linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [NET_SCHED] BUG in qdisc TBF (token bucket filter)
@ 2004-03-03 12:31 Jesper Dangaard Brouer
  2004-03-05  6:47 ` Dmitry Torokhov
  2004-04-06 14:17 ` [NET_SCHED] BUG in qdisc TBF (token bucket filter) Jesper Dangaard Brouer
  0 siblings, 2 replies; 9+ messages in thread
From: Jesper Dangaard Brouer @ 2004-03-03 12:31 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1849 bytes --]


BUG in qdisc TBF (token bucket filter).

 Problem in    : Kernel 2.4.22 (and newer, tested till 2.4.25-rc2)
 Problem NOT in: kernel 2.4.21 (and older)

Problem:
--------
 After I add an tbf qdisc to an htb class, then the htb class disappear
 from the output-listing "tc -s class ls dev ethX".

tc-versions:
 I have tested with different version of the "tc" utility.
 And different versions of the htb patch.

 "tc utility, iproute2-ss010824" (debian's iproute)
 "tc utility, iproute2-ss020116" (with htb3.6-020525)

I've not tested if the tfb qdisc and htb class still works, but only
that the output-listing is wrong.  (I'm running 2.4.21 on my
router/firewall to be on the safe side.)

Howto reproduce:
----------------
 #Removing previous 'root' handle/classification
 /sbin/tc qdisc del dev eth0 root
 #
 /sbin/tc qdisc add dev eth0 root handle 1: htb default 10
 #
 /sbin/tc class add dev eth0 parent 1: classid 1:10 htb rate 500kbit

 # output-listing of class'es
 tc -s class ls dev eth0
 #
 # output:
 class htb 1:10 root prio 0 rate 500Kbit ceil 500Kbit burst 2239b cburst 2239b
  Sent 812 bytes 6 pkts (dropped 0, overlimits 0)
  lended: 6 borrowed: 0 giants: 0
  tokens: 27239 ctokens: 27239

 # the tbf line
 /sbin/tc qdisc add dev eth0 parent 1:10 handle 4210: tbf rate 500kbit \
          latency 50ms burst 2239b

 # output-listing of class'es
 tc -s class ls dev eth0
 #
 # output:
 <NOTHING>

The output-listing of class'es returns, if I remove the tbf qdisc again.

Diff between file /net/sched/sch_tbf.c in kernel 2.4.21 and 2.4.22 is
attached.


Hilsen
  Jesper Brouer

--
-------------------------------------------------------------------
System Administrator
Dept. of Computer Science, University of Copenhagen
E-mail: hawk@diku.dk, Direct Tel.: 353 21464
-------------------------------------------------------------------

[-- Attachment #2: Type: TEXT/PLAIN, Size: 8633 bytes --]

--- linux-2.4.21/net/sched/sch_tbf.c	Fri Dec 21 18:42:06 2001
+++ linux-2.4.22/net/sched/sch_tbf.c	Mon Aug 25 13:44:44 2003
@@ -7,6 +7,8 @@
  *		2 of the License, or (at your option) any later version.
  *
  * Authors:	Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
+ *		Dmitry Torokhov <dtor@mail.ru> - allow attaching inner qdiscs -
+ *						 original idea by Martin Devera
  *
  */
 
@@ -123,62 +125,63 @@
 	long	ptokens;		/* Current number of P tokens */
 	psched_time_t	t_c;		/* Time check-point */
 	struct timer_list wd_timer;	/* Watchdog timer */
+	struct Qdisc	*qdisc;		/* Inner qdisc, default - bfifo queue */
 };
 
 #define L2T(q,L)   ((q)->R_tab->data[(L)>>(q)->R_tab->rate.cell_log])
 #define L2T_P(q,L) ((q)->P_tab->data[(L)>>(q)->P_tab->rate.cell_log])
 
-static int
-tbf_enqueue(struct sk_buff *skb, struct Qdisc* sch)
+static int tbf_enqueue(struct sk_buff *skb, struct Qdisc* sch)
 {
 	struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data;
+	int ret;
 
-	if (skb->len > q->max_size)
-		goto drop;
-	__skb_queue_tail(&sch->q, skb);
-	if ((sch->stats.backlog += skb->len) <= q->limit) {
-		sch->stats.bytes += skb->len;
-		sch->stats.packets++;
-		return 0;
-	}
-
-	/* Drop action: undo the things that we just did,
-	 * i.e. make tail drop
-	 */
-
-	__skb_unlink(skb, &sch->q);
-	sch->stats.backlog -= skb->len;
-
-drop:
-	sch->stats.drops++;
+	if (skb->len > q->max_size || sch->stats.backlog + skb->len > q->limit) {
+		sch->stats.drops++;
 #ifdef CONFIG_NET_CLS_POLICE
-	if (sch->reshape_fail==NULL || sch->reshape_fail(skb, sch))
+		if (sch->reshape_fail == NULL || sch->reshape_fail(skb, sch))
 #endif
-		kfree_skb(skb);
-	return NET_XMIT_DROP;
-}
-
-static int
-tbf_requeue(struct sk_buff *skb, struct Qdisc* sch)
-{
-	__skb_queue_head(&sch->q, skb);
+			kfree_skb(skb);
+	
+		return NET_XMIT_DROP;
+	}
+	
+	if ((ret = q->qdisc->enqueue(skb, q->qdisc)) != 0) {
+		sch->stats.drops++;
+		return ret;
+	}	
+	
+	sch->q.qlen++;
 	sch->stats.backlog += skb->len;
+	sch->stats.bytes += skb->len;
+	sch->stats.packets++;
 	return 0;
 }
 
-static int
-tbf_drop(struct Qdisc* sch)
+static int tbf_requeue(struct sk_buff *skb, struct Qdisc* sch)
 {
-	struct sk_buff *skb;
+	struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data;
+	int ret;
+	
+	if ((ret = q->qdisc->ops->requeue(skb, q->qdisc)) == 0) {
+		sch->q.qlen++; 
+		sch->stats.backlog += skb->len;
+	}
+	
+	return ret;
+}
 
-	skb = __skb_dequeue_tail(&sch->q);
-	if (skb) {
-		sch->stats.backlog -= skb->len;
+static unsigned int tbf_drop(struct Qdisc* sch)
+{
+	struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data;
+	unsigned int len;
+	
+	if ((len = q->qdisc->ops->drop(q->qdisc)) != 0) {
+		sch->q.qlen--;
+		sch->stats.backlog -= len;
 		sch->stats.drops++;
-		kfree_skb(skb);
-		return 1;
 	}
-	return 0;
+	return len;
 }
 
 static void tbf_watchdog(unsigned long arg)
@@ -189,19 +192,19 @@
 	netif_schedule(sch->dev);
 }
 
-static struct sk_buff *
-tbf_dequeue(struct Qdisc* sch)
+static struct sk_buff *tbf_dequeue(struct Qdisc* sch)
 {
 	struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data;
 	struct sk_buff *skb;
 	
-	skb = __skb_dequeue(&sch->q);
+	skb = q->qdisc->dequeue(q->qdisc);
 
 	if (skb) {
 		psched_time_t now;
 		long toks;
 		long ptoks = 0;
-
+		unsigned int len = skb->len;
+		
 		PSCHED_GET_TIME(now);
 
 		toks = PSCHED_TDIFF_SAFE(now, q->t_c, q->buffer, 0);
@@ -210,18 +213,19 @@
 			ptoks = toks + q->ptokens;
 			if (ptoks > (long)q->mtu)
 				ptoks = q->mtu;
-			ptoks -= L2T_P(q, skb->len);
+			ptoks -= L2T_P(q, len);
 		}
 		toks += q->tokens;
 		if (toks > (long)q->buffer)
 			toks = q->buffer;
-		toks -= L2T(q, skb->len);
+		toks -= L2T(q, len);
 
 		if ((toks|ptoks) >= 0) {
 			q->t_c = now;
 			q->tokens = toks;
 			q->ptokens = ptoks;
-			sch->stats.backlog -= skb->len;
+			sch->stats.backlog -= len;
+			sch->q.qlen--;
 			sch->flags &= ~TCQ_F_THROTTLED;
 			return skb;
 		}
@@ -245,20 +249,25 @@
 		   This is the main idea of all FQ algorithms
 		   (cf. CSZ, HPFQ, HFSC)
 		 */
-		__skb_queue_head(&sch->q, skb);
-
+		
+		if (q->qdisc->ops->requeue(skb, q->qdisc) != NET_XMIT_SUCCESS) {
+			/* When requeue fails skb is dropped */ 
+			sch->q.qlen--;
+			sch->stats.backlog -= len;
+			sch->stats.drops++;
+		}	
+		
 		sch->flags |= TCQ_F_THROTTLED;
 		sch->stats.overlimits++;
 	}
 	return NULL;
 }
 
-
-static void
-tbf_reset(struct Qdisc* sch)
+static void tbf_reset(struct Qdisc* sch)
 {
 	struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data;
 
+	qdisc_reset(q->qdisc);
 	skb_queue_purge(&sch->q);
 	sch->stats.backlog = 0;
 	PSCHED_GET_TIME(q->t_c);
@@ -268,6 +277,31 @@
 	del_timer(&q->wd_timer);
 }
 
+static struct Qdisc *tbf_create_dflt_qdisc(struct net_device *dev, u32 limit)
+{
+	struct Qdisc *q = qdisc_create_dflt(dev, &bfifo_qdisc_ops);
+        struct rtattr *rta;
+	int ret;
+	
+	if (q) {
+		rta = kmalloc(RTA_LENGTH(sizeof(struct tc_fifo_qopt)), GFP_KERNEL);
+		if (rta) {
+			rta->rta_type = RTM_NEWQDISC;
+			rta->rta_len = RTA_LENGTH(sizeof(struct tc_fifo_qopt)); 
+			((struct tc_fifo_qopt *)RTA_DATA(rta))->limit = limit;
+			
+			ret = q->ops->change(q, rta);
+			kfree(rta);
+			
+			if (ret == 0)
+				return q;
+		}
+		qdisc_destroy(q);
+	}
+
+	return NULL;	
+}
+
 static int tbf_change(struct Qdisc* sch, struct rtattr *opt)
 {
 	int err = -EINVAL;
@@ -276,6 +310,7 @@
 	struct tc_tbf_qopt *qopt;
 	struct qdisc_rate_table *rtab = NULL;
 	struct qdisc_rate_table *ptab = NULL;
+	struct Qdisc *child = NULL;
 	int max_size,n;
 
 	if (rtattr_parse(tb, TCA_TBF_PTAB, RTA_DATA(opt), RTA_PAYLOAD(opt)) ||
@@ -308,8 +343,14 @@
 	}
 	if (max_size < 0)
 		goto done;
+	
+	if (q->qdisc == &noop_qdisc) {
+		if ((child = tbf_create_dflt_qdisc(sch->dev, qopt->limit)) == NULL)
+			goto done;
+	}
 
 	sch_tree_lock(sch);
+	if (child) q->qdisc = child;
 	q->limit = qopt->limit;
 	q->mtu = qopt->mtu;
 	q->max_size = max_size;
@@ -342,6 +383,8 @@
 	init_timer(&q->wd_timer);
 	q->wd_timer.function = tbf_watchdog;
 	q->wd_timer.data = (unsigned long)sch;
+
+	q->qdisc = &noop_qdisc;
 	
 	if ((err = tbf_change(sch, opt)) != 0) {
 		MOD_DEC_USE_COUNT;
@@ -359,6 +402,9 @@
 		qdisc_put_rtab(q->P_tab);
 	if (q->R_tab)
 		qdisc_put_rtab(q->R_tab);
+	
+	qdisc_destroy(q->qdisc);
+	q->qdisc = &noop_qdisc;
 
 	MOD_DEC_USE_COUNT;
 }
@@ -391,10 +437,93 @@
 	return -1;
 }
 
+static int tbf_dump_class(struct Qdisc *sch, unsigned long cl,
+	       		  struct sk_buff *skb, struct tcmsg *tcm)
+{
+	struct tbf_sched_data *q = (struct tbf_sched_data*)sch->data;
+
+	if (cl != 1) 	/* only one class */ 
+		return -ENOENT;
+    
+	tcm->tcm_parent = TC_H_ROOT;
+	tcm->tcm_handle = 1;
+	tcm->tcm_info = q->qdisc->handle;
+
+	return 0;
+}
+
+static int tbf_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
+		     struct Qdisc **old)
+{
+	struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data;
+
+	if (new == NULL)
+		new = &noop_qdisc;
+
+	sch_tree_lock(sch);	
+	*old = xchg(&q->qdisc, new);
+	qdisc_reset(*old);
+	sch_tree_unlock(sch);
+	
+	return 0;
+}
+
+static struct Qdisc *tbf_leaf(struct Qdisc *sch, unsigned long arg)
+{
+	struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data;
+	return q->qdisc;
+}
+
+static unsigned long tbf_get(struct Qdisc *sch, u32 classid)
+{
+	return 1;
+}
+
+static void tbf_put(struct Qdisc *sch, unsigned long arg)
+{
+}
+
+static int tbf_change_class(struct Qdisc *sch, u32 classid, u32 parentid, 
+			struct rtattr **tca, unsigned long *arg)
+{
+	return -ENOSYS;
+}
+
+static int tbf_delete(struct Qdisc *sch, unsigned long arg)
+{
+	return -ENOSYS;
+}
+
+static void tbf_walk(struct Qdisc *sch, struct qdisc_walker *walker)
+{
+	struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data;
+
+	if (!walker->stop) {
+		if (walker->count >= walker->skip) 
+			if (walker->fn(sch, (unsigned long)q, walker) < 0) { 
+				walker->stop = 1;
+				return;
+			}
+		walker->count++;
+	}
+}
+
+static struct Qdisc_class_ops tbf_class_ops =
+{
+	.graft		= 	tbf_graft,
+	.leaf		=	tbf_leaf,
+	.get		=	tbf_get,
+	.put		=	tbf_put,
+	.change		=	tbf_change_class,
+	.delete		=	tbf_delete,
+	.walk		=	tbf_walk,
+	.dump		=	tbf_dump_class,
+};
+
 struct Qdisc_ops tbf_qdisc_ops =
 {
 	NULL,
-	NULL,
+	&tbf_class_ops,
 	"tbf",
 	sizeof(struct tbf_sched_data),
 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [NET_SCHED] BUG in qdisc TBF (token bucket filter)
  2004-03-03 12:31 [NET_SCHED] BUG in qdisc TBF (token bucket filter) Jesper Dangaard Brouer
@ 2004-03-05  6:47 ` Dmitry Torokhov
  2004-03-05  6:47   ` [PATCH 1/2] NET: fix class reporting in TBF qdisc Dmitry Torokhov
  2004-03-05 15:40   ` Problems with WLAN orinoco_pci Matthias Jim Knopf
  2004-04-06 14:17 ` [NET_SCHED] BUG in qdisc TBF (token bucket filter) Jesper Dangaard Brouer
  1 sibling, 2 replies; 9+ messages in thread
From: Dmitry Torokhov @ 2004-03-05  6:47 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jesper Dangaard Brouer, marek cervenka, linux-net, James Morris

On Wednesday 03 March 2004 07:31 am, Jesper Dangaard Brouer wrote:
> 
> BUG in qdisc TBF (token bucket filter).
> 
>  Problem in    : Kernel 2.4.22 (and newer, tested till 2.4.25-rc2)
>  Problem NOT in: kernel 2.4.21 (and older)
> 
> Problem:
> --------
>  After I add an tbf qdisc to an htb class, then the htb class disappear
>  from the output-listing "tc -s class ls dev ethX".
> 

Yeah, I botched class reporting in TBF, I am sending 2 patches as followups
to this message:

01-tbf-class-reporting.patch - actual fix
02-tbf-trailing-whitespace.patch - removes trailing whitespace from TBF code

The patches are against 2.6 but I am pretty sure they will apply to 2.4.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/2] NET: fix class reporting in TBF qdisc
  2004-03-05  6:47 ` Dmitry Torokhov
@ 2004-03-05  6:47   ` Dmitry Torokhov
  2004-03-05  6:48     ` Dmitry Torokhov
  2004-03-05 15:40   ` Problems with WLAN orinoco_pci Matthias Jim Knopf
  1 sibling, 1 reply; 9+ messages in thread
From: Dmitry Torokhov @ 2004-03-05  6:47 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jesper Dangaard Brouer, marek cervenka, linux-net, James Morris


===================================================================


ChangeSet@1.1648, 2004-03-05 01:02:36-05:00, dtor_core@ameritech.net
  NET: Fix class reporting in TBF qdisc


 sch_tbf.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)


===================================================================



diff -Nru a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
--- a/net/sched/sch_tbf.c	Fri Mar  5 01:26:33 2004
+++ b/net/sched/sch_tbf.c	Fri Mar  5 01:26:33 2004
@@ -434,8 +434,7 @@
 	if (cl != 1) 	/* only one class */ 
 		return -ENOENT;
     
-	tcm->tcm_parent = TC_H_ROOT;
-	tcm->tcm_handle = 1;
+	tcm->tcm_handle |= TC_H_MIN(1);
 	tcm->tcm_info = q->qdisc->handle;
 
 	return 0;
@@ -486,11 +485,9 @@
 
 static void tbf_walk(struct Qdisc *sch, struct qdisc_walker *walker)
 {
-	struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data;
-
 	if (!walker->stop) {
-		if (walker->count >= walker->skip) 
-			if (walker->fn(sch, (unsigned long)q, walker) < 0) { 
+		if (walker->count >= walker->skip)
+			if (walker->fn(sch, 1, walker) < 0) {
 				walker->stop = 1;
 				return;
 			}

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] NET: fix class reporting in TBF qdisc
  2004-03-05  6:47   ` [PATCH 1/2] NET: fix class reporting in TBF qdisc Dmitry Torokhov
@ 2004-03-05  6:48     ` Dmitry Torokhov
  2004-03-05 20:57       ` Mike Fedyk
  0 siblings, 1 reply; 9+ messages in thread
From: Dmitry Torokhov @ 2004-03-05  6:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jesper Dangaard Brouer, marek cervenka, linux-net, James Morris


===================================================================


ChangeSet@1.1649, 2004-03-05 01:18:18-05:00, dtor_core@ameritech.net
  NET: TBF trailing whitespace cleanup


 sch_tbf.c |   68 +++++++++++++++++++++++++++++++-------------------------------
 1 files changed, 34 insertions(+), 34 deletions(-)


===================================================================



diff -Nru a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
--- a/net/sched/sch_tbf.c	Fri Mar  5 01:26:58 2004
+++ b/net/sched/sch_tbf.c	Fri Mar  5 01:26:58 2004
@@ -62,7 +62,7 @@
 
 	Algorithm.
 	----------
-	
+
 	Let N(t_i) be B/R initially and N(t) grow continuously with time as:
 
 	N(t+delta) = min{B/R, N(t) + delta}
@@ -146,15 +146,15 @@
 		if (sch->reshape_fail == NULL || sch->reshape_fail(skb, sch))
 #endif
 			kfree_skb(skb);
-	
+
 		return NET_XMIT_DROP;
 	}
-	
+
 	if ((ret = q->qdisc->enqueue(skb, q->qdisc)) != 0) {
 		sch->stats.drops++;
 		return ret;
-	}	
-	
+	}
+
 	sch->q.qlen++;
 	sch->stats.bytes += skb->len;
 	sch->stats.packets++;
@@ -165,10 +165,10 @@
 {
 	struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data;
 	int ret;
-	
+
 	if ((ret = q->qdisc->ops->requeue(skb, q->qdisc)) == 0)
-		sch->q.qlen++; 
-	
+		sch->q.qlen++;
+
 	return ret;
 }
 
@@ -176,7 +176,7 @@
 {
 	struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data;
 	unsigned int len;
-	
+
 	if ((len = q->qdisc->ops->drop(q->qdisc)) != 0) {
 		sch->q.qlen--;
 		sch->stats.drops++;
@@ -196,7 +196,7 @@
 {
 	struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data;
 	struct sk_buff *skb;
-	
+
 	skb = q->qdisc->dequeue(q->qdisc);
 
 	if (skb) {
@@ -204,7 +204,7 @@
 		long toks;
 		long ptoks = 0;
 		unsigned int len = skb->len;
-		
+
 		PSCHED_GET_TIME(now);
 
 		toks = PSCHED_TDIFF_SAFE(now, q->t_c, q->buffer, 0);
@@ -248,13 +248,13 @@
 		   This is the main idea of all FQ algorithms
 		   (cf. CSZ, HPFQ, HFSC)
 		 */
-		
+
 		if (q->qdisc->ops->requeue(skb, q->qdisc) != NET_XMIT_SUCCESS) {
-			/* When requeue fails skb is dropped */ 
+			/* When requeue fails skb is dropped */
 			sch->q.qlen--;
 			sch->stats.drops++;
-		}	
-		
+		}
+
 		sch->flags |= TCQ_F_THROTTLED;
 		sch->stats.overlimits++;
 	}
@@ -279,24 +279,24 @@
 	struct Qdisc *q = qdisc_create_dflt(dev, &bfifo_qdisc_ops);
         struct rtattr *rta;
 	int ret;
-	
+
 	if (q) {
 		rta = kmalloc(RTA_LENGTH(sizeof(struct tc_fifo_qopt)), GFP_KERNEL);
 		if (rta) {
 			rta->rta_type = RTM_NEWQDISC;
 			rta->rta_len = RTA_LENGTH(sizeof(struct tc_fifo_qopt)); 
 			((struct tc_fifo_qopt *)RTA_DATA(rta))->limit = limit;
-			
+
 			ret = q->ops->change(q, rta);
 			kfree(rta);
-			
+
 			if (ret == 0)
 				return q;
 		}
 		qdisc_destroy(q);
 	}
 
-	return NULL;	
+	return NULL;
 }
 
 static int tbf_change(struct Qdisc* sch, struct rtattr *opt)
@@ -340,7 +340,7 @@
 	}
 	if (max_size < 0)
 		goto done;
-	
+
 	if (q->qdisc == &noop_qdisc) {
 		if ((child = tbf_create_dflt_qdisc(sch->dev, qopt->limit)) == NULL)
 			goto done;
@@ -369,17 +369,17 @@
 static int tbf_init(struct Qdisc* sch, struct rtattr *opt)
 {
 	struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data;
-	
+
 	if (opt == NULL)
 		return -EINVAL;
-	
+
 	PSCHED_GET_TIME(q->t_c);
 	init_timer(&q->wd_timer);
 	q->wd_timer.function = tbf_watchdog;
 	q->wd_timer.data = (unsigned long)sch;
 
 	q->qdisc = &noop_qdisc;
-	
+
 	return tbf_change(sch, opt);
 }
 
@@ -393,7 +393,7 @@
 		qdisc_put_rtab(q->P_tab);
 	if (q->R_tab)
 		qdisc_put_rtab(q->R_tab);
-	
+
 	qdisc_destroy(q->qdisc);
 	q->qdisc = &noop_qdisc;
 }
@@ -404,10 +404,10 @@
 	unsigned char	 *b = skb->tail;
 	struct rtattr *rta;
 	struct tc_tbf_qopt opt;
-	
+
 	rta = (struct rtattr*)b;
 	RTA_PUT(skb, TCA_OPTIONS, 0, NULL);
-	
+
 	opt.limit = q->limit;
 	opt.rate = q->R_tab->rate;
 	if (q->P_tab)
@@ -427,13 +427,13 @@
 }
 
 static int tbf_dump_class(struct Qdisc *sch, unsigned long cl,
-	       		  struct sk_buff *skb, struct tcmsg *tcm)
+			  struct sk_buff *skb, struct tcmsg *tcm)
 {
 	struct tbf_sched_data *q = (struct tbf_sched_data*)sch->data;
 
-	if (cl != 1) 	/* only one class */ 
+	if (cl != 1) 	/* only one class */
 		return -ENOENT;
-    
+
 	tcm->tcm_handle |= TC_H_MIN(1);
 	tcm->tcm_info = q->qdisc->handle;
 
@@ -448,12 +448,12 @@
 	if (new == NULL)
 		new = &noop_qdisc;
 
-	sch_tree_lock(sch);	
+	sch_tree_lock(sch);
 	*old = xchg(&q->qdisc, new);
 	qdisc_reset(*old);
 	sch->q.qlen = 0;
 	sch_tree_unlock(sch);
-	
+
 	return 0;
 }
 
@@ -473,7 +473,7 @@
 }
 
 static int tbf_change_class(struct Qdisc *sch, u32 classid, u32 parentid, 
-			struct rtattr **tca, unsigned long *arg)
+			    struct rtattr **tca, unsigned long *arg)
 {
 	return -ENOSYS;
 }
@@ -497,7 +497,7 @@
 
 static struct Qdisc_class_ops tbf_class_ops =
 {
-	.graft		= 	tbf_graft,
+	.graft		=	tbf_graft,
 	.leaf		=	tbf_leaf,
 	.get		=	tbf_get,
 	.put		=	tbf_put,
@@ -529,7 +529,7 @@
 	return register_qdisc(&tbf_qdisc_ops);
 }
 
-static void __exit tbf_module_exit(void) 
+static void __exit tbf_module_exit(void)
 {
 	unregister_qdisc(&tbf_qdisc_ops);
 }

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Problems with WLAN orinoco_pci
  2004-03-05  6:47 ` Dmitry Torokhov
  2004-03-05  6:47   ` [PATCH 1/2] NET: fix class reporting in TBF qdisc Dmitry Torokhov
@ 2004-03-05 15:40   ` Matthias Jim Knopf
  2004-03-05 23:00     ` Peter Williams
  1 sibling, 1 reply; 9+ messages in thread
From: Matthias Jim Knopf @ 2004-03-05 15:40 UTC (permalink / raw)
  To: linux-kernel

Hi!

My WLAN net goes down from time to time. I cannot ping the wlan/dsl-router
(T-Sinus 111) and the only thing that helps is re-load the kernel-driver
(ifconfig eth1 down; modprobe -r orinoco_pci;
 sleep 8; ifconfig eth1 up; iwconfig ...)

Changing speed (down to 1 Mb/s) does no better

Bisides this, I have annother problem: This f***ing router mentioned
above cannot handle at least one connection per second in the long run
(>30 minutes) and crashes in the way, that it still may be pinged, but
I cannot access the router's web-interface, nor can I get to the internet
and have to power-cyle it (official advice from the company selling it!)
I tried hard to see these problems as one, but it seems, they ARE
two (see logs)


Here is, what I can offer you as info:
WLAN is a Netgear PCI MA311 (using hermes, orinoco)

# iwconfig
eth1      IEEE 802.11-DS  ESSID:"WLAN"  Nickname:"jim"
          Mode:Managed  Frequency:2.437GHz  Access Point: 00:30:F1:xx:xx:xx
          Bit Rate:11Mb/s   Tx-Power=15 dBm   Sensitivity:1/3
          Retry min limit:8   RTS thr:off   Fragment thr:off
          Encryption key:xxxx-xxxx-xx   Security mode:open
          Power Management:off
          Link Quality:20/92  Signal level:-76 dBm  Noise level:-136 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:1
          Tx excessive retries:2  Invalid misc:0   Missed beacon:0

# ping -c 5 router
PING wlan-router (192.168.2.1): 56 data bytes
--- wlan-router ping statistics ---
5 packets transmitted, 0 packets received, 100% packet loss

# uname -a
Linux laura 2.4.22 #2 Sun Dec 21 17:14:01 MET 2003 i686 unknown

# lsmod
Module                  Size  Used by
orinoco_pci             3056   1  (autoclean)
orinoco                31808   0  (autoclean) [orinoco_pci]
hermes                  5232   0  (autoclean) [orinoco_pci orinoco]
[...]

---{ /var/log/warn }----------------------------------------------------------------------------
Mar  5 15:41:43 laura kernel: eth1: Error -110 writing Tx descriptor to BAP
Mar  5 15:42:15 laura last message repeated 59 times
Mar  5 15:42:22 laura last message repeated 12 times
[...]
Mar  5 15:44:34 laura kernel: eth1: error -110 reading info frame. Frame dropped.
Mar  5 15:44:34 laura kernel: eth1: Error -110 writing Tx descriptor to BAP
Mar  5 15:44:41 laura last message repeated 14 times
Mar  5 15:45:33 laura kernel: .....<7>orinoco_lock() called with hw_unavailable (dev=e3c82800)
Mar  5 15:45:33 laura kernel: ......<7>orinoco_lock() called with hw_unavailable (dev=e3c82800)
Mar  5 15:45:33 laura last message repeated 4 times
Mar  5 15:45:33 laura kernel: .....<7>orinoco_lock() called with hw_unavailable (dev=e3c82800)
Mar  5 15:45:33 laura kernel: ......<7>orinoco_lock() called with hw_unavailable (dev=e3c82800)
Mar  5 15:45:33 laura last message repeated 4 times
Mar  5 15:45:34 laura kernel: .........;
[...]
------------------------------------------------------------------------------------------------


Thanks in advance for any help you can give me!

Matthias


-- 
EOF



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] NET: fix class reporting in TBF qdisc
  2004-03-05  6:48     ` Dmitry Torokhov
@ 2004-03-05 20:57       ` Mike Fedyk
  2004-03-06  4:33         ` Dmitry Torokhov
  0 siblings, 1 reply; 9+ messages in thread
From: Mike Fedyk @ 2004-03-05 20:57 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: linux-kernel, Jesper Dangaard Brouer, marek cervenka, linux-net,
	James Morris

Dmitry Torokhov wrote:
> ===================================================================
> 
> 
> ChangeSet@1.1649, 2004-03-05 01:18:18-05:00, dtor_core@ameritech.net
>   NET: TBF trailing whitespace cleanup
> 
> 
>  sch_tbf.c |   68 +++++++++++++++++++++++++++++++-------------------------------
>  1 files changed, 34 insertions(+), 34 deletions(-)
> 
> 
> ===================================================================
> 
> 
> 
> diff -Nru a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
> --- a/net/sched/sch_tbf.c	Fri Mar  5 01:26:58 2004
> +++ b/net/sched/sch_tbf.c	Fri Mar  5 01:26:58 2004
> @@ -62,7 +62,7 @@
>  
>  	Algorithm.
>  	----------
> -	
> +

That's a lot of whitespace cleanup in there too.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Problems with WLAN orinoco_pci
  2004-03-05 15:40   ` Problems with WLAN orinoco_pci Matthias Jim Knopf
@ 2004-03-05 23:00     ` Peter Williams
  0 siblings, 0 replies; 9+ messages in thread
From: Peter Williams @ 2004-03-05 23:00 UTC (permalink / raw)
  To: jim999; +Cc: linux-kernel

Matthias Jim Knopf wrote:
> Hi!
> 
> My WLAN net goes down from time to time. I cannot ping the wlan/dsl-router
> (T-Sinus 111) and the only thing that helps is re-load the kernel-driver
> (ifconfig eth1 down; modprobe -r orinoco_pci;
>  sleep 8; ifconfig eth1 up; iwconfig ...)
> 
> Changing speed (down to 1 Mb/s) does no better
> 
> Bisides this, I have annother problem: This f***ing router mentioned
> above cannot handle at least one connection per second in the long run
> (>30 minutes) and crashes in the way, that it still may be pinged, but
> I cannot access the router's web-interface, nor can I get to the internet
> and have to power-cyle it (official advice from the company selling it!)
> I tried hard to see these problems as one, but it seems, they ARE
> two (see logs)
> 
> 
> Here is, what I can offer you as info:
> WLAN is a Netgear PCI MA311 (using hermes, orinoco)
> 
> # iwconfig
> eth1      IEEE 802.11-DS  ESSID:"WLAN"  Nickname:"jim"
>           Mode:Managed  Frequency:2.437GHz  Access Point: 00:30:F1:xx:xx:xx
>           Bit Rate:11Mb/s   Tx-Power=15 dBm   Sensitivity:1/3
>           Retry min limit:8   RTS thr:off   Fragment thr:off
>           Encryption key:xxxx-xxxx-xx   Security mode:open
>           Power Management:off
>           Link Quality:20/92  Signal level:-76 dBm  Noise level:-136 dBm
>           Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:1
>           Tx excessive retries:2  Invalid misc:0   Missed beacon:0
> 
> # ping -c 5 router
> PING wlan-router (192.168.2.1): 56 data bytes
> --- wlan-router ping statistics ---
> 5 packets transmitted, 0 packets received, 100% packet loss
> 
> # uname -a
> Linux laura 2.4.22 #2 Sun Dec 21 17:14:01 MET 2003 i686 unknown
> 
> # lsmod
> Module                  Size  Used by
> orinoco_pci             3056   1  (autoclean)
> orinoco                31808   0  (autoclean) [orinoco_pci]
> hermes                  5232   0  (autoclean) [orinoco_pci orinoco]
> [...]
> 
> ---{ /var/log/warn }----------------------------------------------------------------------------
> Mar  5 15:41:43 laura kernel: eth1: Error -110 writing Tx descriptor to BAP
> Mar  5 15:42:15 laura last message repeated 59 times
> Mar  5 15:42:22 laura last message repeated 12 times
> [...]
> Mar  5 15:44:34 laura kernel: eth1: error -110 reading info frame. Frame dropped.
> Mar  5 15:44:34 laura kernel: eth1: Error -110 writing Tx descriptor to BAP
> Mar  5 15:44:41 laura last message repeated 14 times
> Mar  5 15:45:33 laura kernel: .....<7>orinoco_lock() called with hw_unavailable (dev=e3c82800)
> Mar  5 15:45:33 laura kernel: ......<7>orinoco_lock() called with hw_unavailable (dev=e3c82800)
> Mar  5 15:45:33 laura last message repeated 4 times
> Mar  5 15:45:33 laura kernel: .....<7>orinoco_lock() called with hw_unavailable (dev=e3c82800)
> Mar  5 15:45:33 laura kernel: ......<7>orinoco_lock() called with hw_unavailable (dev=e3c82800)
> Mar  5 15:45:33 laura last message repeated 4 times
> Mar  5 15:45:34 laura kernel: .........;
> [...]
> ------------------------------------------------------------------------------------------------
> 
> 
> Thanks in advance for any help you can give me!

I'm having similar problems with a PCMCIA orinoco wlan device.  Works 
perfectly with various 2.4.X kernels but keeps (partially) dropping the 
connection with 2.6.X kernels.  By partially, I mean connections are 
lost and pings report target hosts as unreachable but netstat -r reports 
make it look like the connection is still valid.  Doing an ifup (without 
a preceding ifdown) seems to fix the problem.

If more information would be helpful or testing is required don't 
hesitate to ask.

Peter
-- 
Dr Peter Williams, Chief Scientist                peterw@aurema.com
Aurema Pty Limited                                Tel:+61 2 9698 2322
PO Box 305, Strawberry Hills NSW 2012, Australia  Fax:+61 2 9699 9174
79 Myrtle Street, Chippendale NSW 2008, Australia http://www.aurema.com


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/2] NET: fix class reporting in TBF qdisc
  2004-03-05 20:57       ` Mike Fedyk
@ 2004-03-06  4:33         ` Dmitry Torokhov
  0 siblings, 0 replies; 9+ messages in thread
From: Dmitry Torokhov @ 2004-03-06  4:33 UTC (permalink / raw)
  To: Mike Fedyk
  Cc: linux-kernel, Jesper Dangaard Brouer, marek cervenka, linux-net,
	James Morris

On Friday 05 March 2004 03:57 pm, Mike Fedyk wrote:
> Dmitry Torokhov wrote:
> > ===================================================================
> > 
> > 
> > ChangeSet@1.1649, 2004-03-05 01:18:18-05:00, dtor_core@ameritech.net
> >   NET: TBF trailing whitespace cleanup
> > 
> > 
> >  sch_tbf.c |   68 +++++++++++++++++++++++++++++++-------------------------------
> >  1 files changed, 34 insertions(+), 34 deletions(-)
> > 
> > 
> > ===================================================================
> > 
> > 
> > 
> > diff -Nru a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
> > --- a/net/sched/sch_tbf.c	Fri Mar  5 01:26:58 2004
> > +++ b/net/sched/sch_tbf.c	Fri Mar  5 01:26:58 2004
> > @@ -62,7 +62,7 @@
> >  
> >  	Algorithm.
> >  	----------
> > -	
> > +
> 
> That's a lot of whitespace cleanup in there too.
> 

It's only whitespace cleanup... See the changeset comment. Ahh, I see...
I have the same subject on both emails. Doh! Well, it was almost 2AM...

-- 
Dmitry

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [NET_SCHED] BUG in qdisc TBF (token bucket filter)
  2004-03-03 12:31 [NET_SCHED] BUG in qdisc TBF (token bucket filter) Jesper Dangaard Brouer
  2004-03-05  6:47 ` Dmitry Torokhov
@ 2004-04-06 14:17 ` Jesper Dangaard Brouer
  1 sibling, 0 replies; 9+ messages in thread
From: Jesper Dangaard Brouer @ 2004-04-06 14:17 UTC (permalink / raw)
  To: linux-kernel; +Cc: dtor

(...lets keep google updated ;-))

The error have been corrected in kernel 2.4.26-rc1, by

 Dmitry Torokhov:
  o [NET_SCHED]: Fix class reporting in TBF qdisc

--Hawk

On Wed, 3 Mar 2004, Jesper Dangaard Brouer wrote:

> BUG in qdisc TBF (token bucket filter).
>
>  Problem in    : Kernel 2.4.22 (and newer, tested till 2.4.25-rc2)
>  Problem NOT in: kernel 2.4.21 (and older)
>
> Problem:
> --------
>  After I add an tbf qdisc to an htb class, then the htb class disappear
>  from the output-listing "tc -s class ls dev ethX".
>
> tc-versions:
>  I have tested with different version of the "tc" utility.
>  And different versions of the htb patch.
>
>  "tc utility, iproute2-ss010824" (debian's iproute)
>  "tc utility, iproute2-ss020116" (with htb3.6-020525)
>
> I've not tested if the tfb qdisc and htb class still works, but only
> that the output-listing is wrong.  (I'm running 2.4.21 on my
> router/firewall to be on the safe side.)
>
> Howto reproduce:
> ----------------
>  #Removing previous 'root' handle/classification
>  /sbin/tc qdisc del dev eth0 root
>  #
>  /sbin/tc qdisc add dev eth0 root handle 1: htb default 10
>  #
>  /sbin/tc class add dev eth0 parent 1: classid 1:10 htb rate 500kbit
>
>  # output-listing of class'es
>  tc -s class ls dev eth0
>  #
>  # output:
>  class htb 1:10 root prio 0 rate 500Kbit ceil 500Kbit burst 2239b cburst 2239b
>   Sent 812 bytes 6 pkts (dropped 0, overlimits 0)
>   lended: 6 borrowed: 0 giants: 0
>   tokens: 27239 ctokens: 27239
>
>  # the tbf line
>  /sbin/tc qdisc add dev eth0 parent 1:10 handle 4210: tbf rate 500kbit \
>           latency 50ms burst 2239b
>
>  # output-listing of class'es
>  tc -s class ls dev eth0
>  #
>  # output:
>  <NOTHING>
>
> The output-listing of class'es returns, if I remove the tbf qdisc again.
>
> Diff between file /net/sched/sch_tbf.c in kernel 2.4.21 and 2.4.22 is
> attached.
>
>
> Hilsen
>   Jesper Brouer
>
> --
> -------------------------------------------------------------------
> System Administrator
> Dept. of Computer Science, University of Copenhagen
> E-mail: hawk@diku.dk, Direct Tel.: 353 21464
> -------------------------------------------------------------------
>

Hilsen
  Jesper Brouer

--
-------------------------------------------------------------------
System Administrator / Research Assistent
Dept. of Computer Science, University of Copenhagen
E-mail: hawk@diku.dk, Direct Tel.: 353 21464
-------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2004-04-06 14:17 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-03 12:31 [NET_SCHED] BUG in qdisc TBF (token bucket filter) Jesper Dangaard Brouer
2004-03-05  6:47 ` Dmitry Torokhov
2004-03-05  6:47   ` [PATCH 1/2] NET: fix class reporting in TBF qdisc Dmitry Torokhov
2004-03-05  6:48     ` Dmitry Torokhov
2004-03-05 20:57       ` Mike Fedyk
2004-03-06  4:33         ` Dmitry Torokhov
2004-03-05 15:40   ` Problems with WLAN orinoco_pci Matthias Jim Knopf
2004-03-05 23:00     ` Peter Williams
2004-04-06 14:17 ` [NET_SCHED] BUG in qdisc TBF (token bucket filter) Jesper Dangaard Brouer

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