drivers/net/ethernet/intel/ice/ice_txrx.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/ice/ice_txrx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/ice/ice_txrx.c- Extension
.c- Size
- 65057 bytes
- Lines
- 2405
- 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.
- 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
linux/mm.hlinux/netdevice.hlinux/prefetch.hlinux/bpf_trace.hlinux/net/intel/libie/rx.hnet/libeth/xdp.hnet/dsfield.hnet/mpls.hnet/xdp.hice_txrx_lib.hice_lib.hice.hice_trace.hice_dcb_lib.hice_xsk.hice_eswitch.h
Detected Declarations
function ice_prgm_fdir_fltrfunction ice_unmap_and_free_tx_buffunction ice_clean_tstamp_ringfunction ice_free_tstamp_ringfunction ice_free_tx_tstamp_ringfunction ice_clean_tx_ringfunction ice_free_tx_ringfunction ice_clean_tx_irqfunction ice_alloc_tstamp_ringfunction ice_setup_tstamp_ringfunction ice_alloc_setup_tstamp_ringfunction ice_setup_tx_ringfunction ice_rxq_pp_destroyfunction ice_clean_rx_ringfunction ice_free_rx_ringfunction ice_setup_rx_ringfunction ice_run_xdpfunction ice_xmit_xdp_ringfunction transmittedfunction ice_init_ctrl_rx_descsfunction ice_alloc_rx_bufsfunction ice_clean_ctrl_rx_irqfunction ice_clean_rx_irqfunction __ice_update_samplefunction ice_for_each_tx_ringfunction ice_for_each_rx_ringfunction net_dimfunction ice_buildreg_itrfunction ice_enable_interruptfunction ice_set_wb_on_itrfunction ice_napi_pollfunction ice_for_each_rx_ringfunction __ice_maybe_stop_txfunction ice_maybe_stop_txfunction ice_tx_mapfunction errorfunction ice_tx_prepare_vlan_flagsfunction errorfunction ice_txd_use_countfunction ice_xmit_desc_countfunction __ice_chk_linearizefunction ice_chk_linearizefunction ice_tstampfunction ice_xmit_frame_ringfunction ice_start_xmitfunction ice_get_dscp_upfunction ice_select_queuefunction ice_clean_ctrl_tx_irq
Annotated Snippet
while (tx_desc != eop_desc) {
ice_trace(clean_tx_irq_unmap, tx_ring, tx_desc, tx_buf);
tx_buf++;
tx_desc++;
i++;
if (unlikely(!i)) {
i -= tx_ring->count;
tx_buf = tx_ring->tx_buf;
tx_desc = ICE_TX_DESC(tx_ring, 0);
}
/* unmap any remaining paged data */
if (dma_unmap_len(tx_buf, len)) {
dma_unmap_page(tx_ring->dev,
dma_unmap_addr(tx_buf, dma),
dma_unmap_len(tx_buf, len),
DMA_TO_DEVICE);
dma_unmap_len_set(tx_buf, len, 0);
}
}
ice_trace(clean_tx_irq_unmap_eop, tx_ring, tx_desc, tx_buf);
/* move us one more past the eop_desc for start of next pkt */
tx_buf++;
tx_desc++;
i++;
if (unlikely(!i)) {
i -= tx_ring->count;
tx_buf = tx_ring->tx_buf;
tx_desc = ICE_TX_DESC(tx_ring, 0);
}
prefetch(tx_desc);
/* update budget accounting */
budget--;
} while (likely(budget));
i += tx_ring->count;
tx_ring->next_to_clean = i;
ice_update_tx_ring_stats(tx_ring, total_pkts, total_bytes);
netdev_tx_completed_queue(txring_txq(tx_ring), total_pkts, total_bytes);
#define TX_WAKE_THRESHOLD ((s16)(DESC_NEEDED * 2))
if (unlikely(total_pkts && netif_carrier_ok(tx_ring->netdev) &&
(ICE_DESC_UNUSED(tx_ring) >= TX_WAKE_THRESHOLD))) {
/* Make sure that anybody stopping the queue after this
* sees the new next_to_clean.
*/
smp_mb();
if (netif_tx_queue_stopped(txring_txq(tx_ring)) &&
!test_bit(ICE_VSI_DOWN, vsi->state)) {
netif_tx_wake_queue(txring_txq(tx_ring));
ice_stats_inc(tx_ring->ring_stats, tx_restart_q);
}
}
return !!budget;
}
/**
* ice_alloc_tstamp_ring - allocate the Time Stamp ring
* @tx_ring: Tx ring to allocate the Time Stamp ring for
*
* Return: 0 on success, negative on error
*/
static int ice_alloc_tstamp_ring(struct ice_tx_ring *tx_ring)
{
struct ice_tstamp_ring *tstamp_ring;
/* allocate with kzalloc(), free with kfree_rcu() */
tstamp_ring = kzalloc_obj(*tstamp_ring);
if (!tstamp_ring)
return -ENOMEM;
tstamp_ring->tx_ring = tx_ring;
tx_ring->tstamp_ring = tstamp_ring;
tstamp_ring->desc = NULL;
tstamp_ring->count = ice_calc_ts_ring_count(tx_ring);
set_bit(ICE_TX_RING_FLAGS_TXTIME, tx_ring->flags);
return 0;
}
/**
* ice_setup_tstamp_ring - allocate the Time Stamp ring
* @tx_ring: Tx ring to set up the Time Stamp ring for
*
* Return: 0 on success, negative on error
*/
Annotation
- Immediate include surface: `linux/mm.h`, `linux/netdevice.h`, `linux/prefetch.h`, `linux/bpf_trace.h`, `linux/net/intel/libie/rx.h`, `net/libeth/xdp.h`, `net/dsfield.h`, `net/mpls.h`.
- Detected declarations: `function ice_prgm_fdir_fltr`, `function ice_unmap_and_free_tx_buf`, `function ice_clean_tstamp_ring`, `function ice_free_tstamp_ring`, `function ice_free_tx_tstamp_ring`, `function ice_clean_tx_ring`, `function ice_free_tx_ring`, `function ice_clean_tx_irq`, `function ice_alloc_tstamp_ring`, `function ice_setup_tstamp_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.
- 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.