diff options
author | adrian <adrian@FreeBSD.org> | 2014-05-18 22:32:04 +0000 |
---|---|---|
committer | adrian <adrian@FreeBSD.org> | 2014-05-18 22:32:04 +0000 |
commit | 6cb1f60ec96b2933e4407d307a6a9583859a2240 (patch) | |
tree | 6f5f289d706b2c535ca5d529c9c3c08b219bde26 /sys/netinet/in_rss.c | |
parent | f91e4baca7e6ca89e8d188094776a02786928a35 (diff) | |
download | FreeBSD-src-6cb1f60ec96b2933e4407d307a6a9583859a2240.zip FreeBSD-src-6cb1f60ec96b2933e4407d307a6a9583859a2240.tar.gz |
Add a new function to do a CPU ID lookup based on RSS hash information.
This is intended to be used by various places that wish to hash some
information about a TCP/UDP/IP flow but don't necessarily have a
live mbuf to do it with.
Refactor rss_m2cpuid() to use the refactored function.
Diffstat (limited to 'sys/netinet/in_rss.c')
-rw-r--r-- | sys/netinet/in_rss.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/sys/netinet/in_rss.c b/sys/netinet/in_rss.c index 79da70d..a95f0c3 100644 --- a/sys/netinet/in_rss.c +++ b/sys/netinet/in_rss.c @@ -407,27 +407,34 @@ rss_getcpu(u_int bucket) } /* - * netisr CPU affinity lookup routine for use by protocols. + * netisr CPU affinity lookup given just the hash and hashtype. */ -struct mbuf * -rss_m2cpuid(struct mbuf *m, uintptr_t source, u_int *cpuid) +u_int +rss_hash2cpuid(uint32_t hash_val, uint32_t hash_type) { - M_ASSERTPKTHDR(m); - - switch (M_HASHTYPE_GET(m)) { + switch (hash_type) { case M_HASHTYPE_RSS_IPV4: case M_HASHTYPE_RSS_TCP_IPV4: - *cpuid = rss_getcpu(rss_getbucket(m->m_pkthdr.flowid)); - return (m); - + return (rss_getcpu(rss_getbucket(hash_val))); default: - *cpuid = NETISR_CPUID_NONE; - return (m); + return (NETISR_CPUID_NONE); } } /* + * netisr CPU affinity lookup routine for use by protocols. + */ +struct mbuf * +rss_m2cpuid(struct mbuf *m, uintptr_t source, u_int *cpuid) +{ + + M_ASSERTPKTHDR(m); + *cpuid = rss_hash2cpuid(m->m_pkthdr.flowid, M_HASHTYPE_GET(m)); + return (m); +} + +/* * Query the RSS hash algorithm. */ u_int |