From 319c954fc71d5c725e818226f8ba31bb70f24bd0 Mon Sep 17 00:00:00 2001 From: Gokul Sivakumar Date: Wed, 15 Nov 2023 23:55:46 -0600 Subject: [PATCH 191/296] brcmfmac: TWT: cleanup stale session entries after receiving Deauth from AP Firmware sends TWT Setup & Teardown MAC events to Driver on the completion of the Session Setup & Teardown tasks. On receiving these events, driver updates its state machine. If the disconnection is initiated locally, the session cleanup is handled implicitly. However when the Deauth is initiated by the AP, the firmware silently tears down the TWT session and disconnects without sending the TWT Teardown event to Driver. And the driver continues to maintain the stale TWT sessions. Later if the user attempts to initiate a TWT session with the same Flow ID in the stale entry, the request gets rejected. To avoid this, handle this corner case and cleanup the stale TWT sessions while bringing down the STA interface after handling Deauth. Signed-off-by: Gokul Sivakumar --- .../wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c index b05cf6e6aefc..d0a76ea428f7 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c @@ -1994,9 +1994,15 @@ static void brcmf_link_down(struct brcmf_cfg80211_vif *vif, u16 reason, brcmf_dbg(INFO, "Call WLC_DISASSOC to stop excess roaming\n"); err = brcmf_fil_cmd_data_set(vif->ifp, BRCMF_C_DISASSOC, NULL, 0); - if (err) + if (err) { bphy_err(drvr, "WLC_DISASSOC failed (%d)\n", - err); + err); + } else { + if (brcmf_feat_is_enabled(vif->ifp, BRCMF_FEAT_TWT)) { + /* Cleanup TWT Session list */ + brcmf_twt_cleanup_sessions(vif->ifp); + } + } } if ((vif->wdev.iftype == NL80211_IFTYPE_STATION) || -- 2.25.1