[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240131182505.67eeedd9@kernel.org>
Date: Wed, 31 Jan 2024 18:25:05 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Shannon Nelson <shannon.nelson@....com>
Cc: <netdev@...r.kernel.org>, <davem@...emloft.net>, <edumazet@...gle.com>,
<pabeni@...hat.com>, <brett.creeley@....com>, <drivers@...sando.io>
Subject: Re: [PATCH net-next 6/9] ionic: Add XDP_TX support
On Mon, 29 Jan 2024 17:30:39 -0800 Shannon Nelson wrote:
> case XDP_TX:
> + xdpf = xdp_convert_buff_to_frame(&xdp_buf);
> + if (!xdpf)
> + goto out_xdp_abort;
> +
> + txq = rxq->partner;
> + nq = netdev_get_tx_queue(netdev, txq->index);
> + __netif_tx_lock(nq, smp_processor_id());
> +
> + if (netif_tx_queue_stopped(nq) ||
> + unlikely(ionic_maybe_stop_tx(txq, 1))) {
> + __netif_tx_unlock(nq);
> + goto out_xdp_abort;
> + }
> +
> + dma_unmap_page(rxq->dev, buf_info->dma_addr,
> + IONIC_PAGE_SIZE, DMA_FROM_DEVICE);
> +
> + err = ionic_xdp_post_frame(netdev, txq, xdpf, XDP_TX,
> + buf_info->page,
> + buf_info->page_offset,
> + true);
I think that you need txq_trans_cond_update() somewhere, otherwise
if XDP starves stack Tx the stack will think the queue is stalled.
> + __netif_tx_unlock(nq);
> + if (err) {
> + netdev_dbg(netdev, "tx ionic_xdp_post_frame err %d\n", err);
> + goto out_xdp_abort;
> + }
> + stats->xdp_tx++;
> +
> + /* the Tx completion will free the buffers */
> + break;
> +
> case XDP_ABORTED:
> default:
> - trace_xdp_exception(netdev, xdp_prog, xdp_action);
> - ionic_rx_page_free(rxq, buf_info);
> - stats->xdp_aborted++;
> + goto out_xdp_abort;
> }
>
> + return true;
> +
> +out_xdp_abort:
> + trace_xdp_exception(netdev, xdp_prog, xdp_action);
> + ionic_rx_page_free(rxq, buf_info);
> + stats->xdp_aborted++;
> +
> return true;
> }
>
> @@ -880,6 +1001,16 @@ static void ionic_tx_clean(struct ionic_queue *q,
> struct sk_buff *skb = cb_arg;
> u16 qi;
>
> + if (desc_info->xdpf) {
> + ionic_xdp_tx_desc_clean(q->partner, desc_info);
> + stats->clean++;
> +
> + if (unlikely(__netif_subqueue_stopped(q->lif->netdev, q->index)))
> + netif_wake_subqueue(q->lif->netdev, q->index);
> +
> + return;
> + }
You can't complete XDP if NAPI budget is 0, you may be in hard IRQ
context if its netpoll calling :(
Powered by blists - more mailing lists