STRUCT MXL862XX_PORT_STATS(9)
π struct mxl862xx_port_stats(9) β the Kernel API Manual page you didn't know you needed
okay so bestie, welcome to section 9 of the Kernel API Manual, where we're talking about struct mxl862xx_port_stats and honestly? it's a whole vibe. it's the 64-bit accumulated hardware port statistics struct, and it is carrying the entire counters operation on its back. π«Ά
β¨ NAME β¨
struct mxl862xx_port_stats β 64-bit accumulated hardware port statistics. that's it, that's the girl. π
πΈ SYNOPSIS πΈ
struct mxl862xx_port_stats {
u64 rx_packets;
u64 tx_packets;
u64 rx_bytes;
u64 tx_bytes;
u64 rx_errors;
u64 tx_errors;
u64 rx_dropped;
u64 tx_dropped;
u64 multicast;
u64 collisions;
u64 rx_length_errors;
u64 rx_crc_errors;
u64 rx_frame_errors;
u32 prev_rx_good_pkts;
u32 prev_tx_good_pkts;
u64 prev_rx_good_bytes;
u64 prev_tx_good_bytes;
u32 prev_rx_fcserror_pkts;
u32 prev_rx_under_size_error_pkts;
u32 prev_rx_oversize_error_pkts;
u32 prev_rx_align_error_pkts;
u32 prev_tx_dropped_pkts;
u32 prev_rx_dropped_pkts;
u32 prev_rx_evlan_discard_pkts;
u32 prev_mtu_exceed_discard_pkts;
u32 prev_tx_acm_dropped_pkts;
u32 prev_rx_multicast_pkts;
u32 prev_tx_coll_count;
};
look at all those fields. β¨ twenty eight of them. she's thorough, she's organized, she has a prev_ section like a notes app with folders. iykyk.
π¦ MEMBERS π¦
the main character counters π
rx_packetsβ total received packets πtx_packetsβ total transmitted packets πrx_bytesβ total received bytestx_bytesβ total transmitted bytesrx_errorsβ total receive errors. not slay, but we count them anyway πtx_errorsβ total transmit errorsrx_droppedβ total received packets that got droppedtx_droppedβ total transmitted packets that got droppedmulticastβ total received multicast packetscollisionsβ total transmit collisions π
the error girlies π©Ή
rx_length_errorsβ received length errors (undersize + oversize)rx_crc_errorsβ received FCS errorsrx_frame_errorsβ received alignment errors
the prev_ snapshots (the receipts) πΈ
so these are all previous snapshots β the raw counter value from last time we looked, so we can do the math on the delta later. literally the "before" picture.
prev_rx_good_pktsβ previous snapshot of rx good packet counterprev_tx_good_pktsβ previous snapshot of tx good packet counterprev_rx_good_bytesβ previous snapshot of rx good byte counterprev_tx_good_bytesβ previous snapshot of tx good byte counterprev_rx_fcserror_pktsβ previous snapshot of rx FCS error counterprev_rx_under_size_error_pktsβ previous snapshot of rx undersize error counterprev_rx_oversize_error_pktsβ previous snapshot of rx oversize error counterprev_rx_align_error_pktsβ previous snapshot of rx alignment error counterprev_tx_dropped_pktsβ previous snapshot of tx dropped counterprev_rx_dropped_pktsβ previous snapshot of rx dropped counterprev_rx_evlan_discard_pktsβ previous snapshot of extended VLAN discard counterprev_mtu_exceed_discard_pktsβ previous snapshot of MTU exceed discard counterprev_tx_acm_dropped_pktsβ previous snapshot of tx ACM dropped counterprev_rx_multicast_pktsβ previous snapshot of rx multicast counterprev_tx_coll_countβ previous snapshot of tx collision counter
π DESCRIPTION π
okay so here's the lore, and it's genuinely iconic:
the firmware RMON counters are 32-bit free-running (and they're 64-bit for byte counters, because bytes are extra like that π ). this structure holds 64-bit accumulators alongside the previous raw snapshot so that deltas can be computed across polls.
and the way it handles 32-bit wrap correctly? via unsigned subtraction. no cap. that's the whole trick. the counter rolls over, you subtract, the unsigned math Just Worksβ’, and your numbers stay correct. periodt. π
ngl this is the part people mess up β the wrap handling is the reason the prev_* fields exist. respect the design. π
π SEE ALSO π
the kernel file lives at ./drivers/net/dsa/mxl862xx/mxl862xx.h β go read it, bestie, it's giving source of truth π
and the whole friend group:
mxl862xx_fw_portmap_set_bit(9)mxl862xx_fw_portmap_clear_bit(9)mxl862xx_fw_portmap_is_empty(9)struct mxl862xx_vf_vid(9)struct mxl862xx_vf_block(9)struct mxl862xx_evlan_block(9)struct mxl862xx_port(9)struct mxl862xx_pcs(9)struct mxl862xx_fw_version(9)struct mxl862xx_priv(9)
mwah π this page came to you from ./drivers/net/dsa/mxl862xx, dated October 2026, and it's a struct mxl862xx_port_stats(9) situation through and through. go forth and poll your counters, queen. πβ¨π¦
π¦ 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