1 #ifndef __NET_ACT_API_H
2 #define __NET_ACT_API_H
5 * Public police action API for classifiers/qdiscs
8 #include <net/sch_generic.h>
9 #include <net/pkt_sched.h>
11 #define tca_gen(name) \
12 struct tcf_##name *next; \
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; \
35 struct qdisc_rate_table *R_tab;
36 struct qdisc_rate_table *P_tab;
39 #ifdef CONFIG_NET_CLS_ACT
41 #define ACT_P_CREATED 1
42 #define ACT_P_DELETED 1
52 struct tc_action_ops *ops;
53 __u32 type; /* for backward compat(TCA_OLD_COMPAT) */
55 struct tc_action *next;
58 #define TCA_CAP_NONE 0
61 struct tc_action_ops *next;
63 __u32 type; /* TBD to match kind */
64 __u32 capab; /* capabilities includes 4 bit version */
66 int (*act)(struct sk_buff *, struct tc_action *, struct tcf_result *);
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 *);
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 */
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);
94 tcf_police_release(struct tcf_police *p, int bind)
97 #ifdef CONFIG_NET_CLS_ACT
103 if (p->refcnt <= 0 && !p->bindcnt) {
104 tcf_police_destroy(p);
109 if (p && --p->refcnt == 0)
110 tcf_police_destroy(p);
112 #endif /* CONFIG_NET_CLS_ACT */