RE: [PATCH net-next] net: mana: Add support for jumbo frame

From: Haiyang Zhang
Date: Mon Mar 20 2023 - 11:20:21 EST




> -----Original Message-----
> From: Francois Romieu <romieu@xxxxxxxxxxxxx>
> Sent: Monday, March 20, 2023 7:33 AM
> To: Haiyang Zhang <haiyangz@xxxxxxxxxxxxx>
> Cc: linux-hyperv@xxxxxxxxxxxxxxx; netdev@xxxxxxxxxxxxxxx; Dexuan Cui
> <decui@xxxxxxxxxxxxx>; KY Srinivasan <kys@xxxxxxxxxxxxx>; Paul Rosswurm
> <paulros@xxxxxxxxxxxxx>; olaf@xxxxxxxxx; vkuznets@xxxxxxxxxx;
> davem@xxxxxxxxxxxxx; wei.liu@xxxxxxxxxx; edumazet@xxxxxxxxxx;
> kuba@xxxxxxxxxx; pabeni@xxxxxxxxxx; leon@xxxxxxxxxx; Long Li
> <longli@xxxxxxxxxxxxx>; ssengar@xxxxxxxxxxxxxxxxxxx; linux-
> kernel@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH net-next] net: mana: Add support for jumbo frame
>
> [You don't often get email from romieu@xxxxxxxxxxxxx. Learn why this is
> important at https://aka.ms/LearnAboutSenderIdentification ]
>
> Haiyang Zhang <haiyangz@xxxxxxxxxxxxx> :
> > > From: Francois Romieu <romieu@xxxxxxxxxxxxx>
> [...]
> > > 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.
>
> In a ideal world, I would expect change_mtu() to allocate the new resources,
> bail out if some allocation fails, stop the traffic, swap the old and new
> resources, then restart the traffic and release the old resources.
> This way the device is never left in a failed state.

Thanks for the idea -- I will look into that. But the real world implementation may
be less than ideal :)

- Haiyang