STRUCT EF4_NIC_TYPE(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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; wraps filter_rfs_insert and filter_rfs_expire_one β€” so those two only exist when that config is on.
  • #ifdef CONFIG_SFC_FALCON_MTD; wraps mtd_probe, mtd_rename, mtd_read, mtd_erase, mtd_write, and mtd_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_bar and revision β€” the basic identity vibes
  • txd_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 β€” a u64, because she's ambitious
  • rx_prefix_size, rx_hash_offset, rx_ts_offset, rx_buffer_padding β€” the RX geometry era
  • can_rx_scatter and always_rx_scatter β€” two whole bools about scattering, and yes, "can" and "always" are different questions πŸ¦‹
  • max_interrupt_mode, timer_period_max
  • offload_features β€” a netdev_features_t, iconic
  • max_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 that probe allocated. 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 that probe_port allocated.
  • handle_global_event β€” handle a "global" event. and yes, it may be NULL β€” don't call a NULL one, 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 be NULL, 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 be NULL!
  • reconfigure_mac β€” push MAC address, MTU, flow control and filter settings to the hardware. it's serialised by the mac_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 use ef4_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. the dev_id argument is a pointer to the struct ef4_msi_context for the channel.
  • irq_handle_legacy β€” handle the legacy interrupt. the dev_id argument is a pointer to the struct 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 not EF4_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 that rps_may_expire_flow returns true for it. both conditions, no shortcuts πŸŽ€
  • mtd_probe β€” probe and add the MTD partitions associated with this net device, using ef4_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, from enum 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