Home | History | Annotate | Line # | Download | only in altq
altq_fifoq.h revision 1.1
      1 /*	$KAME: altq_fifoq.h,v 1.6 2000/12/14 08:12:45 thorpej Exp $	*/
      2 
      3 /*
      4  * Copyright (C) 1997-2000
      5  *	Sony Computer Science Laboratories Inc.  All rights reserved.
      6  *
      7  * Redistribution and use in source and binary forms, with or without
      8  * modification, are permitted provided that the following conditions
      9  * are met:
     10  * 1. Redistributions of source code must retain the above copyright
     11  *    notice, this list of conditions and the following disclaimer.
     12  * 2. Redistributions in binary form must reproduce the above copyright
     13  *    notice, this list of conditions and the following disclaimer in the
     14  *    documentation and/or other materials provided with the distribution.
     15  *
     16  * THIS SOFTWARE IS PROVIDED BY SONY CSL AND CONTRIBUTORS ``AS IS'' AND
     17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     19  * ARE DISCLAIMED.  IN NO EVENT SHALL SONY CSL OR CONTRIBUTORS BE LIABLE
     20  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     21  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     22  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     23  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     24  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     26  * SUCH DAMAGE.
     27  */
     28 
     29 #ifndef _ALTQ_ALTQ_FIFOQ_H_
     30 #define	_ALTQ_ALTQ_FIFOQ_H_
     31 
     32 typedef struct fifoq_state {
     33 	struct fifoq_state *q_next;	/* next fifoq_state in the list */
     34 	struct ifaltq *q_ifq;		/* backpointer to ifaltq */
     35 
     36 	struct mbuf *q_head;		/* head of queue */
     37 	struct mbuf *q_tail;		/* tail of queue */
     38 	int	q_len;			/* queue length */
     39 	int	q_limit;		/* max queue length */
     40 
     41 	/* statistics */
     42 	struct {
     43 		struct pktcntr	xmit_cnt;
     44 		struct pktcntr	drop_cnt;
     45 		u_int		period;
     46 	} q_stats;
     47 } fifoq_state_t;
     48 
     49 struct fifoq_interface {
     50 	char	fifoq_ifname[IFNAMSIZ];
     51 };
     52 
     53 struct fifoq_getstats {
     54 	struct fifoq_interface iface;
     55 	int		q_len;
     56 	int		q_limit;
     57 	struct pktcntr	xmit_cnt;
     58 	struct pktcntr	drop_cnt;
     59 	u_int		period;
     60 };
     61 
     62 struct fifoq_conf {
     63 	struct fifoq_interface iface;
     64 	int fifoq_limit;
     65 };
     66 
     67 #define	FIFOQ_LIMIT	50	/* default max queue lenght */
     68 
     69 /*
     70  * IOCTLs for FIFOQ
     71  */
     72 #define	FIFOQ_IF_ATTACH		_IOW('Q', 1, struct fifoq_interface)
     73 #define	FIFOQ_IF_DETACH		_IOW('Q', 2, struct fifoq_interface)
     74 #define	FIFOQ_ENABLE		_IOW('Q', 3, struct fifoq_interface)
     75 #define	FIFOQ_DISABLE		_IOW('Q', 4, struct fifoq_interface)
     76 #define	FIFOQ_CONFIG		_IOWR('Q', 6, struct fifoq_conf)
     77 #define	FIFOQ_GETSTATS		_IOWR('Q', 12, struct fifoq_getstats)
     78 
     79 #endif /* _ALTQ_ALTQ_FIFOQ_H_ */
     80