* [net-next 0/3] ip_gre: a bunch of fixes for mtu
@ 2017-10-09 20:47 William Tu
2017-10-09 20:47 ` [net-next 1/3] ip_gre: fix mtu and headroom size William Tu
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: William Tu @ 2017-10-09 20:47 UTC (permalink / raw)
To: netdev
The first two patches are to fix some issues for mtu and needed_headroom length
calculation from the gre and erspan tunnel header. The last path tries to avoid
arithmetic operation for every packet when checking for erspan truncate.
William Tu (3):
ip_gre: fix mtu and headroom size
ip_gre: fix erspan tunnel mtu calculation
ip_gre: cache the device mtu hard_header_len calc
include/net/erspan.h | 1 +
include/net/ip_tunnels.h | 1 +
net/ipv4/ip_gre.c | 23 +++++++++++------------
net/ipv4/ip_tunnel.c | 3 +++
4 files changed, 16 insertions(+), 12 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 8+ messages in thread
* [net-next 1/3] ip_gre: fix mtu and headroom size
2017-10-09 20:47 [net-next 0/3] ip_gre: a bunch of fixes for mtu William Tu
@ 2017-10-09 20:47 ` William Tu
2017-10-09 20:47 ` [net-next 2/3] ip_gre: fix erspan tunnel mtu calculation William Tu
2017-10-09 20:47 ` [net-next 3/3] ip_gre: cache the device mtu hard_header_len calc William Tu
2 siblings, 0 replies; 8+ messages in thread
From: William Tu @ 2017-10-09 20:47 UTC (permalink / raw)
To: netdev; +Cc: Tom Herbert
The ip_gre_calc_hlen() already counts gre's base header len (4-byte)
plus optional header's len, so tunnel->hlen has the entire gre
headeri + options len. Thus, remove the -4 and +4 when calculating
the needed_headroom and mtu.
Fixes: 4565e9919cda ("gre: Setup and TX path for gre/UDP foo-over-udp encapsulation")
Signed-off-by: William Tu <u9012063@gmail.com>
Cc: Tom Herbert <tom@quantonium.net>
---
net/ipv4/ip_gre.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index c105a315b1a3..286065c35959 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -947,8 +947,8 @@ static void __gre_tunnel_init(struct net_device *dev)
t_hlen = tunnel->hlen + sizeof(struct iphdr);
- dev->needed_headroom = LL_MAX_HEADER + t_hlen + 4;
- dev->mtu = ETH_DATA_LEN - t_hlen - 4;
+ dev->needed_headroom = LL_MAX_HEADER + t_hlen;
+ dev->mtu = ETH_DATA_LEN - t_hlen;
dev->features |= GRE_FEATURES;
dev->hw_features |= GRE_FEATURES;
--
2.7.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [net-next 2/3] ip_gre: fix erspan tunnel mtu calculation
2017-10-09 20:47 [net-next 0/3] ip_gre: a bunch of fixes for mtu William Tu
2017-10-09 20:47 ` [net-next 1/3] ip_gre: fix mtu and headroom size William Tu
@ 2017-10-09 20:47 ` William Tu
2017-10-10 5:27 ` Xin Long
2017-10-09 20:47 ` [net-next 3/3] ip_gre: cache the device mtu hard_header_len calc William Tu
2 siblings, 1 reply; 8+ messages in thread
From: William Tu @ 2017-10-09 20:47 UTC (permalink / raw)
To: netdev; +Cc: Xin Long
Remove the unnecessary -4 and +4 bytes at mtu and headroom calculation.
In addition, erspan uses fixed 8-byte gre header, so add ERSPAN_GREHDR_LEN
macro for better readability.
Now tunnel->hlen = grehdr(8) + erspanhdr(8) = 16 byte.
The mtu should be ETH_DATA_LEN - 16 - iph(20) = 1464.
After the ip_tunnel_bind_dev(), the mtu is adjusted to
1464 - 14 (dev->hard_header_len) = 1450.
The maximum skb->len the erspan tunnel can carry without
being truncated is 1450 + 14 = 1464 byte.
Signed-off-by: William Tu <u9012063@gmail.com>
Cc: Xin Long <lucien.xin@gmail.com>
---
include/net/erspan.h | 1 +
net/ipv4/ip_gre.c | 11 +++++------
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/include/net/erspan.h b/include/net/erspan.h
index ca94fc86865e..e28294e248d0 100644
--- a/include/net/erspan.h
+++ b/include/net/erspan.h
@@ -28,6 +28,7 @@
*/
#define ERSPAN_VERSION 0x1
+#define ERSPAN_GREHDR_LEN 8 /* ERSPAN has fixed 8-byte GRE header */
#define VER_MASK 0xf000
#define VLAN_MASK 0x0fff
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 286065c35959..6e6e4c4811cc 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -569,8 +569,7 @@ static void erspan_fb_xmit(struct sk_buff *skb, struct net_device *dev,
key = &tun_info->key;
- /* ERSPAN has fixed 8 byte GRE header */
- tunnel_hlen = 8 + sizeof(struct erspanhdr);
+ tunnel_hlen = ERSPAN_GREHDR_LEN + sizeof(struct erspanhdr);
rt = prepare_fb_xmit(skb, dev, &fl, tunnel_hlen);
if (!rt)
@@ -591,7 +590,7 @@ static void erspan_fb_xmit(struct sk_buff *skb, struct net_device *dev,
erspan_build_header(skb, tunnel_id_to_key32(key->tun_id),
ntohl(md->index), truncate);
- gre_build_header(skb, 8, TUNNEL_SEQ,
+ gre_build_header(skb, ERSPAN_GREHDR_LEN, TUNNEL_SEQ,
htons(ETH_P_ERSPAN), 0, htonl(tunnel->o_seqno++));
df = key->tun_flags & TUNNEL_DONT_FRAGMENT ? htons(IP_DF) : 0;
@@ -1242,14 +1241,14 @@ static int erspan_tunnel_init(struct net_device *dev)
struct ip_tunnel *tunnel = netdev_priv(dev);
int t_hlen;
- tunnel->tun_hlen = 8;
+ tunnel->tun_hlen = ERSPAN_GREHDR_LEN;
tunnel->parms.iph.protocol = IPPROTO_GRE;
tunnel->hlen = tunnel->tun_hlen + tunnel->encap_hlen +
sizeof(struct erspanhdr);
t_hlen = tunnel->hlen + sizeof(struct iphdr);
- dev->needed_headroom = LL_MAX_HEADER + t_hlen + 4;
- dev->mtu = ETH_DATA_LEN - t_hlen - 4;
+ dev->needed_headroom = LL_MAX_HEADER + t_hlen;
+ dev->mtu = ETH_DATA_LEN - t_hlen;
dev->features |= GRE_FEATURES;
dev->hw_features |= GRE_FEATURES;
dev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
--
2.7.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [net-next 3/3] ip_gre: cache the device mtu hard_header_len calc
2017-10-09 20:47 [net-next 0/3] ip_gre: a bunch of fixes for mtu William Tu
2017-10-09 20:47 ` [net-next 1/3] ip_gre: fix mtu and headroom size William Tu
2017-10-09 20:47 ` [net-next 2/3] ip_gre: fix erspan tunnel mtu calculation William Tu
@ 2017-10-09 20:47 ` William Tu
2017-10-11 9:54 ` Xin Long
2 siblings, 1 reply; 8+ messages in thread
From: William Tu @ 2017-10-09 20:47 UTC (permalink / raw)
To: netdev; +Cc: David Laight
The patch introduces ip_tunnel->ether_mtu fields to cache the value of
dev->mtu + dev->hard_header_len. This avoids the arithmetic operation
on every packet.
Signed-off-by: William Tu <u9012063@gmail.com>
Cc: David Laight <David.Laight@aculab.com>
---
include/net/ip_tunnels.h | 1 +
net/ipv4/ip_gre.c | 8 ++++----
net/ipv4/ip_tunnel.c | 3 +++
3 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h
index b41a1e057fce..19565be26e13 100644
--- a/include/net/ip_tunnels.h
+++ b/include/net/ip_tunnels.h
@@ -117,6 +117,7 @@ struct ip_tunnel {
/* This field used only by ERSPAN */
u32 index; /* ERSPAN type II index */
+ unsigned int ether_mtu; /* The mtu including the ether hdr */
struct dst_cache dst_cache;
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 6e6e4c4811cc..994b8ddea0b1 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -578,8 +578,8 @@ static void erspan_fb_xmit(struct sk_buff *skb, struct net_device *dev,
if (gre_handle_offloads(skb, false))
goto err_free_rt;
- if (skb->len > dev->mtu + dev->hard_header_len) {
- pskb_trim(skb, dev->mtu + dev->hard_header_len);
+ if (skb->len > tunnel->ether_mtu) {
+ pskb_trim(skb, tunnel->ether_mtu);
truncate = true;
}
@@ -730,8 +730,8 @@ static netdev_tx_t erspan_xmit(struct sk_buff *skb,
if (skb_cow_head(skb, dev->needed_headroom))
goto free_skb;
- if (skb->len > dev->mtu + dev->hard_header_len) {
- pskb_trim(skb, dev->mtu + dev->hard_header_len);
+ if (skb->len > tunnel->ether_mtu) {
+ pskb_trim(skb, tunnel->ether_mtu);
truncate = true;
}
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
index fe6fee728ce4..859af5b86802 100644
--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -348,6 +348,7 @@ static int ip_tunnel_bind_dev(struct net_device *dev)
dev->needed_headroom = t_hlen + hlen;
mtu -= (dev->hard_header_len + t_hlen);
+ tunnel->ether_mtu = mtu + dev->hard_header_len;
if (mtu < 68)
mtu = 68;
@@ -952,6 +953,7 @@ int __ip_tunnel_change_mtu(struct net_device *dev, int new_mtu, bool strict)
}
dev->mtu = new_mtu;
+ tunnel->ether_mtu = new_mtu + dev->hard_header_len;
return 0;
}
EXPORT_SYMBOL_GPL(__ip_tunnel_change_mtu);
@@ -1183,6 +1185,7 @@ int ip_tunnel_init(struct net_device *dev)
tunnel->dev = dev;
tunnel->net = dev_net(dev);
+ tunnel->ether_mtu = dev->mtu + dev->hard_header_len;
strcpy(tunnel->parms.name, dev->name);
iph->version = 4;
iph->ihl = 5;
--
2.7.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [net-next 2/3] ip_gre: fix erspan tunnel mtu calculation
2017-10-09 20:47 ` [net-next 2/3] ip_gre: fix erspan tunnel mtu calculation William Tu
@ 2017-10-10 5:27 ` Xin Long
2017-10-10 12:59 ` William Tu
0 siblings, 1 reply; 8+ messages in thread
From: Xin Long @ 2017-10-10 5:27 UTC (permalink / raw)
To: William Tu; +Cc: network dev, therbert, davem
On Tue, Oct 10, 2017 at 4:47 AM, William Tu <u9012063@gmail.com> wrote:
> Remove the unnecessary -4 and +4 bytes at mtu and headroom calculation.
> In addition, erspan uses fixed 8-byte gre header, so add ERSPAN_GREHDR_LEN
> macro for better readability.
>
> Now tunnel->hlen = grehdr(8) + erspanhdr(8) = 16 byte.
> The mtu should be ETH_DATA_LEN - 16 - iph(20) = 1464.
> After the ip_tunnel_bind_dev(), the mtu is adjusted to
> 1464 - 14 (dev->hard_header_len) = 1450.
> The maximum skb->len the erspan tunnel can carry without
> being truncated is 1450 + 14 = 1464 byte.
>
> Signed-off-by: William Tu <u9012063@gmail.com>
> Cc: Xin Long <lucien.xin@gmail.com>
> ---
> include/net/erspan.h | 1 +
> net/ipv4/ip_gre.c | 11 +++++------
> 2 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/include/net/erspan.h b/include/net/erspan.h
> index ca94fc86865e..e28294e248d0 100644
> --- a/include/net/erspan.h
> +++ b/include/net/erspan.h
> @@ -28,6 +28,7 @@
> */
>
> #define ERSPAN_VERSION 0x1
> +#define ERSPAN_GREHDR_LEN 8 /* ERSPAN has fixed 8-byte GRE header */
>
> #define VER_MASK 0xf000
> #define VLAN_MASK 0x0fff
> diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
> index 286065c35959..6e6e4c4811cc 100644
> --- a/net/ipv4/ip_gre.c
> +++ b/net/ipv4/ip_gre.c
> @@ -569,8 +569,7 @@ static void erspan_fb_xmit(struct sk_buff *skb, struct net_device *dev,
>
> key = &tun_info->key;
>
> - /* ERSPAN has fixed 8 byte GRE header */
> - tunnel_hlen = 8 + sizeof(struct erspanhdr);
> + tunnel_hlen = ERSPAN_GREHDR_LEN + sizeof(struct erspanhdr);
>
> rt = prepare_fb_xmit(skb, dev, &fl, tunnel_hlen);
> if (!rt)
> @@ -591,7 +590,7 @@ static void erspan_fb_xmit(struct sk_buff *skb, struct net_device *dev,
> erspan_build_header(skb, tunnel_id_to_key32(key->tun_id),
> ntohl(md->index), truncate);
>
> - gre_build_header(skb, 8, TUNNEL_SEQ,
> + gre_build_header(skb, ERSPAN_GREHDR_LEN, TUNNEL_SEQ,
> htons(ETH_P_ERSPAN), 0, htonl(tunnel->o_seqno++));
>
> df = key->tun_flags & TUNNEL_DONT_FRAGMENT ? htons(IP_DF) : 0;
> @@ -1242,14 +1241,14 @@ static int erspan_tunnel_init(struct net_device *dev)
> struct ip_tunnel *tunnel = netdev_priv(dev);
> int t_hlen;
>
> - tunnel->tun_hlen = 8;
> + tunnel->tun_hlen = ERSPAN_GREHDR_LEN;
> tunnel->parms.iph.protocol = IPPROTO_GRE;
> tunnel->hlen = tunnel->tun_hlen + tunnel->encap_hlen +
> sizeof(struct erspanhdr);
> t_hlen = tunnel->hlen + sizeof(struct iphdr);
>
> - dev->needed_headroom = LL_MAX_HEADER + t_hlen + 4;
> - dev->mtu = ETH_DATA_LEN - t_hlen - 4;
> + dev->needed_headroom = LL_MAX_HEADER + t_hlen;
> + dev->mtu = ETH_DATA_LEN - t_hlen;
1. I guess '+4-4' stuff was copied from __gre_tunnel_init(), I'm thinking
it may be there for some reason.
2. 'dev->needed_headroom =' and 'dev->mtu =' are really needed ?
As I've seen both will be updated in .newlink:
ipgre_newlink() -> ip_tunnel_newlink() -> ip_tunnel_bind_dev()
> dev->features |= GRE_FEATURES;
> dev->hw_features |= GRE_FEATURES;
> dev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [net-next 2/3] ip_gre: fix erspan tunnel mtu calculation
2017-10-10 5:27 ` Xin Long
@ 2017-10-10 12:59 ` William Tu
2017-10-11 10:46 ` Xin Long
0 siblings, 1 reply; 8+ messages in thread
From: William Tu @ 2017-10-10 12:59 UTC (permalink / raw)
To: Xin Long; +Cc: therbert, davem, Linux Kernel Network Developers
>> @@ -1242,14 +1241,14 @@ static int erspan_tunnel_init(struct net_device *dev)
>> struct ip_tunnel *tunnel = netdev_priv(dev);
>> int t_hlen;
>>
>> - tunnel->tun_hlen = 8;
>> + tunnel->tun_hlen = ERSPAN_GREHDR_LEN;
>> tunnel->parms.iph.protocol = IPPROTO_GRE;
>> tunnel->hlen = tunnel->tun_hlen + tunnel->encap_hlen +
>> sizeof(struct erspanhdr);
>> t_hlen = tunnel->hlen + sizeof(struct iphdr);
>>
>> - dev->needed_headroom = LL_MAX_HEADER + t_hlen + 4;
>> - dev->mtu = ETH_DATA_LEN - t_hlen - 4;
>> + dev->needed_headroom = LL_MAX_HEADER + t_hlen;
>> + dev->mtu = ETH_DATA_LEN - t_hlen;
> 1. I guess '+4-4' stuff was copied from __gre_tunnel_init(), I'm thinking
> it may be there for some reason.
>
I traced back to
4565e9919cda ("gre: Setup and TX path for gre/UDP foo-over-udp encapsulation")
and I think '+4-4' is there for GRE base header length.
Since now we do
dev->mtu = ETH_DATA_LEN - t_hlen;
and t_hlen already counts the the gre base header + optional header
len, I think it's not needed.
> 2. 'dev->needed_headroom =' and 'dev->mtu =' are really needed ?
> As I've seen both will be updated in .newlink:
> ipgre_newlink() -> ip_tunnel_newlink() -> ip_tunnel_bind_dev()
>
right, I also find both values gets overwritten by
ip_tunnel_bind_dev() using my test cases. Maybe we can remove them?
Thanks
William
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [net-next 3/3] ip_gre: cache the device mtu hard_header_len calc
2017-10-09 20:47 ` [net-next 3/3] ip_gre: cache the device mtu hard_header_len calc William Tu
@ 2017-10-11 9:54 ` Xin Long
0 siblings, 0 replies; 8+ messages in thread
From: Xin Long @ 2017-10-11 9:54 UTC (permalink / raw)
To: William Tu; +Cc: network dev, David Laight, davem
On Tue, Oct 10, 2017 at 4:47 AM, William Tu <u9012063@gmail.com> wrote:
> The patch introduces ip_tunnel->ether_mtu fields to cache the value of
> dev->mtu + dev->hard_header_len. This avoids the arithmetic operation
> on every packet.
>
> Signed-off-by: William Tu <u9012063@gmail.com>
> Cc: David Laight <David.Laight@aculab.com>
> ---
> include/net/ip_tunnels.h | 1 +
> net/ipv4/ip_gre.c | 8 ++++----
> net/ipv4/ip_tunnel.c | 3 +++
> 3 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h
> index b41a1e057fce..19565be26e13 100644
> --- a/include/net/ip_tunnels.h
> +++ b/include/net/ip_tunnels.h
> @@ -117,6 +117,7 @@ struct ip_tunnel {
>
> /* This field used only by ERSPAN */
> u32 index; /* ERSPAN type II index */
> + unsigned int ether_mtu; /* The mtu including the ether hdr */
>
> struct dst_cache dst_cache;
ip_tunnel is a very common structure for various tunnels.
Adding ether_mtu into it to avoid ONLY an addition operation ONLY for
erspan, I think it's not worth it.
>
> diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
> index 6e6e4c4811cc..994b8ddea0b1 100644
> --- a/net/ipv4/ip_gre.c
> +++ b/net/ipv4/ip_gre.c
> @@ -578,8 +578,8 @@ static void erspan_fb_xmit(struct sk_buff *skb, struct net_device *dev,
> if (gre_handle_offloads(skb, false))
> goto err_free_rt;
>
> - if (skb->len > dev->mtu + dev->hard_header_len) {
> - pskb_trim(skb, dev->mtu + dev->hard_header_len);
> + if (skb->len > tunnel->ether_mtu) {
> + pskb_trim(skb, tunnel->ether_mtu);
> truncate = true;
> }
>
> @@ -730,8 +730,8 @@ static netdev_tx_t erspan_xmit(struct sk_buff *skb,
> if (skb_cow_head(skb, dev->needed_headroom))
> goto free_skb;
>
> - if (skb->len > dev->mtu + dev->hard_header_len) {
> - pskb_trim(skb, dev->mtu + dev->hard_header_len);
> + if (skb->len > tunnel->ether_mtu) {
> + pskb_trim(skb, tunnel->ether_mtu);
> truncate = true;
> }
>
> diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
> index fe6fee728ce4..859af5b86802 100644
> --- a/net/ipv4/ip_tunnel.c
> +++ b/net/ipv4/ip_tunnel.c
> @@ -348,6 +348,7 @@ static int ip_tunnel_bind_dev(struct net_device *dev)
>
> dev->needed_headroom = t_hlen + hlen;
> mtu -= (dev->hard_header_len + t_hlen);
> + tunnel->ether_mtu = mtu + dev->hard_header_len;
>
> if (mtu < 68)
> mtu = 68;
> @@ -952,6 +953,7 @@ int __ip_tunnel_change_mtu(struct net_device *dev, int new_mtu, bool strict)
> }
>
> dev->mtu = new_mtu;
> + tunnel->ether_mtu = new_mtu + dev->hard_header_len;
> return 0;
> }
> EXPORT_SYMBOL_GPL(__ip_tunnel_change_mtu);
> @@ -1183,6 +1185,7 @@ int ip_tunnel_init(struct net_device *dev)
>
> tunnel->dev = dev;
> tunnel->net = dev_net(dev);
> + tunnel->ether_mtu = dev->mtu + dev->hard_header_len;
> strcpy(tunnel->parms.name, dev->name);
> iph->version = 4;
> iph->ihl = 5;
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [net-next 2/3] ip_gre: fix erspan tunnel mtu calculation
2017-10-10 12:59 ` William Tu
@ 2017-10-11 10:46 ` Xin Long
0 siblings, 0 replies; 8+ messages in thread
From: Xin Long @ 2017-10-11 10:46 UTC (permalink / raw)
To: William Tu; +Cc: davem, Linux Kernel Network Developers
On Tue, Oct 10, 2017 at 8:59 PM, William Tu <u9012063@gmail.com> wrote:
>>> @@ -1242,14 +1241,14 @@ static int erspan_tunnel_init(struct net_device *dev)
>>> struct ip_tunnel *tunnel = netdev_priv(dev);
>>> int t_hlen;
>>>
>>> - tunnel->tun_hlen = 8;
>>> + tunnel->tun_hlen = ERSPAN_GREHDR_LEN;
>>> tunnel->parms.iph.protocol = IPPROTO_GRE;
>>> tunnel->hlen = tunnel->tun_hlen + tunnel->encap_hlen +
>>> sizeof(struct erspanhdr);
>>> t_hlen = tunnel->hlen + sizeof(struct iphdr);
>>>
>>> - dev->needed_headroom = LL_MAX_HEADER + t_hlen + 4;
>>> - dev->mtu = ETH_DATA_LEN - t_hlen - 4;
>>> + dev->needed_headroom = LL_MAX_HEADER + t_hlen;
>>> + dev->mtu = ETH_DATA_LEN - t_hlen;
>> 1. I guess '+4-4' stuff was copied from __gre_tunnel_init(), I'm thinking
>> it may be there for some reason.
>>
> I traced back to
> 4565e9919cda ("gre: Setup and TX path for gre/UDP foo-over-udp encapsulation")
> and I think '+4-4' is there for GRE base header length.
>
> Since now we do
> dev->mtu = ETH_DATA_LEN - t_hlen;
> and t_hlen already counts the the gre base header + optional header
> len, I think it's not needed.
okay. thanks.
>
>> 2. 'dev->needed_headroom =' and 'dev->mtu =' are really needed ?
>> As I've seen both will be updated in .newlink:
>> ipgre_newlink() -> ip_tunnel_newlink() -> ip_tunnel_bind_dev()
>>
> right, I also find both values gets overwritten by
> ip_tunnel_bind_dev() using my test cases. Maybe we can remove them?
It's there just in case that there is no lower dev found, but
ip_tunnel_newlink/create always updates dev->mtu even if
there is no lower dev found.
let's leave as it is for now, ipgre may just not be sure ip_tunnel_xxx would
do it when no lower dev found.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2017-10-11 10:46 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-09 20:47 [net-next 0/3] ip_gre: a bunch of fixes for mtu William Tu
2017-10-09 20:47 ` [net-next 1/3] ip_gre: fix mtu and headroom size William Tu
2017-10-09 20:47 ` [net-next 2/3] ip_gre: fix erspan tunnel mtu calculation William Tu
2017-10-10 5:27 ` Xin Long
2017-10-10 12:59 ` William Tu
2017-10-11 10:46 ` Xin Long
2017-10-09 20:47 ` [net-next 3/3] ip_gre: cache the device mtu hard_header_len calc William Tu
2017-10-11 9:54 ` Xin Long
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.