2 * Copyright (C) 2013-2015 Freescale Semiconductor
4 * SPDX-License-Identifier: GPL-2.0+
10 #define DPNI_VER_MAJOR 6
11 #define DPNI_VER_MINOR 0
14 #define DPNI_CMDID_OPEN 0x801
15 #define DPNI_CMDID_CLOSE 0x800
16 #define DPNI_CMDID_CREATE 0x901
17 #define DPNI_CMDID_DESTROY 0x900
19 #define DPNI_CMDID_ENABLE 0x002
20 #define DPNI_CMDID_DISABLE 0x003
21 #define DPNI_CMDID_GET_ATTR 0x004
22 #define DPNI_CMDID_RESET 0x005
24 #define DPNI_CMDID_SET_POOLS 0x200
25 #define DPNI_CMDID_GET_RX_BUFFER_LAYOUT 0x201
26 #define DPNI_CMDID_SET_RX_BUFFER_LAYOUT 0x202
27 #define DPNI_CMDID_GET_TX_BUFFER_LAYOUT 0x203
28 #define DPNI_CMDID_SET_TX_BUFFER_LAYOUT 0x204
29 #define DPNI_CMDID_SET_TX_CONF_BUFFER_LAYOUT 0x205
30 #define DPNI_CMDID_GET_TX_CONF_BUFFER_LAYOUT 0x206
31 #define DPNI_CMDID_SET_ERRORS_BEHAVIOR 0x20B
33 #define DPNI_CMDID_GET_QDID 0x210
34 #define DPNI_CMDID_GET_TX_DATA_OFFSET 0x212
35 #define DPNI_CMDID_GET_COUNTER 0x213
36 #define DPNI_CMDID_SET_COUNTER 0x214
37 #define DPNI_CMDID_GET_LINK_STATE 0x215
38 #define DPNI_CMDID_SET_LINK_CFG 0x21A
40 #define DPNI_CMDID_SET_PRIM_MAC 0x224
41 #define DPNI_CMDID_GET_PRIM_MAC 0x225
42 #define DPNI_CMDID_ADD_MAC_ADDR 0x226
43 #define DPNI_CMDID_REMOVE_MAC_ADDR 0x227
45 #define DPNI_CMDID_SET_TX_FLOW 0x236
46 #define DPNI_CMDID_GET_TX_FLOW 0x237
47 #define DPNI_CMDID_SET_RX_FLOW 0x238
48 #define DPNI_CMDID_GET_RX_FLOW 0x239
49 #define DPNI_CMDID_SET_TX_CONF 0x257
50 #define DPNI_CMDID_GET_TX_CONF 0x258
52 /* cmd, param, offset, width, type, arg_name */
53 #define DPNI_CMD_OPEN(cmd, dpni_id) \
54 MC_CMD_OP(cmd, 0, 0, 32, int, dpni_id)
56 #define DPNI_PREP_EXTENDED_CFG(ext, cfg) \
58 MC_PREP_OP(ext, 0, 0, 16, uint16_t, cfg->tc_cfg[0].max_dist); \
59 MC_PREP_OP(ext, 0, 16, 16, uint16_t, cfg->tc_cfg[0].max_fs_entries); \
60 MC_PREP_OP(ext, 0, 32, 16, uint16_t, cfg->tc_cfg[1].max_dist); \
61 MC_PREP_OP(ext, 0, 48, 16, uint16_t, cfg->tc_cfg[1].max_fs_entries); \
62 MC_PREP_OP(ext, 1, 0, 16, uint16_t, cfg->tc_cfg[2].max_dist); \
63 MC_PREP_OP(ext, 1, 16, 16, uint16_t, cfg->tc_cfg[2].max_fs_entries); \
64 MC_PREP_OP(ext, 1, 32, 16, uint16_t, cfg->tc_cfg[3].max_dist); \
65 MC_PREP_OP(ext, 1, 48, 16, uint16_t, cfg->tc_cfg[3].max_fs_entries); \
66 MC_PREP_OP(ext, 2, 0, 16, uint16_t, cfg->tc_cfg[4].max_dist); \
67 MC_PREP_OP(ext, 2, 16, 16, uint16_t, cfg->tc_cfg[4].max_fs_entries); \
68 MC_PREP_OP(ext, 2, 32, 16, uint16_t, cfg->tc_cfg[5].max_dist); \
69 MC_PREP_OP(ext, 2, 48, 16, uint16_t, cfg->tc_cfg[5].max_fs_entries); \
70 MC_PREP_OP(ext, 3, 0, 16, uint16_t, cfg->tc_cfg[6].max_dist); \
71 MC_PREP_OP(ext, 3, 16, 16, uint16_t, cfg->tc_cfg[6].max_fs_entries); \
72 MC_PREP_OP(ext, 3, 32, 16, uint16_t, cfg->tc_cfg[7].max_dist); \
73 MC_PREP_OP(ext, 3, 48, 16, uint16_t, cfg->tc_cfg[7].max_fs_entries); \
74 MC_PREP_OP(ext, 4, 0, 16, uint16_t, \
75 cfg->ipr_cfg.max_open_frames_ipv4); \
76 MC_PREP_OP(ext, 4, 16, 16, uint16_t, \
77 cfg->ipr_cfg.max_open_frames_ipv6); \
78 MC_PREP_OP(ext, 4, 32, 16, uint16_t, \
79 cfg->ipr_cfg.max_reass_frm_size); \
80 MC_PREP_OP(ext, 5, 0, 16, uint16_t, \
81 cfg->ipr_cfg.min_frag_size_ipv4); \
82 MC_PREP_OP(ext, 5, 16, 16, uint16_t, \
83 cfg->ipr_cfg.min_frag_size_ipv6); \
86 #define DPNI_EXT_EXTENDED_CFG(ext, cfg) \
88 MC_EXT_OP(ext, 0, 0, 16, uint16_t, cfg->tc_cfg[0].max_dist); \
89 MC_EXT_OP(ext, 0, 16, 16, uint16_t, cfg->tc_cfg[0].max_fs_entries); \
90 MC_EXT_OP(ext, 0, 32, 16, uint16_t, cfg->tc_cfg[1].max_dist); \
91 MC_EXT_OP(ext, 0, 48, 16, uint16_t, cfg->tc_cfg[1].max_fs_entries); \
92 MC_EXT_OP(ext, 1, 0, 16, uint16_t, cfg->tc_cfg[2].max_dist); \
93 MC_EXT_OP(ext, 1, 16, 16, uint16_t, cfg->tc_cfg[2].max_fs_entries); \
94 MC_EXT_OP(ext, 1, 32, 16, uint16_t, cfg->tc_cfg[3].max_dist); \
95 MC_EXT_OP(ext, 1, 48, 16, uint16_t, cfg->tc_cfg[3].max_fs_entries); \
96 MC_EXT_OP(ext, 2, 0, 16, uint16_t, cfg->tc_cfg[4].max_dist); \
97 MC_EXT_OP(ext, 2, 16, 16, uint16_t, cfg->tc_cfg[4].max_fs_entries); \
98 MC_EXT_OP(ext, 2, 32, 16, uint16_t, cfg->tc_cfg[5].max_dist); \
99 MC_EXT_OP(ext, 2, 48, 16, uint16_t, cfg->tc_cfg[5].max_fs_entries); \
100 MC_EXT_OP(ext, 3, 0, 16, uint16_t, cfg->tc_cfg[6].max_dist); \
101 MC_EXT_OP(ext, 3, 16, 16, uint16_t, cfg->tc_cfg[6].max_fs_entries); \
102 MC_EXT_OP(ext, 3, 32, 16, uint16_t, cfg->tc_cfg[7].max_dist); \
103 MC_EXT_OP(ext, 3, 48, 16, uint16_t, cfg->tc_cfg[7].max_fs_entries); \
104 MC_EXT_OP(ext, 4, 0, 16, uint16_t, \
105 cfg->ipr_cfg.max_open_frames_ipv4); \
106 MC_EXT_OP(ext, 4, 16, 16, uint16_t, \
107 cfg->ipr_cfg.max_open_frames_ipv6); \
108 MC_EXT_OP(ext, 4, 32, 16, uint16_t, \
109 cfg->ipr_cfg.max_reass_frm_size); \
110 MC_EXT_OP(ext, 5, 0, 16, uint16_t, \
111 cfg->ipr_cfg.min_frag_size_ipv4); \
112 MC_EXT_OP(ext, 5, 16, 16, uint16_t, \
113 cfg->ipr_cfg.min_frag_size_ipv6); \
116 /* cmd, param, offset, width, type, arg_name */
117 #define DPNI_CMD_CREATE(cmd, cfg) \
119 MC_CMD_OP(cmd, 0, 0, 8, uint8_t, cfg->adv.max_tcs); \
120 MC_CMD_OP(cmd, 0, 8, 8, uint8_t, cfg->adv.max_senders); \
121 MC_CMD_OP(cmd, 0, 16, 8, uint8_t, cfg->mac_addr[5]); \
122 MC_CMD_OP(cmd, 0, 24, 8, uint8_t, cfg->mac_addr[4]); \
123 MC_CMD_OP(cmd, 0, 32, 8, uint8_t, cfg->mac_addr[3]); \
124 MC_CMD_OP(cmd, 0, 40, 8, uint8_t, cfg->mac_addr[2]); \
125 MC_CMD_OP(cmd, 0, 48, 8, uint8_t, cfg->mac_addr[1]); \
126 MC_CMD_OP(cmd, 0, 56, 8, uint8_t, cfg->mac_addr[0]); \
127 MC_CMD_OP(cmd, 1, 0, 32, uint32_t, cfg->adv.options); \
128 MC_CMD_OP(cmd, 2, 0, 8, uint8_t, cfg->adv.max_unicast_filters); \
129 MC_CMD_OP(cmd, 2, 8, 8, uint8_t, cfg->adv.max_multicast_filters); \
130 MC_CMD_OP(cmd, 2, 16, 8, uint8_t, cfg->adv.max_vlan_filters); \
131 MC_CMD_OP(cmd, 2, 24, 8, uint8_t, cfg->adv.max_qos_entries); \
132 MC_CMD_OP(cmd, 2, 32, 8, uint8_t, cfg->adv.max_qos_key_size); \
133 MC_CMD_OP(cmd, 2, 48, 8, uint8_t, cfg->adv.max_dist_key_size); \
134 MC_CMD_OP(cmd, 2, 56, 8, enum net_prot, cfg->adv.start_hdr); \
135 MC_CMD_OP(cmd, 4, 48, 8, uint8_t, cfg->adv.max_policers); \
136 MC_CMD_OP(cmd, 4, 56, 8, uint8_t, cfg->adv.max_congestion_ctrl); \
137 MC_CMD_OP(cmd, 5, 0, 64, uint64_t, cfg->adv.ext_cfg_iova); \
140 /* cmd, param, offset, width, type, arg_name */
141 #define DPNI_CMD_SET_POOLS(cmd, cfg) \
143 MC_CMD_OP(cmd, 0, 0, 8, uint8_t, cfg->num_dpbp); \
144 MC_CMD_OP(cmd, 0, 8, 1, int, cfg->pools[0].backup_pool); \
145 MC_CMD_OP(cmd, 0, 9, 1, int, cfg->pools[1].backup_pool); \
146 MC_CMD_OP(cmd, 0, 10, 1, int, cfg->pools[2].backup_pool); \
147 MC_CMD_OP(cmd, 0, 11, 1, int, cfg->pools[3].backup_pool); \
148 MC_CMD_OP(cmd, 0, 12, 1, int, cfg->pools[4].backup_pool); \
149 MC_CMD_OP(cmd, 0, 13, 1, int, cfg->pools[5].backup_pool); \
150 MC_CMD_OP(cmd, 0, 14, 1, int, cfg->pools[6].backup_pool); \
151 MC_CMD_OP(cmd, 0, 15, 1, int, cfg->pools[7].backup_pool); \
152 MC_CMD_OP(cmd, 0, 32, 32, int, cfg->pools[0].dpbp_id); \
153 MC_CMD_OP(cmd, 4, 32, 16, uint16_t, cfg->pools[0].buffer_size);\
154 MC_CMD_OP(cmd, 1, 0, 32, int, cfg->pools[1].dpbp_id); \
155 MC_CMD_OP(cmd, 4, 48, 16, uint16_t, cfg->pools[1].buffer_size);\
156 MC_CMD_OP(cmd, 1, 32, 32, int, cfg->pools[2].dpbp_id); \
157 MC_CMD_OP(cmd, 5, 0, 16, uint16_t, cfg->pools[2].buffer_size);\
158 MC_CMD_OP(cmd, 2, 0, 32, int, cfg->pools[3].dpbp_id); \
159 MC_CMD_OP(cmd, 5, 16, 16, uint16_t, cfg->pools[3].buffer_size);\
160 MC_CMD_OP(cmd, 2, 32, 32, int, cfg->pools[4].dpbp_id); \
161 MC_CMD_OP(cmd, 5, 32, 16, uint16_t, cfg->pools[4].buffer_size);\
162 MC_CMD_OP(cmd, 3, 0, 32, int, cfg->pools[5].dpbp_id); \
163 MC_CMD_OP(cmd, 5, 48, 16, uint16_t, cfg->pools[5].buffer_size);\
164 MC_CMD_OP(cmd, 3, 32, 32, int, cfg->pools[6].dpbp_id); \
165 MC_CMD_OP(cmd, 6, 0, 16, uint16_t, cfg->pools[6].buffer_size);\
166 MC_CMD_OP(cmd, 4, 0, 32, int, cfg->pools[7].dpbp_id); \
167 MC_CMD_OP(cmd, 6, 16, 16, uint16_t, cfg->pools[7].buffer_size);\
170 /* cmd, param, offset, width, type, arg_name */
171 #define DPNI_CMD_GET_ATTR(cmd, attr) \
172 MC_CMD_OP(cmd, 6, 0, 64, uint64_t, attr->ext_cfg_iova)
174 /* cmd, param, offset, width, type, arg_name */
175 #define DPNI_RSP_GET_ATTR(cmd, attr) \
177 MC_RSP_OP(cmd, 0, 0, 32, int, attr->id);\
178 MC_RSP_OP(cmd, 0, 32, 8, uint8_t, attr->max_tcs); \
179 MC_RSP_OP(cmd, 0, 40, 8, uint8_t, attr->max_senders); \
180 MC_RSP_OP(cmd, 0, 48, 8, enum net_prot, attr->start_hdr); \
181 MC_RSP_OP(cmd, 1, 0, 32, uint32_t, attr->options); \
182 MC_RSP_OP(cmd, 2, 0, 8, uint8_t, attr->max_unicast_filters); \
183 MC_RSP_OP(cmd, 2, 8, 8, uint8_t, attr->max_multicast_filters);\
184 MC_RSP_OP(cmd, 2, 16, 8, uint8_t, attr->max_vlan_filters); \
185 MC_RSP_OP(cmd, 2, 24, 8, uint8_t, attr->max_qos_entries); \
186 MC_RSP_OP(cmd, 2, 32, 8, uint8_t, attr->max_qos_key_size); \
187 MC_RSP_OP(cmd, 2, 40, 8, uint8_t, attr->max_dist_key_size); \
188 MC_RSP_OP(cmd, 4, 48, 8, uint8_t, attr->max_policers); \
189 MC_RSP_OP(cmd, 4, 56, 8, uint8_t, attr->max_congestion_ctrl); \
190 MC_RSP_OP(cmd, 5, 32, 16, uint16_t, attr->version.major);\
191 MC_RSP_OP(cmd, 5, 48, 16, uint16_t, attr->version.minor);\
194 /* cmd, param, offset, width, type, arg_name */
195 #define DPNI_CMD_SET_ERRORS_BEHAVIOR(cmd, cfg) \
197 MC_CMD_OP(cmd, 0, 0, 32, uint32_t, cfg->errors); \
198 MC_CMD_OP(cmd, 0, 32, 4, enum dpni_error_action, cfg->error_action); \
199 MC_CMD_OP(cmd, 0, 36, 1, int, cfg->set_frame_annotation); \
202 /* cmd, param, offset, width, type, arg_name */
203 #define DPNI_RSP_GET_RX_BUFFER_LAYOUT(cmd, layout) \
205 MC_RSP_OP(cmd, 0, 0, 16, uint16_t, layout->private_data_size); \
206 MC_RSP_OP(cmd, 0, 16, 16, uint16_t, layout->data_align); \
207 MC_RSP_OP(cmd, 1, 0, 1, int, layout->pass_timestamp); \
208 MC_RSP_OP(cmd, 1, 1, 1, int, layout->pass_parser_result); \
209 MC_RSP_OP(cmd, 1, 2, 1, int, layout->pass_frame_status); \
210 MC_RSP_OP(cmd, 1, 16, 16, uint16_t, layout->data_head_room); \
211 MC_RSP_OP(cmd, 1, 32, 16, uint16_t, layout->data_tail_room); \
214 /* cmd, param, offset, width, type, arg_name */
215 #define DPNI_CMD_SET_RX_BUFFER_LAYOUT(cmd, layout) \
217 MC_CMD_OP(cmd, 0, 0, 16, uint16_t, layout->private_data_size); \
218 MC_CMD_OP(cmd, 0, 16, 16, uint16_t, layout->data_align); \
219 MC_CMD_OP(cmd, 0, 32, 32, uint32_t, layout->options); \
220 MC_CMD_OP(cmd, 1, 0, 1, int, layout->pass_timestamp); \
221 MC_CMD_OP(cmd, 1, 1, 1, int, layout->pass_parser_result); \
222 MC_CMD_OP(cmd, 1, 2, 1, int, layout->pass_frame_status); \
223 MC_CMD_OP(cmd, 1, 16, 16, uint16_t, layout->data_head_room); \
224 MC_CMD_OP(cmd, 1, 32, 16, uint16_t, layout->data_tail_room); \
227 /* cmd, param, offset, width, type, arg_name */
228 #define DPNI_RSP_GET_TX_BUFFER_LAYOUT(cmd, layout) \
230 MC_RSP_OP(cmd, 0, 0, 16, uint16_t, layout->private_data_size); \
231 MC_RSP_OP(cmd, 0, 16, 16, uint16_t, layout->data_align); \
232 MC_RSP_OP(cmd, 1, 0, 1, int, layout->pass_timestamp); \
233 MC_RSP_OP(cmd, 1, 1, 1, int, layout->pass_parser_result); \
234 MC_RSP_OP(cmd, 1, 2, 1, int, layout->pass_frame_status); \
235 MC_RSP_OP(cmd, 1, 16, 16, uint16_t, layout->data_head_room); \
236 MC_RSP_OP(cmd, 1, 32, 16, uint16_t, layout->data_tail_room); \
239 /* cmd, param, offset, width, type, arg_name */
240 #define DPNI_CMD_SET_TX_BUFFER_LAYOUT(cmd, layout) \
242 MC_CMD_OP(cmd, 0, 0, 16, uint16_t, layout->private_data_size); \
243 MC_CMD_OP(cmd, 0, 16, 16, uint16_t, layout->data_align); \
244 MC_CMD_OP(cmd, 0, 32, 32, uint32_t, layout->options); \
245 MC_CMD_OP(cmd, 1, 0, 1, int, layout->pass_timestamp); \
246 MC_CMD_OP(cmd, 1, 1, 1, int, layout->pass_parser_result); \
247 MC_CMD_OP(cmd, 1, 2, 1, int, layout->pass_frame_status); \
248 MC_CMD_OP(cmd, 1, 16, 16, uint16_t, layout->data_head_room); \
249 MC_CMD_OP(cmd, 1, 32, 16, uint16_t, layout->data_tail_room); \
252 /* cmd, param, offset, width, type, arg_name */
253 #define DPNI_RSP_GET_TX_CONF_BUFFER_LAYOUT(cmd, layout) \
255 MC_RSP_OP(cmd, 0, 0, 16, uint16_t, layout->private_data_size); \
256 MC_RSP_OP(cmd, 0, 16, 16, uint16_t, layout->data_align); \
257 MC_RSP_OP(cmd, 1, 0, 1, int, layout->pass_timestamp); \
258 MC_RSP_OP(cmd, 1, 1, 1, int, layout->pass_parser_result); \
259 MC_RSP_OP(cmd, 1, 2, 1, int, layout->pass_frame_status); \
260 MC_RSP_OP(cmd, 1, 16, 16, uint16_t, layout->data_head_room); \
261 MC_RSP_OP(cmd, 1, 32, 16, uint16_t, layout->data_tail_room); \
264 /* cmd, param, offset, width, type, arg_name */
265 #define DPNI_CMD_SET_TX_CONF_BUFFER_LAYOUT(cmd, layout) \
267 MC_CMD_OP(cmd, 0, 0, 16, uint16_t, layout->private_data_size); \
268 MC_CMD_OP(cmd, 0, 16, 16, uint16_t, layout->data_align); \
269 MC_CMD_OP(cmd, 0, 32, 32, uint32_t, layout->options); \
270 MC_CMD_OP(cmd, 1, 0, 1, int, layout->pass_timestamp); \
271 MC_CMD_OP(cmd, 1, 1, 1, int, layout->pass_parser_result); \
272 MC_CMD_OP(cmd, 1, 2, 1, int, layout->pass_frame_status); \
273 MC_CMD_OP(cmd, 1, 16, 16, uint16_t, layout->data_head_room); \
274 MC_CMD_OP(cmd, 1, 32, 16, uint16_t, layout->data_tail_room); \
277 /* cmd, param, offset, width, type, arg_name */
278 #define DPNI_RSP_GET_QDID(cmd, qdid) \
279 MC_RSP_OP(cmd, 0, 0, 16, uint16_t, qdid)
281 /* cmd, param, offset, width, type, arg_name */
282 #define DPNI_RSP_GET_TX_DATA_OFFSET(cmd, data_offset) \
283 MC_RSP_OP(cmd, 0, 0, 16, uint16_t, data_offset)
285 /* cmd, param, offset, width, type, arg_name */
286 #define DPNI_CMD_GET_COUNTER(cmd, counter) \
287 MC_CMD_OP(cmd, 0, 0, 16, enum dpni_counter, counter)
289 /* cmd, param, offset, width, type, arg_name */
290 #define DPNI_RSP_GET_COUNTER(cmd, value) \
291 MC_RSP_OP(cmd, 1, 0, 64, uint64_t, value)
293 /* cmd, param, offset, width, type, arg_name */
294 #define DPNI_CMD_SET_COUNTER(cmd, counter, value) \
296 MC_CMD_OP(cmd, 0, 0, 16, enum dpni_counter, counter); \
297 MC_CMD_OP(cmd, 1, 0, 64, uint64_t, value); \
300 /* cmd, param, offset, width, type, arg_name */
301 #define DPNI_CMD_SET_LINK_CFG(cmd, cfg) \
303 MC_CMD_OP(cmd, 1, 0, 32, uint32_t, cfg->rate);\
304 MC_CMD_OP(cmd, 2, 0, 64, uint64_t, cfg->options);\
307 /* cmd, param, offset, width, type, arg_name */
308 #define DPNI_RSP_GET_LINK_STATE(cmd, state) \
310 MC_RSP_OP(cmd, 0, 32, 1, int, state->up);\
311 MC_RSP_OP(cmd, 1, 0, 32, uint32_t, state->rate);\
312 MC_RSP_OP(cmd, 2, 0, 64, uint64_t, state->options);\
317 /* cmd, param, offset, width, type, arg_name */
318 #define DPNI_CMD_SET_PRIMARY_MAC_ADDR(cmd, mac_addr) \
320 MC_CMD_OP(cmd, 0, 16, 8, uint8_t, mac_addr[5]); \
321 MC_CMD_OP(cmd, 0, 24, 8, uint8_t, mac_addr[4]); \
322 MC_CMD_OP(cmd, 0, 32, 8, uint8_t, mac_addr[3]); \
323 MC_CMD_OP(cmd, 0, 40, 8, uint8_t, mac_addr[2]); \
324 MC_CMD_OP(cmd, 0, 48, 8, uint8_t, mac_addr[1]); \
325 MC_CMD_OP(cmd, 0, 56, 8, uint8_t, mac_addr[0]); \
328 /* cmd, param, offset, width, type, arg_name */
329 #define DPNI_RSP_GET_PRIMARY_MAC_ADDR(cmd, mac_addr) \
331 MC_RSP_OP(cmd, 0, 16, 8, uint8_t, mac_addr[5]); \
332 MC_RSP_OP(cmd, 0, 24, 8, uint8_t, mac_addr[4]); \
333 MC_RSP_OP(cmd, 0, 32, 8, uint8_t, mac_addr[3]); \
334 MC_RSP_OP(cmd, 0, 40, 8, uint8_t, mac_addr[2]); \
335 MC_RSP_OP(cmd, 0, 48, 8, uint8_t, mac_addr[1]); \
336 MC_RSP_OP(cmd, 0, 56, 8, uint8_t, mac_addr[0]); \
339 /* cmd, param, offset, width, type, arg_name */
340 #define DPNI_CMD_ADD_MAC_ADDR(cmd, mac_addr) \
342 MC_CMD_OP(cmd, 0, 16, 8, uint8_t, mac_addr[5]); \
343 MC_CMD_OP(cmd, 0, 24, 8, uint8_t, mac_addr[4]); \
344 MC_CMD_OP(cmd, 0, 32, 8, uint8_t, mac_addr[3]); \
345 MC_CMD_OP(cmd, 0, 40, 8, uint8_t, mac_addr[2]); \
346 MC_CMD_OP(cmd, 0, 48, 8, uint8_t, mac_addr[1]); \
347 MC_CMD_OP(cmd, 0, 56, 8, uint8_t, mac_addr[0]); \
350 /* cmd, param, offset, width, type, arg_name */
351 #define DPNI_CMD_REMOVE_MAC_ADDR(cmd, mac_addr) \
353 MC_CMD_OP(cmd, 0, 16, 8, uint8_t, mac_addr[5]); \
354 MC_CMD_OP(cmd, 0, 24, 8, uint8_t, mac_addr[4]); \
355 MC_CMD_OP(cmd, 0, 32, 8, uint8_t, mac_addr[3]); \
356 MC_CMD_OP(cmd, 0, 40, 8, uint8_t, mac_addr[2]); \
357 MC_CMD_OP(cmd, 0, 48, 8, uint8_t, mac_addr[1]); \
358 MC_CMD_OP(cmd, 0, 56, 8, uint8_t, mac_addr[0]); \
361 /* cmd, param, offset, width, type, arg_name */
362 #define DPNI_CMD_SET_TX_FLOW(cmd, flow_id, cfg) \
364 MC_CMD_OP(cmd, 0, 43, 1, int, cfg->l3_chksum_gen);\
365 MC_CMD_OP(cmd, 0, 44, 1, int, cfg->l4_chksum_gen);\
366 MC_CMD_OP(cmd, 0, 45, 1, int, cfg->use_common_tx_conf_queue);\
367 MC_CMD_OP(cmd, 0, 48, 16, uint16_t, flow_id);\
368 MC_CMD_OP(cmd, 2, 0, 32, uint32_t, cfg->options);\
371 /* cmd, param, offset, width, type, arg_name */
372 #define DPNI_RSP_SET_TX_FLOW(cmd, flow_id) \
373 MC_RSP_OP(cmd, 0, 48, 16, uint16_t, flow_id)
375 /* cmd, param, offset, width, type, arg_name */
376 #define DPNI_CMD_GET_TX_FLOW(cmd, flow_id) \
377 MC_CMD_OP(cmd, 0, 48, 16, uint16_t, flow_id)
379 /* cmd, param, offset, width, type, arg_name */
380 #define DPNI_RSP_GET_TX_FLOW(cmd, attr) \
382 MC_RSP_OP(cmd, 0, 43, 1, int, attr->l3_chksum_gen);\
383 MC_RSP_OP(cmd, 0, 44, 1, int, attr->l4_chksum_gen);\
384 MC_RSP_OP(cmd, 0, 45, 1, int, attr->use_common_tx_conf_queue);\
387 /* cmd, param, offset, width, type, arg_name */
388 #define DPNI_CMD_SET_RX_FLOW(cmd, tc_id, flow_id, cfg) \
390 MC_CMD_OP(cmd, 0, 0, 32, int, cfg->dest_cfg.dest_id); \
391 MC_CMD_OP(cmd, 0, 32, 8, uint8_t, cfg->dest_cfg.priority);\
392 MC_CMD_OP(cmd, 0, 40, 2, enum dpni_dest, cfg->dest_cfg.dest_type);\
393 MC_CMD_OP(cmd, 0, 42, 1, int, cfg->order_preservation_en);\
394 MC_CMD_OP(cmd, 0, 48, 16, uint16_t, flow_id); \
395 MC_CMD_OP(cmd, 1, 0, 64, uint64_t, cfg->user_ctx); \
396 MC_CMD_OP(cmd, 2, 16, 8, uint8_t, tc_id); \
397 MC_CMD_OP(cmd, 2, 32, 32, uint32_t, cfg->options); \
398 MC_CMD_OP(cmd, 3, 0, 4, enum dpni_flc_type, cfg->flc_cfg.flc_type); \
399 MC_CMD_OP(cmd, 3, 4, 4, enum dpni_stash_size, \
400 cfg->flc_cfg.frame_data_size);\
401 MC_CMD_OP(cmd, 3, 8, 4, enum dpni_stash_size, \
402 cfg->flc_cfg.flow_context_size);\
403 MC_CMD_OP(cmd, 3, 32, 32, uint32_t, cfg->flc_cfg.options);\
404 MC_CMD_OP(cmd, 4, 0, 64, uint64_t, cfg->flc_cfg.flow_context);\
405 MC_CMD_OP(cmd, 5, 0, 32, uint32_t, cfg->tail_drop_threshold); \
408 /* cmd, param, offset, width, type, arg_name */
409 #define DPNI_CMD_GET_RX_FLOW(cmd, tc_id, flow_id) \
411 MC_CMD_OP(cmd, 0, 16, 8, uint8_t, tc_id); \
412 MC_CMD_OP(cmd, 0, 48, 16, uint16_t, flow_id); \
415 /* cmd, param, offset, width, type, arg_name */
416 #define DPNI_RSP_GET_RX_FLOW(cmd, attr) \
418 MC_RSP_OP(cmd, 0, 0, 32, int, attr->dest_cfg.dest_id); \
419 MC_RSP_OP(cmd, 0, 32, 8, uint8_t, attr->dest_cfg.priority);\
420 MC_RSP_OP(cmd, 0, 40, 2, enum dpni_dest, attr->dest_cfg.dest_type); \
421 MC_RSP_OP(cmd, 0, 42, 1, int, attr->order_preservation_en);\
422 MC_RSP_OP(cmd, 1, 0, 64, uint64_t, attr->user_ctx); \
423 MC_RSP_OP(cmd, 2, 0, 32, uint32_t, attr->tail_drop_threshold); \
424 MC_RSP_OP(cmd, 2, 32, 32, uint32_t, attr->fqid); \
425 MC_RSP_OP(cmd, 3, 0, 4, enum dpni_flc_type, attr->flc_cfg.flc_type); \
426 MC_RSP_OP(cmd, 3, 4, 4, enum dpni_stash_size, \
427 attr->flc_cfg.frame_data_size);\
428 MC_RSP_OP(cmd, 3, 8, 4, enum dpni_stash_size, \
429 attr->flc_cfg.flow_context_size);\
430 MC_RSP_OP(cmd, 3, 32, 32, uint32_t, attr->flc_cfg.options);\
431 MC_RSP_OP(cmd, 4, 0, 64, uint64_t, attr->flc_cfg.flow_context);\
434 #define DPNI_CMD_SET_TX_CONF(cmd, flow_id, cfg) \
436 MC_CMD_OP(cmd, 0, 32, 8, uint8_t, cfg->queue_cfg.dest_cfg.priority); \
437 MC_CMD_OP(cmd, 0, 40, 2, enum dpni_dest, \
438 cfg->queue_cfg.dest_cfg.dest_type); \
439 MC_CMD_OP(cmd, 0, 42, 1, int, cfg->errors_only); \
440 MC_CMD_OP(cmd, 0, 46, 1, int, cfg->queue_cfg.order_preservation_en); \
441 MC_CMD_OP(cmd, 0, 48, 16, uint16_t, flow_id); \
442 MC_CMD_OP(cmd, 1, 0, 64, uint64_t, cfg->queue_cfg.user_ctx); \
443 MC_CMD_OP(cmd, 2, 0, 32, uint32_t, cfg->queue_cfg.options); \
444 MC_CMD_OP(cmd, 2, 32, 32, int, cfg->queue_cfg.dest_cfg.dest_id); \
445 MC_CMD_OP(cmd, 3, 0, 32, uint32_t, \
446 cfg->queue_cfg.tail_drop_threshold); \
447 MC_CMD_OP(cmd, 4, 0, 4, enum dpni_flc_type, \
448 cfg->queue_cfg.flc_cfg.flc_type); \
449 MC_CMD_OP(cmd, 4, 4, 4, enum dpni_stash_size, \
450 cfg->queue_cfg.flc_cfg.frame_data_size); \
451 MC_CMD_OP(cmd, 4, 8, 4, enum dpni_stash_size, \
452 cfg->queue_cfg.flc_cfg.flow_context_size); \
453 MC_CMD_OP(cmd, 4, 32, 32, uint32_t, cfg->queue_cfg.flc_cfg.options); \
454 MC_CMD_OP(cmd, 5, 0, 64, uint64_t, \
455 cfg->queue_cfg.flc_cfg.flow_context); \
458 #define DPNI_CMD_GET_TX_CONF(cmd, flow_id) \
459 MC_CMD_OP(cmd, 0, 48, 16, uint16_t, flow_id)
461 #define DPNI_RSP_GET_TX_CONF(cmd, attr) \
463 MC_RSP_OP(cmd, 0, 32, 8, uint8_t, \
464 attr->queue_attr.dest_cfg.priority); \
465 MC_RSP_OP(cmd, 0, 40, 2, enum dpni_dest, \
466 attr->queue_attr.dest_cfg.dest_type); \
467 MC_RSP_OP(cmd, 0, 42, 1, int, attr->errors_only); \
468 MC_RSP_OP(cmd, 0, 46, 1, int, \
469 attr->queue_attr.order_preservation_en); \
470 MC_RSP_OP(cmd, 1, 0, 64, uint64_t, attr->queue_attr.user_ctx); \
471 MC_RSP_OP(cmd, 2, 32, 32, int, attr->queue_attr.dest_cfg.dest_id); \
472 MC_RSP_OP(cmd, 3, 0, 32, uint32_t, \
473 attr->queue_attr.tail_drop_threshold); \
474 MC_RSP_OP(cmd, 3, 32, 32, uint32_t, attr->queue_attr.fqid); \
475 MC_RSP_OP(cmd, 4, 0, 4, enum dpni_flc_type, \
476 attr->queue_attr.flc_cfg.flc_type); \
477 MC_RSP_OP(cmd, 4, 4, 4, enum dpni_stash_size, \
478 attr->queue_attr.flc_cfg.frame_data_size); \
479 MC_RSP_OP(cmd, 4, 8, 4, enum dpni_stash_size, \
480 attr->queue_attr.flc_cfg.flow_context_size); \
481 MC_RSP_OP(cmd, 4, 32, 32, uint32_t, attr->queue_attr.flc_cfg.options); \
482 MC_RSP_OP(cmd, 5, 0, 64, uint64_t, \
483 attr->queue_attr.flc_cfg.flow_context); \
499 NET_PROT_SCTP_CHUNK_DATA,
503 NET_PROT_PPPMUX_SUBFRM,
505 NET_PROT_L2TPV3_CTRL,
506 NET_PROT_L2TPV3_SESS,
514 NET_PROT_UDP_ENC_ESP, /* RFC 3948 */
522 NET_PROT_CAPWAP_DATA,
523 NET_PROT_CAPWAP_CTRL,
530 NET_PROT_USER_DEFINED_L2,
531 NET_PROT_USER_DEFINED_L3,
532 NET_PROT_USER_DEFINED_L4,
533 NET_PROT_USER_DEFINED_L5,
534 NET_PROT_USER_DEFINED_SHIM1,
535 NET_PROT_USER_DEFINED_SHIM2,
541 * Data Path Network Interface API
542 * Contains initialization APIs and runtime control APIs for DPNI
547 /* General DPNI macros */
549 /* Maximum number of traffic classes */
550 #define DPNI_MAX_TC 8
551 /* Maximum number of buffer pools per DPNI */
552 #define DPNI_MAX_DPBP 8
554 /* All traffic classes considered; see dpni_set_rx_flow() */
555 #define DPNI_ALL_TCS (uint8_t)(-1)
556 /* All flows within traffic class considered; see dpni_set_rx_flow() */
557 #define DPNI_ALL_TC_FLOWS (uint16_t)(-1)
558 /* Generate new flow ID; see dpni_set_tx_flow() */
559 #define DPNI_NEW_FLOW_ID (uint16_t)(-1)
560 /* use for common tx-conf queue; see dpni_set_tx_conf_<x>() */
561 #define DPNI_COMMON_TX_CONF (uint16_t)(-1)
564 * dpni_open() - Open a control session for the specified object
565 * @mc_io: Pointer to MC portal's I/O object
566 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
567 * @dpni_id: DPNI unique ID
568 * @token: Returned token; use in subsequent API calls
570 * This function can be used to open a control session for an
571 * already created object; an object may have been declared in
572 * the DPL or by calling the dpni_create() function.
573 * This function returns a unique authentication token,
574 * associated with the specific object ID and the specific MC
575 * portal; this token must be used in all subsequent commands for
576 * this specific object.
578 * Return: '0' on Success; Error code otherwise.
580 int dpni_open(struct fsl_mc_io *mc_io,
586 * dpni_close() - Close the control session of the object
587 * @mc_io: Pointer to MC portal's I/O object
588 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
589 * @token: Token of DPNI object
591 * After this function is called, no further operations are
592 * allowed on the object without opening a new control session.
594 * Return: '0' on Success; Error code otherwise.
596 int dpni_close(struct fsl_mc_io *mc_io,
600 /* DPNI configuration options */
603 * Allow different distribution key profiles for different traffic classes;
604 * if not set, a single key profile is assumed
606 #define DPNI_OPT_ALLOW_DIST_KEY_PER_TC 0x00000001
609 * Disable all non-error transmit confirmation; error frames are reported
610 * back to a common Tx error queue
612 #define DPNI_OPT_TX_CONF_DISABLED 0x00000002
614 /* Disable per-sender private Tx confirmation/error queue */
615 #define DPNI_OPT_PRIVATE_TX_CONF_ERROR_DISABLED 0x00000004
618 * Support distribution based on hashed key;
619 * allows statistical distribution over receive queues in a traffic class
621 #define DPNI_OPT_DIST_HASH 0x00000010
624 * Support distribution based on flow steering;
625 * allows explicit control of distribution over receive queues in a traffic
628 #define DPNI_OPT_DIST_FS 0x00000020
630 /* Unicast filtering support */
631 #define DPNI_OPT_UNICAST_FILTER 0x00000080
632 /* Multicast filtering support */
633 #define DPNI_OPT_MULTICAST_FILTER 0x00000100
634 /* VLAN filtering support */
635 #define DPNI_OPT_VLAN_FILTER 0x00000200
636 /* Support IP reassembly on received packets */
637 #define DPNI_OPT_IPR 0x00000800
638 /* Support IP fragmentation on transmitted packets */
639 #define DPNI_OPT_IPF 0x00001000
640 /* VLAN manipulation support */
641 #define DPNI_OPT_VLAN_MANIPULATION 0x00010000
642 /* Support masking of QoS lookup keys */
643 #define DPNI_OPT_QOS_MASK_SUPPORT 0x00020000
644 /* Support masking of Flow Steering lookup keys */
645 #define DPNI_OPT_FS_MASK_SUPPORT 0x00040000
648 * struct dpni_extended_cfg - Structure representing extended DPNI configuration
649 * @tc_cfg: TCs configuration
650 * @ipr_cfg: IP reassembly configuration
652 struct dpni_extended_cfg {
654 * struct tc_cfg - TC configuration
655 * @max_dist: Maximum distribution size for Rx traffic class;
656 * supported values: 1,2,3,4,6,7,8,12,14,16,24,28,32,48,56,64,96,
657 * 112,128,192,224,256,384,448,512,768,896,1024;
658 * value '0' will be treated as '1'.
659 * other unsupported values will be round down to the nearest
661 * @max_fs_entries: Maximum FS entries for Rx traffic class;
662 * '0' means no support for this TC;
666 uint16_t max_fs_entries;
667 } tc_cfg[DPNI_MAX_TC];
669 * struct ipr_cfg - Structure representing IP reassembly configuration
670 * @max_reass_frm_size: Maximum size of the reassembled frame
671 * @min_frag_size_ipv4: Minimum fragment size of IPv4 fragments
672 * @min_frag_size_ipv6: Minimum fragment size of IPv6 fragments
673 * @max_open_frames_ipv4: Maximum concurrent IPv4 packets in reassembly
675 * @max_open_frames_ipv6: Maximum concurrent IPv6 packets in reassembly
679 uint16_t max_reass_frm_size;
680 uint16_t min_frag_size_ipv4;
681 uint16_t min_frag_size_ipv6;
682 uint16_t max_open_frames_ipv4;
683 uint16_t max_open_frames_ipv6;
688 * dpni_prepare_extended_cfg() - function prepare extended parameters
689 * @cfg: extended structure
690 * @ext_cfg_buf: Zeroed 256 bytes of memory before mapping it to DMA
692 * This function has to be called before dpni_create()
694 int dpni_prepare_extended_cfg(const struct dpni_extended_cfg *cfg,
695 uint8_t *ext_cfg_buf);
698 * struct dpni_cfg - Structure representing DPNI configuration
699 * @mac_addr: Primary MAC address
700 * @adv: Advanced parameters; default is all zeros;
701 * use this structure to change default settings
706 * struct adv - Advanced parameters
707 * @options: Mask of available options; use 'DPNI_OPT_<X>' values
708 * @start_hdr: Selects the packet starting header for parsing;
709 * 'NET_PROT_NONE' is treated as default: 'NET_PROT_ETH'
710 * @max_senders: Maximum number of different senders; used as the number
711 * of dedicated Tx flows; Non-power-of-2 values are rounded
712 * up to the next power-of-2 value as hardware demands it;
713 * '0' will be treated as '1'
714 * @max_tcs: Maximum number of traffic classes (for both Tx and Rx);
715 * '0' will e treated as '1'
716 * @max_unicast_filters: Maximum number of unicast filters;
717 * '0' is treated as '16'
718 * @max_multicast_filters: Maximum number of multicast filters;
719 * '0' is treated as '64'
720 * @max_qos_entries: if 'max_tcs > 1', declares the maximum entries in
721 * the QoS table; '0' is treated as '64'
722 * @max_qos_key_size: Maximum key size for the QoS look-up;
723 * '0' is treated as '24' which is enough for IPv4
725 * @max_dist_key_size: Maximum key size for the distribution;
726 * '0' is treated as '24' which is enough for IPv4 5-tuple
727 * @max_policers: Maximum number of policers;
728 * should be between '0' and max_tcs
729 * @max_congestion_ctrl: Maximum number of congestion control groups
730 * (CGs); covers early drop and congestion notification
732 * should be between '0' and ('max_tcs' + 'max_senders')
733 * @ext_cfg_iova: I/O virtual address of 256 bytes DMA-able memory
734 * filled with the extended configuration by calling
735 * dpni_prepare_extended_cfg()
739 enum net_prot start_hdr;
742 uint8_t max_unicast_filters;
743 uint8_t max_multicast_filters;
744 uint8_t max_vlan_filters;
745 uint8_t max_qos_entries;
746 uint8_t max_qos_key_size;
747 uint8_t max_dist_key_size;
748 uint8_t max_policers;
749 uint8_t max_congestion_ctrl;
750 uint64_t ext_cfg_iova;
755 * dpni_create() - Create the DPNI object
756 * @mc_io: Pointer to MC portal's I/O object
757 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
758 * @cfg: Configuration structure
759 * @token: Returned token; use in subsequent API calls
761 * Create the DPNI object, allocate required resources and
762 * perform required initialization.
764 * The object can be created either by declaring it in the
765 * DPL file, or by calling this function.
767 * This function returns a unique authentication token,
768 * associated with the specific object ID and the specific MC
769 * portal; this token must be used in all subsequent calls to
770 * this specific object. For objects that are created using the
771 * DPL file, call dpni_open() function to get an authentication
774 * Return: '0' on Success; Error code otherwise.
776 int dpni_create(struct fsl_mc_io *mc_io,
778 const struct dpni_cfg *cfg,
782 * dpni_destroy() - Destroy the DPNI object and release all its resources.
783 * @mc_io: Pointer to MC portal's I/O object
784 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
785 * @token: Token of DPNI object
787 * Return: '0' on Success; error code otherwise.
789 int dpni_destroy(struct fsl_mc_io *mc_io,
794 * struct dpni_pools_cfg - Structure representing buffer pools configuration
795 * @num_dpbp: Number of DPBPs
796 * @pools: Array of buffer pools parameters; The number of valid entries
797 * must match 'num_dpbp' value
799 struct dpni_pools_cfg {
802 * struct pools - Buffer pools parameters
803 * @dpbp_id: DPBP object ID
804 * @buffer_size: Buffer size
805 * @backup_pool: Backup pool
809 uint16_t buffer_size;
811 } pools[DPNI_MAX_DPBP];
815 * dpni_set_pools() - Set buffer pools configuration
816 * @mc_io: Pointer to MC portal's I/O object
817 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
818 * @token: Token of DPNI object
819 * @cfg: Buffer pools configuration
821 * mandatory for DPNI operation
822 * warning:Allowed only when DPNI is disabled
824 * Return: '0' on Success; Error code otherwise.
826 int dpni_set_pools(struct fsl_mc_io *mc_io,
829 const struct dpni_pools_cfg *cfg);
832 * dpni_enable() - Enable the DPNI, allow sending and receiving frames.
833 * @mc_io: Pointer to MC portal's I/O object
834 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
835 * @token: Token of DPNI object
837 * Return: '0' on Success; Error code otherwise.
839 int dpni_enable(struct fsl_mc_io *mc_io,
844 * dpni_disable() - Disable the DPNI, stop sending and receiving frames.
845 * @mc_io: Pointer to MC portal's I/O object
846 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
847 * @token: Token of DPNI object
849 * Return: '0' on Success; Error code otherwise.
851 int dpni_disable(struct fsl_mc_io *mc_io,
857 * dpni_reset() - Reset the DPNI, returns the object to initial state.
858 * @mc_io: Pointer to MC portal's I/O object
859 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
860 * @token: Token of DPNI object
862 * Return: '0' on Success; Error code otherwise.
864 int dpni_reset(struct fsl_mc_io *mc_io,
869 * struct dpni_attr - Structure representing DPNI attributes
870 * @id: DPNI object ID
871 * @version: DPNI version
872 * @start_hdr: Indicates the packet starting header for parsing
873 * @options: Mask of available options; reflects the value as was given in
875 * @max_senders: Maximum number of different senders; used as the number
876 * of dedicated Tx flows;
877 * @max_tcs: Maximum number of traffic classes (for both Tx and Rx)
878 * @max_unicast_filters: Maximum number of unicast filters
879 * @max_multicast_filters: Maximum number of multicast filters
880 * @max_vlan_filters: Maximum number of VLAN filters
881 * @max_qos_entries: if 'max_tcs > 1', declares the maximum entries in QoS table
882 * @max_qos_key_size: Maximum key size for the QoS look-up
883 * @max_dist_key_size: Maximum key size for the distribution look-up
884 * @max_policers: Maximum number of policers;
885 * @max_congestion_ctrl: Maximum number of congestion control groups (CGs);
886 * @ext_cfg_iova: I/O virtual address of 256 bytes DMA-able memory;
887 * call dpni_extract_extended_cfg() to extract the extended configuration
892 * struct version - DPNI version
893 * @major: DPNI major version
894 * @minor: DPNI minor version
900 enum net_prot start_hdr;
904 uint8_t max_unicast_filters;
905 uint8_t max_multicast_filters;
906 uint8_t max_vlan_filters;
907 uint8_t max_qos_entries;
908 uint8_t max_qos_key_size;
909 uint8_t max_dist_key_size;
910 uint8_t max_policers;
911 uint8_t max_congestion_ctrl;
912 uint64_t ext_cfg_iova;
916 * dpni_get_attributes() - Retrieve DPNI attributes.
917 * @mc_io: Pointer to MC portal's I/O object
918 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
919 * @token: Token of DPNI object
920 * @attr: Object's attributes
922 * Return: '0' on Success; Error code otherwise.
924 int dpni_get_attributes(struct fsl_mc_io *mc_io,
927 struct dpni_attr *attr);
930 * dpni_extract_extended_cfg() - extract the extended parameters
931 * @cfg: extended structure
932 * @ext_cfg_buf: 256 bytes of DMA-able memory
934 * This function has to be called after dpni_get_attributes()
936 int dpni_extract_extended_cfg(struct dpni_extended_cfg *cfg,
937 const uint8_t *ext_cfg_buf);
944 * Extract out of frame header error
946 #define DPNI_ERROR_EOFHE 0x00020000
950 #define DPNI_ERROR_FLE 0x00002000
952 * Frame physical error
954 #define DPNI_ERROR_FPE 0x00001000
956 * Parsing header error
958 #define DPNI_ERROR_PHE 0x00000020
960 * Parser L3 checksum error
962 #define DPNI_ERROR_L3CE 0x00000004
964 * Parser L3 checksum error
966 #define DPNI_ERROR_L4CE 0x00000001
969 * enum dpni_error_action - Defines DPNI behavior for errors
970 * @DPNI_ERROR_ACTION_DISCARD: Discard the frame
971 * @DPNI_ERROR_ACTION_CONTINUE: Continue with the normal flow
972 * @DPNI_ERROR_ACTION_SEND_TO_ERROR_QUEUE: Send the frame to the error queue
974 enum dpni_error_action {
975 DPNI_ERROR_ACTION_DISCARD = 0,
976 DPNI_ERROR_ACTION_CONTINUE = 1,
977 DPNI_ERROR_ACTION_SEND_TO_ERROR_QUEUE = 2
981 * struct dpni_error_cfg - Structure representing DPNI errors treatment
982 * @errors: Errors mask; use 'DPNI_ERROR__<X>
983 * @error_action: The desired action for the errors mask
984 * @set_frame_annotation: Set to '1' to mark the errors in frame annotation
985 * status (FAS); relevant only for the non-discard action
987 struct dpni_error_cfg {
989 enum dpni_error_action error_action;
990 int set_frame_annotation;
994 * dpni_set_errors_behavior() - Set errors behavior
995 * @mc_io: Pointer to MC portal's I/O object
996 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
997 * @token: Token of DPNI object
998 * @cfg: Errors configuration
1000 * this function may be called numerous times with different
1003 * Return: '0' on Success; Error code otherwise.
1005 int dpni_set_errors_behavior(struct fsl_mc_io *mc_io,
1008 struct dpni_error_cfg *cfg);
1010 /* DPNI buffer layout modification options */
1012 /* Select to modify the time-stamp setting */
1013 #define DPNI_BUF_LAYOUT_OPT_TIMESTAMP 0x00000001
1014 /* Select to modify the parser-result setting; not applicable for Tx */
1015 #define DPNI_BUF_LAYOUT_OPT_PARSER_RESULT 0x00000002
1016 /* Select to modify the frame-status setting */
1017 #define DPNI_BUF_LAYOUT_OPT_FRAME_STATUS 0x00000004
1018 /* Select to modify the private-data-size setting */
1019 #define DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE 0x00000008
1020 /* Select to modify the data-alignment setting */
1021 #define DPNI_BUF_LAYOUT_OPT_DATA_ALIGN 0x00000010
1022 /* Select to modify the data-head-room setting */
1023 #define DPNI_BUF_LAYOUT_OPT_DATA_HEAD_ROOM 0x00000020
1024 /*!< Select to modify the data-tail-room setting */
1025 #define DPNI_BUF_LAYOUT_OPT_DATA_TAIL_ROOM 0x00000040
1028 * struct dpni_buffer_layout - Structure representing DPNI buffer layout
1029 * @options: Flags representing the suggested modifications to the buffer
1030 * layout; Use any combination of 'DPNI_BUF_LAYOUT_OPT_<X>' flags
1031 * @pass_timestamp: Pass timestamp value
1032 * @pass_parser_result: Pass parser results
1033 * @pass_frame_status: Pass frame status
1034 * @private_data_size: Size kept for private data (in bytes)
1035 * @data_align: Data alignment
1036 * @data_head_room: Data head room
1037 * @data_tail_room: Data tail room
1039 struct dpni_buffer_layout {
1042 int pass_parser_result;
1043 int pass_frame_status;
1044 uint16_t private_data_size;
1045 uint16_t data_align;
1046 uint16_t data_head_room;
1047 uint16_t data_tail_room;
1051 * dpni_get_rx_buffer_layout() - Retrieve Rx buffer layout attributes.
1052 * @mc_io: Pointer to MC portal's I/O object
1053 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1054 * @token: Token of DPNI object
1055 * @layout: Returns buffer layout attributes
1057 * Return: '0' on Success; Error code otherwise.
1059 int dpni_get_rx_buffer_layout(struct fsl_mc_io *mc_io,
1062 struct dpni_buffer_layout *layout);
1065 * dpni_set_rx_buffer_layout() - Set Rx buffer layout configuration.
1066 * @mc_io: Pointer to MC portal's I/O object
1067 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1068 * @token: Token of DPNI object
1069 * @layout: Buffer layout configuration
1071 * Return: '0' on Success; Error code otherwise.
1073 * @warning Allowed only when DPNI is disabled
1075 int dpni_set_rx_buffer_layout(struct fsl_mc_io *mc_io,
1078 const struct dpni_buffer_layout *layout);
1081 * dpni_get_tx_buffer_layout() - Retrieve Tx buffer layout attributes.
1082 * @mc_io: Pointer to MC portal's I/O object
1083 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1084 * @token: Token of DPNI object
1085 * @layout: Returns buffer layout attributes
1087 * Return: '0' on Success; Error code otherwise.
1089 int dpni_get_tx_buffer_layout(struct fsl_mc_io *mc_io,
1092 struct dpni_buffer_layout *layout);
1095 * dpni_set_tx_buffer_layout() - Set Tx buffer layout configuration.
1096 * @mc_io: Pointer to MC portal's I/O object
1097 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1098 * @token: Token of DPNI object
1099 * @layout: Buffer layout configuration
1101 * Return: '0' on Success; Error code otherwise.
1103 * @warning Allowed only when DPNI is disabled
1105 int dpni_set_tx_buffer_layout(struct fsl_mc_io *mc_io,
1108 const struct dpni_buffer_layout *layout);
1111 * dpni_get_tx_conf_buffer_layout() - Retrieve Tx confirmation buffer layout
1113 * @mc_io: Pointer to MC portal's I/O object
1114 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1115 * @token: Token of DPNI object
1116 * @layout: Returns buffer layout attributes
1118 * Return: '0' on Success; Error code otherwise.
1120 int dpni_get_tx_conf_buffer_layout(struct fsl_mc_io *mc_io,
1123 struct dpni_buffer_layout *layout);
1126 * dpni_set_tx_conf_buffer_layout() - Set Tx confirmation buffer layout
1128 * @mc_io: Pointer to MC portal's I/O object
1129 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1130 * @token: Token of DPNI object
1131 * @layout: Buffer layout configuration
1133 * Return: '0' on Success; Error code otherwise.
1135 * @warning Allowed only when DPNI is disabled
1137 int dpni_set_tx_conf_buffer_layout(struct fsl_mc_io *mc_io,
1140 const struct dpni_buffer_layout *layout);
1143 * dpni_get_qdid() - Get the Queuing Destination ID (QDID) that should be used
1144 * for enqueue operations
1145 * @mc_io: Pointer to MC portal's I/O object
1146 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1147 * @token: Token of DPNI object
1148 * @qdid: Returned virtual QDID value that should be used as an argument
1149 * in all enqueue operations
1151 * Return: '0' on Success; Error code otherwise.
1153 int dpni_get_qdid(struct fsl_mc_io *mc_io,
1159 * dpni_get_tx_data_offset() - Get the Tx data offset (from start of buffer)
1160 * @mc_io: Pointer to MC portal's I/O object
1161 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1162 * @token: Token of DPNI object
1163 * @data_offset: Tx data offset (from start of buffer)
1165 * Return: '0' on Success; Error code otherwise.
1167 int dpni_get_tx_data_offset(struct fsl_mc_io *mc_io,
1170 uint16_t *data_offset);
1173 * enum dpni_counter - DPNI counter types
1174 * @DPNI_CNT_ING_FRAME: Counts ingress frames
1175 * @DPNI_CNT_ING_BYTE: Counts ingress bytes
1176 * @DPNI_CNT_ING_FRAME_DROP: Counts ingress frames dropped due to explicit
1178 * @DPNI_CNT_ING_FRAME_DISCARD: Counts ingress frames discarded due to errors
1179 * @DPNI_CNT_ING_MCAST_FRAME: Counts ingress multicast frames
1180 * @DPNI_CNT_ING_MCAST_BYTE: Counts ingress multicast bytes
1181 * @DPNI_CNT_ING_BCAST_FRAME: Counts ingress broadcast frames
1182 * @DPNI_CNT_ING_BCAST_BYTES: Counts ingress broadcast bytes
1183 * @DPNI_CNT_EGR_FRAME: Counts egress frames
1184 * @DPNI_CNT_EGR_BYTE: Counts egress bytes
1185 * @DPNI_CNT_EGR_FRAME_DISCARD: Counts egress frames discarded due to errors
1188 DPNI_CNT_ING_FRAME = 0x0,
1189 DPNI_CNT_ING_BYTE = 0x1,
1190 DPNI_CNT_ING_FRAME_DROP = 0x2,
1191 DPNI_CNT_ING_FRAME_DISCARD = 0x3,
1192 DPNI_CNT_ING_MCAST_FRAME = 0x4,
1193 DPNI_CNT_ING_MCAST_BYTE = 0x5,
1194 DPNI_CNT_ING_BCAST_FRAME = 0x6,
1195 DPNI_CNT_ING_BCAST_BYTES = 0x7,
1196 DPNI_CNT_EGR_FRAME = 0x8,
1197 DPNI_CNT_EGR_BYTE = 0x9,
1198 DPNI_CNT_EGR_FRAME_DISCARD = 0xa
1202 * dpni_get_counter() - Read a specific DPNI counter
1203 * @mc_io: Pointer to MC portal's I/O object
1204 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1205 * @token: Token of DPNI object
1206 * @counter: The requested counter
1207 * @value: Returned counter's current value
1209 * Return: '0' on Success; Error code otherwise.
1211 int dpni_get_counter(struct fsl_mc_io *mc_io,
1214 enum dpni_counter counter,
1218 * dpni_set_counter() - Set (or clear) a specific DPNI counter
1219 * @mc_io: Pointer to MC portal's I/O object
1220 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1221 * @token: Token of DPNI object
1222 * @counter: The requested counter
1223 * @value: New counter value; typically pass '0' for resetting
1226 * Return: '0' on Success; Error code otherwise.
1228 int dpni_set_counter(struct fsl_mc_io *mc_io,
1231 enum dpni_counter counter,
1234 /* Enable auto-negotiation */
1235 #define DPNI_LINK_OPT_AUTONEG 0x0000000000000001ULL
1236 /* Enable half-duplex mode */
1237 #define DPNI_LINK_OPT_HALF_DUPLEX 0x0000000000000002ULL
1238 /* Enable pause frames */
1239 #define DPNI_LINK_OPT_PAUSE 0x0000000000000004ULL
1240 /* Enable a-symmetric pause frames */
1241 #define DPNI_LINK_OPT_ASYM_PAUSE 0x0000000000000008ULL
1244 * struct - Structure representing DPNI link configuration
1246 * @options: Mask of available options; use 'DPNI_LINK_OPT_<X>' values
1248 struct dpni_link_cfg {
1254 * dpni_set_link_cfg() - set the link configuration.
1255 * @mc_io: Pointer to MC portal's I/O object
1256 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1257 * @token: Token of DPNI object
1258 * @cfg: Link configuration
1260 * Return: '0' on Success; Error code otherwise.
1262 int dpni_set_link_cfg(struct fsl_mc_io *mc_io,
1265 const struct dpni_link_cfg *cfg);
1268 * struct dpni_link_state - Structure representing DPNI link state
1270 * @options: Mask of available options; use 'DPNI_LINK_OPT_<X>' values
1271 * @up: Link state; '0' for down, '1' for up
1273 struct dpni_link_state {
1280 * dpni_get_link_state() - Return the link state (either up or down)
1281 * @mc_io: Pointer to MC portal's I/O object
1282 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1283 * @token: Token of DPNI object
1284 * @state: Returned link state;
1286 * Return: '0' on Success; Error code otherwise.
1288 int dpni_get_link_state(struct fsl_mc_io *mc_io,
1291 struct dpni_link_state *state);
1294 * dpni_set_primary_mac_addr() - Set the primary MAC address
1295 * @mc_io: Pointer to MC portal's I/O object
1296 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1297 * @token: Token of DPNI object
1298 * @mac_addr: MAC address to set as primary address
1300 * Return: '0' on Success; Error code otherwise.
1302 int dpni_set_primary_mac_addr(struct fsl_mc_io *mc_io,
1305 const uint8_t mac_addr[6]);
1308 * dpni_get_primary_mac_addr() - Get the primary MAC address
1309 * @mc_io: Pointer to MC portal's I/O object
1310 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1311 * @token: Token of DPNI object
1312 * @mac_addr: Returned MAC address
1314 * Return: '0' on Success; Error code otherwise.
1316 int dpni_get_primary_mac_addr(struct fsl_mc_io *mc_io,
1319 uint8_t mac_addr[6]);
1322 * dpni_add_mac_addr() - Add MAC address filter
1323 * @mc_io: Pointer to MC portal's I/O object
1324 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1325 * @token: Token of DPNI object
1326 * @mac_addr: MAC address to add
1328 * Return: '0' on Success; Error code otherwise.
1330 int dpni_add_mac_addr(struct fsl_mc_io *mc_io,
1333 const uint8_t mac_addr[6]);
1336 * dpni_remove_mac_addr() - Remove MAC address filter
1337 * @mc_io: Pointer to MC portal's I/O object
1338 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1339 * @token: Token of DPNI object
1340 * @mac_addr: MAC address to remove
1342 * Return: '0' on Success; Error code otherwise.
1344 int dpni_remove_mac_addr(struct fsl_mc_io *mc_io,
1347 const uint8_t mac_addr[6]);
1350 * enum dpni_dest - DPNI destination types
1351 * @DPNI_DEST_NONE: Unassigned destination; The queue is set in parked mode and
1352 * does not generate FQDAN notifications; user is expected to
1353 * dequeue from the queue based on polling or other user-defined
1355 * @DPNI_DEST_DPIO: The queue is set in schedule mode and generates FQDAN
1356 * notifications to the specified DPIO; user is expected to dequeue
1357 * from the queue only after notification is received
1358 * @DPNI_DEST_DPCON: The queue is set in schedule mode and does not generate
1359 * FQDAN notifications, but is connected to the specified DPCON
1360 * object; user is expected to dequeue from the DPCON channel
1369 * struct dpni_dest_cfg - Structure representing DPNI destination parameters
1370 * @dest_type: Destination type
1371 * @dest_id: Either DPIO ID or DPCON ID, depending on the destination type
1372 * @priority: Priority selection within the DPIO or DPCON channel; valid values
1373 * are 0-1 or 0-7, depending on the number of priorities in that
1374 * channel; not relevant for 'DPNI_DEST_NONE' option
1376 struct dpni_dest_cfg {
1377 enum dpni_dest dest_type;
1383 * enum dpni_flc_type - DPNI FLC types
1384 * @DPNI_FLC_USER_DEFINED: select the FLC to be used for user defined value
1385 * @DPNI_FLC_STASH: select the FLC to be used for stash control
1387 enum dpni_flc_type {
1388 DPNI_FLC_USER_DEFINED = 0,
1393 * enum dpni_stash_size - DPNI FLC stashing size
1394 * @DPNI_STASH_SIZE_0B: no stash
1395 * @DPNI_STASH_SIZE_64B: stashes 64 bytes
1396 * @DPNI_STASH_SIZE_128B: stashes 128 bytes
1397 * @DPNI_STASH_SIZE_192B: stashes 192 bytes
1399 enum dpni_stash_size {
1400 DPNI_STASH_SIZE_0B = 0,
1401 DPNI_STASH_SIZE_64B = 1,
1402 DPNI_STASH_SIZE_128B = 2,
1403 DPNI_STASH_SIZE_192B = 3,
1406 /* DPNI FLC stash options */
1408 /* stashes the whole annotation area (up to 192 bytes) */
1409 #define DPNI_FLC_STASH_FRAME_ANNOTATION 0x00000001
1412 * struct dpni_flc_cfg - Structure representing DPNI FLC configuration
1413 * @flc_type: FLC type
1414 * @options: Mask of available options;
1415 * use 'DPNI_FLC_STASH_<X>' values
1416 * @frame_data_size: Size of frame data to be stashed
1417 * @flow_context_size: Size of flow context to be stashed
1418 * @flow_context: 1. In case flc_type is 'DPNI_FLC_USER_DEFINED':
1419 * this value will be provided in the frame descriptor
1421 * 2. In case flc_type is 'DPNI_FLC_STASH':
1422 * this value will be I/O virtual address of the
1424 * Must be cacheline-aligned and DMA-able memory
1426 struct dpni_flc_cfg {
1427 enum dpni_flc_type flc_type;
1429 enum dpni_stash_size frame_data_size;
1430 enum dpni_stash_size flow_context_size;
1431 uint64_t flow_context;
1434 /* DPNI queue modification options */
1436 /* Select to modify the user's context associated with the queue */
1437 #define DPNI_QUEUE_OPT_USER_CTX 0x00000001
1438 /* Select to modify the queue's destination */
1439 #define DPNI_QUEUE_OPT_DEST 0x00000002
1440 /** Select to modify the flow-context parameters;
1441 * not applicable for Tx-conf/Err queues as the FD comes from the user
1443 #define DPNI_QUEUE_OPT_FLC 0x00000004
1444 /* Select to modify the queue's order preservation */
1445 #define DPNI_QUEUE_OPT_ORDER_PRESERVATION 0x00000008
1446 /* Select to modify the queue's tail-drop threshold */
1447 #define DPNI_QUEUE_OPT_TAILDROP_THRESHOLD 0x00000010
1450 * struct dpni_queue_cfg - Structure representing queue configuration
1451 * @options: Flags representing the suggested modifications to the queue;
1452 * Use any combination of 'DPNI_QUEUE_OPT_<X>' flags
1453 * @user_ctx: User context value provided in the frame descriptor of each
1454 * dequeued frame; valid only if 'DPNI_QUEUE_OPT_USER_CTX'
1455 * is contained in 'options'
1456 * @dest_cfg: Queue destination parameters;
1457 * valid only if 'DPNI_QUEUE_OPT_DEST' is contained in 'options'
1458 * @flc_cfg: Flow context configuration; in case the TC's distribution
1459 * is either NONE or HASH the FLC's settings of flow#0 are used.
1460 * in the case of FS (flow-steering) the flow's FLC settings
1462 * valid only if 'DPNI_QUEUE_OPT_FLC' is contained in 'options'
1463 * @order_preservation_en: enable/disable order preservation;
1464 * valid only if 'DPNI_QUEUE_OPT_ORDER_PRESERVATION' is contained
1466 * @tail_drop_threshold: set the queue's tail drop threshold in bytes;
1467 * '0' value disable the threshold; maximum value is 0xE000000;
1468 * valid only if 'DPNI_QUEUE_OPT_TAILDROP_THRESHOLD' is contained
1471 struct dpni_queue_cfg {
1474 struct dpni_dest_cfg dest_cfg;
1475 struct dpni_flc_cfg flc_cfg;
1476 int order_preservation_en;
1477 uint32_t tail_drop_threshold;
1481 * struct dpni_queue_attr - Structure representing queue attributes
1482 * @user_ctx: User context value provided in the frame descriptor of each
1484 * @dest_cfg: Queue destination configuration
1485 * @flc_cfg: Flow context configuration
1486 * @order_preservation_en: enable/disable order preservation
1487 * @tail_drop_threshold: queue's tail drop threshold in bytes;
1488 * @fqid: Virtual fqid value to be used for dequeue operations
1490 struct dpni_queue_attr {
1492 struct dpni_dest_cfg dest_cfg;
1493 struct dpni_flc_cfg flc_cfg;
1494 int order_preservation_en;
1495 uint32_t tail_drop_threshold;
1499 /* DPNI Tx flow modification options */
1501 /* Select to modify the settings for dedicate Tx confirmation/error */
1502 #define DPNI_TX_FLOW_OPT_TX_CONF_ERROR 0x00000001
1503 /*!< Select to modify the L3 checksum generation setting */
1504 #define DPNI_TX_FLOW_OPT_L3_CHKSUM_GEN 0x00000010
1505 /*!< Select to modify the L4 checksum generation setting */
1506 #define DPNI_TX_FLOW_OPT_L4_CHKSUM_GEN 0x00000020
1509 * struct dpni_tx_flow_cfg - Structure representing Tx flow configuration
1510 * @options: Flags representing the suggested modifications to the Tx flow;
1511 * Use any combination 'DPNI_TX_FLOW_OPT_<X>' flags
1512 * @use_common_tx_conf_queue: Set to '1' to use the common (default) Tx
1513 * confirmation and error queue; Set to '0' to use the private
1514 * Tx confirmation and error queue; valid only if
1515 * 'DPNI_OPT_PRIVATE_TX_CONF_ERROR_DISABLED' wasn't set at DPNI creation
1516 * and 'DPNI_TX_FLOW_OPT_TX_CONF_ERROR' is contained in 'options'
1517 * @l3_chksum_gen: Set to '1' to enable L3 checksum generation; '0' to disable;
1518 * valid only if 'DPNI_TX_FLOW_OPT_L3_CHKSUM_GEN' is contained in 'options'
1519 * @l4_chksum_gen: Set to '1' to enable L4 checksum generation; '0' to disable;
1520 * valid only if 'DPNI_TX_FLOW_OPT_L4_CHKSUM_GEN' is contained in 'options'
1522 struct dpni_tx_flow_cfg {
1524 int use_common_tx_conf_queue;
1530 * dpni_set_tx_flow() - Set Tx flow configuration
1531 * @mc_io: Pointer to MC portal's I/O object
1532 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1533 * @token: Token of DPNI object
1534 * @flow_id: Provides (or returns) the sender's flow ID;
1535 * for each new sender set (*flow_id) to 'DPNI_NEW_FLOW_ID' to generate
1536 * a new flow_id; this ID should be used as the QDBIN argument
1537 * in enqueue operations
1538 * @cfg: Tx flow configuration
1540 * Return: '0' on Success; Error code otherwise.
1542 int dpni_set_tx_flow(struct fsl_mc_io *mc_io,
1546 const struct dpni_tx_flow_cfg *cfg);
1549 * struct dpni_tx_flow_attr - Structure representing Tx flow attributes
1550 * @use_common_tx_conf_queue: '1' if using common (default) Tx confirmation and
1551 * error queue; '0' if using private Tx confirmation and error queue
1552 * @l3_chksum_gen: '1' if L3 checksum generation is enabled; '0' if disabled
1553 * @l4_chksum_gen: '1' if L4 checksum generation is enabled; '0' if disabled
1555 struct dpni_tx_flow_attr {
1556 int use_common_tx_conf_queue;
1562 * dpni_get_tx_flow() - Get Tx flow attributes
1563 * @mc_io: Pointer to MC portal's I/O object
1564 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1565 * @token: Token of DPNI object
1566 * @flow_id: The sender's flow ID, as returned by the
1567 * dpni_set_tx_flow() function
1568 * @attr: Returned Tx flow attributes
1570 * Return: '0' on Success; Error code otherwise.
1572 int dpni_get_tx_flow(struct fsl_mc_io *mc_io,
1576 struct dpni_tx_flow_attr *attr);
1579 * struct dpni_tx_conf_cfg - Structure representing Tx conf configuration
1580 * @errors_only: Set to '1' to report back only error frames;
1581 * Set to '0' to confirm transmission/error for all transmitted frames;
1582 * @queue_cfg: Queue configuration
1584 struct dpni_tx_conf_cfg {
1586 struct dpni_queue_cfg queue_cfg;
1590 * dpni_set_tx_conf() - Set Tx confirmation and error queue configuration
1591 * @mc_io: Pointer to MC portal's I/O object
1592 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1593 * @token: Token of DPNI object
1594 * @flow_id: The sender's flow ID, as returned by the
1595 * dpni_set_tx_flow() function;
1596 * use 'DPNI_COMMON_TX_CONF' for common tx-conf
1597 * @cfg: Queue configuration
1599 * If either 'DPNI_OPT_TX_CONF_DISABLED' or
1600 * 'DPNI_OPT_PRIVATE_TX_CONF_ERROR_DISABLED' were selected at DPNI creation,
1601 * this function can ONLY be used with 'flow_id == DPNI_COMMON_TX_CONF';
1602 * i.e. only serve the common tx-conf-err queue;
1603 * if 'DPNI_OPT_TX_CONF_DISABLED' was selected, only error frames are reported
1604 * back - successfully transmitted frames are not confirmed. Otherwise, all
1605 * transmitted frames are sent for confirmation.
1607 * Return: '0' on Success; Error code otherwise.
1609 int dpni_set_tx_conf(struct fsl_mc_io *mc_io,
1613 const struct dpni_tx_conf_cfg *cfg);
1616 * struct dpni_tx_conf_attr - Structure representing Tx conf attributes
1617 * @errors_only: '1' if only error frames are reported back; '0' if all
1618 * transmitted frames are confirmed
1619 * @queue_attr: Queue attributes
1621 struct dpni_tx_conf_attr {
1623 struct dpni_queue_attr queue_attr;
1627 * dpni_get_tx_conf() - Get Tx confirmation and error queue attributes
1628 * @mc_io: Pointer to MC portal's I/O object
1629 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1630 * @token: Token of DPNI object
1631 * @flow_id: The sender's flow ID, as returned by the
1632 * dpni_set_tx_flow() function;
1633 * use 'DPNI_COMMON_TX_CONF' for common tx-conf
1634 * @attr: Returned tx-conf attributes
1636 * If either 'DPNI_OPT_TX_CONF_DISABLED' or
1637 * 'DPNI_OPT_PRIVATE_TX_CONF_ERROR_DISABLED' were selected at DPNI creation,
1638 * this function can ONLY be used with 'flow_id == DPNI_COMMON_TX_CONF';
1639 * i.e. only serve the common tx-conf-err queue;
1641 * Return: '0' on Success; Error code otherwise.
1643 int dpni_get_tx_conf(struct fsl_mc_io *mc_io,
1647 struct dpni_tx_conf_attr *attr);
1649 * dpni_set_rx_flow() - Set Rx flow configuration
1650 * @mc_io: Pointer to MC portal's I/O object
1651 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1652 * @token: Token of DPNI object
1653 * @tc_id: Traffic class selection (0-7);
1654 * use 'DPNI_ALL_TCS' to set all TCs and all flows
1655 * @flow_id: Rx flow id within the traffic class; use
1656 * 'DPNI_ALL_TC_FLOWS' to set all flows within
1657 * this tc_id; ignored if tc_id is set to
1659 * @cfg: Rx flow configuration
1661 * Return: '0' on Success; Error code otherwise.
1663 int dpni_set_rx_flow(struct fsl_mc_io *mc_io,
1668 const struct dpni_queue_cfg *cfg);
1671 * dpni_get_rx_flow() - Get Rx flow attributes
1672 * @mc_io: Pointer to MC portal's I/O object
1673 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1674 * @token: Token of DPNI object
1675 * @tc_id: Traffic class selection (0-7)
1676 * @flow_id: Rx flow id within the traffic class
1677 * @attr: Returned Rx flow attributes
1679 * Return: '0' on Success; Error code otherwise.
1681 int dpni_get_rx_flow(struct fsl_mc_io *mc_io,
1686 struct dpni_queue_attr *attr);
1688 #endif /* _FSL_DPNI_H */