STRUCT MACSEC_CONTEXT(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ struct macsec_context(9) ✨

okay so bestie, welcome to struct macsec_context β€” this is the page from the Kernel API Manual and it's giving "the little struct that carries all your MACsec offloading vibes." πŸŽ€ It's the context struct for MACsec hardware offloading. Like, it's the bag you hand to your driver so it knows what's up. Periodt. πŸ’…


🌸 NAME 🌸

struct macsec_context β€” MACsec context for hardware offloading πŸ’–


πŸ¦‹ SYNOPSIS πŸ¦‹

struct macsec_context {
    union {
      struct net_device *netdev;
      struct phy_device *phydev;
    };
    enum macsec_offload offload;
    struct macsec_secy *secy;
    struct macsec_rx_sc *rx_sc;
    struct {
      bool update_pn;
      unsigned char assoc_num;
      u8 key[MACSEC_MAX_KEY_LEN];
      union {
        struct macsec_rx_sa *rx_sa;
        struct macsec_tx_sa *tx_sa;
      };
    } sa;
    union {
      struct macsec_tx_sc_stats *tx_sc_stats;
      struct macsec_tx_sa_stats *tx_sa_stats;
      struct macsec_rx_sc_stats *rx_sc_stats;
      struct macsec_rx_sa_stats *rx_sa_stats;
      struct macsec_dev_stats  *dev_stats;
    } stats;
 };

like… look at her. iconic layout, no notes. πŸ”₯


πŸŽ€ Members πŸŽ€

so here's the member-by-member vibe check, bestie β€” every single one, no skips:

  • {unnamed_union} β€” anonymous πŸ™ˆ (yes, the page literally just says "anonymous" and honestly? same energy)
  • netdev β€” a valid pointer to a struct net_device if offload == MACSEC_OFFLOAD_MAC ✨
  • phydev β€” a valid pointer to a struct phy_device if offload == MACSEC_OFFLOAD_PHY ✨
  • offload β€” MACsec offload status πŸ’«
  • secy β€” pointer to a MACsec SecY πŸ‘‘
  • rx_sc β€” pointer to a RX SC 🌈
  • {unnamed_union} β€” anonymous πŸ™ˆ (round two, she's back)

ngl the takeaway is: the union up top is a pick-your-fighter between netdev and phydev, and which one you get is literally decided by offload. iykyk πŸ’€

heads up bestie: the doc as written only spells out the members above β€” the sa bit and the stats union are right there in the struct, so read 'em straight from the synopsis and don't let anyone tell you otherwise 🫢

🌟 SEE ALSO 🌟

  • Kernel file ./include/net/macsec.h
  • struct macsec_key(9)
  • struct macsec_rx_sa(9)
  • struct macsec_rx_sc(9)
  • struct macsec_tx_sa(9)
  • struct macsec_tx_sc(9)
  • struct macsec_secy(9)
  • struct macsec_ops(9)

like a whole friend group of structs, and you should absolutely go meet all of them πŸ’œ


and that's the whole page, bestie β€” sourced from ./include/net, dated October 2026, and filed under struct macsec_context(9) forever and ever. slay, drink water, go offload something safely πŸ§šπŸ’–βœ¨

πŸ“¦ where this page comes from