Date: Wed, 19 Nov 2014 09:03:12 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r274704 - in stable/10/sys: net netinet Message-ID: <201411190903.sAJ93C0b004564@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Wed Nov 19 09:03:12 2014 New Revision: 274704 URL: https://svnweb.freebsd.org/changeset/base/274704 Log: MFC r274376: Fix some minor TSO issues: - Improve description of TSO limits. - Remove a not needed KASSERT() - Remove some not needed variable casts. Sponsored by: Mellanox Technologies Modified: stable/10/sys/net/if.c stable/10/sys/net/if_var.h stable/10/sys/netinet/tcp_output.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/net/if.c ============================================================================== --- stable/10/sys/net/if.c Wed Nov 19 08:59:49 2014 (r274703) +++ stable/10/sys/net/if.c Wed Nov 19 09:03:12 2014 (r274704) @@ -731,13 +731,6 @@ if_attach_internal(struct ifnet *ifp, in ifp->if_hw_tsomaxsegsize); } } - /* - * If the "if_hw_tsomax" limit is set, check if it is - * too small: - */ - KASSERT(ifp->if_hw_tsomax == 0 || - ifp->if_hw_tsomax >= (IP_MAXPACKET / 8), - ("%s: if_hw_tsomax is outside of range", __func__)); #endif } #ifdef VIMAGE Modified: stable/10/sys/net/if_var.h ============================================================================== --- stable/10/sys/net/if_var.h Wed Nov 19 08:59:49 2014 (r274703) +++ stable/10/sys/net/if_var.h Wed Nov 19 09:03:12 2014 (r274704) @@ -210,11 +210,23 @@ struct ifnet { u_int if_fib; /* interface FIB */ u_char if_alloctype; /* if_type at time of allocation */ - u_int if_hw_tsomax; /* TSO total burst length - * limit in bytes. A value of - * zero means no limit. Have - * to find a better place for - * it eventually. */ + /* + * Network adapter TSO limits: + * =========================== + * + * If the "if_hw_tsomax" field is zero the maximum segment + * length limit does not apply. If the "if_hw_tsomaxsegcount" + * or the "if_hw_tsomaxsegsize" field is zero the TSO segment + * 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. + */ + u_int if_hw_tsomax; /* * Spare fields are added so that we can modify sensitive data Modified: stable/10/sys/netinet/tcp_output.c ============================================================================== --- stable/10/sys/netinet/tcp_output.c Wed Nov 19 08:59:49 2014 (r274703) +++ stable/10/sys/netinet/tcp_output.c Wed Nov 19 09:03:12 2014 (r274704) @@ -803,9 +803,9 @@ send: max_len = (if_hw_tsomax - hdrlen); if (max_len <= 0) { len = 0; - } else if (len > (u_int)max_len) { + } else if (len > max_len) { sendalot = 1; - len = (u_int)max_len; + len = max_len; } } @@ -818,7 +818,7 @@ send: max_len = 0; mb = sbsndmbuf(&so->so_snd, off, &moff); - while (mb != NULL && (u_int)max_len < len) { + while (mb != NULL && max_len < len) { u_int mlen; u_int frags; @@ -852,9 +852,9 @@ send: } if (max_len <= 0) { len = 0; - } else if (len > (u_int)max_len) { + } else if (len > max_len) { sendalot = 1; - len = (u_int)max_len; + len = max_len; } } @@ -865,7 +865,7 @@ send: */ max_len = (tp->t_maxopd - optlen); if ((off + len) < so->so_snd.sb_cc) { - moff = len % (u_int)max_len; + moff = len % max_len; if (moff != 0) { len -= moff; sendalot = 1; @@ -876,8 +876,8 @@ send: * In case there are too many small fragments * don't use TSO: */ - if (len <= (u_int)max_len) { - len = (u_int)max_len; + if (len <= max_len) { + len = max_len; sendalot = 1; tso = 0; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201411190903.sAJ93C0b004564>