1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2017 Cavium, Inc
8 #include <rte_common.h>
10 #include <rte_eventdev.h>
11 #include <rte_service.h>
13 #define CLNRM "\x1b[0m"
14 #define CLRED "\x1b[31m"
15 #define CLGRN "\x1b[32m"
16 #define CLYEL "\x1b[33m"
18 #define evt_err(fmt, args...) \
19 fprintf(stderr, CLRED"error: %s() "fmt CLNRM "\n", __func__, ## args)
21 #define evt_info(fmt, args...) \
22 fprintf(stdout, CLYEL""fmt CLNRM "\n", ## args)
24 #define EVT_STR_FMT 20
26 #define evt_dump(str, fmt, val...) \
27 printf("\t%-*s : "fmt"\n", EVT_STR_FMT, str, ## val)
29 #define evt_dump_begin(str) printf("\t%-*s : {", EVT_STR_FMT, str)
31 #define evt_dump_end printf("\b}\n")
33 #define EVT_MAX_STAGES 64
34 #define EVT_MAX_PORTS 256
35 #define EVT_MAX_QUEUES 256
38 evt_has_distributed_sched(uint8_t dev_id)
40 struct rte_event_dev_info dev_info;
42 rte_event_dev_info_get(dev_id, &dev_info);
43 return (dev_info.event_dev_cap & RTE_EVENT_DEV_CAP_DISTRIBUTED_SCHED) ?
48 evt_has_burst_mode(uint8_t dev_id)
50 struct rte_event_dev_info dev_info;
52 rte_event_dev_info_get(dev_id, &dev_info);
53 return (dev_info.event_dev_cap & RTE_EVENT_DEV_CAP_BURST_MODE) ?
59 evt_has_all_types_queue(uint8_t dev_id)
61 struct rte_event_dev_info dev_info;
63 rte_event_dev_info_get(dev_id, &dev_info);
64 return (dev_info.event_dev_cap & RTE_EVENT_DEV_CAP_QUEUE_ALL_TYPES) ?
69 evt_service_setup(uint32_t service_id)
72 unsigned int lcore = 0;
73 uint32_t core_array[RTE_MAX_LCORE];
75 uint8_t min_cnt = UINT8_MAX;
77 if (!rte_service_lcore_count())
80 core_cnt = rte_service_lcore_list(core_array,
84 /* Get the core which has least number of services running. */
86 /* Reset default mapping */
87 rte_service_map_lcore_set(service_id,
88 core_array[core_cnt], 0);
89 cnt = rte_service_lcore_count_services(
90 core_array[core_cnt]);
92 lcore = core_array[core_cnt];
96 if (rte_service_map_lcore_set(service_id, lcore, 1))
102 #endif /* _EVT_COMMON_*/