---
name: "iflibdi"
section: "9"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/iflib_add_int_delay_sysctl"
---

# iflibdi(9)

Device Independent Configuration Functions

Part of [iflib\_add\_int\_delay\_sysctl(9)](/iflib_add_int_delay_sysctl/9.md).

## NAME

**iflibdi** – Device Independent Configuration Functions

## SYNOPSIS

**#include \<ifdi\_if.h\>**

**#include \<net/iflib.h\>**

### Device Independent Functions

*int*\

**iflib\_device\_attach**(*device\_t dev*);

*int*\

**iflib\_device\_detach**(*device\_t dev*);

*int*\

**iflib\_device\_suspend**(*device\_t dev*);

*int*\

**iflib\_device\_resume**(*device\_t dev*);

*int*\

**iflib\_device\_register**(*device\_t dev*, *void \*softc*, *if\_shared\_ctx\_t sctx*, *if\_ctx\_t \*ctxp*);

*int*\

**iflib\_device\_deregister**(*if\_ctx\_t ctx*);

*int*\

**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*);

*int*\

**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*);

*void*\

**iflib\_led\_create**(*if\_ctx\_t ctx*);

*void*\

**iflib\_tx\_intr\_deferred**(*if\_ctx\_t ctx*, *int txqid*);

*void*\

**iflib\_rx\_intr\_deferred**(*if\_ctx\_t ctx*, *int rxqid*);

*void*\

**iflib\_link\_intr\_deferred**(*if\_ctx\_t ctx*);

*void*\

**iflib\_link\_state\_change**(*if\_ctx\_t ctx*, *int linkstate*);

*void*\

**iflib\_request\_reset**(*if\_ctx\_t ctx*);

*void*\

**iflib\_request\_reset\_if\_up**(*if\_ctx\_t ctx*);

*void*\

**iflib\_init\_failed**(*if\_ctx\_t ctx*);

*bool*\

**iflib\_is\_running**(*if\_ctx\_t ctx*);

*void*\

**iflib\_add\_int\_delay\_sysctl**(*if\_ctx\_t ctx*, *const char \**, *const char \**, *if\_int\_delay\_info\_t*, *int*, *int*);

### Global Variables

*extern* *struct* *if\_txrx*

## 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.

### The if\_ctx\_t Structure

The fields of *struct if\_ctx\_t* are as follows:

- *if\_softc*

  (*void*) A pointer to the driver's private state block.

- *ifc\_dev*

  (*device\_t*) The underlying device structure.

- *ifc\_ip*

  (*if\_t*) A link back to the interface structure

- *ifc\_cpus*

  (*cpuset\_t*)

- *ifc\_mutex*

  (*struct mtx*) Mutex lock used to maintain data integrity

- *ifc\_mtx\_name*

  (*char \**) The name of the mutex

- *ifc\_txqs*

  (*iflib\_txq\_t*) Device independent transmit queue maintained internally by iflib

- *ifc\_rxqs*

  (*iflib\_rxq\_t*) Device independent receive queue maintained internally by iflib

- *ifc\_qsets*

  (*iflib\_qset\_t*) Output queue that contains a single transmit (ifc\_txq\_t) and receive (ifc\_rxq\_t) queue

- *ifc\_if\_flags*

  (*uint32\_t*) Flags describing the operational parameter of the interface

- *ifc\_in\_detach*

  (*int*)

- *ifc\_link\_state*

  (*int*) Describes the current link state of the Ethernet interface. Its possible values are either active or inactive.

- *ifc\_link\_irq*

  (*int*)

- *ifc\_vlan\_attach\_event*

  (*eventhandler\_tag*)

- *ifc\_vlan\_detach\_event*

  (*eventhandler\_tag*)

- *ifc\_pause\_frames*

  (*int*)

- *ifc\_tx\_watchdog\_events*

  (*uint32\_t*)

- *ifc\_mac*

  (*uint8\_t*)

- *ifc\_msix\_mem*

  (*struct resource \**)

- *ifc\_legacy\_irq*

  (*struct if\_irq*)

- *ifc\_admin\_task*

  (*struct grouptask*) Taskqueue task scheduled for link state change events of the interface

- *ifc\_filter\_info*

  (*struct iflib\_filter\_info*) Statistics and information relating to the interface device filter

- *ifc\_media*

  (*struct ifmedia*)

- *ifc\_txrx*

  (*struct if\_txrx*)

## FUNCTIONS

The above named functions are found exclusively in iflib. They are independent of the underlying hardware type or configuration.

### Device Independent Functions

- **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.

- **iflib\_device\_detach**()

  Shutdown and detach the device. Unregister vlan events, drain any dependent tasks, and release irq, pci, and msix memory.

- **iflib\_device\_suspend**()

  Suspend a device by calling the device dependent suspend function and bus\_generic\_suspend.

- **iflib\_device\_resume**()

  Resume a device by calling the device dependent resume function, the iflib\_init\_locked function, and bus\_generic\_resume.

- **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.

- **iflib\_irq\_alloc**()

  Allocate an interrupt resource for a given rid value with an associated filter and handler function.

- **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 IFLIB\_INTR\_TX, IFLIB\_INTR\_RX, and IFLIB\_INTR\_ADMIN.

- **iflib\_led\_create**()

  Calls led\_create to initialize the ctx-\>ifc\_led\_dev field

- **iflib\_tx\_intr\_deferred**()

  Calls GROUPTASK\_ENQUEUE to enqueue the transfer queues ift\_task.

- **iflib\_rx\_intr\_deferred**()

  Calls GROUPTASK\_ENQUEUE to enqueue the receive queues ifr\_task.

- **iflib\_link\_intr\_deferred**()

  Calls GROUPTASK\_ENQUEUE to enqueue the link task

- **iflib\_link\_state\_change**()

  Change the interface link status to either LINK\_STATE\_UP or LINK\_STATE\_DOWN as specified by the second argument to the function.

  *Interface* *Link* *States* The following link states are currently defined:

- LINK\_STATE\_UP

  The link is up.

- LINK\_STATE\_DOWN

  The link is down.

- **iflib\_request\_reset**()

  Request that the admin task stop and reinitialize the interface.

- **iflib\_request\_reset\_if\_up**()

  Request that the admin task stop and reinitialize the interface only if it remains administratively up when the task runs. This form is suitable for asynchronous recovery work that must not restart an interface after an intervening administrative down operation. Like **iflib\_request\_reset**(), this function only records the request; the caller must schedule the admin task, normally with **iflib\_admin\_intr\_deferred**().

- **iflib\_init\_failed**()

  Report that the current **ifdi\_init**() callback could not initialize the hardware. The driver must leave the hardware stopped and call this function while the callback holds the iflib context lock. Iflib then leaves IFF\_DRV\_RUNNING clear and does not enable interrupts or periodic timers. Output remains blocked so explicitly scheduled admin recovery work can run.

- **iflib\_is\_running**()

  Return an atomic snapshot of whether iflib admits software traffic to its queues. This function may be called from an interrupt filter without acquiring an iflib lock. Admission opens after successful driver initialization and receive-buffer setup, before enabling interrupts, and closes before stop or when the watchdog requests recovery. It remains closed after failed initialization.

  This is neither the physical link state nor proof that queue DMA has stopped. In particular, admission closes before deferred watchdog recovery stops the device. The snapshot does not hold a reference to the context or wait for existing queue users; callers must retain their normal lifetime and queue synchronization. Administrative and firmware recovery work may still be needed while admission is closed.

  Drivers should use this accessor instead of reading IFF\_DRV\_RUNNING for software run-state checks, and must not modify the driver flags. Iflib continues to publish the legacy driver flags for network-stack consumers.

- **iflib\_add\_int\_delay\_sysctl**()

  Modifies settings to user defined values for a given set of variables.

## SEE ALSO

[iflibdd(9)](/iflibdd/9.md), [iflibtxrx(9)](/iflibtxrx/9.md)

## AUTHORS

This manual page was written by Nicole Graziano
