From owner-svn-src-all@FreeBSD.ORG Wed Feb 18 06:18:52 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 7F86393C; Wed, 18 Feb 2015 06:18:52 +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 5026D251; Wed, 18 Feb 2015 06:18:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t1I6IqpE073501; Wed, 18 Feb 2015 06:18:52 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t1I6Iqjn073500; Wed, 18 Feb 2015 06:18:52 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201502180618.t1I6Iqjn073500@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Wed, 18 Feb 2015 06:18:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r278937 - head/sys/dev/sfxge X-SVN-Group: head 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, 18 Feb 2015 06:18:52 -0000 Author: arybchik Date: Wed Feb 18 06:18:51 2015 New Revision: 278937 URL: https://svnweb.freebsd.org/changeset/base/278937 Log: 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: head/sys/dev/sfxge/sfxge_tx.c Modified: head/sys/dev/sfxge/sfxge_tx.c ============================================================================== --- head/sys/dev/sfxge/sfxge_tx.c Wed Feb 18 05:53:04 2015 (r278936) +++ head/sys/dev/sfxge/sfxge_tx.c Wed Feb 18 06:18:51 2015 (r278937) @@ -791,6 +791,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) @@ -892,6 +893,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); @@ -1008,11 +1010,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. */ @@ -1034,7 +1035,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. */