drivers/net/ethernet/xilinx/ll_temac_main.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/xilinx/ll_temac_main.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/xilinx/ll_temac_main.c- Extension
.c- Size
- 45773 bytes
- Lines
- 1664
- 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/delay.hlinux/etherdevice.hlinux/mii.hlinux/module.hlinux/mutex.hlinux/netdevice.hlinux/if_ether.hlinux/of.hlinux/of_irq.hlinux/of_mdio.hlinux/of_net.hlinux/platform_device.hlinux/skbuff.hlinux/spinlock.hlinux/tcp.hlinux/udp.hlinux/phy.hlinux/in.hlinux/io.hlinux/ip.hlinux/slab.hlinux/interrupt.hlinux/workqueue.hlinux/dma-mapping.hlinux/processor.hlinux/platform_data/xilinx-ll-temac.hll_temac.h
Detected Declarations
function Copyrightfunction _temac_iow_befunction _temac_ior_lefunction _temac_iow_lefunction hard_acs_rdyfunction hard_acs_rdy_or_timeoutfunction temac_indirect_busywaitfunction temac_indirect_in32function temac_indirect_in32_lockedfunction temac_indirect_out32function temac_indirect_out32_lockedfunction temac_dma_in32_befunction temac_dma_in32_lefunction temac_dma_out32_befunction temac_dma_out32_lefunction temac_dma_dcr_infunction temac_dma_dcr_outfunction temac_dcr_setupfunction temac_dcr_setupfunction temac_dma_bd_releasefunction temac_dma_bd_initfunction temac_do_set_mac_addressfunction temac_init_mac_addressfunction temac_set_mac_addressfunction temac_set_multicast_listfunction netdev_for_each_mc_addrfunction temac_setoptionsfunction temac_device_resetfunction temac_adjust_linkfunction ptr_to_txbdfunction ptr_to_txbdfunction temac_start_xmit_donefunction temac_check_tx_bd_spacefunction temac_start_xmitfunction ll_temac_recv_buffers_availablefunction ll_temac_recvfunction failfunction ll_temac_restart_work_funcfunction ll_temac_tx_irqfunction ll_temac_rx_irqfunction temac_openfunction temac_stopfunction temac_poll_controllerfunction temac_show_llink_regsfunction ll_temac_ethtools_get_ringparamfunction ll_temac_ethtools_set_ringparamfunction ll_temac_ethtools_get_coalescefunction ll_temac_ethtools_set_coalesce
Annotated Snippet
static const struct net_device_ops temac_netdev_ops = {
.ndo_open = temac_open,
.ndo_stop = temac_stop,
.ndo_start_xmit = temac_start_xmit,
.ndo_set_rx_mode = temac_set_multicast_list,
.ndo_set_mac_address = temac_set_mac_address,
.ndo_validate_addr = eth_validate_addr,
.ndo_eth_ioctl = phy_do_ioctl_running,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = temac_poll_controller,
#endif
};
/* ---------------------------------------------------------------------
* SYSFS device attributes
*/
static ssize_t temac_show_llink_regs(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct net_device *ndev = dev_get_drvdata(dev);
struct temac_local *lp = netdev_priv(ndev);
int i, len = 0;
for (i = 0; i < 0x11; i++)
len += sprintf(buf + len, "%.8x%s", lp->dma_in(lp, i),
(i % 8) == 7 ? "\n" : " ");
len += sprintf(buf + len, "\n");
return len;
}
static DEVICE_ATTR(llink_regs, 0440, temac_show_llink_regs, NULL);
static struct attribute *temac_device_attrs[] = {
&dev_attr_llink_regs.attr,
NULL,
};
static const struct attribute_group temac_attr_group = {
.attrs = temac_device_attrs,
};
/* ---------------------------------------------------------------------
* ethtool support
*/
static void
ll_temac_ethtools_get_ringparam(struct net_device *ndev,
struct ethtool_ringparam *ering,
struct kernel_ethtool_ringparam *kernel_ering,
struct netlink_ext_ack *extack)
{
struct temac_local *lp = netdev_priv(ndev);
ering->rx_max_pending = RX_BD_NUM_MAX;
ering->rx_mini_max_pending = 0;
ering->rx_jumbo_max_pending = 0;
ering->tx_max_pending = TX_BD_NUM_MAX;
ering->rx_pending = lp->rx_bd_num;
ering->rx_mini_pending = 0;
ering->rx_jumbo_pending = 0;
ering->tx_pending = lp->tx_bd_num;
}
static int
ll_temac_ethtools_set_ringparam(struct net_device *ndev,
struct ethtool_ringparam *ering,
struct kernel_ethtool_ringparam *kernel_ering,
struct netlink_ext_ack *extack)
{
struct temac_local *lp = netdev_priv(ndev);
if (ering->rx_pending > RX_BD_NUM_MAX ||
ering->rx_mini_pending ||
ering->rx_jumbo_pending ||
ering->tx_pending > TX_BD_NUM_MAX)
return -EINVAL;
if (netif_running(ndev))
return -EBUSY;
lp->rx_bd_num = ering->rx_pending;
lp->tx_bd_num = ering->tx_pending;
return 0;
}
static int
ll_temac_ethtools_get_coalesce(struct net_device *ndev,
struct ethtool_coalesce *ec,
struct kernel_ethtool_coalesce *kernel_coal,
Annotation
- Immediate include surface: `linux/delay.h`, `linux/etherdevice.h`, `linux/mii.h`, `linux/module.h`, `linux/mutex.h`, `linux/netdevice.h`, `linux/if_ether.h`, `linux/of.h`.
- Detected declarations: `function Copyright`, `function _temac_iow_be`, `function _temac_ior_le`, `function _temac_iow_le`, `function hard_acs_rdy`, `function hard_acs_rdy_or_timeout`, `function temac_indirect_busywait`, `function temac_indirect_in32`, `function temac_indirect_in32_locked`, `function temac_indirect_out32`.
- 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.