summaryrefslogtreecommitdiffstats
path: root/sys/netinet6/in6_pcb.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/netinet6/in6_pcb.c')
-rw-r--r--sys/netinet6/in6_pcb.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c
index 848f3c6..068ac72 100644
--- a/sys/netinet6/in6_pcb.c
+++ b/sys/netinet6/in6_pcb.c
@@ -71,6 +71,7 @@ __FBSDID("$FreeBSD$");
#include "opt_inet6.h"
#include "opt_ipsec.h"
#include "opt_pcbgroup.h"
+#include "opt_rss.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -1136,7 +1137,7 @@ struct inpcb *
in6_pcblookup(struct inpcbinfo *pcbinfo, struct in6_addr *faddr, u_int fport,
struct in6_addr *laddr, u_int lport, int lookupflags, struct ifnet *ifp)
{
-#if defined(PCBGROUP)
+#if defined(PCBGROUP) && !defined(RSS)
struct inpcbgroup *pcbgroup;
#endif
@@ -1145,7 +1146,17 @@ in6_pcblookup(struct inpcbinfo *pcbinfo, struct in6_addr *faddr, u_int fport,
KASSERT((lookupflags & (INPLOOKUP_RLOCKPCB | INPLOOKUP_WLOCKPCB)) != 0,
("%s: LOCKPCB not set", __func__));
-#if defined(PCBGROUP)
+ /*
+ * When not using RSS, use connection groups in preference to the
+ * reservation table when looking up 4-tuples. When using RSS, just
+ * use the reservation table, due to the cost of the Toeplitz hash
+ * in software.
+ *
+ * XXXRW: This policy belongs in the pcbgroup code, as in principle
+ * we could be doing RSS with a non-Toeplitz hash that is affordable
+ * in software.
+ */
+#if defined(PCBGROUP) && !defined(RSS)
if (in_pcbgroup_enabled(pcbinfo)) {
pcbgroup = in6_pcbgroup_bytuple(pcbinfo, laddr, lport, faddr,
fport);
@@ -1172,16 +1183,27 @@ in6_pcblookup_mbuf(struct inpcbinfo *pcbinfo, struct in6_addr *faddr,
("%s: LOCKPCB not set", __func__));
#ifdef PCBGROUP
- if (in_pcbgroup_enabled(pcbinfo)) {
+ /*
+ * If we can use a hardware-generated hash to look up the connection
+ * group, use that connection group to find the inpcb. Otherwise
+ * fall back on a software hash -- or the reservation table if we're
+ * using RSS.
+ *
+ * XXXRW: As above, that policy belongs in the pcbgroup code.
+ */
+ if (in_pcbgroup_enabled(pcbinfo) &&
+ !(M_HASHTYPE_TEST(m, M_HASHTYPE_NONE))) {
pcbgroup = in6_pcbgroup_byhash(pcbinfo, M_HASHTYPE_GET(m),
m->m_pkthdr.flowid);
if (pcbgroup != NULL)
return (in6_pcblookup_group(pcbinfo, pcbgroup, faddr,
fport, laddr, lport, lookupflags, ifp));
+#ifndef RSS
pcbgroup = in6_pcbgroup_bytuple(pcbinfo, laddr, lport, faddr,
fport);
return (in6_pcblookup_group(pcbinfo, pcbgroup, faddr, fport,
laddr, lport, lookupflags, ifp));
+#endif
}
#endif
return (in6_pcblookup_hash(pcbinfo, faddr, fport, laddr, lport,
OpenPOWER on IntegriCloud