From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 033FEA04DD;
	Mon, 26 Oct 2020 23:22:25 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 9574D3257;
	Mon, 26 Oct 2020 23:20:41 +0100 (CET)
Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com
 [66.111.4.27]) by dpdk.org (Postfix) with ESMTP id 99F48100C
 for <dev@dpdk.org>; Mon, 26 Oct 2020 23:20:37 +0100 (CET)
Received: from compute2.internal (compute2.nyi.internal [10.202.2.42])
 by mailout.nyi.internal (Postfix) with ESMTP id 497E55C0175;
 Mon, 26 Oct 2020 18:20:36 -0400 (EDT)
Received: from mailfrontend2 ([10.202.2.163])
 by compute2.internal (MEProxy); Mon, 26 Oct 2020 18:20:36 -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=leGvxcYF4Kunf
 im8tEBd45ksJHYqn3ISiqHlQ8W89jk=; b=HSl9TsNf29yNvflkPJTxfs/dexeV2
 TBALXhNMWE2QD0x0Ty92orjsH9z9CX9qxHLQyIV4qK4BbP02actNIBZyzLYsrFo7
 rBSFfWYcJaASadQ6Wbw6VXSWdNF+7gVn6Lr3Dmq/x+jzgYrDz8to6wLR9iHyvl4C
 /hqm2XGqLe0TP4GczSid4WxqSKNrXAKdE06INUwcAGq4JbQLRTxZ5f1Lp0L25LfT
 s77R8OsGdI86COXDVsQ/ge0w/PCBV3Dwarw6pDGcrAB8k6ZaoUPmrxHLdnVAvc4J
 PzVY7zujNzU8t0DhMJY4yJUJFEspaYoo6r2T8myOvQWG3vzbxKnLPk6nw==
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=leGvxcYF4Kunfim8tEBd45ksJHYqn3ISiqHlQ8W89jk=; b=ZEHNCTQl
 A4SM48hUxcsauyFAxohue+ic45BVgLu4vBCoBxsTVKpruSy3S8AAppNZY0LK0pRn
 m5iDM02cngv/+PNwhfxDwF65xQY2A2Ec/4hYCYdKFk0ie0uJ5x56YRZe8U9yyP27
 voQGh4jVBpaJgSBPjOS6BM+WnVu/MbdI2N1gU7yCVnrae55HwX/BZm8AoSN1ci+Y
 uUp0Isi3RzDxmZ/uzdokhlB4rICennvMbiE/LhJOCLN3SHQti7BoTtg/Ov6udZMu
 30hw6BoC7tS+Dc1pjhKzN07Llb+HfGBcxq3sIW0Nk/Lt4D8IoHXzQJ2bvaix05CE
 H0x+fx0QwnspdQ==
X-ME-Sender: <xms:tEuXX64GpVvbwuEkMOH-GetK8qRRgkpBHgedNecjT_Fd2Sey41j0FA>
 <xme:tEuXXz5Iop1K01Md4GM7T7EESLWBFYSBK00TeSRgROUM6Yc8sK4KdT2phwCpw9c1r
 7C4EOO5kz0ehIt6Qw>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrkeejgdduvdegucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefvhhhomhgr
 shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg
 ftrfgrthhtvghrnhepvdehgfeivdejgedtveehfefhteelfefgieevgfffveefjeegtdfg
 uedthedtgeevnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf
 hiiigvpeehnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl
 ohhnrdhnvght
X-ME-Proxy: <xmx:tEuXX5fOiD-HJK-NfZCdVQsqABUHZQuGl1BIlU3J5sfL-EOCvraSmw>
 <xmx:tEuXX3IM86Duy_mVnUWR4C5aEPZa4tU88es8NljRukDTdwuyKEHVZg>
 <xmx:tEuXX-J8BnYuoaRy0umK9SsMyHdgY3MzJyPQlflWUdEo3DxChpZHCw>
 <xmx:tEuXXwhzKeuG02Z0R3IYs8o8rBaFMSQSOMDr_Ofpv_pAqh83A2TNSQ>
Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184])
 by mail.messagingengine.com (Postfix) with ESMTPA id 3C693306467E;
 Mon, 26 Oct 2020 18:20:35 -0400 (EDT)
From: Thomas Monjalon <thomas@monjalon.net>
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, akhil.goyal@nxp.com,
 Harry van Haaren <harry.van.haaren@intel.com>
Date: Mon, 26 Oct 2020 23:20:04 +0100
Message-Id: <20201026222013.2147904-7-thomas@monjalon.net>
X-Mailer: git-send-email 2.28.0
In-Reply-To: <20201026222013.2147904-1-thomas@monjalon.net>
References: <20201026052105.1561859-1-thomas@monjalon.net>
 <20201026222013.2147904-1-thomas@monjalon.net>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [dpdk-dev] [PATCH v2 06/15] event/sw: switch test counter to
	dynamic mbuf field
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

The test worker_loopback used the deprecated mbuf field udata64.
It is moved to a dynamic field in order to allow removal of udata64.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
 drivers/event/sw/sw_evdev_selftest.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/drivers/event/sw/sw_evdev_selftest.c b/drivers/event/sw/sw_evdev_selftest.c
index 5c7e527917..9af20cecf1 100644
--- a/drivers/event/sw/sw_evdev_selftest.c
+++ b/drivers/event/sw/sw_evdev_selftest.c
@@ -40,6 +40,11 @@ struct test {
 	uint32_t service_id;
 };
 
+static int counter_dynfield_offset;
+#define COUNTER_FIELD_TYPE uint8_t
+#define COUNTER_FIELD(mbuf) (*RTE_MBUF_DYNFIELD(mbuf, \
+		counter_dynfield_offset, COUNTER_FIELD_TYPE *))
+
 static struct rte_event release_ev;
 
 static inline struct rte_mbuf *
@@ -2987,8 +2992,8 @@ worker_loopback_worker_fn(void *arg)
 			}
 
 			ev[i].queue_id = 0;
-			ev[i].mbuf->udata64++;
-			if (ev[i].mbuf->udata64 != 16) {
+			COUNTER_FIELD(ev[i].mbuf)++;
+			if (COUNTER_FIELD(ev[i].mbuf) != 16) {
 				ev[i].op = RTE_EVENT_OP_FORWARD;
 				enqd = rte_event_enqueue_burst(evdev, port,
 						&ev[i], 1);
@@ -3028,7 +3033,7 @@ worker_loopback_producer_fn(void *arg)
 			m = rte_pktmbuf_alloc(t->mbuf_pool);
 		} while (m == NULL);
 
-		m->udata64 = 0;
+		COUNTER_FIELD(m) = 0;
 
 		struct rte_event ev = {
 				.op = RTE_EVENT_OP_NEW,
@@ -3061,6 +3066,18 @@ worker_loopback(struct test *t, uint8_t disable_implicit_release)
 	int err;
 	int w_lcore, p_lcore;
 
+	static const struct rte_mbuf_dynfield counter_dynfield_desc = {
+		.name = "rte_event_sw_dynfield_selftest_counter",
+		.size = sizeof(COUNTER_FIELD_TYPE),
+		.align = __alignof__(COUNTER_FIELD_TYPE),
+	};
+	counter_dynfield_offset =
+		rte_mbuf_dynfield_register(&counter_dynfield_desc);
+	if (counter_dynfield_offset < 0) {
+		printf("Error registering mbuf field\n");
+		return -rte_errno;
+	}
+
 	if (init(t, 8, 2) < 0 ||
 			create_atomic_qids(t, 8) < 0) {
 		printf("%d: Error initializing device\n", __LINE__);
-- 
2.28.0