Skip to content

Commit

Permalink
hyperv: Add support for vNIC hot removal
Browse files Browse the repository at this point in the history
This patch adds proper handling of the vNIC hot removal event, which includes
a rescind-channel-offer message from the host side that triggers vNIC close and
removal. In this case, the notices to the host during close and removal is not
necessary because the channel is rescinded. This patch blocks these unnecessary
messages, and lets vNIC removal process complete normally.

Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Reviewed-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Haiyang Zhang authored and David S. Miller committed Dec 9, 2014
1 parent 6867b17 commit c3582a2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/hv/channel_mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,8 @@ static void vmbus_onoffer_rescind(struct vmbus_channel_message_header *hdr)
/* Just return here, no channel found */
return;

channel->rescind = true;

/* work is initialized for vmbus_process_rescind_offer() from
* vmbus_process_offer() where the channel got created */
queue_work(channel->controlwq, &channel->work);
Expand Down
3 changes: 3 additions & 0 deletions drivers/net/hyperv/netvsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,9 @@ int netvsc_send(struct hv_device *device,
out_channel = device->channel;
packet->channel = out_channel;

if (out_channel->rescind)
return -ENODEV;

if (packet->page_buf_cnt) {
ret = vmbus_sendpacket_pagebuffer(out_channel,
packet->page_buf,
Expand Down
3 changes: 3 additions & 0 deletions drivers/net/hyperv/rndis_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,9 @@ static int rndis_filter_close_device(struct rndis_device *dev)
return 0;

ret = rndis_filter_set_packet_filter(dev, 0);
if (ret == -ENODEV)
ret = 0;

if (ret == 0)
dev->state = RNDIS_DEV_INITIALIZED;

Expand Down
2 changes: 2 additions & 0 deletions include/linux/hyperv.h
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,8 @@ struct vmbus_channel {
u8 monitor_grp;
u8 monitor_bit;

bool rescind; /* got rescind msg */

u32 ringbuffer_gpadlhandle;

/* Allocated memory for ring buffer */
Expand Down

0 comments on commit c3582a2

Please sign in to comment.