net: Change TCA_ACT_* to TCA_ID_* to match that of TCA_ID_POLICE
authorEli Cohen <eli@mellanox.com>
Sun, 10 Feb 2019 12:25:00 +0000 (14:25 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sun, 10 Feb 2019 17:28:43 +0000 (09:28 -0800)
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.

Signed-off-by: Eli Cohen <eli@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
27 files changed:
include/net/act_api.h
include/net/tc_act/tc_csum.h
include/net/tc_act/tc_gact.h
include/net/tc_act/tc_mirred.h
include/net/tc_act/tc_pedit.h
include/net/tc_act/tc_sample.h
include/net/tc_act/tc_skbedit.h
include/net/tc_act/tc_tunnel_key.h
include/net/tc_act/tc_vlan.h
include/uapi/linux/pkt_cls.h
net/sched/act_api.c
net/sched/act_bpf.c
net/sched/act_connmark.c
net/sched/act_csum.c
net/sched/act_gact.c
net/sched/act_ife.c
net/sched/act_ipt.c
net/sched/act_mirred.c
net/sched/act_nat.c
net/sched/act_pedit.c
net/sched/act_police.c
net/sched/act_sample.c
net/sched/act_simple.c
net/sched/act_skbedit.c
net/sched/act_skbmod.c
net/sched/act_tunnel_key.c
net/sched/act_vlan.c

index dbc795e..c745e9c 100644 (file)
@@ -80,7 +80,7 @@ static inline void tcf_tm_dump(struct tcf_t *dtm, const struct tcf_t *stm)
 struct tc_action_ops {
        struct list_head head;
        char    kind[IFNAMSIZ];
-       __u32   type; /* TBD to match kind */
+       enum tca_id  id; /* identifier should match kind */
        size_t  size;
        struct module           *owner;
        int     (*act)(struct sk_buff *, const struct tc_action *,
index 32d2454..68269e4 100644 (file)
@@ -21,7 +21,7 @@ struct tcf_csum {
 static inline bool is_tcf_csum(const struct tc_action *a)
 {
 #ifdef CONFIG_NET_CLS_ACT
-       if (a->ops && a->ops->type == TCA_ACT_CSUM)
+       if (a->ops && a->ops->id == TCA_ID_CSUM)
                return true;
 #endif
        return false;
index ef8dd0d..ee8d005 100644 (file)
@@ -22,7 +22,7 @@ static inline bool __is_tcf_gact_act(const struct tc_action *a, int act,
 #ifdef CONFIG_NET_CLS_ACT
        struct tcf_gact *gact;
 
-       if (a->ops && a->ops->type != TCA_ACT_GACT)
+       if (a->ops && a->ops->id != TCA_ID_GACT)
                return false;
 
        gact = to_gact(a);
index a2e9cbc..c757585 100644 (file)
@@ -17,7 +17,7 @@ struct tcf_mirred {
 static inline bool is_tcf_mirred_egress_redirect(const struct tc_action *a)
 {
 #ifdef CONFIG_NET_CLS_ACT
-       if (a->ops && a->ops->type == TCA_ACT_MIRRED)
+       if (a->ops && a->ops->id == TCA_ID_MIRRED)
                return to_mirred(a)->tcfm_eaction == TCA_EGRESS_REDIR;
 #endif
        return false;
@@ -26,7 +26,7 @@ static inline bool is_tcf_mirred_egress_redirect(const struct tc_action *a)
 static inline bool is_tcf_mirred_egress_mirror(const struct tc_action *a)
 {
 #ifdef CONFIG_NET_CLS_ACT
-       if (a->ops && a->ops->type == TCA_ACT_MIRRED)
+       if (a->ops && a->ops->id == TCA_ID_MIRRED)
                return to_mirred(a)->tcfm_eaction == TCA_EGRESS_MIRROR;
 #endif
        return false;
index fac3ad4..748cf87 100644 (file)
@@ -23,7 +23,7 @@ struct tcf_pedit {
 static inline bool is_tcf_pedit(const struct tc_action *a)
 {
 #ifdef CONFIG_NET_CLS_ACT
-       if (a->ops && a->ops->type == TCA_ACT_PEDIT)
+       if (a->ops && a->ops->id == TCA_ID_PEDIT)
                return true;
 #endif
        return false;
index 01dbfea..0a559d4 100644 (file)
@@ -20,7 +20,7 @@ struct tcf_sample {
 static inline bool is_tcf_sample(const struct tc_action *a)
 {
 #ifdef CONFIG_NET_CLS_ACT
-       return a->ops && a->ops->type == TCA_ACT_SAMPLE;
+       return a->ops && a->ops->id == TCA_ID_SAMPLE;
 #else
        return false;
 #endif
index 911bbac..85c5c47 100644 (file)
@@ -44,7 +44,7 @@ static inline bool is_tcf_skbedit_mark(const struct tc_action *a)
 #ifdef CONFIG_NET_CLS_ACT
        u32 flags;
 
-       if (a->ops && a->ops->type == TCA_ACT_SKBEDIT) {
+       if (a->ops && a->ops->id == TCA_ID_SKBEDIT) {
                rcu_read_lock();
                flags = rcu_dereference(to_skbedit(a)->params)->flags;
                rcu_read_unlock();
index 46b8c7f..23d5b8b 100644 (file)
@@ -34,7 +34,7 @@ static inline bool is_tcf_tunnel_set(const struct tc_action *a)
        struct tcf_tunnel_key *t = to_tunnel_key(a);
        struct tcf_tunnel_key_params *params = rtnl_dereference(t->params);
 
-       if (a->ops && a->ops->type == TCA_ACT_TUNNEL_KEY)
+       if (a->ops && a->ops->id == TCA_ID_TUNNEL_KEY)
                return params->tcft_action == TCA_TUNNEL_KEY_ACT_SET;
 #endif
        return false;
@@ -46,7 +46,7 @@ static inline bool is_tcf_tunnel_release(const struct tc_action *a)
        struct tcf_tunnel_key *t = to_tunnel_key(a);
        struct tcf_tunnel_key_params *params = rtnl_dereference(t->params);
 
-       if (a->ops && a->ops->type == TCA_ACT_TUNNEL_KEY)
+       if (a->ops && a->ops->id == TCA_ID_TUNNEL_KEY)
                return params->tcft_action == TCA_TUNNEL_KEY_ACT_RELEASE;
 #endif
        return false;
index 22ae260..fe39ed5 100644 (file)
@@ -30,7 +30,7 @@ struct tcf_vlan {
 static inline bool is_tcf_vlan(const struct tc_action *a)
 {
 #ifdef CONFIG_NET_CLS_ACT
-       if (a->ops && a->ops->type == TCA_ACT_VLAN)
+       if (a->ops && a->ops->id == TCA_ID_VLAN)
                return true;
 #endif
        return false;
index 7ab55f9..51a0496 100644 (file)
@@ -85,7 +85,7 @@ enum {
 #define TCA_ACT_SAMPLE 26
 
 /* Action type identifiers*/
-enum {
+enum tca_id {
        TCA_ID_UNSPEC = 0,
        TCA_ID_POLICE = 1,
        TCA_ID_GACT = TCA_ACT_GACT,
index d4b8355..aecf1bf 100644 (file)
@@ -543,7 +543,7 @@ int tcf_register_action(struct tc_action_ops *act,
 
        write_lock(&act_mod_lock);
        list_for_each_entry(a, &act_base, head) {
-               if (act->type == a->type || (strcmp(act->kind, a->kind) == 0)) {
+               if (act->id == a->id || (strcmp(act->kind, a->kind) == 0)) {
                        write_unlock(&act_mod_lock);
                        unregister_pernet_subsys(ops);
                        return -EEXIST;
index c763384..aa5c38d 100644 (file)
@@ -396,7 +396,7 @@ static int tcf_bpf_search(struct net *net, struct tc_action **a, u32 index)
 
 static struct tc_action_ops act_bpf_ops __read_mostly = {
        .kind           =       "bpf",
-       .type           =       TCA_ACT_BPF,
+       .id             =       TCA_ID_BPF,
        .owner          =       THIS_MODULE,
        .act            =       tcf_bpf_act,
        .dump           =       tcf_bpf_dump,
index 8475913..5d24993 100644 (file)
@@ -204,7 +204,7 @@ static int tcf_connmark_search(struct net *net, struct tc_action **a, u32 index)
 
 static struct tc_action_ops act_connmark_ops = {
        .kind           =       "connmark",
-       .type           =       TCA_ACT_CONNMARK,
+       .id             =       TCA_ID_CONNMARK,
        .owner          =       THIS_MODULE,
        .act            =       tcf_connmark_act,
        .dump           =       tcf_connmark_dump,
index 3dc25b7..945fb34 100644 (file)
@@ -660,7 +660,7 @@ static size_t tcf_csum_get_fill_size(const struct tc_action *act)
 
 static struct tc_action_ops act_csum_ops = {
        .kind           = "csum",
-       .type           = TCA_ACT_CSUM,
+       .id             = TCA_ID_CSUM,
        .owner          = THIS_MODULE,
        .act            = tcf_csum_act,
        .dump           = tcf_csum_dump,
index b61c20e..93da000 100644 (file)
@@ -253,7 +253,7 @@ static size_t tcf_gact_get_fill_size(const struct tc_action *act)
 
 static struct tc_action_ops act_gact_ops = {
        .kind           =       "gact",
-       .type           =       TCA_ACT_GACT,
+       .id             =       TCA_ID_GACT,
        .owner          =       THIS_MODULE,
        .act            =       tcf_gact_act,
        .stats_update   =       tcf_gact_stats_update,
index 30b63fa..9b1f2b3 100644 (file)
@@ -864,7 +864,7 @@ static int tcf_ife_search(struct net *net, struct tc_action **a, u32 index)
 
 static struct tc_action_ops act_ife_ops = {
        .kind = "ife",
-       .type = TCA_ACT_IFE,
+       .id = TCA_ID_IFE,
        .owner = THIS_MODULE,
        .act = tcf_ife_act,
        .dump = tcf_ife_dump,
index 8af6c11..1bad190 100644 (file)
@@ -338,7 +338,7 @@ static int tcf_ipt_search(struct net *net, struct tc_action **a, u32 index)
 
 static struct tc_action_ops act_ipt_ops = {
        .kind           =       "ipt",
-       .type           =       TCA_ACT_IPT,
+       .id             =       TCA_ID_IPT,
        .owner          =       THIS_MODULE,
        .act            =       tcf_ipt_act,
        .dump           =       tcf_ipt_dump,
@@ -387,7 +387,7 @@ static int tcf_xt_search(struct net *net, struct tc_action **a, u32 index)
 
 static struct tc_action_ops act_xt_ops = {
        .kind           =       "xt",
-       .type           =       TCA_ACT_XT,
+       .id             =       TCA_ID_XT,
        .owner          =       THIS_MODULE,
        .act            =       tcf_ipt_act,
        .dump           =       tcf_ipt_dump,
index c8cf4d1..6692fd0 100644 (file)
@@ -400,7 +400,7 @@ static void tcf_mirred_put_dev(struct net_device *dev)
 
 static struct tc_action_ops act_mirred_ops = {
        .kind           =       "mirred",
-       .type           =       TCA_ACT_MIRRED,
+       .id             =       TCA_ID_MIRRED,
        .owner          =       THIS_MODULE,
        .act            =       tcf_mirred_act,
        .stats_update   =       tcf_stats_update,
index c5c1e23..543eab9 100644 (file)
@@ -304,7 +304,7 @@ static int tcf_nat_search(struct net *net, struct tc_action **a, u32 index)
 
 static struct tc_action_ops act_nat_ops = {
        .kind           =       "nat",
-       .type           =       TCA_ACT_NAT,
+       .id             =       TCA_ID_NAT,
        .owner          =       THIS_MODULE,
        .act            =       tcf_nat_act,
        .dump           =       tcf_nat_dump,
index 3663d3b..a803738 100644 (file)
@@ -470,7 +470,7 @@ static int tcf_pedit_search(struct net *net, struct tc_action **a, u32 index)
 
 static struct tc_action_ops act_pedit_ops = {
        .kind           =       "pedit",
-       .type           =       TCA_ACT_PEDIT,
+       .id             =       TCA_ID_PEDIT,
        .owner          =       THIS_MODULE,
        .act            =       tcf_pedit_act,
        .dump           =       tcf_pedit_dump,
index ec8ec55..8271a62 100644 (file)
@@ -366,7 +366,7 @@ MODULE_LICENSE("GPL");
 
 static struct tc_action_ops act_police_ops = {
        .kind           =       "police",
-       .type           =       TCA_ID_POLICE,
+       .id             =       TCA_ID_POLICE,
        .owner          =       THIS_MODULE,
        .act            =       tcf_police_act,
        .dump           =       tcf_police_dump,
index 1a0c682..203e399 100644 (file)
@@ -233,7 +233,7 @@ static int tcf_sample_search(struct net *net, struct tc_action **a, u32 index)
 
 static struct tc_action_ops act_sample_ops = {
        .kind     = "sample",
-       .type     = TCA_ACT_SAMPLE,
+       .id       = TCA_ID_SAMPLE,
        .owner    = THIS_MODULE,
        .act      = tcf_sample_act,
        .dump     = tcf_sample_dump,
index b2b16d4..d54cb60 100644 (file)
@@ -195,7 +195,7 @@ static int tcf_simp_search(struct net *net, struct tc_action **a, u32 index)
 
 static struct tc_action_ops act_simp_ops = {
        .kind           =       "simple",
-       .type           =       TCA_ACT_SIMP,
+       .id             =       TCA_ID_SIMP,
        .owner          =       THIS_MODULE,
        .act            =       tcf_simp_act,
        .dump           =       tcf_simp_dump,
index 64dba37..39f8a67 100644 (file)
@@ -305,7 +305,7 @@ static int tcf_skbedit_search(struct net *net, struct tc_action **a, u32 index)
 
 static struct tc_action_ops act_skbedit_ops = {
        .kind           =       "skbedit",
-       .type           =       TCA_ACT_SKBEDIT,
+       .id             =       TCA_ID_SKBEDIT,
        .owner          =       THIS_MODULE,
        .act            =       tcf_skbedit_act,
        .dump           =       tcf_skbedit_dump,
index 59710a1..7bac1d7 100644 (file)
@@ -260,7 +260,7 @@ static int tcf_skbmod_search(struct net *net, struct tc_action **a, u32 index)
 
 static struct tc_action_ops act_skbmod_ops = {
        .kind           =       "skbmod",
-       .type           =       TCA_ACT_SKBMOD,
+       .id             =       TCA_ACT_SKBMOD,
        .owner          =       THIS_MODULE,
        .act            =       tcf_skbmod_act,
        .dump           =       tcf_skbmod_dump,
index 8b43fe0..9104b8e 100644 (file)
@@ -563,7 +563,7 @@ static int tunnel_key_search(struct net *net, struct tc_action **a, u32 index)
 
 static struct tc_action_ops act_tunnel_key_ops = {
        .kind           =       "tunnel_key",
-       .type           =       TCA_ACT_TUNNEL_KEY,
+       .id             =       TCA_ID_TUNNEL_KEY,
        .owner          =       THIS_MODULE,
        .act            =       tunnel_key_act,
        .dump           =       tunnel_key_dump,
index 93fdaf7..ac00615 100644 (file)
@@ -297,7 +297,7 @@ static int tcf_vlan_search(struct net *net, struct tc_action **a, u32 index)
 
 static struct tc_action_ops act_vlan_ops = {
        .kind           =       "vlan",
-       .type           =       TCA_ACT_VLAN,
+       .id             =       TCA_ID_VLAN,
        .owner          =       THIS_MODULE,
        .act            =       tcf_vlan_act,
        .dump           =       tcf_vlan_dump,