]> git.pld-linux.org Git - packages/iproute2.git/blame - esfq-iproute2.patch
- new version.
[packages/iproute2.git] / esfq-iproute2.patch
CommitLineData
046f602f
PS
1--- iproute2.orig/tc/Makefile Sun Apr 16 20:42:53 2000
2+++ iproute2/tc/Makefile Tue May 14 23:04:10 2002
3@@ -5,6 +5,7 @@
4 TCMODULES :=
5 TCMODULES += q_fifo.o
6 TCMODULES += q_sfq.o
7+TCMODULES += q_esfq.o
8 TCMODULES += q_red.o
9 TCMODULES += q_prio.o
10 TCMODULES += q_tbf.o
11--- iproute2.orig/include/linux/pkt_sched.h 2005-10-23 21:07:52.000000000 -0700
12+++ iproute2/include/linux/pkt_sched.h 2005-10-21 18:12:55.000000000 -0700
13@@ -145,8 +145,35 @@
14 *
15 * The only reason for this is efficiency, it is possible
16 * to change these parameters in compile time.
17+ *
18+ * If you need to play with these values use esfq instead.
19 */
20
21+/* ESFQ section */
22+
23+enum
24+{
25+ /* traditional */
26+ TCA_SFQ_HASH_CLASSIC,
27+ TCA_SFQ_HASH_DST,
28+ TCA_SFQ_HASH_SRC,
29+ TCA_SFQ_HASH_FWMARK,
30+ /* direct */
31+ TCA_SFQ_HASH_DSTDIR,
32+ TCA_SFQ_HASH_SRCDIR,
33+ TCA_SFQ_HASH_FWMARKDIR,
34+};
35+
36+struct tc_esfq_qopt
37+{
38+ unsigned quantum; /* Bytes per round allocated to flow */
39+ int perturb_period; /* Period of hash perturbation */
40+ __u32 limit; /* Maximal packets in queue */
41+ unsigned divisor; /* Hash divisor */
42+ unsigned flows; /* Maximal number of flows */
43+ unsigned hash_kind; /* Hash function to use for flow identification */
44+};
45+
46 /* RED section */
47
48 enum
49--- iproute2.orig/tc/q_esfq.c 1969-12-31 16:00:00.000000000 -0800
50+++ iproute2/tc/q_esfq.c 2005-10-21 18:28:44.000000000 -0700
51@@ -0,0 +1,192 @@
52+/*
53+ * q_esfq.c ESFQ.
54+ *
55+ * This program is free software; you can redistribute it and/or
56+ * modify it under the terms of the GNU General Public License
57+ * as published by the Free Software Foundation; either version
58+ * 2 of the License, or (at your option) any later version.
59+ *
60+ * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
61+ *
62+ * Changes: Alexander Atanasov, <alex@ssi.bg>
63+ * Added depth,limit,divisor,hash_kind options.
64+ */
65+
66+#include <stdio.h>
67+#include <stdlib.h>
68+#include <unistd.h>
69+#include <syslog.h>
70+#include <fcntl.h>
71+#include <math.h>
72+#include <sys/socket.h>
73+#include <netinet/in.h>
74+#include <arpa/inet.h>
75+#include <string.h>
76+
77+#include "utils.h"
78+#include "tc_util.h"
79+
80+static void explain(void)
81+{
82+ fprintf(stderr, "Usage: ... esfq [ perturb SECS ] [ quantum BYTES ] [ depth FLOWS ]\n\t[ divisor HASHBITS ] [ limit PKTS ] [ hash HASHTYPE]\n");
83+ fprintf(stderr,"Where: \n");
84+ fprintf(stderr,"HASHTYPE := { classic | src | dst | fwmark | src_dir | dst_dir | fwmark_dir }\n");
85+}
86+
87+#define usage() return(-1)
88+
89+static int esfq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n)
90+{
91+ int ok=0;
92+ struct tc_esfq_qopt opt;
93+
94+ memset(&opt, 0, sizeof(opt));
95+
96+ opt.hash_kind= TCA_SFQ_HASH_CLASSIC;
97+
98+ while (argc > 0) {
99+ if (strcmp(*argv, "quantum") == 0) {
100+ NEXT_ARG();
101+ if (get_size(&opt.quantum, *argv)) {
102+ fprintf(stderr, "Illegal \"quantum\"\n");
103+ return -1;
104+ }
105+ ok++;
106+ } else if (strcmp(*argv, "perturb") == 0) {
107+ NEXT_ARG();
108+ if (get_integer(&opt.perturb_period, *argv, 0)) {
109+ fprintf(stderr, "Illegal \"perturb\"\n");
110+ return -1;
111+ }
112+ ok++;
113+ } else if (strcmp(*argv, "depth") == 0) {
114+ NEXT_ARG();
115+ if (get_integer((int *) &opt.flows, *argv, 0)) {
116+ fprintf(stderr, "Illegal \"depth\"\n");
117+ return -1;
118+ }
119+ ok++;
120+ } else if (strcmp(*argv, "divisor") == 0) {
121+ NEXT_ARG();
122+ if (get_integer((int *) &opt.divisor, *argv, 0)) {
123+ fprintf(stderr, "Illegal \"divisor\"\n");
124+ return -1;
125+ }
126+ if(opt.divisor >= 15) {
127+ fprintf(stderr, "Illegal \"divisor\" must be < 15\n");
128+ return -1;
129+ }
130+ opt.divisor=pow(2,opt.divisor);
131+ ok++;
132+ } else if (strcmp(*argv, "limit") == 0) {
133+ NEXT_ARG();
134+ if (get_integer((int *) &opt.limit, *argv, 0)) {
135+ fprintf(stderr, "Illegal \"limit\"\n");
136+ return -1;
137+ }
138+ ok++;
139+ } else if (strcmp(*argv, "hash") == 0) {
140+ NEXT_ARG();
141+ if(strcmp(*argv, "classic") == 0) {
142+ opt.hash_kind= TCA_SFQ_HASH_CLASSIC;
143+ } else
144+ if(strcmp(*argv, "dst") == 0) {
145+ opt.hash_kind= TCA_SFQ_HASH_DST;
146+ } else
147+ if(strcmp(*argv, "src") == 0) {
148+ opt.hash_kind= TCA_SFQ_HASH_SRC;
149+ } else
150+ if(strcmp(*argv, "fwmark") == 0) {
151+ opt.hash_kind= TCA_SFQ_HASH_FWMARK;
152+ } else
153+ if(strcmp(*argv, "dst_direct") == 0) {
154+ opt.hash_kind= TCA_SFQ_HASH_DSTDIR;
155+ } else
156+ if(strcmp(*argv, "src_direct") == 0) {
157+ opt.hash_kind= TCA_SFQ_HASH_SRCDIR;
158+ } else
159+ if(strcmp(*argv, "fwmark_direct") == 0) {
160+ opt.hash_kind= TCA_SFQ_HASH_FWMARKDIR;
161+ } else {
162+ fprintf(stderr, "Illegal \"hash\"\n");
163+ explain();
164+ return -1;
165+ }
166+ ok++;
167+ } else if (strcmp(*argv, "help") == 0) {
168+ explain();
169+ return -1;
170+ } else {
171+ fprintf(stderr, "What is \"%s\"?\n", *argv);
172+ explain();
173+ return -1;
174+ }
175+ argc--; argv++;
176+ }
177+
178+ if (ok)
179+ addattr_l(n, 1024, TCA_OPTIONS, &opt, sizeof(opt));
180+ return 0;
181+}
182+
183+static int esfq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
184+{
185+ struct tc_esfq_qopt *qopt;
186+ SPRINT_BUF(b1);
187+
188+ if (opt == NULL)
189+ return 0;
190+
191+ if (RTA_PAYLOAD(opt) < sizeof(*qopt))
192+ return -1;
193+ qopt = RTA_DATA(opt);
194+ fprintf(f, "quantum %s ", sprint_size(qopt->quantum, b1));
195+ if (show_details) {
196+ fprintf(f, "limit %up flows %u/%u ",
197+ qopt->limit, qopt->flows, qopt->divisor);
198+ }
199+ if (qopt->perturb_period)
200+ fprintf(f, "perturb %dsec ", qopt->perturb_period);
201+
202+ fprintf(f,"hash: ");
203+ switch(qopt->hash_kind)
204+ {
205+ case TCA_SFQ_HASH_CLASSIC:
206+ fprintf(f,"classic");
207+ break;
208+ case TCA_SFQ_HASH_DST:
209+ fprintf(f,"dst");
210+ break;
211+ case TCA_SFQ_HASH_SRC:
212+ fprintf(f,"src");
213+ break;
214+ case TCA_SFQ_HASH_FWMARK:
215+ fprintf(f,"fwmark");
216+ break;
217+ case TCA_SFQ_HASH_DSTDIR:
218+ fprintf(f,"dst_direct");
219+ break;
220+ case TCA_SFQ_HASH_SRCDIR:
221+ fprintf(f,"src_direct");
222+ break;
223+ case TCA_SFQ_HASH_FWMARKDIR:
224+ fprintf(f,"fwmark_direct");
225+ break;
226+ default:
227+ fprintf(f,"Unknown");
228+ }
229+ return 0;
230+}
231+
232+static int esfq_print_xstats(struct qdisc_util *qu, FILE *f, struct rtattr *xstats)
233+{
234+ return 0;
235+}
236+
237+
238+struct qdisc_util esfq_qdisc_util = {
239+ .id = "esfq",
240+ .parse_qopt = esfq_parse_opt,
241+ .print_qopt = esfq_print_opt,
242+ .print_xstats = esfq_print_xstats,
243+};
This page took 0.061549 seconds and 4 git commands to generate.