8000 extmod/network_cyw43: Disconnect STA if making inactive. by projectgus · Pull Request #17305 · micropython/micropython · GitHub
[go: up one dir, main page]

Skip to content

extmod/network_cyw43: Disconnect STA if making inactive. #17305

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

projectgus
Copy link
Contributor

Summary

esp32 port will disconnect if active(0) is called on a STA interface, but rp2 port stays associated without this change.

Noticed while running multi_wlan tests for #17272 with a boot.py file in place that associates to my local network, as this test currently calls active(0) during init to disable any previous activity.

This work was funded through GitHub Sponsors.

Testing

  • Re-ran multi_wlan tests on RPI_PICO_W and RPI_PICO2_W with this change and a boot.py that associates to my local network. These tests now pass. Didn't test cyw43 on other ports, but happy to test more if necessary.
  • Did some manual testing to confirm that it's safe to call cyw43_wifi_leave() in corner cases (when interface inactive, already disconnected, mid-connection attempt, etc.) It does occasionally seem to report join state after being made inactive part-way through a connection attempt, which might indicate a driver race/bug(?) However it's generally consistent, and I think this change is still an improvement.

Trade-offs and Alternatives

  • Possibly this fix should be pushed down one layer into the CYW43 driver? Calling cyw43_wifi_set_up(..., CYW43_ITF_STA, false, ...) currently a no-op.

@projectgus projectgus added extmod Relates to extmod/ directory in source port-rp2 labels May 15, 2025
Copy link
codecov bot commented May 15, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.54%. Comparing base (9ef16b4) to head (186caf9).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #17305   +/-   ##
=======================================
  Coverage   98.54%   98.54%           
=======================================
  Files         169      169           
  Lines       21898    21898           
=======================================
  Hits        21579    21579           
  Misses        319      319           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

Code size report:

   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64:    +0 +0.000% standard
      stm32:    +0 +0.000% PYBV10
     mimxrt:    +0 +0.000% TEENSY40
        rp2:   +16 +0.002% RPI_PICO_W
       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS
  qemu rv32:    +0 +0.000% VIRT_RV32

@dpgeorge
Copy link
Member
  • Possibly this fix should be pushed down one layer into the CYW43 driver? Calling cyw43_wifi_set_up(..., CYW43_ITF_STA, false, ...) currently a no-op.

That's true, it is a no-op for STA deinit.

But I think that's fair enough, it's a low-level driver that does just what it needs to.

esp32 port will disconnect if active(0) is called on a STA
interface, but rp2 port stays associated without this change.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
@dpgeorge dpgeorge force-pushed the bugfix/cyw43_disconnect_inactive branch from 5ac1f87 to 186caf9 Compare May 20, 2025 13:15
@dpgeorge dpgeorge merged commit 186caf9 into micropython:master May 20, 2025
63 checks passed
@projectgus projectgus deleted the bugfix/cyw43_disconnect_inactive branch May 20, 2025 23:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extmod Relates to extmod/ directory in source port-rp2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0