[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202110011647.9UsspZwk-lkp@intel.com>
Date: Fri, 1 Oct 2021 16:23:49 +0800
From: kernel test robot <lkp@...el.com>
To: Petr Machata <petrm@...dia.com>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: [jpirko-mlxsw:petrm_leftovers 47/50] net/sched/act_dpxfer.c:13:34:
warning: 'struct tcf_result' declared inside parameter list will not be
visible outside of this definition or declaration
tree: https://github.com/jpirko/linux_mlxsw petrm_leftovers
head: 2b442e043022670cc0d74d76db2cbcf1ba7b0d89
commit: 07498c92e13674912b77d77a0879449a4541b224 [47/50] dpxfer xxx
config: sparc-randconfig-r005-20211001 (attached as .config)
compiler: sparc64-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/jpirko/linux_mlxsw/commit/07498c92e13674912b77d77a0879449a4541b224
git remote add jpirko-mlxsw https://github.com/jpirko/linux_mlxsw
git fetch --no-tags jpirko-mlxsw petrm_leftovers
git checkout 07498c92e13674912b77d77a0879449a4541b224
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=sparc SHELL=/bin/bash net/sched/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
All warnings (new ones prefixed by >>):
>> net/sched/act_dpxfer.c:13:34: warning: 'struct tcf_result' declared inside parameter list will not be visible outside of this definition or declaration
13 | struct tcf_result *res)
| ^~~~~~~~~~
>> net/sched/act_dpxfer.c:12:61: warning: 'struct tc_action' declared inside parameter list will not be visible outside of this definition or declaration
12 | static int tcf_dpxfer_act(struct sk_buff *skb, const struct tc_action *a,
| ^~~~~~~~~
>> net/sched/act_dpxfer.c:12:34: warning: 'struct sk_buff' declared inside parameter list will not be visible outside of this definition or declaration
12 | static int tcf_dpxfer_act(struct sk_buff *skb, const struct tc_action *a,
| ^~~~~~~
net/sched/act_dpxfer.c: In function 'tcf_dpxfer_act':
net/sched/act_dpxfer.c:15:16: error: 'TC_ACT_OK' undeclared (first use in this function)
15 | return TC_ACT_OK;
| ^~~~~~~~~
net/sched/act_dpxfer.c:15:16: note: each undeclared identifier is reported only once for each function it appears in
net/sched/act_dpxfer.c: At top level:
net/sched/act_dpxfer.c:18:56: warning: 'struct tc_action' declared inside parameter list will not be visible outside of this definition or declaration
18 | static int tcf_dpxfer_dump(struct sk_buff *skb, struct tc_action *a, int bind,
| ^~~~~~~~~
net/sched/act_dpxfer.c:18:35: warning: 'struct sk_buff' declared inside parameter list will not be visible outside of this definition or declaration
18 | static int tcf_dpxfer_dump(struct sk_buff *skb, struct tc_action *a, int bind,
| ^~~~~~~
net/sched/act_dpxfer.c: In function 'tcf_dpxfer_dump':
net/sched/act_dpxfer.c:21:28: error: implicit declaration of function 'skb_tail_pointer' [-Werror=implicit-function-declaration]
21 | unsigned char *b = skb_tail_pointer(skb);
| ^~~~~~~~~~~~~~~~
>> net/sched/act_dpxfer.c:21:28: warning: initialization of 'unsigned char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
net/sched/act_dpxfer.c:22:32: error: implicit declaration of function 'to_dpxfer' [-Werror=implicit-function-declaration]
22 | struct tcf_dpxfer *s = to_dpxfer(a);
| ^~~~~~~~~
>> net/sched/act_dpxfer.c:22:32: warning: initialization of 'struct tcf_dpxfer *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
net/sched/act_dpxfer.c:23:16: error: variable 'opt' has initializer but incomplete type
23 | struct tc_dpxfer opt = {
| ^~~~~~~~~
net/sched/act_dpxfer.c:24:18: error: 'struct tc_dpxfer' has no member named 'index'
24 | .index = s->tcf_index,
| ^~~~~
net/sched/act_dpxfer.c:24:32: error: invalid use of undefined type 'struct tcf_dpxfer'
24 | .index = s->tcf_index,
| ^~
>> net/sched/act_dpxfer.c:24:31: warning: excess elements in struct initializer
24 | .index = s->tcf_index,
| ^
net/sched/act_dpxfer.c:24:31: note: (near initialization for 'opt')
net/sched/act_dpxfer.c:25:18: error: 'struct tc_dpxfer' has no member named 'refcnt'
25 | .refcnt = refcount_read(&s->tcf_refcnt) - ref,
| ^~~~~~
net/sched/act_dpxfer.c:25:31: error: implicit declaration of function 'refcount_read' [-Werror=implicit-function-declaration]
25 | .refcnt = refcount_read(&s->tcf_refcnt) - ref,
| ^~~~~~~~~~~~~
net/sched/act_dpxfer.c:25:47: error: invalid use of undefined type 'struct tcf_dpxfer'
25 | .refcnt = refcount_read(&s->tcf_refcnt) - ref,
| ^~
net/sched/act_dpxfer.c:25:31: warning: excess elements in struct initializer
25 | .refcnt = refcount_read(&s->tcf_refcnt) - ref,
| ^~~~~~~~~~~~~
net/sched/act_dpxfer.c:25:31: note: (near initialization for 'opt')
net/sched/act_dpxfer.c:26:18: error: 'struct tc_dpxfer' has no member named 'bindcnt'
26 | .bindcnt = atomic_read(&s->tcf_bindcnt) - bind,
| ^~~~~~~
net/sched/act_dpxfer.c:26:31: error: implicit declaration of function 'atomic_read' [-Werror=implicit-function-declaration]
26 | .bindcnt = atomic_read(&s->tcf_bindcnt) - bind,
| ^~~~~~~~~~~
net/sched/act_dpxfer.c:26:45: error: invalid use of undefined type 'struct tcf_dpxfer'
26 | .bindcnt = atomic_read(&s->tcf_bindcnt) - bind,
| ^~
net/sched/act_dpxfer.c:26:31: warning: excess elements in struct initializer
26 | .bindcnt = atomic_read(&s->tcf_bindcnt) - bind,
| ^~~~~~~~~~~
net/sched/act_dpxfer.c:26:31: note: (near initialization for 'opt')
net/sched/act_dpxfer.c:23:26: error: storage size of 'opt' isn't known
23 | struct tc_dpxfer opt = {
| ^~~
net/sched/act_dpxfer.c:28:22: error: storage size of 't' isn't known
28 | struct tcf_t t;
| ^
net/sched/act_dpxfer.c:30:9: error: implicit declaration of function 'spin_lock_bh' [-Werror=implicit-function-declaration]
30 | spin_lock_bh(&s->tcf_lock);
| ^~~~~~~~~~~~
net/sched/act_dpxfer.c:30:24: error: invalid use of undefined type 'struct tcf_dpxfer'
30 | spin_lock_bh(&s->tcf_lock);
| ^~
net/sched/act_dpxfer.c:32:23: error: invalid use of undefined type 'struct tcf_dpxfer'
32 | opt.action = s->tcf_action;
| ^~
net/sched/act_dpxfer.c:33:13: error: implicit declaration of function 'nla_put' [-Werror=implicit-function-declaration]
33 | if (nla_put(skb, TCA_DPXFER_PARMS, sizeof(opt), &opt))
| ^~~~~~~
net/sched/act_dpxfer.c:33:26: error: 'TCA_DPXFER_PARMS' undeclared (first use in this function)
33 | if (nla_put(skb, TCA_DPXFER_PARMS, sizeof(opt), &opt))
| ^~~~~~~~~~~~~~~~
net/sched/act_dpxfer.c:36:9: error: implicit declaration of function 'tcf_tm_dump' [-Werror=implicit-function-declaration]
36 | tcf_tm_dump(&t, &s->tcf_tm);
| ^~~~~~~~~~~
net/sched/act_dpxfer.c:36:27: error: invalid use of undefined type 'struct tcf_dpxfer'
36 | tcf_tm_dump(&t, &s->tcf_tm);
| ^~
net/sched/act_dpxfer.c:37:13: error: implicit declaration of function 'nla_put_64bit' [-Werror=implicit-function-declaration]
37 | if (nla_put_64bit(skb, TCA_DPXFER_TM, sizeof(t), &t, TCA_DPXFER_PAD))
| ^~~~~~~~~~~~~
net/sched/act_dpxfer.c:37:32: error: 'TCA_DPXFER_TM' undeclared (first use in this function)
37 | if (nla_put_64bit(skb, TCA_DPXFER_TM, sizeof(t), &t, TCA_DPXFER_PAD))
| ^~~~~~~~~~~~~
net/sched/act_dpxfer.c:37:62: error: 'TCA_DPXFER_PAD' undeclared (first use in this function)
37 | if (nla_put_64bit(skb, TCA_DPXFER_TM, sizeof(t), &t, TCA_DPXFER_PAD))
| ^~~~~~~~~~~~~~
net/sched/act_dpxfer.c:40:9: error: implicit declaration of function 'spin_unlock_bh' [-Werror=implicit-function-declaration]
40 | spin_unlock_bh(&s->tcf_lock);
| ^~~~~~~~~~~~~~
net/sched/act_dpxfer.c:40:26: error: invalid use of undefined type 'struct tcf_dpxfer'
40 | spin_unlock_bh(&s->tcf_lock);
| ^~
net/sched/act_dpxfer.c:42:19: error: invalid use of undefined type 'struct sk_buff'
42 | return skb->len;
| ^~
net/sched/act_dpxfer.c:45:26: error: invalid use of undefined type 'struct tcf_dpxfer'
45 | spin_unlock_bh(&s->tcf_lock);
| ^~
net/sched/act_dpxfer.c:46:9: error: implicit declaration of function 'nlmsg_trim' [-Werror=implicit-function-declaration]
46 | nlmsg_trim(skb, b);
| ^~~~~~~~~~
net/sched/act_dpxfer.c:28:22: warning: unused variable 't' [-Wunused-variable]
28 | struct tcf_t t;
| ^
net/sched/act_dpxfer.c:23:26: warning: unused variable 'opt' [-Wunused-variable]
23 | struct tc_dpxfer opt = {
| ^~~
net/sched/act_dpxfer.c: At top level:
net/sched/act_dpxfer.c:52:38: error: unknown type name 'bool'
52 | int bind, bool rtnl_held, struct tcf_proto *tp,
| ^~~~
net/sched/act_dpxfer.c:53:28: error: unknown type name 'u32'
53 | u32 flags, struct netlink_ext_ack *extack)
| ^~~
net/sched/act_dpxfer.c:193:15: error: variable 'act_dpxfer_ops' has initializer but incomplete type
193 | static struct tc_action_ops act_dpxfer_ops = {
| ^~~~~~~~~~~~~
net/sched/act_dpxfer.c:194:10: error: 'struct tc_action_ops' has no member named 'kind'
194 | .kind = "dpxfer",
| ^~~~
net/sched/act_dpxfer.c:194:33: warning: excess elements in struct initializer
194 | .kind = "dpxfer",
| ^~~~~~~~
net/sched/act_dpxfer.c:194:33: note: (near initialization for 'act_dpxfer_ops')
net/sched/act_dpxfer.c:195:10: error: 'struct tc_action_ops' has no member named 'id'
195 | .id = TCA_ID_DPXFER,
| ^~
net/sched/act_dpxfer.c:195:33: error: 'TCA_ID_DPXFER' undeclared here (not in a function)
195 | .id = TCA_ID_DPXFER,
| ^~~~~~~~~~~~~
net/sched/act_dpxfer.c:195:33: warning: excess elements in struct initializer
net/sched/act_dpxfer.c:195:33: note: (near initialization for 'act_dpxfer_ops')
net/sched/act_dpxfer.c:196:10: error: 'struct tc_action_ops' has no member named 'owner'
196 | .owner = THIS_MODULE,
| ^~~~~
net/sched/act_dpxfer.c:196:33: error: 'THIS_MODULE' undeclared here (not in a function); did you mean 'IS_MODULE'?
196 | .owner = THIS_MODULE,
| ^~~~~~~~~~~
| IS_MODULE
net/sched/act_dpxfer.c:196:33: warning: excess elements in struct initializer
net/sched/act_dpxfer.c:196:33: note: (near initialization for 'act_dpxfer_ops')
net/sched/act_dpxfer.c:197:10: error: 'struct tc_action_ops' has no member named 'act'
197 | .act = tcf_dpxfer_act,
| ^~~
net/sched/act_dpxfer.c:197:33: warning: excess elements in struct initializer
197 | .act = tcf_dpxfer_act,
| ^~~~~~~~~~~~~~
net/sched/act_dpxfer.c:197:33: note: (near initialization for 'act_dpxfer_ops')
net/sched/act_dpxfer.c:198:10: error: 'struct tc_action_ops' has no member named 'stats_update'
198 | .stats_update = tcf_stats_update,
| ^~~~~~~~~~~~
net/sched/act_dpxfer.c:198:33: error: 'tcf_stats_update' undeclared here (not in a function)
198 | .stats_update = tcf_stats_update,
| ^~~~~~~~~~~~~~~~
net/sched/act_dpxfer.c:198:33: warning: excess elements in struct initializer
net/sched/act_dpxfer.c:198:33: note: (near initialization for 'act_dpxfer_ops')
net/sched/act_dpxfer.c:199:10: error: 'struct tc_action_ops' has no member named 'dump'
199 | .dump = tcf_dpxfer_dump,
| ^~~~
net/sched/act_dpxfer.c:199:33: warning: excess elements in struct initializer
199 | .dump = tcf_dpxfer_dump,
| ^~~~~~~~~~~~~~~
net/sched/act_dpxfer.c:199:33: note: (near initialization for 'act_dpxfer_ops')
net/sched/act_dpxfer.c:200:10: error: 'struct tc_action_ops' has no member named 'init'
200 | .init = tcf_dpxfer_init,
| ^~~~
net/sched/act_dpxfer.c:200:33: error: 'tcf_dpxfer_init' undeclared here (not in a function); did you mean 'tcf_dpxfer_act'?
200 | .init = tcf_dpxfer_init,
| ^~~~~~~~~~~~~~~
| tcf_dpxfer_act
net/sched/act_dpxfer.c:200:33: warning: excess elements in struct initializer
net/sched/act_dpxfer.c:200:33: note: (near initialization for 'act_dpxfer_ops')
net/sched/act_dpxfer.c:201:10: error: 'struct tc_action_ops' has no member named 'walk'
201 | .walk = tcf_dpxfer_walker,
| ^~~~
net/sched/act_dpxfer.c:201:33: error: 'tcf_dpxfer_walker' undeclared here (not in a function); did you mean 'tcf_dpxfer_act'?
201 | .walk = tcf_dpxfer_walker,
| ^~~~~~~~~~~~~~~~~
| tcf_dpxfer_act
net/sched/act_dpxfer.c:201:33: warning: excess elements in struct initializer
net/sched/act_dpxfer.c:201:33: note: (near initialization for 'act_dpxfer_ops')
net/sched/act_dpxfer.c:202:10: error: 'struct tc_action_ops' has no member named 'lookup'
202 | .lookup = tcf_dpxfer_search,
| ^~~~~~
net/sched/act_dpxfer.c:202:33: error: 'tcf_dpxfer_search' undeclared here (not in a function); did you mean 'tcf_dpxfer_act'?
202 | .lookup = tcf_dpxfer_search,
| ^~~~~~~~~~~~~~~~~
| tcf_dpxfer_act
net/sched/act_dpxfer.c:202:33: warning: excess elements in struct initializer
net/sched/act_dpxfer.c:202:33: note: (near initialization for 'act_dpxfer_ops')
net/sched/act_dpxfer.c:203:10: error: 'struct tc_action_ops' has no member named 'get_fill_size'
203 | .get_fill_size = tcf_dpxfer_get_fill_size,
| ^~~~~~~~~~~~~
net/sched/act_dpxfer.c:203:33: error: 'tcf_dpxfer_get_fill_size' undeclared here (not in a function)
203 | .get_fill_size = tcf_dpxfer_get_fill_size,
| ^~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_dpxfer.c:203:33: warning: excess elements in struct initializer
net/sched/act_dpxfer.c:203:33: note: (near initialization for 'act_dpxfer_ops')
net/sched/act_dpxfer.c:204:10: error: 'struct tc_action_ops' has no member named 'size'
204 | .size = sizeof(struct tcf_dpxfer),
| ^~~~
net/sched/act_dpxfer.c:204:40: error: invalid application of 'sizeof' to incomplete type 'struct tcf_dpxfer'
204 | .size = sizeof(struct tcf_dpxfer),
| ^~~~~~
net/sched/act_dpxfer.c:204:33: warning: excess elements in struct initializer
204 | .size = sizeof(struct tcf_dpxfer),
| ^~~~~~
net/sched/act_dpxfer.c:204:33: note: (near initialization for 'act_dpxfer_ops')
net/sched/act_dpxfer.c:205:10: error: 'struct tc_action_ops' has no member named 'get_dev'
205 | .get_dev = tcf_dpxfer_get_dev,
| ^~~~~~~
net/sched/act_dpxfer.c:205:33: error: 'tcf_dpxfer_get_dev' undeclared here (not in a function); did you mean 'tcf_dpxfer_act'?
205 | .get_dev = tcf_dpxfer_get_dev,
| ^~~~~~~~~~~~~~~~~~
| tcf_dpxfer_act
net/sched/act_dpxfer.c:205:33: warning: excess elements in struct initializer
net/sched/act_dpxfer.c:205:33: note: (near initialization for 'act_dpxfer_ops')
net/sched/act_dpxfer.c:208:18: error: expected ';' before 'int'
208 | static __net_init int dpxfer_init_net(struct net *net)
| ^~~~
| ;
>> net/sched/act_dpxfer.c:208:46: warning: 'struct net' declared inside parameter list will not be visible outside of this definition or declaration
208 | static __net_init int dpxfer_init_net(struct net *net)
| ^~~
>> net/sched/act_dpxfer.c:208:23: warning: no previous prototype for 'dpxfer_init_net' [-Wmissing-prototypes]
208 | static __net_init int dpxfer_init_net(struct net *net)
| ^~~~~~~~~~~~~~~
net/sched/act_dpxfer.c: In function 'dpxfer_init_net':
net/sched/act_dpxfer.c:210:36: error: implicit declaration of function 'net_generic' [-Werror=implicit-function-declaration]
210 | struct tc_action_net *tn = net_generic(net, dpxfer_net_id);
| ^~~~~~~~~~~
>> net/sched/act_dpxfer.c:210:36: warning: initialization of 'struct tc_action_net *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
net/sched/act_dpxfer.c:212:16: error: implicit declaration of function 'tc_action_net_init' [-Werror=implicit-function-declaration]
212 | return tc_action_net_init(net, tn, &act_dpxfer_ops);
| ^~~~~~~~~~~~~~~~~~
net/sched/act_dpxfer.c: At top level:
net/sched/act_dpxfer.c:215:24: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'dpxfer_exit_net'
215 | static void __net_exit dpxfer_exit_net(struct list_head *net_list)
| ^~~~~~~~~~~~~~~
net/sched/act_dpxfer.c:220:15: error: variable 'dpxfer_net_ops' has initializer but incomplete type
220 | static struct pernet_operations dpxfer_net_ops = {
| ^~~~~~~~~~~~~~~~~
net/sched/act_dpxfer.c:221:10: error: 'struct pernet_operations' has no member named 'init'
221 | .init = dpxfer_init_net,
| ^~~~
net/sched/act_dpxfer.c:221:17: warning: excess elements in struct initializer
221 | .init = dpxfer_init_net,
| ^~~~~~~~~~~~~~~
net/sched/act_dpxfer.c:221:17: note: (near initialization for 'dpxfer_net_ops')
net/sched/act_dpxfer.c:222:10: error: 'struct pernet_operations' has no member named 'exit_batch'
222 | .exit_batch = dpxfer_exit_net,
| ^~~~~~~~~~
net/sched/act_dpxfer.c:222:23: error: 'dpxfer_exit_net' undeclared here (not in a function); did you mean 'dpxfer_init_net'?
222 | .exit_batch = dpxfer_exit_net,
| ^~~~~~~~~~~~~~~
| dpxfer_init_net
net/sched/act_dpxfer.c:222:23: warning: excess elements in struct initializer
net/sched/act_dpxfer.c:222:23: note: (near initialization for 'dpxfer_net_ops')
net/sched/act_dpxfer.c:223:10: error: 'struct pernet_operations' has no member named 'id'
223 | .id = &dpxfer_net_id,
| ^~
net/sched/act_dpxfer.c:223:17: warning: excess elements in struct initializer
223 | .id = &dpxfer_net_id,
| ^
net/sched/act_dpxfer.c:223:17: note: (near initialization for 'dpxfer_net_ops')
net/sched/act_dpxfer.c:224:10: error: 'struct pernet_operations' has no member named 'size'
224 | .size = sizeof(struct tc_action_net),
| ^~~~
net/sched/act_dpxfer.c:224:24: error: invalid application of 'sizeof' to incomplete type 'struct tc_action_net'
224 | .size = sizeof(struct tc_action_net),
| ^~~~~~
net/sched/act_dpxfer.c:224:17: warning: excess elements in struct initializer
224 | .size = sizeof(struct tc_action_net),
| ^~~~~~
net/sched/act_dpxfer.c:224:17: note: (near initialization for 'dpxfer_net_ops')
net/sched/act_dpxfer.c:227:20: error: expected declaration specifiers or '...' before string constant
227 | MODULE_DESCRIPTION("Datapath transfer actions");
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
net/sched/act_dpxfer.c:228:16: error: expected declaration specifiers or '...' before string constant
228 | MODULE_LICENSE("GPL");
| ^~~~~
net/sched/act_dpxfer.c:230:19: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'dpxfer_init_module'
230 | static int __init dpxfer_init_module(void)
| ^~~~~~~~~~~~~~~~~~
net/sched/act_dpxfer.c:235:20: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'dpxfer_cleanup_module'
235 | static void __exit dpxfer_cleanup_module(void)
| ^~~~~~~~~~~~~~~~~~~~~
>> net/sched/act_dpxfer.c:240:1: warning: data definition has no type or storage class
240 | module_init(dpxfer_init_module);
| ^~~~~~~~~~~
net/sched/act_dpxfer.c:240:1: error: type defaults to 'int' in declaration of 'module_init' [-Werror=implicit-int]
>> net/sched/act_dpxfer.c:240:1: warning: parameter names (without types) in function declaration
net/sched/act_dpxfer.c:241:1: warning: data definition has no type or storage class
241 | module_exit(dpxfer_cleanup_module);
| ^~~~~~~~~~~
net/sched/act_dpxfer.c:241:1: error: type defaults to 'int' in declaration of 'module_exit' [-Werror=implicit-int]
net/sched/act_dpxfer.c:241:1: warning: parameter names (without types) in function declaration
net/sched/act_dpxfer.c:193:29: error: storage size of 'act_dpxfer_ops' isn't known
193 | static struct tc_action_ops act_dpxfer_ops = {
| ^~~~~~~~~~~~~~
net/sched/act_dpxfer.c:220:33: error: storage size of 'dpxfer_net_ops' isn't known
220 | static struct pernet_operations dpxfer_net_ops = {
| ^~~~~~~~~~~~~~
net/sched/act_dpxfer.c:220:33: warning: 'dpxfer_net_ops' defined but not used [-Wunused-variable]
cc1: some warnings being treated as errors
vim +13 net/sched/act_dpxfer.c
11
> 12 static int tcf_dpxfer_act(struct sk_buff *skb, const struct tc_action *a,
> 13 struct tcf_result *res)
14 {
15 return TC_ACT_OK;
16 }
17
18 static int tcf_dpxfer_dump(struct sk_buff *skb, struct tc_action *a, int bind,
19 int ref)
20 {
> 21 unsigned char *b = skb_tail_pointer(skb);
> 22 struct tcf_dpxfer *s = to_dpxfer(a);
23 struct tc_dpxfer opt = {
> 24 .index = s->tcf_index,
25 .refcnt = refcount_read(&s->tcf_refcnt) - ref,
26 .bindcnt = atomic_read(&s->tcf_bindcnt) - bind,
27 };
28 struct tcf_t t;
29
30 spin_lock_bh(&s->tcf_lock);
31
32 opt.action = s->tcf_action;
33 if (nla_put(skb, TCA_DPXFER_PARMS, sizeof(opt), &opt))
34 goto nla_put_failure;
35
36 tcf_tm_dump(&t, &s->tcf_tm);
37 if (nla_put_64bit(skb, TCA_DPXFER_TM, sizeof(t), &t, TCA_DPXFER_PAD))
38 goto nla_put_failure;
39
40 spin_unlock_bh(&s->tcf_lock);
41
42 return skb->len;
43
44 nla_put_failure:
45 spin_unlock_bh(&s->tcf_lock);
46 nlmsg_trim(skb, b);
47 return -1;
48 }
49
50 static int tcf_dpxfer_init(struct net *net, struct nlattr *nla,
51 struct nlattr *est, struct tc_action **a, int ovr,
52 int bind, bool rtnl_held, struct tcf_proto *tp,
53 u32 flags, struct netlink_ext_ack *extack)
54 {
55 struct tc_action_net *tn = net_generic(net, gate_net_id);
56 enum tk_offsets tk_offset = TK_OFFS_TAI;
57 struct nlattr *tb[TCA_GATE_MAX + 1];
58 struct tcf_chain *goto_ch = NULL;
59 u64 cycletime = 0, basetime = 0;
60 struct tcf_gate_params *p;
61 s32 clockid = CLOCK_TAI;
62 struct tcf_gate *gact;
63 struct tc_gate *parm;
64 int ret = 0, err;
65 u32 gflags = 0;
66 s32 prio = -1;
67 ktime_t start;
68 bool exists;
69 u32 index;
70
71 if (!nla)
72 return -EINVAL;
73
74 err = nla_parse_nested(tb, TCA_DPXFER_MAX, nla, dpxfer_policy, extack);
75 if (err < 0)
76 return err;
77
78 if (!tb[TCA_DPXFER_PARMS])
79 return -EINVAL;
80
81 parm = nla_data(tb[TCA_GATE_PARMS]);
82 index = parm->index;
83
84 err = tcf_idr_check_alloc(tn, &index, a, bind);
85 if (err < 0)
86 return err;
87
88 exists = err;
89 if (exists && bind)
90 return 0;
91
92 if (!exists) {
93 ret = tcf_idr_create(tn, index, est, a,
94 &act_gate_ops, bind, false, 0);
95 if (ret) {
96 tcf_idr_cleanup(tn, index);
97 return ret;
98 }
99
100 ret = ACT_P_CREATED;
101 } else if (!ovr) {
102 tcf_idr_release(*a, bind);
103 return -EEXIST;
104 }
105
106 if (tb[TCA_GATE_PRIORITY])
107 prio = nla_get_s32(tb[TCA_GATE_PRIORITY]);
108
109 if (tb[TCA_GATE_BASE_TIME])
110 basetime = nla_get_u64(tb[TCA_GATE_BASE_TIME]);
111
112 if (tb[TCA_GATE_FLAGS])
113 gflags = nla_get_u32(tb[TCA_GATE_FLAGS]);
114
115 gact = to_gate(*a);
116 if (ret == ACT_P_CREATED)
117 INIT_LIST_HEAD(&gact->param.entries);
118
119 err = tcf_action_check_ctrlact(parm->action, tp, &goto_ch, extack);
120 if (err < 0)
121 goto release_idr;
122
123 spin_lock_bh(&gact->tcf_lock);
124 p = &gact->param;
125
126 if (tb[TCA_GATE_CYCLE_TIME])
127 cycletime = nla_get_u64(tb[TCA_GATE_CYCLE_TIME]);
128
129 if (tb[TCA_GATE_ENTRY_LIST]) {
130 err = parse_gate_list(tb[TCA_GATE_ENTRY_LIST], p, extack);
131 if (err < 0)
132 goto chain_put;
133 }
134
135 if (!cycletime) {
136 struct tcfg_gate_entry *entry;
137 ktime_t cycle = 0;
138
139 list_for_each_entry(entry, &p->entries, list)
140 cycle = ktime_add_ns(cycle, entry->interval);
141 cycletime = cycle;
142 if (!cycletime) {
143 err = -EINVAL;
144 goto chain_put;
145 }
146 }
147 p->tcfg_cycletime = cycletime;
148
149 if (tb[TCA_GATE_CYCLE_TIME_EXT])
150 p->tcfg_cycletime_ext =
151 nla_get_u64(tb[TCA_GATE_CYCLE_TIME_EXT]);
152
153 gate_setup_timer(gact, basetime, tk_offset, clockid,
154 ret == ACT_P_CREATED);
155 p->tcfg_priority = prio;
156 p->tcfg_flags = gflags;
157 gate_get_start_time(gact, &start);
158
159 gact->current_close_time = start;
160 gact->current_gate_status = GATE_ACT_GATE_OPEN | GATE_ACT_PENDING;
161
162 gact->next_entry = list_first_entry(&p->entries,
163 struct tcfg_gate_entry, list);
164
165 goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch);
166
167 gate_start_timer(gact, start);
168
169 spin_unlock_bh(&gact->tcf_lock);
170
171 if (goto_ch)
172 tcf_chain_put_by_act(goto_ch);
173
174 return ret;
175
176 chain_put:
177 spin_unlock_bh(&gact->tcf_lock);
178
179 if (goto_ch)
180 tcf_chain_put_by_act(goto_ch);
181 release_idr:
182 /* action is not inserted in any list: it's safe to init hitimer
183 * without taking tcf_lock.
184 */
185 if (ret == ACT_P_CREATED)
186 gate_setup_timer(gact, gact->param.tcfg_basetime,
187 gact->tk_offset, gact->param.tcfg_clockid,
188 true);
189 tcf_idr_release(*a, bind);
190 return err;
191 }
192
193 static struct tc_action_ops act_dpxfer_ops = {
194 .kind = "dpxfer",
195 .id = TCA_ID_DPXFER,
196 .owner = THIS_MODULE,
197 .act = tcf_dpxfer_act,
198 .stats_update = tcf_stats_update,
199 .dump = tcf_dpxfer_dump,
200 .init = tcf_dpxfer_init,
201 .walk = tcf_dpxfer_walker,
202 .lookup = tcf_dpxfer_search,
203 .get_fill_size = tcf_dpxfer_get_fill_size,
204 .size = sizeof(struct tcf_dpxfer),
205 .get_dev = tcf_dpxfer_get_dev,
206 };
207
> 208 static __net_init int dpxfer_init_net(struct net *net)
209 {
> 210 struct tc_action_net *tn = net_generic(net, dpxfer_net_id);
211
212 return tc_action_net_init(net, tn, &act_dpxfer_ops);
213 }
214
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (32956 bytes)
Powered by blists - more mailing lists