DPDK patches and discussions
 help / color / mirror / Atom feed
From: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PACTH v3 2/2] mlx4: fix shared library dependency
Date: Fri, 31 Jul 2015 15:14:18 +0200	[thread overview]
Message-ID: <1438348458-12291-2-git-send-email-nelio.laranjeiro@6wind.com> (raw)
In-Reply-To: <1438348458-12291-1-git-send-email-nelio.laranjeiro@6wind.com>

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>
---
Changelog: fail the compilation of the PMD when the configuration is not
supported.

 doc/guides/nics/mlx4.rst  | 5 +++++
 drivers/net/mlx4/Makefile | 7 +++++++
 mk/rte.app.mk             | 3 +++
 3 files changed, 15 insertions(+)

diff --git a/doc/guides/nics/mlx4.rst b/doc/guides/nics/mlx4.rst
index c33aa38..562db06 100644
--- a/doc/guides/nics/mlx4.rst
+++ b/doc/guides/nics/mlx4.rst
@@ -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
 ----------------------
 
diff --git a/drivers/net/mlx4/Makefile b/drivers/net/mlx4/Makefile
index 14cb53f..0399aff 100644
--- a/drivers/net/mlx4/Makefile
+++ b/drivers/net/mlx4/Makefile
@@ -31,6 +31,12 @@
 
 include $(RTE_SDK)/mk/rte.vars.mk
 
+ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS)$(CONFIG_RTE_BUILD_SHARED_LIB),yy)
+$(info MLX4: Not supported in a combined shared library)
+all:
+	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
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 97719cb..3871205 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -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
-- 
1.9.1

  reply	other threads:[~2015-07-31 13:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-29 13:56 [dpdk-dev] [PATCH 1/2] mk: add LDLIBS variable when producing the .so file Nelio Laranjeiro
2015-07-29 13:56 ` [dpdk-dev] [PATCH 2/2] mlx4: add missing library dependency when compiling in shared library Nelio Laranjeiro
2015-07-30 14:48 ` [dpdk-dev] [PACTH v2 1/2] mk: use LDLIBS variable when building the shared object file Nelio Laranjeiro
2015-07-30 14:48   ` [dpdk-dev] [PACTH v2 2/2] mlx4: fix shared library dependency Nelio Laranjeiro
2015-07-30 16:22     ` Thomas Monjalon
2015-07-31 13:14 ` [dpdk-dev] [PACTH v3 1/2] mk: use LDLIBS and EXTRA_LDFLAGS variable when building the shared object file Nelio Laranjeiro
2015-07-31 13:14   ` Nelio Laranjeiro [this message]
2015-08-02 22:23     ` [dpdk-dev] [PACTH v3 2/2] mlx4: fix shared library dependency Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1438348458-12291-2-git-send-email-nelio.laranjeiro@6wind.com \
    --to=nelio.laranjeiro@6wind.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).