svn commit: r293022 - head/sys/net80211

John Baldwin jhb at freebsd.org
Fri Jan 1 21:50:50 UTC 2016


On Friday, January 01, 2016 12:21:07 AM Adrian Chadd wrote:
> 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_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));

It would be better to use SBT_1MS instead with cv_timedwait_sbt().  Especially if
the 1 ms is fuzzy you can specify "how" fuzzy it is to permit coalescing of
timer interrupts to reduce power usage.  This would seem to be especially useful
for 802.11 since it is commonly used in devices for which power usage is more
impactful.

-- 
John Baldwin


More information about the svn-src-all mailing list