]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
IB/cm: Reduce dependency on gid attribute ndev check
authorParav Pandit <parav@mellanox.com>
Thu, 2 May 2019 07:48:02 +0000 (10:48 +0300)
committerJason Gunthorpe <jgg@mellanox.com>
Fri, 3 May 2019 14:10:02 +0000 (11:10 -0300)
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>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/core/cm.c

index 4df59f2b0f04c1086a07618ba0684a8c58a55dc3..da10e6ccb43cd033c0d7fd4f148b04793ff07e08 100644 (file)
@@ -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],