With RSS, epair_select_queue() hashes a packet that carries no RSS hash
with rss_soft_m2cpuid_v4() or rss_soft_m2cpuid_v6(), which read the IP
header at the start of the mbuf. On transmit the mbuf starts with the
Ethernet header, so the hash covered the MAC addresses, the EtherType
and the first bytes of the IP header, the IPv4 total length and
identification among them. The packets of one flow were spread over the
queues by their IP ID and delivered out of order, and the value was
stored in the mbuf as an RSS hash for the receiving side to use.
Step over the Ethernet header, and over inline 802.1Q or 802.1ad tags,
while the software hash runs. A tag is inline when vlan(4) or a bridge
member runs without VLAN_HWTAGGING, always for 802.1ad, and for the
inner tag of stacked vlans; those frames previously went to the first
queue unhashed. Frames with more than two tags still do.
Hash with rss_mbuf_software_hash_v4() and rss_mbuf_software_hash_v6()
and map the hash with rss_getbucket(), as the hardware hash path does,
instead of calling the netisr CPU selectors rss_soft_m2cpuid_v4() and
rss_soft_m2cpuid_v6(): those return NETISR_CPUID_NONE, (u_int)-1, for
a packet they cannot hash, and that value modulo the queue count picked
an arbitrary queue rather than the first one.
Fixes: 24f0bfbad57b ("if_epair: implement fanout")
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")