2 # Copyright (c) 2014, Matthew Macy (mmacy@mattmacy.io)
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions are met:
8 # 1. Redistributions of source code must retain the above copyright notice,
9 # this list of conditions and the following disclaimer.
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.
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.
30 #include <sys/types.h>
31 #include <sys/systm.h>
32 #include <sys/socket.h>
34 #include <machine/bus.h>
37 #include <net/ethernet.h>
39 #include <net/if_var.h>
40 #include <net/if_media.h>
41 #include <net/iflib.h>
48 null_void_op(if_ctx_t _ctx __unused)
53 null_timer_op(if_ctx_t _ctx __unused, uint16_t _qsidx __unused)
58 null_int_op(if_ctx_t _ctx __unused)
64 null_queue_intr_enable(if_ctx_t _ctx __unused, uint16_t _qid __unused)
70 null_led_func(if_ctx_t _ctx __unused, int _onoff __unused)
75 null_vlan_register_op(if_ctx_t _ctx __unused, uint16_t vtag __unused)
80 null_q_setup(if_ctx_t _ctx __unused, uint32_t _qid __unused)
86 null_i2c_req(if_ctx_t _sctx __unused, struct ifi2creq *_i2c __unused)
92 null_sysctl_int_delay(if_ctx_t _sctx __unused, if_int_delay_info_t _iidi __unused)
98 null_iov_init(if_ctx_t _ctx __unused, uint16_t num_vfs __unused, const nvlist_t *params __unused)
104 null_vf_add(if_ctx_t _ctx __unused, uint16_t num_vfs __unused, const nvlist_t *params __unused)
110 null_priv_ioctl(if_ctx_t _ctx __unused, u_long command, caddr_t *data __unused)
120 METHOD int attach_pre {
124 METHOD int attach_post {
134 } DEFAULT null_int_op;
136 METHOD int shutdown {
138 } DEFAULT null_int_op;
142 } DEFAULT null_int_op;
145 # downcall to driver to allocate its
146 # own queue state and tie it to the parent
149 METHOD int tx_queues_alloc {
157 METHOD int rx_queues_alloc {
165 METHOD void queues_free {
170 # interface reset / stop
182 # interrupt setup and manipulation
185 METHOD int msix_intr_assign {
190 METHOD void intr_enable {
194 METHOD void intr_disable {
198 METHOD int rx_queue_intr_enable {
201 } DEFAULT null_queue_intr_enable;
203 METHOD int tx_queue_intr_enable {
206 } DEFAULT null_queue_intr_enable;
208 METHOD void link_intr_enable {
210 } DEFAULT null_void_op;
213 # interface configuration
216 METHOD void multi_set {
225 METHOD void media_set{
227 } DEFAULT null_void_op;
229 METHOD int promisc_set {
234 METHOD void crcstrip_set {
244 METHOD void vflr_handle {
246 } DEFAULT null_void_op;
248 METHOD int iov_init {
251 const nvlist_t * params;
252 } DEFAULT null_iov_init;
254 METHOD void iov_uninit {
256 } DEFAULT null_void_op;
258 METHOD int iov_vf_add {
261 const nvlist_t * params;
262 } DEFAULT null_vf_add;
269 METHOD void update_admin_status {
273 METHOD void media_status {
275 struct ifmediareq *_ifm;
278 METHOD int media_change {
282 METHOD uint64_t get_counter {
287 METHOD int priv_ioctl {
291 } DEFAULT null_priv_ioctl;
299 struct ifi2creq *_req;
300 } DEFAULT null_i2c_req;
302 METHOD int txq_setup {
305 } DEFAULT null_q_setup;
307 METHOD int rxq_setup {
310 } DEFAULT null_q_setup;
315 } DEFAULT null_timer_op;
317 METHOD void watchdog_reset {
319 } DEFAULT null_void_op;
321 METHOD void led_func {
324 } DEFAULT null_led_func;
326 METHOD void vlan_register {
329 } DEFAULT null_vlan_register_op;
331 METHOD void vlan_unregister {
334 } DEFAULT null_vlan_register_op;
336 METHOD int sysctl_int_delay {
338 if_int_delay_info_t _iidi;
339 } DEFAULT null_sysctl_int_delay;
343 } DEFAULT null_void_op;