aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/mvm/quota.c
diff options
context:
space:
mode:
authorIlan Peer <ilan.peer@intel.com>2014-01-19 11:38:39 +0200
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>2014-02-03 22:23:37 +0200
commit7b4fe06c25a1a37ba393e791012f3b01c70e674a (patch)
tree551f28a11d06e9bc5889f7fb3739f83941645a1b /drivers/net/wireless/iwlwifi/mvm/quota.c
parentiwlwifi: mvm: add the quota remainder to a data binding (diff)
downloadlinux-dev-7b4fe06c25a1a37ba393e791012f3b01c70e674a.tar.xz
linux-dev-7b4fe06c25a1a37ba393e791012f3b01c70e674a.zip
iwlwifi: mvm: fix quota allocation
Divide the maximal quota between all the data interfaces even in the case of a single low latency binding without any other non low latency interfaces, so that afterwards the quota allocation (which considers the number of data interfaces) will be correct. Signed-off-by: Ilan Peer <ilan.peer@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.c36
1 files changed, 28 insertions, 8 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/quota.c b/drivers/net/wireless/iwlwifi/mvm/quota.c
index f07ae483aa31..06d8429be1fb 100644
--- a/drivers/net/wireless/iwlwifi/mvm/quota.c
+++ b/drivers/net/wireless/iwlwifi/mvm/quota.c
@@ -234,15 +234,24 @@ int iwl_mvm_update_quotas(struct iwl_mvm *mvm, struct ieee80211_vif *newvif)
break;
}
}
- if (n_non_lowlat) {
- quota = (QUOTA_100 - QUOTA_LOWLAT_MIN) / n_non_lowlat;
- quota_rem = QUOTA_100 - n_non_lowlat * quota -
- QUOTA_LOWLAT_MIN;
- } else {
- quota = QUOTA_100;
- quota_rem = 0;
- }
+ }
+
+ if (data.n_low_latency_bindings == 1 && n_non_lowlat) {
+ /*
+ * Reserve quota for the low latency binding in case that
+ * there are several data bindings but only a single
+ * low latency one. Split the rest of the quota equally
+ * between the other data interfaces.
+ */
+ quota = (QUOTA_100 - QUOTA_LOWLAT_MIN) / n_non_lowlat;
+ quota_rem = QUOTA_100 - n_non_lowlat * quota -
+ QUOTA_LOWLAT_MIN;
} else if (num_active_macs) {
+ /*
+ * There are 0 or more than 1 low latency bindings, or all the
+ * data interfaces belong to the single low latency binding.
+ * Split the quota equally between the data interfaces.
+ */
quota = QUOTA_100 / num_active_macs;
quota_rem = QUOTA_100 % num_active_macs;
} else {
@@ -262,11 +271,22 @@ int iwl_mvm_update_quotas(struct iwl_mvm *mvm, struct ieee80211_vif *newvif)
cmd.quotas[idx].quota = cpu_to_le32(0);
else if (data.n_low_latency_bindings == 1 && n_non_lowlat &&
data.low_latency[i])
+ /*
+ * There is more than one binding, but only one of the
+ * bindings is in low latency. For this case, allocate
+ * the minimal required quota for the low latency
+ * binding.
+ */
cmd.quotas[idx].quota = cpu_to_le32(QUOTA_LOWLAT_MIN);
+
else
cmd.quotas[idx].quota =
cpu_to_le32(quota * data.n_interfaces[i]);
+ WARN_ONCE(le32_to_cpu(cmd.quotas[idx].quota) > QUOTA_100,
+ "Binding=%d, quota=%u > max=%u\n",
+ idx, le32_to_cpu(cmd.quotas[idx].quota), QUOTA_100);
+
if (data.n_interfaces[i] && !data.low_latency[i])
cmd.quotas[idx].max_duration =
cpu_to_le32(ll_max_duration);