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 Rx adapters supported */
20 #define EVENT_MODE_MAX_RX_ADAPTERS RTE_EVENT_MAX_DEVS
22 /* Max Rx adapter connections */
23 #define EVENT_MODE_MAX_CONNECTIONS_PER_ADAPTER 16
25 /* Max event queues supported per event device */
26 #define EVENT_MODE_MAX_EVENT_QUEUES_PER_DEV RTE_EVENT_MAX_QUEUES_PER_DEV
28 /* Max event-lcore links */
29 #define EVENT_MODE_MAX_LCORE_LINKS \
30 (EVENT_MODE_MAX_EVENT_DEVS * EVENT_MODE_MAX_EVENT_QUEUES_PER_DEV)
33 * Packet transfer mode of the application
35 enum eh_pkt_transfer_mode {
36 EH_PKT_TRANSFER_MODE_POLL = 0,
37 EH_PKT_TRANSFER_MODE_EVENT,
40 /* Event dev params */
41 struct eventdev_params {
43 uint8_t nb_eventqueue;
45 uint8_t ev_queue_mode;
49 * Event-lcore link configuration
51 struct eh_event_link_info {
53 /**< Event device ID */
54 uint8_t event_port_id;
57 /**< Event queue to be linked to the port */
59 /**< Lcore to be polling on this port */
62 /* Rx adapter connection info */
63 struct rx_adapter_connection_info {
66 int32_t ethdev_rx_qid;
70 struct rx_adapter_conf {
74 uint8_t nb_connections;
75 struct rx_adapter_connection_info
76 conn[EVENT_MODE_MAX_CONNECTIONS_PER_ADAPTER];
79 /* Eventmode conf data */
80 struct eventmode_conf {
82 /**< No of event devs */
83 struct eventdev_params eventdev_config[EVENT_MODE_MAX_EVENT_DEVS];
84 /**< Per event dev conf */
85 uint8_t nb_rx_adapter;
86 /**< No of Rx adapters */
87 struct rx_adapter_conf rx_adapter[EVENT_MODE_MAX_RX_ADAPTERS];
88 /**< Rx adapter conf */
91 struct eh_event_link_info
92 link[EVENT_MODE_MAX_LCORE_LINKS];
94 struct rte_bitmap *eth_core_mask;
95 /**< Core mask of cores to be used for software Rx and Tx */
96 uint32_t eth_portmask;
97 /**< Mask of the eth ports to be used */
101 uint64_t sched_type : 2;
102 /**< Schedule type */
103 uint64_t all_ev_queue_to_ev_port : 1;
105 * When enabled, all event queues need to be mapped to
111 /**< 64 bit field to specify extended params */
115 * Event helper configuration
118 enum eh_pkt_transfer_mode mode;
119 /**< Packet transfer mode of the application */
120 uint32_t eth_portmask;
122 * Mask of the eth ports to be used. This portmask would be
123 * checked while initializing devices using helper routines.
126 /**< Mode specific parameters */
130 * Initialize event mode devices
132 * Application can call this function to get the event devices, eth devices
133 * and eth rx & tx adapters initialized according to the default config or
134 * config populated using the command line args.
136 * Application is expected to initialize the eth devices and then the event
137 * mode helper subsystem will stop & start eth devices according to its
138 * requirement. Call to this function should be done after the eth devices
139 * are successfully initialized.
142 * Event helper configuration
148 eh_devs_init(struct eh_conf *conf);
151 * Release event mode devices
153 * Application can call this function to release event devices,
154 * eth rx & tx adapters according to the config.
156 * Call to this function should be done before application stops
157 * and closes eth devices. This function will not close and stop
161 * Event helper configuration
167 eh_devs_uninit(struct eh_conf *conf);
169 #endif /* _EVENT_HELPER_H_ */