IFLIBDD(9)
π IFLIBDD π
okay so welcome to iflibdd, from the Kernel Developer's Manual β aka the page that tells you all about Device Dependent Configuration Functions. bestie, if you're writing a driver that plugs into iflib, this is your girl. grab a snack, we're going through every single one. π
β¨ 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_suspend(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 π
okay so here's the tea β β every function up there is a device dependent configuration function. your driver registers these with iflib, and then iflib calls them from the matching iflib function whenever it needs you to go configure your device-specific stuff and registers. it's giving "iflib is the group chat, your driver is the friend who actually shows up." π
πΈ Device Dependent Functions πΈ
π Soft Queue Setup and Teardown π
ifdi_tx_queues_alloc()β Mandatory function that is called duringiflib_attachto allocate transmit queues.vaddrsandpaddrsare arrays of virtual and physical addresses respectively of the hardware transmit queues.ntxqsis the number of queues per qset.ntxqsetsis the number of qsets.ifdi_rx_queues_alloc()β Mandatory function that is called duringiflib_attachto allocate receive queues.vaddrsandpaddrsare arrays of virtual and physical addresses respectively of the hardware receive queues.nrxqsis the number of queues per qset.nrxqsetsis 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 afterifdi_attach_pre, and iflib's queue setup andMSI/MSIX(X)or legacy interrupt assignment.ifdi_detach()β Mandatory function that frees any resources allocated by the driver inifdi_attach_preandifdi_attach_post.ifdi_vlan_register()β Optional function called by the VLAN config eventhandler.vtagis the new VLAN tag.ifdi_vlan_unregister()β Optional function called by the VLAN unconfig eventhandler.ifdi_suspend()β Optional function that suspends the driver.ifdi_resume()β Optional function that resumes a driver.
β 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. It should mark the interface running, but not active (IFF_DRV_RUNNING,~IIF_DRV_OACTIVE).ifdi_stop()β Mandatory function that should disable all traffic on the interface by issuing a global reset on the MAC and deallocating the TX and RX buffers.ifdi_multi_set()β Programs the interfaces multicast addressesifdi_media_status()β Media Ioctl Callback. Function is called whenever the user queries the status of the interface usingifconfig(8). The driver sets the appropriate link type and speed inifmr->ifm_active.ifdi_mtu_set()β Sets the mtu interface to the value of the second function parametermtu.ifdi_media_change()β Function is called when the user changes speed/duplex using the media/mediaopt option withifconfig(8).ifdi_promisc_set()β Enables or disables promisc settings depending upon theflagsvalue.flagscontains the interface'sifnet(9)flags.ifdi_get_counter()β Returns the value for countercntdepending upon counter type.ifdi_update_admin_status()β Sets thelink_upstate toTRUEorFALSEdepending upon the OS link state. A real check of the hardware only happens with a link interrupt.ifdi_media_set()β Need to define
not me pointing out that the last one literally just says "Need to define" π that's what the page says, so that's what you get, no cap.
π¦ 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 queueqid.iov_init()β Initializenum_vfsVFs.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 inparamsin VFvfnum.
π§ Service Routines π§
ifdi_timer()β Optional timer routine that will be run every500ms.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), iflibdi(9), iflibtxrx(9), ifnet(9)
π AUTHORS π
This manual page was written by Nicole Graziano π«Ά
okay bestie that's the whole page, you ate it, go write a driver π this one's from the Debian edition and it's dated May 3, 2018 β iconic vintage behavior, we stan a timeless classic β¨π
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms