1f2835adfSPeng Ma // SPDX-License-Identifier: GPL-2.0
2f2835adfSPeng Ma // Copyright 2019 NXP
3f2835adfSPeng Ma
4bd2f66bcSFrank Li #include <linux/bitfield.h>
553596dfaSPeng Ma #include <linux/module.h>
6f2835adfSPeng Ma #include <linux/types.h>
7f2835adfSPeng Ma #include <linux/io.h>
8f2835adfSPeng Ma #include <linux/fsl/mc.h>
9f2835adfSPeng Ma #include "dpdmai.h"
10f2835adfSPeng Ma
11bd2f66bcSFrank Li #define DEST_TYPE_MASK 0xF
12bd2f66bcSFrank Li
13f2835adfSPeng Ma struct dpdmai_rsp_get_attributes {
14f2835adfSPeng Ma __le32 id;
15f2835adfSPeng Ma u8 num_of_priorities;
16bd2f66bcSFrank Li u8 num_of_queues;
17bd2f66bcSFrank Li u8 pad0[2];
18f2835adfSPeng Ma __le16 major;
19f2835adfSPeng Ma __le16 minor;
20f2835adfSPeng Ma };
21f2835adfSPeng Ma
22f2835adfSPeng Ma struct dpdmai_cmd_queue {
23f2835adfSPeng Ma __le32 dest_id;
24bd2f66bcSFrank Li u8 dest_priority;
25bd2f66bcSFrank Li union {
26f2835adfSPeng Ma u8 queue;
27bd2f66bcSFrank Li u8 pri;
28bd2f66bcSFrank Li };
29f2835adfSPeng Ma u8 dest_type;
30bd2f66bcSFrank Li u8 queue_idx;
31f2835adfSPeng Ma __le64 user_ctx;
32f2835adfSPeng Ma union {
33f2835adfSPeng Ma __le32 options;
34f2835adfSPeng Ma __le32 fqid;
35f2835adfSPeng Ma };
36bd2f66bcSFrank Li } __packed;
37f2835adfSPeng Ma
38f2835adfSPeng Ma struct dpdmai_rsp_get_tx_queue {
39f2835adfSPeng Ma __le64 pad;
40f2835adfSPeng Ma __le32 fqid;
41f2835adfSPeng Ma };
42f2835adfSPeng Ma
43ebf85069SFrank Li struct dpdmai_cmd_open {
44ebf85069SFrank Li __le32 dpdmai_id;
45ebf85069SFrank Li } __packed;
46ebf85069SFrank Li
47bd2f66bcSFrank Li struct dpdmai_cmd_destroy {
48bd2f66bcSFrank Li __le32 dpdmai_id;
49bd2f66bcSFrank Li } __packed;
50bd2f66bcSFrank Li
mc_enc(int lsoffset,int width,u64 val)51f2835adfSPeng Ma static inline u64 mc_enc(int lsoffset, int width, u64 val)
52f2835adfSPeng Ma {
53f2835adfSPeng Ma return (val & MAKE_UMASK64(width)) << lsoffset;
54f2835adfSPeng Ma }
55f2835adfSPeng Ma
56f2835adfSPeng Ma /**
57f2835adfSPeng Ma * dpdmai_open() - Open a control session for the specified object
58f2835adfSPeng Ma * @mc_io: Pointer to MC portal's I/O object
59f2835adfSPeng Ma * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
60f2835adfSPeng Ma * @dpdmai_id: DPDMAI unique ID
61f2835adfSPeng Ma * @token: Returned token; use in subsequent API calls
62f2835adfSPeng Ma *
63f2835adfSPeng Ma * This function can be used to open a control session for an
64f2835adfSPeng Ma * already created object; an object may have been declared in
65f2835adfSPeng Ma * the DPL or by calling the dpdmai_create() function.
66f2835adfSPeng Ma * This function returns a unique authentication token,
67f2835adfSPeng Ma * associated with the specific object ID and the specific MC
68f2835adfSPeng Ma * portal; this token must be used in all subsequent commands for
69f2835adfSPeng Ma * this specific object.
70f2835adfSPeng Ma *
71f2835adfSPeng Ma * Return: '0' on Success; Error code otherwise.
72f2835adfSPeng Ma */
dpdmai_open(struct fsl_mc_io * mc_io,u32 cmd_flags,int dpdmai_id,u16 * token)73f2835adfSPeng Ma int dpdmai_open(struct fsl_mc_io *mc_io, u32 cmd_flags,
74f2835adfSPeng Ma int dpdmai_id, u16 *token)
75f2835adfSPeng Ma {
76ebf85069SFrank Li struct dpdmai_cmd_open *cmd_params;
77f2835adfSPeng Ma struct fsl_mc_command cmd = { 0 };
78f2835adfSPeng Ma int err;
79f2835adfSPeng Ma
80f2835adfSPeng Ma /* prepare command */
81f2835adfSPeng Ma cmd.header = mc_encode_cmd_header(DPDMAI_CMDID_OPEN,
82f2835adfSPeng Ma cmd_flags, 0);
83f2835adfSPeng Ma
84ebf85069SFrank Li cmd_params = (struct dpdmai_cmd_open *)&cmd.params;
85ebf85069SFrank Li cmd_params->dpdmai_id = cpu_to_le32(dpdmai_id);
86f2835adfSPeng Ma
87f2835adfSPeng Ma /* send command to mc*/
88f2835adfSPeng Ma err = mc_send_command(mc_io, &cmd);
89f2835adfSPeng Ma if (err)
90f2835adfSPeng Ma return err;
91f2835adfSPeng Ma
92f2835adfSPeng Ma /* retrieve response parameters */
93f2835adfSPeng Ma *token = mc_cmd_hdr_read_token(&cmd);
94f2835adfSPeng Ma
95f2835adfSPeng Ma return 0;
96f2835adfSPeng Ma }
9753596dfaSPeng Ma EXPORT_SYMBOL_GPL(dpdmai_open);
98f2835adfSPeng Ma
99f2835adfSPeng Ma /**
100f2835adfSPeng Ma * dpdmai_close() - Close the control session of the object
101f2835adfSPeng Ma * @mc_io: Pointer to MC portal's I/O object
102f2835adfSPeng Ma * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
103f2835adfSPeng Ma * @token: Token of DPDMAI object
104f2835adfSPeng Ma *
105f2835adfSPeng Ma * After this function is called, no further operations are
106f2835adfSPeng Ma * allowed on the object without opening a new control session.
107f2835adfSPeng Ma *
108f2835adfSPeng Ma * Return: '0' on Success; Error code otherwise.
109f2835adfSPeng Ma */
dpdmai_close(struct fsl_mc_io * mc_io,u32 cmd_flags,u16 token)110f2835adfSPeng Ma int dpdmai_close(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token)
111f2835adfSPeng Ma {
112f2835adfSPeng Ma struct fsl_mc_command cmd = { 0 };
113f2835adfSPeng Ma
114f2835adfSPeng Ma /* prepare command */
115f2835adfSPeng Ma cmd.header = mc_encode_cmd_header(DPDMAI_CMDID_CLOSE,
116f2835adfSPeng Ma cmd_flags, token);
117f2835adfSPeng Ma
118f2835adfSPeng Ma /* send command to mc*/
119f2835adfSPeng Ma return mc_send_command(mc_io, &cmd);
120f2835adfSPeng Ma }
12153596dfaSPeng Ma EXPORT_SYMBOL_GPL(dpdmai_close);
122f2835adfSPeng Ma
123f2835adfSPeng Ma /**
1243e0ca3c3SPeng Ma * dpdmai_destroy() - Destroy the DPDMAI object and release all its resources.
1253e0ca3c3SPeng Ma * @mc_io: Pointer to MC portal's I/O object
1263e0ca3c3SPeng Ma * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
127bd2f66bcSFrank Li * @dpdmai_id: The object id; it must be a valid id within the container that created this object;
1283e0ca3c3SPeng Ma * @token: Token of DPDMAI object
1293e0ca3c3SPeng Ma *
1303e0ca3c3SPeng Ma * Return: '0' on Success; error code otherwise.
1313e0ca3c3SPeng Ma */
dpdmai_destroy(struct fsl_mc_io * mc_io,u32 cmd_flags,u32 dpdmai_id,u16 token)132bd2f66bcSFrank Li int dpdmai_destroy(struct fsl_mc_io *mc_io, u32 cmd_flags, u32 dpdmai_id, u16 token)
1333e0ca3c3SPeng Ma {
134bd2f66bcSFrank Li struct dpdmai_cmd_destroy *cmd_params;
1353e0ca3c3SPeng Ma struct fsl_mc_command cmd = { 0 };
1363e0ca3c3SPeng Ma
1373e0ca3c3SPeng Ma /* prepare command */
1383e0ca3c3SPeng Ma cmd.header = mc_encode_cmd_header(DPDMAI_CMDID_DESTROY,
1393e0ca3c3SPeng Ma cmd_flags, token);
1403e0ca3c3SPeng Ma
141bd2f66bcSFrank Li cmd_params = (struct dpdmai_cmd_destroy *)&cmd.params;
142bd2f66bcSFrank Li cmd_params->dpdmai_id = cpu_to_le32(dpdmai_id);
143bd2f66bcSFrank Li
1443e0ca3c3SPeng Ma /* send command to mc*/
1453e0ca3c3SPeng Ma return mc_send_command(mc_io, &cmd);
1463e0ca3c3SPeng Ma }
1473e0ca3c3SPeng Ma EXPORT_SYMBOL_GPL(dpdmai_destroy);
1483e0ca3c3SPeng Ma
1493e0ca3c3SPeng Ma /**
150f2835adfSPeng Ma * dpdmai_enable() - Enable the DPDMAI, allow sending and receiving frames.
151f2835adfSPeng Ma * @mc_io: Pointer to MC portal's I/O object
152f2835adfSPeng Ma * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
153f2835adfSPeng Ma * @token: Token of DPDMAI object
154f2835adfSPeng Ma *
155f2835adfSPeng Ma * Return: '0' on Success; Error code otherwise.
156f2835adfSPeng Ma */
dpdmai_enable(struct fsl_mc_io * mc_io,u32 cmd_flags,u16 token)157f2835adfSPeng Ma int dpdmai_enable(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token)
158f2835adfSPeng Ma {
159f2835adfSPeng Ma struct fsl_mc_command cmd = { 0 };
160f2835adfSPeng Ma
161f2835adfSPeng Ma /* prepare command */
162f2835adfSPeng Ma cmd.header = mc_encode_cmd_header(DPDMAI_CMDID_ENABLE,
163f2835adfSPeng Ma cmd_flags, token);
164f2835adfSPeng Ma
165f2835adfSPeng Ma /* send command to mc*/
166f2835adfSPeng Ma return mc_send_command(mc_io, &cmd);
167f2835adfSPeng Ma }
16853596dfaSPeng Ma EXPORT_SYMBOL_GPL(dpdmai_enable);
169f2835adfSPeng Ma
170f2835adfSPeng Ma /**
171f2835adfSPeng Ma * dpdmai_disable() - Disable the DPDMAI, stop sending and receiving frames.
172f2835adfSPeng Ma * @mc_io: Pointer to MC portal's I/O object
173f2835adfSPeng Ma * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
174f2835adfSPeng Ma * @token: Token of DPDMAI object
175f2835adfSPeng Ma *
176f2835adfSPeng Ma * Return: '0' on Success; Error code otherwise.
177f2835adfSPeng Ma */
dpdmai_disable(struct fsl_mc_io * mc_io,u32 cmd_flags,u16 token)178f2835adfSPeng Ma int dpdmai_disable(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token)
179f2835adfSPeng Ma {
180f2835adfSPeng Ma struct fsl_mc_command cmd = { 0 };
181f2835adfSPeng Ma
182f2835adfSPeng Ma /* prepare command */
183f2835adfSPeng Ma cmd.header = mc_encode_cmd_header(DPDMAI_CMDID_DISABLE,
184f2835adfSPeng Ma cmd_flags, token);
185f2835adfSPeng Ma
186f2835adfSPeng Ma /* send command to mc*/
187f2835adfSPeng Ma return mc_send_command(mc_io, &cmd);
188f2835adfSPeng Ma }
18953596dfaSPeng Ma EXPORT_SYMBOL_GPL(dpdmai_disable);
190f2835adfSPeng Ma
191f2835adfSPeng Ma /**
192f2835adfSPeng Ma * dpdmai_reset() - Reset the DPDMAI, returns the object to initial state.
193f2835adfSPeng Ma * @mc_io: Pointer to MC portal's I/O object
194f2835adfSPeng Ma * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
195f2835adfSPeng Ma * @token: Token of DPDMAI object
196f2835adfSPeng Ma *
197f2835adfSPeng Ma * Return: '0' on Success; Error code otherwise.
198f2835adfSPeng Ma */
dpdmai_reset(struct fsl_mc_io * mc_io,u32 cmd_flags,u16 token)199f2835adfSPeng Ma int dpdmai_reset(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token)
200f2835adfSPeng Ma {
201f2835adfSPeng Ma struct fsl_mc_command cmd = { 0 };
202f2835adfSPeng Ma
203f2835adfSPeng Ma /* prepare command */
204f2835adfSPeng Ma cmd.header = mc_encode_cmd_header(DPDMAI_CMDID_RESET,
205f2835adfSPeng Ma cmd_flags, token);
206f2835adfSPeng Ma
207f2835adfSPeng Ma /* send command to mc*/
208f2835adfSPeng Ma return mc_send_command(mc_io, &cmd);
209f2835adfSPeng Ma }
21053596dfaSPeng Ma EXPORT_SYMBOL_GPL(dpdmai_reset);
211f2835adfSPeng Ma
212f2835adfSPeng Ma /**
213f2835adfSPeng Ma * dpdmai_get_attributes() - Retrieve DPDMAI attributes.
214f2835adfSPeng Ma * @mc_io: Pointer to MC portal's I/O object
215f2835adfSPeng Ma * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
216f2835adfSPeng Ma * @token: Token of DPDMAI object
217f2835adfSPeng Ma * @attr: Returned object's attributes
218f2835adfSPeng Ma *
219f2835adfSPeng Ma * Return: '0' on Success; Error code otherwise.
220f2835adfSPeng Ma */
dpdmai_get_attributes(struct fsl_mc_io * mc_io,u32 cmd_flags,u16 token,struct dpdmai_attr * attr)221f2835adfSPeng Ma int dpdmai_get_attributes(struct fsl_mc_io *mc_io, u32 cmd_flags,
222f2835adfSPeng Ma u16 token, struct dpdmai_attr *attr)
223f2835adfSPeng Ma {
224f2835adfSPeng Ma struct dpdmai_rsp_get_attributes *rsp_params;
225f2835adfSPeng Ma struct fsl_mc_command cmd = { 0 };
226f2835adfSPeng Ma int err;
227f2835adfSPeng Ma
228f2835adfSPeng Ma /* prepare command */
229f2835adfSPeng Ma cmd.header = mc_encode_cmd_header(DPDMAI_CMDID_GET_ATTR,
230f2835adfSPeng Ma cmd_flags, token);
231f2835adfSPeng Ma
232f2835adfSPeng Ma /* send command to mc*/
233f2835adfSPeng Ma err = mc_send_command(mc_io, &cmd);
234f2835adfSPeng Ma if (err)
235f2835adfSPeng Ma return err;
236f2835adfSPeng Ma
237f2835adfSPeng Ma /* retrieve response parameters */
238f2835adfSPeng Ma rsp_params = (struct dpdmai_rsp_get_attributes *)cmd.params;
239f2835adfSPeng Ma attr->id = le32_to_cpu(rsp_params->id);
240f2835adfSPeng Ma attr->version.major = le16_to_cpu(rsp_params->major);
241f2835adfSPeng Ma attr->version.minor = le16_to_cpu(rsp_params->minor);
242f2835adfSPeng Ma attr->num_of_priorities = rsp_params->num_of_priorities;
243bd2f66bcSFrank Li attr->num_of_queues = rsp_params->num_of_queues;
244f2835adfSPeng Ma
245f2835adfSPeng Ma return 0;
246f2835adfSPeng Ma }
24753596dfaSPeng Ma EXPORT_SYMBOL_GPL(dpdmai_get_attributes);
248f2835adfSPeng Ma
249f2835adfSPeng Ma /**
250f2835adfSPeng Ma * dpdmai_set_rx_queue() - Set Rx queue configuration
251f2835adfSPeng Ma * @mc_io: Pointer to MC portal's I/O object
252f2835adfSPeng Ma * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
253f2835adfSPeng Ma * @token: Token of DPDMAI object
25439def87bSFrank Li * @queue_idx: DMA queue index
255f2835adfSPeng Ma * @priority: Select the queue relative to number of
256f2835adfSPeng Ma * priorities configured at DPDMAI creation
257f2835adfSPeng Ma * @cfg: Rx queue configuration
258f2835adfSPeng Ma *
259f2835adfSPeng Ma * Return: '0' on Success; Error code otherwise.
260f2835adfSPeng Ma */
dpdmai_set_rx_queue(struct fsl_mc_io * mc_io,u32 cmd_flags,u16 token,u8 queue_idx,u8 priority,const struct dpdmai_rx_queue_cfg * cfg)261bd2f66bcSFrank Li int dpdmai_set_rx_queue(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, u8 queue_idx,
262f2835adfSPeng Ma u8 priority, const struct dpdmai_rx_queue_cfg *cfg)
263f2835adfSPeng Ma {
264f2835adfSPeng Ma struct dpdmai_cmd_queue *cmd_params;
265f2835adfSPeng Ma struct fsl_mc_command cmd = { 0 };
266f2835adfSPeng Ma
267f2835adfSPeng Ma /* prepare command */
268f2835adfSPeng Ma cmd.header = mc_encode_cmd_header(DPDMAI_CMDID_SET_RX_QUEUE,
269f2835adfSPeng Ma cmd_flags, token);
270f2835adfSPeng Ma
271f2835adfSPeng Ma cmd_params = (struct dpdmai_cmd_queue *)cmd.params;
272f2835adfSPeng Ma cmd_params->dest_id = cpu_to_le32(cfg->dest_cfg.dest_id);
273bd2f66bcSFrank Li cmd_params->dest_priority = cfg->dest_cfg.priority;
274bd2f66bcSFrank Li cmd_params->pri = priority;
275f2835adfSPeng Ma cmd_params->dest_type = cfg->dest_cfg.dest_type;
276f2835adfSPeng Ma cmd_params->user_ctx = cpu_to_le64(cfg->user_ctx);
277f2835adfSPeng Ma cmd_params->options = cpu_to_le32(cfg->options);
278bd2f66bcSFrank Li cmd_params->queue_idx = queue_idx;
279f2835adfSPeng Ma
280f2835adfSPeng Ma /* send command to mc*/
281f2835adfSPeng Ma return mc_send_command(mc_io, &cmd);
282f2835adfSPeng Ma }
28353596dfaSPeng Ma EXPORT_SYMBOL_GPL(dpdmai_set_rx_queue);
284f2835adfSPeng Ma
285f2835adfSPeng Ma /**
286f2835adfSPeng Ma * dpdmai_get_rx_queue() - Retrieve Rx queue attributes.
287f2835adfSPeng Ma * @mc_io: Pointer to MC portal's I/O object
288f2835adfSPeng Ma * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
289f2835adfSPeng Ma * @token: Token of DPDMAI object
29039def87bSFrank Li * @queue_idx: DMA Queue index
291f2835adfSPeng Ma * @priority: Select the queue relative to number of
292f2835adfSPeng Ma * priorities configured at DPDMAI creation
293f2835adfSPeng Ma * @attr: Returned Rx queue attributes
294f2835adfSPeng Ma *
295f2835adfSPeng Ma * Return: '0' on Success; Error code otherwise.
296f2835adfSPeng Ma */
dpdmai_get_rx_queue(struct fsl_mc_io * mc_io,u32 cmd_flags,u16 token,u8 queue_idx,u8 priority,struct dpdmai_rx_queue_attr * attr)297bd2f66bcSFrank Li int dpdmai_get_rx_queue(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, u8 queue_idx,
298f2835adfSPeng Ma u8 priority, struct dpdmai_rx_queue_attr *attr)
299f2835adfSPeng Ma {
300f2835adfSPeng Ma struct dpdmai_cmd_queue *cmd_params;
301f2835adfSPeng Ma struct fsl_mc_command cmd = { 0 };
302f2835adfSPeng Ma int err;
303f2835adfSPeng Ma
304f2835adfSPeng Ma /* prepare command */
305f2835adfSPeng Ma cmd.header = mc_encode_cmd_header(DPDMAI_CMDID_GET_RX_QUEUE,
306f2835adfSPeng Ma cmd_flags, token);
307f2835adfSPeng Ma
308f2835adfSPeng Ma cmd_params = (struct dpdmai_cmd_queue *)cmd.params;
309f2835adfSPeng Ma cmd_params->queue = priority;
310bd2f66bcSFrank Li cmd_params->queue_idx = queue_idx;
311f2835adfSPeng Ma
312f2835adfSPeng Ma /* send command to mc*/
313f2835adfSPeng Ma err = mc_send_command(mc_io, &cmd);
314f2835adfSPeng Ma if (err)
315f2835adfSPeng Ma return err;
316f2835adfSPeng Ma
317f2835adfSPeng Ma /* retrieve response parameters */
318f2835adfSPeng Ma attr->dest_cfg.dest_id = le32_to_cpu(cmd_params->dest_id);
319bd2f66bcSFrank Li attr->dest_cfg.priority = cmd_params->dest_priority;
320bd2f66bcSFrank Li attr->dest_cfg.dest_type = FIELD_GET(DEST_TYPE_MASK, cmd_params->dest_type);
321f2835adfSPeng Ma attr->user_ctx = le64_to_cpu(cmd_params->user_ctx);
322f2835adfSPeng Ma attr->fqid = le32_to_cpu(cmd_params->fqid);
323f2835adfSPeng Ma
324f2835adfSPeng Ma return 0;
325f2835adfSPeng Ma }
32653596dfaSPeng Ma EXPORT_SYMBOL_GPL(dpdmai_get_rx_queue);
327f2835adfSPeng Ma
328f2835adfSPeng Ma /**
329f2835adfSPeng Ma * dpdmai_get_tx_queue() - Retrieve Tx queue attributes.
330f2835adfSPeng Ma * @mc_io: Pointer to MC portal's I/O object
331f2835adfSPeng Ma * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
332f2835adfSPeng Ma * @token: Token of DPDMAI object
33339def87bSFrank Li * @queue_idx: DMA queue index
334f2835adfSPeng Ma * @priority: Select the queue relative to number of
335f2835adfSPeng Ma * priorities configured at DPDMAI creation
33639def87bSFrank Li * @attr: Returned DMA Tx queue attributes
337f2835adfSPeng Ma *
338f2835adfSPeng Ma * Return: '0' on Success; Error code otherwise.
339f2835adfSPeng Ma */
dpdmai_get_tx_queue(struct fsl_mc_io * mc_io,u32 cmd_flags,u16 token,u8 queue_idx,u8 priority,struct dpdmai_tx_queue_attr * attr)340f2835adfSPeng Ma int dpdmai_get_tx_queue(struct fsl_mc_io *mc_io, u32 cmd_flags,
341bd2f66bcSFrank Li u16 token, u8 queue_idx, u8 priority, struct dpdmai_tx_queue_attr *attr)
342f2835adfSPeng Ma {
343f2835adfSPeng Ma struct dpdmai_rsp_get_tx_queue *rsp_params;
344f2835adfSPeng Ma struct dpdmai_cmd_queue *cmd_params;
345f2835adfSPeng Ma struct fsl_mc_command cmd = { 0 };
346f2835adfSPeng Ma int err;
347f2835adfSPeng Ma
348f2835adfSPeng Ma /* prepare command */
349f2835adfSPeng Ma cmd.header = mc_encode_cmd_header(DPDMAI_CMDID_GET_TX_QUEUE,
350f2835adfSPeng Ma cmd_flags, token);
351f2835adfSPeng Ma
352f2835adfSPeng Ma cmd_params = (struct dpdmai_cmd_queue *)cmd.params;
353f2835adfSPeng Ma cmd_params->queue = priority;
354bd2f66bcSFrank Li cmd_params->queue_idx = queue_idx;
355f2835adfSPeng Ma
356f2835adfSPeng Ma /* send command to mc*/
357f2835adfSPeng Ma err = mc_send_command(mc_io, &cmd);
358f2835adfSPeng Ma if (err)
359f2835adfSPeng Ma return err;
360f2835adfSPeng Ma
361f2835adfSPeng Ma /* retrieve response parameters */
362f2835adfSPeng Ma
363f2835adfSPeng Ma rsp_params = (struct dpdmai_rsp_get_tx_queue *)cmd.params;
364bd2f66bcSFrank Li attr->fqid = le32_to_cpu(rsp_params->fqid);
365f2835adfSPeng Ma
366f2835adfSPeng Ma return 0;
367f2835adfSPeng Ma }
36853596dfaSPeng Ma EXPORT_SYMBOL_GPL(dpdmai_get_tx_queue);
36953596dfaSPeng Ma
370*316d1225SJeff Johnson MODULE_DESCRIPTION("NXP DPAA2 QDMA driver");
37153596dfaSPeng Ma MODULE_LICENSE("GPL v2");
372