From owner-svn-src-all@FreeBSD.ORG Thu Jan 29 18:59:23 2015 Return-Path: Delivered-To: svn-src-all@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 89D8B5B8; Thu, 29 Jan 2015 18:59:23 +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 5D1D4807; Thu, 29 Jan 2015 18:59:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t0TIxNjA077625; Thu, 29 Jan 2015 18:59:23 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t0TIxNTi077624; Thu, 29 Jan 2015 18:59:23 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201501291859.t0TIxNTi077624@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Thu, 29 Jan 2015 18:59:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r277888 - 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: Thu, 29 Jan 2015 18:59:23 -0000 Author: arybchik Date: Thu Jan 29 18:59:22 2015 New Revision: 277888 URL: https://svnweb.freebsd.org/changeset/base/277888 Log: sfxge: fixed TSO code to cope with VLAN headers Submitted by: Artem V. Andreev 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 Thu Jan 29 18:57:27 2015 (r277887) +++ head/sys/dev/sfxge/sfxge_tx.c Thu Jan 29 18:59:22 2015 (r277888) @@ -855,9 +855,7 @@ static void tso_start(struct sfxge_tso_s tso->tcph_off = tso->nh_off + sizeof(struct ip6_hdr); } - /* We assume all headers are linear in the head mbuf */ tso->header_len = tso->tcph_off + 4 * tso_tcph(tso)->th_off; - KASSERT(tso->header_len <= mbuf->m_len, ("packet headers fragmented")); tso->full_packet_size = tso->header_len + mbuf->m_pkthdr.tso_segsz; tso->seqnum = ntohl(tso_tcph(tso)->th_seq); @@ -972,7 +970,7 @@ static int tso_start_new_packet(struct s tsoh_th = (struct tcphdr *)(header + tso->tcph_off); /* Copy and update the headers. */ - memcpy(header, tso->mbuf->m_data, tso->header_len); + m_copydata(tso->mbuf, 0, tso->header_len, header); tsoh_th->th_seq = htonl(tso->seqnum); tso->seqnum += tso->mbuf->m_pkthdr.tso_segsz; @@ -1018,20 +1016,18 @@ sfxge_tx_queue_tso(struct sfxge_txq *txq { struct sfxge_tso_state tso; unsigned int id, next_id; + unsigned skipped = 0; tso_start(&tso, mbuf); - /* Grab the first payload fragment. */ - if (dma_seg->ds_len == tso.header_len) { + while (dma_seg->ds_len + skipped <= tso.header_len) { + skipped += dma_seg->ds_len; --n_dma_seg; KASSERT(n_dma_seg, ("no payload found in TSO packet")); ++dma_seg; - tso.in_len = dma_seg->ds_len; - tso.dma_addr = dma_seg->ds_addr; - } else { - tso.in_len = dma_seg->ds_len - tso.header_len; - tso.dma_addr = dma_seg->ds_addr + tso.header_len; } + tso.in_len = dma_seg->ds_len + (tso.header_len - skipped); + tso.dma_addr = dma_seg->ds_addr + (tso.header_len - skipped); id = txq->added & txq->ptr_mask; if (__predict_false(tso_start_new_packet(txq, &tso, id)))