From c4cec6c8878c80719b7d6ad44772be114407cb66 Mon Sep 17 00:00:00 2001 From: Sylvain Didelot Date: Thu, 23 Jul 2020 14:30:45 -0400 Subject: [PATCH] prov/verbs: set ip_version and port correctly in RDMA CM header The patch also simplifies a 'if' statement. Change-Id: Ib40a46802bb672e3b3ce9e8ee07c0c2c6398d35e Signed-off-by: Sylvain Didelot --- prov/verbs/src/fi_verbs.c | 8 ++++---- prov/verbs/src/verbs_cm.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/prov/verbs/src/fi_verbs.c b/prov/verbs/src/fi_verbs.c index 4bcc42af3c9..b1c95f8a6db 100644 --- a/prov/verbs/src/fi_verbs.c +++ b/prov/verbs/src/fi_verbs.c @@ -237,11 +237,11 @@ static int vrb_get_sib_rai(const char *node, const char *service, uint64_t flags int vrb_get_rdma_rai(const char *node, const char *service, uint64_t flags, const struct fi_info *hints, struct rdma_addrinfo **rai) { - if (hints && hints->addr_format == FI_SOCKADDR_IB) { - if (node || hints->src_addr || hints->dest_addr) - return vrb_get_sib_rai(node, service, flags, hints, rai); - /* fallthrough */ + if (hints && hints->addr_format == FI_SOCKADDR_IB && + (node || hints->src_addr || hints->dest_addr)) { + return vrb_get_sib_rai(node, service, flags, hints, rai); } + return vrb_get_rdmacm_rai(node, service, flags, hints, rai); } diff --git a/prov/verbs/src/verbs_cm.c b/prov/verbs/src/verbs_cm.c index 4ee4184d2c3..8ae1599f11f 100644 --- a/prov/verbs/src/verbs_cm.c +++ b/prov/verbs/src/verbs_cm.c @@ -139,8 +139,8 @@ vrb_msg_ep_prepare_rdma_cm_hdr(void *priv_data, { struct vrb_rdma_cm_hdr *rdma_cm_hdr = priv_data; - rdma_cm_hdr->ip_version = 0; - rdma_cm_hdr->port = 0; + rdma_cm_hdr->ip_version = 6 << 4; /* IPv6 */ + rdma_cm_hdr->port = htons(ofi_addr_get_port(&id->route.addr.src_addr)); /* Record the GIDs */ memcpy(rdma_cm_hdr->src_addr,