mirror of
https://github.com/torvalds/linux.git
synced 2024-11-27 14:41:39 +00:00
RDMA/providers: Simplify query_gid callback of RoCE providers
ib_query_gid() fetches the GID from the software cache maintained in ib_core for RoCE ports. Therefore, simplify the provider drivers for RoCE to treat query_gid() callback as never called for RoCE, and only require non-RoCE devices to implement it. Signed-off-by: Parav Pandit <parav@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
This commit is contained in:
parent
72e1ff0fb7
commit
0e1f9b9244
@ -103,7 +103,6 @@ static int ib_device_check_mandatory(struct ib_device *device)
|
||||
IB_MANDATORY_FUNC(query_device),
|
||||
IB_MANDATORY_FUNC(query_port),
|
||||
IB_MANDATORY_FUNC(query_pkey),
|
||||
IB_MANDATORY_FUNC(query_gid),
|
||||
IB_MANDATORY_FUNC(alloc_pd),
|
||||
IB_MANDATORY_FUNC(dealloc_pd),
|
||||
IB_MANDATORY_FUNC(create_ah),
|
||||
@ -884,6 +883,9 @@ int ib_query_gid(struct ib_device *device,
|
||||
if (attr)
|
||||
return -EINVAL;
|
||||
|
||||
if (!device->query_gid)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
return device->query_gid(device, port_num, index, gid);
|
||||
}
|
||||
EXPORT_SYMBOL(ib_query_gid);
|
||||
|
@ -574,7 +574,6 @@ static int bnxt_re_register_ib(struct bnxt_re_dev *rdev)
|
||||
ibdev->get_port_immutable = bnxt_re_get_port_immutable;
|
||||
ibdev->get_dev_fw_str = bnxt_re_query_fw_str;
|
||||
ibdev->query_pkey = bnxt_re_query_pkey;
|
||||
ibdev->query_gid = bnxt_re_query_gid;
|
||||
ibdev->get_netdev = bnxt_re_get_netdev;
|
||||
ibdev->add_gid = bnxt_re_add_gid;
|
||||
ibdev->del_gid = bnxt_re_del_gid;
|
||||
|
@ -296,12 +296,6 @@ static enum rdma_link_layer hns_roce_get_link_layer(struct ib_device *device,
|
||||
return IB_LINK_LAYER_ETHERNET;
|
||||
}
|
||||
|
||||
static int hns_roce_query_gid(struct ib_device *ib_dev, u8 port_num, int index,
|
||||
union ib_gid *gid)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hns_roce_query_pkey(struct ib_device *ib_dev, u8 port, u16 index,
|
||||
u16 *pkey)
|
||||
{
|
||||
@ -482,7 +476,6 @@ static int hns_roce_register_device(struct hns_roce_dev *hr_dev)
|
||||
ib_dev->modify_port = hns_roce_modify_port;
|
||||
ib_dev->get_link_layer = hns_roce_get_link_layer;
|
||||
ib_dev->get_netdev = hns_roce_get_netdev;
|
||||
ib_dev->query_gid = hns_roce_query_gid;
|
||||
ib_dev->add_gid = hns_roce_add_gid;
|
||||
ib_dev->del_gid = hns_roce_del_gid;
|
||||
ib_dev->query_pkey = hns_roce_query_pkey;
|
||||
|
@ -888,24 +888,9 @@ out:
|
||||
static int mlx4_ib_query_gid(struct ib_device *ibdev, u8 port, int index,
|
||||
union ib_gid *gid)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (rdma_protocol_ib(ibdev, port))
|
||||
return __mlx4_ib_query_gid(ibdev, port, index, gid, 0);
|
||||
|
||||
if (!rdma_protocol_roce(ibdev, port))
|
||||
return -ENODEV;
|
||||
|
||||
if (!rdma_cap_roce_gid_table(ibdev, port))
|
||||
return -ENODEV;
|
||||
|
||||
ret = ib_get_cached_gid(ibdev, port, index, gid, NULL);
|
||||
if (ret == -EAGAIN) {
|
||||
memcpy(gid, &zgid, sizeof(*gid));
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mlx4_ib_query_sl2vl(struct ib_device *ibdev, u8 port, u64 *sl2vl_tbl)
|
||||
|
@ -158,7 +158,6 @@ static int ocrdma_register_device(struct ocrdma_dev *dev)
|
||||
dev->ibdev.query_device = ocrdma_query_device;
|
||||
dev->ibdev.query_port = ocrdma_query_port;
|
||||
dev->ibdev.modify_port = ocrdma_modify_port;
|
||||
dev->ibdev.query_gid = ocrdma_query_gid;
|
||||
dev->ibdev.get_netdev = ocrdma_get_netdev;
|
||||
dev->ibdev.get_link_layer = ocrdma_link_layer;
|
||||
dev->ibdev.alloc_pd = ocrdma_alloc_pd;
|
||||
|
@ -62,24 +62,6 @@ int ocrdma_query_pkey(struct ib_device *ibdev, u8 port, u16 index, u16 *pkey)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ocrdma_query_gid(struct ib_device *ibdev, u8 port,
|
||||
int index, union ib_gid *sgid)
|
||||
{
|
||||
int ret;
|
||||
|
||||
memset(sgid, 0, sizeof(*sgid));
|
||||
if (index >= OCRDMA_MAX_SGID)
|
||||
return -EINVAL;
|
||||
|
||||
ret = ib_get_cached_gid(ibdev, port, index, sgid, NULL);
|
||||
if (ret == -EAGAIN) {
|
||||
memcpy(sgid, &zgid, sizeof(*sgid));
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ocrdma_query_device(struct ib_device *ibdev, struct ib_device_attr *attr,
|
||||
struct ib_udata *uhw)
|
||||
{
|
||||
|
@ -61,8 +61,6 @@ enum rdma_protocol_type
|
||||
ocrdma_query_protocol(struct ib_device *device, u8 port_num);
|
||||
|
||||
void ocrdma_get_guid(struct ocrdma_dev *, u8 *guid);
|
||||
int ocrdma_query_gid(struct ib_device *, u8 port,
|
||||
int index, union ib_gid *gid);
|
||||
struct net_device *ocrdma_get_netdev(struct ib_device *device, u8 port_num);
|
||||
int ocrdma_query_pkey(struct ib_device *, u8 port, u16 index, u16 *pkey);
|
||||
|
||||
|
@ -162,7 +162,6 @@ static int qedr_iw_register_device(struct qedr_dev *dev)
|
||||
static void qedr_roce_register_device(struct qedr_dev *dev)
|
||||
{
|
||||
dev->ibdev.node_type = RDMA_NODE_IB_CA;
|
||||
dev->ibdev.query_gid = qedr_query_gid;
|
||||
|
||||
dev->ibdev.get_port_immutable = qedr_roce_port_immutable;
|
||||
}
|
||||
|
@ -84,27 +84,6 @@ int qedr_iw_query_gid(struct ib_device *ibdev, u8 port,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int qedr_query_gid(struct ib_device *ibdev, u8 port, int index,
|
||||
union ib_gid *sgid)
|
||||
{
|
||||
struct qedr_dev *dev = get_qedr_dev(ibdev);
|
||||
int rc = 0;
|
||||
|
||||
if (!rdma_cap_roce_gid_table(ibdev, port))
|
||||
return -ENODEV;
|
||||
|
||||
rc = ib_get_cached_gid(ibdev, port, index, sgid, NULL);
|
||||
if (rc == -EAGAIN) {
|
||||
memcpy(sgid, &zgid, sizeof(*sgid));
|
||||
return 0;
|
||||
}
|
||||
|
||||
DP_DEBUG(dev, QEDR_MSG_INIT, "query gid: index=%d %llx:%llx\n", index,
|
||||
sgid->global.interface_id, sgid->global.subnet_prefix);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int qedr_query_device(struct ib_device *ibdev,
|
||||
struct ib_device_attr *attr, struct ib_udata *udata)
|
||||
{
|
||||
|
@ -38,7 +38,6 @@ int qedr_query_port(struct ib_device *, u8 port, struct ib_port_attr *props);
|
||||
int qedr_modify_port(struct ib_device *, u8 port, int mask,
|
||||
struct ib_port_modify *props);
|
||||
|
||||
int qedr_query_gid(struct ib_device *, u8 port, int index, union ib_gid *gid);
|
||||
int qedr_iw_query_gid(struct ib_device *ibdev, u8 port,
|
||||
int index, union ib_gid *gid);
|
||||
|
||||
|
@ -77,23 +77,6 @@ out:
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int rxe_query_gid(struct ib_device *device,
|
||||
u8 port_num, int index, union ib_gid *gid)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (index > RXE_PORT_GID_TBL_LEN)
|
||||
return -EINVAL;
|
||||
|
||||
ret = ib_get_cached_gid(device, port_num, index, gid, NULL);
|
||||
if (ret == -EAGAIN) {
|
||||
memcpy(gid, &zgid, sizeof(*gid));
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int rxe_add_gid(struct ib_device *device, u8 port_num, unsigned int
|
||||
index, const union ib_gid *gid,
|
||||
const struct ib_gid_attr *attr, void **context)
|
||||
@ -1285,7 +1268,6 @@ int rxe_register_device(struct rxe_dev *rxe)
|
||||
dev->query_port = rxe_query_port;
|
||||
dev->modify_port = rxe_modify_port;
|
||||
dev->get_link_layer = rxe_get_link_layer;
|
||||
dev->query_gid = rxe_query_gid;
|
||||
dev->get_netdev = rxe_get_netdev;
|
||||
dev->add_gid = rxe_add_gid;
|
||||
dev->del_gid = rxe_del_gid;
|
||||
|
Loading…
Reference in New Issue
Block a user