diff mbox series

[rdma-next,v2,2/7] IB/cm: Reduce dependency on gid attribute ndev check

Message ID 20190502074807.26566-3-leon@kernel.org (mailing list archive)
State Mainlined
Commit 8f9748602491295b305960cd2cd4976ad15cb04f
Delegated to: Jason Gunthorpe
Headers show
Series Allow RoCE GID attribute netdev detachment | expand

Commit Message

Leon Romanovsky May 2, 2019, 7:48 a.m. UTC
From: Parav Pandit <parav@mellanox.com>

GID type to path record type conversion can be done directly
based on port type and gid attribute type.
There is no need to find out using indirect way by its GID attribute's
ndev field.

Signed-off-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 drivers/infiniband/core/cm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index 4df59f2b0f04..da10e6ccb43c 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -1985,11 +1985,12 @@  static int cm_req_handler(struct cm_work *work)
 	grh = rdma_ah_read_grh(&cm_id_priv->av.ah_attr);
 	gid_attr = grh->sgid_attr;
 
-	if (gid_attr && gid_attr->ndev) {
+	if (gid_attr &&
+	    rdma_protocol_roce(work->port->cm_dev->ib_device,
+			       work->port->port_num)) {
 		work->path[0].rec_type =
 			sa_conv_gid_to_pathrec_type(gid_attr->gid_type);
 	} else {
-		/* If no GID attribute or ndev is null, it is not RoCE. */
 		cm_path_set_rec_type(work->port->cm_dev->ib_device,
 				     work->port->port_num,
 				     &work->path[0],