]> git.openfabrics.org - ~shefty/librdmacm.git/commitdiff
r6296: update librdmacm.
authorBryan O'Sullivan <bos@pathscale.com>
Thu, 6 Apr 2006 16:51:32 +0000 (16:51 +0000)
committerBryan O'Sullivan <bos@pathscale.com>
Thu, 6 Apr 2006 16:51:32 +0000 (16:51 +0000)
README
examples/cmatose.c
include/rdma/rdma_cma_abi.h
src/cma.c

diff --git a/README b/README
index be2dbba51b0d9534df604444e8ba866d5d20704f..28a28b7a2fc815ddb6950b74416a64011dde4ed8 100644 (file)
--- a/README
+++ b/README
@@ -18,12 +18,12 @@ of adapters or ports present.
 To create the appropriate character device file automatically with
 udev, a rule like
 
-    KERNEL="ucma", NAME="infiniband/%k", MODE="0666"
+    KERNEL="rdma_cm", NAME="infiniband/%k", MODE="0666"
 
 can be used.  This will create the device node named
 
-    /dev/infiniband/ucma
+    /dev/infiniband/rdma_cm
 
 or you can create it manually
 
-  mknod /dev/infiniband/ucma c 231 255
+  mknod /dev/infiniband/rdma_cm c 231 255
index fc667737cac1dd44503345c7762c9daf0c35ce31..218a8feb7271f6d5470add7f5261141c8d650aee 100644 (file)
@@ -204,9 +204,11 @@ static int post_sends(struct cmatest_node *node)
        sge.lkey = node->mr->lkey;
        sge.addr = (uintptr_t) node->mem;
 
-       for (i = 0; i < message_count && !ret; i++)
+       for (i = 0; i < message_count && !ret; i++) {
                ret = ibv_post_send(node->cma_id->qp, &send_wr, &bad_send_wr);
-
+               if (ret) 
+                       printf("failed to post sends: %d\n", ret);
+       }
        return ret;
 }
 
index db96894d0c1391d13d6bdf24959ed8b862bab95d..5837a4d087c4cb3dc2c891ab4e4d43046a133d8c 100644 (file)
@@ -40,7 +40,7 @@
  */
 
 #define RDMA_USER_CM_MIN_ABI_VERSION   1
-#define RDMA_USER_CM_MAX_ABI_VERSION   1
+#define RDMA_USER_CM_MAX_ABI_VERSION   2
 
 #define RDMA_MAX_PRIVATE_DATA          256
 
index 497f64b2a0d46e53abeec2b379cb72afd598821e..39cf21c3cca4604675c382542afd0d20462e8a16 100644 (file)
--- a/src/cma.c
+++ b/src/cma.c
@@ -118,6 +118,7 @@ static struct ibv_device **dev_list;
 static struct dlist *cma_dev_list;
 static pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER;
 static int ucma_initialized;
+static int abi_ver;
 int cma_fd;
 
 #define container_of(ptr, type, field) \
@@ -139,6 +140,32 @@ static void ucma_cleanup(void)
                close(cma_fd);
 }
 
+static int check_abi_version(void)
+{
+       char path[256];
+       char val[16];
+
+       if (sysfs_get_mnt_path(path, sizeof path)) {
+               fprintf(stderr, "librdmacm: couldn't find sysfs mount.\n");
+               return -ENODEV;
+       }
+
+       strncat(path, "/class/misc/rdma_cm/abi_version", sizeof path);
+       if (sysfs_read_attribute_value(path, val, sizeof val))
+               abi_ver = 1; /* ABI version wasn't available until version 2 */
+       else
+               abi_ver = strtol(val, NULL, 10);
+
+       if (abi_ver < RDMA_USER_CM_MIN_ABI_VERSION ||
+           abi_ver > RDMA_USER_CM_MAX_ABI_VERSION) {
+               fprintf(stderr, "librdmacm: kernel ABI version %d "
+                               "doesn't match library version %d.\n",
+                               abi_ver, RDMA_USER_CM_MAX_ABI_VERSION);
+               return -ENOSYS;
+       }
+       return 0;
+}
+
 static int ucma_init(void)
 {
        int i;
@@ -157,6 +184,10 @@ static int ucma_init(void)
                goto err;
        }
 
+       ret = check_abi_version();
+       if (ret)
+               goto err;
+
        cma_dev_list = dlist_new(sizeof *cma_dev);
        if (!cma_dev_list) {
                ret = -ENOMEM;
@@ -404,7 +435,7 @@ int rdma_bind_addr(struct rdma_cm_id *id, struct sockaddr *addr)
        if (ret != size)
                return (ret > 0) ? -ENODATA : ret;
 
-       if (((struct sockaddr_in *) addr)->sin_addr.s_addr != 0) {
+       if (abi_ver > 1) {
                ret = ucma_query_route(id);
                if (ret)
                        return ret;