Re: [PATCH net-next 5/5] net/mlx4: flush pending doorbell when dropping a TX skb

From
Joe Damato <hidden>
Date
2026-11-17 15:33:09
Also in
linux-rdma, lkml
Reply to
Daniel Machon, 2026-11-12
On Thu, Nov 12, 2026 at 02:43:46PM +0100, Daniel Machon wrote:
quoted
If mlx4_en_xmit drops an skb (for example because DMA mapping fails) and
that skb happens to be the last one in the batch, the doorbell for the
WQEs posted earlier in the batch isn't written.

The queue stays awake, though, so those WQEs are eventually announced to
the HW after the next TX, but that depends on traffic and could induce
latency.

Avoid all of that by writing the pending doorbell in the drop path.

Signed-off-by: Joe Damato <redacted>
---
 drivers/net/ethernet/mellanox/mlx4/en_tx.c | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
index 123071a47bed..3166837711be 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
@@ -1135,6 +1135,9 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
 
 tx_drop_count:
 	ring->tx_dropped++;
+	/* an earlier skb in this batch may have deferred the doorbell */
+	if (ring->doorbell_pending)
I think checking !netdev_xmit_more() here would let you ditch the new ring
state, but it seems bnxt does it the same way, so fine by me.
I need the state for the SW USO followup I mentioned in the cover letter.

That aside, every mlx4 doorbell site today writes it only after posting at
least one WQE. I think replacing this with !netdev_xmit_more() might write a
doorbell with no new WQEs and idk if that is supported by the hardware. It
looks like the XDP path gates against that specifically.
 
quoted
+		mlx4_en_xmit_doorbell(ring);
 tx_drop:
 	dev_kfree_skb_any(skb);
 	return NETDEV_TX_OK;
-- 
2.53.0-Meta
Reviewed-by: Daniel Machon <daniel.machon@microchip.com>
Thanks
Thread (15 messages) 15 messages, 4 authors, last reply 4d ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help