aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/sch_dsmark.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sched/sch_dsmark.c')
-rw-r--r--net/sched/sch_dsmark.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/net/sched/sch_dsmark.c b/net/sched/sch_dsmark.c
index 63d41f86679c..2c790204d042 100644
--- a/net/sched/sch_dsmark.c
+++ b/net/sched/sch_dsmark.c
@@ -61,8 +61,7 @@ static int dsmark_graft(struct Qdisc *sch, unsigned long arg,
61 sch, p, new, old); 61 sch, p, new, old);
62 62
63 if (new == NULL) { 63 if (new == NULL) {
64 new = qdisc_create_dflt(qdisc_dev(sch), sch->dev_queue, 64 new = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops,
65 &pfifo_qdisc_ops,
66 sch->handle); 65 sch->handle);
67 if (new == NULL) 66 if (new == NULL)
68 new = &noop_qdisc; 67 new = &noop_qdisc;
@@ -138,10 +137,10 @@ static int dsmark_change(struct Qdisc *sch, u32 classid, u32 parent,
138 mask = nla_get_u8(tb[TCA_DSMARK_MASK]); 137 mask = nla_get_u8(tb[TCA_DSMARK_MASK]);
139 138
140 if (tb[TCA_DSMARK_VALUE]) 139 if (tb[TCA_DSMARK_VALUE])
141 p->value[*arg-1] = nla_get_u8(tb[TCA_DSMARK_VALUE]); 140 p->value[*arg - 1] = nla_get_u8(tb[TCA_DSMARK_VALUE]);
142 141
143 if (tb[TCA_DSMARK_MASK]) 142 if (tb[TCA_DSMARK_MASK])
144 p->mask[*arg-1] = mask; 143 p->mask[*arg - 1] = mask;
145 144
146 err = 0; 145 err = 0;
147 146
@@ -156,8 +155,8 @@ static int dsmark_delete(struct Qdisc *sch, unsigned long arg)
156 if (!dsmark_valid_index(p, arg)) 155 if (!dsmark_valid_index(p, arg))
157 return -EINVAL; 156 return -EINVAL;
158 157
159 p->mask[arg-1] = 0xff; 158 p->mask[arg - 1] = 0xff;
160 p->value[arg-1] = 0; 159 p->value[arg - 1] = 0;
161 160
162 return 0; 161 return 0;
163} 162}
@@ -176,7 +175,7 @@ static void dsmark_walk(struct Qdisc *sch, struct qdisc_walker *walker)
176 if (p->mask[i] == 0xff && !p->value[i]) 175 if (p->mask[i] == 0xff && !p->value[i])
177 goto ignore; 176 goto ignore;
178 if (walker->count >= walker->skip) { 177 if (walker->count >= walker->skip) {
179 if (walker->fn(sch, i+1, walker) < 0) { 178 if (walker->fn(sch, i + 1, walker) < 0) {
180 walker->stop = 1; 179 walker->stop = 1;
181 break; 180 break;
182 } 181 }
@@ -261,8 +260,6 @@ static int dsmark_enqueue(struct sk_buff *skb, struct Qdisc *sch)
261 return err; 260 return err;
262 } 261 }
263 262
264 sch->bstats.bytes += qdisc_pkt_len(skb);
265 sch->bstats.packets++;
266 sch->q.qlen++; 263 sch->q.qlen++;
267 264
268 return NET_XMIT_SUCCESS; 265 return NET_XMIT_SUCCESS;
@@ -285,6 +282,7 @@ static struct sk_buff *dsmark_dequeue(struct Qdisc *sch)
285 if (skb == NULL) 282 if (skb == NULL)
286 return NULL; 283 return NULL;
287 284
285 qdisc_bstats_update(sch, skb);
288 sch->q.qlen--; 286 sch->q.qlen--;
289 287
290 index = skb->tc_index & (p->indices - 1); 288 index = skb->tc_index & (p->indices - 1);
@@ -306,9 +304,8 @@ static struct sk_buff *dsmark_dequeue(struct Qdisc *sch)
306 * and don't need yet another qdisc as a bypass. 304 * and don't need yet another qdisc as a bypass.
307 */ 305 */
308 if (p->mask[index] != 0xff || p->value[index]) 306 if (p->mask[index] != 0xff || p->value[index])
309 printk(KERN_WARNING 307 pr_warning("dsmark_dequeue: unsupported protocol %d\n",
310 "dsmark_dequeue: unsupported protocol %d\n", 308 ntohs(skb->protocol));
311 ntohs(skb->protocol));
312 break; 309 break;
313 } 310 }
314 311
@@ -384,8 +381,7 @@ static int dsmark_init(struct Qdisc *sch, struct nlattr *opt)
384 p->default_index = default_index; 381 p->default_index = default_index;
385 p->set_tc_index = nla_get_flag(tb[TCA_DSMARK_SET_TC_INDEX]); 382 p->set_tc_index = nla_get_flag(tb[TCA_DSMARK_SET_TC_INDEX]);
386 383
387 p->q = qdisc_create_dflt(qdisc_dev(sch), sch->dev_queue, 384 p->q = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops, sch->handle);
388 &pfifo_qdisc_ops, sch->handle);
389 if (p->q == NULL) 385 if (p->q == NULL)
390 p->q = &noop_qdisc; 386 p->q = &noop_qdisc;
391 387
@@ -427,14 +423,14 @@ static int dsmark_dump_class(struct Qdisc *sch, unsigned long cl,
427 if (!dsmark_valid_index(p, cl)) 423 if (!dsmark_valid_index(p, cl))
428 return -EINVAL; 424 return -EINVAL;
429 425
430 tcm->tcm_handle = TC_H_MAKE(TC_H_MAJ(sch->handle), cl-1); 426 tcm->tcm_handle = TC_H_MAKE(TC_H_MAJ(sch->handle), cl - 1);
431 tcm->tcm_info = p->q->handle; 427 tcm->tcm_info = p->q->handle;
432 428
433 opts = nla_nest_start(skb, TCA_OPTIONS); 429 opts = nla_nest_start(skb, TCA_OPTIONS);
434 if (opts == NULL) 430 if (opts == NULL)
435 goto nla_put_failure; 431 goto nla_put_failure;
436 NLA_PUT_U8(skb, TCA_DSMARK_MASK, p->mask[cl-1]); 432 NLA_PUT_U8(skb, TCA_DSMARK_MASK, p->mask[cl - 1]);
437 NLA_PUT_U8(skb, TCA_DSMARK_VALUE, p->value[cl-1]); 433 NLA_PUT_U8(skb, TCA_DSMARK_VALUE, p->value[cl - 1]);
438 434
439 return nla_nest_end(skb, opts); 435 return nla_nest_end(skb, opts);
440 436