drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ralink/rt2x00/rt2x00dev.c- Extension
.c- Size
- 41829 bytes
- Lines
- 1643
- 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.
- 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/kernel.hlinux/module.hlinux/slab.hlinux/log2.hlinux/of.hlinux/of_net.hrt2x00.hrt2x00lib.h
Detected Declarations
function rt2x00lib_get_bssidxfunction rt2x00lib_enable_radiofunction rt2x00lib_disable_radiofunction rt2x00lib_intf_scheduled_iterfunction rt2x00lib_intf_scheduledfunction rt2x00lib_autowakeupfunction rt2x00lib_bc_buffer_iterfunction rt2x00lib_beaconupdate_iterfunction rt2x00lib_beacondonefunction rt2x00lib_pretbttfunction rt2x00lib_dmastartfunction rt2x00lib_dmadonefunction rt2x00lib_txdone_bar_statusfunction rt2x00lib_fill_tx_statusfunction rt2x00lib_clear_entryfunction rt2x00lib_txdone_nomatchfunction rt2x00lib_txdonefunction callfunction rt2x00lib_txdone_noinfofunction rt2x00lib_sleepfunction rt2x00lib_rxdone_check_bafunction rt2x00lib_rxdone_check_psfunction rt2x00lib_rxdone_read_signalfunction rt2x00lib_rxdonefunction rt2x00lib_channelfunction rt2x00lib_ratefunction rt2x00lib_set_mac_addressfunction rt2x00lib_probe_hw_modesfunction rt2x00lib_remove_hwfunction rt2x00lib_probe_hwfunction rt2x00lib_uninitializefunction rt2x00lib_initializefunction rt2x00lib_startfunction rt2x00lib_stopfunction rt2x00lib_set_if_combinationsfunction rt2x00dev_extra_tx_headroomfunction rt2x00lib_probe_devfunction rt2x00lib_remove_devfunction rt2x00lib_suspendfunction rt2x00lib_resumeexport rt2x00lib_get_bssidxexport rt2x00lib_beacondoneexport rt2x00lib_pretbttexport rt2x00lib_dmastartexport rt2x00lib_dmadoneexport rt2x00lib_txdone_nomatchexport rt2x00lib_txdoneexport rt2x00lib_txdone_noinfo
Annotated Snippet
if (rate_idx - i == 0) {
/*
* The lowest rate (index 0) was used until the
* number of max retries was reached.
*/
tx_info->status.rates[i].count = retry_rates - i;
i++;
break;
}
tx_info->status.rates[i].count = 1;
}
if (i < (IEEE80211_TX_MAX_RATES - 1))
tx_info->status.rates[i].idx = -1; /* terminate */
if (test_bit(TXDONE_NO_ACK_REQ, &txdesc->flags))
tx_info->flags |= IEEE80211_TX_CTL_NO_ACK;
if (!(tx_info->flags & IEEE80211_TX_CTL_NO_ACK)) {
if (success)
tx_info->flags |= IEEE80211_TX_STAT_ACK;
else
rt2x00dev->low_level_stats.dot11ACKFailureCount++;
}
/*
* Every single frame has its own tx status, hence report
* every frame as ampdu of size 1.
*
* TODO: if we can find out how many frames were aggregated
* by the hw we could provide the real ampdu_len to mac80211
* which would allow the rc algorithm to better decide on
* which rates are suitable.
*/
if (test_bit(TXDONE_AMPDU, &txdesc->flags) ||
tx_info->flags & IEEE80211_TX_CTL_AMPDU) {
tx_info->flags |= IEEE80211_TX_STAT_AMPDU |
IEEE80211_TX_CTL_AMPDU;
tx_info->status.ampdu_len = 1;
tx_info->status.ampdu_ack_len = success ? 1 : 0;
}
if (rate_flags & IEEE80211_TX_RC_USE_RTS_CTS) {
if (success)
rt2x00dev->low_level_stats.dot11RTSSuccessCount++;
else
rt2x00dev->low_level_stats.dot11RTSFailureCount++;
}
}
static void rt2x00lib_clear_entry(struct rt2x00_dev *rt2x00dev,
struct queue_entry *entry)
{
/*
* Make this entry available for reuse.
*/
entry->skb = NULL;
entry->flags = 0;
rt2x00dev->ops->lib->clear_entry(entry);
rt2x00queue_index_inc(entry, Q_INDEX_DONE);
/*
* If the data queue was below the threshold before the txdone
* handler we must make sure the packet queue in the mac80211 stack
* is reenabled when the txdone handler has finished. This has to be
* serialized with rt2x00mac_tx(), otherwise we can wake up queue
* before it was stopped.
*/
spin_lock_bh(&entry->queue->tx_lock);
if (!rt2x00queue_threshold(entry->queue))
rt2x00queue_unpause_queue(entry->queue);
spin_unlock_bh(&entry->queue->tx_lock);
}
void rt2x00lib_txdone_nomatch(struct queue_entry *entry,
struct txdone_entry_desc *txdesc)
{
struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
struct ieee80211_tx_info txinfo = {};
bool success;
/*
* Unmap the skb.
*/
rt2x00queue_unmap_skb(entry);
/*
* Signal that the TX descriptor is no longer in the skb.
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/slab.h`, `linux/log2.h`, `linux/of.h`, `linux/of_net.h`, `rt2x00.h`, `rt2x00lib.h`.
- Detected declarations: `function rt2x00lib_get_bssidx`, `function rt2x00lib_enable_radio`, `function rt2x00lib_disable_radio`, `function rt2x00lib_intf_scheduled_iter`, `function rt2x00lib_intf_scheduled`, `function rt2x00lib_autowakeup`, `function rt2x00lib_bc_buffer_iter`, `function rt2x00lib_beaconupdate_iter`, `function rt2x00lib_beacondone`, `function rt2x00lib_pretbtt`.
- 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.
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.