From patchwork Fri Oct 30 17:29:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82963 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id F0667A04E6; Fri, 30 Oct 2020 18:31:56 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 80E275AAE; Fri, 30 Oct 2020 18:30:11 +0100 (CET) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id 8BA695916 for ; Fri, 30 Oct 2020 18:29:59 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 325025C0224; Fri, 30 Oct 2020 13:29:58 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 30 Oct 2020 13:29:58 -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=VopuAHQpDKGDL rnULTcPk7NtBvcwX/S1QrLaKk0hbDk=; b=ahPOLCVE3iSp+e/Y+Vz0mKAp39Yv8 pLjb29F2iHOMMZOyh6k3ut3n7KZmudDc6bR7joAXjMmjOiTBxjeLLwVAieA5Sn+/ EhRxT4rmgPycYQIY82VqbPL0HaGsIxspPb1g47fIJ3Pb8UE8qOn/0KxlZypUGcG1 gUKsNYrVLsFgzxzcDb+mdnxleiyymg1lXafvKiHoZPyQdhBk2ENm3uAJlSxIaiFo ZSnSlEMnolCKgCEseQfq5UeTQK3ZHBVUaVu4hd2Z9ccC1dz1rCSUoCfA71UwlSDX tr+QVS/3UgpkaPUv12oQdnHnb0Ht/zB0EPYFlr6LpZJAc1NHauMLOZzFg== 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=VopuAHQpDKGDLrnULTcPk7NtBvcwX/S1QrLaKk0hbDk=; b=iVgPC1f+ 3dwNPN9leNezPNWYUKmyvPjQGHYQ3NPkG2BuEO0gjImzjWGauG4CoUbT0KHyFS// nP0ivx6ZeDRAKocWXGscXLAYwjohRyfWer0HRhKXLiP+MH0KDsEBlCx5ym2dMhc/ v1koQooZs0E242qGVypEhInOfedjVt/YyOTgR3qbU3BgZnyMY+GQ8F7O3VseWnZX AvhMDNMyowZuxJlX1ETAjJndTRS4Q+uhSLfWWze7houYLp2D9PYSu5wrfXnhIjMY pdG8I5Ke5yKNATN6xf8mbie/j2fbzxWpepOUvX0CA2KwS0upyEYzuCcTk0aFkNzt DVvHrI2P15I6cw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrleehgdeliecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgepgeenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho 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 D394B3064684; Fri, 30 Oct 2020 13:29:56 -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, Hemant Agrawal , Sachin Saxena Date: Fri, 30 Oct 2020 18:29:31 +0100 Message-Id: <20201030172940.1073558-7-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 Subject: [dpdk-dev] [PATCH v5 06/15] net/dpaa2: 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/dpaa2/dpaa2_ethdev.c | 20 ++++++++++++++++++++ drivers/net/dpaa2/dpaa2_ethdev.h | 2 ++ drivers/net/dpaa2/dpaa2_rxtx.c | 25 ++++++++++++++++++------- 3 files changed, 40 insertions(+), 7 deletions(-) diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index 04e60c56f2..ff368174bd 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -65,6 +66,8 @@ static uint64_t dev_tx_offloads_nodis = /* enable timestamp in mbuf */ bool dpaa2_enable_ts[RTE_MAX_ETHPORTS]; +uint64_t dpaa2_timestamp_rx_dynflag; +int dpaa2_timestamp_dynfield_offset = -1; struct rte_dpaa2_xstats_name_off { char name[RTE_ETH_XSTATS_NAME_SIZE]; @@ -505,6 +508,7 @@ dpaa2_eth_dev_configure(struct rte_eth_dev *dev) struct rte_eth_conf *eth_conf = &dev->data->dev_conf; uint64_t rx_offloads = eth_conf->rxmode.offloads; uint64_t tx_offloads = eth_conf->txmode.offloads; + int timestamp_rx_dynflag_offset; int rx_l3_csum_offload = false; int rx_l4_csum_offload = false; int tx_l3_csum_offload = false; @@ -587,7 +591,23 @@ dpaa2_eth_dev_configure(struct rte_eth_dev *dev) #if !defined(RTE_LIBRTE_IEEE1588) if (rx_offloads & DEV_RX_OFFLOAD_TIMESTAMP) #endif + { + dpaa2_timestamp_dynfield_offset = rte_mbuf_dynfield_lookup( + RTE_MBUF_DYNFIELD_TIMESTAMP_NAME, NULL); + if (dpaa2_timestamp_dynfield_offset < 0) { + DPAA2_PMD_ERR("Error 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) { + DPAA2_PMD_ERR("Error to lookup Rx timestamp flag"); + return -rte_errno; + } + dpaa2_timestamp_rx_dynflag = + RTE_BIT64(timestamp_rx_dynflag_offset); dpaa2_enable_ts[dev->data->port_id] = true; + } if (tx_offloads & DEV_TX_OFFLOAD_IPV4_CKSUM) tx_l3_csum_offload = true; diff --git a/drivers/net/dpaa2/dpaa2_ethdev.h b/drivers/net/dpaa2/dpaa2_ethdev.h index 94cf253827..8d82f74684 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.h +++ b/drivers/net/dpaa2/dpaa2_ethdev.h @@ -92,6 +92,8 @@ /* enable timestamp in mbuf*/ extern bool dpaa2_enable_ts[]; +extern uint64_t dpaa2_timestamp_rx_dynflag; +extern int dpaa2_timestamp_dynfield_offset; #define DPAA2_QOS_TABLE_RECONFIGURE 1 #define DPAA2_FS_TABLE_RECONFIGURE 2 diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c index 4dd1d5f578..cef70bfabe 100644 --- a/drivers/net/dpaa2/dpaa2_rxtx.c +++ b/drivers/net/dpaa2/dpaa2_rxtx.c @@ -31,6 +31,13 @@ dpaa2_dev_rx_parse_slow(struct rte_mbuf *mbuf, static void enable_tx_tstamp(struct qbman_fd *fd) __rte_unused; +static inline rte_mbuf_timestamp_t * +dpaa2_timestamp_dynfield(struct rte_mbuf *mbuf) +{ + return RTE_MBUF_DYNFIELD(mbuf, + dpaa2_timestamp_dynfield_offset, rte_mbuf_timestamp_t *); +} + #define DPAA2_MBUF_TO_CONTIG_FD(_mbuf, _fd, _bpid) do { \ DPAA2_SET_FD_ADDR(_fd, DPAA2_MBUF_VADDR_TO_IOVA(_mbuf)); \ DPAA2_SET_FD_LEN(_fd, _mbuf->data_len); \ @@ -109,9 +116,10 @@ dpaa2_dev_rx_parse_new(struct rte_mbuf *m, const struct qbman_fd *fd, m->ol_flags |= PKT_RX_RSS_HASH; if (dpaa2_enable_ts[m->port]) { - m->timestamp = annotation->word2; - m->ol_flags |= PKT_RX_TIMESTAMP; - DPAA2_PMD_DP_DEBUG("pkt timestamp:0x%" PRIx64 "", m->timestamp); + *dpaa2_timestamp_dynfield(m) = annotation->word2; + m->ol_flags |= dpaa2_timestamp_rx_dynflag; + DPAA2_PMD_DP_DEBUG("pkt timestamp:0x%" PRIx64 "", + *dpaa2_timestamp_dynfield(m)); } DPAA2_PMD_DP_DEBUG("HW frc = 0x%x\t packet type =0x%x " @@ -223,9 +231,12 @@ dpaa2_dev_rx_parse(struct rte_mbuf *mbuf, void *hw_annot_addr) else if (BIT_ISSET_AT_POS(annotation->word8, DPAA2_ETH_FAS_L4CE)) mbuf->ol_flags |= PKT_RX_L4_CKSUM_BAD; - mbuf->ol_flags |= PKT_RX_TIMESTAMP; - mbuf->timestamp = annotation->word2; - DPAA2_PMD_DP_DEBUG("pkt timestamp: 0x%" PRIx64 "", mbuf->timestamp); + if (dpaa2_enable_ts[mbuf->port]) { + *dpaa2_timestamp_dynfield(mbuf) = annotation->word2; + mbuf->ol_flags |= dpaa2_timestamp_rx_dynflag; + DPAA2_PMD_DP_DEBUG("pkt timestamp: 0x%" PRIx64 "", + *dpaa2_timestamp_dynfield(mbuf)); + } /* Check detailed parsing requirement */ if (annotation->word3 & 0x7FFFFC3FFFF) @@ -629,7 +640,7 @@ dpaa2_dev_prefetch_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) else bufs[num_rx] = eth_fd_to_mbuf(fd, eth_data->port_id); #if defined(RTE_LIBRTE_IEEE1588) - priv->rx_timestamp = bufs[num_rx]->timestamp; + priv->rx_timestamp = *dpaa2_timestamp_dynfield(bufs[num_rx]); #endif if (eth_data->dev_conf.rxmode.offloads &