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 54AF3A04DD; Wed, 28 Oct 2020 13:22:47 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E8AD0CABD; Wed, 28 Oct 2020 13:20:55 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by dpdk.org (Postfix) with ESMTP id 574C3CA38 for ; Wed, 28 Oct 2020 13:20:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603887646; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Y1m9+HDdkd0G+Nfxe6E1GAtjvn9lkOMcQbhCKIlIDxE=; b=YQZJlZzUmlBVi8GKOCb8QyNi8YmAG5QjWUqm3No7y19P7BCC1Jfa/WVhjAGOZs6edGWWsH fkRNtwyLZfZyp+SsOBkxeshL/2CbfXvKaV2D+HvdFMDWw11uFm3AOfyHsc+eGR5Y716t8G tGwwV0bgwKaVoGzs8GCMXGUrMI4hoRM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-205-NKfMCBIANpiYub1tHuRP8w-1; Wed, 28 Oct 2020 08:20:43 -0400 X-MC-Unique: NKfMCBIANpiYub1tHuRP8w-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3324C809DE2; Wed, 28 Oct 2020 12:20:42 +0000 (UTC) Received: from dmarchan.remote.csb (unknown [10.40.192.40]) by smtp.corp.redhat.com (Postfix) with ESMTP id EE45310013DB; Wed, 28 Oct 2020 12:20:39 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: Jerin Jacob , Pavan Nikhilesh , Liang Ma , Peter Mccarthy , Harry van Haaren , Ray Kinsella , Neil Horman Date: Wed, 28 Oct 2020 13:20:11 +0100 Message-Id: <20201028122013.31104-8-david.marchand@redhat.com> In-Reply-To: <20201028122013.31104-1-david.marchand@redhat.com> References: <20201027221343.28551-1-david.marchand@redhat.com> <20201028122013.31104-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Subject: [dpdk-dev] [PATCH v2 7/9] eventdev: switch sequence number 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 eventdev drivers have been hacking the deprecated field seqn for internal test usage. It is moved to a dynamic mbuf field in order to allow removal of seqn. Signed-off-by: David Marchand --- Changelog since v1: - split eventdev test app changes from this patch (moved to next patch), - moved seqn as a pmd only API, fixed namespace and marked as internal, --- drivers/event/octeontx/ssovf_evdev_selftest.c | 32 +++++++++-------- drivers/event/octeontx2/otx2_evdev_selftest.c | 36 +++++++++++-------- drivers/event/opdl/opdl_test.c | 8 ++--- drivers/event/sw/sw_evdev_selftest.c | 34 +++++++++--------- lib/librte_eventdev/rte_eventdev.c | 14 +++++++- lib/librte_eventdev/rte_eventdev_pmd.h | 20 +++++++++++ lib/librte_eventdev/version.map | 6 ++++ 7 files changed, 99 insertions(+), 51 deletions(-) diff --git a/drivers/event/octeontx/ssovf_evdev_selftest.c b/drivers/event/octeontx/ssovf_evdev_selftest.c index 7a2b7ded25..528f99dd84 100644 --- a/drivers/event/octeontx/ssovf_evdev_selftest.c +++ b/drivers/event/octeontx/ssovf_evdev_selftest.c @@ -300,7 +300,7 @@ inject_events(uint32_t flow_id, uint8_t event_type, uint8_t sub_event_type, m = rte_pktmbuf_alloc(eventdev_test_mempool); RTE_TEST_ASSERT_NOT_NULL(m, "mempool alloc failed"); - m->seqn = i; + *rte_event_pmd_selftest_seqn(m) = i; update_event_and_validation_attr(m, &ev, flow_id, event_type, sub_event_type, sched_type, queue, port); rte_event_enqueue_burst(evdev, port, &ev, 1); @@ -320,7 +320,8 @@ check_excess_events(uint8_t port) valid_event = rte_event_dequeue_burst(evdev, port, &ev, 1, 0); RTE_TEST_ASSERT_SUCCESS(valid_event, - "Unexpected valid event=%d", ev.mbuf->seqn); + "Unexpected valid event=%d", + *rte_event_pmd_selftest_seqn(ev.mbuf)); } return 0; } @@ -425,8 +426,9 @@ static int validate_simple_enqdeq(uint32_t index, uint8_t port, struct rte_event *ev) { RTE_SET_USED(port); - RTE_TEST_ASSERT_EQUAL(index, ev->mbuf->seqn, "index=%d != seqn=%d", - index, ev->mbuf->seqn); + RTE_TEST_ASSERT_EQUAL(index, *rte_event_pmd_selftest_seqn(ev->mbuf), + "index=%d != seqn=%d", index, + *rte_event_pmd_selftest_seqn(ev->mbuf)); return 0; } @@ -509,10 +511,10 @@ validate_queue_priority(uint32_t index, uint8_t port, struct rte_event *ev) expected_val += ev->queue_id; RTE_SET_USED(port); - RTE_TEST_ASSERT_EQUAL(ev->mbuf->seqn, expected_val, - "seqn=%d index=%d expected=%d range=%d nb_queues=%d max_event=%d", - ev->mbuf->seqn, index, expected_val, range, - queue_count, MAX_EVENTS); + RTE_TEST_ASSERT_EQUAL(*rte_event_pmd_selftest_seqn(ev->mbuf), expected_val, + "seqn=%d index=%d expected=%d range=%d nb_queues=%d max_event=%d", + *rte_event_pmd_selftest_seqn(ev->mbuf), index, expected_val, range, + queue_count, MAX_EVENTS); return 0; } @@ -537,7 +539,7 @@ test_multi_queue_priority(void) m = rte_pktmbuf_alloc(eventdev_test_mempool); RTE_TEST_ASSERT_NOT_NULL(m, "mempool alloc failed"); - m->seqn = i; + *rte_event_pmd_selftest_seqn(m) = i; queue = i % queue_count; update_event_and_validation_attr(m, &ev, 0, RTE_EVENT_TYPE_CPU, 0, RTE_SCHED_TYPE_PARALLEL, queue, 0); @@ -904,7 +906,7 @@ worker_flow_based_pipeline(void *arg) ev.op = RTE_EVENT_OP_FORWARD; rte_event_enqueue_burst(evdev, port, &ev, 1); } else if (ev.sub_event_type == 1) { /* Events from stage 1*/ - if (seqn_list_update(ev.mbuf->seqn) == 0) { + if (seqn_list_update(*rte_event_pmd_selftest_seqn(ev.mbuf)) == 0) { rte_pktmbuf_free(ev.mbuf); rte_atomic32_sub(total_events, 1); } else { @@ -939,7 +941,7 @@ test_multiport_flow_sched_type_test(uint8_t in_sched_type, return 0; } - /* Injects events with m->seqn=0 to total_events */ + /* Injects events with a 0 sequence number to total_events */ ret = inject_events( 0x1 /*flow_id */, RTE_EVENT_TYPE_CPU /* event_type */, @@ -1059,7 +1061,7 @@ worker_group_based_pipeline(void *arg) ev.op = RTE_EVENT_OP_FORWARD; rte_event_enqueue_burst(evdev, port, &ev, 1); } else if (ev.queue_id == 1) { /* Events from stage 1(group 1)*/ - if (seqn_list_update(ev.mbuf->seqn) == 0) { + if (seqn_list_update(*rte_event_pmd_selftest_seqn(ev.mbuf)) == 0) { rte_pktmbuf_free(ev.mbuf); rte_atomic32_sub(total_events, 1); } else { @@ -1101,7 +1103,7 @@ test_multiport_queue_sched_type_test(uint8_t in_sched_type, return 0; } - /* Injects events with m->seqn=0 to total_events */ + /* Injects events with a 0 sequence number to total_events */ ret = inject_events( 0x1 /*flow_id */, RTE_EVENT_TYPE_CPU /* event_type */, @@ -1238,7 +1240,7 @@ launch_multi_port_max_stages_random_sched_type(int (*fn)(void *)) return 0; } - /* Injects events with m->seqn=0 to total_events */ + /* Injects events with a 0 sequence number to total_events */ ret = inject_events( 0x1 /*flow_id */, RTE_EVENT_TYPE_CPU /* event_type */, @@ -1360,7 +1362,7 @@ worker_ordered_flow_producer(void *arg) if (m == NULL) continue; - m->seqn = counter++; + *rte_event_pmd_selftest_seqn(m) = counter++; struct rte_event ev = {.event = 0, .u64 = 0}; diff --git a/drivers/event/octeontx2/otx2_evdev_selftest.c b/drivers/event/octeontx2/otx2_evdev_selftest.c index 334a9ccb7c..48bfaf893d 100644 --- a/drivers/event/octeontx2/otx2_evdev_selftest.c +++ b/drivers/event/octeontx2/otx2_evdev_selftest.c @@ -279,7 +279,7 @@ inject_events(uint32_t flow_id, uint8_t event_type, uint8_t sub_event_type, m = rte_pktmbuf_alloc(eventdev_test_mempool); RTE_TEST_ASSERT_NOT_NULL(m, "mempool alloc failed"); - m->seqn = i; + *rte_event_pmd_selftest_seqn(m) = i; update_event_and_validation_attr(m, &ev, flow_id, event_type, sub_event_type, sched_type, queue, port); @@ -301,7 +301,7 @@ check_excess_events(uint8_t port) RTE_TEST_ASSERT_SUCCESS(valid_event, "Unexpected valid event=%d", - ev.mbuf->seqn); + *rte_event_pmd_selftest_seqn(ev.mbuf)); } return 0; } @@ -406,8 +406,9 @@ static int validate_simple_enqdeq(uint32_t index, uint8_t port, struct rte_event *ev) { RTE_SET_USED(port); - RTE_TEST_ASSERT_EQUAL(index, ev->mbuf->seqn, "index=%d != seqn=%d", - index, ev->mbuf->seqn); + RTE_TEST_ASSERT_EQUAL(index, *rte_event_pmd_selftest_seqn(ev->mbuf), + "index=%d != seqn=%d", + index, *rte_event_pmd_selftest_seqn(ev->mbuf)); return 0; } @@ -493,10 +494,11 @@ validate_queue_priority(uint32_t index, uint8_t port, struct rte_event *ev) expected_val += ev->queue_id; RTE_SET_USED(port); - RTE_TEST_ASSERT_EQUAL(ev->mbuf->seqn, expected_val, - "seqn=%d index=%d expected=%d range=%d nb_queues=%d max_event=%d", - ev->mbuf->seqn, index, expected_val, range, - queue_count, MAX_EVENTS); + RTE_TEST_ASSERT_EQUAL( + *rte_event_pmd_selftest_seqn(ev->mbuf), expected_val, + "seqn=%d index=%d expected=%d range=%d nb_queues=%d max_event=%d", + *rte_event_pmd_selftest_seqn(ev->mbuf), index, expected_val, + range, queue_count, MAX_EVENTS); return 0; } @@ -523,7 +525,7 @@ test_multi_queue_priority(void) m = rte_pktmbuf_alloc(eventdev_test_mempool); RTE_TEST_ASSERT_NOT_NULL(m, "mempool alloc failed"); - m->seqn = i; + *rte_event_pmd_selftest_seqn(m) = i; queue = i % queue_count; update_event_and_validation_attr(m, &ev, 0, RTE_EVENT_TYPE_CPU, 0, RTE_SCHED_TYPE_PARALLEL, @@ -888,7 +890,9 @@ worker_flow_based_pipeline(void *arg) ev.op = RTE_EVENT_OP_FORWARD; rte_event_enqueue_burst(evdev, port, &ev, 1); } else if (ev.sub_event_type == 1) { /* Events from stage 1*/ - if (seqn_list_update(ev.mbuf->seqn) == 0) { + uint32_t seqn = *rte_event_pmd_selftest_seqn(ev.mbuf); + + if (seqn_list_update(seqn) == 0) { rte_pktmbuf_free(ev.mbuf); rte_atomic32_sub(total_events, 1); } else { @@ -923,7 +927,7 @@ test_multiport_flow_sched_type_test(uint8_t in_sched_type, return 0; } - /* Injects events with m->seqn=0 to total_events */ + /* Injects events with a 0 sequence number to total_events */ ret = inject_events(0x1 /*flow_id */, RTE_EVENT_TYPE_CPU /* event_type */, 0 /* sub_event_type (stage 0) */, @@ -1043,7 +1047,9 @@ worker_group_based_pipeline(void *arg) ev.op = RTE_EVENT_OP_FORWARD; rte_event_enqueue_burst(evdev, port, &ev, 1); } else if (ev.queue_id == 1) { /* Events from stage 1(group 1)*/ - if (seqn_list_update(ev.mbuf->seqn) == 0) { + uint32_t seqn = *rte_event_pmd_selftest_seqn(ev.mbuf); + + if (seqn_list_update(seqn) == 0) { rte_pktmbuf_free(ev.mbuf); rte_atomic32_sub(total_events, 1); } else { @@ -1084,7 +1090,7 @@ test_multiport_queue_sched_type_test(uint8_t in_sched_type, return 0; } - /* Injects events with m->seqn=0 to total_events */ + /* Injects events with a 0 sequence number to total_events */ ret = inject_events(0x1 /*flow_id */, RTE_EVENT_TYPE_CPU /* event_type */, 0 /* sub_event_type (stage 0) */, @@ -1222,7 +1228,7 @@ launch_multi_port_max_stages_random_sched_type(int (*fn)(void *)) return 0; } - /* Injects events with m->seqn=0 to total_events */ + /* Injects events with a 0 sequence number to total_events */ ret = inject_events(0x1 /*flow_id */, RTE_EVENT_TYPE_CPU /* event_type */, 0 /* sub_event_type (stage 0) */, @@ -1348,7 +1354,7 @@ worker_ordered_flow_producer(void *arg) if (m == NULL) continue; - m->seqn = counter++; + *rte_event_pmd_selftest_seqn(m) = counter++; struct rte_event ev = {.event = 0, .u64 = 0}; diff --git a/drivers/event/opdl/opdl_test.c b/drivers/event/opdl/opdl_test.c index e7a32fbd31..e4fc70a440 100644 --- a/drivers/event/opdl/opdl_test.c +++ b/drivers/event/opdl/opdl_test.c @@ -256,7 +256,7 @@ ordered_basic(struct test *t) ev.queue_id = t->qid[0]; ev.op = RTE_EVENT_OP_NEW; ev.mbuf = mbufs[i]; - mbufs[i]->seqn = MAGIC_SEQN + i; + *rte_event_pmd_selftest_seqn(mbufs[i]) = MAGIC_SEQN + i; /* generate pkt and enqueue */ err = rte_event_enqueue_burst(evdev, t->port[rx_port], &ev, 1); @@ -281,7 +281,7 @@ ordered_basic(struct test *t) rte_event_dev_dump(evdev, stdout); return -1; } - seq = deq_ev[i].mbuf->seqn - MAGIC_SEQN; + seq = *rte_event_pmd_selftest_seqn(deq_ev[i].mbuf) - MAGIC_SEQN; if (seq != (i-1)) { PMD_DRV_LOG(ERR, " seq test failed ! eq is %d , " @@ -396,7 +396,7 @@ atomic_basic(struct test *t) ev.op = RTE_EVENT_OP_NEW; ev.flow_id = 1; ev.mbuf = mbufs[i]; - mbufs[i]->seqn = MAGIC_SEQN + i; + *rte_event_pmd_selftest_seqn(mbufs[i]) = MAGIC_SEQN + i; /* generate pkt and enqueue */ err = rte_event_enqueue_burst(evdev, t->port[rx_port], &ev, 1); @@ -625,7 +625,7 @@ single_link_w_stats(struct test *t) ev.queue_id = t->qid[0]; ev.op = RTE_EVENT_OP_NEW; ev.mbuf = mbufs[i]; - mbufs[i]->seqn = 1234 + i; + *rte_event_pmd_selftest_seqn(mbufs[i]) = 1234 + i; /* generate pkt and enqueue */ err = rte_event_enqueue_burst(evdev, t->port[rx_port], &ev, 1); diff --git a/drivers/event/sw/sw_evdev_selftest.c b/drivers/event/sw/sw_evdev_selftest.c index ad4fc0eed7..4555f799df 100644 --- a/drivers/event/sw/sw_evdev_selftest.c +++ b/drivers/event/sw/sw_evdev_selftest.c @@ -380,7 +380,7 @@ run_prio_packet_test(struct test *t) printf("%d: gen of pkt failed\n", __LINE__); return -1; } - arp->seqn = MAGIC_SEQN[i]; + *rte_event_pmd_selftest_seqn(arp) = MAGIC_SEQN[i]; ev = (struct rte_event){ .priority = PRIORITY[i], @@ -419,7 +419,7 @@ run_prio_packet_test(struct test *t) rte_event_dev_dump(evdev, stdout); return -1; } - if (ev.mbuf->seqn != MAGIC_SEQN[1]) { + if (*rte_event_pmd_selftest_seqn(ev.mbuf) != MAGIC_SEQN[1]) { printf("%d: first packet out not highest priority\n", __LINE__); rte_event_dev_dump(evdev, stdout); @@ -433,7 +433,7 @@ run_prio_packet_test(struct test *t) rte_event_dev_dump(evdev, stdout); return -1; } - if (ev2.mbuf->seqn != MAGIC_SEQN[0]) { + if (*rte_event_pmd_selftest_seqn(ev2.mbuf) != MAGIC_SEQN[0]) { printf("%d: second packet out not lower priority\n", __LINE__); rte_event_dev_dump(evdev, stdout); @@ -477,7 +477,7 @@ test_single_directed_packet(struct test *t) } const uint32_t MAGIC_SEQN = 4711; - arp->seqn = MAGIC_SEQN; + *rte_event_pmd_selftest_seqn(arp) = MAGIC_SEQN; /* generate pkt and enqueue */ err = rte_event_enqueue_burst(evdev, rx_enq, &ev, 1); @@ -516,7 +516,7 @@ test_single_directed_packet(struct test *t) return -1; } - if (ev.mbuf->seqn != MAGIC_SEQN) { + if (*rte_event_pmd_selftest_seqn(ev.mbuf) != MAGIC_SEQN) { printf("%d: error magic sequence number not dequeued\n", __LINE__); return -1; @@ -934,7 +934,7 @@ xstats_tests(struct test *t) ev.op = RTE_EVENT_OP_NEW; ev.mbuf = arp; ev.flow_id = 7; - arp->seqn = i; + *rte_event_pmd_selftest_seqn(arp) = i; int err = rte_event_enqueue_burst(evdev, t->port[0], &ev, 1); if (err != 1) { @@ -1485,7 +1485,7 @@ xstats_id_reset_tests(struct test *t) ev.queue_id = t->qid[i]; ev.op = RTE_EVENT_OP_NEW; ev.mbuf = arp; - arp->seqn = i; + *rte_event_pmd_selftest_seqn(arp) = i; int err = rte_event_enqueue_burst(evdev, t->port[0], &ev, 1); if (err != 1) { @@ -1873,7 +1873,7 @@ qid_priorities(struct test *t) ev.queue_id = t->qid[i]; ev.op = RTE_EVENT_OP_NEW; ev.mbuf = arp; - arp->seqn = i; + *rte_event_pmd_selftest_seqn(arp) = i; int err = rte_event_enqueue_burst(evdev, t->port[0], &ev, 1); if (err != 1) { @@ -1894,7 +1894,7 @@ qid_priorities(struct test *t) return -1; } for (i = 0; i < 3; i++) { - if (ev[i].mbuf->seqn != 2-i) { + if (*rte_event_pmd_selftest_seqn(ev[i].mbuf) != 2-i) { printf( "%d: qid priority test: seqn %d incorrectly prioritized\n", __LINE__, i); @@ -2371,7 +2371,7 @@ single_packet(struct test *t) ev.mbuf = arp; ev.queue_id = 0; ev.flow_id = 3; - arp->seqn = MAGIC_SEQN; + *rte_event_pmd_selftest_seqn(arp) = MAGIC_SEQN; err = rte_event_enqueue_burst(evdev, t->port[rx_enq], &ev, 1); if (err != 1) { @@ -2411,7 +2411,7 @@ single_packet(struct test *t) } err = test_event_dev_stats_get(evdev, &stats); - if (ev.mbuf->seqn != MAGIC_SEQN) { + if (*rte_event_pmd_selftest_seqn(ev.mbuf) != MAGIC_SEQN) { printf("%d: magic sequence number not dequeued\n", __LINE__); return -1; } @@ -2684,7 +2684,7 @@ parallel_basic(struct test *t, int check_order) ev.queue_id = t->qid[0]; ev.op = RTE_EVENT_OP_NEW; ev.mbuf = mbufs[i]; - mbufs[i]->seqn = MAGIC_SEQN + i; + *rte_event_pmd_selftest_seqn(mbufs[i]) = MAGIC_SEQN + i; /* generate pkt and enqueue */ err = rte_event_enqueue_burst(evdev, t->port[rx_port], &ev, 1); @@ -2739,10 +2739,12 @@ parallel_basic(struct test *t, int check_order) /* Check to see if the sequence numbers are in expected order */ if (check_order) { for (j = 0 ; j < deq_pkts ; j++) { - if (deq_ev[j].mbuf->seqn != MAGIC_SEQN + j) { - printf( - "%d: Incorrect sequence number(%d) from port %d\n", - __LINE__, mbufs_out[j]->seqn, tx_port); + if (*rte_event_pmd_selftest_seqn(deq_ev[j].mbuf) != + MAGIC_SEQN + j) { + printf("%d: Incorrect sequence number(%d) from port %d\n", + __LINE__, + *rte_event_pmd_selftest_seqn(mbufs_out[j]), + tx_port); return -1; } } diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c index 322453c532..994bd1eaa9 100644 --- a/lib/librte_eventdev/rte_eventdev.c +++ b/lib/librte_eventdev/rte_eventdev.c @@ -1242,13 +1242,25 @@ int rte_event_dev_xstats_reset(uint8_t dev_id, return -ENOTSUP; } +int rte_event_pmd_selftest_seqn_dynfield_offset = -1; + int rte_event_dev_selftest(uint8_t dev_id) { RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL); + static const struct rte_mbuf_dynfield test_seqn_dynfield_desc = { + .name = "rte_event_pmd_selftest_seqn_dynfield", + .size = sizeof(rte_event_pmd_selftest_seqn_t), + .align = __alignof__(rte_event_pmd_selftest_seqn_t), + }; struct rte_eventdev *dev = &rte_eventdevs[dev_id]; - if (dev->dev_ops->dev_selftest != NULL) + if (dev->dev_ops->dev_selftest != NULL) { + rte_event_pmd_selftest_seqn_dynfield_offset = + rte_mbuf_dynfield_register(&test_seqn_dynfield_desc); + if (rte_event_pmd_selftest_seqn_dynfield_offset < 0) + return -ENOMEM; return (*dev->dev_ops->dev_selftest)(); + } return -ENOTSUP; } diff --git a/lib/librte_eventdev/rte_eventdev_pmd.h b/lib/librte_eventdev/rte_eventdev_pmd.h index d118b9e5ba..27be376ed1 100644 --- a/lib/librte_eventdev/rte_eventdev_pmd.h +++ b/lib/librte_eventdev/rte_eventdev_pmd.h @@ -20,10 +20,13 @@ extern "C" { #include #include +#include #include #include #include #include +#include +#include #include "rte_eventdev.h" #include "rte_event_timer_adapter_pmd.h" @@ -635,6 +638,23 @@ typedef int (*eventdev_eth_rx_adapter_stats_reset) */ typedef int (*eventdev_selftest)(void); +typedef uint32_t rte_event_pmd_selftest_seqn_t; +extern int rte_event_pmd_selftest_seqn_dynfield_offset; + +/** + * Read test sequence number from mbuf. + * + * @param mbuf Structure to read from. + * @return pointer to test sequence number. + */ +__rte_internal +static inline rte_event_pmd_selftest_seqn_t * +rte_event_pmd_selftest_seqn(struct rte_mbuf *mbuf) +{ + return RTE_MBUF_DYNFIELD(mbuf, + rte_event_pmd_selftest_seqn_dynfield_offset, + rte_event_pmd_selftest_seqn_t *); +} struct rte_cryptodev; diff --git a/lib/librte_eventdev/version.map b/lib/librte_eventdev/version.map index 8ae8420f9b..3e5c09cfdb 100644 --- a/lib/librte_eventdev/version.map +++ b/lib/librte_eventdev/version.map @@ -139,3 +139,9 @@ EXPERIMENTAL { # added in 20.11 rte_event_pmd_pci_probe_named; }; + +INTERNAL { + global: + + rte_event_pmd_selftest_seqn_dynfield_offset; +}; -- 2.23.0