Author: adrian
Date: Tue Aug 25 06:12:59 2015
New Revision: 287124
URL: https://svnweb.freebsd.org/changeset/base/287124

Log:
  Call the new RSS hash calculation function to correctly calculate a hash
  based on the configured requirements for the protocol.
  
  Tested:
  
  * UDP IPv6 TX/RX testing, w/ RSS enabled, 82599 ixgbe(4) hardware

Modified:
  head/sys/netinet6/udp6_usrreq.c

Modified: head/sys/netinet6/udp6_usrreq.c
==============================================================================
--- head/sys/netinet6/udp6_usrreq.c     Tue Aug 25 05:31:00 2015        
(r287123)
+++ head/sys/netinet6/udp6_usrreq.c     Tue Aug 25 06:12:59 2015        
(r287124)
@@ -840,19 +840,36 @@ udp6_output(struct inpcb *inp, struct mb
                        m->m_pkthdr.csum_data = offsetof(struct udphdr, uh_sum);
                }
 
-               /*
-                * XXX for now assume UDP is 2-tuple.
-                * Later on this may become configurable as 4-tuple;
-                * we should support that.
-                *
-                * XXX .. and we should likely cache this in the inpcb.
-                */
 #ifdef RSS
-               m->m_pkthdr.flowid = rss_hash_ip6_2tuple(faddr, laddr);
-               M_HASHTYPE_SET(m, M_HASHTYPE_RSS_IPV6);
+               {
+                       uint32_t hash_val, hash_type;
+                       uint8_t pr;
+
+                       pr = inp->inp_socket->so_proto->pr_protocol;
+                       /*
+                        * Calculate an appropriate RSS hash for UDP and
+                        * UDP Lite.
+                        *
+                        * The called function will take care of figuring out
+                        * whether a 2-tuple or 4-tuple hash is required based
+                        * on the currently configured scheme.
+                        *
+                        * Later later on connected socket values should be
+                        * cached in the inpcb and reused, rather than 
constantly
+                        * re-calculating it.
+                        *
+                        * UDP Lite is a different protocol number and will
+                        * likely end up being hashed as a 2-tuple until
+                        * RSS / NICs grow UDP Lite protocol awareness.
+                        */
+                       if (rss_proto_software_hash_v6(faddr, laddr, fport,
+                           inp->inp_lport, pr, &hash_val, &hash_type) == 0) {
+                               m->m_pkthdr.flowid = hash_val;
+                               M_HASHTYPE_SET(m, hash_type);
+                       }
+               }
 #endif
                flags = 0;
-
 #ifdef RSS
                /*
                 * Don't override with the inp cached flowid.
_______________________________________________
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