tcp: Add TSO support for IPv4
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Fri, 27 Jul 2012 06:07:27 +0000 (14:07 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Mon, 30 Jul 2012 06:26:15 +0000 (14:26 +0800)
commit5f60906c244f426e05c09979f8555e604be13865
tree1bbab9416737a37dcc9d902faef2cf050f848518
parentb44c39e5a63367052538488189d68795308f35e5
tcp: Add TSO support for IPv4

It is implemented mainly according to NetBSD's TSO implementation.

Following stuffs are only in DragonFly
- Add comment about devices' expected behaviour upon PUSH and FIN flags
  Obtained-from: Microsoft's LSO online document
- Don't use TSO, if there are SACK or DSACK blocks to report
- Don't use TSO, if congestion window needs validation
- Don't use TSO, if URG flag is to be set
- Take IP and TCP header sizes into consideration when calculate the
  large TCP segment size
- Pseudo checksum for the large TCP segment is calculated using only
  source address, destination address and IPPROTO_TCP according to
  Microsoft's LSO online document.  This fashion of pseudo checksum
  calculation seems to be adopted by several NIC chips.

Several driver helper functions are added:
- tcp_tso_pullup(), which extracts IPv4 and TCP header's location and
  length.  And make sure that IPv4 and TCP headers are in contiguous
  memory.
- ether_tso_pullup(), in addition to what tcp_tso_pullup() does, it
  also extracts ethernet header's length and make sure that ethernet,
  IPv4 and TCP headers are in contiguous memory.

Sysctl node net.inet.tcp.tso could be used to globally disable TSO.
TSO is by default on.

tso/-tso are added to ifconfig(8), which could be used to enable or
disable TSO on the specific interface.
sbin/ifconfig/ifconfig.8
sbin/ifconfig/ifconfig.c
sys/net/if.h
sys/net/if_ethersubr.c
sys/net/if_var.h
sys/netinet/ip_output.c
sys/netinet/tcp_output.c
sys/netinet/tcp_subr.c
sys/netinet/tcp_var.h
sys/sys/mbuf.h