tree: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git master head: 3578a7ecb69920efc3885dbd610e98c00dbdf5db commit: 916c5e1413be058d1c1f6e502db350df890730ce [66/72] hv/netvsc: fix handling of fallback to single queue mode reproduce: # apt-get install sparse git checkout 916c5e1413be058d1c1f6e502db350df890730ce make ARCH=x86_64 allmodconfig make C=1 CF=-D__CHECK_ENDIAN__
sparse warnings: (new ones prefixed by >>) drivers/net/hyperv/rndis_filter.c:1307:31: sparse: expression using sizeof(void) drivers/net/hyperv/rndis_filter.c:1307:31: sparse: expression using sizeof(void) drivers/net/hyperv/rndis_filter.c:1310:31: sparse: expression using sizeof(void) drivers/net/hyperv/rndis_filter.c:1313:31: sparse: expression using sizeof(void) drivers/net/hyperv/rndis_filter.c:1313:31: sparse: expression using sizeof(void) >> drivers/net/hyperv/rndis_filter.c:1341:16: sparse: Using plain integer as >> NULL pointer vim +1341 drivers/net/hyperv/rndis_filter.c 1224 1225 struct netvsc_device *rndis_filter_device_add(struct hv_device *dev, 1226 struct netvsc_device_info *device_info) 1227 { 1228 struct net_device *net = hv_get_drvdata(dev); 1229 struct netvsc_device *net_device; 1230 struct rndis_device *rndis_device; 1231 struct ndis_recv_scale_cap rsscap; 1232 u32 rsscap_size = sizeof(struct ndis_recv_scale_cap); 1233 u32 mtu, size; 1234 u32 num_possible_rss_qs; 1235 int i, ret; 1236 1237 rndis_device = get_rndis_device(); 1238 if (!rndis_device) 1239 return ERR_PTR(-ENODEV); 1240 1241 /* Let the inner driver handle this first to create the netvsc channel 1242 * NOTE! Once the channel is created, we may get a receive callback 1243 * (RndisFilterOnReceive()) before this call is completed 1244 */ 1245 net_device = netvsc_device_add(dev, device_info); 1246 if (IS_ERR(net_device)) { 1247 kfree(rndis_device); 1248 return net_device; 1249 } 1250 1251 /* Initialize the rndis device */ 1252 net_device->max_chn = 1; 1253 net_device->num_chn = 1; 1254 1255 net_device->extension = rndis_device; 1256 rndis_device->ndev = net; 1257 1258 /* Send the rndis initialization message */ 1259 ret = rndis_filter_init_device(rndis_device, net_device); 1260 if (ret != 0) 1261 goto err_dev_remv; 1262 1263 /* Get the MTU from the host */ 1264 size = sizeof(u32); 1265 ret = rndis_filter_query_device(rndis_device, net_device, 1266 RNDIS_OID_GEN_MAXIMUM_FRAME_SIZE, 1267 &mtu, &size); 1268 if (ret == 0 && size == sizeof(u32) && mtu < net->mtu) 1269 net->mtu = mtu; 1270 1271 /* Get the mac address */ 1272 ret = rndis_filter_query_device_mac(rndis_device, net_device); 1273 if (ret != 0) 1274 goto err_dev_remv; 1275 1276 memcpy(device_info->mac_adr, rndis_device->hw_mac_adr, ETH_ALEN); 1277 1278 /* Get friendly name as ifalias*/ 1279 if (!net->ifalias) 1280 rndis_get_friendly_name(net, rndis_device, net_device); 1281 1282 /* Query and set hardware capabilities */ 1283 ret = rndis_netdev_set_hwcaps(rndis_device, net_device); 1284 if (ret != 0) 1285 goto err_dev_remv; 1286 1287 rndis_filter_query_device_link_status(rndis_device, net_device); 1288 1289 netdev_dbg(net, "Device MAC %pM link state %s\n", 1290 rndis_device->hw_mac_adr, 1291 rndis_device->link_state ? "down" : "up"); 1292 1293 if (net_device->nvsp_version < NVSP_PROTOCOL_VERSION_5) 1294 goto out; 1295 1296 rndis_filter_query_link_speed(rndis_device, net_device); 1297 1298 /* vRSS setup */ 1299 memset(&rsscap, 0, rsscap_size); 1300 ret = rndis_filter_query_device(rndis_device, net_device, 1301 OID_GEN_RECEIVE_SCALE_CAPABILITIES, 1302 &rsscap, &rsscap_size); 1303 if (ret || rsscap.num_recv_que < 2) 1304 goto out; 1305 1306 /* This guarantees that num_possible_rss_qs <= num_online_cpus */ > 1307 num_possible_rss_qs = min_t(u32, num_online_cpus(), 1308 rsscap.num_recv_que); 1309 1310 net_device->max_chn = min_t(u32, VRSS_CHANNEL_MAX, num_possible_rss_qs); 1311 1312 /* We will use the given number of channels if available. */ 1313 net_device->num_chn = min(net_device->max_chn, device_info->num_chn); 1314 1315 for (i = 0; i < ITAB_NUM; i++) 1316 rndis_device->rx_table[i] = ethtool_rxfh_indir_default( 1317 i, net_device->num_chn); 1318 1319 atomic_set(&net_device->open_chn, 1); 1320 vmbus_set_sc_create_callback(dev->channel, netvsc_sc_open); 1321 1322 for (i = 1; i < net_device->num_chn; i++) { 1323 ret = netvsc_alloc_recv_comp_ring(net_device, i); 1324 if (ret) { 1325 while (--i != 0) 1326 vfree(net_device->chan_table[i].mrc.slots); 1327 goto out; 1328 } 1329 } 1330 1331 for (i = 1; i < net_device->num_chn; i++) 1332 netif_napi_add(net, &net_device->chan_table[i].napi, 1333 netvsc_poll, NAPI_POLL_WEIGHT); 1334 1335 return net_device; 1336 1337 out: 1338 /* setting up multiple channels failed */ 1339 net_device->max_chn = 1; 1340 net_device->num_chn = 1; > 1341 return 0; 1342 1343 err_dev_remv: 1344 rndis_filter_device_remove(dev, net_device); 1345 return ERR_PTR(ret); 1346 } 1347 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation