Whamcloud - gitweb
LU-12400 lnet: Infiniband sg_dma changes for linux 5.1 97/35497/5
authorShaun Tancheff <stancheff@cray.com>
Sun, 21 Jul 2019 07:42:43 +0000 (02:42 -0500)
committerOleg Drokin <green@whamcloud.com>
Sat, 27 Jul 2019 00:22:14 +0000 (00:22 +0000)
IB/core: Remove ib_sg_dma_address() and ib_sg_dma_len()
Linux-commit: a163afc88556e099271a7b423295bc5176fcecce

This simplification can be applied to mainline 3.15 and later
however the test should remain for 3rd party ib driver support

Test-Parameters: trivial
Cray-bug-id: LUS-7600
Signed-off-by: Shaun Tancheff <stancheff@cray.com>
Change-Id: I4824b3b737388a3fc0aec43b2d8e5d10f871ccdd
Reviewed-on: https://review.whamcloud.com/35497
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Petros Koutoupis <pkoutoupis@cray.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/autoconf/lustre-lnet.m4
lnet/klnds/o2iblnd/o2iblnd.h

index 01fec90..8494135 100644 (file)
@@ -789,6 +789,30 @@ EXTRA_KCFLAGS="$tmp_flags"
 ]) # LN_IB_DEVICE_OPS_EXISTS
 
 #
 ]) # LN_IB_DEVICE_OPS_EXISTS
 
 #
+# LN_IB_SG_DMA_ADDRESS_EXISTS
+#
+# kernel 5.1 commit a163afc88556e099271a7b423295bc5176fcecce
+# IB/core: Remove ib_sg_dma_address() and ib_sg_dma_len()
+# ... when dma_ops existed (3.6) ib_sg_dma_address() was not trivial ...
+#
+AC_DEFUN([LN_IB_SG_DMA_ADDRESS_EXISTS], [
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+LB_CHECK_COMPILE([if ib_sg_dma_address wrapper exists],
+ib_sg_dma_address_test, [
+       #include <rdma/ib_verbs.h>
+],[
+       u64 x = ib_sg_dma_address(NULL, NULL);
+       x = x;
+       (void)x;
+],[
+       AC_DEFINE(HAVE_IB_SG_DMA_ADDRESS, 1,
+               [if ib_sg_dma_address wrapper exists])
+])
+EXTRA_KCFLAGS="$tmp_flags"
+]) # LN_IB_SG_DMA_ADDRESS_EXISTS
+
+#
 # LN_PROG_LINUX
 #
 # LNet linux kernel checks
 # LN_PROG_LINUX
 #
 # LNet linux kernel checks
@@ -817,6 +841,8 @@ LN_CONFIG_SOCK_ACCEPT
 LN_CONFIG_SOCK_GETNAME
 # 5.0
 LN_IB_DEVICE_OPS_EXISTS
 LN_CONFIG_SOCK_GETNAME
 # 5.0
 LN_IB_DEVICE_OPS_EXISTS
+# 5.1
+LN_IB_SG_DMA_ADDRESS_EXISTS
 ]) # LN_PROG_LINUX
 
 #
 ]) # LN_PROG_LINUX
 
 #
index 111133c..fd6f97c 100644 (file)
@@ -1122,6 +1122,12 @@ static inline void kiblnd_dma_unmap_sg(struct ib_device *dev,
         ib_dma_unmap_sg(dev, sg, nents, direction);
 }
 
         ib_dma_unmap_sg(dev, sg, nents, direction);
 }
 
+#ifndef HAVE_IB_SG_DMA_ADDRESS
+#include <linux/scatterlist.h>
+#define ib_sg_dma_address(dev, sg)     sg_dma_address((dev), (sg))
+#define ib_sg_dma_len(dev, sg)         sg_dma_len((dev), (sg))
+#endif
+
 static inline __u64 kiblnd_sg_dma_address(struct ib_device *dev,
                                           struct scatterlist *sg)
 {
 static inline __u64 kiblnd_sg_dma_address(struct ib_device *dev,
                                           struct scatterlist *sg)
 {