Dual phy device not always detected
David Bourgeois
Hi,
We plan to use iwd for an embedded device where we need both station and ap at the same time. For this we have devices based on the rtl88x2bu driver compiled to enable the dual phy. This works well, the dongle is detected as 2 different interfaces wlan0 and wlan1 and both work properly. IWD doesn't always detect both interfaces though when the dongle is plugged. If IWD is restarted, then most of the time both interfaces are detected. When the dongle is plugged at boot it also works most of the time.
Here's what is shown through the interface as soon as I replug the dongle and I added below the lines of the log that are around the unplug/replug events. If there's any other kind of logs I could get to make things easier to track, let me know. I can provide the full logs as well.
Thanks,
David
root(a)cy-rio-15-65:/etc/systemd/network# ip a
13: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP
group default qlen 1000
link/ether 60:a4:b7:83:26:b5 brd ff:ff:ff:ff:ff:ff
inet6 fe80::62a4:b7ff:fe83:26b5/64 scope link
valid_lft forever preferred_lft forever
14: wlan1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN
group default qlen 1000
link/ether 62:a4:b7:83:26:b5 brd ff:ff:ff:ff:ff:ff
root(a)cy-rio-15-65:/etc/systemd/network# iwctl device list
Devices
--------------------------------------------------------------------------------
Name Address Powered Adapter Mode
--------------------------------------------------------------------------------
wlan0 60:a4:b7:83:26:b5 on phy6 stationroot(a)cy-rio-15-65:/etc/systemd/network# systemctl restart iwd
root(a)cy-rio-15-65:/etc/systemd/network# iwctl device list
Devices
--------------------------------------------------------------------------------
Name Address Powered Adapter Mode
--------------------------------------------------------------------------------
wlan0 60:a4:b7:83:26:b5 on phy6 station
wlan1 62:a4:b7:83:26:b5 on phy7 stationroot(a)cy-rio-15-65:/etc/systemd/network# ip a
13: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP
group default qlen 1000
link/ether 60:a4:b7:83:26:b5 brd ff:ff:ff:ff:ff:ff
inet 192.168.88.40/24 brd 192.168.88.255 scope global dynamic wlan0
valid_lft 581sec preferred_lft 581sec
inet6 fe80::62a4:b7ff:fe83:26b5/64 scope link
valid_lft forever preferred_lft forever
14: wlan1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP
group default qlen 1000
link/ether 62:a4:b7:83:26:b5 brd ff:ff:ff:ff:ff:ff
inet 192.168.88.55/24 brd 192.168.88.255 scope global dynamic wlan1
valid_lft 595sec preferred_lft 595sec
inet6 fe80::60a4:b7ff:fe83:26b5/64 scope link
valid_lft forever preferred_lft foreverThis is a log with the -d option, there's a line "10-02-22 12_48_02 NEW_INTERFACE failed: No such device" at the bottom but it's not always there even when the interface is still not detected.
10-02-22 12_47_34 ../iwd-1.24/src/netdev.c:netdev_link_notify() event 16 on ifindex 7
10-02-22 12_47_34 ../iwd-1.24/src/station.c:station_free() 10-02-22 12_47_34 ../iwd-1.24/src/scan.c:scan_periodic_stop() Stopping periodic scan for wdev 200000001
10-02-22 12_47_34 ../iwd-1.24/src/station.c:station_roam_state_clear() 7 10-02-22 12_47_34 ../iwd-1.24/src/manager.c:manager_config_notify() Notification of command Del Interface(8)
10-02-22 12_47_34 ../iwd-1.24/src/netdev.c:netdev_free() Freeing netdev wlan0[7]
10-02-22 12_47_34 ../iwd-1.24/src/device.c:device_free() 10-02-22 12_47_34 Removing scan context for wdev 200000001 10-02-22 12_47_34 ../iwd-1.24/src/scan.c:scan_context_free() sc: 0x10b18b8 10-02-22 12_47_34 ../iwd-1.24/src/netdev.c:netdev_link_notify() event 17 on ifindex 7
10-02-22 12_47_34 ../iwd-1.24/src/manager.c:manager_config_notify() Notification of command Del Wiphy(4)
10-02-22 12_47_34 ../iwd-1.24/src/wiphy.c:wiphy_destroy() 10-02-22 12_47_34 ../iwd-1.24/src/wiphy.c:wiphy_free() Freeing wiphy phy2[2] 10-02-22 12_47_34 ../iwd-1.24/src/netdev.c:netdev_link_notify() event 16 on ifindex 8
10-02-22 12_47_34 ../iwd-1.24/src/station.c:station_free() 10-02-22 12_47_34 ../iwd-1.24/src/scan.c:scan_periodic_stop() Stopping periodic scan for wdev 300000001
10-02-22 12_47_34 ../iwd-1.24/src/station.c:station_roam_state_clear() 8 10-02-22 12_47_34 ../iwd-1.24/src/manager.c:manager_config_notify() Notification of command Del Interface(8)
10-02-22 12_47_34 ../iwd-1.24/src/netdev.c:netdev_free() Freeing netdev wlan1[8]
10-02-22 12_47_34 ../iwd-1.24/src/device.c:device_free() 10-02-22 12_47_34 Removing scan context for wdev 300000001 10-02-22 12_47_34 ../iwd-1.24/src/scan.c:scan_context_free() sc: 0x10b8060 10-02-22 12_47_34 ../iwd-1.24/src/netdev.c:netdev_link_notify() event 17 on ifindex 8
10-02-22 12_47_34 ../iwd-1.24/src/manager.c:manager_config_notify() Notification of command Del Wiphy(4)
10-02-22 12_47_34 ../iwd-1.24/src/wiphy.c:wiphy_destroy() 10-02-22 12_47_34 ../iwd-1.24/src/wiphy.c:wiphy_free() Freeing wiphy phy3[3] 10-02-22 12_48_01 ../iwd-1.24/src/manager.c:manager_config_notify() Notification of command New Wiphy(3)
10-02-22 12_48_01 ../iwd-1.24/src/wiphy.c:wiphy_reg_notify() Notification of command Reg Change(36)
10-02-22 12_48_01 ../iwd-1.24/src/wiphy.c:wiphy_update_reg_domain() New reg domain country code for (global) is XX
10-02-22 12_48_01 ../iwd-1.24/src/manager.c:manager_config_notify() Notification of command New Interface(7)
10-02-22 12_48_01 ../iwd-1.24/src/netdev.c:netdev_link_notify() event 16 on ifindex 9
10-02-22 12_48_01 Wiphy: 4, Name: phy4
10-02-22 12_48_01 Permanent Address: 00:00:00:00:00:00
10-02-22 12_48_01 2.4Ghz Band:
10-02-22 12_48_01 Bitrates (non-HT):
10-02-22 12_48_01 1.0 Mbps
10-02-22 12_48_01 2.0 Mbps
10-02-22 12_48_01 5.5 Mbps
10-02-22 12_48_01 11.0 Mbps
10-02-22 12_48_01 6.0 Mbps
10-02-22 12_48_01 9.0 Mbps
10-02-22 12_48_01 12.0 Mbps
10-02-22 12_48_01 18.0 Mbps
10-02-22 12_48_01 24.0 Mbps
10-02-22 12_48_01 36.0 Mbps
10-02-22 12_48_01 48.0 Mbps
10-02-22 12_48_01 54.0 Mbps
10-02-22 12_48_01 5Ghz Band:
10-02-22 12_48_01 Bitrates (non-HT):
10-02-22 12_48_01 6.0 Mbps
10-02-22 12_48_01 9.0 Mbps
10-02-22 12_48_01 12.0 Mbps
10-02-22 12_48_01 18.0 Mbps
10-02-22 12_48_01 24.0 Mbps
10-02-22 12_48_01 36.0 Mbps
10-02-22 12_48_01 48.0 Mbps
10-02-22 12_48_01 54.0 Mbps
10-02-22 12_48_01 Ciphers: CCMP TKIP BIP
10-02-22 12_48_01 Supported iftypes: ad-hoc station ap
10-02-22 12_48_01 Wiphy phy4 will only use the default interface 10-02-22 12_48_01 ../iwd-1.24/src/manager.c:manager_config_notify() Notification of command New Wiphy(3)
10-02-22 12_48_01 ../iwd-1.24/src/netdev.c:netdev_link_notify() event 16 on ifindex 10
10-02-22 12_48_01 ../iwd-1.24/src/wiphy.c:wiphy_reg_notify() Notification of command Reg Change(36)
10-02-22 12_48_01 ../iwd-1.24/src/wiphy.c:wiphy_update_reg_domain() New reg domain country code for (global) is XX
10-02-22 12_48_01 ../iwd-1.24/src/manager.c:manager_config_notify() Notification of command New Interface(7)
10-02-22 12_48_01 ../iwd-1.24/src/manager.c:manager_interface_dump_callback() 10-02-22 12_48_01 ../iwd-1.24/src/manager.c:manager_get_interface_cb() 10-02-22 12_48_01 ../iwd-1.24/src/manager.c:manager_use_default() 10-02-22 12_48_01 ../iwd-1.24/src/netdev.c:netdev_create_from_genl() Created interface wlan0[9 400000001]
10-02-22 12_48_01 ../iwd-1.24/src/manager.c:manager_create_interfaces() creating wlan5
10-02-22 12_48_01 ../iwd-1.24/src/wiphy.c:wiphy_update_reg_domain() New reg domain country code for (global) is 00
10-02-22 12_48_02 ../iwd-1.24/src/netdev.c:netdev_link_notify() event 16 on ifindex 9
10-02-22 12_48_02 Wiphy: 5, Name: phy5
10-02-22 12_48_02 Permanent Address: d2:37:45:17:a0:5e
10-02-22 12_48_02 2.4Ghz Band:
10-02-22 12_48_02 Bitrates (non-HT):
10-02-22 12_48_02 1.0 Mbps
10-02-22 12_48_02 2.0 Mbps
10-02-22 12_48_02 5.5 Mbps
10-02-22 12_48_02 11.0 Mbps
10-02-22 12_48_02 6.0 Mbps
10-02-22 12_48_02 9.0 Mbps
10-02-22 12_48_02 12.0 Mbps
10-02-22 12_48_02 18.0 Mbps
10-02-22 12_48_02 24.0 Mbps
10-02-22 12_48_02 36.0 Mbps
10-02-22 12_48_02 48.0 Mbps
10-02-22 12_48_02 54.0 Mbps
10-02-22 12_48_02 5Ghz Band:
10-02-22 12_48_02 Bitrates (non-HT):
10-02-22 12_48_02 6.0 Mbps
10-02-22 12_48_02 9.0 Mbps
10-02-22 12_48_02 12.0 Mbps
10-02-22 12_48_02 18.0 Mbps
10-02-22 12_48_02 24.0 Mbps
10-02-22 12_48_02 36.0 Mbps
10-02-22 12_48_02 48.0 Mbps
10-02-22 12_48_02 54.0 Mbps
10-02-22 12_48_02 Ciphers: CCMP TKIP BIP
10-02-22 12_48_02 Supported iftypes: ad-hoc station ap p2p-client p2p-go 10-02-22 12_48_02 Wiphy phy5 will only use the default interface 10-02-22 12_48_02 ../iwd-1.24/src/netdev.c:netdev_set_4addr() netdev: 9use_4addr: 0
10-02-22 12_48_02 ../iwd-1.24/src/netdev.c:netdev_initial_up_cb() Interface 9 initialized
10-02-22 12_48_02 ../iwd-1.24/src/station.c:station_enter_state() Old
State: disconnected, new state: autoconnect_quick
10-02-22 12_48_02 ../iwd-1.24/src/scan.c:scan_periodic_start() Starting periodic scan for wdev 400000001
10-02-22 12_48_02 ../iwd-1.24/src/wiphy.c:wiphy_radio_work_insert() Inserting work item 9
10-02-22 12_48_02 ../iwd-1.24/src/wiphy.c:wiphy_radio_work_next() Starting work item 9
10-02-22 12_48_02 ../iwd-1.24/src/rrm.c:rrm_add_frame_watches() 10-02-22 12_48_02 ../iwd-1.24/src/netdev.c:netdev_link_notify() event 16 on ifindex 9
10-02-22 12_48_02 ../iwd-1.24/src/manager.c:manager_interface_dump_callback() 10-02-22 12_48_02 ../iwd-1.24/src/manager.c:manager_get_interface_cb() 10-02-22 12_48_02 ../iwd-1.24/src/netdev.c:netdev_link_notify() event 16 on ifindex 9
10-02-22 12_48_02 ../iwd-1.24/src/manager.c:manager_new_station_interface_cb() 10-02-22 12_48_02 NEW_INTERFACE failed: No such device
10-02-22 12_48_02 ../iwd-1.24/src/wiphy.c:wiphy_update_reg_domain() New reg domain country code for (global) is 00
10-02-22 12_48_02 ../iwd-1.24/src/manager.c:manager_config_notify() Notification of command Set Interface(6)
10-02-22 12_48_02 ../iwd-1.24/src/scan.c:scan_notify() Scan notification Trigger Scan(33)
10-02-22 12_48_02 ../iwd-1.24/src/scan.c:scan_request_triggered() Passive scan triggered for wdev 400000001
10-02-22 12_48_02 ../iwd-1.24/src/scan.c:scan_periodic_triggered() Periodic scan triggered for wdev 400000001
10-02-22 12_48_02 ../iwd-1.24/src/netdev.c:netdev_link_notify() event 16 on ifindex 9
10-02-22 12_48_07 ../iwd-1.24/src/scan.c:scan_notify() Scan notification New Scan Results(34)
10-02-22 12_48_07 ../iwd-1.24/src/netdev.c:netdev_link_notify() event 16 on ifindex 9
10-02-22 12_48_07 ../iwd-1.24/src/scan.c:get_scan_callback() get_scan_callback
10-02-22 12_48_07 ../iwd-1.24/src/scan.c:scan_parse_bss_information_elements() Load: 174/255 10-02-22 12_48_07 ../iwd-1.24/src/scan.c:get_scan_callback() get_scan_callback
10-02-22 12_48_07 ../iwd-1.24/src/scan.c:scan_parse_bss_information_elements() Load: 174/255
Here's another capture where we enabled IWD_GENL_DEBUG=y.
10-02-22 13_01_05 ../iwd-1.24/src/netdev.c:netdev_link_notify() event 16 on ifindex 9
10-02-22 13_01_05 ../iwd-1.24/src/station.c:station_free() 10-02-22 13_01_05 ../iwd-1.24/src/scan.c:scan_periodic_stop() Stopping periodic scan for wdev 400000001
10-02-22 13_01_05 ../iwd-1.24/src/station.c:station_roam_state_clear() 9 10-02-22 13_01_05 [GENL] < 68 00 00 00 1c 00 00 00 00 00 00 00 00 00 00 00
h...............
10-02-22 13_01_05 [GENL] 08 01 00 00 08 00 03 00 09 00 00 00 0a 00 04 00
................
10-02-22 13_01_05 [GENL] 77 6c 61 6e 30 00 00 00 08 00 01 00 04 00 00 00
wlan0...........
10-02-22 13_01_05 [GENL] 08 00 05 00 02 00 00 00 0c 00 99 00 01 00 00 00
................
10-02-22 13_01_05 [GENL] 04 00 00 00 0a 00 06 00 d0 37 45 17 a0 5e 00 00
.........7E..^..
10-02-22 13_01_05 [GENL] 08 00 2e 00 29 00 00 00 05 00 53 00 00 00 00 00
....).....S.....
10-02-22 13_01_05 [GENL] 08 00 62 00 f0 d8 ff ff
..b.....
10-02-22 13_01_05 ../iwd-1.24/src/manager.c:manager_config_notify() Notification of command Del Interface(8)
10-02-22 13_01_05 ../iwd-1.24/src/netdev.c:netdev_free() Freeing netdev wlan0[9]
10-02-22 13_01_05 ../iwd-1.24/src/device.c:device_free() 10-02-22 13_01_05 Removing scan context for wdev 400000001 10-02-22 13_01_05 ../iwd-1.24/src/scan.c:scan_context_free() sc: 0x22c18b8 10-02-22 13_01_05 ../iwd-1.24/src/netdev.c:netdev_link_notify() event 17 on ifindex 9
10-02-22 13_01_05 [GENL] < 30 00 00 00 1c 00 00 00 00 00 00 00 00 00 00 00
0...............
10-02-22 13_01_05 [GENL] 04 01 00 00 08 00 01 00 04 00 00 00 09 00 02 00
................
10-02-22 13_01_05 [GENL] 70 68 79 34 00 00 00 00 08 00 2e 00 0a 00 00 00
phy4............
10-02-22 13_01_05 ../iwd-1.24/src/manager.c:manager_config_notify() Notification of command Del Wiphy(4)
10-02-22 13_01_05 ../iwd-1.24/src/wiphy.c:wiphy_destroy() 10-02-22 13_01_05 ../iwd-1.24/src/wiphy.c:wiphy_free() Freeing wiphy phy4[4] 10-02-22 13_01_05 ../iwd-1.24/src/netdev.c:netdev_link_notify() event 16 on ifindex 10
10-02-22 13_01_05 ../iwd-1.24/src/station.c:station_free() 10-02-22 13_01_05 ../iwd-1.24/src/scan.c:scan_periodic_stop() Stopping periodic scan for wdev 500000001
10-02-22 13_01_05 ../iwd-1.24/src/station.c:station_roam_state_clear() 10
Denis Kenzior
PATCH 1/1 manager: Refine filtered dumps
When we detect a new phy being added, we schedule a filtered dump of WIPHYs and INTERFACES. However, the processing of these dumps was shared with the global dump of all WIPHYs and INTERFACEs which is performed at startup. This normally worked fine as long as a single phy was created at a time. However, if multiphy new phys were detected in a short amount of time, the logic would get confused and try to process phys that have not been probed yet. Fix this by only processing the wiphy and related interfaces when the filtered dump is performed, and not any additional ones that might still be pending.
--- src/manager.c | 85 ++++++++++++++++++++++++++++++++++----------------- 1 file changed, 57 insertions(+), 28 deletions(-)
src/manager.c +57 -28
@@ -487,6 +487,19 @@ static void manager_interface_dump_callback(struct l_genl_msg *msg,manager_get_interface_cb (msg, state); } +static void manager_filtered_interface_dump_done (void *user_data) +{ +struct wiphy_setup_state *state = user_data; + +l_debug ("" ); + +if (!manager_wiphy_check_setup_done (state)) +return ; + +/* If we are here, there were no interfaces for this phy */ +wiphy_setup_state_destroy (state); +} +static bool manager_check_create_interfaces (void *data,void *user_data) {struct wiphy_setup_state *state = data;
@@ -501,6 +514,8 @@ static bool manager_check_create_interfaces(void *data, void *user_data)static void manager_interface_dump_done (void *user_data) { +l_debug ("" ); +l_queue_foreach_remove (pending_wiphys, manager_check_create_interfaces,NULL ); }
@@ -552,43 +567,59 @@ static void manager_wiphy_filtered_dump_callback(struct l_genl_msg *msg,wiphy_update_from_genl (state->wiphy, msg); } -static void manager_wiphy_dump_done (void *user_data) +static void manager_filtered_wiphy_dump_done (void *user_data) { -const struct l_queue_entry *e; +struct wiphy_setup_state *state = user_data; -for (e =l_queue_get_entries (pending_wiphys); e; e = e->next) { -struct wiphy_setup_state *state = e->data; +l_debug ("" ); -wiphy_create_complete (state->wiphy); - state->use_default = use_default; +wiphy_create_complete (state->wiphy); + state->use_default = use_default; -/* If whitelist/blacklist were given only try to use existing -* interfaces same as when the driver does not support -* NEW_INTERFACE or DEL_INTERFACE, otherwise the interface -* names will become meaningless after we've created our own -* interface(s). Optimally phy name white/blacklists should -* be used. -*/ -if (whitelist_filter || blacklist_filter) - state->use_default = true; +/* +* If whitelist/blacklist were given only try to use existing +* interfaces same as when the driver does not support +* NEW_INTERFACE or DEL_INTERFACE, otherwise the interface +* names will become meaningless after we've created our own +* interface(s). Optimally phy name white/blacklists should +* be used. +*/ +if (whitelist_filter || blacklist_filter) + state->use_default = true; -if (!state->use_default) - state->use_default = -wiphy_uses_default_if (state->wiphy); +if (!state->use_default) + state->use_default =wiphy_uses_default_if (state->wiphy); -if (state->use_default) -l_info ("Wiphy %s will only use the default interface" , -wiphy_get_name (state->wiphy)); - } +if (state->use_default) +l_info ("Wiphy %s will only use the default interface" , +wiphy_get_name (state->wiphy)); +} + +static void manager_wiphy_dump_done (void *user_data) +{ +const struct l_queue_entry *e; + +l_debug ("" ); + +for (e =l_queue_get_entries (pending_wiphys); e; e = e->next) +manager_filtered_wiphy_dump_done (e->data); }static int manager_wiphy_filtered_dump (uint32_t wiphy_id, -l_genl_msg_func_t cb, -void *user_data) +l_genl_msg_func_t cb, +struct wiphy_setup_state *state) {struct l_genl_msg *msg;unsigned int wiphy_cmd_id;unsigned int iface_cmd_id; +l_genl_destroy_func_t wiphy_done = manager_wiphy_dump_done; +l_genl_destroy_func_t interface_done = manager_interface_dump_done; + +/* If state is provided, don't try to process other pending states */ +if (state) { + wiphy_done = manager_filtered_wiphy_dump_done; + interface_done = manager_filtered_interface_dump_done; + }/* * Until fixed, a NEW_WIPHY event will not include all the information
@@ -599,8 +630,7 @@ static int manager_wiphy_filtered_dump(uint32_t wiphy_id,l_genl_msg_append_attr (msg,NL80211_ATTR_SPLIT_WIPHY_DUMP ,0 ,NULL );l_genl_msg_append_attr (msg,NL80211_ATTR_WIPHY ,4 , &wiphy_id); - wiphy_cmd_id =l_genl_family_dump (nl80211, msg, cb, user_data, - manager_wiphy_dump_done); + wiphy_cmd_id =l_genl_family_dump (nl80211, msg, cb, state, wiphy_done);if (!wiphy_cmd_id) {l_error ("Could not dump wiphy %u" , wiphy_id);l_genl_msg_unref (msg);
@@ -625,8 +655,7 @@ static int manager_wiphy_filtered_dump(uint32_t wiphy_id, iface_cmd_id =l_genl_family_dump (nl80211, msg, manager_interface_dump_callback, -NULL , manager_interface_dump_done); - + state, interface_done);if (!iface_cmd_id) {l_error ("Could not dump interface for wiphy %u" , wiphy_id);l_genl_family_cancel (nl80211, wiphy_cmd_id);
Signature · 1 line
2.32.0
Denis Kenzior
Hi David,
Quoted 8 lines · David Bourgeois
Hi,
We plan to use iwd for an embedded device where we need both station and ap at
the same time. For this we have devices based on the rtl88x2bu driver compiled > to enable the dual phy. This works well, the dongle is detected as 2 different interfaces wlan0 and wlan1 and both work properly. IWD doesn't always detect
both interfaces though when the dongle is plugged. If IWD is restarted, then
most of the time both interfaces are detected. When the dongle is plugged at
boot it also works most of the time.
We still need to test this better here, but can you try the patch I just sent out:
[PATCH] manager: Refine filtered dumps
Regards,
-Denis
David Bourgeois
Hi Denis,
I confirm that the patch solves the problem, it works all the time with it.
Thank you for that.
Regards,
David
Quoted 32 lines · Denis Kenzior
Hi David,
Quoted 3 lines · David Bourgeois
Hi,
We plan to use iwd for an embedded device where we need both station and
ap at
Quoted 1 line
the same time. For this we have devices based on the rtl88x2bu driver
compiled > to enable the dual phy. This works well, the dongle is detected as 2 different
Quoted 1 line
interfaces wlan0 and wlan1 and both work properly. IWD doesn't always
detect
Quoted 1 line
both interfaces though when the dongle is plugged. If IWD is restarted,
then
Quoted 1 line
most of the time both interfaces are detected. When the dongle is
plugged at
Quoted 1 line
boot it also works most of the time.
We still need to test this better here, but can you try the patch I just sent out:
[PATCH] manager: Refine filtered dumpsRegards,
-Denis
_______________________________________________
iwd mailing list -- iwd(a)lists.01.org
To unsubscribe send an email to iwd-leave(a)lists.01.org