From mboxrd@z Thu Jan 1 00:00:00 1970 From: bert hubert Date: Sat, 08 Dec 2001 23:54:48 +0000 Subject: [LARTC] Re: further CBQ/tc documentation ds9a.nl/lartc/manpages Message-Id: List-Id: References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: lartc@vger.kernel.org On Sat, Dec 08, 2001 at 06:30:47PM -0500, jamal wrote: > > > On Sun, 9 Dec 2001, bert hubert wrote: > > > > > I will, but I bet you 5 euros that I'm right :-) We are talking about the > > TBF, aren't we? > > > > The trick is that TBF delays packets and the policer drops packet when > exceeding their profile. Well, we're both right to some extent. The policer drops packets which are larger than the configured MTU, but it also dimensions the second bucket to be of size mtu! >From net/sched/police.c (trimmed a bit, added some comments): int tcf_police(struct sk_buff *skb, struct tcf_police *p) { psched_time_t now; long toks,ptoks = 0; spin_lock(&p->lock); p->stats.bytes += skb->len; p->stats.packets++; if (skb->len <= p->mtu) { if (p->R_tab = NULL) { spin_unlock(&p->lock); return p->result; } PSCHED_GET_TIME(now); toks = PSCHED_TDIFF_SAFE(now, p->t_c, p->burst, 0); // tokens that arrived since last invocation if (p->P_tab) { ptoks = toks + p->ptoks; if (ptoks > (long)L2T_P(p, p->mtu)) ptoks = (long)L2T_P(p, p->mtu); // cap total available ptokens to mtu ptoks -= L2T_P(p, skb->len); // deduct packet size } toks += p->toks; if (toks > (long)p->burst) toks = p->burst; // cap regular number of tokens toks -= L2T(p, skb->len); // deduct packet size if ((toks|ptoks) >= 0) { // send if both are positive p->t_c = now; p->toks = toks; // do accounting p->ptoks = ptoks; spin_unlock(&p->lock); return p->result; } } p->stats.overlimits++; spin_unlock(&p->lock); return p->action; } It's a draw? :-) Regards, bert -- http://www.PowerDNS.com Versatile DNS Software & Services Trilab The Technology People Netherlabs BV / Rent-a-Nerd.nl - Nerd Available - 'SYN! .. SYN|ACK! .. ACK!' - the mating call of the internet _______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/lartc/