]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
xio: Add xio_transport_type 4055/head
authorVu Pham <vu@mellanox.com>
Tue, 17 Mar 2015 12:17:01 +0000 (05:17 -0700)
committerVu Pham <vu@mellanox.com>
Tue, 17 Mar 2015 12:17:01 +0000 (05:17 -0700)
Add xio_transport_type to control and run xio messenger over
rdma or tcp

Signed-off-by: Vu Pham <vu@mellanox.com>
src/common/config_opts.h
src/msg/xio/XioMessenger.cc

index 41e3d23a1324fafd97c6e8bdf814f9428b3e936f..9e88f380788bcc22d3e025f45a90d5347456172e 100644 (file)
@@ -74,6 +74,7 @@ OPTION(xio_mp_max_1k, OPT_INT, 8192) // max 1K chunks
 OPTION(xio_mp_max_page, OPT_INT, 4096) // max 1K chunks
 OPTION(xio_mp_max_hint, OPT_INT, 4096) // max size-hint chunks
 OPTION(xio_portal_threads, OPT_INT, 2) // xio portal threads per messenger
+OPTION(xio_transport_type, OPT_STR, "rdma") // xio transport type: {rdma or tcp}
 
 DEFAULT_SUBSYS(0, 5)
 SUBSYS(lockdep, 0, 1)
index 59b1448145d21574000ceeb72425e6c7c987380d..7d0a88cf58e923e71ce02320dca962c3f9e11098 100644 (file)
@@ -212,10 +212,12 @@ static int on_cancel_request(struct xio_session *session,
 }
 
 /* free functions */
-static string xio_uri_from_entity(const entity_addr_t& addr, bool want_port)
+static string xio_uri_from_entity(const string &type,
+                                 const entity_addr_t& addr, bool want_port)
 {
   const char *host = NULL;
   char addr_buf[129];
+  string xio_uri;
 
   switch(addr.addr.ss_family) {
   case AF_INET:
@@ -231,8 +233,12 @@ static string xio_uri_from_entity(const entity_addr_t& addr, bool want_port)
     break;
   };
 
+  if (type == "rdma" || type == "tcp")
+      xio_uri = type + "://";
+  else
+      xio_uri = "rdma://";
+
   /* The following can only succeed if the host is rdma-capable */
-  string xio_uri = "rdma://";
   xio_uri += host;
   if (want_port) {
     xio_uri += ":";
@@ -669,7 +675,8 @@ int XioMessenger::bind(const entity_addr_t& addr)
 
   entity_addr_t shift_addr = *a;
 
-  string base_uri = xio_uri_from_entity(shift_addr, false /* want_port */);
+  string base_uri = xio_uri_from_entity(cct->_conf->xio_transport_type,
+                                       shift_addr, false /* want_port */);
   ldout(cct,4) << "XioMessenger " << this << " bind: xio_uri "
     << base_uri << ':' << shift_addr.get_port() << dendl;
 
@@ -915,7 +922,8 @@ ConnectionRef XioMessenger::get_connection(const entity_inst_t& dest)
   }
   else {
     conns_sp.unlock();
-    string xio_uri = xio_uri_from_entity(dest.addr, true /* want_port */);
+    string xio_uri = xio_uri_from_entity(cct->_conf->xio_transport_type,
+                                        dest.addr, true /* want_port */);
 
     ldout(cct,4) << "XioMessenger " << this << " get_connection: xio_uri "
       << xio_uri << dendl;