STRUCT EFX_NIC(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸŽ€ NAME πŸŽ€

okay so welcome to the struct efx_nic(9) page from the Kernel API Manual, bestie β€” this is literally all about struct efx_nic, aka an Efx NIC. that's the name, that's the assignment, and we're already serving main character energy. πŸ’…βœ¨


✨ SYNOPSIS ✨

here's the whole struct, every field exactly as written β€” no skipping, no remixing, no "oops I dropped a member" behavior. this is the source-code realness, periodt:

struct efx_nic {
    char name[IFNAMSIZ];
    struct list_head node;
    struct efx_nic *primary;
    struct list_head secondary_list;
    struct pci_dev *pci_dev;
    unsigned int port_num;
    const struct efx_nic_type *type;
    int legacy_irq;
    bool eeh_disabled_legacy_irq;
    struct workqueue_struct *workqueue;
    char workqueue_name[16];
    struct work_struct reset_work;
    resource_size_t membase_phys;
    void __iomem *membase;
    unsigned int vi_stride;
    enum efx_int_mode interrupt_mode;
    unsigned int timer_quantum_ns;
    unsigned int timer_max_ns;
    bool irq_rx_adaptive;
    bool irqs_hooked;
    unsigned int irq_mod_step_us;
    unsigned int irq_rx_moderation_us;
    u32 msg_enable;
    enum nic_state state;
    unsigned long reset_pending;
    struct efx_channel *channel[EFX_MAX_CHANNELS];
    struct efx_msi_context msi_context[EFX_MAX_CHANNELS];
    const struct efx_channel_type *
extra_channel_type[EFX_MAX_EXTRA_CHANNELS];
    unsigned int xdp_tx_queue_count;
    struct efx_tx_queue **xdp_tx_queues;
    enum efx_xdp_tx_queues_mode xdp_txq_queues_mode;
    unsigned rxq_entries;
    unsigned txq_entries;
    unsigned int txq_stop_thresh;
    unsigned int txq_wake_thresh;
    unsigned tx_dc_base;
    unsigned rx_dc_base;
    unsigned sram_lim_qw;
    unsigned next_buffer_table;
    unsigned int max_channels;
    unsigned int max_vis;
    unsigned int max_tx_channels;
    unsigned n_channels;
    unsigned n_rx_channels;
    unsigned rss_spread;
    unsigned tx_channel_offset;
    unsigned n_tx_channels;
    unsigned n_extra_tx_channels;
    unsigned int tx_queues_per_channel;
    unsigned int n_xdp_channels;
    unsigned int xdp_channel_offset;
    unsigned int xdp_tx_per_channel;
    unsigned int rx_ip_align;
    unsigned int rx_dma_len;
    unsigned int rx_buffer_order;
    unsigned int rx_buffer_truesize;
    unsigned int rx_page_buf_step;
    unsigned int rx_bufs_per_page;
    unsigned int rx_pages_per_batch;
    unsigned int rx_prefix_size;
    int rx_packet_hash_offset;
    int rx_packet_len_offset;
    int rx_packet_ts_offset;
    bool rx_scatter;
    struct efx_rss_context rss_context;
    u32 vport_id;
    unsigned int_error_count;
    unsigned long int_error_expire;
    bool must_realloc_vis;
    bool irq_soft_enabled;
    struct efx_buffer irq_status;
    unsigned irq_zero_count;
    unsigned irq_level;
    struct delayed_work selftest_work;
  #ifdef CONFIG_SFC_SIENA_MTD;
    struct list_head mtd_list;
  #endif;
    void *nic_data;
    struct efx_mcdi_data *mcdi;
    struct mutex mac_lock;
    struct work_struct mac_work;
    bool port_enabled;
    bool mc_bist_for_other_fn;
    bool port_initialized;
    struct net_device *net_dev;
    netdev_features_t fixed_features;
    u16 num_mac_stats;
    struct efx_buffer stats_buffer;
    u64 rx_nodesc_drops_total;
    u64 rx_nodesc_drops_while_down;
    bool rx_nodesc_drops_prev_state;
    unsigned int phy_type;
    void *phy_data;
    struct mdio_if_info mdio;
    unsigned int mdio_bus;
    enum efx_phy_mode phy_mode;
    unsigned long link_advertising[BITS_TO_LONGS(
__ETHTOOL_LINK_MODE_MASK_NBITS)];
    u32 fec_config;
    struct efx_link_state link_state;
    unsigned int n_link_state_changes;
    bool unicast_filter;
    union efx_multicast_hash multicast_hash;
    u8 wanted_fc;
    unsigned fc_disable;
    atomic_t rx_reset;
    enum efx_loopback_mode loopback_mode;
    u64 loopback_modes;
    void *loopback_selftest;
    struct bpf_prog *xdp_prog;
    struct rw_semaphore filter_sem;
    void *filter_state;
  #ifdef CONFIG_RFS_ACCEL;
    struct mutex rps_mutex;
    unsigned long rps_slot_map;
    struct efx_async_filter_insertion rps_slot[EFX_RPS_MAX_IN_FLIGHT];
    spinlock_t rps_hash_lock;
    struct hlist_head *rps_hash_table;
    u32 rps_next_id;
  #endif;
    atomic_t active_queues;
    atomic_t rxq_flush_pending;
    atomic_t rxq_flush_outstanding;
    wait_queue_head_t flush_wq;
  #ifdef CONFIG_SFC_SIENA_SRIOV;
    unsigned vf_count;
    unsigned vf_init_count;
    unsigned vi_scale;
  #endif;
    struct efx_ptp_data *ptp_data;
    bool ptp_warned;
    char *vpd_sn;
    bool xdp_rxq_info_failed;
    struct notifier_block netdev_notifier;
    unsigned int mem_bar;
    u32 reg_base;
    struct delayed_work monitor_work;
    spinlock_t biu_lock;
    int last_irq_cpu;
    spinlock_t stats_lock;
    atomic_t n_rx_noskb_drops;
};
  • name β€” the device name, bestie. It's the net device name, or a bus id if the net device hasn't registered yet. ✨
  • node β€” list node for keeping the primary/secondary function lists in line. πŸŽ€
  • primary β€” the struct efx_nic instance for the primary function of this controller. It may be the same structure as this one, and it may be NULL if no primary function is bound. Serialised by rtnl_lock. πŸ‘‘
  • secondary_list β€” the list of struct efx_nic instances for the secondary PCI functions of the controller β€” only relevant if this one's the primary function. Serialised by rtnl_lock. πŸ’…
  • pci_dev β€” the PCI device. that's it. that's the whole field. 🀝
  • type β€” controller type attributes.
  • legacy_irq β€” the IRQ number.
  • workqueue β€” workqueue for port reconfigures and the HW monitor. Real talk: work items do not hold, and must not acquire, RTNL. 🚨
  • workqueue_name β€” name of workqueue.
  • reset_work β€” the scheduled reset workitem.
  • membase_phys β€” memory BAR value as a physical address.
  • membase β€” memory BAR value.
  • vi_stride β€” step between per-VI registers / memory regions.
  • interrupt_mode β€” interrupt mode.
  • timer_quantum_ns β€” interrupt timer quantum, in nanoseconds. ⏱️
  • timer_max_ns β€” interrupt timer maximum value, in nanoseconds.
  • irq_rx_adaptive β€” adaptive IRQ moderation enabled for RX event queues.
  • irqs_hooked β€” channel interrupts are hooked.
  • irq_rx_moderation_us β€” IRQ moderation time for RX event queues.
  • msg_enable β€” log message enable flags.
  • state β€” device state number (STATE_*). Serialised by the rtnl_lock.
  • reset_pending β€” bitmask for pending resets.
  • channel β€” channels.
  • msi_context β€” context for each MSI.
  • xdp_tx_queue_count β€” number of entries in xdp_tx_queues.
  • xdp_tx_queues β€” array of pointers to tx queues used for XDP transmit.
  • xdp_txq_queues_mode β€” XDP TX queues sharing strategy.
  • rxq_entries β€” size of receive queues requested by user.
  • txq_entries β€” size of transmit queues requested by user.
  • txq_stop_thresh β€” TX queue fill level at or above which we stop it. πŸ›‘
  • txq_wake_thresh β€” TX queue fill level at or below which we wake it. 🫢
  • tx_dc_base β€” base qword address in SRAM of TX queue descriptor caches.
  • rx_dc_base β€” base qword address in SRAM of RX queue descriptor caches.
  • sram_lim_qw β€” qword address limit of SRAM.
  • next_buffer_table β€” first available buffer table id.
  • n_channels β€” number of channels in use.
  • n_rx_channels β€” number of channels used for RX (= number of RX queues).
  • n_tx_channels β€” number of channels used for TX.
  • n_extra_tx_channels β€” number of extra channels with TX queues.
  • tx_queues_per_channel β€” number of TX queues probed on each channel.
  • n_xdp_channels β€” number of channels used for XDP TX.
  • xdp_channel_offset β€” offset of the zeroth channel used for XDP TX.
  • xdp_tx_per_channel β€” max number of TX queues on an XDP TX channel.
  • rx_ip_align β€” RX DMA address offset so the IP header ends up aligned in accordance with NET_IP_ALIGN. 😌
  • rx_dma_len β€” current maximum RX DMA length.
  • rx_buffer_order β€” order (log2) of number of pages for each RX buffer.
  • rx_buffer_truesize β€” amortised allocation size of an RX buffer, for use in sk_buff::truesize.
  • rx_prefix_size β€” size of RX prefix before packet data.
  • rx_packet_hash_offset β€” offset of RX flow hash from start of packet data (valid only if rx_prefix_size != 0; always negative).
  • rx_packet_len_offset β€” offset of RX packet length from start of packet data (valid only for NICs that set EFX_RX_PKT_PREFIX_LEN; always negative).
  • rx_packet_ts_offset β€” offset of timestamp from start of packet data (valid only if channel->sync_timestamps_enabled; always negative).
  • rx_scatter β€” scatter mode enabled for receives.
  • rss_context β€” main RSS context.
  • vport_id β€” the function's vport ID, only relevant for PFs. iykyk. 🫑
  • int_error_count β€” number of internal errors seen recently.
  • int_error_expire β€” time at which error count will be expired.
  • must_realloc_vis β€” flag: VIs have yet to be reallocated after MC reboot.
  • irq_soft_enabled β€” are IRQs soft-enabled? If not, the IRQ handler will acknowledge but do nothing else. πŸ’€
  • irq_status β€” interrupt status buffer.
  • irq_zero_count β€” number of legacy IRQs seen with queue flags == 0.
  • irq_level β€” IRQ level/index for IRQs not triggered by an event queue.
  • selftest_work β€” work item for asynchronous self-test.
  • mtd_list β€” list of MTDs attached to the NIC.
  • nic_data β€” hardware dependent state.
  • mcdi β€” Management-Controller-to-Driver Interface state.
  • mac_lock β€” MAC access lock. Protects port_enabled, phy_mode, efx_monitor and efx_siena_reconfigure_port. πŸ”’
  • mac_work β€” work item for changing MAC promiscuity and multicast hash.
  • port_enabled β€” port enabled indicator. Serialises efx_siena_stop_all, efx_siena_start_all, efx_monitor and efx_mac_work with kernel interfaces. Reading it is safe under any one of the rtnl_lock, mac_lock, or netif_tx_lock β€” but all three must be held to modify it. yes, all three. no shortcuts bestie. 😭
  • port_initialized β€” port initialized?
  • net_dev β€” operating system network device. Consider holding the rtnl lock.
  • fixed_features β€” features which cannot be turned off.
  • num_mac_stats β€” number of MAC stats reported by firmware (MAC_STATS_NUM_STATS field of MC_CMD_GET_CAPABILITIES_V4 response, or MC_CMD_MAC_NSTATS).
  • stats_buffer β€” DMA buffer for statistics.
  • phy_type β€” PHY type.
  • phy_data β€” PHY private data (including PHY-specific stats).
  • mdio β€” PHY MDIO interface.
  • mdio_bus β€” PHY MDIO bus ID (only used by Siena).
  • phy_mode β€” PHY operating mode. Serialised by mac_lock.
  • link_advertising β€” autonegotiation advertising flags.
  • fec_config β€” Forward Error Correction configuration flags. For bit positions see enum ethtool_fec_config_bits. 🌈
  • link_state β€” current state of the link.
  • n_link_state_changes β€” number of times the link has changed state.
  • unicast_filter β€” flag for Falcon-arch simple unicast filter. Protected by mac_lock.
  • multicast_hash β€” multicast hash table for Falcon-arch. Protected by mac_lock.
  • wanted_fc β€” wanted flow control flags.
  • fc_disable β€” when non-zero, flow control is disabled. Typically used to ensure that network back pressure doesn't delay dma queue flushes. Serialised by the rtnl lock.
  • loopback_mode β€” loopback status.
  • loopback_modes β€” supported loopback mode bitmask.
  • loopback_selftest β€” offline self-test private state.
  • xdp_prog β€” current XDP programme for this interface.
  • filter_sem β€” filter table rw_semaphore, protects existence of filter_state.
  • filter_state β€” architecture-dependent filter table state.
  • rps_mutex β€” protects RPS state of all channels.
  • rps_slot_map β€” bitmap of in-flight entries in rps_slot.
  • rps_slot β€” array of ARFS insertion requests for efx_filter_rfs_work.
  • rps_hash_lock β€” protects ARFS filter mapping state (rps_hash_table and rps_next_id).
  • rps_hash_table β€” mapping between ARFS filters and their various IDs.
  • rps_next_id β€” next arfs_id for an ARFS filter.
  • active_queues β€” count of RX and TX queues that haven't been flushed and drained.
  • rxq_flush_pending β€” count of number of receive queues that need to be flushed. Decremented when the efx_flush_rx_queue is called.
  • rxq_flush_outstanding β€” count of number of RX flushes started but not yet completed (either success or failure). Not used when MCDI is used to flush receive queues.
  • flush_wq β€” wait queue used by efx_nic_flush_queues to wait for flush completions.
  • vf_count β€” number of VFs intended to be enabled.
  • vf_init_count β€” number of VFs that have been fully initialised.
  • vi_scale β€” log2 number of vnics per VF.
  • ptp_data β€” PTP state data.
  • ptp_warned β€” has this NIC seen and warned about unexpected PTP events?
  • vpd_sn β€” serial number read from VPD.
  • xdp_rxq_info_failed β€” have any of the rx queues failed to initialise their xdp_rxq_info structures? 🫠
  • netdev_notifier β€” netdevice notifier.
  • mem_bar β€” the BAR that is mapped into membase.
  • reg_base β€” offset from the start of the bar to the function control window.
  • monitor_work β€” hardware monitor workitem.
  • biu_lock β€” BIU (bus interface unit) lock.
  • last_irq_cpu β€” last CPU to handle a possible test interrupt. This field is used by efx_test_interrupts to verify that an interrupt has occurred.
  • stats_lock β€” statistics update lock. Must be held when calling efx_nic_type::{update,start,stop}_stats.
  • n_rx_noskb_drops β€” count of RX packets dropped due to failure to allocate an skb. 😭

πŸ¦‹ DESCRIPTION πŸ¦‹

So like, where does this whole big beautiful struct actually live? It's stored in the private area of the struct net_device. that's the whole description. iconic brevity honestly. πŸ’…


🌈 SEE ALSO 🌈

Kernel file ./drivers/net/ethernet/sfc/siena/net_driver.h, plus the whole friend group:

  • struct efx_buffer(9)
  • struct efx_special_buffer(9)
  • struct efx_tx_buffer(9)
  • struct efx_tx_queue(9)
  • struct efx_rx_buffer(9)
  • struct efx_rx_page_state(9)
  • struct efx_rx_queue(9)
  • struct efx_channel(9)
  • struct efx_msi_context(9)
  • struct efx_channel_type(9)
  • struct efx_link_state(9)
  • enum efx_phy_mode(9)
  • struct efx_hw_stat_desc(9)
  • struct efx_rss_context(9)
  • struct efx_arfs_rule(9)
  • struct efx_async_filter_insertion(9)
  • struct efx_nic_type(9)

okay that's the whole thing, you made it to the end, so proud of you fr fr πŸŽ€ this one came from ./drivers/net/ethernet/sfc/siena, dated October 2026, and it's struct efx_nic(9) β€” go forth and read the header file bestie, it's giving main character energy βœ¨πŸ’–

πŸ“¦ where this page comes from