Lines Matching +full:ieee80211 +full:- +full:freq +full:- +full:limit
1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
3 * Copyright (C) 2012-2014, 2018-2023 Intel Corporation
4 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
5 * Copyright (C) 2016-2017 Intel Deutschland GmbH
9 #include <linux/ieee80211.h>
15 #include "iwl-io.h"
17 #include "iwl-modparams.h"
18 #include "iwl-drv.h"
19 #include "fw/error-dump.h"
20 #include "fw/api/phy-ctxt.h"
26 struct iwl_mvm *mvm = file->private_data;
31 return -EOPNOTSUPP;
34 mvm->fwrt.cur_fw_img != IWL_UCODE_REGULAR)
35 return -EIO;
37 mutex_lock(&mvm->mutex);
39 mutex_unlock(&mvm->mutex);
65 return -EOPNOTSUPP;
68 mvm->fwrt.cur_fw_img != IWL_UCODE_REGULAR)
69 return -EIO;
71 mutex_lock(&mvm->mutex);
73 mutex_unlock(&mvm->mutex);
95 return -EOPNOTSUPP;
98 mvm->fwrt.cur_fw_img != IWL_UCODE_REGULAR)
99 return -EIO;
101 mutex_lock(&mvm->mutex);
103 mutex_unlock(&mvm->mutex);
112 mvm->fwrt.cur_fw_img != IWL_UCODE_REGULAR)
113 return -EIO;
127 mvm->fwrt.cur_fw_img != IWL_UCODE_REGULAR)
128 return -EIO;
131 return -EINVAL;
137 mutex_lock(&mvm->mutex);
140 mutex_unlock(&mvm->mutex);
147 mutex_lock(&mvm->mutex);
149 mutex_unlock(&mvm->mutex);
157 struct iwl_mvm *mvm = file->private_data;
164 return -EINVAL;
167 img = &mvm->fw->img[mvm->fwrt.cur_fw_img];
168 ofs = img->sec[IWL_UCODE_SECTION_DATA].offset;
169 len = img->sec[IWL_UCODE_SECTION_DATA].len;
171 if (mvm->dbgfs_sram_len) {
172 ofs = mvm->dbgfs_sram_offset;
173 len = mvm->dbgfs_sram_len;
178 return -ENOMEM;
180 iwl_trans_read_mem_bytes(mvm->trans, ofs, ptr, len);
197 return -EINVAL;
199 img = &mvm->fw->img[mvm->fwrt.cur_fw_img];
200 img_offset = img->sec[IWL_UCODE_SECTION_DATA].offset;
201 img_len = img->sec[IWL_UCODE_SECTION_DATA].len;
205 return -EINVAL;
208 return -EINVAL;
210 mvm->dbgfs_sram_offset = offset;
211 mvm->dbgfs_sram_len = len;
213 mvm->dbgfs_sram_offset = 0;
214 mvm->dbgfs_sram_len = 0;
224 struct iwl_mvm *mvm = file->private_data;
228 if (!mvm->temperature_test)
231 pos = scnprintf(buf, sizeof(buf), "%d\n", mvm->temperature);
239 * Enable: any value between IWL_MVM_DEBUG_SET_TEMPERATURE_MIN -
249 if (!iwl_mvm_firmware_running(mvm) && !mvm->temperature_test)
250 return -EIO;
253 return -EINVAL;
258 return -EINVAL;
260 mutex_lock(&mvm->mutex);
262 if (!mvm->temperature_test)
265 mvm->temperature_test = false;
270 mvm->temperature = 0;
272 mvm->temperature_test = true;
273 mvm->temperature = temperature;
276 mvm->temperature_test ? "En" : "Dis",
277 mvm->temperature);
282 mutex_unlock(&mvm->mutex);
291 struct iwl_mvm *mvm = file->private_data;
297 return -EIO;
299 mutex_lock(&mvm->mutex);
301 mutex_unlock(&mvm->mutex);
304 return -EIO;
316 struct iwl_mvm *mvm = file->private_data;
323 return -EIO;
325 mutex_lock(&mvm->mutex);
328 mutex_unlock(&mvm->mutex);
336 pos += scnprintf(buf + pos, bufsz - pos,
338 pos += scnprintf(buf + pos, bufsz - pos,
340 mvm->fwrt.geo_profiles[tbl_idx - 1].bands[0].chains[0],
341 mvm->fwrt.geo_profiles[tbl_idx - 1].bands[0].chains[1],
342 mvm->fwrt.geo_profiles[tbl_idx - 1].bands[0].max);
343 pos += scnprintf(buf + pos, bufsz - pos,
345 mvm->fwrt.geo_profiles[tbl_idx - 1].bands[1].chains[0],
346 mvm->fwrt.geo_profiles[tbl_idx - 1].bands[1].chains[1],
347 mvm->fwrt.geo_profiles[tbl_idx - 1].bands[1].max);
349 mutex_unlock(&mvm->mutex);
358 struct iwl_mvm *mvm = file->private_data;
363 err = iwl_bios_get_dsm(&mvm->fwrt, DSM_FUNC_ENABLE_6E, &value);
376 struct iwl_mvm *mvm = file->private_data;
381 mutex_lock(&mvm->mutex);
383 for (i = 0; i < mvm->fw->ucode_capa.num_stations; i++) {
384 pos += scnprintf(buf + pos, bufsz - pos, "%.2d: ", i);
385 sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[i],
386 lockdep_is_held(&mvm->mutex));
388 pos += scnprintf(buf + pos, bufsz - pos, "N/A\n");
390 pos += scnprintf(buf + pos, bufsz - pos, "%ld\n",
393 pos += scnprintf(buf + pos, bufsz - pos, "%pM\n",
394 sta->addr);
397 mutex_unlock(&mvm->mutex);
409 struct iwl_lq_sta_rs_fw *lq_sta = &mvm_link_sta->lq_sta.rs_fw;
417 return -ENOMEM;
419 desc += scnprintf(buff + desc, bufsz - desc, "sta_id %d\n",
420 lq_sta->pers.sta_id);
421 desc += scnprintf(buff + desc, bufsz - desc,
423 lq_sta->pers.dbg_fixed_rate);
424 desc += scnprintf(buff + desc, bufsz - desc,
425 "A-MPDU size limit %d\n",
426 lq_sta->pers.dbg_agg_frame_count_lim);
427 desc += scnprintf(buff + desc, bufsz - desc,
431 desc += scnprintf(buff + desc, bufsz - desc,
433 lq_sta->last_rate_n_flags);
435 desc += rs_pretty_print_rate(buff + desc, bufsz - desc,
436 lq_sta->last_rate_n_flags);
437 if (desc < bufsz - 1)
456 return -EINVAL;
458 /* only change from debug set <-> debug unset */
459 if (amsdu_len && mvm_link_sta->orig_amsdu_len)
460 return -EBUSY;
463 mvm_link_sta->orig_amsdu_len = link_sta->agg.max_amsdu_len;
464 link_sta->agg.max_amsdu_len = amsdu_len;
465 link_sta->agg.max_amsdu_len = amsdu_len;
466 for (i = 0; i < ARRAY_SIZE(link_sta->agg.max_tid_amsdu_len); i++)
467 link_sta->agg.max_tid_amsdu_len[i] = amsdu_len;
469 link_sta->agg.max_amsdu_len = mvm_link_sta->orig_amsdu_len;
470 mvm_link_sta->orig_amsdu_len = 0;
473 ieee80211_sta_recalc_aggregates(link_sta->sta);
489 link_sta->agg.max_amsdu_len);
490 pos += scnprintf(buf + pos, sizeof(buf) - pos, "stored %d\n",
491 mvm_link_sta->orig_amsdu_len);
500 struct iwl_mvm *mvm = file->private_data;
505 pos += scnprintf(buf+pos, bufsz-pos, "disable_power_off_d0=%d\n",
506 mvm->disable_power_off);
507 pos += scnprintf(buf+pos, bufsz-pos, "disable_power_off_d3=%d\n",
508 mvm->disable_power_off_d3);
519 return -EIO;
523 return -EINVAL;
524 mvm->disable_power_off = val;
527 return -EINVAL;
528 mvm->disable_power_off_d3 = val;
530 return -EINVAL;
533 mutex_lock(&mvm->mutex);
535 mutex_unlock(&mvm->mutex);
543 struct iwl_mvm *mvm = file->private_data;
550 return -ENOMEM;
555 pos += scnprintf(pos, endpos - pos, "FW id: %s\n",
556 mvm->fwrt.fw->fw_version);
557 pos += scnprintf(pos, endpos - pos, "FW: %s\n",
558 mvm->fwrt.fw->human_readable);
559 pos += scnprintf(pos, endpos - pos, "Device: %s\n",
560 mvm->fwrt.trans->name);
561 pos += scnprintf(pos, endpos - pos, "Bus: %s\n",
563 mvm->fwrt.dev->bus->name);
568 ret = simple_read_from_buffer(user_buf, count, ppos, buff, pos - buff);
578 struct iwl_mvm *mvm = file->private_data;
587 "Due To SAR Limit Less Than 6 dBm",
614 return -ENODEV;
616 mutex_lock(&mvm->mutex);
618 mutex_unlock(&mvm->mutex);
624 return -ENOMEM;
628 rsp = (void *)hcmd.resp_pkt->data;
630 pos += scnprintf(pos, endpos - pos, "TAS Conclusion:\n");
631 for (i = 0; i < rsp->in_dual_radio + 1; i++) {
632 if (rsp->tas_status_mac[i].band != TAS_LMAC_BAND_INVALID &&
633 rsp->tas_status_mac[i].dynamic_status & BIT(TAS_DYNA_ACTIVE)) {
634 pos += scnprintf(pos, endpos - pos, "\tON for ");
635 switch (rsp->tas_status_mac[i].band) {
637 pos += scnprintf(pos, endpos - pos, "HB\n");
640 pos += scnprintf(pos, endpos - pos, "LB\n");
643 pos += scnprintf(pos, endpos - pos, "UHB\n");
646 pos += scnprintf(pos, endpos - pos,
650 pos += scnprintf(pos, endpos - pos,
652 rsp->tas_status_mac[i].band);
659 pos += scnprintf(pos, endpos - pos, "\tOFF\n");
661 pos += scnprintf(pos, endpos - pos, "TAS Report\n");
662 pos += scnprintf(pos, endpos - pos, "TAS FW version: %d\n",
663 rsp->tas_fw_version);
664 pos += scnprintf(pos, endpos - pos, "Is UHB enabled for USA?: %s\n",
665 rsp->is_uhb_for_usa_enable ? "True" : "False");
666 pos += scnprintf(pos, endpos - pos, "Current MCC: 0x%x\n",
667 le16_to_cpu(rsp->curr_mcc));
669 pos += scnprintf(pos, endpos - pos, "Block list entries:");
671 pos += scnprintf(pos, endpos - pos, " 0x%x",
672 le16_to_cpu(rsp->block_list[i]));
674 pos += scnprintf(pos, endpos - pos, "\nOEM name: %s\n",
676 pos += scnprintf(pos, endpos - pos, "\tVendor In Approved List: %s\n",
678 pos += scnprintf(pos, endpos - pos,
680 rsp->in_dual_radio ? "TRUE" : "FALSE");
682 for (i = 0; i < rsp->in_dual_radio + 1; i++) {
683 if (rsp->tas_status_mac[i].static_status == 0) {
684 pos += scnprintf(pos, endpos - pos,
686 pos += scnprintf(pos, endpos - pos,
692 pos += scnprintf(pos, endpos - pos, "TAS status for ");
693 switch (rsp->tas_status_mac[i].band) {
695 pos += scnprintf(pos, endpos - pos, "High band\n");
698 pos += scnprintf(pos, endpos - pos, "Low band\n");
701 pos += scnprintf(pos, endpos - pos,
705 pos += scnprintf(pos, endpos - pos,
709 pos += scnprintf(pos, endpos - pos,
711 rsp->tas_status_mac[i].band);
714 pos += scnprintf(pos, endpos - pos, "Static status: %sabled\n",
715 rsp->tas_status_mac[i].static_status ?
717 pos += scnprintf(pos, endpos - pos,
719 if (rsp->tas_status_mac[i].static_dis_reason < TAS_DISABLED_REASON_MAX)
720 pos += scnprintf(pos, endpos - pos, "%s (%d)\n",
721 tas_dis_reason[rsp->tas_status_mac[i].static_dis_reason],
722 rsp->tas_status_mac[i].static_dis_reason);
724 pos += scnprintf(pos, endpos - pos,
726 rsp->tas_status_mac[i].static_dis_reason);
728 pos += scnprintf(pos, endpos - pos, "Dynamic status:\n");
729 dyn_status = (rsp->tas_status_mac[i].dynamic_status);
732 pos += scnprintf(pos, endpos - pos,
737 pos += scnprintf(pos, endpos - pos,
739 rsp->tas_status_mac[i].near_disconnection ?
741 tmp = le16_to_cpu(rsp->tas_status_mac[i].max_reg_pwr_limit);
742 pos += scnprintf(pos, endpos - pos,
743 "Max. regulatory pwr limit (dBm): %d.%03d\n",
745 tmp = le16_to_cpu(rsp->tas_status_mac[i].sar_limit);
746 pos += scnprintf(pos, endpos - pos,
747 "SAR limit (dBm): %d.%03d\n",
752 ret = simple_read_from_buffer(user_buf, count, ppos, buff, pos - buff);
762 struct iwl_mvm *mvm = file->private_data;
768 bufsz = mvm->fw->phy_integration_ver_len + 2;
771 return -ENOMEM;
773 pos = scnprintf(buf, bufsz, "%.*s\n", mvm->fw->phy_integration_ver_len,
774 mvm->fw->phy_integration_ver);
783 pos += scnprintf(buf + pos, bufsz - pos, \
785 le32_to_cpu(_struct->_memb))
791 struct iwl_mvm *mvm = file->private_data;
792 static const char *fmt_table = "\t%-30s %10u\n";
793 static const char *fmt_header = "%-32s\n";
798 u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw,
804 return -EOPNOTSUPP;
816 return -ENOMEM;
818 mutex_lock(&mvm->mutex);
823 pos += scnprintf(buf + pos, bufsz - pos, fmt_header,
824 "Statistics_Rx - OFDM");
826 struct mvm_statistics_rx_phy_v2 *ofdm = &mvm->rx_stats_v3.ofdm;
849 struct mvm_statistics_rx_phy *ofdm = &mvm->rx_stats.ofdm;
858 pos += scnprintf(buf + pos, bufsz - pos, fmt_header,
859 "Statistics_Rx - CCK");
861 struct mvm_statistics_rx_phy_v2 *cck = &mvm->rx_stats_v3.cck;
884 struct mvm_statistics_rx_phy *cck = &mvm->rx_stats.cck;
893 pos += scnprintf(buf + pos, bufsz - pos, fmt_header,
894 "Statistics_Rx - GENERAL");
897 &mvm->rx_stats_v3.general;
925 &mvm->rx_stats.general;
949 pos += scnprintf(buf + pos, bufsz - pos, fmt_header,
950 "Statistics_Rx - HT");
953 &mvm->rx_stats_v3.ofdm_ht;
967 &mvm->rx_stats.ofdm_ht;
975 mutex_unlock(&mvm->mutex);
994 struct iwl_mvm *mvm = file->private_data;
995 u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw,
1005 return -ENOMEM;
1011 pos += scnprintf(pos, endpos - pos,
1016 mutex_lock(&mvm->mutex);
1025 if (vif->type == NL80211_IFTYPE_STATION)
1030 pos += scnprintf(pos, endpos - pos, "vif is NULL\n");
1036 pos += scnprintf(pos, endpos - pos, "mvmvif is NULL\n");
1041 struct iwl_mvm_vif_link_info *link_info = mvmvif->link[i];
1043 pos += scnprintf(pos, endpos - pos,
1045 pos += scnprintf(pos, endpos - pos,
1047 link_info->beacon_stats.num_beacons);
1048 pos += scnprintf(pos, endpos - pos,
1050 link_info->beacon_stats.accu_num_beacons);
1051 pos += scnprintf(pos, endpos - pos,
1053 link_info->beacon_stats.avg_signal);
1056 pos += scnprintf(pos, endpos - pos,
1058 mvm->radio_stats.rx_time);
1059 pos += scnprintf(pos, endpos - pos,
1061 mvm->radio_stats.tx_time);
1062 pos += scnprintf(pos, endpos - pos,
1064 mvm->accu_radio_stats.rx_time);
1065 pos += scnprintf(pos, endpos - pos,
1067 mvm->accu_radio_stats.tx_time);
1070 mutex_unlock(&mvm->mutex);
1073 ret = simple_read_from_buffer(user_buf, count, ppos, buff, pos - buff);
1091 return -ENOMEM;
1093 spin_lock_bh(&mvm->drv_stats_lock);
1098 pos += scnprintf(pos, endpos - pos,
1100 stats->legacy_frames,
1101 stats->ht_frames,
1102 stats->vht_frames);
1103 pos += scnprintf(pos, endpos - pos, "20/40/80\t:\t%d/%d/%d\n",
1104 stats->bw_20_frames,
1105 stats->bw_40_frames,
1106 stats->bw_80_frames);
1107 pos += scnprintf(pos, endpos - pos, "NGI/SGI\t\t:\t%d/%d\n",
1108 stats->ngi_frames,
1109 stats->sgi_frames);
1110 pos += scnprintf(pos, endpos - pos, "SISO/MIMO2\t:\t%d/%d\n",
1111 stats->siso_frames,
1112 stats->mimo2_frames);
1113 pos += scnprintf(pos, endpos - pos, "FAIL/SCSS\t:\t%d/%d\n",
1114 stats->fail_frames,
1115 stats->success_frames);
1116 pos += scnprintf(pos, endpos - pos, "MPDUs agg\t:\t%d\n",
1117 stats->agg_frames);
1118 pos += scnprintf(pos, endpos - pos, "A-MPDUs\t\t:\t%d\n",
1119 stats->ampdu_count);
1120 pos += scnprintf(pos, endpos - pos, "Avg MPDUs/A-MPDU:\t%d\n",
1121 stats->ampdu_count > 0 ?
1122 (stats->agg_frames / stats->ampdu_count) : 0);
1124 pos += scnprintf(pos, endpos - pos, "Last Rates\n");
1126 idx = stats->last_frame_idx - 1;
1127 for (i = 0; i < ARRAY_SIZE(stats->last_rates); i++) {
1128 idx = (idx + 1) % ARRAY_SIZE(stats->last_rates);
1129 if (stats->last_rates[idx] == 0)
1131 pos += scnprintf(pos, endpos - pos, "Rate[%d]: ",
1132 (int)(ARRAY_SIZE(stats->last_rates) - i));
1133 pos += rs_pretty_print_rate_v1(pos, endpos - pos,
1134 stats->last_rates[idx]);
1135 if (pos < endpos - 1)
1138 spin_unlock_bh(&mvm->drv_stats_lock);
1140 ret = simple_read_from_buffer(user_buf, count, ppos, buff, pos - buff);
1150 struct iwl_mvm *mvm = file->private_data;
1153 &mvm->drv_rx_stats);
1162 return -EIO;
1164 mutex_lock(&mvm->mutex);
1167 if (mvm->fw_restart >= 0)
1168 mvm->fw_restart++;
1171 set_bit(IWL_MVM_STATUS_SUPPRESS_ERROR_LOG_ONCE, &mvm->status);
1172 set_bit(STATUS_SUPPRESS_CMD_ERROR_ONCE, &mvm->trans->status);
1175 /* take the return value to make compiler happy - it will fail anyway */
1180 mutex_unlock(&mvm->mutex);
1189 return -EIO;
1194 set_bit(IWL_MVM_STATUS_SUPPRESS_ERROR_LOG_ONCE, &mvm->status);
1196 iwl_force_nmi(mvm->trans);
1206 struct iwl_mvm *mvm = file->private_data;
1212 pos += scnprintf(buf + pos, bufsz - pos, "Antennas for scan: ");
1213 if (mvm->scan_rx_ant & ANT_A)
1214 pos += scnprintf(buf + pos, bufsz - pos, "A");
1215 if (mvm->scan_rx_ant & ANT_B)
1216 pos += scnprintf(buf + pos, bufsz - pos, "B");
1217 pos += scnprintf(buf + pos, bufsz - pos, " (%x)\n", mvm->scan_rx_ant);
1229 return -EIO;
1232 return -EINVAL;
1234 return -EINVAL;
1236 return -EINVAL;
1238 if (mvm->scan_rx_ant != scan_rx_ant) {
1239 mvm->scan_rx_ant = scan_rx_ant;
1240 if (fw_has_capa(&mvm->fw->ucode_capa,
1272 * queues 3 - 14).
1284 mutex_lock(&mvm->mutex);
1290 mutex_unlock(&mvm->mutex);
1309 int ret = -EINVAL;
1312 return -EIO;
1315 if (!mvm->trans->trans_cfg->mq_rx_supported)
1316 return -EOPNOTSUPP;
1320 return -ENOMEM;
1358 return -EINVAL;
1361 return -EIO;
1364 !fw_has_api(&mvm->fw->ucode_capa,
1366 return -EINVAL;
1368 mutex_lock(&mvm->mutex);
1375 if (vif->type == NL80211_IFTYPE_AP)
1382 mvm->hw->extra_beacon_tailroom = len;
1384 beacon = ieee80211_beacon_get_template(mvm->hw, vif, NULL, 0);
1393 mvm->beacon_inject_active = true;
1401 cpu_to_le16(iwl_mvm_mac_ctxt_get_beacon_flags(mvm->fw,
1403 beacon_cmd.byte_cnt = cpu_to_le16((u16)beacon->len);
1404 if (iwl_fw_lookup_cmd_ver(mvm->fw, BEACON_TEMPLATE_CMD, 0) > 12)
1406 cpu_to_le32(mvmvif->link[link_id]->fw_link_id);
1408 beacon_cmd.link_id = cpu_to_le32((u32)mvmvif->id);
1412 beacon->data, beacon->len);
1414 if (iwl_fw_lookup_cmd_ver(mvm->fw,
1416 u32 offset = iwl_mvm_find_ie_offset(beacon->data,
1418 beacon->len);
1426 mutex_unlock(&mvm->mutex);
1433 mutex_unlock(&mvm->mutex);
1434 return -EINVAL;
1443 mvm->hw->extra_beacon_tailroom = 0;
1454 mvm->hw->extra_beacon_tailroom = 0;
1455 mvm->beacon_inject_active = false;
1463 struct iwl_mvm *mvm = file->private_data;
1469 mutex_lock(&mvm->mutex);
1470 conf = mvm->fwrt.dump.conf;
1471 mutex_unlock(&mvm->mutex);
1473 pos += scnprintf(buf + pos, bufsz - pos, "%d\n", conf);
1486 return -EIO;
1493 return -EINVAL;
1495 mutex_lock(&mvm->mutex);
1496 ret = iwl_fw_start_dbg_conf(&mvm->fwrt, conf_id);
1497 mutex_unlock(&mvm->mutex);
1509 iwl_dbg_tlv_time_point(&mvm->fwrt, IWL_FW_INI_TIME_POINT_USER_TRIGGER,
1512 iwl_fw_dbg_collect(&mvm->fwrt, FW_DBG_TRIGGER_USER, buf,
1513 (count - 1), NULL);
1522 if (mvm->trans->trans_cfg->device_family < IWL_DEVICE_FAMILY_9000)
1523 return -EOPNOTSUPP;
1525 mutex_lock(&mvm->mutex);
1526 iwl_fw_dbg_clear_monitor_buf(&mvm->fwrt);
1527 mutex_unlock(&mvm->mutex);
1539 return -EINVAL;
1543 return -EINVAL;
1545 iwl_dbg_tlv_time_point(&mvm->fwrt, timepoint, NULL);
1571 struct ieee80211_link_sta *link_sta = file->private_data;
1572 struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(link_sta->sta);
1573 struct iwl_mvm *mvm = iwl_mvm_vif_from_mac80211(mvmsta->vif)->mvm;
1577 mutex_lock(&mvm->mutex);
1579 mvm_link_sta = rcu_dereference_protected(mvmsta->link[link_sta->link_id],
1580 lockdep_is_held(&mvm->mutex));
1582 mutex_unlock(&mvm->mutex);
1583 return -ENODEV;
1588 mutex_unlock(&mvm->mutex);
1603 struct ieee80211_link_sta *link_sta = file->private_data;
1604 struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(link_sta->sta);
1605 struct iwl_mvm *mvm = iwl_mvm_vif_from_mac80211(mvmsta->vif)->mvm;
1609 mutex_lock(&mvm->mutex);
1611 mvm_link_sta = rcu_dereference_protected(mvmsta->link[link_sta->link_id],
1612 lockdep_is_held(&mvm->mutex));
1614 mutex_unlock(&mvm->mutex);
1615 return -ENODEV;
1620 mutex_unlock(&mvm->mutex);
1631 size_t buf_size = min(count, sizeof(buf) - 1); \
1634 return -EFAULT; \
1688 struct iwl_mvm *mvm = file->private_data;
1693 if (!mvm->dbgfs_prph_reg_addr)
1694 return -EINVAL;
1696 pos += scnprintf(buf + pos, bufsz - pos, "Reg 0x%x: (0x%x)\n",
1697 mvm->dbgfs_prph_reg_addr,
1698 iwl_read_prph(mvm->trans, mvm->dbgfs_prph_reg_addr));
1710 args = sscanf(buf, "%i %i", &mvm->dbgfs_prph_reg_addr, &value);
1711 /* if we only want to set the reg address - nothing more to do */
1717 return -EINVAL;
1719 iwl_write_prph(mvm->trans, mvm->dbgfs_prph_reg_addr, value);
1732 return -EIO;
1734 mutex_lock(&mvm->mutex);
1736 mutex_unlock(&mvm->mutex);
1752 apply->mvm->cur_aid = cpu_to_le16(apply->aid);
1753 memcpy(apply->mvm->cur_bssid, apply->bssid,
1754 sizeof(apply->mvm->cur_bssid));
1775 return -EIO;
1782 return -EINVAL;
1789 mutex_lock(&mvm->mutex);
1795 * still have mvm->cur_aid pointing to the old AID, and that
1798 * get mvm->cur_aid correctly set to the new AID.
1800 iwl_init_notification_wait(&mvm->notif_wait, &wait,
1810 iwl_remove_notification(&mvm->notif_wait, &wait);
1812 mutex_unlock(&mvm->mutex);
1821 struct iwl_mvm *mvm = file->private_data;
1827 le16_to_cpu(mvm->cur_aid), mvm->cur_bssid[0],
1828 mvm->cur_bssid[1], mvm->cur_bssid[2], mvm->cur_bssid[3],
1829 mvm->cur_bssid[4], mvm->cur_bssid[5]);
1838 struct iwl_mvm *mvm = file->private_data;
1844 mutex_lock(&mvm->mutex);
1847 pos += scnprintf(buf + pos, bufsz - pos, "%pM\n",
1848 mvm->uapsd_noagg_bssids[i].addr);
1850 mutex_unlock(&mvm->mutex);
1863 return -EIO;
1873 return -EINVAL;
1876 mutex_lock(&mvm->mutex);
1879 mutex_unlock(&mvm->mutex);
1894 return -EINVAL;
1896 /* value zero triggers re-sending the default table to the device */
1898 mutex_lock(&mvm->mutex);
1900 mutex_unlock(&mvm->mutex);
1902 ret = -EOPNOTSUPP; /* in the future a new table will be added */
1910 * the table; So, need 5 chars for the "freq: " part and each tuple afterwards
1920 struct iwl_mvm *mvm = file->private_data;
1930 status = le32_to_cpu(resp->status);
1936 for (i = 0; i < ARRAY_SIZE(resp->table); i++) {
1937 pos += scnprintf(buf + pos, IWL_RFI_BUF_SIZE - pos, "%d: ",
1938 resp->table[i].freq);
1940 for (j = 0; j < ARRAY_SIZE(resp->table[i].channels); j++)
1941 pos += scnprintf(buf + pos, IWL_RFI_BUF_SIZE - pos,
1943 resp->table[i].channels[j],
1944 resp->table[i].bands[j]);
1945 pos += scnprintf(buf + pos, IWL_RFI_BUF_SIZE - pos, "\n");
2004 struct iwl_mvm *mvm = file->private_data;
2016 return -EIO;
2023 cmd.addr = cpu_to_le32(*ppos - delta);
2027 mutex_lock(&mvm->mutex);
2029 mutex_unlock(&mvm->mutex);
2035 ret = -EIO;
2039 rsp = (void *)hcmd.resp_pkt->data;
2040 if (le32_to_cpu(rsp->status) != DEBUG_MEM_STATUS_SUCCESS) {
2041 ret = -ENXIO;
2045 len = min((size_t)le32_to_cpu(rsp->len) << 2,
2046 iwl_rx_packet_payload_len(hcmd.resp_pkt) - sizeof(*rsp));
2047 len = min(len - delta, count);
2049 ret = -EFAULT;
2053 ret = len - copy_to_user(user_buf, (u8 *)rsp->data + delta, len);
2065 struct iwl_mvm *mvm = file->private_data;
2075 return -EIO;
2081 len = min(count, (size_t)(4 - (*ppos & 0x3)));
2092 return -ENOMEM;
2094 cmd->op = cpu_to_le32(op);
2095 cmd->len = cpu_to_le32(len);
2096 cmd->addr = cpu_to_le32(*ppos);
2097 if (copy_from_user((void *)cmd->data, user_buf, data_size)) {
2099 return -EFAULT;
2106 mutex_lock(&mvm->mutex);
2108 mutex_unlock(&mvm->mutex);
2116 ret = -EIO;
2120 rsp = (void *)hcmd.resp_pkt->data;
2121 if (rsp->status != DEBUG_MEM_STATUS_SUCCESS) {
2122 ret = -ENXIO;
2159 spin_lock_init(&mvm->drv_stats_lock);
2161 MVM_DEBUGFS_ADD_FILE(tx_flush, mvm->debugfs_dir, 0200);
2162 MVM_DEBUGFS_ADD_FILE(sram, mvm->debugfs_dir, 0600);
2163 MVM_DEBUGFS_ADD_FILE(set_nic_temperature, mvm->debugfs_dir, 0600);
2164 MVM_DEBUGFS_ADD_FILE(nic_temp, mvm->debugfs_dir, 0400);
2165 MVM_DEBUGFS_ADD_FILE(ctdp_budget, mvm->debugfs_dir, 0400);
2166 MVM_DEBUGFS_ADD_FILE(stop_ctdp, mvm->debugfs_dir, 0200);
2167 MVM_DEBUGFS_ADD_FILE(start_ctdp, mvm->debugfs_dir, 0200);
2168 MVM_DEBUGFS_ADD_FILE(force_ctkill, mvm->debugfs_dir, 0200);
2169 MVM_DEBUGFS_ADD_FILE(stations, mvm->debugfs_dir, 0400);
2170 MVM_DEBUGFS_ADD_FILE(disable_power_off, mvm->debugfs_dir, 0600);
2171 MVM_DEBUGFS_ADD_FILE(fw_ver, mvm->debugfs_dir, 0400);
2172 MVM_DEBUGFS_ADD_FILE(fw_rx_stats, mvm->debugfs_dir, 0400);
2173 MVM_DEBUGFS_ADD_FILE(drv_rx_stats, mvm->debugfs_dir, 0400);
2174 MVM_DEBUGFS_ADD_FILE(fw_system_stats, mvm->debugfs_dir, 0400);
2175 MVM_DEBUGFS_ADD_FILE(fw_restart, mvm->debugfs_dir, 0200);
2176 MVM_DEBUGFS_ADD_FILE(fw_nmi, mvm->debugfs_dir, 0200);
2177 MVM_DEBUGFS_ADD_FILE(scan_ant_rxchain, mvm->debugfs_dir, 0600);
2178 MVM_DEBUGFS_ADD_FILE(prph_reg, mvm->debugfs_dir, 0600);
2179 MVM_DEBUGFS_ADD_FILE(fw_dbg_conf, mvm->debugfs_dir, 0600);
2180 MVM_DEBUGFS_ADD_FILE(fw_dbg_collect, mvm->debugfs_dir, 0200);
2181 MVM_DEBUGFS_ADD_FILE(fw_dbg_clear, mvm->debugfs_dir, 0200);
2182 MVM_DEBUGFS_ADD_FILE(dbg_time_point, mvm->debugfs_dir, 0200);
2183 MVM_DEBUGFS_ADD_FILE(send_echo_cmd, mvm->debugfs_dir, 0200);
2184 MVM_DEBUGFS_ADD_FILE(indirection_tbl, mvm->debugfs_dir, 0200);
2185 MVM_DEBUGFS_ADD_FILE(inject_packet, mvm->debugfs_dir, 0200);
2186 MVM_DEBUGFS_ADD_FILE(inject_beacon_ie, mvm->debugfs_dir, 0200);
2187 MVM_DEBUGFS_ADD_FILE(inject_beacon_ie_restore, mvm->debugfs_dir, 0200);
2188 MVM_DEBUGFS_ADD_FILE(rfi_freq_table, mvm->debugfs_dir, 0600);
2190 if (mvm->fw->phy_integration_ver)
2191 MVM_DEBUGFS_ADD_FILE(phy_integration_ver, mvm->debugfs_dir, 0400);
2192 MVM_DEBUGFS_ADD_FILE(tas_get_status, mvm->debugfs_dir, 0400);
2194 MVM_DEBUGFS_ADD_FILE(sar_geo_profile, mvm->debugfs_dir, 0400);
2195 MVM_DEBUGFS_ADD_FILE(wifi_6e_enable, mvm->debugfs_dir, 0400);
2197 MVM_DEBUGFS_ADD_FILE(he_sniffer_params, mvm->debugfs_dir, 0600);
2199 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_SET_LTR_GEN2))
2200 MVM_DEBUGFS_ADD_FILE(ltr_config, mvm->debugfs_dir, 0200);
2203 mvm->debugfs_dir, &mvm->scan_iter_notif_enabled);
2204 debugfs_create_bool("drop_bcn_ap_mode", 0600, mvm->debugfs_dir,
2205 &mvm->drop_bcn_ap_mode);
2207 MVM_DEBUGFS_ADD_FILE(uapsd_noagg_bssids, mvm->debugfs_dir, S_IRUSR);
2210 MVM_DEBUGFS_ADD_FILE(d3_test, mvm->debugfs_dir, 0400);
2211 debugfs_create_bool("d3_wake_sysassert", 0600, mvm->debugfs_dir,
2212 &mvm->d3_wake_sysassert);
2213 debugfs_create_u32("last_netdetect_scans", 0400, mvm->debugfs_dir,
2214 &mvm->last_netdetect_scans);
2217 debugfs_create_u8("ps_disabled", 0400, mvm->debugfs_dir,
2218 &mvm->ps_disabled);
2219 debugfs_create_blob("nvm_hw", 0400, mvm->debugfs_dir,
2220 &mvm->nvm_hw_blob);
2221 debugfs_create_blob("nvm_sw", 0400, mvm->debugfs_dir,
2222 &mvm->nvm_sw_blob);
2223 debugfs_create_blob("nvm_calib", 0400, mvm->debugfs_dir,
2224 &mvm->nvm_calib_blob);
2225 debugfs_create_blob("nvm_prod", 0400, mvm->debugfs_dir,
2226 &mvm->nvm_prod_blob);
2227 debugfs_create_blob("nvm_phy_sku", 0400, mvm->debugfs_dir,
2228 &mvm->nvm_phy_sku_blob);
2230 mvm->debugfs_dir, &mvm->nvm_reg_blob);
2232 debugfs_create_file("mem", 0600, mvm->debugfs_dir, mvm,
2235 debugfs_create_bool("rx_ts_ptp", 0600, mvm->debugfs_dir,
2236 &mvm->rx_ts_ptp);
2243 if (!IS_ERR(mvm->debugfs_dir)) {
2246 snprintf(buf, 100, "../../%pd2", mvm->debugfs_dir->d_parent);
2247 debugfs_create_symlink("iwlwifi", mvm->hw->wiphy->debugfsdir,