Skip to content

WiFi_OnOff: improve wait handling for delayed interface creation#482

Merged
bhargav0610 merged 1 commit into
qualcomm-linux:mainfrom
smuppand:wifi-connectivity
Jun 8, 2026
Merged

WiFi_OnOff: improve wait handling for delayed interface creation#482
bhargav0610 merged 1 commit into
qualcomm-linux:mainfrom
smuppand:wifi-connectivity

Conversation

@smuppand

@smuppand smuppand commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Improve WiFi interface discovery robustness for WiFi_OnOff by allowing more time for delayed WiFi netdev creation in LAVA/CI environments.

Why

WiFi_OnOff can fail in LAVA even when the WiFi stack is present:

  • required WiFi kernel configs are enabled
  • WiFi-related modules are loaded
  • no WiFi probe/runtime failures are detected
  • but no wlan*/WiFi interface appears within the current wait window

This can happen because driver/module visibility, firmware initialization, cfg80211 PHY registration, and netdev creation are asynchronous. In automated CI, the interface may appear later than the current 30-second wait.

bhargav0610
bhargav0610 previously approved these changes Jun 4, 2026
@qcom-anilyada

Copy link
Copy Markdown
Contributor

@smuppand

smuppand commented Jun 4, 2026

Copy link
Copy Markdown
Contributor Author

@smuppand smuppand requested a review from bhargav0610 June 5, 2026 04:05
Comment thread Runner/utils/lib_connectivity.sh Outdated

case "$max_wait" in
''|*[!0-9]*)
max_wait=30

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be updated to 60 too?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be updated to 60 too?

Addressed. I updated the helper default and fallback wait values to 60s so direct callers of wait_for_wifi_interface() behave consistently with WiFi_OnOff/run.sh.

;;
esac

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra white-space

;;
esac

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra white-space

Comment thread Runner/utils/lib_connectivity.sh Outdated

if command -v udevadm >/dev/null 2>&1; then
log_info "No WiFi interface yet; triggering net uevents and waiting for udev settle"
udevadm trigger --subsystem-match=net >/dev/null 2>&1 || true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will re-trigger on all network interfaces, which are already settled.
Perhaps this can be done

udevadm trigger --action=add --subsystem-match=net >/dev/null 2>&1 || true

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will re-trigger on all network interfaces, which are already settled. Perhaps this can be done

udevadm trigger --action=add --subsystem-match=net >/dev/null 2>&1 || true

Addressed. Updated the trigger to use --action=add with --subsystem-match=net so it is more targeted.

Comment thread Runner/utils/lib_connectivity.sh Outdated

# Keep stdout reserved for the detected interface name. This helper is
# commonly used through command substitution, so all diagnostics from the
# wait loop must go to stderr. The final interface is printed through fd 3,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the README be also updated to let the user know that fd 3 is in use and they cannot use it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the README be also updated to let the user know that fd 3 is in use and they cannot use it.

Good point. I removed the fd 3 usage completely, so no README update is needed. The helper now sends diagnostics explicitly to stderr and keeps stdout reserved only for the detected interface name.

In LAVA, WiFi driver modules can be visible before the cfg80211 PHY or
wlan netdev has been created. The current wait_for_wifi_interface()
helper only polls get_wifi_interface() for 30 seconds, which can fail
early on systems where firmware, udev, or netdev creation completes
later.

Update wait_for_wifi_interface() to trigger net uevents, wait for udev
settle when available, keep polling for the configured timeout, and emit
periodic wait progress logs. Also increase the WiFi_OnOff default wait
window to 60 seconds while preserving the existing WIFI_WAIT_SECS
environment override.

This keeps the CI policy strict: if the WiFi stack is present but no
usable interface appears after retries, the test still fails. The change
only reduces false failures caused by asynchronous driver/firmware/netdev
initialization timing.

Signed-off-by: Srikanth Muppandam <smuppand@qti.qualcomm.com>
@smuppand smuppand force-pushed the wifi-connectivity branch from 7499f9a to 8c0b837 Compare June 7, 2026 03:23
@bhargav0610 bhargav0610 merged commit 35b546b into qualcomm-linux:main Jun 8, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants