summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2005-11-05 21:14:06 +0100
committerThomas Graf <tgr@axs.localdomain>2005-11-05 22:02:25 +0100
commit9e178ff27cd9187babe86dc80ef766b722c88da6 (patch)
tree035c1fe70783a17a8535638be0306cd8a9844a20 /net
parent6b31b28a441c9ba33889f88ac1d9451ed9532ada (diff)
downloadlinux-3.10-9e178ff27cd9187babe86dc80ef766b722c88da6.tar.gz
linux-3.10-9e178ff27cd9187babe86dc80ef766b722c88da6.tar.bz2
linux-3.10-9e178ff27cd9187babe86dc80ef766b722c88da6.zip
[PKT_SCHED]: RED: Use generic queue management interface
Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Diffstat (limited to 'net')
-rw-r--r--net/sched/sch_red.c42
1 files changed, 13 insertions, 29 deletions
diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c
index 0dabcc9091b..d5e934c33f9 100644
--- a/net/sched/sch_red.c
+++ b/net/sched/sch_red.c
@@ -105,22 +105,14 @@ red_enqueue(struct sk_buff *skb, struct Qdisc* sch)
break;
}
- if (sch->qstats.backlog + skb->len <= q->limit) {
- __skb_queue_tail(&sch->q, skb);
- sch->qstats.backlog += skb->len;
- sch->bstats.bytes += skb->len;
- sch->bstats.packets++;
- return NET_XMIT_SUCCESS;
- }
+ if (sch->qstats.backlog + skb->len <= q->limit)
+ return qdisc_enqueue_tail(skb, sch);
q->stats.pdrop++;
- kfree_skb(skb);
- sch->qstats.drops++;
- return NET_XMIT_DROP;
+ return qdisc_drop(skb, sch);
congestion_drop:
- kfree_skb(skb);
- sch->qstats.drops++;
+ qdisc_drop(skb, sch);
return NET_XMIT_CN;
}
@@ -132,10 +124,7 @@ red_requeue(struct sk_buff *skb, struct Qdisc* sch)
if (red_is_idling(&q->parms))
red_end_of_idle_period(&q->parms);
- __skb_queue_head(&sch->q, skb);
- sch->qstats.backlog += skb->len;
- sch->qstats.requeues++;
- return 0;
+ return qdisc_requeue(skb, sch);
}
static struct sk_buff *
@@ -144,14 +133,12 @@ red_dequeue(struct Qdisc* sch)
struct sk_buff *skb;
struct red_sched_data *q = qdisc_priv(sch);
- skb = __skb_dequeue(&sch->q);
- if (skb) {
- sch->qstats.backlog -= skb->len;
- return skb;
- }
+ skb = qdisc_dequeue_head(sch);
- red_start_of_idle_period(&q->parms);
- return NULL;
+ if (skb == NULL)
+ red_start_of_idle_period(&q->parms);
+
+ return skb;
}
static unsigned int red_drop(struct Qdisc* sch)
@@ -159,13 +146,11 @@ static unsigned int red_drop(struct Qdisc* sch)
struct sk_buff *skb;
struct red_sched_data *q = qdisc_priv(sch);
- skb = __skb_dequeue_tail(&sch->q);
+ skb = qdisc_dequeue_tail(sch);
if (skb) {
unsigned int len = skb->len;
- sch->qstats.backlog -= len;
- sch->qstats.drops++;
q->stats.other++;
- kfree_skb(skb);
+ qdisc_drop(skb, sch);
return len;
}
@@ -177,8 +162,7 @@ static void red_reset(struct Qdisc* sch)
{
struct red_sched_data *q = qdisc_priv(sch);
- __skb_queue_purge(&sch->q);
- sch->qstats.backlog = 0;
+ qdisc_reset_queue(sch);
red_restart(&q->parms);
}