diff mbox

[v2,04/10] rtlwifi: unlink bss when un-association

Message ID 20180111070932.9929-5-pkshih@realtek.com (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show

Commit Message

Ping-Ke Shih Jan. 11, 2018, 7:09 a.m. UTC
From: Tsang-Shian Lin <thlin@realtek.com>

When AP change bandwidth setting from 20M to 40M, STA may use old 20M AP
information to association with AP. Driver unlink bss in the
.bss_info_changed of ieee80211_ops to make sure that later scan can get
correct AP bandwidth capability.

Signed-off-by: Tsang-Shian Lin <thlin@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
 drivers/net/wireless/realtek/rtlwifi/core.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

Comments

Larry Finger Jan. 15, 2018, 6:53 p.m. UTC | #1
On 01/11/2018 01:09 AM, pkshih@realtek.com wrote:
> From: Tsang-Shian Lin <thlin@realtek.com>
> 
> When AP change bandwidth setting from 20M to 40M, STA may use old 20M AP
> information to association with AP. Driver unlink bss in the
> .bss_info_changed of ieee80211_ops to make sure that later scan can get
> correct AP bandwidth capability.
> 
> Signed-off-by: Tsang-Shian Lin <thlin@realtek.com>
> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
> ---
>   drivers/net/wireless/realtek/rtlwifi/core.c | 18 ++++++++++++++++++
>   1 file changed, 18 insertions(+)

Acked-by: Larry Finger <Larry.Finger@lwfinger.net>


> 
> diff --git a/drivers/net/wireless/realtek/rtlwifi/core.c b/drivers/net/wireless/realtek/rtlwifi/core.c
> index ec639fa8095e..6c698123ac07 100644
> --- a/drivers/net/wireless/realtek/rtlwifi/core.c
> +++ b/drivers/net/wireless/realtek/rtlwifi/core.c
> @@ -1171,6 +1171,8 @@ static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
>   			RT_TRACE(rtlpriv, COMP_MAC80211, DBG_DMESG,
>   				 "BSS_CHANGED_ASSOC\n");
>   		} else {
> +			struct cfg80211_bss *bss = NULL;
> +
>   			mstatus = RT_MEDIA_DISCONNECT;
>   
>   			if (mac->link_state == MAC80211_LINKED)
> @@ -1178,6 +1180,22 @@ static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
>   			if (ppsc->p2p_ps_info.p2p_ps_mode > P2P_PS_NONE)
>   				rtl_p2p_ps_cmd(hw, P2P_PS_DISABLE);
>   			mac->link_state = MAC80211_NOLINK;
> +
> +			bss = cfg80211_get_bss(hw->wiphy, NULL,
> +					       (u8 *)mac->bssid, NULL, 0,
> +					       IEEE80211_BSS_TYPE_ESS,
> +					       IEEE80211_PRIVACY_OFF);
> +
> +			RT_TRACE(rtlpriv, COMP_MAC80211, DBG_DMESG,
> +				 "bssid = %pMF\n", mac->bssid);
> +
> +			if (bss) {
> +				cfg80211_unlink_bss(hw->wiphy, bss);
> +				cfg80211_put_bss(hw->wiphy, bss);
> +				RT_TRACE(rtlpriv, COMP_MAC80211, DBG_DMESG,
> +					 "cfg80211_unlink !!\n");
> +			}
> +
>   			eth_zero_addr(mac->bssid);
>   			mac->vendor = PEER_UNKNOWN;
>   			mac->mode = 0;
>
diff mbox

Patch

diff --git a/drivers/net/wireless/realtek/rtlwifi/core.c b/drivers/net/wireless/realtek/rtlwifi/core.c
index ec639fa8095e..6c698123ac07 100644
--- a/drivers/net/wireless/realtek/rtlwifi/core.c
+++ b/drivers/net/wireless/realtek/rtlwifi/core.c
@@ -1171,6 +1171,8 @@  static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
 			RT_TRACE(rtlpriv, COMP_MAC80211, DBG_DMESG,
 				 "BSS_CHANGED_ASSOC\n");
 		} else {
+			struct cfg80211_bss *bss = NULL;
+
 			mstatus = RT_MEDIA_DISCONNECT;
 
 			if (mac->link_state == MAC80211_LINKED)
@@ -1178,6 +1180,22 @@  static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
 			if (ppsc->p2p_ps_info.p2p_ps_mode > P2P_PS_NONE)
 				rtl_p2p_ps_cmd(hw, P2P_PS_DISABLE);
 			mac->link_state = MAC80211_NOLINK;
+
+			bss = cfg80211_get_bss(hw->wiphy, NULL,
+					       (u8 *)mac->bssid, NULL, 0,
+					       IEEE80211_BSS_TYPE_ESS,
+					       IEEE80211_PRIVACY_OFF);
+
+			RT_TRACE(rtlpriv, COMP_MAC80211, DBG_DMESG,
+				 "bssid = %pMF\n", mac->bssid);
+
+			if (bss) {
+				cfg80211_unlink_bss(hw->wiphy, bss);
+				cfg80211_put_bss(hw->wiphy, bss);
+				RT_TRACE(rtlpriv, COMP_MAC80211, DBG_DMESG,
+					 "cfg80211_unlink !!\n");
+			}
+
 			eth_zero_addr(mac->bssid);
 			mac->vendor = PEER_UNKNOWN;
 			mac->mode = 0;