1 diff -Naur iproute2-2.6.19-061214.orig/include/linux/pkt_sched.h iproute2-2.6.19-061214/include/linux/pkt_sched.h
2 --- iproute2-2.6.19-061214.orig/include/linux/pkt_sched.h 2006-12-14 15:04:12.000000000 -0800
3 +++ iproute2-2.6.19-061214/include/linux/pkt_sched.h 2007-02-13 23:18:29.000000000 -0800
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_DSTDIR,
23 + TCA_SFQ_HASH_SRCDIR,
24 + TCA_SFQ_HASH_FWMARKDIR,
26 + TCA_SFQ_HASH_CTORIGDST,
27 + TCA_SFQ_HASH_CTORIGSRC,
28 + TCA_SFQ_HASH_CTREPLDST,
29 + TCA_SFQ_HASH_CTREPLSRC,
34 + unsigned quantum; /* Bytes per round allocated to flow */
35 + int perturb_period; /* Period of hash perturbation */
36 + __u32 limit; /* Maximal packets in queue */
37 + unsigned divisor; /* Hash divisor */
38 + unsigned flows; /* Maximal number of flows */
39 + unsigned hash_kind; /* Hash function to use for flow identification */
45 diff -Naur iproute2-2.6.19-061214.orig/tc/Makefile iproute2-2.6.19-061214/tc/Makefile
46 --- iproute2-2.6.19-061214.orig/tc/Makefile 2006-12-14 15:04:12.000000000 -0800
47 +++ iproute2-2.6.19-061214/tc/Makefile 2007-02-11 11:56:13.000000000 -0800
52 +TCMODULES += q_esfq.o
56 diff -Naur iproute2-2.6.19-061214.orig/tc/q_esfq.c iproute2-2.6.19-061214/tc/q_esfq.c
57 --- iproute2-2.6.19-061214.orig/tc/q_esfq.c 1969-12-31 16:00:00.000000000 -0800
58 +++ iproute2-2.6.19-061214/tc/q_esfq.c 2007-02-13 23:18:26.000000000 -0800
63 + * This program is free software; you can redistribute it and/or
64 + * modify it under the terms of the GNU General Public License
65 + * as published by the Free Software Foundation; either version
66 + * 2 of the License, or (at your option) any later version.
68 + * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
70 + * Changes: Alexander Atanasov, <alex@ssi.bg>
71 + * Alexander Clouter, <alex@digriz.org.uk>
72 + * Corey Hickey, <bugfood-c@fatooh.org>
82 +#include <sys/socket.h>
83 +#include <netinet/in.h>
84 +#include <arpa/inet.h>
90 +static void explain(void)
92 + fprintf(stderr, "Usage: ... esfq [ perturb SECS ] [ quantum BYTES ] [ depth FLOWS ]\n\t[ divisor HASHBITS ] [ limit PKTS ] [ hash HASHTYPE]\n");
93 + fprintf(stderr,"Where: \n");
94 + fprintf(stderr,"HASHTYPE := { classic | src | dst | fwmark | src_dir | dst_dir | fwmark_dir | ctorigdst | ctorigsrc | ctrepldst | ctreplsrc}\n");
97 +#define usage() return(-1)
99 +static int esfq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n)
102 + struct tc_esfq_qopt opt;
104 + memset(&opt, 0, sizeof(opt));
106 + opt.hash_kind= TCA_SFQ_HASH_CLASSIC;
109 + if (strcmp(*argv, "quantum") == 0) {
111 + if (get_size(&opt.quantum, *argv)) {
112 + fprintf(stderr, "Illegal \"quantum\"\n");
116 + } else if (strcmp(*argv, "perturb") == 0) {
118 + if (get_integer(&opt.perturb_period, *argv, 0)) {
119 + fprintf(stderr, "Illegal \"perturb\"\n");
123 + } else if (strcmp(*argv, "depth") == 0) {
125 + if (get_integer((int *) &opt.flows, *argv, 0)) {
126 + fprintf(stderr, "Illegal \"depth\"\n");
130 + } else if (strcmp(*argv, "divisor") == 0) {
132 + if (get_integer((int *) &opt.divisor, *argv, 0)) {
133 + fprintf(stderr, "Illegal \"divisor\"\n");
136 + if(opt.divisor >= 14) {
137 + fprintf(stderr, "Illegal \"divisor\": must be < 14\n");
140 + opt.divisor=pow(2,opt.divisor);
142 + } else if (strcmp(*argv, "limit") == 0) {
144 + if (get_integer((int *) &opt.limit, *argv, 0)) {
145 + fprintf(stderr, "Illegal \"limit\"\n");
149 + } else if (strcmp(*argv, "hash") == 0) {
151 + if(strcmp(*argv, "classic") == 0) {
152 + opt.hash_kind= TCA_SFQ_HASH_CLASSIC;
154 + if(strcmp(*argv, "dst") == 0) {
155 + opt.hash_kind= TCA_SFQ_HASH_DST;
157 + if(strcmp(*argv, "src") == 0) {
158 + opt.hash_kind= TCA_SFQ_HASH_SRC;
160 + if(strcmp(*argv, "fwmark") == 0) {
161 + opt.hash_kind= TCA_SFQ_HASH_FWMARK;
163 + if(strcmp(*argv, "dst_direct") == 0) {
164 + opt.hash_kind= TCA_SFQ_HASH_DSTDIR;
165 + fprintf(stderr, "Warning: \"dst_direct\" is deprecated\n"
166 + "use \"dst\" instead\n");
168 + if(strcmp(*argv, "src_direct") == 0) {
169 + opt.hash_kind= TCA_SFQ_HASH_SRCDIR;
170 + fprintf(stderr, "Warning: \"src_direct\" is deprecated\n"
171 + "use \"src\" instead\n");
173 + if(strcmp(*argv, "fwmark_direct") == 0) {
174 + opt.hash_kind= TCA_SFQ_HASH_FWMARKDIR;
175 + fprintf(stderr, "Warning: \"fwmark_direct\" is deprecated\n"
176 + "use \"fwmark\" instead\n");
178 + if(strcmp(*argv, "ctorigsrc") == 0) {
179 + opt.hash_kind= TCA_SFQ_HASH_CTORIGSRC;
181 + if(strcmp(*argv, "ctorigdst") == 0) {
182 + opt.hash_kind= TCA_SFQ_HASH_CTORIGDST;
184 + if(strcmp(*argv, "ctreplsrc") == 0) {
185 + opt.hash_kind= TCA_SFQ_HASH_CTREPLSRC;
187 + if(strcmp(*argv, "ctrepldst") == 0) {
188 + opt.hash_kind= TCA_SFQ_HASH_CTREPLDST;
190 + fprintf(stderr, "Illegal \"hash\"\n");
195 + } else if (strcmp(*argv, "help") == 0) {
199 + fprintf(stderr, "What is \"%s\"?\n", *argv);
207 + addattr_l(n, 1024, TCA_OPTIONS, &opt, sizeof(opt));
211 +static int esfq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
213 + struct tc_esfq_qopt *qopt;
219 + if (RTA_PAYLOAD(opt) < sizeof(*qopt))
221 + qopt = RTA_DATA(opt);
222 + fprintf(f, "quantum %s ", sprint_size(qopt->quantum, b1));
223 + if (show_details) {
224 + fprintf(f, "limit %up flows %u/%u ",
225 + qopt->limit, qopt->flows, qopt->divisor);
227 + if (qopt->perturb_period)
228 + fprintf(f, "perturb %dsec ", qopt->perturb_period);
230 + fprintf(f,"hash: ");
231 + switch(qopt->hash_kind)
233 + case TCA_SFQ_HASH_CLASSIC:
234 + fprintf(f,"classic");
236 + case TCA_SFQ_HASH_DST:
239 + case TCA_SFQ_HASH_SRC:
242 + case TCA_SFQ_HASH_FWMARK:
243 + fprintf(f,"fwmark");
245 + case TCA_SFQ_HASH_DSTDIR:
246 + fprintf(f,"dst_direct");
248 + case TCA_SFQ_HASH_SRCDIR:
249 + fprintf(f,"src_direct");
251 + case TCA_SFQ_HASH_FWMARKDIR:
252 + fprintf(f,"fwmark_direct");
254 + case TCA_SFQ_HASH_CTORIGSRC:
255 + fprintf(f,"ctorigsrc");
257 + case TCA_SFQ_HASH_CTORIGDST:
258 + fprintf(f,"ctorigdst");
260 + case TCA_SFQ_HASH_CTREPLSRC:
261 + fprintf(f,"ctreplsrc");
263 + case TCA_SFQ_HASH_CTREPLDST:
264 + fprintf(f,"ctrepldst");
267 + fprintf(f,"Unknown");
272 +static int esfq_print_xstats(struct qdisc_util *qu, FILE *f, struct rtattr *xstats)
278 +struct qdisc_util esfq_qdisc_util = {
280 + .parse_qopt = esfq_parse_opt,
281 + .print_qopt = esfq_print_opt,
282 + .print_xstats = esfq_print_xstats,