xref: /openbmc/u-boot/include/fsl-mc/fsl_dpni.h (revision 23ff8633)
1 /*
2  * Copyright (C) 2013-2015 Freescale Semiconductor
3  *
4  * SPDX-License-Identifier:	GPL-2.0+
5  */
6 #ifndef _FSL_DPNI_H
7 #define _FSL_DPNI_H
8 
9 /* DPNI Version */
10 #define DPNI_VER_MAJOR				5
11 #define DPNI_VER_MINOR				1
12 
13 /* Command IDs */
14 #define DPNI_CMDID_OPEN				0x801
15 #define DPNI_CMDID_CLOSE			0x800
16 #define DPNI_CMDID_CREATE			0x901
17 #define DPNI_CMDID_DESTROY			0x900
18 
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
23 
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 
32 #define DPNI_CMDID_GET_QDID			0x210
33 #define DPNI_CMDID_GET_TX_DATA_OFFSET		0x212
34 #define DPNI_CMDID_GET_COUNTER			0x213
35 #define DPNI_CMDID_SET_COUNTER			0x214
36 #define DPNI_CMDID_GET_LINK_STATE		0x215
37 #define DPNI_CMDID_SET_LINK_CFG		0x21A
38 
39 #define DPNI_CMDID_SET_PRIM_MAC			0x224
40 #define DPNI_CMDID_GET_PRIM_MAC			0x225
41 #define DPNI_CMDID_ADD_MAC_ADDR			0x226
42 #define DPNI_CMDID_REMOVE_MAC_ADDR		0x227
43 
44 #define DPNI_CMDID_SET_TX_FLOW			0x236
45 #define DPNI_CMDID_GET_TX_FLOW			0x237
46 #define DPNI_CMDID_SET_RX_FLOW			0x238
47 #define DPNI_CMDID_GET_RX_FLOW			0x239
48 
49 /*                cmd, param, offset, width, type, arg_name */
50 #define DPNI_CMD_OPEN(cmd, dpni_id) \
51 	MC_CMD_OP(cmd,	 0,	0,	32,	int,	dpni_id)
52 
53 /*                cmd, param, offset, width, type, arg_name */
54 #define DPNI_CMD_CREATE(cmd, cfg) \
55 do { \
56 	MC_CMD_OP(cmd, 0, 0,	8,  uint8_t,  cfg->adv.max_tcs); \
57 	MC_CMD_OP(cmd, 0, 8,	8,  uint8_t,  cfg->adv.max_senders); \
58 	MC_CMD_OP(cmd, 0, 16,	8,  uint8_t,  cfg->mac_addr[5]); \
59 	MC_CMD_OP(cmd, 0, 24,	8,  uint8_t,  cfg->mac_addr[4]); \
60 	MC_CMD_OP(cmd, 0, 32,	8,  uint8_t,  cfg->mac_addr[3]); \
61 	MC_CMD_OP(cmd, 0, 40,	8,  uint8_t,  cfg->mac_addr[2]); \
62 	MC_CMD_OP(cmd, 0, 48,	8,  uint8_t,  cfg->mac_addr[1]); \
63 	MC_CMD_OP(cmd, 0, 56,	8,  uint8_t,  cfg->mac_addr[0]); \
64 	MC_CMD_OP(cmd, 1, 0,	32, uint32_t, cfg->adv.options); \
65 	MC_CMD_OP(cmd, 2, 0,	8,  uint8_t,  cfg->adv.max_unicast_filters); \
66 	MC_CMD_OP(cmd, 2, 8,	8,  uint8_t,  cfg->adv.max_multicast_filters); \
67 	MC_CMD_OP(cmd, 2, 16,	8,  uint8_t,  cfg->adv.max_vlan_filters); \
68 	MC_CMD_OP(cmd, 2, 24,	8,  uint8_t,  cfg->adv.max_qos_entries); \
69 	MC_CMD_OP(cmd, 2, 32,	8,  uint8_t,  cfg->adv.max_qos_key_size); \
70 	MC_CMD_OP(cmd, 2, 48,	8,  uint8_t,  cfg->adv.max_dist_key_size); \
71 	MC_CMD_OP(cmd, 2, 56,	8,  enum net_prot, cfg->adv.start_hdr); \
72 	MC_CMD_OP(cmd, 3, 0,	8,  uint8_t,  cfg->adv.max_dist_per_tc[0]); \
73 	MC_CMD_OP(cmd, 3, 8,	8,  uint8_t,  cfg->adv.max_dist_per_tc[1]); \
74 	MC_CMD_OP(cmd, 3, 16,	8,  uint8_t,  cfg->adv.max_dist_per_tc[2]); \
75 	MC_CMD_OP(cmd, 3, 24,	8,  uint8_t,  cfg->adv.max_dist_per_tc[3]); \
76 	MC_CMD_OP(cmd, 3, 32,	8,  uint8_t,  cfg->adv.max_dist_per_tc[4]); \
77 	MC_CMD_OP(cmd, 3, 40,	8,  uint8_t,  cfg->adv.max_dist_per_tc[5]); \
78 	MC_CMD_OP(cmd, 3, 48,	8,  uint8_t,  cfg->adv.max_dist_per_tc[6]); \
79 	MC_CMD_OP(cmd, 3, 56,	8,  uint8_t,  cfg->adv.max_dist_per_tc[7]); \
80 	MC_CMD_OP(cmd, 4, 0,	16, uint16_t, \
81 				    cfg->adv.ipr_cfg.max_reass_frm_size); \
82 	MC_CMD_OP(cmd, 4, 16,	16, uint16_t, \
83 				    cfg->adv.ipr_cfg.min_frag_size_ipv4); \
84 	MC_CMD_OP(cmd, 4, 32,	16, uint16_t, \
85 				    cfg->adv.ipr_cfg.min_frag_size_ipv6); \
86 	MC_CMD_OP(cmd, 4, 48,	8,  uint8_t, cfg->adv.max_policers); \
87 	MC_CMD_OP(cmd, 4, 56,	8,  uint8_t, cfg->adv.max_congestion_ctrl); \
88 	MC_CMD_OP(cmd, 5, 0,	16, uint16_t, \
89 				  cfg->adv.ipr_cfg.max_open_frames_ipv4); \
90 	MC_CMD_OP(cmd, 5, 16,	16, uint16_t, \
91 				  cfg->adv.ipr_cfg.max_open_frames_ipv6); \
92 } while (0)
93 
94 /*                cmd, param, offset, width, type, arg_name */
95 #define DPNI_CMD_SET_POOLS(cmd, cfg) \
96 do { \
97 	MC_CMD_OP(cmd, 0, 0,  8,  uint8_t,  cfg->num_dpbp); \
98 	MC_CMD_OP(cmd, 0, 32, 32, int,      cfg->pools[0].dpbp_id); \
99 	MC_CMD_OP(cmd, 4, 32, 16, uint16_t, cfg->pools[0].buffer_size);\
100 	MC_CMD_OP(cmd, 1, 0,  32, int,      cfg->pools[1].dpbp_id); \
101 	MC_CMD_OP(cmd, 4, 48, 16, uint16_t, cfg->pools[1].buffer_size);\
102 	MC_CMD_OP(cmd, 1, 32, 32, int,      cfg->pools[2].dpbp_id); \
103 	MC_CMD_OP(cmd, 5, 0,  16, uint16_t, cfg->pools[2].buffer_size);\
104 	MC_CMD_OP(cmd, 2, 0,  32, int,      cfg->pools[3].dpbp_id); \
105 	MC_CMD_OP(cmd, 5, 16, 16, uint16_t, cfg->pools[3].buffer_size);\
106 	MC_CMD_OP(cmd, 2, 32, 32, int,      cfg->pools[4].dpbp_id); \
107 	MC_CMD_OP(cmd, 5, 32, 16, uint16_t, cfg->pools[4].buffer_size);\
108 	MC_CMD_OP(cmd, 3, 0,  32, int,      cfg->pools[5].dpbp_id); \
109 	MC_CMD_OP(cmd, 5, 48, 16, uint16_t, cfg->pools[5].buffer_size);\
110 	MC_CMD_OP(cmd, 3, 32, 32, int,      cfg->pools[6].dpbp_id); \
111 	MC_CMD_OP(cmd, 6, 0,  16, uint16_t, cfg->pools[6].buffer_size);\
112 	MC_CMD_OP(cmd, 4, 0,  32, int,      cfg->pools[7].dpbp_id); \
113 	MC_CMD_OP(cmd, 6, 16, 16, uint16_t, cfg->pools[7].buffer_size);\
114 } while (0)
115 
116 /*                cmd, param, offset, width, type, arg_name */
117 #define DPNI_RSP_GET_ATTR(cmd, attr) \
118 do { \
119 	MC_RSP_OP(cmd, 0, 0,  32, int,	    attr->id);\
120 	MC_RSP_OP(cmd, 0, 32, 8,  uint8_t,  attr->max_tcs); \
121 	MC_RSP_OP(cmd, 0, 40, 8,  uint8_t,  attr->max_senders); \
122 	MC_RSP_OP(cmd, 0, 48, 8,  enum net_prot, attr->start_hdr); \
123 	MC_RSP_OP(cmd, 1, 0,  32, uint32_t, attr->options); \
124 	MC_RSP_OP(cmd, 2, 0,  8,  uint8_t,  attr->max_unicast_filters); \
125 	MC_RSP_OP(cmd, 2, 8,  8,  uint8_t,  attr->max_multicast_filters);\
126 	MC_RSP_OP(cmd, 2, 16, 8,  uint8_t,  attr->max_vlan_filters); \
127 	MC_RSP_OP(cmd, 2, 24, 8,  uint8_t,  attr->max_qos_entries); \
128 	MC_RSP_OP(cmd, 2, 32, 8,  uint8_t,  attr->max_qos_key_size); \
129 	MC_RSP_OP(cmd, 2, 40, 8,  uint8_t,  attr->max_dist_key_size); \
130 	MC_RSP_OP(cmd, 3, 0,  8,  uint8_t,  attr->max_dist_per_tc[0]); \
131 	MC_RSP_OP(cmd, 3, 8,  8,  uint8_t,  attr->max_dist_per_tc[1]); \
132 	MC_RSP_OP(cmd, 3, 16, 8,  uint8_t,  attr->max_dist_per_tc[2]); \
133 	MC_RSP_OP(cmd, 3, 24, 8,  uint8_t,  attr->max_dist_per_tc[3]); \
134 	MC_RSP_OP(cmd, 3, 32, 8,  uint8_t,  attr->max_dist_per_tc[4]); \
135 	MC_RSP_OP(cmd, 3, 40, 8,  uint8_t,  attr->max_dist_per_tc[5]); \
136 	MC_RSP_OP(cmd, 3, 48, 8,  uint8_t,  attr->max_dist_per_tc[6]); \
137 	MC_RSP_OP(cmd, 3, 56, 8,  uint8_t,  attr->max_dist_per_tc[7]); \
138 	MC_RSP_OP(cmd, 4, 0,	16, uint16_t, \
139 				    attr->ipr_cfg.max_reass_frm_size); \
140 	MC_RSP_OP(cmd, 4, 16,	16, uint16_t, \
141 				    attr->ipr_cfg.min_frag_size_ipv4); \
142 	MC_RSP_OP(cmd, 4, 32,	16, uint16_t, \
143 				    attr->ipr_cfg.min_frag_size_ipv6);\
144 	MC_RSP_OP(cmd, 4, 48,	8,  uint8_t, attr->max_policers); \
145 	MC_RSP_OP(cmd, 4, 56,	8,  uint8_t, attr->max_congestion_ctrl); \
146 	MC_RSP_OP(cmd, 5, 0,	16, uint16_t, \
147 				  attr->ipr_cfg.max_open_frames_ipv4); \
148 	MC_RSP_OP(cmd, 5, 16,	16, uint16_t, \
149 				  attr->ipr_cfg.max_open_frames_ipv6); \
150 	MC_RSP_OP(cmd, 5, 32, 16, uint16_t, attr->version.major);\
151 	MC_RSP_OP(cmd, 5, 48, 16, uint16_t, attr->version.minor);\
152 } while (0)
153 
154 /*                cmd, param, offset, width, type, arg_name */
155 #define DPNI_RSP_GET_RX_BUFFER_LAYOUT(cmd, layout) \
156 do { \
157 	MC_RSP_OP(cmd, 0, 0,  16, uint16_t, layout->private_data_size); \
158 	MC_RSP_OP(cmd, 0, 16, 16, uint16_t, layout->data_align); \
159 	MC_RSP_OP(cmd, 1, 0,  1,  int,	    layout->pass_timestamp); \
160 	MC_RSP_OP(cmd, 1, 1,  1,  int,	    layout->pass_parser_result); \
161 	MC_RSP_OP(cmd, 1, 2,  1,  int,	    layout->pass_frame_status); \
162 	MC_RSP_OP(cmd, 1, 16, 16, uint16_t, layout->data_head_room); \
163 	MC_RSP_OP(cmd, 1, 32, 16, uint16_t, layout->data_tail_room); \
164 } while (0)
165 
166 /*                cmd, param, offset, width, type, arg_name */
167 #define DPNI_CMD_SET_RX_BUFFER_LAYOUT(cmd, layout) \
168 do { \
169 	MC_CMD_OP(cmd, 0, 0,  16, uint16_t, layout->private_data_size); \
170 	MC_CMD_OP(cmd, 0, 16, 16, uint16_t, layout->data_align); \
171 	MC_CMD_OP(cmd, 0, 32, 32, uint32_t, layout->options); \
172 	MC_CMD_OP(cmd, 1, 0,  1,  int,	    layout->pass_timestamp); \
173 	MC_CMD_OP(cmd, 1, 1,  1,  int,	    layout->pass_parser_result); \
174 	MC_CMD_OP(cmd, 1, 2,  1,  int,	    layout->pass_frame_status); \
175 	MC_CMD_OP(cmd, 1, 16, 16, uint16_t, layout->data_head_room); \
176 	MC_CMD_OP(cmd, 1, 32, 16, uint16_t, layout->data_tail_room); \
177 } while (0)
178 
179 /*                cmd, param, offset, width, type, arg_name */
180 #define DPNI_RSP_GET_TX_BUFFER_LAYOUT(cmd, layout) \
181 do { \
182 	MC_RSP_OP(cmd, 0, 0,  16, uint16_t, layout->private_data_size); \
183 	MC_RSP_OP(cmd, 0, 16, 16, uint16_t, layout->data_align); \
184 	MC_RSP_OP(cmd, 1, 0,  1,  int,      layout->pass_timestamp); \
185 	MC_RSP_OP(cmd, 1, 1,  1,  int,	    layout->pass_parser_result); \
186 	MC_RSP_OP(cmd, 1, 2,  1,  int,	    layout->pass_frame_status); \
187 	MC_RSP_OP(cmd, 1, 16, 16, uint16_t, layout->data_head_room); \
188 	MC_RSP_OP(cmd, 1, 32, 16, uint16_t, layout->data_tail_room); \
189 } while (0)
190 
191 /*                cmd, param, offset, width, type, arg_name */
192 #define DPNI_CMD_SET_TX_BUFFER_LAYOUT(cmd, layout) \
193 do { \
194 	MC_CMD_OP(cmd, 0, 0,  16, uint16_t, layout->private_data_size); \
195 	MC_CMD_OP(cmd, 0, 16, 16, uint16_t, layout->data_align); \
196 	MC_CMD_OP(cmd, 0, 32, 32, uint32_t, layout->options); \
197 	MC_CMD_OP(cmd, 1, 0,  1,  int,	    layout->pass_timestamp); \
198 	MC_CMD_OP(cmd, 1, 1,  1,  int,	    layout->pass_parser_result); \
199 	MC_CMD_OP(cmd, 1, 2,  1,  int,	    layout->pass_frame_status); \
200 	MC_CMD_OP(cmd, 1, 16, 16, uint16_t, layout->data_head_room); \
201 	MC_CMD_OP(cmd, 1, 32, 16, uint16_t, layout->data_tail_room); \
202 } while (0)
203 
204 /*                cmd, param, offset, width, type, arg_name */
205 #define DPNI_RSP_GET_TX_CONF_BUFFER_LAYOUT(cmd, layout) \
206 do { \
207 	MC_RSP_OP(cmd, 0, 0,  16, uint16_t, layout->private_data_size); \
208 	MC_RSP_OP(cmd, 0, 16, 16, uint16_t, layout->data_align); \
209 	MC_RSP_OP(cmd, 1, 0,  1,  int,      layout->pass_timestamp); \
210 	MC_RSP_OP(cmd, 1, 1,  1,  int,	    layout->pass_parser_result); \
211 	MC_RSP_OP(cmd, 1, 2,  1,  int,	    layout->pass_frame_status); \
212 	MC_RSP_OP(cmd, 1, 16, 16, uint16_t, layout->data_head_room); \
213 	MC_RSP_OP(cmd, 1, 32, 16, uint16_t, layout->data_tail_room); \
214 } while (0)
215 
216 /*                cmd, param, offset, width, type, arg_name */
217 #define DPNI_CMD_SET_TX_CONF_BUFFER_LAYOUT(cmd, layout) \
218 do { \
219 	MC_CMD_OP(cmd, 0, 0,  16, uint16_t, layout->private_data_size); \
220 	MC_CMD_OP(cmd, 0, 16, 16, uint16_t, layout->data_align); \
221 	MC_CMD_OP(cmd, 0, 32, 32, uint32_t, layout->options); \
222 	MC_CMD_OP(cmd, 1, 0,  1,  int,	    layout->pass_timestamp); \
223 	MC_CMD_OP(cmd, 1, 1,  1,  int,	    layout->pass_parser_result); \
224 	MC_CMD_OP(cmd, 1, 2,  1,  int,	    layout->pass_frame_status); \
225 	MC_CMD_OP(cmd, 1, 16, 16, uint16_t, layout->data_head_room); \
226 	MC_CMD_OP(cmd, 1, 32, 16, uint16_t, layout->data_tail_room); \
227 } while (0)
228 
229 /*                cmd, param, offset, width, type, arg_name */
230 #define DPNI_RSP_GET_QDID(cmd, qdid) \
231 	MC_RSP_OP(cmd, 0, 0,  16, uint16_t, qdid)
232 
233 /*                cmd, param, offset, width, type, arg_name */
234 #define DPNI_RSP_GET_TX_DATA_OFFSET(cmd, data_offset) \
235 	MC_RSP_OP(cmd, 0, 0,  16, uint16_t, data_offset)
236 
237 /*                cmd, param, offset, width, type, arg_name */
238 #define DPNI_CMD_GET_COUNTER(cmd, counter) \
239 	MC_CMD_OP(cmd, 0, 0,  16, enum dpni_counter, counter)
240 
241 /*                cmd, param, offset, width, type, arg_name */
242 #define DPNI_RSP_GET_COUNTER(cmd, value) \
243 	MC_RSP_OP(cmd, 1, 0,  64, uint64_t, value)
244 
245 /*                cmd, param, offset, width, type, arg_name */
246 #define DPNI_CMD_SET_COUNTER(cmd, counter, value) \
247 do { \
248 	MC_CMD_OP(cmd, 0, 0,  16, enum dpni_counter, counter); \
249 	MC_CMD_OP(cmd, 1, 0,  64, uint64_t, value); \
250 } while (0)
251 
252 /*                cmd, param, offset, width, type, arg_name */
253 #define DPNI_CMD_SET_LINK_CFG(cmd, cfg) \
254 do { \
255 	MC_CMD_OP(cmd, 1, 0,  32, uint32_t, cfg->rate);\
256 	MC_CMD_OP(cmd, 2, 0,  64, uint64_t, cfg->options);\
257 } while (0)
258 
259 /*                cmd, param, offset, width, type, arg_name */
260 #define DPNI_RSP_GET_LINK_STATE(cmd, state) \
261 do { \
262 	MC_RSP_OP(cmd, 0, 32,  1, int,      state->up);\
263 	MC_RSP_OP(cmd, 1, 0,  32, uint32_t, state->rate);\
264 	MC_RSP_OP(cmd, 2, 0,  64, uint64_t, state->options);\
265 } while (0)
266 
267 
268 
269 /*                cmd, param, offset, width, type, arg_name */
270 #define DPNI_CMD_SET_PRIMARY_MAC_ADDR(cmd, mac_addr) \
271 do { \
272 	MC_CMD_OP(cmd, 0, 16, 8,  uint8_t,  mac_addr[5]); \
273 	MC_CMD_OP(cmd, 0, 24, 8,  uint8_t,  mac_addr[4]); \
274 	MC_CMD_OP(cmd, 0, 32, 8,  uint8_t,  mac_addr[3]); \
275 	MC_CMD_OP(cmd, 0, 40, 8,  uint8_t,  mac_addr[2]); \
276 	MC_CMD_OP(cmd, 0, 48, 8,  uint8_t,  mac_addr[1]); \
277 	MC_CMD_OP(cmd, 0, 56, 8,  uint8_t,  mac_addr[0]); \
278 } while (0)
279 
280 /*                cmd, param, offset, width, type, arg_name */
281 #define DPNI_RSP_GET_PRIMARY_MAC_ADDR(cmd, mac_addr) \
282 do { \
283 	MC_RSP_OP(cmd, 0, 16, 8,  uint8_t,  mac_addr[5]); \
284 	MC_RSP_OP(cmd, 0, 24, 8,  uint8_t,  mac_addr[4]); \
285 	MC_RSP_OP(cmd, 0, 32, 8,  uint8_t,  mac_addr[3]); \
286 	MC_RSP_OP(cmd, 0, 40, 8,  uint8_t,  mac_addr[2]); \
287 	MC_RSP_OP(cmd, 0, 48, 8,  uint8_t,  mac_addr[1]); \
288 	MC_RSP_OP(cmd, 0, 56, 8,  uint8_t,  mac_addr[0]); \
289 } while (0)
290 
291 /*                cmd, param, offset, width, type, arg_name */
292 #define DPNI_CMD_ADD_MAC_ADDR(cmd, mac_addr) \
293 do { \
294 	MC_CMD_OP(cmd, 0, 16, 8,  uint8_t,  mac_addr[5]); \
295 	MC_CMD_OP(cmd, 0, 24, 8,  uint8_t,  mac_addr[4]); \
296 	MC_CMD_OP(cmd, 0, 32, 8,  uint8_t,  mac_addr[3]); \
297 	MC_CMD_OP(cmd, 0, 40, 8,  uint8_t,  mac_addr[2]); \
298 	MC_CMD_OP(cmd, 0, 48, 8,  uint8_t,  mac_addr[1]); \
299 	MC_CMD_OP(cmd, 0, 56, 8,  uint8_t,  mac_addr[0]); \
300 } while (0)
301 
302 /*                cmd, param, offset, width, type, arg_name */
303 #define DPNI_CMD_REMOVE_MAC_ADDR(cmd, mac_addr) \
304 do { \
305 	MC_CMD_OP(cmd, 0, 16, 8,  uint8_t,  mac_addr[5]); \
306 	MC_CMD_OP(cmd, 0, 24, 8,  uint8_t,  mac_addr[4]); \
307 	MC_CMD_OP(cmd, 0, 32, 8,  uint8_t,  mac_addr[3]); \
308 	MC_CMD_OP(cmd, 0, 40, 8,  uint8_t,  mac_addr[2]); \
309 	MC_CMD_OP(cmd, 0, 48, 8,  uint8_t,  mac_addr[1]); \
310 	MC_CMD_OP(cmd, 0, 56, 8,  uint8_t,  mac_addr[0]); \
311 } while (0)
312 
313 /*                cmd, param, offset, width, type, arg_name */
314 #define DPNI_CMD_SET_TX_FLOW(cmd, flow_id, cfg) \
315 do { \
316 	MC_CMD_OP(cmd, 0, 0,  32, int,     \
317 			   cfg->conf_err_cfg.queue_cfg.dest_cfg.dest_id);\
318 	MC_CMD_OP(cmd, 0, 32, 8,  uint8_t, \
319 			   cfg->conf_err_cfg.queue_cfg.dest_cfg.priority);\
320 	MC_CMD_OP(cmd, 0, 40, 2,  enum dpni_dest, \
321 			   cfg->conf_err_cfg.queue_cfg.dest_cfg.dest_type);\
322 	MC_CMD_OP(cmd, 0, 42, 1,  int,	    cfg->conf_err_cfg.errors_only);\
323 	MC_CMD_OP(cmd, 0, 43, 1,  int,	    cfg->l3_chksum_gen);\
324 	MC_CMD_OP(cmd, 0, 44, 1,  int,	    cfg->l4_chksum_gen);\
325 	MC_CMD_OP(cmd, 0, 45, 1,  int,	    \
326 			   cfg->conf_err_cfg.use_default_queue);\
327 	MC_CMD_OP(cmd, 0, 48, 16, uint16_t, flow_id);\
328 	MC_CMD_OP(cmd, 1, 0,  64, uint64_t, \
329 			   cfg->conf_err_cfg.queue_cfg.user_ctx);\
330 	MC_CMD_OP(cmd, 2, 0,  32, uint32_t, cfg->options);\
331 	MC_CMD_OP(cmd, 2, 32,  32, uint32_t, \
332 			   cfg->conf_err_cfg.queue_cfg.options);\
333 } while (0)
334 
335 /*                cmd, param, offset, width, type, arg_name */
336 #define DPNI_RSP_SET_TX_FLOW(cmd, flow_id) \
337 	MC_RSP_OP(cmd, 0, 48, 16, uint16_t, flow_id)
338 
339 /*                cmd, param, offset, width, type, arg_name */
340 #define DPNI_CMD_GET_TX_FLOW(cmd, flow_id) \
341 	MC_CMD_OP(cmd, 0, 48, 16, uint16_t, flow_id)
342 
343 /*                cmd, param, offset, width, type, arg_name */
344 #define DPNI_RSP_GET_TX_FLOW(cmd, attr) \
345 do { \
346 	MC_RSP_OP(cmd, 0, 0,  32, int,      \
347 			attr->conf_err_attr.queue_attr.dest_cfg.dest_id);\
348 	MC_RSP_OP(cmd, 0, 32, 8,  uint8_t,  \
349 			attr->conf_err_attr.queue_attr.dest_cfg.priority);\
350 	MC_RSP_OP(cmd, 0, 40, 2,  enum dpni_dest, \
351 			attr->conf_err_attr.queue_attr.dest_cfg.dest_type);\
352 	MC_RSP_OP(cmd, 0, 42, 1,  int,	    attr->conf_err_attr.errors_only);\
353 	MC_RSP_OP(cmd, 0, 43, 1,  int,	    attr->l3_chksum_gen);\
354 	MC_RSP_OP(cmd, 0, 44, 1,  int,	    attr->l4_chksum_gen);\
355 	MC_RSP_OP(cmd, 0, 45, 1,  int,	    \
356 			attr->conf_err_attr.use_default_queue);\
357 	MC_RSP_OP(cmd, 1, 0,  64, uint64_t, \
358 			attr->conf_err_attr.queue_attr.user_ctx);\
359 	MC_RSP_OP(cmd, 2, 32, 32, uint32_t, \
360 			attr->conf_err_attr.queue_attr.fqid);\
361 } while (0)
362 
363 /*                cmd, param, offset, width, type, arg_name */
364 #define DPNI_CMD_SET_RX_FLOW(cmd, tc_id, flow_id, cfg) \
365 do { \
366 	MC_CMD_OP(cmd, 0, 0,  32, int,      cfg->dest_cfg.dest_id); \
367 	MC_CMD_OP(cmd, 0, 32, 8,  uint8_t,  cfg->dest_cfg.priority);\
368 	MC_CMD_OP(cmd, 0, 40, 2,  enum dpni_dest, cfg->dest_cfg.dest_type);\
369 	MC_CMD_OP(cmd, 0, 42, 1,  int,      cfg->order_preservation_en);\
370 	MC_CMD_OP(cmd, 0, 48, 16, uint16_t, flow_id); \
371 	MC_CMD_OP(cmd, 1, 0,  64, uint64_t, cfg->user_ctx); \
372 	MC_CMD_OP(cmd, 2, 16, 8,  uint8_t,  tc_id); \
373 	MC_CMD_OP(cmd, 2, 32,  32, uint32_t, cfg->options); \
374 	MC_CMD_OP(cmd, 3, 0,  4,  enum dpni_flc_type, cfg->flc_cfg.flc_type); \
375 	MC_CMD_OP(cmd, 3, 4,  4,  enum dpni_stash_size, \
376 		cfg->flc_cfg.frame_data_size);\
377 	MC_CMD_OP(cmd, 3, 8,  4,  enum dpni_stash_size, \
378 		cfg->flc_cfg.flow_context_size);\
379 	MC_CMD_OP(cmd, 3, 32, 32, uint32_t, cfg->flc_cfg.options);\
380 	MC_CMD_OP(cmd, 4, 0,  64, uint64_t, cfg->flc_cfg.flow_context);\
381 } while (0)
382 
383 /*                cmd, param, offset, width, type, arg_name */
384 #define DPNI_CMD_GET_RX_FLOW(cmd, tc_id, flow_id) \
385 do { \
386 	MC_CMD_OP(cmd, 0, 16, 8,  uint8_t,  tc_id); \
387 	MC_CMD_OP(cmd, 0, 48, 16, uint16_t, flow_id); \
388 } while (0)
389 
390 /*                cmd, param, offset, width, type, arg_name */
391 #define DPNI_RSP_GET_RX_FLOW(cmd, attr) \
392 do { \
393 	MC_RSP_OP(cmd, 0, 0,  32, int,      attr->dest_cfg.dest_id); \
394 	MC_RSP_OP(cmd, 0, 32, 8,  uint8_t,  attr->dest_cfg.priority);\
395 	MC_RSP_OP(cmd, 0, 40, 2,  enum dpni_dest, attr->dest_cfg.dest_type); \
396 	MC_CMD_OP(cmd, 0, 42, 1,  int,      attr->order_preservation_en);\
397 	MC_RSP_OP(cmd, 1, 0,  64, uint64_t, attr->user_ctx); \
398 	MC_RSP_OP(cmd, 2, 32, 32, uint32_t, attr->fqid); \
399 	MC_RSP_OP(cmd, 3, 0,  4,  enum dpni_flc_type, attr->flc_cfg.flc_type); \
400 	MC_RSP_OP(cmd, 3, 4,  4,  enum dpni_stash_size, \
401 		attr->flc_cfg.frame_data_size);\
402 	MC_RSP_OP(cmd, 3, 8,  4,  enum dpni_stash_size, \
403 		attr->flc_cfg.flow_context_size);\
404 	MC_RSP_OP(cmd, 3, 32, 32, uint32_t, attr->flc_cfg.options);\
405 	MC_RSP_OP(cmd, 4, 0,  64, uint64_t, attr->flc_cfg.flow_context);\
406 } while (0)
407 
408 enum net_prot {
409 	NET_PROT_NONE = 0,
410 	NET_PROT_PAYLOAD,
411 	NET_PROT_ETH,
412 	NET_PROT_VLAN,
413 	NET_PROT_IPV4,
414 	NET_PROT_IPV6,
415 	NET_PROT_IP,
416 	NET_PROT_TCP,
417 	NET_PROT_UDP,
418 	NET_PROT_UDP_LITE,
419 	NET_PROT_IPHC,
420 	NET_PROT_SCTP,
421 	NET_PROT_SCTP_CHUNK_DATA,
422 	NET_PROT_PPPOE,
423 	NET_PROT_PPP,
424 	NET_PROT_PPPMUX,
425 	NET_PROT_PPPMUX_SUBFRM,
426 	NET_PROT_L2TPV2,
427 	NET_PROT_L2TPV3_CTRL,
428 	NET_PROT_L2TPV3_SESS,
429 	NET_PROT_LLC,
430 	NET_PROT_LLC_SNAP,
431 	NET_PROT_NLPID,
432 	NET_PROT_SNAP,
433 	NET_PROT_MPLS,
434 	NET_PROT_IPSEC_AH,
435 	NET_PROT_IPSEC_ESP,
436 	NET_PROT_UDP_ENC_ESP, /* RFC 3948 */
437 	NET_PROT_MACSEC,
438 	NET_PROT_GRE,
439 	NET_PROT_MINENCAP,
440 	NET_PROT_DCCP,
441 	NET_PROT_ICMP,
442 	NET_PROT_IGMP,
443 	NET_PROT_ARP,
444 	NET_PROT_CAPWAP_DATA,
445 	NET_PROT_CAPWAP_CTRL,
446 	NET_PROT_RFC2684,
447 	NET_PROT_ICMPV6,
448 	NET_PROT_FCOE,
449 	NET_PROT_FIP,
450 	NET_PROT_ISCSI,
451 	NET_PROT_GTP,
452 	NET_PROT_USER_DEFINED_L2,
453 	NET_PROT_USER_DEFINED_L3,
454 	NET_PROT_USER_DEFINED_L4,
455 	NET_PROT_USER_DEFINED_L5,
456 	NET_PROT_USER_DEFINED_SHIM1,
457 	NET_PROT_USER_DEFINED_SHIM2,
458 
459 	NET_PROT_DUMMY_LAST
460 };
461 
462 /**
463  * Data Path Network Interface API
464  * Contains initialization APIs and runtime control APIs for DPNI
465  */
466 
467 struct fsl_mc_io;
468 
469 /* General DPNI macros */
470 
471 /* Maximum number of traffic classes */
472 #define DPNI_MAX_TC				8
473 /* Maximum number of buffer pools per DPNI */
474 #define DPNI_MAX_DPBP				8
475 
476 /* All traffic classes considered; see dpni_set_rx_flow() */
477 #define DPNI_ALL_TCS				(uint8_t)(-1)
478 /* All flows within traffic class considered; see dpni_set_rx_flow() */
479 #define DPNI_ALL_TC_FLOWS			(uint16_t)(-1)
480 /* Generate new flow ID; see dpni_set_tx_flow() */
481 #define DPNI_NEW_FLOW_ID			(uint16_t)(-1)
482 
483 /**
484  * dpni_open() - Open a control session for the specified object
485  * @mc_io:	Pointer to MC portal's I/O object
486  * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
487  * @dpni_id:	DPNI unique ID
488  * @token:	Returned token; use in subsequent API calls
489  *
490  * This function can be used to open a control session for an
491  * already created object; an object may have been declared in
492  * the DPL or by calling the dpni_create() function.
493  * This function returns a unique authentication token,
494  * associated with the specific object ID and the specific MC
495  * portal; this token must be used in all subsequent commands for
496  * this specific object.
497  *
498  * Return:	'0' on Success; Error code otherwise.
499  */
500 int dpni_open(struct fsl_mc_io	*mc_io,
501 	      uint32_t		cmd_flags,
502 	      int		dpni_id,
503 	      uint16_t		*token);
504 
505 /**
506  * dpni_close() - Close the control session of the object
507  * @mc_io:	Pointer to MC portal's I/O object
508  * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
509  * @token:	Token of DPNI object
510  *
511  * After this function is called, no further operations are
512  * allowed on the object without opening a new control session.
513  *
514  * Return:	'0' on Success; Error code otherwise.
515  */
516 int dpni_close(struct fsl_mc_io	*mc_io,
517 	       uint32_t		cmd_flags,
518 	       uint16_t		token);
519 
520 /* DPNI configuration options */
521 
522 /**
523  * Allow different distribution key profiles for different traffic classes;
524  * if not set, a single key profile is assumed
525  */
526 #define DPNI_OPT_ALLOW_DIST_KEY_PER_TC		0x00000001
527 
528 /**
529  * Disable all non-error transmit confirmation; error frames are reported
530  * back to a common Tx error queue
531  */
532 #define DPNI_OPT_TX_CONF_DISABLED		0x00000002
533 
534 /* Disable per-sender private Tx confirmation/error queue */
535 #define DPNI_OPT_PRIVATE_TX_CONF_ERROR_DISABLED	0x00000004
536 
537 /**
538  * Support distribution based on hashed key;
539  * allows statistical distribution over receive queues in a traffic class
540  */
541 #define DPNI_OPT_DIST_HASH			0x00000010
542 
543 /**
544  * Support distribution based on flow steering;
545  * allows explicit control of distribution over receive queues in a traffic
546  * class
547  */
548 #define DPNI_OPT_DIST_FS			0x00000020
549 
550 /* Unicast filtering support */
551 #define DPNI_OPT_UNICAST_FILTER			0x00000080
552 /* Multicast filtering support */
553 #define DPNI_OPT_MULTICAST_FILTER		0x00000100
554 /* VLAN filtering support */
555 #define DPNI_OPT_VLAN_FILTER			0x00000200
556 /* Support IP reassembly on received packets */
557 #define DPNI_OPT_IPR				0x00000800
558 /* Support IP fragmentation on transmitted packets */
559 #define DPNI_OPT_IPF				0x00001000
560 /* VLAN manipulation support */
561 #define DPNI_OPT_VLAN_MANIPULATION		0x00010000
562 /* Support masking of QoS lookup keys */
563 #define DPNI_OPT_QOS_MASK_SUPPORT		0x00020000
564 /* Support masking of Flow Steering lookup keys */
565 #define DPNI_OPT_FS_MASK_SUPPORT		0x00040000
566 
567 /**
568  * struct dpni_ipr_cfg - Structure representing IP reassembly configuration
569  * @max_reass_frm_size: Maximum size of the reassembled frame
570  * @min_frag_size_ipv4: Minimum fragment size of IPv4 fragments
571  * @min_frag_size_ipv6: Minimum fragment size of IPv6 fragments
572  * @max_open_frames_ipv4: Maximum concurrent IPv4 packets in reassembly process
573  * @max_open_frames_ipv6: Maximum concurrent IPv6 packets in reassembly process
574  */
575 struct dpni_ipr_cfg {
576 	uint16_t max_reass_frm_size;
577 	uint16_t min_frag_size_ipv4;
578 	uint16_t min_frag_size_ipv6;
579 	uint16_t max_open_frames_ipv4;
580 	uint16_t max_open_frames_ipv6;
581 };
582 
583 /**
584  * struct dpni_cfg - Structure representing DPNI configuration
585  * @mac_addr: Primary MAC address
586  * @adv: Advanced parameters; default is all zeros;
587  *		use this structure to change default settings
588  */
589 struct dpni_cfg {
590 	uint8_t mac_addr[6];
591 	/**
592 	 * struct adv - Advanced parameters
593 	 * @options: Mask of available options; use 'DPNI_OPT_<X>' values
594 	 * @start_hdr: Selects the packet starting header for parsing;
595 	 *		'NET_PROT_NONE' is treated as default: 'NET_PROT_ETH'
596 	 * @max_senders: Maximum number of different senders; used as the number
597 	 *		of dedicated Tx flows; Non-power-of-2 values are rounded
598 	 *		up to the next power-of-2 value as hardware demands it;
599 	 *		'0' will be treated as '1'
600 	 * @max_tcs: Maximum number of traffic classes (for both Tx and Rx);
601 	 *		'0' will e treated as '1'
602 	 * @max_dist_per_tc: Maximum distribution size per Rx traffic class;
603 	 *			Must be set to the required value minus 1;
604 	 *			i.e. 0->1, 1->2, ... ,255->256;
605 	 *			Non-power-of-2 values are rounded up to the next
606 	 *			power-of-2 value as hardware demands it
607 	 * @max_unicast_filters: Maximum number of unicast filters;
608 	 *			'0' is treated	as '16'
609 	 * @max_multicast_filters: Maximum number of multicast filters;
610 	 *			'0' is treated as '64'
611 	 * @max_qos_entries: if 'max_tcs > 1', declares the maximum entries in
612 	 *			the QoS	table; '0' is treated as '64'
613 	 * @max_qos_key_size: Maximum key size for the QoS look-up;
614 	 *			'0' is treated as '24' which is enough for IPv4
615 	 *			5-tuple
616 	 * @max_dist_key_size: Maximum key size for the distribution;
617 	 *		'0' is treated as '24' which is enough for IPv4 5-tuple
618 	 * @max_policers: Maximum number of policers;
619 	 *		should be between '0' and max_tcs
620 	 * @max_congestion_ctrl: Maximum number of congestion control groups
621 	 *		(CGs); covers early drop and congestion notification
622 	 *		requirements for traffic classes;
623 	 *		should be between '0' and max_tcs
624 	 * @ipr_cfg: IP reassembly configuration
625 	 */
626 	struct {
627 		uint32_t		options;
628 		enum net_prot		start_hdr;
629 		uint8_t		max_senders;
630 		uint8_t		max_tcs;
631 		uint8_t			max_dist_per_tc[DPNI_MAX_TC];
632 		uint8_t		max_unicast_filters;
633 		uint8_t		max_multicast_filters;
634 		uint8_t			max_vlan_filters;
635 		uint8_t		max_qos_entries;
636 		uint8_t		max_qos_key_size;
637 		uint8_t		max_dist_key_size;
638 		uint8_t		max_policers;
639 		uint8_t		max_congestion_ctrl;
640 		struct dpni_ipr_cfg	ipr_cfg;
641 	} adv;
642 };
643 
644 /**
645  * dpni_create() - Create the DPNI object
646  * @mc_io:	Pointer to MC portal's I/O object
647  * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
648  * @cfg:	Configuration structure
649  * @token:	Returned token; use in subsequent API calls
650  *
651  * Create the DPNI object, allocate required resources and
652  * perform required initialization.
653  *
654  * The object can be created either by declaring it in the
655  * DPL file, or by calling this function.
656  *
657  * This function returns a unique authentication token,
658  * associated with the specific object ID and the specific MC
659  * portal; this token must be used in all subsequent calls to
660  * this specific object. For objects that are created using the
661  * DPL file, call dpni_open() function to get an authentication
662  * token first.
663  *
664  * Return:	'0' on Success; Error code otherwise.
665  */
666 int dpni_create(struct fsl_mc_io	*mc_io,
667 		uint32_t		cmd_flags,
668 		const struct dpni_cfg	*cfg,
669 		uint16_t		*token);
670 
671 /**
672  * dpni_destroy() - Destroy the DPNI object and release all its resources.
673  * @mc_io:	Pointer to MC portal's I/O object
674  * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
675  * @token:	Token of DPNI object
676  *
677  * Return:	'0' on Success; error code otherwise.
678  */
679 int dpni_destroy(struct fsl_mc_io	*mc_io,
680 		 uint32_t		cmd_flags,
681 		 uint16_t		token);
682 
683 /**
684  * struct dpni_pools_cfg - Structure representing buffer pools configuration
685  * @num_dpbp: Number of DPBPs
686  * @pools: Array of buffer pools parameters; The number of valid entries
687  *	must match 'num_dpbp' value
688  */
689 struct dpni_pools_cfg {
690 	uint8_t num_dpbp;
691 	/**
692 	 * struct pools - Buffer pools parameters
693 	 * @dpbp_id: DPBP object ID
694 	 * @buffer_size: Buffer size
695 	 * @backup_pool: Backup pool
696 	 */
697 	struct {
698 		int		dpbp_id;
699 		uint16_t	buffer_size;
700 		int		backup_pool;
701 	} pools[DPNI_MAX_DPBP];
702 };
703 
704 /**
705  * dpni_set_pools() - Set buffer pools configuration
706  * @mc_io:	Pointer to MC portal's I/O object
707  * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
708  * @token:	Token of DPNI object
709  * @cfg:	Buffer pools configuration
710  *
711  * mandatory for DPNI operation
712  * warning:Allowed only when DPNI is disabled
713  *
714  * Return:	'0' on Success; Error code otherwise.
715  */
716 int dpni_set_pools(struct fsl_mc_io		*mc_io,
717 		   uint32_t			cmd_flags,
718 		   uint16_t			token,
719 		   const struct dpni_pools_cfg	*cfg);
720 
721 /**
722  * dpni_enable() - Enable the DPNI, allow sending and receiving frames.
723  * @mc_io:	Pointer to MC portal's I/O object
724  * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
725  * @token:		Token of DPNI object
726  *
727  * Return:	'0' on Success; Error code otherwise.
728  */
729 int dpni_enable(struct fsl_mc_io	*mc_io,
730 		uint32_t		cmd_flags,
731 		uint16_t		token);
732 
733 /**
734  * dpni_disable() - Disable the DPNI, stop sending and receiving frames.
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  *
739  * Return:	'0' on Success; Error code otherwise.
740  */
741 int dpni_disable(struct fsl_mc_io	*mc_io,
742 		 uint32_t		cmd_flags,
743 		 uint16_t		token);
744 
745 
746 /**
747  * dpni_reset() - Reset the DPNI, returns the object to initial state.
748  * @mc_io:	Pointer to MC portal's I/O object
749  * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
750  * @token:	Token of DPNI object
751  *
752  * Return:	'0' on Success; Error code otherwise.
753  */
754 int dpni_reset(struct fsl_mc_io	*mc_io,
755 	       uint32_t		cmd_flags,
756 	       uint16_t		token);
757 
758 /**
759  * struct dpni_attr - Structure representing DPNI attributes
760  * @id: DPNI object ID
761  * @version: DPNI version
762  * @start_hdr: Indicates the packet starting header for parsing
763  * @options: Mask of available options; reflects the value as was given in
764  *		object's creation
765  * @max_senders: Maximum number of different senders; used as the number
766  *		of dedicated Tx flows;
767  * @max_tcs: Maximum number of traffic classes (for both Tx and Rx)
768  * @max_dist_per_tc: Maximum distribution size per Rx traffic class;
769  *			Set to the required value minus 1
770  * @max_unicast_filters: Maximum number of unicast filters
771  * @max_multicast_filters: Maximum number of multicast filters
772  * @max_vlan_filters: Maximum number of VLAN filters
773  * @max_qos_entries: if 'max_tcs > 1', declares the maximum entries in QoS table
774  * @max_qos_key_size: Maximum key size for the QoS look-up
775  * @max_dist_key_size: Maximum key size for the distribution look-up
776  * @max_policers: Maximum number of policers;
777  * @max_congestion_ctrl: Maximum number of congestion control groups (CGs);
778  * @ipr_cfg: IP reassembly configuration
779  */
780 struct dpni_attr {
781 	int id;
782 	/**
783 	 * struct version - DPNI version
784 	 * @major: DPNI major version
785 	 * @minor: DPNI minor version
786 	 */
787 	struct {
788 		uint16_t major;
789 		uint16_t minor;
790 	} version;
791 	enum net_prot start_hdr;
792 	uint32_t options;
793 	uint8_t max_senders;
794 	uint8_t max_tcs;
795 	uint8_t max_dist_per_tc[DPNI_MAX_TC];
796 	uint8_t max_unicast_filters;
797 	uint8_t max_multicast_filters;
798 	uint8_t max_vlan_filters;
799 	uint8_t max_qos_entries;
800 	uint8_t max_qos_key_size;
801 	uint8_t max_dist_key_size;
802 	uint8_t max_policers;
803 	uint8_t max_congestion_ctrl;
804 	struct dpni_ipr_cfg ipr_cfg;
805 };
806 
807 /**
808  * dpni_get_attributes() - Retrieve DPNI attributes.
809  * @mc_io:	Pointer to MC portal's I/O object
810  * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
811  * @token:	Token of DPNI object
812  * @attr:	Returned object's attributes
813  *
814  * Return:	'0' on Success; Error code otherwise.
815  */
816 int dpni_get_attributes(struct fsl_mc_io	*mc_io,
817 			uint32_t		cmd_flags,
818 			uint16_t		token,
819 			struct dpni_attr	*attr);
820 
821 /* DPNI buffer layout modification options */
822 
823 /* Select to modify the time-stamp setting */
824 #define DPNI_BUF_LAYOUT_OPT_TIMESTAMP		0x00000001
825 /* Select to modify the parser-result setting; not applicable for Tx */
826 #define DPNI_BUF_LAYOUT_OPT_PARSER_RESULT	0x00000002
827 /* Select to modify the frame-status setting */
828 #define DPNI_BUF_LAYOUT_OPT_FRAME_STATUS	0x00000004
829 /* Select to modify the private-data-size setting */
830 #define DPNI_BUF_LAYOUT_OPT_PRIVATE_DATA_SIZE	0x00000008
831 /* Select to modify the data-alignment setting */
832 #define DPNI_BUF_LAYOUT_OPT_DATA_ALIGN		0x00000010
833 /* Select to modify the data-head-room setting */
834 #define DPNI_BUF_LAYOUT_OPT_DATA_HEAD_ROOM	0x00000020
835 /*!< Select to modify the data-tail-room setting */
836 #define DPNI_BUF_LAYOUT_OPT_DATA_TAIL_ROOM	0x00000040
837 
838 /**
839  * struct dpni_buffer_layout - Structure representing DPNI buffer layout
840  * @options: Flags representing the suggested modifications to the buffer
841  *		layout; Use any combination of 'DPNI_BUF_LAYOUT_OPT_<X>' flags
842  * @pass_timestamp: Pass timestamp value
843  * @pass_parser_result: Pass parser results
844  * @pass_frame_status: Pass frame status
845  * @private_data_size: Size kept for private data (in bytes)
846  * @data_align: Data alignment
847  * @data_head_room: Data head room
848  * @data_tail_room: Data tail room
849  */
850 struct dpni_buffer_layout {
851 	uint32_t options;
852 	int pass_timestamp;
853 	int pass_parser_result;
854 	int pass_frame_status;
855 	uint16_t private_data_size;
856 	uint16_t data_align;
857 	uint16_t data_head_room;
858 	uint16_t data_tail_room;
859 };
860 
861 /**
862  * dpni_get_rx_buffer_layout() - Retrieve Rx buffer layout attributes.
863  * @mc_io:	Pointer to MC portal's I/O object
864  * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
865  * @token:	Token of DPNI object
866  * @layout:	Returns buffer layout attributes
867  *
868  * Return:	'0' on Success; Error code otherwise.
869  */
870 int dpni_get_rx_buffer_layout(struct fsl_mc_io		*mc_io,
871 			      uint32_t			cmd_flags,
872 			      uint16_t			token,
873 			      struct dpni_buffer_layout	*layout);
874 
875 /**
876  * dpni_set_rx_buffer_layout() - Set Rx buffer layout 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  * @layout:	Buffer layout configuration
881  *
882  * Return:	'0' on Success; Error code otherwise.
883  *
884  * @warning	Allowed only when DPNI is disabled
885  */
886 int dpni_set_rx_buffer_layout(struct fsl_mc_io			*mc_io,
887 			      uint32_t				cmd_flags,
888 			      uint16_t				token,
889 			      const struct dpni_buffer_layout	*layout);
890 
891 /**
892  * dpni_get_tx_buffer_layout() - Retrieve Tx buffer layout attributes.
893  * @mc_io:	Pointer to MC portal's I/O object
894  * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
895  * @token:	Token of DPNI object
896  * @layout:	Returns buffer layout attributes
897  *
898  * Return:	'0' on Success; Error code otherwise.
899  */
900 int dpni_get_tx_buffer_layout(struct fsl_mc_io		*mc_io,
901 			      uint32_t			cmd_flags,
902 			      uint16_t			token,
903 			      struct dpni_buffer_layout	*layout);
904 
905 /**
906  * dpni_set_tx_buffer_layout() - Set Tx buffer layout configuration.
907  * @mc_io:	Pointer to MC portal's I/O object
908  * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
909  * @token:	Token of DPNI object
910  * @layout:	Buffer layout configuration
911  *
912  * Return:	'0' on Success; Error code otherwise.
913  *
914  * @warning	Allowed only when DPNI is disabled
915  */
916 int dpni_set_tx_buffer_layout(struct fsl_mc_io			*mc_io,
917 			      uint32_t				cmd_flags,
918 			      uint16_t				token,
919 			      const struct dpni_buffer_layout	*layout);
920 
921 /**
922  * dpni_get_tx_conf_buffer_layout() - Retrieve Tx confirmation buffer layout
923  *				attributes.
924  * @mc_io:	Pointer to MC portal's I/O object
925  * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
926  * @token:	Token of DPNI object
927  * @layout:	Returns buffer layout attributes
928  *
929  * Return:	'0' on Success; Error code otherwise.
930  */
931 int dpni_get_tx_conf_buffer_layout(struct fsl_mc_io		*mc_io,
932 				   uint32_t			cmd_flags,
933 				   uint16_t			token,
934 				   struct dpni_buffer_layout	*layout);
935 
936 /**
937  * dpni_set_tx_conf_buffer_layout() - Set Tx confirmation buffer layout
938  *					configuration.
939  * @mc_io:	Pointer to MC portal's I/O object
940  * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
941  * @token:	Token of DPNI object
942  * @layout:	Buffer layout configuration
943  *
944  * Return:	'0' on Success; Error code otherwise.
945  *
946  * @warning	Allowed only when DPNI is disabled
947  */
948 int dpni_set_tx_conf_buffer_layout(struct fsl_mc_io		   *mc_io,
949 				   uint32_t			   cmd_flags,
950 				   uint16_t			   token,
951 				   const struct dpni_buffer_layout *layout);
952 
953 /**
954  * dpni_get_qdid() - Get the Queuing Destination ID (QDID) that should be used
955  *			for enqueue operations
956  * @mc_io:	Pointer to MC portal's I/O object
957  * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
958  * @token:	Token of DPNI object
959  * @qdid:	Returned virtual QDID value that should be used as an argument
960  *			in all enqueue operations
961  *
962  * Return:	'0' on Success; Error code otherwise.
963  */
964 int dpni_get_qdid(struct fsl_mc_io	*mc_io,
965 		  uint32_t		cmd_flags,
966 		  uint16_t		token,
967 		  uint16_t		*qdid);
968 
969 /**
970  * dpni_get_tx_data_offset() - Get the Tx data offset (from start of buffer)
971  * @mc_io:	Pointer to MC portal's I/O object
972  * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
973  * @token:	Token of DPNI object
974  * @data_offset: Tx data offset (from start of buffer)
975  *
976  * Return:	'0' on Success; Error code otherwise.
977  */
978 int dpni_get_tx_data_offset(struct fsl_mc_io	*mc_io,
979 			    uint32_t		cmd_flags,
980 			    uint16_t		token,
981 			    uint16_t		*data_offset);
982 
983 /**
984  * enum dpni_counter - DPNI counter types
985  * @DPNI_CNT_ING_FRAME: Counts ingress frames
986  * @DPNI_CNT_ING_BYTE: Counts ingress bytes
987  * @DPNI_CNT_ING_FRAME_DROP: Counts ingress frames dropped due to explicit
988  *		'drop' setting
989  * @DPNI_CNT_ING_FRAME_DISCARD: Counts ingress frames discarded due to errors
990  * @DPNI_CNT_ING_MCAST_FRAME: Counts ingress multicast frames
991  * @DPNI_CNT_ING_MCAST_BYTE: Counts ingress multicast bytes
992  * @DPNI_CNT_ING_BCAST_FRAME: Counts ingress broadcast frames
993  * @DPNI_CNT_ING_BCAST_BYTES: Counts ingress broadcast bytes
994  * @DPNI_CNT_EGR_FRAME: Counts egress frames
995  * @DPNI_CNT_EGR_BYTE: Counts egress bytes
996  * @DPNI_CNT_EGR_FRAME_DISCARD: Counts egress frames discarded due to errors
997  */
998 enum dpni_counter {
999 	DPNI_CNT_ING_FRAME = 0x0,
1000 	DPNI_CNT_ING_BYTE = 0x1,
1001 	DPNI_CNT_ING_FRAME_DROP = 0x2,
1002 	DPNI_CNT_ING_FRAME_DISCARD = 0x3,
1003 	DPNI_CNT_ING_MCAST_FRAME = 0x4,
1004 	DPNI_CNT_ING_MCAST_BYTE = 0x5,
1005 	DPNI_CNT_ING_BCAST_FRAME = 0x6,
1006 	DPNI_CNT_ING_BCAST_BYTES = 0x7,
1007 	DPNI_CNT_EGR_FRAME = 0x8,
1008 	DPNI_CNT_EGR_BYTE = 0x9,
1009 	DPNI_CNT_EGR_FRAME_DISCARD = 0xa
1010 };
1011 
1012 /**
1013  * dpni_get_counter() - Read a specific DPNI counter
1014  * @mc_io:	Pointer to MC portal's I/O object
1015  * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
1016  * @token:	Token of DPNI object
1017  * @counter:	The requested counter
1018  * @value:	Returned counter's current value
1019  *
1020  * Return:	'0' on Success; Error code otherwise.
1021  */
1022 int dpni_get_counter(struct fsl_mc_io	*mc_io,
1023 		     uint32_t		cmd_flags,
1024 		     uint16_t		token,
1025 		     enum dpni_counter	counter,
1026 		     uint64_t		*value);
1027 
1028 /**
1029  * dpni_set_counter() - Set (or clear) a specific DPNI counter
1030  * @mc_io:	Pointer to MC portal's I/O object
1031  * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
1032  * @token:	Token of DPNI object
1033  * @counter:	The requested counter
1034  * @value:	New counter value; typically pass '0' for resetting
1035  *			the counter.
1036  *
1037  * Return:	'0' on Success; Error code otherwise.
1038  */
1039 int dpni_set_counter(struct fsl_mc_io	*mc_io,
1040 		     uint32_t		cmd_flags,
1041 		     uint16_t		token,
1042 		     enum dpni_counter	counter,
1043 		     uint64_t		value);
1044 
1045 /* Enable auto-negotiation */
1046 #define DPNI_LINK_OPT_AUTONEG		0x0000000000000001ULL
1047 /* Enable half-duplex mode */
1048 #define DPNI_LINK_OPT_HALF_DUPLEX	0x0000000000000002ULL
1049 /* Enable pause frames */
1050 #define DPNI_LINK_OPT_PAUSE		0x0000000000000004ULL
1051 /* Enable a-symmetric pause frames */
1052 #define DPNI_LINK_OPT_ASYM_PAUSE	0x0000000000000008ULL
1053 
1054 /**
1055  * struct - Structure representing DPNI link configuration
1056  * @rate: Rate
1057  * @options: Mask of available options; use 'DPNI_LINK_OPT_<X>' values
1058  */
1059 struct dpni_link_cfg {
1060 	uint32_t rate;
1061 	uint64_t options;
1062 };
1063 
1064 /**
1065  * dpni_set_link_cfg() - set the link 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  * @cfg:	Link configuration
1070  *
1071  * Return:	'0' on Success; Error code otherwise.
1072  */
1073 int dpni_set_link_cfg(struct fsl_mc_io			*mc_io,
1074 		      uint32_t				cmd_flags,
1075 		      uint16_t				token,
1076 		      const struct dpni_link_cfg	*cfg);
1077 
1078 /**
1079  * struct dpni_link_state - Structure representing DPNI link state
1080  * @rate: Rate
1081  * @options: Mask of available options; use 'DPNI_LINK_OPT_<X>' values
1082  * @up: Link state; '0' for down, '1' for up
1083  */
1084 struct dpni_link_state {
1085 	uint32_t rate;
1086 	uint64_t options;
1087 	int up;
1088 };
1089 
1090 /**
1091  * dpni_get_link_state() - Return the link state (either up or down)
1092  * @mc_io:	Pointer to MC portal's I/O object
1093  * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
1094  * @token:	Token of DPNI object
1095  * @state:	Returned link state;
1096  *
1097  * Return:	'0' on Success; Error code otherwise.
1098  */
1099 int dpni_get_link_state(struct fsl_mc_io	*mc_io,
1100 			uint32_t		cmd_flags,
1101 			uint16_t		token,
1102 			struct dpni_link_state	*state);
1103 
1104 /**
1105  * dpni_set_primary_mac_addr() - Set the primary MAC address
1106  * @mc_io:	Pointer to MC portal's I/O object
1107  * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
1108  * @token:	Token of DPNI object
1109  * @mac_addr:	MAC address to set as primary address
1110  *
1111  * Return:	'0' on Success; Error code otherwise.
1112  */
1113 int dpni_set_primary_mac_addr(struct fsl_mc_io *mc_io,
1114 			      uint32_t		cmd_flags,
1115 			      uint16_t		token,
1116 			      const uint8_t	mac_addr[6]);
1117 
1118 /**
1119  * dpni_get_primary_mac_addr() - Get the primary MAC address
1120  * @mc_io:	Pointer to MC portal's I/O object
1121  * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
1122  * @token:	Token of DPNI object
1123  * @mac_addr:	Returned MAC address
1124  *
1125  * Return:	'0' on Success; Error code otherwise.
1126  */
1127 int dpni_get_primary_mac_addr(struct fsl_mc_io	*mc_io,
1128 			      uint32_t		cmd_flags,
1129 			      uint16_t		token,
1130 			      uint8_t		mac_addr[6]);
1131 
1132 /**
1133  * dpni_add_mac_addr() - Add MAC address filter
1134  * @mc_io:	Pointer to MC portal's I/O object
1135  * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
1136  * @token:	Token of DPNI object
1137  * @mac_addr:	MAC address to add
1138  *
1139  * Return:	'0' on Success; Error code otherwise.
1140  */
1141 int dpni_add_mac_addr(struct fsl_mc_io	*mc_io,
1142 		      uint32_t		cmd_flags,
1143 		      uint16_t		token,
1144 		      const uint8_t	mac_addr[6]);
1145 
1146 /**
1147  * dpni_remove_mac_addr() - Remove MAC address filter
1148  * @mc_io:	Pointer to MC portal's I/O object
1149  * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
1150  * @token:	Token of DPNI object
1151  * @mac_addr:	MAC address to remove
1152  *
1153  * Return:	'0' on Success; Error code otherwise.
1154  */
1155 int dpni_remove_mac_addr(struct fsl_mc_io	*mc_io,
1156 			 uint32_t		cmd_flags,
1157 			 uint16_t		token,
1158 			 const uint8_t		mac_addr[6]);
1159 
1160 /**
1161  * enum dpni_dest - DPNI destination types
1162  * @DPNI_DEST_NONE: Unassigned destination; The queue is set in parked mode and
1163  *		does not generate FQDAN notifications; user is expected to
1164  *		dequeue from the queue based on polling or other user-defined
1165  *		method
1166  * @DPNI_DEST_DPIO: The queue is set in schedule mode and generates FQDAN
1167  *		notifications to the specified DPIO; user is expected to dequeue
1168  *		from the queue only after notification is received
1169  * @DPNI_DEST_DPCON: The queue is set in schedule mode and does not generate
1170  *		FQDAN notifications, but is connected to the specified DPCON
1171  *		object; user is expected to dequeue from the DPCON channel
1172  */
1173 enum dpni_dest {
1174 	DPNI_DEST_NONE = 0,
1175 	DPNI_DEST_DPIO = 1,
1176 	DPNI_DEST_DPCON = 2
1177 };
1178 
1179 /**
1180  * struct dpni_dest_cfg - Structure representing DPNI destination parameters
1181  * @dest_type: Destination type
1182  * @dest_id: Either DPIO ID or DPCON ID, depending on the destination type
1183  * @priority: Priority selection within the DPIO or DPCON channel; valid values
1184  *		are 0-1 or 0-7, depending on the number of priorities in that
1185  *		channel; not relevant for 'DPNI_DEST_NONE' option
1186  */
1187 struct dpni_dest_cfg {
1188 	enum dpni_dest dest_type;
1189 	int dest_id;
1190 	uint8_t priority;
1191 };
1192 
1193 /**
1194  * enum dpni_flc_type - DPNI FLC types
1195  * @DPNI_FLC_USER_DEFINED: select the FLC to be used for user defined value
1196  * @DPNI_FLC_STASH: select the FLC to be used for stash control
1197  */
1198 enum dpni_flc_type {
1199 	DPNI_FLC_USER_DEFINED = 0,
1200 	DPNI_FLC_STASH = 1,
1201 };
1202 
1203 /**
1204  * enum dpni_stash_size - DPNI FLC stashing size
1205  * @DPNI_STASH_SIZE_0B: no stash
1206  * @DPNI_STASH_SIZE_64B: stashes 64 bytes
1207  * @DPNI_STASH_SIZE_128B: stashes 128 bytes
1208  * @DPNI_STASH_SIZE_192B: stashes 192 bytes
1209  */
1210 enum dpni_stash_size {
1211 	DPNI_STASH_SIZE_0B = 0,
1212 	DPNI_STASH_SIZE_64B = 1,
1213 	DPNI_STASH_SIZE_128B = 2,
1214 	DPNI_STASH_SIZE_192B = 3,
1215 };
1216 
1217 /* DPNI FLC stash options */
1218 
1219 /* stashes the whole annotation area (up to 192 bytes) */
1220 #define DPNI_FLC_STASH_FRAME_ANNOTATION	0x00000001
1221 
1222 /**
1223  * struct dpni_flc_cfg - Structure representing DPNI FLC configuration
1224  * @flc_type: FLC type
1225  * @options: Mask of available options;
1226  *	use 'DPNI_FLC_STASH_<X>' values
1227  * @frame_data_size: Size of frame data to be stashed
1228  * @flow_context_size: Size of flow context to be stashed
1229  * @flow_context: 1. In case flc_type is 'DPNI_FLC_USER_DEFINED':
1230  *			this value will be provided in the frame descriptor
1231  *			(FD[FLC])
1232  *		  2. In case flc_type is 'DPNI_FLC_STASH':
1233  *			this value will be I/O virtual address of the
1234  *			flow-context;
1235  *			Must be cacheline-aligned and DMA-able memory
1236  */
1237 struct dpni_flc_cfg {
1238 	enum dpni_flc_type flc_type;
1239 	uint32_t options;
1240 	enum dpni_stash_size frame_data_size;
1241 	enum dpni_stash_size flow_context_size;
1242 	uint64_t flow_context;
1243 };
1244 
1245 /* DPNI queue modification options */
1246 
1247 /* Select to modify the user's context associated with the queue */
1248 #define DPNI_QUEUE_OPT_USER_CTX		0x00000001
1249 /* Select to modify the queue's destination */
1250 #define DPNI_QUEUE_OPT_DEST		0x00000002
1251 /** Select to modify the flow-context parameters;
1252  * not applicable for Tx-conf/Err queues as the FD comes from the user
1253  */
1254 #define DPNI_QUEUE_OPT_FLC		0x00000004
1255 /* Select to modify the queue's order preservation */
1256 #define DPNI_QUEUE_OPT_ORDER_PRESERVATION 0x00000008
1257 
1258 /**
1259  * struct dpni_queue_cfg - Structure representing queue configuration
1260  * @options: Flags representing the suggested modifications to the queue;
1261  *		Use any combination of 'DPNI_QUEUE_OPT_<X>' flags
1262  * @user_ctx: User context value provided in the frame descriptor of each
1263  *		dequeued frame; valid only if 'DPNI_QUEUE_OPT_USER_CTX'
1264  *		is contained in 'options'
1265  * @dest_cfg: Queue destination parameters;
1266  *		valid only if 'DPNI_QUEUE_OPT_DEST' is contained in 'options'
1267  * @flc_cfg: Flow context configuration; in case the TC's distribution
1268  *		is either NONE or HASH the FLC's settings of flow#0 are used.
1269  *		in the case of FS (flow-steering) the flow's FLC settings
1270  *		are used.
1271  *		valid only if 'DPNI_QUEUE_OPT_FLC' is contained in 'options'
1272  * @order_preservation_en: enable/disable order preservation;
1273  *		valid only if 'DPNI_QUEUE_OPT_ORDER_PRESERVATION' is contained
1274  *		in 'options'
1275  */
1276 struct dpni_queue_cfg {
1277 	uint32_t options;
1278 	uint64_t user_ctx;
1279 	struct dpni_dest_cfg dest_cfg;
1280 	struct dpni_flc_cfg flc_cfg;
1281 	int order_preservation_en;
1282 };
1283 
1284 /**
1285  * struct dpni_queue_attr - Structure representing queue attributes
1286  * @user_ctx: User context value provided in the frame descriptor of each
1287  *	dequeued frame
1288  * @dest_cfg: Queue destination configuration
1289  * @flc_cfg: Flow context configuration
1290  * @order_preservation_en: enable/disable order preservation
1291  * @fqid: Virtual fqid value to be used for dequeue operations
1292  */
1293 struct dpni_queue_attr {
1294 	uint64_t user_ctx;
1295 	struct dpni_dest_cfg dest_cfg;
1296 	struct dpni_flc_cfg flc_cfg;
1297 	int order_preservation_en;
1298 	uint32_t fqid;
1299 };
1300 
1301 /* DPNI Tx flow modification options */
1302 
1303 /* Select to modify the settings for dedicate Tx confirmation/error */
1304 #define DPNI_TX_FLOW_OPT_TX_CONF_ERROR	0x00000001
1305 /*!< Select to modify the Tx confirmation and/or error setting */
1306 #define DPNI_TX_FLOW_OPT_ONLY_TX_ERROR	0x00000002
1307 /*!< Select to modify the queue configuration */
1308 #define DPNI_TX_FLOW_OPT_QUEUE		0x00000004
1309 /*!< Select to modify the L3 checksum generation setting */
1310 #define DPNI_TX_FLOW_OPT_L3_CHKSUM_GEN	0x00000010
1311 /*!< Select to modify the L4 checksum generation setting */
1312 #define DPNI_TX_FLOW_OPT_L4_CHKSUM_GEN	0x00000020
1313 
1314 /**
1315  * struct dpni_tx_flow_cfg - Structure representing Tx flow configuration
1316  * @options: Flags representing the suggested modifications to the Tx flow;
1317  *		Use any combination 'DPNI_TX_FLOW_OPT_<X>' flags
1318  * @conf_err_cfg: Tx confirmation and error configuration; these settings are
1319  *		ignored if 'DPNI_OPT_PRIVATE_TX_CONF_ERROR_DISABLED' was set at
1320  *		DPNI creation
1321  * @l3_chksum_gen: Set to '1' to enable L3 checksum generation; '0' to disable;
1322  *		valid only if 'DPNI_TX_FLOW_OPT_L3_CHKSUM_GEN' is contained in
1323  *		'options'
1324  * @l4_chksum_gen: Set to '1' to enable L4 checksum generation; '0' to disable;
1325  *		valid only if 'DPNI_TX_FLOW_OPT_L4_CHKSUM_GEN' is contained in
1326  *		'options'
1327  */
1328 struct dpni_tx_flow_cfg {
1329 	uint32_t options;
1330 	/**
1331 	 * struct cnf_err_cfg - Tx confirmation and error configuration
1332 	 * @use_default_queue: Set to '1' to use the common (default) Tx
1333 	 *		confirmation and error queue; Set to '0' to use the
1334 	 *		private Tx confirmation and error queue; valid only if
1335 	 *		'DPNI_TX_FLOW_OPT_TX_CONF_ERROR' is contained in
1336 	 *		'options'
1337 	 * @errors_only: Set to '1' to report back only error frames;
1338 	 *		Set to '0' to confirm transmission/error for all
1339 	 *		transmitted frames;
1340 	 *		valid only if 'DPNI_TX_FLOW_OPT_ONLY_TX_ERROR' is
1341 	 *		contained in 'options' and 'use_default_queue = 0';
1342 	 * @queue_cfg: Queue configuration; valid only if
1343 	 *		'DPNI_TX_FLOW_OPT_QUEUE' is contained in 'options'
1344 	 */
1345 	struct {
1346 		int use_default_queue;
1347 		int errors_only;
1348 		struct dpni_queue_cfg queue_cfg;
1349 	} conf_err_cfg;
1350 	int l3_chksum_gen;
1351 	int l4_chksum_gen;
1352 };
1353 
1354 /**
1355  * dpni_set_tx_flow() - Set Tx flow configuration
1356  * @mc_io:	Pointer to MC portal's I/O object
1357  * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
1358  * @token:	Token of DPNI object
1359  * @flow_id:	Provides (or returns) the sender's flow ID;
1360  *				for each new sender set (*flow_id) to
1361  *				'DPNI_NEW_FLOW_ID' to generate a new flow_id;
1362  *				this ID should be used as the QDBIN argument
1363  *				in enqueue operations
1364  * @cfg:	Tx flow configuration
1365  *
1366  * Return:	'0' on Success; Error code otherwise.
1367  */
1368 int dpni_set_tx_flow(struct fsl_mc_io			*mc_io,
1369 		     uint32_t				cmd_flags,
1370 		     uint16_t				token,
1371 		     uint16_t				*flow_id,
1372 		     const struct dpni_tx_flow_cfg	*cfg);
1373 
1374 /**
1375  * struct dpni_tx_flow_attr - Structure representing Tx flow attributes
1376  * @conf_err_attr: Tx confirmation and error attributes
1377  * @l3_chksum_gen: '1' if L3 checksum generation is enabled; '0' if disabled
1378  * @l4_chksum_gen: '1' if L4 checksum generation is enabled; '0' if disabled
1379  */
1380 struct dpni_tx_flow_attr {
1381 	/**
1382 	 * struct conf_err_attr - Tx confirmation and error attributes
1383 	 * @use_default_queue: '1' if using common (default) Tx confirmation and
1384 	 *			error queue;
1385 	 *			'0' if using private Tx confirmation and error
1386 	 *			queue
1387 	 * @errors_only: '1' if only error frames are reported back; '0' if all
1388 	 *		transmitted frames are confirmed
1389 	 * @queue_attr: Queue attributes
1390 	 */
1391 	struct {
1392 		int use_default_queue;
1393 		int errors_only;
1394 		struct dpni_queue_attr queue_attr;
1395 	} conf_err_attr;
1396 	int l3_chksum_gen;
1397 	int l4_chksum_gen;
1398 };
1399 
1400 /**
1401  * dpni_get_tx_flow() - Get Tx flow attributes
1402  * @mc_io:	Pointer to MC portal's I/O object
1403  * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
1404  * @token:	Token of DPNI object
1405  * @flow_id:	The sender's flow ID, as returned by the
1406  *			dpni_set_tx_flow() function
1407  * @attr:	Returned Tx flow attributes
1408  *
1409  * Return:	'0' on Success; Error code otherwise.
1410  */
1411 int dpni_get_tx_flow(struct fsl_mc_io		*mc_io,
1412 		     uint32_t			cmd_flags,
1413 		     uint16_t			token,
1414 		     uint16_t			flow_id,
1415 		     struct dpni_tx_flow_attr	*attr);
1416 
1417 /**
1418  * dpni_set_rx_flow() - Set Rx flow configuration
1419  * @mc_io:	Pointer to MC portal's I/O object
1420  * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
1421  * @token:	Token of DPNI object
1422  * @tc_id:	Traffic class selection (0-7);
1423  *			use 'DPNI_ALL_TCS' to set all TCs and all flows
1424  * @flow_id:	Rx flow id within the traffic class; use
1425  *			'DPNI_ALL_TC_FLOWS' to set all flows within
1426  *			this tc_id; ignored if tc_id is set to
1427  *			'DPNI_ALL_TCS';
1428  * @cfg:	Rx flow configuration
1429  *
1430  * Return:	'0' on Success; Error code otherwise.
1431  */
1432 int dpni_set_rx_flow(struct fsl_mc_io			*mc_io,
1433 		     uint32_t				cmd_flags,
1434 		     uint16_t				token,
1435 		     uint8_t				tc_id,
1436 		     uint16_t				flow_id,
1437 		     const struct dpni_queue_cfg	*cfg);
1438 
1439 /**
1440  * dpni_get_rx_flow() -	Get Rx flow attributes
1441  * @mc_io:	Pointer to MC portal's I/O object
1442  * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
1443  * @token:	Token of DPNI object
1444  * @tc_id:	Traffic class selection (0-7)
1445  * @flow_id:	Rx flow id within the traffic class
1446  * @attr:	Returned Rx flow attributes
1447  *
1448  * Return:	'0' on Success; Error code otherwise.
1449  */
1450 int dpni_get_rx_flow(struct fsl_mc_io		*mc_io,
1451 		     uint32_t			cmd_flags,
1452 		     uint16_t			token,
1453 		     uint8_t			tc_id,
1454 		     uint16_t			flow_id,
1455 		     struct dpni_queue_attr	*attr);
1456 
1457 #endif /* _FSL_DPNI_H */
1458