drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c- Extension
.c- Size
- 27468 bytes
- Lines
- 940
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/acpi.hlinux/pcs-lynx.hlinux/phy/phy.hlinux/property.hdpaa2-eth.hdpaa2-mac.h
Detected Declarations
struct dpmac_counterfunction dpaa2_mac_setup_statsfunction dpaa2_mac_clear_statsfunction dpaa2_mac_cmp_verfunction dpaa2_mac_detect_featuresfunction phy_modefunction dpmac_eth_if_modefunction fwnode_for_each_child_nodefunction dpaa2_mac_get_if_modefunction dpaa2_mac_configfunction dpaa2_mac_link_upfunction dpaa2_mac_link_downfunction dpaa2_pcs_createfunction dpaa2_pcs_destroyfunction dpaa2_mac_set_supported_interfacesfunction dpaa2_mac_startfunction dpaa2_mac_stopfunction dpaa2_mac_connectfunction dpaa2_mac_disconnectfunction dpaa2_mac_openfunction dpaa2_mac_closefunction dpaa2_mac_transfer_statsfunction dpaa2_mac_get_standard_statsfunction dpaa2_mac_get_rmon_statsfunction dpaa2_mac_get_pause_statsfunction dpaa2_mac_get_ctrl_statsfunction dpaa2_mac_get_eth_mac_statsfunction dpaa2_mac_get_sset_countfunction dpaa2_mac_get_stringsfunction dpaa2_mac_get_ethtool_statsexport dpaa2_mac_startexport dpaa2_mac_stopexport dpaa2_mac_connectexport dpaa2_mac_disconnectexport dpaa2_mac_openexport dpaa2_mac_closeexport dpaa2_mac_get_rmon_statsexport dpaa2_mac_get_pause_statsexport dpaa2_mac_get_ctrl_statsexport dpaa2_mac_get_eth_mac_statsexport dpaa2_mac_get_sset_countexport dpaa2_mac_get_stringsexport dpaa2_mac_get_ethtool_stats
Annotated Snippet
struct dpmac_counter {
enum dpmac_counter_id id;
size_t offset;
const char *name;
};
#define DPMAC_COUNTER(counter_id, struct_name, struct_offset) \
{ \
.id = counter_id, \
.offset = offsetof(struct_name, struct_offset), \
}
#define DPMAC_UNSTRUCTURED_COUNTER(counter_id, counter_name) \
{ \
.id = counter_id, \
.name = counter_name, \
}
#define DPMAC_RMON_COUNTER(counter_id, struct_offset) \
DPMAC_COUNTER(counter_id, struct ethtool_rmon_stats, struct_offset)
#define DPMAC_PAUSE_COUNTER(counter_id, struct_offset) \
DPMAC_COUNTER(counter_id, struct ethtool_pause_stats, struct_offset)
#define DPMAC_CTRL_COUNTER(counter_id, struct_offset) \
DPMAC_COUNTER(counter_id, struct ethtool_eth_ctrl_stats, struct_offset)
#define DPMAC_MAC_COUNTER(counter_id, struct_offset) \
DPMAC_COUNTER(counter_id, struct ethtool_eth_mac_stats, struct_offset)
static const struct dpmac_counter dpaa2_mac_ethtool_stats[] = {
DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_ING_ALL_FRAME, "[mac] rx all frames"),
DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_ING_GOOD_FRAME, "[mac] rx frames ok"),
DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_ING_ERR_FRAME, "[mac] rx frame errors"),
DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_ING_FRAME_DISCARD, "[mac] rx frame discards"),
DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_ING_UCAST_FRAME, "[mac] rx u-cast"),
DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_ING_BCAST_FRAME, "[mac] rx b-cast"),
DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_ING_MCAST_FRAME, "[mac] rx m-cast"),
DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_ING_FRAME_64, "[mac] rx 64 bytes"),
DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_ING_FRAME_127, "[mac] rx 65-127 bytes"),
DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_ING_FRAME_255, "[mac] rx 128-255 bytes"),
DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_ING_FRAME_511, "[mac] rx 256-511 bytes"),
DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_ING_FRAME_1023, "[mac] rx 512-1023 bytes"),
DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_ING_FRAME_1518, "[mac] rx 1024-1518 bytes"),
DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_ING_FRAME_1519_MAX, "[mac] rx 1519-max bytes"),
DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_ING_FRAG, "[mac] rx frags"),
DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_ING_JABBER, "[mac] rx jabber"),
DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_ING_ALIGN_ERR, "[mac] rx align errors"),
DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_ING_OVERSIZED, "[mac] rx oversized"),
DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_ING_VALID_PAUSE_FRAME, "[mac] rx pause"),
DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_ING_BYTE, "[mac] rx bytes"),
DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_EGR_GOOD_FRAME, "[mac] tx frames ok"),
DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_EGR_UCAST_FRAME, "[mac] tx u-cast"),
DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_EGR_MCAST_FRAME, "[mac] tx m-cast"),
DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_EGR_BCAST_FRAME, "[mac] tx b-cast"),
DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_EGR_ERR_FRAME, "[mac] tx frame errors"),
DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_EGR_UNDERSIZED, "[mac] tx undersized"),
DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_EGR_VALID_PAUSE_FRAME, "[mac] tx b-pause"),
DPMAC_UNSTRUCTURED_COUNTER(DPMAC_CNT_EGR_BYTE, "[mac] tx bytes"),
};
#define DPAA2_MAC_NUM_ETHTOOL_STATS ARRAY_SIZE(dpaa2_mac_ethtool_stats)
static const struct dpmac_counter dpaa2_mac_rmon_stats[] = {
DPMAC_RMON_COUNTER(DPMAC_CNT_ING_FRAME_64, hist[0]),
DPMAC_RMON_COUNTER(DPMAC_CNT_ING_FRAME_127, hist[1]),
DPMAC_RMON_COUNTER(DPMAC_CNT_ING_FRAME_255, hist[2]),
DPMAC_RMON_COUNTER(DPMAC_CNT_ING_FRAME_511, hist[3]),
DPMAC_RMON_COUNTER(DPMAC_CNT_ING_FRAME_1023, hist[4]),
DPMAC_RMON_COUNTER(DPMAC_CNT_ING_FRAME_1518, hist[5]),
DPMAC_RMON_COUNTER(DPMAC_CNT_ING_FRAME_1519_MAX, hist[6]),
DPMAC_RMON_COUNTER(DPMAC_CNT_EGR_FRAME_64, hist_tx[0]),
DPMAC_RMON_COUNTER(DPMAC_CNT_EGR_FRAME_127, hist_tx[1]),
DPMAC_RMON_COUNTER(DPMAC_CNT_EGR_FRAME_255, hist_tx[2]),
DPMAC_RMON_COUNTER(DPMAC_CNT_EGR_FRAME_511, hist_tx[3]),
DPMAC_RMON_COUNTER(DPMAC_CNT_EGR_FRAME_1023, hist_tx[4]),
DPMAC_RMON_COUNTER(DPMAC_CNT_EGR_FRAME_1518, hist_tx[5]),
DPMAC_RMON_COUNTER(DPMAC_CNT_EGR_FRAME_1519_MAX, hist_tx[6]),
DPMAC_RMON_COUNTER(DPMAC_CNT_ING_UNDERSIZED, undersize_pkts),
DPMAC_RMON_COUNTER(DPMAC_CNT_ING_OVERSIZED, oversize_pkts),
DPMAC_RMON_COUNTER(DPMAC_CNT_ING_FRAG, fragments),
DPMAC_RMON_COUNTER(DPMAC_CNT_ING_JABBER, jabbers),
};
#define DPAA2_MAC_NUM_RMON_STATS ARRAY_SIZE(dpaa2_mac_rmon_stats)
static const struct dpmac_counter dpaa2_mac_pause_stats[] = {
DPMAC_PAUSE_COUNTER(DPMAC_CNT_ING_VALID_PAUSE_FRAME, rx_pause_frames),
DPMAC_PAUSE_COUNTER(DPMAC_CNT_EGR_VALID_PAUSE_FRAME, tx_pause_frames),
};
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/pcs-lynx.h`, `linux/phy/phy.h`, `linux/property.h`, `dpaa2-eth.h`, `dpaa2-mac.h`.
- Detected declarations: `struct dpmac_counter`, `function dpaa2_mac_setup_stats`, `function dpaa2_mac_clear_stats`, `function dpaa2_mac_cmp_ver`, `function dpaa2_mac_detect_features`, `function phy_mode`, `function dpmac_eth_if_mode`, `function fwnode_for_each_child_node`, `function dpaa2_mac_get_if_mode`, `function dpaa2_mac_config`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration implementation candidate.
- 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.