diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-debugfs.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-debugfs.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c index af00ad2afa14..02f80bc21307 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c +++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c | |||
@@ -2131,6 +2131,49 @@ static ssize_t iwl_dbgfs_fh_reg_read(struct file *file, | |||
2131 | return ret; | 2131 | return ret; |
2132 | } | 2132 | } |
2133 | 2133 | ||
2134 | static ssize_t iwl_dbgfs_missed_beacon_read(struct file *file, | ||
2135 | char __user *user_buf, | ||
2136 | size_t count, loff_t *ppos) { | ||
2137 | |||
2138 | struct iwl_priv *priv = file->private_data; | ||
2139 | int pos = 0; | ||
2140 | char buf[12]; | ||
2141 | const size_t bufsz = sizeof(buf); | ||
2142 | ssize_t ret; | ||
2143 | |||
2144 | pos += scnprintf(buf + pos, bufsz - pos, "%d\n", | ||
2145 | priv->missed_beacon_threshold); | ||
2146 | |||
2147 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); | ||
2148 | return ret; | ||
2149 | } | ||
2150 | |||
2151 | static ssize_t iwl_dbgfs_missed_beacon_write(struct file *file, | ||
2152 | const char __user *user_buf, | ||
2153 | size_t count, loff_t *ppos) | ||
2154 | { | ||
2155 | struct iwl_priv *priv = file->private_data; | ||
2156 | char buf[8]; | ||
2157 | int buf_size; | ||
2158 | int missed; | ||
2159 | |||
2160 | memset(buf, 0, sizeof(buf)); | ||
2161 | buf_size = min(count, sizeof(buf) - 1); | ||
2162 | if (copy_from_user(buf, user_buf, buf_size)) | ||
2163 | return -EFAULT; | ||
2164 | if (sscanf(buf, "%d", &missed) != 1) | ||
2165 | return -EINVAL; | ||
2166 | |||
2167 | if (missed < IWL_MISSED_BEACON_THRESHOLD_MIN || | ||
2168 | missed > IWL_MISSED_BEACON_THRESHOLD_MAX) | ||
2169 | priv->missed_beacon_threshold = | ||
2170 | IWL_MISSED_BEACON_THRESHOLD_DEF; | ||
2171 | else | ||
2172 | priv->missed_beacon_threshold = missed; | ||
2173 | |||
2174 | return count; | ||
2175 | } | ||
2176 | |||
2134 | DEBUGFS_READ_FILE_OPS(rx_statistics); | 2177 | DEBUGFS_READ_FILE_OPS(rx_statistics); |
2135 | DEBUGFS_READ_FILE_OPS(tx_statistics); | 2178 | DEBUGFS_READ_FILE_OPS(tx_statistics); |
2136 | DEBUGFS_READ_WRITE_FILE_OPS(traffic_log); | 2179 | DEBUGFS_READ_WRITE_FILE_OPS(traffic_log); |
@@ -2148,6 +2191,7 @@ DEBUGFS_WRITE_FILE_OPS(clear_traffic_statistics); | |||
2148 | DEBUGFS_WRITE_FILE_OPS(csr); | 2191 | DEBUGFS_WRITE_FILE_OPS(csr); |
2149 | DEBUGFS_READ_WRITE_FILE_OPS(ucode_tracing); | 2192 | DEBUGFS_READ_WRITE_FILE_OPS(ucode_tracing); |
2150 | DEBUGFS_READ_FILE_OPS(fh_reg); | 2193 | DEBUGFS_READ_FILE_OPS(fh_reg); |
2194 | DEBUGFS_READ_WRITE_FILE_OPS(missed_beacon); | ||
2151 | 2195 | ||
2152 | /* | 2196 | /* |
2153 | * Create the debugfs files and directories | 2197 | * Create the debugfs files and directories |
@@ -2200,6 +2244,7 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) | |||
2200 | DEBUGFS_ADD_FILE(clear_traffic_statistics, debug, S_IWUSR); | 2244 | DEBUGFS_ADD_FILE(clear_traffic_statistics, debug, S_IWUSR); |
2201 | DEBUGFS_ADD_FILE(csr, debug, S_IWUSR); | 2245 | DEBUGFS_ADD_FILE(csr, debug, S_IWUSR); |
2202 | DEBUGFS_ADD_FILE(fh_reg, debug, S_IRUSR); | 2246 | DEBUGFS_ADD_FILE(fh_reg, debug, S_IRUSR); |
2247 | DEBUGFS_ADD_FILE(missed_beacon, debug, S_IWUSR); | ||
2203 | if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) != CSR_HW_REV_TYPE_3945) { | 2248 | if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) != CSR_HW_REV_TYPE_3945) { |
2204 | DEBUGFS_ADD_FILE(ucode_rx_stats, debug, S_IRUSR); | 2249 | DEBUGFS_ADD_FILE(ucode_rx_stats, debug, S_IRUSR); |
2205 | DEBUGFS_ADD_FILE(ucode_tx_stats, debug, S_IRUSR); | 2250 | DEBUGFS_ADD_FILE(ucode_tx_stats, debug, S_IRUSR); |
@@ -2260,6 +2305,7 @@ void iwl_dbgfs_unregister(struct iwl_priv *priv) | |||
2260 | file_clear_traffic_statistics); | 2305 | file_clear_traffic_statistics); |
2261 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_csr); | 2306 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_csr); |
2262 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_fh_reg); | 2307 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_fh_reg); |
2308 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_missed_beacon); | ||
2263 | if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) != CSR_HW_REV_TYPE_3945) { | 2309 | if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) != CSR_HW_REV_TYPE_3945) { |
2264 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files. | 2310 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files. |
2265 | file_ucode_rx_stats); | 2311 | file_ucode_rx_stats); |