drivers/net/wireless/realtek/rtw89/mac80211.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/realtek/rtw89/mac80211.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/realtek/rtw89/mac80211.c- Extension
.c- Size
- 55054 bytes
- Lines
- 2043
- 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
cam.hchan.hcoex.hdebug.hfw.hmac.hphy.hps.hreg.hsar.hser.hutil.hwow.h
Detected Declarations
struct rtw89_iter_bitrate_mask_datafunction rtw89_ops_txfunction rtw89_ops_wake_tx_queuefunction rtw89_ops_startfunction rtw89_ops_stopfunction rtw89_ops_configfunction __rtw89_ops_add_iface_linkfunction __rtw89_ops_remove_iface_linkfunction rtw89_ops_add_interfacefunction rtw89_ops_remove_interfacefunction rtw89_ops_change_interfacefunction rtw89_ops_configure_filterfunction rtw89_aifsn_to_aifsfunction ____rtw89_conf_tx_edcafunction ____rtw89_conf_tx_mu_edcafunction __rtw89_conf_txfunction rtw89_conf_txfunction __rtw89_ops_sta_addfunction __rtw89_ops_sta_assocfunction rtw89_sta_for_each_linkfunction __rtw89_ops_sta_disassocfunction rtw89_sta_for_each_linkfunction __rtw89_ops_sta_disconnectfunction rtw89_sta_for_each_linkfunction __rtw89_ops_sta_removefunction rtw89_sta_for_each_linkfunction rtw89_station_mode_sta_assocfunction __rtw89_ops_bss_link_assocfunction __rtw89_ops_bss_assocfunction rtw89_ops_vif_cfg_changedfunction rtw89_ops_link_info_changedfunction rtw89_ops_start_apfunction rtw89_ops_stop_apfunction rtw89_ops_set_timfunction rtw89_ops_conf_txfunction __rtw89_ops_sta_statefunction rtw89_ops_sta_statefunction rtw89_ops_set_keyfunction rtw89_ops_ampdu_actionfunction rtw89_ops_set_rts_thresholdfunction rtw89_ops_sta_statisticsfunction __rtw89_drop_packetsfunction rtw89_ops_flushfunction rtw89_ra_mask_info_update_iterfunction rtw89_sta_for_each_linkfunction rtw89_ra_mask_info_updatefunction rtw89_ops_set_bitrate_maskfunction rtw89_ops_set_antenna
Annotated Snippet
struct rtw89_iter_bitrate_mask_data {
struct rtw89_dev *rtwdev;
struct ieee80211_vif *vif;
const struct cfg80211_bitrate_mask *mask;
};
static void rtw89_ra_mask_info_update_iter(void *data, struct ieee80211_sta *sta)
{
struct rtw89_iter_bitrate_mask_data *br_data = data;
struct rtw89_sta *rtwsta = sta_to_rtwsta(sta);
struct rtw89_vif *rtwvif = rtwsta->rtwvif;
struct ieee80211_vif *vif = rtwvif_to_vif(rtwvif);
struct rtw89_sta_link *rtwsta_link;
unsigned int link_id;
if (vif != br_data->vif || vif->p2p)
return;
rtw89_sta_for_each_link(rtwsta, rtwsta_link, link_id) {
rtwsta_link->use_cfg_mask = true;
rtwsta_link->mask = *br_data->mask;
}
rtw89_phy_ra_update_sta(br_data->rtwdev, sta, IEEE80211_RC_SUPP_RATES_CHANGED);
}
static void rtw89_ra_mask_info_update(struct rtw89_dev *rtwdev,
struct ieee80211_vif *vif,
const struct cfg80211_bitrate_mask *mask)
{
struct rtw89_iter_bitrate_mask_data br_data = { .rtwdev = rtwdev,
.vif = vif,
.mask = mask};
ieee80211_iterate_stations_atomic(rtwdev->hw, rtw89_ra_mask_info_update_iter,
&br_data);
}
static int rtw89_ops_set_bitrate_mask(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
const struct cfg80211_bitrate_mask *mask)
{
struct rtw89_dev *rtwdev = hw->priv;
lockdep_assert_wiphy(hw->wiphy);
rtw89_phy_rate_pattern_vif(rtwdev, vif, mask);
rtw89_ra_mask_info_update(rtwdev, vif, mask);
return 0;
}
static
int rtw89_ops_set_antenna(struct ieee80211_hw *hw, int radio_idx, u32 tx_ant, u32 rx_ant)
{
struct rtw89_dev *rtwdev = hw->priv;
struct rtw89_hal *hal = &rtwdev->hal;
const struct rtw89_chip_info *chip;
lockdep_assert_wiphy(hw->wiphy);
chip = rtwdev->chip;
if (hal->ant_diversity) {
if (tx_ant != rx_ant || hweight32(tx_ant) != 1)
return -EINVAL;
} else if (chip->ops->cfg_txrx_path) {
/* With cfg_txrx_path ops, chips can configure rx_ant */
} else if (rx_ant != hw->wiphy->available_antennas_rx && rx_ant != hal->antenna_rx) {
return -EINVAL;
}
hal->antenna_tx = tx_ant;
hal->antenna_rx = rx_ant;
hal->tx_path_diversity = false;
hal->ant_diversity_fixed = true;
return 0;
}
static
int rtw89_ops_get_antenna(struct ieee80211_hw *hw, int radio_idx, u32 *tx_ant,
u32 *rx_ant)
{
struct rtw89_dev *rtwdev = hw->priv;
struct rtw89_hal *hal = &rtwdev->hal;
*tx_ant = hal->antenna_tx;
*rx_ant = hal->antenna_rx;
Annotation
- Immediate include surface: `cam.h`, `chan.h`, `coex.h`, `debug.h`, `fw.h`, `mac.h`, `phy.h`, `ps.h`.
- Detected declarations: `struct rtw89_iter_bitrate_mask_data`, `function rtw89_ops_tx`, `function rtw89_ops_wake_tx_queue`, `function rtw89_ops_start`, `function rtw89_ops_stop`, `function rtw89_ops_config`, `function __rtw89_ops_add_iface_link`, `function __rtw89_ops_remove_iface_link`, `function rtw89_ops_add_interface`, `function rtw89_ops_remove_interface`.
- 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.