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 BC56FA0521; Tue, 3 Nov 2020 15:14:22 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6B831CBF1; Tue, 3 Nov 2020 15:10:10 +0100 (CET) Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by dpdk.org (Postfix) with ESMTP id 469A9CBDF for ; Tue, 3 Nov 2020 15:10:09 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id DCABDD3C; Tue, 3 Nov 2020 09:10:06 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 03 Nov 2020 09:10:07 -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=GZABAwVG66Jju Kf83gyDQBa9bwdPFhNqz8sc6XLIJBA=; b=oxrG+pkojswkwLltGK3Ru1joHXcbD CzEHLiWYveCZ0SP+tXmdWgEK32PplrbDLfNaIhGTTKCd9d+cD5gpDWz7O1Kv3/Xe tZrNzpEiyBha7XZQNzDWzWARMy7Ff4/T/KGTSzfK3m+Cmh4jR2hdD0CaYiyuuoTV yzApBKPfYWCspzvYpVyR1Q/4ZiDzyDg3oROY62/lDR9MunDZ7SCwUm9BCb/klSGk 2S64EDB1Vd3tj0OdlyXFHXrbyTdvG2Mu6d+nSvGR6ww2HGQv4nhYOF4pG8fIFvvS xDMhz5r1sodVoDiS+tSgcSp+QV0+mlAfI3ByWMc+TlTdHS0jSR+n/YuFw== 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=GZABAwVG66JjuKf83gyDQBa9bwdPFhNqz8sc6XLIJBA=; b=q3d7cf4V Cq0o0NSwP51mFWNcp3HRxj4hLDLzu560iz+R2CI3/6gKswmBkPza0WJ687trBruI 8uzPB0CqAfWb/BFZQavuolf2lKEjaSr0su6tXnDczGEwnUkimhfronzxpiqpgTH3 qiCKZF5PPVPe95w3QNY2thrufkAH9cAjWW5AiLRYaKc3diEKBKgV3ceUEOvIGOWb Zhupa1Yp43bAMMktg62l//avjtgLizfkjBjJe405692dlIOiY0OVZCOasDsfGtVT 39EQsbChEkU0/4DEfMd6hQ4qLbQM3Xw0GW5roylsVK/Fsx719pqREmZ80Gt9yton GGnCEb+ReFDUeg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedruddtfedgheekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepvdehgfeivdejgedtveehfefhteelfefgieevgfffveefjeegtdfg uedthedtgeevnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf hiiigvpedutdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgr lhhonhdrnhgvth 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 292DC3280065; Tue, 3 Nov 2020 09:10:05 -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, John McNamara Date: Tue, 3 Nov 2020 15:09:27 +0100 Message-Id: <20201103140931.488700-13-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201103140931.488700-1-thomas@monjalon.net> References: <20201029092751.3837177-1-thomas@monjalon.net> <20201103140931.488700-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v5 12/16] examples/rxtx_callbacks: switch timestamp to dynamic 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. Signed-off-by: Thomas Monjalon Acked-by: David Marchand --- examples/rxtx_callbacks/main.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/examples/rxtx_callbacks/main.c b/examples/rxtx_callbacks/main.c index 1a8e7d47d9..35c6c39807 100644 --- a/examples/rxtx_callbacks/main.c +++ b/examples/rxtx_callbacks/main.c @@ -19,6 +19,15 @@ #define MBUF_CACHE_SIZE 250 #define BURST_SIZE 32 +static int hwts_dynfield_offset = -1; + +static inline rte_mbuf_timestamp_t * +hwts_field(struct rte_mbuf *mbuf) +{ + return RTE_MBUF_DYNFIELD(mbuf, + hwts_dynfield_offset, rte_mbuf_timestamp_t *); +} + typedef uint64_t tsc_t; static int tsc_dynfield_offset = -1; @@ -77,7 +86,7 @@ calc_latency(uint16_t port, uint16_t qidx __rte_unused, for (i = 0; i < nb_pkts; i++) { cycles += now - *tsc_field(pkts[i]); if (hw_timestamping) - queue_ticks += ticks - pkts[i]->timestamp; + queue_ticks += ticks - *hwts_field(pkts[i]); } latency_numbers.total_cycles += cycles; @@ -141,6 +150,11 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) return -1; } port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_TIMESTAMP; + rte_mbuf_dyn_rx_timestamp_register(&hwts_dynfield_offset, NULL); + if (hwts_dynfield_offset < 0) { + printf("ERROR: Failed to register timestamp field\n"); + return -rte_errno; + } } retval = rte_eth_dev_configure(port, rx_rings, tx_rings, &port_conf); -- 2.28.0