Commit 904f4f64 authored by Parav Pandit's avatar Parav Pandit Committed by Jason Gunthorpe

IB/core: Use valid port number to check link layer

IB HCA port starts from 1. Use IB core provided port iterator API to avoid
any assumption with start port number.

Link: https://lore.kernel.org/r/20210127150010.1876121-11-leon@kernel.orgSigned-off-by: default avatarParav Pandit <parav@nvidia.com>
Signed-off-by: default avatarLeon Romanovsky <leonro@nvidia.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent 6504c772
...@@ -2248,7 +2248,7 @@ static bool is_valid_mcast_lid(struct ib_qp *qp, u16 lid) ...@@ -2248,7 +2248,7 @@ static bool is_valid_mcast_lid(struct ib_qp *qp, u16 lid)
struct ib_qp_init_attr init_attr = {}; struct ib_qp_init_attr init_attr = {};
struct ib_qp_attr attr = {}; struct ib_qp_attr attr = {};
int num_eth_ports = 0; int num_eth_ports = 0;
int port; unsigned int port;
/* If QP state >= init, it is assigned to a port and we can check this /* If QP state >= init, it is assigned to a port and we can check this
* port only. * port only.
...@@ -2263,7 +2263,7 @@ static bool is_valid_mcast_lid(struct ib_qp *qp, u16 lid) ...@@ -2263,7 +2263,7 @@ static bool is_valid_mcast_lid(struct ib_qp *qp, u16 lid)
} }
/* Can't get a quick answer, iterate over all ports */ /* Can't get a quick answer, iterate over all ports */
for (port = 0; port < qp->device->phys_port_cnt; port++) rdma_for_each_port(qp->device, port)
if (rdma_port_get_link_layer(qp->device, port) != if (rdma_port_get_link_layer(qp->device, port) !=
IB_LINK_LAYER_INFINIBAND) IB_LINK_LAYER_INFINIBAND)
num_eth_ports++; num_eth_ports++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment