aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2011-07-05 19:25:42 -0400
committerDavid S. Miller <davem@davemloft.net>2011-07-06 05:52:16 -0400
commitdc7f9f6e8838556f226c2ebd1da7bb305cb25654 (patch)
treec346ae8a155e187f4f88ba70788dc10ef5ff4c43
parent95ec3eb417115fbb2c73b59e2825f6dd5d2f6cf6 (diff)
net: sched: constify tcf_proto and tc_action
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/act_api.h6
-rw-r--r--include/net/pkt_sched.h4
-rw-r--r--include/net/sch_generic.h12
-rw-r--r--net/sched/act_api.c4
-rw-r--r--net/sched/act_csum.c2
-rw-r--r--net/sched/act_gact.c3
-rw-r--r--net/sched/act_ipt.c2
-rw-r--r--net/sched/act_mirred.c2
-rw-r--r--net/sched/act_nat.c2
-rw-r--r--net/sched/act_pedit.c2
-rw-r--r--net/sched/act_police.c2
-rw-r--r--net/sched/act_simple.c3
-rw-r--r--net/sched/act_skbedit.c2
-rw-r--r--net/sched/cls_api.c6
-rw-r--r--net/sched/cls_basic.c2
-rw-r--r--net/sched/cls_cgroup.c2
-rw-r--r--net/sched/cls_flow.c2
-rw-r--r--net/sched/cls_fw.c2
-rw-r--r--net/sched/cls_route.c2
-rw-r--r--net/sched/cls_rsvp.h2
-rw-r--r--net/sched/cls_tcindex.c2
-rw-r--r--net/sched/cls_u32.c2
-rw-r--r--net/sched/sch_api.c6
23 files changed, 39 insertions, 35 deletions
diff --git a/include/net/act_api.h b/include/net/act_api.h
index bab385f13ac3..c739531e1564 100644
--- a/include/net/act_api.h
+++ b/include/net/act_api.h
@@ -72,7 +72,7 @@ struct tcf_act_hdr {
72 72
73struct tc_action { 73struct tc_action {
74 void *priv; 74 void *priv;
75 struct tc_action_ops *ops; 75 const struct tc_action_ops *ops;
76 __u32 type; /* for backward compat(TCA_OLD_COMPAT) */ 76 __u32 type; /* for backward compat(TCA_OLD_COMPAT) */
77 __u32 order; 77 __u32 order;
78 struct tc_action *next; 78 struct tc_action *next;
@@ -86,7 +86,7 @@ struct tc_action_ops {
86 __u32 type; /* TBD to match kind */ 86 __u32 type; /* TBD to match kind */
87 __u32 capab; /* capabilities includes 4 bit version */ 87 __u32 capab; /* capabilities includes 4 bit version */
88 struct module *owner; 88 struct module *owner;
89 int (*act)(struct sk_buff *, struct tc_action *, struct tcf_result *); 89 int (*act)(struct sk_buff *, const struct tc_action *, struct tcf_result *);
90 int (*get_stats)(struct sk_buff *, struct tc_action *); 90 int (*get_stats)(struct sk_buff *, struct tc_action *);
91 int (*dump)(struct sk_buff *, struct tc_action *, int, int); 91 int (*dump)(struct sk_buff *, struct tc_action *, int, int);
92 int (*cleanup)(struct tc_action *, int bind); 92 int (*cleanup)(struct tc_action *, int bind);
@@ -115,7 +115,7 @@ extern void tcf_hash_insert(struct tcf_common *p, struct tcf_hashinfo *hinfo);
115extern int tcf_register_action(struct tc_action_ops *a); 115extern int tcf_register_action(struct tc_action_ops *a);
116extern int tcf_unregister_action(struct tc_action_ops *a); 116extern int tcf_unregister_action(struct tc_action_ops *a);
117extern void tcf_action_destroy(struct tc_action *a, int bind); 117extern void tcf_action_destroy(struct tc_action *a, int bind);
118extern int tcf_action_exec(struct sk_buff *skb, struct tc_action *a, struct tcf_result *res); 118extern int tcf_action_exec(struct sk_buff *skb, const struct tc_action *a, struct tcf_result *res);
119extern struct tc_action *tcf_action_init(struct nlattr *nla, struct nlattr *est, char *n, int ovr, int bind); 119extern struct tc_action *tcf_action_init(struct nlattr *nla, struct nlattr *est, char *n, int ovr, int bind);
120extern struct tc_action *tcf_action_init_1(struct nlattr *nla, struct nlattr *est, char *n, int ovr, int bind); 120extern struct tc_action *tcf_action_init_1(struct nlattr *nla, struct nlattr *est, char *n, int ovr, int bind);
121extern int tcf_action_dump(struct sk_buff *skb, struct tc_action *a, int, int); 121extern int tcf_action_dump(struct sk_buff *skb, struct tc_action *a, int, int);
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index 65afc4966204..fffdc603f4c8 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -99,9 +99,9 @@ static inline void qdisc_run(struct Qdisc *q)
99 __qdisc_run(q); 99 __qdisc_run(q);
100} 100}
101 101
102extern int tc_classify_compat(struct sk_buff *skb, struct tcf_proto *tp, 102extern int tc_classify_compat(struct sk_buff *skb, const struct tcf_proto *tp,
103 struct tcf_result *res); 103 struct tcf_result *res);
104extern int tc_classify(struct sk_buff *skb, struct tcf_proto *tp, 104extern int tc_classify(struct sk_buff *skb, const struct tcf_proto *tp,
105 struct tcf_result *res); 105 struct tcf_result *res);
106 106
107/* Calculate maximal size of packet seen by hard_start_xmit 107/* Calculate maximal size of packet seen by hard_start_xmit
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index b931f021d7ab..4fc88f3ccd5f 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -181,8 +181,9 @@ struct tcf_proto_ops {
181 struct tcf_proto_ops *next; 181 struct tcf_proto_ops *next;
182 char kind[IFNAMSIZ]; 182 char kind[IFNAMSIZ];
183 183
184 int (*classify)(struct sk_buff*, struct tcf_proto*, 184 int (*classify)(struct sk_buff *,
185 struct tcf_result *); 185 const struct tcf_proto *,
186 struct tcf_result *);
186 int (*init)(struct tcf_proto*); 187 int (*init)(struct tcf_proto*);
187 void (*destroy)(struct tcf_proto*); 188 void (*destroy)(struct tcf_proto*);
188 189
@@ -205,8 +206,9 @@ struct tcf_proto {
205 /* Fast access part */ 206 /* Fast access part */
206 struct tcf_proto *next; 207 struct tcf_proto *next;
207 void *root; 208 void *root;
208 int (*classify)(struct sk_buff*, struct tcf_proto*, 209 int (*classify)(struct sk_buff *,
209 struct tcf_result *); 210 const struct tcf_proto *,
211 struct tcf_result *);
210 __be16 protocol; 212 __be16 protocol;
211 213
212 /* All the rest */ 214 /* All the rest */
@@ -214,7 +216,7 @@ struct tcf_proto {
214 u32 classid; 216 u32 classid;
215 struct Qdisc *q; 217 struct Qdisc *q;
216 void *data; 218 void *data;
217 struct tcf_proto_ops *ops; 219 const struct tcf_proto_ops *ops;
218}; 220};
219 221
220struct qdisc_skb_cb { 222struct qdisc_skb_cb {
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index 2f64262ab5d2..f2fb67e701a3 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -365,10 +365,10 @@ static struct tc_action_ops *tc_lookup_action_id(u32 type)
365} 365}
366#endif 366#endif
367 367
368int tcf_action_exec(struct sk_buff *skb, struct tc_action *act, 368int tcf_action_exec(struct sk_buff *skb, const struct tc_action *act,
369 struct tcf_result *res) 369 struct tcf_result *res)
370{ 370{
371 struct tc_action *a; 371 const struct tc_action *a;
372 int ret = -1; 372 int ret = -1;
373 373
374 if (skb->tc_verd & TC_NCLS) { 374 if (skb->tc_verd & TC_NCLS) {
diff --git a/net/sched/act_csum.c b/net/sched/act_csum.c
index 6cdf9abe475f..453a73431ac4 100644
--- a/net/sched/act_csum.c
+++ b/net/sched/act_csum.c
@@ -500,7 +500,7 @@ fail:
500} 500}
501 501
502static int tcf_csum(struct sk_buff *skb, 502static int tcf_csum(struct sk_buff *skb,
503 struct tc_action *a, struct tcf_result *res) 503 const struct tc_action *a, struct tcf_result *res)
504{ 504{
505 struct tcf_csum *p = a->priv; 505 struct tcf_csum *p = a->priv;
506 int action; 506 int action;
diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c
index 2b4ab4b05ce8..b77f5a06a658 100644
--- a/net/sched/act_gact.c
+++ b/net/sched/act_gact.c
@@ -125,7 +125,8 @@ static int tcf_gact_cleanup(struct tc_action *a, int bind)
125 return 0; 125 return 0;
126} 126}
127 127
128static int tcf_gact(struct sk_buff *skb, struct tc_action *a, struct tcf_result *res) 128static int tcf_gact(struct sk_buff *skb, const struct tc_action *a,
129 struct tcf_result *res)
129{ 130{
130 struct tcf_gact *gact = a->priv; 131 struct tcf_gact *gact = a->priv;
131 int action = TC_ACT_SHOT; 132 int action = TC_ACT_SHOT;
diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c
index 9fc211a1b20e..60f8f616e8fa 100644
--- a/net/sched/act_ipt.c
+++ b/net/sched/act_ipt.c
@@ -195,7 +195,7 @@ static int tcf_ipt_cleanup(struct tc_action *a, int bind)
195 return tcf_ipt_release(ipt, bind); 195 return tcf_ipt_release(ipt, bind);
196} 196}
197 197
198static int tcf_ipt(struct sk_buff *skb, struct tc_action *a, 198static int tcf_ipt(struct sk_buff *skb, const struct tc_action *a,
199 struct tcf_result *res) 199 struct tcf_result *res)
200{ 200{
201 int ret = 0, result = 0; 201 int ret = 0, result = 0;
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c
index 961386e2f2c0..102fc212cd64 100644
--- a/net/sched/act_mirred.c
+++ b/net/sched/act_mirred.c
@@ -154,7 +154,7 @@ static int tcf_mirred_cleanup(struct tc_action *a, int bind)
154 return 0; 154 return 0;
155} 155}
156 156
157static int tcf_mirred(struct sk_buff *skb, struct tc_action *a, 157static int tcf_mirred(struct sk_buff *skb, const struct tc_action *a,
158 struct tcf_result *res) 158 struct tcf_result *res)
159{ 159{
160 struct tcf_mirred *m = a->priv; 160 struct tcf_mirred *m = a->priv;
diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c
index 762b027650a9..001d1b354869 100644
--- a/net/sched/act_nat.c
+++ b/net/sched/act_nat.c
@@ -102,7 +102,7 @@ static int tcf_nat_cleanup(struct tc_action *a, int bind)
102 return tcf_hash_release(&p->common, bind, &nat_hash_info); 102 return tcf_hash_release(&p->common, bind, &nat_hash_info);
103} 103}
104 104
105static int tcf_nat(struct sk_buff *skb, struct tc_action *a, 105static int tcf_nat(struct sk_buff *skb, const struct tc_action *a,
106 struct tcf_result *res) 106 struct tcf_result *res)
107{ 107{
108 struct tcf_nat *p = a->priv; 108 struct tcf_nat *p = a->priv;
diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c
index 7affe9a92757..10d3aed86560 100644
--- a/net/sched/act_pedit.c
+++ b/net/sched/act_pedit.c
@@ -120,7 +120,7 @@ static int tcf_pedit_cleanup(struct tc_action *a, int bind)
120 return 0; 120 return 0;
121} 121}
122 122
123static int tcf_pedit(struct sk_buff *skb, struct tc_action *a, 123static int tcf_pedit(struct sk_buff *skb, const struct tc_action *a,
124 struct tcf_result *res) 124 struct tcf_result *res)
125{ 125{
126 struct tcf_pedit *p = a->priv; 126 struct tcf_pedit *p = a->priv;
diff --git a/net/sched/act_police.c b/net/sched/act_police.c
index b3b9b32f4e00..6fb3f5af0f85 100644
--- a/net/sched/act_police.c
+++ b/net/sched/act_police.c
@@ -282,7 +282,7 @@ static int tcf_act_police_cleanup(struct tc_action *a, int bind)
282 return ret; 282 return ret;
283} 283}
284 284
285static int tcf_act_police(struct sk_buff *skb, struct tc_action *a, 285static int tcf_act_police(struct sk_buff *skb, const struct tc_action *a,
286 struct tcf_result *res) 286 struct tcf_result *res)
287{ 287{
288 struct tcf_police *police = a->priv; 288 struct tcf_police *police = a->priv;
diff --git a/net/sched/act_simple.c b/net/sched/act_simple.c
index a34a22de60b3..73e0a3ab4d55 100644
--- a/net/sched/act_simple.c
+++ b/net/sched/act_simple.c
@@ -36,7 +36,8 @@ static struct tcf_hashinfo simp_hash_info = {
36}; 36};
37 37
38#define SIMP_MAX_DATA 32 38#define SIMP_MAX_DATA 32
39static int tcf_simp(struct sk_buff *skb, struct tc_action *a, struct tcf_result *res) 39static int tcf_simp(struct sk_buff *skb, const struct tc_action *a,
40 struct tcf_result *res)
40{ 41{
41 struct tcf_defact *d = a->priv; 42 struct tcf_defact *d = a->priv;
42 43
diff --git a/net/sched/act_skbedit.c b/net/sched/act_skbedit.c
index 5f6f0c7c3905..35dbbe91027e 100644
--- a/net/sched/act_skbedit.c
+++ b/net/sched/act_skbedit.c
@@ -39,7 +39,7 @@ static struct tcf_hashinfo skbedit_hash_info = {
39 .lock = &skbedit_lock, 39 .lock = &skbedit_lock,
40}; 40};
41 41
42static int tcf_skbedit(struct sk_buff *skb, struct tc_action *a, 42static int tcf_skbedit(struct sk_buff *skb, const struct tc_action *a,
43 struct tcf_result *res) 43 struct tcf_result *res)
44{ 44{
45 struct tcf_skbedit *d = a->priv; 45 struct tcf_skbedit *d = a->priv;
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index 9563887f219f..a69d44f1dac5 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -40,9 +40,9 @@ static DEFINE_RWLOCK(cls_mod_lock);
40 40
41/* Find classifier type by string name */ 41/* Find classifier type by string name */
42 42
43static struct tcf_proto_ops *tcf_proto_lookup_ops(struct nlattr *kind) 43static const struct tcf_proto_ops *tcf_proto_lookup_ops(struct nlattr *kind)
44{ 44{
45 struct tcf_proto_ops *t = NULL; 45 const struct tcf_proto_ops *t = NULL;
46 46
47 if (kind) { 47 if (kind) {
48 read_lock(&cls_mod_lock); 48 read_lock(&cls_mod_lock);
@@ -132,7 +132,7 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
132 struct Qdisc *q; 132 struct Qdisc *q;
133 struct tcf_proto **back, **chain; 133 struct tcf_proto **back, **chain;
134 struct tcf_proto *tp; 134 struct tcf_proto *tp;
135 struct tcf_proto_ops *tp_ops; 135 const struct tcf_proto_ops *tp_ops;
136 const struct Qdisc_class_ops *cops; 136 const struct Qdisc_class_ops *cops;
137 unsigned long cl; 137 unsigned long cl;
138 unsigned long fh; 138 unsigned long fh;
diff --git a/net/sched/cls_basic.c b/net/sched/cls_basic.c
index 8be8872dd571..ea1f70b5a5f4 100644
--- a/net/sched/cls_basic.c
+++ b/net/sched/cls_basic.c
@@ -39,7 +39,7 @@ static const struct tcf_ext_map basic_ext_map = {
39 .police = TCA_BASIC_POLICE 39 .police = TCA_BASIC_POLICE
40}; 40};
41 41
42static int basic_classify(struct sk_buff *skb, struct tcf_proto *tp, 42static int basic_classify(struct sk_buff *skb, const struct tcf_proto *tp,
43 struct tcf_result *res) 43 struct tcf_result *res)
44{ 44{
45 int r; 45 int r;
diff --git a/net/sched/cls_cgroup.c b/net/sched/cls_cgroup.c
index 32a335194ca5..f84fdc3a7f27 100644
--- a/net/sched/cls_cgroup.c
+++ b/net/sched/cls_cgroup.c
@@ -101,7 +101,7 @@ struct cls_cgroup_head {
101 struct tcf_ematch_tree ematches; 101 struct tcf_ematch_tree ematches;
102}; 102};
103 103
104static int cls_cgroup_classify(struct sk_buff *skb, struct tcf_proto *tp, 104static int cls_cgroup_classify(struct sk_buff *skb, const struct tcf_proto *tp,
105 struct tcf_result *res) 105 struct tcf_result *res)
106{ 106{
107 struct cls_cgroup_head *head = tp->root; 107 struct cls_cgroup_head *head = tp->root;
diff --git a/net/sched/cls_flow.c b/net/sched/cls_flow.c
index 34533a5d1b3a..6994214db8f8 100644
--- a/net/sched/cls_flow.c
+++ b/net/sched/cls_flow.c
@@ -356,7 +356,7 @@ static u32 flow_key_get(struct sk_buff *skb, int key)
356 } 356 }
357} 357}
358 358
359static int flow_classify(struct sk_buff *skb, struct tcf_proto *tp, 359static int flow_classify(struct sk_buff *skb, const struct tcf_proto *tp,
360 struct tcf_result *res) 360 struct tcf_result *res)
361{ 361{
362 struct flow_head *head = tp->root; 362 struct flow_head *head = tp->root;
diff --git a/net/sched/cls_fw.c b/net/sched/cls_fw.c
index 26e7bc4ffb79..389af152ec45 100644
--- a/net/sched/cls_fw.c
+++ b/net/sched/cls_fw.c
@@ -77,7 +77,7 @@ static inline int fw_hash(u32 handle)
77 return handle & (HTSIZE - 1); 77 return handle & (HTSIZE - 1);
78} 78}
79 79
80static int fw_classify(struct sk_buff *skb, struct tcf_proto *tp, 80static int fw_classify(struct sk_buff *skb, const struct tcf_proto *tp,
81 struct tcf_result *res) 81 struct tcf_result *res)
82{ 82{
83 struct fw_head *head = (struct fw_head *)tp->root; 83 struct fw_head *head = (struct fw_head *)tp->root;
diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c
index a907905376df..13ab66e9df58 100644
--- a/net/sched/cls_route.c
+++ b/net/sched/cls_route.c
@@ -125,7 +125,7 @@ static inline int route4_hash_wild(void)
125 return 0; \ 125 return 0; \
126} 126}
127 127
128static int route4_classify(struct sk_buff *skb, struct tcf_proto *tp, 128static int route4_classify(struct sk_buff *skb, const struct tcf_proto *tp,
129 struct tcf_result *res) 129 struct tcf_result *res)
130{ 130{
131 struct route4_head *head = (struct route4_head *)tp->root; 131 struct route4_head *head = (struct route4_head *)tp->root;
diff --git a/net/sched/cls_rsvp.h b/net/sched/cls_rsvp.h
index ed691b148384..be4505ee67a9 100644
--- a/net/sched/cls_rsvp.h
+++ b/net/sched/cls_rsvp.h
@@ -130,7 +130,7 @@ static struct tcf_ext_map rsvp_ext_map = {
130 return r; \ 130 return r; \
131} 131}
132 132
133static int rsvp_classify(struct sk_buff *skb, struct tcf_proto *tp, 133static int rsvp_classify(struct sk_buff *skb, const struct tcf_proto *tp,
134 struct tcf_result *res) 134 struct tcf_result *res)
135{ 135{
136 struct rsvp_session **sht = ((struct rsvp_head *)tp->root)->ht; 136 struct rsvp_session **sht = ((struct rsvp_head *)tp->root)->ht;
diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c
index 36667fa64237..dbe199234c63 100644
--- a/net/sched/cls_tcindex.c
+++ b/net/sched/cls_tcindex.c
@@ -79,7 +79,7 @@ tcindex_lookup(struct tcindex_data *p, u16 key)
79} 79}
80 80
81 81
82static int tcindex_classify(struct sk_buff *skb, struct tcf_proto *tp, 82static int tcindex_classify(struct sk_buff *skb, const struct tcf_proto *tp,
83 struct tcf_result *res) 83 struct tcf_result *res)
84{ 84{
85 struct tcindex_data *p = PRIV(tp); 85 struct tcindex_data *p = PRIV(tp);
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c
index 3b93fc0c8955..939b627b4795 100644
--- a/net/sched/cls_u32.c
+++ b/net/sched/cls_u32.c
@@ -93,7 +93,7 @@ static inline unsigned int u32_hash_fold(__be32 key,
93 return h; 93 return h;
94} 94}
95 95
96static int u32_classify(struct sk_buff *skb, struct tcf_proto *tp, struct tcf_result *res) 96static int u32_classify(struct sk_buff *skb, const struct tcf_proto *tp, struct tcf_result *res)
97{ 97{
98 struct { 98 struct {
99 struct tc_u_knode *knode; 99 struct tc_u_knode *knode;
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index 8182aefafb02..dca6c1a576f7 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -1644,7 +1644,7 @@ done:
1644 * to this qdisc, (optionally) tests for protocol and asks 1644 * to this qdisc, (optionally) tests for protocol and asks
1645 * specific classifiers. 1645 * specific classifiers.
1646 */ 1646 */
1647int tc_classify_compat(struct sk_buff *skb, struct tcf_proto *tp, 1647int tc_classify_compat(struct sk_buff *skb, const struct tcf_proto *tp,
1648 struct tcf_result *res) 1648 struct tcf_result *res)
1649{ 1649{
1650 __be16 protocol = skb->protocol; 1650 __be16 protocol = skb->protocol;
@@ -1668,12 +1668,12 @@ int tc_classify_compat(struct sk_buff *skb, struct tcf_proto *tp,
1668} 1668}
1669EXPORT_SYMBOL(tc_classify_compat); 1669EXPORT_SYMBOL(tc_classify_compat);
1670 1670
1671int tc_classify(struct sk_buff *skb, struct tcf_proto *tp, 1671int tc_classify(struct sk_buff *skb, const struct tcf_proto *tp,
1672 struct tcf_result *res) 1672 struct tcf_result *res)
1673{ 1673{
1674 int err = 0; 1674 int err = 0;
1675#ifdef CONFIG_NET_CLS_ACT 1675#ifdef CONFIG_NET_CLS_ACT
1676 struct tcf_proto *otp = tp; 1676 const struct tcf_proto *otp = tp;
1677reclassify: 1677reclassify:
1678#endif 1678#endif
1679 1679