From owner-svn-src-head@freebsd.org Fri Jan 1 00:21:08 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AE8D2A57ADB; Fri, 1 Jan 2016 00:21:08 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5F83A1509; Fri, 1 Jan 2016 00:21:08 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u010L7tJ006628; Fri, 1 Jan 2016 00:21:07 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u010L7sW006625; Fri, 1 Jan 2016 00:21:07 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201601010021.u010L7sW006625@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Fri, 1 Jan 2016 00:21:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293022 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jan 2016 00:21:08 -0000 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_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)) /*