@@ -243,18 +243,15 @@ static void netvsc_destroy_buf(struct hv_device *device)
243
243
kfree (net_device -> send_section_map );
244
244
}
245
245
246
- static int netvsc_init_buf (struct hv_device * device )
246
+ static int netvsc_init_buf (struct hv_device * device ,
247
+ struct netvsc_device * net_device )
247
248
{
248
249
int ret = 0 ;
249
- struct netvsc_device * net_device ;
250
250
struct nvsp_message * init_packet ;
251
251
struct net_device * ndev ;
252
252
size_t map_words ;
253
253
int node ;
254
254
255
- net_device = get_outbound_net_device (device );
256
- if (!net_device )
257
- return - ENODEV ;
258
255
ndev = hv_get_drvdata (device );
259
256
260
257
node = cpu_to_node (device -> channel -> target_cpu );
@@ -285,9 +282,7 @@ static int netvsc_init_buf(struct hv_device *device)
285
282
286
283
/* Notify the NetVsp of the gpadl handle */
287
284
init_packet = & net_device -> channel_init_pkt ;
288
-
289
285
memset (init_packet , 0 , sizeof (struct nvsp_message ));
290
-
291
286
init_packet -> hdr .msg_type = NVSP_MSG1_TYPE_SEND_RECV_BUF ;
292
287
init_packet -> msg .v1_msg .send_recv_buf .
293
288
gpadl_handle = net_device -> recv_buf_gpadl_handle ;
@@ -486,20 +481,15 @@ static int negotiate_nvsp_ver(struct hv_device *device,
486
481
return ret ;
487
482
}
488
483
489
- static int netvsc_connect_vsp (struct hv_device * device )
484
+ static int netvsc_connect_vsp (struct hv_device * device ,
485
+ struct netvsc_device * net_device )
490
486
{
491
- int ret ;
492
- struct netvsc_device * net_device ;
493
- struct nvsp_message * init_packet ;
494
- int ndis_version ;
495
487
const u32 ver_list [] = {
496
488
NVSP_PROTOCOL_VERSION_1 , NVSP_PROTOCOL_VERSION_2 ,
497
- NVSP_PROTOCOL_VERSION_4 , NVSP_PROTOCOL_VERSION_5 };
498
- int i ;
499
-
500
- net_device = get_outbound_net_device (device );
501
- if (!net_device )
502
- return - ENODEV ;
489
+ NVSP_PROTOCOL_VERSION_4 , NVSP_PROTOCOL_VERSION_5
490
+ };
491
+ struct nvsp_message * init_packet ;
492
+ int ndis_version , i , ret ;
503
493
504
494
init_packet = & net_device -> channel_init_pkt ;
505
495
@@ -549,7 +539,7 @@ static int netvsc_connect_vsp(struct hv_device *device)
549
539
net_device -> recv_buf_size = NETVSC_RECEIVE_BUFFER_SIZE ;
550
540
net_device -> send_buf_size = NETVSC_SEND_BUFFER_SIZE ;
551
541
552
- ret = netvsc_init_buf (device );
542
+ ret = netvsc_init_buf (device , net_device );
553
543
554
544
cleanup :
555
545
return ret ;
@@ -1349,7 +1339,7 @@ int netvsc_device_add(struct hv_device *device,
1349
1339
rcu_assign_pointer (net_device_ctx -> nvdev , net_device );
1350
1340
1351
1341
/* Connect with the NetVsp */
1352
- ret = netvsc_connect_vsp (device );
1342
+ ret = netvsc_connect_vsp (device , net_device );
1353
1343
if (ret != 0 ) {
1354
1344
netdev_err (ndev ,
1355
1345
"unable to connect to NetVSP - %d\n" , ret );
@@ -1368,4 +1358,5 @@ int netvsc_device_add(struct hv_device *device,
1368
1358
free_netvsc_device (& net_device -> rcu );
1369
1359
1370
1360
return ret ;
1361
+
1371
1362
}
0 commit comments