[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230724165157.7094468a@kernel.org>
Date: Mon, 24 Jul 2023 16:51:57 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Wei Fang <wei.fang@....com>
Cc: davem@...emloft.net, edumazet@...gle.com, pabeni@...hat.com,
shenwei.wang@....com, xiaoning.wang@....com, ast@...nel.org,
daniel@...earbox.net, hawk@...nel.org, john.fastabend@...il.com,
netdev@...r.kernel.org, linux-imx@....com, linux-kernel@...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,
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?
--
pw-bot: cr
Powered by blists - more mailing lists