From owner-svn-src-all@FreeBSD.ORG Wed Mar 25 10:41:10 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8ACD2E99; Wed, 25 Mar 2015 10:41:10 +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 5BD2DA54; Wed, 25 Mar 2015 10:41:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t2PAfAdq090509; Wed, 25 Mar 2015 10:41:10 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t2PAfAUm090508; Wed, 25 Mar 2015 10:41:10 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201503251041.t2PAfAUm090508@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:41:10 +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: r280537 - 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-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Mar 2015 10:41:10 -0000 Author: arybchik Date: Wed Mar 25 10:41:09 2015 New Revision: 280537 URL: https://svnweb.freebsd.org/changeset/base/280537 Log: MFC: 278937 sfxge: add TCP segment size to sfxge_tso_state It avoids access to m_pkthdr when TSO packet is started and also makes tso_start_new_packet() function smaller. 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:40:17 2015 (r280536) +++ stable/10/sys/dev/sfxge/sfxge_tx.c Wed Mar 25 10:41:09 2015 (r280537) @@ -790,6 +790,7 @@ struct sfxge_tso_state { ssize_t nh_off; /* Offset of network header */ ssize_t tcph_off; /* Offset of TCP header */ unsigned header_len; /* Number of bytes of header */ + unsigned seg_size; /* TCP segment size */ }; static const struct ip *tso_iph(const struct sfxge_tso_state *tso) @@ -891,6 +892,7 @@ static void tso_start(struct sfxge_tso_s } tso->header_len = tso->tcph_off + 4 * tso_tcph(tso)->th_off; + tso->seg_size = mbuf->m_pkthdr.tso_segsz; tso->seqnum = ntohl(tso_tcph(tso)->th_seq); @@ -1007,11 +1009,10 @@ static int tso_start_new_packet(struct s m_copydata(tso->mbuf, 0, tso->header_len, header); tsoh_th->th_seq = htonl(tso->seqnum); - tso->seqnum += tso->mbuf->m_pkthdr.tso_segsz; - if (tso->out_len > tso->mbuf->m_pkthdr.tso_segsz) { + tso->seqnum += tso->seg_size; + if (tso->out_len > tso->seg_size) { /* This packet will not finish the TSO burst. */ - ip_length = tso->header_len - tso->nh_off + - tso->mbuf->m_pkthdr.tso_segsz; + ip_length = tso->header_len - tso->nh_off + tso->seg_size; tsoh_th->th_flags &= ~(TH_FIN | TH_PUSH); } else { /* This packet will be the last in the TSO burst. */ @@ -1033,7 +1034,7 @@ static int tso_start_new_packet(struct s /* Make the header visible to the hardware. */ bus_dmamap_sync(txq->packet_dma_tag, map, BUS_DMASYNC_PREWRITE); - tso->packet_space = tso->mbuf->m_pkthdr.tso_segsz; + tso->packet_space = tso->seg_size; txq->tso_packets++; /* Form a descriptor for this header. */