Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Mar 2017 08:24:17 +0000 (UTC)
From:      Sepherosa Ziehau <sephe@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r314483 - head/sys/dev/hyperv/netvsc
Message-ID:  <201703010824.v218OH01012585@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703010824.v218OH01012585>