From: Shaun Tancheff Date: Fri, 18 Aug 2023 04:50:56 +0000 (-0500) Subject: LU-17039 build: cleanup ib_dma_map_sg X-Git-Tag: 2.15.58~6 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=a897803cc75ff9770105512acf1a81e402db7736;p=fs%2Flustre-release.git LU-17039 build: cleanup ib_dma_map_sg CONFIG_INFINIBAND_VIRT_DMA is a kernel configuration option that in some cases conflicts with the configuration of the externally provided OFED stack. During configure when ib_dma_map_sg fails to build correctly we can simply #undef CONFIG_INFINIBAND_VIRT_DMA to resolve the inconsistent configuration that breaks ib_dma_map_sg Test-Parameters: trivial HPE-bug-id: LUS-11771 Signed-off-by: Shaun Tancheff Change-Id: Id0849464d3ffbd573cac13016191d80c6ea991af Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51979 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Chris Horn Reviewed-by: Serguei Smirnov Reviewed-by: Oleg Drokin --- diff --git a/lnet/autoconf/lustre-lnet.m4 b/lnet/autoconf/lustre-lnet.m4 index f36cae7..9a47cd2 100644 --- a/lnet/autoconf/lustre-lnet.m4 +++ b/lnet/autoconf/lustre-lnet.m4 @@ -255,6 +255,7 @@ AS_IF([test $ENABLEO2IB = "no"], [ AC_MSG_NOTICE([adding $O2IB_SYMVER to Symbol Path O2IB]) EXTRA_SYMBOLS="$EXTRA_SYMBOLS $O2IB_SYMVER" AC_SUBST(EXTRA_SYMBOLS) + EXTRA_OFED_INCLUDE="${EXTRA_OFED_INCLUDE} -DMLNX_OFED_BUILD" fi else AC_MSG_ERROR([an external source tree was, either specified or detected, for o2iblnd however I could not find a $O2IBPATH/Module.symvers there]) diff --git a/lnet/klnds/o2iblnd/o2iblnd.h b/lnet/klnds/o2iblnd/o2iblnd.h index 73c5e51..621540a 100644 --- a/lnet/klnds/o2iblnd/o2iblnd.h +++ b/lnet/klnds/o2iblnd/o2iblnd.h @@ -36,6 +36,10 @@ #include #include +#if defined(MLNX_OFED_BUILD) && !defined(HAVE_SANE_IB_DMA_MAP_SG) +#undef CONFIG_INFINIBAND_VIRT_DMA +#endif + #if defined(NEED_LOCKDEP_IS_HELD_DISCARD_CONST) \ && defined(CONFIG_LOCKDEP) \ && defined(lockdep_is_held) @@ -1078,33 +1082,15 @@ static inline void kiblnd_dma_unmap_single(struct ib_device *dev, static inline int kiblnd_dma_map_sg(struct kib_hca_dev *hdev, struct kib_tx *tx) { - struct ib_device *dev = hdev->ibh_ibdev; struct scatterlist *sg = tx->tx_frags; int nents = tx->tx_nfrags; enum dma_data_direction direction = tx->tx_dmadir; if (tx->tx_gpu) - return lnet_rdma_map_sg_attrs(dev->dma_device, sg, nents, - direction); + return lnet_rdma_map_sg_attrs(hdev->ibh_ibdev->dma_device, + sg, nents, direction); -#ifdef HAVE_SANE_IB_DMA_MAP_SG - return ib_dma_map_sg(dev, sg, nents, direction); -#else - #ifdef CONFIG_INFINIBAND_VIRT_DMA - if (!dev->dma_device) { - struct scatterlist *s; - int i; - - /* NOTE: open coded ib_dma_virt_map_sg() */ - for_each_sg(sg, s, nents, i) { - sg_dma_address(s) = (uintptr_t)sg_virt(s); - sg_dma_len(s) = s->length; - } - return nents; - } - #endif - return dma_map_sg_attrs(dev->dma_device, sg, nents, direction, 0); -#endif + return ib_dma_map_sg(hdev->ibh_ibdev, sg, nents, direction); } static inline