Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

IB/cm: Reduce dependency on gid attribute ndev check

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>

authored by

Parav Pandit and committed by
Jason Gunthorpe
8f974860 3bf3e2b8

+3 -2
+3 -2
drivers/infiniband/core/cm.c
··· 1985 1985 grh = rdma_ah_read_grh(&cm_id_priv->av.ah_attr); 1986 1986 gid_attr = grh->sgid_attr; 1987 1987 1988 - if (gid_attr && gid_attr->ndev) { 1988 + if (gid_attr && 1989 + rdma_protocol_roce(work->port->cm_dev->ib_device, 1990 + work->port->port_num)) { 1989 1991 work->path[0].rec_type = 1990 1992 sa_conv_gid_to_pathrec_type(gid_attr->gid_type); 1991 1993 } else { 1992 - /* If no GID attribute or ndev is null, it is not RoCE. */ 1993 1994 cm_path_set_rec_type(work->port->cm_dev->ib_device, 1994 1995 work->port->port_num, 1995 1996 &work->path[0],