You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
96 lines
3.5 KiB
96 lines
3.5 KiB
From 100a5e9b3f924d1840b8be0134fb0fc7e93a9c1f Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
|
Date: Wed, 24 May 2023 15:00:29 +0200
|
|
Subject: [PATCH 062/142] wifi: rtw89: avoid inaccessible IO operations during
|
|
doing change_interface()
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
Bugzilla: https://bugzilla.redhat.com/2207499
|
|
|
|
commit ac3a9f1838d8f5e5f9c8b6e2582b65c48a1e7bc1
|
|
Author: Ping-Ke Shih <pkshih@realtek.com>
|
|
Date: Thu Nov 17 16:52:35 2022 +0800
|
|
|
|
wifi: rtw89: avoid inaccessible IO operations during doing change_interface()
|
|
|
|
During doing change_interface(), hardware is power-off, so some components
|
|
are inaccessible and return error. This causes things unexpected, and we
|
|
don't have a warning message for that. So, ignore some IO operations in
|
|
this situation, and add a warning message to indicate something wrong.
|
|
|
|
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
|
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
|
Link: https://lore.kernel.org/r/20221117085235.53777-1-pkshih@realtek.com
|
|
|
|
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
|
---
|
|
drivers/net/wireless/realtek/rtw89/core.h | 1 +
|
|
drivers/net/wireless/realtek/rtw89/mac.c | 7 +++++++
|
|
drivers/net/wireless/realtek/rtw89/mac80211.c | 11 ++++++++++-
|
|
3 files changed, 18 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
|
|
index 62d834dbff67b..1b0acb1c5450e 100644
|
|
--- a/drivers/net/wireless/realtek/rtw89/core.h
|
|
+++ b/drivers/net/wireless/realtek/rtw89/core.h
|
|
@@ -2968,6 +2968,7 @@ enum rtw89_flags {
|
|
RTW89_FLAG_CRASH_SIMULATING,
|
|
RTW89_FLAG_WOWLAN,
|
|
RTW89_FLAG_FORBIDDEN_TRACK_WROK,
|
|
+ RTW89_FLAG_CHANGING_INTERFACE,
|
|
|
|
NUM_OF_RTW89_FLAGS,
|
|
};
|
|
diff --git a/drivers/net/wireless/realtek/rtw89/mac.c b/drivers/net/wireless/realtek/rtw89/mac.c
|
|
index ecd603a881345..6587cdf6ba624 100644
|
|
--- a/drivers/net/wireless/realtek/rtw89/mac.c
|
|
+++ b/drivers/net/wireless/realtek/rtw89/mac.c
|
|
@@ -3600,6 +3600,13 @@ int rtw89_mac_set_macid_pause(struct rtw89_dev *rtwdev, u8 macid, bool pause)
|
|
u8 grp = macid >> 5;
|
|
int ret;
|
|
|
|
+ /* If this is called by change_interface() in the case of P2P, it could
|
|
+ * be power-off, so ignore this operation.
|
|
+ */
|
|
+ if (test_bit(RTW89_FLAG_CHANGING_INTERFACE, rtwdev->flags) &&
|
|
+ !test_bit(RTW89_FLAG_POWERON, rtwdev->flags))
|
|
+ return 0;
|
|
+
|
|
ret = rtw89_mac_check_mac_en(rtwdev, RTW89_MAC_0, RTW89_CMAC_SEL);
|
|
if (ret)
|
|
return ret;
|
|
diff --git a/drivers/net/wireless/realtek/rtw89/mac80211.c b/drivers/net/wireless/realtek/rtw89/mac80211.c
|
|
index 6e79bf899901d..ce980d2f22c46 100644
|
|
--- a/drivers/net/wireless/realtek/rtw89/mac80211.c
|
|
+++ b/drivers/net/wireless/realtek/rtw89/mac80211.c
|
|
@@ -174,6 +174,9 @@ static int rtw89_ops_change_interface(struct ieee80211_hw *hw,
|
|
enum nl80211_iftype type, bool p2p)
|
|
{
|
|
struct rtw89_dev *rtwdev = hw->priv;
|
|
+ int ret;
|
|
+
|
|
+ set_bit(RTW89_FLAG_CHANGING_INTERFACE, rtwdev->flags);
|
|
|
|
rtw89_debug(rtwdev, RTW89_DBG_STATE, "change vif %pM (%d)->(%d), p2p (%d)->(%d)\n",
|
|
vif->addr, vif->type, type, vif->p2p, p2p);
|
|
@@ -183,7 +186,13 @@ static int rtw89_ops_change_interface(struct ieee80211_hw *hw,
|
|
vif->type = type;
|
|
vif->p2p = p2p;
|
|
|
|
- return rtw89_ops_add_interface(hw, vif);
|
|
+ ret = rtw89_ops_add_interface(hw, vif);
|
|
+ if (ret)
|
|
+ rtw89_warn(rtwdev, "failed to change interface %d\n", ret);
|
|
+
|
|
+ clear_bit(RTW89_FLAG_CHANGING_INTERFACE, rtwdev->flags);
|
|
+
|
|
+ return ret;
|
|
}
|
|
|
|
static void rtw89_ops_configure_filter(struct ieee80211_hw *hw,
|
|
--
|
|
2.13.6
|
|
|