From: Markus Schulz <msc@antzsystem.de>
To: lartc@vger.kernel.org
Subject: Re: [LARTC] Patch to allow for the ATM "cell tax"
Date: Fri, 03 Mar 2006 01:23:09 +0000 [thread overview]
Message-ID: <200603030223.09545.msc@antzsystem.de> (raw)
In-Reply-To: <1141284603.10264.168.camel@ras.pc.brisbane.lube>
[-- Attachment #1: Type: text/plain, Size: 2323 bytes --]
Am Donnerstag, 2. März 2006 20:54 schrieb Adam James:
> Hi,
>
> On Thu, 2006-03-02 at 15:49 +0000, Andy Furniss wrote:
> > Russell Stuart wrote:
> > > The following patch to tc allows it to perform an exact
> > > ATM / ADSL rate calculation.
> >
> > I probably haven't read the patch properly - but I don't think you
> > can do it exactly without patching net/sched/sched_htb.c aswell.
> > Specifically you need to add overhead - 1 before htb shifts the
> > length to get the slot num (-1 because you need to get 48 and 49
> > payload length to map to different slots 47 and 48 do). The table
> > should be filled according to this.
>
> As Markus mentioned in another post on this thread, Jesper Dangaard
> Brouer (http://www.adsl-optimizer.dk) has already written an iproute2
> and Linux kernel patch that implements the above. ATM cell alignment
> is done in tc_core.c, and the per packet overhead is passed to the
> relevant kernel modules.
once again i have thought about this topic and tried to built a rate
table with exactly the same behaviour as the htb-overhead patch from
Jesper. But now as static patch for iproute's tc, without need for
patching htb or other kernel modules.
But in all my experiments i can't calculate an equivalent rate table.
It differs in behaviour from per packet calculated overhead. But i don't
see the difference in mathematics in both calculations. I think it must
be possible, but can't see my fault. With a rate table of at least one
entry from zero (or 40b) to <mtu> it is possible. But, is it possible
with only 256 rate table entries?
I've attached a simple program, which implements three versions of
calculations. Two of them use a rate table, at first the static version
(without htb-overhead patch), second one with "simulated" kernel patch
(like Jesper's one) and at least a "realtime calculation" as a
reference value.
The second rate table is 100% equivalent to realtime calc. But the
static version differs for some ip-length values from it. And i don't
understand why.
Perhaps someone can point me to the difference?
The program is only for testing rate tables calculations.
It would be nice to do it without a htb or other qdisc module patch. And
i think it should be possible :)
--
Markus Schulz
[-- Attachment #2: rate-table.c --]
[-- Type: text/x-csrc, Size: 2824 bytes --]
#include <stdio.h>
#include <stdlib.h>
int align_to_cell(int packet_size, int cell_size, int cell_payload)
{
int needed_cells;
needed_cells = packet_size / cell_payload;
if((packet_size % cell_payload) > 0)
needed_cells++;
return needed_cells * cell_size;
}
int main(int argc, char** argv)
{
if(argc < 4)
{
printf("usage: %s <bps> <mtu> <mpu> <overhead> <0|1 for show rate table>\n", argv[0]);
return 1;
}
int bps = atoi(argv[1]);
int mtu = atoi(argv[2]);
int mpu = atoi(argv[3]);
int overhead = atoi(argv[4]);
int show_rates=0;
if(argc > 5)
show_rates = atoi(argv[5]);
if(mtu == 0 )
{
printf("mtu == 0\n");
return 1;
}
int cell_log = 0;
int i;
while ((mtu>>cell_log) > 255)
cell_log++;
unsigned int rate_table_static[256];
unsigned int rate_table_dynamic[256];
printf("cell_log = %d\n", cell_log);
for (i=0; i<256; i++)
{
unsigned sz1 = ((i+1)<<cell_log);
unsigned sz2 = ((i+1)<<cell_log);
//static overhead calculated in rate table
sz1 += overhead;
if (sz1 < mpu)
sz1 = mpu;
if (sz2 < mpu)
sz2 = mpu;
//align both rate tables to ATM cells
sz1 = align_to_cell(sz1, 53, 48);
sz2 = align_to_cell(sz2, 53, 48);
rate_table_static[i] = (1000000*sz1)/bps;
rate_table_dynamic[i] = (1000000*sz2)/bps;
}
//print both tables?
if(show_rates)
{
int j;
printf("Complete rate table:\n");
for(j=0; j < 256;j++)
{
printf("Entry:%d Static-overhead: %d Dynamic-overhead: %d\n", j,rate_table_static[j], rate_table_dynamic[j]);
}
}
int k=0;
printf("check from 40 byte to <MTU all possible packets and compare rate table entries.\n");
printf("rate1 -> static overhead calculation\n");
printf("rate2 -> dynamic overhead calcuation\n");
printf("rate3 -> realtime calculation. this is the reference value\n");
int rate1_err=0;
int rate2_err=0;
for(k=40; k < mtu;k++)
{
//bytes to send at ip-layer (at least 40)
int ps = k;
//static overhead calculated already in rate table
unsigned int rate1 = rate_table_static[ps >> cell_log];
//dynamic overhead calculated in kernel L2T
unsigned int rate2 = rate_table_dynamic[(ps-1 + overhead) >> cell_log];
//realtime calculated
int sz3 = ps + overhead;
if(sz3 < mpu)
sz3 = mpu;
sz3 = align_to_cell(sz3, 53, 48);
unsigned int rate3 = (1000000*sz3) /bps;
if(rate1 != rate3)
{
printf("rate1 is wrong: Bytes at IP-Layer = %d rate1=%d rate3 = %d\n", ps, rate1, rate3);
rate1_err++;
}
if(rate2 != rate3)
{
printf("rate2 is wrong: Bytes at IP-Layer = %d rate2=%d rate3 = %d\n", ps, rate2, rate3);
rate2_err++;
}
}
printf("Rate1 Error: %d Rate2 Error: %d\n", rate1_err, rate2_err);
return 0;
}
[-- Attachment #3: Type: text/plain, Size: 143 bytes --]
_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
next prev parent reply other threads:[~2006-03-03 1:23 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-02 7:30 [LARTC] Patch to allow for the ATM "cell tax" Russell Stuart
2006-03-02 13:37 ` Markus Schulz
2006-03-02 13:51 ` Markus Schulz
2006-03-02 15:49 ` Andy Furniss
2006-03-02 19:54 ` Adam James
2006-03-02 21:35 ` Andy Furniss
2006-03-02 22:18 ` Russell Stuart
2006-03-02 22:23 ` Stephen Hemminger
2006-03-02 22:45 ` Jason Boxman
2006-03-02 23:44 ` Russell Stuart
2006-03-03 0:27 ` Jason Boxman
2006-03-03 0:43 ` Russell Stuart
2006-03-03 1:23 ` Markus Schulz [this message]
2006-03-03 1:49 ` Markus Schulz
2006-03-03 1:54 ` Russell Stuart
2006-03-03 2:23 ` Markus Schulz
2006-03-03 2:27 ` gentoo
2006-03-03 13:43 ` Andreas Hasenack
2006-03-03 16:18 ` Jason Boxman
2006-03-03 16:45 ` Andreas Hasenack
2006-03-03 18:45 ` Jason Boxman
2006-03-03 19:34 ` Andreas Hasenack
2006-03-05 19:27 ` Andy Furniss
2006-03-06 17:26 ` Jesper Dangaard Brouer
2006-03-13 18:09 ` Jason Boxman
2006-03-14 0:34 ` Russell Stuart
2006-03-14 0:49 ` Jason Boxman
2006-03-14 1:26 ` Russell Stuart
2006-03-14 2:10 ` Adam James
2006-03-14 13:14 ` Andy Furniss
2006-03-14 13:25 ` Andy Furniss
2006-03-14 23:28 ` Russell Stuart
2006-03-15 0:29 ` Andy Furniss
2006-12-06 18:59 ` Taylor, Grant
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=200603030223.09545.msc@antzsystem.de \
--to=msc@antzsystem.de \
--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.