From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by dpdk.org (Postfix) with ESMTP id AF2441322C for ; Tue, 2 Jan 2018 15:07:20 +0100 (CET) Received: by mail-wm0-f68.google.com with SMTP id b76so61348328wmg.1 for ; Tue, 02 Jan 2018 06:07:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=bAsb2k3fu0ebksApyp6skPAxcsjjzCFFwbsshP+dHgc=; b=rVKO8WyPaD+mbazOWIgP907b+mJKb6vFkwd84YS9Kk3VCNgD0jwWs1O3B1SXFuEqHi zEmkncADxwsNylEmjtRY1zdJAe3+NqEChjKDRK2eYFCvo+VWNMotmdzzp7lVQtCNBa3T i/lKqPnpUzL4QmM6vBU7K1QSoMTA2uOX0tgAyG1SzIRIE9W9luv6ojS1tJhaWA0CsvRt 9Fo/GmAMID2QDnGmJGU76ugLeFOF7UPFrKUKc2VZhGM6018xLRFxa42OsaNPZNMZQUFr wwyPMVrJ1ps91hTdmT2cmInwKFQD9QSLto+XB3V9kxwrHzT+xx+7Wx2/uct8x4k2Pucm S5nA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=bAsb2k3fu0ebksApyp6skPAxcsjjzCFFwbsshP+dHgc=; b=JOrxzz9zdgpQgOooA1NxAf3+6twnAVD8Nw5UoxUSGcamI94IeMA7E4h8dTPgTpq97J hmToHiGmoS5sa//oxUqQZ8zCvu8vlP0zDl+BSwbmCOzyCQsxy7a2m3h7cdJ2R5wj01yd ZNesO9FusFz0bwoJ+HBv5ngLH+Za+hLAOiKM53Lj9CtuOT51iT6JEeSY2Qq2BaNYksF7 QM22PxU4cceCACawWeBwInuD5wzn+Q5bzl6fw280FDubGWkge/nWAKBpr2pd+H3/2xBc g3D2uHRD5AzylTzFwBEdHzjpIsetLohrp3xGv/FLqem5deQOd0cMcm6yfk0OubBYN/Ie woCw== X-Gm-Message-State: AKGB3mKFdHnOprx4TKCNmmUdX41MfkKW5RaUm/9t/qztzFJP11svVs1m 6jbA36t1/5VbOeIlU0Qkj1Mh X-Google-Smtp-Source: ACJfBot2GX7Tkh3aopOs+510fa9vCy4M9bnwy3r3wL7s+GAggPQ6rHgntvnV70lr/KhxkM91qr+rTg== X-Received: by 10.28.107.211 with SMTP id a80mr35274784wmi.71.1514902040304; Tue, 02 Jan 2018 06:07:20 -0800 (PST) Received: from laranjeiro-vm.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id y42sm65931803wrc.96.2018.01.02.06.07.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 02 Jan 2018 06:07:19 -0800 (PST) Date: Tue, 2 Jan 2018 15:06:31 +0100 From: Nelio Laranjeiro To: Shachar Beiser Cc: dev@dpdk.org, Adrien Mazarguil Message-ID: <20180102140631.t3o3uhdovl7jlasy@laranjeiro-vm.dev.6wind.com> References: <37757d5cfe32610ef1c7a17d72ea6bc1466023de.1511450393.git.shacharbe@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [dpdk-dev] [PATCH v4] net/mlx5: load libmlx5 and libibverbs in run-time 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: Tue, 02 Jan 2018 14:07:20 -0000 Hi Shachar, Please see small comment bellow, On Sun, Dec 31, 2017 at 07:52:51AM +0000, Shachar Beiser wrote: > MLX5 PMD loads libraries: libibverbs and libmlx5. > MLX5 PMD is not linked to external libraries. > > Signed-off-by: Shachar Beiser > --- > v1: > load external libraries in run-time > v2: > * fix checkpatch warnings > v3: > * fix checkpatch warnings > v4: > New MACROs in order to reuse code > --- > config/common_base | 1 + > drivers/net/mlx5/Makefile | 22 ++- > drivers/net/mlx5/lib/mlx5_dll.c | 294 +++++++++++++++++++++++++++++++++++++++ > drivers/net/mlx5/lib/mlx5_dll.h | 103 ++++++++++++++ > drivers/net/mlx5/mlx5.c | 17 ++- > drivers/net/mlx5/mlx5.h | 4 + > drivers/net/mlx5/mlx5_flow.c | 4 + > drivers/net/mlx5/mlx5_mac.c | 4 + > drivers/net/mlx5/mlx5_mr.c | 4 + > drivers/net/mlx5/mlx5_rss.c | 4 + > drivers/net/mlx5/mlx5_rxmode.c | 4 + > drivers/net/mlx5/mlx5_rxq.c | 4 + > drivers/net/mlx5/mlx5_rxtx.c | 4 + > drivers/net/mlx5/mlx5_rxtx.h | 6 +- > drivers/net/mlx5/mlx5_rxtx_vec.c | 4 + > drivers/net/mlx5/mlx5_txq.c | 4 + > mk/rte.app.mk | 8 +- > 17 files changed, 479 insertions(+), 12 deletions(-) > create mode 100644 drivers/net/mlx5/lib/mlx5_dll.c > create mode 100644 drivers/net/mlx5/lib/mlx5_dll.h > > diff --git a/config/common_base b/config/common_base > index b8ee8f9..30c8fcf 100644 > --- a/config/common_base > +++ b/config/common_base > @@ -236,6 +236,7 @@ CONFIG_RTE_LIBRTE_MLX4_TX_MP_CACHE=8 > # Compile burst-oriented Mellanox ConnectX-4 & ConnectX-5 (MLX5) PMD > # > CONFIG_RTE_LIBRTE_MLX5_PMD=n > +CONFIG_RTE_LIBRTE_MLX5_DLL=y > CONFIG_RTE_LIBRTE_MLX5_DEBUG=n > CONFIG_RTE_LIBRTE_MLX5_TX_MP_CACHE=8 Not sure a new configuration item is allowed. If it is, the documentation of such variable is missing. > diff --git a/drivers/net/mlx5/Makefile b/drivers/net/mlx5/Makefile > index a3984eb..24fa127 100644 > --- a/drivers/net/mlx5/Makefile > +++ b/drivers/net/mlx5/Makefile > @@ -53,18 +53,25 @@ SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_rss.c > SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_mr.c > SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_flow.c > SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_socket.c > - > +ifeq ($(CONFIG_RTE_LIBRTE_MLX5_DLL),y) > +SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += lib/mlx5_dll.c > +endif > # Basic CFLAGS. > CFLAGS += -O3 > CFLAGS += -std=c11 -Wall -Wextra > CFLAGS += -g > CFLAGS += -I. > +CFLAGS += -I$(SRCDIR) > CFLAGS += -D_BSD_SOURCE > CFLAGS += -D_DEFAULT_SOURCE > CFLAGS += -D_XOPEN_SOURCE=600 > CFLAGS += $(WERROR_FLAGS) > CFLAGS += -Wno-strict-prototypes > +ifeq ($(CONFIG_RTE_LIBRTE_MLX5_DLL),y) > +LDLIBS += -ldl > +else > LDLIBS += -libverbs -lmlx5 > +endif > LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring > LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs > LDLIBS += -lrte_bus_pci > @@ -105,26 +112,28 @@ endif > > mlx5_autoconf.h.new: FORCE > > +VERBS_H := infiniband/verbs.h > +MLX5DV_H := infiniband/mlx5dv.h > mlx5_autoconf.h.new: $(RTE_SDK)/buildtools/auto-config-h.sh > $Q $(RM) -f -- '$@' > $Q sh -- '$<' '$@' \ > HAVE_IBV_DEVICE_VXLAN_SUPPORT \ > - infiniband/verbs.h \ > + $(VERBS_H) \ > enum IBV_DEVICE_VXLAN_SUPPORT \ > $(AUTOCONF_OUTPUT) > $Q sh -- '$<' '$@' \ > HAVE_IBV_WQ_FLAG_RX_END_PADDING \ > - infiniband/verbs.h \ > + $(VERBS_H) \ > enum IBV_WQ_FLAG_RX_END_PADDING \ > $(AUTOCONF_OUTPUT) > $Q sh -- '$<' '$@' \ > HAVE_IBV_MLX5_MOD_MPW \ > - infiniband/mlx5dv.h \ > + $(MLX5DV_H) \ > enum MLX5DV_CONTEXT_FLAGS_MPW_ALLOWED \ > $(AUTOCONF_OUTPUT) > $Q sh -- '$<' '$@' \ > HAVE_IBV_MLX5_MOD_CQE_128B_COMP \ > - infiniband/mlx5dv.h \ > + $(MLX5DV_H) \ > enum MLX5DV_CONTEXT_FLAGS_CQE_128B_COMP \ > $(AUTOCONF_OUTPUT) > $Q sh -- '$<' '$@' \ > @@ -144,10 +153,9 @@ mlx5_autoconf.h.new: $(RTE_SDK)/buildtools/auto-config-h.sh > $(AUTOCONF_OUTPUT) > $Q sh -- '$<' '$@' \ > HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT \ > - infiniband/verbs.h \ > + $(VERBS_H) \ > enum IBV_FLOW_SPEC_ACTION_COUNT \ > $(AUTOCONF_OUTPUT) This modification should be inside its own patch, it is not directly related to the this patch itself. > - > # Create mlx5_autoconf.h or update it in case it differs from the new one. > > mlx5_autoconf.h: mlx5_autoconf.h.new > diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c > index cd66fe1..eeef782 100644 > --- a/drivers/net/mlx5/mlx5.c > +++ b/drivers/net/mlx5/mlx5.c > @@ -30,7 +30,8 @@ > * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE > * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > */ > - > +#define _GNU_SOURCE > +#include > #include > #include > #include > @@ -39,13 +40,17 @@ > #include > #include > #include > - > +#include The empty line should remain. > /* Verbs header. */ > /* ISO C doesn't support unnamed structs/unions, disabling -pedantic. */ > #ifdef PEDANTIC > #pragma GCC diagnostic ignored "-Wpedantic" > #endif > +#ifdef RTE_LIBRTE_MLX5_DLL > +#include "lib/mlx5_dll.h" > +#else > #include > +#endif This could be done by the mlx5_dll.h file which could include the correct header according to the configuration. > diff --git a/mk/rte.app.mk b/mk/rte.app.mk > index 6a6a745..2dd2f6b 100644 > --- a/mk/rte.app.mk > +++ b/mk/rte.app.mk > @@ -51,7 +51,9 @@ endif > > # Link only the libraries used in the application > LDFLAGS += --as-needed > - > +ifeq ($(CONFIG_RTE_LIBRTE_MLX5_DLL),y) > +LDFLAGS += -ldl > +endif > # default path for libs > _LDLIBS-y += -L$(RTE_SDK_BIN)/lib > > @@ -142,7 +144,11 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_KNI) += -lrte_pmd_kni > endif > _LDLIBS-$(CONFIG_RTE_LIBRTE_LIO_PMD) += -lrte_pmd_lio > _LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += -lrte_pmd_mlx4 -libverbs -lmlx4 > +ifeq ($(CONFIG_RTE_LIBRTE_MLX5_DLL),y) > +_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += -lrte_pmd_mlx5 -ldl > +else > _LDLIBS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += -lrte_pmd_mlx5 -libverbs -lmlx5 > +endif > _LDLIBS-$(CONFIG_RTE_LIBRTE_MRVL_PMD) += -lrte_pmd_mrvl -L$(LIBMUSDK_PATH)/lib -lmusdk > _LDLIBS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += -lrte_pmd_nfp > _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += -lrte_pmd_null > -- > 1.8.3.1 > Thanks, -- Nélio Laranjeiro 6WIND