Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: tariqt@nvidia.com
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
	kuba@kernel.org, netdev@vger.kernel.org, pabeni@redhat.com,
	willemb@google.com, dtatulea@nvidia.com, gal@nvidia.com,
	leon@kernel.org, linux-rdma@vger.kernel.org, mbloch@nvidia.com,
	saeedm@mellanox.com, saeedm@nvidia.com, tariqt@mellanox.com
Subject: Re: [PATCH net] net/mlx5e: Fix the missing WQE count of large striding RQs
Date: Thu, 03 Dec 2026 12:17:07 +0000	[thread overview]
Message-ID: <179630022795.3146.4180735893350917415@kernel.org> (raw)
In-Reply-To: <20261202121422.3422569-1-tariqt@nvidia.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] The commit message says "The ICOSQ is already sized for the
  UMR WQEs of the whole RQ, so posting them in one refill fits." That…

--

net/mlx5e: Fix the missing WQE count of large striding RQs

This commit widens the missing WQE count and loop counter in
mlx5e_post_rx_mpwqes(), and the umr_in_progress, umr_last_bulk and
umr_completed fields of struct mlx5e_rq, from u8 to u16. Before this, the
u8 truncation limited each striding RQ to 255 posted WQEs even when the
ring was configured larger.

> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
> index 1586cb2404c01..63ac293bfceb4 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c

[ ... ]

> @@ -933,11 +933,11 @@ static void mlx5e_reclaim_mpwqe_pages(struct mlx5e_rq *rq, int head,
>  INDIRECT_CALLABLE_SCOPE bool mlx5e_post_rx_mpwqes(struct mlx5e_rq *rq)
>  {
>  	struct mlx5_wq_ll *wq = &rq->mpwqe.wq;
> -	u8  umr_completed = rq->mpwqe.umr_completed;
> +	u16 umr_completed = rq->mpwqe.umr_completed;
>  	struct mlx5e_icosq *sq = rq->icosq;
>  	bool reclaimed = false;
>  	int alloc_err = 0;
> -	u8  missing, i;
> +	u16 missing, i;

[Severity: Medium]
The commit message says:

  The ICOSQ is already sized for the UMR WQEs of the whole RQ, so posting
  them in one refill fits.

Now that missing and i are u16, mlx5e_post_rx_mpwqes() can post up to
RQ size - 1 UMRs in a single refill. Before, the u8 capped that at 255.
Is the ICOSQ sizing really enough to cover this?

In mlx5e_build_icosq_log_wq_sz() in en/params.c, the comment asks for
(PAGE_SIZE - (max WQE size - MLX5_SEND_WQE_BB)) useful bytes per page.
The code does this instead:

	useful_space = PAGE_SIZE - mlx5e_get_max_sq_wqebbs(mdev) + MLX5_SEND_WQE_BB;

mlx5e_get_max_sq_wqebbs() returns a count of WQEBBs (up to 16), not
bytes. With 4K pages that makes useful_space 4144, which is larger than
PAGE_SIZE.

So the estimate reserves no room for the page-edge NOPs that
mlx5e_icosq_get_next_pi() inserts. For 10-WQEBB UMRs that is 4 NOPs per
64-WQEBB page, about 6.7% overhead. This calculation dates back to commit
0b9c86c78586c2. The 255 in-flight cap has been hiding it until now.

Neither mlx5e_alloc_rx_mpwqe() nor mlx5e_xsk_alloc_rx_mpwqe() checks for
room in the ICOSQ. Both just advance sq->pc and write sq->db.wqe_info[pi].

c->rq and c->xskrq share c->icosq, and both can be refilled from empty in
the same NAPI poll. Two paths lead there:

  mlx5e_xsk_disable_locked()
    mlx5e_activate_rq(&c->rq);   /* while the XSK RQ is still active */

  mlx5e_rx_reporter_err_icosq_cqe_recover()
    re-activates both RQs

I could not find a valid configuration that actually overflows.
Power-of-two rounding and mlx5e_mpwrq_validate_xsk() seem to keep the
footprint within the ICOSQ. The margins are thin, though. For example,
with non-ECPF, 4K pages, umr_wqebbs = 10 and an XSK RQ twice the size of
the regular RQ, the worst case is about 4081 of 4096 WQEBBs.

What if some device capability combination does go over? Then pc - cc
would exceed the ICOSQ size, and in-flight UMR WQEs and wqe_info[]
entries would be overwritten. mlx5e_poll_ico_cq() could also credit
umr_completed to the wrong RQ, and this could underflow the u16:

	rq->mpwqe.umr_in_progress -= umr_completed;

Would it make sense to fix the useful_space calculation, so that the max
WQE size is in bytes, before full-ring refills rely on it? Or should the
commit message be reworded so it does not depend on that sizing?

>  	u16 head;
>  
>  	if (unlikely(!test_bit(MLX5E_RQ_STATE_ENABLED, &rq->state)))

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202121422.3422569-1-tariqt%40nvidia.com

      parent reply	other threads:[~2026-12-03 12:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 12:14 [PATCH net] net/mlx5e: Fix the missing WQE count of large striding RQs Tariq Toukan
2026-12-02 12:18 ` netdev-bot+sinfo
2026-12-02 12:20 ` sashiko-bot
2026-12-03 12:17 ` netdev-bot+sashiko [this message]

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=179630022795.3146.4180735893350917415@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=dtatulea@nvidia.com \
    --cc=edumazet@kernel.org \
    --cc=gal@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mbloch@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=saeedm@mellanox.com \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@mellanox.com \
    --cc=tariqt@nvidia.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