@@ -920,31 +920,54 @@ impl<'a, R: Vsc7448Rw> Vsc7448<'a, R> {
920920 & self ,
921921 targets : VlanTargets ,
922922 ) -> Result < ( ) , VscError > {
923- self . configure_vlans ( |p| match ( targets, p) {
924- ( _, sidecar:: UPLINK ) => None ,
925- ( _, sidecar:: TECHNICIAN_1 ) => {
923+ match targets {
924+ VlanTargets :: EverySp => self . sidecar_vlan_unlock_all ( ) ,
925+ VlanTargets :: ScrimletOnly => self . sidecar_vlan_unlock_scrimlet ( ) ,
926+ }
927+ }
928+
929+ fn sidecar_vlan_unlock_all ( & self ) -> Result < ( ) , VscError > {
930+ self . configure_vlans ( |p| match p {
931+ sidecar:: UPLINK => None ,
932+ sidecar:: TECHNICIAN_1 => {
926933 // Technician ports are connected to every port, but not to each
927934 // other (to prevent spanning tree fun)
928935 Some ( ( ( 1 << 53 ) - 1 ) & !( 1 << sidecar:: TECHNICIAN_2 ) )
929936 }
930- ( _ , sidecar:: TECHNICIAN_2 ) => {
937+ sidecar:: TECHNICIAN_2 => {
931938 Some ( ( ( 1 << 53 ) - 1 ) & !( 1 << sidecar:: TECHNICIAN_1 ) )
932939 }
933- // SPs are connected to the Tofino and technician ports
934- ( VlanTargets :: EverySp , _)
935- | (
936- VlanTargets :: ScrimletOnly ,
937- sidecar:: CUBBY_14 | sidecar:: CUBBY_16 ,
938- ) => Some (
940+ _ => {
941+ // SPs are only connected to the Tofino and technician ports
942+ Some (
943+ ( 1 << p)
944+ | ( 1 << sidecar:: UPLINK )
945+ | ( 1 << sidecar:: TECHNICIAN_1 )
946+ | ( 1 << sidecar:: TECHNICIAN_2 ) ,
947+ )
948+ }
949+ } )
950+ }
951+
952+ fn sidecar_vlan_unlock_scrimlet ( & self ) -> Result < ( ) , VscError > {
953+ self . configure_vlans ( |p| match p {
954+ sidecar:: UPLINK => None ,
955+ // Technician ports are connected to uplink and scrimlets
956+ sidecar:: TECHNICIAN_1 | sidecar:: TECHNICIAN_2 => Some (
957+ ( 1 << p)
958+ | ( 1 << sidecar:: UPLINK )
959+ | ( 1 << sidecar:: CUBBY_14 )
960+ | ( 1 << sidecar:: CUBBY_16 ) ,
961+ ) ,
962+ // Scrimlet SPs are connected to the Tofino and technician ports
963+ sidecar:: CUBBY_14 | sidecar:: CUBBY_16 => Some (
939964 ( 1 << p)
940965 | ( 1 << sidecar:: UPLINK )
941966 | ( 1 << sidecar:: TECHNICIAN_1 )
942967 | ( 1 << sidecar:: TECHNICIAN_2 ) ,
943968 ) ,
944- // SPs connected to only the uplink port
945- ( VlanTargets :: ScrimletOnly , _) => {
946- Some ( ( 1 << p) | ( 1 << sidecar:: UPLINK ) )
947- }
969+ // Other SPs are only connected to the uplink port
970+ _ => Some ( ( 1 << p) | ( 1 << sidecar:: UPLINK ) ) ,
948971 } )
949972 }
950973
0 commit comments