1 /* SPDX-License-Identifier: BSD-3-Clause
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,
40 * struct dpdmai_cfg - Structure representing DPDMAI configuration
41 * @priorities: Priorities for the DMA hardware processing; valid priorities are
42 * configured with values 1-8; the entry following last valid entry
43 * should be configured with 0
47 uint8_t priorities[DPDMAI_PRIO_NUM];
50 int dpdmai_create(struct fsl_mc_io *mc_io,
53 const struct dpdmai_cfg *cfg,
56 int dpdmai_destroy(struct fsl_mc_io *mc_io,
62 int dpdmai_enable(struct fsl_mc_io *mc_io,
67 int dpdmai_disable(struct fsl_mc_io *mc_io,
71 int dpdmai_is_enabled(struct fsl_mc_io *mc_io,
76 int dpdmai_reset(struct fsl_mc_io *mc_io,
81 * struct dpdmai_attr - Structure representing DPDMAI attributes
82 * @id: DPDMAI object ID
83 * @num_of_priorities: number of priorities
87 uint8_t num_of_priorities;
88 uint8_t num_of_queues;
92 int dpdmai_get_attributes(struct fsl_mc_io *mc_io,
95 struct dpdmai_attr *attr);
98 * enum dpdmai_dest - DPDMAI destination types
99 * @DPDMAI_DEST_NONE: Unassigned destination; The queue is set in parked mode
100 * and does not generate FQDAN notifications; user is expected to dequeue
101 * from the queue based on polling or other user-defined method
102 * @DPDMAI_DEST_DPIO: The queue is set in schedule mode and generates FQDAN
103 * notifications to the specified DPIO; user is expected to dequeue
104 * from the queue only after notification is received
105 * @DPDMAI_DEST_DPCON: The queue is set in schedule mode and does not generate
106 * FQDAN notifications, but is connected to the specified DPCON object;
107 * user is expected to dequeue from the DPCON channel
110 DPDMAI_DEST_NONE = 0,
111 DPDMAI_DEST_DPIO = 1,
112 DPDMAI_DEST_DPCON = 2
116 * struct dpdmai_dest_cfg - Structure representing DPDMAI destination parameters
117 * @dest_type: Destination type
118 * @dest_id: Either DPIO ID or DPCON ID, depending on the destination type
119 * @priority: Priority selection within the DPIO or DPCON channel; valid values
120 * are 0-1 or 0-7, depending on the number of priorities in that
121 * channel; not relevant for 'DPDMAI_DEST_NONE' option
123 struct dpdmai_dest_cfg {
124 enum dpdmai_dest dest_type;
129 /* DPDMAI queue modification options */
132 * Select to modify the user's context associated with the queue
134 #define DPDMAI_QUEUE_OPT_USER_CTX 0x00000001
137 * Select to modify the queue's destination
139 #define DPDMAI_QUEUE_OPT_DEST 0x00000002
142 * struct dpdmai_rx_queue_cfg - DPDMAI RX queue configuration
143 * @options: Flags representing the suggested modifications to the queue;
144 * Use any combination of 'DPDMAI_QUEUE_OPT_<X>' flags
145 * @user_ctx: User context value provided in the frame descriptor of each
147 * valid only if 'DPDMAI_QUEUE_OPT_USER_CTX' is contained in 'options'
148 * @dest_cfg: Queue destination parameters;
149 * valid only if 'DPDMAI_QUEUE_OPT_DEST' is contained in 'options'
151 struct dpdmai_rx_queue_cfg {
154 struct dpdmai_dest_cfg dest_cfg;
159 int dpdmai_set_rx_queue(struct fsl_mc_io *mc_io,
164 const struct dpdmai_rx_queue_cfg *cfg);
167 * struct dpdmai_rx_queue_attr - Structure representing attributes of Rx queues
168 * @user_ctx: User context value provided in the frame descriptor of each
170 * @dest_cfg: Queue destination configuration
171 * @fqid: Virtual FQID value to be used for dequeue operations
173 struct dpdmai_rx_queue_attr {
175 struct dpdmai_dest_cfg dest_cfg;
180 int dpdmai_get_rx_queue(struct fsl_mc_io *mc_io,
185 struct dpdmai_rx_queue_attr *attr);
188 * struct dpdmai_tx_queue_attr - Structure representing attributes of Tx queues
189 * @fqid: Virtual FQID to be used for sending frames to DMA hardware
192 struct dpdmai_tx_queue_attr {
197 int dpdmai_get_tx_queue(struct fsl_mc_io *mc_io,
202 struct dpdmai_tx_queue_attr *attr);
204 #endif /* __FSL_DPDMAI_H */