Whamcloud - gitweb
LU-12355 lnet: Adjust checks for ib_device_ops 16/35016/4
authorShaun Tancheff <stancheff@cray.com>
Tue, 11 Jun 2019 12:29:49 +0000 (07:29 -0500)
committerOleg Drokin <green@whamcloud.com>
Sun, 16 Jun 2019 03:26:24 +0000 (03:26 +0000)
RDMA/core: Introduce ib_device_ops

The ib_device_ops structure defines all the InfiniBand device
operations in one place

Linux-commit: 521ed0d92ab0db3edd17a5f4716b7f698f4fce61

Test-Parameters: trivial
Change-Id: Ia2a617597c75ec819f485b93a1deb368d4b5e873
Signed-off-by: Shaun Tancheff <stancheff@cray.com>
Reviewed-on: https://review.whamcloud.com/35016
Reviewed-by: Petros Koutoupis <pkoutoupis@cray.com>
Tested-by: Jenkins
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Amir Shehata <ashehata@whamcloud.com>
Reviewed-by: Chris Horn <hornc@cray.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/autoconf/lustre-lnet.m4
lnet/klnds/o2iblnd/o2iblnd.c

index 1e51ba0..01fec90 100644 (file)
@@ -764,6 +764,31 @@ EXTRA_KCFLAGS="$tmp_flags"
 ]) # LN_CONFIG_SOCK_GETNAME
 
 #
+# LN_IB_DEVICE_OPS_EXISTS
+#
+# kernel 5.0 commit 521ed0d92ab0db3edd17a5f4716b7f698f4fce61
+# RDMA/core: Introduce ib_device_ops
+# ... introduces the ib_device_ops structure that defines all the
+# InfiniBand device operations in one place ...
+#
+AC_DEFUN([LN_IB_DEVICE_OPS_EXISTS], [
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+LB_CHECK_COMPILE([if struct ib_device_ops is defined],
+ib_device_ops_test, [
+       #include <rdma/ib_verbs.h>
+],[
+       int x = offsetof(struct ib_device_ops, unmap_fmr);
+       x = x;
+       (void)x;
+],[
+       AC_DEFINE(HAVE_IB_DEVICE_OPS, 1,
+               [if struct ib_device_ops is defined])
+])
+EXTRA_KCFLAGS="$tmp_flags"
+]) # LN_IB_DEVICE_OPS_EXISTS
+
+#
 # LN_PROG_LINUX
 #
 # LNet linux kernel checks
@@ -790,6 +815,8 @@ LN_CONFIG_SOCK_CREATE_KERN
 LN_CONFIG_SOCK_ACCEPT
 # 4.17
 LN_CONFIG_SOCK_GETNAME
+# 5.0
+LN_IB_DEVICE_OPS_EXISTS
 ]) # LN_PROG_LINUX
 
 #
index 68b9da5..1da7cd7 100644 (file)
@@ -2565,10 +2565,17 @@ kiblnd_hdev_get_attr(struct kib_hca_dev *hdev)
        hdev->ibh_mr_size = dev_attr->max_mr_size;
 
        /* Setup device Memory Registration capabilities */
+#ifdef HAVE_IB_DEVICE_OPS
+       if (hdev->ibh_ibdev->ops.alloc_fmr &&
+           hdev->ibh_ibdev->ops.dealloc_fmr &&
+           hdev->ibh_ibdev->ops.map_phys_fmr &&
+           hdev->ibh_ibdev->ops.unmap_fmr) {
+#else
        if (hdev->ibh_ibdev->alloc_fmr &&
            hdev->ibh_ibdev->dealloc_fmr &&
            hdev->ibh_ibdev->map_phys_fmr &&
            hdev->ibh_ibdev->unmap_fmr) {
+#endif
                LCONSOLE_INFO("Using FMR for registration\n");
                hdev->ibh_dev->ibd_dev_caps |= IBLND_DEV_CAPS_FMR_ENABLED;
        } else if (dev_attr->device_cap_flags & IB_DEVICE_MEM_MGT_EXTENSIONS) {