1

wifi: rtw88: Set default CQM config if not present

When wpa_supplicant is initiated by users and not by NetworkManager,
the CQM configuration might not be set. Without this setting, ICs
with connection quality monitor handled by firmware won't detect
connection loss. To fix this we prepare a default setting upon
associated at first, then update again if any is given later.

Signed-off-by: Po-Hao Huang <phhuang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240401033019.9664-1-pkshih@realtek.com
This commit is contained in:
Po-Hao Huang 2024-04-01 11:30:19 +08:00 committed by Ping-Ke Shih
parent 2ccb8e6ce8
commit 2710c919df
3 changed files with 14 additions and 4 deletions

View File

@ -783,12 +783,18 @@ void rtw_fw_beacon_filter_config(struct rtw_dev *rtwdev, bool connect,
static const u8 rssi_min = 0, rssi_max = 100, rssi_offset = 100; static const u8 rssi_min = 0, rssi_max = 100, rssi_offset = 100;
struct rtw_sta_info *si = struct rtw_sta_info *si =
sta ? (struct rtw_sta_info *)sta->drv_priv : NULL; sta ? (struct rtw_sta_info *)sta->drv_priv : NULL;
s32 threshold = bss_conf->cqm_rssi_thold + rssi_offset; s32 thold = RTW_DEFAULT_CQM_THOLD;
u32 hyst = RTW_DEFAULT_CQM_HYST;
u8 h2c_pkt[H2C_PKT_SIZE] = {0}; u8 h2c_pkt[H2C_PKT_SIZE] = {0};
if (!rtw_fw_feature_check(&rtwdev->fw, FW_FEATURE_BCN_FILTER)) if (!rtw_fw_feature_check(&rtwdev->fw, FW_FEATURE_BCN_FILTER))
return; return;
if (bss_conf->cqm_rssi_thold)
thold = bss_conf->cqm_rssi_thold;
if (bss_conf->cqm_rssi_hyst)
hyst = bss_conf->cqm_rssi_hyst;
if (!connect) { if (!connect) {
SET_H2C_CMD_ID_CLASS(h2c_pkt, H2C_CMD_BCN_FILTER_OFFLOAD_P1); SET_H2C_CMD_ID_CLASS(h2c_pkt, H2C_CMD_BCN_FILTER_OFFLOAD_P1);
SET_BCN_FILTER_OFFLOAD_P1_ENABLE(h2c_pkt, connect); SET_BCN_FILTER_OFFLOAD_P1_ENABLE(h2c_pkt, connect);
@ -805,15 +811,15 @@ void rtw_fw_beacon_filter_config(struct rtw_dev *rtwdev, bool connect,
rtw_fw_send_h2c_command(rtwdev, h2c_pkt); rtw_fw_send_h2c_command(rtwdev, h2c_pkt);
memset(h2c_pkt, 0, sizeof(h2c_pkt)); memset(h2c_pkt, 0, sizeof(h2c_pkt));
threshold = clamp_t(s32, threshold, rssi_min, rssi_max); thold = clamp_t(s32, thold + rssi_offset, rssi_min, rssi_max);
SET_H2C_CMD_ID_CLASS(h2c_pkt, H2C_CMD_BCN_FILTER_OFFLOAD_P1); SET_H2C_CMD_ID_CLASS(h2c_pkt, H2C_CMD_BCN_FILTER_OFFLOAD_P1);
SET_BCN_FILTER_OFFLOAD_P1_ENABLE(h2c_pkt, connect); SET_BCN_FILTER_OFFLOAD_P1_ENABLE(h2c_pkt, connect);
SET_BCN_FILTER_OFFLOAD_P1_OFFLOAD_MODE(h2c_pkt, SET_BCN_FILTER_OFFLOAD_P1_OFFLOAD_MODE(h2c_pkt,
BCN_FILTER_OFFLOAD_MODE_DEFAULT); BCN_FILTER_OFFLOAD_MODE_DEFAULT);
SET_BCN_FILTER_OFFLOAD_P1_THRESHOLD(h2c_pkt, (u8)threshold); SET_BCN_FILTER_OFFLOAD_P1_THRESHOLD(h2c_pkt, thold);
SET_BCN_FILTER_OFFLOAD_P1_BCN_LOSS_CNT(h2c_pkt, BCN_LOSS_CNT); SET_BCN_FILTER_OFFLOAD_P1_BCN_LOSS_CNT(h2c_pkt, BCN_LOSS_CNT);
SET_BCN_FILTER_OFFLOAD_P1_MACID(h2c_pkt, si->mac_id); SET_BCN_FILTER_OFFLOAD_P1_MACID(h2c_pkt, si->mac_id);
SET_BCN_FILTER_OFFLOAD_P1_HYST(h2c_pkt, bss_conf->cqm_rssi_hyst); SET_BCN_FILTER_OFFLOAD_P1_HYST(h2c_pkt, hyst);
SET_BCN_FILTER_OFFLOAD_P1_BCN_INTERVAL(h2c_pkt, bss_conf->beacon_int); SET_BCN_FILTER_OFFLOAD_P1_BCN_INTERVAL(h2c_pkt, bss_conf->beacon_int);
rtw_fw_send_h2c_command(rtwdev, h2c_pkt); rtw_fw_send_h2c_command(rtwdev, h2c_pkt);
} }

View File

@ -29,6 +29,8 @@
#define BCN_FILTER_CONNECTION_LOSS 1 #define BCN_FILTER_CONNECTION_LOSS 1
#define BCN_FILTER_CONNECTED 2 #define BCN_FILTER_CONNECTED 2
#define BCN_FILTER_NOTIFY_BEACON_LOSS 3 #define BCN_FILTER_NOTIFY_BEACON_LOSS 3
#define RTW_DEFAULT_CQM_THOLD -70
#define RTW_DEFAULT_CQM_HYST 4
#define SCAN_NOTIFY_TIMEOUT msecs_to_jiffies(10) #define SCAN_NOTIFY_TIMEOUT msecs_to_jiffies(10)

View File

@ -386,6 +386,8 @@ static void rtw_ops_bss_info_changed(struct ieee80211_hw *hw,
rtw_coex_media_status_notify(rtwdev, vif->cfg.assoc); rtw_coex_media_status_notify(rtwdev, vif->cfg.assoc);
if (rtw_bf_support) if (rtw_bf_support)
rtw_bf_assoc(rtwdev, vif, conf); rtw_bf_assoc(rtwdev, vif, conf);
rtw_fw_beacon_filter_config(rtwdev, true, vif);
} else { } else {
rtw_leave_lps(rtwdev); rtw_leave_lps(rtwdev);
rtw_bf_disassoc(rtwdev, vif, conf); rtw_bf_disassoc(rtwdev, vif, conf);