DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rita Ruvinsky <rita.ruvinsky@weka.io>
To: dev@dpdk.org
Cc: stephen@networkplumber.org, weh@microsoft.com, stable@dpdk.org,
	Rita Ruvinsky <rita.ruvinsky@weka.io>
Subject: [PATCH v2] net/mana: fix Tx stall from send queue free-space unit mismatch
Date: Thu, 17 Sep 2026 09:23:50 +0300	[thread overview]
Message-ID: <20260917062350.1482591-1-rita.ruvinsky@weka.io> (raw)
In-Reply-To: <20260914105809.919580-1-rita.ruvinsky@weka.io>

gdma_post_work_request() subtracted a unit count from an entry count:

  queue_free_units = queue->count - (queue->head - queue->tail);

queue->count is in entries, while head and tail are in WQE alignment
units. On a 512-entry, 128KB send queue the check saw 512 units of
capacity instead of queue->size / GDMA_WQE_ALIGNMENT_UNIT_SIZE = 4096,
and returned -EBUSY with the queue one eighth full. A workload that
fills that window faster than it drains makes rte_eth_tx_burst() return
0 for long enough to look like a dead port.

The size is the authoritative capacity: rdma-core derives sq_size from
sq_count as align_hw_size(max_send_wr * get_wqe_size(max_send_sge)), and
the kernel mana driver computes the same limit in bytes in
mana_gd_wq_avail_space(). Derive it from queue->size, which is also what
the ring wrap in gdma_get_wqe_pointer() uses. Rx is unaffected: its WQEs
occupy exactly one unit, so entries and units coincide.

Also report the size and computed free space in the -EBUSY debug line,
since queue->count no longer takes part in the decision.

Fixes: 56dd45c0ce7b ("net/mana: implement hardware layer operations")
Cc: stable@dpdk.org

Signed-off-by: Rita Ruvinsky <rita.ruvinsky@weka.io>
---
v2:
  - comment states the invariant rather than the old bug (Stephen Hemminger)
  - report queue->size and the computed free space in the -EBUSY debug line
    (Stephen Hemminger, Wei Hu)
  - reference mana_gd_wq_avail_space() in the commit message (Stephen Hemminger)

Independent of patchwork 167383 and 167384 from the same author.

 drivers/net/mana/gdma.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/net/mana/gdma.c b/drivers/net/mana/gdma.c
index 7f66a7a7cf..a92aef59d2 100644
--- a/drivers/net/mana/gdma.c
+++ b/drivers/net/mana/gdma.c
@@ -138,11 +138,16 @@ gdma_post_work_request(struct mana_gdma_queue *queue,
 				client_oob_size + sgl_data_size,
 			  GDMA_WQE_ALIGNMENT_UNIT_SIZE);
 	uint8_t *wq_buffer_pointer;
-	uint32_t queue_free_units = queue->count - (queue->head - queue->tail);
+	/* head and tail are in WQE alignment units, so the capacity must
+	 * come from the queue size in bytes, not the entry count.
+	 */
+	uint32_t queue_free_units = queue->size / GDMA_WQE_ALIGNMENT_UNIT_SIZE -
+					(queue->head - queue->tail);
 
 	if (wqe_size / GDMA_WQE_ALIGNMENT_UNIT_SIZE > queue_free_units) {
-		DP_LOG(DEBUG, "WQE size %u queue count %u head %u tail %u",
-		       wqe_size, queue->count, queue->head, queue->tail);
+		DP_LOG(DEBUG, "WQE size %u queue size %u free %u head %u tail %u",
+		       wqe_size, queue->size, queue_free_units,
+		       queue->head, queue->tail);
 		return -EBUSY;
 	}
 
-- 
2.43.0


      parent reply	other threads:[~2026-09-17  6:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-14 10:58 [PATCH] net/mana: fix Tx stall from send queue free-space unit mismatch Rita Ruvinsky
2026-09-14 16:14 ` Stephen Hemminger
2026-09-14 16:24   ` [EXTERNAL] " Wei Hu
2026-09-16 11:12     ` Rita Ruvinsky
2026-09-16 15:17       ` Stephen Hemminger
2026-09-17  6:23 ` Rita Ruvinsky [this message]

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=20260917062350.1482591-1-rita.ruvinsky@weka.io \
    --to=rita.ruvinsky@weka.io \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    --cc=stephen@networkplumber.org \
    --cc=weh@microsoft.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