1*a3cea1deSKevin Lo.Dd May 21, 2019 2fa504546SEnji Cooper.Dt IFLIBDI 9 334bac11eSSean Bruno.Os 434bac11eSSean Bruno.Sh NAME 534bac11eSSean Bruno.Nm iflibdi 634bac11eSSean Bruno.Nd Device Independent Configuration Functions 734bac11eSSean Bruno.Sh SYNOPSIS 834bac11eSSean Bruno.In "ifdi_if.h" 934bac11eSSean Bruno.Ss "Device Independent Functions" 1034bac11eSSean Bruno.Ft int 11fa504546SEnji Cooper.Fo iflib_device_attach 12fa504546SEnji Cooper.Fa "device_t dev" 13fa504546SEnji Cooper.Fc 1434bac11eSSean Bruno.Ft int 15fa504546SEnji Cooper.Fo iflib_device_detach 16fa504546SEnji Cooper.Fa "device_t dev" 17fa504546SEnji Cooper.Fc 1834bac11eSSean Bruno.Ft int 19fa504546SEnji Cooper.Fo iflib_device_suspend 20fa504546SEnji Cooper.Fa "device_t dev" 21fa504546SEnji Cooper.Fc 2234bac11eSSean Bruno.Ft int 23fa504546SEnji Cooper.Fo iflib_device_resume 24fa504546SEnji Cooper.Fa "device_t dev" 25fa504546SEnji Cooper.Fc 2634bac11eSSean Bruno.Ft int 27fa504546SEnji Cooper.Fo iflib_device_register 28fa504546SEnji Cooper.Fa "device_t dev" 29fa504546SEnji Cooper.Fa "void *softc" 30fa504546SEnji Cooper.Fa "if_shared_ctx_t sctx" 31fa504546SEnji Cooper.Fa "if_ctx_t *ctxp" 32fa504546SEnji Cooper.Fc 3334bac11eSSean Bruno.Ft int 34fa504546SEnji Cooper.Fo iflib_device_deregister 35fa504546SEnji Cooper.Fa "if_ctx_t ctx" 36fa504546SEnji Cooper.Fc 3734bac11eSSean Bruno.Ft int 38fa504546SEnji Cooper.Fo iflib_irq_alloc 39fa504546SEnji Cooper.Fa "if_ctx_t ctx" 40fa504546SEnji Cooper.Fa "if_irq_t irq_info" 41fa504546SEnji Cooper.Fa "int rid" 42fa504546SEnji Cooper.Fa "driver_filter_t filter" 43fa504546SEnji Cooper.Fa "void *filter_arg" 44fa504546SEnji Cooper.Fa "driver_intr_t handler" 45fa504546SEnji Cooper.Fa "void *arg" 46fa504546SEnji Cooper.Fa "char *name" 47fa504546SEnji Cooper.Fc 4834bac11eSSean Bruno.Ft int 49fa504546SEnji Cooper.Fo iflib_irq_alloc_generic 50fa504546SEnji Cooper.Fa "if_ctx_t ctx" 51fa504546SEnji Cooper.Fa "if_irq_t irq" 52fa504546SEnji Cooper.Fa "int rid" 53fa504546SEnji Cooper.Fa "intr_type_t type" 54fa504546SEnji Cooper.Fa "driver_filter_t *filter" 55fa504546SEnji Cooper.Fa "void *filter_arg" 56fa504546SEnji Cooper.Fa "int qid" 57fa504546SEnji Cooper.Fa "char *name" 58fa504546SEnji Cooper.Fc 5934bac11eSSean Bruno.Ft void 60fa504546SEnji Cooper.Fo iflib_led_create 61fa504546SEnji Cooper.Fa "if_ctx_t ctx" 62fa504546SEnji Cooper.Fc 6334bac11eSSean Bruno.Ft void 64fa504546SEnji Cooper.Fo iflib_tx_intr_deferred 65fa504546SEnji Cooper.Fa "if_ctx_t ctx" 66fa504546SEnji Cooper.Fa "int txqid" 67fa504546SEnji Cooper.Fc 6834bac11eSSean Bruno.Ft void 69fa504546SEnji Cooper.Fo iflib_rx_intr_deferred 70fa504546SEnji Cooper.Fa "if_ctx_t ctx" 71fa504546SEnji Cooper.Fa "int rxqid" 72fa504546SEnji Cooper.Fc 7334bac11eSSean Bruno.Ft void 74fa504546SEnji Cooper.Fo iflib_link_intr_deferred 75fa504546SEnji Cooper.Fa "if_ctx_t ctx" 76fa504546SEnji Cooper.Fc 7734bac11eSSean Bruno.Ft void 78fa504546SEnji Cooper.Fo iflib_link_state_change 79fa504546SEnji Cooper.Fa "if_ctx_t ctx" 80fa504546SEnji Cooper.Fa "int linkstate" 81fa504546SEnji Cooper.Fc 8234bac11eSSean Bruno.Ft void 83fa504546SEnji Cooper.Fo iflib_add_int_delay_sysctl 84fa504546SEnji Cooper.Fa "if_ctx_t ctx" 85fa504546SEnji Cooper.Fa "const char *" 86fa504546SEnji Cooper.Fa "const char *" 87fa504546SEnji Cooper.Fa "if_int_delay_info_t" 88fa504546SEnji Cooper.Fa "int" 89fa504546SEnji Cooper.Fa "int" 90fa504546SEnji Cooper.Fc 9134bac11eSSean Bruno.Ss "Global Variables" 9234bac11eSSean Bruno.Vt extern struct if_txrx 9334bac11eSSean Bruno.Sh DATA STRUCTURES 94fa504546SEnji CooperThe \fIif_ctx_t\fP Structure is the device independent data structure that 95fa504546SEnji Coopercontains statistics and identifying information used to transmit and receive 96fa504546SEnji Cooperdata packets. 97fa504546SEnji CooperThe interface is associated with an array of queues assigned sequentially. 98fa504546SEnji CooperEach queue has its own transmit (iflib_txq_t) and receive (iflib_rxq_t) queue. 99fa504546SEnji CooperThe transmit queue is used to hold packets while the interface is in the 100fa504546SEnji Cooperprocess of sending another. 101fa504546SEnji CooperThe receive queue is used to receive packets that are awaiting processing. 10234bac11eSSean Bruno.Ss The if_ctx_t Structure 10334bac11eSSean BrunoThe fields of 10434bac11eSSean Bruno.Vt "struct if_ctx_t" 10534bac11eSSean Brunoare as follows: 10634bac11eSSean Bruno.Bl -tag -width ".Va if_capabilities" -offset indent 10734bac11eSSean Bruno.It Va if_softc 10834bac11eSSean Bruno.Pq Vt "void" 10934bac11eSSean BrunoA pointer to the driver's private state block. 11034bac11eSSean Bruno.It Va ifc_dev 11134bac11eSSean Bruno.Pq Vt "device_t" 11234bac11eSSean BrunoThe underlying device structure. 11334bac11eSSean Bruno.It Va ifc_ip 11434bac11eSSean Bruno.Pq Vt "if_t" 11534bac11eSSean BrunoA link back to the interface structure 11634bac11eSSean Bruno.It Va ifc_cpus 11734bac11eSSean Bruno.Pq Vt "cpuset_t" 11834bac11eSSean Bruno.It Va ifc_mutex 11934bac11eSSean Bruno.Pq Vt "struct mtx" 12034bac11eSSean BrunoMutex lock used to maintain data integrity 12134bac11eSSean Bruno.It Va ifc_mtx_name 12234bac11eSSean Bruno.Pq Vt "char *" 12334bac11eSSean BrunoThe name of the mutex 12434bac11eSSean Bruno.It Va ifc_txqs 12534bac11eSSean Bruno.Pq Vt "iflib_txq_t" 12634bac11eSSean BrunoDevice independent transmit queue maintained internally by iflib 12734bac11eSSean Bruno.It Va ifc_rxqs 12834bac11eSSean Bruno.Pq Vt "iflib_rxq_t" 12934bac11eSSean BrunoDevice independent receive queue maintained internally by iflib 13034bac11eSSean Bruno.It Va ifc_qsets 13134bac11eSSean Bruno.Pq Vt "iflib_qset_t" 132fa504546SEnji CooperOutput queue that contains a single transmit (ifc_txq_t) and receive 133fa504546SEnji Cooper(ifc_rxq_t) queue 13434bac11eSSean Bruno.It Va ifc_if_flags 13534bac11eSSean Bruno.Pq Vt "uint32_t" 13634bac11eSSean BrunoFlags describing the operational parameter of the interface 13734bac11eSSean Bruno.It Va ifc_in_detach 13834bac11eSSean Bruno.Pq Vt "int" 13934bac11eSSean Bruno.It Va ifc_link_state 14034bac11eSSean Bruno.Pq Vt "int" 141fa504546SEnji CooperDescribes the current link state of the Ethernet interface. 142fa504546SEnji CooperIts possible values are either active or inactive. 14334bac11eSSean Bruno.It Va ifc_link_irq 14434bac11eSSean Bruno.Pq Vt "int" 14534bac11eSSean Bruno.It Va ifc_vlan_attach_event 14634bac11eSSean Bruno.Pq Vt "eventhandler_tag" 14734bac11eSSean Bruno.It Va ifc_vlan_detach_event 14834bac11eSSean Bruno.Pq Vt "eventhandler_tag" 14934bac11eSSean Bruno.It Va ifc_pause_frames 15034bac11eSSean Bruno.Pq Vt "int" 15134bac11eSSean Bruno.It Va ifc_watchdog_events 15234bac11eSSean Bruno.Pq Vt "int" 15334bac11eSSean Bruno.It Va ifc_mac 15434bac11eSSean Bruno.Pq Vt "uint8_t" 15534bac11eSSean Bruno.It Va ifc_msix_mem 15634bac11eSSean Bruno.Pq Vt "struct resource *" 15734bac11eSSean Bruno.It Va ifc_legacy_irq 15834bac11eSSean Bruno.Pq Vt "struct if_irq" 15934bac11eSSean Bruno.It Va ifc_admin_task 16034bac11eSSean Bruno.Pq Vt "struct grouptask" 16134bac11eSSean BrunoTaskqueue task scheduled for link state change events of the interface 16234bac11eSSean Bruno.It Va ifc_filter_info 16334bac11eSSean Bruno.Pq Vt "struct iflib_filter_info" 16434bac11eSSean BrunoStatistics and information relating to the interface device filter 16534bac11eSSean Bruno.It Va ifc_media 16634bac11eSSean Bruno.Pq Vt "struct ifmedia" 16734bac11eSSean Bruno.It Va ifc_txrx 16834bac11eSSean Bruno.Pq Vt "struct if_txrx" 16934bac11eSSean Bruno.El 17034bac11eSSean Bruno.Sh FUNCTIONS 171fa504546SEnji CooperThe above named functions are found exclusively in iflib. 172fa504546SEnji CooperThey are independent of the underlying hardware type or configuration. 17334bac11eSSean Bruno.Ss Device Independent Functions 17434bac11eSSean Bruno.Bl -ohang -offset indent 17534bac11eSSean Bruno.It Fn iflib_device_attach 176fa504546SEnji CooperFunction initiates a device registration with the iflib framework. 177fa504546SEnji CooperIt calls the iflib_register function, which is responsible for allocating 178fa504546SEnji Cooperand initializing the \fIif_ctx_t\fP structure. 17934bac11eSSean Bruno.It Fn iflib_device_detach 180fa504546SEnji CooperShutdown and detach the device. 181fa504546SEnji CooperUnregister vlan events, drain any dependent tasks, and release irq, pci, and 182fa504546SEnji Coopermsix memory. 18334bac11eSSean Bruno.It Fn iflib_device_suspend 184fa504546SEnji CooperSuspend a device by calling the device dependent suspend function and 185fa504546SEnji Cooperbus_generic_suspend. 18634bac11eSSean Bruno.It Fn iflib_device_resume 187fa504546SEnji CooperResume a device by calling the device dependent resume function, the 188fa504546SEnji Cooperiflib_init_locked function, and bus_generic_resume. 18934bac11eSSean Bruno.It Fn iflib_device_register 190fa504546SEnji CooperRegister a device with the iflib framework. 191fa504546SEnji CooperAllocate and initialize the 192fa504546SEnji Cooper\fIif_ctx_t\fP structure. 193fa504546SEnji CooperSetup and initialize the MSI or MSI/X interrupt queues if necessary. 194fa504546SEnji CooperAllocate memory for queues and qset structure setup. 195*a3cea1deSKevin Lo.It Fn iflib_irq_alloc 196fa504546SEnji CooperAllocate an interrupt resource for a given rid value with an associated filter 197fa504546SEnji Cooperand handler function. 198*a3cea1deSKevin Lo.It Fn iflib_irq_alloc_generic 199fa504546SEnji CooperPerforms the same function as iflib_device_irq_alloc along with the additional 200fa504546SEnji Cooperfunctionality of adding a taskgroup. 201fa504546SEnji CooperThe data fields and callback function are determined by the type of interrupt, 202fa504546SEnji Coopersuch as 203fa504546SEnji Cooper.Dv IFLIB_INTR_TX , 204fa504546SEnji Cooper.Dv IFLIB_INTR_RX , 205fa504546SEnji Cooperand 206fa504546SEnji Cooper.Dv IFLIB_INTR_ADMIN . 20734bac11eSSean Bruno.It Fn iflib_led_create 20834bac11eSSean BrunoCalls led_create to initialize the ctx->ifc_led_dev field 20934bac11eSSean Bruno.It Fn iflib_tx_intr_deferred 21034bac11eSSean BrunoCalls GROUPTASK_ENQUEUE to enqueue the transfer queues ift_task. 21134bac11eSSean Bruno.It Fn iflib_rx_intr_deferred 21234bac11eSSean BrunoCalls GROUPTASK_ENQUEUE to enqueue the receive queues ifr_task. 21334bac11eSSean Bruno.It Fn iflib_link_intr_deferred 21434bac11eSSean BrunoCalls GROUPTASK_ENQUEUE to enqueue the link task 21534bac11eSSean Bruno.It Fn iflib_link_state_change 216fa504546SEnji CooperChange the interface link status to either 217fa504546SEnji Cooper.Dv LINK_STATE_UP 218fa504546SEnji Cooperor 219fa504546SEnji Cooper.Dv LINK_STATE_DOWN 220fa504546SEnji Cooperas specified by the second argument to the function. 221fa504546SEnji Cooper.Pp 222fa504546SEnji Cooper.Em Interface Link States 22334bac11eSSean BrunoThe following link states are currently defined: 224fa504546SEnji Cooper.It Dv LINK_STATE_UP 225fa504546SEnji CooperThe link is up. 226fa504546SEnji Cooper.It Dv LINK_STATE_DOWN 227fa504546SEnji CooperThe link is down. 22834bac11eSSean Bruno.It Fn iflib_add_int_delay_sysctl 22934bac11eSSean BrunoModifies settings to user defined values for a given set of variables. 23034bac11eSSean Bruno.El 231fa504546SEnji Cooper.Sh SEE ALSO 232fa504546SEnji Cooper.Xr iflibdd 9 , 233fa504546SEnji Cooper.Xr iflibtxrx 9 23434bac11eSSean Bruno.Sh AUTHORS 23534bac11eSSean BrunoThis manual page was written by 23634bac11eSSean Bruno.An Nicole Graziano 237