On Tue, Apr 07, 2020 at 01:42:48PM +0200, Stefan Sperling wrote:
> I've noticed that wireless interfaces in 11n mode show a "media:" line
> in ifconfig such as this while a background scan is in progress:
> 
>  media: IEEE802.11 autoselect (OFDM6)
> 
> What is expected is a line showing active 11n mode, such as:
> 
>  media: IEEE802.11 autoselect (HT-MCS0 mode 11n)
> 
> This happens because ieee80211_media_status() sees ic->ic_curmode as
> AUTO during background scans. Also, because net80211 forgets to reset
> ic_curmode back to MODE_11N when the background scan has finished, the
> displayed mode remains "autoselect (OFDM6)" until the interface is reset.
> 
> This is just a cosmetic issue.
> Internally, the interface operates in 11n mode regardless.
> 
> ok?

OK

> 
> diff 5e4be56314753be1a3ad288aa6b16bcb5257b37c /usr/src
> blob - 410c33358e72c4063f9f71bf69f6c72ecfc558d9
> file + sys/net80211/ieee80211.c
> --- sys/net80211/ieee80211.c
> +++ sys/net80211/ieee80211.c
> @@ -728,6 +728,9 @@ ieee80211_media_status(struct ifnet *ifp, struct ifmed
>                   ic->ic_curmode == IEEE80211_MODE_11AC)
>                       imr->ifm_active |= ieee80211_mcs2media(ic,
>                               ni->ni_txmcs, ic->ic_curmode);
> +             else if (ni->ni_flags & IEEE80211_NODE_HT) /* in MODE_AUTO */
> +                     imr->ifm_active |= ieee80211_mcs2media(ic,
> +                             ni->ni_txmcs, IEEE80211_MODE_11N);
>               else
>                       /* calculate rate subtype */
>                       imr->ifm_active |= ieee80211_rate2media(ic,
> blob - 6656d29d160c26dce86fb44e3f5e715e42b7c42c
> file + sys/net80211/ieee80211_node.c
> --- sys/net80211/ieee80211_node.c
> +++ sys/net80211/ieee80211_node.c
> @@ -1441,6 +1441,19 @@ ieee80211_end_scan(struct ifnet *ifp)
>                                       ic->ic_bgscan_fail *= 2;
>                       }
>                       ic->ic_flags &= ~IEEE80211_F_BGSCAN;
> +
> +                     /*
> +                      * HT is negotiated during association so we must use
> +                      * ic_bss to check HT. The nodes tree was re-populated
> +                      * during background scan and therefore selbs and curbs
> +                      * may not carry HT information.
> +                      */
> +                     ni = ic->ic_bss;
> +                     if (ni->ni_flags & IEEE80211_NODE_HT)
> +                             ieee80211_setmode(ic, IEEE80211_MODE_11N);
> +                     else
> +                             ieee80211_setmode(ic,
> +                                 ieee80211_chan2mode(ic, ni->ni_chan));
>                       return;
>               }
>       

Reply via email to