drivers/net/ethernet/freescale/enetc/enetc4_pf.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/freescale/enetc/enetc4_pf.c- Extension
.c- Size
- 29346 bytes
- Lines
- 1189
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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
linux/clk.hlinux/module.hlinux/of_net.hlinux/of_platform.hlinux/unaligned.henetc_pf_common.henetc4_debugfs.h
Detected Declarations
function enetc4_get_port_capsfunction enetc4_get_psi_hw_featuresfunction enetc4_pf_set_si_primary_macfunction enetc4_pf_get_si_primary_macfunction enetc4_pf_set_si_mac_promiscfunction enetc4_pf_set_si_uc_hash_filterfunction enetc4_pf_set_si_mc_hash_filterfunction enetc4_pf_set_loopbackfunction enetc4_pf_clear_maft_entriesfunction enetc4_pf_add_maft_entriesfunction enetc4_pf_set_uc_exact_filterfunction netdev_for_each_uc_addrfunction enetc4_pf_set_mac_hash_filterfunction enetc4_pf_set_mac_filterfunction enetc4_pf_struct_initfunction enetc4_psicfgr0_val_constructfunction enetc4_default_rings_allocationfunction enetc4_allocate_si_ringsfunction enetc4_pf_set_si_vlan_promiscfunction enetc4_set_default_si_vlan_promiscfunction enetc4_set_si_msix_numfunction enetc4_enable_all_sifunction enetc4_configure_port_sifunction enetc4_pf_reset_tc_msdufunction enetc4_set_trx_frame_sizefunction enetc4_configure_portfunction enetc4_init_ntmp_userfunction enetc4_free_ntmp_userfunction enetc4_pf_initfunction enetc4_pf_freefunction enetc4_psi_do_set_rx_modefunction enetc4_pf_set_rx_modefunction enetc4_pf_set_featuresfunction enetc4_pl_mac_select_pcsfunction enetc4_mac_configfunction enetc4_pl_mac_configfunction enetc4_set_port_speedfunction enetc4_set_rgmii_macfunction enetc4_set_rmii_macfunction enetc4_set_hd_flow_controlfunction enetc4_set_rx_pausefunction enetc4_set_tx_pausefunction enetc4_mac_wait_tx_emptyfunction enetc4_mac_tx_graceful_stopfunction enetc4_mac_tx_enablefunction enetc4_mac_wait_rx_emptyfunction enetc4_mac_rx_graceful_stopfunction enetc4_mac_rx_enable
Annotated Snippet
static const struct net_device_ops enetc4_ndev_ops = {
.ndo_open = enetc_open,
.ndo_stop = enetc_close,
.ndo_start_xmit = enetc_xmit,
.ndo_get_stats = enetc_get_stats,
.ndo_set_mac_address = enetc_pf_set_mac_addr,
.ndo_set_rx_mode = enetc4_pf_set_rx_mode,
.ndo_set_features = enetc4_pf_set_features,
.ndo_vlan_rx_add_vid = enetc_vlan_rx_add_vid,
.ndo_vlan_rx_kill_vid = enetc_vlan_rx_del_vid,
.ndo_eth_ioctl = enetc_ioctl,
.ndo_hwtstamp_get = enetc_hwtstamp_get,
.ndo_hwtstamp_set = enetc_hwtstamp_set,
};
static struct phylink_pcs *
enetc4_pl_mac_select_pcs(struct phylink_config *config, phy_interface_t iface)
{
struct enetc_pf *pf = phylink_to_enetc_pf(config);
return pf->pcs;
}
static void enetc4_mac_config(struct enetc_pf *pf, unsigned int mode,
phy_interface_t phy_mode)
{
struct enetc_ndev_priv *priv = netdev_priv(pf->si->ndev);
struct enetc_si *si = pf->si;
u32 val;
if (enetc_is_pseudo_mac(si))
return;
val = enetc_port_mac_rd(si, ENETC4_PM_IF_MODE(0));
val &= ~(PM_IF_MODE_IFMODE | PM_IF_MODE_ENA);
switch (phy_mode) {
case PHY_INTERFACE_MODE_RGMII:
case PHY_INTERFACE_MODE_RGMII_ID:
case PHY_INTERFACE_MODE_RGMII_RXID:
case PHY_INTERFACE_MODE_RGMII_TXID:
val |= IFMODE_RGMII;
/* We need to enable auto-negotiation for the MAC
* if its RGMII interface support In-Band status.
*/
if (phylink_autoneg_inband(mode))
val |= PM_IF_MODE_ENA;
break;
case PHY_INTERFACE_MODE_RMII:
val |= IFMODE_RMII;
break;
case PHY_INTERFACE_MODE_SGMII:
case PHY_INTERFACE_MODE_2500BASEX:
val |= IFMODE_SGMII;
break;
case PHY_INTERFACE_MODE_10GBASER:
case PHY_INTERFACE_MODE_XGMII:
case PHY_INTERFACE_MODE_USXGMII:
val |= IFMODE_XGMII;
break;
default:
dev_err(priv->dev,
"Unsupported PHY mode:%d\n", phy_mode);
return;
}
enetc_port_mac_wr(si, ENETC4_PM_IF_MODE(0), val);
}
static void enetc4_pl_mac_config(struct phylink_config *config, unsigned int mode,
const struct phylink_link_state *state)
{
struct enetc_pf *pf = phylink_to_enetc_pf(config);
enetc4_mac_config(pf, mode, state->interface);
}
static void enetc4_set_port_speed(struct enetc_ndev_priv *priv, int speed)
{
u32 old_speed = priv->speed;
u32 val;
if (speed == old_speed)
return;
val = enetc_port_rd(&priv->si->hw, ENETC4_PCR);
val &= ~PCR_PSPEED;
switch (speed) {
case SPEED_100:
Annotation
- Immediate include surface: `linux/clk.h`, `linux/module.h`, `linux/of_net.h`, `linux/of_platform.h`, `linux/unaligned.h`, `enetc_pf_common.h`, `enetc4_debugfs.h`.
- Detected declarations: `function enetc4_get_port_caps`, `function enetc4_get_psi_hw_features`, `function enetc4_pf_set_si_primary_mac`, `function enetc4_pf_get_si_primary_mac`, `function enetc4_pf_set_si_mac_promisc`, `function enetc4_pf_set_si_uc_hash_filter`, `function enetc4_pf_set_si_mc_hash_filter`, `function enetc4_pf_set_loopback`, `function enetc4_pf_clear_maft_entries`, `function enetc4_pf_add_maft_entries`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: pattern implementation candidate.
- 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.