drivers/net/ethernet/google/gve/gve_tx_dqo.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/google/gve/gve_tx_dqo.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/google/gve/gve_tx_dqo.c- Extension
.c- Size
- 43496 bytes
- Lines
- 1617
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
gve.hgve_adminq.hgve_utils.hgve_dqo.hnet/ip.hlinux/bpf.hlinux/tcp.hlinux/slab.hlinux/skbuff.hnet/xdp_sock_drv.h
Detected Declarations
function Copyrightfunction gve_alloc_tx_qpl_buffunction gve_free_tx_qpl_bufsfunction gve_has_pending_packetfunction gve_xdp_tx_flush_dqofunction gve_alloc_pending_packetfunction gve_free_pending_packetfunction gve_unmap_packetfunction gve_tx_clean_pending_packetsfunction gve_tx_stop_ring_dqofunction gve_tx_free_ring_dqofunction gve_tx_qpl_buf_initfunction gve_tx_start_ring_dqofunction gve_tx_alloc_ring_dqofunction gve_tx_alloc_rings_dqofunction gve_tx_free_rings_dqofunction num_avail_tx_slotsfunction gve_has_tx_slots_availablefunction gve_has_avail_slots_tx_dqofunction gve_maybe_stop_tx_dqofunction gve_extract_tx_metadata_dqofunction gve_tx_fill_pkt_desc_dqofunction gve_prep_tsofunction gve_tx_fill_tso_ctx_descfunction gve_tx_fill_general_ctx_descfunction gve_tx_update_tailfunction gve_tx_add_skb_no_copy_dqofunction gve_tx_buf_get_addrfunction gve_tx_add_skb_copy_dqofunction gve_has_pending_packetfunction gve_num_descs_per_buffunction gve_num_buffer_descs_neededfunction gve_can_send_tsofunction gve_features_check_dqofunction gve_try_tx_skbfunction gve_xsk_reorder_queue_push_dqofunction gve_xsk_reorder_queue_headfunction gve_xsk_reorder_queue_pop_dqofunction gve_tx_dqofunction gve_xsk_tx_dqofunction add_to_listfunction remove_from_listfunction gve_handle_packet_completionfunction gve_handle_miss_completionfunction remove_miss_completionsfunction remove_timed_out_completionsfunction gve_tx_process_xsk_completionsfunction gve_clean_tx_done_dqo
Annotated Snippet
if (cur_state->skb) {
dev_consume_skb_any(cur_state->skb);
cur_state->skb = NULL;
}
}
}
void gve_tx_stop_ring_dqo(struct gve_priv *priv, int idx)
{
int ntfy_idx = gve_tx_idx_to_ntfy(priv, idx);
struct gve_tx_ring *tx = &priv->tx[idx];
if (!gve_tx_was_added_to_block(priv, idx))
return;
gve_remove_napi(priv, ntfy_idx);
gve_clean_tx_done_dqo(priv, tx, /*napi=*/NULL);
if (tx->netdev_txq)
netdev_tx_reset_queue(tx->netdev_txq);
gve_tx_clean_pending_packets(tx);
gve_tx_remove_from_block(priv, idx);
}
static void gve_tx_free_ring_dqo(struct gve_priv *priv, struct gve_tx_ring *tx,
struct gve_tx_alloc_rings_cfg *cfg)
{
struct device *hdev = &priv->pdev->dev;
int idx = tx->q_num;
size_t bytes;
u32 qpl_id;
if (tx->q_resources) {
dma_free_coherent(hdev, sizeof(*tx->q_resources),
tx->q_resources, tx->q_resources_bus);
tx->q_resources = NULL;
}
if (tx->dqo.compl_ring) {
bytes = sizeof(tx->dqo.compl_ring[0]) *
(tx->dqo.complq_mask + 1);
dma_free_coherent(hdev, bytes, tx->dqo.compl_ring,
tx->complq_bus_dqo);
tx->dqo.compl_ring = NULL;
}
if (tx->dqo.tx_ring) {
bytes = sizeof(tx->dqo.tx_ring[0]) * (tx->mask + 1);
dma_free_coherent(hdev, bytes, tx->dqo.tx_ring, tx->bus);
tx->dqo.tx_ring = NULL;
}
kvfree(tx->dqo.xsk_reorder_queue);
tx->dqo.xsk_reorder_queue = NULL;
kvfree(tx->dqo.pending_packets);
tx->dqo.pending_packets = NULL;
kvfree(tx->dqo.tx_qpl_buf_next);
tx->dqo.tx_qpl_buf_next = NULL;
if (tx->dqo.qpl) {
qpl_id = gve_tx_qpl_id(priv, tx->q_num);
gve_free_queue_page_list(priv, tx->dqo.qpl, qpl_id);
tx->dqo.qpl = NULL;
}
netif_dbg(priv, drv, priv->dev, "freed tx queue %d\n", idx);
}
static int gve_tx_qpl_buf_init(struct gve_tx_ring *tx)
{
int num_tx_qpl_bufs = GVE_TX_BUFS_PER_PAGE_DQO *
tx->dqo.qpl->num_entries;
int i;
tx->dqo.tx_qpl_buf_next = kvzalloc_objs(tx->dqo.tx_qpl_buf_next[0],
num_tx_qpl_bufs);
if (!tx->dqo.tx_qpl_buf_next)
return -ENOMEM;
tx->dqo.num_tx_qpl_bufs = num_tx_qpl_bufs;
/* Generate free TX buf list */
for (i = 0; i < num_tx_qpl_bufs - 1; i++)
tx->dqo.tx_qpl_buf_next[i] = i + 1;
tx->dqo.tx_qpl_buf_next[num_tx_qpl_bufs - 1] = -1;
atomic_set_release(&tx->dqo_compl.free_tx_qpl_buf_head, -1);
return 0;
}
Annotation
- Immediate include surface: `gve.h`, `gve_adminq.h`, `gve_utils.h`, `gve_dqo.h`, `net/ip.h`, `linux/bpf.h`, `linux/tcp.h`, `linux/slab.h`.
- Detected declarations: `function Copyright`, `function gve_alloc_tx_qpl_buf`, `function gve_free_tx_qpl_bufs`, `function gve_has_pending_packet`, `function gve_xdp_tx_flush_dqo`, `function gve_alloc_pending_packet`, `function gve_free_pending_packet`, `function gve_unmap_packet`, `function gve_tx_clean_pending_packets`, `function gve_tx_stop_ring_dqo`.
- 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.