• Johannes Berg's avatar
    wifi: iwlwifi: mvm: increase session protection after CSA · 11d0d831
    Johannes Berg authored
    
    
    In the spec, CSA is defined roughly as follows:
     - TBTT x:     beacon with CSA, count=n   (old channel)
     - TBTT x+1:   beacon with CSA, count=n-1 (old channel)
     - TBTT x+n-1: beacon with CSA, count=1   (old channel)
     "A Channel Switch Count field set to 1 indicates that the switch
      occurs immediately before the next TBTT.
     - TBTT x+n:   beacon without CSA         (new channel)
    
    When we detect it, we currently schedule the CSA event to
    be at 10 TUs before TBTT x+n-1, for a beacon interval, to
    give us quiet time.
    
    When this event *starts*, we currently notify mac80211
    that the channel switch happened, which causes us to add
    a session protection event to listen for the first beacon
    (and enable TX etc. when that arrives).
    
    We don't even ask for a notification when this event ends
    so the code that handles that is effectively dead code.
    
    The session protection duration is 3 beacon intervals,
    scheduled at 10 TU before TBTT x+n-1. It will thus end
    just before TBTT x+n+2.
    
    Unfortunately, if the AP doesn't transmit or we miss just
    the first two beacons on the new channel, then this will
    cause us to disconnect. Or even just one, if the AP isn't
    quite aligned with the TBTT after the switch.
    
    However, listening to the _end_ of the time event isn't
    what we want either, because we want all the new PHY and
    other config that needs to come from mac80211 to start
    early, so we have a head-start for the new channel, since
    we're not going to use the old one anyway for this time.
    
    So since we don't really have anything better to do at
    this time, and this is relatively rare, just make the
    session protection use 5x the beacon interval instead of
    just 3x, so it's more likely we catch a beacon even if
    the AP neglected to send it, or we just miss it.
    Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
    Signed-off-by: default avatarGregory Greenman <gregory.greenman@intel.com>
    Link: https://lore.kernel.org/r/20230830112059.a74176bac37c.I029a2ebcd1b5012327c728ffa1d33fac19cfdf4b@changeid
    
    Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
    11d0d831
mac80211.c 174 KB