Index | Thread | Search

From:
Avon Robertson <avon.r@xtra.co.nz>
Subject:
Re: iwn/iwm/iwx: fix ifmedia IFM_AUTO check
To:
Stefan Sperling <stsp@stsp.name>
Cc:
tech@openbsd.org
Date:
Sat, 17 Feb 2024 17:12:07 +1300

Download raw body.

Thread
On Thu, Feb 15, 2024 at 04:48:52PM +0100, Stefan Sperling wrote:
> These drivers are using the wrong IFM_ macro check for IFM_AUTO.
> 
> I am a bit swamped right now and would appreciate help with tests
> on iwn/iwm/iwx. Nothing should change or break.
> 
> diff /usr/src
> commit - d76fc145fd1843e077ff55bc476a2b23592607fe
> path + /usr/src
> blob - f0977cd84e8a242c89edc4110e30e3b8db3cd310
> file + sys/dev/pci/if_iwm.c
> --- sys/dev/pci/if_iwm.c
> +++ sys/dev/pci/if_iwm.c
> @@ -8534,7 +8534,7 @@ iwm_scan(struct iwm_softc *sc)
>  	 * The current mode might have been fixed during association.
>  	 * Ensure all channels get scanned.
>  	 */
> -	if (IFM_MODE(ic->ic_media.ifm_cur->ifm_media) == IFM_AUTO)
> +	if (IFM_SUBTYPE(ic->ic_media.ifm_cur->ifm_media) == IFM_AUTO)
>  		ieee80211_setmode(ic, IEEE80211_MODE_AUTO);
>  
>  	sc->sc_flags |= IWM_FLAG_SCANNING;
> blob - 69ecb242154be09f6ea83656d6e30170703bfd2b
> file + sys/dev/pci/if_iwn.c
> --- sys/dev/pci/if_iwn.c
> +++ sys/dev/pci/if_iwn.c
> @@ -5359,7 +5359,7 @@ iwn_scan(struct iwn_softc *sc, uint16_t flags, int bgs
>  		 * The current mode might have been fixed during association.
>  		 * Ensure all channels get scanned.
>  		 */
> -		if (IFM_MODE(ic->ic_media.ifm_cur->ifm_media) == IFM_AUTO)
> +		if (IFM_SUBTYPE(ic->ic_media.ifm_cur->ifm_media) == IFM_AUTO)
>  			ieee80211_setmode(ic, IEEE80211_MODE_AUTO);
>  
>  		sc->sc_flags |= IWN_FLAG_SCANNING;
> blob - 4b945edf2c73c6e2582819b283277baff81a6586
> file + sys/dev/pci/if_iwx.c
> --- sys/dev/pci/if_iwx.c
> +++ sys/dev/pci/if_iwx.c
> @@ -7529,7 +7529,7 @@ iwx_scan(struct iwx_softc *sc)
>  	 * The current mode might have been fixed during association.
>  	 * Ensure all channels get scanned.
>  	 */
> -	if (IFM_MODE(ic->ic_media.ifm_cur->ifm_media) == IFM_AUTO)
> +	if (IFM_SUBTYPE(ic->ic_media.ifm_cur->ifm_media) == IFM_AUTO)
>  		ieee80211_setmode(ic, IEEE80211_MODE_AUTO);
>  
>  	sc->sc_flags |= IWX_FLAG_SCANNING;
> 

Performed basic tests with lynx and firefox before and after applying
your diff and building a new kernel. Noticed no diffenence on this
Dell M6600 laptop.  The before and after output from:

$ dmesg | grep -e iwn0
iwn0 at pci3 dev 0 function 0 "Intel Centrino Ultimate-N 6300 rev 0x35, msi, MIMO 3T3R, MoW, address 24:77:03:07:03:10

was identical, as was the output from,

$ ifconfig iwn0.

HTH

-- 
aer