Commit dc7f9f6e authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

net: sched: constify tcf_proto and tc_action

Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 95ec3eb4
...@@ -72,7 +72,7 @@ struct tcf_act_hdr { ...@@ -72,7 +72,7 @@ struct tcf_act_hdr {
struct tc_action { struct tc_action {
void *priv; void *priv;
struct tc_action_ops *ops; const struct tc_action_ops *ops;
__u32 type; /* for backward compat(TCA_OLD_COMPAT) */ __u32 type; /* for backward compat(TCA_OLD_COMPAT) */
__u32 order; __u32 order;
struct tc_action *next; struct tc_action *next;
...@@ -86,7 +86,7 @@ struct tc_action_ops { ...@@ -86,7 +86,7 @@ struct tc_action_ops {
__u32 type; /* TBD to match kind */ __u32 type; /* TBD to match kind */
__u32 capab; /* capabilities includes 4 bit version */ __u32 capab; /* capabilities includes 4 bit version */
struct module *owner; struct module *owner;
int (*act)(struct sk_buff *, struct tc_action *, struct tcf_result *); int (*act)(struct sk_buff *, const struct tc_action *, struct tcf_result *);
int (*get_stats)(struct sk_buff *, struct tc_action *); int (*get_stats)(struct sk_buff *, struct tc_action *);
int (*dump)(struct sk_buff *, struct tc_action *, int, int); int (*dump)(struct sk_buff *, struct tc_action *, int, int);
int (*cleanup)(struct tc_action *, int bind); int (*cleanup)(struct tc_action *, int bind);
...@@ -115,7 +115,7 @@ extern void tcf_hash_insert(struct tcf_common *p, struct tcf_hashinfo *hinfo); ...@@ -115,7 +115,7 @@ extern void tcf_hash_insert(struct tcf_common *p, struct tcf_hashinfo *hinfo);
extern int tcf_register_action(struct tc_action_ops *a); extern int tcf_register_action(struct tc_action_ops *a);
extern int tcf_unregister_action(struct tc_action_ops *a); extern int tcf_unregister_action(struct tc_action_ops *a);
extern void tcf_action_destroy(struct tc_action *a, int bind); extern void tcf_action_destroy(struct tc_action *a, int bind);
extern int tcf_action_exec(struct sk_buff *skb, struct tc_action *a, struct tcf_result *res); extern int tcf_action_exec(struct sk_buff *skb, const struct tc_action *a, struct tcf_result *res);
extern struct tc_action *tcf_action_init(struct nlattr *nla, struct nlattr *est, char *n, int ovr, int bind); extern struct tc_action *tcf_action_init(struct nlattr *nla, struct nlattr *est, char *n, int ovr, int bind);
extern struct tc_action *tcf_action_init_1(struct nlattr *nla, struct nlattr *est, char *n, int ovr, int bind); extern struct tc_action *tcf_action_init_1(struct nlattr *nla, struct nlattr *est, char *n, int ovr, int bind);
extern int tcf_action_dump(struct sk_buff *skb, struct tc_action *a, int, int); extern int tcf_action_dump(struct sk_buff *skb, struct tc_action *a, int, int);
......
...@@ -99,9 +99,9 @@ static inline void qdisc_run(struct Qdisc *q) ...@@ -99,9 +99,9 @@ static inline void qdisc_run(struct Qdisc *q)
__qdisc_run(q); __qdisc_run(q);
} }
extern int tc_classify_compat(struct sk_buff *skb, struct tcf_proto *tp, extern int tc_classify_compat(struct sk_buff *skb, const struct tcf_proto *tp,
struct tcf_result *res); struct tcf_result *res);
extern int tc_classify(struct sk_buff *skb, struct tcf_proto *tp, extern int tc_classify(struct sk_buff *skb, const struct tcf_proto *tp,
struct tcf_result *res); struct tcf_result *res);
/* Calculate maximal size of packet seen by hard_start_xmit /* Calculate maximal size of packet seen by hard_start_xmit
......
...@@ -181,8 +181,9 @@ struct tcf_proto_ops { ...@@ -181,8 +181,9 @@ struct tcf_proto_ops {
struct tcf_proto_ops *next; struct tcf_proto_ops *next;
char kind[IFNAMSIZ]; char kind[IFNAMSIZ];
int (*classify)(struct sk_buff*, struct tcf_proto*, int (*classify)(struct sk_buff *,
struct tcf_result *); const struct tcf_proto *,
struct tcf_result *);
int (*init)(struct tcf_proto*); int (*init)(struct tcf_proto*);
void (*destroy)(struct tcf_proto*); void (*destroy)(struct tcf_proto*);
...@@ -205,8 +206,9 @@ struct tcf_proto { ...@@ -205,8 +206,9 @@ struct tcf_proto {
/* Fast access part */ /* Fast access part */
struct tcf_proto *next; struct tcf_proto *next;
void *root; void *root;
int (*classify)(struct sk_buff*, struct tcf_proto*, int (*classify)(struct sk_buff *,
struct tcf_result *); const struct tcf_proto *,
struct tcf_result *);
__be16 protocol; __be16 protocol;
/* All the rest */ /* All the rest */
...@@ -214,7 +216,7 @@ struct tcf_proto { ...@@ -214,7 +216,7 @@ struct tcf_proto {
u32 classid; u32 classid;
struct Qdisc *q; struct Qdisc *q;
void *data; void *data;
struct tcf_proto_ops *ops; const struct tcf_proto_ops *ops;
}; };
struct qdisc_skb_cb { struct qdisc_skb_cb {
......
...@@ -365,10 +365,10 @@ static struct tc_action_ops *tc_lookup_action_id(u32 type) ...@@ -365,10 +365,10 @@ static struct tc_action_ops *tc_lookup_action_id(u32 type)
} }
#endif #endif
int tcf_action_exec(struct sk_buff *skb, struct tc_action *act, int tcf_action_exec(struct sk_buff *skb, const struct tc_action *act,
struct tcf_result *res) struct tcf_result *res)
{ {
struct tc_action *a; const struct tc_action *a;
int ret = -1; int ret = -1;
if (skb->tc_verd & TC_NCLS) { if (skb->tc_verd & TC_NCLS) {
......
...@@ -500,7 +500,7 @@ static int tcf_csum_ipv6(struct sk_buff *skb, u32 update_flags) ...@@ -500,7 +500,7 @@ static int tcf_csum_ipv6(struct sk_buff *skb, u32 update_flags)
} }
static int tcf_csum(struct sk_buff *skb, static int tcf_csum(struct sk_buff *skb,
struct tc_action *a, struct tcf_result *res) const struct tc_action *a, struct tcf_result *res)
{ {
struct tcf_csum *p = a->priv; struct tcf_csum *p = a->priv;
int action; int action;
......
...@@ -125,7 +125,8 @@ static int tcf_gact_cleanup(struct tc_action *a, int bind) ...@@ -125,7 +125,8 @@ static int tcf_gact_cleanup(struct tc_action *a, int bind)
return 0; return 0;
} }
static int tcf_gact(struct sk_buff *skb, struct tc_action *a, struct tcf_result *res) static int tcf_gact(struct sk_buff *skb, const struct tc_action *a,
struct tcf_result *res)
{ {
struct tcf_gact *gact = a->priv; struct tcf_gact *gact = a->priv;
int action = TC_ACT_SHOT; int action = TC_ACT_SHOT;
......
...@@ -195,7 +195,7 @@ static int tcf_ipt_cleanup(struct tc_action *a, int bind) ...@@ -195,7 +195,7 @@ static int tcf_ipt_cleanup(struct tc_action *a, int bind)
return tcf_ipt_release(ipt, bind); return tcf_ipt_release(ipt, bind);
} }
static int tcf_ipt(struct sk_buff *skb, struct tc_action *a, static int tcf_ipt(struct sk_buff *skb, const struct tc_action *a,
struct tcf_result *res) struct tcf_result *res)
{ {
int ret = 0, result = 0; int ret = 0, result = 0;
......
...@@ -154,7 +154,7 @@ static int tcf_mirred_cleanup(struct tc_action *a, int bind) ...@@ -154,7 +154,7 @@ static int tcf_mirred_cleanup(struct tc_action *a, int bind)
return 0; return 0;
} }
static int tcf_mirred(struct sk_buff *skb, struct tc_action *a, static int tcf_mirred(struct sk_buff *skb, const struct tc_action *a,
struct tcf_result *res) struct tcf_result *res)
{ {
struct tcf_mirred *m = a->priv; struct tcf_mirred *m = a->priv;
......
...@@ -102,7 +102,7 @@ static int tcf_nat_cleanup(struct tc_action *a, int bind) ...@@ -102,7 +102,7 @@ static int tcf_nat_cleanup(struct tc_action *a, int bind)
return tcf_hash_release(&p->common, bind, &nat_hash_info); return tcf_hash_release(&p->common, bind, &nat_hash_info);
} }
static int tcf_nat(struct sk_buff *skb, struct tc_action *a, static int tcf_nat(struct sk_buff *skb, const struct tc_action *a,
struct tcf_result *res) struct tcf_result *res)
{ {
struct tcf_nat *p = a->priv; struct tcf_nat *p = a->priv;
......
...@@ -120,7 +120,7 @@ static int tcf_pedit_cleanup(struct tc_action *a, int bind) ...@@ -120,7 +120,7 @@ static int tcf_pedit_cleanup(struct tc_action *a, int bind)
return 0; return 0;
} }
static int tcf_pedit(struct sk_buff *skb, struct tc_action *a, static int tcf_pedit(struct sk_buff *skb, const struct tc_action *a,
struct tcf_result *res) struct tcf_result *res)
{ {
struct tcf_pedit *p = a->priv; struct tcf_pedit *p = a->priv;
......
...@@ -282,7 +282,7 @@ static int tcf_act_police_cleanup(struct tc_action *a, int bind) ...@@ -282,7 +282,7 @@ static int tcf_act_police_cleanup(struct tc_action *a, int bind)
return ret; return ret;
} }
static int tcf_act_police(struct sk_buff *skb, struct tc_action *a, static int tcf_act_police(struct sk_buff *skb, const struct tc_action *a,
struct tcf_result *res) struct tcf_result *res)
{ {
struct tcf_police *police = a->priv; struct tcf_police *police = a->priv;
......
...@@ -36,7 +36,8 @@ static struct tcf_hashinfo simp_hash_info = { ...@@ -36,7 +36,8 @@ static struct tcf_hashinfo simp_hash_info = {
}; };
#define SIMP_MAX_DATA 32 #define SIMP_MAX_DATA 32
static int tcf_simp(struct sk_buff *skb, struct tc_action *a, struct tcf_result *res) static int tcf_simp(struct sk_buff *skb, const struct tc_action *a,
struct tcf_result *res)
{ {
struct tcf_defact *d = a->priv; struct tcf_defact *d = a->priv;
......
...@@ -39,7 +39,7 @@ static struct tcf_hashinfo skbedit_hash_info = { ...@@ -39,7 +39,7 @@ static struct tcf_hashinfo skbedit_hash_info = {
.lock = &skbedit_lock, .lock = &skbedit_lock,
}; };
static int tcf_skbedit(struct sk_buff *skb, struct tc_action *a, static int tcf_skbedit(struct sk_buff *skb, const struct tc_action *a,
struct tcf_result *res) struct tcf_result *res)
{ {
struct tcf_skbedit *d = a->priv; struct tcf_skbedit *d = a->priv;
......
...@@ -40,9 +40,9 @@ static DEFINE_RWLOCK(cls_mod_lock); ...@@ -40,9 +40,9 @@ static DEFINE_RWLOCK(cls_mod_lock);
/* Find classifier type by string name */ /* Find classifier type by string name */
static struct tcf_proto_ops *tcf_proto_lookup_ops(struct nlattr *kind) static const struct tcf_proto_ops *tcf_proto_lookup_ops(struct nlattr *kind)
{ {
struct tcf_proto_ops *t = NULL; const struct tcf_proto_ops *t = NULL;
if (kind) { if (kind) {
read_lock(&cls_mod_lock); read_lock(&cls_mod_lock);
...@@ -132,7 +132,7 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n, void *arg) ...@@ -132,7 +132,7 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
struct Qdisc *q; struct Qdisc *q;
struct tcf_proto **back, **chain; struct tcf_proto **back, **chain;
struct tcf_proto *tp; struct tcf_proto *tp;
struct tcf_proto_ops *tp_ops; const struct tcf_proto_ops *tp_ops;
const struct Qdisc_class_ops *cops; const struct Qdisc_class_ops *cops;
unsigned long cl; unsigned long cl;
unsigned long fh; unsigned long fh;
......
...@@ -39,7 +39,7 @@ static const struct tcf_ext_map basic_ext_map = { ...@@ -39,7 +39,7 @@ static const struct tcf_ext_map basic_ext_map = {
.police = TCA_BASIC_POLICE .police = TCA_BASIC_POLICE
}; };
static int basic_classify(struct sk_buff *skb, struct tcf_proto *tp, static int basic_classify(struct sk_buff *skb, const struct tcf_proto *tp,
struct tcf_result *res) struct tcf_result *res)
{ {
int r; int r;
......
...@@ -101,7 +101,7 @@ struct cls_cgroup_head { ...@@ -101,7 +101,7 @@ struct cls_cgroup_head {
struct tcf_ematch_tree ematches; struct tcf_ematch_tree ematches;
}; };
static int cls_cgroup_classify(struct sk_buff *skb, struct tcf_proto *tp, static int cls_cgroup_classify(struct sk_buff *skb, const struct tcf_proto *tp,
struct tcf_result *res) struct tcf_result *res)
{ {
struct cls_cgroup_head *head = tp->root; struct cls_cgroup_head *head = tp->root;
......
...@@ -356,7 +356,7 @@ static u32 flow_key_get(struct sk_buff *skb, int key) ...@@ -356,7 +356,7 @@ static u32 flow_key_get(struct sk_buff *skb, int key)
} }
} }
static int flow_classify(struct sk_buff *skb, struct tcf_proto *tp, static int flow_classify(struct sk_buff *skb, const struct tcf_proto *tp,
struct tcf_result *res) struct tcf_result *res)
{ {
struct flow_head *head = tp->root; struct flow_head *head = tp->root;
......
...@@ -77,7 +77,7 @@ static inline int fw_hash(u32 handle) ...@@ -77,7 +77,7 @@ static inline int fw_hash(u32 handle)
return handle & (HTSIZE - 1); return handle & (HTSIZE - 1);
} }
static int fw_classify(struct sk_buff *skb, struct tcf_proto *tp, static int fw_classify(struct sk_buff *skb, const struct tcf_proto *tp,
struct tcf_result *res) struct tcf_result *res)
{ {
struct fw_head *head = (struct fw_head *)tp->root; struct fw_head *head = (struct fw_head *)tp->root;
......
...@@ -125,7 +125,7 @@ static inline int route4_hash_wild(void) ...@@ -125,7 +125,7 @@ static inline int route4_hash_wild(void)
return 0; \ return 0; \
} }
static int route4_classify(struct sk_buff *skb, struct tcf_proto *tp, static int route4_classify(struct sk_buff *skb, const struct tcf_proto *tp,
struct tcf_result *res) struct tcf_result *res)
{ {
struct route4_head *head = (struct route4_head *)tp->root; struct route4_head *head = (struct route4_head *)tp->root;
......
...@@ -130,7 +130,7 @@ static struct tcf_ext_map rsvp_ext_map = { ...@@ -130,7 +130,7 @@ static struct tcf_ext_map rsvp_ext_map = {
return r; \ return r; \
} }
static int rsvp_classify(struct sk_buff *skb, struct tcf_proto *tp, static int rsvp_classify(struct sk_buff *skb, const struct tcf_proto *tp,
struct tcf_result *res) struct tcf_result *res)
{ {
struct rsvp_session **sht = ((struct rsvp_head *)tp->root)->ht; struct rsvp_session **sht = ((struct rsvp_head *)tp->root)->ht;
......
...@@ -79,7 +79,7 @@ tcindex_lookup(struct tcindex_data *p, u16 key) ...@@ -79,7 +79,7 @@ tcindex_lookup(struct tcindex_data *p, u16 key)
} }
static int tcindex_classify(struct sk_buff *skb, struct tcf_proto *tp, static int tcindex_classify(struct sk_buff *skb, const struct tcf_proto *tp,
struct tcf_result *res) struct tcf_result *res)
{ {
struct tcindex_data *p = PRIV(tp); struct tcindex_data *p = PRIV(tp);
......
...@@ -93,7 +93,7 @@ static inline unsigned int u32_hash_fold(__be32 key, ...@@ -93,7 +93,7 @@ static inline unsigned int u32_hash_fold(__be32 key,
return h; return h;
} }
static int u32_classify(struct sk_buff *skb, struct tcf_proto *tp, struct tcf_result *res) static int u32_classify(struct sk_buff *skb, const struct tcf_proto *tp, struct tcf_result *res)
{ {
struct { struct {
struct tc_u_knode *knode; struct tc_u_knode *knode;
......
...@@ -1644,7 +1644,7 @@ static int tc_dump_tclass(struct sk_buff *skb, struct netlink_callback *cb) ...@@ -1644,7 +1644,7 @@ static int tc_dump_tclass(struct sk_buff *skb, struct netlink_callback *cb)
* to this qdisc, (optionally) tests for protocol and asks * to this qdisc, (optionally) tests for protocol and asks
* specific classifiers. * specific classifiers.
*/ */
int tc_classify_compat(struct sk_buff *skb, struct tcf_proto *tp, int tc_classify_compat(struct sk_buff *skb, const struct tcf_proto *tp,
struct tcf_result *res) struct tcf_result *res)
{ {
__be16 protocol = skb->protocol; __be16 protocol = skb->protocol;
...@@ -1668,12 +1668,12 @@ int tc_classify_compat(struct sk_buff *skb, struct tcf_proto *tp, ...@@ -1668,12 +1668,12 @@ int tc_classify_compat(struct sk_buff *skb, struct tcf_proto *tp,
} }
EXPORT_SYMBOL(tc_classify_compat); EXPORT_SYMBOL(tc_classify_compat);
int tc_classify(struct sk_buff *skb, struct tcf_proto *tp, int tc_classify(struct sk_buff *skb, const struct tcf_proto *tp,
struct tcf_result *res) struct tcf_result *res)
{ {
int err = 0; int err = 0;
#ifdef CONFIG_NET_CLS_ACT #ifdef CONFIG_NET_CLS_ACT
struct tcf_proto *otp = tp; const struct tcf_proto *otp = tp;
reclassify: reclassify:
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment