openssl: Adjust manual pages for 1.0.1h.
[dragonfly.git] / sys / net / netisr2.h
1 /*
2  * Copyright (c) 2004 Jeffrey M. Hsu.  All rights reserved.
3  * Copyright (c) 2004 The DragonFly Project.  All rights reserved.
4  * 
5  * This code is derived from software contributed to The DragonFly Project
6  * by Jeffrey M. Hsu.
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  * 3. Neither the name of The DragonFly Project nor the names of its
17  *    contributors may be used to endorse or promote products derived
18  *    from this software without specific, prior written permission.
19  * 
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
24  * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25  * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
26  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
30  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31  * SUCH DAMAGE.
32  */
33
34 /*
35  * Copyright (c) 1980, 1986, 1989, 1993
36  *      The Regents of the University of California.  All rights reserved.
37  *
38  * Redistribution and use in source and binary forms, with or without
39  * modification, are permitted provided that the following conditions
40  * are met:
41  * 1. Redistributions of source code must retain the above copyright
42  *    notice, this list of conditions and the following disclaimer.
43  * 2. Redistributions in binary form must reproduce the above copyright
44  *    notice, this list of conditions and the following disclaimer in the
45  *    documentation and/or other materials provided with the distribution.
46  * 3. All advertising materials mentioning features or use of this software
47  *    must display the following acknowledgement:
48  *      This product includes software developed by the University of
49  *      California, Berkeley and its contributors.
50  * 4. Neither the name of the University nor the names of its contributors
51  *    may be used to endorse or promote products derived from this software
52  *    without specific prior written permission.
53  *
54  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
55  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
56  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
57  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
58  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
59  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
60  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
61  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
62  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
63  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
64  * SUCH DAMAGE.
65  *
66  *      @(#)netisr.h    8.1 (Berkeley) 6/10/93
67  * $FreeBSD: src/sys/net/netisr.h,v 1.21.2.5 2002/02/09 23:02:39 luigi Exp $
68  */
69
70 #ifndef _NET_NETISR2_H_
71 #define _NET_NETISR2_H_
72
73 #ifndef _KERNEL
74 #error "kernel only header file"
75 #endif
76
77 #ifndef _SYS_SYSTM_H_
78 #include <sys/systm.h>
79 #endif
80 #ifndef _SYS_THREAD_H_
81 #include <sys/thread.h>
82 #endif
83 #ifndef _NET_NETISR_H_
84 #include <net/netisr.h>
85 #endif
86
87 extern struct thread netisr_cpu[MAXCPU];
88
89 /*
90  * Return the message port for the general protocol message servicing
91  * thread for a particular cpu.
92  */
93 static __inline lwkt_port_t
94 netisr_cpuport(int cpu)
95 {
96         KKASSERT(cpu >= 0 && cpu < ncpus);
97         return &netisr_cpu[cpu].td_msgport;
98 }
99
100 /*
101  * Return the current cpu's network protocol thread.
102  */
103 static __inline lwkt_port_t
104 netisr_curport(void)
105 {
106         return netisr_cpuport(mycpuid);
107 }
108
109 /*
110  * Return the cpu for the hash.
111  */
112 static __inline int
113 netisr_hashcpu(uint16_t hash)
114 {
115         return (hash & ncpus2_mask);
116 }
117
118 /*
119  * Return the message port for the general protocol message servicing
120  * thread for the hash.
121  */
122 static __inline lwkt_port_t
123 netisr_hashport(uint16_t hash)
124 {
125         return netisr_cpuport(netisr_hashcpu(hash));
126 }
127
128 #define ASSERT_CANDOMSG_NETISR0(td) \
129         KASSERT((td)->td_type != TD_TYPE_NETISR || \
130             &(td)->td_msgport == netisr_cpuport(0), \
131             ("can't domsg to netisr0 in thread %p", (td)))
132
133 #endif  /* _NET_NETISR2_H_ */