net: Move all TC actions identifiers to one place
authorEli Cohen <eli@mellanox.com>
Sun, 10 Feb 2019 12:24:59 +0000 (14:24 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sun, 10 Feb 2019 17:28:43 +0000 (09:28 -0800)
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.

Signed-off-by: Eli Cohen <eli@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
17 files changed:
include/uapi/linux/pkt_cls.h
include/uapi/linux/tc_act/tc_bpf.h
include/uapi/linux/tc_act/tc_connmark.h
include/uapi/linux/tc_act/tc_csum.h
include/uapi/linux/tc_act/tc_gact.h
include/uapi/linux/tc_act/tc_ife.h
include/uapi/linux/tc_act/tc_ipt.h
include/uapi/linux/tc_act/tc_mirred.h
include/uapi/linux/tc_act/tc_nat.h
include/uapi/linux/tc_act/tc_pedit.h
include/uapi/linux/tc_act/tc_sample.h
include/uapi/linux/tc_act/tc_skbedit.h
include/uapi/linux/tc_act/tc_skbmod.h
include/uapi/linux/tc_act/tc_tunnel_key.h
include/uapi/linux/tc_act/tc_vlan.h
net/sched/act_simple.c
tools/include/uapi/linux/tc_act/tc_bpf.h

index 02ac251..7ab55f9 100644 (file)
@@ -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
index 6e89a5d..653c4f9 100644 (file)
@@ -13,8 +13,6 @@
 
 #include <linux/pkt_cls.h>
 
-#define TCA_ACT_BPF 13
-
 struct tc_act_bpf {
        tc_gen;
 };
index 80caa47..9f8f6f7 100644 (file)
@@ -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;
index 0ecf4d2..94b2044 100644 (file)
@@ -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,
index 94273c3..37e5392 100644 (file)
@@ -5,7 +5,6 @@
 #include <linux/types.h>
 #include <linux/pkt_cls.h>
 
-#define TCA_ACT_GACT 5
 struct tc_gact {
        tc_gen;
 
index 2f48490..8c401f1 100644 (file)
@@ -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
index b743c8b..c48d7da 100644 (file)
@@ -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,
index 5dd671c..2500a00 100644 (file)
@@ -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*/
index 086be84..21399c2 100644 (file)
@@ -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,
index 24ec792..f3e61b0 100644 (file)
@@ -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,
index bd7e9f0..fee1bcc 100644 (file)
@@ -6,8 +6,6 @@
 #include <linux/pkt_cls.h>
 #include <linux/if_ether.h>
 
-#define TCA_ACT_SAMPLE 26
-
 struct tc_sample {
        tc_gen;
 };
index 6de6071..800e933 100644 (file)
@@ -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
index 38c072f..c525b35 100644 (file)
@@ -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
index be384d6..41c8b46 100644 (file)
@@ -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
 
index 0d7b5fd..168995b 100644 (file)
@@ -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
index 902957b..b2b16d4 100644 (file)
@@ -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>
 
index 6e89a5d..653c4f9 100644 (file)
@@ -13,8 +13,6 @@
 
 #include <linux/pkt_cls.h>
 
-#define TCA_ACT_BPF 13
-
 struct tc_act_bpf {
        tc_gen;
 };