Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions config/common_base
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ CONFIG_RTE_LIBRTE_FM10K_INC_VECTOR=y
#
CONFIG_RTE_LIBRTE_MLX4_PMD=n
CONFIG_RTE_LIBRTE_MLX4_DEBUG=n
CONFIG_RTE_LIBRTE_MLX4_DLOPEN_DEPS=n
CONFIG_RTE_LIBRTE_MLX4_SGE_WR_N=4
CONFIG_RTE_LIBRTE_MLX4_MAX_INLINE=0
CONFIG_RTE_LIBRTE_MLX4_TX_MP_CACHE=8
Expand All @@ -216,6 +217,7 @@ CONFIG_RTE_LIBRTE_MLX4_SOFT_COUNTERS=1
#
CONFIG_RTE_LIBRTE_MLX5_PMD=n
CONFIG_RTE_LIBRTE_MLX5_DEBUG=n
CONFIG_RTE_LIBRTE_MLX5_DLOPEN_DEPS=n
CONFIG_RTE_LIBRTE_MLX5_TX_MP_CACHE=8

#
Expand Down
27 changes: 27 additions & 0 deletions doc/guides/nics/mlx4.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,24 @@ These options can be modified in the ``.config`` file.

Toggle compilation of librte_pmd_mlx4 itself.

- ``CONFIG_RTE_LIBRTE_MLX4_DLOPEN_DEPS`` (default **n**)

Build PMD with additional code to make it loadable without hard
dependencies on **libibverbs** nor **libmlx4**, which may not be installed
on the target system.

In this mode, their presence is still required for it to run properly,
however their absence won't prevent a DPDK application from starting (with
``CONFIG_RTE_BUILD_SHARED_LIB`` disabled) and they won't show up as
missing with ``ldd(1)``.

It works by moving these dependencies to a purpose-built rdma-core "glue"
plug-in, which must either be installed in ``CONFIG_RTE_EAL_PMD_PATH`` if
set, or in a standard location for the dynamic linker (e.g. ``/lib``) if
left to the default empty string (``""``).

This option has no performance impact.

- ``CONFIG_RTE_LIBRTE_MLX4_DEBUG`` (default **n**)

Toggle debugging code and stricter compilation flags. Enabling this option
Expand Down Expand Up @@ -144,6 +162,15 @@ These options can be modified in the ``.config`` file.
Environment variables
~~~~~~~~~~~~~~~~~~~~~

- ``MLX4_GLUE_PATH``

A list of directories in which to search for the rdma-core "glue" plug-in,
separated by colons or semi-colons.

Only matters when compiled with ``CONFIG_RTE_LIBRTE_MLX4_DLOPEN_DEPS``
enabled and most useful when ``CONFIG_RTE_EAL_PMD_PATH`` is also set,
since ``LD_LIBRARY_PATH`` has no effect in this case.

- ``MLX4_INLINE_RECV_SIZE``

A nonzero value enables inline receive for packets up to that size. May
Expand Down
27 changes: 27 additions & 0 deletions doc/guides/nics/mlx5.rst
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,24 @@ These options can be modified in the ``.config`` file.

Toggle compilation of librte_pmd_mlx5 itself.

- ``CONFIG_RTE_LIBRTE_MLX5_DLOPEN_DEPS`` (default **n**)

Build PMD with additional code to make it loadable without hard
dependencies on **libibverbs** nor **libmlx5**, which may not be installed
on the target system.

In this mode, their presence is still required for it to run properly,
however their absence won't prevent a DPDK application from starting (with
``CONFIG_RTE_BUILD_SHARED_LIB`` disabled) and they won't show up as
missing with ``ldd(1)``.

It works by moving these dependencies to a purpose-built rdma-core "glue"
plug-in, which must either be installed in ``CONFIG_RTE_EAL_PMD_PATH`` if
set, or in a standard location for the dynamic linker (e.g. ``/lib``) if
left to the default empty string (``""``).

This option has no performance impact.

- ``CONFIG_RTE_LIBRTE_MLX5_DEBUG`` (default **n**)

Toggle debugging code and stricter compilation flags. Enabling this option
Expand All @@ -128,6 +146,15 @@ These options can be modified in the ``.config`` file.
Environment variables
~~~~~~~~~~~~~~~~~~~~~

- ``MLX5_GLUE_PATH``

A list of directories in which to search for the rdma-core "glue" plug-in,
separated by colons or semi-colons.

Only matters when compiled with ``CONFIG_RTE_LIBRTE_MLX5_DLOPEN_DEPS``
enabled and most useful when ``CONFIG_RTE_EAL_PMD_PATH`` is also set,
since ``LD_LIBRARY_PATH`` has no effect in this case.

- ``MLX5_PMD_ENABLE_PADDING``

Enables HW packet padding in PCI bus transactions.
Expand Down
34 changes: 34 additions & 0 deletions drivers/net/mlx4/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,26 @@ include $(RTE_SDK)/mk/rte.vars.mk

# Library name.
LIB = librte_pmd_mlx4.a
LIB_GLUE = $(LIB_GLUE_BASE).$(LIB_GLUE_VERSION)
LIB_GLUE_BASE = librte_pmd_mlx4_glue.so
LIB_GLUE_VERSION = 17.02.1

# Sources.
SRCS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4.c
ifneq ($(CONFIG_RTE_LIBRTE_MLX4_DLOPEN_DEPS),y)
SRCS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4_glue.c
endif

# Dependencies.
DEPDIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += lib/librte_ether
DEPDIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += lib/librte_mbuf
DEPDIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += lib/librte_eal
DEPDIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += lib/librte_mempool

ifeq ($(CONFIG_RTE_LIBRTE_MLX4_DLOPEN_DEPS),y)
INSTALL-$(CONFIG_RTE_LIBRTE_MLX4_PMD)-lib += $(LIB_GLUE)
endif

# Basic CFLAGS.
CFLAGS += -O3
CFLAGS += -std=gnu99 -Wall -Wextra
Expand All @@ -52,7 +62,14 @@ CFLAGS += -D_BSD_SOURCE
CFLAGS += -D_DEFAULT_SOURCE
CFLAGS += -D_XOPEN_SOURCE=600
CFLAGS += $(WERROR_FLAGS)
ifeq ($(CONFIG_RTE_LIBRTE_MLX4_DLOPEN_DEPS),y)
CFLAGS += -DMLX4_GLUE='"$(LIB_GLUE)"'
CFLAGS += -DMLX4_GLUE_VERSION='"$(LIB_GLUE_VERSION)"'
CFLAGS_mlx4_glue.o += -fPIC
LDLIBS += -ldl
else
LDLIBS += -libverbs
endif

# A few warnings cannot be avoided in external headers.
CFLAGS += -Wno-error=cast-qual
Expand Down Expand Up @@ -131,7 +148,24 @@ mlx4_autoconf.h: mlx4_autoconf.h.new

mlx4.o: mlx4_autoconf.h

# Generate dependency plug-in for rdma-core when the PMD must not be linked
# directly, so that applications do not inherit this dependency.

ifeq ($(CONFIG_RTE_LIBRTE_MLX4_DLOPEN_DEPS),y)

$(LIB): $(LIB_GLUE)

$(LIB_GLUE): mlx4_glue.o
$Q $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) \
-Wl,-h,$(LIB_GLUE) \
-s -shared -o $@ $< -libverbs

mlx4_glue.o: mlx4_autoconf.h

endif

clean_mlx4: FORCE
$Q rm -f -- mlx4_autoconf.h mlx4_autoconf.h.new
$Q rm -f -- mlx4_glue.o $(LIB_GLUE_BASE)*

clean: clean_mlx4
Loading