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.
29 #include <sys/types.h>
30 #include <sys/systm.h>
31 #include <sys/socket.h>
33 #include <machine/bus.h>
36 #include <net/ethernet.h>
38 #include <net/if_var.h>
39 #include <net/if_media.h>
40 #include <net/iflib.h>
41 #include <net/if_private.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)
116 null_needs_restart(if_ctx_t _ctx __unused, enum iflib_restart_event _event __unused)
126 METHOD int attach_pre {
130 METHOD int attach_post {
134 METHOD int reinit_pre {
138 METHOD int reinit_post {
148 } DEFAULT null_int_op;
150 METHOD int shutdown {
152 } DEFAULT null_int_op;
156 } DEFAULT null_int_op;
159 # downcall to driver to allocate its
160 # own queue state and tie it to the parent
163 METHOD int tx_queues_alloc {
171 METHOD int rx_queues_alloc {
179 METHOD void queues_free {
184 # interface reset / stop
196 # interrupt setup and manipulation
199 METHOD int msix_intr_assign {
204 METHOD void intr_enable {
208 METHOD void intr_disable {
212 METHOD int rx_queue_intr_enable {
215 } DEFAULT null_queue_intr_enable;
217 METHOD int tx_queue_intr_enable {
220 } DEFAULT null_queue_intr_enable;
222 METHOD void link_intr_enable {
224 } DEFAULT null_void_op;
226 METHOD void admin_completion_handle {
228 } DEFAULT null_void_op;
231 # interface configuration
234 METHOD void multi_set {
243 METHOD void media_set{
245 } DEFAULT null_void_op;
247 METHOD int promisc_set {
252 METHOD void crcstrip_set {
262 METHOD void vflr_handle {
264 } DEFAULT null_void_op;
266 METHOD int iov_init {
269 const nvlist_t * params;
270 } DEFAULT null_iov_init;
272 METHOD void iov_uninit {
274 } DEFAULT null_void_op;
276 METHOD int iov_vf_add {
279 const nvlist_t * params;
280 } DEFAULT null_vf_add;
287 METHOD void update_admin_status {
291 METHOD void media_status {
293 struct ifmediareq *_ifm;
296 METHOD int media_change {
300 METHOD uint64_t get_counter {
305 METHOD int priv_ioctl {
309 } DEFAULT null_priv_ioctl;
317 struct ifi2creq *_req;
318 } DEFAULT null_i2c_req;
320 METHOD int txq_setup {
323 } DEFAULT null_q_setup;
325 METHOD int rxq_setup {
328 } DEFAULT null_q_setup;
333 } DEFAULT null_timer_op;
335 METHOD void watchdog_reset {
337 } DEFAULT null_void_op;
339 METHOD void led_func {
342 } DEFAULT null_led_func;
344 METHOD void vlan_register {
347 } DEFAULT null_vlan_register_op;
349 METHOD void vlan_unregister {
352 } DEFAULT null_vlan_register_op;
354 METHOD int sysctl_int_delay {
356 if_int_delay_info_t _iidi;
357 } DEFAULT null_sysctl_int_delay;
361 } DEFAULT null_void_op;
363 METHOD bool needs_restart {
365 enum iflib_restart_event _event;
366 } DEFAULT null_needs_restart;