Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: nlmon: Remove init and uninit functions

With commit 34d21de99cea9 ("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.

Remove the allocation in the nlmon driver and leverage the network
core allocation.

Signed-off-by: Breno Leitao <leitao@debian.org>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Breno Leitao and committed by
David S. Miller
4f41ce81 b8b85d04

+1 -13
+1 -13
drivers/net/nlmon.c
··· 17 17 return NETDEV_TX_OK; 18 18 } 19 19 20 - static int nlmon_dev_init(struct net_device *dev) 21 - { 22 - dev->lstats = netdev_alloc_pcpu_stats(struct pcpu_lstats); 23 - return dev->lstats == NULL ? -ENOMEM : 0; 24 - } 25 - 26 - static void nlmon_dev_uninit(struct net_device *dev) 27 - { 28 - free_percpu(dev->lstats); 29 - } 30 - 31 20 struct nlmon { 32 21 struct netlink_tap nt; 33 22 }; ··· 61 72 }; 62 73 63 74 static const struct net_device_ops nlmon_ops = { 64 - .ndo_init = nlmon_dev_init, 65 - .ndo_uninit = nlmon_dev_uninit, 66 75 .ndo_open = nlmon_open, 67 76 .ndo_stop = nlmon_close, 68 77 .ndo_start_xmit = nlmon_xmit, ··· 79 92 dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | 80 93 NETIF_F_HIGHDMA | NETIF_F_LLTX; 81 94 dev->flags = IFF_NOARP; 95 + dev->pcpu_stat_type = NETDEV_PCPU_STAT_LSTATS; 82 96 83 97 /* That's rather a softlimit here, which, of course, 84 98 * can be altered. Not a real MTU, but what is to be