Skip to content

Commit

Permalink
iwlwifi: mvm: Fix quota command settings
Browse files Browse the repository at this point in the history
According to the FW implementation, the quota command should
have a valid entry for each active binding (where 'active' in
this context means that the binding is known to the FW). In case
the binding should not get any quota, the 'quota' should be set
to zero.

Not setting an 0 quota for an active binding when all the MACs
in the binding are idle, i.e., not associated in case of managed
interface, will result in preventing the FW scheduler from entering
IDLE state and the FW from transitioning to low PS.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  • Loading branch information
Ilan Peer authored and Johannes Berg committed Jun 4, 2013
1 parent 1094fa2 commit 8d683b7
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions drivers/net/wireless/iwlwifi/mvm/quota.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,27 +169,34 @@ int iwl_mvm_update_quotas(struct iwl_mvm *mvm, struct ieee80211_vif *newvif)
num_active_bindings++;
}

if (!num_active_bindings)
goto send_cmd;

quota = IWL_MVM_MAX_QUOTA / num_active_bindings;
quota_rem = IWL_MVM_MAX_QUOTA % num_active_bindings;
quota = 0;
quota_rem = 0;
if (num_active_bindings) {
quota = IWL_MVM_MAX_QUOTA / num_active_bindings;
quota_rem = IWL_MVM_MAX_QUOTA % num_active_bindings;
}

for (idx = 0, i = 0; i < MAX_BINDINGS; i++) {
if (data.n_interfaces[i] <= 0)
if (data.colors[i] < 0)
continue;

cmd.quotas[idx].id_and_color =
cpu_to_le32(FW_CMD_ID_AND_COLOR(i, data.colors[i]));
cmd.quotas[idx].quota = cpu_to_le32(quota);
cmd.quotas[idx].max_duration = cpu_to_le32(IWL_MVM_MAX_QUOTA);

if (data.n_interfaces[i] <= 0) {
cmd.quotas[idx].quota = cpu_to_le32(0);
cmd.quotas[idx].max_duration = cpu_to_le32(0);
} else {
cmd.quotas[idx].quota = cpu_to_le32(quota);
cmd.quotas[idx].max_duration =
cpu_to_le32(IWL_MVM_MAX_QUOTA);
}
idx++;
}

/* Give the remainder of the session to the first binding */
le32_add_cpu(&cmd.quotas[0].quota, quota_rem);

send_cmd:
ret = iwl_mvm_send_cmd_pdu(mvm, TIME_QUOTA_CMD, CMD_SYNC,
sizeof(cmd), &cmd);
if (ret)
Expand Down

0 comments on commit 8d683b7

Please sign in to comment.