No empty .Rs/.Re
[netbsd-mini2440.git] / sys / altq / altq_priq.h
blob5cf3e2a0b5481eadb4ce2ce3b99509b40b7c6cc3
1 /* $NetBSD: altq_priq.h,v 1.6.12.1 2006/03/18 12:08:18 peter Exp $ */
2 /* $KAME: altq_priq.h,v 1.7 2003/10/03 05:05:15 kjc Exp $ */
3 /*
4 * Copyright (C) 2000-2003
5 * Sony Computer Science Laboratories Inc. All rights reserved.
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.
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.
29 #ifndef _ALTQ_ALTQ_PRIQ_H_
30 #define _ALTQ_ALTQ_PRIQ_H_
32 #include <altq/altq.h>
33 #include <altq/altq_classq.h>
34 #include <altq/altq_red.h>
35 #include <altq/altq_rio.h>
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
41 #define PRIQ_MAXPRI 16 /* upper limit of the number of priorities */
43 #ifdef ALTQ3_COMPAT
44 struct priq_interface {
45 char ifname[IFNAMSIZ]; /* interface name (e.g., fxp0) */
46 u_long arg; /* request-specific argument */
49 struct priq_add_class {
50 struct priq_interface iface;
51 int pri; /* priority (0 is the lowest) */
52 int qlimit; /* queue size limit */
53 int flags; /* misc flags (see below) */
55 u_int32_t class_handle; /* return value */
57 #endif /* ALTQ3_COMPAT */
59 /* priq class flags */
60 #define PRCF_RED 0x0001 /* use RED */
61 #define PRCF_ECN 0x0002 /* use RED/ECN */
62 #define PRCF_RIO 0x0004 /* use RIO */
63 #define PRCF_CLEARDSCP 0x0010 /* clear diffserv codepoint */
64 #define PRCF_DEFAULTCLASS 0x1000 /* default class */
66 /* special class handles */
67 #define PRIQ_NULLCLASS_HANDLE 0
69 #ifdef ALTQ3_COMPAT
70 struct priq_delete_class {
71 struct priq_interface iface;
72 u_int32_t class_handle;
75 struct priq_modify_class {
76 struct priq_interface iface;
77 u_int32_t class_handle;
78 int pri;
79 int qlimit;
80 int flags;
83 struct priq_add_filter {
84 struct priq_interface iface;
85 u_int32_t class_handle;
86 struct flow_filter filter;
88 u_long filter_handle; /* return value */
91 struct priq_delete_filter {
92 struct priq_interface iface;
93 u_long filter_handle;
95 #endif /* ALTQ3_COMPAT */
97 struct priq_classstats {
98 u_int32_t class_handle;
100 u_int qlength;
101 u_int qlimit;
102 u_int period;
103 struct pktcntr xmitcnt; /* transmitted packet counter */
104 struct pktcntr dropcnt; /* dropped packet counter */
106 /* red and rio related info */
107 int qtype;
108 struct redstats red[3]; /* rio has 3 red stats */
111 #ifdef ALTQ3_COMPAT
112 struct priq_class_stats {
113 struct priq_interface iface;
114 int maxpri; /* in/out */
116 struct priq_classstats *stats; /* pointer to stats array */
119 #define PRIQ_IF_ATTACH _IOW('Q', 1, struct priq_interface)
120 #define PRIQ_IF_DETACH _IOW('Q', 2, struct priq_interface)
121 #define PRIQ_ENABLE _IOW('Q', 3, struct priq_interface)
122 #define PRIQ_DISABLE _IOW('Q', 4, struct priq_interface)
123 #define PRIQ_CLEAR _IOW('Q', 5, struct priq_interface)
124 #define PRIQ_ADD_CLASS _IOWR('Q', 7, struct priq_add_class)
125 #define PRIQ_DEL_CLASS _IOW('Q', 8, struct priq_delete_class)
126 #define PRIQ_MOD_CLASS _IOW('Q', 9, struct priq_modify_class)
127 #define PRIQ_ADD_FILTER _IOWR('Q', 10, struct priq_add_filter)
128 #define PRIQ_DEL_FILTER _IOW('Q', 11, struct priq_delete_filter)
129 #define PRIQ_GETSTATS _IOWR('Q', 12, struct priq_class_stats)
131 #endif /* ALTQ3_COMPAT */
133 #ifdef _KERNEL
135 struct priq_class {
136 u_int32_t cl_handle; /* class handle */
137 class_queue_t *cl_q; /* class queue structure */
138 struct red *cl_red; /* RED state */
139 int cl_pri; /* priority */
140 int cl_flags; /* class flags */
141 struct priq_if *cl_pif; /* back pointer to pif */
142 struct altq_pktattr *cl_pktattr; /* saved header used by ECN */
144 /* statistics */
145 u_int cl_period; /* backlog period */
146 struct pktcntr cl_xmitcnt; /* transmitted packet counter */
147 struct pktcntr cl_dropcnt; /* dropped packet counter */
151 * priq interface state
153 struct priq_if {
154 struct priq_if *pif_next; /* interface state list */
155 struct ifaltq *pif_ifq; /* backpointer to ifaltq */
156 u_int pif_bandwidth; /* link bandwidth in bps */
157 int pif_maxpri; /* max priority in use */
158 struct priq_class *pif_default; /* default class */
159 struct priq_class *pif_classes[PRIQ_MAXPRI]; /* classes */
160 #ifdef ALTQ3_CLFIER_COMPAT
161 struct acc_classifier pif_classifier; /* classifier */
162 #endif
165 #endif /* _KERNEL */
167 #ifdef __cplusplus
169 #endif
171 #endif /* _ALTQ_ALTQ_PRIQ_H_ */