drivers/net/ethernet/broadcom/genet/bcmgenet.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/broadcom/genet/bcmgenet.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/broadcom/genet/bcmgenet.c- Extension
.c- Size
- 120574 bytes
- Lines
- 4419
- 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/acpi.hlinux/kernel.hlinux/module.hlinux/sched.hlinux/types.hlinux/fcntl.hlinux/interrupt.hlinux/string.hlinux/if_ether.hlinux/init.hlinux/errno.hlinux/delay.hlinux/platform_device.hlinux/dma-mapping.hlinux/pm.hlinux/clk.hnet/arp.hlinux/mii.hlinux/ethtool.hlinux/netdevice.hlinux/inetdevice.hlinux/etherdevice.hlinux/skbuff.hlinux/in.hlinux/ip.hlinux/ipv6.hlinux/phy.hlinux/unaligned.hbcmgenet.h
Detected Declarations
struct bcmgenet_statsstruct bcmgenet_plat_dataenum dma_regenum dma_ring_regenum bcmgenet_stat_typefunction bcmgenet_writelfunction bcmgenet_readlfunction dmadesc_set_length_statusfunction dmadesc_set_addrfunction dmadesc_setfunction bcmgenet_rbuf_ctrl_getfunction bcmgenet_rbuf_ctrl_setfunction bcmgenet_tbuf_ctrl_getfunction bcmgenet_tbuf_ctrl_setfunction bcmgenet_bp_mc_getfunction bcmgenet_bp_mc_setfunction bcmgenet_tdma_readlfunction bcmgenet_tdma_writelfunction bcmgenet_rdma_readlfunction bcmgenet_rdma_writelfunction bcmgenet_tdma_ring_readlfunction bcmgenet_tdma_ring_writelfunction bcmgenet_rdma_ring_readlfunction bcmgenet_rdma_ring_writelfunction bcmgenet_hfb_enable_filterfunction bcmgenet_hfb_disable_filterfunction bcmgenet_hfb_set_filter_rx_queue_mappingfunction bcmgenet_hfb_set_filter_lengthfunction bcmgenet_hfb_validate_maskfunction bcmgenet_hfb_insert_datafunction bcmgenet_hfb_create_rxnfc_filterfunction bcmgenet_hfb_clear_filterfunction bcmgenet_hfb_clearfunction bcmgenet_hfb_initfunction bcmgenet_beginfunction bcmgenet_completefunction bcmgenet_get_link_ksettingsfunction bcmgenet_set_link_ksettingsfunction bcmgenet_set_featuresfunction bcmgenet_get_msglevelfunction bcmgenet_set_msglevelfunction bcmgenet_get_coalescefunction bcmgenet_set_rx_coalescefunction bcmgenet_set_ring_rx_coalescefunction bcmgenet_set_coalescefunction bcmgenet_get_pauseparamfunction bcmgenet_set_pauseparamfunction bcmgenet_get_drvinfo
Annotated Snippet
static const struct net_device_ops bcmgenet_netdev_ops = {
.ndo_open = bcmgenet_open,
.ndo_stop = bcmgenet_close,
.ndo_start_xmit = bcmgenet_xmit,
.ndo_tx_timeout = bcmgenet_timeout,
.ndo_set_rx_mode = bcmgenet_set_rx_mode,
.ndo_set_mac_address = bcmgenet_set_mac_addr,
.ndo_eth_ioctl = phy_do_ioctl_running,
.ndo_set_features = bcmgenet_set_features,
.ndo_get_stats64 = bcmgenet_get_stats64,
.ndo_change_carrier = bcmgenet_change_carrier,
};
/* GENET hardware parameters/characteristics */
static const struct bcmgenet_hw_params bcmgenet_hw_params_v1 = {
.tx_queues = 0,
.tx_bds_per_q = 0,
.rx_queues = 0,
.rx_bds_per_q = 0,
.bp_in_en_shift = 16,
.bp_in_mask = 0xffff,
.hfb_filter_cnt = 16,
.hfb_filter_size = 64,
.qtag_mask = 0x1F,
.hfb_offset = 0x1000,
.hfb_reg_offset = GENET_RBUF_OFF + RBUF_HFB_CTRL_V1,
.rdma_offset = 0x2000,
.tdma_offset = 0x3000,
.words_per_bd = 2,
};
static const struct bcmgenet_hw_params bcmgenet_hw_params_v2 = {
.tx_queues = 4,
.tx_bds_per_q = 32,
.rx_queues = 0,
.rx_bds_per_q = 0,
.bp_in_en_shift = 16,
.bp_in_mask = 0xffff,
.hfb_filter_cnt = 16,
.hfb_filter_size = 64,
.qtag_mask = 0x1F,
.tbuf_offset = 0x0600,
.hfb_offset = 0x1000,
.hfb_reg_offset = 0x2000,
.rdma_offset = 0x3000,
.tdma_offset = 0x4000,
.words_per_bd = 2,
};
static const struct bcmgenet_hw_params bcmgenet_hw_params_v3 = {
.tx_queues = 4,
.tx_bds_per_q = 32,
.rx_queues = 0,
.rx_bds_per_q = 0,
.bp_in_en_shift = 17,
.bp_in_mask = 0x1ffff,
.hfb_filter_cnt = 48,
.hfb_filter_size = 128,
.qtag_mask = 0x3F,
.tbuf_offset = 0x0600,
.hfb_offset = 0x8000,
.hfb_reg_offset = 0xfc00,
.rdma_offset = 0x10000,
.tdma_offset = 0x11000,
.words_per_bd = 2,
};
static const struct bcmgenet_hw_params bcmgenet_hw_params_v4 = {
.tx_queues = 4,
.tx_bds_per_q = 32,
.rx_queues = 0,
.rx_bds_per_q = 0,
.bp_in_en_shift = 17,
.bp_in_mask = 0x1ffff,
.hfb_filter_cnt = 48,
.hfb_filter_size = 128,
.qtag_mask = 0x3F,
.tbuf_offset = 0x0600,
.hfb_offset = 0x8000,
.hfb_reg_offset = 0xfc00,
.rdma_offset = 0x2000,
.tdma_offset = 0x4000,
.words_per_bd = 3,
};
/* Infer hardware parameters from the detected GENET version */
static void bcmgenet_set_hw_params(struct bcmgenet_priv *priv)
{
const struct bcmgenet_hw_params *params;
u32 reg;
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/kernel.h`, `linux/module.h`, `linux/sched.h`, `linux/types.h`, `linux/fcntl.h`, `linux/interrupt.h`, `linux/string.h`.
- Detected declarations: `struct bcmgenet_stats`, `struct bcmgenet_plat_data`, `enum dma_reg`, `enum dma_ring_reg`, `enum bcmgenet_stat_type`, `function bcmgenet_writel`, `function bcmgenet_readl`, `function dmadesc_set_length_status`, `function dmadesc_set_addr`, `function dmadesc_set`.
- 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.