Commit 1b050d97 authored by Soontak Lee's avatar Soontak Lee Committed by Kalle Valo

brcmfmac: Fix for wrong disconnection event source information

Current brcmf_link_down() always call cfg80211_disconnected() with
locally_generated=1, which is not always the case. Add event source
argument on link down handler and set locally_generated based on the
real trigger.
Signed-off-by: default avatarSoontak Lee <soontak.lee@cypress.com>
Signed-off-by: default avatarChi-Hsien Lin <chi-hsien.lin@cypress.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200618160739.21457-3-chi-hsien.lin@cypress.com
parent d9429d03
...@@ -1387,7 +1387,8 @@ static int brcmf_set_sae_password(struct brcmf_if *ifp, const u8 *pwd_data, ...@@ -1387,7 +1387,8 @@ static int brcmf_set_sae_password(struct brcmf_if *ifp, const u8 *pwd_data,
return err; return err;
} }
static void brcmf_link_down(struct brcmf_cfg80211_vif *vif, u16 reason) static void brcmf_link_down(struct brcmf_cfg80211_vif *vif, u16 reason,
bool locally_generated)
{ {
struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(vif->wdev.wiphy); struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(vif->wdev.wiphy);
struct brcmf_pub *drvr = cfg->pub; struct brcmf_pub *drvr = cfg->pub;
...@@ -1409,7 +1410,7 @@ static void brcmf_link_down(struct brcmf_cfg80211_vif *vif, u16 reason) ...@@ -1409,7 +1410,7 @@ static void brcmf_link_down(struct brcmf_cfg80211_vif *vif, u16 reason)
if ((vif->wdev.iftype == NL80211_IFTYPE_STATION) || if ((vif->wdev.iftype == NL80211_IFTYPE_STATION) ||
(vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT)) (vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT))
cfg80211_disconnected(vif->wdev.netdev, reason, NULL, 0, cfg80211_disconnected(vif->wdev.netdev, reason, NULL, 0,
true, GFP_KERNEL); locally_generated, GFP_KERNEL);
} }
clear_bit(BRCMF_VIF_STATUS_CONNECTING, &vif->sme_state); clear_bit(BRCMF_VIF_STATUS_CONNECTING, &vif->sme_state);
clear_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status); clear_bit(BRCMF_SCAN_STATUS_SUPPRESS, &cfg->scan_status);
...@@ -1588,7 +1589,7 @@ brcmf_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *ndev) ...@@ -1588,7 +1589,7 @@ brcmf_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *ndev)
return 0; return 0;
} }
brcmf_link_down(ifp->vif, WLAN_REASON_DEAUTH_LEAVING); brcmf_link_down(ifp->vif, WLAN_REASON_DEAUTH_LEAVING, true);
brcmf_net_setcarrier(ifp, false); brcmf_net_setcarrier(ifp, false);
brcmf_dbg(TRACE, "Exit\n"); brcmf_dbg(TRACE, "Exit\n");
...@@ -3907,7 +3908,7 @@ static s32 brcmf_cfg80211_suspend(struct wiphy *wiphy, ...@@ -3907,7 +3908,7 @@ static s32 brcmf_cfg80211_suspend(struct wiphy *wiphy,
* disassociate from AP to save power while system is * disassociate from AP to save power while system is
* in suspended state * in suspended state
*/ */
brcmf_link_down(vif, WLAN_REASON_UNSPECIFIED); brcmf_link_down(vif, WLAN_REASON_UNSPECIFIED, true);
/* Make sure WPA_Supplicant receives all the event /* Make sure WPA_Supplicant receives all the event
* generated due to DISASSOC call to the fw to keep * generated due to DISASSOC call to the fw to keep
* the state fw and WPA_Supplicant state consistent * the state fw and WPA_Supplicant state consistent
...@@ -6029,7 +6030,11 @@ brcmf_notify_connect_status(struct brcmf_if *ifp, ...@@ -6029,7 +6030,11 @@ brcmf_notify_connect_status(struct brcmf_if *ifp,
if (!brcmf_is_ibssmode(ifp->vif)) { if (!brcmf_is_ibssmode(ifp->vif)) {
brcmf_bss_connect_done(cfg, ndev, e, false); brcmf_bss_connect_done(cfg, ndev, e, false);
brcmf_link_down(ifp->vif, brcmf_link_down(ifp->vif,
brcmf_map_fw_linkdown_reason(e)); brcmf_map_fw_linkdown_reason(e),
e->event_code &
(BRCMF_E_DEAUTH_IND |
BRCMF_E_DISASSOC_IND)
? false : true);
brcmf_init_prof(ndev_to_prof(ndev)); brcmf_init_prof(ndev_to_prof(ndev));
if (ndev != cfg_to_ndev(cfg)) if (ndev != cfg_to_ndev(cfg))
complete(&cfg->vif_disabled); complete(&cfg->vif_disabled);
...@@ -7182,7 +7187,7 @@ static s32 __brcmf_cfg80211_down(struct brcmf_if *ifp) ...@@ -7182,7 +7187,7 @@ static s32 __brcmf_cfg80211_down(struct brcmf_if *ifp)
* from AP to save power * from AP to save power
*/ */
if (check_vif_up(ifp->vif)) { if (check_vif_up(ifp->vif)) {
brcmf_link_down(ifp->vif, WLAN_REASON_UNSPECIFIED); brcmf_link_down(ifp->vif, WLAN_REASON_UNSPECIFIED, true);
/* Make sure WPA_Supplicant receives all the event /* Make sure WPA_Supplicant receives all the event
generated due to DISASSOC call to the fw to keep generated due to DISASSOC call to the fw to keep
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment