]> git.openfabrics.org - ~shefty/librdmacm.git/commitdiff
librdmamcm: Check for valid route in ucma_set_ib_route
authorSean Hefty <sean.hefty@intel.com>
Fri, 30 Sep 2011 21:37:02 +0000 (14:37 -0700)
committerSean Hefty <sean.hefty@intel.com>
Fri, 2 Mar 2012 01:11:10 +0000 (17:11 -0800)
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 <sean.hefty@intel.com>
src/cma.c

index df18684b69872dc1fa11f64505bdbfd6ade968a2..fa8621451ee89aaea93c8ddb763915e3ff04fe14 100755 (executable)
--- 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;
 }