ocelot_xmit_get_vlan_info(9)
π ocelot_xmit_get_vlan_info π
okay bestie so we're in the Kernel API Manual today and the page we're reading is ocelot_xmit_get_vlan_info(9) β yes that whole mouthful, iykyk π¦
β¨ NAME β¨
ocelot_xmit_get_vlan_info β the lil helper that figures out the VLAN_TCI and the TAG_TYPE for a frame that's getting injected π
πΈ SYNOPSIS πΈ
void ocelot_xmit_get_vlan_info (struct sk_buff *skb , struct net_device
*br , u64 *vlan_tci , u64 *tag_type );
literally that's it, that's the whole signature, no cap π
π ARGUMENTS π
skbβ pointer to the socket buffer, the packet itself, the main character of this whole situation π¦brβ pointer to the bridge device that the port is under, if any (keyword: if any, sometimes it's just vibing with no bridge at all) πvlan_tciβ ngl bestie the manpage gives zero description here, it just sits there looking pretty πtag_typeβ same situation, no blurb, we move β¨
π¦ DESCRIPTION π¦
okay so here's the tea β
If the port is under a VLAN-aware bridge, we remove the VLAN header from the payload and move it into the DSA tag β and the way that works is it makes the switch classify the packet to the bridge VLAN. slay, correct behavior, no notes π
Otherwise? We leave the classified VLAN at zero. And zero is the pvid of standalone ports (OCELOT_STANDALONE_PVID) β but not of VLAN-unaware bridge ports, because those would be ocelot_vlan_unaware_pvid. different girl, different pvid, don't mix them up π«Ά
Anyway, VID 0 is fine, and here's why, two reasons, both iconic:
- it is stripped on egress for these port modes π§
- source address learning is not performed for packets injected from the CPU anyway
so yeah, it doesn't matter that the VID is "wrong" β those quote marks are doing so much work, and honestly? it ate. π₯
β SEE ALSO β
- Kernel file
./include/linux/dsa/ocelot.hβ go read it, it's giving source of truth π
π«Ά friendly reminder bestie: this page lives at ./include/linux/dsa and it's dated October 2026 β so yes, from the future, and it's still iconic. periodt ππ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms