STRUCT F_ECM_OPTS(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– struct f_ecm_opts(9) β€” the ECM function options glow-up πŸ’–

okay so bestie, this is a page from the Kernel API Manual and it's all about struct f_ecm_opts, which is literally the options bundle for the ECM function. no cap, it's shorter than it looks, so let's get into it 😌✨


✨ NAME ✨

struct f_ecm_opts β€” ECM function options πŸŽ€

Like, that's it. That's the whole name. Iconic brevity, honestly.


🌸 SYNOPSIS 🌸

struct f_ecm_opts {
    struct usb_function_instance    func_inst;
    struct net_device               *net;
    bool bound;
    int bind_count;
    struct mutex                    lock;
    int refcnt;
 };

okay so quick vibe check: there's a trailing space situation before that closing brace in the original and we are keeping it, because facts are facts and we do not touch the code πŸ’…


πŸ¦‹ Members πŸ¦‹

  • func_inst β€” USB function instance. that's the whole description bestie, short and sweet 🫢
  • net β€” the net_device that's associated with the ECM function.
  • bound β€” true if the net_device is shared and pre-registered during the legacy composite driver's bind phase (like, multi.c does that). if it's false, then the ECM function registers the net_device during its own bind phase instead. so like, who's doing the registering? depends on this flag. iykyk 😭
  • bind_count β€” tracks how many configurations the ECM function is bound to, and the whole point is preventing double-registration of the net device. we love a counter with a purpose ✨
  • lock β€” protects the data from concurrent access by configfs read/write and create symlink/remove symlink operations. so like, it's the bouncer at the club, nobody gets in at the same time πŸšͺπŸ’…
  • refcnt β€” reference counter for the function instance. classic refcnt behaviour, no notes πŸ’œ

🧚 SEE ALSO 🧚

  • Kernel file ./drivers/usb/gadget/function/u_ecm.h β€” go read it, bestie, it's right there πŸ‘‘

⭐ friendly reminder that bound, bind_count, lock and refcnt all exist for real reasons: sharing, avoiding double-registration, concurrent access protection, and reference counting. don't sleep on them πŸ™ˆ

and that's the whole page, fr fr β€” shoutout to the source at ./drivers/usb/gadget/function, dated October 2026, and a big kiss to the struct f_ecm_opts(9) footer for keeping it all together πŸŒˆπŸ’– mwah, bye bestie! πŸ“

πŸ“¦ where this page comes from