Skip to content

Commit 489645d

Browse files
author
Paolo Abeni
committed
Merge branch 'net-collect-tstats-automatically'
Breno Leitao says: ==================== net: collect tstats automatically The commit 34d21de ("net: Move {l,t,d}stats allocation to core and convert veth & vrf") added a field in struct_netdevice, which tells what type of statistics the driver supports. That field is used primarily to allocate stats structures automatically, but, it also could leveraged to simplify the drivers even further, such as, if the driver relies in the default stats collection, then it doesn't need to assign to .ndo_get_stats64. That means that drivers only assign functions to .ndo_get_stats64 if they are using something special. I started to move some of these drivers[1][2][3] to use the core allocation, and with this change in, I just need to touch the driver once, and be able to simplify the whole stats allocation and collection for generic case. There are 44 devices today that could benefit from this simplification. # grep -r .ndo_get_stats64 | grep dev_get_tstats64 | wc -l 44 As of today, netnext only has the `sit` driver fully ported to core stats allocation, hence the second patch. Links: [1] https://lore.kernel.org/all/[email protected]/ [2] https://lore.kernel.org/all/[email protected]/ [3] https://lore.kernel.org/all/[email protected]/ ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
2 parents 39de857 + fa0cd90 commit 489645d

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

net/core/dev.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10702,6 +10702,8 @@ struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev,
1070210702
ops->ndo_get_stats64(dev, storage);
1070310703
} else if (ops->ndo_get_stats) {
1070410704
netdev_stats_to_stats64(storage, ops->ndo_get_stats(dev));
10705+
} else if (dev->pcpu_stat_type == NETDEV_PCPU_STAT_TSTATS) {
10706+
dev_get_tstats64(dev, storage);
1070510707
} else {
1070610708
netdev_stats_to_stats64(storage, &dev->stats);
1070710709
}

net/ipv6/sit.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1398,7 +1398,6 @@ static const struct net_device_ops ipip6_netdev_ops = {
13981398
.ndo_uninit = ipip6_tunnel_uninit,
13991399
.ndo_start_xmit = sit_tunnel_xmit,
14001400
.ndo_siocdevprivate = ipip6_tunnel_siocdevprivate,
1401-
.ndo_get_stats64 = dev_get_tstats64,
14021401
.ndo_get_iflink = ip_tunnel_get_iflink,
14031402
.ndo_tunnel_ctl = ipip6_tunnel_ctl,
14041403
};

0 commit comments

Comments
 (0)