Commit 02f23f09 authored by Thomas Graf's avatar Thomas Graf Committed by David S. Miller

[PKT_SCHED]: Make dsmark use the new dumping macros

Signed-off-by: default avatarThomas Graf <tgraf@suug.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 758cc43c
...@@ -428,50 +428,46 @@ static void dsmark_destroy(struct Qdisc *sch) ...@@ -428,50 +428,46 @@ static void dsmark_destroy(struct Qdisc *sch)
static int dsmark_dump_class(struct Qdisc *sch, unsigned long cl, static int dsmark_dump_class(struct Qdisc *sch, unsigned long cl,
struct sk_buff *skb, struct tcmsg *tcm) struct sk_buff *skb, struct tcmsg *tcm)
{ {
struct dsmark_qdisc_data *p = PRIV(sch); struct dsmark_qdisc_data *p = PRIV(sch);
unsigned char *b = skb->tail; struct rtattr *opts = NULL;
struct rtattr *rta;
DPRINTK("dsmark_dump_class(sch %p,[qdisc %p],class %ld\n",sch,p,cl); DPRINTK("dsmark_dump_class(sch %p,[qdisc %p],class %ld\n", sch, p, cl);
if (!cl || cl > p->indices)
if (!dsmark_valid_index(p, cl))
return -EINVAL; return -EINVAL;
tcm->tcm_handle = TC_H_MAKE(TC_H_MAJ(sch->handle),cl-1);
rta = (struct rtattr *) b; tcm->tcm_handle = TC_H_MAKE(TC_H_MAJ(sch->handle), cl-1);
RTA_PUT(skb,TCA_OPTIONS,0,NULL);
RTA_PUT(skb,TCA_DSMARK_MASK,1,&p->mask[cl-1]); opts = RTA_NEST(skb, TCA_OPTIONS);
RTA_PUT(skb,TCA_DSMARK_VALUE,1,&p->value[cl-1]); RTA_PUT_U8(skb,TCA_DSMARK_MASK, p->mask[cl-1]);
rta->rta_len = skb->tail-b; RTA_PUT_U8(skb,TCA_DSMARK_VALUE, p->value[cl-1]);
return skb->len;
return RTA_NEST_END(skb, opts);
rtattr_failure: rtattr_failure:
skb_trim(skb,b-skb->data); return RTA_NEST_CANCEL(skb, opts);
return -1;
} }
static int dsmark_dump(struct Qdisc *sch, struct sk_buff *skb) static int dsmark_dump(struct Qdisc *sch, struct sk_buff *skb)
{ {
struct dsmark_qdisc_data *p = PRIV(sch); struct dsmark_qdisc_data *p = PRIV(sch);
unsigned char *b = skb->tail; struct rtattr *opts = NULL;
struct rtattr *rta;
rta = (struct rtattr *) b; opts = RTA_NEST(skb, TCA_OPTIONS);
RTA_PUT(skb,TCA_OPTIONS,0,NULL); RTA_PUT_U16(skb, TCA_DSMARK_INDICES, p->indices);
RTA_PUT(skb,TCA_DSMARK_INDICES,sizeof(__u16),&p->indices);
if (p->default_index != NO_DEFAULT_INDEX) { if (p->default_index != NO_DEFAULT_INDEX)
__u16 tmp = p->default_index; RTA_PUT_U16(skb, TCA_DSMARK_DEFAULT_INDEX, p->default_index);
RTA_PUT(skb,TCA_DSMARK_DEFAULT_INDEX, sizeof(__u16), &tmp);
}
if (p->set_tc_index) if (p->set_tc_index)
RTA_PUT(skb, TCA_DSMARK_SET_TC_INDEX, 0, NULL); RTA_PUT_FLAG(skb, TCA_DSMARK_SET_TC_INDEX);
rta->rta_len = skb->tail-b;
return skb->len; return RTA_NEST_END(skb, opts);
rtattr_failure: rtattr_failure:
skb_trim(skb,b-skb->data); return RTA_NEST_CANCEL(skb, opts);
return -1;
} }
static struct Qdisc_class_ops dsmark_class_ops = { static struct Qdisc_class_ops dsmark_class_ops = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment