net_test_phy...tcp_bad_csum(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 reports ip_summed as CHECKSUM_NONE or CHECKSUM_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 with ip_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