svn commit: r293022 - head/sys/net80211
Adrian Chadd
adrian at FreeBSD.org
Fri Jan 1 00:21:08 UTC 2016
Author: adrian
Date: Fri Jan 1 00:21:07 2016
New Revision: 293022
URL: https://svnweb.freebsd.org/changeset/base/293022
Log:
[net80211] document the (not completely complete) set of places where
we're assuming hz=1000 and not gracefully handling when it isn't.
The math involved will return 0 for hz < 1000, which it is on some
platforms and on DragonflyBSD.
This doesn't fix it, it:
* converts one manual use over to use the macro, and
* comments where it needs some thought/fixing.
I'll think about this a bit more before fixing it.
Submitted by: imre at vdsz.com
Modified:
head/sys/net80211/ieee80211_freebsd.h
head/sys/net80211/ieee80211_scan_sw.c
head/sys/net80211/ieee80211_var.h
Modified: head/sys/net80211/ieee80211_freebsd.h
==============================================================================
--- head/sys/net80211/ieee80211_freebsd.h Fri Jan 1 00:16:54 2016 (r293021)
+++ head/sys/net80211/ieee80211_freebsd.h Fri Jan 1 00:21:07 2016 (r293022)
@@ -246,9 +246,11 @@ void ieee80211_vap_destroy(struct ieee80
(((_ifp)->if_flags & IFF_UP) && \
((_ifp)->if_drv_flags & IFF_DRV_RUNNING))
+/* XXX TODO: cap these at 1, as hz may not be 1000 */
#define msecs_to_ticks(ms) (((ms)*hz)/1000)
#define ticks_to_msecs(t) (1000*(t) / hz)
#define ticks_to_secs(t) ((t) / hz)
+
#define time_after(a,b) ((long)(b) - (long)(a) < 0)
#define time_before(a,b) time_after(b,a)
#define time_after_eq(a,b) ((long)(a) - (long)(b) >= 0)
Modified: head/sys/net80211/ieee80211_scan_sw.c
==============================================================================
--- head/sys/net80211/ieee80211_scan_sw.c Fri Jan 1 00:16:54 2016 (r293021)
+++ head/sys/net80211/ieee80211_scan_sw.c Fri Jan 1 00:21:07 2016 (r293022)
@@ -641,7 +641,7 @@ scan_task(void *arg, int pending)
* XXX Should use M_TXCB mechanism to eliminate this.
*/
cv_timedwait(&SCAN_PRIVATE(ss)->ss_scan_cv,
- IEEE80211_LOCK_OBJ(ic), hz / 1000);
+ IEEE80211_LOCK_OBJ(ic), msecs_to_ticks(1));
if (SCAN_PRIVATE(ss)->ss_iflags & ISCAN_ABORT)
goto done;
}
Modified: head/sys/net80211/ieee80211_var.h
==============================================================================
--- head/sys/net80211/ieee80211_var.h Fri Jan 1 00:16:54 2016 (r293021)
+++ head/sys/net80211/ieee80211_var.h Fri Jan 1 00:21:07 2016 (r293022)
@@ -84,6 +84,7 @@
#define IEEE80211_MS_TO_TU(x) (((x) * 1000) / 1024)
#define IEEE80211_TU_TO_MS(x) (((x) * 1024) / 1000)
+/* XXX TODO: cap this at 1, in case hz is not 1000 */
#define IEEE80211_TU_TO_TICKS(x)(((x) * 1024 * hz) / (1000 * 1000))
/*
More information about the svn-src-all
mailing list