diff mbox

[net,1/2] iptunnel: make rx/tx bytes counters consistent

Message ID 1442569661-5528-1-git-send-email-nicolas.dichtel@6wind.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Nicolas Dichtel Sept. 18, 2015, 9:47 a.m. UTC
This was already done a long time ago in
commit 64194c31a0b6 ("inet: Make tunnel RX/TX byte counters more consistent")
but tx path was broken (at least since 3.10).

Before the patch the gre header was included on tx.

After the patch:
$ ping -c1 192.168.0.121 ; ip -s l ls dev gre1
PING 192.168.0.121 (192.168.0.121) 56(84) bytes of data.
64 bytes from 192.168.0.121: icmp_req=1 ttl=64 time=2.95 ms

--- 192.168.0.121 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 2.955/2.955/2.955/0.000 ms
7: gre1@NONE: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1468 qdisc noqueue state UNKNOWN mode DEFAULT group default
    link/gre 10.16.0.249 peer 10.16.0.121
    RX: bytes  packets  errors  dropped overrun mcast
    84         1        0       0       0       0
    TX: bytes  packets  errors  dropped carrier collsns
    84         1        0       0       0       0

Reported-by: Julien Meunier <julien.meunier@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
 net/ipv4/ip_tunnel_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Miller Sept. 21, 2015, 5:35 a.m. UTC | #1
From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Date: Fri, 18 Sep 2015 11:47:40 +0200

> This was already done a long time ago in
> commit 64194c31a0b6 ("inet: Make tunnel RX/TX byte counters more consistent")
> but tx path was broken (at least since 3.10).
> 
> Before the patch the gre header was included on tx.
> 
> After the patch:
> $ ping -c1 192.168.0.121 ; ip -s l ls dev gre1
> PING 192.168.0.121 (192.168.0.121) 56(84) bytes of data.
> 64 bytes from 192.168.0.121: icmp_req=1 ttl=64 time=2.95 ms
> 
> --- 192.168.0.121 ping statistics ---
> 1 packets transmitted, 1 received, 0% packet loss, time 0ms
> rtt min/avg/max/mdev = 2.955/2.955/2.955/0.000 ms
> 7: gre1@NONE: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1468 qdisc noqueue state UNKNOWN mode DEFAULT group default
>     link/gre 10.16.0.249 peer 10.16.0.121
>     RX: bytes  packets  errors  dropped overrun mcast
>     84         1        0       0       0       0
>     TX: bytes  packets  errors  dropped carrier collsns
>     84         1        0       0       0       0
> 
> Reported-by: Julien Meunier <julien.meunier@6wind.com>
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Sept. 21, 2015, 5:37 a.m. UTC | #2
From: David Miller <davem@davemloft.net>
Date: Sun, 20 Sep 2015 22:35:13 -0700 (PDT)

>> After the patch:
>> $ ping -c1 192.168.0.121 ; ip -s l ls dev gre1
>> PING 192.168.0.121 (192.168.0.121) 56(84) bytes of data.
>> 64 bytes from 192.168.0.121: icmp_req=1 ttl=64 time=2.95 ms
>> 
>> --- 192.168.0.121 ping statistics ---
>> 1 packets transmitted, 1 received, 0% packet loss, time 0ms
>> rtt min/avg/max/mdev = 2.955/2.955/2.955/0.000 ms

BTW, when you includ PING output in a commit message like this
it really makes things difficult.

"---" denotes end of the commit as far as tools like "git am"
are concerned.

I happened to notice this time and fix up the commit messages by hand,
but it'd be much better if it weren't left up to chance like that.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Nicolas Dichtel Sept. 21, 2015, 7:39 a.m. UTC | #3
Le 21/09/2015 07:37, David Miller a écrit :
> From: David Miller <davem@davemloft.net>
> Date: Sun, 20 Sep 2015 22:35:13 -0700 (PDT)
>
>>> After the patch:
>>> $ ping -c1 192.168.0.121 ; ip -s l ls dev gre1
>>> PING 192.168.0.121 (192.168.0.121) 56(84) bytes of data.
>>> 64 bytes from 192.168.0.121: icmp_req=1 ttl=64 time=2.95 ms
>>>
>>> --- 192.168.0.121 ping statistics ---
>>> 1 packets transmitted, 1 received, 0% packet loss, time 0ms
>>> rtt min/avg/max/mdev = 2.955/2.955/2.955/0.000 ms
>
> BTW, when you includ PING output in a commit message like this
> it really makes things difficult.
>
> "---" denotes end of the commit as far as tools like "git am"
> are concerned.
>
> I happened to notice this time and fix up the commit messages by hand,
> but it'd be much better if it weren't left up to chance like that.
Oh ok. I will take care of that next time.

Thank you for fixing it.


Regards,
Nicolas
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c
index 29ed6c5a5185..9b97204b8c81 100644
--- a/net/ipv4/ip_tunnel_core.c
+++ b/net/ipv4/ip_tunnel_core.c
@@ -51,7 +51,7 @@  int iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb,
 		  __be32 src, __be32 dst, __u8 proto,
 		  __u8 tos, __u8 ttl, __be16 df, bool xnet)
 {
-	int pkt_len = skb->len;
+	int pkt_len = skb->len - skb_inner_network_offset(skb);
 	struct iphdr *iph;
 	int err;