Author: adrian
Date: Sat Oct  3 15:49:55 2015
New Revision: 288604
URL: https://svnweb.freebsd.org/changeset/base/288604

Log:
  rum(4): add TSF field into radiotap headers
  
  Submitted by: <s3er...@gmail.com>
  Differential Revision:        https://reviews.freebsd.org/D3607

Modified:
  head/sys/dev/usb/wlan/if_rum.c
  head/sys/dev/usb/wlan/if_rumvar.h

Modified: head/sys/dev/usb/wlan/if_rum.c
==============================================================================
--- head/sys/dev/usb/wlan/if_rum.c      Sat Oct  3 15:48:21 2015        
(r288603)
+++ head/sys/dev/usb/wlan/if_rum.c      Sat Oct  3 15:49:55 2015        
(r288604)
@@ -206,6 +206,7 @@ static void         rum_set_chan(struct rum_sof
 static void            rum_enable_tsf_sync(struct rum_softc *);
 static void            rum_enable_tsf(struct rum_softc *);
 static void            rum_abort_tsf_sync(struct rum_softc *);
+static void            rum_get_tsf(struct rum_softc *, uint64_t *);
 static void            rum_update_slot(struct rum_softc *);
 static void            rum_set_bssid(struct rum_softc *, const uint8_t *);
 static void            rum_set_macaddr(struct rum_softc *, const uint8_t *);
@@ -857,6 +858,7 @@ tr_setup:
 
                                tap->wt_flags = 0;
                                tap->wt_rate = data->rate;
+                               rum_get_tsf(sc, &tap->wt_tsf);
                                tap->wt_antenna = sc->tx_ant;
 
                                ieee80211_radiotap_tx(vap, m);
@@ -963,11 +965,11 @@ rum_bulk_read_callback(struct usb_xfer *
                if (ieee80211_radiotap_active(ic)) {
                        struct rum_rx_radiotap_header *tap = &sc->sc_rxtap;
 
-                       /* XXX read tsf */
                        tap->wr_flags = 0;
                        tap->wr_rate = ieee80211_plcp2rate(sc->sc_rx_desc.rate,
                            (flags & RT2573_RX_OFDM) ?
                            IEEE80211_T_OFDM : IEEE80211_T_CCK);
+                       rum_get_tsf(sc, &tap->wr_tsf);
                        tap->wr_antsignal = RT2573_NOISE_FLOOR + rssi;
                        tap->wr_antnoise = RT2573_NOISE_FLOOR;
                        tap->wr_antenna = sc->rx_ant;
@@ -1836,6 +1838,12 @@ rum_abort_tsf_sync(struct rum_softc *sc)
 }
 
 static void
+rum_get_tsf(struct rum_softc *sc, uint64_t *buf)
+{
+       rum_read_multi(sc, RT2573_TXRX_CSR12, buf, sizeof (*buf));
+}
+
+static void
 rum_update_slot(struct rum_softc *sc)
 {
        struct ieee80211com *ic = &sc->sc_ic;

Modified: head/sys/dev/usb/wlan/if_rumvar.h
==============================================================================
--- head/sys/dev/usb/wlan/if_rumvar.h   Sat Oct  3 15:48:21 2015        
(r288603)
+++ head/sys/dev/usb/wlan/if_rumvar.h   Sat Oct  3 15:49:55 2015        
(r288604)
@@ -22,6 +22,7 @@
 
 struct rum_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;
@@ -32,7 +33,8 @@ struct rum_rx_radiotap_header {
 } __packed __aligned(8);
 
 #define RT2573_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) |                      \
@@ -42,6 +44,7 @@ struct rum_rx_radiotap_header {
 
 struct rum_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;
@@ -50,7 +53,8 @@ struct rum_tx_radiotap_header {
 } __packed __aligned(8);
 
 #define RT2573_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_ANTENNA))
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to