Modify the kernel users of the TCA_ACT_* macros to use TCA_ID_*. For example, use TCA_ID_GACT instead of TCA_ACT_GACT. This will align with TCA_ID_POLICE and also differentiates these identifier, used in struct tc_action_ops type field, from other macros starting with TCA_ACT_. To make things clearer, we name the enum defining the TCA_ID_* identifiers and also change the "type" field of struct tc_action to id.
Unified · Split
| @@ -80,7 +80,7 @@ static inline void tcf_tm_dump(struct tcf_t *dtm, const struct tcf_t *stm) · 79 unmodified lines | |||
| 80 | struct tc_action_ops { | 80 | struct tc_action_ops { |
| 81 | struct list_head head; | 81 | struct list_head head; |
| 82 | char kind[IFNAMSIZ]; | 82 | char kind[IFNAMSIZ]; |
| 83 | __u32 type; /* TBD to match kind */ | 83 | enum tca_id id; /* identifier should match kind */ |
| 84 | size_t size; | 84 | size_t size; |
| 85 | struct module *owner; | 85 | struct module *owner; |
| 86 | int (*act)(struct sk_buff *, const struct tc_action *, | 86 | int (*act)(struct sk_buff *, const struct tc_action *, |
| @@ -21,7 +21,7 @@ struct tcf_csum { · 20 unmodified lines | |||
| 21 | static inline bool is_tcf_csum(const struct tc_action *a) | 21 | static inline bool is_tcf_csum(const struct tc_action *a) |
| 22 | { | 22 | { |
| 23 | #ifdef CONFIG_NET_CLS_ACT | 23 | #ifdef CONFIG_NET_CLS_ACT |
| 24 | if (a->ops && a->ops->type == TCA_ACT_CSUM) | 24 | if (a->ops && a->ops->id == TCA_ID_CSUM) |
| 25 | return true; | 25 | return true; |
| 26 | #endif | 26 | #endif |
| 27 | return false; | 27 | return false; |
| @@ -22,7 +22,7 @@ static inline bool __is_tcf_gact_act(const struct tc_action *a, int act, · 21 unmodified lines | |||
| 22 | #ifdef CONFIG_NET_CLS_ACT | 22 | #ifdef CONFIG_NET_CLS_ACT |
| 23 | struct tcf_gact *gact; | 23 | struct tcf_gact *gact; |
| 24 | 24 | ||
| 25 | if (a->ops && a->ops->type != TCA_ACT_GACT) | 25 | if (a->ops && a->ops->id != TCA_ID_GACT) |
| 26 | return false; | 26 | return false; |
| 27 | 27 | ||
| 28 | gact = to_gact(a); | 28 | gact = to_gact(a); |
| @@ -17,7 +17,7 @@ struct tcf_mirred { · 16 unmodified lines | |||
| 17 | static inline bool is_tcf_mirred_egress_redirect(const struct tc_action *a) | 17 | static inline bool is_tcf_mirred_egress_redirect(const struct tc_action *a) |
| 18 | { | 18 | { |
| 19 | #ifdef CONFIG_NET_CLS_ACT | 19 | #ifdef CONFIG_NET_CLS_ACT |
| 20 | if (a->ops && a->ops->type == TCA_ACT_MIRRED) | 20 | if (a->ops && a->ops->id == TCA_ID_MIRRED) |
| 21 | return to_mirred(a)->tcfm_eaction == TCA_EGRESS_REDIR; | 21 | return to_mirred(a)->tcfm_eaction == TCA_EGRESS_REDIR; |
| 22 | #endif | 22 | #endif |
| 23 | return false; | 23 | return false; |
| @@ -26,7 +26,7 @@ static inline bool is_tcf_mirred_egress_redirect(const struct tc_action *a) · 2 unmodified lines | |||
| 26 | static inline bool is_tcf_mirred_egress_mirror(const struct tc_action *a) | 26 | static inline bool is_tcf_mirred_egress_mirror(const struct tc_action *a) |
| 27 | { | 27 | { |
| 28 | #ifdef CONFIG_NET_CLS_ACT | 28 | #ifdef CONFIG_NET_CLS_ACT |
| 29 | if (a->ops && a->ops->type == TCA_ACT_MIRRED) | 29 | if (a->ops && a->ops->id == TCA_ID_MIRRED) |
| 30 | return to_mirred(a)->tcfm_eaction == TCA_EGRESS_MIRROR; | 30 | return to_mirred(a)->tcfm_eaction == TCA_EGRESS_MIRROR; |
| 31 | #endif | 31 | #endif |
| 32 | return false; | 32 | return false; |
| @@ -23,7 +23,7 @@ struct tcf_pedit { · 22 unmodified lines | |||
| 23 | static inline bool is_tcf_pedit(const struct tc_action *a) | 23 | static inline bool is_tcf_pedit(const struct tc_action *a) |
| 24 | { | 24 | { |
| 25 | #ifdef CONFIG_NET_CLS_ACT | 25 | #ifdef CONFIG_NET_CLS_ACT |
| 26 | if (a->ops && a->ops->type == TCA_ACT_PEDIT) | 26 | if (a->ops && a->ops->id == TCA_ID_PEDIT) |
| 27 | return true; | 27 | return true; |
| 28 | #endif | 28 | #endif |
| 29 | return false; | 29 | return false; |
| @@ -20,7 +20,7 @@ struct tcf_sample { · 19 unmodified lines | |||
| 20 | static inline bool is_tcf_sample(const struct tc_action *a) | 20 | static inline bool is_tcf_sample(const struct tc_action *a) |
| 21 | { | 21 | { |
| 22 | #ifdef CONFIG_NET_CLS_ACT | 22 | #ifdef CONFIG_NET_CLS_ACT |
| 23 | return a->ops && a->ops->type == TCA_ACT_SAMPLE; | 23 | return a->ops && a->ops->id == TCA_ID_SAMPLE; |
| 24 | #else | 24 | #else |
| 25 | return false; | 25 | return false; |
| 26 | #endif | 26 | #endif |
| @@ -44,7 +44,7 @@ static inline bool is_tcf_skbedit_mark(const struct tc_action *a) · 43 unmodified lines | |||
| 44 | #ifdef CONFIG_NET_CLS_ACT | 44 | #ifdef CONFIG_NET_CLS_ACT |
| 45 | u32 flags; | 45 | u32 flags; |
| 46 | 46 | ||
| 47 | if (a->ops && a->ops->type == TCA_ACT_SKBEDIT) { | 47 | if (a->ops && a->ops->id == TCA_ID_SKBEDIT) { |
| 48 | rcu_read_lock(); | 48 | rcu_read_lock(); |
| 49 | flags = rcu_dereference(to_skbedit(a)->params)->flags; | 49 | flags = rcu_dereference(to_skbedit(a)->params)->flags; |
| 50 | rcu_read_unlock(); | 50 | rcu_read_unlock(); |
| @@ -34,7 +34,7 @@ static inline bool is_tcf_tunnel_set(const struct tc_action *a) · 33 unmodified lines | |||
| 34 | struct tcf_tunnel_key *t = to_tunnel_key(a); | 34 | struct tcf_tunnel_key *t = to_tunnel_key(a); |
| 35 | struct tcf_tunnel_key_params *params = rtnl_dereference(t->params); | 35 | struct tcf_tunnel_key_params *params = rtnl_dereference(t->params); |
| 36 | 36 | ||
| 37 | if (a->ops && a->ops->type == TCA_ACT_TUNNEL_KEY) | 37 | if (a->ops && a->ops->id == TCA_ID_TUNNEL_KEY) |
| 38 | return params->tcft_action == TCA_TUNNEL_KEY_ACT_SET; | 38 | return params->tcft_action == TCA_TUNNEL_KEY_ACT_SET; |
| 39 | #endif | 39 | #endif |
| 40 | return false; | 40 | return false; |
| @@ -46,7 +46,7 @@ static inline bool is_tcf_tunnel_release(const struct tc_action *a) · 5 unmodified lines | |||
| 46 | struct tcf_tunnel_key *t = to_tunnel_key(a); | 46 | struct tcf_tunnel_key *t = to_tunnel_key(a); |
| 47 | struct tcf_tunnel_key_params *params = rtnl_dereference(t->params); | 47 | struct tcf_tunnel_key_params *params = rtnl_dereference(t->params); |
| 48 | 48 | ||
| 49 | if (a->ops && a->ops->type == TCA_ACT_TUNNEL_KEY) | 49 | if (a->ops && a->ops->id == TCA_ID_TUNNEL_KEY) |
| 50 | return params->tcft_action == TCA_TUNNEL_KEY_ACT_RELEASE; | 50 | return params->tcft_action == TCA_TUNNEL_KEY_ACT_RELEASE; |
| 51 | #endif | 51 | #endif |
| 52 | return false; | 52 | return false; |
| @@ -30,7 +30,7 @@ struct tcf_vlan { · 29 unmodified lines | |||
| 30 | static inline bool is_tcf_vlan(const struct tc_action *a) | 30 | static inline bool is_tcf_vlan(const struct tc_action *a) |
| 31 | { | 31 | { |
| 32 | #ifdef CONFIG_NET_CLS_ACT | 32 | #ifdef CONFIG_NET_CLS_ACT |
| 33 | if (a->ops && a->ops->type == TCA_ACT_VLAN) | 33 | if (a->ops && a->ops->id == TCA_ID_VLAN) |
| 34 | return true; | 34 | return true; |
| 35 | #endif | 35 | #endif |
| 36 | return false; | 36 | return false; |
| @@ -85,7 +85,7 @@ enum { · 84 unmodified lines | |||
| 85 | #define TCA_ACT_SAMPLE 26 | 85 | #define TCA_ACT_SAMPLE 26 |
| 86 | 86 | ||
| 87 | /* Action type identifiers*/ | 87 | /* Action type identifiers*/ |
| 88 | enum { | 88 | enum tca_id { |
| 89 | TCA_ID_UNSPEC = 0, | 89 | TCA_ID_UNSPEC = 0, |
| 90 | TCA_ID_POLICE = 1, | 90 | TCA_ID_POLICE = 1, |
| 91 | TCA_ID_GACT = TCA_ACT_GACT, | 91 | TCA_ID_GACT = TCA_ACT_GACT, |
| @@ -543,7 +543,7 @@ int tcf_register_action(struct tc_action_ops *act, · 542 unmodified lines | |||
| 543 | 543 | ||
| 544 | write_lock(&act_mod_lock); | 544 | write_lock(&act_mod_lock); |
| 545 | list_for_each_entry(a, &act_base, head) { | 545 | list_for_each_entry(a, &act_base, head) { |
| 546 | if (act->type == a->type || (strcmp(act->kind, a->kind) == 0)) { | 546 | if (act->id == a->id || (strcmp(act->kind, a->kind) == 0)) { |
| 547 | write_unlock(&act_mod_lock); | 547 | write_unlock(&act_mod_lock); |
| 548 | unregister_pernet_subsys(ops); | 548 | unregister_pernet_subsys(ops); |
| 549 | return -EEXIST; | 549 | return -EEXIST; |
| @@ -396,7 +396,7 @@ static int tcf_bpf_search(struct net *net, struct tc_action **a, u32 index) · 395 unmodified lines | |||
| 396 | 396 | ||
| 397 | static struct tc_action_ops act_bpf_ops __read_mostly = { | 397 | static struct tc_action_ops act_bpf_ops __read_mostly = { |
| 398 | .kind = "bpf", | 398 | .kind = "bpf", |
| 399 | .type = TCA_ACT_BPF, | 399 | .id = TCA_ID_BPF, |
| 400 | .owner = THIS_MODULE, | 400 | .owner = THIS_MODULE, |
| 401 | .act = tcf_bpf_act, | 401 | .act = tcf_bpf_act, |
| 402 | .dump = tcf_bpf_dump, | 402 | .dump = tcf_bpf_dump, |
| @@ -204,7 +204,7 @@ static int tcf_connmark_search(struct net *net, struct tc_action **a, u32 index) · 203 unmodified lines | |||
| 204 | 204 | ||
| 205 | static struct tc_action_ops act_connmark_ops = { | 205 | static struct tc_action_ops act_connmark_ops = { |
| 206 | .kind = "connmark", | 206 | .kind = "connmark", |
| 207 | .type = TCA_ACT_CONNMARK, | 207 | .id = TCA_ID_CONNMARK, |
| 208 | .owner = THIS_MODULE, | 208 | .owner = THIS_MODULE, |
| 209 | .act = tcf_connmark_act, | 209 | .act = tcf_connmark_act, |
| 210 | .dump = tcf_connmark_dump, | 210 | .dump = tcf_connmark_dump, |
| @@ -660,7 +660,7 @@ static size_t tcf_csum_get_fill_size(const struct tc_action *act) · 659 unmodified lines | |||
| 660 | 660 | ||
| 661 | static struct tc_action_ops act_csum_ops = { | 661 | static struct tc_action_ops act_csum_ops = { |
| 662 | .kind = "csum", | 662 | .kind = "csum", |
| 663 | .type = TCA_ACT_CSUM, | 663 | .id = TCA_ID_CSUM, |
| 664 | .owner = THIS_MODULE, | 664 | .owner = THIS_MODULE, |
| 665 | .act = tcf_csum_act, | 665 | .act = tcf_csum_act, |
| 666 | .dump = tcf_csum_dump, | 666 | .dump = tcf_csum_dump, |
| @@ -253,7 +253,7 @@ static size_t tcf_gact_get_fill_size(const struct tc_action *act) · 252 unmodified lines | |||
| 253 | 253 | ||
| 254 | static struct tc_action_ops act_gact_ops = { | 254 | static struct tc_action_ops act_gact_ops = { |
| 255 | .kind = "gact", | 255 | .kind = "gact", |
| 256 | .type = TCA_ACT_GACT, | 256 | .id = TCA_ID_GACT, |
| 257 | .owner = THIS_MODULE, | 257 | .owner = THIS_MODULE, |
| 258 | .act = tcf_gact_act, | 258 | .act = tcf_gact_act, |
| 259 | .stats_update = tcf_gact_stats_update, | 259 | .stats_update = tcf_gact_stats_update, |
| @@ -864,7 +864,7 @@ static int tcf_ife_search(struct net *net, struct tc_action **a, u32 index) · 863 unmodified lines | |||
| 864 | 864 | ||
| 865 | static struct tc_action_ops act_ife_ops = { | 865 | static struct tc_action_ops act_ife_ops = { |
| 866 | .kind = "ife", | 866 | .kind = "ife", |
| 867 | .type = TCA_ACT_IFE, | 867 | .id = TCA_ID_IFE, |
| 868 | .owner = THIS_MODULE, | 868 | .owner = THIS_MODULE, |
| 869 | .act = tcf_ife_act, | 869 | .act = tcf_ife_act, |
| 870 | .dump = tcf_ife_dump, | 870 | .dump = tcf_ife_dump, |
| @@ -338,7 +338,7 @@ static int tcf_ipt_search(struct net *net, struct tc_action **a, u32 index) · 337 unmodified lines | |||
| 338 | 338 | ||
| 339 | static struct tc_action_ops act_ipt_ops = { | 339 | static struct tc_action_ops act_ipt_ops = { |
| 340 | .kind = "ipt", | 340 | .kind = "ipt", |
| 341 | .type = TCA_ACT_IPT, | 341 | .id = TCA_ID_IPT, |
| 342 | .owner = THIS_MODULE, | 342 | .owner = THIS_MODULE, |
| 343 | .act = tcf_ipt_act, | 343 | .act = tcf_ipt_act, |
| 344 | .dump = tcf_ipt_dump, | 344 | .dump = tcf_ipt_dump, |
| @@ -387,7 +387,7 @@ static int tcf_xt_search(struct net *net, struct tc_action **a, u32 index) · 42 unmodified lines | |||
| 387 | 387 | ||
| 388 | static struct tc_action_ops act_xt_ops = { | 388 | static struct tc_action_ops act_xt_ops = { |
| 389 | .kind = "xt", | 389 | .kind = "xt", |
| 390 | .type = TCA_ACT_XT, | 390 | .id = TCA_ID_XT, |
| 391 | .owner = THIS_MODULE, | 391 | .owner = THIS_MODULE, |
| 392 | .act = tcf_ipt_act, | 392 | .act = tcf_ipt_act, |
| 393 | .dump = tcf_ipt_dump, | 393 | .dump = tcf_ipt_dump, |
| @@ -400,7 +400,7 @@ static void tcf_mirred_put_dev(struct net_device *dev) · 399 unmodified lines | |||
| 400 | 400 | ||
| 401 | static struct tc_action_ops act_mirred_ops = { | 401 | static struct tc_action_ops act_mirred_ops = { |
| 402 | .kind = "mirred", | 402 | .kind = "mirred", |
| 403 | .type = TCA_ACT_MIRRED, | 403 | .id = TCA_ID_MIRRED, |
| 404 | .owner = THIS_MODULE, | 404 | .owner = THIS_MODULE, |
| 405 | .act = tcf_mirred_act, | 405 | .act = tcf_mirred_act, |
| 406 | .stats_update = tcf_stats_update, | 406 | .stats_update = tcf_stats_update, |
| @@ -304,7 +304,7 @@ static int tcf_nat_search(struct net *net, struct tc_action **a, u32 index) · 303 unmodified lines | |||
| 304 | 304 | ||
| 305 | static struct tc_action_ops act_nat_ops = { | 305 | static struct tc_action_ops act_nat_ops = { |
| 306 | .kind = "nat", | 306 | .kind = "nat", |
| 307 | .type = TCA_ACT_NAT, | 307 | .id = TCA_ID_NAT, |
| 308 | .owner = THIS_MODULE, | 308 | .owner = THIS_MODULE, |
| 309 | .act = tcf_nat_act, | 309 | .act = tcf_nat_act, |
| 310 | .dump = tcf_nat_dump, | 310 | .dump = tcf_nat_dump, |
| @@ -470,7 +470,7 @@ static int tcf_pedit_search(struct net *net, struct tc_action **a, u32 index) · 469 unmodified lines | |||
| 470 | 470 | ||
| 471 | static struct tc_action_ops act_pedit_ops = { | 471 | static struct tc_action_ops act_pedit_ops = { |
| 472 | .kind = "pedit", | 472 | .kind = "pedit", |
| 473 | .type = TCA_ACT_PEDIT, | 473 | .id = TCA_ID_PEDIT, |
| 474 | .owner = THIS_MODULE, | 474 | .owner = THIS_MODULE, |
| 475 | .act = tcf_pedit_act, | 475 | .act = tcf_pedit_act, |
| 476 | .dump = tcf_pedit_dump, | 476 | .dump = tcf_pedit_dump, |
| @@ -366,7 +366,7 @@ MODULE_LICENSE("GPL"); · 365 unmodified lines | |||
| 366 | 366 | ||
| 367 | static struct tc_action_ops act_police_ops = { | 367 | static struct tc_action_ops act_police_ops = { |
| 368 | .kind = "police", | 368 | .kind = "police", |
| 369 | .type = TCA_ID_POLICE, | 369 | .id = TCA_ID_POLICE, |
| 370 | .owner = THIS_MODULE, | 370 | .owner = THIS_MODULE, |
| 371 | .act = tcf_police_act, | 371 | .act = tcf_police_act, |
| 372 | .dump = tcf_police_dump, | 372 | .dump = tcf_police_dump, |
| @@ -233,7 +233,7 @@ static int tcf_sample_search(struct net *net, struct tc_action **a, u32 index) · 232 unmodified lines | |||
| 233 | 233 | ||
| 234 | static struct tc_action_ops act_sample_ops = { | 234 | static struct tc_action_ops act_sample_ops = { |
| 235 | .kind = "sample", | 235 | .kind = "sample", |
| 236 | .type = TCA_ACT_SAMPLE, | 236 | .id = TCA_ID_SAMPLE, |
| 237 | .owner = THIS_MODULE, | 237 | .owner = THIS_MODULE, |
| 238 | .act = tcf_sample_act, | 238 | .act = tcf_sample_act, |
| 239 | .dump = tcf_sample_dump, | 239 | .dump = tcf_sample_dump, |
| @@ -195,7 +195,7 @@ static int tcf_simp_search(struct net *net, struct tc_action **a, u32 index) · 194 unmodified lines | |||
| 195 | 195 | ||
| 196 | static struct tc_action_ops act_simp_ops = { | 196 | static struct tc_action_ops act_simp_ops = { |
| 197 | .kind = "simple", | 197 | .kind = "simple", |
| 198 | .type = TCA_ACT_SIMP, | 198 | .id = TCA_ID_SIMP, |
| 199 | .owner = THIS_MODULE, | 199 | .owner = THIS_MODULE, |
| 200 | .act = tcf_simp_act, | 200 | .act = tcf_simp_act, |
| 201 | .dump = tcf_simp_dump, | 201 | .dump = tcf_simp_dump, |
| @@ -305,7 +305,7 @@ static int tcf_skbedit_search(struct net *net, struct tc_action **a, u32 index) · 304 unmodified lines | |||
| 305 | 305 | ||
| 306 | static struct tc_action_ops act_skbedit_ops = { | 306 | static struct tc_action_ops act_skbedit_ops = { |
| 307 | .kind = "skbedit", | 307 | .kind = "skbedit", |
| 308 | .type = TCA_ACT_SKBEDIT, | 308 | .id = TCA_ID_SKBEDIT, |
| 309 | .owner = THIS_MODULE, | 309 | .owner = THIS_MODULE, |
| 310 | .act = tcf_skbedit_act, | 310 | .act = tcf_skbedit_act, |
| 311 | .dump = tcf_skbedit_dump, | 311 | .dump = tcf_skbedit_dump, |
| @@ -260,7 +260,7 @@ static int tcf_skbmod_search(struct net *net, struct tc_action **a, u32 index) · 259 unmodified lines | |||
| 260 | 260 | ||
| 261 | static struct tc_action_ops act_skbmod_ops = { | 261 | static struct tc_action_ops act_skbmod_ops = { |
| 262 | .kind = "skbmod", | 262 | .kind = "skbmod", |
| 263 | .type = TCA_ACT_SKBMOD, | 263 | .id = TCA_ACT_SKBMOD, |
| 264 | .owner = THIS_MODULE, | 264 | .owner = THIS_MODULE, |
| 265 | .act = tcf_skbmod_act, | 265 | .act = tcf_skbmod_act, |
| 266 | .dump = tcf_skbmod_dump, | 266 | .dump = tcf_skbmod_dump, |
| @@ -563,7 +563,7 @@ static int tunnel_key_search(struct net *net, struct tc_action **a, u32 index) · 562 unmodified lines | |||
| 563 | 563 | ||
| 564 | static struct tc_action_ops act_tunnel_key_ops = { | 564 | static struct tc_action_ops act_tunnel_key_ops = { |
| 565 | .kind = "tunnel_key", | 565 | .kind = "tunnel_key", |
| 566 | .type = TCA_ACT_TUNNEL_KEY, | 566 | .id = TCA_ID_TUNNEL_KEY, |
| 567 | .owner = THIS_MODULE, | 567 | .owner = THIS_MODULE, |
| 568 | .act = tunnel_key_act, | 568 | .act = tunnel_key_act, |
| 569 | .dump = tunnel_key_dump, | 569 | .dump = tunnel_key_dump, |
| @@ -297,7 +297,7 @@ static int tcf_vlan_search(struct net *net, struct tc_action **a, u32 index) · 296 unmodified lines | |||
| 297 | 297 | ||
| 298 | static struct tc_action_ops act_vlan_ops = { | 298 | static struct tc_action_ops act_vlan_ops = { |
| 299 | .kind = "vlan", | 299 | .kind = "vlan", |
| 300 | .type = TCA_ACT_VLAN, | 300 | .id = TCA_ID_VLAN, |
| 301 | .owner = THIS_MODULE, | 301 | .owner = THIS_MODULE, |
| 302 | .act = tcf_vlan_act, | 302 | .act = tcf_vlan_act, |
| 303 | .dump = tcf_vlan_dump, | 303 | .dump = tcf_vlan_dump, |