Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Haiyang Zhang and committed by
David S. Miller
c3582a2c 6867b17b

+10
+2
drivers/hv/channel_mgmt.c
··· 517 517 /* Just return here, no channel found */ 518 518 return; 519 519 520 + channel->rescind = true; 521 + 520 522 /* work is initialized for vmbus_process_rescind_offer() from 521 523 * vmbus_process_offer() where the channel got created */ 522 524 queue_work(channel->controlwq, &channel->work);
+3
drivers/net/hyperv/netvsc.c
··· 764 764 out_channel = device->channel; 765 765 packet->channel = out_channel; 766 766 767 + if (out_channel->rescind) 768 + return -ENODEV; 769 + 767 770 if (packet->page_buf_cnt) { 768 771 ret = vmbus_sendpacket_pagebuffer(out_channel, 769 772 packet->page_buf,
+3
drivers/net/hyperv/rndis_filter.c
··· 958 958 return 0; 959 959 960 960 ret = rndis_filter_set_packet_filter(dev, 0); 961 + if (ret == -ENODEV) 962 + ret = 0; 963 + 961 964 if (ret == 0) 962 965 dev->state = RNDIS_DEV_INITIALIZED; 963 966
+2
include/linux/hyperv.h
··· 650 650 u8 monitor_grp; 651 651 u8 monitor_bit; 652 652 653 + bool rescind; /* got rescind msg */ 654 + 653 655 u32 ringbuffer_gpadlhandle; 654 656 655 657 /* Allocated memory for ring buffer */