aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/mvm/quota.c
diff options
context:
space:
mode:
authorIlan Peer <ilan.peer@intel.com>2013-02-04 06:16:24 -0500
committerJohannes Berg <johannes.berg@intel.com>2013-02-11 05:54:16 -0500
commit35adfd6e458741d3d3fca1ce0e342919eb250c2b (patch)
tree4cf385b592e41f4656d0b23deb1d6eaf7e920594 /drivers/net/wireless/iwlwifi/mvm/quota.c
parent2bfb50924c7e92362ac937aef2ab56bc7bd3ca52 (diff)
iwlwifi: mvm: Update quota settings for all bindings
The FW scheduler, schedules the bindings over a session of 128 fragments (each is 4 TU long). The quota command should allocate all the session fragments between all the bindings that require quota allocation. Currently, use static allocation, where the fragments are equally distributed between all data bindings. Note, that not allocating all the session's fragments might cause the FW scheduler to leave the medium unused. Signed-off-by: Ilan Peer <ilan.peer@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/mvm/quota.c')
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/quota.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/quota.c b/drivers/net/wireless/iwlwifi/mvm/quota.c
index 2d4611a563c5..925628468146 100644
--- a/drivers/net/wireless/iwlwifi/mvm/quota.c
+++ b/drivers/net/wireless/iwlwifi/mvm/quota.c
@@ -131,7 +131,7 @@ static void iwl_mvm_quota_iterator(void *_data, u8 *mac,
131int iwl_mvm_update_quotas(struct iwl_mvm *mvm, struct ieee80211_vif *newvif) 131int iwl_mvm_update_quotas(struct iwl_mvm *mvm, struct ieee80211_vif *newvif)
132{ 132{
133 struct iwl_time_quota_cmd cmd; 133 struct iwl_time_quota_cmd cmd;
134 int i, idx, ret; 134 int i, idx, ret, num_active_bindings, quota, quota_rem;
135 struct iwl_mvm_quota_iterator_data data = { 135 struct iwl_mvm_quota_iterator_data data = {
136 .n_interfaces = {}, 136 .n_interfaces = {},
137 .colors = { -1, -1, -1, -1 }, 137 .colors = { -1, -1, -1, -1 },
@@ -156,20 +156,39 @@ int iwl_mvm_update_quotas(struct iwl_mvm *mvm, struct ieee80211_vif *newvif)
156 iwl_mvm_quota_iterator(&data, newvif->addr, newvif); 156 iwl_mvm_quota_iterator(&data, newvif->addr, newvif);
157 } 157 }
158 158
159 /*
160 * The FW's scheduling session consists of
161 * IWL_MVM_MAX_QUOTA fragments. Divide these fragments
162 * equally between all the bindings that require quota
163 */
164 num_active_bindings = 0;
165 for (i = 0; i < MAX_BINDINGS; i++) {
166 cmd.quotas[i].id_and_color = cpu_to_le32(FW_CTXT_INVALID);
167 if (data.n_interfaces[i] > 0)
168 num_active_bindings++;
169 }
170
171 if (!num_active_bindings)
172 goto send_cmd;
173
174 quota = IWL_MVM_MAX_QUOTA / num_active_bindings;
175 quota_rem = IWL_MVM_MAX_QUOTA % num_active_bindings;
176
159 for (idx = 0, i = 0; i < MAX_BINDINGS; i++) { 177 for (idx = 0, i = 0; i < MAX_BINDINGS; i++) {
160 if (data.n_interfaces[i] <= 0) 178 if (data.n_interfaces[i] <= 0)
161 continue; 179 continue;
162 180
163 cmd.quotas[idx].id_and_color = 181 cmd.quotas[idx].id_and_color =
164 cpu_to_le32(FW_CMD_ID_AND_COLOR(i, data.colors[i])); 182 cpu_to_le32(FW_CMD_ID_AND_COLOR(i, data.colors[i]));
165 cmd.quotas[idx].quota = cpu_to_le32(100); 183 cmd.quotas[idx].quota = cpu_to_le32(quota);
166 cmd.quotas[idx].max_duration = cpu_to_le32(1000); 184 cmd.quotas[idx].max_duration = cpu_to_le32(IWL_MVM_MAX_QUOTA);
167 idx++; 185 idx++;
168 } 186 }
169 187
170 for (i = idx; i < MAX_BINDINGS; i++) 188 /* Give the remainder of the session to the first binding */
171 cmd.quotas[i].id_and_color = cpu_to_le32(FW_CTXT_INVALID); 189 le32_add_cpu(&cmd.quotas[0].quota, quota_rem);
172 190
191send_cmd:
173 ret = iwl_mvm_send_cmd_pdu(mvm, TIME_QUOTA_CMD, CMD_SYNC, 192 ret = iwl_mvm_send_cmd_pdu(mvm, TIME_QUOTA_CMD, CMD_SYNC,
174 sizeof(cmd), &cmd); 193 sizeof(cmd), &cmd);
175 if (ret) 194 if (ret)