netdev
[Top] [All Lists]

[PATCH] - sch_htb: Drop packet when direct queue overflows

To: Thomas Graf <tgraf@xxxxxxx>
Subject: [PATCH] - sch_htb: Drop packet when direct queue overflows
From: Asim Shankar <asimshankar@xxxxxxxxx>
Date: Thu, 21 Apr 2005 15:41:24 -0500
Cc: netdev@xxxxxxxxxxx
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:references; b=fN7mEtDU1VXd2rEySHrpLL4a94yHBhyHXVrTEyyAGEYJw69VGl10bgNaG5VB6ykfl3N5uPTyoM8FqBEVSIy8yLrsoHIQyaTcDB1yjcMTChfjDWDK+jvAKQ9/oJOyjNgqYcckSe7pWZGG+KKyE1+LzzUtaz52a9+Byj+tGh10lj4=
In-reply-to: <20050421195605.GJ577@postel.suug.ch>
References: <7bca1cb50504211221655fd54c@mail.gmail.com> <20050421195605.GJ577@postel.suug.ch>
Reply-to: Asim Shankar <asimshankar@xxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
> > If a packet is classified as HTB_DIRECT but the direct_queue is
> > already full, then the packet doesn't get enqueued but sch->q.qlen++
> > will happen a few lines later. Overflowing of the direct_queue
> > probably rarely happens in practice, but I was playing around and
> > noticed it happen in some corner cases of my testing.
> 
> Yes, that's a bug.
> 
> > Should the packet be dropped instead? Like:
> >
> > if (cl == HTB_DIRECT) {
> >         /* enqueue to helper queue */
> >         if (q->direct_queue.qlen < q->direct_qlen) {
> >                 __skb_queue_tail(&q->direct_queue, skb);
> >                 q->direct_pkts++;
> >         } else {
> >                sch->qstats.drops++;
> >                 kfree_skb(skb);
> >                 return NET_XMIT_DROP;
> >        }
> > }
> 
> Can you send a patch?
> 
Patched pasted and attached:

--- linux-2.6.11.7/net/sched/sch_htb.c  2005-04-07 13:57:45.000000000 -0500
+++ linux-2.6.11.7-new/net/sched/sch_htb.c      2005-04-21 14:17:36.272065816 
-0500
@@ -717,6 +717,10 @@
        if (q->direct_queue.qlen < q->direct_qlen) {
            __skb_queue_tail(&q->direct_queue, skb);
            q->direct_pkts++;
+       } else {
+           kfree_skb (skb);
+           sch->qstats.drops++;
+           return NET_XMIT_DROP;
        }
 #ifdef CONFIG_NET_CLS_ACT
     } else if (!cl) {

Attachment: patch-htb-2.6.11.7
Description: Text document

<Prev in Thread] Current Thread [Next in Thread>