net_test_phy...tcp_bad_csum(9)
π NAME π
okay so bestie, gather round β this is net_test_phy_loopback_tcp_bad_csum, and it's literally the PHY loopback test that ships a deliberately corrupted TCP checksum. yes, on purpose. we're testing the hardware's vibe check, not its math. π
β¨ SYNOPSIS β¨
int net_test_phy_loopback_tcp_bad_csum (struct net_device *ndev );
π¦ ARGUMENTS π¦
ndevβ the network device you're putting through the test. the main character of this whole operation, honestly. π
πΈ DESCRIPTION πΈ
So here's the tea: this builds the exact same minimal Ethernet/IPv4/TCP frame as net_test_phy_loopback_tcp, and then it flips the least-significant bit of the TCP checksum π. which means the resulting value is provably invalid β it's neither 0 nor 0xFFFF. no cap, it cannot sneak through as valid.
Then that frame gets transmitted through the device's internal PHY loopback path, and the journey looks like this:
test code -> MAC driver -> MAC HW -> xMII -> PHY -> internal PHY
loopback -> xMII -> MAC HW -> MAC driver -> test code
it's giving full circle. iconic. π₯
π Result interpretation π
0β the frame is delivered to the stack, and the driver reportsip_summedasCHECKSUM_NONEorCHECKSUM_COMPLETE. both are valid ways to say "bad checksum, let the stack verify." slay, that's the correct behavior. β-ETIMEDOUTβ the MAC/PHY silently dropped the frame. hardware checksum verification filtered it out before the driver ever saw it. π«₯-EIOβ the driver returned the frame withip_summed == CHECKSUM_UNNECESSARY, which is it falsely claiming a valid checksum. that indicates a serious RX-path defect. not cute. not the vibe. red flag fr fr. π©
π RETURN π
0 on success, or a negative error code on failure. simple as that, bestie. π«Ά
π SEE ALSO π
- Kernel file
./net/core/selftests.c
and that's the whole page, bestie β hope you understood it, iykyk π this little gem lives under ./net/core, dated October 2026, and the manpage is all about net_test_phy...tcp_bad_csum(9) in the Kernel API Manual. go forth and test those checksums π§β¨
π¦ 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