Skip to content

WiFi_OnOff: add bounded recovery for missing WiFi interface#490

Merged
bhargav0610 merged 2 commits into
qualcomm-linux:mainfrom
smuppand:wifi-connectivity
Jun 13, 2026
Merged

WiFi_OnOff: add bounded recovery for missing WiFi interface#490
bhargav0610 merged 2 commits into
qualcomm-linux:mainfrom
smuppand:wifi-connectivity

Conversation

@smuppand

@smuppand smuppand commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Improve WiFi_OnOff robustness for intermittent cases where WiFi modules are loaded but no WiFi interface is exposed before the wait timeout.

The test can intermittently fail in LAVA even though WiFi kernel configs and modules are present. In these cases, no usable WiFi runtime object is exposed:
no WiFi interface from get_wifi_interface
empty iw dev
empty iw phy
empty /sys/class/ieee80211

Sample lava job for reference https://lava.infra.foundries.io/scheduler/job/263091

smuppand added 2 commits June 12, 2026 09:35
WiFi_OnOff can intermittently fail when WiFi modules are loaded but no
wlan interface is created before the wait timeout. The existing
wait_for_wifi_interface() only unblocks rfkill and triggers udev once, so
it does not recover cases where the WiFi leaf driver needs a soft reprobe.

Extend wait_for_wifi_interface() to perform one controlled reload of a
loaded WiFi leaf driver module after the interface has not appeared for a
bounded time. The recovery path is limited to WiFi leaf/platform modules
and intentionally avoids shared modules such as cfg80211, mac80211, and
mhi.

Also tighten wifi_stack_present() so it reports success only when runtime
WiFi evidence exists, such as a wlan netdev, ieee80211 phy, iw phy/dev
output, or wireless sysfs markers. Module-only state no longer causes
missing-interface paths to be treated as a real WiFi runtime stack.

All diagnostic logging from wait_for_wifi_interface() is kept on stderr so
callers using command substitution receive only the interface name on
stdout.

Signed-off-by: Srikanth Muppandam <smuppand@qti.qualcomm.com>
Update WiFi_OnOff to use the enhanced WiFi interface wait/recovery flow
from lib_connectivity.sh.

Add runtime knobs for the bounded recovery path:
- WIFI_RECOVERY_RELOAD
- WIFI_RECOVERY_RELOAD_AFTER_S

Also narrow the default DT match patterns to avoid treating Bluetooth-only
compatible strings such as qcom,wcn6855-bt as WiFi DT evidence. The test
now prefers WiFi-specific patterns such as ath12k, ath11k, ath10k, wifi,
wlan, and qca.

When no WiFi interface is found after wait/recovery, classify the result
more accurately:
- fail if WiFi probe/runtime errors are detected
- fail if a runtime WiFi stack is exposed but no usable interface is found
- skip if only module-level evidence exists and no WiFi phy/netdev/runtime
  object is exposed

This keeps real WiFi driver failures visible while avoiding misleading
failures when no WiFi runtime device is registered.

Signed-off-by: Srikanth Muppandam <smuppand@qti.qualcomm.com>
@smuppand smuppand requested a review from bhargav0610 June 12, 2026 16:42

log_warn "No WiFi interface after ${waited}s; attempting one controlled reload of $mod" >&2

if modprobe -r "$mod" >/dev/null 2>&1; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do test script reload the module here? Isnt it needs to be taken care by Kernel to safely loada modules on bootup? or by udev?

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.

Why do test script reload the module here? Isnt it needs to be taken care by Kernel to safely loada modules on bootup? or by udev?

we do not reload modules during the normal path.

  1. Wait for WiFi interface normally

    • rfkill unblock
    • get_wifi_interface retry
    • udev trigger/settle
  2. If interface appears

    • no module reload
    • continue toggle test
  3. Only if interface does not appear after part of the wait

    • attempt one controlled reload
    • only for an already-loaded WiFi leaf driver module

@bhargav0610 bhargav0610 merged commit 6e9150d into qualcomm-linux:main Jun 13, 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.

3 participants