drivers/net/wireless/realtek/rtw89/mac.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/realtek/rtw89/mac.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/realtek/rtw89/mac.c- Extension
.c- Size
- 223875 bytes
- Lines
- 7526
- 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
cam.hchan.hdebug.hefuse.hfw.hmac.hpci.hphy.hps.hreg.hser.hutil.h
Detected Declarations
struct rtw89_mac_bf_monitor_iter_datafunction rtw89_mac_mem_writefunction rtw89_mac_mem_readfunction rtw89_mac_check_mac_en_axfunction rtw89_mac_write_ltefunction rtw89_mac_read_ltefunction rtw89_mac_dle_dfi_cfgfunction rtw89_mac_dle_dfi_quota_cfgfunction rtw89_mac_dle_dfi_qempty_cfgfunction dump_err_status_dispatcher_axfunction rtw89_mac_dump_qta_lost_axfunction rtw89_mac_dump_l0_to_l1function rtw89_mac_dump_dmac_err_statusfunction rtw89_mac_dump_cmac_err_status_axfunction rtw89_mac_dump_err_status_axfunction rtw89_mac_suppress_logfunction rtw89_mac_get_err_statusfunction rtw89_mac_set_err_statusfunction hfc_reset_paramfunction hfc_ch_cfg_chkfunction hfc_pub_info_chkfunction hfc_pub_cfg_chkfunction hfc_ch_ctrlfunction hfc_upd_ch_infofunction hfc_pub_ctrlfunction hfc_get_mix_info_axfunction hfc_upd_mix_infofunction hfc_h2c_cfg_axfunction hfc_mix_cfg_axfunction hfc_func_en_axfunction rtw89_mac_hfc_initfunction pwr_cmd_pollfunction rtw89_mac_sub_pwr_seqfunction rtw89_mac_pwr_seqfunction rtw89_mac_get_req_pwr_statefunction rtw89_mac_send_rpwmfunction rtw89_mac_check_cpwm_statefunction rtw89_mac_power_mode_changefunction rtw89_mac_notify_wakefunction rtw89_mac_power_switch_boot_modefunction rtw89_mac_pwr_off_func_for_unpluggedfunction rtw89_mac_update_scoreboardfunction rtw89_mac_power_switchfunction rtw89_mac_pwr_onfunction rtw89_mac_pwr_offfunction cmac_func_en_axfunction dmac_func_en_axfunction chip_func_en_ax
Annotated Snippet
struct rtw89_mac_bf_monitor_iter_data {
struct rtw89_dev *rtwdev;
struct rtw89_sta_link *down_rtwsta_link;
int count;
};
static
void rtw89_mac_bf_monitor_calc_iter(void *data, struct ieee80211_sta *sta)
{
struct rtw89_mac_bf_monitor_iter_data *iter_data =
(struct rtw89_mac_bf_monitor_iter_data *)data;
struct rtw89_sta_link *down_rtwsta_link = iter_data->down_rtwsta_link;
struct rtw89_sta *rtwsta = sta_to_rtwsta(sta);
struct ieee80211_link_sta *link_sta;
struct rtw89_sta_link *rtwsta_link;
bool has_beamformer_cap = false;
int *count = &iter_data->count;
unsigned int link_id;
rcu_read_lock();
rtw89_sta_for_each_link(rtwsta, rtwsta_link, link_id) {
if (rtwsta_link == down_rtwsta_link)
continue;
link_sta = rtw89_sta_rcu_dereference_link(rtwsta_link, false);
if (rtw89_sta_has_beamformer_cap(link_sta)) {
has_beamformer_cap = true;
break;
}
}
if (has_beamformer_cap)
(*count)++;
rcu_read_unlock();
}
void rtw89_mac_bf_monitor_calc(struct rtw89_dev *rtwdev,
struct rtw89_sta_link *rtwsta_link,
bool disconnect)
{
struct rtw89_mac_bf_monitor_iter_data data;
data.rtwdev = rtwdev;
data.down_rtwsta_link = disconnect ? rtwsta_link : NULL;
data.count = 0;
ieee80211_iterate_stations_atomic(rtwdev->hw,
rtw89_mac_bf_monitor_calc_iter,
&data);
rtw89_debug(rtwdev, RTW89_DBG_BF, "bfee STA count=%d\n", data.count);
if (data.count)
set_bit(RTW89_FLAG_BFEE_MON, rtwdev->flags);
else
clear_bit(RTW89_FLAG_BFEE_MON, rtwdev->flags);
}
void _rtw89_mac_bf_monitor_track(struct rtw89_dev *rtwdev)
{
struct rtw89_traffic_stats *stats = &rtwdev->stats;
struct rtw89_vif_link *rtwvif_link;
bool en = stats->tx_tfc_lv <= stats->rx_tfc_lv;
bool old = test_bit(RTW89_FLAG_BFEE_EN, rtwdev->flags);
struct rtw89_vif *rtwvif;
bool keep_timer = true;
unsigned int link_id;
bool old_keep_timer;
old_keep_timer = test_bit(RTW89_FLAG_BFEE_TIMER_KEEP, rtwdev->flags);
if (stats->tx_tfc_lv <= RTW89_TFC_LOW && stats->rx_tfc_lv <= RTW89_TFC_LOW)
keep_timer = false;
if (keep_timer != old_keep_timer) {
rtw89_for_each_rtwvif(rtwdev, rtwvif)
rtw89_vif_for_each_link(rtwvif, rtwvif_link, link_id)
rtw89_mac_bfee_standby_timer(rtwdev, rtwvif_link->mac_idx,
keep_timer);
}
if (en == old)
return;
rtw89_for_each_rtwvif(rtwdev, rtwvif)
rtw89_vif_for_each_link(rtwvif, rtwvif_link, link_id)
rtw89_mac_bfee_ctrl(rtwdev, rtwvif_link->mac_idx, en);
}
static int
Annotation
- Immediate include surface: `cam.h`, `chan.h`, `debug.h`, `efuse.h`, `fw.h`, `mac.h`, `pci.h`, `phy.h`.
- Detected declarations: `struct rtw89_mac_bf_monitor_iter_data`, `function rtw89_mac_mem_write`, `function rtw89_mac_mem_read`, `function rtw89_mac_check_mac_en_ax`, `function rtw89_mac_write_lte`, `function rtw89_mac_read_lte`, `function rtw89_mac_dle_dfi_cfg`, `function rtw89_mac_dle_dfi_quota_cfg`, `function rtw89_mac_dle_dfi_qempty_cfg`, `function dump_err_status_dispatcher_ax`.
- 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.