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:

zatwierdzone przez
Jason Gunthorpe

rodzic
d97099fe53
commit
47ec386662
@@ -524,41 +524,15 @@ static int mlx5_ib_del_gid(const struct ib_gid_attr *attr,
|
||||
attr->index, NULL, NULL);
|
||||
}
|
||||
|
||||
__be16 mlx5_get_roce_udp_sport(struct mlx5_ib_dev *dev, u8 port_num,
|
||||
int index)
|
||||
__be16 mlx5_get_roce_udp_sport(struct mlx5_ib_dev *dev,
|
||||
const struct ib_gid_attr *attr)
|
||||
{
|
||||
struct ib_gid_attr attr;
|
||||
union ib_gid gid;
|
||||
|
||||
if (ib_get_cached_gid(&dev->ib_dev, port_num, index, &gid, &attr))
|
||||
return 0;
|
||||
|
||||
dev_put(attr.ndev);
|
||||
|
||||
if (attr.gid_type != IB_GID_TYPE_ROCE_UDP_ENCAP)
|
||||
if (attr->gid_type != IB_GID_TYPE_ROCE_UDP_ENCAP)
|
||||
return 0;
|
||||
|
||||
return cpu_to_be16(MLX5_CAP_ROCE(dev->mdev, r_roce_min_src_udp_port));
|
||||
}
|
||||
|
||||
int mlx5_get_roce_gid_type(struct mlx5_ib_dev *dev, u8 port_num,
|
||||
int index, enum ib_gid_type *gid_type)
|
||||
{
|
||||
struct ib_gid_attr attr;
|
||||
union ib_gid gid;
|
||||
int ret;
|
||||
|
||||
ret = ib_get_cached_gid(&dev->ib_dev, port_num, index, &gid, &attr);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
dev_put(attr.ndev);
|
||||
|
||||
*gid_type = attr.gid_type;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mlx5_use_mad_ifc(struct mlx5_ib_dev *dev)
|
||||
{
|
||||
if (MLX5_CAP_GEN(dev->mdev, port_type) == MLX5_CAP_PORT_TYPE_IB)
|
||||
|
Reference in New Issue
Block a user