vxlan: Do not alloc tstats manually
[linux-block.git] / drivers / net / vxlan / vxlan_core.c
index 386cbe4d33272791e80470bd1378731d0c3b4d3b..6f26003a30646b23121949b28a94c1e3833e1a00 100644 (file)
@@ -2841,15 +2841,9 @@ static int vxlan_init(struct net_device *dev)
        if (vxlan->cfg.flags & VXLAN_F_VNIFILTER)
                vxlan_vnigroup_init(vxlan);
 
-       dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
-       if (!dev->tstats) {
-               err = -ENOMEM;
-               goto err_vnigroup_uninit;
-       }
-
        err = gro_cells_init(&vxlan->gro_cells, dev);
        if (err)
-               goto err_free_percpu;
+               goto err_vnigroup_uninit;
 
        err = vxlan_mdb_init(vxlan);
        if (err)
@@ -2860,8 +2854,6 @@ static int vxlan_init(struct net_device *dev)
 
 err_gro_cells_destroy:
        gro_cells_destroy(&vxlan->gro_cells);
-err_free_percpu:
-       free_percpu(dev->tstats);
 err_vnigroup_uninit:
        if (vxlan->cfg.flags & VXLAN_F_VNIFILTER)
                vxlan_vnigroup_uninit(vxlan);
@@ -2892,8 +2884,6 @@ static void vxlan_uninit(struct net_device *dev)
        gro_cells_destroy(&vxlan->gro_cells);
 
        vxlan_fdb_delete_default(vxlan, vxlan->cfg.vni);
-
-       free_percpu(dev->tstats);
 }
 
 /* Start ageing timer and join group when device is brought up */
@@ -3316,6 +3306,7 @@ static void vxlan_setup(struct net_device *dev)
        dev->min_mtu = ETH_MIN_MTU;
        dev->max_mtu = ETH_MAX_MTU;
 
+       dev->pcpu_stat_type = NETDEV_PCPU_STAT_TSTATS;
        INIT_LIST_HEAD(&vxlan->next);
 
        timer_setup(&vxlan->age_timer, vxlan_cleanup, TIMER_DEFERRABLE);