@@ -1129,6 +1129,121 @@ test_eventdev_link_get(void)
return TEST_SUCCESS;
}
+static int
+test_eventdev_change_profile(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_change_profile),
TEST_CASE_ST(eventdev_setup_device, eventdev_stop_device,
test_eventdev_link),
TEST_CASE_ST(eventdev_setup_device, eventdev_stop_device,