All of lore.kernel.org
 help / color / mirror / Atom feed
From: bert hubert <ahu@ds9a.nl>
To: lartc@vger.kernel.org
Subject: [LARTC] Re: further CBQ/tc documentation ds9a.nl/lartc/manpages
Date: Sat, 08 Dec 2001 23:54:48 +0000	[thread overview]
Message-ID: <marc-lartc-100785573410094@msgid-missing> (raw)
In-Reply-To: <marc-lartc-100785524509147@msgid-missing>

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/

  parent reply	other threads:[~2001-12-08 23:54 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-08 20:43 [LARTC] Re: further CBQ/tc documentation ds9a.nl/lartc/manpages jamal
2001-12-08 21:30 ` bert hubert
2001-12-08 21:56 ` jamal
2001-12-08 23:08 ` bert hubert
2001-12-08 23:29 ` jamal
2001-12-08 23:30 ` jamal
2001-12-08 23:45 ` Henrik Nordstrom
2001-12-08 23:54 ` bert hubert [this message]
2001-12-09  1:19 ` jamal
2001-12-09  1:35 ` bert hubert
2001-12-09  2:11 ` jamal
2001-12-09  2:30 ` jamal
2001-12-09 11:38 ` Henrik Nordstrom
2001-12-09 14:40 ` bert hubert
2001-12-09 14:49 ` jamal
2001-12-09 15:01 ` jamal
2001-12-09 15:49 ` Henrik Nordstrom
2001-12-09 16:45 ` Henrik Nordstrom
2001-12-09 21:41 ` jamal
2001-12-09 22:33 ` Michael T. Babcock
2001-12-09 22:36 ` Michael T. Babcock
2001-12-10  1:12 ` Cédric Rivard
2001-12-10  7:53 ` Don Cohen
2001-12-10  8:38 ` Martin Devera
2001-12-10  8:41 ` Henrik Nordstrom
2001-12-10  9:59 ` Henrik Nordstrom
2001-12-10 11:35 ` Martin Devera
2001-12-10 11:59 ` Martin Devera
2001-12-10 12:00 ` Henrik Nordstrom
2001-12-10 12:14 ` bert hubert
2001-12-10 12:25 ` Henrik Nordstrom
2001-12-10 12:52 ` Martin Devera
2001-12-10 13:29 ` jamal
2001-12-10 13:40 ` Martin Devera
2001-12-10 13:42 ` Jim Fleming
2001-12-10 13:52 ` Michael T. Babcock
2001-12-10 13:54 ` Michael T. Babcock
2001-12-10 13:56 ` Gerry Creager N5JXS
2001-12-10 13:58 ` Michael T. Babcock
2001-12-10 14:02 ` Martin Devera
2001-12-10 14:51 ` Jim Fleming

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=marc-lartc-100785573410094@msgid-missing \
    --to=ahu@ds9a.nl \
    --cc=lartc@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.