Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 Apr 2011 07:32:57 +0000 (UTC)
From:      Bernhard Schmidt <bschmidt@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r220689 - head/sys/dev/iwn
Message-ID:  <201104160732.p3G7WvkF095624@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bschmidt
Date: Sat Apr 16 07:32:57 2011
New Revision: 220689
URL: http://svn.freebsd.org/changeset/base/220689

Log:
  RSSI related syncs with the OpenBSD code:
  - read RSSI only for the active chains
  - cast RSSI/NF to int8_t before passing it up to radiotap
  - remove the htole64() for the timestamp
  
  Obtained from:	OpenBSD

Modified:
  head/sys/dev/iwn/if_iwn.c

Modified: head/sys/dev/iwn/if_iwn.c
==============================================================================
--- head/sys/dev/iwn/if_iwn.c	Sat Apr 16 07:21:00 2011	(r220688)
+++ head/sys/dev/iwn/if_iwn.c	Sat Apr 16 07:32:57 2011	(r220689)
@@ -2128,18 +2128,18 @@ iwn_rx_done(struct iwn_softc *sc, struct
 	m->m_data = head;
 	m->m_pkthdr.len = m->m_len = len;
 
-	rssi = hal->get_rssi(sc, stat);
-
 	/* Grab a reference to the source node. */
 	wh = mtod(m, struct ieee80211_frame *);
 	ni = ieee80211_find_rxnode(ic, (struct ieee80211_frame_min *)wh);
 	nf = (ni != NULL && ni->ni_vap->iv_state == IEEE80211_S_RUN &&
 	    (ic->ic_flags & IEEE80211_F_SCAN) == 0) ? sc->noise : -95;
 
+	rssi = hal->get_rssi(sc, stat);
+
 	if (ieee80211_radiotap_active(ic)) {
 		struct iwn_rx_radiotap_header *tap = &sc->sc_rxtap;
 
-		tap->wr_tsft = htole64(stat->tstamp);
+		tap->wr_tsft = stat->tstamp;
 		tap->wr_flags = 0;
 		if (stat->flags & htole16(IWN_STAT_FLAG_SHPREAMBLE))
 			tap->wr_flags |= IEEE80211_RADIOTAP_F_SHORTPRE;
@@ -2161,8 +2161,8 @@ iwn_rx_done(struct iwn_softc *sc, struct
 		/* Unknown rate: should not happen. */
 		default:  tap->wr_rate =   0;
 		}
-		tap->wr_dbm_antsignal = rssi;
-		tap->wr_dbm_antnoise = nf;
+		tap->wr_dbm_antsignal = (int8_t)rssi;
+		tap->wr_dbm_antnoise = (int8_t)nf;
 	}
 
 	IWN_UNLOCK(sc);
@@ -3985,18 +3985,12 @@ iwn4965_get_rssi(struct iwn_softc *sc, s
 	agc  = (le16toh(phy->agc) >> 7) & 0x7f;
 
 	rssi = 0;
-#if 0
-	if (mask & IWN_ANT_A)	/* Ant A */
-		rssi = max(rssi, phy->rssi[0]);
-	if (mask & IWN_ATH_B)	/* Ant B */
-		rssi = max(rssi, phy->rssi[2]);
-	if (mask & IWN_ANT_C)	/* Ant C */
-		rssi = max(rssi, phy->rssi[4]);
-#else
-	rssi = max(rssi, phy->rssi[0]);
-	rssi = max(rssi, phy->rssi[2]);
-	rssi = max(rssi, phy->rssi[4]);
-#endif
+	if (mask & IWN_ANT_A)
+		rssi = MAX(rssi, phy->rssi[0]);
+	if (mask & IWN_ANT_B)
+		rssi = MAX(rssi, phy->rssi[2]);
+	if (mask & IWN_ANT_C)
+		rssi = MAX(rssi, phy->rssi[4]);
 
 	DPRINTF(sc, IWN_DEBUG_RECV, "%s: agc %d mask 0x%x rssi %d %d %d "
 	    "result %d\n", __func__, agc, mask,



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