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 A3D88A0521; Tue, 3 Nov 2020 13:26:47 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EEBF4CA1A; Tue, 3 Nov 2020 13:22:45 +0100 (CET) Received: from wnew3-smtp.messagingengine.com (wnew3-smtp.messagingengine.com [64.147.123.17]) by dpdk.org (Postfix) with ESMTP id 09B97C9D6 for ; Tue, 3 Nov 2020 13:22:43 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailnew.west.internal (Postfix) with ESMTP id 95322BDC; Tue, 3 Nov 2020 07:22:40 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Tue, 03 Nov 2020 07:22:41 -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=1MVqx3g3AEn1c JJ3l65IOOB3xXJLgjolC48wT4VmaAI=; b=jI5HoiG60l25TN76MfFSJGtIs/aB5 QgyMfPrxiwNOEhRyVJ/cWza27UMo7xC4/ZDb0LE8FdvzIT7rGHzR/M+SmFTRAxmG qDbXdTJy8dLL22fA162CYm/XU8jtZB98uF3qXS7wS4JgeBgLpFkgfOIkwhU7EFVY s/vzqgsOvho5GQ10FvSwmbMDm8sb2usWj9JOjpSekAliGuf0adVA2occJEbmUyZT WYKDARsr+BqMDHllQ4mr2pDVG0zVTTb+j2CEgZwrCMxsRze9g14GzvDPtTHzStl/ 2d4z3jrb58utRecL6tbk/CccAcdZExjCsUM728rHZx17XXshhGGr6tQWg== 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=1MVqx3g3AEn1cJJ3l65IOOB3xXJLgjolC48wT4VmaAI=; b=JUktdlx1 +VLyLW2fymVdM9//zFaIOkQUgn/bWu0korCVJxapWjVaB3O2YdJMidbkEymiiVXe 5tvNoa15k4gJMHEUPgDkc60+Tkv5DmFjyGIJpKatDZwNB1uWRKeQwQBmwhI5OGi3 mV17BuIpU2jjLVMRl9ORRVZWI/Dl8kiM6BtCd9hpy8G8/5S1olmYkFX9pRIObMDC qXVMpqqpdWXopLNt8ev0YavA5V8tVUCYcAxi8HrPTgnb+1aKV030eWdVCDtijEW+ hcWW33LjlniehhOmTDNtWfS2JFHQuA4UDHa3Bq1jq6vPoiBNsNWtXWTEHJHUUfQl BebGOLh973K91w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedruddtfedgfeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhephefgjeeggfeuvefgvedvkeegffeftdekheegffejieegfeeuffdu fffhleffffdunecuffhomhgrihhnpehfughirhdrihgunecukfhppeejjedrudefgedrvd dtfedrudekgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhr ohhmpehthhhomhgrshesmhhonhhjrghlohhnrdhnvght 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 D7810306467E; Tue, 3 Nov 2020 07:22:38 -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, Wenzhuo Lu , Beilei Xing , Bernard Iremonger Date: Tue, 3 Nov 2020 13:22:00 +0100 Message-Id: <20201103122205.183472-12-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 11/16] app/testpmd: 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. Signed-off-by: Thomas Monjalon Acked-by: David Marchand --- app/test-pmd/util.c | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/util.c b/app/test-pmd/util.c index 781a813759..649bf8f53a 100644 --- a/app/test-pmd/util.c +++ b/app/test-pmd/util.c @@ -5,6 +5,7 @@ #include +#include #include #include #include @@ -22,6 +23,39 @@ print_ether_addr(const char *what, const struct rte_ether_addr *eth_addr) printf("%s%s", what, buf); } +static inline bool +is_timestamp_enabled(const struct rte_mbuf *mbuf) +{ + static uint64_t timestamp_rx_dynflag; + int timestamp_rx_dynflag_offset; + + if (timestamp_rx_dynflag == 0) { + timestamp_rx_dynflag_offset = rte_mbuf_dynflag_lookup( + RTE_MBUF_DYNFLAG_RX_TIMESTAMP_NAME, NULL); + if (timestamp_rx_dynflag_offset < 0) + return false; + timestamp_rx_dynflag = RTE_BIT64(timestamp_rx_dynflag_offset); + } + + return (mbuf->ol_flags & timestamp_rx_dynflag) != 0; +} + +static inline rte_mbuf_timestamp_t +get_timestamp(const struct rte_mbuf *mbuf) +{ + static int timestamp_dynfield_offset = -1; + + if (timestamp_dynfield_offset < 0) { + timestamp_dynfield_offset = rte_mbuf_dynfield_lookup( + RTE_MBUF_DYNFIELD_TIMESTAMP_NAME, NULL); + if (timestamp_dynfield_offset < 0) + return 0; + } + + return *RTE_MBUF_DYNFIELD(mbuf, + timestamp_dynfield_offset, rte_mbuf_timestamp_t *); +} + static inline void dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], uint16_t nb_pkts, int is_rx) @@ -107,8 +141,8 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], printf("hash=0x%x ID=0x%x ", mb->hash.fdir.hash, mb->hash.fdir.id); } - if (ol_flags & PKT_RX_TIMESTAMP) - printf(" - timestamp %"PRIu64" ", mb->timestamp); + if (is_timestamp_enabled(mb)) + printf(" - timestamp %"PRIu64" ", get_timestamp(mb)); if (ol_flags & PKT_RX_QINQ) printf(" - QinQ VLAN tci=0x%x, VLAN tci outer=0x%x", mb->vlan_tci, mb->vlan_tci_outer); -- 2.28.0