Change tc action identifiers to be more consistent
Subsystems (5)
cover Change tc action identifiers to be more consistent
This two patch series modifies TC actions identifiers to be more consistent and also puts them in one place so new identifiers numbers can be chosen more easily.
Eli Cohen (2):
net: Move all TC actions identifiers to one place
net: Change TCA_ACT_* to TCA_ID_* to match that of TCA_ID_POLICE
include/net/act_api.h | 2 +- include/net/tc_act/tc_csum.h | 2 +- include/net/tc_act/tc_gact.h | 2 +- include/net/tc_act/tc_mirred.h | 4 +-- include/net/tc_act/tc_pedit.h | 2 +- include/net/tc_act/tc_sample.h | 2 +- include/net/tc_act/tc_skbedit.h | 2 +- include/net/tc_act/tc_tunnel_key.h | 4 +-- include/net/tc_act/tc_vlan.h | 2 +- include/uapi/linux/pkt_cls.h | 45 ++++++++++++++++++++++++++++--- include/uapi/linux/tc_act/tc_bpf.h | 2 -- include/uapi/linux/tc_act/tc_connmark.h | 2 -- include/uapi/linux/tc_act/tc_csum.h | 2 -- include/uapi/linux/tc_act/tc_gact.h | 1 - include/uapi/linux/tc_act/tc_ife.h | 1 - include/uapi/linux/tc_act/tc_ipt.h | 3 --- include/uapi/linux/tc_act/tc_mirred.h | 1 - include/uapi/linux/tc_act/tc_nat.h | 2 -- include/uapi/linux/tc_act/tc_pedit.h | 2 -- include/uapi/linux/tc_act/tc_sample.h | 2 -- include/uapi/linux/tc_act/tc_skbedit.h | 2 -- include/uapi/linux/tc_act/tc_skbmod.h | 2 -- include/uapi/linux/tc_act/tc_tunnel_key.h | 2 -- include/uapi/linux/tc_act/tc_vlan.h | 2 -- net/sched/act_api.c | 2 +- net/sched/act_bpf.c | 2 +- net/sched/act_connmark.c | 2 +- net/sched/act_csum.c | 2 +- net/sched/act_gact.c | 2 +- net/sched/act_ife.c | 2 +- net/sched/act_ipt.c | 4 +-- net/sched/act_mirred.c | 2 +- net/sched/act_nat.c | 2 +- net/sched/act_pedit.c | 2 +- net/sched/act_police.c | 2 +- net/sched/act_sample.c | 2 +- net/sched/act_simple.c | 4 +-- net/sched/act_skbedit.c | 2 +- net/sched/act_skbmod.c | 2 +- net/sched/act_tunnel_key.c | 2 +- net/sched/act_vlan.c | 2 +- tools/include/uapi/linux/tc_act/tc_bpf.h | 2 -- 42 files changed, 70 insertions(+), 63 deletions(-)
Signature · 1 line
1.8.3.1
PATCH 1/2 net: Move all TC actions identifiers to one place
Move all the TC identifiers to one place, to the same enum that defines the identifier of police action. This makes it easier choose numbers for new actions since they are now defined in one place. We preserve the original values for binary compatibility. New IDs should be added inside the enum.
--- include/uapi/linux/pkt_cls.h | 43 ++++++++++++++++++++++++++++--- include/uapi/linux/tc_act/tc_bpf.h | 2 -- include/uapi/linux/tc_act/tc_connmark.h | 2 -- include/uapi/linux/tc_act/tc_csum.h | 2 -- include/uapi/linux/tc_act/tc_gact.h | 1 - include/uapi/linux/tc_act/tc_ife.h | 1 - include/uapi/linux/tc_act/tc_ipt.h | 3 --- include/uapi/linux/tc_act/tc_mirred.h | 1 - include/uapi/linux/tc_act/tc_nat.h | 2 -- include/uapi/linux/tc_act/tc_pedit.h | 2 -- include/uapi/linux/tc_act/tc_sample.h | 2 -- include/uapi/linux/tc_act/tc_skbedit.h | 2 -- include/uapi/linux/tc_act/tc_skbmod.h | 2 -- include/uapi/linux/tc_act/tc_tunnel_key.h | 2 -- include/uapi/linux/tc_act/tc_vlan.h | 2 -- tools/include/uapi/linux/tc_act/tc_bpf.h | 2 -- 16 files changed, 40 insertions(+), 31 deletions(-)
include/uapi/linux/pkt_cls.h +40 -3
@@ -63,12 +63,49 @@ enum {#define TC_ACT_GOTO_CHAIN __TC_ACT_EXT(2)#define TC_ACT_EXT_OPCODE_MAX TC_ACT_GOTO_CHAIN +/* These macros are put here for binary compatibility with userspace apps that +* make use of them. For kernel code and new userspace apps, use the TCA_ID_* +* versions. +*/ +#define TCA_ACT_GACT 5 +#define TCA_ACT_IPT 6 +#define TCA_ACT_PEDIT 7 +#define TCA_ACT_MIRRED 8 +#define TCA_ACT_NAT 9 +#define TCA_ACT_XT 10 +#define TCA_ACT_SKBEDIT 11 +#define TCA_ACT_VLAN 12 +#define TCA_ACT_BPF 13 +#define TCA_ACT_CONNMARK 14 +#define TCA_ACT_SKBMOD 15 +#define TCA_ACT_CSUM 16 +#define TCA_ACT_TUNNEL_KEY 17 +#define TCA_ACT_SIMP 22 +#define TCA_ACT_IFE 25 +#define TCA_ACT_SAMPLE 26 +/* Action type identifiers*/ enum { -TCA_ID_UNSPEC =0 , -TCA_ID_POLICE =1 , +TCA_ID_UNSPEC =0 , +TCA_ID_POLICE =1 , +TCA_ID_GACT =TCA_ACT_GACT , +TCA_ID_IPT =TCA_ACT_IPT , +TCA_ID_PEDIT =TCA_ACT_PEDIT , +TCA_ID_MIRRED =TCA_ACT_MIRRED , +TCA_ID_NAT =TCA_ACT_NAT , +TCA_ID_XT =TCA_ACT_XT , +TCA_ID_SKBEDIT =TCA_ACT_SKBEDIT , +TCA_ID_VLAN =TCA_ACT_VLAN , +TCA_ID_BPF =TCA_ACT_BPF , +TCA_ID_CONNMARK =TCA_ACT_CONNMARK , +TCA_ID_SKBMOD =TCA_ACT_SKBMOD , +TCA_ID_CSUM =TCA_ACT_CSUM , +TCA_ID_TUNNEL_KEY =TCA_ACT_TUNNEL_KEY , +TCA_ID_SIMP =TCA_ACT_SIMP , +TCA_ID_IFE =TCA_ACT_IFE , +TCA_ID_SAMPLE =TCA_ACT_SAMPLE ,/* other actions go here */ - __TCA_ID_MAX=255 + __TCA_ID_MAX =255 };#define TCA_ID_MAX __TCA_ID_MAX
include/uapi/linux/tc_act/tc_bpf.h +0 -2
@@ -13,8 +13,6 @@#include <linux/pkt_cls.h> -#define TCA_ACT_BPF 13 -struct tc_act_bpf {tc_gen ; };
include/uapi/linux/tc_act/tc_connmark.h +0 -2
@@ -5,8 +5,6 @@#include <linux/types.h> #include <linux/pkt_cls.h> -#define TCA_ACT_CONNMARK 14 -struct tc_connmark {tc_gen ;__u16 zone;
include/uapi/linux/tc_act/tc_csum.h +0 -2
@@ -5,8 +5,6 @@#include <linux/types.h> #include <linux/pkt_cls.h> -#define TCA_ACT_CSUM 16 -enum {TCA_CSUM_UNSPEC ,TCA_CSUM_PARMS ,
include/uapi/linux/tc_act/tc_gact.h +0 -1
@@ -5,7 +5,6 @@#include <linux/types.h> #include <linux/pkt_cls.h> -#define TCA_ACT_GACT 5struct tc_gact {tc_gen ;
include/uapi/linux/tc_act/tc_ife.h +0 -1
@@ -6,7 +6,6 @@#include <linux/pkt_cls.h> #include <linux/ife.h> -#define TCA_ACT_IFE 25/* Flag bits for now just encoding/decoding; mutually exclusive */ #define IFE_ENCODE 1#define IFE_DECODE 0
include/uapi/linux/tc_act/tc_ipt.h +0 -3
@@ -4,9 +4,6 @@#include <linux/pkt_cls.h> -#define TCA_ACT_IPT 6 -#define TCA_ACT_XT 10 -enum {TCA_IPT_UNSPEC ,TCA_IPT_TABLE ,
include/uapi/linux/tc_act/tc_mirred.h +0 -1
@@ -5,7 +5,6 @@#include <linux/types.h> #include <linux/pkt_cls.h> -#define TCA_ACT_MIRRED 8#define TCA_EGRESS_REDIR 1/* packet redirect to EGRESS*/ #define TCA_EGRESS_MIRROR 2/* mirror packet to EGRESS */ #define TCA_INGRESS_REDIR 3/* packet redirect to INGRESS*/
include/uapi/linux/tc_act/tc_nat.h +0 -2
@@ -5,8 +5,6 @@#include <linux/pkt_cls.h> #include <linux/types.h> -#define TCA_ACT_NAT 9 -enum {TCA_NAT_UNSPEC ,TCA_NAT_PARMS ,
include/uapi/linux/tc_act/tc_pedit.h +0 -2
@@ -5,8 +5,6 @@#include <linux/types.h> #include <linux/pkt_cls.h> -#define TCA_ACT_PEDIT 7 -enum {TCA_PEDIT_UNSPEC ,TCA_PEDIT_TM ,
include/uapi/linux/tc_act/tc_sample.h +0 -2
@@ -6,8 +6,6 @@#include <linux/pkt_cls.h> #include <linux/if_ether.h> -#define TCA_ACT_SAMPLE 26 -struct tc_sample {tc_gen ; };
include/uapi/linux/tc_act/tc_skbedit.h +0 -2
@@ -23,8 +23,6 @@#include <linux/pkt_cls.h> -#define TCA_ACT_SKBEDIT 11 -#define SKBEDIT_F_PRIORITY 0x1#define SKBEDIT_F_QUEUE_MAPPING 0x2#define SKBEDIT_F_MARK 0x4
include/uapi/linux/tc_act/tc_skbmod.h +0 -2
@@ -13,8 +13,6 @@#include <linux/pkt_cls.h> -#define TCA_ACT_SKBMOD 15 -#define SKBMOD_F_DMAC 0x1#define SKBMOD_F_SMAC 0x2#define SKBMOD_F_ETYPE 0x4
include/uapi/linux/tc_act/tc_tunnel_key.h +0 -2
@@ -14,8 +14,6 @@#include <linux/pkt_cls.h> -#define TCA_ACT_TUNNEL_KEY 17 -#define TCA_TUNNEL_KEY_ACT_SET 1#define TCA_TUNNEL_KEY_ACT_RELEASE 2
include/uapi/linux/tc_act/tc_vlan.h +0 -2
@@ -13,8 +13,6 @@#include <linux/pkt_cls.h> -#define TCA_ACT_VLAN 12 -#define TCA_VLAN_ACT_POP 1#define TCA_VLAN_ACT_PUSH 2#define TCA_VLAN_ACT_MODIFY 3
tools/include/uapi/linux/tc_act/tc_bpf.h +0 -2
@@ -13,8 +13,6 @@#include <linux/pkt_cls.h> -#define TCA_ACT_BPF 13 -struct tc_act_bpf {tc_gen ; };
Signature · 1 line
1.8.3.1
PATCH 2/2 net: Change TCA_ACT_* to TCA_ID_* to match that of TCA_ID_POLICE
In reply to Eli CohenModify 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.
--- include/net/act_api.h | 2 +- include/net/tc_act/tc_csum.h | 2 +- include/net/tc_act/tc_gact.h | 2 +- include/net/tc_act/tc_mirred.h | 4 ++-- include/net/tc_act/tc_pedit.h | 2 +- include/net/tc_act/tc_sample.h | 2 +- include/net/tc_act/tc_skbedit.h | 2 +- include/net/tc_act/tc_tunnel_key.h | 4 ++-- include/net/tc_act/tc_vlan.h | 2 +- include/uapi/linux/pkt_cls.h | 2 +- net/sched/act_api.c | 2 +- net/sched/act_bpf.c | 2 +- net/sched/act_connmark.c | 2 +- net/sched/act_csum.c | 2 +- net/sched/act_gact.c | 2 +- net/sched/act_ife.c | 2 +- net/sched/act_ipt.c | 4 ++-- net/sched/act_mirred.c | 2 +- net/sched/act_nat.c | 2 +- net/sched/act_pedit.c | 2 +- net/sched/act_police.c | 2 +- net/sched/act_sample.c | 2 +- net/sched/act_simple.c | 4 +--- net/sched/act_skbedit.c | 2 +- net/sched/act_skbmod.c | 2 +- net/sched/act_tunnel_key.c | 2 +- net/sched/act_vlan.c | 2 +- 27 files changed, 30 insertions(+), 32 deletions(-)
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)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 *,
include/net/tc_act/tc_csum.h +1 -1
@@ -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;
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,#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);
include/net/tc_act/tc_mirred.h +2 -2
@@ -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;
include/net/tc_act/tc_pedit.h +1 -1
@@ -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;
include/net/tc_act/tc_sample.h +1 -1
@@ -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
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)#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 ();
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)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;
include/net/tc_act/tc_vlan.h +1 -1
@@ -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;
include/uapi/linux/pkt_cls.h +1 -1
@@ -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 ,
net/sched/act_api.c +1 -1
@@ -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 ;
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)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,
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)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,
net/sched/act_csum.c +1 -1
@@ -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,
net/sched/act_gact.c +1 -1
@@ -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,
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)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,
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)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,
net/sched/act_mirred.c +1 -1
@@ -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,
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)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,
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)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,
net/sched/act_police.c +1 -1
@@ -366,7 +366,7 @@ static int tcf_police_search(struct net *net, struct tc_action **a, u32 index)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,
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)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,
net/sched/act_simple.c +1 -3
@@ -19,8 +19,6 @@#include <net/netlink.h> #include <net/pkt_sched.h> -#define TCA_ACT_SIMP 22 -#include <linux/tc_act/tc_defact.h> #include <net/tc_act/tc_defact.h>
@@ -197,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,
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)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,
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)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,
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)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,
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)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,
Signature · 1 line
1.8.3.1
David Miller
maintainerRe: [PATCH net-next 2/2] net: Change TCA_ACT_* to TCA_ID_* to match that of TCA_ID_POLICE
From: Eli Cohen <[email protected]>
Date: Thu, 7 Feb 2019 09:45:49 +0200
net/sched/act_simple.c line 24
Quoted 13 lines
net/sched/act_simple.c +0
-2@@ -19,8 +19,6 @@#include <net/netlink.h> #include <net/pkt_sched.h> -#define TCA_ACT_SIMP 22 -#include <linux/tc_act/tc_defact.h> #include <net/tc_act/tc_defact.h>
I would do this in patch #1.
Actually, because you didn't, after patch #1 there are two #defines evaluated for this macro. One in pkt_cls.h and one here.
The only reason the compiler doesn't warn and complain is because the definitions are identical.
Thank you.
Re: [PATCH net-next 2/2] net: Change TCA_ACT_* to TCA_ID_* to match that of TCA_ID_POLICE
Quoted 11 lines · David Miller
From: Eli Cohen <[email protected]>
Date: Thu, 7 Feb 2019 09:45:49 +0200Quoted 8 lines
net/sched/act_simple.c +0
-0@@ -19,8 +19,6 @@#include <net/netlink.h> #include <net/pkt_sched.h>
Quoted 7 lines
net/sched/act_simple.c line 24
Quoted 5 lines
net/sched/act_simple.c +0
-2-#define TCA_ACT_SIMP 22 -#include <linux/tc_act/tc_defact.h> #include <net/tc_act/tc_defact.h> I would do this in patch #1.
Sure, that was the intention. It just slipped off my fingers.
Will fix and send a new series.
Quoted 7 lines
Actually, because you didn't, after patch #1 there are two #defines evaluated for this macro. One in
pkt_cls.hand one here.The only reason the compiler doesn't warn and complain is because the definitions are identical.
Thank you.
Re: [PATCH net-next 2/2] net: Change TCA_ACT_* to TCA_ID_* to match that of TCA_ID_POLICE
In reply to Eli CohenQuoted 11 lines · Eli Cohen
Modify the kernel users of the TCA_ACT_* macros to use TCA_ID_*. For example, use
TCA_ID_GACTinstead ofTCA_ACT_GACT. This will align withTCA_ID_POLICEand also differentiates these identifier, used in structtc_action_opstype field, from other macros starting withTCA_ACT_.To make things clearer, we name the enum defining the TCA_ID_* identifiers and also change the "type" field of struct
tc_actionto id.Signed-off-by Eli Cohen <[email protected]>Acked-by Jiri Pirko <[email protected]>
...
include/uapi/linux/pkt_cls.h enum { · line 91
Quoted 13 lines
include/uapi/linux/pkt_cls.h +1
-1@@ -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 ,
This change updates the UAPI. It seems to me that it would not break existing users. But I would like to ask if this has been given due consideration.
...
Jiri Pirko
maintainerRe: [PATCH net-next 2/2] net: Change TCA_ACT_* to TCA_ID_* to match that of TCA_ID_POLICE
Quoted 22 lines · Fri, Feb 08, 2019 at 09:01:42AM CET, [email protected] wrote:
Quoted 11 lines · Eli Cohen
Modify the kernel users of the TCA_ACT_* macros to use TCA_ID_*. For example, use
TCA_ID_GACTinstead ofTCA_ACT_GACT. This will align withTCA_ID_POLICEand also differentiates these identifier, used in structtc_action_opstype field, from other macros starting withTCA_ACT_.To make things clearer, we name the enum defining the TCA_ID_* identifiers and also change the "type" field of struct
tc_actionto id.Signed-off-by Eli Cohen <[email protected]>Acked-by Jiri Pirko <[email protected]>...
Quoted 7 lines
include/uapi/linux/pkt_cls.h +0
-0@@ -85,7 +85,7 @@ enum {#define TCA_ACT_SAMPLE 26
Quoted 10 lines
include/uapi/linux/pkt_cls.h enum { · line 91
Quoted 6 lines
include/uapi/linux/pkt_cls.h +1
-1/* Action type identifiers*/ -enum { +enum tca_id {TCA_ID_UNSPEC =0 ,TCA_ID_POLICE =1 ,TCA_ID_GACT =TCA_ACT_GACT ,This change updates the UAPI. It seems to me that it would not break existing users. But I would like to ask if this has been given due consideration.
Sure it has. I believe this is UAPI-safe change.
Quoted 4 lines · Eli Cohen
This two patch series modifies TC actions identifiers to be more consistent and also puts them in one place so new identifiers numbers can be chosen more easily.
For the series:
cheers,
jamal