Re: [PATCH V2 net 2/4] net: fec: recycle pages for transmitted XDP frames

From: Alexander Lobakin
Date: Thu Jul 06 2023 - 08:00:56 EST


From: Wei Fang <wei.fang@xxxxxxx>
Date: Thu, 6 Jul 2023 16:10:10 +0800

> From: Wei Fang <wei.fang@xxxxxxx>
>
> Once the XDP frames have been successfully transmitted through the
> ndo_xdp_xmit() interface, it's the driver responsibility to free
> the frames so that the page_pool can recycle the pages and reuse
> them. However, this action is not implemented in the fec driver.
> This leads to a user-visible problem that the console will print
> the following warning log.

[...]

> + if (txq->tx_buf[i].xdp) {
> + xdp_return_frame(txq->tx_buf[i].xdp);
> + txq->tx_buf[i].xdp = NULL;
> + }
> +
> + /* restore default tx buffer type: FEC_TXBUF_T_SKB */
> + txq->tx_buf[i].type = FEC_TXBUF_T_SKB;

Here and in the related places below: maybe set ::type dynamically when
sending to either SKB or XDP instead of setting it only for XDP and then
restoring each time?

> }
> +
> bdp->cbd_bufaddr = cpu_to_fec32(0);
> bdp = fec_enet_get_nextdesc(bdp, &txq->bd);
> }
[...]

Thanks,
Olek