[PATCH net-next 2/2] net: sit: Do not set .ndo_get_stats64

Breno Leitao posted 2 patches 1 year, 11 months ago
[PATCH net-next 2/2] net: sit: Do not set .ndo_get_stats64
Posted by Breno Leitao 1 year, 11 months ago
If the driver is using the network core allocation mechanism, by setting
NETDEV_PCPU_STAT_TSTATS, as this driver is, then, it doesn't need to set
the dev_get_tstats64() generic .ndo_get_stats64 function pointer. Since
the network core calls it automatically, and .ndo_get_stats64 should
only be set if the driver needs special treatment.

This simplifies the driver, since all the generic statistics is now
handled by core.

Signed-off-by: Breno Leitao <leitao@debian.org>
---
 net/ipv6/sit.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 5ad01480854d..655c9b1a19b8 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -1398,7 +1398,6 @@ static const struct net_device_ops ipip6_netdev_ops = {
 	.ndo_uninit	= ipip6_tunnel_uninit,
 	.ndo_start_xmit	= sit_tunnel_xmit,
 	.ndo_siocdevprivate = ipip6_tunnel_siocdevprivate,
-	.ndo_get_stats64 = dev_get_tstats64,
 	.ndo_get_iflink = ip_tunnel_get_iflink,
 	.ndo_tunnel_ctl = ipip6_tunnel_ctl,
 };
-- 
2.43.0
Re: [PATCH net-next 2/2] net: sit: Do not set .ndo_get_stats64
Posted by Simon Horman 1 year, 11 months ago
On Wed, Feb 28, 2024 at 03:31:22AM -0800, Breno Leitao wrote:
> If the driver is using the network core allocation mechanism, by setting
> NETDEV_PCPU_STAT_TSTATS, as this driver is, then, it doesn't need to set
> the dev_get_tstats64() generic .ndo_get_stats64 function pointer. Since
> the network core calls it automatically, and .ndo_get_stats64 should
> only be set if the driver needs special treatment.
> 
> This simplifies the driver, since all the generic statistics is now
> handled by core.
> 
> Signed-off-by: Breno Leitao <leitao@debian.org>

Reviewed-by: Simon Horman <horms@kernel.org>