* [PATCH net 1/2] hv_netvsc: Switch the data path at the right time during hibernation
@ 2020-09-09 4:07 Dexuan Cui
2020-09-10 19:55 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Dexuan Cui @ 2020-09-09 4:07 UTC (permalink / raw)
To: kuba, wei.liu, kys, haiyangz, sthemmin, davem, linux-hyperv,
netdev, linux-kernel, mikelley
Cc: saeedm, markb, Dexuan Cui
When netvsc_resume() is called, the mlx5 VF NIC has not been resumed yet,
so in the future the host might sliently fail the call netvsc_vf_changed()
-> netvsc_switch_datapath() there, even if the call works now.
Call netvsc_vf_changed() in the NETDEV_CHANGE event handler: at that time
the mlx5 VF NIC has been resumed.
Fixes: 19162fd4063a ("hv_netvsc: Fix hibernation for mlx5 VF driver")
Signed-off-by: Dexuan Cui <decui@microsoft.com>
---
drivers/net/hyperv/netvsc_drv.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 81c5c70b616a..4a25886e2346 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -2619,7 +2619,6 @@ static int netvsc_resume(struct hv_device *dev)
struct net_device *net = hv_get_drvdata(dev);
struct net_device_context *net_device_ctx;
struct netvsc_device_info *device_info;
- struct net_device *vf_netdev;
int ret;
rtnl_lock();
@@ -2632,15 +2631,6 @@ static int netvsc_resume(struct hv_device *dev)
netvsc_devinfo_put(device_info);
net_device_ctx->saved_netvsc_dev_info = NULL;
- /* A NIC driver (e.g. mlx5) may keep the VF network interface across
- * hibernation, but here the data path is implicitly switched to the
- * netvsc NIC since the vmbus channel is closed and re-opened, so
- * netvsc_vf_changed() must be used to switch the data path to the VF.
- */
- vf_netdev = rtnl_dereference(net_device_ctx->vf_netdev);
- if (vf_netdev && netvsc_vf_changed(vf_netdev) != NOTIFY_OK)
- ret = -EINVAL;
-
rtnl_unlock();
return ret;
@@ -2701,6 +2691,7 @@ static int netvsc_netdev_event(struct notifier_block *this,
return netvsc_unregister_vf(event_dev);
case NETDEV_UP:
case NETDEV_DOWN:
+ case NETDEV_CHANGE:
return netvsc_vf_changed(event_dev);
default:
return NOTIFY_DONE;
--
2.19.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net 1/2] hv_netvsc: Switch the data path at the right time during hibernation
2020-09-09 4:07 [PATCH net 1/2] hv_netvsc: Switch the data path at the right time during hibernation Dexuan Cui
@ 2020-09-10 19:55 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-09-10 19:55 UTC (permalink / raw)
To: decui
Cc: kuba, wei.liu, kys, haiyangz, sthemmin, linux-hyperv, netdev,
linux-kernel, mikelley, saeedm, markb
From: Dexuan Cui <decui@microsoft.com>
Date: Tue, 8 Sep 2020 21:07:32 -0700
> When netvsc_resume() is called, the mlx5 VF NIC has not been resumed yet,
> so in the future the host might sliently fail the call netvsc_vf_changed()
> -> netvsc_switch_datapath() there, even if the call works now.
>
> Call netvsc_vf_changed() in the NETDEV_CHANGE event handler: at that time
> the mlx5 VF NIC has been resumed.
>
> Fixes: 19162fd4063a ("hv_netvsc: Fix hibernation for mlx5 VF driver")
> Signed-off-by: Dexuan Cui <decui@microsoft.com>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-09-10 19:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-09 4:07 [PATCH net 1/2] hv_netvsc: Switch the data path at the right time during hibernation Dexuan Cui
2020-09-10 19:55 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).