/*-1* Copyright (C) 1998-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.h,v 1.10 2003/07/10 12:07:47 kjc Exp $26*/27#ifndef _ALTQ_ALTQ_H_28#define _ALTQ_ALTQ_H_2930#if 031/*32* allow altq-3 (altqd(8) and /dev/altq) to coexist with the new pf-based altq.33* altq3 is mainly for research experiments. pf-based altq is for daily use.34*/35#define ALTQ3_COMPAT /* for compatibility with altq-3 */36#define ALTQ3_CLFIER_COMPAT /* for compatibility with altq-3 classifier */37#endif3839/* altq discipline type */40#define ALTQT_NONE 0 /* reserved */41#define ALTQT_CBQ 1 /* cbq */42#define ALTQT_WFQ 2 /* wfq */43#define ALTQT_AFMAP 3 /* afmap */44#define ALTQT_FIFOQ 4 /* fifoq */45#define ALTQT_RED 5 /* red */46#define ALTQT_RIO 6 /* rio */47#define ALTQT_LOCALQ 7 /* local use */48#define ALTQT_HFSC 8 /* hfsc */49#define ALTQT_CDNR 9 /* traffic conditioner */50#define ALTQT_BLUE 10 /* blue */51#define ALTQT_PRIQ 11 /* priority queue */52#define ALTQT_JOBS 12 /* JoBS */53#define ALTQT_FAIRQ 13 /* fairq */54#define ALTQT_CODEL 14 /* CoDel */55#define ALTQT_MAX 15 /* should be max discipline type + 1 */5657/* simple token backet meter profile */58struct tb_profile {59u_int64_t rate; /* rate in bit-per-sec */60u_int32_t depth; /* depth in bytes */61};6263/*64* generic packet counter65*/66struct pktcntr {67u_int64_t packets;68u_int64_t bytes;69};7071#define PKTCNTR_ADD(cntr, len) \72do { (cntr)->packets++; (cntr)->bytes += len; } while (/*CONSTCOND*/ 0)7374#ifdef _KERNEL75#include <net/altq/altq_var.h>76#endif7778/*79* Can't put these versions in the scheduler-specific headers and include80* them all here as that will cause build failure due to cross-including81* each other scheduler's private bits into each scheduler's82* implementation.83*/84#define CBQ_STATS_VERSION 0 /* Latest version of class_stats_t */85#define CODEL_STATS_VERSION 0 /* Latest version of codel_ifstats */86#define FAIRQ_STATS_VERSION 0 /* Latest version of fairq_classstats */87#define HFSC_STATS_VERSION 1 /* Latest version of hfsc_classstats */88#define PRIQ_STATS_VERSION 0 /* Latest version of priq_classstats */8990/* Return the latest stats version for the given scheduler. */91static inline int altq_stats_version(int scheduler)92{93switch (scheduler) {94case ALTQT_CBQ: return (CBQ_STATS_VERSION);95case ALTQT_CODEL: return (CODEL_STATS_VERSION);96case ALTQT_FAIRQ: return (FAIRQ_STATS_VERSION);97case ALTQT_HFSC: return (HFSC_STATS_VERSION);98case ALTQT_PRIQ: return (PRIQ_STATS_VERSION);99default: return (0);100}101}102103#endif /* _ALTQ_ALTQ_H_ */104105106