ksz_switch_macaddr_get(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– ksz_switch_macaddr_get(9) πŸ’–

okay so bestie, welcome to the Kernel API Manual ✨ β€” yes we're in the kernel API manual era, it's giving "I read source code for fun" and honestly? iconic. this one's all about programming a switch's MAC address register, and it's lowkey important so let's get into it 🫢


✨ NAME ✨

ksz_switch_macaddr_get β€” bestie this one programs the switch's MAC address register πŸ’… periodt, that's the whole job.


🌸 SYNOPSIS 🌸

int ksz_switch_macaddr_get (struct dsa_switch *ds , int port , struct
       netlink_ext_ack *extack );

πŸŽ€ ARGUMENTS πŸŽ€

  • ds β€” your DSA switch instance πŸ’– like, the switch in question, the main character.
  • port β€” the port number 🌈 just the number of the port we're talking about.
  • extack β€” the netlink extended acknowledgment ✨ yes it's a whole thing, it carries the extra ack info.

πŸ¦‹ DESCRIPTION πŸ¦‹

so what does this actually do? it programs the switch's MAC address register with the MAC address of the requesting user port πŸ’« that's it, that's the vibe.

and here's the slay part: this single address gets used by the switch for multiple features β€” think HSR self-address filtering and WoL πŸ‘‘ iykyk, one address serving multiple looks, very efficient of her.

other user ports can totally share ownership of this address as long as their MAC address is the same 🀝 sharing is caring, but only if you match, no cap.

🚨 warning bestie, listen: the MAC addresses of user ports must not change while they have ownership of the switch MAC address. like, don't. seriously. don't do it πŸ™ˆ

πŸ’€ RETURN πŸ’€

  • 0 on success πŸŽ‰ slay
  • or other error codes on failure 😭 not slay, but that's how it goes

🌟 SEE ALSO 🌟

first up, the kernel file herself:

  • Kernel file ./drivers/net/dsa/microchip/ksz_common.c πŸ’–

and the whole friend group 🫢:


and that's the page bestie πŸ’œ this little gem lives in ./drivers/net/dsa/microchip, dated October 2026, and it's brought to you by the one and only ksz_switch_macaddr_get(9) 🧚 go program that register, you got this πŸ’…βœ¨

πŸ“¦ where this page comes from