From: Jakub Kicinski <kuba@kernel.org>
To: Shannon Nelson <shannon.nelson@amd.com>
Cc: <netdev@vger.kernel.org>, <davem@davemloft.net>,
<edumazet@google.com>, <pabeni@redhat.com>,
<brett.creeley@amd.com>, <drivers@pensando.io>
Subject: Re: [PATCH net-next 6/9] ionic: Add XDP_TX support
Date: Wed, 31 Jan 2024 18:25:05 -0800 [thread overview]
Message-ID: <20240131182505.67eeedd9@kernel.org> (raw)
In-Reply-To: <20240130013042.11586-7-shannon.nelson@amd.com>
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 :(
next prev parent reply other threads:[~2024-02-01 2:25 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-30 1:30 [PATCH net-next 0/9] ionic: add XDP support Shannon Nelson
2024-01-30 1:30 ` [PATCH net-next 1/9] ionic: set adminq irq affinity Shannon Nelson
2024-01-30 1:30 ` [PATCH net-next 2/9] ionic: add helpers for accessing buffer info Shannon Nelson
2024-01-30 1:30 ` [PATCH net-next 3/9] ionic: use dma range APIs Shannon Nelson
2024-01-30 1:30 ` [PATCH net-next 4/9] ionic: add initial framework for XDP support Shannon Nelson
2024-01-30 1:30 ` [PATCH net-next 5/9] ionic: Add XDP packet headroom Shannon Nelson
2024-01-30 1:30 ` [PATCH net-next 6/9] ionic: Add XDP_TX support Shannon Nelson
2024-02-01 2:25 ` Jakub Kicinski [this message]
2024-02-01 17:41 ` Nelson, Shannon
2024-01-30 1:30 ` [PATCH net-next 7/9] ionic: Add XDP_REDIRECT support Shannon Nelson
2024-01-30 1:30 ` [PATCH net-next 8/9] ionic: add ndo_xdp_xmit Shannon Nelson
2024-01-30 1:30 ` [PATCH net-next 9/9] ionic: implement xdp frags support Shannon Nelson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240131182505.67eeedd9@kernel.org \
--to=kuba@kernel.org \
--cc=brett.creeley@amd.com \
--cc=davem@davemloft.net \
--cc=drivers@pensando.io \
--cc=edumazet@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shannon.nelson@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.