]> git.pld-linux.org Git - packages/iproute2.git/blame - esfq-iproute2.patch
- up to 2.6.20-070313
[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
046f602f
PS
11--- iproute2.orig/tc/q_esfq.c 1969-12-31 16:00:00.000000000 -0800
12+++ iproute2/tc/q_esfq.c 2005-10-21 18:28:44.000000000 -0700
13@@ -0,0 +1,192 @@
14+/*
15+ * q_esfq.c ESFQ.
16+ *
17+ * This program is free software; you can redistribute it and/or
18+ * modify it under the terms of the GNU General Public License
19+ * as published by the Free Software Foundation; either version
20+ * 2 of the License, or (at your option) any later version.
21+ *
22+ * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
23+ *
24+ * Changes: Alexander Atanasov, <alex@ssi.bg>
25+ * Added depth,limit,divisor,hash_kind options.
26+ */
27+
28+#include <stdio.h>
29+#include <stdlib.h>
30+#include <unistd.h>
31+#include <syslog.h>
32+#include <fcntl.h>
33+#include <math.h>
34+#include <sys/socket.h>
35+#include <netinet/in.h>
36+#include <arpa/inet.h>
37+#include <string.h>
38+
39+#include "utils.h"
40+#include "tc_util.h"
41+
42+static void explain(void)
43+{
44+ fprintf(stderr, "Usage: ... esfq [ perturb SECS ] [ quantum BYTES ] [ depth FLOWS ]\n\t[ divisor HASHBITS ] [ limit PKTS ] [ hash HASHTYPE]\n");
45+ fprintf(stderr,"Where: \n");
46+ fprintf(stderr,"HASHTYPE := { classic | src | dst | fwmark | src_dir | dst_dir | fwmark_dir }\n");
47+}
48+
49+#define usage() return(-1)
50+
51+static int esfq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n)
52+{
53+ int ok=0;
54+ struct tc_esfq_qopt opt;
55+
56+ memset(&opt, 0, sizeof(opt));
57+
58+ opt.hash_kind= TCA_SFQ_HASH_CLASSIC;
59+
60+ while (argc > 0) {
61+ if (strcmp(*argv, "quantum") == 0) {
62+ NEXT_ARG();
63+ if (get_size(&opt.quantum, *argv)) {
64+ fprintf(stderr, "Illegal \"quantum\"\n");
65+ return -1;
66+ }
67+ ok++;
68+ } else if (strcmp(*argv, "perturb") == 0) {
69+ NEXT_ARG();
70+ if (get_integer(&opt.perturb_period, *argv, 0)) {
71+ fprintf(stderr, "Illegal \"perturb\"\n");
72+ return -1;
73+ }
74+ ok++;
75+ } else if (strcmp(*argv, "depth") == 0) {
76+ NEXT_ARG();
77+ if (get_integer((int *) &opt.flows, *argv, 0)) {
78+ fprintf(stderr, "Illegal \"depth\"\n");
79+ return -1;
80+ }
81+ ok++;
82+ } else if (strcmp(*argv, "divisor") == 0) {
83+ NEXT_ARG();
84+ if (get_integer((int *) &opt.divisor, *argv, 0)) {
85+ fprintf(stderr, "Illegal \"divisor\"\n");
86+ return -1;
87+ }
88+ if(opt.divisor >= 15) {
89+ fprintf(stderr, "Illegal \"divisor\" must be < 15\n");
90+ return -1;
91+ }
92+ opt.divisor=pow(2,opt.divisor);
93+ ok++;
94+ } else if (strcmp(*argv, "limit") == 0) {
95+ NEXT_ARG();
96+ if (get_integer((int *) &opt.limit, *argv, 0)) {
97+ fprintf(stderr, "Illegal \"limit\"\n");
98+ return -1;
99+ }
100+ ok++;
101+ } else if (strcmp(*argv, "hash") == 0) {
102+ NEXT_ARG();
103+ if(strcmp(*argv, "classic") == 0) {
104+ opt.hash_kind= TCA_SFQ_HASH_CLASSIC;
105+ } else
106+ if(strcmp(*argv, "dst") == 0) {
107+ opt.hash_kind= TCA_SFQ_HASH_DST;
108+ } else
109+ if(strcmp(*argv, "src") == 0) {
110+ opt.hash_kind= TCA_SFQ_HASH_SRC;
111+ } else
112+ if(strcmp(*argv, "fwmark") == 0) {
113+ opt.hash_kind= TCA_SFQ_HASH_FWMARK;
114+ } else
115+ if(strcmp(*argv, "dst_direct") == 0) {
116+ opt.hash_kind= TCA_SFQ_HASH_DSTDIR;
117+ } else
118+ if(strcmp(*argv, "src_direct") == 0) {
119+ opt.hash_kind= TCA_SFQ_HASH_SRCDIR;
120+ } else
121+ if(strcmp(*argv, "fwmark_direct") == 0) {
122+ opt.hash_kind= TCA_SFQ_HASH_FWMARKDIR;
123+ } else {
124+ fprintf(stderr, "Illegal \"hash\"\n");
125+ explain();
126+ return -1;
127+ }
128+ ok++;
129+ } else if (strcmp(*argv, "help") == 0) {
130+ explain();
131+ return -1;
132+ } else {
133+ fprintf(stderr, "What is \"%s\"?\n", *argv);
134+ explain();
135+ return -1;
136+ }
137+ argc--; argv++;
138+ }
139+
140+ if (ok)
141+ addattr_l(n, 1024, TCA_OPTIONS, &opt, sizeof(opt));
142+ return 0;
143+}
144+
145+static int esfq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
146+{
147+ struct tc_esfq_qopt *qopt;
148+ SPRINT_BUF(b1);
149+
150+ if (opt == NULL)
151+ return 0;
152+
153+ if (RTA_PAYLOAD(opt) < sizeof(*qopt))
154+ return -1;
155+ qopt = RTA_DATA(opt);
156+ fprintf(f, "quantum %s ", sprint_size(qopt->quantum, b1));
157+ if (show_details) {
158+ fprintf(f, "limit %up flows %u/%u ",
159+ qopt->limit, qopt->flows, qopt->divisor);
160+ }
161+ if (qopt->perturb_period)
162+ fprintf(f, "perturb %dsec ", qopt->perturb_period);
163+
164+ fprintf(f,"hash: ");
165+ switch(qopt->hash_kind)
166+ {
167+ case TCA_SFQ_HASH_CLASSIC:
168+ fprintf(f,"classic");
169+ break;
170+ case TCA_SFQ_HASH_DST:
171+ fprintf(f,"dst");
172+ break;
173+ case TCA_SFQ_HASH_SRC:
174+ fprintf(f,"src");
175+ break;
176+ case TCA_SFQ_HASH_FWMARK:
177+ fprintf(f,"fwmark");
178+ break;
179+ case TCA_SFQ_HASH_DSTDIR:
180+ fprintf(f,"dst_direct");
181+ break;
182+ case TCA_SFQ_HASH_SRCDIR:
183+ fprintf(f,"src_direct");
184+ break;
185+ case TCA_SFQ_HASH_FWMARKDIR:
186+ fprintf(f,"fwmark_direct");
187+ break;
188+ default:
189+ fprintf(f,"Unknown");
190+ }
191+ return 0;
192+}
193+
194+static int esfq_print_xstats(struct qdisc_util *qu, FILE *f, struct rtattr *xstats)
195+{
196+ return 0;
197+}
198+
199+
200+struct qdisc_util esfq_qdisc_util = {
201+ .id = "esfq",
202+ .parse_qopt = esfq_parse_opt,
203+ .print_qopt = esfq_print_opt,
204+ .print_xstats = esfq_print_xstats,
205+};
This page took 0.118746 seconds and 4 git commands to generate.