0

I did a small experiment by using Linux-tc

My question is what is the difference between Burst and MTU at Linux tc-htb

It seems that they have a same effect. They change a only burst value.

(we can see by using this command tc -s -s -d c ls dev <iface> )

However, two page say differently.

1) HTB - Traffic control How to said

burst max bytes burst which can be accumulated during idle period {computed}

mtu max packet size we create rate map for {1600}

2) MAN tc-tbf page said

burst Also known as buffer or maxburst. Size of the bucket, in bytes. ...

mtu/minburst Specifies the size of the peakrate bucket.

Is it right that they have a different explanation but same effect?

Thank you for reading!

0

Actually, It looks same when looking linux tc source code.

Two option change the variable 'buffer'.

In detail, HTB change the variable 'buffer' when using the options mtu and burst

However TBF change the variable 'buffer' when using the option burst

but the variable 'mtu' when using the option mtu

But I need to study what it means, more deeply.

[1] /tc/q_tbf.c

static int tbf_parse_opt(struct qdisc_util *qu, int argc, char **argv,
             struct nlmsghdr *n, const char *dev)
{
...
        } else if (matches(*argv, "burst") == 0 ||
            strcmp(*argv, "buffer") == 0 ||
            strcmp(*argv, "maxburst") == 0) {
            const char *parm_name = *argv;

            NEXT_ARG();
            if (buffer) {
                fprintf(stderr, "tbf: duplicate \"buffer/burst/maxburst\" specification\n");
                return -1;
            }
            if (get_size_and_cell(&buffer, &Rcell_log, *argv) < 0) {
                explain1(parm_name, *argv);
                return -1;
            }
...
        } else if (strcmp(*argv, "mtu") == 0 ||
               strcmp(*argv, "minburst") == 0) {
            const char *parm_name = *argv;

            NEXT_ARG();
            if (mtu) {
                fprintf(stderr, "tbf: duplicate \"mtu/minburst\" specification\n");
                return -1;
            }
            if (get_size_and_cell(&mtu, &Pcell_log, *argv) < 0) {
                explain1(parm_name, *argv);
                return -1;
            }
...
    opt.buffer = tc_calc_xmittime(opt.rate.rate, buffer);

    if (opt.peakrate.rate) {
        opt.peakrate.mpu      = mpu;
        opt.peakrate.overhead = overhead;
        if (tc_calc_rtable(&opt.peakrate, ptab, Pcell_log, mtu, linklayer) < 0) {
            fprintf(stderr, "tbf: failed to calculate peak rate table.\n");
            return -1;
        }
        opt.mtu = tc_calc_xmittime(opt.peakrate.rate, mtu);
    }

...
}

[2] /tc/q_htb.c

static int htb_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n, const char *dev)
...
        } else if (matches(*argv, "burst") == 0 ||
               strcmp(*argv, "buffer") == 0 ||
               strcmp(*argv, "maxburst") == 0) {
            NEXT_ARG();
            if (get_size_and_cell(&buffer, &cell_log, *argv) < 0) {
                explain1("buffer");
                return -1;
            }
        } else if (matches(*argv, "cburst") == 0 ||
               strcmp(*argv, "cbuffer") == 0 ||
               strcmp(*argv, "cmaxburst") == 0) {
            NEXT_ARG();
            if (get_size_and_cell(&cbuffer, &ccell_log, *argv) < 0) {
                explain1("cbuffer");
                return -1;
            }
        } else if 
..


...
    if (!buffer)
        buffer = rate64 / get_hz() + mtu;
    if (!cbuffer)
        cbuffer = ceil64 / get_hz() + mtu;
...
}


static int htb_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
{
...
        if (show_details) {
            fprintf(f, "burst %s/%u mpu %s ",
                sprint_size(buffer, b1),
                1<<hopt->rate.cell_log,
                sprint_size(hopt->rate.mpu, b2));
            fprintf(f, "cburst %s/%u mpu %s ",
                sprint_size(cbuffer, b1),
                1<<hopt->ceil.cell_log,
                sprint_size(hopt->ceil.mpu, b2));
            fprintf(f, "level %d ", (int)hopt->level);
        } else {

...
}


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.