[nf-next:nexpr-wip 38/41] net/netfilter/nft_counter.c:67:16: note: in expansion of macro 'xchg'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.git nexpr-wip
head:   79fecc65dbc173c5c12e0fa33997e4b8cae10d41
commit: 3593c74388e4faafa88c04cbb8e0a6792d4600eb [38/41] netfilter: nft_counter: support for atomic dump and reset
config: i386-randconfig-s1-201636 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        git checkout 3593c74388e4faafa88c04cbb8e0a6792d4600eb
        # save the attached .config to linux build tree
        make ARCH=i386 

All warnings (new ones prefixed by >>):

   In file included from arch/x86/include/asm/atomic.h:7:0,
                    from include/linux/atomic.h:4,
                    from arch/x86/include/asm/thread_info.h:53,
                    from include/linux/thread_info.h:54,
                    from arch/x86/include/asm/preempt.h:6,
                    from include/linux/preempt.h:59,
                    from include/linux/spinlock.h:50,
                    from include/linux/seqlock.h:35,
                    from include/linux/time.h:5,
                    from include/linux/stat.h:18,
                    from include/linux/module.h:10,
                    from net/netfilter/nft_counter.c:13:
   net/netfilter/nft_counter.c: In function 'nft_counter_fetch':
   arch/x86/include/asm/cmpxchg.h:66:4: error: call to '__xchg_wrong_size' declared with attribute error: Bad argument size for xchg
       __ ## op ## _wrong_size();   \
       ^~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/include/asm/cmpxchg.h:77:22: note: in expansion of macro '__xchg_op'
    #define xchg(ptr, v) __xchg_op((ptr), (v), xchg, "")
                         ^~~~~~~~~
>> net/netfilter/nft_counter.c:67:16: note: in expansion of macro 'xchg'
        packets += xchg(&cpu_stats->counter.packets, 0);
                   ^~~~
   arch/x86/include/asm/cmpxchg.h:66:4: error: call to '__xchg_wrong_size' declared with attribute error: Bad argument size for xchg
       __ ## op ## _wrong_size();   \
       ^~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/include/asm/cmpxchg.h:77:22: note: in expansion of macro '__xchg_op'
    #define xchg(ptr, v) __xchg_op((ptr), (v), xchg, "")
                         ^~~~~~~~~
   net/netfilter/nft_counter.c:68:14: note: in expansion of macro 'xchg'
        bytes += xchg(&cpu_stats->counter.bytes, 0);
                 ^~~~

vim +/xchg +67 net/netfilter/nft_counter.c

     7	 *
     8	 * Development of this code funded by Astaro AG (http://www.astaro.com/)
     9	 */
    10	
    11	#include <linux/kernel.h>
    12	#include <linux/init.h>
  > 13	#include <linux/module.h>
    14	#include <linux/seqlock.h>
    15	#include <linux/netlink.h>
    16	#include <linux/netfilter.h>
    17	#include <linux/netfilter/nf_tables.h>
    18	#include <net/netfilter/nf_tables.h>
    19	
    20	struct nft_counter {
    21		u64		bytes;
    22		u64		packets;
    23	};
    24	
    25	struct nft_counter_percpu {
    26		struct nft_counter	counter;
    27		struct u64_stats_sync	syncp;
    28	};
    29	
    30	struct nft_counter_percpu_priv {
    31		struct nft_counter_percpu __percpu *counter;
    32	};
    33	
    34	static void nft_counter_eval(const struct nft_expr *expr,
    35				     struct nft_regs *regs,
    36				     const struct nft_pktinfo *pkt)
    37	{
    38		struct nft_counter_percpu_priv *priv = nft_expr_priv(expr);
    39		struct nft_counter_percpu *this_cpu;
    40	
    41		local_bh_disable();
    42		this_cpu = this_cpu_ptr(priv->counter);
    43		u64_stats_update_begin(&this_cpu->syncp);
    44		this_cpu->counter.bytes += pkt->skb->len;
    45		this_cpu->counter.packets++;
    46		u64_stats_update_end(&this_cpu->syncp);
    47		local_bh_enable();
    48	}
    49	
    50	static void nft_counter_fetch(struct nft_counter_percpu __percpu *counter,
    51				      struct nft_counter *total, bool reset)
    52	{
    53		struct nft_counter_percpu *cpu_stats;
    54		u64 bytes, packets;
    55		unsigned int seq;
    56		int cpu;
    57	
    58		memset(total, 0, sizeof(*total));
    59		for_each_possible_cpu(cpu) {
    60			if (reset)
    61				bytes = packets = 0;
    62	
    63			cpu_stats = per_cpu_ptr(counter, cpu);
    64			do {
    65				seq	= u64_stats_fetch_begin_irq(&cpu_stats->syncp);
    66				if (reset) {
  > 67					packets += xchg(&cpu_stats->counter.packets, 0);
    68					bytes	+= xchg(&cpu_stats->counter.bytes, 0);
    69				} else {
    70					bytes	= cpu_stats->counter.bytes;

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: Binary data


[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux