Home | History | Annotate | Line # | Download | only in altq
altq_fifoq.h revision 1.3
      1 /*	$NetBSD: altq_fifoq.h,v 1.3 2004/02/13 18:02:05 wiz Exp $	*/
      2 /*	$KAME: altq_fifoq.h,v 1.6 2000/12/14 08:12:45 thorpej Exp $	*/
      3 
      4 /*
      5  * Copyright (C) 1997-2000
      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_FIFOQ_H_
     31 #define	_ALTQ_ALTQ_FIFOQ_H_
     32 
     33 typedef struct fifoq_state {
     34 	struct fifoq_state *q_next;	/* next fifoq_state in the list */
     35 	struct ifaltq *q_ifq;		/* backpointer to ifaltq */
     36 
     37 	struct mbuf *q_head;		/* head of queue */
     38 	struct mbuf *q_tail;		/* tail of queue */
     39 	int	q_len;			/* queue length */
     40 	int	q_limit;		/* max queue length */
     41 
     42 	/* statistics */
     43 	struct {
     44 		struct pktcntr	xmit_cnt;
     45 		struct pktcntr	drop_cnt;
     46 		u_int		period;
     47 	} q_stats;
     48 } fifoq_state_t;
     49 
     50 struct fifoq_interface {
     51 	char	fifoq_ifname[IFNAMSIZ];
     52 };
     53 
     54 struct fifoq_getstats {
     55 	struct fifoq_interface iface;
     56 	int		q_len;
     57 	int		q_limit;
     58 	struct pktcntr	xmit_cnt;
     59 	struct pktcntr	drop_cnt;
     60 	u_int		period;
     61 };
     62 
     63 struct fifoq_conf {
     64 	struct fifoq_interface iface;
     65 	int fifoq_limit;
     66 };
     67 
     68 #define	FIFOQ_LIMIT	50	/* default max queue length */
     69 
     70 /*
     71  * IOCTLs for FIFOQ
     72  */
     73 #define	FIFOQ_IF_ATTACH		_IOW('Q', 1, struct fifoq_interface)
     74 #define	FIFOQ_IF_DETACH		_IOW('Q', 2, struct fifoq_interface)
     75 #define	FIFOQ_ENABLE		_IOW('Q', 3, struct fifoq_interface)
     76 #define	FIFOQ_DISABLE		_IOW('Q', 4, struct fifoq_interface)
     77 #define	FIFOQ_CONFIG		_IOWR('Q', 6, struct fifoq_conf)
     78 #define	FIFOQ_GETSTATS		_IOWR('Q', 12, struct fifoq_getstats)
     79 
     80 #endif /* _ALTQ_ALTQ_FIFOQ_H_ */
     81