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 C4677A0521; Tue, 3 Nov 2020 13:27:09 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2320DCA60; Tue, 3 Nov 2020 13:22:48 +0100 (CET) Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by dpdk.org (Postfix) with ESMTP id 4610EC9D6 for ; Tue, 3 Nov 2020 13:22:45 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id DB830C66; Tue, 3 Nov 2020 07:22:42 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Tue, 03 Nov 2020 07:22:43 -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=DkNisCFQiiEDZq7y41Ha82mreyEYw w9fS96LGCSqwAhuzRyCtccUv4VLYzQT0tm9a7FHSZ+/AnIR7Ij7o4uLv+IaLoXTI VLRUGku3vfsyHCVPhck7x+xHuUYqs2uEU6/KftqqGEUfv3lQisLyQFbeaaLE0YL/ 7eCZ74bxfTh1RXDK9CF/50f0vCg3FQZdG/od0tdS1JYNDFnhkVHXWi76Q1DA+fdT tgSPVfRfr0ygQKigD+D+TdhQGzsNBsFadhihNDmz5WgC42Vc11fzhx6GsOddf96K tY6X6Neoy+RAgV8qhpGtkO0WZenmo/7EgCHJ8Wc9bZbIvLvRPMrVhknTA== 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=EMUhOhLL pWv2C3sczhLWHQr+WVcNdnuo02jDFJTtwb5D/82YugEuVb7QJUxTBGmXFqZz18pM NRNQQSe98Og8nsxbHPcnPOUUEYRfaFFuVP4N67g0OG5xIQXu50idus5rMFAo+xWW YNq728iE27CPm0eXCTw5xRJjZt3opDutt0hvIcMwozUPj2QLViaW18JNgnfa+0K1 DjlUUrH1cEXz3o90KAmGcU/xtsXj7iJO8J/TiBHAOGo5OX14lLe1OcQt3KCxGo1y AlAT+bPzFIV8mppeuOjALT4++xsHGo2c0Qhzg9vMChEWpZRYI2PmtWTrKHun011X DQBtLLyjUweUTQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedruddtfedgfeelucetufdoteggodetrfdotf 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 6F8EB3064683; Tue, 3 Nov 2020 07:22:41 -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 13:22:01 +0100 Message-Id: <20201103122205.183472-13-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 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