drivers/net/ethernet/freescale/enetc/enetc_pf.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/freescale/enetc/enetc_pf.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/freescale/enetc/enetc_pf.c- Extension
.c- Size
- 25365 bytes
- Lines
- 1022
- 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.
- 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/unaligned.hlinux/module.hlinux/of.hlinux/of_platform.hlinux/of_net.hlinux/pcs-lynx.henetc_ierb.henetc_pf_common.h
Detected Declarations
function enetc_pf_get_primary_mac_addrfunction enetc_pf_set_primary_mac_addrfunction enetc_pf_destroy_pcsfunction enetc_set_vlan_promiscfunction enetc_enable_si_vlan_promiscfunction enetc_disable_si_vlan_promiscfunction enetc_set_isol_vlanfunction enetc_add_mac_addr_em_filterfunction enetc_clear_mac_ht_fltfunction enetc_set_mac_ht_fltfunction enetc_sync_mac_filtersfunction enetc_pf_set_rx_modefunction netdev_for_each_uc_addrfunction netdev_for_each_mc_addrfunction enetc_set_loopbackfunction enetc_pf_set_vf_macfunction enetc_pf_set_vf_vlanfunction enetc_pf_set_vf_spoofchkfunction enetc_port_assign_rfs_entriesfunction enetc_port_get_capsfunction enetc_port_si_configurefunction enetc_set_ptcmsdurfunction enetc_reset_ptcmsdurfunction enetc_configure_port_macfunction enetc_mac_configfunction enetc_mac_enablefunction enetc_configure_portfunction enetc_pf_set_featuresfunction enetc_pf_setup_tcfunction enetc_pl_mac_select_pcsfunction enetc_pl_mac_configfunction enetc_force_rgmii_macfunction enetc_pl_mac_link_upfunction enetc_pl_mac_link_downfunction portfunction enetc_init_port_rss_memoryfunction enetc_pf_register_with_ierbfunction enetc_psi_destroyfunction enetc_pf_probefunction enetc_pf_removefunction enetc_fixup_clear_rss_rfs
Annotated Snippet
static const struct net_device_ops enetc_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 = enetc_pf_set_rx_mode,
.ndo_vlan_rx_add_vid = enetc_vlan_rx_add_vid,
.ndo_vlan_rx_kill_vid = enetc_vlan_rx_del_vid,
.ndo_set_vf_mac = enetc_pf_set_vf_mac,
.ndo_set_vf_vlan = enetc_pf_set_vf_vlan,
.ndo_set_vf_spoofchk = enetc_pf_set_vf_spoofchk,
.ndo_set_features = enetc_pf_set_features,
.ndo_eth_ioctl = enetc_ioctl,
.ndo_setup_tc = enetc_pf_setup_tc,
.ndo_bpf = enetc_setup_bpf,
.ndo_xdp_xmit = enetc_xdp_xmit,
.ndo_hwtstamp_get = enetc_hwtstamp_get,
.ndo_hwtstamp_set = enetc_hwtstamp_set,
};
static struct phylink_pcs *
enetc_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 enetc_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);
enetc_mac_config(pf->si, state->interface);
}
static void enetc_force_rgmii_mac(struct enetc_si *si, int speed, int duplex)
{
u32 old_val, val;
old_val = val = enetc_port_mac_rd(si, ENETC_PM0_IF_MODE);
if (speed == SPEED_1000) {
val &= ~ENETC_PM0_IFM_SSP_MASK;
val |= ENETC_PM0_IFM_SSP_1000;
} else if (speed == SPEED_100) {
val &= ~ENETC_PM0_IFM_SSP_MASK;
val |= ENETC_PM0_IFM_SSP_100;
} else if (speed == SPEED_10) {
val &= ~ENETC_PM0_IFM_SSP_MASK;
val |= ENETC_PM0_IFM_SSP_10;
}
if (duplex == DUPLEX_FULL)
val |= ENETC_PM0_IFM_FULL_DPX;
else
val &= ~ENETC_PM0_IFM_FULL_DPX;
if (val == old_val)
return;
enetc_port_mac_wr(si, ENETC_PM0_IF_MODE, val);
}
static void enetc_pl_mac_link_up(struct phylink_config *config,
struct phy_device *phy, unsigned int mode,
phy_interface_t interface, int speed,
int duplex, bool tx_pause, bool rx_pause)
{
struct enetc_pf *pf = phylink_to_enetc_pf(config);
u32 pause_off_thresh = 0, pause_on_thresh = 0;
u32 init_quanta = 0, refresh_quanta = 0;
struct enetc_hw *hw = &pf->si->hw;
struct enetc_si *si = pf->si;
struct enetc_ndev_priv *priv;
u32 rbmr, cmd_cfg;
int idx;
priv = netdev_priv(pf->si->ndev);
if (pf->si->hw_features & ENETC_SI_F_QBV)
enetc_sched_speed_set(priv, speed);
if (!phylink_autoneg_inband(mode) &&
phy_interface_mode_is_rgmii(interface))
enetc_force_rgmii_mac(si, speed, duplex);
/* Flow control */
Annotation
- Immediate include surface: `linux/unaligned.h`, `linux/module.h`, `linux/of.h`, `linux/of_platform.h`, `linux/of_net.h`, `linux/pcs-lynx.h`, `enetc_ierb.h`, `enetc_pf_common.h`.
- Detected declarations: `function enetc_pf_get_primary_mac_addr`, `function enetc_pf_set_primary_mac_addr`, `function enetc_pf_destroy_pcs`, `function enetc_set_vlan_promisc`, `function enetc_enable_si_vlan_promisc`, `function enetc_disable_si_vlan_promisc`, `function enetc_set_isol_vlan`, `function enetc_add_mac_addr_em_filter`, `function enetc_clear_mac_ht_flt`, `function enetc_set_mac_ht_flt`.
- 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.