aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSara Sharon <sara.sharon@intel.com>2017-12-27 05:16:33 -0500
committerLuca Coelho <luciano.coelho@intel.com>2018-03-28 15:43:40 -0400
commit9b137866f9a2699698cfffb0b7729331a419d617 (patch)
tree235ad00028f48f18fc688a75d021d22457b5b23f
parent8f27036a0e380c6ede67a8d2a132327fcb760ace (diff)
iwlwifi: mvm: save low latency causes in an enum
Currently we have a boolean variable for each cause. This costs space, and requires to check each separately when determining low latency. Since we have another cause incoming, convert it to an enum. While at it, move the retrieval of the prev value and the assignment of the new value to be inside iwl_mvm_update_low_latency and save the need for each caller to do it separately. Signed-off-by: Sara Sharon <sara.sharon@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c11
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/mvm.h36
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/utils.c8
3 files changed, 38 insertions, 17 deletions
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
index 4e9d1792baf3..f7fcf700196b 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
@@ -1276,7 +1276,6 @@ static ssize_t iwl_dbgfs_low_latency_write(struct ieee80211_vif *vif, char *buf,
1276{ 1276{
1277 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 1277 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
1278 struct iwl_mvm *mvm = mvmvif->mvm; 1278 struct iwl_mvm *mvm = mvmvif->mvm;
1279 bool prev;
1280 u8 value; 1279 u8 value;
1281 int ret; 1280 int ret;
1282 1281
@@ -1287,9 +1286,7 @@ static ssize_t iwl_dbgfs_low_latency_write(struct ieee80211_vif *vif, char *buf,
1287 return -EINVAL; 1286 return -EINVAL;
1288 1287
1289 mutex_lock(&mvm->mutex); 1288 mutex_lock(&mvm->mutex);
1290 prev = iwl_mvm_vif_low_latency(mvmvif); 1289 iwl_mvm_update_low_latency(mvm, vif, value, LOW_LATENCY_DEBUGFS);
1291 mvmvif->low_latency_dbgfs = value;
1292 iwl_mvm_update_low_latency(mvm, vif, prev);
1293 mutex_unlock(&mvm->mutex); 1290 mutex_unlock(&mvm->mutex);
1294 1291
1295 return count; 1292 return count;
@@ -1306,9 +1303,9 @@ static ssize_t iwl_dbgfs_low_latency_read(struct file *file,
1306 1303
1307 len = scnprintf(buf, sizeof(buf) - 1, 1304 len = scnprintf(buf, sizeof(buf) - 1,
1308 "traffic=%d\ndbgfs=%d\nvcmd=%d\n", 1305 "traffic=%d\ndbgfs=%d\nvcmd=%d\n",
1309 mvmvif->low_latency_traffic, 1306 !!(mvmvif->low_latency & LOW_LATENCY_TRAFFIC),
1310 mvmvif->low_latency_dbgfs, 1307 !!(mvmvif->low_latency & LOW_LATENCY_DEBUGFS),
1311 mvmvif->low_latency_vcmd); 1308 !!(mvmvif->low_latency & LOW_LATENCY_VCMD));
1312 return simple_read_from_buffer(user_buf, count, ppos, buf, len); 1309 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
1313} 1310}
1314 1311
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index 82445e12aacb..d2cf751db68d 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -300,6 +300,18 @@ enum iwl_bt_force_ant_mode {
300}; 300};
301 301
302/** 302/**
303* struct iwl_mvm_low_latency_cause - low latency set causes
304* @LOW_LATENCY_TRAFFIC: indicates low latency traffic was detected
305* @LOW_LATENCY_DEBUGFS: low latency mode set from debugfs
306* @LOW_LATENCY_VCMD: low latency mode set from vendor command
307*/
308enum iwl_mvm_low_latency_cause {
309 LOW_LATENCY_TRAFFIC = BIT(0),
310 LOW_LATENCY_DEBUGFS = BIT(1),
311 LOW_LATENCY_VCMD = BIT(2),
312};
313
314/**
303* struct iwl_mvm_vif_bf_data - beacon filtering related data 315* struct iwl_mvm_vif_bf_data - beacon filtering related data
304* @bf_enabled: indicates if beacon filtering is enabled 316* @bf_enabled: indicates if beacon filtering is enabled
305* @ba_enabled: indicated if beacon abort is enabled 317* @ba_enabled: indicated if beacon abort is enabled
@@ -335,9 +347,8 @@ struct iwl_mvm_vif_bf_data {
335 * @pm_enabled - Indicate if MAC power management is allowed 347 * @pm_enabled - Indicate if MAC power management is allowed
336 * @monitor_active: indicates that monitor context is configured, and that the 348 * @monitor_active: indicates that monitor context is configured, and that the
337 * interface should get quota etc. 349 * interface should get quota etc.
338 * @low_latency_traffic: indicates low latency traffic was detected 350 * @low_latency: indicates low latency is set, see
339 * @low_latency_dbgfs: low latency mode set from debugfs 351 * enum &iwl_mvm_low_latency_cause for causes.
340 * @low_latency_vcmd: low latency mode set from vendor command
341 * @ps_disabled: indicates that this interface requires PS to be disabled 352 * @ps_disabled: indicates that this interface requires PS to be disabled
342 * @queue_params: QoS params for this MAC 353 * @queue_params: QoS params for this MAC
343 * @bcast_sta: station used for broadcast packets. Used by the following 354 * @bcast_sta: station used for broadcast packets. Used by the following
@@ -367,7 +378,7 @@ struct iwl_mvm_vif {
367 bool ap_ibss_active; 378 bool ap_ibss_active;
368 bool pm_enabled; 379 bool pm_enabled;
369 bool monitor_active; 380 bool monitor_active;
370 bool low_latency_traffic, low_latency_dbgfs, low_latency_vcmd; 381 u8 low_latency;
371 bool ps_disabled; 382 bool ps_disabled;
372 struct iwl_mvm_vif_bf_data bf_data; 383 struct iwl_mvm_vif_bf_data bf_data;
373 384
@@ -1756,7 +1767,8 @@ bool iwl_mvm_rx_diversity_allowed(struct iwl_mvm *mvm);
1756 1767
1757/* Low latency */ 1768/* Low latency */
1758int iwl_mvm_update_low_latency(struct iwl_mvm *mvm, struct ieee80211_vif *vif, 1769int iwl_mvm_update_low_latency(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
1759 bool value); 1770 bool low_latency,
1771 enum iwl_mvm_low_latency_cause cause);
1760/* get SystemLowLatencyMode - only needed for beacon threshold? */ 1772/* get SystemLowLatencyMode - only needed for beacon threshold? */
1761bool iwl_mvm_low_latency(struct iwl_mvm *mvm); 1773bool iwl_mvm_low_latency(struct iwl_mvm *mvm);
1762/* get VMACLowLatencyMode */ 1774/* get VMACLowLatencyMode */
@@ -1772,9 +1784,17 @@ static inline bool iwl_mvm_vif_low_latency(struct iwl_mvm_vif *mvmvif)
1772 * binding, so this has no real impact. For now, just return 1784 * binding, so this has no real impact. For now, just return
1773 * the current desired low-latency state. 1785 * the current desired low-latency state.
1774 */ 1786 */
1775 return mvmvif->low_latency_dbgfs || 1787 return mvmvif->low_latency;
1776 mvmvif->low_latency_traffic || 1788}
1777 mvmvif->low_latency_vcmd; 1789
1790static inline
1791void iwl_mvm_vif_set_low_latency(struct iwl_mvm_vif *mvmvif, bool set,
1792 enum iwl_mvm_low_latency_cause cause)
1793{
1794 if (set)
1795 mvmvif->low_latency |= cause;
1796 else
1797 mvmvif->low_latency &= ~cause;
1778} 1798}
1779 1799
1780/* hw scheduler queue config */ 1800/* hw scheduler queue config */
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/utils.c b/drivers/net/wireless/intel/iwlwifi/mvm/utils.c
index 70f8b8eb6117..bebcfb44c8c2 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/utils.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/utils.c
@@ -1034,14 +1034,18 @@ bool iwl_mvm_rx_diversity_allowed(struct iwl_mvm *mvm)
1034} 1034}
1035 1035
1036int iwl_mvm_update_low_latency(struct iwl_mvm *mvm, struct ieee80211_vif *vif, 1036int iwl_mvm_update_low_latency(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
1037 bool prev) 1037 bool low_latency,
1038 enum iwl_mvm_low_latency_cause cause)
1038{ 1039{
1039 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 1040 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
1040 int res; 1041 int res;
1041 bool low_latency; 1042 bool prev;
1042 1043
1043 lockdep_assert_held(&mvm->mutex); 1044 lockdep_assert_held(&mvm->mutex);
1044 1045
1046 prev = iwl_mvm_vif_low_latency(mvmvif);
1047 iwl_mvm_vif_set_low_latency(mvmvif, low_latency, cause);
1048
1045 low_latency = iwl_mvm_vif_low_latency(mvmvif); 1049 low_latency = iwl_mvm_vif_low_latency(mvmvif);
1046 1050
1047 if (low_latency == prev) 1051 if (low_latency == prev)