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 | |
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>
-rw-r--r-- | net/sched/cls_api.c | 100 | ||||
-rw-r--r-- | net/sched/cls_tcindex.c | 60 |
2 files changed, 73 insertions, 87 deletions
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 80dccac769d0..e53773612bc7 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c | |||
@@ -29,12 +29,6 @@ | |||
29 | #include <net/pkt_sched.h> | 29 | #include <net/pkt_sched.h> |
30 | #include <net/pkt_cls.h> | 30 | #include <net/pkt_cls.h> |
31 | 31 | ||
32 | #if 0 /* control */ | ||
33 | #define DPRINTK(format,args...) printk(KERN_DEBUG format,##args) | ||
34 | #else | ||
35 | #define DPRINTK(format,args...) | ||
36 | #endif | ||
37 | |||
38 | /* The list of all installed classifier types */ | 32 | /* The list of all installed classifier types */ |
39 | 33 | ||
40 | static struct tcf_proto_ops *tcf_proto_base; | 34 | static struct tcf_proto_ops *tcf_proto_base; |
@@ -44,7 +38,7 @@ static DEFINE_RWLOCK(cls_mod_lock); | |||
44 | 38 | ||
45 | /* Find classifier type by string name */ | 39 | /* Find classifier type by string name */ |
46 | 40 | ||
47 | static struct tcf_proto_ops * tcf_proto_lookup_ops(struct rtattr *kind) | 41 | static struct tcf_proto_ops *tcf_proto_lookup_ops(struct rtattr *kind) |
48 | { | 42 | { |
49 | struct tcf_proto_ops *t = NULL; | 43 | struct tcf_proto_ops *t = NULL; |
50 | 44 | ||
@@ -81,6 +75,7 @@ out: | |||
81 | write_unlock(&cls_mod_lock); | 75 | write_unlock(&cls_mod_lock); |
82 | return rc; | 76 | return rc; |
83 | } | 77 | } |
78 | EXPORT_SYMBOL(register_tcf_proto_ops); | ||
84 | 79 | ||
85 | int unregister_tcf_proto_ops(struct tcf_proto_ops *ops) | 80 | int unregister_tcf_proto_ops(struct tcf_proto_ops *ops) |
86 | { | 81 | { |
@@ -100,6 +95,7 @@ out: | |||
100 | write_unlock(&cls_mod_lock); | 95 | write_unlock(&cls_mod_lock); |
101 | return rc; | 96 | return rc; |
102 | } | 97 | } |
98 | EXPORT_SYMBOL(unregister_tcf_proto_ops); | ||
103 | 99 | ||
104 | static int tfilter_notify(struct sk_buff *oskb, struct nlmsghdr *n, | 100 | static int tfilter_notify(struct sk_buff *oskb, struct nlmsghdr *n, |
105 | struct tcf_proto *tp, unsigned long fh, int event); | 101 | struct tcf_proto *tp, unsigned long fh, int event); |
@@ -107,9 +103,9 @@ static int tfilter_notify(struct sk_buff *oskb, struct nlmsghdr *n, | |||
107 | 103 | ||
108 | /* Select new prio value from the range, managed by kernel. */ | 104 | /* Select new prio value from the range, managed by kernel. */ |
109 | 105 | ||
110 | static __inline__ u32 tcf_auto_prio(struct tcf_proto *tp) | 106 | static inline u32 tcf_auto_prio(struct tcf_proto *tp) |
111 | { | 107 | { |
112 | u32 first = TC_H_MAKE(0xC0000000U,0U); | 108 | u32 first = TC_H_MAKE(0xC0000000U, 0U); |
113 | 109 | ||
114 | if (tp) | 110 | if (tp) |
115 | first = tp->prio-1; | 111 | first = tp->prio-1; |
@@ -154,21 +150,25 @@ replay: | |||
154 | /* If no priority is given, user wants we allocated it. */ | 150 | /* If no priority is given, user wants we allocated it. */ |
155 | if (n->nlmsg_type != RTM_NEWTFILTER || !(n->nlmsg_flags&NLM_F_CREATE)) | 151 | if (n->nlmsg_type != RTM_NEWTFILTER || !(n->nlmsg_flags&NLM_F_CREATE)) |
156 | return -ENOENT; | 152 | return -ENOENT; |
157 | prio = TC_H_MAKE(0x80000000U,0U); | 153 | prio = TC_H_MAKE(0x80000000U, 0U); |
158 | } | 154 | } |
159 | 155 | ||
160 | /* Find head of filter chain. */ | 156 | /* Find head of filter chain. */ |
161 | 157 | ||
162 | /* Find link */ | 158 | /* Find link */ |
163 | if ((dev = __dev_get_by_index(&init_net, t->tcm_ifindex)) == NULL) | 159 | dev = __dev_get_by_index(&init_net, t->tcm_ifindex); |
160 | if (dev == NULL) | ||
164 | return -ENODEV; | 161 | return -ENODEV; |
165 | 162 | ||
166 | /* Find qdisc */ | 163 | /* Find qdisc */ |
167 | if (!parent) { | 164 | if (!parent) { |
168 | q = dev->qdisc_sleeping; | 165 | q = dev->qdisc_sleeping; |
169 | parent = q->handle; | 166 | parent = q->handle; |
170 | } else if ((q = qdisc_lookup(dev, TC_H_MAJ(t->tcm_parent))) == NULL) | 167 | } else { |
171 | return -EINVAL; | 168 | q = qdisc_lookup(dev, TC_H_MAJ(t->tcm_parent)); |
169 | if (q == NULL) | ||
170 | return -EINVAL; | ||
171 | } | ||
172 | 172 | ||
173 | /* Is it classful? */ | 173 | /* Is it classful? */ |
174 | if ((cops = q->ops->cl_ops) == NULL) | 174 | if ((cops = q->ops->cl_ops) == NULL) |
@@ -213,7 +213,8 @@ replay: | |||
213 | /* Create new proto tcf */ | 213 | /* Create new proto tcf */ |
214 | 214 | ||
215 | err = -ENOBUFS; | 215 | err = -ENOBUFS; |
216 | if ((tp = kzalloc(sizeof(*tp), GFP_KERNEL)) == NULL) | 216 | tp = kzalloc(sizeof(*tp), GFP_KERNEL); |
217 | if (tp == NULL) | ||
217 | goto errout; | 218 | goto errout; |
218 | err = -EINVAL; | 219 | err = -EINVAL; |
219 | tp_ops = tcf_proto_lookup_ops(tca[TCA_KIND-1]); | 220 | tp_ops = tcf_proto_lookup_ops(tca[TCA_KIND-1]); |
@@ -249,7 +250,9 @@ replay: | |||
249 | tp->q = q; | 250 | tp->q = q; |
250 | tp->classify = tp_ops->classify; | 251 | tp->classify = tp_ops->classify; |
251 | tp->classid = parent; | 252 | tp->classid = parent; |
252 | if ((err = tp_ops->init(tp)) != 0) { | 253 | |
254 | err = tp_ops->init(tp); | ||
255 | if (err != 0) { | ||
253 | module_put(tp_ops->owner); | 256 | module_put(tp_ops->owner); |
254 | kfree(tp); | 257 | kfree(tp); |
255 | goto errout; | 258 | goto errout; |
@@ -278,13 +281,14 @@ replay: | |||
278 | } | 281 | } |
279 | 282 | ||
280 | err = -ENOENT; | 283 | err = -ENOENT; |
281 | if (n->nlmsg_type != RTM_NEWTFILTER || !(n->nlmsg_flags&NLM_F_CREATE)) | 284 | if (n->nlmsg_type != RTM_NEWTFILTER || |
285 | !(n->nlmsg_flags & NLM_F_CREATE)) | ||
282 | goto errout; | 286 | goto errout; |
283 | } else { | 287 | } else { |
284 | switch (n->nlmsg_type) { | 288 | switch (n->nlmsg_type) { |
285 | case RTM_NEWTFILTER: | 289 | case RTM_NEWTFILTER: |
286 | err = -EEXIST; | 290 | err = -EEXIST; |
287 | if (n->nlmsg_flags&NLM_F_EXCL) | 291 | if (n->nlmsg_flags & NLM_F_EXCL) |
288 | goto errout; | 292 | goto errout; |
289 | break; | 293 | break; |
290 | case RTM_DELTFILTER: | 294 | case RTM_DELTFILTER: |
@@ -314,9 +318,8 @@ errout: | |||
314 | return err; | 318 | return err; |
315 | } | 319 | } |
316 | 320 | ||
317 | static int | 321 | static int tcf_fill_node(struct sk_buff *skb, struct tcf_proto *tp, |
318 | tcf_fill_node(struct sk_buff *skb, struct tcf_proto *tp, unsigned long fh, | 322 | unsigned long fh, u32 pid, u32 seq, u16 flags, int event) |
319 | u32 pid, u32 seq, u16 flags, int event) | ||
320 | { | 323 | { |
321 | struct tcmsg *tcm; | 324 | struct tcmsg *tcm; |
322 | struct nlmsghdr *nlh; | 325 | struct nlmsghdr *nlh; |
@@ -361,19 +364,20 @@ static int tfilter_notify(struct sk_buff *oskb, struct nlmsghdr *n, | |||
361 | return -EINVAL; | 364 | return -EINVAL; |
362 | } | 365 | } |
363 | 366 | ||
364 | return rtnetlink_send(skb, &init_net, pid, RTNLGRP_TC, n->nlmsg_flags&NLM_F_ECHO); | 367 | return rtnetlink_send(skb, &init_net, pid, RTNLGRP_TC, |
368 | n->nlmsg_flags & NLM_F_ECHO); | ||
365 | } | 369 | } |
366 | 370 | ||
367 | struct tcf_dump_args | 371 | struct tcf_dump_args { |
368 | { | ||
369 | struct tcf_walker w; | 372 | struct tcf_walker w; |
370 | struct sk_buff *skb; | 373 | struct sk_buff *skb; |
371 | struct netlink_callback *cb; | 374 | struct netlink_callback *cb; |
372 | }; | 375 | }; |
373 | 376 | ||
374 | static int tcf_node_dump(struct tcf_proto *tp, unsigned long n, struct tcf_walker *arg) | 377 | static int tcf_node_dump(struct tcf_proto *tp, unsigned long n, |
378 | struct tcf_walker *arg) | ||
375 | { | 379 | { |
376 | struct tcf_dump_args *a = (void*)arg; | 380 | struct tcf_dump_args *a = (void *)arg; |
377 | 381 | ||
378 | return tcf_fill_node(a->skb, tp, n, NETLINK_CB(a->cb->skb).pid, | 382 | return tcf_fill_node(a->skb, tp, n, NETLINK_CB(a->cb->skb).pid, |
379 | a->cb->nlh->nlmsg_seq, NLM_F_MULTI, RTM_NEWTFILTER); | 383 | a->cb->nlh->nlmsg_seq, NLM_F_MULTI, RTM_NEWTFILTER); |
@@ -387,7 +391,7 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb) | |||
387 | struct net_device *dev; | 391 | struct net_device *dev; |
388 | struct Qdisc *q; | 392 | struct Qdisc *q; |
389 | struct tcf_proto *tp, **chain; | 393 | struct tcf_proto *tp, **chain; |
390 | struct tcmsg *tcm = (struct tcmsg*)NLMSG_DATA(cb->nlh); | 394 | struct tcmsg *tcm = (struct tcmsg *)NLMSG_DATA(cb->nlh); |
391 | unsigned long cl = 0; | 395 | unsigned long cl = 0; |
392 | const struct Qdisc_class_ops *cops; | 396 | const struct Qdisc_class_ops *cops; |
393 | struct tcf_dump_args arg; | 397 | struct tcf_dump_args arg; |
@@ -431,9 +435,10 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb) | |||
431 | memset(&cb->args[1], 0, sizeof(cb->args)-sizeof(cb->args[0])); | 435 | memset(&cb->args[1], 0, sizeof(cb->args)-sizeof(cb->args[0])); |
432 | if (cb->args[1] == 0) { | 436 | if (cb->args[1] == 0) { |
433 | if (tcf_fill_node(skb, tp, 0, NETLINK_CB(cb->skb).pid, | 437 | if (tcf_fill_node(skb, tp, 0, NETLINK_CB(cb->skb).pid, |
434 | cb->nlh->nlmsg_seq, NLM_F_MULTI, RTM_NEWTFILTER) <= 0) { | 438 | cb->nlh->nlmsg_seq, NLM_F_MULTI, |
439 | RTM_NEWTFILTER) <= 0) | ||
435 | break; | 440 | break; |
436 | } | 441 | |
437 | cb->args[1] = 1; | 442 | cb->args[1] = 1; |
438 | } | 443 | } |
439 | if (tp->ops->walk == NULL) | 444 | if (tp->ops->walk == NULL) |
@@ -460,8 +465,7 @@ out: | |||
460 | return skb->len; | 465 | return skb->len; |
461 | } | 466 | } |
462 | 467 | ||
463 | void | 468 | void tcf_exts_destroy(struct tcf_proto *tp, struct tcf_exts *exts) |
464 | tcf_exts_destroy(struct tcf_proto *tp, struct tcf_exts *exts) | ||
465 | { | 469 | { |
466 | #ifdef CONFIG_NET_CLS_ACT | 470 | #ifdef CONFIG_NET_CLS_ACT |
467 | if (exts->action) { | 471 | if (exts->action) { |
@@ -470,10 +474,9 @@ tcf_exts_destroy(struct tcf_proto *tp, struct tcf_exts *exts) | |||
470 | } | 474 | } |
471 | #endif | 475 | #endif |
472 | } | 476 | } |
477 | EXPORT_SYMBOL(tcf_exts_destroy); | ||
473 | 478 | ||
474 | 479 | int tcf_exts_validate(struct tcf_proto *tp, struct rtattr **tb, | |
475 | int | ||
476 | tcf_exts_validate(struct tcf_proto *tp, struct rtattr **tb, | ||
477 | struct rtattr *rate_tlv, struct tcf_exts *exts, | 480 | struct rtattr *rate_tlv, struct tcf_exts *exts, |
478 | struct tcf_ext_map *map) | 481 | struct tcf_ext_map *map) |
479 | { | 482 | { |
@@ -485,8 +488,9 @@ tcf_exts_validate(struct tcf_proto *tp, struct rtattr **tb, | |||
485 | struct tc_action *act; | 488 | struct tc_action *act; |
486 | 489 | ||
487 | if (map->police && tb[map->police-1]) { | 490 | if (map->police && tb[map->police-1]) { |
488 | act = tcf_action_init_1(tb[map->police-1], rate_tlv, "police", | 491 | act = tcf_action_init_1(tb[map->police-1], rate_tlv, |
489 | TCA_ACT_NOREPLACE, TCA_ACT_BIND, &err); | 492 | "police", TCA_ACT_NOREPLACE, |
493 | TCA_ACT_BIND, &err); | ||
490 | if (act == NULL) | 494 | if (act == NULL) |
491 | return err; | 495 | return err; |
492 | 496 | ||
@@ -509,10 +513,10 @@ tcf_exts_validate(struct tcf_proto *tp, struct rtattr **tb, | |||
509 | 513 | ||
510 | return 0; | 514 | return 0; |
511 | } | 515 | } |
516 | EXPORT_SYMBOL(tcf_exts_validate); | ||
512 | 517 | ||
513 | void | 518 | void tcf_exts_change(struct tcf_proto *tp, struct tcf_exts *dst, |
514 | tcf_exts_change(struct tcf_proto *tp, struct tcf_exts *dst, | 519 | struct tcf_exts *src) |
515 | struct tcf_exts *src) | ||
516 | { | 520 | { |
517 | #ifdef CONFIG_NET_CLS_ACT | 521 | #ifdef CONFIG_NET_CLS_ACT |
518 | if (src->action) { | 522 | if (src->action) { |
@@ -525,9 +529,9 @@ tcf_exts_change(struct tcf_proto *tp, struct tcf_exts *dst, | |||
525 | } | 529 | } |
526 | #endif | 530 | #endif |
527 | } | 531 | } |
532 | EXPORT_SYMBOL(tcf_exts_change); | ||
528 | 533 | ||
529 | int | 534 | int tcf_exts_dump(struct sk_buff *skb, struct tcf_exts *exts, |
530 | tcf_exts_dump(struct sk_buff *skb, struct tcf_exts *exts, | ||
531 | struct tcf_ext_map *map) | 535 | struct tcf_ext_map *map) |
532 | { | 536 | { |
533 | #ifdef CONFIG_NET_CLS_ACT | 537 | #ifdef CONFIG_NET_CLS_ACT |
@@ -556,10 +560,11 @@ tcf_exts_dump(struct sk_buff *skb, struct tcf_exts *exts, | |||
556 | rtattr_failure: __attribute__ ((unused)) | 560 | rtattr_failure: __attribute__ ((unused)) |
557 | return -1; | 561 | return -1; |
558 | } | 562 | } |
563 | EXPORT_SYMBOL(tcf_exts_dump); | ||
559 | 564 | ||
560 | int | 565 | |
561 | tcf_exts_dump_stats(struct sk_buff *skb, struct tcf_exts *exts, | 566 | int tcf_exts_dump_stats(struct sk_buff *skb, struct tcf_exts *exts, |
562 | struct tcf_ext_map *map) | 567 | struct tcf_ext_map *map) |
563 | { | 568 | { |
564 | #ifdef CONFIG_NET_CLS_ACT | 569 | #ifdef CONFIG_NET_CLS_ACT |
565 | if (exts->action) | 570 | if (exts->action) |
@@ -570,6 +575,7 @@ tcf_exts_dump_stats(struct sk_buff *skb, struct tcf_exts *exts, | |||
570 | rtattr_failure: __attribute__ ((unused)) | 575 | rtattr_failure: __attribute__ ((unused)) |
571 | return -1; | 576 | return -1; |
572 | } | 577 | } |
578 | EXPORT_SYMBOL(tcf_exts_dump_stats); | ||
573 | 579 | ||
574 | static int __init tc_filter_init(void) | 580 | static int __init tc_filter_init(void) |
575 | { | 581 | { |
@@ -582,11 +588,3 @@ static int __init tc_filter_init(void) | |||
582 | } | 588 | } |
583 | 589 | ||
584 | subsys_initcall(tc_filter_init); | 590 | subsys_initcall(tc_filter_init); |
585 | |||
586 | EXPORT_SYMBOL(register_tcf_proto_ops); | ||
587 | EXPORT_SYMBOL(unregister_tcf_proto_ops); | ||
588 | EXPORT_SYMBOL(tcf_exts_validate); | ||
589 | EXPORT_SYMBOL(tcf_exts_destroy); | ||
590 | EXPORT_SYMBOL(tcf_exts_change); | ||
591 | EXPORT_SYMBOL(tcf_exts_dump); | ||
592 | EXPORT_SYMBOL(tcf_exts_dump_stats); | ||
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 | ||