sfp_get_name(9)
β¨ sfp_get_name β¨
okay so bestie, this is a page from the Kernel API Manual β yes, the kernel kernel, the big one π β and it's all about one teeny tiny function that tells you the name of your SFP device. it's giving "small but iconic", fr fr.
πΈ NAME πΈ
sfp_get_name β Get the SFP device name π
like, literally that's the whole job. it gets the name. and it does it so well.
β¨ SYNOPSIS β¨
const char * sfp_get_name (struct sfp_bus *bus );
that's it. one function, one arg, one const char * coming back at you. no cap. π«Ά
π¦ ARGUMENTS π¦
busβ a pointer to thestruct sfp_busstructure for the sfp module. basically the little handle that says "hey, this is the bus we're talking about" π
π DESCRIPTION π
so the way that this works is: sfp_get_name gets the SFP device's name, if bus has a registered socket. that "if" is doing a lot of heavy lifting there, so pay attention π
β οΈ okay important part, don't skip this β callers must hold RTNL. that's not a suggestion, that's the rules. and the returned name is only valid until RTNL is released. so like... grab it, use it, don't get attached. it is not yours forever. π
π RETURN π
- the name of the SFP device registered with
sfp_register_socketβ¨ NULLif no device was registered onbusπ
so either you get a name or you get nothing. vibe check either way. π
π§ SEE ALSO π§
the kernel file ./drivers/net/phy/sfp-bus.c and these absolute legends of the SFP universe:
struct sfp_bus(9)sfp_select_interface(9)sfp_bus_put(9)sfp_get_module_info(9)sfp_get_module_eeprom(9)sfp_get_module_eeprom_by_page(9)sfp_upstream_start(9)sfp_upstream_stop(9)sfp_upstream_set_signal_rate(9)sfp_bus_find_fwnode(9)sfp_bus_add_upstream(9)sfp_bus_del_upstream(9)
okay that's a whole friend group right there and honestly? obsessed. go read them too, iykyk π
π sign-off π
this little gem lives in ./drivers/net/phy, and it's dated October 2026 β β so yeah, mark your calendars bestie. mwah, go hold RTNL and stay safe out there ππ₯ππ
π¦ 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