-
Notifications
You must be signed in to change notification settings - Fork 476
/
saihostif.h
1468 lines (1255 loc) · 44.3 KB
/
saihostif.h
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) 2014 Microsoft Open Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may obtain
* a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT
* LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS
* FOR A PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT.
*
* See the Apache Version 2.0 License for specific language governing
* permissions and limitations under the License.
*
* Microsoft would like to thank the following companies for their review and
* assistance with these files: Intel Corporation, Mellanox Technologies Ltd,
* Dell Products, L.P., Facebook, Inc., Marvell International Ltd.
*
* @file saihostif.h
*
* @brief This module defines SAI host interface
*
* @par Abstract
*
* This module defines SAI Host Interface which is responsible for
* creating/deleting Linux netdev corresponding to the host interface type.
* All the management operations of the netdevs such as changing IP address
* are outside the scope of SAI.
*/
#if !defined (__SAIHOSTIF_H_)
#define __SAIHOSTIF_H_
#include <saitypes.h>
/**
* @defgroup SAIHOSTINTF SAI - Host Interface specific API definitions
*
* @{
*/
/**
* @brief Defines maximum host interface name
*/
#define SAI_HOSTIF_NAME_SIZE 16
/**
* @brief Defines maximum length of generic netlink multicast group name
*/
#define SAI_HOSTIF_GENETLINK_MCGRP_NAME_SIZE 16
/**
* @brief Host interface trap group attributes
*/
typedef enum _sai_hostif_trap_group_attr_t
{
/**
* @brief Start of attributes
*/
SAI_HOSTIF_TRAP_GROUP_ATTR_START,
/**
* @brief Admin Mode
*
* @type bool
* @flags CREATE_AND_SET
* @default true
*/
SAI_HOSTIF_TRAP_GROUP_ATTR_ADMIN_STATE = SAI_HOSTIF_TRAP_GROUP_ATTR_START,
/**
* @brief CPU egress queue
*
* @type sai_uint32_t
* @flags CREATE_AND_SET
* @default 0
*/
SAI_HOSTIF_TRAP_GROUP_ATTR_QUEUE,
/**
* @brief SAI policer object id
*
* @type sai_object_id_t
* @flags CREATE_AND_SET
* @objects SAI_OBJECT_TYPE_POLICER
* @allownull true
* @default SAI_NULL_OBJECT_ID
*/
SAI_HOSTIF_TRAP_GROUP_ATTR_POLICER,
/**
* @brief Hostif trap group object stage
*
* @type sai_object_stage_t
* @flags CREATE_ONLY
* @default SAI_OBJECT_STAGE_BOTH
*/
SAI_HOSTIF_TRAP_GROUP_ATTR_OBJECT_STAGE,
/**
* @brief End of attributes
*/
SAI_HOSTIF_TRAP_GROUP_ATTR_END,
/** Start of custom range base */
SAI_HOSTIF_TRAP_GROUP_ATTR_CUSTOM_RANGE_START = 0x10000000,
/** End of custom range */
SAI_HOSTIF_TRAP_GROUP_ATTR_CUSTOM_RANGE_END
} sai_hostif_trap_group_attr_t;
/**
* @brief Create host interface trap group
*
* @param[out] hostif_trap_group_id Host interface trap group id
* @param[in] switch_id Switch object id
* @param[in] attr_count Number of attributes
* @param[in] attr_list Array of attributes
*
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
*/
typedef sai_status_t (*sai_create_hostif_trap_group_fn)(
_Out_ sai_object_id_t *hostif_trap_group_id,
_In_ sai_object_id_t switch_id,
_In_ uint32_t attr_count,
_In_ const sai_attribute_t *attr_list);
/**
* @brief Remove host interface trap group
*
* @param[in] hostif_trap_group_id Host interface trap group id
*
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
*/
typedef sai_status_t (*sai_remove_hostif_trap_group_fn)(
_In_ sai_object_id_t hostif_trap_group_id);
/**
* @brief Set host interface trap group attribute value.
*
* @param[in] hostif_trap_group_id Host interface trap group id
* @param[in] attr Attribute
*
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
*/
typedef sai_status_t (*sai_set_hostif_trap_group_attribute_fn)(
_In_ sai_object_id_t hostif_trap_group_id,
_In_ const sai_attribute_t *attr);
/**
* @brief Get host interface trap group attribute value.
*
* @param[in] hostif_trap_group_id Host interface trap group id
* @param[in] attr_count Number of attributes
* @param[inout] attr_list Array of attributes
*
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
*/
typedef sai_status_t (*sai_get_hostif_trap_group_attribute_fn)(
_In_ sai_object_id_t hostif_trap_group_id,
_In_ uint32_t attr_count,
_Inout_ sai_attribute_t *attr_list);
/**
* @brief Host interface trap type
*
* @flags ranges
*/
typedef enum _sai_hostif_trap_type_t
{
/**
* @brief Start of trap types
*/
SAI_HOSTIF_TRAP_TYPE_START = 0x00000000,
/* Control plane protocol */
/* Switch trap */
/** Default action is drop */
SAI_HOSTIF_TRAP_TYPE_STP = SAI_HOSTIF_TRAP_TYPE_START,
/** Default action is drop */
SAI_HOSTIF_TRAP_TYPE_LACP = 0x00000001,
/** Default action is drop */
SAI_HOSTIF_TRAP_TYPE_EAPOL = 0x00000002,
/** Default action is drop */
SAI_HOSTIF_TRAP_TYPE_LLDP = 0x00000003,
/** Default action is drop */
SAI_HOSTIF_TRAP_TYPE_PVRST = 0x00000004,
/** Default action is forward */
SAI_HOSTIF_TRAP_TYPE_IGMP_TYPE_QUERY = 0x00000005,
/** Default action is forward */
SAI_HOSTIF_TRAP_TYPE_IGMP_TYPE_LEAVE = 0x00000006,
/** Default action is forward */
SAI_HOSTIF_TRAP_TYPE_IGMP_TYPE_V1_REPORT = 0x00000007,
/** Default action is forward */
SAI_HOSTIF_TRAP_TYPE_IGMP_TYPE_V2_REPORT = 0x00000008,
/** Default action is forward */
SAI_HOSTIF_TRAP_TYPE_IGMP_TYPE_V3_REPORT = 0x00000009,
/** Default action is drop */
SAI_HOSTIF_TRAP_TYPE_SAMPLEPACKET = 0x0000000a,
/** Default action is drop */
SAI_HOSTIF_TRAP_TYPE_UDLD = 0x0000000b,
/** Default action is drop */
SAI_HOSTIF_TRAP_TYPE_CDP = 0x0000000c,
/** Default action is drop */
SAI_HOSTIF_TRAP_TYPE_VTP = 0x0000000d,
/** Default action is drop */
SAI_HOSTIF_TRAP_TYPE_DTP = 0x0000000e,
/** Default action is drop */
SAI_HOSTIF_TRAP_TYPE_PAGP = 0x0000000f,
/**
* @brief PTP traffic (EtherType = 0x88F7 or UDP dst port == 319 or UDP dst port == 320)
* (default packet action is drop)
*/
SAI_HOSTIF_TRAP_TYPE_PTP = 0x00000010,
/**
* @brief PTP packet sent from CPU with updated TX timestamp
* (default packet action is drop)
*/
SAI_HOSTIF_TRAP_TYPE_PTP_TX_EVENT = 0x00000011,
/**
* @brief DHCP traffic (UDP ports 67, 68)
* (default packet action is forward)
*/
SAI_HOSTIF_TRAP_TYPE_DHCP_L2 = 0x00000012,
/**
* @brief DHCPV6 traffic (UDP ports 546, 547)
* (default packet action is forward)
*/
SAI_HOSTIF_TRAP_TYPE_DHCPV6_L2 = 0x00000013,
/** Switch traps custom range start */
SAI_HOSTIF_TRAP_TYPE_SWITCH_CUSTOM_RANGE_BASE = 0x00001000,
/* Router traps */
/** Default packet action is forward */
SAI_HOSTIF_TRAP_TYPE_ARP_REQUEST = 0x00002000,
/** Default packet action is forward */
SAI_HOSTIF_TRAP_TYPE_ARP_RESPONSE = 0x00002001,
/**
* @brief DHCP traffic (UDP ports 67, 68), either L3 broadcast or unicast
* to local router IP address (default packet action is forward)
*/
SAI_HOSTIF_TRAP_TYPE_DHCP = 0x00002002,
/** Default packet action is forward */
SAI_HOSTIF_TRAP_TYPE_OSPF = 0x00002003,
/** Default packet action is forward */
SAI_HOSTIF_TRAP_TYPE_PIM = 0x00002004,
/** Default packet action is forward */
SAI_HOSTIF_TRAP_TYPE_VRRP = 0x00002005,
/** Default packet action is forward */
SAI_HOSTIF_TRAP_TYPE_DHCPV6 = 0x00002006,
/** Default packet action is forward */
SAI_HOSTIF_TRAP_TYPE_OSPFV6 = 0x00002007,
/** Default packet action is forward */
SAI_HOSTIF_TRAP_TYPE_VRRPV6 = 0x00002008,
/** Default packet action is forward */
SAI_HOSTIF_TRAP_TYPE_IPV6_NEIGHBOR_DISCOVERY = 0x00002009,
/** Default packet action is forward */
SAI_HOSTIF_TRAP_TYPE_IPV6_MLD_V1_V2 = 0x0000200a,
/** Default packet action is forward */
SAI_HOSTIF_TRAP_TYPE_IPV6_MLD_V1_REPORT = 0x0000200b,
/** Default packet action is forward */
SAI_HOSTIF_TRAP_TYPE_IPV6_MLD_V1_DONE = 0x0000200c,
/** Default packet action is forward */
SAI_HOSTIF_TRAP_TYPE_MLD_V2_REPORT = 0x0000200d,
/**
* @brief Unknown L3 multicast packets
* (default packet action is drop)
*/
SAI_HOSTIF_TRAP_TYPE_UNKNOWN_L3_MULTICAST = 0x0000200e,
/**
* @brief Source NAT miss packets
* (default packet action is drop)
*/
SAI_HOSTIF_TRAP_TYPE_SNAT_MISS = 0x0000200f,
/**
* @brief Destination NAT miss packets
* (default packet action is drop)
*/
SAI_HOSTIF_TRAP_TYPE_DNAT_MISS = 0x00002010,
/**
* @brief NAT hairpin packets
* (default packet action is drop)
*/
SAI_HOSTIF_TRAP_TYPE_NAT_HAIRPIN = 0x00002011,
/** Default packet action is forward */
SAI_HOSTIF_TRAP_TYPE_IPV6_NEIGHBOR_SOLICITATION = 0x00002012,
/** Default packet action is forward */
SAI_HOSTIF_TRAP_TYPE_IPV6_NEIGHBOR_ADVERTISEMENT = 0x00002013,
/**
* @brief Intermediate System-to-Intermediate System (IS-IS) protocol
*
* Traffic:
* L1 IS: 01:80:c2:00:00:14, All Level 1 Intermediate Systems Address
* L2 IS: 01:80:c2:00:00:15, All Level 2 Intermediate Systems Address
* All IS: 09:00:2b:00:00:05, All Intermediate System Network Entities address
*
* Default packet action is forward
*/
SAI_HOSTIF_TRAP_TYPE_ISIS = 0x00002014,
/**
* @brief Packets matching subnet routes with NH pointing to router interface
* i.e., no neighbor entry route is present
* (default packet action is trap)
*/
SAI_HOSTIF_TRAP_TYPE_NEIGHBOR_MISS = 0x00002015,
/** Router traps custom range start */
SAI_HOSTIF_TRAP_TYPE_ROUTER_CUSTOM_RANGE_BASE = 0x00003000,
/* Local IP traps */
/**
* @brief IP packets to local router IP address (routes with
* #SAI_ROUTE_ENTRY_ATTR_NEXT_HOP_ID = #SAI_SWITCH_ATTR_CPU_PORT)
* (default packet action is drop)
*/
SAI_HOSTIF_TRAP_TYPE_IP2ME = 0x00004000,
/**
* @brief SSH traffic (TCP dst port == 22) to local router IP address
* (default packet action is drop)
*/
SAI_HOSTIF_TRAP_TYPE_SSH = 0x00004001,
/**
* @brief SNMP traffic (UDP dst port == 161) to local router IP address
* (default packet action is drop)
*/
SAI_HOSTIF_TRAP_TYPE_SNMP = 0x00004002,
/**
* @brief BGP traffic (TCP src port == 179 or TCP dst port == 179) to local
* router IP address (default packet action is drop)
*/
SAI_HOSTIF_TRAP_TYPE_BGP = 0x00004003,
/**
* @brief BGPv6 traffic (TCP src port == 179 or TCP dst port == 179) to
* local router IP address (default packet action is drop)
*/
SAI_HOSTIF_TRAP_TYPE_BGPV6 = 0x00004004,
/**
* @brief BFD traffic (UDP dst port == 3784 or UDP dst port == 4784) to local
* router IP address (default packet action is drop)
*/
SAI_HOSTIF_TRAP_TYPE_BFD = 0x00004005,
/**
* @brief BFDV6 traffic (UDP dst port == 3784 or UDP dst port == 4784) to
* local router IP address (default packet action is drop)
*/
SAI_HOSTIF_TRAP_TYPE_BFDV6 = 0x00004006,
/**
* @brief Micro BFD traffic (UDP dst port == 6784) to local
* router IP address (default packet action is drop)
*/
SAI_HOSTIF_TRAP_TYPE_BFD_MICRO = 0x00004007,
/**
* @brief Micro BFDV6 traffic (UDP dst port == 6784) to local
* router IP address (default packet action is drop)
*/
SAI_HOSTIF_TRAP_TYPE_BFDV6_MICRO = 0x00004008,
/**
* @brief LDP traffic (TCP src port == 646 or TCP dst port == 646) to local
* router IP address or, (UDP dst port == 646) to the 'all routers on this
* subnet' group multicast address (224.0.0.2) (default packet action is drop)
*/
SAI_HOSTIF_TRAP_TYPE_LDP = 0x00004009,
/**
* @brief GNMI traffic (TCP dst port == 9339) to local router IP address
* (default packet action is drop)
*/
SAI_HOSTIF_TRAP_TYPE_GNMI = 0x0000400a,
/**
* @brief P4RT traffic (TCP dst port == 9559) to local router IP address
* (default packet action is drop)
*/
SAI_HOSTIF_TRAP_TYPE_P4RT = 0x0000400b,
/**
* @brief NTPCLIENT traffic (UDP/TCP src port == 123)
* to local router IP address (default packet action is drop)
*/
SAI_HOSTIF_TRAP_TYPE_NTPCLIENT = 0x0000400c,
/**
* @brief NTPSERVER traffic (UDP/TCP dst port == 123)
* to local router IP address (default packet action is drop)
*/
SAI_HOSTIF_TRAP_TYPE_NTPSERVER = 0x0000400d,
/**
* @brief HTTPCLIENT traffic (TCP src port == 80)
* to local router IP address (default packet action is drop)
*/
SAI_HOSTIF_TRAP_TYPE_HTTPCLIENT = 0x0000400e,
/**
* @brief HTTPSERVER traffic (TCP dst port == 80)
* to local router IP address (default packet action is drop)
*/
SAI_HOSTIF_TRAP_TYPE_HTTPSERVER = 0x0000400f,
/** Local IP traps custom range start */
SAI_HOSTIF_TRAP_TYPE_LOCAL_IP_CUSTOM_RANGE_BASE = 0x00005000,
/* Pipeline exceptions */
/**
* @brief Packets size exceeds the router interface MTU size
* (default packet action is drop)
*/
SAI_HOSTIF_TRAP_TYPE_L3_MTU_ERROR = 0x00006000,
/**
* @brief Packets with TTL 0 or 1
* (default packet action is drop)
*/
SAI_HOSTIF_TRAP_TYPE_TTL_ERROR = 0x00006001,
/**
* @brief Packets trapped when station move is observed with static FDB entry
* (default packet action is drop)
*/
SAI_HOSTIF_TRAP_TYPE_STATIC_FDB_MOVE = 0x00006002,
/* Pipeline discards. For the following traps, packet action is either drop or trap */
/**
* @brief Packets discarded due to egress buffer full
* (default packet action is drop)
*/
SAI_HOSTIF_TRAP_TYPE_PIPELINE_DISCARD_EGRESS_BUFFER = 0x00007000,
/**
* @brief Packets discarded by WRED
* (default packet action is drop)
*/
SAI_HOSTIF_TRAP_TYPE_PIPELINE_DISCARD_WRED = 0x00007001,
/**
* @brief Packets discarded due to router causes, such as
* header checksum, router interface is down,
* matching a route with drop action (black holes), etc.
* (default packet action is drop)
*/
SAI_HOSTIF_TRAP_TYPE_PIPELINE_DISCARD_ROUTER = 0x00007002,
/**
* @brief MPLS packets with expiring TTL value of 1
* (default packet action is drop)
*/
SAI_HOSTIF_TRAP_TYPE_MPLS_TTL_ERROR = 0x00008000,
/**
* @brief MPLS packet with router alert label
* (default packet action is forward)
*/
SAI_HOSTIF_TRAP_TYPE_MPLS_ROUTER_ALERT_LABEL = 0x00008001,
/**
* @brief MPLS packets discarded due to label lookup miss
* (default packet action is drop)
*/
SAI_HOSTIF_TRAP_TYPE_MPLS_LABEL_LOOKUP_MISS = 0x00008002,
/** Exception traps custom range start */
SAI_HOSTIF_TRAP_TYPE_CUSTOM_EXCEPTION_RANGE_BASE = 0x00009000,
/**
* @brief End of trap types
*/
SAI_HOSTIF_TRAP_TYPE_END = 0x0000a000
} sai_hostif_trap_type_t;
/**
* @brief Host interface trap attributes
*/
typedef enum _sai_hostif_trap_attr_t
{
/**
* @brief Start of attributes
*/
SAI_HOSTIF_TRAP_ATTR_START,
/**
* @brief Host interface trap type
*
* @type sai_hostif_trap_type_t
* @flags MANDATORY_ON_CREATE | CREATE_ONLY | KEY
*/
SAI_HOSTIF_TRAP_ATTR_TRAP_TYPE = SAI_HOSTIF_TRAP_ATTR_START,
/**
* @brief Trap action
*
* @type sai_packet_action_t
* @flags MANDATORY_ON_CREATE | CREATE_AND_SET
*/
SAI_HOSTIF_TRAP_ATTR_PACKET_ACTION,
/**
* @brief Trap priority.
*
* This is equivalent to ACL entry priority #SAI_ACL_ENTRY_ATTR_PRIORITY.
*
* @type sai_uint32_t
* @flags CREATE_AND_SET
* @default attrvalue SAI_SWITCH_ATTR_ACL_ENTRY_MINIMUM_PRIORITY
* @validonly SAI_HOSTIF_TRAP_ATTR_PACKET_ACTION == SAI_PACKET_ACTION_TRAP or SAI_HOSTIF_TRAP_ATTR_PACKET_ACTION == SAI_PACKET_ACTION_COPY
*/
SAI_HOSTIF_TRAP_ATTR_TRAP_PRIORITY,
/**
* @brief List of SAI ports to be excluded (disabled) from the trap generation
*
* @type sai_object_list_t
* @flags CREATE_AND_SET
* @objects SAI_OBJECT_TYPE_PORT
* @default empty
* @validonly SAI_HOSTIF_TRAP_ATTR_PACKET_ACTION == SAI_PACKET_ACTION_TRAP or SAI_HOSTIF_TRAP_ATTR_PACKET_ACTION == SAI_PACKET_ACTION_COPY
*/
SAI_HOSTIF_TRAP_ATTR_EXCLUDE_PORT_LIST,
/**
* @brief Trap group ID for the trap
*
* @type sai_object_id_t
* @flags CREATE_AND_SET
* @objects SAI_OBJECT_TYPE_HOSTIF_TRAP_GROUP
* @default attrvalue SAI_SWITCH_ATTR_DEFAULT_TRAP_GROUP
* @validonly SAI_HOSTIF_TRAP_ATTR_PACKET_ACTION == SAI_PACKET_ACTION_TRAP or SAI_HOSTIF_TRAP_ATTR_PACKET_ACTION == SAI_PACKET_ACTION_COPY
*/
SAI_HOSTIF_TRAP_ATTR_TRAP_GROUP,
/**
* @brief Mirror session for the trap
*
* @type sai_object_list_t
* @flags CREATE_AND_SET
* @objects SAI_OBJECT_TYPE_MIRROR_SESSION
* @default empty
*/
SAI_HOSTIF_TRAP_ATTR_MIRROR_SESSION,
/**
* @brief Attach a counter
*
* When it is empty, then packet hits won't be counted
*
* @type sai_object_id_t
* @flags CREATE_AND_SET
* @objects SAI_OBJECT_TYPE_COUNTER
* @allownull true
* @default SAI_NULL_OBJECT_ID
*/
SAI_HOSTIF_TRAP_ATTR_COUNTER_ID,
/**
* @brief End of attributes
*/
SAI_HOSTIF_TRAP_ATTR_END,
/** Custom range start */
SAI_HOSTIF_TRAP_ATTR_CUSTOM_RANGE_START = 0x10000000,
/** Custom range end */
SAI_HOSTIF_TRAP_ATTR_CUSTOM_RANGE_END
} sai_hostif_trap_attr_t;
/**
* @brief Create host interface trap
*
* @param[out] hostif_trap_id Host interface trap id
* @param[in] switch_id Switch object id
* @param[in] attr_count Number of attributes
* @param[in] attr_list Array of attributes
*
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
*/
typedef sai_status_t (*sai_create_hostif_trap_fn)(
_Out_ sai_object_id_t *hostif_trap_id,
_In_ sai_object_id_t switch_id,
_In_ uint32_t attr_count,
_In_ const sai_attribute_t *attr_list);
/**
* @brief Remove host interface trap
*
* @param[in] hostif_trap_id Host interface trap id
*
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
*/
typedef sai_status_t (*sai_remove_hostif_trap_fn)(
_In_ sai_object_id_t hostif_trap_id);
/**
* @brief Set trap attribute value.
*
* @param[in] hostif_trap_id Host interface trap id
* @param[in] attr Attribute
*
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
*/
typedef sai_status_t (*sai_set_hostif_trap_attribute_fn)(
_In_ sai_object_id_t hostif_trap_id,
_In_ const sai_attribute_t *attr);
/**
* @brief Get trap attribute value.
*
* @param[in] hostif_trap_id Host interface trap id
* @param[in] attr_count Number of attributes
* @param[inout] attr_list Array of attributes
*
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
*/
typedef sai_status_t (*sai_get_hostif_trap_attribute_fn)(
_In_ sai_object_id_t hostif_trap_id,
_In_ uint32_t attr_count,
_Inout_ sai_attribute_t *attr_list);
/**
* @brief Host interface user defined trap type
*
* User defined traps action is controlled by the referencing object.
* For example, ACL entry with packet action trap and user trap object ID
*/
typedef enum _sai_hostif_user_defined_trap_type_t
{
/**
* @brief Start of user defined trap types
*/
SAI_HOSTIF_USER_DEFINED_TRAP_TYPE_START = 0x00000000,
/** Router traps */
SAI_HOSTIF_USER_DEFINED_TRAP_TYPE_ROUTER = SAI_HOSTIF_USER_DEFINED_TRAP_TYPE_START,
/**
* @brief Neighbor table traps
*
* Generated by neighbor table entry hit with action trap/log, or by neighbor table miss
*/
SAI_HOSTIF_USER_DEFINED_TRAP_TYPE_NEIGHBOR,
/** @ignore - for backward compatibility */
SAI_HOSTIF_USER_DEFINED_TRAP_TYPE_NEIGH = SAI_HOSTIF_USER_DEFINED_TRAP_TYPE_NEIGHBOR,
/** ACL traps */
SAI_HOSTIF_USER_DEFINED_TRAP_TYPE_ACL,
/** FDB traps */
SAI_HOSTIF_USER_DEFINED_TRAP_TYPE_FDB,
/** In Segment Entry traps */
SAI_HOSTIF_USER_DEFINED_TRAP_TYPE_INSEG_ENTRY,
/** Traps to be associated with TAM collector */
SAI_HOSTIF_USER_DEFINED_TRAP_TYPE_TAM,
/** Custom range base */
SAI_HOSTIF_USER_DEFINED_TRAP_TYPE_CUSTOM_RANGE_BASE = 0x00001000,
/**
* @brief End of user defined trap types
*/
SAI_HOSTIF_USER_DEFINED_TRAP_TYPE_END,
} sai_hostif_user_defined_trap_type_t;
/**
* @brief Host interface user defined trap attributes
*/
typedef enum _sai_hostif_user_defined_trap_attr_t
{
/**
* @brief Start of attributes
*/
SAI_HOSTIF_USER_DEFINED_TRAP_ATTR_START,
/**
* @brief Host interface user defined trap type
*
* It is valid to create multiple instances of the same user defined type
*
* @type sai_hostif_user_defined_trap_type_t
* @flags MANDATORY_ON_CREATE | CREATE_ONLY
*/
SAI_HOSTIF_USER_DEFINED_TRAP_ATTR_TYPE = SAI_HOSTIF_USER_DEFINED_TRAP_ATTR_START,
/**
* @brief Trap priority. This is equivalent to ACL entry priority
* #SAI_ACL_ENTRY_ATTR_PRIORITY
*
* @type sai_uint32_t
* @flags CREATE_AND_SET
* @default attrvalue SAI_SWITCH_ATTR_ACL_ENTRY_MINIMUM_PRIORITY
*/
SAI_HOSTIF_USER_DEFINED_TRAP_ATTR_TRAP_PRIORITY,
/**
* @brief Trap group ID for the trap
*
* @type sai_object_id_t
* @flags CREATE_AND_SET
* @objects SAI_OBJECT_TYPE_HOSTIF_TRAP_GROUP
* @default attrvalue SAI_SWITCH_ATTR_DEFAULT_TRAP_GROUP
*/
SAI_HOSTIF_USER_DEFINED_TRAP_ATTR_TRAP_GROUP,
/**
* @brief End of attributes
*/
SAI_HOSTIF_USER_DEFINED_TRAP_ATTR_END,
/** Custom range start */
SAI_HOSTIF_USER_DEFINED_TRAP_ATTR_CUSTOM_RANGE_START = 0x10000000,
/** Custom range end */
SAI_HOSTIF_USER_DEFINED_TRAP_ATTR_CUSTOM_RANGE_END
} sai_hostif_user_defined_trap_attr_t;
/**
* @brief Create host interface user defined trap
*
* @param[out] hostif_user_defined_trap_id Host interface user defined trap id
* @param[in] switch_id Switch object id
* @param[in] attr_count Number of attributes
* @param[in] attr_list Array of attributes
*
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
*/
typedef sai_status_t (*sai_create_hostif_user_defined_trap_fn)(
_Out_ sai_object_id_t *hostif_user_defined_trap_id,
_In_ sai_object_id_t switch_id,
_In_ uint32_t attr_count,
_In_ const sai_attribute_t *attr_list);
/**
* @brief Remove host interface user defined trap
*
* @param[in] hostif_user_defined_trap_id Host interface user defined trap id
*
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
*/
typedef sai_status_t (*sai_remove_hostif_user_defined_trap_fn)(
_In_ sai_object_id_t hostif_user_defined_trap_id);
/**
* @brief Set user defined trap attribute value.
*
* @param[in] hostif_user_defined_trap_id Host interface user defined trap id
* @param[in] attr Attribute
*
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
*/
typedef sai_status_t (*sai_set_hostif_user_defined_trap_attribute_fn)(
_In_ sai_object_id_t hostif_user_defined_trap_id,
_In_ const sai_attribute_t *attr);
/**
* @brief Get user defined trap attribute value.
*
* @param[in] hostif_user_defined_trap_id Host interface user defined trap id
* @param[in] attr_count Number of attributes
* @param[inout] attr_list Array of attributes
*
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
*/
typedef sai_status_t (*sai_get_hostif_user_defined_trap_attribute_fn)(
_In_ sai_object_id_t hostif_user_defined_trap_id,
_In_ uint32_t attr_count,
_Inout_ sai_attribute_t *attr_list);
/**
* @brief Attribute data for SAI_HOSTIF_ATTR_TYPE
*/
typedef enum _sai_hostif_type_t
{
/** Netdevice */
SAI_HOSTIF_TYPE_NETDEV,
/** File descriptor */
SAI_HOSTIF_TYPE_FD,
/** Generic netlink */
SAI_HOSTIF_TYPE_GENETLINK
} sai_hostif_type_t;
/**
* @brief Attribute data for SAI_HOSTIF_ATTR_VLAN_TAG
*/
typedef enum _sai_hostif_vlan_tag_t
{
/**
* @brief Strip vlan tag
* Strip vlan tag from the incoming packet
* when delivering the packet to host interface.
*/
SAI_HOSTIF_VLAN_TAG_STRIP,
/**
* @brief Keep vlan tag.
* When incoming packet is untagged, add PVID tag to the packet when delivering
* the packet to host interface.
*/
SAI_HOSTIF_VLAN_TAG_KEEP,
/**
* @brief Keep the packet same as the incoming packet
*
* The packet delivered to host interface is the same as the original packet.
* When the host interface is PORT and LAG, the packet delivered to host interface is the
* same as the original packet seen by the PORT and LAG.
* When the host interface is VLAN, the packet delivered to host interface will not have tag.
*/
SAI_HOSTIF_VLAN_TAG_ORIGINAL,
} sai_hostif_vlan_tag_t;
/**
* @brief Host interface attribute IDs
*/
typedef enum _sai_hostif_attr_t
{
/**
* @brief Start of attributes
*/
SAI_HOSTIF_ATTR_START,
/**
* @brief Host interface type
*
* @type sai_hostif_type_t
* @flags MANDATORY_ON_CREATE | CREATE_ONLY
*/
SAI_HOSTIF_ATTR_TYPE = SAI_HOSTIF_ATTR_START,
/**
* @brief Host interface object ID
*
* Port netdev will be created when object type is SAI_OBJECT_TYPE_PORT
* LAG netdev will be created when object type is SAI_OBJECT_TYPE_LAG
* VLAN netdev will be created when object type is SAI_OBJECT_TYPE_VLAN
* System Port netdev will be created when object type is SAI_OBJECT_TYPE_SYSTEM_PORT
*
* @type sai_object_id_t
* @flags MANDATORY_ON_CREATE | CREATE_ONLY
* @objects SAI_OBJECT_TYPE_PORT, SAI_OBJECT_TYPE_LAG, SAI_OBJECT_TYPE_VLAN, SAI_OBJECT_TYPE_SYSTEM_PORT
* @condition SAI_HOSTIF_ATTR_TYPE == SAI_HOSTIF_TYPE_NETDEV
*/
SAI_HOSTIF_ATTR_OBJ_ID,
/**
* @brief Name [char[SAI_HOSTIF_NAME_SIZE]]
*
* The maximum number of characters for the name is SAI_HOSTIF_NAME_SIZE - 1 since
* it needs the terminating null byte ('\0') at the end.
*
* If Hostif is a generic netlink, this indicates the generic netlink family name.
*
* @type char
* @flags MANDATORY_ON_CREATE | CREATE_ONLY
* @condition SAI_HOSTIF_ATTR_TYPE == SAI_HOSTIF_TYPE_NETDEV or SAI_HOSTIF_ATTR_TYPE == SAI_HOSTIF_TYPE_GENETLINK
*/
SAI_HOSTIF_ATTR_NAME,
/**
* @brief Set the operational status for this host interface
*
* @type bool
* @flags CREATE_AND_SET
* @default false
*/
SAI_HOSTIF_ATTR_OPER_STATUS,
/**
* @brief Set the queue index to be used for packets going out through this interface
*
* @type sai_uint32_t
* @flags CREATE_AND_SET
* @default 0
*/
SAI_HOSTIF_ATTR_QUEUE,
/**
* @brief Strip/keep vlan tag for received packet
*
* @type sai_hostif_vlan_tag_t
* @flags CREATE_AND_SET
* @default SAI_HOSTIF_VLAN_TAG_STRIP
* @validonly SAI_HOSTIF_ATTR_TYPE == SAI_HOSTIF_TYPE_NETDEV
*/
SAI_HOSTIF_ATTR_VLAN_TAG,
/**
* @brief Name [char[SAI_HOSTIF_GENETLINK_MCGRP_NAME_SIZE]]
*
* The maximum number of characters for the name is SAI_HOSTIF_GENETLINK_MCGRP_NAME_SIZE - 1
* Set the Generic netlink multicast group name on which the packets/buffers
* are received on this host interface
*
* @type char
* @flags MANDATORY_ON_CREATE | CREATE_ONLY
* @condition SAI_HOSTIF_ATTR_TYPE == SAI_HOSTIF_TYPE_GENETLINK
*/
SAI_HOSTIF_ATTR_GENETLINK_MCGRP_NAME,
/**
* @brief End of attributes
*/
SAI_HOSTIF_ATTR_END,
/** Custom range base value */
SAI_HOSTIF_ATTR_CUSTOM_RANGE_START = 0x10000000,
/** End of custom range base */
SAI_HOSTIF_ATTR_CUSTOM_RANGE_END
} sai_hostif_attr_t;
/**
* @brief Create host interface
*
* @param[out] hostif_id Host interface id
* @param[in] switch_id Switch object id
* @param[in] attr_count Number of attributes
* @param[in] attr_list Array of attributes
*
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
*/
typedef sai_status_t (*sai_create_hostif_fn)(
_Out_ sai_object_id_t *hostif_id,
_In_ sai_object_id_t switch_id,
_In_ uint32_t attr_count,
_In_ const sai_attribute_t *attr_list);
/**
* @brief Remove host interface
*
* @param[in] hostif_id Host interface id
*
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
*/