Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
forked fromtorvalds/linux

Commit0cf7378

Browse files
vittyvkdavem330
authored andcommitted
hv_netvsc: netvsc_teardown_gpadl() split
It was found that in some cases host refuses to teardown GPADL for send/receive buffers (probably when some work with these buffere is scheduled orongoing). Change the teardown logic to be:1) Send NVSP_MSG1_TYPE_REVOKE_* messages2) Close the channel3) Teardown GPADLs.This seems to work reliably.Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent3928ee6 commit0cf7378

File tree

1 file changed

+36
-33
lines changed

1 file changed

+36
-33
lines changed

‎drivers/net/hyperv/netvsc.c‎

Lines changed: 36 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,11 @@ static void free_netvsc_device_rcu(struct netvsc_device *nvdev)
100100
call_rcu(&nvdev->rcu,free_netvsc_device);
101101
}
102102

103-
staticvoidnetvsc_destroy_buf(structhv_device*device)
103+
staticvoidnetvsc_revoke_buf(structhv_device*device,
104+
structnetvsc_device*net_device)
104105
{
105106
structnvsp_message*revoke_packet;
106107
structnet_device*ndev=hv_get_drvdata(device);
107-
structnet_device_context*ndc=netdev_priv(ndev);
108-
structnetvsc_device*net_device=rtnl_dereference(ndc->nvdev);
109108
intret;
110109

111110
/*
@@ -148,28 +147,6 @@ static void netvsc_destroy_buf(struct hv_device *device)
148147
net_device->recv_section_cnt=0;
149148
}
150149

151-
/* Teardown the gpadl on the vsp end */
152-
if (net_device->recv_buf_gpadl_handle) {
153-
ret=vmbus_teardown_gpadl(device->channel,
154-
net_device->recv_buf_gpadl_handle);
155-
156-
/* If we failed here, we might as well return and have a leak
157-
* rather than continue and a bugchk
158-
*/
159-
if (ret!=0) {
160-
netdev_err(ndev,
161-
"unable to teardown receive buffer's gpadl\n");
162-
return;
163-
}
164-
net_device->recv_buf_gpadl_handle=0;
165-
}
166-
167-
if (net_device->recv_buf) {
168-
/* Free up the receive buffer */
169-
vfree(net_device->recv_buf);
170-
net_device->recv_buf=NULL;
171-
}
172-
173150
/* Deal with the send buffer we may have setup.
174151
* If we got a send section size, it means we received a
175152
* NVSP_MSG1_TYPE_SEND_SEND_BUF_COMPLETE msg (ie sent
@@ -210,7 +187,35 @@ static void netvsc_destroy_buf(struct hv_device *device)
210187
}
211188
net_device->send_section_cnt=0;
212189
}
213-
/* Teardown the gpadl on the vsp end */
190+
}
191+
192+
staticvoidnetvsc_teardown_gpadl(structhv_device*device,
193+
structnetvsc_device*net_device)
194+
{
195+
structnet_device*ndev=hv_get_drvdata(device);
196+
intret;
197+
198+
if (net_device->recv_buf_gpadl_handle) {
199+
ret=vmbus_teardown_gpadl(device->channel,
200+
net_device->recv_buf_gpadl_handle);
201+
202+
/* If we failed here, we might as well return and have a leak
203+
* rather than continue and a bugchk
204+
*/
205+
if (ret!=0) {
206+
netdev_err(ndev,
207+
"unable to teardown receive buffer's gpadl\n");
208+
return;
209+
}
210+
net_device->recv_buf_gpadl_handle=0;
211+
}
212+
213+
if (net_device->recv_buf) {
214+
/* Free up the receive buffer */
215+
vfree(net_device->recv_buf);
216+
net_device->recv_buf=NULL;
217+
}
218+
214219
if (net_device->send_buf_gpadl_handle) {
215220
ret=vmbus_teardown_gpadl(device->channel,
216221
net_device->send_buf_gpadl_handle);
@@ -420,7 +425,8 @@ static int netvsc_init_buf(struct hv_device *device,
420425
gotoexit;
421426

422427
cleanup:
423-
netvsc_destroy_buf(device);
428+
netvsc_revoke_buf(device,net_device);
429+
netvsc_teardown_gpadl(device,net_device);
424430

425431
exit:
426432
returnret;
@@ -539,11 +545,6 @@ static int netvsc_connect_vsp(struct hv_device *device,
539545
returnret;
540546
}
541547

542-
staticvoidnetvsc_disconnect_vsp(structhv_device*device)
543-
{
544-
netvsc_destroy_buf(device);
545-
}
546-
547548
/*
548549
* netvsc_device_remove - Callback when the root bus device is removed
549550
*/
@@ -557,7 +558,7 @@ void netvsc_device_remove(struct hv_device *device)
557558

558559
cancel_work_sync(&net_device->subchan_work);
559560

560-
netvsc_disconnect_vsp(device);
561+
netvsc_revoke_buf(device,net_device);
561562

562563
RCU_INIT_POINTER(net_device_ctx->nvdev,NULL);
563564

@@ -570,6 +571,8 @@ void netvsc_device_remove(struct hv_device *device)
570571
/* Now, we can close the channel safely */
571572
vmbus_close(device->channel);
572573

574+
netvsc_teardown_gpadl(device,net_device);
575+
573576
/* And dissassociate NAPI context from device */
574577
for (i=0;i<net_device->num_chn;i++)
575578
netif_napi_del(&net_device->chan_table[i].napi);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp