M: Yongseok Koh <yskoh@mellanox.com>
T: git://dpdk.org/next/dpdk-next-net-mlx
F: drivers/net/mlx5/
+F: buildtools/options-ibverbs-static.sh
F: doc/guides/nics/mlx5.rst
F: doc/guides/nics/features/mlx5.ini
--- /dev/null
+#! /bin/sh
+# SPDX-License-Identifier: BSD-3-Clause
+#
+# Print link options -l for static link of ibverbs.
+#
+# Static flavour of ibverbs and the providers libs are explicitly picked,
+# thanks to the syntax -l:libfoo.a
+# Other libs (pthread and nl) are unchanged, i.e. linked dynamically by default.
+#
+# PKG_CONFIG_PATH may be required to be set if libibverbs.pc is not installed.
+
+pkg-config --libs-only-l --static libibverbs |
+ tr '[:space:]' '\n' |
+ sed -r '/^-l(pthread|nl)/! s,(^-l)(.*),\1:lib\2.a,'
# Linking method for mlx4/5 dependency on ibverbs and related libraries
# Default linking is dynamic by linker.
-# Other option is dynamic by dlopen at run-time.
+# Other options are: dynamic by dlopen at run-time, or statically embedded.
CONFIG_RTE_IBVERBS_LINK_DLOPEN=n
+CONFIG_RTE_IBVERBS_LINK_STATIC=n
#
# Compile burst-oriented Netronome NFP PMD driver
This option has no performance impact.
+- ``CONFIG_RTE_IBVERBS_LINK_STATIC`` (default **n**)
+
+ Embed static flavour of the dependencies **libibverbs** and **libmlx4**
+ in the PMD shared library or the executable static binary.
+
- ``CONFIG_RTE_LIBRTE_MLX4_DEBUG`` (default **n**)
Toggle debugging code and stricter compilation flags. Enabling this option
- Minimal Linux kernel version: 4.14.
- Minimal RDMA core version: v15 (see `RDMA core installation documentation`_).
+- Starting with rdma-core v21, static libraries can be built::
+
+ cd build
+ CFLAGS=-fPIC cmake -DIN_PLACE=1 -DENABLE_STATIC=1 -GNinja ..
+ ninja
+
.. _`RDMA core installation documentation`: https://raw.githubusercontent.com/linux-rdma/rdma-core/master/README.md
+If rdma-core libraries are built but not installed, DPDK makefile can link them,
+thanks to these environment variables:
+
+ - ``EXTRA_CFLAGS=-I/path/to/rdma-core/build/include``
+ - ``EXTRA_LDFLAGS=-L/path/to/rdma-core/build/lib``
+ - ``PKG_CONFIG_PATH=/path/to/rdma-core/build/lib/pkgconfig``
+
.. _Mellanox_OFED_as_a_fallback:
Mellanox OFED as a fallback
This option has no performance impact.
+- ``CONFIG_RTE_IBVERBS_LINK_STATIC`` (default **n**)
+
+ Embed static flavour of the dependencies **libibverbs** and **libmlx5**
+ in the PMD shared library or the executable static binary.
+
- ``CONFIG_RTE_LIBRTE_MLX5_DEBUG`` (default **n**)
Toggle debugging code and stricter compilation flags. Enabling this option
- rdma-core version 18.0 or above built with 32bit support.
- Kernel version 4.14.41 or above.
+- Starting with rdma-core v21, static libraries can be built::
+
+ cd build
+ CFLAGS=-fPIC cmake -DIN_PLACE=1 -DENABLE_STATIC=1 -GNinja ..
+ ninja
+
.. _`Linux installation documentation`: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/plain/Documentation/admin-guide/README.rst
.. _`RDMA Core installation documentation`: https://raw.githubusercontent.com/linux-rdma/rdma-core/master/README.md
+If rdma-core libraries are built but not installed, DPDK makefile can link them,
+thanks to these environment variables:
+
+ - ``EXTRA_CFLAGS=-I/path/to/rdma-core/build/include``
+ - ``EXTRA_LDFLAGS=-L/path/to/rdma-core/build/lib``
+ - ``PKG_CONFIG_PATH=/path/to/rdma-core/build/lib/pkgconfig``
+
Mellanox OFED
^^^^^^^^^^^^^
CFLAGS += -DMLX4_GLUE_VERSION='"$(LIB_GLUE_VERSION)"'
CFLAGS_mlx4_glue.o += -fPIC
LDLIBS += -ldl
+else ifeq ($(CONFIG_RTE_IBVERBS_LINK_STATIC),y)
+LDLIBS += $(shell $(RTE_SDK)/buildtools/options-ibverbs-static.sh)
else
LDLIBS += -libverbs -lmlx4
endif
CFLAGS += -DMLX5_GLUE_VERSION='"$(LIB_GLUE_VERSION)"'
CFLAGS_mlx5_glue.o += -fPIC
LDLIBS += -ldl
+else ifeq ($(CONFIG_RTE_IBVERBS_LINK_STATIC),y)
+LDLIBS += $(shell $(RTE_SDK)/buildtools/options-ibverbs-static.sh)
else
LDLIBS += -libverbs -lmlx5
endif
ifeq ($(CONFIG_RTE_IBVERBS_LINK_DLOPEN),y)
_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += -ldl
_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += -ldl
+else ifeq ($(CONFIG_RTE_IBVERBS_LINK_STATIC),y)
+LIBS_IBVERBS_STATIC = $(shell $(RTE_SDK)/buildtools/options-ibverbs-static.sh)
+_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += $(LIBS_IBVERBS_STATIC)
+_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += $(LIBS_IBVERBS_STATIC)
else
_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += -libverbs -lmlx4
_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += -libverbs -lmlx5