From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0BAEBA04B5; Tue, 27 Oct 2020 22:03:59 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id ECA8B4C73; Tue, 27 Oct 2020 22:02:03 +0100 (CET) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by dpdk.org (Postfix) with ESMTP id 91AB34C90 for ; Tue, 27 Oct 2020 22:02:02 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 4330A5C00C1; Tue, 27 Oct 2020 17:02:01 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 27 Oct 2020 17:02:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=ohDsyWWzMYPJ9 FR1tnbyC+cf4fz5hzLNw6ufGn39duU=; b=iJgEu+5NMhcjkcHethD45LyzdzoJg gL2D743hDQPMX17qE1c+OI8StwQ6o3gB4AB1AoXqwflMzyGuq0tJGgQpbkF8SgEi S0UI9yGqQFuZyQUDjfQVYRQ59Kt6LjdeQ40S+3NJJYmpHSELceU8rak3mwFJ1NeA Ian6ypgNwkKrr9M9peEwxdKeUY5soQXKq6l9UdY1wPxQehOOoKAhBr1Y++FrAe9/ 1ZtiuvRV04iQDZSIxprUnAlLeO34BzWzCc1kXogoIcwD4KeaAZoMQt4JQ6hoyGO8 EV/zuKaDNLzotOa5ypr1uSQu39cPH9Cc5XTDTwXkjqcxf9gGyt3pI08nQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=ohDsyWWzMYPJ9FR1tnbyC+cf4fz5hzLNw6ufGn39duU=; b=Wxf/NKxm Q8AUiUdAt710glHlNTnGyE3Ym3rb7pFr1ACZUcTH8myrVDtMyCIinG3bE3BRYKXJ bDfUo275OG48nQcr1wKvkENjaQVS1LmTUz1F0zBNr3v826fmRh7QaEw05XYgdhd3 zy/VThYzm+I6SfmN7apm5Rae9815It/Q2b0M/O8T9TWHeElGMgUXa2Sb2suE7Swo Db3HEDSLivQr5QrfCMOad08O4X9NplBotJWsUUi6DPNg2whHX8K/Z2GVQeUzHEGS LB9JgRZzkNoITrqdeBxU5D+GDX3701U+lc2hQmfaOe7n9kcOujU7qJWC1WIxVThI B1hwCnq/HInAZA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrkeelgddugeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepheejhfdvffeuheeiveduvdefieeghfdtvddvtdehhefgkeefhfdt hfetffegteeunecuffhomhgrihhnpegtohhnfhdrihhnnecukfhppeejjedrudefgedrvd dtfedrudekgeenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhr ohhmpehthhhomhgrshesmhhonhhjrghlohhnrdhnvght X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 004973280059; Tue, 27 Oct 2020 17:01:59 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@intel.com, david.marchand@redhat.com, bruce.richardson@intel.com, olivier.matz@6wind.com, andrew.rybchenko@oktetlabs.ru, akhil.goyal@nxp.com, Shepard Siegel , Ed Czeck , John Miller Date: Tue, 27 Oct 2020 22:01:07 +0100 Message-Id: <20201027210115.2529025-8-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201027210115.2529025-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201027210115.2529025-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3 07/15] net/ark: switch user data to dynamic mbuf field X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The second field of metadata is reserved for user data which was using a deprecated mbuf field. It is moved to a dynamic field in order to allow removal of udata64. Signed-off-by: Thomas Monjalon --- doc/api/doxy-api-index.md | 1 + doc/api/doxy-api.conf.in | 1 + drivers/net/ark/ark_ethdev.c | 18 +++++++++++ drivers/net/ark/ark_ethdev_rx.c | 3 +- drivers/net/ark/ark_ethdev_tx.c | 3 +- drivers/net/ark/rte_pmd_ark.h | 56 +++++++++++++++++++++++++++++++++ 6 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 drivers/net/ark/rte_pmd_ark.h diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md index a9c12d1a2f..b865a51e8c 100644 --- a/doc/api/doxy-api-index.md +++ b/doc/api/doxy-api-index.md @@ -41,6 +41,7 @@ The public API headers are grouped by topics: [vhost] (@ref rte_vhost.h), [vdpa] (@ref rte_vdpa.h), [KNI] (@ref rte_kni.h), + [ark] (@ref rte_pmd_ark.h), [ixgbe] (@ref rte_pmd_ixgbe.h), [i40e] (@ref rte_pmd_i40e.h), [ice] (@ref rte_pmd_ice.h), diff --git a/doc/api/doxy-api.conf.in b/doc/api/doxy-api.conf.in index e37f8c2e80..c5b01a1814 100644 --- a/doc/api/doxy-api.conf.in +++ b/doc/api/doxy-api.conf.in @@ -8,6 +8,7 @@ INPUT = @TOPDIR@/doc/api/doxy-api-index.md \ @TOPDIR@/drivers/bus/vdev \ @TOPDIR@/drivers/crypto/scheduler \ @TOPDIR@/drivers/mempool/dpaa2 \ + @TOPDIR@/drivers/net/ark \ @TOPDIR@/drivers/net/bnxt \ @TOPDIR@/drivers/net/bonding \ @TOPDIR@/drivers/net/dpaa \ diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c index 168b3659d6..5f19d8d1ea 100644 --- a/drivers/net/ark/ark_ethdev.c +++ b/drivers/net/ark/ark_ethdev.c @@ -10,6 +10,7 @@ #include #include +#include "rte_pmd_ark.h" #include "ark_global.h" #include "ark_logs.h" #include "ark_ethdev_tx.h" @@ -78,6 +79,8 @@ static int eth_ark_set_mtu(struct rte_eth_dev *dev, uint16_t size); #define ARK_TX_MAX_QUEUE (4096 * 4) #define ARK_TX_MIN_QUEUE (256) +int rte_pmd_ark_userdata_dynfield_offset = -1; + static const char * const valid_arguments[] = { ARK_PKTGEN_ARG, ARK_PKTCHKR_ARG, @@ -245,6 +248,11 @@ eth_ark_dev_init(struct rte_eth_dev *dev) int ret; int port_count = 1; int p; + static const struct rte_mbuf_dynfield ark_userdata_dynfield_desc = { + .name = RTE_PMD_ARK_USERDATA_DYNFIELD_NAME, + .size = sizeof(rte_pmd_ark_userdata_t), + .align = __alignof__(rte_pmd_ark_userdata_t), + }; ark->eth_dev = dev; @@ -254,6 +262,16 @@ eth_ark_dev_init(struct rte_eth_dev *dev) ret = check_for_ext(ark); if (ret) return ret; + + /* Extra mbuf field for user data */ + rte_pmd_ark_userdata_dynfield_offset = + rte_mbuf_dynfield_register(&ark_userdata_dynfield_desc); + if (rte_pmd_ark_userdata_dynfield_offset < 0) { + ARK_PMD_LOG(ERR, + "Failed to register mbuf field for userdata\n"); + return -rte_errno; + } + pci_dev = RTE_ETH_DEV_TO_PCI(dev); rte_eth_copy_pci_info(dev, pci_dev); dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS; diff --git a/drivers/net/ark/ark_ethdev_rx.c b/drivers/net/ark/ark_ethdev_rx.c index 2f8d05099c..c5788498b3 100644 --- a/drivers/net/ark/ark_ethdev_rx.c +++ b/drivers/net/ark/ark_ethdev_rx.c @@ -4,6 +4,7 @@ #include +#include "rte_pmd_ark.h" #include "ark_ethdev_rx.h" #include "ark_global.h" #include "ark_logs.h" @@ -272,7 +273,7 @@ eth_ark_recv_pkts(void *rx_queue, mbuf->pkt_len = meta->pkt_len; mbuf->data_len = meta->pkt_len; mbuf->timestamp = meta->timestamp; - mbuf->udata64 = meta->user_data; + rte_pmd_ark_mbuf_userdata_set(mbuf, meta->user_data); if (ARK_DEBUG_CORE) { /* debug sanity checks */ if ((meta->pkt_len > (1024 * 16)) || diff --git a/drivers/net/ark/ark_ethdev_tx.c b/drivers/net/ark/ark_ethdev_tx.c index a0e35af880..ab488d83f2 100644 --- a/drivers/net/ark/ark_ethdev_tx.c +++ b/drivers/net/ark/ark_ethdev_tx.c @@ -4,6 +4,7 @@ #include +#include "rte_pmd_ark.h" #include "ark_ethdev_tx.h" #include "ark_global.h" #include "ark_mpu.h" @@ -70,7 +71,7 @@ eth_ark_tx_meta_from_mbuf(struct ark_tx_meta *meta, uint8_t flags) { meta->physaddr = rte_mbuf_data_iova(mbuf); - meta->user1 = (uint32_t)mbuf->udata64; + meta->user1 = (uint32_t)rte_pmd_ark_mbuf_userdata_get(mbuf); meta->data_len = rte_pktmbuf_data_len(mbuf); meta->flags = flags; } diff --git a/drivers/net/ark/rte_pmd_ark.h b/drivers/net/ark/rte_pmd_ark.h new file mode 100644 index 0000000000..11e96e0e9c --- /dev/null +++ b/drivers/net/ark/rte_pmd_ark.h @@ -0,0 +1,56 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright (c) 2020 Atomic Rules LLC + */ + +#ifndef RTE_PMD_ARK_H +#define RTE_PMD_ARK_H + +/** + * @file + * ARK driver-specific API + */ + +#include +#include + +typedef uint64_t rte_pmd_ark_userdata_t; +extern int rte_pmd_ark_userdata_dynfield_offset; + +/** mbuf dynamic field for custom ARK data */ +#define RTE_PMD_ARK_USERDATA_DYNFIELD_NAME "rte_net_ark_dynfield_userdata" + +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice + * + * Read user data from mbuf. + * + * @param mbuf Structure to read from. + * @return user data + */ +__rte_experimental +static inline rte_pmd_ark_userdata_t +rte_pmd_ark_mbuf_userdata_get(const struct rte_mbuf *mbuf) +{ + return *RTE_MBUF_DYNFIELD(mbuf, rte_pmd_ark_userdata_dynfield_offset, + rte_pmd_ark_userdata_t *); +} + +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice + * + * Write user data to mbuf. + * + * @param mbuf Structure to write into. + */ +__rte_experimental +static inline void +rte_pmd_ark_mbuf_userdata_set(struct rte_mbuf *mbuf, + rte_pmd_ark_userdata_t data) +{ + *RTE_MBUF_DYNFIELD(mbuf, rte_pmd_ark_userdata_dynfield_offset, + rte_pmd_ark_userdata_t *) = data; +} + +#endif /* RTE_PMD_ARK_H */ -- 2.28.0