HomeFreeBSD

Implement IPv4 RSS software hash functions to use during packet ingress

Description

Implement IPv4 RSS software hash functions to use during packet ingress
and egress.

  • rss_mbuf_software_hash_v4 - look at the IPv4 mbuf to fetch the IPv4 details + direction to calculate a hash.
  • rss_proto_software_hash_v4 - hash the given source/destination IPv4 address, port and direction.
  • rss_soft_m2cpuid - map the given mbuf to an RSS CPU ("bucket" for now)

These functions are intended to be used by the stack to support
the following:

  • Not all NICs do RSS hashing, so we should support some way of doing a hash in software;
  • The NIC / driver may not hash frames the way we want (eg UDP 4-tuple hashing when the stack is only doing 2-tuple hashing for UDP); so we may need to re-hash frames;
  • .. same with IPv4 fragments - they will need to be re-hashed after reassembly;
  • .. and same with things like IP tunneling and such;
  • The transmit path for things like UDP, RAW and ICMP don't currently have any RSS information attached to them - so they'll need an RSS calculation performed before transmit.

TODO:

  • Counters! Everywhere!
  • Add a debug mode that software hashes received frames and compares them to the hardware hash provided by the hardware to ensure they match.

The IPv6 part of this is missing - I'm going to do some re-juggling of
where various parts of the RSS framework live before I add the IPv6
code (read: the IPv6 code is going to go into netinet6/in6_rss.[ch],
rather than living here.)

Note: This API is still fluid. Please keep that in mind.

Differential Revision: https://reviews.freebsd.org/D527
Reviewed by: grehan

Event Timeline