]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
RDMA/mlx5: Better estimate max_qp_wr to reflect WQE count
authorOr Har-Toov <ohartoov@nvidia.com>
Wed, 13 Aug 2025 12:39:56 +0000 (15:39 +0300)
committerJason Gunthorpe <jgg@nvidia.com>
Mon, 25 Aug 2025 17:42:19 +0000 (14:42 -0300)
commit1a7c18c485bf17ef408d5ebb7f83e1f8ef329585
tree40bce48b5dc258f09769e521e7e7f6ee02927691
parentd9e6e85b7beb2aeb8defac2f705b23532ddb25d4
RDMA/mlx5: Better estimate max_qp_wr to reflect WQE count

The mlx5 driver currently derives max_qp_wr directly from the
log_max_qp_sz HCA capability:

    props->max_qp_wr = 1 << MLX5_CAP_GEN(mdev, log_max_qp_sz);

However, this value represents the number of WQEs in units of Basic
Blocks (see MLX5_SEND_WQE_BB), not actual number of WQEs.  Since the size
of a WQE can vary depending on transport type and features (e.g., atomic
operations, UMR, LSO), the actual number of WQEs can be significantly
smaller than the WQEBB count suggests.

This patch introduces a conservative estimation of the worst-case WQE size
— considering largest segments possible with 1 SGE and no inline data or
special features. It uses this to derive a more accurate max_qp_wr value.

Fixes: 938fe83c8dcb ("net/mlx5_core: New device capabilities handling")
Link: https://patch.msgid.link/r/7d992c9831c997ed5c33d30973406dc2dcaf5e89.1755088725.git.leon@kernel.org
Reported-by: Chuck Lever <cel@kernel.org>
Closes: https://lore.kernel.org/all/20250506142202.GJ2260621@ziepe.ca/
Signed-off-by: Or Har-Toov <ohartoov@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/mlx5/main.c