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 F1446A04E6; Fri, 30 Oct 2020 18:48:08 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BB00E5B30; Fri, 30 Oct 2020 18:45:24 +0100 (CET) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id E0D63593A for ; Fri, 30 Oct 2020 18:45:08 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 936A65C01E2; Fri, 30 Oct 2020 13:45:08 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 30 Oct 2020 13:45:08 -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=YSvc5iUF215JO rEjqV2WVuhghD0tdgw9i1BG9IKS/ho=; b=tsUCwTZTfiL13xq0P7lqyOproyo52 awOqVI8IWSre6arhOqsyKlhGrZs2Kj8NGsTIC2qszO1Acshxs0TJVkDDP+8P4jhm qVJGHtHHiJE5yGE0CFIF8b/9zS9VeKhW4hnnMmWDmW6eQfqphIUENX4YgCjofdyZ 375hHAQmURArNh2cl6v9KKE9udWzOmerykmUrPnIvxozcAlUU2pyKTf8xEVCrk4y wQSChdwU8pHzZITZkFpj59xXkIxQG+3/VZf75ArBREcboO9DuvOiM5ucMT7OUJ84 cJ0+1RdxLcwdQSihcYvRS0uK6PwjgL0SYk6T6/Dg4SYqTXwFzlblStcPQ== 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=YSvc5iUF215JOrEjqV2WVuhghD0tdgw9i1BG9IKS/ho=; b=dvAtMo+w /1fW1KwNHdOQ+LWlMg1K2fdkoijOA3I7cee5TA4krhTMPxhWObEvHssyB5PqZwK3 VWKSr7ReWNMODGzaIV020GbhNH7+BFzIJdZ108TROeftT9522VY277ReA4UqHNoK xt1TPGgf2/88HWRawuEQODEC5lcAQdR/wJM5Jak19ZcAfNBwONHNPfoEohAYiNah ohMJgcyZMgwGLv6sGl7EWA8n1H4scATON6vd69oiL3zzFkr0s5M+XII8bss0xKlM t764DnGlqe+0kRYx1hZVTOe9tB+zduhxNLMaZfD73cff6jbKi2wbBoL6Hj3zRgh8 iBh7D/imY1/g3g== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrleehgdellecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedvhefgiedvjeegtdevheefhfetleefgfeivefgffevfeejgedtgfeu tdehtdegveenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgepieenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho 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 2A5463064674; Fri, 30 Oct 2020 13:45:07 -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, jerinj@marvell.com, Lukasz Wojciechowski , David Hunt Date: Fri, 30 Oct 2020 18:44:36 +0100 Message-Id: <20201030174441.1076264-11-thomas@monjalon.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201030174441.1076264-1-thomas@monjalon.net> References: <20201026052105.1561859-1-thomas@monjalon.net> <20201030174441.1076264-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v6 10/15] test/distributor: switch sequence 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 Acked-by: Lukasz Wojciechowski Tested-by: Lukasz Wojciechowski --- app/test/test_distributor.c | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c index eb889b91d1..f4c6229f16 100644 --- a/app/test/test_distributor.c +++ b/app/test/test_distributor.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -17,6 +18,15 @@ #define BURST 32 #define BIG_BATCH 1024 +typedef uint32_t seq_dynfield_t; +static int seq_dynfield_offset = -1; + +static inline seq_dynfield_t * +seq_field(struct rte_mbuf *mbuf) +{ + return RTE_MBUF_DYNFIELD(mbuf, seq_dynfield_offset, seq_dynfield_t *); +} + struct worker_params { char name[64]; struct rte_distributor *dist; @@ -578,7 +588,7 @@ handle_and_mark_work(void *arg) __atomic_fetch_add(&worker_stats[id].handled_packets, num, __ATOMIC_RELAXED); for (i = 0; i < num; i++) - buf[i]->udata64 += id + 1; + *seq_field(buf[i]) += id + 1; num = rte_distributor_get_pkt(db, id, buf, buf, num); } @@ -631,10 +641,10 @@ sanity_mark_test(struct worker_params *wp, struct rte_mempool *p) << shift; } /* Assign a sequence number to each packet. The sequence is shifted, - * so that lower bits of the udate64 will hold mark from worker. + * so that lower bits will hold mark from worker. */ for (i = 0; i < buf_count; i++) - bufs[i]->udata64 = i << seq_shift; + *seq_field(bufs[i]) = i << seq_shift; count = 0; for (i = 0; i < buf_count/burst; i++) { @@ -660,8 +670,8 @@ sanity_mark_test(struct worker_params *wp, struct rte_mempool *p) /* Sort returned packets by sent order (sequence numbers). */ for (i = 0; i < buf_count; i++) { - seq = returns[i]->udata64 >> seq_shift; - id = returns[i]->udata64 - (seq << seq_shift); + seq = *seq_field(returns[i]) >> seq_shift; + id = *seq_field(returns[i]) - (seq << seq_shift); sorted[seq] = id; } @@ -805,6 +815,18 @@ test_distributor(void) static struct rte_mempool *p; int i; + static const struct rte_mbuf_dynfield seq_dynfield_desc = { + .name = "test_distributor_dynfield_seq", + .size = sizeof(seq_dynfield_t), + .align = __alignof__(seq_dynfield_t), + }; + seq_dynfield_offset = + rte_mbuf_dynfield_register(&seq_dynfield_desc); + if (seq_dynfield_offset < 0) { + printf("Error registering mbuf field\n"); + return TEST_FAILED; + } + if (rte_lcore_count() < 2) { printf("Not enough cores for distributor_autotest, expecting at least 2\n"); return TEST_SKIPPED; -- 2.28.0