MCPcopy Create free account
hub / github.com/F-Stack/f-stack / test_eventdev_profile_switch

Function test_eventdev_profile_switch

dpdk/app/test/test_eventdev.c:1138–1252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1136}
1137
1138static int
1139test_eventdev_profile_switch(void)
1140{
1141#define MAX_RETRIES 4
1142 uint8_t priorities[RTE_EVENT_MAX_QUEUES_PER_DEV];
1143 uint8_t queues[RTE_EVENT_MAX_QUEUES_PER_DEV];
1144 struct rte_event_queue_conf qcfg;
1145 struct rte_event_port_conf pcfg;
1146 struct rte_event_dev_info info;
1147 struct rte_event ev;
1148 uint8_t q, re;
1149 int rc;
1150
1151 rte_event_dev_info_get(TEST_DEV_ID, &info);
1152
1153 if (info.max_profiles_per_port <= 1)
1154 return TEST_SKIPPED;
1155
1156 if (info.max_event_queues <= 1)
1157 return TEST_SKIPPED;
1158
1159 rc = rte_event_port_default_conf_get(TEST_DEV_ID, 0, &pcfg);
1160 TEST_ASSERT_SUCCESS(rc, "Failed to get port0 default config");
1161 rc = rte_event_port_setup(TEST_DEV_ID, 0, &pcfg);
1162 TEST_ASSERT_SUCCESS(rc, "Failed to setup port0");
1163
1164 rc = rte_event_queue_default_conf_get(TEST_DEV_ID, 0, &qcfg);
1165 TEST_ASSERT_SUCCESS(rc, "Failed to get queue0 default config");
1166 rc = rte_event_queue_setup(TEST_DEV_ID, 0, &qcfg);
1167 TEST_ASSERT_SUCCESS(rc, "Failed to setup queue0");
1168
1169 q = 0;
1170 rc = rte_event_port_profile_links_set(TEST_DEV_ID, 0, &q, NULL, 1, 0);
1171 TEST_ASSERT(rc == 1, "Failed to link queue 0 to port 0 with profile 0");
1172 q = 1;
1173 rc = rte_event_port_profile_links_set(TEST_DEV_ID, 0, &q, NULL, 1, 1);
1174 TEST_ASSERT(rc == 1, "Failed to link queue 1 to port 0 with profile 1");
1175
1176 rc = rte_event_port_profile_links_get(TEST_DEV_ID, 0, queues, priorities, 0);
1177 TEST_ASSERT(rc == 1, "Failed to links");
1178 TEST_ASSERT(queues[0] == 0, "Invalid queue found in link");
1179
1180 rc = rte_event_port_profile_links_get(TEST_DEV_ID, 0, queues, priorities, 1);
1181 TEST_ASSERT(rc == 1, "Failed to links");
1182 TEST_ASSERT(queues[0] == 1, "Invalid queue found in link");
1183
1184 rc = rte_event_dev_start(TEST_DEV_ID);
1185 TEST_ASSERT_SUCCESS(rc, "Failed to start event device");
1186
1187 ev.event_type = RTE_EVENT_TYPE_CPU;
1188 ev.queue_id = 0;
1189 ev.op = RTE_EVENT_OP_NEW;
1190 ev.flow_id = 0;
1191 ev.u64 = 0xBADF00D0;
1192 ev.sched_type = RTE_SCHED_TYPE_PARALLEL;
1193 rc = rte_event_enqueue_burst(TEST_DEV_ID, 0, &ev, 1);
1194 TEST_ASSERT(rc == 1, "Failed to enqueue event");
1195 ev.queue_id = 1;

Callers

nothing calls this directly

Tested by

no test coverage detected