diff options
author | Johannes Berg <johannes.berg@intel.com> | 2013-11-12 11:30:52 -0500 |
---|---|---|
committer | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2014-02-03 15:23:34 -0500 |
commit | a21d7bcbf4c65bb7f79e16287d41040e4c7f5596 (patch) | |
tree | ac16a9b2af653bb739afe4cfb2388ea7a266fee1 /drivers/net/wireless/iwlwifi | |
parent | 992f81fcd97e87e7ebbb26e544430adf483203f0 (diff) |
iwlwifi: mvm: add low-latency framework
For various traffic use cases, we want to be able to treat multi-
channel scenarios differently. Introduce a low-latency framework
that currently only has a debugfs file to enable low-latency mode,
but can later be extended.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c | 38 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/mvm.h | 25 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/utils.c | 12 |
3 files changed, 74 insertions, 1 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c b/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c index 0e29cd83a06a..19ecade5ec5f 100644 --- a/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c +++ b/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c | |||
@@ -460,6 +460,41 @@ static ssize_t iwl_dbgfs_bf_params_read(struct file *file, | |||
460 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); | 460 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
461 | } | 461 | } |
462 | 462 | ||
463 | static ssize_t iwl_dbgfs_low_latency_write(struct ieee80211_vif *vif, char *buf, | ||
464 | size_t count, loff_t *ppos) | ||
465 | { | ||
466 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | ||
467 | struct iwl_mvm *mvm = mvmvif->mvm; | ||
468 | u8 value; | ||
469 | int ret; | ||
470 | |||
471 | ret = kstrtou8(buf, 0, &value); | ||
472 | if (ret) | ||
473 | return ret; | ||
474 | if (value > 1) | ||
475 | return -EINVAL; | ||
476 | |||
477 | mutex_lock(&mvm->mutex); | ||
478 | iwl_mvm_update_low_latency(mvm, vif, value); | ||
479 | mutex_unlock(&mvm->mutex); | ||
480 | |||
481 | return count; | ||
482 | } | ||
483 | |||
484 | static ssize_t iwl_dbgfs_low_latency_read(struct file *file, | ||
485 | char __user *user_buf, | ||
486 | size_t count, loff_t *ppos) | ||
487 | { | ||
488 | struct ieee80211_vif *vif = file->private_data; | ||
489 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | ||
490 | char buf[3]; | ||
491 | |||
492 | buf[0] = mvmvif->low_latency ? '1' : '0'; | ||
493 | buf[1] = '\n'; | ||
494 | buf[2] = '\0'; | ||
495 | return simple_read_from_buffer(user_buf, count, ppos, buf, sizeof(buf)); | ||
496 | } | ||
497 | |||
463 | #define MVM_DEBUGFS_WRITE_FILE_OPS(name, bufsz) \ | 498 | #define MVM_DEBUGFS_WRITE_FILE_OPS(name, bufsz) \ |
464 | _MVM_DEBUGFS_WRITE_FILE_OPS(name, bufsz, struct ieee80211_vif) | 499 | _MVM_DEBUGFS_WRITE_FILE_OPS(name, bufsz, struct ieee80211_vif) |
465 | #define MVM_DEBUGFS_READ_WRITE_FILE_OPS(name, bufsz) \ | 500 | #define MVM_DEBUGFS_READ_WRITE_FILE_OPS(name, bufsz) \ |
@@ -473,6 +508,7 @@ static ssize_t iwl_dbgfs_bf_params_read(struct file *file, | |||
473 | MVM_DEBUGFS_READ_FILE_OPS(mac_params); | 508 | MVM_DEBUGFS_READ_FILE_OPS(mac_params); |
474 | MVM_DEBUGFS_READ_WRITE_FILE_OPS(pm_params, 32); | 509 | MVM_DEBUGFS_READ_WRITE_FILE_OPS(pm_params, 32); |
475 | MVM_DEBUGFS_READ_WRITE_FILE_OPS(bf_params, 256); | 510 | MVM_DEBUGFS_READ_WRITE_FILE_OPS(bf_params, 256); |
511 | MVM_DEBUGFS_READ_WRITE_FILE_OPS(low_latency, 10); | ||
476 | 512 | ||
477 | void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif) | 513 | void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif) |
478 | { | 514 | { |
@@ -505,6 +541,8 @@ void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif) | |||
505 | 541 | ||
506 | MVM_DEBUGFS_ADD_FILE_VIF(mac_params, mvmvif->dbgfs_dir, | 542 | MVM_DEBUGFS_ADD_FILE_VIF(mac_params, mvmvif->dbgfs_dir, |
507 | S_IRUSR); | 543 | S_IRUSR); |
544 | MVM_DEBUGFS_ADD_FILE_VIF(low_latency, mvmvif->dbgfs_dir, | ||
545 | S_IRUSR | S_IWUSR); | ||
508 | 546 | ||
509 | if (vif->type == NL80211_IFTYPE_STATION && !vif->p2p && | 547 | if (vif->type == NL80211_IFTYPE_STATION && !vif->p2p && |
510 | mvmvif == mvm->bf_allowed_vif) | 548 | mvmvif == mvm->bf_allowed_vif) |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h b/drivers/net/wireless/iwlwifi/mvm/mvm.h index 02e4bdc80de2..00bc4ce06cca 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h | |||
@@ -269,7 +269,9 @@ struct iwl_mvm_vif_bf_data { | |||
269 | * @ap_ibss_active: indicates that AP/IBSS is configured and that the interface | 269 | * @ap_ibss_active: indicates that AP/IBSS is configured and that the interface |
270 | * should get quota etc. | 270 | * should get quota etc. |
271 | * @monitor_active: indicates that monitor context is configured, and that the | 271 | * @monitor_active: indicates that monitor context is configured, and that the |
272 | * interface should get quota etc. | 272 | * interface should get quota etc. |
273 | * @low_latency: indicates that this interface is in low-latency mode | ||
274 | * (VMACLowLatencyMode) | ||
273 | * @queue_params: QoS params for this MAC | 275 | * @queue_params: QoS params for this MAC |
274 | * @bcast_sta: station used for broadcast packets. Used by the following | 276 | * @bcast_sta: station used for broadcast packets. Used by the following |
275 | * vifs: P2P_DEVICE, GO and AP. | 277 | * vifs: P2P_DEVICE, GO and AP. |
@@ -285,6 +287,7 @@ struct iwl_mvm_vif { | |||
285 | bool uploaded; | 287 | bool uploaded; |
286 | bool ap_ibss_active; | 288 | bool ap_ibss_active; |
287 | bool monitor_active; | 289 | bool monitor_active; |
290 | bool low_latency; | ||
288 | struct iwl_mvm_vif_bf_data bf_data; | 291 | struct iwl_mvm_vif_bf_data bf_data; |
289 | 292 | ||
290 | u32 ap_beacon_time; | 293 | u32 ap_beacon_time; |
@@ -909,6 +912,26 @@ void iwl_mvm_update_smps(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | |||
909 | enum iwl_mvm_smps_type_request req_type, | 912 | enum iwl_mvm_smps_type_request req_type, |
910 | enum ieee80211_smps_mode smps_request); | 913 | enum ieee80211_smps_mode smps_request); |
911 | 914 | ||
915 | /* Low latency */ | ||
916 | int iwl_mvm_update_low_latency(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | ||
917 | bool value); | ||
918 | /* get VMACLowLatencyMode */ | ||
919 | static inline bool iwl_mvm_vif_low_latency(struct iwl_mvm_vif *mvmvif) | ||
920 | { | ||
921 | /* | ||
922 | * should this consider associated/active/... state? | ||
923 | * | ||
924 | * Normally low-latency should only be active on interfaces | ||
925 | * that are active, but at least with debugfs it can also be | ||
926 | * enabled on interfaces that aren't active. However, when | ||
927 | * interface aren't active then they aren't added into the | ||
928 | * binding, so this has no real impact. For now, just return | ||
929 | * the current desired low-latency state. | ||
930 | */ | ||
931 | |||
932 | return mvmvif->low_latency; | ||
933 | } | ||
934 | |||
912 | /* Thermal management and CT-kill */ | 935 | /* Thermal management and CT-kill */ |
913 | void iwl_mvm_tt_handler(struct iwl_mvm *mvm); | 936 | void iwl_mvm_tt_handler(struct iwl_mvm *mvm); |
914 | void iwl_mvm_tt_initialize(struct iwl_mvm *mvm); | 937 | void iwl_mvm_tt_initialize(struct iwl_mvm *mvm); |
diff --git a/drivers/net/wireless/iwlwifi/mvm/utils.c b/drivers/net/wireless/iwlwifi/mvm/utils.c index a4a5e25623c3..e2cc876d9388 100644 --- a/drivers/net/wireless/iwlwifi/mvm/utils.c +++ b/drivers/net/wireless/iwlwifi/mvm/utils.c | |||
@@ -536,3 +536,15 @@ void iwl_mvm_update_smps(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | |||
536 | 536 | ||
537 | ieee80211_request_smps(vif, smps_mode); | 537 | ieee80211_request_smps(vif, smps_mode); |
538 | } | 538 | } |
539 | |||
540 | int iwl_mvm_update_low_latency(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | ||
541 | bool value) | ||
542 | { | ||
543 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | ||
544 | |||
545 | lockdep_assert_held(&mvm->mutex); | ||
546 | |||
547 | mvmvif->low_latency = value; | ||
548 | |||
549 | return iwl_mvm_update_quotas(mvm, NULL); | ||
550 | } | ||