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

From: Joe Damato

Date: Tue Nov 10 2026 - 18:18:07 EST


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 <joe@xxxxxxx>
---
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)
+ mlx4_en_xmit_doorbell(ring);
tx_drop:
dev_kfree_skb_any(skb);
return NETDEV_TX_OK;
--
2.53.0-Meta