From owner-svn-src-head@freebsd.org Thu Nov 3 23:05:40 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7911EC2E379; Thu, 3 Nov 2016 23:05:40 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2E8FC1333; Thu, 3 Nov 2016 23:05:40 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uA3N5dLC009662; Thu, 3 Nov 2016 23:05:39 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uA3N5doN009661; Thu, 3 Nov 2016 23:05:39 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201611032305.uA3N5doN009661@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Thu, 3 Nov 2016 23:05:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308267 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Nov 2016 23:05:40 -0000 Author: adrian Date: Thu Nov 3 23:05:39 2016 New Revision: 308267 URL: https://svnweb.freebsd.org/changeset/base/308267 Log: [ath] add the MIMO per-chain RSSI and noise floor information. This is a long time coming. The general pieces have been floating around in a local repo since circa 2012 when I dropped the net80211 support into the tree. This allows the per-chain RSSI and NF to show up in 'ifconfig wlanX list sta'. I haven't yet implemented the EVM hookups so that'll show up; that'll come later. Thanks to Susie Hellings who did the original work on this a looong time ago for a company we both worked at. Modified: head/sys/dev/ath/if_ath_rx.c Modified: head/sys/dev/ath/if_ath_rx.c ============================================================================== --- head/sys/dev/ath/if_ath_rx.c Thu Nov 3 22:51:38 2016 (r308266) +++ head/sys/dev/ath/if_ath_rx.c Thu Nov 3 23:05:39 2016 (r308267) @@ -635,7 +635,9 @@ ath_rx_pkt(struct ath_softc *sc, struct struct mbuf *m) { uint64_t rstamp; - int len, type; + /* XXX TODO: make this an mbuf tag? */ + struct ieee80211_rx_stats rxs; + int len, type, i; struct ieee80211com *ic = &sc->sc_ic; struct ieee80211_node *ni; int is_good = 0; @@ -904,6 +906,33 @@ rx_accept: sc->sc_stats.ast_rx_agg++; #endif /* AH_SUPPORT_AR5416 */ + + /* + * Populate the per-chain RSSI values where appropriate. + */ + bzero(&rxs, sizeof(rxs)); + rxs.r_flags |= IEEE80211_R_NF | IEEE80211_R_RSSI | + IEEE80211_R_C_CHAIN | + IEEE80211_R_C_NF | + IEEE80211_R_C_RSSI | + IEEE80211_R_TSF64 | + IEEE80211_R_TSF_START; /* XXX TODO: validate */ + rxs.c_rssi = rs->rs_rssi; + rxs.c_nf = nf; + rxs.c_chain = 3; /* XXX TODO: check */ + rxs.c_rx_tsf = rstamp; + + for (i = 0; i < 3; i++) { + rxs.c_rssi_ctl[i] = rs->rs_rssi_ctl[i]; + rxs.c_rssi_ext[i] = rs->rs_rssi_ext[i]; + /* + * XXX note: we currently don't track + * per-chain noisefloor. + */ + rxs.c_nf_ctl[i] = nf; + rxs.c_nf_ext[i] = nf; + } + if (ni != NULL) { /* * Only punt packets for ampdu reorder processing for @@ -916,7 +945,8 @@ rx_accept: /* * Sending station is known, dispatch directly. */ - type = ieee80211_input(ni, m, rs->rs_rssi, nf); + (void) ieee80211_add_rx_params(m, &rxs); + type = ieee80211_input_mimo(ni, m); ieee80211_free_node(ni); m = NULL; /* @@ -929,7 +959,8 @@ rx_accept: rs->rs_keyix != HAL_RXKEYIX_INVALID) is_good = 1; } else { - type = ieee80211_input_all(ic, m, rs->rs_rssi, nf); + (void) ieee80211_add_rx_params(m, &rxs); + type = ieee80211_input_mimo_all(ic, m); m = NULL; }