aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c')
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c83
1 files changed, 67 insertions, 16 deletions
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
index 0e6401cd7ccc..3b6b3d8fb961 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
@@ -19,11 +19,6 @@
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details. 20 * General Public License for more details.
21 * 21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
25 * USA
26 *
27 * The full GNU General Public License is included in this distribution 22 * The full GNU General Public License is included in this distribution
28 * in the file called COPYING. 23 * in the file called COPYING.
29 * 24 *
@@ -671,16 +666,11 @@ iwl_dbgfs_bt_force_ant_write(struct iwl_mvm *mvm, char *buf,
671 }; 666 };
672 int ret, bt_force_ant_mode; 667 int ret, bt_force_ant_mode;
673 668
674 for (bt_force_ant_mode = 0; 669 ret = match_string(modes_str, ARRAY_SIZE(modes_str), buf);
675 bt_force_ant_mode < ARRAY_SIZE(modes_str); 670 if (ret < 0)
676 bt_force_ant_mode++) { 671 return ret;
677 if (!strcmp(buf, modes_str[bt_force_ant_mode]))
678 break;
679 }
680
681 if (bt_force_ant_mode >= ARRAY_SIZE(modes_str))
682 return -EINVAL;
683 672
673 bt_force_ant_mode = ret;
684 ret = 0; 674 ret = 0;
685 mutex_lock(&mvm->mutex); 675 mutex_lock(&mvm->mutex);
686 if (mvm->bt_force_ant_mode == bt_force_ant_mode) 676 if (mvm->bt_force_ant_mode == bt_force_ant_mode)
@@ -1150,6 +1140,10 @@ static ssize_t iwl_dbgfs_inject_packet_write(struct iwl_mvm *mvm,
1150 struct iwl_rx_mpdu_desc *desc; 1140 struct iwl_rx_mpdu_desc *desc;
1151 int bin_len = count / 2; 1141 int bin_len = count / 2;
1152 int ret = -EINVAL; 1142 int ret = -EINVAL;
1143 size_t mpdu_cmd_hdr_size =
1144 (mvm->trans->cfg->device_family >= IWL_DEVICE_FAMILY_22560) ?
1145 sizeof(struct iwl_rx_mpdu_desc) :
1146 IWL_RX_DESC_SIZE_V1;
1153 1147
1154 if (!iwl_mvm_firmware_running(mvm)) 1148 if (!iwl_mvm_firmware_running(mvm))
1155 return -EIO; 1149 return -EIO;
@@ -1168,7 +1162,7 @@ static ssize_t iwl_dbgfs_inject_packet_write(struct iwl_mvm *mvm,
1168 goto out; 1162 goto out;
1169 1163
1170 /* avoid invalid memory access */ 1164 /* avoid invalid memory access */
1171 if (bin_len < sizeof(*pkt) + sizeof(*desc)) 1165 if (bin_len < sizeof(*pkt) + mpdu_cmd_hdr_size)
1172 goto out; 1166 goto out;
1173 1167
1174 /* check this is RX packet */ 1168 /* check this is RX packet */
@@ -1179,7 +1173,7 @@ static ssize_t iwl_dbgfs_inject_packet_write(struct iwl_mvm *mvm,
1179 /* check the length in metadata matches actual received length */ 1173 /* check the length in metadata matches actual received length */
1180 desc = (void *)pkt->data; 1174 desc = (void *)pkt->data;
1181 if (le16_to_cpu(desc->mpdu_len) != 1175 if (le16_to_cpu(desc->mpdu_len) !=
1182 (bin_len - sizeof(*desc) - sizeof(*pkt))) 1176 (bin_len - mpdu_cmd_hdr_size - sizeof(*pkt)))
1183 goto out; 1177 goto out;
1184 1178
1185 local_bh_disable(); 1179 local_bh_disable();
@@ -1728,6 +1722,56 @@ iwl_dbgfs_send_echo_cmd_write(struct iwl_mvm *mvm, char *buf,
1728 return ret ?: count; 1722 return ret ?: count;
1729} 1723}
1730 1724
1725static ssize_t
1726iwl_dbgfs_he_sniffer_params_write(struct iwl_mvm *mvm, char *buf,
1727 size_t count, loff_t *ppos)
1728{
1729 struct iwl_he_monitor_cmd he_mon_cmd = {};
1730 u32 aid;
1731 int ret;
1732
1733 if (!iwl_mvm_firmware_running(mvm))
1734 return -EIO;
1735
1736 ret = sscanf(buf, "%x %2hhx:%2hhx:%2hhx:%2hhx:%2hhx:%2hhx", &aid,
1737 &he_mon_cmd.bssid[0], &he_mon_cmd.bssid[1],
1738 &he_mon_cmd.bssid[2], &he_mon_cmd.bssid[3],
1739 &he_mon_cmd.bssid[4], &he_mon_cmd.bssid[5]);
1740 if (ret != 7)
1741 return -EINVAL;
1742
1743 he_mon_cmd.aid = cpu_to_le16(aid);
1744
1745 mutex_lock(&mvm->mutex);
1746 ret = iwl_mvm_send_cmd_pdu(mvm, iwl_cmd_id(HE_AIR_SNIFFER_CONFIG_CMD,
1747 DATA_PATH_GROUP, 0), 0,
1748 sizeof(he_mon_cmd), &he_mon_cmd);
1749 mutex_unlock(&mvm->mutex);
1750
1751 return ret ?: count;
1752}
1753
1754static ssize_t
1755iwl_dbgfs_uapsd_noagg_bssids_read(struct file *file, char __user *user_buf,
1756 size_t count, loff_t *ppos)
1757{
1758 struct iwl_mvm *mvm = file->private_data;
1759 u8 buf[IWL_MVM_UAPSD_NOAGG_BSSIDS_NUM * ETH_ALEN * 3 + 1];
1760 unsigned int pos = 0;
1761 size_t bufsz = sizeof(buf);
1762 int i;
1763
1764 mutex_lock(&mvm->mutex);
1765
1766 for (i = 0; i < IWL_MVM_UAPSD_NOAGG_LIST_LEN; i++)
1767 pos += scnprintf(buf + pos, bufsz - pos, "%pM\n",
1768 mvm->uapsd_noagg_bssids[i].addr);
1769
1770 mutex_unlock(&mvm->mutex);
1771
1772 return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1773}
1774
1731MVM_DEBUGFS_READ_WRITE_FILE_OPS(prph_reg, 64); 1775MVM_DEBUGFS_READ_WRITE_FILE_OPS(prph_reg, 64);
1732 1776
1733/* Device wide debugfs entries */ 1777/* Device wide debugfs entries */
@@ -1762,6 +1806,8 @@ MVM_DEBUGFS_WRITE_FILE_OPS(indirection_tbl,
1762 (IWL_RSS_INDIRECTION_TABLE_SIZE * 2)); 1806 (IWL_RSS_INDIRECTION_TABLE_SIZE * 2));
1763MVM_DEBUGFS_WRITE_FILE_OPS(inject_packet, 512); 1807MVM_DEBUGFS_WRITE_FILE_OPS(inject_packet, 512);
1764 1808
1809MVM_DEBUGFS_READ_FILE_OPS(uapsd_noagg_bssids);
1810
1765#ifdef CONFIG_IWLWIFI_BCAST_FILTERING 1811#ifdef CONFIG_IWLWIFI_BCAST_FILTERING
1766MVM_DEBUGFS_READ_WRITE_FILE_OPS(bcast_filters, 256); 1812MVM_DEBUGFS_READ_WRITE_FILE_OPS(bcast_filters, 256);
1767MVM_DEBUGFS_READ_WRITE_FILE_OPS(bcast_filters_macs, 256); 1813MVM_DEBUGFS_READ_WRITE_FILE_OPS(bcast_filters_macs, 256);
@@ -1774,6 +1820,8 @@ MVM_DEBUGFS_READ_WRITE_FILE_OPS(d3_sram, 8);
1774MVM_DEBUGFS_READ_FILE_OPS(sar_geo_profile); 1820MVM_DEBUGFS_READ_FILE_OPS(sar_geo_profile);
1775#endif 1821#endif
1776 1822
1823MVM_DEBUGFS_WRITE_FILE_OPS(he_sniffer_params, 32);
1824
1777static ssize_t iwl_dbgfs_mem_read(struct file *file, char __user *user_buf, 1825static ssize_t iwl_dbgfs_mem_read(struct file *file, char __user *user_buf,
1778 size_t count, loff_t *ppos) 1826 size_t count, loff_t *ppos)
1779{ 1827{
@@ -1962,6 +2010,7 @@ int iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, struct dentry *dbgfs_dir)
1962#ifdef CONFIG_ACPI 2010#ifdef CONFIG_ACPI
1963 MVM_DEBUGFS_ADD_FILE(sar_geo_profile, dbgfs_dir, 0400); 2011 MVM_DEBUGFS_ADD_FILE(sar_geo_profile, dbgfs_dir, 0400);
1964#endif 2012#endif
2013 MVM_DEBUGFS_ADD_FILE(he_sniffer_params, mvm->debugfs_dir, 0200);
1965 2014
1966 if (!debugfs_create_bool("enable_scan_iteration_notif", 2015 if (!debugfs_create_bool("enable_scan_iteration_notif",
1967 0600, 2016 0600,
@@ -1972,6 +2021,8 @@ int iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, struct dentry *dbgfs_dir)
1972 mvm->debugfs_dir, &mvm->drop_bcn_ap_mode)) 2021 mvm->debugfs_dir, &mvm->drop_bcn_ap_mode))
1973 goto err; 2022 goto err;
1974 2023
2024 MVM_DEBUGFS_ADD_FILE(uapsd_noagg_bssids, mvm->debugfs_dir, S_IRUSR);
2025
1975#ifdef CONFIG_IWLWIFI_BCAST_FILTERING 2026#ifdef CONFIG_IWLWIFI_BCAST_FILTERING
1976 if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_BCAST_FILTERING) { 2027 if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_BCAST_FILTERING) {
1977 bcast_dir = debugfs_create_dir("bcast_filtering", 2028 bcast_dir = debugfs_create_dir("bcast_filtering",