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.

Dependency Surface

Detected Declarations

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

Implementation Notes