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 * $FreeBSD$
28 */
29
30#ifndef __NET_IFLIB_PRIVATE_H_
31#define	__NET_IFLIB_PRIVATE_H_
32
33#define	IFC_LEGACY		0x001
34#define	IFC_QFLUSH		0x002
35#define	IFC_MULTISEG		0x004
36#define	IFC_SPARE1		0x008
37#define	IFC_SC_ALLOCATED	0x010
38#define	IFC_INIT_DONE		0x020
39#define	IFC_PREFETCH		0x040
40#define	IFC_DO_RESET		0x080
41#define	IFC_DO_WATCHDOG		0x100
42#define	IFC_SPARE0		0x200
43#define	IFC_PSEUDO		0x400
44#define	IFC_IN_DETACH		0x800
45
46#define	IFC_NETMAP_TX_IRQ	0x80000000
47
48MALLOC_DECLARE(M_IFLIB);
49
50struct iflib_cloneattach_ctx {
51	struct if_clone *cc_ifc;
52	caddr_t cc_params;
53	const char *cc_name;
54	int cc_len;
55};
56
57extern driver_t iflib_pseudodriver;
58int noop_attach(device_t dev);
59int iflib_pseudo_detach(device_t dev);
60
61int iflib_pseudo_register(device_t dev, if_shared_ctx_t sctx, if_ctx_t *ctxp,
62	    struct iflib_cloneattach_ctx *clctx);
63
64int iflib_pseudo_deregister(if_ctx_t ctx);
65
66uint32_t iflib_get_flags(if_ctx_t ctx);
67void iflib_set_detach(if_ctx_t ctx);
68void iflib_stop(if_ctx_t ctx);
69
70#endif
71