[PKT_SCHED] SFQ: whitespace cleanup

Add whitespace around operators, and add a few blank lines to improve
readability.

Signed-off-by: Stephen Hemminger <stephen.hemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Stephen Hemminger 2008-01-20 17:20:56 -08:00 committed by David S. Miller
parent d46f8dd87d
commit 6f9e98f7a9
1 changed files with 25 additions and 17 deletions

View File

@ -148,9 +148,10 @@ static unsigned sfq_hash(struct sfq_sched_data *q, struct sk_buff *skb)
break; break;
} }
default: default:
h = (u32)(unsigned long)skb->dst^skb->protocol; h = (unsigned long)skb->dst ^ skb->protocol;
h2 = (u32)(unsigned long)skb->sk; h2 = (unsigned long)skb->sk;
} }
return sfq_fold_hash(q, h, h2); return sfq_fold_hash(q, h, h2);
} }
@ -252,6 +253,7 @@ sfq_enqueue(struct sk_buff *skb, struct Qdisc* sch)
q->ht[hash] = x = q->dep[SFQ_DEPTH].next; q->ht[hash] = x = q->dep[SFQ_DEPTH].next;
q->hash[x] = hash; q->hash[x] = hash;
} }
/* If selected queue has length q->limit, this means that /* If selected queue has length q->limit, this means that
* all another queues are empty and that we do simple tail drop, * all another queues are empty and that we do simple tail drop,
* i.e. drop _this_ packet. * i.e. drop _this_ packet.
@ -295,6 +297,7 @@ sfq_requeue(struct sk_buff *skb, struct Qdisc* sch)
q->ht[hash] = x = q->dep[SFQ_DEPTH].next; q->ht[hash] = x = q->dep[SFQ_DEPTH].next;
q->hash[x] = hash; q->hash[x] = hash;
} }
sch->qstats.backlog += skb->len; sch->qstats.backlog += skb->len;
__skb_queue_head(&q->qs[x], skb); __skb_queue_head(&q->qs[x], skb);
/* If selected queue has length q->limit+1, this means that /* If selected queue has length q->limit+1, this means that
@ -310,6 +313,7 @@ sfq_requeue(struct sk_buff *skb, struct Qdisc* sch)
kfree_skb(skb); kfree_skb(skb);
return NET_XMIT_CN; return NET_XMIT_CN;
} }
sfq_inc(q, x); sfq_inc(q, x);
if (q->qs[x].qlen == 1) { /* The flow is new */ if (q->qs[x].qlen == 1) { /* The flow is new */
if (q->tail == SFQ_DEPTH) { /* It is the first flow */ if (q->tail == SFQ_DEPTH) { /* It is the first flow */
@ -322,6 +326,7 @@ sfq_requeue(struct sk_buff *skb, struct Qdisc* sch)
q->tail = x; q->tail = x;
} }
} }
if (++sch->q.qlen <= q->limit) { if (++sch->q.qlen <= q->limit) {
sch->qstats.requeues++; sch->qstats.requeues++;
return 0; return 0;
@ -432,11 +437,13 @@ static int sfq_init(struct Qdisc *sch, struct rtattr *opt)
for (i = 0; i < SFQ_HASH_DIVISOR; i++) for (i = 0; i < SFQ_HASH_DIVISOR; i++)
q->ht[i] = SFQ_DEPTH; q->ht[i] = SFQ_DEPTH;
for (i = 0; i < SFQ_DEPTH; i++) { for (i = 0; i < SFQ_DEPTH; i++) {
skb_queue_head_init(&q->qs[i]); skb_queue_head_init(&q->qs[i]);
q->dep[i + SFQ_DEPTH].next = i + SFQ_DEPTH; q->dep[i + SFQ_DEPTH].next = i + SFQ_DEPTH;
q->dep[i + SFQ_DEPTH].prev = i + SFQ_DEPTH; q->dep[i + SFQ_DEPTH].prev = i + SFQ_DEPTH;
} }
q->limit = SFQ_DEPTH - 1; q->limit = SFQ_DEPTH - 1;
q->max_depth = 0; q->max_depth = 0;
q->tail = SFQ_DEPTH; q->tail = SFQ_DEPTH;
@ -449,6 +456,7 @@ static int sfq_init(struct Qdisc *sch, struct rtattr *opt)
if (err) if (err)
return err; return err;
} }
for (i = 0; i < SFQ_DEPTH; i++) for (i = 0; i < SFQ_DEPTH; i++)
sfq_link(q, i); sfq_link(q, i);
return 0; return 0;