Add wget2nand from David Goodenough, useful for RouterOS to OpenWrt migration
[openwrt.git] / package / iproute2 / patches / 003-iproute2-htb_overhead.patch
1 --- iproute2-2.6.11-050330.new/tc/q_htb.c Sun May 12 22:18:27 2002
2 +++ iproute2-2.6.11-050330.new/tc/q_htb.c Sat Oct 18 00:05:18 2003
3 @@ -34,10 +34,14 @@
4 " default minor id of class to which unclassified packets are sent {0}\n"
5 " r2q DRR quantums are computed as rate in Bps/r2q {10}\n"
6 " debug string of 16 numbers each 0-3 {0}\n\n"
7 - "... class add ... htb rate R1 burst B1 [prio P] [slot S] [pslot PS]\n"
8 + "... class add ... htb rate R1 [burst B1] [mpu B] [overhead O]\n"
9 + " [prio P] [slot S] [pslot PS]\n"
10 " [ceil R2] [cburst B2] [mtu MTU] [quantum Q]\n"
11 " rate rate allocated to this class (class can still borrow)\n"
12 " burst max bytes burst which can be accumulated during idle period {computed}\n"
13 + " mpu minimum packet size used in rate computations\n"
14 + " overhead per-packet size overhead used in rate computations\n"
15 +
16 " ceil definite upper class rate (no borrows) {rate}\n"
17 " cburst burst but for ceil {computed}\n"
18 " mtu max packet size we create rate map for {1600}\n"
19 @@ -102,7 +106,9 @@
20 struct tc_htb_opt opt;
21 __u32 rtab[256],ctab[256];
22 unsigned buffer=0,cbuffer=0;
23 - int cell_log=-1,ccell_log = -1,mtu;
24 + int cell_log=-1,ccell_log = -1;
25 + unsigned mtu, mpu;
26 + unsigned char mpu8 = 0, overhead = 0;
27 struct rtattr *tail;
28
29 memset(&opt, 0, sizeof(opt)); mtu = 1600; /* eth packet len */
30 @@ -119,6 +125,16 @@
31 if (get_u32(&mtu, *argv, 10)) {
32 explain1("mtu"); return -1;
33 }
34 + } else if (matches(*argv, "mpu") == 0) {
35 + NEXT_ARG();
36 + if (get_u8(&mpu8, *argv, 10)) {
37 + explain1("mpu"); return -1;
38 + }
39 + } else if (matches(*argv, "overhead") == 0) {
40 + NEXT_ARG();
41 + if (get_u8(&overhead, *argv, 10)) {
42 + explain1("overhead"); return -1;
43 + }
44 } else if (matches(*argv, "quantum") == 0) {
45 NEXT_ARG();
46 if (get_u32(&opt.quantum, *argv, 10)) {
47 @@ -190,14 +206,18 @@
48 if (!buffer) buffer = opt.rate.rate / HZ + mtu;
49 if (!cbuffer) cbuffer = opt.ceil.rate / HZ + mtu;
50
51 - if ((cell_log = tc_calc_rtable(opt.rate.rate, rtab, cell_log, mtu, 0)) < 0) {
52 +/* encode overhead and mpu, 8 bits each, into lower 16 bits */
53 + mpu = (unsigned)mpu8 | (unsigned)overhead << 8;
54 + opt.ceil.mpu = mpu; opt.rate.mpu = mpu;
55 +
56 + if ((cell_log = tc_calc_rtable(opt.rate.rate, rtab, cell_log, mtu, mpu)) < 0) {
57 fprintf(stderr, "htb: failed to calculate rate table.\n");
58 return -1;
59 }
60 opt.buffer = tc_calc_xmittime(opt.rate.rate, buffer);
61 opt.rate.cell_log = cell_log;
62
63 - if ((ccell_log = tc_calc_rtable(opt.ceil.rate, ctab, cell_log, mtu, 0)) < 0) {
64 + if ((ccell_log = tc_calc_rtable(opt.ceil.rate, ctab, cell_log, mtu, mpu)) < 0) {
65 fprintf(stderr, "htb: failed to calculate ceil rate table.\n");
66 return -1;
67 }
68 @@ -221,6 +241,7 @@
69 double buffer,cbuffer;
70 SPRINT_BUF(b1);
71 SPRINT_BUF(b2);
72 + SPRINT_BUF(b3);
73
74 if (opt == NULL)
75 return 0;
76 @@ -243,10 +264,16 @@
77 fprintf(f, "ceil %s ", sprint_rate(hopt->ceil.rate, b1));
78 cbuffer = ((double)hopt->ceil.rate*tc_core_tick2usec(hopt->cbuffer))/1000000;
79 if (show_details) {
80 - fprintf(f, "burst %s/%u mpu %s ", sprint_size(buffer, b1),
81 - 1<<hopt->rate.cell_log, sprint_size(hopt->rate.mpu, b2));
82 - fprintf(f, "cburst %s/%u mpu %s ", sprint_size(cbuffer, b1),
83 - 1<<hopt->ceil.cell_log, sprint_size(hopt->ceil.mpu, b2));
84 + fprintf(f, "burst %s/%u mpu %s overhead %s ",
85 + sprint_size(buffer, b1),
86 + 1<<hopt->rate.cell_log,
87 + sprint_size(hopt->rate.mpu&0xFF, b2),
88 + sprint_size((hopt->rate.mpu>>8)&0xFF, b3));
89 + fprintf(f, "cburst %s/%u mpu %s overhead %s ",
90 + sprint_size(cbuffer, b1),
91 + 1<<hopt->ceil.cell_log,
92 + sprint_size(hopt->ceil.mpu&0xFF, b2),
93 + sprint_size((hopt->ceil.mpu>>8)&0xFF, b3));
94 fprintf(f, "level %d ", (int)hopt->level);
95 } else {
96 fprintf(f, "burst %s ", sprint_size(buffer, b1));
This page took 0.0458 seconds and 5 git commands to generate.