From owner-svn-src-all@freebsd.org Tue Sep 8 08:02:16 2015 Return-Path: Delivered-To: svn-src-all@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 DAD879CD1E4; Tue, 8 Sep 2015 08:02:15 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::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 CC2FB14E8; Tue, 8 Sep 2015 08:02:15 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8882Fip065855; Tue, 8 Sep 2015 08:02:15 GMT (envelope-from kevlo@FreeBSD.org) Received: (from kevlo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8882Fr1065853; Tue, 8 Sep 2015 08:02:15 GMT (envelope-from kevlo@FreeBSD.org) Message-Id: <201509080802.t8882Fr1065853@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevlo set sender to kevlo@FreeBSD.org using -f From: Kevin Lo Date: Tue, 8 Sep 2015 08:02:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287554 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2015 08:02:16 -0000 Author: kevlo Date: Tue Sep 8 08:02:14 2015 New Revision: 287554 URL: https://svnweb.freebsd.org/changeset/base/287554 Log: Add TSF field into TX/RX radiotap headers Tested on RT5370, sta mode. Submitted by: Andriy Voskoboinyk Differential Revision: https://reviews.freebsd.org/D3590 Modified: head/sys/dev/usb/wlan/if_run.c head/sys/dev/usb/wlan/if_runvar.h Modified: head/sys/dev/usb/wlan/if_run.c ============================================================================== --- head/sys/dev/usb/wlan/if_run.c Tue Sep 8 07:53:10 2015 (r287553) +++ head/sys/dev/usb/wlan/if_run.c Tue Sep 8 08:02:14 2015 (r287554) @@ -431,6 +431,7 @@ static void run_updateprot_cb(void *); static void run_usb_timeout_cb(void *); static void run_reset_livelock(struct run_softc *); static void run_enable_tsf_sync(struct run_softc *); +static void run_get_tsf(struct run_softc *, uint64_t *); static void run_enable_mrr(struct run_softc *); static void run_set_txpreamble(struct run_softc *); static void run_set_basicrates(struct run_softc *); @@ -2811,6 +2812,7 @@ run_rx_frame(struct run_softc *sc, struc tap->wr_antenna = ant; tap->wr_dbm_antsignal = run_rssi2dbm(sc, rssi, ant); tap->wr_rate = 2; /* in case it can't be found below */ + run_get_tsf(sc, &tap->wr_tsf); phy = le16toh(rxwi->phy); switch (phy & RT2860_PHY_MODE) { case RT2860_PHY_CCK: @@ -3058,6 +3060,7 @@ tr_setup: (struct rt2860_txwi *)(&data->desc + sizeof(struct rt2870_txd)); tap->wt_flags = 0; tap->wt_rate = rt2860_rates[data->ridx].rate; + run_get_tsf(sc, &tap->wt_tsf); tap->wt_chan_freq = htole16(ic->ic_curchan->ic_freq); tap->wt_chan_flags = htole16(ic->ic_curchan->ic_flags); tap->wt_hwqueue = index; @@ -5047,6 +5050,13 @@ run_enable_tsf_sync(struct run_softc *sc } static void +run_get_tsf(struct run_softc *sc, uint64_t *buf) +{ + run_read_region_1(sc, RT2860_TSF_TIMER_DW0, (uint8_t *)buf, + sizeof(*buf)); +} + +static void run_enable_mrr(struct run_softc *sc) { #define CCK(mcs) (mcs) Modified: head/sys/dev/usb/wlan/if_runvar.h ============================================================================== --- head/sys/dev/usb/wlan/if_runvar.h Tue Sep 8 07:53:10 2015 (r287553) +++ head/sys/dev/usb/wlan/if_runvar.h Tue Sep 8 08:02:14 2015 (r287554) @@ -45,6 +45,7 @@ struct run_rx_radiotap_header { struct ieee80211_radiotap_header wr_ihdr; + uint64_t wr_tsf; uint8_t wr_flags; uint8_t wr_rate; uint16_t wr_chan_freq; @@ -55,7 +56,8 @@ struct run_rx_radiotap_header { } __packed __aligned(8); #define RUN_RX_RADIOTAP_PRESENT \ - (1 << IEEE80211_RADIOTAP_FLAGS | \ + (1 << IEEE80211_RADIOTAP_TSFT | \ + 1 << IEEE80211_RADIOTAP_FLAGS | \ 1 << IEEE80211_RADIOTAP_RATE | \ 1 << IEEE80211_RADIOTAP_CHANNEL | \ 1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL | \ @@ -64,6 +66,7 @@ struct run_rx_radiotap_header { struct run_tx_radiotap_header { struct ieee80211_radiotap_header wt_ihdr; + uint64_t wt_tsf; uint8_t wt_flags; uint8_t wt_rate; uint16_t wt_chan_freq; @@ -74,7 +77,8 @@ struct run_tx_radiotap_header { #define IEEE80211_RADIOTAP_HWQUEUE 15 #define RUN_TX_RADIOTAP_PRESENT \ - (1 << IEEE80211_RADIOTAP_FLAGS | \ + (1 << IEEE80211_RADIOTAP_TSFT | \ + 1 << IEEE80211_RADIOTAP_FLAGS | \ 1 << IEEE80211_RADIOTAP_RATE | \ 1 << IEEE80211_RADIOTAP_CHANNEL | \ 1 << IEEE80211_RADIOTAP_HWQUEUE)