]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Teach the loopback interface about checksum generation and validation
authorrwatson <rwatson@FreeBSD.org>
Sun, 15 Mar 2009 20:17:44 +0000 (20:17 +0000)
committerrwatson <rwatson@FreeBSD.org>
Sun, 15 Mar 2009 20:17:44 +0000 (20:17 +0000)
commit4fc2f82f67bc08664b8ed7df98cea3f48013160d
tree530a65986c07f1088440b3c9121142d5a6112c2c
parente488f4df7ac6fbbbb933a95cb2b979f2d98ebd95
Teach the loopback interface about checksum generation and validation
avoidance:

- Enable setting the RXCSUM and TXCSUM flags for loopback interfaces;
  set both by default.
- When RXCSUM is set, flag packets sent over the loopback interface as
  having checked and valid IP, UDP, TCP checksums so that higher
  protocol layers won't check them.
- Always clear CSUM_{IP,UDP_TCP} checksum required flags on transmit,
  as they will have gotten there as a result of TXCSUM being set.

This is done only for packets explicitly sent over the loopback, not
simulated loopback via if_simloop() due to !SIMPLEX interfaces, etc.

Note that enabling TXCSUM but not RXCSUM will lead to unhappiness, as
checksums won't be generated but will be validated.

Kris reports that this leads to significant performance improvements
in loopback benchmarking with TCP and UDP for throughput:

RXCSUM  RXCSUM+TXCSUM
TCP 15% 37%
UDP 10% 74%

Update man page.

Reviewed by: sam
Tested by: kris
MFC after: 1 week
share/man/man4/lo.4
sys/net/if_loop.c