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 DC3CEA04B5; Mon, 26 Oct 2020 06:25:13 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 347FE4F90; Mon, 26 Oct 2020 06:21:53 +0100 (CET) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id C0AFD4C87 for ; Mon, 26 Oct 2020 06:21:46 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 64E685C00D0; Mon, 26 Oct 2020 01:21:45 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 26 Oct 2020 01:21:45 -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=uKL6dYhtKqOHW 2to/07iORUt56/dgbPsFEz4d4eNFL4=; b=sLBqUwTvOLtFFrVpxr7O23wf6jdC+ +8l0Gr3KW7KEVGqRfWpmi7ROF0MfLyDT1Cwxuuso2v4dKsz3MyianvZqH+xRXSn8 k5SekbJ3MMGqHurOUm+CdwOkeBje91GiKC817ner7rgfP0bLVNEZleRieq7I0euH l3qXOJ6o5wMJUzzd3GJNAvVfA44yPmFfWWCZcCcLFKKnts4jzsSEZEVBKE+2Tkkz OqPrFNgEY4Vl7mt7ZeH5SzlKIv9nRifL66S+yM6jrs0IEnRChX2q4Z2xpzdN8oL+ sPqrHGx6gINuVIOOJAfmOSUV0iGAieI/54nou/SLjNH9pjxPX9VPHvewA== 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=uKL6dYhtKqOHW2to/07iORUt56/dgbPsFEz4d4eNFL4=; b=PMfSgSiS ztPoD/lVzgZT6Qha7gAdi8NyZNxbs40+y899AatK3I68aUN/o+8bbqDIEG2oF00B w/+EwqYxAPgGaDToVSvlA3Kt9S1PAhLjqBQ5yZIfXpyP5VR4IGvtOhdMKnItzE6e 0NsHHTEcTlDmTLq/boDut4XHGzmFXEaBiqSTsv6u/yFP+8TC9xOPzNE7ZCdxDlgN a2cht/HSHWOfJumoKVIDtHv9ohhkkBmNA4Ay2DGiSKaw3mjxmqjxaTDeDxNTmHPj Fxuq8COxiEn33CToHrlPeRKqK6b5IEjqiTnS0r3Vn9HKA2KWen2U/wnROPm/XNpP YbPnhy0y1Vj2Sw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrkeehgdekgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgepleenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho nhdrnhgvth 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 EBD6D3064674; Mon, 26 Oct 2020 01:21:43 -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, akhil.goyal@nxp.com, Jerin Jacob , Kiran Kumar K , Nithin Dabilpuram Date: Mon, 26 Oct 2020 06:21:01 +0100 Message-Id: <20201026052105.1561859-12-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 11/15] test/graph: switch user data to dynamic mbuf 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 test 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 --- app/test/test_graph.c | 93 +++++++++++++++++++++++++------------------ 1 file changed, 55 insertions(+), 38 deletions(-) diff --git a/app/test/test_graph.c b/app/test/test_graph.c index ed69eda997..74d8e78353 100644 --- a/app/test/test_graph.c +++ b/app/test/test_graph.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include "test.h" @@ -39,6 +40,10 @@ static uint16_t test_node3_worker(struct rte_graph *graph, #define MBUFF_SIZE 512 #define MAX_NODES 4 +static int graph_dynfield_offset; +#define GRAPH_FIELD(mbuf) \ + (*RTE_MBUF_DYNFIELD(mbuf, graph_dynfield_offset, uint64_t *)) + static struct rte_mbuf mbuf[MAX_NODES + 1][MBUFF_SIZE]; static void *mbuf_p[MAX_NODES + 1][MBUFF_SIZE]; static rte_graph_t graph_id; @@ -162,9 +167,9 @@ test_node_worker_source(struct rte_graph *graph, struct rte_node *node, next_stream = rte_node_next_stream_get(graph, node, next, obj_node0); for (i = 0; i < obj_node0; i++) { data = &mbuf[0][i]; - data->udata64 = ((uint64_t)tm->test_node[0].idx << 32) | i; + GRAPH_FIELD(data) = ((uint64_t)tm->test_node[0].idx << 32) | i; if ((i + 1) == obj_node0) - data->udata64 |= (1 << 16); + GRAPH_FIELD(data) |= (1 << 16); next_stream[i] = &mbuf[0][i]; } rte_node_next_stream_put(graph, node, next, obj_node0); @@ -175,9 +180,9 @@ test_node_worker_source(struct rte_graph *graph, struct rte_node *node, next_stream = rte_node_next_stream_get(graph, node, next, obj_node1); for (i = 0; i < obj_node1; i++) { data = &mbuf[0][obj_node0 + i]; - data->udata64 = ((uint64_t)tm->test_node[1].idx << 32) | i; + GRAPH_FIELD(data) = ((uint64_t)tm->test_node[1].idx << 32) | i; if ((i + 1) == obj_node1) - data->udata64 |= (1 << 16); + GRAPH_FIELD(data) |= (1 << 16); next_stream[i] = &mbuf[0][obj_node0 + i]; } @@ -205,23 +210,23 @@ test_node0_worker(struct rte_graph *graph, struct rte_node *node, void **objs, for (i = 0; i < nb_objs; i++) { data = (struct rte_mbuf *)objs[i]; - if ((data->udata64 >> 32) != tm->test_node[0].idx) { + if ((GRAPH_FIELD(data) >> 32) != tm->test_node[0].idx) { printf("Data idx miss match at node 0, expected" " = %u got = %u\n", tm->test_node[0].idx, - (uint32_t)(data->udata64 >> 32)); + (uint32_t)(GRAPH_FIELD(data) >> 32)); goto end; } - if ((data->udata64 & 0xffff) != (i - count)) { + if ((GRAPH_FIELD(data) & 0xffff) != (i - count)) { printf("Expected buff count miss match at " "node 0\n"); goto end; } - if (data->udata64 & (0x1 << 16)) + if (GRAPH_FIELD(data) & (0x1 << 16)) count = i + 1; - if (data->udata64 & (0x1 << 17)) + if (GRAPH_FIELD(data) & (0x1 << 17)) second_pass = 1; } @@ -233,12 +238,12 @@ test_node0_worker(struct rte_graph *graph, struct rte_node *node, void **objs, obj_node0 = nb_objs * obj_node0 * 0.01; for (i = 0; i < obj_node0; i++) { data = &mbuf[1][i]; - data->udata64 = + GRAPH_FIELD(data) = ((uint64_t)tm->test_node[1].idx << 32) | i; if ((i + 1) == obj_node0) - data->udata64 |= (1 << 16); + GRAPH_FIELD(data) |= (1 << 16); if (second_pass) - data->udata64 |= (1 << 17); + GRAPH_FIELD(data) |= (1 << 17); } rte_node_enqueue(graph, node, 0, (void **)&mbuf_p[1][0], obj_node0); @@ -246,12 +251,12 @@ test_node0_worker(struct rte_graph *graph, struct rte_node *node, void **objs, obj_node1 = nb_objs - obj_node0; for (i = 0; i < obj_node1; i++) { data = &mbuf[1][obj_node0 + i]; - data->udata64 = + GRAPH_FIELD(data) = ((uint64_t)tm->test_node[2].idx << 32) | i; if ((i + 1) == obj_node1) - data->udata64 |= (1 << 16); + GRAPH_FIELD(data) |= (1 << 16); if (second_pass) - data->udata64 |= (1 << 17); + GRAPH_FIELD(data) |= (1 << 17); } rte_node_enqueue(graph, node, 1, (void **)&mbuf_p[1][obj_node0], obj_node1); @@ -285,22 +290,22 @@ test_node1_worker(struct rte_graph *graph, struct rte_node *node, void **objs, fn_calls[2] += 1; for (i = 0; i < nb_objs; i++) { data = (struct rte_mbuf *)objs[i]; - if ((data->udata64 >> 32) != tm->test_node[1].idx) { + if ((GRAPH_FIELD(data) >> 32) != tm->test_node[1].idx) { printf("Data idx miss match at node 1, expected = %u" " got = %u\n", tm->test_node[1].idx, - (uint32_t)(data->udata64 >> 32)); + (uint32_t)(GRAPH_FIELD(data) >> 32)); goto end; } - if ((data->udata64 & 0xffff) != (i - count)) { + if ((GRAPH_FIELD(data) & 0xffff) != (i - count)) { printf("Expected buff count miss match at node 1\n"); goto end; } - if (data->udata64 & (0x1 << 16)) + if (GRAPH_FIELD(data) & (0x1 << 16)) count = i + 1; - if (data->udata64 & (0x1 << 17)) + if (GRAPH_FIELD(data) & (0x1 << 17)) second_pass = 1; } @@ -312,11 +317,11 @@ test_node1_worker(struct rte_graph *graph, struct rte_node *node, void **objs, obj_node0 = nb_objs; for (i = 0; i < obj_node0; i++) { data = &mbuf[2][i]; - data->udata64 = ((uint64_t)tm->test_node[2].idx << 32) | i; + GRAPH_FIELD(data) = ((uint64_t)tm->test_node[2].idx << 32) | i; if ((i + 1) == obj_node0) - data->udata64 |= (1 << 16); + GRAPH_FIELD(data) |= (1 << 16); if (second_pass) - data->udata64 |= (1 << 17); + GRAPH_FIELD(data) |= (1 << 17); } rte_node_enqueue(graph, node, 0, (void **)&mbuf_p[2][0], obj_node0); @@ -339,22 +344,22 @@ test_node2_worker(struct rte_graph *graph, struct rte_node *node, void **objs, fn_calls[3] += 1; for (i = 0; i < nb_objs; i++) { data = (struct rte_mbuf *)objs[i]; - if ((data->udata64 >> 32) != tm->test_node[2].idx) { + if ((GRAPH_FIELD(data) >> 32) != tm->test_node[2].idx) { printf("Data idx miss match at node 2, expected = %u" " got = %u\n", tm->test_node[2].idx, - (uint32_t)(data->udata64 >> 32)); + (uint32_t)(GRAPH_FIELD(data) >> 32)); goto end; } - if ((data->udata64 & 0xffff) != (i - count)) { + if ((GRAPH_FIELD(data) & 0xffff) != (i - count)) { printf("Expected buff count miss match at node 2\n"); goto end; } - if (data->udata64 & (0x1 << 16)) + if (GRAPH_FIELD(data) & (0x1 << 16)) count = i + 1; - if (data->udata64 & (0x1 << 17)) + if (GRAPH_FIELD(data) & (0x1 << 17)) second_pass = 1; } @@ -367,10 +372,10 @@ test_node2_worker(struct rte_graph *graph, struct rte_node *node, void **objs, obj_node0 = nb_objs; for (i = 0; i < obj_node0; i++) { data = &mbuf[3][i]; - data->udata64 = + GRAPH_FIELD(data) = ((uint64_t)tm->test_node[3].idx << 32) | i; if ((i + 1) == obj_node0) - data->udata64 |= (1 << 16); + GRAPH_FIELD(data) |= (1 << 16); } rte_node_enqueue(graph, node, 0, (void **)&mbuf_p[3][0], obj_node0); @@ -395,22 +400,22 @@ test_node3_worker(struct rte_graph *graph, struct rte_node *node, void **objs, fn_calls[4] += 1; for (i = 0; i < nb_objs; i++) { data = (struct rte_mbuf *)objs[i]; - if ((data->udata64 >> 32) != tm->test_node[3].idx) { + if ((GRAPH_FIELD(data) >> 32) != tm->test_node[3].idx) { printf("Data idx miss match at node 3, expected = %u" " got = %u\n", tm->test_node[3].idx, - (uint32_t)(data->udata64 >> 32)); + (uint32_t)(GRAPH_FIELD(data) >> 32)); goto end; } - if ((data->udata64 & 0xffff) != (i - count)) { + if ((GRAPH_FIELD(data) & 0xffff) != (i - count)) { printf("Expected buff count miss match at node 3\n"); goto end; } - if (data->udata64 & (0x1 << 16)) + if (GRAPH_FIELD(data) & (0x1 << 16)) count = i + 1; - if (data->udata64 & (0x1 << 17)) + if (GRAPH_FIELD(data) & (0x1 << 17)) second_pass = 1; } @@ -426,11 +431,11 @@ test_node3_worker(struct rte_graph *graph, struct rte_node *node, void **objs, obj_node0 = nb_objs * 2; for (i = 0; i < obj_node0; i++) { data = &mbuf[4][i]; - data->udata64 = + GRAPH_FIELD(data) = ((uint64_t)tm->test_node[0].idx << 32) | i; - data->udata64 |= (1 << 17); + GRAPH_FIELD(data) |= (1 << 17); if ((i + 1) == obj_node0) - data->udata64 |= (1 << 16); + GRAPH_FIELD(data) |= (1 << 16); } rte_node_enqueue(graph, node, 0, (void **)&mbuf_p[4][0], obj_node0); @@ -765,6 +770,18 @@ graph_setup(void) { int i, j; + static const struct rte_mbuf_dynfield graph_dynfield_desc = { + .name = "test_graph_dynfield", + .size = sizeof(uint64_t), + .align = __alignof__(uint64_t), + }; + graph_dynfield_offset = + rte_mbuf_dynfield_register(&graph_dynfield_desc); + if (graph_dynfield_offset < 0) { + printf("Cannot register mbuf field\n"); + return TEST_FAILED; + } + for (i = 0; i <= MAX_NODES; i++) { for (j = 0; j < MBUFF_SIZE; j++) mbuf_p[i][j] = &mbuf[i][j]; -- 2.28.0