2a4f1042156054b8a1fb910446a611d4f3679bbf
[dpdk.git] / drivers / event / dsw / dsw_evdev.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2018 Ericsson AB
3  */
4
5 #ifndef _DSW_EVDEV_H_
6 #define _DSW_EVDEV_H_
7
8 #include <rte_event_ring.h>
9 #include <rte_eventdev.h>
10
11 #define DSW_PMD_NAME RTE_STR(event_dsw)
12
13 /* Code changes are required to allow more ports. */
14 #define DSW_MAX_PORTS (64)
15 #define DSW_MAX_PORT_DEQUEUE_DEPTH (128)
16 #define DSW_MAX_PORT_ENQUEUE_DEPTH (128)
17
18 #define DSW_MAX_QUEUES (16)
19
20 #define DSW_MAX_EVENTS (16384)
21
22 /* Code changes are required to allow more flows than 32k. */
23 #define DSW_MAX_FLOWS_BITS (15)
24 #define DSW_MAX_FLOWS (1<<(DSW_MAX_FLOWS_BITS))
25 #define DSW_MAX_FLOWS_MASK (DSW_MAX_FLOWS-1)
26
27 /* The rings are dimensioned so that all in-flight events can reside
28  * on any one of the port rings, to avoid the trouble of having to
29  * care about the case where there's no room on the destination port's
30  * input ring.
31  */
32 #define DSW_IN_RING_SIZE (DSW_MAX_EVENTS)
33
34 struct dsw_port {
35         uint16_t id;
36
37         /* Keeping a pointer here to avoid container_of() calls, which
38          * are expensive since they are very frequent and will result
39          * in an integer multiplication (since the port id is an index
40          * into the dsw_evdev port array).
41          */
42         struct dsw_evdev *dsw;
43
44         uint16_t dequeue_depth;
45         uint16_t enqueue_depth;
46
47         int32_t new_event_threshold;
48
49         struct rte_event_ring *in_ring __rte_cache_aligned;
50 } __rte_cache_aligned;
51
52 struct dsw_queue {
53         uint8_t schedule_type;
54         uint16_t num_serving_ports;
55 };
56
57 struct dsw_evdev {
58         struct rte_eventdev_data *data;
59
60         struct dsw_port ports[DSW_MAX_PORTS];
61         uint16_t num_ports;
62         struct dsw_queue queues[DSW_MAX_QUEUES];
63         uint8_t num_queues;
64 };
65
66 static inline struct dsw_evdev *
67 dsw_pmd_priv(const struct rte_eventdev *eventdev)
68 {
69         return eventdev->data->dev_private;
70 }
71
72 #endif