drivers/net/ethernet/freescale/enetc/enetc_pf_common.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/freescale/enetc/enetc_pf_common.c- Extension
.c- Size
- 11533 bytes
- Lines
- 467
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/fsl/enetc_mdio.hlinux/of_mdio.hlinux/of_net.henetc_pf_common.h
Detected Declarations
function enetc_set_si_hw_addrfunction enetc_get_si_hw_addrfunction enetc_pf_set_mac_addrfunction enetc_setup_mac_addressfunction enetc_setup_mac_addressesfunction enetc_pf_netdev_setupfunction enetc_mdio_probefunction enetc_mdio_removefunction enetc_imdio_createfunction enetc_imdio_removefunction enetc_port_has_pcsfunction enetc_mdiobus_createfunction enetc_mdiobus_destroyfunction enetc_phylink_createfunction enetc_phylink_destroyfunction enetc_set_default_rss_keyfunction enetc_vid_hash_idxfunction enetc_refresh_vlan_ht_filterfunction enetc_set_si_vlan_ht_filterfunction enetc_vlan_rx_add_vidfunction enetc_vlan_rx_del_vidfunction enetc_init_sriov_resourcesexport enetc_set_si_hw_addrexport enetc_pf_set_mac_addrexport enetc_setup_mac_addressesexport enetc_pf_netdev_setupexport enetc_mdiobus_createexport enetc_mdiobus_destroyexport enetc_phylink_createexport enetc_phylink_destroyexport enetc_set_default_rss_keyexport enetc_vlan_rx_add_videxport enetc_vlan_rx_del_videxport enetc_init_sriov_resources
Annotated Snippet
const struct net_device_ops *ndev_ops)
{
struct enetc_ndev_priv *priv = netdev_priv(ndev);
struct enetc_pf *pf = enetc_si_priv(si);
SET_NETDEV_DEV(ndev, &si->pdev->dev);
priv->ndev = ndev;
priv->si = si;
priv->dev = &si->pdev->dev;
si->ndev = ndev;
priv->msg_enable = (NETIF_MSG_WOL << 1) - 1;
priv->sysclk_freq = si->drvdata->sysclk_freq;
priv->max_frags = si->drvdata->max_frags;
ndev->netdev_ops = ndev_ops;
enetc_set_ethtool_ops(ndev);
ndev->watchdog_timeo = 5 * HZ;
ndev->max_mtu = ENETC_MAX_MTU;
ndev->hw_features = NETIF_F_SG | NETIF_F_RXCSUM |
NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX |
NETIF_F_HW_VLAN_CTAG_FILTER |
NETIF_F_HW_CSUM | NETIF_F_TSO | NETIF_F_TSO6 |
NETIF_F_GSO_UDP_L4;
ndev->features = NETIF_F_HIGHDMA | NETIF_F_SG | NETIF_F_RXCSUM |
NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX |
NETIF_F_HW_CSUM | NETIF_F_TSO | NETIF_F_TSO6 |
NETIF_F_GSO_UDP_L4;
ndev->vlan_features = NETIF_F_SG | NETIF_F_HW_CSUM |
NETIF_F_TSO | NETIF_F_TSO6;
ndev->priv_flags |= IFF_UNICAST_FLT;
if (si->drvdata->tx_csum)
priv->active_offloads |= ENETC_F_TXCSUM;
if (si->hw_features & ENETC_SI_F_LSO)
priv->active_offloads |= ENETC_F_LSO;
if (si->num_rss) {
ndev->hw_features |= NETIF_F_RXHASH;
ndev->features |= NETIF_F_RXHASH;
}
if (!enetc_is_pseudo_mac(si))
ndev->hw_features |= NETIF_F_LOOPBACK;
/* TODO: currently, i.MX95 ENETC driver does not support advanced features */
if (!is_enetc_rev1(si))
goto end;
ndev->xdp_features = NETDEV_XDP_ACT_BASIC | NETDEV_XDP_ACT_REDIRECT |
NETDEV_XDP_ACT_NDO_XMIT | NETDEV_XDP_ACT_RX_SG |
NETDEV_XDP_ACT_NDO_XMIT_SG;
if (si->hw_features & ENETC_SI_F_PSFP && pf->ops->enable_psfp &&
!pf->ops->enable_psfp(priv)) {
priv->active_offloads |= ENETC_F_QCI;
ndev->features |= NETIF_F_HW_TC;
ndev->hw_features |= NETIF_F_HW_TC;
}
end:
/* pick up primary MAC address from SI */
enetc_load_primary_mac_addr(&si->hw, ndev);
}
EXPORT_SYMBOL_GPL(enetc_pf_netdev_setup);
static int enetc_mdio_probe(struct enetc_pf *pf, struct device_node *np)
{
struct device *dev = &pf->si->pdev->dev;
struct enetc_mdio_priv *mdio_priv;
struct mii_bus *bus;
int err;
bus = devm_mdiobus_alloc_size(dev, sizeof(*mdio_priv));
if (!bus)
return -ENOMEM;
bus->name = "Freescale ENETC MDIO Bus";
bus->read = enetc_mdio_read_c22;
bus->write = enetc_mdio_write_c22;
bus->read_c45 = enetc_mdio_read_c45;
bus->write_c45 = enetc_mdio_write_c45;
bus->parent = dev;
mdio_priv = bus->priv;
mdio_priv->hw = &pf->si->hw;
if (is_enetc_rev1(pf->si))
Annotation
- Immediate include surface: `linux/fsl/enetc_mdio.h`, `linux/of_mdio.h`, `linux/of_net.h`, `enetc_pf_common.h`.
- Detected declarations: `function enetc_set_si_hw_addr`, `function enetc_get_si_hw_addr`, `function enetc_pf_set_mac_addr`, `function enetc_setup_mac_address`, `function enetc_setup_mac_addresses`, `function enetc_pf_netdev_setup`, `function enetc_mdio_probe`, `function enetc_mdio_remove`, `function enetc_imdio_create`, `function enetc_imdio_remove`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: pattern implementation candidate.
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.