[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <PH7PR21MB31162F5F9E5C8C146760AF10CA809@PH7PR21MB3116.namprd21.prod.outlook.com>
Date: Mon, 20 Mar 2023 01:47:18 +0000
From: Haiyang Zhang <haiyangz@...rosoft.com>
To: Francois Romieu <romieu@...zoreil.com>
CC: "linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Dexuan Cui <decui@...rosoft.com>,
KY Srinivasan <kys@...rosoft.com>,
Paul Rosswurm <paulros@...rosoft.com>,
"olaf@...fle.de" <olaf@...fle.de>,
"vkuznets@...hat.com" <vkuznets@...hat.com>,
"davem@...emloft.net" <davem@...emloft.net>,
"wei.liu@...nel.org" <wei.liu@...nel.org>,
"edumazet@...gle.com" <edumazet@...gle.com>,
"kuba@...nel.org" <kuba@...nel.org>,
"pabeni@...hat.com" <pabeni@...hat.com>,
"leon@...nel.org" <leon@...nel.org>,
Long Li <longli@...rosoft.com>,
"ssengar@...ux.microsoft.com" <ssengar@...ux.microsoft.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH net-next] net: mana: Add support for jumbo frame
> -----Original Message-----
> From: Francois Romieu <romieu@...zoreil.com>
> Sent: Sunday, March 19, 2023 6:47 PM
> To: Haiyang Zhang <haiyangz@...rosoft.com>
> Cc: linux-hyperv@...r.kernel.org; netdev@...r.kernel.org; Dexuan Cui
> <decui@...rosoft.com>; KY Srinivasan <kys@...rosoft.com>; Paul Rosswurm
> <paulros@...rosoft.com>; olaf@...fle.de; vkuznets@...hat.com;
> davem@...emloft.net; wei.liu@...nel.org; edumazet@...gle.com;
> kuba@...nel.org; pabeni@...hat.com; leon@...nel.org; Long Li
> <longli@...rosoft.com>; ssengar@...ux.microsoft.com; linux-
> kernel@...r.kernel.org
> Subject: Re: [PATCH net-next] net: mana: Add support for jumbo frame
>
> [Some people who received this message don't often get email from
> romieu@...zoreil.com. Learn why this is important at
> https://aka.ms/LearnAboutSenderIdentification ]
>
> Haiyang Zhang <haiyangz@...rosoft.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 ?
No, it doesn't make the driver less reliable. To safely remove and reallocate
DMA buffers with different size, we have to stop the traffic. So, mana_detach()
is called. We also call mana_detach() in mana_close(). So the process in
mana_change_mtu() is no more risky than ifdown/ifup of the NIC.
In some rare cases, if the system memory is running really low, the bigger
buffer allocation may fail, so we re-try with the previous MTU. I don't expect
it to fail again. But we still check & log the error code for completeness and
debugging.
Thanks,
- Haiyang
Powered by blists - more mailing lists