Merge git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers.git
[platform/kernel/linux-starfive.git] / drivers / net / wireless / intel / iwlwifi / mvm / mac80211.c
index 90f8c89..5f0701c 100644 (file)
@@ -953,6 +953,16 @@ static int iwl_mvm_mac_ampdu_action(struct ieee80211_hw *hw,
 
        switch (action) {
        case IEEE80211_AMPDU_RX_START:
+               if (iwl_mvm_vif_from_mac80211(vif)->ap_sta_id ==
+                               iwl_mvm_sta_from_mac80211(sta)->sta_id) {
+                       struct iwl_mvm_vif *mvmvif;
+                       u16 macid = iwl_mvm_vif_from_mac80211(vif)->id;
+                       struct iwl_mvm_tcm_mac *mdata = &mvm->tcm.data[macid];
+
+                       mdata->opened_rx_ba_sessions = true;
+                       mvmvif = iwl_mvm_vif_from_mac80211(vif);
+                       cancel_delayed_work(&mvmvif->uapsd_nonagg_detected_wk);
+               }
                if (!iwl_enable_rx_ampdu(mvm->cfg)) {
                        ret = -EINVAL;
                        break;
@@ -1436,6 +1446,8 @@ static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw,
                mvm->p2p_device_vif = vif;
        }
 
+       iwl_mvm_tcm_add_vif(mvm, vif);
+
        if (vif->type == NL80211_IFTYPE_MONITOR)
                mvm->monitor_on = true;
 
@@ -1487,6 +1499,10 @@ static void iwl_mvm_mac_remove_interface(struct ieee80211_hw *hw,
 
        iwl_mvm_prepare_mac_removal(mvm, vif);
 
+       if (!(vif->type == NL80211_IFTYPE_AP ||
+             vif->type == NL80211_IFTYPE_ADHOC))
+               iwl_mvm_tcm_rm_vif(mvm, vif);
+
        mutex_lock(&mvm->mutex);
 
        if (mvm->bf_allowed_vif == mvmvif) {
@@ -2536,6 +2552,16 @@ static void iwl_mvm_sta_pre_rcu_remove(struct ieee80211_hw *hw,
 static void iwl_mvm_check_uapsd(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
                                const u8 *bssid)
 {
+       int i;
+
+       if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) {
+               struct iwl_mvm_tcm_mac *mdata;
+
+               mdata = &mvm->tcm.data[iwl_mvm_vif_from_mac80211(vif)->id];
+               ewma_rate_init(&mdata->uapsd_nonagg_detect.rate);
+               mdata->opened_rx_ba_sessions = false;
+       }
+
        if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_UAPSD_SUPPORT))
                return;
 
@@ -2550,6 +2576,13 @@ static void iwl_mvm_check_uapsd(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
                return;
        }
 
+       for (i = 0; i < IWL_MVM_UAPSD_NOAGG_LIST_LEN; i++) {
+               if (ether_addr_equal(mvm->uapsd_noagg_bssids[i].addr, bssid)) {
+                       vif->driver_flags &= ~IEEE80211_VIF_SUPPORTS_UAPSD;
+                       return;
+               }
+       }
+
        vif->driver_flags |= IEEE80211_VIF_SUPPORTS_UAPSD;
 }