Skip to content

Commit

Permalink
[PKT_SCHED]: Add and use prio2list() in the pfifo_fast qdisc
Browse files Browse the repository at this point in the history
prio2list() returns the relevant sk_buff_head for the
band specified by the priority for a given skb.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
tgraf authored and davem330 committed Jun 19, 2005
1 parent 821d24a commit 321090e
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions net/sched/sch_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,12 +311,17 @@ static const u8 prio2band[TC_PRIO_MAX+1] =
generic prio+fifo combination.
*/

static int
pfifo_fast_enqueue(struct sk_buff *skb, struct Qdisc* qdisc)
static inline struct sk_buff_head *prio2list(struct sk_buff *skb,
struct Qdisc *qdisc)
{
struct sk_buff_head *list = qdisc_priv(qdisc);
return list + prio2band[skb->priority & TC_PRIO_MAX];
}

list += prio2band[skb->priority&TC_PRIO_MAX];
static int
pfifo_fast_enqueue(struct sk_buff *skb, struct Qdisc* qdisc)
{
struct sk_buff_head *list = prio2list(skb, qdisc);

if (skb_queue_len(list) < qdisc->dev->tx_queue_len) {
qdisc->q.qlen++;
Expand Down Expand Up @@ -345,12 +350,8 @@ pfifo_fast_dequeue(struct Qdisc* qdisc)
static int
pfifo_fast_requeue(struct sk_buff *skb, struct Qdisc* qdisc)
{
struct sk_buff_head *list = qdisc_priv(qdisc);

list += prio2band[skb->priority&TC_PRIO_MAX];

qdisc->q.qlen++;
return __qdisc_requeue(skb, qdisc, list);
return __qdisc_requeue(skb, qdisc, prio2list(skb, qdisc));
}

static void
Expand Down

0 comments on commit 321090e

Please sign in to comment.