From owner-svn-src-user@FreeBSD.ORG Wed Oct 24 14:34:14 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4DA5DF4A; Wed, 24 Oct 2012 14:34:14 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3639F8FC08; Wed, 24 Oct 2012 14:34:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9OEYEtC033097; Wed, 24 Oct 2012 14:34:14 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9OEYDP7033095; Wed, 24 Oct 2012 14:34:13 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201210241434.q9OEYDP7033095@svn.freebsd.org> From: Andre Oppermann Date: Wed, 24 Oct 2012 14:34:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r242001 - user/andre/tcp_workqueue/sys/netinet X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Oct 2012 14:34:14 -0000 Author: andre Date: Wed Oct 24 14:34:13 2012 New Revision: 242001 URL: http://svn.freebsd.org/changeset/base/242001 Log: Prevent total TSO not only from exceeding IP_MAXPACKET (64K) with IP[46] header, IP[46] options and TCP header and options but also from exceeding the magic 64K in total DMA size by deducting the max_linkhdr length as well. This fixes an edge case in TSO operation when the NIC driver only handles 64K DMA transfers including ethernet link headers. Modified: user/andre/tcp_workqueue/sys/netinet/tcp_output.c Modified: user/andre/tcp_workqueue/sys/netinet/tcp_output.c ============================================================================== --- user/andre/tcp_workqueue/sys/netinet/tcp_output.c Wed Oct 24 14:06:47 2012 (r242000) +++ user/andre/tcp_workqueue/sys/netinet/tcp_output.c Wed Oct 24 14:34:13 2012 (r242001) @@ -772,9 +772,12 @@ send: * Limit a burst to IP_MAXPACKET minus IP, * TCP and options length to keep ip->ip_len * from overflowing. + * Deduct max_linkhdr as well to prevent the + * eventual DMA chain from exceeding IP_MAXPACKET + * (64K) as well. */ - if (len > IP_MAXPACKET - hdrlen) { - len = IP_MAXPACKET - hdrlen; + if (len > IP_MAXPACKET - (hdrlen + max_linkhdr)) { + len = IP_MAXPACKET - (hdrlen + max_linkhdr); sendalot = 1; } @@ -805,7 +808,7 @@ send: } else tso = 0; - KASSERT(len + hdrlen + ipoptlen <= IP_MAXPACKET, + KASSERT(len + hdrlen + ipoptlen + max_linkhdr <= IP_MAXPACKET, ("%s: len > IP_MAXPACKET", __func__)); /*#ifdef DIAGNOSTIC*/