1 diff -Naur iproute-2.6.20-070313.orig/include/linux/pkt_sched.h iproute-2.6.20-070313/include/linux/pkt_sched.h
2 --- iproute-2.6.20-070313.orig/include/linux/pkt_sched.h 2007-03-13 14:50:56.000000000 -0700
3 +++ iproute-2.6.20-070313/include/linux/pkt_sched.h 2007-06-09 11:32:22.000000000 -0700
6 * The only reason for this is efficiency, it is possible
7 * to change these parameters in compile time.
9 + * If you need to play with these values, use esfq instead.
17 + TCA_SFQ_HASH_CLASSIC,
20 + TCA_SFQ_HASH_FWMARK,
22 + TCA_SFQ_HASH_CTORIGDST,
23 + TCA_SFQ_HASH_CTORIGSRC,
24 + TCA_SFQ_HASH_CTREPLDST,
25 + TCA_SFQ_HASH_CTREPLSRC,
26 + TCA_SFQ_HASH_CTNATCHG,
31 + unsigned quantum; /* Bytes per round allocated to flow */
32 + int perturb_period; /* Period of hash perturbation */
33 + __u32 limit; /* Maximal packets in queue */
34 + unsigned divisor; /* Hash divisor */
35 + unsigned flows; /* Maximal number of flows */
36 + unsigned hash_kind; /* Hash function to use for flow identification */
42 diff -Naur iproute-2.6.20-070313.orig/tc/Makefile iproute-2.6.20-070313/tc/Makefile
43 --- iproute-2.6.20-070313.orig/tc/Makefile 2007-03-13 14:50:56.000000000 -0700
44 +++ iproute-2.6.20-070313/tc/Makefile 2007-06-09 00:39:44.000000000 -0700
49 +TCMODULES += q_esfq.o
53 diff -Naur iproute-2.6.20-070313.orig/tc/q_esfq.c iproute-2.6.20-070313/tc/q_esfq.c
54 --- iproute-2.6.20-070313.orig/tc/q_esfq.c 1969-12-31 16:00:00.000000000 -0800
55 +++ iproute-2.6.20-070313/tc/q_esfq.c 2007-06-09 11:38:59.000000000 -0700
60 + * This program is free software; you can redistribute it and/or
61 + * modify it under the terms of the GNU General Public License
62 + * as published by the Free Software Foundation; either version
63 + * 2 of the License, or (at your option) any later version.
65 + * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
67 + * Changes: Alexander Atanasov, <alex@ssi.bg>
68 + * Alexander Clouter, <alex@digriz.org.uk>
69 + * Corey Hickey, <bugfood-c@fatooh.org>
79 +#include <sys/socket.h>
80 +#include <netinet/in.h>
81 +#include <arpa/inet.h>
87 +static void explain(void)
89 + fprintf(stderr, "Usage: ... esfq [ perturb SECS ] [ quantum BYTES ] [ depth FLOWS ]\n\t[ divisor HASHBITS ] [ limit PKTS ] [ hash HASHTYPE]\n");
90 + fprintf(stderr,"Where: \n");
91 + fprintf(stderr,"HASHTYPE := { classic | src | dst | fwmark | ctorigdst | ctorigsrc | ctrepldst | ctreplsrc | ctnatchg}\n");
94 +#define usage() return(-1)
96 +static int esfq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n)
99 + struct tc_esfq_qopt opt;
101 + memset(&opt, 0, sizeof(opt));
103 + opt.hash_kind= TCA_SFQ_HASH_CLASSIC;
106 + if (strcmp(*argv, "quantum") == 0) {
108 + if (get_size(&opt.quantum, *argv)) {
109 + fprintf(stderr, "Illegal \"quantum\"\n");
113 + } else if (strcmp(*argv, "perturb") == 0) {
115 + if (get_integer(&opt.perturb_period, *argv, 0)) {
116 + fprintf(stderr, "Illegal \"perturb\"\n");
120 + } else if (strcmp(*argv, "depth") == 0) {
122 + if (get_integer((int *) &opt.flows, *argv, 0)) {
123 + fprintf(stderr, "Illegal \"depth\"\n");
127 + } else if (strcmp(*argv, "divisor") == 0) {
129 + if (get_integer((int *) &opt.divisor, *argv, 0)) {
130 + fprintf(stderr, "Illegal \"divisor\"\n");
133 + if(opt.divisor >= 15) {
134 + fprintf(stderr, "Illegal \"divisor\": must be < 15\n");
137 + opt.divisor=pow(2,opt.divisor);
139 + } else if (strcmp(*argv, "limit") == 0) {
141 + if (get_integer((int *) &opt.limit, *argv, 0)) {
142 + fprintf(stderr, "Illegal \"limit\"\n");
146 + } else if (strcmp(*argv, "hash") == 0) {
148 + if (strcmp(*argv, "classic") == 0) {
149 + opt.hash_kind = TCA_SFQ_HASH_CLASSIC;
150 + } else if (strcmp(*argv, "dst") == 0) {
151 + opt.hash_kind = TCA_SFQ_HASH_DST;
152 + } else if (strcmp(*argv, "src") == 0) {
153 + opt.hash_kind = TCA_SFQ_HASH_SRC;
154 + } else if (strcmp(*argv, "fwmark") == 0) {
155 + opt.hash_kind = TCA_SFQ_HASH_FWMARK;
156 + } else if (strcmp(*argv, "ctorigsrc") == 0) {
157 + opt.hash_kind = TCA_SFQ_HASH_CTORIGSRC;
158 + } else if (strcmp(*argv, "ctorigdst") == 0) {
159 + opt.hash_kind = TCA_SFQ_HASH_CTORIGDST;
160 + } else if (strcmp(*argv, "ctreplsrc") == 0) {
161 + opt.hash_kind = TCA_SFQ_HASH_CTREPLSRC;
162 + } else if (strcmp(*argv, "ctrepldst") == 0) {
163 + opt.hash_kind = TCA_SFQ_HASH_CTREPLDST;
164 + } else if (strcmp(*argv, "ctnatchg") == 0) {
165 + opt.hash_kind = TCA_SFQ_HASH_CTNATCHG;
167 + fprintf(stderr, "Illegal \"hash\"\n");
172 + } else if (strcmp(*argv, "help") == 0) {
176 + fprintf(stderr, "What is \"%s\"?\n", *argv);
184 + addattr_l(n, 1024, TCA_OPTIONS, &opt, sizeof(opt));
188 +static int esfq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
190 + struct tc_esfq_qopt *qopt;
196 + if (RTA_PAYLOAD(opt) < sizeof(*qopt))
198 + qopt = RTA_DATA(opt);
199 + fprintf(f, "quantum %s ", sprint_size(qopt->quantum, b1));
200 + if (show_details) {
201 + fprintf(f, "limit %up flows %u/%u ",
202 + qopt->limit, qopt->flows, qopt->divisor);
204 + if (qopt->perturb_period)
205 + fprintf(f, "perturb %dsec ", qopt->perturb_period);
207 + fprintf(f,"hash: ");
208 + switch(qopt->hash_kind)
210 + case TCA_SFQ_HASH_CLASSIC:
211 + fprintf(f,"classic");
213 + case TCA_SFQ_HASH_DST:
216 + case TCA_SFQ_HASH_SRC:
219 + case TCA_SFQ_HASH_FWMARK:
220 + fprintf(f,"fwmark");
222 + case TCA_SFQ_HASH_CTORIGSRC:
223 + fprintf(f,"ctorigsrc");
225 + case TCA_SFQ_HASH_CTORIGDST:
226 + fprintf(f,"ctorigdst");
228 + case TCA_SFQ_HASH_CTREPLSRC:
229 + fprintf(f,"ctreplsrc");
231 + case TCA_SFQ_HASH_CTREPLDST:
232 + fprintf(f,"ctrepldst");
234 + case TCA_SFQ_HASH_CTNATCHG:
235 + fprintf(f,"ctnatchg");
238 + fprintf(f,"Unknown");
243 +static int esfq_print_xstats(struct qdisc_util *qu, FILE *f, struct rtattr *xstats)
249 +struct qdisc_util esfq_qdisc_util = {
251 + .parse_qopt = esfq_parse_opt,
252 + .print_qopt = esfq_print_opt,
253 + .print_xstats = esfq_print_xstats,