drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ralink/rt2x00/rt2x00mac.c- Extension
.c- Size
- 23986 bytes
- Lines
- 841
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/module.hrt2x00.hrt2x00lib.h
Detected Declarations
function rt2x00mac_tx_rts_ctsfunction rt2x00mac_txfunction set_rts_thresholdfunction rt2x00mac_startfunction rt2x00mac_stopfunction rt2x00mac_reconfig_completefunction rt2x00mac_add_interfacefunction rt2x00mac_remove_interfacefunction rt2x00mac_configfunction rt2x00mac_configure_filterfunction rt2x00mac_set_tim_iterfunction rt2x00mac_set_timfunction memcpy_tkipfunction rt2x00mac_set_keyfunction rt2x00mac_sw_scan_startfunction rt2x00mac_sw_scan_completefunction rt2x00mac_get_statsfunction rt2x00mac_bss_info_changedfunction rt2x00mac_conf_txfunction rt2x00mac_rfkill_pollfunction rt2x00mac_flushfunction rt2x00mac_set_antennafunction rt2x00mac_get_antennafunction rt2x00mac_get_ringparamfunction tx_queue_for_eachfunction rt2x00mac_tx_frames_pendingfunction tx_queue_for_eachexport rt2x00mac_txexport rt2x00mac_startexport rt2x00mac_stopexport rt2x00mac_reconfig_completeexport rt2x00mac_add_interfaceexport rt2x00mac_remove_interfaceexport rt2x00mac_configexport rt2x00mac_configure_filterexport rt2x00mac_set_timexport rt2x00mac_set_keyexport rt2x00mac_sw_scan_startexport rt2x00mac_sw_scan_completeexport rt2x00mac_get_statsexport rt2x00mac_bss_info_changedexport rt2x00mac_conf_txexport rt2x00mac_rfkill_pollexport rt2x00mac_flushexport rt2x00mac_set_antennaexport rt2x00mac_get_antennaexport rt2x00mac_get_ringparamexport rt2x00mac_tx_frames_pending
Annotated Snippet
if (rt2x00queue_available(queue) <= 1) {
/*
* Recheck for full queue under lock to avoid race
* conditions with rt2x00lib_txdone().
*/
spin_lock(&queue->tx_lock);
if (rt2x00queue_threshold(queue))
rt2x00queue_pause_queue(queue);
spin_unlock(&queue->tx_lock);
goto exit_free_skb;
}
if (rt2x00mac_tx_rts_cts(rt2x00dev, queue, skb))
goto exit_free_skb;
}
if (unlikely(rt2x00queue_write_tx_frame(queue, skb, control->sta, false)))
goto exit_free_skb;
return;
exit_free_skb:
ieee80211_free_txskb(hw, skb);
}
EXPORT_SYMBOL_GPL(rt2x00mac_tx);
int rt2x00mac_start(struct ieee80211_hw *hw)
{
struct rt2x00_dev *rt2x00dev = hw->priv;
if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
return 0;
if (test_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags)) {
/*
* This is special case for ieee80211_restart_hw(), otherwise
* mac80211 never call start() two times in row without stop();
*/
set_bit(DEVICE_STATE_RESET, &rt2x00dev->flags);
rt2x00dev->ops->lib->pre_reset_hw(rt2x00dev);
rt2x00lib_stop(rt2x00dev);
}
return rt2x00lib_start(rt2x00dev);
}
EXPORT_SYMBOL_GPL(rt2x00mac_start);
void rt2x00mac_stop(struct ieee80211_hw *hw, bool suspend)
{
struct rt2x00_dev *rt2x00dev = hw->priv;
if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
return;
rt2x00lib_stop(rt2x00dev);
}
EXPORT_SYMBOL_GPL(rt2x00mac_stop);
void
rt2x00mac_reconfig_complete(struct ieee80211_hw *hw,
enum ieee80211_reconfig_type reconfig_type)
{
struct rt2x00_dev *rt2x00dev = hw->priv;
if (reconfig_type == IEEE80211_RECONFIG_TYPE_RESTART)
clear_bit(DEVICE_STATE_RESET, &rt2x00dev->flags);
}
EXPORT_SYMBOL_GPL(rt2x00mac_reconfig_complete);
int rt2x00mac_add_interface(struct ieee80211_hw *hw,
struct ieee80211_vif *vif)
{
struct rt2x00_dev *rt2x00dev = hw->priv;
struct rt2x00_intf *intf = vif_to_intf(vif);
struct data_queue *queue = rt2x00dev->bcn;
struct queue_entry *entry = NULL;
unsigned int i;
/*
* Don't allow interfaces to be added
* the device has disappeared.
*/
if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) ||
!test_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags))
return -ENODEV;
/*
* Loop through all beacon queues to find a free
* entry. Since there are as much beacon entries
* as the maximum interfaces, this search shouldn't
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `rt2x00.h`, `rt2x00lib.h`.
- Detected declarations: `function rt2x00mac_tx_rts_cts`, `function rt2x00mac_tx`, `function set_rts_threshold`, `function rt2x00mac_start`, `function rt2x00mac_stop`, `function rt2x00mac_reconfig_complete`, `function rt2x00mac_add_interface`, `function rt2x00mac_remove_interface`, `function rt2x00mac_config`, `function rt2x00mac_configure_filter`.
- 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.