drivers/net/ethernet/ti/cpsw.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/ti/cpsw.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/ti/cpsw.c- Extension
.c- Size
- 48797 bytes
- Lines
- 1874
- 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/kernel.hlinux/io.hlinux/clk.hlinux/timer.hlinux/module.hlinux/platform_device.hlinux/irqreturn.hlinux/interrupt.hlinux/if_ether.hlinux/etherdevice.hlinux/netdevice.hlinux/net_tstamp.hlinux/phy.hlinux/phy/phy.hlinux/workqueue.hlinux/delay.hlinux/pm_runtime.hlinux/gpio/consumer.hlinux/of.hlinux/of_mdio.hlinux/of_net.hlinux/of_platform.hlinux/if_vlan.hlinux/kmemleak.hlinux/sys_soc.hnet/page_pool/helpers.hlinux/bpf.hlinux/bpf_trace.hlinux/pinctrl/consumer.hnet/pkt_cls.hcpsw.hcpsw_ale.h
Detected Declarations
function cpsw_slave_index_privfunction cpsw_get_slave_portfunction cpsw_set_promisciousfunction cpsw_set_mcfunction cpsw_update_vlan_mcfunction cpsw_add_mc_addrfunction cpsw_del_mc_addrfunction cpsw_purge_vlan_mcfunction cpsw_purge_all_mcfunction cpsw_ndo_set_rx_mode_workfunction cpsw_ndo_set_rx_modefunction cpsw_rxbuf_total_lenfunction cpsw_rx_handlerfunction _cpsw_adjust_linkfunction cpsw_adjust_linkfunction cpsw_add_dual_emac_def_ale_entriesfunction cpsw_slave_openfunction cpsw_add_default_vlanfunction cpsw_init_host_portfunction cpsw_slave_stopfunction cpsw_restore_vlansfunction cpsw_restorefunction cpsw_ndo_openfunction cpsw_ndo_stopfunction cpsw_ndo_start_xmitfunction cpsw_ndo_set_mac_addressfunction cpsw_add_vlan_ale_entryfunction cpsw_ndo_vlan_rx_add_vidfunction cpsw_ndo_vlan_rx_kill_vidfunction cpsw_ndo_xdp_xmitfunction cpsw_ndo_poll_controllerfunction cpsw_ndo_ioctlfunction cpsw_get_drvinfofunction cpsw_set_pauseparamfunction cpsw_set_channelsfunction cpsw_probe_dtfunction for_each_available_child_of_nodefunction cpsw_remove_dtfunction for_each_available_child_of_nodefunction cpsw_probe_dual_emacfunction cpsw_probefunction cpsw_removefunction cpsw_suspendfunction cpsw_resume
Annotated Snippet
static const struct net_device_ops cpsw_netdev_ops = {
.ndo_open = cpsw_ndo_open,
.ndo_stop = cpsw_ndo_stop,
.ndo_start_xmit = cpsw_ndo_start_xmit,
.ndo_set_mac_address = cpsw_ndo_set_mac_address,
.ndo_eth_ioctl = cpsw_ndo_ioctl,
.ndo_validate_addr = eth_validate_addr,
.ndo_tx_timeout = cpsw_ndo_tx_timeout,
.ndo_set_rx_mode = cpsw_ndo_set_rx_mode,
.ndo_set_tx_maxrate = cpsw_ndo_set_tx_maxrate,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = cpsw_ndo_poll_controller,
#endif
.ndo_vlan_rx_add_vid = cpsw_ndo_vlan_rx_add_vid,
.ndo_vlan_rx_kill_vid = cpsw_ndo_vlan_rx_kill_vid,
.ndo_setup_tc = cpsw_ndo_setup_tc,
.ndo_bpf = cpsw_ndo_bpf,
.ndo_xdp_xmit = cpsw_ndo_xdp_xmit,
.ndo_hwtstamp_get = cpsw_hwtstamp_get,
.ndo_hwtstamp_set = cpsw_hwtstamp_set,
};
static void cpsw_get_drvinfo(struct net_device *ndev,
struct ethtool_drvinfo *info)
{
struct cpsw_common *cpsw = ndev_to_cpsw(ndev);
struct platform_device *pdev = to_platform_device(cpsw->dev);
strscpy(info->driver, "cpsw", sizeof(info->driver));
strscpy(info->version, "1.0", sizeof(info->version));
strscpy(info->bus_info, pdev->name, sizeof(info->bus_info));
}
static int cpsw_set_pauseparam(struct net_device *ndev,
struct ethtool_pauseparam *pause)
{
struct cpsw_priv *priv = netdev_priv(ndev);
bool link;
priv->rx_pause = pause->rx_pause ? true : false;
priv->tx_pause = pause->tx_pause ? true : false;
for_each_slave(priv, _cpsw_adjust_link, priv, &link);
return 0;
}
static int cpsw_set_channels(struct net_device *ndev,
struct ethtool_channels *chs)
{
return cpsw_set_channels_common(ndev, chs, cpsw_rx_handler);
}
static const struct ethtool_ops cpsw_ethtool_ops = {
.supported_coalesce_params = ETHTOOL_COALESCE_RX_USECS,
.get_drvinfo = cpsw_get_drvinfo,
.get_msglevel = cpsw_get_msglevel,
.set_msglevel = cpsw_set_msglevel,
.get_link = ethtool_op_get_link,
.get_ts_info = cpsw_get_ts_info,
.get_coalesce = cpsw_get_coalesce,
.set_coalesce = cpsw_set_coalesce,
.get_sset_count = cpsw_get_sset_count,
.get_strings = cpsw_get_strings,
.get_ethtool_stats = cpsw_get_ethtool_stats,
.get_pauseparam = cpsw_get_pauseparam,
.set_pauseparam = cpsw_set_pauseparam,
.get_wol = cpsw_get_wol,
.set_wol = cpsw_set_wol,
.get_regs_len = cpsw_get_regs_len,
.get_regs = cpsw_get_regs,
.begin = cpsw_ethtool_op_begin,
.complete = cpsw_ethtool_op_complete,
.get_channels = cpsw_get_channels,
.set_channels = cpsw_set_channels,
.get_link_ksettings = cpsw_get_link_ksettings,
.set_link_ksettings = cpsw_set_link_ksettings,
.get_eee = cpsw_get_eee,
.nway_reset = cpsw_nway_reset,
.get_ringparam = cpsw_get_ringparam,
.set_ringparam = cpsw_set_ringparam,
};
static int cpsw_probe_dt(struct cpsw_platform_data *data,
struct platform_device *pdev)
{
struct device_node *node = pdev->dev.of_node;
struct device_node *slave_node;
int i = 0, ret;
u32 prop;
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/io.h`, `linux/clk.h`, `linux/timer.h`, `linux/module.h`, `linux/platform_device.h`, `linux/irqreturn.h`, `linux/interrupt.h`.
- Detected declarations: `function cpsw_slave_index_priv`, `function cpsw_get_slave_port`, `function cpsw_set_promiscious`, `function cpsw_set_mc`, `function cpsw_update_vlan_mc`, `function cpsw_add_mc_addr`, `function cpsw_del_mc_addr`, `function cpsw_purge_vlan_mc`, `function cpsw_purge_all_mc`, `function cpsw_ndo_set_rx_mode_work`.
- 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.