aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorSean Hefty <sean.hefty@intel.com>2013-05-29 13:09:28 -0400
committerRoland Dreier <roland@purestorage.com>2013-06-21 02:35:41 -0400
commitcf53936f229d81131fef475919f163ce566a205f (patch)
tree94031fdd3349e307cd8cc72b01764e85efc46165 /drivers/infiniband
parentac53b264b2f39e89781e3b855008123dfdb44aea (diff)
RDMA/cma: Export cma_get_service_id()
Allow the rdma_ucm to query the IB service ID formed or allocated by the rdma_cm by exporting the cma_get_service_id() functionality. Signed-off-by: Sean Hefty <sean.hefty@intel.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/core/cma.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index 6a0ee9265015..32d74c76e638 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -1336,13 +1336,14 @@ err1:
1336 return ret; 1336 return ret;
1337} 1337}
1338 1338
1339static __be64 cma_get_service_id(enum rdma_port_space ps, struct sockaddr *addr) 1339__be64 rdma_get_service_id(struct rdma_cm_id *id, struct sockaddr *addr)
1340{ 1340{
1341 if (addr->sa_family == AF_IB) 1341 if (addr->sa_family == AF_IB)
1342 return ((struct sockaddr_ib *) addr)->sib_sid; 1342 return ((struct sockaddr_ib *) addr)->sib_sid;
1343 1343
1344 return cpu_to_be64(((u64)ps << 16) + be16_to_cpu(cma_port(addr))); 1344 return cpu_to_be64(((u64)id->ps << 16) + be16_to_cpu(cma_port(addr)));
1345} 1345}
1346EXPORT_SYMBOL(rdma_get_service_id);
1346 1347
1347static void cma_set_compare_data(enum rdma_port_space ps, struct sockaddr *addr, 1348static void cma_set_compare_data(enum rdma_port_space ps, struct sockaddr *addr,
1348 struct ib_cm_compare_data *compare) 1349 struct ib_cm_compare_data *compare)
@@ -1556,7 +1557,7 @@ static int cma_ib_listen(struct rdma_id_private *id_priv)
1556 id_priv->cm_id.ib = id; 1557 id_priv->cm_id.ib = id;
1557 1558
1558 addr = cma_src_addr(id_priv); 1559 addr = cma_src_addr(id_priv);
1559 svc_id = cma_get_service_id(id_priv->id.ps, addr); 1560 svc_id = rdma_get_service_id(&id_priv->id, addr);
1560 if (cma_any_addr(addr) && !id_priv->afonly) 1561 if (cma_any_addr(addr) && !id_priv->afonly)
1561 ret = ib_cm_listen(id_priv->cm_id.ib, svc_id, 0, NULL); 1562 ret = ib_cm_listen(id_priv->cm_id.ib, svc_id, 0, NULL);
1562 else { 1563 else {
@@ -1699,7 +1700,7 @@ static int cma_query_ib_route(struct rdma_id_private *id_priv, int timeout_ms,
1699 path_rec.pkey = cpu_to_be16(ib_addr_get_pkey(dev_addr)); 1700 path_rec.pkey = cpu_to_be16(ib_addr_get_pkey(dev_addr));
1700 path_rec.numb_path = 1; 1701 path_rec.numb_path = 1;
1701 path_rec.reversible = 1; 1702 path_rec.reversible = 1;
1702 path_rec.service_id = cma_get_service_id(id_priv->id.ps, cma_dst_addr(id_priv)); 1703 path_rec.service_id = rdma_get_service_id(&id_priv->id, cma_dst_addr(id_priv));
1703 1704
1704 comp_mask = IB_SA_PATH_REC_DGID | IB_SA_PATH_REC_SGID | 1705 comp_mask = IB_SA_PATH_REC_DGID | IB_SA_PATH_REC_SGID |
1705 IB_SA_PATH_REC_PKEY | IB_SA_PATH_REC_NUMB_PATH | 1706 IB_SA_PATH_REC_PKEY | IB_SA_PATH_REC_NUMB_PATH |
@@ -2710,7 +2711,7 @@ static int cma_resolve_ib_udp(struct rdma_id_private *id_priv,
2710 id_priv->cm_id.ib = id; 2711 id_priv->cm_id.ib = id;
2711 2712
2712 req.path = id_priv->id.route.path_rec; 2713 req.path = id_priv->id.route.path_rec;
2713 req.service_id = cma_get_service_id(id_priv->id.ps, cma_dst_addr(id_priv)); 2714 req.service_id = rdma_get_service_id(&id_priv->id, cma_dst_addr(id_priv));
2714 req.timeout_ms = 1 << (CMA_CM_RESPONSE_TIMEOUT - 8); 2715 req.timeout_ms = 1 << (CMA_CM_RESPONSE_TIMEOUT - 8);
2715 req.max_cm_retries = CMA_MAX_CM_RETRIES; 2716 req.max_cm_retries = CMA_MAX_CM_RETRIES;
2716 2717
@@ -2770,7 +2771,7 @@ static int cma_connect_ib(struct rdma_id_private *id_priv,
2770 if (route->num_paths == 2) 2771 if (route->num_paths == 2)
2771 req.alternate_path = &route->path_rec[1]; 2772 req.alternate_path = &route->path_rec[1];
2772 2773
2773 req.service_id = cma_get_service_id(id_priv->id.ps, cma_dst_addr(id_priv)); 2774 req.service_id = rdma_get_service_id(&id_priv->id, cma_dst_addr(id_priv));
2774 req.qp_num = id_priv->qp_num; 2775 req.qp_num = id_priv->qp_num;
2775 req.qp_type = id_priv->id.qp_type; 2776 req.qp_type = id_priv->id.qp_type;
2776 req.starting_psn = id_priv->seq_num; 2777 req.starting_psn = id_priv->seq_num;