| 1 | /*	$NetBSD: altq_fifoq.h,v 1.7 2006/10/12 19:59:08 peter Exp $	*/ |
| 2 | /*	$KAME: altq_fifoq.h,v 1.8 2002/11/29 04:36:23 kjc Exp $	*/ |
| 3 | |
| 4 | /* |
| 5 | * Copyright (C) 1997-2002 |
| 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 | #ifdef _KERNEL |
| 34 | typedef struct fifoq_state { |
| 35 | 	struct fifoq_state *q_next;	/* next fifoq_state in the list */ |
| 36 | 	struct ifaltq *q_ifq;		/* backpointer to ifaltq */ |
| 37 | |
| 38 | 	struct mbuf *q_head;		/* head of queue */ |
| 39 | 	struct mbuf *q_tail;		/* tail of queue */ |
| 40 | 	int	q_len;			/* queue length */ |
| 41 | 	int	q_limit;		/* max queue length */ |
| 42 | |
| 43 | 	/* statistics */ |
| 44 | 	struct { |
| 45 | 		struct pktcntr	xmit_cnt; |
| 46 | 		struct pktcntr	drop_cnt; |
| 47 | 		u_int		period; |
| 48 | 	} q_stats; |
| 49 | } fifoq_state_t; |
| 50 | #endif |
| 51 | |
| 52 | struct fifoq_interface { |
| 53 | 	char	fifoq_ifname[IFNAMSIZ]; |
| 54 | }; |
| 55 | |
| 56 | struct fifoq_getstats { |
| 57 | 	struct fifoq_interface iface; |
| 58 | 	int		q_len; |
| 59 | 	int		q_limit; |
| 60 | 	struct pktcntr	xmit_cnt; |
| 61 | 	struct pktcntr	drop_cnt; |
| 62 | 	u_int		period; |
| 63 | }; |
| 64 | |
| 65 | struct fifoq_conf { |
| 66 | 	struct fifoq_interface iface; |
| 67 | 	int fifoq_limit; |
| 68 | }; |
| 69 | |
| 70 | #define	FIFOQ_LIMIT	50	/* default max queue length */ |
| 71 | |
| 72 | /* |
| 73 | * IOCTLs for FIFOQ |
| 74 | */ |
| 75 | #define	FIFOQ_IF_ATTACH		_IOW('Q', 1, struct fifoq_interface) |
| 76 | #define	FIFOQ_IF_DETACH		_IOW('Q', 2, struct fifoq_interface) |
| 77 | #define	FIFOQ_ENABLE		_IOW('Q', 3, struct fifoq_interface) |
| 78 | #define	FIFOQ_DISABLE		_IOW('Q', 4, struct fifoq_interface) |
| 79 | #define	FIFOQ_CONFIG		_IOWR('Q', 6, struct fifoq_conf) |
| 80 | #define	FIFOQ_GETSTATS		_IOWR('Q', 12, struct fifoq_getstats) |
| 81 | |
| 82 | #endif /* _ALTQ_ALTQ_FIFOQ_H_ */ |