From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30061.outbound.protection.outlook.com [40.107.3.61]) by dpdk.org (Postfix) with ESMTP id B4E2C1B1D6 for ; Wed, 3 Jan 2018 16:00:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=07S7J8NcYdsghntK7wsUQQUd+aOMgWFp4UOuJGMr7xQ=; b=cHR/vYyTo6fEIS4AYH+Xb+pUVceedTPXLMIC589Lp69Pnb3op4qH/+8a183MZbyJ/ZXtRk1pu7MfJHc68mci3AopslMzvnysQqcNu5o/UbXZ09J2IW/kBsnOF4V9ACR0b7/Fvdrx+iFKFVNh7FhHpYDc4HtqqWR5mrm7lcW4GLc= Received: from AM6PR0502MB3640.eurprd05.prod.outlook.com (52.133.20.141) by AM6PR0502MB3638.eurprd05.prod.outlook.com (52.133.20.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.366.8; Wed, 3 Jan 2018 15:00:51 +0000 Received: from AM6PR0502MB3640.eurprd05.prod.outlook.com ([fe80::313b:aa22:94e3:cfa4]) by AM6PR0502MB3640.eurprd05.prod.outlook.com ([fe80::313b:aa22:94e3:cfa4%13]) with mapi id 15.20.0366.009; Wed, 3 Jan 2018 15:00:51 +0000 From: Shachar Beiser To: =?iso-8859-1?Q?N=E9lio_Laranjeiro?= CC: "dev@dpdk.org" , Adrien Mazarguil Thread-Topic: [PATCH v4] net/mlx5: load libmlx5 and libibverbs in run-time Thread-Index: AQHTggxmyS7mr8h1wkeIKVYr2IY576Ngoa6AgAGeaaA= Date: Wed, 3 Jan 2018 15:00:46 +0000 Message-ID: References: <37757d5cfe32610ef1c7a17d72ea6bc1466023de.1511450393.git.shacharbe@mellanox.com> <20180102140631.t3o3uhdovl7jlasy@laranjeiro-vm.dev.6wind.com> In-Reply-To: <20180102140631.t3o3uhdovl7jlasy@laranjeiro-vm.dev.6wind.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=shacharbe@mellanox.com; x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM6PR0502MB3638; 7:yohhsfa6hQvNnIUtC7lo8qQynYwSDqlib3EDQmBDdsSePei8IwX1CKegt2OV0PPWk5ye1fyN3+QlsMRdMndIuxIHuXbqiqtixhkL243Yem4/GV3IPBbFmHrRlvxvMaURl326KE3ASP7gP4FlxG8oVKOXkefo+7V6+BxcI/sa2mt3gyoyc122Sn7dGG3Fo2suYDXUgXsRSfAJ3S4h2zVEIU89hhnlx5zFDmnobHvl6UuGv11hMrggvZCif88Xxfis x-ms-office365-filtering-correlation-id: 82482f57-6f73-4838-1a50-08d552bac7db x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(3008032)(48565401081)(2017052603307)(7153060); SRVR:AM6PR0502MB3638; x-ms-traffictypediagnostic: AM6PR0502MB3638: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(17755550239193); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(3002001)(3231023)(944501075)(10201501046)(93006095)(93001095)(6055026)(6041268)(20161123558120)(20161123560045)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:AM6PR0502MB3638; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:AM6PR0502MB3638; x-forefront-prvs: 0541031FF6 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(346002)(396003)(376002)(366004)(39380400002)(199004)(24454002)(189003)(13464003)(2900100001)(81166006)(105586002)(66066001)(99286004)(81156014)(8676002)(33656002)(68736007)(14454004)(86362001)(5250100002)(8936002)(106356001)(3280700002)(4326008)(25786009)(3660700001)(7696005)(6246003)(2906002)(97736004)(53936002)(6666003)(478600001)(59450400001)(76176011)(6916009)(54906003)(7736002)(5660300001)(2950100002)(316002)(74316002)(3846002)(6116002)(305945005)(6506007)(53546011)(102836004)(229853002)(6436002)(55016002)(9686003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR0502MB3638; H:AM6PR0502MB3640.eurprd05.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: /O+Df6A625Hg4dAG7dfBbUym6FB8ZhB70CeSGRMJpBcvqnICUOAZx1EZLjdVP/yak//aoEQCfouGZeAiSRC43w== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 82482f57-6f73-4838-1a50-08d552bac7db X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Jan 2018 15:00:49.2587 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0502MB3638 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: Wed, 03 Jan 2018 15:00:52 -0000 > -----Original Message----- > From: Nelio Laranjeiro [mailto:nelio.laranjeiro@6wind.com] > Sent: Tuesday, January 2, 2018 4:07 PM > To: Shachar Beiser > Cc: dev@dpdk.org; Adrien Mazarguil > Subject: Re: [PATCH v4] net/mlx5: load libmlx5 and libibverbs in run-time >=20 > Hi Shachar, >=20 > Please see small comment bellow, >=20 > 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=3D8 > > # Compile burst-oriented Mellanox ConnectX-4 & ConnectX-5 (MLX5) PMD > > # CONFIG_RTE_LIBRTE_MLX5_PMD=3Dn > > +CONFIG_RTE_LIBRTE_MLX5_DLL=3Dy > > CONFIG_RTE_LIBRTE_MLX5_DEBUG=3Dn > > CONFIG_RTE_LIBRTE_MLX5_TX_MP_CACHE=3D8 >=20 > Not sure a new configuration item is allowed. If it is, the documentatio= n of > such variable is missing. [S.B] The patch is based on this CONFIG_RTE_LIBRTE_MLX5_DLL , it was requir= ed by Adrian in the design phase to enable/disable this linkage mode. I will update the documentation . >=20 > > 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) +=3D > mlx5_rss.c > > SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) +=3D mlx5_mr.c > > SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) +=3D mlx5_flow.c > > SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) +=3D mlx5_socket.c > > - > > +ifeq ($(CONFIG_RTE_LIBRTE_MLX5_DLL),y) > > +SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) +=3D lib/mlx5_dll.c endif > > # Basic CFLAGS. > > CFLAGS +=3D -O3 > > CFLAGS +=3D -std=3Dc11 -Wall -Wextra > > CFLAGS +=3D -g > > CFLAGS +=3D -I. > > +CFLAGS +=3D -I$(SRCDIR) > > CFLAGS +=3D -D_BSD_SOURCE > > CFLAGS +=3D -D_DEFAULT_SOURCE > > CFLAGS +=3D -D_XOPEN_SOURCE=3D600 > > CFLAGS +=3D $(WERROR_FLAGS) > > CFLAGS +=3D -Wno-strict-prototypes > > +ifeq ($(CONFIG_RTE_LIBRTE_MLX5_DLL),y) LDLIBS +=3D -ldl else > > LDLIBS +=3D -libverbs -lmlx5 > > +endif > > LDLIBS +=3D -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring LDLIBS +=3D > > -lrte_ethdev -lrte_net -lrte_kvargs LDLIBS +=3D -lrte_bus_pci @@ > > -105,26 +112,28 @@ endif > > > > mlx5_autoconf.h.new: FORCE > > > > +VERBS_H :=3D infiniband/verbs.h > > +MLX5DV_H :=3D 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) >=20 > This modification should be inside its own patch, it is not directly rela= ted to > the this patch itself. [S.B] I can revert the VERBS_H , MLX5DV_H and not change it all .=20 There is no need to change in a different patch.=20 >=20 > > - > > # 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 >=20 > The empty line should remain. [S.B] OK. >=20 > > /* 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 >=20 > This could be done by the mlx5_dll.h file which could include the correct > header according to the configuration. [S.B] I guess you refer to all *.c files that includes the verbs.h . I will change them all ?=20 >=20 > > > 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 +=3D > > --as-needed > > - > > +ifeq ($(CONFIG_RTE_LIBRTE_MLX5_DLL),y) LDFLAGS +=3D -ldl endif > > # default path for libs > > _LDLIBS-y +=3D -L$(RTE_SDK_BIN)/lib > > > > @@ -142,7 +144,11 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_KNI) +=3D > -lrte_pmd_kni > > endif > > _LDLIBS-$(CONFIG_RTE_LIBRTE_LIO_PMD) +=3D -lrte_pmd_lio > > _LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) +=3D -lrte_pmd_mlx4 - > libverbs -lmlx4 > > +ifeq ($(CONFIG_RTE_LIBRTE_MLX5_DLL),y) > > +_LDLIBS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) +=3D -lrte_pmd_mlx5 -ldl > > +else > > _LDLIBS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) +=3D -lrte_pmd_mlx5 - > libverbs -lmlx5 > > +endif > > _LDLIBS-$(CONFIG_RTE_LIBRTE_MRVL_PMD) +=3D -lrte_pmd_mrvl - > L$(LIBMUSDK_PATH)/lib -lmusdk > > _LDLIBS-$(CONFIG_RTE_LIBRTE_NFP_PMD) +=3D -lrte_pmd_nfp > > _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL) +=3D -lrte_pmd_null > > -- > > 1.8.3.1 > > >=20 > Thanks, >=20 > -- > N=E9lio Laranjeiro > 6WIND