summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Gross <jesse@nicira.com>2015-02-17 17:46:09 -0800
committerJesse Gross <jesse@nicira.com>2015-02-20 15:34:26 -0800
commit2d79a600a6bafe290b4fca62062ea6bb3993578d (patch)
tree9e7e7e223c87de4e48d7bf9cabfdbb5c38438294
parenta19920cc02c2c5e4f3883dbb141dcffa04020a5f (diff)
downloadopenvswitch-2d79a600a6bafe290b4fca62062ea6bb3993578d.tar.gz
datapath: Account for "openvswitch: Add support for checksums on UDP tunnels."
Upstream commit: openvswitch: Add support for checksums on UDP tunnels. Currently, it isn't possible to request checksums on the outer UDP header of tunnels - the TUNNEL_CSUM flag is ignored. This adds support for requesting that UDP checksums be computed on transmit and properly reported if they are present on receive. Signed-off-by: Jesse Gross <jesse@nicira.com> Signed-off-by: David S. Miller <davem@davemloft.net> Upstream: b8693877 ("openvswitch: Add support for checksums on UDP tunnels.") Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Pravin B Shelar <pshelar@nicira.com>
-rw-r--r--datapath/linux/compat/include/net/vxlan.h4
-rw-r--r--datapath/linux/compat/vxlan.c5
-rw-r--r--datapath/vport-vxlan.c7
3 files changed, 12 insertions, 4 deletions
diff --git a/datapath/linux/compat/include/net/vxlan.h b/datapath/linux/compat/include/net/vxlan.h
index 198a1e353..7511c2e85 100644
--- a/datapath/linux/compat/include/net/vxlan.h
+++ b/datapath/linux/compat/include/net/vxlan.h
@@ -79,6 +79,10 @@ struct vxlanhdr_gbp {
#define VXLAN_F_GBP 0x800
#endif
+#ifndef VXLAN_F_UDP_CSUM
+#define VXLAN_F_UDP_CSUM 0x40
+#endif
+
#ifndef VXLAN_F_RCV_FLAGS
#define VXLAN_F_RCV_FLAGS VXLAN_F_GBP
#endif
diff --git a/datapath/linux/compat/vxlan.c b/datapath/linux/compat/vxlan.c
index 532f8ac6b..960ddba63 100644
--- a/datapath/linux/compat/vxlan.c
+++ b/datapath/linux/compat/vxlan.c
@@ -189,8 +189,9 @@ int vxlan_xmit_skb(struct vxlan_sock *vs,
struct vxlanhdr *vxh;
int min_headroom;
int err;
+ bool udp_sum = !!(vxflags & VXLAN_F_UDP_CSUM);
- skb = udp_tunnel_handle_offloads(skb, false, true);
+ skb = udp_tunnel_handle_offloads(skb, udp_sum, true);
if (IS_ERR(skb))
return PTR_ERR(skb);
@@ -222,7 +223,7 @@ int vxlan_xmit_skb(struct vxlan_sock *vs,
return udp_tunnel_xmit_skb(rt, skb, src, dst, tos,
ttl, df, src_port, dst_port, xnet,
- true);
+ !udp_sum);
}
static void rcu_free_vs(struct rcu_head *rcu)
diff --git a/datapath/vport-vxlan.c b/datapath/vport-vxlan.c
index 7fcb88a78..c25cc5889 100644
--- a/datapath/vport-vxlan.c
+++ b/datapath/vport-vxlan.c
@@ -72,7 +72,7 @@ static void vxlan_rcv(struct vxlan_sock *vs, struct sk_buff *skb,
__be64 key;
__be16 flags;
- flags = TUNNEL_KEY;
+ flags = TUNNEL_KEY | (udp_hdr(skb)->check != 0 ? TUNNEL_CSUM : 0);
vxlan_port = vxlan_vport(vport);
if (vxlan_port->exts & VXLAN_F_GBP && md->gbp)
flags |= TUNNEL_VXLAN_OPT;
@@ -228,6 +228,7 @@ static int vxlan_tnl_send(struct vport *vport, struct sk_buff *skb)
__be32 saddr;
__be16 df;
int err;
+ u32 vxflags;
if (unlikely(!OVS_CB(skb)->egress_tun_info)) {
err = -EINVAL;
@@ -253,13 +254,15 @@ static int vxlan_tnl_send(struct vport *vport, struct sk_buff *skb)
src_port = udp_flow_src_port(net, skb, 0, 0, true);
md.vni = htonl(be64_to_cpu(tun_key->tun_id) << 8);
md.gbp = vxlan_ext_gbp(skb);
+ vxflags = vxlan_port->exts |
+ (tun_key->tun_flags & TUNNEL_CSUM ? VXLAN_F_UDP_CSUM : 0);
err = vxlan_xmit_skb(vxlan_port->vs, rt, skb,
saddr, tun_key->ipv4_dst,
tun_key->ipv4_tos,
tun_key->ipv4_ttl, df,
src_port, dst_port,
- &md, false, vxlan_port->exts);
+ &md, false, vxflags);
if (err < 0)
ip_rt_put(rt);
return err;