forked from openwrt/openwrt
/
rtl8367c_asicdrv_igmp.c
2109 lines (1877 loc) · 54.4 KB
/
rtl8367c_asicdrv_igmp.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright (C) 2013 Realtek Semiconductor Corp.
* All Rights Reserved.
*
* Unless you and Realtek execute a separate written software license
* agreement governing use of this software, this software is licensed
* to you under the terms of the GNU General Public License version 2,
* available at https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
*
* $Revision: 76306 $
* $Date: 2017-03-08 15:13:58 +0800 (週三, 08 三月 2017) $
*
* Purpose : RTL8367C switch high-level API for RTL8367C
* Feature : IGMP related functions
*
*/
#include <rtl8367c_asicdrv_igmp.h>
/* Function Name:
* rtl8367c_setAsicIgmp
* Description:
* Set IGMP/MLD state
* Input:
* enabled - 1: enabled, 0: disabled
* Output:
* None
* Return:
* RT_ERR_OK - Success
* RT_ERR_SMI - SMI access error
* Note:
* None
*/
ret_t rtl8367c_setAsicIgmp(rtk_uint32 enabled)
{
ret_t retVal;
/* Enable/Disable H/W IGMP/MLD */
retVal = rtl8367c_setAsicRegBit(RTL8367C_REG_IGMP_MLD_CFG0, RTL8367C_IGMP_MLD_EN_OFFSET, enabled);
return retVal;
}
/* Function Name:
* rtl8367c_getAsicIgmp
* Description:
* Get IGMP/MLD state
* Input:
* enabled - 1: enabled, 0: disabled
* Output:
* None
* Return:
* RT_ERR_OK - Success
* RT_ERR_SMI - SMI access error
* Note:
* None
*/
ret_t rtl8367c_getAsicIgmp(rtk_uint32 *ptr_enabled)
{
ret_t retVal;
retVal = rtl8367c_getAsicRegBit(RTL8367C_REG_IGMP_MLD_CFG0, RTL8367C_IGMP_MLD_EN_OFFSET, ptr_enabled);
return retVal;
}
/* Function Name:
* rtl8367c_setAsicIpMulticastVlanLeaky
* Description:
* Set IP multicast VLAN Leaky function
* Input:
* port - Physical port number (0~7)
* enabled - 1: enabled, 0: disabled
* Output:
* None
* Return:
* RT_ERR_OK - Success
* RT_ERR_SMI - SMI access error
* RT_ERR_PORT_ID - Invalid port number
* Note:
* When enabling this function,
* if the lookup result(forwarding portmap) of IP Multicast packet is over VLAN boundary,
* the packet can be forwarded across VLAN
*/
ret_t rtl8367c_setAsicIpMulticastVlanLeaky(rtk_uint32 port, rtk_uint32 enabled)
{
ret_t retVal;
if(port > RTL8367C_PORTIDMAX)
return RT_ERR_PORT_ID;
retVal = rtl8367c_setAsicRegBit(RTL8367C_REG_IPMCAST_VLAN_LEAKY, port, enabled);
return retVal;
}
/* Function Name:
* rtl8367c_getAsicIpMulticastVlanLeaky
* Description:
* Get IP multicast VLAN Leaky function
* Input:
* port - Physical port number (0~7)
* enabled - 1: enabled, 0: disabled
* Output:
* None
* Return:
* RT_ERR_OK - Success
* RT_ERR_SMI - SMI access error
* RT_ERR_PORT_ID - Invalid port number
* Note:
* None
*/
ret_t rtl8367c_getAsicIpMulticastVlanLeaky(rtk_uint32 port, rtk_uint32 *ptr_enabled)
{
ret_t retVal;
if(port > RTL8367C_PORTIDMAX)
return RT_ERR_PORT_ID;
retVal = rtl8367c_getAsicRegBit(RTL8367C_REG_IPMCAST_VLAN_LEAKY, port, ptr_enabled);
return retVal;
}
/* Function Name:
* rtl8367c_setAsicIGMPTableFullOP
* Description:
* Set Table Full operation
* Input:
* operation - The operation should be taken when the IGMP table is full.
* Output:
* None
* Return:
* RT_ERR_OK - Success
* RT_ERR_SMI - SMI access error
* RT_ERR_OUT_OF_RANGE - input parameter is out of range
* Note:
* None
*/
ret_t rtl8367c_setAsicIGMPTableFullOP(rtk_uint32 operation)
{
ret_t retVal;
if(operation >= TABLE_FULL_OP_END)
return RT_ERR_OUT_OF_RANGE;
/* Table full Operation */
retVal = rtl8367c_setAsicRegBits(RTL8367C_REG_IGMP_MLD_CFG1, RTL8367C_TABLE_FULL_OP_MASK, operation);
if(retVal != RT_ERR_OK)
return retVal;
return RT_ERR_OK;
}
/* Function Name:
* rtl8367c_getAsicIGMPTableFullOP
* Description:
* Get Table Full operation
* Input:
* None
* Output:
* poperation - The operation should be taken when the IGMP table is full.
* Return:
* RT_ERR_OK - Success
* RT_ERR_SMI - SMI access error
* Note:
* None
*/
ret_t rtl8367c_getAsicIGMPTableFullOP(rtk_uint32 *poperation)
{
ret_t retVal;
rtk_uint32 value;
/* Table full Operation */
retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_IGMP_MLD_CFG1, RTL8367C_TABLE_FULL_OP_MASK, &value);
if(retVal != RT_ERR_OK)
return retVal;
*poperation = value;
return RT_ERR_OK;
}
/* Function Name:
* rtl8367c_setAsicIGMPCRCErrOP
* Description:
* Set the operation when ASIC receive a Checksum error packet
* Input:
* operation -The operation when ASIC receive a Checksum error packet
* Output:
* None
* Return:
* RT_ERR_OK - Success
* RT_ERR_SMI - SMI access error
* RT_ERR_OUT_OF_RANGE - input parameter is out of range
* Note:
* None
*/
ret_t rtl8367c_setAsicIGMPCRCErrOP(rtk_uint32 operation)
{
ret_t retVal;
if(operation >= CRC_ERR_OP_END)
return RT_ERR_OUT_OF_RANGE;
/* CRC Error Operation */
retVal = rtl8367c_setAsicRegBits(RTL8367C_REG_IGMP_MLD_CFG0, RTL8367C_CKS_ERR_OP_MASK, operation);
if(retVal != RT_ERR_OK)
return retVal;
return RT_ERR_OK;
}
/* Function Name:
* rtl8367c_getAsicIGMPCRCErrOP
* Description:
* Get the operation when ASIC receive a Checksum error packet
* Input:
* None
* Output:
* poperation - The operation of Checksum error packet
* Return:
* RT_ERR_OK - Success
* RT_ERR_SMI - SMI access error
* Note:
* None
*/
ret_t rtl8367c_getAsicIGMPCRCErrOP(rtk_uint32 *poperation)
{
ret_t retVal;
rtk_uint32 value;
/* CRC Error Operation */
retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_IGMP_MLD_CFG0, RTL8367C_CKS_ERR_OP_MASK, &value);
if(retVal != RT_ERR_OK)
return retVal;
*poperation = value;
return RT_ERR_OK;
}
/* Function Name:
* rtl8367c_setAsicIGMPFastLeaveEn
* Description:
* Enable/Disable Fast Leave
* Input:
* enabled - 1:enable Fast Leave; 0:disable Fast Leave
* Output:
* None
* Return:
* RT_ERR_OK - Success
* RT_ERR_SMI - SMI access error
* Note:
* None
*/
ret_t rtl8367c_setAsicIGMPFastLeaveEn(rtk_uint32 enabled)
{
ret_t retVal;
/* Fast Leave */
retVal = rtl8367c_setAsicRegBits(RTL8367C_REG_IGMP_MLD_CFG0, RTL8367C_FAST_LEAVE_EN_MASK, (enabled >= 1) ? 1 : 0);
if(retVal != RT_ERR_OK)
return retVal;
return RT_ERR_OK;
}
/* Function Name:
* rtl8367c_getAsicIGMPFastLeaveEn
* Description:
* Get Fast Leave state
* Input:
* None
* Output:
* penabled - 1:enable Fast Leave; 0:disable Fast Leave
* Return:
* RT_ERR_OK - Success
* RT_ERR_SMI - SMI access error
* Note:
* None
*/
ret_t rtl8367c_getAsicIGMPFastLeaveEn(rtk_uint32 *penabled)
{
ret_t retVal;
rtk_uint32 value;
/* Fast Leave */
retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_IGMP_MLD_CFG0, RTL8367C_FAST_LEAVE_EN_MASK, &value);
if(retVal != RT_ERR_OK)
return retVal;
*penabled = value;
return RT_ERR_OK;
}
/* Function Name:
* rtl8367c_setAsicIGMPLeaveTimer
* Description:
* Set the Leave timer of IGMP/MLD
* Input:
* leave_timer - Leave timer
* Output:
* None
* Return:
* RT_ERR_OK - Success
* RT_ERR_SMI - SMI access error
* RT_ERR_OUT_OF_RANGE - input parameter is out of range
* Note:
* None
*/
ret_t rtl8367c_setAsicIGMPLeaveTimer(rtk_uint32 leave_timer)
{
ret_t retVal;
if(leave_timer > RTL8367C_MAX_LEAVE_TIMER)
return RT_ERR_OUT_OF_RANGE;
/* Leave timer */
retVal = rtl8367c_setAsicRegBits(RTL8367C_REG_IGMP_MLD_CFG0, RTL8367C_LEAVE_TIMER_MASK, leave_timer);
if(retVal != RT_ERR_OK)
return retVal;
return RT_ERR_OK;
}
/* Function Name:
* rtl8367c_getAsicIGMPLeaveTimer
* Description:
* Get the Leave timer of IGMP/MLD
* Input:
* None
* Output:
* pleave_timer - Leave timer
* Return:
* RT_ERR_OK - Success
* RT_ERR_SMI - SMI access error
* Note:
* None
*/
ret_t rtl8367c_getAsicIGMPLeaveTimer(rtk_uint32 *pleave_timer)
{
ret_t retVal;
rtk_uint32 value;
/* Leave timer */
retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_IGMP_MLD_CFG0, RTL8367C_LEAVE_TIMER_MASK, &value);
if(retVal != RT_ERR_OK)
return retVal;
*pleave_timer = value;
return RT_ERR_OK;
}
/* Function Name:
* rtl8367c_setAsicIGMPQueryInterval
* Description:
* Set Query Interval of IGMP/MLD
* Input:
* interval - Query Interval
* Output:
* None
* Return:
* RT_ERR_OK - Success
* RT_ERR_SMI - SMI access error
* RT_ERR_OUT_OF_RANGE - input parameter is out of range
* Note:
* None
*/
ret_t rtl8367c_setAsicIGMPQueryInterval(rtk_uint32 interval)
{
ret_t retVal;
if(interval > RTL8367C_MAX_QUERY_INT)
return RT_ERR_OUT_OF_RANGE;
/* Query Interval */
retVal = rtl8367c_setAsicReg(RTL8367C_REG_IGMP_MLD_CFG2, interval);
if(retVal != RT_ERR_OK)
return retVal;
return RT_ERR_OK;
}
/* Function Name:
* rtl8367c_getAsicIGMPQueryInterval
* Description:
* Get Query Interval of IGMP/MLD
* Input:
* None
* Output:
* pinterval - Query Interval
* Return:
* RT_ERR_OK - Success
* RT_ERR_SMI - SMI access error
* Note:
* None
*/
ret_t rtl8367c_getAsicIGMPQueryInterval(rtk_uint32 *pinterval)
{
ret_t retVal;
rtk_uint32 value;
/* Query Interval */
retVal = rtl8367c_getAsicReg(RTL8367C_REG_IGMP_MLD_CFG2, &value);
if(retVal != RT_ERR_OK)
return retVal;
*pinterval = value;
return RT_ERR_OK;
}
/* Function Name:
* rtl8367c_setAsicIGMPRobVar
* Description:
* Set Robustness Variable of IGMP/MLD
* Input:
* rob_var - Robustness Variable
* Output:
* None
* Return:
* RT_ERR_OK - Success
* RT_ERR_SMI - SMI access error
* RT_ERR_OUT_OF_RANGE - input parameter is out of range
* Note:
* None
*/
ret_t rtl8367c_setAsicIGMPRobVar(rtk_uint32 rob_var)
{
ret_t retVal;
if(rob_var > RTL8367C_MAX_ROB_VAR)
return RT_ERR_OUT_OF_RANGE;
/* Bourstness variable */
retVal = rtl8367c_setAsicRegBits(RTL8367C_REG_IGMP_MLD_CFG0, RTL8367C_ROBURSTNESS_VAR_MASK, rob_var);
if(retVal != RT_ERR_OK)
return retVal;
return RT_ERR_OK;
}
/* Function Name:
* rtl8367c_getAsicIGMPRobVar
* Description:
* Get Robustness Variable of IGMP/MLD
* Input:
* none
* Output:
* prob_var - Robustness Variable
* Return:
* RT_ERR_OK - Success
* RT_ERR_SMI - SMI access error
* Note:
* None
*/
ret_t rtl8367c_getAsicIGMPRobVar(rtk_uint32 *prob_var)
{
ret_t retVal;
rtk_uint32 value;
/* Bourstness variable */
retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_IGMP_MLD_CFG0, RTL8367C_ROBURSTNESS_VAR_MASK, &value);
if(retVal != RT_ERR_OK)
return retVal;
*prob_var = value;
return RT_ERR_OK;
}
/* Function Name:
* rtl8367c_setAsicIGMPStaticRouterPort
* Description:
* Set IGMP static router port mask
* Input:
* pmsk - Static portmask
* Output:
* None
* Return:
* RT_ERR_OK - Success
* RT_ERR_SMI - SMI access error
* RT_ERR_PORT_MASK - Invalid port mask
* Note:
* None
*/
ret_t rtl8367c_setAsicIGMPStaticRouterPort(rtk_uint32 pmsk)
{
if(pmsk > RTL8367C_PORTMASK)
return RT_ERR_PORT_MASK;
return rtl8367c_setAsicRegBits(RTL8367C_REG_IGMP_STATIC_ROUTER_PORT, RTL8367C_IGMP_STATIC_ROUTER_PORT_MASK, pmsk);
}
/* Function Name:
* rtl8367c_getAsicIGMPStaticRouterPort
* Description:
* Get IGMP static router port mask
* Input:
* pmsk - Static portmask
* Output:
* None
* Return:
* RT_ERR_OK - Success
* RT_ERR_SMI - SMI access error
* Note:
* None
*/
ret_t rtl8367c_getAsicIGMPStaticRouterPort(rtk_uint32 *pmsk)
{
return rtl8367c_getAsicRegBits(RTL8367C_REG_IGMP_STATIC_ROUTER_PORT, RTL8367C_IGMP_STATIC_ROUTER_PORT_MASK, pmsk);
}
/* Function Name:
* rtl8367c_setAsicIGMPAllowDynamicRouterPort
* Description:
* Set IGMP dynamic router port allow mask
* Input:
* pmsk - Allow dynamic router port mask
* Output:
* None
* Return:
* RT_ERR_OK - Success
* RT_ERR_SMI - SMI access error
* RT_ERR_PORT_MASK - Invalid port mask
* Note:
* None
*/
ret_t rtl8367c_setAsicIGMPAllowDynamicRouterPort(rtk_uint32 pmsk)
{
return rtl8367c_setAsicReg(RTL8367C_REG_IGMP_MLD_CFG4, pmsk);
}
/* Function Name:
* rtl8367c_getAsicIGMPAllowDynamicRouterPort
* Description:
* Get IGMP dynamic router port allow mask
* Input:
* None.
* Output:
* pPmsk - Allow dynamic router port mask
* Return:
* RT_ERR_OK - Success
* RT_ERR_SMI - SMI access error
* RT_ERR_PORT_MASK - Invalid port mask
* Note:
* None
*/
ret_t rtl8367c_getAsicIGMPAllowDynamicRouterPort(rtk_uint32 *pPmsk)
{
return rtl8367c_getAsicReg(RTL8367C_REG_IGMP_MLD_CFG4, pPmsk);
}
/* Function Name:
* rtl8367c_getAsicIGMPdynamicRouterPort1
* Description:
* Get 1st dynamic router port and timer
* Input:
* port - Physical port number (0~7)
* timer - router port timer
* Output:
* None
* Return:
* RT_ERR_OK - Success
* RT_ERR_SMI - SMI access error
* Note:
* None
*/
ret_t rtl8367c_getAsicIGMPdynamicRouterPort1(rtk_uint32 *port, rtk_uint32 *timer)
{
ret_t retVal;
retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_IGMP_DYNAMIC_ROUTER_PORT, RTL8367C_D_ROUTER_PORT_1_MASK, port);
if(retVal != RT_ERR_OK)
return retVal;
retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_IGMP_DYNAMIC_ROUTER_PORT, RTL8367C_D_ROUTER_PORT_TMR_1_MASK, timer);
if(retVal != RT_ERR_OK)
return retVal;
return RT_ERR_OK;
}
/* Function Name:
* rtl8367c_getAsicIGMPdynamicRouterPort2
* Description:
* Get 2nd dynamic router port and timer
* Input:
* port - Physical port number (0~7)
* timer - router port timer
* Output:
* None
* Return:
* RT_ERR_OK - Success
* RT_ERR_SMI - SMI access error
* Note:
* None
*/
ret_t rtl8367c_getAsicIGMPdynamicRouterPort2(rtk_uint32 *port, rtk_uint32 *timer)
{
ret_t retVal;
retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_IGMP_DYNAMIC_ROUTER_PORT, RTL8367C_D_ROUTER_PORT_2_MASK, port);
if(retVal != RT_ERR_OK)
return retVal;
retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_IGMP_DYNAMIC_ROUTER_PORT, RTL8367C_D_ROUTER_PORT_TMR_2_MASK, timer);
if(retVal != RT_ERR_OK)
return retVal;
return RT_ERR_OK;
}
/* Function Name:
* rtl8367c_setAsicIGMPSuppression
* Description:
* Set the suppression function
* Input:
* report_supp_enabled - Report suppression, 1:Enable, 0:disable
* leave_supp_enabled - Leave suppression, 1:Enable, 0:disable
* Output:
* None
* Return:
* RT_ERR_OK - Success
* RT_ERR_SMI - SMI access error
* Note:
* None
*/
ret_t rtl8367c_setAsicIGMPSuppression(rtk_uint32 report_supp_enabled, rtk_uint32 leave_supp_enabled)
{
ret_t retVal;
retVal = rtl8367c_setAsicRegBits(RTL8367C_REG_IGMP_MLD_CFG0, RTL8367C_REPORT_SUPPRESSION_MASK, report_supp_enabled);
if(retVal != RT_ERR_OK)
return retVal;
retVal = rtl8367c_setAsicRegBits(RTL8367C_REG_IGMP_MLD_CFG0, RTL8367C_LEAVE_SUPPRESSION_MASK, leave_supp_enabled);
if(retVal != RT_ERR_OK)
return retVal;
return RT_ERR_OK;
}
/* Function Name:
* rtl8367c_getAsicIGMPSuppression
* Description:
* Get the suppression function
* Input:
* report_supp_enabled - Report suppression, 1:Enable, 0:disable
* leave_supp_enabled - Leave suppression, 1:Enable, 0:disable
* Output:
* None
* Return:
* RT_ERR_OK - Success
* RT_ERR_SMI - SMI access error
* Note:
* None
*/
ret_t rtl8367c_getAsicIGMPSuppression(rtk_uint32 *report_supp_enabled, rtk_uint32 *leave_supp_enabled)
{
ret_t retVal;
retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_IGMP_MLD_CFG0, RTL8367C_REPORT_SUPPRESSION_MASK, report_supp_enabled);
if(retVal != RT_ERR_OK)
return retVal;
retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_IGMP_MLD_CFG0, RTL8367C_LEAVE_SUPPRESSION_MASK, leave_supp_enabled);
if(retVal != RT_ERR_OK)
return retVal;
return RT_ERR_OK;
}
/* Function Name:
* rtl8367c_setAsicIGMPQueryRX
* Description:
* Set port-based Query packet RX allowance
* Input:
* port - port number
* allow_query - allowance of Query packet RX, 1:Allow, 0:Drop
* Output:
* None
* Return:
* RT_ERR_OK - Success
* RT_ERR_PORT_ID - Error PORT ID
* RT_ERR_SMI - SMI access error
* Note:
* None
*/
ret_t rtl8367c_setAsicIGMPQueryRX(rtk_uint32 port, rtk_uint32 allow_query)
{
ret_t retVal;
if(port > RTL8367C_PORTIDMAX)
return RT_ERR_PORT_ID;
/* Allow Query */
if (port < 8)
{
retVal = rtl8367c_setAsicRegBits(RTL8367C_REG_IGMP_PORT0_CONTROL + port, RTL8367C_IGMP_PORT0_CONTROL_ALLOW_QUERY_MASK, allow_query);
if(retVal != RT_ERR_OK)
return retVal;
}
else
{
retVal = rtl8367c_setAsicRegBits(RTL8367C_REG_IGMP_PORT8_CONTROL + port - 8, RTL8367C_IGMP_PORT0_CONTROL_ALLOW_QUERY_MASK, allow_query);
if(retVal != RT_ERR_OK)
return retVal;
}
return RT_ERR_OK;
}
/* Function Name:
* rtl8367c_getAsicIGMPQueryRX
* Description:
* Get port-based Query packet RX allowance
* Input:
* port - port number
* Output:
* allow_query - allowance of Query packet RX, 1:Allow, 0:Drop
* Return:
* RT_ERR_OK - Success
* RT_ERR_PORT_ID - Error PORT ID
* RT_ERR_SMI - SMI access error
* Note:
* None
*/
ret_t rtl8367c_getAsicIGMPQueryRX(rtk_uint32 port, rtk_uint32 *allow_query)
{
ret_t retVal;
rtk_uint32 value;
if(port > RTL8367C_PORTIDMAX)
return RT_ERR_PORT_ID;
/* Allow Query */
if (port < 8)
{
retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_IGMP_PORT0_CONTROL + port, RTL8367C_IGMP_PORT0_CONTROL_ALLOW_QUERY_MASK, &value);
if(retVal != RT_ERR_OK)
return retVal;
}
else
{
retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_IGMP_PORT8_CONTROL + port - 8, RTL8367C_IGMP_PORT0_CONTROL_ALLOW_QUERY_MASK, &value);
if(retVal != RT_ERR_OK)
return retVal;
}
*allow_query = value;
return RT_ERR_OK;
}
/* Function Name:
* rtl8367c_setAsicIGMPReportRX
* Description:
* Set port-based Report packet RX allowance
* Input:
* port - port number
* allow_report - allowance of Report packet RX, 1:Allow, 0:Drop
* Output:
* None
* Return:
* RT_ERR_OK - Success
* RT_ERR_PORT_ID - Error PORT ID
* RT_ERR_SMI - SMI access error
* Note:
* None
*/
ret_t rtl8367c_setAsicIGMPReportRX(rtk_uint32 port, rtk_uint32 allow_report)
{
ret_t retVal;
if(port > RTL8367C_PORTIDMAX)
return RT_ERR_PORT_ID;
if(port < 8)
{
/* Allow Report */
retVal = rtl8367c_setAsicRegBits(RTL8367C_REG_IGMP_PORT0_CONTROL + port, RTL8367C_IGMP_PORT0_CONTROL_ALLOW_REPORT_MASK, allow_report);
if(retVal != RT_ERR_OK)
return retVal;
}
else
{
retVal = rtl8367c_setAsicRegBits(RTL8367C_REG_IGMP_PORT8_CONTROL + port - 8, RTL8367C_IGMP_PORT0_CONTROL_ALLOW_REPORT_MASK, allow_report);
if(retVal != RT_ERR_OK)
return retVal;
}
return RT_ERR_OK;
}
/* Function Name:
* rtl8367c_getAsicIGMPReportRX
* Description:
* Get port-based Report packet RX allowance
* Input:
* port - port number
* Output:
* allow_report - allowance of Report packet RX, 1:Allow, 0:Drop
* Return:
* RT_ERR_OK - Success
* RT_ERR_PORT_ID - Error PORT ID
* RT_ERR_SMI - SMI access error
* Note:
* None
*/
ret_t rtl8367c_getAsicIGMPReportRX(rtk_uint32 port, rtk_uint32 *allow_report)
{
ret_t retVal;
rtk_uint32 value;
if(port > RTL8367C_PORTIDMAX)
return RT_ERR_PORT_ID;
if(port < 8)
{
/* Allow Report */
retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_IGMP_PORT0_CONTROL + port, RTL8367C_IGMP_PORT0_CONTROL_ALLOW_REPORT_MASK, &value);
if(retVal != RT_ERR_OK)
return retVal;
}
else
{
retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_IGMP_PORT8_CONTROL + port - 8, RTL8367C_IGMP_PORT0_CONTROL_ALLOW_REPORT_MASK, &value);
if(retVal != RT_ERR_OK)
return retVal;
}
*allow_report = value;
return RT_ERR_OK;
}
/* Function Name:
* rtl8367c_setAsicIGMPLeaveRX
* Description:
* Set port-based Leave packet RX allowance
* Input:
* port - port number
* allow_leave - allowance of Leave packet RX, 1:Allow, 0:Drop
* Output:
* None
* Return:
* RT_ERR_OK - Success
* RT_ERR_PORT_ID - Error PORT ID
* RT_ERR_SMI - SMI access error
* Note:
* None
*/
ret_t rtl8367c_setAsicIGMPLeaveRX(rtk_uint32 port, rtk_uint32 allow_leave)
{
ret_t retVal;
if(port > RTL8367C_PORTIDMAX)
return RT_ERR_PORT_ID;
if(port < 8)
{
/* Allow Leave */
retVal = rtl8367c_setAsicRegBits(RTL8367C_REG_IGMP_PORT0_CONTROL + port, RTL8367C_IGMP_PORT0_CONTROL_ALLOW_LEAVE_MASK, allow_leave);
if(retVal != RT_ERR_OK)
return retVal;
}
else
{
retVal = rtl8367c_setAsicRegBits(RTL8367C_REG_IGMP_PORT8_CONTROL + port - 8, RTL8367C_IGMP_PORT0_CONTROL_ALLOW_LEAVE_MASK, allow_leave);
if(retVal != RT_ERR_OK)
return retVal;
}
return RT_ERR_OK;
}
/* Function Name:
* rtl8367c_getAsicIGMPLeaveRX
* Description:
* Get port-based Leave packet RX allowance
* Input:
* port - port number
* Output:
* allow_leave - allowance of Leave packet RX, 1:Allow, 0:Drop
* Return:
* RT_ERR_OK - Success
* RT_ERR_PORT_ID - Error PORT ID
* RT_ERR_SMI - SMI access error
* Note:
* None
*/
ret_t rtl8367c_getAsicIGMPLeaveRX(rtk_uint32 port, rtk_uint32 *allow_leave)
{
ret_t retVal;
rtk_uint32 value;
if(port > RTL8367C_PORTIDMAX)
return RT_ERR_PORT_ID;
if(port < 8)
{
/* Allow Leave */
retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_IGMP_PORT0_CONTROL + port, RTL8367C_IGMP_PORT0_CONTROL_ALLOW_LEAVE_MASK, &value);
if(retVal != RT_ERR_OK)
return retVal;
}
else
{
retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_IGMP_PORT8_CONTROL + port - 8, RTL8367C_IGMP_PORT0_CONTROL_ALLOW_LEAVE_MASK, &value);
if(retVal != RT_ERR_OK)
return retVal;
}
*allow_leave = value;
return RT_ERR_OK;
}
/* Function Name:
* rtl8367c_setAsicIGMPMRPRX
* Description:
* Set port-based Multicast Routing Protocol packet RX allowance
* Input:
* port - port number
* allow_mrp - allowance of Multicast Routing Protocol packet RX, 1:Allow, 0:Drop
* Output:
* None
* Return:
* RT_ERR_OK - Success
* RT_ERR_PORT_ID - Error PORT ID
* RT_ERR_SMI - SMI access error
* Note:
* None
*/
ret_t rtl8367c_setAsicIGMPMRPRX(rtk_uint32 port, rtk_uint32 allow_mrp)
{
ret_t retVal;
if(port > RTL8367C_PORTIDMAX)
return RT_ERR_PORT_ID;
if(port < 8)
{
/* Allow Multicast Routing Protocol */
retVal = rtl8367c_setAsicRegBits(RTL8367C_REG_IGMP_PORT0_CONTROL + port, RTL8367C_IGMP_PORT0_CONTROL_ALLOW_MRP_MASK, allow_mrp);
if(retVal != RT_ERR_OK)
return retVal;
}
else
{
retVal = rtl8367c_setAsicRegBits(RTL8367C_REG_IGMP_PORT8_CONTROL + port - 8, RTL8367C_IGMP_PORT0_CONTROL_ALLOW_MRP_MASK, allow_mrp);
if(retVal != RT_ERR_OK)
return retVal;
}
return RT_ERR_OK;
}
/* Function Name:
* rtl8367c_getAsicIGMPMRPRX
* Description:
* Get port-based Multicast Routing Protocol packet RX allowance
* Input:
* port - port number
* Output:
* allow_mrp - allowance of Multicast Routing Protocol packet RX, 1:Allow, 0:Drop
* Return:
* RT_ERR_OK - Success
* RT_ERR_PORT_ID - Error PORT ID
* RT_ERR_SMI - SMI access error
* Note:
* None
*/
ret_t rtl8367c_getAsicIGMPMRPRX(rtk_uint32 port, rtk_uint32 *allow_mrp)
{
ret_t retVal;
rtk_uint32 value;
if(port > RTL8367C_PORTIDMAX)
return RT_ERR_PORT_ID;
/* Allow Multicast Routing Protocol */
if(port < 8)
{
retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_IGMP_PORT0_CONTROL + port, RTL8367C_IGMP_PORT0_CONTROL_ALLOW_MRP_MASK, &value);
if(retVal != RT_ERR_OK)
return retVal;
}
else
{
retVal = rtl8367c_getAsicRegBits(RTL8367C_REG_IGMP_PORT8_CONTROL + port - 8, RTL8367C_IGMP_PORT0_CONTROL_ALLOW_MRP_MASK, &value);
if(retVal != RT_ERR_OK)
return retVal;
}
*allow_mrp = value;
return RT_ERR_OK;
}
/* Function Name:
* rtl8367c_setAsicIGMPMcDataRX
* Description:
* Set port-based Multicast data packet RX allowance
* Input:
* port - port number
* allow_mcdata - allowance of Multicast data packet RX, 1:Allow, 0:Drop
* Output: