Skip to content

Commit e28c5ef

Browse files
leitaokuba-moo
authored andcommitted
vxlan: Do not alloc tstats manually
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 in 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. Remove the allocation in the vxlan driver and leverage the network core allocation instead. Signed-off-by: Breno Leitao <[email protected]> Reviewed-by: Subbaraya Sundeep <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent eaf657f commit e28c5ef

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

drivers/net/vxlan/vxlan_core.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2841,15 +2841,9 @@ static int vxlan_init(struct net_device *dev)
28412841
if (vxlan->cfg.flags & VXLAN_F_VNIFILTER)
28422842
vxlan_vnigroup_init(vxlan);
28432843

2844-
dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
2845-
if (!dev->tstats) {
2846-
err = -ENOMEM;
2847-
goto err_vnigroup_uninit;
2848-
}
2849-
28502844
err = gro_cells_init(&vxlan->gro_cells, dev);
28512845
if (err)
2852-
goto err_free_percpu;
2846+
goto err_vnigroup_uninit;
28532847

28542848
err = vxlan_mdb_init(vxlan);
28552849
if (err)
@@ -2860,8 +2854,6 @@ static int vxlan_init(struct net_device *dev)
28602854

28612855
err_gro_cells_destroy:
28622856
gro_cells_destroy(&vxlan->gro_cells);
2863-
err_free_percpu:
2864-
free_percpu(dev->tstats);
28652857
err_vnigroup_uninit:
28662858
if (vxlan->cfg.flags & VXLAN_F_VNIFILTER)
28672859
vxlan_vnigroup_uninit(vxlan);
@@ -2892,8 +2884,6 @@ static void vxlan_uninit(struct net_device *dev)
28922884
gro_cells_destroy(&vxlan->gro_cells);
28932885

28942886
vxlan_fdb_delete_default(vxlan, vxlan->cfg.vni);
2895-
2896-
free_percpu(dev->tstats);
28972887
}
28982888

28992889
/* Start ageing timer and join group when device is brought up */
@@ -3316,6 +3306,7 @@ static void vxlan_setup(struct net_device *dev)
33163306
dev->min_mtu = ETH_MIN_MTU;
33173307
dev->max_mtu = ETH_MAX_MTU;
33183308

3309+
dev->pcpu_stat_type = NETDEV_PCPU_STAT_TSTATS;
33193310
INIT_LIST_HEAD(&vxlan->next);
33203311

33213312
timer_setup(&vxlan->age_timer, vxlan_cleanup, TIMER_DEFERRABLE);

0 commit comments

Comments
 (0)