From: Sepherosa Ziehau Date: Mon, 5 Mar 2007 14:17:36 +0000 (+0000) Subject: Correct TU <-> millisecond and TU -> ticks convertion. X-Git-Tag: v2.0.1~3421 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/34b861deb40880a799407cb8afd7657692f0c8bb?hp=cf00283f06478470aafa8c05d1178ce40065b8ac Correct TU <-> millisecond and TU -> ticks convertion. --- diff --git a/sys/netproto/802_11/ieee80211_var.h b/sys/netproto/802_11/ieee80211_var.h index 6b1e25868f..f98c88d10e 100644 --- a/sys/netproto/802_11/ieee80211_var.h +++ b/sys/netproto/802_11/ieee80211_var.h @@ -30,7 +30,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/net80211/ieee80211_var.h,v 1.22.2.11 2006/03/13 03:05:48 sam Exp $ - * $DragonFly: src/sys/netproto/802_11/ieee80211_var.h,v 1.13 2007/03/04 13:09:15 sephe Exp $ + * $DragonFly: src/sys/netproto/802_11/ieee80211_var.h,v 1.14 2007/03/05 14:17:36 sephe Exp $ */ #ifndef _NET80211_IEEE80211_VAR_H_ #define _NET80211_IEEE80211_VAR_H_ @@ -83,9 +83,9 @@ #define IEEE80211_RTS_DEFAULT IEEE80211_RTS_MAX #define IEEE80211_FRAG_DEFAULT IEEE80211_FRAG_MAX -#define IEEE80211_MS_TO_TU(x) (((x) * 1024) / 1000) -#define IEEE80211_TU_TO_MS(x) (((x) * 1000) / 1024) -#define IEEE80211_TU_TO_TICKS(x)(((x) * hz) / 1024) +#define IEEE80211_MS_TO_TU(x) (((x) * 1000) / 1024) +#define IEEE80211_TU_TO_MS(x) (((x) * 1024) / 1000) +#define IEEE80211_TU_TO_TICKS(x)(((x) * 1024 * hz) / (1000 * 1000)) struct ieee80211_aclator; struct sysctl_ctx_list; diff --git a/sys/netproto/802_11/wlan/ieee80211_output.c b/sys/netproto/802_11/wlan/ieee80211_output.c index 5226bc34ed..88034ec693 100644 --- a/sys/netproto/802_11/wlan/ieee80211_output.c +++ b/sys/netproto/802_11/wlan/ieee80211_output.c @@ -30,7 +30,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/net80211/ieee80211_output.c,v 1.26.2.8 2006/09/02 15:06:04 sam Exp $ - * $DragonFly: src/sys/netproto/802_11/wlan/ieee80211_output.c,v 1.14 2007/03/04 07:52:36 sephe Exp $ + * $DragonFly: src/sys/netproto/802_11/wlan/ieee80211_output.c,v 1.15 2007/03/05 14:17:36 sephe Exp $ */ #include "opt_inet.h" @@ -1788,8 +1788,8 @@ ieee80211_pwrsave(struct ieee80211com *ic, struct ieee80211_node *ni, * Frames that sit around too long are reclaimed * using this information. */ - /* XXX handle overflow? */ - age = ((ni->ni_intval * ic->ic_bintval) << 2) / 1024; /* TU -> secs */ + /* TU -> secs. XXX handle overflow? */ + age = IEEE80211_TU_TO_MS((ni->ni_intval * ic->ic_bintval) << 2) / 1000; _IEEE80211_NODE_SAVEQ_ENQUEUE(ni, m, qlen, age); IEEE80211_DPRINTF(ic, IEEE80211_MSG_POWER,