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 dbc795ec659e599febd0d64c994fb2cca6d0989c..c745e9ccfab2d6f86a58c1a038e416fe29a63d67 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 32d2454c04793021c0dc87bca7f1802b49c5249b..68269e4581b766f850734cc1d7ff275622da6b88 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 ef8dd0db70ceca2b4d41b707833faaf6044c9061..ee8d005f56fcddb0e3dc5d68b10a5dd1efdeb8f7 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 a2e9cbca5c9edbb770af873f6d885602e1ccf86a..c757585a05b08cf258901b7a4b8e2599c05aec09 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 fac3ad4a86de96ed1acb1b2747f043471b5f4fd3..748cf87a4d7ea5c92b4fd48dd3302b8ad64944fe 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 01dbfea3267277ad5efacef4b59b4a1c615de66b..0a559d4b6f0f019a872e2afad578fc3cd3d02b1b 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 911bbac838a271b5d3690fc890338f19201c521b..85c5c4756d92283553ba3935f96441e8a8e8b40b 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 46b8c7f1c8d5273791df55eeb6345807d8812e96..23d5b8b19f3e7e6d0ca0e8a0d76d9b832754118f 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 22ae260d686951f4005c1e9c903c244a92da31b0..fe39ed502bef2fff338afe56f5b27e55584569c4 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 7ab55f97e7c4f5d11456125314f900be86d1c96c..51a0496f78eacc66a927a5f836dd1e70d2990fad 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 d4b8355737d8f80b5304aa7aa6d73949a7b52c11..aecf1bf233c8362673812b5ab212f32e5f868a5b 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 c7633843e223a591b2306c8ebaca7bffdcb19804..aa5c38d11a3079644d36329c8b4637e0bdfaa5c6 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 8475913f2070c777ecf35f21c338960beba481aa..5d24993cccfebead613c7dd15bb41a1087c8024e 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 3dc25b7806d7ec92f88452241fc53872857bcac2..945fb34ae721de0dae301f4ad7998571651b01d7 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 b61c20ebb314ac8301f66758c6de0d97e38c7a9a..93da0004e9f415e9eb8439eeacdc0ae73f5783fd 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 30b63fa23ee28f33622c25d36aa75e27e05db5bb..9b1f2b3990eedeeca44ba6ad5c7e334043727dd1 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 8af6c11d2482ac53e6520691c85ff291a4704a81..1bad190710add1b89e5be597acb94e355f9b64bd 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 c8cf4d10c4355f934c02d407ec725670e36433b8..6692fd0546177347a70123a959156d1120eace90 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 c5c1e23add77c09f9496ca8e68e7b188a80c6f12..543eab9193f17ca94756bff060fee937078a1e21 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 3663d3b615a418bc43dfb5948561d11f66495248..a80373878df769d180a6c34a9c6fdda4e846efd8 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 ec8ec55e0fe879a35ff17f6cc6542f5efa451886..8271a6263824bf53aaa92f97a35916d6d31aa244 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 1a0c682fd734357d83e1aa9df1326b2e8698f49d..203e399e5c85a293b29d52a84f31bff929827cf4 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 b2b16d440154273422c66520b2d96a07026dac49..d54cb608dbafae7ea9a333bd6a117824f2a1caac 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 64dba3708fce2e096872061bd4405344a957be4b..39f8a67ea94019c32dd03b3f7ea9d0f33aa99788 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 59710a183bd3238e2471ced2a7143d079a07df74..7bac1d78e7a39994ccb9bea33fd3aa0fd7030a7e 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 8b43fe0130f73039e3f1802701df910e079fc4ba..9104b8e364826bae2cc4ce0f09b3f53d1364a838 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 93fdaf707313fdbb78ce8c13993edd2455880919..ac0061599225b6871d846dce30dd83ae37abff25 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,