Author: sephe
Date: Mon Feb 29 09:05:33 2016
New Revision: 296187
URL: https://svnweb.freebsd.org/changeset/base/296187

Log:
  hyperv/hn: Utilize mbuf flowid
  
  MFC after:    1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:        https://reviews.freebsd.org/D5488

Modified:
  head/sys/dev/hyperv/netvsc/hv_net_vsc.h
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c

Modified: head/sys/dev/hyperv/netvsc/hv_net_vsc.h
==============================================================================
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.h     Mon Feb 29 09:03:07 2016        
(r296186)
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.h     Mon Feb 29 09:05:33 2016        
(r296187)
@@ -1000,10 +1000,11 @@ struct buf_ring;
 
 struct hn_rx_ring {
        struct ifnet    *hn_ifp;
-       struct lro_ctrl hn_lro;
+       int             hn_rx_idx;
 
        /* Trust csum verification on host side */
        int             hn_trust_hcsum; /* HN_TRUST_HCSUM_ */
+       struct lro_ctrl hn_lro;
 
        u_long          hn_csum_ip;
        u_long          hn_csum_tcp;

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==============================================================================
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Mon Feb 29 09:03:07 
2016        (r296186)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Mon Feb 29 09:05:33 
2016        (r296187)
@@ -1287,6 +1287,9 @@ skip:
                m_new->m_flags |= M_VLANTAG;
        }
 
+       m_new->m_pkthdr.flowid = rxr->hn_rx_idx;
+       M_HASHTYPE_SET(m_new, M_HASHTYPE_OPAQUE);
+
        /*
         * Note:  Moved RX completion back to hv_nv_on_receive() so all
         * messages (not just data messages) will trigger a response.
@@ -2037,6 +2040,7 @@ hn_create_rx_data(struct hn_softc *sc)
                if (hn_trust_hostip)
                        rxr->hn_trust_hcsum |= HN_TRUST_HCSUM_IP;
                rxr->hn_ifp = sc->hn_ifp;
+               rxr->hn_rx_idx = i;
 
                /*
                 * Initialize LRO.
@@ -2567,10 +2571,14 @@ hn_transmit(struct ifnet *ifp, struct mb
 {
        struct hn_softc *sc = ifp->if_softc;
        struct hn_tx_ring *txr;
-       int error;
+       int error, idx = 0;
 
-       /* TODO: vRSS, TX ring selection */
-       txr = &sc->hn_tx_ring[0];
+       /*
+        * Select the TX ring based on flowid
+        */
+       if (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE)
+               idx = m->m_pkthdr.flowid % sc->hn_tx_ring_cnt;
+       txr = &sc->hn_tx_ring[idx];
 
        error = drbr_enqueue(ifp, txr->hn_mbuf_br, m);
        if (error)
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to