]> git.openfabrics.org - ~shefty/librdmacm.git/commitdiff
refresh
authorSean Hefty <sean.hefty@intel.com>
Thu, 19 Jul 2012 21:14:44 +0000 (14:14 -0700)
committerSean Hefty <sean.hefty@intel.com>
Thu, 19 Jul 2012 21:14:44 +0000 (14:14 -0700)
meta
patches/cma-rm-pd
patches/refresh-temp [deleted file]

diff --git a/meta b/meta
index cceeeb7b77c1ed7a0fb7ce33bebbf0bbdda3621a..6ff8c6a801cd8a799ae4cc795b2a0850d3d2b807 100644 (file)
--- a/meta
+++ b/meta
@@ -1,10 +1,9 @@
 Version: 1
-Previous: 99e6e8698c075e8ce24bd41f12b5c6decf1c47f2
-Head: 143e8cc030a8be486937485f01e0cc75f338612e
+Previous: 4c713c380c7f1c91e2866e431489502a0d514de2
+Head: 05f424a751356396f7546c73b8d2881109958008
 Applied:
   rm-ib-var: 63a728f303f78348ad9727c46ac3e271197dace4
-  cma-rm-pd: 56e5f9a89ab63ee3dac2d0f2a11888603b8e86b0
-  refresh-temp: 143e8cc030a8be486937485f01e0cc75f338612e
+  cma-rm-pd: 05f424a751356396f7546c73b8d2881109958008
 Unapplied:
   transpose: 84e0beee0d2d3c217cd9703b9e438d25856cacb6
   fork: 0744fbe2b19f7924faf0dce72349307cc445577e
index b48c3f3ff4591314bdbe194db13a3b864af89893..0a40e790591cd917053227f227bc1a643159a292 100644 (file)
@@ -1,5 +1,5 @@
 Bottom: 7683fa697371afc1116e378e4f1b6c848ead85aa
-Top:    7683fa697371afc1116e378e4f1b6c848ead85aa
+Top:    8be788d836cc93c7da4ef5d9221d97c9784be146
 Author: Sean Hefty <sean.hefty@intel.com>
 Date:   2012-07-19 10:09:48 -0700
 
@@ -18,4 +18,113 @@ Signed-off-by: Sean Hefty <sean.hefty@intel.com>
 
 ---
 
-
+diff --git a/src/cma.c b/src/cma.c
+index bad8bce..a190dee 100755
+--- a/src/cma.c
++++ b/src/cma.c
+@@ -76,6 +76,7 @@ struct cma_device {
+       struct ibv_pd      *pd;
+       uint64_t            guid;
+       int                 port_cnt;
++      int                 refcnt;
+       int                 max_qpsize;
+       uint8_t             max_initiator_depth;
+       uint8_t             max_responder_resources;
+@@ -122,6 +123,7 @@ static int cma_dev_cnt;
+ static pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER;
+ static int abi_ver = RDMA_USER_CM_MAX_ABI_VERSION;
+ int af_ib_support;
++static int verbs_refcnt;
+ #define container_of(ptr, type, field) \
+       ((type *) ((void *)ptr - offsetof(type, field)))
+@@ -129,10 +131,12 @@ int af_ib_support;
+ static void ucma_cleanup(void)
+ {
+       ucma_ib_cleanup();
++      ucma_release_verbs();
+       if (cma_dev_cnt) {
+               while (cma_dev_cnt--) {
+-                      ibv_dealloc_pd(cma_dev_array[cma_dev_cnt].pd);
++                      if (cma_dev_array[cma_dev_cnt].refcnt)
++                              ibv_dealloc_pd(cma_dev_array[cma_dev_cnt].pd);
+                       ibv_close_device(cma_dev_array[cma_dev_cnt].verbs);
+               }
+@@ -235,7 +239,7 @@ int ucma_init(void)
+               goto err2;
+       }
+               
+-      cma_dev_array = malloc(sizeof *cma_dev * dev_cnt);
++      cma_dev_array = calloc(dev_cnt, sizeof *cma_dev);
+       if (!cma_dev_array) {
+               ret = ERR(ENOMEM);
+               goto err2;
+@@ -252,13 +256,6 @@ int ucma_init(void)
+                       goto err3;
+               }
+-              cma_dev->pd = ibv_alloc_pd(cma_dev->verbs);
+-              if (!cma_dev->pd) {
+-                      ibv_close_device(cma_dev->verbs);
+-                      ret = ERR(ENOMEM);
+-                      goto err3;
+-              }
+-
+               i++;
+               ret = ibv_query_device(cma_dev->verbs, &attr);
+               if (ret) {
+@@ -280,10 +277,8 @@ int ucma_init(void)
+       return 0;
+ err3:
+-      while (i--) {
+-              ibv_dealloc_pd(cma_dev_array[i].pd);
++      while (i--)
+               ibv_close_device(cma_dev_array[i].verbs);
+-      }
+       free(cma_dev_array);
+ err2:
+       ibv_free_device_list(dev_list);
+@@ -358,15 +353,34 @@ static int ucma_get_device(struct cma_id_private *id_priv, uint64_t guid)
+       for (i = 0; i < cma_dev_cnt; i++) {
+               cma_dev = &cma_dev_array[i];
+-              if (cma_dev->guid == guid) {
+-                      id_priv->cma_dev = cma_dev;
+-                      id_priv->id.verbs = cma_dev->verbs;
+-                      id_priv->id.pd = cma_dev->pd;
+-                      return 0;
+-              }
++              if (cma_dev->guid == guid)
++                      goto match;
+       }
+       return ERR(ENODEV);
++match:
++      pthread_mutex_lock(&mut);
++      if (!cma_dev->refcnt++) {
++              cma_dev->pd = ibv_alloc_pd(cma_dev_array[i].verbs);
++              if (!cma_dev->pd) {
++                      cma_dev->refcnt--;
++                      pthread_mutex_unlock(&mut);
++                      return ERR(ENOMEM);
++              }
++      }
++      pthread_mutex_unlock(&mut);
++      id_priv->cma_dev = cma_dev;
++      id_priv->id.verbs = cma_dev->verbs;
++      id_priv->id.pd = cma_dev->pd;
++      return 0;
++}
++
++static void ucma_put_device(struct cma_device *cma_dev)
++{
++      pthread_mutex_lock(&mut);
++      if (!--cma_dev->verbs_refcnt)
++              ibv_dealloc_pd(cma_dev_array[i].pd)
++      pthread_mutex_unlock(&mut);
+ }
+ static void ucma_free_id(struct cma_id_private *id_priv)
diff --git a/patches/refresh-temp b/patches/refresh-temp
deleted file mode 100644 (file)
index f3a3660..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-Bottom: 7683fa697371afc1116e378e4f1b6c848ead85aa
-Top:    8be788d836cc93c7da4ef5d9221d97c9784be146
-Author: Sean Hefty <sean.hefty@intel.com>
-Date:   2012-07-19 14:14:43 -0700
-
-Refresh of cma-rm-pd
-
----
-
-diff --git a/src/cma.c b/src/cma.c
-index bad8bce..a190dee 100755
---- a/src/cma.c
-+++ b/src/cma.c
-@@ -76,6 +76,7 @@ struct cma_device {
-       struct ibv_pd      *pd;
-       uint64_t            guid;
-       int                 port_cnt;
-+      int                 refcnt;
-       int                 max_qpsize;
-       uint8_t             max_initiator_depth;
-       uint8_t             max_responder_resources;
-@@ -122,6 +123,7 @@ static int cma_dev_cnt;
- static pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER;
- static int abi_ver = RDMA_USER_CM_MAX_ABI_VERSION;
- int af_ib_support;
-+static int verbs_refcnt;
- #define container_of(ptr, type, field) \
-       ((type *) ((void *)ptr - offsetof(type, field)))
-@@ -129,10 +131,12 @@ int af_ib_support;
- static void ucma_cleanup(void)
- {
-       ucma_ib_cleanup();
-+      ucma_release_verbs();
-       if (cma_dev_cnt) {
-               while (cma_dev_cnt--) {
--                      ibv_dealloc_pd(cma_dev_array[cma_dev_cnt].pd);
-+                      if (cma_dev_array[cma_dev_cnt].refcnt)
-+                              ibv_dealloc_pd(cma_dev_array[cma_dev_cnt].pd);
-                       ibv_close_device(cma_dev_array[cma_dev_cnt].verbs);
-               }
-@@ -235,7 +239,7 @@ int ucma_init(void)
-               goto err2;
-       }
-               
--      cma_dev_array = malloc(sizeof *cma_dev * dev_cnt);
-+      cma_dev_array = calloc(dev_cnt, sizeof *cma_dev);
-       if (!cma_dev_array) {
-               ret = ERR(ENOMEM);
-               goto err2;
-@@ -252,13 +256,6 @@ int ucma_init(void)
-                       goto err3;
-               }
--              cma_dev->pd = ibv_alloc_pd(cma_dev->verbs);
--              if (!cma_dev->pd) {
--                      ibv_close_device(cma_dev->verbs);
--                      ret = ERR(ENOMEM);
--                      goto err3;
--              }
--
-               i++;
-               ret = ibv_query_device(cma_dev->verbs, &attr);
-               if (ret) {
-@@ -280,10 +277,8 @@ int ucma_init(void)
-       return 0;
- err3:
--      while (i--) {
--              ibv_dealloc_pd(cma_dev_array[i].pd);
-+      while (i--)
-               ibv_close_device(cma_dev_array[i].verbs);
--      }
-       free(cma_dev_array);
- err2:
-       ibv_free_device_list(dev_list);
-@@ -358,15 +353,34 @@ static int ucma_get_device(struct cma_id_private *id_priv, uint64_t guid)
-       for (i = 0; i < cma_dev_cnt; i++) {
-               cma_dev = &cma_dev_array[i];
--              if (cma_dev->guid == guid) {
--                      id_priv->cma_dev = cma_dev;
--                      id_priv->id.verbs = cma_dev->verbs;
--                      id_priv->id.pd = cma_dev->pd;
--                      return 0;
--              }
-+              if (cma_dev->guid == guid)
-+                      goto match;
-       }
-       return ERR(ENODEV);
-+match:
-+      pthread_mutex_lock(&mut);
-+      if (!cma_dev->refcnt++) {
-+              cma_dev->pd = ibv_alloc_pd(cma_dev_array[i].verbs);
-+              if (!cma_dev->pd) {
-+                      cma_dev->refcnt--;
-+                      pthread_mutex_unlock(&mut);
-+                      return ERR(ENOMEM);
-+              }
-+      }
-+      pthread_mutex_unlock(&mut);
-+      id_priv->cma_dev = cma_dev;
-+      id_priv->id.verbs = cma_dev->verbs;
-+      id_priv->id.pd = cma_dev->pd;
-+      return 0;
-+}
-+
-+static void ucma_put_device(struct cma_device *cma_dev)
-+{
-+      pthread_mutex_lock(&mut);
-+      if (!--cma_dev->verbs_refcnt)
-+              ibv_dealloc_pd(cma_dev_array[i].pd)
-+      pthread_mutex_unlock(&mut);
- }
- static void ucma_free_id(struct cma_id_private *id_priv)