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 7B7C9A0521; Tue, 3 Nov 2020 13:26:00 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 97DA6CA4A; Tue, 3 Nov 2020 13:22:41 +0100 (CET) Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by dpdk.org (Postfix) with ESMTP id 0C305CA30 for ; Tue, 3 Nov 2020 13:22:39 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id A1DB1BDC; Tue, 3 Nov 2020 07:22:36 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Tue, 03 Nov 2020 07:22:37 -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=DfNJ6hTYQIexp AN1d1fLr/nsATV9IbWx+3OWrAaNIP8=; b=wmW+iaq1DleWZKivmMwn50peZYiWD OaDirWYEGaUmLf0kLcqIhL9JRaLg7eP2c8QFTibAWCiblmr//M4d+gHev7BxswM+ pL7LNrn1iQf5mQpvBpGxSlHxmMTuCurWv4t4IPaCLYK7UaF+r9AHEosEK4lkTtni MaVv20++ZCREE0YtyS4IjehxrZ66m6pT5rdlUxpo28On3DLRMm8FTtUQGuZNqwr0 mBN/ZroqUbkSHVXhdIMyRBKfeKFRJTD2Pj+g5GIyjTRyiDJ6vilRHh3W0ID2Nxce 5adAIdwpnepgj3ESQrbMRowoqqG8l1VNgyJmpb6PcDMSbp4mVX4nrYttw== 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=DfNJ6hTYQIexpAN1d1fLr/nsATV9IbWx+3OWrAaNIP8=; b=hEr1euVU w98rx5y38N/iiqj9KoS4ny/DlElv12DTVLDMIDBFXp0isfeHNO/Us6vxYVaJpoBL GRixClgnBfgKPbJG9jsnmJSD6DnbX9LKx+wbqVXp5CQ3UgcfduzvW8C0cLW0XPUQ 1X0IjRenSpgHdXvUW/LWi6Li26sP+b3/1gcUlqJmzQrGeGALuOGR4yoUgqsJ4xiC GYWNdL7UfmfnXhy6TQyBFlJNfs0R3+AgrCM/0eEUolPUe2pDNba9uVkwC6zepl4t UU5qoDhUeOsyns0dn5o6KlD+VrqA4FAUhiN4gI8eTBugLqoeuusaXNJFbDRN/UaY hTBKGRlRQOGyDg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedruddtfedgfeelucetufdoteggodetrfdotf 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 1179F3064684; Tue, 3 Nov 2020 07:22:34 -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 13:21:58 +0100 Message-Id: <20201103122205.183472-10-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201103122205.183472-1-thomas@monjalon.net> References: <20201029092751.3837177-1-thomas@monjalon.net> <20201103122205.183472-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v4 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 Acked-by: David Marchand --- 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