drivers/net/ethernet/apm/xgene/xgene_enet_main.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/apm/xgene/xgene_enet_main.c- Extension
.c- Size
- 52855 bytes
- Lines
- 2172
- 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/gpio.hxgene_enet_main.hxgene_enet_hw.hxgene_enet_sgmac.hxgene_enet_xgmac.h
Detected Declarations
function Copyrightfunction xgene_enet_get_data_lenfunction xgene_enet_set_data_lenfunction xgene_enet_refill_pagepoolfunction xgene_enet_refill_bufpoolfunction xgene_enet_hdr_lenfunction xgene_enet_delete_bufpoolfunction xgene_enet_delete_pagepoolfunction xgene_enet_rx_irqfunction xgene_enet_tx_completionfunction xgene_enet_setup_mssfunction xgene_enet_work_msgfunction xgene_enet_encode_lenfunction xgene_set_addr_lenfunction xgene_enet_setup_tx_descfunction xgene_enet_start_xmitfunction xgene_enet_rx_csumfunction xgene_enet_free_pagepoolfunction xgene_enet_errata_10GE_10function xgene_enet_errata_10GE_8function xgene_enet_rx_framefunction is_rx_descfunction xgene_enet_process_ringfunction xgene_enet_napifunction xgene_enet_timeoutfunction xgene_enet_set_irq_namefunction xgene_enet_register_irqfunction xgene_enet_free_irqfunction xgene_enet_napi_enablefunction xgene_enet_napi_disablefunction xgene_enet_openfunction xgene_enet_closefunction xgene_enet_delete_ringfunction xgene_enet_delete_desc_ringsfunction xgene_enet_get_ring_sizefunction xgene_enet_free_desc_ringfunction xgene_enet_free_desc_ringsfunction is_irq_mbox_requiredfunction xgene_enet_get_ring_idfunction xgene_derive_ring_ownerfunction xgene_start_cpu_bufnumfunction xgene_enet_create_desc_ringsfunction xgene_enet_get_stats64function xgene_enet_set_mac_addressfunction xgene_change_mtufunction xgene_get_port_id_acpifunction xgene_get_port_id_dtfunction xgene_get_tx_delay
Annotated Snippet
static const struct net_device_ops xgene_ndev_ops = {
.ndo_open = xgene_enet_open,
.ndo_stop = xgene_enet_close,
.ndo_start_xmit = xgene_enet_start_xmit,
.ndo_tx_timeout = xgene_enet_timeout,
.ndo_get_stats64 = xgene_enet_get_stats64,
.ndo_change_mtu = xgene_change_mtu,
.ndo_set_mac_address = xgene_enet_set_mac_address,
};
#ifdef CONFIG_ACPI
static void xgene_get_port_id_acpi(struct device *dev,
struct xgene_enet_pdata *pdata)
{
acpi_status status;
u64 temp;
status = acpi_evaluate_integer(ACPI_HANDLE(dev), "_SUN", NULL, &temp);
if (ACPI_FAILURE(status)) {
pdata->port_id = 0;
} else {
pdata->port_id = temp;
}
return;
}
#endif
static void xgene_get_port_id_dt(struct device *dev, struct xgene_enet_pdata *pdata)
{
u32 id = 0;
of_property_read_u32(dev->of_node, "port-id", &id);
pdata->port_id = id & BIT(0);
return;
}
static int xgene_get_tx_delay(struct xgene_enet_pdata *pdata)
{
struct device *dev = &pdata->pdev->dev;
int delay, ret;
ret = device_property_read_u32(dev, "tx-delay", &delay);
if (ret) {
pdata->tx_delay = 4;
return 0;
}
if (delay < 0 || delay > 7) {
dev_err(dev, "Invalid tx-delay specified\n");
return -EINVAL;
}
pdata->tx_delay = delay;
return 0;
}
static int xgene_get_rx_delay(struct xgene_enet_pdata *pdata)
{
struct device *dev = &pdata->pdev->dev;
int delay, ret;
ret = device_property_read_u32(dev, "rx-delay", &delay);
if (ret) {
pdata->rx_delay = 2;
return 0;
}
if (delay < 0 || delay > 7) {
dev_err(dev, "Invalid rx-delay specified\n");
return -EINVAL;
}
pdata->rx_delay = delay;
return 0;
}
static int xgene_enet_get_irqs(struct xgene_enet_pdata *pdata)
{
struct platform_device *pdev = pdata->pdev;
int i, ret, max_irqs;
if (phy_interface_mode_is_rgmii(pdata->phy_mode))
max_irqs = 1;
else if (pdata->phy_mode == PHY_INTERFACE_MODE_SGMII)
max_irqs = 2;
Annotation
- Immediate include surface: `linux/gpio.h`, `xgene_enet_main.h`, `xgene_enet_hw.h`, `xgene_enet_sgmac.h`, `xgene_enet_xgmac.h`.
- Detected declarations: `function Copyright`, `function xgene_enet_get_data_len`, `function xgene_enet_set_data_len`, `function xgene_enet_refill_pagepool`, `function xgene_enet_refill_bufpool`, `function xgene_enet_hdr_len`, `function xgene_enet_delete_bufpool`, `function xgene_enet_delete_pagepool`, `function xgene_enet_rx_irq`, `function xgene_enet_tx_completion`.
- 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.