1 /* $KAME: altq_priq.h,v 1.7 2003/10/03 05:05:15 kjc Exp $ */ 2 /* $DragonFly: src/sys/net/altq/altq_priq.h,v 1.1 2005/02/11 22:25:57 joerg Exp $ */ 3 4 /* 5 * Copyright (C) 2000-2003 6 * Sony Computer Science Laboratories Inc. All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 17 * THIS SOFTWARE IS PROVIDED BY SONY CSL AND CONTRIBUTORS ``AS IS'' AND 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 * ARE DISCLAIMED. IN NO EVENT SHALL SONY CSL OR CONTRIBUTORS BE LIABLE 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30 #ifndef _ALTQ_ALTQ_PRIQ_H_ 31 #define _ALTQ_ALTQ_PRIQ_H_ 32 33 #include <net/altq/altq.h> 34 #include <net/altq/altq_classq.h> 35 #include <net/altq/altq_red.h> 36 #include <net/altq/altq_rio.h> 37 38 #define PRIQ_MAXPRI 16 /* upper limit of the number of priorities */ 39 40 /* priq class flags */ 41 #define PRCF_RED 0x0001 /* use RED */ 42 #define PRCF_ECN 0x0002 /* use RED/ECN */ 43 #define PRCF_RIO 0x0004 /* use RIO */ 44 #define PRCF_CLEARDSCP 0x0010 /* clear diffserv codepoint */ 45 #define PRCF_DEFAULTCLASS 0x1000 /* default class */ 46 47 /* special class handles */ 48 #define PRIQ_NULLCLASS_HANDLE 0 49 50 struct priq_classstats { 51 uint32_t class_handle; 52 53 u_int qlength; 54 u_int qlimit; 55 u_int period; 56 struct pktcntr xmitcnt; /* transmitted packet counter */ 57 struct pktcntr dropcnt; /* dropped packet counter */ 58 59 /* red and rio related info */ 60 int qtype; 61 struct redstats red[3]; /* rio has 3 red stats */ 62 }; 63 64 #ifdef _KERNEL 65 66 struct priq_class { 67 uint32_t cl_handle; /* class handle */ 68 class_queue_t *cl_q; /* class queue structure */ 69 struct red *cl_red; /* RED state */ 70 int cl_pri; /* priority */ 71 int cl_flags; /* class flags */ 72 struct priq_if *cl_pif; /* back pointer to pif */ 73 struct altq_pktattr *cl_pktattr; /* saved header used by ECN */ 74 75 /* statistics */ 76 u_int cl_period; /* backlog period */ 77 struct pktcntr cl_xmitcnt; /* transmitted packet counter */ 78 struct pktcntr cl_dropcnt; /* dropped packet counter */ 79 }; 80 81 /* 82 * priq interface state 83 */ 84 struct priq_if { 85 struct priq_if *pif_next; /* interface state list */ 86 struct ifaltq *pif_ifq; /* backpointer to ifaltq */ 87 u_int pif_bandwidth; /* link bandwidth in bps */ 88 int pif_maxpri; /* max priority in use */ 89 struct priq_class *pif_default; /* default class */ 90 struct priq_class *pif_classes[PRIQ_MAXPRI]; /* classes */ 91 }; 92 93 #endif /* _KERNEL */ 94 95 #endif /* _ALTQ_ALTQ_PRIQ_H_ */ 96