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);
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to