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

Function xps_proto_software_hash_v6

freebsd/netinet6/in6_rss.c:166–196  ·  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. * * It assumes the packet source/destination address * are in "outgoin" packet order (ie, desti

Source from the content-addressed store, hash-verified

164 * are in "outgoin" packet order (ie, destination is "far" address.)
165 */
166uint32_t
167xps_proto_software_hash_v6(const struct in6_addr *s, const struct in6_addr *d,
168 u_short sp, u_short dp, int proto, uint32_t *hashtype)
169{
170
171 uint32_t hash;
172
173 /*
174 * Next, choose the hash type depending upon the protocol
175 * identifier.
176 */
177 if ((proto == IPPROTO_TCP) &&
178 (rss_gethashconfig() & RSS_HASHTYPE_RSS_TCP_IPV6)) {
179 hash = rss_hash_ip6_4tuple(d, dp, s, sp);
180 *hashtype = M_HASHTYPE_RSS_TCP_IPV6;
181 return (hash);
182 } else if ((proto == IPPROTO_UDP) &&
183 (rss_gethashconfig() & RSS_HASHTYPE_RSS_UDP_IPV6)) {
184 hash = rss_hash_ip6_4tuple(d, dp, s, sp);
185 *hashtype = M_HASHTYPE_RSS_UDP_IPV6;
186 return (hash);
187 } else if (rss_gethashconfig() & RSS_HASHTYPE_RSS_IPV6) {
188 /* RSS doesn't hash on other protocols like SCTP; so 2-tuple */
189 hash = rss_hash_ip6_2tuple(d, s);
190 *hashtype = M_HASHTYPE_RSS_IPV6;
191 return (hash);
192 }
193
194 *hashtype = M_HASHTYPE_NONE;
195 return (0);
196}
197
198
199/*

Callers

nothing calls this directly

Calls 3

rss_gethashconfigFunction · 0.85
rss_hash_ip6_4tupleFunction · 0.85
rss_hash_ip6_2tupleFunction · 0.85

Tested by

no test coverage detected