]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
wifi: rtw89: wow: fix wait condition for AOAC report request
authorZong-Zhe Yang <kevin_yang@realtek.com>
Mon, 26 Aug 2024 09:04:36 +0000 (17:04 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 4 Oct 2024 14:37:23 +0000 (16:37 +0200)
[ Upstream commit d9dd3ac77cf7cabd35732893f3aefba1daa1c2e1 ]

Each condition binding to the same wait should be unique. AOAC code misused
the wait of FW offload series and broke the above rule. It added another
macro to generate wait condition of WoWLAN/AOAC, but the results conflict
to the ones of FW offload series. It means that we might be completed
wrongly in logic. We don't want things work/read like this and should
have avoided this.

Fix this by adding another wait which aims for WoWLAN functions.

Fixes: ff53fce5c78b ("wifi: rtw89: wow: update latest PTK GTK info to mac80211 after resume")
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20240826090439.17242-2-pkshih@realtek.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/realtek/rtw89/core.c
drivers/net/wireless/realtek/rtw89/core.h
drivers/net/wireless/realtek/rtw89/fw.c
drivers/net/wireless/realtek/rtw89/fw.h
drivers/net/wireless/realtek/rtw89/mac.c

index 7019f7d482a88175fd45ea629e75308ab14e814b..fc172964349bdd5ac16cc4bb2e21b7f871eb9829 100644 (file)
@@ -4278,6 +4278,7 @@ int rtw89_core_init(struct rtw89_dev *rtwdev)
 
        rtw89_init_wait(&rtwdev->mcc.wait);
        rtw89_init_wait(&rtwdev->mac.fw_ofld_wait);
+       rtw89_init_wait(&rtwdev->wow.wait);
 
        INIT_WORK(&rtwdev->c2h_work, rtw89_fw_c2h_work);
        INIT_WORK(&rtwdev->ips_work, rtw89_ips_work);
index 11fa003a9788c446181f8ced509dc8acd9e04ad9..9c282d84743b9ef1355af261f0c0312d9ea49b97 100644 (file)
@@ -5293,6 +5293,9 @@ struct rtw89_wow_param {
        u8 gtk_alg;
        u8 ptk_keyidx;
        u8 akm;
+
+       /* see RTW89_WOW_WAIT_COND series for wait condition */
+       struct rtw89_wait_info wait;
 };
 
 struct rtw89_mcc_limit {
index fbe08c162b93de5123456749aedb6343cf507c43..c322148d6daf59798b26134b333ca2f3ed4bd873 100644 (file)
@@ -6825,11 +6825,10 @@ fail:
 
 int rtw89_fw_h2c_wow_request_aoac(struct rtw89_dev *rtwdev)
 {
-       struct rtw89_wait_info *wait = &rtwdev->mac.fw_ofld_wait;
+       struct rtw89_wait_info *wait = &rtwdev->wow.wait;
        struct rtw89_h2c_wow_aoac *h2c;
        u32 len = sizeof(*h2c);
        struct sk_buff *skb;
-       unsigned int cond;
 
        skb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, len);
        if (!skb) {
@@ -6848,8 +6847,7 @@ int rtw89_fw_h2c_wow_request_aoac(struct rtw89_dev *rtwdev)
                              H2C_FUNC_AOAC_REPORT_REQ, 1, 0,
                              len);
 
-       cond = RTW89_WOW_WAIT_COND(H2C_FUNC_AOAC_REPORT_REQ);
-       return rtw89_h2c_tx_and_wait(rtwdev, skb, wait, cond);
+       return rtw89_h2c_tx_and_wait(rtwdev, skb, wait, RTW89_WOW_WAIT_COND_AOAC);
 }
 
 /* Return < 0, if failures happen during waiting for the condition.
index c3b4324c621c16a83c07d15338edc3a8cec344ea..df6f2424fa91139429ef3acb2bc927477b633667 100644 (file)
@@ -3942,8 +3942,11 @@ enum rtw89_wow_h2c_func {
        NUM_OF_RTW89_WOW_H2C_FUNC,
 };
 
-#define RTW89_WOW_WAIT_COND(func) \
-       (NUM_OF_RTW89_WOW_H2C_FUNC + (func))
+#define RTW89_WOW_WAIT_COND(tag, func) \
+       ((tag) * NUM_OF_RTW89_WOW_H2C_FUNC + (func))
+
+#define RTW89_WOW_WAIT_COND_AOAC \
+       RTW89_WOW_WAIT_COND(0 /* don't care */, H2C_FUNC_AOAC_REPORT_REQ)
 
 /* CLASS 2 - PS */
 #define H2C_CL_MAC_PS                  0x2
index facd32de37bce1eb0a66fbd675f16b45257a4b57..9a4f23d83bf2a872fe1182608c687d2f05e335ca 100644 (file)
@@ -5151,11 +5151,10 @@ rtw89_mac_c2h_wow_aoac_rpt(struct rtw89_dev *rtwdev, struct sk_buff *skb, u32 le
 {
        struct rtw89_wow_param *rtw_wow = &rtwdev->wow;
        struct rtw89_wow_aoac_report *aoac_rpt = &rtw_wow->aoac_rpt;
-       struct rtw89_wait_info *wait = &rtwdev->mac.fw_ofld_wait;
+       struct rtw89_wait_info *wait = &rtw_wow->wait;
        const struct rtw89_c2h_wow_aoac_report *c2h =
                (const struct rtw89_c2h_wow_aoac_report *)skb->data;
        struct rtw89_completion_data data = {};
-       unsigned int cond;
 
        aoac_rpt->rpt_ver = c2h->rpt_ver;
        aoac_rpt->sec_type = c2h->sec_type;
@@ -5173,8 +5172,7 @@ rtw89_mac_c2h_wow_aoac_rpt(struct rtw89_dev *rtwdev, struct sk_buff *skb, u32 le
        aoac_rpt->igtk_ipn = le64_to_cpu(c2h->igtk_ipn);
        memcpy(aoac_rpt->igtk, c2h->igtk, sizeof(aoac_rpt->igtk));
 
-       cond = RTW89_WOW_WAIT_COND(H2C_FUNC_AOAC_REPORT_REQ);
-       rtw89_complete_cond(wait, cond, &data);
+       rtw89_complete_cond(wait, RTW89_WOW_WAIT_COND_AOAC, &data);
 }
 
 static void