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 B7819A0521; Tue, 3 Nov 2020 15:13:15 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8913ACB96; Tue, 3 Nov 2020 15:10:05 +0100 (CET) Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by dpdk.org (Postfix) with ESMTP id D7150CB63 for ; Tue, 3 Nov 2020 15:10:01 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id 7085F8E1; Tue, 3 Nov 2020 09:10:00 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 03 Nov 2020 09:10:01 -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=qxthh7yKE5dT/ WgzMl4VjgNwUYpwMNsALmCVM9v2b0c=; b=Ux9bet9s5bPJ1KFnKLy3BQWS9orFN U3/L+ROLr9Ws4QYp8rLA7IH+Umc4pTpO2aYboasBpKIGM5DkFbzp7gza/camL8GH SHRVj6uL4sjrvIt6CbGGBMQadNuQR/nHKRrk3jzpupc/fzzVRBk83Z4fivbejtxX bVnnsQUPy2afKrZ8Ir4yVeW16PTs7JOphogs5PsHoNlVzscqqtWg/ZZZByacTImM GEHv7kF1X2SUqag86GiiyZvt6nG82Kx8NSFjRokAdu9KLhCUCMgVJv78gpB2RWQX eofWPeNRj6KpDfthz+dY6sAuy8t20+6o+tMiqPESRMA3IOcT7r3giW1JQ== 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=qxthh7yKE5dT/WgzMl4VjgNwUYpwMNsALmCVM9v2b0c=; b=Z4cmmgD3 oCM4clqp/hITsu9jXv+NbiaiNH4jKkHyV+S59ymd7I5XTNn3qNkCj8Zr2cmlpXO1 N99ydhIvwgtw9H/kx77Spummvc21ly5hwbwkNeKYsGtsD7QRoo3UTr4vFCFm9TPD 5tQAELsaKQcm8ysKT6UuU5EXMMIAUNUs6Jsec4fthtaKNUUn9WynDNI2uAwad/9m DbW+9+fsVKM0k+bqq7ekzuFqGNrPGSf7FzuRe9xOxGpf1Q6+i9cbXibavKV6b4gL J+MFJfa8+jJoDMnfn722JMEHrsNVpQgg7GMt7fdUFNVrya5SwTiUs0vSiXFOzo7y mYb7Aw0ovLWAUg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedruddtfedgheekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepvdehgfeivdejgedtveehfefhteelfefgieevgfffveefjeegtdfg uedthedtgeevnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf hiiigvpeeknecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl 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 D5098328005E; Tue, 3 Nov 2020 09:09:58 -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 15:09:24 +0100 Message-Id: <20201103140931.488700-10-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201103140931.488700-1-thomas@monjalon.net> References: <20201029092751.3837177-1-thomas@monjalon.net> <20201103140931.488700-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v5 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 registration of field and flag is done in both otx2_nix_dev_start() and otx2_nix_timesync_enable(). 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_ptp.c | 8 ++++++++ drivers/net/octeontx2/otx2_rx.h | 19 ++++++++++++++++--- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/drivers/net/octeontx2/otx2_ethdev.c b/drivers/net/octeontx2/otx2_ethdev.c index cfb733a4b5..6cebbe677d 100644 --- a/drivers/net/octeontx2/otx2_ethdev.c +++ b/drivers/net/octeontx2/otx2_ethdev.c @@ -2225,6 +2225,16 @@ otx2_nix_dev_start(struct rte_eth_dev *eth_dev) if (otx2_ethdev_is_ptp_en(dev) && otx2_dev_is_vf(dev)) otx2_nix_ptp_enable_vf(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; + } + } + rc = npc_rx_enable(dev); if (rc) { otx2_err("Failed to enable NPC rx %d", rc); diff --git a/drivers/net/octeontx2/otx2_ptp.c b/drivers/net/octeontx2/otx2_ptp.c index ae5a2b7cd1..b8ef4c181d 100644 --- a/drivers/net/octeontx2/otx2_ptp.c +++ b/drivers/net/octeontx2/otx2_ptp.c @@ -239,6 +239,14 @@ otx2_nix_timesync_enable(struct rte_eth_dev *eth_dev) dev->tstamp.tx_tstamp_iova = ts->iova; dev->tstamp.tx_tstamp = ts->addr; + 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; + } + /* System time should be already on by default */ nix_start_timecounters(eth_dev); 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