STRUCT ETHOC(9)
π struct ethoc(9) β the driver's lil private clubhouse π β¨
okay so bestie, picture this: you're deep in the kernel, you're writing a network driver, and you need somewhere to keep All Your Stuff. That's this struct. It's the driver-private device structure for the ethoc driver, and it is literally the main character of ./drivers/net/ethernet/ethoc.c. No cap. π«Ά
This page lives in the Kernel API Manual, section 9 β the one for kernel internals, iykyk. π
β¨ SYNOPSIS β¨
struct ethoc {
void __iomem *iobase;
void __iomem *membase;
bool big_endian;
unsigned int num_bd;
unsigned int num_tx;
unsigned int cur_tx;
unsigned int dty_tx;
unsigned int num_rx;
unsigned int cur_rx;
void **vma;
struct net_device *netdev;
struct napi_struct napi;
u32 msg_enable;
spinlock_t lock;
struct mii_bus *mdio;
struct clk *clk;
s8 phy_id;
int old_link;
int old_duplex;
};
like, look at her. every field accounted for, nothing extra, so organized. we stan a tidy struct. π
πΈ Members πΈ
okay now the meet-the-cast portion of the page, let's go member by member π
iobaseβ pointer to the I/O memory region. her home base π‘membaseβ pointer to the buffer memory region. the other home base, but for buffers π§big_endianβ just big or little (endian). that's it, that's the whole vibe check πnum_bdβ number of buffer descriptors πnum_txβ number of send buffers π€cur_txβ last send buffer written βοΈdty_txβ last buffer actually sent. past tense, bestie, it's gone πnum_rxβ number of receive buffers π₯cur_rxβ current receive buffer πvmaβ pointer to array of virtual memory addresses for buffers πΊοΈnetdevβ pointer to network device structure. the whole reason we're here ngl πnapiβ NAPI structure β‘msg_enableβ device state flags π©lockβ device lock πmdioβ MDIO bus for PHY access πclkβ clock β°phy_idβ address of attached PHY πͺͺold_linkβ previous link info πold_duplexβ previous duplex info π
bestie note: nothing here is optional reading, these are all just fields of one struct, so don't come for me about the bullet list. every single one is listed, periodt. π
π SEE ALSO π
if you want the lore extended universe, go read the kernel file ./drivers/net/ethernet/ethoc.c, plus these absolute icons:
struct ethoc_bd(9)ethoc_probe(9)ethoc_remove(9)
like, the whole squad. read them fr fr ππ¦
and that's the page!! sourced from way down in ./drivers/net/ethernet, dated October 2026, section 9 of the Kernel API Manual β ty for coming to my ted talk, ily, go read the other ethoc pages π«ΆππΈβ¨π
π¦ 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