hc
2024-01-31 f9004dbfff8a3fbbd7e2a88c8a4327c7f2f8e5b2
kernel/include/net/vxlan.h
....@@ -327,10 +327,15 @@
327327 return features;
328328 }
329329
330
-/* IP header + UDP + VXLAN + Ethernet header */
331
-#define VXLAN_HEADROOM (20 + 8 + 8 + 14)
332
-/* IPv6 header + UDP + VXLAN + Ethernet header */
333
-#define VXLAN6_HEADROOM (40 + 8 + 8 + 14)
330
+static inline int vxlan_headroom(u32 flags)
331
+{
332
+ /* VXLAN: IP4/6 header + UDP + VXLAN + Ethernet header */
333
+ /* VXLAN-GPE: IP4/6 header + UDP + VXLAN */
334
+ return (flags & VXLAN_F_IPV6 ? sizeof(struct ipv6hdr) :
335
+ sizeof(struct iphdr)) +
336
+ sizeof(struct udphdr) + sizeof(struct vxlanhdr) +
337
+ (flags & VXLAN_F_GPE ? 0 : ETH_HLEN);
338
+}
334339
335340 static inline struct vxlanhdr *vxlan_hdr(struct sk_buff *skb)
336341 {
....@@ -492,12 +497,12 @@
492497 }
493498
494499 static inline bool vxlan_fdb_nh_path_select(struct nexthop *nh,
495
- int hash,
500
+ u32 hash,
496501 struct vxlan_rdst *rdst)
497502 {
498503 struct fib_nh_common *nhc;
499504
500
- nhc = nexthop_path_fdb_result(nh, hash);
505
+ nhc = nexthop_path_fdb_result(nh, hash >> 1);
501506 if (unlikely(!nhc))
502507 return false;
503508