aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2x00link.c
diff options
context:
space:
mode:
authorIvo van Doorn <ivdoorn@gmail.com>2009-11-08 08:37:48 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-11-11 17:09:13 -0500
commit863cc978a73bc07f1de0e9a9bd9889bed6e618da (patch)
tree904a4cd93e811a9909f142753923e5704741fe94 /drivers/net/wireless/rt2x00/rt2x00link.c
parenta65986824d2552dd76786d5a0012989a64c45ab7 (diff)
rt2x00: Remove deprecated ieee80211_rx_status->qual usage
ieee80211_rx_status->qual has been marked deprecated. This allows us to remove several functions and fields which were used to calculate a reasonable value for it. Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Acked-by: Gertjan van Wingerde <gwingerde@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00link.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00link.c88
1 files changed, 0 insertions, 88 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00link.c b/drivers/net/wireless/rt2x00/rt2x00link.c
index c708d0be9155..f918f29e2d73 100644
--- a/drivers/net/wireless/rt2x00/rt2x00link.c
+++ b/drivers/net/wireless/rt2x00/rt2x00link.c
@@ -36,24 +36,6 @@
36#define DEFAULT_RSSI -128 36#define DEFAULT_RSSI -128
37 37
38/* 38/*
39 * When no TX/RX percentage could be calculated due to lack of
40 * frames on the air, we fallback to a percentage of 50%.
41 * This will assure we will get at least get some decent value
42 * when the link tuner starts.
43 * The value will be dropped and overwritten with the correct (measured)
44 * value anyway during the first run of the link tuner.
45 */
46#define DEFAULT_PERCENTAGE 50
47
48/*
49 * Small helper macro for percentage calculation
50 * This is a very simple macro with the only catch that it will
51 * produce a default value in case no total value was provided.
52 */
53#define PERCENTAGE(__value, __total) \
54 ( (__total) ? (((__value) * 100) / (__total)) : (DEFAULT_PERCENTAGE) )
55
56/*
57 * Helper struct and macro to work with moving/walking averages. 39 * Helper struct and macro to work with moving/walking averages.
58 * When adding a value to the average value the following calculation 40 * When adding a value to the average value the following calculation
59 * is needed: 41 * is needed:
@@ -91,27 +73,6 @@
91 __new; \ 73 __new; \
92}) 74})
93 75
94/*
95 * For calculating the Signal quality we have determined
96 * the total number of success and failed RX and TX frames.
97 * With the addition of the average RSSI value we can determine
98 * the link quality using the following algorithm:
99 *
100 * rssi_percentage = (avg_rssi * 100) / rssi_offset
101 * rx_percentage = (rx_success * 100) / rx_total
102 * tx_percentage = (tx_success * 100) / tx_total
103 * avg_signal = ((WEIGHT_RSSI * avg_rssi) +
104 * (WEIGHT_TX * tx_percentage) +
105 * (WEIGHT_RX * rx_percentage)) / 100
106 *
107 * This value should then be checked to not be greater then 100.
108 * This means the values of WEIGHT_RSSI, WEIGHT_RX, WEIGHT_TX must
109 * sum up to 100 as well.
110 */
111#define WEIGHT_RSSI 20
112#define WEIGHT_RX 40
113#define WEIGHT_TX 40
114
115static int rt2x00link_antenna_get_link_rssi(struct rt2x00_dev *rt2x00dev) 76static int rt2x00link_antenna_get_link_rssi(struct rt2x00_dev *rt2x00dev)
116{ 77{
117 struct link_ant *ant = &rt2x00dev->link.ant; 78 struct link_ant *ant = &rt2x00dev->link.ant;
@@ -304,46 +265,6 @@ void rt2x00link_update_stats(struct rt2x00_dev *rt2x00dev,
304 ant->rssi_ant = MOVING_AVERAGE(ant->rssi_ant, rxdesc->rssi); 265 ant->rssi_ant = MOVING_AVERAGE(ant->rssi_ant, rxdesc->rssi);
305} 266}
306 267
307static void rt2x00link_precalculate_signal(struct rt2x00_dev *rt2x00dev)
308{
309 struct link *link = &rt2x00dev->link;
310 struct link_qual *qual = &rt2x00dev->link.qual;
311
312 link->rx_percentage =
313 PERCENTAGE(qual->rx_success, qual->rx_failed + qual->rx_success);
314 link->tx_percentage =
315 PERCENTAGE(qual->tx_success, qual->tx_failed + qual->tx_success);
316}
317
318int rt2x00link_calculate_signal(struct rt2x00_dev *rt2x00dev, int rssi)
319{
320 struct link *link = &rt2x00dev->link;
321 int rssi_percentage = 0;
322 int signal;
323
324 /*
325 * We need a positive value for the RSSI.
326 */
327 if (rssi < 0)
328 rssi += rt2x00dev->rssi_offset;
329
330 /*
331 * Calculate the different percentages,
332 * which will be used for the signal.
333 */
334 rssi_percentage = PERCENTAGE(rssi, rt2x00dev->rssi_offset);
335
336 /*
337 * Add the individual percentages and use the WEIGHT
338 * defines to calculate the current link signal.
339 */
340 signal = ((WEIGHT_RSSI * rssi_percentage) +
341 (WEIGHT_TX * link->tx_percentage) +
342 (WEIGHT_RX * link->rx_percentage)) / 100;
343
344 return max_t(int, signal, 100);
345}
346
347void rt2x00link_start_tuner(struct rt2x00_dev *rt2x00dev) 268void rt2x00link_start_tuner(struct rt2x00_dev *rt2x00dev)
348{ 269{
349 struct link *link = &rt2x00dev->link; 270 struct link *link = &rt2x00dev->link;
@@ -357,9 +278,6 @@ void rt2x00link_start_tuner(struct rt2x00_dev *rt2x00dev)
357 if (!rt2x00dev->intf_ap_count && !rt2x00dev->intf_sta_count) 278 if (!rt2x00dev->intf_ap_count && !rt2x00dev->intf_sta_count)
358 return; 279 return;
359 280
360 link->rx_percentage = DEFAULT_PERCENTAGE;
361 link->tx_percentage = DEFAULT_PERCENTAGE;
362
363 rt2x00link_reset_tuner(rt2x00dev, false); 281 rt2x00link_reset_tuner(rt2x00dev, false);
364 282
365 if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags)) 283 if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
@@ -448,12 +366,6 @@ static void rt2x00link_tuner(struct work_struct *work)
448 rt2x00dev->ops->lib->link_tuner(rt2x00dev, qual, link->count); 366 rt2x00dev->ops->lib->link_tuner(rt2x00dev, qual, link->count);
449 367
450 /* 368 /*
451 * Precalculate a portion of the link signal which is
452 * in based on the tx/rx success/failure counters.
453 */
454 rt2x00link_precalculate_signal(rt2x00dev);
455
456 /*
457 * Send a signal to the led to update the led signal strength. 369 * Send a signal to the led to update the led signal strength.
458 */ 370 */
459 rt2x00leds_led_quality(rt2x00dev, qual->rssi); 371 rt2x00leds_led_quality(rt2x00dev, qual->rssi);