ocelot_xmit_get_vlan_info(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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:

  1. it is stripped on egress for these port modes 🧚
  2. 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