diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/net/act_api.h |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'include/net/act_api.h')
-rw-r--r-- | include/net/act_api.h | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/include/net/act_api.h b/include/net/act_api.h new file mode 100644 index 000000000000..ed00a995f576 --- /dev/null +++ b/include/net/act_api.h | |||
@@ -0,0 +1,116 @@ | |||
1 | #ifndef __NET_ACT_API_H | ||
2 | #define __NET_ACT_API_H | ||
3 | |||
4 | /* | ||
5 | * Public police action API for classifiers/qdiscs | ||
6 | */ | ||
7 | |||
8 | #include <net/sch_generic.h> | ||
9 | #include <net/pkt_sched.h> | ||
10 | |||
11 | #define tca_gen(name) \ | ||
12 | struct tcf_##name *next; \ | ||
13 | u32 index; \ | ||
14 | int refcnt; \ | ||
15 | int bindcnt; \ | ||
16 | u32 capab; \ | ||
17 | int action; \ | ||
18 | struct tcf_t tm; \ | ||
19 | struct gnet_stats_basic bstats; \ | ||
20 | struct gnet_stats_queue qstats; \ | ||
21 | struct gnet_stats_rate_est rate_est; \ | ||
22 | spinlock_t *stats_lock; \ | ||
23 | spinlock_t lock | ||
24 | |||
25 | struct tcf_police | ||
26 | { | ||
27 | tca_gen(police); | ||
28 | int result; | ||
29 | u32 ewma_rate; | ||
30 | u32 burst; | ||
31 | u32 mtu; | ||
32 | u32 toks; | ||
33 | u32 ptoks; | ||
34 | psched_time_t t_c; | ||
35 | struct qdisc_rate_table *R_tab; | ||
36 | struct qdisc_rate_table *P_tab; | ||
37 | }; | ||
38 | |||
39 | #ifdef CONFIG_NET_CLS_ACT | ||
40 | |||
41 | #define ACT_P_CREATED 1 | ||
42 | #define ACT_P_DELETED 1 | ||
43 | |||
44 | struct tcf_act_hdr | ||
45 | { | ||
46 | tca_gen(act_hdr); | ||
47 | }; | ||
48 | |||
49 | struct tc_action | ||
50 | { | ||
51 | void *priv; | ||
52 | struct tc_action_ops *ops; | ||
53 | __u32 type; /* for backward compat(TCA_OLD_COMPAT) */ | ||
54 | __u32 order; | ||
55 | struct tc_action *next; | ||
56 | }; | ||
57 | |||
58 | #define TCA_CAP_NONE 0 | ||
59 | struct tc_action_ops | ||
60 | { | ||
61 | struct tc_action_ops *next; | ||
62 | char kind[IFNAMSIZ]; | ||
63 | __u32 type; /* TBD to match kind */ | ||
64 | __u32 capab; /* capabilities includes 4 bit version */ | ||
65 | struct module *owner; | ||
66 | int (*act)(struct sk_buff **, struct tc_action *); | ||
67 | int (*get_stats)(struct sk_buff *, struct tc_action *); | ||
68 | int (*dump)(struct sk_buff *, struct tc_action *,int , int); | ||
69 | int (*cleanup)(struct tc_action *, int bind); | ||
70 | int (*lookup)(struct tc_action *, u32 ); | ||
71 | int (*init)(struct rtattr *,struct rtattr *,struct tc_action *, int , int ); | ||
72 | int (*walk)(struct sk_buff *, struct netlink_callback *, int , struct tc_action *); | ||
73 | }; | ||
74 | |||
75 | extern int tcf_register_action(struct tc_action_ops *a); | ||
76 | extern int tcf_unregister_action(struct tc_action_ops *a); | ||
77 | extern void tcf_action_destroy(struct tc_action *a, int bind); | ||
78 | extern int tcf_action_exec(struct sk_buff *skb, struct tc_action *a, struct tcf_result *res); | ||
79 | extern struct tc_action *tcf_action_init(struct rtattr *rta, struct rtattr *est, char *n, int ovr, int bind, int *err); | ||
80 | extern struct tc_action *tcf_action_init_1(struct rtattr *rta, struct rtattr *est, char *n, int ovr, int bind, int *err); | ||
81 | extern int tcf_action_dump(struct sk_buff *skb, struct tc_action *a, int, int); | ||
82 | extern int tcf_action_dump_old(struct sk_buff *skb, struct tc_action *a, int, int); | ||
83 | extern int tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int, int); | ||
84 | extern int tcf_action_copy_stats (struct sk_buff *,struct tc_action *, int); | ||
85 | #endif /* CONFIG_NET_CLS_ACT */ | ||
86 | |||
87 | extern int tcf_police(struct sk_buff *skb, struct tcf_police *p); | ||
88 | extern void tcf_police_destroy(struct tcf_police *p); | ||
89 | extern struct tcf_police * tcf_police_locate(struct rtattr *rta, struct rtattr *est); | ||
90 | extern int tcf_police_dump(struct sk_buff *skb, struct tcf_police *p); | ||
91 | extern int tcf_police_dump_stats(struct sk_buff *skb, struct tcf_police *p); | ||
92 | |||
93 | static inline int | ||
94 | tcf_police_release(struct tcf_police *p, int bind) | ||
95 | { | ||
96 | int ret = 0; | ||
97 | #ifdef CONFIG_NET_CLS_ACT | ||
98 | if (p) { | ||
99 | if (bind) { | ||
100 | p->bindcnt--; | ||
101 | } | ||
102 | p->refcnt--; | ||
103 | if (p->refcnt <= 0 && !p->bindcnt) { | ||
104 | tcf_police_destroy(p); | ||
105 | ret = 1; | ||
106 | } | ||
107 | } | ||
108 | #else | ||
109 | if (p && --p->refcnt == 0) | ||
110 | tcf_police_destroy(p); | ||
111 | |||
112 | #endif /* CONFIG_NET_CLS_ACT */ | ||
113 | return ret; | ||
114 | } | ||
115 | |||
116 | #endif | ||