Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Tariq Toukan" <tariqt@nvidia.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH net-next V2 06/13] net/mlx5e: Add data direct RX infrastructure
Date: Wed, 11 Nov 2026 18:40:34 +0000	[thread overview]
Message-ID: <sashiko-outbox-209474@kernel.org> (raw)
In-Reply-To: <20261110183826.2927274-7-tariqt@nvidia.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] net/mlx5e: SHAMPO header buffer double-sized in
  mlx5e_shampo_hd_per_wqe()
--

commit 65149098852b3b139560ca93742af4a582b969d5
Author: Dragos Tatulea <dtatulea@nvidia.com>

net/mlx5e: Add data direct RX infrastructure

This commit adds RX infrastructure for data direct mode, including a new
RQ state flag, crossing and KSM mkeys, and ICOSQ sizing for KSM UMR WQEs.

> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/params.c b/drivers/net/ethernet/mellanox/mlx5/core/en/params.c
> index 5caf7820a136b..61a77ee77244a 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en/params.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/params.c
> @@ -62,6 +62,9 @@ mlx5e_mpwrq_umr_mode(struct mlx5_core_dev *mdev,
>  	bool unaligned = xsk ? xsk->unaligned : false;
>  	bool oversized = false;
>  
> +	if (rqo && rqo->data_direct)
> +		return MLX5E_MPWRQ_UMR_MODE_UNALIGNED;
> +
>  	if (xsk) {
>  		oversized = xsk->chunk_size < (1 << page_shift);
>  		WARN_ON_ONCE(xsk->chunk_size > (1 << page_shift));

[Severity: Medium]
Does switching data-direct SHAMPO RQs to MLX5E_MPWRQ_UMR_MODE_UNALIGNED
cause mlx5e_shampo_hd_per_wq() to double-size the SHAMPO header buffer and
overflow log_headers_buffer_entry_num at maximum ring size?

With 4KB pages, MLX5E_MPWRQ_UMR_MODE_UNALIGNED uses 16-byte KSM entries
instead of 8-byte MTT entries, which halves the WQE size from 256KB to
128KB and doubles wq_size in rq_param->rqc.  However,
mlx5e_shampo_hd_per_wqe() ignores rq_param and passes NULL for rqo:

drivers/net/ethernet/mellanox/mlx5/core/en/params.c:mlx5e_shampo_hd_per_wqe() {
	u16 num_strides = BIT(mlx5e_mpwqe_get_log_num_strides(mdev, params, NULL));
	u8 log_stride_sz = mlx5e_mpwqe_get_log_stride_size(mdev, params, NULL);
	int pkt_per_rsrv = BIT(mlx5e_shampo_get_log_pkt_per_rsrv(params));
	int wqe_size = BIT(log_stride_sz) * num_strides;
    ...
}

Because rqo is NULL, mlx5e_shampo_hd_per_wqe() computes wqe_size for
MLX5E_MPWRQ_UMR_MODE_ALIGNED (256KB) instead of UNALIGNED (128KB), and
mlx5e_shampo_hd_per_wq() multiplies that unhalved hd_per_wqe by the
doubled wq_size from rq_param->rqc.  This allocates twice as many SHAMPO
header pages as needed, and when log_rq_mtu_frames is 13 with sw_mtu <=
1024, hd_per_wq doubles from 32768 to 65536, causing
order_base_2(rq->mpwqe.shampo->hd_per_wq) (16) in mlx5e_create_rq() to
overflow the 4-bit log_headers_buffer_entry_num hardware field to 0.

Passing rqo (or reading log_wqe_num_of_strides and log_wqe_stride_size
from rq_param->rqc) in mlx5e_shampo_hd_per_wqe() would compute the actual
WQE size.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261110183826.2927274-1-tariqt@nvidia.com?part=6

  reply	other threads:[~2026-11-11 18:40 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10 18:38 [PATCH net-next V2 00/13] net/mlx5e: Add netdev support for data direct Tariq Toukan
2026-11-10 18:38 ` [PATCH net-next V2 01/13] net/mlx5: Log the data direct to PF device mapping Tariq Toukan
2026-11-11 18:40   ` sashiko-bot
2026-11-10 18:38 ` [PATCH net-next V2 02/13] net/mlx5: Detach auxiliary devices on attach failure during load Tariq Toukan
2026-11-11 18:40   ` sashiko-bot
2026-11-10 18:38 ` [PATCH net-next V2 03/13] net/mlx5e: Register supported netdevs as data direct users Tariq Toukan
2026-11-11 18:40   ` sashiko-bot
2026-11-10 18:38 ` [PATCH net-next V2 04/13] net/mlx5e: Pre-calculate UMR padding and entry size Tariq Toukan
2026-11-11 18:40   ` sashiko-bot
2026-11-10 18:38 ` [PATCH net-next V2 05/13] net/mlx5e: Add data direct ethtool private flag Tariq Toukan
2026-11-11 18:40   ` sashiko-bot
2026-11-10 18:38 ` [PATCH net-next V2 06/13] net/mlx5e: Add data direct RX infrastructure Tariq Toukan
2026-11-11 18:40   ` sashiko-bot [this message]
2026-11-10 18:38 ` [PATCH net-next V2 07/13] net/mlx5e: SHAMPO, Use page_pool DMA sync helper for SKB frags Tariq Toukan
2026-11-11 18:40   ` sashiko-bot
2026-11-10 18:38 ` [PATCH net-next V2 08/13] net/mlx5e: Add data direct TX infrastructure Tariq Toukan
2026-11-11 18:40   ` sashiko-bot
2026-11-10 18:38 ` [PATCH net-next V2 09/13] net/mlx5e: Use the correct DMA dev when data_direct is enabled Tariq Toukan
2026-11-11 18:40   ` sashiko-bot
2026-11-10 18:38 ` [PATCH net-next V2 10/13] net: devmem: add netdev_has_dmabuf_binding() helper Tariq Toukan
2026-11-11 18:40   ` sashiko-bot
2026-11-11 21:46   ` Stanislav Fomichev
2026-11-10 18:38 ` [PATCH net-next V2 11/13] net: add netdev_unbind_dma_dev() helper Tariq Toukan
2026-11-11 18:40   ` sashiko-bot
2026-11-10 18:38 ` [PATCH net-next V2 12/13] net/mlx5e: Disable data direct on data direct device unbind Tariq Toukan
2026-11-11 18:40   ` sashiko-bot
2026-11-10 18:38 ` [PATCH net-next V2 13/13] net/mlx5e: Enable the data direct netdev feature Tariq Toukan
2026-11-11 18:40   ` sashiko-bot

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=sashiko-outbox-209474@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=tariqt@nvidia.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