DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: Jerin Jacob <jerinj@marvell.com>
Subject: [dpdk-dev] [PATCH v2 8/9] app/eventdev: switch sequence number to dynamic mbuf field
Date: Wed, 28 Oct 2020 13:20:12 +0100	[thread overview]
Message-ID: <20201028122013.31104-9-david.marchand@redhat.com> (raw)
In-Reply-To: <20201028122013.31104-1-david.marchand@redhat.com>

The order test stored a sequence number in the deprecated mbuf field
seqn.
It is moved to a dynamic field in order to allow removal of seqn.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 app/test-eventdev/test_order_common.c | 14 +++++++++++++-
 app/test-eventdev/test_order_common.h | 13 +++++++++++--
 2 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/app/test-eventdev/test_order_common.c b/app/test-eventdev/test_order_common.c
index 01a44bcd75..04456d56db 100644
--- a/app/test-eventdev/test_order_common.c
+++ b/app/test-eventdev/test_order_common.c
@@ -48,7 +48,7 @@ order_producer(void *arg)
 
 		const flow_id_t flow = (uintptr_t)m % nb_flows;
 		/* Maintain seq number per flow */
-		m->seqn = producer_flow_seq[flow]++;
+		*order_mbuf_seqn(t, m) = producer_flow_seq[flow]++;
 		order_flow_id_save(t, flow, m, &ev);
 
 		while (rte_event_enqueue_burst(dev_id, port, &ev, 1) != 1) {
@@ -141,6 +141,11 @@ order_test_setup(struct evt_test *test, struct evt_options *opt)
 		.size = sizeof(flow_id_t),
 		.align = __alignof__(flow_id_t),
 	};
+	static const struct rte_mbuf_dynfield seqn_dynfield_desc = {
+		.name = "test_event_dynfield_seqn",
+		.size = sizeof(seqn_t),
+		.align = __alignof__(seqn_t),
+	};
 
 	test_order = rte_zmalloc_socket(test->name, sizeof(struct test_order),
 				RTE_CACHE_LINE_SIZE, opt->socket_id);
@@ -158,6 +163,13 @@ order_test_setup(struct evt_test *test, struct evt_options *opt)
 		return -rte_errno;
 	}
 
+	t->seqn_dynfield_offset =
+		rte_mbuf_dynfield_register(&seqn_dynfield_desc);
+	if (t->seqn_dynfield_offset < 0) {
+		evt_err("failed to register mbuf field");
+		return -rte_errno;
+	}
+
 	t->producer_flow_seq = rte_zmalloc_socket("test_producer_flow_seq",
 				 sizeof(*t->producer_flow_seq) * opt->nb_flows,
 				RTE_CACHE_LINE_SIZE, opt->socket_id);
diff --git a/app/test-eventdev/test_order_common.h b/app/test-eventdev/test_order_common.h
index 90eac96fc8..5ef8404938 100644
--- a/app/test-eventdev/test_order_common.h
+++ b/app/test-eventdev/test_order_common.h
@@ -22,6 +22,7 @@
 #define BURST_SIZE 16
 
 typedef uint32_t flow_id_t;
+typedef uint32_t seqn_t;
 
 struct test_order;
 
@@ -53,6 +54,7 @@ struct test_order {
 	uint64_t nb_pkts;
 	struct rte_mempool *pool;
 	int flow_id_dynfield_offset;
+	int seqn_dynfield_offset;
 	struct prod_data prod;
 	struct worker_data worker[EVT_MAX_PORTS];
 	uint32_t *producer_flow_seq;
@@ -77,6 +79,12 @@ order_flow_id_save(struct test_order *t, flow_id_t flow_id,
 	event->mbuf = mbuf;
 }
 
+static inline seqn_t *
+order_mbuf_seqn(struct test_order *t, struct rte_mbuf *mbuf)
+{
+	return RTE_MBUF_DYNFIELD(mbuf, t->seqn_dynfield_offset, seqn_t *);
+}
+
 static inline int
 order_nb_event_ports(struct evt_options *opt)
 {
@@ -91,9 +99,10 @@ order_process_stage_1(struct test_order *const t,
 {
 	const uint32_t flow = (uintptr_t)ev->mbuf % nb_flows;
 	/* compare the seqn against expected value */
-	if (ev->mbuf->seqn != expected_flow_seq[flow]) {
+	if (*order_mbuf_seqn(t, ev->mbuf) != expected_flow_seq[flow]) {
 		evt_err("flow=%x seqn mismatch got=%x expected=%x",
-			flow, ev->mbuf->seqn, expected_flow_seq[flow]);
+			flow, *order_mbuf_seqn(t, ev->mbuf),
+			expected_flow_seq[flow]);
 		t->err = true;
 		rte_smp_wmb();
 	}
-- 
2.23.0


  parent reply	other threads:[~2020-10-28 12:23 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-27 22:13 [dpdk-dev] [PATCH 0/8] remove mbuf seqn David Marchand
2020-10-27 22:13 ` [dpdk-dev] [PATCH 1/8] event/dpaa2: remove dead code David Marchand
2020-10-27 22:13 ` [dpdk-dev] [PATCH 2/8] crypto/scheduler: remove unused internal seqn David Marchand
2020-10-27 22:13 ` [dpdk-dev] [PATCH 3/8] net/ark: remove use of seqn for debug David Marchand
2020-10-28 12:19   ` Ed Czeck
2020-10-27 22:13 ` [dpdk-dev] [PATCH 4/8] reorder: switch sequence number to dynamic mbuf field David Marchand
2020-10-27 22:13 ` [dpdk-dev] [PATCH 5/8] dpaa: switch sequence number to dynamic field David Marchand
2020-10-27 22:13 ` [dpdk-dev] [PATCH 6/8] fslmc: " David Marchand
2020-10-27 22:13 ` [dpdk-dev] [PATCH 7/8] event: " David Marchand
2020-10-27 22:18   ` David Marchand
2020-10-28  7:27   ` Jerin Jacob
2020-10-28  8:55     ` David Marchand
2020-10-28  9:09       ` Jerin Jacob
2020-10-27 22:13 ` [dpdk-dev] [PATCH 8/8] mbuf: remove seqn field David Marchand
2020-10-28 10:27   ` Andrew Rybchenko
2020-10-28 12:20 ` [dpdk-dev] [PATCH v2 0/9] remove mbuf seqn David Marchand
2020-10-28 12:20   ` [dpdk-dev] [PATCH v2 1/9] event/dpaa2: remove dead code David Marchand
2020-10-31 18:28     ` Nipun Gupta
2020-10-28 12:20   ` [dpdk-dev] [PATCH v2 2/9] crypto/scheduler: remove unused internal seqn David Marchand
2020-10-28 12:20   ` [dpdk-dev] [PATCH v2 3/9] net/ark: remove use of seqn for debug David Marchand
2020-10-28 12:20   ` [dpdk-dev] [PATCH v2 4/9] reorder: switch sequence number to dynamic mbuf field David Marchand
2020-10-28 12:54     ` Andrew Rybchenko
2020-10-28 12:20   ` [dpdk-dev] [PATCH v2 5/9] dpaa: " David Marchand
2020-10-28 12:20   ` [dpdk-dev] [PATCH v2 6/9] fslmc: " David Marchand
2020-10-28 12:20   ` [dpdk-dev] [PATCH v2 7/9] eventdev: " David Marchand
2020-10-28 12:20   ` David Marchand [this message]
2020-10-28 12:20   ` [dpdk-dev] [PATCH v2 9/9] mbuf: remove seqn field David Marchand
2020-10-31 21:09     ` Thomas Monjalon
2020-10-31 21:11   ` [dpdk-dev] [PATCH v2 0/9] remove mbuf seqn Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201028122013.31104-9-david.marchand@redhat.com \
    --to=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).