DPDK patches and discussions
 help / color / mirror / Atom feed
From: Shijith Thotton <sthotton@marvell.com>
To: <dev@dpdk.org>, <jerinj@marvell.com>
Cc: Shijith Thotton <sthotton@marvell.com>,
	<pbhagavatula@marvell.com>, <harry.van.haaren@intel.com>,
	<mattias.ronnblom@ericsson.com>, <mdr@ashroe.eu>
Subject: [PATCH v4 3/5] test/event: test cases to test runtime queue attribute
Date: Mon, 16 May 2022 23:05:49 +0530	[thread overview]
Message-ID: <7f2bd0734a71e6b46496933379df1bac51cc8b0a.1652722314.git.sthotton@marvell.com> (raw)
In-Reply-To: <cover.1652722314.git.sthotton@marvell.com>

Added test cases to test changing of queue QoS attributes priority,
weight and affinity at runtime.

Signed-off-by: Shijith Thotton <sthotton@marvell.com>
---
 app/test/test_eventdev.c | 201 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 201 insertions(+)

diff --git a/app/test/test_eventdev.c b/app/test/test_eventdev.c
index 4f51042bda..336529038e 100644
--- a/app/test/test_eventdev.c
+++ b/app/test/test_eventdev.c
@@ -385,6 +385,201 @@ test_eventdev_queue_attr_priority(void)
 	return TEST_SUCCESS;
 }
 
+static int
+test_eventdev_queue_attr_priority_runtime(void)
+{
+	uint32_t queue_count, queue_req, prio, deq_cnt;
+	struct rte_event_queue_conf qconf;
+	struct rte_event_port_conf pconf;
+	struct rte_event_dev_info info;
+	struct rte_event event = {
+		.op = RTE_EVENT_OP_NEW,
+		.event_type = RTE_EVENT_TYPE_CPU,
+		.sched_type = RTE_SCHED_TYPE_ATOMIC,
+		.u64 = 0xbadbadba,
+	};
+	int i, ret;
+
+	ret = rte_event_dev_info_get(TEST_DEV_ID, &info);
+	TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info");
+
+	if (!(info.event_dev_cap & RTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR))
+		return TEST_SKIPPED;
+
+	TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(
+				    TEST_DEV_ID, RTE_EVENT_DEV_ATTR_QUEUE_COUNT,
+				    &queue_count),
+			    "Queue count get failed");
+
+	/* Need at least 2 queues to test LOW and HIGH priority. */
+	TEST_ASSERT(queue_count > 1, "Not enough event queues, needed 2");
+	queue_req = 2;
+
+	for (i = 0; i < (int)queue_count; i++) {
+		ret = rte_event_queue_default_conf_get(TEST_DEV_ID, i, &qconf);
+		TEST_ASSERT_SUCCESS(ret, "Failed to get queue%d def conf", i);
+		ret = rte_event_queue_setup(TEST_DEV_ID, i, &qconf);
+		TEST_ASSERT_SUCCESS(ret, "Failed to setup queue%d", i);
+	}
+
+	ret = rte_event_queue_attr_set(TEST_DEV_ID, 0,
+				       RTE_EVENT_QUEUE_ATTR_PRIORITY,
+				       RTE_EVENT_DEV_PRIORITY_LOWEST);
+	if (ret == -ENOTSUP)
+		return TEST_SKIPPED;
+	TEST_ASSERT_SUCCESS(ret, "Queue0 priority set failed");
+
+	ret = rte_event_queue_attr_set(TEST_DEV_ID, 1,
+				       RTE_EVENT_QUEUE_ATTR_PRIORITY,
+				       RTE_EVENT_DEV_PRIORITY_HIGHEST);
+	if (ret == -ENOTSUP)
+		return TEST_SKIPPED;
+	TEST_ASSERT_SUCCESS(ret, "Queue1 priority set failed");
+
+	/* Setup event port 0 */
+	ret = rte_event_port_default_conf_get(TEST_DEV_ID, 0, &pconf);
+	TEST_ASSERT_SUCCESS(ret, "Failed to get port0 info");
+	ret = rte_event_port_setup(TEST_DEV_ID, 0, &pconf);
+	TEST_ASSERT_SUCCESS(ret, "Failed to setup port0");
+	ret = rte_event_port_link(TEST_DEV_ID, 0, NULL, NULL, 0);
+	TEST_ASSERT(ret == (int)queue_count, "Failed to link port, device %d",
+		    TEST_DEV_ID);
+
+	ret = rte_event_dev_start(TEST_DEV_ID);
+	TEST_ASSERT_SUCCESS(ret, "Failed to start device%d", TEST_DEV_ID);
+
+	for (i = 0; i < (int)queue_req; i++) {
+		event.queue_id = i;
+		while (rte_event_enqueue_burst(TEST_DEV_ID, 0, &event, 1) != 1)
+			rte_pause();
+	}
+
+	prio = RTE_EVENT_DEV_PRIORITY_HIGHEST;
+	deq_cnt = 0;
+	while (deq_cnt < queue_req) {
+		uint32_t queue_prio;
+
+		if (rte_event_dequeue_burst(TEST_DEV_ID, 0, &event, 1, 0) == 0)
+			continue;
+
+		ret = rte_event_queue_attr_get(TEST_DEV_ID, event.queue_id,
+					       RTE_EVENT_QUEUE_ATTR_PRIORITY,
+					       &queue_prio);
+		if (ret == -ENOTSUP)
+			return TEST_SKIPPED;
+
+		TEST_ASSERT_SUCCESS(ret, "Queue priority get failed");
+		TEST_ASSERT(queue_prio >= prio,
+			    "Received event from a lower priority queue first");
+		prio = queue_prio;
+		deq_cnt++;
+	}
+
+	return TEST_SUCCESS;
+}
+
+static int
+test_eventdev_queue_attr_weight_runtime(void)
+{
+	struct rte_event_queue_conf qconf;
+	struct rte_event_dev_info info;
+	uint32_t queue_count;
+	int i, ret;
+
+	ret = rte_event_dev_info_get(TEST_DEV_ID, &info);
+	TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info");
+
+	if (!(info.event_dev_cap & RTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR))
+		return TEST_SKIPPED;
+
+	TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(
+				    TEST_DEV_ID, RTE_EVENT_DEV_ATTR_QUEUE_COUNT,
+				    &queue_count),
+			    "Queue count get failed");
+
+	for (i = 0; i < (int)queue_count; i++) {
+		ret = rte_event_queue_default_conf_get(TEST_DEV_ID, i, &qconf);
+		TEST_ASSERT_SUCCESS(ret, "Failed to get queue%d def conf", i);
+		ret = rte_event_queue_setup(TEST_DEV_ID, i, &qconf);
+		TEST_ASSERT_SUCCESS(ret, "Failed to setup queue%d", i);
+	}
+
+	for (i = 0; i < (int)queue_count; i++) {
+		uint32_t get_val;
+		uint64_t set_val;
+
+		set_val = i % RTE_EVENT_QUEUE_WEIGHT_HIGHEST;
+		ret = rte_event_queue_attr_set(
+			TEST_DEV_ID, i, RTE_EVENT_QUEUE_ATTR_WEIGHT, set_val);
+		if (ret == -ENOTSUP)
+			return TEST_SKIPPED;
+
+		TEST_ASSERT_SUCCESS(ret, "Queue weight set failed");
+
+		ret = rte_event_queue_attr_get(
+			TEST_DEV_ID, i, RTE_EVENT_QUEUE_ATTR_WEIGHT, &get_val);
+		if (ret == -ENOTSUP)
+			return TEST_SKIPPED;
+
+		TEST_ASSERT_SUCCESS(ret, "Queue weight get failed");
+		TEST_ASSERT_EQUAL(get_val, set_val,
+				  "Wrong weight value for queue%d", i);
+	}
+
+	return TEST_SUCCESS;
+}
+
+static int
+test_eventdev_queue_attr_affinity_runtime(void)
+{
+	struct rte_event_queue_conf qconf;
+	struct rte_event_dev_info info;
+	uint32_t queue_count;
+	int i, ret;
+
+	ret = rte_event_dev_info_get(TEST_DEV_ID, &info);
+	TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info");
+
+	if (!(info.event_dev_cap & RTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR))
+		return TEST_SKIPPED;
+
+	TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(
+				    TEST_DEV_ID, RTE_EVENT_DEV_ATTR_QUEUE_COUNT,
+				    &queue_count),
+			    "Queue count get failed");
+
+	for (i = 0; i < (int)queue_count; i++) {
+		ret = rte_event_queue_default_conf_get(TEST_DEV_ID, i, &qconf);
+		TEST_ASSERT_SUCCESS(ret, "Failed to get queue%d def conf", i);
+		ret = rte_event_queue_setup(TEST_DEV_ID, i, &qconf);
+		TEST_ASSERT_SUCCESS(ret, "Failed to setup queue%d", i);
+	}
+
+	for (i = 0; i < (int)queue_count; i++) {
+		uint32_t get_val;
+		uint64_t set_val;
+
+		set_val = i % RTE_EVENT_QUEUE_AFFINITY_HIGHEST;
+		ret = rte_event_queue_attr_set(
+			TEST_DEV_ID, i, RTE_EVENT_QUEUE_ATTR_AFFINITY, set_val);
+		if (ret == -ENOTSUP)
+			return TEST_SKIPPED;
+
+		TEST_ASSERT_SUCCESS(ret, "Queue affinity set failed");
+
+		ret = rte_event_queue_attr_get(
+			TEST_DEV_ID, i, RTE_EVENT_QUEUE_ATTR_AFFINITY, &get_val);
+		if (ret == -ENOTSUP)
+			return TEST_SKIPPED;
+
+		TEST_ASSERT_SUCCESS(ret, "Queue affinity get failed");
+		TEST_ASSERT_EQUAL(get_val, set_val,
+				  "Wrong affinity value for queue%d", i);
+	}
+
+	return TEST_SUCCESS;
+}
+
 static int
 test_eventdev_queue_attr_nb_atomic_flows(void)
 {
@@ -964,6 +1159,12 @@ static struct unit_test_suite eventdev_common_testsuite  = {
 			test_eventdev_queue_count),
 		TEST_CASE_ST(eventdev_configure_setup, NULL,
 			test_eventdev_queue_attr_priority),
+		TEST_CASE_ST(eventdev_configure_setup, eventdev_stop_device,
+			test_eventdev_queue_attr_priority_runtime),
+		TEST_CASE_ST(eventdev_configure_setup, NULL,
+			test_eventdev_queue_attr_weight_runtime),
+		TEST_CASE_ST(eventdev_configure_setup, NULL,
+			test_eventdev_queue_attr_affinity_runtime),
 		TEST_CASE_ST(eventdev_configure_setup, NULL,
 			test_eventdev_queue_attr_nb_atomic_flows),
 		TEST_CASE_ST(eventdev_configure_setup, NULL,
-- 
2.25.1


  parent reply	other threads:[~2022-05-16 17:39 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-29 13:10 [PATCH 0/6] Extend and set event queue attributes at runtime Shijith Thotton
2022-03-29 13:11 ` [PATCH 1/6] eventdev: support to set " Shijith Thotton
2022-03-30 10:58   ` Van Haaren, Harry
2022-04-04  9:35     ` Shijith Thotton
2022-04-04  9:45       ` Van Haaren, Harry
2022-03-30 12:14   ` Mattias Rönnblom
2022-04-04 11:45     ` Shijith Thotton
2022-03-29 13:11 ` [PATCH 2/6] eventdev: add weight and affinity to queue attributes Shijith Thotton
2022-03-30 12:12   ` Mattias Rönnblom
2022-04-04  9:33     ` Shijith Thotton
2022-03-29 13:11 ` [PATCH 3/6] doc: announce change in event queue conf structure Shijith Thotton
2022-03-29 13:11 ` [PATCH 4/6] test/event: test cases to test runtime queue attribute Shijith Thotton
2022-03-29 13:11 ` [PATCH 5/6] event/cnxk: support to set runtime queue attributes Shijith Thotton
2022-03-30 11:05   ` Van Haaren, Harry
2022-04-04  7:59     ` Shijith Thotton
2022-03-29 13:11 ` [PATCH 6/6] common/cnxk: use lock when accessing mbox of SSO Shijith Thotton
2022-03-29 18:49 ` [PATCH 0/6] Extend and set event queue attributes at runtime Jerin Jacob
2022-03-30 10:52   ` Van Haaren, Harry
2022-04-04  7:57     ` Shijith Thotton
2022-04-05  5:40 ` [PATCH v2 " Shijith Thotton
2022-04-05  5:40   ` [PATCH v2 1/6] eventdev: support to set " Shijith Thotton
2022-05-09 12:43     ` Jerin Jacob
2022-04-05  5:40   ` [PATCH v2 2/6] eventdev: add weight and affinity to queue attributes Shijith Thotton
2022-05-09 12:46     ` Jerin Jacob
2022-04-05  5:41   ` [PATCH v2 3/6] doc: announce change in event queue conf structure Shijith Thotton
2022-05-09 12:47     ` Jerin Jacob
2022-05-15 10:24     ` [PATCH v3] " Shijith Thotton
2022-07-12 14:05       ` Jerin Jacob
2022-07-13  6:52         ` [EXT] " Pavan Nikhilesh Bhagavatula
2022-07-13  8:55         ` Mattias Rönnblom
2022-07-13  9:56           ` Pavan Nikhilesh Bhagavatula
2022-07-17 12:52       ` Thomas Monjalon
2022-04-05  5:41   ` [PATCH v2 4/6] test/event: test cases to test runtime queue attribute Shijith Thotton
2022-05-09 12:55     ` Jerin Jacob
2022-04-05  5:41   ` [PATCH v2 5/6] event/cnxk: support to set runtime queue attributes Shijith Thotton
2022-05-09 12:57     ` Jerin Jacob
2022-04-05  5:41   ` [PATCH v2 6/6] common/cnxk: use lock when accessing mbox of SSO Shijith Thotton
2022-04-11 11:07   ` [PATCH v2 0/6] Extend and set event queue attributes at runtime Shijith Thotton
2022-05-15  9:53   ` [PATCH v3 0/5] " Shijith Thotton
2022-05-15  9:53     ` [PATCH v3 1/5] eventdev: support to set " Shijith Thotton
2022-05-15 13:11       ` Mattias Rönnblom
2022-05-16  3:57         ` Shijith Thotton
2022-05-16 10:23           ` Mattias Rönnblom
2022-05-16 12:12             ` Shijith Thotton
2022-05-15  9:53     ` [PATCH v3 2/5] eventdev: add weight and affinity to queue attributes Shijith Thotton
2022-05-15  9:53     ` [PATCH v3 3/5] test/event: test cases to test runtime queue attribute Shijith Thotton
2022-05-15  9:53     ` [PATCH v3 4/5] common/cnxk: use lock when accessing mbox of SSO Shijith Thotton
2022-05-15  9:53     ` [PATCH v3 5/5] event/cnxk: support to set runtime queue attributes Shijith Thotton
2022-05-16 17:35     ` [PATCH v4 0/5] Extend and set event queue attributes at runtime Shijith Thotton
2022-05-16 17:35       ` [PATCH v4 1/5] eventdev: support to set " Shijith Thotton
2022-05-16 18:02         ` Jerin Jacob
2022-05-17  8:55           ` Mattias Rönnblom
2022-05-17 13:35             ` Jerin Jacob
2022-05-19  8:49         ` Ray Kinsella
2022-05-16 17:35       ` [PATCH v4 2/5] eventdev: add weight and affinity to queue attributes Shijith Thotton
2022-05-16 17:35       ` Shijith Thotton [this message]
2022-05-16 17:35       ` [PATCH v4 4/5] common/cnxk: use lock when accessing mbox of SSO Shijith Thotton
2022-05-16 17:35       ` [PATCH v4 5/5] event/cnxk: support to set runtime queue attributes Shijith Thotton

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=7f2bd0734a71e6b46496933379df1bac51cc8b0a.1652722314.git.sthotton@marvell.com \
    --to=sthotton@marvell.com \
    --cc=dev@dpdk.org \
    --cc=harry.van.haaren@intel.com \
    --cc=jerinj@marvell.com \
    --cc=mattias.ronnblom@ericsson.com \
    --cc=mdr@ashroe.eu \
    --cc=pbhagavatula@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).