]> git.pld-linux.org Git - packages/kernel.git/blame - kernel-wrr.patch
up to 2.6.32.63, use .xz patch
[packages/kernel.git] / kernel-wrr.patch
CommitLineData
2380c486
JR
1diff -urN linux-2.6.26.2.org/include/linux/pkt_sched.h linux-2.6.26.2/include/linux/pkt_sched.h
2--- linux-2.6.26.2.org/include/linux/pkt_sched.h 2008-07-13 23:51:29.000000000 +0200
3+++ linux-2.6.26.2/include/linux/pkt_sched.h 2008-08-19 11:20:27.000000000 +0200
2cb58ce7 4@@ -23,6 +23,8 @@
5
6 #define TC_PRIO_MAX 15
7
8+#include <linux/if_ether.h>
9+
10 /* Generic queue statistics, available for all the elements.
11 Particular schedulers may have also their private records.
12 */
96e550b9 13@@ -482,4 +484,96 @@
2cb58ce7 14
15 #define NETEM_DIST_SCALE 8192
16
17+
18+/* WRR section */
19+
20+/*
21+ * A sub weight and of a class
22+ * All numbers are represented as parts of (2^64-1).
23+ */
24+struct tc_wrr_class_weight {
25+ __u64 val; // Current value (0 is not valid)
26+ __u64 decr; // Value pr bytes (2^64-1 is not valid)
27+ __u64 incr; // Value pr seconds (2^64-1 is not valid)
28+ __u64 min; // Minimal value (0 is not valid)
29+ __u64 max; // Minimal value (0 is not valid)
30+ time_t tim; // The time where the above information was correct
31+};
32+
33+/* Packet send when modifying a class */
34+struct tc_wrr_class_modf {
35+ /* Not-valid values are ignored */
36+ struct tc_wrr_class_weight weight1;
37+ struct tc_wrr_class_weight weight2;
38+};
39+
40+/* Packet returned when quering a class */
41+struct tc_wrr_class_stats {
42+ char used; /* If this is false the information below is invalid */
43+ struct tc_wrr_class_modf class_modf;
44+ unsigned char addr[ETH_ALEN];
45+ char usemac; /* True if addr is a MAC address, else it is an IP address
46+ (this value is only for convience, it is always the same
47+ value as in the qdisc) */
48+ int heappos; /* Current heap position or 0 if not in heap */
49+ __u64 penal_ls; /* Penalty value in heap (ls) */
50+ __u64 penal_ms; /* Penalty value in heap (ms) */
51+};
52+
53+/* Qdisc-wide penalty information (boolean values - 2 not valid) */
54+struct tc_wrr_qdisc_weight {
55+ signed char weight_mode; /* 0=No automatic change to weight
56+ 1=Decrease normally
57+ 2=Also multiply with number of machines
58+ 3=Instead multiply with priority divided
59+ with priority of the other.
60+ -1=no change */
61+};
62+
63+/* Packet send when modifing a qdisc */
64+struct tc_wrr_qdisc_modf {
65+ /* Not-valid values are ignored */
66+ struct tc_wrr_qdisc_weight weight1;
67+ struct tc_wrr_qdisc_weight weight2;
68+};
69+
70+/* Packet send when creating a qdisc */
71+struct tc_wrr_qdisc_crt {
72+ struct tc_wrr_qdisc_modf qdisc_modf;
73+ char srcaddr; /* 1=lookup source, 0=lookup destination */
74+ char usemac; /* 1=Classify on MAC addresses, 0=classify on IP */
75+ char usemasq; /* 1=Classify based on masqgrading - only valid
76+ if usemac is zero */
77+ int bands_max; /* Maximal number of bands (i.e.: classes) */
78+ int proxy_maxconn; /* If differnt from 0 then we support proxy remapping
79+ of packets. And this is the number of maximal
80+ concurrent proxy connections. */
81+};
82+
83+/* Packet returned when quering a qdisc */
84+struct tc_wrr_qdisc_stats {
85+ struct tc_wrr_qdisc_crt qdisc_crt;
86+ int proxy_curconn;
87+ int nodes_in_heap; /* Current number of bands wanting to send something */
88+ int bands_cur; /* Current number of bands used (i.e.: MAC/IP addresses seen) */
89+ int bands_reused; /* Number of times this band has been reused. */
2cb58ce7 90+ __u64 priosum; /* Sum of priorities in heap where 1 is 2^32 */
91+};
92+
93+struct tc_wrr_qdisc_modf_std {
94+ char proxy; /* This indicates which of the tc_wrr_qdisc_modf structers this is. 0=This struct */
95+ char change_class; /* Should we also change a class? */
96+ struct tc_wrr_qdisc_modf qdisc_modf; /* Only valid if change_class is false */
97+ unsigned char addr[ETH_ALEN]; /* Class to change (non-used bytes should be 0). Valid only of change_class is true */
98+ struct tc_wrr_class_modf class_modf; /* The change */
99+};
100+
101+/* Used for proxyremapping */
102+struct tc_wrr_qdisc_modf_proxy {
103+ char proxy; /* This indicates which of the tc_wrr_qdisc_modf structers this is. 1=This struct */
104+ char reset; /* This is 1 if the proxyremap information should be reset */
105+ int changec; /* changec is the number of elements in changes. */
106+ long changes[0]; /* This is an array of type ProxyRemapBlock */
107+};
108+
109 #endif
2380c486
JR
110diff -urN linux-2.6.26.2.org/include/linux/wrr.h linux-2.6.26.2/include/linux/wrr.h
111--- linux-2.6.26.2.org/include/linux/wrr.h 1970-01-01 01:00:00.000000000 +0100
112+++ linux-2.6.26.2/include/linux/wrr.h 2008-08-19 11:20:27.000000000 +0200
2cb58ce7 113@@ -0,0 +1,67 @@
114+#ifndef WRR_H
115+#define WRR_H
116+
117+/*
118+ * This describes the information that is written in proxyremap.log and which
119+ * are used in the communication between proxyremapserver and proxyremapclient.
120+ * Everything is in network order.
121+ */
122+
123+/* First this header is send */
124+#define PROXY_WELCOME_LINE "ProxyRemap 1.02. This is a binary protocol.\r\n"
125+
126+/*
127+ * Then this block is send every time a connection is opened or closed.
128+ * Note how it is alligned to use small space usage - arrays of this
129+ * structure are saved in many places.
130+ */
131+typedef struct {
132+ /* Server endpoint of connection */
133+ unsigned saddr;
134+ unsigned short sport;
135+
136+ /* IP protocol for this connection (typically udp or tcp) */
137+ unsigned char proto;
138+
139+ /* Is the connection opened or closed? */
140+ unsigned char open;
141+
142+ /* Client the packets should be accounted to */
143+ unsigned caddr;
144+ unsigned char macaddr[6]; /* Might be 0. */
145+
146+ /* An informal two-charecter code from the proxyserver. Used for debugging. */
147+ char proxyinfo[2];
148+} ProxyRemapBlock;
149+
150+
151+/*
152+ * This is common code for for handling the tables containing information about
153+ * which proxyserver connections are associated with which machines..
154+ */
155+
156+/* Returns the number of bytes that should be available in the area
157+ * maintained by this module given the maximal number of concurrent
158+ * connections. */
159+int proxyGetMemSize(int max_connections);
160+
161+/* Initializes a memory area to use. There must be as many bytes
162+ available as returned by getMemSize. */
163+void proxyInitMem(void *data, int max_connections);
164+
165+/* Queries */
166+int proxyGetCurConn(void *data); /* Returns current number of connections */
167+int proxyMaxCurConn(void *data); /* Returns maximal number of connections */
168+
169+/* This is called to open and close conenctions. Returns -1 if
170+ a protocol error occores (i.e.: If it is discovered) */
171+int proxyConsumeBlock(void *data, ProxyRemapBlock *);
172+
173+/* Returns the RemapBlock associated with this connection or 0: */
174+ProxyRemapBlock *proxyLookup(void *data, unsigned ipaddr, unsigned short port,
175+ char proto);
176+
177+/* Return the maximum number of connections */
178+int proxyGetMaxConn(void *data);
179+
180+#endif
2380c486
JR
181diff -urN linux-2.6.26.2.org/MAINTAINERS linux-2.6.26.2/MAINTAINERS
182--- linux-2.6.26.2.org/MAINTAINERS 2008-07-13 23:51:29.000000000 +0200
183+++ linux-2.6.26.2/MAINTAINERS 2008-08-19 11:20:27.000000000 +0200
184@@ -4500,6 +4500,12 @@
185 W: http://opensource.wolfsonmicro.com/node/7
186 S: Supported
2cb58ce7 187
188+WRR NETWORK SCHEDULER
189