drivers/net/ethernet/mediatek/mtk_eth_soc.h
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mediatek/mtk_eth_soc.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mediatek/mtk_eth_soc.h- Extension
.h- Size
- 47211 bytes
- Lines
- 1520
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/dma-mapping.hlinux/netdevice.hlinux/of_net.hlinux/u64_stats_sync.hlinux/refcount.hlinux/phylink.hlinux/rhashtable.hlinux/dim.hlinux/bitfield.hnet/page_pool/types.hlinux/bpf_trace.hmtk_ppe.h
Detected Declarations
struct mtk_rx_dmastruct mtk_rx_dma_v2struct mtk_tx_dmastruct mtk_tx_dma_v2struct mtk_ethstruct mtk_macstruct mtk_xdp_statsstruct mtk_hw_statsstruct mtk_tx_bufstruct mtk_tx_ringstruct mtk_rx_ringstruct mtk_tx_dma_desc_infostruct mtk_reg_mapstruct mtk_soc_datastruct mtk_ethstruct mtk_macenum mtk_tx_flagsenum mtk_clks_mapenum mtk_dev_stateenum mtk_pse_portenum mtk_gmac_idenum mtk_tx_buf_typeenum mtk_rx_flagsenum mkt_eth_capabilitiesfunction mtk_is_netsys_v1function mtk_is_netsys_v2_or_greaterfunction mtk_is_netsys_v3_or_greaterfunction mtk_foe_get_entryfunction mtk_get_ib1_ts_maskfunction mtk_get_ib1_ppoe_maskfunction mtk_get_ib1_vlan_tag_maskfunction mtk_get_ib1_vlan_layer_maskfunction mtk_prep_ib1_vlan_layerfunction mtk_get_ib1_vlan_layerfunction mtk_get_ib1_pkt_type_maskfunction mtk_get_ib1_pkt_typefunction mtk_get_ib2_multicast_maskfunction mtk_interface_mode_is_xgmii
Annotated Snippet
struct mtk_rx_dma {
unsigned int rxd1;
unsigned int rxd2;
unsigned int rxd3;
unsigned int rxd4;
} __packed __aligned(4);
struct mtk_rx_dma_v2 {
unsigned int rxd1;
unsigned int rxd2;
unsigned int rxd3;
unsigned int rxd4;
unsigned int rxd5;
unsigned int rxd6;
unsigned int rxd7;
unsigned int rxd8;
} __packed __aligned(4);
struct mtk_tx_dma {
unsigned int txd1;
unsigned int txd2;
unsigned int txd3;
unsigned int txd4;
} __packed __aligned(4);
struct mtk_tx_dma_v2 {
unsigned int txd1;
unsigned int txd2;
unsigned int txd3;
unsigned int txd4;
unsigned int txd5;
unsigned int txd6;
unsigned int txd7;
unsigned int txd8;
} __packed __aligned(4);
struct mtk_eth;
struct mtk_mac;
struct mtk_xdp_stats {
u64 rx_xdp_redirect;
u64 rx_xdp_pass;
u64 rx_xdp_drop;
u64 rx_xdp_tx;
u64 rx_xdp_tx_errors;
u64 tx_xdp_xmit;
u64 tx_xdp_xmit_errors;
};
/* struct mtk_hw_stats - the structure that holds the traffic statistics.
* @stats_lock: make sure that stats operations are atomic
* @reg_offset: the status register offset of the SoC
* @syncp: the refcount
*
* All of the supported SoCs have hardware counters for traffic statistics.
* Whenever the status IRQ triggers we can read the latest stats from these
* counters and store them in this struct.
*/
struct mtk_hw_stats {
u64 tx_bytes;
u64 tx_packets;
u64 tx_skip;
u64 tx_collisions;
u64 rx_bytes;
u64 rx_packets;
u64 rx_overflow;
u64 rx_fcs_errors;
u64 rx_short_errors;
u64 rx_long_errors;
u64 rx_checksum_errors;
u64 rx_flow_control_packets;
struct mtk_xdp_stats xdp_stats;
spinlock_t stats_lock;
u32 reg_offset;
struct u64_stats_sync syncp;
};
enum mtk_tx_flags {
/* PDMA descriptor can point at 1-2 segments. This enum allows us to
* track how memory was allocated so that it can be freed properly.
*/
MTK_TX_FLAGS_SINGLE0 = 0x01,
MTK_TX_FLAGS_PAGE0 = 0x02,
};
/* This enum allows us to identify how the clock is defined on the array of the
* clock in the order
*/
Annotation
- Immediate include surface: `linux/dma-mapping.h`, `linux/netdevice.h`, `linux/of_net.h`, `linux/u64_stats_sync.h`, `linux/refcount.h`, `linux/phylink.h`, `linux/rhashtable.h`, `linux/dim.h`.
- Detected declarations: `struct mtk_rx_dma`, `struct mtk_rx_dma_v2`, `struct mtk_tx_dma`, `struct mtk_tx_dma_v2`, `struct mtk_eth`, `struct mtk_mac`, `struct mtk_xdp_stats`, `struct mtk_hw_stats`, `struct mtk_tx_buf`, `struct mtk_tx_ring`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.