1 1.5 ozaki /* $NetBSD: qop_cbq.h,v 1.5 2024/12/24 08:35:28 ozaki-r Exp $ */ 2 1.1 thorpej /* $KAME: qop_cbq.h,v 1.2 2000/10/18 09:15:18 kjc Exp $ */ 3 1.1 thorpej /* 4 1.1 thorpej * Copyright (c) Sun Microsystems, Inc. 1993-1998 All rights reserved. 5 1.1 thorpej * 6 1.1 thorpej * Redistribution and use in source and binary forms, with or without 7 1.1 thorpej * modification, are permitted provided that the following conditions 8 1.1 thorpej * are met: 9 1.1 thorpej * 10 1.1 thorpej * 1. Redistributions of source code must retain the above copyright 11 1.1 thorpej * notice, this list of conditions and the following disclaimer. 12 1.1 thorpej * 13 1.1 thorpej * 2. Redistributions in binary form must reproduce the above copyright 14 1.1 thorpej * notice, this list of conditions and the following disclaimer in the 15 1.1 thorpej * documentation and/or other materials provided with the distribution. 16 1.1 thorpej * 17 1.1 thorpej * 3. All advertising materials mentioning features or use of this software 18 1.1 thorpej * must display the following acknowledgement: 19 1.1 thorpej * This product includes software developed by the SMCC Technology 20 1.1 thorpej * Development Group at Sun Microsystems, Inc. 21 1.1 thorpej * 22 1.1 thorpej * 4. The name of the Sun Microsystems, Inc nor may not be used to endorse or 23 1.1 thorpej * promote products derived from this software without specific prior 24 1.1 thorpej * written permission. 25 1.1 thorpej * 26 1.1 thorpej * SUN MICROSYSTEMS DOES NOT CLAIM MERCHANTABILITY OF THIS SOFTWARE OR THE 27 1.1 thorpej * SUITABILITY OF THIS SOFTWARE FOR ANY PARTICULAR PURPOSE. The software is 28 1.1 thorpej * provided "as is" without express or implied warranty of any kind. 29 1.1 thorpej * 30 1.1 thorpej * These notices must be retained in any copies of any part of this software. 31 1.1 thorpej */ 32 1.1 thorpej 33 1.1 thorpej #include <altq/altq_rmclass.h> 34 1.1 thorpej #include <altq/altq_cbq.h> 35 1.1 thorpej 36 1.1 thorpej /* cbq admission types */ 37 1.1 thorpej typedef enum { 38 1.1 thorpej CBQ_QOS_NONE, 39 1.1 thorpej CBQ_QOS_GUARANTEED, 40 1.1 thorpej CBQ_QOS_PREDICTIVE, 41 1.1 thorpej CBQ_QOS_CNTR_DELAY, 42 1.1 thorpej CBQ_QOS_CNTR_LOAD 43 1.1 thorpej } cbq_tos_t; 44 1.1 thorpej 45 1.1 thorpej /* 46 1.1 thorpej * cbq private ifinfo structure 47 1.1 thorpej */ 48 1.1 thorpej struct cbq_ifinfo { 49 1.1 thorpej struct classinfo *root_class; /* root class */ 50 1.1 thorpej struct classinfo *default_class; /* default class */ 51 1.1 thorpej struct classinfo *ctl_class; /* control class */ 52 1.1 thorpej 53 1.4 ozaki double psPerByte; /* bandwidth in ps per sec */ 54 1.1 thorpej int is_wrr; /* use weighted-round robin */ 55 1.1 thorpej int is_efficient; /* use work-conserving */ 56 1.3 ozaki bool no_control; /* don't create a control class automatically */ 57 1.1 thorpej }; 58 1.1 thorpej 59 1.1 thorpej /* 60 1.1 thorpej * cbq private classinfo structure 61 1.1 thorpej */ 62 1.1 thorpej struct cbq_classinfo { 63 1.5 ozaki uint64_t bandwidth; /* bandwidth in bps */ 64 1.5 ozaki uint64_t allocated; /* bandwidth used by children */ 65 1.1 thorpej 66 1.1 thorpej u_int maxdelay; 67 1.1 thorpej u_int maxburst; 68 1.1 thorpej u_int minburst; 69 1.1 thorpej u_int av_pkt_size; 70 1.1 thorpej u_int max_pkt_size; 71 1.1 thorpej 72 1.1 thorpej cbq_class_spec_t class_spec; /* class parameters */ 73 1.1 thorpej }; 74 1.1 thorpej 75 1.1 thorpej int cbq_interface_parser(const char *ifname, int argc, char **argv); 76 1.1 thorpej int cbq_class_parser(const char *ifname, const char *class_name, 77 1.1 thorpej const char *parent_name, int argc, char **argv); 78 1.1 thorpej 79 1.5 ozaki int qcmd_cbq_add_if(const char *ifname, uint64_t bandwidth, 80 1.3 ozaki int is_wrr, int efficient, bool no_control); 81 1.1 thorpej int qcmd_cbq_add_class(const char *ifname, const char *class_name, 82 1.1 thorpej const char *parent_name, const char *borrow_name, 83 1.5 ozaki u_int pri, uint64_t bandwidth, 84 1.1 thorpej u_int maxdelay, u_int maxburst, u_int minburst, 85 1.1 thorpej u_int av_pkt_size, u_int max_pkt_size, 86 1.1 thorpej int admission_type, int flags); 87 1.1 thorpej int qcmd_cbq_modify_class(const char *ifname, const char *class_name, 88 1.5 ozaki u_int pri, uint64_t bandwidth, 89 1.1 thorpej u_int maxdelay, u_int maxburst, u_int minburst, 90 1.1 thorpej u_int av_pkt_size, u_int max_pkt_size, int flags); 91 1.1 thorpej 92 1.1 thorpej int qop_cbq_add_if(struct ifinfo **rp, const char *ifname, 93 1.5 ozaki uint64_t bandwidth, int is_wrr, int efficient, bool no_control); 94 1.1 thorpej int qop_cbq_add_class(struct classinfo **rp, const char *class_name, 95 1.1 thorpej struct ifinfo *ifinfo, struct classinfo *parent, 96 1.5 ozaki struct classinfo *borrow, u_int pri, uint64_t bandwidth, 97 1.1 thorpej u_int maxdelay, u_int maxburst, u_int minburst, 98 1.1 thorpej u_int av_pkt_size, u_int max_pkt_size, 99 1.1 thorpej int admission_type, int flags); 100 1.5 ozaki int qop_cbq_modify_class(struct classinfo *clinfo, u_int pri, uint64_t bandwidth, 101 1.1 thorpej u_int maxdelay, u_int maxburst, u_int minburst, 102 1.1 thorpej u_int av_pkt_size, u_int max_pkt_size, int flags); 103 1.1 thorpej 104