xref: /netbsd/sys/altq/altq_fifoq.h (revision dd191f37)
1*dd191f37Speter /*	$NetBSD: altq_fifoq.h,v 1.7 2006/10/12 19:59:08 peter Exp $	*/
2*dd191f37Speter /*	$KAME: altq_fifoq.h,v 1.8 2002/11/29 04:36:23 kjc Exp $	*/
368de460fSthorpej 
468de460fSthorpej /*
5*dd191f37Speter  * Copyright (C) 1997-2002
668de460fSthorpej  *	Sony Computer Science Laboratories Inc.  All rights reserved.
768de460fSthorpej  *
868de460fSthorpej  * Redistribution and use in source and binary forms, with or without
968de460fSthorpej  * modification, are permitted provided that the following conditions
1068de460fSthorpej  * are met:
1168de460fSthorpej  * 1. Redistributions of source code must retain the above copyright
1268de460fSthorpej  *    notice, this list of conditions and the following disclaimer.
1368de460fSthorpej  * 2. Redistributions in binary form must reproduce the above copyright
1468de460fSthorpej  *    notice, this list of conditions and the following disclaimer in the
1568de460fSthorpej  *    documentation and/or other materials provided with the distribution.
1668de460fSthorpej  *
1768de460fSthorpej  * THIS SOFTWARE IS PROVIDED BY SONY CSL AND CONTRIBUTORS ``AS IS'' AND
1868de460fSthorpej  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1968de460fSthorpej  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2068de460fSthorpej  * ARE DISCLAIMED.  IN NO EVENT SHALL SONY CSL OR CONTRIBUTORS BE LIABLE
2168de460fSthorpej  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2268de460fSthorpej  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2368de460fSthorpej  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2468de460fSthorpej  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2568de460fSthorpej  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2668de460fSthorpej  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2768de460fSthorpej  * SUCH DAMAGE.
2868de460fSthorpej  */
2968de460fSthorpej 
3068de460fSthorpej #ifndef _ALTQ_ALTQ_FIFOQ_H_
3168de460fSthorpej #define	_ALTQ_ALTQ_FIFOQ_H_
3268de460fSthorpej 
33afa9c2cdSitojun #ifdef _KERNEL
3468de460fSthorpej typedef struct fifoq_state {
3568de460fSthorpej 	struct fifoq_state *q_next;	/* next fifoq_state in the list */
3668de460fSthorpej 	struct ifaltq *q_ifq;		/* backpointer to ifaltq */
3768de460fSthorpej 
3868de460fSthorpej 	struct mbuf *q_head;		/* head of queue */
3968de460fSthorpej 	struct mbuf *q_tail;		/* tail of queue */
4068de460fSthorpej 	int	q_len;			/* queue length */
4168de460fSthorpej 	int	q_limit;		/* max queue length */
4268de460fSthorpej 
4368de460fSthorpej 	/* statistics */
4468de460fSthorpej 	struct {
4568de460fSthorpej 		struct pktcntr	xmit_cnt;
4668de460fSthorpej 		struct pktcntr	drop_cnt;
4768de460fSthorpej 		u_int		period;
4868de460fSthorpej 	} q_stats;
4968de460fSthorpej } fifoq_state_t;
50afa9c2cdSitojun #endif
5168de460fSthorpej 
5268de460fSthorpej struct fifoq_interface {
5368de460fSthorpej 	char	fifoq_ifname[IFNAMSIZ];
5468de460fSthorpej };
5568de460fSthorpej 
5668de460fSthorpej struct fifoq_getstats {
5768de460fSthorpej 	struct fifoq_interface iface;
5868de460fSthorpej 	int		q_len;
5968de460fSthorpej 	int		q_limit;
6068de460fSthorpej 	struct pktcntr	xmit_cnt;
6168de460fSthorpej 	struct pktcntr	drop_cnt;
6268de460fSthorpej 	u_int		period;
6368de460fSthorpej };
6468de460fSthorpej 
6568de460fSthorpej struct fifoq_conf {
6668de460fSthorpej 	struct fifoq_interface iface;
6768de460fSthorpej 	int fifoq_limit;
6868de460fSthorpej };
6968de460fSthorpej 
70e365329bSwiz #define	FIFOQ_LIMIT	50	/* default max queue length */
7168de460fSthorpej 
7268de460fSthorpej /*
7368de460fSthorpej  * IOCTLs for FIFOQ
7468de460fSthorpej  */
7568de460fSthorpej #define	FIFOQ_IF_ATTACH		_IOW('Q', 1, struct fifoq_interface)
7668de460fSthorpej #define	FIFOQ_IF_DETACH		_IOW('Q', 2, struct fifoq_interface)
7768de460fSthorpej #define	FIFOQ_ENABLE		_IOW('Q', 3, struct fifoq_interface)
7868de460fSthorpej #define	FIFOQ_DISABLE		_IOW('Q', 4, struct fifoq_interface)
7968de460fSthorpej #define	FIFOQ_CONFIG		_IOWR('Q', 6, struct fifoq_conf)
8068de460fSthorpej #define	FIFOQ_GETSTATS		_IOWR('Q', 12, struct fifoq_getstats)
8168de460fSthorpej 
8268de460fSthorpej #endif /* _ALTQ_ALTQ_FIFOQ_H_ */
83