diff options
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00.h | 7 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00dev.c | 1 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00lib.h | 13 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00link.c | 88 |
4 files changed, 0 insertions, 109 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index c83dbaefd57a..1a84574a26d3 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -313,13 +313,6 @@ struct link { | |||
313 | struct avg_val avg_rssi; | 313 | struct avg_val avg_rssi; |
314 | 314 | ||
315 | /* | 315 | /* |
316 | * Currently precalculated percentages of successful | ||
317 | * TX and RX frames. | ||
318 | */ | ||
319 | int rx_percentage; | ||
320 | int tx_percentage; | ||
321 | |||
322 | /* | ||
323 | * Work structure for scheduling periodic link tuning. | 316 | * Work structure for scheduling periodic link tuning. |
324 | */ | 317 | */ |
325 | struct delayed_work work; | 318 | struct delayed_work work; |
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index 73bbec58341e..00bfb2255ceb 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
@@ -430,7 +430,6 @@ void rt2x00lib_rxdone(struct rt2x00_dev *rt2x00dev, | |||
430 | 430 | ||
431 | rx_status->mactime = rxdesc.timestamp; | 431 | rx_status->mactime = rxdesc.timestamp; |
432 | rx_status->rate_idx = rate_idx; | 432 | rx_status->rate_idx = rate_idx; |
433 | rx_status->qual = rt2x00link_calculate_signal(rt2x00dev, rxdesc.rssi); | ||
434 | rx_status->signal = rxdesc.rssi; | 433 | rx_status->signal = rxdesc.rssi; |
435 | rx_status->noise = rxdesc.noise; | 434 | rx_status->noise = rxdesc.noise; |
436 | rx_status->flag = rxdesc.flags; | 435 | rx_status->flag = rxdesc.flags; |
diff --git a/drivers/net/wireless/rt2x00/rt2x00lib.h b/drivers/net/wireless/rt2x00/rt2x00lib.h index 567f029a8cda..e17016572c3f 100644 --- a/drivers/net/wireless/rt2x00/rt2x00lib.h +++ b/drivers/net/wireless/rt2x00/rt2x00lib.h | |||
@@ -223,19 +223,6 @@ void rt2x00link_update_stats(struct rt2x00_dev *rt2x00dev, | |||
223 | struct rxdone_entry_desc *rxdesc); | 223 | struct rxdone_entry_desc *rxdesc); |
224 | 224 | ||
225 | /** | 225 | /** |
226 | * rt2x00link_calculate_signal - Calculate signal quality | ||
227 | * @rt2x00dev: Pointer to &struct rt2x00_dev. | ||
228 | * @rssi: RX Frame RSSI | ||
229 | * | ||
230 | * Calculate the signal quality of a frame based on the rssi | ||
231 | * measured during the receiving of the frame and the global | ||
232 | * link quality statistics measured since the start of the | ||
233 | * link tuning. The result is a value between 0 and 100 which | ||
234 | * is an indication of the signal quality. | ||
235 | */ | ||
236 | int rt2x00link_calculate_signal(struct rt2x00_dev *rt2x00dev, int rssi); | ||
237 | |||
238 | /** | ||
239 | * rt2x00link_start_tuner - Start periodic link tuner work | 226 | * rt2x00link_start_tuner - Start periodic link tuner work |
240 | * @rt2x00dev: Pointer to &struct rt2x00_dev. | 227 | * @rt2x00dev: Pointer to &struct rt2x00_dev. |
241 | * | 228 | * |
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 | |||
115 | static int rt2x00link_antenna_get_link_rssi(struct rt2x00_dev *rt2x00dev) | 76 | static 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 | ||
307 | static 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 | |||
318 | int 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 | |||
347 | void rt2x00link_start_tuner(struct rt2x00_dev *rt2x00dev) | 268 | void 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); |