diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2008-01-21 03:50:09 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:08:38 -0500 |
commit | 81da99ed71254a08d9a0bce46c258c1e15ac3948 (patch) | |
tree | d0bf4afba63a246a295170d58f5e02b23c2cb28e /net/sched/sch_dsmark.c | |
parent | d20b3109e9d122460929c50b857fcde251706ece (diff) |
[PKT_SCHED] dsmark: get rid of wrappers
Remove extraneous macro wrappers for printk and qdisc_priv.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/sch_dsmark.c')
-rw-r--r-- | net/sched/sch_dsmark.c | 83 |
1 files changed, 34 insertions, 49 deletions
diff --git a/net/sched/sch_dsmark.c b/net/sched/sch_dsmark.c index b9fe6975fbec..a9732aef2ca1 100644 --- a/net/sched/sch_dsmark.c +++ b/net/sched/sch_dsmark.c | |||
@@ -15,23 +15,6 @@ | |||
15 | #include <net/inet_ecn.h> | 15 | #include <net/inet_ecn.h> |
16 | #include <asm/byteorder.h> | 16 | #include <asm/byteorder.h> |
17 | 17 | ||
18 | |||
19 | #if 0 /* control */ | ||
20 | #define DPRINTK(format,args...) printk(KERN_DEBUG format,##args) | ||
21 | #else | ||
22 | #define DPRINTK(format,args...) | ||
23 | #endif | ||
24 | |||
25 | #if 0 /* data */ | ||
26 | #define D2PRINTK(format,args...) printk(KERN_DEBUG format,##args) | ||
27 | #else | ||
28 | #define D2PRINTK(format,args...) | ||
29 | #endif | ||
30 | |||
31 | |||
32 | #define PRIV(sch) ((struct dsmark_qdisc_data *) qdisc_priv(sch)) | ||
33 | |||
34 | |||
35 | /* | 18 | /* |
36 | * classid class marking | 19 | * classid class marking |
37 | * ------- ----- ------- | 20 | * ------- ----- ------- |
@@ -81,9 +64,9 @@ static inline int dsmark_valid_index(struct dsmark_qdisc_data *p, u16 index) | |||
81 | static int dsmark_graft(struct Qdisc *sch, unsigned long arg, | 64 | static int dsmark_graft(struct Qdisc *sch, unsigned long arg, |
82 | struct Qdisc *new, struct Qdisc **old) | 65 | struct Qdisc *new, struct Qdisc **old) |
83 | { | 66 | { |
84 | struct dsmark_qdisc_data *p = PRIV(sch); | 67 | struct dsmark_qdisc_data *p = qdisc_priv(sch); |
85 | 68 | ||
86 | DPRINTK("dsmark_graft(sch %p,[qdisc %p],new %p,old %p)\n", | 69 | pr_debug("dsmark_graft(sch %p,[qdisc %p],new %p,old %p)\n", |
87 | sch, p, new, old); | 70 | sch, p, new, old); |
88 | 71 | ||
89 | if (new == NULL) { | 72 | if (new == NULL) { |
@@ -104,13 +87,14 @@ static int dsmark_graft(struct Qdisc *sch, unsigned long arg, | |||
104 | 87 | ||
105 | static struct Qdisc *dsmark_leaf(struct Qdisc *sch, unsigned long arg) | 88 | static struct Qdisc *dsmark_leaf(struct Qdisc *sch, unsigned long arg) |
106 | { | 89 | { |
107 | return PRIV(sch)->q; | 90 | struct dsmark_qdisc_data *p = qdisc_priv(sch); |
91 | return p->q; | ||
108 | } | 92 | } |
109 | 93 | ||
110 | static unsigned long dsmark_get(struct Qdisc *sch, u32 classid) | 94 | static unsigned long dsmark_get(struct Qdisc *sch, u32 classid) |
111 | { | 95 | { |
112 | DPRINTK("dsmark_get(sch %p,[qdisc %p],classid %x)\n", | 96 | pr_debug("dsmark_get(sch %p,[qdisc %p],classid %x)\n", |
113 | sch, PRIV(sch), classid); | 97 | sch, qdisc_priv(sch), classid); |
114 | 98 | ||
115 | return TC_H_MIN(classid) + 1; | 99 | return TC_H_MIN(classid) + 1; |
116 | } | 100 | } |
@@ -128,13 +112,13 @@ static void dsmark_put(struct Qdisc *sch, unsigned long cl) | |||
128 | static int dsmark_change(struct Qdisc *sch, u32 classid, u32 parent, | 112 | static int dsmark_change(struct Qdisc *sch, u32 classid, u32 parent, |
129 | struct rtattr **tca, unsigned long *arg) | 113 | struct rtattr **tca, unsigned long *arg) |
130 | { | 114 | { |
131 | struct dsmark_qdisc_data *p = PRIV(sch); | 115 | struct dsmark_qdisc_data *p = qdisc_priv(sch); |
132 | struct rtattr *opt = tca[TCA_OPTIONS-1]; | 116 | struct rtattr *opt = tca[TCA_OPTIONS-1]; |
133 | struct rtattr *tb[TCA_DSMARK_MAX]; | 117 | struct rtattr *tb[TCA_DSMARK_MAX]; |
134 | int err = -EINVAL; | 118 | int err = -EINVAL; |
135 | u8 mask = 0; | 119 | u8 mask = 0; |
136 | 120 | ||
137 | DPRINTK("dsmark_change(sch %p,[qdisc %p],classid %x,parent %x)," | 121 | pr_debug("dsmark_change(sch %p,[qdisc %p],classid %x,parent %x)," |
138 | "arg 0x%lx\n", sch, p, classid, parent, *arg); | 122 | "arg 0x%lx\n", sch, p, classid, parent, *arg); |
139 | 123 | ||
140 | if (!dsmark_valid_index(p, *arg)) { | 124 | if (!dsmark_valid_index(p, *arg)) { |
@@ -162,7 +146,7 @@ rtattr_failure: | |||
162 | 146 | ||
163 | static int dsmark_delete(struct Qdisc *sch, unsigned long arg) | 147 | static int dsmark_delete(struct Qdisc *sch, unsigned long arg) |
164 | { | 148 | { |
165 | struct dsmark_qdisc_data *p = PRIV(sch); | 149 | struct dsmark_qdisc_data *p = qdisc_priv(sch); |
166 | 150 | ||
167 | if (!dsmark_valid_index(p, arg)) | 151 | if (!dsmark_valid_index(p, arg)) |
168 | return -EINVAL; | 152 | return -EINVAL; |
@@ -175,10 +159,10 @@ static int dsmark_delete(struct Qdisc *sch, unsigned long arg) | |||
175 | 159 | ||
176 | static void dsmark_walk(struct Qdisc *sch,struct qdisc_walker *walker) | 160 | static void dsmark_walk(struct Qdisc *sch,struct qdisc_walker *walker) |
177 | { | 161 | { |
178 | struct dsmark_qdisc_data *p = PRIV(sch); | 162 | struct dsmark_qdisc_data *p = qdisc_priv(sch); |
179 | int i; | 163 | int i; |
180 | 164 | ||
181 | DPRINTK("dsmark_walk(sch %p,[qdisc %p],walker %p)\n", sch, p, walker); | 165 | pr_debug("dsmark_walk(sch %p,[qdisc %p],walker %p)\n", sch, p, walker); |
182 | 166 | ||
183 | if (walker->stop) | 167 | if (walker->stop) |
184 | return; | 168 | return; |
@@ -197,19 +181,20 @@ ignore: | |||
197 | } | 181 | } |
198 | } | 182 | } |
199 | 183 | ||
200 | static struct tcf_proto **dsmark_find_tcf(struct Qdisc *sch,unsigned long cl) | 184 | static inline struct tcf_proto **dsmark_find_tcf(struct Qdisc *sch,unsigned long cl) |
201 | { | 185 | { |
202 | return &PRIV(sch)->filter_list; | 186 | struct dsmark_qdisc_data *p = qdisc_priv(sch); |
187 | return &p->filter_list; | ||
203 | } | 188 | } |
204 | 189 | ||
205 | /* --------------------------- Qdisc operations ---------------------------- */ | 190 | /* --------------------------- Qdisc operations ---------------------------- */ |
206 | 191 | ||
207 | static int dsmark_enqueue(struct sk_buff *skb,struct Qdisc *sch) | 192 | static int dsmark_enqueue(struct sk_buff *skb,struct Qdisc *sch) |
208 | { | 193 | { |
209 | struct dsmark_qdisc_data *p = PRIV(sch); | 194 | struct dsmark_qdisc_data *p = qdisc_priv(sch); |
210 | int err; | 195 | int err; |
211 | 196 | ||
212 | D2PRINTK("dsmark_enqueue(skb %p,sch %p,[qdisc %p])\n", skb, sch, p); | 197 | pr_debug("dsmark_enqueue(skb %p,sch %p,[qdisc %p])\n", skb, sch, p); |
213 | 198 | ||
214 | if (p->set_tc_index) { | 199 | if (p->set_tc_index) { |
215 | /* FIXME: Safe with non-linear skbs? --RR */ | 200 | /* FIXME: Safe with non-linear skbs? --RR */ |
@@ -234,7 +219,7 @@ static int dsmark_enqueue(struct sk_buff *skb,struct Qdisc *sch) | |||
234 | struct tcf_result res; | 219 | struct tcf_result res; |
235 | int result = tc_classify(skb, p->filter_list, &res); | 220 | int result = tc_classify(skb, p->filter_list, &res); |
236 | 221 | ||
237 | D2PRINTK("result %d class 0x%04x\n", result, res.classid); | 222 | pr_debug("result %d class 0x%04x\n", result, res.classid); |
238 | 223 | ||
239 | switch (result) { | 224 | switch (result) { |
240 | #ifdef CONFIG_NET_CLS_ACT | 225 | #ifdef CONFIG_NET_CLS_ACT |
@@ -272,11 +257,11 @@ static int dsmark_enqueue(struct sk_buff *skb,struct Qdisc *sch) | |||
272 | 257 | ||
273 | static struct sk_buff *dsmark_dequeue(struct Qdisc *sch) | 258 | static struct sk_buff *dsmark_dequeue(struct Qdisc *sch) |
274 | { | 259 | { |
275 | struct dsmark_qdisc_data *p = PRIV(sch); | 260 | struct dsmark_qdisc_data *p = qdisc_priv(sch); |
276 | struct sk_buff *skb; | 261 | struct sk_buff *skb; |
277 | u32 index; | 262 | u32 index; |
278 | 263 | ||
279 | D2PRINTK("dsmark_dequeue(sch %p,[qdisc %p])\n", sch, p); | 264 | pr_debug("dsmark_dequeue(sch %p,[qdisc %p])\n", sch, p); |
280 | 265 | ||
281 | skb = p->q->ops->dequeue(p->q); | 266 | skb = p->q->ops->dequeue(p->q); |
282 | if (skb == NULL) | 267 | if (skb == NULL) |
@@ -285,7 +270,7 @@ static struct sk_buff *dsmark_dequeue(struct Qdisc *sch) | |||
285 | sch->q.qlen--; | 270 | sch->q.qlen--; |
286 | 271 | ||
287 | index = skb->tc_index & (p->indices - 1); | 272 | index = skb->tc_index & (p->indices - 1); |
288 | D2PRINTK("index %d->%d\n", skb->tc_index, index); | 273 | pr_debug("index %d->%d\n", skb->tc_index, index); |
289 | 274 | ||
290 | switch (skb->protocol) { | 275 | switch (skb->protocol) { |
291 | case __constant_htons(ETH_P_IP): | 276 | case __constant_htons(ETH_P_IP): |
@@ -314,10 +299,10 @@ static struct sk_buff *dsmark_dequeue(struct Qdisc *sch) | |||
314 | 299 | ||
315 | static int dsmark_requeue(struct sk_buff *skb,struct Qdisc *sch) | 300 | static int dsmark_requeue(struct sk_buff *skb,struct Qdisc *sch) |
316 | { | 301 | { |
317 | struct dsmark_qdisc_data *p = PRIV(sch); | 302 | struct dsmark_qdisc_data *p = qdisc_priv(sch); |
318 | int err; | 303 | int err; |
319 | 304 | ||
320 | D2PRINTK("dsmark_requeue(skb %p,sch %p,[qdisc %p])\n", skb, sch, p); | 305 | pr_debug("dsmark_requeue(skb %p,sch %p,[qdisc %p])\n", skb, sch, p); |
321 | 306 | ||
322 | err = p->q->ops->requeue(skb, p->q); | 307 | err = p->q->ops->requeue(skb, p->q); |
323 | if (err != NET_XMIT_SUCCESS) { | 308 | if (err != NET_XMIT_SUCCESS) { |
@@ -333,10 +318,10 @@ static int dsmark_requeue(struct sk_buff *skb,struct Qdisc *sch) | |||
333 | 318 | ||
334 | static unsigned int dsmark_drop(struct Qdisc *sch) | 319 | static unsigned int dsmark_drop(struct Qdisc *sch) |
335 | { | 320 | { |
336 | struct dsmark_qdisc_data *p = PRIV(sch); | 321 | struct dsmark_qdisc_data *p = qdisc_priv(sch); |
337 | unsigned int len; | 322 | unsigned int len; |
338 | 323 | ||
339 | DPRINTK("dsmark_reset(sch %p,[qdisc %p])\n", sch, p); | 324 | pr_debug("dsmark_reset(sch %p,[qdisc %p])\n", sch, p); |
340 | 325 | ||
341 | if (p->q->ops->drop == NULL) | 326 | if (p->q->ops->drop == NULL) |
342 | return 0; | 327 | return 0; |
@@ -350,14 +335,14 @@ static unsigned int dsmark_drop(struct Qdisc *sch) | |||
350 | 335 | ||
351 | static int dsmark_init(struct Qdisc *sch, struct rtattr *opt) | 336 | static int dsmark_init(struct Qdisc *sch, struct rtattr *opt) |
352 | { | 337 | { |
353 | struct dsmark_qdisc_data *p = PRIV(sch); | 338 | struct dsmark_qdisc_data *p = qdisc_priv(sch); |
354 | struct rtattr *tb[TCA_DSMARK_MAX]; | 339 | struct rtattr *tb[TCA_DSMARK_MAX]; |
355 | int err = -EINVAL; | 340 | int err = -EINVAL; |
356 | u32 default_index = NO_DEFAULT_INDEX; | 341 | u32 default_index = NO_DEFAULT_INDEX; |
357 | u16 indices; | 342 | u16 indices; |
358 | u8 *mask; | 343 | u8 *mask; |
359 | 344 | ||
360 | DPRINTK("dsmark_init(sch %p,[qdisc %p],opt %p)\n", sch, p, opt); | 345 | pr_debug("dsmark_init(sch %p,[qdisc %p],opt %p)\n", sch, p, opt); |
361 | 346 | ||
362 | if (!opt || rtattr_parse_nested(tb, TCA_DSMARK_MAX, opt) < 0) | 347 | if (!opt || rtattr_parse_nested(tb, TCA_DSMARK_MAX, opt) < 0) |
363 | goto errout; | 348 | goto errout; |
@@ -389,7 +374,7 @@ static int dsmark_init(struct Qdisc *sch, struct rtattr *opt) | |||
389 | if (p->q == NULL) | 374 | if (p->q == NULL) |
390 | p->q = &noop_qdisc; | 375 | p->q = &noop_qdisc; |
391 | 376 | ||
392 | DPRINTK("dsmark_init: qdisc %p\n", p->q); | 377 | pr_debug("dsmark_init: qdisc %p\n", p->q); |
393 | 378 | ||
394 | err = 0; | 379 | err = 0; |
395 | errout: | 380 | errout: |
@@ -399,18 +384,18 @@ rtattr_failure: | |||
399 | 384 | ||
400 | static void dsmark_reset(struct Qdisc *sch) | 385 | static void dsmark_reset(struct Qdisc *sch) |
401 | { | 386 | { |
402 | struct dsmark_qdisc_data *p = PRIV(sch); | 387 | struct dsmark_qdisc_data *p = qdisc_priv(sch); |
403 | 388 | ||
404 | DPRINTK("dsmark_reset(sch %p,[qdisc %p])\n", sch, p); | 389 | pr_debug("dsmark_reset(sch %p,[qdisc %p])\n", sch, p); |
405 | qdisc_reset(p->q); | 390 | qdisc_reset(p->q); |
406 | sch->q.qlen = 0; | 391 | sch->q.qlen = 0; |
407 | } | 392 | } |
408 | 393 | ||
409 | static void dsmark_destroy(struct Qdisc *sch) | 394 | static void dsmark_destroy(struct Qdisc *sch) |
410 | { | 395 | { |
411 | struct dsmark_qdisc_data *p = PRIV(sch); | 396 | struct dsmark_qdisc_data *p = qdisc_priv(sch); |
412 | 397 | ||
413 | DPRINTK("dsmark_destroy(sch %p,[qdisc %p])\n", sch, p); | 398 | pr_debug("dsmark_destroy(sch %p,[qdisc %p])\n", sch, p); |
414 | 399 | ||
415 | tcf_destroy_chain(p->filter_list); | 400 | tcf_destroy_chain(p->filter_list); |
416 | qdisc_destroy(p->q); | 401 | qdisc_destroy(p->q); |
@@ -420,10 +405,10 @@ static void dsmark_destroy(struct Qdisc *sch) | |||
420 | static int dsmark_dump_class(struct Qdisc *sch, unsigned long cl, | 405 | static int dsmark_dump_class(struct Qdisc *sch, unsigned long cl, |
421 | struct sk_buff *skb, struct tcmsg *tcm) | 406 | struct sk_buff *skb, struct tcmsg *tcm) |
422 | { | 407 | { |
423 | struct dsmark_qdisc_data *p = PRIV(sch); | 408 | struct dsmark_qdisc_data *p = qdisc_priv(sch); |
424 | struct rtattr *opts = NULL; | 409 | struct rtattr *opts = NULL; |
425 | 410 | ||
426 | DPRINTK("dsmark_dump_class(sch %p,[qdisc %p],class %ld\n", sch, p, cl); | 411 | pr_debug("dsmark_dump_class(sch %p,[qdisc %p],class %ld\n", sch, p, cl); |
427 | 412 | ||
428 | if (!dsmark_valid_index(p, cl)) | 413 | if (!dsmark_valid_index(p, cl)) |
429 | return -EINVAL; | 414 | return -EINVAL; |
@@ -443,7 +428,7 @@ rtattr_failure: | |||
443 | 428 | ||
444 | static int dsmark_dump(struct Qdisc *sch, struct sk_buff *skb) | 429 | static int dsmark_dump(struct Qdisc *sch, struct sk_buff *skb) |
445 | { | 430 | { |
446 | struct dsmark_qdisc_data *p = PRIV(sch); | 431 | struct dsmark_qdisc_data *p = qdisc_priv(sch); |
447 | struct rtattr *opts = NULL; | 432 | struct rtattr *opts = NULL; |
448 | 433 | ||
449 | opts = RTA_NEST(skb, TCA_OPTIONS); | 434 | opts = RTA_NEST(skb, TCA_OPTIONS); |