1 /* 2 * This file is produced automatically. 3 * Do not modify anything in here by hand. 4 * 5 * Created from source file 6 * sys/net/ifdi_if.m 7 # 8 # Copyright (c) 2014-2018, Matthew Macy (mmacy@mattmacy.io) 9 # All rights reserved. 10 # 11 # Redistribution and use in source and binary forms, with or without 12 # modification, are permitted provided that the following conditions are met: 13 # 14 # 1. Redistributions of source code must retain the above copyright notice, 15 # this list of conditions and the following disclaimer. 16 # 17 # 2. Neither the name of Matthew Macy nor the names of its 18 # contributors may be used to endorse or promote products derived from 19 # this software without specific prior written permission. 20 # 21 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 25 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 # POSSIBILITY OF SUCH DAMAGE. 32 */ 33 34 #include <sys/param.h> 35 #include <sys/queue.h> 36 #include <sys/kernel.h> 37 #include <sys/kobj.h> 38 #include <sys/types.h> 39 #include <sys/systm.h> 40 #include <sys/socket.h> 41 #include <machine/bus.h> 42 #include <sys/bus.h> 43 #include <net/ethernet.h> 44 #include <net/if.h> 45 #include <net/if_var.h> 46 #include <net/if_media.h> 47 #include <net/iflib.h> 48 #include <net/if_dl.h> 49 #include <net/if_types.h> 50 #include <ifdi_if.h> 51 52 53 54 static void 55 null_void_op(if_ctx_t _ctx __unused) 56 { 57 } 58 59 #ifndef __HAIKU__ 60 static int 61 null_knlist_add(if_ctx_t _ctx __unused, struct knote *_kn) 62 { 63 return (0); 64 } 65 66 static int 67 null_knote_event(if_ctx_t _ctx __unused, struct knote *_kn, int _hint) 68 { 69 return (0); 70 } 71 #endif 72 73 static void 74 null_timer_op(if_ctx_t _ctx __unused, uint16_t _qsidx __unused) 75 { 76 } 77 78 static int 79 null_int_op(if_ctx_t _ctx __unused) 80 { 81 return (0); 82 } 83 84 static int 85 null_int_int_op(if_ctx_t _ctx __unused, int arg0 __unused) 86 { 87 return (ENOTSUP); 88 } 89 90 static int 91 null_queue_intr_enable(if_ctx_t _ctx __unused, uint16_t _qid __unused) 92 { 93 return (ENOTSUP); 94 } 95 96 static void 97 null_led_func(if_ctx_t _ctx __unused, int _onoff __unused) 98 { 99 } 100 101 static void 102 null_vlan_register_op(if_ctx_t _ctx __unused, uint16_t vtag __unused) 103 { 104 } 105 106 static int 107 null_q_setup(if_ctx_t _ctx __unused, uint32_t _qid __unused) 108 { 109 return (0); 110 } 111 112 static int 113 null_i2c_req(if_ctx_t _sctx __unused, struct ifi2creq *_i2c __unused) 114 { 115 return (ENOTSUP); 116 } 117 118 static int 119 null_sysctl_int_delay(if_ctx_t _sctx __unused, if_int_delay_info_t _iidi __unused) 120 { 121 return (0); 122 } 123 124 static int 125 null_iov_init(if_ctx_t _ctx __unused, uint16_t num_vfs __unused, const nvlist_t *params __unused) 126 { 127 return (ENOTSUP); 128 } 129 130 static int 131 null_vf_add(if_ctx_t _ctx __unused, uint16_t num_vfs __unused, const nvlist_t *params __unused) 132 { 133 return (ENOTSUP); 134 } 135 136 static int 137 null_priv_ioctl(if_ctx_t _ctx __unused, u_long command, caddr_t *data __unused) 138 { 139 return (ENOTSUP); 140 } 141 142 static void 143 null_media_status(if_ctx_t ctx __unused, struct ifmediareq *ifmr) 144 { 145 ifmr->ifm_status = IFM_AVALID | IFM_ACTIVE; 146 ifmr->ifm_active = IFM_ETHER | IFM_FDX; 147 } 148 149 static int 150 null_cloneattach(if_ctx_t ctx __unused, struct if_clone *ifc __unused, 151 const char *name __unused, caddr_t params __unused) 152 { 153 return (0); 154 } 155 156 static void 157 null_rx_clset(if_ctx_t _ctx __unused, uint16_t _flid __unused, 158 uint16_t _qid __unused, caddr_t *_sdcl __unused) 159 { 160 } 161 static void 162 null_object_info_get(if_ctx_t ctx __unused, void *data __unused, int size __unused) 163 { 164 } 165 static int 166 default_mac_set(if_ctx_t ctx, const uint8_t *mac) 167 { 168 struct ifnet *ifp = iflib_get_ifp(ctx); 169 struct sockaddr_dl *sdl; 170 171 if (ifp && ifp->if_addr) { 172 sdl = (struct sockaddr_dl *)ifp->if_addr->ifa_addr; 173 MPASS(sdl->sdl_type == IFT_ETHER); 174 memcpy(LLADDR(sdl), mac, ETHER_ADDR_LEN); 175 } 176 return (0); 177 } 178 179 #ifndef __HAIKU__ 180 struct kobjop_desc ifdi_knlist_add_desc = { 181 0, { NULL, ID_ifdi_knlist_add, (kobjop_t)null_knlist_add } 182 }; 183 184 struct kobjop_desc ifdi_knote_event_desc = { 185 0, { NULL, ID_ifdi_knote_event, (kobjop_t)null_knote_event } 186 }; 187 #endif 188 189 struct kobjop_desc ifdi_object_info_get_desc = { 190 0, { NULL, ID_ifdi_object_info_get, (kobjop_t)null_object_info_get } 191 }; 192 193 struct kobjop_desc ifdi_attach_pre_desc = { 194 0, { NULL, ID_ifdi_attach_pre, (kobjop_t)null_int_op } 195 }; 196 197 struct kobjop_desc ifdi_attach_post_desc = { 198 0, { NULL, ID_ifdi_attach_post, (kobjop_t)null_int_op } 199 }; 200 201 struct kobjop_desc ifdi_reinit_pre_desc = { 202 0, { NULL, ID_ifdi_reinit_pre, (kobjop_t)null_int_op } 203 }; 204 205 struct kobjop_desc ifdi_reinit_post_desc = { 206 0, { NULL, ID_ifdi_reinit_post, (kobjop_t)null_int_op } 207 }; 208 209 struct kobjop_desc ifdi_cloneattach_desc = { 210 0, { NULL, ID_ifdi_cloneattach, (kobjop_t)null_cloneattach } 211 }; 212 213 struct kobjop_desc ifdi_detach_desc = { 214 0, { NULL, ID_ifdi_detach, (kobjop_t)kobj_error_method } 215 }; 216 217 struct kobjop_desc ifdi_suspend_desc = { 218 0, { NULL, ID_ifdi_suspend, (kobjop_t)null_int_op } 219 }; 220 221 struct kobjop_desc ifdi_shutdown_desc = { 222 0, { NULL, ID_ifdi_shutdown, (kobjop_t)null_int_op } 223 }; 224 225 struct kobjop_desc ifdi_resume_desc = { 226 0, { NULL, ID_ifdi_resume, (kobjop_t)null_int_op } 227 }; 228 229 struct kobjop_desc ifdi_tx_queues_alloc_desc = { 230 0, { NULL, ID_ifdi_tx_queues_alloc, (kobjop_t)kobj_error_method } 231 }; 232 233 struct kobjop_desc ifdi_rx_queues_alloc_desc = { 234 0, { NULL, ID_ifdi_rx_queues_alloc, (kobjop_t)kobj_error_method } 235 }; 236 237 struct kobjop_desc ifdi_queues_free_desc = { 238 0, { NULL, ID_ifdi_queues_free, (kobjop_t)null_void_op } 239 }; 240 241 struct kobjop_desc ifdi_rx_clset_desc = { 242 0, { NULL, ID_ifdi_rx_clset, (kobjop_t)null_rx_clset } 243 }; 244 245 struct kobjop_desc ifdi_init_desc = { 246 0, { NULL, ID_ifdi_init, (kobjop_t)kobj_error_method } 247 }; 248 249 struct kobjop_desc ifdi_stop_desc = { 250 0, { NULL, ID_ifdi_stop, (kobjop_t)kobj_error_method } 251 }; 252 253 struct kobjop_desc ifdi_msix_intr_assign_desc = { 254 0, { NULL, ID_ifdi_msix_intr_assign, (kobjop_t)null_int_int_op } 255 }; 256 257 struct kobjop_desc ifdi_intr_enable_desc = { 258 0, { NULL, ID_ifdi_intr_enable, (kobjop_t)kobj_error_method } 259 }; 260 261 struct kobjop_desc ifdi_intr_disable_desc = { 262 0, { NULL, ID_ifdi_intr_disable, (kobjop_t)kobj_error_method } 263 }; 264 265 struct kobjop_desc ifdi_rx_queue_intr_enable_desc = { 266 0, { NULL, ID_ifdi_rx_queue_intr_enable, (kobjop_t)null_queue_intr_enable } 267 }; 268 269 struct kobjop_desc ifdi_tx_queue_intr_enable_desc = { 270 0, { NULL, ID_ifdi_tx_queue_intr_enable, (kobjop_t)null_queue_intr_enable } 271 }; 272 273 struct kobjop_desc ifdi_link_intr_enable_desc = { 274 0, { NULL, ID_ifdi_link_intr_enable, (kobjop_t)null_void_op } 275 }; 276 277 struct kobjop_desc ifdi_multi_set_desc = { 278 0, { NULL, ID_ifdi_multi_set, (kobjop_t)kobj_error_method } 279 }; 280 281 struct kobjop_desc ifdi_mtu_set_desc = { 282 0, { NULL, ID_ifdi_mtu_set, (kobjop_t)kobj_error_method } 283 }; 284 285 struct kobjop_desc ifdi_mac_set_desc = { 286 0, { NULL, ID_ifdi_mac_set, (kobjop_t)default_mac_set } 287 }; 288 289 struct kobjop_desc ifdi_media_set_desc = { 290 0, { NULL, ID_ifdi_media_set, (kobjop_t)null_void_op } 291 }; 292 293 struct kobjop_desc ifdi_promisc_set_desc = { 294 0, { NULL, ID_ifdi_promisc_set, (kobjop_t)kobj_error_method } 295 }; 296 297 struct kobjop_desc ifdi_crcstrip_set_desc = { 298 0, { NULL, ID_ifdi_crcstrip_set, (kobjop_t)kobj_error_method } 299 }; 300 301 struct kobjop_desc ifdi_vflr_handle_desc = { 302 0, { NULL, ID_ifdi_vflr_handle, (kobjop_t)null_void_op } 303 }; 304 305 struct kobjop_desc ifdi_iov_init_desc = { 306 0, { NULL, ID_ifdi_iov_init, (kobjop_t)null_iov_init } 307 }; 308 309 struct kobjop_desc ifdi_iov_uninit_desc = { 310 0, { NULL, ID_ifdi_iov_uninit, (kobjop_t)null_void_op } 311 }; 312 313 struct kobjop_desc ifdi_iov_vf_add_desc = { 314 0, { NULL, ID_ifdi_iov_vf_add, (kobjop_t)null_vf_add } 315 }; 316 317 struct kobjop_desc ifdi_update_admin_status_desc = { 318 0, { NULL, ID_ifdi_update_admin_status, (kobjop_t)kobj_error_method } 319 }; 320 321 struct kobjop_desc ifdi_media_status_desc = { 322 0, { NULL, ID_ifdi_media_status, (kobjop_t)null_media_status } 323 }; 324 325 struct kobjop_desc ifdi_media_change_desc = { 326 0, { NULL, ID_ifdi_media_change, (kobjop_t)null_int_op } 327 }; 328 329 struct kobjop_desc ifdi_get_counter_desc = { 330 0, { NULL, ID_ifdi_get_counter, (kobjop_t)kobj_error_method } 331 }; 332 333 struct kobjop_desc ifdi_priv_ioctl_desc = { 334 0, { NULL, ID_ifdi_priv_ioctl, (kobjop_t)null_priv_ioctl } 335 }; 336 337 struct kobjop_desc ifdi_i2c_req_desc = { 338 0, { NULL, ID_ifdi_i2c_req, (kobjop_t)null_i2c_req } 339 }; 340 341 struct kobjop_desc ifdi_txq_setup_desc = { 342 0, { NULL, ID_ifdi_txq_setup, (kobjop_t)null_q_setup } 343 }; 344 345 struct kobjop_desc ifdi_rxq_setup_desc = { 346 0, { NULL, ID_ifdi_rxq_setup, (kobjop_t)null_q_setup } 347 }; 348 349 struct kobjop_desc ifdi_timer_desc = { 350 0, { NULL, ID_ifdi_timer, (kobjop_t)null_timer_op } 351 }; 352 353 struct kobjop_desc ifdi_watchdog_reset_desc = { 354 0, { NULL, ID_ifdi_watchdog_reset, (kobjop_t)null_void_op } 355 }; 356 357 struct kobjop_desc ifdi_watchdog_reset_queue_desc = { 358 0, { NULL, ID_ifdi_watchdog_reset_queue, (kobjop_t)null_timer_op } 359 }; 360 361 struct kobjop_desc ifdi_led_func_desc = { 362 0, { NULL, ID_ifdi_led_func, (kobjop_t)null_led_func } 363 }; 364 365 struct kobjop_desc ifdi_vlan_register_desc = { 366 0, { NULL, ID_ifdi_vlan_register, (kobjop_t)null_vlan_register_op } 367 }; 368 369 struct kobjop_desc ifdi_vlan_unregister_desc = { 370 0, { NULL, ID_ifdi_vlan_unregister, (kobjop_t)null_vlan_register_op } 371 }; 372 373 struct kobjop_desc ifdi_sysctl_int_delay_desc = { 374 0, { NULL, ID_ifdi_sysctl_int_delay, (kobjop_t)null_sysctl_int_delay } 375 }; 376 377 struct kobjop_desc ifdi_debug_desc = { 378 0, { NULL, ID_ifdi_debug, (kobjop_t)null_void_op } 379 }; 380