Deleted Added
full compact
altq_cdnr.h (130366) altq_cdnr.h (281613)
1/* $KAME: altq_cdnr.h,v 1.9 2003/07/10 12:07:48 kjc Exp $ */
2
3/*
1/*-
4 * Copyright (C) 1999-2002
5 * Sony Computer Science Laboratories Inc. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY SONY CSL AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL SONY CSL OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
2 * Copyright (C) 1999-2002
3 * Sony Computer Science Laboratories Inc. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY SONY CSL AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL SONY CSL OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $KAME: altq_cdnr.h,v 1.9 2003/07/10 12:07:48 kjc Exp $
27 * $FreeBSD: head/sys/net/altq/altq_cdnr.h 281613 2015-04-16 20:22:40Z glebius $
27 */
28
29#ifndef _ALTQ_ALTQ_CDNR_H_
30#define _ALTQ_ALTQ_CDNR_H_
31
28 */
29
30#ifndef _ALTQ_ALTQ_CDNR_H_
31#define _ALTQ_ALTQ_CDNR_H_
32
32#include
33#include <net/altq/altq.h>
33
34/*
35 * traffic conditioner element types
36 */
37#define TCETYPE_NONE 0
38#define TCETYPE_TOP 1 /* top level conditioner */
39#define TCETYPE_ELEMENT 2 /* a simple tc element */
40#define TCETYPE_TBMETER 3 /* token bucket meter */
41#define TCETYPE_TRTCM 4 /* (two-rate) three color marker */
42#define TCETYPE_TSWTCM 5 /* time sliding window 3-color maker */
43
44/*
45 * traffic conditioner action
46 */
47struct cdnr_block;
48
49struct tc_action {
50 int tca_code; /* e.g., TCACODE_PASS */
51 /* tca_code dependent variable */
52 union {
53 u_long un_value; /* template */
54 u_int8_t un_dscp; /* diffserv code point */
55 u_long un_handle; /* tc action handle */
56 struct cdnr_block *un_next; /* next tc element block */
57 } tca_un;
58};
59#define tca_value tca_un.un_value
60#define tca_dscp tca_un.un_dscp
61#define tca_handle tca_un.un_handle
62#define tca_next tca_un.un_next
63
64#define TCACODE_NONE 0 /* action is not set */
65#define TCACODE_PASS 1 /* pass this packet */
66#define TCACODE_DROP 2 /* discard this packet */
67#define TCACODE_RETURN 3 /* do not process this packet */
68#define TCACODE_MARK 4 /* mark dscp */
69#define TCACODE_HANDLE 5 /* take action specified by handle */
70#define TCACODE_NEXT 6 /* take action in the next tc element */
71#define TCACODE_MAX 6
72
73#define CDNR_NULL_HANDLE 0
74
75struct cdnr_interface {
76 char cdnr_ifname[IFNAMSIZ]; /* interface name (e.g., fxp0) */
77};
78
79/* simple element operations */
80struct cdnr_add_element {
81 struct cdnr_interface iface;
82 struct tc_action action;
83
84 u_long cdnr_handle; /* return value */
85};
86
87struct cdnr_delete_element {
88 struct cdnr_interface iface;
89 u_long cdnr_handle;
90};
91
92/* token-bucket meter operations */
93struct cdnr_add_tbmeter {
94 struct cdnr_interface iface;
95 struct tb_profile profile;
96 struct tc_action in_action;
97 struct tc_action out_action;
98
99 u_long cdnr_handle; /* return value */
100};
101
102struct cdnr_modify_tbmeter {
103 struct cdnr_interface iface;
104 u_long cdnr_handle;
105 struct tb_profile profile;
106};
107
108struct cdnr_tbmeter_stats {
109 struct cdnr_interface iface;
110 u_long cdnr_handle;
111 struct pktcntr in_cnt;
112 struct pktcntr out_cnt;
113};
114
115/* two-rate three-color marker operations */
116struct cdnr_add_trtcm {
117 struct cdnr_interface iface;
118 struct tb_profile cmtd_profile; /* profile for committed tb */
119 struct tb_profile peak_profile; /* profile for peak tb */
120 struct tc_action green_action; /* action for green packets */
121 struct tc_action yellow_action; /* action for yellow packets */
122 struct tc_action red_action; /* action for red packets */
123 int coloraware; /* color-aware/color-blind */
124
125 u_long cdnr_handle; /* return value */
126};
127
128struct cdnr_modify_trtcm {
129 struct cdnr_interface iface;
130 u_long cdnr_handle;
131 struct tb_profile cmtd_profile; /* profile for committed tb */
132 struct tb_profile peak_profile; /* profile for peak tb */
133 int coloraware; /* color-aware/color-blind */
134};
135
136struct cdnr_tcm_stats {
137 struct cdnr_interface iface;
138 u_long cdnr_handle;
139 struct pktcntr green_cnt;
140 struct pktcntr yellow_cnt;
141 struct pktcntr red_cnt;
142};
143
144/* time sliding window three-color marker operations */
145struct cdnr_add_tswtcm {
146 struct cdnr_interface iface;
147 u_int32_t cmtd_rate; /* committed rate (bits/sec) */
148 u_int32_t peak_rate; /* peak rate (bits/sec) */
149 u_int32_t avg_interval; /* averaging interval (msec) */
150 struct tc_action green_action; /* action for green packets */
151 struct tc_action yellow_action; /* action for yellow packets */
152 struct tc_action red_action; /* action for red packets */
153
154 u_long cdnr_handle; /* return value */
155};
156
157struct cdnr_modify_tswtcm {
158 struct cdnr_interface iface;
159 u_long cdnr_handle;
160 u_int32_t cmtd_rate; /* committed rate (bits/sec) */
161 u_int32_t peak_rate; /* peak rate (bits/sec) */
162 u_int32_t avg_interval; /* averaging interval (msec) */
163};
164
165struct cdnr_add_filter {
166 struct cdnr_interface iface;
167 u_long cdnr_handle;
168#ifdef ALTQ3_CLFIER_COMPAT
169 struct flow_filter filter;
170#endif
171 u_long filter_handle; /* return value */
172};
173
174struct cdnr_delete_filter {
175 struct cdnr_interface iface;
176 u_long filter_handle;
177};
178
179struct tce_stats {
180 u_long tce_handle; /* tc element handle */
181 int tce_type; /* e.g., TCETYPE_ELEMENT */
182 struct pktcntr tce_cnts[3]; /* tcm returns 3 counters */
183};
184
185struct cdnr_get_stats {
186 struct cdnr_interface iface;
187 struct pktcntr cnts[TCACODE_MAX+1];
188
189 /* element stats */
190 int nskip; /* skip # of elements */
191 int nelements; /* # of element stats (WR) */
192 struct tce_stats *tce_stats; /* pointer to stats array */
193};
194
195#define CDNR_IF_ATTACH _IOW('Q', 1, struct cdnr_interface)
196#define CDNR_IF_DETACH _IOW('Q', 2, struct cdnr_interface)
197#define CDNR_ENABLE _IOW('Q', 3, struct cdnr_interface)
198#define CDNR_DISABLE _IOW('Q', 4, struct cdnr_interface)
199#define CDNR_ADD_FILTER _IOWR('Q', 10, struct cdnr_add_filter)
200#define CDNR_DEL_FILTER _IOW('Q', 11, struct cdnr_delete_filter)
201#define CDNR_GETSTATS _IOWR('Q', 12, struct cdnr_get_stats)
202#define CDNR_ADD_ELEM _IOWR('Q', 30, struct cdnr_add_element)
203#define CDNR_DEL_ELEM _IOW('Q', 31, struct cdnr_delete_element)
204#define CDNR_ADD_TBM _IOWR('Q', 32, struct cdnr_add_tbmeter)
205#define CDNR_MOD_TBM _IOW('Q', 33, struct cdnr_modify_tbmeter)
206#define CDNR_TBM_STATS _IOWR('Q', 34, struct cdnr_tbmeter_stats)
207#define CDNR_ADD_TCM _IOWR('Q', 35, struct cdnr_add_trtcm)
208#define CDNR_MOD_TCM _IOWR('Q', 36, struct cdnr_modify_trtcm)
209#define CDNR_TCM_STATS _IOWR('Q', 37, struct cdnr_tcm_stats)
210#define CDNR_ADD_TSW _IOWR('Q', 38, struct cdnr_add_tswtcm)
211#define CDNR_MOD_TSW _IOWR('Q', 39, struct cdnr_modify_tswtcm)
212
213#ifndef DSCP_EF
214/* diffserve code points */
215#define DSCP_MASK 0xfc
216#define DSCP_CUMASK 0x03
217#define DSCP_EF 0xb8
218#define DSCP_AF11 0x28
219#define DSCP_AF12 0x30
220#define DSCP_AF13 0x38
221#define DSCP_AF21 0x48
222#define DSCP_AF22 0x50
223#define DSCP_AF23 0x58
224#define DSCP_AF31 0x68
225#define DSCP_AF32 0x70
226#define DSCP_AF33 0x78
227#define DSCP_AF41 0x88
228#define DSCP_AF42 0x90
229#define DSCP_AF43 0x98
230#define AF_CLASSMASK 0xe0
231#define AF_DROPPRECMASK 0x18
232#endif
233
234#ifdef _KERNEL
235
236/*
237 * packet information passed to the input function of tc elements
238 */
239struct cdnr_pktinfo {
240 int pkt_len; /* packet length */
241 u_int8_t pkt_dscp; /* diffserv code point */
242};
243
244/*
245 * traffic conditioner control block common to all types of tc elements
246 */
247struct cdnr_block {
248 LIST_ENTRY(cdnr_block) cb_next;
249 int cb_len; /* size of this tc element */
250 int cb_type; /* cdnr block type */
251 int cb_ref; /* reference count of this element */
252 u_long cb_handle; /* handle of this tc element */
253 struct top_cdnr *cb_top; /* back pointer to top */
254 struct tc_action cb_action; /* top level action for this tcb */
255 struct tc_action *(*cb_input)(struct cdnr_block *,
256 struct cdnr_pktinfo *);
257};
258
259/*
260 * top level traffic conditioner structure for an interface
261 */
262struct top_cdnr {
263 struct cdnr_block tc_block;
264
265 LIST_ENTRY(top_cdnr) tc_next;
266 struct ifaltq *tc_ifq;
267
268 LIST_HEAD(, cdnr_block) tc_elements;
269#ifdef ALTQ3_CLFIER_COMPAT
270 struct acc_classifier tc_classifier;
271#endif
272 struct pktcntr tc_cnts[TCACODE_MAX+1];
273};
274
275/* token bucket element */
276struct tbe {
277 u_int64_t rate;
278 u_int64_t depth;
279
280 u_int64_t token;
281 u_int64_t filluptime;
282 u_int64_t last;
283};
284
285/* token bucket meter structure */
286struct tbmeter {
287 struct cdnr_block cdnrblk; /* conditioner block */
288 struct tbe tb; /* token bucket */
289 struct tc_action in_action; /* actions for IN/OUT */
290 struct tc_action out_action; /* actions for IN/OUT */
291 struct pktcntr in_cnt; /* statistics for IN/OUT */
292 struct pktcntr out_cnt; /* statistics for IN/OUT */
293};
294
295/* two-rate three-color marker structure */
296struct trtcm {
297 struct cdnr_block cdnrblk; /* conditioner block */
298 struct tbe cmtd_tb; /* committed tb profile */
299 struct tbe peak_tb; /* peak tb profile */
300 struct tc_action green_action;
301 struct tc_action yellow_action;
302 struct tc_action red_action;
303 int coloraware;
304 u_int8_t green_dscp;
305 u_int8_t yellow_dscp;
306 u_int8_t red_dscp;
307 struct pktcntr green_cnt;
308 struct pktcntr yellow_cnt;
309 struct pktcntr red_cnt;
310};
311
312/* time sliding window three-color marker structure */
313struct tswtcm {
314 struct cdnr_block cdnrblk; /* conditioner block */
315
316 u_int32_t avg_rate; /* average rate (bytes/sec) */
317 u_int64_t t_front; /* timestamp of last update */
318
319 u_int64_t timewin; /* average interval */
320 u_int32_t cmtd_rate; /* committed target rate */
321 u_int32_t peak_rate; /* peak target rate */
322 struct tc_action green_action;
323 struct tc_action yellow_action;
324 struct tc_action red_action;
325 u_int8_t green_dscp;
326 u_int8_t yellow_dscp;
327 u_int8_t red_dscp;
328 struct pktcntr green_cnt;
329 struct pktcntr yellow_cnt;
330 struct pktcntr red_cnt;
331};
332
333#endif /* _KERNEL */
334
335#endif /* _ALTQ_ALTQ_CDNR_H_ */
34
35/*
36 * traffic conditioner element types
37 */
38#define TCETYPE_NONE 0
39#define TCETYPE_TOP 1 /* top level conditioner */
40#define TCETYPE_ELEMENT 2 /* a simple tc element */
41#define TCETYPE_TBMETER 3 /* token bucket meter */
42#define TCETYPE_TRTCM 4 /* (two-rate) three color marker */
43#define TCETYPE_TSWTCM 5 /* time sliding window 3-color maker */
44
45/*
46 * traffic conditioner action
47 */
48struct cdnr_block;
49
50struct tc_action {
51 int tca_code; /* e.g., TCACODE_PASS */
52 /* tca_code dependent variable */
53 union {
54 u_long un_value; /* template */
55 u_int8_t un_dscp; /* diffserv code point */
56 u_long un_handle; /* tc action handle */
57 struct cdnr_block *un_next; /* next tc element block */
58 } tca_un;
59};
60#define tca_value tca_un.un_value
61#define tca_dscp tca_un.un_dscp
62#define tca_handle tca_un.un_handle
63#define tca_next tca_un.un_next
64
65#define TCACODE_NONE 0 /* action is not set */
66#define TCACODE_PASS 1 /* pass this packet */
67#define TCACODE_DROP 2 /* discard this packet */
68#define TCACODE_RETURN 3 /* do not process this packet */
69#define TCACODE_MARK 4 /* mark dscp */
70#define TCACODE_HANDLE 5 /* take action specified by handle */
71#define TCACODE_NEXT 6 /* take action in the next tc element */
72#define TCACODE_MAX 6
73
74#define CDNR_NULL_HANDLE 0
75
76struct cdnr_interface {
77 char cdnr_ifname[IFNAMSIZ]; /* interface name (e.g., fxp0) */
78};
79
80/* simple element operations */
81struct cdnr_add_element {
82 struct cdnr_interface iface;
83 struct tc_action action;
84
85 u_long cdnr_handle; /* return value */
86};
87
88struct cdnr_delete_element {
89 struct cdnr_interface iface;
90 u_long cdnr_handle;
91};
92
93/* token-bucket meter operations */
94struct cdnr_add_tbmeter {
95 struct cdnr_interface iface;
96 struct tb_profile profile;
97 struct tc_action in_action;
98 struct tc_action out_action;
99
100 u_long cdnr_handle; /* return value */
101};
102
103struct cdnr_modify_tbmeter {
104 struct cdnr_interface iface;
105 u_long cdnr_handle;
106 struct tb_profile profile;
107};
108
109struct cdnr_tbmeter_stats {
110 struct cdnr_interface iface;
111 u_long cdnr_handle;
112 struct pktcntr in_cnt;
113 struct pktcntr out_cnt;
114};
115
116/* two-rate three-color marker operations */
117struct cdnr_add_trtcm {
118 struct cdnr_interface iface;
119 struct tb_profile cmtd_profile; /* profile for committed tb */
120 struct tb_profile peak_profile; /* profile for peak tb */
121 struct tc_action green_action; /* action for green packets */
122 struct tc_action yellow_action; /* action for yellow packets */
123 struct tc_action red_action; /* action for red packets */
124 int coloraware; /* color-aware/color-blind */
125
126 u_long cdnr_handle; /* return value */
127};
128
129struct cdnr_modify_trtcm {
130 struct cdnr_interface iface;
131 u_long cdnr_handle;
132 struct tb_profile cmtd_profile; /* profile for committed tb */
133 struct tb_profile peak_profile; /* profile for peak tb */
134 int coloraware; /* color-aware/color-blind */
135};
136
137struct cdnr_tcm_stats {
138 struct cdnr_interface iface;
139 u_long cdnr_handle;
140 struct pktcntr green_cnt;
141 struct pktcntr yellow_cnt;
142 struct pktcntr red_cnt;
143};
144
145/* time sliding window three-color marker operations */
146struct cdnr_add_tswtcm {
147 struct cdnr_interface iface;
148 u_int32_t cmtd_rate; /* committed rate (bits/sec) */
149 u_int32_t peak_rate; /* peak rate (bits/sec) */
150 u_int32_t avg_interval; /* averaging interval (msec) */
151 struct tc_action green_action; /* action for green packets */
152 struct tc_action yellow_action; /* action for yellow packets */
153 struct tc_action red_action; /* action for red packets */
154
155 u_long cdnr_handle; /* return value */
156};
157
158struct cdnr_modify_tswtcm {
159 struct cdnr_interface iface;
160 u_long cdnr_handle;
161 u_int32_t cmtd_rate; /* committed rate (bits/sec) */
162 u_int32_t peak_rate; /* peak rate (bits/sec) */
163 u_int32_t avg_interval; /* averaging interval (msec) */
164};
165
166struct cdnr_add_filter {
167 struct cdnr_interface iface;
168 u_long cdnr_handle;
169#ifdef ALTQ3_CLFIER_COMPAT
170 struct flow_filter filter;
171#endif
172 u_long filter_handle; /* return value */
173};
174
175struct cdnr_delete_filter {
176 struct cdnr_interface iface;
177 u_long filter_handle;
178};
179
180struct tce_stats {
181 u_long tce_handle; /* tc element handle */
182 int tce_type; /* e.g., TCETYPE_ELEMENT */
183 struct pktcntr tce_cnts[3]; /* tcm returns 3 counters */
184};
185
186struct cdnr_get_stats {
187 struct cdnr_interface iface;
188 struct pktcntr cnts[TCACODE_MAX+1];
189
190 /* element stats */
191 int nskip; /* skip # of elements */
192 int nelements; /* # of element stats (WR) */
193 struct tce_stats *tce_stats; /* pointer to stats array */
194};
195
196#define CDNR_IF_ATTACH _IOW('Q', 1, struct cdnr_interface)
197#define CDNR_IF_DETACH _IOW('Q', 2, struct cdnr_interface)
198#define CDNR_ENABLE _IOW('Q', 3, struct cdnr_interface)
199#define CDNR_DISABLE _IOW('Q', 4, struct cdnr_interface)
200#define CDNR_ADD_FILTER _IOWR('Q', 10, struct cdnr_add_filter)
201#define CDNR_DEL_FILTER _IOW('Q', 11, struct cdnr_delete_filter)
202#define CDNR_GETSTATS _IOWR('Q', 12, struct cdnr_get_stats)
203#define CDNR_ADD_ELEM _IOWR('Q', 30, struct cdnr_add_element)
204#define CDNR_DEL_ELEM _IOW('Q', 31, struct cdnr_delete_element)
205#define CDNR_ADD_TBM _IOWR('Q', 32, struct cdnr_add_tbmeter)
206#define CDNR_MOD_TBM _IOW('Q', 33, struct cdnr_modify_tbmeter)
207#define CDNR_TBM_STATS _IOWR('Q', 34, struct cdnr_tbmeter_stats)
208#define CDNR_ADD_TCM _IOWR('Q', 35, struct cdnr_add_trtcm)
209#define CDNR_MOD_TCM _IOWR('Q', 36, struct cdnr_modify_trtcm)
210#define CDNR_TCM_STATS _IOWR('Q', 37, struct cdnr_tcm_stats)
211#define CDNR_ADD_TSW _IOWR('Q', 38, struct cdnr_add_tswtcm)
212#define CDNR_MOD_TSW _IOWR('Q', 39, struct cdnr_modify_tswtcm)
213
214#ifndef DSCP_EF
215/* diffserve code points */
216#define DSCP_MASK 0xfc
217#define DSCP_CUMASK 0x03
218#define DSCP_EF 0xb8
219#define DSCP_AF11 0x28
220#define DSCP_AF12 0x30
221#define DSCP_AF13 0x38
222#define DSCP_AF21 0x48
223#define DSCP_AF22 0x50
224#define DSCP_AF23 0x58
225#define DSCP_AF31 0x68
226#define DSCP_AF32 0x70
227#define DSCP_AF33 0x78
228#define DSCP_AF41 0x88
229#define DSCP_AF42 0x90
230#define DSCP_AF43 0x98
231#define AF_CLASSMASK 0xe0
232#define AF_DROPPRECMASK 0x18
233#endif
234
235#ifdef _KERNEL
236
237/*
238 * packet information passed to the input function of tc elements
239 */
240struct cdnr_pktinfo {
241 int pkt_len; /* packet length */
242 u_int8_t pkt_dscp; /* diffserv code point */
243};
244
245/*
246 * traffic conditioner control block common to all types of tc elements
247 */
248struct cdnr_block {
249 LIST_ENTRY(cdnr_block) cb_next;
250 int cb_len; /* size of this tc element */
251 int cb_type; /* cdnr block type */
252 int cb_ref; /* reference count of this element */
253 u_long cb_handle; /* handle of this tc element */
254 struct top_cdnr *cb_top; /* back pointer to top */
255 struct tc_action cb_action; /* top level action for this tcb */
256 struct tc_action *(*cb_input)(struct cdnr_block *,
257 struct cdnr_pktinfo *);
258};
259
260/*
261 * top level traffic conditioner structure for an interface
262 */
263struct top_cdnr {
264 struct cdnr_block tc_block;
265
266 LIST_ENTRY(top_cdnr) tc_next;
267 struct ifaltq *tc_ifq;
268
269 LIST_HEAD(, cdnr_block) tc_elements;
270#ifdef ALTQ3_CLFIER_COMPAT
271 struct acc_classifier tc_classifier;
272#endif
273 struct pktcntr tc_cnts[TCACODE_MAX+1];
274};
275
276/* token bucket element */
277struct tbe {
278 u_int64_t rate;
279 u_int64_t depth;
280
281 u_int64_t token;
282 u_int64_t filluptime;
283 u_int64_t last;
284};
285
286/* token bucket meter structure */
287struct tbmeter {
288 struct cdnr_block cdnrblk; /* conditioner block */
289 struct tbe tb; /* token bucket */
290 struct tc_action in_action; /* actions for IN/OUT */
291 struct tc_action out_action; /* actions for IN/OUT */
292 struct pktcntr in_cnt; /* statistics for IN/OUT */
293 struct pktcntr out_cnt; /* statistics for IN/OUT */
294};
295
296/* two-rate three-color marker structure */
297struct trtcm {
298 struct cdnr_block cdnrblk; /* conditioner block */
299 struct tbe cmtd_tb; /* committed tb profile */
300 struct tbe peak_tb; /* peak tb profile */
301 struct tc_action green_action;
302 struct tc_action yellow_action;
303 struct tc_action red_action;
304 int coloraware;
305 u_int8_t green_dscp;
306 u_int8_t yellow_dscp;
307 u_int8_t red_dscp;
308 struct pktcntr green_cnt;
309 struct pktcntr yellow_cnt;
310 struct pktcntr red_cnt;
311};
312
313/* time sliding window three-color marker structure */
314struct tswtcm {
315 struct cdnr_block cdnrblk; /* conditioner block */
316
317 u_int32_t avg_rate; /* average rate (bytes/sec) */
318 u_int64_t t_front; /* timestamp of last update */
319
320 u_int64_t timewin; /* average interval */
321 u_int32_t cmtd_rate; /* committed target rate */
322 u_int32_t peak_rate; /* peak target rate */
323 struct tc_action green_action;
324 struct tc_action yellow_action;
325 struct tc_action red_action;
326 u_int8_t green_dscp;
327 u_int8_t yellow_dscp;
328 u_int8_t red_dscp;
329 struct pktcntr green_cnt;
330 struct pktcntr yellow_cnt;
331 struct pktcntr red_cnt;
332};
333
334#endif /* _KERNEL */
335
336#endif /* _ALTQ_ALTQ_CDNR_H_ */