The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/net/ifdi_if.m

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 #
    2 # Copyright (c) 2014-2018, Matthew Macy (mmacy@mattmacy.io)
    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 #include <sys/types.h>
   31 #include <sys/systm.h>
   32 #include <sys/socket.h>
   33 
   34 #include <machine/bus.h>
   35 #include <sys/bus.h>
   36 
   37 #include <net/ethernet.h>
   38 #include <net/if.h>
   39 #include <net/if_var.h>
   40 #include <net/if_media.h>
   41 #include <net/iflib.h>
   42 #include <net/if_clone.h>
   43 #include <net/if_dl.h>
   44 #include <net/if_types.h>
   45 
   46 INTERFACE ifdi;
   47 
   48 CODE {
   49 
   50         static void
   51         null_void_op(if_ctx_t _ctx __unused)
   52         {
   53         }
   54 
   55         static int
   56         null_knlist_add(if_ctx_t _ctx __unused, struct knote *_kn)
   57         {
   58             return (0);
   59         }
   60 
   61         static int
   62         null_knote_event(if_ctx_t _ctx __unused, struct knote *_kn, int _hint)
   63         {
   64             return (0);
   65         }
   66 
   67         static void
   68         null_timer_op(if_ctx_t _ctx __unused, uint16_t _qsidx __unused)
   69         {
   70         }
   71 
   72         static int
   73         null_int_op(if_ctx_t _ctx __unused)
   74         {
   75                 return (0);
   76         }
   77 
   78         static int
   79         null_int_int_op(if_ctx_t _ctx __unused, int arg0 __unused)
   80         {
   81                 return (ENOTSUP);
   82         }
   83 
   84         static int
   85         null_queue_intr_enable(if_ctx_t _ctx __unused, uint16_t _qid __unused)
   86         {
   87                 return (ENOTSUP);
   88         }
   89 
   90         static void
   91         null_led_func(if_ctx_t _ctx __unused, int _onoff __unused)
   92         {
   93         }
   94 
   95         static void
   96         null_vlan_register_op(if_ctx_t _ctx __unused, uint16_t vtag __unused)
   97         {
   98         }
   99 
  100         static int
  101         null_q_setup(if_ctx_t _ctx __unused, uint32_t _qid __unused)
  102         {
  103                 return (0);
  104         }
  105 
  106         static int
  107         null_i2c_req(if_ctx_t _sctx __unused, struct ifi2creq *_i2c __unused)
  108         {
  109                 return (ENOTSUP);
  110         }
  111 
  112         static int
  113         null_sysctl_int_delay(if_ctx_t _sctx __unused, if_int_delay_info_t _iidi __unused)
  114         {
  115                 return (0);
  116         }
  117 
  118         static int
  119         null_iov_init(if_ctx_t _ctx __unused, uint16_t num_vfs __unused, const nvlist_t *params __unused)
  120         {
  121                 return (ENOTSUP);
  122         }
  123 
  124         static int
  125         null_vf_add(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_priv_ioctl(if_ctx_t _ctx __unused, u_long command, caddr_t *data __unused)
  132         {
  133                 return (ENOTSUP);
  134         }
  135 
  136         static void
  137         null_media_status(if_ctx_t ctx __unused, struct ifmediareq *ifmr)
  138         {
  139             ifmr->ifm_status = IFM_AVALID | IFM_ACTIVE;
  140             ifmr->ifm_active = IFM_ETHER | IFM_25G_ACC | IFM_FDX;
  141         }
  142 
  143         static int
  144         null_cloneattach(if_ctx_t ctx __unused, struct if_clone *ifc __unused,
  145                          const char *name __unused, caddr_t params __unused)
  146         {
  147             return (0);
  148         }
  149 
  150         static void
  151         null_rx_clset(if_ctx_t _ctx __unused, uint16_t _flid __unused,
  152                       uint16_t _qid __unused, caddr_t *_sdcl __unused)
  153         {
  154         }
  155         static void
  156         null_object_info_get(if_ctx_t ctx __unused, void *data __unused, int size __unused)
  157         {
  158         }
  159         static int
  160         default_mac_set(if_ctx_t ctx, const uint8_t *mac)
  161         {
  162             struct ifnet *ifp = iflib_get_ifp(ctx);
  163             struct sockaddr_dl *sdl;
  164 
  165             if (ifp && ifp->if_addr) {
  166                 sdl = (struct sockaddr_dl *)ifp->if_addr->ifa_addr;
  167                 MPASS(sdl->sdl_type == IFT_ETHER);
  168                 memcpy(LLADDR(sdl), mac, ETHER_ADDR_LEN);
  169             }
  170             return (0);
  171         }
  172 
  173         static bool
  174         null_needs_restart(if_ctx_t _ctx __unused, enum iflib_restart_event _event __unused)
  175         {
  176                 return (true);
  177         }
  178 };
  179 
  180 #
  181 # kevent interfaces
  182 #
  183 
  184 METHOD int knlist_add {
  185         if_ctx_t _ctx;
  186         struct knote *_kn;
  187 } DEFAULT null_knlist_add;
  188 
  189 METHOD int knote_event {
  190         if_ctx_t _ctx;
  191         struct knote *_kn;
  192         int hint;
  193 } DEFAULT null_knote_event;
  194 
  195 
  196 #
  197 # query
  198 #
  199 
  200 METHOD int object_info_get {
  201         if_ctx_t _ctx;
  202         void *data;
  203         int size;
  204 } DEFAULT null_object_info_get;
  205 
  206 #
  207 # bus interfaces
  208 #
  209 
  210 METHOD int attach_pre {
  211         if_ctx_t _ctx;
  212 } DEFAULT null_int_op;
  213 
  214 METHOD int attach_post {
  215         if_ctx_t _ctx;
  216 } DEFAULT null_int_op;
  217 
  218 METHOD int reinit_pre {
  219         if_ctx_t _ctx;
  220 } DEFAULT null_int_op;
  221 
  222 METHOD int reinit_post {
  223         if_ctx_t _ctx;
  224 } DEFAULT null_int_op;
  225 
  226 METHOD int cloneattach {
  227         if_ctx_t _ctx;
  228         struct if_clone *_ifc;
  229         const char *_name;
  230         caddr_t params;
  231 } DEFAULT null_cloneattach;
  232 
  233 METHOD int detach {
  234         if_ctx_t _ctx;
  235 };
  236 
  237 METHOD int suspend {
  238         if_ctx_t _ctx;
  239 } DEFAULT null_int_op;
  240 
  241 METHOD int shutdown {
  242         if_ctx_t _ctx;
  243 } DEFAULT null_int_op;
  244 
  245 METHOD int resume {
  246         if_ctx_t _ctx;
  247 } DEFAULT null_int_op;
  248 
  249 #
  250 # downcall to driver to allocate its
  251 # own queue state and tie it to the parent
  252 #
  253 
  254 METHOD int tx_queues_alloc {
  255         if_ctx_t _ctx;
  256         caddr_t *_vaddrs;
  257         uint64_t *_paddrs;
  258         int ntxqs;
  259         int ntxqsets;
  260 };
  261 
  262 METHOD int rx_queues_alloc {
  263         if_ctx_t _ctx;
  264         caddr_t *_vaddrs;
  265         uint64_t *_paddrs;
  266         int nrxqs;
  267         int nrxqsets;
  268 };
  269 
  270 METHOD void queues_free {
  271         if_ctx_t _ctx;
  272 } DEFAULT null_void_op;
  273 
  274 METHOD void rx_clset {
  275         if_ctx_t _ctx;
  276         uint16_t _fl;
  277         uint16_t _qsetid;
  278         caddr_t *_sdcl;
  279 } DEFAULT null_rx_clset;
  280 
  281 #
  282 # interface reset / stop
  283 #
  284 
  285 METHOD void init {
  286         if_ctx_t _ctx;
  287 };
  288 
  289 METHOD void stop {
  290         if_ctx_t _ctx;
  291 };
  292 
  293 #
  294 # interrupt setup and manipulation
  295 #
  296 
  297 METHOD int msix_intr_assign {
  298         if_ctx_t _sctx;
  299         int msix;
  300 } DEFAULT null_int_int_op;
  301 
  302 METHOD void intr_enable {
  303         if_ctx_t _ctx;
  304 };
  305 
  306 METHOD void intr_disable {
  307         if_ctx_t _ctx;
  308 };
  309 
  310 METHOD int rx_queue_intr_enable {
  311         if_ctx_t _ctx;
  312         uint16_t _qid;
  313 } DEFAULT null_queue_intr_enable;
  314 
  315 METHOD int tx_queue_intr_enable {
  316         if_ctx_t _ctx;
  317         uint16_t _qid;
  318 } DEFAULT null_queue_intr_enable;
  319 
  320 METHOD void link_intr_enable {
  321         if_ctx_t _ctx;
  322 } DEFAULT null_void_op;
  323 
  324 #
  325 # interface configuration
  326 #
  327 
  328 METHOD void multi_set {
  329         if_ctx_t _ctx;
  330 };
  331 
  332 METHOD int mtu_set {
  333         if_ctx_t _ctx;
  334         uint32_t _mtu;
  335 };
  336 METHOD int mac_set {
  337         if_ctx_t _ctx;
  338         const uint8_t *_mac;
  339 } DEFAULT default_mac_set;
  340 
  341 METHOD void media_set{
  342         if_ctx_t _ctx;
  343 } DEFAULT null_void_op;
  344 
  345 METHOD int promisc_set {
  346         if_ctx_t _ctx;
  347         int _flags;
  348 };
  349 
  350 METHOD void crcstrip_set {
  351         if_ctx_t _ctx;
  352         int _onoff;
  353         int _strip;
  354 };
  355 
  356 #
  357 # IOV handling
  358 #
  359 
  360 METHOD void vflr_handle {
  361         if_ctx_t _ctx;
  362 } DEFAULT null_void_op;
  363 
  364 METHOD int iov_init {
  365         if_ctx_t _ctx;
  366         uint16_t num_vfs;
  367         const nvlist_t * params;
  368 } DEFAULT null_iov_init;
  369 
  370 METHOD void iov_uninit {
  371         if_ctx_t _ctx;
  372 } DEFAULT null_void_op;
  373 
  374 METHOD int iov_vf_add {
  375         if_ctx_t _ctx;
  376         uint16_t num_vfs;
  377         const nvlist_t * params;
  378 } DEFAULT null_vf_add;
  379 
  380 
  381 #
  382 # Device status
  383 #
  384 
  385 METHOD void update_admin_status {
  386         if_ctx_t _ctx;
  387 };
  388 
  389 METHOD void media_status {
  390         if_ctx_t _ctx;
  391         struct ifmediareq *_ifm;
  392 } DEFAULT null_media_status;
  393 
  394 METHOD int media_change {
  395         if_ctx_t _ctx;
  396 } DEFAULT null_int_op;
  397 
  398 METHOD uint64_t get_counter {
  399         if_ctx_t _ctx;
  400         ift_counter cnt;
  401 };
  402 
  403 METHOD int priv_ioctl {
  404         if_ctx_t _ctx;
  405         u_long   _cmd;
  406         caddr_t _data;
  407 } DEFAULT null_priv_ioctl;
  408 
  409 #
  410 # optional methods
  411 #
  412 
  413 METHOD int i2c_req {
  414         if_ctx_t _ctx;
  415         struct ifi2creq *_req;
  416 } DEFAULT null_i2c_req;
  417 
  418 METHOD int txq_setup {
  419         if_ctx_t _ctx;
  420         uint32_t _txqid;
  421 } DEFAULT null_q_setup;
  422 
  423 METHOD int rxq_setup {
  424         if_ctx_t _ctx;
  425         uint32_t _txqid;
  426 } DEFAULT null_q_setup;
  427 
  428 METHOD void timer {
  429         if_ctx_t _ctx;
  430         uint16_t _txqid;
  431 } DEFAULT null_timer_op;
  432 
  433 METHOD void watchdog_reset {
  434         if_ctx_t _ctx;
  435 } DEFAULT null_void_op;
  436 
  437 METHOD void watchdog_reset_queue {
  438         if_ctx_t _ctx;
  439         uint16_t _q;
  440 } DEFAULT null_timer_op;
  441 
  442 METHOD void led_func {
  443         if_ctx_t _ctx;
  444         int _onoff;
  445 } DEFAULT null_led_func;
  446 
  447 METHOD void vlan_register {
  448         if_ctx_t _ctx;
  449         uint16_t _vtag;
  450 } DEFAULT null_vlan_register_op;
  451 
  452 METHOD void vlan_unregister {
  453         if_ctx_t _ctx;
  454         uint16_t _vtag;
  455 } DEFAULT null_vlan_register_op;
  456 
  457 METHOD int sysctl_int_delay {
  458         if_ctx_t _sctx;
  459         if_int_delay_info_t _iidi;
  460 } DEFAULT null_sysctl_int_delay;
  461 
  462 METHOD void debug {
  463         if_ctx_t _ctx;
  464 } DEFAULT null_void_op;
  465 
  466 METHOD bool needs_restart {
  467         if_ctx_t _ctx;
  468         enum iflib_restart_event _event;
  469 } DEFAULT null_needs_restart;

Cache object: 26768f38c3fe09378fb5175f9328fff6


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.