aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorWey-Yi Guy <wey-yi.w.guy@intel.com>2010-01-22 17:22:42 -0500
committerJohn W. Linville <linville@tuxdriver.com>2010-01-25 16:36:19 -0500
commita13d276f1e49ae0bc4ad18ce8ea3c90656c9e8d4 (patch)
tree791d149b22623844e1f8e21fe198d7bf573fdd33 /drivers
parent3b43a18743421cccd33902e29016fa49b2d52dbb (diff)
iwlwifi: configure missed beacon threshold
Add support to configure missed beacon threshold, by default, if receive "missed beacon" notification from uCode and has more than 5 consecutive beacon missed, then perform sensitivity calibration; with this change, allow user to adjust the missed beacon threshold from debugfs in case more sensitivity calibration required for better performance in noisy environment The default value (=5) should be good enough for the normal condition, but for very noisy environment, more sensitivity calibration could help improve the throughput, so by setting the missed beacon threshold to lower number, user might experience better performance result. 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')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-commands.h25
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debug.h1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debugfs.c46
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-rx.c5
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c1
7 files changed, 74 insertions, 6 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 62b6939df52e..e9f786443d1f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -3372,6 +3372,7 @@ static int iwl_init_drv(struct iwl_priv *priv)
3372 3372
3373 priv->iw_mode = NL80211_IFTYPE_STATION; 3373 priv->iw_mode = NL80211_IFTYPE_STATION;
3374 priv->current_ht_config.smps = IEEE80211_SMPS_STATIC; 3374 priv->current_ht_config.smps = IEEE80211_SMPS_STATIC;
3375 priv->missed_beacon_threshold = IWL_MISSED_BEACON_THRESHOLD_DEF;
3375 3376
3376 /* Choose which receivers/antennas to use */ 3377 /* Choose which receivers/antennas to use */
3377 if (priv->cfg->ops->hcmd->set_rxon_chain) 3378 if (priv->cfg->ops->hcmd->set_rxon_chain)
diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h
index cee5fb2187c8..8823d18b9f43 100644
--- a/drivers/net/wireless/iwlwifi/iwl-commands.h
+++ b/drivers/net/wireless/iwlwifi/iwl-commands.h
@@ -3165,13 +3165,30 @@ struct iwl_notif_statistics {
3165 3165
3166/* 3166/*
3167 * MISSED_BEACONS_NOTIFICATION = 0xa2 (notification only, not a command) 3167 * MISSED_BEACONS_NOTIFICATION = 0xa2 (notification only, not a command)
3168 *
3169 * uCode send MISSED_BEACONS_NOTIFICATION to driver when detect beacon missed
3170 * in regardless of how many missed beacons, which mean when driver receive the
3171 * notification, inside the command, it can find all the beacons information
3172 * which include number of total missed beacons, number of consecutive missed
3173 * beacons, number of beacons received and number of beacons expected to
3174 * receive.
3175 *
3176 * If uCode detected consecutive_missed_beacons > 5, it will reset the radio
3177 * in order to bring the radio/PHY back to working state; which has no relation
3178 * to when driver will perform sensitivity calibration.
3179 *
3180 * Driver should set it own missed_beacon_threshold to decide when to perform
3181 * sensitivity calibration based on number of consecutive missed beacons in
3182 * order to improve overall performance, especially in noisy environment.
3183 *
3168 */ 3184 */
3169/* if ucode missed CONSECUTIVE_MISSED_BCONS_TH beacons in a row, 3185
3170 * then this notification will be sent. */ 3186#define IWL_MISSED_BEACON_THRESHOLD_MIN (1)
3171#define CONSECUTIVE_MISSED_BCONS_TH 20 3187#define IWL_MISSED_BEACON_THRESHOLD_DEF (5)
3188#define IWL_MISSED_BEACON_THRESHOLD_MAX IWL_MISSED_BEACON_THRESHOLD_DEF
3172 3189
3173struct iwl_missed_beacon_notif { 3190struct iwl_missed_beacon_notif {
3174 __le32 consequtive_missed_beacons; 3191 __le32 consecutive_missed_beacons;
3175 __le32 total_missed_becons; 3192 __le32 total_missed_becons;
3176 __le32 num_expected_beacons; 3193 __le32 num_expected_beacons;
3177 __le32 num_recvd_beacons; 3194 __le32 num_recvd_beacons;
diff --git a/drivers/net/wireless/iwlwifi/iwl-debug.h b/drivers/net/wireless/iwlwifi/iwl-debug.h
index 0facaca9b40b..36b558f23325 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debug.h
+++ b/drivers/net/wireless/iwlwifi/iwl-debug.h
@@ -112,6 +112,7 @@ struct iwl_debugfs {
112 struct dentry *file_csr; 112 struct dentry *file_csr;
113 struct dentry *file_ucode_tracing; 113 struct dentry *file_ucode_tracing;
114 struct dentry *file_fh_reg; 114 struct dentry *file_fh_reg;
115 struct dentry *file_missed_beacon;
115 } dbgfs_debug_files; 116 } dbgfs_debug_files;
116 u32 sram_offset; 117 u32 sram_offset;
117 u32 sram_len; 118 u32 sram_len;
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
2134static 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
2151static 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
2134DEBUGFS_READ_FILE_OPS(rx_statistics); 2177DEBUGFS_READ_FILE_OPS(rx_statistics);
2135DEBUGFS_READ_FILE_OPS(tx_statistics); 2178DEBUGFS_READ_FILE_OPS(tx_statistics);
2136DEBUGFS_READ_WRITE_FILE_OPS(traffic_log); 2179DEBUGFS_READ_WRITE_FILE_OPS(traffic_log);
@@ -2148,6 +2191,7 @@ DEBUGFS_WRITE_FILE_OPS(clear_traffic_statistics);
2148DEBUGFS_WRITE_FILE_OPS(csr); 2191DEBUGFS_WRITE_FILE_OPS(csr);
2149DEBUGFS_READ_WRITE_FILE_OPS(ucode_tracing); 2192DEBUGFS_READ_WRITE_FILE_OPS(ucode_tracing);
2150DEBUGFS_READ_FILE_OPS(fh_reg); 2193DEBUGFS_READ_FILE_OPS(fh_reg);
2194DEBUGFS_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);
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index c6310b0b2f12..5e06e666f176 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -1053,6 +1053,7 @@ struct iwl_priv {
1053#endif 1053#endif
1054 /* ucode beacon time */ 1054 /* ucode beacon time */
1055 u32 ucode_beacon_time; 1055 u32 ucode_beacon_time;
1056 int missed_beacon_threshold;
1056 1057
1057 /* we allocate array of iwl4965_channel_info for NIC's valid channels. 1058 /* we allocate array of iwl4965_channel_info for NIC's valid channels.
1058 * Access via channel # using indirect index array */ 1059 * Access via channel # using indirect index array */
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c
index eb45f8be0746..dc06c7bb0f5c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-rx.c
@@ -499,9 +499,10 @@ void iwl_rx_missed_beacon_notif(struct iwl_priv *priv,
499 struct iwl_missed_beacon_notif *missed_beacon; 499 struct iwl_missed_beacon_notif *missed_beacon;
500 500
501 missed_beacon = &pkt->u.missed_beacon; 501 missed_beacon = &pkt->u.missed_beacon;
502 if (le32_to_cpu(missed_beacon->consequtive_missed_beacons) > 5) { 502 if (le32_to_cpu(missed_beacon->consecutive_missed_beacons) >
503 priv->missed_beacon_threshold) {
503 IWL_DEBUG_CALIB(priv, "missed bcn cnsq %d totl %d rcd %d expctd %d\n", 504 IWL_DEBUG_CALIB(priv, "missed bcn cnsq %d totl %d rcd %d expctd %d\n",
504 le32_to_cpu(missed_beacon->consequtive_missed_beacons), 505 le32_to_cpu(missed_beacon->consecutive_missed_beacons),
505 le32_to_cpu(missed_beacon->total_missed_becons), 506 le32_to_cpu(missed_beacon->total_missed_becons),
506 le32_to_cpu(missed_beacon->num_recvd_beacons), 507 le32_to_cpu(missed_beacon->num_recvd_beacons),
507 le32_to_cpu(missed_beacon->num_expected_beacons)); 508 le32_to_cpu(missed_beacon->num_expected_beacons));
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index c46f988d0a5b..9c0b6ebbdc59 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -3881,6 +3881,7 @@ static int iwl3945_init_drv(struct iwl_priv *priv)
3881 priv->band = IEEE80211_BAND_2GHZ; 3881 priv->band = IEEE80211_BAND_2GHZ;
3882 3882
3883 priv->iw_mode = NL80211_IFTYPE_STATION; 3883 priv->iw_mode = NL80211_IFTYPE_STATION;
3884 priv->missed_beacon_threshold = IWL_MISSED_BEACON_THRESHOLD_DEF;
3884 3885
3885 iwl_reset_qos(priv); 3886 iwl_reset_qos(priv);
3886 3887