raw/dpaa2_qdma: introduce the DPAA2 QDMA driver
[dpdk.git] / drivers / raw / dpaa2_qdma / dpaa2_qdma.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright 2018 NXP
3  */
4
5 #ifndef __DPAA2_QDMA_H__
6 #define __DPAA2_QDMA_H__
7
8 /**
9  * Represents a QDMA device.
10  * A single QDMA device exists which is combination of multiple DPDMAI rawdev's.
11  */
12 struct qdma_device {
13         /** total number of hw queues. */
14         uint16_t num_hw_queues;
15         /**
16          * Maximum number of hw queues to be alocated per core.
17          * This is limited by MAX_HW_QUEUE_PER_CORE
18          */
19         uint16_t max_hw_queues_per_core;
20         /** Maximum number of VQ's */
21         uint16_t max_vqs;
22         /** mode of operation - physical(h/w) or virtual */
23         uint8_t mode;
24         /** Device state - started or stopped */
25         uint8_t state;
26         /** FLE pool for the device */
27         struct rte_mempool *fle_pool;
28         /** FLE pool size */
29         int fle_pool_count;
30         /** A lock to QDMA device whenever required */
31         rte_spinlock_t lock;
32 };
33
34 /** Represents a QDMA H/W queue */
35 struct qdma_hw_queue {
36         /** Pointer to Next instance */
37         TAILQ_ENTRY(qdma_hw_queue) next;
38         /** DPDMAI device to communicate with HW */
39         struct dpaa2_dpdmai_dev *dpdmai_dev;
40         /** queue ID to communicate with HW */
41         uint16_t queue_id;
42         /** Associated lcore id */
43         uint32_t lcore_id;
44         /** Number of users of this hw queue */
45         uint32_t num_users;
46 };
47
48 /** Represents a DPDMAI raw device */
49 struct dpaa2_dpdmai_dev {
50         /** Pointer to Next device instance */
51         TAILQ_ENTRY(dpaa2_qdma_device) next;
52         /** handle to DPDMAI object */
53         struct fsl_mc_io dpdmai;
54         /** HW ID for DPDMAI object */
55         uint32_t dpdmai_id;
56         /** Tocken of this device */
57         uint16_t token;
58         /** Number of queue in this DPDMAI device */
59         uint8_t num_queues;
60         /** RX queues */
61         struct dpaa2_queue rx_queue[DPDMAI_PRIO_NUM];
62         /** TX queues */
63         struct dpaa2_queue tx_queue[DPDMAI_PRIO_NUM];
64 };
65
66 #endif /* __DPAA2_QDMA_H__ */