xref: /dragonfly/sys/net/altq/altq_var.h (revision 0085a56d)
1 /*	$KAME: altq_var.h,v 1.17 2004/04/20 05:09:08 kjc Exp $	*/
2 
3 /*
4  * Copyright (C) 1998-2003
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 #ifndef _ALTQ_ALTQ_VAR_H_
29 #define	_ALTQ_ALTQ_VAR_H_
30 
31 #ifdef _KERNEL
32 
33 #ifndef _SYS_PARAM_H_
34 #include <sys/param.h>
35 #endif
36 #ifndef _SYS_KERNEL_H_
37 #include <sys/kernel.h>
38 #endif
39 #ifndef _SYS_QUEUE_H_
40 #include <sys/queue.h>
41 #endif
42 
43 #ifdef MALLOC_DECLARE
44 MALLOC_DECLARE(M_ALTQ);
45 #endif
46 
47 /*
48  * machine dependent clock
49  * a 64bit high resolution time counter.
50  */
51 extern uint64_t	machclk_freq;
52 extern uint32_t	machclk_per_tick;
53 
54 void		init_machclk(void);
55 uint64_t	read_machclk(void);
56 
57 #define	m_pktlen(m)		((m)->m_pkthdr.len)
58 
59 extern int pfaltq_running;
60 
61 struct ifnet;
62 struct mbuf;
63 struct pf_altq;
64 struct pf_mtag;
65 
66 void	*altq_lookup(const char *, int);
67 uint8_t	read_dsfield(struct mbuf *, struct altq_pktattr *);
68 void	write_dsfield(struct mbuf *, struct altq_pktattr *, uint8_t);
69 int	tbr_set(struct ifaltq *, struct tb_profile *);
70 int	tbr_get(struct ifaltq *, struct tb_profile *);
71 
72 int	altq_pfattach(struct pf_altq *);
73 int	altq_pfdetach(struct pf_altq *);
74 int	altq_add(struct pf_altq *);
75 int	altq_remove(struct pf_altq *);
76 int	altq_add_queue(struct pf_altq *);
77 int	altq_remove_queue(struct pf_altq *);
78 int	altq_getqstats(struct pf_altq *, void *, int *);
79 
80 int	cbq_pfattach(struct pf_altq *, struct ifaltq *);
81 int	cbq_add_altq(struct pf_altq *);
82 int	cbq_remove_altq(struct pf_altq *);
83 int	cbq_add_queue(struct pf_altq *);
84 int	cbq_remove_queue(struct pf_altq *);
85 int	cbq_getqstats(struct pf_altq *, void *, int *);
86 
87 int	priq_pfattach(struct pf_altq *, struct ifaltq *);
88 int	priq_add_altq(struct pf_altq *);
89 int	priq_remove_altq(struct pf_altq *);
90 int	priq_add_queue(struct pf_altq *);
91 int	priq_remove_queue(struct pf_altq *);
92 int	priq_getqstats(struct pf_altq *, void *, int *);
93 
94 int	hfsc_pfattach(struct pf_altq *, struct ifaltq *);
95 int	hfsc_add_altq(struct pf_altq *);
96 int	hfsc_remove_altq(struct pf_altq *);
97 int	hfsc_add_queue(struct pf_altq *);
98 int	hfsc_remove_queue(struct pf_altq *);
99 int	hfsc_getqstats(struct pf_altq *, void *, int *);
100 
101 int	fairq_pfattach(struct pf_altq *, struct ifaltq *);
102 int	fairq_add_altq(struct pf_altq *);
103 int	fairq_remove_altq(struct pf_altq *);
104 int	fairq_add_queue(struct pf_altq *);
105 int	fairq_remove_queue(struct pf_altq *);
106 int	fairq_getqstats(struct pf_altq *, void *, int *);
107 
108 #endif /* _KERNEL */
109 #endif /* _ALTQ_ALTQ_VAR_H_ */
110