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.
Derive the capacity 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.
Fixes: 56dd45c0ce7b ("net/mana: implement hardware layer operations")
Cc: [email protected]
Signed-off-by: Rita Ruvinsky <[email protected]>
---
Independent of patchwork 167383 and 167384 (net/mana MR length
truncation / Rx WQE double free) from the same author, currently in
awaiting-upstream: this touches gdma.c only and applies cleanly with or
without them.
drivers/net/mana/gdma.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/net/mana/gdma.c b/drivers/net/mana/gdma.c
index 7f66a7a7cf..c80fc25f21 100644
--- a/drivers/net/mana/gdma.c
+++ b/drivers/net/mana/gdma.c
@@ -138,7 +138,12 @@ 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/tail count WQE alignment units, so the capacity they are
compared
+ * against must too: queue->count is in entries and undercounts the
+ * queue, stalling Tx well below capacity.
+ */
+ 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",
--
2.43.0