Skip to content

Commit 2892956

Browse files
leitaokuba-moo
authored andcommitted
net: amt: Move stats allocation to core
With commit 34d21de ("net: Move {l,t,d}stats allocation to core and convert veth & vrf"), stats allocation could be done on net core instead of this driver. With this new approach, the driver doesn't have to bother with error handling (allocation failure checking, making sure free happens in the right spot, etc). This is core responsibility now. Move amt driver to leverage the core allocation. Signed-off-by: Breno Leitao <[email protected]> Reviewed-by: Taehee Yoo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent ba980f8 commit 2892956

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

drivers/net/amt.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3063,15 +3063,10 @@ static int amt_dev_init(struct net_device *dev)
30633063
int err;
30643064

30653065
amt->dev = dev;
3066-
dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
3067-
if (!dev->tstats)
3068-
return -ENOMEM;
30693066

30703067
err = gro_cells_init(&amt->gro_cells, dev);
3071-
if (err) {
3072-
free_percpu(dev->tstats);
3068+
if (err)
30733069
return err;
3074-
}
30753070

30763071
return 0;
30773072
}
@@ -3081,7 +3076,6 @@ static void amt_dev_uninit(struct net_device *dev)
30813076
struct amt_dev *amt = netdev_priv(dev);
30823077

30833078
gro_cells_destroy(&amt->gro_cells);
3084-
free_percpu(dev->tstats);
30853079
}
30863080

30873081
static const struct net_device_ops amt_netdev_ops = {
@@ -3111,6 +3105,7 @@ static void amt_link_setup(struct net_device *dev)
31113105
dev->hw_features |= NETIF_F_SG | NETIF_F_HW_CSUM;
31123106
dev->hw_features |= NETIF_F_FRAGLIST | NETIF_F_RXCSUM;
31133107
dev->hw_features |= NETIF_F_GSO_SOFTWARE;
3108+
dev->pcpu_stat_type = NETDEV_PCPU_STAT_TSTATS;
31143109
eth_hw_addr_random(dev);
31153110
eth_zero_addr(dev->broadcast);
31163111
ether_setup(dev);

0 commit comments

Comments
 (0)