tree: https://github.com/jpirko/linux_mlxsw petrm_leftovers head: 99db5530c934193451b2a6d90792f37ac803ea93 commit: 82da66831b70737dfca05d0da5318181965b56c0 [31/33] dpxfer xxx config: i386-randconfig-s032-20211104 (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 reproduce: # apt-get install sparse # sparse version: v0.6.4-dirty # https://github.com/jpirko/linux_mlxsw/commit/82da66831b70737dfca05d0da5318181965b56c0 git remote add jpirko-mlxsw https://github.com/jpirko/linux_mlxsw git fetch --no-tags jpirko-mlxsw petrm_leftovers git checkout 82da66831b70737dfca05d0da5318181965b56c0 # save the attached .config to linux build tree make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 SHELL=/bin/bash net/sched/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All warnings (new ones prefixed by >>): >> net/sched/act_dpxfer.c:13:13: 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:9: error: 'TC_ACT_OK' undeclared (first use in this function) 15 | return TC_ACT_OK; | ^~~~~~~~~ net/sched/act_dpxfer.c:15:9: 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:21: 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:21: warning: initialization of 'unsigned char *' from 'int' makes pointer from integer without a cast [-Wint-conversion] net/sched/act_dpxfer.c:22:25: 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:25: warning: initialization of 'struct tcf_dpxfer *' from 'int' makes pointer from integer without a cast [-Wint-conversion] net/sched/act_dpxfer.c:23:9: error: variable 'opt' has initializer but incomplete type 23 | struct tc_dpxfer opt = { | ^~~~~~~~~ net/sched/act_dpxfer.c:24:4: error: 'struct tc_dpxfer' has no member named 'index' 24 | .index = s->tcf_index, | ^~~~~ net/sched/act_dpxfer.c:24:18: error: dereferencing pointer to incomplete type 'struct tcf_dpxfer' 24 | .index = s->tcf_index, | ^~ >> net/sched/act_dpxfer.c:24:17: warning: excess elements in struct initializer 24 | .index = s->tcf_index, | ^ net/sched/act_dpxfer.c:24:17: note: (near initialization for 'opt') net/sched/act_dpxfer.c:25:4: error: 'struct tc_dpxfer' has no member named 'refcnt' 25 | .refcnt = refcount_read(&s->tcf_refcnt) - ref, | ^~~~~~ net/sched/act_dpxfer.c:25:17: 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:17: warning: excess elements in struct initializer net/sched/act_dpxfer.c:25:17: note: (near initialization for 'opt') net/sched/act_dpxfer.c:26:4: error: 'struct tc_dpxfer' has no member named 'bindcnt' 26 | .bindcnt = atomic_read(&s->tcf_bindcnt) - bind, | ^~~~~~~ net/sched/act_dpxfer.c:26:17: 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:17: warning: excess elements in struct initializer net/sched/act_dpxfer.c:26:17: note: (near initialization for 'opt') net/sched/act_dpxfer.c:23:19: error: storage size of 'opt' isn't known 23 | struct tc_dpxfer opt = { | ^~~ net/sched/act_dpxfer.c:28:15: error: storage size of 't' isn't known 28 | struct tcf_t t; | ^ net/sched/act_dpxfer.c:30:2: error: implicit declaration of function 'spin_lock_bh' [-Werror=implicit-function-declaration] 30 | spin_lock_bh(&s->tcf_lock); | ^~~~~~~~~~~~ net/sched/act_dpxfer.c:33:6: 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:19: 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:2: 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:37:6: 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:25: 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:55: 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:2: error: implicit declaration of function 'spin_unlock_bh' [-Werror=implicit-function-declaration] 40 | spin_unlock_bh(&s->tcf_lock); | ^~~~~~~~~~~~~~ net/sched/act_dpxfer.c:42:12: error: dereferencing pointer to incomplete type 'struct sk_buff' 42 | return skb->len; | ^~ net/sched/act_dpxfer.c:46:2: error: implicit declaration of function 'nlmsg_trim' [-Werror=implicit-function-declaration] 46 | nlmsg_trim(skb, b); | ^~~~~~~~~~ net/sched/act_dpxfer.c:28:15: warning: unused variable 't' [-Wunused-variable] 28 | struct tcf_t t; | ^ net/sched/act_dpxfer.c:23:19: 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:17: error: unknown type name 'bool' 52 | int bind, bool rtnl_held, struct tcf_proto *tp, | ^~~~ net/sched/act_dpxfer.c:53:7: 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:3: error: 'struct tc_action_ops' has no member named 'kind' 194 | .kind = "dpxfer", | ^~~~ net/sched/act_dpxfer.c:194:11: warning: excess elements in struct initializer 194 | .kind = "dpxfer", | ^~~~~~~~ net/sched/act_dpxfer.c:194:11: note: (near initialization for 'act_dpxfer_ops') net/sched/act_dpxfer.c:195:3: error: 'struct tc_action_ops' has no member named 'id' 195 | .id = TCA_ID_DPXFER, | ^~ net/sched/act_dpxfer.c:195:9: error: 'TCA_ID_DPXFER' undeclared here (not in a function) 195 | .id = TCA_ID_DPXFER, | ^~~~~~~~~~~~~ net/sched/act_dpxfer.c:195:9: warning: excess elements in struct initializer net/sched/act_dpxfer.c:195:9: note: (near initialization for 'act_dpxfer_ops') net/sched/act_dpxfer.c:196:3: error: 'struct tc_action_ops' has no member named 'owner' 196 | .owner = THIS_MODULE, | ^~~~~ net/sched/act_dpxfer.c:196:12: 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:12: warning: excess elements in struct initializer net/sched/act_dpxfer.c:196:12: note: (near initialization for 'act_dpxfer_ops') net/sched/act_dpxfer.c:197:3: error: 'struct tc_action_ops' has no member named 'act' 197 | .act = tcf_dpxfer_act, | ^~~ net/sched/act_dpxfer.c:197:10: warning: excess elements in struct initializer 197 | .act = tcf_dpxfer_act, | ^~~~~~~~~~~~~~ net/sched/act_dpxfer.c:197:10: note: (near initialization for 'act_dpxfer_ops') net/sched/act_dpxfer.c:198:3: error: 'struct tc_action_ops' has no member named 'stats_update' 198 | .stats_update = tcf_stats_update, | ^~~~~~~~~~~~ net/sched/act_dpxfer.c:198:18: error: 'tcf_stats_update' undeclared here (not in a function) 198 | .stats_update = tcf_stats_update, | ^~~~~~~~~~~~~~~~ net/sched/act_dpxfer.c:198:18: warning: excess elements in struct initializer net/sched/act_dpxfer.c:198:18: note: (near initialization for 'act_dpxfer_ops') net/sched/act_dpxfer.c:199:3: error: 'struct tc_action_ops' has no member named 'dump' 199 | .dump = tcf_dpxfer_dump, | ^~~~ net/sched/act_dpxfer.c:199:11: warning: excess elements in struct initializer 199 | .dump = tcf_dpxfer_dump, | ^~~~~~~~~~~~~~~ net/sched/act_dpxfer.c:199:11: note: (near initialization for 'act_dpxfer_ops') net/sched/act_dpxfer.c:200:3: error: 'struct tc_action_ops' has no member named 'init' 200 | .init = tcf_dpxfer_init, | ^~~~ net/sched/act_dpxfer.c:200:11: 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:11: warning: excess elements in struct initializer net/sched/act_dpxfer.c:200:11: note: (near initialization for 'act_dpxfer_ops') net/sched/act_dpxfer.c:201:3: error: 'struct tc_action_ops' has no member named 'walk' 201 | .walk = tcf_dpxfer_walker, | ^~~~ net/sched/act_dpxfer.c:201:11: 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:11: warning: excess elements in struct initializer net/sched/act_dpxfer.c:201:11: note: (near initialization for 'act_dpxfer_ops') net/sched/act_dpxfer.c:202:3: error: 'struct tc_action_ops' has no member named 'lookup' 202 | .lookup = tcf_dpxfer_search, | ^~~~~~ net/sched/act_dpxfer.c:202:13: 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:13: warning: excess elements in struct initializer net/sched/act_dpxfer.c:202:13: note: (near initialization for 'act_dpxfer_ops') net/sched/act_dpxfer.c:203:3: 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:19: 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:19: warning: excess elements in struct initializer net/sched/act_dpxfer.c:203:19: note: (near initialization for 'act_dpxfer_ops') net/sched/act_dpxfer.c:204:3: error: 'struct tc_action_ops' has no member named 'size' 204 | .size = sizeof(struct tcf_dpxfer), | ^~~~ net/sched/act_dpxfer.c:204:18: error: invalid application of 'sizeof' to incomplete type 'struct tcf_dpxfer' 204 | .size = sizeof(struct tcf_dpxfer), | ^~~~~~ net/sched/act_dpxfer.c:204:11: warning: excess elements in struct initializer 204 | .size = sizeof(struct tcf_dpxfer), | ^~~~~~ net/sched/act_dpxfer.c:204:11: note: (near initialization for 'act_dpxfer_ops') net/sched/act_dpxfer.c:205:3: error: 'struct tc_action_ops' has no member named 'get_dev' 205 | .get_dev = tcf_dpxfer_get_dev, | ^~~~~~~ net/sched/act_dpxfer.c:205:13: 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:13: warning: excess elements in struct initializer net/sched/act_dpxfer.c:205:13: 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:29: 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:29: warning: initialization of 'struct tc_action_net *' from 'int' makes pointer from integer without a cast [-Wint-conversion] net/sched/act_dpxfer.c:212:9: 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:3: error: 'struct pernet_operations' has no member named 'init' 221 | .init = dpxfer_init_net, | ^~~~ net/sched/act_dpxfer.c:221:10: warning: excess elements in struct initializer 221 | .init = dpxfer_init_net, | ^~~~~~~~~~~~~~~ net/sched/act_dpxfer.c:221:10: note: (near initialization for 'dpxfer_net_ops') net/sched/act_dpxfer.c:222:3: error: 'struct pernet_operations' has no member named 'exit_batch' 222 | .exit_batch = dpxfer_exit_net, | ^~~~~~~~~~ net/sched/act_dpxfer.c:222:16: 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:16: warning: excess elements in struct initializer net/sched/act_dpxfer.c:222:16: note: (near initialization for 'dpxfer_net_ops') net/sched/act_dpxfer.c:223:3: error: 'struct pernet_operations' has no member named 'id' 223 | .id = &dpxfer_net_id, | ^~ net/sched/act_dpxfer.c:223:10: warning: excess elements in struct initializer 223 | .id = &dpxfer_net_id, | ^ net/sched/act_dpxfer.c:223:10: note: (near initialization for 'dpxfer_net_ops') net/sched/act_dpxfer.c:224:3: error: 'struct pernet_operations' has no member named 'size' 224 | .size = sizeof(struct tc_action_net), | ^~~~ net/sched/act_dpxfer.c:224:17: 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:10: warning: excess elements in struct initializer 224 | .size = sizeof(struct tc_action_net), | ^~~~~~ net/sched/act_dpxfer.c:224:10: 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