wifi: rtw89: refine FW feature judgement on packet drop
authorZong-Zhe Yang <kevin_yang@realtek.com>
Mon, 20 Feb 2023 07:02:02 +0000 (15:02 +0800)
committerKalle Valo <kvalo@kernel.org>
Wed, 22 Feb 2023 12:32:13 +0000 (14:32 +0200)
The newer chips use the newer firmware branches, e.g. v027, v029.
And, those firmware branches are supposed to support packet drop
when they are just branched out.

The initial firmware branch used by each chip is as below.
* 8852A: v009
* 8852C: v027
* 8852B: v027

So, only 8852A may use firmware which doesn't support packet drop at
runtime. To save trivial positive listing in firmware feature table,
we change to reverse judgment.

Besides, rtw89_mac_ptk_drop_by_band_and_wait() missed to check firmware
feature before calling rtw89_fw_h2c_pkt_drop(). We also fix it.

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://lore.kernel.org/r/20230220070202.29868-7-pkshih@realtek.com
drivers/net/wireless/realtek/rtw89/core.h
drivers/net/wireless/realtek/rtw89/fw.c
drivers/net/wireless/realtek/rtw89/mac.c
drivers/net/wireless/realtek/rtw89/mac80211.c

index 41365ffb7e5ea79b829aae10f386e2074e10a770..b1a886898c5a088cd5459c7e753543997b864972 100644 (file)
@@ -3023,7 +3023,7 @@ enum rtw89_fw_feature {
        RTW89_FW_FEATURE_SCAN_OFFLOAD,
        RTW89_FW_FEATURE_TX_WAKE,
        RTW89_FW_FEATURE_CRASH_TRIGGER,
-       RTW89_FW_FEATURE_PACKET_DROP,
+       RTW89_FW_FEATURE_NO_PACKET_DROP,
        RTW89_FW_FEATURE_NO_DEEP_PS,
        RTW89_FW_FEATURE_NO_LPS_PG,
 };
index dceb033acbc890904d25d5d57d83b4c1544e4142..1a4ff24078fb934279eb2839669f2920efc34dac 100644 (file)
@@ -235,6 +235,7 @@ static bool __fw_feat_cond_ ## __cond(u32 suit_ver_code, u32 comp_ver_code) \
 
 __DEF_FW_FEAT_COND(ge, >=); /* greater or equal */
 __DEF_FW_FEAT_COND(le, <=); /* less or equal */
+__DEF_FW_FEAT_COND(lt, <); /* less than */
 
 struct __fw_feat_cfg {
        enum rtw89_core_chip_id chip_id;
@@ -256,12 +257,11 @@ static const struct __fw_feat_cfg fw_feat_tbl[] = {
        __CFG_FW_FEAT(RTL8852A, ge, 0, 13, 35, 0, SCAN_OFFLOAD),
        __CFG_FW_FEAT(RTL8852A, ge, 0, 13, 35, 0, TX_WAKE),
        __CFG_FW_FEAT(RTL8852A, ge, 0, 13, 36, 0, CRASH_TRIGGER),
-       __CFG_FW_FEAT(RTL8852A, ge, 0, 13, 38, 0, PACKET_DROP),
+       __CFG_FW_FEAT(RTL8852A, lt, 0, 13, 38, 0, NO_PACKET_DROP),
        __CFG_FW_FEAT(RTL8852B, ge, 0, 29, 26, 0, NO_LPS_PG),
        __CFG_FW_FEAT(RTL8852B, ge, 0, 29, 26, 0, TX_WAKE),
        __CFG_FW_FEAT(RTL8852B, ge, 0, 29, 29, 0, CRASH_TRIGGER),
        __CFG_FW_FEAT(RTL8852B, ge, 0, 29, 29, 0, SCAN_OFFLOAD),
-       __CFG_FW_FEAT(RTL8852C, ge, 0, 27, 20, 0, PACKET_DROP),
        __CFG_FW_FEAT(RTL8852C, le, 0, 27, 33, 0, NO_DEEP_PS),
        __CFG_FW_FEAT(RTL8852C, ge, 0, 27, 34, 0, TX_WAKE),
        __CFG_FW_FEAT(RTL8852C, ge, 0, 27, 36, 0, SCAN_OFFLOAD),
index 2e2a2b6eab09d4a3c6c9b2ca1c1d1d77683cddd2..3d1e4ffef1b16c1d9456a93837f8833a33e6be8a 100644 (file)
@@ -5426,7 +5426,7 @@ int rtw89_mac_ptk_drop_by_band_and_wait(struct rtw89_dev *rtwdev,
        for (i = 0; i < try_cnt; i++) {
                ret = read_poll_timeout(mac_is_txq_empty, empty, empty, 50,
                                        50000, false, rtwdev);
-               if (ret)
+               if (ret && !RTW89_CHK_FW_FEATURE(NO_PACKET_DROP, &rtwdev->fw))
                        rtw89_fw_h2c_pkt_drop(rtwdev, &params);
                else
                        return 0;
index d43281f7335b139c636f2fd6fabf2a0245384839..367a7bf319daeb8446e7f5f88ad50489345e1cf9 100644 (file)
@@ -676,7 +676,7 @@ static void rtw89_ops_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
        rtw89_leave_lps(rtwdev);
        rtw89_hci_flush_queues(rtwdev, queues, drop);
 
-       if (drop && RTW89_CHK_FW_FEATURE(PACKET_DROP, &rtwdev->fw))
+       if (drop && !RTW89_CHK_FW_FEATURE(NO_PACKET_DROP, &rtwdev->fw))
                __rtw89_drop_packets(rtwdev, vif);
        else
                rtw89_mac_flush_txq(rtwdev, queues, drop);