Re: [wireless-testsing2:master 1/4] drivers/net/netdevsim/bpf.c:130:14: sparse: incompatible types for 'case' statement

2018-01-05 Thread Fengguang Wu

On Wed, Jan 03, 2018 at 05:02:37PM -0800, Jakub Kicinski wrote:

On Thu, 4 Jan 2018 03:53:20 +0800, kbuild test robot wrote:

tree:   
https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-testing.git 
master
head:   6b3b30d0c31ddb2f4d8208c90bc2b4adef47204d
commit: af2cae39f6ab9dc596616d6a28c7772e1dd55e91 [1/4] Merge remote-tracking 
branch 'wireless-drivers-next/master'
reproduce:
# apt-get install sparse
git checkout af2cae39f6ab9dc596616d6a28c7772e1dd55e91
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__



   drivers/net/netdevsim/bpf.c: In function 'nsim_bpf_setup_tc_block_cb':
>> drivers/net/netdevsim/bpf.c:130:7: error: 'TC_CLSBPF_REPLACE' undeclared 
(first use in this function); did you mean 'TC_RED_REPLACE'?
 case TC_CLSBPF_REPLACE:
  ^
  TC_RED_REPLACE


FWIW looks like the tree contains old net-next code and latest net
(linux/master) code.  Pulling from net-next will solve this.


:: TO: Jakub Kicinski 
:: CC: Daniel Borkmann 


Interestingly Daniel and I were not CCed on the report, is this
intentional?


Yeah the above ":: TO/CC" lines are for manual addition when
appropriate. They are the author/committer of the commit that last
modified the code line in question.

Thanks,
Fengguang


Re: [wireless-testsing2:master 1/4] drivers/net/netdevsim/bpf.c:130:14: sparse: incompatible types for 'case' statement

2018-01-04 Thread Bob Copeland
On Wed, Jan 03, 2018 at 05:02:37PM -0800, Jakub Kicinski wrote:
> >drivers/net/netdevsim/bpf.c: In function 'nsim_bpf_setup_tc_block_cb':
> > >> drivers/net/netdevsim/bpf.c:130:7: error: 'TC_CLSBPF_REPLACE' undeclared 
> > >> (first use in this function); did you mean 'TC_RED_REPLACE'?  
> >  case TC_CLSBPF_REPLACE:
> >   ^
> >   TC_RED_REPLACE
> 
> FWIW looks like the tree contains old net-next code and latest net
> (linux/master) code.  Pulling from net-next will solve this.
>

Thanks, yes, sorry about the noise.  This tree doesn't always pull net-next,
but I'll do so and compile-test netdevsim in next build.

> > :: TO: Jakub Kicinski 
> > :: CC: Daniel Borkmann 
> 
> Interestingly Daniel and I were not CCed on the report, is this
> intentional?

One for kbuildbot team I guess, not sure how it determines whom to email.
Personally I would be ok if only myself and maybe linux-wireless got the
emails for this tree since most build failures are similar noise.

-- 
Bob Copeland %% https://bobcopeland.com/


Re: [wireless-testsing2:master 1/4] drivers/net/netdevsim/bpf.c:130:14: sparse: incompatible types for 'case' statement

2018-01-03 Thread Jakub Kicinski
On Thu, 4 Jan 2018 03:53:20 +0800, kbuild test robot wrote:
> tree:   
> https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-testing.git 
> master
> head:   6b3b30d0c31ddb2f4d8208c90bc2b4adef47204d
> commit: af2cae39f6ab9dc596616d6a28c7772e1dd55e91 [1/4] Merge remote-tracking 
> branch 'wireless-drivers-next/master'
> reproduce:
> # apt-get install sparse
> git checkout af2cae39f6ab9dc596616d6a28c7772e1dd55e91
> make ARCH=x86_64 allmodconfig
> make C=1 CF=-D__CHECK_ENDIAN__

>drivers/net/netdevsim/bpf.c: In function 'nsim_bpf_setup_tc_block_cb':
> >> drivers/net/netdevsim/bpf.c:130:7: error: 'TC_CLSBPF_REPLACE' undeclared 
> >> (first use in this function); did you mean 'TC_RED_REPLACE'?  
>  case TC_CLSBPF_REPLACE:
>   ^
>   TC_RED_REPLACE

FWIW looks like the tree contains old net-next code and latest net
(linux/master) code.  Pulling from net-next will solve this.

> :: TO: Jakub Kicinski 
> :: CC: Daniel Borkmann 

Interestingly Daniel and I were not CCed on the report, is this
intentional?


[wireless-testsing2:master 1/4] drivers/net/netdevsim/bpf.c:130:14: sparse: incompatible types for 'case' statement

2018-01-03 Thread kbuild test robot
tree:   
https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-testing.git 
master
head:   6b3b30d0c31ddb2f4d8208c90bc2b4adef47204d
commit: af2cae39f6ab9dc596616d6a28c7772e1dd55e91 [1/4] Merge remote-tracking 
branch 'wireless-drivers-next/master'
reproduce:
# apt-get install sparse
git checkout af2cae39f6ab9dc596616d6a28c7772e1dd55e91
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__

All errors (new ones prefixed by >>):

   drivers/net/netdevsim/bpf.c:130:14: sparse: undefined identifier 
'TC_CLSBPF_REPLACE'
   drivers/net/netdevsim/bpf.c:132:14: sparse: undefined identifier 
'TC_CLSBPF_ADD'
   drivers/net/netdevsim/bpf.c:134:14: sparse: undefined identifier 
'TC_CLSBPF_DESTROY'
   drivers/net/netdevsim/bpf.c:130:14: sparse: incompatible types for 'case' 
statement
   drivers/net/netdevsim/bpf.c:132:14: sparse: incompatible types for 'case' 
statement
   drivers/net/netdevsim/bpf.c:134:14: sparse: incompatible types for 'case' 
statement
   drivers/net/netdevsim/bpf.c:130:14: sparse: Expected constant expression in 
case statement
   drivers/net/netdevsim/bpf.c:132:14: sparse: Expected constant expression in 
case statement
   drivers/net/netdevsim/bpf.c:134:14: sparse: Expected constant expression in 
case statement
   drivers/net/netdevsim/bpf.c: In function 'nsim_bpf_setup_tc_block_cb':
>> drivers/net/netdevsim/bpf.c:130:7: error: 'TC_CLSBPF_REPLACE' undeclared 
>> (first use in this function); did you mean 'TC_RED_REPLACE'?
 case TC_CLSBPF_REPLACE:
  ^
  TC_RED_REPLACE
   drivers/net/netdevsim/bpf.c:130:7: note: each undeclared identifier is 
reported only once for each function it appears in
>> drivers/net/netdevsim/bpf.c:132:7: error: 'TC_CLSBPF_ADD' undeclared (first 
>> use in this function); did you mean 'TC_CLSBPF_STATS'?
 case TC_CLSBPF_ADD:
  ^
  TC_CLSBPF_STATS
>> drivers/net/netdevsim/bpf.c:134:7: error: 'TC_CLSBPF_DESTROY' undeclared 
>> (first use in this function); did you mean 'TC_CLSBPF_STATS'?
 case TC_CLSBPF_DESTROY:
  ^
  TC_CLSBPF_STATS

sparse warnings: (new ones prefixed by >>)


vim +/case +130 drivers/net/netdevsim/bpf.c

31d3ad83 Jakub Kicinski 2017-12-01  103  
31d3ad83 Jakub Kicinski 2017-12-01  104  int nsim_bpf_setup_tc_block_cb(enum 
tc_setup_type type,
31d3ad83 Jakub Kicinski 2017-12-01  105void 
*type_data, void *cb_priv)
31d3ad83 Jakub Kicinski 2017-12-01  106  {
31d3ad83 Jakub Kicinski 2017-12-01  107 struct tc_cls_bpf_offload 
*cls_bpf = type_data;
31d3ad83 Jakub Kicinski 2017-12-01  108 struct bpf_prog *prog = 
cls_bpf->prog;
31d3ad83 Jakub Kicinski 2017-12-01  109 struct netdevsim *ns = cb_priv;
31d3ad83 Jakub Kicinski 2017-12-01  110 bool skip_sw;
31d3ad83 Jakub Kicinski 2017-12-01  111  
31d3ad83 Jakub Kicinski 2017-12-01  112 if (type != TC_SETUP_CLSBPF ||
31d3ad83 Jakub Kicinski 2017-12-01  113 !tc_can_offload(ns->netdev) 
||
31d3ad83 Jakub Kicinski 2017-12-01  114 cls_bpf->common.protocol != 
htons(ETH_P_ALL) ||
31d3ad83 Jakub Kicinski 2017-12-01  115 cls_bpf->common.chain_index)
31d3ad83 Jakub Kicinski 2017-12-01  116 return -EOPNOTSUPP;
31d3ad83 Jakub Kicinski 2017-12-01  117  
31d3ad83 Jakub Kicinski 2017-12-01  118 skip_sw = cls_bpf->gen_flags & 
TCA_CLS_FLAGS_SKIP_SW;
31d3ad83 Jakub Kicinski 2017-12-01  119  
31d3ad83 Jakub Kicinski 2017-12-01  120 if (nsim_xdp_offload_active(ns))
31d3ad83 Jakub Kicinski 2017-12-01  121 return -EBUSY;
31d3ad83 Jakub Kicinski 2017-12-01  122  
31d3ad83 Jakub Kicinski 2017-12-01  123 if (!ns->bpf_tc_accept)
31d3ad83 Jakub Kicinski 2017-12-01  124 return -EOPNOTSUPP;
31d3ad83 Jakub Kicinski 2017-12-01  125 /* Note: progs without skip_sw 
will probably not be dev bound */
31d3ad83 Jakub Kicinski 2017-12-01  126 if (prog && !prog->aux->offload 
&& !ns->bpf_tc_non_bound_accept)
31d3ad83 Jakub Kicinski 2017-12-01  127 return -EOPNOTSUPP;
31d3ad83 Jakub Kicinski 2017-12-01  128  
31d3ad83 Jakub Kicinski 2017-12-01  129 switch (cls_bpf->command) {
31d3ad83 Jakub Kicinski 2017-12-01 @130 case TC_CLSBPF_REPLACE:
31d3ad83 Jakub Kicinski 2017-12-01  131 return 
nsim_bpf_offload(ns, prog, true);
31d3ad83 Jakub Kicinski 2017-12-01 @132 case TC_CLSBPF_ADD:
31d3ad83 Jakub Kicinski 2017-12-01  133 return 
nsim_bpf_offload(ns, prog, false);
31d3ad83 Jakub Kicinski 2017-12-01 @134 case TC_CLSBPF_DESTROY:
31d3ad83 Jakub Kicinski 2017-12-01  135 return 
nsim_bpf_offload(ns, NULL, true);
31d3ad83 Jakub Kicinski 2017-12-01  136 default:
31d3ad83 Jakub Kicinski 2017-12-01  137 return -EOPNOTSUPP;
31d3ad83 Jakub Kicinski 2017-12-01  138 }
31d3ad83 Jakub Kicinski