iwlwifi: mvm: track low-latency sources separately

To be able to test low-latency behaviour properly, split the
different low-latency sources so that setting any one of them,
for example from debugfs, is sufficient; this avoids getting
the debug setting overwritten by other sources.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
This commit is contained in:
Johannes Berg 2016-01-06 10:01:41 +01:00 committed by Emmanuel Grumbach
parent 0db056d324
commit b525d08125
3 changed files with 23 additions and 14 deletions

View File

@ -7,6 +7,7 @@
* *
* Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
* Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
* Copyright(c) 2016 Intel Deutschland GmbH
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as * it under the terms of version 2 of the GNU General Public License as
@ -33,6 +34,7 @@
* *
* Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
* Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
* Copyright(c) 2016 Intel Deutschland GmbH
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -1255,6 +1257,7 @@ static ssize_t iwl_dbgfs_low_latency_write(struct ieee80211_vif *vif, char *buf,
{ {
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
struct iwl_mvm *mvm = mvmvif->mvm; struct iwl_mvm *mvm = mvmvif->mvm;
bool prev;
u8 value; u8 value;
int ret; int ret;
@ -1265,7 +1268,9 @@ static ssize_t iwl_dbgfs_low_latency_write(struct ieee80211_vif *vif, char *buf,
return -EINVAL; return -EINVAL;
mutex_lock(&mvm->mutex); mutex_lock(&mvm->mutex);
iwl_mvm_update_low_latency(mvm, vif, value); prev = iwl_mvm_vif_low_latency(mvmvif);
mvmvif->low_latency_dbgfs = value;
iwl_mvm_update_low_latency(mvm, vif, prev);
mutex_unlock(&mvm->mutex); mutex_unlock(&mvm->mutex);
return count; return count;
@ -1277,11 +1282,15 @@ static ssize_t iwl_dbgfs_low_latency_read(struct file *file,
{ {
struct ieee80211_vif *vif = file->private_data; struct ieee80211_vif *vif = file->private_data;
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
char buf[2]; char buf[30] = {};
int len;
buf[0] = mvmvif->low_latency ? '1' : '0'; len = snprintf(buf, sizeof(buf) - 1,
buf[1] = '\n'; "traffic=%d\ndbgfs=%d\nvcmd=%d\n",
return simple_read_from_buffer(user_buf, count, ppos, buf, sizeof(buf)); mvmvif->low_latency_traffic,
mvmvif->low_latency_dbgfs,
mvmvif->low_latency_vcmd);
return simple_read_from_buffer(user_buf, count, ppos, buf, len);
} }
static ssize_t iwl_dbgfs_uapsd_misbehaving_read(struct file *file, static ssize_t iwl_dbgfs_uapsd_misbehaving_read(struct file *file,

View File

@ -346,8 +346,9 @@ struct iwl_mvm_vif_bf_data {
* @pm_enabled - Indicate if MAC power management is allowed * @pm_enabled - Indicate if MAC power management is allowed
* @monitor_active: indicates that monitor context is configured, and that the * @monitor_active: indicates that monitor context is configured, and that the
* interface should get quota etc. * interface should get quota etc.
* @low_latency: indicates that this interface is in low-latency mode * @low_latency_traffic: indicates low latency traffic was detected
* (VMACLowLatencyMode) * @low_latency_dbgfs: low latency mode set from debugfs
* @low_latency_vcmd: low latency mode set from vendor command
* @ps_disabled: indicates that this interface requires PS to be disabled * @ps_disabled: indicates that this interface requires PS to be disabled
* @queue_params: QoS params for this MAC * @queue_params: QoS params for this MAC
* @bcast_sta: station used for broadcast packets. Used by the following * @bcast_sta: station used for broadcast packets. Used by the following
@ -375,7 +376,7 @@ struct iwl_mvm_vif {
bool ap_ibss_active; bool ap_ibss_active;
bool pm_enabled; bool pm_enabled;
bool monitor_active; bool monitor_active;
bool low_latency; bool low_latency_traffic, low_latency_dbgfs, low_latency_vcmd;
bool ps_disabled; bool ps_disabled;
struct iwl_mvm_vif_bf_data bf_data; struct iwl_mvm_vif_bf_data bf_data;
@ -1427,8 +1428,9 @@ static inline bool iwl_mvm_vif_low_latency(struct iwl_mvm_vif *mvmvif)
* binding, so this has no real impact. For now, just return * binding, so this has no real impact. For now, just return
* the current desired low-latency state. * the current desired low-latency state.
*/ */
return mvmvif->low_latency_dbgfs ||
return mvmvif->low_latency; mvmvif->low_latency_traffic ||
mvmvif->low_latency_vcmd;
} }
/* hw scheduler queue config */ /* hw scheduler queue config */

View File

@ -937,18 +937,16 @@ bool iwl_mvm_rx_diversity_allowed(struct iwl_mvm *mvm)
} }
int iwl_mvm_update_low_latency(struct iwl_mvm *mvm, struct ieee80211_vif *vif, int iwl_mvm_update_low_latency(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
bool value) bool prev)
{ {
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
int res; int res;
lockdep_assert_held(&mvm->mutex); lockdep_assert_held(&mvm->mutex);
if (mvmvif->low_latency == value) if (iwl_mvm_vif_low_latency(mvmvif) == prev)
return 0; return 0;
mvmvif->low_latency = value;
res = iwl_mvm_update_quotas(mvm, false, NULL); res = iwl_mvm_update_quotas(mvm, false, NULL);
if (res) if (res)
return res; return res;