summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDamien Bergamini <damien@cvs.openbsd.org>2006-05-20 15:31:31 +0000
committerDamien Bergamini <damien@cvs.openbsd.org>2006-05-20 15:31:31 +0000
commit1bdc492c48e86604ea52d892d6caba216be3dd35 (patch)
tree701e4ac4b5cd816cff47f0622bb36f7c3a87b609 /sys
parentfd808774b27f862430650b5057e65289dddf5dec (diff)
more rx radiotap stats
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/if_wpi.c32
-rw-r--r--sys/dev/pci/if_wpireg.h4
-rw-r--r--sys/dev/pci/if_wpivar.h16
3 files changed, 41 insertions, 11 deletions
diff --git a/sys/dev/pci/if_wpi.c b/sys/dev/pci/if_wpi.c
index 2816f53cf0a..5b8980b6bd9 100644
--- a/sys/dev/pci/if_wpi.c
+++ b/sys/dev/pci/if_wpi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_wpi.c,v 1.10 2006/05/20 13:24:02 damien Exp $ */
+/* $OpenBSD: if_wpi.c,v 1.11 2006/05/20 15:31:30 damien Exp $ */
/*-
* Copyright (c) 2006
@@ -1096,7 +1096,30 @@ wpi_rx_intr(struct wpi_softc *sc, struct wpi_rx_desc *desc,
htole16(ic->ic_channels[head->chan].ic_freq);
tap->wr_chan_flags =
htole16(ic->ic_channels[head->chan].ic_flags);
- tap->wr_antsignal = stat->signal;
+ tap->wr_dbm_antsignal = (int8_t)(stat->rssi - WPI_RSSI_OFFSET);
+ tap->wr_dbm_antnoise = (int8_t)stat->noise;
+ tap->wr_tsft = tail->tstamp;
+ tap->wr_antenna = (letoh16(head->flags) >> 4) & 0xf;
+ switch (head->rate) {
+ /* CCK rates */
+ case 10: tap->wr_rate = 2; break;
+ case 20: tap->wr_rate = 4; break;
+ case 55: tap->wr_rate = 11; break;
+ case 110: tap->wr_rate = 22; break;
+ /* OFDM rates */
+ case 0xd: tap->wr_rate = 12; break;
+ case 0xf: tap->wr_rate = 18; break;
+ case 0x5: tap->wr_rate = 24; break;
+ case 0x7: tap->wr_rate = 36; break;
+ case 0x9: tap->wr_rate = 48; break;
+ case 0xb: tap->wr_rate = 72; break;
+ case 0x1: tap->wr_rate = 96; break;
+ case 0x3: tap->wr_rate = 109; break;
+ /* unknown rate: should not happen */
+ default: tap->wr_rate = 0;
+ }
+ if (letoh16(head->flags) & 0x4)
+ tap->wr_flags |= IEEE80211_RADIOTAP_F_SHORTPRE;
M_DUP_PKTHDR(&mb, m);
mb.m_data = (caddr_t)tap;
@@ -1126,9 +1149,8 @@ wpi_tx_intr(struct wpi_softc *sc, struct wpi_rx_desc *desc,
struct ifnet *ifp = &ic->ic_if;
struct wpi_tx_ring *ring = &sc->txq[desc->qid & 0x3];
struct wpi_tx_data *txdata = &ring->data[desc->idx];
-#ifdef WPI_DEBUG
struct wpi_tx_stat *stat = (struct wpi_tx_stat *)(desc + 1);
-#endif
+
DPRINTFN(4, ("tx done: qid=%d idx=%d retries=%d nkill=%d rate=%x "
"duration=%d status=%x\n", desc->qid, desc->idx, stat->ntries,
stat->nkill, stat->rate, letoh32(stat->duration),
@@ -1848,7 +1870,7 @@ wpi_auth(struct wpi_softc *sc)
sc->config.ofdm_mask = 0x15;
}
if (ic->ic_flags & IEEE80211_F_SHSLOT)
- sc->config.flags |= htole32(WPI_CONFIG_SHORT_SLOT);
+ sc->config.flags |= htole32(WPI_CONFIG_SHSLOT);
if (ic->ic_flags & IEEE80211_F_SHPREAMBLE)
sc->config.flags |= htole32(WPI_CONFIG_SHPREAMBLE);
diff --git a/sys/dev/pci/if_wpireg.h b/sys/dev/pci/if_wpireg.h
index 2e9dfd02b95..022a5f2fbd8 100644
--- a/sys/dev/pci/if_wpireg.h
+++ b/sys/dev/pci/if_wpireg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_wpireg.h,v 1.4 2006/05/20 13:24:02 damien Exp $ */
+/* $OpenBSD: if_wpireg.h,v 1.5 2006/05/20 15:31:30 damien Exp $ */
/*-
@@ -275,7 +275,7 @@ struct wpi_config {
#define WPI_CONFIG_24GHZ (1 << 0)
#define WPI_CONFIG_CCK (1 << 1)
#define WPI_CONFIG_AUTO (1 << 2)
-#define WPI_CONFIG_SHORT_SLOT (1 << 4)
+#define WPI_CONFIG_SHSLOT (1 << 4)
#define WPI_CONFIG_SHPREAMBLE (1 << 5)
#define WPI_CONFIG_NODIVERSITY (1 << 7)
#define WPI_CONFIG_ANTENNA_A (1 << 8)
diff --git a/sys/dev/pci/if_wpivar.h b/sys/dev/pci/if_wpivar.h
index a96242445ee..05366df3eb6 100644
--- a/sys/dev/pci/if_wpivar.h
+++ b/sys/dev/pci/if_wpivar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_wpivar.h,v 1.3 2006/05/20 11:47:29 damien Exp $ */
+/* $OpenBSD: if_wpivar.h,v 1.4 2006/05/20 15:31:30 damien Exp $ */
/*-
* Copyright (c) 2006
@@ -19,16 +19,24 @@
struct wpi_rx_radiotap_header {
struct ieee80211_radiotap_header wr_ihdr;
+ uint64_t wr_tsft;
uint8_t wr_flags;
+ uint8_t wr_rate;
uint16_t wr_chan_freq;
uint16_t wr_chan_flags;
- uint8_t wr_antsignal;
+ int8_t wr_dbm_antsignal;
+ int8_t wr_dbm_antnoise;
+ uint8_t wr_antenna;
} __packed;
#define WPI_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_DB_ANTSIGNAL))
+ (1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) | \
+ (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE) | \
+ (1 << IEEE80211_RADIOTAP_ANTENNA))
struct wpi_tx_radiotap_header {
struct ieee80211_radiotap_header wt_ihdr;