diff options
author | Johannes Berg <johannes.berg@intel.com> | 2016-01-13 09:01:00 -0500 |
---|---|---|
committer | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2016-02-01 09:40:23 -0500 |
commit | a80c1cf9b4b2937cfe782aba7b54a5144fe7eec2 (patch) | |
tree | c325d9c0905aaaf99466445ba2f3db9d7329faa2 | |
parent | b525d08125e61e262be63ea250e3e13e93b6a92a (diff) |
iwlwifi: mvm: support setting minimum quota from debugfs
For debug purposes, allow setting minimum quota (for a single
virtual interface) from debugfs. This is an absolute minimum,
so it can only be set up to 95%.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
-rw-r--r-- | drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c | 56 | ||||
-rw-r--r-- | drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/intel/iwlwifi/mvm/quota.c | 16 |
3 files changed, 73 insertions, 0 deletions
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c index c286a5f8d8bd..14004456bf55 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c | |||
@@ -1372,6 +1372,59 @@ static ssize_t iwl_dbgfs_rx_phyinfo_read(struct file *file, | |||
1372 | return simple_read_from_buffer(user_buf, count, ppos, buf, sizeof(buf)); | 1372 | return simple_read_from_buffer(user_buf, count, ppos, buf, sizeof(buf)); |
1373 | } | 1373 | } |
1374 | 1374 | ||
1375 | static void iwl_dbgfs_quota_check(void *data, u8 *mac, | ||
1376 | struct ieee80211_vif *vif) | ||
1377 | { | ||
1378 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | ||
1379 | int *ret = data; | ||
1380 | |||
1381 | if (mvmvif->dbgfs_quota_min) | ||
1382 | *ret = -EINVAL; | ||
1383 | } | ||
1384 | |||
1385 | static ssize_t iwl_dbgfs_quota_min_write(struct ieee80211_vif *vif, char *buf, | ||
1386 | size_t count, loff_t *ppos) | ||
1387 | { | ||
1388 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | ||
1389 | struct iwl_mvm *mvm = mvmvif->mvm; | ||
1390 | u16 value; | ||
1391 | int ret; | ||
1392 | |||
1393 | ret = kstrtou16(buf, 0, &value); | ||
1394 | if (ret) | ||
1395 | return ret; | ||
1396 | |||
1397 | if (value > 95) | ||
1398 | return -EINVAL; | ||
1399 | |||
1400 | mutex_lock(&mvm->mutex); | ||
1401 | |||
1402 | mvmvif->dbgfs_quota_min = 0; | ||
1403 | ieee80211_iterate_interfaces(mvm->hw, IEEE80211_IFACE_ITER_NORMAL, | ||
1404 | iwl_dbgfs_quota_check, &ret); | ||
1405 | if (ret == 0) { | ||
1406 | mvmvif->dbgfs_quota_min = value; | ||
1407 | iwl_mvm_update_quotas(mvm, false, NULL); | ||
1408 | } | ||
1409 | mutex_unlock(&mvm->mutex); | ||
1410 | |||
1411 | return ret ?: count; | ||
1412 | } | ||
1413 | |||
1414 | static ssize_t iwl_dbgfs_quota_min_read(struct file *file, | ||
1415 | char __user *user_buf, | ||
1416 | size_t count, loff_t *ppos) | ||
1417 | { | ||
1418 | struct ieee80211_vif *vif = file->private_data; | ||
1419 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | ||
1420 | char buf[10]; | ||
1421 | int len; | ||
1422 | |||
1423 | len = snprintf(buf, sizeof(buf), "%d\n", mvmvif->dbgfs_quota_min); | ||
1424 | |||
1425 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
1426 | } | ||
1427 | |||
1375 | #define MVM_DEBUGFS_WRITE_FILE_OPS(name, bufsz) \ | 1428 | #define MVM_DEBUGFS_WRITE_FILE_OPS(name, bufsz) \ |
1376 | _MVM_DEBUGFS_WRITE_FILE_OPS(name, bufsz, struct ieee80211_vif) | 1429 | _MVM_DEBUGFS_WRITE_FILE_OPS(name, bufsz, struct ieee80211_vif) |
1377 | #define MVM_DEBUGFS_READ_WRITE_FILE_OPS(name, bufsz) \ | 1430 | #define MVM_DEBUGFS_READ_WRITE_FILE_OPS(name, bufsz) \ |
@@ -1395,6 +1448,7 @@ MVM_DEBUGFS_READ_WRITE_FILE_OPS(tof_range_req_ext, 32); | |||
1395 | MVM_DEBUGFS_READ_WRITE_FILE_OPS(tof_range_abort, 32); | 1448 | MVM_DEBUGFS_READ_WRITE_FILE_OPS(tof_range_abort, 32); |
1396 | MVM_DEBUGFS_READ_FILE_OPS(tof_range_response); | 1449 | MVM_DEBUGFS_READ_FILE_OPS(tof_range_response); |
1397 | MVM_DEBUGFS_READ_WRITE_FILE_OPS(tof_responder_params, 32); | 1450 | MVM_DEBUGFS_READ_WRITE_FILE_OPS(tof_responder_params, 32); |
1451 | MVM_DEBUGFS_READ_WRITE_FILE_OPS(quota_min, 32); | ||
1398 | 1452 | ||
1399 | void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif) | 1453 | void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif) |
1400 | { | 1454 | { |
@@ -1432,6 +1486,8 @@ void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif) | |||
1432 | S_IRUSR | S_IWUSR); | 1486 | S_IRUSR | S_IWUSR); |
1433 | MVM_DEBUGFS_ADD_FILE_VIF(rx_phyinfo, mvmvif->dbgfs_dir, | 1487 | MVM_DEBUGFS_ADD_FILE_VIF(rx_phyinfo, mvmvif->dbgfs_dir, |
1434 | S_IRUSR | S_IWUSR); | 1488 | S_IRUSR | S_IWUSR); |
1489 | MVM_DEBUGFS_ADD_FILE_VIF(quota_min, mvmvif->dbgfs_dir, | ||
1490 | S_IRUSR | S_IWUSR); | ||
1435 | 1491 | ||
1436 | if (vif->type == NL80211_IFTYPE_STATION && !vif->p2p && | 1492 | if (vif->type == NL80211_IFTYPE_STATION && !vif->p2p && |
1437 | mvmvif == mvm->bf_allowed_vif) | 1493 | mvmvif == mvm->bf_allowed_vif) |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h index 418aeffd9bab..5a34808fdeed 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | |||
@@ -433,6 +433,7 @@ struct iwl_mvm_vif { | |||
433 | struct iwl_dbgfs_pm dbgfs_pm; | 433 | struct iwl_dbgfs_pm dbgfs_pm; |
434 | struct iwl_dbgfs_bf dbgfs_bf; | 434 | struct iwl_dbgfs_bf dbgfs_bf; |
435 | struct iwl_mac_power_cmd mac_pwr_cmd; | 435 | struct iwl_mac_power_cmd mac_pwr_cmd; |
436 | int dbgfs_quota_min; | ||
436 | #endif | 437 | #endif |
437 | 438 | ||
438 | enum ieee80211_smps_mode smps_requests[NUM_IWL_MVM_SMPS_REQ]; | 439 | enum ieee80211_smps_mode smps_requests[NUM_IWL_MVM_SMPS_REQ]; |
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/quota.c b/drivers/net/wireless/intel/iwlwifi/mvm/quota.c index 0b762b4f8fad..2141db5bff82 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/quota.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/quota.c | |||
@@ -7,6 +7,7 @@ | |||
7 | * | 7 | * |
8 | * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. | 8 | * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. |
9 | * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH | 9 | * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH |
10 | * Copyright(c) 2016 Intel Deutschland GmbH | ||
10 | * | 11 | * |
11 | * This program is free software; you can redistribute it and/or modify | 12 | * This program is free software; you can redistribute it and/or modify |
12 | * it under the terms of version 2 of the GNU General Public License as | 13 | * it under the terms of version 2 of the GNU General Public License as |
@@ -33,6 +34,7 @@ | |||
33 | * | 34 | * |
34 | * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. | 35 | * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. |
35 | * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH | 36 | * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH |
37 | * Copyright(c) 2016 Intel Deutschland GmbH | ||
36 | * All rights reserved. | 38 | * All rights reserved. |
37 | * | 39 | * |
38 | * Redistribution and use in source and binary forms, with or without | 40 | * Redistribution and use in source and binary forms, with or without |
@@ -74,6 +76,9 @@ struct iwl_mvm_quota_iterator_data { | |||
74 | int n_interfaces[MAX_BINDINGS]; | 76 | int n_interfaces[MAX_BINDINGS]; |
75 | int colors[MAX_BINDINGS]; | 77 | int colors[MAX_BINDINGS]; |
76 | int low_latency[MAX_BINDINGS]; | 78 | int low_latency[MAX_BINDINGS]; |
79 | #ifdef CONFIG_IWLWIFI_DEBUGFS | ||
80 | int dbgfs_min[MAX_BINDINGS]; | ||
81 | #endif | ||
77 | int n_low_latency_bindings; | 82 | int n_low_latency_bindings; |
78 | struct ieee80211_vif *disabled_vif; | 83 | struct ieee80211_vif *disabled_vif; |
79 | }; | 84 | }; |
@@ -129,6 +134,12 @@ static void iwl_mvm_quota_iterator(void *_data, u8 *mac, | |||
129 | 134 | ||
130 | data->n_interfaces[id]++; | 135 | data->n_interfaces[id]++; |
131 | 136 | ||
137 | #ifdef CONFIG_IWLWIFI_DEBUGFS | ||
138 | if (mvmvif->dbgfs_quota_min) | ||
139 | data->dbgfs_min[id] = max(data->dbgfs_min[id], | ||
140 | mvmvif->dbgfs_quota_min); | ||
141 | #endif | ||
142 | |||
132 | if (iwl_mvm_vif_low_latency(mvmvif) && !data->low_latency[id]) { | 143 | if (iwl_mvm_vif_low_latency(mvmvif) && !data->low_latency[id]) { |
133 | data->n_low_latency_bindings++; | 144 | data->n_low_latency_bindings++; |
134 | data->low_latency[id] = true; | 145 | data->low_latency[id] = true; |
@@ -259,6 +270,11 @@ int iwl_mvm_update_quotas(struct iwl_mvm *mvm, | |||
259 | 270 | ||
260 | if (data.n_interfaces[i] <= 0) | 271 | if (data.n_interfaces[i] <= 0) |
261 | cmd.quotas[idx].quota = cpu_to_le32(0); | 272 | cmd.quotas[idx].quota = cpu_to_le32(0); |
273 | #ifdef CONFIG_IWLWIFI_DEBUGFS | ||
274 | else if (data.dbgfs_min[i]) | ||
275 | cmd.quotas[idx].quota = | ||
276 | cpu_to_le32(data.dbgfs_min[i] * QUOTA_100 / 100); | ||
277 | #endif | ||
262 | else if (data.n_low_latency_bindings == 1 && n_non_lowlat && | 278 | else if (data.n_low_latency_bindings == 1 && n_non_lowlat && |
263 | data.low_latency[i]) | 279 | data.low_latency[i]) |
264 | /* | 280 | /* |