From: Eric Dumazet <eric.dumazet@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: Patrick McHardy <kaber@trash.net>,
netdev <netdev@vger.kernel.org>,
Jarek Poplawski <jarkao2@gmail.com>
Subject: [PATCH net-next-2.6] sch_sfq: allow big packets and be fair
Date: Tue, 21 Dec 2010 00:16:16 +0100 [thread overview]
Message-ID: <1292886976.2627.146.camel@edumazet-laptop> (raw)
In-Reply-To: <1292864525.2800.189.camel@edumazet-laptop>
SFQ is currently 'limited' to small packets, because it uses a 16bit
allotment number per flow. Switch it to 18bit, and use appropriate
handling to make sure this allotment is in [1 .. quantum] range before a
new packet is dequeued, so that fairness is respected.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Jarek Poplawski <jarkao2@gmail.com>
Cc: Patrick McHardy <kaber@trash.net>
---
net/sched/sch_sfq.c | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c
index c474b4b..878704a 100644
--- a/net/sched/sch_sfq.c
+++ b/net/sched/sch_sfq.c
@@ -67,7 +67,7 @@
IMPLEMENTATION:
This implementation limits maximal queue length to 128;
- maximal mtu to 2^15-1; max 128 flows, number of hash buckets to 1024.
+ maximal mtu to 2^16-1; max 128 flows, number of hash buckets to 1024.
The only goal of this restrictions was that all data
fit into one 4K page on 32bit arches.
@@ -99,9 +99,10 @@ struct sfq_slot {
sfq_index qlen; /* number of skbs in skblist */
sfq_index next; /* next slot in sfq chain */
struct sfq_head dep; /* anchor in dep[] chains */
- unsigned short hash; /* hash value (index in ht[]) */
- short allot; /* credit for this slot */
+ unsigned int hash:14; /* hash value (index in ht[]) */
+ unsigned int allot:18; /* credit for this slot */
};
+#define ALLOT_ZERO (1 << 16)
struct sfq_sched_data
{
@@ -394,7 +395,7 @@ sfq_enqueue(struct sk_buff *skb, struct Qdisc *sch)
q->tail->next = x;
}
q->tail = slot;
- slot->allot = q->quantum;
+ slot->allot = ALLOT_ZERO + q->quantum;
}
if (++sch->q.qlen <= q->limit) {
sch->bstats.bytes += qdisc_pkt_len(skb);
@@ -430,8 +431,14 @@ sfq_dequeue(struct Qdisc *sch)
if (q->tail == NULL)
return NULL;
+next:
a = q->tail->next;
slot = &q->slots[a];
+ if (slot->allot <= ALLOT_ZERO) {
+ q->tail = slot;
+ slot->allot += q->quantum;
+ goto next;
+ }
skb = slot_dequeue_head(slot);
sfq_dec(q, a);
sch->q.qlen--;
@@ -446,9 +453,8 @@ sfq_dequeue(struct Qdisc *sch)
return skb;
}
q->tail->next = next_a;
- } else if ((slot->allot -= qdisc_pkt_len(skb)) <= 0) {
- q->tail = slot;
- slot->allot += q->quantum;
+ } else {
+ slot->allot -= qdisc_pkt_len(skb);
}
return skb;
}
@@ -610,7 +616,9 @@ static int sfq_dump_class_stats(struct Qdisc *sch, unsigned long cl,
struct sfq_sched_data *q = qdisc_priv(sch);
const struct sfq_slot *slot = &q->slots[q->ht[cl - 1]];
struct gnet_stats_queue qs = { .qlen = slot->qlen };
- struct tc_sfq_xstats xstats = { .allot = slot->allot };
+ struct tc_sfq_xstats xstats = {
+ .allot = slot->allot - ALLOT_ZERO
+ };
struct sk_buff *skb;
slot_queue_walk(slot, skb)
next prev parent reply other threads:[~2010-12-20 23:16 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-15 14:03 [PATCH] net_sched: sch_sfq: fix allot handling Eric Dumazet
2010-12-15 16:03 ` Patrick McHardy
2010-12-15 16:27 ` Eric Dumazet
2010-12-15 16:40 ` [PATCH v2] " Eric Dumazet
2010-12-15 16:43 ` Patrick McHardy
2010-12-15 16:55 ` Eric Dumazet
2010-12-15 17:03 ` Patrick McHardy
2010-12-15 17:09 ` Eric Dumazet
2010-12-15 17:21 ` Patrick McHardy
2010-12-15 17:30 ` [PATCH v3] " Eric Dumazet
2010-12-15 18:18 ` [PATCH net-next-2.6] net_sched: sch_sfq: add backlog info in sfq_dump_class_stats() Eric Dumazet
2010-12-15 19:10 ` Eric Dumazet
2010-12-16 8:16 ` Jarek Poplawski
2010-12-16 10:18 ` [PATCH v2 " Eric Dumazet
2010-12-16 11:03 ` [PATCH " Eric Dumazet
2010-12-16 13:09 ` Jarek Poplawski
2010-12-20 21:14 ` David Miller
2010-12-20 21:18 ` [PATCH v3] net_sched: sch_sfq: fix allot handling David Miller
2010-12-16 13:08 ` [PATCH v2] " Eric Dumazet
2010-12-17 16:52 ` [RFC PATCH] net_sched: sch_sfq: better struct layouts Eric Dumazet
2010-12-19 21:22 ` Jarek Poplawski
2010-12-20 17:02 ` [PATCH v2] " Eric Dumazet
2010-12-20 21:33 ` David Miller
2010-12-20 21:42 ` Eric Dumazet
2010-12-20 22:54 ` [PATCH v3 net-next-2.6] " Eric Dumazet
2010-12-21 5:33 ` David Miller
2010-12-20 22:55 ` [PATCH v2] " Jarek Poplawski
2010-12-20 23:16 ` Eric Dumazet [this message]
2010-12-21 10:15 ` [PATCH net-next-2.6] sch_sfq: allow big packets and be fair Jarek Poplawski
2010-12-21 10:30 ` Jarek Poplawski
2010-12-21 10:44 ` Eric Dumazet
2010-12-21 10:56 ` Jarek Poplawski
2010-12-21 10:57 ` Eric Dumazet
2010-12-21 11:39 ` Jarek Poplawski
2010-12-21 12:17 ` Jarek Poplawski
2010-12-21 13:04 ` [PATCH v2 " Eric Dumazet
2010-12-21 13:47 ` Jarek Poplawski
2010-12-28 21:46 ` David Miller
2010-12-29 7:53 ` [PATCH v3 " Eric Dumazet
2010-12-31 20:48 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1292886976.2627.146.camel@edumazet-laptop \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=jarkao2@gmail.com \
--cc=kaber@trash.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox