1 /* $NetBSD: altq_flowvalve.h,v 1.2.64.1 2006/03/18 12:08:18 peter Exp $ */
2 /* $KAME: altq_flowvalve.h,v 1.5 2002/04/03 05:38:50 kjc Exp $ */
5 * Copyright (C) 1998-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_FLOWVALVE_H_
31 #define _ALTQ_ALTQ_FLOWVALVE_H_
35 /* fv_flow structure to define a unique address pair */
37 int flow_af
; /* address family */
40 struct in_addr ip_src
;
41 struct in_addr ip_dst
;
45 struct in6_addr ip6_src
;
46 struct in6_addr ip6_dst
;
52 #define flow_ip flow_un._ip
53 #define flow_ip6 flow_un._ip6
57 TAILQ_ENTRY(fve
) fve_lru
; /* for LRU list */
59 enum fv_state
{ Green
, Red
} fve_state
;
61 int fve_p
; /* scaled average drop rate */
62 int fve_f
; /* scaled average fraction */
63 int fve_count
; /* counter to update f */
64 u_int fve_ifseq
; /* ifseq at the last update of f */
65 struct timeval fve_lastdrop
; /* timestamp of the last drop */
67 struct fv_flow fve_flow
; /* unique address pair */
70 /* flowvalve structure */
72 u_int fv_ifseq
; /* packet sequence number */
73 int fv_flows
; /* number of valid flows in the flowlist */
74 int fv_pthresh
; /* drop rate threshold */
76 TAILQ_HEAD(fv_flowhead
, fve
) fv_flowlist
; /* LRU list */
78 struct fve
*fv_fves
; /* pointer to the allocated fves */
80 int *fv_p2ftab
; /* drop rate to fraction table */
83 u_int pass
; /* # of packets that have the fve
84 but aren't predropped */
85 u_int predrop
; /* # of packets predropped */
86 u_int alloc
; /* # of fves assigned */
87 u_int escape
; /* # of fves escaped */
93 #endif /* _ALTQ_ALTQ_FLOWVALVE_H_ */