From owner-svn-src-all@freebsd.org Sat Mar 30 09:24:08 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D25B1156C2CA; Sat, 30 Mar 2019 09:24:07 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7666B77416; Sat, 30 Mar 2019 09:24:07 +0000 (UTC) (envelope-from avos@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4E2F6CD1A; Sat, 30 Mar 2019 09:24:07 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2U9O7k7054218; Sat, 30 Mar 2019 09:24:07 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2U9O79B054217; Sat, 30 Mar 2019 09:24:07 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201903300924.x2U9O79B054217@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sat, 30 Mar 2019 09:24:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345729 - head/sys/dev/usb/wlan X-SVN-Group: head X-SVN-Commit-Author: avos X-SVN-Commit-Paths: head/sys/dev/usb/wlan X-SVN-Commit-Revision: 345729 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7666B77416 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.92)[-0.918,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 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: Sat, 30 Mar 2019 09:24:08 -0000 Author: avos Date: Sat Mar 30 09:24:06 2019 New Revision: 345729 URL: https://svnweb.freebsd.org/changeset/base/345729 Log: urtw(4): export TSF timestamp for received frames via radiotap Tested with Netgear WG111 v3 (RTL8187B), STA mode. MFC after: 1 week Modified: head/sys/dev/usb/wlan/if_urtw.c head/sys/dev/usb/wlan/if_urtwvar.h Modified: head/sys/dev/usb/wlan/if_urtw.c ============================================================================== --- head/sys/dev/usb/wlan/if_urtw.c Sat Mar 30 07:29:20 2019 (r345728) +++ head/sys/dev/usb/wlan/if_urtw.c Sat Mar 30 09:24:06 2019 (r345729) @@ -3932,6 +3932,7 @@ urtw_rxeof(struct usb_xfer *xfer, struct urtw_data *da struct urtw_softc *sc = data->sc; struct ieee80211com *ic = &sc->sc_ic; uint8_t noise = 0, rate; + uint64_t mactime; usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL); @@ -3951,6 +3952,9 @@ urtw_rxeof(struct usb_xfer *xfer, struct urtw_data *da /* XXX correct? */ rssi = rx->rssi & URTW_RX_RSSI_MASK; noise = rx->noise; + + if (ieee80211_radiotap_active(ic)) + mactime = rx->mactime; } else { struct urtw_8187l_rxhdr *rx; @@ -3967,6 +3971,9 @@ urtw_rxeof(struct usb_xfer *xfer, struct urtw_data *da /* XXX correct? */ rssi = rx->rssi & URTW_RX_8187L_RSSI_MASK; noise = rx->noise; + + if (ieee80211_radiotap_active(ic)) + mactime = rx->mactime; } if (flen < IEEE80211_ACK_LEN) @@ -3986,6 +3993,7 @@ urtw_rxeof(struct usb_xfer *xfer, struct urtw_data *da if (ieee80211_radiotap_active(ic)) { struct urtw_rx_radiotap_header *tap = &sc->sc_rxtap; + tap->wr_tsf = mactime; tap->wr_flags = 0; tap->wr_dbm_antsignal = (int8_t)rssi; } Modified: head/sys/dev/usb/wlan/if_urtwvar.h ============================================================================== --- head/sys/dev/usb/wlan/if_urtwvar.h Sat Mar 30 07:29:20 2019 (r345728) +++ head/sys/dev/usb/wlan/if_urtwvar.h Sat Mar 30 09:24:06 2019 (r345729) @@ -55,6 +55,7 @@ typedef STAILQ_HEAD(, urtw_data) urtw_datahead; struct urtw_rx_radiotap_header { struct ieee80211_radiotap_header wr_ihdr; + uint64_t wr_tsf; uint8_t wr_flags; uint8_t wr_pad; uint16_t wr_chan_freq; @@ -63,7 +64,8 @@ struct urtw_rx_radiotap_header { } __packed __aligned(8); #define URTW_RX_RADIOTAP_PRESENT \ - ((1 << IEEE80211_RADIOTAP_FLAGS) | \ + ((1 << IEEE80211_RADIOTAP_TSFT) | \ + (1 << IEEE80211_RADIOTAP_FLAGS) | \ (1 << IEEE80211_RADIOTAP_CHANNEL) | \ (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL))