netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH nf 1/2] net: add __netdev_alloc_pcpu_stats() to indicate gfp flags
@ 2015-11-10 16:36 Pablo Neira Ayuso
  2015-11-10 16:36 ` [PATCH] netfilter: Fix removal of GRE expectation entries created by PPTP Pablo Neira Ayuso
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Pablo Neira Ayuso @ 2015-11-10 16:36 UTC (permalink / raw)
  To: netfilter-devel; +Cc: kaber, netdev

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>
---
 include/linux/netdevice.h | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 2c00772..e9d0c8a 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
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-11-10 20:12 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-10 16:36 [PATCH nf 1/2] net: add __netdev_alloc_pcpu_stats() to indicate gfp flags Pablo Neira Ayuso
2015-11-10 16:36 ` [PATCH] netfilter: Fix removal of GRE expectation entries created by PPTP Pablo Neira Ayuso
2015-11-10 16:39   ` Pablo Neira Ayuso
2015-11-10 16:36 ` [PATCH nf 2/2] netfilter: nf_tables: add clone interface to expression operations Pablo Neira Ayuso
2015-11-10 18:30   ` Patrick McHardy
2015-11-10 18:39     ` Pablo Neira Ayuso
2015-11-10 18:58       ` Patrick McHardy
2015-11-10 18:59         ` Pablo Neira Ayuso
2015-11-10 19:05           ` Patrick McHardy
2015-11-10 20:12 ` [PATCH nf 1/2] net: add __netdev_alloc_pcpu_stats() to indicate gfp flags David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).