Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Oct 2015 07:42:56 +0000 (UTC)
From:      Andriy Voskoboinyk <avos@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r289799 - head/sys/dev/usb/wlan
Message-ID:  <201510230742.t9N7guJR072278@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avos
Date: Fri Oct 23 07:42:56 2015
New Revision: 289799
URL: https://svnweb.freebsd.org/changeset/base/289799

Log:
  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

Modified:
  head/sys/dev/usb/wlan/if_urtwn.c
  head/sys/dev/usb/wlan/if_urtwnreg.h

Modified: head/sys/dev/usb/wlan/if_urtwn.c
==============================================================================
--- head/sys/dev/usb/wlan/if_urtwn.c	Fri Oct 23 07:40:43 2015	(r289798)
+++ head/sys/dev/usb/wlan/if_urtwn.c	Fri Oct 23 07:42:56 2015	(r289799)
@@ -86,7 +86,6 @@ SYSCTL_INT(_hw_usb_urtwn, OID_AUTO, debu
     "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, u
 			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);

Modified: head/sys/dev/usb/wlan/if_urtwnreg.h
==============================================================================
--- head/sys/dev/usb/wlan/if_urtwnreg.h	Fri Oct 23 07:40:43 2015	(r289798)
+++ head/sys/dev/usb/wlan/if_urtwnreg.h	Fri Oct 23 07:42:56 2015	(r289799)
@@ -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. */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201510230742.t9N7guJR072278>