From: <pbhagavatula@marvell.com>
To: <jerinj@marvell.com>, <pbhagavatula@marvell.com>,
<sthotton@marvell.com>, <timothy.mcdaniel@intel.com>,
<hemant.agrawal@nxp.com>, <sachin.saxena@nxp.com>,
<mattias.ronnblom@ericsson.com>, <liangma@liangbit.com>,
<peter.mccarthy@intel.com>, <harry.van.haaren@intel.com>,
<erik.g.carrillo@intel.com>, <abhinandan.gujjar@intel.com>,
<s.v.naga.harish.k@intel.com>, <anatoly.burakov@intel.com>
Cc: <dev@dpdk.org>
Subject: [PATCH v4 3/3] test/event: add event link profile test
Date: Thu, 28 Sep 2023 15:42:05 +0530 [thread overview]
Message-ID: <20230928101205.4352-4-pbhagavatula@marvell.com> (raw)
In-Reply-To: <20230928101205.4352-1-pbhagavatula@marvell.com>
From: Pavan Nikhilesh <pbhagavatula@marvell.com>
Add test case to verify event link profiles.
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
app/test/test_eventdev.c | 117 +++++++++++++++++++++++++++++++++++++++
1 file changed, 117 insertions(+)
diff --git a/app/test/test_eventdev.c b/app/test/test_eventdev.c
index c51c93bdbd..0ecfa7db02 100644
--- a/app/test/test_eventdev.c
+++ b/app/test/test_eventdev.c
@@ -1129,6 +1129,121 @@ test_eventdev_link_get(void)
return TEST_SUCCESS;
}
+static int
+test_eventdev_profile_switch(void)
+{
+#define MAX_RETRIES 4
+ uint8_t priorities[RTE_EVENT_MAX_QUEUES_PER_DEV];
+ uint8_t queues[RTE_EVENT_MAX_QUEUES_PER_DEV];
+ struct rte_event_queue_conf qcfg;
+ struct rte_event_port_conf pcfg;
+ struct rte_event_dev_info info;
+ struct rte_event ev;
+ uint8_t q, re;
+ int rc;
+
+ rte_event_dev_info_get(TEST_DEV_ID, &info);
+
+ if (info.max_profiles_per_port <= 1)
+ return TEST_SKIPPED;
+
+ if (info.max_event_queues <= 1)
+ return TEST_SKIPPED;
+
+ rc = rte_event_port_default_conf_get(TEST_DEV_ID, 0, &pcfg);
+ TEST_ASSERT_SUCCESS(rc, "Failed to get port0 default config");
+ rc = rte_event_port_setup(TEST_DEV_ID, 0, &pcfg);
+ TEST_ASSERT_SUCCESS(rc, "Failed to setup port0");
+
+ rc = rte_event_queue_default_conf_get(TEST_DEV_ID, 0, &qcfg);
+ TEST_ASSERT_SUCCESS(rc, "Failed to get queue0 default config");
+ rc = rte_event_queue_setup(TEST_DEV_ID, 0, &qcfg);
+ TEST_ASSERT_SUCCESS(rc, "Failed to setup queue0");
+
+ q = 0;
+ rc = rte_event_port_profile_links_set(TEST_DEV_ID, 0, &q, NULL, 1, 0);
+ TEST_ASSERT(rc == 1, "Failed to link queue 0 to port 0 with profile 0");
+ q = 1;
+ rc = rte_event_port_profile_links_set(TEST_DEV_ID, 0, &q, NULL, 1, 1);
+ TEST_ASSERT(rc == 1, "Failed to link queue 1 to port 0 with profile 1");
+
+ rc = rte_event_port_profile_links_get(TEST_DEV_ID, 0, queues, priorities, 0);
+ TEST_ASSERT(rc == 1, "Failed to links");
+ TEST_ASSERT(queues[0] == 0, "Invalid queue found in link");
+
+ rc = rte_event_port_profile_links_get(TEST_DEV_ID, 0, queues, priorities, 1);
+ TEST_ASSERT(rc == 1, "Failed to links");
+ TEST_ASSERT(queues[0] == 1, "Invalid queue found in link");
+
+ rc = rte_event_dev_start(TEST_DEV_ID);
+ TEST_ASSERT_SUCCESS(rc, "Failed to start event device");
+
+ ev.event_type = RTE_EVENT_TYPE_CPU;
+ ev.queue_id = 0;
+ ev.op = RTE_EVENT_OP_NEW;
+ ev.flow_id = 0;
+ ev.u64 = 0xBADF00D0;
+ rc = rte_event_enqueue_burst(TEST_DEV_ID, 0, &ev, 1);
+ TEST_ASSERT(rc == 1, "Failed to enqueue event");
+ ev.queue_id = 1;
+ ev.flow_id = 1;
+ rc = rte_event_enqueue_burst(TEST_DEV_ID, 0, &ev, 1);
+ TEST_ASSERT(rc == 1, "Failed to enqueue event");
+
+ ev.event = 0;
+ ev.u64 = 0;
+
+ rc = rte_event_port_profile_switch(TEST_DEV_ID, 0, 1);
+ TEST_ASSERT_SUCCESS(rc, "Failed to change profile");
+
+ re = MAX_RETRIES;
+ while (re--) {
+ rc = rte_event_dequeue_burst(TEST_DEV_ID, 0, &ev, 1, 0);
+ printf("rc %d\n", rc);
+ if (rc)
+ break;
+ }
+
+ TEST_ASSERT(rc == 1, "Failed to dequeue event from profile 1");
+ TEST_ASSERT(ev.flow_id == 1, "Incorrect flow identifier from profile 1");
+ TEST_ASSERT(ev.queue_id == 1, "Incorrect queue identifier from profile 1");
+
+ re = MAX_RETRIES;
+ while (re--) {
+ rc = rte_event_dequeue_burst(TEST_DEV_ID, 0, &ev, 1, 0);
+ TEST_ASSERT(rc == 0, "Unexpected event dequeued from active profile");
+ }
+
+ rc = rte_event_port_profile_switch(TEST_DEV_ID, 0, 0);
+ TEST_ASSERT_SUCCESS(rc, "Failed to change profile");
+
+ re = MAX_RETRIES;
+ while (re--) {
+ rc = rte_event_dequeue_burst(TEST_DEV_ID, 0, &ev, 1, 0);
+ if (rc)
+ break;
+ }
+
+ TEST_ASSERT(rc == 1, "Failed to dequeue event from profile 1");
+ TEST_ASSERT(ev.flow_id == 0, "Incorrect flow identifier from profile 0");
+ TEST_ASSERT(ev.queue_id == 0, "Incorrect queue identifier from profile 0");
+
+ re = MAX_RETRIES;
+ while (re--) {
+ rc = rte_event_dequeue_burst(TEST_DEV_ID, 0, &ev, 1, 0);
+ TEST_ASSERT(rc == 0, "Unexpected event dequeued from active profile");
+ }
+
+ q = 0;
+ rc = rte_event_port_profile_unlink(TEST_DEV_ID, 0, &q, 1, 0);
+ TEST_ASSERT(rc == 1, "Failed to unlink queue 0 to port 0 with profile 0");
+ q = 1;
+ rc = rte_event_port_profile_unlink(TEST_DEV_ID, 0, &q, 1, 1);
+ TEST_ASSERT(rc == 1, "Failed to unlink queue 1 to port 0 with profile 1");
+
+ return TEST_SUCCESS;
+}
+
static int
test_eventdev_close(void)
{
@@ -1187,6 +1302,8 @@ static struct unit_test_suite eventdev_common_testsuite = {
test_eventdev_timeout_ticks),
TEST_CASE_ST(NULL, NULL,
test_eventdev_start_stop),
+ TEST_CASE_ST(eventdev_configure_setup, eventdev_stop_device,
+ test_eventdev_profile_switch),
TEST_CASE_ST(eventdev_setup_device, eventdev_stop_device,
test_eventdev_link),
TEST_CASE_ST(eventdev_setup_device, eventdev_stop_device,
--
2.25.1
next prev parent reply other threads:[~2023-09-28 10:12 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-09 14:26 [RFC 0/3] Introduce event link profiles pbhagavatula
2023-08-09 14:26 ` [RFC 1/3] eventdev: introduce " pbhagavatula
2023-08-18 10:27 ` Jerin Jacob
2023-08-09 14:26 ` [RFC 2/3] event/cnxk: implement event " pbhagavatula
2023-08-09 14:26 ` [RFC 3/3] test/event: add event link profile test pbhagavatula
2023-08-09 19:45 ` [RFC 0/3] Introduce event link profiles Mattias Rönnblom
2023-08-10 5:17 ` [EXT] " Pavan Nikhilesh Bhagavatula
2023-08-12 5:52 ` Mattias Rönnblom
2023-08-14 11:29 ` Pavan Nikhilesh Bhagavatula
2023-08-25 18:44 ` [PATCH " pbhagavatula
2023-08-25 18:44 ` [PATCH 1/3] eventdev: introduce " pbhagavatula
2023-08-25 18:44 ` [PATCH 2/3] event/cnxk: implement event " pbhagavatula
2023-08-25 18:44 ` [PATCH 3/3] test/event: add event link profile test pbhagavatula
2023-08-31 20:44 ` [PATCH v2 0/3] Introduce event link profiles pbhagavatula
2023-08-31 20:44 ` [PATCH v2 1/3] eventdev: introduce " pbhagavatula
2023-09-20 4:22 ` Jerin Jacob
2023-08-31 20:44 ` [PATCH v2 2/3] event/cnxk: implement event " pbhagavatula
2023-08-31 20:44 ` [PATCH v2 3/3] test/event: add event link profile test pbhagavatula
2023-09-21 10:28 ` [PATCH v3 0/3] Introduce event link profiles pbhagavatula
2023-09-21 10:28 ` [PATCH v3 1/3] eventdev: introduce " pbhagavatula
2023-09-27 15:23 ` Jerin Jacob
2023-09-21 10:28 ` [PATCH v3 2/3] event/cnxk: implement event " pbhagavatula
2023-09-27 15:29 ` Jerin Jacob
2023-09-21 10:28 ` [PATCH v3 3/3] test/event: add event link profile test pbhagavatula
2023-09-27 14:56 ` [PATCH v3 0/3] Introduce event link profiles Jerin Jacob
2023-09-28 10:12 ` [PATCH v4 " pbhagavatula
2023-09-28 10:12 ` [PATCH v4 1/3] eventdev: introduce " pbhagavatula
2023-10-03 6:55 ` Jerin Jacob
2023-09-28 10:12 ` [PATCH v4 2/3] event/cnxk: implement event " pbhagavatula
2023-09-28 10:12 ` pbhagavatula [this message]
2023-09-28 14:45 ` [PATCH v4 0/3] Introduce " Jerin Jacob
2023-09-29 9:27 ` [EXT] " Pavan Nikhilesh Bhagavatula
2023-10-03 7:51 ` [PATCH v5 " pbhagavatula
2023-10-03 7:51 ` [PATCH v5 1/3] eventdev: introduce " pbhagavatula
2023-10-03 7:51 ` [PATCH v5 2/3] event/cnxk: implement event " pbhagavatula
2023-10-03 7:51 ` [PATCH v5 3/3] test/event: add event link profile test pbhagavatula
2023-10-03 9:47 ` [PATCH v6 0/3] Introduce event link profiles pbhagavatula
2023-10-03 9:47 ` [PATCH v6 1/3] eventdev: introduce " pbhagavatula
2023-10-03 9:47 ` [PATCH v6 2/3] event/cnxk: implement event " pbhagavatula
2023-10-03 9:47 ` [PATCH v6 3/3] test/event: add event link profile test pbhagavatula
2023-10-03 10:36 ` [PATCH v6 0/3] Introduce event link profiles Jerin Jacob
2023-10-03 14:12 ` Bruce Richardson
2023-10-03 15:17 ` Jerin Jacob
2023-10-03 15:32 ` [EXT] " Pavan Nikhilesh Bhagavatula
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=20230928101205.4352-4-pbhagavatula@marvell.com \
--to=pbhagavatula@marvell.com \
--cc=abhinandan.gujjar@intel.com \
--cc=anatoly.burakov@intel.com \
--cc=dev@dpdk.org \
--cc=erik.g.carrillo@intel.com \
--cc=harry.van.haaren@intel.com \
--cc=hemant.agrawal@nxp.com \
--cc=jerinj@marvell.com \
--cc=liangma@liangbit.com \
--cc=mattias.ronnblom@ericsson.com \
--cc=peter.mccarthy@intel.com \
--cc=s.v.naga.harish.k@intel.com \
--cc=sachin.saxena@nxp.com \
--cc=sthotton@marvell.com \
--cc=timothy.mcdaniel@intel.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).