summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_output.c
diff options
context:
space:
mode:
authorandre <andre@FreeBSD.org>2013-06-03 12:55:13 +0000
committerandre <andre@FreeBSD.org>2013-06-03 12:55:13 +0000
commitb706ceb4abd7f12c0ad38c0da053f4523814bcc4 (patch)
tree1234da94faa0d8e5fb8d693bb7883535361a40a4 /sys/netinet/tcp_output.c
parent4cb7f1fd6f7638e16e52678307df1995d28cad40 (diff)
downloadFreeBSD-src-b706ceb4abd7f12c0ad38c0da053f4523814bcc4.zip
FreeBSD-src-b706ceb4abd7f12c0ad38c0da053f4523814bcc4.tar.gz
Allow drivers to specify a maximum TSO length in bytes if they are
limited in the amount of data they can handle at once. Drivers can set ifp->if_hw_tsomax before calling ether_ifattach() to change the limit. The lowest allowable size is IP_MAXPACKET / 8 (8192 bytes) as anything less wouldn't be very useful anymore. The upper limit is still at IP_MAXPACKET (65536 bytes). Raising it requires further auditing of the IPv4/v6 code path's as the length field in the IP header would overflow leading to confusion in firewalls and others packet handler on the real size of the packet. The placement into "struct ifnet" is a bit hackish but the best place that was found. When the stack/driver boundary is updated it should be handled in a better way. Submitted by: cperciva (earlier version) Reviewed by: cperciva Tested by: cperciva MFC after: 1 week (using spare struct members to preserve ABI)
Diffstat (limited to 'sys/netinet/tcp_output.c')
-rw-r--r--sys/netinet/tcp_output.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c
index 16038cb..b4342f3 100644
--- a/sys/netinet/tcp_output.c
+++ b/sys/netinet/tcp_output.c
@@ -769,12 +769,13 @@ send:
("%s: TSO can't do IP options", __func__));
/*
- * Limit a burst to IP_MAXPACKET minus IP,
+ * Limit a burst to t_tsomax minus IP,
* TCP and options length to keep ip->ip_len
- * from overflowing.
+ * from overflowing or exceeding the maximum
+ * length allowed by the network interface.
*/
- if (len > IP_MAXPACKET - hdrlen) {
- len = IP_MAXPACKET - hdrlen;
+ if (len > tp->t_tsomax - hdrlen) {
+ len = tp->t_tsomax - hdrlen;
sendalot = 1;
}
OpenPOWER on IntegriCloud