Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Feb 2008 12:30:52 -0500
From:      "Barbieri, Paul  (US SSA)" <paul.barbieri@baesystems.com>
To:        <freebsd-net@freebsd.org>
Subject:   ieee80211 ms and tu convert macros
Message-ID:  <8DD841934E0E96429CC4470C23528CA10260B9CB@GLDMS00013.goldlnk.rootlnka.net>

next in thread | raw e-mail | index | archive | help
I happened to be looking in net80211/ieee80211_var.h and examined the
macros IEEE80211_MS_TO_TU and IEEE80211_TU_TO_MS. The conversions seem
backward to me. The macros are:

=20

#define IEEE80211_MS_TO_TU(x)          (((x) * 1000) / 1024)

#define IEEE80211_TU_TO_MS(x)          (((x) * 1024) / 1000)

=20

If I take the values:

            1 second =3D 1000 milliseconds (ms) =3D 1024 timer units =
(tu)

=20

When I convert 1000 ms, I should get 1024 tu but when I use the macro
IEEE80211_MS_TO_TU(1000), I get 976. The current definition yields (1000
* 1000) / 1024 =3D 976.=20

The macro should be:

=20

#define IEEE80211_MS_TO_TU(x)          (((x) * 1024) / 1000)

=20

This yields IEEE80211_MS_TO_TU(1000) =3D (1000 * 1024) / 1000 =3D 1024

=20

The other macro needs a similar change.

=20

Am I missing something, interpreting something incorrectly? Please let
me know.

=20

Paul




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8DD841934E0E96429CC4470C23528CA10260B9CB>