.Dd May 21, 2019 .Dt IFLIBDI 9 .Os .Sh NAME .Nm iflibdi .Nd Device Independent Configuration Functions .Sh SYNOPSIS n "ifdi_if.h" .Ss "Device Independent Functions" .Ft int .Fo iflib_device_attach .Fa "device_t dev" .Fc .Ft int .Fo iflib_device_detach .Fa "device_t dev" .Fc .Ft int .Fo iflib_device_suspend .Fa "device_t dev" .Fc .Ft int .Fo iflib_device_resume .Fa "device_t dev" .Fc .Ft int .Fo iflib_device_register .Fa "device_t dev" .Fa "void *softc" .Fa "if_shared_ctx_t sctx" .Fa "if_ctx_t *ctxp" .Fc .Ft int .Fo iflib_device_deregister .Fa "if_ctx_t ctx" .Fc .Ft int .Fo iflib_irq_alloc .Fa "if_ctx_t ctx" .Fa "if_irq_t irq_info" .Fa "int rid" .Fa "driver_filter_t filter" .Fa "void *filter_arg" .Fa "driver_intr_t handler" .Fa "void *arg" .Fa "char *name" .Fc .Ft int .Fo iflib_irq_alloc_generic .Fa "if_ctx_t ctx" .Fa "if_irq_t irq" .Fa "int rid" .Fa "intr_type_t type" .Fa "driver_filter_t *filter" .Fa "void *filter_arg" .Fa "int qid" .Fa "char *name" .Fc .Ft void .Fo iflib_led_create .Fa "if_ctx_t ctx" .Fc .Ft void .Fo iflib_tx_intr_deferred .Fa "if_ctx_t ctx" .Fa "int txqid" .Fc .Ft void .Fo iflib_rx_intr_deferred .Fa "if_ctx_t ctx" .Fa "int rxqid" .Fc .Ft void .Fo iflib_link_intr_deferred .Fa "if_ctx_t ctx" .Fc .Ft void .Fo iflib_link_state_change .Fa "if_ctx_t ctx" .Fa "int linkstate" .Fc .Ft void .Fo iflib_add_int_delay_sysctl .Fa "if_ctx_t ctx" .Fa "const char *" .Fa "const char *" .Fa "if_int_delay_info_t" .Fa "int" .Fa "int" .Fc .Ss "Global Variables" .Vt extern struct if_txrx .Sh DATA STRUCTURES The if_ctx_t 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 queue 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.
p .Ss The if_ctx_t Structure The fields of .Vt "struct if_ctx_t" are as follows: l -tag -width ".Va if_capabilities" -offset indent t Va if_softc
q Vt "void" A pointer to the driver's private state block. t Va ifc_dev
q Vt "device_t" The underlying device structure. t Va ifc_ip
q Vt "if_t" A link back to the interface structure t Va ifc_cpus
q Vt "cpuset_t" t Va ifc_mutex
q Vt "struct mtx" Mutex lock used to maintain data integrity t Va ifc_mtx_name
q Vt "char *" The name of the mutex t Va ifc_txqs
q Vt "iflib_txq_t" Device independent transmit queue maintained internally by iflib t Va ifc_rxqs
q Vt "iflib_rxq_t" Device independent receive queue maintained internally by iflib t Va ifc_qsets
q Vt "iflib_qset_t" Output queue that contains a single transmit (ifc_txq_t) and receive (ifc_rxq_t) queue t Va ifc_if_flags
q Vt "uint32_t" Flags describing the operational parameter of the interface t Va ifc_in_detach
q Vt "int" t Va ifc_link_state
q Vt "int" Describes the current link state of the Ethernet interface. Its possible values are either active or inactive. t Va ifc_link_irq
q Vt "int" t Va ifc_vlan_attach_event
q Vt "eventhandler_tag" t Va ifc_vlan_detach_event
q Vt "eventhandler_tag" t Va ifc_pause_frames
q Vt "int" t Va ifc_watchdog_events
q Vt "int" t Va ifc_mac
q Vt "uint8_t" t Va ifc_msix_mem
q Vt "struct resource *" t Va ifc_legacy_irq
q Vt "struct if_irq" t Va ifc_admin_task
q Vt "struct grouptask" Taskqueue task scheduled for link state change events of the interface t Va ifc_filter_info
q Vt "struct iflib_filter_info" Statistics and information relating to the interface device filter t Va ifc_media
q Vt "struct ifmedia" t Va ifc_txrx
q Vt "struct if_txrx" .El .Sh FUNCTIONS The above named functions are found exclusively in iflib. They are independent of the underlying hardware type or configuration. .Ss Device Independent Functions l -ohang -offset indent t Fn iflib_device_attach Function initiates a device registration with the iflib framework. It calls the iflib_register function, which is responsible for allocating and initializing the if_ctx_t structure. t Fn iflib_device_detach Shutdown and detach the device. Unregister vlan events, drain any dependent tasks, and release irq, pci, and msix memory. t Fn iflib_device_suspend Suspend a device by calling the device dependent suspend function and bus_generic_suspend. t Fn iflib_device_resume Resume a device by calling the device dependent resume function, the iflib_init_locked function, and bus_generic_resume. t Fn iflib_device_register Register a device with the iflib framework. Allocate and initialize the if_ctx_t structure. Setup and initialize the MSI or MSI/X interrupt queues if necessary. Allocate memory for queues and qset structure setup. t Fn iflib_irq_alloc Allocate an interrupt resource for a given rid value with an associated filter and handler function. t Fn iflib_irq_alloc_generic Performs 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 .Dv IFLIB_INTR_TX , .Dv IFLIB_INTR_RX , and .Dv IFLIB_INTR_ADMIN . t Fn iflib_led_create Calls led_create to initialize the ctx->ifc_led_dev field t Fn iflib_tx_intr_deferred Calls GROUPTASK_ENQUEUE to enqueue the transfer queues ift_task. t Fn iflib_rx_intr_deferred Calls GROUPTASK_ENQUEUE to enqueue the receive queues ifr_task. t Fn iflib_link_intr_deferred Calls GROUPTASK_ENQUEUE to enqueue the link task t Fn iflib_link_state_change Change the interface link status to either .Dv LINK_STATE_UP or .Dv LINK_STATE_DOWN as specified by the second argument to the function.
p .Em Interface Link States The following link states are currently defined: t Dv LINK_STATE_UP The link is up. t Dv LINK_STATE_DOWN The link is down. t Fn iflib_add_int_delay_sysctl Modifies settings to user defined values for a given set of variables. .El .Sh SEE ALSO .Xr iflibdd 9 , .Xr iflibtxrx 9 .Sh AUTHORS This manual page was written by .An Nicole Graziano