tree:   https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git 
testing/next
head:   f463883ae099b7e98e8ea0a6b9c8dbd05217d94a
commit: 4e4a058b2f048b009b7826e6404ec5133563417e [45/52] usb/gadget/NCM: 
Replace tasklet with softirq hrtimer
config: x86_64-randconfig-x014-201743 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        git checkout 4e4a058b2f048b009b7826e6404ec5133563417e
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/usb/gadget/function/f_ncm.c: In function 'ncm_wrap_ntb':
>> drivers/usb/gadget/function/f_ncm.c:1109:10: error: 'HRTIMER_MODE_REL_SOFT' 
>> undeclared (first use in this function)
             HRTIMER_MODE_REL_SOFT);
             ^~~~~~~~~~~~~~~~~~~~~
   drivers/usb/gadget/function/f_ncm.c:1109:10: note: each undeclared 
identifier is reported only once for each function it appears in
   drivers/usb/gadget/function/f_ncm.c: In function 'ncm_bind':
   drivers/usb/gadget/function/f_ncm.c:1506:50: error: 'HRTIMER_MODE_REL_SOFT' 
undeclared (first use in this function)
     hrtimer_init(&ncm->task_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_SOFT);
                                                     ^~~~~~~~~~~~~~~~~~~~~

vim +/HRTIMER_MODE_REL_SOFT +1109 drivers/usb/gadget/function/f_ncm.c

  1015  
  1016  static struct sk_buff *ncm_wrap_ntb(struct gether *port,
  1017                                      struct sk_buff *skb)
  1018  {
  1019          struct f_ncm    *ncm = func_to_ncm(&port->func);
  1020          struct sk_buff  *skb2 = NULL;
  1021          int             ncb_len = 0;
  1022          __le16          *ntb_data;
  1023          __le16          *ntb_ndp;
  1024          int             dgram_pad;
  1025  
  1026          unsigned        max_size = ncm->port.fixed_in_len;
  1027          const struct ndp_parser_opts *opts = ncm->parser_opts;
  1028          const int ndp_align = 
le16_to_cpu(ntb_parameters.wNdpInAlignment);
  1029          const int div = le16_to_cpu(ntb_parameters.wNdpInDivisor);
  1030          const int rem = 
le16_to_cpu(ntb_parameters.wNdpInPayloadRemainder);
  1031          const int dgram_idx_len = 2 * 2 * opts->dgram_item_len;
  1032  
  1033          if (!skb && !ncm->skb_tx_data)
  1034                  return NULL;
  1035  
  1036          if (skb) {
  1037                  /* Add the CRC if required up front */
  1038                  if (ncm->is_crc) {
  1039                          uint32_t        crc;
  1040                          __le16          *crc_pos;
  1041  
  1042                          crc = ~crc32_le(~0,
  1043                                          skb->data,
  1044                                          skb->len);
  1045                          crc_pos = skb_put(skb, sizeof(uint32_t));
  1046                          put_unaligned_le32(crc, crc_pos);
  1047                  }
  1048  
  1049                  /* If the new skb is too big for the current NCM NTB 
then
  1050                   * set the current stored skb to be sent now and clear 
it
  1051                   * ready for new data.
  1052                   * NOTE: Assume maximum align for speed of calculation.
  1053                   */
  1054                  if (ncm->skb_tx_data
  1055                      && (ncm->ndp_dgram_count >= TX_MAX_NUM_DPE
  1056                      || (ncm->skb_tx_data->len +
  1057                      div + rem + skb->len +
  1058                      ncm->skb_tx_ndp->len + ndp_align + (2 * 
dgram_idx_len))
  1059                      > max_size)) {
  1060                          skb2 = package_for_tx(ncm);
  1061                          if (!skb2)
  1062                                  goto err;
  1063                  }
  1064  
  1065                  if (!ncm->skb_tx_data) {
  1066                          ncb_len = opts->nth_size;
  1067                          dgram_pad = ALIGN(ncb_len, div) + rem - ncb_len;
  1068                          ncb_len += dgram_pad;
  1069  
  1070                          /* Create a new skb for the NTH and datagrams. 
*/
  1071                          ncm->skb_tx_data = alloc_skb(max_size, 
GFP_ATOMIC);
  1072                          if (!ncm->skb_tx_data)
  1073                                  goto err;
  1074  
  1075                          ncm->skb_tx_data->dev = ncm->netdev;
  1076                          ntb_data = skb_put_zero(ncm->skb_tx_data, 
ncb_len);
  1077                          /* dwSignature */
  1078                          put_unaligned_le32(opts->nth_sign, ntb_data);
  1079                          ntb_data += 2;
  1080                          /* wHeaderLength */
  1081                          put_unaligned_le16(opts->nth_size, ntb_data++);
  1082  
  1083                          /* Allocate an skb for storing the NDP,
  1084                           * TX_MAX_NUM_DPE should easily suffice for a
  1085                           * 16k packet.
  1086                           */
  1087                          ncm->skb_tx_ndp = alloc_skb((int)(opts->ndp_size
  1088                                                      + opts->dpe_size
  1089                                                      * TX_MAX_NUM_DPE),
  1090                                                      GFP_ATOMIC);
  1091                          if (!ncm->skb_tx_ndp)
  1092                                  goto err;
  1093  
  1094                          ncm->skb_tx_ndp->dev = ncm->netdev;
  1095                          ntb_ndp = skb_put(ncm->skb_tx_ndp, 
opts->ndp_size);
  1096                          memset(ntb_ndp, 0, ncb_len);
  1097                          /* dwSignature */
  1098                          put_unaligned_le32(ncm->ndp_sign, ntb_ndp);
  1099                          ntb_ndp += 2;
  1100  
  1101                          /* There is always a zeroed entry */
  1102                          ncm->ndp_dgram_count = 1;
  1103  
  1104                          /* Note: we skip opts->next_ndp_index */
  1105                  }
  1106  
  1107                  /* Delay the timer. */
  1108                  hrtimer_start(&ncm->task_timer, TX_TIMEOUT_NSECS,
> 1109                                HRTIMER_MODE_REL_SOFT);
  1110  
  1111                  /* Add the datagram position entries */
  1112                  ntb_ndp = skb_put_zero(ncm->skb_tx_ndp, dgram_idx_len);
  1113  
  1114                  ncb_len = ncm->skb_tx_data->len;
  1115                  dgram_pad = ALIGN(ncb_len, div) + rem - ncb_len;
  1116                  ncb_len += dgram_pad;
  1117  
  1118                  /* (d)wDatagramIndex */
  1119                  put_ncm(&ntb_ndp, opts->dgram_item_len, ncb_len);
  1120                  /* (d)wDatagramLength */
  1121                  put_ncm(&ntb_ndp, opts->dgram_item_len, skb->len);
  1122                  ncm->ndp_dgram_count++;
  1123  
  1124                  /* Add the new data to the skb */
  1125                  skb_put_zero(ncm->skb_tx_data, dgram_pad);
  1126                  skb_put_data(ncm->skb_tx_data, skb->data, skb->len);
  1127                  dev_consume_skb_any(skb);
  1128                  skb = NULL;
  1129  
  1130          } else if (ncm->skb_tx_data && ncm->timer_force_tx) {
  1131                  /* If the tx was requested because of a timeout then 
send */
  1132                  skb2 = package_for_tx(ncm);
  1133                  if (!skb2)
  1134                          goto err;
  1135          }
  1136  
  1137          return skb2;
  1138  
  1139  err:
  1140          ncm->netdev->stats.tx_dropped++;
  1141  
  1142          if (skb)
  1143                  dev_kfree_skb_any(skb);
  1144          if (ncm->skb_tx_data)
  1145                  dev_kfree_skb_any(ncm->skb_tx_data);
  1146          if (ncm->skb_tx_ndp)
  1147                  dev_kfree_skb_any(ncm->skb_tx_ndp);
  1148  
  1149          return NULL;
  1150  }
  1151  

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip

Reply via email to