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.