From patchwork Fri Oct 30 17:44:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82975 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0899CA04E6; Fri, 30 Oct 2020 18:45:11 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A445D2E8B; Fri, 30 Oct 2020 18:44:55 +0100 (CET) Received: from new2-smtp.messagingengine.com (new2-smtp.messagingengine.com [66.111.4.224]) by dpdk.org (Postfix) with ESMTP id A1C732BD3 for ; Fri, 30 Oct 2020 18:44:50 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailnew.nyi.internal (Postfix) with ESMTP id 4FD01580844; Fri, 30 Oct 2020 13:44:49 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 30 Oct 2020 13:44:49 -0400 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=fm2; bh=G13Alg8crF9pU n5EeXzX58GxbnYD/rTRoYepF3qyh5g=; b=NFFQaZLIfd5f6Eu32uIoFJMGCMzRX uA/LAeCIWLDVdardN+gEX2cYUDb2SkOXYVlxIGp0LnH7Za9zDcCtJRR4A7h4vYhX jo4muVYAr6nxdLsqgOqqwLWuqJrGbo3erw8hvJjF6XOUv1Kt1/kt3lRevFwIUQDY yIf7Zuqo6dj3LS1LQNaajXpW5H1ANhrg5LC3/R8QLtAYjF/+CQzbmEEZjK/+MfgY +a5dRnb0GExZbzbrYeMFYRnoCd1KPsmxysKaS8JQk35/dzPKEgcWJOXJNnGDODsy NFdAdKZi542jufx1F8JoM8yEO6f8GgD1rtF+7Wjz2/JXhdWCPZZsnbgiA== 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=G13Alg8crF9pUn5EeXzX58GxbnYD/rTRoYepF3qyh5g=; b=e0HH3dvJ deyy+iqc9EtwxLDv0ifKjZWIf0C08eYkrgYvjE9NF5G22Zie5Lyic5r0b9LwxDEo cFLtsxCuQJ/fhSXNk0Y5R6H4Xk0pwZUBvx/v211L0kpwfWpSGd/rpwa3h2+yGOKQ Nnrk2/jceLcDqXeraB+ewDCs4pnN9YDdpfpWir8YO3hoi34ZeUjaCrMyzsK/fv2f deAqNBbBaDqlKNrB80Pd64kWa9RaYUzP95APdh763tv0nnkqCub0oZnfA/HHq7q3 iOuYsxnj5gyh9ww/v6mFRkCj08hZPxM/wWfF14h/tjrTOmUneR3d9pGVs3Osz70j bc44V+p1UnllXA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrleehgdellecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho nhdrnhgvth 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 DB1F03064610; Fri, 30 Oct 2020 13:44:47 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@intel.com, david.marchand@redhat.com, bruce.richardson@intel.com, olivier.matz@6wind.com, andrew.rybchenko@oktetlabs.ru, akhil.goyal@nxp.com, jerinj@marvell.com, Nicolas Chautru , Chas Williams , "Min Hu (Connor)" Date: Fri, 30 Oct 2020 18:44:27 +0100 Message-Id: <20201030174441.1076264-2-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201030174441.1076264-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201030174441.1076264-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v6 01/15] examples: enclose DPDK includes with angle brackets 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" In examples, DPDK header files are external, so they must be enclosed with angle brackets, not quotes. Signed-off-by: Thomas Monjalon Acked-by: Andrew Rybchenko Acked-by: Bruce Richardson --- examples/bbdev_app/main.c | 30 +++++++++++++++--------------- examples/bond/main.c | 11 ++++------- 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c index 43fe631760..e512c807cd 100644 --- a/examples/bbdev_app/main.c +++ b/examples/bbdev_app/main.c @@ -18,21 +18,21 @@ #include #include -#include "rte_atomic.h" -#include "rte_common.h" -#include "rte_eal.h" -#include "rte_cycles.h" -#include "rte_ether.h" -#include "rte_ethdev.h" -#include "rte_ip.h" -#include "rte_lcore.h" -#include "rte_malloc.h" -#include "rte_mbuf.h" -#include "rte_memory.h" -#include "rte_mempool.h" -#include "rte_log.h" -#include "rte_bbdev.h" -#include "rte_bbdev_op.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* LLR values - negative value for '1' bit */ #define LLR_1_BIT 0x81 diff --git a/examples/bond/main.c b/examples/bond/main.c index 398553b785..81a6fa976b 100644 --- a/examples/bond/main.c +++ b/examples/bond/main.c @@ -41,6 +41,10 @@ #include #include #include +#include +#include +#include +#include #include #include @@ -53,13 +57,6 @@ #include "main.h" -#include - - -#include "rte_byteorder.h" -#include "rte_cpuflags.h" -#include "rte_eth_bond.h" - #define RTE_LOGTYPE_DCB RTE_LOGTYPE_USER1 #define NB_MBUF (1024*8) From patchwork Fri Oct 30 17:44:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82976 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0360AA04E6; Fri, 30 Oct 2020 18:45:31 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 61E8A3421; Fri, 30 Oct 2020 18:44:57 +0100 (CET) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id 520812C2D for ; Fri, 30 Oct 2020 18:44:52 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 083DC5C01A3; Fri, 30 Oct 2020 13:44:51 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 30 Oct 2020 13:44:51 -0400 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=fm2; bh=SLQHZ4oISK+Ea ZcBn6REcBRcuC4K9L09BvwFbP5o2+Q=; b=ZcHVAJIVRW/01iSAS9BlFfsAbIXET 7vrXTMZqF+pSOqjXCNtPsZRoRGUxLwv00Hg4CC37Bv5dj/6X7P2N81qb3Oci6ll9 S6MFqWbJZgyaxi9pnjaE4Bl7U2VJ3iNL9DKHsxdeyIJtERd7avIYeQFEpNK2KULS Bkqe0xf2FbjdUIbIjPFBoavKWqR19/DJvjayuHj0g0McjFSpTm/6NoB/XAlK4GKK p7U4CZqrvp+Gd9ZXuHcVbbEJnOBoZqT1EsTXZ6+PQ5V+eA2yVvNr4PKAsOc78Esz oGDsGbh/ybwdvBgtvzad299m36SCrEC8Cz7J6ZnZA+P2K23juLHOcl9rQ== 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=SLQHZ4oISK+EaZcBn6REcBRcuC4K9L09BvwFbP5o2+Q=; b=OS/1MQWC O1Cf021iuXtHTcjPti1MaVN00z4TK5TaHBHvwDVfeTzUF/FAx+QMSfBbThOo/Kd7 Ufh2wSE9gcupD4tRGG4oBUFOsGmyD8ySyruOVdjAsLVDg/tHEjQ+OHffscSlWveA V6jbaxNXYueUOAB+3NKgZpATr1Ga7gQOlNloYawjikmBgksPB4bLz+Yegbz4iN3Z pDe/2zOUKk6qbe0Te1vw/LjVly1RgYyR+vqIiuUZEm8oixu6qIwSPMNkuLN0pt5p xs8LLiIybkalVooZrRuf5NG5IKR5TUIki9T1kemNQKavpvTVImZ6ahj7dOzWPcJf R4oCSWZTbZBTdw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrleehgdellecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpefvhhhomhgrshcuofhonhhjrghlohhnuceothhhohhmrghssehm ohhnjhgrlhhonhdrnhgvtheqnecuggftrfgrthhtvghrnhepvdehgfeivdejgedtveehfe fhteelfefgieevgfffveefjeegtdfguedthedtgeevnecukfhppeejjedrudefgedrvddt fedrudekgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehthhhomhgrshesmhhonhhjrghlohhnrdhnvght 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 F01B3306467E; Fri, 30 Oct 2020 13:44:49 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@intel.com, david.marchand@redhat.com, bruce.richardson@intel.com, olivier.matz@6wind.com, andrew.rybchenko@oktetlabs.ru, akhil.goyal@nxp.com, jerinj@marvell.com Date: Fri, 30 Oct 2020 18:44:28 +0100 Message-Id: <20201030174441.1076264-3-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201030174441.1076264-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201030174441.1076264-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v6 02/15] kni: move header file from EAL 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Since the kernel module is not part of EAL anymore, there is no need to have the common KNI header file in EAL. The file rte_kni_common.h is moved to librte_kni. Signed-off-by: Thomas Monjalon Acked-by: Andrew Rybchenko Acked-by: Bruce Richardson --- kernel/linux/kni/meson.build | 2 +- lib/librte_eal/linux/include/meson.build | 1 - lib/librte_kni/meson.build | 2 +- lib/{librte_eal/linux/include => librte_kni}/rte_kni_common.h | 0 4 files changed, 2 insertions(+), 3 deletions(-) rename lib/{librte_eal/linux/include => librte_kni}/rte_kni_common.h (100%) diff --git a/kernel/linux/kni/meson.build b/kernel/linux/kni/meson.build index d696347f22..07e0c9dae7 100644 --- a/kernel/linux/kni/meson.build +++ b/kernel/linux/kni/meson.build @@ -18,7 +18,7 @@ custom_target('rte_kni', 'src=' + meson.current_source_dir(), 'MODULE_CFLAGS=-include ' + meson.source_root() + '/config/rte_config.h' + ' -I' + meson.source_root() + '/lib/librte_eal/include' + - ' -I' + meson.source_root() + '/lib/librte_eal/linux/include' + + ' -I' + meson.source_root() + '/lib/librte_kni' + ' -I' + meson.build_root() + ' -I' + meson.current_source_dir(), 'modules'], diff --git a/lib/librte_eal/linux/include/meson.build b/lib/librte_eal/linux/include/meson.build index 1241894b3c..7d18dd52f1 100644 --- a/lib/librte_eal/linux/include/meson.build +++ b/lib/librte_eal/linux/include/meson.build @@ -4,6 +4,5 @@ includes += include_directories('.') headers += files( - 'rte_kni_common.h', 'rte_os.h', ) diff --git a/lib/librte_kni/meson.build b/lib/librte_kni/meson.build index 963eae6fe0..ad598bb3d0 100644 --- a/lib/librte_kni/meson.build +++ b/lib/librte_kni/meson.build @@ -6,5 +6,5 @@ if not is_linux or not dpdk_conf.get('RTE_ARCH_64') reason = 'only supported on 64-bit linux' endif sources = files('rte_kni.c') -headers = files('rte_kni.h') +headers = files('rte_kni.h', 'rte_kni_common.h') deps += ['ethdev', 'pci'] diff --git a/lib/librte_eal/linux/include/rte_kni_common.h b/lib/librte_kni/rte_kni_common.h similarity index 100% rename from lib/librte_eal/linux/include/rte_kni_common.h rename to lib/librte_kni/rte_kni_common.h From patchwork Fri Oct 30 17:44:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82977 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 13883A04E6; Fri, 30 Oct 2020 18:45:51 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 287B34C87; Fri, 30 Oct 2020 18:45:04 +0100 (CET) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id 53F4A2C2D; Fri, 30 Oct 2020 18:44:54 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 0978D5C021F; Fri, 30 Oct 2020 13:44:53 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 30 Oct 2020 13:44:53 -0400 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=fm2; bh=rrwCap5BZSoHK 2YcU5LKb5C1tJv9i5GLPlZsCf345kw=; b=jm+zAKPklmYGwAaMfBoj+BxIzvrDc JN+Hn/ZtFMNVd7IvZ4SjkYgb/XRSViMUFNFxkQCA1eF9UebThVhwJtfH/8r0UFuO s+NOybIRzoXzyMAdgSAGJEZY+dMo8gqg2nSSE9+XTbyMVklWlnz/2kI7eepMquFa FfhSBR8OE+98Ij53HJD4D/tNVx2NLhXMpehiBgmo0mtiJetAqT1aRPJuSGP7Ga+V bMP9zmSwII7bqxzF7/rY1wrVUW6kd1Vdle+ewM1Fs6DzOf0fJSgruA8ERjFWrMso VAKCnx4GUufgZnkVow6wMEMlz9uR2mPhWl9kWY7vO3O/eTCP55MW/2QIw== 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=rrwCap5BZSoHK2YcU5LKb5C1tJv9i5GLPlZsCf345kw=; b=TfwtYhzB QncpuMjd1n4Swv22ml/npF8JOPmZJbHYaxG9pRiI2FGzrCv01T+Cum8wQUqM6q4t SeB22gXouL3BHAfl4vQbhZ5Vx+8OaxM97qDrJeYc0809LMkANIeHiprgP7o78B+J CIrjj4O3vYkI1hltayWx7rvLpf6BgjNNXOjXOtb4J8V5uXXSJAwPMoMABd/sV/lN daOilXJlqBLeDikKTZ5njBXAwgpY1C8ynE/N+NvrRcpp+DIbEDowWRJGW5ukdJ0T QJBvw1hEuvNuhptpX27Hs+b82nb64pEU8fhSD0kTNygTn0E1SSUqR7ie5gu+cpuk aj06JiACft+fKw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrleehgdellecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho nhdrnhgvth 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 C1F7C306467E; Fri, 30 Oct 2020 13:44:51 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@intel.com, david.marchand@redhat.com, bruce.richardson@intel.com, olivier.matz@6wind.com, andrew.rybchenko@oktetlabs.ru, akhil.goyal@nxp.com, jerinj@marvell.com, stable@dpdk.org, Konstantin Ananyev Date: Fri, 30 Oct 2020 18:44:29 +0100 Message-Id: <20201030174441.1076264-4-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201030174441.1076264-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201030174441.1076264-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v6 03/15] mbuf: fix typo in dynamic field convention note 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Replace "in a in PMD" with "in a PMD". Fixes: 4958ca3a443a ("mbuf: support dynamic fields and flags") Cc: stable@dpdk.org Signed-off-by: Thomas Monjalon Acked-by: Andrew Rybchenko --- lib/librte_mbuf/rte_mbuf_dyn.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_mbuf/rte_mbuf_dyn.h b/lib/librte_mbuf/rte_mbuf_dyn.h index 8407230ecf..0ebac88b83 100644 --- a/lib/librte_mbuf/rte_mbuf_dyn.h +++ b/lib/librte_mbuf/rte_mbuf_dyn.h @@ -62,7 +62,7 @@ * conventions than function names in dpdk: * - "rte_mbuf_dynfield_" if defined in mbuf library * - "rte__dynfield_" if defined in another library - * - "rte_net__dynfield_" if defined in a in PMD + * - "rte_net__dynfield_" if defined in a PMD * - any name that does not start with "rte_" in an application */ From patchwork Fri Oct 30 17:44:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82978 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0E89EA04E6; Fri, 30 Oct 2020 18:46:14 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A39F34C97; Fri, 30 Oct 2020 18:45:05 +0100 (CET) Received: from new2-smtp.messagingengine.com (new2-smtp.messagingengine.com [66.111.4.224]) by dpdk.org (Postfix) with ESMTP id 82DFA3253 for ; Fri, 30 Oct 2020 18:44:55 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailnew.nyi.internal (Postfix) with ESMTP id 39D02580851; Fri, 30 Oct 2020 13:44:55 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 30 Oct 2020 13:44:55 -0400 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=fm2; bh=b2/UgouepwNuH akdJkmPqZDAY7jia25Ie/3cISWNZ/4=; b=YDcs40rbY/4j41FqAJsz7q/eUs4HN 1JO1k/5s85bikxoT2xKMtxrwXMwQbrb9gXpoMWh157racg5E3fHImfaBqvQMQz1z 1pZukFBn2GycevQ8qn380AXkkGHMeLiRcGe5kQHftiWeSmizdTtmHHPgmXbHHZsN 8yMi155vz0iLehuWTogJq/EIRfPhujBCuAGBNB7EvURdcxczSuC5o60fbyYB6vwQ 3qfSeC/seguxrkoUq+n7xvD9aAnvQtVCmkW/HXlO0+bxI10l1SDdu8gFbDsy4S8V eZXtDF3VksT0JOiqSbFQedn3AVmxce3+PDM7CioqiInyGNFLkaeEANQvA== 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=b2/UgouepwNuHakdJkmPqZDAY7jia25Ie/3cISWNZ/4=; b=NAAMGIQo 6sQYPax0NA3TBh7iA20/1qFDK1MOLl1XEzum2OraW4F95pOynRmRDddHt612S6SE j3r/7tn14QtiNYDF9GHYL6e79PyFWmuWF6AWRZ7hnFo4AkI/T4o4tIc+4bagUR+L lM1Mhh4y55Erq8NsaYu7v3JvQmMQdFgMRJROadYHUrIZ51n3odC7BKfDJUSaIkP1 utcuKPjYiTTyf8kWQ0qxi0xmdHfFKmH6AcPyDTD7skGcpuC4dbMfXerTAdntjTH2 XONR0Slg44Qo4b7yKKpDVwoe5SN+lYVGyxSV+YVBr6Gt7kvHOhu7fts68aK96nti xzqyYWa1P+XjvQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrleehgdellecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgepfeenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho nhdrnhgvth 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 B8D133064610; Fri, 30 Oct 2020 13:44:53 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@intel.com, david.marchand@redhat.com, bruce.richardson@intel.com, olivier.matz@6wind.com, andrew.rybchenko@oktetlabs.ru, akhil.goyal@nxp.com, jerinj@marvell.com, Nithin Dabilpuram , Pavan Nikhilesh , Ruifeng Wang , Konstantin Ananyev Date: Fri, 30 Oct 2020 18:44:30 +0100 Message-Id: <20201030174441.1076264-5-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201030174441.1076264-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201030174441.1076264-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v6 04/15] node: switch IPv4 metadata to dynamic mbuf field 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Nithin Dabilpuram The node_mbuf_priv1 was stored in the deprecated mbuf field udata64. It is moved to a dynamic field in order to allow removal of udata64. Signed-off-by: Thomas Monjalon Signed-off-by: Nithin Dabilpuram --- lib/librte_node/ip4_lookup.c | 40 ++++++++++++++++++------- lib/librte_node/ip4_lookup_neon.h | 20 ++++++------- lib/librte_node/ip4_lookup_sse.h | 36 +++++++++++------------ lib/librte_node/ip4_rewrite.c | 49 +++++++++++++++++++++++-------- lib/librte_node/node_private.h | 13 ++++++-- 5 files changed, 103 insertions(+), 55 deletions(-) diff --git a/lib/librte_node/ip4_lookup.c b/lib/librte_node/ip4_lookup.c index 8835aab9dd..d083a725fc 100644 --- a/lib/librte_node/ip4_lookup.c +++ b/lib/librte_node/ip4_lookup.c @@ -29,8 +29,23 @@ struct ip4_lookup_node_main { struct rte_lpm *lpm_tbl[RTE_MAX_NUMA_NODES]; }; +struct ip4_lookup_node_ctx { + /* Socket's LPM table */ + struct rte_lpm *lpm; + /* Dynamic offset to mbuf priv1 */ + int mbuf_priv1_off; +}; + +int node_mbuf_priv1_dynfield_offset = -1; + static struct ip4_lookup_node_main ip4_lookup_nm; +#define IP4_LOOKUP_NODE_LPM(ctx) \ + (((struct ip4_lookup_node_ctx *)ctx)->lpm) + +#define IP4_LOOKUP_NODE_PRIV1_OFF(ctx) \ + (((struct ip4_lookup_node_ctx *)ctx)->mbuf_priv1_off) + #if defined(__ARM_NEON) #include "ip4_lookup_neon.h" #elif defined(RTE_ARCH_X86) @@ -41,12 +56,13 @@ static uint16_t ip4_lookup_node_process_scalar(struct rte_graph *graph, struct rte_node *node, void **objs, uint16_t nb_objs) { + struct rte_lpm *lpm = IP4_LOOKUP_NODE_LPM(node->ctx); + const int dyn = IP4_LOOKUP_NODE_PRIV1_OFF(node->ctx); struct rte_ipv4_hdr *ipv4_hdr; void **to_next, **from; uint16_t last_spec = 0; struct rte_mbuf *mbuf; rte_edge_t next_index; - struct rte_lpm *lpm; uint16_t held = 0; uint32_t drop_nh; int i, rc; @@ -55,9 +71,6 @@ ip4_lookup_node_process_scalar(struct rte_graph *graph, struct rte_node *node, next_index = RTE_NODE_IP4_LOOKUP_NEXT_REWRITE; /* Drop node */ drop_nh = ((uint32_t)RTE_NODE_IP4_LOOKUP_NEXT_PKT_DROP) << 16; - - /* Get socket specific LPM from ctx */ - lpm = *((struct rte_lpm **)node->ctx); from = objs; /* Get stream for the speculated next node */ @@ -72,14 +85,14 @@ ip4_lookup_node_process_scalar(struct rte_graph *graph, struct rte_node *node, ipv4_hdr = rte_pktmbuf_mtod_offset(mbuf, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); /* Extract cksum, ttl as ipv4 hdr is in cache */ - node_mbuf_priv1(mbuf)->cksum = ipv4_hdr->hdr_checksum; - node_mbuf_priv1(mbuf)->ttl = ipv4_hdr->time_to_live; + node_mbuf_priv1(mbuf, dyn)->cksum = ipv4_hdr->hdr_checksum; + node_mbuf_priv1(mbuf, dyn)->ttl = ipv4_hdr->time_to_live; rc = rte_lpm_lookup(lpm, rte_be_to_cpu_32(ipv4_hdr->dst_addr), &next_hop); next_hop = (rc == 0) ? next_hop : drop_nh; - node_mbuf_priv1(mbuf)->nh = (uint16_t)next_hop; + node_mbuf_priv1(mbuf, dyn)->nh = (uint16_t)next_hop; next_hop = next_hop >> 16; next = (uint16_t)next_hop; @@ -169,15 +182,19 @@ setup_lpm(struct ip4_lookup_node_main *nm, int socket) static int ip4_lookup_node_init(const struct rte_graph *graph, struct rte_node *node) { - struct rte_lpm **lpm_p = (struct rte_lpm **)&node->ctx; uint16_t socket, lcore_id; static uint8_t init_once; int rc; RTE_SET_USED(graph); - RTE_SET_USED(node); + RTE_BUILD_BUG_ON(sizeof(struct ip4_lookup_node_ctx) > RTE_NODE_CTX_SZ); if (!init_once) { + node_mbuf_priv1_dynfield_offset = rte_mbuf_dynfield_register( + &node_mbuf_priv1_dynfield_desc); + if (node_mbuf_priv1_dynfield_offset < 0) + return -rte_errno; + /* Setup LPM tables for all sockets */ RTE_LCORE_FOREACH(lcore_id) { @@ -192,7 +209,10 @@ ip4_lookup_node_init(const struct rte_graph *graph, struct rte_node *node) } init_once = 1; } - *lpm_p = ip4_lookup_nm.lpm_tbl[graph->socket]; + + /* Update socket's LPM and mbuf dyn priv1 offset in node ctx */ + IP4_LOOKUP_NODE_LPM(node->ctx) = ip4_lookup_nm.lpm_tbl[graph->socket]; + IP4_LOOKUP_NODE_PRIV1_OFF(node->ctx) = node_mbuf_priv1_dynfield_offset; #if defined(__ARM_NEON) || defined(RTE_ARCH_X86) if (rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128) diff --git a/lib/librte_node/ip4_lookup_neon.h b/lib/librte_node/ip4_lookup_neon.h index 0ad2763b82..d5c8da3719 100644 --- a/lib/librte_node/ip4_lookup_neon.h +++ b/lib/librte_node/ip4_lookup_neon.h @@ -11,12 +11,13 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node, void **objs, uint16_t nb_objs) { struct rte_mbuf *mbuf0, *mbuf1, *mbuf2, *mbuf3, **pkts; + struct rte_lpm *lpm = IP4_LOOKUP_NODE_LPM(node->ctx); + const int dyn = IP4_LOOKUP_NODE_PRIV1_OFF(node->ctx); struct rte_ipv4_hdr *ipv4_hdr; void **to_next, **from; uint16_t last_spec = 0; rte_edge_t next_index; uint16_t n_left_from; - struct rte_lpm *lpm; uint16_t held = 0; uint32_t drop_nh; rte_xmm_t result; @@ -30,9 +31,6 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node, /* Drop node */ drop_nh = ((uint32_t)RTE_NODE_IP4_LOOKUP_NEXT_PKT_DROP) << 16; - /* Get socket specific LPM from ctx */ - lpm = *((struct rte_lpm **)node->ctx); - pkts = (struct rte_mbuf **)objs; from = objs; n_left_from = nb_objs; @@ -119,10 +117,10 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node, priv23.u16[0] = result.u16[4]; priv23.u16[4] = result.u16[6]; - node_mbuf_priv1(mbuf0)->u = priv01.u64[0]; - node_mbuf_priv1(mbuf1)->u = priv01.u64[1]; - node_mbuf_priv1(mbuf2)->u = priv23.u64[0]; - node_mbuf_priv1(mbuf3)->u = priv23.u64[1]; + node_mbuf_priv1(mbuf0, dyn)->u = priv01.u64[0]; + node_mbuf_priv1(mbuf1, dyn)->u = priv01.u64[1]; + node_mbuf_priv1(mbuf2, dyn)->u = priv23.u64[0]; + node_mbuf_priv1(mbuf3, dyn)->u = priv23.u64[1]; /* Enqueue four to next node */ rte_edge_t fix_spec = ((next_index == result.u16[1]) && @@ -197,14 +195,14 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node, ipv4_hdr = rte_pktmbuf_mtod_offset(mbuf0, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); /* Extract cksum, ttl as ipv4 hdr is in cache */ - node_mbuf_priv1(mbuf0)->cksum = ipv4_hdr->hdr_checksum; - node_mbuf_priv1(mbuf0)->ttl = ipv4_hdr->time_to_live; + node_mbuf_priv1(mbuf0, dyn)->cksum = ipv4_hdr->hdr_checksum; + node_mbuf_priv1(mbuf0, dyn)->ttl = ipv4_hdr->time_to_live; rc = rte_lpm_lookup(lpm, rte_be_to_cpu_32(ipv4_hdr->dst_addr), &next_hop); next_hop = (rc == 0) ? next_hop : drop_nh; - node_mbuf_priv1(mbuf0)->nh = (uint16_t)next_hop; + node_mbuf_priv1(mbuf0, dyn)->nh = (uint16_t)next_hop; next_hop = next_hop >> 16; next0 = (uint16_t)next_hop; diff --git a/lib/librte_node/ip4_lookup_sse.h b/lib/librte_node/ip4_lookup_sse.h index 264c986071..74dbf97533 100644 --- a/lib/librte_node/ip4_lookup_sse.h +++ b/lib/librte_node/ip4_lookup_sse.h @@ -11,13 +11,14 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node, void **objs, uint16_t nb_objs) { struct rte_mbuf *mbuf0, *mbuf1, *mbuf2, *mbuf3, **pkts; + struct rte_lpm *lpm = IP4_LOOKUP_NODE_LPM(node->ctx); + const int dyn = IP4_LOOKUP_NODE_PRIV1_OFF(node->ctx); rte_edge_t next0, next1, next2, next3, next_index; struct rte_ipv4_hdr *ipv4_hdr; uint32_t ip0, ip1, ip2, ip3; void **to_next, **from; uint16_t last_spec = 0; uint16_t n_left_from; - struct rte_lpm *lpm; uint16_t held = 0; uint32_t drop_nh; rte_xmm_t dst; @@ -29,9 +30,6 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node, /* Drop node */ drop_nh = ((uint32_t)RTE_NODE_IP4_LOOKUP_NEXT_PKT_DROP) << 16; - /* Get socket specific LPM from ctx */ - lpm = *((struct rte_lpm **)node->ctx); - pkts = (struct rte_mbuf **)objs; from = objs; n_left_from = nb_objs; @@ -78,24 +76,24 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node, sizeof(struct rte_ether_hdr)); ip0 = ipv4_hdr->dst_addr; /* Extract cksum, ttl as ipv4 hdr is in cache */ - node_mbuf_priv1(mbuf0)->cksum = ipv4_hdr->hdr_checksum; - node_mbuf_priv1(mbuf0)->ttl = ipv4_hdr->time_to_live; + node_mbuf_priv1(mbuf0, dyn)->cksum = ipv4_hdr->hdr_checksum; + node_mbuf_priv1(mbuf0, dyn)->ttl = ipv4_hdr->time_to_live; /* Extract DIP of mbuf1 */ ipv4_hdr = rte_pktmbuf_mtod_offset(mbuf1, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); ip1 = ipv4_hdr->dst_addr; /* Extract cksum, ttl as ipv4 hdr is in cache */ - node_mbuf_priv1(mbuf1)->cksum = ipv4_hdr->hdr_checksum; - node_mbuf_priv1(mbuf1)->ttl = ipv4_hdr->time_to_live; + node_mbuf_priv1(mbuf1, dyn)->cksum = ipv4_hdr->hdr_checksum; + node_mbuf_priv1(mbuf1, dyn)->ttl = ipv4_hdr->time_to_live; /* Extract DIP of mbuf2 */ ipv4_hdr = rte_pktmbuf_mtod_offset(mbuf2, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); ip2 = ipv4_hdr->dst_addr; /* Extract cksum, ttl as ipv4 hdr is in cache */ - node_mbuf_priv1(mbuf2)->cksum = ipv4_hdr->hdr_checksum; - node_mbuf_priv1(mbuf2)->ttl = ipv4_hdr->time_to_live; + node_mbuf_priv1(mbuf2, dyn)->cksum = ipv4_hdr->hdr_checksum; + node_mbuf_priv1(mbuf2, dyn)->ttl = ipv4_hdr->time_to_live; /* Extract DIP of mbuf3 */ ipv4_hdr = rte_pktmbuf_mtod_offset(mbuf3, struct rte_ipv4_hdr *, @@ -111,23 +109,23 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node, dip = _mm_shuffle_epi8(dip, bswap_mask); /* Extract cksum, ttl as ipv4 hdr is in cache */ - node_mbuf_priv1(mbuf3)->cksum = ipv4_hdr->hdr_checksum; - node_mbuf_priv1(mbuf3)->ttl = ipv4_hdr->time_to_live; + node_mbuf_priv1(mbuf3, dyn)->cksum = ipv4_hdr->hdr_checksum; + node_mbuf_priv1(mbuf3, dyn)->ttl = ipv4_hdr->time_to_live; /* Perform LPM lookup to get NH and next node */ rte_lpm_lookupx4(lpm, dip, dst.u32, drop_nh); /* Extract next node id and NH */ - node_mbuf_priv1(mbuf0)->nh = dst.u32[0] & 0xFFFF; + node_mbuf_priv1(mbuf0, dyn)->nh = dst.u32[0] & 0xFFFF; next0 = (dst.u32[0] >> 16); - node_mbuf_priv1(mbuf1)->nh = dst.u32[1] & 0xFFFF; + node_mbuf_priv1(mbuf1, dyn)->nh = dst.u32[1] & 0xFFFF; next1 = (dst.u32[1] >> 16); - node_mbuf_priv1(mbuf2)->nh = dst.u32[2] & 0xFFFF; + node_mbuf_priv1(mbuf2, dyn)->nh = dst.u32[2] & 0xFFFF; next2 = (dst.u32[2] >> 16); - node_mbuf_priv1(mbuf3)->nh = dst.u32[3] & 0xFFFF; + node_mbuf_priv1(mbuf3, dyn)->nh = dst.u32[3] & 0xFFFF; next3 = (dst.u32[3] >> 16); /* Enqueue four to next node */ @@ -202,14 +200,14 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node, ipv4_hdr = rte_pktmbuf_mtod_offset(mbuf0, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); /* Extract cksum, ttl as ipv4 hdr is in cache */ - node_mbuf_priv1(mbuf0)->cksum = ipv4_hdr->hdr_checksum; - node_mbuf_priv1(mbuf0)->ttl = ipv4_hdr->time_to_live; + node_mbuf_priv1(mbuf0, dyn)->cksum = ipv4_hdr->hdr_checksum; + node_mbuf_priv1(mbuf0, dyn)->ttl = ipv4_hdr->time_to_live; rc = rte_lpm_lookup(lpm, rte_be_to_cpu_32(ipv4_hdr->dst_addr), &next_hop); next_hop = (rc == 0) ? next_hop : drop_nh; - node_mbuf_priv1(mbuf0)->nh = next_hop & 0xFFFF; + node_mbuf_priv1(mbuf0, dyn)->nh = next_hop & 0xFFFF; next0 = (next_hop >> 16); if (unlikely(next_index ^ next0)) { diff --git a/lib/librte_node/ip4_rewrite.c b/lib/librte_node/ip4_rewrite.c index bb7f671b5c..99ecb457ff 100644 --- a/lib/librte_node/ip4_rewrite.c +++ b/lib/librte_node/ip4_rewrite.c @@ -19,14 +19,28 @@ #include "ip4_rewrite_priv.h" #include "node_private.h" +struct ip4_rewrite_node_ctx { + /* Dynamic offset to mbuf priv1 */ + int mbuf_priv1_off; + /* Cached next index */ + uint16_t next_index; +}; + static struct ip4_rewrite_node_main *ip4_rewrite_nm; +#define IP4_REWRITE_NODE_LAST_NEXT(ctx) \ + (((struct ip4_rewrite_node_ctx *)ctx)->next_index) + +#define IP4_REWRITE_NODE_PRIV1_OFF(ctx) \ + (((struct ip4_rewrite_node_ctx *)ctx)->mbuf_priv1_off) + static uint16_t ip4_rewrite_node_process(struct rte_graph *graph, struct rte_node *node, void **objs, uint16_t nb_objs) { struct rte_mbuf *mbuf0, *mbuf1, *mbuf2, *mbuf3, **pkts; struct ip4_rewrite_nh_header *nh = ip4_rewrite_nm->nh; + const int dyn = IP4_REWRITE_NODE_PRIV1_OFF(node->ctx); uint16_t next0, next1, next2, next3, next_index; struct rte_ipv4_hdr *ip0, *ip1, *ip2, *ip3; uint16_t n_left_from, held = 0, last_spec = 0; @@ -37,7 +51,7 @@ ip4_rewrite_node_process(struct rte_graph *graph, struct rte_node *node, int i; /* Speculative next as last next */ - next_index = *(uint16_t *)node->ctx; + next_index = IP4_REWRITE_NODE_LAST_NEXT(node->ctx); rte_prefetch0(nh); pkts = (struct rte_mbuf **)objs; @@ -68,10 +82,10 @@ ip4_rewrite_node_process(struct rte_graph *graph, struct rte_node *node, pkts += 4; n_left_from -= 4; - priv01.u64[0] = node_mbuf_priv1(mbuf0)->u; - priv01.u64[1] = node_mbuf_priv1(mbuf1)->u; - priv23.u64[0] = node_mbuf_priv1(mbuf2)->u; - priv23.u64[1] = node_mbuf_priv1(mbuf3)->u; + priv01.u64[0] = node_mbuf_priv1(mbuf0, dyn)->u; + priv01.u64[1] = node_mbuf_priv1(mbuf1, dyn)->u; + priv23.u64[0] = node_mbuf_priv1(mbuf2, dyn)->u; + priv23.u64[1] = node_mbuf_priv1(mbuf3, dyn)->u; /* Increment checksum by one. */ priv01.u32[1] += rte_cpu_to_be_16(0x0100); @@ -203,17 +217,17 @@ ip4_rewrite_node_process(struct rte_graph *graph, struct rte_node *node, n_left_from -= 1; d0 = rte_pktmbuf_mtod(mbuf0, void *); - rte_memcpy(d0, nh[node_mbuf_priv1(mbuf0)->nh].rewrite_data, - nh[node_mbuf_priv1(mbuf0)->nh].rewrite_len); + rte_memcpy(d0, nh[node_mbuf_priv1(mbuf0, dyn)->nh].rewrite_data, + nh[node_mbuf_priv1(mbuf0, dyn)->nh].rewrite_len); - next0 = nh[node_mbuf_priv1(mbuf0)->nh].tx_node; + next0 = nh[node_mbuf_priv1(mbuf0, dyn)->nh].tx_node; ip0 = (struct rte_ipv4_hdr *)((uint8_t *)d0 + sizeof(struct rte_ether_hdr)); - chksum = node_mbuf_priv1(mbuf0)->cksum + + chksum = node_mbuf_priv1(mbuf0, dyn)->cksum + rte_cpu_to_be_16(0x0100); chksum += chksum >= 0xffff; ip0->hdr_checksum = chksum; - ip0->time_to_live = node_mbuf_priv1(mbuf0)->ttl - 1; + ip0->time_to_live = node_mbuf_priv1(mbuf0, dyn)->ttl - 1; if (unlikely(next_index ^ next0)) { /* Copy things successfully speculated till now */ @@ -240,7 +254,7 @@ ip4_rewrite_node_process(struct rte_graph *graph, struct rte_node *node, rte_memcpy(to_next, from, last_spec * sizeof(from[0])); rte_node_next_stream_put(graph, node, next_index, held); /* Save the last next used */ - *(uint16_t *)node->ctx = next_index; + IP4_REWRITE_NODE_LAST_NEXT(node->ctx) = next_index; return nb_objs; } @@ -248,9 +262,20 @@ ip4_rewrite_node_process(struct rte_graph *graph, struct rte_node *node, static int ip4_rewrite_node_init(const struct rte_graph *graph, struct rte_node *node) { + static bool init_once; RTE_SET_USED(graph); - RTE_SET_USED(node); + RTE_BUILD_BUG_ON(sizeof(struct ip4_rewrite_node_ctx) > RTE_NODE_CTX_SZ); + + if (!init_once) { + node_mbuf_priv1_dynfield_offset = rte_mbuf_dynfield_register( + &node_mbuf_priv1_dynfield_desc); + if (node_mbuf_priv1_dynfield_offset < 0) + return -rte_errno; + init_once = true; + } + IP4_REWRITE_NODE_PRIV1_OFF(node->ctx) = node_mbuf_priv1_dynfield_offset; + node_dbg("ip4_rewrite", "Initialized ip4_rewrite node initialized"); return 0; diff --git a/lib/librte_node/node_private.h b/lib/librte_node/node_private.h index ab7941c12b..8c73d5dc10 100644 --- a/lib/librte_node/node_private.h +++ b/lib/librte_node/node_private.h @@ -8,6 +8,7 @@ #include #include #include +#include extern int rte_node_logtype; #define NODE_LOG(level, node_name, ...) \ @@ -21,7 +22,6 @@ extern int rte_node_logtype; #define node_dbg(node_name, ...) NODE_LOG(DEBUG, node_name, __VA_ARGS__) /** - * * Node mbuf private data to store next hop, ttl and checksum. */ struct node_mbuf_priv1 { @@ -37,6 +37,13 @@ struct node_mbuf_priv1 { }; }; +static const struct rte_mbuf_dynfield node_mbuf_priv1_dynfield_desc = { + .name = "rte_node_dynfield_priv1", + .size = sizeof(struct node_mbuf_priv1), + .align = __alignof__(struct node_mbuf_priv1), +}; +extern int node_mbuf_priv1_dynfield_offset; + /** * Node mbuf private area 2. */ @@ -58,9 +65,9 @@ struct node_mbuf_priv2 { * Pointer to the mbuf_priv1. */ static __rte_always_inline struct node_mbuf_priv1 * -node_mbuf_priv1(struct rte_mbuf *m) +node_mbuf_priv1(struct rte_mbuf *m, const int offset) { - return (struct node_mbuf_priv1 *)&m->udata64; + return RTE_MBUF_DYNFIELD(m, offset, struct node_mbuf_priv1 *); } /** From patchwork Fri Oct 30 17:44:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82979 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0AE39A04E6; Fri, 30 Oct 2020 18:46:35 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3F86C558E; Fri, 30 Oct 2020 18:45:07 +0100 (CET) Received: from new2-smtp.messagingengine.com (new2-smtp.messagingengine.com [66.111.4.224]) by dpdk.org (Postfix) with ESMTP id 581B24C87 for ; Fri, 30 Oct 2020 18:44:59 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailnew.nyi.internal (Postfix) with ESMTP id 0A48D580845; Fri, 30 Oct 2020 13:44:59 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 30 Oct 2020 13:44:59 -0400 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=fm2; bh=b8SbF0NICIvkU l4YbjctFtLN6/hRNYrZZY3FGxeen0s=; b=T1KKjbb1bKX4xeLK95S4YmXzpu6WX 8DdVXwWCks4G2bK4xswu2uaP8iFsCMTKWxbqe+r9jK793lEdC6kqp8xMdAor62RU vat97HzfwobuY89Dbrwvt3fxAG0PwYGLZhGH8sMk4OOvkyH9J7UsHcKXm7vToPYD 7jJ2RjRYJjQH0y05rPMdL1ncrY5QPy9LOFpKUJfqGnkLUu3wgcSUm5hmrMCWzDym BxsyqHF2HrymO/JsFm9JeDuQjEtalnWclRU4oZNIVKV+IHbJp2kOkP/K36XjkOaf nfmGqN8z0587WOZbSnSwSuvELr7sRAt01iGlTQR1zRZFMS8pM8+fRZn/g== 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=b8SbF0NICIvkUl4YbjctFtLN6/hRNYrZZY3FGxeen0s=; b=jN98N+Sa ISFxwXa/O9OrY4+M4k9ihStM67crvuWCV/0H2CRhiTq2psCqmS/nHtngQhNIS2LK Z+ShMy6aL05+5SHx5eHAsr964N/hBcXNPW4oJ7zbZRBib6yferyPnbf9KEUA2VGS ZyxhJuZRFPHDecwG6m66ZKJlizeQ6yh4mEo8Cp1MW4NJZVdDeW8cuWl4MqczT4Rs lsN+bUQ3wYZi0ujWHuNxNh4w5ORP+vvFbAhV6oSUsquMmeb/NbICpgm66cs/ighA zDhjP4nF+MQ3QbDEDMQliSq+IlF37IqxLy+elDbXQ0wmap7+NzSEMHlTqlrMssOV EUAM5JOq4rF1ug== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrleehgdellecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgepfeenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho nhdrnhgvth 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 D711F3064674; Fri, 30 Oct 2020 13:44:55 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@intel.com, david.marchand@redhat.com, bruce.richardson@intel.com, olivier.matz@6wind.com, andrew.rybchenko@oktetlabs.ru, akhil.goyal@nxp.com, jerinj@marvell.com, Haiyue Wang , Declan Doherty , Ankur Dwivedi , Anoob Joseph , Jeff Guo , Nithin Dabilpuram , Kiran Kumar K , Radu Nicolau , Ray Kinsella , Neil Horman Date: Fri, 30 Oct 2020 18:44:31 +0100 Message-Id: <20201030174441.1076264-6-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201030174441.1076264-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201030174441.1076264-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v6 05/15] security: switch metadata to dynamic mbuf field 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The device-specific metadata was stored in the deprecated field udata64. It is moved to a dynamic mbuf field in order to allow removal of udata64. The name rte_security_dynfield is not very descriptive but it should be replaced later by separate fields for each type of data that drivers pass to the upper layer. Signed-off-by: Thomas Monjalon Acked-by: Haiyue Wang --- doc/guides/prog_guide/rte_security.rst | 9 ++-- drivers/crypto/octeontx2/otx2_cryptodev_sec.c | 5 ++- drivers/net/ixgbe/ixgbe_ipsec.c | 5 ++- drivers/net/ixgbe/ixgbe_rxtx.c | 6 ++- drivers/net/octeontx2/otx2_ethdev.h | 1 + drivers/net/octeontx2/otx2_ethdev_sec.c | 5 ++- drivers/net/octeontx2/otx2_ethdev_sec_tx.h | 2 +- drivers/net/octeontx2/otx2_rx.h | 2 +- examples/ipsec-secgw/ipsec-secgw.c | 9 ++-- examples/ipsec-secgw/ipsec_worker.c | 12 ++++-- lib/librte_security/rte_security.c | 16 +++++++ lib/librte_security/rte_security.h | 42 +++++++++++++++++++ lib/librte_security/rte_security_driver.h | 3 ++ lib/librte_security/version.map | 2 + 14 files changed, 99 insertions(+), 20 deletions(-) diff --git a/doc/guides/prog_guide/rte_security.rst b/doc/guides/prog_guide/rte_security.rst index c64aef3de9..f72bc8a78f 100644 --- a/doc/guides/prog_guide/rte_security.rst +++ b/doc/guides/prog_guide/rte_security.rst @@ -125,8 +125,9 @@ ESP/AH headers will be removed from the packet and the received packet will contains the decrypted packet only. The driver Rx path checks the descriptors and based on the crypto status sets additional flags in ``rte_mbuf.ol_flags`` field. The driver would also set device-specific -metadata in ``rte_mbuf.udata64`` field. This will allow the application -to identify the security processing done on the packet. +metadata in ``RTE_SECURITY_DYNFIELD_NAME`` field. +This will allow the application to identify the security processing +done on the packet. .. note:: @@ -568,8 +569,8 @@ security session which processed the packet. .. note:: - In case of inline processed packets, ``rte_mbuf.udata64`` field would be - used by the driver to relay information on the security processing + In case of inline processed packets, ``RTE_SECURITY_DYNFIELD_NAME`` field + would be used by the driver to relay information on the security processing associated with the packet. In ingress, the driver would set this in Rx path while in egress, ``rte_security_set_pkt_metadata()`` would perform a similar operation. The application is expected not to modify the field diff --git a/drivers/crypto/octeontx2/otx2_cryptodev_sec.c b/drivers/crypto/octeontx2/otx2_cryptodev_sec.c index b80ec7bff2..4e2a0e3afe 100644 --- a/drivers/crypto/octeontx2/otx2_cryptodev_sec.c +++ b/drivers/crypto/octeontx2/otx2_cryptodev_sec.c @@ -455,6 +455,9 @@ otx2_crypto_sec_session_create(void *device, if (conf->action_type != RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL) return -ENOTSUP; + if (rte_security_dynfield_register() < 0) + return -rte_errno; + if (rte_mempool_get(mempool, (void **)&priv)) { otx2_err("Could not allocate security session private data"); return -ENOMEM; @@ -514,7 +517,7 @@ otx2_crypto_sec_set_pkt_mdata(void *device __rte_unused, struct rte_mbuf *m, void *params __rte_unused) { /* Set security session as the pkt metadata */ - m->udata64 = (uint64_t)session; + *rte_security_dynfield(m) = (rte_security_dynfield_t)session; return 0; } diff --git a/drivers/net/ixgbe/ixgbe_ipsec.c b/drivers/net/ixgbe/ixgbe_ipsec.c index 48f5082d49..62f2a5f764 100644 --- a/drivers/net/ixgbe/ixgbe_ipsec.c +++ b/drivers/net/ixgbe/ixgbe_ipsec.c @@ -484,7 +484,8 @@ ixgbe_crypto_update_mb(void *device __rte_unused, get_sec_session_private_data(session); if (ic_session->op == IXGBE_OP_AUTHENTICATED_ENCRYPTION) { union ixgbe_crypto_tx_desc_md *mdata = - (union ixgbe_crypto_tx_desc_md *)&m->udata64; + (union ixgbe_crypto_tx_desc_md *) + rte_security_dynfield(m); mdata->enc = 1; mdata->sa_idx = ic_session->sa_index; mdata->pad_len = ixgbe_crypto_compute_pad_len(m); @@ -751,5 +752,7 @@ ixgbe_ipsec_ctx_create(struct rte_eth_dev *dev) return -ENOMEM; } } + if (rte_security_dynfield_register() < 0) + return -rte_errno; return 0; } diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 5f19972031..6cfbb582e2 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -694,7 +695,7 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, if (use_ipsec) { union ixgbe_crypto_tx_desc_md *ipsec_mdata = (union ixgbe_crypto_tx_desc_md *) - &tx_pkt->udata64; + rte_security_dynfield(tx_pkt); tx_offload.sa_idx = ipsec_mdata->sa_idx; tx_offload.sec_pad_len = ipsec_mdata->pad_len; } @@ -859,7 +860,8 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, } ixgbe_set_xmit_ctx(txq, ctx_txd, tx_ol_req, - tx_offload, &tx_pkt->udata64); + tx_offload, + rte_security_dynfield(tx_pkt)); txe->last_id = tx_last; tx_id = txe->next_id; diff --git a/drivers/net/octeontx2/otx2_ethdev.h b/drivers/net/octeontx2/otx2_ethdev.h index b20f399a15..3b9871f4dc 100644 --- a/drivers/net/octeontx2/otx2_ethdev.h +++ b/drivers/net/octeontx2/otx2_ethdev.h @@ -13,6 +13,7 @@ #include #include #include +#include #include #include diff --git a/drivers/net/octeontx2/otx2_ethdev_sec.c b/drivers/net/octeontx2/otx2_ethdev_sec.c index 4e0dd4e49e..1ee597ff6e 100644 --- a/drivers/net/octeontx2/otx2_ethdev_sec.c +++ b/drivers/net/octeontx2/otx2_ethdev_sec.c @@ -684,7 +684,7 @@ otx2_eth_sec_set_pkt_mdata(void *device __rte_unused, struct rte_mbuf *m, void *params __rte_unused) { /* Set security session as the pkt metadata */ - m->udata64 = (uint64_t)session; + *rte_security_dynfield(m) = (rte_security_dynfield_t)session; return 0; } @@ -831,6 +831,9 @@ otx2_eth_sec_init(struct rte_eth_dev *eth_dev) !(dev->rx_offloads & DEV_RX_OFFLOAD_SECURITY)) return 0; + if (rte_security_dynfield_register() < 0) + return -rte_errno; + nb_sa = dev->ipsec_in_max_spi; mz_sz = nb_sa * sa_width; in_sa_mz_name_get(name, RTE_MEMZONE_NAMESIZE, port); diff --git a/drivers/net/octeontx2/otx2_ethdev_sec_tx.h b/drivers/net/octeontx2/otx2_ethdev_sec_tx.h index 5bf8c19995..284bcd5367 100644 --- a/drivers/net/octeontx2/otx2_ethdev_sec_tx.h +++ b/drivers/net/octeontx2/otx2_ethdev_sec_tx.h @@ -55,7 +55,7 @@ otx2_sec_event_tx(struct otx2_ssogws *ws, struct rte_event *ev, struct nix_iova_s nix_iova; } *sd; - priv = get_sec_session_private_data((void *)(m->udata64)); + priv = get_sec_session_private_data((void *)(*rte_security_dynfield(m))); sess = &priv->ipsec.ip; sa = &sess->out_sa; diff --git a/drivers/net/octeontx2/otx2_rx.h b/drivers/net/octeontx2/otx2_rx.h index f29a0542f9..61a5c436dd 100644 --- a/drivers/net/octeontx2/otx2_rx.h +++ b/drivers/net/octeontx2/otx2_rx.h @@ -241,7 +241,7 @@ nix_rx_sec_mbuf_update(const struct nix_cqe_hdr_s *cq, struct rte_mbuf *m, spi = cq->tag & 0xFFFFF; sa = nix_rx_sec_sa_get(lookup_mem, spi, m->port); - m->udata64 = (uint64_t)sa->userdata; + *rte_security_dynfield(m) = sa->udata64; data = rte_pktmbuf_mtod(m, char *); diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c index 2219148285..bbe7ce48d9 100644 --- a/examples/ipsec-secgw/ipsec-secgw.c +++ b/examples/ipsec-secgw/ipsec-secgw.c @@ -426,7 +426,8 @@ prepare_one_packet(struct rte_mbuf *pkt, struct ipsec_traffic *t) * with the security session. */ - if (pkt->ol_flags & PKT_RX_SEC_OFFLOAD) { + if (pkt->ol_flags & PKT_RX_SEC_OFFLOAD && + rte_security_dynfield_is_registered()) { struct ipsec_sa *sa; struct ipsec_mbuf_metadata *priv; struct rte_security_ctx *ctx = (struct rte_security_ctx *) @@ -436,10 +437,8 @@ prepare_one_packet(struct rte_mbuf *pkt, struct ipsec_traffic *t) /* Retrieve the userdata registered. Here, the userdata * registered is the SA pointer. */ - - sa = (struct ipsec_sa *) - rte_security_get_userdata(ctx, pkt->udata64); - + sa = (struct ipsec_sa *)rte_security_get_userdata(ctx, + *rte_security_dynfield(pkt)); if (sa == NULL) { /* userdata could not be retrieved */ return; diff --git a/examples/ipsec-secgw/ipsec_worker.c b/examples/ipsec-secgw/ipsec_worker.c index b6c851f257..647e22df59 100644 --- a/examples/ipsec-secgw/ipsec_worker.c +++ b/examples/ipsec-secgw/ipsec_worker.c @@ -208,7 +208,7 @@ process_ipsec_ev_inbound(struct ipsec_ctx *ctx, struct route_table *rt, "Inbound security offload failed\n"); goto drop_pkt_and_exit; } - sa = pkt->userdata; + sa = *(struct ipsec_sa **)rte_security_dynfield(pkt); } /* Check if we have a match */ @@ -226,7 +226,7 @@ process_ipsec_ev_inbound(struct ipsec_ctx *ctx, struct route_table *rt, "Inbound security offload failed\n"); goto drop_pkt_and_exit; } - sa = pkt->userdata; + sa = *(struct ipsec_sa **)rte_security_dynfield(pkt); } /* Check if we have a match */ @@ -357,7 +357,8 @@ process_ipsec_ev_outbound(struct ipsec_ctx *ctx, struct route_table *rt, } if (sess->security.ol_flags & RTE_SECURITY_TX_OLOAD_NEED_MDATA) - pkt->userdata = sess->security.ses; + *(struct rte_security_session **)rte_security_dynfield(pkt) = + sess->security.ses; /* Mark the packet for Tx security offload */ pkt->ol_flags |= PKT_TX_SEC_OFFLOAD; @@ -465,7 +466,10 @@ ipsec_wrkr_non_burst_int_port_drv_mode(struct eh_event_link_info *links, } /* Save security session */ - pkt->userdata = sess_tbl[port_id]; + if (rte_security_dynfield_is_registered()) + *(struct rte_security_session **) + rte_security_dynfield(pkt) = + sess_tbl[port_id]; /* Mark the packet for Tx security offload */ pkt->ol_flags |= PKT_TX_SEC_OFFLOAD; diff --git a/lib/librte_security/rte_security.c b/lib/librte_security/rte_security.c index ee4666026a..e8116d5447 100644 --- a/lib/librte_security/rte_security.c +++ b/lib/librte_security/rte_security.c @@ -23,6 +23,22 @@ RTE_PTR_OR_ERR_RET(p1->p2->p3, last_retval); \ } while (0) +#define RTE_SECURITY_DYNFIELD_NAME "rte_security_dynfield_metadata" +int rte_security_dynfield_offset = -1; + +int +rte_security_dynfield_register(void) +{ + static const struct rte_mbuf_dynfield dynfield_desc = { + .name = RTE_SECURITY_DYNFIELD_NAME, + .size = sizeof(rte_security_dynfield_t), + .align = __alignof__(rte_security_dynfield_t), + }; + rte_security_dynfield_offset = + rte_mbuf_dynfield_register(&dynfield_desc); + return rte_security_dynfield_offset; +} + struct rte_security_session * rte_security_session_create(struct rte_security_ctx *instance, struct rte_security_session_conf *conf, diff --git a/lib/librte_security/rte_security.h b/lib/librte_security/rte_security.h index 271531af12..88d31de0a6 100644 --- a/lib/librte_security/rte_security.h +++ b/lib/librte_security/rte_security.h @@ -27,6 +27,7 @@ extern "C" { #include #include #include +#include #include #include @@ -451,6 +452,47 @@ int rte_security_session_destroy(struct rte_security_ctx *instance, struct rte_security_session *sess); +/** Device-specific metadata field type */ +typedef uint64_t rte_security_dynfield_t; +/** Dynamic mbuf field for device-specific metadata */ +extern int rte_security_dynfield_offset; + +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice + * + * Get pointer to mbuf field for device-specific metadata. + * + * For performance reason, no check is done, + * the dynamic field may not be registered. + * @see rte_security_dynfield_is_registered + * + * @param mbuf packet to access + * @return pointer to mbuf field + */ +__rte_experimental +static inline rte_security_dynfield_t * +rte_security_dynfield(struct rte_mbuf *mbuf) +{ + return RTE_MBUF_DYNFIELD(mbuf, + rte_security_dynfield_offset, + rte_security_dynfield_t *); +} + +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice + * + * Check whether the dynamic field is registered. + * + * @return true if rte_security_dynfield_register() has been called. + */ +__rte_experimental +static inline bool rte_security_dynfield_is_registered(void) +{ + return rte_security_dynfield_offset >= 0; +} + /** * Updates the buffer with device-specific defined metadata * diff --git a/lib/librte_security/rte_security_driver.h b/lib/librte_security/rte_security_driver.h index 1b561f8528..c5abb07990 100644 --- a/lib/librte_security/rte_security_driver.h +++ b/lib/librte_security/rte_security_driver.h @@ -89,6 +89,9 @@ typedef int (*security_session_stats_get_t)(void *device, struct rte_security_session *sess, struct rte_security_stats *stats); +__rte_experimental +int rte_security_dynfield_register(void); + /** * Update the mbuf with provided metadata. * diff --git a/lib/librte_security/version.map b/lib/librte_security/version.map index d84eec0a88..22775558c8 100644 --- a/lib/librte_security/version.map +++ b/lib/librte_security/version.map @@ -15,6 +15,8 @@ DPDK_21 { EXPERIMENTAL { global: + rte_security_dynfield_offset; + rte_security_dynfield_register; rte_security_get_userdata; rte_security_session_stats_get; rte_security_session_update; From patchwork Fri Oct 30 17:44:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82980 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 080C9A04E6; Fri, 30 Oct 2020 18:46:55 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BD4935913; Fri, 30 Oct 2020 18:45:08 +0100 (CET) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id E47E12BDB for ; Fri, 30 Oct 2020 18:44:59 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 974185C01A6; Fri, 30 Oct 2020 13:44:59 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 30 Oct 2020 13:44:59 -0400 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=fm2; bh=LwWQwfU6RHLbt g4dEo+IhspzPWam5yQep4h1I7K5+f4=; b=nNw2k7zg0HSqJwYohkBKEZseBURZi ZZ+/BGsUEouvH/EQMnqPXz+QdNDq9l2pK2Mn6vyd7DgUb34sYZBY14QkhkhxyPwX XCG3hbWbjqy+GzvP7v4Z89CFelXxWVIAgQmwISbyqdaIjGAColQ4dQYbLQPwULAT J2s4f1O5Tmf8AlgiIxowVBSfG+5JEzGkRXDv8zZDHcqti3/C9hK9CeajOtH/LMll 4r80Y6bUfdtJBrXIFCQHDtRbDy3jwweyFN3dKYEQEZDxgK0GL9Be22VDUgs0aQtQ 7guTGqAbdEUPZ+l68o5rIyFmbkRvBkspFpqf3C4L82Er10VJ4FJQseNnA== 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=LwWQwfU6RHLbtg4dEo+IhspzPWam5yQep4h1I7K5+f4=; b=ZD7US32H oRwOlovTlC7G67JnLTvSRy5UDiR3M3R2f1ZTV4aeb1paY/jo+pajrOlPvJUaERRM RDG90LOFIkI7grxgG31xecAXi3P0BaQgTcYKV4dYoV63S43I8kjnzj/mle7Pwab0 VZUwFVqF0BhF9fXU+TGHV834/sl/TZfAnSm6P3nvTkmBslUdYvzGrpTXrN+X8uBL eRB05GhRdeDCaAfCtPvn3LlMF5fXhfxWTav760cxjEeeWg13R2iGEpLcuolKWUys ouOL+iV4JCcpRJDujONAuOybw8nYBEDdrrSMG/Y+8lpzikUcWBpnD5IazPt/h/Ws F9nvObIGrM4KNQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrleehgdellecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgepfeenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho nhdrnhgvth 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 7614B3064686; Fri, 30 Oct 2020 13:44:58 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@intel.com, david.marchand@redhat.com, bruce.richardson@intel.com, olivier.matz@6wind.com, andrew.rybchenko@oktetlabs.ru, akhil.goyal@nxp.com, jerinj@marvell.com, Harry van Haaren Date: Fri, 30 Oct 2020 18:44:32 +0100 Message-Id: <20201030174441.1076264-7-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201030174441.1076264-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201030174441.1076264-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v6 06/15] event/sw: switch test counter to dynamic mbuf field 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The test worker_loopback used the deprecated mbuf field udata64. It is moved to a dynamic field in order to allow removal of udata64. Signed-off-by: Thomas Monjalon Reviewed-by: Andrew Rybchenko Acked-by: Harry van Haaren --- drivers/event/sw/sw_evdev_selftest.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/drivers/event/sw/sw_evdev_selftest.c b/drivers/event/sw/sw_evdev_selftest.c index 5c7e527917..0929fa68ef 100644 --- a/drivers/event/sw/sw_evdev_selftest.c +++ b/drivers/event/sw/sw_evdev_selftest.c @@ -40,6 +40,16 @@ struct test { uint32_t service_id; }; +typedef uint8_t counter_dynfield_t; +static int counter_dynfield_offset = -1; + +static inline counter_dynfield_t * +counter_field(struct rte_mbuf *mbuf) +{ + return RTE_MBUF_DYNFIELD(mbuf, \ + counter_dynfield_offset, counter_dynfield_t *); +} + static struct rte_event release_ev; static inline struct rte_mbuf * @@ -2987,8 +2997,8 @@ worker_loopback_worker_fn(void *arg) } ev[i].queue_id = 0; - ev[i].mbuf->udata64++; - if (ev[i].mbuf->udata64 != 16) { + (*counter_field(ev[i].mbuf))++; + if (*counter_field(ev[i].mbuf) != 16) { ev[i].op = RTE_EVENT_OP_FORWARD; enqd = rte_event_enqueue_burst(evdev, port, &ev[i], 1); @@ -3028,7 +3038,7 @@ worker_loopback_producer_fn(void *arg) m = rte_pktmbuf_alloc(t->mbuf_pool); } while (m == NULL); - m->udata64 = 0; + *counter_field(m) = 0; struct rte_event ev = { .op = RTE_EVENT_OP_NEW, @@ -3061,6 +3071,18 @@ worker_loopback(struct test *t, uint8_t disable_implicit_release) int err; int w_lcore, p_lcore; + static const struct rte_mbuf_dynfield counter_dynfield_desc = { + .name = "rte_event_sw_dynfield_selftest_counter", + .size = sizeof(counter_dynfield_t), + .align = __alignof__(counter_dynfield_t), + }; + counter_dynfield_offset = + rte_mbuf_dynfield_register(&counter_dynfield_desc); + if (counter_dynfield_offset < 0) { + printf("Error registering mbuf field\n"); + return -rte_errno; + } + if (init(t, 8, 2) < 0 || create_atomic_qids(t, 8) < 0) { printf("%d: Error initializing device\n", __LINE__); From patchwork Fri Oct 30 17:44:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82981 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E670BA04E6; Fri, 30 Oct 2020 18:47:14 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6409D5946; Fri, 30 Oct 2020 18:45:19 +0100 (CET) Received: from new2-smtp.messagingengine.com (new2-smtp.messagingengine.com [66.111.4.224]) by dpdk.org (Postfix) with ESMTP id B4FEC2BDB for ; Fri, 30 Oct 2020 18:45:02 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailnew.nyi.internal (Postfix) with ESMTP id 6B4AE580844; Fri, 30 Oct 2020 13:45:02 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 30 Oct 2020 13:45:02 -0400 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=fm2; bh=mKlEZpWa+INxK OAxmqTfNHwropb/kjkJIecE0tJRT9M=; b=M1IYjFRIGwQbE4XuLeAgOlENzWnjA 3U02VzT9P74sGwUqIEIC4kfJCb7C+NE8OdMF+Eq9PfAQ5A1t/vuhdQ6Am6ZpmOGm VQ85mQ4QYHnkU1HrozVofvmZa3ZYPZmoa00OPHjm+PtwQSMjxSNK4Ka9FkFPXnn6 1p+03uWAJ9d/Vmb2djOs68PWUPxLRSjEYLG4QnBuAzRzxVVhnskKE9ztSLtu9+OQ dCtuke9bfeeKAG95wui566aGNsuZwYS+TcFkIIp0ifGmkWEos2ILU9g5SMvdXBGB sh+QErodzHt4amHAJQK0jczq29oj8xD+EDiRuJ6vQa2UGhV5mAHkcKNjw== 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=mKlEZpWa+INxKOAxmqTfNHwropb/kjkJIecE0tJRT9M=; b=WjS2UvIC UdcSr2AeGBWKvt+0bqC4l47fo8Ik7iuk1wQ0Q24F6Xc+jh3ybY4yhkVzcMTq9/8l x6Es9iDexqo3P5HRg4Q/TkhbhqmsuD7HoPYIX3JG4TTnXHQA8oTPPR3oiiP52i16 jG5GyR0TmM43RIqt3Ev/ZC9YBVH5pKWl3i/zTt6401Z6VU1vj4QaewlPXR0k6s2E Ygc2RZkndP56hEpzQgiIAsd7O67zhFhM3dGgccNTOjOCTe2N7Z+EjmpNxZGzLDc0 ij5Ip9Yi1BbqzNXBkv3zqQ8ckburejqC36m78oXvlhe/sfIxxG881dxPQ5ynD0aG 0XaVVm4wEP1nPw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrleehgdellecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpeehjefhvdffueehieevuddvfeeigefhtddvvddtheehgfekfefhtdfh teffgeetueenucffohhmrghinheptghonhhfrdhinhenucfkphepjeejrddufeegrddvtd efrddukeegnecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilhhfrhho mhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth 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 3B3813064680; Fri, 30 Oct 2020 13:45:00 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@intel.com, david.marchand@redhat.com, bruce.richardson@intel.com, olivier.matz@6wind.com, andrew.rybchenko@oktetlabs.ru, akhil.goyal@nxp.com, jerinj@marvell.com, Ed Czeck , Shepard Siegel , John Miller , Ray Kinsella , Neil Horman Date: Fri, 30 Oct 2020 18:44:33 +0100 Message-Id: <20201030174441.1076264-8-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201030174441.1076264-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201030174441.1076264-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v6 07/15] net/ark: switch user data to dynamic mbuf fields 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Ed Czeck The second field of metadata is reserved for user data which was using a deprecated mbuf field. It is moved to dynamic fields in order to allow removal of udata64. The use of meta data must be enabled with a compile-time flag RTE_PMD_ARK_{TX,RX}_USERDATA_ENABLE. User data on Tx and Rx paths can be defined and used separately. Signed-off-by: Thomas Monjalon Signed-off-by: Ed Czeck --- doc/api/doxy-api-index.md | 1 + doc/api/doxy-api.conf.in | 1 + drivers/net/ark/ark_ethdev.c | 39 ++++++++++ drivers/net/ark/ark_ethdev_rx.c | 3 +- drivers/net/ark/ark_ethdev_tx.c | 3 +- drivers/net/ark/meson.build | 2 + drivers/net/ark/rte_pmd_ark.h | 125 ++++++++++++++++++++++++++++++++ drivers/net/ark/version.map | 7 ++ 8 files changed, 179 insertions(+), 2 deletions(-) create mode 100644 drivers/net/ark/rte_pmd_ark.h diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md index a9c12d1a2f..b865a51e8c 100644 --- a/doc/api/doxy-api-index.md +++ b/doc/api/doxy-api-index.md @@ -41,6 +41,7 @@ The public API headers are grouped by topics: [vhost] (@ref rte_vhost.h), [vdpa] (@ref rte_vdpa.h), [KNI] (@ref rte_kni.h), + [ark] (@ref rte_pmd_ark.h), [ixgbe] (@ref rte_pmd_ixgbe.h), [i40e] (@ref rte_pmd_i40e.h), [ice] (@ref rte_pmd_ice.h), diff --git a/doc/api/doxy-api.conf.in b/doc/api/doxy-api.conf.in index e37f8c2e80..c5b01a1814 100644 --- a/doc/api/doxy-api.conf.in +++ b/doc/api/doxy-api.conf.in @@ -8,6 +8,7 @@ INPUT = @TOPDIR@/doc/api/doxy-api-index.md \ @TOPDIR@/drivers/bus/vdev \ @TOPDIR@/drivers/crypto/scheduler \ @TOPDIR@/drivers/mempool/dpaa2 \ + @TOPDIR@/drivers/net/ark \ @TOPDIR@/drivers/net/bnxt \ @TOPDIR@/drivers/net/bonding \ @TOPDIR@/drivers/net/dpaa \ diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c index 168b3659d6..fa343999a1 100644 --- a/drivers/net/ark/ark_ethdev.c +++ b/drivers/net/ark/ark_ethdev.c @@ -10,6 +10,7 @@ #include #include +#include "rte_pmd_ark.h" #include "ark_global.h" #include "ark_logs.h" #include "ark_ethdev_tx.h" @@ -78,6 +79,9 @@ static int eth_ark_set_mtu(struct rte_eth_dev *dev, uint16_t size); #define ARK_TX_MAX_QUEUE (4096 * 4) #define ARK_TX_MIN_QUEUE (256) +int rte_pmd_ark_rx_userdata_dynfield_offset = -1; +int rte_pmd_ark_tx_userdata_dynfield_offset = -1; + static const char * const valid_arguments[] = { ARK_PKTGEN_ARG, ARK_PKTCHKR_ARG, @@ -245,6 +249,16 @@ eth_ark_dev_init(struct rte_eth_dev *dev) int ret; int port_count = 1; int p; + static const struct rte_mbuf_dynfield ark_tx_userdata_dynfield_desc = { + .name = RTE_PMD_ARK_TX_USERDATA_DYNFIELD_NAME, + .size = sizeof(rte_pmd_ark_tx_userdata_t), + .align = __alignof__(rte_pmd_ark_tx_userdata_t), + }; + static const struct rte_mbuf_dynfield ark_rx_userdata_dynfield_desc = { + .name = RTE_PMD_ARK_RX_USERDATA_DYNFIELD_NAME, + .size = sizeof(rte_pmd_ark_rx_userdata_t), + .align = __alignof__(rte_pmd_ark_rx_userdata_t), + }; ark->eth_dev = dev; @@ -254,6 +268,31 @@ eth_ark_dev_init(struct rte_eth_dev *dev) ret = check_for_ext(ark); if (ret) return ret; + + /* Extra mbuf fields for user data */ + if (RTE_PMD_ARK_TX_USERDATA_ENABLE) { + rte_pmd_ark_tx_userdata_dynfield_offset = + rte_mbuf_dynfield_register(&ark_tx_userdata_dynfield_desc); + if (rte_pmd_ark_tx_userdata_dynfield_offset < 0) { + ARK_PMD_LOG(ERR, + "Failed to register mbuf field for tx userdata\n"); + return -rte_errno; + } + ARK_PMD_LOG(INFO, "Registered TX-meta dynamic field at %d\n", + rte_pmd_ark_tx_userdata_dynfield_offset); + } + if (RTE_PMD_ARK_RX_USERDATA_ENABLE) { + rte_pmd_ark_rx_userdata_dynfield_offset = + rte_mbuf_dynfield_register(&ark_rx_userdata_dynfield_desc); + if (rte_pmd_ark_rx_userdata_dynfield_offset < 0) { + ARK_PMD_LOG(ERR, + "Failed to register mbuf field for rx userdata\n"); + return -rte_errno; + } + ARK_PMD_LOG(INFO, "Registered RX-meta dynamic field at %d\n", + rte_pmd_ark_rx_userdata_dynfield_offset); + } + pci_dev = RTE_ETH_DEV_TO_PCI(dev); rte_eth_copy_pci_info(dev, pci_dev); dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS; diff --git a/drivers/net/ark/ark_ethdev_rx.c b/drivers/net/ark/ark_ethdev_rx.c index 2f8d05099c..825b4791be 100644 --- a/drivers/net/ark/ark_ethdev_rx.c +++ b/drivers/net/ark/ark_ethdev_rx.c @@ -4,6 +4,7 @@ #include +#include "rte_pmd_ark.h" #include "ark_ethdev_rx.h" #include "ark_global.h" #include "ark_logs.h" @@ -272,7 +273,7 @@ eth_ark_recv_pkts(void *rx_queue, mbuf->pkt_len = meta->pkt_len; mbuf->data_len = meta->pkt_len; mbuf->timestamp = meta->timestamp; - mbuf->udata64 = meta->user_data; + rte_pmd_ark_mbuf_rx_userdata_set(mbuf, meta->user_data); if (ARK_DEBUG_CORE) { /* debug sanity checks */ if ((meta->pkt_len > (1024 * 16)) || diff --git a/drivers/net/ark/ark_ethdev_tx.c b/drivers/net/ark/ark_ethdev_tx.c index a0e35af880..612d918e33 100644 --- a/drivers/net/ark/ark_ethdev_tx.c +++ b/drivers/net/ark/ark_ethdev_tx.c @@ -4,6 +4,7 @@ #include +#include "rte_pmd_ark.h" #include "ark_ethdev_tx.h" #include "ark_global.h" #include "ark_mpu.h" @@ -70,7 +71,7 @@ eth_ark_tx_meta_from_mbuf(struct ark_tx_meta *meta, uint8_t flags) { meta->physaddr = rte_mbuf_data_iova(mbuf); - meta->user1 = (uint32_t)mbuf->udata64; + meta->user1 = rte_pmd_ark_mbuf_tx_userdata_get(mbuf); meta->data_len = rte_pktmbuf_data_len(mbuf); meta->flags = flags; } diff --git a/drivers/net/ark/meson.build b/drivers/net/ark/meson.build index 99151bba1d..80bce94e1a 100644 --- a/drivers/net/ark/meson.build +++ b/drivers/net/ark/meson.build @@ -1,6 +1,8 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2018 Intel Corporation +headers = files('rte_pmd_ark.h') + sources = files('ark_ddm.c', 'ark_ethdev.c', 'ark_ethdev_rx.c', diff --git a/drivers/net/ark/rte_pmd_ark.h b/drivers/net/ark/rte_pmd_ark.h new file mode 100644 index 0000000000..6f26d66b12 --- /dev/null +++ b/drivers/net/ark/rte_pmd_ark.h @@ -0,0 +1,125 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright (c) 2020 Atomic Rules LLC + */ + +#ifndef RTE_PMD_ARK_H +#define RTE_PMD_ARK_H + +/** + * @file + * ARK driver-specific API + */ + +#include +#include + +#ifndef RTE_PMD_ARK_TX_USERDATA_ENABLE +#define RTE_PMD_ARK_TX_USERDATA_ENABLE 0 +#endif + +#ifndef RTE_PMD_ARK_RX_USERDATA_ENABLE +#define RTE_PMD_ARK_RX_USERDATA_ENABLE 0 +#endif + +typedef uint32_t rte_pmd_ark_tx_userdata_t; +typedef uint64_t rte_pmd_ark_rx_userdata_t; + +extern int rte_pmd_ark_tx_userdata_dynfield_offset; +extern int rte_pmd_ark_rx_userdata_dynfield_offset; + +/** mbuf dynamic field for custom Tx ARK data */ +#define RTE_PMD_ARK_TX_USERDATA_DYNFIELD_NAME "rte_net_ark_dynfield_tx_userdata" +/** mbuf dynamic field for custom Rx ARK data */ +#define RTE_PMD_ARK_RX_USERDATA_DYNFIELD_NAME "rte_net_ark_dynfield_rx_userdata" + +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice + * + * Read Tx user data from mbuf. + * + * @param mbuf Structure to read from. + * @return user data + */ +__rte_experimental +static inline rte_pmd_ark_tx_userdata_t +rte_pmd_ark_mbuf_tx_userdata_get(const struct rte_mbuf *mbuf) +{ +#if RTE_PMD_ARK_TX_USERDATA_ENABLE + return *RTE_MBUF_DYNFIELD(mbuf, rte_pmd_ark_tx_userdata_dynfield_offset, + rte_pmd_ark_tx_userdata_t *); +#else + RTE_SET_USED(mbuf); + return 0; +#endif +} + +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice + * + * Write Tx user data to mbuf. + * + * @param mbuf Structure to write into. + * @param data User data. + */ +__rte_experimental +static inline void +rte_pmd_ark_mbuf_tx_userdata_set(struct rte_mbuf *mbuf, + rte_pmd_ark_tx_userdata_t data) +{ +#if RTE_PMD_ARK_TX_USERDATA_ENABLE + *RTE_MBUF_DYNFIELD(mbuf, rte_pmd_ark_tx_userdata_dynfield_offset, + rte_pmd_ark_tx_userdata_t *) = data; +#else + RTE_SET_USED(mbuf); + RTE_SET_USED(data); +#endif +} + +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice + * + * Read Rx user data from mbuf. + * + * @param mbuf Structure to read from. + * @return user data + */ +__rte_experimental +static inline rte_pmd_ark_rx_userdata_t +rte_pmd_ark_mbuf_rx_userdata_get(const struct rte_mbuf *mbuf) +{ +#if RTE_PMD_ARK_RX_USERDATA_ENABLE + return *RTE_MBUF_DYNFIELD(mbuf, rte_pmd_ark_rx_userdata_dynfield_offset, + rte_pmd_ark_rx_userdata_t *); +#else + RTE_SET_USED(mbuf); + return 0; +#endif +} + +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice + * + * Write Rx user data to mbuf. + * + * @param mbuf Structure to write into. + * @param data User data. + */ +__rte_experimental +static inline void +rte_pmd_ark_mbuf_rx_userdata_set(struct rte_mbuf *mbuf, + rte_pmd_ark_rx_userdata_t data) +{ +#if RTE_PMD_ARK_RX_USERDATA_ENABLE + *RTE_MBUF_DYNFIELD(mbuf, rte_pmd_ark_rx_userdata_dynfield_offset, + rte_pmd_ark_rx_userdata_t *) = data; +#else + RTE_SET_USED(mbuf); + RTE_SET_USED(data); +#endif +} + +#endif /* RTE_PMD_ARK_H */ diff --git a/drivers/net/ark/version.map b/drivers/net/ark/version.map index 4a76d1d52d..954bea6796 100644 --- a/drivers/net/ark/version.map +++ b/drivers/net/ark/version.map @@ -1,3 +1,10 @@ DPDK_21 { local: *; }; + +EXPERIMENTAL { + global: + + rte_pmd_ark_tx_userdata_dynfield_offset; + rte_pmd_ark_rx_userdata_dynfield_offset; +}; From patchwork Fri Oct 30 17:44:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82982 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A0B6BA04E6; Fri, 30 Oct 2020 18:47:30 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 379575A51; Fri, 30 Oct 2020 18:45:21 +0100 (CET) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id C26154CBD for ; Fri, 30 Oct 2020 18:45:04 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 796FA5C021F; Fri, 30 Oct 2020 13:45:04 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 30 Oct 2020 13:45:04 -0400 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=fm2; bh=vjz3RUMuHR5py H4Sy9RjqlR0bENy+QbAml/3GtVfI+4=; b=rQxSG0kEyw9z2mbqaC5PQlOM0tTsX rhN1/NBEp7CbceVWBo7O5ObWElOaj1c7GL0l4NITA3xFqj47U0mhUFtILA2/0P7h x2XGagO1bwVpIUKqtRaF8QukU4p55Alll3uRdxrZQ1MImKqhgITrZ5RfZ/lYGJBe 6nA+yDD6B6QxSlmL82nKtBWxmC7553/Xggx2FwaURiUeFoe3MAQJ4cd3xkWl4mg4 46lsU7gEHfEwMRppFcHSL8q4kjVq9FSAcSgnuKSel4Maa4dMdZOvclCNikOCJ1JB lgvbm+Hwrf4IMLeb3K7tsSIHrNVbkRBCcQuOBkdV58tMfcphYVIhk/PCQ== 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=vjz3RUMuHR5pyH4Sy9RjqlR0bENy+QbAml/3GtVfI+4=; b=YO7BVaB7 te+8bSLbS4wBcQUgveTUfB1fyaZoT0hCCI7GhO690tX9Q7v6rnL92YJlqXC4mz3S YazVocBFPzGBPcby+CVVTMWuV8IXM0zPYPyVXyObNnwxNbpxGS/PgQpm+Ru7xjTl 1IsVtz1FECp7qLpHb2nuHaKBdbp45BlcPYg/HormtXOhjHUAkHFTxfPjUIqmHdCO mgSTWUgtjX75Ld1NaoOzsEMp50etCKct0ysM8QviBtFCatM8fAJMWcz4KdGrOmfU rWi7ciQFZ9q3lq4AjXxX+P2roVdAELADntKSJL4KXT5METtubqBoteXgWbmixd/v 6NZ9mSzxGHjqmQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrleehgdellecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpeehgfejgefgueevgfevvdekgefffedtkeehgeffjeeigeefueffudff hfelffffudenucffohhmrghinhepfhguihhrrdhiugenucfkphepjeejrddufeegrddvtd efrddukeegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhho mhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth 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 2454E3064674; Fri, 30 Oct 2020 13:45:03 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@intel.com, david.marchand@redhat.com, bruce.richardson@intel.com, olivier.matz@6wind.com, andrew.rybchenko@oktetlabs.ru, akhil.goyal@nxp.com, jerinj@marvell.com, Ajit Khaparde , Somnath Kotur Date: Fri, 30 Oct 2020 18:44:34 +0100 Message-Id: <20201030174441.1076264-9-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201030174441.1076264-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201030174441.1076264-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v6 08/15] net/bnxt: switch CFA code to dynamic mbuf field 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The CFA code from mark was stored in the deprecated mbuf field udata64. It is moved to a dynamic field in order to allow removal of udata64. Note: the new field has 32 bits, smaller than udata64. Signed-off-by: Thomas Monjalon Acked-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_ethdev.c | 19 +++++++++++++++++++ drivers/net/bnxt/bnxt_rxr.c | 2 +- drivers/net/bnxt/bnxt_rxr.h | 10 ++++++++++ drivers/net/bnxt/rte_pmd_bnxt.h | 3 +++ 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 1c7d1b758d..f1350d39da 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -31,6 +31,7 @@ #include "bnxt_nvm_defs.h" #include "bnxt_tf_common.h" #include "ulp_flow_db.h" +#include "rte_pmd_bnxt.h" #define DRV_MODULE_NAME "bnxt" static const char bnxt_version[] = @@ -163,6 +164,8 @@ static const char *const bnxt_dev_args[] = { */ #define BNXT_DEVARG_REP_FC_F2R_INVALID(rep_fc_f2r) ((rep_fc_f2r) > 1) +int bnxt_cfa_code_dynfield_offset = -1; + /* * max_num_kflows must be >= 32 * and must be a power-of-2 supported value @@ -6021,6 +6024,22 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev, void *params __rte_unused) pci_dev->id.device_id == BROADCOM_DEV_ID_58802_VF) bp->flags |= BNXT_FLAG_STINGRAY; + if (BNXT_TRUFLOW_EN(bp)) { + /* extra mbuf field is required to store CFA code from mark */ + static const struct rte_mbuf_dynfield bnxt_cfa_code_dynfield_desc = { + .name = RTE_PMD_BNXT_CFA_CODE_DYNFIELD_NAME, + .size = sizeof(bnxt_cfa_code_dynfield_t), + .align = __alignof__(bnxt_cfa_code_dynfield_t), + }; + bnxt_cfa_code_dynfield_offset = + rte_mbuf_dynfield_register(&bnxt_cfa_code_dynfield_desc); + if (bnxt_cfa_code_dynfield_offset < 0) { + PMD_DRV_LOG(ERR, + "Failed to register mbuf field for TruFlow mark\n"); + return -rte_errno; + } + } + rc = bnxt_init_board(eth_dev); if (rc) { PMD_DRV_LOG(ERR, diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c index 039217fa60..2645ed61f4 100644 --- a/drivers/net/bnxt/bnxt_rxr.c +++ b/drivers/net/bnxt/bnxt_rxr.c @@ -606,7 +606,7 @@ bnxt_ulp_set_mark_in_mbuf(struct bnxt *bp, struct rx_pkt_cmpl_hi *rxcmp1, return mark_id; /* Got the mark, write it to the mbuf and return */ mbuf->hash.fdir.hi = mark_id; - mbuf->udata64 = (cfa_code & 0xffffffffull) << 32; + *bnxt_cfa_code_dynfield(mbuf) = cfa_code & 0xffffffffull; mbuf->hash.fdir.id = rxcmp1->cfa_code; mbuf->ol_flags |= PKT_RX_FDIR | PKT_RX_FDIR_ID; return mark_id; diff --git a/drivers/net/bnxt/bnxt_rxr.h b/drivers/net/bnxt/bnxt_rxr.h index b874e54a8c..f9e60d01c2 100644 --- a/drivers/net/bnxt/bnxt_rxr.h +++ b/drivers/net/bnxt/bnxt_rxr.h @@ -95,6 +95,16 @@ void bnxt_set_mark_in_mbuf(struct bnxt *bp, struct rx_pkt_cmpl_hi *rxcmp1, struct rte_mbuf *mbuf); +typedef uint32_t bnxt_cfa_code_dynfield_t; +extern int bnxt_cfa_code_dynfield_offset; + +static inline bnxt_cfa_code_dynfield_t * +bnxt_cfa_code_dynfield(struct rte_mbuf *mbuf) +{ + return RTE_MBUF_DYNFIELD(mbuf, + bnxt_cfa_code_dynfield_offset, bnxt_cfa_code_dynfield_t *); +} + #define BNXT_RX_META_CFA_CODE_SHIFT 19 #define BNXT_CFA_CODE_META_SHIFT 16 #define BNXT_RX_META_CFA_CODE_INT_ACT_REC_BIT 0x8000000 diff --git a/drivers/net/bnxt/rte_pmd_bnxt.h b/drivers/net/bnxt/rte_pmd_bnxt.h index 81d0d0e032..f538b6550e 100644 --- a/drivers/net/bnxt/rte_pmd_bnxt.h +++ b/drivers/net/bnxt/rte_pmd_bnxt.h @@ -9,6 +9,9 @@ #include #include +/** mbuf dynamic field where CFA code is stored */ +#define RTE_PMD_BNXT_CFA_CODE_DYNFIELD_NAME "rte_net_bnxt_dynfield_cfa_code" + /* * Response sent back to the caller after callback */ From patchwork Fri Oct 30 17:44:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82983 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6D07FA04E6; Fri, 30 Oct 2020 18:47:50 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1F5795AAE; Fri, 30 Oct 2020 18:45:23 +0100 (CET) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id BF6C05913 for ; Fri, 30 Oct 2020 18:45:06 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 7436A5C0221; Fri, 30 Oct 2020 13:45:06 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 30 Oct 2020 13:45:06 -0400 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=fm2; bh=1PIv/Ly/apQEX HhrzPrT/4w1V6sIZN9yh8eCG39yyOQ=; b=Q2jCVi/V6+8ILwMmGwQ7l970YY/nt L/W4SvMxqszDZVT8qmjIG3UaCGILAe2sYEmXLwTb92hK4HKM3HZkWv6YzwVI478K qdy9VL6+Tu+5xQucal6NKaolRgbRHeocv+rQFvEavmAhz9LXq3Icl5898wZoruzo QMIL5m3z6Ul/jCu9KpoQrLQXGtAv67Ktlo4F58ctHDpLd/SRYgLvgEdedLH2BfO4 q1TtvpMm5WF6Iqny/bUc1ClRUdRmEevlyDmsRCtfaYKwyB536QaNaxeJ/6ZxPFHZ 8Hkqqp9YxNIFd6/BqnvhRpoi0TKrXApQBhXcXueZ3r2idUPu3vep5xrhA== 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=1PIv/Ly/apQEXHhrzPrT/4w1V6sIZN9yh8eCG39yyOQ=; b=GxbL3Ydx aiDeLLz+MEWJhAXbV77tONO4Oq4WNbjF/KjivsW0TW6CYV9SWyyQrxhTXJpJKjNB /QGhNM5Fjsi7lvYKG/SayRZsLYHZw0H+riYLatAUoiT7x9XbKe9rNY6ya2EQ0jtc Zf3FiPfhGpu/BnrnSgm12AblHa5SKeex597pLCuDa+JdzdDV+NfonJsaLUhFqadI aWTAimKYT9mBxM/jizfr+MP7pw3cnrxSuYEM+e7nLpG+HQQouIF9W3qXknNiU2+p Jd4YkiOH0ohQjlewZydpiFkZ+gw4QMJBKC412cOUe8k5mlNpYf1fdPPZSB1EvY6a Pw4d7UtO4+moXw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrleehgdellecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgepieenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho nhdrnhgvth 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 4E19A3064610; Fri, 30 Oct 2020 13:45:05 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@intel.com, david.marchand@redhat.com, bruce.richardson@intel.com, olivier.matz@6wind.com, andrew.rybchenko@oktetlabs.ru, akhil.goyal@nxp.com, jerinj@marvell.com, Yong Wang Date: Fri, 30 Oct 2020 18:44:35 +0100 Message-Id: <20201030174441.1076264-10-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201030174441.1076264-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201030174441.1076264-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v6 09/15] net/vmxnet3: switch MSS hint to dynamic mbuf field 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The segment count, used for MSS guess, was stored in the deprecated mbuf field udata64. It is moved to a dynamic field in order to allow removal of udata64. Signed-off-by: Thomas Monjalon --- drivers/net/vmxnet3/vmxnet3_ethdev.c | 15 +++++++++++++++ drivers/net/vmxnet3/vmxnet3_ethdev.h | 11 +++++++++++ drivers/net/vmxnet3/vmxnet3_rxtx.c | 9 +++++---- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c index 6920ab568c..23a2ebbefa 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c @@ -59,6 +59,8 @@ DEV_RX_OFFLOAD_JUMBO_FRAME | \ DEV_RX_OFFLOAD_RSS_HASH) +int vmxnet3_segs_dynfield_offset = -1; + static int eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev); static int eth_vmxnet3_dev_uninit(struct rte_eth_dev *eth_dev); static int vmxnet3_dev_configure(struct rte_eth_dev *dev); @@ -233,6 +235,11 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev) struct vmxnet3_hw *hw = eth_dev->data->dev_private; uint32_t mac_hi, mac_lo, ver; struct rte_eth_link link; + static const struct rte_mbuf_dynfield vmxnet3_segs_dynfield_desc = { + .name = VMXNET3_SEGS_DYNFIELD_NAME, + .size = sizeof(vmxnet3_segs_dynfield_t), + .align = __alignof__(vmxnet3_segs_dynfield_t), + }; PMD_INIT_FUNC_TRACE(); @@ -242,6 +249,14 @@ eth_vmxnet3_dev_init(struct rte_eth_dev *eth_dev) eth_dev->tx_pkt_prepare = vmxnet3_prep_pkts; pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev); + /* extra mbuf field is required to guess MSS */ + vmxnet3_segs_dynfield_offset = + rte_mbuf_dynfield_register(&vmxnet3_segs_dynfield_desc); + if (vmxnet3_segs_dynfield_offset < 0) { + PMD_INIT_LOG(ERR, "Cannot register mbuf field."); + return -rte_errno; + } + /* * for secondary processes, we don't initialize any further as primary * has already done this work. diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.h b/drivers/net/vmxnet3/vmxnet3_ethdev.h index dd685b02b7..9d00f5d127 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.h +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.h @@ -193,4 +193,15 @@ uint16_t vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t vmxnet3_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts); +#define VMXNET3_SEGS_DYNFIELD_NAME "rte_net_vmxnet3_dynfield_segs" +typedef uint8_t vmxnet3_segs_dynfield_t; +extern int vmxnet3_segs_dynfield_offset; + +static inline vmxnet3_segs_dynfield_t * +vmxnet3_segs_dynfield(struct rte_mbuf *mbuf) +{ + return RTE_MBUF_DYNFIELD(mbuf, \ + vmxnet3_segs_dynfield_offset, vmxnet3_segs_dynfield_t *); +} + #endif /* _VMXNET3_ETHDEV_H_ */ diff --git a/drivers/net/vmxnet3/vmxnet3_rxtx.c b/drivers/net/vmxnet3/vmxnet3_rxtx.c index e10f9ee870..95c697f8e3 100644 --- a/drivers/net/vmxnet3/vmxnet3_rxtx.c +++ b/drivers/net/vmxnet3/vmxnet3_rxtx.c @@ -674,6 +674,7 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, struct rte_ipv6_hdr *ipv6_hdr; struct rte_tcp_hdr *tcp_hdr; char *ptr; + uint8_t segs; RTE_ASSERT(rcd->tcp); @@ -710,9 +711,9 @@ vmxnet3_guess_mss(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, tcp_hdr = (struct rte_tcp_hdr *)(ptr + hlen); hlen += (tcp_hdr->data_off & 0xf0) >> 2; - if (rxm->udata64 > 1) - return (rte_pktmbuf_pkt_len(rxm) - hlen + - rxm->udata64 - 1) / rxm->udata64; + segs = *vmxnet3_segs_dynfield(rxm); + if (segs > 1) + return (rte_pktmbuf_pkt_len(rxm) - hlen + segs - 1) / segs; else return hw->mtu - hlen + sizeof(struct rte_ether_hdr); } @@ -737,7 +738,7 @@ vmxnet3_rx_offload(struct vmxnet3_hw *hw, const Vmxnet3_RxCompDesc *rcd, (const Vmxnet3_RxCompDescExt *)rcd; rxm->tso_segsz = rcde->mss; - rxm->udata64 = rcde->segCnt; + *vmxnet3_segs_dynfield(rxm) = rcde->segCnt; ol_flags |= PKT_RX_LRO; } } else { /* Offloads set in eop */ From patchwork Fri Oct 30 17:44:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82984 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id F1446A04E6; Fri, 30 Oct 2020 18:48:08 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BB00E5B30; Fri, 30 Oct 2020 18:45:24 +0100 (CET) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id E0D63593A for ; Fri, 30 Oct 2020 18:45:08 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 936A65C01E2; Fri, 30 Oct 2020 13:45:08 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 30 Oct 2020 13:45:08 -0400 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=fm2; bh=YSvc5iUF215JO rEjqV2WVuhghD0tdgw9i1BG9IKS/ho=; b=tsUCwTZTfiL13xq0P7lqyOproyo52 awOqVI8IWSre6arhOqsyKlhGrZs2Kj8NGsTIC2qszO1Acshxs0TJVkDDP+8P4jhm qVJGHtHHiJE5yGE0CFIF8b/9zS9VeKhW4hnnMmWDmW6eQfqphIUENX4YgCjofdyZ 375hHAQmURArNh2cl6v9KKE9udWzOmerykmUrPnIvxozcAlUU2pyKTf8xEVCrk4y wQSChdwU8pHzZITZkFpj59xXkIxQG+3/VZf75ArBREcboO9DuvOiM5ucMT7OUJ84 cJ0+1RdxLcwdQSihcYvRS0uK6PwjgL0SYk6T6/Dg4SYqTXwFzlblStcPQ== 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=YSvc5iUF215JOrEjqV2WVuhghD0tdgw9i1BG9IKS/ho=; b=dvAtMo+w /1fW1KwNHdOQ+LWlMg1K2fdkoijOA3I7cee5TA4krhTMPxhWObEvHssyB5PqZwK3 VWKSr7ReWNMODGzaIV020GbhNH7+BFzIJdZ108TROeftT9522VY277ReA4UqHNoK xt1TPGgf2/88HWRawuEQODEC5lcAQdR/wJM5Jak19ZcAfNBwONHNPfoEohAYiNah ohMJgcyZMgwGLv6sGl7EWA8n1H4scATON6vd69oiL3zzFkr0s5M+XII8bss0xKlM t764DnGlqe+0kRYx1hZVTOe9tB+zduhxNLMaZfD73cff6jbKi2wbBoL6Hj3zRgh8 iBh7D/imY1/g3g== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrleehgdellecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgepieenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho nhdrnhgvth 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 2A5463064674; Fri, 30 Oct 2020 13:45:07 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@intel.com, david.marchand@redhat.com, bruce.richardson@intel.com, olivier.matz@6wind.com, andrew.rybchenko@oktetlabs.ru, akhil.goyal@nxp.com, jerinj@marvell.com, Lukasz Wojciechowski , David Hunt Date: Fri, 30 Oct 2020 18:44:36 +0100 Message-Id: <20201030174441.1076264-11-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201030174441.1076264-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201030174441.1076264-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v6 10/15] test/distributor: switch sequence to dynamic mbuf field 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The test used the deprecated mbuf field udata64. It is moved to a dynamic field in order to allow removal of udata64. Signed-off-by: Thomas Monjalon Acked-by: Lukasz Wojciechowski Tested-by: Lukasz Wojciechowski --- app/test/test_distributor.c | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c index eb889b91d1..f4c6229f16 100644 --- a/app/test/test_distributor.c +++ b/app/test/test_distributor.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -17,6 +18,15 @@ #define BURST 32 #define BIG_BATCH 1024 +typedef uint32_t seq_dynfield_t; +static int seq_dynfield_offset = -1; + +static inline seq_dynfield_t * +seq_field(struct rte_mbuf *mbuf) +{ + return RTE_MBUF_DYNFIELD(mbuf, seq_dynfield_offset, seq_dynfield_t *); +} + struct worker_params { char name[64]; struct rte_distributor *dist; @@ -578,7 +588,7 @@ handle_and_mark_work(void *arg) __atomic_fetch_add(&worker_stats[id].handled_packets, num, __ATOMIC_RELAXED); for (i = 0; i < num; i++) - buf[i]->udata64 += id + 1; + *seq_field(buf[i]) += id + 1; num = rte_distributor_get_pkt(db, id, buf, buf, num); } @@ -631,10 +641,10 @@ sanity_mark_test(struct worker_params *wp, struct rte_mempool *p) << shift; } /* Assign a sequence number to each packet. The sequence is shifted, - * so that lower bits of the udate64 will hold mark from worker. + * so that lower bits will hold mark from worker. */ for (i = 0; i < buf_count; i++) - bufs[i]->udata64 = i << seq_shift; + *seq_field(bufs[i]) = i << seq_shift; count = 0; for (i = 0; i < buf_count/burst; i++) { @@ -660,8 +670,8 @@ sanity_mark_test(struct worker_params *wp, struct rte_mempool *p) /* Sort returned packets by sent order (sequence numbers). */ for (i = 0; i < buf_count; i++) { - seq = returns[i]->udata64 >> seq_shift; - id = returns[i]->udata64 - (seq << seq_shift); + seq = *seq_field(returns[i]) >> seq_shift; + id = *seq_field(returns[i]) - (seq << seq_shift); sorted[seq] = id; } @@ -805,6 +815,18 @@ test_distributor(void) static struct rte_mempool *p; int i; + static const struct rte_mbuf_dynfield seq_dynfield_desc = { + .name = "test_distributor_dynfield_seq", + .size = sizeof(seq_dynfield_t), + .align = __alignof__(seq_dynfield_t), + }; + seq_dynfield_offset = + rte_mbuf_dynfield_register(&seq_dynfield_desc); + if (seq_dynfield_offset < 0) { + printf("Error registering mbuf field\n"); + return TEST_FAILED; + } + if (rte_lcore_count() < 2) { printf("Not enough cores for distributor_autotest, expecting at least 2\n"); return TEST_SKIPPED; From patchwork Fri Oct 30 17:44:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82985 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 133F1A04E6; Fri, 30 Oct 2020 18:48:30 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7482668C0; Fri, 30 Oct 2020 18:45:26 +0100 (CET) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id E4D52593A for ; Fri, 30 Oct 2020 18:45:10 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 909A55C0221; Fri, 30 Oct 2020 13:45:10 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 30 Oct 2020 13:45:10 -0400 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=fm2; bh=ZFwkqnbsSvl5x KbM7SjmZejNOt0jMYWYHsRuYeaaTVE=; b=nPhDvlHC7aWfjiFgNh28WckiT1CIt p+B2soFs4zRRpHe+klOSVz6sUu5TjgSNP+/CGOaJ15jnEcGF9yAKp0L2TM6Gcgj9 YmTG9rgTz5CYBZ3yKnmsxHkgj73bgeWXPRNXB5112ZaUZxTuF7vqrE391E7MLX9K F/OYB//L9BlCHyvQiMYb8JJyK7cZ2YuSXR11/ucE3pbplheF5uM1emvWbV0EL8JV +RD+29W5elSGIkp9cBzSC/A9hLwX7E/H2nun6Ocwtn4E2IJSvXr6mlUF872ktgoV T+VAq0dlvuJ3/PwYSYb6CeqFfv+YucMEFIDvOgvD6xGIMi8uQKEJ8Qs1w== 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=ZFwkqnbsSvl5xKbM7SjmZejNOt0jMYWYHsRuYeaaTVE=; b=rN0DFGzr ldgreSXspvf7JUHm06Qz+sX5UBeIGcv6sviK0fYpnaTD2ThJdfu+5hS7gAfEEMLk 0niDCcRZHXq1R5aQlhmRE15bQWN7uP5hhmEzzWyEwokd3O9KQSW6vC/8I/9lKtFl QOKvXyqP8XPVIQag/FkPMUCzQTYlxf+q1fkhKhi9RhHr1OdkiFDNzkl910zKLFWT ynLZhVyETggECUffJxS9qlsqnGyanjOyZ77YjACsA7i331uflx1u3bkj1KXqpYKw AsUXRryopgBnllYIfoP4AXc55DPqhqKWUgxKcSaG9KFtH0mbeoXv+JOtpYdD/zUo U3l68WS4ONvJig== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrleehgdellecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgepieenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho nhdrnhgvth 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 49C7D3064680; Fri, 30 Oct 2020 13:45:09 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@intel.com, david.marchand@redhat.com, bruce.richardson@intel.com, olivier.matz@6wind.com, andrew.rybchenko@oktetlabs.ru, akhil.goyal@nxp.com, jerinj@marvell.com, Kiran Kumar K , Nithin Dabilpuram Date: Fri, 30 Oct 2020 18:44:37 +0100 Message-Id: <20201030174441.1076264-12-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201030174441.1076264-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201030174441.1076264-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v6 11/15] test/graph: switch user data to dynamic mbuf field 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The test used the deprecated mbuf field udata64. It is moved to a dynamic field in order to allow removal of udata64. Signed-off-by: Thomas Monjalon --- app/test/test_graph.c | 99 ++++++++++++++++++++++++++----------------- 1 file changed, 61 insertions(+), 38 deletions(-) diff --git a/app/test/test_graph.c b/app/test/test_graph.c index ed69eda997..81bdcb9bea 100644 --- a/app/test/test_graph.c +++ b/app/test/test_graph.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include "test.h" @@ -39,6 +40,16 @@ static uint16_t test_node3_worker(struct rte_graph *graph, #define MBUFF_SIZE 512 #define MAX_NODES 4 +typedef uint64_t graph_dynfield_t; +static int graph_dynfield_offset = -1; + +static inline graph_dynfield_t * +graph_field(struct rte_mbuf *mbuf) +{ + return RTE_MBUF_DYNFIELD(mbuf, \ + graph_dynfield_offset, graph_dynfield_t *); +} + static struct rte_mbuf mbuf[MAX_NODES + 1][MBUFF_SIZE]; static void *mbuf_p[MAX_NODES + 1][MBUFF_SIZE]; static rte_graph_t graph_id; @@ -162,9 +173,9 @@ test_node_worker_source(struct rte_graph *graph, struct rte_node *node, next_stream = rte_node_next_stream_get(graph, node, next, obj_node0); for (i = 0; i < obj_node0; i++) { data = &mbuf[0][i]; - data->udata64 = ((uint64_t)tm->test_node[0].idx << 32) | i; + *graph_field(data) = ((uint64_t)tm->test_node[0].idx << 32) | i; if ((i + 1) == obj_node0) - data->udata64 |= (1 << 16); + *graph_field(data) |= (1 << 16); next_stream[i] = &mbuf[0][i]; } rte_node_next_stream_put(graph, node, next, obj_node0); @@ -175,9 +186,9 @@ test_node_worker_source(struct rte_graph *graph, struct rte_node *node, next_stream = rte_node_next_stream_get(graph, node, next, obj_node1); for (i = 0; i < obj_node1; i++) { data = &mbuf[0][obj_node0 + i]; - data->udata64 = ((uint64_t)tm->test_node[1].idx << 32) | i; + *graph_field(data) = ((uint64_t)tm->test_node[1].idx << 32) | i; if ((i + 1) == obj_node1) - data->udata64 |= (1 << 16); + *graph_field(data) |= (1 << 16); next_stream[i] = &mbuf[0][obj_node0 + i]; } @@ -205,23 +216,23 @@ test_node0_worker(struct rte_graph *graph, struct rte_node *node, void **objs, for (i = 0; i < nb_objs; i++) { data = (struct rte_mbuf *)objs[i]; - if ((data->udata64 >> 32) != tm->test_node[0].idx) { + if ((*graph_field(data) >> 32) != tm->test_node[0].idx) { printf("Data idx miss match at node 0, expected" " = %u got = %u\n", tm->test_node[0].idx, - (uint32_t)(data->udata64 >> 32)); + (uint32_t)(*graph_field(data) >> 32)); goto end; } - if ((data->udata64 & 0xffff) != (i - count)) { + if ((*graph_field(data) & 0xffff) != (i - count)) { printf("Expected buff count miss match at " "node 0\n"); goto end; } - if (data->udata64 & (0x1 << 16)) + if (*graph_field(data) & (0x1 << 16)) count = i + 1; - if (data->udata64 & (0x1 << 17)) + if (*graph_field(data) & (0x1 << 17)) second_pass = 1; } @@ -233,12 +244,12 @@ test_node0_worker(struct rte_graph *graph, struct rte_node *node, void **objs, obj_node0 = nb_objs * obj_node0 * 0.01; for (i = 0; i < obj_node0; i++) { data = &mbuf[1][i]; - data->udata64 = + *graph_field(data) = ((uint64_t)tm->test_node[1].idx << 32) | i; if ((i + 1) == obj_node0) - data->udata64 |= (1 << 16); + *graph_field(data) |= (1 << 16); if (second_pass) - data->udata64 |= (1 << 17); + *graph_field(data) |= (1 << 17); } rte_node_enqueue(graph, node, 0, (void **)&mbuf_p[1][0], obj_node0); @@ -246,12 +257,12 @@ test_node0_worker(struct rte_graph *graph, struct rte_node *node, void **objs, obj_node1 = nb_objs - obj_node0; for (i = 0; i < obj_node1; i++) { data = &mbuf[1][obj_node0 + i]; - data->udata64 = + *graph_field(data) = ((uint64_t)tm->test_node[2].idx << 32) | i; if ((i + 1) == obj_node1) - data->udata64 |= (1 << 16); + *graph_field(data) |= (1 << 16); if (second_pass) - data->udata64 |= (1 << 17); + *graph_field(data) |= (1 << 17); } rte_node_enqueue(graph, node, 1, (void **)&mbuf_p[1][obj_node0], obj_node1); @@ -285,22 +296,22 @@ test_node1_worker(struct rte_graph *graph, struct rte_node *node, void **objs, fn_calls[2] += 1; for (i = 0; i < nb_objs; i++) { data = (struct rte_mbuf *)objs[i]; - if ((data->udata64 >> 32) != tm->test_node[1].idx) { + if ((*graph_field(data) >> 32) != tm->test_node[1].idx) { printf("Data idx miss match at node 1, expected = %u" " got = %u\n", tm->test_node[1].idx, - (uint32_t)(data->udata64 >> 32)); + (uint32_t)(*graph_field(data) >> 32)); goto end; } - if ((data->udata64 & 0xffff) != (i - count)) { + if ((*graph_field(data) & 0xffff) != (i - count)) { printf("Expected buff count miss match at node 1\n"); goto end; } - if (data->udata64 & (0x1 << 16)) + if (*graph_field(data) & (0x1 << 16)) count = i + 1; - if (data->udata64 & (0x1 << 17)) + if (*graph_field(data) & (0x1 << 17)) second_pass = 1; } @@ -312,11 +323,11 @@ test_node1_worker(struct rte_graph *graph, struct rte_node *node, void **objs, obj_node0 = nb_objs; for (i = 0; i < obj_node0; i++) { data = &mbuf[2][i]; - data->udata64 = ((uint64_t)tm->test_node[2].idx << 32) | i; + *graph_field(data) = ((uint64_t)tm->test_node[2].idx << 32) | i; if ((i + 1) == obj_node0) - data->udata64 |= (1 << 16); + *graph_field(data) |= (1 << 16); if (second_pass) - data->udata64 |= (1 << 17); + *graph_field(data) |= (1 << 17); } rte_node_enqueue(graph, node, 0, (void **)&mbuf_p[2][0], obj_node0); @@ -339,22 +350,22 @@ test_node2_worker(struct rte_graph *graph, struct rte_node *node, void **objs, fn_calls[3] += 1; for (i = 0; i < nb_objs; i++) { data = (struct rte_mbuf *)objs[i]; - if ((data->udata64 >> 32) != tm->test_node[2].idx) { + if ((*graph_field(data) >> 32) != tm->test_node[2].idx) { printf("Data idx miss match at node 2, expected = %u" " got = %u\n", tm->test_node[2].idx, - (uint32_t)(data->udata64 >> 32)); + (uint32_t)(*graph_field(data) >> 32)); goto end; } - if ((data->udata64 & 0xffff) != (i - count)) { + if ((*graph_field(data) & 0xffff) != (i - count)) { printf("Expected buff count miss match at node 2\n"); goto end; } - if (data->udata64 & (0x1 << 16)) + if (*graph_field(data) & (0x1 << 16)) count = i + 1; - if (data->udata64 & (0x1 << 17)) + if (*graph_field(data) & (0x1 << 17)) second_pass = 1; } @@ -367,10 +378,10 @@ test_node2_worker(struct rte_graph *graph, struct rte_node *node, void **objs, obj_node0 = nb_objs; for (i = 0; i < obj_node0; i++) { data = &mbuf[3][i]; - data->udata64 = + *graph_field(data) = ((uint64_t)tm->test_node[3].idx << 32) | i; if ((i + 1) == obj_node0) - data->udata64 |= (1 << 16); + *graph_field(data) |= (1 << 16); } rte_node_enqueue(graph, node, 0, (void **)&mbuf_p[3][0], obj_node0); @@ -395,22 +406,22 @@ test_node3_worker(struct rte_graph *graph, struct rte_node *node, void **objs, fn_calls[4] += 1; for (i = 0; i < nb_objs; i++) { data = (struct rte_mbuf *)objs[i]; - if ((data->udata64 >> 32) != tm->test_node[3].idx) { + if ((*graph_field(data) >> 32) != tm->test_node[3].idx) { printf("Data idx miss match at node 3, expected = %u" " got = %u\n", tm->test_node[3].idx, - (uint32_t)(data->udata64 >> 32)); + (uint32_t)(*graph_field(data) >> 32)); goto end; } - if ((data->udata64 & 0xffff) != (i - count)) { + if ((*graph_field(data) & 0xffff) != (i - count)) { printf("Expected buff count miss match at node 3\n"); goto end; } - if (data->udata64 & (0x1 << 16)) + if (*graph_field(data) & (0x1 << 16)) count = i + 1; - if (data->udata64 & (0x1 << 17)) + if (*graph_field(data) & (0x1 << 17)) second_pass = 1; } @@ -426,11 +437,11 @@ test_node3_worker(struct rte_graph *graph, struct rte_node *node, void **objs, obj_node0 = nb_objs * 2; for (i = 0; i < obj_node0; i++) { data = &mbuf[4][i]; - data->udata64 = + *graph_field(data) = ((uint64_t)tm->test_node[0].idx << 32) | i; - data->udata64 |= (1 << 17); + *graph_field(data) |= (1 << 17); if ((i + 1) == obj_node0) - data->udata64 |= (1 << 16); + *graph_field(data) |= (1 << 16); } rte_node_enqueue(graph, node, 0, (void **)&mbuf_p[4][0], obj_node0); @@ -765,6 +776,18 @@ graph_setup(void) { int i, j; + static const struct rte_mbuf_dynfield graph_dynfield_desc = { + .name = "test_graph_dynfield", + .size = sizeof(graph_dynfield_t), + .align = __alignof__(graph_dynfield_t), + }; + graph_dynfield_offset = + rte_mbuf_dynfield_register(&graph_dynfield_desc); + if (graph_dynfield_offset < 0) { + printf("Cannot register mbuf field\n"); + return TEST_FAILED; + } + for (i = 0; i <= MAX_NODES; i++) { for (j = 0; j < MBUFF_SIZE; j++) mbuf_p[i][j] = &mbuf[i][j]; From patchwork Fri Oct 30 17:44:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82986 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4E2F9A04E6; Fri, 30 Oct 2020 18:48:50 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 22F3A69C8; Fri, 30 Oct 2020 18:45:28 +0100 (CET) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id 91D3D593A for ; Fri, 30 Oct 2020 18:45:12 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 48BE35C021F; Fri, 30 Oct 2020 13:45:12 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 30 Oct 2020 13:45:12 -0400 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=fm2; bh=HhLwf0w4DGO4G rUYkzhR7OWJ7zfGCnjW/SYxuiDy6eY=; b=QzhH0+/9DHxxQesD3pKLk3Mf081Jg cePr4VRYblniQCONpS1av9xhgk8DfhNLVUpQcLQAv+cmqJ2C76GYCkL+mt2CqVtn 8Pfx3BjVi0DGCcd3JdJurajlD/Ri+hIANpcRt7hVJe9lUQliGdw/J6GlVRdOHG7g ycLaAtBXzsXLC1kOx2r+hhyPUNwL7PgHj41xnCefoUdHuuMTQBAOVaCt40bsvWJn JYaVXkpMDrH3/9d+Rwy0EwbnOg/ZQlppPbnOiUgGDs1mkum32wkAJBLe+t+hywm7 q8mP0LXV27/ZCR9MSJh5Tcb+MKDfUa1WrCw+4DD0AuCRqgynHC4IgDNKA== 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=HhLwf0w4DGO4GrUYkzhR7OWJ7zfGCnjW/SYxuiDy6eY=; b=kQkvN3JC XIz7A0Cze3rurcgTPgN03arpCEKZTMmnb08g4QlASLfwE26so3no8co3g2+WbGmv tZpVWV1nAT/BL9R0NZe5Sq3nm+inkWHP+4S4hIhtWJrjVJ/+/8Mb4/qDSsbnGWl5 7G5Lw1HdNcFWPoAhVfFc72D7TtMB3idUc2wVRkpUFUaRgoaKncvhm7f4XYNzaqkO i9Ij68kw+30bPA4DKSb0JfUiLFnQHDEKNSsIxxPUWS+XAF/+KJRLy73j3FSKeZtT rtEcr3X49mXQJ+61b69dyWD80lN3lGysTOUqgYUyRbXpQ/xXgWGdUUeQR1hDikT1 HRLAOnrF0d2zlg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrleehgdellecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpefvhhhomhgrshcuofhonhhjrghlohhnuceothhhohhmrghssehm ohhnjhgrlhhonhdrnhgvtheqnecuggftrfgrthhtvghrnhepvdehgfeivdejgedtveehfe fhteelfefgieevgfffveefjeegtdfguedthedtgeevnecukfhppeejjedrudefgedrvddt fedrudekgeenucevlhhushhtvghrufhiiigvpeelnecurfgrrhgrmhepmhgrihhlfhhroh hmpehthhhomhgrshesmhhonhhjrghlohhnrdhnvght 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 4666E3064674; Fri, 30 Oct 2020 13:45:11 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@intel.com, david.marchand@redhat.com, bruce.richardson@intel.com, olivier.matz@6wind.com, andrew.rybchenko@oktetlabs.ru, akhil.goyal@nxp.com, jerinj@marvell.com Date: Fri, 30 Oct 2020 18:44:38 +0100 Message-Id: <20201030174441.1076264-13-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201030174441.1076264-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201030174441.1076264-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v6 12/15] app/eventdev: switch flow ID to dynamic mbuf field 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The order test stored the flow ID in the deprecated mbuf field udata64. It is moved to a dynamic field in order to allow removal of udata64. Signed-off-by: Thomas Monjalon --- app/test-eventdev/test_order_atq.c | 4 ++-- app/test-eventdev/test_order_common.c | 21 +++++++++++++++------ app/test-eventdev/test_order_common.h | 21 +++++++++++++++++++++ app/test-eventdev/test_order_queue.c | 4 ++-- 4 files changed, 40 insertions(+), 10 deletions(-) diff --git a/app/test-eventdev/test_order_atq.c b/app/test-eventdev/test_order_atq.c index cfcb1dc4e9..71215a07b6 100644 --- a/app/test-eventdev/test_order_atq.c +++ b/app/test-eventdev/test_order_atq.c @@ -35,7 +35,7 @@ order_atq_worker(void *arg, const bool flow_id_cap) } if (!flow_id_cap) - ev.flow_id = ev.mbuf->udata64; + order_flow_id_copy_from_mbuf(t, &ev); if (ev.sub_event_type == 0) { /* stage 0 from producer */ order_atq_process_stage_0(&ev); @@ -72,7 +72,7 @@ order_atq_worker_burst(void *arg, const bool flow_id_cap) for (i = 0; i < nb_rx; i++) { if (!flow_id_cap) - ev[i].flow_id = ev[i].mbuf->udata64; + order_flow_id_copy_from_mbuf(t, &ev[i]); if (ev[i].sub_event_type == 0) { /*stage 0 */ order_atq_process_stage_0(&ev[i]); diff --git a/app/test-eventdev/test_order_common.c b/app/test-eventdev/test_order_common.c index dc55d93921..01a44bcd75 100644 --- a/app/test-eventdev/test_order_common.c +++ b/app/test-eventdev/test_order_common.c @@ -46,13 +46,10 @@ order_producer(void *arg) if (m == NULL) continue; - const uint32_t flow = (uintptr_t)m % nb_flows; + const flow_id_t flow = (uintptr_t)m % nb_flows; /* Maintain seq number per flow */ m->seqn = producer_flow_seq[flow]++; - m->udata64 = flow; - - ev.flow_id = flow; - ev.mbuf = m; + order_flow_id_save(t, flow, m, &ev); while (rte_event_enqueue_burst(dev_id, port, &ev, 1) != 1) { if (t->err) @@ -138,6 +135,12 @@ int order_test_setup(struct evt_test *test, struct evt_options *opt) { void *test_order; + struct test_order *t; + static const struct rte_mbuf_dynfield flow_id_dynfield_desc = { + .name = "test_event_dynfield_flow_id", + .size = sizeof(flow_id_t), + .align = __alignof__(flow_id_t), + }; test_order = rte_zmalloc_socket(test->name, sizeof(struct test_order), RTE_CACHE_LINE_SIZE, opt->socket_id); @@ -146,8 +149,14 @@ order_test_setup(struct evt_test *test, struct evt_options *opt) goto nomem; } test->test_priv = test_order; + t = evt_test_priv(test); - struct test_order *t = evt_test_priv(test); + t->flow_id_dynfield_offset = + rte_mbuf_dynfield_register(&flow_id_dynfield_desc); + if (t->flow_id_dynfield_offset < 0) { + evt_err("failed to register mbuf field"); + return -rte_errno; + } t->producer_flow_seq = rte_zmalloc_socket("test_producer_flow_seq", sizeof(*t->producer_flow_seq) * opt->nb_flows, diff --git a/app/test-eventdev/test_order_common.h b/app/test-eventdev/test_order_common.h index e0fe9c968a..90eac96fc8 100644 --- a/app/test-eventdev/test_order_common.h +++ b/app/test-eventdev/test_order_common.h @@ -13,6 +13,7 @@ #include #include #include +#include #include "evt_common.h" #include "evt_options.h" @@ -20,6 +21,8 @@ #define BURST_SIZE 16 +typedef uint32_t flow_id_t; + struct test_order; struct worker_data { @@ -49,6 +52,7 @@ struct test_order { uint32_t nb_flows; uint64_t nb_pkts; struct rte_mempool *pool; + int flow_id_dynfield_offset; struct prod_data prod; struct worker_data worker[EVT_MAX_PORTS]; uint32_t *producer_flow_seq; @@ -56,6 +60,23 @@ struct test_order { struct evt_options *opt; } __rte_cache_aligned; +static inline void +order_flow_id_copy_from_mbuf(struct test_order *t, struct rte_event *event) +{ + event->flow_id = *RTE_MBUF_DYNFIELD(event->mbuf, + t->flow_id_dynfield_offset, flow_id_t *); +} + +static inline void +order_flow_id_save(struct test_order *t, flow_id_t flow_id, + struct rte_mbuf *mbuf, struct rte_event *event) +{ + *RTE_MBUF_DYNFIELD(mbuf, + t->flow_id_dynfield_offset, flow_id_t *) = flow_id; + event->flow_id = flow_id; + event->mbuf = mbuf; +} + static inline int order_nb_event_ports(struct evt_options *opt) { diff --git a/app/test-eventdev/test_order_queue.c b/app/test-eventdev/test_order_queue.c index 1511c0092d..621367805a 100644 --- a/app/test-eventdev/test_order_queue.c +++ b/app/test-eventdev/test_order_queue.c @@ -35,7 +35,7 @@ order_queue_worker(void *arg, const bool flow_id_cap) } if (!flow_id_cap) - ev.flow_id = ev.mbuf->udata64; + order_flow_id_copy_from_mbuf(t, &ev); if (ev.queue_id == 0) { /* from ordered queue */ order_queue_process_stage_0(&ev); @@ -73,7 +73,7 @@ order_queue_worker_burst(void *arg, const bool flow_id_cap) for (i = 0; i < nb_rx; i++) { if (!flow_id_cap) - ev[i].flow_id = ev[i].mbuf->udata64; + order_flow_id_copy_from_mbuf(t, &ev[i]); if (ev[i].queue_id == 0) { /* from ordered queue */ order_queue_process_stage_0(&ev[i]); From patchwork Fri Oct 30 17:44:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82987 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B359AA04E6; Fri, 30 Oct 2020 18:49:11 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D20556A1A; Fri, 30 Oct 2020 18:45:29 +0100 (CET) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id CE5FB593A for ; Fri, 30 Oct 2020 18:45:14 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 849575C0222; Fri, 30 Oct 2020 13:45:14 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 30 Oct 2020 13:45:14 -0400 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=fm2; bh=J3RBE1bgeb3gm u4FInGoS6XAPQG+HMuKP2wilUMhvWI=; b=OKz/lXnFI2kUgJEhjrZzAFEuCy0Fr 4j+IHYJH/tU3koXf04tp3+Q4qIWEeF8gbh4+uTXL7SbIfVJRCGLh2vDckmf4Z6dj 9xLmqWg1Q+HszjjXd7Yr8a65dkPW9LYNOO1x7N0S8z6cjarQA8QxikXFli49Kx+J 7EXWLdXDqb7ZepGlaxYzl/NTZw6nZIn8jpcNa7coKRRFqWJ4BjBZl4oKHP3TaSen OlJ4d4TYuqpaOlx5il5MeSA2ViKJRr/tTKz01EvYhK/+qfbOG+P7LVdBtE1fM0SJ 1UoUYNnil5WuHnOrPoz2POFYAl1GbcgA3zvFFuOEQfAFnUMvqYDKGFB3Q== 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=J3RBE1bgeb3gmu4FInGoS6XAPQG+HMuKP2wilUMhvWI=; b=r7tkPfqb UrV4erYO/XMz0Ly8ClIkYhmUYZ6b9vF1aCCi5WNwCLGLOsEUBi5qGod8KbAeliDf 1+jMrcjC31xIj4YQQb+a0Uxx4zoqQr1xAqhZ2N4cLIOi1FO0zr08aYN5H+K5RHxo mS1kwl55VOjsm6Z95yS0t/+j8h5jcS80M3n3yszkalUbOofdViGs8shArlA/v8Qj Do4o5/viinjRXaAigrAdM7fqLbW7FykJSI6JhUg81FYJTh33a8a3N9LWuRYqIdEJ +7UV993ubumf2MuJejLuAfmNER0pOxI5ZHLAfjZ8bfNa7WnLjwX0bK/CQvvL+bIq pf1DTiLupiUDzw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrleehgdellecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgepleenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho nhdrnhgvth 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 24F5B3064674; Fri, 30 Oct 2020 13:45:13 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@intel.com, david.marchand@redhat.com, bruce.richardson@intel.com, olivier.matz@6wind.com, andrew.rybchenko@oktetlabs.ru, akhil.goyal@nxp.com, jerinj@marvell.com, Nicolas Chautru Date: Fri, 30 Oct 2020 18:44:39 +0100 Message-Id: <20201030174441.1076264-14-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201030174441.1076264-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201030174441.1076264-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v6 13/15] examples/bbdev: switch to dynamic mbuf field 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The example used the deprecated mbuf field udata64 as input mbuf pointer. It is moved to a dynamic field in order to allow removal of udata64. Signed-off-by: Thomas Monjalon Reviewed-by: Andrew Rybchenko --- examples/bbdev_app/main.c | 42 +++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c index e512c807cd..2e170caf84 100644 --- a/examples/bbdev_app/main.c +++ b/examples/bbdev_app/main.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -59,6 +60,15 @@ } \ } while (0) +static int input_dynfield_offset = -1; + +static inline struct rte_mbuf ** +mbuf_input(struct rte_mbuf *mbuf) +{ + return RTE_MBUF_DYNFIELD(mbuf, + input_dynfield_offset, struct rte_mbuf **); +} + static const struct rte_eth_conf port_conf = { .rxmode = { .mq_mode = ETH_MQ_RX_NONE, @@ -294,11 +304,11 @@ pktmbuf_free_bulk(struct rte_mbuf **mbufs, unsigned int nb_to_free) } static inline void -pktmbuf_userdata_free_bulk(struct rte_mbuf **mbufs, unsigned int nb_to_free) +pktmbuf_input_free_bulk(struct rte_mbuf **mbufs, unsigned int nb_to_free) { unsigned int i; for (i = 0; i < nb_to_free; ++i) { - struct rte_mbuf *rx_pkt = mbufs[i]->userdata; + struct rte_mbuf *rx_pkt = *mbuf_input(mbufs[i]); rte_pktmbuf_free(rx_pkt); rte_pktmbuf_free(mbufs[i]); } @@ -429,7 +439,7 @@ verify_data(struct rte_mbuf **mbufs, uint16_t num_pkts) uint16_t i; for (i = 0; i < num_pkts; ++i) { struct rte_mbuf *out = mbufs[i]; - struct rte_mbuf *in = out->userdata; + struct rte_mbuf *in = *mbuf_input(out); if (memcmp(rte_pktmbuf_mtod_offset(in, uint8_t *, sizeof(struct rte_ether_hdr)), @@ -731,7 +741,7 @@ run_encoding(struct lcore_conf *lcore_conf) rte_pktmbuf_data_len(rx_pkts_burst[i]) - sizeof(struct rte_ether_hdr); /* save input mbuf pointer for later comparison */ - enc_out_pkts[i]->userdata = rx_pkts_burst[i]; + *mbuf_input(enc_out_pkts[i]) = rx_pkts_burst[i]; /* copy ethernet header */ rte_pktmbuf_reset(enc_out_pkts[i]); @@ -775,7 +785,7 @@ run_encoding(struct lcore_conf *lcore_conf) nb_enq = rte_bbdev_enqueue_enc_ops(bbdev_id, enc_queue_id, bbdev_ops_burst, nb_rx); if (unlikely(nb_enq < nb_rx)) { - pktmbuf_userdata_free_bulk(&enc_out_pkts[nb_enq], + pktmbuf_input_free_bulk(&enc_out_pkts[nb_enq], nb_rx - nb_enq); rte_bbdev_enc_op_free_bulk(&bbdev_ops_burst[nb_enq], nb_rx - nb_enq); @@ -805,7 +815,7 @@ run_encoding(struct lcore_conf *lcore_conf) nb_sent = rte_ring_enqueue_burst(enc_to_dec_ring, (void **)enc_out_pkts, nb_deq, NULL); if (unlikely(nb_sent < nb_deq)) { - pktmbuf_userdata_free_bulk(&enc_out_pkts[nb_sent], + pktmbuf_input_free_bulk(&enc_out_pkts[nb_sent], nb_deq - nb_sent); lcore_stats->enc_to_dec_lost_packets += nb_deq - nb_sent; } @@ -842,7 +852,7 @@ run_decoding(struct lcore_conf *lcore_conf) if (unlikely(rte_bbdev_dec_op_alloc_bulk(bbdev_op_pool, bbdev_ops_burst, nb_recv) != 0)) { - pktmbuf_userdata_free_bulk(recv_pkts_burst, nb_recv); + pktmbuf_input_free_bulk(recv_pkts_burst, nb_recv); lcore_stats->rx_lost_packets += nb_recv; return; } @@ -871,7 +881,7 @@ run_decoding(struct lcore_conf *lcore_conf) nb_enq = rte_bbdev_enqueue_dec_ops(bbdev_id, bbdev_queue_id, bbdev_ops_burst, nb_recv); if (unlikely(nb_enq < nb_recv)) { - pktmbuf_userdata_free_bulk(&recv_pkts_burst[nb_enq], + pktmbuf_input_free_bulk(&recv_pkts_burst[nb_enq], nb_recv - nb_enq); rte_bbdev_dec_op_free_bulk(&bbdev_ops_burst[nb_enq], nb_recv - nb_enq); @@ -898,12 +908,12 @@ run_decoding(struct lcore_conf *lcore_conf) /* Free the RX mbufs after verification */ for (i = 0; i < nb_deq; ++i) - rte_pktmbuf_free(recv_pkts_burst[i]->userdata); + rte_pktmbuf_free(*mbuf_input(recv_pkts_burst[i])); /* Transmit the packets */ nb_tx = rte_eth_tx_burst(port_id, tx_queue_id, recv_pkts_burst, nb_deq); if (unlikely(nb_tx < nb_deq)) { - pktmbuf_userdata_free_bulk(&recv_pkts_burst[nb_tx], + pktmbuf_input_free_bulk(&recv_pkts_burst[nb_tx], nb_deq - nb_tx); lcore_stats->tx_lost_packets += nb_deq - nb_tx; } @@ -1046,6 +1056,12 @@ main(int argc, char **argv) bool stats_thread_started = false; unsigned int main_lcore_id = rte_get_main_lcore(); + static const struct rte_mbuf_dynfield input_dynfield_desc = { + .name = "example_bbdev_dynfield_input", + .size = sizeof(struct rte_mbuf *), + .align = __alignof__(struct rte_mbuf *), + }; + rte_atomic16_init(&global_exit_flag); sigret = signal(SIGTERM, signal_handler); @@ -1115,6 +1131,12 @@ main(int argc, char **argv) if (bbdev_mbuf_mempool == NULL) rte_exit(EXIT_FAILURE, "Cannot create ethdev mbuf mempool\n"); + /* register mbuf field to store input pointer */ + input_dynfield_offset = + rte_mbuf_dynfield_register(&input_dynfield_desc); + if (input_dynfield_offset < 0) + rte_exit(EXIT_FAILURE, "Cannot register mbuf field\n"); + /* initialize ports */ ret = initialize_ports(&app_params, ethdev_mbuf_mempool); From patchwork Fri Oct 30 17:44:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82988 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 28E56A04E6; Fri, 30 Oct 2020 18:49:30 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 765492BFF; Fri, 30 Oct 2020 18:45:43 +0100 (CET) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id 9690A5946 for ; Fri, 30 Oct 2020 18:45:16 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 4A04A5C0226; Fri, 30 Oct 2020 13:45:16 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 30 Oct 2020 13:45:16 -0400 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=fm2; bh=tiaM3Au73WwaT RdFqBkQJUsMMBTubovz+d2J0K8CACE=; b=lxWZufSviUJGwmcPsw+XXyOkHx7bB k5sYEol8Nn8O5LxFij0PzfaZ6d3dIjUi34XZtLZXvjVAvRpYekPlCh4mSMmgQH7w bY9DeSGA/1dQx879QyB8gXJGqt9MTWvwwGGWcafBEIZBNSnRi4WSwzYHqWiN5ik4 SP0YJNchqxtK+jvkaenzyxoJkMJZo6c3JcGdzF4tS79IPfTX+NOXZ5//oj778pyM RGWPvoBi5L5zcS/1Rkjae0PgJa/74P41FfHtqS0N43FQd6r4DKC4ohqAc928QNn1 HR7UN3Qw2nRVT1VvJkjapMHaqhFyeG7A7C4zh/WTsQodwHOD18e8yjDHQ== 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=tiaM3Au73WwaTRdFqBkQJUsMMBTubovz+d2J0K8CACE=; b=WnEmioXz ecg9US1oloFHZdS66HL94r3kY1K8EWUn34vt54kg6/01dues7iG0/3q9hrBGqeps S9AwucatAyJz1M4QnvjnESCiV6psHiH1KXXt+ek/nPD/2P3CYOPykuKQal4rEQLa lSBqZpMiNzssq+bwPccfWFbpKtt9p8qpQShvuXru42gg2zdoMLzqTrizj4asIh3d WwnIj/+2rwe91WY2faXznUlh0u9teoqD4EAnb59URdfQ6UL5N+e3hD3ZjTwNWzjW RQROls3KsrE15awzgelDaIlbBN39aIawWYVPkgVpnDzqqcjb2u5wt5MDbVPX5kNa bKTA9I4WzhIPvA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrleehgdellecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgepleenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho nhdrnhgvth 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 39FF43064674; Fri, 30 Oct 2020 13:45:15 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@intel.com, david.marchand@redhat.com, bruce.richardson@intel.com, olivier.matz@6wind.com, andrew.rybchenko@oktetlabs.ru, akhil.goyal@nxp.com, jerinj@marvell.com, John McNamara Date: Fri, 30 Oct 2020 18:44:40 +0100 Message-Id: <20201030174441.1076264-15-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201030174441.1076264-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201030174441.1076264-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v6 14/15] examples/rxtx_callbacks: switch TSC to dynamic field 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The example used the deprecated mbuf field udata64. It is moved to a dynamic field in order to allow removal of udata64. Signed-off-by: Thomas Monjalon --- doc/guides/sample_app_ug/rxtx_callbacks.rst | 4 ++-- examples/rxtx_callbacks/main.c | 24 +++++++++++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/doc/guides/sample_app_ug/rxtx_callbacks.rst b/doc/guides/sample_app_ug/rxtx_callbacks.rst index 62d1f39d7e..344446290b 100644 --- a/doc/guides/sample_app_ug/rxtx_callbacks.rst +++ b/doc/guides/sample_app_ug/rxtx_callbacks.rst @@ -152,7 +152,7 @@ all packets received: uint64_t now = rte_rdtsc(); for (i = 0; i < nb_pkts; i++) - pkts[i]->udata64 = now; + *tsc_field(pkts[i]) = now; return nb_pkts; } @@ -179,7 +179,7 @@ packets prior to transmission: unsigned i; for (i = 0; i < nb_pkts; i++) - cycles += now - pkts[i]->udata64; + cycles += now - *tsc_field(pkts[i]); latency_numbers.total_cycles += cycles; latency_numbers.total_pkts += nb_pkts; diff --git a/examples/rxtx_callbacks/main.c b/examples/rxtx_callbacks/main.c index 6fe39546dd..1a8e7d47d9 100644 --- a/examples/rxtx_callbacks/main.c +++ b/examples/rxtx_callbacks/main.c @@ -10,6 +10,7 @@ #include #include #include +#include #define RX_RING_SIZE 1024 #define TX_RING_SIZE 1024 @@ -18,6 +19,15 @@ #define MBUF_CACHE_SIZE 250 #define BURST_SIZE 32 +typedef uint64_t tsc_t; +static int tsc_dynfield_offset = -1; + +static inline tsc_t * +tsc_field(struct rte_mbuf *mbuf) +{ + return RTE_MBUF_DYNFIELD(mbuf, tsc_dynfield_offset, tsc_t *); +} + static const char usage[] = "%s EAL_ARGS -- [-t]\n"; @@ -47,7 +57,7 @@ add_timestamps(uint16_t port __rte_unused, uint16_t qidx __rte_unused, uint64_t now = rte_rdtsc(); for (i = 0; i < nb_pkts; i++) - pkts[i]->udata64 = now; + *tsc_field(pkts[i]) = now; return nb_pkts; } @@ -65,7 +75,7 @@ calc_latency(uint16_t port, uint16_t qidx __rte_unused, rte_eth_read_clock(port, &ticks); for (i = 0; i < nb_pkts; i++) { - cycles += now - pkts[i]->udata64; + cycles += now - *tsc_field(pkts[i]); if (hw_timestamping) queue_ticks += ticks - pkts[i]->timestamp; } @@ -261,6 +271,11 @@ main(int argc, char *argv[]) }; int opt, option_index; + static const struct rte_mbuf_dynfield tsc_dynfield_desc = { + .name = "example_bbdev_dynfield_tsc", + .size = sizeof(tsc_t), + .align = __alignof__(tsc_t), + }; /* init EAL */ int ret = rte_eal_init(argc, argv); @@ -292,6 +307,11 @@ main(int argc, char *argv[]) if (mbuf_pool == NULL) rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n"); + tsc_dynfield_offset = + rte_mbuf_dynfield_register(&tsc_dynfield_desc); + if (tsc_dynfield_offset < 0) + rte_exit(EXIT_FAILURE, "Cannot register mbuf field\n"); + /* initialize all ports */ RTE_ETH_FOREACH_DEV(portid) if (port_init(portid, mbuf_pool) != 0) From patchwork Fri Oct 30 17:44:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82989 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7D559A04E6; Fri, 30 Oct 2020 18:49:48 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BAAED6A6F; Fri, 30 Oct 2020 18:45:44 +0100 (CET) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id D24455953 for ; Fri, 30 Oct 2020 18:45:18 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 88CF85C01A3; Fri, 30 Oct 2020 13:45:18 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 30 Oct 2020 13:45:18 -0400 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=fm2; bh=eLyw5qV9xwuy0 gAhRVSGsWhtnJcQtq52JbUjAnuadJk=; b=u6p9+K93x0jaR89bD5/qNZXLBrp3x +Ncg1hFIdnBYvoszCRqeThTDSYH0Wh6fqsV8be7duWvsunDcKZUEUFrulo/6ucHt G+V6D7LTvM8OXMaaekrzAxF7IhltGq6K/D15vxbe3oH895l6Lu+EvvSJkkmVwOhf rggEQOPt2NIHZAMrvRaMM2oF+FSP3kkHyV7qt+xSHhVH3K7iLGnxLcDBlJkW78Jx 8pVwSN3aLfx5cyB29Tfxxtr0saeipBC89l1pFPPYqe8fmxACicN7YY6bb58CHuwE RBm+rvWIbrfJoqBqfMCjnEFoUKND96UTpeMCsuFrPzwoXkKw2evEXzfnA== 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=eLyw5qV9xwuy0gAhRVSGsWhtnJcQtq52JbUjAnuadJk=; b=rLlfip7I RuD5Qol15pE/ps+2ClAqGP8Bt5bbnZHwlxmjNLLPuGN32d/SovHJGDa2HS/y6CRf FsNio84taUGgcyr7YxO6Ud5P2eOL+gv9IRlGWRWn/0MRwzh0ZPkQgWyXboP/zWpv qKKjIg7NjFiBH8HFrqJuiaFllnhSJ9o58jGKhXLOKZyAP82DDHovvdCpCExL2t4G KwGvBVrDJ1SsrPh1Lh1Nb1w1TeCZN8m+xTZKsrPk5tnVYw1ThK5ON5+IL8qIWhdF zVMgHr1mszUxtWL043X+FqtzHPS573D73beA3Qx5fDPZZ0kSsTomQUHp28VFXaVW ygKG/R+xhZVO3A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrleehgdellecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgepuddvnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl ohhnrdhnvght 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 4868A306467D; Fri, 30 Oct 2020 13:45:17 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@intel.com, david.marchand@redhat.com, bruce.richardson@intel.com, olivier.matz@6wind.com, andrew.rybchenko@oktetlabs.ru, akhil.goyal@nxp.com, jerinj@marvell.com, Ray Kinsella , Neil Horman Date: Fri, 30 Oct 2020 18:44:41 +0100 Message-Id: <20201030174441.1076264-16-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201030174441.1076264-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201030174441.1076264-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v6 15/15] mbuf: remove userdata field 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" As announced in the deprecation note, the field userdata / udata64 is removed to give more space to the dynamic fields. This is how the mbuf layout looks like (pahole-style): word type name byte size 0 void * buf_addr; /* 0 + 8 */ 1 rte_iova_t buf_iova /* 8 + 8 */ /* --- RTE_MARKER64 rearm_data; */ 2 uint16_t data_off; /* 16 + 2 */ uint16_t refcnt; /* 18 + 2 */ uint16_t nb_segs; /* 20 + 2 */ uint16_t port; /* 22 + 2 */ 3 uint64_t ol_flags; /* 24 + 8 */ /* --- RTE_MARKER rx_descriptor_fields1; */ 4 uint32_t union packet_type; /* 32 + 4 */ uint32_t pkt_len; /* 36 + 4 */ 5 uint16_t data_len; /* 40 + 2 */ uint16_t vlan_tci; /* 42 + 2 */ 5.5 uint64_t union hash; /* 44 + 8 */ 6.5 uint16_t vlan_tci_outer; /* 52 + 2 */ uint16_t buf_len; /* 54 + 2 */ 7 uint64_t timestamp; /* 56 + 8 */ /* --- RTE_MARKER cacheline1; */ 8 struct rte_mempool * pool; /* 64 + 8 */ 9 struct rte_mbuf * next; /* 72 + 8 */ 10 uint64_t union tx_offload; /* 80 + 8 */ 11 uint16_t priv_size; /* 88 + 2 */ uint16_t timesync; /* 90 + 2 */ uint32_t seqn; /* 92 + 4 */ 12 struct rte_mbuf_ext_shared_info * shinfo; /* 96 + 8 */ 13 uint64_t dynfield1[3]; /* 104 + 24 */ 16 /* --- END 128 */ Signed-off-by: Thomas Monjalon Acked-by: Olivier Matz --- doc/guides/rel_notes/deprecation.rst | 1 - doc/guides/rel_notes/release_20_11.rst | 3 +++ lib/librte_kni/rte_kni_common.h | 2 +- lib/librte_mbuf/rte_mbuf_core.h | 8 +------- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index 2e082499b8..0f6f1df12a 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -87,7 +87,6 @@ Deprecation Notices The following static fields will be moved as dynamic: - ``timestamp`` - - ``userdata`` / ``udata64`` - ``seqn`` As a consequence, the layout of the ``struct rte_mbuf`` will be re-arranged, diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst index bae39b2dd0..70cefb6d07 100644 --- a/doc/guides/rel_notes/release_20_11.rst +++ b/doc/guides/rel_notes/release_20_11.rst @@ -442,6 +442,9 @@ API Changes the structures ``rte_mbuf`` and ``rte_mbuf_ext_shared_info``. The field ``refcnt`` is remaining from the old unions. +* mbuf: Removed the unioned fields ``userdata`` and ``udata64`` + from the structure ``rte_mbuf``. It is replaced with dynamic fields. + * pci: Removed the ``rte_kernel_driver`` enum defined in rte_dev.h and replaced with a private enum in the PCI subsystem. diff --git a/lib/librte_kni/rte_kni_common.h b/lib/librte_kni/rte_kni_common.h index 21b477f0aa..36d66e2ffa 100644 --- a/lib/librte_kni/rte_kni_common.h +++ b/lib/librte_kni/rte_kni_common.h @@ -86,7 +86,7 @@ struct rte_kni_mbuf { uint16_t data_len; /**< Amount of data in segment buffer. */ /* fields on second cache line */ - char pad3[8] __attribute__((__aligned__(RTE_CACHE_LINE_MIN_SIZE))); + __attribute__((__aligned__(RTE_CACHE_LINE_MIN_SIZE))) void *pool; void *next; /**< Physical address of next mbuf in kernel. */ }; diff --git a/lib/librte_mbuf/rte_mbuf_core.h b/lib/librte_mbuf/rte_mbuf_core.h index 065d87d28a..a65eaaf692 100644 --- a/lib/librte_mbuf/rte_mbuf_core.h +++ b/lib/librte_mbuf/rte_mbuf_core.h @@ -599,12 +599,6 @@ struct rte_mbuf { /* second cache line - fields only used in slow path or on TX */ RTE_MARKER cacheline1 __rte_cache_min_aligned; - RTE_STD_C11 - union { - void *userdata; /**< Can be used for external metadata */ - uint64_t udata64; /**< Allow 8-byte userdata on 32-bit */ - }; - struct rte_mempool *pool; /**< Pool from which mbuf was allocated. */ struct rte_mbuf *next; /**< Next segment of scattered packet. */ @@ -662,7 +656,7 @@ struct rte_mbuf { */ struct rte_mbuf_ext_shared_info *shinfo; - uint64_t dynfield1[2]; /**< Reserved for dynamic fields. */ + uint64_t dynfield1[3]; /**< Reserved for dynamic fields. */ } __rte_cache_aligned; /**