[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <AM5PR04MB313905A73DB27CE3741E18E78803A@AM5PR04MB3139.eurprd04.prod.outlook.com>
Date: Tue, 25 Jul 2023 01:58:56 +0000
From: Wei Fang <wei.fang@....com>
To: Jakub Kicinski <kuba@...nel.org>
CC: "davem@...emloft.net" <davem@...emloft.net>,
"edumazet@...gle.com" <edumazet@...gle.com>,
"pabeni@...hat.com" <pabeni@...hat.com>,
Shenwei Wang <shenwei.wang@....com>,
Clark Wang <xiaoning.wang@....com>,
"ast@...nel.org" <ast@...nel.org>,
"daniel@...earbox.net" <daniel@...earbox.net>,
"hawk@...nel.org" <hawk@...nel.org>,
"john.fastabend@...il.com" <john.fastabend@...il.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
dl-linux-imx <linux-imx@....com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"bpf@...r.kernel.org" <bpf@...r.kernel.org>
Subject: RE: [PATCH V2 net-next] net: fec: add XDP_TX feature support
> On Fri, 21 Jul 2023 14:21:53 +0800 Wei Fang wrote:
> > + /* Tx processing cannot call any XDP (or page pool) APIs if
> > + * the "budget" is 0. Because NAPI is called with budget of
> > + * 0 (such as netpoll) indicates we may be in an IRQ context,
> > + * however, we can't use the page pool from IRQ context.
> > + */
> > + if (unlikely(!budget))
> > + break;
> > +
> > xdpf = txq->tx_buf[index].xdp;
> > - if (bdp->cbd_bufaddr)
> > + if (bdp->cbd_bufaddr &&
> > + txq->tx_buf[index].type == FEC_TXBUF_T_XDP_NDO)
> > dma_unmap_single(&fep->pdev->dev,
> > fec32_to_cpu(bdp->cbd_bufaddr),
> > fec16_to_cpu(bdp->cbd_datlen), @@ -1474,7
> +1486,10 @@
> > fec_enet_tx_queue(struct net_device *ndev, u16 queue_id)
> > /* Free the sk buffer associated with this last transmit */
> > dev_kfree_skb_any(skb);
> > } else {
> > - xdp_return_frame(xdpf);
> > + if (txq->tx_buf[index].type == FEC_TXBUF_T_XDP_NDO)
> > + xdp_return_frame(xdpf);
> > + else
> > + xdp_return_frame_rx_napi(xdpf);
>
> I think that you need to also break if (!budget) here,
I think there is no need to break again here, because if the "budget" is 0, the code logic
will no jump here.
> xdp_return_frame() may call page pool APIs to return the frame to a page pool
> owned by another driver. And that needs to be fixed in net/main already?
Yes, you are right, I should fixed it in net tree first, and when the fix is merged
into net-next tree, I will send a 3rd version of this patch.
Powered by blists - more mailing lists