Linux Advanced Routing and Traffic Control list
 help / color / mirror / Atom feed
From: "lartc@manchotnetworks.net" <lartc@manchotnetworks.net>
To: lartc@vger.kernel.org
Subject: Re: no bug in tcng; tc kbit v. tcng kbps [LARTC] was tcng error
Date: Fri, 28 Nov 2003 07:43:06 +0000	[thread overview]
Message-ID: <marc-lartc-107000548614419@msgid-missing> (raw)
In-Reply-To: <marc-lartc-106996355118825@msgid-missing>

hi martin,


On Thu, 2003-11-27 at 20:58, Martin A. Brown wrote:
> Hello Charles,
> 
>  : after slicing and dicing, i found that i had cut and pasted bad syntax,
>  : so i have solved the problem posted in my first message.
> 
> Where did you find the original (I'm hoping it's not one of mine).  If so,
> let me know, and I'll fix it.
indeed, i used some of your examples as well as those included in the
tcng/examples-ng directory, and wshaper.htb to create the following
(i'll post it now as it is untested but functioning less or more)

#define DEVICE eth0
#define DOWNLINK 1024 
#define UPLINK 512 

#include "fields.tc"
#include "ports.tc"

dev DEVICE {
    ingress {
        $policer = SLB( cir DOWNLINK kBps, cbs 60kB, mpu 0b );
        class (<>) if SLB_ok($policer);
        drop if 1;
    }

    egress {
        class (<$high>) if tcp_ACK || 
                           ip_proto = IPPROTO_ICMP ||
                           ip_tos = 0x10 ||
                           tcp_dport = PORT_SSH ||
                           tcp_dport = 8080 ||
                           tcp_dport = 18082 ||
                           tcp_dport = 18083;


        class (<$medium>) if tcp_dport = PORT_HTTP ||
                             tcp_dport = PORT_SMTP ; 

        class (<$low>) if 1;

        htb () {
            class (rate UPLINK bps, burst 6kB) {
                $high = class (prio 1, rate UPLINK kBps)
                    { sfq (perturb 10 sec); };
                $medium = class (prio 2, rate (0.9*UPLINK)kBps)
                    { sfq (perturb 10 sec); };
                $low = class (prio 3, rate (0.8*UPLINK) kBps)
                    { sfq (perturb 10 sec); };
            }
        }
    }
}


>   [ example snipped ]
> 
>  : notice that the UPLINK of 512 kbps (arguably 524288 bps) has been
>  : incorrectly calculated as 64000 bps
> 
> You have not actually found a bug, but rather a historical strangeness
> about the Linux traffic control system.  For reasons of which I'm
> ignorant, the syntax for the "tc" command uses bps for bytes/second.  So,
> 64000 bytes/second is actually 512 kilobits/second ("512 kbps" in common
> usage), but is 512 kbit to the "tc" tool.  Here's a brief chart:
> 
>                       tc syntax       tcng syntax
>                   +----------------+----------------+
>      bytes/second |      bps       |      Bps       |
>       bits/second |      bit       |      bps       |
>  kilobytes/second |     kbps       |     kBps       |
>   kilobits/second |     kbit       |     kbps       |
>                   +----------------+----------------+
> 
> Note that the tcng syntax is exactly the same sort of syntax we use in
> general when discussing speed of WAN links.  "It's a 512 kbps line" means
> it's 512 kilobits per second, but this would be 64000 bytes per second if
> we were writing a "tc" command line.
ah ha -- thanks for this!!!! much clearer now ... perhaps this table is
worthy of inclusion in the howto or a compatibility option in tcng?

curious also on your experience with ingress -- i noticed that using a
Single Leaky Bucket, and playing with the cbs parameter can dramatically
(obviously) affect the ingress policing. is there a general rule of
thumb in calculating the cbs size based on the cir?

cheers

charles




_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

  reply	other threads:[~2003-11-28  7:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-27 19:58 no bug in tcng; tc kbit v. tcng kbps [LARTC] was tcng error Martin A. Brown
2003-11-28  7:43 ` lartc [this message]
2003-12-01  6:01 ` Martin A. Brown

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-107000548614419@msgid-missing \
    --to=lartc@manchotnetworks.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox