History

net: Change TCA_ACT_* to TCA_ID_* to match that of TCA_ID_POLICE

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.

Eli Cohen committed 7 years ago

Commit eddd2cf1 parent 257eede27 files · +30 −30Browse files

Unified · Split

27 files
  1. include/net/act_api.h +1 −1
  2. include/net/tc_act/tc_csum.h +1 −1
  3. include/net/tc_act/tc_gact.h +1 −1
  4. include/net/tc_act/tc_mirred.h +2 −2
  5. include/net/tc_act/tc_pedit.h +1 −1
  6. include/net/tc_act/tc_sample.h +1 −1
  7. include/net/tc_act/tc_skbedit.h +1 −1
  8. include/net/tc_act/tc_tunnel_key.h +2 −2
  9. include/net/tc_act/tc_vlan.h +1 −1
  10. include/uapi/linux/pkt_cls.h +1 −1
  11. net/sched/act_api.c +1 −1
  12. net/sched/act_bpf.c +1 −1
  13. net/sched/act_connmark.c +1 −1
  14. net/sched/act_csum.c +1 −1
  15. net/sched/act_gact.c +1 −1
  16. net/sched/act_ife.c +1 −1
  17. net/sched/act_ipt.c +2 −2
  18. net/sched/act_mirred.c +1 −1
  19. net/sched/act_nat.c +1 −1
  20. net/sched/act_pedit.c +1 −1
  21. net/sched/act_police.c +1 −1
  22. net/sched/act_sample.c +1 −1
  23. net/sched/act_simple.c +1 −1
  24. net/sched/act_skbedit.c +1 −1
  25. net/sched/act_skbmod.c +1 −1
  26. net/sched/act_tunnel_key.c +1 −1
  27. net/sched/act_vlan.c +1 −1
include/net/act_api.h+1−1
@@ -80,7 +80,7 @@ static inline void tcf_tm_dump(struct tcf_t *dtm, const struct tcf_t *stm) · 79 unmodified lines
8080 struct tc_action_ops {
8181 struct list_head head;
8282 char kind[IFNAMSIZ];
83− __u32 type; /* TBD to match kind */
83+ enum tca_id id; /* identifier should match kind */
8484 size_t size;
8585 struct module *owner;
8686 int (*act)(struct sk_buff *, const struct tc_action *,
include/net/tc_act/tc_csum.h+1−1
@@ -21,7 +21,7 @@ struct tcf_csum { · 20 unmodified lines
2121 static inline bool is_tcf_csum(const struct tc_action *a)
2222 {
2323 #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)
2525 return true;
2626 #endif
2727 return false;
include/net/tc_act/tc_gact.h+1−1
@@ -22,7 +22,7 @@ static inline bool __is_tcf_gact_act(const struct tc_action *a, int act, · 21 unmodified lines
2222 #ifdef CONFIG_NET_CLS_ACT
2323 struct tcf_gact *gact;
2424
25− if (a->ops && a->ops->type != TCA_ACT_GACT)
25+ if (a->ops && a->ops->id != TCA_ID_GACT)
2626 return false;
2727
2828 gact = to_gact(a);
include/net/tc_act/tc_mirred.h+2−2
@@ -17,7 +17,7 @@ struct tcf_mirred { · 16 unmodified lines
1717 static inline bool is_tcf_mirred_egress_redirect(const struct tc_action *a)
1818 {
1919 #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)
2121 return to_mirred(a)->tcfm_eaction == TCA_EGRESS_REDIR;
2222 #endif
2323 return false;
@@ -26,7 +26,7 @@ static inline bool is_tcf_mirred_egress_redirect(const struct tc_action *a) · 2 unmodified lines
2626 static inline bool is_tcf_mirred_egress_mirror(const struct tc_action *a)
2727 {
2828 #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)
3030 return to_mirred(a)->tcfm_eaction == TCA_EGRESS_MIRROR;
3131 #endif
3232 return false;
include/net/tc_act/tc_pedit.h+1−1
@@ -23,7 +23,7 @@ struct tcf_pedit { · 22 unmodified lines
2323 static inline bool is_tcf_pedit(const struct tc_action *a)
2424 {
2525 #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)
2727 return true;
2828 #endif
2929 return false;
include/net/tc_act/tc_sample.h+1−1
@@ -20,7 +20,7 @@ struct tcf_sample { · 19 unmodified lines
2020 static inline bool is_tcf_sample(const struct tc_action *a)
2121 {
2222 #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;
2424 #else
2525 return false;
2626 #endif
include/net/tc_act/tc_skbedit.h+1−1
@@ -44,7 +44,7 @@ static inline bool is_tcf_skbedit_mark(const struct tc_action *a) · 43 unmodified lines
4444 #ifdef CONFIG_NET_CLS_ACT
4545 u32 flags;
4646
47− if (a->ops && a->ops->type == TCA_ACT_SKBEDIT) {
47+ if (a->ops && a->ops->id == TCA_ID_SKBEDIT) {
4848 rcu_read_lock();
4949 flags = rcu_dereference(to_skbedit(a)->params)->flags;
5050 rcu_read_unlock();
include/net/tc_act/tc_tunnel_key.h+2−2
@@ -34,7 +34,7 @@ static inline bool is_tcf_tunnel_set(const struct tc_action *a) · 33 unmodified lines
3434 struct tcf_tunnel_key *t = to_tunnel_key(a);
3535 struct tcf_tunnel_key_params *params = rtnl_dereference(t->params);
3636
37− if (a->ops && a->ops->type == TCA_ACT_TUNNEL_KEY)
37+ if (a->ops && a->ops->id == TCA_ID_TUNNEL_KEY)
3838 return params->tcft_action == TCA_TUNNEL_KEY_ACT_SET;
3939 #endif
4040 return false;
@@ -46,7 +46,7 @@ static inline bool is_tcf_tunnel_release(const struct tc_action *a) · 5 unmodified lines
4646 struct tcf_tunnel_key *t = to_tunnel_key(a);
4747 struct tcf_tunnel_key_params *params = rtnl_dereference(t->params);
4848
49− if (a->ops && a->ops->type == TCA_ACT_TUNNEL_KEY)
49+ if (a->ops && a->ops->id == TCA_ID_TUNNEL_KEY)
5050 return params->tcft_action == TCA_TUNNEL_KEY_ACT_RELEASE;
5151 #endif
5252 return false;
include/net/tc_act/tc_vlan.h+1−1
@@ -30,7 +30,7 @@ struct tcf_vlan { · 29 unmodified lines
3030 static inline bool is_tcf_vlan(const struct tc_action *a)
3131 {
3232 #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)
3434 return true;
3535 #endif
3636 return false;
include/uapi/linux/pkt_cls.h+1−1
@@ -85,7 +85,7 @@ enum { · 84 unmodified lines
8585 #define TCA_ACT_SAMPLE 26
8686
8787 /* Action type identifiers*/
88−enum {
88+enum tca_id {
8989 TCA_ID_UNSPEC = 0,
9090 TCA_ID_POLICE = 1,
9191 TCA_ID_GACT = TCA_ACT_GACT,
net/sched/act_api.c+1−1
@@ -543,7 +543,7 @@ int tcf_register_action(struct tc_action_ops *act, · 542 unmodified lines
543543
544544 write_lock(&act_mod_lock);
545545 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)) {
547547 write_unlock(&act_mod_lock);
548548 unregister_pernet_subsys(ops);
549549 return -EEXIST;
net/sched/act_bpf.c+1−1
@@ -396,7 +396,7 @@ static int tcf_bpf_search(struct net *net, struct tc_action **a, u32 index) · 395 unmodified lines
396396
397397 static struct tc_action_ops act_bpf_ops __read_mostly = {
398398 .kind = "bpf",
399− .type = TCA_ACT_BPF,
399+ .id = TCA_ID_BPF,
400400 .owner = THIS_MODULE,
401401 .act = tcf_bpf_act,
402402 .dump = tcf_bpf_dump,
net/sched/act_connmark.c+1−1
@@ -204,7 +204,7 @@ static int tcf_connmark_search(struct net *net, struct tc_action **a, u32 index) · 203 unmodified lines
204204
205205 static struct tc_action_ops act_connmark_ops = {
206206 .kind = "connmark",
207− .type = TCA_ACT_CONNMARK,
207+ .id = TCA_ID_CONNMARK,
208208 .owner = THIS_MODULE,
209209 .act = tcf_connmark_act,
210210 .dump = tcf_connmark_dump,
net/sched/act_csum.c+1−1
@@ -660,7 +660,7 @@ static size_t tcf_csum_get_fill_size(const struct tc_action *act) · 659 unmodified lines
660660
661661 static struct tc_action_ops act_csum_ops = {
662662 .kind = "csum",
663− .type = TCA_ACT_CSUM,
663+ .id = TCA_ID_CSUM,
664664 .owner = THIS_MODULE,
665665 .act = tcf_csum_act,
666666 .dump = tcf_csum_dump,
net/sched/act_gact.c+1−1
@@ -253,7 +253,7 @@ static size_t tcf_gact_get_fill_size(const struct tc_action *act) · 252 unmodified lines
253253
254254 static struct tc_action_ops act_gact_ops = {
255255 .kind = "gact",
256− .type = TCA_ACT_GACT,
256+ .id = TCA_ID_GACT,
257257 .owner = THIS_MODULE,
258258 .act = tcf_gact_act,
259259 .stats_update = tcf_gact_stats_update,
net/sched/act_ife.c+1−1
@@ -864,7 +864,7 @@ static int tcf_ife_search(struct net *net, struct tc_action **a, u32 index) · 863 unmodified lines
864864
865865 static struct tc_action_ops act_ife_ops = {
866866 .kind = "ife",
867− .type = TCA_ACT_IFE,
867+ .id = TCA_ID_IFE,
868868 .owner = THIS_MODULE,
869869 .act = tcf_ife_act,
870870 .dump = tcf_ife_dump,
net/sched/act_ipt.c+2−2
@@ -338,7 +338,7 @@ static int tcf_ipt_search(struct net *net, struct tc_action **a, u32 index) · 337 unmodified lines
338338
339339 static struct tc_action_ops act_ipt_ops = {
340340 .kind = "ipt",
341− .type = TCA_ACT_IPT,
341+ .id = TCA_ID_IPT,
342342 .owner = THIS_MODULE,
343343 .act = tcf_ipt_act,
344344 .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
387387
388388 static struct tc_action_ops act_xt_ops = {
389389 .kind = "xt",
390− .type = TCA_ACT_XT,
390+ .id = TCA_ID_XT,
391391 .owner = THIS_MODULE,
392392 .act = tcf_ipt_act,
393393 .dump = tcf_ipt_dump,
net/sched/act_mirred.c+1−1
@@ -400,7 +400,7 @@ static void tcf_mirred_put_dev(struct net_device *dev) · 399 unmodified lines
400400
401401 static struct tc_action_ops act_mirred_ops = {
402402 .kind = "mirred",
403− .type = TCA_ACT_MIRRED,
403+ .id = TCA_ID_MIRRED,
404404 .owner = THIS_MODULE,
405405 .act = tcf_mirred_act,
406406 .stats_update = tcf_stats_update,
net/sched/act_nat.c+1−1
@@ -304,7 +304,7 @@ static int tcf_nat_search(struct net *net, struct tc_action **a, u32 index) · 303 unmodified lines
304304
305305 static struct tc_action_ops act_nat_ops = {
306306 .kind = "nat",
307− .type = TCA_ACT_NAT,
307+ .id = TCA_ID_NAT,
308308 .owner = THIS_MODULE,
309309 .act = tcf_nat_act,
310310 .dump = tcf_nat_dump,
net/sched/act_pedit.c+1−1
@@ -470,7 +470,7 @@ static int tcf_pedit_search(struct net *net, struct tc_action **a, u32 index) · 469 unmodified lines
470470
471471 static struct tc_action_ops act_pedit_ops = {
472472 .kind = "pedit",
473− .type = TCA_ACT_PEDIT,
473+ .id = TCA_ID_PEDIT,
474474 .owner = THIS_MODULE,
475475 .act = tcf_pedit_act,
476476 .dump = tcf_pedit_dump,
net/sched/act_police.c+1−1
@@ -366,7 +366,7 @@ MODULE_LICENSE("GPL"); · 365 unmodified lines
366366
367367 static struct tc_action_ops act_police_ops = {
368368 .kind = "police",
369− .type = TCA_ID_POLICE,
369+ .id = TCA_ID_POLICE,
370370 .owner = THIS_MODULE,
371371 .act = tcf_police_act,
372372 .dump = tcf_police_dump,
net/sched/act_sample.c+1−1
@@ -233,7 +233,7 @@ static int tcf_sample_search(struct net *net, struct tc_action **a, u32 index) · 232 unmodified lines
233233
234234 static struct tc_action_ops act_sample_ops = {
235235 .kind = "sample",
236− .type = TCA_ACT_SAMPLE,
236+ .id = TCA_ID_SAMPLE,
237237 .owner = THIS_MODULE,
238238 .act = tcf_sample_act,
239239 .dump = tcf_sample_dump,
net/sched/act_simple.c+1−1
@@ -195,7 +195,7 @@ static int tcf_simp_search(struct net *net, struct tc_action **a, u32 index) · 194 unmodified lines
195195
196196 static struct tc_action_ops act_simp_ops = {
197197 .kind = "simple",
198− .type = TCA_ACT_SIMP,
198+ .id = TCA_ID_SIMP,
199199 .owner = THIS_MODULE,
200200 .act = tcf_simp_act,
201201 .dump = tcf_simp_dump,
net/sched/act_skbedit.c+1−1
@@ -305,7 +305,7 @@ static int tcf_skbedit_search(struct net *net, struct tc_action **a, u32 index) · 304 unmodified lines
305305
306306 static struct tc_action_ops act_skbedit_ops = {
307307 .kind = "skbedit",
308− .type = TCA_ACT_SKBEDIT,
308+ .id = TCA_ID_SKBEDIT,
309309 .owner = THIS_MODULE,
310310 .act = tcf_skbedit_act,
311311 .dump = tcf_skbedit_dump,
net/sched/act_skbmod.c+1−1
@@ -260,7 +260,7 @@ static int tcf_skbmod_search(struct net *net, struct tc_action **a, u32 index) · 259 unmodified lines
260260
261261 static struct tc_action_ops act_skbmod_ops = {
262262 .kind = "skbmod",
263− .type = TCA_ACT_SKBMOD,
263+ .id = TCA_ACT_SKBMOD,
264264 .owner = THIS_MODULE,
265265 .act = tcf_skbmod_act,
266266 .dump = tcf_skbmod_dump,
net/sched/act_tunnel_key.c+1−1
@@ -563,7 +563,7 @@ static int tunnel_key_search(struct net *net, struct tc_action **a, u32 index) · 562 unmodified lines
563563
564564 static struct tc_action_ops act_tunnel_key_ops = {
565565 .kind = "tunnel_key",
566− .type = TCA_ACT_TUNNEL_KEY,
566+ .id = TCA_ID_TUNNEL_KEY,
567567 .owner = THIS_MODULE,
568568 .act = tunnel_key_act,
569569 .dump = tunnel_key_dump,
net/sched/act_vlan.c+1−1
@@ -297,7 +297,7 @@ static int tcf_vlan_search(struct net *net, struct tc_action **a, u32 index) · 296 unmodified lines
297297
298298 static struct tc_action_ops act_vlan_ops = {
299299 .kind = "vlan",
300− .type = TCA_ACT_VLAN,
300+ .id = TCA_ID_VLAN,
301301 .owner = THIS_MODULE,
302302 .act = tcf_vlan_act,
303303 .dump = tcf_vlan_dump,