drivers/net/ethernet/faraday/ftmac100.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/faraday/ftmac100.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/faraday/ftmac100.c- Extension
.c- Size
- 32870 bytes
- Lines
- 1262
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/dma-mapping.hlinux/etherdevice.hlinux/ethtool.hlinux/if_ether.hlinux/if_vlan.hlinux/init.hlinux/interrupt.hlinux/io.hlinux/mii.hlinux/module.hlinux/mod_devicetable.hlinux/netdevice.hlinux/platform_device.hftmac100.h
Detected Declarations
struct ftmac100_descsstruct ftmac100function functionsfunction ftmac100_disable_all_intfunction ftmac100_set_rx_ring_basefunction ftmac100_set_tx_ring_basefunction ftmac100_txdma_start_pollingfunction ftmac100_resetfunction ftmac100_set_macfunction ftmac100_setup_mc_htfunction netdev_for_each_mc_addrfunction ftmac100_set_rx_bitsfunction ftmac100_start_hwfunction ftmac100_stop_hwfunction functionsfunction ftmac100_rxdes_last_segmentfunction ftmac100_rxdes_owned_by_dmafunction ftmac100_rxdes_set_dma_ownfunction ftmac100_rxdes_rx_errorfunction ftmac100_rxdes_crc_errorfunction ftmac100_rxdes_runtfunction ftmac100_rxdes_odd_nibblefunction ftmac100_rxdes_frame_lengthfunction ftmac100_rxdes_multicastfunction ftmac100_rxdes_set_buffer_sizefunction ftmac100_rxdes_set_end_of_ringfunction ftmac100_rxdes_set_dma_addrfunction ftmac100_rxdes_get_dma_addrfunction ftmac100_rxdes_set_pagefunction functionsfunction ftmac100_rx_pointer_advancefunction ftmac100_rx_locate_first_segmentfunction ftmac100_rx_packet_errorfunction ftmac100_rx_drop_packetfunction ftmac100_rx_packetfunction functionsfunction ftmac100_txdes_owned_by_dmafunction ftmac100_txdes_set_dma_ownfunction ftmac100_txdes_excessive_collisionfunction ftmac100_txdes_late_collisionfunction ftmac100_txdes_set_end_of_ringfunction ftmac100_txdes_set_first_segmentfunction ftmac100_txdes_set_last_segmentfunction ftmac100_txdes_set_txintfunction ftmac100_txdes_set_buffer_sizefunction ftmac100_txdes_set_dma_addrfunction ftmac100_txdes_get_dma_addrfunction ftmac100_txdes_set_skb
Annotated Snippet
* struct net_device_ops functions
*****************************************************************************/
static int ftmac100_open(struct net_device *netdev)
{
struct ftmac100 *priv = netdev_priv(netdev);
int err;
err = ftmac100_alloc_buffers(priv);
if (err) {
netdev_err(netdev, "failed to allocate buffers\n");
goto err_alloc;
}
err = request_irq(priv->irq, ftmac100_interrupt, 0, netdev->name, netdev);
if (err) {
netdev_err(netdev, "failed to request irq %d\n", priv->irq);
goto err_irq;
}
priv->rx_pointer = 0;
priv->tx_clean_pointer = 0;
priv->tx_pointer = 0;
priv->tx_pending = 0;
err = ftmac100_start_hw(priv);
if (err)
goto err_hw;
napi_enable(&priv->napi);
netif_start_queue(netdev);
ftmac100_enable_all_int(priv);
return 0;
err_hw:
free_irq(priv->irq, netdev);
err_irq:
ftmac100_free_buffers(priv);
err_alloc:
return err;
}
static int ftmac100_stop(struct net_device *netdev)
{
struct ftmac100 *priv = netdev_priv(netdev);
ftmac100_disable_all_int(priv);
netif_stop_queue(netdev);
napi_disable(&priv->napi);
ftmac100_stop_hw(priv);
free_irq(priv->irq, netdev);
ftmac100_free_buffers(priv);
return 0;
}
static netdev_tx_t
ftmac100_hard_start_xmit(struct sk_buff *skb, struct net_device *netdev)
{
struct ftmac100 *priv = netdev_priv(netdev);
dma_addr_t map;
if (unlikely(skb->len > MAX_PKT_SIZE)) {
if (net_ratelimit())
netdev_dbg(netdev, "tx packet too big\n");
netdev->stats.tx_dropped++;
dev_kfree_skb(skb);
return NETDEV_TX_OK;
}
map = dma_map_single(priv->dev, skb->data, skb_headlen(skb), DMA_TO_DEVICE);
if (unlikely(dma_mapping_error(priv->dev, map))) {
/* drop packet */
if (net_ratelimit())
netdev_err(netdev, "map socket buffer failed\n");
netdev->stats.tx_dropped++;
dev_kfree_skb(skb);
return NETDEV_TX_OK;
}
return ftmac100_xmit(priv, skb, map);
}
/* optional */
static int ftmac100_do_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
{
struct ftmac100 *priv = netdev_priv(netdev);
Annotation
- Immediate include surface: `linux/dma-mapping.h`, `linux/etherdevice.h`, `linux/ethtool.h`, `linux/if_ether.h`, `linux/if_vlan.h`, `linux/init.h`, `linux/interrupt.h`, `linux/io.h`.
- Detected declarations: `struct ftmac100_descs`, `struct ftmac100`, `function functions`, `function ftmac100_disable_all_int`, `function ftmac100_set_rx_ring_base`, `function ftmac100_set_tx_ring_base`, `function ftmac100_txdma_start_polling`, `function ftmac100_reset`, `function ftmac100_set_mac`, `function ftmac100_setup_mc_ht`.
- 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.