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 634A3A04B5;
	Mon, 26 Oct 2020 06:23:40 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 709D63772;
	Mon, 26 Oct 2020 06:21:42 +0100 (CET)
Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com
 [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id E8BCB2BAA
 for <dev@dpdk.org>; Mon, 26 Oct 2020 06:21:33 +0100 (CET)
Received: from compute2.internal (compute2.nyi.internal [10.202.2.42])
 by mailout.nyi.internal (Postfix) with ESMTP id 9BE075C00D0;
 Mon, 26 Oct 2020 01:21:33 -0400 (EDT)
Received: from mailfrontend2 ([10.202.2.163])
 by compute2.internal (MEProxy); Mon, 26 Oct 2020 01:21:33 -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=EpKrOH7NTqj0c
 cBzDkoyTZMZJe4wT8NqOd3aNnChEcQ=; b=mzpbHOkAAMxTV4PAh8xHsAfPvihmf
 x09uMoFvqSDy/MA193I9TxIZFbS65pZPcBgds7D5SfgWAUvROJrEqEVw4Cv6EfNW
 JyJu6snn03QCb4awilg5b4bJ47HR8rDsbR7+McUrlBvLlj/ZV+Rs2/U4XARPRDvK
 z0bfp0GvEVi+IL2xwU+2jZC/L7swBqZfEH0mzufeXTdEC9rSsYKG9tF/zJBb/BCp
 bmSi8TaecNnum4DDhodiANldf3N9kS27MVPNf/1CLpDfPlIxzhDE9qqQpX+odWoo
 SBeXqEJkdYi22dJTrlFjOnlpoC8gLwThPIEVBNxRpEqGkKWp2FFoPu8mQ==
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=EpKrOH7NTqj0ccBzDkoyTZMZJe4wT8NqOd3aNnChEcQ=; b=eLYY3bel
 fxhAlxECSHA2hJyWhjdOa+nBoZG3zNWWRRWs/gHk1hj3TwtVx91IjfZIBPQVc7fx
 JhE/MP1tFOHUxIW0SJ4llTzc1g6HmbnZYr6iFR3qvMC4VmifgqEwoejIwtnxE97h
 jEtgjbCyQAjTytKj3vt8BY2Ev2ehxJxKFQ74BRe1MoZqd8f5Y4GpDywid6l3GuX2
 7BWcEezrPWwRW2i9zEnBTw4p09+Hop5cAUwOhyojHyS+9V69lIWk8exkxrfdKCFn
 NgfSEg+APOvqIkl5DYQEeIq9hR6A2uejzOqHyOOUmOkoAGQATxrPBz71P5IIDlot
 XPHyxQGo9xrbAQ==
X-ME-Sender: <xms:3VyWX8Kzi3y17D8n2qw7NwatT4Sb5WQDs95Brzdj6Q4KIChNU2Nokg>
 <xme:3VyWX8LxycWTK7i-4XtTp8KMGlLWsT2YdMZ8W6LDhdVQmKnM4kPFFHBCHo9jb7A55
 r-VamZu78JW3_OGoA>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrkeehgdekgecutefuodetggdotefrodftvf
 curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu
 uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc
 fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs
 ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf
 frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu
 tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih
 iivgepheenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho
 nhdrnhgvth
X-ME-Proxy: <xmx:3VyWX8uTaLhPYvAeCoSWQzw_odlx8I7pDgg6xRVw9bupMYQbUBEEoQ>
 <xmx:3VyWX5a7Vgcd6aRIEXjiP4fMkUwfnpvzMawufqs7pnsVosYFBWEaUg>
 <xmx:3VyWXzZnAktsnzt0oU17dOk3d6nBrgCCqBGOsIfjbYjwmnmv7nFR1A>
 <xmx:3VyWX-w4a7LtKnDrJ1rLRXp1HMobt6WG8jh6PZgr9jxa7qm5wBpL8w>
Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184])
 by mail.messagingengine.com (Postfix) with ESMTPA id 8F93F3064610;
 Mon, 26 Oct 2020 01:21:32 -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 06:20:56 +0100
Message-Id: <20201026052105.1561859-7-thomas@monjalon.net>
X-Mailer: git-send-email 2.28.0
In-Reply-To: <20201026052105.1561859-1-thomas@monjalon.net>
References: <20201026052105.1561859-1-thomas@monjalon.net>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [dpdk-dev] [PATCH 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>
---
 drivers/event/sw/sw_evdev_selftest.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/drivers/event/sw/sw_evdev_selftest.c b/drivers/event/sw/sw_evdev_selftest.c
index 5c7e527917..754504c421 100644
--- a/drivers/event/sw/sw_evdev_selftest.c
+++ b/drivers/event/sw/sw_evdev_selftest.c
@@ -40,6 +40,10 @@ struct test {
 	uint32_t service_id;
 };
 
+static int counter_dynfield_offset;
+#define COUNTER_FIELD(mbuf) \
+	(*RTE_MBUF_DYNFIELD(mbuf, counter_dynfield_offset, uint8_t *))
+
 static struct rte_event release_ev;
 
 static inline struct rte_mbuf *
@@ -2987,8 +2991,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 +3032,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 +3065,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(uint8_t),
+		.align = __alignof__(uint8_t),
+	};
+	counter_dynfield_offset =
+		rte_mbuf_dynfield_register(&counter_dynfield_desc);
+	if (counter_dynfield_offset < 0) {
+		printf("Error registering mbuf field\n");
+		return -1;
+	}
+
 	if (init(t, 8, 2) < 0 ||
 			create_atomic_qids(t, 8) < 0) {
 		printf("%d: Error initializing device\n", __LINE__);
-- 
2.28.0