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 F0ABAA04E7; Sun, 1 Nov 2020 19:10:49 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1885E69A4; Sun, 1 Nov 2020 19:07:15 +0100 (CET) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id 7C4179B04 for ; Sun, 1 Nov 2020 19:07:12 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 322915C008C; Sun, 1 Nov 2020 13:07:12 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Sun, 01 Nov 2020 13:07:12 -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=MOdpUSFSnVGb6 VY+6OUa19Wtkh2mtbqEWADJwzRfn/Q=; b=jRpYEpdbuC5RxXDubkKXRoh1xP/KN dYj8u6GkMJzXAB3WWhLz6A5mUnQRp/rVfB8vpAJVWOzFJtYLZIqB/zayXjuqFodV pv816Wn8oEvR/r/Xe6os/WrBUFT1ovoiA+hGuLwNxV0qWLieuDtWXvklCRbW/32W sCye7RZU37QTbusxvzgMZ8WD9p30uMZyh3MJWCi0RmNN64xZc8x9zm2/TW+KRmYW 6Rno8ZVwtuEKPT5nIXeU6VdqSkEFT0UGmCZ88gbmShbrmc/Kvw4f79Zmhk0XBeFz +FiX3FqXRcWAPZc3pxBuZbpV/H5/g6jtZ9vCMtEeYNhd0RzeKW06W+rIQ== 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=MOdpUSFSnVGb6VY+6OUa19Wtkh2mtbqEWADJwzRfn/Q=; b=A7YQVYTG lS13MMKh5fyjMoHxAsk3pMASlmdOoo/yRJT3XVyrZ8QJatZxOlpMkWZRcSPxoxJM O0K1RtVqBmKXOnnTsjdjrJ7NfgGidtzuLR6Eal44ANA/QNcMkdaVxYTzXZ5OWVHq xHISkqetmh5TSdzXMKLdtFUL8RlP55Q8kleagOBRkQXcXzwLfHmq3e2aatYb29GN AMqkFSuI1H9+BLpgEolzMhwHXqbWUbcd9xsJKxR9D5Q3Wzedt2ZcTTX8qvOE33he st4ydq5RAn0Fv4f2nBd4M5TI8UccXnD3iu9ynqhfpg7fal9nGZbAgafxVh3Hi552 KRLWTmkM3AjJ+Q== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrleelgdduuddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepvdehgfeivdejgedtveehfefhteelfefgieevgfffveefjeegtdfg uedthedtgeevnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf hiiigvpeduudenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgr 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 1F2623280064; Sun, 1 Nov 2020 13:07:11 -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: Sun, 1 Nov 2020 19:06:25 +0100 Message-Id: <20201101180626.2198868-14-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201101180626.2198868-1-thomas@monjalon.net> References: <20201029092751.3837177-1-thomas@monjalon.net> <20201101180626.2198868-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 13/14] 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 | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/examples/rxtx_callbacks/main.c b/examples/rxtx_callbacks/main.c index 1a8e7d47d9..b1869a5ce8 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,12 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool) return -1; } port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_TIMESTAMP; + hwts_dynfield_offset = rte_mbuf_dynfield_lookup( + RTE_MBUF_DYNFIELD_TIMESTAMP_NAME, NULL); + if (hwts_dynfield_offset < 0) { + printf("ERROR: Failed to lookup timestamp field\n"); + return -rte_errno; + } } retval = rte_eth_dev_configure(port, rx_rings, tx_rings, &port_conf); -- 2.28.0