1 diff -urN --exclude=.svn iproute2-2.6.11-050330/include/linux/pkt_sched.h iproute2-2.6.11-050330/include/linux/pkt_sched.h
2 --- iproute2-2.6.11-050330/include/linux/pkt_sched.h 2007-05-04 22:21:48.000000000 -0400
3 +++ iproute2-2.6.11-050330/include/linux/pkt_sched.h 2007-05-04 22:27:12.000000000 -0400
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,
21 + TCA_SFQ_HASH_CTORIGDST,
22 + TCA_SFQ_HASH_CTORIGSRC,
23 + TCA_SFQ_HASH_CTREPLDST,
24 + TCA_SFQ_HASH_CTREPLSRC,
25 + TCA_SFQ_HASH_CTNATCHG,
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 */
45 * The only reason for this is efficiency, it is possible
46 * to change these parameters in compile time.
48 + * If you need to play with these values use esfq instead.
56 + TCA_SFQ_HASH_CLASSIC,
60 + TCA_SFQ_HASH_CTORIGDST,
61 + TCA_SFQ_HASH_CTORIGSRC,
62 + TCA_SFQ_HASH_CTREPLDST,
63 + TCA_SFQ_HASH_CTREPLSRC,
64 + TCA_SFQ_HASH_CTNATCHG,
69 + unsigned quantum; /* Bytes per round allocated to flow */
70 + int perturb_period; /* Period of hash perturbation */
71 + __u32 limit; /* Maximal packets in queue */
72 + unsigned divisor; /* Hash divisor */
73 + unsigned flows; /* Maximal number of flows */
74 + unsigned hash_kind; /* Hash function to use for flow identification */
81 diff -urN --exclude=.svn iproute2-2.6.11-050330/tc/Makefile iproute2-2.6.11-050330/tc/Makefile
82 --- iproute2-2.6.11-050330/tc/Makefile 2007-05-04 22:21:48.000000000 -0400
83 +++ iproute2-2.6.11-050330/tc/Makefile 2007-05-04 22:27:37.000000000 -0400
88 +TCMODULES += q_esfq.o
92 diff -urN --exclude=.svn iproute2-2.6.11-050330/tc/q_esfq.c iproute2-2.6.11-050330/tc/q_esfq.c
93 --- iproute2-2.6.11-050330/tc/q_esfq.c 1969-12-31 19:00:00.000000000 -0500
94 +++ iproute2-2.6.11-050330/tc/q_esfq.c 2007-05-04 22:37:54.000000000 -0400
99 + * This program is free software; you can redistribute it and/or
100 + * modify it under the terms of the GNU General Public License
101 + * as published by the Free Software Foundation; either version
102 + * 2 of the License, or (at your option) any later version.
104 + * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
106 + * Changes: Alexander Atanasov, <alex@ssi.bg>
107 + * Alexander Clouter, <alex@digriz.org.uk>
108 + * Corey Hickey, <bugfood-c@fatooh.org>
118 +#include <sys/socket.h>
119 +#include <netinet/in.h>
120 +#include <arpa/inet.h>
124 +#include "tc_util.h"
126 +static void explain(void)
128 + fprintf(stderr, "Usage: ... esfq [ perturb SECS ] [ quantum BYTES ] [ depth FLOWS ]\n\t[ divisor HASHBITS ] [ limit PKTS ] [ hash HASHTYPE]\n");
129 + fprintf(stderr,"Where: \n");
130 + fprintf(stderr,"HASHTYPE := { classic | src | dst | ctorigdst | ctorigsrc | ctrepldst | ctreplsrc | ctnatchg }\n");
133 +#define usage() return(-1)
135 +static int esfq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n)
138 + struct tc_esfq_qopt opt;
140 + memset(&opt, 0, sizeof(opt));
142 + opt.hash_kind= TCA_SFQ_HASH_CLASSIC;
145 + if (strcmp(*argv, "quantum") == 0) {
147 + if (get_size(&opt.quantum, *argv)) {
148 + fprintf(stderr, "Illegal \"quantum\"\n");
152 + } else if (strcmp(*argv, "perturb") == 0) {
154 + if (get_integer(&opt.perturb_period, *argv, 0)) {
155 + fprintf(stderr, "Illegal \"perturb\"\n");
159 + } else if (strcmp(*argv, "depth") == 0) {
161 + if (get_integer((int *) &opt.flows, *argv, 0)) {
162 + fprintf(stderr, "Illegal \"depth\"\n");
166 + } else if (strcmp(*argv, "divisor") == 0) {
168 + if (get_integer((int *) &opt.divisor, *argv, 0)) {
169 + fprintf(stderr, "Illegal \"divisor\"\n");
172 + if(opt.divisor >= 14) {
173 + fprintf(stderr, "Illegal \"divisor\": must be < 14\n");
176 + opt.divisor=pow(2,opt.divisor);
178 + } else if (strcmp(*argv, "limit") == 0) {
180 + if (get_integer((int *) &opt.limit, *argv, 0)) {
181 + fprintf(stderr, "Illegal \"limit\"\n");
185 + } else if (strcmp(*argv, "hash") == 0) {
187 + if(strcmp(*argv, "classic") == 0) {
188 + opt.hash_kind= TCA_SFQ_HASH_CLASSIC;
190 + if(strcmp(*argv, "dst") == 0) {
191 + opt.hash_kind= TCA_SFQ_HASH_DST;
193 + if(strcmp(*argv, "src") == 0) {
194 + opt.hash_kind= TCA_SFQ_HASH_SRC;
196 + if(strcmp(*argv, "ctorigsrc") == 0) {
197 + opt.hash_kind= TCA_SFQ_HASH_CTORIGSRC;
199 + if(strcmp(*argv, "ctorigdst") == 0) {
200 + opt.hash_kind= TCA_SFQ_HASH_CTORIGDST;
202 + if(strcmp(*argv, "ctreplsrc") == 0) {
203 + opt.hash_kind= TCA_SFQ_HASH_CTREPLSRC;
205 + if(strcmp(*argv, "ctrepldst") == 0) {
206 + opt.hash_kind= TCA_SFQ_HASH_CTREPLDST;
208 + if(strcmp(*argv, "ctnatchg") == 0) {
209 + opt.hash_kind= TCA_SFQ_HASH_CTNATCHG;
211 + fprintf(stderr, "Illegal \"hash\"\n");
216 + } else if (strcmp(*argv, "help") == 0) {
220 + fprintf(stderr, "What is \"%s\"?\n", *argv);
228 + addattr_l(n, 1024, TCA_OPTIONS, &opt, sizeof(opt));
232 +static int esfq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
234 + struct tc_esfq_qopt *qopt;
240 + if (RTA_PAYLOAD(opt) < sizeof(*qopt))
242 + qopt = RTA_DATA(opt);
243 + fprintf(f, "quantum %s ", sprint_size(qopt->quantum, b1));
244 + if (show_details) {
245 + fprintf(f, "limit %up flows %u/%u ",
246 + qopt->limit, qopt->flows, qopt->divisor);
248 + if (qopt->perturb_period)
249 + fprintf(f, "perturb %dsec ", qopt->perturb_period);
251 + fprintf(f,"hash: ");
252 + switch(qopt->hash_kind)
254 + case TCA_SFQ_HASH_CLASSIC:
255 + fprintf(f,"classic");
257 + case TCA_SFQ_HASH_DST:
260 + case TCA_SFQ_HASH_SRC:
263 + case TCA_SFQ_HASH_CTORIGSRC:
264 + fprintf(f,"ctorigsrc");
266 + case TCA_SFQ_HASH_CTORIGDST:
267 + fprintf(f,"ctorigdst");
269 + case TCA_SFQ_HASH_CTREPLSRC:
270 + fprintf(f,"ctreplsrc");
272 + case TCA_SFQ_HASH_CTREPLDST:
273 + fprintf(f,"ctrepldst");
275 + case TCA_SFQ_HASH_CTNATCHG:
276 + fprintf(f,"ctnatchg");
279 + fprintf(f,"Unknown");
284 +static int esfq_print_xstats(struct qdisc_util *qu, FILE *f, struct rtattr *xstats)
290 +struct qdisc_util esfq_qdisc_util = {
292 + .parse_qopt = esfq_parse_opt,
293 + .print_qopt = esfq_print_opt,
294 + .print_xstats = esfq_print_xstats,