2 * SPDX-License-Identifier: BSD-2-Clause
4 * Copyright (c) 2001 Daniel Hartmeier
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * - Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * - Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
31 * $OpenBSD: pfvar.h,v 1.282 2009/01/29 15:12:28 pyr Exp $
35 #ifndef _NET_PF_ALTQ_H_
36 #define _NET_PF_ALTQ_H_
61 /* real-time service curve */
62 u_int rtsc_m1; /* slope of the 1st segment in bps */
63 u_int rtsc_d; /* the x-projection of m1 in msec */
64 u_int rtsc_m2; /* slope of the 2nd segment in bps */
65 /* link-sharing service curve */
69 /* upper-limit service curve */
77 /* real-time service curve */
78 u_int64_t rtsc_m1; /* slope of the 1st segment in bps */
79 u_int rtsc_d; /* the x-projection of m1 in msec */
80 u_int64_t rtsc_m2; /* slope of the 2nd segment in bps */
81 /* link-sharing service curve */
85 /* upper-limit service curve */
93 * struct hfsc_opts doesn't have a version indicator macro or
94 * backwards-compat and convenience macros because both in the kernel and
95 * the pfctl parser, there are struct hfsc_opts instances named 'hfsc_opts'.
96 * It is believed that only in-tree code uses struct hfsc_opts, so
97 * backwards-compat macros are not necessary. The few in-tree uses can just
98 * be updated to the latest versioned struct tag.
102 * XXX this needs some work
109 /* link sharing service curve */
116 * struct pf_altq_v0, struct pf_altq_v1, etc. are the ioctl argument
117 * structures corresponding to struct pfioc_altq_v0, struct pfioc_altq_v1,
122 char ifname[IFNAMSIZ];
125 * This member is a holdover from when the kernel state structure
126 * was reused as the ioctl argument structure, and remains to
127 * preserve the size and layout of this struct for backwards compat.
130 TAILQ_ENTRY(pf_altq_v0) entries;
133 uint8_t scheduler; /* scheduler type */
134 uint16_t tbrsize; /* tokenbucket regulator size */
135 uint32_t ifbandwidth; /* interface bandwidth */
138 char qname[PF_QNAME_SIZE]; /* queue name */
139 char parent[PF_QNAME_SIZE]; /* parent name */
140 uint32_t parent_qid; /* parent queue id */
141 uint32_t bandwidth; /* queue bandwidth */
142 uint8_t priority; /* priority */
143 uint8_t local_flags; /* dynamic interface */
144 #define PFALTQ_FLAG_IF_REMOVED 0x01
146 uint16_t qlimit; /* queue size limit */
147 uint16_t flags; /* misc flags */
149 struct cbq_opts cbq_opts;
150 struct codel_opts codel_opts;
151 struct priq_opts priq_opts;
152 struct hfsc_opts_v0 hfsc_opts;
153 struct fairq_opts fairq_opts;
156 uint32_t qid; /* return value */
160 char ifname[IFNAMSIZ];
162 TAILQ_ENTRY(pf_altq_v1) entries;
165 uint8_t scheduler; /* scheduler type */
166 uint32_t tbrsize; /* tokenbucket regulator size */
167 uint64_t ifbandwidth; /* interface bandwidth */
170 char qname[PF_QNAME_SIZE]; /* queue name */
171 char parent[PF_QNAME_SIZE]; /* parent name */
172 uint32_t parent_qid; /* parent queue id */
173 uint64_t bandwidth; /* queue bandwidth */
174 uint8_t priority; /* priority */
175 uint8_t local_flags; /* dynamic interface, see _v0 */
177 uint16_t qlimit; /* queue size limit */
178 uint16_t flags; /* misc flags */
180 struct cbq_opts cbq_opts;
181 struct codel_opts codel_opts;
182 struct priq_opts priq_opts;
183 struct hfsc_opts_v1 hfsc_opts;
184 struct fairq_opts fairq_opts;
187 uint32_t qid; /* return value */
190 /* Latest version of struct pf_altq_vX */
191 #define PF_ALTQ_VERSION 1
195 char ifname[IFNAMSIZ];
197 void *altq_disc; /* discipline-specific state */
198 TAILQ_ENTRY(pf_kaltq) entries;
201 uint8_t scheduler; /* scheduler type */
202 uint32_t tbrsize; /* tokenbucket regulator size */
203 uint64_t ifbandwidth; /* interface bandwidth */
206 char qname[PF_QNAME_SIZE]; /* queue name */
207 char parent[PF_QNAME_SIZE]; /* parent name */
208 uint32_t parent_qid; /* parent queue id */
209 uint64_t bandwidth; /* queue bandwidth */
210 uint8_t priority; /* priority */
211 uint8_t local_flags; /* dynamic interface, see _v0 */
213 uint16_t qlimit; /* queue size limit */
214 uint16_t flags; /* misc flags */
216 struct cbq_opts cbq_opts;
217 struct codel_opts codel_opts;
218 struct priq_opts priq_opts;
219 struct hfsc_opts_v1 hfsc_opts;
220 struct fairq_opts fairq_opts;
223 uint32_t qid; /* return value */
228 * Compatibility and convenience macros
232 * Avoid a patch with 100+ lines of name substitution.
234 #define pf_altq pf_kaltq
238 #ifdef PFIOC_USE_LATEST
240 * Maintaining in-tree consumers of the ioctl interface is easier when that
241 * code can be written in terms old names that refer to the latest interface
242 * version as that reduces the required changes in the consumers to those
243 * that are functionally necessary to accommodate a new interface version.
245 #define pf_altq __CONCAT(pf_altq_v, PF_ALTQ_VERSION)
247 #else /* PFIOC_USE_LATEST */
249 * When building out-of-tree code that is written for the old interface,
250 * such as may exist in ports for example, resolve the old pf_altq struct
251 * tag to the v0 version.
253 #define pf_altq __CONCAT(pf_altq_v, 0)
255 #endif /* PFIOC_USE_LATEST */
258 #endif /* _NET_PF_ALTQ_H_ */