aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/usb
diff options
context:
space:
mode:
authorAndriy Voskoboinyk <avos@FreeBSD.org>2015-10-23 07:42:56 +0000
committerAndriy Voskoboinyk <avos@FreeBSD.org>2015-10-23 07:42:56 +0000
commit1b65f30ffa29ed145a555a8b887a639f09fb54b2 (patch)
tree226fd8fa7b76339e6c70fde002cb32545a47213a /sys/dev/usb
parentbf7a0eeb924f562945cd2fed57b4fb085d86ec9a (diff)
downloadsrc-1b65f30ffa29ed145a555a8b887a639f09fb54b2.tar.gz
src-1b65f30ffa29ed145a555a8b887a639f09fb54b2.zip
urtwn(4): fix the RSSI calculation for RTL8188EU.
This change also reverts r252405 (causes integer underflow). Reviewed by: kevlo Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D3820
Notes
Notes: svn path=/head/; revision=289799
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/wlan/if_urtwn.c14
-rw-r--r--sys/dev/usb/wlan/if_urtwnreg.h8
2 files changed, 9 insertions, 13 deletions
diff --git a/sys/dev/usb/wlan/if_urtwn.c b/sys/dev/usb/wlan/if_urtwn.c
index 5ad2fa805279..2b17b9f55606 100644
--- a/sys/dev/usb/wlan/if_urtwn.c
+++ b/sys/dev/usb/wlan/if_urtwn.c
@@ -86,7 +86,6 @@ SYSCTL_INT(_hw_usb_urtwn, OID_AUTO, debug, CTLFLAG_RWTUN, &urtwn_debug, 0,
"Debug level");
#endif
-#define URTWN_RSSI(r) (r) - 110
#define IEEE80211_HAS_ADDR4(wh) IEEE80211_IS_DSTODS(wh)
/* various supported device vendors/products */
@@ -641,11 +640,6 @@ urtwn_rx_frame(struct urtwn_softc *sc, uint8_t *buf, int pktlen, int *rssi_p)
rssi = urtwn_get_rssi(sc, rate, &stat[1]);
/* Update our average RSSI. */
urtwn_update_avgrssi(sc, rate, rssi);
- /*
- * Convert the RSSI to a range that will be accepted
- * by net80211.
- */
- rssi = URTWN_RSSI(rssi);
}
m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR);
@@ -792,10 +786,12 @@ tr_setup:
(struct ieee80211_frame_min *)wh);
nf = URTWN_NOISE_FLOOR;
if (ni != NULL) {
- (void)ieee80211_input(ni, m, rssi, nf);
+ (void)ieee80211_input(ni, m, rssi - nf, nf);
ieee80211_free_node(ni);
- } else
- (void)ieee80211_input_all(ic, m, rssi, nf);
+ } else {
+ (void)ieee80211_input_all(ic, m, rssi - nf,
+ nf);
+ }
m = next;
}
URTWN_LOCK(sc);
diff --git a/sys/dev/usb/wlan/if_urtwnreg.h b/sys/dev/usb/wlan/if_urtwnreg.h
index d401664d959f..cf45d6a8c961 100644
--- a/sys/dev/usb/wlan/if_urtwnreg.h
+++ b/sys/dev/usb/wlan/if_urtwnreg.h
@@ -975,22 +975,22 @@ struct r92c_rx_cck {
struct r88e_rx_cck {
uint8_t path_agc[2];
+ uint8_t chan;
+ uint8_t reserved1;
uint8_t sig_qual;
uint8_t agc_rpt;
uint8_t rpt_b;
- uint8_t reserved1;
+ uint8_t reserved2;
uint8_t noise_power;
uint8_t path_cfotail[2];
uint8_t pcts_mask[2];
uint8_t stream_rxevm[2];
uint8_t path_rxsnr[2];
uint8_t noise_power_db_lsb;
- uint8_t reserved2[3];
+ uint8_t reserved3[3];
uint8_t stream_csi[2];
uint8_t stream_target_csi[2];
uint8_t sig_evm;
- uint8_t reserved3;
- uint8_t reserved4;
} __packed;
/* Tx MAC descriptor. */