Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F178006905
D61037.1795748440.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D61037.1795748440.diff
View Options
diff --git a/sys/net/if_epair.c b/sys/net/if_epair.c
--- a/sys/net/if_epair.c
+++ b/sys/net/if_epair.c
@@ -202,35 +202,67 @@
static struct epair_queue *
epair_select_queue(struct epair_softc *sc, struct mbuf *m)
{
- uint32_t bucket;
+ uint32_t bucket = 0;
#ifdef RSS
struct ether_header *eh;
- int ret;
+ uint32_t hash, hashtype;
+ uint16_t etype;
+ int i, off, ret;
ret = rss_m2bucket(m, &bucket);
if (ret) {
- /* Actually hash the packet. */
+ /*
+ * Actually hash the packet. The software hash reads the IP
+ * header at the start of the mbuf, so step over the Ethernet
+ * header, and over any inline 802.1Q or 802.1ad tags, while
+ * it runs. Frames we cannot parse go to the first queue.
+ */
+ off = ETHER_HDR_LEN;
+ if (m->m_len < off)
+ goto done;
eh = mtod(m, struct ether_header *);
+ etype = ntohs(eh->ether_type);
+ for (i = 0; i < 2 && (etype == ETHERTYPE_VLAN ||
+ etype == ETHERTYPE_QINQ); i++) {
+ if (m->m_len < off + ETHER_VLAN_ENCAP_LEN)
+ goto done;
+ memcpy(&etype, mtod(m, char *) + off +
+ sizeof(uint16_t), sizeof(etype));
+ etype = ntohs(etype);
+ off += ETHER_VLAN_ENCAP_LEN;
+ }
- switch (ntohs(eh->ether_type)) {
+ m->m_data += off;
+ m->m_len -= off;
+ m->m_pkthdr.len -= off;
+ switch (etype) {
#ifdef INET
case ETHERTYPE_IP:
- rss_soft_m2cpuid_v4(m, 0, &bucket);
+ ret = rss_mbuf_software_hash_v4(m,
+ RSS_HASH_PKT_INGRESS, &hash, &hashtype);
break;
#endif
#ifdef INET6
case ETHERTYPE_IPV6:
- rss_soft_m2cpuid_v6(m, 0, &bucket);
+ ret = rss_mbuf_software_hash_v6(m,
+ RSS_HASH_PKT_INGRESS, &hash, &hashtype);
break;
#endif
default:
- bucket = 0;
+ ret = -1;
break;
}
+ m->m_data -= off;
+ m->m_len += off;
+ m->m_pkthdr.len += off;
+ if (ret == 0) {
+ m->m_pkthdr.flowid = hash;
+ M_HASHTYPE_SET(m, hashtype);
+ bucket = rss_getbucket(hash);
+ }
}
+done:
bucket %= sc->num_queues;
-#else
- bucket = 0;
#endif
return (&sc->queues[bucket]);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 27, 3:00 AM (21 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41532297
Default Alt Text
D61037.1795748440.diff (1 KB)
Attached To
Mode
D61037: if_epair: Hash the IP header, not the Ethernet header, for fanout
Attached
Detach File
Event Timeline