drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c- Extension
.c- Size
- 14600 bytes
- Lines
- 570
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/stmmac.hcommon.hdwmac4.hdwmac4_descs.h
Detected Declarations
function Copyrightfunction dwmac4_wrback_get_rx_statusfunction dwmac4_set_tx_ownerfunction dwmac4_set_rx_ownerfunction dwmac4_wrback_get_rx_vlan_tcifunction dwmac4_wrback_get_rx_vlan_validfunction dwmac4_wrback_get_rx_frame_lenfunction dwmac4_rd_enable_tx_timestampfunction dwmac4_wrback_get_tx_timestamp_statusfunction dwmac4_get_timestampfunction dwmac4_rx_check_timestampfunction dwmac4_wrback_get_rx_timestamp_statusfunction dwmac4_rd_init_rx_descfunction dwmac4_rd_init_tx_descfunction dwmac4_rd_prepare_tx_descfunction dwmac4_rd_prepare_tso_tx_descfunction dwmac4_release_tx_descfunction dwmac4_rd_set_tx_icfunction dwmac4_display_ringfunction dwmac4_set_mss_ctxtfunction dwmac4_set_addrfunction dwmac4_clearfunction dwmac4_set_sarcfunction set_16kib_bfsizefunction dwmac4_set_vlan_tagfunction dwmac4_set_vlanfunction dwmac4_get_rx_header_lenfunction dwmac4_set_sec_addrfunction dwmac4_set_tbs
Annotated Snippet
if (unlikely(tdes3 & TDES3_LOSS_CARRIER)) {
x->tx_losscarrier++;
}
if (unlikely(tdes3 & TDES3_NO_CARRIER)) {
x->tx_carrier++;
}
if (unlikely((tdes3 & TDES3_LATE_COLLISION) ||
(tdes3 & TDES3_EXCESSIVE_COLLISION)))
x->tx_collision +=
FIELD_GET(TDES3_COLLISION_COUNT_MASK, tdes3);
if (unlikely(tdes3 & TDES3_EXCESSIVE_DEFERRAL))
x->tx_deferred++;
if (unlikely(tdes3 & TDES3_UNDERFLOW_ERROR)) {
x->tx_underflow++;
ret |= tx_err_bump_tc;
}
if (unlikely(tdes3 & TDES3_IP_HDR_ERROR))
x->tx_ip_header_error++;
if (unlikely(tdes3 & TDES3_PAYLOAD_ERROR))
x->tx_payload_error++;
}
if (unlikely(tdes3 & TDES3_DEFERRED))
x->tx_deferred++;
return ret;
}
static int dwmac4_wrback_get_rx_status(struct stmmac_extra_stats *x,
struct dma_desc *p)
{
u32 rdes1 = le32_to_cpu(p->des1);
u32 rdes2 = le32_to_cpu(p->des2);
u32 rdes3 = le32_to_cpu(p->des3);
int message_type;
int ret = good_frame;
if (unlikely(rdes3 & RDES3_OWN))
return dma_own;
if (unlikely(rdes3 & RDES3_CONTEXT_DESCRIPTOR))
return discard_frame;
if (likely(!(rdes3 & RDES3_LAST_DESCRIPTOR)))
return rx_not_ls;
if (unlikely(rdes3 & RDES3_ERROR_SUMMARY)) {
if (unlikely(rdes3 & RDES3_GIANT_PACKET))
x->rx_length++;
if (unlikely(rdes3 & RDES3_OVERFLOW_ERROR))
x->rx_gmac_overflow++;
if (unlikely(rdes3 & RDES3_RECEIVE_WATCHDOG))
x->rx_watchdog++;
if (unlikely(rdes3 & RDES3_RECEIVE_ERROR))
x->rx_mii++;
if (unlikely(rdes3 & RDES3_CRC_ERROR))
x->rx_crc_errors++;
if (unlikely(rdes3 & RDES3_DRIBBLE_ERROR))
x->dribbling_bit++;
ret = discard_frame;
}
message_type = FIELD_GET(RDES1_PTP_MSG_TYPE_MASK, rdes1);
if (rdes1 & RDES1_IP_HDR_ERROR) {
x->ip_hdr_err++;
ret |= csum_none;
}
if (rdes1 & RDES1_IP_CSUM_BYPASSED)
x->ip_csum_bypassed++;
if (rdes1 & RDES1_IPV4_HEADER)
x->ipv4_pkt_rcvd++;
if (rdes1 & RDES1_IPV6_HEADER)
x->ipv6_pkt_rcvd++;
if (rdes1 & RDES1_IP_PAYLOAD_ERROR) {
x->ip_payload_err++;
ret |= csum_none;
}
if (message_type == RDES_EXT_NO_PTP)
x->no_ptp_rx_msg_type_ext++;
else if (message_type == RDES_EXT_SYNC)
Annotation
- Immediate include surface: `linux/stmmac.h`, `common.h`, `dwmac4.h`, `dwmac4_descs.h`.
- Detected declarations: `function Copyright`, `function dwmac4_wrback_get_rx_status`, `function dwmac4_set_tx_owner`, `function dwmac4_set_rx_owner`, `function dwmac4_wrback_get_rx_vlan_tci`, `function dwmac4_wrback_get_rx_vlan_valid`, `function dwmac4_wrback_get_rx_frame_len`, `function dwmac4_rd_enable_tx_timestamp`, `function dwmac4_wrback_get_tx_timestamp_status`, `function dwmac4_get_timestamp`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
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.