From owner-svn-src-stable@FreeBSD.ORG Thu Jun 12 04:47:15 2014 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 493132A7; Thu, 12 Jun 2014 04:47:15 +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 343FD2E3D; Thu, 12 Jun 2014 04:47:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s5C4lFG0009402; Thu, 12 Jun 2014 04:47:15 GMT (envelope-from bryanv@svn.freebsd.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s5C4lFHF009401; Thu, 12 Jun 2014 04:47:15 GMT (envelope-from bryanv@svn.freebsd.org) Message-Id: <201406120447.s5C4lFHF009401@svn.freebsd.org> From: Bryan Venteicher Date: Thu, 12 Jun 2014 04:47:15 +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: r267382 - stable/10/sys/dev/vmware/vmxnet3 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 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: Thu, 12 Jun 2014 04:47:15 -0000 Author: bryanv Date: Thu Jun 12 04:47:14 2014 New Revision: 267382 URL: http://svnweb.freebsd.org/changeset/base/267382 Log: MFC r267252, r267253: - Remove an unnecessary variable reassignment - Fix TSO support on VMware Fusion Modified: stable/10/sys/dev/vmware/vmxnet3/if_vmx.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/vmware/vmxnet3/if_vmx.c ============================================================================== --- stable/10/sys/dev/vmware/vmxnet3/if_vmx.c Thu Jun 12 01:33:01 2014 (r267381) +++ stable/10/sys/dev/vmware/vmxnet3/if_vmx.c Thu Jun 12 04:47:14 2014 (r267382) @@ -55,6 +55,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include #include #include @@ -2602,6 +2604,12 @@ vmxnet3_txq_offload_ctx(struct vmxnet3_t { struct ether_vlan_header *evh; int offset; +#if defined(INET) + struct ip *ip, iphdr; +#endif +#if defined(INET6) + struct ip6_hdr *ip6, ip6hdr; +#endif evh = mtod(m, struct ether_vlan_header *); if (evh->evl_encap_proto == htons(ETHERTYPE_VLAN)) { @@ -2615,8 +2623,7 @@ vmxnet3_txq_offload_ctx(struct vmxnet3_t switch (*etype) { #if defined(INET) - case ETHERTYPE_IP: { - struct ip *ip, iphdr; + case ETHERTYPE_IP: if (__predict_false(m->m_len < offset + sizeof(struct ip))) { m_copydata(m, offset, sizeof(struct ip), (caddr_t) &iphdr); @@ -2626,10 +2633,16 @@ vmxnet3_txq_offload_ctx(struct vmxnet3_t *proto = ip->ip_p; *start = offset + (ip->ip_hl << 2); break; - } #endif #if defined(INET6) case ETHERTYPE_IPV6: + if (__predict_false(m->m_len < + offset + sizeof(struct ip6_hdr))) { + m_copydata(m, offset, sizeof(struct ip6_hdr), + (caddr_t) &ip6hdr); + ip6 = &ip6hdr; + } else + ip6 = mtodo(m, offset); *proto = -1; *start = ip6_lasthdr(m, offset, IPPROTO_IPV6, proto); /* Assert the network stack sent us a valid packet. */ @@ -2644,6 +2657,7 @@ vmxnet3_txq_offload_ctx(struct vmxnet3_t if (m->m_pkthdr.csum_flags & CSUM_TSO) { struct tcphdr *tcp, tcphdr; + uint16_t sum; if (__predict_false(*proto != IPPROTO_TCP)) { /* Likely failed to correctly parse the mbuf. */ @@ -2652,16 +2666,38 @@ vmxnet3_txq_offload_ctx(struct vmxnet3_t txq->vxtxq_stats.vmtxs_tso++; - /* - * For TSO, the size of the protocol header is also - * included in the descriptor header size. - */ + switch (*etype) { +#if defined(INET) + case ETHERTYPE_IP: + sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, + htons(IPPROTO_TCP)); + break; +#endif +#if defined(INET6) + case ETHERTYPE_IPV6: + sum = in6_cksum_pseudo(ip6, 0, IPPROTO_TCP, 0); + break; +#endif + default: + sum = 0; + break; + } + if (m->m_len < *start + sizeof(struct tcphdr)) { - m_copydata(m, offset, sizeof(struct tcphdr), + m_copyback(m, *start + offsetof(struct tcphdr, th_sum), + sizeof(uint16_t), (caddr_t) &sum); + m_copydata(m, *start, sizeof(struct tcphdr), (caddr_t) &tcphdr); tcp = &tcphdr; - } else + } else { tcp = mtodo(m, *start); + tcp->th_sum = sum; + } + + /* + * For TSO, the size of the protocol header is also + * included in the descriptor header size. + */ *start += (tcp->th_off << 2); } else txq->vxtxq_stats.vmtxs_csum++; @@ -2755,7 +2791,7 @@ vmxnet3_txq_encap(struct vmxnet3_txqueue } } - txr->vxtxr_txbuf[txr->vxtxr_head].vtxb_m = m = *m0; + txr->vxtxr_txbuf[txr->vxtxr_head].vtxb_m = m; sop = &txr->vxtxr_txd[txr->vxtxr_head]; gen = txr->vxtxr_gen ^ 1; /* Owned by cpu (yet) */