Skip to content

Commit c3582a2

Browse files
haiyangzdavem330
authored andcommitted
hyperv: Add support for vNIC hot removal
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>
1 parent 6867b17 commit c3582a2

File tree

4 files changed

+10
-0
lines changed

4 files changed

+10
-0
lines changed

drivers/hv/channel_mgmt.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,8 @@ static void vmbus_onoffer_rescind(struct vmbus_channel_message_header *hdr)
517517
/* Just return here, no channel found */
518518
return;
519519

520+
channel->rescind = true;
521+
520522
/* work is initialized for vmbus_process_rescind_offer() from
521523
* vmbus_process_offer() where the channel got created */
522524
queue_work(channel->controlwq, &channel->work);

drivers/net/hyperv/netvsc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,9 @@ int netvsc_send(struct hv_device *device,
764764
out_channel = device->channel;
765765
packet->channel = out_channel;
766766

767+
if (out_channel->rescind)
768+
return -ENODEV;
769+
767770
if (packet->page_buf_cnt) {
768771
ret = vmbus_sendpacket_pagebuffer(out_channel,
769772
packet->page_buf,

drivers/net/hyperv/rndis_filter.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -958,6 +958,9 @@ static int rndis_filter_close_device(struct rndis_device *dev)
958958
return 0;
959959

960960
ret = rndis_filter_set_packet_filter(dev, 0);
961+
if (ret == -ENODEV)
962+
ret = 0;
963+
961964
if (ret == 0)
962965
dev->state = RNDIS_DEV_INITIALIZED;
963966

include/linux/hyperv.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,8 @@ struct vmbus_channel {
650650
u8 monitor_grp;
651651
u8 monitor_bit;
652652

653+
bool rescind; /* got rescind msg */
654+
653655
u32 ringbuffer_gpadlhandle;
654656

655657
/* Allocated memory for ring buffer */

0 commit comments

Comments
 (0)