[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<PAXPR04MB9185E35E7B53836BD9261A298907A@PAXPR04MB9185.eurprd04.prod.outlook.com>
Date: Mon, 1 Sep 2025 17:26:37 +0000
From: Shenwei Wang <shenwei.wang@....com>
To: Wei Fang <wei.fang@....com>
CC: Clark Wang <xiaoning.wang@....com>, Stanislav Fomichev <sdf@...ichev.me>,
"imx@...ts.linux.dev" <imx@...ts.linux.dev>, "netdev@...r.kernel.org"
<netdev@...r.kernel.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, dl-linux-imx <linux-imx@....com>, Andrew Lunn
<andrew+netdev@...n.ch>, "David S. Miller" <davem@...emloft.net>, Eric
Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni
<pabeni@...hat.com>, Alexei Starovoitov <ast@...nel.org>, Daniel Borkmann
<daniel@...earbox.net>, Jesper Dangaard Brouer <hawk@...nel.org>, John
Fastabend <john.fastabend@...il.com>
Subject: RE: [PATCH v4 net-next 4/5] net: fec: add change_mtu to support
dynamic buffer allocation
> -----Original Message-----
> From: Wei Fang <wei.fang@....com>
> Sent: Monday, September 1, 2025 1:53 AM
> To: Shenwei Wang <shenwei.wang@....com>
> Cc: Clark Wang <xiaoning.wang@....com>; Stanislav Fomichev
> <sdf@...ichev.me>; imx@...ts.linux.dev; netdev@...r.kernel.org; linux-
> kernel@...r.kernel.org; dl-linux-imx <linux-imx@....com>; Andrew Lunn
> <andrew+netdev@...n.ch>; David S. Miller <davem@...emloft.net>; Eric
> Dumazet <edumazet@...gle.com>; Jakub Kicinski <kuba@...nel.org>; Paolo
> Abeni <pabeni@...hat.com>; Alexei Starovoitov <ast@...nel.org>; Daniel
> Borkmann <daniel@...earbox.net>; Jesper Dangaard Brouer
> <hawk@...nel.org>; John Fastabend <john.fastabend@...il.com>
> Subject: RE: [PATCH v4 net-next 4/5] net: fec: add change_mtu to support
> dynamic buffer allocation
> > + /* Stop TX/RX and free the buffers */
> > + napi_disable(&fep->napi);
> > + netif_tx_disable(ndev);
> > + read_poll_timeout(fec_enet_rx_napi, done, (done == 0),
> > + 10, 1000, false, &fep->napi, 10);
> > + fec_stop(ndev);
> > +
> > + WRITE_ONCE(ndev->mtu, new_mtu);
> > +
> > + if (fep->pagepool_order != old_order) {
>
> If fep->pagepool_order is not changed, why need to stop TX/RX?
>
The purpose is to update the MAX_FL based on the new mtu.
Thanks,
Shenwei
> > + fec_enet_free_buffers(ndev);
> > +
> > + /* Create the pagepool based on the new mtu.
> > + * Revert to the original settings if buffer
> > + * allocation fails.
> > + */
> > + if (fec_enet_alloc_buffers(ndev) < 0) {
> > + fep->pagepool_order = old_order;
> > + fep->rx_frame_size = old_size;
> > + WRITE_ONCE(ndev->mtu, old_mtu);
> > + fec_enet_alloc_buffers(ndev);
>
> fec_enet_alloc_buffers() may still fail here, the best approach is to add a helper
> function that allocates new buffers before freeing the old ones. However, this is a
> complex change, so I think returning an error is sufficient for now, and we can
> consider improving it later.
Yes, it needs a separate set of patches to re-organize the buffer management flow.
Thanks,
Shenwei
Powered by blists - more mailing lists