IB/Verbs: Reform route related part in IB-core cma

Use raw management helpers to reform route related part in IB-core cma.

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:
Michael Wang 2015-05-05 14:50:28 +02:00 committed by Doug Ledford
parent 21655afc62
commit c72f21893e
2 changed files with 14 additions and 42 deletions

View File

@ -930,13 +930,9 @@ 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)
{ {
switch (rdma_port_get_link_layer(id_priv->id.device, id_priv->id.port_num)) { if (rdma_protocol_ib(id_priv->id.device, id_priv->id.port_num)) {
case IB_LINK_LAYER_INFINIBAND:
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);
break;
default:
break;
} }
} }
@ -1964,26 +1960,15 @@ 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);
switch (rdma_node_get_transport(id->device->node_type)) { if (rdma_protocol_ib(id->device, id->port_num))
case RDMA_TRANSPORT_IB:
switch (rdma_port_get_link_layer(id->device, id->port_num)) {
case IB_LINK_LAYER_INFINIBAND:
ret = cma_resolve_ib_route(id_priv, timeout_ms); ret = cma_resolve_ib_route(id_priv, timeout_ms);
break; else if (rdma_protocol_iboe(id->device, id->port_num))
case IB_LINK_LAYER_ETHERNET:
ret = cma_resolve_iboe_route(id_priv); ret = cma_resolve_iboe_route(id_priv);
break; else if (rdma_protocol_iwarp(id->device, id->port_num))
default:
ret = -ENOSYS;
}
break;
case RDMA_TRANSPORT_IWARP:
ret = cma_resolve_iw_route(id_priv, timeout_ms); ret = cma_resolve_iw_route(id_priv, timeout_ms);
break; else
default:
ret = -ENOSYS; ret = -ENOSYS;
break;
}
if (ret) if (ret)
goto err; goto err;

View File

@ -722,26 +722,13 @@ 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;
switch (rdma_node_get_transport(ctx->cm_id->device->node_type)) {
case RDMA_TRANSPORT_IB: if (rdma_protocol_ib(ctx->cm_id->device, ctx->cm_id->port_num))
switch (rdma_port_get_link_layer(ctx->cm_id->device,
ctx->cm_id->port_num)) {
case IB_LINK_LAYER_INFINIBAND:
ucma_copy_ib_route(&resp, &ctx->cm_id->route); ucma_copy_ib_route(&resp, &ctx->cm_id->route);
break; else if (rdma_protocol_iboe(ctx->cm_id->device, ctx->cm_id->port_num))
case IB_LINK_LAYER_ETHERNET:
ucma_copy_iboe_route(&resp, &ctx->cm_id->route); ucma_copy_iboe_route(&resp, &ctx->cm_id->route);
break; else if (rdma_protocol_iwarp(ctx->cm_id->device, ctx->cm_id->port_num))
default:
break;
}
break;
case RDMA_TRANSPORT_IWARP:
ucma_copy_iw_route(&resp, &ctx->cm_id->route); ucma_copy_iw_route(&resp, &ctx->cm_id->route);
break;
default:
break;
}
out: out:
if (copy_to_user((void __user *)(unsigned long)cmd.response, if (copy_to_user((void __user *)(unsigned long)cmd.response,