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 B38D3A04E7; Sun, 1 Nov 2020 19:08:18 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 59F0E4C89; Sun, 1 Nov 2020 19:06:58 +0100 (CET) Received: from new2-smtp.messagingengine.com (new2-smtp.messagingengine.com [66.111.4.224]) by dpdk.org (Postfix) with ESMTP id D90EF493D for ; Sun, 1 Nov 2020 19:06:55 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailnew.nyi.internal (Postfix) with ESMTP id 87ADF58010A; Sun, 1 Nov 2020 13:06:55 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Sun, 01 Nov 2020 13:06:55 -0500 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=mVca7G8TnSCRg IiK9bL97Mo48HPGrUZ2iIImFhPSfoU=; b=ncktr/fAVOLVH70c28MS58N6gpIr1 J8eRL7PEgAuw2+DID4xYcMCluliL9YHnYvr6DorOnW7dxbQFyOGzU6H5rSsBpR15 EfNuMN0Iy/f1Lpc0b8WADMrUtcR8fx9BgHIc6j+YeDGg2yMLP7ilj6FjDYpk2Bqi BF2bDGIpKgVMCvYhLMtJ8Mu5d9iq1FnMK0rQPzTSguhZerepjxq3NdepAaDI/RiI /5JG8XIlupeGndtgJmckzjX6Xf/kYhaJC0x45I8M67gClYOh5kqp9Ieq3ELPRngo Hkx3sjOuHGXiPWrxuTBDmyCUc4UKyz8ic9+1iShmFKr03cCuHieq+OZzg== 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=mVca7G8TnSCRgIiK9bL97Mo48HPGrUZ2iIImFhPSfoU=; b=G+uVVmk+ Wi/np8HjIg3Nk/vVvYv6nFkwREo1CLeOFh5ZSsimXsHGaPGCXl/rIyrwG2eSj//R OHtzUAiJ+Mtgjdjz8sofi9kNGeC5FZwsQZDR3pEEpSotdoAek7YB0a5erJl5j2zb N/fx2nQUufip+IVZgt/IFfO8yrbHje+4YXz4oRFz+89E3cKzT+WlAcqvRAAkkhsX gVVqreAwv+kECPFru5p2VI53dOIPE1tGQ4wlH5VQiKW0A7GoHoP+HS+4OX2x2rEm GMuxqCvVPrEQl1+ro9guwOYIcyLXrkW/Ibe3hBrKl05fkjKSfVLyLIEJ82GUFEJR kF7ZeACBLkrg2Q== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrleelgdduuddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepvdehgfeivdejgedtveehfefhteelfefgieevgfffveefjeegtdfg uedthedtgeevnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf hiiigvpeegnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl ohhnrdhnvght X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 204C1328005A; Sun, 1 Nov 2020 13:06:54 -0500 (EST) 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, jerinj@marvell.com, viacheslavo@nvidia.com, Shepard Siegel , Ed Czeck , John Miller Date: Sun, 1 Nov 2020 19:06:17 +0100 Message-Id: <20201101180626.2198868-6-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201101180626.2198868-1-thomas@monjalon.net> References: <20201029092751.3837177-1-thomas@monjalon.net> <20201101180626.2198868-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 05/14] net/ark: switch timestamp 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 mbuf timestamp is moved to a dynamic field in order to allow removal of the deprecated static field. The related dynamic mbuf flag is set, although was missing previously. The timestamp is set if configured for at least one device. Signed-off-by: Thomas Monjalon --- drivers/net/ark/ark_ethdev.c | 23 +++++++++++++++++++++++ drivers/net/ark/ark_ethdev_rx.c | 10 +++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c index fa343999a1..629f825019 100644 --- a/drivers/net/ark/ark_ethdev.c +++ b/drivers/net/ark/ark_ethdev.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "rte_pmd_ark.h" #include "ark_global.h" @@ -79,6 +80,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) +uint64_t ark_timestamp_rx_dynflag; +int ark_timestamp_dynfield_offset = -1; int rte_pmd_ark_rx_userdata_dynfield_offset = -1; int rte_pmd_ark_tx_userdata_dynfield_offset = -1; @@ -552,6 +555,24 @@ static int eth_ark_dev_configure(struct rte_eth_dev *dev) { struct ark_adapter *ark = dev->data->dev_private; + int ark_timestamp_rx_dynflag_offset; + + if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_TIMESTAMP) { + ark_timestamp_dynfield_offset = rte_mbuf_dynfield_lookup( + RTE_MBUF_DYNFIELD_TIMESTAMP_NAME, NULL); + if (ark_timestamp_dynfield_offset < 0) { + ARK_PMD_LOG(ERR, "Failed to lookup timestamp field\n"); + return -rte_errno; + } + ark_timestamp_rx_dynflag_offset = rte_mbuf_dynflag_lookup( + RTE_MBUF_DYNFLAG_RX_TIMESTAMP_NAME, NULL); + if (ark_timestamp_rx_dynflag_offset < 0) { + ARK_PMD_LOG(ERR, "Failed to lookup Rx timestamp flag\n"); + return -rte_errno; + } + ark_timestamp_rx_dynflag = + RTE_BIT64(ark_timestamp_rx_dynflag_offset); + } eth_ark_dev_set_link_up(dev); if (ark->user_ext.dev_configure) @@ -782,6 +803,8 @@ eth_ark_dev_info_get(struct rte_eth_dev *dev, ETH_LINK_SPEED_50G | ETH_LINK_SPEED_100G); + dev_info->rx_offload_capa = DEV_RX_OFFLOAD_TIMESTAMP; + return 0; } diff --git a/drivers/net/ark/ark_ethdev_rx.c b/drivers/net/ark/ark_ethdev_rx.c index c24cc00e2f..e45adf959d 100644 --- a/drivers/net/ark/ark_ethdev_rx.c +++ b/drivers/net/ark/ark_ethdev_rx.c @@ -15,6 +15,9 @@ #define ARK_RX_META_OFFSET (RTE_PKTMBUF_HEADROOM - ARK_RX_META_SIZE) #define ARK_RX_MAX_NOCHAIN (RTE_MBUF_DEFAULT_DATAROOM) +extern uint64_t ark_timestamp_rx_dynflag; +extern int ark_timestamp_dynfield_offset; + /* Forward declarations */ struct ark_rx_queue; struct ark_rx_meta; @@ -272,7 +275,12 @@ eth_ark_recv_pkts(void *rx_queue, mbuf->port = meta->port; mbuf->pkt_len = meta->pkt_len; mbuf->data_len = meta->pkt_len; - mbuf->timestamp = meta->timestamp; + /* set timestamp if enabled at least on one device */ + if (ark_timestamp_rx_dynflag > 0) { + *RTE_MBUF_DYNFIELD(mbuf, ark_timestamp_dynfield_offset, + rte_mbuf_timestamp_t *) = meta->timestamp; + mbuf->ol_flags |= ark_timestamp_rx_dynflag; + } rte_pmd_ark_mbuf_rx_userdata_set(mbuf, meta->user_data); if (ARK_DEBUG_CORE) { /* debug sanity checks */ -- 2.28.0