drivers/net/ethernet/xilinx/xilinx_axienet_main.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/xilinx/xilinx_axienet_main.c- Extension
.c- Size
- 94668 bytes
- Lines
- 3226
- 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/clk.hlinux/delay.hlinux/etherdevice.hlinux/module.hlinux/netdevice.hlinux/of.hlinux/of_mdio.hlinux/of_net.hlinux/of_irq.hlinux/of_address.hlinux/platform_device.hlinux/skbuff.hlinux/math64.hlinux/phy.hlinux/mii.hlinux/ethtool.hlinux/dmaengine.hlinux/dma-mapping.hlinux/dma/xilinx_dma.hlinux/circ_buf.hnet/netdev_queues.hxilinx_axienet.h
Detected Declarations
function axienet_dma_in32function desc_set_phys_addrfunction desc_get_phys_addrfunction axienet_dma_bd_releasefunction axienet_dma_ratefunction axienet_calc_crfunction axienet_coalesce_paramsfunction axienet_dma_startfunction axienet_dma_bd_initfunction axienet_set_mac_addressfunction netdev_set_mac_addressfunction axienet_set_multicast_listfunction netdev_for_each_mc_addrfunction axienet_setoptionsfunction axienet_statfunction axienet_stats_updatefunction axienet_refresh_statsfunction __axienet_device_resetfunction axienet_dma_stopfunction axienet_device_resetfunction packetsfunction axienet_check_tx_bd_spacefunction axienet_dma_tx_cbfunction axienet_start_xmit_dmaenginefunction axienet_tx_pollfunction axienet_start_xmitfunction axienet_dma_rx_cbfunction axienet_rx_pollfunction axienet_tx_irqfunction axienet_rx_irqfunction axienet_eth_irqfunction axienet_rx_submit_descfunction axienet_init_dmaenginefunction axienet_init_legacy_dmafunction axienet_openfunction axienet_stopfunction axienet_change_mtufunction axienet_poll_controllerfunction axienet_ioctlfunction axienet_get_stats64function axienet_ethtools_get_drvinfofunction axienet_ethtools_get_regs_lenfunction axienet_ethtools_get_regsfunction axienet_ethtools_get_ringparamfunction axienet_ethtools_set_ringparamfunction axienet_ethtools_get_pauseparamfunction axienet_ethtools_set_pauseparamfunction axienet_update_coalesce_rx
Annotated Snippet
static const struct net_device_ops axienet_netdev_ops = {
.ndo_open = axienet_open,
.ndo_stop = axienet_stop,
.ndo_start_xmit = axienet_start_xmit,
.ndo_get_stats64 = axienet_get_stats64,
.ndo_change_mtu = axienet_change_mtu,
.ndo_set_mac_address = netdev_set_mac_address,
.ndo_validate_addr = eth_validate_addr,
.ndo_eth_ioctl = axienet_ioctl,
.ndo_set_rx_mode = axienet_set_multicast_list,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = axienet_poll_controller,
#endif
};
static const struct net_device_ops axienet_netdev_dmaengine_ops = {
.ndo_open = axienet_open,
.ndo_stop = axienet_stop,
.ndo_start_xmit = axienet_start_xmit_dmaengine,
.ndo_get_stats64 = axienet_get_stats64,
.ndo_change_mtu = axienet_change_mtu,
.ndo_set_mac_address = netdev_set_mac_address,
.ndo_validate_addr = eth_validate_addr,
.ndo_eth_ioctl = axienet_ioctl,
.ndo_set_rx_mode = axienet_set_multicast_list,
};
/**
* axienet_ethtools_get_drvinfo - Get various Axi Ethernet driver information.
* @ndev: Pointer to net_device structure
* @ed: Pointer to ethtool_drvinfo structure
*
* This implements ethtool command for getting the driver information.
* Issue "ethtool -i ethX" under linux prompt to execute this function.
*/
static void axienet_ethtools_get_drvinfo(struct net_device *ndev,
struct ethtool_drvinfo *ed)
{
strscpy(ed->driver, DRIVER_NAME, sizeof(ed->driver));
strscpy(ed->version, DRIVER_VERSION, sizeof(ed->version));
}
/**
* axienet_ethtools_get_regs_len - Get the total regs length present in the
* AxiEthernet core.
* @ndev: Pointer to net_device structure
*
* This implements ethtool command for getting the total register length
* information.
*
* Return: the total regs length
*/
static int axienet_ethtools_get_regs_len(struct net_device *ndev)
{
return sizeof(u32) * AXIENET_REGS_N;
}
/**
* axienet_ethtools_get_regs - Dump the contents of all registers present
* in AxiEthernet core.
* @ndev: Pointer to net_device structure
* @regs: Pointer to ethtool_regs structure
* @ret: Void pointer used to return the contents of the registers.
*
* This implements ethtool command for getting the Axi Ethernet register dump.
* Issue "ethtool -d ethX" to execute this function.
*/
static void axienet_ethtools_get_regs(struct net_device *ndev,
struct ethtool_regs *regs, void *ret)
{
u32 *data = (u32 *)ret;
size_t len = sizeof(u32) * AXIENET_REGS_N;
struct axienet_local *lp = netdev_priv(ndev);
regs->version = 0;
regs->len = len;
memset(data, 0, len);
data[0] = axienet_ior(lp, XAE_RAF_OFFSET);
data[1] = axienet_ior(lp, XAE_TPF_OFFSET);
data[2] = axienet_ior(lp, XAE_IFGP_OFFSET);
data[3] = axienet_ior(lp, XAE_IS_OFFSET);
data[4] = axienet_ior(lp, XAE_IP_OFFSET);
data[5] = axienet_ior(lp, XAE_IE_OFFSET);
data[6] = axienet_ior(lp, XAE_TTAG_OFFSET);
data[7] = axienet_ior(lp, XAE_RTAG_OFFSET);
data[8] = axienet_ior(lp, XAE_UAWL_OFFSET);
data[9] = axienet_ior(lp, XAE_UAWU_OFFSET);
data[10] = axienet_ior(lp, XAE_TPID0_OFFSET);
data[11] = axienet_ior(lp, XAE_TPID1_OFFSET);
Annotation
- Immediate include surface: `linux/clk.h`, `linux/delay.h`, `linux/etherdevice.h`, `linux/module.h`, `linux/netdevice.h`, `linux/of.h`, `linux/of_mdio.h`, `linux/of_net.h`.
- Detected declarations: `function axienet_dma_in32`, `function desc_set_phys_addr`, `function desc_get_phys_addr`, `function axienet_dma_bd_release`, `function axienet_dma_rate`, `function axienet_calc_cr`, `function axienet_coalesce_params`, `function axienet_dma_start`, `function axienet_dma_bd_init`, `function axienet_set_mac_address`.
- 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.