mediatek: mt7622: add Linux 5.10 support
[openwrt/staging/rmilecki.git] / target / linux / mediatek / files-5.10 / drivers / net / phy / rtk / rtl8367c / include / svlan.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 SVLAN module high-layer API defination
13 *
14 */
15
16 #ifndef __RTK_API_SVLAN_H__
17 #define __RTK_API_SVLAN_H__
18
19 typedef rtk_uint32 rtk_svlan_index_t;
20
21 typedef struct rtk_svlan_memberCfg_s{
22 rtk_uint32 svid;
23 rtk_portmask_t memberport;
24 rtk_portmask_t untagport;
25 rtk_uint32 fiden;
26 rtk_uint32 fid;
27 rtk_uint32 priority;
28 rtk_uint32 efiden;
29 rtk_uint32 efid;
30 }rtk_svlan_memberCfg_t;
31
32 typedef enum rtk_svlan_pri_ref_e
33 {
34 REF_INTERNAL_PRI = 0,
35 REF_CTAG_PRI,
36 REF_SVLAN_PRI,
37 REF_PB_PRI,
38 REF_PRI_END
39 } rtk_svlan_pri_ref_t;
40
41
42 typedef rtk_uint32 rtk_svlan_tpid_t;
43
44 typedef enum rtk_svlan_untag_action_e
45 {
46 UNTAG_DROP = 0,
47 UNTAG_TRAP,
48 UNTAG_ASSIGN,
49 UNTAG_END
50 } rtk_svlan_untag_action_t;
51
52 typedef enum rtk_svlan_unmatch_action_e
53 {
54 UNMATCH_DROP = 0,
55 UNMATCH_TRAP,
56 UNMATCH_ASSIGN,
57 UNMATCH_END
58 } rtk_svlan_unmatch_action_t;
59
60 typedef enum rtk_svlan_unassign_action_e
61 {
62 UNASSIGN_PBSVID = 0,
63 UNASSIGN_TRAP,
64 UNASSIGN_END
65 } rtk_svlan_unassign_action_t;
66
67
68 typedef enum rtk_svlan_lookupType_e
69 {
70 SVLAN_LOOKUP_S64MBRCGF = 0,
71 SVLAN_LOOKUP_C4KVLAN,
72 SVLAN_LOOKUP_END,
73
74 } rtk_svlan_lookupType_t;
75
76 /* Function Name:
77 * rtk_svlan_init
78 * Description:
79 * Initialize SVLAN Configuration
80 * Input:
81 * None
82 * Output:
83 * None
84 * Return:
85 * RT_ERR_OK - OK
86 * RT_ERR_FAILED - Failed
87 * RT_ERR_SMI - SMI access error
88 * Note:
89 * Ether type of S-tag in 802.1ad is 0x88a8 and there are existed ether type 0x9100 and 0x9200 for Q-in-Q SLAN design.
90 * User can set mathced ether type as service provider supported protocol.
91 */
92 extern rtk_api_ret_t rtk_svlan_init(void);
93
94 /* Function Name:
95 * rtk_svlan_servicePort_add
96 * Description:
97 * Add one service port in the specified device
98 * Input:
99 * port - Port id.
100 * Output:
101 * None
102 * Return:
103 * RT_ERR_OK - OK
104 * RT_ERR_FAILED - Failed
105 * RT_ERR_SMI - SMI access error
106 * RT_ERR_PORT_ID - Invalid port number.
107 * RT_ERR_INPUT - Invalid input parameters.
108 * Note:
109 * This API is setting which port is connected to provider switch. All frames receiving from this port must
110 * contain accept SVID in S-tag field.
111 */
112 extern rtk_api_ret_t rtk_svlan_servicePort_add(rtk_port_t port);
113
114 /* Function Name:
115 * rtk_svlan_servicePort_get
116 * Description:
117 * Get service ports in the specified device.
118 * Input:
119 * None
120 * Output:
121 * pSvlan_portmask - pointer buffer of svlan ports.
122 * Return:
123 * RT_ERR_OK - OK
124 * RT_ERR_FAILED - Failed
125 * RT_ERR_SMI - SMI access error
126 * Note:
127 * This API is setting which port is connected to provider switch. All frames receiving from this port must
128 * contain accept SVID in S-tag field.
129 */
130 extern rtk_api_ret_t rtk_svlan_servicePort_get(rtk_portmask_t *pSvlan_portmask);
131
132 /* Function Name:
133 * rtk_svlan_servicePort_del
134 * Description:
135 * Delete one service port in the specified device
136 * Input:
137 * port - Port id.
138 * Output:
139 * None
140 * Return:
141 * RT_ERR_OK - OK
142 * RT_ERR_FAILED - Failed
143 * RT_ERR_SMI - SMI access error
144 * RT_ERR_PORT_ID - Invalid port number.
145 * Note:
146 * This API is removing SVLAN service port in the specified device.
147 */
148 extern rtk_api_ret_t rtk_svlan_servicePort_del(rtk_port_t port);
149
150 /* Function Name:
151 * rtk_svlan_tpidEntry_set
152 * Description:
153 * Configure accepted S-VLAN ether type.
154 * Input:
155 * svlan_tag_id - Ether type of S-tag frame parsing in uplink ports.
156 * Output:
157 * None
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 parameter.
163 * Note:
164 * Ether type of S-tag in 802.1ad is 0x88a8 and there are existed ether type 0x9100 and 0x9200 for Q-in-Q SLAN design.
165 * User can set mathced ether type as service provider supported protocol.
166 */
167 extern rtk_api_ret_t rtk_svlan_tpidEntry_set(rtk_uint32 svlan_tag_id);
168
169 /* Function Name:
170 * rtk_svlan_tpidEntry_get
171 * Description:
172 * Get accepted S-VLAN ether type setting.
173 * Input:
174 * None
175 * Output:
176 * pSvlan_tag_id - Ether type of S-tag frame parsing in uplink ports.
177 * Return:
178 * RT_ERR_OK - OK
179 * RT_ERR_FAILED - Failed
180 * RT_ERR_SMI - SMI access error
181 * Note:
182 * This API is setting which port is connected to provider switch. All frames receiving from this port must
183 * contain accept SVID in S-tag field.
184 */
185 extern rtk_api_ret_t rtk_svlan_tpidEntry_get(rtk_uint32 *pSvlan_tag_id);
186
187 /* Function Name:
188 * rtk_svlan_priorityRef_set
189 * Description:
190 * Set S-VLAN upstream priority reference setting.
191 * Input:
192 * ref - reference selection parameter.
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_INPUT - Invalid input parameter.
200 * Note:
201 * The API can set the upstream SVLAN tag priority reference source. The related priority
202 * sources are as following:
203 * - REF_INTERNAL_PRI,
204 * - REF_CTAG_PRI,
205 * - REF_SVLAN_PRI,
206 * - REF_PB_PRI.
207 */
208 extern rtk_api_ret_t rtk_svlan_priorityRef_set(rtk_svlan_pri_ref_t ref);
209
210 /* Function Name:
211 * rtk_svlan_priorityRef_get
212 * Description:
213 * Get S-VLAN upstream priority reference setting.
214 * Input:
215 * None
216 * Output:
217 * pRef - reference selection parameter.
218 * Return:
219 * RT_ERR_OK - OK
220 * RT_ERR_FAILED - Failed
221 * RT_ERR_SMI - SMI access error
222 * Note:
223 * The API can get the upstream SVLAN tag priority reference source. The related priority
224 * sources are as following:
225 * - REF_INTERNAL_PRI,
226 * - REF_CTAG_PRI,
227 * - REF_SVLAN_PRI,
228 * - REF_PB_PRI
229 */
230 extern rtk_api_ret_t rtk_svlan_priorityRef_get(rtk_svlan_pri_ref_t *pRef);
231
232 /* Function Name:
233 * rtk_svlan_memberPortEntry_set
234 * Description:
235 * Configure system SVLAN member content
236 * Input:
237 * svid - SVLAN id
238 * psvlan_cfg - SVLAN member configuration
239 * Output:
240 * None
241 * Return:
242 * RT_ERR_OK - OK
243 * RT_ERR_FAILED - Failed
244 * RT_ERR_SMI - SMI access error
245 * RT_ERR_INPUT - Invalid input parameter.
246 * RT_ERR_SVLAN_VID - Invalid SVLAN VID parameter.
247 * RT_ERR_PORT_MASK - Invalid portmask.
248 * RT_ERR_SVLAN_TABLE_FULL - SVLAN configuration is full.
249 * Note:
250 * The API can set system 64 accepted s-tag frame format. Only 64 SVID S-tag frame will be accpeted
251 * to receiving from uplink ports. Other SVID S-tag frame or S-untagged frame will be droped by default setup.
252 * - rtk_svlan_memberCfg_t->svid is SVID of SVLAN member configuration.
253 * - rtk_svlan_memberCfg_t->memberport is member port mask of SVLAN member configuration.
254 * - rtk_svlan_memberCfg_t->fid is filtering database of SVLAN member configuration.
255 * - rtk_svlan_memberCfg_t->priority is priority of SVLAN member configuration.
256 */
257 extern rtk_api_ret_t rtk_svlan_memberPortEntry_set(rtk_uint32 svid_idx, rtk_svlan_memberCfg_t *psvlan_cfg);
258
259 /* Function Name:
260 * rtk_svlan_memberPortEntry_get
261 * Description:
262 * Get SVLAN member Configure.
263 * Input:
264 * svid - SVLAN id
265 * Output:
266 * pSvlan_cfg - SVLAN member configuration
267 * Return:
268 * RT_ERR_OK - OK
269 * RT_ERR_FAILED - Failed
270 * RT_ERR_SMI - SMI access error
271 * RT_ERR_SVLAN_ENTRY_NOT_FOUND - specified svlan entry not found.
272 * RT_ERR_INPUT - Invalid input parameters.
273 * Note:
274 * The API can get system 64 accepted s-tag frame format. Only 64 SVID S-tag frame will be accpeted
275 * to receiving from uplink ports. Other SVID S-tag frame or S-untagged frame will be droped.
276 */
277 extern rtk_api_ret_t rtk_svlan_memberPortEntry_get(rtk_uint32 svid_idx, rtk_svlan_memberCfg_t *pSvlan_cfg);
278
279 /* Function Name:
280 * rtk_svlan_memberPortEntry_adv_set
281 * Description:
282 * Configure system SVLAN member by index
283 * Input:
284 * idx - Index (0 ~ 63)
285 * psvlan_cfg - SVLAN member configuration
286 * Output:
287 * None
288 * Return:
289 * RT_ERR_OK - OK
290 * RT_ERR_FAILED - Failed
291 * RT_ERR_SMI - SMI access error
292 * RT_ERR_INPUT - Invalid input parameter.
293 * RT_ERR_SVLAN_VID - Invalid SVLAN VID parameter.
294 * RT_ERR_PORT_MASK - Invalid portmask.
295 * RT_ERR_SVLAN_TABLE_FULL - SVLAN configuration is full.
296 * Note:
297 * The API can set system 64 accepted s-tag frame format by index.
298 * - rtk_svlan_memberCfg_t->svid is SVID of SVLAN member configuration.
299 * - rtk_svlan_memberCfg_t->memberport is member port mask of SVLAN member configuration.
300 * - rtk_svlan_memberCfg_t->fid is filtering database of SVLAN member configuration.
301 * - rtk_svlan_memberCfg_t->priority is priority of SVLAN member configuration.
302 */
303 extern rtk_api_ret_t rtk_svlan_memberPortEntry_adv_set(rtk_uint32 idx, rtk_svlan_memberCfg_t *pSvlan_cfg);
304
305 /* Function Name:
306 * rtk_svlan_memberPortEntry_adv_get
307 * Description:
308 * Get SVLAN member Configure by index.
309 * Input:
310 * idx - Index (0 ~ 63)
311 * Output:
312 * pSvlan_cfg - SVLAN member configuration
313 * Return:
314 * RT_ERR_OK - OK
315 * RT_ERR_FAILED - Failed
316 * RT_ERR_SMI - SMI access error
317 * RT_ERR_SVLAN_ENTRY_NOT_FOUND - specified svlan entry not found.
318 * RT_ERR_INPUT - Invalid input parameters.
319 * Note:
320 * The API can get system 64 accepted s-tag frame format. Only 64 SVID S-tag frame will be accpeted
321 * to receiving from uplink ports. Other SVID S-tag frame or S-untagged frame will be droped.
322 */
323 extern rtk_api_ret_t rtk_svlan_memberPortEntry_adv_get(rtk_uint32 idx, rtk_svlan_memberCfg_t *pSvlan_cfg);
324
325 /* Function Name:
326 * rtk_svlan_defaultSvlan_set
327 * Description:
328 * Configure default egress SVLAN.
329 * Input:
330 * port - Source port
331 * svid - SVLAN id
332 * Output:
333 * None
334 * Return:
335 * RT_ERR_OK - OK
336 * RT_ERR_FAILED - Failed
337 * RT_ERR_SMI - SMI access error
338 * RT_ERR_INPUT - Invalid input parameter.
339 * RT_ERR_SVLAN_VID - Invalid SVLAN VID parameter.
340 * RT_ERR_SVLAN_ENTRY_NOT_FOUND - specified svlan entry not found.
341 * Note:
342 * The API can set port n S-tag format index while receiving frame from port n
343 * is transmit through uplink port with s-tag field
344 */
345 extern rtk_api_ret_t rtk_svlan_defaultSvlan_set(rtk_port_t port, rtk_vlan_t svid);
346
347 /* Function Name:
348 * rtk_svlan_defaultSvlan_get
349 * Description:
350 * Get the configure default egress SVLAN.
351 * Input:
352 * port - Source port
353 * Output:
354 * pSvid - SVLAN VID
355 * Return:
356 * RT_ERR_OK - OK
357 * RT_ERR_FAILED - Failed
358 * RT_ERR_SMI - SMI access error
359 * RT_ERR_INPUT - Invalid input parameters.
360 * Note:
361 * The API can get port n S-tag format index while receiving frame from port n
362 * is transmit through uplink port with s-tag field
363 */
364 extern rtk_api_ret_t rtk_svlan_defaultSvlan_get(rtk_port_t port, rtk_vlan_t *pSvid);
365
366 /* Function Name:
367 * rtk_svlan_c2s_add
368 * Description:
369 * Configure SVLAN C2S table
370 * Input:
371 * vid - VLAN ID
372 * src_port - Ingress Port
373 * svid - SVLAN VID
374 * Output:
375 * None
376 * Return:
377 * RT_ERR_OK - OK
378 * RT_ERR_FAILED - Failed
379 * RT_ERR_SMI - SMI access error
380 * RT_ERR_PORT_ID - Invalid port ID.
381 * RT_ERR_SVLAN_VID - Invalid SVLAN VID parameter.
382 * RT_ERR_VLAN_VID - Invalid VID parameter.
383 * RT_ERR_OUT_OF_RANGE - input out of range.
384 * RT_ERR_INPUT - Invalid input parameters.
385 * Note:
386 * The API can set system C2S configuration. ASIC will check upstream's VID and assign related
387 * SVID to mathed packet. There are 128 SVLAN C2S configurations.
388 */
389 extern rtk_api_ret_t rtk_svlan_c2s_add(rtk_vlan_t vid, rtk_port_t src_port, rtk_vlan_t svid);
390
391 /* Function Name:
392 * rtk_svlan_c2s_del
393 * Description:
394 * Delete one C2S entry
395 * Input:
396 * vid - VLAN ID
397 * src_port - Ingress Port
398 * svid - SVLAN VID
399 * Output:
400 * None
401 * Return:
402 * RT_ERR_OK - OK
403 * RT_ERR_FAILED - Failed
404 * RT_ERR_SMI - SMI access error
405 * RT_ERR_VLAN_VID - Invalid VID parameter.
406 * RT_ERR_PORT_ID - Invalid port ID.
407 * RT_ERR_OUT_OF_RANGE - input out of range.
408 * Note:
409 * The API can delete system C2S configuration. There are 128 SVLAN C2S configurations.
410 */
411 extern rtk_api_ret_t rtk_svlan_c2s_del(rtk_vlan_t vid, rtk_port_t src_port);
412
413 /* Function Name:
414 * rtk_svlan_c2s_get
415 * Description:
416 * Get configure SVLAN C2S table
417 * Input:
418 * vid - VLAN ID
419 * src_port - Ingress Port
420 * Output:
421 * pSvid - SVLAN ID
422 * Return:
423 * RT_ERR_OK - OK
424 * RT_ERR_FAILED - Failed
425 * RT_ERR_SMI - SMI access error
426 * RT_ERR_INPUT - Invalid input parameters.
427 * RT_ERR_PORT_ID - Invalid port ID.
428 * RT_ERR_OUT_OF_RANGE - input out of range.
429 * Note:
430 * The API can get system C2S configuration. There are 128 SVLAN C2S configurations.
431 */
432 extern rtk_api_ret_t rtk_svlan_c2s_get(rtk_vlan_t vid, rtk_port_t src_port, rtk_vlan_t *pSvid);
433
434 /* Function Name:
435 * rtk_svlan_untag_action_set
436 * Description:
437 * Configure Action of downstream Un-Stag packet
438 * Input:
439 * action - Action for UnStag
440 * svid - The SVID assigned to UnStag packet
441 * Output:
442 * None
443 * Return:
444 * RT_ERR_OK - OK
445 * RT_ERR_FAILED - Failed
446 * RT_ERR_SMI - SMI access error
447 * RT_ERR_SVLAN_VID - Invalid SVLAN VID parameter.
448 * RT_ERR_SVLAN_ENTRY_NOT_FOUND - specified svlan entry not found.
449 * RT_ERR_OUT_OF_RANGE - input out of range.
450 * RT_ERR_INPUT - Invalid input parameters.
451 * Note:
452 * The API can configure action of downstream Un-Stag packet. A SVID assigned
453 * to the un-stag is also supported by this API. The parameter of svid is
454 * only referenced when the action is set to UNTAG_ASSIGN
455 */
456 extern rtk_api_ret_t rtk_svlan_untag_action_set(rtk_svlan_untag_action_t action, rtk_vlan_t svid);
457
458 /* Function Name:
459 * rtk_svlan_untag_action_get
460 * Description:
461 * Get Action of downstream Un-Stag packet
462 * Input:
463 * None
464 * Output:
465 * pAction - Action for UnStag
466 * pSvid - The SVID assigned to UnStag packet
467 * Return:
468 * RT_ERR_OK - OK
469 * RT_ERR_FAILED - Failed
470 * RT_ERR_SMI - SMI access error
471 * RT_ERR_SVLAN_VID - Invalid SVLAN VID parameter.
472 * RT_ERR_SVLAN_ENTRY_NOT_FOUND - specified svlan entry not found.
473 * RT_ERR_OUT_OF_RANGE - input out of range.
474 * RT_ERR_INPUT - Invalid input parameters.
475 * Note:
476 * The API can Get action of downstream Un-Stag packet. A SVID assigned
477 * to the un-stag is also retrieved by this API. The parameter pSvid is
478 * only refernced when the action is UNTAG_ASSIGN
479 */
480 extern rtk_api_ret_t rtk_svlan_untag_action_get(rtk_svlan_untag_action_t *pAction, rtk_vlan_t *pSvid);
481
482 /* Function Name:
483 * rtk_svlan_unmatch_action_set
484 * Description:
485 * Configure Action of downstream Unmatch packet
486 * Input:
487 * action - Action for Unmatch
488 * svid - The SVID assigned to Unmatch packet
489 * Output:
490 * None
491 * Return:
492 * RT_ERR_OK - OK
493 * RT_ERR_FAILED - Failed
494 * RT_ERR_SMI - SMI access error
495 * RT_ERR_SVLAN_VID - Invalid SVLAN VID parameter.
496 * RT_ERR_SVLAN_ENTRY_NOT_FOUND - specified svlan entry not found.
497 * RT_ERR_OUT_OF_RANGE - input out of range.
498 * RT_ERR_INPUT - Invalid input parameters.
499 * Note:
500 * The API can configure action of downstream Un-match packet. A SVID assigned
501 * to the un-match is also supported by this API. The parameter od svid is
502 * only refernced when the action is set to UNMATCH_ASSIGN
503 */
504 extern rtk_api_ret_t rtk_svlan_unmatch_action_set(rtk_svlan_unmatch_action_t action, rtk_vlan_t svid);
505
506 /* Function Name:
507 * rtk_svlan_unmatch_action_get
508 * Description:
509 * Get Action of downstream Unmatch packet
510 * Input:
511 * None
512 * Output:
513 * pAction - Action for Unmatch
514 * pSvid - The SVID assigned to Unmatch packet
515 * Return:
516 * RT_ERR_OK - OK
517 * RT_ERR_FAILED - Failed
518 * RT_ERR_SMI - SMI access error
519 * RT_ERR_SVLAN_VID - Invalid SVLAN VID parameter.
520 * RT_ERR_SVLAN_ENTRY_NOT_FOUND - specified svlan entry not found.
521 * RT_ERR_OUT_OF_RANGE - input out of range.
522 * RT_ERR_INPUT - Invalid input parameters.
523 * Note:
524 * The API can Get action of downstream Un-match packet. A SVID assigned
525 * to the un-match is also retrieved by this API. The parameter pSvid is
526 * only refernced when the action is UNMATCH_ASSIGN
527 */
528 extern rtk_api_ret_t rtk_svlan_unmatch_action_get(rtk_svlan_unmatch_action_t *pAction, rtk_vlan_t *pSvid);
529
530 /* Function Name:
531 * rtk_svlan_dmac_vidsel_set
532 * Description:
533 * Set DMAC CVID selection
534 * Input:
535 * port - Port
536 * enable - state of DMAC CVID Selection
537 * Output:
538 * None.
539 * Return:
540 * RT_ERR_OK - OK
541 * RT_ERR_FAILED - Failed
542 * RT_ERR_SMI - SMI access error
543 * RT_ERR_SVLAN_VID - Invalid SVLAN VID parameter.
544 * RT_ERR_SVLAN_ENTRY_NOT_FOUND - specified svlan entry not found.
545 * RT_ERR_OUT_OF_RANGE - input out of range.
546 * RT_ERR_INPUT - Invalid input parameters.
547 * Note:
548 * This API can set DMAC CVID Selection state
549 */
550 extern rtk_api_ret_t rtk_svlan_dmac_vidsel_set(rtk_port_t port, rtk_enable_t enable);
551
552 /* Function Name:
553 * rtk_svlan_dmac_vidsel_get
554 * Description:
555 * Get DMAC CVID selection
556 * Input:
557 * port - Port
558 * Output:
559 * pEnable - state of DMAC CVID Selection
560 * Return:
561 * RT_ERR_OK - OK
562 * RT_ERR_FAILED - Failed
563 * RT_ERR_SMI - SMI access error
564 * RT_ERR_SVLAN_VID - Invalid SVLAN VID parameter.
565 * RT_ERR_SVLAN_ENTRY_NOT_FOUND - specified svlan entry not found.
566 * RT_ERR_OUT_OF_RANGE - input out of range.
567 * RT_ERR_INPUT - Invalid input parameters.
568 * Note:
569 * This API can get DMAC CVID Selection state
570 */
571 extern rtk_api_ret_t rtk_svlan_dmac_vidsel_get(rtk_port_t port, rtk_enable_t *pEnable);
572
573 /* Function Name:
574 * rtk_svlan_ipmc2s_add
575 * Description:
576 * add ip multicast address to SVLAN
577 * Input:
578 * svid - SVLAN VID
579 * ipmc - ip multicast address
580 * ipmcMsk - ip multicast mask
581 * Output:
582 * None
583 * Return:
584 * RT_ERR_OK - OK
585 * RT_ERR_FAILED - Failed
586 * RT_ERR_SMI - SMI access error
587 * RT_ERR_SVLAN_VID - Invalid SVLAN VID parameter.
588 * RT_ERR_SVLAN_ENTRY_NOT_FOUND - specified svlan entry not found.
589 * RT_ERR_OUT_OF_RANGE - input out of range.
590 * RT_ERR_INPUT - Invalid input parameters.
591 * Note:
592 * The API can set IP mutlicast to SVID configuration. If upstream packet is IPv4 multicast
593 * packet and DIP is matched MC2S configuration, ASIC will assign egress SVID to the packet.
594 * There are 32 SVLAN multicast configurations for IP and L2 multicast.
595 */
596 extern rtk_api_ret_t rtk_svlan_ipmc2s_add(ipaddr_t ipmc, ipaddr_t ipmcMsk, rtk_vlan_t svid);
597
598 /* Function Name:
599 * rtk_svlan_ipmc2s_del
600 * Description:
601 * delete ip multicast address to SVLAN
602 * Input:
603 * ipmc - ip multicast address
604 * ipmcMsk - ip multicast mask
605 * Output:
606 * None
607 * Return:
608 * RT_ERR_OK - OK
609 * RT_ERR_FAILED - Failed
610 * RT_ERR_SMI - SMI access error
611 * RT_ERR_SVLAN_VID - Invalid SVLAN VID parameter.
612 * RT_ERR_OUT_OF_RANGE - input out of range.
613 * Note:
614 * The API can delete IP mutlicast to SVID configuration. There are 32 SVLAN multicast configurations for IP and L2 multicast.
615 */
616 extern rtk_api_ret_t rtk_svlan_ipmc2s_del(ipaddr_t ipmc, ipaddr_t ipmcMsk);
617
618 /* Function Name:
619 * rtk_svlan_ipmc2s_get
620 * Description:
621 * Get ip multicast address to SVLAN
622 * Input:
623 * ipmc - ip multicast address
624 * ipmcMsk - ip multicast mask
625 * Output:
626 * pSvid - SVLAN VID
627 * Return:
628 * RT_ERR_OK - OK
629 * RT_ERR_FAILED - Failed
630 * RT_ERR_SMI - SMI access error
631 * RT_ERR_INPUT - Invalid input parameters.
632 * RT_ERR_OUT_OF_RANGE - input out of range.
633 * Note:
634 * The API can get IP mutlicast to SVID configuration. There are 32 SVLAN multicast configurations for IP and L2 multicast.
635 */
636 extern rtk_api_ret_t rtk_svlan_ipmc2s_get(ipaddr_t ipmc, ipaddr_t ipmcMsk, rtk_vlan_t *pSvid);
637
638 /* Function Name:
639 * rtk_svlan_l2mc2s_add
640 * Description:
641 * Add L2 multicast address to SVLAN
642 * Input:
643 * mac - L2 multicast address
644 * macMsk - L2 multicast address mask
645 * svid - SVLAN VID
646 * Output:
647 * None
648 * Return:
649 * RT_ERR_OK - OK
650 * RT_ERR_FAILED - Failed
651 * RT_ERR_SMI - SMI access error
652 * RT_ERR_SVLAN_VID - Invalid SVLAN VID parameter.
653 * RT_ERR_SVLAN_ENTRY_NOT_FOUND - specified svlan entry not found.
654 * RT_ERR_OUT_OF_RANGE - input out of range.
655 * RT_ERR_INPUT - Invalid input parameters.
656 * Note:
657 * The API can set L2 Mutlicast to SVID configuration. If upstream packet is L2 multicast
658 * packet and DMAC is matched, ASIC will assign egress SVID to the packet. There are 32
659 * SVLAN multicast configurations for IP and L2 multicast.
660 */
661 extern rtk_api_ret_t rtk_svlan_l2mc2s_add(rtk_mac_t mac, rtk_mac_t macMsk, rtk_vlan_t svid);
662
663 /* Function Name:
664 * rtk_svlan_l2mc2s_del
665 * Description:
666 * delete L2 multicast address to SVLAN
667 * Input:
668 * mac - L2 multicast address
669 * macMsk - L2 multicast address mask
670 * Output:
671 * None
672 * Return:
673 * RT_ERR_OK - OK
674 * RT_ERR_FAILED - Failed
675 * RT_ERR_SMI - SMI access error
676 * RT_ERR_SVLAN_VID - Invalid SVLAN VID parameter.
677 * RT_ERR_OUT_OF_RANGE - input out of range.
678 * Note:
679 * The API can delete Mutlicast to SVID configuration. There are 32 SVLAN multicast configurations for IP and L2 multicast.
680 */
681 extern rtk_api_ret_t rtk_svlan_l2mc2s_del(rtk_mac_t mac, rtk_mac_t macMsk);
682
683 /* Function Name:
684 * rtk_svlan_l2mc2s_get
685 * Description:
686 * Get L2 multicast address to SVLAN
687 * Input:
688 * mac - L2 multicast address
689 * macMsk - L2 multicast address mask
690 * Output:
691 * pSvid - SVLAN VID
692 * Return:
693 * RT_ERR_OK - OK
694 * RT_ERR_FAILED - Failed
695 * RT_ERR_SMI - SMI access error
696 * RT_ERR_INPUT - Invalid input parameters.
697 * RT_ERR_OUT_OF_RANGE - input out of range.
698 * Note:
699 * The API can get L2 mutlicast to SVID configuration. There are 32 SVLAN multicast configurations for IP and L2 multicast.
700 */
701 extern rtk_api_ret_t rtk_svlan_l2mc2s_get(rtk_mac_t mac, rtk_mac_t macMsk, rtk_vlan_t *pSvid);
702
703 /* Function Name:
704 * rtk_svlan_sp2c_add
705 * Description:
706 * Add system SP2C configuration
707 * Input:
708 * cvid - VLAN ID
709 * dst_port - Destination port of SVLAN to CVLAN configuration
710 * svid - SVLAN VID
711 *
712 * Output:
713 * None
714 * Return:
715 * RT_ERR_OK - OK
716 * RT_ERR_FAILED - Failed
717 * RT_ERR_SMI - SMI access error
718 * RT_ERR_PORT_ID - Invalid port number.
719 * RT_ERR_SVLAN_VID - Invalid SVLAN VID parameter.
720 * RT_ERR_VLAN_VID - Invalid VID parameter.
721 * RT_ERR_OUT_OF_RANGE - input out of range.
722 * RT_ERR_INPUT - Invalid input parameters.
723 * Note:
724 * The API can add SVID & Destination Port to CVLAN configuration. The downstream frames with assigned
725 * SVID will be add C-tag with assigned CVID if the output port is the assigned destination port.
726 * There are 128 SP2C configurations.
727 */
728 extern rtk_api_ret_t rtk_svlan_sp2c_add(rtk_vlan_t svid, rtk_port_t dst_port, rtk_vlan_t cvid);
729
730 /* Function Name:
731 * rtk_svlan_sp2c_get
732 * Description:
733 * Get configure system SP2C content
734 * Input:
735 * svid - SVLAN VID
736 * dst_port - Destination port of SVLAN to CVLAN configuration
737 * Output:
738 * pCvid - VLAN ID
739 * Return:
740 * RT_ERR_OK - OK
741 * RT_ERR_FAILED - Failed
742 * RT_ERR_SMI - SMI access error
743 * RT_ERR_INPUT - Invalid input parameters.
744 * RT_ERR_OUT_OF_RANGE - input out of range.
745 * RT_ERR_PORT_ID - Invalid port number.
746 * RT_ERR_SVLAN_VID - Invalid SVLAN VID parameter.
747 * Note:
748 * The API can get SVID & Destination Port to CVLAN configuration. There are 128 SP2C configurations.
749 */
750 extern rtk_api_ret_t rtk_svlan_sp2c_get(rtk_vlan_t svid, rtk_port_t dst_port, rtk_vlan_t *pCvid);
751
752 /* Function Name:
753 * rtk_svlan_sp2c_del
754 * Description:
755 * Delete system SP2C configuration
756 * Input:
757 * svid - SVLAN VID
758 * dst_port - Destination port of SVLAN to CVLAN configuration
759 * Output:
760 * None
761 * Return:
762 * RT_ERR_OK - OK
763 * RT_ERR_FAILED - Failed
764 * RT_ERR_SMI - SMI access error
765 * RT_ERR_PORT_ID - Invalid port number.
766 * RT_ERR_SVLAN_VID - Invalid SVLAN VID parameter.
767 * RT_ERR_OUT_OF_RANGE - input out of range.
768 * Note:
769 * The API can delete SVID & Destination Port to CVLAN configuration. There are 128 SP2C configurations.
770 */
771 extern rtk_api_ret_t rtk_svlan_sp2c_del(rtk_vlan_t svid, rtk_port_t dst_port);
772
773
774 /* Function Name:
775 * rtk_svlan_lookupType_set
776 * Description:
777 * Set lookup type of SVLAN
778 * Input:
779 * type - lookup type
780 * Output:
781 * None
782 * Return:
783 * RT_ERR_OK
784 * RT_ERR_FAILED
785 * Note:
786 * none
787 */
788 extern rtk_api_ret_t rtk_svlan_lookupType_set(rtk_svlan_lookupType_t type);
789
790 /* Function Name:
791 * rtk_svlan_lookupType_get
792 * Description:
793 * Get lookup type of SVLAN
794 * Input:
795 * pType - lookup type
796 * Output:
797 * None
798 * Return:
799 * RT_ERR_OK
800 * RT_ERR_FAILED
801 * Note:
802 * none
803 */
804 extern rtk_api_ret_t rtk_svlan_lookupType_get(rtk_svlan_lookupType_t *pType);
805
806 /* Function Name:
807 * rtk_svlan_trapPri_set
808 * Description:
809 * Set svlan trap priority
810 * Input:
811 * priority - priority for trap packets
812 * Output:
813 * None
814 * Return:
815 * RT_ERR_OK
816 * RT_ERR_FAILED
817 * RT_ERR_QOS_INT_PRIORITY
818 * Note:
819 * None
820 */
821 extern rtk_api_ret_t rtk_svlan_trapPri_set(rtk_pri_t priority);
822
823 /* Function Name:
824 * rtk_svlan_trapPri_get
825 * Description:
826 * Get svlan trap priority
827 * Input:
828 * None
829 * Output:
830 * pPriority - priority for trap packets
831 * Return:
832 * RT_ERR_OK
833 * RT_ERR_FAILED
834 * RT_ERR_NULL_POINTER - input parameter may be null pointer
835 * Note:
836 * None
837 */
838 extern rtk_api_ret_t rtk_svlan_trapPri_get(rtk_pri_t *pPriority);
839
840 /* Function Name:
841 * rtk_svlan_unassign_action_set
842 * Description:
843 * Configure Action of upstream without svid assign action
844 * Input:
845 * action - Action for Un-assign
846 * Output:
847 * None
848 * Return:
849 * RT_ERR_OK - OK
850 * RT_ERR_FAILED - Failed
851 * RT_ERR_OUT_OF_RANGE - input out of range.
852 * RT_ERR_INPUT - Invalid input parameters.
853 * Note:
854 * The API can configure action of upstream Un-assign svid packet. If action is not
855 * trap to CPU, the port-based SVID sure be assign as system need
856 */
857 extern rtk_api_ret_t rtk_svlan_unassign_action_set(rtk_svlan_unassign_action_t action);
858
859 /* Function Name:
860 * rtk_svlan_unassign_action_get
861 * Description:
862 * Get action of upstream without svid assignment
863 * Input:
864 * None
865 * Output:
866 * pAction - Action for Un-assign
867 * Return:
868 * RT_ERR_OK - OK
869 * RT_ERR_FAILED - Failed
870 * Note:
871 * None
872 */
873 extern rtk_api_ret_t rtk_svlan_unassign_action_get(rtk_svlan_unassign_action_t *pAction);
874
875
876 /* Function Name:
877 * rtk_svlan_checkAndCreateMbr
878 * Description:
879 * Check and create Member configuration and return index
880 * Input:
881 * vid - VLAN id.
882 * Output:
883 * pIndex - Member configuration index
884 * Return:
885 * RT_ERR_OK - OK
886 * RT_ERR_FAILED - Failed
887 * RT_ERR_SMI - SMI access error
888 * RT_ERR_VLAN_VID - Invalid VLAN ID.
889 * RT_ERR_TBL_FULL - Member Configuration table full
890 * Note:
891 *
892 */
893 extern rtk_api_ret_t rtk_svlan_checkAndCreateMbr(rtk_vlan_t vid, rtk_uint32 *pIndex);
894
895
896 #endif /* __RTK_API_SVLAN_H__ */