MCPcopy Create free account
hub / github.com/F-Stack/f-stack / rss_proto_software_hash_v6

Function rss_proto_software_hash_v6

freebsd/netinet6/in6_rss.c:119–153  ·  view source on GitHub ↗

* Calculate an appropriate ipv6 2-tuple or 4-tuple given the given * IPv6 source/destination address, UDP or TCP source/destination ports * and the protocol type. * * The protocol code may wish to do a software hash of the given * tuple. This depends upon the currently configured RSS hash types. * * This assumes that the packet in question isn't a fragment. * * It also assumes the packet

Source from the content-addressed store, hash-verified

117 * are in "incoming" packet order (ie, source is "far" address.)
118 */
119int
120rss_proto_software_hash_v6(const struct in6_addr *s, const struct in6_addr *d,
121 u_short sp, u_short dp, int proto,
122 uint32_t *hashval, uint32_t *hashtype)
123{
124 uint32_t hash;
125
126 /*
127 * Next, choose the hash type depending upon the protocol
128 * identifier.
129 */
130 if ((proto == IPPROTO_TCP) &&
131 (rss_gethashconfig() & RSS_HASHTYPE_RSS_TCP_IPV6)) {
132 hash = rss_hash_ip6_4tuple(s, sp, d, dp);
133 *hashval = hash;
134 *hashtype = M_HASHTYPE_RSS_TCP_IPV6;
135 return (0);
136 } else if ((proto == IPPROTO_UDP) &&
137 (rss_gethashconfig() & RSS_HASHTYPE_RSS_UDP_IPV6)) {
138 hash = rss_hash_ip6_4tuple(s, sp, d, dp);
139 *hashval = hash;
140 *hashtype = M_HASHTYPE_RSS_UDP_IPV6;
141 return (0);
142 } else if (rss_gethashconfig() & RSS_HASHTYPE_RSS_IPV6) {
143 /* RSS doesn't hash on other protocols like SCTP; so 2-tuple */
144 hash = rss_hash_ip6_2tuple(s, d);
145 *hashval = hash;
146 *hashtype = M_HASHTYPE_RSS_IPV6;
147 return (0);
148 }
149
150 /* No configured available hashtypes! */
151 RSS_DEBUG("no available hashtypes!\n");
152 return (-1);
153}
154
155/*
156 * Calculate an appropriate ipv6 2-tuple or 4-tuple given the given

Callers 1

Calls 3

rss_gethashconfigFunction · 0.85
rss_hash_ip6_4tupleFunction · 0.85
rss_hash_ip6_2tupleFunction · 0.85

Tested by

no test coverage detected