From patchwork Fri Oct 30 17:29:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82969 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 9C5E5A04E6; Fri, 30 Oct 2020 18:33:59 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6808E72ED; Fri, 30 Oct 2020 18:30:24 +0100 (CET) Received: from new2-smtp.messagingengine.com (new2-smtp.messagingengine.com [66.111.4.224]) by dpdk.org (Postfix) with ESMTP id 0C1485AB9 for ; Fri, 30 Oct 2020 18:30:12 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailnew.nyi.internal (Postfix) with ESMTP id B3529580659; Fri, 30 Oct 2020 13:30:11 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 30 Oct 2020 13:30:11 -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=Ov0I/SIS+DHYz 5Y9S4XZq7X4a/eTgLt/knF0/zSbz0E=; b=RujN1W6PoLDzhkgACZnnfoZeZxedY b+y5MJci7Tb+IULS/l8Wf1hujx18da+nZrlkHDqM7UWVqyb5ws6EBoB34RR1SlB2 FMG6+fVMJK4Vxs+FaOg4SEp7HOsJNAoQNETrxu3+CxyYloVcMtAA0Qd8UoYwzWpS ye4xxenXxUj0Kgow3gq/eajqUFr4oz0ZmunL0JSDfpsGKv6EqgFBganTmPKsheDI BexJPlymik8zdf0BSdw+QgvXEBa9OsZ9aI2a2sRetP2LH9EbrEhmj6IM0/keRyGF 6B6YjlNN0OvR1jAYuMpYVy+SnHj6NBXEQ7ccqQ54LVnsplTf8EXSrDMNw== 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=Ov0I/SIS+DHYz5Y9S4XZq7X4a/eTgLt/knF0/zSbz0E=; b=VM6j84pb Cc1UDDaACxeUeXfh7ZCjKo1QjeXk3+3BznLC5+MCNqnBc4aQyVCOlRJbun5JjI30 ngTIfzeXmnC20fAK/jVYkaLo9W7XzlOWIBvbz5h5J62nSu+L3V3u4WsahFuv8mVk qXsaUuNJLqZBgo/OBrGDg8cr5OkpNqiokgF4JrO1f7xMnJW0zzc9PqD/yd6551AG pV94l+Cx4KOnvv02oNQnKYt46yX2cjGYg3aBGFr8gVRUIFND6jPbhSHBq8Sy3I37 CgLL3neyvNKtEGpBI5w4JXAYt1Bu/TRwpX7+eu5oXjJTPC7v97sWJ7lwBMMfkkKc K9sK50RGxNNymg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrleehgdeliecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpeehgfejgefgueevgfevvdekgefffedtkeehgeffjeeigeefueffudff hfelffffudenucffohhmrghinhepfhguihhrrdhiugenucfkphepjeejrddufeegrddvtd efrddukeegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhho mhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth 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 645A03064674; Fri, 30 Oct 2020 13:30:10 -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, Wenzhuo Lu , Beilei Xing , Bernard Iremonger Date: Fri, 30 Oct 2020 18:29:37 +0100 Message-Id: <20201030172940.1073558-13-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 12/15] app/testpmd: 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 --- app/test-pmd/util.c | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/util.c b/app/test-pmd/util.c index 781a813759..eebb5166ad 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,40 @@ 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 +142,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);