From 7ca603935fe08b4e9c4daa403c54454fdde0a632 Mon Sep 17 00:00:00 2001 From: Sean Hefty Date: Fri, 30 Sep 2011 14:37:02 -0700 Subject: [PATCH] librdmamcm: Check for valid route in ucma_set_ib_route ucma_set_ib_route will call rdma_getaddrinfo to obtain IB path information. However, rdma_getaddrinfo will return success, but not provide routing data if no route can be found (the IB ACM service is not running). In this case, we can call rdma_set_option without a valid route. Although the kernel will trap this and fail, we can detect the error in the library. This will speed up the connection rate if IB ACM is not in use. Signed-off-by: Sean Hefty --- src/cma.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/cma.c b/src/cma.c index df18684b..fa862145 100755 --- a/src/cma.c +++ b/src/cma.c @@ -846,8 +846,12 @@ static int ucma_set_ib_route(struct rdma_cm_id *id) if (ret) return ret; - ret = rdma_set_option(id, RDMA_OPTION_IB, RDMA_OPTION_IB_PATH, - rai->ai_route, rai->ai_route_len); + if (rai->ai_route_len) + ret = rdma_set_option(id, RDMA_OPTION_IB, RDMA_OPTION_IB_PATH, + rai->ai_route, rai->ai_route_len); + else + ret = -1; + rdma_freeaddrinfo(rai); return ret; } -- 2.41.0