drivers/net/ethernet/freescale/enetc/enetc.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/freescale/enetc/enetc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/freescale/enetc/enetc.c- Extension
.c- Size
- 94689 bytes
- Lines
- 3792
- 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.
- 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
enetc.hlinux/bpf_trace.hlinux/clk.hlinux/tcp.hlinux/udp.hlinux/vmalloc.hlinux/ptp_classify.hnet/ip6_checksum.hnet/pkt_sched.hnet/tso.h
Detected Declarations
function enetc_port_mac_rdfunction enetc_port_mac_wrfunction enetc_change_preemptible_tcsfunction enetc_mac_addr_hash_idxfunction enetc_add_mac_addr_ht_filterfunction enetc_reset_mac_addr_filterfunction enetc_num_stack_tx_queuesfunction enetc_tx_swbd_get_xdp_framefunction enetc_unmap_tx_bufffunction enetc_free_tx_framefunction enetc_update_tx_ring_tailfunction enetc_ptp_parsefunction enetc_tx_csum_offload_checkfunction enetc_skb_is_ipv6function enetc_skb_is_tcpfunction enetc_unwind_tx_framefunction enetc_set_one_step_tsfunction enetc4_set_one_step_tsfunction enetc_update_ptp_sync_msgfunction enetc_map_tx_buffsfunction enetc_map_tx_tso_hdrfunction enetc_map_tx_tso_datafunction enetc_tso_hdr_csumfunction enetc_tso_complete_csumfunction enetc_lso_count_descsfunction enetc_lso_get_hdr_lenfunction enetc_lso_startfunction enetc_lso_map_hdrfunction enetc_lso_map_datafunction enetc_lso_hw_offloadfunction enetc_map_tx_tso_buffsfunction enetc_start_xmitfunction enetc_xmitfunction enetc_msixfunction enetc_rx_dim_workfunction enetc_rx_net_dimfunction enetc_bd_ready_countfunction enetc_page_reusablefunction enetc_reuse_pagefunction enetc_get_tx_tstampfunction enetc_tstamp_txfunction enetc_recycle_xdp_tx_bufffunction enetc_clean_tx_ringfunction enetc_new_pagefunction enetc_refill_rx_ringfunction enetc_get_rx_tstampfunction enetc_get_offloadsfunction enetc_put_rx_buff
Annotated Snippet
enetc_tx_csum_offload_check(skb) && !tx_ring->tsd_enable) {
temp_bd.l3_aux0 = FIELD_PREP(ENETC_TX_BD_L3_START,
skb_network_offset(skb));
temp_bd.l3_aux1 = FIELD_PREP(ENETC_TX_BD_L3_HDR_LEN,
skb_network_header_len(skb) / 4);
temp_bd.l3_aux1 |= FIELD_PREP(ENETC_TX_BD_L3T,
enetc_skb_is_ipv6(skb));
if (enetc_skb_is_tcp(skb))
temp_bd.l4_aux = FIELD_PREP(ENETC_TX_BD_L4T,
ENETC_TXBD_L4T_TCP);
else
temp_bd.l4_aux = FIELD_PREP(ENETC_TX_BD_L4T,
ENETC_TXBD_L4T_UDP);
flags |= ENETC_TXBD_FLAGS_CSUM_LSO | ENETC_TXBD_FLAGS_L4CS;
csum_offload = true;
} else if (skb_checksum_help(skb)) {
return 0;
}
}
if (enetc_cb->flag & ENETC_F_TX_ONESTEP_SYNC_TSTAMP) {
do_onestep_tstamp = true;
tstamp = enetc_update_ptp_sync_msg(priv, skb, csum_offload);
} else if (enetc_cb->flag & ENETC_F_TX_TSTAMP) {
do_twostep_tstamp = true;
}
i = tx_ring->next_to_use;
txbd = ENETC_TXBD(*tx_ring, i);
prefetchw(txbd);
dma = dma_map_single(tx_ring->dev, skb->data, len, DMA_TO_DEVICE);
if (unlikely(dma_mapping_error(tx_ring->dev, dma)))
goto dma_err;
temp_bd.addr = cpu_to_le64(dma);
temp_bd.buf_len = cpu_to_le16(len);
tx_swbd = &tx_ring->tx_swbd[i];
tx_swbd->dma = dma;
tx_swbd->len = len;
tx_swbd->is_dma_page = 0;
tx_swbd->dir = DMA_TO_DEVICE;
count++;
do_vlan = skb_vlan_tag_present(skb);
tx_swbd->do_twostep_tstamp = do_twostep_tstamp;
tx_swbd->qbv_en = !!(priv->active_offloads & ENETC_F_QBV);
tx_swbd->check_wb = tx_swbd->do_twostep_tstamp || tx_swbd->qbv_en;
if (do_vlan || do_onestep_tstamp || do_twostep_tstamp)
flags |= ENETC_TXBD_FLAGS_EX;
if (tx_ring->tsd_enable)
flags |= ENETC_TXBD_FLAGS_TSE | ENETC_TXBD_FLAGS_TXSTART;
/* first BD needs frm_len and offload flags set */
temp_bd.frm_len = cpu_to_le16(skb->len);
temp_bd.flags = flags;
if (flags & ENETC_TXBD_FLAGS_TSE)
temp_bd.txstart = enetc_txbd_set_tx_start(skb->skb_mstamp_ns,
flags);
if (flags & ENETC_TXBD_FLAGS_EX) {
u8 e_flags = 0;
*txbd = temp_bd;
enetc_clear_tx_bd(&temp_bd);
/* add extension BD for VLAN and/or timestamping */
flags = 0;
tx_swbd++;
txbd++;
i++;
if (unlikely(i == tx_ring->bd_count)) {
i = 0;
tx_swbd = tx_ring->tx_swbd;
txbd = ENETC_TXBD(*tx_ring, 0);
}
prefetchw(txbd);
if (do_vlan) {
temp_bd.ext.vid = cpu_to_le16(skb_vlan_tag_get(skb));
temp_bd.ext.tpid = 0; /* < C-TAG */
e_flags |= ENETC_TXBD_E_FLAGS_VLAN_INS;
}
if (do_onestep_tstamp) {
/* Configure extension BD */
temp_bd.ext.tstamp = cpu_to_le32(tstamp);
Annotation
- Immediate include surface: `enetc.h`, `linux/bpf_trace.h`, `linux/clk.h`, `linux/tcp.h`, `linux/udp.h`, `linux/vmalloc.h`, `linux/ptp_classify.h`, `net/ip6_checksum.h`.
- Detected declarations: `function enetc_port_mac_rd`, `function enetc_port_mac_wr`, `function enetc_change_preemptible_tcs`, `function enetc_mac_addr_hash_idx`, `function enetc_add_mac_addr_ht_filter`, `function enetc_reset_mac_addr_filter`, `function enetc_num_stack_tx_queues`, `function enetc_tx_swbd_get_xdp_frame`, `function enetc_unmap_tx_buff`, `function enetc_free_tx_frame`.
- 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.