---
name: "iflibdd"
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/ifdi_attach_post"
---

# iflibdd(9)

Device Dependent Configuration Functions

Part of [ifdi\_attach\_post(9)](/ifdi_attach_post/9.md).

## NAME

**iflibdd** – Device Dependent Configuration Functions

## SYNOPSIS

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

### Soft Queue Setup and Teardown Functions

### Mandatory Functions

*int*\

**ifdi\_tx\_queues\_alloc**(*if\_ctx\_t ctx*, *caddr\_t \*vaddrs*, *uint64\_t \*paddrs*, *int ntxqs*, *int ntxqsets*);

*int*\

**ifdi\_rx\_queues\_alloc**(*if\_ctx\_t ctx*, *caddr\_t \*vaddrs*, *uint64\_t \*paddrs*, *int nrxqs*, *int nrxqsets*);

*int*\

**ifdi\_queues\_free**(*if\_ctx\_t ctx*);

### Optional Functions

*int*\

**ifdi\_txq\_setup**(*if\_ctx\_t ctx*, *uint16\_t qid*);

*int*\

**ifdi\_rxq\_setup**(*if\_ctx\_t ctx*, *uint16\_t qid*);

### Device Setup and Teardown Functions

### Mandatory Functions

*int*\

**ifdi\_attach\_pre**(*if\_ctx\_t ctx*);

*int*\

**ifdi\_attach\_post**(*if\_ctx\_t ctx*);

*int*\

**ifdi\_detach**(*if\_ctx\_t ctx*);

### Optional Functions

*void*\

**ifdi\_vlan\_register**(*if\_ctx\_t ctx*, *uint16\_t vtag*);

*void*\

**ifdi\_vlan\_unregister**(*if\_ctx\_t ctx*, *uint16\_t vtag*);

*int*\

**ifdi\_power\_prepare**(*if\_ctx\_t ctx*, *enum iflib\_power\_event event*);

*int*\

**ifdi\_suspend**(*if\_ctx\_t ctx*);

*int*\

**ifdi\_shutdown**(*if\_ctx\_t ctx*);

*int*\

**ifdi\_resume**(*if\_ctx\_t ctx*);

### Device Configuration Functions

### Mandatory Functions

*void*\

**ifdi\_init**(*if\_ctx\_t ctx*);

*void*\

**ifdi\_stop**(*if\_ctx\_t ctx*);

*void*\

**ifdi\_multi\_set**(*if\_ctx\_t ctx*);

*int*\

**ifdi\_mtu\_set**(*if\_ctx\_t ctx*, *uint32\_t mtu*);

*void*\

**ifdi\_media\_status**(*if\_ctx\_t ctx*, *struct ifmediareq \*ifr*);

*int*\

**ifdi\_media\_change**(*if\_ctx\_t ctx*);

*void*\

**ifdi\_promisc\_set**(*if\_ctx\_t ctx*, *int flags*);

*uint64\_t*\

**ifdi\_get\_counter**(*if\_ctx\_t ctx*, *ift\_counter cnt*);

*void*\

**ifdi\_update\_admin\_status**(*if\_ctx\_t ctx*);

### Optional Functions

*void*\

**ifdi\_media\_set**(*if\_ctx\_t ctx*);

### Interrupt enable/disable

### Mandatory Functions

*void*\

**ifdi\_intr\_enable**(*if\_ctx\_t ctx*);

*void*\

**ifdi\_queue\_intr\_enable**(*if\_ctx\_t ctx*, *uint16\_t qid*);

*void*\

**ifdi\_intr\_disable**(*if\_ctx\_t ctx*);

### IOV Support

*init*\

**iov\_init**(*if\_ctx\_t ctx*, *uint16\_t num\_vfs*, *const nvlist\_t \*params*);

*void*\

**iov\_uinit**(*if\_ctx\_t ctx*);

*void*\

**ifdi\_vflr\_handle**(*if\_ctx\_t ctx*);

*int*\

**ifdi\_vf\_add**(*if\_ctx\_t ctx*, *uint16\_t vfnum*, *const nvlist\_t \*params*);

### Optional Functions

*void*\

**ifdi\_link\_intr\_enable**(*if\_ctx\_t ctx*);

### Optional Service Routines

*void*\

**ifdi\_timer**(*if\_ctx\_t ctx*);

*void*\

**ifdi\_watchdog\_reset**(*if\_ctx\_t ctx*);

### Additional Functions

*void*\

**ifdi\_led\_func**(*if\_ctx\_t ctx*, *int onoff*);

*int*\

**ifdi\_sysctl\_int\_delay**(*if\_ctx\_t ctx*, *if\_int\_delay\_info\_t iidi*);

*int*\

**ifdi\_i2c\_req**(*if\_ctx\_t ctx*, *struct ifi2creq \*req*);

## FUNCTIONS

The above named functions are device dependent configuration functions. These routines are registered with iflib by the driver and are called from the corresponding iflib function to configure device specific functions and registers.

### Device Dependent Functions

### Soft Queue Setup and Teardown

- **ifdi\_tx\_queues\_alloc**()

  Mandatory function that is called during iflib\_attach to allocate transmit queues. vaddrs and paddrs are arrays of virtual and physical addresses respectively of the hardware transmit queues. ntxqs is the number of queues per qset. ntxqsets is the number of qsets.

- **ifdi\_rx\_queues\_alloc**()

  Mandatory function that is called during iflib\_attach to allocate receive queues. vaddrs and paddrs are arrays of virtual and physical addresses respectively of the hardware receive queues. nrxqs is the number of queues per qset. nrxqsets is the number of qsets.

- **ifdi\_queues\_free**()

  Mandatory function that frees the allocated queues and associated transmit buffers.

- **ifdi\_txq\_setup**()

  Optional function for each transmit queue that handles device specific initialization.

- **ifdi\_rxq\_setup**()

  Optional function for each receive queue that handles device specific initialization.

### Device Setup and Teardown

- **ifdi\_attach\_pre**()

  Mandatory function implemented by the driver to perform any attach logic that procedes interrupt and queue allocation, queue setup, and interrupt assignment.

- **ifdi\_attach\_post**()

  Mandatory function implemented by the driver to perform any attach logic that occurs after ifdi\_attach\_pre, and iflib's queue setup and MSI/MSIX(X) or legacy interrupt assignment.

- **ifdi\_detach**()

  Mandatory function that frees any resources allocated by the driver in ifdi\_attach\_pre and ifdi\_attach\_post.

- **ifdi\_vlan\_register**()

  Optional function called by the VLAN config eventhandler. *vtag* is the new VLAN tag.

- **ifdi\_vlan\_unregister**()

  Optional function called by the VLAN unconfig eventhandler.

- **ifdi\_power\_prepare**()

  Optional function called before iflib performs the terminal stop used for detach, suspend, or shutdown. The *event* argument is one of IFLIB\_POWER\_DETACH, IFLIB\_POWER\_SUSPEND, or IFLIB\_POWER\_SHUTDOWN. Drivers should use this hook only to establish policy which must precede the stop and must not start, stop, or alter queue DMA; the default implementation does nothing. If it returns an error, it must undo any partial policy change before returning.

- **ifdi\_suspend**()

  Optional function called after iflib has stopped queue DMA and drained its private configuration taskqueue. It performs suspend-specific firmware, wake, PHY, and low-power work. An error is returned to the bus, and iflib attempts to resume the stopped interface.

- **ifdi\_shutdown**()

  Optional function called after the same terminal stop and taskqueue drain as **ifdi\_suspend**(). Shutdown errors are returned without attempting rollback.

- **ifdi\_resume**()

  Optional function that restores suspend-specific device state while the datapath remains stopped. This function is also called to roll back a failed suspend. It must not assume that a PCI power-state transition or configuration-space restore has occurred since **ifdi\_suspend**(). After it succeeds, iflib initializes the datapath exactly once when the interface is administratively up and leaves an administratively-down interface stopped.

### Device Configuration Functions

- **ifdi\_init**()

  Mandatory function that will initialize and bring up the hardware. For example, it will reset the chip and enable the receiver unit. Iflib marks the interface running after the callback returns successfully; the driver must not modify the driver flags itself. If initialization cannot complete, the driver must leave the hardware stopped or in a state in which **ifdi\_stop**() can safely quiesce it, and call **iflib\_init\_failed**() before returning. Iflib treats this report conservatively and invokes the driver stop method before retrying initialization or releasing queue mappings.

- **ifdi\_stop**()

  Mandatory function that performs a terminal stop and disables all traffic on the interface. The driver must stop DMA before returning; iflib releases the TX and RX buffers after the callback. The method commonly issues a global reset and may also put the PHY or device into its administratively-down state.

- **ifdi\_multi\_set**()

  Programs the interfaces multicast addresses

- **ifdi\_media\_status**()

  Media Ioctl Callback. Function is called whenever the user queries the status of the interface using [ifconfig(8)](/ifconfig/8.md). The driver sets the appropriate link type and speed in ifmr-\>ifm\_active.

- **ifdi\_mtu\_set**()

  Sets the mtu interface to the value of the second function parameter mtu.

- **ifdi\_media\_change**()

  Function is called when the user changes speed/duplex using the media/mediaopt option with [ifconfig(8)](/ifconfig/8.md). It is not called while the device is suspending or suspended; iflib rejects such a media change with EBUSY.

- **ifdi\_promisc\_set**()

  Enables or disables promisc settings depending upon the flags value. *flags* contains the interface's [ifnet(9)](/ifnet/9.md) flags.

- **ifdi\_get\_counter**()

  Returns the value for counter cnt depending upon counter type.

- **ifdi\_update\_admin\_status**()

  Sets the link\_up state to TRUE or FALSE depending upon the OS link state. A real check of the hardware only happens with a link interrupt.

- **ifdi\_media\_set**()

  Need to define

### Interrupt Enable/Disable

- **ifdi\_intr\_enable**()

  Mandatory function that enables all interrupts.

- **ifdi\_intr\_disable**()

  Mandatory function that disables all interrupts.

- **ifdi\_queue\_intr\_enable**()

  Mandatory function that enables interrupts on queue qid.

- **iov\_init**()

  Initialize num\_vfs VFs.

- **io\_uninit**()

  Tear down the context for all VFs.

- **ifdi\_vflr\_handle**()

  Handle any VFs that have reset themselves via a Function Level Reset (FLR).

- **ifdi\_vf\_add**()

  Set parameters in params in VF vfnum.

### Service Routines

- **ifdi\_timer**()

  Optional timer routine that will be run every 500ms.

- **ifdi\_watchdog\_reset**()

  Optional function to run when a transmit queue is hung.

### Additional Functions

- **ifdi\_led\_func**()

  - **ifdi\_sysctl\_int\_delay**()

  - **ifdi\_i2c\_req**()

  ## SEE ALSO

[ifconfig(8)](/ifconfig/8.md), [iflibdi(9)](/iflibdi/9.md), [iflibtxrx(9)](/iflibtxrx/9.md), [ifnet(9)](/ifnet/9.md)

## AUTHORS

This manual page was written by Nicole Graziano
