1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright 2018-2021 NXP
8 #include <rte_compat.h>
12 /* Data Path DMA Interface API
13 * Contains initialization APIs and runtime control APIs for DPDMAI
16 /* General DPDMAI macros */
19 * Maximum number of Tx/Rx priorities per DPDMAI object
21 #define DPDMAI_PRIO_NUM 2
24 * All queues considered; see dpdmai_set_rx_queue()
26 #define DPDMAI_ALL_QUEUES (uint8_t)(-1)
29 int dpdmai_open(struct fsl_mc_io *mc_io,
35 int dpdmai_close(struct fsl_mc_io *mc_io,
42 * Enable individual Congestion Groups usage per each priority queue
43 * If this option is not enabled then only one CG is used for all priority
45 * If this option is enabled then a separate specific CG is used for each
46 * individual priority queue.
47 * In this case the priority queue must be specified via congestion notification
50 #define DPDMAI_OPT_CG_PER_PRIORITY 0x00000001
53 * struct dpdmai_cfg - Structure representing DPDMAI configuration
54 * @priorities: Priorities for the DMA hardware processing; valid priorities are
55 * configured with values 1-8; the entry following last valid entry
56 * should be configured with 0
57 * @options: dpdmai options
61 uint8_t priorities[DPDMAI_PRIO_NUM];
67 int dpdmai_create(struct fsl_mc_io *mc_io,
70 const struct dpdmai_cfg *cfg,
73 int dpdmai_destroy(struct fsl_mc_io *mc_io,
79 int dpdmai_enable(struct fsl_mc_io *mc_io,
84 int dpdmai_disable(struct fsl_mc_io *mc_io,
88 int dpdmai_is_enabled(struct fsl_mc_io *mc_io,
93 int dpdmai_reset(struct fsl_mc_io *mc_io,
98 * struct dpdmai_attr - Structure representing DPDMAI attributes
99 * @id: DPDMAI object ID
100 * @num_of_priorities: number of priorities
101 * @options: dpdmai options
105 uint8_t num_of_priorities;
106 uint8_t num_of_queues;
111 int dpdmai_get_attributes(struct fsl_mc_io *mc_io,
114 struct dpdmai_attr *attr);
117 * enum dpdmai_dest - DPDMAI destination types
118 * @DPDMAI_DEST_NONE: Unassigned destination; The queue is set in parked mode
119 * and does not generate FQDAN notifications; user is expected to dequeue
120 * from the queue based on polling or other user-defined method
121 * @DPDMAI_DEST_DPIO: The queue is set in schedule mode and generates FQDAN
122 * notifications to the specified DPIO; user is expected to dequeue
123 * from the queue only after notification is received
124 * @DPDMAI_DEST_DPCON: The queue is set in schedule mode and does not generate
125 * FQDAN notifications, but is connected to the specified DPCON object;
126 * user is expected to dequeue from the DPCON channel
129 DPDMAI_DEST_NONE = 0,
130 DPDMAI_DEST_DPIO = 1,
131 DPDMAI_DEST_DPCON = 2
135 * struct dpdmai_dest_cfg - Structure representing DPDMAI destination parameters
136 * @dest_type: Destination type
137 * @dest_id: Either DPIO ID or DPCON ID, depending on the destination type
138 * @priority: Priority selection within the DPIO or DPCON channel; valid values
139 * are 0-1 or 0-7, depending on the number of priorities in that
140 * channel; not relevant for 'DPDMAI_DEST_NONE' option
142 struct dpdmai_dest_cfg {
143 enum dpdmai_dest dest_type;
148 /* DPDMAI queue modification options */
151 * Select to modify the user's context associated with the queue
153 #define DPDMAI_QUEUE_OPT_USER_CTX 0x00000001
156 * Select to modify the queue's destination
158 #define DPDMAI_QUEUE_OPT_DEST 0x00000002
161 * struct dpdmai_rx_queue_cfg - DPDMAI RX queue configuration
162 * @options: Flags representing the suggested modifications to the queue;
163 * Use any combination of 'DPDMAI_QUEUE_OPT_<X>' flags
164 * @user_ctx: User context value provided in the frame descriptor of each
166 * valid only if 'DPDMAI_QUEUE_OPT_USER_CTX' is contained in 'options'
167 * @dest_cfg: Queue destination parameters;
168 * valid only if 'DPDMAI_QUEUE_OPT_DEST' is contained in 'options'
170 struct dpdmai_rx_queue_cfg {
173 struct dpdmai_dest_cfg dest_cfg;
178 int dpdmai_set_rx_queue(struct fsl_mc_io *mc_io,
183 const struct dpdmai_rx_queue_cfg *cfg);
186 * struct dpdmai_rx_queue_attr - Structure representing attributes of Rx queues
187 * @user_ctx: User context value provided in the frame descriptor of each
189 * @dest_cfg: Queue destination configuration
190 * @fqid: Virtual FQID value to be used for dequeue operations
192 struct dpdmai_rx_queue_attr {
194 struct dpdmai_dest_cfg dest_cfg;
199 int dpdmai_get_rx_queue(struct fsl_mc_io *mc_io,
204 struct dpdmai_rx_queue_attr *attr);
207 * struct dpdmai_tx_queue_attr - Structure representing attributes of Tx queues
208 * @fqid: Virtual FQID to be used for sending frames to DMA hardware
211 struct dpdmai_tx_queue_attr {
216 int dpdmai_get_tx_queue(struct fsl_mc_io *mc_io,
221 struct dpdmai_tx_queue_attr *attr);
223 #endif /* __FSL_DPDMAI_H */