quoted hunk ↗ jump to hunk
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.
+ 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>