Author: sephe
Date: Fri Oct 14 03:32:20 2016
New Revision: 307256
URL: https://svnweb.freebsd.org/changeset/base/307256

Log:
  MFC 306433
  
      hyperv/hn: Don't set HASHVAL pktinfo for NDIS < 6.30
  
      This unbreaks packet sending on WS2008R2.
  
      Sponsored by:   Microsoft
      Differential Revision:  https://reviews.freebsd.org/D8057

Modified:
  stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h
  stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h
==============================================================================
--- stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h        Fri Oct 14 03:26:24 
2016        (r307255)
+++ stable/10/sys/dev/hyperv/netvsc/hv_net_vsc.h        Fri Oct 14 03:32:20 
2016        (r307256)
@@ -168,6 +168,7 @@ struct hn_tx_ring {
        struct buf_ring *hn_mbuf_br;
        int             hn_oactive;
        int             hn_tx_idx;
+       int             hn_tx_flags;
 
        struct mtx      hn_tx_lock;
        struct hn_softc *hn_sc;
@@ -194,10 +195,10 @@ struct hn_tx_ring {
        struct hn_txdesc *hn_txdesc;
        bus_dma_tag_t   hn_tx_rndis_dtag;
        struct sysctl_oid *hn_tx_sysctl_tree;
-       int             hn_tx_flags;
 } __aligned(CACHE_LINE_SIZE);
 
 #define HN_TX_FLAG_ATTACHED    0x1
+#define HN_TX_FLAG_HASHVAL     0x2     /* support HASHVAL pktinfo */
 
 /*
  * Device-specific softc structure

Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==============================================================================
--- stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c     Fri Oct 14 
03:26:24 2016        (r307255)
+++ stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c     Fri Oct 14 
03:32:20 2016        (r307256)
@@ -1028,14 +1028,16 @@ hn_encap(struct hn_tx_ring *txr, struct 
        pkt->rm_pktinfooffset = sizeof(*pkt);
        pkt->rm_pktinfolen = 0;
 
-       /*
-        * Set the hash value for this packet, so that the host could
-        * dispatch the TX done event for this packet back to this TX
-        * ring's channel.
-        */
-       pi_data = hn_rndis_pktinfo_append(pkt, HN_RNDIS_PKT_LEN,
-           HN_NDIS_HASH_VALUE_SIZE, HN_NDIS_PKTINFO_TYPE_HASHVAL);
-       *pi_data = txr->hn_tx_idx;
+       if (txr->hn_tx_flags & HN_TX_FLAG_HASHVAL) {
+               /*
+                * Set the hash value for this packet, so that the host could
+                * dispatch the TX done event for this packet back to this TX
+                * ring's channel.
+                */
+               pi_data = hn_rndis_pktinfo_append(pkt, HN_RNDIS_PKT_LEN,
+                   HN_NDIS_HASH_VALUE_SIZE, HN_NDIS_PKTINFO_TYPE_HASHVAL);
+               *pi_data = txr->hn_tx_idx;
+       }
 
        if (m_head->m_flags & M_VLANTAG) {
                pi_data = hn_rndis_pktinfo_append(pkt, HN_RNDIS_PKT_LEN,
@@ -2940,6 +2942,12 @@ hn_fixup_tx_data(struct hn_softc *sc)
 
        for (i = 0; i < sc->hn_tx_ring_cnt; ++i)
                sc->hn_tx_ring[i].hn_csum_assist = csum_assist;
+
+       if (sc->hn_ndis_ver >= HN_NDIS_VERSION_6_30) {
+               /* Support HASHVAL pktinfo on TX path. */
+               for (i = 0; i < sc->hn_tx_ring_cnt; ++i)
+                       sc->hn_tx_ring[i].hn_tx_flags |= HN_TX_FLAG_HASHVAL;
+       }
 }
 
 static void
_______________________________________________
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to