Author: hselasky
Date: Thu Oct  8 08:55:34 2015
New Revision: 289022
URL: https://svnweb.freebsd.org/changeset/base/289022

Log:
  MFC r287775:
  Update TSO limits to include all headers.
  
  To make driver programming easier the TSO limits are changed to
  reflect the values used in the BUSDMA tag a network adapter driver is
  using. The TCP/IP network stack will subtract space for all linklevel
  and protocol level headers and ensure that the full mbuf chain passed
  to the network adapter fits within the given limits. See r287775
  for a more detailed description.
  
  Differential Revision:        https://reviews.freebsd.org/D3477
  Reviewed by:          rmacklem

Modified:
  stable/9/sys/net/if_var.h
  stable/9/sys/netinet/tcp_output.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/net/   (props changed)

Modified: stable/9/sys/net/if_var.h
==============================================================================
--- stable/9/sys/net/if_var.h   Thu Oct  8 08:55:08 2015        (r289021)
+++ stable/9/sys/net/if_var.h   Thu Oct  8 08:55:34 2015        (r289022)
@@ -222,11 +222,12 @@ struct ifnet {
         * count limit does not apply. If all three fields are zero,
         * there is no TSO limit.
         *
-        * NOTE: The TSO limits only apply to the data payload part of
-        * a TCP/IP packet. That means there is no need to subtract
-        * space for ethernet-, vlan-, IP- or TCP- headers from the
-        * TSO limits unless the hardware driver in question requires
-        * so.
+        * NOTE: The TSO limits should reflect the values used in the
+        * BUSDMA tag a network adapter is using to load a mbuf chain
+        * for transmission. The TCP/IP network stack will subtract
+        * space for all linklevel and protocol level headers and
+        * ensure that the full mbuf chain passed to the network
+        * adapter fits within the given limits.
         */
        u_int   if_hw_tsomax;
        int     if_ispare[1];

Modified: stable/9/sys/netinet/tcp_output.c
==============================================================================
--- stable/9/sys/netinet/tcp_output.c   Thu Oct  8 08:55:08 2015        
(r289021)
+++ stable/9/sys/netinet/tcp_output.c   Thu Oct  8 08:55:34 2015        
(r289022)
@@ -798,7 +798,8 @@ send:
                         */
                        if (if_hw_tsomax != 0) {
                                /* compute maximum TSO length */
-                               max_len = (if_hw_tsomax - hdrlen);
+                               max_len = (if_hw_tsomax - hdrlen -
+                                   max_linkhdr);
                                if (max_len <= 0) {
                                        len = 0;
                                } else if (len > max_len) {
@@ -813,6 +814,15 @@ send:
                         */
                        if (if_hw_tsomaxsegcount != 0 &&
                            if_hw_tsomaxsegsize != 0) {
+                               /*
+                                * Subtract one segment for the LINK
+                                * and TCP/IP headers mbuf that will
+                                * be prepended to this mbuf chain
+                                * after the code in this section
+                                * limits the number of mbufs in the
+                                * chain to if_hw_tsomaxsegcount.
+                                */
+                               if_hw_tsomaxsegcount -= 1;
                                max_len = 0;
                                mb = sbsndmbuf(&so->so_snd, off, &moff);
 
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to