All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] wcn36xx: handle connection loss indication
@ 2021-09-01 18:06 Benjamin Li
  2021-09-02 16:37 ` Kalle Valo
  2021-09-21 13:31 ` Kalle Valo
  0 siblings, 2 replies; 4+ messages in thread
From: Benjamin Li @ 2021-09-01 18:06 UTC (permalink / raw)
  To: Kalle Valo
  Cc: Bryan O'Donoghue, Loic Poulain, Benjamin Li, stable,
	David S. Miller, Jakub Kicinski, wcn36xx, linux-wireless, netdev,
	linux-kernel

Firmware sends delete_sta_context_ind when it detects the AP has gone
away in STA mode. Right now the handler for that indication only handles
AP mode; fix it to also handle STA mode.

Cc: stable@vger.kernel.org
Signed-off-by: Benjamin Li <benl@squareup.com>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Loic Poulain <loic.poulain@linaro.org>
---
 drivers/net/wireless/ath/wcn36xx/smd.c | 44 +++++++++++++++++++-------
 1 file changed, 33 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c
index 57fa857b290b..f6bea896abe8 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -2623,30 +2623,52 @@ static int wcn36xx_smd_delete_sta_context_ind(struct wcn36xx *wcn,
 					      size_t len)
 {
 	struct wcn36xx_hal_delete_sta_context_ind_msg *rsp = buf;
-	struct wcn36xx_vif *tmp;
+	struct wcn36xx_vif *vif_priv;
+	struct ieee80211_vif *vif;
+	struct ieee80211_bss_conf *bss_conf;
 	struct ieee80211_sta *sta;
+	bool found = false;
 
 	if (len != sizeof(*rsp)) {
 		wcn36xx_warn("Corrupted delete sta indication\n");
 		return -EIO;
 	}
 
-	wcn36xx_dbg(WCN36XX_DBG_HAL, "delete station indication %pM index %d\n",
-		    rsp->addr2, rsp->sta_id);
+	wcn36xx_dbg(WCN36XX_DBG_HAL,
+		    "delete station indication %pM index %d reason %d\n",
+		    rsp->addr2, rsp->sta_id, rsp->reason_code);
 
-	list_for_each_entry(tmp, &wcn->vif_list, list) {
+	list_for_each_entry(vif_priv, &wcn->vif_list, list) {
 		rcu_read_lock();
-		sta = ieee80211_find_sta(wcn36xx_priv_to_vif(tmp), rsp->addr2);
-		if (sta)
-			ieee80211_report_low_ack(sta, 0);
+		vif = wcn36xx_priv_to_vif(vif_priv);
+
+		if (vif->type == NL80211_IFTYPE_STATION) {
+			/* We could call ieee80211_find_sta too, but checking
+			 * bss_conf is clearer.
+			 */
+			bss_conf = &vif->bss_conf;
+			if (vif_priv->sta_assoc &&
+			    !memcmp(bss_conf->bssid, rsp->addr2, ETH_ALEN)) {
+				found = true;
+				wcn36xx_dbg(WCN36XX_DBG_HAL,
+					    "connection loss bss_index %d\n",
+					    vif_priv->bss_index);
+				ieee80211_connection_loss(vif);
+			}
+		} else {
+			sta = ieee80211_find_sta(vif, rsp->addr2);
+			if (sta) {
+				found = true;
+				ieee80211_report_low_ack(sta, 0);
+			}
+		}
+
 		rcu_read_unlock();
-		if (sta)
+		if (found)
 			return 0;
 	}
 
-	wcn36xx_warn("STA with addr %pM and index %d not found\n",
-		     rsp->addr2,
-		     rsp->sta_id);
+	wcn36xx_warn("BSS or STA with addr %pM not found\n", rsp->addr2);
 	return -ENOENT;
 }
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] wcn36xx: handle connection loss indication
  2021-09-01 18:06 [PATCH v2] wcn36xx: handle connection loss indication Benjamin Li
@ 2021-09-02 16:37 ` Kalle Valo
  2021-09-02 18:37   ` Benjamin Li
  2021-09-21 13:31 ` Kalle Valo
  1 sibling, 1 reply; 4+ messages in thread
From: Kalle Valo @ 2021-09-02 16:37 UTC (permalink / raw)
  To: Benjamin Li
  Cc: Bryan O'Donoghue, Loic Poulain, stable, David S. Miller,
	Jakub Kicinski, wcn36xx, linux-wireless, netdev, linux-kernel

Benjamin Li <benl@squareup.com> writes:

> Firmware sends delete_sta_context_ind when it detects the AP has gone
> away in STA mode. Right now the handler for that indication only handles
> AP mode; fix it to also handle STA mode.
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Benjamin Li <benl@squareup.com>
> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> Reviewed-by: Loic Poulain <loic.poulain@linaro.org>

How well is this tested? I'm pondering should I queue this to v5.15 or
v5.16, at the moment I'm leaning towards v5.16.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] wcn36xx: handle connection loss indication
  2021-09-02 16:37 ` Kalle Valo
@ 2021-09-02 18:37   ` Benjamin Li
  0 siblings, 0 replies; 4+ messages in thread
From: Benjamin Li @ 2021-09-02 18:37 UTC (permalink / raw)
  To: Kalle Valo
  Cc: Bryan O'Donoghue, Loic Poulain, stable, David S. Miller,
	Jakub Kicinski, wcn36xx, linux-wireless, netdev, linux-kernel

On 9/2/21 9:37 AM, Kalle Valo wrote:
> Benjamin Li <benl@squareup.com> writes:
> 
>> Firmware sends delete_sta_context_ind when it detects the AP has gone
>> away in STA mode. Right now the handler for that indication only handles
>> AP mode; fix it to also handle STA mode.
>>
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Benjamin Li <benl@squareup.com>
>> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
>> Reviewed-by: Loic Poulain <loic.poulain@linaro.org>
> 
> How well is this tested? I'm pondering should I queue this to v5.15 or
> v5.16, at the moment I'm leaning towards v5.16.
>
It was an issue reported during internal testing, and the patch has not
yet had soak time with our quality team/field devices. v5.16 sounds fine.

Ben

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] wcn36xx: handle connection loss indication
  2021-09-01 18:06 [PATCH v2] wcn36xx: handle connection loss indication Benjamin Li
  2021-09-02 16:37 ` Kalle Valo
@ 2021-09-21 13:31 ` Kalle Valo
  1 sibling, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2021-09-21 13:31 UTC (permalink / raw)
  To: Benjamin Li
  Cc: Bryan O'Donoghue, Loic Poulain, Benjamin Li, stable,
	David S. Miller, Jakub Kicinski, wcn36xx, linux-wireless, netdev,
	linux-kernel

Benjamin Li <benl@squareup.com> wrote:

> Firmware sends delete_sta_context_ind when it detects the AP has gone
> away in STA mode. Right now the handler for that indication only handles
> AP mode; fix it to also handle STA mode.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Benjamin Li <benl@squareup.com>
> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> Reviewed-by: Loic Poulain <loic.poulain@linaro.org>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

Patch applied to ath-next branch of ath.git, thanks.

d6dbce453b19 wcn36xx: handle connection loss indication

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20210901180606.11686-1-benl@squareup.com/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-09-21 13:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-01 18:06 [PATCH v2] wcn36xx: handle connection loss indication Benjamin Li
2021-09-02 16:37 ` Kalle Valo
2021-09-02 18:37   ` Benjamin Li
2021-09-21 13:31 ` Kalle Valo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.