1*34bac11eSSean Bruno.\" $FreeBSD$ 2*34bac11eSSean Bruno.Dd January 27, 2017 3*34bac11eSSean Bruno.Dt IFlIBDI(9) 4*34bac11eSSean Bruno.Os 5*34bac11eSSean Bruno.Sh NAME 6*34bac11eSSean Bruno.Nm iflibdi 7*34bac11eSSean Bruno.Nd Device Independent Configuration Functions 8*34bac11eSSean Bruno.Sh SYNOPSIS 9*34bac11eSSean Bruno.In "ifdi_if.h" 10*34bac11eSSean Bruno.Ss "Device Independent Functions" 11*34bac11eSSean Bruno.Ft int 12*34bac11eSSean Bruno.Fn iflib_device_attach "device_t dev" 13*34bac11eSSean Bruno.Ft int 14*34bac11eSSean Bruno.Fn iflib_device_detach "device_t dev" 15*34bac11eSSean Bruno.Ft int 16*34bac11eSSean Bruno.Fn iflib_device_suspend "device_t dev" 17*34bac11eSSean Bruno.Ft int 18*34bac11eSSean Bruno.Fn iflib_device_resume "device_t dev" 19*34bac11eSSean Bruno.Ft int 20*34bac11eSSean Bruno.Fn iflib_device_register "device_t dev, void *softc, if_shared_ctx_t sctx, if_ctx_t *ctxp" 21*34bac11eSSean Bruno.Ft int 22*34bac11eSSean Bruno.Fn iflib_device_deregister "if_ctx_t ctx" 23*34bac11eSSean Bruno.Ft int 24*34bac11eSSean Bruno.Fn iflib_irq_alloc "if_ctx_t ctx, if_irq_t irq_info, int rid, driver_filter_t filter, void *filter_arg, driver_intr_t handler, void *arg, char *name" 25*34bac11eSSean Bruno.Ft int 26*34bac11eSSean Bruno.Fn iflib_irq_alloc_generic "if_ctx_t, ctx, if_irq_t irq, int rid, intr_type_t type, driver_filter_t *filter, void *filter_arg, int qid, char *name" 27*34bac11eSSean Bruno.Ft void 28*34bac11eSSean Bruno.Fn iflib_led_create "if_ctx_t ctx" 29*34bac11eSSean Bruno.Ft void 30*34bac11eSSean Bruno.Fn iflib_tx_intr_deferred "if_ctx_t ctx, int txqid" 31*34bac11eSSean Bruno.Ft void 32*34bac11eSSean Bruno.Fn iflib_rx_intr_deferred "if_ctx_t ctx, int rxqid" 33*34bac11eSSean Bruno.Ft void 34*34bac11eSSean Bruno.Fn iflib_link_intr_deferred "if_ctx_t ctx" 35*34bac11eSSean Bruno.Ft void 36*34bac11eSSean Bruno.Fn iflib_link_state_change "if_ctx_t ctx, int linkstate" 37*34bac11eSSean Bruno.Ft void 38*34bac11eSSean Bruno.Fn iflib_led_create "if_ctx_t ctx" 39*34bac11eSSean Bruno.Ft void 40*34bac11eSSean Bruno.Fn iflib_add_int_delay_sysctl "if_ctx_t ctx, const char *, const char *, if_int_delay_info_t, int, int" 41*34bac11eSSean Bruno.Ss "Global Variables" 42*34bac11eSSean Bruno.Vt extern struct if_txrx 43*34bac11eSSean Bruno.Sh DATA STRUCTURES 44*34bac11eSSean BrunoThe \fIif_ctx_t\fP Structure is the device independent data structure that contains statistics and identifying information used to transmit and receive data packets. The interface is associated with an array of queues assigned sequentially. Each queu has its own transmit (iflib_txq_t) and receive (iflib_rxq_t) queue. The transmit queue is used to hold packets while the interface is in the process of sending another. The receive queue is used to receive packets that are awaiting processing. 45*34bac11eSSean Bruno.Pp 46*34bac11eSSean Bruno.Ss The if_ctx_t Structure 47*34bac11eSSean BrunoThe fields of 48*34bac11eSSean Bruno.Vt "struct if_ctx_t" 49*34bac11eSSean Brunoare as follows: 50*34bac11eSSean Bruno.Bl -tag -width ".Va if_capabilities" -offset indent 51*34bac11eSSean Bruno.It Va if_softc 52*34bac11eSSean Bruno.Pq Vt "void" 53*34bac11eSSean BrunoA pointer to the driver's private state block. 54*34bac11eSSean Bruno.It Va ifc_dev 55*34bac11eSSean Bruno.Pq Vt "device_t" 56*34bac11eSSean BrunoThe underlying device structure. 57*34bac11eSSean Bruno.It Va ifc_ip 58*34bac11eSSean Bruno.Pq Vt "if_t" 59*34bac11eSSean BrunoA link back to the interface structure 60*34bac11eSSean Bruno.It Va ifc_cpus 61*34bac11eSSean Bruno.Pq Vt "cpuset_t" 62*34bac11eSSean Bruno.It Va ifc_mutex 63*34bac11eSSean Bruno.Pq Vt "struct mtx" 64*34bac11eSSean BrunoMutex lock used to maintain data integrity 65*34bac11eSSean Bruno.It Va ifc_mtx_name 66*34bac11eSSean Bruno.Pq Vt "char *" 67*34bac11eSSean BrunoThe name of the mutex 68*34bac11eSSean Bruno.It Va ifc_txqs 69*34bac11eSSean Bruno.Pq Vt "iflib_txq_t" 70*34bac11eSSean BrunoDevice independent transmit queue maintained internally by iflib 71*34bac11eSSean Bruno.It Va ifc_rxqs 72*34bac11eSSean Bruno.Pq Vt "iflib_rxq_t" 73*34bac11eSSean BrunoDevice independent receive queue maintained internally by iflib 74*34bac11eSSean Bruno.It Va ifc_qsets 75*34bac11eSSean Bruno.Pq Vt "iflib_qset_t" 76*34bac11eSSean Bruno Output queue that contains a single transmit (ifc_txq_t) and receive (ifc_rxq_t) queue 77*34bac11eSSean Bruno.It Va ifc_if_flags 78*34bac11eSSean Bruno.Pq Vt "uint32_t" 79*34bac11eSSean BrunoFlags describing the operational parameter of the interface 80*34bac11eSSean Bruno.It Va ifc_in_detach 81*34bac11eSSean Bruno.Pq Vt "int" 82*34bac11eSSean Bruno.It Va ifc_link_state 83*34bac11eSSean Bruno.Pq Vt "int" 84*34bac11eSSean BrunoDescribes the current link state of the Ethernet interface. It's possible values are either active or inactive. 85*34bac11eSSean Bruno.It Va ifc_link_irq 86*34bac11eSSean Bruno.Pq Vt "int" 87*34bac11eSSean Bruno.It Va ifc_vlan_attach_event 88*34bac11eSSean Bruno.Pq Vt "eventhandler_tag" 89*34bac11eSSean Bruno.It Va ifc_vlan_detach_event 90*34bac11eSSean Bruno.Pq Vt "eventhandler_tag" 91*34bac11eSSean Bruno.It Va ifc_pause_frames 92*34bac11eSSean Bruno.Pq Vt "int" 93*34bac11eSSean Bruno.It Va ifc_watchdog_events 94*34bac11eSSean Bruno.Pq Vt "int" 95*34bac11eSSean Bruno.It Va ifc_mac 96*34bac11eSSean Bruno.Pq Vt "uint8_t" 97*34bac11eSSean Bruno.It Va ifc_msix_mem 98*34bac11eSSean Bruno.Pq Vt "struct resource *" 99*34bac11eSSean Bruno.It Va ifc_legacy_irq 100*34bac11eSSean Bruno.Pq Vt "struct if_irq" 101*34bac11eSSean Bruno.It Va ifc_admin_task 102*34bac11eSSean Bruno.Pq Vt "struct grouptask" 103*34bac11eSSean BrunoTaskqueue task scheduled for link state change events of the interface 104*34bac11eSSean Bruno.It Va ifc_filter_info 105*34bac11eSSean Bruno.Pq Vt "struct iflib_filter_info" 106*34bac11eSSean BrunoStatistics and information relating to the interface device filter 107*34bac11eSSean Bruno.It Va ifc_media 108*34bac11eSSean Bruno.Pq Vt "struct ifmedia" 109*34bac11eSSean Bruno.It Va ifc_txrx 110*34bac11eSSean Bruno.Pq Vt "struct if_txrx" 111*34bac11eSSean Bruno.El 112*34bac11eSSean Bruno.Sh FUNCTIONS 113*34bac11eSSean Bruno The above named functions are found exclusively in iflib. They are independent of the underlying hardware type or configuration. 114*34bac11eSSean Bruno.Ss Device Independent Functions 115*34bac11eSSean Bruno.Bl -ohang -offset indent 116*34bac11eSSean Bruno.It Fn iflib_device_attach 117*34bac11eSSean BrunoFunction initiates a device registration with the iflib framework. It calls the iflib_register function, which is responsible for allocating and initializing the \fIif_ctx_t\fP structure. 118*34bac11eSSean Bruno.It Fn iflib_device_detach 119*34bac11eSSean BrunoShutdown and detach the device. Unregister vlan events, drain any dependent tasks, and release irq, pci, and msix memory. 120*34bac11eSSean Bruno.It Fn iflib_device_suspend 121*34bac11eSSean BrunoSuspend a device by calling the device dependent suspend function and bus_generic_suspend. 122*34bac11eSSean Bruno.It Fn iflib_device_resume 123*34bac11eSSean BrunoResume a device by calling the device dependent resume function, the iflib_init_locked function, and bus_generic_resume. 124*34bac11eSSean Bruno.It Fn iflib_device_register 125*34bac11eSSean BrunoRegister a device with the iflib framework. Allocate and initialize the \fIif_ctx_t\fP structure. Setup and initialize the MSI or MSI/X interrupt queues if necessary. Allocate memory for queues and qset structure setup. 126*34bac11eSSean Bruno.It Fn iflib_device_irq_alloc 127*34bac11eSSean BrunoAllocate an interrupt resource for a given rid value with an associated filter and handler function. 128*34bac11eSSean Bruno.It Fn iflib_device_irq_alloc_generic 129*34bac11eSSean BrunoPerforms the same function as iflib_device_irq_alloc along with the additional functionality of adding a taskgroup. The data fields and callback function are determined by the type of interrupt, such as IFLIB_INTR_TX, IFLIB_INTR_RX, and IFLIB_INTR_ADMIN. 130*34bac11eSSean Bruno.It Fn iflib_led_create 131*34bac11eSSean BrunoCalls led_create to initialize the ctx->ifc_led_dev field 132*34bac11eSSean Bruno.It Fn iflib_tx_intr_deferred 133*34bac11eSSean BrunoCalls GROUPTASK_ENQUEUE to enqueue the transfer queues ift_task. 134*34bac11eSSean Bruno.It Fn iflib_rx_intr_deferred 135*34bac11eSSean BrunoCalls GROUPTASK_ENQUEUE to enqueue the receive queues ifr_task. 136*34bac11eSSean Bruno.It Fn iflib_link_intr_deferred 137*34bac11eSSean BrunoCalls GROUPTASK_ENQUEUE to enqueue the link task 138*34bac11eSSean Bruno.It Fn iflib_link_state_change 139*34bac11eSSean BrunoChange the interface link status to either LINK_STATE_UP or LINK_STATE_DOWN as specified by the second argument to the function. 140*34bac11eSSean Bruno\fBInterface Link States\fP 141*34bac11eSSean BrunoThe following link states are currently defined: 142*34bac11eSSean Bruno 143*34bac11eSSean Bruno LINK_STATE_UP The link is up. 144*34bac11eSSean Bruno LINK_STATE_DOWN The link is down. 145*34bac11eSSean Bruno.It Fn iflib_add_int_delay_sysctl 146*34bac11eSSean BrunoModifies settings to user defined values for a given set of variables. 147*34bac11eSSean Bruno.El 148*34bac11eSSean Bruno.Sh "SEE ALSO" 149*34bac11eSSean Bruno iflibtxrx(9), iflibdd(9) 150*34bac11eSSean Bruno.Sh AUTHORS 151*34bac11eSSean BrunoThis manual page was written by 152*34bac11eSSean Bruno.An Nicole Graziano 153