2 * Copyright (C) 2013-2015 Freescale Semiconductor
4 * SPDX-License-Identifier: GPL-2.0+
10 #define DPNI_VER_MAJOR 5
11 #define DPNI_VER_MINOR 1
14 #define DPNI_CMDID_OPEN 0x801
15 #define DPNI_CMDID_CLOSE 0x800
17 #define DPNI_CMDID_ENABLE 0x002
18 #define DPNI_CMDID_DISABLE 0x003
19 #define DPNI_CMDID_GET_ATTR 0x004
20 #define DPNI_CMDID_RESET 0x005
22 #define DPNI_CMDID_SET_POOLS 0x200
23 #define DPNI_CMDID_GET_RX_BUFFER_LAYOUT 0x201
24 #define DPNI_CMDID_SET_RX_BUFFER_LAYOUT 0x202
25 #define DPNI_CMDID_GET_TX_BUFFER_LAYOUT 0x203
26 #define DPNI_CMDID_SET_TX_BUFFER_LAYOUT 0x204
27 #define DPNI_CMDID_SET_TX_CONF_BUFFER_LAYOUT 0x205
28 #define DPNI_CMDID_GET_TX_CONF_BUFFER_LAYOUT 0x206
30 #define DPNI_CMDID_GET_QDID 0x210
31 #define DPNI_CMDID_GET_TX_DATA_OFFSET 0x212
32 #define DPNI_CMDID_GET_COUNTER 0x213
33 #define DPNI_CMDID_SET_COUNTER 0x214
34 #define DPNI_CMDID_GET_LINK_STATE 0x215
35 #define DPNI_CMDID_SET_LINK_CFG 0x21A
37 #define DPNI_CMDID_SET_PRIM_MAC 0x224
38 #define DPNI_CMDID_GET_PRIM_MAC 0x225
39 #define DPNI_CMDID_ADD_MAC_ADDR 0x226
40 #define DPNI_CMDID_REMOVE_MAC_ADDR 0x227
42 #define DPNI_CMDID_SET_TX_FLOW 0x236
43 #define DPNI_CMDID_GET_TX_FLOW 0x237
44 #define DPNI_CMDID_SET_RX_FLOW 0x238
45 #define DPNI_CMDID_GET_RX_FLOW 0x239
47 /* cmd, param, offset, width, type, arg_name */
48 #define DPNI_CMD_OPEN(cmd, dpni_id) \
49 MC_CMD_OP(cmd, 0, 0, 32, int, dpni_id)
52 /* cmd, param, offset, width, type, arg_name */
53 #define DPNI_CMD_SET_POOLS(cmd, cfg) \
55 MC_CMD_OP(cmd, 0, 0, 8, uint8_t, cfg->num_dpbp); \
56 MC_CMD_OP(cmd, 0, 32, 32, int, cfg->pools[0].dpbp_id); \
57 MC_CMD_OP(cmd, 4, 32, 16, uint16_t, cfg->pools[0].buffer_size);\
58 MC_CMD_OP(cmd, 1, 0, 32, int, cfg->pools[1].dpbp_id); \
59 MC_CMD_OP(cmd, 4, 48, 16, uint16_t, cfg->pools[1].buffer_size);\
60 MC_CMD_OP(cmd, 1, 32, 32, int, cfg->pools[2].dpbp_id); \
61 MC_CMD_OP(cmd, 5, 0, 16, uint16_t, cfg->pools[2].buffer_size);\
62 MC_CMD_OP(cmd, 2, 0, 32, int, cfg->pools[3].dpbp_id); \
63 MC_CMD_OP(cmd, 5, 16, 16, uint16_t, cfg->pools[3].buffer_size);\
64 MC_CMD_OP(cmd, 2, 32, 32, int, cfg->pools[4].dpbp_id); \
65 MC_CMD_OP(cmd, 5, 32, 16, uint16_t, cfg->pools[4].buffer_size);\
66 MC_CMD_OP(cmd, 3, 0, 32, int, cfg->pools[5].dpbp_id); \
67 MC_CMD_OP(cmd, 5, 48, 16, uint16_t, cfg->pools[5].buffer_size);\
68 MC_CMD_OP(cmd, 3, 32, 32, int, cfg->pools[6].dpbp_id); \
69 MC_CMD_OP(cmd, 6, 0, 16, uint16_t, cfg->pools[6].buffer_size);\
70 MC_CMD_OP(cmd, 4, 0, 32, int, cfg->pools[7].dpbp_id); \
71 MC_CMD_OP(cmd, 6, 16, 16, uint16_t, cfg->pools[7].buffer_size);\
74 /* cmd, param, offset, width, type, arg_name */
75 #define DPNI_RSP_GET_ATTR(cmd, attr) \
77 MC_RSP_OP(cmd, 0, 0, 32, int, attr->id);\
78 MC_RSP_OP(cmd, 0, 32, 8, uint8_t, attr->max_tcs); \
79 MC_RSP_OP(cmd, 0, 40, 8, uint8_t, attr->max_senders); \
80 MC_RSP_OP(cmd, 0, 48, 8, enum net_prot, attr->start_hdr); \
81 MC_RSP_OP(cmd, 1, 0, 32, uint32_t, attr->options); \
82 MC_RSP_OP(cmd, 2, 0, 8, uint8_t, attr->max_unicast_filters); \
83 MC_RSP_OP(cmd, 2, 8, 8, uint8_t, attr->max_multicast_filters);\
84 MC_RSP_OP(cmd, 2, 16, 8, uint8_t, attr->max_vlan_filters); \
85 MC_RSP_OP(cmd, 2, 24, 8, uint8_t, attr->max_qos_entries); \
86 MC_RSP_OP(cmd, 2, 32, 8, uint8_t, attr->max_qos_key_size); \
87 MC_RSP_OP(cmd, 2, 40, 8, uint8_t, attr->max_dist_key_size); \
88 MC_RSP_OP(cmd, 3, 0, 8, uint8_t, attr->max_dist_per_tc[0]); \
89 MC_RSP_OP(cmd, 3, 8, 8, uint8_t, attr->max_dist_per_tc[1]); \
90 MC_RSP_OP(cmd, 3, 16, 8, uint8_t, attr->max_dist_per_tc[2]); \
91 MC_RSP_OP(cmd, 3, 24, 8, uint8_t, attr->max_dist_per_tc[3]); \
92 MC_RSP_OP(cmd, 3, 32, 8, uint8_t, attr->max_dist_per_tc[4]); \
93 MC_RSP_OP(cmd, 3, 40, 8, uint8_t, attr->max_dist_per_tc[5]); \
94 MC_RSP_OP(cmd, 3, 48, 8, uint8_t, attr->max_dist_per_tc[6]); \
95 MC_RSP_OP(cmd, 3, 56, 8, uint8_t, attr->max_dist_per_tc[7]); \
96 MC_RSP_OP(cmd, 4, 0, 16, uint16_t, \
97 attr->ipr_cfg.max_reass_frm_size); \
98 MC_RSP_OP(cmd, 4, 16, 16, uint16_t, \
99 attr->ipr_cfg.min_frag_size_ipv4); \
100 MC_RSP_OP(cmd, 4, 32, 16, uint16_t, \
101 attr->ipr_cfg.min_frag_size_ipv6);\
102 MC_RSP_OP(cmd, 4, 48, 8, uint8_t, attr->max_policers); \
103 MC_RSP_OP(cmd, 4, 56, 8, uint8_t, attr->max_congestion_ctrl); \
104 MC_RSP_OP(cmd, 5, 0, 16, uint16_t, \
105 attr->ipr_cfg.max_open_frames_ipv4); \
106 MC_RSP_OP(cmd, 5, 16, 16, uint16_t, \
107 attr->ipr_cfg.max_open_frames_ipv6); \
108 MC_RSP_OP(cmd, 5, 32, 16, uint16_t, attr->version.major);\
109 MC_RSP_OP(cmd, 5, 48, 16, uint16_t, attr->version.minor);\
112 /* cmd, param, offset, width, type, arg_name */
113 #define DPNI_RSP_GET_RX_BUFFER_LAYOUT(cmd, layout) \
115 MC_RSP_OP(cmd, 0, 0, 16, uint16_t, layout->private_data_size); \
116 MC_RSP_OP(cmd, 0, 16, 16, uint16_t, layout->data_align); \
117 MC_RSP_OP(cmd, 1, 0, 1, int, layout->pass_timestamp); \
118 MC_RSP_OP(cmd, 1, 1, 1, int, layout->pass_parser_result); \
119 MC_RSP_OP(cmd, 1, 2, 1, int, layout->pass_frame_status); \
120 MC_RSP_OP(cmd, 1, 16, 16, uint16_t, layout->data_head_room); \
121 MC_RSP_OP(cmd, 1, 32, 16, uint16_t, layout->data_tail_room); \
124 /* cmd, param, offset, width, type, arg_name */
125 #define DPNI_CMD_SET_RX_BUFFER_LAYOUT(cmd, layout) \
127 MC_CMD_OP(cmd, 0, 0, 16, uint16_t, layout->private_data_size); \
128 MC_CMD_OP(cmd, 0, 16, 16, uint16_t, layout->data_align); \
129 MC_CMD_OP(cmd, 0, 32, 32, uint32_t, layout->options); \
130 MC_CMD_OP(cmd, 1, 0, 1, int, layout->pass_timestamp); \
131 MC_CMD_OP(cmd, 1, 1, 1, int, layout->pass_parser_result); \
132 MC_CMD_OP(cmd, 1, 2, 1, int, layout->pass_frame_status); \
133 MC_CMD_OP(cmd, 1, 16, 16, uint16_t, layout->data_head_room); \
134 MC_CMD_OP(cmd, 1, 32, 16, uint16_t, layout->data_tail_room); \
137 /* cmd, param, offset, width, type, arg_name */
138 #define DPNI_RSP_GET_TX_BUFFER_LAYOUT(cmd, layout) \
140 MC_RSP_OP(cmd, 0, 0, 16, uint16_t, layout->private_data_size); \
141 MC_RSP_OP(cmd, 0, 16, 16, uint16_t, layout->data_align); \
142 MC_RSP_OP(cmd, 1, 0, 1, int, layout->pass_timestamp); \
143 MC_RSP_OP(cmd, 1, 1, 1, int, layout->pass_parser_result); \
144 MC_RSP_OP(cmd, 1, 2, 1, int, layout->pass_frame_status); \
145 MC_RSP_OP(cmd, 1, 16, 16, uint16_t, layout->data_head_room); \
146 MC_RSP_OP(cmd, 1, 32, 16, uint16_t, layout->data_tail_room); \
149 /* cmd, param, offset, width, type, arg_name */
150 #define DPNI_CMD_SET_TX_BUFFER_LAYOUT(cmd, layout) \
152 MC_CMD_OP(cmd, 0, 0, 16, uint16_t, layout->private_data_size); \
153 MC_CMD_OP(cmd, 0, 16, 16, uint16_t, layout->data_align); \
154 MC_CMD_OP(cmd, 0, 32, 32, uint32_t, layout->options); \
155 MC_CMD_OP(cmd, 1, 0, 1, int, layout->pass_timestamp); \
156 MC_CMD_OP(cmd, 1, 1, 1, int, layout->pass_parser_result); \
157 MC_CMD_OP(cmd, 1, 2, 1, int, layout->pass_frame_status); \
158 MC_CMD_OP(cmd, 1, 16, 16, uint16_t, layout->data_head_room); \
159 MC_CMD_OP(cmd, 1, 32, 16, uint16_t, layout->data_tail_room); \
162 /* cmd, param, offset, width, type, arg_name */
163 #define DPNI_RSP_GET_TX_CONF_BUFFER_LAYOUT(cmd, layout) \
165 MC_RSP_OP(cmd, 0, 0, 16, uint16_t, layout->private_data_size); \
166 MC_RSP_OP(cmd, 0, 16, 16, uint16_t, layout->data_align); \
167 MC_RSP_OP(cmd, 1, 0, 1, int, layout->pass_timestamp); \
168 MC_RSP_OP(cmd, 1, 1, 1, int, layout->pass_parser_result); \
169 MC_RSP_OP(cmd, 1, 2, 1, int, layout->pass_frame_status); \
170 MC_RSP_OP(cmd, 1, 16, 16, uint16_t, layout->data_head_room); \
171 MC_RSP_OP(cmd, 1, 32, 16, uint16_t, layout->data_tail_room); \
174 /* cmd, param, offset, width, type, arg_name */
175 #define DPNI_CMD_SET_TX_CONF_BUFFER_LAYOUT(cmd, layout) \
177 MC_CMD_OP(cmd, 0, 0, 16, uint16_t, layout->private_data_size); \
178 MC_CMD_OP(cmd, 0, 16, 16, uint16_t, layout->data_align); \
179 MC_CMD_OP(cmd, 0, 32, 32, uint32_t, layout->options); \
180 MC_CMD_OP(cmd, 1, 0, 1, int, layout->pass_timestamp); \
181 MC_CMD_OP(cmd, 1, 1, 1, int, layout->pass_parser_result); \
182 MC_CMD_OP(cmd, 1, 2, 1, int, layout->pass_frame_status); \
183 MC_CMD_OP(cmd, 1, 16, 16, uint16_t, layout->data_head_room); \
184 MC_CMD_OP(cmd, 1, 32, 16, uint16_t, layout->data_tail_room); \
187 /* cmd, param, offset, width, type, arg_name */
188 #define DPNI_RSP_GET_QDID(cmd, qdid) \
189 MC_RSP_OP(cmd, 0, 0, 16, uint16_t, qdid)
191 /* cmd, param, offset, width, type, arg_name */
192 #define DPNI_RSP_GET_TX_DATA_OFFSET(cmd, data_offset) \
193 MC_RSP_OP(cmd, 0, 0, 16, uint16_t, data_offset)
195 /* cmd, param, offset, width, type, arg_name */
196 #define DPNI_CMD_GET_COUNTER(cmd, counter) \
197 MC_CMD_OP(cmd, 0, 0, 16, enum dpni_counter, counter)
199 /* cmd, param, offset, width, type, arg_name */
200 #define DPNI_RSP_GET_COUNTER(cmd, value) \
201 MC_RSP_OP(cmd, 1, 0, 64, uint64_t, value)
203 /* cmd, param, offset, width, type, arg_name */
204 #define DPNI_CMD_SET_COUNTER(cmd, counter, value) \
206 MC_CMD_OP(cmd, 0, 0, 16, enum dpni_counter, counter); \
207 MC_CMD_OP(cmd, 1, 0, 64, uint64_t, value); \
210 /* cmd, param, offset, width, type, arg_name */
211 #define DPNI_CMD_SET_LINK_CFG(cmd, cfg) \
213 MC_CMD_OP(cmd, 1, 0, 32, uint32_t, cfg->rate);\
214 MC_CMD_OP(cmd, 2, 0, 64, uint64_t, cfg->options);\
217 /* cmd, param, offset, width, type, arg_name */
218 #define DPNI_RSP_GET_LINK_STATE(cmd, state) \
220 MC_RSP_OP(cmd, 0, 32, 1, int, state->up);\
221 MC_RSP_OP(cmd, 1, 0, 32, uint32_t, state->rate);\
222 MC_RSP_OP(cmd, 2, 0, 64, uint64_t, state->options);\
227 /* cmd, param, offset, width, type, arg_name */
228 #define DPNI_CMD_SET_PRIMARY_MAC_ADDR(cmd, mac_addr) \
230 MC_CMD_OP(cmd, 0, 16, 8, uint8_t, mac_addr[5]); \
231 MC_CMD_OP(cmd, 0, 24, 8, uint8_t, mac_addr[4]); \
232 MC_CMD_OP(cmd, 0, 32, 8, uint8_t, mac_addr[3]); \
233 MC_CMD_OP(cmd, 0, 40, 8, uint8_t, mac_addr[2]); \
234 MC_CMD_OP(cmd, 0, 48, 8, uint8_t, mac_addr[1]); \
235 MC_CMD_OP(cmd, 0, 56, 8, uint8_t, mac_addr[0]); \
238 /* cmd, param, offset, width, type, arg_name */
239 #define DPNI_RSP_GET_PRIMARY_MAC_ADDR(cmd, mac_addr) \
241 MC_RSP_OP(cmd, 0, 16, 8, uint8_t, mac_addr[5]); \
242 MC_RSP_OP(cmd, 0, 24, 8, uint8_t, mac_addr[4]); \
243 MC_RSP_OP(cmd, 0, 32, 8, uint8_t, mac_addr[3]); \
244 MC_RSP_OP(cmd, 0, 40, 8, uint8_t, mac_addr[2]); \
245 MC_RSP_OP(cmd, 0, 48, 8, uint8_t, mac_addr[1]); \
246 MC_RSP_OP(cmd, 0, 56, 8, uint8_t, mac_addr[0]); \
249 /* cmd, param, offset, width, type, arg_name */
250 #define DPNI_CMD_ADD_MAC_ADDR(cmd, mac_addr) \
252 MC_CMD_OP(cmd, 0, 16, 8, uint8_t, mac_addr[5]); \
253 MC_CMD_OP(cmd, 0, 24, 8, uint8_t, mac_addr[4]); \
254 MC_CMD_OP(cmd, 0, 32, 8, uint8_t, mac_addr[3]); \
255 MC_CMD_OP(cmd, 0, 40, 8, uint8_t, mac_addr[2]); \
256 MC_CMD_OP(cmd, 0, 48, 8, uint8_t, mac_addr[1]); \
257 MC_CMD_OP(cmd, 0, 56, 8, uint8_t, mac_addr[0]); \
260 /* cmd, param, offset, width, type, arg_name */
261 #define DPNI_CMD_REMOVE_MAC_ADDR(cmd, mac_addr) \
263 MC_CMD_OP(cmd, 0, 16, 8, uint8_t, mac_addr[5]); \
264 MC_CMD_OP(cmd, 0, 24, 8, uint8_t, mac_addr[4]); \
265 MC_CMD_OP(cmd, 0, 32, 8, uint8_t, mac_addr[3]); \
266 MC_CMD_OP(cmd, 0, 40, 8, uint8_t, mac_addr[2]); \
267 MC_CMD_OP(cmd, 0, 48, 8, uint8_t, mac_addr[1]); \
268 MC_CMD_OP(cmd, 0, 56, 8, uint8_t, mac_addr[0]); \
271 /* cmd, param, offset, width, type, arg_name */
272 #define DPNI_CMD_SET_TX_FLOW(cmd, flow_id, cfg) \
274 MC_CMD_OP(cmd, 0, 0, 32, int, \
275 cfg->conf_err_cfg.queue_cfg.dest_cfg.dest_id);\
276 MC_CMD_OP(cmd, 0, 32, 8, uint8_t, \
277 cfg->conf_err_cfg.queue_cfg.dest_cfg.priority);\
278 MC_CMD_OP(cmd, 0, 40, 2, enum dpni_dest, \
279 cfg->conf_err_cfg.queue_cfg.dest_cfg.dest_type);\
280 MC_CMD_OP(cmd, 0, 42, 1, int, cfg->conf_err_cfg.errors_only);\
281 MC_CMD_OP(cmd, 0, 43, 1, int, cfg->l3_chksum_gen);\
282 MC_CMD_OP(cmd, 0, 44, 1, int, cfg->l4_chksum_gen);\
283 MC_CMD_OP(cmd, 0, 45, 1, int, \
284 cfg->conf_err_cfg.use_default_queue);\
285 MC_CMD_OP(cmd, 0, 48, 16, uint16_t, flow_id);\
286 MC_CMD_OP(cmd, 1, 0, 64, uint64_t, \
287 cfg->conf_err_cfg.queue_cfg.user_ctx);\
288 MC_CMD_OP(cmd, 2, 0, 32, uint32_t, cfg->options);\
289 MC_CMD_OP(cmd, 2, 32, 32, uint32_t, \
290 cfg->conf_err_cfg.queue_cfg.options);\
293 /* cmd, param, offset, width, type, arg_name */
294 #define DPNI_RSP_SET_TX_FLOW(cmd, flow_id) \
295 MC_RSP_OP(cmd, 0, 48, 16, uint16_t, flow_id)
297 /* cmd, param, offset, width, type, arg_name */
298 #define DPNI_CMD_GET_TX_FLOW(cmd, flow_id) \
299 MC_CMD_OP(cmd, 0, 48, 16, uint16_t, flow_id)
301 /* cmd, param, offset, width, type, arg_name */
302 #define DPNI_RSP_GET_TX_FLOW(cmd, attr) \
304 MC_RSP_OP(cmd, 0, 0, 32, int, \
305 attr->conf_err_attr.queue_attr.dest_cfg.dest_id);\
306 MC_RSP_OP(cmd, 0, 32, 8, uint8_t, \
307 attr->conf_err_attr.queue_attr.dest_cfg.priority);\
308 MC_RSP_OP(cmd, 0, 40, 2, enum dpni_dest, \
309 attr->conf_err_attr.queue_attr.dest_cfg.dest_type);\
310 MC_RSP_OP(cmd, 0, 42, 1, int, attr->conf_err_attr.errors_only);\
311 MC_RSP_OP(cmd, 0, 43, 1, int, attr->l3_chksum_gen);\
312 MC_RSP_OP(cmd, 0, 44, 1, int, attr->l4_chksum_gen);\
313 MC_RSP_OP(cmd, 0, 45, 1, int, \
314 attr->conf_err_attr.use_default_queue);\
315 MC_RSP_OP(cmd, 1, 0, 64, uint64_t, \
316 attr->conf_err_attr.queue_attr.user_ctx);\
317 MC_RSP_OP(cmd, 2, 32, 32, uint32_t, \
318 attr->conf_err_attr.queue_attr.fqid);\
321 /* cmd, param, offset, width, type, arg_name */
322 #define DPNI_CMD_SET_RX_FLOW(cmd, tc_id, flow_id, cfg) \
324 MC_CMD_OP(cmd, 0, 0, 32, int, cfg->dest_cfg.dest_id); \
325 MC_CMD_OP(cmd, 0, 32, 8, uint8_t, cfg->dest_cfg.priority);\
326 MC_CMD_OP(cmd, 0, 40, 2, enum dpni_dest, cfg->dest_cfg.dest_type);\
327 MC_CMD_OP(cmd, 0, 42, 1, int, cfg->order_preservation_en);\
328 MC_CMD_OP(cmd, 0, 48, 16, uint16_t, flow_id); \
329 MC_CMD_OP(cmd, 1, 0, 64, uint64_t, cfg->user_ctx); \
330 MC_CMD_OP(cmd, 2, 16, 8, uint8_t, tc_id); \
331 MC_CMD_OP(cmd, 2, 32, 32, uint32_t, cfg->options); \
332 MC_CMD_OP(cmd, 3, 0, 4, enum dpni_flc_type, cfg->flc_cfg.flc_type); \
333 MC_CMD_OP(cmd, 3, 4, 4, enum dpni_stash_size, \
334 cfg->flc_cfg.frame_data_size);\
335 MC_CMD_OP(cmd, 3, 8, 4, enum dpni_stash_size, \
336 cfg->flc_cfg.flow_context_size);\
337 MC_CMD_OP(cmd, 3, 32, 32, uint32_t, cfg->flc_cfg.options);\
338 MC_CMD_OP(cmd, 4, 0, 64, uint64_t, cfg->flc_cfg.flow_context);\
341 /* cmd, param, offset, width, type, arg_name */
342 #define DPNI_CMD_GET_RX_FLOW(cmd, tc_id, flow_id) \
344 MC_CMD_OP(cmd, 0, 16, 8, uint8_t, tc_id); \
345 MC_CMD_OP(cmd, 0, 48, 16, uint16_t, flow_id); \
348 /* cmd, param, offset, width, type, arg_name */
349 #define DPNI_RSP_GET_RX_FLOW(cmd, attr) \
351 MC_RSP_OP(cmd, 0, 0, 32, int, attr->dest_cfg.dest_id); \
352 MC_RSP_OP(cmd, 0, 32, 8, uint8_t, attr->dest_cfg.priority);\
353 MC_RSP_OP(cmd, 0, 40, 2, enum dpni_dest, attr->dest_cfg.dest_type); \
354 MC_CMD_OP(cmd, 0, 42, 1, int, attr->order_preservation_en);\
355 MC_RSP_OP(cmd, 1, 0, 64, uint64_t, attr->user_ctx); \
356 MC_RSP_OP(cmd, 2, 32, 32, uint32_t, attr->fqid); \
357 MC_RSP_OP(cmd, 3, 0, 4, enum dpni_flc_type, attr->flc_cfg.flc_type); \
358 MC_RSP_OP(cmd, 3, 4, 4, enum dpni_stash_size, \
359 attr->flc_cfg.frame_data_size);\
360 MC_RSP_OP(cmd, 3, 8, 4, enum dpni_stash_size, \
361 attr->flc_cfg.flow_context_size);\
362 MC_RSP_OP(cmd, 3, 32, 32, uint32_t, attr->flc_cfg.options);\
363 MC_RSP_OP(cmd, 4, 0, 64, uint64_t, attr->flc_cfg.flow_context);\
379 NET_PROT_SCTP_CHUNK_DATA,
383 NET_PROT_PPPMUX_SUBFRM,
385 NET_PROT_L2TPV3_CTRL,
386 NET_PROT_L2TPV3_SESS,
394 NET_PROT_UDP_ENC_ESP, /* RFC 3948 */
402 NET_PROT_CAPWAP_DATA,
403 NET_PROT_CAPWAP_CTRL,
410 NET_PROT_USER_DEFINED_L2,
411 NET_PROT_USER_DEFINED_L3,
412 NET_PROT_USER_DEFINED_L4,
413 NET_PROT_USER_DEFINED_L5,
414 NET_PROT_USER_DEFINED_SHIM1,
415 NET_PROT_USER_DEFINED_SHIM2,
421 * Data Path Network Interface API
422 * Contains initialization APIs and runtime control APIs for DPNI
427 /* General DPNI macros */
429 /* Maximum number of traffic classes */
430 #define DPNI_MAX_TC 8
431 /* Maximum number of buffer pools per DPNI */
432 #define DPNI_MAX_DPBP 8
434 /* All traffic classes considered; see dpni_set_rx_flow() */
435 #define DPNI_ALL_TCS (uint8_t)(-1)
436 /* All flows within traffic class considered; see dpni_set_rx_flow() */
437 #define DPNI_ALL_TC_FLOWS (uint16_t)(-1)
438 /* Generate new flow ID; see dpni_set_tx_flow() */
439 #define DPNI_NEW_FLOW_ID (uint16_t)(-1)
442 * dpni_open() - Open a control session for the specified object
443 * @mc_io: Pointer to MC portal's I/O object
444 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
445 * @dpni_id: DPNI unique ID
446 * @token: Returned token; use in subsequent API calls
448 * This function can be used to open a control session for an
449 * already created object; an object may have been declared in
450 * the DPL or by calling the dpni_create() function.
451 * This function returns a unique authentication token,
452 * associated with the specific object ID and the specific MC
453 * portal; this token must be used in all subsequent commands for
454 * this specific object.
456 * Return: '0' on Success; Error code otherwise.
458 int dpni_open(struct fsl_mc_io *mc_io,
464 * dpni_close() - Close the control session of the object
465 * @mc_io: Pointer to MC portal's I/O object
466 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
467 * @token: Token of DPNI object
469 * After this function is called, no further operations are
470 * allowed on the object without opening a new control session.
472 * Return: '0' on Success; Error code otherwise.
474 int dpni_close(struct fsl_mc_io *mc_io,
479 * struct dpni_ipr_cfg - Structure representing IP reassembly configuration
480 * @max_reass_frm_size: Maximum size of the reassembled frame
481 * @min_frag_size_ipv4: Minimum fragment size of IPv4 fragments
482 * @min_frag_size_ipv6: Minimum fragment size of IPv6 fragments
483 * @max_open_frames_ipv4: Maximum concurrent IPv4 packets in reassembly process
484 * @max_open_frames_ipv6: Maximum concurrent IPv6 packets in reassembly process
486 struct dpni_ipr_cfg {
487 uint16_t max_reass_frm_size;
488 uint16_t min_frag_size_ipv4;
489 uint16_t min_frag_size_ipv6;
490 uint16_t max_open_frames_ipv4;
491 uint16_t max_open_frames_ipv6;
495 * struct dpni_pools_cfg - Structure representing buffer pools configuration
496 * @num_dpbp: Number of DPBPs
497 * @pools: Array of buffer pools parameters; The number of valid entries
498 * must match 'num_dpbp' value
500 struct dpni_pools_cfg {
503 * struct pools - Buffer pools parameters
504 * @dpbp_id: DPBP object ID
505 * @buffer_size: Buffer size
506 * @backup_pool: Backup pool
510 uint16_t buffer_size;
512 } pools[DPNI_MAX_DPBP];
516 * dpni_set_pools() - Set buffer pools configuration
517 * @mc_io: Pointer to MC portal's I/O object
518 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
519 * @token: Token of DPNI object
520 * @cfg: Buffer pools configuration
522 * mandatory for DPNI operation
523 * warning:Allowed only when DPNI is disabled
525 * Return: '0' on Success; Error code otherwise.
527 int dpni_set_pools(struct fsl_mc_io *mc_io,
530 const struct dpni_pools_cfg *cfg);
533 * dpni_enable() - Enable the DPNI, allow sending and receiving frames.
534 * @mc_io: Pointer to MC portal's I/O object
535 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
536 * @token: Token of DPNI object
538 * Return: '0' on Success; Error code otherwise.
540 int dpni_enable(struct fsl_mc_io *mc_io,
545 * dpni_disable() - Disable the DPNI, stop sending and receiving frames.
546 * @mc_io: Pointer to MC portal's I/O object
547 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
548 * @token: Token of DPNI object
550 * Return: '0' on Success; Error code otherwise.
552 int dpni_disable(struct fsl_mc_io *mc_io,
558 * dpni_reset() - Reset the DPNI, returns the object to initial state.
559 * @mc_io: Pointer to MC portal's I/O object
560 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
561 * @token: Token of DPNI object
563 * Return: '0' on Success; Error code otherwise.
565 int dpni_reset(struct fsl_mc_io *mc_io,
570 * struct dpni_attr - Structure representing DPNI attributes
571 * @id: DPNI object ID
572 * @version: DPNI version
573 * @start_hdr: Indicates the packet starting header for parsing
574 * @options: Mask of available options; reflects the value as was given in
576 * @max_senders: Maximum number of different senders; used as the number
577 * of dedicated Tx flows;
578 * @max_tcs: Maximum number of traffic classes (for both Tx and Rx)
579 * @max_dist_per_tc: Maximum distribution size per Rx traffic class;
580 * Set to the required value minus 1
581 * @max_unicast_filters: Maximum number of unicast filters
582 * @max_multicast_filters: Maximum number of multicast filters
583 * @max_vlan_filters: Maximum number of VLAN filters
584 * @max_qos_entries: if 'max_tcs > 1', declares the maximum entries in QoS table
585 * @max_qos_key_size: Maximum key size for the QoS look-up
586 * @max_dist_key_size: Maximum key size for the distribution look-up
587 * @max_policers: Maximum number of policers;
588 * @max_congestion_ctrl: Maximum number of congestion control groups (CGs);
589 * @ipr_cfg: IP reassembly configuration
594 * struct version - DPNI version
595 * @major: DPNI major version
596 * @minor: DPNI minor version
602 enum net_prot start_hdr;
606 uint8_t max_dist_per_tc[DPNI_MAX_TC];
607 uint8_t max_unicast_filters;
608 uint8_t max_multicast_filters;
609 uint8_t max_vlan_filters;
610 uint8_t max_qos_entries;
611 uint8_t max_qos_key_size;
612 uint8_t max_dist_key_size;
613 uint8_t max_policers;
614 uint8_t max_congestion_ctrl;
615 struct dpni_ipr_cfg ipr_cfg;
619 * dpni_get_attributes() - Retrieve DPNI attributes.
620 * @mc_io: Pointer to MC portal's I/O object
621 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
622 * @token: Token of DPNI object
623 * @attr: Returned object's attributes
625 * Return: '0' on Success; Error code otherwise.
627 int dpni_get_attributes(struct fsl_mc_io *mc_io,
630 struct dpni_attr *attr);
632 /* DPNI buffer layout modification options */
634 /* Select to modify the time-stamp setting */
635 #define DPNI_BUF_LAYOUT_OPT_TIMESTAMP 0x00000001
636 /* Select to modify the parser-result setting; not applicable for Tx */
637 #define DPNI_BUF_LAYOUT_OPT_PARSER_RESULT 0x00000002
638 /* Select to modify the frame-status setting */
639 #define DPNI_BUF_LAYOUT_OPT_FRAME_STATUS 0x00000004
640 /* Select to modify the private-data-size setting */
641 #define DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE 0x00000008
642 /* Select to modify the data-alignment setting */
643 #define DPNI_BUF_LAYOUT_OPT_DATA_ALIGN 0x00000010
644 /* Select to modify the data-head-room setting */
645 #define DPNI_BUF_LAYOUT_OPT_DATA_HEAD_ROOM 0x00000020
646 /*!< Select to modify the data-tail-room setting */
647 #define DPNI_BUF_LAYOUT_OPT_DATA_TAIL_ROOM 0x00000040
650 * struct dpni_buffer_layout - Structure representing DPNI buffer layout
651 * @options: Flags representing the suggested modifications to the buffer
652 * layout; Use any combination of 'DPNI_BUF_LAYOUT_OPT_<X>' flags
653 * @pass_timestamp: Pass timestamp value
654 * @pass_parser_result: Pass parser results
655 * @pass_frame_status: Pass frame status
656 * @private_data_size: Size kept for private data (in bytes)
657 * @data_align: Data alignment
658 * @data_head_room: Data head room
659 * @data_tail_room: Data tail room
661 struct dpni_buffer_layout {
664 int pass_parser_result;
665 int pass_frame_status;
666 uint16_t private_data_size;
668 uint16_t data_head_room;
669 uint16_t data_tail_room;
673 * dpni_get_rx_buffer_layout() - Retrieve Rx buffer layout attributes.
674 * @mc_io: Pointer to MC portal's I/O object
675 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
676 * @token: Token of DPNI object
677 * @layout: Returns buffer layout attributes
679 * Return: '0' on Success; Error code otherwise.
681 int dpni_get_rx_buffer_layout(struct fsl_mc_io *mc_io,
684 struct dpni_buffer_layout *layout);
687 * dpni_set_rx_buffer_layout() - Set Rx buffer layout configuration.
688 * @mc_io: Pointer to MC portal's I/O object
689 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
690 * @token: Token of DPNI object
691 * @layout: Buffer layout configuration
693 * Return: '0' on Success; Error code otherwise.
695 * @warning Allowed only when DPNI is disabled
697 int dpni_set_rx_buffer_layout(struct fsl_mc_io *mc_io,
700 const struct dpni_buffer_layout *layout);
703 * dpni_get_tx_buffer_layout() - Retrieve Tx buffer layout attributes.
704 * @mc_io: Pointer to MC portal's I/O object
705 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
706 * @token: Token of DPNI object
707 * @layout: Returns buffer layout attributes
709 * Return: '0' on Success; Error code otherwise.
711 int dpni_get_tx_buffer_layout(struct fsl_mc_io *mc_io,
714 struct dpni_buffer_layout *layout);
717 * dpni_set_tx_buffer_layout() - Set Tx buffer layout configuration.
718 * @mc_io: Pointer to MC portal's I/O object
719 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
720 * @token: Token of DPNI object
721 * @layout: Buffer layout configuration
723 * Return: '0' on Success; Error code otherwise.
725 * @warning Allowed only when DPNI is disabled
727 int dpni_set_tx_buffer_layout(struct fsl_mc_io *mc_io,
730 const struct dpni_buffer_layout *layout);
733 * dpni_get_tx_conf_buffer_layout() - Retrieve Tx confirmation buffer layout
735 * @mc_io: Pointer to MC portal's I/O object
736 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
737 * @token: Token of DPNI object
738 * @layout: Returns buffer layout attributes
740 * Return: '0' on Success; Error code otherwise.
742 int dpni_get_tx_conf_buffer_layout(struct fsl_mc_io *mc_io,
745 struct dpni_buffer_layout *layout);
748 * dpni_set_tx_conf_buffer_layout() - Set Tx confirmation buffer layout
750 * @mc_io: Pointer to MC portal's I/O object
751 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
752 * @token: Token of DPNI object
753 * @layout: Buffer layout configuration
755 * Return: '0' on Success; Error code otherwise.
757 * @warning Allowed only when DPNI is disabled
759 int dpni_set_tx_conf_buffer_layout(struct fsl_mc_io *mc_io,
762 const struct dpni_buffer_layout *layout);
765 * dpni_get_qdid() - Get the Queuing Destination ID (QDID) that should be used
766 * for enqueue operations
767 * @mc_io: Pointer to MC portal's I/O object
768 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
769 * @token: Token of DPNI object
770 * @qdid: Returned virtual QDID value that should be used as an argument
771 * in all enqueue operations
773 * Return: '0' on Success; Error code otherwise.
775 int dpni_get_qdid(struct fsl_mc_io *mc_io,
781 * dpni_get_tx_data_offset() - Get the Tx data offset (from start of buffer)
782 * @mc_io: Pointer to MC portal's I/O object
783 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
784 * @token: Token of DPNI object
785 * @data_offset: Tx data offset (from start of buffer)
787 * Return: '0' on Success; Error code otherwise.
789 int dpni_get_tx_data_offset(struct fsl_mc_io *mc_io,
792 uint16_t *data_offset);
795 * enum dpni_counter - DPNI counter types
796 * @DPNI_CNT_ING_FRAME: Counts ingress frames
797 * @DPNI_CNT_ING_BYTE: Counts ingress bytes
798 * @DPNI_CNT_ING_FRAME_DROP: Counts ingress frames dropped due to explicit
800 * @DPNI_CNT_ING_FRAME_DISCARD: Counts ingress frames discarded due to errors
801 * @DPNI_CNT_ING_MCAST_FRAME: Counts ingress multicast frames
802 * @DPNI_CNT_ING_MCAST_BYTE: Counts ingress multicast bytes
803 * @DPNI_CNT_ING_BCAST_FRAME: Counts ingress broadcast frames
804 * @DPNI_CNT_ING_BCAST_BYTES: Counts ingress broadcast bytes
805 * @DPNI_CNT_EGR_FRAME: Counts egress frames
806 * @DPNI_CNT_EGR_BYTE: Counts egress bytes
807 * @DPNI_CNT_EGR_FRAME_DISCARD: Counts egress frames discarded due to errors
810 DPNI_CNT_ING_FRAME = 0x0,
811 DPNI_CNT_ING_BYTE = 0x1,
812 DPNI_CNT_ING_FRAME_DROP = 0x2,
813 DPNI_CNT_ING_FRAME_DISCARD = 0x3,
814 DPNI_CNT_ING_MCAST_FRAME = 0x4,
815 DPNI_CNT_ING_MCAST_BYTE = 0x5,
816 DPNI_CNT_ING_BCAST_FRAME = 0x6,
817 DPNI_CNT_ING_BCAST_BYTES = 0x7,
818 DPNI_CNT_EGR_FRAME = 0x8,
819 DPNI_CNT_EGR_BYTE = 0x9,
820 DPNI_CNT_EGR_FRAME_DISCARD = 0xa
824 * dpni_get_counter() - Read a specific DPNI counter
825 * @mc_io: Pointer to MC portal's I/O object
826 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
827 * @token: Token of DPNI object
828 * @counter: The requested counter
829 * @value: Returned counter's current value
831 * Return: '0' on Success; Error code otherwise.
833 int dpni_get_counter(struct fsl_mc_io *mc_io,
836 enum dpni_counter counter,
840 * dpni_set_counter() - Set (or clear) a specific DPNI counter
841 * @mc_io: Pointer to MC portal's I/O object
842 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
843 * @token: Token of DPNI object
844 * @counter: The requested counter
845 * @value: New counter value; typically pass '0' for resetting
848 * Return: '0' on Success; Error code otherwise.
850 int dpni_set_counter(struct fsl_mc_io *mc_io,
853 enum dpni_counter counter,
856 /* Enable auto-negotiation */
857 #define DPNI_LINK_OPT_AUTONEG 0x0000000000000001ULL
858 /* Enable half-duplex mode */
859 #define DPNI_LINK_OPT_HALF_DUPLEX 0x0000000000000002ULL
860 /* Enable pause frames */
861 #define DPNI_LINK_OPT_PAUSE 0x0000000000000004ULL
862 /* Enable a-symmetric pause frames */
863 #define DPNI_LINK_OPT_ASYM_PAUSE 0x0000000000000008ULL
866 * struct - Structure representing DPNI link configuration
868 * @options: Mask of available options; use 'DPNI_LINK_OPT_<X>' values
870 struct dpni_link_cfg {
876 * dpni_set_link_cfg() - set the link configuration.
877 * @mc_io: Pointer to MC portal's I/O object
878 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
879 * @token: Token of DPNI object
880 * @cfg: Link configuration
882 * Return: '0' on Success; Error code otherwise.
884 int dpni_set_link_cfg(struct fsl_mc_io *mc_io,
887 const struct dpni_link_cfg *cfg);
890 * struct dpni_link_state - Structure representing DPNI link state
892 * @options: Mask of available options; use 'DPNI_LINK_OPT_<X>' values
893 * @up: Link state; '0' for down, '1' for up
895 struct dpni_link_state {
902 * dpni_get_link_state() - Return the link state (either up or down)
903 * @mc_io: Pointer to MC portal's I/O object
904 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
905 * @token: Token of DPNI object
906 * @state: Returned link state;
908 * Return: '0' on Success; Error code otherwise.
910 int dpni_get_link_state(struct fsl_mc_io *mc_io,
913 struct dpni_link_state *state);
916 * dpni_set_primary_mac_addr() - Set the primary MAC address
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 * @mac_addr: MAC address to set as primary address
922 * Return: '0' on Success; Error code otherwise.
924 int dpni_set_primary_mac_addr(struct fsl_mc_io *mc_io,
927 const uint8_t mac_addr[6]);
930 * dpni_get_primary_mac_addr() - Get the primary MAC address
931 * @mc_io: Pointer to MC portal's I/O object
932 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
933 * @token: Token of DPNI object
934 * @mac_addr: Returned MAC address
936 * Return: '0' on Success; Error code otherwise.
938 int dpni_get_primary_mac_addr(struct fsl_mc_io *mc_io,
941 uint8_t mac_addr[6]);
944 * dpni_add_mac_addr() - Add MAC address filter
945 * @mc_io: Pointer to MC portal's I/O object
946 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
947 * @token: Token of DPNI object
948 * @mac_addr: MAC address to add
950 * Return: '0' on Success; Error code otherwise.
952 int dpni_add_mac_addr(struct fsl_mc_io *mc_io,
955 const uint8_t mac_addr[6]);
958 * dpni_remove_mac_addr() - Remove MAC address filter
959 * @mc_io: Pointer to MC portal's I/O object
960 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
961 * @token: Token of DPNI object
962 * @mac_addr: MAC address to remove
964 * Return: '0' on Success; Error code otherwise.
966 int dpni_remove_mac_addr(struct fsl_mc_io *mc_io,
969 const uint8_t mac_addr[6]);
972 * enum dpni_dest - DPNI destination types
973 * @DPNI_DEST_NONE: Unassigned destination; The queue is set in parked mode and
974 * does not generate FQDAN notifications; user is expected to
975 * dequeue from the queue based on polling or other user-defined
977 * @DPNI_DEST_DPIO: The queue is set in schedule mode and generates FQDAN
978 * notifications to the specified DPIO; user is expected to dequeue
979 * from the queue only after notification is received
980 * @DPNI_DEST_DPCON: The queue is set in schedule mode and does not generate
981 * FQDAN notifications, but is connected to the specified DPCON
982 * object; user is expected to dequeue from the DPCON channel
991 * struct dpni_dest_cfg - Structure representing DPNI destination parameters
992 * @dest_type: Destination type
993 * @dest_id: Either DPIO ID or DPCON ID, depending on the destination type
994 * @priority: Priority selection within the DPIO or DPCON channel; valid values
995 * are 0-1 or 0-7, depending on the number of priorities in that
996 * channel; not relevant for 'DPNI_DEST_NONE' option
998 struct dpni_dest_cfg {
999 enum dpni_dest dest_type;
1005 * enum dpni_flc_type - DPNI FLC types
1006 * @DPNI_FLC_USER_DEFINED: select the FLC to be used for user defined value
1007 * @DPNI_FLC_STASH: select the FLC to be used for stash control
1009 enum dpni_flc_type {
1010 DPNI_FLC_USER_DEFINED = 0,
1015 * enum dpni_stash_size - DPNI FLC stashing size
1016 * @DPNI_STASH_SIZE_0B: no stash
1017 * @DPNI_STASH_SIZE_64B: stashes 64 bytes
1018 * @DPNI_STASH_SIZE_128B: stashes 128 bytes
1019 * @DPNI_STASH_SIZE_192B: stashes 192 bytes
1021 enum dpni_stash_size {
1022 DPNI_STASH_SIZE_0B = 0,
1023 DPNI_STASH_SIZE_64B = 1,
1024 DPNI_STASH_SIZE_128B = 2,
1025 DPNI_STASH_SIZE_192B = 3,
1028 /* DPNI FLC stash options */
1030 /* stashes the whole annotation area (up to 192 bytes) */
1031 #define DPNI_FLC_STASH_FRAME_ANNOTATION 0x00000001
1034 * struct dpni_flc_cfg - Structure representing DPNI FLC configuration
1035 * @flc_type: FLC type
1036 * @options: Mask of available options;
1037 * use 'DPNI_FLC_STASH_<X>' values
1038 * @frame_data_size: Size of frame data to be stashed
1039 * @flow_context_size: Size of flow context to be stashed
1040 * @flow_context: 1. In case flc_type is 'DPNI_FLC_USER_DEFINED':
1041 * this value will be provided in the frame descriptor
1043 * 2. In case flc_type is 'DPNI_FLC_STASH':
1044 * this value will be I/O virtual address of the
1046 * Must be cacheline-aligned and DMA-able memory
1048 struct dpni_flc_cfg {
1049 enum dpni_flc_type flc_type;
1051 enum dpni_stash_size frame_data_size;
1052 enum dpni_stash_size flow_context_size;
1053 uint64_t flow_context;
1056 /* DPNI queue modification options */
1058 /* Select to modify the user's context associated with the queue */
1059 #define DPNI_QUEUE_OPT_USER_CTX 0x00000001
1060 /* Select to modify the queue's destination */
1061 #define DPNI_QUEUE_OPT_DEST 0x00000002
1062 /** Select to modify the flow-context parameters;
1063 * not applicable for Tx-conf/Err queues as the FD comes from the user
1065 #define DPNI_QUEUE_OPT_FLC 0x00000004
1066 /* Select to modify the queue's order preservation */
1067 #define DPNI_QUEUE_OPT_ORDER_PRESERVATION 0x00000008
1070 * struct dpni_queue_cfg - Structure representing queue configuration
1071 * @options: Flags representing the suggested modifications to the queue;
1072 * Use any combination of 'DPNI_QUEUE_OPT_<X>' flags
1073 * @user_ctx: User context value provided in the frame descriptor of each
1074 * dequeued frame; valid only if 'DPNI_QUEUE_OPT_USER_CTX'
1075 * is contained in 'options'
1076 * @dest_cfg: Queue destination parameters;
1077 * valid only if 'DPNI_QUEUE_OPT_DEST' is contained in 'options'
1078 * @flc_cfg: Flow context configuration; in case the TC's distribution
1079 * is either NONE or HASH the FLC's settings of flow#0 are used.
1080 * in the case of FS (flow-steering) the flow's FLC settings
1082 * valid only if 'DPNI_QUEUE_OPT_FLC' is contained in 'options'
1083 * @order_preservation_en: enable/disable order preservation;
1084 * valid only if 'DPNI_QUEUE_OPT_ORDER_PRESERVATION' is contained
1087 struct dpni_queue_cfg {
1090 struct dpni_dest_cfg dest_cfg;
1091 struct dpni_flc_cfg flc_cfg;
1092 int order_preservation_en;
1096 * struct dpni_queue_attr - Structure representing queue attributes
1097 * @user_ctx: User context value provided in the frame descriptor of each
1099 * @dest_cfg: Queue destination configuration
1100 * @flc_cfg: Flow context configuration
1101 * @order_preservation_en: enable/disable order preservation
1102 * @fqid: Virtual fqid value to be used for dequeue operations
1104 struct dpni_queue_attr {
1106 struct dpni_dest_cfg dest_cfg;
1107 struct dpni_flc_cfg flc_cfg;
1108 int order_preservation_en;
1112 /* DPNI Tx flow modification options */
1114 /* Select to modify the settings for dedicate Tx confirmation/error */
1115 #define DPNI_TX_FLOW_OPT_TX_CONF_ERROR 0x00000001
1116 /*!< Select to modify the Tx confirmation and/or error setting */
1117 #define DPNI_TX_FLOW_OPT_ONLY_TX_ERROR 0x00000002
1118 /*!< Select to modify the queue configuration */
1119 #define DPNI_TX_FLOW_OPT_QUEUE 0x00000004
1120 /*!< Select to modify the L3 checksum generation setting */
1121 #define DPNI_TX_FLOW_OPT_L3_CHKSUM_GEN 0x00000010
1122 /*!< Select to modify the L4 checksum generation setting */
1123 #define DPNI_TX_FLOW_OPT_L4_CHKSUM_GEN 0x00000020
1126 * struct dpni_tx_flow_cfg - Structure representing Tx flow configuration
1127 * @options: Flags representing the suggested modifications to the Tx flow;
1128 * Use any combination 'DPNI_TX_FLOW_OPT_<X>' flags
1129 * @conf_err_cfg: Tx confirmation and error configuration; these settings are
1130 * ignored if 'DPNI_OPT_PRIVATE_TX_CONF_ERROR_DISABLED' was set at
1132 * @l3_chksum_gen: Set to '1' to enable L3 checksum generation; '0' to disable;
1133 * valid only if 'DPNI_TX_FLOW_OPT_L3_CHKSUM_GEN' is contained in
1135 * @l4_chksum_gen: Set to '1' to enable L4 checksum generation; '0' to disable;
1136 * valid only if 'DPNI_TX_FLOW_OPT_L4_CHKSUM_GEN' is contained in
1139 struct dpni_tx_flow_cfg {
1142 * struct cnf_err_cfg - Tx confirmation and error configuration
1143 * @use_default_queue: Set to '1' to use the common (default) Tx
1144 * confirmation and error queue; Set to '0' to use the
1145 * private Tx confirmation and error queue; valid only if
1146 * 'DPNI_TX_FLOW_OPT_TX_CONF_ERROR' is contained in
1148 * @errors_only: Set to '1' to report back only error frames;
1149 * Set to '0' to confirm transmission/error for all
1150 * transmitted frames;
1151 * valid only if 'DPNI_TX_FLOW_OPT_ONLY_TX_ERROR' is
1152 * contained in 'options' and 'use_default_queue = 0';
1153 * @queue_cfg: Queue configuration; valid only if
1154 * 'DPNI_TX_FLOW_OPT_QUEUE' is contained in 'options'
1157 int use_default_queue;
1159 struct dpni_queue_cfg queue_cfg;
1166 * dpni_set_tx_flow() - Set Tx flow configuration
1167 * @mc_io: Pointer to MC portal's I/O object
1168 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1169 * @token: Token of DPNI object
1170 * @flow_id: Provides (or returns) the sender's flow ID;
1171 * for each new sender set (*flow_id) to
1172 * 'DPNI_NEW_FLOW_ID' to generate a new flow_id;
1173 * this ID should be used as the QDBIN argument
1174 * in enqueue operations
1175 * @cfg: Tx flow configuration
1177 * Return: '0' on Success; Error code otherwise.
1179 int dpni_set_tx_flow(struct fsl_mc_io *mc_io,
1183 const struct dpni_tx_flow_cfg *cfg);
1186 * struct dpni_tx_flow_attr - Structure representing Tx flow attributes
1187 * @conf_err_attr: Tx confirmation and error attributes
1188 * @l3_chksum_gen: '1' if L3 checksum generation is enabled; '0' if disabled
1189 * @l4_chksum_gen: '1' if L4 checksum generation is enabled; '0' if disabled
1191 struct dpni_tx_flow_attr {
1193 * struct conf_err_attr - Tx confirmation and error attributes
1194 * @use_default_queue: '1' if using common (default) Tx confirmation and
1196 * '0' if using private Tx confirmation and error
1198 * @errors_only: '1' if only error frames are reported back; '0' if all
1199 * transmitted frames are confirmed
1200 * @queue_attr: Queue attributes
1203 int use_default_queue;
1205 struct dpni_queue_attr queue_attr;
1212 * dpni_get_tx_flow() - Get Tx flow attributes
1213 * @mc_io: Pointer to MC portal's I/O object
1214 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1215 * @token: Token of DPNI object
1216 * @flow_id: The sender's flow ID, as returned by the
1217 * dpni_set_tx_flow() function
1218 * @attr: Returned Tx flow attributes
1220 * Return: '0' on Success; Error code otherwise.
1222 int dpni_get_tx_flow(struct fsl_mc_io *mc_io,
1226 struct dpni_tx_flow_attr *attr);
1229 * dpni_set_rx_flow() - Set Rx flow configuration
1230 * @mc_io: Pointer to MC portal's I/O object
1231 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1232 * @token: Token of DPNI object
1233 * @tc_id: Traffic class selection (0-7);
1234 * use 'DPNI_ALL_TCS' to set all TCs and all flows
1235 * @flow_id: Rx flow id within the traffic class; use
1236 * 'DPNI_ALL_TC_FLOWS' to set all flows within
1237 * this tc_id; ignored if tc_id is set to
1239 * @cfg: Rx flow configuration
1241 * Return: '0' on Success; Error code otherwise.
1243 int dpni_set_rx_flow(struct fsl_mc_io *mc_io,
1248 const struct dpni_queue_cfg *cfg);
1251 * dpni_get_rx_flow() - Get Rx flow attributes
1252 * @mc_io: Pointer to MC portal's I/O object
1253 * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
1254 * @token: Token of DPNI object
1255 * @tc_id: Traffic class selection (0-7)
1256 * @flow_id: Rx flow id within the traffic class
1257 * @attr: Returned Rx flow attributes
1259 * Return: '0' on Success; Error code otherwise.
1261 int dpni_get_rx_flow(struct fsl_mc_io *mc_io,
1266 struct dpni_queue_attr *attr);
1268 #endif /* _FSL_DPNI_H */