From: Sean Hefty Date: Mon, 6 Jun 2011 23:24:32 +0000 (-0700) Subject: librdmacm: Renumber RDMA_PS_IB to match kernel patch X-Git-Tag: v1.0.15~8 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=26e115ea0f82ef9bdc3fa80eb9eb91933a789c12;p=~shefty%2Flibrdmacm.git librdmacm: Renumber RDMA_PS_IB to match kernel patch 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 the port space when formatting responses. Signed-off-by: Sean Hefty --- diff --git a/include/rdma/rdma_cma.h b/include/rdma/rdma_cma.h index b9fd308c..fa4d1894 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 021f7c4e..428baf6a 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; }