struct inpcbgroup * in6_pcbgroup_bytuple(struct inpcbinfo *pcbinfo, const struct in6_addr *laddrp, u_short lport, const struct in6_addr *faddrp, u_short fport) { uint32_t hash; /* * RSS note: we pass foreign addr/port as source, and local addr/port * as destination, as we want to align with what the hardware is * doing. */ switch (pcbinfo->ipi_hashfields) { case IPI_HASHFIELDS_4TUPLE: #ifdef RSS hash = rss_hash_ip6_4tuple(faddrp, fport, laddrp, lport); #else hash = faddrp->s6_addr32[3] ^ fport; #endif break; case IPI_HASHFIELDS_2TUPLE: #ifdef RSS hash = rss_hash_ip6_2tuple(faddrp, laddrp); #else hash = faddrp->s6_addr32[3] ^ laddrp->s6_addr32[3]; #endif break; default: hash = 0; } return (&pcbinfo->ipi_pcbgroups[in6_pcbgroup_getbucket(pcbinfo, hash)]); }
/* * Map a (hashtype, hash) tuple into a connection group, or NULL if the hash * information is insufficient to identify the pcbgroup. This might occur if * a TCP packet turnsup with a 2-tuple hash, or if an RSS hash is present but * RSS is not compiled into the kernel. */ struct inpcbgroup * in6_pcbgroup_byhash(struct inpcbinfo *pcbinfo, u_int hashtype, uint32_t hash) { #ifdef RSS if ((pcbinfo->ipi_hashfields == IPI_HASHFIELDS_4TUPLE && hashtype == M_HASHTYPE_RSS_TCP_IPV6) || (pcbinfo->ipi_hashfields == IPI_HASHFIELDS_4TUPLE && hashtype == M_HASHTYPE_RSS_UDP_IPV6) || (pcbinfo->ipi_hashfields == IPI_HASHFIELDS_2TUPLE && hashtype == M_HASHTYPE_RSS_IPV6)) return (&pcbinfo->ipi_pcbgroups[ in6_pcbgroup_getbucket(pcbinfo, hash)]); #endif return (NULL); }
struct inpcbgroup * in6_pcbgroup_bytuple(struct inpcbinfo *pcbinfo, const struct in6_addr *laddrp, u_short lport, const struct in6_addr *faddrp, u_short fport) { uint32_t hash; switch (pcbinfo->ipi_hashfields) { case IPI_HASHFIELDS_4TUPLE: hash = faddrp->s6_addr32[3] ^ fport; break; case IPI_HASHFIELDS_2TUPLE: hash = faddrp->s6_addr32[3] ^ laddrp->s6_addr32[3]; break; default: hash = 0; } return (&pcbinfo->ipi_pcbgroups[in6_pcbgroup_getbucket(pcbinfo, hash)]); }