iwlwifi: mvm: implement NoA testing using testmode cmd
For testing, implement setting continuous NoA duration using a new MVM-specific testmode command. Signed-off-by: David Spinadel <david.spinadel@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:

committed by
Johannes Berg

parent
272b98c645
commit
507cadf262
@@ -129,6 +129,38 @@ static void iwl_mvm_quota_iterator(void *_data, u8 *mac,
|
||||
}
|
||||
}
|
||||
|
||||
static void iwl_mvm_adjust_quota_for_noa(struct iwl_mvm *mvm,
|
||||
struct iwl_time_quota_cmd *cmd)
|
||||
{
|
||||
#ifdef CONFIG_NL80211_TESTMODE
|
||||
struct iwl_mvm_vif *mvmvif;
|
||||
int i, phy_id = -1, beacon_int = 0;
|
||||
|
||||
if (!mvm->noa_duration || !mvm->noa_vif)
|
||||
return;
|
||||
|
||||
mvmvif = iwl_mvm_vif_from_mac80211(mvm->noa_vif);
|
||||
if (!mvmvif->ap_active)
|
||||
return;
|
||||
|
||||
phy_id = mvmvif->phy_ctxt->id;
|
||||
beacon_int = mvm->noa_vif->bss_conf.beacon_int;
|
||||
|
||||
for (i = 0; i < MAX_BINDINGS; i++) {
|
||||
u32 id_n_c = le32_to_cpu(cmd->quotas[i].id_and_color);
|
||||
u32 id = (id_n_c & FW_CTXT_ID_MSK) >> FW_CTXT_ID_POS;
|
||||
u32 quota = le32_to_cpu(cmd->quotas[i].quota);
|
||||
|
||||
if (id != phy_id)
|
||||
continue;
|
||||
|
||||
quota *= (beacon_int - mvm->noa_duration) / beacon_int;
|
||||
|
||||
cmd->quotas[i].quota = cpu_to_le32(quota);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int iwl_mvm_update_quotas(struct iwl_mvm *mvm, struct ieee80211_vif *newvif)
|
||||
{
|
||||
struct iwl_time_quota_cmd cmd = {};
|
||||
@@ -196,6 +228,8 @@ int iwl_mvm_update_quotas(struct iwl_mvm *mvm, struct ieee80211_vif *newvif)
|
||||
/* Give the remainder of the session to the first binding */
|
||||
le32_add_cpu(&cmd.quotas[0].quota, quota_rem);
|
||||
|
||||
iwl_mvm_adjust_quota_for_noa(mvm, &cmd);
|
||||
|
||||
ret = iwl_mvm_send_cmd_pdu(mvm, TIME_QUOTA_CMD, CMD_SYNC,
|
||||
sizeof(cmd), &cmd);
|
||||
if (ret)
|
||||
|
Reference in New Issue
Block a user