Commit 35fbbccf authored by stephen hemminger's avatar stephen hemminger Committed by David S. Miller

netvsc: save pointer to parent netvsc_device in channel table

Keep back pointer in the per-channel data structure to
avoid any possible RCU related issues when napi poll is
called but netvsc_device is in RCU limbo.
Signed-off-by: default avatarStephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2a926f79
...@@ -727,6 +727,7 @@ struct net_device_context { ...@@ -727,6 +727,7 @@ struct net_device_context {
/* Per channel data */ /* Per channel data */
struct netvsc_channel { struct netvsc_channel {
struct vmbus_channel *channel; struct vmbus_channel *channel;
struct netvsc_device *net_device;
const struct vmpacket_descriptor *desc; const struct vmpacket_descriptor *desc;
struct napi_struct napi; struct napi_struct napi;
struct multi_send_data msd; struct multi_send_data msd;
......
...@@ -1224,11 +1224,11 @@ int netvsc_poll(struct napi_struct *napi, int budget) ...@@ -1224,11 +1224,11 @@ int netvsc_poll(struct napi_struct *napi, int budget)
{ {
struct netvsc_channel *nvchan struct netvsc_channel *nvchan
= container_of(napi, struct netvsc_channel, napi); = container_of(napi, struct netvsc_channel, napi);
struct netvsc_device *net_device = nvchan->net_device;
struct vmbus_channel *channel = nvchan->channel; struct vmbus_channel *channel = nvchan->channel;
struct hv_device *device = netvsc_channel_to_device(channel); struct hv_device *device = netvsc_channel_to_device(channel);
u16 q_idx = channel->offermsg.offer.sub_channel_index; u16 q_idx = channel->offermsg.offer.sub_channel_index;
struct net_device *ndev = hv_get_drvdata(device); struct net_device *ndev = hv_get_drvdata(device);
struct netvsc_device *net_device = net_device_to_netvsc_device(ndev);
int work_done = 0; int work_done = 0;
/* If starting a new interval */ /* If starting a new interval */
...@@ -1307,6 +1307,7 @@ struct netvsc_device *netvsc_device_add(struct hv_device *device, ...@@ -1307,6 +1307,7 @@ struct netvsc_device *netvsc_device_add(struct hv_device *device,
struct netvsc_channel *nvchan = &net_device->chan_table[i]; struct netvsc_channel *nvchan = &net_device->chan_table[i];
nvchan->channel = device->channel; nvchan->channel = device->channel;
nvchan->net_device = net_device;
} }
/* Enable NAPI handler before init callbacks */ /* Enable NAPI handler before init callbacks */
......
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