From: Jesper Dangaard Brouer <jbrouer@redhat.com>
To: Maciej Fijalkowski <maciej.fijalkowski@intel.com>,
bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net,
magnus.karlsson@intel.com, bjorn@kernel.org
Cc: brouer@redhat.com, netdev@vger.kernel.org, maximmi@nvidia.com,
alexandr.lobakin@intel.com,
Toke Hoiland Jorgensen <toke@redhat.com>
Subject: Re: [PATCH bpf-next 04/10] i40e: xsk: terminate NAPI when XSK Rx queue gets full
Date: Tue, 5 Apr 2022 15:04:17 +0200 [thread overview]
Message-ID: <8bb40f98-2f1f-c331-23d4-ed94a6a1ce76@redhat.com> (raw)
In-Reply-To: <20220405110631.404427-5-maciej.fijalkowski@intel.com>
On 05/04/2022 13.06, Maciej Fijalkowski wrote:
> Correlate -ENOBUFS that was returned from xdp_do_redirect() with a XSK
> Rx queue being full. In such case, terminate the softirq processing and
> let the user space to consume descriptors from XSK Rx queue so that
> there is room that driver can use later on.
>
> Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
> ---
> .../ethernet/intel/i40e/i40e_txrx_common.h | 1 +
> drivers/net/ethernet/intel/i40e/i40e_xsk.c | 21 ++++++++++++-------
> 2 files changed, 15 insertions(+), 7 deletions(-)
>
[...]
I noticed you are only doing this for the Zero-Copy variants.
Wouldn't this also be a benefit for normal AF_XDP ?
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_xsk.c b/drivers/net/ethernet/intel/i40e/i40e_xsk.c
> index c1d25b0b0ca2..9f9e4ce9a24d 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_xsk.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_xsk.c
> @@ -161,9 +161,10 @@ static int i40e_run_xdp_zc(struct i40e_ring *rx_ring, struct xdp_buff *xdp)
>
> if (likely(act == XDP_REDIRECT)) {
> err = xdp_do_redirect(rx_ring->netdev, xdp, xdp_prog);
> - if (err)
> - goto out_failure;
> - return I40E_XDP_REDIR;
> + if (!err)
> + return I40E_XDP_REDIR;
> + result = (err == -ENOBUFS) ? I40E_XDP_EXIT : I40E_XDP_CONSUMED;
> + goto out_failure;
> }
>
> switch (act) {
> @@ -175,6 +176,9 @@ static int i40e_run_xdp_zc(struct i40e_ring *rx_ring, struct xdp_buff *xdp)
> if (result == I40E_XDP_CONSUMED)
> goto out_failure;
> break;
> + case XDP_DROP:
> + result = I40E_XDP_CONSUMED;
> + break;
> default:
> bpf_warn_invalid_xdp_action(rx_ring->netdev, xdp_prog, act);
> fallthrough;
> @@ -182,9 +186,6 @@ static int i40e_run_xdp_zc(struct i40e_ring *rx_ring, struct xdp_buff *xdp)
> out_failure:
> trace_xdp_exception(rx_ring->netdev, xdp_prog, act);
> fallthrough; /* handle aborts by dropping packet */
> - case XDP_DROP:
> - result = I40E_XDP_CONSUMED;
> - break;
> }
> return result;
> }
> @@ -370,6 +371,12 @@ int i40e_clean_rx_irq_zc(struct i40e_ring *rx_ring, int budget)
> xsk_buff_dma_sync_for_cpu(bi, rx_ring->xsk_pool);
>
> xdp_res = i40e_run_xdp_zc(rx_ring, bi);
> + if (xdp_res == I40E_XDP_EXIT) {
> + failure = true;
> + xsk_buff_free(bi);
> + next_to_clean = (next_to_clean + 1) & count_mask;
> + break;
> + }
> i40e_handle_xdp_result_zc(rx_ring, bi, rx_desc, &rx_packets,
> &rx_bytes, size, xdp_res);
> total_rx_packets += rx_packets;
> @@ -382,7 +389,7 @@ int i40e_clean_rx_irq_zc(struct i40e_ring *rx_ring, int budget)
> cleaned_count = (next_to_clean - rx_ring->next_to_use - 1) & count_mask;
>
> if (cleaned_count >= I40E_RX_BUFFER_WRITE)
> - failure = !i40e_alloc_rx_buffers_zc(rx_ring, cleaned_count);
> + failure |= !i40e_alloc_rx_buffers_zc(rx_ring, cleaned_count);
>
> i40e_finalize_xdp_rx(rx_ring, xdp_xmit);
> i40e_update_rx_stats(rx_ring, total_rx_bytes, total_rx_packets);
>
next prev parent reply other threads:[~2022-04-05 14:25 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-05 11:06 [PATCH bpf-next 00/10] xsk: stop softirq processing on full XSK Rx queue Maciej Fijalkowski
2022-04-05 11:06 ` [PATCH bpf-next 01/10] xsk: improve xdp_do_redirect() error codes Maciej Fijalkowski
2022-04-05 12:18 ` Jesper Dangaard Brouer
2022-04-05 11:06 ` [PATCH bpf-next 02/10] xsk: diversify return codes in xsk_rcv_check() Maciej Fijalkowski
2022-04-05 13:00 ` Jesper Dangaard Brouer
2022-04-05 13:35 ` Maciej Fijalkowski
2022-04-05 11:06 ` [PATCH bpf-next 03/10] ice: xsk: terminate NAPI when XSK Rx queue gets full Maciej Fijalkowski
2022-04-05 11:34 ` Alexander Lobakin
2022-04-05 12:02 ` Maciej Fijalkowski
2022-04-05 11:06 ` [PATCH bpf-next 04/10] i40e: " Maciej Fijalkowski
2022-04-05 13:04 ` Jesper Dangaard Brouer [this message]
2022-04-06 16:04 ` Maciej Fijalkowski
2022-04-05 11:06 ` [PATCH bpf-next 05/10] ixgbe: " Maciej Fijalkowski
2022-04-05 12:36 ` Jesper Dangaard Brouer
2022-04-05 13:52 ` Maciej Fijalkowski
2022-04-05 11:06 ` [PATCH bpf-next 06/10] ice: xsk: diversify return values from xsk_wakeup call paths Maciej Fijalkowski
2022-04-05 11:06 ` [PATCH bpf-next 07/10] i40e: " Maciej Fijalkowski
2022-04-05 11:06 ` [PATCH bpf-next 08/10] ixgbe: " Maciej Fijalkowski
2022-04-05 11:06 ` [PATCH bpf-next 09/10] ice: xsk: avoid refilling single Rx descriptors Maciej Fijalkowski
2022-04-05 11:06 ` [PATCH bpf-next 10/10] xsk: drop ternary operator from xskq_cons_has_entries Maciej Fijalkowski
2022-04-07 10:49 ` [PATCH bpf-next 00/10] xsk: stop softirq processing on full XSK Rx queue Maxim Mikityanskiy
2022-04-08 9:08 ` Maciej Fijalkowski
2022-04-08 12:48 ` Maxim Mikityanskiy
2022-04-08 18:17 ` Jakub Kicinski
2022-04-11 15:46 ` Maciej Fijalkowski
2022-04-11 17:07 ` Jakub Kicinski
2022-04-11 15:35 ` Maciej Fijalkowski
2022-04-13 10:40 ` Maxim Mikityanskiy
2022-04-13 15:12 ` Magnus Karlsson
2022-04-13 15:26 ` Maciej Fijalkowski
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=8bb40f98-2f1f-c331-23d4-ed94a6a1ce76@redhat.com \
--to=jbrouer@redhat.com \
--cc=alexandr.lobakin@intel.com \
--cc=ast@kernel.org \
--cc=bjorn@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=brouer@redhat.com \
--cc=daniel@iogearbox.net \
--cc=maciej.fijalkowski@intel.com \
--cc=magnus.karlsson@intel.com \
--cc=maximmi@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=toke@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).