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