1772e66a6SGleb Smirnoff /*- 2772e66a6SGleb Smirnoff * Copyright (c) 1997-1999 Carnegie Mellon University. All Rights Reserved. 3772e66a6SGleb Smirnoff * 4772e66a6SGleb Smirnoff * Permission to use, copy, modify, and distribute this software and 5772e66a6SGleb Smirnoff * its documentation is hereby granted (including for commercial or 6772e66a6SGleb Smirnoff * for-profit use), provided that both the copyright notice and this 7772e66a6SGleb Smirnoff * permission notice appear in all copies of the software, derivative 8772e66a6SGleb Smirnoff * works, or modified versions, and any portions thereof. 9772e66a6SGleb Smirnoff * 10772e66a6SGleb Smirnoff * THIS SOFTWARE IS EXPERIMENTAL AND IS KNOWN TO HAVE BUGS, SOME OF 11772e66a6SGleb Smirnoff * WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON PROVIDES THIS 12772e66a6SGleb Smirnoff * SOFTWARE IN ITS ``AS IS'' CONDITION, AND ANY EXPRESS OR IMPLIED 13772e66a6SGleb Smirnoff * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 14772e66a6SGleb Smirnoff * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 15772e66a6SGleb Smirnoff * DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE 16772e66a6SGleb Smirnoff * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 17772e66a6SGleb Smirnoff * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 18772e66a6SGleb Smirnoff * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 19772e66a6SGleb Smirnoff * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 20772e66a6SGleb Smirnoff * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21772e66a6SGleb Smirnoff * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 22772e66a6SGleb Smirnoff * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 23772e66a6SGleb Smirnoff * DAMAGE. 24772e66a6SGleb Smirnoff * 25772e66a6SGleb Smirnoff * Carnegie Mellon encourages (but does not require) users of this 26772e66a6SGleb Smirnoff * software to return any improvements or extensions that they make, 27772e66a6SGleb Smirnoff * and to grant Carnegie Mellon the rights to redistribute these 28772e66a6SGleb Smirnoff * changes without encumbrance. 29772e66a6SGleb Smirnoff * 30772e66a6SGleb Smirnoff * $KAME: altq_hfsc.h,v 1.12 2003/12/05 05:40:46 kjc Exp $ 31772e66a6SGleb Smirnoff */ 32772e66a6SGleb Smirnoff #ifndef _ALTQ_ALTQ_HFSC_H_ 33772e66a6SGleb Smirnoff #define _ALTQ_ALTQ_HFSC_H_ 34772e66a6SGleb Smirnoff 35772e66a6SGleb Smirnoff #include <net/altq/altq.h> 36772e66a6SGleb Smirnoff #include <net/altq/altq_classq.h> 370a70aaf8SLuiz Otavio O Souza #include <net/altq/altq_codel.h> 38772e66a6SGleb Smirnoff #include <net/altq/altq_red.h> 39772e66a6SGleb Smirnoff #include <net/altq/altq_rio.h> 40772e66a6SGleb Smirnoff 41772e66a6SGleb Smirnoff #ifdef __cplusplus 42772e66a6SGleb Smirnoff extern "C" { 43772e66a6SGleb Smirnoff #endif 44772e66a6SGleb Smirnoff 45249cc75fSPatrick Kelsey struct service_curve_v0 { 46772e66a6SGleb Smirnoff u_int m1; /* slope of the first segment in bits/sec */ 47772e66a6SGleb Smirnoff u_int d; /* the x-projection of the first segment in msec */ 48772e66a6SGleb Smirnoff u_int m2; /* slope of the second segment in bits/sec */ 49772e66a6SGleb Smirnoff }; 50772e66a6SGleb Smirnoff 51249cc75fSPatrick Kelsey struct service_curve_v1 { 52249cc75fSPatrick Kelsey u_int64_t m1; /* slope of the first segment in bits/sec */ 53249cc75fSPatrick Kelsey u_int d; /* the x-projection of the first segment in msec */ 54249cc75fSPatrick Kelsey u_int64_t m2; /* slope of the second segment in bits/sec */ 55249cc75fSPatrick Kelsey }; 56249cc75fSPatrick Kelsey 57249cc75fSPatrick Kelsey /* Latest version of struct service_curve_vX */ 58249cc75fSPatrick Kelsey #define HFSC_SERVICE_CURVE_VERSION 1 59249cc75fSPatrick Kelsey 60772e66a6SGleb Smirnoff /* special class handles */ 61772e66a6SGleb Smirnoff #define HFSC_NULLCLASS_HANDLE 0 62*448732b8SKristof Provost #define HFSC_MAX_CLASSES 2048 63772e66a6SGleb Smirnoff 64772e66a6SGleb Smirnoff /* hfsc class flags */ 65772e66a6SGleb Smirnoff #define HFCF_RED 0x0001 /* use RED */ 66772e66a6SGleb Smirnoff #define HFCF_ECN 0x0002 /* use RED/ECN */ 67772e66a6SGleb Smirnoff #define HFCF_RIO 0x0004 /* use RIO */ 680a70aaf8SLuiz Otavio O Souza #define HFCF_CODEL 0x0008 /* use CoDel */ 69772e66a6SGleb Smirnoff #define HFCF_CLEARDSCP 0x0010 /* clear diffserv codepoint */ 70772e66a6SGleb Smirnoff #define HFCF_DEFAULTCLASS 0x1000 /* default class */ 71772e66a6SGleb Smirnoff 72772e66a6SGleb Smirnoff /* service curve types */ 73772e66a6SGleb Smirnoff #define HFSC_REALTIMESC 1 74772e66a6SGleb Smirnoff #define HFSC_LINKSHARINGSC 2 75772e66a6SGleb Smirnoff #define HFSC_UPPERLIMITSC 4 76772e66a6SGleb Smirnoff #define HFSC_DEFAULTSC (HFSC_REALTIMESC|HFSC_LINKSHARINGSC) 77772e66a6SGleb Smirnoff 78249cc75fSPatrick Kelsey struct hfsc_classstats_v0 { 79772e66a6SGleb Smirnoff u_int class_id; 80772e66a6SGleb Smirnoff u_int32_t class_handle; 81249cc75fSPatrick Kelsey struct service_curve_v0 rsc; 82249cc75fSPatrick Kelsey struct service_curve_v0 fsc; 83249cc75fSPatrick Kelsey struct service_curve_v0 usc; /* upper limit service curve */ 84772e66a6SGleb Smirnoff 85772e66a6SGleb Smirnoff u_int64_t total; /* total work in bytes */ 86772e66a6SGleb Smirnoff u_int64_t cumul; /* cumulative work in bytes 87772e66a6SGleb Smirnoff done by real-time criteria */ 88772e66a6SGleb Smirnoff u_int64_t d; /* deadline */ 89772e66a6SGleb Smirnoff u_int64_t e; /* eligible time */ 90772e66a6SGleb Smirnoff u_int64_t vt; /* virtual time */ 91772e66a6SGleb Smirnoff u_int64_t f; /* fit time for upper-limit */ 92772e66a6SGleb Smirnoff 93772e66a6SGleb Smirnoff /* info helpful for debugging */ 94772e66a6SGleb Smirnoff u_int64_t initvt; /* init virtual time */ 95772e66a6SGleb Smirnoff u_int64_t vtoff; /* cl_vt_ipoff */ 96772e66a6SGleb Smirnoff u_int64_t cvtmax; /* cl_maxvt */ 97772e66a6SGleb Smirnoff u_int64_t myf; /* cl_myf */ 98772e66a6SGleb Smirnoff u_int64_t cfmin; /* cl_mincf */ 99772e66a6SGleb Smirnoff u_int64_t cvtmin; /* cl_mincvt */ 100772e66a6SGleb Smirnoff u_int64_t myfadj; /* cl_myfadj */ 101772e66a6SGleb Smirnoff u_int64_t vtadj; /* cl_vtadj */ 102772e66a6SGleb Smirnoff u_int64_t cur_time; 103772e66a6SGleb Smirnoff u_int32_t machclk_freq; 104772e66a6SGleb Smirnoff 105772e66a6SGleb Smirnoff u_int qlength; 106772e66a6SGleb Smirnoff u_int qlimit; 107772e66a6SGleb Smirnoff struct pktcntr xmit_cnt; 108772e66a6SGleb Smirnoff struct pktcntr drop_cnt; 109772e66a6SGleb Smirnoff u_int period; 110772e66a6SGleb Smirnoff 111772e66a6SGleb Smirnoff u_int vtperiod; /* vt period sequence no */ 112772e66a6SGleb Smirnoff u_int parentperiod; /* parent's vt period seqno */ 113772e66a6SGleb Smirnoff int nactive; /* number of active children */ 114772e66a6SGleb Smirnoff 1150a70aaf8SLuiz Otavio O Souza /* codel, red and rio related info */ 116772e66a6SGleb Smirnoff int qtype; 117772e66a6SGleb Smirnoff struct redstats red[3]; 1180a70aaf8SLuiz Otavio O Souza struct codel_stats codel; 119772e66a6SGleb Smirnoff }; 120772e66a6SGleb Smirnoff 121249cc75fSPatrick Kelsey struct hfsc_classstats_v1 { 122249cc75fSPatrick Kelsey u_int class_id; 123249cc75fSPatrick Kelsey u_int32_t class_handle; 124249cc75fSPatrick Kelsey struct service_curve_v1 rsc; 125249cc75fSPatrick Kelsey struct service_curve_v1 fsc; 126249cc75fSPatrick Kelsey struct service_curve_v1 usc; /* upper limit service curve */ 127249cc75fSPatrick Kelsey 128249cc75fSPatrick Kelsey u_int64_t total; /* total work in bytes */ 129249cc75fSPatrick Kelsey u_int64_t cumul; /* cumulative work in bytes 130249cc75fSPatrick Kelsey done by real-time criteria */ 131249cc75fSPatrick Kelsey u_int64_t d; /* deadline */ 132249cc75fSPatrick Kelsey u_int64_t e; /* eligible time */ 133249cc75fSPatrick Kelsey u_int64_t vt; /* virtual time */ 134249cc75fSPatrick Kelsey u_int64_t f; /* fit time for upper-limit */ 135249cc75fSPatrick Kelsey 136249cc75fSPatrick Kelsey /* info helpful for debugging */ 137249cc75fSPatrick Kelsey u_int64_t initvt; /* init virtual time */ 138249cc75fSPatrick Kelsey u_int64_t vtoff; /* cl_vt_ipoff */ 139249cc75fSPatrick Kelsey u_int64_t cvtmax; /* cl_maxvt */ 140249cc75fSPatrick Kelsey u_int64_t myf; /* cl_myf */ 141249cc75fSPatrick Kelsey u_int64_t cfmin; /* cl_mincf */ 142249cc75fSPatrick Kelsey u_int64_t cvtmin; /* cl_mincvt */ 143249cc75fSPatrick Kelsey u_int64_t myfadj; /* cl_myfadj */ 144249cc75fSPatrick Kelsey u_int64_t vtadj; /* cl_vtadj */ 145249cc75fSPatrick Kelsey u_int64_t cur_time; 146249cc75fSPatrick Kelsey u_int32_t machclk_freq; 147249cc75fSPatrick Kelsey 148249cc75fSPatrick Kelsey u_int qlength; 149249cc75fSPatrick Kelsey u_int qlimit; 150249cc75fSPatrick Kelsey struct pktcntr xmit_cnt; 151249cc75fSPatrick Kelsey struct pktcntr drop_cnt; 152249cc75fSPatrick Kelsey u_int period; 153249cc75fSPatrick Kelsey 154249cc75fSPatrick Kelsey u_int vtperiod; /* vt period sequence no */ 155249cc75fSPatrick Kelsey u_int parentperiod; /* parent's vt period seqno */ 156249cc75fSPatrick Kelsey int nactive; /* number of active children */ 157249cc75fSPatrick Kelsey 158249cc75fSPatrick Kelsey /* codel, red and rio related info */ 159249cc75fSPatrick Kelsey int qtype; 160249cc75fSPatrick Kelsey struct redstats red[3]; 161249cc75fSPatrick Kelsey struct codel_stats codel; 162249cc75fSPatrick Kelsey }; 163249cc75fSPatrick Kelsey 164249cc75fSPatrick Kelsey /* 165249cc75fSPatrick Kelsey * HFSC_STATS_VERSION is defined in altq.h to work around issues stemming 166249cc75fSPatrick Kelsey * from mixing of public-API and internal bits in each scheduler-specific 167249cc75fSPatrick Kelsey * header. 168249cc75fSPatrick Kelsey */ 169772e66a6SGleb Smirnoff 170772e66a6SGleb Smirnoff #ifdef _KERNEL 171772e66a6SGleb Smirnoff /* 172772e66a6SGleb Smirnoff * kernel internal service curve representation 173772e66a6SGleb Smirnoff * coordinates are given by 64 bit unsigned integers. 174772e66a6SGleb Smirnoff * x-axis: unit is clock count. for the intel x86 architecture, 175772e66a6SGleb Smirnoff * the raw Pentium TSC (Timestamp Counter) value is used. 176772e66a6SGleb Smirnoff * virtual time is also calculated in this time scale. 177772e66a6SGleb Smirnoff * y-axis: unit is byte. 178772e66a6SGleb Smirnoff * 179772e66a6SGleb Smirnoff * the service curve parameters are converted to the internal 180772e66a6SGleb Smirnoff * representation. 181772e66a6SGleb Smirnoff * the slope values are scaled to avoid overflow. 182772e66a6SGleb Smirnoff * the inverse slope values as well as the y-projection of the 1st 183caa7e52fSEitan Adler * segment are kept in order to avoid 64-bit divide operations 184772e66a6SGleb Smirnoff * that are expensive on 32-bit architectures. 185772e66a6SGleb Smirnoff * 186772e66a6SGleb Smirnoff * note: Intel Pentium TSC never wraps around in several thousands of years. 187772e66a6SGleb Smirnoff * x-axis doesn't wrap around for 1089 years with 1GHz clock. 188772e66a6SGleb Smirnoff * y-axis doesn't wrap around for 4358 years with 1Gbps bandwidth. 189772e66a6SGleb Smirnoff */ 190772e66a6SGleb Smirnoff 191772e66a6SGleb Smirnoff /* kernel internal representation of a service curve */ 192772e66a6SGleb Smirnoff struct internal_sc { 193772e66a6SGleb Smirnoff u_int64_t sm1; /* scaled slope of the 1st segment */ 194772e66a6SGleb Smirnoff u_int64_t ism1; /* scaled inverse-slope of the 1st segment */ 195772e66a6SGleb Smirnoff u_int64_t dx; /* the x-projection of the 1st segment */ 196772e66a6SGleb Smirnoff u_int64_t dy; /* the y-projection of the 1st segment */ 197772e66a6SGleb Smirnoff u_int64_t sm2; /* scaled slope of the 2nd segment */ 198772e66a6SGleb Smirnoff u_int64_t ism2; /* scaled inverse-slope of the 2nd segment */ 199772e66a6SGleb Smirnoff }; 200772e66a6SGleb Smirnoff 201772e66a6SGleb Smirnoff /* runtime service curve */ 202772e66a6SGleb Smirnoff struct runtime_sc { 203772e66a6SGleb Smirnoff u_int64_t x; /* current starting position on x-axis */ 204772e66a6SGleb Smirnoff u_int64_t y; /* current starting position on x-axis */ 205772e66a6SGleb Smirnoff u_int64_t sm1; /* scaled slope of the 1st segment */ 206772e66a6SGleb Smirnoff u_int64_t ism1; /* scaled inverse-slope of the 1st segment */ 207772e66a6SGleb Smirnoff u_int64_t dx; /* the x-projection of the 1st segment */ 208772e66a6SGleb Smirnoff u_int64_t dy; /* the y-projection of the 1st segment */ 209772e66a6SGleb Smirnoff u_int64_t sm2; /* scaled slope of the 2nd segment */ 210772e66a6SGleb Smirnoff u_int64_t ism2; /* scaled inverse-slope of the 2nd segment */ 211772e66a6SGleb Smirnoff }; 212772e66a6SGleb Smirnoff 213772e66a6SGleb Smirnoff struct hfsc_class { 214772e66a6SGleb Smirnoff u_int cl_id; /* class id (just for debug) */ 2158f2ac656SPatrick Kelsey u_int cl_slot; /* slot in hif class table */ 216772e66a6SGleb Smirnoff u_int32_t cl_handle; /* class handle */ 217772e66a6SGleb Smirnoff struct hfsc_if *cl_hif; /* back pointer to struct hfsc_if */ 218772e66a6SGleb Smirnoff int cl_flags; /* misc flags */ 219772e66a6SGleb Smirnoff 220772e66a6SGleb Smirnoff struct hfsc_class *cl_parent; /* parent class */ 221772e66a6SGleb Smirnoff struct hfsc_class *cl_siblings; /* sibling classes */ 222772e66a6SGleb Smirnoff struct hfsc_class *cl_children; /* child classes */ 223772e66a6SGleb Smirnoff 224772e66a6SGleb Smirnoff class_queue_t *cl_q; /* class queue structure */ 2250a70aaf8SLuiz Otavio O Souza union { 226772e66a6SGleb Smirnoff struct red *cl_red; /* RED state */ 2270a70aaf8SLuiz Otavio O Souza struct codel *cl_codel; /* CoDel state */ 2280a70aaf8SLuiz Otavio O Souza } cl_aqm; 2290a70aaf8SLuiz Otavio O Souza #define cl_red cl_aqm.cl_red 2300a70aaf8SLuiz Otavio O Souza #define cl_codel cl_aqm.cl_codel 231772e66a6SGleb Smirnoff struct altq_pktattr *cl_pktattr; /* saved header used by ECN */ 232772e66a6SGleb Smirnoff 233772e66a6SGleb Smirnoff u_int64_t cl_total; /* total work in bytes */ 234772e66a6SGleb Smirnoff u_int64_t cl_cumul; /* cumulative work in bytes 235772e66a6SGleb Smirnoff done by real-time criteria */ 236772e66a6SGleb Smirnoff u_int64_t cl_d; /* deadline */ 237772e66a6SGleb Smirnoff u_int64_t cl_e; /* eligible time */ 238772e66a6SGleb Smirnoff u_int64_t cl_vt; /* virtual time */ 239772e66a6SGleb Smirnoff u_int64_t cl_f; /* time when this class will fit for 240772e66a6SGleb Smirnoff link-sharing, max(myf, cfmin) */ 241772e66a6SGleb Smirnoff u_int64_t cl_myf; /* my fit-time (as calculated from this 242772e66a6SGleb Smirnoff class's own upperlimit curve) */ 243772e66a6SGleb Smirnoff u_int64_t cl_myfadj; /* my fit-time adjustment 244772e66a6SGleb Smirnoff (to cancel history dependence) */ 245772e66a6SGleb Smirnoff u_int64_t cl_cfmin; /* earliest children's fit-time (used 246772e66a6SGleb Smirnoff with cl_myf to obtain cl_f) */ 247772e66a6SGleb Smirnoff u_int64_t cl_cvtmin; /* minimal virtual time among the 248772e66a6SGleb Smirnoff children fit for link-sharing 249772e66a6SGleb Smirnoff (monotonic within a period) */ 250772e66a6SGleb Smirnoff u_int64_t cl_vtadj; /* intra-period cumulative vt 251772e66a6SGleb Smirnoff adjustment */ 252772e66a6SGleb Smirnoff u_int64_t cl_vtoff; /* inter-period cumulative vt offset */ 253772e66a6SGleb Smirnoff u_int64_t cl_cvtmax; /* max child's vt in the last period */ 254772e66a6SGleb Smirnoff 255772e66a6SGleb Smirnoff u_int64_t cl_initvt; /* init virtual time (for debugging) */ 256772e66a6SGleb Smirnoff 257772e66a6SGleb Smirnoff struct internal_sc *cl_rsc; /* internal real-time service curve */ 258772e66a6SGleb Smirnoff struct internal_sc *cl_fsc; /* internal fair service curve */ 259772e66a6SGleb Smirnoff struct internal_sc *cl_usc; /* internal upperlimit service curve */ 260772e66a6SGleb Smirnoff struct runtime_sc cl_deadline; /* deadline curve */ 261772e66a6SGleb Smirnoff struct runtime_sc cl_eligible; /* eligible curve */ 262772e66a6SGleb Smirnoff struct runtime_sc cl_virtual; /* virtual curve */ 263772e66a6SGleb Smirnoff struct runtime_sc cl_ulimit; /* upperlimit curve */ 264772e66a6SGleb Smirnoff 265772e66a6SGleb Smirnoff u_int cl_vtperiod; /* vt period sequence no */ 266772e66a6SGleb Smirnoff u_int cl_parentperiod; /* parent's vt period seqno */ 267772e66a6SGleb Smirnoff int cl_nactive; /* number of active children */ 268772e66a6SGleb Smirnoff 269772e66a6SGleb Smirnoff TAILQ_HEAD(acthead, hfsc_class) cl_actc; /* active children list */ 270772e66a6SGleb Smirnoff TAILQ_ENTRY(hfsc_class) cl_actlist; /* active children list entry */ 271772e66a6SGleb Smirnoff TAILQ_ENTRY(hfsc_class) cl_ellist; /* eligible list entry */ 272772e66a6SGleb Smirnoff 273772e66a6SGleb Smirnoff struct { 274772e66a6SGleb Smirnoff struct pktcntr xmit_cnt; 275772e66a6SGleb Smirnoff struct pktcntr drop_cnt; 276772e66a6SGleb Smirnoff u_int period; 277772e66a6SGleb Smirnoff } cl_stats; 278772e66a6SGleb Smirnoff }; 279772e66a6SGleb Smirnoff 280772e66a6SGleb Smirnoff /* 281772e66a6SGleb Smirnoff * hfsc interface state 282772e66a6SGleb Smirnoff */ 283772e66a6SGleb Smirnoff struct hfsc_if { 284772e66a6SGleb Smirnoff struct hfsc_if *hif_next; /* interface state list */ 285772e66a6SGleb Smirnoff struct ifaltq *hif_ifq; /* backpointer to ifaltq */ 286772e66a6SGleb Smirnoff struct hfsc_class *hif_rootclass; /* root class */ 287772e66a6SGleb Smirnoff struct hfsc_class *hif_defaultclass; /* default class */ 288772e66a6SGleb Smirnoff struct hfsc_class *hif_class_tbl[HFSC_MAX_CLASSES]; 289772e66a6SGleb Smirnoff struct hfsc_class *hif_pollcache; /* cache for poll operation */ 290772e66a6SGleb Smirnoff 291772e66a6SGleb Smirnoff u_int hif_classes; /* # of classes in the tree */ 292772e66a6SGleb Smirnoff u_int hif_packets; /* # of packets in the tree */ 293772e66a6SGleb Smirnoff u_int hif_classid; /* class id sequence number */ 294772e66a6SGleb Smirnoff 295772e66a6SGleb Smirnoff TAILQ_HEAD(elighead, hfsc_class) hif_eligible; /* eligible list */ 296772e66a6SGleb Smirnoff 297772e66a6SGleb Smirnoff #ifdef ALTQ3_CLFIER_COMPAT 298772e66a6SGleb Smirnoff struct acc_classifier hif_classifier; 299772e66a6SGleb Smirnoff #endif 300772e66a6SGleb Smirnoff }; 301772e66a6SGleb Smirnoff 302249cc75fSPatrick Kelsey /* 303249cc75fSPatrick Kelsey * Kernel code always wants the latest version - avoid a bunch of renames in 304249cc75fSPatrick Kelsey * the code to the current latest versioned name. 305249cc75fSPatrick Kelsey */ 306249cc75fSPatrick Kelsey #define service_curve __CONCAT(service_curve_v, HFSC_SERVICE_CURVE_VERSION) 307249cc75fSPatrick Kelsey 308249cc75fSPatrick Kelsey #else /* _KERNEL */ 309249cc75fSPatrick Kelsey 310249cc75fSPatrick Kelsey #ifdef PFIOC_USE_LATEST 311249cc75fSPatrick Kelsey /* 312249cc75fSPatrick Kelsey * Maintaining in-tree consumers of the ioctl interface is easier when that 313249cc75fSPatrick Kelsey * code can be written in terms old names that refer to the latest interface 314249cc75fSPatrick Kelsey * version as that reduces the required changes in the consumers to those 315249cc75fSPatrick Kelsey * that are functionally necessary to accommodate a new interface version. 316249cc75fSPatrick Kelsey */ 317249cc75fSPatrick Kelsey #define hfsc_classstats __CONCAT(hfsc_classstats_v, HFSC_STATS_VERSION) 318249cc75fSPatrick Kelsey #define service_curve __CONCAT(service_curve_v, HFSC_SERVICE_CURVE_VERSION) 319249cc75fSPatrick Kelsey 320249cc75fSPatrick Kelsey #else 321249cc75fSPatrick Kelsey /* 322249cc75fSPatrick Kelsey * When building out-of-tree code that is written for the old interface, 323249cc75fSPatrick Kelsey * such as may exist in ports for example, resolve the old struct tags to 324249cc75fSPatrick Kelsey * the v0 versions. 325249cc75fSPatrick Kelsey */ 326249cc75fSPatrick Kelsey #define hfsc_classstats __CONCAT(hfsc_classstats_v, 0) 327249cc75fSPatrick Kelsey #define service_curve __CONCAT(service_curve_v, 0) 328249cc75fSPatrick Kelsey 329249cc75fSPatrick Kelsey #endif /* PFIOC_USE_LATEST */ 330249cc75fSPatrick Kelsey 331772e66a6SGleb Smirnoff #endif /* _KERNEL */ 332772e66a6SGleb Smirnoff 333772e66a6SGleb Smirnoff #ifdef __cplusplus 334772e66a6SGleb Smirnoff } 335772e66a6SGleb Smirnoff #endif 336772e66a6SGleb Smirnoff 337772e66a6SGleb Smirnoff #endif /* _ALTQ_ALTQ_HFSC_H_ */ 338