Commit 14f1f724 authored by Alexander Duyck's avatar Alexander Duyck Committed by David S. Miller

GENEVE: Support outer IPv4 Tx checksums by default

This change makes it so that if UDP CSUM is not specified we will default
to enabling it.  The main motivation behind this is the fact that with the
use of outer checksum we can greatly improve the performance for GENEVE
tunnels on hardware that doesn't know how to parse them.
Signed-off-by: default avatarAlexander Duyck <aduyck@mirantis.com>
Acked-by: default avatarTom Herbert <tom@herbertland.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 417b7ca4
...@@ -76,7 +76,7 @@ struct geneve_dev { ...@@ -76,7 +76,7 @@ struct geneve_dev {
}; };
/* Geneve device flags */ /* Geneve device flags */
#define GENEVE_F_UDP_CSUM BIT(0) #define GENEVE_F_UDP_ZERO_CSUM_TX BIT(0)
#define GENEVE_F_UDP_ZERO_CSUM6_TX BIT(1) #define GENEVE_F_UDP_ZERO_CSUM6_TX BIT(1)
#define GENEVE_F_UDP_ZERO_CSUM6_RX BIT(2) #define GENEVE_F_UDP_ZERO_CSUM6_RX BIT(2)
...@@ -703,7 +703,7 @@ static int geneve_build_skb(struct rtable *rt, struct sk_buff *skb, ...@@ -703,7 +703,7 @@ static int geneve_build_skb(struct rtable *rt, struct sk_buff *skb,
struct genevehdr *gnvh; struct genevehdr *gnvh;
int min_headroom; int min_headroom;
int err; int err;
bool udp_sum = !!(flags & GENEVE_F_UDP_CSUM); bool udp_sum = !(flags & GENEVE_F_UDP_ZERO_CSUM_TX);
skb_scrub_packet(skb, xnet); skb_scrub_packet(skb, xnet);
...@@ -944,9 +944,9 @@ static netdev_tx_t geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev, ...@@ -944,9 +944,9 @@ static netdev_tx_t geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev,
opts = ip_tunnel_info_opts(info); opts = ip_tunnel_info_opts(info);
if (key->tun_flags & TUNNEL_CSUM) if (key->tun_flags & TUNNEL_CSUM)
flags |= GENEVE_F_UDP_CSUM; flags &= ~GENEVE_F_UDP_ZERO_CSUM_TX;
else else
flags &= ~GENEVE_F_UDP_CSUM; flags |= GENEVE_F_UDP_ZERO_CSUM_TX;
err = geneve_build_skb(rt, skb, key->tun_flags, vni, err = geneve_build_skb(rt, skb, key->tun_flags, vni,
info->options_len, opts, flags, xnet); info->options_len, opts, flags, xnet);
...@@ -972,7 +972,7 @@ static netdev_tx_t geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev, ...@@ -972,7 +972,7 @@ static netdev_tx_t geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev,
udp_tunnel_xmit_skb(rt, gs4->sock->sk, skb, fl4.saddr, fl4.daddr, udp_tunnel_xmit_skb(rt, gs4->sock->sk, skb, fl4.saddr, fl4.daddr,
tos, ttl, df, sport, geneve->dst_port, tos, ttl, df, sport, geneve->dst_port,
!net_eq(geneve->net, dev_net(geneve->dev)), !net_eq(geneve->net, dev_net(geneve->dev)),
!(flags & GENEVE_F_UDP_CSUM)); !!(flags & GENEVE_F_UDP_ZERO_CSUM_TX));
return NETDEV_TX_OK; return NETDEV_TX_OK;
...@@ -1383,8 +1383,8 @@ static int geneve_newlink(struct net *net, struct net_device *dev, ...@@ -1383,8 +1383,8 @@ static int geneve_newlink(struct net *net, struct net_device *dev,
metadata = true; metadata = true;
if (data[IFLA_GENEVE_UDP_CSUM] && if (data[IFLA_GENEVE_UDP_CSUM] &&
nla_get_u8(data[IFLA_GENEVE_UDP_CSUM])) !nla_get_u8(data[IFLA_GENEVE_UDP_CSUM]))
flags |= GENEVE_F_UDP_CSUM; flags |= GENEVE_F_UDP_ZERO_CSUM_TX;
if (data[IFLA_GENEVE_UDP_ZERO_CSUM6_TX] && if (data[IFLA_GENEVE_UDP_ZERO_CSUM6_TX] &&
nla_get_u8(data[IFLA_GENEVE_UDP_ZERO_CSUM6_TX])) nla_get_u8(data[IFLA_GENEVE_UDP_ZERO_CSUM6_TX]))
...@@ -1454,7 +1454,7 @@ static int geneve_fill_info(struct sk_buff *skb, const struct net_device *dev) ...@@ -1454,7 +1454,7 @@ static int geneve_fill_info(struct sk_buff *skb, const struct net_device *dev)
} }
if (nla_put_u8(skb, IFLA_GENEVE_UDP_CSUM, if (nla_put_u8(skb, IFLA_GENEVE_UDP_CSUM,
!!(geneve->flags & GENEVE_F_UDP_CSUM)) || !(geneve->flags & GENEVE_F_UDP_ZERO_CSUM_TX)) ||
nla_put_u8(skb, IFLA_GENEVE_UDP_ZERO_CSUM6_TX, nla_put_u8(skb, IFLA_GENEVE_UDP_ZERO_CSUM6_TX,
!!(geneve->flags & GENEVE_F_UDP_ZERO_CSUM6_TX)) || !!(geneve->flags & GENEVE_F_UDP_ZERO_CSUM6_TX)) ||
nla_put_u8(skb, IFLA_GENEVE_UDP_ZERO_CSUM6_RX, nla_put_u8(skb, IFLA_GENEVE_UDP_ZERO_CSUM6_RX,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment