layerscape: add patches-5.4
[openwrt/staging/mkresin.git] / target / linux / layerscape / patches-5.4 / 806-dma-0001-dmaengine-fsl-dpaa2-qdma-Add-the-DPDMAI-Data-Path-DM.patch
1 From e8a617bd4aa67cc57b7ff8b9a1b2ca0acd4712ac Mon Sep 17 00:00:00 2001
2 From: Peng Ma <peng.ma@nxp.com>
3 Date: Mon, 4 Mar 2019 15:39:14 +0800
4 Subject: [PATCH] dmaengine: fsl-dpaa2-qdma: Add the DPDMAI(Data Path DMA
5 Interface) support
6
7 The MC(Management Complex) exports the DPDMAI(Data Path DMA Interface)
8 object as an interface to operate the DPAA2(Data Path Acceleration
9 Architecture 2) qDMA Engine. The DPDMAI enables sending frame-based
10 requests to qDMA and receiving back confirmation response on transaction
11 completion, utilizing the DPAA2 QBMan(Queue Manager and Buffer Manager
12 hardware) infrastructure. DPDMAI object provides up to two priorities for
13 processing qDMA requests.
14 The following list summarizes the DPDMAI main features and capabilities:
15 1. Supports up to two scheduling priorities for processing
16 service requests.
17 - Each DPDMAI transmit queue is mapped to one of two service
18 priorities, allowing further prioritization in hardware between
19 requests from different DPDMAI objects.
20 2. Supports up to two receive queues for incoming transaction
21 completion confirmations.
22 - Each DPDMAI receive queue is mapped to one of two receive
23 priorities, allowing further prioritization between other
24 interfaces when associating the DPDMAI receive queues to DPIO
25 or DPCON(Data Path Concentrator) objects.
26 3. Supports different scheduling options for processing received
27 packets:
28 - Queues can be configured either in 'parked' mode (default),
29 or attached to a DPIO object, or attached to DPCON object.
30 4. Allows interaction with one or more DPIO objects for
31 dequeueing/enqueueing frame descriptors(FD) and for
32 acquiring/releasing buffers.
33 5. Supports enable, disable, and reset operations.
34
35 Add dpdmai to support some platforms with dpaa2 qdma engine.
36
37 Signed-off-by: Peng Ma <peng.ma@nxp.com>
38 ---
39 drivers/dma/fsl-dpaa2-qdma/dpdmai.c | 366 ++++++++++++++++++++++++++++++++++++
40 drivers/dma/fsl-dpaa2-qdma/dpdmai.h | 177 +++++++++++++++++
41 2 files changed, 543 insertions(+)
42 create mode 100644 drivers/dma/fsl-dpaa2-qdma/dpdmai.c
43 create mode 100644 drivers/dma/fsl-dpaa2-qdma/dpdmai.h
44
45 --- /dev/null
46 +++ b/drivers/dma/fsl-dpaa2-qdma/dpdmai.c
47 @@ -0,0 +1,366 @@
48 +// SPDX-License-Identifier: GPL-2.0
49 +// Copyright 2019 NXP
50 +
51 +#include <linux/types.h>
52 +#include <linux/io.h>
53 +#include <linux/fsl/mc.h>
54 +#include "dpdmai.h"
55 +
56 +struct dpdmai_rsp_get_attributes {
57 + __le32 id;
58 + u8 num_of_priorities;
59 + u8 pad0[3];
60 + __le16 major;
61 + __le16 minor;
62 +};
63 +
64 +struct dpdmai_cmd_queue {
65 + __le32 dest_id;
66 + u8 priority;
67 + u8 queue;
68 + u8 dest_type;
69 + u8 pad;
70 + __le64 user_ctx;
71 + union {
72 + __le32 options;
73 + __le32 fqid;
74 + };
75 +};
76 +
77 +struct dpdmai_rsp_get_tx_queue {
78 + __le64 pad;
79 + __le32 fqid;
80 +};
81 +
82 +#define MC_CMD_OP(_cmd, _param, _offset, _width, _type, _arg) \
83 + ((_cmd).params[_param] |= mc_enc((_offset), (_width), _arg))
84 +
85 +/* cmd, param, offset, width, type, arg_name */
86 +#define DPDMAI_CMD_CREATE(_cmd, _cfg) \
87 +do { \
88 + typeof(_cmd) (cmd) = (_cmd); \
89 + typeof(_cfg) (cfg) = (_cfg); \
90 + MC_CMD_OP(cmd, 0, 8, 8, u8, (cfg)->priorities[0]);\
91 + MC_CMD_OP(cmd, 0, 16, 8, u8, (cfg)->priorities[1]);\
92 +} while (0)
93 +
94 +static inline u64 mc_enc(int lsoffset, int width, u64 val)
95 +{
96 + return (val & MAKE_UMASK64(width)) << lsoffset;
97 +}
98 +
99 +/**
100 + * dpdmai_open() - Open a control session for the specified object
101 + * @mc_io: Pointer to MC portal's I/O object
102 + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
103 + * @dpdmai_id: DPDMAI unique ID
104 + * @token: Returned token; use in subsequent API calls
105 + *
106 + * This function can be used to open a control session for an
107 + * already created object; an object may have been declared in
108 + * the DPL or by calling the dpdmai_create() function.
109 + * This function returns a unique authentication token,
110 + * associated with the specific object ID and the specific MC
111 + * portal; this token must be used in all subsequent commands for
112 + * this specific object.
113 + *
114 + * Return: '0' on Success; Error code otherwise.
115 + */
116 +int dpdmai_open(struct fsl_mc_io *mc_io, u32 cmd_flags,
117 + int dpdmai_id, u16 *token)
118 +{
119 + struct fsl_mc_command cmd = { 0 };
120 + __le64 *cmd_dpdmai_id;
121 + int err;
122 +
123 + /* prepare command */
124 + cmd.header = mc_encode_cmd_header(DPDMAI_CMDID_OPEN,
125 + cmd_flags, 0);
126 +
127 + cmd_dpdmai_id = cmd.params;
128 + *cmd_dpdmai_id = cpu_to_le32(dpdmai_id);
129 +
130 + /* send command to mc*/
131 + err = mc_send_command(mc_io, &cmd);
132 + if (err)
133 + return err;
134 +
135 + /* retrieve response parameters */
136 + *token = mc_cmd_hdr_read_token(&cmd);
137 +
138 + return 0;
139 +}
140 +
141 +/**
142 + * dpdmai_close() - Close the control session of the object
143 + * @mc_io: Pointer to MC portal's I/O object
144 + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
145 + * @token: Token of DPDMAI object
146 + *
147 + * After this function is called, no further operations are
148 + * allowed on the object without opening a new control session.
149 + *
150 + * Return: '0' on Success; Error code otherwise.
151 + */
152 +int dpdmai_close(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token)
153 +{
154 + struct fsl_mc_command cmd = { 0 };
155 +
156 + /* prepare command */
157 + cmd.header = mc_encode_cmd_header(DPDMAI_CMDID_CLOSE,
158 + cmd_flags, token);
159 +
160 + /* send command to mc*/
161 + return mc_send_command(mc_io, &cmd);
162 +}
163 +
164 +/**
165 + * dpdmai_create() - Create the DPDMAI object
166 + * @mc_io: Pointer to MC portal's I/O object
167 + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
168 + * @cfg: Configuration structure
169 + * @token: Returned token; use in subsequent API calls
170 + *
171 + * Create the DPDMAI object, allocate required resources and
172 + * perform required initialization.
173 + *
174 + * The object can be created either by declaring it in the
175 + * DPL file, or by calling this function.
176 + *
177 + * This function returns a unique authentication token,
178 + * associated with the specific object ID and the specific MC
179 + * portal; this token must be used in all subsequent calls to
180 + * this specific object. For objects that are created using the
181 + * DPL file, call dpdmai_open() function to get an authentication
182 + * token first.
183 + *
184 + * Return: '0' on Success; Error code otherwise.
185 + */
186 +int dpdmai_create(struct fsl_mc_io *mc_io, u32 cmd_flags,
187 + const struct dpdmai_cfg *cfg, u16 *token)
188 +{
189 + struct fsl_mc_command cmd = { 0 };
190 + int err;
191 +
192 + /* prepare command */
193 + cmd.header = mc_encode_cmd_header(DPDMAI_CMDID_CREATE,
194 + cmd_flags, 0);
195 + DPDMAI_CMD_CREATE(cmd, cfg);
196 +
197 + /* send command to mc*/
198 + err = mc_send_command(mc_io, &cmd);
199 + if (err)
200 + return err;
201 +
202 + /* retrieve response parameters */
203 + *token = mc_cmd_hdr_read_token(&cmd);
204 +
205 + return 0;
206 +}
207 +
208 +/**
209 + * dpdmai_enable() - Enable the DPDMAI, allow sending and receiving frames.
210 + * @mc_io: Pointer to MC portal's I/O object
211 + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
212 + * @token: Token of DPDMAI object
213 + *
214 + * Return: '0' on Success; Error code otherwise.
215 + */
216 +int dpdmai_enable(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token)
217 +{
218 + struct fsl_mc_command cmd = { 0 };
219 +
220 + /* prepare command */
221 + cmd.header = mc_encode_cmd_header(DPDMAI_CMDID_ENABLE,
222 + cmd_flags, token);
223 +
224 + /* send command to mc*/
225 + return mc_send_command(mc_io, &cmd);
226 +}
227 +
228 +/**
229 + * dpdmai_disable() - Disable the DPDMAI, stop sending and receiving frames.
230 + * @mc_io: Pointer to MC portal's I/O object
231 + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
232 + * @token: Token of DPDMAI object
233 + *
234 + * Return: '0' on Success; Error code otherwise.
235 + */
236 +int dpdmai_disable(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token)
237 +{
238 + struct fsl_mc_command cmd = { 0 };
239 +
240 + /* prepare command */
241 + cmd.header = mc_encode_cmd_header(DPDMAI_CMDID_DISABLE,
242 + cmd_flags, token);
243 +
244 + /* send command to mc*/
245 + return mc_send_command(mc_io, &cmd);
246 +}
247 +
248 +/**
249 + * dpdmai_reset() - Reset the DPDMAI, returns the object to initial state.
250 + * @mc_io: Pointer to MC portal's I/O object
251 + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
252 + * @token: Token of DPDMAI object
253 + *
254 + * Return: '0' on Success; Error code otherwise.
255 + */
256 +int dpdmai_reset(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token)
257 +{
258 + struct fsl_mc_command cmd = { 0 };
259 +
260 + /* prepare command */
261 + cmd.header = mc_encode_cmd_header(DPDMAI_CMDID_RESET,
262 + cmd_flags, token);
263 +
264 + /* send command to mc*/
265 + return mc_send_command(mc_io, &cmd);
266 +}
267 +
268 +/**
269 + * dpdmai_get_attributes() - Retrieve DPDMAI attributes.
270 + * @mc_io: Pointer to MC portal's I/O object
271 + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
272 + * @token: Token of DPDMAI object
273 + * @attr: Returned object's attributes
274 + *
275 + * Return: '0' on Success; Error code otherwise.
276 + */
277 +int dpdmai_get_attributes(struct fsl_mc_io *mc_io, u32 cmd_flags,
278 + u16 token, struct dpdmai_attr *attr)
279 +{
280 + struct dpdmai_rsp_get_attributes *rsp_params;
281 + struct fsl_mc_command cmd = { 0 };
282 + int err;
283 +
284 + /* prepare command */
285 + cmd.header = mc_encode_cmd_header(DPDMAI_CMDID_GET_ATTR,
286 + cmd_flags, token);
287 +
288 + /* send command to mc*/
289 + err = mc_send_command(mc_io, &cmd);
290 + if (err)
291 + return err;
292 +
293 + /* retrieve response parameters */
294 + rsp_params = (struct dpdmai_rsp_get_attributes *)cmd.params;
295 + attr->id = le32_to_cpu(rsp_params->id);
296 + attr->version.major = le16_to_cpu(rsp_params->major);
297 + attr->version.minor = le16_to_cpu(rsp_params->minor);
298 + attr->num_of_priorities = rsp_params->num_of_priorities;
299 +
300 + return 0;
301 +}
302 +
303 +/**
304 + * dpdmai_set_rx_queue() - Set Rx queue configuration
305 + * @mc_io: Pointer to MC portal's I/O object
306 + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
307 + * @token: Token of DPDMAI object
308 + * @priority: Select the queue relative to number of
309 + * priorities configured at DPDMAI creation
310 + * @cfg: Rx queue configuration
311 + *
312 + * Return: '0' on Success; Error code otherwise.
313 + */
314 +int dpdmai_set_rx_queue(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
315 + u8 priority, const struct dpdmai_rx_queue_cfg *cfg)
316 +{
317 + struct dpdmai_cmd_queue *cmd_params;
318 + struct fsl_mc_command cmd = { 0 };
319 +
320 + /* prepare command */
321 + cmd.header = mc_encode_cmd_header(DPDMAI_CMDID_SET_RX_QUEUE,
322 + cmd_flags, token);
323 +
324 + cmd_params = (struct dpdmai_cmd_queue *)cmd.params;
325 + cmd_params->dest_id = cpu_to_le32(cfg->dest_cfg.dest_id);
326 + cmd_params->priority = cfg->dest_cfg.priority;
327 + cmd_params->queue = priority;
328 + cmd_params->dest_type = cfg->dest_cfg.dest_type;
329 + cmd_params->user_ctx = cpu_to_le64(cfg->user_ctx);
330 + cmd_params->options = cpu_to_le32(cfg->options);
331 +
332 + /* send command to mc*/
333 + return mc_send_command(mc_io, &cmd);
334 +}
335 +
336 +/**
337 + * dpdmai_get_rx_queue() - Retrieve Rx queue attributes.
338 + * @mc_io: Pointer to MC portal's I/O object
339 + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
340 + * @token: Token of DPDMAI object
341 + * @priority: Select the queue relative to number of
342 + * priorities configured at DPDMAI creation
343 + * @attr: Returned Rx queue attributes
344 + *
345 + * Return: '0' on Success; Error code otherwise.
346 + */
347 +int dpdmai_get_rx_queue(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
348 + u8 priority, struct dpdmai_rx_queue_attr *attr)
349 +{
350 + struct dpdmai_cmd_queue *cmd_params;
351 + struct fsl_mc_command cmd = { 0 };
352 + int err;
353 +
354 + /* prepare command */
355 + cmd.header = mc_encode_cmd_header(DPDMAI_CMDID_GET_RX_QUEUE,
356 + cmd_flags, token);
357 +
358 + cmd_params = (struct dpdmai_cmd_queue *)cmd.params;
359 + cmd_params->queue = priority;
360 +
361 + /* send command to mc*/
362 + err = mc_send_command(mc_io, &cmd);
363 + if (err)
364 + return err;
365 +
366 + /* retrieve response parameters */
367 + attr->dest_cfg.dest_id = le32_to_cpu(cmd_params->dest_id);
368 + attr->dest_cfg.priority = cmd_params->priority;
369 + attr->dest_cfg.dest_type = cmd_params->dest_type;
370 + attr->user_ctx = le64_to_cpu(cmd_params->user_ctx);
371 + attr->fqid = le32_to_cpu(cmd_params->fqid);
372 +
373 + return 0;
374 +}
375 +
376 +/**
377 + * dpdmai_get_tx_queue() - Retrieve Tx queue attributes.
378 + * @mc_io: Pointer to MC portal's I/O object
379 + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
380 + * @token: Token of DPDMAI object
381 + * @priority: Select the queue relative to number of
382 + * priorities configured at DPDMAI creation
383 + * @fqid: Returned Tx queue
384 + *
385 + * Return: '0' on Success; Error code otherwise.
386 + */
387 +int dpdmai_get_tx_queue(struct fsl_mc_io *mc_io, u32 cmd_flags,
388 + u16 token, u8 priority, u32 *fqid)
389 +{
390 + struct dpdmai_rsp_get_tx_queue *rsp_params;
391 + struct dpdmai_cmd_queue *cmd_params;
392 + struct fsl_mc_command cmd = { 0 };
393 + int err;
394 +
395 + /* prepare command */
396 + cmd.header = mc_encode_cmd_header(DPDMAI_CMDID_GET_TX_QUEUE,
397 + cmd_flags, token);
398 +
399 + cmd_params = (struct dpdmai_cmd_queue *)cmd.params;
400 + cmd_params->queue = priority;
401 +
402 + /* send command to mc*/
403 + err = mc_send_command(mc_io, &cmd);
404 + if (err)
405 + return err;
406 +
407 + /* retrieve response parameters */
408 +
409 + rsp_params = (struct dpdmai_rsp_get_tx_queue *)cmd.params;
410 + *fqid = le32_to_cpu(rsp_params->fqid);
411 +
412 + return 0;
413 +}
414 --- /dev/null
415 +++ b/drivers/dma/fsl-dpaa2-qdma/dpdmai.h
416 @@ -0,0 +1,177 @@
417 +/* SPDX-License-Identifier: GPL-2.0 */
418 +/* Copyright 2019 NXP */
419 +
420 +#ifndef __FSL_DPDMAI_H
421 +#define __FSL_DPDMAI_H
422 +
423 +/* DPDMAI Version */
424 +#define DPDMAI_VER_MAJOR 2
425 +#define DPDMAI_VER_MINOR 2
426 +
427 +#define DPDMAI_CMD_BASE_VERSION 0
428 +#define DPDMAI_CMD_ID_OFFSET 4
429 +
430 +#define DPDMAI_CMDID_FORMAT(x) (((x) << DPDMAI_CMD_ID_OFFSET) | \
431 + DPDMAI_CMD_BASE_VERSION)
432 +
433 +/* Command IDs */
434 +#define DPDMAI_CMDID_CLOSE DPDMAI_CMDID_FORMAT(0x800)
435 +#define DPDMAI_CMDID_OPEN DPDMAI_CMDID_FORMAT(0x80E)
436 +#define DPDMAI_CMDID_CREATE DPDMAI_CMDID_FORMAT(0x90E)
437 +
438 +#define DPDMAI_CMDID_ENABLE DPDMAI_CMDID_FORMAT(0x002)
439 +#define DPDMAI_CMDID_DISABLE DPDMAI_CMDID_FORMAT(0x003)
440 +#define DPDMAI_CMDID_GET_ATTR DPDMAI_CMDID_FORMAT(0x004)
441 +#define DPDMAI_CMDID_RESET DPDMAI_CMDID_FORMAT(0x005)
442 +#define DPDMAI_CMDID_IS_ENABLED DPDMAI_CMDID_FORMAT(0x006)
443 +
444 +#define DPDMAI_CMDID_SET_IRQ DPDMAI_CMDID_FORMAT(0x010)
445 +#define DPDMAI_CMDID_GET_IRQ DPDMAI_CMDID_FORMAT(0x011)
446 +#define DPDMAI_CMDID_SET_IRQ_ENABLE DPDMAI_CMDID_FORMAT(0x012)
447 +#define DPDMAI_CMDID_GET_IRQ_ENABLE DPDMAI_CMDID_FORMAT(0x013)
448 +#define DPDMAI_CMDID_SET_IRQ_MASK DPDMAI_CMDID_FORMAT(0x014)
449 +#define DPDMAI_CMDID_GET_IRQ_MASK DPDMAI_CMDID_FORMAT(0x015)
450 +#define DPDMAI_CMDID_GET_IRQ_STATUS DPDMAI_CMDID_FORMAT(0x016)
451 +#define DPDMAI_CMDID_CLEAR_IRQ_STATUS DPDMAI_CMDID_FORMAT(0x017)
452 +
453 +#define DPDMAI_CMDID_SET_RX_QUEUE DPDMAI_CMDID_FORMAT(0x1A0)
454 +#define DPDMAI_CMDID_GET_RX_QUEUE DPDMAI_CMDID_FORMAT(0x1A1)
455 +#define DPDMAI_CMDID_GET_TX_QUEUE DPDMAI_CMDID_FORMAT(0x1A2)
456 +
457 +#define MC_CMD_HDR_TOKEN_O 32 /* Token field offset */
458 +#define MC_CMD_HDR_TOKEN_S 16 /* Token field size */
459 +
460 +#define MAKE_UMASK64(_width) \
461 + ((u64)((_width) < 64 ? ((u64)1 << (_width)) - 1 : (u64)-1))
462 +
463 +/* Data Path DMA Interface API
464 + * Contains initialization APIs and runtime control APIs for DPDMAI
465 + */
466 +
467 +/**
468 + * Maximum number of Tx/Rx priorities per DPDMAI object
469 + */
470 +#define DPDMAI_PRIO_NUM 2
471 +
472 +/* DPDMAI queue modification options */
473 +
474 +/**
475 + * Select to modify the user's context associated with the queue
476 + */
477 +#define DPDMAI_QUEUE_OPT_USER_CTX 0x1
478 +
479 +/**
480 + * Select to modify the queue's destination
481 + */
482 +#define DPDMAI_QUEUE_OPT_DEST 0x2
483 +
484 +/**
485 + * struct dpdmai_cfg - Structure representing DPDMAI configuration
486 + * @priorities: Priorities for the DMA hardware processing; valid priorities are
487 + * configured with values 1-8; the entry following last valid entry
488 + * should be configured with 0
489 + */
490 +struct dpdmai_cfg {
491 + u8 priorities[DPDMAI_PRIO_NUM];
492 +};
493 +
494 +/**
495 + * struct dpdmai_attr - Structure representing DPDMAI attributes
496 + * @id: DPDMAI object ID
497 + * @version: DPDMAI version
498 + * @num_of_priorities: number of priorities
499 + */
500 +struct dpdmai_attr {
501 + int id;
502 + /**
503 + * struct version - DPDMAI version
504 + * @major: DPDMAI major version
505 + * @minor: DPDMAI minor version
506 + */
507 + struct {
508 + u16 major;
509 + u16 minor;
510 + } version;
511 + u8 num_of_priorities;
512 +};
513 +
514 +/**
515 + * enum dpdmai_dest - DPDMAI destination types
516 + * @DPDMAI_DEST_NONE: Unassigned destination; The queue is set in parked mode
517 + * and does not generate FQDAN notifications; user is expected to dequeue
518 + * from the queue based on polling or other user-defined method
519 + * @DPDMAI_DEST_DPIO: The queue is set in schedule mode and generates FQDAN
520 + * notifications to the specified DPIO; user is expected to dequeue
521 + * from the queue only after notification is received
522 + * @DPDMAI_DEST_DPCON: The queue is set in schedule mode and does not generate
523 + * FQDAN notifications, but is connected to the specified DPCON object;
524 + * user is expected to dequeue from the DPCON channel
525 + */
526 +enum dpdmai_dest {
527 + DPDMAI_DEST_NONE = 0,
528 + DPDMAI_DEST_DPIO = 1,
529 + DPDMAI_DEST_DPCON = 2
530 +};
531 +
532 +/**
533 + * struct dpdmai_dest_cfg - Structure representing DPDMAI destination parameters
534 + * @dest_type: Destination type
535 + * @dest_id: Either DPIO ID or DPCON ID, depending on the destination type
536 + * @priority: Priority selection within the DPIO or DPCON channel; valid values
537 + * are 0-1 or 0-7, depending on the number of priorities in that
538 + * channel; not relevant for 'DPDMAI_DEST_NONE' option
539 + */
540 +struct dpdmai_dest_cfg {
541 + enum dpdmai_dest dest_type;
542 + int dest_id;
543 + u8 priority;
544 +};
545 +
546 +/**
547 + * struct dpdmai_rx_queue_cfg - DPDMAI RX queue configuration
548 + * @options: Flags representing the suggested modifications to the queue;
549 + * Use any combination of 'DPDMAI_QUEUE_OPT_<X>' flags
550 + * @user_ctx: User context value provided in the frame descriptor of each
551 + * dequeued frame;
552 + * valid only if 'DPDMAI_QUEUE_OPT_USER_CTX' is contained in 'options'
553 + * @dest_cfg: Queue destination parameters;
554 + * valid only if 'DPDMAI_QUEUE_OPT_DEST' is contained in 'options'
555 + */
556 +struct dpdmai_rx_queue_cfg {
557 + struct dpdmai_dest_cfg dest_cfg;
558 + u32 options;
559 + u64 user_ctx;
560 +
561 +};
562 +
563 +/**
564 + * struct dpdmai_rx_queue_attr - Structure representing attributes of Rx queues
565 + * @user_ctx: User context value provided in the frame descriptor of each
566 + * dequeued frame
567 + * @dest_cfg: Queue destination configuration
568 + * @fqid: Virtual FQID value to be used for dequeue operations
569 + */
570 +struct dpdmai_rx_queue_attr {
571 + struct dpdmai_dest_cfg dest_cfg;
572 + u64 user_ctx;
573 + u32 fqid;
574 +};
575 +
576 +int dpdmai_open(struct fsl_mc_io *mc_io, u32 cmd_flags,
577 + int dpdmai_id, u16 *token);
578 +int dpdmai_close(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token);
579 +int dpdmai_create(struct fsl_mc_io *mc_io, u32 cmd_flags,
580 + const struct dpdmai_cfg *cfg, u16 *token);
581 +int dpdmai_enable(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token);
582 +int dpdmai_disable(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token);
583 +int dpdmai_reset(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token);
584 +int dpdmai_get_attributes(struct fsl_mc_io *mc_io, u32 cmd_flags,
585 + u16 token, struct dpdmai_attr *attr);
586 +int dpdmai_set_rx_queue(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
587 + u8 priority, const struct dpdmai_rx_queue_cfg *cfg);
588 +int dpdmai_get_rx_queue(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
589 + u8 priority, struct dpdmai_rx_queue_attr *attr);
590 +int dpdmai_get_tx_queue(struct fsl_mc_io *mc_io, u32 cmd_flags,
591 + u16 token, u8 priority, u32 *fqid);
592 +
593 +#endif /* __FSL_DPDMAI_H */