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 73833A04E7; Tue, 3 Nov 2020 01:18:23 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 67F38BE4D; Tue, 3 Nov 2020 01:14:53 +0100 (CET) Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) by dpdk.org (Postfix) with ESMTP id AA6B2BE49 for ; Tue, 3 Nov 2020 01:14:51 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id 5CCECB3D; Mon, 2 Nov 2020 19:14:49 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 02 Nov 2020 19:14:50 -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=L0RLc9erIgpuO e4PDBfgicNmo2LrGJJ0+Z5UDkH8LWE=; b=pFWIF8Np6PKKzeulQCs63JRMm0IDr peLEMIJL0Y/n2F/eR5iCE0RVTKOqxNo6Ae6cKLAOvifgMviTHxwD6yeyikBx/EFY qV1vw4HxjS+XlXWNDLeTiDIR0M9Q/W64FbpnibRLHK/ofEMd8dr9OnYM0hRT8C1/ yCKHLB/Ss45Q8f+ePlT8n7P4XDZ0Y75DY/6z3WHw5XNbS4V9/M2DQXdCGzwRneyF BTBeWKV5Id0H9KcQB7lb2TqeFgMVUGfAg0sZEymMxaexM0yiNka8Gbb9APoTTQNA GMKc8Q6JsDxp87GVSE7V97EEJYq3FuzarVgmhS/zAyknpkvK+80EaybqA== 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=L0RLc9erIgpuOe4PDBfgicNmo2LrGJJ0+Z5UDkH8LWE=; b=X4zKdhc/ sijaoap8N39hwkCZPmmda1B1JKqph81eBH0wnQ73BMky8/zl2T5aW+pwbl9pCWm0 HWfCa4FMC8EAYsMK/IZ0+LQRCwE/kKA04SsZO23DbZtyFKv8DGMehIBIP0MMPyTT 8xOhI+OZCRcP/KcSw9quizr8CQER90dbWbWGWlu0Rh5kytrbUI7ERH75OvrE0qHn zmiJsnwj6yWrqVynESkPScJFFG3RWgmH5WEjE5Ch6z5jg3Fo6tq5uCHYBIntXC3I BewpY5mmnOTrDxhmSfY3qldII0pONWvY0avpXNtqQgXlpd9agySOac9JxlVKBx++ dB3nDedz5k11fw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedruddtvddgudejucetufdoteggodetrfdotf 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 D4CA83064674; Mon, 2 Nov 2020 19:14:47 -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 01:14:03 +0100 Message-Id: <20201103001407.2931963-13-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201103001407.2931963-1-thomas@monjalon.net> References: <20201029092751.3837177-1-thomas@monjalon.net> <20201103001407.2931963-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3 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 --- 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