Permalink
Browse files

Add compatibility macro for rdma_create_id()

As of RHEL6.2 kernel 2.6.32-204.el6, rdma_create_id() requires a
queue-pair type as a fourth argument.  This was previously inferred
from the rdma_port_space argument.  Add an autoconf test to detect
whether the fourth argument is expected and a compatibility macro
that discards the QP type argument if the 3-argument version of
rdma_create_id() is present.
  • Loading branch information...
1 parent d73246e commit 69f82e5ee2b3ed70bc4cc25c3e26c996a1f9c61f @nedbass nedbass committed Oct 17, 2011
Showing with 32 additions and 4 deletions.
  1. +19 −0 lnet/autoconf/lustre-lnet.m4
  2. +4 −3 lnet/klnds/o2iblnd/o2iblnd.c
  3. +6 −0 lnet/klnds/o2iblnd/o2iblnd.h
  4. +3 −1 lnet/klnds/o2iblnd/o2iblnd_cb.c
@@ -356,6 +356,20 @@ AC_SUBST(MXLND)
# LN_CONFIG_O2IB
#
AC_DEFUN([LN_CONFIG_O2IB],[
+
+# In RHEL 6.2, rdma_create_id() takes the queue-pair type as a fourth argument
+AC_MSG_CHECKING([if rdma_create_id wants four args])
+LB_LINUX_TRY_COMPILE([
+ #include <rdma/rdma_cm.h>
+],[
+ rdma_create_id(NULL, NULL, 0, 0);
+],[
+ AC_MSG_RESULT([yes])
+ AC_DEFINE(HAVE_RDMA_CREATE_ID_4ARG, 1, [rdma_create_id wants 4 args])
+],[
+ AC_MSG_RESULT([no])
+])
+
AC_MSG_CHECKING([whether to enable OpenIB gen2 support])
# set default
AC_ARG_WITH([o2ib],
@@ -425,7 +439,12 @@ else
struct ib_qp_attr qp_attr __attribute__ ((unused));
struct ib_pool_fmr pool_fmr __attribute__ ((unused));
enum ib_cm_rej_reason rej_reason __attribute__ ((unused));
+
+ #ifdef HAVE_RDMA_CREATE_ID_4ARG
+ cm_id = rdma_create_id(NULL, NULL, RDMA_PS_TCP, 0);
+ #else
cm_id = rdma_create_id(NULL, NULL, RDMA_PS_TCP);
+ #endif
return PTR_ERR(cm_id);
],[
AC_MSG_RESULT([yes])
@@ -2383,8 +2383,8 @@ kiblnd_dev_need_failover(kib_dev_t *dev)
*
* a. rdma_bind_addr(), it will conflict with listener cmid
* b. rdma_resolve_addr() to zero addr */
- cmid = rdma_create_id(kiblnd_dummy_callback,
- dev, RDMA_PS_TCP);
+ cmid = kiblnd_rdma_create_id(kiblnd_dummy_callback, dev, RDMA_PS_TCP,
+ IB_QPT_RC);
if (IS_ERR(cmid)) {
rc = PTR_ERR(cmid);
CERROR("Failed to create cmid for failover: %d\n", rc);
@@ -2456,7 +2456,8 @@ kiblnd_dev_failover(kib_dev_t *dev)
rdma_destroy_id(cmid);
}
- cmid = rdma_create_id(kiblnd_cm_callback, dev, RDMA_PS_TCP);
+ cmid = kiblnd_rdma_create_id(kiblnd_cm_callback, dev, RDMA_PS_TCP,
+ IB_QPT_RC);
if (IS_ERR(cmid)) {
rc = PTR_ERR(cmid);
CERROR("Failed to create cmid for failover: %d\n", rc);
@@ -144,6 +144,12 @@ extern kib_tunables_t kiblnd_tunables;
IBLND_CREDIT_HIGHWATER_V1 : \
*kiblnd_tunables.kib_peercredits_hiw) /* when eagerly to return credits */
+#ifdef HAVE_RDMA_CREATE_ID_4ARG
+#define kiblnd_rdma_create_id(cb, dev, ps, qpt) rdma_create_id(cb, dev, ps, qpt)
+#else
+#define kiblnd_rdma_create_id(cb, dev, ps, qpt) rdma_create_id(cb, dev, ps)
+#endif
+
static inline int
kiblnd_concurrent_sends_v1(void)
{
@@ -1262,7 +1262,9 @@ kiblnd_connect_peer (kib_peer_t *peer)
LASSERT (net != NULL);
LASSERT (peer->ibp_connecting > 0);
- cmid = rdma_create_id(kiblnd_cm_callback, peer, RDMA_PS_TCP);
+ cmid = kiblnd_rdma_create_id(kiblnd_cm_callback, peer, RDMA_PS_TCP,
+ IB_QPT_RC);
+
if (IS_ERR(cmid)) {
CERROR("Can't create CMID for %s: %ld\n",
libcfs_nid2str(peer->ibp_nid), PTR_ERR(cmid));

0 comments on commit 69f82e5

Please sign in to comment.