]> git.pld-linux.org Git - packages/iproute2.git/blob - esfq-iproute2.patch
- updated to 6.9.0
[packages/iproute2.git] / esfq-iproute2.patch
1 diff -Naur iproute2-2.6.19-061214.orig/include/uapi/linux/pkt_sched.h iproute2-2.6.19-061214/include/uapi/linux/pkt_sched.h
2 --- iproute2-2.6.19-061214.orig/include/uapi/linux/pkt_sched.h  2006-12-14 15:04:12.000000000 -0800
3 +++ iproute2-2.6.19-061214/include/uapi/linux/pkt_sched.h       2007-02-13 23:18:29.000000000 -0800
4 @@ -193,6 +193,36 @@ struct tc_sfq_xstats {
5         __s32           allot;
6  };
7  
8 +/* ESFQ section */
9 +
10 +enum
11 +{
12 +       /* traditional */
13 +       TCA_SFQ_HASH_CLASSIC,
14 +       TCA_SFQ_HASH_DST,
15 +       TCA_SFQ_HASH_SRC,
16 +       TCA_SFQ_HASH_FWMARK,
17 +       /* direct */
18 +       TCA_SFQ_HASH_DSTDIR,
19 +       TCA_SFQ_HASH_SRCDIR,
20 +       TCA_SFQ_HASH_FWMARKDIR,
21 +       /* conntrack */
22 +       TCA_SFQ_HASH_CTORIGDST,
23 +       TCA_SFQ_HASH_CTORIGSRC,
24 +       TCA_SFQ_HASH_CTREPLDST,
25 +       TCA_SFQ_HASH_CTREPLSRC,
26 +};
27 +
28 +struct tc_esfq_qopt
29 +{
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 */
36 +};
37 +
38  /* RED section */
39  
40  enum {
41 --- iproute2-5.10.0/tc/Makefile.orig    2021-02-24 19:28:31.498889761 +0100
42 +++ iproute2-5.10.0/tc/Makefile 2021-02-24 19:29:13.547728259 +0100
43 @@ -10,6 +10,7 @@
44  TCMODULES :=
45  TCMODULES += q_fifo.o
46  TCMODULES += q_sfq.o
47 +TCMODULES += q_esfq.o
48  TCMODULES += q_red.o
49  TCMODULES += q_prio.o
50  TCMODULES += q_skbprio.o
51 diff -Naur iproute2-2.6.19-061214.orig/tc/q_esfq.c iproute2-2.6.19-061214/tc/q_esfq.c
52 --- iproute2-2.6.19-061214.orig/tc/q_esfq.c     1969-12-31 16:00:00.000000000 -0800
53 +++ iproute2-2.6.19-061214/tc/q_esfq.c  2007-02-13 23:18:26.000000000 -0800
54 @@ -0,0 +1,224 @@
55 +/*
56 + * q_esfq.c            ESFQ.
57 + *
58 + *             This program is free software; you can redistribute it and/or
59 + *             modify it under the terms of the GNU General Public License
60 + *             as published by the Free Software Foundation; either version
61 + *             2 of the License, or (at your option) any later version.
62 + *
63 + * Authors:    Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
64 + *
65 + * Changes:    Alexander Atanasov, <alex@ssi.bg>
66 + *             Alexander Clouter, <alex@digriz.org.uk>
67 + *             Corey Hickey, <bugfood-c@fatooh.org>
68 + *
69 + */
70 +
71 +#include <stdio.h>
72 +#include <stdlib.h>
73 +#include <unistd.h>
74 +#include <syslog.h>
75 +#include <fcntl.h>
76 +#include <math.h> 
77 +#include <sys/socket.h>
78 +#include <netinet/in.h>
79 +#include <arpa/inet.h>
80 +#include <string.h>
81 +
82 +#include "utils.h"
83 +#include "tc_util.h"
84 +
85 +static void explain(void)
86 +{
87 +       fprintf(stderr, "Usage: ... esfq [ perturb SECS ] [ quantum BYTES ] [ depth FLOWS ]\n\t[ divisor HASHBITS ] [ limit PKTS ] [ hash HASHTYPE]\n");
88 +       fprintf(stderr,"Where: \n");
89 +       fprintf(stderr,"HASHTYPE := { classic | src | dst | fwmark | src_dir | dst_dir | fwmark_dir | ctorigdst | ctorigsrc | ctrepldst | ctreplsrc}\n");
90 +}
91 +
92 +#define usage() return(-1)
93 +
94 +static int esfq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n)
95 +{
96 +       int ok=0;
97 +       struct tc_esfq_qopt opt;
98 +
99 +       memset(&opt, 0, sizeof(opt));
100 +
101 +       opt.hash_kind= TCA_SFQ_HASH_CLASSIC;
102 +       
103 +       while (argc > 0) {
104 +               if (strcmp(*argv, "quantum") == 0) {
105 +                       NEXT_ARG();
106 +                       if (get_size(&opt.quantum, *argv)) {
107 +                               fprintf(stderr, "Illegal \"quantum\"\n");
108 +                               return -1;
109 +                       }
110 +                       ok++;
111 +               } else if (strcmp(*argv, "perturb") == 0) {
112 +                       NEXT_ARG();
113 +                       if (get_integer(&opt.perturb_period, *argv, 0)) {
114 +                               fprintf(stderr, "Illegal \"perturb\"\n");
115 +                               return -1;
116 +                       }
117 +                       ok++;
118 +               } else if (strcmp(*argv, "depth") == 0) {
119 +                       NEXT_ARG();
120 +                       if (get_integer((int *) &opt.flows, *argv, 0)) {
121 +                               fprintf(stderr, "Illegal \"depth\"\n");
122 +                               return -1;
123 +                       }
124 +                       ok++;
125 +               } else if (strcmp(*argv, "divisor") == 0) {
126 +                       NEXT_ARG();
127 +                       if (get_integer((int *) &opt.divisor, *argv, 0)) {
128 +                               fprintf(stderr, "Illegal \"divisor\"\n");
129 +                               return -1;
130 +                       }
131 +                       if(opt.divisor >= 14) {
132 +                               fprintf(stderr, "Illegal \"divisor\": must be < 14\n");
133 +                               return -1;
134 +                       }
135 +                       opt.divisor=pow(2,opt.divisor);
136 +                       ok++;
137 +               } else if (strcmp(*argv, "limit") == 0) {
138 +                       NEXT_ARG();
139 +                       if (get_integer((int *) &opt.limit, *argv, 0)) {
140 +                               fprintf(stderr, "Illegal \"limit\"\n");
141 +                               return -1;
142 +                       }
143 +                       ok++;
144 +               } else if (strcmp(*argv, "hash") == 0) {
145 +                       NEXT_ARG();
146 +                       if(strcmp(*argv, "classic") == 0) {
147 +                               opt.hash_kind= TCA_SFQ_HASH_CLASSIC;
148 +                       } else 
149 +                       if(strcmp(*argv, "dst") == 0) {
150 +                               opt.hash_kind= TCA_SFQ_HASH_DST;
151 +                       } else
152 +                       if(strcmp(*argv, "src") == 0) {
153 +                               opt.hash_kind= TCA_SFQ_HASH_SRC;
154 +                       } else
155 +                       if(strcmp(*argv, "fwmark") == 0) {
156 +                               opt.hash_kind= TCA_SFQ_HASH_FWMARK;
157 +                       } else
158 +                       if(strcmp(*argv, "dst_direct") == 0) {
159 +                               opt.hash_kind= TCA_SFQ_HASH_DSTDIR;
160 +                               fprintf(stderr, "Warning: \"dst_direct\" is deprecated\n"
161 +                                       "use \"dst\" instead\n");
162 +                       } else
163 +                       if(strcmp(*argv, "src_direct") == 0) {
164 +                               opt.hash_kind= TCA_SFQ_HASH_SRCDIR;
165 +                               fprintf(stderr, "Warning: \"src_direct\" is deprecated\n"
166 +                                       "use \"src\" instead\n");
167 +                       } else
168 +                       if(strcmp(*argv, "fwmark_direct") == 0) {
169 +                               opt.hash_kind= TCA_SFQ_HASH_FWMARKDIR;
170 +                               fprintf(stderr, "Warning: \"fwmark_direct\" is deprecated\n"
171 +                                       "use \"fwmark\" instead\n");
172 +                       } else
173 +                       if(strcmp(*argv, "ctorigsrc") == 0) {
174 +                               opt.hash_kind= TCA_SFQ_HASH_CTORIGSRC;
175 +                       } else
176 +                       if(strcmp(*argv, "ctorigdst") == 0) {
177 +                               opt.hash_kind= TCA_SFQ_HASH_CTORIGDST;
178 +                       } else
179 +                       if(strcmp(*argv, "ctreplsrc") == 0) {
180 +                               opt.hash_kind= TCA_SFQ_HASH_CTREPLSRC;
181 +                       } else
182 +                       if(strcmp(*argv, "ctrepldst") == 0) {
183 +                               opt.hash_kind= TCA_SFQ_HASH_CTREPLDST;
184 +                       } else {
185 +                               fprintf(stderr, "Illegal \"hash\"\n");
186 +                               explain();
187 +                               return -1;
188 +                       }
189 +                       ok++;
190 +               } else if (strcmp(*argv, "help") == 0) {
191 +                       explain();
192 +                       return -1;
193 +               } else {
194 +                       fprintf(stderr, "What is \"%s\"?\n", *argv);
195 +                       explain();
196 +                       return -1;
197 +               }
198 +               argc--; argv++;
199 +       }
200 +
201 +       if (ok)
202 +               addattr_l(n, 1024, TCA_OPTIONS, &opt, sizeof(opt));
203 +       return 0;
204 +}
205 +
206 +static int esfq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
207 +{
208 +       struct tc_esfq_qopt *qopt;
209 +       SPRINT_BUF(b1);
210 +
211 +       if (opt == NULL)
212 +               return 0;
213 +
214 +       if (RTA_PAYLOAD(opt)  < sizeof(*qopt))
215 +               return -1;
216 +       qopt = RTA_DATA(opt);
217 +       fprintf(f, "quantum %s ", sprint_size(qopt->quantum, b1));
218 +       if (show_details) {
219 +               fprintf(f, "limit %up flows %u/%u ",
220 +                       qopt->limit, qopt->flows, qopt->divisor);
221 +       }
222 +       if (qopt->perturb_period)
223 +               fprintf(f, "perturb %dsec ", qopt->perturb_period);
224 +
225 +               fprintf(f,"hash: ");
226 +       switch(qopt->hash_kind)
227 +       {
228 +       case TCA_SFQ_HASH_CLASSIC:
229 +               fprintf(f,"classic");
230 +               break;
231 +       case TCA_SFQ_HASH_DST:
232 +               fprintf(f,"dst");
233 +               break;
234 +       case TCA_SFQ_HASH_SRC:
235 +               fprintf(f,"src");
236 +               break;
237 +       case TCA_SFQ_HASH_FWMARK:
238 +               fprintf(f,"fwmark");
239 +               break;
240 +       case TCA_SFQ_HASH_DSTDIR:
241 +               fprintf(f,"dst_direct");
242 +               break;
243 +       case TCA_SFQ_HASH_SRCDIR:
244 +               fprintf(f,"src_direct");
245 +               break;
246 +       case TCA_SFQ_HASH_FWMARKDIR:
247 +               fprintf(f,"fwmark_direct");
248 +               break;
249 +       case TCA_SFQ_HASH_CTORIGSRC:
250 +               fprintf(f,"ctorigsrc");
251 +               break;
252 +       case TCA_SFQ_HASH_CTORIGDST:
253 +               fprintf(f,"ctorigdst");
254 +               break;
255 +       case TCA_SFQ_HASH_CTREPLSRC:
256 +               fprintf(f,"ctreplsrc");
257 +               break;
258 +       case TCA_SFQ_HASH_CTREPLDST:
259 +               fprintf(f,"ctrepldst");
260 +               break;
261 +       default:
262 +               fprintf(f,"Unknown");
263 +       }
264 +       return 0;
265 +}
266 +
267 +static int esfq_print_xstats(struct qdisc_util *qu, FILE *f, struct rtattr *xstats)
268 +{
269 +       return 0;
270 +}
271 +
272 +
273 +struct qdisc_util esfq_qdisc_util = {
274 +       .id = "esfq",
275 +       .parse_qopt = esfq_parse_opt,
276 +       .print_qopt = esfq_print_opt,
277 +       .print_xstats = esfq_print_xstats,
278 +};
This page took 1.899399 seconds and 4 git commands to generate.