Add basic RSS awareness for the UDPv6 send path.

This doesn't include the same kind of userland overriding that the IPv4
path has; nor does it yet know about 2-tuple versus 4-tuple hashing.
That'll come later.

Differential Revision:	https://reviews.freebsd.org/D527
Reviewed by:	grehan
This commit is contained in:
adrian 2014-09-09 04:20:53 +00:00
parent 63bc177a08
commit d01f185e80

View File

@ -74,6 +74,7 @@ __FBSDID("$FreeBSD$");
#include "opt_inet6.h" #include "opt_inet6.h"
#include "opt_ipfw.h" #include "opt_ipfw.h"
#include "opt_ipsec.h" #include "opt_ipsec.h"
#include "opt_rss.h"
#include <sys/param.h> #include <sys/param.h>
#include <sys/jail.h> #include <sys/jail.h>
@ -111,6 +112,7 @@ __FBSDID("$FreeBSD$");
#include <netinet/udp.h> #include <netinet/udp.h>
#include <netinet/udp_var.h> #include <netinet/udp_var.h>
#include <netinet/udplite.h> #include <netinet/udplite.h>
#include <netinet/in_rss.h>
#include <netinet6/ip6protosw.h> #include <netinet6/ip6protosw.h>
#include <netinet6/ip6_var.h> #include <netinet6/ip6_var.h>
@ -850,8 +852,30 @@ udp6_output(struct inpcb *inp, struct mbuf *m, struct sockaddr *addr6,
m->m_pkthdr.csum_data = offsetof(struct udphdr, uh_sum); 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->m_flags |= M_FLOWID;
M_HASHTYPE_SET(m, M_HASHTYPE_RSS_IPV6);
#endif
flags = 0; flags = 0;
#ifdef RSS
/*
* Don't override with the inp cached flowid.
*
* Until the whole UDP path is vetted, it may actually
* be incorrect.
*/
flags |= IP_NODEFAULTFLOWID;
#endif
UDP_PROBE(send, NULL, inp, ip6, inp, udp6); UDP_PROBE(send, NULL, inp, ip6, inp, udp6);
UDPSTAT_INC(udps_opackets); UDPSTAT_INC(udps_opackets);
error = ip6_output(m, optp, NULL, flags, inp->in6p_moptions, error = ip6_output(m, optp, NULL, flags, inp->in6p_moptions,