1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright (C) 2020 Marvell International Ltd.
4 #ifndef _EVENT_HELPER_H_
5 #define _EVENT_HELPER_H_
9 #define RTE_LOGTYPE_EH RTE_LOGTYPE_USER4
11 #define EH_LOG_ERR(...) \
13 RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \
14 __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__ ,)))
16 /* Max event devices supported */
17 #define EVENT_MODE_MAX_EVENT_DEVS RTE_EVENT_MAX_DEVS
19 /* Max event queues supported per event device */
20 #define EVENT_MODE_MAX_EVENT_QUEUES_PER_DEV RTE_EVENT_MAX_QUEUES_PER_DEV
22 /* Max event-lcore links */
23 #define EVENT_MODE_MAX_LCORE_LINKS \
24 (EVENT_MODE_MAX_EVENT_DEVS * EVENT_MODE_MAX_EVENT_QUEUES_PER_DEV)
27 * Packet transfer mode of the application
29 enum eh_pkt_transfer_mode {
30 EH_PKT_TRANSFER_MODE_POLL = 0,
31 EH_PKT_TRANSFER_MODE_EVENT,
34 /* Event dev params */
35 struct eventdev_params {
37 uint8_t nb_eventqueue;
39 uint8_t ev_queue_mode;
43 * Event-lcore link configuration
45 struct eh_event_link_info {
47 /**< Event device ID */
48 uint8_t event_port_id;
51 /**< Event queue to be linked to the port */
53 /**< Lcore to be polling on this port */
56 /* Eventmode conf data */
57 struct eventmode_conf {
59 /**< No of event devs */
60 struct eventdev_params eventdev_config[EVENT_MODE_MAX_EVENT_DEVS];
61 /**< Per event dev conf */
64 struct eh_event_link_info
65 link[EVENT_MODE_MAX_LCORE_LINKS];
67 struct rte_bitmap *eth_core_mask;
68 /**< Core mask of cores to be used for software Rx and Tx */
72 uint64_t sched_type : 2;
74 uint64_t all_ev_queue_to_ev_port : 1;
76 * When enabled, all event queues need to be mapped to
82 /**< 64 bit field to specify extended params */
86 * Event helper configuration
89 enum eh_pkt_transfer_mode mode;
90 /**< Packet transfer mode of the application */
91 uint32_t eth_portmask;
93 * Mask of the eth ports to be used. This portmask would be
94 * checked while initializing devices using helper routines.
97 /**< Mode specific parameters */
101 * Initialize event mode devices
103 * Application can call this function to get the event devices, eth devices
104 * and eth rx & tx adapters initialized according to the default config or
105 * config populated using the command line args.
107 * Application is expected to initialize the eth devices and then the event
108 * mode helper subsystem will stop & start eth devices according to its
109 * requirement. Call to this function should be done after the eth devices
110 * are successfully initialized.
113 * Event helper configuration
119 eh_devs_init(struct eh_conf *conf);
122 * Release event mode devices
124 * Application can call this function to release event devices,
125 * eth rx & tx adapters according to the config.
127 * Call to this function should be done before application stops
128 * and closes eth devices. This function will not close and stop
132 * Event helper configuration
138 eh_devs_uninit(struct eh_conf *conf);
140 #endif /* _EVENT_HELPER_H_ */