Subject: Re: radiotap DB vs DBM, signedness
To: None <>
From: David Young <>
List: tech-net
Date: 09/21/2006 14:49:39
On Wed, Sep 20, 2006 at 08:48:05AM -0400, Greg Troxel wrote:
> David Young <> writes:
> > On Wed, Sep 13, 2006 at 02:47:29PM -0400, Greg Troxel wrote:
> >> 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.
> >
> > Why doesn't it make sense?  If you choose the reference point right, then
> > all dB values will fit between 0 and 255.  Maybe I am missing something.
> [I know you know some of what I'm saying, but I'm including it for the
> broader audience.]

I should say, first, that I am happy for radiotap to sprout a new,
signed-dB field, if that is required.

> It doesn't make sense because dB relative to a reference is
> fundamentally a signed quantity.  We're talking about how to encode a
> real number in a computer representation.  So the two choices are what
> degree of quantization and the range.  We now have fixed-point with
> 256 values, and that seems fine.  So therefore we can either have -128
> to +127 relative to a reference, or we can have +0 to +255.  With
> signed, the system is well behaved for any reasonable choice of
> reference.  With unsigned, the reference has to be below the minimum
> value that will ever happen or one gets wrapping.

In practice, choosing a reasonable reference will be easy.  One reads
the dB from a fixed-width hardware register, or a DMA descriptor, and
the minimum value is either zero (unsigned register) or -128 (signed),
-64, -32, ..., depending on the width of the register.

> 1 mW (used for dBm) is the standard reference level, and in my view an
> 'unspecified reference' is simply a way to say that the calibration to
> dBm is lame or unknown.

Lame or unknown is right.  My aim with radiotap has been to give a driver
developer a choice of fields, ranging from the perfectly vague to the
scientifically precise, with a vague field always preferred to a lying
field. :-)

> With a value that's actually in dBm, and the current DB_ANT encoding,
> I got values like 160 dB for noise and 220 dB for a strong signal.
> This is relative to -256 dBm, which is an odd choice.  And then values
> like +20 dBm can't be represented on the same scale.  Had this been
> signed, I would have obtained -96 and -46 dB, which would have been
> decent values for "uncalibrated dBm" in this case.

I understand and appreciate the principled argument you are making.  As a
practical matter, however, 20 dBm is an astonishingly high RSSI!  I figure
it is a value way higher than the hardware's descriptor/register can even
express.  I think of the _DB_ANT fields as holding raw, uncalibrated,
log-scale measurements from the hardware, whose range and reference is
set by the range of some hardware register, be it 5, 6, ..., or 8 bits
wide, signed or unsigned.

> I think my real point is that you shouldn't be forced to choose a
> reference point that's on the low end of all possible values.  With a
> signed representation and the notion that a reference closer to 1 mW
> is better, there's no grief.

Ok.  My point is that while you are forced to choose such a reference
point, it's easy. :-)


David Young             OJC Technologies      Urbana, IL * (217) 278-3933