Skip to content

Commit 33a6acb

Browse files
authored
Set VLAN FID in configuration (#2501)
The MAC tables in the VSC7448 contain a map from `(source mac, filtering id)` tuples to port. The filtering id field ("FID") allows for VLAN-aware learning. Unfortunately, you have to explicitly set a flag to copy the classified VID to the FID. If you're in a situation where you see the same MAC address on multiple ports (which are on different VLANs), properly setting the FID is load-bearing; otherwise, that MAC address will randomly wander between those ports, and packets directed to that MAC address have unpredictable deliverability. Fixes oxidecomputer/mfg#224
1 parent 7cf3e63 commit 33a6acb

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

drv/vsc7448/src/lib.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -741,10 +741,17 @@ impl<'a, R: Vsc7448Rw> Vsc7448<'a, R> {
741741
if let Some(mask) = f(p) {
742742
// Configure the 0x1YY VLAN, using our closure to decide what
743743
// mask to apply
744-
self.write_port_mask(
745-
ANA_L3().VLAN(0x100 + p as u16).VLAN_MASK_CFG(),
746-
mask,
747-
)?;
744+
let vid = 0x100 + p as u16;
745+
self.write_port_mask(ANA_L3().VLAN(vid).VLAN_MASK_CFG(), mask)?;
746+
747+
// Configure the VLAN so that the classified VID is also copied
748+
// to the FID ("filtering ID") field in packet metadata. The
749+
// FID is used as part of the MAC table entry (along with the
750+
// source MAC), so this is necessary to make the MAC tables
751+
// VLAN-aware.
752+
self.write_with(ANA_L3().VLAN(vid).VLAN_CFG(), |r| {
753+
r.set_vlan_fid(u32::from(vid))
754+
})?;
748755
}
749756
}
750757
Ok(())

0 commit comments

Comments
 (0)