diff options
author | Pablo Neira Ayuso | 2015-11-10 14:31:18 +0100 |
---|---|---|
committer | Pablo Neira Ayuso | 2015-11-10 23:47:32 +0100 |
commit | aabc92bbe3cfe4c545f8ccdaaeeea012a46f0abf (patch) | |
tree | 9d6f868aec5c556a43c38e73d536005dfbe4a475 | |
parent | netfilter: fix xt_TEE and xt_TPROXY dependencies (diff) | |
download | kernel-qcow2-linux-aabc92bbe3cfe4c545f8ccdaaeeea012a46f0abf.tar.gz kernel-qcow2-linux-aabc92bbe3cfe4c545f8ccdaaeeea012a46f0abf.tar.xz kernel-qcow2-linux-aabc92bbe3cfe4c545f8ccdaaeeea012a46f0abf.zip |
net: add __netdev_alloc_pcpu_stats() to indicate gfp flags
nf_tables may create percpu counters from the packet path through its
dynamic set instantiation infrastructure, so we need a way to allocate
this through GFP_ATOMIC.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Acked-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/linux/netdevice.h | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 2c00772bd136..e9d0c8a75380 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -2068,20 +2068,23 @@ struct pcpu_sw_netstats { struct u64_stats_sync syncp; }; -#define netdev_alloc_pcpu_stats(type) \ -({ \ - typeof(type) __percpu *pcpu_stats = alloc_percpu(type); \ - if (pcpu_stats) { \ - int __cpu; \ - for_each_possible_cpu(__cpu) { \ - typeof(type) *stat; \ - stat = per_cpu_ptr(pcpu_stats, __cpu); \ - u64_stats_init(&stat->syncp); \ - } \ - } \ - pcpu_stats; \ +#define __netdev_alloc_pcpu_stats(type, gfp) \ +({ \ + typeof(type) __percpu *pcpu_stats = alloc_percpu_gfp(type, gfp);\ + if (pcpu_stats) { \ + int __cpu; \ + for_each_possible_cpu(__cpu) { \ + typeof(type) *stat; \ + stat = per_cpu_ptr(pcpu_stats, __cpu); \ + u64_stats_init(&stat->syncp); \ + } \ + } \ + pcpu_stats; \ }) +#define netdev_alloc_pcpu_stats(type) \ + __netdev_alloc_pcpu_stats(type, GFP_KERNEL); + #include <linux/notifier.h> /* netdevice notifier chain. Please remember to update the rtnetlink |