1 Index: iproute2-2.6.25/include/linux/pkt_sched.h
2 ===================================================================
3 --- iproute2-2.6.25.orig/include/linux/pkt_sched.h 2008-05-01 00:37:45.000000000 +0100
4 +++ iproute2-2.6.25/include/linux/pkt_sched.h 2008-05-01 20:30:49.000000000 +0100
5 @@ -174,8 +174,38 @@ struct tc_sfq_qopt
7 * The only reason for this is efficiency, it is possible
8 * to change these parameters in compile time.
10 + * If you need to play with these values use esfq instead.
18 + TCA_SFQ_HASH_CLASSIC,
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 */
44 @@ -568,8 +598,37 @@ struct tc_sfq_xstats
46 * The only reason for this is efficiency, it is possible
47 * to change these parameters in compile time.
49 + * If you need to play with these values use esfq instead.
57 + TCA_SFQ_HASH_CLASSIC,
61 + TCA_SFQ_HASH_CTORIGDST,
62 + TCA_SFQ_HASH_CTORIGSRC,
63 + TCA_SFQ_HASH_CTREPLDST,
64 + TCA_SFQ_HASH_CTREPLSRC,
65 + TCA_SFQ_HASH_CTNATCHG,
70 + unsigned quantum; /* Bytes per round allocated to flow */
71 + int perturb_period; /* Period of hash perturbation */
72 + __u32 limit; /* Maximal packets in queue */
73 + unsigned divisor; /* Hash divisor */
74 + unsigned flows; /* Maximal number of flows */
75 + unsigned hash_kind; /* Hash function to use for flow identification */
82 Index: iproute2-2.6.25/tc/Makefile
83 ===================================================================
84 --- iproute2-2.6.25.orig/tc/Makefile 2008-05-01 00:30:13.000000000 +0100
85 +++ iproute2-2.6.25/tc/Makefile 2008-05-01 20:30:49.000000000 +0100
86 @@ -7,6 +7,7 @@ include ../Config
90 +TCMODULES += q_esfq.o
94 Index: iproute2-2.6.25/tc/q_esfq.c
95 ===================================================================
96 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
97 +++ iproute2-2.6.25/tc/q_esfq.c 2008-05-01 20:31:09.000000000 +0100
102 + * This program is free software; you can redistribute it and/or
103 + * modify it under the terms of the GNU General Public License
104 + * as published by the Free Software Foundation; either version
105 + * 2 of the License, or (at your option) any later version.
107 + * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
109 + * Changes: Alexander Atanasov, <alex@ssi.bg>
110 + * Alexander Clouter, <alex@digriz.org.uk>
111 + * Corey Hickey, <bugfood-c@fatooh.org>
121 +#include <sys/socket.h>
122 +#include <netinet/in.h>
123 +#include <arpa/inet.h>
127 +#include "tc_util.h"
129 +static void explain(void)
131 + fprintf(stderr, "Usage: ... esfq [ perturb SECS ] [ quantum BYTES ] [ depth FLOWS ]\n\t[ divisor HASHBITS ] [ limit PKTS ] [ hash HASHTYPE]\n");
132 + fprintf(stderr,"Where: \n");
133 + fprintf(stderr,"HASHTYPE := { classic | src | dst | ctorigdst | ctorigsrc | ctrepldst | ctreplsrc | ctnatchg }\n");
136 +#define usage() return(-1)
138 +static int esfq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n)
141 + struct tc_esfq_qopt opt;
143 + memset(&opt, 0, sizeof(opt));
145 + opt.hash_kind= TCA_SFQ_HASH_CLASSIC;
148 + if (strcmp(*argv, "quantum") == 0) {
150 + if (get_size(&opt.quantum, *argv)) {
151 + fprintf(stderr, "Illegal \"quantum\"\n");
155 + } else if (strcmp(*argv, "perturb") == 0) {
157 + if (get_integer(&opt.perturb_period, *argv, 0)) {
158 + fprintf(stderr, "Illegal \"perturb\"\n");
162 + } else if (strcmp(*argv, "depth") == 0) {
164 + if (get_integer((int *) &opt.flows, *argv, 0)) {
165 + fprintf(stderr, "Illegal \"depth\"\n");
169 + } else if (strcmp(*argv, "divisor") == 0) {
171 + if (get_integer((int *) &opt.divisor, *argv, 0)) {
172 + fprintf(stderr, "Illegal \"divisor\"\n");
175 + if(opt.divisor >= 14) {
176 + fprintf(stderr, "Illegal \"divisor\": must be < 14\n");
179 + opt.divisor=pow(2,opt.divisor);
181 + } else if (strcmp(*argv, "limit") == 0) {
183 + if (get_integer((int *) &opt.limit, *argv, 0)) {
184 + fprintf(stderr, "Illegal \"limit\"\n");
188 + } else if (strcmp(*argv, "hash") == 0) {
190 + if(strcmp(*argv, "classic") == 0) {
191 + opt.hash_kind= TCA_SFQ_HASH_CLASSIC;
193 + if(strcmp(*argv, "dst") == 0) {
194 + opt.hash_kind= TCA_SFQ_HASH_DST;
196 + if(strcmp(*argv, "src") == 0) {
197 + opt.hash_kind= TCA_SFQ_HASH_SRC;
199 + if(strcmp(*argv, "ctorigsrc") == 0) {
200 + opt.hash_kind= TCA_SFQ_HASH_CTORIGSRC;
202 + if(strcmp(*argv, "ctorigdst") == 0) {
203 + opt.hash_kind= TCA_SFQ_HASH_CTORIGDST;
205 + if(strcmp(*argv, "ctreplsrc") == 0) {
206 + opt.hash_kind= TCA_SFQ_HASH_CTREPLSRC;
208 + if(strcmp(*argv, "ctrepldst") == 0) {
209 + opt.hash_kind= TCA_SFQ_HASH_CTREPLDST;
211 + if(strcmp(*argv, "ctnatchg") == 0) {
212 + opt.hash_kind= TCA_SFQ_HASH_CTNATCHG;
214 + fprintf(stderr, "Illegal \"hash\"\n");
219 + } else if (strcmp(*argv, "help") == 0) {
223 + fprintf(stderr, "What is \"%s\"?\n", *argv);
231 + addattr_l(n, 1024, TCA_OPTIONS, &opt, sizeof(opt));
235 +static int esfq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
237 + struct tc_esfq_qopt *qopt;
243 + if (RTA_PAYLOAD(opt) < sizeof(*qopt))
245 + qopt = RTA_DATA(opt);
246 + fprintf(f, "quantum %s ", sprint_size(qopt->quantum, b1));
247 + if (show_details) {
248 + fprintf(f, "limit %up flows %u/%u ",
249 + qopt->limit, qopt->flows, qopt->divisor);
251 + if (qopt->perturb_period)
252 + fprintf(f, "perturb %dsec ", qopt->perturb_period);
254 + fprintf(f,"hash: ");
255 + switch(qopt->hash_kind)
257 + case TCA_SFQ_HASH_CLASSIC:
258 + fprintf(f,"classic");
260 + case TCA_SFQ_HASH_DST:
263 + case TCA_SFQ_HASH_SRC:
266 + case TCA_SFQ_HASH_CTORIGSRC:
267 + fprintf(f,"ctorigsrc");
269 + case TCA_SFQ_HASH_CTORIGDST:
270 + fprintf(f,"ctorigdst");
272 + case TCA_SFQ_HASH_CTREPLSRC:
273 + fprintf(f,"ctreplsrc");
275 + case TCA_SFQ_HASH_CTREPLDST:
276 + fprintf(f,"ctrepldst");
278 + case TCA_SFQ_HASH_CTNATCHG:
279 + fprintf(f,"ctnatchg");
282 + fprintf(f,"Unknown");
287 +static int esfq_print_xstats(struct qdisc_util *qu, FILE *f, struct rtattr *xstats)
293 +struct qdisc_util esfq_qdisc_util = {
295 + .parse_qopt = esfq_parse_opt,
296 + .print_qopt = esfq_print_opt,
297 + .print_xstats = esfq_print_xstats,