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.
7 * Copyright 2013-2016 Freescale Semiconductor Inc.
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.
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
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.
40 #ifndef _FSL_DPNI_CMD_H
41 #define _FSL_DPNI_CMD_H
44 #define DPNI_VER_MAJOR 7
45 #define DPNI_VER_MINOR 0
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))
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))
60 #define DPNI_CMDID_SET_POOLS ((0x200 << 4) | (0x1))
61 #define DPNI_CMDID_SET_ERRORS_BEHAVIOR ((0x20B << 4) | (0x1))
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 #define DPNI_CMDID_SET_LINK_CFG ((0x21a << 4) | (0x1))
69 #define DPNI_CMDID_SET_MCAST_PROMISC ((0x220 << 4) | (0x1))
70 #define DPNI_CMDID_GET_MCAST_PROMISC ((0x221 << 4) | (0x1))
71 #define DPNI_CMDID_SET_UNICAST_PROMISC ((0x222 << 4) | (0x1))
72 #define DPNI_CMDID_GET_UNICAST_PROMISC ((0x223 << 4) | (0x1))
73 #define DPNI_CMDID_SET_PRIM_MAC ((0x224 << 4) | (0x1))
74 #define DPNI_CMDID_GET_PRIM_MAC ((0x225 << 4) | (0x1))
75 #define DPNI_CMDID_ADD_MAC_ADDR ((0x226 << 4) | (0x1))
76 #define DPNI_CMDID_REMOVE_MAC_ADDR ((0x227 << 4) | (0x1))
77 #define DPNI_CMDID_CLR_MAC_FILTERS ((0x228 << 4) | (0x1))
79 #define DPNI_CMDID_ENABLE_VLAN_FILTER ((0x230 << 4) | (0x1))
80 #define DPNI_CMDID_ADD_VLAN_ID ((0x231 << 4) | (0x1))
81 #define DPNI_CMDID_REMOVE_VLAN_ID ((0x232 << 4) | (0x1))
82 #define DPNI_CMDID_CLR_VLAN_FILTERS ((0x233 << 4) | (0x1))
84 #define DPNI_CMDID_SET_RX_TC_DIST ((0x235 << 4) | (0x1))
86 #define DPNI_CMDID_GET_STATISTICS ((0x25D << 4) | (0x1))
87 #define DPNI_CMDID_RESET_STATISTICS ((0x25E << 4) | (0x1))
88 #define DPNI_CMDID_GET_QUEUE ((0x25F << 4) | (0x1))
89 #define DPNI_CMDID_SET_QUEUE ((0x260 << 4) | (0x1))
90 #define DPNI_CMDID_GET_TAILDROP ((0x261 << 4) | (0x1))
91 #define DPNI_CMDID_SET_TAILDROP ((0x262 << 4) | (0x1))
93 #define DPNI_CMDID_GET_PORT_MAC_ADDR ((0x263 << 4) | (0x1))
95 #define DPNI_CMDID_GET_BUFFER_LAYOUT ((0x264 << 4) | (0x1))
96 #define DPNI_CMDID_SET_BUFFER_LAYOUT ((0x265 << 4) | (0x1))
98 #define DPNI_CMDID_SET_CONGESTION_NOTIFICATION ((0x267 << 4) | (0x1))
99 #define DPNI_CMDID_GET_CONGESTION_NOTIFICATION ((0x268 << 4) | (0x1))
100 #define DPNI_CMDID_GET_OFFLOAD ((0x26B << 4) | (0x1))
101 #define DPNI_CMDID_SET_OFFLOAD ((0x26C << 4) | (0x1))
102 #define DPNI_CMDID_SET_TX_CONFIRMATION_MODE ((0x266 << 4) | (0x1))
103 #define DPNI_CMDID_GET_TX_CONFIRMATION_MODE ((0x26D << 4) | (0x1))
105 /* cmd, param, offset, width, type, arg_name */
106 #define DPNI_CMD_OPEN(cmd, dpni_id) \
107 MC_CMD_OP(cmd, 0, 0, 32, int, dpni_id)
109 /* cmd, param, offset, width, type, arg_name */
110 #define DPNI_CMD_CREATE(cmd, cfg) \
112 MC_CMD_OP(cmd, 0, 0, 32, uint32_t, (cfg)->options); \
113 MC_CMD_OP(cmd, 0, 32, 8, uint8_t, (cfg)->num_queues); \
114 MC_CMD_OP(cmd, 0, 40, 8, uint8_t, (cfg)->num_tcs); \
115 MC_CMD_OP(cmd, 0, 48, 8, uint8_t, (cfg)->mac_filter_entries); \
116 MC_CMD_OP(cmd, 1, 0, 8, uint8_t, (cfg)->vlan_filter_entries); \
117 MC_CMD_OP(cmd, 1, 16, 8, uint8_t, (cfg)->qos_entries); \
118 MC_CMD_OP(cmd, 1, 32, 16, uint16_t, (cfg)->fs_entries); \
121 /* cmd, param, offset, width, type, arg_name */
122 #define DPNI_CMD_SET_POOLS(cmd, cfg) \
124 MC_CMD_OP(cmd, 0, 0, 8, uint8_t, cfg->num_dpbp); \
125 MC_CMD_OP(cmd, 0, 8, 1, int, cfg->pools[0].backup_pool); \
126 MC_CMD_OP(cmd, 0, 9, 1, int, cfg->pools[1].backup_pool); \
127 MC_CMD_OP(cmd, 0, 10, 1, int, cfg->pools[2].backup_pool); \
128 MC_CMD_OP(cmd, 0, 11, 1, int, cfg->pools[3].backup_pool); \
129 MC_CMD_OP(cmd, 0, 12, 1, int, cfg->pools[4].backup_pool); \
130 MC_CMD_OP(cmd, 0, 13, 1, int, cfg->pools[5].backup_pool); \
131 MC_CMD_OP(cmd, 0, 14, 1, int, cfg->pools[6].backup_pool); \
132 MC_CMD_OP(cmd, 0, 15, 1, int, cfg->pools[7].backup_pool); \
133 MC_CMD_OP(cmd, 0, 32, 32, int, cfg->pools[0].dpbp_id); \
134 MC_CMD_OP(cmd, 4, 32, 16, uint16_t, cfg->pools[0].buffer_size);\
135 MC_CMD_OP(cmd, 1, 0, 32, int, cfg->pools[1].dpbp_id); \
136 MC_CMD_OP(cmd, 4, 48, 16, uint16_t, cfg->pools[1].buffer_size);\
137 MC_CMD_OP(cmd, 1, 32, 32, int, cfg->pools[2].dpbp_id); \
138 MC_CMD_OP(cmd, 5, 0, 16, uint16_t, cfg->pools[2].buffer_size);\
139 MC_CMD_OP(cmd, 2, 0, 32, int, cfg->pools[3].dpbp_id); \
140 MC_CMD_OP(cmd, 5, 16, 16, uint16_t, cfg->pools[3].buffer_size);\
141 MC_CMD_OP(cmd, 2, 32, 32, int, cfg->pools[4].dpbp_id); \
142 MC_CMD_OP(cmd, 5, 32, 16, uint16_t, cfg->pools[4].buffer_size);\
143 MC_CMD_OP(cmd, 3, 0, 32, int, cfg->pools[5].dpbp_id); \
144 MC_CMD_OP(cmd, 5, 48, 16, uint16_t, cfg->pools[5].buffer_size);\
145 MC_CMD_OP(cmd, 3, 32, 32, int, cfg->pools[6].dpbp_id); \
146 MC_CMD_OP(cmd, 6, 0, 16, uint16_t, cfg->pools[6].buffer_size);\
147 MC_CMD_OP(cmd, 4, 0, 32, int, cfg->pools[7].dpbp_id); \
148 MC_CMD_OP(cmd, 6, 16, 16, uint16_t, cfg->pools[7].buffer_size);\
151 /* cmd, param, offset, width, type, arg_name */
152 #define DPNI_RSP_IS_ENABLED(cmd, en) \
153 MC_RSP_OP(cmd, 0, 0, 1, int, en)
155 /* DPNI_CMD_GET_ATTR is not used, no input parameters */
157 #define DPNI_RSP_GET_ATTR(cmd, attr) \
159 MC_RSP_OP(cmd, 0, 0, 32, uint32_t, (attr)->options); \
160 MC_RSP_OP(cmd, 0, 32, 8, uint8_t, (attr)->num_queues); \
161 MC_RSP_OP(cmd, 0, 40, 8, uint8_t, (attr)->num_tcs); \
162 MC_RSP_OP(cmd, 0, 48, 8, uint8_t, (attr)->mac_filter_entries); \
163 MC_RSP_OP(cmd, 1, 0, 8, uint8_t, (attr)->vlan_filter_entries); \
164 MC_RSP_OP(cmd, 1, 16, 8, uint8_t, (attr)->qos_entries); \
165 MC_RSP_OP(cmd, 1, 32, 16, uint16_t, (attr)->fs_entries); \
166 MC_RSP_OP(cmd, 2, 0, 8, uint8_t, (attr)->qos_key_size); \
167 MC_RSP_OP(cmd, 2, 8, 8, uint8_t, (attr)->fs_key_size); \
168 MC_RSP_OP(cmd, 2, 16, 16, uint16_t, (attr)->wriop_version); \
171 /* cmd, param, offset, width, type, arg_name */
172 #define DPNI_CMD_SET_ERRORS_BEHAVIOR(cmd, cfg) \
174 MC_CMD_OP(cmd, 0, 0, 32, uint32_t, cfg->errors); \
175 MC_CMD_OP(cmd, 0, 32, 4, enum dpni_error_action, cfg->error_action); \
176 MC_CMD_OP(cmd, 0, 36, 1, int, cfg->set_frame_annotation); \
179 #define DPNI_CMD_GET_BUFFER_LAYOUT(cmd, qtype) \
180 MC_CMD_OP(cmd, 0, 0, 8, enum dpni_queue_type, qtype)
182 #define DPNI_RSP_GET_BUFFER_LAYOUT(cmd, layout) \
184 MC_RSP_OP(cmd, 0, 48, 1, char, (layout)->pass_timestamp); \
185 MC_RSP_OP(cmd, 0, 49, 1, char, (layout)->pass_parser_result); \
186 MC_RSP_OP(cmd, 0, 50, 1, char, (layout)->pass_frame_status); \
187 MC_RSP_OP(cmd, 1, 0, 16, uint16_t, (layout)->private_data_size); \
188 MC_RSP_OP(cmd, 1, 16, 16, uint16_t, (layout)->data_align); \
189 MC_RSP_OP(cmd, 1, 32, 16, uint16_t, (layout)->data_head_room); \
190 MC_RSP_OP(cmd, 1, 48, 16, uint16_t, (layout)->data_tail_room); \
193 #define DPNI_CMD_SET_BUFFER_LAYOUT(cmd, qtype, layout) \
195 MC_CMD_OP(cmd, 0, 0, 8, enum dpni_queue_type, qtype); \
196 MC_CMD_OP(cmd, 0, 32, 16, uint16_t, (layout)->options); \
197 MC_CMD_OP(cmd, 0, 48, 1, char, (layout)->pass_timestamp); \
198 MC_CMD_OP(cmd, 0, 49, 1, char, (layout)->pass_parser_result); \
199 MC_CMD_OP(cmd, 0, 50, 1, char, (layout)->pass_frame_status); \
200 MC_CMD_OP(cmd, 1, 0, 16, uint16_t, (layout)->private_data_size); \
201 MC_CMD_OP(cmd, 1, 16, 16, uint16_t, (layout)->data_align); \
202 MC_CMD_OP(cmd, 1, 32, 16, uint16_t, (layout)->data_head_room); \
203 MC_CMD_OP(cmd, 1, 48, 16, uint16_t, (layout)->data_tail_room); \
206 #define DPNI_CMD_SET_OFFLOAD(cmd, type, config) \
208 MC_CMD_OP(cmd, 0, 24, 8, enum dpni_offload, type); \
209 MC_CMD_OP(cmd, 0, 32, 32, uint32_t, config); \
212 #define DPNI_CMD_GET_OFFLOAD(cmd, type) \
213 MC_CMD_OP(cmd, 0, 24, 8, enum dpni_offload, type)
215 #define DPNI_RSP_GET_OFFLOAD(cmd, config) \
216 MC_RSP_OP(cmd, 0, 32, 32, uint32_t, config)
218 #define DPNI_CMD_GET_QDID(cmd, qtype) \
219 MC_CMD_OP(cmd, 0, 0, 8, enum dpni_queue_type, qtype)
221 /* cmd, param, offset, width, type, arg_name */
222 #define DPNI_RSP_GET_QDID(cmd, qdid) \
223 MC_RSP_OP(cmd, 0, 0, 16, uint16_t, qdid)
226 /* cmd, param, offset, width, type, arg_name */
227 #define DPNI_CMD_GET_STATISTICS(cmd, page) \
228 MC_CMD_OP(cmd, 0, 0, 8, uint8_t, page)
230 #define DPNI_RSP_GET_STATISTICS(cmd, stat) \
232 MC_RSP_OP(cmd, 0, 0, 64, uint64_t, (stat)->raw.counter[0]); \
233 MC_RSP_OP(cmd, 1, 0, 64, uint64_t, (stat)->raw.counter[1]); \
234 MC_RSP_OP(cmd, 2, 0, 64, uint64_t, (stat)->raw.counter[2]); \
235 MC_RSP_OP(cmd, 3, 0, 64, uint64_t, (stat)->raw.counter[3]); \
236 MC_RSP_OP(cmd, 4, 0, 64, uint64_t, (stat)->raw.counter[4]); \
237 MC_RSP_OP(cmd, 5, 0, 64, uint64_t, (stat)->raw.counter[5]); \
238 MC_RSP_OP(cmd, 6, 0, 64, uint64_t, (stat)->raw.counter[6]); \
241 /* cmd, param, offset, width, type, arg_name */
242 #define DPNI_CMD_SET_LINK_CFG(cmd, cfg) \
244 MC_CMD_OP(cmd, 1, 0, 32, uint32_t, cfg->rate);\
245 MC_CMD_OP(cmd, 2, 0, 64, uint64_t, cfg->options);\
248 /* cmd, param, offset, width, type, arg_name */
249 #define DPNI_RSP_GET_LINK_STATE(cmd, state) \
251 MC_RSP_OP(cmd, 0, 32, 1, int, state->up);\
252 MC_RSP_OP(cmd, 1, 0, 32, uint32_t, state->rate);\
253 MC_RSP_OP(cmd, 2, 0, 64, uint64_t, state->options);\
256 /* cmd, param, offset, width, type, arg_name */
257 #define DPNI_CMD_SET_MAX_FRAME_LENGTH(cmd, max_frame_length) \
258 MC_CMD_OP(cmd, 0, 0, 16, uint16_t, max_frame_length)
260 /* cmd, param, offset, width, type, arg_name */
261 #define DPNI_RSP_GET_MAX_FRAME_LENGTH(cmd, max_frame_length) \
262 MC_RSP_OP(cmd, 0, 0, 16, uint16_t, max_frame_length)
264 /* cmd, param, offset, width, type, arg_name */
265 #define DPNI_CMD_SET_MULTICAST_PROMISC(cmd, en) \
266 MC_CMD_OP(cmd, 0, 0, 1, int, en)
268 /* cmd, param, offset, width, type, arg_name */
269 #define DPNI_RSP_GET_MULTICAST_PROMISC(cmd, en) \
270 MC_RSP_OP(cmd, 0, 0, 1, int, en)
272 /* cmd, param, offset, width, type, arg_name */
273 #define DPNI_CMD_SET_UNICAST_PROMISC(cmd, en) \
274 MC_CMD_OP(cmd, 0, 0, 1, int, en)
276 /* cmd, param, offset, width, type, arg_name */
277 #define DPNI_RSP_GET_UNICAST_PROMISC(cmd, en) \
278 MC_RSP_OP(cmd, 0, 0, 1, int, en)
280 /* cmd, param, offset, width, type, arg_name */
281 #define DPNI_CMD_SET_PRIMARY_MAC_ADDR(cmd, mac_addr) \
283 MC_CMD_OP(cmd, 0, 16, 8, uint8_t, mac_addr[5]); \
284 MC_CMD_OP(cmd, 0, 24, 8, uint8_t, mac_addr[4]); \
285 MC_CMD_OP(cmd, 0, 32, 8, uint8_t, mac_addr[3]); \
286 MC_CMD_OP(cmd, 0, 40, 8, uint8_t, mac_addr[2]); \
287 MC_CMD_OP(cmd, 0, 48, 8, uint8_t, mac_addr[1]); \
288 MC_CMD_OP(cmd, 0, 56, 8, uint8_t, mac_addr[0]); \
291 /* cmd, param, offset, width, type, arg_name */
292 #define DPNI_RSP_GET_PRIMARY_MAC_ADDR(cmd, mac_addr) \
294 MC_RSP_OP(cmd, 0, 16, 8, uint8_t, mac_addr[5]); \
295 MC_RSP_OP(cmd, 0, 24, 8, uint8_t, mac_addr[4]); \
296 MC_RSP_OP(cmd, 0, 32, 8, uint8_t, mac_addr[3]); \
297 MC_RSP_OP(cmd, 0, 40, 8, uint8_t, mac_addr[2]); \
298 MC_RSP_OP(cmd, 0, 48, 8, uint8_t, mac_addr[1]); \
299 MC_RSP_OP(cmd, 0, 56, 8, uint8_t, mac_addr[0]); \
302 #define DPNI_RSP_GET_PORT_MAC_ADDR(cmd, mac_addr) \
304 MC_RSP_OP(cmd, 0, 16, 8, uint8_t, mac_addr[5]); \
305 MC_RSP_OP(cmd, 0, 24, 8, uint8_t, mac_addr[4]); \
306 MC_RSP_OP(cmd, 0, 32, 8, uint8_t, mac_addr[3]); \
307 MC_RSP_OP(cmd, 0, 40, 8, uint8_t, mac_addr[2]); \
308 MC_RSP_OP(cmd, 0, 48, 8, uint8_t, mac_addr[1]); \
309 MC_RSP_OP(cmd, 0, 56, 8, uint8_t, mac_addr[0]); \
312 /* cmd, param, offset, width, type, arg_name */
313 #define DPNI_CMD_ADD_MAC_ADDR(cmd, mac_addr) \
315 MC_CMD_OP(cmd, 0, 16, 8, uint8_t, mac_addr[5]); \
316 MC_CMD_OP(cmd, 0, 24, 8, uint8_t, mac_addr[4]); \
317 MC_CMD_OP(cmd, 0, 32, 8, uint8_t, mac_addr[3]); \
318 MC_CMD_OP(cmd, 0, 40, 8, uint8_t, mac_addr[2]); \
319 MC_CMD_OP(cmd, 0, 48, 8, uint8_t, mac_addr[1]); \
320 MC_CMD_OP(cmd, 0, 56, 8, uint8_t, mac_addr[0]); \
323 /* cmd, param, offset, width, type, arg_name */
324 #define DPNI_CMD_REMOVE_MAC_ADDR(cmd, mac_addr) \
326 MC_CMD_OP(cmd, 0, 16, 8, uint8_t, mac_addr[5]); \
327 MC_CMD_OP(cmd, 0, 24, 8, uint8_t, mac_addr[4]); \
328 MC_CMD_OP(cmd, 0, 32, 8, uint8_t, mac_addr[3]); \
329 MC_CMD_OP(cmd, 0, 40, 8, uint8_t, mac_addr[2]); \
330 MC_CMD_OP(cmd, 0, 48, 8, uint8_t, mac_addr[1]); \
331 MC_CMD_OP(cmd, 0, 56, 8, uint8_t, mac_addr[0]); \
334 /* cmd, param, offset, width, type, arg_name */
335 #define DPNI_CMD_CLEAR_MAC_FILTERS(cmd, unicast, multicast) \
337 MC_CMD_OP(cmd, 0, 0, 1, int, unicast); \
338 MC_CMD_OP(cmd, 0, 1, 1, int, multicast); \
341 /* cmd, param, offset, width, type, arg_name */
342 #define DPNI_CMD_ENABLE_VLAN_FILTER(cmd, en) \
343 MC_CMD_OP(cmd, 0, 0, 1, int, en)
345 /* cmd, param, offset, width, type, arg_name */
346 #define DPNI_CMD_ADD_VLAN_ID(cmd, vlan_id) \
347 MC_CMD_OP(cmd, 0, 32, 16, uint16_t, vlan_id)
349 /* cmd, param, offset, width, type, arg_name */
350 #define DPNI_CMD_REMOVE_VLAN_ID(cmd, vlan_id) \
351 MC_CMD_OP(cmd, 0, 32, 16, uint16_t, vlan_id)
354 /* cmd, param, offset, width, type, arg_name */
355 #define DPNI_CMD_SET_RX_TC_DIST(cmd, tc_id, cfg) \
357 MC_CMD_OP(cmd, 0, 0, 16, uint16_t, cfg->dist_size); \
358 MC_CMD_OP(cmd, 0, 16, 8, uint8_t, tc_id); \
359 MC_CMD_OP(cmd, 0, 24, 4, enum dpni_dist_mode, cfg->dist_mode); \
360 MC_CMD_OP(cmd, 0, 28, 4, enum dpni_fs_miss_action, \
361 cfg->fs_cfg.miss_action); \
362 MC_CMD_OP(cmd, 0, 48, 16, uint16_t, cfg->fs_cfg.default_flow_id); \
363 MC_CMD_OP(cmd, 6, 0, 64, uint64_t, cfg->key_cfg_iova); \
366 #define DPNI_CMD_GET_QUEUE(cmd, qtype, tc, index) \
368 MC_CMD_OP(cmd, 0, 0, 8, enum dpni_queue_type, qtype); \
369 MC_CMD_OP(cmd, 0, 8, 8, uint8_t, tc); \
370 MC_CMD_OP(cmd, 0, 16, 8, uint8_t, index); \
373 #define DPNI_RSP_GET_QUEUE(cmd, queue, queue_id) \
375 MC_RSP_OP(cmd, 1, 0, 32, uint32_t, (queue)->destination.id); \
376 MC_RSP_OP(cmd, 1, 48, 8, uint8_t, (queue)->destination.priority); \
377 MC_RSP_OP(cmd, 1, 56, 4, enum dpni_dest, (queue)->destination.type); \
378 MC_RSP_OP(cmd, 1, 62, 1, char, (queue)->flc.stash_control); \
379 MC_RSP_OP(cmd, 1, 63, 1, char, (queue)->destination.hold_active); \
380 MC_RSP_OP(cmd, 2, 0, 64, uint64_t, (queue)->flc.value); \
381 MC_RSP_OP(cmd, 3, 0, 64, uint64_t, (queue)->user_context); \
382 MC_RSP_OP(cmd, 4, 0, 32, uint32_t, (queue_id)->fqid); \
383 MC_RSP_OP(cmd, 4, 32, 16, uint16_t, (queue_id)->qdbin); \
386 #define DPNI_CMD_SET_QUEUE(cmd, qtype, tc, index, options, queue) \
388 MC_CMD_OP(cmd, 0, 0, 8, enum dpni_queue_type, qtype); \
389 MC_CMD_OP(cmd, 0, 8, 8, uint8_t, tc); \
390 MC_CMD_OP(cmd, 0, 16, 8, uint8_t, index); \
391 MC_CMD_OP(cmd, 0, 24, 8, uint8_t, options); \
392 MC_CMD_OP(cmd, 1, 0, 32, uint32_t, (queue)->destination.id); \
393 MC_CMD_OP(cmd, 1, 48, 8, uint8_t, (queue)->destination.priority); \
394 MC_CMD_OP(cmd, 1, 56, 4, enum dpni_dest, (queue)->destination.type); \
395 MC_CMD_OP(cmd, 1, 62, 1, char, (queue)->flc.stash_control); \
396 MC_CMD_OP(cmd, 1, 63, 1, char, (queue)->destination.hold_active); \
397 MC_CMD_OP(cmd, 2, 0, 64, uint64_t, (queue)->flc.value); \
398 MC_CMD_OP(cmd, 3, 0, 64, uint64_t, (queue)->user_context); \
401 /* cmd, param, offset, width, type, arg_name */
402 #define DPNI_RSP_GET_API_VERSION(cmd, major, minor) \
404 MC_RSP_OP(cmd, 0, 0, 16, uint16_t, major);\
405 MC_RSP_OP(cmd, 0, 16, 16, uint16_t, minor);\
408 #define DPNI_CMD_GET_TAILDROP(cmd, cp, q_type, tc, q_index) \
410 MC_CMD_OP(cmd, 0, 0, 8, enum dpni_congestion_point, cp); \
411 MC_CMD_OP(cmd, 0, 8, 8, enum dpni_queue_type, q_type); \
412 MC_CMD_OP(cmd, 0, 16, 8, uint8_t, tc); \
413 MC_CMD_OP(cmd, 0, 24, 8, uint8_t, q_index); \
416 #define DPNI_RSP_GET_TAILDROP(cmd, taildrop) \
418 MC_RSP_OP(cmd, 1, 0, 1, char, (taildrop)->enable); \
419 MC_RSP_OP(cmd, 1, 16, 8, enum dpni_congestion_unit, \
420 (taildrop)->units); \
421 MC_RSP_OP(cmd, 1, 32, 32, uint32_t, (taildrop)->threshold); \
424 #define DPNI_CMD_SET_TAILDROP(cmd, cp, q_type, tc, q_index, taildrop) \
426 MC_CMD_OP(cmd, 0, 0, 8, enum dpni_congestion_point, cp); \
427 MC_CMD_OP(cmd, 0, 8, 8, enum dpni_queue_type, q_type); \
428 MC_CMD_OP(cmd, 0, 16, 8, uint8_t, tc); \
429 MC_CMD_OP(cmd, 0, 24, 8, uint8_t, q_index); \
430 MC_CMD_OP(cmd, 1, 0, 1, char, (taildrop)->enable); \
431 MC_CMD_OP(cmd, 1, 16, 8, enum dpni_congestion_unit, \
432 (taildrop)->units); \
433 MC_CMD_OP(cmd, 1, 32, 32, uint32_t, (taildrop)->threshold); \
436 #define DPNI_CMD_SET_TX_CONFIRMATION_MODE(cmd, mode) \
437 MC_CMD_OP(cmd, 0, 32, 8, enum dpni_confirmation_mode, mode)
439 #define DPNI_RSP_GET_TX_CONFIRMATION_MODE(cmd, mode) \
440 MC_RSP_OP(cmd, 0, 32, 8, enum dpni_confirmation_mode, mode)
442 #define DPNI_CMD_SET_CONGESTION_NOTIFICATION(cmd, qtype, tc, cfg) \
444 MC_CMD_OP(cmd, 0, 0, 8, enum dpni_queue_type, qtype); \
445 MC_CMD_OP(cmd, 0, 8, 8, uint8_t, tc); \
446 MC_CMD_OP(cmd, 1, 0, 32, uint32_t, (cfg)->dest_cfg.dest_id); \
447 MC_CMD_OP(cmd, 1, 32, 16, uint16_t, (cfg)->notification_mode); \
448 MC_CMD_OP(cmd, 1, 48, 8, uint8_t, (cfg)->dest_cfg.priority); \
449 MC_CMD_OP(cmd, 1, 56, 4, enum dpni_dest, (cfg)->dest_cfg.dest_type); \
450 MC_CMD_OP(cmd, 1, 60, 2, enum dpni_congestion_unit, (cfg)->units); \
451 MC_CMD_OP(cmd, 2, 0, 64, uint64_t, (cfg)->message_iova); \
452 MC_CMD_OP(cmd, 3, 0, 64, uint64_t, (cfg)->message_ctx); \
453 MC_CMD_OP(cmd, 4, 0, 32, uint32_t, (cfg)->threshold_entry); \
454 MC_CMD_OP(cmd, 4, 32, 32, uint32_t, (cfg)->threshold_exit); \
457 #define DPNI_CMD_GET_CONGESTION_NOTIFICATION(cmd, qtype, tc) \
459 MC_CMD_OP(cmd, 0, 0, 8, enum dpni_queue_type, qtype); \
460 MC_CMD_OP(cmd, 0, 8, 8, uint8_t, tc); \
463 #define DPNI_RSP_GET_CONGESTION_NOTIFICATION(cmd, cfg) \
465 MC_RSP_OP(cmd, 1, 0, 32, uint32_t, (cfg)->dest_cfg.dest_id); \
466 MC_RSP_OP(cmd, 1, 0, 16, uint16_t, (cfg)->notification_mode); \
467 MC_RSP_OP(cmd, 1, 48, 8, uint8_t, (cfg)->dest_cfg.priority); \
468 MC_RSP_OP(cmd, 1, 56, 4, enum dpni_dest, (cfg)->dest_cfg.dest_type); \
469 MC_RSP_OP(cmd, 1, 60, 2, enum dpni_congestion_unit, (cfg)->units); \
470 MC_RSP_OP(cmd, 2, 0, 64, uint64_t, (cfg)->message_iova); \
471 MC_RSP_OP(cmd, 3, 0, 64, uint64_t, (cfg)->message_ctx); \
472 MC_RSP_OP(cmd, 4, 0, 32, uint32_t, (cfg)->threshold_entry); \
473 MC_RSP_OP(cmd, 4, 32, 32, uint32_t, (cfg)->threshold_exit); \
476 #endif /* _FSL_DPNI_CMD_H */