mediatek: add support for rtl8367c
[openwrt/openwrt.git] / target / linux / mediatek / files-5.4 / drivers / net / phy / rtk / rtl8367c / include / vlan.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 Trap module high-layer VLAN defination
13 *
14 */
15
16 #ifndef __RTK_API_VLAN_H__
17 #define __RTK_API_VLAN_H__
18
19
20 /*
21 * Data Type Declaration
22 */
23 #define RTK_MAX_NUM_OF_PROTO_TYPE 0xFFFF
24 #define RTK_MAX_NUM_OF_MSTI 0xF
25 #define RTK_FID_MAX 0xF
26
27 typedef struct rtk_vlan_cfg_s
28 {
29 rtk_portmask_t mbr;
30 rtk_portmask_t untag;
31 rtk_uint16 ivl_en;
32 rtk_uint16 fid_msti;
33 rtk_uint16 envlanpol;
34 rtk_uint16 meteridx;
35 rtk_uint16 vbpen;
36 rtk_uint16 vbpri;
37 }rtk_vlan_cfg_t;
38
39 typedef struct rtk_vlan_mbrcfg_s
40 {
41 rtk_uint16 evid;
42 rtk_portmask_t mbr;
43 rtk_uint16 fid_msti;
44 rtk_uint16 envlanpol;
45 rtk_uint16 meteridx;
46 rtk_uint16 vbpen;
47 rtk_uint16 vbpri;
48 }rtk_vlan_mbrcfg_t;
49
50 typedef rtk_uint32 rtk_stp_msti_id_t; /* MSTI ID */
51
52 typedef enum rtk_stp_state_e
53 {
54 STP_STATE_DISABLED = 0,
55 STP_STATE_BLOCKING,
56 STP_STATE_LEARNING,
57 STP_STATE_FORWARDING,
58 STP_STATE_END
59 } rtk_stp_state_t;
60
61 typedef rtk_uint32 rtk_vlan_proto_type_t; /* protocol and port based VLAN protocol type */
62
63
64 typedef enum rtk_vlan_acceptFrameType_e
65 {
66 ACCEPT_FRAME_TYPE_ALL = 0, /* untagged, priority-tagged and tagged */
67 ACCEPT_FRAME_TYPE_TAG_ONLY, /* tagged */
68 ACCEPT_FRAME_TYPE_UNTAG_ONLY, /* untagged and priority-tagged */
69 ACCEPT_FRAME_TYPE_END
70 } rtk_vlan_acceptFrameType_t;
71
72
73 /* frame type of protocol vlan - reference 802.1v standard */
74 typedef enum rtk_vlan_protoVlan_frameType_e
75 {
76 FRAME_TYPE_ETHERNET = 0,
77 FRAME_TYPE_LLCOTHER,
78 FRAME_TYPE_RFC1042,
79 FRAME_TYPE_END
80 } rtk_vlan_protoVlan_frameType_t;
81
82 /* Protocol-and-port-based Vlan structure */
83 typedef struct rtk_vlan_protoAndPortInfo_s
84 {
85 rtk_uint32 proto_type;
86 rtk_vlan_protoVlan_frameType_t frame_type;
87 rtk_vlan_t cvid;
88 rtk_pri_t cpri;
89 }rtk_vlan_protoAndPortInfo_t;
90
91 /* tagged mode of VLAN - reference realtek private specification */
92 typedef enum rtk_vlan_tagMode_e
93 {
94 VLAN_TAG_MODE_ORIGINAL = 0,
95 VLAN_TAG_MODE_KEEP_FORMAT,
96 VLAN_TAG_MODE_PRI,
97 VLAN_TAG_MODE_REAL_KEEP_FORMAT,
98 VLAN_TAG_MODE_END
99 } rtk_vlan_tagMode_t;
100
101 typedef enum rtk_vlan_resVidAction_e
102 {
103 RESVID_ACTION_UNTAG = 0,
104 RESVID_ACTION_TAG,
105 RESVID_ACTION_END
106 }
107 rtk_vlan_resVidAction_t;
108
109 /* Function Name:
110 * rtk_vlan_init
111 * Description:
112 * Initialize VLAN.
113 * Input:
114 * None
115 * Output:
116 * None
117 * Return:
118 * RT_ERR_OK - OK
119 * RT_ERR_FAILED - Failed
120 * RT_ERR_SMI - SMI access error
121 * Note:
122 * VLAN is disabled by default. User has to call this API to enable VLAN before
123 * using it. And It will set a default VLAN(vid 1) including all ports and set
124 * all ports PVID to the default VLAN.
125 */
126 extern rtk_api_ret_t rtk_vlan_init(void);
127
128 /* Function Name:
129 * rtk_vlan_set
130 * Description:
131 * Set a VLAN entry.
132 * Input:
133 * vid - VLAN ID to configure.
134 * pVlanCfg - VLAN Configuration
135 * Output:
136 * None
137 * Return:
138 * RT_ERR_OK - OK
139 * RT_ERR_FAILED - Failed
140 * RT_ERR_SMI - SMI access error
141 * RT_ERR_INPUT - Invalid input parameters.
142 * RT_ERR_L2_FID - Invalid FID.
143 * RT_ERR_VLAN_PORT_MBR_EXIST - Invalid member port mask.
144 * RT_ERR_VLAN_VID - Invalid VID parameter.
145 * Note:
146 *
147 */
148 extern rtk_api_ret_t rtk_vlan_set(rtk_vlan_t vid, rtk_vlan_cfg_t *pVlanCfg);
149
150 /* Function Name:
151 * rtk_vlan_get
152 * Description:
153 * Get a VLAN entry.
154 * Input:
155 * vid - VLAN ID to configure.
156 * Output:
157 * pVlanCfg - VLAN Configuration
158 * Return:
159 * RT_ERR_OK - OK
160 * RT_ERR_FAILED - Failed
161 * RT_ERR_SMI - SMI access error
162 * RT_ERR_INPUT - Invalid input parameters.
163 * RT_ERR_VLAN_VID - Invalid VID parameter.
164 * Note:
165 *
166 */
167 extern rtk_api_ret_t rtk_vlan_get(rtk_vlan_t vid, rtk_vlan_cfg_t *pVlanCfg);
168
169 /* Function Name:
170 * rtk_vlan_egrFilterEnable_set
171 * Description:
172 * Set VLAN egress filter.
173 * Input:
174 * egrFilter - Egress filtering
175 * Output:
176 * None.
177 * Return:
178 * RT_ERR_OK - OK
179 * RT_ERR_FAILED - Failed
180 * RT_ERR_SMI - SMI access error
181 * RT_ERR_ENABLE - Invalid input parameters.
182 * Note:
183 *
184 */
185 extern rtk_api_ret_t rtk_vlan_egrFilterEnable_set(rtk_enable_t egrFilter);
186
187 /* Function Name:
188 * rtk_vlan_egrFilterEnable_get
189 * Description:
190 * Get VLAN egress filter.
191 * Input:
192 * pEgrFilter - Egress filtering
193 * Output:
194 * None.
195 * Return:
196 * RT_ERR_OK - OK
197 * RT_ERR_FAILED - Failed
198 * RT_ERR_SMI - SMI access error
199 * RT_ERR_NULL_POINTER - NULL Pointer.
200 * Note:
201 *
202 */
203 extern rtk_api_ret_t rtk_vlan_egrFilterEnable_get(rtk_enable_t *pEgrFilter);
204
205 /* Function Name:
206 * rtk_vlan_mbrCfg_set
207 * Description:
208 * Set a VLAN Member Configuration entry by index.
209 * Input:
210 * idx - Index of VLAN Member Configuration.
211 * pMbrcfg - VLAN member Configuration.
212 * Output:
213 * None.
214 * Return:
215 * RT_ERR_OK - OK
216 * RT_ERR_FAILED - Failed
217 * RT_ERR_SMI - SMI access error
218 * RT_ERR_INPUT - Invalid input parameters.
219 * RT_ERR_VLAN_VID - Invalid VID parameter.
220 * Note:
221 * Set a VLAN Member Configuration entry by index.
222 */
223 extern rtk_api_ret_t rtk_vlan_mbrCfg_set(rtk_uint32 idx, rtk_vlan_mbrcfg_t *pMbrcfg);
224
225 /* Function Name:
226 * rtk_vlan_mbrCfg_get
227 * Description:
228 * Get a VLAN Member Configuration entry by index.
229 * Input:
230 * idx - Index of VLAN Member Configuration.
231 * Output:
232 * pMbrcfg - VLAN member Configuration.
233 * Return:
234 * RT_ERR_OK - OK
235 * RT_ERR_FAILED - Failed
236 * RT_ERR_SMI - SMI access error
237 * RT_ERR_INPUT - Invalid input parameters.
238 * RT_ERR_VLAN_VID - Invalid VID parameter.
239 * Note:
240 * Get a VLAN Member Configuration entry by index.
241 */
242 extern rtk_api_ret_t rtk_vlan_mbrCfg_get(rtk_uint32 idx, rtk_vlan_mbrcfg_t *pMbrcfg);
243
244 /* Function Name:
245 * rtk_vlan_portPvid_set
246 * Description:
247 * Set port to specified VLAN ID(PVID).
248 * Input:
249 * port - Port id.
250 * pvid - Specified VLAN ID.
251 * priority - 802.1p priority for the PVID.
252 * Output:
253 * None
254 * Return:
255 * RT_ERR_OK - OK
256 * RT_ERR_FAILED - Failed
257 * RT_ERR_SMI - SMI access error
258 * RT_ERR_PORT_ID - Invalid port number.
259 * RT_ERR_VLAN_PRIORITY - Invalid priority.
260 * RT_ERR_VLAN_ENTRY_NOT_FOUND - VLAN entry not found.
261 * RT_ERR_VLAN_VID - Invalid VID parameter.
262 * Note:
263 * The API is used for Port-based VLAN. The untagged frame received from the
264 * port will be classified to the specified VLAN and assigned to the specified priority.
265 */
266 extern rtk_api_ret_t rtk_vlan_portPvid_set(rtk_port_t port, rtk_vlan_t pvid, rtk_pri_t priority);
267
268 /* Function Name:
269 * rtk_vlan_portPvid_get
270 * Description:
271 * Get VLAN ID(PVID) on specified port.
272 * Input:
273 * port - Port id.
274 * Output:
275 * pPvid - Specified VLAN ID.
276 * pPriority - 802.1p priority for the PVID.
277 * Return:
278 * RT_ERR_OK - OK
279 * RT_ERR_FAILED - Failed
280 * RT_ERR_SMI - SMI access error
281 * RT_ERR_INPUT - Invalid input parameters.
282 * RT_ERR_PORT_ID - Invalid port number.
283 * Note:
284 * The API can get the PVID and 802.1p priority for the PVID of Port-based VLAN.
285 */
286 extern rtk_api_ret_t rtk_vlan_portPvid_get(rtk_port_t port, rtk_vlan_t *pPvid, rtk_pri_t *pPriority);
287
288 /* Function Name:
289 * rtk_vlan_portIgrFilterEnable_set
290 * Description:
291 * Set VLAN ingress for each port.
292 * Input:
293 * port - Port id.
294 * igr_filter - VLAN ingress function enable status.
295 * Output:
296 * None
297 * Return:
298 * RT_ERR_OK - OK
299 * RT_ERR_FAILED - Failed
300 * RT_ERR_SMI - SMI access error
301 * RT_ERR_PORT_ID - Invalid port number
302 * RT_ERR_ENABLE - Invalid enable input
303 * Note:
304 * The status of vlan ingress filter is as following:
305 * - DISABLED
306 * - ENABLED
307 * While VLAN function is enabled, ASIC will decide VLAN ID for each received frame and get belonged member
308 * ports from VLAN table. If received port is not belonged to VLAN member ports, ASIC will drop received frame if VLAN ingress function is enabled.
309 */
310 extern rtk_api_ret_t rtk_vlan_portIgrFilterEnable_set(rtk_port_t port, rtk_enable_t igr_filter);
311
312 /* Function Name:
313 * rtk_vlan_portIgrFilterEnable_get
314 * Description:
315 * Get VLAN Ingress Filter
316 * Input:
317 * port - Port id.
318 * Output:
319 * pIgr_filter - VLAN ingress function enable status.
320 * Return:
321 * RT_ERR_OK - OK
322 * RT_ERR_FAILED - Failed
323 * RT_ERR_SMI - SMI access error
324 * RT_ERR_INPUT - Invalid input parameters.
325 * RT_ERR_PORT_ID - Invalid port number.
326 * Note:
327 * The API can Get the VLAN ingress filter status.
328 * The status of vlan ingress filter is as following:
329 * - DISABLED
330 * - ENABLED
331 */
332 extern rtk_api_ret_t rtk_vlan_portIgrFilterEnable_get(rtk_port_t port, rtk_enable_t *pIgr_filter);
333
334 /* Function Name:
335 * rtk_vlan_portAcceptFrameType_set
336 * Description:
337 * Set VLAN accept_frame_type
338 * Input:
339 * port - Port id.
340 * accept_frame_type - accept frame type
341 * Output:
342 * None
343 * Return:
344 * RT_ERR_OK - OK
345 * RT_ERR_FAILED - Failed
346 * RT_ERR_SMI - SMI access error
347 * RT_ERR_PORT_ID - Invalid port number.
348 * RT_ERR_VLAN_ACCEPT_FRAME_TYPE - Invalid frame type.
349 * Note:
350 * The API is used for checking 802.1Q tagged frames.
351 * The accept frame type as following:
352 * - ACCEPT_FRAME_TYPE_ALL
353 * - ACCEPT_FRAME_TYPE_TAG_ONLY
354 * - ACCEPT_FRAME_TYPE_UNTAG_ONLY
355 */
356 extern rtk_api_ret_t rtk_vlan_portAcceptFrameType_set(rtk_port_t port, rtk_vlan_acceptFrameType_t accept_frame_type);
357
358 /* Function Name:
359 * rtk_vlan_portAcceptFrameType_get
360 * Description:
361 * Get VLAN accept_frame_type
362 * Input:
363 * port - Port id.
364 * Output:
365 * pAccept_frame_type - accept frame type
366 * Return:
367 * RT_ERR_OK - OK
368 * RT_ERR_FAILED - Failed
369 * RT_ERR_SMI - SMI access error
370 * RT_ERR_INPUT - Invalid input parameters.
371 * RT_ERR_PORT_ID - Invalid port number.
372 * Note:
373 * The API can Get the VLAN ingress filter.
374 * The accept frame type as following:
375 * - ACCEPT_FRAME_TYPE_ALL
376 * - ACCEPT_FRAME_TYPE_TAG_ONLY
377 * - ACCEPT_FRAME_TYPE_UNTAG_ONLY
378 */
379 extern rtk_api_ret_t rtk_vlan_portAcceptFrameType_get(rtk_port_t port, rtk_vlan_acceptFrameType_t *pAccept_frame_type);
380
381 /* Function Name:
382 * rtk_vlan_tagMode_set
383 * Description:
384 * Set CVLAN egress tag mode
385 * Input:
386 * port - Port id.
387 * tag_mode - The egress tag mode.
388 * Output:
389 * None
390 * Return:
391 * RT_ERR_OK - OK
392 * RT_ERR_FAILED - Failed
393 * RT_ERR_SMI - SMI access error
394 * RT_ERR_PORT_ID - Invalid port number.
395 * RT_ERR_INPUT - Invalid input parameter.
396 * RT_ERR_ENABLE - Invalid enable input.
397 * Note:
398 * The API can set Egress tag mode. There are 4 mode for egress tag:
399 * - VLAN_TAG_MODE_ORIGINAL,
400 * - VLAN_TAG_MODE_KEEP_FORMAT,
401 * - VLAN_TAG_MODE_PRI.
402 * - VLAN_TAG_MODE_REAL_KEEP_FORMAT,
403 */
404 extern rtk_api_ret_t rtk_vlan_tagMode_set(rtk_port_t port, rtk_vlan_tagMode_t tag_mode);
405
406 /* Function Name:
407 * rtk_vlan_tagMode_get
408 * Description:
409 * Get CVLAN egress tag mode
410 * Input:
411 * port - Port id.
412 * Output:
413 * pTag_mode - The egress tag mode.
414 * Return:
415 * RT_ERR_OK - OK
416 * RT_ERR_FAILED - Failed
417 * RT_ERR_SMI - SMI access error
418 * RT_ERR_INPUT - Invalid input parameters.
419 * RT_ERR_PORT_ID - Invalid port number.
420 * Note:
421 * The API can get Egress tag mode. There are 4 mode for egress tag:
422 * - VLAN_TAG_MODE_ORIGINAL,
423 * - VLAN_TAG_MODE_KEEP_FORMAT,
424 * - VLAN_TAG_MODE_PRI.
425 * - VLAN_TAG_MODE_REAL_KEEP_FORMAT,
426 */
427 extern rtk_api_ret_t rtk_vlan_tagMode_get(rtk_port_t port, rtk_vlan_tagMode_t *pTag_mode);
428
429 /* Function Name:
430 * rtk_vlan_transparent_set
431 * Description:
432 * Set VLAN transparent mode
433 * Input:
434 * egr_port - Egress Port id.
435 * pIgr_pmask - Ingress Port Mask.
436 * Output:
437 * None.
438 * Return:
439 * RT_ERR_OK - OK
440 * RT_ERR_FAILED - Failed
441 * RT_ERR_SMI - SMI access error
442 * RT_ERR_INPUT - Invalid input parameters.
443 * RT_ERR_PORT_ID - Invalid port number.
444 * Note:
445 * None.
446 */
447 extern rtk_api_ret_t rtk_vlan_transparent_set(rtk_port_t egr_port, rtk_portmask_t *pIgr_pmask);
448
449 /* Function Name:
450 * rtk_vlan_transparent_get
451 * Description:
452 * Get VLAN transparent mode
453 * Input:
454 * egr_port - Egress Port id.
455 * Output:
456 * pIgr_pmask - Ingress Port Mask
457 * Return:
458 * RT_ERR_OK - OK
459 * RT_ERR_FAILED - Failed
460 * RT_ERR_SMI - SMI access error
461 * RT_ERR_INPUT - Invalid input parameters.
462 * RT_ERR_PORT_ID - Invalid port number.
463 * Note:
464 * None.
465 */
466 extern rtk_api_ret_t rtk_vlan_transparent_get(rtk_port_t egr_port, rtk_portmask_t *pIgr_pmask);
467
468 /* Function Name:
469 * rtk_vlan_keep_set
470 * Description:
471 * Set VLAN egress keep mode
472 * Input:
473 * egr_port - Egress Port id.
474 * pIgr_pmask - Ingress Port Mask.
475 * Output:
476 * None.
477 * Return:
478 * RT_ERR_OK - OK
479 * RT_ERR_FAILED - Failed
480 * RT_ERR_SMI - SMI access error
481 * RT_ERR_INPUT - Invalid input parameters.
482 * RT_ERR_PORT_ID - Invalid port number.
483 * Note:
484 * None.
485 */
486 extern rtk_api_ret_t rtk_vlan_keep_set(rtk_port_t egr_port, rtk_portmask_t *pIgr_pmask);
487
488 /* Function Name:
489 * rtk_vlan_keep_get
490 * Description:
491 * Get VLAN egress keep mode
492 * Input:
493 * egr_port - Egress Port id.
494 * Output:
495 * pIgr_pmask - Ingress Port Mask
496 * Return:
497 * RT_ERR_OK - OK
498 * RT_ERR_FAILED - Failed
499 * RT_ERR_SMI - SMI access error
500 * RT_ERR_INPUT - Invalid input parameters.
501 * RT_ERR_PORT_ID - Invalid port number.
502 * Note:
503 * None.
504 */
505 extern rtk_api_ret_t rtk_vlan_keep_get(rtk_port_t egr_port, rtk_portmask_t *pIgr_pmask);
506
507 /* Function Name:
508 * rtk_vlan_stg_set
509 * Description:
510 * Set spanning tree group instance of the vlan to the specified device
511 * Input:
512 * vid - Specified VLAN ID.
513 * stg - spanning tree group instance.
514 * Output:
515 * None
516 * Return:
517 * RT_ERR_OK - OK
518 * RT_ERR_FAILED - Failed
519 * RT_ERR_SMI - SMI access error
520 * RT_ERR_MSTI - Invalid msti parameter
521 * RT_ERR_INPUT - Invalid input parameter.
522 * RT_ERR_VLAN_VID - Invalid VID parameter.
523 * Note:
524 * The API can set spanning tree group instance of the vlan to the specified device.
525 */
526 extern rtk_api_ret_t rtk_vlan_stg_set(rtk_vlan_t vid, rtk_stp_msti_id_t stg);
527
528 /* Function Name:
529 * rtk_vlan_stg_get
530 * Description:
531 * Get spanning tree group instance of the vlan to the specified device
532 * Input:
533 * vid - Specified VLAN ID.
534 * Output:
535 * pStg - spanning tree group instance.
536 * Return:
537 * RT_ERR_OK - OK
538 * RT_ERR_FAILED - Failed
539 * RT_ERR_SMI - SMI access error
540 * RT_ERR_INPUT - Invalid input parameters.
541 * RT_ERR_VLAN_VID - Invalid VID parameter.
542 * Note:
543 * The API can get spanning tree group instance of the vlan to the specified device.
544 */
545 extern rtk_api_ret_t rtk_vlan_stg_get(rtk_vlan_t vid, rtk_stp_msti_id_t *pStg);
546
547 /* Function Name:
548 * rtk_vlan_protoAndPortBasedVlan_add
549 * Description:
550 * Add the protocol-and-port-based vlan to the specified port of device.
551 * Input:
552 * port - Port id.
553 * pInfo - Protocol and port based VLAN configuration information.
554 * Output:
555 * None
556 * Return:
557 * RT_ERR_OK - OK
558 * RT_ERR_FAILED - Failed
559 * RT_ERR_SMI - SMI access error
560 * RT_ERR_PORT_ID - Invalid port number.
561 * RT_ERR_VLAN_VID - Invalid VID parameter.
562 * RT_ERR_VLAN_PRIORITY - Invalid priority.
563 * RT_ERR_TBL_FULL - Table is full.
564 * RT_ERR_OUT_OF_RANGE - input out of range.
565 * Note:
566 * The incoming packet which match the protocol-and-port-based vlan will use the configure vid for ingress pipeline
567 * The frame type is shown in the following:
568 * - FRAME_TYPE_ETHERNET
569 * - FRAME_TYPE_RFC1042
570 * - FRAME_TYPE_LLCOTHER
571 */
572 extern rtk_api_ret_t rtk_vlan_protoAndPortBasedVlan_add(rtk_port_t port, rtk_vlan_protoAndPortInfo_t *pInfo);
573
574 /* Function Name:
575 * rtk_vlan_protoAndPortBasedVlan_get
576 * Description:
577 * Get the protocol-and-port-based vlan to the specified port of device.
578 * Input:
579 * port - Port id.
580 * proto_type - protocol-and-port-based vlan protocol type.
581 * frame_type - protocol-and-port-based vlan frame type.
582 * Output:
583 * pInfo - Protocol and port based VLAN configuration information.
584 * Return:
585 * RT_ERR_OK - OK
586 * RT_ERR_FAILED - Failed
587 * RT_ERR_SMI - SMI access error
588 * RT_ERR_PORT_ID - Invalid port number.
589 * RT_ERR_OUT_OF_RANGE - input out of range.
590 * RT_ERR_TBL_FULL - Table is full.
591 * Note:
592 * The incoming packet which match the protocol-and-port-based vlan will use the configure vid for ingress pipeline
593 * The frame type is shown in the following:
594 * - FRAME_TYPE_ETHERNET
595 * - FRAME_TYPE_RFC1042
596 * - FRAME_TYPE_LLCOTHER
597 */
598 extern rtk_api_ret_t rtk_vlan_protoAndPortBasedVlan_get(rtk_port_t port, rtk_vlan_proto_type_t proto_type, rtk_vlan_protoVlan_frameType_t frame_type, rtk_vlan_protoAndPortInfo_t *pInfo);
599
600 /* Function Name:
601 * rtk_vlan_protoAndPortBasedVlan_del
602 * Description:
603 * Delete the protocol-and-port-based vlan from the specified port of device.
604 * Input:
605 * port - Port id.
606 * proto_type - protocol-and-port-based vlan protocol type.
607 * frame_type - protocol-and-port-based vlan frame type.
608 * Output:
609 * None
610 * Return:
611 * RT_ERR_OK - OK
612 * RT_ERR_FAILED - Failed
613 * RT_ERR_SMI - SMI access error
614 * RT_ERR_PORT_ID - Invalid port number.
615 * RT_ERR_OUT_OF_RANGE - input out of range.
616 * RT_ERR_TBL_FULL - Table is full.
617 * Note:
618 * The incoming packet which match the protocol-and-port-based vlan will use the configure vid for ingress pipeline
619 * The frame type is shown in the following:
620 * - FRAME_TYPE_ETHERNET
621 * - FRAME_TYPE_RFC1042
622 * - FRAME_TYPE_LLCOTHER
623 */
624 extern rtk_api_ret_t rtk_vlan_protoAndPortBasedVlan_del(rtk_port_t port, rtk_vlan_proto_type_t proto_type, rtk_vlan_protoVlan_frameType_t frame_type);
625
626 /* Function Name:
627 * rtk_vlan_protoAndPortBasedVlan_delAll
628 * Description:
629 * Delete all protocol-and-port-based vlans from the specified port of device.
630 * Input:
631 * port - Port id.
632 * Output:
633 * None
634 * Return:
635 * RT_ERR_OK - OK
636 * RT_ERR_FAILED - Failed
637 * RT_ERR_SMI - SMI access error
638 * RT_ERR_PORT_ID - Invalid port number.
639 * RT_ERR_OUT_OF_RANGE - input out of range.
640 * Note:
641 * The incoming packet which match the protocol-and-port-based vlan will use the configure vid for ingress pipeline
642 * Delete all flow table protocol-and-port-based vlan entries.
643 */
644 extern rtk_api_ret_t rtk_vlan_protoAndPortBasedVlan_delAll(rtk_port_t port);
645
646 /* Function Name:
647 * rtk_vlan_portFid_set
648 * Description:
649 * Set port-based filtering database
650 * Input:
651 * port - Port id.
652 * enable - ebable port-based FID
653 * fid - Specified filtering database.
654 * Output:
655 * None
656 * Return:
657 * RT_ERR_OK - OK
658 * RT_ERR_FAILED - Failed
659 * RT_ERR_SMI - SMI access error
660 * RT_ERR_L2_FID - Invalid fid.
661 * RT_ERR_INPUT - Invalid input parameter.
662 * RT_ERR_PORT_ID - Invalid port ID.
663 * Note:
664 * The API can set port-based filtering database. If the function is enabled, all input
665 * packets will be assigned to the port-based fid regardless vlan tag.
666 */
667 extern rtk_api_ret_t rtk_vlan_portFid_set(rtk_port_t port, rtk_enable_t enable, rtk_fid_t fid);
668
669 /* Function Name:
670 * rtk_vlan_portFid_get
671 * Description:
672 * Get port-based filtering database
673 * Input:
674 * port - Port id.
675 * Output:
676 * pEnable - ebable port-based FID
677 * pFid - Specified filtering database.
678 * Return:
679 * RT_ERR_OK - OK
680 * RT_ERR_FAILED - Failed
681 * RT_ERR_SMI - SMI access error
682 * RT_ERR_INPUT - Invalid input parameters.
683 * RT_ERR_PORT_ID - Invalid port ID.
684 * Note:
685 * The API can get port-based filtering database status. If the function is enabled, all input
686 * packets will be assigned to the port-based fid regardless vlan tag.
687 */
688 extern rtk_api_ret_t rtk_vlan_portFid_get(rtk_port_t port, rtk_enable_t *pEnable, rtk_fid_t *pFid);
689
690 /* Function Name:
691 * rtk_vlan_UntagDscpPriorityEnable_set
692 * Description:
693 * Set Untag DSCP priority assign
694 * Input:
695 * enable - state of Untag DSCP priority assign
696 * Output:
697 * None
698 * Return:
699 * RT_ERR_OK - OK
700 * RT_ERR_FAILED - Failed
701 * RT_ERR_SMI - SMI access error
702 * RT_ERR_ENABLE - Invalid input parameters.
703 * Note:
704 *
705 */
706 extern rtk_api_ret_t rtk_vlan_UntagDscpPriorityEnable_set(rtk_enable_t enable);
707
708 /* Function Name:
709 * rtk_vlan_UntagDscpPriorityEnable_get
710 * Description:
711 * Get Untag DSCP priority assign
712 * Input:
713 * None
714 * Output:
715 * pEnable - state of Untag DSCP priority assign
716 * Return:
717 * RT_ERR_OK - OK
718 * RT_ERR_FAILED - Failed
719 * RT_ERR_SMI - SMI access error
720 * RT_ERR_NULL_POINTER - Null pointer
721 * Note:
722 *
723 */
724 extern rtk_api_ret_t rtk_vlan_UntagDscpPriorityEnable_get(rtk_enable_t *pEnable);
725
726
727 /*Spanning Tree*/
728 /* Function Name:
729 * rtk_stp_mstpState_set
730 * Description:
731 * Configure spanning tree state per each port.
732 * Input:
733 * port - Port id
734 * msti - Multiple spanning tree instance.
735 * stp_state - Spanning tree state for msti
736 * Output:
737 * None
738 * Return:
739 * RT_ERR_OK - OK
740 * RT_ERR_FAILED - Failed
741 * RT_ERR_SMI - SMI access error
742 * RT_ERR_PORT_ID - Invalid port number.
743 * RT_ERR_MSTI - Invalid msti parameter.
744 * RT_ERR_MSTP_STATE - Invalid STP state.
745 * Note:
746 * System supports per-port multiple spanning tree state for each msti.
747 * There are four states supported by ASIC.
748 * - STP_STATE_DISABLED
749 * - STP_STATE_BLOCKING
750 * - STP_STATE_LEARNING
751 * - STP_STATE_FORWARDING
752 */
753 extern rtk_api_ret_t rtk_stp_mstpState_set(rtk_stp_msti_id_t msti, rtk_port_t port, rtk_stp_state_t stp_state);
754
755 /* Function Name:
756 * rtk_stp_mstpState_get
757 * Description:
758 * Get spanning tree state per each port.
759 * Input:
760 * port - Port id.
761 * msti - Multiple spanning tree instance.
762 * Output:
763 * pStp_state - Spanning tree state for msti
764 * Return:
765 * RT_ERR_OK - OK
766 * RT_ERR_FAILED - Failed
767 * RT_ERR_SMI - SMI access error
768 * RT_ERR_PORT_ID - Invalid port number.
769 * RT_ERR_MSTI - Invalid msti parameter.
770 * Note:
771 * System supports per-port multiple spanning tree state for each msti.
772 * There are four states supported by ASIC.
773 * - STP_STATE_DISABLED
774 * - STP_STATE_BLOCKING
775 * - STP_STATE_LEARNING
776 * - STP_STATE_FORWARDING
777 */
778 extern rtk_api_ret_t rtk_stp_mstpState_get(rtk_stp_msti_id_t msti, rtk_port_t port, rtk_stp_state_t *pStp_state);
779
780 /* Function Name:
781 * rtk_vlan_checkAndCreateMbr
782 * Description:
783 * Check and create Member configuration and return index
784 * Input:
785 * vid - VLAN id.
786 * Output:
787 * pIndex - Member configuration index
788 * Return:
789 * RT_ERR_OK - OK
790 * RT_ERR_FAILED - Failed
791 * RT_ERR_SMI - SMI access error
792 * RT_ERR_VLAN_VID - Invalid VLAN ID.
793 * RT_ERR_VLAN_ENTRY_NOT_FOUND - VLAN not found
794 * RT_ERR_TBL_FULL - Member Configuration table full
795 * Note:
796 *
797 */
798 extern rtk_api_ret_t rtk_vlan_checkAndCreateMbr(rtk_vlan_t vid, rtk_uint32 *pIndex);
799
800 /* Function Name:
801 * rtk_vlan_reservedVidAction_set
802 * Description:
803 * Set Action of VLAN ID = 0 & 4095 tagged packet
804 * Input:
805 * action_vid0 - Action for VID 0.
806 * action_vid4095 - Action for VID 4095.
807 * Output:
808 * None.
809 * Return:
810 * RT_ERR_OK - OK
811 * RT_ERR_FAILED - Failed
812 * RT_ERR_SMI - SMI access error
813 * RT_ERR_INPUT - Error Input
814 * Note:
815 *
816 */
817 extern rtk_api_ret_t rtk_vlan_reservedVidAction_set(rtk_vlan_resVidAction_t action_vid0, rtk_vlan_resVidAction_t action_vid4095);
818
819 /* Function Name:
820 * rtk_vlan_reservedVidAction_get
821 * Description:
822 * Get Action of VLAN ID = 0 & 4095 tagged packet
823 * Input:
824 * pAction_vid0 - Action for VID 0.
825 * pAction_vid4095 - Action for VID 4095.
826 * Output:
827 * None.
828 * Return:
829 * RT_ERR_OK - OK
830 * RT_ERR_FAILED - Failed
831 * RT_ERR_SMI - SMI access error
832 * RT_ERR_NULL_POINTER - NULL Pointer
833 * Note:
834 *
835 */
836 extern rtk_api_ret_t rtk_vlan_reservedVidAction_get(rtk_vlan_resVidAction_t *pAction_vid0, rtk_vlan_resVidAction_t *pAction_vid4095);
837
838 /* Function Name:
839 * rtk_vlan_realKeepRemarkEnable_set
840 * Description:
841 * Set Real keep 1p remarking feature
842 * Input:
843 * enabled - State of 1p remarking at real keep packet
844 * Output:
845 * None.
846 * Return:
847 * RT_ERR_OK - OK
848 * RT_ERR_FAILED - Failed
849 * RT_ERR_SMI - SMI access error
850 * RT_ERR_INPUT - Error Input
851 * Note:
852 *
853 */
854 extern rtk_api_ret_t rtk_vlan_realKeepRemarkEnable_set(rtk_enable_t enabled);
855
856 /* Function Name:
857 * rtk_vlan_realKeepRemarkEnable_get
858 * Description:
859 * Get Real keep 1p remarking feature
860 * Input:
861 * None.
862 * Output:
863 * pEnabled - State of 1p remarking at real keep packet
864 * Return:
865 * RT_ERR_OK - OK
866 * RT_ERR_FAILED - Failed
867 * RT_ERR_SMI - SMI access error
868 * RT_ERR_INPUT - Error Input
869 * Note:
870 *
871 */
872 extern rtk_api_ret_t rtk_vlan_realKeepRemarkEnable_get(rtk_enable_t *pEnabled);
873
874 /* Function Name:
875 * rtk_vlan_reset
876 * Description:
877 * Reset VLAN
878 * Input:
879 * None.
880 * Output:
881 * pEnabled - State of 1p remarking at real keep packet
882 * Return:
883 * RT_ERR_OK - OK
884 * RT_ERR_FAILED - Failed
885 * RT_ERR_SMI - SMI access error
886 * RT_ERR_INPUT - Error Input
887 * Note:
888 *
889 */
890 rtk_api_ret_t rtk_vlan_reset(void);
891
892 #endif /* __RTK_API_VLAN_H__ */