mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
net: Get rid of rtnl_link_stats64 / net_device_stats union
In commitbe1f3c2c02"net: Enable 64-bit net device statistics on 32-bit architectures" I redefined struct net_device_stats so that it could be used in a union with struct rtnl_link_stats64, avoiding the need for explicit copying or conversion between the two. However, this is unsafe because there is no locking required and no lock consistently held around calls to dev_get_stats() and use of the statistics structure it returns. In commit28172739f0"net: fix 64 bit counters on 32 bit arches" Eric Dumazet dealt with that problem by requiring callers of dev_get_stats() to provide storage for the result. This means that the net_device::stats64 field and the padding in struct net_device_stats are now redundant, so remove them. Update the comment on net_device_ops::ndo_get_stats64 to reflect its new usage. Change dev_txq_stats_fold() to use struct rtnl_link_stats64, since that is what all its callers are really using and it is no longer going to be compatible with struct net_device_stats. Eric Dumazet suggested the separate function for the structure conversion. Signed-off-by: Ben Hutchings <[email protected]> Acked-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
cc7b86c1a8
commit
3cfde79c6c
4 changed files with 56 additions and 49 deletions
|
|
@ -805,7 +805,7 @@ static u32 vlan_ethtool_get_flags(struct net_device *dev)
|
|||
|
||||
static struct rtnl_link_stats64 *vlan_dev_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
|
||||
{
|
||||
dev_txq_stats_fold(dev, (struct net_device_stats *)stats);
|
||||
dev_txq_stats_fold(dev, stats);
|
||||
|
||||
if (vlan_dev_info(dev)->vlan_rx_stats) {
|
||||
struct vlan_rx_stats *p, accum = {0};
|
||||
|
|
|
|||
Loading…
Reference in a new issue