From owner-svn-src-stable@FreeBSD.ORG Wed Mar 25 10:51:09 2015 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AA640CF7; Wed, 25 Mar 2015 10:51:09 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7A8D7BCE; Wed, 25 Mar 2015 10:51:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t2PAp9ZI098355; Wed, 25 Mar 2015 10:51:09 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t2PAp9DJ098353; Wed, 25 Mar 2015 10:51:09 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201503251051.t2PAp9DJ098353@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Wed, 25 Mar 2015 10:51:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r280547 - stable/10/sys/dev/sfxge X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Mar 2015 10:51:09 -0000 Author: arybchik Date: Wed Mar 25 10:51:08 2015 New Revision: 280547 URL: https://svnweb.freebsd.org/changeset/base/280547 Log: MFC: 279046 sfxge: handle fragmented TCP header in mbuf TCP header is fragmented in the case of VLAN tagged IPv6 traffic without HW VLAN tagging. Sponsored by: Solarflare Communications, Inc. Approved by: gnn (mentor) Modified: stable/10/sys/dev/sfxge/sfxge_tx.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/sfxge/sfxge_tx.c ============================================================================== --- stable/10/sys/dev/sfxge/sfxge_tx.c Wed Mar 25 10:50:13 2015 (r280546) +++ stable/10/sys/dev/sfxge/sfxge_tx.c Wed Mar 25 10:51:08 2015 (r280547) @@ -864,6 +864,8 @@ static void tso_fini(struct sfxge_txq *t static void tso_start(struct sfxge_tso_state *tso, struct mbuf *mbuf) { struct ether_header *eh = mtod(mbuf, struct ether_header *); + const struct tcphdr *th; + struct tcphdr th_copy; tso->mbuf = mbuf; @@ -891,13 +893,24 @@ static void tso_start(struct sfxge_tso_s tso->tcph_off = tso->nh_off + sizeof(struct ip6_hdr); } - tso->header_len = tso->tcph_off + 4 * tso_tcph(tso)->th_off; + KASSERT(mbuf->m_len >= tso->tcph_off, + ("network header is fragmented in mbuf")); + /* We need TCP header including flags (window is the next) */ + if (mbuf->m_len < tso->tcph_off + offsetof(struct tcphdr, th_win)) { + m_copydata(tso->mbuf, tso->tcph_off, sizeof(th_copy), + (caddr_t)&th_copy); + th = &th_copy; + } else { + th = tso_tcph(tso); + } + + tso->header_len = tso->tcph_off + 4 * th->th_off; tso->seg_size = mbuf->m_pkthdr.tso_segsz; - tso->seqnum = ntohl(tso_tcph(tso)->th_seq); + tso->seqnum = ntohl(th->th_seq); /* These flags must not be duplicated */ - KASSERT(!(tso_tcph(tso)->th_flags & (TH_URG | TH_SYN | TH_RST)), + KASSERT(!(th->th_flags & (TH_URG | TH_SYN | TH_RST)), ("incompatible TCP flag on TSO packet")); tso->out_len = mbuf->m_pkthdr.len - tso->header_len;