From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796300229; b=k5awfig8oW13yvfO0f/HTcsgXCuIrxvmKqSkAbGE3Dew8HbXuqRNSDMLw0wLXwAKyj1X wVXqeGrhv1O/SWNW63c4BgJJ7QRW8eQKnd4tb9qS2wJBUPRBYyxeD8ebEk4SmePM8wq7m eWozHquyhJmhdv5oJNcpGhxv5WY4Rt4HZBI708/C8ORhqUnDBMDmFACXizte7CDnmYTjD SUofxLvK+g0SDa9/Mq39+57hDXmV8vElNgeQcsNO2bmvV4k6MP37Fa3cN36gqTpwblleq mYochADHhY6cUvIW33WhaHybm2jmBtSYEKDkzTV4BTfqt3q7B5KeiMuFN9ZuZZaG49g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796300229; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=x8IMyr1BQRdOyi/NQme8NgeyIj4qFnfsmDqDa3DFA/I=; b=A9wlJw9F4RAj6NSYjVn5qdxzodg8/2XTjOjG0PItcaVD4Gt3LxrYo6SH8HjjOPZHrL6G c3DuU7ONELs/m3y1Jp/8WLZZzpXQYVEkQiumQRd/q7SYuaDGG8Y86hcraja5/OhJYyMz1 35M6D9ZuIUWVUG6FslLsvmGIWILL8EW16sS/gCcYSUDuLL5I2W43IvuO5DtTS92HqgHW9 5thOS3U6I1+Qdaw+352+gCcem2NaXm1VhMVSj2/3rhrEAIzWhZU3STCVYJsIws6Twpbqe Qd0mVUBrKwzBUgngUic6/7MxwnBBGblXTKCegVu9zg57Gfzhm6oJbw3YExNay/qazdg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=BWRTq4TE; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A9A76606A332; Thu, 3 Dec 2026 12:17:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=BWRTq4TE Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E33B1F00896; Thu, 3 Dec 2026 12:17:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796300229; bh=x8IMyr1BQRdOyi/NQme8NgeyIj4qFnfsmDqDa3DFA/I=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=BWRTq4TEMw7RXakxNQdS9a00KxvKHFfd4M7cyr5T2YZCs6ldfelI5sfGDKnDTkqol RoxvOobzBR0zEVILPBWfUd/D/xh3+MPTvD4yFvvI3BHWiDoIF0QhB/QO2YKPWhQzYo 1sbu5BuG5r7ikFFwFREyu1H+IGqP1Iu54x5enwuutMMwrQWWJd2uOnCaLEnsFNxdDV UpJYY3E3rqPmy2W5f5L3p/vMb52sMfhMk6Pi7C4tgPv06KOZQdnz01MGOD46HBOZt2 OQh4MxyWhE1jwQwgWErRsaojtcBLDgk48yssG+soa+m5GuJsdskYT40w8S99okBRoV yfmYoP+dHFUGw== Subject: Re: [PATCH net] net/mlx5e: Fix the missing WQE count of large striding RQs 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 Date: Thu, 03 Dec 2026 12:17:07 +0000 Message-ID: <179630022795.3146.4180735893350917415@kernel.org> In-Reply-To: <20261202121422.3422569-1-tariqt@nvidia.com> References: <20261202121422.3422569-1-tariqt@nvidia.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 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