提交 821d24ae 编写于 作者: T Thomas Graf 提交者: David S. Miller

[PKT_SCHED]: Transform pfifo_fast to use generic queue management interface

Gives pfifo_fast a byte based backlog.
Signed-off-by: NThomas Graf <tgraf@suug.ch>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 6fc8e84f
...@@ -318,16 +318,12 @@ pfifo_fast_enqueue(struct sk_buff *skb, struct Qdisc* qdisc) ...@@ -318,16 +318,12 @@ pfifo_fast_enqueue(struct sk_buff *skb, struct Qdisc* qdisc)
list += prio2band[skb->priority&TC_PRIO_MAX]; list += prio2band[skb->priority&TC_PRIO_MAX];
if (list->qlen < qdisc->dev->tx_queue_len) { if (skb_queue_len(list) < qdisc->dev->tx_queue_len) {
__skb_queue_tail(list, skb);
qdisc->q.qlen++; qdisc->q.qlen++;
qdisc->bstats.bytes += skb->len; return __qdisc_enqueue_tail(skb, qdisc, list);
qdisc->bstats.packets++;
return 0;
} }
qdisc->qstats.drops++;
kfree_skb(skb); return qdisc_drop(skb, qdisc);
return NET_XMIT_DROP;
} }
static struct sk_buff * static struct sk_buff *
...@@ -335,10 +331,9 @@ pfifo_fast_dequeue(struct Qdisc* qdisc) ...@@ -335,10 +331,9 @@ pfifo_fast_dequeue(struct Qdisc* qdisc)
{ {
int prio; int prio;
struct sk_buff_head *list = qdisc_priv(qdisc); struct sk_buff_head *list = qdisc_priv(qdisc);
struct sk_buff *skb;
for (prio = 0; prio < 3; prio++, list++) { for (prio = 0; prio < 3; prio++, list++) {
skb = __skb_dequeue(list); struct sk_buff *skb = __qdisc_dequeue_head(qdisc, list);
if (skb) { if (skb) {
qdisc->q.qlen--; qdisc->q.qlen--;
return skb; return skb;
...@@ -354,10 +349,8 @@ pfifo_fast_requeue(struct sk_buff *skb, struct Qdisc* qdisc) ...@@ -354,10 +349,8 @@ pfifo_fast_requeue(struct sk_buff *skb, struct Qdisc* qdisc)
list += prio2band[skb->priority&TC_PRIO_MAX]; list += prio2band[skb->priority&TC_PRIO_MAX];
__skb_queue_head(list, skb);
qdisc->q.qlen++; qdisc->q.qlen++;
qdisc->qstats.requeues++; return __qdisc_requeue(skb, qdisc, list);
return 0;
} }
static void static void
...@@ -367,7 +360,9 @@ pfifo_fast_reset(struct Qdisc* qdisc) ...@@ -367,7 +360,9 @@ pfifo_fast_reset(struct Qdisc* qdisc)
struct sk_buff_head *list = qdisc_priv(qdisc); struct sk_buff_head *list = qdisc_priv(qdisc);
for (prio=0; prio < 3; prio++) for (prio=0; prio < 3; prio++)
skb_queue_purge(list+prio); __qdisc_reset_queue(qdisc, list + prio);
qdisc->qstats.backlog = 0;
qdisc->q.qlen = 0; qdisc->q.qlen = 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册