diff options
author | Wey-Yi Guy <wey-yi.w.guy@intel.com> | 2009-11-20 15:04:56 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-11-23 17:05:32 -0500 |
commit | 7163b8a4ec995dabda3e92c6fed7b8600060618c (patch) | |
tree | 5ceab5ac9ddda4b73f54e74c7a5c99228b9ef561 /drivers/net | |
parent | c15d20c1d19616f73b6fee4befd254d0c37b4d87 (diff) |
iwlwifi: reset led_tpt when clear tx/rx traffic byte counts
LED blink rate is based on the traffic load, when tx/rx traffic counts
got reset, we also need to reset the led_tpt to prevent incorrect
blink rate being calculated.
Merge both clear_tx_statistics() and clear_rx_statistics() into
single clear_traffic_statistics() function, when reset the traffic byte
counts, both tx and rx need to be reset at the same time, to make
sure calculated the correct led blink rate.
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-core.c | 8 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-core.h | 3 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-debug.h | 3 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-debugfs.c | 42 |
4 files changed, 18 insertions, 38 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index dbe41cf8943c..c2263180614e 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c | |||
@@ -3079,15 +3079,11 @@ const char *get_ctrl_string(int cmd) | |||
3079 | } | 3079 | } |
3080 | } | 3080 | } |
3081 | 3081 | ||
3082 | void iwl_clear_tx_stats(struct iwl_priv *priv) | 3082 | void iwl_clear_traffic_stats(struct iwl_priv *priv) |
3083 | { | 3083 | { |
3084 | memset(&priv->tx_stats, 0, sizeof(struct traffic_stats)); | 3084 | memset(&priv->tx_stats, 0, sizeof(struct traffic_stats)); |
3085 | |||
3086 | } | ||
3087 | |||
3088 | void iwl_clear_rx_stats(struct iwl_priv *priv) | ||
3089 | { | ||
3090 | memset(&priv->rx_stats, 0, sizeof(struct traffic_stats)); | 3085 | memset(&priv->rx_stats, 0, sizeof(struct traffic_stats)); |
3086 | priv->led_tpt = 0; | ||
3091 | } | 3087 | } |
3092 | 3088 | ||
3093 | /* | 3089 | /* |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h index 334da64d968d..0779158fed2f 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-core.h | |||
@@ -353,8 +353,7 @@ void iwl_dbg_log_rx_data_frame(struct iwl_priv *priv, | |||
353 | u16 length, struct ieee80211_hdr *header); | 353 | u16 length, struct ieee80211_hdr *header); |
354 | const char *get_mgmt_string(int cmd); | 354 | const char *get_mgmt_string(int cmd); |
355 | const char *get_ctrl_string(int cmd); | 355 | const char *get_ctrl_string(int cmd); |
356 | void iwl_clear_tx_stats(struct iwl_priv *priv); | 356 | void iwl_clear_traffic_stats(struct iwl_priv *priv); |
357 | void iwl_clear_rx_stats(struct iwl_priv *priv); | ||
358 | void iwl_update_stats(struct iwl_priv *priv, bool is_tx, __le16 fc, | 357 | void iwl_update_stats(struct iwl_priv *priv, bool is_tx, __le16 fc, |
359 | u16 len); | 358 | u16 len); |
360 | #else | 359 | #else |
diff --git a/drivers/net/wireless/iwlwifi/iwl-debug.h b/drivers/net/wireless/iwlwifi/iwl-debug.h index 25a0e73314f7..d61293ab67c9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debug.h +++ b/drivers/net/wireless/iwlwifi/iwl-debug.h | |||
@@ -107,7 +107,8 @@ struct iwl_debugfs { | |||
107 | struct dentry *file_chain_noise; | 107 | struct dentry *file_chain_noise; |
108 | struct dentry *file_tx_power; | 108 | struct dentry *file_tx_power; |
109 | struct dentry *file_power_save_status; | 109 | struct dentry *file_power_save_status; |
110 | struct dentry *file_clear_statistics; | 110 | struct dentry *file_clear_ucode_statistics; |
111 | struct dentry *file_clear_traffic_statistics; | ||
111 | } dbgfs_debug_files; | 112 | } dbgfs_debug_files; |
112 | u32 sram_offset; | 113 | u32 sram_offset; |
113 | u32 sram_len; | 114 | u32 sram_len; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c index 9a5ca25d72c3..b8f9edc3d998 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c +++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c | |||
@@ -160,7 +160,7 @@ static ssize_t iwl_dbgfs_tx_statistics_read(struct file *file, | |||
160 | return ret; | 160 | return ret; |
161 | } | 161 | } |
162 | 162 | ||
163 | static ssize_t iwl_dbgfs_tx_statistics_write(struct file *file, | 163 | static ssize_t iwl_dbgfs_clear_traffic_statistics_write(struct file *file, |
164 | const char __user *user_buf, | 164 | const char __user *user_buf, |
165 | size_t count, loff_t *ppos) | 165 | size_t count, loff_t *ppos) |
166 | { | 166 | { |
@@ -175,8 +175,7 @@ static ssize_t iwl_dbgfs_tx_statistics_write(struct file *file, | |||
175 | return -EFAULT; | 175 | return -EFAULT; |
176 | if (sscanf(buf, "%x", &clear_flag) != 1) | 176 | if (sscanf(buf, "%x", &clear_flag) != 1) |
177 | return -EFAULT; | 177 | return -EFAULT; |
178 | if (clear_flag == 1) | 178 | iwl_clear_traffic_stats(priv); |
179 | iwl_clear_tx_stats(priv); | ||
180 | 179 | ||
181 | return count; | 180 | return count; |
182 | } | 181 | } |
@@ -221,26 +220,6 @@ static ssize_t iwl_dbgfs_rx_statistics_read(struct file *file, | |||
221 | return ret; | 220 | return ret; |
222 | } | 221 | } |
223 | 222 | ||
224 | static ssize_t iwl_dbgfs_rx_statistics_write(struct file *file, | ||
225 | const char __user *user_buf, | ||
226 | size_t count, loff_t *ppos) | ||
227 | { | ||
228 | struct iwl_priv *priv = file->private_data; | ||
229 | u32 clear_flag; | ||
230 | char buf[8]; | ||
231 | int buf_size; | ||
232 | |||
233 | memset(buf, 0, sizeof(buf)); | ||
234 | buf_size = min(count, sizeof(buf) - 1); | ||
235 | if (copy_from_user(buf, user_buf, buf_size)) | ||
236 | return -EFAULT; | ||
237 | if (sscanf(buf, "%x", &clear_flag) != 1) | ||
238 | return -EFAULT; | ||
239 | if (clear_flag == 1) | ||
240 | iwl_clear_rx_stats(priv); | ||
241 | return count; | ||
242 | } | ||
243 | |||
244 | #define BYTE1_MASK 0x000000ff; | 223 | #define BYTE1_MASK 0x000000ff; |
245 | #define BYTE2_MASK 0x0000ffff; | 224 | #define BYTE2_MASK 0x0000ffff; |
246 | #define BYTE3_MASK 0x00ffffff; | 225 | #define BYTE3_MASK 0x00ffffff; |
@@ -1823,7 +1802,7 @@ static ssize_t iwl_dbgfs_power_save_status_read(struct file *file, | |||
1823 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); | 1802 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
1824 | } | 1803 | } |
1825 | 1804 | ||
1826 | static ssize_t iwl_dbgfs_clear_statistics_write(struct file *file, | 1805 | static ssize_t iwl_dbgfs_clear_ucode_statistics_write(struct file *file, |
1827 | const char __user *user_buf, | 1806 | const char __user *user_buf, |
1828 | size_t count, loff_t *ppos) | 1807 | size_t count, loff_t *ppos) |
1829 | { | 1808 | { |
@@ -1847,8 +1826,8 @@ static ssize_t iwl_dbgfs_clear_statistics_write(struct file *file, | |||
1847 | return count; | 1826 | return count; |
1848 | } | 1827 | } |
1849 | 1828 | ||
1850 | DEBUGFS_READ_WRITE_FILE_OPS(rx_statistics); | 1829 | DEBUGFS_READ_FILE_OPS(rx_statistics); |
1851 | DEBUGFS_READ_WRITE_FILE_OPS(tx_statistics); | 1830 | DEBUGFS_READ_FILE_OPS(tx_statistics); |
1852 | DEBUGFS_READ_WRITE_FILE_OPS(traffic_log); | 1831 | DEBUGFS_READ_WRITE_FILE_OPS(traffic_log); |
1853 | DEBUGFS_READ_FILE_OPS(rx_queue); | 1832 | DEBUGFS_READ_FILE_OPS(rx_queue); |
1854 | DEBUGFS_READ_FILE_OPS(tx_queue); | 1833 | DEBUGFS_READ_FILE_OPS(tx_queue); |
@@ -1859,7 +1838,8 @@ DEBUGFS_READ_FILE_OPS(sensitivity); | |||
1859 | DEBUGFS_READ_FILE_OPS(chain_noise); | 1838 | DEBUGFS_READ_FILE_OPS(chain_noise); |
1860 | DEBUGFS_READ_FILE_OPS(tx_power); | 1839 | DEBUGFS_READ_FILE_OPS(tx_power); |
1861 | DEBUGFS_READ_FILE_OPS(power_save_status); | 1840 | DEBUGFS_READ_FILE_OPS(power_save_status); |
1862 | DEBUGFS_WRITE_FILE_OPS(clear_statistics); | 1841 | DEBUGFS_WRITE_FILE_OPS(clear_ucode_statistics); |
1842 | DEBUGFS_WRITE_FILE_OPS(clear_traffic_statistics); | ||
1863 | 1843 | ||
1864 | /* | 1844 | /* |
1865 | * Create the debugfs files and directories | 1845 | * Create the debugfs files and directories |
@@ -1908,7 +1888,8 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) | |||
1908 | DEBUGFS_ADD_FILE(tx_queue, debug); | 1888 | DEBUGFS_ADD_FILE(tx_queue, debug); |
1909 | DEBUGFS_ADD_FILE(tx_power, debug); | 1889 | DEBUGFS_ADD_FILE(tx_power, debug); |
1910 | DEBUGFS_ADD_FILE(power_save_status, debug); | 1890 | DEBUGFS_ADD_FILE(power_save_status, debug); |
1911 | DEBUGFS_ADD_FILE(clear_statistics, debug); | 1891 | DEBUGFS_ADD_FILE(clear_ucode_statistics, debug); |
1892 | DEBUGFS_ADD_FILE(clear_traffic_statistics, debug); | ||
1912 | if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) != CSR_HW_REV_TYPE_3945) { | 1893 | if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) != CSR_HW_REV_TYPE_3945) { |
1913 | DEBUGFS_ADD_FILE(ucode_rx_stats, debug); | 1894 | DEBUGFS_ADD_FILE(ucode_rx_stats, debug); |
1914 | DEBUGFS_ADD_FILE(ucode_tx_stats, debug); | 1895 | DEBUGFS_ADD_FILE(ucode_tx_stats, debug); |
@@ -1962,7 +1943,10 @@ void iwl_dbgfs_unregister(struct iwl_priv *priv) | |||
1962 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_tx_queue); | 1943 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_tx_queue); |
1963 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_tx_power); | 1944 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_tx_power); |
1964 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_power_save_status); | 1945 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_power_save_status); |
1965 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files.file_clear_statistics); | 1946 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files. |
1947 | file_clear_ucode_statistics); | ||
1948 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files. | ||
1949 | file_clear_traffic_statistics); | ||
1966 | if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) != CSR_HW_REV_TYPE_3945) { | 1950 | if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) != CSR_HW_REV_TYPE_3945) { |
1967 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files. | 1951 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_debug_files. |
1968 | file_ucode_rx_stats); | 1952 | file_ucode_rx_stats); |