RDMA: Convert drivers to use sgid_attr instead of sgid_index

The core code now ensures that all driver callbacks that receive an
rdma_ah_attrs will have a sgid_attr's pointer if there is a GRH present.

Drivers can use this pointer instead of calling a query function with
sgid_index. This simplifies the drivers and also avoids races where a
gid_index lookup may return different data if it is changed.

Signed-off-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
This commit is contained in:
Parav Pandit
2018-06-13 10:22:06 +03:00
committed by Jason Gunthorpe
parent d97099fe53
commit 47ec386662
16 changed files with 97 additions and 238 deletions

View File

@@ -149,13 +149,13 @@ static inline enum ib_gid_type ib_network_to_gid_type(enum rdma_network_type net
return IB_GID_TYPE_IB;
}
static inline enum rdma_network_type ib_gid_to_network_type(enum ib_gid_type gid_type,
union ib_gid *gid)
static inline enum rdma_network_type
rdma_gid_attr_network_type(const struct ib_gid_attr *attr)
{
if (gid_type == IB_GID_TYPE_IB)
if (attr->gid_type == IB_GID_TYPE_IB)
return RDMA_NETWORK_IB;
if (ipv6_addr_v4mapped((struct in6_addr *)gid))
if (ipv6_addr_v4mapped((struct in6_addr *)&attr->gid))
return RDMA_NETWORK_IPV4;
else
return RDMA_NETWORK_IPV6;