Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

msg/async/rdma: check if exp verbs avail #13391

Merged
merged 1 commit into from Feb 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions cmake/modules/Findrdma.cmake
Expand Up @@ -20,6 +20,17 @@ endif ()

if (RDMA_FOUND)
message(STATUS "Found libibverbs: ${RDMA_LIBRARY}")

include(CheckCXXSourceCompiles)
CHECK_CXX_SOURCE_COMPILES("
#include <infiniband/verbs.h>
int main() {
struct ibv_context* ctxt;
struct ibv_exp_gid_attr gid_attr;
ibv_exp_query_gid_attr(ctxt, 1, 0, &gid_attr);
return 0;
} " HAVE_IBV_EXP)

else ()
message(STATUS "Not Found libibverbs: ${RDMA_LIBRARY}")
if (RDMA_FIND_REQUIRED)
Expand Down
3 changes: 3 additions & 0 deletions src/include/config-h.in.cmake
Expand Up @@ -130,6 +130,9 @@
/* AsyncMessenger RDMA conditional compilation */
#cmakedefine HAVE_RDMA

/* ibverbs experimental conditional compilation */
#cmakedefine HAVE_IBV_EXP

/* define if embedded enabled */
#cmakedefine WITH_EMBEDDED

Expand Down
16 changes: 16 additions & 0 deletions src/msg/async/rdma/Infiniband.cc
Expand Up @@ -29,10 +29,12 @@ static const uint32_t CQ_DEPTH = 30000;

Port::Port(CephContext *cct, struct ibv_context* ictxt, uint8_t ipn): ctxt(ictxt), port_num(ipn), port_attr(new ibv_port_attr)
{
#ifdef HAVE_IBV_EXP
union ibv_gid cgid;
struct ibv_exp_gid_attr gid_attr;
bool malformed = false;

ldout(cct,1) << __func__ << " using experimental verbs for gid" << dendl;
int r = ibv_query_port(ctxt, port_num, port_attr);
if (r == -1) {
lderr(cct) << __func__ << " query port failed " << cpp_strerror(errno) << dendl;
Expand Down Expand Up @@ -87,6 +89,20 @@ Port::Port(CephContext *cct, struct ibv_context* ictxt, uint8_t ipn): ctxt(ictxt
lderr(cct) << __func__ << " Requested local GID was not found in GID table" << dendl;
ceph_abort();
}
#else
int r = ibv_query_port(ctxt, port_num, port_attr);
if (r == -1) {
lderr(cct) << __func__ << " query port failed " << cpp_strerror(errno) << dendl;
ceph_abort();
}

lid = port_attr->lid;
r = ibv_query_gid(ctxt, port_num, 0, &gid);
if (r) {
lderr(cct) << __func__ << " query gid failed " << cpp_strerror(errno) << dendl;
ceph_abort();
}
#endif
}


Expand Down