summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJoe Stringer <joestringer@nicira.com>2014-11-18 03:24:54 +0300
committerDavid S. Miller <davem@davemloft.net>2014-11-18 23:38:44 +0300
commit11bf7828a59880427403e13dcff8228d67e9e0f7 (patch)
tree35bc60b412b19009bd5bf604b2e8d98f3116d125 /include
parentfeb91a02ccb09661507f170b2a444aec94f307f9 (diff)
downloadlinux-11bf7828a59880427403e13dcff8228d67e9e0f7.tar.xz
vxlan: Inline vxlan_gso_check().
Suggested-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Joe Stringer <joestringer@nicira.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/net/vxlan.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/include/net/vxlan.h b/include/net/vxlan.h
index afadf8e53f20..57cccd0052e5 100644
--- a/include/net/vxlan.h
+++ b/include/net/vxlan.h
@@ -8,6 +8,12 @@
#define VNI_HASH_BITS 10
#define VNI_HASH_SIZE (1<<VNI_HASH_BITS)
+/* VXLAN protocol header */
+struct vxlanhdr {
+ __be32 vx_flags;
+ __be32 vx_vni;
+};
+
struct vxlan_sock;
typedef void (vxlan_rcv_t)(struct vxlan_sock *vh, struct sk_buff *skb, __be32 key);
@@ -45,7 +51,17 @@ int vxlan_xmit_skb(struct vxlan_sock *vs,
__be32 src, __be32 dst, __u8 tos, __u8 ttl, __be16 df,
__be16 src_port, __be16 dst_port, __be32 vni, bool xnet);
-bool vxlan_gso_check(struct sk_buff *skb);
+static inline bool vxlan_gso_check(struct sk_buff *skb)
+{
+ if ((skb_shinfo(skb)->gso_type & SKB_GSO_UDP_TUNNEL) &&
+ (skb->inner_protocol_type != ENCAP_TYPE_ETHER ||
+ skb->inner_protocol != htons(ETH_P_TEB) ||
+ (skb_inner_mac_header(skb) - skb_transport_header(skb) !=
+ sizeof(struct udphdr) + sizeof(struct vxlanhdr))))
+ return false;
+
+ return true;
+}
/* IP header + UDP + VXLAN + Ethernet header */
#define VXLAN_HEADROOM (20 + 8 + 8 + 14)