]> git.pld-linux.org Git - packages/iproute2.git/blob - iproute2-q_srr.v0.4.patch
- updated to 5.12.0
[packages/iproute2.git] / iproute2-q_srr.v0.4.patch
1 --- iproute2-5.10.0/include/uapi/linux/pkt_sched.h.orig 2021-02-24 19:32:20.974075535 +0100
2 +++ iproute2-5.10.0/include/uapi/linux/pkt_sched.h      2021-02-24 19:33:12.273391823 +0100
3 @@ -279,6 +279,14 @@
4         unsigned        hash_kind;      /* Hash function to use for flow identification */
5  };
6  
7 +/* SRR section */
8 +struct tc_srr_qopt {
9 +       __u32 slots;
10 +       __u32 used_slots;
11 +       __u32 slot_limit;
12 +       __u32 slot_classify;
13 +};
14 +
15  /* RED section */
16  
17  enum {
18 diff -ruN iproute-20041019/tc/q_srr.c iproute-20041019.srr.patched.v0.4/tc/q_srr.c
19 --- iproute-20041019/tc/q_srr.c 1970-01-01 03:00:00.000000000 +0300
20 +++ iproute-20041019.srr.patched.v0.4/tc/q_srr.c        2006-07-27 12:59:27.000000000 +0300
21 @@ -0,0 +1,118 @@
22 +#include <unistd.h>
23 +#include <syslog.h>
24 +#include <fcntl.h>
25 +#include <sys/socket.h>
26 +#include <netinet/in.h>
27 +#include <arpa/inet.h>
28 +#include <string.h>
29 +
30 +#include "utils.h"
31 +#include "tc_util.h"
32 +
33 +#define SRR_CL_SRC     0
34 +#define SRR_CL_DST     1
35 +#define SRR_CL_FWM     2
36 +
37 +static void explain(void)
38 +{
39 +       fprintf(stderr, "Usage: ... srr [ slots NUMBER ] [ limit NUMBER ] [ classify src/dst/fw ]\n");
40 +}
41 +
42 +#define usage() return(-1)
43 +
44 +static int srr_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n)
45 +{
46 +       int ok=0;
47 +       struct tc_srr_qopt opt;
48 +
49 +       memset(&opt, 0, sizeof(opt));
50 +
51 +       while ( argc > 0 ) {
52 +               if ( strcmp(*argv, "slots") == 0 ) {
53 +                       NEXT_ARG();
54 +                       if ( get_u32(&opt.slots, *argv, 0) ) {
55 +                               fprintf(stderr, "Illegal \"slot\"\n");
56 +                               return -1;
57 +                       }
58 +                       ok++;
59 +               }
60 +               else if ( strcmp(*argv, "limit") == 0 ) {
61 +                       NEXT_ARG();
62 +                       if ( get_u32(&opt.slot_limit, *argv, 0) ) {
63 +                               fprintf(stderr, "Illegal \"limit\"\n");
64 +                       }
65 +                       ok++;
66 +               }
67 +               else if ( strcmp(*argv, "classify") == 0 ) {
68 +                       NEXT_ARG();
69 +                       if ( strcmp(*argv, "src") == 0 ) {
70 +                                       opt.slot_classify = SRR_CL_SRC;
71 +                                       goto cl_ok;
72 +                       }
73 +                       if ( strcmp(*argv, "dst") == 0 ) {
74 +                                       opt.slot_classify = SRR_CL_DST;
75 +                                       goto cl_ok;
76 +                       }
77 +                       if ( strcmp(*argv, "fw") == 0 ) {
78 +                                       opt.slot_classify = SRR_CL_FWM;
79 +                                       goto cl_ok;
80 +                       }
81 +                       fprintf(stderr, "Illegal \"classify\"\n");
82 +                       return -1;
83 +
84 +                       cl_ok: ok++;
85 +               }
86 +               else if ( strcmp(*argv, "help") == 0 ) {
87 +                       explain();
88 +                       return -1;
89 +               }
90 +               else {
91 +                       fprintf(stderr, "What is \"%s\"?\n", *argv);
92 +                       explain();
93 +                       return -1;
94 +               }
95 +               argc--; argv++;
96 +       }
97 +
98 +       if ( ok )
99 +               addattr_l(n, 1024, TCA_OPTIONS, &opt, sizeof(opt));
100 +       return 0;
101 +}
102 +
103 +static int srr_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
104 +{
105 +       struct tc_srr_qopt *qopt;
106 +
107 +       if ( opt == NULL ) 
108 +               return 0;
109 +
110 +       if (RTA_PAYLOAD(opt)  < sizeof(*qopt))
111 +               return -1;
112 +
113 +       qopt = RTA_DATA(opt);
114 +       fprintf(f, "slots %u ", qopt->slots);
115 +       fprintf(f, "used %u/%u ", qopt->used_slots, qopt->slots);
116 +       fprintf(f, "qlimit %u ", qopt->slot_limit);
117 +       switch (qopt->slot_classify) {
118 +               case SRR_CL_SRC:
119 +                       fprintf(f, "classify IP_SRC");
120 +                       break;
121 +               case SRR_CL_DST:
122 +                       fprintf(f, "classify IP_DST");
123 +                       break;
124 +               case SRR_CL_FWM:
125 +                       fprintf(f, "classify FW");
126 +                       break;
127 +               default:
128 +                       fprintf(f, "classify UNKNOW!!!");
129 +       }
130 +
131 +       return 0;
132 +}
133 +
134 +
135 +struct qdisc_util srr_qdisc_util = {
136 +       .id             = "srr",
137 +       .parse_qopt     = srr_parse_opt,
138 +       .print_qopt     = srr_print_opt,
139 +};
140 --- iproute2-5.10.0/tc/Makefile.orig    2021-02-24 19:32:21.377429702 +0100
141 +++ iproute2-5.10.0/tc/Makefile 2021-02-24 19:33:44.238376154 +0100
142 @@ -21,6 +21,7 @@
143  TCMODULES += q_netem.o
144  TCMODULES += q_choke.o
145  TCMODULES += q_sfb.o
146 +TCMODULES += q_srr.o
147  TCMODULES += q_wrr.o
148  TCMODULES += f_rsvp.o
149  TCMODULES += f_u32.o
This page took 0.074373 seconds and 3 git commands to generate.