Subject: Re: [PATCH v2 net-next 4/4] cxgb4: Add MPS refcounting for alloc/free mac filters

From: kbuild test robot <[email-masked]>
Date: Tue, 25 Jun 2019 02:24:06 +0800

Hi Raju,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Raju-Rangoju/cxgb4-Reference-count-MPS-TCAM-entries-within-a-PF/20190624-230630
config: x86_64-randconfig-b0-06242344 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <[email-masked]>

All warnings (new ones prefixed by >>):

   drivers/net/ethernet/chelsio/cxgb4/cxgb4_mps.c: In function 'cxgb4_mps_ref_dec_by_mac':
>> drivers/net/ethernet/chelsio/cxgb4/cxgb4_mps.c:17:29: warning: passing argument 1 of 'atomic_dec_and_test' from incompatible pointer type
       if (!atomic_dec_and_test(&mps_entry->refcnt)) {
                                ^
   In file included from arch/x86/include/asm/atomic.h:265:0,
                    from arch/x86/include/asm/msr.h:67,
                    from arch/x86/include/asm/processor.h:21,
                    from arch/x86/include/asm/cpufeature.h:5,
                    from arch/x86/include/asm/thread_info.h:53,
                    from include/linux/thread_info.h:38,
                    from arch/x86/include/asm/preempt.h:7,
                    from include/linux/preempt.h:78,
                    from include/linux/hardirq.h:5,
                    from include/linux/interrupt.h:11,
                    from drivers/net/ethernet/chelsio/cxgb4/cxgb4.h:42,
                    from drivers/net/ethernet/chelsio/cxgb4/cxgb4_mps.c:4:
   include/asm-generic/atomic-instrumented.h:745:1: note: expected 'struct atomic_t *' but argument is of type 'struct refcount_t *'
    atomic_dec_and_test(atomic_t *v)
    ^

vim +/atomic_dec_and_test +17 drivers/net/ethernet/chelsio/cxgb4/cxgb4_mps.c

     5	
     6	static int cxgb4_mps_ref_dec_by_mac(struct adapter *adap,
     7					    const u8 *addr, const u8 *mask)
     8	{
     9		u8 bitmask[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
    10		struct mps_entries_ref *mps_entry, *tmp;
    11		int ret = -EINVAL;
    12	
    13		spin_lock_bh(&adap->mps_ref_lock);
    14		list_for_each_entry_safe(mps_entry, tmp, &adap->mps_ref, list) {
    15			if (ether_addr_equal(mps_entry->addr, addr) &&
    16			    ether_addr_equal(mps_entry->mask, mask ? mask : bitmask)) {
  > 17				if (!atomic_dec_and_test(&mps_entry->refcnt)) {
    18					spin_unlock_bh(&adap->mps_ref_lock);
    19					return -EBUSY;
    20				}
    21				list_del(&mps_entry->list);
    22				kfree(mps_entry);
    23				ret = 0;
    24				break;
    25			}
    26		}
    27		spin_unlock_bh(&adap->mps_ref_lock);
    28		return ret;
    29	}
    30	

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