drivers/net/ethernet/marvell/skge.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/marvell/skge.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/marvell/skge.c- Extension
.c- Size
- 108471 bytes
- Lines
- 4191
- 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/in.hlinux/kernel.hlinux/module.hlinux/moduleparam.hlinux/netdevice.hlinux/etherdevice.hlinux/ethtool.hlinux/pci.hlinux/if_vlan.hlinux/ip.hlinux/delay.hlinux/crc32.hlinux/dma-mapping.hlinux/debugfs.hlinux/sched.hlinux/seq_file.hlinux/mii.hlinux/slab.hlinux/dmi.hlinux/prefetch.hasm/irq.hskge.h
Detected Declarations
enum led_modefunction is_genesisfunction skge_get_regs_lenfunction skge_get_regsfunction wol_supportedfunction skge_wol_initfunction skge_get_wolfunction skge_set_wolfunction skge_supported_modesfunction skge_get_link_ksettingsfunction skge_set_link_ksettingsfunction skge_get_drvinfofunction skge_get_sset_countfunction skge_get_ethtool_statsfunction skge_get_stringsfunction skge_get_ring_paramfunction skge_set_ring_paramfunction skge_get_msglevelfunction skge_set_msglevelfunction skge_nway_resetfunction skge_get_pauseparamfunction skge_set_pauseparamfunction hwkhzfunction skge_clk2usecfunction skge_usecs2clkfunction skge_get_coalescefunction skge_set_coalescefunction skge_ledfunction skge_set_phys_idfunction skge_get_eeprom_lenfunction skge_vpd_readfunction skge_vpd_writefunction skge_get_eepromfunction skge_set_eepromfunction skge_ring_allocfunction skge_rx_setupfunction skge_rx_reusefunction skge_rx_cleanfunction skge_rx_fillfunction skge_link_upfunction skge_link_downfunction xm_link_downfunction __xm_phy_readfunction xm_phy_readfunction xm_phy_writefunction genesis_initfunction genesis_resetfunction bcom_check_link
Annotated Snippet
static const struct net_device_ops skge_netdev_ops = {
.ndo_open = skge_up,
.ndo_stop = skge_down,
.ndo_start_xmit = skge_xmit_frame,
.ndo_eth_ioctl = skge_ioctl,
.ndo_get_stats = skge_get_stats,
.ndo_tx_timeout = skge_tx_timeout,
.ndo_change_mtu = skge_change_mtu,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_rx_mode = skge_set_multicast,
.ndo_set_mac_address = skge_set_mac_address,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = skge_netpoll,
#endif
};
/* Initialize network device */
static struct net_device *skge_devinit(struct skge_hw *hw, int port,
int highmem)
{
struct skge_port *skge;
struct net_device *dev = alloc_etherdev(sizeof(*skge));
u8 addr[ETH_ALEN];
if (!dev)
return NULL;
SET_NETDEV_DEV(dev, &hw->pdev->dev);
dev->netdev_ops = &skge_netdev_ops;
dev->ethtool_ops = &skge_ethtool_ops;
dev->watchdog_timeo = TX_WATCHDOG;
dev->irq = hw->pdev->irq;
/* MTU range: 60 - 9000 */
dev->min_mtu = ETH_ZLEN;
dev->max_mtu = ETH_JUMBO_MTU;
if (highmem)
dev->features |= NETIF_F_HIGHDMA;
skge = netdev_priv(dev);
netif_napi_add(dev, &skge->napi, skge_poll);
skge->netdev = dev;
skge->hw = hw;
skge->msg_enable = netif_msg_init(debug, default_msg);
skge->tx_ring.count = DEFAULT_TX_RING_SIZE;
skge->rx_ring.count = DEFAULT_RX_RING_SIZE;
/* Auto speed and flow control */
skge->autoneg = AUTONEG_ENABLE;
skge->flow_control = FLOW_MODE_SYM_OR_REM;
skge->duplex = -1;
skge->speed = -1;
skge->advertising = skge_supported_modes(hw);
if (device_can_wakeup(&hw->pdev->dev)) {
skge->wol = wol_supported(hw) & WAKE_MAGIC;
device_set_wakeup_enable(&hw->pdev->dev, skge->wol);
}
hw->dev[port] = dev;
skge->port = port;
/* Only used for Genesis XMAC */
if (is_genesis(hw))
timer_setup(&skge->link_timer, xm_link_timer, 0);
else {
dev->hw_features = NETIF_F_IP_CSUM | NETIF_F_SG |
NETIF_F_RXCSUM;
dev->features |= dev->hw_features;
}
/* read the mac address */
memcpy_fromio(addr, hw->regs + B2_MAC_1 + port*8, ETH_ALEN);
eth_hw_addr_set(dev, addr);
return dev;
}
static void skge_show_addr(struct net_device *dev)
{
const struct skge_port *skge = netdev_priv(dev);
netif_info(skge, probe, skge->netdev, "addr %pM\n", dev->dev_addr);
}
static int only_32bit_dma;
Annotation
- Immediate include surface: `linux/in.h`, `linux/kernel.h`, `linux/module.h`, `linux/moduleparam.h`, `linux/netdevice.h`, `linux/etherdevice.h`, `linux/ethtool.h`, `linux/pci.h`.
- Detected declarations: `enum led_mode`, `function is_genesis`, `function skge_get_regs_len`, `function skge_get_regs`, `function wol_supported`, `function skge_wol_init`, `function skge_get_wol`, `function skge_set_wol`, `function skge_supported_modes`, `function skge_get_link_ksettings`.
- 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.