wifi: rtw89: drop TIMING_BEACON_ONLY and sync beacon TSF by self
Some of our calculation during concurrent mode depend on last beacon TSF. Originally, we just set IEEE80211_HW_TIMING_BEACON_ONLY and get what we want from mac80211. But, IEEE80211_HW_TIMING_BEACON_ONLY will be restricted once we declare MLO. Since we are about to consider the MLO stuffs, so sync beacon TSF by ourselves now and unset IEEE80211_HW_TIMING_BEACON_ONLY. Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://msgid.link/20240206030624.23382-2-pkshih@realtek.com
This commit is contained in:
committed by
Kalle Valo
parent
a8e5fefa91
commit
188045a856
@@ -320,19 +320,12 @@ int rtw89_iterate_mcc_roles(struct rtw89_dev *rtwdev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* For now, IEEE80211_HW_TIMING_BEACON_ONLY can make things simple to ensure
|
||||
* correctness of MCC calculation logic below. We have noticed that once driver
|
||||
* declares WIPHY_FLAG_SUPPORTS_MLO, the use of IEEE80211_HW_TIMING_BEACON_ONLY
|
||||
* will be restricted. We will make an alternative in driver when it is ready
|
||||
* for MLO.
|
||||
*/
|
||||
static u32 rtw89_mcc_get_tbtt_ofst(struct rtw89_dev *rtwdev,
|
||||
struct rtw89_mcc_role *role, u64 tsf)
|
||||
{
|
||||
struct rtw89_vif *rtwvif = role->rtwvif;
|
||||
struct ieee80211_vif *vif = rtwvif_to_vif(rtwvif);
|
||||
u32 bcn_intvl_us = ieee80211_tu_to_usec(role->beacon_interval);
|
||||
u64 sync_tsf = vif->bss_conf.sync_tsf;
|
||||
u64 sync_tsf = READ_ONCE(rtwvif->sync_bcn_tsf);
|
||||
u32 remainder;
|
||||
|
||||
if (tsf < sync_tsf) {
|
||||
|
||||
@@ -1868,6 +1868,17 @@ static void rtw89_core_cancel_6ghz_probe_tx(struct rtw89_dev *rtwdev,
|
||||
ieee80211_queue_work(rtwdev->hw, &rtwdev->cancel_6ghz_probe_work);
|
||||
}
|
||||
|
||||
static void rtw89_vif_sync_bcn_tsf(struct rtw89_vif *rtwvif,
|
||||
struct ieee80211_hdr *hdr, size_t len)
|
||||
{
|
||||
struct ieee80211_mgmt *mgmt = (typeof(mgmt))hdr;
|
||||
|
||||
if (len < offsetof(typeof(*mgmt), u.beacon.variable))
|
||||
return;
|
||||
|
||||
WRITE_ONCE(rtwvif->sync_bcn_tsf, le64_to_cpu(mgmt->u.beacon.timestamp));
|
||||
}
|
||||
|
||||
static void rtw89_vif_rx_stats_iter(void *data, u8 *mac,
|
||||
struct ieee80211_vif *vif)
|
||||
{
|
||||
@@ -1898,8 +1909,10 @@ static void rtw89_vif_rx_stats_iter(void *data, u8 *mac,
|
||||
return;
|
||||
|
||||
if (ieee80211_is_beacon(hdr->frame_control)) {
|
||||
if (vif->type == NL80211_IFTYPE_STATION)
|
||||
if (vif->type == NL80211_IFTYPE_STATION) {
|
||||
rtw89_vif_sync_bcn_tsf(rtwvif, hdr, skb->len);
|
||||
rtw89_fw_h2c_rssi_offload(rtwdev, phy_ppdu);
|
||||
}
|
||||
pkt_stat->beacon_nr++;
|
||||
}
|
||||
|
||||
@@ -4447,9 +4460,6 @@ static int rtw89_core_register_hw(struct rtw89_dev *rtwdev)
|
||||
ieee80211_hw_set(hw, SUPPORTS_MULTI_BSSID);
|
||||
ieee80211_hw_set(hw, WANT_MONITOR_VIF);
|
||||
|
||||
/* ref: description of rtw89_mcc_get_tbtt_ofst() in chan.c */
|
||||
ieee80211_hw_set(hw, TIMING_BEACON_ONLY);
|
||||
|
||||
if (chip->support_bandwidths & BIT(NL80211_CHAN_WIDTH_160))
|
||||
ieee80211_hw_set(hw, SUPPORTS_VHT_EXT_NSS_BW);
|
||||
|
||||
|
||||
@@ -3044,6 +3044,7 @@ struct rtw89_vif {
|
||||
u8 bcn_hit_cond;
|
||||
u8 hit_rule;
|
||||
u8 last_noa_nr;
|
||||
u64 sync_bcn_tsf;
|
||||
bool offchan;
|
||||
bool trigger;
|
||||
bool lsig_txop;
|
||||
|
||||
@@ -449,6 +449,7 @@ static void rtw89_ops_bss_info_changed(struct ieee80211_hw *hw,
|
||||
ether_addr_copy(rtwvif->bssid, conf->bssid);
|
||||
rtw89_cam_bssid_changed(rtwdev, rtwvif);
|
||||
rtw89_fw_h2c_cam(rtwdev, rtwvif, NULL, NULL);
|
||||
WRITE_ONCE(rtwvif->sync_bcn_tsf, 0);
|
||||
}
|
||||
|
||||
if (changed & BSS_CHANGED_BEACON)
|
||||
|
||||
Reference in New Issue
Block a user