Skip to content

Commit 363437f

Browse files
Eric Dumazetdavem330
authored andcommitted
net_sched: sfb: optimize enqueue on full queue
In case SFB queue is full (hard limit reached), there is no point spending time to compute hash and maximum qlen/p_mark. We instead just early drop packet. Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 18cf124 commit 363437f

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

net/sched/sch_sfb.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,12 @@ static int sfb_enqueue(struct sk_buff *skb, struct Qdisc *sch)
287287
u32 r, slot, salt, sfbhash;
288288
int ret = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
289289

290+
if (unlikely(sch->q.qlen >= q->limit)) {
291+
sch->qstats.overlimits++;
292+
q->stats.queuedrop++;
293+
goto drop;
294+
}
295+
290296
if (q->rehash_interval > 0) {
291297
unsigned long limit = q->rehash_time + q->rehash_interval;
292298

@@ -332,12 +338,9 @@ static int sfb_enqueue(struct sk_buff *skb, struct Qdisc *sch)
332338
slot ^= 1;
333339
sfb_skb_cb(skb)->hashes[slot] = 0;
334340

335-
if (unlikely(minqlen >= q->max || sch->q.qlen >= q->limit)) {
341+
if (unlikely(minqlen >= q->max)) {
336342
sch->qstats.overlimits++;
337-
if (minqlen >= q->max)
338-
q->stats.bucketdrop++;
339-
else
340-
q->stats.queuedrop++;
343+
q->stats.bucketdrop++;
341344
goto drop;
342345
}
343346

0 commit comments

Comments
 (0)