aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorBruno Randolf <br1@einfach.org>2011-01-28 02:52:11 -0500
committerJohn W. Linville <linville@tuxdriver.com>2011-01-28 15:46:23 -0500
commit76a9f6fd9adc5ce62b4ea36a099bb1458d4cb7a6 (patch)
tree49cb62eea2aae4415e967900ab514d9956f5c593 /drivers/net/wireless
parent4914b3bb7fa6badc25e77e22c47fde22b924b53f (diff)
ath5k: Fix short and long retry configuration
The register definition for retry configuration on AR5212 was wrong, and simply copied over from AR5210. Update the register definitions from the documentation. Let the short and long retries be configured from mac80211 and use the standard values of 7 and 4 by default. Also we need to make sure we don't export more retries than we are configured for to mac80211 (and the rate module) in hw->max_rate_tries. Also clean up the code by removing unused defines and variables and drop the different values for "station retries" - if these need to be different it can be handled tru ah_retry_long/short. Signed-off-by: Bruno Randolf <br1@einfach.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/ath/ath5k/ath5k.h18
-rw-r--r--drivers/net/wireless/ath/ath5k/attach.c4
-rw-r--r--drivers/net/wireless/ath/ath5k/base.c3
-rw-r--r--drivers/net/wireless/ath/ath5k/mac80211-ops.c9
-rw-r--r--drivers/net/wireless/ath/ath5k/qcu.c46
-rw-r--r--drivers/net/wireless/ath/ath5k/reg.h15
6 files changed, 44 insertions, 51 deletions
diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h
index 407e39c2b10..e43175a89d6 100644
--- a/drivers/net/wireless/ath/ath5k/ath5k.h
+++ b/drivers/net/wireless/ath/ath5k/ath5k.h
@@ -210,14 +210,9 @@
210/* Initial values */ 210/* Initial values */
211#define AR5K_INIT_CYCRSSI_THR1 2 211#define AR5K_INIT_CYCRSSI_THR1 2
212 212
213/* Tx retry limits */ 213/* Tx retry limit defaults from standard */
214#define AR5K_INIT_SH_RETRY 10 214#define AR5K_INIT_RETRY_SHORT 7
215#define AR5K_INIT_LG_RETRY AR5K_INIT_SH_RETRY 215#define AR5K_INIT_RETRY_LONG 4
216/* For station mode */
217#define AR5K_INIT_SSH_RETRY 32
218#define AR5K_INIT_SLG_RETRY AR5K_INIT_SSH_RETRY
219#define AR5K_INIT_TX_RETRY 10
220
221 216
222/* Slot time */ 217/* Slot time */
223#define AR5K_INIT_SLOT_TIME_TURBO 6 218#define AR5K_INIT_SLOT_TIME_TURBO 6
@@ -1057,7 +1052,9 @@ struct ath5k_hw {
1057#define ah_modes ah_capabilities.cap_mode 1052#define ah_modes ah_capabilities.cap_mode
1058#define ah_ee_version ah_capabilities.cap_eeprom.ee_version 1053#define ah_ee_version ah_capabilities.cap_eeprom.ee_version
1059 1054
1060 u32 ah_limit_tx_retries; 1055 u8 ah_retry_long;
1056 u8 ah_retry_short;
1057
1061 u8 ah_coverage_class; 1058 u8 ah_coverage_class;
1062 bool ah_ack_bitrate_high; 1059 bool ah_ack_bitrate_high;
1063 u8 ah_bwmode; 1060 u8 ah_bwmode;
@@ -1067,7 +1064,6 @@ struct ath5k_hw {
1067 u8 ah_ant_mode; 1064 u8 ah_ant_mode;
1068 u8 ah_tx_ant; 1065 u8 ah_tx_ant;
1069 u8 ah_def_ant; 1066 u8 ah_def_ant;
1070 bool ah_software_retry;
1071 1067
1072 struct ath5k_capabilities ah_capabilities; 1068 struct ath5k_capabilities ah_capabilities;
1073 1069
@@ -1250,6 +1246,8 @@ int ath5k_hw_set_tx_queueprops(struct ath5k_hw *ah, int queue,
1250int ath5k_hw_setup_tx_queue(struct ath5k_hw *ah, 1246int ath5k_hw_setup_tx_queue(struct ath5k_hw *ah,
1251 enum ath5k_tx_queue queue_type, 1247 enum ath5k_tx_queue queue_type,
1252 struct ath5k_txq_info *queue_info); 1248 struct ath5k_txq_info *queue_info);
1249void ath5k_hw_set_tx_retry_limits(struct ath5k_hw *ah,
1250 unsigned int queue);
1253u32 ath5k_hw_num_tx_pending(struct ath5k_hw *ah, unsigned int queue); 1251u32 ath5k_hw_num_tx_pending(struct ath5k_hw *ah, unsigned int queue);
1254void ath5k_hw_release_tx_queue(struct ath5k_hw *ah, unsigned int queue); 1252void ath5k_hw_release_tx_queue(struct ath5k_hw *ah, unsigned int queue);
1255int ath5k_hw_reset_tx_queue(struct ath5k_hw *ah, unsigned int queue); 1253int ath5k_hw_reset_tx_queue(struct ath5k_hw *ah, unsigned int queue);
diff --git a/drivers/net/wireless/ath/ath5k/attach.c b/drivers/net/wireless/ath/ath5k/attach.c
index cdac5cff017..c71fdbb4c43 100644
--- a/drivers/net/wireless/ath/ath5k/attach.c
+++ b/drivers/net/wireless/ath/ath5k/attach.c
@@ -118,8 +118,8 @@ int ath5k_hw_init(struct ath5k_softc *sc)
118 ah->ah_bwmode = AR5K_BWMODE_DEFAULT; 118 ah->ah_bwmode = AR5K_BWMODE_DEFAULT;
119 ah->ah_txpower.txp_tpc = AR5K_TUNE_TPC_TXPOWER; 119 ah->ah_txpower.txp_tpc = AR5K_TUNE_TPC_TXPOWER;
120 ah->ah_imr = 0; 120 ah->ah_imr = 0;
121 ah->ah_limit_tx_retries = AR5K_INIT_TX_RETRY; 121 ah->ah_retry_short = AR5K_INIT_RETRY_SHORT;
122 ah->ah_software_retry = false; 122 ah->ah_retry_long = AR5K_INIT_RETRY_LONG;
123 ah->ah_ant_mode = AR5K_ANTMODE_DEFAULT; 123 ah->ah_ant_mode = AR5K_ANTMODE_DEFAULT;
124 ah->ah_noise_floor = -95; /* until first NF calibration is run */ 124 ah->ah_noise_floor = -95; /* until first NF calibration is run */
125 sc->ani_state.ani_mode = ATH5K_ANI_MODE_AUTO; 125 sc->ani_state.ani_mode = ATH5K_ANI_MODE_AUTO;
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index c0927d7b7c6..e9e7af6e4b6 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -2399,7 +2399,8 @@ ath5k_init_softc(struct ath5k_softc *sc, const struct ath_bus_ops *bus_ops)
2399 /* set up multi-rate retry capabilities */ 2399 /* set up multi-rate retry capabilities */
2400 if (sc->ah->ah_version == AR5K_AR5212) { 2400 if (sc->ah->ah_version == AR5K_AR5212) {
2401 hw->max_rates = 4; 2401 hw->max_rates = 4;
2402 hw->max_rate_tries = 11; 2402 hw->max_rate_tries = max(AR5K_INIT_RETRY_SHORT,
2403 AR5K_INIT_RETRY_LONG);
2403 } 2404 }
2404 2405
2405 hw->vif_data_size = sizeof(struct ath5k_vif); 2406 hw->vif_data_size = sizeof(struct ath5k_vif);
diff --git a/drivers/net/wireless/ath/ath5k/mac80211-ops.c b/drivers/net/wireless/ath/ath5k/mac80211-ops.c
index d76d68c99f7..36a51995a7b 100644
--- a/drivers/net/wireless/ath/ath5k/mac80211-ops.c
+++ b/drivers/net/wireless/ath/ath5k/mac80211-ops.c
@@ -226,6 +226,7 @@ ath5k_config(struct ieee80211_hw *hw, u32 changed)
226 struct ath5k_hw *ah = sc->ah; 226 struct ath5k_hw *ah = sc->ah;
227 struct ieee80211_conf *conf = &hw->conf; 227 struct ieee80211_conf *conf = &hw->conf;
228 int ret = 0; 228 int ret = 0;
229 int i;
229 230
230 mutex_lock(&sc->lock); 231 mutex_lock(&sc->lock);
231 232
@@ -243,6 +244,14 @@ ath5k_config(struct ieee80211_hw *hw, u32 changed)
243 ath5k_hw_set_txpower_limit(ah, (conf->power_level * 2)); 244 ath5k_hw_set_txpower_limit(ah, (conf->power_level * 2));
244 } 245 }
245 246
247 if (changed & IEEE80211_CONF_CHANGE_RETRY_LIMITS) {
248 ah->ah_retry_long = conf->long_frame_max_tx_count;
249 ah->ah_retry_short = conf->short_frame_max_tx_count;
250
251 for (i = 0; i < ah->ah_capabilities.cap_queues.q_tx_num; i++)
252 ath5k_hw_set_tx_retry_limits(ah, i);
253 }
254
246 /* TODO: 255 /* TODO:
247 * 1) Move this on config_interface and handle each case 256 * 1) Move this on config_interface and handle each case
248 * separately eg. when we have only one STA vif, use 257 * separately eg. when we have only one STA vif, use
diff --git a/drivers/net/wireless/ath/ath5k/qcu.c b/drivers/net/wireless/ath/ath5k/qcu.c
index 2c9c9e793d4..3343fb9e494 100644
--- a/drivers/net/wireless/ath/ath5k/qcu.c
+++ b/drivers/net/wireless/ath/ath5k/qcu.c
@@ -228,24 +228,9 @@ int ath5k_hw_setup_tx_queue(struct ath5k_hw *ah, enum ath5k_tx_queue queue_type,
228/* 228/*
229 * Set tx retry limits on DCU 229 * Set tx retry limits on DCU
230 */ 230 */
231static void ath5k_hw_set_tx_retry_limits(struct ath5k_hw *ah, 231void ath5k_hw_set_tx_retry_limits(struct ath5k_hw *ah,
232 unsigned int queue) 232 unsigned int queue)
233{ 233{
234 u32 retry_lg, retry_sh;
235
236 /*
237 * Calculate and set retry limits
238 */
239 if (ah->ah_software_retry) {
240 /* XXX Need to test this */
241 retry_lg = ah->ah_limit_tx_retries;
242 retry_sh = retry_lg = retry_lg > AR5K_DCU_RETRY_LMT_SH_RETRY ?
243 AR5K_DCU_RETRY_LMT_SH_RETRY : retry_lg;
244 } else {
245 retry_lg = AR5K_INIT_LG_RETRY;
246 retry_sh = AR5K_INIT_SH_RETRY;
247 }
248
249 /* Single data queue on AR5210 */ 234 /* Single data queue on AR5210 */
250 if (ah->ah_version == AR5K_AR5210) { 235 if (ah->ah_version == AR5K_AR5210) {
251 struct ath5k_txq_info *tq = &ah->ah_txq[queue]; 236 struct ath5k_txq_info *tq = &ah->ah_txq[queue];
@@ -255,25 +240,26 @@ static void ath5k_hw_set_tx_retry_limits(struct ath5k_hw *ah,
255 240
256 ath5k_hw_reg_write(ah, 241 ath5k_hw_reg_write(ah,
257 (tq->tqi_cw_min << AR5K_NODCU_RETRY_LMT_CW_MIN_S) 242 (tq->tqi_cw_min << AR5K_NODCU_RETRY_LMT_CW_MIN_S)
258 | AR5K_REG_SM(AR5K_INIT_SLG_RETRY, 243 | AR5K_REG_SM(ah->ah_retry_long,
259 AR5K_NODCU_RETRY_LMT_SLG_RETRY) 244 AR5K_NODCU_RETRY_LMT_SLG_RETRY)
260 | AR5K_REG_SM(AR5K_INIT_SSH_RETRY, 245 | AR5K_REG_SM(ah->ah_retry_short,
261 AR5K_NODCU_RETRY_LMT_SSH_RETRY) 246 AR5K_NODCU_RETRY_LMT_SSH_RETRY)
262 | AR5K_REG_SM(retry_lg, AR5K_NODCU_RETRY_LMT_LG_RETRY) 247 | AR5K_REG_SM(ah->ah_retry_long,
263 | AR5K_REG_SM(retry_sh, AR5K_NODCU_RETRY_LMT_SH_RETRY), 248 AR5K_NODCU_RETRY_LMT_LG_RETRY)
249 | AR5K_REG_SM(ah->ah_retry_short,
250 AR5K_NODCU_RETRY_LMT_SH_RETRY),
264 AR5K_NODCU_RETRY_LMT); 251 AR5K_NODCU_RETRY_LMT);
265 /* DCU on AR5211+ */ 252 /* DCU on AR5211+ */
266 } else { 253 } else {
267 ath5k_hw_reg_write(ah, 254 ath5k_hw_reg_write(ah,
268 AR5K_REG_SM(AR5K_INIT_SLG_RETRY, 255 AR5K_REG_SM(ah->ah_retry_long,
269 AR5K_DCU_RETRY_LMT_SLG_RETRY) | 256 AR5K_DCU_RETRY_LMT_RTS)
270 AR5K_REG_SM(AR5K_INIT_SSH_RETRY, 257 | AR5K_REG_SM(ah->ah_retry_long,
271 AR5K_DCU_RETRY_LMT_SSH_RETRY) | 258 AR5K_DCU_RETRY_LMT_STA_RTS)
272 AR5K_REG_SM(retry_lg, AR5K_DCU_RETRY_LMT_LG_RETRY) | 259 | AR5K_REG_SM(max(ah->ah_retry_long, ah->ah_retry_short),
273 AR5K_REG_SM(retry_sh, AR5K_DCU_RETRY_LMT_SH_RETRY), 260 AR5K_DCU_RETRY_LMT_STA_DATA),
274 AR5K_QUEUE_DFS_RETRY_LIMIT(queue)); 261 AR5K_QUEUE_DFS_RETRY_LIMIT(queue));
275 } 262 }
276 return;
277} 263}
278 264
279/** 265/**
diff --git a/drivers/net/wireless/ath/ath5k/reg.h b/drivers/net/wireless/ath/ath5k/reg.h
index fd14b910395..e1c9abd8c87 100644
--- a/drivers/net/wireless/ath/ath5k/reg.h
+++ b/drivers/net/wireless/ath/ath5k/reg.h
@@ -686,16 +686,15 @@
686 686
687/* 687/*
688 * DCU retry limit registers 688 * DCU retry limit registers
689 * all these fields don't allow zero values
689 */ 690 */
690#define AR5K_DCU_RETRY_LMT_BASE 0x1080 /* Register Address -Queue0 DCU_RETRY_LMT */ 691#define AR5K_DCU_RETRY_LMT_BASE 0x1080 /* Register Address -Queue0 DCU_RETRY_LMT */
691#define AR5K_DCU_RETRY_LMT_SH_RETRY 0x0000000f /* Short retry limit mask */ 692#define AR5K_DCU_RETRY_LMT_RTS 0x0000000f /* RTS failure limit. Transmission fails if no CTS is received for this number of times */
692#define AR5K_DCU_RETRY_LMT_SH_RETRY_S 0 693#define AR5K_DCU_RETRY_LMT_RTS_S 0
693#define AR5K_DCU_RETRY_LMT_LG_RETRY 0x000000f0 /* Long retry limit mask */ 694#define AR5K_DCU_RETRY_LMT_STA_RTS 0x00003f00 /* STA RTS failure limit. If exceeded CW reset */
694#define AR5K_DCU_RETRY_LMT_LG_RETRY_S 4 695#define AR5K_DCU_RETRY_LMT_STA_RTS_S 8
695#define AR5K_DCU_RETRY_LMT_SSH_RETRY 0x00003f00 /* Station short retry limit mask (?) */ 696#define AR5K_DCU_RETRY_LMT_STA_DATA 0x000fc000 /* STA data failure limit. If exceeded CW reset. */
696#define AR5K_DCU_RETRY_LMT_SSH_RETRY_S 8 697#define AR5K_DCU_RETRY_LMT_STA_DATA_S 14
697#define AR5K_DCU_RETRY_LMT_SLG_RETRY 0x000fc000 /* Station long retry limit mask (?) */
698#define AR5K_DCU_RETRY_LMT_SLG_RETRY_S 14
699#define AR5K_QUEUE_DFS_RETRY_LIMIT(_q) AR5K_QUEUE_REG(AR5K_DCU_RETRY_LMT_BASE, _q) 698#define AR5K_QUEUE_DFS_RETRY_LIMIT(_q) AR5K_QUEUE_REG(AR5K_DCU_RETRY_LMT_BASE, _q)
700 699
701/* 700/*