drivers/net/ethernet/marvell/sky2.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/marvell/sky2.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/marvell/sky2.c- Extension
.c- Size
- 137793 bytes
- Lines
- 5161
- 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/crc32.hlinux/kernel.hlinux/module.hlinux/netdevice.hlinux/dma-mapping.hlinux/etherdevice.hlinux/ethtool.hlinux/pci.hlinux/interrupt.hlinux/ip.hlinux/slab.hnet/ip.hlinux/tcp.hlinux/in.hlinux/delay.hlinux/workqueue.hlinux/if_vlan.hlinux/prefetch.hlinux/debugfs.hlinux/mii.hlinux/of_net.hlinux/dmi.hlinux/skbuff_ref.hasm/irq.hsky2.h
Detected Declarations
function gm_phy_writefunction __gm_phy_readfunction gm_phy_readfunction sky2_power_onfunction sky2_power_auxfunction sky2_gmac_resetfunction sky2_phy_initfunction sky2_phy_power_upfunction sky2_phy_power_downfunction sky2_set_ipgfunction sky2_enable_rx_txfunction sky2_phy_reinitfunction sky2_wol_initfunction sky2_set_tx_stfwdfunction sky2_mac_initfunction sky2_ramsetfunction sky2_qsetfunction sky2_prefetch_initfunction tx_initfunction sky2_put_idxfunction sky2_get_rx_thresholdfunction sky2_get_rx_data_sizefunction sky2_rx_addfunction sky2_rx_submitfunction sky2_rx_map_skbfunction sky2_rx_unmap_skbfunction rx_set_checksumfunction rx_set_rssfunction sky2_rx_stopfunction sky2_rx_cleanfunction sky2_ioctlfunction sky2_vlan_modefunction sky2_rx_padfunction sky2_rx_updatefunction sky2_alloc_rx_skbsfunction sky2_rx_startfunction sky2_alloc_buffersfunction sky2_free_buffersfunction sky2_hw_upfunction sky2_setup_irqfunction sky2_openfunction tx_inusefunction tx_availfunction tx_le_reqfunction sky2_tx_unmapfunction sky2_xmit_framefunction FIFOfunction sky2_tx_reset
Annotated Snippet
static const struct net_device_ops sky2_netdev_ops[2] = {
{
.ndo_open = sky2_open,
.ndo_stop = sky2_close,
.ndo_start_xmit = sky2_xmit_frame,
.ndo_eth_ioctl = sky2_ioctl,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = sky2_set_mac_address,
.ndo_set_rx_mode = sky2_set_multicast,
.ndo_change_mtu = sky2_change_mtu,
.ndo_fix_features = sky2_fix_features,
.ndo_set_features = sky2_set_features,
.ndo_tx_timeout = sky2_tx_timeout,
.ndo_get_stats64 = sky2_get_stats,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = sky2_netpoll,
#endif
},
{
.ndo_open = sky2_open,
.ndo_stop = sky2_close,
.ndo_start_xmit = sky2_xmit_frame,
.ndo_eth_ioctl = sky2_ioctl,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = sky2_set_mac_address,
.ndo_set_rx_mode = sky2_set_multicast,
.ndo_change_mtu = sky2_change_mtu,
.ndo_fix_features = sky2_fix_features,
.ndo_set_features = sky2_set_features,
.ndo_tx_timeout = sky2_tx_timeout,
.ndo_get_stats64 = sky2_get_stats,
},
};
/* Initialize network device */
static struct net_device *sky2_init_netdev(struct sky2_hw *hw, unsigned port,
int highmem, int wol)
{
struct sky2_port *sky2;
struct net_device *dev = alloc_etherdev(sizeof(*sky2));
int ret;
if (!dev)
return NULL;
SET_NETDEV_DEV(dev, &hw->pdev->dev);
dev->irq = hw->pdev->irq;
dev->ethtool_ops = &sky2_ethtool_ops;
dev->watchdog_timeo = TX_WATCHDOG;
dev->netdev_ops = &sky2_netdev_ops[port];
sky2 = netdev_priv(dev);
sky2->netdev = dev;
sky2->hw = hw;
sky2->msg_enable = netif_msg_init(debug, default_msg);
u64_stats_init(&sky2->tx_stats.syncp);
u64_stats_init(&sky2->rx_stats.syncp);
/* Auto speed and flow control */
sky2->flags = SKY2_FLAG_AUTO_SPEED | SKY2_FLAG_AUTO_PAUSE;
if (hw->chip_id != CHIP_ID_YUKON_XL)
dev->hw_features |= NETIF_F_RXCSUM;
sky2->flow_mode = FC_BOTH;
sky2->duplex = -1;
sky2->speed = -1;
sky2->advertising = sky2_supported_modes(hw);
sky2->wol = wol;
spin_lock_init(&sky2->phy_lock);
sky2->tx_pending = TX_DEF_PENDING;
sky2->tx_ring_size = roundup_ring_size(TX_DEF_PENDING);
sky2->rx_pending = RX_DEF_PENDING;
hw->dev[port] = dev;
sky2->port = port;
dev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_TSO;
if (highmem)
dev->features |= NETIF_F_HIGHDMA;
/* Enable receive hashing unless hardware is known broken */
if (!(hw->flags & SKY2_HW_RSS_BROKEN))
dev->hw_features |= NETIF_F_RXHASH;
Annotation
- Immediate include surface: `linux/crc32.h`, `linux/kernel.h`, `linux/module.h`, `linux/netdevice.h`, `linux/dma-mapping.h`, `linux/etherdevice.h`, `linux/ethtool.h`, `linux/pci.h`.
- Detected declarations: `function gm_phy_write`, `function __gm_phy_read`, `function gm_phy_read`, `function sky2_power_on`, `function sky2_power_aux`, `function sky2_gmac_reset`, `function sky2_phy_init`, `function sky2_phy_power_up`, `function sky2_phy_power_down`, `function sky2_set_ipg`.
- 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.