drivers/net/ethernet/sfc/siena/efx_common.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/sfc/siena/efx_common.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/sfc/siena/efx_common.c- Extension
.c- Size
- 39359 bytes
- Lines
- 1399
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
net_driver.hlinux/filter.hlinux/module.hlinux/netdevice.hnet/gre.hefx_common.hefx_channels.hefx.hmcdi.hselftest.hrx_common.htx_common.hnic.hmcdi_port_common.hio.hmcdi_pcol.h
Detected Declarations
function efx_siena_create_reset_workqueuefunction efx_siena_queue_reset_workfunction efx_siena_flush_reset_workqueuefunction efx_siena_destroy_reset_workqueuefunction efx_siena_mac_reconfigurefunction efx_mac_workfunction efx_siena_set_mac_addressfunction efx_siena_set_rx_modefunction efx_siena_set_featuresfunction efx_siena_link_status_changedfunction efx_siena_xdp_max_mtufunction efx_siena_change_mtufunction efx_monitorfunction monitorfunction efx_siena_start_monitorfunction changesfunction efx_stop_datapathfunction efx_siena_link_clear_advertisingfunction efx_siena_link_set_wanted_fcfunction efx_start_portfunction efx_stop_portfunction efx_siena_start_allfunction efx_siena_stop_allfunction efx_siena_update_stats_atomicfunction efx_siena_net_statsfunction efx_monitorfunction efx_siena_reconfigure_portfunction efx_wait_for_bist_endfunction efx_siena_try_recoveryfunction efx_siena_reset_downfunction efx_siena_watchdogfunction efx_siena_reset_downfunction efx_siena_resetfunction efx_reset_workfunction efx_siena_schedule_resetfunction efx_siena_port_dummy_op_intfunction efx_siena_port_dummy_op_voidfunction efx_siena_fini_structfunction efx_siena_init_iofunction efx_siena_fini_iofunction mcdi_logging_showfunction mcdi_logging_storefunction efx_siena_init_mcdi_loggingfunction efx_siena_fini_mcdi_loggingfunction efx_io_error_detectedfunction efx_io_slot_resetfunction efx_io_resumefunction efx_can_encap_offloads
Annotated Snippet
if (rc) {
eth_hw_addr_set(net_dev, old_addr);
return rc;
}
}
/* Reconfigure the MAC */
mutex_lock(&efx->mac_lock);
efx_siena_mac_reconfigure(efx, false);
mutex_unlock(&efx->mac_lock);
return 0;
}
/* Context: netif_addr_lock held, BHs disabled. */
void efx_siena_set_rx_mode(struct net_device *net_dev)
{
struct efx_nic *efx = netdev_priv(net_dev);
if (efx->port_enabled)
queue_work(efx->workqueue, &efx->mac_work);
/* Otherwise efx_start_port() will do this */
}
int efx_siena_set_features(struct net_device *net_dev, netdev_features_t data)
{
struct efx_nic *efx = netdev_priv(net_dev);
int rc;
/* If disabling RX n-tuple filtering, clear existing filters */
if (net_dev->features & ~data & NETIF_F_NTUPLE) {
rc = efx->type->filter_clear_rx(efx, EFX_FILTER_PRI_MANUAL);
if (rc)
return rc;
}
/* If Rx VLAN filter is changed, update filters via mac_reconfigure.
* If rx-fcs is changed, mac_reconfigure updates that too.
*/
if ((net_dev->features ^ data) & (NETIF_F_HW_VLAN_CTAG_FILTER |
NETIF_F_RXFCS)) {
/* efx_siena_set_rx_mode() will schedule MAC work to update filters
* when a new features are finally set in net_dev.
*/
efx_siena_set_rx_mode(net_dev);
}
return 0;
}
/* This ensures that the kernel is kept informed (via
* netif_carrier_on/off) of the link status, and also maintains the
* link status's stop on the port's TX queue.
*/
void efx_siena_link_status_changed(struct efx_nic *efx)
{
struct efx_link_state *link_state = &efx->link_state;
/* SFC Bug 5356: A net_dev notifier is registered, so we must ensure
* that no events are triggered between unregister_netdev() and the
* driver unloading. A more general condition is that NETDEV_CHANGE
* can only be generated between NETDEV_UP and NETDEV_DOWN
*/
if (!netif_running(efx->net_dev))
return;
if (link_state->up != netif_carrier_ok(efx->net_dev)) {
efx->n_link_state_changes++;
if (link_state->up)
netif_carrier_on(efx->net_dev);
else
netif_carrier_off(efx->net_dev);
}
/* Status message for kernel log */
if (link_state->up)
netif_info(efx, link, efx->net_dev,
"link up at %uMbps %s-duplex (MTU %d)\n",
link_state->speed, link_state->fd ? "full" : "half",
efx->net_dev->mtu);
else
netif_info(efx, link, efx->net_dev, "link down\n");
}
unsigned int efx_siena_xdp_max_mtu(struct efx_nic *efx)
{
/* The maximum MTU that we can fit in a single page, allowing for
* framing, overhead and XDP headroom + tailroom.
*/
Annotation
- Immediate include surface: `net_driver.h`, `linux/filter.h`, `linux/module.h`, `linux/netdevice.h`, `net/gre.h`, `efx_common.h`, `efx_channels.h`, `efx.h`.
- Detected declarations: `function efx_siena_create_reset_workqueue`, `function efx_siena_queue_reset_work`, `function efx_siena_flush_reset_workqueue`, `function efx_siena_destroy_reset_workqueue`, `function efx_siena_mac_reconfigure`, `function efx_mac_work`, `function efx_siena_set_mac_address`, `function efx_siena_set_rx_mode`, `function efx_siena_set_features`, `function efx_siena_link_status_changed`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.