Re: [PATCH net v6 1/8] net/mlx5e: ring the tx doorbell when an accel offload drops a packet

From: netdev-bot+sashiko

Date: Sat Nov 21 2026 - 16:17:58 EST


Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The new mlx5e_tx_check_stop() call in mlx5e_tx_flush()
(drivers/net/ethernet/mellanox/mlx5/core/en_tx.c:368) can count one…

--

net/mlx5e: ring the tx doorbell when an accel offload drops a packet

When mlx5e_accel_tx_begin() drops an skb, this patch makes mlx5e_xmit()
call mlx5e_tx_flush(). That closes any open mpwqe session, posts a nop
and rings the doorbell that earlier xmit_more skbs had deferred. It also
adds a stop_room check to mlx5e_tx_flush() after the nop is posted.

> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
> index 14479da98f427..006bf976def1a 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
> @@ -365,6 +365,7 @@ static void mlx5e_tx_flush(struct mlx5e_txqsq *sq)
> };
>
> wqe = mlx5e_post_nop(&sq->wq, sq->sqn, &sq->pc);
> + mlx5e_tx_check_stop(sq);

[Severity: Low]
Can this count a single queue stop twice in sq->stats->stopped?

mlx5e_tx_flush() starts with mlx5e_tx_mpwqe_ensure_complete(). If an
MPWQE session is open, that goes into
mlx5e_tx_mpwqe_session_complete(), which already runs a stop check:

mlx5e_tx_mpwqe_session_complete() {
...
sq->pc += wi->num_wqebbs;

session->wqe = NULL;

mlx5e_tx_check_stop(sq);
...
}

If closing the session leaves less than sq->stop_room free, the queue
is stopped and stopped is incremented. The nop then advances sq->pc by
one more, so free room has only gone down, and the new check also
fails. mlx5e_tx_check_stop() does not test whether the queue is
already stopped:

mlx5e_tx_check_stop() {
if (unlikely(!mlx5e_wqc_has_room_for(&sq->wq, sq->cc, sq->pc, sq->stop_room))) {
netif_tx_stop_queue(sq->txq);
sq->stats->stopped++;
}
}

When the nop completes, mlx5e_txqsq_wake() wakes the queue once and
increments wake once. That leaves stopped one higher than wake. These
counters are reported as the qstats tx stop/wake values and as
tx_queue_stopped/tx_queue_wake in ethtool.

This can be reached from the new accel drop path below. It can also
now be reached from the existing DMA error paths in
mlx5e_sq_xmit_mpwqe() and mlx5e_sq_xmit_wqe(), since they call the same
helper.

The PTP path in mlx5e_txwqe_complete() already avoids this:

if (!netif_tx_queue_stopped(sq->txq) &&
mlx5e_ptpsq_metadata_freelist_empty(sq->ptpsq)) {
netif_tx_stop_queue(sq->txq);
sq->stats->stopped++;
}

Would a similar netif_tx_queue_stopped() guard work here?

Only the statistics are affected. The queue still wakes when the nop
completes, and no packets are lost. The normal mlx5e_xmit() path can
already skew these counters the same way, through
mlx5e_tx_mpwqe_ensure_complete() followed by mlx5e_txwqe_complete().
Later patches in the series do not touch en_tx.c, so this is still
present at the end of the series.

> mlx5e_notify_hw(&sq->wq, sq->pc, sq->uar_map, &wqe->ctrl);
> }
>
> @@ -672,8 +673,13 @@ netdev_tx_t mlx5e_xmit(struct sk_buff *skb, struct net_device *dev)
> }
>
> /* May send SKBs and WQEs. */
> - if (unlikely(!mlx5e_accel_tx_begin(dev, sq, skb, &accel)))
> + if (unlikely(!mlx5e_accel_tx_begin(dev, sq, skb, &accel))) {
> + /* The skb was dropped: ring the doorbell which the previous
> + * ones may have deferred to it
> + */
> + mlx5e_tx_flush(sq);
> return NETDEV_TX_OK;
> + }

This is the new caller that reaches the double count above. It needs a
PSP, IPsec, MACsec or kTLS drop while an MPWQE session is open and the
SQ is close to full. The commit message says the next patch makes the
PSP drop reachable from user space.

[ ... ]

--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261117203137.804424-1-toddfreed%40meta.com