Skip to content

Commit

Permalink
hv_netvsc: Process NETDEV_GOING_DOWN on VF hot remove
Browse files Browse the repository at this point in the history
On VF hot remove, NETDEV_GOING_DOWN is sent to notify the VF is about to
go down. At this time, the VF is still sending/receiving traffic and we
request the VSP to switch datapath.

On completion, the datapath is switched to synthetic and we can proceed
with VF hot remove.

Signed-off-by: Long Li <longli@microsoft.com>
Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Long Li authored and Jakub Kicinski committed Jan 13, 2021
1 parent 8b31f8c commit 34b06a2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions drivers/net/hyperv/netvsc_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -2382,12 +2382,15 @@ static int netvsc_register_vf(struct net_device *vf_netdev)
* During hibernation, if a VF NIC driver (e.g. mlx5) preserves the network
* interface, there is only the CHANGE event and no UP or DOWN event.
*/
static int netvsc_vf_changed(struct net_device *vf_netdev)
static int netvsc_vf_changed(struct net_device *vf_netdev, unsigned long event)
{
struct net_device_context *net_device_ctx;
struct netvsc_device *netvsc_dev;
struct net_device *ndev;
bool vf_is_up = netif_running(vf_netdev);
bool vf_is_up = false;

if (event != NETDEV_GOING_DOWN)
vf_is_up = netif_running(vf_netdev);

ndev = get_netvsc_byref(vf_netdev);
if (!ndev)
Expand Down Expand Up @@ -2716,7 +2719,8 @@ static int netvsc_netdev_event(struct notifier_block *this,
case NETDEV_UP:
case NETDEV_DOWN:
case NETDEV_CHANGE:
return netvsc_vf_changed(event_dev);
case NETDEV_GOING_DOWN:
return netvsc_vf_changed(event_dev, event);
default:
return NOTIFY_DONE;
}
Expand Down

0 comments on commit 34b06a2

Please sign in to comment.