• Johannes Berg's avatar
    iwlwifi: mvm: avoid static queue number aliasing · c6ce1c74
    Johannes Berg authored
    When TVQM is enabled (iwl_mvm_has_new_tx_api() is true), then
    queue numbers are just sequentially assigned 0, 1, 2, ...
    Prior to TVQM, in DQA, there were some statically allocated
    queue numbers:
     * IWL_MVM_DQA_AUX_QUEUE == 1,
     * both IWL_MVM_DQA_INJECT_MONITOR_QUEUE and
       IWL_MVM_DQA_P2P_DEVICE_QUEUE == 2, and
     * IWL_MVM_DQA_AP_PROBE_RESP_QUEUE == 9.
    
    Now, these values are assigned to the members mvm->aux_queue,
    mvm->snif_queue, mvm->probe_queue and mvm->p2p_dev_queue by
    default. Normally, this doesn't really matter, and if TVQM is
    in fact available we override them to the real values after
    allocating a queue for use there.
    
    However, this allocation doesn't always happen. For example,
    for mvm->p2p_dev_queue (== 2) it only happens when the P2P
    Device interface is started, if any. If it's not started, the
    value in mvm->p2p_dev_queue remains 2. This wouldn't really
    matter all that much if it weren't for iwl_mvm_is_static_queue()
    which checks a queue number against one of those four static
    numbers.
    
    Now, if no P2P Device or monitor interface is added then queue
    2 may be dynamically allocated, yet alias mvm->p2p_dev_queue or
    mvm->snif_queue, and thus iwl_mvm_is_static_queue() erroneously
    returns true for it. If it then gets full, all interface queues
    are stopped, instead of just backpressuring against the one TXQ
    that's really the only affected one.
    
    This clearly can lead to issues, as everything is stopped even
    if just a single TXQ filled its corresponding HW queue, if it
    happens to have an appropriate number (2 or 9, AUX is always
    reassigned.) Due to a mac80211 bug, this also led to a situation
    in which the queues remained stopped across a deauthentication
    and then attempts to connect to a new AP started failing, but
    that's fixed separately.
    
    Fix all of this by simply initializing the queue numbers to
    the invalid value until they're used, if TVQM is enabled, and
    also setting them back to that value when the queues are later
    freed again.
    Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
    Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
    Link: https://lore.kernel.org/r/iwlwifi.20210802172232.2e47e623f9e2.I9b0830dafbb68ef35b7b8f0f46160abec02ac7d0@changeidSigned-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
    c6ce1c74
ops.c 45.7 KB