All of lore.kernel.org
 help / color / mirror / Atom feed
* iwd picking worse network despite better one available
@ 2024-03-27 18:36 Sven-Hendrik Haase
  2024-03-27 18:54 ` James Prestwood
  0 siblings, 1 reply; 6+ messages in thread
From: Sven-Hendrik Haase @ 2024-03-27 18:36 UTC (permalink / raw)
  To: iwd

Hello,

I've spent a good chunk of my evening looking into why iwd doesn't select the network I want it to select. I have a network "Home" with two APs. iwd seems to strongly prefer the AP that is further away and that has worse strength as measured by iwd.

From some testing, I believe it has to do with the AP rather than the wifi adapter. I tested a wifi adapter using mt7921e and one using iwlwifi and the result is the same in both cases. The APs are both pretty modern: The one iwd doesn't like is a FRITZ!Box 7590 AX while the one it likes is a FRITZ!Repeater 6000. From the log it seems that iwd is unable to perform a proper data rate estimation and then falls back to some default. At any rate, the rank would indicate that the estimated data rate plays an important role. If I use the developer mode to force roaming to the AP I want (named "better" in the log) then I'm able to use it perfectly well with a good data rate.

As such I think this is a bug _somewhere_ but I'm not exactly sure where. I searched the configuration options but it seems it's not possible to turn off the data rate estimations for the ranking. I'd be perfectly happy to just go by signal strength. However, I suppose it would be better to actually fix the core problem in iwd.

Log is here:

Mar 27 16:01:55 cypher systemd[1]: Starting Wireless service...
Mar 27 16:01:55 cypher iwd[30930]: Wireless daemon version 2.16
Mar 27 16:01:55 cypher iwd[30930]: src/main.c:main() Using configuration directory /etc/iwd
Mar 27 16:01:55 cypher iwd[30930]: src/storage.c:storage_create_dirs() Using state directory /var/lib/iwd
Mar 27 16:01:55 cypher systemd[1]: Started Wireless service.
Mar 27 16:01:55 cypher iwd[30930]: src/main.c:nl80211_appeared() Found nl80211 interface
Mar 27 16:01:55 cypher iwd[30930]: src/module.c:iwd_modules_init()
Mar 27 16:01:55 cypher iwd[30930]: station: Network configuration is disabled.
Mar 27 16:01:55 cypher iwd[30930]: src/wsc.c:wsc_init()
Mar 27 16:01:55 cypher iwd[30930]: src/eap.c:__eap_method_enable()
Mar 27 16:01:55 cypher iwd[30930]: src/eap-wsc.c:eap_wsc_init()
Mar 27 16:01:55 cypher iwd[30930]: src/eap-md5.c:eap_md5_init()
Mar 27 16:01:55 cypher iwd[30930]: src/eap-tls.c:eap_tls_init()
Mar 27 16:01:55 cypher iwd[30930]: src/eap-ttls.c:eap_ttls_init()
Mar 27 16:01:55 cypher iwd[30930]: src/eap-mschapv2.c:eap_mschapv2_init()
Mar 27 16:01:55 cypher iwd[30930]: src/eap-sim.c:eap_sim_init()
Mar 27 16:01:55 cypher iwd[30930]: src/eap-aka.c:eap_aka_prime_init()
Mar 27 16:01:55 cypher iwd[30930]: src/eap-aka.c:eap_aka_init()
Mar 27 16:01:55 cypher iwd[30930]: src/eap-peap.c:eap_peap_init()
Mar 27 16:01:55 cypher iwd[30930]: src/eap-gtc.c:eap_gtc_init()
Mar 27 16:01:55 cypher iwd[30930]: src/eap-pwd.c:eap_pwd_init()
Mar 27 16:01:55 cypher iwd[30930]: src/manager.c:manager_wiphy_dump_callback() New wiphy phy0 added (0)
Mar 27 16:01:55 cypher iwd[30930]: src/manager.c:manager_wiphy_dump_done()
Mar 27 16:01:55 cypher iwd[30930]: src/manager.c:manager_filtered_wiphy_dump_done()
Mar 27 16:01:55 cypher iwd[30930]: Wiphy: 0, Name: phy0
Mar 27 16:01:55 cypher iwd[30930]:         Permanent Address: redacted
Mar 27 16:01:55 cypher iwd[30930]:         2.4GHz Band:
Mar 27 16:01:55 cypher iwd[30930]:                 Bitrates (non-HT):
Mar 27 16:01:55 cypher iwd[30930]:                          1.0 Mbps
Mar 27 16:01:55 cypher iwd[30930]:                          2.0 Mbps
Mar 27 16:01:55 cypher iwd[30930]:                          5.5 Mbps
Mar 27 16:01:55 cypher iwd[30930]:                         11.0 Mbps
Mar 27 16:01:55 cypher iwd[30930]:                          6.0 Mbps
Mar 27 16:01:55 cypher iwd[30930]:                          9.0 Mbps
Mar 27 16:01:55 cypher iwd[30930]:                         12.0 Mbps
Mar 27 16:01:55 cypher iwd[30930]:                         18.0 Mbps
Mar 27 16:01:55 cypher iwd[30930]:                         24.0 Mbps
Mar 27 16:01:55 cypher iwd[30930]:                         36.0 Mbps
Mar 27 16:01:55 cypher iwd[30930]:                         48.0 Mbps
Mar 27 16:01:55 cypher iwd[30930]:                         54.0 Mbps
Mar 27 16:01:55 cypher iwd[30930]:                 HT Capabilities:
Mar 27 16:01:55 cypher iwd[30930]:                         HT40
Mar 27 16:01:55 cypher iwd[30930]:                         Short GI for 20Mhz
Mar 27 16:01:55 cypher iwd[30930]:                         Short GI for 40Mhz
Mar 27 16:01:55 cypher iwd[30930]:                 HT RX MCS indexes:
Mar 27 16:01:55 cypher iwd[30930]:                         0-15
Mar 27 16:01:55 cypher iwd[30930]:                 HE Capabilities
Mar 27 16:01:55 cypher iwd[30930]:                         Interface Types: ap
Mar 27 16:01:55 cypher iwd[30930]:                         Max HE RX <= 80MHz MCS: 0-11 for NSS: 2
Mar 27 16:01:55 cypher iwd[30930]:                         Max HE TX <= 80MHz MCS: 0-11 for NSS: 2
Mar 27 16:01:55 cypher iwd[30930]:                         Interface Types: station
Mar 27 16:01:55 cypher iwd[30930]:                         Max HE RX <= 80MHz MCS: 0-11 for NSS: 2
Mar 27 16:01:55 cypher iwd[30930]:                         Max HE TX <= 80MHz MCS: 0-11 for NSS: 2
Mar 27 16:01:55 cypher iwd[30930]:         5GHz Band:
Mar 27 16:01:55 cypher iwd[30930]:                 Bitrates (non-HT):
Mar 27 16:01:55 cypher iwd[30930]:                          6.0 Mbps
Mar 27 16:01:55 cypher iwd[30930]:                          9.0 Mbps
Mar 27 16:01:55 cypher iwd[30930]:                         12.0 Mbps
Mar 27 16:01:55 cypher iwd[30930]:                         18.0 Mbps
Mar 27 16:01:55 cypher iwd[30930]:                         24.0 Mbps
Mar 27 16:01:55 cypher iwd[30930]:                         36.0 Mbps
Mar 27 16:01:55 cypher iwd[30930]:                         48.0 Mbps
Mar 27 16:01:55 cypher iwd[30930]:                         54.0 Mbps
Mar 27 16:01:55 cypher iwd[30930]:                 HT Capabilities:
Mar 27 16:01:55 cypher iwd[30930]:                         HT40
Mar 27 16:01:55 cypher iwd[30930]:                         Short GI for 20Mhz
Mar 27 16:01:55 cypher iwd[30930]:                         Short GI for 40Mhz
Mar 27 16:01:55 cypher iwd[30930]:                 HT RX MCS indexes:
Mar 27 16:01:55 cypher iwd[30930]:                         0-15
Mar 27 16:01:55 cypher iwd[30930]:                 VHT Capabilities:
Mar 27 16:01:55 cypher iwd[30930]:                         160 Mhz operation
Mar 27 16:01:55 cypher iwd[30930]:                         Short GI for 80Mhz
Mar 27 16:01:55 cypher iwd[30930]:                         Short GI for 160 and 80 + 80 Mhz
Mar 27 16:01:55 cypher iwd[30930]:                         Max RX MCS: 0-9 for NSS: 2
Mar 27 16:01:55 cypher iwd[30930]:                         Max TX MCS: 0-9 for NSS: 2
Mar 27 16:01:55 cypher iwd[30930]:                 HE Capabilities
Mar 27 16:01:55 cypher iwd[30930]:                         Interface Types: ap
Mar 27 16:01:55 cypher iwd[30930]:                         Max HE RX <= 80MHz MCS: 0-11 for NSS: 2
Mar 27 16:01:55 cypher iwd[30930]:                         Max HE TX <= 80MHz MCS: 0-11 for NSS: 2
Mar 27 16:01:55 cypher iwd[30930]:                         Interface Types: station
Mar 27 16:01:55 cypher iwd[30930]:                         Max HE RX <= 80MHz MCS: 0-11 for NSS: 2
Mar 27 16:01:55 cypher iwd[30930]:                         Max HE TX <= 80MHz MCS: 0-11 for NSS: 2
Mar 27 16:01:55 cypher iwd[30930]:                         Max HE RX <= 160MHz MCS: 0-11 for NSS: 2
Mar 27 16:01:55 cypher iwd[30930]:                         Max HE TX <= 160MHz MCS: 0-11 for NSS: 2
Mar 27 16:01:55 cypher iwd[30930]:         6GHz Band:
Mar 27 16:01:55 cypher iwd[30930]:                 Bitrates (non-HT):
Mar 27 16:01:55 cypher iwd[30930]:                          6.0 Mbps
Mar 27 16:01:55 cypher iwd[30930]:                          9.0 Mbps
Mar 27 16:01:55 cypher iwd[30930]:                         12.0 Mbps
Mar 27 16:01:55 cypher iwd[30930]:                         18.0 Mbps
Mar 27 16:01:55 cypher iwd[30930]:                         24.0 Mbps
Mar 27 16:01:55 cypher iwd[30930]:                         36.0 Mbps
Mar 27 16:01:55 cypher iwd[30930]:                         48.0 Mbps
Mar 27 16:01:55 cypher iwd[30930]:                         54.0 Mbps
Mar 27 16:01:55 cypher iwd[30930]:                 HE Capabilities
Mar 27 16:01:55 cypher iwd[30930]:                         Interface Types: ap
Mar 27 16:01:55 cypher iwd[30930]:                         Max HE RX <= 80MHz MCS: 0-11 for NSS: 2
Mar 27 16:01:55 cypher iwd[30930]:                         Max HE TX <= 80MHz MCS: 0-11 for NSS: 2
Mar 27 16:01:55 cypher iwd[30930]:                         Interface Types: station
Mar 27 16:01:55 cypher iwd[30930]:                         Max HE RX <= 80MHz MCS: 0-11 for NSS: 2
Mar 27 16:01:55 cypher iwd[30930]:                         Max HE TX <= 80MHz MCS: 0-11 for NSS: 2
Mar 27 16:01:55 cypher iwd[30930]:                         Max HE RX <= 160MHz MCS: 0-11 for NSS: 2
Mar 27 16:01:55 cypher iwd[30930]:                         Max HE TX <= 160MHz MCS: 0-11 for NSS: 2
Mar 27 16:01:55 cypher iwd[30930]:         Ciphers: BIP-CMAC-256 BIP-GMAC-256 BIP-GMAC-128 CCMP-256
Mar 27 16:01:55 cypher iwd[30930]:                  GCMP-256 GCMP-128 BIP-CMAC-128 CCMP-128
Mar 27 16:01:55 cypher iwd[30930]:                  TKIP
Mar 27 16:01:55 cypher iwd[30930]:         Supported iftypes: station ap p2p-client p2p-go
Mar 27 16:01:55 cypher iwd[30930]: src/manager.c:manager_interface_dump_done()
Mar 27 16:01:55 cypher iwd[30930]: src/manager.c:manager_create_interfaces() creating wlan0
Mar 27 16:01:55 cypher iwd[30930]: src/wiphy.c:wiphy_update_reg_domain() New reg domain country code for (global) is DE
Mar 27 16:01:55 cypher iwd[30930]: src/manager.c:manager_config_notify() Notification of command New Interface(7)
Mar 27 16:01:55 cypher iwd[30930]: src/netdev.c:netdev_link_notify() event 16 on ifindex 6
Mar 27 16:01:55 cypher iwd[30930]: src/manager.c:manager_new_station_interface_cb()
Mar 27 16:01:55 cypher iwd[30930]: src/netdev.c:netdev_create_from_genl() Created interface wlan0[6 5]
Mar 27 16:01:55 cypher iwd[30930]: src/netdev.c:netdev_link_notify() event 16 on ifindex 6
Mar 27 16:01:55 cypher iwd[30930]: src/netdev.c:netdev_set_4addr() netdev: 6 use_4addr: 0
Mar 27 16:01:55 cypher iwd[30930]: src/netdev.c:netdev_initial_up_cb() Interface 6 initialized
Mar 27 16:01:55 cypher iwd[30930]: event: state, old: disconnected, new: autoconnect_quick
Mar 27 16:01:55 cypher iwd[30930]: src/wiphy.c:wiphy_radio_work_insert() Inserting work item 1
Mar 27 16:01:55 cypher iwd[30930]: src/wiphy.c:wiphy_radio_work_next() Starting work item 1
Mar 27 16:01:55 cypher iwd[30930]: src/rrm.c:rrm_add_frame_watches()
Mar 27 16:01:55 cypher iwd[30930]: src/netdev.c:netdev_link_notify() event 16 on ifindex 6
Mar 27 16:01:55 cypher iwd[30930]: src/manager.c:manager_config_notify() Notification of command Set Interface(6)
Mar 27 16:01:55 cypher iwd[30930]: src/scan.c:scan_notify() Scan notification Trigger Scan(33)
Mar 27 16:01:55 cypher iwd[30930]: src/scan.c:scan_request_triggered() Active scan triggered for wdev 5
Mar 27 16:01:55 cypher iwd[30930]: src/station.c:station_quick_scan_triggered() Quick scan triggered for wlan0
Mar 27 16:01:55 cypher iwd[30930]: src/netdev.c:netdev_link_notify() event 16 on ifindex 6
Mar 27 16:01:55 cypher iwd[30930]: src/scan.c:scan_notify() Scan notification New Scan Results(34)
Mar 27 16:01:55 cypher iwd[30930]: src/netdev.c:netdev_link_notify() event 16 on ifindex 6
Mar 27 16:01:55 cypher iwd[30930]: wiphy_estimate_data_rate() failed
Mar 27 16:01:55 cypher iwd[30930]: wiphy_estimate_data_rate() failed
Mar 27 16:01:55 cypher iwd[30930]: src/station.c:station_add_seen_bss() Processing BSS 'worse:2d' with SSID: Home, freq: 2412, rank: 469, strength: -7100, data_rate: 68.8
Mar 27 16:01:55 cypher iwd[30930]: src/station.c:station_add_seen_bss() Added new Network "Home" security psk
Mar 27 16:01:55 cypher iwd[30930]: src/station.c:station_add_seen_bss() Processing BSS 'better:f1' with SSID: Home, freq: 2462, rank: 16, strength: -4700, data_rate: 2.0
Mar 27 16:01:55 cypher iwd[30930]: src/station.c:station_add_seen_bss() Processing BSS 'better:f0' with SSID: Home, freq: 5180, rank: 16, strength: -5500, data_rate: 2.0
Mar 27 16:01:55 cypher iwd[30930]: src/station.c:station_add_seen_bss() Processing BSS 'worse:2e' with SSID: Home, freq: 5180, rank: 13, strength: -9000, data_rate: 2.0
Mar 27 16:01:55 cypher iwd[30930]: src/station.c:station_autoconnect_start()
Mar 27 16:01:55 cypher iwd[30930]: src/wiphy.c:wiphy_select_akm() Network is WPA3-Personal...
Mar 27 16:01:55 cypher iwd[30930]: src/station.c:station_autoconnect_next() autoconnect: Trying SSID: Home
Mar 27 16:01:55 cypher iwd[30930]: src/station.c:station_autoconnect_next() autoconnect: 'worse:2d' freq: 2412, rank: 469, strength: -7100
Mar 27 16:01:55 cypher iwd[30930]: src/wiphy.c:wiphy_select_akm() Network is WPA3-Personal...
Mar 27 16:01:55 cypher iwd[30930]: src/netdev.c:netdev_cqm_rssi_update()
Mar 27 16:01:55 cypher iwd[30930]: src/wiphy.c:wiphy_radio_work_insert() Inserting work item 2
Mar 27 16:01:55 cypher iwd[30930]: event: connect-info, ssid: Home, bss: worse:2d, signal: -71, load: 127/255

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: iwd picking worse network despite better one available
  2024-03-27 18:36 iwd picking worse network despite better one available Sven-Hendrik Haase
@ 2024-03-27 18:54 ` James Prestwood
  2024-03-27 19:21   ` Sven-Hendrik Haase
  0 siblings, 1 reply; 6+ messages in thread
From: James Prestwood @ 2024-03-27 18:54 UTC (permalink / raw)
  To: Sven-Hendrik Haase, iwd

Hi,

On 3/27/24 11:36 AM, Sven-Hendrik Haase wrote:
> Hello,
>
> I've spent a good chunk of my evening looking into why iwd doesn't select the network I want it to select. I have a network "Home" with two APs. iwd seems to strongly prefer the AP that is further away and that has worse strength as measured by iwd.
>
>  From some testing, I believe it has to do with the AP rather than the wifi adapter. I tested a wifi adapter using mt7921e and one using iwlwifi and the result is the same in both cases. The APs are both pretty modern: The one iwd doesn't like is a FRITZ!Box 7590 AX while the one it likes is a FRITZ!Repeater 6000. From the log it seems that iwd is unable to perform a proper data rate estimation and then falls back to some default. At any rate, the rank would indicate that the estimated data rate plays an important role. If I use the developer mode to force roaming to the AP I want (named "better" in the log) then I'm able to use it perfectly well with a good data rate.
>
> As such I think this is a bug _somewhere_ but I'm not exactly sure where. I searched the configuration options but it seems it's not possible to turn off the data rate estimations for the ranking. I'd be perfectly happy to just go by signal strength. However, I suppose it would be better to actually fix the core problem in iwd.

IWD bases the ranking of BSS's heavily off the estimated data rate. If 
that fails then as you see the rank is very low as it defaults back to 
802.11b rates. There are several IEs the AP sends which IWD parses, any 
one of them could be either not included at all, or not be formatted 
correctly, or an actual bug in the parsing code. Could you get an iwmon 
capture of IWD scanning your APs so I could take a look and see exactly 
why its failing? Then we can go from there.

Thanks,

James


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: iwd picking worse network despite better one available
  2024-03-27 18:54 ` James Prestwood
@ 2024-03-27 19:21   ` Sven-Hendrik Haase
  2024-03-28 13:48     ` James Prestwood
  0 siblings, 1 reply; 6+ messages in thread
From: Sven-Hendrik Haase @ 2024-03-27 19:21 UTC (permalink / raw)
  To: James Prestwood, iwd

On Wed, Mar 27, 2024, at 19:54, James Prestwood wrote:
> Hi,
> 
> On 3/27/24 11:36 AM, Sven-Hendrik Haase wrote:
> > Hello,
> >
> > I've spent a good chunk of my evening looking into why iwd doesn't select the network I want it to select. I have a network "Home" with two APs. iwd seems to strongly prefer the AP that is further away and that has worse strength as measured by iwd.
> >
> >  From some testing, I believe it has to do with the AP rather than the wifi adapter. I tested a wifi adapter using mt7921e and one using iwlwifi and the result is the same in both cases. The APs are both pretty modern: The one iwd doesn't like is a FRITZ!Box 7590 AX while the one it likes is a FRITZ!Repeater 6000. From the log it seems that iwd is unable to perform a proper data rate estimation and then falls back to some default. At any rate, the rank would indicate that the estimated data rate plays an important role. If I use the developer mode to force roaming to the AP I want (named "better" in the log) then I'm able to use it perfectly well with a good data rate.
> >
> > As such I think this is a bug _somewhere_ but I'm not exactly sure where. I searched the configuration options but it seems it's not possible to turn off the data rate estimations for the ranking. I'd be perfectly happy to just go by signal strength. However, I suppose it would be better to actually fix the core problem in iwd.
> 
> IWD bases the ranking of BSS's heavily off the estimated data rate. If 
> that fails then as you see the rank is very low as it defaults back to 
> 802.11b rates. There are several IEs the AP sends which IWD parses, any 
> one of them could be either not included at all, or not be formatted 
> correctly, or an actual bug in the parsing code. Could you get an iwmon 
> capture of IWD scanning your APs so I could take a look and see exactly 
> why its failing? Then we can go from there.
> 
> Thanks,
> 
> James
> 

Hi James,

You should have received a pcap file of an iwd restart in a separate email. I hope there's some usable data in there for you.

Cheers,
Sven

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: iwd picking worse network despite better one available
  2024-03-27 19:21   ` Sven-Hendrik Haase
@ 2024-03-28 13:48     ` James Prestwood
  2024-03-28 16:21       ` Sven-Hendrik Haase
  0 siblings, 1 reply; 6+ messages in thread
From: James Prestwood @ 2024-03-28 13:48 UTC (permalink / raw)
  To: Sven-Hendrik Haase, iwd

Hi Sven,

On 3/27/24 12:21 PM, Sven-Hendrik Haase wrote:
> On Wed, Mar 27, 2024, at 19:54, James Prestwood wrote:
>> Hi,
>>
>> On 3/27/24 11:36 AM, Sven-Hendrik Haase wrote:
>>> Hello,
>>>
>>> I've spent a good chunk of my evening looking into why iwd doesn't select the network I want it to select. I have a network "Home" with two APs. iwd seems to strongly prefer the AP that is further away and that has worse strength as measured by iwd.
>>>
>>>   From some testing, I believe it has to do with the AP rather than the wifi adapter. I tested a wifi adapter using mt7921e and one using iwlwifi and the result is the same in both cases. The APs are both pretty modern: The one iwd doesn't like is a FRITZ!Box 7590 AX while the one it likes is a FRITZ!Repeater 6000. From the log it seems that iwd is unable to perform a proper data rate estimation and then falls back to some default. At any rate, the rank would indicate that the estimated data rate plays an important role. If I use the developer mode to force roaming to the AP I want (named "better" in the log) then I'm able to use it perfectly well with a good data rate.
>>>
>>> As such I think this is a bug _somewhere_ but I'm not exactly sure where. I searched the configuration options but it seems it's not possible to turn off the data rate estimations for the ranking. I'd be perfectly happy to just go by signal strength. However, I suppose it would be better to actually fix the core problem in iwd.
>> IWD bases the ranking of BSS's heavily off the estimated data rate. If
>> that fails then as you see the rank is very low as it defaults back to
>> 802.11b rates. There are several IEs the AP sends which IWD parses, any
>> one of them could be either not included at all, or not be formatted
>> correctly, or an actual bug in the parsing code. Could you get an iwmon
>> capture of IWD scanning your APs so I could take a look and see exactly
>> why its failing? Then we can go from there.
>>
>> Thanks,
>>
>> James
>>
> Hi James,
>
> You should have received a pcap file of an iwd restart in a separate email. I hope there's some usable data in there for you.
>
> Cheers,
> Sven

The issue is that the AP in question is not setting a bit correctly in 
the HE capabilities element. As part of the HE PHY capabilities there is 
a "Supported Channel Width Set" (Table 9-322b):

— B2 indicates support for a 160 MHz channel width.
— B3 indicates support for a 160/80+80 MHz channel
width.

And it then goes to say:

B3 is set to 1 if supported. If B3 is 1, then B2 is set to 1.

In your case B3=1 and B2=0. This is checked by IWD and fails. So this is 
something the AP should fix. But at the same time this check actually 
bypasses the VHT/HT/basic rates calculations which is why your only 
getting 2mbps as the estimation. I just sent patches to the list fixing 
this, so this should certainly help in your case, although the HE 
capabilities will still fail to parse which means IWD will estimate 
based on VHT instead.

Thanks,

James


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: iwd picking worse network despite better one available
  2024-03-28 13:48     ` James Prestwood
@ 2024-03-28 16:21       ` Sven-Hendrik Haase
  2024-03-28 16:45         ` James Prestwood
  0 siblings, 1 reply; 6+ messages in thread
From: Sven-Hendrik Haase @ 2024-03-28 16:21 UTC (permalink / raw)
  To: James Prestwood, iwd

On Thu, Mar 28, 2024, at 14:48, James Prestwood wrote:
> Hi Sven,
> 
> On 3/27/24 12:21 PM, Sven-Hendrik Haase wrote:
> > On Wed, Mar 27, 2024, at 19:54, James Prestwood wrote:
> >> Hi,
> >>
> >> On 3/27/24 11:36 AM, Sven-Hendrik Haase wrote:
> >>> Hello,
> >>>
> >>> I've spent a good chunk of my evening looking into why iwd doesn't select the network I want it to select. I have a network "Home" with two APs. iwd seems to strongly prefer the AP that is further away and that has worse strength as measured by iwd.
> >>>
> >>>   From some testing, I believe it has to do with the AP rather than the wifi adapter. I tested a wifi adapter using mt7921e and one using iwlwifi and the result is the same in both cases. The APs are both pretty modern: The one iwd doesn't like is a FRITZ!Box 7590 AX while the one it likes is a FRITZ!Repeater 6000. From the log it seems that iwd is unable to perform a proper data rate estimation and then falls back to some default. At any rate, the rank would indicate that the estimated data rate plays an important role. If I use the developer mode to force roaming to the AP I want (named "better" in the log) then I'm able to use it perfectly well with a good data rate.
> >>>
> >>> As such I think this is a bug _somewhere_ but I'm not exactly sure where. I searched the configuration options but it seems it's not possible to turn off the data rate estimations for the ranking. I'd be perfectly happy to just go by signal strength. However, I suppose it would be better to actually fix the core problem in iwd.
> >> IWD bases the ranking of BSS's heavily off the estimated data rate. If
> >> that fails then as you see the rank is very low as it defaults back to
> >> 802.11b rates. There are several IEs the AP sends which IWD parses, any
> >> one of them could be either not included at all, or not be formatted
> >> correctly, or an actual bug in the parsing code. Could you get an iwmon
> >> capture of IWD scanning your APs so I could take a look and see exactly
> >> why its failing? Then we can go from there.
> >>
> >> Thanks,
> >>
> >> James
> >>
> > Hi James,
> >
> > You should have received a pcap file of an iwd restart in a separate email. I hope there's some usable data in there for you.
> >
> > Cheers,
> > Sven
> 
> The issue is that the AP in question is not setting a bit correctly in 
> the HE capabilities element. As part of the HE PHY capabilities there is 
> a "Supported Channel Width Set" (Table 9-322b):
> 
> — B2 indicates support for a 160 MHz channel width.
> — B3 indicates support for a 160/80+80 MHz channel
> width.
> 
> And it then goes to say:
> 
> B3 is set to 1 if supported. If B3 is 1, then B2 is set to 1.
> 
> In your case B3=1 and B2=0. This is checked by IWD and fails. So this is 
> something the AP should fix. But at the same time this check actually 
> bypasses the VHT/HT/basic rates calculations which is why your only 
> getting 2mbps as the estimation. I just sent patches to the list fixing 
> this, so this should certainly help in your case, although the HE 
> capabilities will still fail to parse which means IWD will estimate 
> based on VHT instead.
> 
> Thanks,
> 
> James
> 

Hey James,

I just tested the patches and can confirm that they perform perfectly for me and I'm now getting the right AP selected along with incredible speeds so I'm happy. Looking forward to the next release of iwd!

I also reported the problem in detail to AVM. Let's see whether they will actually get an engineer onboard to fix the fundamental problem.

Cheers,
Sven

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: iwd picking worse network despite better one available
  2024-03-28 16:21       ` Sven-Hendrik Haase
@ 2024-03-28 16:45         ` James Prestwood
  0 siblings, 0 replies; 6+ messages in thread
From: James Prestwood @ 2024-03-28 16:45 UTC (permalink / raw)
  To: Sven-Hendrik Haase, iwd

Hi Sven,

On 3/28/24 9:21 AM, Sven-Hendrik Haase wrote:
> On Thu, Mar 28, 2024, at 14:48, James Prestwood wrote:
>> Hi Sven,
>>
>> On 3/27/24 12:21 PM, Sven-Hendrik Haase wrote:
>>> On Wed, Mar 27, 2024, at 19:54, James Prestwood wrote:
>>>> Hi,
>>>>
>>>> On 3/27/24 11:36 AM, Sven-Hendrik Haase wrote:
>>>>> Hello,
>>>>>
>>>>> I've spent a good chunk of my evening looking into why iwd doesn't select the network I want it to select. I have a network "Home" with two APs. iwd seems to strongly prefer the AP that is further away and that has worse strength as measured by iwd.
>>>>>
>>>>>    From some testing, I believe it has to do with the AP rather than the wifi adapter. I tested a wifi adapter using mt7921e and one using iwlwifi and the result is the same in both cases. The APs are both pretty modern: The one iwd doesn't like is a FRITZ!Box 7590 AX while the one it likes is a FRITZ!Repeater 6000. From the log it seems that iwd is unable to perform a proper data rate estimation and then falls back to some default. At any rate, the rank would indicate that the estimated data rate plays an important role. If I use the developer mode to force roaming to the AP I want (named "better" in the log) then I'm able to use it perfectly well with a good data rate.
>>>>>
>>>>> As such I think this is a bug _somewhere_ but I'm not exactly sure where. I searched the configuration options but it seems it's not possible to turn off the data rate estimations for the ranking. I'd be perfectly happy to just go by signal strength. However, I suppose it would be better to actually fix the core problem in iwd.
>>>> IWD bases the ranking of BSS's heavily off the estimated data rate. If
>>>> that fails then as you see the rank is very low as it defaults back to
>>>> 802.11b rates. There are several IEs the AP sends which IWD parses, any
>>>> one of them could be either not included at all, or not be formatted
>>>> correctly, or an actual bug in the parsing code. Could you get an iwmon
>>>> capture of IWD scanning your APs so I could take a look and see exactly
>>>> why its failing? Then we can go from there.
>>>>
>>>> Thanks,
>>>>
>>>> James
>>>>
>>> Hi James,
>>>
>>> You should have received a pcap file of an iwd restart in a separate email. I hope there's some usable data in there for you.
>>>
>>> Cheers,
>>> Sven
>> The issue is that the AP in question is not setting a bit correctly in
>> the HE capabilities element. As part of the HE PHY capabilities there is
>> a "Supported Channel Width Set" (Table 9-322b):
>>
>> — B2 indicates support for a 160 MHz channel width.
>> — B3 indicates support for a 160/80+80 MHz channel
>> width.
>>
>> And it then goes to say:
>>
>> B3 is set to 1 if supported. If B3 is 1, then B2 is set to 1.
>>
>> In your case B3=1 and B2=0. This is checked by IWD and fails. So this is
>> something the AP should fix. But at the same time this check actually
>> bypasses the VHT/HT/basic rates calculations which is why your only
>> getting 2mbps as the estimation. I just sent patches to the list fixing
>> this, so this should certainly help in your case, although the HE
>> capabilities will still fail to parse which means IWD will estimate
>> based on VHT instead.
>>
>> Thanks,
>>
>> James
>>
> Hey James,
>
> I just tested the patches and can confirm that they perform perfectly for me and I'm now getting the right AP selected along with incredible speeds so I'm happy. Looking forward to the next release of iwd!
>
> I also reported the problem in detail to AVM. Let's see whether they will actually get an engineer onboard to fix the fundamental problem.
Glad to hear it. The unfortunate thing is these bits come directly from 
the driver/hardware so the AP is probably just passing those as-is, 
which is what IWD does as well. They'll have to push on the hardware 
vendor to fix the bits. But in any case, glad the behavior is at least 
improved now.
>
> Cheers,
> Sven

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-03-28 16:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-27 18:36 iwd picking worse network despite better one available Sven-Hendrik Haase
2024-03-27 18:54 ` James Prestwood
2024-03-27 19:21   ` Sven-Hendrik Haase
2024-03-28 13:48     ` James Prestwood
2024-03-28 16:21       ` Sven-Hendrik Haase
2024-03-28 16:45         ` James Prestwood

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.