aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rtl818x/rtl8187_dev.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/rtl818x/rtl8187_dev.c')
-rw-r--r--drivers/net/wireless/rtl818x/rtl8187_dev.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/drivers/net/wireless/rtl818x/rtl8187_dev.c b/drivers/net/wireless/rtl818x/rtl8187_dev.c
index 2017ccc00145..76973b8c7099 100644
--- a/drivers/net/wireless/rtl818x/rtl8187_dev.c
+++ b/drivers/net/wireless/rtl818x/rtl8187_dev.c
@@ -320,7 +320,6 @@ static void rtl8187_rx_cb(struct urb *urb)
320 struct ieee80211_rx_status rx_status = { 0 }; 320 struct ieee80211_rx_status rx_status = { 0 };
321 int rate, signal; 321 int rate, signal;
322 u32 flags; 322 u32 flags;
323 u32 quality;
324 unsigned long f; 323 unsigned long f;
325 324
326 spin_lock_irqsave(&priv->rx_queue.lock, f); 325 spin_lock_irqsave(&priv->rx_queue.lock, f);
@@ -338,10 +337,9 @@ static void rtl8187_rx_cb(struct urb *urb)
338 (typeof(hdr))(skb_tail_pointer(skb) - sizeof(*hdr)); 337 (typeof(hdr))(skb_tail_pointer(skb) - sizeof(*hdr));
339 flags = le32_to_cpu(hdr->flags); 338 flags = le32_to_cpu(hdr->flags);
340 /* As with the RTL8187B below, the AGC is used to calculate 339 /* As with the RTL8187B below, the AGC is used to calculate
341 * signal strength and quality. In this case, the scaling 340 * signal strength. In this case, the scaling
342 * constants are derived from the output of p54usb. 341 * constants are derived from the output of p54usb.
343 */ 342 */
344 quality = 130 - ((41 * hdr->agc) >> 6);
345 signal = -4 - ((27 * hdr->agc) >> 6); 343 signal = -4 - ((27 * hdr->agc) >> 6);
346 rx_status.antenna = (hdr->signal >> 7) & 1; 344 rx_status.antenna = (hdr->signal >> 7) & 1;
347 rx_status.mactime = le64_to_cpu(hdr->mac_time); 345 rx_status.mactime = le64_to_cpu(hdr->mac_time);
@@ -354,23 +352,18 @@ static void rtl8187_rx_cb(struct urb *urb)
354 * In testing, none of these quantities show qualitative 352 * In testing, none of these quantities show qualitative
355 * agreement with AP signal strength, except for the AGC, 353 * agreement with AP signal strength, except for the AGC,
356 * which is inversely proportional to the strength of the 354 * which is inversely proportional to the strength of the
357 * signal. In the following, the quality and signal strength 355 * signal. In the following, the signal strength
358 * are derived from the AGC. The arbitrary scaling constants 356 * is derived from the AGC. The arbitrary scaling constants
359 * are chosen to make the results close to the values obtained 357 * are chosen to make the results close to the values obtained
360 * for a BCM4312 using b43 as the driver. The noise is ignored 358 * for a BCM4312 using b43 as the driver. The noise is ignored
361 * for now. 359 * for now.
362 */ 360 */
363 flags = le32_to_cpu(hdr->flags); 361 flags = le32_to_cpu(hdr->flags);
364 quality = 170 - hdr->agc;
365 signal = 14 - hdr->agc / 2; 362 signal = 14 - hdr->agc / 2;
366 rx_status.antenna = (hdr->rssi >> 7) & 1; 363 rx_status.antenna = (hdr->rssi >> 7) & 1;
367 rx_status.mactime = le64_to_cpu(hdr->mac_time); 364 rx_status.mactime = le64_to_cpu(hdr->mac_time);
368 } 365 }
369 366
370 if (quality > 100)
371 quality = 100;
372 rx_status.qual = quality;
373 priv->quality = quality;
374 rx_status.signal = signal; 367 rx_status.signal = signal;
375 priv->signal = signal; 368 priv->signal = signal;
376 rate = (flags >> 20) & 0xF; 369 rate = (flags >> 20) & 0xF;