186d7f5d3SJohn Marino /* $KAME: altq_priq.h,v 1.7 2003/10/03 05:05:15 kjc Exp $ */ 286d7f5d3SJohn Marino /* $DragonFly: src/sys/net/altq/altq_priq.h,v 1.1 2005/02/11 22:25:57 joerg Exp $ */ 386d7f5d3SJohn Marino 486d7f5d3SJohn Marino /* 586d7f5d3SJohn Marino * Copyright (C) 2000-2003 686d7f5d3SJohn Marino * Sony Computer Science Laboratories Inc. All rights reserved. 786d7f5d3SJohn Marino * 886d7f5d3SJohn Marino * Redistribution and use in source and binary forms, with or without 986d7f5d3SJohn Marino * modification, are permitted provided that the following conditions 1086d7f5d3SJohn Marino * are met: 1186d7f5d3SJohn Marino * 1. Redistributions of source code must retain the above copyright 1286d7f5d3SJohn Marino * notice, this list of conditions and the following disclaimer. 1386d7f5d3SJohn Marino * 2. Redistributions in binary form must reproduce the above copyright 1486d7f5d3SJohn Marino * notice, this list of conditions and the following disclaimer in the 1586d7f5d3SJohn Marino * documentation and/or other materials provided with the distribution. 1686d7f5d3SJohn Marino * 1786d7f5d3SJohn Marino * THIS SOFTWARE IS PROVIDED BY SONY CSL AND CONTRIBUTORS ``AS IS'' AND 1886d7f5d3SJohn Marino * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1986d7f5d3SJohn Marino * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2086d7f5d3SJohn Marino * ARE DISCLAIMED. IN NO EVENT SHALL SONY CSL OR CONTRIBUTORS BE LIABLE 2186d7f5d3SJohn Marino * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2286d7f5d3SJohn Marino * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2386d7f5d3SJohn Marino * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2486d7f5d3SJohn Marino * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2586d7f5d3SJohn Marino * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2686d7f5d3SJohn Marino * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2786d7f5d3SJohn Marino * SUCH DAMAGE. 2886d7f5d3SJohn Marino */ 2986d7f5d3SJohn Marino 3086d7f5d3SJohn Marino #ifndef _ALTQ_ALTQ_PRIQ_H_ 3186d7f5d3SJohn Marino #define _ALTQ_ALTQ_PRIQ_H_ 3286d7f5d3SJohn Marino 3386d7f5d3SJohn Marino #include <net/altq/altq.h> 3486d7f5d3SJohn Marino #include <net/altq/altq_classq.h> 3586d7f5d3SJohn Marino #include <net/altq/altq_red.h> 3686d7f5d3SJohn Marino #include <net/altq/altq_rio.h> 3786d7f5d3SJohn Marino 3886d7f5d3SJohn Marino #define PRIQ_MAXPRI 16 /* upper limit of the number of priorities */ 3986d7f5d3SJohn Marino 4086d7f5d3SJohn Marino /* priq class flags */ 4186d7f5d3SJohn Marino #define PRCF_RED 0x0001 /* use RED */ 4286d7f5d3SJohn Marino #define PRCF_ECN 0x0002 /* use RED/ECN */ 4386d7f5d3SJohn Marino #define PRCF_RIO 0x0004 /* use RIO */ 4486d7f5d3SJohn Marino #define PRCF_CLEARDSCP 0x0010 /* clear diffserv codepoint */ 4586d7f5d3SJohn Marino #define PRCF_DEFAULTCLASS 0x1000 /* default class */ 4686d7f5d3SJohn Marino 4786d7f5d3SJohn Marino /* special class handles */ 4886d7f5d3SJohn Marino #define PRIQ_NULLCLASS_HANDLE 0 4986d7f5d3SJohn Marino 5086d7f5d3SJohn Marino struct priq_classstats { 5186d7f5d3SJohn Marino uint32_t class_handle; 5286d7f5d3SJohn Marino 5386d7f5d3SJohn Marino u_int qlength; 5486d7f5d3SJohn Marino u_int qlimit; 5586d7f5d3SJohn Marino u_int period; 5686d7f5d3SJohn Marino struct pktcntr xmitcnt; /* transmitted packet counter */ 5786d7f5d3SJohn Marino struct pktcntr dropcnt; /* dropped packet counter */ 5886d7f5d3SJohn Marino 5986d7f5d3SJohn Marino /* red and rio related info */ 6086d7f5d3SJohn Marino int qtype; 6186d7f5d3SJohn Marino struct redstats red[3]; /* rio has 3 red stats */ 6286d7f5d3SJohn Marino }; 6386d7f5d3SJohn Marino 6486d7f5d3SJohn Marino #ifdef _KERNEL 6586d7f5d3SJohn Marino 6686d7f5d3SJohn Marino struct priq_class { 6786d7f5d3SJohn Marino uint32_t cl_handle; /* class handle */ 6886d7f5d3SJohn Marino class_queue_t *cl_q; /* class queue structure */ 6986d7f5d3SJohn Marino struct red *cl_red; /* RED state */ 7086d7f5d3SJohn Marino int cl_pri; /* priority */ 7186d7f5d3SJohn Marino int cl_flags; /* class flags */ 7286d7f5d3SJohn Marino struct priq_if *cl_pif; /* back pointer to pif */ 7386d7f5d3SJohn Marino struct altq_pktattr *cl_pktattr; /* saved header used by ECN */ 7486d7f5d3SJohn Marino 7586d7f5d3SJohn Marino /* statistics */ 7686d7f5d3SJohn Marino u_int cl_period; /* backlog period */ 7786d7f5d3SJohn Marino struct pktcntr cl_xmitcnt; /* transmitted packet counter */ 7886d7f5d3SJohn Marino struct pktcntr cl_dropcnt; /* dropped packet counter */ 7986d7f5d3SJohn Marino }; 8086d7f5d3SJohn Marino 8186d7f5d3SJohn Marino /* 8286d7f5d3SJohn Marino * priq interface state 8386d7f5d3SJohn Marino */ 8486d7f5d3SJohn Marino struct priq_if { 8586d7f5d3SJohn Marino struct priq_if *pif_next; /* interface state list */ 8686d7f5d3SJohn Marino struct ifaltq *pif_ifq; /* backpointer to ifaltq */ 8786d7f5d3SJohn Marino u_int pif_bandwidth; /* link bandwidth in bps */ 8886d7f5d3SJohn Marino int pif_maxpri; /* max priority in use */ 8986d7f5d3SJohn Marino struct priq_class *pif_default; /* default class */ 9086d7f5d3SJohn Marino struct priq_class *pif_classes[PRIQ_MAXPRI]; /* classes */ 9186d7f5d3SJohn Marino }; 9286d7f5d3SJohn Marino 9386d7f5d3SJohn Marino #endif /* _KERNEL */ 9486d7f5d3SJohn Marino 9586d7f5d3SJohn Marino #endif /* _ALTQ_ALTQ_PRIQ_H_ */ 96