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
......@@ -431,47 +431,43 @@ static int dsmark_dump_class(struct Qdisc *sch, unsigned long cl,
struct sk_buff *skb, struct tcmsg *tcm)
{
struct dsmark_qdisc_data *p = PRIV(sch);
unsigned char *b = skb->tail;
struct rtattr *rta;
struct rtattr *opts = NULL;
DPRINTK("dsmark_dump_class(sch %p,[qdisc %p],class %ld\n",sch,p,cl);
if (!cl || cl > p->indices)
DPRINTK("dsmark_dump_class(sch %p,[qdisc %p],class %ld\n", sch, p, cl);
if (!dsmark_valid_index(p, cl))
return -EINVAL;
tcm->tcm_handle = TC_H_MAKE(TC_H_MAJ(sch->handle),cl-1);
rta = (struct rtattr *) b;
RTA_PUT(skb,TCA_OPTIONS,0,NULL);
RTA_PUT(skb,TCA_DSMARK_MASK,1,&p->mask[cl-1]);
RTA_PUT(skb,TCA_DSMARK_VALUE,1,&p->value[cl-1]);
rta->rta_len = skb->tail-b;
return skb->len;
tcm->tcm_handle = TC_H_MAKE(TC_H_MAJ(sch->handle), cl-1);
opts = RTA_NEST(skb, TCA_OPTIONS);
RTA_PUT_U8(skb,TCA_DSMARK_MASK, p->mask[cl-1]);
RTA_PUT_U8(skb,TCA_DSMARK_VALUE, p->value[cl-1]);
return RTA_NEST_END(skb, opts);
rtattr_failure:
skb_trim(skb,b-skb->data);
return -1;
return RTA_NEST_CANCEL(skb, opts);
}
static int dsmark_dump(struct Qdisc *sch, struct sk_buff *skb)
{
struct dsmark_qdisc_data *p = PRIV(sch);
unsigned char *b = skb->tail;
struct rtattr *rta;
struct rtattr *opts = NULL;
rta = (struct rtattr *) b;
RTA_PUT(skb,TCA_OPTIONS,0,NULL);
RTA_PUT(skb,TCA_DSMARK_INDICES,sizeof(__u16),&p->indices);
if (p->default_index != NO_DEFAULT_INDEX) {
__u16 tmp = p->default_index;
opts = RTA_NEST(skb, TCA_OPTIONS);
RTA_PUT_U16(skb, TCA_DSMARK_INDICES, p->indices);
if (p->default_index != NO_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)
RTA_PUT(skb, TCA_DSMARK_SET_TC_INDEX, 0, NULL);
rta->rta_len = skb->tail-b;
return skb->len;
RTA_PUT_FLAG(skb, TCA_DSMARK_SET_TC_INDEX);
return RTA_NEST_END(skb, opts);
rtattr_failure:
skb_trim(skb,b-skb->data);
return -1;
return RTA_NEST_CANCEL(skb, opts);
}
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