drivers/net/ethernet/apm/xgene-v2/main.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/apm/xgene-v2/main.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/apm/xgene-v2/main.c- Extension
.c- Size
- 15947 bytes
- Lines
- 742
- 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
main.h
Detected Declarations
function Copyrightfunction xge_refill_buffersfunction xge_init_hwfunction xge_irqfunction xge_request_irqfunction xge_free_irqfunction is_tx_slot_availablefunction xge_start_xmitfunction is_tx_hw_donefunction xge_txc_pollfunction xge_rx_pollfunction xge_delete_desc_ringfunction xge_free_buffersfunction xge_delete_desc_ringsfunction xge_create_desc_ringsfunction xge_openfunction xge_closefunction xge_napifunction xge_set_mac_addrfunction is_tx_pendingfunction xge_free_pending_skbfunction xge_timeoutfunction xge_get_stats64function xge_probefunction xge_removefunction xge_shutdown
Annotated Snippet
static const struct net_device_ops xgene_ndev_ops = {
.ndo_open = xge_open,
.ndo_stop = xge_close,
.ndo_start_xmit = xge_start_xmit,
.ndo_set_mac_address = xge_set_mac_addr,
.ndo_tx_timeout = xge_timeout,
.ndo_get_stats64 = xge_get_stats64,
};
static int xge_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct net_device *ndev;
struct xge_pdata *pdata;
int ret;
ndev = alloc_etherdev(sizeof(*pdata));
if (!ndev)
return -ENOMEM;
pdata = netdev_priv(ndev);
pdata->pdev = pdev;
pdata->ndev = ndev;
SET_NETDEV_DEV(ndev, dev);
platform_set_drvdata(pdev, pdata);
ndev->netdev_ops = &xgene_ndev_ops;
ndev->features |= NETIF_F_GSO |
NETIF_F_GRO;
ret = xge_get_resources(pdata);
if (ret)
goto err;
ndev->hw_features = ndev->features;
xge_set_ethtool_ops(ndev);
ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64));
if (ret) {
netdev_err(ndev, "No usable DMA configuration\n");
goto err;
}
ret = xge_init_hw(ndev);
if (ret)
goto err;
ret = xge_mdio_config(ndev);
if (ret)
goto err;
netif_napi_add(ndev, &pdata->napi, xge_napi);
ret = register_netdev(ndev);
if (ret) {
netdev_err(ndev, "Failed to register netdev\n");
goto err_mdio_remove;
}
return 0;
err_mdio_remove:
xge_mdio_remove(ndev);
err:
free_netdev(ndev);
return ret;
}
static void xge_remove(struct platform_device *pdev)
{
struct xge_pdata *pdata;
struct net_device *ndev;
pdata = platform_get_drvdata(pdev);
ndev = pdata->ndev;
rtnl_lock();
if (netif_running(ndev))
dev_close(ndev);
rtnl_unlock();
xge_mdio_remove(ndev);
unregister_netdev(ndev);
free_netdev(ndev);
}
static void xge_shutdown(struct platform_device *pdev)
{
Annotation
- Immediate include surface: `main.h`.
- Detected declarations: `function Copyright`, `function xge_refill_buffers`, `function xge_init_hw`, `function xge_irq`, `function xge_request_irq`, `function xge_free_irq`, `function is_tx_slot_available`, `function xge_start_xmit`, `function is_tx_hw_done`, `function xge_txc_poll`.
- 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.