diff options
Diffstat (limited to 'net/sched/sch_dsmark.c')
-rw-r--r-- | net/sched/sch_dsmark.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/net/sched/sch_dsmark.c b/net/sched/sch_dsmark.c index 76f2fc394..a66fd2b45 100644 --- a/net/sched/sch_dsmark.c +++ b/net/sched/sch_dsmark.c @@ -39,16 +39,22 @@ * x:y y>0 y+1 use entry [y] * ... ... ... * x:indices-1 indices use entry [indices-1] + * ... ... ... + * x:y y+1 use entry [y & (indices-1)] + * ... ... ... + * 0xffff 0x10000 use entry [indices-1] */ +#define NO_DEFAULT_INDEX (1 << 16) + struct dsmark_qdisc_data { struct Qdisc *q; struct tcf_proto *filter_list; __u8 *mask; /* "owns" the array */ __u8 *value; __u16 indices; - __u16 default_index; + __u32 default_index; /* index range is 0...0xffff */ int set_tc_index; }; @@ -217,7 +223,7 @@ static int dsmark_enqueue(struct sk_buff *skb,struct Qdisc *sch) case TC_POLICE_UNSPEC: /* fall through */ default: - if (p->default_index) + if (p->default_index != NO_DEFAULT_INDEX) skb->tc_index = p->default_index; break; }; @@ -325,14 +331,12 @@ int dsmark_init(struct Qdisc *sch,struct rtattr *opt) if (tmp & 1) return -EINVAL; } - p->default_index = 0; + p->default_index = NO_DEFAULT_INDEX; if (tb[TCA_DSMARK_DEFAULT_INDEX-1]) { if (RTA_PAYLOAD(tb[TCA_DSMARK_DEFAULT_INDEX-1]) < sizeof(__u16)) return -EINVAL; p->default_index = *(__u16 *) RTA_DATA(tb[TCA_DSMARK_DEFAULT_INDEX-1]); - if (!p->default_index || p->default_index >= p->indices) - return -EINVAL; } p->set_tc_index = !!tb[TCA_DSMARK_SET_TC_INDEX-1]; p->mask = kmalloc(p->indices*2,GFP_KERNEL); @@ -411,9 +415,11 @@ static int dsmark_dump(struct Qdisc *sch, struct sk_buff *skb) 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) - RTA_PUT(skb,TCA_DSMARK_DEFAULT_INDEX, sizeof(__u16), - &p->default_index); + if (p->default_index != NO_DEFAULT_INDEX) { + __u16 tmp = 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; |