From: Shaun Tancheff Date: Sun, 21 Jul 2019 07:42:43 +0000 (-0500) Subject: LU-12400 lnet: Infiniband sg_dma changes for linux 5.1 X-Git-Tag: 2.12.57~85 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=bbc2cf593b83f5f1822889ef5c910906aadbe735 LU-12400 lnet: Infiniband sg_dma changes for linux 5.1 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 Change-Id: I4824b3b737388a3fc0aec43b2d8e5d10f871ccdd Reviewed-on: https://review.whamcloud.com/35497 Tested-by: jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Petros Koutoupis Reviewed-by: Oleg Drokin --- diff --git a/lnet/autoconf/lustre-lnet.m4 b/lnet/autoconf/lustre-lnet.m4 index 01fec90..8494135 100644 --- a/lnet/autoconf/lustre-lnet.m4 +++ b/lnet/autoconf/lustre-lnet.m4 @@ -789,6 +789,30 @@ EXTRA_KCFLAGS="$tmp_flags" ]) # 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 +],[ + 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 @@ -817,6 +841,8 @@ LN_CONFIG_SOCK_ACCEPT LN_CONFIG_SOCK_GETNAME # 5.0 LN_IB_DEVICE_OPS_EXISTS +# 5.1 +LN_IB_SG_DMA_ADDRESS_EXISTS ]) # LN_PROG_LINUX # diff --git a/lnet/klnds/o2iblnd/o2iblnd.h b/lnet/klnds/o2iblnd/o2iblnd.h index 111133c..fd6f97c 100644 --- a/lnet/klnds/o2iblnd/o2iblnd.h +++ b/lnet/klnds/o2iblnd/o2iblnd.h @@ -1122,6 +1122,12 @@ static inline void kiblnd_dma_unmap_sg(struct ib_device *dev, ib_dma_unmap_sg(dev, sg, nents, direction); } +#ifndef HAVE_IB_SG_DMA_ADDRESS +#include +#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) {