6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
16 * * Neither the name of NXP nor the names of its
17 * contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 #ifndef __DPAA2_EVENTDEV_H__
34 #define __DPAA2_EVENTDEV_H__
36 #include <rte_eventdev_pmd.h>
37 #include <rte_eventdev_pmd_vdev.h>
38 #include <rte_atomic.h>
39 #include <mc/fsl_dpcon.h>
40 #include <mc/fsl_mc_sys.h>
42 #define EVENTDEV_NAME_DPAA2_PMD event_dpaa2
44 #ifdef RTE_LIBRTE_PMD_DPAA2_EVENTDEV_DEBUG
45 #define PMD_DRV_LOG(level, fmt, args...) \
46 RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
47 #define PMD_DRV_FUNC_TRACE() PMD_DRV_LOG(DEBUG, ">>")
49 #define PMD_DRV_LOG(level, fmt, args...) do { } while (0)
50 #define PMD_DRV_FUNC_TRACE() do { } while (0)
53 #define PMD_DRV_ERR(fmt, args...) \
54 RTE_LOG(ERR, PMD, "%s(): " fmt "\n", __func__, ## args)
56 #define DPAA2_EVENT_DEFAULT_DPCI_PRIO 0
58 #define DPAA2_EVENT_MAX_QUEUES 16
59 #define DPAA2_EVENT_MIN_DEQUEUE_TIMEOUT 1
60 #define DPAA2_EVENT_MAX_DEQUEUE_TIMEOUT (UINT32_MAX - 1)
61 #define DPAA2_EVENT_MAX_QUEUE_FLOWS 2048
62 #define DPAA2_EVENT_MAX_QUEUE_PRIORITY_LEVELS 8
63 #define DPAA2_EVENT_MAX_EVENT_PRIORITY_LEVELS 0
64 #define DPAA2_EVENT_MAX_PORT_DEQUEUE_DEPTH 8
65 #define DPAA2_EVENT_MAX_PORT_ENQUEUE_DEPTH 8
66 #define DPAA2_EVENT_MAX_NUM_EVENTS (INT32_MAX - 1)
68 #define DPAA2_EVENT_QUEUE_ATOMIC_FLOWS 2048
69 #define DPAA2_EVENT_QUEUE_ORDER_SEQUENCES 2048
72 DPAA2_EVENT_DPCI_PARALLEL_QUEUE,
73 DPAA2_EVENT_DPCI_ATOMIC_QUEUE,
74 DPAA2_EVENT_DPCI_MAX_QUEUES
77 #define RTE_EVENT_ETH_RX_ADAPTER_DPAA2_CAP \
78 (RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT | \
79 RTE_EVENT_ETH_RX_ADAPTER_CAP_MULTI_EVENTQ | \
80 RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID)
81 /**< Ethernet Rx adapter cap to return If the packet transfers from
82 * the ethdev to eventdev with DPAA2 devices.
85 struct dpaa2_dpcon_dev {
86 TAILQ_ENTRY(dpaa2_dpcon_dev) next;
87 struct fsl_mc_io dpcon;
89 rte_atomic16_t in_use;
92 uint8_t num_priorities;
93 uint8_t channel_index;
98 struct dpaa2_dpcon_dev *dpcon;
99 /* Attached DPCI device */
100 struct dpaa2_dpci_dev *dpci;
101 /* Configuration provided by the user */
102 uint32_t event_queue_cfg;
106 struct dpaa2_eventdev {
107 struct evq_info_t evq_info[DPAA2_EVENT_MAX_QUEUES];
108 uint32_t dequeue_timeout_ns;
109 uint8_t max_event_queues;
110 uint8_t nb_event_queues;
111 uint8_t nb_event_ports;
113 uint32_t nb_event_queue_flows;
114 uint32_t nb_event_port_dequeue_depth;
115 uint32_t nb_event_port_enqueue_depth;
116 uint32_t event_dev_cfg;
119 struct dpaa2_dpcon_dev *rte_dpaa2_alloc_dpcon_dev(void);
120 void rte_dpaa2_free_dpcon_dev(struct dpaa2_dpcon_dev *dpcon);
122 #endif /* __DPAA2_EVENTDEV_H__ */