aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2x00dev.c
diff options
context:
space:
mode:
authorIvo van Doorn <ivdoorn@gmail.com>2007-10-13 10:26:12 -0400
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:02:49 -0500
commitebcf26dae9f10e247ea41ef66f89b336ba456097 (patch)
tree27913a0d00a754d37702ec29a979c3ce5d358524 /drivers/net/wireless/rt2x00/rt2x00dev.c
parent191df5737e3047de8b7d8ea4e17df241cf8eefca (diff)
[PATCH] rt2x00: Move quality statistics into seperate structure
Move all link quality statistics variables into the link_qual structure. This cleans up the link structure and allows us to use it for more then just statistics. Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00dev.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index ff399f8083e9..5d32e098696e 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -179,26 +179,26 @@ void rt2x00lib_toggle_rx(struct rt2x00_dev *rt2x00dev, enum dev_state state)
179 rt2x00lib_start_link_tuner(rt2x00dev); 179 rt2x00lib_start_link_tuner(rt2x00dev);
180} 180}
181 181
182static void rt2x00lib_precalculate_link_signal(struct link *link) 182static void rt2x00lib_precalculate_link_signal(struct link_qual *qual)
183{ 183{
184 if (link->rx_failed || link->rx_success) 184 if (qual->rx_failed || qual->rx_success)
185 link->rx_percentage = 185 qual->rx_percentage =
186 (link->rx_success * 100) / 186 (qual->rx_success * 100) /
187 (link->rx_failed + link->rx_success); 187 (qual->rx_failed + qual->rx_success);
188 else 188 else
189 link->rx_percentage = 50; 189 qual->rx_percentage = 50;
190 190
191 if (link->tx_failed || link->tx_success) 191 if (qual->tx_failed || qual->tx_success)
192 link->tx_percentage = 192 qual->tx_percentage =
193 (link->tx_success * 100) / 193 (qual->tx_success * 100) /
194 (link->tx_failed + link->tx_success); 194 (qual->tx_failed + qual->tx_success);
195 else 195 else
196 link->tx_percentage = 50; 196 qual->tx_percentage = 50;
197 197
198 link->rx_success = 0; 198 qual->rx_success = 0;
199 link->rx_failed = 0; 199 qual->rx_failed = 0;
200 link->tx_success = 0; 200 qual->tx_success = 0;
201 link->tx_failed = 0; 201 qual->tx_failed = 0;
202} 202}
203 203
204static int rt2x00lib_calculate_link_signal(struct rt2x00_dev *rt2x00dev, 204static int rt2x00lib_calculate_link_signal(struct rt2x00_dev *rt2x00dev,
@@ -225,8 +225,8 @@ static int rt2x00lib_calculate_link_signal(struct rt2x00_dev *rt2x00dev,
225 * defines to calculate the current link signal. 225 * defines to calculate the current link signal.
226 */ 226 */
227 signal = ((WEIGHT_RSSI * rssi_percentage) + 227 signal = ((WEIGHT_RSSI * rssi_percentage) +
228 (WEIGHT_TX * rt2x00dev->link.tx_percentage) + 228 (WEIGHT_TX * rt2x00dev->link.qual.tx_percentage) +
229 (WEIGHT_RX * rt2x00dev->link.rx_percentage)) / 100; 229 (WEIGHT_RX * rt2x00dev->link.qual.rx_percentage)) / 100;
230 230
231 return (signal > 100) ? 100 : signal; 231 return (signal > 100) ? 100 : signal;
232} 232}
@@ -246,10 +246,10 @@ static void rt2x00lib_link_tuner(struct work_struct *work)
246 /* 246 /*
247 * Update statistics. 247 * Update statistics.
248 */ 248 */
249 rt2x00dev->ops->lib->link_stats(rt2x00dev); 249 rt2x00dev->ops->lib->link_stats(rt2x00dev, &rt2x00dev->link.qual);
250 250
251 rt2x00dev->low_level_stats.dot11FCSErrorCount += 251 rt2x00dev->low_level_stats.dot11FCSErrorCount +=
252 rt2x00dev->link.rx_failed; 252 rt2x00dev->link.qual.rx_failed;
253 253
254 /* 254 /*
255 * Only perform the link tuning when Link tuning 255 * Only perform the link tuning when Link tuning
@@ -262,7 +262,7 @@ static void rt2x00lib_link_tuner(struct work_struct *work)
262 * Precalculate a portion of the link signal which is 262 * Precalculate a portion of the link signal which is
263 * in based on the tx/rx success/failure counters. 263 * in based on the tx/rx success/failure counters.
264 */ 264 */
265 rt2x00lib_precalculate_link_signal(&rt2x00dev->link); 265 rt2x00lib_precalculate_link_signal(&rt2x00dev->link.qual);
266 266
267 /* 267 /*
268 * Increase tuner counter, and reschedule the next link tuner run. 268 * Increase tuner counter, and reschedule the next link tuner run.
@@ -350,8 +350,8 @@ void rt2x00lib_txdone(struct data_entry *entry,
350 tx_status->ack_signal = 0; 350 tx_status->ack_signal = 0;
351 tx_status->excessive_retries = (status == TX_FAIL_RETRY); 351 tx_status->excessive_retries = (status == TX_FAIL_RETRY);
352 tx_status->retry_count = retry; 352 tx_status->retry_count = retry;
353 rt2x00dev->link.tx_success += success; 353 rt2x00dev->link.qual.tx_success += success;
354 rt2x00dev->link.tx_failed += retry + fail; 354 rt2x00dev->link.qual.tx_failed += retry + fail;
355 355
356 if (!(tx_status->control.flags & IEEE80211_TXCTL_NO_ACK)) { 356 if (!(tx_status->control.flags & IEEE80211_TXCTL_NO_ACK)) {
357 if (success) 357 if (success)
@@ -413,7 +413,7 @@ void rt2x00lib_rxdone(struct data_entry *entry, struct sk_buff *skb,
413 } 413 }
414 414
415 rt2x00_update_link_rssi(&rt2x00dev->link, desc->rssi); 415 rt2x00_update_link_rssi(&rt2x00dev->link, desc->rssi);
416 rt2x00dev->link.rx_success++; 416 rt2x00dev->link.qual.rx_success++;
417 rx_status->rate = val; 417 rx_status->rate = val;
418 rx_status->signal = 418 rx_status->signal =
419 rt2x00lib_calculate_link_signal(rt2x00dev, desc->rssi); 419 rt2x00lib_calculate_link_signal(rt2x00dev, desc->rssi);