mlx4: fix shared library dependency

librte_pmd_mlx4.so needs to be linked with libibverbs otherwise, the PMD is
not able to open Mellanox devices and the following message is printed by
testpmd at startup
"librte_pmd_mlx4: cannot access device, is mlx4_ib loaded?".

Applications dependency on libibverbs are moved to be only valid in static
mode, in shared mode, applications do not depend on it anymore,
librte_pmd_mlx4.so keeps this dependency and thus is linked with libibverbs.

MLX4 cannot be supported in combined shared library because there is no clean
way of adding -libverbs to the combined library.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
This commit is contained in:
Nelio Laranjeiro 2015-07-31 15:14:18 +02:00 committed by Thomas Monjalon
parent bef06a8a06
commit 113c8e13c4
3 changed files with 15 additions and 0 deletions

View File

@ -47,6 +47,11 @@ There is also a `section dedicated to this poll mode driver
be enabled manually by setting ``CONFIG_RTE_LIBRTE_MLX4_PMD=y`` and
recompiling DPDK.
.. warning::
``CONFIG_RTE_BUILD_COMBINE_LIBS`` with ``CONFIG_RTE_BUILD_SHARED_LIB``
is not supported and thus the compilation will fail with this configuration.
Implementation details
----------------------

View File

@ -31,6 +31,12 @@
include $(RTE_SDK)/mk/rte.vars.mk
ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS)$(CONFIG_RTE_BUILD_SHARED_LIB),yy)
all:
@echo 'MLX4: Not supported in a combined shared library'
@false
endif
# Library name.
LIB = librte_pmd_mlx4.a
@ -50,6 +56,7 @@ CFLAGS += -g
CFLAGS += -I.
CFLAGS += -D_XOPEN_SOURCE=600
CFLAGS += $(WERROR_FLAGS)
LDLIBS += -libverbs
# A few warnings cannot be avoided in external headers.
CFLAGS += -Wno-error=cast-qual

View File

@ -100,7 +100,10 @@ ifeq ($(CONFIG_RTE_LIBRTE_VHOST_USER),n)
_LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST) += -lfuse
endif
ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n)
_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += -libverbs
endif # ! CONFIG_RTE_BUILD_SHARED_LIBS
_LDLIBS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += -lz
_LDLIBS-y += --start-group