diff options
author | Alexey Kodanev <alexey.kodanev@oracle.com> | 2018-04-19 14:42:30 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-04-20 17:20:05 +0200 |
commit | 5edbea6987b305346a6ba9cf854e148b4ae814f0 (patch) | |
tree | a93cc803720429be1ff88eb92b086f9a0b4091dd /drivers/net/geneve.c | |
parent | geneve: remove white-space before '#if IS_ENABLED(CONFIG_IPV6)' (diff) | |
download | linux-5edbea6987b305346a6ba9cf854e148b4ae814f0.tar.xz linux-5edbea6987b305346a6ba9cf854e148b4ae814f0.zip |
geneve: cleanup hard coded value for Ethernet header length
Use ETH_HLEN instead and introduce two new macros: GENEVE_IPV4_HLEN
and GENEVE_IPV6_HLEN that include Ethernet header length, corresponded
IP header length and GENEVE_BASE_HLEN.
Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
-rw-r--r-- | drivers/net/geneve.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c index 45acdc9f986e..b650f845af25 100644 --- a/drivers/net/geneve.c +++ b/drivers/net/geneve.c @@ -36,6 +36,8 @@ MODULE_PARM_DESC(log_ecn_error, "Log packets received with corrupted ECN"); #define GENEVE_VER 0 #define GENEVE_BASE_HLEN (sizeof(struct udphdr) + sizeof(struct genevehdr)) +#define GENEVE_IPV4_HLEN (ETH_HLEN + sizeof(struct iphdr) + GENEVE_BASE_HLEN) +#define GENEVE_IPV6_HLEN (ETH_HLEN + sizeof(struct ipv6hdr) + GENEVE_BASE_HLEN) /* per-network namespace private data for this module */ struct geneve_net { @@ -826,8 +828,8 @@ static int geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev, return PTR_ERR(rt); if (skb_dst(skb)) { - int mtu = dst_mtu(&rt->dst) - sizeof(struct iphdr) - - GENEVE_BASE_HLEN - info->options_len - 14; + int mtu = dst_mtu(&rt->dst) - GENEVE_IPV4_HLEN - + info->options_len; skb_dst_update_pmtu(skb, mtu); } @@ -872,8 +874,7 @@ static int geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev, return PTR_ERR(dst); if (skb_dst(skb)) { - int mtu = dst_mtu(dst) - sizeof(struct ipv6hdr) - - GENEVE_BASE_HLEN - info->options_len - 14; + int mtu = dst_mtu(dst) - GENEVE_IPV6_HLEN - info->options_len; skb_dst_update_pmtu(skb, mtu); } |