From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id DDF481B485 for ; Wed, 9 Jan 2019 15:23:25 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 35494231C5; Wed, 9 Jan 2019 09:23:25 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Wed, 09 Jan 2019 09:23:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=mesmtp; bh=E3IX5h5qnv Cz8HGQprpcP/99exWufWqBm6yXaaBUngM=; b=RYLTkGZ4MHgqa1wjk5Yes1ZOLq QgETjs/aCtN1KW77OlwlBTdJwjkxDqhV2lRpbHmsNv9yfRt9BFul5XCs8U20Rs4K BjG+eBSfWQJ+kmcpvISFc5+dpVBO9Xv/de2A3znKMoy4vS1MaLdONSUua9bFXsgZ Dk15kypYmhbOqsSvU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=E3IX5h5qnvCz8HGQprpcP/99exWufWqBm6yXaaBUngM=; b=dUb6RLc6 goRF4oU2me2y93Lx0A+GoloOM7W7KSDwT20Gm3USDpyvX3XKV18x/96gCeFSZFcX ov07vSk2kVM1xc4DW1qXcBARJ3i3d7qEUBoOg0gRmY+dkA8ka/NzjSaFce9Syypn c1CAZS3mvozF8Gtgea7MkHkmw4ipKxoyQ+EB3ZgeE2MhuTA3YUgWNgR1lyOLURb8 sH2lyEuHqFlm86HTB3mNpN9A5Goy9yEFP9idcfnnuPN2S2/3b9UelTYXdWVXpcZE 5/1l1Gz20pPVAnHNJ+X1+KyqU8HeN87l9watSJzmglvKLEZRrXXc0x/Joc2kIJoc xCFVjZ3dkK6YNA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrfedugdeigeculddtuddrgedtkedrtddtmd cutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomhepvfhhohhmrghsucfoohhnjhgrlhhonhcuoehthhhomhgrshes mhhonhhjrghlohhnrdhnvghtqeenucfkphepjeejrddufeegrddvtdefrddukeegnecurf grrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtnecu vehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id D2D53E4394; Wed, 9 Jan 2019 09:23:23 -0500 (EST) From: Thomas Monjalon To: yskoh@mellanox.com, shahafs@mellanox.com Cc: dev@dpdk.org, ferruh.yigit@intel.com, bruce.richardson@intel.com Date: Wed, 9 Jan 2019 15:23:18 +0100 Message-Id: <20190109142319.15148-1-thomas@monjalon.net> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190109020524.3633-1-thomas@monjalon.net> References: <20190109020524.3633-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 1/2] config: gather options for dlopen mlx dependency X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Jan 2019 14:23:26 -0000 Rename options CONFIG_RTE_LIBRTE_MLX4_DLOPEN_DEPS and CONFIG_RTE_LIBRTE_MLX5_DLOPEN_DEPS to a single option CONFIG_RTE_IBVERBS_LINK_DLOPEN. Rename meson option enable_driver_mlx_glue to ibverbs_link. There was no good reason for setting a different link option for mlx4 and mlx5. Having a single common option makes it easier to understand and unify make and meson systems. Signed-off-by: Thomas Monjalon Acked-by: Shahaf Shuler --- v2: use "combo" option type (Bruce review) --- config/common_base | 7 +++++-- doc/guides/nics/mlx4.rst | 4 ++-- doc/guides/nics/mlx5.rst | 4 ++-- drivers/net/mlx4/Makefile | 8 ++++---- drivers/net/mlx4/meson.build | 4 ++-- drivers/net/mlx4/mlx4.c | 4 ++-- drivers/net/mlx5/Makefile | 8 ++++---- drivers/net/mlx5/meson.build | 4 ++-- drivers/net/mlx5/mlx5.c | 4 ++-- meson_options.txt | 4 ++-- mk/rte.app.mk | 15 +++++++-------- 11 files changed, 34 insertions(+), 32 deletions(-) diff --git a/config/common_base b/config/common_base index 964a6956e..37f692ce1 100644 --- a/config/common_base +++ b/config/common_base @@ -320,7 +320,6 @@ CONFIG_RTE_LIBRTE_AVF_16BYTE_RX_DESC=n # CONFIG_RTE_LIBRTE_MLX4_PMD=n CONFIG_RTE_LIBRTE_MLX4_DEBUG=n -CONFIG_RTE_LIBRTE_MLX4_DLOPEN_DEPS=n # # Compile burst-oriented Mellanox ConnectX-4, ConnectX-5, @@ -328,7 +327,11 @@ CONFIG_RTE_LIBRTE_MLX4_DLOPEN_DEPS=n # CONFIG_RTE_LIBRTE_MLX5_PMD=n CONFIG_RTE_LIBRTE_MLX5_DEBUG=n -CONFIG_RTE_LIBRTE_MLX5_DLOPEN_DEPS=n + +# 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. +CONFIG_RTE_IBVERBS_LINK_DLOPEN=n # # Compile burst-oriented Netronome NFP PMD driver diff --git a/doc/guides/nics/mlx4.rst b/doc/guides/nics/mlx4.rst index 5326d916e..88d467a23 100644 --- a/doc/guides/nics/mlx4.rst +++ b/doc/guides/nics/mlx4.rst @@ -60,7 +60,7 @@ These options can be modified in the ``.config`` file. Toggle compilation of librte_pmd_mlx4 itself. -- ``CONFIG_RTE_LIBRTE_MLX4_DLOPEN_DEPS`` (default **n**) +- ``CONFIG_RTE_IBVERBS_LINK_DLOPEN`` (default **n**) Build PMD with additional code to make it loadable without hard dependencies on **libibverbs** nor **libmlx4**, which may not be installed @@ -93,7 +93,7 @@ Environment variables 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`` + Only matters when compiled with ``CONFIG_RTE_IBVERBS_LINK_DLOPEN`` enabled and most useful when ``CONFIG_RTE_EAL_PMD_PATH`` is also set, since ``LD_LIBRARY_PATH`` has no effect in this case. diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst index add8bc1ed..749acd222 100644 --- a/doc/guides/nics/mlx5.rst +++ b/doc/guides/nics/mlx5.rst @@ -191,7 +191,7 @@ These options can be modified in the ``.config`` file. Toggle compilation of librte_pmd_mlx5 itself. -- ``CONFIG_RTE_LIBRTE_MLX5_DLOPEN_DEPS`` (default **n**) +- ``CONFIG_RTE_IBVERBS_LINK_DLOPEN`` (default **n**) Build PMD with additional code to make it loadable without hard dependencies on **libibverbs** nor **libmlx5**, which may not be installed @@ -224,7 +224,7 @@ Environment variables 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`` + Only matters when compiled with ``CONFIG_RTE_IBVERBS_LINK_DLOPEN`` enabled and most useful when ``CONFIG_RTE_EAL_PMD_PATH`` is also set, since ``LD_LIBRARY_PATH`` has no effect in this case. diff --git a/drivers/net/mlx4/Makefile b/drivers/net/mlx4/Makefile index 92e932250..724a4dcbc 100644 --- a/drivers/net/mlx4/Makefile +++ b/drivers/net/mlx4/Makefile @@ -14,7 +14,7 @@ LIB_GLUE_VERSION = 18.02.0 SRCS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4.c SRCS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4_ethdev.c SRCS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4_flow.c -ifneq ($(CONFIG_RTE_LIBRTE_MLX4_DLOPEN_DEPS),y) +ifneq ($(CONFIG_RTE_IBVERBS_LINK_DLOPEN),y) SRCS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4_glue.c endif SRCS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4_intr.c @@ -24,7 +24,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4_rxtx.c SRCS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4_txq.c SRCS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4_utils.c -ifeq ($(CONFIG_RTE_LIBRTE_MLX4_DLOPEN_DEPS),y) +ifeq ($(CONFIG_RTE_IBVERBS_LINK_DLOPEN),y) INSTALL-$(CONFIG_RTE_LIBRTE_MLX4_PMD)-lib += $(LIB_GLUE) endif @@ -38,7 +38,7 @@ CFLAGS += -D_DEFAULT_SOURCE CFLAGS += -D_XOPEN_SOURCE=600 CFLAGS += $(WERROR_FLAGS) CFLAGS += -DALLOW_EXPERIMENTAL_API -ifeq ($(CONFIG_RTE_LIBRTE_MLX4_DLOPEN_DEPS),y) +ifeq ($(CONFIG_RTE_IBVERBS_LINK_DLOPEN),y) CFLAGS += -DMLX4_GLUE='"$(LIB_GLUE)"' CFLAGS += -DMLX4_GLUE_VERSION='"$(LIB_GLUE_VERSION)"' CFLAGS_mlx4_glue.o += -fPIC @@ -103,7 +103,7 @@ $(SRCS-$(CONFIG_RTE_LIBRTE_MLX4_PMD):.c=.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) +ifeq ($(CONFIG_RTE_IBVERBS_LINK_DLOPEN),y) $(LIB): $(LIB_GLUE) diff --git a/drivers/net/mlx4/meson.build b/drivers/net/mlx4/meson.build index 7de571e2a..4bccd68e0 100644 --- a/drivers/net/mlx4/meson.build +++ b/drivers/net/mlx4/meson.build @@ -2,12 +2,12 @@ # Copyright 2018 6WIND S.A. # Copyright 2018 Mellanox Technologies, Ltd -pmd_dlopen = get_option('enable_driver_mlx_glue') +pmd_dlopen = (get_option('ibverbs_link') == 'dlopen') LIB_GLUE_BASE = 'librte_pmd_mlx4_glue.so' LIB_GLUE_VERSION = '18.02.0' LIB_GLUE = LIB_GLUE_BASE + '.' + LIB_GLUE_VERSION if pmd_dlopen - dpdk_conf.set('RTE_LIBRTE_MLX4_DLOPEN_DEPS', 1) + dpdk_conf.set('RTE_IBVERBS_LINK_DLOPEN', 1) cflags += [ '-DMLX4_GLUE="@0@"'.format(LIB_GLUE), '-DMLX4_GLUE_VERSION="@0@"'.format(LIB_GLUE_VERSION), diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index 7f07b8dc0..070cf7111 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -838,7 +838,7 @@ static struct rte_pci_driver mlx4_driver = { RTE_PCI_DRV_INTR_RMV, }; -#ifdef RTE_LIBRTE_MLX4_DLOPEN_DEPS +#ifdef RTE_IBVERBS_LINK_DLOPEN /** * Suffix RTE_EAL_PMD_PATH with "-glue". @@ -986,7 +986,7 @@ RTE_INIT(rte_mlx4_pmd_init) * using this PMD, which is not supported in forked processes. */ setenv("RDMAV_HUGEPAGES_SAFE", "1", 1); -#ifdef RTE_LIBRTE_MLX4_DLOPEN_DEPS +#ifdef RTE_IBVERBS_LINK_DLOPEN if (mlx4_glue_init()) return; assert(mlx4_glue); diff --git a/drivers/net/mlx5/Makefile b/drivers/net/mlx5/Makefile index 1353c1827..47a7f4d68 100644 --- a/drivers/net/mlx5/Makefile +++ b/drivers/net/mlx5/Makefile @@ -12,7 +12,7 @@ LIB_GLUE_VERSION = 19.02.0 # Sources. SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5.c -ifneq ($(CONFIG_RTE_LIBRTE_MLX5_DLOPEN_DEPS),y) +ifneq ($(CONFIG_RTE_IBVERBS_LINK_DLOPEN),y) SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_glue.c endif SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_rxq.c @@ -37,7 +37,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_flow_verbs.c SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_socket.c SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_nl.c -ifeq ($(CONFIG_RTE_LIBRTE_MLX5_DLOPEN_DEPS),y) +ifeq ($(CONFIG_RTE_IBVERBS_LINK_DLOPEN),y) INSTALL-$(CONFIG_RTE_LIBRTE_MLX5_PMD)-lib += $(LIB_GLUE) endif @@ -52,7 +52,7 @@ CFLAGS += -D_XOPEN_SOURCE=600 CFLAGS += $(WERROR_FLAGS) CFLAGS += -Wno-strict-prototypes CFLAGS += $(shell command -v pkg-config > /dev/null 2>&1 && pkg-config --cflags libmnl) -ifeq ($(CONFIG_RTE_LIBRTE_MLX5_DLOPEN_DEPS),y) +ifeq ($(CONFIG_RTE_IBVERBS_LINK_DLOPEN),y) CFLAGS += -DMLX5_GLUE='"$(LIB_GLUE)"' CFLAGS += -DMLX5_GLUE_VERSION='"$(LIB_GLUE_VERSION)"' CFLAGS_mlx5_glue.o += -fPIC @@ -525,7 +525,7 @@ $(SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD):.c=.o): mlx5_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_MLX5_DLOPEN_DEPS),y) +ifeq ($(CONFIG_RTE_IBVERBS_LINK_DLOPEN),y) $(LIB): $(LIB_GLUE) diff --git a/drivers/net/mlx5/meson.build b/drivers/net/mlx5/meson.build index 8ba19e818..a1130d610 100644 --- a/drivers/net/mlx5/meson.build +++ b/drivers/net/mlx5/meson.build @@ -2,12 +2,12 @@ # Copyright 2018 6WIND S.A. # Copyright 2018 Mellanox Technologies, Ltd -pmd_dlopen = get_option('enable_driver_mlx_glue') +pmd_dlopen = (get_option('ibverbs_link') == 'dlopen') LIB_GLUE_BASE = 'librte_pmd_mlx5_glue.so' LIB_GLUE_VERSION = '19.02.0' LIB_GLUE = LIB_GLUE_BASE + '.' + LIB_GLUE_VERSION if pmd_dlopen - dpdk_conf.set('RTE_LIBRTE_MLX5_DLOPEN_DEPS', 1) + dpdk_conf.set('RTE_IBVERBS_LINK_DLOPEN', 1) cflags += [ '-DMLX5_GLUE="@0@"'.format(LIB_GLUE), '-DMLX5_GLUE_VERSION="@0@"'.format(LIB_GLUE_VERSION), diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 45210451d..f111e6ef8 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -1609,7 +1609,7 @@ static struct rte_pci_driver mlx5_driver = { RTE_PCI_DRV_PROBE_AGAIN), }; -#ifdef RTE_LIBRTE_MLX5_DLOPEN_DEPS +#ifdef RTE_IBVERBS_LINK_DLOPEN /** * Suffix RTE_EAL_PMD_PATH with "-glue". @@ -1770,7 +1770,7 @@ RTE_INIT(rte_mlx5_pmd_init) * cleanup all the Verbs resources even when the device was removed. */ setenv("MLX5_DEVICE_FATAL_CLEANUP", "1", 1); -#ifdef RTE_LIBRTE_MLX5_DLOPEN_DEPS +#ifdef RTE_IBVERBS_LINK_DLOPEN if (mlx5_glue_init()) return; assert(mlx5_glue); diff --git a/meson_options.txt b/meson_options.txt index 10b541615..574054597 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -2,8 +2,8 @@ option('allow_invalid_socket_id', type: 'boolean', value: false, description: 'allow out-of-range NUMA socket id\'s for platforms that don\'t report the value correctly') option('drivers_install_subdir', type: 'string', value: 'dpdk/pmds-', description: 'Subdirectory of libdir where to install PMDs. Defaults to using a versioned subdirectory.') -option('enable_driver_mlx_glue', type: 'boolean', value: false, - description: 'Enable glue library for Mellanox PMDs') +option('ibverbs_link', type: 'combo', choices : ['shared', 'dlopen'], value: 'shared', + description: 'Linkage method (shared/dlopen) for Mellanox PMDs with ibverbs dependencies.') option('enable_kmods', type: 'boolean', value: true, description: 'build kernel modules') option('enable_docs', type: 'boolean', value: false, diff --git a/mk/rte.app.mk b/mk/rte.app.mk index 02e8b6f05..d5b1ec6b7 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -169,15 +169,14 @@ ifeq ($(CONFIG_RTE_LIBRTE_KNI),y) _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_KNI) += -lrte_pmd_kni endif _LDLIBS-$(CONFIG_RTE_LIBRTE_LIO_PMD) += -lrte_pmd_lio -ifeq ($(CONFIG_RTE_LIBRTE_MLX4_DLOPEN_DEPS),y) -_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += -lrte_pmd_mlx4 -ldl +_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += -lrte_pmd_mlx4 +_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += -lrte_pmd_mlx5 -lmnl +ifeq ($(CONFIG_RTE_IBVERBS_LINK_DLOPEN),y) +_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += -ldl +_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += -ldl else -_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += -lrte_pmd_mlx4 -libverbs -lmlx4 -endif -ifeq ($(CONFIG_RTE_LIBRTE_MLX5_DLOPEN_DEPS),y) -_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += -lrte_pmd_mlx5 -ldl -lmnl -else -_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += -lrte_pmd_mlx5 -libverbs -lmlx5 -lmnl +_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += -libverbs -lmlx4 +_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += -libverbs -lmlx5 endif _LDLIBS-$(CONFIG_RTE_LIBRTE_MVPP2_PMD) += -lrte_pmd_mvpp2 _LDLIBS-$(CONFIG_RTE_LIBRTE_MVNETA_PMD) += -lrte_pmd_mvneta -- 2.20.1