iwlwifi: mvm: fix a few firmware capability checks
[cascardo/linux.git] / drivers / net / wireless / intel / iwlwifi / mvm / mac80211.c
index 6286063..18a8474 100644 (file)
@@ -229,7 +229,11 @@ void iwl_mvm_unref(struct iwl_mvm *mvm, enum iwl_mvm_ref_type ref_type)
 
        IWL_DEBUG_RPM(mvm, "Leave mvm reference - type %d\n", ref_type);
        spin_lock_bh(&mvm->refs_lock);
-       WARN_ON(!mvm->refs[ref_type]--);
+       if (WARN_ON(!mvm->refs[ref_type])) {
+               spin_unlock_bh(&mvm->refs_lock);
+               return;
+       }
+       mvm->refs[ref_type]--;
        spin_unlock_bh(&mvm->refs_lock);
        iwl_trans_unref(mvm->trans);
 }
@@ -442,10 +446,16 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
        if (iwl_mvm_has_new_rx_api(mvm))
                ieee80211_hw_set(hw, SUPPORTS_REORDERING_BUFFER);
 
+       if (mvm->trans->num_rx_queues > 1)
+               ieee80211_hw_set(hw, USES_RSS);
+
        if (mvm->trans->max_skb_frags)
                hw->netdev_features = NETIF_F_HIGHDMA | NETIF_F_SG;
 
-       hw->queues = mvm->first_agg_queue;
+       if (!iwl_mvm_is_dqa_supported(mvm))
+               hw->queues = mvm->first_agg_queue;
+       else
+               hw->queues = IEEE80211_MAX_QUEUES;
        hw->offchannel_tx_hw_queue = IWL_MVM_OFFCHANNEL_QUEUE;
        hw->radiotap_mcs_details |= IEEE80211_RADIOTAP_MCS_HAVE_FEC |
                                    IEEE80211_RADIOTAP_MCS_HAVE_STBC;
@@ -3841,8 +3851,8 @@ static int iwl_mvm_mac_get_survey(struct ieee80211_hw *hw, int idx,
        if (idx != 0)
                return -ENOENT;
 
-       if (fw_has_capa(&mvm->fw->ucode_capa,
-                       IWL_UCODE_TLV_CAPA_RADIO_BEACON_STATS))
+       if (!fw_has_capa(&mvm->fw->ucode_capa,
+                        IWL_UCODE_TLV_CAPA_RADIO_BEACON_STATS))
                return -ENOENT;
 
        mutex_lock(&mvm->mutex);
@@ -3888,8 +3898,8 @@ static void iwl_mvm_mac_sta_statistics(struct ieee80211_hw *hw,
        struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
        struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
 
-       if (fw_has_capa(&mvm->fw->ucode_capa,
-                       IWL_UCODE_TLV_CAPA_RADIO_BEACON_STATS))
+       if (!fw_has_capa(&mvm->fw->ucode_capa,
+                        IWL_UCODE_TLV_CAPA_RADIO_BEACON_STATS))
                return;
 
        /* if beacon filtering isn't on mac80211 does it anyway */