From patchwork Thu Apr 1 17:08:41 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hefty, Sean" X-Patchwork-Id: 90187 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o31H8iDR030454 for ; Thu, 1 Apr 2010 17:08:50 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757600Ab0DARIs (ORCPT ); Thu, 1 Apr 2010 13:08:48 -0400 Received: from mga11.intel.com ([192.55.52.93]:44648 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757545Ab0DARIr (ORCPT ); Thu, 1 Apr 2010 13:08:47 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 01 Apr 2010 10:08:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.51,349,1267430400"; d="scan'208";a="785809546" Received: from unknown (HELO msheftyMOBL2) ([10.254.108.159]) by fmsmga001.fm.intel.com with ESMTP; 01 Apr 2010 10:08:45 -0700 From: "Sean Hefty" To: "Hefty, Sean" , References: Subject: [PATCH 21/26] rdma/cm: export cma_get_service_id Date: Thu, 1 Apr 2010 10:08:41 -0700 Message-ID: <05948EACA7394A2CB88F924F73C7E4E2@amr.corp.intel.com> MIME-Version: 1.0 X-Mailer: Microsoft Office Outlook 11 Thread-Index: AcrRtMZV7yVukZHyQqa3gseqBpR7/wABgq7g In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 01 Apr 2010 17:08:51 +0000 (UTC) diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index 8e22119..e0bdb80 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c @@ -1255,13 +1255,14 @@ out: return ret; } -static __be64 cma_get_service_id(enum rdma_port_space ps, struct sockaddr *addr) +__be64 rdma_get_service_id(struct rdma_cm_id *id, struct sockaddr *addr) { if (addr->sa_family == AF_IB) return ((struct sockaddr_ib *) addr)->sib_sid; - return cpu_to_be64(((u64)ps << 16) + be16_to_cpu(cma_port(addr))); + return cpu_to_be64(((u64)id->ps << 16) + be16_to_cpu(cma_port(addr))); } +EXPORT_SYMBOL(rdma_get_service_id); static void cma_set_compare_data(enum rdma_port_space ps, struct sockaddr *addr, struct ib_cm_compare_data *compare) @@ -1477,7 +1478,7 @@ static int cma_ib_listen(struct rdma_id_private *id_priv) return PTR_ERR(id_priv->cm_id.ib); addr = (struct sockaddr *) &id_priv->id.route.addr.src_addr; - svc_id = cma_get_service_id(id_priv->id.ps, addr); + svc_id = rdma_get_service_id(&id_priv->id, addr); if (cma_any_addr(addr)) ret = ib_cm_listen(id_priv->cm_id.ib, svc_id, 0, NULL); else { @@ -1659,8 +1660,8 @@ static int cma_query_ib_route(struct rdma_id_private *id_priv, int timeout_ms, path_rec.pkey = cpu_to_be16(ib_addr_get_pkey(&addr->dev_addr)); path_rec.numb_path = 1; path_rec.reversible = 1; - path_rec.service_id = cma_get_service_id(id_priv->id.ps, - (struct sockaddr *) &addr->dst_addr); + path_rec.service_id = rdma_get_service_id(&id_priv->id, + (struct sockaddr *) &addr->dst_addr); comp_mask = IB_SA_PATH_REC_DGID | IB_SA_PATH_REC_SGID | IB_SA_PATH_REC_PKEY | IB_SA_PATH_REC_NUMB_PATH | @@ -2509,8 +2510,8 @@ static int cma_resolve_ib_udp(struct rdma_id_private *id_priv, } req.path = route->path_rec; - req.service_id = cma_get_service_id(id_priv->id.ps, - (struct sockaddr *) &route->addr.dst_addr); + req.service_id = rdma_get_service_id(&id_priv->id, + (struct sockaddr *) &route->addr.dst_addr); req.timeout_ms = 1 << (CMA_CM_RESPONSE_TIMEOUT - 8); req.max_cm_retries = CMA_MAX_CM_RETRIES; @@ -2560,8 +2561,8 @@ static int cma_connect_ib(struct rdma_id_private *id_priv, if (route->num_paths == 2) req.alternate_path = &route->path_rec[1]; - req.service_id = cma_get_service_id(id_priv->id.ps, - (struct sockaddr *) &route->addr.dst_addr); + req.service_id = rdma_get_service_id(&id_priv->id, + (struct sockaddr *) &route->addr.dst_addr); req.qp_num = id_priv->qp_num; req.qp_type = IB_QPT_RC; req.starting_psn = id_priv->seq_num; diff --git a/include/rdma/rdma_cm.h b/include/rdma/rdma_cm.h index 68e73d1..e74de96 100644 --- a/include/rdma/rdma_cm.h +++ b/include/rdma/rdma_cm.h @@ -339,4 +339,11 @@ void rdma_leave_multicast(struct rdma_cm_id *id, struct sockaddr *addr); */ void rdma_set_service_type(struct rdma_cm_id *id, int tos); +/** + * rdma_get_service_id - Return the IB service ID for a specified address. + * @id: Communication identifier associated with the address. + * @addr: Address for the service ID. + */ +__be64 rdma_get_service_id(struct rdma_cm_id *id, struct sockaddr *addr); + #endif /* RDMA_CM_H */