From patchwork Tue Oct 27 21:01:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82366 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 DC79EA04B5; Tue, 27 Oct 2020 22:01:42 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 452892BF9; Tue, 27 Oct 2020 22:01:32 +0100 (CET) Received: from new1-smtp.messagingengine.com (new1-smtp.messagingengine.com [66.111.4.221]) by dpdk.org (Postfix) with ESMTP id 49D8C2BF7 for ; Tue, 27 Oct 2020 22:01:30 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailnew.nyi.internal (Postfix) with ESMTP id 9204B58012D; Tue, 27 Oct 2020 17:01:28 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 27 Oct 2020 17:01:28 -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=utT25ffjUJ4jh zKp5ZYTAZjjQ8wN3LUlWb45ZAjLSW4=; b=DeZodNVT5yguoRMe5OzqEqy6p/FXO c6L1wkEKpqpXWFPLMu0nf4+9UMvEdaIr5SOoFpRF/nIKdgbI8I/vW+Jveo4NuPD/ wi/0s71fgI8nnHuJZm+b1dnLdpAED94PQVJgaxy6ngeqWNC1PgR8Zw90SbSrm9bH MDzX17mc8GOIsBU4B6KIXW9cQFJ9PFTPhB0izLuQFyya4fow73gULuArCNtPZUDj /SxLoiTDV2bpqZq/PEYc+xido2tpDVojcVW8WX1eXYlzOIRYTq8FPWu5cFBZjFR+ ImF5te/JhnoT70iic9o8H4YB+3gTFysPsax51EEfA6KG74nftR50JtUdg== 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=utT25ffjUJ4jhzKp5ZYTAZjjQ8wN3LUlWb45ZAjLSW4=; b=eozowYIM y7D5PY/0LphS/foJrjfmpUYXi6YqElN1aT2kUlZ9gLGFt3eUclmn5Yr1X+zlsbEG H0pX+KMvEUL5wd3gT7o2+6D+sSch4XugA+8UEWExSymLegEAO0Oa6VS5Go/gcsiC jc37pvNElMmaccR9lkehalV32nCS9XLp+BHUeI1UkVEJubEHljDrg5TI1637+RF4 ke1T9nrMOWF/zny6tIlNq5WcWXDjY99vr3AhdMxr5WL6h4tD6lLTLBF66nMmCOmi Hjx1Buej2/gpmhu41TU/+yQzltUAN4JDCGjJjTDRkQYgFwvCcI3Hgjp1haoZmI9f se0nswrvypa0Jw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrkeelgddugeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepvdehgfeivdejgedtveehfefhteelfefgieevgfffveefjeegtdfg uedthedtgeevnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf hiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl 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 0CCB6328005A; Tue, 27 Oct 2020 17:01:26 -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, Nicolas Chautru , Chas Williams , "Min Hu (Connor)" , Xiaoyun Li Date: Tue, 27 Oct 2020 22:01:01 +0100 Message-Id: <20201027210115.2529025-2-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201027210115.2529025-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201027210115.2529025-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 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 ++++------ examples/tep_termination/vxlan_setup.c | 2 +- 3 files changed, 20 insertions(+), 23 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) diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c index 4b44ccc143..0bcd870b4a 100644 --- a/examples/tep_termination/vxlan_setup.c +++ b/examples/tep_termination/vxlan_setup.c @@ -18,9 +18,9 @@ #include #include #include +#include #include "main.h" -#include "rte_vhost.h" #include "vxlan.h" #include "vxlan_setup.h" From patchwork Tue Oct 27 21:01:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82367 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 16723A04B5; Tue, 27 Oct 2020 22:02:09 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5A3162C2E; Tue, 27 Oct 2020 22:01:39 +0100 (CET) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by dpdk.org (Postfix) with ESMTP id 63E4B2C2D for ; Tue, 27 Oct 2020 22:01:37 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 0AD7B5C0118; Tue, 27 Oct 2020 17:01:36 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 27 Oct 2020 17:01:36 -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=jms7atduLp8ClNwxgSvs/TSybg8C+ MfbHPpouCErsofNAwlxxsHnLQVmz7Ike/dIX2NE9Qva0x/muHfS6a87Gw+S0Sz0X bm1hNxOdrGjA8VvNyBWSdwjvlzDsUu4kQmNsE5FfobonBT/TqnMOk1F6CjvsPTuF 3xJUwtgsPYK7m7WW/gvYnCLVLJ5EKEJC9b5AbznS4o/4gDKcHH0TDZYPTYm6PhQs euK6GA52pR7e8+4jkdrQ6rMfr9oQwYrzfNztCyghyhBJqIa7Ph73m+HXUGl/TMw/ OY1lCTvC+XH5+yNa0bcE1QzGZlDmmESh3008so64oyJlLLpoTF0dhNxbg== 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=hqyOckk5 +G5upTJGd7J9PI0vbC+BjhkiDtidth3scs5Ara2neomxyNkgq6Uc/2TKJWWkAU7x wifZdtwsSiJuSFoTZY6ZDuvI+/dACI9NYhtH+Ht9QAC1YhGsnprXuU8TFYTuP/Uh Ozl4gScU4Lj4jpjMv+LL0/NmlitWHmzCNlA3is85A8tgkWtVFjBsz1uBJ7rLStMz djcKZOV9n3msWywKHIdzE+0u5U7W7BkNqi3byeIwX7hlFXYPqs4cCI0lzXC+GzdQ LorQjaq4sC0wFZJflFu3hQ+Gon6E2E2syFoCBz4m788Hk4LeyJn6XZMLRJ+9h28s 0Hgjsl34y8zCUg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrkeelgddugeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomhepvfhhohhmrghsucfoohhnjhgrlhhonhcuoehthhhomhgrshes mhhonhhjrghlohhnrdhnvghtqeenucggtffrrghtthgvrhhnpedvhefgiedvjeegtdevhe efhfetleefgfeivefgffevfeejgedtgfeutdehtdegveenucfkphepjeejrddufeegrddv tdefrddukeegnecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilhhfrh homhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth 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 0B1CD3280060; Tue, 27 Oct 2020 17:01:34 -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 Date: Tue, 27 Oct 2020 22:01:02 +0100 Message-Id: <20201027210115.2529025-3-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201027210115.2529025-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201027210115.2529025-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 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 Tue Oct 27 21:01:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82368 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 CA195A04B5; Tue, 27 Oct 2020 22:02:30 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0D2082E8D; Tue, 27 Oct 2020 22:01:43 +0100 (CET) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by dpdk.org (Postfix) with ESMTP id 42EA62E1E; Tue, 27 Oct 2020 22:01:39 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id DB2835C00C1; Tue, 27 Oct 2020 17:01:38 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 27 Oct 2020 17:01:38 -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=Q+btjpNCg7WJ424APGw3Mr0LjREqF +5jyloXF5FiE4Ij4SQ/XaNxMkMVMuoKHrcJ5O0IaYf0Wb54/Jyq+p3Qvypnou8Re hzm2W+rgahJSZva8mDNvx1st05KvejPRq2bpwzM/JoXYmb4+kRzJJrtYlbrNZrCC Vmtw6grnOjdPVtMkuSKXEvRzDEv3jzBjjk+z2F4nDNPK4BnVD1DqRhN+4SQ654GY jmJ0RIoYecalq7ddX1XbJc6K0LZ365GpvKhS4BnTlchU60AClPS3wBO0TDWCl71B p5lFMwuFht8IUj7o+QErjN0Xet35tNNOROeO65DqVQb6uPfQLSwl7ZP5w== 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=EreBS47e IOWXTBWUAlgwCoXsmgZmVBMyjXeXYP+WKIHVOmtmPnCdDizpKWC9d+sAMuRHOezB TUfcRmjZjggZlTjJZbVq/xE9ZxKYqqHfVYhVOOZgQnh6ieYKF92y3jSccSPH7Rnt Bdrxg03VqYDB7BefGo6LFOiBUEqizg9jmLoL+CsY5A8r2mIbO38nbk7ETudgMoWG F27LGVKerABMvmoWCVM4gZZ2SGArTzeiWZFUeCkLxa+zX3yuABjELXJV58PxgQsu /hsm053Fe58JzvJFCu0/8P0maE+Z28Jz6NPQhQO4bc4++r9mvehr6Gu85d2ow8GN YWDh0zHuuWiRHA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrkeelgddugeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepvdehgfeivdejgedtveehfefhteelfefgieevgfffveefjeegtdfg uedthedtgeevnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf hiiigvpedvnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl 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 6206B328005D; Tue, 27 Oct 2020 17:01:37 -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, stable@dpdk.org, Konstantin Ananyev Date: Tue, 27 Oct 2020 22:01:03 +0100 Message-Id: <20201027210115.2529025-4-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201027210115.2529025-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201027210115.2529025-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 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 Tue Oct 27 21:01:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82369 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 E0963A04B5; Tue, 27 Oct 2020 22:02:53 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CF9FD377E; Tue, 27 Oct 2020 22:01:46 +0100 (CET) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by dpdk.org (Postfix) with ESMTP id 61A432E1E for ; Tue, 27 Oct 2020 22:01:42 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 13DEA5C0114; Tue, 27 Oct 2020 17:01:41 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 27 Oct 2020 17:01:41 -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=QJdXpZU2oQc/L yG6lujnevqgmy9iPf8wUnvIRPL1toE=; b=FhMIZiqaG2vgtEFDNUV3y/K5/HMA8 2rhQ8K/bUuOEZQGk8O6o8L0IgdwKTu1aofI4bD3JGCI6VwOWMhQQP8bFcMmN4bXU 2OzpjAseC5qLoHNbJ2KqcwNDiPvueRH1GMiBXfw3bvLZIvFXHC5/yIPGUgWs4zY6 RKkB1NWHgAHat3O5KiFs+aEG11UPip2kR3vUkmpOaFRqxhQaO3otR5LdE1DM34wZ 9zz+AJoCe6aQYky6l0xaU85xDfNYGqBv0r4PCmE0390RprcyRD88aA+JXv3jda6/ xZvYbCfh3G6qAOLsE0ZzPeK7x5E7vdhJzNAukkg+svLIIZBTJo5l9sZwA== 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=QJdXpZU2oQc/LyG6lujnevqgmy9iPf8wUnvIRPL1toE=; b=jr6QAgUW 8CcLucEinl2jOZrtx6OHDbA+Hr+pyWwGpkdQwI9PmpekEcVT+WQ0Ar3HyR/IlW4/ vOfjHRcZBRMQRy/+YtcQTN4cfP9OvchN64qwX2iGBDX75lsX4uUwmPf0eohpKMwv 4PH+zVH+Q3DZJhisVIyzH4Pg7hMsz80zzEytJ+iZ0Cfp2w7OyLMfMsdxSaK+QVSH 2WsY1x0cse9OuHFkjXTG/smvDtCkOuP/M8lBwj8yMqYC8iWvs58i0Gnymo06UxTO u4m1Ct93FOL7eYStBEc9UikzAvEEinTmHIE7JFka0sJ3xa3Rf8rATopuIBplZlcB 1xjQSAymVGhHCw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrkeelgddugeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepvdehgfeivdejgedtveehfefhteelfefgieevgfffveefjeegtdfg uedthedtgeevnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf hiiigvpedvnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl 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 E04BE328005A; Tue, 27 Oct 2020 17:01:39 -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, Nithin Dabilpuram , Pavan Nikhilesh Date: Tue, 27 Oct 2020 22:01:04 +0100 Message-Id: <20201027210115.2529025-5-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201027210115.2529025-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201027210115.2529025-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 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" 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. WARNING: this change should be replaced with another solution proposed by Nithin. Waiting for the patch to be integrated. Signed-off-by: Thomas Monjalon --- lib/librte_node/ip4_lookup.c | 7 +++++++ lib/librte_node/ip4_rewrite.c | 10 ++++++++++ lib/librte_node/node_private.h | 12 ++++++++++-- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/lib/librte_node/ip4_lookup.c b/lib/librte_node/ip4_lookup.c index 8835aab9dd..3bd7c179ab 100644 --- a/lib/librte_node/ip4_lookup.c +++ b/lib/librte_node/ip4_lookup.c @@ -21,6 +21,8 @@ #include "node_private.h" +int node_mbuf_priv1_dynfield_offset = -1; + #define IPV4_L3FWD_LPM_MAX_RULES 1024 #define IPV4_L3FWD_LPM_NUMBER_TBL8S (1 << 8) @@ -178,6 +180,11 @@ ip4_lookup_node_init(const struct rte_graph *graph, struct rte_node *node) RTE_SET_USED(node); 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) { diff --git a/lib/librte_node/ip4_rewrite.c b/lib/librte_node/ip4_rewrite.c index bb7f671b5c..1c4e51968c 100644 --- a/lib/librte_node/ip4_rewrite.c +++ b/lib/librte_node/ip4_rewrite.c @@ -248,9 +248,19 @@ 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); + + 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; + } + 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..9258082df0 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. */ @@ -60,7 +67,8 @@ struct node_mbuf_priv2 { static __rte_always_inline struct node_mbuf_priv1 * node_mbuf_priv1(struct rte_mbuf *m) { - return (struct node_mbuf_priv1 *)&m->udata64; + return RTE_MBUF_DYNFIELD(m, + node_mbuf_priv1_dynfield_offset, struct node_mbuf_priv1 *); } /** From patchwork Tue Oct 27 21:01:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82370 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 3E5A7A04B5; Tue, 27 Oct 2020 22:03:15 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9741337B1; Tue, 27 Oct 2020 22:01:49 +0100 (CET) Received: from new1-smtp.messagingengine.com (new1-smtp.messagingengine.com [66.111.4.221]) by dpdk.org (Postfix) with ESMTP id B6653354D for ; Tue, 27 Oct 2020 22:01:46 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailnew.nyi.internal (Postfix) with ESMTP id 5C09B58012A; Tue, 27 Oct 2020 17:01:45 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 27 Oct 2020 17:01:45 -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=UJlT9FoFDHzVKEIyu+6w2SUkgPm02 UVnLJbOemw4aS4+pwLKSqhbpGJ/Fchjx6CO2IgUen7VgCeLvRIcKdFL/R1P7icU8 wlJXXDp6Fxt0qikv4+avJ9BKcU/h+rInK9r3U26qMHyE+by7U3PYINyCcQw8fp+1 r0FVclh+cOxu2fvy/F8GkXv2wD4CWRzScLbV+8PRx8UCaMHBuWP4XI3cyd19Z1Ln uV/68dhvthkHKmgezMGEgkDMXPE5isJo3DK1nF1PSBRxJgrPM0+23JywXHgNrbjA HckuUuylMaLp0AB5x3q90HJWEbI7P8xF+wt9Xt7MW/R6PMOV4HHp4osWw== 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=r+VZ9Vp9 Av9/Jy+1Aj1aNC7ErMP32T83+nQQeW2CIq2CoLTvfIWycWxGU0HkcTLfn2xH+tPq Ine8lsxoaPWM6rulHQby4+aYcMAXY9DpA64Nb320Z/7Tg4HI1vIZkcacRSmxiNYH JERQYzsGRw9UKId0ztsE2l+w3PwHIcKpaWtJU64+h1dMPfqQJvSRLhDZBie1H5RX yXofS1qNVf5utvD2Nczywn8ZgEW9bZda9V+69yZDICb+ga9GlpcHlRJKln3nhu3+ t68x3HWyQaKfp9Y0mheg/z7P68u/jvcTyZTDZknV87LdYo12N9RVH71RxgZ/n3c7 9LsbYErWMVz++A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrkeelgddugeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepvdehgfeivdejgedtveehfefhteelfefgieevgfffveefjeegtdfg uedthedtgeevnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf hiiigvpeegnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl 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 7623F3280064; Tue, 27 Oct 2020 17:01:42 -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, Haiyue Wang , Declan Doherty , Ankur Dwivedi , Anoob Joseph , Jeff Guo , Jerin Jacob , Nithin Dabilpuram , Kiran Kumar K , Radu Nicolau , Ray Kinsella , Neil Horman Date: Tue, 27 Oct 2020 22:01:05 +0100 Message-Id: <20201027210115.2529025-6-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201027210115.2529025-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201027210115.2529025-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 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 Tue Oct 27 21:01:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82371 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 B8C1DA04B5; Tue, 27 Oct 2020 22:03:39 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7415F2C2A; Tue, 27 Oct 2020 22:01:58 +0100 (CET) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by dpdk.org (Postfix) with ESMTP id 59E9E2C2A for ; Tue, 27 Oct 2020 22:01:56 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 027955C0107; Tue, 27 Oct 2020 17:01:55 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 27 Oct 2020 17:01: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=1UzBR21QvXDgt S81e9z9w66hiO7pk6hmwzzFEMFIFjY=; b=fqvICvO9ALB6YTdXz/Yp4GkcaKejz OtMhqgqh4N1WckuKZmlg2KT2yPFdm2XJsAB/c8udwxH7sWqT782IahTirKw0p81S 1uICUv+181ciqwlYbbv8KFp0XCYJXkGus3F8c0A8/PhIJj6RH8Yv4UdVhMRMIvcr jTRwuYDzx+Yk/TQBMuAUBWJnqMj2vfa/ajJgLxMoSd2uH07msZ+/5MP+fMQyx0E2 oil57NsnkZsXhy+QAV72ZqOCge2v+5cE5Zs7qZcGsCcJL8DIFTwke0IzDIRrHIGH Zi0sxXEhaUhqIyGkd/GLQDFgujEGFCV1zEcMp9WpXsQlsUcQb4M/EFFHA== 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=1UzBR21QvXDgtS81e9z9w66hiO7pk6hmwzzFEMFIFjY=; b=N48kXv5W 0b5xBC7Gg4ESaa8IoUcI9340ueq96dOhB4hChDHECyULNc50VZintN7f9441ERH1 AmP/V4LgjGW6kZzbhzJYqrLZg8+C3k20AY8QrzXp/com0XnQbfj44qQ6yxY7DYq1 GOZOgMH5CFl1CHmXUohJYVNYsEquzoEXbowpRV8myXhWLZSas7/5K103EngZuefO 3740RA5GiHMtfmwkd4VXP3JWuDuE0VLTRUieMcuD93oon55Cmhoch/nxPlGTuo1z Qy4aqIJw9tme/JdO6vDNzdFMIPb1ucPaIpfZZ61R/bqC7Xmz5Pv8l4LB+88iMjHL R0TAmLsB80HS+w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrkeelgddugeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepvdehgfeivdejgedtveehfefhteelfefgieevgfffveefjeegtdfg uedthedtgeevnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf hiiigvpeehnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl 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 E15D5328005A; Tue, 27 Oct 2020 17:01: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, Harry van Haaren Date: Tue, 27 Oct 2020 22:01:06 +0100 Message-Id: <20201027210115.2529025-7-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201027210115.2529025-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201027210115.2529025-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 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 --- drivers/event/sw/sw_evdev_selftest.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/drivers/event/sw/sw_evdev_selftest.c b/drivers/event/sw/sw_evdev_selftest.c index 5c7e527917..ad4fc0eed7 100644 --- a/drivers/event/sw/sw_evdev_selftest.c +++ b/drivers/event/sw/sw_evdev_selftest.c @@ -40,6 +40,11 @@ struct test { uint32_t service_id; }; +typedef uint8_t counter_dynfield_t; +static int counter_dynfield_offset = -1; +#define COUNTER_FIELD(mbuf) (*RTE_MBUF_DYNFIELD(mbuf, \ + counter_dynfield_offset, counter_dynfield_t *)) + static struct rte_event release_ev; static inline struct rte_mbuf * @@ -2987,8 +2992,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 +3033,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 +3066,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 Tue Oct 27 21:01:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82372 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 0BAEBA04B5; Tue, 27 Oct 2020 22:03:59 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id ECA8B4C73; Tue, 27 Oct 2020 22:02:03 +0100 (CET) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by dpdk.org (Postfix) with ESMTP id 91AB34C90 for ; Tue, 27 Oct 2020 22:02:02 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 4330A5C00C1; Tue, 27 Oct 2020 17:02:01 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 27 Oct 2020 17:02:01 -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=ohDsyWWzMYPJ9 FR1tnbyC+cf4fz5hzLNw6ufGn39duU=; b=iJgEu+5NMhcjkcHethD45LyzdzoJg gL2D743hDQPMX17qE1c+OI8StwQ6o3gB4AB1AoXqwflMzyGuq0tJGgQpbkF8SgEi S0UI9yGqQFuZyQUDjfQVYRQ59Kt6LjdeQ40S+3NJJYmpHSELceU8rak3mwFJ1NeA Ian6ypgNwkKrr9M9peEwxdKeUY5soQXKq6l9UdY1wPxQehOOoKAhBr1Y++FrAe9/ 1ZtiuvRV04iQDZSIxprUnAlLeO34BzWzCc1kXogoIcwD4KeaAZoMQt4JQ6hoyGO8 EV/zuKaDNLzotOa5ypr1uSQu39cPH9Cc5XTDTwXkjqcxf9gGyt3pI08nQ== 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=ohDsyWWzMYPJ9FR1tnbyC+cf4fz5hzLNw6ufGn39duU=; b=Wxf/NKxm Q8AUiUdAt710glHlNTnGyE3Ym3rb7pFr1ACZUcTH8myrVDtMyCIinG3bE3BRYKXJ bDfUo275OG48nQcr1wKvkENjaQVS1LmTUz1F0zBNr3v826fmRh7QaEw05XYgdhd3 zy/VThYzm+I6SfmN7apm5Rae9815It/Q2b0M/O8T9TWHeElGMgUXa2Sb2suE7Swo Db3HEDSLivQr5QrfCMOad08O4X9NplBotJWsUUi6DPNg2whHX8K/Z2GVQeUzHEGS LB9JgRZzkNoITrqdeBxU5D+GDX3701U+lc2hQmfaOe7n9kcOujU7qJWC1WIxVThI B1hwCnq/HInAZA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrkeelgddugeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepheejhfdvffeuheeiveduvdefieeghfdtvddvtdehhefgkeefhfdt hfetffegteeunecuffhomhgrihhnpegtohhnfhdrihhnnecukfhppeejjedrudefgedrvd dtfedrudekgeenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhr ohhmpehthhhomhgrshesmhhonhhjrghlohhnrdhnvght 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 004973280059; Tue, 27 Oct 2020 17:01:59 -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, Shepard Siegel , Ed Czeck , John Miller Date: Tue, 27 Oct 2020 22:01:07 +0100 Message-Id: <20201027210115.2529025-8-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201027210115.2529025-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201027210115.2529025-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 07/15] net/ark: 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 second field of metadata is reserved for user data which was using a deprecated mbuf field. It is moved to a dynamic field in order to allow removal of udata64. Signed-off-by: Thomas Monjalon --- doc/api/doxy-api-index.md | 1 + doc/api/doxy-api.conf.in | 1 + drivers/net/ark/ark_ethdev.c | 18 +++++++++++ drivers/net/ark/ark_ethdev_rx.c | 3 +- drivers/net/ark/ark_ethdev_tx.c | 3 +- drivers/net/ark/rte_pmd_ark.h | 56 +++++++++++++++++++++++++++++++++ 6 files changed, 80 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..5f19d8d1ea 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,8 @@ 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_userdata_dynfield_offset = -1; + static const char * const valid_arguments[] = { ARK_PKTGEN_ARG, ARK_PKTCHKR_ARG, @@ -245,6 +248,11 @@ eth_ark_dev_init(struct rte_eth_dev *dev) int ret; int port_count = 1; int p; + static const struct rte_mbuf_dynfield ark_userdata_dynfield_desc = { + .name = RTE_PMD_ARK_USERDATA_DYNFIELD_NAME, + .size = sizeof(rte_pmd_ark_userdata_t), + .align = __alignof__(rte_pmd_ark_userdata_t), + }; ark->eth_dev = dev; @@ -254,6 +262,16 @@ eth_ark_dev_init(struct rte_eth_dev *dev) ret = check_for_ext(ark); if (ret) return ret; + + /* Extra mbuf field for user data */ + rte_pmd_ark_userdata_dynfield_offset = + rte_mbuf_dynfield_register(&ark_userdata_dynfield_desc); + if (rte_pmd_ark_userdata_dynfield_offset < 0) { + ARK_PMD_LOG(ERR, + "Failed to register mbuf field for userdata\n"); + return -rte_errno; + } + 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..c5788498b3 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_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..ab488d83f2 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 = (uint32_t)rte_pmd_ark_mbuf_userdata_get(mbuf); meta->data_len = rte_pktmbuf_data_len(mbuf); meta->flags = flags; } diff --git a/drivers/net/ark/rte_pmd_ark.h b/drivers/net/ark/rte_pmd_ark.h new file mode 100644 index 0000000000..11e96e0e9c --- /dev/null +++ b/drivers/net/ark/rte_pmd_ark.h @@ -0,0 +1,56 @@ +/* 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 + +typedef uint64_t rte_pmd_ark_userdata_t; +extern int rte_pmd_ark_userdata_dynfield_offset; + +/** mbuf dynamic field for custom ARK data */ +#define RTE_PMD_ARK_USERDATA_DYNFIELD_NAME "rte_net_ark_dynfield_userdata" + +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice + * + * Read user data from mbuf. + * + * @param mbuf Structure to read from. + * @return user data + */ +__rte_experimental +static inline rte_pmd_ark_userdata_t +rte_pmd_ark_mbuf_userdata_get(const struct rte_mbuf *mbuf) +{ + return *RTE_MBUF_DYNFIELD(mbuf, rte_pmd_ark_userdata_dynfield_offset, + rte_pmd_ark_userdata_t *); +} + +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice + * + * Write user data to mbuf. + * + * @param mbuf Structure to write into. + */ +__rte_experimental +static inline void +rte_pmd_ark_mbuf_userdata_set(struct rte_mbuf *mbuf, + rte_pmd_ark_userdata_t data) +{ + *RTE_MBUF_DYNFIELD(mbuf, rte_pmd_ark_userdata_dynfield_offset, + rte_pmd_ark_userdata_t *) = data; +} + +#endif /* RTE_PMD_ARK_H */ From patchwork Tue Oct 27 21:01:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82373 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 B74A9A04B5; Tue, 27 Oct 2020 22:04:17 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5BFED2BF4; Tue, 27 Oct 2020 22:02:08 +0100 (CET) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by dpdk.org (Postfix) with ESMTP id 3B29F4C97 for ; Tue, 27 Oct 2020 22:02:04 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id DF78D5C0108; Tue, 27 Oct 2020 17:02:03 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 27 Oct 2020 17:02:03 -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=35KouOHKmhnO2 N0MhYSi0uf0EtybAxmBhe66ewb4wQw=; b=onsbvz15KY+nsWB5tas0n4FU/Almd 6/oGBrTvpON+gnzw4BiCW0V56cTo7gLTmjxAucntHNjtCqElwxrmvI77U+ma+zLv fo+iD7KCDyYdMHgRCFZutBv9tljd5RAUmekcuZ4aUGLNkkRrvaiBalSgAqDm3DHz RjULJcvBUbHIlXjYSLal+TPj5M8hzI5WCNExQ5/6QzQkdBs7EfMeNDYfsoBZ0TOT naODm20dNz2U7HtHnS41JCeceATd28wSkZmwFAv1g9ioGFXISMLWk363SsL/QZMi PZ8sKnrn8hz1Hzf8k8+llMpad+J2GkBZ89oywNQWe/9n4RKQdC98DxBhA== 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=35KouOHKmhnO2N0MhYSi0uf0EtybAxmBhe66ewb4wQw=; b=fmDEHcxJ 91QydIN6P0rZo2EDtfoxLmbGSidLPaDFNkD7c4P5oafQrObPi062On5/pBI4OzCG wcDYP5gSyInDYkMWNGh6OLGJcYSQNcDkMBYhAh08WsNJ85KXvxd6eHqPWNCSnv99 nUHUp7YnPKouL5wR4HbJJhNdICxX2CoTbF7Tg4QZbO8xBPov20lC4zP1Zd+3nCi4 eYg+dVMjQU2CEC+miO+JPKaMBSqouPDNZwQLqvYMkpYE7VISpj3dOBFgkX8mFpT7 gBrBOgRAgU33KKR3Xf2HYlwkC3nttx99eGbPLxUu0ZMvlfCpGqItl6fF3lYunvzJ OUIhZT8QKPaNEw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrkeelgddugeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhephefgjeeggfeuvefgvedvkeegffeftdekheegffejieegfeeuffdu fffhleffffdunecuffhomhgrihhnpehfughirhdrihgunecukfhppeejjedrudefgedrvd dtfedrudekgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhr ohhmpehthhhomhgrshesmhhonhhjrghlohhnrdhnvght 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 3905B3280059; Tue, 27 Oct 2020 17:02:02 -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, Ajit Khaparde , Somnath Kotur Date: Tue, 27 Oct 2020 22:01:08 +0100 Message-Id: <20201027210115.2529025-9-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201027210115.2529025-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201027210115.2529025-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 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 | 5 +++++ drivers/net/bnxt/rte_pmd_bnxt.h | 3 +++ 4 files changed, 28 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..7156ce7dd8 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..2d16a551ce 100644 --- a/drivers/net/bnxt/bnxt_rxr.h +++ b/drivers/net/bnxt/bnxt_rxr.h @@ -95,6 +95,11 @@ 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; +#define BNXT_CFA_CODE_DYNFIELD(mbuf) (*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 Tue Oct 27 21:01:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82374 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 A9899A04B5; Tue, 27 Oct 2020 22:04:35 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 004C24F96; Tue, 27 Oct 2020 22:02:10 +0100 (CET) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by dpdk.org (Postfix) with ESMTP id 217352BF4 for ; Tue, 27 Oct 2020 22:02:06 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id C1BAE5C00E2; Tue, 27 Oct 2020 17:02:05 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 27 Oct 2020 17:02:05 -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=d1fFCseucXepU XOo5x5zp3KAoUipq++IKlig9YGnDR0=; b=KgJ4mkdd1yai3UpXmFRhwUzZ3RXvy lk/S4RYF/v+lu1kFrnphOQZknQ+sW+QdwhwiwzBXuNV96pgCNmYDK1QEVD2suzYA ZrLq0tmU3tq1pz5sD9fA4m9N6jSbFgmxRdPhFAB1qTXi74KjJ29xHyfCtR+V7ilW 174tpazC1UQRXHH3wX9iolPptuhDyYicQ4AFSvySgedfYRTay0IMZyMeEVUe1Pnj ZTflVQPpybV1eX6jE6xl7WCnSvp4yTDTJ7gmSxZ5vnzbKB4GytEmhXoJleJpStGK Xr44EPe9cKoBKFsG+i2WYq/jAY31/IfhRmgKclZWeOW+EjhgYe9TYzTNQ== 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=d1fFCseucXepUXOo5x5zp3KAoUipq++IKlig9YGnDR0=; b=NIE/kkvQ UsM6c0dhD/otgm7n5HZ9o19DXkRbZ2uZpRRlcnqjJCbjgHbNet5eYHDci1Mn7Rzi /c5B+ii+p923Kq7f3QrxknWuRglWV18XxMwsUaY/T9EZtVh0Xavz3SNwSPe6X2js psv54lCVm9MQpwRZlWlsWKGIEHoU4l6C0r4tlNyi6KOhchM+uoK+m+eSybHuuuHb njFBt2M57X/qSOTVVjVCYNf3qOxLIUVHfNv0gUzKXsMeDk3SSb3SUzdNpbhJchaL nQVz3EJnJodRtHT2LgcC82l9pjqdAdjJIZ5aqGpov/RzI/uiuhbjcbu42rrlt0rm o2gPqYG8XA/FXg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrkeelgddugeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepvdehgfeivdejgedtveehfefhteelfefgieevgfffveefjeegtdfg uedthedtgeevnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf hiiigvpeeinecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl 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 A4CFD3280059; Tue, 27 Oct 2020 17:02:04 -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, Yong Wang Date: Tue, 27 Oct 2020 22:01:09 +0100 Message-Id: <20201027210115.2529025-10-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201027210115.2529025-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201027210115.2529025-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 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 | 6 ++++++ drivers/net/vmxnet3/vmxnet3_rxtx.c | 9 +++++---- 3 files changed, 26 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..e19718ce64 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.h +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.h @@ -193,4 +193,10 @@ 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; +#define VMXNET3_SEGS_DYNFIELD(mbuf) (*RTE_MBUF_DYNFIELD(rxm, \ + 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..2b0e2e6f19 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 Tue Oct 27 21:01:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82375 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 02EE1A04B5; Tue, 27 Oct 2020 22:04:58 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2D91156A3; Tue, 27 Oct 2020 22:02:15 +0100 (CET) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by dpdk.org (Postfix) with ESMTP id A99064CA7 for ; Tue, 27 Oct 2020 22:02:08 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 181405C00CC; Tue, 27 Oct 2020 17:02:08 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 27 Oct 2020 17:02: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=AKn3SixaXOpxs GduMvsitiEjbrkJq1l4ZUlqKp6x8vo=; b=Ox5OKvRhOZ/+sW6o3M2vUogAwxZOS vnEnBESPWimodB1e/CjxcGFTkrn2hArkg2gjuUDUilr9xK4Tw8DFTLHI0FTniMuF cHjsgntIKh97tsXO2Uc8N5ixDLAtHvvFK4xOK3Q4C07qb20EmMFT+dNQXhUGb3Bp 9od5b7SQVRlQWLr2ya58myaVq25ihcJK/ETkk6VHR0pT3eA/JmWPI6AV6wFxzIj6 vpaygWN01bQK+Cv5doKrU+OCKI2YaskMaaT/YHywPcCR4hqjsYkyCDVDgMz99Can lmY+WOMGdUPSveirWdBtGJzMmr5TKzTDYtS+xXffKVzRw9AeLPqg5Puqg== 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=AKn3SixaXOpxsGduMvsitiEjbrkJq1l4ZUlqKp6x8vo=; b=l+b6kygS GdFEZmelMuKoLfl2kZVZrVv5Nhu+tEfBbW8qU0KdPVt2pN+9YSaaAdXgPQBcFZ2W 8hJEKUSXKXNGy0oMcdrqjcdQKFilQHZoyk27Vb7BgvQmguZ5r25JeOtL6GnStlgM ZkmNPyX/XRWarf+h4zKbatSq6vbNl7CxoReaCLGbTfKgvgrJLcX/AB6/+06PB6Sg aHa6zDKYmNEYUlQBf74a4omtF9RqRrkx6Jb4lZ9BN8JYYG8ZrtjiDThbAEVyjwk/ SwhAEUa91QRbp9YPS3nnXbSYOz2aC1vPezrvQ2ZZBvYQKw0IQhWEd4VfdTfO1FR5 MghAOeCP9RDVWw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrkeelgddugeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepvdehgfeivdejgedtveehfefhteelfefgieevgfffveefjeegtdfg uedthedtgeevnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf hiiigvpeejnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl 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 8DD0B328005D; Tue, 27 Oct 2020 17:02:06 -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, Lukasz Wojciechowski , David Hunt Date: Tue, 27 Oct 2020 22:01:10 +0100 Message-Id: <20201027210115.2529025-11-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201027210115.2529025-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201027210115.2529025-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 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 | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c index eb889b91d1..24ee824eef 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,11 @@ #define BURST 32 #define BIG_BATCH 1024 +typedef uint32_t seq_dynfield_t; +static int seq_dynfield_offset = -1; +#define SEQ_FIELD(mbuf) (*RTE_MBUF_DYNFIELD(mbuf, \ + seq_dynfield_offset, seq_dynfield_t *)) + struct worker_params { char name[64]; struct rte_distributor *dist; @@ -578,7 +584,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 +637,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 +666,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 +811,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 Tue Oct 27 21:01:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82376 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 CAAF1A04B5; Tue, 27 Oct 2020 22:05:13 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C7B0E58E6; Tue, 27 Oct 2020 22:02:16 +0100 (CET) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by dpdk.org (Postfix) with ESMTP id 14B2F4CA7 for ; Tue, 27 Oct 2020 22:02:10 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id A20135C00D6; Tue, 27 Oct 2020 17:02:09 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 27 Oct 2020 17:02:09 -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=gCnFlPwlPHUt5 Qjmew/qeycaqOI5GSF2L7hRxaoB3vc=; b=ZgTw9/ND0qkT0N/NsCO1lbjS5KVIO AjYkfIY1DYkUk/1Pym1553WuhTHpElHmImivTsdY0athbdnRpye03Ad5qNo8H0zb sdUxPTwuLbr9inryfwpyWpCknQTCmhG/t5LZt8BCl1SGcl6h28h7Oofl9cnkw7st 9V0qr3QbKybkkcfWu1WFNJcHmfJu25dO7lG2FojMR/7z4gpnqDzCzJyIIxRvUgB/ z2AIu5YAl/l5UET594KCEgABpTha8dZMQIH4sX1BTQ6sJf6S44Oe2i2NwU8HeFUv 7abZCxIDAVh71JpNGJmAsYof1bPV0YxJJzsofrjzMNAX/UYNZYEV3K1Wg== 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=gCnFlPwlPHUt5Qjmew/qeycaqOI5GSF2L7hRxaoB3vc=; b=Gn8myYf/ MO1tuID7i5WBvM2qFVl+g20/CbYy8ECMbetEtIWWkBilnC+glBfeoIzHJc2yPYi+ TAAVwZUXiWoITl+kOtpwqA69uRGA63y8JGweXyW8B3AjrC2R8jYnKaMPMaBTdiwW igOETwG/59XQTxJQKPCvg+CLV5b9M5/mXSXFWUZjrStwNcwpa/PvpFdqGzNRqv3h ikqhxtETlvXRndIJdEw0vJCJwZpifIpIGA9xeWElo5LGGrH/+f8YGp1q1AkF32IT MnhcXY3bj/rQEt6yFFJtnrCLRU/RIRFF3KrYUJixaV96efwmj7QwCETN1+31W5Q+ /mA4iEmgJbMuOQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrkeelgddugeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepvdehgfeivdejgedtveehfefhteelfefgieevgfffveefjeegtdfg uedthedtgeevnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf hiiigvpeejnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl 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 60CFD3280059; Tue, 27 Oct 2020 17:02:08 -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, Jerin Jacob , Kiran Kumar K , Nithin Dabilpuram Date: Tue, 27 Oct 2020 22:01:11 +0100 Message-Id: <20201027210115.2529025-12-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201027210115.2529025-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201027210115.2529025-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 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 | 94 ++++++++++++++++++++++++++----------------- 1 file changed, 56 insertions(+), 38 deletions(-) diff --git a/app/test/test_graph.c b/app/test/test_graph.c index ed69eda997..164486911f 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,11 @@ 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; +#define GRAPH_FIELD(mbuf) (*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 +168,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 +181,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 +211,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 +239,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 +252,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 +291,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 +318,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 +345,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 +373,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 +401,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 +432,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 +771,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 Tue Oct 27 21:01:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82377 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 2C27BA04B5; Tue, 27 Oct 2020 22:05:37 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5F2965928; Tue, 27 Oct 2020 22:02:18 +0100 (CET) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by dpdk.org (Postfix) with ESMTP id 9EA425688 for ; Tue, 27 Oct 2020 22:02:13 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 4BA255C0114; Tue, 27 Oct 2020 17:02:12 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 27 Oct 2020 17:02: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=WqkAEYxbJIcz0 ACL2DZgYLEix8fmARoNnQvkyGm1OX8=; b=VXYJmAN7uNJ1MJIAel6k/BZs+qqoO N3UTI2Ock5uildkNEJlskAXV6MLXcuJHnWQxXNvjEy+knii6WGnvshPxrEa2KwBd BoBgjZ5pXE/WVhNxyPDqJPvepDabP0OQvn4xjaygqhTRO9F+xr6fqxG9zk2njMeo sC9+9p29kNlDvbyjHs0vgeHaq5BX7lZFbtClNHe1WMTeMg+MtXfbean7h3B2Tsr1 9alSiCEZXRtfJtjw288fF2JiWVaKkJQIRuE5mRGhT3tm1TsuNJRvE/MuK6YjaY3z mLPlLl655XZJWxH8znQ93QLZ0BLSmykQOiMBcVf6yJLnolBvgeP5owqBw== 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=WqkAEYxbJIcz0ACL2DZgYLEix8fmARoNnQvkyGm1OX8=; b=Naltz6Xg Nw1eg4n8oAKVqo1vPQ5uvEDHDypPF0NwCYB3dWY4L88/UCWCEE59hlDgsp1i8qwe 02jogD9vYdwTm0QC2gReLlrqdUHqGtQfcxc/usNyx+sOLXMb5Xh6pi3VlA0+L6Dl 9oKFx/pS9CEOHEMpdhxlMuJmQzryttUUFTdJSSceCV62gMmMX93cXbipbVmxjs1c J8suCz86Fxad5fE7cBxGRGGmDUgN8x9lyiDeOQo6ALqPHQ70+JyhIGL7Y/bZ/6EK BAnblyu9yITm+1byru/NG9CuFDlegD5ZQ1rKJd1fyl2eYQkEydzreLqF6SVlYPuw sZ6xh8nbTN+JtQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrkeelgddugeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepvdehgfeivdejgedtveehfefhteelfefgieevgfffveefjeegtdfg uedthedtgeevnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf hiiigvpeejnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl 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 479413280064; Tue, 27 Oct 2020 17:02: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, Jerin Jacob Date: Tue, 27 Oct 2020 22:01:12 +0100 Message-Id: <20201027210115.2529025-13-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201027210115.2529025-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201027210115.2529025-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 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 | 19 +++++++++++++++++++ app/test-eventdev/test_order_queue.c | 4 ++-- 4 files changed, 39 insertions(+), 9 deletions(-) diff --git a/app/test-eventdev/test_order_atq.c b/app/test-eventdev/test_order_atq.c index cfcb1dc4e9..b135ac4e55 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; + flow_id_copy_from_mbuf(&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; + flow_id_copy_from_mbuf(&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..c5f7317440 100644 --- a/app/test-eventdev/test_order_common.c +++ b/app/test-eventdev/test_order_common.c @@ -4,6 +4,8 @@ #include "test_order_common.h" +int flow_id_dynfield_offset = -1; + int order_test_result(struct evt_test *test, struct evt_options *opt) { @@ -46,13 +48,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; + flow_id_save(flow, m, &ev); while (rte_event_enqueue_burst(dev_id, port, &ev, 1) != 1) { if (t->err) @@ -139,6 +138,18 @@ order_test_setup(struct evt_test *test, struct evt_options *opt) { void *test_order; + 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), + }; + flow_id_dynfield_offset = + rte_mbuf_dynfield_register(&flow_id_dynfield_desc); + if (flow_id_dynfield_offset < 0) { + evt_err("failed to register mbuf field"); + return -rte_errno; + } + test_order = rte_zmalloc_socket(test->name, sizeof(struct test_order), RTE_CACHE_LINE_SIZE, opt->socket_id); if (test_order == NULL) { diff --git a/app/test-eventdev/test_order_common.h b/app/test-eventdev/test_order_common.h index e0fe9c968a..9e3415e421 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,24 @@ #define BURST_SIZE 16 +typedef uint32_t flow_id_t; +extern int flow_id_dynfield_offset; + +static inline void +flow_id_copy_from_mbuf(struct rte_event *event) +{ + event->flow_id = *RTE_MBUF_DYNFIELD(event->mbuf, + flow_id_dynfield_offset, flow_id_t *); +} + +static inline void +flow_id_save(flow_id_t flow, struct rte_mbuf *mbuf, struct rte_event *event) +{ + *RTE_MBUF_DYNFIELD(mbuf, flow_id_dynfield_offset, flow_id_t *) = flow; + event->flow_id = flow; + event->mbuf = mbuf; +} + struct test_order; struct worker_data { diff --git a/app/test-eventdev/test_order_queue.c b/app/test-eventdev/test_order_queue.c index 1511c0092d..42950626c9 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; + flow_id_copy_from_mbuf(&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; + flow_id_copy_from_mbuf(&ev[i]); if (ev[i].queue_id == 0) { /* from ordered queue */ order_queue_process_stage_0(&ev[i]); From patchwork Tue Oct 27 21:01:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82378 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 4B217A04B5; Tue, 27 Oct 2020 22:05:56 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1CA962C1A; Tue, 27 Oct 2020 22:02:25 +0100 (CET) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by dpdk.org (Postfix) with ESMTP id C6A4F58CD for ; Tue, 27 Oct 2020 22:02:15 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 76B2E5C00B4; Tue, 27 Oct 2020 17:02:14 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 27 Oct 2020 17:02: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=tQuKWbiliUVAj SSPhKYtMVm5sa1lzLavUnMWeV38LP4=; b=htWG0Rh/ng015pCAFtew70qzyhsMQ tVWch3O0spqVG4eF7VcWVuCPYUc1n43VJh0YUqsc2Ahe7YPkK8XGstwrUd6E2eLM xltiO3jW8dGgXIOyTulOtxA11CKSLf7FtKoum04fsIx0P2XMOMakBrEAAx55BUDK di5lD3ZmN4POpntGVBuywYsriK6KdDDe3yr6cT8H+yAsk2yCVApbC/UyLmbBv/cw owMA1w7bFRglOPeT1WDEHHxIBf2axvySFPYmJ937YbauY+rBqixETXEze99mEUtP UUl4/lVFkAgcZAdBegkW3biZyECY2OOc7PrkTa9vVZbO4JCQ+YstVdeEQ== 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=tQuKWbiliUVAjSSPhKYtMVm5sa1lzLavUnMWeV38LP4=; b=ch03CNJE pHjVYuwjOAhcaRfgCihMhDkemkXc5BntXVxb+GVsDxLSJHVCnQ+j1Vo1uTDRUv76 2Qstxk5zoS/IfAjo30vaeY590wDZSDR5qpEIPNdNoKICj3qrvFQTghMcJlunU9Yq SxBEtEei/rx7AqQemHSKzXLhvREOjanAD/wKD2yiy7BPnsP9v4SiRkXPbw01q/Z5 YckQZg0ez3rYjHzXBgbFf7SugZFF7R4V7bovTpmBhWXgg6gfbQ4jSQn37lbGju6b qkuRj8TTgWc8EBHe0VWxD/+LmE/An/51RlHncno9HO1N+EKw2KP9sdDgiA48wX/R F0CBJSKXaMTIrw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrkeelgddugeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepvdehgfeivdejgedtveehfefhteelfefgieevgfffveefjeegtdfg uedthedtgeevnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf hiiigvpedutdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgr lhhonhdrnhgvth 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 6E1113280059; Tue, 27 Oct 2020 17:02: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, Nicolas Chautru Date: Tue, 27 Oct 2020 22:01:13 +0100 Message-Id: <20201027210115.2529025-14-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201027210115.2529025-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201027210115.2529025-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 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 --- examples/bbdev_app/main.c | 49 +++++++++++++++++++++++++++++++-------- 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c index e512c807cd..63e8b18e44 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,22 @@ } \ } while (0) +static int input_dynfield_offset = -1; + +static inline struct rte_mbuf * +get_mbuf_input(struct rte_mbuf *mbuf) +{ + return *RTE_MBUF_DYNFIELD(mbuf, + input_dynfield_offset, struct rte_mbuf **); +} + +static inline void +set_mbuf_input(struct rte_mbuf *mbuf, struct rte_mbuf *input) +{ + *RTE_MBUF_DYNFIELD(mbuf, + input_dynfield_offset, struct rte_mbuf **) = input; +} + static const struct rte_eth_conf port_conf = { .rxmode = { .mq_mode = ETH_MQ_RX_NONE, @@ -294,11 +311,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 = get_mbuf_input(mbufs[i]); rte_pktmbuf_free(rx_pkt); rte_pktmbuf_free(mbufs[i]); } @@ -429,7 +446,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 = get_mbuf_input(out); if (memcmp(rte_pktmbuf_mtod_offset(in, uint8_t *, sizeof(struct rte_ether_hdr)), @@ -731,7 +748,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]; + set_mbuf_input(enc_out_pkts[i], rx_pkts_burst[i]); /* copy ethernet header */ rte_pktmbuf_reset(enc_out_pkts[i]); @@ -775,7 +792,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 +822,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 +859,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 +888,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 +915,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(get_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 +1063,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 +1138,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 Tue Oct 27 21:01:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82379 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 BAA4CA04B5; Tue, 27 Oct 2020 22:06:15 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B3749593A; Tue, 27 Oct 2020 22:02:26 +0100 (CET) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by dpdk.org (Postfix) with ESMTP id 8343B592C for ; Tue, 27 Oct 2020 22:02:18 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 343475C00B4; Tue, 27 Oct 2020 17:02:17 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 27 Oct 2020 17:02:17 -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=4yZj+8b1nOxb6 ehMxfOUTqIE3F/4Ed8jzYXpIR+VKNk=; b=FCfk2XURAVjcOrfIuX8tLY6jkPcHU kQykIemUqsLLFZS+qKYG4Kbvpf1QAOUsUA53dP5kjD7DqchnAlWOjWAiwmZ9Pr/4 /Too+xM2MhiWD8lQtMyH9QDMB17L+iPuJd3jw050UhRhjqWc0emRjHCjkWxeUbDS 1376vREK9OJJxfyIm7XJUCsCBF+RPH9tGV0XDWZx92Fq+q+gyP7xndVA2iQ1MCOt 0/Q2JmKHyF0jCfCWZsaM74uoWzBHxWwzgI/aG5THGpcFKeFX6MnhMqsqzYYEH8RG +9Pd2jiEuMNjmUQ32iGmKVjtfZVATVj3Xl9iOIeOeKF+WZbrF+EZQjeZw== 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=4yZj+8b1nOxb6ehMxfOUTqIE3F/4Ed8jzYXpIR+VKNk=; b=dh1gw7E4 GDMspvSErdPxzvUAbvpHPuMSgEkNJ2IslFa3XsbKiNIYu1LjcD0pzUTynsJcmb+9 ipsoWsHDJkNCo1nbW+Hz8zT4t33ST7ru3DZbz3EhpaULoEgtYFSGdF1o2xZ+wW6h vksmDoX8qhYjbAJqWReOdDG1l/ZhAORCaZMR3Ai8tGY9lB5HXprJiF+Jqg2FvaAh Hfz8NS84vnEbstTUdmeIK6RR167SuKMihcv+hMwdCOXug7TfwvSmnzqA6lLRvEYC /d9Ou917JpD58koX2t0Xe0qbilcIwazv21R9OFi2MKqLxGiM5R5w9o4+tT1+PweQ ldD+16MOj4Loyw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrkeelgddugeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepvdehgfeivdejgedtveehfefhteelfefgieevgfffveefjeegtdfg uedthedtgeevnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf hiiigvpedutdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgr lhhonhdrnhgvth 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 31FF1328005D; Tue, 27 Oct 2020 17:02:16 -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, John McNamara Date: Tue, 27 Oct 2020 22:01:14 +0100 Message-Id: <20201027210115.2529025-15-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201027210115.2529025-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201027210115.2529025-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 14/15] examples/rxtx_callbacks: 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. 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 | 20 ++++++++++++++++++-- 2 files changed, 20 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..56c4293a1a 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..b9a98ceddc 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,11 @@ #define MBUF_CACHE_SIZE 250 #define BURST_SIZE 32 +typedef uint64_t tsc_t; +static int tsc_dynfield_offset = -1; +#define TSC_FIELD(mbuf) (*RTE_MBUF_DYNFIELD(mbuf, \ + tsc_dynfield_offset, tsc_t *)) + static const char usage[] = "%s EAL_ARGS -- [-t]\n"; @@ -47,7 +53,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 +71,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 +267,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 +303,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 Tue Oct 27 21:01:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82380 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 BA41AA04B5; Tue, 27 Oct 2020 22:06:39 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A51695A8C; Tue, 27 Oct 2020 22:02:30 +0100 (CET) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by dpdk.org (Postfix) with ESMTP id CB7F72BDB for ; Tue, 27 Oct 2020 22:02:24 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 678C65C00B4; Tue, 27 Oct 2020 17:02:23 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 27 Oct 2020 17:02:23 -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=cAs1fn75z12U/ eGvLRzSn5M1GqqkZv38pdTsyTdaF+k=; b=sTBHQoVjfqkc4GoJYtV5Vw8foWOgd 24b9K2NbsdHld6z5/dCQ7YFksGA+7bIEAi1ET4N225ZkFNTdZar1rHmFoJI3XOuU VN/QVIHGekF2v+WbG1fjFB9io0cKz8/G1u0ivUSaFOMWN5VLrZYVU3Rldkm3U/OC evPopukL0cxqvCtFosIVxWyqTQNePDeTszjTncBpZ7VXDzzauh0aOaNBr0m88EcC Klc9yYIpDYyvSEcxOMZEEw7K8inKFFxGE/ooqrbBZ20R920zBsqabRyhfxq7wRRV u+jRlArxP/9TekIdVXpX0ySwTquTRenxOhtGADpEQ9D8Z0412gwPjlOTA== 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=cAs1fn75z12U/eGvLRzSn5M1GqqkZv38pdTsyTdaF+k=; b=sBOA6dJ9 W1SmfZoRVLvbXJtXV2F8aelEikuC0Nu1WXwGX4FJ8PMQCXuub/zG6zyEwBB7Gxw/ OSeR4EpC4QEE20oit5ci3Y09hR+ldJPzvLYsU8+2fRrHPw0FNbwFw2v90//6sZmT jw39mOw9OcKPDMSUJUbXJuzWiIuSMvDfVWbR6rbjHXXT5uUZ4eWUaUnESZfPIaN6 njNsC5wxHEugssHqsnKCz7MGpNC6Km72+ybrV8jsVnkldNiXYCxE4+MyZ+2ln02M +s1Ag0EoXwYKwNMpYVG4YVvmaI3eZOvNo7b5kQ35sBemHE6Zd76Sybxpfc20pgcK hr3xxYbKMrEUQg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrkeelgddugeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepvdehgfeivdejgedtveehfefhteelfefgieevgfffveefjeegtdfg uedthedtgeevnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf hiiigvpeduvdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgr lhhonhdrnhgvth 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 311D2328005D; Tue, 27 Oct 2020 17:02:21 -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, Ray Kinsella , Neil Horman Date: Tue, 27 Oct 2020 22:01:15 +0100 Message-Id: <20201027210115.2529025-16-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201027210115.2529025-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201027210115.2529025-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 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 | 3 +-- lib/librte_mbuf/rte_mbuf_core.h | 8 +------- 4 files changed, 5 insertions(+), 10 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 d8ac359e51..3cec526b6a 100644 --- a/doc/guides/rel_notes/release_20_11.rst +++ b/doc/guides/rel_notes/release_20_11.rst @@ -426,6 +426,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..0db45e6a24 100644 --- a/lib/librte_kni/rte_kni_common.h +++ b/lib/librte_kni/rte_kni_common.h @@ -86,8 +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))); - void *pool; + void *pool __attribute__((__aligned__(RTE_CACHE_LINE_MIN_SIZE))); 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; /**