diff mbox series

mac80211: Fixed a bug: STA disconnects frequently

Message ID A19B14FA-9AD8-4E33-A1C9-2202F2097D11@abv.bg
State New
Headers show
Series mac80211: Fixed a bug: STA disconnects frequently | expand

Commit Message

Georgi Valkov Sept. 21, 2020, 8:45 a.m. UTC
Hi Felix!

Please revise your patch:
package/kernel/mac80211/patches/subsys/321-mac80211-optimize-station-connection-monitor.patch

net/mac80211/mlme.c
Function  ieee80211_sta_tx_notify should check and reset  sdata->u.mgd.probe_send_count = 0, when  ack is  true, before calling  ieee80211_queue_work.
Otherwise the counter accumulates over time and the STA will eventually disconnect periodically.

Test conditions:
STA (WDS): TL-WR1043ND v4 - fixing the STA firmware resolves the issue
AP (WDS): WRT3200ACM - AP is not affected
PC wired to AP: ping -t sta-ip-address - indicate lost packets

Log:
[ 1516.144323] br-lan: port 3(wifi) entered disabled state
[ 1516.149836] br-lan: topology change detected, propagating
[ 1517.097423] wifi: authenticate with 60:38:e0:xx:xx:xx
[ 1517.116774] wifi: send auth to 60:38:e0:xx:xx:xx (try 1/3)
[ 1517.159748] wifi: authenticated
[ 1517.167704] wifi: associate with 60:38:e0:xx:xx:xx (try 1/3)
[ 1517.191637] wifi: RX AssocResp from 60:38:e0:xx:xx:xx (capab=0x431 status=0 aid=1)
[ 1517.199819] wifi: associated
[ 1517.213115] br-lan: port 3(wifi) entered blocking state
[ 1517.218579] br-lan: port 3(wifi) entered listening state
[ 1519.121477] br-lan: port 3(wifi) entered disabled state
[ 1519.126978] br-lan: topology change detected, propagating
[ 1520.075548] wifi: authenticate with 60:38:e0:xx:xx:xx
[ 1520.094883] wifi: send auth to 60:38:e0:xx:xx:xx (try 1/3)
[ 1520.128702] wifi: authenticated
[ 1520.133053] wifi: associate with 60:38:e0:xx:xx:xx (try 1/3)
[ 1520.157807] wifi: RX AssocResp from 60:38:e0:xx:xx:xx (capab=0x431 status=0 aid=1)
[ 1520.165962] wifi: associated
[ 1520.176668] br-lan: port 3(wifi) entered blocking state
[ 1520.182136] br-lan: port 3(wifi) entered listening state
[ 1522.217602] br-lan: port 3(wifi) entered learning state

Pull request with fix:
https://github.com/openwrt/openwrt/pull/3443

Please grant me write access to OpenWRT, so I can contribute other important fixes in the future, such as:
https://github.com/openwrt/openwrt/pull/3391


From 174bc62cf9157e06f6625ca68bb562c8c0a9ad32 Mon Sep 17 00:00:00 2001
From: Georgi Valkov <gvalkov@abv.bg>
Date: Sun, 20 Sep 2020 18:55:56 +0300
Subject: [PATCH] mac80211: Fixed a bug: STA disconnects frequently, because
 probe_send_count was not reset when ACK is received. Introduced in
 317-mac80211-optimize-station-connection-monitor.patch

Signed-off-by: Georgi Valkov <gvalkov@abv.bg>
---
 ...-optimize-station-connection-monitor.patch | 31 +++++++++----------
 1 file changed, 14 insertions(+), 17 deletions(-)

Comments

Chuanhong Guo Sept. 21, 2020, 10:43 a.m. UTC | #1
Hi!

On Mon, Sep 21, 2020 at 4:49 PM Georgi Valkov <gvalkov@abv.bg> wrote:
> Please grant me write access to OpenWRT, so I can contribute other important fixes in the future, such as:
> https://github.com/openwrt/openwrt/pull/3391

That's totally not how the development of OpenWrt works. Please
take your time to read OpenWrt contribution guidelines [0]
and fix all the formal issues first.

[0] https://openwrt.org/submitting-patches
diff mbox series

Patch

diff --git a/package/kernel/mac80211/patches/subsys/321-mac80211-optimize-station-connection-monitor.patch b/package/kernel/mac80211/patches/subsys/321-mac80211-optimize-station-connection-monitor.patch
index ed9efb2b0d..bbf5ed0d35 100644
--- a/package/kernel/mac80211/patches/subsys/321-mac80211-optimize-station-connection-monitor.patch
+++ b/package/kernel/mac80211/patches/subsys/321-mac80211-optimize-station-connection-monitor.patch
@@ -46,34 +46,31 @@  Signed-off-by: Felix Fietkau <nbd@nbd.name>
  static void ieee80211_reset_ap_probe(struct ieee80211_sub_if_data *sdata)
  {
  	struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
-@@ -2521,21 +2504,13 @@ void ieee80211_sta_tx_notify(struct ieee
+@@ -2521,13 +2504,10 @@ void ieee80211_sta_tx_notify(struct ieee
  {
  	ieee80211_sta_tx_wmm_ac_notify(sdata, hdr, tx_time);
  
 -	if (!ieee80211_is_data(hdr->frame_control))
 -	    return;
 -
--	if (ieee80211_is_any_nullfunc(hdr->frame_control) &&
--	    sdata->u.mgd.probe_send_count > 0) {
--		if (ack)
+ 	if (ieee80211_is_any_nullfunc(hdr->frame_control) &&
+ 	    sdata->u.mgd.probe_send_count > 0) {
+ 		if (ack)
 -			ieee80211_sta_reset_conn_monitor(sdata);
--		else
--			sdata->u.mgd.nullfunc_failed = true;
--		ieee80211_queue_work(&sdata->local->hw, &sdata->work);
-+	if (!ieee80211_is_any_nullfunc(hdr->frame_control) ||
-+	    !sdata->u.mgd.probe_send_count)
- 		return;
--	}
++			sdata->u.mgd.probe_send_count = 0;
+ 		else
+ 			sdata->u.mgd.nullfunc_failed = true;
+ 		ieee80211_queue_work(&sdata->local->hw, &sdata->work);
+@@ -2535,7 +2515,7 @@ void ieee80211_sta_tx_notify(struct ieee
+ 	}
  
--	if (ack)
+ 	if (ack)
 -		ieee80211_sta_reset_conn_monitor(sdata);
-+	if (!ack)
-+		sdata->u.mgd.nullfunc_failed = true;
-+	ieee80211_queue_work(&sdata->local->hw, &sdata->work);
++		sdata->u.mgd.probe_send_count = 0;
  }
  
  static void ieee80211_mlme_send_probe_req(struct ieee80211_sub_if_data *sdata,
-@@ -3600,8 +3575,8 @@ static bool ieee80211_assoc_success(stru
+@@ -3600,8 +3580,8 @@ static bool ieee80211_assoc_success(stru
  	 * Start timer to probe the connection to the AP now.
  	 * Also start the timer that will detect beacon loss.
  	 */
@@ -83,7 +80,7 @@  Signed-off-by: Felix Fietkau <nbd@nbd.name>
  
  	ret = true;
   out:
-@@ -4569,10 +4544,26 @@ static void ieee80211_sta_conn_mon_timer
+@@ -4569,10 +4549,26 @@ static void ieee80211_sta_conn_mon_timer
  		from_timer(sdata, t, u.mgd.conn_mon_timer);
  	struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
  	struct ieee80211_local *local = sdata->local;