1 /* SPDX-License-Identifier: BSD-3-Clause
5 #ifndef __RTE_PMD_DPAA2_QDMA_H__
6 #define __RTE_PMD_DPAA2_QDMA_H__
11 * NXP dpaa2 QDMA specific structures.
15 /** Determines the mode of operation */
18 * Allocate a H/W queue per VQ i.e. Exclusive hardware queue for a VQ.
19 * This mode will have best performance.
23 * A VQ shall not have an exclusive associated H/W queue.
24 * Rather a H/W Queue will be shared by multiple Virtual Queues.
25 * This mode will have intermediate data structures to support
26 * multi VQ to PQ mappings thus having some performance implications.
27 * Note: Even in this mode there is an option to allocate a H/W
28 * queue for a VQ. Please see 'RTE_QDMA_VQ_EXCLUSIVE_PQ' flag.
34 * If user has configued a Virtual Queue mode, but for some particular VQ
35 * user needs an exclusive H/W queue associated (for better performance
36 * on that particular VQ), then user can pass this flag while creating the
37 * Virtual Queue. A H/W queue will be allocated corresponding to
38 * VQ which uses this flag.
40 #define RTE_QDMA_VQ_EXCLUSIVE_PQ (1ULL)
42 /** States if the source addresses is physical. */
43 #define RTE_QDMA_JOB_SRC_PHY (1ULL)
45 /** States if the destination addresses is physical. */
46 #define RTE_QDMA_JOB_DEST_PHY (1ULL << 1)
48 /** Provides QDMA device attributes */
49 struct rte_qdma_attr {
50 /** total number of hw QDMA queues present */
51 uint16_t num_hw_queues;
54 /** QDMA device configuration structure */
55 struct rte_qdma_config {
56 /** Number of maximum hw queues to allocate per core. */
57 uint16_t max_hw_queues_per_core;
58 /** Maximum number of VQ's to be used. */
60 /** mode of operation - physical(h/w) or virtual */
63 * User provides this as input to the driver as a size of the FLE pool.
64 * FLE's (and corresponding source/destination descriptors) are
65 * allocated by the driver at enqueue time to store src/dest and
66 * other data and are freed at the dequeue time. This determines the
67 * maximum number of inflight jobs on the QDMA device. This should
73 /** Provides QDMA device statistics */
74 struct rte_qdma_vq_stats {
75 /** States if this vq has exclusively associated hw queue */
76 uint8_t exclusive_hw_queue;
77 /** Associated lcore id */
79 /* Total number of enqueues on this VQ */
80 uint64_t num_enqueues;
81 /* Total number of dequeues from this VQ */
82 uint64_t num_dequeues;
83 /* total number of pending jobs in this VQ */
84 uint64_t num_pending_jobs;
87 /** Determines a QDMA job */
89 /** Source Address from where DMA is (to be) performed */
91 /** Destination Address where DMA is (to be) done */
93 /** Length of the DMA operation in bytes. */
95 /** See RTE_QDMA_JOB_ flags */
98 * User can specify a context which will be maintained
99 * on the dequeue operation.
103 * Status of the transaction.
104 * This is filled in the dequeue operation by the driver.
110 * Initialize the QDMA device.
116 int __rte_experimental
120 * Get the QDMA attributes.
123 * QDMA attributes providing total number of hw queues etc.
125 void __rte_experimental
126 rte_qdma_attr_get(struct rte_qdma_attr *qdma_attr);
129 * Reset the QDMA device. This API will completely reset the QDMA
130 * device, bringing it to original state as if only rte_qdma_init() API
137 int __rte_experimental
138 rte_qdma_reset(void);
141 * Configure the QDMA device.
147 int __rte_experimental
148 rte_qdma_configure(struct rte_qdma_config *qdma_config);
151 * Start the QDMA device.
157 int __rte_experimental
158 rte_qdma_start(void);
161 * Create a Virtual Queue on a particular lcore id.
162 * This API can be called from any thread/core. User can create/destroy
166 * LCORE ID on which this particular queue would be associated with.
168 * RTE_QDMA_VQ_ flags. See macro definitions.
171 * - >= 0: Virtual queue ID.
174 int __rte_experimental
175 rte_qdma_vq_create(uint32_t lcore_id, uint32_t flags);
178 * Enqueue multiple jobs to a Virtual Queue.
179 * If the enqueue is successful, the H/W will perform DMA operations
180 * on the basis of the QDMA jobs provided.
185 * List of QDMA Jobs containing relevant information related to DMA.
187 * Number of QDMA jobs provided by the user.
190 * - >=0: Number of jobs successfully submitted
193 int __rte_experimental
194 rte_qdma_vq_enqueue_multi(uint16_t vq_id,
195 struct rte_qdma_job **job,
199 * Enqueue a single job to a Virtual Queue.
200 * If the enqueue is successful, the H/W will perform DMA operations
201 * on the basis of the QDMA job provided.
206 * A QDMA Job containing relevant information related to DMA.
209 * - >=0: Number of jobs successfully submitted
212 int __rte_experimental
213 rte_qdma_vq_enqueue(uint16_t vq_id,
214 struct rte_qdma_job *job);
217 * Dequeue multiple completed jobs from a Virtual Queue.
218 * Provides the list of completed jobs capped by nb_jobs.
223 * List of QDMA Jobs returned from the API.
225 * Number of QDMA jobs requested for dequeue by the user.
228 * Number of jobs actually dequeued.
230 int __rte_experimental
231 rte_qdma_vq_dequeue_multi(uint16_t vq_id,
232 struct rte_qdma_job **job,
236 * Dequeue a single completed jobs from a Virtual Queue.
242 * - A completed job or NULL if no job is there.
244 struct rte_qdma_job * __rte_experimental
245 rte_qdma_vq_dequeue(uint16_t vq_id);
248 * Get a Virtual Queue statistics.
253 * VQ statistics structure which will be filled in by the driver.
255 void __rte_experimental
256 rte_qdma_vq_stats(uint16_t vq_id,
257 struct rte_qdma_vq_stats *vq_stats);
260 * Destroy the Virtual Queue specified by vq_id.
261 * This API can be called from any thread/core. User can create/destroy
265 * Virtual Queue ID which needs to be deinialized.
271 int __rte_experimental
272 rte_qdma_vq_destroy(uint16_t vq_id);
277 void __rte_experimental
281 * Destroy the QDMA device.
283 void __rte_experimental
284 rte_qdma_destroy(void);
286 #endif /* __RTE_PMD_DPAA2_QDMA_H__*/