xref: /dpdk/drivers/event/dpaa2/dpaa2_eventdev.h (revision 2518704288342eb855a9e43dc3abd41ba1b9c98f)
1c6b57157SStephen Hemminger /* SPDX-License-Identifier: BSD-3-Clause
2131a75b6SHemant Agrawal  * Copyright 2017 NXP
38cbe85b6SNipun Gupta  */
48cbe85b6SNipun Gupta 
58cbe85b6SNipun Gupta #ifndef __DPAA2_EVENTDEV_H__
68cbe85b6SNipun Gupta #define __DPAA2_EVENTDEV_H__
78cbe85b6SNipun Gupta 
8*25187042SBruce Richardson #include <eventdev_pmd.h>
9*25187042SBruce Richardson #include <eventdev_pmd_vdev.h>
105c2b5b72SNipun Gupta #include <rte_atomic.h>
115c2b5b72SNipun Gupta #include <mc/fsl_dpcon.h>
125c2b5b72SNipun Gupta #include <mc/fsl_mc_sys.h>
135c2b5b72SNipun Gupta 
148cbe85b6SNipun Gupta #define EVENTDEV_NAME_DPAA2_PMD		event_dpaa2
158cbe85b6SNipun Gupta 
168a5d7a8eSNipun Gupta #define DPAA2_EVENT_DEFAULT_DPCI_PRIO 0
178a5d7a8eSNipun Gupta 
188a5d7a8eSNipun Gupta #define DPAA2_EVENT_MAX_QUEUES			16
190ce3ce7cSNipun Gupta #define DPAA2_EVENT_MIN_DEQUEUE_TIMEOUT		1
200ce3ce7cSNipun Gupta #define DPAA2_EVENT_MAX_DEQUEUE_TIMEOUT		(UINT32_MAX - 1)
215d024f0fSHemant Agrawal #define DPAA2_EVENT_PORT_DEQUEUE_TIMEOUT_NS	100UL
220ce3ce7cSNipun Gupta #define DPAA2_EVENT_MAX_QUEUE_FLOWS		2048
230ce3ce7cSNipun Gupta #define DPAA2_EVENT_MAX_QUEUE_PRIORITY_LEVELS	8
240ce3ce7cSNipun Gupta #define DPAA2_EVENT_MAX_EVENT_PRIORITY_LEVELS	0
250ce3ce7cSNipun Gupta #define DPAA2_EVENT_MAX_PORT_DEQUEUE_DEPTH	8
260ce3ce7cSNipun Gupta #define DPAA2_EVENT_MAX_PORT_ENQUEUE_DEPTH	8
270ce3ce7cSNipun Gupta #define DPAA2_EVENT_MAX_NUM_EVENTS		(INT32_MAX - 1)
280ce3ce7cSNipun Gupta 
290ce3ce7cSNipun Gupta #define DPAA2_EVENT_QUEUE_ATOMIC_FLOWS		2048
300ce3ce7cSNipun Gupta #define DPAA2_EVENT_QUEUE_ORDER_SEQUENCES	2048
318a5d7a8eSNipun Gupta 
328a5d7a8eSNipun Gupta enum {
338a5d7a8eSNipun Gupta 	DPAA2_EVENT_DPCI_PARALLEL_QUEUE,
348a5d7a8eSNipun Gupta 	DPAA2_EVENT_DPCI_ATOMIC_QUEUE,
358a5d7a8eSNipun Gupta 	DPAA2_EVENT_DPCI_MAX_QUEUES
368a5d7a8eSNipun Gupta };
378a5d7a8eSNipun Gupta 
38120843bdSNipun Gupta #define RTE_EVENT_ETH_RX_ADAPTER_DPAA2_CAP \
39120843bdSNipun Gupta 		(RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT | \
40120843bdSNipun Gupta 		RTE_EVENT_ETH_RX_ADAPTER_CAP_MULTI_EVENTQ | \
41c9d02b79SNipun Gupta 		RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID | \
42c9d02b79SNipun Gupta 		RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT)
433721c39fSAkhil Goyal 
443721c39fSAkhil Goyal /**< Crypto Rx adapter cap to return If the packet transfers from
453721c39fSAkhil Goyal  * the cryptodev to eventdev with DPAA2 devices.
463721c39fSAkhil Goyal  */
473721c39fSAkhil Goyal #define RTE_EVENT_CRYPTO_ADAPTER_DPAA2_CAP \
483721c39fSAkhil Goyal 		(RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW | \
493721c39fSAkhil Goyal 		RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_QP_EV_BIND | \
503721c39fSAkhil Goyal 		RTE_EVENT_CRYPTO_ADAPTER_CAP_SESSION_PRIVATE_DATA)
513721c39fSAkhil Goyal 
52120843bdSNipun Gupta /**< Ethernet Rx adapter cap to return If the packet transfers from
53120843bdSNipun Gupta  * the ethdev to eventdev with DPAA2 devices.
54120843bdSNipun Gupta  */
55120843bdSNipun Gupta 
5604718855SHemant Agrawal struct dpaa2_eventq {
578a5d7a8eSNipun Gupta 	/* DPcon device */
588a5d7a8eSNipun Gupta 	struct dpaa2_dpcon_dev *dpcon;
598a5d7a8eSNipun Gupta 	/* Attached DPCI device */
608a5d7a8eSNipun Gupta 	struct dpaa2_dpci_dev *dpci;
614ab57b04SHemant Agrawal 	/* Mapped event port */
624ab57b04SHemant Agrawal 	struct dpaa2_io_portal_t *event_port;
630ce3ce7cSNipun Gupta 	/* Configuration provided by the user */
640ce3ce7cSNipun Gupta 	uint32_t event_queue_cfg;
6504718855SHemant Agrawal 	uint32_t event_queue_id;
668a5d7a8eSNipun Gupta };
678a5d7a8eSNipun Gupta 
684ab57b04SHemant Agrawal struct dpaa2_port {
694ab57b04SHemant Agrawal 	struct dpaa2_eventq evq_info[DPAA2_EVENT_MAX_QUEUES];
704ab57b04SHemant Agrawal 	uint8_t num_linked_evq;
714ab57b04SHemant Agrawal 	uint8_t is_port_linked;
724ab57b04SHemant Agrawal 	uint64_t timeout_us;
734ab57b04SHemant Agrawal };
744ab57b04SHemant Agrawal 
758a5d7a8eSNipun Gupta struct dpaa2_eventdev {
7604718855SHemant Agrawal 	struct dpaa2_eventq evq_info[DPAA2_EVENT_MAX_QUEUES];
770ce3ce7cSNipun Gupta 	uint32_t dequeue_timeout_ns;
788a5d7a8eSNipun Gupta 	uint8_t max_event_queues;
790ce3ce7cSNipun Gupta 	uint8_t nb_event_queues;
800ce3ce7cSNipun Gupta 	uint8_t nb_event_ports;
810ce3ce7cSNipun Gupta 	uint8_t resvd_1;
820ce3ce7cSNipun Gupta 	uint32_t nb_event_queue_flows;
830ce3ce7cSNipun Gupta 	uint32_t nb_event_port_dequeue_depth;
840ce3ce7cSNipun Gupta 	uint32_t nb_event_port_enqueue_depth;
850ce3ce7cSNipun Gupta 	uint32_t event_dev_cfg;
868a5d7a8eSNipun Gupta };
878a5d7a8eSNipun Gupta 
885c2b5b72SNipun Gupta struct dpaa2_dpcon_dev *rte_dpaa2_alloc_dpcon_dev(void);
895c2b5b72SNipun Gupta void rte_dpaa2_free_dpcon_dev(struct dpaa2_dpcon_dev *dpcon);
905c2b5b72SNipun Gupta 
91653242c3SHemant Agrawal int test_eventdev_dpaa2(void);
92653242c3SHemant Agrawal 
938cbe85b6SNipun Gupta #endif /* __DPAA2_EVENTDEV_H__ */
94