From 47031f23684d6aa458780f28326a0840f1845f7f Mon Sep 17 00:00:00 2001 From: Roy Date: Tue, 14 Apr 2026 22:12:46 +0000 Subject: [PATCH] Add disable vlan checks attributes to Alpine --- dataplane/apigen/docparser/docparser.go | 11 ++++- dataplane/proto/sai/common.pb.go | 26 ++++++++-- dataplane/proto/sai/common.proto | 2 + dataplane/proto/sai/switch.pb.go | 64 +++++++++++++++++++++---- dataplane/proto/sai/switch.proto | 6 +++ dataplane/saiserver/switch.go | 2 + dataplane/saiserver/switch_test.go | 2 + dataplane/standalone/sai/enum.cc | 12 +++++ dataplane/standalone/sai/switch.cc | 18 +++++++ patches/sai.patch | 30 ++++++++++++ 10 files changed, 160 insertions(+), 13 deletions(-) diff --git a/dataplane/apigen/docparser/docparser.go b/dataplane/apigen/docparser/docparser.go index b0cc0e78d..6c597276a 100644 --- a/dataplane/apigen/docparser/docparser.go +++ b/dataplane/apigen/docparser/docparser.go @@ -98,7 +98,9 @@ type Paragraph struct { // SimpleSect contains a description of an element. type SimpleSect struct { - Para string `xml:"para"` + Para struct { + InnerXML string `xml:",innerxml"` + } `xml:"para"` } // ParseSAIXMLDir parses all the SAI Doxygen XML files in a directory. @@ -149,10 +151,15 @@ func memberToAttrInfo(enum MemberDef) (*Attr, error) { trimStr := strings.TrimSuffix(strings.TrimPrefix(enum.Name, "_"), "_t") + "_" for i, value := range enum.EnumValues { + tagRegex := regexp.MustCompile(`<[^>]*>`) var canCreate, canRead, canSet bool var saiType string for _, details := range value.DetailedDescription.Paragraph.SimpleSect { - annotation := strings.TrimSpace(details.Para) + // Handle nested XML tags by capturing raw content and then removing all + // tags using regex. + annotation := details.Para.InnerXML + annotation = tagRegex.ReplaceAllString(annotation, "") + annotation = strings.TrimSpace(annotation) switch { case strings.HasPrefix(annotation, "@@type"): saiType = strings.TrimSpace(strings.TrimPrefix(annotation, "@@type")) diff --git a/dataplane/proto/sai/common.pb.go b/dataplane/proto/sai/common.pb.go index c4a9bf4a4..fad2c5ace 100644 --- a/dataplane/proto/sai/common.pb.go +++ b/dataplane/proto/sai/common.pb.go @@ -29189,6 +29189,8 @@ type SwitchAttribute struct { SupportedDebugCounterTypeList []DebugCounterType `protobuf:"varint,222,rep,packed,name=supported_debug_counter_type_list,json=supportedDebugCounterTypeList,proto3,enum=lemming.dataplane.sai.DebugCounterType" json:"supported_debug_counter_type_list,omitempty"` SupportedIngressDropReasonList []InDropReason `protobuf:"varint,223,rep,packed,name=supported_ingress_drop_reason_list,json=supportedIngressDropReasonList,proto3,enum=lemming.dataplane.sai.InDropReason" json:"supported_ingress_drop_reason_list,omitempty"` AvailableSwitchIngressDropCounters *uint32 `protobuf:"varint,224,opt,name=available_switch_ingress_drop_counters,json=availableSwitchIngressDropCounters,proto3,oneof" json:"available_switch_ingress_drop_counters,omitempty"` + DisableIngressVlanChecks *bool `protobuf:"varint,225,opt,name=disable_ingress_vlan_checks,json=disableIngressVlanChecks,proto3,oneof" json:"disable_ingress_vlan_checks,omitempty"` + DisableEgressVlanChecks *bool `protobuf:"varint,226,opt,name=disable_egress_vlan_checks,json=disableEgressVlanChecks,proto3,oneof" json:"disable_egress_vlan_checks,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -30791,6 +30793,20 @@ func (x *SwitchAttribute) GetAvailableSwitchIngressDropCounters() uint32 { return 0 } +func (x *SwitchAttribute) GetDisableIngressVlanChecks() bool { + if x != nil && x.DisableIngressVlanChecks != nil { + return *x.DisableIngressVlanChecks + } + return false +} + +func (x *SwitchAttribute) GetDisableEgressVlanChecks() bool { + if x != nil && x.DisableEgressVlanChecks != nil { + return *x.DisableEgressVlanChecks + } + return false +} + type SwitchTunnelAttribute struct { state protoimpl.MessageState `protogen:"open.v1"` TunnelType *TunnelType `protobuf:"varint,1,opt,name=tunnel_type,json=tunnelType,proto3,enum=lemming.dataplane.sai.TunnelType,oneof" json:"tunnel_type,omitempty"` @@ -36642,7 +36658,7 @@ const file_dataplane_proto_sai_common_proto_rawDesc = "" + "\x05state\x18\x03 \x01(\x0e2#.lemming.dataplane.sai.StpPortStateB\x06\xf0ܓ\xad\x0f\x03H\x02R\x05state\x88\x01\x01B\x06\n" + "\x04_stpB\x0e\n" + "\f_bridge_portB\b\n" + - "\x06_state\"\xe3\xab\x01\n" + + "\x06_state\"\xbe\xad\x01\n" + "\x0fSwitchAttribute\x12@\n" + "\x16number_of_active_ports\x18\x01 \x01(\rB\x06\xf0ܓ\xad\x0f\x01H\x00R\x13numberOfActivePorts\x88\x01\x01\x12M\n" + "\x1dmax_number_of_supported_ports\x18\x02 \x01(\rB\x06\xf0ܓ\xad\x0f\x02H\x01R\x19maxNumberOfSupportedPorts\x88\x01\x01\x12#\n" + @@ -36880,7 +36896,9 @@ const file_dataplane_proto_sai_common_proto_rawDesc = "" + "\x16selective_counter_list\x18\xdd\x01 \x03(\x04B\a\xf0ܓ\xad\x0f\xed\x01R\x14selectiveCounterList\x12{\n" + "!supported_debug_counter_type_list\x18\xde\x01 \x03(\x0e2'.lemming.dataplane.sai.DebugCounterTypeB\a\xf0ܓ\xad\x0f\xc0\x10R\x1dsupportedDebugCounterTypeList\x12y\n" + "\"supported_ingress_drop_reason_list\x18\xdf\x01 \x03(\x0e2#.lemming.dataplane.sai.InDropReasonB\a\xf0ܓ\xad\x0f\xc1\x10R\x1esupportedIngressDropReasonList\x12b\n" + - "&available_switch_ingress_drop_counters\x18\xe0\x01 \x01(\rB\a\xf0ܓ\xad\x0f\xc6\x10H\xc0\x01R\"availableSwitchIngressDropCounters\x88\x01\x01B\x19\n" + + "&available_switch_ingress_drop_counters\x18\xe0\x01 \x01(\rB\a\xf0ܓ\xad\x0f\xc6\x10H\xc0\x01R\"availableSwitchIngressDropCounters\x88\x01\x01\x12M\n" + + "\x1bdisable_ingress_vlan_checks\x18\xe1\x01 \x01(\bB\a\xf0ܓ\xad\x0f\xee\x01H\xc1\x01R\x18disableIngressVlanChecks\x88\x01\x01\x12K\n" + + "\x1adisable_egress_vlan_checks\x18\xe2\x01 \x01(\bB\a\xf0ܓ\xad\x0f\xef\x01H\xc2\x01R\x17disableEgressVlanChecks\x88\x01\x01B\x19\n" + "\x17_number_of_active_portsB \n" + "\x1e_max_number_of_supported_portsB\x0f\n" + "\r_port_max_mtuB\v\n" + @@ -37077,7 +37095,9 @@ const file_dataplane_proto_sai_common_proto_rawDesc = "" + "\x1c_available_icmp_echo_sessionB\x18\n" + "\x16_max_icmp_echo_sessionB\x13\n" + "\x11_stats_count_modeB)\n" + - "'_available_switch_ingress_drop_counters\"\xda\n" + + "'_available_switch_ingress_drop_countersB\x1e\n" + + "\x1c_disable_ingress_vlan_checksB\x1d\n" + + "\x1b_disable_egress_vlan_checks\"\xda\n" + "\n" + "\x15SwitchTunnelAttribute\x12O\n" + "\vtunnel_type\x18\x01 \x01(\x0e2!.lemming.dataplane.sai.TunnelTypeB\x06\xf0ܓ\xad\x0f\x01H\x00R\n" + diff --git a/dataplane/proto/sai/common.proto b/dataplane/proto/sai/common.proto index c95f6b99d..5d4b74392 100644 --- a/dataplane/proto/sai/common.proto +++ b/dataplane/proto/sai/common.proto @@ -4570,6 +4570,8 @@ message SwitchAttribute { repeated DebugCounterType supported_debug_counter_type_list = 222 [(attr_enum_value) = 2112]; repeated InDropReason supported_ingress_drop_reason_list = 223 [(attr_enum_value) = 2113]; optional uint32 available_switch_ingress_drop_counters = 224 [(attr_enum_value) = 2118]; + optional bool disable_ingress_vlan_checks = 225 [(attr_enum_value) = 238]; + optional bool disable_egress_vlan_checks = 226 [(attr_enum_value) = 239]; } message SwitchTunnelAttribute { diff --git a/dataplane/proto/sai/switch.pb.go b/dataplane/proto/sai/switch.pb.go index 4f1e2052a..588e916ab 100644 --- a/dataplane/proto/sai/switch.pb.go +++ b/dataplane/proto/sai/switch.pb.go @@ -262,6 +262,8 @@ const ( SwitchAttr_SWITCH_ATTR_MAX_ICMP_ECHO_SESSION SwitchAttr = 235 SwitchAttr_SWITCH_ATTR_STATS_COUNT_MODE SwitchAttr = 236 SwitchAttr_SWITCH_ATTR_SELECTIVE_COUNTER_LIST SwitchAttr = 237 + SwitchAttr_SWITCH_ATTR_DISABLE_INGRESS_VLAN_CHECKS SwitchAttr = 238 + SwitchAttr_SWITCH_ATTR_DISABLE_EGRESS_VLAN_CHECKS SwitchAttr = 239 ) // Enum value maps for SwitchAttr. @@ -505,6 +507,8 @@ var ( 235: "SWITCH_ATTR_MAX_ICMP_ECHO_SESSION", 236: "SWITCH_ATTR_STATS_COUNT_MODE", 237: "SWITCH_ATTR_SELECTIVE_COUNTER_LIST", + 238: "SWITCH_ATTR_DISABLE_INGRESS_VLAN_CHECKS", + 239: "SWITCH_ATTR_DISABLE_EGRESS_VLAN_CHECKS", } SwitchAttr_value = map[string]int32{ "SWITCH_ATTR_UNSPECIFIED": 0, @@ -745,6 +749,8 @@ var ( "SWITCH_ATTR_MAX_ICMP_ECHO_SESSION": 235, "SWITCH_ATTR_STATS_COUNT_MODE": 236, "SWITCH_ATTR_SELECTIVE_COUNTER_LIST": 237, + "SWITCH_ATTR_DISABLE_INGRESS_VLAN_CHECKS": 238, + "SWITCH_ATTR_DISABLE_EGRESS_VLAN_CHECKS": 239, } ) @@ -953,6 +959,8 @@ type CreateSwitchRequest struct { PoeDeviceList []uint64 `protobuf:"varint,92,rep,packed,name=poe_device_list,json=poeDeviceList,proto3" json:"poe_device_list,omitempty"` StatsCountMode *StatsCountMode `protobuf:"varint,93,opt,name=stats_count_mode,json=statsCountMode,proto3,enum=lemming.dataplane.sai.StatsCountMode,oneof" json:"stats_count_mode,omitempty"` SelectiveCounterList []uint64 `protobuf:"varint,94,rep,packed,name=selective_counter_list,json=selectiveCounterList,proto3" json:"selective_counter_list,omitempty"` + DisableIngressVlanChecks *bool `protobuf:"varint,95,opt,name=disable_ingress_vlan_checks,json=disableIngressVlanChecks,proto3,oneof" json:"disable_ingress_vlan_checks,omitempty"` + DisableEgressVlanChecks *bool `protobuf:"varint,96,opt,name=disable_egress_vlan_checks,json=disableEgressVlanChecks,proto3,oneof" json:"disable_egress_vlan_checks,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -1645,6 +1653,20 @@ func (x *CreateSwitchRequest) GetSelectiveCounterList() []uint64 { return nil } +func (x *CreateSwitchRequest) GetDisableIngressVlanChecks() bool { + if x != nil && x.DisableIngressVlanChecks != nil { + return *x.DisableIngressVlanChecks + } + return false +} + +func (x *CreateSwitchRequest) GetDisableEgressVlanChecks() bool { + if x != nil && x.DisableEgressVlanChecks != nil { + return *x.DisableEgressVlanChecks + } + return false +} + type CreateSwitchResponse struct { state protoimpl.MessageState `protogen:"open.v1"` Oid uint64 `protobuf:"varint,1,opt,name=oid,proto3" json:"oid,omitempty"` @@ -1852,6 +1874,8 @@ type SetSwitchAttributeRequest struct { PoeDeviceList []uint64 `protobuf:"varint,79,rep,packed,name=poe_device_list,json=poeDeviceList,proto3" json:"poe_device_list,omitempty"` StatsCountMode *StatsCountMode `protobuf:"varint,80,opt,name=stats_count_mode,json=statsCountMode,proto3,enum=lemming.dataplane.sai.StatsCountMode,oneof" json:"stats_count_mode,omitempty"` SelectiveCounterList []uint64 `protobuf:"varint,81,rep,packed,name=selective_counter_list,json=selectiveCounterList,proto3" json:"selective_counter_list,omitempty"` + DisableIngressVlanChecks *bool `protobuf:"varint,82,opt,name=disable_ingress_vlan_checks,json=disableIngressVlanChecks,proto3,oneof" json:"disable_ingress_vlan_checks,omitempty"` + DisableEgressVlanChecks *bool `protobuf:"varint,83,opt,name=disable_egress_vlan_checks,json=disableEgressVlanChecks,proto3,oneof" json:"disable_egress_vlan_checks,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -2453,6 +2477,20 @@ func (x *SetSwitchAttributeRequest) GetSelectiveCounterList() []uint64 { return nil } +func (x *SetSwitchAttributeRequest) GetDisableIngressVlanChecks() bool { + if x != nil && x.DisableIngressVlanChecks != nil { + return *x.DisableIngressVlanChecks + } + return false +} + +func (x *SetSwitchAttributeRequest) GetDisableEgressVlanChecks() bool { + if x != nil && x.DisableEgressVlanChecks != nil { + return *x.DisableEgressVlanChecks + } + return false +} + type SetSwitchAttributeResponse struct { state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields @@ -3957,7 +3995,7 @@ var File_dataplane_proto_sai_switch_proto protoreflect.FileDescriptor const file_dataplane_proto_sai_switch_proto_rawDesc = "" + "\n" + - " dataplane/proto/sai/switch.proto\x12\x15lemming.dataplane.sai\x1a dataplane/proto/sai/common.proto\"\xa5D\n" + + " dataplane/proto/sai/switch.proto\x12\x15lemming.dataplane.sai\x1a dataplane/proto/sai/common.proto\"\xfcE\n" + "\x13CreateSwitchRequest\x12,\n" + "\vingress_acl\x18\x01 \x01(\x04B\x06\xf0ܓ\xad\x0f+H\x00R\n" + "ingressAcl\x88\x01\x01\x12*\n" + @@ -4059,7 +4097,9 @@ const file_dataplane_proto_sai_switch_proto_rawDesc = "" + "*reg_notice_switch_asic_sdk_health_category\x18[ \x03(\x0e22.lemming.dataplane.sai.SwitchAsicSdkHealthCategoryB\a\xf0ܓ\xad\x0f\xdd\x01R$regNoticeSwitchAsicSdkHealthCategory\x12/\n" + "\x0fpoe_device_list\x18\\ \x03(\x04B\a\xf0ܓ\xad\x0f\xe8\x01R\rpoeDeviceList\x12]\n" + "\x10stats_count_mode\x18] \x01(\x0e2%.lemming.dataplane.sai.StatsCountModeB\a\xf0ܓ\xad\x0f\xec\x01HOR\x0estatsCountMode\x88\x01\x01\x12=\n" + - "\x16selective_counter_list\x18^ \x03(\x04B\a\xf0ܓ\xad\x0f\xed\x01R\x14selectiveCounterList:\x06\xa0\xa9\x90\xad\x0f\"B\x0e\n" + + "\x16selective_counter_list\x18^ \x03(\x04B\a\xf0ܓ\xad\x0f\xed\x01R\x14selectiveCounterList\x12K\n" + + "\x1bdisable_ingress_vlan_checks\x18_ \x01(\bB\a\xf0ܓ\xad\x0f\xee\x01HPR\x18disableIngressVlanChecks\x88\x01\x01\x12I\n" + + "\x1adisable_egress_vlan_checks\x18` \x01(\bB\a\xf0ܓ\xad\x0f\xef\x01HQR\x17disableEgressVlanChecks\x88\x01\x01:\x06\xa0\xa9\x90\xad\x0f\"B\x0e\n" + "\f_ingress_aclB\r\n" + "\v_egress_aclB\x0f\n" + "\r_restart_warmB\x0f\n" + @@ -4142,12 +4182,14 @@ const file_dataplane_proto_sai_switch_proto_rawDesc = "" + "\x10_credit_wd_timerB\x11\n" + "\x0f_switch_isolateB!\n" + "\x1f_hostif_oper_status_update_modeB\x13\n" + - "\x11_stats_count_mode\"(\n" + + "\x11_stats_count_modeB\x1e\n" + + "\x1c_disable_ingress_vlan_checksB\x1d\n" + + "\x1b_disable_egress_vlan_checks\"(\n" + "\x14CreateSwitchResponse\x12\x10\n" + "\x03oid\x18\x01 \x01(\x04R\x03oid\"'\n" + "\x13RemoveSwitchRequest\x12\x10\n" + "\x03oid\x18\x01 \x01(\x04R\x03oid\"\x16\n" + - "\x14RemoveSwitchResponse\"\xf3:\n" + + "\x14RemoveSwitchResponse\"\xca<\n" + "\x19SetSwitchAttributeRequest\x12\x10\n" + "\x03oid\x18\x01 \x01(\x04R\x03oid\x12,\n" + "\vingress_acl\x18\x02 \x01(\x04B\x06\xf0ܓ\xad\x0f+H\x00R\n" + @@ -4235,7 +4277,9 @@ const file_dataplane_proto_sai_switch_proto_rawDesc = "" + "*reg_notice_switch_asic_sdk_health_category\x18N \x03(\x0e22.lemming.dataplane.sai.SwitchAsicSdkHealthCategoryB\a\xf0ܓ\xad\x0f\xdd\x01R$regNoticeSwitchAsicSdkHealthCategory\x12/\n" + "\x0fpoe_device_list\x18O \x03(\x04B\a\xf0ܓ\xad\x0f\xe8\x01R\rpoeDeviceList\x12]\n" + "\x10stats_count_mode\x18P \x01(\x0e2%.lemming.dataplane.sai.StatsCountModeB\a\xf0ܓ\xad\x0f\xec\x01HER\x0estatsCountMode\x88\x01\x01\x12=\n" + - "\x16selective_counter_list\x18Q \x03(\x04B\a\xf0ܓ\xad\x0f\xed\x01R\x14selectiveCounterListB\x0e\n" + + "\x16selective_counter_list\x18Q \x03(\x04B\a\xf0ܓ\xad\x0f\xed\x01R\x14selectiveCounterList\x12K\n" + + "\x1bdisable_ingress_vlan_checks\x18R \x01(\bB\a\xf0ܓ\xad\x0f\xee\x01HFR\x18disableIngressVlanChecks\x88\x01\x01\x12I\n" + + "\x1adisable_egress_vlan_checks\x18S \x01(\bB\a\xf0ܓ\xad\x0f\xef\x01HGR\x17disableEgressVlanChecks\x88\x01\x01B\x0e\n" + "\f_ingress_aclB\r\n" + "\v_egress_aclB\x0f\n" + "\r_restart_warmB\x0f\n" + @@ -4307,7 +4351,9 @@ const file_dataplane_proto_sai_switch_proto_rawDesc = "" + "\x10_credit_wd_timerB\x11\n" + "\x0f_switch_isolateB!\n" + "\x1f_hostif_oper_status_update_modeB\x13\n" + - "\x11_stats_count_mode\"\x1c\n" + + "\x11_stats_count_modeB\x1e\n" + + "\x1c_disable_ingress_vlan_checksB\x1d\n" + + "\x1b_disable_egress_vlan_checks\"\x1c\n" + "\x1aSetSwitchAttributeResponse\"m\n" + "\x19GetSwitchAttributeRequest\x12\x10\n" + "\x03oid\x18\x01 \x01(\x04R\x03oid\x12>\n" + @@ -4413,7 +4459,7 @@ const file_dataplane_proto_sai_switch_proto_rawDesc = "" + "\x03oid\x18\x01 \x01(\x04R\x03oid\x12D\n" + "\tattr_type\x18\x02 \x03(\x0e2'.lemming.dataplane.sai.SwitchTunnelAttrR\battrType\"d\n" + " GetSwitchTunnelAttributeResponse\x12@\n" + - "\x04attr\x18\x01 \x01(\v2,.lemming.dataplane.sai.SwitchTunnelAttributeR\x04attr*\x9dK\n" + + "\x04attr\x18\x01 \x01(\v2,.lemming.dataplane.sai.SwitchTunnelAttributeR\x04attr*\xf8K\n" + "\n" + "SwitchAttr\x12\x1b\n" + "\x17SWITCH_ATTR_UNSPECIFIED\x10\x00\x12&\n" + @@ -4654,7 +4700,9 @@ const file_dataplane_proto_sai_switch_proto_rawDesc = "" + "'SWITCH_ATTR_AVAILABLE_ICMP_ECHO_SESSION\x10\xea\x01\x12&\n" + "!SWITCH_ATTR_MAX_ICMP_ECHO_SESSION\x10\xeb\x01\x12!\n" + "\x1cSWITCH_ATTR_STATS_COUNT_MODE\x10\xec\x01\x12'\n" + - "\"SWITCH_ATTR_SELECTIVE_COUNTER_LIST\x10\xed\x01*\x93\x05\n" + + "\"SWITCH_ATTR_SELECTIVE_COUNTER_LIST\x10\xed\x01\x12,\n" + + "'SWITCH_ATTR_DISABLE_INGRESS_VLAN_CHECKS\x10\xee\x01\x12+\n" + + "&SWITCH_ATTR_DISABLE_EGRESS_VLAN_CHECKS\x10\xef\x01*\x93\x05\n" + "\x10SwitchTunnelAttr\x12\"\n" + "\x1eSWITCH_TUNNEL_ATTR_UNSPECIFIED\x10\x00\x12\"\n" + "\x1eSWITCH_TUNNEL_ATTR_TUNNEL_TYPE\x10\x01\x12-\n" + diff --git a/dataplane/proto/sai/switch.proto b/dataplane/proto/sai/switch.proto index 2f3b39ddb..5cba45471 100644 --- a/dataplane/proto/sai/switch.proto +++ b/dataplane/proto/sai/switch.proto @@ -246,6 +246,8 @@ enum SwitchAttr { SWITCH_ATTR_MAX_ICMP_ECHO_SESSION = 235; SWITCH_ATTR_STATS_COUNT_MODE = 236; SWITCH_ATTR_SELECTIVE_COUNTER_LIST = 237; + SWITCH_ATTR_DISABLE_INGRESS_VLAN_CHECKS = 238; + SWITCH_ATTR_DISABLE_EGRESS_VLAN_CHECKS = 239; } enum SwitchTunnelAttr { @@ -379,6 +381,8 @@ message CreateSwitchRequest { repeated uint64 poe_device_list = 92 [(attr_enum_value) = 232]; optional StatsCountMode stats_count_mode = 93 [(attr_enum_value) = 236]; repeated uint64 selective_counter_list = 94 [(attr_enum_value) = 237]; + optional bool disable_ingress_vlan_checks = 95 [(attr_enum_value) = 238]; + optional bool disable_egress_vlan_checks = 96 [(attr_enum_value) = 239]; } message CreateSwitchResponse { @@ -487,6 +491,8 @@ message SetSwitchAttributeRequest { repeated uint64 poe_device_list = 79 [(attr_enum_value) = 232]; optional StatsCountMode stats_count_mode = 80 [(attr_enum_value) = 236]; repeated uint64 selective_counter_list = 81 [(attr_enum_value) = 237]; + optional bool disable_ingress_vlan_checks = 82 [(attr_enum_value) = 238]; + optional bool disable_egress_vlan_checks = 83 [(attr_enum_value) = 239]; } message SetSwitchAttributeResponse {} diff --git a/dataplane/saiserver/switch.go b/dataplane/saiserver/switch.go index 88a8ece82..9bede9005 100644 --- a/dataplane/saiserver/switch.go +++ b/dataplane/saiserver/switch.go @@ -922,6 +922,8 @@ func (sw *saiSwitch) CreateSwitch(ctx context.Context, _ *saipb.CreateSwitchRequ SwitchShellEnable: proto.Bool(false), SwitchProfileId: proto.Uint32(0), NatZoneCounterObjectId: proto.Uint64(0), + DisableIngressVlanChecks: proto.Bool(false), + DisableEgressVlanChecks: proto.Bool(false), SupportedObjectTypeList: []saipb.ObjectType{ saipb.ObjectType_OBJECT_TYPE_PORT, saipb.ObjectType_OBJECT_TYPE_VLAN, diff --git a/dataplane/saiserver/switch_test.go b/dataplane/saiserver/switch_test.go index 9653846cd..f8736f2c8 100644 --- a/dataplane/saiserver/switch_test.go +++ b/dataplane/saiserver/switch_test.go @@ -132,6 +132,8 @@ func TestCreateSwitch(t *testing.T) { SwitchShellEnable: proto.Bool(false), SwitchProfileId: proto.Uint32(0), NatZoneCounterObjectId: proto.Uint64(0), + DisableIngressVlanChecks: proto.Bool(false), + DisableEgressVlanChecks: proto.Bool(false), SupportedObjectTypeList: []saipb.ObjectType{ saipb.ObjectType_OBJECT_TYPE_PORT, saipb.ObjectType_OBJECT_TYPE_VLAN, diff --git a/dataplane/standalone/sai/enum.cc b/dataplane/standalone/sai/enum.cc index 163227cc7..76e88a5de 100644 --- a/dataplane/standalone/sai/enum.cc +++ b/dataplane/standalone/sai/enum.cc @@ -24855,6 +24855,12 @@ lemming::dataplane::sai::SwitchAttr convert_sai_switch_attr_t_to_proto( case SAI_SWITCH_ATTR_SELECTIVE_COUNTER_LIST: return lemming::dataplane::sai::SWITCH_ATTR_SELECTIVE_COUNTER_LIST; + case SAI_SWITCH_ATTR_DISABLE_INGRESS_VLAN_CHECKS: + return lemming::dataplane::sai::SWITCH_ATTR_DISABLE_INGRESS_VLAN_CHECKS; + + case SAI_SWITCH_ATTR_DISABLE_EGRESS_VLAN_CHECKS: + return lemming::dataplane::sai::SWITCH_ATTR_DISABLE_EGRESS_VLAN_CHECKS; + default: return lemming::dataplane::sai::SWITCH_ATTR_UNSPECIFIED; } @@ -25591,6 +25597,12 @@ sai_switch_attr_t convert_sai_switch_attr_t_to_sai( case lemming::dataplane::sai::SWITCH_ATTR_SELECTIVE_COUNTER_LIST: return SAI_SWITCH_ATTR_SELECTIVE_COUNTER_LIST; + case lemming::dataplane::sai::SWITCH_ATTR_DISABLE_INGRESS_VLAN_CHECKS: + return SAI_SWITCH_ATTR_DISABLE_INGRESS_VLAN_CHECKS; + + case lemming::dataplane::sai::SWITCH_ATTR_DISABLE_EGRESS_VLAN_CHECKS: + return SAI_SWITCH_ATTR_DISABLE_EGRESS_VLAN_CHECKS; + default: return SAI_SWITCH_ATTR_NUMBER_OF_ACTIVE_PORTS; } diff --git a/dataplane/standalone/sai/switch.cc b/dataplane/standalone/sai/switch.cc index eab91bac4..bbb371061 100644 --- a/dataplane/standalone/sai/switch.cc +++ b/dataplane/standalone/sai/switch.cc @@ -364,6 +364,12 @@ lemming::dataplane::sai::CreateSwitchRequest convert_create_switch( attr_list[i].value.objlist.list, attr_list[i].value.objlist.list + attr_list[i].value.objlist.count); break; + case SAI_SWITCH_ATTR_DISABLE_INGRESS_VLAN_CHECKS: + msg.set_disable_ingress_vlan_checks(attr_list[i].value.booldata); + break; + case SAI_SWITCH_ATTR_DISABLE_EGRESS_VLAN_CHECKS: + msg.set_disable_egress_vlan_checks(attr_list[i].value.booldata); + break; } } return msg; @@ -759,6 +765,12 @@ sai_status_t l_set_switch_attribute(sai_object_id_t switch_id, attr->value.objlist.list, attr->value.objlist.list + attr->value.objlist.count); break; + case SAI_SWITCH_ATTR_DISABLE_INGRESS_VLAN_CHECKS: + req.set_disable_ingress_vlan_checks(attr->value.booldata); + break; + case SAI_SWITCH_ATTR_DISABLE_EGRESS_VLAN_CHECKS: + req.set_disable_egress_vlan_checks(attr->value.booldata); + break; } grpc::Status status = switch_->SetSwitchAttribute(&context, req, &resp); @@ -1510,6 +1522,12 @@ sai_status_t l_get_switch_attribute(sai_object_id_t switch_id, resp.attr().selective_counter_list(), &attr_list[i].value.objlist.count); break; + case SAI_SWITCH_ATTR_DISABLE_INGRESS_VLAN_CHECKS: + attr_list[i].value.booldata = resp.attr().disable_ingress_vlan_checks(); + break; + case SAI_SWITCH_ATTR_DISABLE_EGRESS_VLAN_CHECKS: + attr_list[i].value.booldata = resp.attr().disable_egress_vlan_checks(); + break; case SAI_SWITCH_ATTR_SUPPORTED_DEBUG_COUNTER_TYPE_LIST: if (attr_list[i].value.s32list.list == nullptr || attr_list[i].value.s32list.count < 1) { attr_list[i].value.s32list.count = 1; diff --git a/patches/sai.patch b/patches/sai.patch index c714bb863..386cf0264 100644 --- a/patches/sai.patch +++ b/patches/sai.patch @@ -190,3 +190,33 @@ index fb76035..c50f35a 100644 CHECK_STRUCT_SIZE(sai_bfd_session_state_notification_t, 16); CHECK_STRUCT_SIZE(sai_fabric_port_reachability_t, 8); CHECK_STRUCT_SIZE(sai_fdb_entry_t, 24); + +diff --git a/inc/saiswitch.h b/inc/saiswitch.h +index 1234567..89abcdef 100644 +--- a/inc/saiswitch.h ++++ b/inc/saiswitch.h +@@ -3071,6 +3071,24 @@ + SAI_SWITCH_ATTR_SELECTIVE_COUNTER_LIST, + ++ /** ++ * @brief Disable ingress VLAN checks ++ * ++ * @type bool ++ * @flags CREATE_AND_SET ++ * @default false ++ */ ++ SAI_SWITCH_ATTR_DISABLE_INGRESS_VLAN_CHECKS = 0x20000020, ++ ++ /** ++ * @brief Disable egress VLAN checks ++ * ++ * @type bool ++ * @flags CREATE_AND_SET ++ * @default false ++ */ ++ SAI_SWITCH_ATTR_DISABLE_EGRESS_VLAN_CHECKS = 0x20000021, ++ + /** + * @brief End of attributes + */ + SAI_SWITCH_ATTR_END,