diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2008-01-21 05:26:41 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:08:42 -0500 |
commit | aa767bfea4828936fffb7800204294ba4c8ba283 (patch) | |
tree | 22108dfc08b78a928774bc099436f0300092332e /net/sched/cls_tcindex.c | |
parent | 786a90366f7571b5755d0e2773be9fe4cde80871 (diff) |
[PKT_SCHED] net classifier: style cleanup's
Classifier code cleanup. Get rid of printk wrapper, and fix whitespace
and other style stuff reported by checkpatch
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/cls_tcindex.c')
-rw-r--r-- | net/sched/cls_tcindex.c | 60 |
1 files changed, 24 insertions, 36 deletions
diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c index 2314820a080a..471909e54807 100644 --- a/net/sched/cls_tcindex.c +++ b/net/sched/cls_tcindex.c | |||
@@ -29,19 +29,6 @@ | |||
29 | #define DEFAULT_HASH_SIZE 64 /* optimized for diffserv */ | 29 | #define DEFAULT_HASH_SIZE 64 /* optimized for diffserv */ |
30 | 30 | ||
31 | 31 | ||
32 | #if 1 /* control */ | ||
33 | #define DPRINTK(format,args...) printk(KERN_DEBUG format,##args) | ||
34 | #else | ||
35 | #define DPRINTK(format,args...) | ||
36 | #endif | ||
37 | |||
38 | #if 0 /* data */ | ||
39 | #define D2PRINTK(format,args...) printk(KERN_DEBUG format,##args) | ||
40 | #else | ||
41 | #define D2PRINTK(format,args...) | ||
42 | #endif | ||
43 | |||
44 | |||
45 | #define PRIV(tp) ((struct tcindex_data *) (tp)->root) | 32 | #define PRIV(tp) ((struct tcindex_data *) (tp)->root) |
46 | 33 | ||
47 | 34 | ||
@@ -104,7 +91,8 @@ static int tcindex_classify(struct sk_buff *skb, struct tcf_proto *tp, | |||
104 | struct tcindex_filter_result *f; | 91 | struct tcindex_filter_result *f; |
105 | int key = (skb->tc_index & p->mask) >> p->shift; | 92 | int key = (skb->tc_index & p->mask) >> p->shift; |
106 | 93 | ||
107 | D2PRINTK("tcindex_classify(skb %p,tp %p,res %p),p %p\n",skb,tp,res,p); | 94 | pr_debug("tcindex_classify(skb %p,tp %p,res %p),p %p\n", |
95 | skb, tp, res, p); | ||
108 | 96 | ||
109 | f = tcindex_lookup(p, key); | 97 | f = tcindex_lookup(p, key); |
110 | if (!f) { | 98 | if (!f) { |
@@ -112,11 +100,11 @@ static int tcindex_classify(struct sk_buff *skb, struct tcf_proto *tp, | |||
112 | return -1; | 100 | return -1; |
113 | res->classid = TC_H_MAKE(TC_H_MAJ(tp->q->handle), key); | 101 | res->classid = TC_H_MAKE(TC_H_MAJ(tp->q->handle), key); |
114 | res->class = 0; | 102 | res->class = 0; |
115 | D2PRINTK("alg 0x%x\n",res->classid); | 103 | pr_debug("alg 0x%x\n", res->classid); |
116 | return 0; | 104 | return 0; |
117 | } | 105 | } |
118 | *res = f->res; | 106 | *res = f->res; |
119 | D2PRINTK("map 0x%x\n",res->classid); | 107 | pr_debug("map 0x%x\n", res->classid); |
120 | 108 | ||
121 | return tcf_exts_exec(skb, &f->exts, res); | 109 | return tcf_exts_exec(skb, &f->exts, res); |
122 | } | 110 | } |
@@ -127,7 +115,7 @@ static unsigned long tcindex_get(struct tcf_proto *tp, u32 handle) | |||
127 | struct tcindex_data *p = PRIV(tp); | 115 | struct tcindex_data *p = PRIV(tp); |
128 | struct tcindex_filter_result *r; | 116 | struct tcindex_filter_result *r; |
129 | 117 | ||
130 | DPRINTK("tcindex_get(tp %p,handle 0x%08x)\n",tp,handle); | 118 | pr_debug("tcindex_get(tp %p,handle 0x%08x)\n", tp, handle); |
131 | if (p->perfect && handle >= p->alloc_hash) | 119 | if (p->perfect && handle >= p->alloc_hash) |
132 | return 0; | 120 | return 0; |
133 | r = tcindex_lookup(p, handle); | 121 | r = tcindex_lookup(p, handle); |
@@ -137,7 +125,7 @@ static unsigned long tcindex_get(struct tcf_proto *tp, u32 handle) | |||
137 | 125 | ||
138 | static void tcindex_put(struct tcf_proto *tp, unsigned long f) | 126 | static void tcindex_put(struct tcf_proto *tp, unsigned long f) |
139 | { | 127 | { |
140 | DPRINTK("tcindex_put(tp %p,f 0x%lx)\n",tp,f); | 128 | pr_debug("tcindex_put(tp %p,f 0x%lx)\n", tp, f); |
141 | } | 129 | } |
142 | 130 | ||
143 | 131 | ||
@@ -145,8 +133,8 @@ static int tcindex_init(struct tcf_proto *tp) | |||
145 | { | 133 | { |
146 | struct tcindex_data *p; | 134 | struct tcindex_data *p; |
147 | 135 | ||
148 | DPRINTK("tcindex_init(tp %p)\n",tp); | 136 | pr_debug("tcindex_init(tp %p)\n", tp); |
149 | p = kzalloc(sizeof(struct tcindex_data),GFP_KERNEL); | 137 | p = kzalloc(sizeof(struct tcindex_data), GFP_KERNEL); |
150 | if (!p) | 138 | if (!p) |
151 | return -ENOMEM; | 139 | return -ENOMEM; |
152 | 140 | ||
@@ -166,7 +154,7 @@ __tcindex_delete(struct tcf_proto *tp, unsigned long arg, int lock) | |||
166 | struct tcindex_filter_result *r = (struct tcindex_filter_result *) arg; | 154 | struct tcindex_filter_result *r = (struct tcindex_filter_result *) arg; |
167 | struct tcindex_filter *f = NULL; | 155 | struct tcindex_filter *f = NULL; |
168 | 156 | ||
169 | DPRINTK("tcindex_delete(tp %p,arg 0x%lx),p %p,f %p\n",tp,arg,p,f); | 157 | pr_debug("tcindex_delete(tp %p,arg 0x%lx),p %p,f %p\n", tp, arg, p, f); |
170 | if (p->perfect) { | 158 | if (p->perfect) { |
171 | if (!r->res.class) | 159 | if (!r->res.class) |
172 | return -ENOENT; | 160 | return -ENOENT; |
@@ -363,7 +351,7 @@ tcindex_change(struct tcf_proto *tp, unsigned long base, u32 handle, | |||
363 | struct tcindex_data *p = PRIV(tp); | 351 | struct tcindex_data *p = PRIV(tp); |
364 | struct tcindex_filter_result *r = (struct tcindex_filter_result *) *arg; | 352 | struct tcindex_filter_result *r = (struct tcindex_filter_result *) *arg; |
365 | 353 | ||
366 | DPRINTK("tcindex_change(tp %p,handle 0x%08x,tca %p,arg %p),opt %p," | 354 | pr_debug("tcindex_change(tp %p,handle 0x%08x,tca %p,arg %p),opt %p," |
367 | "p %p,r %p,*arg 0x%lx\n", | 355 | "p %p,r %p,*arg 0x%lx\n", |
368 | tp, handle, tca, arg, opt, p, r, arg ? *arg : 0L); | 356 | tp, handle, tca, arg, opt, p, r, arg ? *arg : 0L); |
369 | 357 | ||
@@ -380,10 +368,10 @@ tcindex_change(struct tcf_proto *tp, unsigned long base, u32 handle, | |||
380 | static void tcindex_walk(struct tcf_proto *tp, struct tcf_walker *walker) | 368 | static void tcindex_walk(struct tcf_proto *tp, struct tcf_walker *walker) |
381 | { | 369 | { |
382 | struct tcindex_data *p = PRIV(tp); | 370 | struct tcindex_data *p = PRIV(tp); |
383 | struct tcindex_filter *f,*next; | 371 | struct tcindex_filter *f, *next; |
384 | int i; | 372 | int i; |
385 | 373 | ||
386 | DPRINTK("tcindex_walk(tp %p,walker %p),p %p\n",tp,walker,p); | 374 | pr_debug("tcindex_walk(tp %p,walker %p),p %p\n", tp, walker, p); |
387 | if (p->perfect) { | 375 | if (p->perfect) { |
388 | for (i = 0; i < p->hash; i++) { | 376 | for (i = 0; i < p->hash; i++) { |
389 | if (!p->perfect[i].res.class) | 377 | if (!p->perfect[i].res.class) |
@@ -405,7 +393,7 @@ static void tcindex_walk(struct tcf_proto *tp, struct tcf_walker *walker) | |||
405 | for (f = p->h[i]; f; f = next) { | 393 | for (f = p->h[i]; f; f = next) { |
406 | next = f->next; | 394 | next = f->next; |
407 | if (walker->count >= walker->skip) { | 395 | if (walker->count >= walker->skip) { |
408 | if (walker->fn(tp,(unsigned long) &f->result, | 396 | if (walker->fn(tp, (unsigned long) &f->result, |
409 | walker) < 0) { | 397 | walker) < 0) { |
410 | walker->stop = 1; | 398 | walker->stop = 1; |
411 | return; | 399 | return; |
@@ -429,11 +417,11 @@ static void tcindex_destroy(struct tcf_proto *tp) | |||
429 | struct tcindex_data *p = PRIV(tp); | 417 | struct tcindex_data *p = PRIV(tp); |
430 | struct tcf_walker walker; | 418 | struct tcf_walker walker; |
431 | 419 | ||
432 | DPRINTK("tcindex_destroy(tp %p),p %p\n",tp,p); | 420 | pr_debug("tcindex_destroy(tp %p),p %p\n", tp, p); |
433 | walker.count = 0; | 421 | walker.count = 0; |
434 | walker.skip = 0; | 422 | walker.skip = 0; |
435 | walker.fn = &tcindex_destroy_element; | 423 | walker.fn = &tcindex_destroy_element; |
436 | tcindex_walk(tp,&walker); | 424 | tcindex_walk(tp, &walker); |
437 | kfree(p->perfect); | 425 | kfree(p->perfect); |
438 | kfree(p->h); | 426 | kfree(p->h); |
439 | kfree(p); | 427 | kfree(p); |
@@ -449,17 +437,17 @@ static int tcindex_dump(struct tcf_proto *tp, unsigned long fh, | |||
449 | unsigned char *b = skb_tail_pointer(skb); | 437 | unsigned char *b = skb_tail_pointer(skb); |
450 | struct rtattr *rta; | 438 | struct rtattr *rta; |
451 | 439 | ||
452 | DPRINTK("tcindex_dump(tp %p,fh 0x%lx,skb %p,t %p),p %p,r %p,b %p\n", | 440 | pr_debug("tcindex_dump(tp %p,fh 0x%lx,skb %p,t %p),p %p,r %p,b %p\n", |
453 | tp,fh,skb,t,p,r,b); | 441 | tp, fh, skb, t, p, r, b); |
454 | DPRINTK("p->perfect %p p->h %p\n",p->perfect,p->h); | 442 | pr_debug("p->perfect %p p->h %p\n", p->perfect, p->h); |
455 | rta = (struct rtattr *) b; | 443 | rta = (struct rtattr *) b; |
456 | RTA_PUT(skb,TCA_OPTIONS,0,NULL); | 444 | RTA_PUT(skb, TCA_OPTIONS, 0, NULL); |
457 | if (!fh) { | 445 | if (!fh) { |
458 | t->tcm_handle = ~0; /* whatever ... */ | 446 | t->tcm_handle = ~0; /* whatever ... */ |
459 | RTA_PUT(skb,TCA_TCINDEX_HASH,sizeof(p->hash),&p->hash); | 447 | RTA_PUT(skb, TCA_TCINDEX_HASH, sizeof(p->hash), &p->hash); |
460 | RTA_PUT(skb,TCA_TCINDEX_MASK,sizeof(p->mask),&p->mask); | 448 | RTA_PUT(skb, TCA_TCINDEX_MASK, sizeof(p->mask), &p->mask); |
461 | RTA_PUT(skb,TCA_TCINDEX_SHIFT,sizeof(p->shift),&p->shift); | 449 | RTA_PUT(skb, TCA_TCINDEX_SHIFT, sizeof(p->shift), &p->shift); |
462 | RTA_PUT(skb,TCA_TCINDEX_FALL_THROUGH,sizeof(p->fall_through), | 450 | RTA_PUT(skb, TCA_TCINDEX_FALL_THROUGH, sizeof(p->fall_through), |
463 | &p->fall_through); | 451 | &p->fall_through); |
464 | rta->rta_len = skb_tail_pointer(skb) - b; | 452 | rta->rta_len = skb_tail_pointer(skb) - b; |
465 | } else { | 453 | } else { |
@@ -478,7 +466,7 @@ static int tcindex_dump(struct tcf_proto *tp, unsigned long fh, | |||
478 | } | 466 | } |
479 | } | 467 | } |
480 | } | 468 | } |
481 | DPRINTK("handle = %d\n",t->tcm_handle); | 469 | pr_debug("handle = %d\n", t->tcm_handle); |
482 | if (r->res.class) | 470 | if (r->res.class) |
483 | RTA_PUT(skb, TCA_TCINDEX_CLASSID, 4, &r->res.classid); | 471 | RTA_PUT(skb, TCA_TCINDEX_CLASSID, 4, &r->res.classid); |
484 | 472 | ||