xref: /freebsd/sys/net/altq/altq_cdnr.h (revision 2ff63af9)
1772e66a6SGleb Smirnoff /*-
2772e66a6SGleb Smirnoff  * Copyright (C) 1999-2002
3772e66a6SGleb Smirnoff  *	Sony Computer Science Laboratories Inc.  All rights reserved.
4772e66a6SGleb Smirnoff  *
5772e66a6SGleb Smirnoff  * Redistribution and use in source and binary forms, with or without
6772e66a6SGleb Smirnoff  * modification, are permitted provided that the following conditions
7772e66a6SGleb Smirnoff  * are met:
8772e66a6SGleb Smirnoff  * 1. Redistributions of source code must retain the above copyright
9772e66a6SGleb Smirnoff  *    notice, this list of conditions and the following disclaimer.
10772e66a6SGleb Smirnoff  * 2. Redistributions in binary form must reproduce the above copyright
11772e66a6SGleb Smirnoff  *    notice, this list of conditions and the following disclaimer in the
12772e66a6SGleb Smirnoff  *    documentation and/or other materials provided with the distribution.
13772e66a6SGleb Smirnoff  *
14772e66a6SGleb Smirnoff  * THIS SOFTWARE IS PROVIDED BY SONY CSL AND CONTRIBUTORS ``AS IS'' AND
15772e66a6SGleb Smirnoff  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16772e66a6SGleb Smirnoff  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17772e66a6SGleb Smirnoff  * ARE DISCLAIMED.  IN NO EVENT SHALL SONY CSL OR CONTRIBUTORS BE LIABLE
18772e66a6SGleb Smirnoff  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19772e66a6SGleb Smirnoff  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20772e66a6SGleb Smirnoff  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21772e66a6SGleb Smirnoff  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22772e66a6SGleb Smirnoff  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23772e66a6SGleb Smirnoff  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24772e66a6SGleb Smirnoff  * SUCH DAMAGE.
25772e66a6SGleb Smirnoff  *
26772e66a6SGleb Smirnoff  * $KAME: altq_cdnr.h,v 1.9 2003/07/10 12:07:48 kjc Exp $
27772e66a6SGleb Smirnoff  */
28772e66a6SGleb Smirnoff 
29772e66a6SGleb Smirnoff #ifndef _ALTQ_ALTQ_CDNR_H_
30772e66a6SGleb Smirnoff #define	_ALTQ_ALTQ_CDNR_H_
31772e66a6SGleb Smirnoff 
32772e66a6SGleb Smirnoff #include <net/altq/altq.h>
33772e66a6SGleb Smirnoff 
34772e66a6SGleb Smirnoff /*
35772e66a6SGleb Smirnoff  * traffic conditioner element types
36772e66a6SGleb Smirnoff  */
37772e66a6SGleb Smirnoff #define	TCETYPE_NONE		0
38772e66a6SGleb Smirnoff #define	TCETYPE_TOP		1	/* top level conditioner */
39772e66a6SGleb Smirnoff #define	TCETYPE_ELEMENT		2	/* a simple tc element */
40772e66a6SGleb Smirnoff #define	TCETYPE_TBMETER		3	/* token bucket meter */
41772e66a6SGleb Smirnoff #define	TCETYPE_TRTCM		4	/* (two-rate) three color marker */
42772e66a6SGleb Smirnoff #define	TCETYPE_TSWTCM		5	/* time sliding window 3-color maker */
43772e66a6SGleb Smirnoff 
44772e66a6SGleb Smirnoff /*
45772e66a6SGleb Smirnoff  * traffic conditioner action
46772e66a6SGleb Smirnoff  */
47772e66a6SGleb Smirnoff struct cdnr_block;
48772e66a6SGleb Smirnoff 
49772e66a6SGleb Smirnoff struct tc_action {
50772e66a6SGleb Smirnoff 	int	tca_code;	/* e.g., TCACODE_PASS */
51772e66a6SGleb Smirnoff 	/* tca_code dependent variable */
52772e66a6SGleb Smirnoff 	union {
53772e66a6SGleb Smirnoff 		u_long		un_value;	/* template */
54772e66a6SGleb Smirnoff 		u_int8_t	un_dscp;	/* diffserv code point */
55772e66a6SGleb Smirnoff 		u_long		un_handle;	/* tc action handle */
56772e66a6SGleb Smirnoff 		struct cdnr_block *un_next;	/* next tc element block */
57772e66a6SGleb Smirnoff 	} tca_un;
58772e66a6SGleb Smirnoff };
59772e66a6SGleb Smirnoff #define	tca_value	tca_un.un_value
60772e66a6SGleb Smirnoff #define	tca_dscp	tca_un.un_dscp
61772e66a6SGleb Smirnoff #define	tca_handle	tca_un.un_handle
62772e66a6SGleb Smirnoff #define	tca_next	tca_un.un_next
63772e66a6SGleb Smirnoff 
64772e66a6SGleb Smirnoff #define	TCACODE_NONE	0	/* action is not set */
65772e66a6SGleb Smirnoff #define	TCACODE_PASS	1 	/* pass this packet */
66772e66a6SGleb Smirnoff #define	TCACODE_DROP	2	/* discard this packet */
67772e66a6SGleb Smirnoff #define	TCACODE_RETURN	3	/* do not process this packet */
68772e66a6SGleb Smirnoff #define	TCACODE_MARK	4	/* mark dscp */
69772e66a6SGleb Smirnoff #define	TCACODE_HANDLE	5	/* take action specified by handle */
70772e66a6SGleb Smirnoff #define	TCACODE_NEXT	6	/* take action in the next tc element */
71772e66a6SGleb Smirnoff #define	TCACODE_MAX	6
72772e66a6SGleb Smirnoff 
73772e66a6SGleb Smirnoff #define	CDNR_NULL_HANDLE	0
74772e66a6SGleb Smirnoff 
75772e66a6SGleb Smirnoff struct cdnr_interface {
76772e66a6SGleb Smirnoff 	char	cdnr_ifname[IFNAMSIZ];  /* interface name (e.g., fxp0) */
77772e66a6SGleb Smirnoff };
78772e66a6SGleb Smirnoff 
79772e66a6SGleb Smirnoff /* simple element operations */
80772e66a6SGleb Smirnoff struct cdnr_add_element {
81772e66a6SGleb Smirnoff 	struct cdnr_interface	iface;
82772e66a6SGleb Smirnoff 	struct tc_action	action;
83772e66a6SGleb Smirnoff 
84772e66a6SGleb Smirnoff 	u_long			cdnr_handle;	/* return value */
85772e66a6SGleb Smirnoff };
86772e66a6SGleb Smirnoff 
87772e66a6SGleb Smirnoff struct cdnr_delete_element {
88772e66a6SGleb Smirnoff 	struct cdnr_interface	iface;
89772e66a6SGleb Smirnoff 	u_long			cdnr_handle;
90772e66a6SGleb Smirnoff };
91772e66a6SGleb Smirnoff 
92772e66a6SGleb Smirnoff /* token-bucket meter operations */
93772e66a6SGleb Smirnoff struct cdnr_add_tbmeter {
94772e66a6SGleb Smirnoff 	struct cdnr_interface	iface;
95772e66a6SGleb Smirnoff 	struct tb_profile	profile;
96772e66a6SGleb Smirnoff 	struct tc_action	in_action;
97772e66a6SGleb Smirnoff 	struct tc_action	out_action;
98772e66a6SGleb Smirnoff 
99772e66a6SGleb Smirnoff 	u_long			cdnr_handle;	/* return value */
100772e66a6SGleb Smirnoff };
101772e66a6SGleb Smirnoff 
102772e66a6SGleb Smirnoff struct cdnr_modify_tbmeter {
103772e66a6SGleb Smirnoff 	struct cdnr_interface	iface;
104772e66a6SGleb Smirnoff 	u_long			cdnr_handle;
105772e66a6SGleb Smirnoff 	struct tb_profile	profile;
106772e66a6SGleb Smirnoff };
107772e66a6SGleb Smirnoff 
108772e66a6SGleb Smirnoff struct cdnr_tbmeter_stats {
109772e66a6SGleb Smirnoff 	struct cdnr_interface	iface;
110772e66a6SGleb Smirnoff 	u_long			cdnr_handle;
111772e66a6SGleb Smirnoff 	struct pktcntr		in_cnt;
112772e66a6SGleb Smirnoff 	struct pktcntr		out_cnt;
113772e66a6SGleb Smirnoff };
114772e66a6SGleb Smirnoff 
115772e66a6SGleb Smirnoff /* two-rate three-color marker operations */
116772e66a6SGleb Smirnoff struct cdnr_add_trtcm {
117772e66a6SGleb Smirnoff 	struct cdnr_interface	iface;
118772e66a6SGleb Smirnoff 	struct tb_profile	cmtd_profile;	/* profile for committed tb */
119772e66a6SGleb Smirnoff 	struct tb_profile	peak_profile;	/* profile for peak tb */
120772e66a6SGleb Smirnoff 	struct tc_action	green_action;	/* action for green packets */
121772e66a6SGleb Smirnoff 	struct tc_action	yellow_action;	/* action for yellow packets */
122772e66a6SGleb Smirnoff 	struct tc_action	red_action;	/* action for red packets */
123772e66a6SGleb Smirnoff 	int			coloraware;	/* color-aware/color-blind */
124772e66a6SGleb Smirnoff 
125772e66a6SGleb Smirnoff 	u_long			cdnr_handle;	/* return value */
126772e66a6SGleb Smirnoff };
127772e66a6SGleb Smirnoff 
128772e66a6SGleb Smirnoff struct cdnr_modify_trtcm {
129772e66a6SGleb Smirnoff 	struct cdnr_interface	iface;
130772e66a6SGleb Smirnoff 	u_long			cdnr_handle;
131772e66a6SGleb Smirnoff 	struct tb_profile	cmtd_profile;	/* profile for committed tb */
132772e66a6SGleb Smirnoff 	struct tb_profile	peak_profile;	/* profile for peak tb */
133772e66a6SGleb Smirnoff 	int			coloraware;	/* color-aware/color-blind */
134772e66a6SGleb Smirnoff };
135772e66a6SGleb Smirnoff 
136772e66a6SGleb Smirnoff struct cdnr_tcm_stats {
137772e66a6SGleb Smirnoff 	struct cdnr_interface	iface;
138772e66a6SGleb Smirnoff 	u_long			cdnr_handle;
139772e66a6SGleb Smirnoff 	struct pktcntr		green_cnt;
140772e66a6SGleb Smirnoff 	struct pktcntr		yellow_cnt;
141772e66a6SGleb Smirnoff 	struct pktcntr		red_cnt;
142772e66a6SGleb Smirnoff };
143772e66a6SGleb Smirnoff 
144772e66a6SGleb Smirnoff /* time sliding window three-color marker operations */
145772e66a6SGleb Smirnoff struct cdnr_add_tswtcm {
146772e66a6SGleb Smirnoff 	struct cdnr_interface	iface;
147772e66a6SGleb Smirnoff 	u_int32_t		cmtd_rate;	/* committed rate (bits/sec) */
148772e66a6SGleb Smirnoff 	u_int32_t		peak_rate;	/* peak rate (bits/sec) */
149772e66a6SGleb Smirnoff 	u_int32_t		avg_interval;	/* averaging interval (msec) */
150772e66a6SGleb Smirnoff 	struct tc_action	green_action;	/* action for green packets */
151772e66a6SGleb Smirnoff 	struct tc_action	yellow_action;	/* action for yellow packets */
152772e66a6SGleb Smirnoff 	struct tc_action	red_action;	/* action for red packets */
153772e66a6SGleb Smirnoff 
154772e66a6SGleb Smirnoff 	u_long			cdnr_handle;	/* return value */
155772e66a6SGleb Smirnoff };
156772e66a6SGleb Smirnoff 
157772e66a6SGleb Smirnoff struct cdnr_modify_tswtcm {
158772e66a6SGleb Smirnoff 	struct cdnr_interface	iface;
159772e66a6SGleb Smirnoff 	u_long			cdnr_handle;
160772e66a6SGleb Smirnoff 	u_int32_t		cmtd_rate;	/* committed rate (bits/sec) */
161772e66a6SGleb Smirnoff 	u_int32_t		peak_rate;	/* peak rate (bits/sec) */
162772e66a6SGleb Smirnoff 	u_int32_t		avg_interval;	/* averaging interval (msec) */
163772e66a6SGleb Smirnoff };
164772e66a6SGleb Smirnoff 
165772e66a6SGleb Smirnoff struct cdnr_add_filter {
166772e66a6SGleb Smirnoff 	struct cdnr_interface	iface;
167772e66a6SGleb Smirnoff 	u_long			cdnr_handle;
168772e66a6SGleb Smirnoff #ifdef ALTQ3_CLFIER_COMPAT
169772e66a6SGleb Smirnoff 	struct flow_filter	filter;
170772e66a6SGleb Smirnoff #endif
171772e66a6SGleb Smirnoff 	u_long			filter_handle;	/* return value */
172772e66a6SGleb Smirnoff };
173772e66a6SGleb Smirnoff 
174772e66a6SGleb Smirnoff struct cdnr_delete_filter {
175772e66a6SGleb Smirnoff 	struct cdnr_interface	iface;
176772e66a6SGleb Smirnoff 	u_long			filter_handle;
177772e66a6SGleb Smirnoff };
178772e66a6SGleb Smirnoff 
179772e66a6SGleb Smirnoff struct tce_stats {
180772e66a6SGleb Smirnoff 	u_long			tce_handle;	/* tc element handle */
181772e66a6SGleb Smirnoff 	int			tce_type;	/* e.g., TCETYPE_ELEMENT */
182772e66a6SGleb Smirnoff 	struct pktcntr		tce_cnts[3];	/* tcm returns 3 counters */
183772e66a6SGleb Smirnoff };
184772e66a6SGleb Smirnoff 
185772e66a6SGleb Smirnoff struct cdnr_get_stats {
186772e66a6SGleb Smirnoff 	struct cdnr_interface	iface;
187772e66a6SGleb Smirnoff 	struct pktcntr		cnts[TCACODE_MAX+1];
188772e66a6SGleb Smirnoff 
189772e66a6SGleb Smirnoff 	/* element stats */
190772e66a6SGleb Smirnoff 	int			nskip;		/* skip # of elements */
191772e66a6SGleb Smirnoff 	int			nelements;	/* # of element stats (WR) */
192772e66a6SGleb Smirnoff 	struct tce_stats	*tce_stats;	/* pointer to stats array */
193772e66a6SGleb Smirnoff };
194772e66a6SGleb Smirnoff 
195772e66a6SGleb Smirnoff #define	CDNR_IF_ATTACH		_IOW('Q', 1, struct cdnr_interface)
196772e66a6SGleb Smirnoff #define	CDNR_IF_DETACH		_IOW('Q', 2, struct cdnr_interface)
197772e66a6SGleb Smirnoff #define	CDNR_ENABLE		_IOW('Q', 3, struct cdnr_interface)
198772e66a6SGleb Smirnoff #define	CDNR_DISABLE		_IOW('Q', 4, struct cdnr_interface)
199772e66a6SGleb Smirnoff #define	CDNR_ADD_FILTER		_IOWR('Q', 10, struct cdnr_add_filter)
200772e66a6SGleb Smirnoff #define	CDNR_DEL_FILTER		_IOW('Q', 11, struct cdnr_delete_filter)
201772e66a6SGleb Smirnoff #define	CDNR_GETSTATS		_IOWR('Q', 12, struct cdnr_get_stats)
202772e66a6SGleb Smirnoff #define	CDNR_ADD_ELEM		_IOWR('Q', 30, struct cdnr_add_element)
203772e66a6SGleb Smirnoff #define	CDNR_DEL_ELEM		_IOW('Q', 31, struct cdnr_delete_element)
204772e66a6SGleb Smirnoff #define	CDNR_ADD_TBM		_IOWR('Q', 32, struct cdnr_add_tbmeter)
205772e66a6SGleb Smirnoff #define	CDNR_MOD_TBM		_IOW('Q', 33, struct cdnr_modify_tbmeter)
206772e66a6SGleb Smirnoff #define	CDNR_TBM_STATS		_IOWR('Q', 34, struct cdnr_tbmeter_stats)
207772e66a6SGleb Smirnoff #define	CDNR_ADD_TCM		_IOWR('Q', 35, struct cdnr_add_trtcm)
208772e66a6SGleb Smirnoff #define	CDNR_MOD_TCM		_IOWR('Q', 36, struct cdnr_modify_trtcm)
209772e66a6SGleb Smirnoff #define	CDNR_TCM_STATS		_IOWR('Q', 37, struct cdnr_tcm_stats)
210772e66a6SGleb Smirnoff #define	CDNR_ADD_TSW		_IOWR('Q', 38, struct cdnr_add_tswtcm)
211772e66a6SGleb Smirnoff #define	CDNR_MOD_TSW		_IOWR('Q', 39, struct cdnr_modify_tswtcm)
212772e66a6SGleb Smirnoff 
213772e66a6SGleb Smirnoff #ifndef DSCP_EF
214772e66a6SGleb Smirnoff /* diffserve code points */
215772e66a6SGleb Smirnoff #define	DSCP_MASK	0xfc
216772e66a6SGleb Smirnoff #define	DSCP_CUMASK	0x03
217772e66a6SGleb Smirnoff #define	DSCP_EF		0xb8
218772e66a6SGleb Smirnoff #define	DSCP_AF11	0x28
219772e66a6SGleb Smirnoff #define	DSCP_AF12	0x30
220772e66a6SGleb Smirnoff #define	DSCP_AF13	0x38
221772e66a6SGleb Smirnoff #define	DSCP_AF21	0x48
222772e66a6SGleb Smirnoff #define	DSCP_AF22	0x50
223772e66a6SGleb Smirnoff #define	DSCP_AF23	0x58
224772e66a6SGleb Smirnoff #define	DSCP_AF31	0x68
225772e66a6SGleb Smirnoff #define	DSCP_AF32	0x70
226772e66a6SGleb Smirnoff #define	DSCP_AF33	0x78
227772e66a6SGleb Smirnoff #define	DSCP_AF41	0x88
228772e66a6SGleb Smirnoff #define	DSCP_AF42	0x90
229772e66a6SGleb Smirnoff #define	DSCP_AF43	0x98
230772e66a6SGleb Smirnoff #define	AF_CLASSMASK		0xe0
231772e66a6SGleb Smirnoff #define	AF_DROPPRECMASK		0x18
232772e66a6SGleb Smirnoff #endif
233772e66a6SGleb Smirnoff 
234772e66a6SGleb Smirnoff #ifdef _KERNEL
235772e66a6SGleb Smirnoff 
236772e66a6SGleb Smirnoff /*
237772e66a6SGleb Smirnoff  * packet information passed to the input function of tc elements
238772e66a6SGleb Smirnoff  */
239772e66a6SGleb Smirnoff struct cdnr_pktinfo {
240772e66a6SGleb Smirnoff 	int		pkt_len;	/* packet length */
241772e66a6SGleb Smirnoff 	u_int8_t	pkt_dscp;	/* diffserv code point */
242772e66a6SGleb Smirnoff };
243772e66a6SGleb Smirnoff 
244772e66a6SGleb Smirnoff /*
245772e66a6SGleb Smirnoff  * traffic conditioner control block common to all types of tc elements
246772e66a6SGleb Smirnoff  */
247772e66a6SGleb Smirnoff struct cdnr_block {
248772e66a6SGleb Smirnoff 	LIST_ENTRY(cdnr_block)	cb_next;
249772e66a6SGleb Smirnoff 	int		cb_len;		/* size of this tc element */
250772e66a6SGleb Smirnoff 	int		cb_type;	/* cdnr block type */
251772e66a6SGleb Smirnoff 	int		cb_ref;		/* reference count of this element */
252772e66a6SGleb Smirnoff 	u_long		cb_handle;	/* handle of this tc element */
253772e66a6SGleb Smirnoff 	struct top_cdnr *cb_top;	/* back pointer to top */
254772e66a6SGleb Smirnoff 	struct tc_action cb_action;	/* top level action for this tcb */
255772e66a6SGleb Smirnoff 	struct tc_action *(*cb_input)(struct cdnr_block *,
256772e66a6SGleb Smirnoff 				      struct cdnr_pktinfo *);
257772e66a6SGleb Smirnoff };
258772e66a6SGleb Smirnoff 
259772e66a6SGleb Smirnoff /*
260772e66a6SGleb Smirnoff  * top level traffic conditioner structure for an interface
261772e66a6SGleb Smirnoff  */
262772e66a6SGleb Smirnoff struct top_cdnr {
263772e66a6SGleb Smirnoff 	struct cdnr_block	tc_block;
264772e66a6SGleb Smirnoff 
265772e66a6SGleb Smirnoff 	LIST_ENTRY(top_cdnr)	tc_next;
266772e66a6SGleb Smirnoff 	struct ifaltq		*tc_ifq;
267772e66a6SGleb Smirnoff 
268772e66a6SGleb Smirnoff 	LIST_HEAD(, cdnr_block) tc_elements;
269772e66a6SGleb Smirnoff #ifdef ALTQ3_CLFIER_COMPAT
270772e66a6SGleb Smirnoff 	struct acc_classifier	tc_classifier;
271772e66a6SGleb Smirnoff #endif
272772e66a6SGleb Smirnoff 	struct pktcntr		tc_cnts[TCACODE_MAX+1];
273772e66a6SGleb Smirnoff };
274772e66a6SGleb Smirnoff 
275772e66a6SGleb Smirnoff /* token bucket element */
276772e66a6SGleb Smirnoff struct tbe {
277772e66a6SGleb Smirnoff 	u_int64_t	rate;
278772e66a6SGleb Smirnoff 	u_int64_t	depth;
279772e66a6SGleb Smirnoff 
280772e66a6SGleb Smirnoff 	u_int64_t	token;
281772e66a6SGleb Smirnoff 	u_int64_t	filluptime;
282772e66a6SGleb Smirnoff 	u_int64_t	last;
283772e66a6SGleb Smirnoff };
284772e66a6SGleb Smirnoff 
285772e66a6SGleb Smirnoff /* token bucket meter structure */
286772e66a6SGleb Smirnoff struct tbmeter {
287772e66a6SGleb Smirnoff 	struct cdnr_block	cdnrblk;	/* conditioner block */
288772e66a6SGleb Smirnoff 	struct tbe		tb;		/* token bucket */
289772e66a6SGleb Smirnoff 	struct tc_action	in_action;	/* actions for IN/OUT */
290772e66a6SGleb Smirnoff 	struct tc_action	out_action;	/* actions for IN/OUT */
291772e66a6SGleb Smirnoff 	struct pktcntr		in_cnt;		/* statistics for IN/OUT */
292772e66a6SGleb Smirnoff 	struct pktcntr		out_cnt;	/* statistics for IN/OUT */
293772e66a6SGleb Smirnoff };
294772e66a6SGleb Smirnoff 
295772e66a6SGleb Smirnoff /* two-rate three-color marker structure */
296772e66a6SGleb Smirnoff struct trtcm {
297772e66a6SGleb Smirnoff 	struct cdnr_block	cdnrblk;	/* conditioner block */
298772e66a6SGleb Smirnoff 	struct tbe		cmtd_tb;	/* committed tb profile */
299772e66a6SGleb Smirnoff 	struct tbe		peak_tb;	/* peak tb profile */
300772e66a6SGleb Smirnoff 	struct tc_action	green_action;
301772e66a6SGleb Smirnoff 	struct tc_action	yellow_action;
302772e66a6SGleb Smirnoff 	struct tc_action	red_action;
303772e66a6SGleb Smirnoff 	int			coloraware;
304772e66a6SGleb Smirnoff 	u_int8_t		green_dscp;
305772e66a6SGleb Smirnoff 	u_int8_t		yellow_dscp;
306772e66a6SGleb Smirnoff 	u_int8_t		red_dscp;
307772e66a6SGleb Smirnoff 	struct pktcntr		green_cnt;
308772e66a6SGleb Smirnoff 	struct pktcntr		yellow_cnt;
309772e66a6SGleb Smirnoff 	struct pktcntr		red_cnt;
310772e66a6SGleb Smirnoff };
311772e66a6SGleb Smirnoff 
312772e66a6SGleb Smirnoff /* time sliding window three-color marker structure */
313772e66a6SGleb Smirnoff struct tswtcm {
314772e66a6SGleb Smirnoff 	struct cdnr_block	cdnrblk;	/* conditioner block */
315772e66a6SGleb Smirnoff 
316772e66a6SGleb Smirnoff 	u_int32_t		avg_rate;	/* average rate (bytes/sec) */
317772e66a6SGleb Smirnoff 	u_int64_t		t_front;	/* timestamp of last update */
318772e66a6SGleb Smirnoff 
319772e66a6SGleb Smirnoff 	u_int64_t		timewin;	/* average interval */
320772e66a6SGleb Smirnoff 	u_int32_t		cmtd_rate;	/* committed target rate */
321772e66a6SGleb Smirnoff 	u_int32_t		peak_rate;	/* peak target rate */
322772e66a6SGleb Smirnoff 	struct tc_action	green_action;
323772e66a6SGleb Smirnoff 	struct tc_action	yellow_action;
324772e66a6SGleb Smirnoff 	struct tc_action	red_action;
325772e66a6SGleb Smirnoff 	u_int8_t		green_dscp;
326772e66a6SGleb Smirnoff 	u_int8_t		yellow_dscp;
327772e66a6SGleb Smirnoff 	u_int8_t		red_dscp;
328772e66a6SGleb Smirnoff 	struct pktcntr		green_cnt;
329772e66a6SGleb Smirnoff 	struct pktcntr		yellow_cnt;
330772e66a6SGleb Smirnoff 	struct pktcntr		red_cnt;
331772e66a6SGleb Smirnoff };
332772e66a6SGleb Smirnoff 
333772e66a6SGleb Smirnoff #endif /* _KERNEL */
334772e66a6SGleb Smirnoff 
335772e66a6SGleb Smirnoff #endif /* _ALTQ_ALTQ_CDNR_H_ */
336