From: Sean Hefty Date: Fri, 24 Aug 2012 23:27:49 +0000 (-0700) Subject: refresh X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=4d3a0ba02c853dde81149a140f57c0311c12e156;p=~shefty%2Flibrdmacm.git refresh --- diff --git a/meta b/meta index 66497484..63301543 100644 --- a/meta +++ b/meta @@ -1,10 +1,9 @@ Version: 1 -Previous: 6a85d1486b0043167e7d28d24489135903f77a19 -Head: 176450cd5ae69e86c1e896fd0395ae94b890d1ce +Previous: fe4da85f6b4e1304e30f7ce88447182a7728e39e +Head: bc29fc638eb134253a21057788b819de48a085bf Applied: sa_family: 85be179d2f63865dbf1f5adc1dc76c093c6b811e - af_ib: b82d9accb321bd3aa85f65674c99a912231dbc45 - refresh-temp: 176450cd5ae69e86c1e896fd0395ae94b890d1ce + af_ib: bc29fc638eb134253a21057788b819de48a085bf Unapplied: dbg-fork: 5679a32af8305db3c0406f9abb961259304a384a dbg-out: 4b4c0572eab77856d8fbb919b1feb8f3502a101a diff --git a/patches/af_ib b/patches/af_ib index 08f22668..ccbec4f7 100644 --- a/patches/af_ib +++ b/patches/af_ib @@ -1,5 +1,5 @@ Bottom: a714bc4ff96a4b6832ac8f7cb9d7f0d37f8320e7 -Top: b818a49f265b98fc20de6ebcd8b46a3d2e72a1d8 +Top: 162a1f68ee732043b0c08739b5bab499d00d568d Author: Sean Hefty Date: 2012-08-17 14:02:45 -0700 @@ -10,10 +10,126 @@ Signed-off-by: Sean Hefty --- +diff --git a/include/rdma/rdma_cma.h b/include/rdma/rdma_cma.h +index 1487f8f..f3c8921 100755 +--- a/include/rdma/rdma_cma.h ++++ b/include/rdma/rdma_cma.h +@@ -1,6 +1,6 @@ + /* + * Copyright (c) 2005 Voltaire Inc. All rights reserved. +- * Copyright (c) 2005-2010 Intel Corporation. All rights reserved. ++ * Copyright (c) 2005-2012 Intel Corporation. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU +@@ -581,19 +581,8 @@ int rdma_get_cm_event(struct rdma_event_channel *channel, + */ + int rdma_ack_cm_event(struct rdma_cm_event *event); + +-static inline uint16_t rdma_get_src_port(struct rdma_cm_id *id) +-{ +- return id->route.addr.src_addr.sa_family == PF_INET6 ? +- id->route.addr.src_sin6.sin6_port : +- id->route.addr.src_sin.sin_port; +-} +- +-static inline uint16_t rdma_get_dst_port(struct rdma_cm_id *id) +-{ +- return id->route.addr.dst_addr.sa_family == PF_INET6 ? +- id->route.addr.dst_sin6.sin6_port : +- id->route.addr.dst_sin.sin_port; +-} ++uint16_t rdma_get_src_port(struct rdma_cm_id *id); ++uint16_t rdma_get_dst_port(struct rdma_cm_id *id); + + static inline struct sockaddr *rdma_get_local_addr(struct rdma_cm_id *id) + { +diff --git a/src/acm.c b/src/acm.c +index d96dbcd..d538d92 100755 +--- a/src/acm.c ++++ b/src/acm.c +@@ -324,6 +324,17 @@ static void ucma_copy_rai_addr(struct acm_ep_addr_data *data, struct sockaddr *a + } + } + ++static int ucma_inet_addr(struct sockaddr *addr, socklen_t len) ++{ ++ return len && addr && (addr->sa_family == AF_INET || ++ addr->sa_family == AF_INET6); ++} ++ ++static int ucma_ib_addr(struct sockaddr *addr, socklen_t len) ++{ ++ return len && addr && (addr->sa_family == AF_IB); ++} ++ + void ucma_ib_resolve(struct rdma_addrinfo **rai, struct rdma_addrinfo *hints) + { + cma_acm_msg_t msg; +@@ -340,14 +351,14 @@ void ucma_ib_resolve(struct rdma_addrinfo **rai, struct rdma_addrinfo *hints) + msg.hdr.length = ACM_MSG_HDR_LENGTH; + + data = &msg.resolve_data[0]; +- if ((*rai)->ai_src_len) { ++ if (ucma_inet_addr((*rai)->ai_src_addr, (*rai)->ai_src_len)) { + data->flags = ACM_EP_FLAG_SOURCE; + ucma_copy_rai_addr(data, (*rai)->ai_src_addr); + data++; + msg.hdr.length += ACM_MSG_EP_LENGTH; + } + +- if ((*rai)->ai_dst_len) { ++ if (ucma_inet_addr((*rai)->ai_dst_addr, (*rai)->ai_dst_len)) { + data->flags = ACM_EP_FLAG_DEST; + if ((*rai)->ai_flags & (RAI_NUMERICHOST | RAI_NOROUTE)) + data->flags |= ACM_FLAGS_NODELAY; +@@ -356,7 +367,9 @@ void ucma_ib_resolve(struct rdma_addrinfo **rai, struct rdma_addrinfo *hints) + msg.hdr.length += ACM_MSG_EP_LENGTH; + } + +- if (hints && hints->ai_route_len) { ++ if (hints && (hints->ai_route_len || ++ ucma_ib_addr((*rai)->ai_src_addr, (*rai)->ai_src_len) || ++ ucma_ib_addr((*rai)->ai_dst_addr, (*rai)->ai_dst_len))) { + struct ibv_path_record *path; + + if (hints->ai_route_len == sizeof(struct ibv_path_record)) +@@ -366,12 +379,20 @@ void ucma_ib_resolve(struct rdma_addrinfo **rai, struct rdma_addrinfo *hints) + else + path = NULL; + +- if (path) { +- data->type = ACM_EP_INFO_PATH; ++ if (path) + memcpy(&data->info.path, path, sizeof(*path)); +- data++; +- msg.hdr.length += ACM_MSG_EP_LENGTH; ++ ++ if (ucma_ib_addr((*rai)->ai_src_addr, (*rai)->ai_src_len)) { ++ memcpy(&data->info.path.sgid, ++ ((struct sockaddr_ib *) (*rai)->ai_src_addr)->sib_addr, 16); ++ } ++ if (ucma_ib_addr((*rai)->ai_dst_addr, (*rai)->ai_dst_len)) { ++ memcpy(&data->info.path.dgid, ++ ((struct sockaddr_ib *) (*rai)->ai_dst_addr)->sib_addr, 16); + } ++ data->type = ACM_EP_INFO_PATH; ++ data++; ++ msg.hdr.length += ACM_MSG_EP_LENGTH; + } + + pthread_mutex_lock(&acm_lock); diff --git a/src/cma.c b/src/cma.c -index 5280620..9286e81 100755 +index 5280620..2994655 100755 --- a/src/cma.c +++ b/src/cma.c +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2005-2011 Intel Corporation. All rights reserved. ++ * Copyright (c) 2005-2012 Intel Corporation. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU @@ -185,9 +185,6 @@ static void ucma_set_af_ib_support(void) struct sockaddr_ib sib; int ret; @@ -24,3 +140,44 @@ index 5280620..9286e81 100755 ret = rdma_create_id(NULL, &id, NULL, RDMA_PS_IB); if (ret) return; +@@ -2242,3 +2239,28 @@ int ucma_max_qpsize(struct rdma_cm_id *id) + id_priv = container_of(id, struct cma_id_private, id); + return id_priv->cma_dev->max_qpsize; + } ++ ++static uint16_t ucma_get_port(struct sockaddr *addr) ++{ ++ switch (addr->sa_family) { ++ case AF_INET: ++ return ((struct sockaddr_in *) addr)->sin_port; ++ case AF_INET6: ++ return ((struct sockaddr_in6 *) addr)->sin6_port; ++ case AF_IB: ++ return htons((uint16_t) ntohll(((struct sockaddr_ib *) addr)->sib_sid)); ++ default: ++ return 0; ++ } ++} ++ ++uint16_t rdma_get_src_port(struct rdma_cm_id *id) ++{ ++ return ucma_get_port(&id->route.addr.src_addr); ++} ++ ++uint16_t rdma_get_dst_port(struct rdma_cm_id *id) ++{ ++ return ucma_get_port(&id->route.addr.dst_addr); ++} ++ +diff --git a/src/librdmacm.map b/src/librdmacm.map +index d994de4..5c317a3 100644 +--- a/src/librdmacm.map ++++ b/src/librdmacm.map +@@ -61,5 +61,7 @@ RDMACM_1.0 { + rfcntl; + rpoll; + rselect; ++ rdma_get_src_port; ++ rdma_get_dst_port; + local: *; + }; diff --git a/patches/refresh-temp b/patches/refresh-temp deleted file mode 100644 index 2b1176a0..00000000 --- a/patches/refresh-temp +++ /dev/null @@ -1,170 +0,0 @@ -Bottom: b818a49f265b98fc20de6ebcd8b46a3d2e72a1d8 -Top: 162a1f68ee732043b0c08739b5bab499d00d568d -Author: Sean Hefty -Date: 2012-08-24 16:27:49 -0700 - -Refresh of af_ib - ---- - -diff --git a/include/rdma/rdma_cma.h b/include/rdma/rdma_cma.h -index 1487f8f..f3c8921 100755 ---- a/include/rdma/rdma_cma.h -+++ b/include/rdma/rdma_cma.h -@@ -1,6 +1,6 @@ - /* - * Copyright (c) 2005 Voltaire Inc. All rights reserved. -- * Copyright (c) 2005-2010 Intel Corporation. All rights reserved. -+ * Copyright (c) 2005-2012 Intel Corporation. All rights reserved. - * - * This software is available to you under a choice of one of two - * licenses. You may choose to be licensed under the terms of the GNU -@@ -581,19 +581,8 @@ int rdma_get_cm_event(struct rdma_event_channel *channel, - */ - int rdma_ack_cm_event(struct rdma_cm_event *event); - --static inline uint16_t rdma_get_src_port(struct rdma_cm_id *id) --{ -- return id->route.addr.src_addr.sa_family == PF_INET6 ? -- id->route.addr.src_sin6.sin6_port : -- id->route.addr.src_sin.sin_port; --} -- --static inline uint16_t rdma_get_dst_port(struct rdma_cm_id *id) --{ -- return id->route.addr.dst_addr.sa_family == PF_INET6 ? -- id->route.addr.dst_sin6.sin6_port : -- id->route.addr.dst_sin.sin_port; --} -+uint16_t rdma_get_src_port(struct rdma_cm_id *id); -+uint16_t rdma_get_dst_port(struct rdma_cm_id *id); - - static inline struct sockaddr *rdma_get_local_addr(struct rdma_cm_id *id) - { -diff --git a/src/acm.c b/src/acm.c -index d96dbcd..d538d92 100755 ---- a/src/acm.c -+++ b/src/acm.c -@@ -324,6 +324,17 @@ static void ucma_copy_rai_addr(struct acm_ep_addr_data *data, struct sockaddr *a - } - } - -+static int ucma_inet_addr(struct sockaddr *addr, socklen_t len) -+{ -+ return len && addr && (addr->sa_family == AF_INET || -+ addr->sa_family == AF_INET6); -+} -+ -+static int ucma_ib_addr(struct sockaddr *addr, socklen_t len) -+{ -+ return len && addr && (addr->sa_family == AF_IB); -+} -+ - void ucma_ib_resolve(struct rdma_addrinfo **rai, struct rdma_addrinfo *hints) - { - cma_acm_msg_t msg; -@@ -340,14 +351,14 @@ void ucma_ib_resolve(struct rdma_addrinfo **rai, struct rdma_addrinfo *hints) - msg.hdr.length = ACM_MSG_HDR_LENGTH; - - data = &msg.resolve_data[0]; -- if ((*rai)->ai_src_len) { -+ if (ucma_inet_addr((*rai)->ai_src_addr, (*rai)->ai_src_len)) { - data->flags = ACM_EP_FLAG_SOURCE; - ucma_copy_rai_addr(data, (*rai)->ai_src_addr); - data++; - msg.hdr.length += ACM_MSG_EP_LENGTH; - } - -- if ((*rai)->ai_dst_len) { -+ if (ucma_inet_addr((*rai)->ai_dst_addr, (*rai)->ai_dst_len)) { - data->flags = ACM_EP_FLAG_DEST; - if ((*rai)->ai_flags & (RAI_NUMERICHOST | RAI_NOROUTE)) - data->flags |= ACM_FLAGS_NODELAY; -@@ -356,7 +367,9 @@ void ucma_ib_resolve(struct rdma_addrinfo **rai, struct rdma_addrinfo *hints) - msg.hdr.length += ACM_MSG_EP_LENGTH; - } - -- if (hints && hints->ai_route_len) { -+ if (hints && (hints->ai_route_len || -+ ucma_ib_addr((*rai)->ai_src_addr, (*rai)->ai_src_len) || -+ ucma_ib_addr((*rai)->ai_dst_addr, (*rai)->ai_dst_len))) { - struct ibv_path_record *path; - - if (hints->ai_route_len == sizeof(struct ibv_path_record)) -@@ -366,12 +379,20 @@ void ucma_ib_resolve(struct rdma_addrinfo **rai, struct rdma_addrinfo *hints) - else - path = NULL; - -- if (path) { -- data->type = ACM_EP_INFO_PATH; -+ if (path) - memcpy(&data->info.path, path, sizeof(*path)); -- data++; -- msg.hdr.length += ACM_MSG_EP_LENGTH; -+ -+ if (ucma_ib_addr((*rai)->ai_src_addr, (*rai)->ai_src_len)) { -+ memcpy(&data->info.path.sgid, -+ ((struct sockaddr_ib *) (*rai)->ai_src_addr)->sib_addr, 16); -+ } -+ if (ucma_ib_addr((*rai)->ai_dst_addr, (*rai)->ai_dst_len)) { -+ memcpy(&data->info.path.dgid, -+ ((struct sockaddr_ib *) (*rai)->ai_dst_addr)->sib_addr, 16); - } -+ data->type = ACM_EP_INFO_PATH; -+ data++; -+ msg.hdr.length += ACM_MSG_EP_LENGTH; - } - - pthread_mutex_lock(&acm_lock); -diff --git a/src/cma.c b/src/cma.c -index 9286e81..2994655 100755 ---- a/src/cma.c -+++ b/src/cma.c -@@ -1,5 +1,5 @@ - /* -- * Copyright (c) 2005-2011 Intel Corporation. All rights reserved. -+ * Copyright (c) 2005-2012 Intel Corporation. All rights reserved. - * - * This software is available to you under a choice of one of two - * licenses. You may choose to be licensed under the terms of the GNU -@@ -2239,3 +2239,28 @@ int ucma_max_qpsize(struct rdma_cm_id *id) - id_priv = container_of(id, struct cma_id_private, id); - return id_priv->cma_dev->max_qpsize; - } -+ -+static uint16_t ucma_get_port(struct sockaddr *addr) -+{ -+ switch (addr->sa_family) { -+ case AF_INET: -+ return ((struct sockaddr_in *) addr)->sin_port; -+ case AF_INET6: -+ return ((struct sockaddr_in6 *) addr)->sin6_port; -+ case AF_IB: -+ return htons((uint16_t) ntohll(((struct sockaddr_ib *) addr)->sib_sid)); -+ default: -+ return 0; -+ } -+} -+ -+uint16_t rdma_get_src_port(struct rdma_cm_id *id) -+{ -+ return ucma_get_port(&id->route.addr.src_addr); -+} -+ -+uint16_t rdma_get_dst_port(struct rdma_cm_id *id) -+{ -+ return ucma_get_port(&id->route.addr.dst_addr); -+} -+ -diff --git a/src/librdmacm.map b/src/librdmacm.map -index d994de4..5c317a3 100644 ---- a/src/librdmacm.map -+++ b/src/librdmacm.map -@@ -61,5 +61,7 @@ RDMACM_1.0 { - rfcntl; - rpoll; - rselect; -+ rdma_get_src_port; -+ rdma_get_dst_port; - local: *; - };