drivers/net/ethernet/alibaba/eea/eea_net.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/alibaba/eea/eea_net.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/alibaba/eea/eea_net.c- Extension
.c- Size
- 18935 bytes
- Lines
- 888
- 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/etherdevice.hlinux/module.hlinux/netdevice.hlinux/rtnetlink.hnet/netdev_queues.heea_adminq.heea_net.heea_pci.heea_ring.h
Detected Declarations
function Copyrightfunction eea_free_irq_blkfunction eea_alloc_irq_blksfunction eea_update_queuesfunction eea_init_ctxfunction eea_bind_q_and_cfgfunction eea_unbind_q_and_cfgfunction eea_free_rxtx_q_memfunction eea_alloc_rxtx_q_memfunction eea_hw_active_ringfunction eea_hw_unactive_ringfunction eea_stop_rxtxfunction eea_start_rxtxfunction eea_netdev_stopfunction eea_netdev_openfunction eea_statsfunction eea_reset_hw_resourcesfunction eea_queues_check_and_resetfunction eea_update_cfgfunction eea_netdev_init_featuresfunction eea_update_ts_offfunction eea_net_reprobefunction netif_runningfunction eea_net_probefunction eea_net_ha_reset_removefunction eea_net_removefunction eea_net_shutdown
Annotated Snippet
static const struct net_device_ops eea_netdev = {
.ndo_open = eea_netdev_open,
.ndo_stop = eea_netdev_stop,
.ndo_start_xmit = eea_tx_xmit,
.ndo_validate_addr = eth_validate_addr,
.ndo_get_stats64 = eea_stats,
.ndo_features_check = passthru_features_check,
};
static struct eea_net *eea_netdev_alloc(struct eea_device *edev, u32 pairs)
{
struct net_device *netdev;
struct eea_net *enet;
int err;
netdev = alloc_etherdev_mq(sizeof(struct eea_net), pairs);
if (!netdev) {
dev_err(edev->dma_dev,
"alloc_etherdev_mq failed with pairs %d\n", pairs);
return NULL;
}
netdev->netdev_ops = &eea_netdev;
netdev->ethtool_ops = &eea_ethtool_ops;
SET_NETDEV_DEV(netdev, edev->dma_dev);
enet = netdev_priv(netdev);
enet->netdev = netdev;
enet->edev = edev;
edev->enet = enet;
err = eea_alloc_irq_blks(enet);
if (err) {
dev_err(edev->dma_dev,
"eea_alloc_irq_blks failed with pairs %d\n", pairs);
free_netdev(netdev);
return NULL;
}
spin_lock_init(&enet->stats_lock);
return enet;
}
static void eea_update_ts_off(struct eea_device *edev, struct eea_net *enet)
{
u64 ts;
ts = eea_pci_device_ts(edev);
enet->hw_ts_offset = ktime_get_real() - ts;
}
static int eea_net_reprobe(struct eea_device *edev)
{
struct eea_net *enet = edev->enet;
int err = 0;
enet->edev = edev;
if (!enet->adminq.ring) {
err = eea_create_adminq(enet, edev->rx_num + edev->tx_num);
if (err)
return err;
}
err = eea_alloc_irq_blks(enet);
if (err)
goto err_destroy_aq;
eea_update_ts_off(edev, enet);
rtnl_lock();
enet->link_err = 0;
if (edev->ha_reset_netdev_running &&
netif_running(edev->enet->netdev)) {
err = eea_netdev_open(enet->netdev);
if (err) {
enet->link_err = EEA_LINK_ERR_HA_RESET_DEV;
rtnl_unlock();
goto err_free_irq_blks;
}
}
rtnl_unlock();
enet->wait_pci_ready = false;
return 0;
Annotation
- Immediate include surface: `linux/etherdevice.h`, `linux/module.h`, `linux/netdevice.h`, `linux/rtnetlink.h`, `net/netdev_queues.h`, `eea_adminq.h`, `eea_net.h`, `eea_pci.h`.
- Detected declarations: `function Copyright`, `function eea_free_irq_blk`, `function eea_alloc_irq_blks`, `function eea_update_queues`, `function eea_init_ctx`, `function eea_bind_q_and_cfg`, `function eea_unbind_q_and_cfg`, `function eea_free_rxtx_q_mem`, `function eea_alloc_rxtx_q_mem`, `function eea_hw_active_ring`.
- 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.