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 | 80 | struct tc_action_ops { |
| 81 | 81 | struct list_head head; |
| 82 | 82 | char kind[IFNAMSIZ]; |
| 83 | − __u32 type; /* TBD to match kind */ | |
| 83 | + enum tca_id id; /* identifier should match kind */ | |
| 84 | 84 | size_t size; |
| 85 | 85 | struct module *owner; |
| 86 | 86 | int (*act)(struct sk_buff *, const struct tc_action *, |
| @@ -21,7 +21,7 @@ struct tcf_csum { · 20 unmodified lines | ||
| 21 | 21 | static inline bool is_tcf_csum(const struct tc_action *a) |
| 22 | 22 | { |
| 23 | 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 | 25 | return true; |
| 26 | 26 | #endif |
| 27 | 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 | 22 | #ifdef CONFIG_NET_CLS_ACT |
| 23 | 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 | 26 | return false; |
| 27 | 27 | |
| 28 | 28 | gact = to_gact(a); |
| @@ -17,7 +17,7 @@ struct tcf_mirred { · 16 unmodified lines | ||
| 17 | 17 | static inline bool is_tcf_mirred_egress_redirect(const struct tc_action *a) |
| 18 | 18 | { |
| 19 | 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 | 21 | return to_mirred(a)->tcfm_eaction == TCA_EGRESS_REDIR; |
| 22 | 22 | #endif |
| 23 | 23 | return false; |
| @@ -26,7 +26,7 @@ static inline bool is_tcf_mirred_egress_redirect(const struct tc_action *a) · 2 unmodified lines | ||
| 26 | 26 | static inline bool is_tcf_mirred_egress_mirror(const struct tc_action *a) |
| 27 | 27 | { |
| 28 | 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 | 30 | return to_mirred(a)->tcfm_eaction == TCA_EGRESS_MIRROR; |
| 31 | 31 | #endif |
| 32 | 32 | return false; |
| @@ -23,7 +23,7 @@ struct tcf_pedit { · 22 unmodified lines | ||
| 23 | 23 | static inline bool is_tcf_pedit(const struct tc_action *a) |
| 24 | 24 | { |
| 25 | 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 | 27 | return true; |
| 28 | 28 | #endif |
| 29 | 29 | return false; |
| @@ -20,7 +20,7 @@ struct tcf_sample { · 19 unmodified lines | ||
| 20 | 20 | static inline bool is_tcf_sample(const struct tc_action *a) |
| 21 | 21 | { |
| 22 | 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 | 24 | #else |
| 25 | 25 | return false; |
| 26 | 26 | #endif |
| @@ -44,7 +44,7 @@ static inline bool is_tcf_skbedit_mark(const struct tc_action *a) · 43 unmodified lines | ||
| 44 | 44 | #ifdef CONFIG_NET_CLS_ACT |
| 45 | 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 | 48 | rcu_read_lock(); |
| 49 | 49 | flags = rcu_dereference(to_skbedit(a)->params)->flags; |
| 50 | 50 | rcu_read_unlock(); |
| @@ -34,7 +34,7 @@ static inline bool is_tcf_tunnel_set(const struct tc_action *a) · 33 unmodified lines | ||
| 34 | 34 | struct tcf_tunnel_key *t = to_tunnel_key(a); |
| 35 | 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 | 38 | return params->tcft_action == TCA_TUNNEL_KEY_ACT_SET; |
| 39 | 39 | #endif |
| 40 | 40 | return false; |
| @@ -46,7 +46,7 @@ static inline bool is_tcf_tunnel_release(const struct tc_action *a) · 5 unmodified lines | ||
| 46 | 46 | struct tcf_tunnel_key *t = to_tunnel_key(a); |
| 47 | 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 | 50 | return params->tcft_action == TCA_TUNNEL_KEY_ACT_RELEASE; |
| 51 | 51 | #endif |
| 52 | 52 | return false; |
| @@ -30,7 +30,7 @@ struct tcf_vlan { · 29 unmodified lines | ||
| 30 | 30 | static inline bool is_tcf_vlan(const struct tc_action *a) |
| 31 | 31 | { |
| 32 | 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 | 34 | return true; |
| 35 | 35 | #endif |
| 36 | 36 | return false; |
| @@ -85,7 +85,7 @@ enum { · 84 unmodified lines | ||
| 85 | 85 | #define TCA_ACT_SAMPLE 26 |
| 86 | 86 | |
| 87 | 87 | /* Action type identifiers*/ |
| 88 | −enum { | |
| 88 | +enum tca_id { | |
| 89 | 89 | TCA_ID_UNSPEC = 0, |
| 90 | 90 | TCA_ID_POLICE = 1, |
| 91 | 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 | 544 | write_lock(&act_mod_lock); |
| 545 | 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 | 547 | write_unlock(&act_mod_lock); |
| 548 | 548 | unregister_pernet_subsys(ops); |
| 549 | 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 | 397 | static struct tc_action_ops act_bpf_ops __read_mostly = { |
| 398 | 398 | .kind = "bpf", |
| 399 | − .type = TCA_ACT_BPF, | |
| 399 | + .id = TCA_ID_BPF, | |
| 400 | 400 | .owner = THIS_MODULE, |
| 401 | 401 | .act = tcf_bpf_act, |
| 402 | 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 | 205 | static struct tc_action_ops act_connmark_ops = { |
| 206 | 206 | .kind = "connmark", |
| 207 | − .type = TCA_ACT_CONNMARK, | |
| 207 | + .id = TCA_ID_CONNMARK, | |
| 208 | 208 | .owner = THIS_MODULE, |
| 209 | 209 | .act = tcf_connmark_act, |
| 210 | 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 | 661 | static struct tc_action_ops act_csum_ops = { |
| 662 | 662 | .kind = "csum", |
| 663 | − .type = TCA_ACT_CSUM, | |
| 663 | + .id = TCA_ID_CSUM, | |
| 664 | 664 | .owner = THIS_MODULE, |
| 665 | 665 | .act = tcf_csum_act, |
| 666 | 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 | 254 | static struct tc_action_ops act_gact_ops = { |
| 255 | 255 | .kind = "gact", |
| 256 | − .type = TCA_ACT_GACT, | |
| 256 | + .id = TCA_ID_GACT, | |
| 257 | 257 | .owner = THIS_MODULE, |
| 258 | 258 | .act = tcf_gact_act, |
| 259 | 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 | 865 | static struct tc_action_ops act_ife_ops = { |
| 866 | 866 | .kind = "ife", |
| 867 | − .type = TCA_ACT_IFE, | |
| 867 | + .id = TCA_ID_IFE, | |
| 868 | 868 | .owner = THIS_MODULE, |
| 869 | 869 | .act = tcf_ife_act, |
| 870 | 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 | 339 | static struct tc_action_ops act_ipt_ops = { |
| 340 | 340 | .kind = "ipt", |
| 341 | − .type = TCA_ACT_IPT, | |
| 341 | + .id = TCA_ID_IPT, | |
| 342 | 342 | .owner = THIS_MODULE, |
| 343 | 343 | .act = tcf_ipt_act, |
| 344 | 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 | 388 | static struct tc_action_ops act_xt_ops = { |
| 389 | 389 | .kind = "xt", |
| 390 | − .type = TCA_ACT_XT, | |
| 390 | + .id = TCA_ID_XT, | |
| 391 | 391 | .owner = THIS_MODULE, |
| 392 | 392 | .act = tcf_ipt_act, |
| 393 | 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 | 401 | static struct tc_action_ops act_mirred_ops = { |
| 402 | 402 | .kind = "mirred", |
| 403 | − .type = TCA_ACT_MIRRED, | |
| 403 | + .id = TCA_ID_MIRRED, | |
| 404 | 404 | .owner = THIS_MODULE, |
| 405 | 405 | .act = tcf_mirred_act, |
| 406 | 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 | 305 | static struct tc_action_ops act_nat_ops = { |
| 306 | 306 | .kind = "nat", |
| 307 | − .type = TCA_ACT_NAT, | |
| 307 | + .id = TCA_ID_NAT, | |
| 308 | 308 | .owner = THIS_MODULE, |
| 309 | 309 | .act = tcf_nat_act, |
| 310 | 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 | 471 | static struct tc_action_ops act_pedit_ops = { |
| 472 | 472 | .kind = "pedit", |
| 473 | − .type = TCA_ACT_PEDIT, | |
| 473 | + .id = TCA_ID_PEDIT, | |
| 474 | 474 | .owner = THIS_MODULE, |
| 475 | 475 | .act = tcf_pedit_act, |
| 476 | 476 | .dump = tcf_pedit_dump, |
| @@ -366,7 +366,7 @@ MODULE_LICENSE("GPL"); · 365 unmodified lines | ||
| 366 | 366 | |
| 367 | 367 | static struct tc_action_ops act_police_ops = { |
| 368 | 368 | .kind = "police", |
| 369 | − .type = TCA_ID_POLICE, | |
| 369 | + .id = TCA_ID_POLICE, | |
| 370 | 370 | .owner = THIS_MODULE, |
| 371 | 371 | .act = tcf_police_act, |
| 372 | 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 | 234 | static struct tc_action_ops act_sample_ops = { |
| 235 | 235 | .kind = "sample", |
| 236 | − .type = TCA_ACT_SAMPLE, | |
| 236 | + .id = TCA_ID_SAMPLE, | |
| 237 | 237 | .owner = THIS_MODULE, |
| 238 | 238 | .act = tcf_sample_act, |
| 239 | 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 | 196 | static struct tc_action_ops act_simp_ops = { |
| 197 | 197 | .kind = "simple", |
| 198 | − .type = TCA_ACT_SIMP, | |
| 198 | + .id = TCA_ID_SIMP, | |
| 199 | 199 | .owner = THIS_MODULE, |
| 200 | 200 | .act = tcf_simp_act, |
| 201 | 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 | 306 | static struct tc_action_ops act_skbedit_ops = { |
| 307 | 307 | .kind = "skbedit", |
| 308 | − .type = TCA_ACT_SKBEDIT, | |
| 308 | + .id = TCA_ID_SKBEDIT, | |
| 309 | 309 | .owner = THIS_MODULE, |
| 310 | 310 | .act = tcf_skbedit_act, |
| 311 | 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 | 261 | static struct tc_action_ops act_skbmod_ops = { |
| 262 | 262 | .kind = "skbmod", |
| 263 | − .type = TCA_ACT_SKBMOD, | |
| 263 | + .id = TCA_ACT_SKBMOD, | |
| 264 | 264 | .owner = THIS_MODULE, |
| 265 | 265 | .act = tcf_skbmod_act, |
| 266 | 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 | 564 | static struct tc_action_ops act_tunnel_key_ops = { |
| 565 | 565 | .kind = "tunnel_key", |
| 566 | − .type = TCA_ACT_TUNNEL_KEY, | |
| 566 | + .id = TCA_ID_TUNNEL_KEY, | |
| 567 | 567 | .owner = THIS_MODULE, |
| 568 | 568 | .act = tunnel_key_act, |
| 569 | 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 | 298 | static struct tc_action_ops act_vlan_ops = { |
| 299 | 299 | .kind = "vlan", |
| 300 | − .type = TCA_ACT_VLAN, | |
| 300 | + .id = TCA_ID_VLAN, | |
| 301 | 301 | .owner = THIS_MODULE, |
| 302 | 302 | .act = tcf_vlan_act, |
| 303 | 303 | .dump = tcf_vlan_dump, |