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

Function test_eventdev_link_get

dpdk/app/test/test_eventdev.c:1048–1136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1046}
1047
1048static int
1049test_eventdev_link_get(void)
1050{
1051 int ret, i;
1052 uint8_t queues[RTE_EVENT_MAX_QUEUES_PER_DEV];
1053 uint8_t priorities[RTE_EVENT_MAX_QUEUES_PER_DEV];
1054
1055 /* link all queues */
1056 ret = rte_event_port_link(TEST_DEV_ID, 0, NULL, NULL, 0);
1057 TEST_ASSERT(ret >= 0, "Failed to link with NULL device%d",
1058 TEST_DEV_ID);
1059
1060 uint32_t queue_count;
1061 TEST_ASSERT_SUCCESS(rte_event_dev_attr_get(TEST_DEV_ID,
1062 RTE_EVENT_DEV_ATTR_QUEUE_COUNT, &queue_count),
1063 "Queue count get failed");
1064 const int nb_queues = queue_count;
1065 for (i = 0; i < nb_queues; i++)
1066 queues[i] = i;
1067
1068 ret = rte_event_port_unlink(TEST_DEV_ID, 0, queues, nb_queues);
1069 TEST_ASSERT(ret == nb_queues, "Failed to unlink(device%d) ret=%d",
1070 TEST_DEV_ID, ret);
1071
1072 ret = rte_event_port_links_get(TEST_DEV_ID, 0, queues, priorities);
1073 TEST_ASSERT(ret == 0, "(%d)Wrong link get=%d", TEST_DEV_ID, ret);
1074
1075 /* link all queues and get the links */
1076 for (i = 0; i < nb_queues; i++) {
1077 queues[i] = i;
1078 priorities[i] = RTE_EVENT_DEV_PRIORITY_NORMAL;
1079 }
1080 ret = rte_event_port_link(TEST_DEV_ID, 0, queues, priorities,
1081 nb_queues);
1082 TEST_ASSERT(ret == nb_queues, "Failed to link(device%d) ret=%d",
1083 TEST_DEV_ID, ret);
1084 ret = rte_event_port_links_get(TEST_DEV_ID, 0, queues, priorities);
1085 TEST_ASSERT(ret == nb_queues, "(%d)Wrong link get ret=%d expected=%d",
1086 TEST_DEV_ID, ret, nb_queues);
1087 /* unlink all*/
1088 ret = rte_event_port_unlink(TEST_DEV_ID, 0, NULL, 0);
1089 TEST_ASSERT(ret == nb_queues, "Failed to unlink(device%d) ret=%d",
1090 TEST_DEV_ID, ret);
1091 /* link just one queue */
1092 queues[0] = 0;
1093 priorities[0] = RTE_EVENT_DEV_PRIORITY_NORMAL;
1094
1095 ret = rte_event_port_link(TEST_DEV_ID, 0, queues, priorities, 1);
1096 TEST_ASSERT(ret == 1, "Failed to link(device%d) ret=%d",
1097 TEST_DEV_ID, ret);
1098 ret = rte_event_port_links_get(TEST_DEV_ID, 0, queues, priorities);
1099 TEST_ASSERT(ret == 1, "(%d)Wrong link get ret=%d expected=%d",
1100 TEST_DEV_ID, ret, 1);
1101 /* unlink the queue */
1102 ret = rte_event_port_unlink(TEST_DEV_ID, 0, NULL, 0);
1103 TEST_ASSERT(ret == 1, "Failed to unlink(device%d) ret=%d",
1104 TEST_DEV_ID, ret);
1105

Callers

nothing calls this directly

Calls 4

rte_event_port_linkFunction · 0.85
rte_event_dev_attr_getFunction · 0.85
rte_event_port_unlinkFunction · 0.85
rte_event_port_links_getFunction · 0.85

Tested by

no test coverage detected