aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c')
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c119
1 files changed, 109 insertions, 10 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c b/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c
index 0e29cd83a06a..9b59e1d7ae71 100644
--- a/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c
+++ b/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c
@@ -185,7 +185,7 @@ static ssize_t iwl_dbgfs_pm_params_write(struct ieee80211_vif *vif, char *buf,
185 185
186 mutex_lock(&mvm->mutex); 186 mutex_lock(&mvm->mutex);
187 iwl_dbgfs_update_pm(mvm, vif, param, val); 187 iwl_dbgfs_update_pm(mvm, vif, param, val);
188 ret = iwl_mvm_power_update_mode(mvm, vif); 188 ret = iwl_mvm_power_update_mac(mvm, vif);
189 mutex_unlock(&mvm->mutex); 189 mutex_unlock(&mvm->mutex);
190 190
191 return ret ?: count; 191 return ret ?: count;
@@ -202,7 +202,7 @@ static ssize_t iwl_dbgfs_pm_params_read(struct file *file,
202 int bufsz = sizeof(buf); 202 int bufsz = sizeof(buf);
203 int pos; 203 int pos;
204 204
205 pos = iwl_mvm_power_dbgfs_read(mvm, vif, buf, bufsz); 205 pos = iwl_mvm_power_mac_dbgfs_read(mvm, vif, buf, bufsz);
206 206
207 return simple_read_from_buffer(user_buf, count, ppos, buf, pos); 207 return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
208} 208}
@@ -225,6 +225,29 @@ static ssize_t iwl_dbgfs_mac_params_read(struct file *file,
225 225
226 ap_sta_id = mvmvif->ap_sta_id; 226 ap_sta_id = mvmvif->ap_sta_id;
227 227
228 switch (ieee80211_vif_type_p2p(vif)) {
229 case NL80211_IFTYPE_ADHOC:
230 pos += scnprintf(buf+pos, bufsz-pos, "type: ibss\n");
231 break;
232 case NL80211_IFTYPE_STATION:
233 pos += scnprintf(buf+pos, bufsz-pos, "type: bss\n");
234 break;
235 case NL80211_IFTYPE_AP:
236 pos += scnprintf(buf+pos, bufsz-pos, "type: ap\n");
237 break;
238 case NL80211_IFTYPE_P2P_CLIENT:
239 pos += scnprintf(buf+pos, bufsz-pos, "type: p2p client\n");
240 break;
241 case NL80211_IFTYPE_P2P_GO:
242 pos += scnprintf(buf+pos, bufsz-pos, "type: p2p go\n");
243 break;
244 case NL80211_IFTYPE_P2P_DEVICE:
245 pos += scnprintf(buf+pos, bufsz-pos, "type: p2p dev\n");
246 break;
247 default:
248 break;
249 }
250
228 pos += scnprintf(buf+pos, bufsz-pos, "mac id/color: %d / %d\n", 251 pos += scnprintf(buf+pos, bufsz-pos, "mac id/color: %d / %d\n",
229 mvmvif->id, mvmvif->color); 252 mvmvif->id, mvmvif->color);
230 pos += scnprintf(buf+pos, bufsz-pos, "bssid: %pM\n", 253 pos += scnprintf(buf+pos, bufsz-pos, "bssid: %pM\n",
@@ -249,9 +272,10 @@ static ssize_t iwl_dbgfs_mac_params_read(struct file *file,
249 struct iwl_mvm_sta *mvm_sta = (void *)sta->drv_priv; 272 struct iwl_mvm_sta *mvm_sta = (void *)sta->drv_priv;
250 273
251 pos += scnprintf(buf+pos, bufsz-pos, 274 pos += scnprintf(buf+pos, bufsz-pos,
252 "ap_sta_id %d - reduced Tx power %d\n", 275 "ap_sta_id %d - reduced Tx power %d force %d\n",
253 ap_sta_id, 276 ap_sta_id,
254 mvm_sta->bt_reduced_txpower); 277 mvm_sta->bt_reduced_txpower,
278 mvm_sta->bt_reduced_txpower_dbg);
255 } 279 }
256 } 280 }
257 281
@@ -269,6 +293,41 @@ static ssize_t iwl_dbgfs_mac_params_read(struct file *file,
269 return simple_read_from_buffer(user_buf, count, ppos, buf, pos); 293 return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
270} 294}
271 295
296static ssize_t iwl_dbgfs_reduced_txp_write(struct ieee80211_vif *vif,
297 char *buf, size_t count,
298 loff_t *ppos)
299{
300 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
301 struct iwl_mvm *mvm = mvmvif->mvm;
302 struct iwl_mvm_sta *mvmsta;
303 bool reduced_tx_power;
304 int ret;
305
306 if (mvmvif->ap_sta_id >= ARRAY_SIZE(mvm->fw_id_to_mac_id))
307 return -ENOTCONN;
308
309 if (strtobool(buf, &reduced_tx_power) != 0)
310 return -EINVAL;
311
312 mutex_lock(&mvm->mutex);
313
314 mvmsta = iwl_mvm_sta_from_staid_protected(mvm, mvmvif->ap_sta_id);
315 if (IS_ERR_OR_NULL(mvmsta)) {
316 mutex_unlock(&mvm->mutex);
317 return -ENOTCONN;
318 }
319
320 mvmsta->bt_reduced_txpower_dbg = false;
321 ret = iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id,
322 reduced_tx_power);
323 if (!ret)
324 mvmsta->bt_reduced_txpower_dbg = true;
325
326 mutex_unlock(&mvm->mutex);
327
328 return ret ? : count;
329}
330
272static void iwl_dbgfs_update_bf(struct ieee80211_vif *vif, 331static void iwl_dbgfs_update_bf(struct ieee80211_vif *vif,
273 enum iwl_dbgfs_bf_mask param, int value) 332 enum iwl_dbgfs_bf_mask param, int value)
274{ 333{
@@ -403,9 +462,9 @@ static ssize_t iwl_dbgfs_bf_params_write(struct ieee80211_vif *vif, char *buf,
403 mutex_lock(&mvm->mutex); 462 mutex_lock(&mvm->mutex);
404 iwl_dbgfs_update_bf(vif, param, value); 463 iwl_dbgfs_update_bf(vif, param, value);
405 if (param == MVM_DEBUGFS_BF_ENABLE_BEACON_FILTER && !value) 464 if (param == MVM_DEBUGFS_BF_ENABLE_BEACON_FILTER && !value)
406 ret = iwl_mvm_disable_beacon_filter(mvm, vif); 465 ret = iwl_mvm_disable_beacon_filter(mvm, vif, CMD_SYNC);
407 else 466 else
408 ret = iwl_mvm_enable_beacon_filter(mvm, vif); 467 ret = iwl_mvm_enable_beacon_filter(mvm, vif, CMD_SYNC);
409 mutex_unlock(&mvm->mutex); 468 mutex_unlock(&mvm->mutex);
410 469
411 return ret ?: count; 470 return ret ?: count;
@@ -460,6 +519,41 @@ static ssize_t iwl_dbgfs_bf_params_read(struct file *file,
460 return simple_read_from_buffer(user_buf, count, ppos, buf, pos); 519 return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
461} 520}
462 521
522static ssize_t iwl_dbgfs_low_latency_write(struct ieee80211_vif *vif, char *buf,
523 size_t count, loff_t *ppos)
524{
525 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
526 struct iwl_mvm *mvm = mvmvif->mvm;
527 u8 value;
528 int ret;
529
530 ret = kstrtou8(buf, 0, &value);
531 if (ret)
532 return ret;
533 if (value > 1)
534 return -EINVAL;
535
536 mutex_lock(&mvm->mutex);
537 iwl_mvm_update_low_latency(mvm, vif, value);
538 mutex_unlock(&mvm->mutex);
539
540 return count;
541}
542
543static ssize_t iwl_dbgfs_low_latency_read(struct file *file,
544 char __user *user_buf,
545 size_t count, loff_t *ppos)
546{
547 struct ieee80211_vif *vif = file->private_data;
548 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
549 char buf[3];
550
551 buf[0] = mvmvif->low_latency ? '1' : '0';
552 buf[1] = '\n';
553 buf[2] = '\0';
554 return simple_read_from_buffer(user_buf, count, ppos, buf, sizeof(buf));
555}
556
463#define MVM_DEBUGFS_WRITE_FILE_OPS(name, bufsz) \ 557#define MVM_DEBUGFS_WRITE_FILE_OPS(name, bufsz) \
464 _MVM_DEBUGFS_WRITE_FILE_OPS(name, bufsz, struct ieee80211_vif) 558 _MVM_DEBUGFS_WRITE_FILE_OPS(name, bufsz, struct ieee80211_vif)
465#define MVM_DEBUGFS_READ_WRITE_FILE_OPS(name, bufsz) \ 559#define MVM_DEBUGFS_READ_WRITE_FILE_OPS(name, bufsz) \
@@ -473,6 +567,8 @@ static ssize_t iwl_dbgfs_bf_params_read(struct file *file,
473MVM_DEBUGFS_READ_FILE_OPS(mac_params); 567MVM_DEBUGFS_READ_FILE_OPS(mac_params);
474MVM_DEBUGFS_READ_WRITE_FILE_OPS(pm_params, 32); 568MVM_DEBUGFS_READ_WRITE_FILE_OPS(pm_params, 32);
475MVM_DEBUGFS_READ_WRITE_FILE_OPS(bf_params, 256); 569MVM_DEBUGFS_READ_WRITE_FILE_OPS(bf_params, 256);
570MVM_DEBUGFS_READ_WRITE_FILE_OPS(low_latency, 10);
571MVM_DEBUGFS_WRITE_FILE_OPS(reduced_txp, 10);
476 572
477void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif) 573void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
478{ 574{
@@ -496,15 +592,18 @@ void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
496 return; 592 return;
497 } 593 }
498 594
499 if (iwlmvm_mod_params.power_scheme != IWL_POWER_SCHEME_CAM && 595 if ((mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_PM_CMD_SUPPORT) &&
596 iwlmvm_mod_params.power_scheme != IWL_POWER_SCHEME_CAM &&
500 ((vif->type == NL80211_IFTYPE_STATION && !vif->p2p) || 597 ((vif->type == NL80211_IFTYPE_STATION && !vif->p2p) ||
501 (vif->type == NL80211_IFTYPE_STATION && vif->p2p && 598 (vif->type == NL80211_IFTYPE_STATION && vif->p2p &&
502 mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_P2P_PS))) 599 mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_BSS_P2P_PS_DCM)))
503 MVM_DEBUGFS_ADD_FILE_VIF(pm_params, mvmvif->dbgfs_dir, S_IWUSR | 600 MVM_DEBUGFS_ADD_FILE_VIF(pm_params, mvmvif->dbgfs_dir, S_IWUSR |
504 S_IRUSR); 601 S_IRUSR);
505 602
506 MVM_DEBUGFS_ADD_FILE_VIF(mac_params, mvmvif->dbgfs_dir, 603 MVM_DEBUGFS_ADD_FILE_VIF(mac_params, mvmvif->dbgfs_dir, S_IRUSR);
507 S_IRUSR); 604 MVM_DEBUGFS_ADD_FILE_VIF(reduced_txp, mvmvif->dbgfs_dir, S_IWUSR);
605 MVM_DEBUGFS_ADD_FILE_VIF(low_latency, mvmvif->dbgfs_dir,
606 S_IRUSR | S_IWUSR);
508 607
509 if (vif->type == NL80211_IFTYPE_STATION && !vif->p2p && 608 if (vif->type == NL80211_IFTYPE_STATION && !vif->p2p &&
510 mvmvif == mvm->bf_allowed_vif) 609 mvmvif == mvm->bf_allowed_vif)