Subject: radiotap DB vs DBM, signedness
To: None <tech-net@netbsd.org>
From: Greg Troxel <gdt@ir.bbn.com>
List: tech-net
Date: 09/13/2006 14:47:29
--=-=-=


I've recently been trying to make more careful signal and noise
measurements with ath(4) cards.  (You can see my fleet of All-Terrain
Radio Flyer Wagons, complete with Novatel GPS units with local
differential corrections at http://www.lexort.com/gallery/random-geek )

I've had two sources of consternation: noise values and calibration
intervals, and the sign and units of rssi/nf.  Sam Leffler has helped
me out greatly off-list and I'm writing to propose fixes and explain
what I've learned.

1) Calibration and noise values

I'm still gathering data, but basically the noise values don't change
often.  Setting ath.calibrate to 1 (from 30) should result in more
frequent calibration and hence more accurate/recent noise
measurements.

2) radiotap and signal representation

Radiotap has both

  IEEE80211_RADIOTAP_DBM_ANTSIGNAL

and

  IEEE80211_RADIOTAP_DB_ANTSIGNAL

for signal strength.  These are relative to dBm and to an arbitrary
reference.  While it might well be good to have the latter, the useful
thing to do is have some rough calibration done and the constant put
in the driver.

It turns out Atheros chips return values in dBm, so I have a local
patch to use IEEE80211_RADIOTAP_DBM_ANT{SIGNAL,NOISE} instead of the
DB flavors.

I also patched tcpdump to show dBm when DBM is used, rather than dB,
so one can tell what's going on.

With those changes, I see packets like this:

13:57:40.467100 965620941716us tsft 1.0 Mb/s 2462 MHz (0x0480) -41dBm signal -96dBm noise antenna 1 Beacon (adroit-collab) [1.0* 2.0* 5.5* 6.0 9.0 11.0* 12.0 18.0 Mbit] IBSS CH: 11, PRIVACY

which is much more useful and tied to reality than the previous values
of 201 and 160 dB, which turned out to be dB relative to -256 dBm.


The other problem is that IEEE80211_RADIOTAP_DB_ANT is in u_int8_t
rather than int8_t.  For dB, this doesn't make sense.

So, barring objections I'm going to

  fix sys/dev/ic/athioctl.h to use DBM flavors of radiotap fields
  fix tcpdump to print dBm for DBM

I'd also like to adjust the DB fields to be signed, and make the
change in tcpdump.  Then everything that uses it can change, or can
ask the question: how can I make this sort of dBm.  But it's sort of
an ABI change for radiotap.  Thoughts?

    Greg Troxel <gdt@ir.bbn.com>

--=-=-=
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (NetBSD)

iD8DBQFFCFJB+vesoDJhHiURAor+AJ9vPE5pKmj8IAQZYn5KZPhaNYdtWACfexl+
KFgyEH3q9zZ3ORUCA23+qH0=
=rIed
-----END PGP SIGNATURE-----
--=-=-=--