1/* $KAME: altq_priq.h,v 1.7 2003/10/03 05:05:15 kjc Exp $ */ 2/*
| 1/*-
|
3 * Copyright (C) 2000-2003 4 * Sony Computer Science Laboratories Inc. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY SONY CSL AND CONTRIBUTORS ``AS IS'' AND 16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 * ARE DISCLAIMED. IN NO EVENT SHALL SONY CSL OR CONTRIBUTORS BE LIABLE 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE.
| 2 * Copyright (C) 2000-2003 3 * Sony Computer Science Laboratories Inc. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 14 * THIS SOFTWARE IS PROVIDED BY SONY CSL AND CONTRIBUTORS ``AS IS'' AND 15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 * ARE DISCLAIMED. IN NO EVENT SHALL SONY CSL OR CONTRIBUTORS BE LIABLE 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE.
|
| 25 * 26 * $KAME: altq_priq.h,v 1.7 2003/10/03 05:05:15 kjc Exp $ 27 * $FreeBSD: head/sys/net/altq/altq_priq.h 281613 2015-04-16 20:22:40Z glebius $
|
26 */ 27 28#ifndef _ALTQ_ALTQ_PRIQ_H_ 29#define _ALTQ_ALTQ_PRIQ_H_ 30
| 28 */ 29 30#ifndef _ALTQ_ALTQ_PRIQ_H_ 31#define _ALTQ_ALTQ_PRIQ_H_ 32
|
31#include 32#include 33#include 34#include
| 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>
|
35 36#ifdef __cplusplus 37extern "C" { 38#endif 39 40#define PRIQ_MAXPRI 16 /* upper limit of the number of priorities */ 41 42#ifdef ALTQ3_COMPAT 43struct priq_interface { 44 char ifname[IFNAMSIZ]; /* interface name (e.g., fxp0) */ 45 u_long arg; /* request-specific argument */ 46}; 47 48struct priq_add_class { 49 struct priq_interface iface; 50 int pri; /* priority (0 is the lowest) */ 51 int qlimit; /* queue size limit */ 52 int flags; /* misc flags (see below) */ 53 54 u_int32_t class_handle; /* return value */ 55}; 56#endif /* ALTQ3_COMPAT */ 57 58/* priq class flags */ 59#define PRCF_RED 0x0001 /* use RED */ 60#define PRCF_ECN 0x0002 /* use RED/ECN */ 61#define PRCF_RIO 0x0004 /* use RIO */ 62#define PRCF_CLEARDSCP 0x0010 /* clear diffserv codepoint */ 63#define PRCF_DEFAULTCLASS 0x1000 /* default class */ 64 65/* special class handles */ 66#define PRIQ_NULLCLASS_HANDLE 0 67 68#ifdef ALTQ3_COMPAT 69struct priq_delete_class { 70 struct priq_interface iface; 71 u_int32_t class_handle; 72}; 73 74struct priq_modify_class { 75 struct priq_interface iface; 76 u_int32_t class_handle; 77 int pri; 78 int qlimit; 79 int flags; 80}; 81 82struct priq_add_filter { 83 struct priq_interface iface; 84 u_int32_t class_handle; 85 struct flow_filter filter; 86 87 u_long filter_handle; /* return value */ 88}; 89 90struct priq_delete_filter { 91 struct priq_interface iface; 92 u_long filter_handle; 93}; 94#endif /* ALTQ3_COMPAT */ 95 96struct priq_classstats { 97 u_int32_t class_handle; 98 99 u_int qlength; 100 u_int qlimit; 101 u_int period; 102 struct pktcntr xmitcnt; /* transmitted packet counter */ 103 struct pktcntr dropcnt; /* dropped packet counter */ 104 105 /* red and rio related info */ 106 int qtype; 107 struct redstats red[3]; /* rio has 3 red stats */ 108}; 109 110#ifdef ALTQ3_COMPAT 111struct priq_class_stats { 112 struct priq_interface iface; 113 int maxpri; /* in/out */ 114 115 struct priq_classstats *stats; /* pointer to stats array */ 116}; 117 118#define PRIQ_IF_ATTACH _IOW('Q', 1, struct priq_interface) 119#define PRIQ_IF_DETACH _IOW('Q', 2, struct priq_interface) 120#define PRIQ_ENABLE _IOW('Q', 3, struct priq_interface) 121#define PRIQ_DISABLE _IOW('Q', 4, struct priq_interface) 122#define PRIQ_CLEAR _IOW('Q', 5, struct priq_interface) 123#define PRIQ_ADD_CLASS _IOWR('Q', 7, struct priq_add_class) 124#define PRIQ_DEL_CLASS _IOW('Q', 8, struct priq_delete_class) 125#define PRIQ_MOD_CLASS _IOW('Q', 9, struct priq_modify_class) 126#define PRIQ_ADD_FILTER _IOWR('Q', 10, struct priq_add_filter) 127#define PRIQ_DEL_FILTER _IOW('Q', 11, struct priq_delete_filter) 128#define PRIQ_GETSTATS _IOWR('Q', 12, struct priq_class_stats) 129 130#endif /* ALTQ3_COMPAT */ 131 132#ifdef _KERNEL 133 134struct priq_class { 135 u_int32_t cl_handle; /* class handle */ 136 class_queue_t *cl_q; /* class queue structure */ 137 struct red *cl_red; /* RED state */ 138 int cl_pri; /* priority */ 139 int cl_flags; /* class flags */ 140 struct priq_if *cl_pif; /* back pointer to pif */ 141 struct altq_pktattr *cl_pktattr; /* saved header used by ECN */ 142 143 /* statistics */ 144 u_int cl_period; /* backlog period */ 145 struct pktcntr cl_xmitcnt; /* transmitted packet counter */ 146 struct pktcntr cl_dropcnt; /* dropped packet counter */ 147}; 148 149/* 150 * priq interface state 151 */ 152struct priq_if { 153 struct priq_if *pif_next; /* interface state list */ 154 struct ifaltq *pif_ifq; /* backpointer to ifaltq */ 155 u_int pif_bandwidth; /* link bandwidth in bps */ 156 int pif_maxpri; /* max priority in use */ 157 struct priq_class *pif_default; /* default class */ 158 struct priq_class *pif_classes[PRIQ_MAXPRI]; /* classes */ 159#ifdef ALTQ3_CLFIER_COMPAT 160 struct acc_classifier pif_classifier; /* classifier */ 161#endif 162}; 163 164#endif /* _KERNEL */ 165 166#ifdef __cplusplus 167} 168#endif 169 170#endif /* _ALTQ_ALTQ_PRIQ_H_ */
| 37 38#ifdef __cplusplus 39extern "C" { 40#endif 41 42#define PRIQ_MAXPRI 16 /* upper limit of the number of priorities */ 43 44#ifdef ALTQ3_COMPAT 45struct priq_interface { 46 char ifname[IFNAMSIZ]; /* interface name (e.g., fxp0) */ 47 u_long arg; /* request-specific argument */ 48}; 49 50struct priq_add_class { 51 struct priq_interface iface; 52 int pri; /* priority (0 is the lowest) */ 53 int qlimit; /* queue size limit */ 54 int flags; /* misc flags (see below) */ 55 56 u_int32_t class_handle; /* return value */ 57}; 58#endif /* ALTQ3_COMPAT */ 59 60/* priq class flags */ 61#define PRCF_RED 0x0001 /* use RED */ 62#define PRCF_ECN 0x0002 /* use RED/ECN */ 63#define PRCF_RIO 0x0004 /* use RIO */ 64#define PRCF_CLEARDSCP 0x0010 /* clear diffserv codepoint */ 65#define PRCF_DEFAULTCLASS 0x1000 /* default class */ 66 67/* special class handles */ 68#define PRIQ_NULLCLASS_HANDLE 0 69 70#ifdef ALTQ3_COMPAT 71struct priq_delete_class { 72 struct priq_interface iface; 73 u_int32_t class_handle; 74}; 75 76struct priq_modify_class { 77 struct priq_interface iface; 78 u_int32_t class_handle; 79 int pri; 80 int qlimit; 81 int flags; 82}; 83 84struct priq_add_filter { 85 struct priq_interface iface; 86 u_int32_t class_handle; 87 struct flow_filter filter; 88 89 u_long filter_handle; /* return value */ 90}; 91 92struct priq_delete_filter { 93 struct priq_interface iface; 94 u_long filter_handle; 95}; 96#endif /* ALTQ3_COMPAT */ 97 98struct priq_classstats { 99 u_int32_t class_handle; 100 101 u_int qlength; 102 u_int qlimit; 103 u_int period; 104 struct pktcntr xmitcnt; /* transmitted packet counter */ 105 struct pktcntr dropcnt; /* dropped packet counter */ 106 107 /* red and rio related info */ 108 int qtype; 109 struct redstats red[3]; /* rio has 3 red stats */ 110}; 111 112#ifdef ALTQ3_COMPAT 113struct priq_class_stats { 114 struct priq_interface iface; 115 int maxpri; /* in/out */ 116 117 struct priq_classstats *stats; /* pointer to stats array */ 118}; 119 120#define PRIQ_IF_ATTACH _IOW('Q', 1, struct priq_interface) 121#define PRIQ_IF_DETACH _IOW('Q', 2, struct priq_interface) 122#define PRIQ_ENABLE _IOW('Q', 3, struct priq_interface) 123#define PRIQ_DISABLE _IOW('Q', 4, struct priq_interface) 124#define PRIQ_CLEAR _IOW('Q', 5, struct priq_interface) 125#define PRIQ_ADD_CLASS _IOWR('Q', 7, struct priq_add_class) 126#define PRIQ_DEL_CLASS _IOW('Q', 8, struct priq_delete_class) 127#define PRIQ_MOD_CLASS _IOW('Q', 9, struct priq_modify_class) 128#define PRIQ_ADD_FILTER _IOWR('Q', 10, struct priq_add_filter) 129#define PRIQ_DEL_FILTER _IOW('Q', 11, struct priq_delete_filter) 130#define PRIQ_GETSTATS _IOWR('Q', 12, struct priq_class_stats) 131 132#endif /* ALTQ3_COMPAT */ 133 134#ifdef _KERNEL 135 136struct priq_class { 137 u_int32_t cl_handle; /* class handle */ 138 class_queue_t *cl_q; /* class queue structure */ 139 struct red *cl_red; /* RED state */ 140 int cl_pri; /* priority */ 141 int cl_flags; /* class flags */ 142 struct priq_if *cl_pif; /* back pointer to pif */ 143 struct altq_pktattr *cl_pktattr; /* saved header used by ECN */ 144 145 /* statistics */ 146 u_int cl_period; /* backlog period */ 147 struct pktcntr cl_xmitcnt; /* transmitted packet counter */ 148 struct pktcntr cl_dropcnt; /* dropped packet counter */ 149}; 150 151/* 152 * priq interface state 153 */ 154struct priq_if { 155 struct priq_if *pif_next; /* interface state list */ 156 struct ifaltq *pif_ifq; /* backpointer to ifaltq */ 157 u_int pif_bandwidth; /* link bandwidth in bps */ 158 int pif_maxpri; /* max priority in use */ 159 struct priq_class *pif_default; /* default class */ 160 struct priq_class *pif_classes[PRIQ_MAXPRI]; /* classes */ 161#ifdef ALTQ3_CLFIER_COMPAT 162 struct acc_classifier pif_classifier; /* classifier */ 163#endif 164}; 165 166#endif /* _KERNEL */ 167 168#ifdef __cplusplus 169} 170#endif 171 172#endif /* _ALTQ_ALTQ_PRIQ_H_ */
|