From mboxrd@z Thu Jan 1 00:00:00 1970 From: Markus Schulz Date: Fri, 03 Mar 2006 01:23:09 +0000 Subject: Re: [LARTC] Patch to allow for the ATM "cell tax" Message-Id: <200603030223.09545.msc@antzsystem.de> MIME-Version: 1 Content-Type: multipart/mixed; boundary="Boundary-00=_9p5BEHPMoYLJ+Kz" List-Id: References: <1141284603.10264.168.camel@ras.pc.brisbane.lube> In-Reply-To: <1141284603.10264.168.camel@ras.pc.brisbane.lube> To: lartc@vger.kernel.org --Boundary-00=_9p5BEHPMoYLJ+Kz Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Am Donnerstag, 2. M=C3=A4rz 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=20 table with exactly the same behaviour as the htb-overhead patch from=20 Jesper. But now as static patch for iproute's tc, without need for=20 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=20 see the difference in mathematics in both calculations. I think it must=20 be possible, but can't see my fault. With a rate table of at least one=20 entry from zero (or 40b) to it is possible. But, is it possible=20 with only 256 rate table entries? I've attached a simple program, which implements three versions of=20 calculations. Two of them use a rate table, at first the static version=20 (without htb-overhead patch), second one with "simulated" kernel patch=20 (like Jesper's one) and at least a "realtime calculation" as a=20 reference value. The second rate table is 100% equivalent to realtime calc. But the=20 static version differs for some ip-length values from it. And i don't=20 understand why.=20 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=20 i think it should be possible :) =2D- =09 Markus Schulz --Boundary-00=_9p5BEHPMoYLJ+Kz Content-Type: text/x-csrc; charset="utf-8"; name="rate-table.c" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="rate-table.c" #include #include 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 <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)< 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; } --Boundary-00=_9p5BEHPMoYLJ+Kz Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ LARTC mailing list LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc --Boundary-00=_9p5BEHPMoYLJ+Kz--