STRUCT SFP_UPSTREAM_OPS(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct sfp_upstream_ops(9) β€” like, the upstream operations structure, bestie

Okay so picture this: you're deep in the Kernel API Manual (yes, that's the manual name, she's fancy) and you hit struct sfp_upstream_ops. This is the vibe check for everyone who lives upstream of an SFP socket. Grab a snack, we're going in πŸ“


✨ SYNOPSIS ✨

Here's the whole squad, exactly as they appear, no cap:

struct sfp_upstream_ops {
    void (*attach)(void *priv, struct sfp_bus *bus);
    void (*detach)(void *priv, struct sfp_bus *bus);
    int (*module_insert)(void *priv, const struct sfp_eeprom_id *id);
    void (*module_remove)(void *priv);
    int (*module_start)(void *priv);
    void (*module_stop)(void *priv);
    void (*link_down)(void *priv);
    void (*link_up)(void *priv);
    int (*connect_phy)(void *priv, struct phy_device *);
    void (*disconnect_phy)(void *priv, struct phy_device *);
 };

Like, ten whole function pointers. She's giving full roster energy πŸ‘‘


πŸŽ€ Members πŸŽ€

Every single one of these, in order, because we do not skip members in this house:

  • attach β€” called when the sfp socket driver is bound to the upstream. Mandatory. You literally cannot skip this one, fr fr.
  • detach β€” called when the sfp socket driver is unbound from the upstream. Also mandatory πŸ™ˆ breaking up is a whole callback too.
  • module_insert β€” called after a module has been detected, to determine whether the module is supported for the upstream device. iykyk, it's the compatibility check era πŸ’…
  • module_remove β€” called after the module has been removed. bye bestie πŸ¦‹
  • module_start β€” called after the PHY probe step. iconic timing, no notes ✨
  • module_stop β€” called before the PHY is removed. like, before, okay, don't be late 🫢
  • link_down β€” called when the link is non-operational for whatever reason. she's going through it 😭
  • link_up β€” called when the link is operational. WE'RE SO BACK πŸ”₯
  • connect_phy β€” called when an I2C accessible PHY has been detected on the module. obsessed 🌸
  • disconnect_phy β€” called when a module with an I2C accessible PHY has been removed. the sad goodbye arc πŸ’€
ngl the two mandatory ones are attach and detach β€” everything else is optional flair. but the mandatory ones? non-negotiable, bestie πŸ’–

πŸ¦‹ SEE ALSO πŸ¦‹

Go give these their flowers too:

  • Kernel file ./include/linux/sfp.h β€” struct sfp_eeprom_id(9)
  • struct sfp_module_caps(9)

And that's the whole page, periodt 🌈 She lives in ./include/linux, dated October 2026 β€” so yeah, mark your calendar, screenshot it, send it to the group chat πŸ’œπŸ†

πŸ“¦ where this page comes from