Page MenuHomeFreeBSD

D28773.id84198.diff
No OneTemporary

D28773.id84198.diff

diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c
--- a/sys/kern/uipc_mbuf.c
+++ b/sys/kern/uipc_mbuf.c
@@ -855,6 +855,29 @@
}
}
+void
+m_adj_decap(struct mbuf *mp, int len)
+{
+ uint8_t rsstype;
+
+ m_adj(mp, len);
+ if ((mp->m_flags & M_PKTHDR) != 0) {
+ /*
+ * In flowid was calculated by card from the inner
+ * headers, move flowid to the decapsulated mbuf
+ * chain, otherwise clear. This depends on the
+ * internals of m_adj, which keeps pkthdr as is, in
+ * particular not changing rsstype and flowid.
+ */
+ rsstype = mp->m_pkthdr.rsstype;
+ if ((rsstype & M_HASHTYPE_INNER) != 0) {
+ M_HASHTYPE_SET(mp, rsstype & ~M_HASHTYPE_INNER);
+ } else {
+ M_HASHTYPE_CLEAR(mp);
+ }
+ }
+}
+
/*
* Rearange an mbuf chain so that len bytes are contiguous
* and in the data area of an mbuf (so that mtod will work
diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c
--- a/sys/net/if_gif.c
+++ b/sys/net/if_gif.c
@@ -540,7 +540,8 @@
m_freem(m);
goto drop;
}
- m_adj(m, sizeof(struct etherip_header));
+
+ m_adj_decap(m, sizeof(struct etherip_header));
m->m_flags &= ~(M_BCAST|M_MCAST);
m->m_pkthdr.rcvif = ifp;
diff --git a/sys/net/if_vxlan.c b/sys/net/if_vxlan.c
--- a/sys/net/if_vxlan.c
+++ b/sys/net/if_vxlan.c
@@ -2780,8 +2780,9 @@
goto out;
vni = ntohl(vxh->vxlh_vni) >> VXLAN_HDR_VNI_SHIFT;
+
/* Adjust to the start of the inner Ethernet frame. */
- m_adj(m, offset + sizeof(struct vxlan_header));
+ m_adj_decap(m, offset + sizeof(struct vxlan_header));
error = vxlan_input(vso, vni, &m, srcsa);
MPASS(error != 0 || m == NULL);
diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h
--- a/sys/sys/mbuf.h
+++ b/sys/sys/mbuf.h
@@ -532,6 +532,7 @@
* https://docs.microsoft.com/en-us/windows-hardware/drivers/network/rss-hashing-types#ndishashipv6ex
*/
#define M_HASHTYPE_HASHPROP 0x80 /* has hash properties */
+#define M_HASHTYPE_INNER 0x40 /* calculated from inner headers */
#define M_HASHTYPE_HASH(t) (M_HASHTYPE_HASHPROP | (t))
/* Microsoft RSS standard hash types */
#define M_HASHTYPE_NONE 0
@@ -548,15 +549,19 @@
#define M_HASHTYPE_RSS_UDP_IPV6_EX M_HASHTYPE_HASH(10)/* IPv6 UDP 4-tuple +
* ext hdrs */
-#define M_HASHTYPE_OPAQUE 63 /* ordering, not affinity */
+#define M_HASHTYPE_OPAQUE 0x3f /* ordering, not affinity */
#define M_HASHTYPE_OPAQUE_HASH M_HASHTYPE_HASH(M_HASHTYPE_OPAQUE)
/* ordering+hash, not affinity*/
#define M_HASHTYPE_CLEAR(m) ((m)->m_pkthdr.rsstype = 0)
-#define M_HASHTYPE_GET(m) ((m)->m_pkthdr.rsstype)
+#define M_HASHTYPE_GET(m) ((m)->m_pkthdr.rsstype & ~M_HASHTYPE_INNER)
#define M_HASHTYPE_SET(m, v) ((m)->m_pkthdr.rsstype = (v))
#define M_HASHTYPE_TEST(m, v) (M_HASHTYPE_GET(m) == (v))
-#define M_HASHTYPE_ISHASH(m) (M_HASHTYPE_GET(m) & M_HASHTYPE_HASHPROP)
+#define M_HASHTYPE_ISHASH(m) \
+ ((M_HASHTYPE_GET(m) & M_HASHTYPE_HASHPROP) != 0)
+#define M_HASHTYPE_SETINNER(m) do { \
+ (m)->m_pkthdr.rsstype |= M_HASHTYPE_INNER; \
+ } while (0)
/*
* External mbuf storage buffer types.
@@ -792,6 +797,7 @@
struct mbuf *mb_unmapped_to_ext(struct mbuf *m);
void mb_free_notready(struct mbuf *m, int count);
void m_adj(struct mbuf *, int);
+void m_adj_decap(struct mbuf *, int);
int m_apply(struct mbuf *, int, int,
int (*)(void *, void *, u_int), void *);
int m_append(struct mbuf *, int, c_caddr_t);

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 19, 2:10 AM (20 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14708592
Default Alt Text
D28773.id84198.diff (3 KB)

Event Timeline