[dpdk-dev,PACTH,v2,2/2] mlx4: fix shared library dependency
Commit Message
librte_pmd_mlx4.so needs to be linked with libiverbs 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 libverbs 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 libverbs.
Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
---
Changelog: don't compiled MLX4 PMD when the DPDK is build in combined shared
library.
doc/guides/nics/mlx4.rst | 5 +++++
drivers/net/Makefile | 6 +++++-
drivers/net/mlx4/Makefile | 1 +
mk/rte.app.mk | 2 +-
4 files changed, 12 insertions(+), 2 deletions(-)
Comments
2015-07-30 16:48, Nelio Laranjeiro:
> librte_pmd_mlx4.so needs to be linked with libiverbs 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 libverbs 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 libverbs.
>
> Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> Acked-by: Olivier Matz <olivier.matz@6wind.com>
> ---
> Changelog: don't compiled MLX4 PMD when the DPDK is build in combined shared
> library.
MLX4 cannot be supported in combined shared library because there is no clean
way of adding -libverbs to the combined library.
(This comment should be in the commit message)
> --- a/drivers/net/Makefile
> +++ b/drivers/net/Makefile
> @@ -40,7 +40,6 @@ DIRS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic
> DIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += fm10k
> DIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e
> DIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe
> -DIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4
> DIRS-$(CONFIG_RTE_LIBRTE_MPIPE_PMD) += mpipe
> DIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += null
> DIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += pcap
> @@ -49,5 +48,10 @@ DIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio
> DIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += vmxnet3
> DIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += xenvirt
>
> +# Drivers not support in combined mode
This comment is useless.
> +ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n)
It can be enabled if building a static combined library.
> +DIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4
There is no good reason to move this line.
@@ -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`` is not supported (if set, it will not
+ compile this PMD even if ``CONFIG_RTE_LIBRTE_MLX4_PMD`` is set).
+
Implementation details
----------------------
@@ -40,7 +40,6 @@ DIRS-$(CONFIG_RTE_LIBRTE_ENIC_PMD) += enic
DIRS-$(CONFIG_RTE_LIBRTE_FM10K_PMD) += fm10k
DIRS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e
DIRS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD) += ixgbe
-DIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4
DIRS-$(CONFIG_RTE_LIBRTE_MPIPE_PMD) += mpipe
DIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += null
DIRS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += pcap
@@ -49,5 +48,10 @@ DIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio
DIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += vmxnet3
DIRS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += xenvirt
+# Drivers not support in combined mode
+ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n)
+DIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4
+endif
+
include $(RTE_SDK)/mk/rte.sharelib.mk
include $(RTE_SDK)/mk/rte.subdir.mk
@@ -50,6 +50,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
@@ -100,7 +100,6 @@ ifeq ($(CONFIG_RTE_LIBRTE_VHOST_USER),n)
_LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST) += -lfuse
endif
-_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += -libverbs
_LDLIBS-$(CONFIG_RTE_LIBRTE_BNX2X_PMD) += -lz
_LDLIBS-y += --start-group
@@ -140,6 +139,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_RING) += -lrte_pmd_ring
_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP) += -lrte_pmd_pcap
_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET) += -lrte_pmd_af_packet
_LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += -lrte_pmd_null
+_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += -libverbs
endif # ! $(CONFIG_RTE_BUILD_SHARED_LIB)