Netdev List
 help / color / mirror / Atom feed
From: Tariq Toukan <tariqt@nvidia.com>
To: Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, <netdev@vger.kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	Willem de Bruijn <willemb@google.com>
Cc: Aya Levin <ayal@mellanox.com>,
	Dragos Tatulea <dtatulea@nvidia.com>,
	"Gal Pressman" <gal@nvidia.com>, Jiri Pirko <jiri@resnulli.us>,
	Jonathan Corbet <corbet@lwn.net>,
	Josef Bacik <josef@toxicpanda.com>,
	Leon Romanovsky <leon@kernel.org>, <linux-doc@vger.kernel.org>,
	<linux-rdma@vger.kernel.org>, Mark Bloch <mbloch@nvidia.com>,
	Randy Dunlap <rdunlap@infradead.org>,
	"Saeed Mahameed" <saeedm@mellanox.com>,
	Saeed Mahameed <saeedm@nvidia.com>,
	"Shuah Khan" <skhan@linuxfoundation.org>,
	Simon Horman <horms@kernel.org>,
	"Tariq Toukan" <tariqt@mellanox.com>,
	Tariq Toukan <tariqt@nvidia.com>
Subject: [PATCH net 1/2] net/mlx5e: RX, Drop ICOSQ padding NOPs on UMR allocation failure
Date: Wed, 2 Dec 2026 13:02:06 +0200	[thread overview]
Message-ID: <20261202110207.3387859-2-tariqt@nvidia.com> (raw)
In-Reply-To: <20261202110207.3387859-1-tariqt@nvidia.com>

mlx5e_alloc_rx_mpwqe() takes its ICOSQ slot before it allocates the
pages, and mlx5e_icosq_get_next_pi() may pad the SQ with NOPs up to a
page boundary on the way. When the allocation fails, the producer
counter is not restored, and the NOPs stay with no WQE after them to
request their completion. The ICOSQ recovery flow, which waits for
the SQ to become empty, can then time out and leave the RQ
deactivated.

Restore the producer counter when the allocation fails. The NOPs were
not submitted yet, as the doorbell is rung only after the refill loop.
The XSK flavor allocates its frames before it takes the slot, so it is
not affected.

The next patch relies on this: it posts a NOP only on an empty ICOSQ,
and takes a non-empty one as having a completion to come.

Fixes: be5323c8379f ("net/mlx5e: Report and recover from CQE error on ICOSQ")
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
index 1586cb2404c0..3f6b11da486b 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
@@ -651,11 +651,12 @@ static int mlx5e_alloc_rx_mpwqe(struct mlx5e_rq *rq, u16 ix)
 	struct mlx5e_umr_wqe *umr_wqe;
 	u32 offset; /* 17-bit value with MTT. */
 	bool sync_locked;
-	u16 pi;
+	u16 pc, pi;
 	int err;
 	int i;
 
 	sync_locked = mlx5e_icosq_sync_lock(sq);
+	pc = sq->pc;
 	pi = mlx5e_icosq_get_next_pi(sq, rq->mpwqe.umr_wqebbs);
 	umr_wqe = mlx5_wq_cyc_get_wqe(wq, pi);
 	memcpy(umr_wqe, &rq->mpwqe.umr_wqe, sizeof(struct mlx5e_umr_wqe));
@@ -710,6 +711,10 @@ static int mlx5e_alloc_rx_mpwqe(struct mlx5e_rq *rq, u16 ix)
 	return 0;
 
 err_unmap:
+	/* Drop the padding NOPs of mlx5e_icosq_get_next_pi(), no WQE follows
+	 * them to request their completion.
+	 */
+	sq->pc = pc;
 	mlx5e_icosq_sync_unlock(sq, sync_locked);
 	while (--i >= 0) {
 		frag_page--;
-- 
2.44.0


  reply	other threads:[~2026-12-02 11:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 11:02 [PATCH net 0/2] net/mlx5e: Fix channel stall on affinity change Tariq Toukan
2026-12-02 11:02 ` Tariq Toukan [this message]
2026-12-02 11:02 ` [PATCH net 2/2] net/mlx5e: Fix channel stall after NAPI moves to another CPU Tariq Toukan

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=20261202110207.3387859-2-tariqt@nvidia.com \
    --to=tariqt@nvidia.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=ayal@mellanox.com \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=dtatulea@nvidia.com \
    --cc=edumazet@kernel.org \
    --cc=gal@nvidia.com \
    --cc=horms@kernel.org \
    --cc=jiri@resnulli.us \
    --cc=josef@toxicpanda.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mbloch@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rdunlap@infradead.org \
    --cc=saeedm@mellanox.com \
    --cc=saeedm@nvidia.com \
    --cc=skhan@linuxfoundation.org \
    --cc=tariqt@mellanox.com \
    --cc=willemb@google.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