aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2015-11-10 08:31:18 -0500
committerPablo Neira Ayuso <pablo@netfilter.org>2015-11-10 17:47:32 -0500
commitaabc92bbe3cfe4c545f8ccdaaeeea012a46f0abf (patch)
tree9d6f868aec5c556a43c38e73d536005dfbe4a475
parent74ec4d55c4d243330d93fc52e23e37d2e76548ba (diff)
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.h27
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 {
2068 struct u64_stats_sync syncp; 2068 struct u64_stats_sync syncp;
2069}; 2069};
2070 2070
2071#define netdev_alloc_pcpu_stats(type) \ 2071#define __netdev_alloc_pcpu_stats(type, gfp) \
2072({ \ 2072({ \
2073 typeof(type) __percpu *pcpu_stats = alloc_percpu(type); \ 2073 typeof(type) __percpu *pcpu_stats = alloc_percpu_gfp(type, gfp);\
2074 if (pcpu_stats) { \ 2074 if (pcpu_stats) { \
2075 int __cpu; \ 2075 int __cpu; \
2076 for_each_possible_cpu(__cpu) { \ 2076 for_each_possible_cpu(__cpu) { \
2077 typeof(type) *stat; \ 2077 typeof(type) *stat; \
2078 stat = per_cpu_ptr(pcpu_stats, __cpu); \ 2078 stat = per_cpu_ptr(pcpu_stats, __cpu); \
2079 u64_stats_init(&stat->syncp); \ 2079 u64_stats_init(&stat->syncp); \
2080 } \ 2080 } \
2081 } \ 2081 } \
2082 pcpu_stats; \ 2082 pcpu_stats; \
2083}) 2083})
2084 2084
2085#define netdev_alloc_pcpu_stats(type) \
2086 __netdev_alloc_pcpu_stats(type, GFP_KERNEL);
2087
2085#include <linux/notifier.h> 2088#include <linux/notifier.h>
2086 2089
2087/* netdevice notifier chain. Please remember to update the rtnetlink 2090/* netdevice notifier chain. Please remember to update the rtnetlink