What's the deal with hardware checksum and net.inet.udp.checksum?

Robert Watson rwatson at FreeBSD.org
Thu Jul 10 10:43:24 UTC 2008

On Wed, 9 Jul 2008, gnn at freebsd.org wrote:

> I would assume that if a card, say the em, has hardware TX checksum that the 
> UDP checksum could be calculated by the hardware, but this seems not to be 
> the case.  The manual pages are unhelpful in this regard.

On the whole, they should be generated in hardware as long as it's not 
administratively disabled with ifconfig, and as long as there aren't know bugs 
in the hardware for the rev you're using.  Just for example, hardware 
checksumming is disabled in software for quite a few early 1gbps cards due to 
bugs in the hardware causing rather nasty side effects.  What specific problem 
are you seeing?  We do do a software checksum of the pseudo-header, but the 
UDP data should be checksummed by hardware.

(The usual test for hardware checksum being enabled on transmit is to tcpdump 
the interface and see tcpdump reporting lots of bad checksums, as the BPF 
capture happens before hardware checksumming is run -- in principle on the 
receive side that shouldn't happen!)

Robert N M Watson
Computer Laboratory
University of Cambridge

More information about the freebsd-net mailing list