mediatek: mt7622: add Linux 5.10 support
[openwrt/staging/rmilecki.git] / target / linux / mediatek / files-5.10 / drivers / net / phy / rtk / rtl8367c / include / storm.h
1 /*
2 * Copyright (C) 2013 Realtek Semiconductor Corp.
3 * All Rights Reserved.
4 *
5 * Unless you and Realtek execute a separate written software license
6 * agreement governing use of this software, this software is licensed
7 * to you under the terms of the GNU General Public License version 2,
8 * available at https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
9 *
10 * Purpose : RTL8367/RTL8367C switch high-level API
11 *
12 * Feature : The file includes Storm module high-layer API defination
13 *
14 */
15
16 #ifndef __RTK_API_STORM_H__
17 #define __RTK_API_STORM_H__
18
19 #define STORM_UNUC_INDEX 28
20 #define STORM_UNMC_INDEX 29
21 #define STORM_MC_INDEX 30
22 #define STORM_BC_INDEX 31
23
24 typedef enum rtk_rate_storm_group_e
25 {
26 STORM_GROUP_UNKNOWN_UNICAST = 0,
27 STORM_GROUP_UNKNOWN_MULTICAST,
28 STORM_GROUP_MULTICAST,
29 STORM_GROUP_BROADCAST,
30 STORM_GROUP_END
31 } rtk_rate_storm_group_t;
32
33 typedef enum rtk_storm_bypass_e
34 {
35 BYPASS_BRG_GROUP = 0,
36 BYPASS_FD_PAUSE,
37 BYPASS_SP_MCAST,
38 BYPASS_1X_PAE,
39 BYPASS_UNDEF_BRG_04,
40 BYPASS_UNDEF_BRG_05,
41 BYPASS_UNDEF_BRG_06,
42 BYPASS_UNDEF_BRG_07,
43 BYPASS_PROVIDER_BRIDGE_GROUP_ADDRESS,
44 BYPASS_UNDEF_BRG_09,
45 BYPASS_UNDEF_BRG_0A,
46 BYPASS_UNDEF_BRG_0B,
47 BYPASS_UNDEF_BRG_0C,
48 BYPASS_PROVIDER_BRIDGE_GVRP_ADDRESS,
49 BYPASS_8021AB,
50 BYPASS_UNDEF_BRG_0F,
51 BYPASS_BRG_MNGEMENT,
52 BYPASS_UNDEFINED_11,
53 BYPASS_UNDEFINED_12,
54 BYPASS_UNDEFINED_13,
55 BYPASS_UNDEFINED_14,
56 BYPASS_UNDEFINED_15,
57 BYPASS_UNDEFINED_16,
58 BYPASS_UNDEFINED_17,
59 BYPASS_UNDEFINED_18,
60 BYPASS_UNDEFINED_19,
61 BYPASS_UNDEFINED_1A,
62 BYPASS_UNDEFINED_1B,
63 BYPASS_UNDEFINED_1C,
64 BYPASS_UNDEFINED_1D,
65 BYPASS_UNDEFINED_1E,
66 BYPASS_UNDEFINED_1F,
67 BYPASS_GMRP,
68 BYPASS_GVRP,
69 BYPASS_UNDEF_GARP_22,
70 BYPASS_UNDEF_GARP_23,
71 BYPASS_UNDEF_GARP_24,
72 BYPASS_UNDEF_GARP_25,
73 BYPASS_UNDEF_GARP_26,
74 BYPASS_UNDEF_GARP_27,
75 BYPASS_UNDEF_GARP_28,
76 BYPASS_UNDEF_GARP_29,
77 BYPASS_UNDEF_GARP_2A,
78 BYPASS_UNDEF_GARP_2B,
79 BYPASS_UNDEF_GARP_2C,
80 BYPASS_UNDEF_GARP_2D,
81 BYPASS_UNDEF_GARP_2E,
82 BYPASS_UNDEF_GARP_2F,
83 BYPASS_IGMP,
84 BYPASS_CDP,
85 BYPASS_CSSTP,
86 BYPASS_LLDP,
87 BYPASS_END,
88 }rtk_storm_bypass_t;
89
90 /* Function Name:
91 * rtk_rate_stormControlMeterIdx_set
92 * Description:
93 * Set the storm control meter index.
94 * Input:
95 * port - port id
96 * storm_type - storm group type
97 * index - storm control meter index.
98 * Output:
99 * None.
100 * Return:
101 * RT_ERR_OK
102 * RT_ERR_FAILED
103 * RT_ERR_PORT_ID - Invalid port id
104 * RT_ERR_FILTER_METER_ID - Invalid meter
105 * Note:
106 *
107 */
108 extern rtk_api_ret_t rtk_rate_stormControlMeterIdx_set(rtk_port_t port, rtk_rate_storm_group_t stormType, rtk_uint32 index);
109
110 /* Function Name:
111 * rtk_rate_stormControlMeterIdx_get
112 * Description:
113 * Get the storm control meter index.
114 * Input:
115 * port - port id
116 * storm_type - storm group type
117 * Output:
118 * pIndex - storm control meter index.
119 * Return:
120 * RT_ERR_OK
121 * RT_ERR_FAILED
122 * RT_ERR_PORT_ID - Invalid port id
123 * RT_ERR_FILTER_METER_ID - Invalid meter
124 * Note:
125 *
126 */
127 extern rtk_api_ret_t rtk_rate_stormControlMeterIdx_get(rtk_port_t port, rtk_rate_storm_group_t stormType, rtk_uint32 *pIndex);
128
129 /* Function Name:
130 * rtk_rate_stormControlPortEnable_set
131 * Description:
132 * Set enable status of storm control on specified port.
133 * Input:
134 * port - port id
135 * stormType - storm group type
136 * enable - enable status of storm control
137 * Output:
138 * None
139 * Return:
140 * RT_ERR_OK
141 * RT_ERR_FAILED
142 * RT_ERR_NOT_INIT - The module is not initial
143 * RT_ERR_PORT_ID - invalid port id
144 * RT_ERR_INPUT - invalid input parameter
145 * Note:
146 *
147 */
148 extern rtk_api_ret_t rtk_rate_stormControlPortEnable_set(rtk_port_t port, rtk_rate_storm_group_t stormType, rtk_enable_t enable);
149
150 /* Function Name:
151 * rtk_rate_stormControlPortEnable_set
152 * Description:
153 * Set enable status of storm control on specified port.
154 * Input:
155 * port - port id
156 * stormType - storm group type
157 * Output:
158 * pEnable - enable status of storm control
159 * Return:
160 * RT_ERR_OK
161 * RT_ERR_FAILED
162 * RT_ERR_NOT_INIT - The module is not initial
163 * RT_ERR_PORT_ID - invalid port id
164 * RT_ERR_INPUT - invalid input parameter
165 * Note:
166 *
167 */
168 extern rtk_api_ret_t rtk_rate_stormControlPortEnable_get(rtk_port_t port, rtk_rate_storm_group_t stormType, rtk_enable_t *pEnable);
169
170 /* Function Name:
171 * rtk_storm_bypass_set
172 * Description:
173 * Set bypass storm filter control configuration.
174 * Input:
175 * type - Bypass storm filter control type.
176 * enable - Bypass status.
177 * Output:
178 * None
179 * Return:
180 * RT_ERR_OK - OK
181 * RT_ERR_FAILED - Failed
182 * RT_ERR_SMI - SMI access error
183 * RT_ERR_INPUT - Invalid input parameters.
184 * RT_ERR_ENABLE - Invalid IFG parameter
185 * Note:
186 *
187 * This API can set per-port bypass stomr filter control frame type including RMA and igmp.
188 * The bypass frame type is as following:
189 * - BYPASS_BRG_GROUP,
190 * - BYPASS_FD_PAUSE,
191 * - BYPASS_SP_MCAST,
192 * - BYPASS_1X_PAE,
193 * - BYPASS_UNDEF_BRG_04,
194 * - BYPASS_UNDEF_BRG_05,
195 * - BYPASS_UNDEF_BRG_06,
196 * - BYPASS_UNDEF_BRG_07,
197 * - BYPASS_PROVIDER_BRIDGE_GROUP_ADDRESS,
198 * - BYPASS_UNDEF_BRG_09,
199 * - BYPASS_UNDEF_BRG_0A,
200 * - BYPASS_UNDEF_BRG_0B,
201 * - BYPASS_UNDEF_BRG_0C,
202 * - BYPASS_PROVIDER_BRIDGE_GVRP_ADDRESS,
203 * - BYPASS_8021AB,
204 * - BYPASS_UNDEF_BRG_0F,
205 * - BYPASS_BRG_MNGEMENT,
206 * - BYPASS_UNDEFINED_11,
207 * - BYPASS_UNDEFINED_12,
208 * - BYPASS_UNDEFINED_13,
209 * - BYPASS_UNDEFINED_14,
210 * - BYPASS_UNDEFINED_15,
211 * - BYPASS_UNDEFINED_16,
212 * - BYPASS_UNDEFINED_17,
213 * - BYPASS_UNDEFINED_18,
214 * - BYPASS_UNDEFINED_19,
215 * - BYPASS_UNDEFINED_1A,
216 * - BYPASS_UNDEFINED_1B,
217 * - BYPASS_UNDEFINED_1C,
218 * - BYPASS_UNDEFINED_1D,
219 * - BYPASS_UNDEFINED_1E,
220 * - BYPASS_UNDEFINED_1F,
221 * - BYPASS_GMRP,
222 * - BYPASS_GVRP,
223 * - BYPASS_UNDEF_GARP_22,
224 * - BYPASS_UNDEF_GARP_23,
225 * - BYPASS_UNDEF_GARP_24,
226 * - BYPASS_UNDEF_GARP_25,
227 * - BYPASS_UNDEF_GARP_26,
228 * - BYPASS_UNDEF_GARP_27,
229 * - BYPASS_UNDEF_GARP_28,
230 * - BYPASS_UNDEF_GARP_29,
231 * - BYPASS_UNDEF_GARP_2A,
232 * - BYPASS_UNDEF_GARP_2B,
233 * - BYPASS_UNDEF_GARP_2C,
234 * - BYPASS_UNDEF_GARP_2D,
235 * - BYPASS_UNDEF_GARP_2E,
236 * - BYPASS_UNDEF_GARP_2F,
237 * - BYPASS_IGMP.
238 */
239 extern rtk_api_ret_t rtk_storm_bypass_set(rtk_storm_bypass_t type, rtk_enable_t enable);
240
241 /* Function Name:
242 * rtk_storm_bypass_get
243 * Description:
244 * Get bypass storm filter control configuration.
245 * Input:
246 * type - Bypass storm filter control type.
247 * Output:
248 * pEnable - Bypass status.
249 * Return:
250 * RT_ERR_OK - OK
251 * RT_ERR_FAILED - Failed
252 * RT_ERR_SMI - SMI access error
253 * RT_ERR_INPUT - Invalid input parameters.
254 * Note:
255 * This API can get per-port bypass stomr filter control frame type including RMA and igmp.
256 * The bypass frame type is as following:
257 * - BYPASS_BRG_GROUP,
258 * - BYPASS_FD_PAUSE,
259 * - BYPASS_SP_MCAST,
260 * - BYPASS_1X_PAE,
261 * - BYPASS_UNDEF_BRG_04,
262 * - BYPASS_UNDEF_BRG_05,
263 * - BYPASS_UNDEF_BRG_06,
264 * - BYPASS_UNDEF_BRG_07,
265 * - BYPASS_PROVIDER_BRIDGE_GROUP_ADDRESS,
266 * - BYPASS_UNDEF_BRG_09,
267 * - BYPASS_UNDEF_BRG_0A,
268 * - BYPASS_UNDEF_BRG_0B,
269 * - BYPASS_UNDEF_BRG_0C,
270 * - BYPASS_PROVIDER_BRIDGE_GVRP_ADDRESS,
271 * - BYPASS_8021AB,
272 * - BYPASS_UNDEF_BRG_0F,
273 * - BYPASS_BRG_MNGEMENT,
274 * - BYPASS_UNDEFINED_11,
275 * - BYPASS_UNDEFINED_12,
276 * - BYPASS_UNDEFINED_13,
277 * - BYPASS_UNDEFINED_14,
278 * - BYPASS_UNDEFINED_15,
279 * - BYPASS_UNDEFINED_16,
280 * - BYPASS_UNDEFINED_17,
281 * - BYPASS_UNDEFINED_18,
282 * - BYPASS_UNDEFINED_19,
283 * - BYPASS_UNDEFINED_1A,
284 * - BYPASS_UNDEFINED_1B,
285 * - BYPASS_UNDEFINED_1C,
286 * - BYPASS_UNDEFINED_1D,
287 * - BYPASS_UNDEFINED_1E,
288 * - BYPASS_UNDEFINED_1F,
289 * - BYPASS_GMRP,
290 * - BYPASS_GVRP,
291 * - BYPASS_UNDEF_GARP_22,
292 * - BYPASS_UNDEF_GARP_23,
293 * - BYPASS_UNDEF_GARP_24,
294 * - BYPASS_UNDEF_GARP_25,
295 * - BYPASS_UNDEF_GARP_26,
296 * - BYPASS_UNDEF_GARP_27,
297 * - BYPASS_UNDEF_GARP_28,
298 * - BYPASS_UNDEF_GARP_29,
299 * - BYPASS_UNDEF_GARP_2A,
300 * - BYPASS_UNDEF_GARP_2B,
301 * - BYPASS_UNDEF_GARP_2C,
302 * - BYPASS_UNDEF_GARP_2D,
303 * - BYPASS_UNDEF_GARP_2E,
304 * - BYPASS_UNDEF_GARP_2F,
305 * - BYPASS_IGMP.
306 */
307 extern rtk_api_ret_t rtk_storm_bypass_get(rtk_storm_bypass_t type, rtk_enable_t *pEnable);
308
309 /* Function Name:
310 * rtk_rate_stormControlExtPortmask_set
311 * Description:
312 * Set externsion storm control port mask
313 * Input:
314 * pPortmask - port mask
315 * Output:
316 * None
317 * Return:
318 * RT_ERR_OK
319 * RT_ERR_FAILED
320 * RT_ERR_NOT_INIT - The module is not initial
321 * RT_ERR_INPUT - invalid input parameter
322 * Note:
323 *
324 */
325 extern rtk_api_ret_t rtk_rate_stormControlExtPortmask_set(rtk_portmask_t *pPortmask);
326
327 /* Function Name:
328 * rtk_rate_stormControlExtPortmask_get
329 * Description:
330 * Set externsion storm control port mask
331 * Input:
332 * None
333 * Output:
334 * pPortmask - port mask
335 * Return:
336 * RT_ERR_OK
337 * RT_ERR_FAILED
338 * RT_ERR_NOT_INIT - The module is not initial
339 * RT_ERR_INPUT - invalid input parameter
340 * Note:
341 *
342 */
343 extern rtk_api_ret_t rtk_rate_stormControlExtPortmask_get(rtk_portmask_t *pPortmask);
344
345 /* Function Name:
346 * rtk_rate_stormControlExtEnable_set
347 * Description:
348 * Set externsion storm control state
349 * Input:
350 * stormType - storm group type
351 * enable - externsion storm control state
352 * Output:
353 * None
354 * Return:
355 * RT_ERR_OK
356 * RT_ERR_FAILED
357 * RT_ERR_NOT_INIT - The module is not initial
358 * RT_ERR_INPUT - invalid input parameter
359 * Note:
360 *
361 */
362 extern rtk_api_ret_t rtk_rate_stormControlExtEnable_set(rtk_rate_storm_group_t stormType, rtk_enable_t enable);
363
364 /* Function Name:
365 * rtk_rate_stormControlExtEnable_get
366 * Description:
367 * Get externsion storm control state
368 * Input:
369 * stormType - storm group type
370 * Output:
371 * pEnable - externsion storm control state
372 * Return:
373 * RT_ERR_OK
374 * RT_ERR_FAILED
375 * RT_ERR_NOT_INIT - The module is not initial
376 * RT_ERR_INPUT - invalid input parameter
377 * Note:
378 *
379 */
380 extern rtk_api_ret_t rtk_rate_stormControlExtEnable_get(rtk_rate_storm_group_t stormType, rtk_enable_t *pEnable);
381
382 /* Function Name:
383 * rtk_rate_stormControlExtMeterIdx_set
384 * Description:
385 * Set externsion storm control meter index
386 * Input:
387 * stormType - storm group type
388 * index - externsion storm control state
389 * Output:
390 * None
391 * Return:
392 * RT_ERR_OK
393 * RT_ERR_FAILED
394 * RT_ERR_NOT_INIT - The module is not initial
395 * RT_ERR_INPUT - invalid input parameter
396 * Note:
397 *
398 */
399 extern rtk_api_ret_t rtk_rate_stormControlExtMeterIdx_set(rtk_rate_storm_group_t stormType, rtk_uint32 index);
400
401 /* Function Name:
402 * rtk_rate_stormControlExtMeterIdx_get
403 * Description:
404 * Get externsion storm control meter index
405 * Input:
406 * stormType - storm group type
407 * pIndex - externsion storm control state
408 * Output:
409 * None
410 * Return:
411 * RT_ERR_OK
412 * RT_ERR_FAILED
413 * RT_ERR_NOT_INIT - The module is not initial
414 * RT_ERR_INPUT - invalid input parameter
415 * Note:
416 *
417 */
418 extern rtk_api_ret_t rtk_rate_stormControlExtMeterIdx_get(rtk_rate_storm_group_t stormType, rtk_uint32 *pIndex);
419
420
421
422 #endif /* __RTK_API_STORM_H__ */