/*-1* Copyright (C) 2000-20032* Sony Computer Science Laboratories Inc. All rights reserved.3*4* Redistribution and use in source and binary forms, with or without5* modification, are permitted provided that the following conditions6* are met:7* 1. Redistributions of source code must retain the above copyright8* notice, this list of conditions and the following disclaimer.9* 2. Redistributions in binary form must reproduce the above copyright10* notice, this list of conditions and the following disclaimer in the11* documentation and/or other materials provided with the distribution.12*13* THIS SOFTWARE IS PROVIDED BY SONY CSL AND CONTRIBUTORS ``AS IS'' AND14* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE15* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE16* ARE DISCLAIMED. IN NO EVENT SHALL SONY CSL OR CONTRIBUTORS BE LIABLE17* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL18* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS19* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)20* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT21* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY22* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF23* SUCH DAMAGE.24*25* $KAME: altq_priq.h,v 1.7 2003/10/03 05:05:15 kjc Exp $26*/2728#ifndef _ALTQ_ALTQ_PRIQ_H_29#define _ALTQ_ALTQ_PRIQ_H_3031#include <net/altq/altq.h>32#include <net/altq/altq_classq.h>33#include <net/altq/altq_codel.h>34#include <net/altq/altq_red.h>35#include <net/altq/altq_rio.h>3637#ifdef __cplusplus38extern "C" {39#endif4041#define PRIQ_MAXPRI 16 /* upper limit of the number of priorities */4243/* priq class flags */44#define PRCF_RED 0x0001 /* use RED */45#define PRCF_ECN 0x0002 /* use RED/ECN */46#define PRCF_RIO 0x0004 /* use RIO */47#define PRCF_CODEL 0x0008 /* use CoDel */48#define PRCF_CLEARDSCP 0x0010 /* clear diffserv codepoint */49#define PRCF_DEFAULTCLASS 0x1000 /* default class */5051/* special class handles */52#define PRIQ_NULLCLASS_HANDLE 05354struct priq_classstats {55u_int32_t class_handle;5657u_int qlength;58u_int qlimit;59u_int period;60struct pktcntr xmitcnt; /* transmitted packet counter */61struct pktcntr dropcnt; /* dropped packet counter */6263/* codel, red and rio related info */64int qtype;65struct redstats red[3]; /* rio has 3 red stats */66struct codel_stats codel;67};6869/*70* PRIQ_STATS_VERSION is defined in altq.h to work around issues stemming71* from mixing of public-API and internal bits in each scheduler-specific72* header.73*/7475#ifdef _KERNEL7677struct priq_class {78u_int32_t cl_handle; /* class handle */79class_queue_t *cl_q; /* class queue structure */80union {81struct red *cl_red; /* RED state */82struct codel *cl_codel; /* CoDel state */83} cl_aqm;84#define cl_red cl_aqm.cl_red85#define cl_codel cl_aqm.cl_codel86int cl_pri; /* priority */87int cl_flags; /* class flags */88struct priq_if *cl_pif; /* back pointer to pif */89struct altq_pktattr *cl_pktattr; /* saved header used by ECN */9091/* statistics */92u_int cl_period; /* backlog period */93struct pktcntr cl_xmitcnt; /* transmitted packet counter */94struct pktcntr cl_dropcnt; /* dropped packet counter */95};9697/*98* priq interface state99*/100struct priq_if {101struct priq_if *pif_next; /* interface state list */102struct ifaltq *pif_ifq; /* backpointer to ifaltq */103u_int pif_bandwidth; /* link bandwidth in bps */104int pif_maxpri; /* max priority in use */105struct priq_class *pif_default; /* default class */106struct priq_class *pif_classes[PRIQ_MAXPRI]; /* classes */107#ifdef ALTQ3_CLFIER_COMPAT108struct acc_classifier pif_classifier; /* classifier */109#endif110};111112#endif /* _KERNEL */113114#ifdef __cplusplus115}116#endif117118#endif /* _ALTQ_ALTQ_PRIQ_H_ */119120121