From patchwork Wed Jun 15 17:35:22 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hefty, Sean" X-Patchwork-Id: 882972 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p5FHZPou029777 for ; Wed, 15 Jun 2011 17:35:25 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752416Ab1FORfY (ORCPT ); Wed, 15 Jun 2011 13:35:24 -0400 Received: from mga01.intel.com ([192.55.52.88]:26204 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752363Ab1FORfY convert rfc822-to-8bit (ORCPT ); Wed, 15 Jun 2011 13:35:24 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 15 Jun 2011 10:35:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.65,370,1304319600"; d="scan'208";a="18585520" Received: from orsmsx602.amr.corp.intel.com ([10.22.226.211]) by fmsmga001.fm.intel.com with ESMTP; 15 Jun 2011 10:35:23 -0700 Received: from orsmsx104.amr.corp.intel.com (10.22.225.131) by orsmsx602.amr.corp.intel.com (10.22.226.211) with Microsoft SMTP Server (TLS) id 8.2.255.0; Wed, 15 Jun 2011 10:35:23 -0700 Received: from orsmsx101.amr.corp.intel.com ([169.254.8.26]) by ORSMSX104.amr.corp.intel.com ([169.254.3.236]) with mapi id 14.01.0289.001; Wed, 15 Jun 2011 10:35:23 -0700 From: "Hefty, Sean" To: "linux-rdma (linux-rdma@vger.kernel.org)" Subject: [PATCH 1/8] librdmacm: Renumber RDMA_PS_IB to match kernel patch Thread-Topic: [PATCH 1/8] librdmacm: Renumber RDMA_PS_IB to match kernel patch Thread-Index: Acwrgpi3/7BCa9rdSKiNniJdKkqXlQ== Date: Wed, 15 Jun 2011 17:35:22 +0000 Message-ID: <1828884A29C6694DAF28B7E6B8A823730212B3@ORSMSX101.amr.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.9.131.214] MIME-Version: 1.0 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.6 (demeter2.kernel.org [140.211.167.43]); Wed, 15 Jun 2011 17:35:25 +0000 (UTC) RDMA_PS_IB is only a placeholder and not usable yet. Update the assigned value to match that specified for the kernel. Update rdma_getaddrinfo to use port space hints when formatting responses. Signed-off-by: Sean Hefty --- include/rdma/rdma_cma.h | 2 +- src/addrinfo.c | 29 ++++++++++++++++++++--------- 2 files changed, 21 insertions(+), 10 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/include/rdma/rdma_cma.h b/include/rdma/rdma_cma.h index 3648c97..ab6016e 100755 --- a/include/rdma/rdma_cma.h +++ b/include/rdma/rdma_cma.h @@ -68,9 +68,9 @@ enum rdma_cm_event_type { enum rdma_port_space { RDMA_PS_IPOIB = 0x0002, - RDMA_PS_IB = 0x0003, RDMA_PS_TCP = 0x0106, RDMA_PS_UDP = 0x0111, + RDMA_PS_IB = 0x013F, }; #define RDMA_IB_IP_PS_MASK 0xFFFFFFFFFFFF0000ULL diff --git a/src/addrinfo.c b/src/addrinfo.c index 021f7c4..428baf6 100755 --- a/src/addrinfo.c +++ b/src/addrinfo.c @@ -69,6 +69,12 @@ static void ucma_convert_to_ai(struct addrinfo *ai, struct rdma_addrinfo *rai) case RDMA_PS_UDP: ai->ai_protocol = IPPROTO_UDP; break; + case RDMA_PS_IB: + if (ai->ai_socktype == SOCK_STREAM) + ai->ai_protocol = IPPROTO_TCP; + else if (ai->ai_socktype == SOCK_DGRAM) + ai->ai_protocol = IPPROTO_UDP; + break; } if (rai->ai_flags & RAI_PASSIVE) { @@ -82,7 +88,8 @@ static void ucma_convert_to_ai(struct addrinfo *ai, struct rdma_addrinfo *rai) ai->ai_next = NULL; } -static int ucma_convert_to_rai(struct rdma_addrinfo *rai, struct addrinfo *ai) +static int ucma_convert_to_rai(struct rdma_addrinfo *rai, + struct rdma_addrinfo *hints, struct addrinfo *ai) { struct sockaddr *addr; char *canonname; @@ -98,13 +105,17 @@ static int ucma_convert_to_rai(struct rdma_addrinfo *rai, struct addrinfo *ai) break; } - switch (ai->ai_protocol) { - case IPPROTO_TCP: - rai->ai_port_space = RDMA_PS_TCP; - break; - case IPPROTO_UDP: - rai->ai_port_space = RDMA_PS_UDP; - break; + if (hints && hints->ai_port_space) { + rai->ai_port_space = hints->ai_port_space; + } else { + switch (ai->ai_protocol) { + case IPPROTO_TCP: + rai->ai_port_space = RDMA_PS_TCP; + break; + case IPPROTO_UDP: + rai->ai_port_space = RDMA_PS_UDP; + break; + } } addr = malloc(ai->ai_addrlen); @@ -149,7 +160,7 @@ static int ucma_convert_gai(char *node, char *service, if (ret) return ret; - ret = ucma_convert_to_rai(rai, ai); + ret = ucma_convert_to_rai(rai, hints, ai); freeaddrinfo(ai); return ret; }