From patchwork Thu Oct 29 09:27:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 82725 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E2DD9A04DD; Thu, 29 Oct 2020 10:32:34 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2CB0EC9A6; Thu, 29 Oct 2020 10:28:43 +0100 (CET) Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by dpdk.org (Postfix) with ESMTP id 9BB99C8DA for ; Thu, 29 Oct 2020 10:28:31 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id 530C59EF; Thu, 29 Oct 2020 05:28:30 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Thu, 29 Oct 2020 05:28:31 -0400 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=dulWPH/DmlCVG ZCSUvrFCQUsLYQiwt6mMne8sZbrQoU=; b=XLJbBjVhbnaqjc7/4Zn3IjbViCnfG q0mWZHJbBKtj1buZpz9on9mxaiRQ7TMGr5/19zfhy20N5erkYQSAlkINxmlyyRyR bYLG3OeqhYU7bNWPp8WDwB/xIYFNm85StKV7Hgz06KOLYb7gqAwZNTf3wo/tctEl JUZh9yzaCA9vURM+5wkT+noJgWl/CdnlBEq8uGQula/zoXQNHoEzXEDEHszREEqW CdhiLsW34cxiYrU4i9rEBLTTOpLabBv0LZmgglZPJpCFvXCle2FGfDC/PrBoRY8k +B7X+A/ST0rQgK3Jm9aDkNdQl80cAXYF2bYD3LQls1K3l42uBzxLp5V7w== 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=dulWPH/DmlCVGZCSUvrFCQUsLYQiwt6mMne8sZbrQoU=; b=gNfOWa3/ 7LAwpsWJ7gQuJ19X3EtTPBhwzoRM5LhAZqXhKWrc2mGc0Y+i8Vo07uoGuLPZgu2P Nh3xjcoVi2Os0iDpTPop3VLtBmOb1yQeJ/B9neRp7CJrApClvrhzL4OD4kS91xki zr2/YqIDyVq+sZUPLlonkFIzKrBbZCODbv30RWwrmud2io4tbDlxAn6xYerDzxVY 9PZ2XNOiZ8FwoE+/n14weOLfkuN51bUbpwcXBaXMxNXVEEiPIQaOwzMDSpGbZLt2 DZwgVmIfK0HinNsrhpIeF0nLwiFebhzKW9Xd37sRw5jp3G4Df72n+Uk/GRKz9Vpw rb2Xby+K63N4ow== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrleefgddthecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgepuddtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl ohhnrdhnvght 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 DCF5B3280065; Thu, 29 Oct 2020 05:28:28 -0400 (EDT) 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: Thu, 29 Oct 2020 10:27:48 +0100 Message-Id: <20201029092751.3837177-14-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201029092751.3837177-1-thomas@monjalon.net> References: <20201029092751.3837177-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 13/15] 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 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/examples/rxtx_callbacks/main.c b/examples/rxtx_callbacks/main.c index b9a98ceddc..4798e0962c 100644 --- a/examples/rxtx_callbacks/main.c +++ b/examples/rxtx_callbacks/main.c @@ -19,6 +19,10 @@ #define MBUF_CACHE_SIZE 250 #define BURST_SIZE 32 +static int hwts_dynfield_offset = -1; +#define HWTS_FIELD(mbuf) (*RTE_MBUF_DYNFIELD(mbuf, \ + hwts_dynfield_offset, rte_mbuf_timestamp_t *)) + typedef uint64_t tsc_t; static int tsc_dynfield_offset = -1; #define TSC_FIELD(mbuf) (*RTE_MBUF_DYNFIELD(mbuf, \ @@ -73,7 +77,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; @@ -137,6 +141,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);