crypto/mlx5: add maximum segments configuration
[dpdk.git] / examples / l3fwd / l3fwd_event.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(C) 2019 Marvell International Ltd.
3  */
4
5 #ifndef __L3FWD_EVENTDEV_H__
6 #define __L3FWD_EVENTDEV_H__
7
8 #include <rte_common.h>
9 #include <rte_eventdev.h>
10 #include <rte_event_eth_rx_adapter.h>
11 #include <rte_event_eth_tx_adapter.h>
12 #include <rte_service.h>
13 #include <rte_spinlock.h>
14
15 #include "l3fwd.h"
16
17 #define L3FWD_EVENT_SINGLE     0x1
18 #define L3FWD_EVENT_BURST      0x2
19 #define L3FWD_EVENT_TX_DIRECT  0x4
20 #define L3FWD_EVENT_TX_ENQ     0x8
21
22 typedef uint32_t (*event_device_setup_cb)(void);
23 typedef void (*event_queue_setup_cb)(uint32_t event_queue_cfg);
24 typedef void (*event_port_setup_cb)(void);
25 typedef void (*adapter_setup_cb)(void);
26 typedef int (*event_loop_cb)(void *);
27
28 struct l3fwd_event_queues {
29         uint8_t *event_q_id;
30         uint8_t nb_queues;
31 };
32
33 struct l3fwd_event_ports {
34         uint8_t *event_p_id;
35         uint8_t nb_ports;
36         rte_spinlock_t lock;
37 };
38
39 struct l3fwd_event_rx_adptr {
40         uint32_t service_id;
41         uint8_t nb_rx_adptr;
42         uint8_t *rx_adptr;
43 };
44
45 struct l3fwd_event_tx_adptr {
46         uint32_t service_id;
47         uint8_t nb_tx_adptr;
48         uint8_t *tx_adptr;
49 };
50
51 struct l3fwd_event_setup_ops {
52         event_device_setup_cb event_device_setup;
53         event_queue_setup_cb event_queue_setup;
54         event_port_setup_cb event_port_setup;
55         adapter_setup_cb adapter_setup;
56         event_loop_cb lpm_event_loop;
57         event_loop_cb em_event_loop;
58         event_loop_cb fib_event_loop;
59 };
60
61 struct l3fwd_event_resources {
62         struct rte_event_port_conf def_p_conf;
63         struct l3fwd_event_rx_adptr rx_adptr;
64         struct l3fwd_event_tx_adptr tx_adptr;
65         uint8_t disable_implicit_release;
66         struct l3fwd_event_setup_ops ops;
67         struct rte_mempool * (*pkt_pool)[NB_SOCKETS];
68         struct l3fwd_event_queues evq;
69         struct l3fwd_event_ports evp;
70         uint32_t port_mask;
71         uint8_t per_port_pool;
72         uint8_t event_d_id;
73         uint8_t sched_type;
74         uint8_t tx_mode_q;
75         uint8_t deq_depth;
76         uint8_t has_burst;
77         uint8_t enabled;
78         uint8_t eth_rx_queues;
79 };
80
81 struct l3fwd_event_resources *l3fwd_get_eventdev_rsrc(void);
82 void l3fwd_event_resource_setup(struct rte_eth_conf *port_conf);
83 int l3fwd_get_free_event_port(struct l3fwd_event_resources *eventdev_rsrc);
84 void l3fwd_event_set_generic_ops(struct l3fwd_event_setup_ops *ops);
85 void l3fwd_event_set_internal_port_ops(struct l3fwd_event_setup_ops *ops);
86
87 #endif /* __L3FWD_EVENTDEV_H__ */