Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Dexuan Cui <decui@microsoft.com>
Cc: wei.liu@kernel.org, kys@microsoft.com, haiyangz@microsoft.com,
sthemmin@microsoft.com, davem@davemloft.net,
linux-hyperv@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, mikelley@microsoft.com
Subject: Re: [PATCH net] hv_netvsc: Fix hibernation for mlx5 VF driver
Date: Sat, 5 Sep 2020 16:27:12 -0700 [thread overview]
Message-ID: <20200905162712.65b886a4@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> (raw)
In-Reply-To: <20200905025218.45268-1-decui@microsoft.com>
On Fri, 4 Sep 2020 19:52:18 -0700 Dexuan Cui wrote:
> mlx5_suspend()/resume() keep the network interface, so during hibernation
> netvsc_unregister_vf() and netvsc_register_vf() are not called, and hence
> netvsc_resume() should call netvsc_vf_changed() to switch the data path
> back to the VF after hibernation.
Does suspending the system automatically switch back to the synthetic
datapath? Please clarify this in the commit message and/or add a code
comment.
> Similarly, netvsc_suspend() should not call netvsc_unregister_vf().
>
> BTW, mlx4_suspend()/resume() are differnt in that they destroy and
> re-create the network device, so netvsc_register_vf() and
> netvsc_unregister_vf() are automatically called. Note: mlx4 can also work
> with the changes here because in netvsc_suspend()/resume()
> ndev_ctx->vf_netdev is NULL for mlx4.
>
> Fixes: 0efeea5fb153 ("hv_netvsc: Add the support of hibernation")
> Signed-off-by: Dexuan Cui <decui@microsoft.com>
> ---
> drivers/net/hyperv/netvsc_drv.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
> index 64b0a74c1523..f896059a9588 100644
> --- a/drivers/net/hyperv/netvsc_drv.c
> +++ b/drivers/net/hyperv/netvsc_drv.c
> @@ -2587,7 +2587,7 @@ static int netvsc_remove(struct hv_device *dev)
> static int netvsc_suspend(struct hv_device *dev)
> {
> struct net_device_context *ndev_ctx;
> - struct net_device *vf_netdev, *net;
> + struct net_device *net;
> struct netvsc_device *nvdev;
> int ret;
Please keep reverse xmas tree variable ordering.
> @@ -2604,10 +2604,6 @@ static int netvsc_suspend(struct hv_device *dev)
> goto out;
> }
>
> - vf_netdev = rtnl_dereference(ndev_ctx->vf_netdev);
> - if (vf_netdev)
> - netvsc_unregister_vf(vf_netdev);
> -
> /* Save the current config info */
> ndev_ctx->saved_netvsc_dev_info = netvsc_devinfo_get(nvdev);
>
> @@ -2623,6 +2619,7 @@ 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();
> @@ -2635,6 +2632,10 @@ static int netvsc_resume(struct hv_device *dev)
> netvsc_devinfo_put(device_info);
> net_device_ctx->saved_netvsc_dev_info = NULL;
>
> + vf_netdev = rtnl_dereference(net_device_ctx->vf_netdev);
> + if (vf_netdev && netvsc_vf_changed(vf_netdev) != NOTIFY_OK)
> + ret = -EINVAL;
Should you perhaps remove the VF in case of the failure?
> rtnl_unlock();
>
> return ret;
next prev parent reply other threads:[~2020-09-05 23:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-05 2:52 Dexuan Cui
2020-09-05 23:27 ` Jakub Kicinski [this message]
2020-09-06 3:05 ` Dexuan Cui
2020-09-06 16:26 ` Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200905162712.65b886a4@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com \
--to=kuba@kernel.org \
--cc=davem@davemloft.net \
--cc=decui@microsoft.com \
--cc=haiyangz@microsoft.com \
--cc=kys@microsoft.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mikelley@microsoft.com \
--cc=netdev@vger.kernel.org \
--cc=sthemmin@microsoft.com \
--cc=wei.liu@kernel.org \
--subject='Re: [PATCH net] hv_netvsc: Fix hibernation for mlx5 VF driver' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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).