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: [email protected]
Signed-off-by: Rita Ruvinsky <[email protected]>
---
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