]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/net/iflib_private.h
Followup to r347996
[FreeBSD/FreeBSD.git] / sys / net / iflib_private.h
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
34 #define IFC_LEGACY              0x001
35 #define IFC_QFLUSH              0x002
36 #define IFC_MULTISEG            0x004
37 #define IFC_SPARE1              0x008
38 #define IFC_SC_ALLOCATED        0x010
39 #define IFC_INIT_DONE           0x020
40 #define IFC_PREFETCH            0x040
41 #define IFC_DO_RESET            0x080
42 #define IFC_DO_WATCHDOG         0x100
43 #define IFC_CHECK_HUNG          0x200
44 #define IFC_PSEUDO              0x400
45 #define IFC_IN_DETACH           0x800
46
47 #define IFC_NETMAP_TX_IRQ       0x80000000
48
49 MALLOC_DECLARE(M_IFLIB);
50
51 #define IFLIB_MAX_TX_BYTES              (2*1024*1024)
52 #define IFLIB_MIN_TX_BYTES              (8*1024)
53 #define IFLIB_DEFAULT_TX_QDEPTH 2048
54
55
56 struct iflib_cloneattach_ctx {
57         struct if_clone *cc_ifc;
58         caddr_t cc_params;
59         const char *cc_name;
60         int cc_len;
61 };
62
63 extern driver_t iflib_pseudodriver;
64 int noop_attach(device_t dev);
65 int iflib_pseudo_detach(device_t dev);
66
67 int iflib_pseudo_register(device_t dev, if_shared_ctx_t sctx, if_ctx_t *ctxp,
68             struct iflib_cloneattach_ctx *clctx);
69
70 int iflib_pseudo_deregister(if_ctx_t ctx);
71
72 uint32_t iflib_get_flags(if_ctx_t ctx);
73 void iflib_set_detach(if_ctx_t ctx);
74 void iflib_stop(if_ctx_t ctx);
75
76 #endif