383649e2690ac1e6a1144141687dc35bb4a36085
[dpdk.git] / drivers / net / dpaa2 / mc / fsl_dpni_cmd.h
1 /*-
2  * This file is provided under a dual BSD/GPLv2 license. When using or
3  * redistributing this file, you may do so under either license.
4  *
5  *   BSD LICENSE
6  *
7  * Copyright 2013-2016 Freescale Semiconductor Inc.
8  * Copyright (c) 2016 NXP.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions are met:
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in the
16  * documentation and/or other materials provided with the distribution.
17  * * Neither the name of the above-listed copyright holders nor the
18  * names of any contributors may be used to endorse or promote products
19  * derived from this software without specific prior written permission.
20  *
21  *   GPL LICENSE SUMMARY
22  *
23  * ALTERNATIVELY, this software may be distributed under the terms of the
24  * GNU General Public License ("GPL") as published by the Free Software
25  * Foundation, either version 2 of that License or (at your option) any
26  * later version.
27  *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
29  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
32  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
33  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
34  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
35  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
36  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
37  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38  * POSSIBILITY OF SUCH DAMAGE.
39  */
40 #ifndef _FSL_DPNI_CMD_H
41 #define _FSL_DPNI_CMD_H
42
43 /* DPNI Version */
44 #define DPNI_VER_MAJOR                          7
45 #define DPNI_VER_MINOR                          0
46
47 /* Command IDs */
48 #define DPNI_CMDID_OPEN                                ((0x801 << 4) | (0x1))
49 #define DPNI_CMDID_CLOSE                               ((0x800 << 4) | (0x1))
50 #define DPNI_CMDID_CREATE                              ((0x901 << 4) | (0x1))
51 #define DPNI_CMDID_DESTROY                             ((0x981 << 4) | (0x1))
52 #define DPNI_CMDID_GET_API_VERSION                     ((0xa01 << 4) | (0x1))
53
54 #define DPNI_CMDID_ENABLE                              ((0x002 << 4) | (0x1))
55 #define DPNI_CMDID_DISABLE                             ((0x003 << 4) | (0x1))
56 #define DPNI_CMDID_GET_ATTR                            ((0x004 << 4) | (0x1))
57 #define DPNI_CMDID_RESET                               ((0x005 << 4) | (0x1))
58 #define DPNI_CMDID_IS_ENABLED                          ((0x006 << 4) | (0x1))
59
60 #define DPNI_CMDID_SET_POOLS                           ((0x200 << 4) | (0x1))
61 #define DPNI_CMDID_SET_ERRORS_BEHAVIOR                 ((0x20B << 4) | (0x1))
62
63 #define DPNI_CMDID_GET_QDID                            ((0x210 << 4) | (0x1))
64 #define DPNI_CMDID_GET_LINK_STATE                      ((0x215 << 4) | (0x1))
65 #define DPNI_CMDID_SET_MAX_FRAME_LENGTH                ((0x216 << 4) | (0x1))
66 #define DPNI_CMDID_GET_MAX_FRAME_LENGTH                ((0x217 << 4) | (0x1))
67
68 #define DPNI_CMDID_SET_UNICAST_PROMISC                 ((0x222 << 4) | (0x1))
69 #define DPNI_CMDID_GET_UNICAST_PROMISC                 ((0x223 << 4) | (0x1))
70 #define DPNI_CMDID_SET_PRIM_MAC                        ((0x224 << 4) | (0x1))
71 #define DPNI_CMDID_GET_PRIM_MAC                        ((0x225 << 4) | (0x1))
72
73 #define DPNI_CMDID_SET_RX_TC_DIST                      ((0x235 << 4) | (0x1))
74
75 #define DPNI_CMDID_GET_STATISTICS                      ((0x25D << 4) | (0x1))
76 #define DPNI_CMDID_RESET_STATISTICS                    ((0x25E << 4) | (0x1))
77 #define DPNI_CMDID_GET_QUEUE                           ((0x25F << 4) | (0x1))
78 #define DPNI_CMDID_SET_QUEUE                           ((0x260 << 4) | (0x1))
79
80 #define DPNI_CMDID_GET_PORT_MAC_ADDR                   ((0x263 << 4) | (0x1))
81
82 #define DPNI_CMDID_GET_BUFFER_LAYOUT                   ((0x264 << 4) | (0x1))
83 #define DPNI_CMDID_SET_BUFFER_LAYOUT                   ((0x265 << 4) | (0x1))
84
85 #define DPNI_CMDID_SET_CONGESTION_NOTIFICATION         ((0x267 << 4) | (0x1))
86 #define DPNI_CMDID_GET_CONGESTION_NOTIFICATION         ((0x268 << 4) | (0x1))
87 #define DPNI_CMDID_GET_OFFLOAD                         ((0x26B << 4) | (0x1))
88 #define DPNI_CMDID_SET_OFFLOAD                         ((0x26C << 4) | (0x1))
89 #define DPNI_CMDID_SET_TX_CONFIRMATION_MODE            ((0x266 << 4) | (0x1))
90 #define DPNI_CMDID_GET_TX_CONFIRMATION_MODE            ((0x26D << 4) | (0x1))
91
92 /*                cmd, param, offset, width, type, arg_name */
93 #define DPNI_CMD_OPEN(cmd, dpni_id) \
94         MC_CMD_OP(cmd,   0,     0,      32,     int,    dpni_id)
95
96 /*                cmd, param, offset, width, type, arg_name */
97 #define DPNI_CMD_CREATE(cmd, cfg) \
98 do { \
99         MC_CMD_OP(cmd, 0,  0, 32, uint32_t,  (cfg)->options); \
100         MC_CMD_OP(cmd, 0, 32,  8,  uint8_t,  (cfg)->num_queues); \
101         MC_CMD_OP(cmd, 0, 40,  8,  uint8_t,  (cfg)->num_tcs); \
102         MC_CMD_OP(cmd, 0, 48,  8,  uint8_t,  (cfg)->mac_filter_entries); \
103         MC_CMD_OP(cmd, 1,  0,  8,  uint8_t,  (cfg)->vlan_filter_entries); \
104         MC_CMD_OP(cmd, 1, 16,  8,  uint8_t,  (cfg)->qos_entries); \
105         MC_CMD_OP(cmd, 1, 32, 16, uint16_t,  (cfg)->fs_entries); \
106 } while (0)
107
108 /*                cmd, param, offset, width, type, arg_name */
109 #define DPNI_CMD_SET_POOLS(cmd, cfg) \
110 do { \
111         MC_CMD_OP(cmd, 0, 0,  8,  uint8_t,  cfg->num_dpbp); \
112         MC_CMD_OP(cmd, 0, 8,  1,  int,      cfg->pools[0].backup_pool); \
113         MC_CMD_OP(cmd, 0, 9,  1,  int,      cfg->pools[1].backup_pool); \
114         MC_CMD_OP(cmd, 0, 10, 1,  int,      cfg->pools[2].backup_pool); \
115         MC_CMD_OP(cmd, 0, 11, 1,  int,      cfg->pools[3].backup_pool); \
116         MC_CMD_OP(cmd, 0, 12, 1,  int,      cfg->pools[4].backup_pool); \
117         MC_CMD_OP(cmd, 0, 13, 1,  int,      cfg->pools[5].backup_pool); \
118         MC_CMD_OP(cmd, 0, 14, 1,  int,      cfg->pools[6].backup_pool); \
119         MC_CMD_OP(cmd, 0, 15, 1,  int,      cfg->pools[7].backup_pool); \
120         MC_CMD_OP(cmd, 0, 32, 32, int,      cfg->pools[0].dpbp_id); \
121         MC_CMD_OP(cmd, 4, 32, 16, uint16_t, cfg->pools[0].buffer_size);\
122         MC_CMD_OP(cmd, 1, 0,  32, int,      cfg->pools[1].dpbp_id); \
123         MC_CMD_OP(cmd, 4, 48, 16, uint16_t, cfg->pools[1].buffer_size);\
124         MC_CMD_OP(cmd, 1, 32, 32, int,      cfg->pools[2].dpbp_id); \
125         MC_CMD_OP(cmd, 5, 0,  16, uint16_t, cfg->pools[2].buffer_size);\
126         MC_CMD_OP(cmd, 2, 0,  32, int,      cfg->pools[3].dpbp_id); \
127         MC_CMD_OP(cmd, 5, 16, 16, uint16_t, cfg->pools[3].buffer_size);\
128         MC_CMD_OP(cmd, 2, 32, 32, int,      cfg->pools[4].dpbp_id); \
129         MC_CMD_OP(cmd, 5, 32, 16, uint16_t, cfg->pools[4].buffer_size);\
130         MC_CMD_OP(cmd, 3, 0,  32, int,      cfg->pools[5].dpbp_id); \
131         MC_CMD_OP(cmd, 5, 48, 16, uint16_t, cfg->pools[5].buffer_size);\
132         MC_CMD_OP(cmd, 3, 32, 32, int,      cfg->pools[6].dpbp_id); \
133         MC_CMD_OP(cmd, 6, 0,  16, uint16_t, cfg->pools[6].buffer_size);\
134         MC_CMD_OP(cmd, 4, 0,  32, int,      cfg->pools[7].dpbp_id); \
135         MC_CMD_OP(cmd, 6, 16, 16, uint16_t, cfg->pools[7].buffer_size);\
136 } while (0)
137
138 /*                cmd, param, offset, width, type, arg_name */
139 #define DPNI_RSP_IS_ENABLED(cmd, en) \
140         MC_RSP_OP(cmd, 0, 0,  1,  int,      en)
141
142 /* DPNI_CMD_GET_ATTR is not used, no input parameters */
143
144 #define DPNI_RSP_GET_ATTR(cmd, attr) \
145 do { \
146         MC_RSP_OP(cmd, 0,  0, 32, uint32_t, (attr)->options); \
147         MC_RSP_OP(cmd, 0, 32,  8, uint8_t,  (attr)->num_queues); \
148         MC_RSP_OP(cmd, 0, 40,  8, uint8_t,  (attr)->num_tcs); \
149         MC_RSP_OP(cmd, 0, 48,  8, uint8_t,  (attr)->mac_filter_entries); \
150         MC_RSP_OP(cmd, 1,  0,  8, uint8_t, (attr)->vlan_filter_entries); \
151         MC_RSP_OP(cmd, 1, 16,  8, uint8_t,  (attr)->qos_entries); \
152         MC_RSP_OP(cmd, 1, 32, 16, uint16_t, (attr)->fs_entries); \
153         MC_RSP_OP(cmd, 2,  0,  8, uint8_t,  (attr)->qos_key_size); \
154         MC_RSP_OP(cmd, 2,  8,  8, uint8_t,  (attr)->fs_key_size); \
155         MC_RSP_OP(cmd, 2, 16, 16, uint16_t, (attr)->wriop_version); \
156 } while (0)
157
158 /*                cmd, param, offset, width, type, arg_name */
159 #define DPNI_CMD_SET_ERRORS_BEHAVIOR(cmd, cfg) \
160 do { \
161         MC_CMD_OP(cmd, 0, 0,  32, uint32_t, cfg->errors); \
162         MC_CMD_OP(cmd, 0, 32, 4,  enum dpni_error_action, cfg->error_action); \
163         MC_CMD_OP(cmd, 0, 36, 1,  int,      cfg->set_frame_annotation); \
164 } while (0)
165
166 #define DPNI_CMD_GET_BUFFER_LAYOUT(cmd, qtype) \
167         MC_CMD_OP(cmd, 0,  0,  8, enum dpni_queue_type, qtype)
168
169 #define DPNI_RSP_GET_BUFFER_LAYOUT(cmd, layout) \
170 do { \
171         MC_RSP_OP(cmd, 0, 48,  1, char, (layout)->pass_timestamp); \
172         MC_RSP_OP(cmd, 0, 49,  1, char, (layout)->pass_parser_result); \
173         MC_RSP_OP(cmd, 0, 50,  1, char, (layout)->pass_frame_status); \
174         MC_RSP_OP(cmd, 1,  0, 16, uint16_t, (layout)->private_data_size); \
175         MC_RSP_OP(cmd, 1, 16, 16, uint16_t, (layout)->data_align); \
176         MC_RSP_OP(cmd, 1, 32, 16, uint16_t, (layout)->data_head_room); \
177         MC_RSP_OP(cmd, 1, 48, 16, uint16_t, (layout)->data_tail_room); \
178 } while (0)
179
180 #define DPNI_CMD_SET_BUFFER_LAYOUT(cmd, qtype, layout) \
181 do { \
182         MC_CMD_OP(cmd, 0,  0,  8, enum dpni_queue_type, qtype); \
183         MC_CMD_OP(cmd, 0, 32, 16, uint16_t, (layout)->options); \
184         MC_CMD_OP(cmd, 0, 48,  1, char, (layout)->pass_timestamp); \
185         MC_CMD_OP(cmd, 0, 49,  1, char, (layout)->pass_parser_result); \
186         MC_CMD_OP(cmd, 0, 50,  1, char, (layout)->pass_frame_status); \
187         MC_CMD_OP(cmd, 1,  0, 16, uint16_t, (layout)->private_data_size); \
188         MC_CMD_OP(cmd, 1, 16, 16, uint16_t, (layout)->data_align); \
189         MC_CMD_OP(cmd, 1, 32, 16, uint16_t, (layout)->data_head_room); \
190         MC_CMD_OP(cmd, 1, 48, 16, uint16_t, (layout)->data_tail_room); \
191 } while (0)
192
193 #define DPNI_CMD_SET_OFFLOAD(cmd, type, config) \
194 do { \
195         MC_CMD_OP(cmd, 0, 24,  8, enum dpni_offload, type); \
196         MC_CMD_OP(cmd, 0, 32, 32, uint32_t, config); \
197 } while (0)
198
199 #define DPNI_CMD_GET_OFFLOAD(cmd, type) \
200         MC_CMD_OP(cmd, 0, 24,  8, enum dpni_offload, type)
201
202 #define DPNI_RSP_GET_OFFLOAD(cmd, config) \
203         MC_RSP_OP(cmd, 0, 32, 32, uint32_t, config)
204
205 #define DPNI_CMD_GET_QDID(cmd, qtype) \
206         MC_CMD_OP(cmd, 0,  0,  8, enum dpni_queue_type, qtype)
207
208 /*                cmd, param, offset, width, type, arg_name */
209 #define DPNI_RSP_GET_QDID(cmd, qdid) \
210         MC_RSP_OP(cmd, 0, 0,  16, uint16_t, qdid)
211
212
213 /*                cmd, param, offset, width, type, arg_name */
214 #define DPNI_CMD_GET_STATISTICS(cmd, page) \
215         MC_CMD_OP(cmd, 0, 0, 8, uint8_t, page)
216
217 #define DPNI_RSP_GET_STATISTICS(cmd, stat) \
218 do { \
219         MC_RSP_OP(cmd, 0, 0, 64, uint64_t, (stat)->raw.counter[0]); \
220         MC_RSP_OP(cmd, 1, 0, 64, uint64_t, (stat)->raw.counter[1]); \
221         MC_RSP_OP(cmd, 2, 0, 64, uint64_t, (stat)->raw.counter[2]); \
222         MC_RSP_OP(cmd, 3, 0, 64, uint64_t, (stat)->raw.counter[3]); \
223         MC_RSP_OP(cmd, 4, 0, 64, uint64_t, (stat)->raw.counter[4]); \
224         MC_RSP_OP(cmd, 5, 0, 64, uint64_t, (stat)->raw.counter[5]); \
225         MC_RSP_OP(cmd, 6, 0, 64, uint64_t, (stat)->raw.counter[6]); \
226 } while (0)
227
228 /*                cmd, param, offset, width, type, arg_name */
229 #define DPNI_RSP_GET_LINK_STATE(cmd, state) \
230 do { \
231         MC_RSP_OP(cmd, 0, 32,  1, int,      state->up);\
232         MC_RSP_OP(cmd, 1, 0,  32, uint32_t, state->rate);\
233         MC_RSP_OP(cmd, 2, 0,  64, uint64_t, state->options);\
234 } while (0)
235
236 /*                cmd, param, offset, width, type, arg_name */
237 #define DPNI_CMD_SET_MAX_FRAME_LENGTH(cmd, max_frame_length) \
238         MC_CMD_OP(cmd, 0, 0,  16, uint16_t, max_frame_length)
239
240 /*                cmd, param, offset, width, type, arg_name */
241 #define DPNI_RSP_GET_MAX_FRAME_LENGTH(cmd, max_frame_length) \
242         MC_RSP_OP(cmd, 0, 0,  16, uint16_t, max_frame_length)
243
244 /*                cmd, param, offset, width, type, arg_name */
245 #define DPNI_CMD_SET_UNICAST_PROMISC(cmd, en) \
246         MC_CMD_OP(cmd, 0, 0,  1,  int,      en)
247
248 /*                cmd, param, offset, width, type, arg_name */
249 #define DPNI_RSP_GET_UNICAST_PROMISC(cmd, en) \
250         MC_RSP_OP(cmd, 0, 0,  1,  int,      en)
251
252 /*                cmd, param, offset, width, type, arg_name */
253 #define DPNI_CMD_SET_PRIMARY_MAC_ADDR(cmd, mac_addr) \
254 do { \
255         MC_CMD_OP(cmd, 0, 16, 8,  uint8_t,  mac_addr[5]); \
256         MC_CMD_OP(cmd, 0, 24, 8,  uint8_t,  mac_addr[4]); \
257         MC_CMD_OP(cmd, 0, 32, 8,  uint8_t,  mac_addr[3]); \
258         MC_CMD_OP(cmd, 0, 40, 8,  uint8_t,  mac_addr[2]); \
259         MC_CMD_OP(cmd, 0, 48, 8,  uint8_t,  mac_addr[1]); \
260         MC_CMD_OP(cmd, 0, 56, 8,  uint8_t,  mac_addr[0]); \
261 } while (0)
262
263 /*                cmd, param, offset, width, type, arg_name */
264 #define DPNI_RSP_GET_PRIMARY_MAC_ADDR(cmd, mac_addr) \
265 do { \
266         MC_RSP_OP(cmd, 0, 16, 8,  uint8_t,  mac_addr[5]); \
267         MC_RSP_OP(cmd, 0, 24, 8,  uint8_t,  mac_addr[4]); \
268         MC_RSP_OP(cmd, 0, 32, 8,  uint8_t,  mac_addr[3]); \
269         MC_RSP_OP(cmd, 0, 40, 8,  uint8_t,  mac_addr[2]); \
270         MC_RSP_OP(cmd, 0, 48, 8,  uint8_t,  mac_addr[1]); \
271         MC_RSP_OP(cmd, 0, 56, 8,  uint8_t,  mac_addr[0]); \
272 } while (0)
273
274
275 /*                cmd, param, offset, width, type, arg_name */
276 #define DPNI_CMD_SET_RX_TC_DIST(cmd, tc_id, cfg) \
277 do { \
278         MC_CMD_OP(cmd, 0, 0,  16, uint16_t,  cfg->dist_size); \
279         MC_CMD_OP(cmd, 0, 16, 8,  uint8_t,  tc_id); \
280         MC_CMD_OP(cmd, 0, 24, 4,  enum dpni_dist_mode, cfg->dist_mode); \
281         MC_CMD_OP(cmd, 0, 28, 4,  enum dpni_fs_miss_action, \
282                                                   cfg->fs_cfg.miss_action); \
283         MC_CMD_OP(cmd, 0, 48, 16, uint16_t, cfg->fs_cfg.default_flow_id); \
284         MC_CMD_OP(cmd, 6, 0,  64, uint64_t, cfg->key_cfg_iova); \
285 } while (0)
286
287 #define DPNI_CMD_GET_QUEUE(cmd, qtype, tc, index) \
288 do { \
289         MC_CMD_OP(cmd, 0,  0,  8, enum dpni_queue_type, qtype); \
290         MC_CMD_OP(cmd, 0,  8,  8,  uint8_t, tc); \
291         MC_CMD_OP(cmd, 0, 16,  8,  uint8_t, index); \
292 } while (0)
293
294 #define DPNI_RSP_GET_QUEUE(cmd, queue, queue_id) \
295 do { \
296         MC_RSP_OP(cmd, 1,  0, 32, uint32_t, (queue)->destination.id); \
297         MC_RSP_OP(cmd, 1, 48,  8, uint8_t, (queue)->destination.priority); \
298         MC_RSP_OP(cmd, 1, 56,  4, enum dpni_dest, (queue)->destination.type); \
299         MC_RSP_OP(cmd, 1, 62,  1, char, (queue)->flc.stash_control); \
300         MC_RSP_OP(cmd, 1, 63,  1, char, (queue)->destination.hold_active); \
301         MC_RSP_OP(cmd, 2,  0, 64, uint64_t, (queue)->flc.value); \
302         MC_RSP_OP(cmd, 3,  0, 64, uint64_t, (queue)->user_context); \
303         MC_RSP_OP(cmd, 4,  0, 32, uint32_t, (queue_id)->fqid); \
304         MC_RSP_OP(cmd, 4, 32, 16, uint16_t, (queue_id)->qdbin); \
305 } while (0)
306
307 #define DPNI_CMD_SET_QUEUE(cmd, qtype, tc, index, options, queue) \
308 do { \
309         MC_CMD_OP(cmd, 0,  0,  8, enum dpni_queue_type, qtype); \
310         MC_CMD_OP(cmd, 0,  8,  8,  uint8_t, tc); \
311         MC_CMD_OP(cmd, 0, 16,  8,  uint8_t, index); \
312         MC_CMD_OP(cmd, 0, 24,  8,  uint8_t, options); \
313         MC_CMD_OP(cmd, 1,  0, 32, uint32_t, (queue)->destination.id); \
314         MC_CMD_OP(cmd, 1, 48,  8, uint8_t, (queue)->destination.priority); \
315         MC_CMD_OP(cmd, 1, 56,  4, enum dpni_dest, (queue)->destination.type); \
316         MC_CMD_OP(cmd, 1, 62,  1, char, (queue)->flc.stash_control); \
317         MC_CMD_OP(cmd, 1, 63,  1, char, (queue)->destination.hold_active); \
318         MC_CMD_OP(cmd, 2,  0, 64, uint64_t, (queue)->flc.value); \
319         MC_CMD_OP(cmd, 3,  0, 64, uint64_t, (queue)->user_context); \
320 } while (0)
321
322 /*                cmd, param, offset, width, type,      arg_name */
323 #define DPNI_RSP_GET_API_VERSION(cmd, major, minor) \
324 do { \
325         MC_RSP_OP(cmd, 0, 0,  16, uint16_t, major);\
326         MC_RSP_OP(cmd, 0, 16, 16, uint16_t, minor);\
327 } while (0)
328
329
330 #define DPNI_CMD_SET_TX_CONFIRMATION_MODE(cmd, mode) \
331         MC_CMD_OP(cmd, 0, 32, 8, enum dpni_confirmation_mode, mode)
332
333 #define DPNI_RSP_GET_TX_CONFIRMATION_MODE(cmd, mode) \
334         MC_RSP_OP(cmd, 0, 32, 8, enum dpni_confirmation_mode, mode)
335
336 #define DPNI_CMD_SET_CONGESTION_NOTIFICATION(cmd, qtype, tc, cfg) \
337 do { \
338         MC_CMD_OP(cmd, 0,  0,  8, enum dpni_queue_type, qtype); \
339         MC_CMD_OP(cmd, 0,  8,  8, uint8_t, tc); \
340         MC_CMD_OP(cmd, 1,  0, 32, uint32_t, (cfg)->dest_cfg.dest_id); \
341         MC_CMD_OP(cmd, 1, 32, 16, uint16_t, (cfg)->notification_mode); \
342         MC_CMD_OP(cmd, 1, 48,  8, uint8_t, (cfg)->dest_cfg.priority); \
343         MC_CMD_OP(cmd, 1, 56,  4, enum dpni_dest, (cfg)->dest_cfg.dest_type); \
344         MC_CMD_OP(cmd, 1, 60,  2, enum dpni_congestion_unit, (cfg)->units); \
345         MC_CMD_OP(cmd, 2,  0, 64, uint64_t, (cfg)->message_iova); \
346         MC_CMD_OP(cmd, 3,  0, 64, uint64_t, (cfg)->message_ctx); \
347         MC_CMD_OP(cmd, 4,  0, 32, uint32_t, (cfg)->threshold_entry); \
348         MC_CMD_OP(cmd, 4, 32, 32, uint32_t, (cfg)->threshold_exit); \
349 } while (0)
350
351 #define DPNI_CMD_GET_CONGESTION_NOTIFICATION(cmd, qtype, tc) \
352 do { \
353         MC_CMD_OP(cmd, 0,  0,  8, enum dpni_queue_type, qtype); \
354         MC_CMD_OP(cmd, 0,  8,  8, uint8_t, tc); \
355 } while (0)
356
357 #define DPNI_RSP_GET_CONGESTION_NOTIFICATION(cmd, cfg) \
358 do { \
359         MC_RSP_OP(cmd, 1,  0, 32, uint32_t, (cfg)->dest_cfg.dest_id); \
360         MC_RSP_OP(cmd, 1,  0, 16, uint16_t, (cfg)->notification_mode); \
361         MC_RSP_OP(cmd, 1, 48,  8, uint8_t, (cfg)->dest_cfg.priority); \
362         MC_RSP_OP(cmd, 1, 56,  4, enum dpni_dest, (cfg)->dest_cfg.dest_type); \
363         MC_RSP_OP(cmd, 1, 60,  2, enum dpni_congestion_unit, (cfg)->units); \
364         MC_RSP_OP(cmd, 2,  0, 64, uint64_t, (cfg)->message_iova); \
365         MC_RSP_OP(cmd, 3,  0, 64, uint64_t, (cfg)->message_ctx); \
366         MC_RSP_OP(cmd, 4,  0, 32, uint32_t, (cfg)->threshold_entry); \
367         MC_RSP_OP(cmd, 4, 32, 32, uint32_t, (cfg)->threshold_exit); \
368 } while (0)
369
370 #endif /* _FSL_DPNI_CMD_H */