netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jarek Poplawski <jarkao2@gmail.com>
To: Denys Fedoryschenko <denys@visp.net.lb>
Cc: netdev@vger.kernel.org
Subject: Re: iproute2 / tbf with large burst seems broken again
Date: Tue, 25 Aug 2009 09:41:20 +0000	[thread overview]
Message-ID: <20090825094120.GA11478@ff.dom.local> (raw)
In-Reply-To: <20090825090035.GB7879@ff.dom.local>

On Tue, Aug 25, 2009 at 09:00:35AM +0000, Jarek Poplawski wrote:
> On Tue, Aug 25, 2009 at 08:43:06AM +0000, Jarek Poplawski wrote:
> ...
> > since these 64 bits will be needed soon for higher rates anyway, I
> > guess we could try some change like the patch below, if you find it
> > works for you (I didn't test it yet.)

I hope this time it works...

Jarek P.

--- (take 2)

 net/sched/sch_tbf.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
index e22dfe8..7d0fe69 100644
--- a/net/sched/sch_tbf.c
+++ b/net/sched/sch_tbf.c
@@ -108,8 +108,8 @@ struct tbf_sched_data
 	struct qdisc_rate_table	*P_tab;
 
 /* Variables */
-	long	tokens;			/* Current number of B tokens */
-	long	ptokens;		/* Current number of P tokens */
+	u32	tokens;			/* Current number of B tokens */
+	u32	ptokens;		/* Current number of P tokens */
 	psched_time_t	t_c;		/* Time check-point */
 	struct Qdisc	*qdisc;		/* Inner qdisc, default - bfifo queue */
 	struct qdisc_watchdog watchdog;	/* Watchdog timer */
@@ -160,21 +160,21 @@ static struct sk_buff *tbf_dequeue(struct Qdisc* sch)
 
 	if (skb) {
 		psched_time_t now;
-		long toks;
-		long ptoks = 0;
+		long long toks;
+		long long ptoks = 0;
 		unsigned int len = qdisc_pkt_len(skb);
 
 		now = psched_get_time();
-		toks = psched_tdiff_bounded(now, q->t_c, q->buffer);
+		toks = min_t(u32, now - q->t_c, q->buffer);
 
 		if (q->P_tab) {
 			ptoks = toks + q->ptokens;
-			if (ptoks > (long)q->mtu)
+			if (ptoks > q->mtu)
 				ptoks = q->mtu;
 			ptoks -= L2T_P(q, len);
 		}
 		toks += q->tokens;
-		if (toks > (long)q->buffer)
+		if (toks > q->buffer)
 			toks = q->buffer;
 		toks -= L2T(q, len);
 

  reply	other threads:[~2009-08-25  9:41 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-24 23:37 iproute2 / tbf with large burst seems broken again Denys Fedoryschenko
2009-08-25  6:22 ` Jarek Poplawski
2009-08-25  7:34   ` Denys Fedoryschenko
2009-08-25  8:43     ` Jarek Poplawski
2009-08-25  9:00       ` Jarek Poplawski
2009-08-25  9:41         ` Jarek Poplawski [this message]
2009-08-25 10:29           ` Denys Fedoryschenko
2009-08-25 11:16           ` Denys Fedoryschenko
2009-08-25 12:13             ` Jarek Poplawski
2009-08-25 12:18               ` Denys Fedoryschenko
2009-08-26 21:59                 ` [PATCH] " Jarek Poplawski
2009-08-31  5:05                   ` David Miller
2009-08-31  5:30                     ` Jarek Poplawski
2009-08-31  5:32                       ` David Miller
2009-08-31  8:03                         ` Denys Fedoryschenko
2009-08-31  8:18                         ` Denys Fedoryschenko
2009-08-31  8:37                           ` David Miller
2009-08-31  8:51                             ` Denys Fedoryschenko
2009-08-31  9:05                               ` Jarek Poplawski
2009-08-31  8:58                             ` Jarek Poplawski
2009-09-01 22:51                               ` David Miller
2009-08-31  8:49                           ` Jarek Poplawski
2009-08-25 20:03             ` Jarek Poplawski
2009-08-26 19:03               ` Jarek Poplawski
  -- strict thread matches above, loose matches on Subject: below --
2009-08-24 12:07 Denys Fedoryschenko

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=20090825094120.GA11478@ff.dom.local \
    --to=jarkao2@gmail.com \
    --cc=denys@visp.net.lb \
    --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;
as well as URLs for NNTP newsgroup(s).