Date: Mon, 12 Sep 2016 04:55:14 +0000 (UTC) From: Adrian Chadd <adrian@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305721 - head/sys/dev/ath Message-ID: <201609120455.u8C4tEgJ052540@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: adrian Date: Mon Sep 12 04:55:13 2016 New Revision: 305721 URL: https://svnweb.freebsd.org/changeset/base/305721 Log: [ath] set the relevant TOA/TOD locationing bits when trying to do locationing. * Don't do RTS/CTS - experiments show that we get ACK frames for each of them and this ends up causing the timestamps to look all funny. * Set the HAL_TXDESC_POS bit, so the AR9300 HAL sets up the hardware to return location and CSI information. Modified: head/sys/dev/ath/if_ath_tx.c Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Mon Sep 12 04:50:40 2016 (r305720) +++ head/sys/dev/ath/if_ath_tx.c Mon Sep 12 04:55:13 2016 (r305721) @@ -1042,6 +1042,14 @@ ath_tx_calc_protection(struct ath_softc shortPreamble = bf->bf_state.bfs_shpream; wh = mtod(bf->bf_m, struct ieee80211_frame *); + /* Disable frame protection for TOA probe frames */ + if (bf->bf_flags & ATH_BUF_TOA_PROBE) { + /* XXX count */ + flags &= ~(HAL_TXDESC_CTSENA | HAL_TXDESC_RTSENA); + bf->bf_state.bfs_doprot = 0; + goto finish; + } + /* * If 802.11g protection is enabled, determine whether * to use RTS/CTS or just CTS. Note that this is only @@ -1081,6 +1089,8 @@ ath_tx_calc_protection(struct ath_softc flags |= HAL_TXDESC_RTSENA; sc->sc_stats.ast_tx_htprotect++; } + +finish: bf->bf_state.bfs_txflags = flags; } @@ -1739,6 +1749,34 @@ ath_tx_normal_setup(struct ath_softc *sc } #endif + /* + * If it's a frame to do location reporting on, + * communicate it to the HAL. + */ + if (ieee80211_get_toa_params(m0, NULL)) { + device_printf(sc->sc_dev, + "%s: setting TX positioning bit\n", __func__); + flags |= HAL_TXDESC_POS; + + /* + * Note: The hardware reports timestamps for + * each of the RX'ed packets as part of the packet + * exchange. So this means things like RTS/CTS + * exchanges, as well as the final ACK. + * + * So, if you send a RTS-protected NULL data frame, + * you'll get an RX report for the RTS response, then + * an RX report for the NULL frame, and then the TX + * completion at the end. + * + * NOTE: it doesn't work right for CCK frames; + * there's no channel info data provided unless + * it's OFDM or HT. Will have to dig into it. + */ + flags &= ~(HAL_TXDESC_RTSENA | HAL_TXDESC_CTSENA); + bf->bf_flags |= ATH_BUF_TOA_PROBE; + } + #if 0 /* * Placeholder: if you want to transmit with the azimuth @@ -2175,6 +2213,18 @@ ath_tx_raw_start(struct ath_softc *sc, s try0 = ATH_TXMAXTRY; /* XXX?too many? */ } + /* + * If it's a frame to do location reporting on, + * communicate it to the HAL. + */ + if (ieee80211_get_toa_params(m0, NULL)) { + device_printf(sc->sc_dev, + "%s: setting TX positioning bit\n", __func__); + flags |= HAL_TXDESC_POS; + flags &= ~(HAL_TXDESC_RTSENA | HAL_TXDESC_CTSENA); + bf->bf_flags |= ATH_BUF_TOA_PROBE; + } + txrate = rt->info[rix].rateCode; if (params->ibp_flags & IEEE80211_BPF_SHORTPRE) txrate |= rt->info[rix].shortPreamble;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201609120455.u8C4tEgJ052540>