diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2008-01-21 05:25:29 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:08:41 -0500 |
commit | 786a90366f7571b5755d0e2773be9fe4cde80871 (patch) | |
tree | 0f598353cfe98e26698368d2fdd5dba27f3b6785 | |
parent | 9d127fbdd26f9f16c41893b5f85b38321980e096 (diff) |
[PKT_SCHED] sch_atm: style cleanup
ATM scheduler clean house:
* get rid of printk and qdisc_priv() wrapper
* split some assignment in if() statements
* whitespace and line breaks.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/sched/sch_atm.c | 139 |
1 files changed, 65 insertions, 74 deletions
diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c index d870a4115d9a..734be9d37d46 100644 --- a/net/sched/sch_atm.c +++ b/net/sched/sch_atm.c | |||
@@ -16,18 +16,6 @@ | |||
16 | 16 | ||
17 | extern struct socket *sockfd_lookup(int fd, int *err); /* @@@ fix this */ | 17 | extern struct socket *sockfd_lookup(int fd, int *err); /* @@@ fix this */ |
18 | 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 | /* | 19 | /* |
32 | * The ATM queuing discipline provides a framework for invoking classifiers | 20 | * The ATM queuing discipline provides a framework for invoking classifiers |
33 | * (aka "filters"), which in turn select classes of this queuing discipline. | 21 | * (aka "filters"), which in turn select classes of this queuing discipline. |
@@ -49,7 +37,6 @@ extern struct socket *sockfd_lookup(int fd, int *err); /* @@@ fix this */ | |||
49 | * - should lock the flow while there is data in the queue (?) | 37 | * - should lock the flow while there is data in the queue (?) |
50 | */ | 38 | */ |
51 | 39 | ||
52 | #define PRIV(sch) qdisc_priv(sch) | ||
53 | #define VCC2FLOW(vcc) ((struct atm_flow_data *) ((vcc)->user_back)) | 40 | #define VCC2FLOW(vcc) ((struct atm_flow_data *) ((vcc)->user_back)) |
54 | 41 | ||
55 | struct atm_flow_data { | 42 | struct atm_flow_data { |
@@ -57,7 +44,7 @@ struct atm_flow_data { | |||
57 | struct tcf_proto *filter_list; | 44 | struct tcf_proto *filter_list; |
58 | struct atm_vcc *vcc; /* VCC; NULL if VCC is closed */ | 45 | struct atm_vcc *vcc; /* VCC; NULL if VCC is closed */ |
59 | void (*old_pop)(struct atm_vcc *vcc, | 46 | void (*old_pop)(struct atm_vcc *vcc, |
60 | struct sk_buff * skb); /* chaining */ | 47 | struct sk_buff *skb); /* chaining */ |
61 | struct atm_qdisc_data *parent; /* parent qdisc */ | 48 | struct atm_qdisc_data *parent; /* parent qdisc */ |
62 | struct socket *sock; /* for closing */ | 49 | struct socket *sock; /* for closing */ |
63 | u32 classid; /* x:y type ID */ | 50 | u32 classid; /* x:y type ID */ |
@@ -84,17 +71,17 @@ static int find_flow(struct atm_qdisc_data *qdisc, struct atm_flow_data *flow) | |||
84 | { | 71 | { |
85 | struct atm_flow_data *walk; | 72 | struct atm_flow_data *walk; |
86 | 73 | ||
87 | DPRINTK("find_flow(qdisc %p,flow %p)\n", qdisc, flow); | 74 | pr_debug("find_flow(qdisc %p,flow %p)\n", qdisc, flow); |
88 | for (walk = qdisc->flows; walk; walk = walk->next) | 75 | for (walk = qdisc->flows; walk; walk = walk->next) |
89 | if (walk == flow) | 76 | if (walk == flow) |
90 | return 1; | 77 | return 1; |
91 | DPRINTK("find_flow: not found\n"); | 78 | pr_debug("find_flow: not found\n"); |
92 | return 0; | 79 | return 0; |
93 | } | 80 | } |
94 | 81 | ||
95 | static inline struct atm_flow_data *lookup_flow(struct Qdisc *sch, u32 classid) | 82 | static inline struct atm_flow_data *lookup_flow(struct Qdisc *sch, u32 classid) |
96 | { | 83 | { |
97 | struct atm_qdisc_data *p = PRIV(sch); | 84 | struct atm_qdisc_data *p = qdisc_priv(sch); |
98 | struct atm_flow_data *flow; | 85 | struct atm_flow_data *flow; |
99 | 86 | ||
100 | for (flow = p->flows; flow; flow = flow->next) | 87 | for (flow = p->flows; flow; flow = flow->next) |
@@ -106,10 +93,10 @@ static inline struct atm_flow_data *lookup_flow(struct Qdisc *sch, u32 classid) | |||
106 | static int atm_tc_graft(struct Qdisc *sch, unsigned long arg, | 93 | static int atm_tc_graft(struct Qdisc *sch, unsigned long arg, |
107 | struct Qdisc *new, struct Qdisc **old) | 94 | struct Qdisc *new, struct Qdisc **old) |
108 | { | 95 | { |
109 | struct atm_qdisc_data *p = PRIV(sch); | 96 | struct atm_qdisc_data *p = qdisc_priv(sch); |
110 | struct atm_flow_data *flow = (struct atm_flow_data *)arg; | 97 | struct atm_flow_data *flow = (struct atm_flow_data *)arg; |
111 | 98 | ||
112 | DPRINTK("atm_tc_graft(sch %p,[qdisc %p],flow %p,new %p,old %p)\n", | 99 | pr_debug("atm_tc_graft(sch %p,[qdisc %p],flow %p,new %p,old %p)\n", |
113 | sch, p, flow, new, old); | 100 | sch, p, flow, new, old); |
114 | if (!find_flow(p, flow)) | 101 | if (!find_flow(p, flow)) |
115 | return -EINVAL; | 102 | return -EINVAL; |
@@ -125,20 +112,20 @@ static struct Qdisc *atm_tc_leaf(struct Qdisc *sch, unsigned long cl) | |||
125 | { | 112 | { |
126 | struct atm_flow_data *flow = (struct atm_flow_data *)cl; | 113 | struct atm_flow_data *flow = (struct atm_flow_data *)cl; |
127 | 114 | ||
128 | DPRINTK("atm_tc_leaf(sch %p,flow %p)\n", sch, flow); | 115 | pr_debug("atm_tc_leaf(sch %p,flow %p)\n", sch, flow); |
129 | return flow ? flow->q : NULL; | 116 | return flow ? flow->q : NULL; |
130 | } | 117 | } |
131 | 118 | ||
132 | static unsigned long atm_tc_get(struct Qdisc *sch, u32 classid) | 119 | static unsigned long atm_tc_get(struct Qdisc *sch, u32 classid) |
133 | { | 120 | { |
134 | struct atm_qdisc_data *p __maybe_unused = PRIV(sch); | 121 | struct atm_qdisc_data *p __maybe_unused = qdisc_priv(sch); |
135 | struct atm_flow_data *flow; | 122 | struct atm_flow_data *flow; |
136 | 123 | ||
137 | DPRINTK("atm_tc_get(sch %p,[qdisc %p],classid %x)\n", sch, p, classid); | 124 | pr_debug("atm_tc_get(sch %p,[qdisc %p],classid %x)\n", sch, p, classid); |
138 | flow = lookup_flow(sch, classid); | 125 | flow = lookup_flow(sch, classid); |
139 | if (flow) | 126 | if (flow) |
140 | flow->ref++; | 127 | flow->ref++; |
141 | DPRINTK("atm_tc_get: flow %p\n", flow); | 128 | pr_debug("atm_tc_get: flow %p\n", flow); |
142 | return (unsigned long)flow; | 129 | return (unsigned long)flow; |
143 | } | 130 | } |
144 | 131 | ||
@@ -155,14 +142,14 @@ static unsigned long atm_tc_bind_filter(struct Qdisc *sch, | |||
155 | */ | 142 | */ |
156 | static void atm_tc_put(struct Qdisc *sch, unsigned long cl) | 143 | static void atm_tc_put(struct Qdisc *sch, unsigned long cl) |
157 | { | 144 | { |
158 | struct atm_qdisc_data *p = PRIV(sch); | 145 | struct atm_qdisc_data *p = qdisc_priv(sch); |
159 | struct atm_flow_data *flow = (struct atm_flow_data *)cl; | 146 | struct atm_flow_data *flow = (struct atm_flow_data *)cl; |
160 | struct atm_flow_data **prev; | 147 | struct atm_flow_data **prev; |
161 | 148 | ||
162 | DPRINTK("atm_tc_put(sch %p,[qdisc %p],flow %p)\n", sch, p, flow); | 149 | pr_debug("atm_tc_put(sch %p,[qdisc %p],flow %p)\n", sch, p, flow); |
163 | if (--flow->ref) | 150 | if (--flow->ref) |
164 | return; | 151 | return; |
165 | DPRINTK("atm_tc_put: destroying\n"); | 152 | pr_debug("atm_tc_put: destroying\n"); |
166 | for (prev = &p->flows; *prev; prev = &(*prev)->next) | 153 | for (prev = &p->flows; *prev; prev = &(*prev)->next) |
167 | if (*prev == flow) | 154 | if (*prev == flow) |
168 | break; | 155 | break; |
@@ -171,11 +158,11 @@ static void atm_tc_put(struct Qdisc *sch, unsigned long cl) | |||
171 | return; | 158 | return; |
172 | } | 159 | } |
173 | *prev = flow->next; | 160 | *prev = flow->next; |
174 | DPRINTK("atm_tc_put: qdisc %p\n", flow->q); | 161 | pr_debug("atm_tc_put: qdisc %p\n", flow->q); |
175 | qdisc_destroy(flow->q); | 162 | qdisc_destroy(flow->q); |
176 | tcf_destroy_chain(flow->filter_list); | 163 | tcf_destroy_chain(flow->filter_list); |
177 | if (flow->sock) { | 164 | if (flow->sock) { |
178 | DPRINTK("atm_tc_put: f_count %d\n", | 165 | pr_debug("atm_tc_put: f_count %d\n", |
179 | file_count(flow->sock->file)); | 166 | file_count(flow->sock->file)); |
180 | flow->vcc->pop = flow->old_pop; | 167 | flow->vcc->pop = flow->old_pop; |
181 | sockfd_put(flow->sock); | 168 | sockfd_put(flow->sock); |
@@ -194,7 +181,7 @@ static void sch_atm_pop(struct atm_vcc *vcc, struct sk_buff *skb) | |||
194 | { | 181 | { |
195 | struct atm_qdisc_data *p = VCC2FLOW(vcc)->parent; | 182 | struct atm_qdisc_data *p = VCC2FLOW(vcc)->parent; |
196 | 183 | ||
197 | D2PRINTK("sch_atm_pop(vcc %p,skb %p,[qdisc %p])\n", vcc, skb, p); | 184 | pr_debug("sch_atm_pop(vcc %p,skb %p,[qdisc %p])\n", vcc, skb, p); |
198 | VCC2FLOW(vcc)->old_pop(vcc, skb); | 185 | VCC2FLOW(vcc)->old_pop(vcc, skb); |
199 | tasklet_schedule(&p->task); | 186 | tasklet_schedule(&p->task); |
200 | } | 187 | } |
@@ -211,7 +198,7 @@ static const u8 llc_oui_ip[] = { | |||
211 | static int atm_tc_change(struct Qdisc *sch, u32 classid, u32 parent, | 198 | static int atm_tc_change(struct Qdisc *sch, u32 classid, u32 parent, |
212 | struct rtattr **tca, unsigned long *arg) | 199 | struct rtattr **tca, unsigned long *arg) |
213 | { | 200 | { |
214 | struct atm_qdisc_data *p = PRIV(sch); | 201 | struct atm_qdisc_data *p = qdisc_priv(sch); |
215 | struct atm_flow_data *flow = (struct atm_flow_data *)*arg; | 202 | struct atm_flow_data *flow = (struct atm_flow_data *)*arg; |
216 | struct atm_flow_data *excess = NULL; | 203 | struct atm_flow_data *excess = NULL; |
217 | struct rtattr *opt = tca[TCA_OPTIONS - 1]; | 204 | struct rtattr *opt = tca[TCA_OPTIONS - 1]; |
@@ -220,7 +207,7 @@ static int atm_tc_change(struct Qdisc *sch, u32 classid, u32 parent, | |||
220 | int fd, error, hdr_len; | 207 | int fd, error, hdr_len; |
221 | void *hdr; | 208 | void *hdr; |
222 | 209 | ||
223 | DPRINTK("atm_tc_change(sch %p,[qdisc %p],classid %x,parent %x," | 210 | pr_debug("atm_tc_change(sch %p,[qdisc %p],classid %x,parent %x," |
224 | "flow %p,opt %p)\n", sch, p, classid, parent, flow, opt); | 211 | "flow %p,opt %p)\n", sch, p, classid, parent, flow, opt); |
225 | /* | 212 | /* |
226 | * The concept of parents doesn't apply for this qdisc. | 213 | * The concept of parents doesn't apply for this qdisc. |
@@ -241,7 +228,7 @@ static int atm_tc_change(struct Qdisc *sch, u32 classid, u32 parent, | |||
241 | if (!tb[TCA_ATM_FD - 1] || RTA_PAYLOAD(tb[TCA_ATM_FD - 1]) < sizeof(fd)) | 228 | if (!tb[TCA_ATM_FD - 1] || RTA_PAYLOAD(tb[TCA_ATM_FD - 1]) < sizeof(fd)) |
242 | return -EINVAL; | 229 | return -EINVAL; |
243 | fd = *(int *)RTA_DATA(tb[TCA_ATM_FD - 1]); | 230 | fd = *(int *)RTA_DATA(tb[TCA_ATM_FD - 1]); |
244 | DPRINTK("atm_tc_change: fd %d\n", fd); | 231 | pr_debug("atm_tc_change: fd %d\n", fd); |
245 | if (tb[TCA_ATM_HDR - 1]) { | 232 | if (tb[TCA_ATM_HDR - 1]) { |
246 | hdr_len = RTA_PAYLOAD(tb[TCA_ATM_HDR - 1]); | 233 | hdr_len = RTA_PAYLOAD(tb[TCA_ATM_HDR - 1]); |
247 | hdr = RTA_DATA(tb[TCA_ATM_HDR - 1]); | 234 | hdr = RTA_DATA(tb[TCA_ATM_HDR - 1]); |
@@ -259,11 +246,12 @@ static int atm_tc_change(struct Qdisc *sch, u32 classid, u32 parent, | |||
259 | if (!excess) | 246 | if (!excess) |
260 | return -ENOENT; | 247 | return -ENOENT; |
261 | } | 248 | } |
262 | DPRINTK("atm_tc_change: type %d, payload %d, hdr_len %d\n", | 249 | pr_debug("atm_tc_change: type %d, payload %lu, hdr_len %d\n", |
263 | opt->rta_type, RTA_PAYLOAD(opt), hdr_len); | 250 | opt->rta_type, RTA_PAYLOAD(opt), hdr_len); |
264 | if (!(sock = sockfd_lookup(fd, &error))) | 251 | sock = sockfd_lookup(fd, &error); |
252 | if (!sock) | ||
265 | return error; /* f_count++ */ | 253 | return error; /* f_count++ */ |
266 | DPRINTK("atm_tc_change: f_count %d\n", file_count(sock->file)); | 254 | pr_debug("atm_tc_change: f_count %d\n", file_count(sock->file)); |
267 | if (sock->ops->family != PF_ATMSVC && sock->ops->family != PF_ATMPVC) { | 255 | if (sock->ops->family != PF_ATMSVC && sock->ops->family != PF_ATMPVC) { |
268 | error = -EPROTOTYPE; | 256 | error = -EPROTOTYPE; |
269 | goto err_out; | 257 | goto err_out; |
@@ -272,7 +260,7 @@ static int atm_tc_change(struct Qdisc *sch, u32 classid, u32 parent, | |||
272 | on vcc->send */ | 260 | on vcc->send */ |
273 | if (classid) { | 261 | if (classid) { |
274 | if (TC_H_MAJ(classid ^ sch->handle)) { | 262 | if (TC_H_MAJ(classid ^ sch->handle)) { |
275 | DPRINTK("atm_tc_change: classid mismatch\n"); | 263 | pr_debug("atm_tc_change: classid mismatch\n"); |
276 | error = -EINVAL; | 264 | error = -EINVAL; |
277 | goto err_out; | 265 | goto err_out; |
278 | } | 266 | } |
@@ -286,26 +274,28 @@ static int atm_tc_change(struct Qdisc *sch, u32 classid, u32 parent, | |||
286 | 274 | ||
287 | for (i = 1; i < 0x8000; i++) { | 275 | for (i = 1; i < 0x8000; i++) { |
288 | classid = TC_H_MAKE(sch->handle, 0x8000 | i); | 276 | classid = TC_H_MAKE(sch->handle, 0x8000 | i); |
289 | if (!(cl = atm_tc_get(sch, classid))) | 277 | cl = atm_tc_get(sch, classid); |
278 | if (!cl) | ||
290 | break; | 279 | break; |
291 | atm_tc_put(sch, cl); | 280 | atm_tc_put(sch, cl); |
292 | } | 281 | } |
293 | } | 282 | } |
294 | DPRINTK("atm_tc_change: new id %x\n", classid); | 283 | pr_debug("atm_tc_change: new id %x\n", classid); |
295 | flow = kzalloc(sizeof(struct atm_flow_data) + hdr_len, GFP_KERNEL); | 284 | flow = kzalloc(sizeof(struct atm_flow_data) + hdr_len, GFP_KERNEL); |
296 | DPRINTK("atm_tc_change: flow %p\n", flow); | 285 | pr_debug("atm_tc_change: flow %p\n", flow); |
297 | if (!flow) { | 286 | if (!flow) { |
298 | error = -ENOBUFS; | 287 | error = -ENOBUFS; |
299 | goto err_out; | 288 | goto err_out; |
300 | } | 289 | } |
301 | flow->filter_list = NULL; | 290 | flow->filter_list = NULL; |
302 | if (!(flow->q = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops, classid))) | 291 | flow->q = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops, classid); |
292 | if (!flow->q) | ||
303 | flow->q = &noop_qdisc; | 293 | flow->q = &noop_qdisc; |
304 | DPRINTK("atm_tc_change: qdisc %p\n", flow->q); | 294 | pr_debug("atm_tc_change: qdisc %p\n", flow->q); |
305 | flow->sock = sock; | 295 | flow->sock = sock; |
306 | flow->vcc = ATM_SD(sock); /* speedup */ | 296 | flow->vcc = ATM_SD(sock); /* speedup */ |
307 | flow->vcc->user_back = flow; | 297 | flow->vcc->user_back = flow; |
308 | DPRINTK("atm_tc_change: vcc %p\n", flow->vcc); | 298 | pr_debug("atm_tc_change: vcc %p\n", flow->vcc); |
309 | flow->old_pop = flow->vcc->pop; | 299 | flow->old_pop = flow->vcc->pop; |
310 | flow->parent = p; | 300 | flow->parent = p; |
311 | flow->vcc->pop = sch_atm_pop; | 301 | flow->vcc->pop = sch_atm_pop; |
@@ -330,11 +320,11 @@ err_out: | |||
330 | 320 | ||
331 | static int atm_tc_delete(struct Qdisc *sch, unsigned long arg) | 321 | static int atm_tc_delete(struct Qdisc *sch, unsigned long arg) |
332 | { | 322 | { |
333 | struct atm_qdisc_data *p = PRIV(sch); | 323 | struct atm_qdisc_data *p = qdisc_priv(sch); |
334 | struct atm_flow_data *flow = (struct atm_flow_data *)arg; | 324 | struct atm_flow_data *flow = (struct atm_flow_data *)arg; |
335 | 325 | ||
336 | DPRINTK("atm_tc_delete(sch %p,[qdisc %p],flow %p)\n", sch, p, flow); | 326 | pr_debug("atm_tc_delete(sch %p,[qdisc %p],flow %p)\n", sch, p, flow); |
337 | if (!find_flow(PRIV(sch), flow)) | 327 | if (!find_flow(qdisc_priv(sch), flow)) |
338 | return -EINVAL; | 328 | return -EINVAL; |
339 | if (flow->filter_list || flow == &p->link) | 329 | if (flow->filter_list || flow == &p->link) |
340 | return -EBUSY; | 330 | return -EBUSY; |
@@ -354,10 +344,10 @@ static int atm_tc_delete(struct Qdisc *sch, unsigned long arg) | |||
354 | 344 | ||
355 | static void atm_tc_walk(struct Qdisc *sch, struct qdisc_walker *walker) | 345 | static void atm_tc_walk(struct Qdisc *sch, struct qdisc_walker *walker) |
356 | { | 346 | { |
357 | struct atm_qdisc_data *p = PRIV(sch); | 347 | struct atm_qdisc_data *p = qdisc_priv(sch); |
358 | struct atm_flow_data *flow; | 348 | struct atm_flow_data *flow; |
359 | 349 | ||
360 | DPRINTK("atm_tc_walk(sch %p,[qdisc %p],walker %p)\n", sch, p, walker); | 350 | pr_debug("atm_tc_walk(sch %p,[qdisc %p],walker %p)\n", sch, p, walker); |
361 | if (walker->stop) | 351 | if (walker->stop) |
362 | return; | 352 | return; |
363 | for (flow = p->flows; flow; flow = flow->next) { | 353 | for (flow = p->flows; flow; flow = flow->next) { |
@@ -372,10 +362,10 @@ static void atm_tc_walk(struct Qdisc *sch, struct qdisc_walker *walker) | |||
372 | 362 | ||
373 | static struct tcf_proto **atm_tc_find_tcf(struct Qdisc *sch, unsigned long cl) | 363 | static struct tcf_proto **atm_tc_find_tcf(struct Qdisc *sch, unsigned long cl) |
374 | { | 364 | { |
375 | struct atm_qdisc_data *p = PRIV(sch); | 365 | struct atm_qdisc_data *p = qdisc_priv(sch); |
376 | struct atm_flow_data *flow = (struct atm_flow_data *)cl; | 366 | struct atm_flow_data *flow = (struct atm_flow_data *)cl; |
377 | 367 | ||
378 | DPRINTK("atm_tc_find_tcf(sch %p,[qdisc %p],flow %p)\n", sch, p, flow); | 368 | pr_debug("atm_tc_find_tcf(sch %p,[qdisc %p],flow %p)\n", sch, p, flow); |
379 | return flow ? &flow->filter_list : &p->link.filter_list; | 369 | return flow ? &flow->filter_list : &p->link.filter_list; |
380 | } | 370 | } |
381 | 371 | ||
@@ -383,13 +373,13 @@ static struct tcf_proto **atm_tc_find_tcf(struct Qdisc *sch, unsigned long cl) | |||
383 | 373 | ||
384 | static int atm_tc_enqueue(struct sk_buff *skb, struct Qdisc *sch) | 374 | static int atm_tc_enqueue(struct sk_buff *skb, struct Qdisc *sch) |
385 | { | 375 | { |
386 | struct atm_qdisc_data *p = PRIV(sch); | 376 | struct atm_qdisc_data *p = qdisc_priv(sch); |
387 | struct atm_flow_data *flow = NULL; /* @@@ */ | 377 | struct atm_flow_data *flow = NULL; /* @@@ */ |
388 | struct tcf_result res; | 378 | struct tcf_result res; |
389 | int result; | 379 | int result; |
390 | int ret = NET_XMIT_POLICED; | 380 | int ret = NET_XMIT_POLICED; |
391 | 381 | ||
392 | D2PRINTK("atm_tc_enqueue(skb %p,sch %p,[qdisc %p])\n", skb, sch, p); | 382 | pr_debug("atm_tc_enqueue(skb %p,sch %p,[qdisc %p])\n", skb, sch, p); |
393 | result = TC_POLICE_OK; /* be nice to gcc */ | 383 | result = TC_POLICE_OK; /* be nice to gcc */ |
394 | if (TC_H_MAJ(skb->priority) != sch->handle || | 384 | if (TC_H_MAJ(skb->priority) != sch->handle || |
395 | !(flow = (struct atm_flow_data *)atm_tc_get(sch, skb->priority))) | 385 | !(flow = (struct atm_flow_data *)atm_tc_get(sch, skb->priority))) |
@@ -430,7 +420,8 @@ static int atm_tc_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
430 | #endif | 420 | #endif |
431 | } | 421 | } |
432 | 422 | ||
433 | if ((ret = flow->q->enqueue(skb, flow->q)) != 0) { | 423 | ret = flow->q->enqueue(skb, flow->q); |
424 | if (ret != 0) { | ||
434 | drop: __maybe_unused | 425 | drop: __maybe_unused |
435 | sch->qstats.drops++; | 426 | sch->qstats.drops++; |
436 | if (flow) | 427 | if (flow) |
@@ -468,11 +459,11 @@ drop: __maybe_unused | |||
468 | static void sch_atm_dequeue(unsigned long data) | 459 | static void sch_atm_dequeue(unsigned long data) |
469 | { | 460 | { |
470 | struct Qdisc *sch = (struct Qdisc *)data; | 461 | struct Qdisc *sch = (struct Qdisc *)data; |
471 | struct atm_qdisc_data *p = PRIV(sch); | 462 | struct atm_qdisc_data *p = qdisc_priv(sch); |
472 | struct atm_flow_data *flow; | 463 | struct atm_flow_data *flow; |
473 | struct sk_buff *skb; | 464 | struct sk_buff *skb; |
474 | 465 | ||
475 | D2PRINTK("sch_atm_dequeue(sch %p,[qdisc %p])\n", sch, p); | 466 | pr_debug("sch_atm_dequeue(sch %p,[qdisc %p])\n", sch, p); |
476 | for (flow = p->link.next; flow; flow = flow->next) | 467 | for (flow = p->link.next; flow; flow = flow->next) |
477 | /* | 468 | /* |
478 | * If traffic is properly shaped, this won't generate nasty | 469 | * If traffic is properly shaped, this won't generate nasty |
@@ -483,7 +474,7 @@ static void sch_atm_dequeue(unsigned long data) | |||
483 | (void)flow->q->ops->requeue(skb, flow->q); | 474 | (void)flow->q->ops->requeue(skb, flow->q); |
484 | break; | 475 | break; |
485 | } | 476 | } |
486 | D2PRINTK("atm_tc_dequeue: sending on class %p\n", flow); | 477 | pr_debug("atm_tc_dequeue: sending on class %p\n", flow); |
487 | /* remove any LL header somebody else has attached */ | 478 | /* remove any LL header somebody else has attached */ |
488 | skb_pull(skb, skb_network_offset(skb)); | 479 | skb_pull(skb, skb_network_offset(skb)); |
489 | if (skb_headroom(skb) < flow->hdr_len) { | 480 | if (skb_headroom(skb) < flow->hdr_len) { |
@@ -495,7 +486,7 @@ static void sch_atm_dequeue(unsigned long data) | |||
495 | continue; | 486 | continue; |
496 | skb = new; | 487 | skb = new; |
497 | } | 488 | } |
498 | D2PRINTK("sch_atm_dequeue: ip %p, data %p\n", | 489 | pr_debug("sch_atm_dequeue: ip %p, data %p\n", |
499 | skb_network_header(skb), skb->data); | 490 | skb_network_header(skb), skb->data); |
500 | ATM_SKB(skb)->vcc = flow->vcc; | 491 | ATM_SKB(skb)->vcc = flow->vcc; |
501 | memcpy(skb_push(skb, flow->hdr_len), flow->hdr, | 492 | memcpy(skb_push(skb, flow->hdr_len), flow->hdr, |
@@ -509,10 +500,10 @@ static void sch_atm_dequeue(unsigned long data) | |||
509 | 500 | ||
510 | static struct sk_buff *atm_tc_dequeue(struct Qdisc *sch) | 501 | static struct sk_buff *atm_tc_dequeue(struct Qdisc *sch) |
511 | { | 502 | { |
512 | struct atm_qdisc_data *p = PRIV(sch); | 503 | struct atm_qdisc_data *p = qdisc_priv(sch); |
513 | struct sk_buff *skb; | 504 | struct sk_buff *skb; |
514 | 505 | ||
515 | D2PRINTK("atm_tc_dequeue(sch %p,[qdisc %p])\n", sch, p); | 506 | pr_debug("atm_tc_dequeue(sch %p,[qdisc %p])\n", sch, p); |
516 | tasklet_schedule(&p->task); | 507 | tasklet_schedule(&p->task); |
517 | skb = p->link.q->dequeue(p->link.q); | 508 | skb = p->link.q->dequeue(p->link.q); |
518 | if (skb) | 509 | if (skb) |
@@ -522,10 +513,10 @@ static struct sk_buff *atm_tc_dequeue(struct Qdisc *sch) | |||
522 | 513 | ||
523 | static int atm_tc_requeue(struct sk_buff *skb, struct Qdisc *sch) | 514 | static int atm_tc_requeue(struct sk_buff *skb, struct Qdisc *sch) |
524 | { | 515 | { |
525 | struct atm_qdisc_data *p = PRIV(sch); | 516 | struct atm_qdisc_data *p = qdisc_priv(sch); |
526 | int ret; | 517 | int ret; |
527 | 518 | ||
528 | D2PRINTK("atm_tc_requeue(skb %p,sch %p,[qdisc %p])\n", skb, sch, p); | 519 | pr_debug("atm_tc_requeue(skb %p,sch %p,[qdisc %p])\n", skb, sch, p); |
529 | ret = p->link.q->ops->requeue(skb, p->link.q); | 520 | ret = p->link.q->ops->requeue(skb, p->link.q); |
530 | if (!ret) { | 521 | if (!ret) { |
531 | sch->q.qlen++; | 522 | sch->q.qlen++; |
@@ -539,11 +530,11 @@ static int atm_tc_requeue(struct sk_buff *skb, struct Qdisc *sch) | |||
539 | 530 | ||
540 | static unsigned int atm_tc_drop(struct Qdisc *sch) | 531 | static unsigned int atm_tc_drop(struct Qdisc *sch) |
541 | { | 532 | { |
542 | struct atm_qdisc_data *p = PRIV(sch); | 533 | struct atm_qdisc_data *p = qdisc_priv(sch); |
543 | struct atm_flow_data *flow; | 534 | struct atm_flow_data *flow; |
544 | unsigned int len; | 535 | unsigned int len; |
545 | 536 | ||
546 | DPRINTK("atm_tc_drop(sch %p,[qdisc %p])\n", sch, p); | 537 | pr_debug("atm_tc_drop(sch %p,[qdisc %p])\n", sch, p); |
547 | for (flow = p->flows; flow; flow = flow->next) | 538 | for (flow = p->flows; flow; flow = flow->next) |
548 | if (flow->q->ops->drop && (len = flow->q->ops->drop(flow->q))) | 539 | if (flow->q->ops->drop && (len = flow->q->ops->drop(flow->q))) |
549 | return len; | 540 | return len; |
@@ -552,14 +543,14 @@ static unsigned int atm_tc_drop(struct Qdisc *sch) | |||
552 | 543 | ||
553 | static int atm_tc_init(struct Qdisc *sch, struct rtattr *opt) | 544 | static int atm_tc_init(struct Qdisc *sch, struct rtattr *opt) |
554 | { | 545 | { |
555 | struct atm_qdisc_data *p = PRIV(sch); | 546 | struct atm_qdisc_data *p = qdisc_priv(sch); |
556 | 547 | ||
557 | DPRINTK("atm_tc_init(sch %p,[qdisc %p],opt %p)\n", sch, p, opt); | 548 | pr_debug("atm_tc_init(sch %p,[qdisc %p],opt %p)\n", sch, p, opt); |
558 | p->flows = &p->link; | 549 | p->flows = &p->link; |
559 | if (!(p->link.q = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops, | 550 | p->link.q = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops, sch->handle); |
560 | sch->handle))) | 551 | if (!p->link.q) |
561 | p->link.q = &noop_qdisc; | 552 | p->link.q = &noop_qdisc; |
562 | DPRINTK("atm_tc_init: link (%p) qdisc %p\n", &p->link, p->link.q); | 553 | pr_debug("atm_tc_init: link (%p) qdisc %p\n", &p->link, p->link.q); |
563 | p->link.filter_list = NULL; | 554 | p->link.filter_list = NULL; |
564 | p->link.vcc = NULL; | 555 | p->link.vcc = NULL; |
565 | p->link.sock = NULL; | 556 | p->link.sock = NULL; |
@@ -572,10 +563,10 @@ static int atm_tc_init(struct Qdisc *sch, struct rtattr *opt) | |||
572 | 563 | ||
573 | static void atm_tc_reset(struct Qdisc *sch) | 564 | static void atm_tc_reset(struct Qdisc *sch) |
574 | { | 565 | { |
575 | struct atm_qdisc_data *p = PRIV(sch); | 566 | struct atm_qdisc_data *p = qdisc_priv(sch); |
576 | struct atm_flow_data *flow; | 567 | struct atm_flow_data *flow; |
577 | 568 | ||
578 | DPRINTK("atm_tc_reset(sch %p,[qdisc %p])\n", sch, p); | 569 | pr_debug("atm_tc_reset(sch %p,[qdisc %p])\n", sch, p); |
579 | for (flow = p->flows; flow; flow = flow->next) | 570 | for (flow = p->flows; flow; flow = flow->next) |
580 | qdisc_reset(flow->q); | 571 | qdisc_reset(flow->q); |
581 | sch->q.qlen = 0; | 572 | sch->q.qlen = 0; |
@@ -583,10 +574,10 @@ static void atm_tc_reset(struct Qdisc *sch) | |||
583 | 574 | ||
584 | static void atm_tc_destroy(struct Qdisc *sch) | 575 | static void atm_tc_destroy(struct Qdisc *sch) |
585 | { | 576 | { |
586 | struct atm_qdisc_data *p = PRIV(sch); | 577 | struct atm_qdisc_data *p = qdisc_priv(sch); |
587 | struct atm_flow_data *flow; | 578 | struct atm_flow_data *flow; |
588 | 579 | ||
589 | DPRINTK("atm_tc_destroy(sch %p,[qdisc %p])\n", sch, p); | 580 | pr_debug("atm_tc_destroy(sch %p,[qdisc %p])\n", sch, p); |
590 | /* races ? */ | 581 | /* races ? */ |
591 | while ((flow = p->flows)) { | 582 | while ((flow = p->flows)) { |
592 | tcf_destroy_chain(flow->filter_list); | 583 | tcf_destroy_chain(flow->filter_list); |
@@ -608,12 +599,12 @@ static void atm_tc_destroy(struct Qdisc *sch) | |||
608 | static int atm_tc_dump_class(struct Qdisc *sch, unsigned long cl, | 599 | static int atm_tc_dump_class(struct Qdisc *sch, unsigned long cl, |
609 | struct sk_buff *skb, struct tcmsg *tcm) | 600 | struct sk_buff *skb, struct tcmsg *tcm) |
610 | { | 601 | { |
611 | struct atm_qdisc_data *p = PRIV(sch); | 602 | struct atm_qdisc_data *p = qdisc_priv(sch); |
612 | struct atm_flow_data *flow = (struct atm_flow_data *)cl; | 603 | struct atm_flow_data *flow = (struct atm_flow_data *)cl; |
613 | unsigned char *b = skb_tail_pointer(skb); | 604 | unsigned char *b = skb_tail_pointer(skb); |
614 | struct rtattr *rta; | 605 | struct rtattr *rta; |
615 | 606 | ||
616 | DPRINTK("atm_tc_dump_class(sch %p,[qdisc %p],flow %p,skb %p,tcm %p)\n", | 607 | pr_debug("atm_tc_dump_class(sch %p,[qdisc %p],flow %p,skb %p,tcm %p)\n", |
617 | sch, p, flow, skb, tcm); | 608 | sch, p, flow, skb, tcm); |
618 | if (!find_flow(p, flow)) | 609 | if (!find_flow(p, flow)) |
619 | return -EINVAL; | 610 | return -EINVAL; |