From patchwork Wed Oct 28 10:26:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82614 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 7798DA04DD; Wed, 28 Oct 2020 11:27:18 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 99C77C982; Wed, 28 Oct 2020 11:27:02 +0100 (CET) Received: from new1-smtp.messagingengine.com (new1-smtp.messagingengine.com [66.111.4.221]) by dpdk.org (Postfix) with ESMTP id 2B843C974 for ; Wed, 28 Oct 2020 11:27:01 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailnew.nyi.internal (Postfix) with ESMTP id 82B02580381; Wed, 28 Oct 2020 06:26:59 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Wed, 28 Oct 2020 06:26:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=utT25ffjUJ4jh zKp5ZYTAZjjQ8wN3LUlWb45ZAjLSW4=; b=KOQcfbyCoL5HPHy/7s9boi/ikl32h nx0NL3UDpRqGHXqjnWabFoq+dAsm3MZzEJllcTH5Tb+2i1mPxuwDel554jZGw1tH upO2fwsnFkgjnt1i2m62PzVOUsjsTytK2Hn7gbbtdhCiNkH2VezemlSNDP82/kOH LrZLY83wPn9QDOMpo3f0ncyTjSy1cMw8xDud0sse6kugiZeBZ4pVLUYwPsxh6wM3 Dxy2WTJT5Kch7elEFB7Gc1rT9rDzrmcw/pYP+czNDP5LYVE05rhHoOhkKp0vnB6g YniTvHj7CK2bLV8CLjYN+h6GmJhniGpfI75AXV6ALEjioTsbvUHXNC8KA== 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=P9IWRKnb CrFuoJZmApXA5AblEHYY6/Z0fceZIVi+HfAGITc0trfToT9EJkpN0DwThvJw40wv ml3/oXfo0bNC/9leZOgaJkcXmm0uoVoLTDWjMG2hXNJi/qLa2AfsTOi7fbSP73Xg 1HcTzd0ZNMynDtN+CEZa35HnoS/39rGJxKCgBZBYeZc4ATjYEwQKUv3myOrRbI+t 6iQ5SfzfPSyHVRh013MJ45scK5KM4ORcL4EWFtANyg+6Qf5dMNmYX1K82a3R//zp SH+u+DVQf3CkmGrywGtemXgQbAo75e8HHi5saMefQkvXVweJdIV61An0/OArMLrP mWGmIfppozNjBA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrledugdduhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho nhdrnhgvth X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id DFFFF3280059; Wed, 28 Oct 2020 06:26:57 -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: Wed, 28 Oct 2020 11:26:26 +0100 Message-Id: <20201028102640.3191964-2-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201028102640.3191964-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201028102640.3191964-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 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 Wed Oct 28 10:26:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82615 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 D29B7A04DD; Wed, 28 Oct 2020 11:27:42 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8664CC9BA; Wed, 28 Oct 2020 11:27:06 +0100 (CET) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id D7B2FC996 for ; Wed, 28 Oct 2020 11:27:02 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 780365C013C; Wed, 28 Oct 2020 06:27:01 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Wed, 28 Oct 2020 06:27: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=SLQHZ4oISK+Ea ZcBn6REcBRcuC4K9L09BvwFbP5o2+Q=; b=UHzc85k1+0gG2vn2b8MKIdyJPoORU BENWupMwz5xEfWhjriiezUTcXQJyIjbEH0vm5zoBc3aV87MNjE9gglMvvE+7AT8c eGlVtE3zXj1XhNMEV9M0hflo6cNhJrKcxLKkeLhBQwMZgLrY49ebsjuz0J6lyU6b 0nm0iSr63JKaJwaD6p8vmPEIE52CsgNCh9vo7W4OLwBNjLbLFX1h9kCGF53r2ips eq4/wmePTbjJGHgNb+g3yaS/uKvtvp4IOxLOH6NV+Devrt4JdEm6rb2QeXZUQ/bf H5RRWLG5YzWFlBBXPZ+/21oGctqKg8cyX075Jnlvu868icyIy+3vHQf6w== 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=ghlUYkJr zL1+qcBbITpCyxfc+se7Gdjss7UAWqgBL4+0JA25fqyECy3y5TyPCq22F4MfGrxL O0Efv+zTafe2AnqbyGlJBLQPki/DseOg0b1EPrQ0nRhcSHBD/D6MmcKV0jH5NvoK Zfxm65AC3u10IcsXoe1xAZhDYGDuMCny+rBvepegsjEK6+k57Ij10B9XSbd0TNzs J2JZmq11NvjRG7+OP2v1tJhuwkGIz0btoQXvYUGZLUWOkgH6kCYxS4E55VEji1Up RLAnFRkCrt/nQ/n8I2Yossa8zZabGdrbQo17DdmxEPGdy9qTChR+RVShSAJw5UTO 3Szmw4Swh/z1hQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrledugdduhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpefvhhhomhgrshcuofhonhhjrghlohhnuceothhhohhmrghssehm ohhnjhgrlhhonhdrnhgvtheqnecuggftrfgrthhtvghrnhepvdehgfeivdejgedtveehfe fhteelfefgieevgfffveefjeegtdfguedthedtgeevnecukfhppeejjedrudefgedrvddt fedrudekgeenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhroh hmpehthhhomhgrshesmhhonhhjrghlohhnrdhnvght X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 802603280060; Wed, 28 Oct 2020 06:27:00 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@intel.com, david.marchand@redhat.com, bruce.richardson@intel.com, olivier.matz@6wind.com, andrew.rybchenko@oktetlabs.ru, akhil.goyal@nxp.com Date: Wed, 28 Oct 2020 11:26:27 +0100 Message-Id: <20201028102640.3191964-3-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201028102640.3191964-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201028102640.3191964-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 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 Wed Oct 28 10:26:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82616 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 7B9BDA04DD; Wed, 28 Oct 2020 11:28:03 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 281ABC9CC; Wed, 28 Oct 2020 11:27:10 +0100 (CET) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id B84EEC9CC; Wed, 28 Oct 2020 11:27:07 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 60C305C018D; Wed, 28 Oct 2020 06:27:06 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Wed, 28 Oct 2020 06:27:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=rrwCap5BZSoHK 2YcU5LKb5C1tJv9i5GLPlZsCf345kw=; b=AEiys/hKDAA5kh+/H1m1tpLh5hfX1 aulciseWuLdvwIMG7YfGtKCg2W+5uq9tQBMIrJ2blf7RDhh/jcf5NjCRHjI17VTs cJAEElpQvCHLG9V/h8E/FuF0IEj/hV9z4xZ+ajayqZzAaUc83EXvCHMHZL8uhma/ YA48aLT36G5/fjRnbapxHxHd10uGwaKoUDv9AjeigLjh8szNdSfO/zvXyIzp36Ae pecibg/p8a9fdSsnfayrcyN4sP20ikolFokzrQopdkxJn2H0zEVFQfeNVwJxZe7y Ap+kRG1PqMKv5srBYg6Tl4vSd8co1T+A0dALoez/NHUjkFu5ZUKh4j+/g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=rrwCap5BZSoHK2YcU5LKb5C1tJv9i5GLPlZsCf345kw=; b=P5YBMgKX IbtsSfbcAU+6T9Dvns/qAXHfVsfqUwAvSvpQxeU2UcyRa+SFQqUBZD4Jd13oJr+L oHtC0KTq/08RRA+Ul2EM7zXopGQwKU4bpHc3xMAwCqjhh+NS4shkhKsAgOPz+xGs u21AEuCc+HeV/Gxc1VgwUH7zrrqUzc8mCj33xN84yYS/ATsqP87rw6SZNQspLNLg KZpdykQsRx7sLq1dhpFSiClw/DDgvAmpEs8yCOuAq+WKkhZtNo8TZWk2Jvp6RnoH Qq2YQSsFoHXktv53S/a4RsVA9VmJ25FIH/0OVlC2Aocph3TSh/eWTgVP2zemi93Q /MHh2hpySiEIjA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrledugdduhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgepudenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho nhdrnhgvth X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 3FA9C3280064; Wed, 28 Oct 2020 06:27:05 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@intel.com, david.marchand@redhat.com, bruce.richardson@intel.com, olivier.matz@6wind.com, andrew.rybchenko@oktetlabs.ru, akhil.goyal@nxp.com, stable@dpdk.org, Konstantin Ananyev Date: Wed, 28 Oct 2020 11:26:28 +0100 Message-Id: <20201028102640.3191964-4-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201028102640.3191964-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201028102640.3191964-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 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 Wed Oct 28 10:26:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82617 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 3A127A04DD; Wed, 28 Oct 2020 11:28:24 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 06F31C9E0; Wed, 28 Oct 2020 11:27:14 +0100 (CET) Received: from new1-smtp.messagingengine.com (new1-smtp.messagingengine.com [66.111.4.221]) by dpdk.org (Postfix) with ESMTP id 7CC36C9D4 for ; Wed, 28 Oct 2020 11:27:10 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailnew.nyi.internal (Postfix) with ESMTP id 2E40B580388; Wed, 28 Oct 2020 06:27:09 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Wed, 28 Oct 2020 06:27: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=b2/UgouepwNuH akdJkmPqZDAY7jia25Ie/3cISWNZ/4=; b=NEmu+9W4Hi8cidOKzp4DwszBQC/qV DOvx4IuXfJN2dIoTS50kxVWUYXsPWPLVB+rogpdgX5cXly41QmGAu8G7rS2gHTur pYiuvSZcnZHvcQEKfQifF2riCOTB5VmuQ+lQ3ukyFFcUGedY/Alq3YH7g7p0Dvxy dJmai5KQmWpyG8KaLkvO8FNNh6T5J9WGzzvGOxMvDlgpNFbzXKtf3luxJFTLsLDs mTFBcgYw1LYBGG2MWKAQGyOe6IJ73b0v9P+bdXUBRfPfPWE7unUXOKCOhy4qq+1B qXw3n26gQQ8MViCCWk0BLk3/OHQdxPfEaaRtYrwC0RhMfcNYtslLH9QRw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=b2/UgouepwNuHakdJkmPqZDAY7jia25Ie/3cISWNZ/4=; b=GL6FkAJ6 5BOiH4eLh20yx3gexG5grYvgXrGtPHFyJvO4X05o7y9I9qqcYrr3ZBSwwIe63Ekq CWK82rtQUR/hq+35JKZNgxBS47Hd7xHec4oCDTpqD0RWzHX9kmyWGERk1ah6mqoP agwlE5sJlbJezX4gYOnxOFg51CgjU672/lP6NdQhX5Qk4vh4SSoF79K05KBcxufu LzgnQKmSYs9NnCdSrSi6oXuci/UjVVP2FP5bFsAx/r6ZMjsPzYax56MbHYoyTtHB Bwbvz6VuhAR+OU889rTkga9SmnGVr5nh+Trh/3H8nUX8p7QqHoVhBmtARkelYA3t iOZEJdEFNeKlVA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrledugdduhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgepfeenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho nhdrnhgvth X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 603C23280059; Wed, 28 Oct 2020 06:27:07 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@intel.com, david.marchand@redhat.com, bruce.richardson@intel.com, olivier.matz@6wind.com, andrew.rybchenko@oktetlabs.ru, akhil.goyal@nxp.com, Nithin Dabilpuram , Pavan Nikhilesh , Jerin Jacob , Ruifeng Wang , Konstantin Ananyev Date: Wed, 28 Oct 2020 11:26:29 +0100 Message-Id: <20201028102640.3191964-5-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201028102640.3191964-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201028102640.3191964-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 04/15] node: switch IPv4 metadata to dynamic mbuf field X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Nithin Dabilpuram The node_mbuf_priv1 was stored in the deprecated mbuf field udata64. It is moved to a dynamic field in order to allow removal of udata64. Signed-off-by: Thomas Monjalon Signed-off-by: Nithin Dabilpuram --- lib/librte_node/ip4_lookup.c | 40 ++++++++++++++++++------- lib/librte_node/ip4_lookup_neon.h | 20 ++++++------- lib/librte_node/ip4_lookup_sse.h | 36 +++++++++++------------ lib/librte_node/ip4_rewrite.c | 49 +++++++++++++++++++++++-------- lib/librte_node/node_private.h | 13 ++++++-- 5 files changed, 103 insertions(+), 55 deletions(-) diff --git a/lib/librte_node/ip4_lookup.c b/lib/librte_node/ip4_lookup.c index 8835aab9dd..d083a725fc 100644 --- a/lib/librte_node/ip4_lookup.c +++ b/lib/librte_node/ip4_lookup.c @@ -29,8 +29,23 @@ struct ip4_lookup_node_main { struct rte_lpm *lpm_tbl[RTE_MAX_NUMA_NODES]; }; +struct ip4_lookup_node_ctx { + /* Socket's LPM table */ + struct rte_lpm *lpm; + /* Dynamic offset to mbuf priv1 */ + int mbuf_priv1_off; +}; + +int node_mbuf_priv1_dynfield_offset = -1; + static struct ip4_lookup_node_main ip4_lookup_nm; +#define IP4_LOOKUP_NODE_LPM(ctx) \ + (((struct ip4_lookup_node_ctx *)ctx)->lpm) + +#define IP4_LOOKUP_NODE_PRIV1_OFF(ctx) \ + (((struct ip4_lookup_node_ctx *)ctx)->mbuf_priv1_off) + #if defined(__ARM_NEON) #include "ip4_lookup_neon.h" #elif defined(RTE_ARCH_X86) @@ -41,12 +56,13 @@ static uint16_t ip4_lookup_node_process_scalar(struct rte_graph *graph, struct rte_node *node, void **objs, uint16_t nb_objs) { + struct rte_lpm *lpm = IP4_LOOKUP_NODE_LPM(node->ctx); + const int dyn = IP4_LOOKUP_NODE_PRIV1_OFF(node->ctx); struct rte_ipv4_hdr *ipv4_hdr; void **to_next, **from; uint16_t last_spec = 0; struct rte_mbuf *mbuf; rte_edge_t next_index; - struct rte_lpm *lpm; uint16_t held = 0; uint32_t drop_nh; int i, rc; @@ -55,9 +71,6 @@ ip4_lookup_node_process_scalar(struct rte_graph *graph, struct rte_node *node, next_index = RTE_NODE_IP4_LOOKUP_NEXT_REWRITE; /* Drop node */ drop_nh = ((uint32_t)RTE_NODE_IP4_LOOKUP_NEXT_PKT_DROP) << 16; - - /* Get socket specific LPM from ctx */ - lpm = *((struct rte_lpm **)node->ctx); from = objs; /* Get stream for the speculated next node */ @@ -72,14 +85,14 @@ ip4_lookup_node_process_scalar(struct rte_graph *graph, struct rte_node *node, ipv4_hdr = rte_pktmbuf_mtod_offset(mbuf, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); /* Extract cksum, ttl as ipv4 hdr is in cache */ - node_mbuf_priv1(mbuf)->cksum = ipv4_hdr->hdr_checksum; - node_mbuf_priv1(mbuf)->ttl = ipv4_hdr->time_to_live; + node_mbuf_priv1(mbuf, dyn)->cksum = ipv4_hdr->hdr_checksum; + node_mbuf_priv1(mbuf, dyn)->ttl = ipv4_hdr->time_to_live; rc = rte_lpm_lookup(lpm, rte_be_to_cpu_32(ipv4_hdr->dst_addr), &next_hop); next_hop = (rc == 0) ? next_hop : drop_nh; - node_mbuf_priv1(mbuf)->nh = (uint16_t)next_hop; + node_mbuf_priv1(mbuf, dyn)->nh = (uint16_t)next_hop; next_hop = next_hop >> 16; next = (uint16_t)next_hop; @@ -169,15 +182,19 @@ setup_lpm(struct ip4_lookup_node_main *nm, int socket) static int ip4_lookup_node_init(const struct rte_graph *graph, struct rte_node *node) { - struct rte_lpm **lpm_p = (struct rte_lpm **)&node->ctx; uint16_t socket, lcore_id; static uint8_t init_once; int rc; RTE_SET_USED(graph); - RTE_SET_USED(node); + RTE_BUILD_BUG_ON(sizeof(struct ip4_lookup_node_ctx) > RTE_NODE_CTX_SZ); if (!init_once) { + node_mbuf_priv1_dynfield_offset = rte_mbuf_dynfield_register( + &node_mbuf_priv1_dynfield_desc); + if (node_mbuf_priv1_dynfield_offset < 0) + return -rte_errno; + /* Setup LPM tables for all sockets */ RTE_LCORE_FOREACH(lcore_id) { @@ -192,7 +209,10 @@ ip4_lookup_node_init(const struct rte_graph *graph, struct rte_node *node) } init_once = 1; } - *lpm_p = ip4_lookup_nm.lpm_tbl[graph->socket]; + + /* Update socket's LPM and mbuf dyn priv1 offset in node ctx */ + IP4_LOOKUP_NODE_LPM(node->ctx) = ip4_lookup_nm.lpm_tbl[graph->socket]; + IP4_LOOKUP_NODE_PRIV1_OFF(node->ctx) = node_mbuf_priv1_dynfield_offset; #if defined(__ARM_NEON) || defined(RTE_ARCH_X86) if (rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128) diff --git a/lib/librte_node/ip4_lookup_neon.h b/lib/librte_node/ip4_lookup_neon.h index 0ad2763b82..d5c8da3719 100644 --- a/lib/librte_node/ip4_lookup_neon.h +++ b/lib/librte_node/ip4_lookup_neon.h @@ -11,12 +11,13 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node, void **objs, uint16_t nb_objs) { struct rte_mbuf *mbuf0, *mbuf1, *mbuf2, *mbuf3, **pkts; + struct rte_lpm *lpm = IP4_LOOKUP_NODE_LPM(node->ctx); + const int dyn = IP4_LOOKUP_NODE_PRIV1_OFF(node->ctx); struct rte_ipv4_hdr *ipv4_hdr; void **to_next, **from; uint16_t last_spec = 0; rte_edge_t next_index; uint16_t n_left_from; - struct rte_lpm *lpm; uint16_t held = 0; uint32_t drop_nh; rte_xmm_t result; @@ -30,9 +31,6 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node, /* Drop node */ drop_nh = ((uint32_t)RTE_NODE_IP4_LOOKUP_NEXT_PKT_DROP) << 16; - /* Get socket specific LPM from ctx */ - lpm = *((struct rte_lpm **)node->ctx); - pkts = (struct rte_mbuf **)objs; from = objs; n_left_from = nb_objs; @@ -119,10 +117,10 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node, priv23.u16[0] = result.u16[4]; priv23.u16[4] = result.u16[6]; - node_mbuf_priv1(mbuf0)->u = priv01.u64[0]; - node_mbuf_priv1(mbuf1)->u = priv01.u64[1]; - node_mbuf_priv1(mbuf2)->u = priv23.u64[0]; - node_mbuf_priv1(mbuf3)->u = priv23.u64[1]; + node_mbuf_priv1(mbuf0, dyn)->u = priv01.u64[0]; + node_mbuf_priv1(mbuf1, dyn)->u = priv01.u64[1]; + node_mbuf_priv1(mbuf2, dyn)->u = priv23.u64[0]; + node_mbuf_priv1(mbuf3, dyn)->u = priv23.u64[1]; /* Enqueue four to next node */ rte_edge_t fix_spec = ((next_index == result.u16[1]) && @@ -197,14 +195,14 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node, ipv4_hdr = rte_pktmbuf_mtod_offset(mbuf0, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); /* Extract cksum, ttl as ipv4 hdr is in cache */ - node_mbuf_priv1(mbuf0)->cksum = ipv4_hdr->hdr_checksum; - node_mbuf_priv1(mbuf0)->ttl = ipv4_hdr->time_to_live; + node_mbuf_priv1(mbuf0, dyn)->cksum = ipv4_hdr->hdr_checksum; + node_mbuf_priv1(mbuf0, dyn)->ttl = ipv4_hdr->time_to_live; rc = rte_lpm_lookup(lpm, rte_be_to_cpu_32(ipv4_hdr->dst_addr), &next_hop); next_hop = (rc == 0) ? next_hop : drop_nh; - node_mbuf_priv1(mbuf0)->nh = (uint16_t)next_hop; + node_mbuf_priv1(mbuf0, dyn)->nh = (uint16_t)next_hop; next_hop = next_hop >> 16; next0 = (uint16_t)next_hop; diff --git a/lib/librte_node/ip4_lookup_sse.h b/lib/librte_node/ip4_lookup_sse.h index 264c986071..74dbf97533 100644 --- a/lib/librte_node/ip4_lookup_sse.h +++ b/lib/librte_node/ip4_lookup_sse.h @@ -11,13 +11,14 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node, void **objs, uint16_t nb_objs) { struct rte_mbuf *mbuf0, *mbuf1, *mbuf2, *mbuf3, **pkts; + struct rte_lpm *lpm = IP4_LOOKUP_NODE_LPM(node->ctx); + const int dyn = IP4_LOOKUP_NODE_PRIV1_OFF(node->ctx); rte_edge_t next0, next1, next2, next3, next_index; struct rte_ipv4_hdr *ipv4_hdr; uint32_t ip0, ip1, ip2, ip3; void **to_next, **from; uint16_t last_spec = 0; uint16_t n_left_from; - struct rte_lpm *lpm; uint16_t held = 0; uint32_t drop_nh; rte_xmm_t dst; @@ -29,9 +30,6 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node, /* Drop node */ drop_nh = ((uint32_t)RTE_NODE_IP4_LOOKUP_NEXT_PKT_DROP) << 16; - /* Get socket specific LPM from ctx */ - lpm = *((struct rte_lpm **)node->ctx); - pkts = (struct rte_mbuf **)objs; from = objs; n_left_from = nb_objs; @@ -78,24 +76,24 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node, sizeof(struct rte_ether_hdr)); ip0 = ipv4_hdr->dst_addr; /* Extract cksum, ttl as ipv4 hdr is in cache */ - node_mbuf_priv1(mbuf0)->cksum = ipv4_hdr->hdr_checksum; - node_mbuf_priv1(mbuf0)->ttl = ipv4_hdr->time_to_live; + node_mbuf_priv1(mbuf0, dyn)->cksum = ipv4_hdr->hdr_checksum; + node_mbuf_priv1(mbuf0, dyn)->ttl = ipv4_hdr->time_to_live; /* Extract DIP of mbuf1 */ ipv4_hdr = rte_pktmbuf_mtod_offset(mbuf1, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); ip1 = ipv4_hdr->dst_addr; /* Extract cksum, ttl as ipv4 hdr is in cache */ - node_mbuf_priv1(mbuf1)->cksum = ipv4_hdr->hdr_checksum; - node_mbuf_priv1(mbuf1)->ttl = ipv4_hdr->time_to_live; + node_mbuf_priv1(mbuf1, dyn)->cksum = ipv4_hdr->hdr_checksum; + node_mbuf_priv1(mbuf1, dyn)->ttl = ipv4_hdr->time_to_live; /* Extract DIP of mbuf2 */ ipv4_hdr = rte_pktmbuf_mtod_offset(mbuf2, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); ip2 = ipv4_hdr->dst_addr; /* Extract cksum, ttl as ipv4 hdr is in cache */ - node_mbuf_priv1(mbuf2)->cksum = ipv4_hdr->hdr_checksum; - node_mbuf_priv1(mbuf2)->ttl = ipv4_hdr->time_to_live; + node_mbuf_priv1(mbuf2, dyn)->cksum = ipv4_hdr->hdr_checksum; + node_mbuf_priv1(mbuf2, dyn)->ttl = ipv4_hdr->time_to_live; /* Extract DIP of mbuf3 */ ipv4_hdr = rte_pktmbuf_mtod_offset(mbuf3, struct rte_ipv4_hdr *, @@ -111,23 +109,23 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node, dip = _mm_shuffle_epi8(dip, bswap_mask); /* Extract cksum, ttl as ipv4 hdr is in cache */ - node_mbuf_priv1(mbuf3)->cksum = ipv4_hdr->hdr_checksum; - node_mbuf_priv1(mbuf3)->ttl = ipv4_hdr->time_to_live; + node_mbuf_priv1(mbuf3, dyn)->cksum = ipv4_hdr->hdr_checksum; + node_mbuf_priv1(mbuf3, dyn)->ttl = ipv4_hdr->time_to_live; /* Perform LPM lookup to get NH and next node */ rte_lpm_lookupx4(lpm, dip, dst.u32, drop_nh); /* Extract next node id and NH */ - node_mbuf_priv1(mbuf0)->nh = dst.u32[0] & 0xFFFF; + node_mbuf_priv1(mbuf0, dyn)->nh = dst.u32[0] & 0xFFFF; next0 = (dst.u32[0] >> 16); - node_mbuf_priv1(mbuf1)->nh = dst.u32[1] & 0xFFFF; + node_mbuf_priv1(mbuf1, dyn)->nh = dst.u32[1] & 0xFFFF; next1 = (dst.u32[1] >> 16); - node_mbuf_priv1(mbuf2)->nh = dst.u32[2] & 0xFFFF; + node_mbuf_priv1(mbuf2, dyn)->nh = dst.u32[2] & 0xFFFF; next2 = (dst.u32[2] >> 16); - node_mbuf_priv1(mbuf3)->nh = dst.u32[3] & 0xFFFF; + node_mbuf_priv1(mbuf3, dyn)->nh = dst.u32[3] & 0xFFFF; next3 = (dst.u32[3] >> 16); /* Enqueue four to next node */ @@ -202,14 +200,14 @@ ip4_lookup_node_process_vec(struct rte_graph *graph, struct rte_node *node, ipv4_hdr = rte_pktmbuf_mtod_offset(mbuf0, struct rte_ipv4_hdr *, sizeof(struct rte_ether_hdr)); /* Extract cksum, ttl as ipv4 hdr is in cache */ - node_mbuf_priv1(mbuf0)->cksum = ipv4_hdr->hdr_checksum; - node_mbuf_priv1(mbuf0)->ttl = ipv4_hdr->time_to_live; + node_mbuf_priv1(mbuf0, dyn)->cksum = ipv4_hdr->hdr_checksum; + node_mbuf_priv1(mbuf0, dyn)->ttl = ipv4_hdr->time_to_live; rc = rte_lpm_lookup(lpm, rte_be_to_cpu_32(ipv4_hdr->dst_addr), &next_hop); next_hop = (rc == 0) ? next_hop : drop_nh; - node_mbuf_priv1(mbuf0)->nh = next_hop & 0xFFFF; + node_mbuf_priv1(mbuf0, dyn)->nh = next_hop & 0xFFFF; next0 = (next_hop >> 16); if (unlikely(next_index ^ next0)) { diff --git a/lib/librte_node/ip4_rewrite.c b/lib/librte_node/ip4_rewrite.c index bb7f671b5c..99ecb457ff 100644 --- a/lib/librte_node/ip4_rewrite.c +++ b/lib/librte_node/ip4_rewrite.c @@ -19,14 +19,28 @@ #include "ip4_rewrite_priv.h" #include "node_private.h" +struct ip4_rewrite_node_ctx { + /* Dynamic offset to mbuf priv1 */ + int mbuf_priv1_off; + /* Cached next index */ + uint16_t next_index; +}; + static struct ip4_rewrite_node_main *ip4_rewrite_nm; +#define IP4_REWRITE_NODE_LAST_NEXT(ctx) \ + (((struct ip4_rewrite_node_ctx *)ctx)->next_index) + +#define IP4_REWRITE_NODE_PRIV1_OFF(ctx) \ + (((struct ip4_rewrite_node_ctx *)ctx)->mbuf_priv1_off) + static uint16_t ip4_rewrite_node_process(struct rte_graph *graph, struct rte_node *node, void **objs, uint16_t nb_objs) { struct rte_mbuf *mbuf0, *mbuf1, *mbuf2, *mbuf3, **pkts; struct ip4_rewrite_nh_header *nh = ip4_rewrite_nm->nh; + const int dyn = IP4_REWRITE_NODE_PRIV1_OFF(node->ctx); uint16_t next0, next1, next2, next3, next_index; struct rte_ipv4_hdr *ip0, *ip1, *ip2, *ip3; uint16_t n_left_from, held = 0, last_spec = 0; @@ -37,7 +51,7 @@ ip4_rewrite_node_process(struct rte_graph *graph, struct rte_node *node, int i; /* Speculative next as last next */ - next_index = *(uint16_t *)node->ctx; + next_index = IP4_REWRITE_NODE_LAST_NEXT(node->ctx); rte_prefetch0(nh); pkts = (struct rte_mbuf **)objs; @@ -68,10 +82,10 @@ ip4_rewrite_node_process(struct rte_graph *graph, struct rte_node *node, pkts += 4; n_left_from -= 4; - priv01.u64[0] = node_mbuf_priv1(mbuf0)->u; - priv01.u64[1] = node_mbuf_priv1(mbuf1)->u; - priv23.u64[0] = node_mbuf_priv1(mbuf2)->u; - priv23.u64[1] = node_mbuf_priv1(mbuf3)->u; + priv01.u64[0] = node_mbuf_priv1(mbuf0, dyn)->u; + priv01.u64[1] = node_mbuf_priv1(mbuf1, dyn)->u; + priv23.u64[0] = node_mbuf_priv1(mbuf2, dyn)->u; + priv23.u64[1] = node_mbuf_priv1(mbuf3, dyn)->u; /* Increment checksum by one. */ priv01.u32[1] += rte_cpu_to_be_16(0x0100); @@ -203,17 +217,17 @@ ip4_rewrite_node_process(struct rte_graph *graph, struct rte_node *node, n_left_from -= 1; d0 = rte_pktmbuf_mtod(mbuf0, void *); - rte_memcpy(d0, nh[node_mbuf_priv1(mbuf0)->nh].rewrite_data, - nh[node_mbuf_priv1(mbuf0)->nh].rewrite_len); + rte_memcpy(d0, nh[node_mbuf_priv1(mbuf0, dyn)->nh].rewrite_data, + nh[node_mbuf_priv1(mbuf0, dyn)->nh].rewrite_len); - next0 = nh[node_mbuf_priv1(mbuf0)->nh].tx_node; + next0 = nh[node_mbuf_priv1(mbuf0, dyn)->nh].tx_node; ip0 = (struct rte_ipv4_hdr *)((uint8_t *)d0 + sizeof(struct rte_ether_hdr)); - chksum = node_mbuf_priv1(mbuf0)->cksum + + chksum = node_mbuf_priv1(mbuf0, dyn)->cksum + rte_cpu_to_be_16(0x0100); chksum += chksum >= 0xffff; ip0->hdr_checksum = chksum; - ip0->time_to_live = node_mbuf_priv1(mbuf0)->ttl - 1; + ip0->time_to_live = node_mbuf_priv1(mbuf0, dyn)->ttl - 1; if (unlikely(next_index ^ next0)) { /* Copy things successfully speculated till now */ @@ -240,7 +254,7 @@ ip4_rewrite_node_process(struct rte_graph *graph, struct rte_node *node, rte_memcpy(to_next, from, last_spec * sizeof(from[0])); rte_node_next_stream_put(graph, node, next_index, held); /* Save the last next used */ - *(uint16_t *)node->ctx = next_index; + IP4_REWRITE_NODE_LAST_NEXT(node->ctx) = next_index; return nb_objs; } @@ -248,9 +262,20 @@ ip4_rewrite_node_process(struct rte_graph *graph, struct rte_node *node, static int ip4_rewrite_node_init(const struct rte_graph *graph, struct rte_node *node) { + static bool init_once; RTE_SET_USED(graph); - RTE_SET_USED(node); + RTE_BUILD_BUG_ON(sizeof(struct ip4_rewrite_node_ctx) > RTE_NODE_CTX_SZ); + + if (!init_once) { + node_mbuf_priv1_dynfield_offset = rte_mbuf_dynfield_register( + &node_mbuf_priv1_dynfield_desc); + if (node_mbuf_priv1_dynfield_offset < 0) + return -rte_errno; + init_once = true; + } + IP4_REWRITE_NODE_PRIV1_OFF(node->ctx) = node_mbuf_priv1_dynfield_offset; + node_dbg("ip4_rewrite", "Initialized ip4_rewrite node initialized"); return 0; diff --git a/lib/librte_node/node_private.h b/lib/librte_node/node_private.h index ab7941c12b..8c73d5dc10 100644 --- a/lib/librte_node/node_private.h +++ b/lib/librte_node/node_private.h @@ -8,6 +8,7 @@ #include #include #include +#include extern int rte_node_logtype; #define NODE_LOG(level, node_name, ...) \ @@ -21,7 +22,6 @@ extern int rte_node_logtype; #define node_dbg(node_name, ...) NODE_LOG(DEBUG, node_name, __VA_ARGS__) /** - * * Node mbuf private data to store next hop, ttl and checksum. */ struct node_mbuf_priv1 { @@ -37,6 +37,13 @@ struct node_mbuf_priv1 { }; }; +static const struct rte_mbuf_dynfield node_mbuf_priv1_dynfield_desc = { + .name = "rte_node_dynfield_priv1", + .size = sizeof(struct node_mbuf_priv1), + .align = __alignof__(struct node_mbuf_priv1), +}; +extern int node_mbuf_priv1_dynfield_offset; + /** * Node mbuf private area 2. */ @@ -58,9 +65,9 @@ struct node_mbuf_priv2 { * Pointer to the mbuf_priv1. */ static __rte_always_inline struct node_mbuf_priv1 * -node_mbuf_priv1(struct rte_mbuf *m) +node_mbuf_priv1(struct rte_mbuf *m, const int offset) { - return (struct node_mbuf_priv1 *)&m->udata64; + return RTE_MBUF_DYNFIELD(m, offset, struct node_mbuf_priv1 *); } /** From patchwork Wed Oct 28 10:26:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82618 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 38721A04DD; Wed, 28 Oct 2020 11:28:48 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2525AC9F8; Wed, 28 Oct 2020 11:27:19 +0100 (CET) Received: from new1-smtp.messagingengine.com (new1-smtp.messagingengine.com [66.111.4.221]) by dpdk.org (Postfix) with ESMTP id B4F94C9EA for ; Wed, 28 Oct 2020 11:27:14 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailnew.nyi.internal (Postfix) with ESMTP id 632D4580388; Wed, 28 Oct 2020 06:27:13 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Wed, 28 Oct 2020 06:27:13 -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=ktlbMN6DhrmjjlEO/TaM1JVBrCmm6 DZbKgdq2hAQb7zK4tcomJjVoAHIH7H1iC1WixIettu7GsOQkM0pVOi02zgQ2xN/2 eSJ7rsJdK1FBcPcb8GViN3c33XUevRshEWpAMGWtqs+anIsSLP/5BXK4Y38AXVXo qdEW7d2pBYN9Kc4YV7ma/I9Mtf++t6iKhSNtKfJDoAZaf/JnJILAuUcTJWZVH4aZ AeXUtwiN9UTbh9Tm9f50EwY5h0oq9uksJF45B1mqRv3bDaSkYm4m+FsZl5MAp9nZ M+lbiR2nv0sSB+bB6BzM9xa5Yn7O6b5Vk/iNDSba1K0kDQqRvvmmce/rg== 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=HsvTfQA3 uz17qVlOW1+6LJ/hoj+vE3qc4b5uPWAeiOYaG/I29/bzUpfqlKNoYIg3OvsM36cD ywYvIBpN3ecBiD2iSIii33UfMOLy76fMEnH/jiqNq1x1PbmnZZ+iqREAlzF1x2L+ X91wPHHL3+rK2h5EDNsOdIlRoXW93+QOYBLPgkDwECX0wazpALzXQ0N9KsbY6nQe ulg7lnEu9zwxvtxPO3i7l8pwmztwFq0d/oJfanzq9eOohpE5pRUETD9Iv1uRUxV1 vt/siYcYqf/40vTlmYxQGiH0gRRGW1d505GOSHuFC6TdnIG9qK2eypT0u8LoSxSp AiRZBx4JG0OkzQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrledugdduhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgepfeenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho nhdrnhgvth X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id CD2793280059; Wed, 28 Oct 2020 06:27:09 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@intel.com, david.marchand@redhat.com, bruce.richardson@intel.com, olivier.matz@6wind.com, andrew.rybchenko@oktetlabs.ru, akhil.goyal@nxp.com, Haiyue Wang , Declan Doherty , Ankur Dwivedi , Anoob Joseph , Jeff Guo , Jerin Jacob , Nithin Dabilpuram , Kiran Kumar K , Radu Nicolau , Ray Kinsella , Neil Horman Date: Wed, 28 Oct 2020 11:26:30 +0100 Message-Id: <20201028102640.3191964-6-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201028102640.3191964-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201028102640.3191964-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 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 Wed Oct 28 10:26:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82619 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 9F025A04DD; Wed, 28 Oct 2020 11:29:07 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CCAB4CA00; Wed, 28 Oct 2020 11:27:20 +0100 (CET) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id EB131C9EC for ; Wed, 28 Oct 2020 11:27:14 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id A227F5C019C; Wed, 28 Oct 2020 06:27:13 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Wed, 28 Oct 2020 06:27:13 -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=voIRqonoo8ELGewK8WzvfZ3df+CPS EGeN5iNYKhDoAOm4twlO8AGaId6o8NITS5jy4qCgShjvcLxFtbWFKJPMTOgwyNe6 zVbSEi0iHhWLpz1IDa2Asdbrb7iPQiTbBc456WxHuAfD+xJF1Gn+O29zSKJ6/0EB C3QjFnUzVH6rAn4UTteadrjEz7oWJimKh1oPfzJ3VdJaEcuD1XL5snGhUyt4mvao Vg6MqZ8PAGDWfjXXzxsmeQ9fJBIqVu2+6Qkt9J2R1+N6IPeFV7Ns7a8A+a/NHRzw wCPs6zI5izmTQSWBqlU+j+J3ZW8yjh8+hSAbTCtlH3zkQmH/CLvnMiXJw== 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=eXtXqtx3 NnTvLvX6bA3aAgmN2AMDTRPgbXgvCD4diOk4YYeW9dlyghUPnAr4Vxmf3PtZ8vgh byel0JErrWZ6jrt+/bWUTXy829UseWqZexmYGLToOjPt8qwEJldr8Na7Og6Qn2Lq HcRNbw6DYuAhhQW6YC5oUH9ARsFddFx6SEc/YA/PyKPpTqKclqv2/nwUpkhR9Dwi jjyKjTiFXtK+m7EfJTmT3nM55ShkmvWXbrxwywASZ9/NqfzC2GoBAT2TFYogqA4k Ebl8k44HypI4nH+GlOIR0WB1BCbkxbixRPjyrZklxsFCXpOVqvsBgXHcr72hCmc5 tZgxad2dNGejcg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrledugdduhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgepheenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho nhdrnhgvth X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id A3B0E328005E; Wed, 28 Oct 2020 06:27:12 -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: Wed, 28 Oct 2020 11:26:31 +0100 Message-Id: <20201028102640.3191964-7-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201028102640.3191964-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201028102640.3191964-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 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 Wed Oct 28 10:26:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82620 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 BCEBCA04DD; Wed, 28 Oct 2020 11:29:22 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7F6B0CA10; Wed, 28 Oct 2020 11:27:22 +0100 (CET) Received: from new1-smtp.messagingengine.com (new1-smtp.messagingengine.com [66.111.4.221]) by dpdk.org (Postfix) with ESMTP id 9C689C9F8 for ; Wed, 28 Oct 2020 11:27:17 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailnew.nyi.internal (Postfix) with ESMTP id 4E42C5803A7; Wed, 28 Oct 2020 06:27:16 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Wed, 28 Oct 2020 06:27:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=YGjUJsKehJWXi WjrnXqL8aKk3a7qS0fp1jDNVzWeQ2o=; b=ZAMw6gpvwoA/zZVb7bn6ALOZ7eCIE TocsyE+Z8IL/KzoXGs0U8enr31cAtyHHVLcaIjU+CZ1emYvnBhD6hERfLQxabPsw QoxavRt2EHqmExVV7IGDYLb2HoV6PmST2gn+fIK33E/sSGI4M6VlsZaimouHdBuu /wBfE0JPYCIWSJXZYEsMQnzy9IB21hpV9ARrMky8UZHB+JHlFfmobZ4xzOm4fQ3n pU5G/qz9ztB7N93R9T3irh7gV4U0wUU0X8MDMMQa8Kj7xP3cr7OYnlfHZL8nwN7a 1XQMZM2vXunZFNw6XhR9uvWSlX0D9Wyr75btk6ijfPHXoxSmiHl9xXdwg== 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=YGjUJsKehJWXiWjrnXqL8aKk3a7qS0fp1jDNVzWeQ2o=; b=JhrDIYpH 6KSHNyHEDkQ0uTfUUp4N/OrqNC0KEBbahF+gHFmwhZRiuq4v2ZsZLQzc2886MBVF aRK1G/qg7jyFYy+CSRQfz1oPhNDfWR4mVTWpfg73t84WEs/H1V9WVObZ90PLG44A gfixhF/vjgZxCgzEG8BQ2O+RD2v+/gSu3VhuMAPd/zLck0ntK4tq4O7VOnSzusi0 5i8uKThwFtLcrFRvQqo9cydChB+KeH8LEk33F+uY74eXSvuWMa1ASh6+eD2rdMso o82Btq766R3AdLX7psOuB6zJTMsIjtOXHrhmdsjQuA20q/FAqpRyfNcFy4oO7L/I lFYdx7LcSTxafw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrledugdduhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpeehjefhvdffueehieevuddvfeeigefhtddvvddtheehgfekfefhtdfh teffgeetueenucffohhmrghinheptghonhhfrdhinhenucfkphepjeejrddufeegrddvtd efrddukeegnecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilhhfrhho mhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id CFDB33280069; Wed, 28 Oct 2020 06:27:14 -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, Ed Czeck , Shepard Siegel , John Miller , Ray Kinsella , Neil Horman Date: Wed, 28 Oct 2020 11:26:32 +0100 Message-Id: <20201028102640.3191964-8-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201028102640.3191964-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201028102640.3191964-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 07/15] net/ark: switch user data to dynamic mbuf fields X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Ed Czeck The second field of metadata is reserved for user data which was using a deprecated mbuf field. It is moved to dynamic fields in order to allow removal of udata64. The use of meta data must be enabled with a compile-time flag RTE_PMD_ARK_{TX,RX}_USERDATA_ENABLE. User data on Tx and Rx paths can be defined and used separately. Signed-off-by: Thomas Monjalon Signed-off-by: Ed Czeck --- doc/api/doxy-api-index.md | 1 + doc/api/doxy-api.conf.in | 1 + drivers/net/ark/ark_ethdev.c | 39 ++++++++++ drivers/net/ark/ark_ethdev_rx.c | 3 +- drivers/net/ark/ark_ethdev_tx.c | 3 +- drivers/net/ark/meson.build | 2 + drivers/net/ark/rte_pmd_ark.h | 123 ++++++++++++++++++++++++++++++++ drivers/net/ark/version.map | 7 ++ 8 files changed, 177 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..7b03f0fbc2 100644 --- a/drivers/net/ark/ark_ethdev.c +++ b/drivers/net/ark/ark_ethdev.c @@ -10,6 +10,7 @@ #include #include +#include "rte_pmd_ark.h" #include "ark_global.h" #include "ark_logs.h" #include "ark_ethdev_tx.h" @@ -78,6 +79,9 @@ static int eth_ark_set_mtu(struct rte_eth_dev *dev, uint16_t size); #define ARK_TX_MAX_QUEUE (4096 * 4) #define ARK_TX_MIN_QUEUE (256) +int rte_pmd_ark_rx_userdata_dynfield_offset = -1; +int rte_pmd_ark_tx_userdata_dynfield_offset = -1; + static const char * const valid_arguments[] = { ARK_PKTGEN_ARG, ARK_PKTCHKR_ARG, @@ -245,6 +249,16 @@ eth_ark_dev_init(struct rte_eth_dev *dev) int ret; int port_count = 1; int p; + static const struct rte_mbuf_dynfield ark_tx_userdata_dynfield_desc = { + .name = RTE_PMD_ARK_TX_USERDATA_DYNFIELD_NAME, + .size = sizeof(rte_pmd_ark_userdata_t), + .align = __alignof__(rte_pmd_ark_userdata_t), + }; + static const struct rte_mbuf_dynfield ark_rx_userdata_dynfield_desc = { + .name = RTE_PMD_ARK_RX_USERDATA_DYNFIELD_NAME, + .size = sizeof(rte_pmd_ark_userdata_t), + .align = __alignof__(rte_pmd_ark_userdata_t), + }; ark->eth_dev = dev; @@ -254,6 +268,31 @@ eth_ark_dev_init(struct rte_eth_dev *dev) ret = check_for_ext(ark); if (ret) return ret; + + /* Extra mbuf fields for user data */ + if (RTE_PMD_ARK_TX_USERDATA_ENABLE) { + rte_pmd_ark_tx_userdata_dynfield_offset = + rte_mbuf_dynfield_register(&ark_tx_userdata_dynfield_desc); + if (rte_pmd_ark_tx_userdata_dynfield_offset < 0) { + ARK_PMD_LOG(ERR, + "Failed to register mbuf field for tx userdata\n"); + return -rte_errno; + } + ARK_PMD_LOG(INFO, "Registered TX-meta dynamic field at %d\n", + rte_pmd_ark_tx_userdata_dynfield_offset); + } + if (RTE_PMD_ARK_RX_USERDATA_ENABLE) { + rte_pmd_ark_rx_userdata_dynfield_offset = + rte_mbuf_dynfield_register(&ark_rx_userdata_dynfield_desc); + if (rte_pmd_ark_rx_userdata_dynfield_offset < 0) { + ARK_PMD_LOG(ERR, + "Failed to register mbuf field for rx userdata\n"); + return -rte_errno; + } + ARK_PMD_LOG(INFO, "Registered RX-meta dynamic field at %d\n", + rte_pmd_ark_rx_userdata_dynfield_offset); + } + pci_dev = RTE_ETH_DEV_TO_PCI(dev); rte_eth_copy_pci_info(dev, pci_dev); dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS; diff --git a/drivers/net/ark/ark_ethdev_rx.c b/drivers/net/ark/ark_ethdev_rx.c index 2f8d05099c..825b4791be 100644 --- a/drivers/net/ark/ark_ethdev_rx.c +++ b/drivers/net/ark/ark_ethdev_rx.c @@ -4,6 +4,7 @@ #include +#include "rte_pmd_ark.h" #include "ark_ethdev_rx.h" #include "ark_global.h" #include "ark_logs.h" @@ -272,7 +273,7 @@ eth_ark_recv_pkts(void *rx_queue, mbuf->pkt_len = meta->pkt_len; mbuf->data_len = meta->pkt_len; mbuf->timestamp = meta->timestamp; - mbuf->udata64 = meta->user_data; + rte_pmd_ark_mbuf_rx_userdata_set(mbuf, meta->user_data); if (ARK_DEBUG_CORE) { /* debug sanity checks */ if ((meta->pkt_len > (1024 * 16)) || diff --git a/drivers/net/ark/ark_ethdev_tx.c b/drivers/net/ark/ark_ethdev_tx.c index a0e35af880..612d918e33 100644 --- a/drivers/net/ark/ark_ethdev_tx.c +++ b/drivers/net/ark/ark_ethdev_tx.c @@ -4,6 +4,7 @@ #include +#include "rte_pmd_ark.h" #include "ark_ethdev_tx.h" #include "ark_global.h" #include "ark_mpu.h" @@ -70,7 +71,7 @@ eth_ark_tx_meta_from_mbuf(struct ark_tx_meta *meta, uint8_t flags) { meta->physaddr = rte_mbuf_data_iova(mbuf); - meta->user1 = (uint32_t)mbuf->udata64; + meta->user1 = rte_pmd_ark_mbuf_tx_userdata_get(mbuf); meta->data_len = rte_pktmbuf_data_len(mbuf); meta->flags = flags; } diff --git a/drivers/net/ark/meson.build b/drivers/net/ark/meson.build index 99151bba1d..80bce94e1a 100644 --- a/drivers/net/ark/meson.build +++ b/drivers/net/ark/meson.build @@ -1,6 +1,8 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2018 Intel Corporation +headers = files('rte_pmd_ark.h') + sources = files('ark_ddm.c', 'ark_ethdev.c', 'ark_ethdev_rx.c', diff --git a/drivers/net/ark/rte_pmd_ark.h b/drivers/net/ark/rte_pmd_ark.h new file mode 100644 index 0000000000..2a23b82951 --- /dev/null +++ b/drivers/net/ark/rte_pmd_ark.h @@ -0,0 +1,123 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright (c) 2020 Atomic Rules LLC + */ + +#ifndef RTE_PMD_ARK_H +#define RTE_PMD_ARK_H + +/** + * @file + * ARK driver-specific API + */ + +#include +#include + +#ifndef RTE_PMD_ARK_TX_USERDATA_ENABLE +#define RTE_PMD_ARK_TX_USERDATA_ENABLE 0 +#endif + +#ifndef RTE_PMD_ARK_RX_USERDATA_ENABLE +#define RTE_PMD_ARK_RX_USERDATA_ENABLE 0 +#endif + +typedef uint32_t rte_pmd_ark_userdata_t; +extern int rte_pmd_ark_tx_userdata_dynfield_offset; +extern int rte_pmd_ark_rx_userdata_dynfield_offset; + +/** mbuf dynamic field for custom Tx ARK data */ +#define RTE_PMD_ARK_TX_USERDATA_DYNFIELD_NAME "rte_net_ark_dynfield_tx_userdata" +/** mbuf dynamic field for custom Rx ARK data */ +#define RTE_PMD_ARK_RX_USERDATA_DYNFIELD_NAME "rte_net_ark_dynfield_rx_userdata" + +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice + * + * Read Tx user data from mbuf. + * + * @param mbuf Structure to read from. + * @return user data + */ +__rte_experimental +static inline rte_pmd_ark_userdata_t +rte_pmd_ark_mbuf_tx_userdata_get(const struct rte_mbuf *mbuf) +{ +#if RTE_PMD_ARK_TX_USERDATA_ENABLE + return *RTE_MBUF_DYNFIELD(mbuf, rte_pmd_ark_tx_userdata_dynfield_offset, + rte_pmd_ark_userdata_t *); +#else + RTE_SET_USED(mbuf); + return 0; +#endif +} + +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice + * + * Write Tx user data to mbuf. + * + * @param mbuf Structure to write into. + * @param data User data. + */ +__rte_experimental +static inline void +rte_pmd_ark_mbuf_tx_userdata_set(struct rte_mbuf *mbuf, + rte_pmd_ark_userdata_t data) +{ +#if RTE_PMD_ARK_TX_USERDATA_ENABLE + *RTE_MBUF_DYNFIELD(mbuf, rte_pmd_ark_tx_userdata_dynfield_offset, + rte_pmd_ark_userdata_t *) = data; +#else + RTE_SET_USED(mbuf); + RTE_SET_USED(data); +#endif +} + +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice + * + * Read Rx user data from mbuf. + * + * @param mbuf Structure to read from. + * @return user data + */ +__rte_experimental +static inline rte_pmd_ark_userdata_t +rte_pmd_ark_mbuf_rx_userdata_get(const struct rte_mbuf *mbuf) +{ +#if RTE_PMD_ARK_RX_USERDATA_ENABLE + return *RTE_MBUF_DYNFIELD(mbuf, rte_pmd_ark_rx_userdata_dynfield_offset, + rte_pmd_ark_userdata_t *); +#else + RTE_SET_USED(mbuf); + return 0; +#endif +} + +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice + * + * Write Rx user data to mbuf. + * + * @param mbuf Structure to write into. + * @param data User data. + */ +__rte_experimental +static inline void +rte_pmd_ark_mbuf_rx_userdata_set(struct rte_mbuf *mbuf, + rte_pmd_ark_userdata_t data) +{ +#if RTE_PMD_ARK_RX_USERDATA_ENABLE + *RTE_MBUF_DYNFIELD(mbuf, rte_pmd_ark_rx_userdata_dynfield_offset, + rte_pmd_ark_userdata_t *) = data; +#else + RTE_SET_USED(mbuf); + RTE_SET_USED(data); +#endif +} + +#endif /* RTE_PMD_ARK_H */ diff --git a/drivers/net/ark/version.map b/drivers/net/ark/version.map index 4a76d1d52d..954bea6796 100644 --- a/drivers/net/ark/version.map +++ b/drivers/net/ark/version.map @@ -1,3 +1,10 @@ DPDK_21 { local: *; }; + +EXPERIMENTAL { + global: + + rte_pmd_ark_tx_userdata_dynfield_offset; + rte_pmd_ark_rx_userdata_dynfield_offset; +}; From patchwork Wed Oct 28 10:26:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82621 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 F2D3DA04DD; Wed, 28 Oct 2020 11:29:46 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B3F78CA18; Wed, 28 Oct 2020 11:27:29 +0100 (CET) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id A04A1C9FC for ; Wed, 28 Oct 2020 11:27:19 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 5367C5C01A3; Wed, 28 Oct 2020 06:27:18 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Wed, 28 Oct 2020 06:27:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=35KouOHKmhnO2 N0MhYSi0uf0EtybAxmBhe66ewb4wQw=; b=Oh+tIHwQFp3cKKOkgccVdG95DRcks zRLXzgqgqtZ2QaISkYCfkpJ28y0qdg6QhvshesjStNcBkf5CSCKq4QQ34c0mS+bE ho8E1OVohTpBn9cY09bECM7nN5K6X9SR8wBLTJnEmeuNABlujjrVz2jGfpmVnqv+ /9HcwSYLyIkbbvpczJokgOLZvuKmmwuB6i+ur2qhowrpof4rRnQ1WeT6Pk9Ir0ei Dr3CL6nKe2QZm5rqG6YlVy5l8EMFtcUKoB09sjNHKIKyUbtY6ajM1MfRXcjl8jQw T+km4TkysZxnnCCeAQ3ISffM3CAWOuakuU94F0CSWQYsn8CGoFnzaqODw== 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=PSLjHPsk xTKZhH4UvIe8VCuabvNAkT28/2xzOPPrDZnCGaz4zXVZUEj2ExUEBUwI5gKSZPcE u7svijwD+38YZ7BA+uSgQLLO8bB+YcwEevx39D671gTVE4IGoDABlzMcyYAM6eDl 3an+/6GGGsTKOPkivmGGHF096fhB48uS15TLLgBY1hoW64QBVh9ZrbRLdWeOnTVS OkE825iT/GGGfti0LUx8VSOhXVPdXYkJM8JsPDQ/QuOOtF6XAqmsyUUWQvx4wAX1 xqi7RB8hxxUChayqzqP3v6R70lHc4Q7W2aHPdWkb1kWYDR3QZDjjLalZ9CEpOCzt RUraoe1bHeXE0w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrledugdduhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpeehgfejgefgueevgfevvdekgefffedtkeehgeffjeeigeefueffudff hfelffffudenucffohhmrghinhepfhguihhrrdhiugenucfkphepjeejrddufeegrddvtd efrddukeegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhho mhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 25EA6328005E; Wed, 28 Oct 2020 06:27:17 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@intel.com, david.marchand@redhat.com, bruce.richardson@intel.com, olivier.matz@6wind.com, andrew.rybchenko@oktetlabs.ru, akhil.goyal@nxp.com, Ajit Khaparde , Somnath Kotur Date: Wed, 28 Oct 2020 11:26:33 +0100 Message-Id: <20201028102640.3191964-9-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201028102640.3191964-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201028102640.3191964-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 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 Wed Oct 28 10:26:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82622 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 48587A04DD; Wed, 28 Oct 2020 11:30:05 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 91142CA3B; Wed, 28 Oct 2020 11:27:31 +0100 (CET) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id 652E7CA08 for ; Wed, 28 Oct 2020 11:27:21 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 185DE5C014E; Wed, 28 Oct 2020 06:27:20 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Wed, 28 Oct 2020 06:27:20 -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=Vs6FeTlghTassqWpUcb/OZEbp2YPv sSlDw/KvgkFvURcAnlt78yCRR4K5bSCNJoLBqzVYr5Sz2iV+bFAStoxTP361lJET 2cP++kypU2HcWO6J0eA7itTOvJxDVKGz14cBj5wQoGUhawzbEExEKliK2bvbNV/Z WUWAwyYS2+mWcX/P35GB8BBfR1BNYcnx37tpGPbT6BB24KFpbL5Hw72cmayYzB/g TTbQdrwBICkg/cEW0sooMMrnXKdFIVF2KJNKs+M/8K94R3XDUnLVhNCDhqpuH+JY ZCJ5kTeCeKyqMav3Kd4W9+MDyHAAL86XP8FXDylL6gHIlYeoCDUDDLoqw== 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=EOlxNfzi lE6ofcrzCBZxt6rW8vng3fzLmMKi07gXnPo9ryQCJzc2aVLd1EJ2U9uVYP8PCF8J 7JHV0mokc7ObbH+qHWQJGl+KeXhtpyiW2ud95ioVaSNprINv/6faMBZm382kAhMZ uZl99djngBTcW/Zx0gT91mKl57vrKl8GgtPC+kL39rOIX9lbW/dINgLe/XiaHS6Q 4OFAFlqzjEBV26GZBn3SfAFS7rhAU2wH4kqf3XHZ4vZbkDl3apxVmtryu5jhF9ud uu3mBi8yI8h5DpHhcYmQCsdPD/vd1QixyPnEaQW5iHoXCM+B+MEGec93c76zaboG cjc3FmiYE2Xptw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrledugdduhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgepieenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho nhdrnhgvth X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 1182A3280059; Wed, 28 Oct 2020 06:27:18 -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: Wed, 28 Oct 2020 11:26:34 +0100 Message-Id: <20201028102640.3191964-10-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201028102640.3191964-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201028102640.3191964-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 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 Wed Oct 28 10:26:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82623 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 76C62A04DD; Wed, 28 Oct 2020 11:30:22 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 33591CA49; Wed, 28 Oct 2020 11:27:33 +0100 (CET) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id A430FCA18 for ; Wed, 28 Oct 2020 11:27:23 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 44C1E5C01A1; Wed, 28 Oct 2020 06:27:22 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Wed, 28 Oct 2020 06:27:22 -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=eteHdq5/EMaSkQNUikhrbJrObdj9D BdGR84QnjDhiFR+RzCr1TUNyz8aIINnnAu4CHKcwJyKmmqWOKW25/a5d05/DdsA8 B+O9SZodNl1qzCkB9U7j5dLG1POf96she8waqLwyezuTz74d/H4l9RbdYIERAyB/ faWA2GuJx8XNYgd/4oVmf9f7A8zqB64yX59r9cfbXGS972fHAz9GglXdMUP5GpXh wBbN3hgGL7LpH9ho+tTfjjtgvwlqoVyG77M1fZsTQSk4PNiXwMDW5kM9uhruasKf nc804yrV8ZuCQ0INSFWcZeY6fBFmGMnOQJfSdBNmpCOTmc8b909W59cUQ== 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=jrrBayoJ VRYuL1JKej1Zux4/h0J/Bhq/MD15aYABS4BUA0OCywvl1t18/WO5iNciOD8MvxUX RKMChlyPsZMDvmqzh41DMehUFwEUO2Wfa/TL7LvCvb04X1MdXqWYUp+uuVWs786z 6XGMyzB3SjO1dLFaSmKROqP+jRn514Ve2R7cqmTybIxC9s13gp9+JOmSc+nGQVk4 KUTHw0XBk26p5SeQizFbmWOJQwUjeLXyrU9NOa+cUBeMnR14QBoPTnMsLBlZDSvf mkcjli7EOYm2JEeUx+AE6TwBceHNg8w+TwBVENolNtHWcDyqVkcxuQrxtelI/hdi IfY45Enz615aCg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrledugdduhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgepieenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho nhdrnhgvth X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id E07D73280064; Wed, 28 Oct 2020 06:27:20 -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: Wed, 28 Oct 2020 11:26:35 +0100 Message-Id: <20201028102640.3191964-11-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201028102640.3191964-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201028102640.3191964-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 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 Wed Oct 28 10:26:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82624 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 1AE51A04DD; Wed, 28 Oct 2020 11:30:39 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E1A52CA4E; Wed, 28 Oct 2020 11:27:34 +0100 (CET) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id 5312CC9EE for ; Wed, 28 Oct 2020 11:27:25 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 059ED5C0189; Wed, 28 Oct 2020 06:27:24 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Wed, 28 Oct 2020 06:27:24 -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=edix0yg6I/UIT5vElekZ4RK4rVxxF wI0leWSP4t4qbPewXcu4ywmI4WWNR7PLuBMqsdrZJjjCdVD4RZNeBDRZbKzzbTpW ZQQKaZV/EGAgwZx0tKP16fhxcXQAeBO9U4MOwIUq8wIOCzsMCXcr1J205WTTfKpE 6egZmd/MP71j6ktpCIXMPVXM8edPrMy634wMlEfNoChbC1hlbCxJbxd1K5pStnYY LJ9tIqBfVU7BMBlOtz1DICXDlFs4hemgLlMrlZF+Ff/lfwPXHvJtMMzNpaOzfCKp a2xSuIL2dLJuMTO/Txi0FKlFZEbhm39owIQSpDYEzsUnk6lOgoo0AXTRQ== 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=OWLMV8lA kHCdxXzsCjkruVbSaSqY7+2VnzGysjZdgbzZdwUBKqJdisZAIfGwWYy/lAxZNe6Y w6TbAB3+wMg7dYOHG8jaQW2ejIHn0tDBPOFQxG+2AeDMoR3EqejXqja6Q9U/RKEo Es6jDOmY6OAbfEVKTTMtqUmxDfylpK5gT2VP/j+kK9WwblD6JnoFCZuSr9eJrTMQ Lg6HKGIF1Z6YB8fH8tXilzCPnkvGSMCdZi3BsO8HfPkvPsB3HA5Uoc/52ALfhCGz c7yr91qADyFcGvnw2T8BLRhIXK8+US9q4Df6cXSBFLNtvm+TuQTIRiPDEQ0SOJgU hkDKSTwtoUIBDA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrledugdduhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgepieenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho nhdrnhgvth X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id C03FA3280059; Wed, 28 Oct 2020 06:27:22 -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: Wed, 28 Oct 2020 11:26:36 +0100 Message-Id: <20201028102640.3191964-12-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201028102640.3191964-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201028102640.3191964-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 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 Wed Oct 28 10:26:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82625 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 905ABA04DD; Wed, 28 Oct 2020 11:30:57 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 644F4CA5D; Wed, 28 Oct 2020 11:27:36 +0100 (CET) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id 11617C9EE for ; Wed, 28 Oct 2020 11:27:27 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id B8E6E5C01A3; Wed, 28 Oct 2020 06:27:25 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Wed, 28 Oct 2020 06:27:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=HhLwf0w4DGO4G rUYkzhR7OWJ7zfGCnjW/SYxuiDy6eY=; b=vAVC4ZVjhtZTCkU0QOSv77P4GAjAb xy3S5dCXcp7BY5vp3DJ2QK3o4UWqDw+fuMoOTM2/4X+JGC89yuCRFKhjqcnELQDV G8sprwMOY8SnU6E7231e9wwQcASOYY79JsMEf1WTBCSLHU3D5+prTBJklQ2cjo3x 5UYM1s3s0yJR+xhcJHlDhGEApm/QiYs/5jy2qfWv4H8YxuCNDSvI6sppBhCdIQQ8 VsQO1CeAk+cnDrbpwF+qXPnFBL6fgp9YF7E1DgLIBe0fa65vZMpRGt40FxNlLnlY W5NIyRTsokRUViCvRdptMIxrfEsJXQPTRNJ8nUJqUCC/tMcr6PSjAPDgA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=HhLwf0w4DGO4GrUYkzhR7OWJ7zfGCnjW/SYxuiDy6eY=; b=H/DubX13 JO89iugMHwq7Zhb8SpLHKHnlU2Zjv+1wpTuhWR+UVO0k5gwjSN73E47xlRQ6IcKT pscoHXfMST1gTFg+gtlEdBFgjoe/vH/QOwfF5lLNZsrF3IS73h3pQ7my701tEHtY yc2xr69QOumrS+w0EswjcE3t9IRZIpCkn+NFW7S1hetk2Hloq0fBIaPfTboj5jjU 6Zy8Tr6O00fDmfCiEF3Xw+xIvjcRA6p8u8DWWs1hGmt2MH/ixaWtf9a22h4Lx5qc blbGGFEmTBddwWfl52TTwJOHqdVVL60uvV8vBe5lrVkT+E1FH92zV7Vtjz9LTTxo oL0JURj+wdV0CA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrledugdduhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgepleenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho nhdrnhgvth X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id B842D3280060; Wed, 28 Oct 2020 06:27:24 -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: Wed, 28 Oct 2020 11:26:37 +0100 Message-Id: <20201028102640.3191964-13-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201028102640.3191964-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201028102640.3191964-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 12/15] app/eventdev: switch flow ID to dynamic mbuf field X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The order test stored the flow ID in the deprecated mbuf field udata64. It is moved to a dynamic field in order to allow removal of udata64. Signed-off-by: Thomas Monjalon --- app/test-eventdev/test_order_atq.c | 4 ++-- app/test-eventdev/test_order_common.c | 21 +++++++++++++++------ app/test-eventdev/test_order_common.h | 21 +++++++++++++++++++++ app/test-eventdev/test_order_queue.c | 4 ++-- 4 files changed, 40 insertions(+), 10 deletions(-) diff --git a/app/test-eventdev/test_order_atq.c b/app/test-eventdev/test_order_atq.c index cfcb1dc4e9..71215a07b6 100644 --- a/app/test-eventdev/test_order_atq.c +++ b/app/test-eventdev/test_order_atq.c @@ -35,7 +35,7 @@ order_atq_worker(void *arg, const bool flow_id_cap) } if (!flow_id_cap) - ev.flow_id = ev.mbuf->udata64; + order_flow_id_copy_from_mbuf(t, &ev); if (ev.sub_event_type == 0) { /* stage 0 from producer */ order_atq_process_stage_0(&ev); @@ -72,7 +72,7 @@ order_atq_worker_burst(void *arg, const bool flow_id_cap) for (i = 0; i < nb_rx; i++) { if (!flow_id_cap) - ev[i].flow_id = ev[i].mbuf->udata64; + order_flow_id_copy_from_mbuf(t, &ev[i]); if (ev[i].sub_event_type == 0) { /*stage 0 */ order_atq_process_stage_0(&ev[i]); diff --git a/app/test-eventdev/test_order_common.c b/app/test-eventdev/test_order_common.c index dc55d93921..01a44bcd75 100644 --- a/app/test-eventdev/test_order_common.c +++ b/app/test-eventdev/test_order_common.c @@ -46,13 +46,10 @@ order_producer(void *arg) if (m == NULL) continue; - const uint32_t flow = (uintptr_t)m % nb_flows; + const flow_id_t flow = (uintptr_t)m % nb_flows; /* Maintain seq number per flow */ m->seqn = producer_flow_seq[flow]++; - m->udata64 = flow; - - ev.flow_id = flow; - ev.mbuf = m; + order_flow_id_save(t, flow, m, &ev); while (rte_event_enqueue_burst(dev_id, port, &ev, 1) != 1) { if (t->err) @@ -138,6 +135,12 @@ int order_test_setup(struct evt_test *test, struct evt_options *opt) { void *test_order; + struct test_order *t; + static const struct rte_mbuf_dynfield flow_id_dynfield_desc = { + .name = "test_event_dynfield_flow_id", + .size = sizeof(flow_id_t), + .align = __alignof__(flow_id_t), + }; test_order = rte_zmalloc_socket(test->name, sizeof(struct test_order), RTE_CACHE_LINE_SIZE, opt->socket_id); @@ -146,8 +149,14 @@ order_test_setup(struct evt_test *test, struct evt_options *opt) goto nomem; } test->test_priv = test_order; + t = evt_test_priv(test); - struct test_order *t = evt_test_priv(test); + t->flow_id_dynfield_offset = + rte_mbuf_dynfield_register(&flow_id_dynfield_desc); + if (t->flow_id_dynfield_offset < 0) { + evt_err("failed to register mbuf field"); + return -rte_errno; + } t->producer_flow_seq = rte_zmalloc_socket("test_producer_flow_seq", sizeof(*t->producer_flow_seq) * opt->nb_flows, diff --git a/app/test-eventdev/test_order_common.h b/app/test-eventdev/test_order_common.h index e0fe9c968a..90eac96fc8 100644 --- a/app/test-eventdev/test_order_common.h +++ b/app/test-eventdev/test_order_common.h @@ -13,6 +13,7 @@ #include #include #include +#include #include "evt_common.h" #include "evt_options.h" @@ -20,6 +21,8 @@ #define BURST_SIZE 16 +typedef uint32_t flow_id_t; + struct test_order; struct worker_data { @@ -49,6 +52,7 @@ struct test_order { uint32_t nb_flows; uint64_t nb_pkts; struct rte_mempool *pool; + int flow_id_dynfield_offset; struct prod_data prod; struct worker_data worker[EVT_MAX_PORTS]; uint32_t *producer_flow_seq; @@ -56,6 +60,23 @@ struct test_order { struct evt_options *opt; } __rte_cache_aligned; +static inline void +order_flow_id_copy_from_mbuf(struct test_order *t, struct rte_event *event) +{ + event->flow_id = *RTE_MBUF_DYNFIELD(event->mbuf, + t->flow_id_dynfield_offset, flow_id_t *); +} + +static inline void +order_flow_id_save(struct test_order *t, flow_id_t flow_id, + struct rte_mbuf *mbuf, struct rte_event *event) +{ + *RTE_MBUF_DYNFIELD(mbuf, + t->flow_id_dynfield_offset, flow_id_t *) = flow_id; + event->flow_id = flow_id; + event->mbuf = mbuf; +} + static inline int order_nb_event_ports(struct evt_options *opt) { diff --git a/app/test-eventdev/test_order_queue.c b/app/test-eventdev/test_order_queue.c index 1511c0092d..621367805a 100644 --- a/app/test-eventdev/test_order_queue.c +++ b/app/test-eventdev/test_order_queue.c @@ -35,7 +35,7 @@ order_queue_worker(void *arg, const bool flow_id_cap) } if (!flow_id_cap) - ev.flow_id = ev.mbuf->udata64; + order_flow_id_copy_from_mbuf(t, &ev); if (ev.queue_id == 0) { /* from ordered queue */ order_queue_process_stage_0(&ev); @@ -73,7 +73,7 @@ order_queue_worker_burst(void *arg, const bool flow_id_cap) for (i = 0; i < nb_rx; i++) { if (!flow_id_cap) - ev[i].flow_id = ev[i].mbuf->udata64; + order_flow_id_copy_from_mbuf(t, &ev[i]); if (ev[i].queue_id == 0) { /* from ordered queue */ order_queue_process_stage_0(&ev[i]); From patchwork Wed Oct 28 10:26:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82626 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 EA927A04DD; Wed, 28 Oct 2020 11:31:19 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7F3BCCA87; Wed, 28 Oct 2020 11:27:44 +0100 (CET) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id 154EFCA37 for ; Wed, 28 Oct 2020 11:27:29 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id B91005C01A1; Wed, 28 Oct 2020 06:27:27 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Wed, 28 Oct 2020 06:27:27 -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=pQ2qcIVb6b0KG+f5xYENUi3NPhaF/ eUzDKLLqcbpkGno9c8VnOyCvuXZoDOYrdARSZZqHXQ8bZII+08MfzGceq3PiCXfv hy6haMlAeEyHCGW2Dix3McfA2KmAWvH1hVUO0l+NmqrCdrvIkT3bjsz8rqKghGCh RmeCurlEo7P0tpVX3XI3tcuuL2La9ylzVdtSXUg5mHa7UL+G00JBLw46ryRn+2Q5 hahIwsa3kxm7DF4GY5NhA0lg8q6yQy4ezcCp+TtAN5itfjooh3AF2BGBWOkWl02X hOXO0cj1aQnikzFIA9yTpO0wOIgzqfn27Z51g4gMcF6LpZgnAMMNWV83g== 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=ZrNtfIe6 F+PDDcdAxrW8T1qZ/FItjQ5oVPEa/iBD1EI7nqYfAKUTvvhTFhvqauyWMmrnKkuE 6EU00+Ms7SxnqYfylz0MX4HjVArjOi98ioViemjCljJcHQKTnQNqawfeyhiFDf7H h5ymPLNNjlv0j+M7ODqE0NXgUP+kQlqEHG4cfYAmSBqtg0xCodK4O9QQW78CIjwV kQ7VIfSa260HwLUC65Ngodu3+BmYlhdvR0cktazSmv2VK0nKBALgfbeoHGKQvFNP cJNWP4JMpprafMGrCaq6E+5LNQl3A+e2T3C2WPV9pFfoON1m1eFTmllpNtw64odp 608zDFEbqvlY0Q== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrledugdduhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgepleenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho nhdrnhgvth X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id A38FD3280064; Wed, 28 Oct 2020 06:27: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 Date: Wed, 28 Oct 2020 11:26:38 +0100 Message-Id: <20201028102640.3191964-14-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201028102640.3191964-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201028102640.3191964-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 13/15] examples/bbdev: switch to dynamic mbuf field X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The example used the deprecated mbuf field udata64 as input mbuf pointer. It is moved to a dynamic field in order to allow removal of udata64. Signed-off-by: Thomas Monjalon Reviewed-by: Andrew Rybchenko --- examples/bbdev_app/main.c | 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 Wed Oct 28 10:26:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82627 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 D6782A04DD; Wed, 28 Oct 2020 11:31:38 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 30CA8CA90; Wed, 28 Oct 2020 11:27:46 +0100 (CET) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id EB025CA37 for ; Wed, 28 Oct 2020 11:27:29 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id A25FC5C01A3; Wed, 28 Oct 2020 06:27:29 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Wed, 28 Oct 2020 06:27:29 -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=dn3oNt53fRvWVC2c3G+Bmb6eYRQmm JY89+hgmWcj0K2GgPLmLlaQiOsjlqvf3P+EORxUrY9+dKzH4fuJZqTK/DpuBXvNw pdRfOEgUlFo7KMaUuG5ibH1nTUSVBWGnJJ3/m9WPWTjd1LRJghUYuTSPRV1P66vs 4jsuCuJAfccJqadsEaDeXklvY6/avpMXnhw7S0c7Y5k4kLh9JyiMP4k6UNh/FZha u9LWyekngkjGl7q7Cw9LyChyQfO/8qGF0rdUDBRtxz+C5EtLkZ0eNtTMAljyGgaW bm0gSYX7Mmj5VR/aKsDZUo0AiGUOdq4S+BiuitdrglMNmIjC2h07PupIA== 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=DeMwK5Mt nMZezv1aObd1a4aMvw8IKmq/gSt2mkccjHSnBvVkwcOqX+cQ64hlbDZi5C9/+rGI roy3yezNGOxSGSbyH+Z5Cw70wDPxKVlX81qQG5OiLjVyGzrymLy4VJqt070u+lol V7IFD6vQwYeveLD83NjVjbCKYKTeAsy3tU8XE934PuXpo/SExs4nRBS+aZxt0EvZ hsOxzdUo0jJ7pd8+7+ALoVfL2q3GgXVjdSjI7B4j+vE9Gy8lEMCdfJ3NdQ8Z3fBp cx8yNIf4+5agm8TJfjliBjWzZ5wkIZ8cShgAhbOay6UYpSY8I20OHExOE+olspLz MPC5qXGvyI/IaQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrledugdduhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgepleenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho nhdrnhgvth X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 8DC473280060; Wed, 28 Oct 2020 06:27:28 -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: Wed, 28 Oct 2020 11:26:39 +0100 Message-Id: <20201028102640.3191964-15-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201028102640.3191964-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201028102640.3191964-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 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 Wed Oct 28 10:26:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82628 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 B49C4A04DD; Wed, 28 Oct 2020 11:31:57 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9DE12CA9D; Wed, 28 Oct 2020 11:27:47 +0100 (CET) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id E087BC9A4 for ; Wed, 28 Oct 2020 11:27:31 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 941F35C0189; Wed, 28 Oct 2020 06:27:31 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Wed, 28 Oct 2020 06:27:31 -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=pAq62eiR3EHxXiDsx9DYuWxSerL5O YJKZOqXFURGr1oqEjJ88QdrzO0M0IKIDiUJ+7cTzudkoRaO7C3Nj/fZwIXPKihb8 igJlPIrf0qAcLv3HKr7whNhKl8MZYH9jV75N+akRf8jItn/apRHPBv5se6XTJknk VJrvXAFi0M4TITtesa9RCcT8RSmlg04yYSkAODD6G1EGkIdf+Jc9NSIWz48XcU0C njPqIQFNw9t4/5QSYeXFvnpptBbGjF5i4+ljfz86LR1ba+QG+fjVxsQwu7UCM13g 8X7YfJM9IaIAuHwSTZarqloCxPEXnjJaLw8OpZxdoRHYisSgzmIqGzi0A== 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=II48f0Q0 b5JUFFO1pqLpLCsBJe+qkA76hBd0csqrkuxcYx0VbX921JTPNImf7J2kKruMv5KC wm+ucJwSWzBcfnUPV2igeMgof50JDeHFlurzQc2NZcm3segPdF7lvusxYz3jmn0D 3oJxIgjn2O0LlVtvKWCOTgBnmQMJUrPyccomuJS35A+9oYxh+QopF9edV2086rxW A7Dfi1/BfoaibqgPGvH9+BsLBxSyLHpi1q+UZNIkE9756E7mjxUUD2Iz+djvbOxo NWTEl1fCgNwHXcoU76Yde2qhFmJbBOhZUhvgnuWkx6vXtPOp3b/FLHub6MgbbOx3 YtAHjxMLm4PIgw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrledugdduhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgepuddvnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl ohhnrdhnvght X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 800333280060; Wed, 28 Oct 2020 06:27:30 -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: Wed, 28 Oct 2020 11:26:40 +0100 Message-Id: <20201028102640.3191964-16-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201028102640.3191964-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201028102640.3191964-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 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; /**