1 /* $NetBSD: altq_blue.h,v 1.4.12.1 2006/03/18 12:08:18 peter Exp $ */
2 /* $KAME: altq_blue.h,v 1.7 2002/11/29 04:36:22 kjc Exp $ */
5 * Copyright (C) 1997-2002
6 * Sony Computer Science Laboratories Inc. All rights reserved.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY SONY CSL AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL SONY CSL OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 #ifndef _ALTQ_ALTQ_BLUE_H_
31 #define _ALTQ_ALTQ_BLUE_H_
33 #include <altq/altq_classq.h>
35 struct blue_interface
{
36 char blue_ifname
[IFNAMSIZ
];
40 struct blue_interface iface
;
44 u_quad_t xmit_packets
;
46 u_quad_t drop_packets
;
49 u_quad_t drop_unforced
;
50 u_quad_t marked_packets
;
54 struct blue_interface iface
;
58 int blue_pkttime
; /* average packet time in usec */
59 int blue_flags
; /* see below */
63 #define BLUEF_ECN4 0x01 /* use packet marking for IPv4 packets */
64 #define BLUEF_ECN6 0x02 /* use packet marking for IPv6 packets */
65 #define BLUEF_ECN (BLUEF_ECN4 | BLUEF_ECN6)
70 #define BLUE_IF_ATTACH _IOW('Q', 1, struct blue_interface)
71 #define BLUE_IF_DETACH _IOW('Q', 2, struct blue_interface)
72 #define BLUE_ENABLE _IOW('Q', 3, struct blue_interface)
73 #define BLUE_DISABLE _IOW('Q', 4, struct blue_interface)
74 #define BLUE_CONFIG _IOWR('Q', 6, struct blue_conf)
75 #define BLUE_GETSTATS _IOWR('Q', 12, struct blue_stats)
80 int blue_pkttime
; /* average packet time in micro sec
81 used for idle calibration */
82 int blue_flags
; /* blue flags */
85 int blue_pmark
; /* 0-1000 (mark probability*10000) */
86 int blue_max_pmark
; /* sets precision of marking probability */
87 int blue_hold_time
; /* hold time in usec */
89 int blue_idle
; /* queue was empty */
90 struct timeval blue_last
; /* timestamp when the queue becomes idle */
93 u_quad_t xmit_packets
;
95 u_quad_t drop_packets
;
98 u_quad_t drop_unforced
;
99 u_quad_t marked_packets
;
103 typedef struct blue_queue
{
104 struct blue_queue
*rq_next
; /* next blue_state in the list */
105 struct ifaltq
*rq_ifq
; /* backpointer to ifaltq */
112 extern int blue_init(blue_t
*, int, int, int, int);
113 extern int blue_addq(blue_t
*, class_queue_t
*, struct mbuf
*,
114 struct altq_pktattr
*);
115 extern struct mbuf
*blue_getq(blue_t
*, class_queue_t
*);
119 #endif /* _ALTQ_ALTQ_BLUE_H_ */