Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: toddfreed@meta.com
Cc: netdev@vger.kernel.org, davem@davemloft.net,
	andrew+netdev@lunn.ch, bjorn@kernel.org, borisp@nvidia.com,
	cratiu@nvidia.com, daniel.zahka@gmail.com, dsahern@kernel.org,
	dtatulea@nvidia.com, edumazet@kernel.org, idosch@nvidia.com,
	kuba@kernel.org, john.fastabend@gmail.com, leon@kernel.org,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-rdma@vger.kernel.org, mbloch@nvidia.com, pabeni@redhat.com,
	raeds@nvidia.com, rrameshbabu@nvidia.com, sd@queasysnail.net,
	saeedm@nvidia.com, shuah@kernel.org, horms@kernel.org,
	tariqt@nvidia.com, weiwan@google.com,
	willemdebruijn.kernel@gmail.com, stable@vger.kernel.org
Subject: Re: [PATCH net v6 1/8] net/mlx5e: ring the tx doorbell when an accel offload drops a packet
Date: Sat, 21 Nov 2026 21:17:36 +0000	[thread overview]
Message-ID: <179529585606.3135.5694313033561024003@kernel.org> (raw)
In-Reply-To: <20261117203137.804424-2-toddfreed@meta.com>

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

  parent reply	other threads:[~2026-11-21 21:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 20:31 [PATCH net v6 0/8] psp, tls: don't send offloaded contents in cleartext Todd Freed
2026-11-17 20:31 ` [PATCH net v6 1/8] net/mlx5e: ring the tx doorbell when an accel offload drops a packet Todd Freed
2026-11-18 14:08   ` Dragos Tatulea
2026-11-21 21:17   ` netdev-bot+sashiko [this message]
2026-11-17 20:31 ` [PATCH net v6 2/8] psp: don't encapsulate ipv6 packets with extension headers Todd Freed
2026-11-17 20:31 ` [PATCH net v6 3/8] net: don't fragment decrypted skbs Todd Freed
2026-11-21 21:17   ` netdev-bot+sashiko
2026-11-17 20:31 ` [PATCH net v6 4/8] ipv4: icmp: don't quote decrypted payload in icmp errors Todd Freed
2026-11-21 21:17   ` netdev-bot+sashiko
2026-11-17 20:31 ` [PATCH net v6 5/8] ipv6: icmpv6: don't quote decrypted payload in icmpv6 errors Todd Freed
2026-11-21 21:17   ` netdev-bot+sashiko
2026-11-17 20:31 ` [PATCH net v6 6/8] selftests: drv-net: psp: test ipv6 tcp socket with extension headers Todd Freed
2026-11-17 20:31 ` [PATCH net v6 7/8] selftests: drv-net: psp: test that ipv4 psp packets aren't fragmented Todd Freed
2026-11-17 20:31 ` [PATCH net v6 8/8] net/mlx5e: psp: tso: replace only the length in checksum seed Todd Freed
2026-11-18 14:24   ` Dragos Tatulea
2026-11-20 17:17     ` Todd Bert Freed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179529585606.3135.5694313033561024003@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=bjorn@kernel.org \
    --cc=borisp@nvidia.com \
    --cc=cratiu@nvidia.com \
    --cc=daniel.zahka@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=dtatulea@nvidia.com \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mbloch@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=raeds@nvidia.com \
    --cc=rrameshbabu@nvidia.com \
    --cc=saeedm@nvidia.com \
    --cc=sd@queasysnail.net \
    --cc=shuah@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tariqt@nvidia.com \
    --cc=toddfreed@meta.com \
    --cc=weiwan@google.com \
    --cc=willemdebruijn.kernel@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox