Commit de12e4fb authored by David S. Miller's avatar David S. Miller

Merge branch 'netvsc-fix-module-removal-hangs'

Stephen Hemminger says:

====================
netvsc: fix module removal hangs

A couple of patches are necessary to make netvsc driver module
removable again.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 115a731e 79cd874c
...@@ -91,15 +91,6 @@ static void free_netvsc_device(struct netvsc_device *nvdev) ...@@ -91,15 +91,6 @@ static void free_netvsc_device(struct netvsc_device *nvdev)
} }
static inline bool netvsc_channel_idle(const struct netvsc_device *net_device,
u16 q_idx)
{
const struct netvsc_channel *nvchan = &net_device->chan_table[q_idx];
return atomic_read(&net_device->num_outstanding_recvs) == 0 &&
atomic_read(&nvchan->queue_sends) == 0;
}
static struct netvsc_device *get_outbound_net_device(struct hv_device *device) static struct netvsc_device *get_outbound_net_device(struct hv_device *device)
{ {
struct netvsc_device *net_device = hv_device_to_netvsc_device(device); struct netvsc_device *net_device = hv_device_to_netvsc_device(device);
...@@ -571,8 +562,8 @@ void netvsc_device_remove(struct hv_device *device) ...@@ -571,8 +562,8 @@ void netvsc_device_remove(struct hv_device *device)
/* Now, we can close the channel safely */ /* Now, we can close the channel safely */
vmbus_close(device->channel); vmbus_close(device->channel);
for (i = 0; i < VRSS_CHANNEL_MAX; i++) for (i = 0; i < net_device->num_chn; i++)
napi_disable(&net_device->chan_table[0].napi); napi_disable(&net_device->chan_table[i].napi);
/* Release all resources */ /* Release all resources */
free_netvsc_device(net_device); free_netvsc_device(net_device);
...@@ -1273,13 +1264,10 @@ void netvsc_channel_cb(void *context) ...@@ -1273,13 +1264,10 @@ void netvsc_channel_cb(void *context)
if (unlikely(!ndev)) if (unlikely(!ndev))
return; return;
net_device = net_device_to_netvsc_device(ndev);
if (unlikely(net_device->destroy) &&
netvsc_channel_idle(net_device, q_idx))
return;
/* disable interupts from host */ /* disable interupts from host */
hv_begin_read(&channel->inbound); hv_begin_read(&channel->inbound);
net_device = net_device_to_netvsc_device(ndev);
napi_schedule(&net_device->chan_table[q_idx].napi); napi_schedule(&net_device->chan_table[q_idx].napi);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment