Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 01 Jan 2016 11:50:55 -0800
From:      John Baldwin <jhb@freebsd.org>
To:        Adrian Chadd <adrian@freebsd.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r293022 - head/sys/net80211
Message-ID:  <5919271.R3YaC4QkYh@ralph.baldwin.cx>
In-Reply-To: <201601010021.u010L7sW006625@repo.freebsd.org>
References:  <201601010021.u010L7sW006625@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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@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



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