xref: /freebsd-13-stable/sys/net/iflib_private.h (revision f8167e0404dab9ffeaca95853dd237ab7c587f82)
1 /*-
2  * Copyright (c) 2018, Matthew Macy (mmacy@freebsd.org)
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  *  1. Redistributions of source code must retain the above copyright notice,
9  *     this list of conditions and the following disclaimer.
10  *
11  *  2. Neither the name of Matthew Macy nor the names of its
12  *     contributors may be used to endorse or promote products derived from
13  *     this software without specific prior written permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16  * AND 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 COPYRIGHT OWNER OR CONTRIBUTORS BE
19  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25  * POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #ifndef __NET_IFLIB_PRIVATE_H_
29 #define	__NET_IFLIB_PRIVATE_H_
30 
31 #define	IFC_LEGACY		0x001
32 #define	IFC_QFLUSH		0x002
33 #define	IFC_MULTISEG		0x004
34 #define	IFC_SPARE1		0x008
35 #define	IFC_SC_ALLOCATED	0x010
36 #define	IFC_INIT_DONE		0x020
37 #define	IFC_PREFETCH		0x040
38 #define	IFC_DO_RESET		0x080
39 #define	IFC_DO_WATCHDOG		0x100
40 #define	IFC_SPARE0		0x200
41 #define	IFC_PSEUDO		0x400
42 #define	IFC_IN_DETACH		0x800
43 
44 #define	IFC_NETMAP_TX_IRQ	0x80000000
45 
46 MALLOC_DECLARE(M_IFLIB);
47 
48 struct iflib_cloneattach_ctx {
49 	struct if_clone *cc_ifc;
50 	caddr_t cc_params;
51 	const char *cc_name;
52 	int cc_len;
53 };
54 
55 extern driver_t iflib_pseudodriver;
56 int noop_attach(device_t dev);
57 int iflib_pseudo_detach(device_t dev);
58 
59 int iflib_pseudo_register(device_t dev, if_shared_ctx_t sctx, if_ctx_t *ctxp,
60 	    struct iflib_cloneattach_ctx *clctx);
61 
62 int iflib_pseudo_deregister(if_ctx_t ctx);
63 
64 uint32_t iflib_get_flags(if_ctx_t ctx);
65 void iflib_set_detach(if_ctx_t ctx);
66 void iflib_stop(if_ctx_t ctx);
67 
68 #endif
69