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 67497A04E6; Fri, 30 Oct 2020 18:33:26 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 313246CAC; Fri, 30 Oct 2020 18:30:21 +0100 (CET) Received: from new2-smtp.messagingengine.com (new2-smtp.messagingengine.com [66.111.4.224]) by dpdk.org (Postfix) with ESMTP id 74C125953 for ; Fri, 30 Oct 2020 18:30:08 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailnew.nyi.internal (Postfix) with ESMTP id 2B19E580650; Fri, 30 Oct 2020 13:30:08 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 30 Oct 2020 13:30:08 -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=R+fWXq0CLTLv7TRdqHc7x6rMf7G6e 56p/lMm+GyYzSKIqrQK1duRfIrnNoid6APY6f4MQiyFcmDhpIrgS70X3GODtMtHW c9RFe9nKm3jPXneLuPW0s6e4V4Te6DRXALH7q0QvPGYV/xJuzuB+HJsz2J09Jtk0 TCqIhxKg4l5s+bIbAWeveok/7jYfHjDze1D14x5c1W6U19K0IJ8FdtHIdIbrVLO8 QW5oaKg8nAO6h9QPBNTW4gHL+RZsGDMbxRjxHd9ljGcZhuJqWTsM/KeiJAgyxwmp AfL0AZ8Ro4JWOLPqAd0GL5igy8pWppwZZX9A/xgBqp+wMZr1sgSnVTZXQ== 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=pPdDZgKi tLWqzQenr68vysEvw/rWlIyRPN4N2+PtHH60+OpErIRQtxMkO6KiXeaAUfmtdKKy ZLeKFGFXIdHwdiOCEIVLExfafLR3xe+Y+ncPFXU1S27gopISEelBZMjLeGL4xO+7 AWG7bLzFZ9IEnFuOtH3mQiNvDBnskRhgZ5yDamE6FcqD5/lKZdQTlKaORq7f2TLF zDaNM1RdVHC/RZzT/d9Lnu+0buXNCpU5OHrcxPUhbsjZWKshwu3bw5h8G08WhTgr MbNcAOK0QBoRdtXOTWHN0WNWlaB35+xvDjXGDRS1Q5Jhp41T76LbYUzqvGsu8yKh g+hlLtgVLlybAg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrleehgdeliecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgepuddtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl 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 70BCF3064610; Fri, 30 Oct 2020 13:30:06 -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, akhil.goyal@nxp.com, jerinj@marvell.com, Nithin Dabilpuram , Kiran Kumar K , Ray Kinsella , Neil Horman Date: Fri, 30 Oct 2020 18:29:35 +0100 Message-Id: <20201030172940.1073558-11-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201030172940.1073558-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201030172940.1073558-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v5 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