mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-02 06:26:39 +07:00
IB/Verbs: Use management helper rdma_cap_ib_sa()
Introduce helper rdma_cap_ib_sa() to help us check if the port of an IB device support Infiniband Subnet Administration. Signed-off-by: Michael Wang <yun.wang@profitbricks.com> Reviewed-by: Ira Weiny <ira.weiny@intel.com> Tested-by: Ira Weiny <ira.weiny@intel.com> Reviewed-by: Sean Hefty <sean.hefty@intel.com> Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> Tested-by: Doug Ledford <dledford@redhat.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
parent
042153306d
commit
fe53ba2f0c
@ -940,7 +940,7 @@ static inline int cma_user_data_offset(struct rdma_id_private *id_priv)
|
|||||||
|
|
||||||
static void cma_cancel_route(struct rdma_id_private *id_priv)
|
static void cma_cancel_route(struct rdma_id_private *id_priv)
|
||||||
{
|
{
|
||||||
if (rdma_protocol_ib(id_priv->id.device, id_priv->id.port_num)) {
|
if (rdma_cap_ib_sa(id_priv->id.device, id_priv->id.port_num)) {
|
||||||
if (id_priv->query)
|
if (id_priv->query)
|
||||||
ib_sa_cancel_query(id_priv->query_id, id_priv->query);
|
ib_sa_cancel_query(id_priv->query_id, id_priv->query);
|
||||||
}
|
}
|
||||||
@ -1964,7 +1964,7 @@ int rdma_resolve_route(struct rdma_cm_id *id, int timeout_ms)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
atomic_inc(&id_priv->refcount);
|
atomic_inc(&id_priv->refcount);
|
||||||
if (rdma_protocol_ib(id->device, id->port_num))
|
if (rdma_cap_ib_sa(id->device, id->port_num))
|
||||||
ret = cma_resolve_ib_route(id_priv, timeout_ms);
|
ret = cma_resolve_ib_route(id_priv, timeout_ms);
|
||||||
else if (rdma_protocol_iboe(id->device, id->port_num))
|
else if (rdma_protocol_iboe(id->device, id->port_num))
|
||||||
ret = cma_resolve_iboe_route(id_priv);
|
ret = cma_resolve_iboe_route(id_priv);
|
||||||
|
@ -450,7 +450,7 @@ static void ib_sa_event(struct ib_event_handler *handler, struct ib_event *event
|
|||||||
struct ib_sa_port *port =
|
struct ib_sa_port *port =
|
||||||
&sa_dev->port[event->element.port_num - sa_dev->start_port];
|
&sa_dev->port[event->element.port_num - sa_dev->start_port];
|
||||||
|
|
||||||
if (WARN_ON(!rdma_protocol_ib(handler->device, port->port_num)))
|
if (WARN_ON(!rdma_cap_ib_sa(handler->device, port->port_num)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
spin_lock_irqsave(&port->ah_lock, flags);
|
spin_lock_irqsave(&port->ah_lock, flags);
|
||||||
@ -1173,7 +1173,7 @@ static void ib_sa_add_one(struct ib_device *device)
|
|||||||
|
|
||||||
for (i = 0; i <= e - s; ++i) {
|
for (i = 0; i <= e - s; ++i) {
|
||||||
spin_lock_init(&sa_dev->port[i].ah_lock);
|
spin_lock_init(&sa_dev->port[i].ah_lock);
|
||||||
if (!rdma_protocol_ib(device, i + 1))
|
if (!rdma_cap_ib_sa(device, i + 1))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
sa_dev->port[i].sm_ah = NULL;
|
sa_dev->port[i].sm_ah = NULL;
|
||||||
@ -1208,7 +1208,7 @@ static void ib_sa_add_one(struct ib_device *device)
|
|||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
for (i = 0; i <= e - s; ++i) {
|
for (i = 0; i <= e - s; ++i) {
|
||||||
if (rdma_protocol_ib(device, i + 1))
|
if (rdma_cap_ib_sa(device, i + 1))
|
||||||
update_sm_ah(&sa_dev->port[i].update_task);
|
update_sm_ah(&sa_dev->port[i].update_task);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1216,7 +1216,7 @@ static void ib_sa_add_one(struct ib_device *device)
|
|||||||
|
|
||||||
err:
|
err:
|
||||||
while (--i >= 0) {
|
while (--i >= 0) {
|
||||||
if (rdma_protocol_ib(device, i + 1))
|
if (rdma_cap_ib_sa(device, i + 1))
|
||||||
ib_unregister_mad_agent(sa_dev->port[i].agent);
|
ib_unregister_mad_agent(sa_dev->port[i].agent);
|
||||||
}
|
}
|
||||||
free:
|
free:
|
||||||
@ -1237,7 +1237,7 @@ static void ib_sa_remove_one(struct ib_device *device)
|
|||||||
flush_workqueue(ib_wq);
|
flush_workqueue(ib_wq);
|
||||||
|
|
||||||
for (i = 0; i <= sa_dev->end_port - sa_dev->start_port; ++i) {
|
for (i = 0; i <= sa_dev->end_port - sa_dev->start_port; ++i) {
|
||||||
if (rdma_protocol_ib(device, i + 1)) {
|
if (rdma_cap_ib_sa(device, i + 1)) {
|
||||||
ib_unregister_mad_agent(sa_dev->port[i].agent);
|
ib_unregister_mad_agent(sa_dev->port[i].agent);
|
||||||
if (sa_dev->port[i].sm_ah)
|
if (sa_dev->port[i].sm_ah)
|
||||||
kref_put(&sa_dev->port[i].sm_ah->ref, free_sm_ah);
|
kref_put(&sa_dev->port[i].sm_ah->ref, free_sm_ah);
|
||||||
|
@ -723,7 +723,7 @@ static ssize_t ucma_query_route(struct ucma_file *file,
|
|||||||
resp.node_guid = (__force __u64) ctx->cm_id->device->node_guid;
|
resp.node_guid = (__force __u64) ctx->cm_id->device->node_guid;
|
||||||
resp.port_num = ctx->cm_id->port_num;
|
resp.port_num = ctx->cm_id->port_num;
|
||||||
|
|
||||||
if (rdma_protocol_ib(ctx->cm_id->device, ctx->cm_id->port_num))
|
if (rdma_cap_ib_sa(ctx->cm_id->device, ctx->cm_id->port_num))
|
||||||
ucma_copy_ib_route(&resp, &ctx->cm_id->route);
|
ucma_copy_ib_route(&resp, &ctx->cm_id->route);
|
||||||
else if (rdma_protocol_iboe(ctx->cm_id->device, ctx->cm_id->port_num))
|
else if (rdma_protocol_iboe(ctx->cm_id->device, ctx->cm_id->port_num))
|
||||||
ucma_copy_iboe_route(&resp, &ctx->cm_id->route);
|
ucma_copy_iboe_route(&resp, &ctx->cm_id->route);
|
||||||
|
@ -1834,6 +1834,21 @@ static inline bool rdma_cap_iw_cm(struct ib_device *device, u8 port_num)
|
|||||||
return rdma_protocol_iwarp(device, port_num);
|
return rdma_protocol_iwarp(device, port_num);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* rdma_cap_ib_sa - Check if the port of device has the capability Infiniband
|
||||||
|
* Subnet Administration.
|
||||||
|
*
|
||||||
|
* @device: Device to be checked
|
||||||
|
* @port_num: Port number of the device
|
||||||
|
*
|
||||||
|
* Return false when port of the device don't support Infiniband
|
||||||
|
* Subnet Administration.
|
||||||
|
*/
|
||||||
|
static inline bool rdma_cap_ib_sa(struct ib_device *device, u8 port_num)
|
||||||
|
{
|
||||||
|
return rdma_protocol_ib(device, port_num);
|
||||||
|
}
|
||||||
|
|
||||||
int ib_query_gid(struct ib_device *device,
|
int ib_query_gid(struct ib_device *device,
|
||||||
u8 port_num, int index, union ib_gid *gid);
|
u8 port_num, int index, union ib_gid *gid);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user