On Monday 21 June 2004 06:04, Ed Wildgoose wrote: > >So does it just let you be honest about your rated speed, or is there an > > added performance bonus from being able to specify your true ATM rate? > <snip> > > So the patch simply works out how many cells you will need and > multiplies up by the real size of those cells to work out bw used. Interesting. > It's also more conservative than before. Previously it was working out > an effective rate for 8 byte packets, and using that rate for 8-15 byte > packets. Now it works out the rate for 15 byte packets and uses *that* > for 8-15 byte packets. 10 byte PPP overhead + 5 byte ATM overhead? > It's probably not perfect, but it's extremely accurate for me. I can > bump up the bandwidth on my interfaces to basically 99% and for stable > streams there is no queuing. P2P still seems to cause so many new > incoming connections that you need to throttle down the incoming to > leave some space for an unexpected incoming rush - but for most users I > think it will work nicely I think we have a winner. I had to futz with the patch some, as Andy did. Once I got it to compile, I kicked my rate up too 256. That didn't work, but 224 seems stable. I started to `scp` a copy of linux-2.6.3.tar.bz2 since it's all I could find on short notice to a remote host. Both machines have host CPUs fast enough for 3DES encryption not be the limiting factor. I ping out around 15ms - 70ms to my gateway. That's about what I was seeing at 160kbit before. I'm running PPPoEoATM here. I don't know what my actual PPPoE overhead is, but I guess 10 bytes is reasonably close enough. PPPoE is handled by my Westell Wirespeed, which doesn't provide any useful cell information. At the moment I cannot easily obtain a cell count to determine my actual PPP overhead. Perhaps I need to idle everything and do one of those 'speed tests' to see what my actual upstream is. Could be it's really around 224, since I'm not guaranteed 256 by my ISP anyway. 218 packets transmitted, 218 packets received, 0% packet loss round-trip min/avg/max = 11.5/41.3/70.6 ms I have attached a unified `diff` with both the HTB `tc` patch and Ed Wildgoose's new PPPoA overhead patch as a unified patch. -- Jason Boxman Perl Programmer / *NIX Systems Administrator Shimberg Center for Affordable Housing | University of Florida http://edseek.com/ - Linux and FOSS stuff
diff -uNr iproute-20010824/tc/q_htb.c iproute-20010824-mod/tc/q_htb.c --- iproute-20010824/tc/q_htb.c 2004-06-22 01:09:00.000000000 -0400 +++ iproute-20010824-mod/tc/q_htb.c 2004-06-22 00:27:44.000000000 -0400 @@ -34,10 +34,14 @@ " default minor id of class to which unclassified packets are sent {0}\n" " r2q DRR quantums are computed as rate in Bps/r2q {10}\n" " debug string of 16 numbers each 0-3 {0}\n\n" - "... class add ... htb rate R1 burst B1 [prio P] [slot S] [pslot PS]\n" + "... class add ... htb rate R1 [burst B1] [mpu B] [overhead O]\n" + " [prio P] [slot S] [pslot PS]\n" " [ceil R2] [cburst B2] [mtu MTU] [quantum Q]\n" " rate rate allocated to this class (class can still borrow)\n" " burst max bytes burst which can be accumulated during idle period {computed}\n" + " mpu minimum packet size used in rate computations\n" + " overhead per-packet size overhead used in rate computations\n" + " ceil definite upper class rate (no borrows) {rate}\n" " cburst burst but for ceil {computed}\n" " mtu max packet size we create rate map for {1600}\n" @@ -102,7 +106,9 @@ struct tc_htb_opt opt; __u32 rtab[256],ctab[256]; unsigned buffer=0,cbuffer=0; - int cell_log=-1,ccell_log = -1,mtu; + int cell_log=-1,ccell_log = -1; + unsigned mtu, mpu; + unsigned char mpu8 = 0, overhead = 0; struct rtattr *tail; memset(&opt, 0, sizeof(opt)); mtu = 1600; /* eth packet len */ @@ -119,6 +125,16 @@ if (get_u32(&mtu, *argv, 10)) { explain1("mtu"); return -1; } + } else if (matches(*argv, "mpu") == 0) { + NEXT_ARG(); + if (get_u8(&mpu8, *argv, 10)) { + explain1("mpu"); return -1; + } + } else if (matches(*argv, "overhead") == 0) { + NEXT_ARG(); + if (get_u8(&overhead, *argv, 10)) { + explain1("overhead"); return -1; + } } else if (matches(*argv, "quantum") == 0) { NEXT_ARG(); if (get_u32(&opt.quantum, *argv, 10)) { @@ -190,14 +206,18 @@ if (!buffer) buffer = opt.rate.rate / HZ + mtu; if (!cbuffer) cbuffer = opt.ceil.rate / HZ + mtu; - if ((cell_log = tc_calc_rtable(opt.rate.rate, rtab, cell_log, mtu, 0)) < 0) { +/* encode overhead and mpu, 8 bits each, into lower 16 bits */ + mpu = (unsigned)mpu8 | (unsigned)overhead << 8; + opt.ceil.mpu = mpu; opt.rate.mpu = mpu; + + if ((cell_log = tc_calc_rtable(opt.rate.rate, rtab, cell_log, mtu, mpu)) < 0) { fprintf(stderr, "htb: failed to calculate rate table.\n"); return -1; } opt.buffer = tc_calc_xmittime(opt.rate.rate, buffer); opt.rate.cell_log = cell_log; - if ((ccell_log = tc_calc_rtable(opt.ceil.rate, ctab, cell_log, mtu, 0)) < 0) { + if ((ccell_log = tc_calc_rtable(opt.ceil.rate, ctab, cell_log, mtu, mpu)) < 0) { fprintf(stderr, "htb: failed to calculate ceil rate table.\n"); return -1; } @@ -221,6 +241,7 @@ double buffer,cbuffer; SPRINT_BUF(b1); SPRINT_BUF(b2); + SPRINT_BUF(b3); if (opt == NULL) return 0; @@ -243,10 +264,16 @@ fprintf(f, "ceil %s ", sprint_rate(hopt->ceil.rate, b1)); cbuffer = ((double)hopt->ceil.rate*tc_core_tick2usec(hopt->cbuffer))/1000000; 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, "burst %s/%u mpu %s overhead %s ", + sprint_size(buffer, b1), + 1<<hopt->rate.cell_log, + sprint_size(hopt->rate.mpu&0xFF, b2), + sprint_size((hopt->rate.mpu>>8)&0xFF, b3)); + fprintf(f, "cburst %s/%u mpu %s overhead %s ", + sprint_size(cbuffer, b1), + 1<<hopt->ceil.cell_log, + sprint_size(hopt->ceil.mpu&0xFF, b2), + sprint_size((hopt->ceil.mpu>>8)&0xFF, b3)); fprintf(f, "level %d ", (int)hopt->level); } else { fprintf(f, "burst %s ", sprint_size(buffer, b1)); diff -uNr iproute-20010824/tc/tc_core.c iproute-20010824-mod/tc/tc_core.c --- iproute-20010824/tc/tc_core.c 2000-04-16 13:42:55.000000000 -0400 +++ iproute-20010824-mod/tc/tc_core.c 2004-06-22 00:41:52.000000000 -0400 @@ -50,6 +50,9 @@ unsigned mpu) { int i; + unsigned overhead = (mpu >> 8) & 0xFF; + mpu = mpu & 0xFF; + unsigned sz; if (mtu == 0) mtu = 2047; @@ -59,10 +62,22 @@ while ((mtu>>cell_log) > 255) cell_log++; } + + // HACK - UK ATM Params + int encaps_cell_sz = 53; + int encaps_cell_overhead = 5; + int encaps_data_sz = encaps_cell_sz - encaps_cell_overhead; + int proto_overhead = 10; // PPP Overhead + for (i=0; i<256; i++) { - unsigned sz = (i<<cell_log); - if (sz < mpu) - sz = mpu; + if (overhead) + sz += overhead; + sz = ((i+1)<<cell_log)-1; +// unsigned sz = ((i+1)<<cell_log)-1; + sz = sz + proto_overhead; + sz = ( (int)((sz-1)/encaps_data_sz) + 1) * encaps_cell_sz; +// if (sz < mpu) +// sz = mpu; rtab[i] = tc_core_usec2tick(1000000*((double)sz/bps)); } return cell_log;