STRUCT EF4_NIC(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 NAME 🌸

okay bestie, welcome to the struct ef4_nic(9) page β€” this is the Kernel API Manual, and we're talking about the big one: an Efx NIC. like, the whole struct that holds the NIC's whole personality. no cap, it's giving main character energy for the driver πŸ’…


✨ SYNOPSIS ✨

here's the struct in all its glory β€” every field, exactly as it appears, no skipping, no summarizing, because we don't do that here 🫢

       struct ef4_nic {
           char name[IFNAMSIZ];
           struct list_head node;
           struct ef4_nic *primary;
           struct list_head secondary_list;
           struct pci_dev *pci_dev;
           unsigned int port_num;
           const struct ef4_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;
           enum ef4_int_mode interrupt_mode;
           unsigned int timer_quantum_ns;
           unsigned int timer_max_ns;
           bool irq_rx_adaptive;
           unsigned int irq_mod_step_us;
           unsigned int irq_rx_moderation_us;
           u32 msg_enable;
           enum nic_state state;
           unsigned long reset_pending;
           struct ef4_channel *channel[EF4_MAX_CHANNELS];
           struct ef4_msi_context msi_context[EF4_MAX_CHANNELS];
           const struct ef4_channel_type *
       extra_channel_type[EF4_MAX_EXTRA_CHANNELS];
           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_tx_channels;
           unsigned n_channels;
           unsigned n_rx_channels;
           unsigned rss_spread;
           unsigned tx_channel_offset;
           unsigned n_tx_channels;
           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;
           u8 rx_hash_key[40];
           u32 rx_indir_table[128];
           bool rx_scatter;
           unsigned int_error_count;
           unsigned long int_error_expire;
           bool irq_soft_enabled;
           struct ef4_buffer irq_status;
           unsigned irq_zero_count;
           unsigned irq_level;
           struct delayed_work selftest_work;
         #ifdef CONFIG_SFC_FALCON_MTD;
           struct list_head mtd_list;
         #endif;
           void *nic_data;
           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;
           struct ef4_buffer stats_buffer;
           u64 rx_nodesc_drops_total;
           u64 rx_nodesc_drops_while_down;
           bool rx_nodesc_drops_prev_state;
           unsigned int phy_type;
           const struct ef4_phy_operations *phy_op;
           void *phy_data;
           struct mdio_if_info mdio;
           enum ef4_phy_mode phy_mode;
           u32 link_advertising;
           struct ef4_link_state link_state;
           unsigned int n_link_state_changes;
           bool unicast_filter;
           union ef4_multicast_hash multicast_hash;
           u8 wanted_fc;
           unsigned fc_disable;
           atomic_t rx_reset;
           enum ef4_loopback_mode loopback_mode;
           u64 loopback_modes;
           void *loopback_selftest;
           struct rw_semaphore filter_sem;
           spinlock_t filter_lock;
           void *filter_state;
         #ifdef CONFIG_RFS_ACCEL;
           unsigned int rps_expire_channel;
           unsigned int rps_expire_index;
         #endif;
           atomic_t active_queues;
           atomic_t rxq_flush_pending;
           atomic_t rxq_flush_outstanding;
           wait_queue_head_t flush_wq;
           char *vpd_sn;
           struct delayed_work monitor_work;
           spinlock_t biu_lock;
           int last_irq_cpu;
           spinlock_t stats_lock;
           atomic_t n_rx_noskb_drops;
        };
heads up bestie: this is part 1 of 2, so don't panic when it cuts off right after the struct β€” more is literally coming πŸ’–

and yes, we kept every single field exactly as written, including the little #ifdef/#endif moments with their semicolons β€” that's the vibe, don't come for me 😭 part 2 is gonna keep the group chat going, so stay tuned ✨

πŸ’… MEMBERS πŸ’…

okay bestie, buckle up β€” struct ef4_nic has a lot of members, and we're going through every single one because she deserves it πŸ’– no skipping, no "you get the idea", we're doing the whole tour.

  • name β€” the device name, iykyk β€” that's the net device name, or the bus id if we're still pre-net-device-registration 🌸
  • node β€” a list node keeping track of the primary/secondary function lists πŸ”—
  • primary β€” the struct ef4_nic instance for the primary function of this controller. Could literally 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 ef4_nic instances for the secondary PCI functions of the controller, but only if this one is the primary function. Serialised by rtnl_lock ✨
  • pci_dev β€” the PCI device, periodt πŸŽ€
  • type β€” controller type attributes
  • legacy_irq β€” IRQ number
  • workqueue β€” workqueue for port reconfigures and the HW monitor. Huge caveat: work items do not hold and must not acquire RTNL ⚠️
  • workqueue_name β€” the name of the workqueue
  • reset_work β€” the scheduled reset workitem
  • membase_phys β€” the Memory BAR value, but as a physical address
  • membase β€” the Memory BAR value
  • 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
  • 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
  • rxq_entries β€” size of receive queues requested by user.
  • txq_entries β€” size of transmit queues requested by user.
  • txq_stop_thresh β€” the TX queue fill level at or above which we stop it πŸ›‘
  • txq_wake_thresh β€” the TX queue fill level at or below which we wake it back up πŸŒ…
  • tx_dc_base β€” base qword address in SRAM of the TX queue descriptor caches
  • rx_dc_base β€” base qword address in SRAM of the 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 (= the number of RX queues) 🎯
  • n_tx_channels β€” number of channels used for TX
  • rx_ip_align β€” RX DMA address offset so the IP header lines up in accordance with NET_IP_ALIGN
  • rx_dma_len β€” current maximum RX DMA length
  • rx_buffer_order β€” order (log2) of the 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 the RX prefix before the packet data
  • rx_packet_hash_offset β€” offset of the RX flow hash from the start of packet data (valid only if rx_prefix_size != 0; always negative) πŸ™ˆ
  • rx_packet_len_offset β€” offset of the RX packet length from the start of packet data (valid only for NICs that set EF4_RX_PKT_PREFIX_LEN; always negative)
  • rx_packet_ts_offset β€” offset of the timestamp from the start of packet data (valid only if channel->sync_timestamps_enabled; always negative) ⏰
  • rx_hash_key β€” Toeplitz hash key for RSS
  • rx_indir_table β€” indirection table for RSS
  • rx_scatter β€” scatter mode enabled for receives
  • int_error_count β€” number of internal errors seen recently 😬
  • int_error_expire β€” time at which the error count will be expired
  • irq_soft_enabled β€” are IRQs soft-enabled? If not, the IRQ handler will acknowledge but do nothing else, literally just vibing πŸ«₯
  • 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 the asynchronous self-test πŸ§ͺ
  • mtd_list β€” list of MTDs attached to the NIC
  • nic_data β€” hardware dependent state
  • mac_lock β€” MAC access lock. Protects port_enabled, phy_mode, ef4_monitor and ef4_reconfigure_port πŸ”
  • mac_work β€” work item for changing MAC promiscuity and the multicast hash
  • port_enabled β€” port enabled indicator. Serialises ef4_stop_all, ef4_start_all, ef4_monitor and ef4_mac_work with kernel interfaces. It's safe to read under any one of the rtnl_lock, mac_lock, or netif_tx_lock, but all three must be held to modify it β€” all three, bestie, no cutting corners πŸ’€
  • port_initialized β€” port initialized?
  • net_dev β€” the operating system network device. Consider holding the rtnl lock πŸ€”
  • fixed_features β€” features which cannot be turned off
  • stats_buffer β€” DMA buffer for statistics
  • phy_type β€” PHY type
  • phy_op β€” PHY interface
  • phy_data β€” PHY private data (including PHY-specific stats)
  • mdio β€” PHY MDIO interface
  • phy_mode β€” PHY operating mode. Serialised by mac_lock πŸ”’
  • link_advertising β€” autonegotiation advertising flags
  • link_state β€” current state of the link
  • n_link_state_changes β€” number of times the link has changed state, she's been through a lot 😭
  • 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 make sure 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
  • filter_sem β€” filter table rw_semaphore, for freeing the table
  • filter_lock β€” filter table lock, for mere content changes
  • filter_state β€” architecture-dependent filter table state
  • rps_expire_channel β€” next channel to check for expiry
  • rps_expire_index β€” next index to check for expiry in rps_expire_channel's rps_flow_id
  • active_queues β€” count of RX and TX queues that haven't been flushed and drained.
  • rxq_flush_pending β€” count of the number of receive queues that need to be flushed. Decremented when ef4_flush_rx_queue is called.
  • rxq_flush_outstanding β€” count of the 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 ef4_nic_flush_queues to wait for flush completions. 🚰
  • vpd_sn β€” serial number read from VPD
  • 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 ef4_test_interrupts to verify that an interrupt has actually occurred πŸ”
  • stats_lock β€” statistics update lock. Must be held when calling ef4_nic_type::{update,start,stop}_stats. πŸ“Š
  • n_rx_noskb_drops β€” count of RX packets dropped due to failure to allocate an skb πŸ’”

🌸 DESCRIPTION 🌸

so here's the tea: this whole entire struct is stored in the private area of the struct net_device. that's the description. she's big, she's iconic, and she lives rent-free in net_device's private area πŸ’…βœ¨


πŸ¦‹ SEE ALSO πŸ¦‹

kernel file ./drivers/net/ethernet/sfc/falcon/net_driver.h, plus 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_type(9)

and that's the page, bestie 🫢 this one came straight out of ./drivers/net/ethernet/sfc/falcon, dated October 2026, and she answers to the name struct ef4_nic(9) β€” go forth and read the source, mwah πŸ’–πŸŽ€πŸ§š

πŸ“¦ where this page comes from