xref: /dragonfly/sys/net/if_poll.h (revision 43437467fdbd94c8c08c994b9ffff422e5a46c98)
1 /*-
2  * Copyright (c) 2001-2002 Luigi Rizzo
3  *
4  * Supported by: the Xorp Project (www.xorp.org)
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25  * SUCH DAMAGE.
26  *
27  * $FreeBSD: src/sys/kern/kern_poll.c,v 1.2.2.4 2002/06/27 23:26:33 luigi Exp $
28  */
29 
30 #ifndef _NET_IF_POLL_H_
31 #define _NET_IF_POLL_H_
32 
33 #ifdef _KERNEL
34 
35 struct sysctl_ctx_list;
36 struct sysctl_oid;
37 struct lwkt_serialize;
38 struct ifnet;
39 
40 typedef   void      (*ifpoll_iofn_t)(struct ifnet *, void *, int);
41 typedef   void      (*ifpoll_stfn_t)(struct ifnet *);
42 
43 struct ifpoll_status {
44           struct lwkt_serialize         *serializer;
45           ifpoll_stfn_t                 status_func;
46 };
47 
48 struct ifpoll_io {
49           struct lwkt_serialize         *serializer;
50           void                          *arg;
51           ifpoll_iofn_t                 poll_func;
52 };
53 
54 struct ifpoll_info {
55           struct ifnet                  *ifpi_ifp;
56           struct ifpoll_status          ifpi_status;
57           struct ifpoll_io    ifpi_rx[MAXCPU];
58           struct ifpoll_io    ifpi_tx[MAXCPU];
59 };
60 
61 struct ifpoll_compat {
62           int                           ifpc_stcount;
63           int                           ifpc_stfrac;
64 
65           int                           ifpc_cpuid;
66           struct lwkt_serialize         *ifpc_serializer;
67 };
68 
69 void      ifpoll_compat_setup(struct ifpoll_compat *, struct sysctl_ctx_list *,
70               struct sysctl_oid *, int, struct lwkt_serialize *);
71 
72 #endif    /* _KERNEL */
73 
74 #endif    /* !_NET_IF_POLL_H_ */
75