Commit 9e178ff2 authored by Thomas Graf's avatar Thomas Graf Committed by Thomas Graf

[PKT_SCHED]: RED: Use generic queue management interface

Signed-off-by: default avatarThomas Graf <tgraf@suug.ch>
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@mandriva.com>
parent 6b31b28a
...@@ -105,22 +105,14 @@ red_enqueue(struct sk_buff *skb, struct Qdisc* sch) ...@@ -105,22 +105,14 @@ red_enqueue(struct sk_buff *skb, struct Qdisc* sch)
break; break;
} }
if (sch->qstats.backlog + skb->len <= q->limit) { if (sch->qstats.backlog + skb->len <= q->limit)
__skb_queue_tail(&sch->q, skb); return qdisc_enqueue_tail(skb, sch);
sch->qstats.backlog += skb->len;
sch->bstats.bytes += skb->len;
sch->bstats.packets++;
return NET_XMIT_SUCCESS;
}
q->stats.pdrop++; q->stats.pdrop++;
kfree_skb(skb); return qdisc_drop(skb, sch);
sch->qstats.drops++;
return NET_XMIT_DROP;
congestion_drop: congestion_drop:
kfree_skb(skb); qdisc_drop(skb, sch);
sch->qstats.drops++;
return NET_XMIT_CN; return NET_XMIT_CN;
} }
...@@ -132,10 +124,7 @@ red_requeue(struct sk_buff *skb, struct Qdisc* sch) ...@@ -132,10 +124,7 @@ red_requeue(struct sk_buff *skb, struct Qdisc* sch)
if (red_is_idling(&q->parms)) if (red_is_idling(&q->parms))
red_end_of_idle_period(&q->parms); red_end_of_idle_period(&q->parms);
__skb_queue_head(&sch->q, skb); return qdisc_requeue(skb, sch);
sch->qstats.backlog += skb->len;
sch->qstats.requeues++;
return 0;
} }
static struct sk_buff * static struct sk_buff *
...@@ -144,14 +133,12 @@ red_dequeue(struct Qdisc* sch) ...@@ -144,14 +133,12 @@ red_dequeue(struct Qdisc* sch)
struct sk_buff *skb; struct sk_buff *skb;
struct red_sched_data *q = qdisc_priv(sch); struct red_sched_data *q = qdisc_priv(sch);
skb = __skb_dequeue(&sch->q); skb = qdisc_dequeue_head(sch);
if (skb) {
sch->qstats.backlog -= skb->len;
return skb;
}
red_start_of_idle_period(&q->parms); if (skb == NULL)
return NULL; red_start_of_idle_period(&q->parms);
return skb;
} }
static unsigned int red_drop(struct Qdisc* sch) static unsigned int red_drop(struct Qdisc* sch)
...@@ -159,13 +146,11 @@ 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 sk_buff *skb;
struct red_sched_data *q = qdisc_priv(sch); struct red_sched_data *q = qdisc_priv(sch);
skb = __skb_dequeue_tail(&sch->q); skb = qdisc_dequeue_tail(sch);
if (skb) { if (skb) {
unsigned int len = skb->len; unsigned int len = skb->len;
sch->qstats.backlog -= len;
sch->qstats.drops++;
q->stats.other++; q->stats.other++;
kfree_skb(skb); qdisc_drop(skb, sch);
return len; return len;
} }
...@@ -177,8 +162,7 @@ static void red_reset(struct Qdisc* sch) ...@@ -177,8 +162,7 @@ static void red_reset(struct Qdisc* sch)
{ {
struct red_sched_data *q = qdisc_priv(sch); struct red_sched_data *q = qdisc_priv(sch);
__skb_queue_purge(&sch->q); qdisc_reset_queue(sch);
sch->qstats.backlog = 0;
red_restart(&q->parms); red_restart(&q->parms);
} }
......
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