]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/async/rdma: get_device() by ibv_context 14410/head
authorAmir Vadai <amir@vadai.me>
Thu, 23 Mar 2017 08:39:08 +0000 (10:39 +0200)
committerAdir Lev <adirl@mellanox.com>
Sun, 9 Apr 2017 07:30:31 +0000 (07:30 +0000)
This function will be used by RDMAConnCM

Issue: 995322
Change-Id: I52b684e8bbac14c1070801b2ba470c7c0dfe40b9
Signed-off-by: Amir Vadai <amir@vadai.me>
src/msg/async/rdma/Device.cc
src/msg/async/rdma/Device.h
src/msg/async/rdma/Infiniband.cc
src/msg/async/rdma/Infiniband.h

index ee5bbd73fd884cf9c3c1d4aada97f94dbf8466da..6f7df5b1133300bc43cf2f7870573a31d754104a 100644 (file)
@@ -456,6 +456,21 @@ Device* DeviceList::get_device(const char* device_name)
   return NULL;
 }
 
+
+Device* DeviceList::get_device(const struct ibv_context *ctxt)
+{
+  ibv_device *device = ctxt->device;
+
+  assert(devices);
+  for (int i = 0; i < num; ++i) {
+    if (devices[i]->ctxt->device == device) {
+      return devices[i];
+    }
+  }
+
+  return NULL;
+}
+
 int DeviceList::poll_tx(int num_entries, Device **d, ibv_wc *wc)
 {
   int n = 0;
index 5ba7d5ca4efe4d66d0a46d62c12cedca8ae46f5b..148a7517437e4ba24905bfcd0edb5641eb7adcaf 100644 (file)
@@ -153,6 +153,7 @@ class DeviceList {
   ~DeviceList();
 
   Device* get_device(const char* device_name);
+  Device* get_device(const struct ibv_context *ctxt);
 
   void uninit();
 
index 0a87b04ed5ac9acea420de1953516f3d46fdf6ee..1edb4ca71d674c1c797358020314542263912cc1 100644 (file)
@@ -612,6 +612,11 @@ Device* Infiniband::get_device(const char* device_name)
   return device_list->get_device(device_name);
 }
 
+Device *Infiniband::get_device(const struct ibv_context *ctxt)
+{
+  return device_list->get_device(ctxt);
+}
+
 Infiniband::QueuePair::~QueuePair()
 {
   if (qp) {
index a16b093ae3c268746d404e7ef623e6e19bc9f53b..53850eda1185d7197b6bf8ab27c7a4fc5c54dd39 100644 (file)
@@ -277,6 +277,7 @@ class Infiniband {
   void handle_pre_fork();
 
   Device* get_device(const char* device_name);
+  Device* get_device(const struct ibv_context *ctxt);
 
   int poll_tx(int n, Device **d, ibv_wc *wc);
   int poll_rx(int n, Device **d, ibv_wc *wc);