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 4CB35A0521; Tue, 3 Nov 2020 11:23:11 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 203C7C906; Tue, 3 Nov 2020 11:23:10 +0100 (CET) Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by dpdk.org (Postfix) with ESMTP id 1B70EC86A for ; Tue, 3 Nov 2020 11:23:07 +0100 (CET) Received: by mail-wm1-f65.google.com with SMTP id c9so10623910wml.5 for ; Tue, 03 Nov 2020 02:23:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=M5C9PrtPsy5KGXyn7iW7tDLcMVMEbnAzwqKx+TtGk8s=; b=aHzVIeibhAsyTGIteaB9jGNCnEj0XQkY148jZsuMhtt7reSbHRMVKmYWuNya8W/P0A gTy9wAuGeIZ+fb8upK3pl8sWXYc686T3GjTDe54OTgK8ZcU3sOrjZLwhEuEIeRmJKJdv 8OIJzW7/eAgReEUxB977tU7dd3MXiw9VsV8Xz1RybIo4pUOjE5puUKYHcwPQ/JCvv96I eroDrQZHXnYz2pqs2yQQpO0AYrMET39h6aLRWRcuHbJfUnciaoS6Zuq0C61FmxCy98J/ 6x9SPaZ1le/4DCSweRYsIeT1oDAPLRLVgMVUrVw6yMv/HJbJk4hnr7mT4FQikUmADXJ1 ma9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=M5C9PrtPsy5KGXyn7iW7tDLcMVMEbnAzwqKx+TtGk8s=; b=X4nlJ8X2A4bPleWXIPlitJEqaO06deKIn8YxaE4zXHfc82Y2/bE+yy0vjuChaDnIav xuGK4kf0Zd4kMQeZ2t5td6tQgRyea8z3X26OtYfWn/oOwJ+gDukeanMFJhvsMRqVxD5K VJqjKtXnNVLp7HGE29uynxztt7VLZNCtVFosk/ll2s0++kZ/Oj5ATBDIjTINdn7FoK8y Z8JmmlM3WcdJOUUT98EEiG/kNqvFCKSZRBLZ7Kr21wDaCnkB+0sgT5Qp9pvI/pImU5eI 7bzsKCvvPkZwrM8znUChYTItr6IDDS+7CDTibrEjpP4nAiLXH8UB2QeAO/Y9bWFbG3VQ V4qg== X-Gm-Message-State: AOAM533yDJykskMgMaO9TVhh6C7yes1BxuECN30+7+yb+1nw0mqklI9j zdtEAf37AJ5nbo5Dhp4++sK8Gg== X-Google-Smtp-Source: ABdhPJy9uOD+zbPkU4KT94sc09PfmW5/CfzULFmnDZgJiAOr15/7azpH4Xy4dWl7kCA1cbN+UXYCBw== X-Received: by 2002:a1c:103:: with SMTP id 3mr2703454wmb.81.1604398985839; Tue, 03 Nov 2020 02:23:05 -0800 (PST) Received: from 6wind.com (2a01cb0c0005a600345636f7e65ed1a0.ipv6.abo.wanadoo.fr. [2a01:cb0c:5:a600:3456:36f7:e65e:d1a0]) by smtp.gmail.com with ESMTPSA id l3sm2762525wmg.32.2020.11.03.02.23.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Nov 2020 02:23:05 -0800 (PST) Date: Tue, 3 Nov 2020 11:23:04 +0100 From: Olivier Matz To: Thomas Monjalon Cc: dev@dpdk.org, ferruh.yigit@intel.com, david.marchand@redhat.com, bruce.richardson@intel.com, andrew.rybchenko@oktetlabs.ru, jerinj@marvell.com, viacheslavo@nvidia.com, Wenzhuo Lu , Beilei Xing , Bernard Iremonger Message-ID: <20201103102304.GD1898@platinum> References: <20201029092751.3837177-1-thomas@monjalon.net> <20201103001407.2931963-1-thomas@monjalon.net> <20201103001407.2931963-12-thomas@monjalon.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201103001407.2931963-12-thomas@monjalon.net> User-Agent: Mutt/1.10.1 (2018-07-13) Subject: Re: [dpdk-dev] [PATCH v3 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" On Tue, Nov 03, 2020 at 01:14:02AM +0100, Thomas Monjalon wrote: > 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; unneeded blank line > + > + 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); > -- > 2.28.0 >