1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright 2018-2019 NXP
5 #ifndef __DPAA2_QDMA_H__
6 #define __DPAA2_QDMA_H__
11 #define DPAA2_QDMA_MAX_FLE 3
12 #define DPAA2_QDMA_MAX_SDD 2
14 #define DPAA2_DPDMAI_MAX_QUEUES 8
16 /** FLE pool size: 3 Frame list + 2 source/destination descriptor */
17 #define QDMA_FLE_POOL_SIZE (sizeof(struct rte_qdma_job *) + \
18 sizeof(struct qbman_fle) * DPAA2_QDMA_MAX_FLE + \
19 sizeof(struct qdma_sdd) * DPAA2_QDMA_MAX_SDD)
20 /** FLE pool cache size */
21 #define QDMA_FLE_CACHE_SIZE(_num) (_num/(RTE_MAX_LCORE * 2))
23 /** Notification by FQD_CTX[fqid] */
24 #define QDMA_SER_CTX (1 << 8)
25 #define DPAA2_RBP_MEM_RW 0x0
27 * Source descriptor command read transaction type for RBP=0:
28 * coherent copy of cacheable memory
30 #define DPAA2_COHERENT_NO_ALLOCATE_CACHE 0xb
31 #define DPAA2_LX2_COHERENT_NO_ALLOCATE_CACHE 0x7
33 * Destination descriptor command write transaction type for RBP=0:
34 * coherent copy of cacheable memory
36 #define DPAA2_COHERENT_ALLOCATE_CACHE 0x6
37 #define DPAA2_LX2_COHERENT_ALLOCATE_CACHE 0xb
39 /** Maximum possible H/W Queues on each core */
40 #define MAX_HW_QUEUE_PER_CORE 64
42 #define QDMA_RBP_UPPER_ADDRESS_MASK (0xfff0000000000)
44 * Represents a QDMA device.
45 * A single QDMA device exists which is combination of multiple DPDMAI rawdev's.
48 /** total number of hw queues. */
49 uint16_t num_hw_queues;
51 * Maximum number of hw queues to be alocated per core.
52 * This is limited by MAX_HW_QUEUE_PER_CORE
54 uint16_t max_hw_queues_per_core;
55 /** Maximum number of VQ's */
57 /** mode of operation - physical(h/w) or virtual */
59 /** Device state - started or stopped */
61 /** FLE pool for the device */
62 struct rte_mempool *fle_pool;
65 /** A lock to QDMA device whenever required */
69 /** Represents a QDMA H/W queue */
70 struct qdma_hw_queue {
71 /** Pointer to Next instance */
72 TAILQ_ENTRY(qdma_hw_queue) next;
73 /** DPDMAI device to communicate with HW */
74 struct dpaa2_dpdmai_dev *dpdmai_dev;
75 /** queue ID to communicate with HW */
77 /** Associated lcore id */
79 /** Number of users of this hw queue */
83 /** Represents a QDMA virtual queue */
84 struct qdma_virt_queue {
85 /** Status ring of the virtual queue */
86 struct rte_ring *status_ring;
87 /** Associated hw queue */
88 struct qdma_hw_queue *hw_queue;
90 struct rte_qdma_rbp rbp;
91 /** Associated lcore id */
93 /** States if this vq is in use or not */
95 /** States if this vq has exclusively associated hw queue */
96 uint8_t exclusive_hw_queue;
97 /* Total number of enqueues on this VQ */
98 uint64_t num_enqueues;
99 /* Total number of dequeues from this VQ */
100 uint64_t num_dequeues;
103 /** Represents a QDMA per core hw queues allocation in virtual mode */
104 struct qdma_per_core_info {
105 /** list for allocated hw queues */
106 struct qdma_hw_queue *hw_queues[MAX_HW_QUEUE_PER_CORE];
107 /* Number of hw queues allocated for this core */
108 uint16_t num_hw_queues;
111 /** Source/Destination Descriptor */
114 /** Stride configuration */
116 /** Route-by-port command */
160 /** Represents a DPDMAI raw device */
161 struct dpaa2_dpdmai_dev {
162 /** Pointer to Next device instance */
163 TAILQ_ENTRY(dpaa2_qdma_device) next;
164 /** handle to DPDMAI object */
165 struct fsl_mc_io dpdmai;
166 /** HW ID for DPDMAI object */
168 /** Tocken of this device */
170 /** Number of queue in this DPDMAI device */
173 struct dpaa2_queue rx_queue[DPAA2_DPDMAI_MAX_QUEUES];
175 struct dpaa2_queue tx_queue[DPAA2_DPDMAI_MAX_QUEUES];
178 #endif /* __DPAA2_QDMA_H__ */