diff mbox series

[net-next,2/5] net: make ip_tunnel_get_stats64 an alias for dev_get_tstats64

Message ID 944fa7d0-9b0e-5ae2-d4f8-9c609f1a7c20@gmail.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series net: add and use dev_get_tstats64 | expand

Commit Message

Heiner Kallweit Nov. 1, 2020, 12:35 p.m. UTC
ip_tunnel_get_stats64() now is a duplicate of dev_get_tstats64().
Make it an alias so that we don't have to change all users of
ip_tunnel_get_stats64().

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 include/net/ip_tunnels.h  | 4 ++--
 net/ipv4/ip_tunnel_core.c | 9 ---------
 2 files changed, 2 insertions(+), 11 deletions(-)

Comments

Florian Fainelli Nov. 2, 2020, 9:09 p.m. UTC | #1
On 11/1/2020 4:35 AM, Heiner Kallweit wrote:
> ip_tunnel_get_stats64() now is a duplicate of dev_get_tstats64().
> Make it an alias so that we don't have to change all users of
> ip_tunnel_get_stats64().
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>

> ---
>  include/net/ip_tunnels.h  | 4 ++--
>  net/ipv4/ip_tunnel_core.c | 9 ---------
>  2 files changed, 2 insertions(+), 11 deletions(-)
> 
> diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h
> index 02ccd3254..500943ba8 100644
> --- a/include/net/ip_tunnels.h
> +++ b/include/net/ip_tunnels.h
> @@ -274,8 +274,8 @@ int ip_tunnel_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
>  int __ip_tunnel_change_mtu(struct net_device *dev, int new_mtu, bool strict);
>  int ip_tunnel_change_mtu(struct net_device *dev, int new_mtu);
>  
> -void ip_tunnel_get_stats64(struct net_device *dev,
> -			   struct rtnl_link_stats64 *tot);
> +#define ip_tunnel_get_stats64 dev_get_tstats64

A static inline might have worked too, up to you, really.
Jakub Kicinski Nov. 2, 2020, 9:37 p.m. UTC | #2
On Sun, 1 Nov 2020 13:35:14 +0100 Heiner Kallweit wrote:
> ip_tunnel_get_stats64() now is a duplicate of dev_get_tstats64().
> Make it an alias so that we don't have to change all users of
> ip_tunnel_get_stats64().

Why would we not change all the users?  It's just an ndo pointer.
Saeed Mahameed Nov. 2, 2020, 9:56 p.m. UTC | #3
On Mon, 2020-11-02 at 13:37 -0800, Jakub Kicinski wrote:
> On Sun, 1 Nov 2020 13:35:14 +0100 Heiner Kallweit wrote:
> > ip_tunnel_get_stats64() now is a duplicate of dev_get_tstats64().
> > Make it an alias so that we don't have to change all users of
> > ip_tunnel_get_stats64().
> 
> Why would we not change all the users?  It's just an ndo pointer.

+1.
diff mbox series

Patch

diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h
index 02ccd3254..500943ba8 100644
--- a/include/net/ip_tunnels.h
+++ b/include/net/ip_tunnels.h
@@ -274,8 +274,8 @@  int ip_tunnel_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
 int __ip_tunnel_change_mtu(struct net_device *dev, int new_mtu, bool strict);
 int ip_tunnel_change_mtu(struct net_device *dev, int new_mtu);
 
-void ip_tunnel_get_stats64(struct net_device *dev,
-			   struct rtnl_link_stats64 *tot);
+#define ip_tunnel_get_stats64 dev_get_tstats64
+
 struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn,
 				   int link, __be16 flags,
 				   __be32 remote, __be32 local,
diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c
index 25f1caf5a..923a9fa2e 100644
--- a/net/ipv4/ip_tunnel_core.c
+++ b/net/ipv4/ip_tunnel_core.c
@@ -429,15 +429,6 @@  int skb_tunnel_check_pmtu(struct sk_buff *skb, struct dst_entry *encap_dst,
 }
 EXPORT_SYMBOL(skb_tunnel_check_pmtu);
 
-/* Often modified stats are per cpu, other are shared (netdev->stats) */
-void ip_tunnel_get_stats64(struct net_device *dev,
-			   struct rtnl_link_stats64 *tot)
-{
-	netdev_stats_to_stats64(tot, &dev->stats);
-	dev_fetch_sw_netstats(tot, dev->tstats);
-}
-EXPORT_SYMBOL_GPL(ip_tunnel_get_stats64);
-
 static const struct nla_policy ip_tun_policy[LWTUNNEL_IP_MAX + 1] = {
 	[LWTUNNEL_IP_UNSPEC]	= { .strict_start_type = LWTUNNEL_IP_OPTS },
 	[LWTUNNEL_IP_ID]	= { .type = NLA_U64 },