drivers/net/ethernet/intel/iavf/iavf_txrx.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/iavf/iavf_txrx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/iavf/iavf_txrx.c- Extension
.c- Size
- 68964 bytes
- Lines
- 2408
- 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.
- 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/bitfield.hlinux/net/intel/libie/rx.hlinux/prefetch.hiavf.hiavf_trace.hiavf_prototype.hiavf_ptp.h
Detected Declarations
function descriptorsfunction build_ctobfunction iavf_unmap_and_free_tx_resourcefunction iavf_clean_tx_ringfunction iavf_free_tx_resourcesfunction iavf_get_tx_pendingfunction iavf_force_wbfunction iavf_detect_recover_hungfunction iavf_clean_tx_irqfunction iavf_enable_wb_on_itrfunction iavf_container_is_rxfunction iavf_mbps_itr_multiplierfunction iavf_virtchnl_itr_multiplierfunction iavf_itr_divisorfunction iavf_update_itrfunction iavf_setup_tx_descriptorsfunction iavf_clean_rx_ringfunction iavf_free_rx_resourcesfunction iavf_setup_rx_descriptorsfunction iavf_release_rx_descfunction iavf_receive_skbfunction iavf_alloc_rx_buffersfunction iavf_rx_csumfunction iavf_legacy_rx_csumfunction iavf_flex_rx_csumfunction iavf_legacy_rx_hashfunction iavf_flex_rx_hashfunction iavf_flex_rx_tstampfunction iavf_process_skb_fieldsfunction iavf_cleanup_headersfunction iavf_add_rx_fragfunction iavf_is_non_eopfunction iavf_extract_legacy_rx_fieldsfunction iavf_extract_flex_rx_fieldsfunction iavf_extract_rx_fieldsfunction iavf_clean_rx_irqfunction iavf_buildreg_itrfunction iavf_update_enable_itrfunction iavf_napi_pollfunction iavf_for_each_ringfunction iavf_tx_prepare_vlan_flagsfunction iavf_tsofunction iavf_tx_enable_csumfunction iavf_create_tx_ctxfunction __iavf_chk_linearizefunction __iavf_maybe_stop_txfunction iavf_tx_mapfunction iavf_xmit_frame_ring
Annotated Snippet
if (tx_ring && tx_ring->desc) {
/* If packet counter has not changed the queue is
* likely stalled, so force an interrupt for this
* queue.
*
* prev_pkt_ctr would be negative if there was no
* pending work.
*/
packets = tx_ring->stats.packets & INT_MAX;
if (tx_ring->prev_pkt_ctr == packets) {
iavf_force_wb(vsi, tx_ring->q_vector);
continue;
}
/* Memory barrier between read of packet count and call
* to iavf_get_tx_pending()
*/
smp_rmb();
tx_ring->prev_pkt_ctr =
iavf_get_tx_pending(tx_ring, true) ? packets : -1;
}
}
}
#define WB_STRIDE 4
/**
* iavf_clean_tx_irq - Reclaim resources after transmit completes
* @vsi: the VSI we care about
* @tx_ring: Tx ring to clean
* @napi_budget: Used to determine if we are in netpoll
*
* Returns true if there's any budget left (e.g. the clean is finished)
**/
static bool iavf_clean_tx_irq(struct iavf_vsi *vsi,
struct iavf_ring *tx_ring, int napi_budget)
{
int i = tx_ring->next_to_clean;
struct iavf_tx_buffer *tx_buf;
struct iavf_tx_desc *tx_desc;
unsigned int total_bytes = 0, total_packets = 0;
unsigned int budget = IAVF_DEFAULT_IRQ_WORK;
tx_buf = &tx_ring->tx_bi[i];
tx_desc = IAVF_TX_DESC(tx_ring, i);
i -= tx_ring->count;
do {
struct iavf_tx_desc *eop_desc = tx_buf->next_to_watch;
/* if next_to_watch is not set then there is no work pending */
if (!eop_desc)
break;
/* prevent any other reads prior to eop_desc */
smp_rmb();
iavf_trace(clean_tx_irq, tx_ring, tx_desc, tx_buf);
/* if the descriptor isn't done, no work yet to do */
if (!(eop_desc->cmd_type_offset_bsz &
cpu_to_le64(IAVF_TX_DESC_DTYPE_DESC_DONE)))
break;
/* clear next_to_watch to prevent false hangs */
tx_buf->next_to_watch = NULL;
/* update the statistics for this packet */
total_bytes += tx_buf->bytecount;
total_packets += tx_buf->gso_segs;
/* free the skb */
napi_consume_skb(tx_buf->skb, napi_budget);
/* unmap skb header data */
dma_unmap_single(tx_ring->dev,
dma_unmap_addr(tx_buf, dma),
dma_unmap_len(tx_buf, len),
DMA_TO_DEVICE);
/* clear tx_buffer data */
tx_buf->skb = NULL;
dma_unmap_len_set(tx_buf, len, 0);
/* unmap remaining buffers */
while (tx_desc != eop_desc) {
iavf_trace(clean_tx_irq_unmap,
tx_ring, tx_desc, tx_buf);
tx_buf++;
tx_desc++;
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/net/intel/libie/rx.h`, `linux/prefetch.h`, `iavf.h`, `iavf_trace.h`, `iavf_prototype.h`, `iavf_ptp.h`.
- Detected declarations: `function descriptors`, `function build_ctob`, `function iavf_unmap_and_free_tx_resource`, `function iavf_clean_tx_ring`, `function iavf_free_tx_resources`, `function iavf_get_tx_pending`, `function iavf_force_wb`, `function iavf_detect_recover_hung`, `function iavf_clean_tx_irq`, `function iavf_enable_wb_on_itr`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source 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.