STRUCT EF4_NIC_TYPE(9)
π struct ef4_nic_type(9)
okay bestie so this is from the Kernel API Manual, and it's literally the whole Efx device type definition β like the master blueprint of everything an ef4 NIC driver type is allowed to do. it's a big one, so keep up π«Ά
So picture this: struct ef4_nic_type is basically the main character of an Efx device's personality. it's a struct full of function pointers plus a handful of plain old numbers, and everything the driver needs to know about this specific flavour of hardware lives right in here. no cap. β¨
β¨ SYNOPSIS β¨
struct ef4_nic_type {
unsigned int mem_bar;
unsigned int (*mem_map_size)(struct ef4_nic *efx);
int (*probe)(struct ef4_nic *efx);
void (*remove)(struct ef4_nic *efx);
int (*init)(struct ef4_nic *efx);
int (*dimension_resources)(struct ef4_nic *efx);
void (*fini)(struct ef4_nic *efx);
void (*monitor)(struct ef4_nic *efx);
enum reset_type (*map_reset_reason)(enum reset_type reason);
int (*map_reset_flags)(u32 *flags);
int (*reset)(struct ef4_nic *efx, enum reset_type method);
int (*probe_port)(struct ef4_nic *efx);
void (*remove_port)(struct ef4_nic *efx);
bool (*handle_global_event)(struct ef4_channel *channel, ef4_qword_t
*);
int (*fini_dmaq)(struct ef4_nic *efx);
void (*prepare_flush)(struct ef4_nic *efx);
void (*finish_flush)(struct ef4_nic *efx);
void (*prepare_flr)(struct ef4_nic *efx);
void (*finish_flr)(struct ef4_nic *efx);
size_t (*describe_stats)(struct ef4_nic *efx, u8 **names);
size_t (*update_stats)(struct ef4_nic *efx, u64 *full_stats, struct
rtnl_link_stats64 *core_stats);
void (*start_stats)(struct ef4_nic *efx);
void (*pull_stats)(struct ef4_nic *efx);
void (*stop_stats)(struct ef4_nic *efx);
void (*set_id_led)(struct ef4_nic *efx, enum ef4_led_mode mode);
void (*push_irq_moderation)(struct ef4_channel *channel);
int (*reconfigure_port)(struct ef4_nic *efx);
void (*prepare_enable_fc_tx)(struct ef4_nic *efx);
int (*reconfigure_mac)(struct ef4_nic *efx);
bool (*check_mac_fault)(struct ef4_nic *efx);
void (*get_wol)(struct ef4_nic *efx, struct ethtool_wolinfo *wol);
int (*set_wol)(struct ef4_nic *efx, u32 type);
void (*resume_wol)(struct ef4_nic *efx);
int (*test_chip)(struct ef4_nic *efx, struct ef4_self_tests *tests);
int (*test_nvram)(struct ef4_nic *efx);
void (*irq_enable_master)(struct ef4_nic *efx);
int (*irq_test_generate)(struct ef4_nic *efx);
void (*irq_disable_non_ev)(struct ef4_nic *efx);
irqreturn_t (*irq_handle_msi)(int irq, void *dev_id);
irqreturn_t (*irq_handle_legacy)(int irq, void *dev_id);
int (*tx_probe)(struct ef4_tx_queue *tx_queue);
void (*tx_init)(struct ef4_tx_queue *tx_queue);
void (*tx_remove)(struct ef4_tx_queue *tx_queue);
void (*tx_write)(struct ef4_tx_queue *tx_queue);
unsigned int (*tx_limit_len)(struct ef4_tx_queue *tx_queue,
dma_addr_t dma_addr, unsigned int len);
int (*rx_push_rss_config)(struct ef4_nic *efx, bool user, const u32
*rx_indir_table);
int (*rx_probe)(struct ef4_rx_queue *rx_queue);
void (*rx_init)(struct ef4_rx_queue *rx_queue);
void (*rx_remove)(struct ef4_rx_queue *rx_queue);
void (*rx_write)(struct ef4_rx_queue *rx_queue);
void (*rx_defer_refill)(struct ef4_rx_queue *rx_queue);
int (*ev_probe)(struct ef4_channel *channel);
int (*ev_init)(struct ef4_channel *channel);
void (*ev_fini)(struct ef4_channel *channel);
void (*ev_remove)(struct ef4_channel *channel);
int (*ev_process)(struct ef4_channel *channel, int quota);
void (*ev_read_ack)(struct ef4_channel *channel);
void (*ev_test_generate)(struct ef4_channel *channel);
int (*filter_table_probe)(struct ef4_nic *efx);
void (*filter_table_restore)(struct ef4_nic *efx);
void (*filter_table_remove)(struct ef4_nic *efx);
void (*filter_update_rx_scatter)(struct ef4_nic *efx);
s32 (*filter_insert)(struct ef4_nic *efx, struct ef4_filter_spec
*spec, bool replace);
int (*filter_remove_safe)(struct ef4_nic *efx, enum
ef4_filter_priority priority, u32 filter_id);
int (*filter_get_safe)(struct ef4_nic *efx, enum ef4_filter_priority
priority, u32 filter_id, struct ef4_filter_spec *);
int (*filter_clear_rx)(struct ef4_nic *efx, enum ef4_filter_priority
priority);
u32 (*filter_count_rx_used)(struct ef4_nic *efx, enum
ef4_filter_priority priority);
u32 (*filter_get_rx_id_limit)(struct ef4_nic *efx);
s32 (*filter_get_rx_ids)(struct ef4_nic *efx, enum
ef4_filter_priority priority, u32 *buf, u32 size);
#ifdef CONFIG_RFS_ACCEL;
s32 (*filter_rfs_insert)(struct ef4_nic *efx, struct ef4_filter_spec
*spec);
bool (*filter_rfs_expire_one)(struct ef4_nic *efx, u32 flow_id,
unsigned int index);
#endif;
#ifdef CONFIG_SFC_FALCON_MTD;
int (*mtd_probe)(struct ef4_nic *efx);
void (*mtd_rename)(struct ef4_mtd_partition *part);
int (*mtd_read)(struct mtd_info *mtd, loff_t start, size_t len,
size_t *retlen, u8 *buffer);
int (*mtd_erase)(struct mtd_info *mtd, loff_t start, size_t len);
int (*mtd_write)(struct mtd_info *mtd, loff_t start, size_t len,
size_t *retlen, const u8 *buffer);
int (*mtd_sync)(struct mtd_info *mtd);
#endif;
int (*get_mac_address)(struct ef4_nic *efx, unsigned char
*perm_addr);
int (*set_mac_address)(struct ef4_nic *efx);
int revision;
unsigned int txd_ptr_tbl_base;
unsigned int rxd_ptr_tbl_base;
unsigned int buf_tbl_base;
unsigned int evq_ptr_tbl_base;
unsigned int evq_rptr_tbl_base;
u64 max_dma_mask;
unsigned int rx_prefix_size;
unsigned int rx_hash_offset;
unsigned int rx_ts_offset;
unsigned int rx_buffer_padding;
bool can_rx_scatter;
bool always_rx_scatter;
unsigned int max_interrupt_mode;
unsigned int timer_period_max;
netdev_features_t offload_features;
unsigned int max_rx_ip_filters;
};
okay so unm π you can see she's packed. like there are hook functions for probing, removing, init, fini, monitoring, resetting in every way imaginable, plus a whole relay team of stats functions (describe_stats, update_stats, start_stats, pull_stats, stop_stats β the way they hand off to each other, it's giving relay race πββοΈπ¨), then MAC address stuff, WOL stuff, self-test stuff, IRQ stuff, TX/RX/event-queue stuff, and a huge filter block at the end.
and did you clock the conditional bits? π
#ifdef CONFIG_RFS_ACCEL;wrapsfilter_rfs_insertandfilter_rfs_expire_oneβ so those two only exist when that config is on.#ifdef CONFIG_SFC_FALCON_MTD;wrapsmtd_probe,mtd_rename,mtd_read,mtd_erase,mtd_write, andmtd_syncβ whole MTD crew, conditional on that config too.
keep those exact, bestie, they're doing the lord's work π
and then past all the function pointers she's got the plain data members chillin' at the bottom:
mem_barandrevisionβ the basic identity vibestxd_ptr_tbl_base,rxd_ptr_tbl_base,buf_tbl_base,evq_ptr_tbl_base,evq_rptr_tbl_baseβ all the table base addresses ποΈmax_dma_maskβ au64, because she's ambitiousrx_prefix_size,rx_hash_offset,rx_ts_offset,rx_buffer_paddingβ the RX geometry eracan_rx_scatterandalways_rx_scatterβ two whole bools about scattering, and yes, "can" and "always" are different questions π¦max_interrupt_mode,timer_period_maxoffload_featuresβ anetdev_features_t, iconicmax_rx_ip_filtersβ the final field, closing out the struct like a mic drop π€
and that's the SYNOPSIS, diva. every single member, present and accounted for, nothing skipped, nothing merged, nothing invented. π
more coming in part 2 β don't go anywhere π«Ά
Members π
okay bestie this is the big one β the whole member list of struct ef4_nic_type, aka the giant function-pointer table that tells the driver how to actually talk to this specific NIC. no skipping, we're going through all of them π
mem_barβ get the memory BAR. that's the base address register, the doorway to the registers, iconic.mem_map_sizeβ get the mapped size of that memory BAR. how much room you get when you map it β¨probeβ probe the controller. first-contact vibes, main character energy.removeβ free the resources thatprobeallocated. the cleanup era π§Ήinitβ initialise the controller. get it ready to actually do stuff.dimension_resourcesβ dimension the controller resources: the buffer table, and the VIs once the available interrupt resources are clear. sizing things up fr.finiβ shut the controller down. bye bestie π«Άmonitorβ the periodic function for polling link state and hardware monitor. it just keeps checking in, like a good friend texting "u good?"map_reset_reasonβ map an ethtool reset reason to a reset method.map_reset_flagsβ map ethtool reset flags to a reset method, if possible. the "if possible" is doing emotional labour here ngl.resetβ reset the controller hardware and possibly the PHY. β οΈ heads up: this gets called while the controller is uninitialised, so don't go assuming things are set up, okay?probe_portβ probe the MAC and PHY.remove_portβ free the resources thatprobe_portallocated.handle_global_eventβ handle a "global" event. and yes, it may beNULLβ don't call aNULLone, that's not the vibe πfini_dmaqβ flush and finalise the DMA queues (RX and TX queues).prepare_flushβ prepare the hardware for flushing the DMA queues (for the Falcon architecture).finish_flushβ clean up after flushing the DMA queues (for the Falcon architecture).prepare_flrβ prepare for an FLR.finish_flrβ clean up after an FLR. symmetry, we love to see it.describe_statsβ describe statistics for ethtool.update_statsβ update statistics that aren't provided by event handling. either argument may beNULL, so check before you deref, bestie.start_statsβ start the regular fetching of statistics. the stats era begins β¨pull_statsβ pull stats from the NIC and wait until they arrive. yes, wait. patience is a virtue etc etc.stop_statsβ stop the regular fetching of statistics.set_id_ledβ set the state of the identifying LED, or revert it to automatic function. blink blink π‘push_irq_moderationβ apply the interrupt moderation value.reconfigure_portβ push loopback/power/txdis changes to the MAC and PHY.prepare_enable_fc_txβ prepare the MAC to enable pause frame TX. may beNULL!reconfigure_macβ push MAC address, MTU, flow control and filter settings to the hardware. it's serialised by themac_lock, so respect the lock fr fr.check_mac_faultβ check the MAC fault state. true if a fault is present πget_wolβ get the WoL (wake-on-LAN) configuration from the driver state.set_wolβ push the WoL configuration to the NIC.resume_wolβ synchronise WoL state between driver and MC (e.g. after resume). get them back on the same page πtest_chipβ test registers. may useef4_farch_test_registers, and is expected to reset the NIC. lowkey rude but okay.test_nvramβ test the validity of the NVRAM contents.irq_enable_masterβ enable IRQs on the NIC. π₯ important: each event queue must be separately enabled after this.irq_test_generateβ generate a test IRQ.irq_disable_non_evβ disable non-event IRQs on the NIC. and guess what: each event queue must be separately disabled before this. order matters, periodt.irq_handle_msiβ handle MSI for a channel. thedev_idargument is a pointer to thestruct ef4_msi_contextfor the channel.irq_handle_legacyβ handle the legacy interrupt. thedev_idargument is a pointer to thestruct ef4_nic.tx_probeβ allocate resources for a TX queue.tx_initβ initialise a TX queue on the NIC.tx_removeβ free resources for a TX queue.tx_writeβ write TX descriptors and the doorbell. πrx_push_rss_configβ write the RSS hash key and indirection table to the NIC.rx_probeβ allocate resources for an RX queue.rx_initβ initialise an RX queue on the NIC.rx_removeβ free resources for an RX queue.rx_writeβ write RX descriptors and the doorbell.rx_defer_refillβ generate a refill reminder event. a little note-to-self for the NIC πev_probeβ allocate resources for an event queue.ev_initβ initialise an event queue on the NIC.ev_finiβ deinitialise an event queue on the NIC.ev_removeβ free resources for an event queue.ev_processβ process events for a queue, up to the given NAPI quota. know your limits bestie.ev_read_ackβ acknowledge read events on a queue, and rearm its IRQ.ev_test_generateβ generate a test event.filter_table_probeβ probe filter capabilities and set up the filter software state.filter_table_restoreβ restore filters that were removed from the hardware.filter_table_removeβ remove filters from the hardware and tear down the software state.filter_update_rx_scatterβ update filters after a change to the rx scatter setting.filter_insertβ add or replace a filter.filter_remove_safeβ remove a filter by ID, carefully. π carefully.filter_get_safeβ retrieve a filter by ID, carefully. same energy.filter_clear_rxβ remove all RX filters whose priority is less than or equal to the given priority and is notEF4_FILTER_PRI_AUTO. read that twice, it matters.filter_count_rx_usedβ get the number of filters in use at a given priority.filter_get_rx_id_limitβ get the maximum value of a filter id, plus 1. yes, plus 1. classic.filter_get_rx_idsβ get the list of RX filters at a given priority.filter_rfs_insertβ add or replace a filter for RFS. π¨ this must be atomic. the hardware change may be asynchronous but should not be delayed for long, and it may fail if this can't be done atomically. no pressure or anything.filter_rfs_expire_oneβ consider expiring a filter that was inserted for RFS. it must check whether the specified table entry is used by RFS and thatrps_may_expire_flowreturns true for it. both conditions, no shortcuts πmtd_probeβ probe and add the MTD partitions associated with this net device, usingef4_mtd_add.mtd_renameβ set an MTD partition name using the net device name.mtd_readβ read from an MTD partition.mtd_eraseβ erase part of an MTD partition.mtd_writeβ write to an MTD partition.mtd_syncβ wait for write-back to complete on an MTD partition. this also notifies the driver that a writer has finished using this partition π«‘set_mac_addressβ set the MAC address of the device.revisionβ the hardware architecture revision.txd_ptr_tbl_baseβ TX descriptor ring base address.rxd_ptr_tbl_baseβ RX descriptor ring base address.buf_tbl_baseβ buffer table base address.evq_ptr_tbl_baseβ event queue pointer table base address.evq_rptr_tbl_baseβ event queue read-pointer table base address.max_dma_maskβ maximum possible DMA mask.rx_prefix_sizeβ size of the RX prefix before the packet data.rx_hash_offsetβ offset of the RX flow hash within the prefix.rx_ts_offsetβ offset of the timestamp within the prefix.rx_buffer_paddingβ size of the padding at the end of an RX packet.can_rx_scatterβ the NIC is able to scatter packets to multiple buffers.always_rx_scatterβ the NIC will always scatter packets to multiple buffers. no chill.max_interrupt_modeβ highest capability interrupt mode supported, fromenum ef4_init_mode.timer_period_maxβ maximum period of the interrupt timer (in ticks).offload_featuresβ net_device feature flags for the protocol offload features implemented in hardware.
β¨ SEE ALSO β¨
kernel file ./drivers/net/ethernet/sfc/falcon/net_driver.h and honestly the whole friend group:
struct ef4_buffer(9)struct ef4_special_buffer(9)struct ef4_tx_buffer(9)struct ef4_tx_queue(9)struct ef4_rx_buffer(9)struct ef4_rx_page_state(9)struct ef4_rx_queue(9)struct ef4_channel(9)struct ef4_msi_context(9)struct ef4_channel_type(9)struct ef4_link_state(9)struct ef4_phy_operations(9)enum ef4_phy_mode(9)struct ef4_hw_stat_desc(9)struct ef4_nic(9)
okay that's the whole list, you made it, I'm so proud of you π₯Ήπ this page lives in ./drivers/net/ethernet/sfc/falcon, dated October 2026, and it's the struct ef4_nic_type(9) manual page. go forth and probe things responsibly, bestie π¦β¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms