net80211: increase background scan backoff timer

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

net80211: increase background scan backoff timer

Stefan Sperling-5
Frequent background scans are known to cause packet loss with
some types of APs (e.g. old Apple APs and some Android phones).

There is already a heuristic to make bgscans less frequent if we
keep choosing the same AP. However, the current backoff interval
keeps increasing in tiny steps of 500ms, so problems caused by
background scans remain noticable for some time after association
to a problematic AP.

This diff increases the hgscan backoff timer such that the interval
keeps doubling each time we choose the same AP again. I hope this will
help in situations where a single AP is used and frequent bgscans are
causing trouble.
 
diff e17574f85785da4fa4073c8b9a00d8d738f3298f c6d97512c3c477464b2407c31d85add72ed1df9f
blob - 313d7249f09646a2eeabc21e9e760c9debcdf790
blob + dde43eda321beaa949255c143b249339c39f027c
--- sys/net80211/ieee80211_node.c
+++ sys/net80211/ieee80211_node.c
@@ -1421,8 +1421,12 @@ ieee80211_end_scan(struct ifnet *ifp)
  * and make background scans less frequent.
  */
  if (selbs == curbs) {
- if (ic->ic_bgscan_fail < IEEE80211_BGSCAN_FAIL_MAX)
- ic->ic_bgscan_fail++;
+ if (ic->ic_bgscan_fail < IEEE80211_BGSCAN_FAIL_MAX) {
+ if (ic->ic_bgscan_fail <= 0)
+ ic->ic_bgscan_fail = 1;
+ else
+ ic->ic_bgscan_fail *= 2;
+ }
  ic->ic_flags &= ~IEEE80211_F_BGSCAN;
  return;
  }
blob - 0f2072288232ac276c2979b799b03c37e0ca8032
blob + b475001b14ddb11c5c1713d072358ef2b9e2736d
--- sys/net80211/ieee80211_var.h
+++ sys/net80211/ieee80211_var.h
@@ -62,7 +62,7 @@
 #define IEEE80211_RSSI_THRES_RATIO_2GHZ 60 /* in percent */
 #define IEEE80211_RSSI_THRES_RATIO_5GHZ 50 /* in percent */
 
-#define IEEE80211_BGSCAN_FAIL_MAX 360 /* units of 500 msec */
+#define IEEE80211_BGSCAN_FAIL_MAX 512 /* units of 500 msec */
 
 enum ieee80211_phytype {
  IEEE80211_T_DS, /* direct sequence spread spectrum */

Reply | Threaded
Open this post in threaded view
|

Re: net80211: increase background scan backoff timer

Stefan Sperling-5
Is anyone running this already? OK?

On Mon, Oct 07, 2019 at 04:41:37PM +0200, Stefan Sperling wrote:

> Frequent background scans are known to cause packet loss with
> some types of APs (e.g. old Apple APs and some Android phones).
>
> There is already a heuristic to make bgscans less frequent if we
> keep choosing the same AP. However, the current backoff interval
> keeps increasing in tiny steps of 500ms, so problems caused by
> background scans remain noticable for some time after association
> to a problematic AP.
>
> This diff increases the hgscan backoff timer such that the interval
> keeps doubling each time we choose the same AP again. I hope this will
> help in situations where a single AP is used and frequent bgscans are
> causing trouble.
>  
> diff e17574f85785da4fa4073c8b9a00d8d738f3298f c6d97512c3c477464b2407c31d85add72ed1df9f
> blob - 313d7249f09646a2eeabc21e9e760c9debcdf790
> blob + dde43eda321beaa949255c143b249339c39f027c
> --- sys/net80211/ieee80211_node.c
> +++ sys/net80211/ieee80211_node.c
> @@ -1421,8 +1421,12 @@ ieee80211_end_scan(struct ifnet *ifp)
>   * and make background scans less frequent.
>   */
>   if (selbs == curbs) {
> - if (ic->ic_bgscan_fail < IEEE80211_BGSCAN_FAIL_MAX)
> - ic->ic_bgscan_fail++;
> + if (ic->ic_bgscan_fail < IEEE80211_BGSCAN_FAIL_MAX) {
> + if (ic->ic_bgscan_fail <= 0)
> + ic->ic_bgscan_fail = 1;
> + else
> + ic->ic_bgscan_fail *= 2;
> + }
>   ic->ic_flags &= ~IEEE80211_F_BGSCAN;
>   return;
>   }
> blob - 0f2072288232ac276c2979b799b03c37e0ca8032
> blob + b475001b14ddb11c5c1713d072358ef2b9e2736d
> --- sys/net80211/ieee80211_var.h
> +++ sys/net80211/ieee80211_var.h
> @@ -62,7 +62,7 @@
>  #define IEEE80211_RSSI_THRES_RATIO_2GHZ 60 /* in percent */
>  #define IEEE80211_RSSI_THRES_RATIO_5GHZ 50 /* in percent */
>  
> -#define IEEE80211_BGSCAN_FAIL_MAX 360 /* units of 500 msec */
> +#define IEEE80211_BGSCAN_FAIL_MAX 512 /* units of 500 msec */
>  
>  enum ieee80211_phytype {
>   IEEE80211_T_DS, /* direct sequence spread spectrum */
>

Reply | Threaded
Open this post in threaded view
|

Re: net80211: increase background scan backoff timer

Jan Klemkow
On Mon, Oct 14, 2019 at 02:22:24PM +0200, Stefan Sperling wrote:
> Is anyone running this already? OK?

I run the diff without any noticeable problems.
Run this with iwm and wpa-enterprise.

iwm0 at pci1 dev 0 function 0 "Intel Dual Band Wireless-AC 8265" rev 0x78, msi

Seems to work for me.

bye,
Jan

> On Mon, Oct 07, 2019 at 04:41:37PM +0200, Stefan Sperling wrote:
> > Frequent background scans are known to cause packet loss with
> > some types of APs (e.g. old Apple APs and some Android phones).
> >
> > There is already a heuristic to make bgscans less frequent if we
> > keep choosing the same AP. However, the current backoff interval
> > keeps increasing in tiny steps of 500ms, so problems caused by
> > background scans remain noticable for some time after association
> > to a problematic AP.
> >
> > This diff increases the hgscan backoff timer such that the interval
> > keeps doubling each time we choose the same AP again. I hope this will
> > help in situations where a single AP is used and frequent bgscans are
> > causing trouble.
> >  
> > diff e17574f85785da4fa4073c8b9a00d8d738f3298f c6d97512c3c477464b2407c31d85add72ed1df9f
> > blob - 313d7249f09646a2eeabc21e9e760c9debcdf790
> > blob + dde43eda321beaa949255c143b249339c39f027c
> > --- sys/net80211/ieee80211_node.c
> > +++ sys/net80211/ieee80211_node.c
> > @@ -1421,8 +1421,12 @@ ieee80211_end_scan(struct ifnet *ifp)
> >   * and make background scans less frequent.
> >   */
> >   if (selbs == curbs) {
> > - if (ic->ic_bgscan_fail < IEEE80211_BGSCAN_FAIL_MAX)
> > - ic->ic_bgscan_fail++;
> > + if (ic->ic_bgscan_fail < IEEE80211_BGSCAN_FAIL_MAX) {
> > + if (ic->ic_bgscan_fail <= 0)
> > + ic->ic_bgscan_fail = 1;
> > + else
> > + ic->ic_bgscan_fail *= 2;
> > + }
> >   ic->ic_flags &= ~IEEE80211_F_BGSCAN;
> >   return;
> >   }
> > blob - 0f2072288232ac276c2979b799b03c37e0ca8032
> > blob + b475001b14ddb11c5c1713d072358ef2b9e2736d
> > --- sys/net80211/ieee80211_var.h
> > +++ sys/net80211/ieee80211_var.h
> > @@ -62,7 +62,7 @@
> >  #define IEEE80211_RSSI_THRES_RATIO_2GHZ 60 /* in percent */
> >  #define IEEE80211_RSSI_THRES_RATIO_5GHZ 50 /* in percent */
> >  
> > -#define IEEE80211_BGSCAN_FAIL_MAX 360 /* units of 500 msec */
> > +#define IEEE80211_BGSCAN_FAIL_MAX 512 /* units of 500 msec */
> >  
> >  enum ieee80211_phytype {
> >   IEEE80211_T_DS, /* direct sequence spread spectrum */
> >
>