<div dir="ltr">Hi Stephen,<div>I am happy to send these as a follow-up if you've already committed v1 or create a v2 patch.</div><div><br></div><div>Thanks,</div><div>Rita</div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Mon, Sep 14, 2026 at 7:25 PM Wei Hu <<a href="mailto:weh@microsoft.com">weh@microsoft.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
> -----Original Message-----<br>
> From: Stephen Hemminger <<a href="mailto:stephen@networkplumber.org" target="_blank">stephen@networkplumber.org</a>><br>
> Sent: Tuesday, September 15, 2026 12:14 AM<br>
> To: Rita Ruvinsky <<a href="mailto:rita.ruvinsky@weka.io" target="_blank">rita.ruvinsky@weka.io</a>><br>
> Cc: <a href="mailto:dev@dpdk.org" target="_blank">dev@dpdk.org</a>; <a href="mailto:longli@microsoft.com" target="_blank">longli@microsoft.com</a>; Wei Hu <<a href="mailto:weh@microsoft.com" target="_blank">weh@microsoft.com</a>>;<br>
> <a href="mailto:stable@dpdk.org" target="_blank">stable@dpdk.org</a><br>
> Subject: [EXTERNAL] Re: [PATCH] net/mana: fix Tx stall from send queue free-<br>
> space unit mismatch<br>
> <br>
> On Mon, 14 Sep 2026 13:58:08 +0300<br>
> Rita Ruvinsky <<a href="mailto:rita.ruvinsky@weka.io" target="_blank">rita.ruvinsky@weka.io</a>> wrote:<br>
> <br>
> > gdma_post_work_request() subtracted a unit count from an entry count:<br>
> ><br>
> >   queue_free_units = queue->count - (queue->head - queue->tail);<br>
> ><br>
> > queue->count is in entries, while head and tail are in WQE alignment<br>
> > units. On a 512-entry, 128KB send queue the check saw 512 units of<br>
> > capacity instead of queue->size / GDMA_WQE_ALIGNMENT_UNIT_SIZE =<br>
> 4096,<br>
> > and returned -EBUSY with the queue one eighth full. A workload that<br>
> > fills that window faster than it drains makes rte_eth_tx_burst()<br>
> > return<br>
> > 0 for long enough to look like a dead port.<br>
> ><br>
> > Derive the capacity from queue->size, which is also what the ring wrap<br>
> > in gdma_get_wqe_pointer() uses. Rx is unaffected: its WQEs occupy<br>
> > exactly one unit, so entries and units coincide.<br>
> ><br>
> > Fixes: 56dd45c0ce7b ("net/mana: implement hardware layer operations")<br>
> > Cc: <a href="mailto:stable@dpdk.org" target="_blank">stable@dpdk.org</a><br>
> ><br>
> > Signed-off-by: Rita Ruvinsky <<a href="mailto:rita.ruvinsky@weka.io" target="_blank">rita.ruvinsky@weka.io</a>><br>
> > ---<br>
> <br>
> Applied to next-net<br>
> <br>
> The long form AI review had some observations worth including:<br>
> <br>
> On Mon, 14 Sep 2026 13:58:08 +0300<br>
> Rita Ruvinsky <<a href="mailto:rita.ruvinsky@weka.io" target="_blank">rita.ruvinsky@weka.io</a>> wrote:<br>
> <br>
> > gdma_post_work_request() subtracted a unit count from an entry count:<br>
> <br>
> The unit analysis is right.  head/tail are advanced in alignment units (queue-<br>
> >head += wqe_size / GDMA_WQE_ALIGNMENT_UNIT_SIZE, and<br>
> gdma_get_wqe_pointer() multiplies head by the same constant), while<br>
> sq_count comes from rdma-core as attr->cap.max_send_wr and sq_size as<br>
> align_hw_size(max_send_wr * get_wqe_size(max_send_sge)).  Deriving the<br>
> capacity from size is the only self-consistent choice, and it is what<br>
> mana_gd_wq_avail_space() in the kernel driver does.<br>
> <br>
> Info:<br>
> <br>
> 1. The debug line in the -EBUSY path still reports queue->count:<br>
> <br>
>       DP_LOG(DEBUG, "WQE size %u queue count %u head %u tail %u",<br>
>              wqe_size, queue->count, queue->head, queue->tail);<br>
> <br>
> After this patch count no longer takes part in the decision for the send or<br>
> receive queue; only gdma_poll_completion_queue() still uses it, for the CQ.<br>
> The one line printed when a post is rejected no longer shows what it was<br>
> rejected against.  Suggest:<br>
> <br>
>       DP_LOG(DEBUG, "WQE size %u queue size %u free %u head %u<br>
> tail %u",<br>
>              wqe_size, queue->size, queue_free_units,<br>
>              queue->head, queue->tail);<br>
> <br>
> 2. The comment describes the old bug rather than the invariant:<br>
> <br>
>       /* head/tail count WQE alignment units, so the capacity they are<br>
>        * compared against must too: queue->count is in entries and<br>
>        * undercounts the queue, stalling Tx well below capacity.<br>
>        */<br>
> <br>
> The stall belongs in the commit message, where it already is.  In the source the<br>
> invariant is enough:<br>
> <br>
>       /* head and tail are in WQE alignment units, so the capacity must<br>
>        * come from the queue size in bytes, not the entry count.<br>
>        */<br>
> <br>
> 3. Worth a sentence in the commit message that the kernel mana driver<br>
> computes the same limit in mana_gd_wq_avail_space(), in bytes:<br>
> <br>
>       u32 used_space = (wq->head - wq->tail) * GDMA_WQE_BU_SIZE;<br>
>       return wq->queue_size - used_space;<br>
> <br>
> It is independent confirmation of the unit convention and tells anyone<br>
> backporting this that the two drivers now agree.<br>
<br>
I was about to say the same. The change in DP_LOG and code comments<br>
all make a lot of sense. Thanks for fixing this. <br>
<br>
Wei<br>
</blockquote></div>