diff options
Diffstat (limited to 'net/sched/sch_red.c')
| -rw-r--r-- | net/sched/sch_red.c | 37 |
1 files changed, 5 insertions, 32 deletions
diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c index 5c569853b9c0..3f2d1d7f3bbd 100644 --- a/net/sched/sch_red.c +++ b/net/sched/sch_red.c | |||
| @@ -92,9 +92,9 @@ static int red_enqueue(struct sk_buff *skb, struct Qdisc* sch) | |||
| 92 | break; | 92 | break; |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | ret = child->enqueue(skb, child); | 95 | ret = qdisc_enqueue(skb, child); |
| 96 | if (likely(ret == NET_XMIT_SUCCESS)) { | 96 | if (likely(ret == NET_XMIT_SUCCESS)) { |
| 97 | sch->bstats.bytes += skb->len; | 97 | sch->bstats.bytes += qdisc_pkt_len(skb); |
| 98 | sch->bstats.packets++; | 98 | sch->bstats.packets++; |
| 99 | sch->q.qlen++; | 99 | sch->q.qlen++; |
| 100 | } else { | 100 | } else { |
| @@ -174,33 +174,6 @@ static void red_destroy(struct Qdisc *sch) | |||
| 174 | qdisc_destroy(q->qdisc); | 174 | qdisc_destroy(q->qdisc); |
| 175 | } | 175 | } |
| 176 | 176 | ||
| 177 | static struct Qdisc *red_create_dflt(struct Qdisc *sch, u32 limit) | ||
| 178 | { | ||
| 179 | struct Qdisc *q; | ||
| 180 | struct nlattr *nla; | ||
| 181 | int ret; | ||
| 182 | |||
| 183 | q = qdisc_create_dflt(sch->dev, &bfifo_qdisc_ops, | ||
| 184 | TC_H_MAKE(sch->handle, 1)); | ||
| 185 | if (q) { | ||
| 186 | nla = kmalloc(nla_attr_size(sizeof(struct tc_fifo_qopt)), | ||
| 187 | GFP_KERNEL); | ||
| 188 | if (nla) { | ||
| 189 | nla->nla_type = RTM_NEWQDISC; | ||
| 190 | nla->nla_len = nla_attr_size(sizeof(struct tc_fifo_qopt)); | ||
| 191 | ((struct tc_fifo_qopt *)nla_data(nla))->limit = limit; | ||
| 192 | |||
| 193 | ret = q->ops->change(q, nla); | ||
| 194 | kfree(nla); | ||
| 195 | |||
| 196 | if (ret == 0) | ||
| 197 | return q; | ||
| 198 | } | ||
| 199 | qdisc_destroy(q); | ||
| 200 | } | ||
| 201 | return NULL; | ||
| 202 | } | ||
| 203 | |||
| 204 | static const struct nla_policy red_policy[TCA_RED_MAX + 1] = { | 177 | static const struct nla_policy red_policy[TCA_RED_MAX + 1] = { |
| 205 | [TCA_RED_PARMS] = { .len = sizeof(struct tc_red_qopt) }, | 178 | [TCA_RED_PARMS] = { .len = sizeof(struct tc_red_qopt) }, |
| 206 | [TCA_RED_STAB] = { .len = RED_STAB_SIZE }, | 179 | [TCA_RED_STAB] = { .len = RED_STAB_SIZE }, |
| @@ -228,9 +201,9 @@ static int red_change(struct Qdisc *sch, struct nlattr *opt) | |||
| 228 | ctl = nla_data(tb[TCA_RED_PARMS]); | 201 | ctl = nla_data(tb[TCA_RED_PARMS]); |
| 229 | 202 | ||
| 230 | if (ctl->limit > 0) { | 203 | if (ctl->limit > 0) { |
| 231 | child = red_create_dflt(sch, ctl->limit); | 204 | child = fifo_create_dflt(sch, &bfifo_qdisc_ops, ctl->limit); |
| 232 | if (child == NULL) | 205 | if (IS_ERR(child)) |
| 233 | return -ENOMEM; | 206 | return PTR_ERR(child); |
| 234 | } | 207 | } |
| 235 | 208 | ||
| 236 | sch_tree_lock(sch); | 209 | sch_tree_lock(sch); |
