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
4 @@ -193,6 +193,36 @@ struct tc_sfq_xstats {
13 + TCA_SFQ_HASH_CLASSIC,
16 + TCA_SFQ_HASH_FWMARK,
18 + TCA_SFQ_HASH_DSTDIR,
19 + TCA_SFQ_HASH_SRCDIR,
20 + TCA_SFQ_HASH_FWMARKDIR,
22 + TCA_SFQ_HASH_CTORIGDST,
23 + TCA_SFQ_HASH_CTORIGSRC,
24 + TCA_SFQ_HASH_CTREPLDST,
25 + TCA_SFQ_HASH_CTREPLSRC,
30 + unsigned quantum; /* Bytes per round allocated to flow */
31 + int perturb_period; /* Period of hash perturbation */
32 + __u32 limit; /* Maximal packets in queue */
33 + unsigned divisor; /* Hash divisor */
34 + unsigned flows; /* Maximal number of flows */
35 + unsigned hash_kind; /* Hash function to use for flow identification */
41 diff -Naur iproute2-2.6.19-061214.orig/tc/Makefile iproute2-2.6.19-061214/tc/Makefile
42 --- iproute2-2.6.19-061214.orig/tc/Makefile 2006-12-14 15:04:12.000000000 -0800
43 +++ iproute2-2.6.19-061214/tc/Makefile 2007-02-11 11:56:13.000000000 -0800
48 +TCMODULES += q_esfq.o
52 diff -Naur iproute2-2.6.19-061214.orig/tc/q_esfq.c iproute2-2.6.19-061214/tc/q_esfq.c
53 --- iproute2-2.6.19-061214.orig/tc/q_esfq.c 1969-12-31 16:00:00.000000000 -0800
54 +++ iproute2-2.6.19-061214/tc/q_esfq.c 2007-02-13 23:18:26.000000000 -0800
59 + * This program is free software; you can redistribute it and/or
60 + * modify it under the terms of the GNU General Public License
61 + * as published by the Free Software Foundation; either version
62 + * 2 of the License, or (at your option) any later version.
64 + * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
66 + * Changes: Alexander Atanasov, <alex@ssi.bg>
67 + * Alexander Clouter, <alex@digriz.org.uk>
68 + * Corey Hickey, <bugfood-c@fatooh.org>
78 +#include <sys/socket.h>
79 +#include <netinet/in.h>
80 +#include <arpa/inet.h>
86 +static void explain(void)
88 + fprintf(stderr, "Usage: ... esfq [ perturb SECS ] [ quantum BYTES ] [ depth FLOWS ]\n\t[ divisor HASHBITS ] [ limit PKTS ] [ hash HASHTYPE]\n");
89 + fprintf(stderr,"Where: \n");
90 + fprintf(stderr,"HASHTYPE := { classic | src | dst | fwmark | src_dir | dst_dir | fwmark_dir | ctorigdst | ctorigsrc | ctrepldst | ctreplsrc}\n");
93 +#define usage() return(-1)
95 +static int esfq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n)
98 + struct tc_esfq_qopt opt;
100 + memset(&opt, 0, sizeof(opt));
102 + opt.hash_kind= TCA_SFQ_HASH_CLASSIC;
105 + if (strcmp(*argv, "quantum") == 0) {
107 + if (get_size(&opt.quantum, *argv)) {
108 + fprintf(stderr, "Illegal \"quantum\"\n");
112 + } else if (strcmp(*argv, "perturb") == 0) {
114 + if (get_integer(&opt.perturb_period, *argv, 0)) {
115 + fprintf(stderr, "Illegal \"perturb\"\n");
119 + } else if (strcmp(*argv, "depth") == 0) {
121 + if (get_integer((int *) &opt.flows, *argv, 0)) {
122 + fprintf(stderr, "Illegal \"depth\"\n");
126 + } else if (strcmp(*argv, "divisor") == 0) {
128 + if (get_integer((int *) &opt.divisor, *argv, 0)) {
129 + fprintf(stderr, "Illegal \"divisor\"\n");
132 + if(opt.divisor >= 14) {
133 + fprintf(stderr, "Illegal \"divisor\": must be < 14\n");
136 + opt.divisor=pow(2,opt.divisor);
138 + } else if (strcmp(*argv, "limit") == 0) {
140 + if (get_integer((int *) &opt.limit, *argv, 0)) {
141 + fprintf(stderr, "Illegal \"limit\"\n");
145 + } else if (strcmp(*argv, "hash") == 0) {
147 + if(strcmp(*argv, "classic") == 0) {
148 + opt.hash_kind= TCA_SFQ_HASH_CLASSIC;
150 + if(strcmp(*argv, "dst") == 0) {
151 + opt.hash_kind= TCA_SFQ_HASH_DST;
153 + if(strcmp(*argv, "src") == 0) {
154 + opt.hash_kind= TCA_SFQ_HASH_SRC;
156 + if(strcmp(*argv, "fwmark") == 0) {
157 + opt.hash_kind= TCA_SFQ_HASH_FWMARK;
159 + if(strcmp(*argv, "dst_direct") == 0) {
160 + opt.hash_kind= TCA_SFQ_HASH_DSTDIR;
161 + fprintf(stderr, "Warning: \"dst_direct\" is deprecated\n"
162 + "use \"dst\" instead\n");
164 + if(strcmp(*argv, "src_direct") == 0) {
165 + opt.hash_kind= TCA_SFQ_HASH_SRCDIR;
166 + fprintf(stderr, "Warning: \"src_direct\" is deprecated\n"
167 + "use \"src\" instead\n");
169 + if(strcmp(*argv, "fwmark_direct") == 0) {
170 + opt.hash_kind= TCA_SFQ_HASH_FWMARKDIR;
171 + fprintf(stderr, "Warning: \"fwmark_direct\" is deprecated\n"
172 + "use \"fwmark\" instead\n");
174 + if(strcmp(*argv, "ctorigsrc") == 0) {
175 + opt.hash_kind= TCA_SFQ_HASH_CTORIGSRC;
177 + if(strcmp(*argv, "ctorigdst") == 0) {
178 + opt.hash_kind= TCA_SFQ_HASH_CTORIGDST;
180 + if(strcmp(*argv, "ctreplsrc") == 0) {
181 + opt.hash_kind= TCA_SFQ_HASH_CTREPLSRC;
183 + if(strcmp(*argv, "ctrepldst") == 0) {
184 + opt.hash_kind= TCA_SFQ_HASH_CTREPLDST;
186 + fprintf(stderr, "Illegal \"hash\"\n");
191 + } else if (strcmp(*argv, "help") == 0) {
195 + fprintf(stderr, "What is \"%s\"?\n", *argv);
203 + addattr_l(n, 1024, TCA_OPTIONS, &opt, sizeof(opt));
207 +static int esfq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
209 + struct tc_esfq_qopt *qopt;
215 + if (RTA_PAYLOAD(opt) < sizeof(*qopt))
217 + qopt = RTA_DATA(opt);
218 + fprintf(f, "quantum %s ", sprint_size(qopt->quantum, b1));
219 + if (show_details) {
220 + fprintf(f, "limit %up flows %u/%u ",
221 + qopt->limit, qopt->flows, qopt->divisor);
223 + if (qopt->perturb_period)
224 + fprintf(f, "perturb %dsec ", qopt->perturb_period);
226 + fprintf(f,"hash: ");
227 + switch(qopt->hash_kind)
229 + case TCA_SFQ_HASH_CLASSIC:
230 + fprintf(f,"classic");
232 + case TCA_SFQ_HASH_DST:
235 + case TCA_SFQ_HASH_SRC:
238 + case TCA_SFQ_HASH_FWMARK:
239 + fprintf(f,"fwmark");
241 + case TCA_SFQ_HASH_DSTDIR:
242 + fprintf(f,"dst_direct");
244 + case TCA_SFQ_HASH_SRCDIR:
245 + fprintf(f,"src_direct");
247 + case TCA_SFQ_HASH_FWMARKDIR:
248 + fprintf(f,"fwmark_direct");
250 + case TCA_SFQ_HASH_CTORIGSRC:
251 + fprintf(f,"ctorigsrc");
253 + case TCA_SFQ_HASH_CTORIGDST:
254 + fprintf(f,"ctorigdst");
256 + case TCA_SFQ_HASH_CTREPLSRC:
257 + fprintf(f,"ctreplsrc");
259 + case TCA_SFQ_HASH_CTREPLDST:
260 + fprintf(f,"ctrepldst");
263 + fprintf(f,"Unknown");
268 +static int esfq_print_xstats(struct qdisc_util *qu, FILE *f, struct rtattr *xstats)
274 +struct qdisc_util esfq_qdisc_util = {
276 + .parse_qopt = esfq_parse_opt,
277 + .print_qopt = esfq_print_opt,
278 + .print_xstats = esfq_print_xstats,