net/ena: fix build with GCC 12
[dpdk.git] / drivers / dma / dpaa2 / rte_pmd_dpaa2_qdma.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright 2021-2022 NXP
3  */
4
5 #ifndef _RTE_PMD_DPAA2_QDMA_H_
6 #define _RTE_PMD_DPAA2_QDMA_H_
7
8 /** States if the source addresses is physical. */
9 #define RTE_DPAA2_QDMA_JOB_SRC_PHY              (1ULL << 30)
10
11 /** States if the destination addresses is physical. */
12 #define RTE_DPAA2_QDMA_JOB_DEST_PHY             (1ULL << 31)
13
14 struct rte_dpaa2_qdma_rbp {
15         uint32_t use_ultrashort:1;
16         uint32_t enable:1;
17         /**
18          * dportid:
19          * 0000 PCI-Express 1
20          * 0001 PCI-Express 2
21          * 0010 PCI-Express 3
22          * 0011 PCI-Express 4
23          * 0100 PCI-Express 5
24          * 0101 PCI-Express 6
25          */
26         uint32_t dportid:4;
27         uint32_t dpfid:2;
28         uint32_t dvfid:6;
29         /*using route by port for destination */
30         uint32_t drbp:1;
31         /**
32          * sportid:
33          * 0000 PCI-Express 1
34          * 0001 PCI-Express 2
35          * 0010 PCI-Express 3
36          * 0011 PCI-Express 4
37          * 0100 PCI-Express 5
38          * 0101 PCI-Express 6
39          */
40         uint32_t sportid:4;
41         uint32_t spfid:2;
42         uint32_t svfid:6;
43         /* using route by port for source */
44         uint32_t srbp:1;
45         uint32_t rsv:4;
46 };
47
48 /** Determines a QDMA job */
49 struct rte_dpaa2_qdma_job {
50         /** Source Address from where DMA is (to be) performed */
51         uint64_t src;
52         /** Destination Address where DMA is (to be) done */
53         uint64_t dest;
54         /** Length of the DMA operation in bytes. */
55         uint32_t len;
56         /** See RTE_QDMA_JOB_ flags */
57         uint32_t flags;
58         /**
59          * Status of the transaction.
60          * This is filled in the dequeue operation by the driver.
61          * upper 8bits acc_err for route by port.
62          * lower 8bits fd error
63          */
64         uint16_t status;
65         uint16_t vq_id;
66         /**
67          * FLE pool element maintained by user, in case no qDMA response.
68          * Note: the address must be allocated from DPDK memory pool.
69          */
70         void *usr_elem;
71 };
72
73 /**
74  * @warning
75  * @b EXPERIMENTAL: this API may change without prior notice.
76  *
77  * Enable FD in Ultra Short format on a channel. This API should be
78  * called before calling 'rte_dma_vchan_setup()' API.
79  *
80  * @param dev_id
81  *   The identifier of the device.
82  * @param vchan
83  *   The identifier of virtual DMA channel.
84  */
85 __rte_experimental
86 void rte_dpaa2_qdma_vchan_fd_us_enable(int16_t dev_id, uint16_t vchan);
87
88 /**
89  * @warning
90  * @b EXPERIMENTAL: this API may change without prior notice.
91  *
92  * Enable internal SG processing on a channel. This API should be
93  * called before calling 'rte_dma_vchan_setup()' API.
94  *
95  * @param dev_id
96  *   The identifier of the device.
97  * @param vchan
98  *   The identifier of virtual DMA channel.
99  */
100 __rte_experimental
101 void rte_dpaa2_qdma_vchan_internal_sg_enable(int16_t dev_id, uint16_t vchan);
102
103 /**
104  * @warning
105  * @b EXPERIMENTAL: this API may change without prior notice.
106  *
107  * Enable Route-by-port on a channel. This API should be
108  * called before calling 'rte_dma_vchan_setup()' API.
109  *
110  * @param dev_id
111  *   The identifier of the device.
112  * @param vchan
113  *   The identifier of virtual DMA channel.
114  * @param rbp_config
115  *   Configuration for route-by-port
116  */
117 __rte_experimental
118 void rte_dpaa2_qdma_vchan_rbp_enable(int16_t dev_id, uint16_t vchan,
119                 struct rte_dpaa2_qdma_rbp *rbp_config);
120
121 /**
122  * @warning
123  * @b EXPERIMENTAL: this API may change without prior notice.
124  *
125  * Enqueue a copy operation onto the virtual DMA channel for silent mode,
126  * when dequeue is not required.
127  *
128  * This queues up a copy operation to be performed by hardware, if the 'flags'
129  * parameter contains RTE_DMA_OP_FLAG_SUBMIT then trigger doorbell to begin
130  * this operation, otherwise do not trigger doorbell.
131  *
132  * @param dev_id
133  *   The identifier of the device.
134  * @param vchan
135  *   The identifier of virtual DMA channel.
136  * @param jobs
137  *   Jobs to be submitted to QDMA.
138  * @param nb_cpls
139  *   Number of DMA jobs.
140  *
141  * @return
142  *   - >= 0..Number of enqueued job.
143  *   - -ENOSPC: if no space left to enqueue.
144  *   - other values < 0 on failure.
145  */
146 __rte_experimental
147 int rte_dpaa2_qdma_copy_multi(int16_t dev_id, uint16_t vchan,
148                 struct rte_dpaa2_qdma_job **jobs, uint16_t nb_cpls);
149
150 /**
151  * @warning
152  * @b EXPERIMENTAL: this API may change without prior notice.
153  *
154  * Return the number of operations that have been successfully completed.
155  *
156  * @param dev_id
157  *   The identifier of the device.
158  * @param vchan
159  *   The identifier of virtual DMA channel.
160  * @param jobs
161  *   Jobs completed by QDMA.
162  * @param nb_cpls
163  *   Number of completed DMA jobs.
164  *
165  * @return
166  *   The number of operations that successfully completed. This return value
167  *   must be less than or equal to the value of nb_cpls.
168  */
169 __rte_experimental
170 uint16_t rte_dpaa2_qdma_completed_multi(int16_t dev_id, uint16_t vchan,
171                 struct rte_dpaa2_qdma_job **jobs, uint16_t nb_cpls);
172
173 #endif /* _RTE_PMD_DPAA2_QDMA_H_ */