aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/tc_act
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2006-08-22 02:54:55 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-09-22 17:55:10 -0400
commite9ce1cd3cf6cf35b21d0ce990f2e738f35907386 (patch)
tree22a3ee7b78ae7cbf00520c66dcc389d87740069c /include/net/tc_act
parent2e4ca75b31b6851dcc036c2cdebf3ecfe279a653 (diff)
[PKT_SCHED]: Kill pkt_act.h inlining.
This was simply making templates of functions and mostly causing a lot of code duplication in the classifier action modules. We solve this more cleanly by having a common "struct tcf_common" that hash worker functions contained once in act_api.c can work with. Callers work with real action objects that have the common struct plus their module specific struct members. You go from a common object to the higher level one using a "to_foo()" macro which makes use of container_of() to do the dirty work. This also kills off act_generic.h which was only used by act_simple.c and keeping it around was more work than the it's value. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/tc_act')
-rw-r--r--include/net/tc_act/tc_defact.h13
-rw-r--r--include/net/tc_act/tc_gact.h18
-rw-r--r--include/net/tc_act/tc_ipt.h15
-rw-r--r--include/net/tc_act/tc_mirred.h17
-rw-r--r--include/net/tc_act/tc_pedit.h15
5 files changed, 41 insertions, 37 deletions
diff --git a/include/net/tc_act/tc_defact.h b/include/net/tc_act/tc_defact.h
index 463aa671f95d..65f024b80958 100644
--- a/include/net/tc_act/tc_defact.h
+++ b/include/net/tc_act/tc_defact.h
@@ -3,11 +3,12 @@
3 3
4#include <net/act_api.h> 4#include <net/act_api.h>
5 5
6struct tcf_defact 6struct tcf_defact {
7{ 7 struct tcf_common common;
8 tca_gen(defact); 8 u32 tcfd_datalen;
9 u32 datalen; 9 void *tcfd_defdata;
10 void *defdata;
11}; 10};
11#define to_defact(pc) \
12 container_of(pc, struct tcf_defact, common)
12 13
13#endif 14#endif /* __NET_TC_DEF_H */
diff --git a/include/net/tc_act/tc_gact.h b/include/net/tc_act/tc_gact.h
index 59f0d9628ad1..9e3f6767b80e 100644
--- a/include/net/tc_act/tc_gact.h
+++ b/include/net/tc_act/tc_gact.h
@@ -3,15 +3,15 @@
3 3
4#include <net/act_api.h> 4#include <net/act_api.h>
5 5
6struct tcf_gact 6struct tcf_gact {
7{ 7 struct tcf_common common;
8 tca_gen(gact);
9#ifdef CONFIG_GACT_PROB 8#ifdef CONFIG_GACT_PROB
10 u16 ptype; 9 u16 tcfg_ptype;
11 u16 pval; 10 u16 tcfg_pval;
12 int paction; 11 int tcfg_paction;
13#endif 12#endif
14
15}; 13};
16 14#define to_gact(pc) \
17#endif 15 container_of(pc, struct tcf_gact, common)
16
17#endif /* __NET_TC_GACT_H */
diff --git a/include/net/tc_act/tc_ipt.h b/include/net/tc_act/tc_ipt.h
index cb37ad08427f..f7d25dfcc4b7 100644
--- a/include/net/tc_act/tc_ipt.h
+++ b/include/net/tc_act/tc_ipt.h
@@ -5,12 +5,13 @@
5 5
6struct xt_entry_target; 6struct xt_entry_target;
7 7
8struct tcf_ipt 8struct tcf_ipt {
9{ 9 struct tcf_common common;
10 tca_gen(ipt); 10 u32 tcfi_hook;
11 u32 hook; 11 char *tcfi_tname;
12 char *tname; 12 struct xt_entry_target *tcfi_t;
13 struct xt_entry_target *t;
14}; 13};
14#define to_ipt(pc) \
15 container_of(pc, struct tcf_ipt, common)
15 16
16#endif 17#endif /* __NET_TC_IPT_H */
diff --git a/include/net/tc_act/tc_mirred.h b/include/net/tc_act/tc_mirred.h
index b5c32f65c12c..ceac661cdfd5 100644
--- a/include/net/tc_act/tc_mirred.h
+++ b/include/net/tc_act/tc_mirred.h
@@ -3,13 +3,14 @@
3 3
4#include <net/act_api.h> 4#include <net/act_api.h>
5 5
6struct tcf_mirred 6struct tcf_mirred {
7{ 7 struct tcf_common common;
8 tca_gen(mirred); 8 int tcfm_eaction;
9 int eaction; 9 int tcfm_ifindex;
10 int ifindex; 10 int tcfm_ok_push;
11 int ok_push; 11 struct net_device *tcfm_dev;
12 struct net_device *dev;
13}; 12};
13#define to_mirred(pc) \
14 container_of(pc, struct tcf_mirred, common)
14 15
15#endif 16#endif /* __NET_TC_MIR_H */
diff --git a/include/net/tc_act/tc_pedit.h b/include/net/tc_act/tc_pedit.h
index eb21689d759d..e6f6e15956f5 100644
--- a/include/net/tc_act/tc_pedit.h
+++ b/include/net/tc_act/tc_pedit.h
@@ -3,12 +3,13 @@
3 3
4#include <net/act_api.h> 4#include <net/act_api.h>
5 5
6struct tcf_pedit 6struct tcf_pedit {
7{ 7 struct tcf_common common;
8 tca_gen(pedit); 8 unsigned char tcfp_nkeys;
9 unsigned char nkeys; 9 unsigned char tcfp_flags;
10 unsigned char flags; 10 struct tc_pedit_key *tcfp_keys;
11 struct tc_pedit_key *keys;
12}; 11};
12#define to_pedit(pc) \
13 container_of(pc, struct tcf_pedit, common)
13 14
14#endif 15#endif /* __NET_TC_PED_H */