Page MenuHomeFreeBSD

[net80211] Fix interrupted scan logic and ticks comparison
ClosedPublic

Authored by adrian on May 27 2020, 5:16 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Apr 19, 9:56 PM
Unknown Object (File)
Tue, Apr 9, 10:30 PM
Unknown Object (File)
Tue, Apr 9, 4:02 PM
Unknown Object (File)
Tue, Apr 2, 6:35 AM
Unknown Object (File)
Dec 23 2023, 12:09 PM
Unknown Object (File)
Dec 21 2023, 9:02 AM
Unknown Object (File)
Nov 11 2023, 5:20 PM
Unknown Object (File)
Nov 10 2023, 9:24 AM

Details

Summary
  • The scan task refactoring stuff circa 2014-2016 broke the blocking task into a taskqueue with some async bits, but it apparently broke scans being interrupted by traffic.

    Notably - the new "field" SCAN_PAUSE sets both SCAN_INTERRUPT and SCAN_CANCEL, and a bunch of existing code was checking for SCAN_CANCEL only and breaking the scan. Unfortunately it was then (a) cancelling the scan entirely and (b) not notifying userland that scan was done.

    So:
    • Update the calls to scan_end() to only pass in 1 (saying the scan is complete) if SCAN_CANCEL is set WITHOUT SCAN_INTERRUPT. If both are set then yes, the scan is interrupted, but it isn't canceled - it's just paused.
    • Update the "did the scan flags change whilst the driver was called" logic to check for canceled scans, not interrupted scans.
    • the "scan done" logic now explicitly checks for either interrupted or completed scans. This accounts for the situation where a scan is being aborted via traffic but it ALSO happens to have finished (ie the last channel was checked.)

This doesn't ENTIRELY fix scanning as the resume function is broken
due to incorrect ticks math. Thus, the second half of this patch
changes the ieee80211_ticks_*() macros to use int instead of long,
matching the logic that the TCP code does with ticks and handles
wrapping / negative ticks values. If cast to long then the wrapping
math wouldn't work right (ie, if ticks was actually negative,
ie, after the system has been up for a while.)

This allows contbgscan() to correctly calculate if a scan should
continue based on ticks and ic_lastdata .

Test Plan
  • ath(4), AR9380, STA mode

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 31338
Build 28972: arc lint + arc unit

Event Timeline

bz added a subscriber: bz.

Could make the flags bool instead of int but for the sake of minimal change for now, on a quick pass it looks ok.

This revision is now accepted and ready to land.May 27 2020, 5:28 PM

Could make the flags bool instead of int

I'd argue for making that change here actually.

I'd like to land the MVP fix before I do a second pass to tidy this stuff up into separate flags..