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 273FBA04E7; Tue, 3 Nov 2020 01:17:29 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id F26F7BBA4; Tue, 3 Nov 2020 01:14:45 +0100 (CET) Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) by dpdk.org (Postfix) with ESMTP id 81A30ACAA for ; Tue, 3 Nov 2020 01:14:44 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id 2B080B17; Mon, 2 Nov 2020 19:14:42 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 02 Nov 2020 19:14:42 -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=rePCm52R8+Kz0 IrhjasMcaZcJ+s9vjFL1RYQwKD4dqo=; b=Yh33Eoi41bquPBrfN6ACAbyAPYVOp U1i1rV+YutFdnwJ6itwNPYckUvwwsOw1oN2iU/dijFeC7JsUrcKcTQDZYk2jGFPO YwpKKAlcavxTHEVcfe2kywRrZrEIJquTwKuiGbRx5GG7AWrJZkMidsQLnLx3OOL1 BzaPm0jbWs4lZmgStUJN8ot8iWSeeBOZhj9qrctAVRBfq7481fyhrg+3U5uQcjIC +oZFD/v2+H65FN74YL+fqqZNx4Alw7M/UkOCn0kwlzsKBeAiZ9+qhu6FmC1e1f+0 U87p4nu+QwUFvusbvcBRFotF2UmMolyDlZonWnx+rpIX3NaukNGpgJIRQ== 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=rePCm52R8+Kz0IrhjasMcaZcJ+s9vjFL1RYQwKD4dqo=; b=MiOoYYBf 6ItIQjyZq9cTAhWUzJLJZ172VDBjz2kOFSrRl/9IbdxryspJNFTzyWiofvFIT7lz hnPfU/GCFuETSCHxsL1wCZP6pDojtBkWyYOnxGAldrqwd2/ODw6Qgyx1nMKa/frO XUtGMlR1VvKKyn3GHF2CCqrdLs8dKabYKUKYcRyBZqF9cQsIvjmMITi1WZ/NTMdb Ps5iH77L3AmaRAxysXCytWpATsWWuOkrxXxwIkqRVaL8Ua4FgxpGerSanOX79+92 FWYG/da/7nEwKSWluy/GfE8o38yA4yF8hqG4/aDYFCZF73Oir0B2YkOF8CBNudpX MK21BeOyXv04AA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedruddtvddgudejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepvdehgfeivdejgedtveehfefhteelfefgieevgfffveefjeegtdfg uedthedtgeevnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf hiiigvpeejnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl ohhnrdhnvght X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id A29223064683; Mon, 2 Nov 2020 19:14:40 -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, Nithin Dabilpuram , Kiran Kumar K Date: Tue, 3 Nov 2020 01:14:00 +0100 Message-Id: <20201103001407.2931963-10-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201103001407.2931963-1-thomas@monjalon.net> References: <20201029092751.3837177-1-thomas@monjalon.net> <20201103001407.2931963-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3 09/16] net/octeontx2: switch Rx 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 mbuf flag is also replaced. The dynamic offset and flag are stored in struct otx2_timesync_info to favor cache locality. Signed-off-by: Thomas Monjalon --- drivers/net/octeontx2/otx2_ethdev.c | 10 ++++++++++ drivers/net/octeontx2/otx2_rx.h | 19 ++++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/drivers/net/octeontx2/otx2_ethdev.c b/drivers/net/octeontx2/otx2_ethdev.c index cfb733a4b5..f6962be9b2 100644 --- a/drivers/net/octeontx2/otx2_ethdev.c +++ b/drivers/net/octeontx2/otx2_ethdev.c @@ -2219,6 +2219,16 @@ otx2_nix_dev_start(struct rte_eth_dev *eth_dev) else otx2_nix_timesync_disable(eth_dev); + if (dev->rx_offload_flags & NIX_RX_OFFLOAD_TSTAMP_F) { + rc = rte_mbuf_dyn_rx_timestamp_register( + &dev->tstamp.tstamp_dynfield_offset, + &dev->tstamp.rx_tstamp_dynflag); + if (rc != 0) { + otx2_err("Failed to register Rx timestamp field/flag"); + return -rte_errno; + } + } + /* Update VF about data off shifted by 8 bytes if PTP already * enabled in PF owning this VF */ diff --git a/drivers/net/octeontx2/otx2_rx.h b/drivers/net/octeontx2/otx2_rx.h index 61a5c436dd..926f614a4e 100644 --- a/drivers/net/octeontx2/otx2_rx.h +++ b/drivers/net/octeontx2/otx2_rx.h @@ -49,6 +49,8 @@ struct otx2_timesync_info { uint64_t rx_tstamp; rte_iova_t tx_tstamp_iova; uint64_t *tx_tstamp; + uint64_t rx_tstamp_dynflag; + int tstamp_dynfield_offset; uint8_t tx_ready; uint8_t rx_ready; } __rte_cache_aligned; @@ -63,6 +65,14 @@ union mbuf_initializer { uint64_t value; }; +static inline rte_mbuf_timestamp_t * +otx2_timestamp_dynfield(struct rte_mbuf *mbuf, + struct otx2_timesync_info *info) +{ + return RTE_MBUF_DYNFIELD(mbuf, + info->tstamp_dynfield_offset, rte_mbuf_timestamp_t *); +} + static __rte_always_inline void otx2_nix_mbuf_to_tstamp(struct rte_mbuf *mbuf, struct otx2_timesync_info *tstamp, const uint16_t flag, @@ -77,15 +87,18 @@ otx2_nix_mbuf_to_tstamp(struct rte_mbuf *mbuf, /* Reading the rx timestamp inserted by CGX, viz at * starting of the packet data. */ - mbuf->timestamp = rte_be_to_cpu_64(*tstamp_ptr); + *otx2_timestamp_dynfield(mbuf, tstamp) = + rte_be_to_cpu_64(*tstamp_ptr); /* PKT_RX_IEEE1588_TMST flag needs to be set only in case * PTP packets are received. */ if (mbuf->packet_type == RTE_PTYPE_L2_ETHER_TIMESYNC) { - tstamp->rx_tstamp = mbuf->timestamp; + tstamp->rx_tstamp = + *otx2_timestamp_dynfield(mbuf, tstamp); tstamp->rx_ready = 1; mbuf->ol_flags |= PKT_RX_IEEE1588_PTP | - PKT_RX_IEEE1588_TMST | PKT_RX_TIMESTAMP; + PKT_RX_IEEE1588_TMST | + tstamp->rx_tstamp_dynflag; } } } -- 2.28.0