]> git.baikalelectronics.ru Git - kernel.git/commitdiff
RDMA/mlx5: Use correct device num_ports when modify DC
authorMark Zhang <markzhang@nvidia.com>
Thu, 20 Apr 2023 01:39:06 +0000 (04:39 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 May 2023 09:35:52 +0000 (11:35 +0200)
[ Upstream commit 746aa3c8cb1a650ff2583497ac646e505831b9b9 ]

Just like other QP types, when modify DC, the port_num should be compared
with dev->num_ports, instead of HCA_CAP.num_ports.  Otherwise Multi-port
vHCA on DC may not work.

Fixes: db517196ede3 ("IB/mlx5: Add support for DC target QP")
Link: https://lore.kernel.org/r/20230420013906.1244185-1-markzhang@nvidia.com
Signed-off-by: Mark Zhang <markzhang@nvidia.com>
Reviewed-by: Maor Gottlieb <maorg@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/infiniband/hw/mlx5/qp.c

index 6edd30c92156edbfa7bf867a3b6f5193439a7e7d..51623431b879abbb3a9f6e7b549c9ce983d3255f 100644 (file)
@@ -3821,7 +3821,7 @@ static int mlx5_ib_modify_dct(struct ib_qp *ibqp, struct ib_qp_attr *attr,
                        return -EINVAL;
 
                if (attr->port_num == 0 ||
-                   attr->port_num > MLX5_CAP_GEN(dev->mdev, num_ports)) {
+                   attr->port_num > dev->num_ports) {
                        mlx5_ib_dbg(dev, "invalid port number %d. number of ports is %d\n",
                                    attr->port_num, dev->num_ports);
                        return -EINVAL;