Whamcloud - gitweb
LU-17039 build: cleanup ib_dma_map_sg 79/51979/2
authorShaun Tancheff <shaun.tancheff@hpe.com>
Fri, 18 Aug 2023 04:50:56 +0000 (23:50 -0500)
committerOleg Drokin <green@whamcloud.com>
Thu, 31 Aug 2023 06:40:43 +0000 (06:40 +0000)
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 <shaun.tancheff@hpe.com>
Change-Id: Id0849464d3ffbd573cac13016191d80c6ea991af
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51979
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Chris Horn <chris.horn@hpe.com>
Reviewed-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/autoconf/lustre-lnet.m4
lnet/klnds/o2iblnd/o2iblnd.h

index f36cae7..9a47cd2 100644 (file)
@@ -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])
index 73c5e51..621540a 100644 (file)
 #include <linux/module.h>
 #include <linux/kernel.h>
 
+#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