iwlwifi: mvm: Send non offchannel traffic via AP sta
authorAndrei Otcheretianski <andrei.otcheretianski@intel.com>
Tue, 24 Jul 2018 18:57:50 +0000 (21:57 +0300)
committerLuca Coelho <luciano.coelho@intel.com>
Sun, 11 Nov 2018 09:06:20 +0000 (11:06 +0200)
TDLS discovery response frame is a unicast direct frame to the peer.
Since we don't have a STA for this peer, this frame goes through
iwl_tx_skb_non_sta(). As the result aux_sta and some completely
arbitrary queue would be selected for this frame, resulting in a queue
hang.  Fix that by sending such frames through AP sta instead.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c

index 5bdc638fc99981ae0aea9b0e98506fe243524a86..55b965629e33f2cff3a78c45bdea4fe4d6775a05 100644 (file)
@@ -809,6 +809,21 @@ static void iwl_mvm_mac_tx(struct ieee80211_hw *hw,
            !ieee80211_is_bufferable_mmpdu(hdr->frame_control))
                sta = NULL;
 
+       /* If there is no sta, and it's not offchannel - send through AP */
+       if (info->control.vif->type == NL80211_IFTYPE_STATION &&
+           info->hw_queue != IWL_MVM_OFFCHANNEL_QUEUE && !sta) {
+               struct iwl_mvm_vif *mvmvif =
+                       iwl_mvm_vif_from_mac80211(info->control.vif);
+               u8 ap_sta_id = READ_ONCE(mvmvif->ap_sta_id);
+
+               if (ap_sta_id < IWL_MVM_STATION_COUNT) {
+                       /* mac80211 holds rcu read lock */
+                       sta = rcu_dereference(mvm->fw_id_to_mac_id[ap_sta_id]);
+                       if (IS_ERR_OR_NULL(sta))
+                               goto drop;
+               }
+       }
+
        if (sta) {
                if (iwl_mvm_defer_tx(mvm, sta, skb))
                        return;