BPF List
 help / color / mirror / Atom feed
From: Tony Nguyen <anthony.l.nguyen@intel.com>
To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
	edumazet@google.com
Cc: Sylwester Dziedziuch <sylwesterx.dziedziuch@intel.com>,
	netdev@vger.kernel.org, anthony.l.nguyen@intel.com,
	maciej.fijalkowski@intel.com, magnus.karlsson@intel.com,
	bjorn@kernel.org, ast@kernel.org, daniel@iogearbox.net,
	hawk@kernel.org, john.fastabend@gmail.com, bpf@vger.kernel.org,
	Mateusz Palczewski <mateusz.palczewski@intel.com>,
	Shwetha Nagaraju <Shwetha.nagaraju@intel.com>
Subject: [PATCH net 1/2] i40e: Fix failure message when XDP is configured in TX only mode
Date: Mon, 14 Nov 2022 16:03:23 -0800	[thread overview]
Message-ID: <20221115000324.3040207-2-anthony.l.nguyen@intel.com> (raw)
In-Reply-To: <20221115000324.3040207-1-anthony.l.nguyen@intel.com>

From: Sylwester Dziedziuch <sylwesterx.dziedziuch@intel.com>

When starting xdpsock program in TX only mode:

samples/bpf/xdpsock -i <interface> -t

there was an error on i40e driver:

Failed to allocate some buffers on AF_XDP ZC enabled Rx ring 0 (pf_q 81)

It was caused by trying to allocate RX buffers even though
no RX buffers are available because we run in TX only mode.

Fix this by checking for number of available buffers
for RX queue when allocating buffers during XDP setup.

Fixes: 0a714186d3c0 ("i40e: add AF_XDP zero-copy Rx support")
Signed-off-by: Sylwester Dziedziuch <sylwesterx.dziedziuch@intel.com>
Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
Tested-by: Shwetha Nagaraju <Shwetha.nagaraju@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index b5dcd15ced36..41112f92f9ef 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -3555,7 +3555,7 @@ static int i40e_configure_rx_ring(struct i40e_ring *ring)
 	struct i40e_hw *hw = &vsi->back->hw;
 	struct i40e_hmc_obj_rxq rx_ctx;
 	i40e_status err = 0;
-	bool ok;
+	bool ok = true;
 	int ret;
 
 	bitmap_zero(ring->state, __I40E_RING_STATE_NBITS);
@@ -3653,7 +3653,9 @@ static int i40e_configure_rx_ring(struct i40e_ring *ring)
 
 	if (ring->xsk_pool) {
 		xsk_pool_set_rxq_info(ring->xsk_pool, &ring->xdp_rxq);
-		ok = i40e_alloc_rx_buffers_zc(ring, I40E_DESC_UNUSED(ring));
+		if (ring->xsk_pool->free_list_cnt)
+			ok = i40e_alloc_rx_buffers_zc(ring,
+						      I40E_DESC_UNUSED(ring));
 	} else {
 		ok = !i40e_alloc_rx_buffers(ring, I40E_DESC_UNUSED(ring));
 	}
-- 
2.35.1


  reply	other threads:[~2022-11-15  0:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-15  0:03 [PATCH net 0/2][pull request] Intel Wired LAN Driver Updates 2022-11-14 (i40e) Tony Nguyen
2022-11-15  0:03 ` Tony Nguyen [this message]
2022-11-15 12:13   ` [PATCH net 1/2] i40e: Fix failure message when XDP is configured in TX only mode Maciej Fijalkowski
2022-11-16 22:29     ` Saeed Mahameed
2022-11-17  7:09       ` Magnus Karlsson
2022-11-15  0:03 ` [PATCH net 2/2] i40e: fix xdp_redirect logs error message when testing with MTU=1500 Tony Nguyen
2022-11-15 12:27   ` Maciej Fijalkowski
2022-11-16 23:21 ` [PATCH net 0/2][pull request] Intel Wired LAN Driver Updates 2022-11-14 (i40e) Vladimir Oltean
2022-11-17  0:03   ` Maciej Fijalkowski
2022-11-17  0:24     ` Vladimir Oltean
2022-11-17  0:30       ` 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=20221115000324.3040207-2-anthony.l.nguyen@intel.com \
    --to=anthony.l.nguyen@intel.com \
    --cc=Shwetha.nagaraju@intel.com \
    --cc=ast@kernel.org \
    --cc=bjorn@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=maciej.fijalkowski@intel.com \
    --cc=magnus.karlsson@intel.com \
    --cc=mateusz.palczewski@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sylwesterx.dziedziuch@intel.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