netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Asim Shankar <asimshankar@gmail.com>
To: Thomas Graf <tgraf@suug.ch>
Cc: netdev@oss.sgi.com
Subject: [PATCH] - sch_htb: Drop packet when direct queue overflows
Date: Thu, 21 Apr 2005 15:41:24 -0500	[thread overview]
Message-ID: <7bca1cb505042113417a5d9f59@mail.gmail.com> (raw)
In-Reply-To: <20050421195605.GJ577@postel.suug.ch>

[-- Attachment #1: Type: text/plain, Size: 1334 bytes --]

> > 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 #2: patch-htb-2.6.11.7 --]
[-- Type: text/plain, Size: 436 bytes --]

--- 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) {

  reply	other threads:[~2005-04-21 20:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-21 19:21 BUG: HTB? Asim Shankar
2005-04-21 19:56 ` Thomas Graf
2005-04-21 20:41   ` Asim Shankar [this message]
2005-04-21 21:54     ` [PATCH] - sch_htb: Drop packet when direct queue overflows Thomas Graf
2005-04-21 23:02       ` [PATCH 2.6.11.7] sch_htb: Drop packet when direct queue is full Asim Shankar

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=7bca1cb505042113417a5d9f59@mail.gmail.com \
    --to=asimshankar@gmail.com \
    --cc=netdev@oss.sgi.com \
    --cc=tgraf@suug.ch \
    /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;
as well as URLs for NNTP newsgroup(s).