Whamcloud - gitweb
LU-13761 o2ib: Fix compilation with MOFED 5.1 81/39781/2
authorSergey Gorenko <sergeygo@mellanox.com>
Tue, 1 Sep 2020 06:53:06 +0000 (23:53 -0700)
committerOleg Drokin <green@whamcloud.com>
Tue, 15 Sep 2020 05:09:26 +0000 (05:09 +0000)
A new argument was added to rdma_reject() in MOFED 5.1 and
Linux 5.8.

Add a cofigure check and support both versions of rdma_reject().

Lustre-commit: 956deb0fe8195c7a0c38c66a5a8cc1e95c2c245e
Lustre-change: https://review.whamcloud.com/39323

Test-Parameters: trivial
Signed-off-by: Sergey Gorenko <sergeygo@mellanox.com>
Change-Id: I2b28991f335658b651b21a09899b7b17ab2a9d57
Reviewed-on: https://review.whamcloud.com/39781
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/autoconf/lustre-lnet.m4
lnet/klnds/o2iblnd/o2iblnd_cb.c

index 2ad1840..b30250e 100644 (file)
@@ -570,6 +570,29 @@ AS_IF([test $ENABLEO2IB != "no"], [
        # 5.1
        LN_IB_SG_DMA_ADDRESS_EXISTS
 
+       # A reason argument was added to rdma_reject() in Linux 5.8,
+       # commit 8094ba0ace7f6cd1e31ea8b151fba3594cadfa9a
+       LB_CHECK_COMPILE([if 4arg 'rdma_reject' exists],
+       rdma_reject, [
+               #ifdef HAVE_COMPAT_RDMA
+               #undef PACKAGE_NAME
+               #undef PACKAGE_TARNAME
+               #undef PACKAGE_VERSION
+               #undef PACKAGE_STRING
+               #undef PACKAGE_BUGREPORT
+               #undef PACKAGE_URL
+               #include <linux/compat-2.6.h>
+               #endif
+               #include <rdma/ib_verbs.h>
+               #include <rdma/ib_cm.h>
+               #include <rdma/rdma_cm.h>
+       ],[
+               rdma_reject(NULL, NULL, 0, 0);
+       ],[
+               AC_DEFINE(HAVE_RDMA_REJECT_4ARGS, 1,
+                       [rdma_reject has 4 arguments])
+       ])
+
        EXTRA_CHECK_INCLUDE=""
 ]) # ENABLEO2IB != "no"
 ]) # LN_CONFIG_O2IB
index 40b2b12..2432a8e 100644 (file)
@@ -2407,7 +2407,11 @@ kiblnd_reject(struct rdma_cm_id *cmid, struct kib_rej *rej)
 {
         int          rc;
 
+#ifdef HAVE_RDMA_REJECT_4ARGS
+       rc = rdma_reject(cmid, rej, sizeof(*rej), IB_CM_REJ_CONSUMER_DEFINED);
+#else
         rc = rdma_reject(cmid, rej, sizeof(*rej));
+#endif
 
         if (rc != 0)
                 CWARN("Error %d sending reject\n", rc);