From: Francois Romieu <romieu@fr.zoreil.com>
To: Haiyang Zhang <haiyangz@microsoft.com>
Cc: linux-hyperv@vger.kernel.org, netdev@vger.kernel.org,
decui@microsoft.com, kys@microsoft.com, paulros@microsoft.com,
olaf@aepfle.de, vkuznets@redhat.com, davem@davemloft.net,
wei.liu@kernel.org, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, leon@kernel.org, longli@microsoft.com,
ssengar@linux.microsoft.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] net: mana: Add support for jumbo frame
Date: Sun, 19 Mar 2023 23:46:42 +0100 [thread overview]
Message-ID: <20230319224642.GA239003@electric-eye.fr.zoreil.com> (raw)
In-Reply-To: <1679261264-26375-1-git-send-email-haiyangz@microsoft.com>
Haiyang Zhang <haiyangz@microsoft.com> :
[...]
> diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c
> index 492474b4d8aa..07738b7e85f2 100644
> --- a/drivers/net/ethernet/microsoft/mana/mana_en.c
> +++ b/drivers/net/ethernet/microsoft/mana/mana_en.c
> @@ -427,6 +427,34 @@ static u16 mana_select_queue(struct net_device *ndev, struct sk_buff *skb,
> return txq;
> }
>
> +static int mana_change_mtu(struct net_device *ndev, int new_mtu)
> +{
> + unsigned int old_mtu = ndev->mtu;
> + int err, err2;
> +
> + err = mana_detach(ndev, false);
> + if (err) {
> + netdev_err(ndev, "mana_detach failed: %d\n", err);
> + return err;
> + }
> +
> + ndev->mtu = new_mtu;
> +
> + err = mana_attach(ndev);
> + if (!err)
> + return 0;
> +
> + netdev_err(ndev, "mana_attach failed: %d\n", err);
> +
> + /* Try to roll it back to the old configuration. */
> + ndev->mtu = old_mtu;
> + err2 = mana_attach(ndev);
> + if (err2)
> + netdev_err(ndev, "mana re-attach failed: %d\n", err2);
> +
> + return err;
> +}
I do not see where the driver could depend on the MTU. Even if it fails,
a single call to mana_change_mtu should thus never wreck the old working
state/configuration.
Stated differently, the detach/attach implementation is simple but
it makes the driver less reliable than it could be.
No ?
--
Ueimor
next prev parent reply other threads:[~2023-03-19 22:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-19 21:27 Haiyang Zhang
2023-03-19 22:46 ` Francois Romieu [this message]
2023-03-20 1:47 ` Haiyang Zhang
2023-03-20 11:33 ` Francois Romieu
2023-03-20 15:13 ` Haiyang Zhang
2023-03-20 7:42 ` Leon Romanovsky
2023-03-20 15:14 ` Haiyang Zhang
2023-03-20 9:42 ` Yunsheng Lin
2023-03-20 15:21 ` Haiyang Zhang
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=20230319224642.GA239003@electric-eye.fr.zoreil.com \
--to=romieu@fr.zoreil.com \
--cc=davem@davemloft.net \
--cc=decui@microsoft.com \
--cc=edumazet@google.com \
--cc=haiyangz@microsoft.com \
--cc=kuba@kernel.org \
--cc=kys@microsoft.com \
--cc=leon@kernel.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=longli@microsoft.com \
--cc=netdev@vger.kernel.org \
--cc=olaf@aepfle.de \
--cc=pabeni@redhat.com \
--cc=paulros@microsoft.com \
--cc=ssengar@linux.microsoft.com \
--cc=vkuznets@redhat.com \
--cc=wei.liu@kernel.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®