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 B6DD8A04DD; Thu, 29 Oct 2020 10:31:35 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 70C57C90E; Thu, 29 Oct 2020 10:28:33 +0100 (CET) Received: from wnew3-smtp.messagingengine.com (wnew3-smtp.messagingengine.com [64.147.123.17]) by dpdk.org (Postfix) with ESMTP id 66C9FC92C for ; Thu, 29 Oct 2020 10:28:25 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailnew.west.internal (Postfix) with ESMTP id E33909FE; Thu, 29 Oct 2020 05:28:23 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Thu, 29 Oct 2020 05:28:24 -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=DOn1l1u2vwZ2n GbtpoeDWnpnD0GrfJWR9l+cCrsJ/Ds=; b=ZHOdn1WoRETRNHm9qJj1jq6zxNJxy zUHMnv1kLI46nXcpmO6HIUGUfJpod1z2nabMAQoOOK6ADJYP18pzkk84oY+m4G7w kajnUT8FeP2vOZVBEyuizD4LZj3YltTRs33O8FYdnKDEiLYGPSbebFEeL9V9IA9Y fPUR6JA0fCesL3hK8MU2KWVYhmcAR/4SW7h4U6Fxjt9EZOOYItTBCXWb6rNyAW5t 1zr5u83ar4YA2sdSSFqfFipe3I5jjmq+fJkG73Sq70tMcdiRbUeS7FVid8/KpVco rdNV2+PB/94onPqoYQRbk2y82gaNlqJEszcdTGCA3czVLf2COO6orOaKQ== 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=DOn1l1u2vwZ2nGbtpoeDWnpnD0GrfJWR9l+cCrsJ/Ds=; b=jv7VC7ui MjzPJfyOpdUGfm55R97fnWwoQ6/wewLgCwG4+hRFpGnBF1346zlWdz99Wcf1Owe3 Ha5VgCvRAl6OauYyaWyAuLtuHd6r9JS4izYO+Y2qMfIwveS1NT7cxhC8s7M2SEDm 0GxQGd2F5YstosVS9CqkFyv8CQhYRk2KOJBZTG5gzgiUEvJrfAzixyh9xRn4mvPq 8Pj0im1/jEMksudFpa+/z7wVOUw6pk5ckpuVP+wqW7eXhjAGl2ArU+SSS18WDxBb YdIjOmcqbhbomkdunHEuvU7Agq56qcXWFpafGZYGa3A/L2UQi9U15Kfk2mz6kkuI ePxnSrHdMRl+CA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrleefgddthecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgepkeenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho nhdrnhgvth 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 A0471328005D; Thu, 29 Oct 2020 05:28:21 -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, jerinj@marvell.com, viacheslavo@nvidia.com, Nithin Dabilpuram , Kiran Kumar K , Ray Kinsella , Neil Horman Date: Thu, 29 Oct 2020 10:27:45 +0100 Message-Id: <20201029092751.3837177-11-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201029092751.3837177-1-thomas@monjalon.net> References: <20201029092751.3837177-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 10/15] net/octeontx2: 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 mbuf flag is also replaced. Signed-off-by: Thomas Monjalon --- drivers/net/octeontx2/otx2_ethdev.c | 33 +++++++++++++++++++++++++++++ drivers/net/octeontx2/otx2_rx.h | 19 ++++++++++++++--- drivers/net/octeontx2/version.map | 7 ++++++ 3 files changed, 56 insertions(+), 3 deletions(-) diff --git a/drivers/net/octeontx2/otx2_ethdev.c b/drivers/net/octeontx2/otx2_ethdev.c index cfb733a4b5..ad95219438 100644 --- a/drivers/net/octeontx2/otx2_ethdev.c +++ b/drivers/net/octeontx2/otx2_ethdev.c @@ -4,6 +4,7 @@ #include +#include #include #include #include @@ -14,6 +15,35 @@ #include "otx2_ethdev.h" #include "otx2_ethdev_sec.h" +uint64_t rte_pmd_octeontx2_timestamp_rx_dynflag; +int rte_pmd_octeontx2_timestamp_dynfield_offset = -1; + +static int +otx2_rx_timestamp_setup(uint16_t flags) +{ + int timestamp_rx_dynflag_offset; + + if ((flags & NIX_RX_OFFLOAD_TSTAMP_F) == 0) + return 0; + + rte_pmd_octeontx2_timestamp_dynfield_offset = rte_mbuf_dynfield_lookup( + RTE_MBUF_DYNFIELD_TIMESTAMP_NAME, NULL); + if (rte_pmd_octeontx2_timestamp_dynfield_offset < 0) { + otx2_err("Failed to lookup timestamp field"); + return -rte_errno; + } + timestamp_rx_dynflag_offset = rte_mbuf_dynflag_lookup( + RTE_MBUF_DYNFLAG_RX_TIMESTAMP_NAME, NULL); + if (timestamp_rx_dynflag_offset < 0) { + otx2_err("Failed to lookup Rx timestamp flag"); + return -rte_errno; + } + rte_pmd_octeontx2_timestamp_rx_dynflag = + RTE_BIT64(timestamp_rx_dynflag_offset); + + return 0; +} + static inline uint64_t nix_get_rx_offload_capa(struct otx2_eth_dev *dev) { @@ -1874,6 +1904,9 @@ otx2_nix_configure(struct rte_eth_dev *eth_dev) dev->tx_offload_flags |= nix_tx_offload_flags(eth_dev); dev->rss_info.rss_grps = NIX_RSS_GRPS; + if (otx2_rx_timestamp_setup(dev->rx_offload_flags) != 0) + goto fail_offloads; + nb_rxq = RTE_MAX(data->nb_rx_queues, 1); nb_txq = RTE_MAX(data->nb_tx_queues, 1); diff --git a/drivers/net/octeontx2/otx2_rx.h b/drivers/net/octeontx2/otx2_rx.h index 61a5c436dd..6981edce82 100644 --- a/drivers/net/octeontx2/otx2_rx.h +++ b/drivers/net/octeontx2/otx2_rx.h @@ -63,6 +63,18 @@ union mbuf_initializer { uint64_t value; }; +/* variables are exported because this file is included in other drivers */ +extern uint64_t rte_pmd_octeontx2_timestamp_rx_dynflag; +extern int rte_pmd_octeontx2_timestamp_dynfield_offset; + +static inline rte_mbuf_timestamp_t * +otx2_timestamp_dynfield(struct rte_mbuf *mbuf) +{ + return RTE_MBUF_DYNFIELD(mbuf, + rte_pmd_octeontx2_timestamp_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 +89,16 @@ 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) = 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->rx_ready = 1; mbuf->ol_flags |= PKT_RX_IEEE1588_PTP | - PKT_RX_IEEE1588_TMST | PKT_RX_TIMESTAMP; + PKT_RX_IEEE1588_TMST | + rte_pmd_octeontx2_timestamp_rx_dynflag; } } } diff --git a/drivers/net/octeontx2/version.map b/drivers/net/octeontx2/version.map index 4a76d1d52d..d4f4784bcd 100644 --- a/drivers/net/octeontx2/version.map +++ b/drivers/net/octeontx2/version.map @@ -1,3 +1,10 @@ DPDK_21 { local: *; }; + +INTERNAL { + global: + + rte_pmd_octeontx2_timestamp_dynfield_offset; + rte_pmd_octeontx2_timestamp_rx_dynflag; +}; -- 2.28.0