drivers/net/ethernet/sfc/siena/efx.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/sfc/siena/efx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/sfc/siena/efx.c- Extension
.c- Size
- 33935 bytes
- Lines
- 1351
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/filter.hlinux/module.hlinux/pci.hlinux/netdevice.hlinux/etherdevice.hlinux/delay.hlinux/notifier.hlinux/ip.hlinux/tcp.hlinux/in.hlinux/ethtool.hlinux/topology.hlinux/gfp.hlinux/interrupt.hnet_driver.hnet/gre.hnet/udp_tunnel.hefx.hefx_common.hefx_channels.hrx_common.htx_common.hnic.hio.hselftest.hsriov.hsiena_sriov.hmcdi_port_common.hmcdi_pcol.hworkarounds.h
Detected Declarations
function efx_probe_portfunction efx_init_portfunction efx_fini_portfunction efx_remove_portfunction efx_same_controllerfunction efx_associatefunction list_for_each_entry_safefunction list_for_each_entryfunction efx_dissociatefunction list_for_each_entry_safefunction efx_probe_nicfunction efx_remove_nicfunction efx_probe_allfunction efx_remove_allfunction efx_siena_usecs_to_ticksfunction efx_siena_init_irq_moderationfunction efx_siena_get_irq_moderationfunction efx_ioctlfunction efx_net_openfunction efx_net_stopfunction efx_vlan_rx_add_vidfunction efx_vlan_rx_kill_vidfunction efx_siena_hwtstamp_setfunction efx_siena_hwtstamp_getfunction efx_xdp_setup_progfunction efx_xdpfunction efx_xdp_xmitfunction efx_update_namefunction efx_netdev_eventfunction phy_type_showfunction efx_register_netdevfunction efx_for_each_channelfunction efx_unregister_netdevfunction efx_siena_update_sw_statsfunction unloadfunction unloadfunction efx_probe_vpd_stringsfunction loadfunction efx_pci_probe_post_iofunction upfunction efx_pci_sriov_configurefunction efx_pm_freezefunction efx_pci_shutdownfunction efx_pm_thawfunction efx_pm_powerofffunction efx_pm_resumefunction efx_pm_suspendfunction efx_init_module
Annotated Snippet
static const struct net_device_ops efx_netdev_ops = {
.ndo_open = efx_net_open,
.ndo_stop = efx_net_stop,
.ndo_get_stats64 = efx_siena_net_stats,
.ndo_tx_timeout = efx_siena_watchdog,
.ndo_start_xmit = efx_siena_hard_start_xmit,
.ndo_validate_addr = eth_validate_addr,
.ndo_eth_ioctl = efx_ioctl,
.ndo_change_mtu = efx_siena_change_mtu,
.ndo_set_mac_address = efx_siena_set_mac_address,
.ndo_set_rx_mode = efx_siena_set_rx_mode,
.ndo_set_features = efx_siena_set_features,
.ndo_features_check = efx_siena_features_check,
.ndo_vlan_rx_add_vid = efx_vlan_rx_add_vid,
.ndo_vlan_rx_kill_vid = efx_vlan_rx_kill_vid,
.ndo_hwtstamp_set = efx_siena_hwtstamp_set,
.ndo_hwtstamp_get = efx_siena_hwtstamp_get,
#ifdef CONFIG_SFC_SIENA_SRIOV
.ndo_set_vf_mac = efx_sriov_set_vf_mac,
.ndo_set_vf_vlan = efx_sriov_set_vf_vlan,
.ndo_set_vf_spoofchk = efx_sriov_set_vf_spoofchk,
.ndo_get_vf_config = efx_sriov_get_vf_config,
.ndo_set_vf_link_state = efx_sriov_set_vf_link_state,
#endif
.ndo_get_phys_port_id = efx_siena_get_phys_port_id,
.ndo_get_phys_port_name = efx_siena_get_phys_port_name,
.ndo_setup_tc = efx_siena_setup_tc,
#ifdef CONFIG_RFS_ACCEL
.ndo_rx_flow_steer = efx_siena_filter_rfs,
#endif
.ndo_xdp_xmit = efx_xdp_xmit,
.ndo_bpf = efx_xdp
};
static int efx_xdp_setup_prog(struct efx_nic *efx, struct bpf_prog *prog)
{
struct bpf_prog *old_prog;
if (efx->xdp_rxq_info_failed) {
netif_err(efx, drv, efx->net_dev,
"Unable to bind XDP program due to previous failure of rxq_info\n");
return -EINVAL;
}
if (prog && efx->net_dev->mtu > efx_siena_xdp_max_mtu(efx)) {
netif_err(efx, drv, efx->net_dev,
"Unable to configure XDP with MTU of %d (max: %d)\n",
efx->net_dev->mtu, efx_siena_xdp_max_mtu(efx));
return -EINVAL;
}
old_prog = rtnl_dereference(efx->xdp_prog);
rcu_assign_pointer(efx->xdp_prog, prog);
/* Release the reference that was originally passed by the caller. */
if (old_prog)
bpf_prog_put(old_prog);
return 0;
}
/* Context: process, rtnl_lock() held. */
static int efx_xdp(struct net_device *dev, struct netdev_bpf *xdp)
{
struct efx_nic *efx = netdev_priv(dev);
switch (xdp->command) {
case XDP_SETUP_PROG:
return efx_xdp_setup_prog(efx, xdp->prog);
default:
return -EINVAL;
}
}
static int efx_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **xdpfs,
u32 flags)
{
struct efx_nic *efx = netdev_priv(dev);
if (!netif_running(dev))
return -EINVAL;
return efx_siena_xdp_tx_buffers(efx, n, xdpfs, flags & XDP_XMIT_FLUSH);
}
static void efx_update_name(struct efx_nic *efx)
{
strcpy(efx->name, efx->net_dev->name);
efx_siena_mtd_rename(efx);
efx_siena_set_channel_names(efx);
}
Annotation
- Immediate include surface: `linux/filter.h`, `linux/module.h`, `linux/pci.h`, `linux/netdevice.h`, `linux/etherdevice.h`, `linux/delay.h`, `linux/notifier.h`, `linux/ip.h`.
- Detected declarations: `function efx_probe_port`, `function efx_init_port`, `function efx_fini_port`, `function efx_remove_port`, `function efx_same_controller`, `function efx_associate`, `function list_for_each_entry_safe`, `function list_for_each_entry`, `function efx_dissociate`, `function list_for_each_entry_safe`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: pattern implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.