drivers/net/wireless/ralink/rt2x00/rt2x00queue.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ralink/rt2x00/rt2x00queue.c- Extension
.c- Size
- 33746 bytes
- Lines
- 1288
- 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.
- 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/slab.hlinux/kernel.hlinux/module.hlinux/dma-mapping.hrt2x00.hrt2x00lib.h
Detected Declarations
function rt2x00queue_map_txskbfunction rt2x00queue_unmap_skbfunction rt2x00queue_free_skbfunction rt2x00queue_align_framefunction rt2x00queue_insert_l2padfunction rt2x00queue_remove_l2padfunction rt2x00queue_create_tx_descriptor_seqfunction rt2x00queue_create_tx_descriptor_plcpfunction rt2x00queue_create_tx_descriptor_htfunction rt2x00queue_create_tx_descriptorfunction ieee80211_is_ctsfunction rt2x00queue_write_tx_datafunction rt2x00queue_write_tx_descriptorfunction rt2x00queue_kick_tx_queuefunction rt2x00queue_bar_checkfunction rt2x00queue_write_tx_framefunction rt2x00queue_clear_beaconfunction rt2x00queue_update_beaconfunction rt2x00queue_for_each_entryfunction rt2x00queue_index_incfunction rt2x00queue_pause_queue_nocheckfunction rt2x00queue_pause_queuefunction rt2x00queue_unpause_queuefunction rt2x00queue_start_queuefunction rt2x00queue_stop_queuefunction rt2x00queue_flush_queuefunction rt2x00queue_start_queuesfunction rt2x00queue_stop_queuesfunction rt2x00queue_flush_queuesfunction rt2x00queue_resetfunction rt2x00queue_init_queuesfunction queue_for_eachfunction rt2x00queue_alloc_entriesfunction rt2x00queue_free_skbsfunction rt2x00queue_alloc_rxskbsfunction rt2x00queue_initializefunction tx_queue_for_eachfunction rt2x00queue_uninitializefunction queue_for_eachfunction rt2x00queue_initfunction rt2x00queue_allocatefunction rt2x00queue_freeexport rt2x00queue_map_txskbexport rt2x00queue_unmap_skbexport rt2x00queue_for_each_entryexport rt2x00queue_get_entryexport rt2x00queue_pause_queueexport rt2x00queue_unpause_queue
Annotated Snippet
if (unlikely(dma_mapping_error(rt2x00dev->dev, skb_dma))) {
dev_kfree_skb_any(skb);
return NULL;
}
skbdesc->skb_dma = skb_dma;
skbdesc->flags |= SKBDESC_DMA_MAPPED_RX;
}
return skb;
}
int rt2x00queue_map_txskb(struct queue_entry *entry)
{
struct device *dev = entry->queue->rt2x00dev->dev;
struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
skbdesc->skb_dma =
dma_map_single(dev, entry->skb->data, entry->skb->len, DMA_TO_DEVICE);
if (unlikely(dma_mapping_error(dev, skbdesc->skb_dma)))
return -ENOMEM;
skbdesc->flags |= SKBDESC_DMA_MAPPED_TX;
rt2x00lib_dmadone(entry);
return 0;
}
EXPORT_SYMBOL_GPL(rt2x00queue_map_txskb);
void rt2x00queue_unmap_skb(struct queue_entry *entry)
{
struct device *dev = entry->queue->rt2x00dev->dev;
struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
if (skbdesc->flags & SKBDESC_DMA_MAPPED_RX) {
dma_unmap_single(dev, skbdesc->skb_dma, entry->skb->len,
DMA_FROM_DEVICE);
skbdesc->flags &= ~SKBDESC_DMA_MAPPED_RX;
} else if (skbdesc->flags & SKBDESC_DMA_MAPPED_TX) {
dma_unmap_single(dev, skbdesc->skb_dma, entry->skb->len,
DMA_TO_DEVICE);
skbdesc->flags &= ~SKBDESC_DMA_MAPPED_TX;
}
}
EXPORT_SYMBOL_GPL(rt2x00queue_unmap_skb);
void rt2x00queue_free_skb(struct queue_entry *entry)
{
if (!entry->skb)
return;
rt2x00queue_unmap_skb(entry);
dev_kfree_skb_any(entry->skb);
entry->skb = NULL;
}
void rt2x00queue_align_frame(struct sk_buff *skb)
{
unsigned int frame_length = skb->len;
unsigned int align = ALIGN_SIZE(skb, 0);
if (!align)
return;
skb_push(skb, align);
memmove(skb->data, skb->data + align, frame_length);
skb_trim(skb, frame_length);
}
/*
* H/W needs L2 padding between the header and the paylod if header size
* is not 4 bytes aligned.
*/
void rt2x00queue_insert_l2pad(struct sk_buff *skb, unsigned int hdr_len)
{
unsigned int l2pad = (skb->len > hdr_len) ? L2PAD_SIZE(hdr_len) : 0;
if (!l2pad)
return;
skb_push(skb, l2pad);
memmove(skb->data, skb->data + l2pad, hdr_len);
}
void rt2x00queue_remove_l2pad(struct sk_buff *skb, unsigned int hdr_len)
{
unsigned int l2pad = (skb->len > hdr_len) ? L2PAD_SIZE(hdr_len) : 0;
if (!l2pad)
return;
Annotation
- Immediate include surface: `linux/slab.h`, `linux/kernel.h`, `linux/module.h`, `linux/dma-mapping.h`, `rt2x00.h`, `rt2x00lib.h`.
- Detected declarations: `function rt2x00queue_map_txskb`, `function rt2x00queue_unmap_skb`, `function rt2x00queue_free_skb`, `function rt2x00queue_align_frame`, `function rt2x00queue_insert_l2pad`, `function rt2x00queue_remove_l2pad`, `function rt2x00queue_create_tx_descriptor_seq`, `function rt2x00queue_create_tx_descriptor_plcp`, `function rt2x00queue_create_tx_descriptor_ht`, `function rt2x00queue_create_tx_descriptor`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration 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.