---
name: "iflibdi"
section: "9freebsd"
platform: "linux"
package: "freebsd-manpages"
version: "12.2-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/iflib_add_int_delay_sysctl/9freebsd"
---

# iflibdi(9freebsd)

Device Independent Configuration Functions

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

## NAME

**iflibdi** – Device Independent Configuration Functions

## SYNOPSIS

**#include \<ifdi\_if.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\_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\_watchdog\_events*

  (*int*)

- *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\_device\_irq\_alloc**()

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

- **iflib\_device\_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\_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
