From owner-svn-src-head@freebsd.org Wed Mar 1 08:24:18 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5FE50CF2ECE; Wed, 1 Mar 2017 08:24:18 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 2F7C0689; Wed, 1 Mar 2017 08:24:18 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v218OHgT012586; Wed, 1 Mar 2017 08:24:17 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v218OH01012585; Wed, 1 Mar 2017 08:24:17 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201703010824.v218OH01012585@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Wed, 1 Mar 2017 08:24:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r314483 - head/sys/dev/hyperv/netvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Mar 2017 08:24:18 -0000 Author: sephe Date: Wed Mar 1 08:24:17 2017 New Revision: 314483 URL: https://svnweb.freebsd.org/changeset/base/314483 Log: hyperv/hn: Simplify RNDIS packet total length calculation. MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D9712 Modified: head/sys/dev/hyperv/netvsc/if_hn.c Modified: head/sys/dev/hyperv/netvsc/if_hn.c ============================================================================== --- head/sys/dev/hyperv/netvsc/if_hn.c Wed Mar 1 08:22:51 2017 (r314482) +++ head/sys/dev/hyperv/netvsc/if_hn.c Wed Mar 1 08:24:17 2017 (r314483) @@ -1784,9 +1784,6 @@ hn_rndis_pktinfo_append(struct rndis_pac pi->rm_type = pi_type; pi->rm_pktinfooffset = RNDIS_PKTINFO_OFFSET; - /* Update RNDIS packet msg length */ - pkt->rm_len += pi_size; - return (pi->rm_data); } @@ -1928,7 +1925,7 @@ hn_encap(struct ifnet *ifp, struct hn_tx } pkt->rm_type = REMOTE_NDIS_PACKET_MSG; - pkt->rm_len = sizeof(*pkt) + m_head->m_pkthdr.len; + pkt->rm_len = m_head->m_pkthdr.len; pkt->rm_dataoffset = 0; pkt->rm_datalen = m_head->m_pkthdr.len; pkt->rm_oobdataoffset = 0; @@ -1999,6 +1996,8 @@ hn_encap(struct ifnet *ifp, struct hn_tx } pkt_hlen = pkt->rm_pktinfooffset + pkt->rm_pktinfolen; + /* Fixup RNDIS packet message total length */ + pkt->rm_len += pkt_hlen; /* Convert RNDIS packet message offsets */ pkt->rm_dataoffset = hn_rndis_pktmsg_offset(pkt_hlen); pkt->rm_pktinfooffset = hn_rndis_pktmsg_offset(pkt->rm_pktinfooffset);