Skip to contentSkip to conversation

wcn36xx: disconnect timeout

PATCH In review Eduardo Abinader 2 participants 3 messages Dec 5, 2019 – Dec 17, 2019 2 messages not in the archive Qualcomm WCN36XX wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wcn36xx: disconnect timeout

Whenever the signal stregth decays smoothly and physical connnection is already gone and no deauth has arrived, the qcom soc is not able to indicate neither WCN36XX_HAL_MISSED_BEACON_IND nor WCN36XX_HAL_MISSED_BEACON_IND. It was noticed that such situation gets even more reproducible, when the driver fails to enter bmps mode - which is highly likely to occur. Thus, in order to provide proper disconnection of the connected STA, a disconnection timeout based on last time seen bss beacon is here given.

---
 drivers/net/wireless/ath/wcn36xx/txrx.c    | 34 ++++++++++++++++++++++
 drivers/net/wireless/ath/wcn36xx/txrx.h    |  2 ++
 drivers/net/wireless/ath/wcn36xx/wcn36xx.h |  2 ++
 3 files changed, 38 insertions(+)
drivers/net/wireless/ath/wcn36xx/txrx.c +34 -0
index a6902371e89c..98155b2115e0 100644
@@ -23,11 +23,30 @@ static inline int get_rssi0(struct wcn36xx_rx_bd *bd)
 	return 100 - ((bd->phy_stat0 >> 24) & 0xff);
 }
 
+static inline void rx_check(struct timer_list *t) {
+	struct wcn36xx *wcn = from_timer(wcn, t, rx_timer);
+	struct ieee80211_vif *vif = NULL;
+	struct wcn36xx_vif *tmp;
+
+	list_for_each_entry(tmp, &wcn->vif_list, list) {
+			vif = wcn36xx_priv_to_vif(tmp);
+			if (vif && vif->bss_conf.assoc) {
+				wcn36xx_warn("no beacons seen - disconnect timeout\n");
+
+				ieee80211_connection_loss(vif);
+				del_timer(&wcn->rx_timer);
+				wcn->rx_timer.function = NULL;
+			}
+	}
+}
+
 int wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buff *skb)
 {
 	struct ieee80211_rx_status status;
 	struct ieee80211_hdr *hdr;
 	struct wcn36xx_rx_bd *bd;
+	struct ieee80211_vif *vif = NULL;
+	struct wcn36xx_vif *tmp;
 	u16 fc, sn;
 
 	/*
@@ -77,6 +96,21 @@ int wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buff *skb)
 			    skb, skb->len, fc, sn);
 		wcn36xx_dbg_dump(WCN36XX_DBG_BEACON_DUMP, "SKB <<< ",
 				 (char *)skb->data, skb->len);
+
+		list_for_each_entry(tmp, &wcn->vif_list, list) {
+			vif = wcn36xx_priv_to_vif(tmp);
+			if (vif && vif->bss_conf.assoc &&
+				ether_addr_equal(hdr->addr2, vif->bss_conf.bssid)) {
+					del_timer(&wcn->rx_timer);
+					wcn->rx_timer.function = NULL;
+
+					wcn->rx_timer.expires = jiffies +
+											msecs_to_jiffies(RX_TIMEOUT);
+					timer_setup(&wcn->rx_timer, rx_check, 0);
+					add_timer(&wcn->rx_timer);
+				}
+		}
+
 	} else {
 		wcn36xx_dbg(WCN36XX_DBG_RX, "rx skb %p len %d fc %04x sn %d\n",
 			    skb, skb->len, fc, sn);
drivers/net/wireless/ath/wcn36xx/txrx.h +2 -0
index 032216e82b2b..f6b07cba165a 100644
@@ -32,6 +32,8 @@
 #define WCN36XX_BD_RATE_MGMT 2
 #define WCN36XX_BD_RATE_CTRL 3
 
+#define RX_TIMEOUT 30000
+
 enum wcn36xx_txbd_ssn_type {
 	WCN36XX_TXBD_SSN_FILL_HOST = 0,
 	WCN36XX_TXBD_SSN_FILL_DPU_NON_QOS = 1,
drivers/net/wireless/ath/wcn36xx/wcn36xx.h +2 -0
index a58f313983b9..a9cfb817fab7 100644
@@ -254,6 +254,8 @@ struct wcn36xx {
 	struct wcn36xx_dfs_entry    dfs;
 #endif /* CONFIG_WCN36XX_DEBUGFS */
 
+	struct timer_list rx_timer;
+
 };
 
 static inline bool wcn36xx_is_fw_version(struct wcn36xx *wcn,
Signature · 1 line
2.20.1
#1 lore raw
Quoted 10 lines · Eduardo Abinader

Whenever the signal stregth decays smoothly and physical connnection is already gone and no deauth has arrived, the qcom soc is not able to indicate neither WCN36XX_HAL_MISSED_BEACON_IND nor WCN36XX_HAL_MISSED_BEACON_IND. It was noticed that such situation gets even more reproducible, when the driver fails to enter bmps mode - which is highly likely to occur. Thus, in order to provide proper disconnection of the connected STA, a disconnection timeout based on last time seen bss beacon is here given.

Wouldn't it be better to disable IEEE80211_HW_CONNECTION_MONITOR and let mac80211 handle it entirely?

Signature · 1 line
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

A message that is not in the archive (sent off-list or not yet received): 0101016ed4f1db3a-e6a9458a-676e-48b1-bf5b-120a4a8d4ab7-000000@us-west-2.amazonses.com

A message that is not in the archive (sent off-list or not yet received): CAGoNHngJQteebGkq2dwofhm819xD9u=zTgFD0xV4WfbgiwR+AQ@mail.gmail.com

#4 lore raw

Thanks for the hint, Kalle.

The disconnection procedure seems more steady by delegating it to mac80211. I'm gonna send a patch with such change then.

Quoted 28 lines · Eduardo Abinader

Thanks for the hint, Kalle.

The disconnection procedure seems more steady by delegating it to mac80211. I'm gonna send a patch with such change then.

Quoted 19 lines · Kalle Valo
Quoted 10 lines · Eduardo Abinader

Whenever the signal stregth decays smoothly and physical connnection is already gone and no deauth has arrived, the qcom soc is not able to indicate neither WCN36XX_HAL_MISSED_BEACON_IND nor WCN36XX_HAL_MISSED_BEACON_IND. It was noticed that such situation gets even more reproducible, when the driver fails to enter bmps mode - which is highly likely to occur. Thus, in order to provide proper disconnection of the connected STA, a disconnection timeout based on last time seen bss beacon is here given.

Wouldn't it be better to disable IEEE80211_HW_CONNECTION_MONITOR and let mac80211 handle it entirely?

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