diff options
author | Thomas Graf <tgraf@suug.ch> | 2005-06-19 01:53:12 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2005-06-19 01:53:12 -0400 |
commit | 02f23f095f1d9534873ecb5d94bbdb0ab67f1d8e (patch) | |
tree | f411ec540945f539506fc883e7005a1317ebada3 /net/sched | |
parent | 758cc43c6d7326c62751fb516485e8e188854637 (diff) |
[PKT_SCHED]: Make dsmark use the new dumping macros
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched')
-rw-r--r-- | net/sched/sch_dsmark.c | 52 |
1 files changed, 24 insertions, 28 deletions
diff --git a/net/sched/sch_dsmark.c b/net/sched/sch_dsmark.c index 66abf139f4bf..ac0efeae312e 100644 --- a/net/sched/sch_dsmark.c +++ b/net/sched/sch_dsmark.c | |||
@@ -428,50 +428,46 @@ static void dsmark_destroy(struct Qdisc *sch) | |||
428 | 428 | ||
429 | 429 | ||
430 | static int dsmark_dump_class(struct Qdisc *sch, unsigned long cl, | 430 | static int dsmark_dump_class(struct Qdisc *sch, unsigned long cl, |
431 | struct sk_buff *skb, struct tcmsg *tcm) | 431 | struct sk_buff *skb, struct tcmsg *tcm) |
432 | { | 432 | { |
433 | struct dsmark_qdisc_data *p = PRIV(sch); | 433 | struct dsmark_qdisc_data *p = PRIV(sch); |
434 | unsigned char *b = skb->tail; | 434 | struct rtattr *opts = NULL; |
435 | struct rtattr *rta; | ||
436 | 435 | ||
437 | DPRINTK("dsmark_dump_class(sch %p,[qdisc %p],class %ld\n",sch,p,cl); | 436 | DPRINTK("dsmark_dump_class(sch %p,[qdisc %p],class %ld\n", sch, p, cl); |
438 | if (!cl || cl > p->indices) | 437 | |
438 | if (!dsmark_valid_index(p, cl)) | ||
439 | return -EINVAL; | 439 | return -EINVAL; |
440 | tcm->tcm_handle = TC_H_MAKE(TC_H_MAJ(sch->handle),cl-1); | 440 | |
441 | rta = (struct rtattr *) b; | 441 | tcm->tcm_handle = TC_H_MAKE(TC_H_MAJ(sch->handle), cl-1); |
442 | RTA_PUT(skb,TCA_OPTIONS,0,NULL); | 442 | |
443 | RTA_PUT(skb,TCA_DSMARK_MASK,1,&p->mask[cl-1]); | 443 | opts = RTA_NEST(skb, TCA_OPTIONS); |
444 | RTA_PUT(skb,TCA_DSMARK_VALUE,1,&p->value[cl-1]); | 444 | RTA_PUT_U8(skb,TCA_DSMARK_MASK, p->mask[cl-1]); |
445 | rta->rta_len = skb->tail-b; | 445 | RTA_PUT_U8(skb,TCA_DSMARK_VALUE, p->value[cl-1]); |
446 | return skb->len; | 446 | |
447 | return RTA_NEST_END(skb, opts); | ||
447 | 448 | ||
448 | rtattr_failure: | 449 | rtattr_failure: |
449 | skb_trim(skb,b-skb->data); | 450 | return RTA_NEST_CANCEL(skb, opts); |
450 | return -1; | ||
451 | } | 451 | } |
452 | 452 | ||
453 | static int dsmark_dump(struct Qdisc *sch, struct sk_buff *skb) | 453 | static int dsmark_dump(struct Qdisc *sch, struct sk_buff *skb) |
454 | { | 454 | { |
455 | struct dsmark_qdisc_data *p = PRIV(sch); | 455 | struct dsmark_qdisc_data *p = PRIV(sch); |
456 | unsigned char *b = skb->tail; | 456 | struct rtattr *opts = NULL; |
457 | struct rtattr *rta; | ||
458 | 457 | ||
459 | rta = (struct rtattr *) b; | 458 | opts = RTA_NEST(skb, TCA_OPTIONS); |
460 | RTA_PUT(skb,TCA_OPTIONS,0,NULL); | 459 | RTA_PUT_U16(skb, TCA_DSMARK_INDICES, p->indices); |
461 | RTA_PUT(skb,TCA_DSMARK_INDICES,sizeof(__u16),&p->indices); | 460 | |
462 | if (p->default_index != NO_DEFAULT_INDEX) { | 461 | if (p->default_index != NO_DEFAULT_INDEX) |
463 | __u16 tmp = p->default_index; | 462 | RTA_PUT_U16(skb, TCA_DSMARK_DEFAULT_INDEX, p->default_index); |
464 | 463 | ||
465 | RTA_PUT(skb,TCA_DSMARK_DEFAULT_INDEX, sizeof(__u16), &tmp); | ||
466 | } | ||
467 | if (p->set_tc_index) | 464 | if (p->set_tc_index) |
468 | RTA_PUT(skb, TCA_DSMARK_SET_TC_INDEX, 0, NULL); | 465 | RTA_PUT_FLAG(skb, TCA_DSMARK_SET_TC_INDEX); |
469 | rta->rta_len = skb->tail-b; | 466 | |
470 | return skb->len; | 467 | return RTA_NEST_END(skb, opts); |
471 | 468 | ||
472 | rtattr_failure: | 469 | rtattr_failure: |
473 | skb_trim(skb,b-skb->data); | 470 | return RTA_NEST_CANCEL(skb, opts); |
474 | return -1; | ||
475 | } | 471 | } |
476 | 472 | ||
477 | static struct Qdisc_class_ops dsmark_class_ops = { | 473 | static struct Qdisc_class_ops dsmark_class_ops = { |