STRUCT KSZ_PORT(9)
πΈ NAME πΈ
ok so this is struct ksz_port β the Virtual port data structure, straight out of the Kernel API Manual. yes, the Kernel API Manual. we're doing kernel networking today bestie, drink some water first π
β¨ SYNOPSIS β¨
here's the whole vibe, verbatim, don't touch it:
struct ksz_port {
u8 duplex;
u8 speed;
u8 force_link;
u8 flow_ctrl;
int first_port;
int mib_port_cnt;
int port_cnt;
u64 counter[OID_COUNTER_LAST];
struct ksz_hw *hw;
struct ksz_port_info *linked;
};
look at that layout. it's giving organized. it's giving "my notes app is actually clean." π
π Members π
okay so every single field, one by one, no skipping, because we don't do that here:
duplexβ the duplex mode setting, bestie.1= half duplex,2= full duplex, and0= auto, which usually lands you on full duplex anyway. so0is the "let the universe decide (it'll pick full duplex)" choice πspeedβ the speed setting.10for 10 Mbit,100for 100 Mbit, and0for auto, which normally results in 100 Mbit. yes auto is a vibe and its vibe is usually 100 π¦force_linkβ the force link setting.0means auto-negotiation (let them talk it out),1means force (you're the main character, you decide) πflow_ctrlβ the flow control setting.PHY_NO_FLOW_CTRLfor no flow control,PHY_FLOW_CTRLfor flow control. and lowkey important:PHY_TX_ONLYandPHY_RX_ONLYare not supported for 100 Mbit PHY. not supported!! so don't come for me when they don't work πfirst_portβ index of the first port this port supports π’mib_port_cntβ number of ports that have MIB countersport_cntβ number of ports this port supports (yes, it's a different number frommib_port_cnt, they're siblings not twins, keep them straight) π«Άcounterβ port statistics counter. it's an array:counter[OID_COUNTER_LAST]πhwβ pointer to the hardware structure. it's astruct ksz_hw *, treat it with respect πlinkedβ pointer to port information linked to this port. it's astruct ksz_port_info *, and no cap that name is exactly what it says β¨
π₯ SEE ALSO π₯
the mother of all see-also lists, and I'm not dropping a single crumb. first up, the kernel file itself: ./drivers/net/ethernet/micrel/ksz884x.c β go read it, it's right there π
then the structs, in order:
struct ksz_hw_desc(9), struct ksz_sw_desc(9), struct ksz_dma_buf(9), struct ksz_desc(9), struct ksz_desc_info(9), struct ksz_mac_table(9), struct ksz_vlan_table(9), struct ksz_port_mib(9), struct ksz_port_cfg(9), struct ksz_switch(9), struct ksz_port_info(9), struct ksz_hw(9), struct ksz_timer_info(9), struct ksz_shared_mem(9), struct ksz_counter_info(9), struct dev_info(9), struct dev_priv(9)
then the hardware/sw helpers:
hw_turn_on_intr(9), hw_block_intr(9), sw_r_table(9), sw_w_table_64(9), sw_w_sta_mac_table(9), sw_r_vlan_table(9), port_r_mib_cnt(9), port_r_mib_pkt(9), port_r_cnt(9), port_init_cnt(9), port_cfg(9), port_r8(9), port_r16(9), port_w16(9), sw_chk(9), sw_cfg(9)
then the broad-storm + priority-rate crew:
sw_cfg_broad_storm(9), sw_get_broad_storm(9), sw_dis_broad_storm(9), sw_ena_broad_storm(9), sw_init_broad_storm(9), hw_cfg_broad_storm(9), sw_dis_prio_rate(9), sw_init_prio_rate(9), sw_dis_diffserv(9), sw_dis_802_1p(9)
then the vlan/port-based gang:
sw_cfg_replace_null_vid(9), sw_cfg_replace_vid(9), sw_cfg_port_based(9), sw_dis_multi_queue(9), sw_init_prio(9), port_get_def_vid(9), sw_init_vlan(9), sw_cfg_port_base_vlan(9), sw_set_addr(9), sw_set_global_ctrl(9), port_set_stp_state(9), sw_clr_sta_mac_table(9), sw_init_stp(9), sw_block_addr(9)
then PHY, eeprom and link stuff:
hw_r_phy(9), hw_w_phy(9), eeprom_read(9), eeprom_write(9), port_get_link_speed(9), port_set_link_speed(9), port_force_link_speed(9)
then the entire wake-on-lan arc π:
hw_chk_wol_pme_status(9), hw_clr_wol_pme_status(9), hw_cfg_wol_pme(9), hw_cfg_wol(9), hw_set_wol_frame(9), hw_add_wol_arp(9), hw_add_wol_bcast(9), hw_add_wol_mcast(9), hw_add_wol_ucast(9), hw_enable_wol(9)
then hw bring-up and tx/rx:
hw_init(9), hw_reset(9), hw_setup(9), hw_setup_intr(9), hw_set_desc_base(9), hw_start_rx(9), hw_stop_rx(9), hw_start_tx(9), hw_stop_tx(9), hw_disable(9), hw_enable(9), hw_alloc_pkt(9), hw_send_pkt(9)
then addressing + multicast + promiscuous:
hw_set_addr(9), hw_read_addr(9), hw_clr_multicast(9), hw_set_grp_addr(9), hw_set_multicast(9), hw_set_promiscuous(9)
then switch setup + timers + descs + memory:
sw_enable(9), sw_setup(9), ksz_start_timer(9), ksz_stop_timer(9), ksz_alloc_soft_desc(9), ksz_alloc_desc(9), free_dma_buf(9), ksz_init_rx_buffers(9), ksz_alloc_mem(9), ksz_free_desc(9), ksz_free_buffers(9), ksz_free_mem(9)
then the packet path:
send_packet(9), transmit_cleanup(9), tx_done(9), netdev_tx(9), netdev_tx_timeout(9), netdev_intr(9), netdev_close(9), netdev_open(9), netdev_query_statistics(9), netdev_set_mac_address(9), netdev_set_rx_mode(9), netdev_ioctl(9)
then mdio:
then the whole ethtool-ops saga (respect the grind):
netdev_get_link_ksettings(9), netdev_set_link_ksettings(9), netdev_nway_reset(9), netdev_get_link(9), netdev_get_drvinfo(9), netdev_get_regs_len(9), netdev_get_regs(9), netdev_get_wol(9), netdev_set_wol(9), netdev_get_msglevel(9), netdev_set_msglevel(9), netdev_get_eeprom_len(9), netdev_get_eeprom(9), netdev_set_eeprom(9), netdev_get_pauseparam(9), netdev_set_pauseparam(9), netdev_get_ringparam(9), netdev_get_strings(9), netdev_get_sset_count(9), netdev_get_ethtool_stats(9), netdev_set_features(9)
and finally, the last two icons:
dev_monitor(9), netdev_init(9)
that's all of them. every single one. I counted, I checked, nobody got left on read π
π cute sign-off π
and that's the page!! source path is ./drivers/net/ethernet/micrel, dated October 2026, and the whole thing is filed under struct ksz_port(9) β so if your kernel driver is acting up, it's givin' "read the docs bestie," and now you literally can. go forth and slay your ports, ily π§ππ
π¦ 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