Whamcloud - gitweb
LU-13761 o2ib: Fix compilation with MOFED 5.1 23/39323/5
authorSergey Gorenko <sergeygo@mellanox.com>
Tue, 7 Jul 2020 11:31:31 +0000 (14:31 +0300)
committerOleg Drokin <green@whamcloud.com>
Fri, 7 Aug 2020 04:59:21 +0000 (04:59 +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().

Test-Parameters: trivial
Signed-off-by: Sergey Gorenko <sergeygo@mellanox.com>
Change-Id: I2b28991f335658b651b21a09899b7b17ab2a9d57
Reviewed-on: https://review.whamcloud.com/39323
Reviewed-by: Neil Brown <neilb@suse.de>
Reviewed-by: Alexey Lyashkov <alexey.lyashkov@hpe.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/autoconf/lustre-lnet.m4
lnet/klnds/o2iblnd/o2iblnd_cb.c

index 318036b..9554330 100644 (file)
@@ -522,6 +522,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=""
        AC_DEFUN([LN_CONFIG_O2IB_SRC], [])
        AC_DEFUN([LN_CONFIG_O2IB_RESULTS], [])
index 49433c1..f3c1a4e 100644 (file)
@@ -2293,7 +2293,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);