drivers/net/ethernet/ti/icssg/icssg_prueth.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/ti/icssg/icssg_prueth.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/ti/icssg/icssg_prueth.c- Extension
.c- Size
- 70161 bytes
- Lines
- 2591
- 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/bitops.hlinux/clk.hlinux/delay.hlinux/dma-mapping.hlinux/dma/ti-cppi5.hlinux/etherdevice.hlinux/genalloc.hlinux/if_hsr.hlinux/if_vlan.hlinux/interrupt.hlinux/io-64-nonatomic-hi-lo.hlinux/kernel.hlinux/mfd/syscon.hlinux/module.hlinux/of.hlinux/of_mdio.hlinux/of_net.hlinux/platform_device.hlinux/phy.hlinux/property.hlinux/remoteproc/pruss.hlinux/regmap.hlinux/remoteproc.hnet/switchdev.hicssg_prueth.hicssg_mii_rt.hicssg_switchdev.h../k3-cppi-desc-pool.h
Detected Declarations
struct hsr_mcast_updatefunction emac_get_tx_tsfunction tx_ts_workfunction prueth_tx_ts_irqfunction prueth_startfunction prueth_shutdownfunction prueth_emac_startfunction prueth_emac_stopfunction icssg_enable_fw_offloadfunction prueth_emac_common_startfunction prueth_emac_common_stopfunction emac_adjust_linkfunction emac_rx_timer_callbackfunction emac_phy_connectfunction prueth_iep_gettimefunction prueth_iep_settimefunction prueth_perout_enablefunction prueth_destroy_xdp_rxqsfunction prueth_create_xdp_rxqsfunction icssg_prueth_add_mcastfunction icssg_prueth_del_mcastfunction masterfunction icssg_hsr_fdb_updatefunction bitsfunction icssg_prueth_hsr_add_mcastfunction icssg_prueth_hsr_del_mcastfunction icssg_update_vlan_mcastfunction prueth_set_xsk_poolfunction prueth_destroy_txqfunction prueth_destroy_rxqfunction Markerfunction prueth_create_txqfunction prueth_create_rxqfunction emac_ndo_openfunction emac_ndo_stopfunction icssg_hsr_handle_multicast_syncfunction emac_ndo_set_rx_mode_workfunction emac_ndo_set_rx_modefunction emac_ndo_fix_featuresfunction emac_ndo_vlan_rx_add_vidfunction emac_ndo_vlan_rx_del_vidfunction transmittedfunction emac_xdp_setupfunction prueth_xsk_pool_enablefunction prueth_xsk_pool_disablefunction emac_ndo_bpffunction prueth_xsk_wakeupfunction prueth_netdev_init
Annotated Snippet
static const struct net_device_ops emac_netdev_ops = {
.ndo_open = emac_ndo_open,
.ndo_stop = emac_ndo_stop,
.ndo_start_xmit = icssg_ndo_start_xmit,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
.ndo_tx_timeout = icssg_ndo_tx_timeout,
.ndo_set_rx_mode = emac_ndo_set_rx_mode,
.ndo_eth_ioctl = phy_do_ioctl,
.ndo_get_stats64 = icssg_ndo_get_stats64,
.ndo_get_phys_port_name = icssg_ndo_get_phys_port_name,
.ndo_fix_features = emac_ndo_fix_features,
.ndo_vlan_rx_add_vid = emac_ndo_vlan_rx_add_vid,
.ndo_vlan_rx_kill_vid = emac_ndo_vlan_rx_del_vid,
.ndo_bpf = emac_ndo_bpf,
.ndo_xdp_xmit = emac_xdp_xmit,
.ndo_hwtstamp_get = icssg_ndo_get_ts_config,
.ndo_hwtstamp_set = icssg_ndo_set_ts_config,
.ndo_xsk_wakeup = prueth_xsk_wakeup,
};
static int prueth_netdev_init(struct prueth *prueth,
struct device_node *eth_node)
{
int ret, num_tx_chn = PRUETH_MAX_TX_QUEUES;
struct prueth_emac *emac;
struct net_device *ndev;
enum prueth_port port;
const char *irq_name;
enum prueth_mac mac;
port = prueth_node_port(eth_node);
if (port == PRUETH_PORT_INVALID)
return -EINVAL;
mac = prueth_node_mac(eth_node);
if (mac == PRUETH_MAC_INVALID)
return -EINVAL;
ndev = alloc_etherdev_mq(sizeof(*emac), num_tx_chn);
if (!ndev)
return -ENOMEM;
emac = netdev_priv(ndev);
emac->prueth = prueth;
emac->ndev = ndev;
emac->port_id = port;
emac->xdp_prog = NULL;
emac->ndev->pcpu_stat_type = NETDEV_PCPU_STAT_TSTATS;
INIT_WORK(&emac->rx_mode_work, emac_ndo_set_rx_mode_work);
INIT_DELAYED_WORK(&emac->stats_work, icssg_stats_work_handler);
ret = pruss_request_mem_region(prueth->pruss,
port == PRUETH_PORT_MII0 ?
PRUSS_MEM_DRAM0 : PRUSS_MEM_DRAM1,
&emac->dram);
if (ret) {
dev_err(prueth->dev, "unable to get DRAM: %d\n", ret);
ret = -ENOMEM;
goto free_ndev;
}
emac->tx_ch_num = 1;
irq_name = "tx_ts0";
if (emac->port_id == PRUETH_PORT_MII1)
irq_name = "tx_ts1";
emac->tx_ts_irq = platform_get_irq_byname_optional(prueth->pdev, irq_name);
if (emac->tx_ts_irq < 0) {
ret = dev_err_probe(prueth->dev, emac->tx_ts_irq, "could not get tx_ts_irq\n");
goto free;
}
SET_NETDEV_DEV(ndev, prueth->dev);
spin_lock_init(&emac->lock);
mutex_init(&emac->cmd_lock);
emac->phy_node = of_parse_phandle(eth_node, "phy-handle", 0);
if (!emac->phy_node && !of_phy_is_fixed_link(eth_node)) {
dev_err(prueth->dev, "couldn't find phy-handle\n");
ret = -ENODEV;
goto free;
} else if (of_phy_is_fixed_link(eth_node)) {
ret = of_phy_register_fixed_link(eth_node);
if (ret) {
dev_err_probe(prueth->dev, ret, "failed to register fixed-link phy\n");
goto free;
}
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/clk.h`, `linux/delay.h`, `linux/dma-mapping.h`, `linux/dma/ti-cppi5.h`, `linux/etherdevice.h`, `linux/genalloc.h`, `linux/if_hsr.h`.
- Detected declarations: `struct hsr_mcast_update`, `function emac_get_tx_ts`, `function tx_ts_work`, `function prueth_tx_ts_irq`, `function prueth_start`, `function prueth_shutdown`, `function prueth_emac_start`, `function prueth_emac_stop`, `function icssg_enable_fw_offload`, `function prueth_emac_common_start`.
- 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.