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

Function test_sw_eventdev

dpdk/drivers/event/sw/sw_evdev_selftest.c:3307–3554  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3305static struct rte_mempool *eventdev_func_mempool;
3306
3307int
3308test_sw_eventdev(void)
3309{
3310 struct test *t;
3311 int ret;
3312
3313 t = malloc(sizeof(struct test));
3314 if (t == NULL)
3315 return -1;
3316 /* manually initialize the op, older gcc's complain on static
3317 * initialization of struct elements that are a bitfield.
3318 */
3319 release_ev.op = RTE_EVENT_OP_RELEASE;
3320
3321 const char *eventdev_name = "event_sw";
3322 evdev = rte_event_dev_get_dev_id(eventdev_name);
3323 if (evdev < 0) {
3324 printf("%d: Eventdev %s not found - creating.\n",
3325 __LINE__, eventdev_name);
3326 if (rte_vdev_init(eventdev_name, NULL) < 0) {
3327 printf("Error creating eventdev\n");
3328 goto test_fail;
3329 }
3330 evdev = rte_event_dev_get_dev_id(eventdev_name);
3331 if (evdev < 0) {
3332 printf("Error finding newly created eventdev\n");
3333 goto test_fail;
3334 }
3335 }
3336
3337 if (rte_event_dev_service_id_get(evdev, &t->service_id) < 0) {
3338 printf("Failed to get service ID for software event dev\n");
3339 goto test_fail;
3340 }
3341
3342 rte_service_runstate_set(t->service_id, 1);
3343 rte_service_set_runstate_mapped_check(t->service_id, 0);
3344
3345 /* Only create mbuf pool once, reuse for each test run */
3346 if (!eventdev_func_mempool) {
3347 eventdev_func_mempool = rte_pktmbuf_pool_create(
3348 "EVENTDEV_SW_SA_MBUF_POOL",
3349 (1<<12), /* 4k buffers */
3350 32 /*MBUF_CACHE_SIZE*/,
3351 0,
3352 512, /* use very small mbufs */
3353 rte_socket_id());
3354 if (!eventdev_func_mempool) {
3355 printf("ERROR creating mempool\n");
3356 goto test_fail;
3357 }
3358 }
3359 t->mbuf_pool = eventdev_func_mempool;
3360 printf("*** Running Single Directed Packet test...\n");
3361 ret = test_single_directed_packet(t);
3362 if (ret != 0) {
3363 printf("ERROR - Single Directed Packet test FAILED.\n");
3364 goto test_fail;

Callers

nothing calls this directly

Calls 15

mallocFunction · 0.85
rte_event_dev_get_dev_idFunction · 0.85
rte_vdev_initFunction · 0.85
rte_service_runstate_setFunction · 0.85
rte_pktmbuf_pool_createFunction · 0.85
rte_socket_idFunction · 0.85
single_packetFunction · 0.85
unordered_basicFunction · 0.85

Tested by

no test coverage detected