From dbcf4595ee8beffa3e28a65fe3af477d1cbbbd6d Mon Sep 17 00:00:00 2001 From: Sean Hefty Date: Thu, 20 Sep 2012 15:03:51 -0700 Subject: [PATCH] commit --- meta | 8 +- patches/addrinfo-af-ib | 416 ----------------------------------------- patches/af_ib | 192 ------------------- patches/dup2 | 37 ---- patches/ren-copy-rai | 45 ----- patches/rs-docs | 166 ---------------- patches/sa_family | 66 ------- 7 files changed, 1 insertion(+), 929 deletions(-) delete mode 100644 patches/addrinfo-af-ib delete mode 100644 patches/af_ib delete mode 100644 patches/dup2 delete mode 100644 patches/ren-copy-rai delete mode 100644 patches/rs-docs delete mode 100644 patches/sa_family diff --git a/meta b/meta index b5eaacd1..124f16ab 100644 --- a/meta +++ b/meta @@ -1,13 +1,7 @@ Version: 1 -Previous: 3799c079a44adcf5f499e03573c67e5b63bfbc01 +Previous: e1562eef4caf978025a926ad37a26b523e2bab48 Head: e9feafcb10b48b7917ed34d7dd8a5a95269938a0 Applied: - sa_family: 79ecff9afd483c22821eca679e7ed668035ab4c1 - af_ib: ed14c624d882d21df3e2d0c022cffab0b7f664b9 - ren-copy-rai: a7ae817991416863772d28d97839ee8daeefb07e - dup2: 3524c878f537ef2c57f973fad54b1204c299026d - addrinfo-af-ib: 7ada839ae4e288fadf40ffa49b6b6fb0e1a6bf78 - rs-docs: e9feafcb10b48b7917ed34d7dd8a5a95269938a0 Unapplied: addrtype: 066c2615bf5399848088a9771093a76c5e205bf1 dbg-fork: 5679a32af8305db3c0406f9abb961259304a384a diff --git a/patches/addrinfo-af-ib b/patches/addrinfo-af-ib deleted file mode 100644 index 7534f762..00000000 --- a/patches/addrinfo-af-ib +++ /dev/null @@ -1,416 +0,0 @@ -Bottom: 79d073d6c2d4883bac75c2245a0da053def1f1d6 -Top: aff44b871980ab9e18c7d2c9b90bc34b060bb30d -Author: Sean Hefty -Date: 2012-08-28 12:33:04 -0700 - -librdmacm: Support using GIDs with rdma_getaddrinfo - -Allow the user to specify a GID as the node parameter into -rdma_getaddrinfo. - -To distinguish between the node being an IPv6 address or a GID, -we add a new flag, RAI_FAMILY, which can be set as part of the -hints to rdma_getaddrinfo. When set, this flag indicates that the -value of ai_family in the hints should be used when interpretting -the node parameter. - -Signed-off-by: Sean Hefty - - ---- - -diff --git a/include/rdma/rdma_cma.h b/include/rdma/rdma_cma.h -index f3c8921..4c4a057 100755 ---- a/include/rdma/rdma_cma.h -+++ b/include/rdma/rdma_cma.h -@@ -77,6 +77,7 @@ enum rdma_port_space { - #define RDMA_IB_IP_PORT_MASK 0x000000000000FFFFULL - #define RDMA_IB_IP_PS_TCP 0x0000000001060000ULL - #define RDMA_IB_IP_PS_UDP 0x0000000001110000ULL -+#define RDMA_IB_PS_IB 0x00000000013F0000ULL - - /* - * Global qkey value for UDP QPs and multicast groups created via the -@@ -176,6 +177,7 @@ struct rdma_cm_event { - #define RAI_PASSIVE 0x00000001 - #define RAI_NUMERICHOST 0x00000002 - #define RAI_NOROUTE 0x00000004 -+#define RAI_FAMILY 0x00000008 - - struct rdma_addrinfo { - int ai_flags; -diff --git a/man/rdma_getaddrinfo.3 b/man/rdma_getaddrinfo.3 -index 86e00ca..cd819c6 100755 ---- a/man/rdma_getaddrinfo.3 -+++ b/man/rdma_getaddrinfo.3 -@@ -48,6 +48,9 @@ If specified, then the node parameter, if provided, must be a numerical - network address. This flag suppresses any lengthy address resolution. - .IP "RAI_NOROUTE" 12 - If set, this flag suppresses any lengthy route resolution. -+.IP "RAI_FAMILY" 12 -+If set, the ai_family setting should be used as an input hint for interpretting -+the node parameter. - .IP "ai_family" 12 - Address family for the source and destination address. Supported families - are: AF_INET, AF_INET6, and AF_IB. -diff --git a/src/acm.c b/src/acm.c -index 95eee73..3d8c912 100755 ---- a/src/acm.c -+++ b/src/acm.c -@@ -1,5 +1,5 @@ - /* -- * Copyright (c) 2010 Intel Corporation. All rights reserved. -+ * Copyright (c) 2010-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 -@@ -123,23 +123,6 @@ void ucma_ib_cleanup(void) - } - } - --static void ucma_set_sid(enum rdma_port_space ps, struct sockaddr *addr, -- struct sockaddr_ib *sib) --{ -- uint16_t port; -- -- if (addr->sa_family == AF_INET) -- port = ((struct sockaddr_in *) addr)->sin_port; -- else -- port = ((struct sockaddr_in6 *) addr)->sin6_port; -- -- sib->sib_sid = htonll(((uint64_t) ps << 16) + ntohs(port)); -- if (port) -- sib->sib_sid_mask = ~0ULL; -- else -- sib->sib_sid_mask = htonll(RDMA_IB_IP_PS_MASK); --} -- - static int ucma_ib_set_addr(struct rdma_addrinfo *ib_rai, - struct rdma_addrinfo *rai) - { -@@ -184,6 +167,9 @@ static int ucma_ib_set_connect(struct rdma_addrinfo *ib_rai, - { - struct ib_connect_hdr *hdr; - -+ if (rai->ai_family == AF_IB) -+ return 0; -+ - hdr = calloc(1, sizeof *hdr); - if (!hdr) - return ERR(ENOMEM); -@@ -360,16 +346,16 @@ void ucma_ib_resolve(struct rdma_addrinfo **rai, struct rdma_addrinfo *hints) - - 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)) -+ if (hints->ai_flags & (RAI_NUMERICHOST | RAI_NOROUTE)) - data->flags |= ACM_FLAGS_NODELAY; - ucma_set_ep_addr(data, (*rai)->ai_dst_addr); - data++; - msg.hdr.length += ACM_MSG_EP_LENGTH; - } - -- if (hints && (hints->ai_route_len || -+ if (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))) { -+ 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)) -@@ -409,8 +395,7 @@ void ucma_ib_resolve(struct rdma_addrinfo **rai, struct rdma_addrinfo *hints) - - ucma_ib_save_resp(*rai, &msg); - -- if (af_ib_support && !((*rai)->ai_flags & RAI_ROUTEONLY) && -- (*rai)->ai_route_len && ((*rai)->ai_family != AF_IB)) -+ if (af_ib_support && !(hints->ai_flags & RAI_ROUTEONLY) && (*rai)->ai_route_len) - ucma_resolve_af_ib(rai); - } - -diff --git a/src/addrinfo.c b/src/addrinfo.c -index 2da35f0..e7643f7 100755 ---- a/src/addrinfo.c -+++ b/src/addrinfo.c -@@ -53,12 +53,17 @@ - #define RDMA_QPT_XRC_RECV 10 - #endif - -+struct rdma_addrinfo nohints; -+ - static void ucma_convert_to_ai(struct addrinfo *ai, struct rdma_addrinfo *rai) - { - memset(ai, 0, sizeof *ai); -- ai->ai_flags = (rai->ai_flags & RAI_PASSIVE) ? AI_PASSIVE : 0; -- ai->ai_flags |= (rai->ai_flags & RAI_NUMERICHOST) ? AI_NUMERICHOST : 0; -- ai->ai_family = rai->ai_family; -+ if (rai->ai_flags & RAI_PASSIVE) -+ ai->ai_flags = AI_PASSIVE; -+ if (rai->ai_flags & RAI_NUMERICHOST) -+ ai->ai_flags |= AI_NUMERICHOST; -+ if (rai->ai_family != AF_IB) -+ ai->ai_family = rai->ai_family; - - switch (rai->ai_qp_type) { - case IBV_QPT_RC: -@@ -99,15 +104,60 @@ static void ucma_convert_to_ai(struct addrinfo *ai, struct rdma_addrinfo *rai) - ai->ai_next = NULL; - } - -+static int ucma_copy_addr(struct sockaddr **dst, socklen_t *dst_len, -+ struct sockaddr *src, socklen_t src_len) -+{ -+ *dst = malloc(src_len); -+ if (!(*dst)) -+ return ERR(ENOMEM); -+ -+ memcpy(*dst, src, src_len); -+ *dst_len = src_len; -+ return 0; -+} -+ -+void ucma_set_sid(enum rdma_port_space ps, struct sockaddr *addr, -+ struct sockaddr_ib *sib) -+{ -+ uint16_t port; -+ -+ port = addr ? ucma_get_port(addr) : 0; -+ sib->sib_sid = htonll(((uint64_t) ps << 16) + ntohs(port)); -+ -+ if (ps) -+ sib->sib_sid_mask = htonll(RDMA_IB_IP_PS_MASK); -+ if (port) -+ sib->sib_sid_mask |= htonll(RDMA_IB_IP_PORT_MASK); -+} -+ -+static int ucma_convert_in6(int ps, struct sockaddr_ib **dst, socklen_t *dst_len, -+ struct sockaddr_in6 *src, socklen_t src_len) -+{ -+ *dst = calloc(1, sizeof(struct sockaddr_ib)); -+ if (!(*dst)) -+ return ERR(ENOMEM); -+printf("converting ipv6 to ib\n"); -+ -+ (*dst)->sib_family = AF_IB; -+ (*dst)->sib_pkey = 0xFFFF; -+ (*dst)->sib_flowinfo = src->sin6_flowinfo; -+ ib_addr_set(&(*dst)->sib_addr, src->sin6_addr.s6_addr32[0], -+ src->sin6_addr.s6_addr32[1], src->sin6_addr.s6_addr32[2], -+ src->sin6_addr.s6_addr32[3]); -+ ucma_set_sid(ps, (struct sockaddr *) src, *dst); -+printf("sid %llx %llx\n", (*dst)->sib_sid, (*dst)->sib_sid_mask); -+ (*dst)->sib_scope_id = src->sin6_scope_id; -+ -+ *dst_len = sizeof(struct sockaddr_ib); -+ return 0; -+} -+ - static int ucma_convert_to_rai(struct rdma_addrinfo *rai, - struct rdma_addrinfo *hints, struct addrinfo *ai) - { -- struct sockaddr *addr; -- char *canonname; -- -- rai->ai_family = ai->ai_family; -+ int ret; - -- if (hints && hints->ai_qp_type) { -+ if (hints->ai_qp_type) { - rai->ai_qp_type = hints->ai_qp_type; - } else { - switch (ai->ai_socktype) { -@@ -119,8 +169,9 @@ static int ucma_convert_to_rai(struct rdma_addrinfo *rai, - break; - } - } -+printf("qp type %d\n", rai->ai_qp_type); - -- if (hints && hints->ai_port_space) { -+ if (hints->ai_port_space) { - rai->ai_port_space = hints->ai_port_space; - } else { - switch (ai->ai_protocol) { -@@ -132,44 +183,63 @@ static int ucma_convert_to_rai(struct rdma_addrinfo *rai, - break; - } - } -- -- addr = malloc(ai->ai_addrlen); -- if (!addr) -- return ERR(ENOMEM); -- -- canonname = ai->ai_canonname ? strdup(ai->ai_canonname) : NULL; -- -- memcpy(addr, ai->ai_addr, ai->ai_addrlen); -- if (ai->ai_flags & RAI_PASSIVE) { -- rai->ai_src_addr = addr; -- rai->ai_src_len = ai->ai_addrlen; -- rai->ai_src_canonname = canonname; -+printf("port space %d\n", rai->ai_port_space); -+ -+ if (ai->ai_flags & AI_PASSIVE) { -+ rai->ai_flags = RAI_PASSIVE; -+ if (ai->ai_canonname) -+ rai->ai_src_canonname = strdup(ai->ai_canonname); -+ -+ if ((hints->ai_flags & RAI_FAMILY) && (hints->ai_family == AF_IB) && -+ (hints->ai_flags & RAI_NUMERICHOST)) { -+ rai->ai_family = AF_IB; -+ ret = ucma_convert_in6(rai->ai_port_space, -+ (struct sockaddr_ib **) &rai->ai_src_addr, -+ &rai->ai_src_len, -+ (struct sockaddr_in6 *) ai->ai_addr, -+ ai->ai_addrlen); -+printf("using af ib \n"); -+ } else { -+ rai->ai_family = ai->ai_family; -+printf("af %d\n", rai->ai_family); -+ ret = ucma_copy_addr(&rai->ai_src_addr, &rai->ai_src_len, -+ ai->ai_addr, ai->ai_addrlen); -+ } - } else { -- rai->ai_dst_addr = addr; -- rai->ai_dst_len = ai->ai_addrlen; -- rai->ai_dst_canonname = canonname; -+ if (ai->ai_canonname) -+ rai->ai_dst_canonname = strdup(ai->ai_canonname); -+ -+ if ((hints->ai_flags & RAI_FAMILY) && (hints->ai_family == AF_IB) && -+ (hints->ai_flags & RAI_NUMERICHOST)) { -+ rai->ai_family = AF_IB; -+ ret = ucma_convert_in6(rai->ai_port_space, -+ (struct sockaddr_ib **) &rai->ai_dst_addr, -+ &rai->ai_dst_len, -+ (struct sockaddr_in6 *) ai->ai_addr, -+ ai->ai_addrlen); -+ } else { -+ rai->ai_family = ai->ai_family; -+ ret = ucma_copy_addr(&rai->ai_dst_addr, &rai->ai_dst_len, -+ ai->ai_addr, ai->ai_addrlen); -+ } - } -- -- return 0; -+ return ret; - } - --static int ucma_convert_gai(char *node, char *service, -+static int ucma_getaddrinfo(char *node, char *service, - struct rdma_addrinfo *hints, - struct rdma_addrinfo *rai) - { - struct addrinfo ai_hints; -- struct addrinfo *ai, *aih; -+ struct addrinfo *ai; - int ret; - -- if (hints) { -+ if (hints != &nohints) { - ucma_convert_to_ai(&ai_hints, hints); -- rai->ai_flags = hints->ai_flags; -- aih = &ai_hints; -+ ret = getaddrinfo(node, service, &ai_hints, &ai); - } else { -- aih = NULL; -+ ret = getaddrinfo(node, service, NULL, &ai); - } -- -- ret = getaddrinfo(node, service, aih, &ai); - if (ret) - return ret; - -@@ -178,18 +248,6 @@ static int ucma_convert_gai(char *node, char *service, - return ret; - } - --static int ucma_copy_ai_addr(struct sockaddr **dst, socklen_t *dst_len, -- struct sockaddr *src, socklen_t src_len) --{ -- *dst = calloc(1, src_len); -- if (!(*dst)) -- return ERR(ENOMEM); -- -- memcpy(*dst, src, src_len); -- *dst_len = src_len; -- return 0; --} -- - int rdma_getaddrinfo(char *node, char *service, - struct rdma_addrinfo *hints, - struct rdma_addrinfo **res) -@@ -208,24 +266,27 @@ int rdma_getaddrinfo(char *node, char *service, - if (!rai) - return ERR(ENOMEM); - -+ if (!hints) -+ hints = &nohints; -+ - if (node || service) { -- ret = ucma_convert_gai(node, service, hints, rai); -+ ret = ucma_getaddrinfo(node, service, hints, rai); - } else { - rai->ai_flags = hints->ai_flags; - rai->ai_family = hints->ai_family; - rai->ai_qp_type = hints->ai_qp_type; - rai->ai_port_space = hints->ai_port_space; - if (hints->ai_dst_len) { -- ret = ucma_copy_ai_addr(&rai->ai_dst_addr, &rai->ai_dst_len, -- hints->ai_dst_addr, hints->ai_dst_len); -+ ret = ucma_copy_addr(&rai->ai_dst_addr, &rai->ai_dst_len, -+ hints->ai_dst_addr, hints->ai_dst_len); - } - } - if (ret) - goto err; - -- if (!rai->ai_src_len && hints && hints->ai_src_len) { -- ret = ucma_copy_ai_addr(&rai->ai_src_addr, &rai->ai_src_len, -- hints->ai_src_addr, hints->ai_src_len); -+ if (!rai->ai_src_len && hints->ai_src_len) { -+ ret = ucma_copy_addr(&rai->ai_src_addr, &rai->ai_src_len, -+ hints->ai_src_addr, hints->ai_src_len); - if (ret) - goto err; - } -diff --git a/src/cma.c b/src/cma.c -index f460967..d168df6 100755 ---- a/src/cma.c -+++ b/src/cma.c -@@ -2240,7 +2240,7 @@ int ucma_max_qpsize(struct rdma_cm_id *id) - return id_priv->cma_dev->max_qpsize; - } - --static uint16_t ucma_get_port(struct sockaddr *addr) -+uint16_t ucma_get_port(struct sockaddr *addr) - { - switch (addr->sa_family) { - case AF_INET: -diff --git a/src/cma.h b/src/cma.h -index 6c3df27..6a1cd75 100644 ---- a/src/cma.h -+++ b/src/cma.h -@@ -1,5 +1,5 @@ - /* -- * 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 -@@ -45,6 +45,7 @@ - #include - - #include -+#include - - #ifdef INCLUDE_VALGRIND - # include -@@ -137,6 +138,9 @@ typedef struct { volatile int val; } atomic_t; - #define atomic_get(v) ((v)->val) - #define atomic_set(v, s) ((v)->val = s) - -+uint16_t ucma_get_port(struct sockaddr *addr); -+void ucma_set_sid(enum rdma_port_space ps, struct sockaddr *addr, -+ struct sockaddr_ib *sib); - int ucma_max_qpsize(struct rdma_cm_id *id); - int ucma_complete(struct rdma_cm_id *id); - static inline int ERR(int err) diff --git a/patches/af_ib b/patches/af_ib deleted file mode 100644 index 50850586..00000000 --- a/patches/af_ib +++ /dev/null @@ -1,192 +0,0 @@ -Bottom: 086badbbfd868932f3fafcd3ccbe5f43b1f494c0 -Top: 2e0a7d3ef44614a3f6760f3dad7fff7ae67386fc -Author: Sean Hefty -Date: 2012-08-17 14:02:45 -0700 - -librdmacm: Enable AF_IB support - -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..92411fa 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); -@@ -389,7 +410,7 @@ void ucma_ib_resolve(struct rdma_addrinfo **rai, struct rdma_addrinfo *hints) - ucma_ib_save_resp(*rai, &msg); - - if (af_ib_support && !((*rai)->ai_flags & RAI_ROUTEONLY) && -- (*rai)->ai_route_len) -+ (*rai)->ai_route_len && ((*rai)->ai_family != AF_IB)) - ucma_resolve_af_ib(rai); - } - -diff --git a/src/cma.c b/src/cma.c -index 4f6a5ab..f460967 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; - -- /* Just return - do not enable AF_IB support for now */ -- return; -- - 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/dup2 b/patches/dup2 deleted file mode 100644 index 3d28953a..00000000 --- a/patches/dup2 +++ /dev/null @@ -1,37 +0,0 @@ -Bottom: 4e01eb8a1c0681cd7bcca9c1bf3502036b929d4b -Top: 79d073d6c2d4883bac75c2245a0da053def1f1d6 -Author: Sean Hefty -Date: 2012-09-07 10:20:53 -0700 - -rspreload: Fix state checks in dup2 - -The patch to add dup2 support was never updated to handle the fd -state. The check for the fd type == fd_fork is no longer valid. -We need to instead check the fd state before handling forking. - -Problem pointed out by Alex Couvrard - -Signed-off-by: Sean Hefty - - ---- - -diff --git a/src/preload.c b/src/preload.c -index 4ba38f5..fb2149b 100644 ---- a/src/preload.c -+++ b/src/preload.c -@@ -978,8 +978,12 @@ int dup2(int oldfd, int newfd) - - init_preload(); - oldfdi = idm_lookup(&idm, oldfd); -- if (oldfdi && oldfdi->type == fd_fork) -- fork_passive(oldfd); -+ if (oldfdi) { -+ if (oldfdi->state == fd_fork_passive) -+ fork_passive(oldfd); -+ else if (oldfdi->state == fd_fork_active) -+ fork_active(oldfd); -+ } - - newfdi = idm_lookup(&idm, newfd); - if (newfdi) { diff --git a/patches/ren-copy-rai b/patches/ren-copy-rai deleted file mode 100644 index 0225d6da..00000000 --- a/patches/ren-copy-rai +++ /dev/null @@ -1,45 +0,0 @@ -Bottom: 2e0a7d3ef44614a3f6760f3dad7fff7ae67386fc -Top: 4e01eb8a1c0681cd7bcca9c1bf3502036b929d4b -Author: Sean Hefty -Date: 2012-08-28 17:37:30 -0700 - -librdmacm: Rename ucma_copy_rai_addr to ucma_set_ep_data - -Simple function rename to better indicate operation. - -Signed-off-by: Sean Hefty - - ---- - -diff --git a/src/acm.c b/src/acm.c -index 92411fa..95eee73 100755 ---- a/src/acm.c -+++ b/src/acm.c -@@ -313,7 +313,7 @@ static void ucma_ib_save_resp(struct rdma_addrinfo *rai, cma_acm_msg_t *msg) - } - } - --static void ucma_copy_rai_addr(struct acm_ep_addr_data *data, struct sockaddr *addr) -+static void ucma_set_ep_addr(struct acm_ep_addr_data *data, struct sockaddr *addr) - { - if (addr->sa_family == AF_INET) { - data->type = ACM_EP_INFO_ADDRESS_IP; -@@ -353,7 +353,7 @@ void ucma_ib_resolve(struct rdma_addrinfo **rai, struct rdma_addrinfo *hints) - data = &msg.resolve_data[0]; - 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); -+ ucma_set_ep_addr(data, (*rai)->ai_src_addr); - data++; - msg.hdr.length += ACM_MSG_EP_LENGTH; - } -@@ -362,7 +362,7 @@ void ucma_ib_resolve(struct rdma_addrinfo **rai, struct rdma_addrinfo *hints) - data->flags = ACM_EP_FLAG_DEST; - if ((*rai)->ai_flags & (RAI_NUMERICHOST | RAI_NOROUTE)) - data->flags |= ACM_FLAGS_NODELAY; -- ucma_copy_rai_addr(data, (*rai)->ai_dst_addr); -+ ucma_set_ep_addr(data, (*rai)->ai_dst_addr); - data++; - msg.hdr.length += ACM_MSG_EP_LENGTH; - } diff --git a/patches/rs-docs b/patches/rs-docs deleted file mode 100644 index 898f6576..00000000 --- a/patches/rs-docs +++ /dev/null @@ -1,166 +0,0 @@ -Bottom: aff44b871980ab9e18c7d2c9b90bc34b060bb30d -Top: fd25e5104198197967ac10d49db6570c49bf661c -Author: Sean Hefty -Date: 2012-09-10 14:32:45 -0700 - -rsockets: Document rsocket protocol and design - -Include a brief overview of the rsocket protocol and underlying design -with the source code to make it easier for someone trying to decipher -the actual code. - -Signed-off-by: Sean Hefty - - ---- - -diff --git a/docs/rsocket b/docs/rsocket -new file mode 100644 -index 0000000..5399f6c ---- /dev/null -+++ b/docs/rsocket -@@ -0,0 +1,144 @@ -+rsocket Protocol and Design Guide 9/10/2012 -+ -+Overview -+-------- -+Rsockets is a protocol over RDMA that supports a socket-level API -+for applications. For details on the current state of the -+implementation, readers should refer to the rsocket man page. This -+document describes the rsocket protocol, general design, and -+some implementation details. -+ -+Rsockets exchanges data by performing RDMA write operations into -+exposed data buffers. In addition to RDMA write data, rsockets uses -+small, 32-bit messages for internal communication. RDMA writes -+are used to transfer application data into remote data buffers -+and to notify the peer when new target data buffers are available. -+The following figure highlights the operation. -+ -+ host A host B -+ remote SGL -+ target SGL <------------- [ ] -+ [ ] ------ -+ [ ] -- ------ receive buffer(s) -+ -- -----> +--+ -+ -- | | -+ -- | | -+ -- | | -+ -- +--+ -+ -- -+ ---> +--+ -+ | | -+ | | -+ +--+ -+ -+The remote SGL contains the address, size, and rkey of the target SGL. As -+receive buffers become available on host B, rsockets will issue an RDMA -+write against one of the entries in the target SGL on host A. The -+updated entry will reference an available receive buffer. Immediate data -+included with the RDMA write will indicate to host A that a target SGE -+has been updated. -+ -+When host A has data to send, it will check its target SGL. The current -+target SGE will contain the address, size, and rkey of the next receive -+buffer on host B. If the data transfer is smaller than the size of the -+remote receive buffer, host A will update its target SGE to reflect the -+remaining size of the receive buffer. That is, once a receive buffer has -+been published to a remote peer, it will be fully consumed before a second -+buffer is used. -+ -+Rsockets relies on immediate data to notify the remote peer when data has -+been transferred or when a target SGL has been updated. Because immediate -+data requires that the remote QP have a posted receive, rsockets also uses -+a credit based flow control mechanism. The number of credits is based on -+the size of the receive queue, with initial credits exchanged during -+connection setup. In order to transfer data, rsockets requires both -+available receive buffers (published via the target SGL) and data credits. -+ -+Since immediate data is limited to 32-bits, messages may either indicate -+the arrival of application data or may be an internal message, but not both. -+To avoid credit deadlock, rsockets reserves a small number of available -+credits for control messages only, with the protocol relying on RNR NAKs -+and retries to make forward progress. -+ -+ -+Connection Establishment -+------------------------ -+rsockets uses the RDMA CM for connection establishment. Struct rs_conn_data -+is exchanged during the connection exchange as private data in the request -+and reply messages. -+ -+struct rs_sge { -+ uint64_t addr; -+ uint32_t key; -+ uint32_t length; -+}; -+ -+#define RS_CONN_FLAG_NET 1 -+ -+struct rs_conn_data { -+ uint8_t version; -+ uint8_t flags; -+ uint16_t credits; -+ uint32_t reserved2; -+ struct rs_sge target_sgl; -+ struct rs_sge data_buf; -+}; -+ -+Version - current version is 1 -+Flags -+RS_CONN_FLAG_NET - Set to 1 if host is big Endian. -+ Determines byte ordering for RDMA write messages -+Credits - number of initial receive credits -+Reserved2 - set to 0 -+Target SGL - Address, size (# entries), and rkey of target SGL. -+ Remote side will copy this into their remote SGL. -+Data Buffer - Initial receive buffer address, size (in bytes), and rkey. -+ Remote side will copy this into their first target SGE. -+ -+ -+Message Format -+-------------- -+Rsocket uses RDMA writes with immediate data for all message exchanges. -+RDMA writes of 0 length are used if no additional data beyond the message -+needs to be exchanged. Immediate data is limited to 32-bits. Rsockets -+defines the following format for messages. -+ -+The upper 3 bits are used to define the type of message being exchanged, -+with the meaning of the lower 29 bits determined by the upper bits. -+ -+Bits Message Meaning of -+31:29 Type Bits 28:0 -+000 Data Transfer bytes transfered -+001 reserved -+010 reserved -+011 reserved -+100 Credit Update received credits granted -+101 reserved -+110 reserved -+111 Control control message type -+ -+Data Transfer -+Indicates that application data has been written into the next available -+receive buffer. The size of the transfer, in bytes, is carried in the lower -+bits of the message. -+ -+Credit Update -+Used to indicate that additional receive buffers and credits are available. -+The number of available credits is carried in the lower bits of the message. -+A credit update message is also used to indicate that a target SGE has been -+updated, in which case the number of additional credits may be 0. The -+receiver of a credit update message must check for updates to the target SGL -+by inspecting the contents of the SGL. The rsocket implementation must take -+care not to modify a remote target SGL while it may be in use. This is done -+by tracking when a receive buffer referenced by a remote target SGL has been -+filled. -+ -+Control Message - DISCONNECT -+Indicates that the rsocket connection has been fully disconnected and will no -+longer send or receive data. Data received before the disconnect message was -+processed may still be available for reading. -+ -+Control Message - SHUTDOWN -+Indicates that the remote rsocket has shutdown the send side of its -+connection. The recipient of a shutdown message will no longer accept -+incoming data, but may still transfer outbound data. diff --git a/patches/sa_family b/patches/sa_family deleted file mode 100644 index e4c3b5f1..00000000 --- a/patches/sa_family +++ /dev/null @@ -1,66 +0,0 @@ -Bottom: 29515e2e36f97c36cfce9dc0aace196aae3e2879 -Top: 086badbbfd868932f3fafcd3ccbe5f43b1f494c0 -Author: Sean Hefty -Date: 2012-08-23 15:48:06 -0700 - -librdmacm: Set address family for source address returned by ACM - -Set the sa_family type when saving the source address returnd -by ACM. - -Signed-off-by: Sean Hefty - - ---- - -diff --git a/src/acm.c b/src/acm.c -index 458e23d..d96dbcd 100755 ---- a/src/acm.c -+++ b/src/acm.c -@@ -258,6 +258,8 @@ static void ucma_ib_save_resp(struct rdma_addrinfo *rai, cma_acm_msg_t *msg) - struct acm_ep_addr_data *ep_data; - struct ibv_path_data *path_data = NULL; - struct ibv_path_record *pri_path = NULL; -+ struct sockaddr_in *sin; -+ struct sockaddr_in6 *sin6; - int i, cnt, path_cnt = 0; - - cnt = (msg->hdr.length - ACM_MSG_HDR_LENGTH) / ACM_MSG_EP_LENGTH; -@@ -277,25 +279,27 @@ static void ucma_ib_save_resp(struct rdma_addrinfo *rai, cma_acm_msg_t *msg) - if (!(ep_data->flags & ACM_EP_FLAG_SOURCE) || rai->ai_src_len) - break; - -- rai->ai_src_addr = calloc(1, sizeof(struct sockaddr_in)); -- if (!rai->ai_src_addr) -+ sin = calloc(1, sizeof(*sin)); -+ if (!sin) - break; - -- rai->ai_src_len = sizeof(struct sockaddr_in); -- memcpy(&((struct sockaddr_in *) rai->ai_src_addr)->sin_addr, -- &ep_data->info.addr, 4); -+ sin->sin_family = AF_INET; -+ memcpy(&sin->sin_addr, &ep_data->info.addr, 4); -+ rai->ai_src_len = sizeof(*sin); -+ rai->ai_src_addr = (struct sockaddr *) sin; - break; - case ACM_EP_INFO_ADDRESS_IP6: - if (!(ep_data->flags & ACM_EP_FLAG_SOURCE) || rai->ai_src_len) - break; - -- rai->ai_src_addr = calloc(1, sizeof(struct sockaddr_in6)); -- if (!rai->ai_src_addr) -+ sin6 = calloc(1, sizeof(*sin6)); -+ if (!sin6) - break; - -- rai->ai_src_len = sizeof(struct sockaddr_in6); -- memcpy(&((struct sockaddr_in6 *) rai->ai_src_addr)->sin6_addr, -- &ep_data->info.addr, 16); -+ sin6->sin6_family = AF_INET6; -+ memcpy(&sin6->sin6_addr, &ep_data->info.addr, 16); -+ rai->ai_src_len = sizeof(*sin6); -+ rai->ai_src_addr = (struct sockaddr *) sin6; - break; - default: - break; -- 2.41.0