summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/mvm/quota.c
diff options
context:
space:
mode:
authorLuciano Coelho <luciano.coelho@intel.com>2014-05-13 22:28:35 +0300
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>2014-07-07 21:41:13 +0300
commit63cbe180f8bfcf355516b09849c71fed19e035b3 (patch)
tree65de9413cb9aa84b27ba9b51e1038f20c2e1499d /drivers/net/wireless/iwlwifi/mvm/quota.c
parentca55eb47822560e56b126eeb05b3cd0b8415acfd (diff)
downloadblackbird-op-linux-63cbe180f8bfcf355516b09849c71fed19e035b3.tar.gz
blackbird-op-linux-63cbe180f8bfcf355516b09849c71fed19e035b3.zip
iwlwifi: mvm: let iwl_mvm_update_quotas disregard a disabled vif
In some cases (e.g. when we're doing a channel switch), we may need to disable the quota of a vif temporarily. In order to do so, add an argument to the iwl_mvm_update_quotas() function to tell if the passed vif is a new one or if it should be disregarded. Signed-off-by: Luciano Coelho <luciano.coelho@intel.com> Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/mvm/quota.c')
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/quota.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/quota.c b/drivers/net/wireless/iwlwifi/mvm/quota.c
index ba68d7b84505..75d2c95b4076 100644
--- a/drivers/net/wireless/iwlwifi/mvm/quota.c
+++ b/drivers/net/wireless/iwlwifi/mvm/quota.c
@@ -73,7 +73,8 @@ struct iwl_mvm_quota_iterator_data {
int colors[MAX_BINDINGS];
int low_latency[MAX_BINDINGS];
int n_low_latency_bindings;
- struct ieee80211_vif *new_vif;
+ struct ieee80211_vif *vif;
+ enum iwl_mvm_quota_update_type type;
};
static void iwl_mvm_quota_iterator(void *_data, u8 *mac,
@@ -89,7 +90,7 @@ static void iwl_mvm_quota_iterator(void *_data, u8 *mac,
* the add_interface callback (otherwise it won't show
* up in iteration)
*/
- if (vif == data->new_vif)
+ if (data->type == IWL_MVM_QUOTA_UPDATE_TYPE_NEW && vif == data->vif)
return;
if (!mvmvif->phy_ctxt)
@@ -109,6 +110,10 @@ static void iwl_mvm_quota_iterator(void *_data, u8 *mac,
else
WARN_ON_ONCE(data->colors[id] != mvmvif->phy_ctxt->color);
+ if (data->type == IWL_MVM_QUOTA_UPDATE_TYPE_DISABLED &&
+ vif == data->vif)
+ return;
+
switch (vif->type) {
case NL80211_IFTYPE_STATION:
if (vif->bss_conf.assoc)
@@ -171,14 +176,16 @@ static void iwl_mvm_adjust_quota_for_noa(struct iwl_mvm *mvm,
#endif
}
-int iwl_mvm_update_quotas(struct iwl_mvm *mvm, struct ieee80211_vif *newvif)
+int iwl_mvm_update_quotas(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
+ enum iwl_mvm_quota_update_type type)
{
struct iwl_time_quota_cmd cmd = {};
int i, idx, ret, num_active_macs, quota, quota_rem, n_non_lowlat;
struct iwl_mvm_quota_iterator_data data = {
.n_interfaces = {},
.colors = { -1, -1, -1, -1 },
- .new_vif = newvif,
+ .vif = vif,
+ .type = type,
};
lockdep_assert_held(&mvm->mutex);
@@ -190,12 +197,17 @@ int iwl_mvm_update_quotas(struct iwl_mvm *mvm, struct ieee80211_vif *newvif)
/* iterator data above must match */
BUILD_BUG_ON(MAX_BINDINGS != 4);
+ if (WARN_ON_ONCE((type != IWL_MVM_QUOTA_UPDATE_TYPE_REGULAR && !vif) ||
+ (type == IWL_MVM_QUOTA_UPDATE_TYPE_REGULAR && vif)))
+ return -EINVAL;
+
ieee80211_iterate_active_interfaces_atomic(
mvm->hw, IEEE80211_IFACE_ITER_NORMAL,
iwl_mvm_quota_iterator, &data);
- if (newvif) {
- data.new_vif = NULL;
- iwl_mvm_quota_iterator(&data, newvif->addr, newvif);
+ if (type == IWL_MVM_QUOTA_UPDATE_TYPE_NEW) {
+ data.vif = NULL;
+ data.type = IWL_MVM_QUOTA_UPDATE_TYPE_REGULAR;
+ iwl_mvm_quota_iterator(&data, vif->addr, vif);
}
/*
OpenPOWER on IntegriCloud