From owner-svn-src-all@FreeBSD.ORG Sun Sep 4 05:04:35 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 25AE3106566B; Sun, 4 Sep 2011 05:04:35 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1552B8FC08; Sun, 4 Sep 2011 05:04:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8454YOL076307; Sun, 4 Sep 2011 05:04:34 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8454YKj076305; Sun, 4 Sep 2011 05:04:34 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201109040504.p8454YKj076305@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sun, 4 Sep 2011 05:04:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225371 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2011 05:04:35 -0000 Author: trasz Date: Sun Sep 4 05:04:34 2011 New Revision: 225371 URL: http://svn.freebsd.org/changeset/base/225371 Log: Since r224036 the cputime and wallclock are supposed to be in seconds, not microseconds. Make it so. Approved by: re (kib) Modified: head/sys/kern/kern_rctl.c Modified: head/sys/kern/kern_rctl.c ============================================================================== --- head/sys/kern/kern_rctl.c Sat Sep 3 21:28:26 2011 (r225370) +++ head/sys/kern/kern_rctl.c Sun Sep 4 05:04:34 2011 (r225371) @@ -908,7 +908,7 @@ rctl_string_to_rule(char *rulestr, struc if (error != 0) goto out; if (RACCT_IS_IN_MILLIONS(rule->rr_resource)) - rule->rr_amount *= 1000; + rule->rr_amount *= 1000000; } if (perstr == NULL || perstr[0] == '\0') @@ -1223,7 +1223,7 @@ rctl_racct_to_sbuf(struct racct *racct, continue; amount = racct->r_resources[i]; if (RACCT_IS_IN_MILLIONS(i)) - amount /= 1000; + amount /= 1000000; sbuf_printf(sb, "%s=%jd,", rctl_resource_name(i), amount); } sbuf_setpos(sb, sbuf_len(sb) - 1); From owner-svn-src-all@FreeBSD.ORG Sun Sep 4 13:07:02 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E998E1065672; Sun, 4 Sep 2011 13:07:02 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BB8408FC12; Sun, 4 Sep 2011 13:07:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p84D72Ft092464; Sun, 4 Sep 2011 13:07:02 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p84D72GY092462; Sun, 4 Sep 2011 13:07:02 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201109041307.p84D72GY092462@svn.freebsd.org> From: Attilio Rao Date: Sun, 4 Sep 2011 13:07:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225372 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2011 13:07:03 -0000 Author: attilio Date: Sun Sep 4 13:07:02 2011 New Revision: 225372 URL: http://svn.freebsd.org/changeset/base/225372 Log: Interrupts are disabled/enabled when entering and exiting the KDB context. While this is generally good, it brings along a serie of problems, like clocks going off sync and in presence of SW_WATCHDOG, watchdogs firing without a good reason (missed hardclock wdog ticks update). Fix the latter by kicking the watchdog just before to re-enable the interrupts. Also, while here, not rely on users to stop the watchdog manually when entering DDB but do that when entering KDB context. Sponsored by: Sandvine Incorporated Reviewed by: emaste, rstone Approved by: re (kib) MFC after: 1 week Modified: head/sys/kern/subr_kdb.c Modified: head/sys/kern/subr_kdb.c ============================================================================== --- head/sys/kern/subr_kdb.c Sun Sep 4 05:04:34 2011 (r225371) +++ head/sys/kern/subr_kdb.c Sun Sep 4 13:07:02 2011 (r225372) @@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$"); #include "opt_kdb.h" #include "opt_stack.h" +#include "opt_watchdog.h" #include #include @@ -41,6 +42,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef SW_WATCHDOG +#include +#endif #include #include @@ -587,6 +591,9 @@ kdb_trap(int type, int code, struct trap cpuset_t other_cpus; #endif struct kdb_dbbe *be; +#ifdef SW_WATCHDOG + u_int wdoglvt; +#endif register_t intr; int handled; @@ -600,6 +607,10 @@ kdb_trap(int type, int code, struct trap intr = intr_disable(); +#ifdef SW_WATCHDOG + wdoglvt = wdog_kern_last_timeout(); + wdog_kern_pat(WD_TO_NEVER); +#endif #ifdef SMP other_cpus = all_cpus; CPU_CLR(PCPU_GET(cpuid), &other_cpus); @@ -631,6 +642,9 @@ kdb_trap(int type, int code, struct trap #ifdef SMP restart_cpus(stopped_cpus); #endif +#ifdef SW_WATCHDOG + wdog_kern_pat(wdoglvt); +#endif intr_restore(intr); From owner-svn-src-all@FreeBSD.ORG Sun Sep 4 13:09:20 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1949A106564A; Sun, 4 Sep 2011 13:09:20 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id 5A3098FC18; Sun, 4 Sep 2011 13:09:18 +0000 (UTC) Received: by wwi36 with SMTP id 36so4354768wwi.31 for ; Sun, 04 Sep 2011 06:09:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; bh=54EOdp9jfQYXFaN8ncgEqSPVBp1epaEGlYjY0i4allY=; b=IfNs7bbygiYtHNEjP9fy/xmq+HYcxzhj+pwj2363R3bVzK8KSKfnaHeEfIYfeN/HOi VnyzofM0ws7hrnZAYQBJRas19YRNqq9l3HfhGJ6GAuVAQv4FoXoTH87JM49W0Z39XZPR tqjkDdBZxeIPgxMjMP5H4fG+/77/EjHGkMYsg= MIME-Version: 1.0 Received: by 10.227.72.200 with SMTP id n8mr2926324wbj.19.1315141757835; Sun, 04 Sep 2011 06:09:17 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.227.206.139 with HTTP; Sun, 4 Sep 2011 06:09:17 -0700 (PDT) In-Reply-To: <201109041307.p84D72GY092462@svn.freebsd.org> References: <201109041307.p84D72GY092462@svn.freebsd.org> Date: Sun, 4 Sep 2011 15:09:17 +0200 X-Google-Sender-Auth: NmWxJJfLRms7fZCeVnhH2nxTiBI Message-ID: From: Attilio Rao To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: Subject: Re: svn commit: r225372 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2011 13:09:20 -0000 2011/9/4 Attilio Rao : > Author: attilio > Date: Sun Sep =C2=A04 13:07:02 2011 > New Revision: 225372 > URL: http://svn.freebsd.org/changeset/base/225372 > > Log: > =C2=A0Interrupts are disabled/enabled when entering and exiting the KDB c= ontext. > =C2=A0While this is generally good, it brings along a serie of problems, > =C2=A0like clocks going off sync and in presence of SW_WATCHDOG, watchdog= s > =C2=A0firing without a good reason (missed hardclock wdog ticks update). Also please notice that intr enable/disable happens in the wrong way as it is done via the MD (x86 specific likely) interface. This is wrong for 2 reasons: 1) There may be some codepaths leading to explicit preemption 2) It should really use an MI interface The right way to do this should be via spinlock_enter(). Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-all@FreeBSD.ORG Sun Sep 4 14:28:06 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 99B001065670; Sun, 4 Sep 2011 14:28:06 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 882258FC0C; Sun, 4 Sep 2011 14:28:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p84ES6bu094919; Sun, 4 Sep 2011 14:28:06 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p84ES6wS094916; Sun, 4 Sep 2011 14:28:06 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201109041428.p84ES6wS094916@svn.freebsd.org> From: Christian Brueffer Date: Sun, 4 Sep 2011 14:28:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225374 - stable/8/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2011 14:28:06 -0000 Author: brueffer Date: Sun Sep 4 14:28:06 2011 New Revision: 225374 URL: http://svn.freebsd.org/changeset/base/225374 Log: MFC: r225228 Remove broken link to supported wifi cards. There doesn't appear to be an equivalent list anywhere else. Modified: stable/8/share/man/man4/ath.4 stable/8/share/man/man4/ath_hal.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/ath.4 ============================================================================== --- stable/8/share/man/man4/ath.4 Sun Sep 4 14:09:59 2011 (r225373) +++ stable/8/share/man/man4/ath.4 Sun Sep 4 14:28:06 2011 (r225374) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\"/ -.Dd July 8, 2009 +.Dd August 28, 2011 .Dt ATH 4 .Os .Sh NAME @@ -141,9 +141,6 @@ The .Nm driver supports all Atheros Cardbus and PCI cards, except those that are based on the AR5005VL chipset. -.Pp -A list of cards that are supported can be found at -.Pa http://customerproducts.atheros.com/customerproducts/default.asp . .Sh EXAMPLES Join an existing BSS network (ie: connect to an access point): .Pp Modified: stable/8/share/man/man4/ath_hal.4 ============================================================================== --- stable/8/share/man/man4/ath_hal.4 Sun Sep 4 14:09:59 2011 (r225373) +++ stable/8/share/man/man4/ath_hal.4 Sun Sep 4 14:28:06 2011 (r225374) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\"/ -.Dd March 25, 2009 +.Dd August 28, 2011 .Dt ATH_HAL 4 .Os .Sh NAME @@ -124,9 +124,6 @@ module: .It "Sony PCWA-C500 AR5210 Cardbus a" .It "3Com 3CRPAG175 AR5212 CardBus a/b/g" .El -.Pp -An up to date list can be found at -.Pa http://customerproducts.atheros.com/customerproducts . .Sh SEE ALSO .Xr ath 4 .Sh HISTORY From owner-svn-src-all@FreeBSD.ORG Sun Sep 4 14:30:22 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BF1F3106566B; Sun, 4 Sep 2011 14:30:22 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ADB648FC15; Sun, 4 Sep 2011 14:30:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p84EUM06095038; Sun, 4 Sep 2011 14:30:22 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p84EUMsT095035; Sun, 4 Sep 2011 14:30:22 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201109041430.p84EUMsT095035@svn.freebsd.org> From: Christian Brueffer Date: Sun, 4 Sep 2011 14:30:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225375 - stable/7/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2011 14:30:22 -0000 Author: brueffer Date: Sun Sep 4 14:30:22 2011 New Revision: 225375 URL: http://svn.freebsd.org/changeset/base/225375 Log: MFC: r225228 Remove broken link to supported wifi cards. There doesn't appear to be an equivalent list anywhere else. Modified: stable/7/share/man/man4/ath.4 stable/7/share/man/man4/ath_hal.4 Directory Properties: stable/7/share/man/man4/ (props changed) Modified: stable/7/share/man/man4/ath.4 ============================================================================== --- stable/7/share/man/man4/ath.4 Sun Sep 4 14:28:06 2011 (r225374) +++ stable/7/share/man/man4/ath.4 Sun Sep 4 14:30:22 2011 (r225375) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\"/ -.Dd December 7, 2006 +.Dd August 28, 2011 .Dt ATH 4 .Os .Sh NAME @@ -129,9 +129,6 @@ The .Nm driver supports all Atheros Cardbus or PCI cards, except those that are based on the AR5005VL chipset. -.Pp -A list of cards that are supported can be found at -.Pa http://customerproducts.atheros.com/customerproducts/default.asp . .Sh EXAMPLES Join an existing BSS network (ie: connect to an access point): .Pp Modified: stable/7/share/man/man4/ath_hal.4 ============================================================================== --- stable/7/share/man/man4/ath_hal.4 Sun Sep 4 14:28:06 2011 (r225374) +++ stable/7/share/man/man4/ath_hal.4 Sun Sep 4 14:30:22 2011 (r225375) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\"/ -.Dd August 26, 2004 +.Dd August 28, 2011 .Dt ATH_HAL 4 .Os .Sh NAME @@ -97,9 +97,6 @@ module: .It "Sony PCWA-C500 AR5210 Cardbus a" .It "3Com 3CRPAG175 AR5212 CardBus a/b/g" .El -.Pp -An up to date list can be found at -.Pa http://customerproducts.atheros.com/customerproducts . .Sh SEE ALSO .Xr ath 4 .Sh HISTORY From owner-svn-src-all@FreeBSD.ORG Sun Sep 4 18:04:34 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 276D01065670; Sun, 4 Sep 2011 18:04:34 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail10.syd.optusnet.com.au (mail10.syd.optusnet.com.au [211.29.132.191]) by mx1.freebsd.org (Postfix) with ESMTP id AF0FC8FC1B; Sun, 4 Sep 2011 18:04:33 +0000 (UTC) Received: from c122-106-165-191.carlnfd1.nsw.optusnet.com.au (c122-106-165-191.carlnfd1.nsw.optusnet.com.au [122.106.165.191]) by mail10.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p84I4Ps6008983 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 5 Sep 2011 04:04:30 +1000 Date: Mon, 5 Sep 2011 04:04:18 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Attilio Rao In-Reply-To: Message-ID: <20110905023251.C832@besplex.bde.org> References: <201109041307.p84D72GY092462@svn.freebsd.org> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-1840991722-1315159458=:832" Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r225372 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2011 18:04:34 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-1840991722-1315159458=:832 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Sun, 4 Sep 2011, Attilio Rao wrote: >> Log: >> =C2=A0Interrupts are disabled/enabled when entering and exiting the KDB = context. >> =C2=A0While this is generally good, it brings along a serie of problems, >> =C2=A0like clocks going off sync and in presence of SW_WATCHDOG, watchdo= gs >> =C2=A0firing without a good reason (missed hardclock wdog ticks update). Please fix your mailer. It corrupts spaces to binary data \xc2\xa0. My version resets the timecounter 3 seconds after leaving ddb (not immediately, to avoid setting it thousands or millions of times per second for trace traps and possibly making it drift a few usec every time (I get a drift of ~ 1 usec per second stopped)). In fact, I don't see how anyone can use ddb without this. When running current, I have to remember to stop ntpd before running ddb so that ntpd doesn't corrupt its database (just the driftfile and logs). > Also please notice that intr enable/disable happens in the wrong way > as it is done via the MD (x86 specific likely) interface. This is > wrong for 2 reasons: No, intr_disable() is MI. It is also used by witness. disable_intr() is the corresponding x86 interface that you may be thinking of. The MI interface intr_disable() was introduced to avoid the MD'ness of intr_disable(). > 1) There may be some codepaths leading to explicit preemption > 2) It should really use an MI interface > > The right way to do this should be via spinlock_enter(). spinlock_enter() is MI, but has wrong semantics. In my version of i386, spinlocks don't disable any h/w interrupt, as is needed for fast interrupt handlers to actually work. I believe sparc64 is similar, except its spinlock_enter() disables most h/w interrupts and this includes fast interrupt handlers. I don't understand sparc64, but it looks like its spinlock_enter() disables all interrupts visible in C code, but not all interrupts: from cpufunc.h: % static __inline register_t % intr_disable(void) % { % =09register_t s; %=20 % =09s =3D rdpr(pstate); % =09wrpr(pstate, s & ~PSTATE_IE, 0); % =09return (s); % } This seems to mask all interrupts, as required. (The interface here is slightly broken (non-MI). It returns register_= t. This assumes that the interrupt state can be represented in a single register. The type critical_t exists to avoid the same bug in an old version of critical_enter(). Now this type is just bogus. critical_enter() no longer returns it. Instead, spinlock_enter() uses a non-reentrant interface which stores what used to be the return valu= e of critical_enter() in a per-thread MD data structure (md_saved_pil in the above). Most or all arches use register_t for this. This leaves critical_t as pure garbage -- the only remaining references to it are for its definition.) From=20machep.c: % void % spinlock_enter(void) % { % =09struct thread *td; % =09register_t pil; %=20 % =09td =3D curthread; % =09if (td->td_md.md_spinlock_count =3D=3D 0) { % =09=09pil =3D rdpr(pil); % =09=09wrpr(pil, 0, PIL_TICK); % =09=09td->td_md.md_spinlock_count =3D 1; % =09=09td->td_md.md_saved_pil =3D pil; % =09} else % =09=09td->td_md.md_spinlock_count++; % =09critical_enter(); % } I believe this disables all interrupts at and below a certain level. From=20intr_machdep.h: % #define=09PIL_LOW=09=091=09/* stray interrupts */ % #define=09PIL_ITHREAD=092=09/* interrupts that use ithreads */ % #define=09PIL_RENDEZVOUS=093=09/* smp rendezvous ipi */ % #define=09PIL_AST=09=094=09/* ast ipi */ % #define=09PIL_STOP=095=09/* stop cpu ipi */ % #define=09PIL_PREEMPT=096=09/* preempt idle thread cpu ipi */ % #define=09PIL_HARDCLOCK=097=09/* hardclock broadcast */ % #define=09PIL_FILTER=0912=09/* filter interrupts */ % #define=09PIL_BRIDGE=0913=09/* bridge interrupts */ % #define=09PIL_TICK=0914=09/* tick interrupts */ And this level includes all interrupts that have a level, including tick interrupts. In my version of x86, spinlocks mask everything except the equivalent of filter interrupts (=3D non-broken fast interrupts in my version).=20 Non-broken fast-interrupt handlers have to be written very carefully to be reentrant. Since full reentrancy is too hard, they must run with _all_ h/w interrupts disabled. kdb needs all h/w interrupts disabled for similar reasons. It cannot even call things like spinlock_enter() without knowing too much about their internals. In fact, the non-reentrant state for spinlock_enter() and/or critical _enter() was a reliable cause of panics for many years even when it was accessed externally near kdb -- tracing through these functions often paniced. Below the filter level is a much higher level than sparc64. I think the interrupts not masked at PIL_TICK are mostly handled in asm, which I am further from understanding. Anyway, this is all at a low level for sparc64. Higher levels just need to use the correct interface to disable all interrupts. That is disable_intr(), not spinlock_enter(). Bruce --0-1840991722-1315159458=:832-- From owner-svn-src-all@FreeBSD.ORG Sun Sep 4 22:06:32 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C4D331065672; Sun, 4 Sep 2011 22:06:32 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9AC418FC08; Sun, 4 Sep 2011 22:06:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p84M6WHE008869; Sun, 4 Sep 2011 22:06:32 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p84M6W8e008867; Sun, 4 Sep 2011 22:06:32 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <201109042206.p84M6W8e008867@svn.freebsd.org> From: Andrew Thompson Date: Sun, 4 Sep 2011 22:06:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225380 - head/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Sep 2011 22:06:32 -0000 Author: thompsa Date: Sun Sep 4 22:06:32 2011 New Revision: 225380 URL: http://svn.freebsd.org/changeset/base/225380 Log: On the first loop for generating a bridge MAC address use the local hostid, this gives a good chance of keeping the same address over reboots. This is intended to help IPV6 and similar which generate their addresses from the mac. PR: kern/160300 Submitted by: mdodd Approved by: re (kib) Modified: head/sys/net/if_bridge.c Modified: head/sys/net/if_bridge.c ============================================================================== --- head/sys/net/if_bridge.c Sun Sep 4 16:26:43 2011 (r225379) +++ head/sys/net/if_bridge.c Sun Sep 4 22:06:32 2011 (r225380) @@ -85,6 +85,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include /* for net/if.h */ #include @@ -560,7 +561,8 @@ bridge_clone_create(struct if_clone *ifc { struct bridge_softc *sc, *sc2; struct ifnet *bifp, *ifp; - int retry; + int fb, retry; + unsigned long hostid; sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_ZERO); ifp = sc->sc_ifp = if_alloc(IFT_ETHER); @@ -593,17 +595,30 @@ bridge_clone_create(struct if_clone *ifc IFQ_SET_READY(&ifp->if_snd); /* - * Generate a random ethernet address with a locally administered - * address. + * Generate an ethernet address with a locally administered address. * * Since we are using random ethernet addresses for the bridge, it is * possible that we might have address collisions, so make sure that * this hardware address isn't already in use on another bridge. + * The first try uses the hostid and falls back to arc4rand(). */ + fb = 0; + getcredhostid(curthread->td_ucred, &hostid); for (retry = 1; retry != 0;) { - arc4rand(sc->sc_defaddr, ETHER_ADDR_LEN, 1); - sc->sc_defaddr[0] &= ~1; /* clear multicast bit */ - sc->sc_defaddr[0] |= 2; /* set the LAA bit */ + if (fb || hostid == 0) { + arc4rand(sc->sc_defaddr, ETHER_ADDR_LEN, 1); + sc->sc_defaddr[0] &= ~1;/* clear multicast bit */ + sc->sc_defaddr[0] |= 2; /* set the LAA bit */ + } else { + sc->sc_defaddr[0] = 0x2; + sc->sc_defaddr[1] = (hostid >> 24) & 0xff; + sc->sc_defaddr[2] = (hostid >> 16) & 0xff; + sc->sc_defaddr[3] = (hostid >> 8 ) & 0xff; + sc->sc_defaddr[4] = hostid & 0xff; + sc->sc_defaddr[5] = ifp->if_dunit & 0xff; + } + + fb = 1; retry = 0; mtx_lock(&bridge_list_mtx); LIST_FOREACH(sc2, &bridge_list, sc_list) { From owner-svn-src-all@FreeBSD.ORG Mon Sep 5 06:54:13 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E22F9106566B; Mon, 5 Sep 2011 06:54:13 +0000 (UTC) (envelope-from art@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D096B8FC0C; Mon, 5 Sep 2011 06:54:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p856sDsd024757; Mon, 5 Sep 2011 06:54:13 GMT (envelope-from art@svn.freebsd.org) Received: (from art@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p856sDJG024755; Mon, 5 Sep 2011 06:54:13 GMT (envelope-from art@svn.freebsd.org) Message-Id: <201109050654.p856sDJG024755@svn.freebsd.org> From: Artem Belevich Date: Mon, 5 Sep 2011 06:54:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225384 - stable/8/sys/rpc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Sep 2011 06:54:14 -0000 Author: art Date: Mon Sep 5 06:54:13 2011 New Revision: 225384 URL: http://svn.freebsd.org/changeset/base/225384 Log: MFC r225234: Make sure RPC calls over UDP return RPC_INTR status if the process has been interrupted in a restartable syscall. Otherwise we could end up in an (almost) endless loop in clnt_reconnect_call(). PR: kern/160198 Reviewed by: rmacklem Approved by: avg (mentor) Modified: stable/8/sys/rpc/clnt_dg.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/rpc/clnt_dg.c ============================================================================== --- stable/8/sys/rpc/clnt_dg.c Mon Sep 5 06:11:17 2011 (r225383) +++ stable/8/sys/rpc/clnt_dg.c Mon Sep 5 06:54:13 2011 (r225384) @@ -467,7 +467,10 @@ send_again: cu->cu_waitflag, "rpccwnd", 0); if (error) { errp->re_errno = error; - errp->re_status = stat = RPC_CANTSEND; + if (error == EINTR || error == ERESTART) + errp->re_status = stat = RPC_INTR; + else + errp->re_status = stat = RPC_CANTSEND; goto out; } } @@ -636,7 +639,7 @@ get_reply: */ if (error != EWOULDBLOCK) { errp->re_errno = error; - if (error == EINTR) + if (error == EINTR || error == ERESTART) errp->re_status = stat = RPC_INTR; else errp->re_status = stat = RPC_CANTRECV; From owner-svn-src-all@FreeBSD.ORG Mon Sep 5 07:57:56 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A691E106564A; Mon, 5 Sep 2011 07:57:56 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9443C8FC13; Mon, 5 Sep 2011 07:57:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p857vuND026762; Mon, 5 Sep 2011 07:57:56 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p857vuFX026760; Mon, 5 Sep 2011 07:57:56 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201109050757.p857vuFX026760@svn.freebsd.org> From: Sergey Kandaurov Date: Mon, 5 Sep 2011 07:57:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225386 - stable/8/lib/libmemstat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Sep 2011 07:57:56 -0000 Author: pluknet Date: Mon Sep 5 07:57:56 2011 New Revision: 225386 URL: http://svn.freebsd.org/changeset/base/225386 Log: MFC r225330: Cosmetic cleanup: remove unused #define LIBMEMSTAT Modified: stable/8/lib/libmemstat/memstat_uma.c Directory Properties: stable/8/lib/libmemstat/ (props changed) Modified: stable/8/lib/libmemstat/memstat_uma.c ============================================================================== --- stable/8/lib/libmemstat/memstat_uma.c Mon Sep 5 07:36:16 2011 (r225385) +++ stable/8/lib/libmemstat/memstat_uma.c Mon Sep 5 07:57:56 2011 (r225386) @@ -29,7 +29,6 @@ #include #include -#define LIBMEMSTAT /* Cause vm_page.h not to include opt_vmpage.h */ #include #include From owner-svn-src-all@FreeBSD.ORG Mon Sep 5 07:59:23 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C9960106566C; Mon, 5 Sep 2011 07:59:23 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B79528FC15; Mon, 5 Sep 2011 07:59:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p857xN1i026852; Mon, 5 Sep 2011 07:59:23 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p857xNZv026850; Mon, 5 Sep 2011 07:59:23 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201109050759.p857xNZv026850@svn.freebsd.org> From: Sergey Kandaurov Date: Mon, 5 Sep 2011 07:59:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225387 - stable/7/lib/libmemstat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Sep 2011 07:59:23 -0000 Author: pluknet Date: Mon Sep 5 07:59:23 2011 New Revision: 225387 URL: http://svn.freebsd.org/changeset/base/225387 Log: MFC r225330: Cosmetic cleanup: remove unused #define LIBMEMSTAT Modified: stable/7/lib/libmemstat/memstat_uma.c Directory Properties: stable/7/lib/libmemstat/ (props changed) Modified: stable/7/lib/libmemstat/memstat_uma.c ============================================================================== --- stable/7/lib/libmemstat/memstat_uma.c Mon Sep 5 07:57:56 2011 (r225386) +++ stable/7/lib/libmemstat/memstat_uma.c Mon Sep 5 07:59:23 2011 (r225387) @@ -29,7 +29,6 @@ #include #include -#define LIBMEMSTAT /* Cause vm_page.h not to include opt_vmpage.h */ #include #include From owner-svn-src-all@FreeBSD.ORG Mon Sep 5 08:41:57 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C9104106564A; Mon, 5 Sep 2011 08:41:57 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B6F0A8FC17; Mon, 5 Sep 2011 08:41:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p858fvKl028201; Mon, 5 Sep 2011 08:41:57 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p858fv66028200; Mon, 5 Sep 2011 08:41:57 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201109050841.p858fv66028200@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 5 Sep 2011 08:41:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225388 - stable/8/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Sep 2011 08:41:57 -0000 Author: kib Date: Mon Sep 5 08:41:57 2011 New Revision: 225388 URL: http://svn.freebsd.org/changeset/base/225388 Log: MFC r225076: Apply the limit to avoid the overflows in the radix tree subr_blist.c after the conversion of the swap device size to the page size units, not before. Modified: stable/8/sys/vm/swap_pager.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/vm/swap_pager.c ============================================================================== --- stable/8/sys/vm/swap_pager.c Mon Sep 5 07:59:23 2011 (r225387) +++ stable/8/sys/vm/swap_pager.c Mon Sep 5 08:41:57 2011 (r225388) @@ -2083,16 +2083,6 @@ swaponsomething(struct vnode *vp, void * u_long mblocks; /* - * If we go beyond this, we get overflows in the radix - * tree bitmap code. - */ - mblocks = 0x40000000 / BLIST_META_RADIX; - if (nblks > mblocks) { - printf("WARNING: reducing size to maximum of %lu blocks per swap unit\n", - mblocks); - nblks = mblocks; - } - /* * nblks is in DEV_BSIZE'd chunks, convert to PAGE_SIZE'd chunks. * First chop nblks off to page-align it, then convert. * @@ -2101,6 +2091,18 @@ swaponsomething(struct vnode *vp, void * nblks &= ~(ctodb(1) - 1); nblks = dbtoc(nblks); + /* + * If we go beyond this, we get overflows in the radix + * tree bitmap code. + */ + mblocks = 0x40000000 / BLIST_META_RADIX; + if (nblks > mblocks) { + printf( + "WARNING: reducing swap size to maximum of %luMB per unit\n", + mblocks / 1024 / 1024 * PAGE_SIZE); + nblks = mblocks; + } + sp = malloc(sizeof *sp, M_VMPGDATA, M_WAITOK | M_ZERO); sp->sw_vp = vp; sp->sw_id = id; From owner-svn-src-all@FreeBSD.ORG Mon Sep 5 09:49:28 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6ADB7106566C; Mon, 5 Sep 2011 09:49:28 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 57A188FC0C; Mon, 5 Sep 2011 09:49:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p859nSNB030383; Mon, 5 Sep 2011 09:49:28 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p859nSf4030373; Mon, 5 Sep 2011 09:49:28 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201109050949.p859nSf4030373@svn.freebsd.org> From: Martin Matuska Date: Mon, 5 Sep 2011 09:49:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225392 - in stable/8/lib/libarchive: . test X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Sep 2011 09:49:28 -0000 Author: mm Date: Mon Sep 5 09:49:28 2011 New Revision: 225392 URL: http://svn.freebsd.org/changeset/base/225392 Log: MFC r225167, r225329: MFC r225167: Import bugfix for reading and extracting of FreeBSD ISO images with tar. Vendor revision 3645 (merge of 3642): Change the mechanism handling a rr_moved directory, which is Rockridge extension that can exceed the limitation of a maximum directory depth of ISO 9660. - Stop reading all entries at a time. - Connect "CL" entry to "RE" entry dynamically, which "CL" and "RE" have information to rebuild a full directory tree. - Tweak some related tests since we use Headsort for re-ordering entries and it cannot make a steady order when the keies of the entries are the same. http://code.google.com/p/libarchive/issues/detail?id=168 MFC r225329: Import additional bugfix for reading and extracting makefs-created ISO images with tar. Vendor revision 3648 (merge of 3647): Additional fix to issue 168 because the change of r3642 was not sufficient. - Make sure "CL" entry appear after its "RE" entry which the "CL" entry should be connected with. - Give consideration to the case that the top level "RE" entry has already been exposed outside before its tree. Obtained from: libarchive (release/2.8, svn rev 3645, 3648) Added: stable/8/lib/libarchive/test/test_read_format_iso_2.iso.Z.uu - copied unchanged from r225167, head/lib/libarchive/test/test_read_format_iso_2.iso.Z.uu Modified: stable/8/lib/libarchive/archive_read_support_format_iso9660.c stable/8/lib/libarchive/test/test_read_format_iso_gz.c stable/8/lib/libarchive/test/test_read_format_isojoliet_bz2.c stable/8/lib/libarchive/test/test_read_format_isojoliet_long.c stable/8/lib/libarchive/test/test_read_format_isojoliet_rr.c stable/8/lib/libarchive/test/test_read_format_isorr_bz2.c stable/8/lib/libarchive/test/test_read_format_isorr_new_bz2.c stable/8/lib/libarchive/test/test_read_format_isozisofs_bz2.c Directory Properties: stable/8/lib/libarchive/ (props changed) Modified: stable/8/lib/libarchive/archive_read_support_format_iso9660.c ============================================================================== --- stable/8/lib/libarchive/archive_read_support_format_iso9660.c Mon Sep 5 09:39:35 2011 (r225391) +++ stable/8/lib/libarchive/archive_read_support_format_iso9660.c Mon Sep 5 09:49:28 2011 (r225392) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2003-2007 Tim Kientzle * Copyright (c) 2009 Andreas Henriksson - * Copyright (c) 2009 Michihiro NAKAJIMA + * Copyright (c) 2009-2011 Michihiro NAKAJIMA * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -261,13 +261,17 @@ struct file_info { struct file_info *use_next; struct file_info *parent; struct file_info *next; + struct file_info *re_next; int subdirs; uint64_t key; /* Heap Key. */ uint64_t offset; /* Offset on disk. */ uint64_t size; /* File size in bytes. */ uint32_t ce_offset; /* Offset of CE. */ uint32_t ce_size; /* Size of CE. */ + char rr_moved; /* Flag to rr_moved. */ + char rr_moved_has_re_only; char re; /* Having RRIP "RE" extension. */ + char re_descendant; uint64_t cl_offset; /* Having RRIP "CL" extension. */ int birthtime_is_set; time_t birthtime; /* File created time. */ @@ -294,7 +298,10 @@ struct file_info { struct content *first; struct content **last; } contents; - char exposed; + struct { + struct file_info *first; + struct file_info **last; + } rede_files; }; struct heap_queue { @@ -317,8 +324,6 @@ struct iso9660 { unsigned char suspOffset; struct file_info *rr_moved; - struct heap_queue re_dirs; - struct heap_queue cl_files; struct read_ce_queue { struct read_ce_req { uint64_t offset;/* Offset of CE on disk. */ @@ -337,6 +342,10 @@ struct iso9660 { struct file_info *first; struct file_info **last; } cache_files; + struct { + struct file_info *first; + struct file_info **last; + } re_files; uint64_t current_position; ssize_t logical_block_size; @@ -377,7 +386,8 @@ static int isJolietSVD(struct iso9660 *, static int isSVD(struct iso9660 *, const unsigned char *); static int isEVD(struct iso9660 *, const unsigned char *); static int isPVD(struct iso9660 *, const unsigned char *); -static struct file_info *next_cache_entry(struct iso9660 *iso9660); +static int next_cache_entry(struct archive_read *, struct iso9660 *, + struct file_info **); static int next_entry_seek(struct archive_read *a, struct iso9660 *iso9660, struct file_info **pfile); static struct file_info * @@ -400,10 +410,12 @@ static void parse_rockridge_ZF1(struct f static void register_file(struct iso9660 *, struct file_info *); static void release_files(struct iso9660 *); static unsigned toi(const void *p, int n); +static inline void re_add_entry(struct iso9660 *, struct file_info *); +static inline struct file_info * re_get_entry(struct iso9660 *); +static inline int rede_add_entry(struct file_info *); +static inline struct file_info * rede_get_entry(struct file_info *); static inline void cache_add_entry(struct iso9660 *iso9660, struct file_info *file); -static inline void cache_add_to_next_of_parent(struct iso9660 *iso9660, - struct file_info *file); static inline struct file_info *cache_get_entry(struct iso9660 *iso9660); static void heap_add_entry(struct heap_queue *heap, struct file_info *file, uint64_t key); @@ -430,6 +442,8 @@ archive_read_support_format_iso9660(stru iso9660->magic = ISO9660_MAGIC; iso9660->cache_files.first = NULL; iso9660->cache_files.last = &(iso9660->cache_files.first); + iso9660->re_files.first = NULL; + iso9660->re_files.last = &(iso9660->re_files.first); /* Enable to support Joliet extensions by default. */ iso9660->opt_support_joliet = 1; /* Enable to support Rock Ridge extensions by default. */ @@ -975,42 +989,38 @@ read_children(struct archive_read *a, st child = parse_file_info(a, parent, p); if (child == NULL) return (ARCHIVE_FATAL); - if (child->cl_offset) - heap_add_entry(&(iso9660->cl_files), - child, child->cl_offset); - else { - if (child->multi_extent || multi != NULL) { - struct content *con; - - if (multi == NULL) { - multi = child; - multi->contents.first = NULL; - multi->contents.last = - &(multi->contents.first); - } - con = malloc(sizeof(struct content)); - if (con == NULL) { - archive_set_error( - &a->archive, ENOMEM, - "No memory for " - "multi extent"); - return (ARCHIVE_FATAL); - } - con->offset = child->offset; - con->size = child->size; - con->next = NULL; - *multi->contents.last = con; - multi->contents.last = &(con->next); - if (multi == child) - add_entry(iso9660, child); - else { - multi->size += child->size; - if (!child->multi_extent) - multi = NULL; - } - } else + if (child->cl_offset == 0 && + (child->multi_extent || multi != NULL)) { + struct content *con; + + if (multi == NULL) { + multi = child; + multi->contents.first = NULL; + multi->contents.last = + &(multi->contents.first); + } + con = malloc(sizeof(struct content)); + if (con == NULL) { + archive_set_error( + &a->archive, ENOMEM, + "No memory for " + "multi extent"); + return (ARCHIVE_FATAL); + } + con->offset = child->offset; + con->size = child->size; + con->next = NULL; + *multi->contents.last = con; + multi->contents.last = &(con->next); + if (multi == child) add_entry(iso9660, child); - } + else { + multi->size += child->size; + if (!child->multi_extent) + multi = NULL; + } + } else + add_entry(iso9660, child); } } @@ -1022,102 +1032,12 @@ read_children(struct archive_read *a, st } static int -relocate_dir(struct iso9660 *iso9660, struct file_info *file) -{ - struct file_info *re; - - re = heap_get_entry(&(iso9660->re_dirs)); - while (re != NULL && re->offset < file->cl_offset) { - /* This case is wrong pattern. - * But dont't reject this directory entry to be robust. */ - cache_add_entry(iso9660, re); - re = heap_get_entry(&(iso9660->re_dirs)); - } - if (re == NULL) - /* This case is wrong pattern. */ - return (0); - if (re->offset == file->cl_offset) { - re->parent->subdirs--; - re->parent = file->parent; - re->parent->subdirs++; - cache_add_to_next_of_parent(iso9660, re); - return (1); - } else - /* This case is wrong pattern. */ - heap_add_entry(&(iso9660->re_dirs), re, re->offset); - return (0); -} - -static int -read_entries(struct archive_read *a) -{ - struct iso9660 *iso9660; - struct file_info *file; - int r; - - iso9660 = (struct iso9660 *)(a->format->data); - - while ((file = next_entry(iso9660)) != NULL && - (file->mode & AE_IFMT) == AE_IFDIR) { - r = read_children(a, file); - if (r != ARCHIVE_OK) - return (r); - - if (iso9660->seenRockridge && - file->parent != NULL && - file->parent->parent == NULL && - iso9660->rr_moved == NULL && - (strcmp(file->name.s, "rr_moved") == 0 || - strcmp(file->name.s, ".rr_moved") == 0)) { - iso9660->rr_moved = file; - } else if (file->re) - heap_add_entry(&(iso9660->re_dirs), file, - file->offset); - else - cache_add_entry(iso9660, file); - } - if (file != NULL) - add_entry(iso9660, file); - - if (iso9660->rr_moved != NULL) { - /* - * Relocate directory which rr_moved has. - */ - while ((file = heap_get_entry(&(iso9660->cl_files))) != NULL) - relocate_dir(iso9660, file); - - /* If rr_moved directory still has children, - * Add rr_moved into pending_files to show - */ - if (iso9660->rr_moved->subdirs) { - cache_add_entry(iso9660, iso9660->rr_moved); - /* If entries which have "RE" extension are still - * remaining(this case is unlikely except ISO image - * is broken), the entries won't be exposed. */ - while ((file = heap_get_entry(&(iso9660->re_dirs))) != NULL) - cache_add_entry(iso9660, file); - } else - iso9660->rr_moved->parent->subdirs--; - } else { - /* - * In case ISO image is broken. If the name of rr_moved - * directory has been changed by damage, subdirectories - * of rr_moved entry won't be exposed. - */ - while ((file = heap_get_entry(&(iso9660->re_dirs))) != NULL) - cache_add_entry(iso9660, file); - } - - return (ARCHIVE_OK); -} - -static int archive_read_format_iso9660_read_header(struct archive_read *a, struct archive_entry *entry) { struct iso9660 *iso9660; struct file_info *file; - int r, rd_r; + int r, rd_r = ARCHIVE_OK; iso9660 = (struct iso9660 *)(a->format->data); @@ -1207,11 +1127,7 @@ archive_read_format_iso9660_read_header( a->archive.archive_format_name = "ISO9660 with Rockridge extensions"; } - rd_r = read_entries(a); - if (rd_r == ARCHIVE_FATAL) - return (ARCHIVE_FATAL); - } else - rd_r = ARCHIVE_OK; + } /* Get the next entry that appears after the current offset. */ r = next_entry_seek(a, iso9660, &file); @@ -1324,7 +1240,6 @@ archive_read_format_iso9660_read_header( /* Directory data has been read completely. */ iso9660->entry_bytes_remaining = 0; iso9660->entry_sparse_offset = 0; - file->exposed = 1; } if (rd_r != ARCHIVE_OK) @@ -1651,10 +1566,6 @@ archive_read_format_iso9660_cleanup(stru archive_string_free(&iso9660->previous_pathname); if (iso9660->pending_files.files) free(iso9660->pending_files.files); - if (iso9660->re_dirs.files) - free(iso9660->re_dirs.files); - if (iso9660->cl_files.files) - free(iso9660->cl_files.files); #ifdef HAVE_ZLIB_H free(iso9660->entry_zisofs.uncompressed_buffer); free(iso9660->entry_zisofs.block_pointers); @@ -1735,6 +1646,8 @@ parse_file_info(struct archive_read *a, file->size = fsize; file->mtime = isodate7(isodirrec + DR_date_offset); file->ctime = file->atime = file->mtime; + file->rede_files.first = NULL; + file->rede_files.last = &(file->rede_files.first); p = isodirrec + DR_name_offset; /* Rockridge extensions (if any) follow name. Compute this @@ -1873,9 +1786,43 @@ parse_file_info(struct archive_read *a, file->nlinks = 1;/* Reset nlink. we'll calculate it later. */ /* Tell file's parent how many children that parent has. */ - if (parent != NULL && (flags & 0x02) && file->cl_offset == 0) + if (parent != NULL && (flags & 0x02)) parent->subdirs++; + if (iso9660->seenRockridge) { + if (parent != NULL && parent->parent == NULL && + (flags & 0x02) && iso9660->rr_moved == NULL && + (strcmp(file->name.s, "rr_moved") == 0 || + strcmp(file->name.s, ".rr_moved") == 0)) { + iso9660->rr_moved = file; + file->rr_moved = 1; + file->rr_moved_has_re_only = 1; + file->re = 0; + parent->subdirs--; + } else if (file->re) { + /* This file's parent is not rr_moved, clear invalid + * "RE" mark. */ + if (parent == NULL || parent->rr_moved == 0) + file->re = 0; + else if ((flags & 0x02) == 0) { + file->rr_moved_has_re_only = 0; + file->re = 0; + } + } else if (parent != NULL && parent->rr_moved) + file->rr_moved_has_re_only = 0; + else if (parent != NULL && (flags & 0x02) && + (parent->re || parent->re_descendant)) + file->re_descendant = 1; + if (file->cl_offset != 0) { + parent->subdirs++; + /* Overwrite an offset and a number of this "CL" entry + * to appear before other dirs. "+1" to those is to + * make sure to appear after "RE" entry which this + * "CL" entry should be connected with. */ + file->offset = file->number = file->cl_offset + 1; + } + } + #if DEBUG /* DEBUGGING: Warn about attributes I don't yet fully support. */ if ((flags & ~0x02) != 0) { @@ -2489,10 +2436,12 @@ next_entry_seek(struct archive_read *a, struct file_info **pfile) { struct file_info *file; + int r; - *pfile = file = next_cache_entry(iso9660); - if (file == NULL) - return (ARCHIVE_EOF); + r = next_cache_entry(a, iso9660, pfile); + if (r != ARCHIVE_OK) + return (r); + file = *pfile; /* Don't waste time seeking for zero-length bodies. */ if (file->size == 0) @@ -2513,8 +2462,9 @@ next_entry_seek(struct archive_read *a, return (ARCHIVE_OK); } -static struct file_info * -next_cache_entry(struct iso9660 *iso9660) +static int +next_cache_entry(struct archive_read *a, struct iso9660 *iso9660, + struct file_info **pfile) { struct file_info *file; struct { @@ -2526,21 +2476,131 @@ next_cache_entry(struct iso9660 *iso9660 file = cache_get_entry(iso9660); if (file != NULL) { - while (file->parent != NULL && !file->parent->exposed) { - /* If file's parent is not exposed, it's moved - * to next entry of its parent. */ - cache_add_to_next_of_parent(iso9660, file); - file = cache_get_entry(iso9660); - } - return (file); + *pfile = file; + return (ARCHIVE_OK); } - file = next_entry(iso9660); - if (file == NULL) - return (NULL); + for (;;) { + struct file_info *re, *d; + + *pfile = file = next_entry(iso9660); + if (file == NULL) { + /* + * If directory entries all which are descendant of + * rr_moved are stil remaning, expose their. + */ + if (iso9660->re_files.first != NULL && + iso9660->rr_moved != NULL && + iso9660->rr_moved->rr_moved_has_re_only) + /* Expose "rr_moved" entry. */ + cache_add_entry(iso9660, iso9660->rr_moved); + while ((re = re_get_entry(iso9660)) != NULL) { + /* Expose its descendant dirs. */ + while ((d = rede_get_entry(re)) != NULL) + cache_add_entry(iso9660, d); + } + if (iso9660->cache_files.first != NULL) + return (next_cache_entry(a, iso9660, pfile)); + return (ARCHIVE_EOF); + } + + if (file->cl_offset) { + struct file_info *first_re = NULL; + int nexted_re = 0; + + /* + * Find "RE" dir for the current file, which + * has "CL" flag. + */ + while ((re = re_get_entry(iso9660)) + != first_re) { + if (first_re == NULL) + first_re = re; + if (re->offset == file->cl_offset) { + re->parent->subdirs--; + re->parent = file->parent; + re->re = 0; + if (re->parent->re_descendant) { + nexted_re = 1; + re->re_descendant = 1; + if (rede_add_entry(re) < 0) + goto fatal_rr; + /* Move a list of descendants + * to a new ancestor. */ + while ((d = rede_get_entry( + re)) != NULL) + if (rede_add_entry(d) + < 0) + goto fatal_rr; + break; + } + /* Replace the current file + * with "RE" dir */ + *pfile = file = re; + /* Expose its descendant */ + while ((d = rede_get_entry( + file)) != NULL) + cache_add_entry( + iso9660, d); + break; + } else + re_add_entry(iso9660, re); + } + if (nexted_re) { + /* + * Do not expose this at this time + * because we have not gotten its full-path + * name yet. + */ + continue; + } + } else if ((file->mode & AE_IFMT) == AE_IFDIR) { + int r; + + /* Read file entries in this dir. */ + r = read_children(a, file); + if (r != ARCHIVE_OK) + return (r); + + /* + * Handle a special dir of Rockridge extensions, + * "rr_moved". + */ + if (file->rr_moved) { + /* + * If this has only the subdirectories which + * have "RE" flags, do not expose at this time. + */ + if (file->rr_moved_has_re_only) + continue; + /* Otherwise expose "rr_moved" entry. */ + } else if (file->re) { + /* + * Do not expose this at this time + * because we have not gotten its full-path + * name yet. + */ + re_add_entry(iso9660, file); + continue; + } else if (file->re_descendant) { + /* + * If the top level "RE" entry of this entry + * is not exposed, we, accordingly, should not + * expose this entry at this time because + * we cannot make its proper full-path name. + */ + if (rede_add_entry(file) == 0) + continue; + /* Otherwise we can expose this entry because + * it seems its top level "RE" has already been + * exposed. */ + } + } + break; + } if ((file->mode & AE_IFMT) != AE_IFREG || file->number == -1) - return (file); + return (ARCHIVE_OK); count = 0; number = file->number; @@ -2573,8 +2633,10 @@ next_cache_entry(struct iso9660 *iso9660 file = next_entry(iso9660); } - if (count == 0) - return (file); + if (count == 0) { + *pfile = file; + return ((file == NULL)?ARCHIVE_EOF:ARCHIVE_OK); + } if (file->number == -1) { file->next = NULL; *empty_files.last = file; @@ -2599,24 +2661,75 @@ next_cache_entry(struct iso9660 *iso9660 *iso9660->cache_files.last = empty_files.first; iso9660->cache_files.last = empty_files.last; } - return (cache_get_entry(iso9660)); + *pfile = cache_get_entry(iso9660); + return ((*pfile == NULL)?ARCHIVE_EOF:ARCHIVE_OK); + +fatal_rr: + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Failed to connect 'CL' pointer to 'RE' rr_moved pointer of" + "Rockridge extensions"); + return (ARCHIVE_FATAL); } static inline void -cache_add_entry(struct iso9660 *iso9660, struct file_info *file) +re_add_entry(struct iso9660 *iso9660, struct file_info *file) { - file->next = NULL; - *iso9660->cache_files.last = file; - iso9660->cache_files.last = &(file->next); + file->re_next = NULL; + *iso9660->re_files.last = file; + iso9660->re_files.last = &(file->re_next); +} + +static inline struct file_info * +re_get_entry(struct iso9660 *iso9660) +{ + struct file_info *file; + + if ((file = iso9660->re_files.first) != NULL) { + iso9660->re_files.first = file->re_next; + if (iso9660->re_files.first == NULL) + iso9660->re_files.last = + &(iso9660->re_files.first); + } + return (file); +} + +static inline int +rede_add_entry(struct file_info *file) +{ + struct file_info *re; + + re = file->parent; + while (re != NULL && !re->re) + re = re->parent; + if (re == NULL) + return (-1); + + file->re_next = NULL; + *re->rede_files.last = file; + re->rede_files.last = &(file->re_next); + return (0); +} + +static inline struct file_info * +rede_get_entry(struct file_info *re) +{ + struct file_info *file; + + if ((file = re->rede_files.first) != NULL) { + re->rede_files.first = file->re_next; + if (re->rede_files.first == NULL) + re->rede_files.last = + &(re->rede_files.first); + } + return (file); } static inline void -cache_add_to_next_of_parent(struct iso9660 *iso9660, struct file_info *file) +cache_add_entry(struct iso9660 *iso9660, struct file_info *file) { - file->next = file->parent->next; - file->parent->next = file; - if (iso9660->cache_files.last == &(file->parent->next)) - iso9660->cache_files.last = &(file->next); + file->next = NULL; + *iso9660->cache_files.last = file; + iso9660->cache_files.last = &(file->next); } static inline struct file_info * Copied: stable/8/lib/libarchive/test/test_read_format_iso_2.iso.Z.uu (from r225167, head/lib/libarchive/test/test_read_format_iso_2.iso.Z.uu) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/lib/libarchive/test/test_read_format_iso_2.iso.Z.uu Mon Sep 5 09:49:28 2011 (r225392, copy of r225167, head/lib/libarchive/test/test_read_format_iso_2.iso.Z.uu) @@ -0,0 +1,37 @@ +$FreeBSD$ + +begin 644 test_read_format_iso_2.iso.Z +M'YV0``(*'$BPH,&#"!,J7,BPH<.'$"-*G$BQHL6+&#-JW,BQH\>/($.*'$FR +MI,F3*%.J7,FRIO8,.*'4NVK-FS:-.J7//JW/'D"-+GDRYLN7+F#-KWLRY +ML^?/H$.+'DVZM.G3J%.K7LVZM>O7L&/+GDV[MNW;N'/KWLV[M^_?P(,+'TZ\ +MN/'CR),K7\Z\N?/GT*-+GTZ]NO7KV+-KW\Z]N_?OX,.+'T^^O/GSZ-.K7\^^ +MO?OW\./+GT^_OOW[^//KW\^_O_^_`0Q!!`PPQ!```$Z408<04Q`!PH,01BCA +MA!16:.&%$!Z404$;>G0@``%\>"`""`#@04$>2)#0!`.)```%!<%8HD`EEF+C +MC:4($)"(!V+HXX]`!BGDD$06:>212":IY)),-NGDDU!&*>645%9II8\R%!@# +M##C$0(,,,6Q)PPP$DI-EF%QZ"::89,)`#H%PQBDGG&=NV>67:(Y9YH?_]>GG +MGX7](R"!!@)JZ*&()JKHHL<="...`AU80:0`!`$B`!=0.@2CG';JZ:>@A@H8 +MGR]>:FI`DP9@*:F9!BCJJ[#&*NNLM#[EXJ,#R3A0C3C:J*.I(0)P:XP`S!@0 +MK[W^RF,`+DY*T*3&%@O`&P@X4($"!I"C[(ZJNI@I09E&6R*UUBJP@+:0@NAJ +MK>RVZ^Z[\$;7;$'0[CIMM==FNZVZPI9*D*XT`M"KK^F&&(`)`%A0D`4&%&0` +MN?F20RF(!`CAP@XQQ*OQQAQW['%S:)3!!AMO*/#QR2BGK/+*G7I;4+CV0FPN +MNL`>..R_T@8\<(X%AX@P!@5AT#!!#^,[\\0!$$#$Q1FS[/334$M]MILM^WVVW#'+??<=-=M]]UXYZWW +MWGSW[???@`N^>:<=^[Y +MYZ"'+OKHI)=N^NFHIZ[ZZJRW[OKKL,O_/+,-^_\\]!'+_WTU%=O_?789Z_]]MQW[_WWX(BGK_[Z[+?O_OOPQR___/37;__]^.>O__[\]^___P`,H``'2,`"&O"`"$R@ +M`A?(P`8Z\($0C*`$)TC!"EKP@AC,H`8WR,$.>O"#(`RA"$=(PA*:\(0H3*$* +M5\C"%KKPA3",H0QG2,,:VO"&.,RA#G?(PQ[Z\(=`#*(0ATC$(AKQB$A,HA*7 +MR,0F.O&)4(RB%*=(Q2I:\8I8S*(6M\C%+GKQBV`,HQC'2,8RFO&,:$RC&M?( +MQC:Z\8UPC*,O.;X`RG.,=)SG*:\YSH3*^,RG/O?)SW[Z\Y\`#:A`!TK0@AKTH`A-J$(7RM"&.O2A +M$(VH1"=*T8I:]*(8S:A&-\K1CGKTHR`-J4A'2M*2FO2D*$VI2E?*TI:Z]*4P +MC:E,9TK3FMKTICC-J4YWRM.>^O2G0`VJ4(=*U*(:]:A(3:I2E\K4ICKUJ5"- +MJE2G2M6J6O6J6,VJ5K?*U:YZ]:M@#:M8QTK6LIKUK&A-JUK7RM:VNO6M<`TG +` +end Modified: stable/8/lib/libarchive/test/test_read_format_iso_gz.c ============================================================================== --- stable/8/lib/libarchive/test/test_read_format_iso_gz.c Mon Sep 5 09:39:35 2011 (r225391) +++ stable/8/lib/libarchive/test/test_read_format_iso_gz.c Mon Sep 5 09:49:28 2011 (r225392) @@ -25,7 +25,8 @@ #include "test.h" __FBSDID("$FreeBSD$"); -DEFINE_TEST(test_read_format_iso_gz) +static void +test1(void) { struct archive_entry *ae; struct archive *a; @@ -49,4 +50,50 @@ DEFINE_TEST(test_read_format_iso_gz) assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); } +static +void test2(void) +{ + struct archive_entry *ae; + struct archive *a; + const char *name = "test_read_format_iso_2.iso.Z"; + + extract_reference_file(name); + + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_compression_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_open_filename(a, name, 512)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_next_header(a, &ae)); + assertEqualString(".", archive_entry_pathname(ae)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_next_header(a, &ae)); + assertEqualString("A", archive_entry_pathname(ae)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_next_header(a, &ae)); + assertEqualString("A/B", archive_entry_pathname(ae)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_next_header(a, &ae)); + assertEqualString("C", archive_entry_pathname(ae)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_next_header(a, &ae)); + assertEqualString("C/D", archive_entry_pathname(ae)); + assertEqualIntA(a, ARCHIVE_EOF, + archive_read_next_header(a, &ae)); + assertEqualInt(archive_compression(a), + ARCHIVE_COMPRESSION_COMPRESS); + assertEqualInt(archive_format(a), ARCHIVE_FORMAT_ISO9660); + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); +} + +DEFINE_TEST(test_read_format_iso_gz) +{ + test1(); + test2(); +} + Modified: stable/8/lib/libarchive/test/test_read_format_isojoliet_bz2.c ============================================================================== --- stable/8/lib/libarchive/test/test_read_format_isojoliet_bz2.c Mon Sep 5 09:39:35 2011 (r225391) +++ stable/8/lib/libarchive/test/test_read_format_isojoliet_bz2.c Mon Sep 5 09:49:28 2011 (r225392) @@ -95,7 +95,7 @@ DEFINE_TEST(test_read_format_isojoliet_b /* A regular file with two names ("hardlink" gets returned * first, so it's not marked as a hardlink). */ assertEqualInt(0, archive_read_next_header(a, &ae)); - assertEqualString("long-joliet-file-name.textfile", + assertEqualString("hardlink", archive_entry_pathname(ae)); assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); assert(archive_entry_hardlink(ae) == NULL); @@ -108,9 +108,10 @@ DEFINE_TEST(test_read_format_isojoliet_b /* Second name for the same regular file (this happens to be * returned second, so does get marked as a hardlink). */ assertEqualInt(0, archive_read_next_header(a, &ae)); - assertEqualString("hardlink", archive_entry_pathname(ae)); - assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); assertEqualString("long-joliet-file-name.textfile", + archive_entry_pathname(ae)); + assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); + assertEqualString("hardlink", archive_entry_hardlink(ae)); assert(!archive_entry_size_is_set(ae)); Modified: stable/8/lib/libarchive/test/test_read_format_isojoliet_long.c ============================================================================== --- stable/8/lib/libarchive/test/test_read_format_isojoliet_long.c Mon Sep 5 09:39:35 2011 (r225391) +++ stable/8/lib/libarchive/test/test_read_format_isojoliet_long.c Mon Sep 5 09:49:28 2011 (r225392) @@ -111,7 +111,7 @@ DEFINE_TEST(test_read_format_isojoliet_l pathname[102] = '3'; pathname[103] = '\0'; assertEqualInt(0, archive_read_next_header(a, &ae)); - assertEqualString(pathname, archive_entry_pathname(ae)); + assertEqualString("hardlink", archive_entry_pathname(ae)); assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); assert(archive_entry_hardlink(ae) == NULL); assertEqualInt(6, archive_entry_size(ae)); @@ -123,9 +123,9 @@ DEFINE_TEST(test_read_format_isojoliet_l /* Second name for the same regular file (this happens to be * returned second, so does get marked as a hardlink). */ assertEqualInt(0, archive_read_next_header(a, &ae)); - assertEqualString("hardlink", archive_entry_pathname(ae)); + assertEqualString(pathname, archive_entry_pathname(ae)); assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); - assertEqualString(pathname, archive_entry_hardlink(ae)); + assertEqualString("hardlink", archive_entry_hardlink(ae)); assert(!archive_entry_size_is_set(ae)); /* End of archive. */ Modified: stable/8/lib/libarchive/test/test_read_format_isojoliet_rr.c ============================================================================== --- stable/8/lib/libarchive/test/test_read_format_isojoliet_rr.c Mon Sep 5 09:39:35 2011 (r225391) +++ stable/8/lib/libarchive/test/test_read_format_isojoliet_rr.c Mon Sep 5 09:49:28 2011 (r225392) @@ -98,7 +98,7 @@ DEFINE_TEST(test_read_format_isojoliet_r /* A regular file with two names ("hardlink" gets returned * first, so it's not marked as a hardlink). */ assertEqualInt(0, archive_read_next_header(a, &ae)); - assertEqualString("long-joliet-file-name.textfile", + assertEqualString("hardlink", archive_entry_pathname(ae)); assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); assert(archive_entry_hardlink(ae) == NULL); @@ -120,9 +120,10 @@ DEFINE_TEST(test_read_format_isojoliet_r /* Second name for the same regular file (this happens to be * returned second, so does get marked as a hardlink). */ assertEqualInt(0, archive_read_next_header(a, &ae)); - assertEqualString("hardlink", archive_entry_pathname(ae)); - assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); assertEqualString("long-joliet-file-name.textfile", + archive_entry_pathname(ae)); + assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); + assertEqualString("hardlink", archive_entry_hardlink(ae)); assert(!archive_entry_size_is_set(ae)); assertEqualInt(86401, archive_entry_mtime(ae)); Modified: stable/8/lib/libarchive/test/test_read_format_isorr_bz2.c ============================================================================== --- stable/8/lib/libarchive/test/test_read_format_isorr_bz2.c Mon Sep 5 09:39:35 2011 (r225391) +++ stable/8/lib/libarchive/test/test_read_format_isorr_bz2.c Mon Sep 5 09:49:28 2011 (r225392) @@ -97,9 +97,9 @@ DEFINE_TEST(test_read_format_isorr_bz2) assertEqualInt(2, archive_entry_stat(ae)->st_nlink); assertEqualInt(1, archive_entry_uid(ae)); assertEqualInt(2, archive_entry_gid(ae)); - } else if (strcmp("hardlink", archive_entry_pathname(ae)) == 0) { + } else if (strcmp("file", archive_entry_pathname(ae)) == 0) { /* A regular file. */ - assertEqualString("hardlink", archive_entry_pathname(ae)); + assertEqualString("file", archive_entry_pathname(ae)); assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); assertEqualInt(12345684, archive_entry_size(ae)); assertEqualInt(0, @@ -111,16 +111,16 @@ DEFINE_TEST(test_read_format_isorr_bz2) assertEqualInt(2, archive_entry_stat(ae)->st_nlink); assertEqualInt(1, archive_entry_uid(ae)); assertEqualInt(2, archive_entry_gid(ae)); - } else if (strcmp("file", archive_entry_pathname(ae)) == 0) { + } else if (strcmp("hardlink", archive_entry_pathname(ae)) == 0) { /* A hardlink to the regular file. */ /* Note: If "hardlink" gets returned before "file", * then "hardlink" will get returned as a regular file * and "file" will get returned as the hardlink. * This test should tolerate that, since it's a * perfectly permissible thing for libarchive to do. */ - assertEqualString("file", archive_entry_pathname(ae)); + assertEqualString("hardlink", archive_entry_pathname(ae)); assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); - assertEqualString("hardlink", archive_entry_hardlink(ae)); + assertEqualString("file", archive_entry_hardlink(ae)); assertEqualInt(0, archive_entry_size_is_set(ae)); assertEqualInt(0, archive_entry_size(ae)); assertEqualInt(86401, archive_entry_mtime(ae)); Modified: stable/8/lib/libarchive/test/test_read_format_isorr_new_bz2.c ============================================================================== --- stable/8/lib/libarchive/test/test_read_format_isorr_new_bz2.c Mon Sep 5 09:39:35 2011 (r225391) +++ stable/8/lib/libarchive/test/test_read_format_isorr_new_bz2.c Mon Sep 5 09:49:28 2011 (r225392) @@ -98,9 +98,9 @@ DEFINE_TEST(test_read_format_isorr_new_b assertEqualInt(2, archive_entry_stat(ae)->st_nlink); assertEqualInt(1, archive_entry_uid(ae)); assertEqualInt(2, archive_entry_gid(ae)); - } else if (strcmp("hardlink", archive_entry_pathname(ae)) == 0) { + } else if (strcmp("file", archive_entry_pathname(ae)) == 0) { /* A regular file. */ - assertEqualString("hardlink", archive_entry_pathname(ae)); + assertEqualString("file", archive_entry_pathname(ae)); assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); assertEqualInt(12345684, archive_entry_size(ae)); assertEqualInt(0, @@ -112,16 +112,16 @@ DEFINE_TEST(test_read_format_isorr_new_b assertEqualInt(2, archive_entry_stat(ae)->st_nlink); assertEqualInt(1, archive_entry_uid(ae)); assertEqualInt(2, archive_entry_gid(ae)); - } else if (strcmp("file", archive_entry_pathname(ae)) == 0) { + } else if (strcmp("hardlink", archive_entry_pathname(ae)) == 0) { /* A hardlink to the regular file. */ /* Note: If "hardlink" gets returned before "file", * then "hardlink" will get returned as a regular file * and "file" will get returned as the hardlink. * This test should tolerate that, since it's a * perfectly permissible thing for libarchive to do. */ - assertEqualString("file", archive_entry_pathname(ae)); + assertEqualString("hardlink", archive_entry_pathname(ae)); assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); - assertEqualString("hardlink", archive_entry_hardlink(ae)); + assertEqualString("file", archive_entry_hardlink(ae)); assertEqualInt(0, archive_entry_size_is_set(ae)); assertEqualInt(0, archive_entry_size(ae)); assertEqualInt(86401, archive_entry_mtime(ae)); Modified: stable/8/lib/libarchive/test/test_read_format_isozisofs_bz2.c ============================================================================== --- stable/8/lib/libarchive/test/test_read_format_isozisofs_bz2.c Mon Sep 5 09:39:35 2011 (r225391) +++ stable/8/lib/libarchive/test/test_read_format_isozisofs_bz2.c Mon Sep 5 09:49:28 2011 (r225392) @@ -96,10 +96,10 @@ DEFINE_TEST(test_read_format_isozisofs_b assertEqualInt(2, archive_entry_stat(ae)->st_nlink); assertEqualInt(1, archive_entry_uid(ae)); assertEqualInt(2, archive_entry_gid(ae)); - } else if (strcmp("hardlink", archive_entry_pathname(ae)) == 0) { + } else if (strcmp("file", archive_entry_pathname(ae)) == 0) { int r; /* A regular file. */ - assertEqualString("hardlink", archive_entry_pathname(ae)); + assertEqualString("file", archive_entry_pathname(ae)); assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); assertEqualInt(12345684, archive_entry_size(ae)); r = archive_read_data_block(a, &p, &size, &offset); @@ -111,23 +111,23 @@ DEFINE_TEST(test_read_format_isozisofs_b assertEqualMem(p, "hello\n", 6); } assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(86401, archive_entry_atime(ae)); assertEqualInt(2, archive_entry_stat(ae)->st_nlink); assertEqualInt(1, archive_entry_uid(ae)); assertEqualInt(2, archive_entry_gid(ae)); - } else if (strcmp("file", archive_entry_pathname(ae)) == 0) { + } else if (strcmp("hardlink", archive_entry_pathname(ae)) == 0) { /* A hardlink to the regular file. */ /* Note: If "hardlink" gets returned before "file", * then "hardlink" will get returned as a regular file * and "file" will get returned as the hardlink. * This test should tolerate that, since it's a * perfectly permissible thing for libarchive to do. */ - assertEqualString("file", archive_entry_pathname(ae)); + assertEqualString("hardlink", archive_entry_pathname(ae)); assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); - assertEqualString("hardlink", archive_entry_hardlink(ae)); + assertEqualString("file", archive_entry_hardlink(ae)); assertEqualInt(0, archive_entry_size_is_set(ae)); assertEqualInt(0, archive_entry_size(ae)); assertEqualInt(86401, archive_entry_mtime(ae)); - assertEqualInt(86401, archive_entry_atime(ae)); assertEqualInt(2, archive_entry_stat(ae)->st_nlink); assertEqualInt(1, archive_entry_uid(ae)); assertEqualInt(2, archive_entry_gid(ae)); From owner-svn-src-all@FreeBSD.ORG Mon Sep 5 10:45:29 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB5151065670; Mon, 5 Sep 2011 10:45:29 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D864C8FC16; Mon, 5 Sep 2011 10:45:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p85AjTmA034585; Mon, 5 Sep 2011 10:45:29 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p85AjTeK034574; Mon, 5 Sep 2011 10:45:29 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201109051045.p85AjTeK034574@svn.freebsd.org> From: "Jayachandran C." Date: Mon, 5 Sep 2011 10:45:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225394 - in head/sys/mips: conf nlm nlm/hal X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Sep 2011 10:45:30 -0000 Author: jchandra Date: Mon Sep 5 10:45:29 2011 New Revision: 225394 URL: http://svn.freebsd.org/changeset/base/225394 Log: MIPS XLP platform code update. * Update the hardware access register definitions and functions to bring them in line with other Netlogic software. * Update the platform bus to use PCI even for on-chip devices. Add a dummy PCI driver to ignore on-chip devices which do not need driver. * Provide memory and IRQ resource allocation code for on-chip devices which cannot get it from PCI config. * add support for on-chip PCI and USB interfaces. * update conf files, enable pci and retain old MAXCPU until we can support >32 cpus. Approved by: re(kib), jmallett Added: head/sys/mips/nlm/bus_space_rmi_pci.c (contents, props changed) head/sys/mips/nlm/hal/haldefs.h (contents, props changed) head/sys/mips/nlm/hal/pcibus.h (contents, props changed) head/sys/mips/nlm/hal/usb.h (contents, props changed) head/sys/mips/nlm/intern_dev.c (contents, props changed) head/sys/mips/nlm/uart_cpu_xlp.c (contents, props changed) head/sys/mips/nlm/uart_pci_xlp.c (contents, props changed) head/sys/mips/nlm/usb_init.c (contents, props changed) head/sys/mips/nlm/xlp_pci.c (contents, props changed) Deleted: head/sys/mips/nlm/hal/cop0.h head/sys/mips/nlm/hal/mmio.h head/sys/mips/nlm/iodi.c head/sys/mips/nlm/uart_cpu_mips_xlp.c Modified: head/sys/mips/conf/XLP head/sys/mips/conf/XLP64 head/sys/mips/conf/XLPN32 head/sys/mips/nlm/board.c head/sys/mips/nlm/board.h head/sys/mips/nlm/bus_space_rmi.c head/sys/mips/nlm/clock.h head/sys/mips/nlm/cms.c head/sys/mips/nlm/files.xlp head/sys/mips/nlm/hal/bridge.h head/sys/mips/nlm/hal/cop2.h head/sys/mips/nlm/hal/cpucontrol.h head/sys/mips/nlm/hal/fmn.c head/sys/mips/nlm/hal/fmn.h head/sys/mips/nlm/hal/iomap.h head/sys/mips/nlm/hal/mips-extns.h head/sys/mips/nlm/hal/mmu.h head/sys/mips/nlm/hal/pic.h head/sys/mips/nlm/hal/sys.h head/sys/mips/nlm/hal/uart.h head/sys/mips/nlm/interrupt.h head/sys/mips/nlm/intr_machdep.c head/sys/mips/nlm/mpreset.S head/sys/mips/nlm/msgring.h head/sys/mips/nlm/uart_bus_xlp_iodi.c head/sys/mips/nlm/xlp.h head/sys/mips/nlm/xlp_machdep.c Modified: head/sys/mips/conf/XLP ============================================================================== --- head/sys/mips/conf/XLP Mon Sep 5 10:09:53 2011 (r225393) +++ head/sys/mips/conf/XLP Mon Sep 5 10:45:29 2011 (r225394) @@ -36,7 +36,7 @@ options SCHED_ULE # ULE scheduler options SMP options PREEMPTION # Enable kernel thread preemption #options FULL_PREEMPTION # Enable kernel thread preemption -options MAXCPU=128 # XLP can probe 128 CPUs +#options MAXCPU=128 # XLP can probe 128 CPUs options INET # InterNETworking options INET6 # IPv6 communications protocols options FFS # Berkeley Fast Filesystem @@ -89,6 +89,7 @@ device bpf # UART device uart +device pci # Network device ether Modified: head/sys/mips/conf/XLP64 ============================================================================== --- head/sys/mips/conf/XLP64 Mon Sep 5 10:09:53 2011 (r225393) +++ head/sys/mips/conf/XLP64 Mon Sep 5 10:45:29 2011 (r225394) @@ -21,7 +21,7 @@ machine mips mips64eb ident XLP64 options ISA_MIPS64 -makeoptions ARCH_FLAGS="-march=mips64 -mabi=64" +makeoptions ARCH_FLAGS="-march=mips64r2 -mabi=64" makeoptions KERNLOADADDR=0xffffffff80100000 include "../nlm/std.xlp" @@ -38,7 +38,7 @@ options SCHED_ULE # ULE scheduler options SMP options PREEMPTION # Enable kernel thread preemption #options FULL_PREEMPTION # Enable kernel thread preemption -options MAXCPU=128 # XLP can probe 128 CPUs +#options MAXCPU=128 # XLP can probe 128 CPUs options INET # InterNETworking options INET6 # IPv6 communications protocols options FFS # Berkeley Fast Filesystem @@ -91,6 +91,7 @@ device bpf # UART device uart +device pci # Network device ether Modified: head/sys/mips/conf/XLPN32 ============================================================================== --- head/sys/mips/conf/XLPN32 Mon Sep 5 10:09:53 2011 (r225393) +++ head/sys/mips/conf/XLPN32 Mon Sep 5 10:45:29 2011 (r225394) @@ -37,7 +37,7 @@ options SCHED_ULE # ULE scheduler options SMP options PREEMPTION # Enable kernel thread preemption #options FULL_PREEMPTION # Enable kernel thread preemption -options MAXCPU=128 # XLP can probe 128 CPUs +#options MAXCPU=128 # XLP can probe 128 CPUs options INET # InterNETworking options INET6 # IPv6 communications protocols options FFS # Berkeley Fast Filesystem @@ -90,6 +90,7 @@ device bpf # UART device uart +device pci # Network device ether Modified: head/sys/mips/nlm/board.c ============================================================================== --- head/sys/mips/nlm/board.c Mon Sep 5 10:09:53 2011 (r225393) +++ head/sys/mips/nlm/board.c Mon Sep 5 10:45:29 2011 (r225394) @@ -29,7 +29,6 @@ #include __FBSDID("$FreeBSD$"); - #include #include #include @@ -38,7 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include #include #include Modified: head/sys/mips/nlm/board.h ============================================================================== --- head/sys/mips/nlm/board.h Mon Sep 5 10:09:53 2011 (r225393) +++ head/sys/mips/nlm/board.h Mon Sep 5 10:45:29 2011 (r225394) @@ -25,8 +25,9 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * + * NETLOGIC_BSD * $FreeBSD$ - * NETLOGIC_BSD */ + */ #ifndef __NLM_BOARD_H__ #define __NLM_BOARD_H__ Modified: head/sys/mips/nlm/bus_space_rmi.c ============================================================================== --- head/sys/mips/nlm/bus_space_rmi.c Mon Sep 5 10:09:53 2011 (r225393) +++ head/sys/mips/nlm/bus_space_rmi.c Mon Sep 5 10:45:29 2011 (r225394) @@ -401,14 +401,14 @@ static u_int8_t rmi_bus_space_read_1(void *tag, bus_space_handle_t handle, bus_size_t offset) { - return (u_int8_t) (*(volatile u_int32_t *)(handle + offset)); + return (u_int8_t) (*(volatile u_int8_t *)(handle + offset)); } static u_int16_t rmi_bus_space_read_2(void *tag, bus_space_handle_t handle, bus_size_t offset) { - return (u_int16_t)(*(volatile u_int32_t *)(handle + offset)); + return (u_int16_t)(*(volatile u_int16_t *)(handle + offset)); } static u_int32_t @@ -453,14 +453,14 @@ static void rmi_bus_space_write_1(void *tag, bus_space_handle_t handle, bus_size_t offset, u_int8_t value) { - *(volatile u_int32_t *)(handle + offset) = (u_int32_t)value; + *(volatile u_int8_t *)(handle + offset) = value; } static void rmi_bus_space_write_2(void *tag, bus_space_handle_t handle, bus_size_t offset, u_int16_t value) { - *(volatile u_int32_t *)(handle + offset) = (u_int32_t)value; + *(volatile u_int16_t *)(handle + offset) = value; } static void Added: head/sys/mips/nlm/bus_space_rmi_pci.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/nlm/bus_space_rmi_pci.c Mon Sep 5 10:45:29 2011 (r225394) @@ -0,0 +1,768 @@ +/*- + * Copyright 2003-2011 Netlogic Microsystems (Netlogic). All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY Netlogic Microsystems ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NETLOGIC OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + * NETLOGIC_BSD */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +static int +rmi_pci_bus_space_map(void *t, bus_addr_t addr, + bus_size_t size, int flags, + bus_space_handle_t * bshp); + +static void +rmi_pci_bus_space_unmap(void *t, bus_space_handle_t bsh, + bus_size_t size); + +static int +rmi_pci_bus_space_subregion(void *t, + bus_space_handle_t bsh, + bus_size_t offset, bus_size_t size, + bus_space_handle_t * nbshp); + +static u_int8_t +rmi_pci_bus_space_read_1(void *t, + bus_space_handle_t handle, + bus_size_t offset); + +static u_int16_t +rmi_pci_bus_space_read_2(void *t, + bus_space_handle_t handle, + bus_size_t offset); + +static u_int32_t +rmi_pci_bus_space_read_4(void *t, + bus_space_handle_t handle, + bus_size_t offset); + +static void +rmi_pci_bus_space_read_multi_1(void *t, + bus_space_handle_t handle, + bus_size_t offset, u_int8_t * addr, + size_t count); + +static void +rmi_pci_bus_space_read_multi_2(void *t, + bus_space_handle_t handle, + bus_size_t offset, u_int16_t * addr, + size_t count); + +static void +rmi_pci_bus_space_read_multi_4(void *t, + bus_space_handle_t handle, + bus_size_t offset, u_int32_t * addr, + size_t count); + +static void +rmi_pci_bus_space_read_region_1(void *t, + bus_space_handle_t bsh, + bus_size_t offset, u_int8_t * addr, + size_t count); + +static void +rmi_pci_bus_space_read_region_2(void *t, + bus_space_handle_t bsh, + bus_size_t offset, u_int16_t * addr, + size_t count); + +static void +rmi_pci_bus_space_read_region_4(void *t, + bus_space_handle_t bsh, + bus_size_t offset, u_int32_t * addr, + size_t count); + +static void +rmi_pci_bus_space_write_1(void *t, + bus_space_handle_t handle, + bus_size_t offset, u_int8_t value); + +static void +rmi_pci_bus_space_write_2(void *t, + bus_space_handle_t handle, + bus_size_t offset, u_int16_t value); + +static void +rmi_pci_bus_space_write_4(void *t, + bus_space_handle_t handle, + bus_size_t offset, u_int32_t value); + +static void +rmi_pci_bus_space_write_multi_1(void *t, + bus_space_handle_t handle, + bus_size_t offset, + const u_int8_t * addr, + size_t count); + +static void +rmi_pci_bus_space_write_multi_2(void *t, + bus_space_handle_t handle, + bus_size_t offset, + const u_int16_t * addr, + size_t count); + +static void +rmi_pci_bus_space_write_multi_4(void *t, + bus_space_handle_t handle, + bus_size_t offset, + const u_int32_t * addr, + size_t count); + +static void +rmi_pci_bus_space_write_region_2(void *t, + bus_space_handle_t bsh, + bus_size_t offset, + const u_int16_t * addr, + size_t count); + +static void +rmi_pci_bus_space_write_region_4(void *t, + bus_space_handle_t bsh, + bus_size_t offset, + const u_int32_t * addr, + size_t count); + + +static void +rmi_pci_bus_space_set_region_2(void *t, + bus_space_handle_t bsh, + bus_size_t offset, u_int16_t value, + size_t count); +static void +rmi_pci_bus_space_set_region_4(void *t, + bus_space_handle_t bsh, + bus_size_t offset, u_int32_t value, + size_t count); + +static void +rmi_pci_bus_space_barrier(void *tag __unused, bus_space_handle_t bsh __unused, + bus_size_t offset __unused, bus_size_t len __unused, int flags); + +static void +rmi_pci_bus_space_copy_region_2(void *t, + bus_space_handle_t bsh1, + bus_size_t off1, + bus_space_handle_t bsh2, + bus_size_t off2, size_t count); + +u_int8_t +rmi_pci_bus_space_read_stream_1(void *t, bus_space_handle_t handle, + bus_size_t offset); + +static u_int16_t +rmi_pci_bus_space_read_stream_2(void *t, bus_space_handle_t handle, + bus_size_t offset); + +static u_int32_t +rmi_pci_bus_space_read_stream_4(void *t, bus_space_handle_t handle, + bus_size_t offset); +static void +rmi_pci_bus_space_read_multi_stream_1(void *t, + bus_space_handle_t handle, + bus_size_t offset, u_int8_t * addr, + size_t count); + +static void +rmi_pci_bus_space_read_multi_stream_2(void *t, + bus_space_handle_t handle, + bus_size_t offset, u_int16_t * addr, + size_t count); + +static void +rmi_pci_bus_space_read_multi_stream_4(void *t, + bus_space_handle_t handle, + bus_size_t offset, u_int32_t * addr, + size_t count); + +void +rmi_pci_bus_space_write_stream_1(void *t, bus_space_handle_t bsh, + bus_size_t offset, u_int8_t value); +static void +rmi_pci_bus_space_write_stream_2(void *t, bus_space_handle_t handle, + bus_size_t offset, u_int16_t value); + +static void +rmi_pci_bus_space_write_stream_4(void *t, bus_space_handle_t handle, + bus_size_t offset, u_int32_t value); + +static void +rmi_pci_bus_space_write_multi_stream_1(void *t, + bus_space_handle_t handle, + bus_size_t offset, + const u_int8_t * addr, + size_t count); +static void +rmi_pci_bus_space_write_multi_stream_2(void *t, + bus_space_handle_t handle, + bus_size_t offset, + const u_int16_t * addr, + size_t count); + +static void +rmi_pci_bus_space_write_multi_stream_4(void *t, + bus_space_handle_t handle, + bus_size_t offset, + const u_int32_t * addr, + size_t count); + +#define TODO() printf("XLR memory bus space function '%s' unimplemented\n", __func__) + +static struct bus_space local_rmi_pci_bus_space = { + /* cookie */ + (void *)0, + + /* mapping/unmapping */ + rmi_pci_bus_space_map, + rmi_pci_bus_space_unmap, + rmi_pci_bus_space_subregion, + + /* allocation/deallocation */ + NULL, + NULL, + + /* barrier */ + rmi_pci_bus_space_barrier, + + /* read (single) */ + rmi_pci_bus_space_read_1, + rmi_pci_bus_space_read_2, + rmi_pci_bus_space_read_4, + NULL, + + /* read multiple */ + rmi_pci_bus_space_read_multi_1, + rmi_pci_bus_space_read_multi_2, + rmi_pci_bus_space_read_multi_4, + NULL, + + /* read region */ + rmi_pci_bus_space_read_region_1, + rmi_pci_bus_space_read_region_2, + rmi_pci_bus_space_read_region_4, + NULL, + + /* write (single) */ + rmi_pci_bus_space_write_1, + rmi_pci_bus_space_write_2, + rmi_pci_bus_space_write_4, + NULL, + + /* write multiple */ + rmi_pci_bus_space_write_multi_1, + rmi_pci_bus_space_write_multi_2, + rmi_pci_bus_space_write_multi_4, + NULL, + + /* write region */ + NULL, + rmi_pci_bus_space_write_region_2, + rmi_pci_bus_space_write_region_4, + NULL, + + /* set multiple */ + NULL, + NULL, + NULL, + NULL, + + /* set region */ + NULL, + rmi_pci_bus_space_set_region_2, + rmi_pci_bus_space_set_region_4, + NULL, + + /* copy */ + NULL, + rmi_pci_bus_space_copy_region_2, + NULL, + NULL, + + /* read (single) stream */ + rmi_pci_bus_space_read_stream_1, + rmi_pci_bus_space_read_stream_2, + rmi_pci_bus_space_read_stream_4, + NULL, + + /* read multiple stream */ + rmi_pci_bus_space_read_multi_stream_1, + rmi_pci_bus_space_read_multi_stream_2, + rmi_pci_bus_space_read_multi_stream_4, + NULL, + + /* read region stream */ + rmi_pci_bus_space_read_region_1, + rmi_pci_bus_space_read_region_2, + rmi_pci_bus_space_read_region_4, + NULL, + + /* write (single) stream */ + rmi_pci_bus_space_write_stream_1, + rmi_pci_bus_space_write_stream_2, + rmi_pci_bus_space_write_stream_4, + NULL, + + /* write multiple stream */ + rmi_pci_bus_space_write_multi_stream_1, + rmi_pci_bus_space_write_multi_stream_2, + rmi_pci_bus_space_write_multi_stream_4, + NULL, + + /* write region stream */ + NULL, + rmi_pci_bus_space_write_region_2, + rmi_pci_bus_space_write_region_4, + NULL, +}; + +/* generic bus_space tag */ +bus_space_tag_t rmi_pci_bus_space = &local_rmi_pci_bus_space; + +/* + * Map a region of device bus space into CPU virtual address space. + */ +static int +rmi_pci_bus_space_map(void *t __unused, bus_addr_t addr, + bus_size_t size __unused, int flags __unused, + bus_space_handle_t * bshp) +{ + *bshp = addr; + return (0); +} + +/* + * Unmap a region of device bus space. + */ +static void +rmi_pci_bus_space_unmap(void *t __unused, bus_space_handle_t bsh __unused, + bus_size_t size __unused) +{ +} + +/* + * Get a new handle for a subregion of an already-mapped area of bus space. + */ + +static int +rmi_pci_bus_space_subregion(void *t __unused, bus_space_handle_t bsh, + bus_size_t offset, bus_size_t size __unused, + bus_space_handle_t * nbshp) +{ + *nbshp = bsh + offset; + return (0); +} + +/* + * Read a 1, 2, 4, or 8 byte quantity from bus space + * described by tag/handle/offset. + */ + +static u_int8_t +rmi_pci_bus_space_read_1(void *tag, bus_space_handle_t handle, + bus_size_t offset) +{ + return (u_int8_t) (*(volatile u_int8_t *)(handle + offset)); +} + +static u_int16_t +rmi_pci_bus_space_read_2(void *tag, bus_space_handle_t handle, + bus_size_t offset) +{ + u_int16_t value; + + value = *(volatile u_int16_t *)(handle + offset); + return bswap16(value); +} + +static u_int32_t +rmi_pci_bus_space_read_4(void *tag, bus_space_handle_t handle, + bus_size_t offset) +{ + uint32_t value; + + value = *(volatile u_int32_t *)(handle + offset); + return bswap32(value); +} + +/* + * Read `count' 1, 2, 4, or 8 byte quantities from bus space + * described by tag/handle/offset and copy into buffer provided. + */ +static void +rmi_pci_bus_space_read_multi_1(void *tag, bus_space_handle_t handle, + bus_size_t offset, u_int8_t * addr, size_t count) +{ + while (count--) { + *addr = *(volatile u_int8_t *)(handle + offset); + addr++; + } +} + +static void +rmi_pci_bus_space_read_multi_2(void *tag, bus_space_handle_t handle, + bus_size_t offset, u_int16_t * addr, size_t count) +{ + + while (count--) { + *addr = *(volatile u_int16_t *)(handle + offset); + *addr = bswap16(*addr); + addr++; + } +} + +static void +rmi_pci_bus_space_read_multi_4(void *tag, bus_space_handle_t handle, + bus_size_t offset, u_int32_t * addr, size_t count) +{ + + while (count--) { + *addr = *(volatile u_int32_t *)(handle + offset); + *addr = bswap32(*addr); + addr++; + } +} + +/* + * Write the 1, 2, 4, or 8 byte value `value' to bus space + * described by tag/handle/offset. + */ + +static void +rmi_pci_bus_space_write_1(void *tag, bus_space_handle_t handle, + bus_size_t offset, u_int8_t value) +{ + mips_sync(); + *(volatile u_int8_t *)(handle + offset) = value; +} + +static void +rmi_pci_bus_space_write_2(void *tag, bus_space_handle_t handle, + bus_size_t offset, u_int16_t value) +{ + mips_sync(); + *(volatile u_int16_t *)(handle + offset) = bswap16(value); +} + + +static void +rmi_pci_bus_space_write_4(void *tag, bus_space_handle_t handle, + bus_size_t offset, u_int32_t value) +{ + mips_sync(); + *(volatile u_int32_t *)(handle + offset) = bswap32(value); +} + +/* + * Write `count' 1, 2, 4, or 8 byte quantities from the buffer + * provided to bus space described by tag/handle/offset. + */ + + +static void +rmi_pci_bus_space_write_multi_1(void *tag, bus_space_handle_t handle, + bus_size_t offset, const u_int8_t * addr, size_t count) +{ + mips_sync(); + while (count--) { + (*(volatile u_int8_t *)(handle + offset)) = *addr; + addr++; + } +} + +static void +rmi_pci_bus_space_write_multi_2(void *tag, bus_space_handle_t handle, + bus_size_t offset, const u_int16_t * addr, size_t count) +{ + mips_sync(); + while (count--) { + (*(volatile u_int16_t *)(handle + offset)) = bswap16(*addr); + addr++; + } +} + +static void +rmi_pci_bus_space_write_multi_4(void *tag, bus_space_handle_t handle, + bus_size_t offset, const u_int32_t * addr, size_t count) +{ + mips_sync(); + while (count--) { + (*(volatile u_int32_t *)(handle + offset)) = bswap32(*addr); + addr++; + } +} + +/* + * Write `count' 1, 2, 4, or 8 byte value `val' to bus space described + * by tag/handle starting at `offset'. + */ + +static void +rmi_pci_bus_space_set_region_2(void *t, bus_space_handle_t bsh, + bus_size_t offset, u_int16_t value, size_t count) +{ + bus_addr_t addr = bsh + offset; + + for (; count != 0; count--, addr += 2) + (*(volatile u_int16_t *)(addr)) = value; +} + +static void +rmi_pci_bus_space_set_region_4(void *t, bus_space_handle_t bsh, + bus_size_t offset, u_int32_t value, size_t count) +{ + bus_addr_t addr = bsh + offset; + + for (; count != 0; count--, addr += 4) + (*(volatile u_int32_t *)(addr)) = value; +} + + +/* + * Copy `count' 1, 2, 4, or 8 byte values from bus space starting + * at tag/bsh1/off1 to bus space starting at tag/bsh2/off2. + */ +static void +rmi_pci_bus_space_copy_region_2(void *t, bus_space_handle_t bsh1, + bus_size_t off1, bus_space_handle_t bsh2, + bus_size_t off2, size_t count) +{ + TODO(); +} + +/* + * Read `count' 1, 2, 4, or 8 byte quantities from bus space + * described by tag/handle/offset and copy into buffer provided. + */ + +u_int8_t +rmi_pci_bus_space_read_stream_1(void *t, bus_space_handle_t handle, + bus_size_t offset) +{ + + return *((volatile u_int8_t *)(handle + offset)); +} + + +static u_int16_t +rmi_pci_bus_space_read_stream_2(void *t, bus_space_handle_t handle, + bus_size_t offset) +{ + return *(volatile u_int16_t *)(handle + offset); +} + + +static u_int32_t +rmi_pci_bus_space_read_stream_4(void *t, bus_space_handle_t handle, + bus_size_t offset) +{ + return (*(volatile u_int32_t *)(handle + offset)); +} + + +static void +rmi_pci_bus_space_read_multi_stream_1(void *tag, bus_space_handle_t handle, + bus_size_t offset, u_int8_t * addr, size_t count) +{ + while (count--) { + *addr = (*(volatile u_int8_t *)(handle + offset)); + addr++; + } +} + +static void +rmi_pci_bus_space_read_multi_stream_2(void *tag, bus_space_handle_t handle, + bus_size_t offset, u_int16_t * addr, size_t count) +{ + while (count--) { + *addr = (*(volatile u_int16_t *)(handle + offset)); + addr++; + } +} + +static void +rmi_pci_bus_space_read_multi_stream_4(void *tag, bus_space_handle_t handle, + bus_size_t offset, u_int32_t * addr, size_t count) +{ + while (count--) { + *addr = (*(volatile u_int32_t *)(handle + offset)); + addr++; + } +} + + + +/* + * Read `count' 1, 2, 4, or 8 byte quantities from bus space + * described by tag/handle and starting at `offset' and copy into + * buffer provided. + */ +void +rmi_pci_bus_space_read_region_1(void *t, bus_space_handle_t bsh, + bus_size_t offset, u_int8_t * addr, size_t count) +{ + bus_addr_t baddr = bsh + offset; + + while (count--) { + *addr++ = (*(volatile u_int8_t *)(baddr)); + baddr += 1; + } +} + +void +rmi_pci_bus_space_read_region_2(void *t, bus_space_handle_t bsh, + bus_size_t offset, u_int16_t * addr, size_t count) +{ + bus_addr_t baddr = bsh + offset; + + while (count--) { + *addr++ = (*(volatile u_int16_t *)(baddr)); + baddr += 2; + } +} + +void +rmi_pci_bus_space_read_region_4(void *t, bus_space_handle_t bsh, + bus_size_t offset, u_int32_t * addr, size_t count) +{ + bus_addr_t baddr = bsh + offset; + + while (count--) { + *addr++ = (*(volatile u_int32_t *)(baddr)); + baddr += 4; + } +} + + +void +rmi_pci_bus_space_write_stream_1(void *t, bus_space_handle_t handle, + bus_size_t offset, u_int8_t value) +{ + mips_sync(); + *(volatile u_int8_t *)(handle + offset) = value; +} + +static void +rmi_pci_bus_space_write_stream_2(void *t, bus_space_handle_t handle, + bus_size_t offset, u_int16_t value) +{ + mips_sync(); + *(volatile u_int16_t *)(handle + offset) = value; +} + + +static void +rmi_pci_bus_space_write_stream_4(void *t, bus_space_handle_t handle, + bus_size_t offset, u_int32_t value) +{ + mips_sync(); + *(volatile u_int32_t *)(handle + offset) = value; +} + + +static void +rmi_pci_bus_space_write_multi_stream_1(void *tag, bus_space_handle_t handle, + bus_size_t offset, const u_int8_t * addr, size_t count) +{ + mips_sync(); + while (count--) { + (*(volatile u_int8_t *)(handle + offset)) = *addr; + addr++; + } +} + +static void +rmi_pci_bus_space_write_multi_stream_2(void *tag, bus_space_handle_t handle, + bus_size_t offset, const u_int16_t * addr, size_t count) +{ + mips_sync(); + while (count--) { + (*(volatile u_int16_t *)(handle + offset)) = *addr; + addr++; + } +} + +static void +rmi_pci_bus_space_write_multi_stream_4(void *tag, bus_space_handle_t handle, + bus_size_t offset, const u_int32_t * addr, size_t count) +{ + mips_sync(); + while (count--) { + (*(volatile u_int32_t *)(handle + offset)) = *addr; + addr++; + } +} + +void +rmi_pci_bus_space_write_region_2(void *t, + bus_space_handle_t bsh, + bus_size_t offset, + const u_int16_t * addr, + size_t count) +{ + bus_addr_t baddr = (bus_addr_t) bsh + offset; + + while (count--) { + (*(volatile u_int16_t *)(baddr)) = *addr; + addr++; + baddr += 2; + } +} + +void +rmi_pci_bus_space_write_region_4(void *t, bus_space_handle_t bsh, + bus_size_t offset, const u_int32_t * addr, size_t count) +{ + bus_addr_t baddr = bsh + offset; + + while (count--) { + (*(volatile u_int32_t *)(baddr)) = *addr; + addr++; + baddr += 4; + } +} + +static void +rmi_pci_bus_space_barrier(void *tag __unused, bus_space_handle_t bsh __unused, + bus_size_t offset __unused, bus_size_t len __unused, int flags) +{ + +} Modified: head/sys/mips/nlm/clock.h ============================================================================== --- head/sys/mips/nlm/clock.h Mon Sep 5 10:09:53 2011 (r225393) +++ head/sys/mips/nlm/clock.h Mon Sep 5 10:45:29 2011 (r225394) @@ -25,8 +25,9 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * + * NETLOGIC_BSD * $FreeBSD$ - * NETLOGIC_BSD */ + */ #ifndef _RMI_CLOCK_H_ #define _RMI_CLOCK_H_ Modified: head/sys/mips/nlm/cms.c ============================================================================== --- head/sys/mips/nlm/cms.c Mon Sep 5 10:09:53 2011 (r225393) +++ head/sys/mips/nlm/cms.c Mon Sep 5 10:45:29 2011 (r225394) @@ -56,9 +56,8 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include -#include #include #include #include @@ -108,7 +107,7 @@ xlp_msgring_config(void) int i; /* TODO: Add other nodes */ - xlp_cms_base = nlm_regbase_cms(0); + xlp_cms_base = nlm_get_cms_regbase(0); mtx_init(&msgmap_lock, "msgring", NULL, MTX_SPIN); if (xlp_threads_per_core < xlp_msg_threads_per_core) @@ -147,62 +146,58 @@ xlp_msgring_iodi_config(void) void nlm_cms_credit_setup(int credit) { - int src, qid, i; + int src, qid, i; #if 0 - /* there are a total of 18 src stations on XLP. */ + /* there are a total of 18 src stations on XLP. */ printf("Setting up CMS credits!\n"); - for(src=0; src<18; src++) { - for(qid=0; qid<1024; qid++) { - nlm_cms_setup_credits(xlp_cms_base, qid, src, credit); - } - } + for (src=0; src<18; src++) { + for(qid=0; qid<1024; qid++) { + nlm_cms_setup_credits(xlp_cms_base, qid, src, credit); + } + } #endif printf("Setting up CMS credits!\n"); /* CPU Credits */ - for(i = 1; i < 8; i++) { + for (i = 1; i < 8; i++) { src = (i << 4); - for(qid = 0; qid < 1024; qid++) { - nlm_cms_setup_credits(xlp_cms_base, qid, src, credit); - } - } + for (qid = 0; qid < 1024; qid++) + nlm_cms_setup_credits(xlp_cms_base, qid, src, credit); + } /* PCIE Credits */ - for(i = 0; i < 4; i++) { + for(i = 0; i < 4; i++) { src = (256 + (i * 2)); - for(qid = 0; qid < 1024; qid++) { - nlm_cms_setup_credits(xlp_cms_base, qid, src, credit); - } - } + for(qid = 0; qid < 1024; qid++) + nlm_cms_setup_credits(xlp_cms_base, qid, src, credit); + } /* DTE Credits */ src = 264; - for(qid = 0; qid < 1024; qid++) { - nlm_cms_setup_credits(xlp_cms_base, qid, src, credit); - } + for (qid = 0; qid < 1024; qid++) + nlm_cms_setup_credits(xlp_cms_base, qid, src, credit); /* RSA Credits */ src = 272; - for(qid = 0; qid < 1024; qid++) { - nlm_cms_setup_credits(xlp_cms_base, qid, src, credit); - } + for (qid = 0; qid < 1024; qid++) + nlm_cms_setup_credits(xlp_cms_base, qid, src, credit); + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Mon Sep 5 11:08:34 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 872701065672; Mon, 5 Sep 2011 11:08:34 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 75AE88FC23; Mon, 5 Sep 2011 11:08:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p85B8Ygt035325; Mon, 5 Sep 2011 11:08:34 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p85B8YTm035323; Mon, 5 Sep 2011 11:08:34 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201109051108.p85B8YTm035323@svn.freebsd.org> From: Ed Schouten Date: Mon, 5 Sep 2011 11:08:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225395 - stable/8/etc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Sep 2011 11:08:34 -0000 Author: ed Date: Mon Sep 5 11:08:33 2011 New Revision: 225395 URL: http://svn.freebsd.org/changeset/base/225395 Log: MFC r224659, r224674 and r224765: Remove NIS entries from /etc/nsswitch.conf for WITHOUT_NIS. We already modify various configuration files in /etc based on build configuration. This is not done for nsswitch.conf right now when setting WITHOUT_NIS. This breaks various utilities, including crond, that depend on working databases. Modified: stable/8/etc/Makefile Directory Properties: stable/8/etc/ (props changed) Modified: stable/8/etc/Makefile ============================================================================== --- stable/8/etc/Makefile Mon Sep 5 10:45:29 2011 (r225394) +++ stable/8/etc/Makefile Mon Sep 5 11:08:33 2011 (r225395) @@ -252,6 +252,10 @@ distribution: ${DESTDIR}/boot/device.hints .endif .endif +.if ${MK_NIS} == "no" + sed -i "" -e 's/.*_compat:/# &/' -e 's/compat$$/files/' \ + ${DESTDIR}/etc/nsswitch.conf +.endif distrib-dirs: mtree -eU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/mtree/BSD.root.dist -p ${DESTDIR}/ From owner-svn-src-all@FreeBSD.ORG Mon Sep 5 12:36:11 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1908C106566B; Mon, 5 Sep 2011 12:36:11 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E188C8FC08; Mon, 5 Sep 2011 12:36:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p85CaA6x038019; Mon, 5 Sep 2011 12:36:10 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p85CaAVa038017; Mon, 5 Sep 2011 12:36:10 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201109051236.p85CaAVa038017@svn.freebsd.org> From: Marius Strobl Date: Mon, 5 Sep 2011 12:36:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225396 - stable/8/tools/tools/netrate/netsend X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Sep 2011 12:36:11 -0000 Author: marius Date: Mon Sep 5 12:36:10 2011 New Revision: 225396 URL: http://svn.freebsd.org/changeset/base/225396 Log: MFC: r198132 A small change to avoid calling gettimeofday() too often (hardwired to once every 20us at most). Modified: stable/8/tools/tools/netrate/netsend/netsend.c Directory Properties: stable/8/tools/tools/netrate/netsend/ (props changed) Modified: stable/8/tools/tools/netrate/netsend/netsend.c ============================================================================== --- stable/8/tools/tools/netrate/netsend/netsend.c Mon Sep 5 11:08:33 2011 (r225395) +++ stable/8/tools/tools/netrate/netsend/netsend.c Mon Sep 5 12:36:10 2011 (r225396) @@ -124,6 +124,9 @@ timing_loop(int s, struct timespec inter u_int32_t counter; long finishtime; long send_errors, send_calls; + /* do not call gettimeofday more than every 20us */ + long minres_ns = 20000; + int ic, gettimeofday_cycles; if (clock_getres(CLOCK_REALTIME, &tmptime) == -1) { perror("clock_getres"); @@ -132,8 +135,15 @@ timing_loop(int s, struct timespec inter if (timespec_ge(&tmptime, &interval)) fprintf(stderr, - "warning: interval less than resolution (%jd.%09ld)\n", + "warning: interval (%jd.%09ld) less than resolution (%jd.%09ld)\n", + (intmax_t)interval.tv_sec, interval.tv_nsec, (intmax_t)tmptime.tv_sec, tmptime.tv_nsec); + if (tmptime.tv_nsec < minres_ns) { + gettimeofday_cycles = minres_ns/(tmptime.tv_nsec + 1); + fprintf(stderr, + "calling time every %d cycles\n", gettimeofday_cycles); + } else + gettimeofday_cycles = 0; if (clock_gettime(CLOCK_REALTIME, &starttime) == -1) { perror("clock_gettime"); @@ -151,10 +161,14 @@ timing_loop(int s, struct timespec inter send_errors = send_calls = 0; counter = 0; waited = 0; + ic = gettimeofday_cycles; while (1) { timespec_add(&nexttime, &interval); - if (wait_time(nexttime, &tmptime, &waited) == -1) - return (-1); + if (--ic <= 0) { + ic = gettimeofday_cycles; + if (wait_time(nexttime, &tmptime, &waited) == -1) + return (-1); + } /* * We maintain and, if there's room, send a counter. Note * that even if the error is purely local, we still increment @@ -236,8 +250,9 @@ main(int argc, char *argv[]) /* * Specify an arbitrary limit. It's exactly that, not selected by - .* any particular strategy. '0' is a special value meaning "blast", + * any particular strategy. '0' is a special value meaning "blast", * and avoids the cost of a timing loop. + * XXX 0 is not actually implemented. */ rate = strtoul(argv[4], &dummy, 10); if (rate < 1 || *dummy != '\0') From owner-svn-src-all@FreeBSD.ORG Mon Sep 5 12:36:12 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1DB5A106564A; Mon, 5 Sep 2011 12:36:12 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E65608FC0A; Mon, 5 Sep 2011 12:36:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p85CaBi4038052; Mon, 5 Sep 2011 12:36:11 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p85CaBeL038050; Mon, 5 Sep 2011 12:36:11 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201109051236.p85CaBeL038050@svn.freebsd.org> From: Marius Strobl Date: Mon, 5 Sep 2011 12:36:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225397 - stable/7/tools/tools/netrate/netsend X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Sep 2011 12:36:12 -0000 Author: marius Date: Mon Sep 5 12:36:11 2011 New Revision: 225397 URL: http://svn.freebsd.org/changeset/base/225397 Log: MFC: r198132 A small change to avoid calling gettimeofday() too often (hardwired to once every 20us at most). Modified: stable/7/tools/tools/netrate/netsend/netsend.c Directory Properties: stable/7/tools/tools/netrate/netsend/ (props changed) Modified: stable/7/tools/tools/netrate/netsend/netsend.c ============================================================================== --- stable/7/tools/tools/netrate/netsend/netsend.c Mon Sep 5 12:36:10 2011 (r225396) +++ stable/7/tools/tools/netrate/netsend/netsend.c Mon Sep 5 12:36:11 2011 (r225397) @@ -124,6 +124,9 @@ timing_loop(int s, struct timespec inter u_int32_t counter; long finishtime; long send_errors, send_calls; + /* do not call gettimeofday more than every 20us */ + long minres_ns = 20000; + int ic, gettimeofday_cycles; if (clock_getres(CLOCK_REALTIME, &tmptime) == -1) { perror("clock_getres"); @@ -132,8 +135,15 @@ timing_loop(int s, struct timespec inter if (timespec_ge(&tmptime, &interval)) fprintf(stderr, - "warning: interval less than resolution (%jd.%09ld)\n", + "warning: interval (%jd.%09ld) less than resolution (%jd.%09ld)\n", + (intmax_t)interval.tv_sec, interval.tv_nsec, (intmax_t)tmptime.tv_sec, tmptime.tv_nsec); + if (tmptime.tv_nsec < minres_ns) { + gettimeofday_cycles = minres_ns/(tmptime.tv_nsec + 1); + fprintf(stderr, + "calling time every %d cycles\n", gettimeofday_cycles); + } else + gettimeofday_cycles = 0; if (clock_gettime(CLOCK_REALTIME, &starttime) == -1) { perror("clock_gettime"); @@ -151,10 +161,14 @@ timing_loop(int s, struct timespec inter send_errors = send_calls = 0; counter = 0; waited = 0; + ic = gettimeofday_cycles; while (1) { timespec_add(&nexttime, &interval); - if (wait_time(nexttime, &tmptime, &waited) == -1) - return (-1); + if (--ic <= 0) { + ic = gettimeofday_cycles; + if (wait_time(nexttime, &tmptime, &waited) == -1) + return (-1); + } /* * We maintain and, if there's room, send a counter. Note * that even if the error is purely local, we still increment @@ -236,8 +250,9 @@ main(int argc, char *argv[]) /* * Specify an arbitrary limit. It's exactly that, not selected by - .* any particular strategy. '0' is a special value meaning "blast", + * any particular strategy. '0' is a special value meaning "blast", * and avoids the cost of a timing loop. + * XXX 0 is not actually implemented. */ rate = strtoul(argv[4], &dummy, 10); if (rate < 1 || *dummy != '\0') From owner-svn-src-all@FreeBSD.ORG Mon Sep 5 12:39:15 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 092E1106564A; Mon, 5 Sep 2011 12:39:15 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EA0EE8FC17; Mon, 5 Sep 2011 12:39:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p85CdE7G038201; Mon, 5 Sep 2011 12:39:14 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p85CdEQG038199; Mon, 5 Sep 2011 12:39:14 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201109051239.p85CdEQG038199@svn.freebsd.org> From: Marius Strobl Date: Mon, 5 Sep 2011 12:39:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225398 - stable/8/tools/tools/netrate/netsend X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Sep 2011 12:39:15 -0000 Author: marius Date: Mon Sep 5 12:39:14 2011 New Revision: 225398 URL: http://svn.freebsd.org/changeset/base/225398 Log: MFC: r198136 Support the specification of a range of destination ports e.g. netsend 127.0.0.1 6666-7777 [payloadsize] [packet_rate] [duration] Modified: stable/8/tools/tools/netrate/netsend/netsend.c Directory Properties: stable/8/tools/tools/netrate/netsend/ (props changed) Modified: stable/8/tools/tools/netrate/netsend/netsend.c ============================================================================== --- stable/8/tools/tools/netrate/netsend/netsend.c Mon Sep 5 12:36:11 2011 (r225397) +++ stable/8/tools/tools/netrate/netsend/netsend.c Mon Sep 5 12:39:14 2011 (r225398) @@ -39,12 +39,23 @@ #include #include +/* program arguments */ +struct _a { + int s; + struct timespec interval; + int port, port_max; + long duration; + struct sockaddr_in sin; + int packet_len; + void *packet; +}; + static void usage(void) { fprintf(stderr, - "netsend [ip] [port] [payloadsize] [rate] [duration]\n"); + "netsend [ip] [port[-port_max]] [payloadsize] [packet_rate] [duration]\n"); exit(-1); } @@ -114,10 +125,12 @@ wait_time(struct timespec ts, struct tim * Calculate a second-aligned starting time for the packet stream. Busy * wait between our calculated interval and dropping the provided packet * into the socket. If we hit our duration limit, bail. + * We sweep the ports from a->port to a->port_max included. + * If the two ports are the same we connect() the socket upfront, which + * almost halves the cost of the sendto() call. */ static int -timing_loop(int s, struct timespec interval, long duration, u_char *packet, - u_int packet_len) +timing_loop(struct _a *a) { struct timespec nexttime, starttime, tmptime; long long waited; @@ -127,18 +140,19 @@ timing_loop(int s, struct timespec inter /* do not call gettimeofday more than every 20us */ long minres_ns = 20000; int ic, gettimeofday_cycles; + int cur_port; if (clock_getres(CLOCK_REALTIME, &tmptime) == -1) { perror("clock_getres"); return (-1); } - if (timespec_ge(&tmptime, &interval)) + if (timespec_ge(&tmptime, &a->interval)) fprintf(stderr, "warning: interval (%jd.%09ld) less than resolution (%jd.%09ld)\n", - (intmax_t)interval.tv_sec, interval.tv_nsec, + (intmax_t)a->interval.tv_sec, a->interval.tv_nsec, (intmax_t)tmptime.tv_sec, tmptime.tv_nsec); - if (tmptime.tv_nsec < minres_ns) { + if (a->interval.tv_nsec < minres_ns) { gettimeofday_cycles = minres_ns/(tmptime.tv_nsec + 1); fprintf(stderr, "calling time every %d cycles\n", gettimeofday_cycles); @@ -156,14 +170,23 @@ timing_loop(int s, struct timespec inter if (wait_time(starttime, NULL, NULL) == -1) return (-1); nexttime = starttime; - finishtime = starttime.tv_sec + duration; + finishtime = starttime.tv_sec + a->duration; send_errors = send_calls = 0; counter = 0; waited = 0; ic = gettimeofday_cycles; + cur_port = a->port; + if (a->port == a->port_max) { + if (connect(a->s, (struct sockaddr *)&a->sin, sizeof(a->sin))) { + perror("connect"); + return (-1); + } + } while (1) { - timespec_add(&nexttime, &interval); + int ret; + + timespec_add(&nexttime, &a->interval); if (--ic <= 0) { ic = gettimeofday_cycles; if (wait_time(nexttime, &tmptime, &waited) == -1) @@ -178,17 +201,28 @@ timing_loop(int s, struct timespec inter * previous send, the error will turn up the current send * operation, causing the current sequence number also to be * skipped. + * The counter is incremented only on the initial port number, + * so all destinations will see the same set of packets. * * XXXRW: Note alignment assumption. */ - if (packet_len >= 4) { - *((u_int32_t *)packet) = htonl(counter); + if (cur_port == a->port && a->packet_len >= 4) { + *((u_int32_t *)a->packet) = htonl(counter); counter++; } - if (send(s, packet, packet_len, 0) < 0) + if (a->port == a->port_max) { /* socket already bound */ + ret = send(a->s, a->packet, a->packet_len, 0); + } else { + a->sin.sin_port = htons(cur_port++); + if (cur_port > a->port_max) + cur_port = a->port; + ret = sendto(a->s, a->packet, a->packet_len, 0, + (struct sockaddr *)&a->sin, sizeof(a->sin)); + } + if (ret < 0) send_errors++; send_calls++; - if (duration != 0 && tmptime.tv_sec >= finishtime) + if (a->duration != 0 && tmptime.tv_sec >= finishtime) goto done; } @@ -205,11 +239,11 @@ done: tmptime.tv_nsec); printf("send calls: %ld\n", send_calls); printf("send errors: %ld\n", send_errors); - printf("approx send rate: %ld\n", (send_calls - send_errors) / - duration); + printf("approx send rate: %ld pps\n", (send_calls - send_errors) / + a->duration); printf("approx error rate: %ld\n", (send_errors / send_calls)); printf("waited: %lld\n", waited); - printf("approx waits/sec: %lld\n", (long long)(waited / duration)); + printf("approx waits/sec: %lld\n", (long long)(waited / a->duration)); printf("approx wait rate: %lld\n", (long long)(waited / send_calls)); return (0); @@ -218,27 +252,35 @@ done: int main(int argc, char *argv[]) { - long rate, payloadsize, port, duration; - struct timespec interval; - struct sockaddr_in sin; - char *dummy, *packet; - int s; + long rate, payloadsize, port; + char *dummy; + struct _a a; /* arguments */ + + bzero(&a, sizeof(a)); if (argc != 6) usage(); - bzero(&sin, sizeof(sin)); - sin.sin_len = sizeof(sin); - sin.sin_family = AF_INET; - if (inet_aton(argv[1], &sin.sin_addr) == 0) { + a.sin.sin_len = sizeof(a.sin); + a.sin.sin_family = AF_INET; + if (inet_aton(argv[1], &a.sin.sin_addr) == 0) { perror(argv[1]); return (-1); } port = strtoul(argv[2], &dummy, 10); - if (port < 1 || port > 65535 || *dummy != '\0') + if (port < 1 || port > 65535) usage(); - sin.sin_port = htons(port); + if (*dummy != '\0' && *dummy != '-') + usage(); + a.sin.sin_port = htons(port); + a.port = a.port_max = port; + if (*dummy == '-') { /* set high port */ + port = strtoul(dummy + 1, &dummy, 10); + if (port < a.port || port > 65535) + usage(); + a.port_max = port; + } payloadsize = strtoul(argv[3], &dummy, 10); if (payloadsize < 0 || *dummy != '\0') @@ -247,56 +289,51 @@ main(int argc, char *argv[]) fprintf(stderr, "payloadsize > 32768\n"); return (-1); } + a.packet_len = payloadsize; /* * Specify an arbitrary limit. It's exactly that, not selected by * any particular strategy. '0' is a special value meaning "blast", * and avoids the cost of a timing loop. - * XXX 0 is not actually implemented. */ rate = strtoul(argv[4], &dummy, 10); - if (rate < 1 || *dummy != '\0') + if (rate < 0 || *dummy != '\0') usage(); if (rate > MAX_RATE) { - fprintf(stderr, "rate > %d\n", MAX_RATE); + fprintf(stderr, "packet rate at most %d\n", MAX_RATE); return (-1); } - duration = strtoul(argv[5], &dummy, 10); - if (duration < 0 || *dummy != '\0') + a.duration = strtoul(argv[5], &dummy, 10); + if (a.duration < 0 || *dummy != '\0') usage(); - packet = malloc(payloadsize); - if (packet == NULL) { + a.packet = malloc(payloadsize); + if (a.packet == NULL) { perror("malloc"); return (-1); } - bzero(packet, payloadsize); - + bzero(a.packet, payloadsize); if (rate == 0) { - interval.tv_sec = 0; - interval.tv_nsec = 0; + a.interval.tv_sec = 0; + a.interval.tv_nsec = 0; } else if (rate == 1) { - interval.tv_sec = 1; - interval.tv_nsec = 0; + a.interval.tv_sec = 1; + a.interval.tv_nsec = 0; } else { - interval.tv_sec = 0; - interval.tv_nsec = ((1 * 1000000000) / rate); + a.interval.tv_sec = 0; + a.interval.tv_nsec = ((1 * 1000000000) / rate); } + printf("Sending packet of payload size %ld every %jd.%09lds for %ld " - "seconds\n", payloadsize, (intmax_t)interval.tv_sec, - interval.tv_nsec, duration); + "seconds\n", payloadsize, (intmax_t)a.interval.tv_sec, + a.interval.tv_nsec, a.duration); - s = socket(PF_INET, SOCK_DGRAM, 0); - if (s == -1) { + a.s = socket(PF_INET, SOCK_DGRAM, 0); + if (a.s == -1) { perror("socket"); return (-1); } - if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) { - perror("connect"); - return (-1); - } - - return (timing_loop(s, interval, duration, packet, payloadsize)); + return (timing_loop(&a)); } From owner-svn-src-all@FreeBSD.ORG Mon Sep 5 12:39:16 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 519261065670; Mon, 5 Sep 2011 12:39:16 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3E7D28FC18; Mon, 5 Sep 2011 12:39:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p85CdGZK038234; Mon, 5 Sep 2011 12:39:16 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p85CdGs4038232; Mon, 5 Sep 2011 12:39:16 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201109051239.p85CdGs4038232@svn.freebsd.org> From: Marius Strobl Date: Mon, 5 Sep 2011 12:39:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225399 - stable/7/tools/tools/netrate/netsend X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Sep 2011 12:39:16 -0000 Author: marius Date: Mon Sep 5 12:39:15 2011 New Revision: 225399 URL: http://svn.freebsd.org/changeset/base/225399 Log: MFC: r198136 Support the specification of a range of destination ports e.g. netsend 127.0.0.1 6666-7777 [payloadsize] [packet_rate] [duration] Modified: stable/7/tools/tools/netrate/netsend/netsend.c Directory Properties: stable/7/tools/tools/netrate/netsend/ (props changed) Modified: stable/7/tools/tools/netrate/netsend/netsend.c ============================================================================== --- stable/7/tools/tools/netrate/netsend/netsend.c Mon Sep 5 12:39:14 2011 (r225398) +++ stable/7/tools/tools/netrate/netsend/netsend.c Mon Sep 5 12:39:15 2011 (r225399) @@ -39,12 +39,23 @@ #include #include +/* program arguments */ +struct _a { + int s; + struct timespec interval; + int port, port_max; + long duration; + struct sockaddr_in sin; + int packet_len; + void *packet; +}; + static void usage(void) { fprintf(stderr, - "netsend [ip] [port] [payloadsize] [rate] [duration]\n"); + "netsend [ip] [port[-port_max]] [payloadsize] [packet_rate] [duration]\n"); exit(-1); } @@ -114,10 +125,12 @@ wait_time(struct timespec ts, struct tim * Calculate a second-aligned starting time for the packet stream. Busy * wait between our calculated interval and dropping the provided packet * into the socket. If we hit our duration limit, bail. + * We sweep the ports from a->port to a->port_max included. + * If the two ports are the same we connect() the socket upfront, which + * almost halves the cost of the sendto() call. */ static int -timing_loop(int s, struct timespec interval, long duration, u_char *packet, - u_int packet_len) +timing_loop(struct _a *a) { struct timespec nexttime, starttime, tmptime; long long waited; @@ -127,18 +140,19 @@ timing_loop(int s, struct timespec inter /* do not call gettimeofday more than every 20us */ long minres_ns = 20000; int ic, gettimeofday_cycles; + int cur_port; if (clock_getres(CLOCK_REALTIME, &tmptime) == -1) { perror("clock_getres"); return (-1); } - if (timespec_ge(&tmptime, &interval)) + if (timespec_ge(&tmptime, &a->interval)) fprintf(stderr, "warning: interval (%jd.%09ld) less than resolution (%jd.%09ld)\n", - (intmax_t)interval.tv_sec, interval.tv_nsec, + (intmax_t)a->interval.tv_sec, a->interval.tv_nsec, (intmax_t)tmptime.tv_sec, tmptime.tv_nsec); - if (tmptime.tv_nsec < minres_ns) { + if (a->interval.tv_nsec < minres_ns) { gettimeofday_cycles = minres_ns/(tmptime.tv_nsec + 1); fprintf(stderr, "calling time every %d cycles\n", gettimeofday_cycles); @@ -156,14 +170,23 @@ timing_loop(int s, struct timespec inter if (wait_time(starttime, NULL, NULL) == -1) return (-1); nexttime = starttime; - finishtime = starttime.tv_sec + duration; + finishtime = starttime.tv_sec + a->duration; send_errors = send_calls = 0; counter = 0; waited = 0; ic = gettimeofday_cycles; + cur_port = a->port; + if (a->port == a->port_max) { + if (connect(a->s, (struct sockaddr *)&a->sin, sizeof(a->sin))) { + perror("connect"); + return (-1); + } + } while (1) { - timespec_add(&nexttime, &interval); + int ret; + + timespec_add(&nexttime, &a->interval); if (--ic <= 0) { ic = gettimeofday_cycles; if (wait_time(nexttime, &tmptime, &waited) == -1) @@ -178,17 +201,28 @@ timing_loop(int s, struct timespec inter * previous send, the error will turn up the current send * operation, causing the current sequence number also to be * skipped. + * The counter is incremented only on the initial port number, + * so all destinations will see the same set of packets. * * XXXRW: Note alignment assumption. */ - if (packet_len >= 4) { - *((u_int32_t *)packet) = htonl(counter); + if (cur_port == a->port && a->packet_len >= 4) { + *((u_int32_t *)a->packet) = htonl(counter); counter++; } - if (send(s, packet, packet_len, 0) < 0) + if (a->port == a->port_max) { /* socket already bound */ + ret = send(a->s, a->packet, a->packet_len, 0); + } else { + a->sin.sin_port = htons(cur_port++); + if (cur_port > a->port_max) + cur_port = a->port; + ret = sendto(a->s, a->packet, a->packet_len, 0, + (struct sockaddr *)&a->sin, sizeof(a->sin)); + } + if (ret < 0) send_errors++; send_calls++; - if (duration != 0 && tmptime.tv_sec >= finishtime) + if (a->duration != 0 && tmptime.tv_sec >= finishtime) goto done; } @@ -205,11 +239,11 @@ done: tmptime.tv_nsec); printf("send calls: %ld\n", send_calls); printf("send errors: %ld\n", send_errors); - printf("approx send rate: %ld\n", (send_calls - send_errors) / - duration); + printf("approx send rate: %ld pps\n", (send_calls - send_errors) / + a->duration); printf("approx error rate: %ld\n", (send_errors / send_calls)); printf("waited: %lld\n", waited); - printf("approx waits/sec: %lld\n", (long long)(waited / duration)); + printf("approx waits/sec: %lld\n", (long long)(waited / a->duration)); printf("approx wait rate: %lld\n", (long long)(waited / send_calls)); return (0); @@ -218,27 +252,35 @@ done: int main(int argc, char *argv[]) { - long rate, payloadsize, port, duration; - struct timespec interval; - struct sockaddr_in sin; - char *dummy, *packet; - int s; + long rate, payloadsize, port; + char *dummy; + struct _a a; /* arguments */ + + bzero(&a, sizeof(a)); if (argc != 6) usage(); - bzero(&sin, sizeof(sin)); - sin.sin_len = sizeof(sin); - sin.sin_family = AF_INET; - if (inet_aton(argv[1], &sin.sin_addr) == 0) { + a.sin.sin_len = sizeof(a.sin); + a.sin.sin_family = AF_INET; + if (inet_aton(argv[1], &a.sin.sin_addr) == 0) { perror(argv[1]); return (-1); } port = strtoul(argv[2], &dummy, 10); - if (port < 1 || port > 65535 || *dummy != '\0') + if (port < 1 || port > 65535) usage(); - sin.sin_port = htons(port); + if (*dummy != '\0' && *dummy != '-') + usage(); + a.sin.sin_port = htons(port); + a.port = a.port_max = port; + if (*dummy == '-') { /* set high port */ + port = strtoul(dummy + 1, &dummy, 10); + if (port < a.port || port > 65535) + usage(); + a.port_max = port; + } payloadsize = strtoul(argv[3], &dummy, 10); if (payloadsize < 0 || *dummy != '\0') @@ -247,56 +289,51 @@ main(int argc, char *argv[]) fprintf(stderr, "payloadsize > 32768\n"); return (-1); } + a.packet_len = payloadsize; /* * Specify an arbitrary limit. It's exactly that, not selected by * any particular strategy. '0' is a special value meaning "blast", * and avoids the cost of a timing loop. - * XXX 0 is not actually implemented. */ rate = strtoul(argv[4], &dummy, 10); - if (rate < 1 || *dummy != '\0') + if (rate < 0 || *dummy != '\0') usage(); if (rate > MAX_RATE) { - fprintf(stderr, "rate > %d\n", MAX_RATE); + fprintf(stderr, "packet rate at most %d\n", MAX_RATE); return (-1); } - duration = strtoul(argv[5], &dummy, 10); - if (duration < 0 || *dummy != '\0') + a.duration = strtoul(argv[5], &dummy, 10); + if (a.duration < 0 || *dummy != '\0') usage(); - packet = malloc(payloadsize); - if (packet == NULL) { + a.packet = malloc(payloadsize); + if (a.packet == NULL) { perror("malloc"); return (-1); } - bzero(packet, payloadsize); - + bzero(a.packet, payloadsize); if (rate == 0) { - interval.tv_sec = 0; - interval.tv_nsec = 0; + a.interval.tv_sec = 0; + a.interval.tv_nsec = 0; } else if (rate == 1) { - interval.tv_sec = 1; - interval.tv_nsec = 0; + a.interval.tv_sec = 1; + a.interval.tv_nsec = 0; } else { - interval.tv_sec = 0; - interval.tv_nsec = ((1 * 1000000000) / rate); + a.interval.tv_sec = 0; + a.interval.tv_nsec = ((1 * 1000000000) / rate); } + printf("Sending packet of payload size %ld every %jd.%09lds for %ld " - "seconds\n", payloadsize, (intmax_t)interval.tv_sec, - interval.tv_nsec, duration); + "seconds\n", payloadsize, (intmax_t)a.interval.tv_sec, + a.interval.tv_nsec, a.duration); - s = socket(PF_INET, SOCK_DGRAM, 0); - if (s == -1) { + a.s = socket(PF_INET, SOCK_DGRAM, 0); + if (a.s == -1) { perror("socket"); return (-1); } - if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) { - perror("connect"); - return (-1); - } - - return (timing_loop(s, interval, duration, packet, payloadsize)); + return (timing_loop(&a)); } From owner-svn-src-all@FreeBSD.ORG Mon Sep 5 14:37:59 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8E625106564A; Mon, 5 Sep 2011 14:37:59 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 652B48FC1E; Mon, 5 Sep 2011 14:37:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p85Ebxjp041816; Mon, 5 Sep 2011 14:37:59 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p85Ebxj3041814; Mon, 5 Sep 2011 14:37:59 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201109051437.p85Ebxj3041814@svn.freebsd.org> From: Hans Petter Selasky Date: Mon, 5 Sep 2011 14:37:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225400 - head/sys/dev/usb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Sep 2011 14:37:59 -0000 Author: hselasky Date: Mon Sep 5 14:37:59 2011 New Revision: 225400 URL: http://svn.freebsd.org/changeset/base/225400 Log: Some USB mass storage devices requires that the sense information is retrieved after a failed SCSI command to continue normal operation. Else this sense information is retrived at the next SCSI command. Approved by: re (kib) Reported by: Alex Kozlov MFC after: 1 week PR: usb/160299 Modified: head/sys/dev/usb/usb_msctest.c Modified: head/sys/dev/usb/usb_msctest.c ============================================================================== --- head/sys/dev/usb/usb_msctest.c Mon Sep 5 12:39:15 2011 (r225399) +++ head/sys/dev/usb/usb_msctest.c Mon Sep 5 14:37:59 2011 (r225400) @@ -1,6 +1,6 @@ /* $FreeBSD$ */ /*- - * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. + * Copyright (c) 2008,2011 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -83,7 +83,10 @@ enum { DIR_NONE, }; +#define SCSI_MAX_LEN 0x100 #define SCSI_INQ_LEN 0x24 +#define SCSI_SENSE_LEN 0xFF + static uint8_t scsi_test_unit_ready[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; static uint8_t scsi_inquiry[] = { 0x12, 0x00, 0x00, 0x00, SCSI_INQ_LEN, 0x00 }; static uint8_t scsi_rezero_init[] = { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 }; @@ -98,6 +101,8 @@ static uint8_t scsi_huawei_eject[] = { 0 static uint8_t scsi_tct_eject[] = { 0x06, 0xf5, 0x04, 0x02, 0x52, 0x70 }; static uint8_t scsi_sync_cache[] = { 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +static uint8_t scsi_request_sense[] = { 0x03, 0x00, 0x00, 0x00, 0x12, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; #define BULK_SIZE 64 /* dummy */ #define ERR_CSW_FAILED -1 @@ -151,7 +156,7 @@ struct bbb_transfer { uint8_t status_try; int error; - uint8_t buffer[256]; + uint8_t buffer[SCSI_MAX_LEN] __aligned(4); }; static usb_callback_t bbb_command_callback; @@ -661,6 +666,32 @@ usb_msc_auto_quirk(struct usb_device *ud usbd_add_dynamic_quirk(udev, UQ_MSC_NO_SYNC_CACHE); } + /* clear sense status of any failed commands on the device */ + + err = bbb_command_start(sc, DIR_IN, 0, sc->buffer, + SCSI_INQ_LEN, &scsi_inquiry, sizeof(scsi_inquiry), + USB_MS_HZ); + + DPRINTF("Inquiry = %d\n", err); + + if (err != 0) { + + if (err != ERR_CSW_FAILED) + goto error; + } + + err = bbb_command_start(sc, DIR_IN, 0, sc->buffer, + SCSI_SENSE_LEN, &scsi_request_sense, + sizeof(scsi_request_sense), USB_MS_HZ); + + DPRINTF("Request sense = %d\n", err); + + if (err != 0) { + + if (err != ERR_CSW_FAILED) + goto error; + } + done: bbb_detach(sc); return (0); From owner-svn-src-all@FreeBSD.ORG Mon Sep 5 17:45:22 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D7F2C1065670; Mon, 5 Sep 2011 17:45:22 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ACE678FC17; Mon, 5 Sep 2011 17:45:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p85HjMjv047648; Mon, 5 Sep 2011 17:45:22 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p85HjMM1047645; Mon, 5 Sep 2011 17:45:22 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201109051745.p85HjMM1047645@svn.freebsd.org> From: Marius Strobl Date: Mon, 5 Sep 2011 17:45:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225403 - in stable/8/tools/tools/netrate: netblast netsend X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Sep 2011 17:45:22 -0000 Author: marius Date: Mon Sep 5 17:45:22 2011 New Revision: 225403 URL: http://svn.freebsd.org/changeset/base/225403 Log: MFC: r225334 Fix alignment assumptions. PR: 160289 Modified: stable/8/tools/tools/netrate/netblast/netblast.c stable/8/tools/tools/netrate/netsend/netsend.c Directory Properties: stable/8/tools/tools/netrate/netblast/ (props changed) stable/8/tools/tools/netrate/netsend/ (props changed) Modified: stable/8/tools/tools/netrate/netblast/netblast.c ============================================================================== --- stable/8/tools/tools/netrate/netblast/netblast.c Mon Sep 5 15:21:18 2011 (r225402) +++ stable/8/tools/tools/netrate/netblast/netblast.c Mon Sep 5 17:45:22 2011 (r225403) @@ -26,6 +26,7 @@ * $FreeBSD$ */ +#include #include #include #include @@ -108,11 +109,9 @@ blast_loop(int s, long duration, u_char * previous send, the error will turn up the current send * operation, causing the current sequence number also to be * skipped. - * - * XXXRW: Note alignment assumption. */ if (packet_len >= 4) { - *((u_int32_t *)packet) = htonl(counter); + be32enc(packet, counter); counter++; } if (send(s, packet, packet_len, 0) < 0) Modified: stable/8/tools/tools/netrate/netsend/netsend.c ============================================================================== --- stable/8/tools/tools/netrate/netsend/netsend.c Mon Sep 5 15:21:18 2011 (r225402) +++ stable/8/tools/tools/netrate/netsend/netsend.c Mon Sep 5 17:45:22 2011 (r225403) @@ -26,6 +26,7 @@ * $FreeBSD$ */ +#include #include #include #include @@ -203,11 +204,9 @@ timing_loop(struct _a *a) * skipped. * The counter is incremented only on the initial port number, * so all destinations will see the same set of packets. - * - * XXXRW: Note alignment assumption. */ if (cur_port == a->port && a->packet_len >= 4) { - *((u_int32_t *)a->packet) = htonl(counter); + be32enc(a->packet, counter); counter++; } if (a->port == a->port_max) { /* socket already bound */ From owner-svn-src-all@FreeBSD.ORG Mon Sep 5 17:45:24 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 903D6106566B; Mon, 5 Sep 2011 17:45:24 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 656008FC08; Mon, 5 Sep 2011 17:45:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p85HjOQ8047683; Mon, 5 Sep 2011 17:45:24 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p85HjOhq047680; Mon, 5 Sep 2011 17:45:24 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201109051745.p85HjOhq047680@svn.freebsd.org> From: Marius Strobl Date: Mon, 5 Sep 2011 17:45:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225404 - in stable/7/tools/tools/netrate: netblast netsend X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Sep 2011 17:45:24 -0000 Author: marius Date: Mon Sep 5 17:45:24 2011 New Revision: 225404 URL: http://svn.freebsd.org/changeset/base/225404 Log: MFC: r225334 Fix alignment assumptions. PR: 160289 Modified: stable/7/tools/tools/netrate/netblast/netblast.c stable/7/tools/tools/netrate/netsend/netsend.c Directory Properties: stable/7/tools/tools/netrate/netblast/ (props changed) stable/7/tools/tools/netrate/netsend/ (props changed) Modified: stable/7/tools/tools/netrate/netblast/netblast.c ============================================================================== --- stable/7/tools/tools/netrate/netblast/netblast.c Mon Sep 5 17:45:22 2011 (r225403) +++ stable/7/tools/tools/netrate/netblast/netblast.c Mon Sep 5 17:45:24 2011 (r225404) @@ -26,6 +26,7 @@ * $FreeBSD$ */ +#include #include #include #include @@ -108,11 +109,9 @@ blast_loop(int s, long duration, u_char * previous send, the error will turn up the current send * operation, causing the current sequence number also to be * skipped. - * - * XXXRW: Note alignment assumption. */ if (packet_len >= 4) { - *((u_int32_t *)packet) = htonl(counter); + be32enc(packet, counter); counter++; } if (send(s, packet, packet_len, 0) < 0) Modified: stable/7/tools/tools/netrate/netsend/netsend.c ============================================================================== --- stable/7/tools/tools/netrate/netsend/netsend.c Mon Sep 5 17:45:22 2011 (r225403) +++ stable/7/tools/tools/netrate/netsend/netsend.c Mon Sep 5 17:45:24 2011 (r225404) @@ -26,6 +26,7 @@ * $FreeBSD$ */ +#include #include #include #include @@ -203,11 +204,9 @@ timing_loop(struct _a *a) * skipped. * The counter is incremented only on the initial port number, * so all destinations will see the same set of packets. - * - * XXXRW: Note alignment assumption. */ if (cur_port == a->port && a->packet_len >= 4) { - *((u_int32_t *)a->packet) = htonl(counter); + be32enc(a->packet, counter); counter++; } if (a->port == a->port_max) { /* socket already bound */ From owner-svn-src-all@FreeBSD.ORG Mon Sep 5 17:54:19 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B96DC1065670; Mon, 5 Sep 2011 17:54:19 +0000 (UTC) (envelope-from qingli@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8FD9E8FC14; Mon, 5 Sep 2011 17:54:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p85HsJwx047970; Mon, 5 Sep 2011 17:54:19 GMT (envelope-from qingli@svn.freebsd.org) Received: (from qingli@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p85HsJS6047967; Mon, 5 Sep 2011 17:54:19 GMT (envelope-from qingli@svn.freebsd.org) Message-Id: <201109051754.p85HsJS6047967@svn.freebsd.org> From: Qing Li Date: Mon, 5 Sep 2011 17:54:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225405 - head/sys/dev/ixgbe X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Sep 2011 17:54:19 -0000 Author: qingli Date: Mon Sep 5 17:54:19 2011 New Revision: 225405 URL: http://svn.freebsd.org/changeset/base/225405 Log: The maximum read size of incoming packets is done in 1024-byte increments. The current code was rounding down the maximum frame size instead of routing up, resulting in a read size of 1024 bytes, in the non-jumbo frame case, and splitting the packets across multiple mbufs. Consequently the above problem exposed another issue, which is when packets were splitted across multiple mbufs, and all of the mbufs in the chain have the M_PKTHDR flag set. Submitted by: original patch by Ray Ruvinskiy at BlueCoat dot com Reviewed by: jfv, kmacy, rwatson Approved by: re (rwatson) MFC after: 5 days Modified: head/sys/dev/ixgbe/ixgbe.c Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Mon Sep 5 17:45:24 2011 (r225404) +++ head/sys/dev/ixgbe/ixgbe.c Mon Sep 5 17:54:19 2011 (r225405) @@ -3849,6 +3849,8 @@ fail: **********************************************************************/ #define IXGBE_SRRCTL_BSIZEHDRSIZE_SHIFT 2 +#define BSIZEPKT_ROUNDUP ((1<rx_mbuf_sz >> IXGBE_SRRCTL_BSIZEPKT_SHIFT; + bufsz = (adapter->rx_mbuf_sz + BSIZEPKT_ROUNDUP) >> IXGBE_SRRCTL_BSIZEPKT_SHIFT; for (int i = 0; i < adapter->num_queues; i++, rxr++) { u64 rdba = rxr->rxdma.dma_paddr; @@ -4300,9 +4302,10 @@ ixgbe_rxeof(struct ix_queue *que, int co sendmp = rbuf->fmp; rbuf->m_pack = rbuf->fmp = NULL; - if (sendmp != NULL) /* secondary frag */ + if (sendmp != NULL) { /* secondary frag */ + mp->m_flags &= ~M_PKTHDR; sendmp->m_pkthdr.len += mp->m_len; - else { + } else { /* first desc of a non-ps chain */ sendmp = mp; sendmp->m_flags |= M_PKTHDR; From owner-svn-src-all@FreeBSD.ORG Mon Sep 5 23:56:15 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E7DD91065675; Mon, 5 Sep 2011 23:56:14 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: from mail-pz0-f45.google.com (mail-pz0-f45.google.com [209.85.210.45]) by mx1.freebsd.org (Postfix) with ESMTP id A8BD08FC12; Mon, 5 Sep 2011 23:56:14 +0000 (UTC) Received: by pzk33 with SMTP id 33so15458595pzk.18 for ; Mon, 05 Sep 2011 16:56:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:date:to:cc:subject:message-id:reply-to:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=/OMpJIyRS48zPEEW4o/7OOwcYi9rTqxaLfxP899Fwps=; b=cT9Zj2fqOevp4PVTkQML2gpRVyth15gBqtA2/P6xh1m+AYPx/tklqtT/J8CeS95bUR RYmgol+2cN/9NO56PgFP4OqZ96MPmMAJ2w0w/OESCSWctcrS0qmXhjaPdZOigJyOKmsI Ckw7zLFfqYMeCJiqktf/De2AtjlzwIKtLQ4oQ= Received: by 10.68.10.4 with SMTP id e4mr8388346pbb.516.1315265516921; Mon, 05 Sep 2011 16:31:56 -0700 (PDT) Received: from pyunyh@gmail.com ([174.35.1.224]) by mx.google.com with ESMTPS id e8sm25468487pbc.8.2011.09.05.16.31.54 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 05 Sep 2011 16:31:55 -0700 (PDT) Received: by pyunyh@gmail.com (sSMTP sendmail emulation); Mon, 05 Sep 2011 16:31:21 -0700 From: YongHyeon PYUN Date: Mon, 5 Sep 2011 16:31:21 -0700 To: Qing Li Message-ID: <20110905233121.GA1760@michelle.cdnetworks.com> References: <201109051754.p85HsJS6047967@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201109051754.p85HsJS6047967@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r225405 - head/sys/dev/ixgbe X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: pyunyh@gmail.com List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Sep 2011 23:56:15 -0000 On Mon, Sep 05, 2011 at 05:54:19PM +0000, Qing Li wrote: > Author: qingli > Date: Mon Sep 5 17:54:19 2011 > New Revision: 225405 > URL: http://svn.freebsd.org/changeset/base/225405 > > Log: > The maximum read size of incoming packets is done in 1024-byte increments. > The current code was rounding down the maximum frame size instead of > routing up, resulting in a read size of 1024 bytes, in the non-jumbo > frame case, and splitting the packets across multiple mbufs. > I guess the minimum allowed value of rx_mbuf_sz is 2048 such that old code will still produce 2(i.e. 2KB). Do you use non-standard rx_mbuf_sz which is not multiple of 1024? > Consequently the above problem exposed another issue, which is when > packets were splitted across multiple mbufs, and all of the mbufs in the > chain have the M_PKTHDR flag set. > > Submitted by: original patch by Ray Ruvinskiy at BlueCoat dot com > Reviewed by: jfv, kmacy, rwatson > Approved by: re (rwatson) > MFC after: 5 days > > Modified: > head/sys/dev/ixgbe/ixgbe.c > > Modified: head/sys/dev/ixgbe/ixgbe.c > ============================================================================== > --- head/sys/dev/ixgbe/ixgbe.c Mon Sep 5 17:45:24 2011 (r225404) > +++ head/sys/dev/ixgbe/ixgbe.c Mon Sep 5 17:54:19 2011 (r225405) > @@ -3849,6 +3849,8 @@ fail: > **********************************************************************/ > #define IXGBE_SRRCTL_BSIZEHDRSIZE_SHIFT 2 > > +#define BSIZEPKT_ROUNDUP ((1< + > static void > ixgbe_initialize_receive_units(struct adapter *adapter) > { > @@ -3882,7 +3884,7 @@ ixgbe_initialize_receive_units(struct ad > hlreg &= ~IXGBE_HLREG0_JUMBOEN; > IXGBE_WRITE_REG(hw, IXGBE_HLREG0, hlreg); > > - bufsz = adapter->rx_mbuf_sz >> IXGBE_SRRCTL_BSIZEPKT_SHIFT; > + bufsz = (adapter->rx_mbuf_sz + BSIZEPKT_ROUNDUP) >> IXGBE_SRRCTL_BSIZEPKT_SHIFT; > > for (int i = 0; i < adapter->num_queues; i++, rxr++) { > u64 rdba = rxr->rxdma.dma_paddr; > @@ -4300,9 +4302,10 @@ ixgbe_rxeof(struct ix_queue *que, int co > sendmp = rbuf->fmp; > rbuf->m_pack = rbuf->fmp = NULL; > > - if (sendmp != NULL) /* secondary frag */ > + if (sendmp != NULL) { /* secondary frag */ > + mp->m_flags &= ~M_PKTHDR; > sendmp->m_pkthdr.len += mp->m_len; > - else { > + } else { > /* first desc of a non-ps chain */ > sendmp = mp; > sendmp->m_flags |= M_PKTHDR; From owner-svn-src-all@FreeBSD.ORG Tue Sep 6 08:15:55 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C29CE106566B; Tue, 6 Sep 2011 08:15:55 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AF78D8FC1E; Tue, 6 Sep 2011 08:15:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p868Ftda074856; Tue, 6 Sep 2011 08:15:55 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p868FtmO074854; Tue, 6 Sep 2011 08:15:55 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201109060815.p868FtmO074854@svn.freebsd.org> From: Hans Petter Selasky Date: Tue, 6 Sep 2011 08:15:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225414 - head/sys/dev/sound/usb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Sep 2011 08:15:56 -0000 Author: hselasky Date: Tue Sep 6 08:15:55 2011 New Revision: 225414 URL: http://svn.freebsd.org/changeset/base/225414 Log: Fix precedence warning when compiling kernel with clang. Approved by: re (kib) Submitted by: dim MFC after: 1 week Modified: head/sys/dev/sound/usb/uaudio.c Modified: head/sys/dev/sound/usb/uaudio.c ============================================================================== --- head/sys/dev/sound/usb/uaudio.c Tue Sep 6 05:06:49 2011 (r225413) +++ head/sys/dev/sound/usb/uaudio.c Tue Sep 6 08:15:55 2011 (r225414) @@ -927,8 +927,8 @@ uaudio_chan_fill_info_sub(struct uaudio_ continue; } if (asf1d->bLength < (sizeof(*asf1d) + - (asf1d->bSamFreqType == 0) ? 6 : - (asf1d->bSamFreqType * 3))) { + ((asf1d->bSamFreqType == 0) ? 6 : + (asf1d->bSamFreqType * 3)))) { DPRINTFN(11, "'asf1d' descriptor is too short\n"); asf1d = NULL; continue; From owner-svn-src-all@FreeBSD.ORG Tue Sep 6 09:53:37 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1AA8A106564A; Tue, 6 Sep 2011 09:53:37 +0000 (UTC) (envelope-from fabien.thomas@netasq.com) Received: from work.netasq.com (mars.netasq.com [91.212.116.3]) by mx1.freebsd.org (Postfix) with ESMTP id 09A068FC17; Tue, 6 Sep 2011 09:53:35 +0000 (UTC) Received: from [10.2.1.1] (unknown [10.2.1.1]) by work.netasq.com (Postfix) with ESMTPSA id 8182B74004E; Tue, 6 Sep 2011 11:36:05 +0200 (CEST) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Fabien Thomas In-Reply-To: <201109051754.p85HsJS6047967@svn.freebsd.org> Date: Tue, 6 Sep 2011 11:36:33 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <239C40DF-095D-4571-BE83-0E2FB21F13EF@netasq.com> References: <201109051754.p85HsJS6047967@svn.freebsd.org> To: Qing Li X-Mailer: Apple Mail (2.1084) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r225405 - head/sys/dev/ixgbe X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Sep 2011 09:53:37 -0000 On Sep 5, 2011, at 7:54 PM, Qing Li wrote: > Author: qingli > Date: Mon Sep 5 17:54:19 2011 > New Revision: 225405 > URL: http://svn.freebsd.org/changeset/base/225405 >=20 > Log: > The maximum read size of incoming packets is done in 1024-byte = increments. > The current code was rounding down the maximum frame size instead of > routing up, resulting in a read size of 1024 bytes, in the non-jumbo > frame case, and splitting the packets across multiple mbufs. I'm not sure to understand the fix: if (adapter->max_frame_size <=3D 2048) adapter->rx_mbuf_sz =3D MCLBYTES; else if (adapter->max_frame_size <=3D 4096) adapter->rx_mbuf_sz =3D MJUMPAGESIZE; else if (adapter->max_frame_size <=3D 9216) adapter->rx_mbuf_sz =3D MJUM9BYTES; else adapter->rx_mbuf_sz =3D MJUM16BYTES; Without the fix this resolve to bufsz =3D adapter->rx_mbuf_sz >> IXGBE_SRRCTL_BSIZEPKT_SHIFT; 2048 >> 10 =3D 2 which seem correct regarding the definition: BSIZEPACKET: Receive Buffer Size for Packet Buffer. The value is in 1 KB resolution. = Value can be from 1 KB to 16 KB. Default buffer size is 2 KB. This field = should not be set to 0x0. This field should be greater or equal to 0x2 = in queues where RSC is enabled. I've missed something? >=20 > Consequently the above problem exposed another issue, which is when > packets were splitted across multiple mbufs, and all of the mbufs in = the > chain have the M_PKTHDR flag set. >=20 > Submitted by: original patch by Ray Ruvinskiy at BlueCoat dot = com > Reviewed by: jfv, kmacy, rwatson > Approved by: re (rwatson) > MFC after: 5 days >=20 > Modified: > head/sys/dev/ixgbe/ixgbe.c >=20 > Modified: head/sys/dev/ixgbe/ixgbe.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/dev/ixgbe/ixgbe.c Mon Sep 5 17:45:24 2011 = (r225404) > +++ head/sys/dev/ixgbe/ixgbe.c Mon Sep 5 17:54:19 2011 = (r225405) > @@ -3849,6 +3849,8 @@ fail: > = **********************************************************************/ > #define IXGBE_SRRCTL_BSIZEHDRSIZE_SHIFT 2 >=20 > +#define BSIZEPKT_ROUNDUP ((1< +=09 > static void > ixgbe_initialize_receive_units(struct adapter *adapter) > { > @@ -3882,7 +3884,7 @@ ixgbe_initialize_receive_units(struct ad > hlreg &=3D ~IXGBE_HLREG0_JUMBOEN; > IXGBE_WRITE_REG(hw, IXGBE_HLREG0, hlreg); >=20 > - bufsz =3D adapter->rx_mbuf_sz >> IXGBE_SRRCTL_BSIZEPKT_SHIFT; > + bufsz =3D (adapter->rx_mbuf_sz + BSIZEPKT_ROUNDUP) >> = IXGBE_SRRCTL_BSIZEPKT_SHIFT; >=20 > for (int i =3D 0; i < adapter->num_queues; i++, rxr++) { > u64 rdba =3D rxr->rxdma.dma_paddr; > @@ -4300,9 +4302,10 @@ ixgbe_rxeof(struct ix_queue *que, int co > sendmp =3D rbuf->fmp; > rbuf->m_pack =3D rbuf->fmp =3D NULL; >=20 > - if (sendmp !=3D NULL) /* secondary frag */ > + if (sendmp !=3D NULL) { /* secondary frag */ > + mp->m_flags &=3D ~M_PKTHDR; > sendmp->m_pkthdr.len +=3D mp->m_len; > - else { > + } else { > /* first desc of a non-ps chain */ > sendmp =3D mp; > sendmp->m_flags |=3D M_PKTHDR; -- Fabien Thomas From owner-svn-src-all@FreeBSD.ORG Tue Sep 6 10:17:02 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DB38C10656D0; Tue, 6 Sep 2011 10:17:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C32E18FC0A; Tue, 6 Sep 2011 10:17:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p86AH2pA078523; Tue, 6 Sep 2011 10:17:02 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p86AH2RA078521; Tue, 6 Sep 2011 10:17:02 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201109061017.p86AH2RA078521@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 6 Sep 2011 10:17:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225415 - head X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Sep 2011 10:17:03 -0000 Author: kib Date: Tue Sep 6 10:17:02 2011 New Revision: 225415 URL: http://svn.freebsd.org/changeset/base/225415 Log: Fix for the obsolete libraries list after the 9.0 bump. Partially noted by: pluknet Approved by: re (bz) Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Tue Sep 6 08:15:55 2011 (r225414) +++ head/ObsoleteFiles.inc Tue Sep 6 10:17:02 2011 (r225415) @@ -39,19 +39,21 @@ # done # 20110828: library version bump for 9.0 +OLD_LIBS+=lib/libcam.so.5 +OLD_LIBS+=lib/libpcap.so.7 OLD_LIBS+=lib/libufs.so.5 OLD_LIBS+=usr/lib/libbsnmp.so.5 OLD_LIBS+=usr/lib/libdwarf.so.2 OLD_LIBS+=usr/lib/libopie.so.6 -OLD_LIBS+=usr/lib/libpcap.so.7 OLD_LIBS+=usr/lib/librtld_db.so.1 OLD_LIBS+=usr/lib/libtacplus.so.4 .if ${TARGET_ARCH} == "amd64" +OLD_LIBS+=usr/lib32/libcam.so.5 +OLD_LIBS+=usr/lib32/libpcap.so.7 OLD_LIBS+=usr/lib32/libufs.so.5 OLD_LIBS+=usr/lib32/libbsnmp.so.5 OLD_LIBS+=usr/lib32/libdwarf.so.2 OLD_LIBS+=usr/lib32/libopie.so.6 -OLD_LIBS+=usr/lib32/libpcap.so.7 OLD_LIBS+=usr/lib32/librtld_db.so.1 OLD_LIBS+=usr/lib32/libtacplus.so.4 .endif From owner-svn-src-all@FreeBSD.ORG Tue Sep 6 10:19:01 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A9FD3106566B; Tue, 6 Sep 2011 10:19:01 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 803978FC0C; Tue, 6 Sep 2011 10:19:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p86AJ1Wk078615; Tue, 6 Sep 2011 10:19:01 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p86AJ1jS078612; Tue, 6 Sep 2011 10:19:01 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201109061019.p86AJ1jS078612@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 6 Sep 2011 10:19:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225416 - head/sbin/mdmfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Sep 2011 10:19:01 -0000 Author: kib Date: Tue Sep 6 10:19:01 2011 New Revision: 225416 URL: http://svn.freebsd.org/changeset/base/225416 Log: dd -t switch for mdmfs to enable TRIM on the configured filesystem. While there, fix minor style issues. Submitted by: Alex Kozlov MFC after: 1 week Approved by: re (bz) Modified: head/sbin/mdmfs/mdmfs.8 head/sbin/mdmfs/mdmfs.c Modified: head/sbin/mdmfs/mdmfs.8 ============================================================================== --- head/sbin/mdmfs/mdmfs.8 Tue Sep 6 10:17:02 2011 (r225415) +++ head/sbin/mdmfs/mdmfs.8 Tue Sep 6 10:19:01 2011 (r225416) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 15, 2007 +.Dd September 4, 2011 .Dt MDMFS 8 .Os .Sh NAME @@ -36,7 +36,7 @@ driver .Sh SYNOPSIS .Nm -.Op Fl DLlMNPSUX +.Op Fl DLlMNPStUX .Op Fl a Ar maxcontig .Op Fl b Ar block-size .Op Fl c Ar blocks-per-cylinder-group @@ -224,6 +224,13 @@ and the optional .Xr malloc 9 backed disks .Pq Dv MD_MALLOC . +.It Fl t +Turn on the TRIM enable flag for +.Xr newfs 8 . +The +.Xr md 4 +device supports the BIO_DELETE command, enabling the TRIM on created +filesystem allows return of freed memory to the system pool. .It Fl U Enable soft-updates on the file system. This is the default, and is accepted only Modified: head/sbin/mdmfs/mdmfs.c ============================================================================== --- head/sbin/mdmfs/mdmfs.c Tue Sep 6 10:17:02 2011 (r225415) +++ head/sbin/mdmfs/mdmfs.c Tue Sep 6 10:19:01 2011 (r225416) @@ -127,7 +127,7 @@ main(int argc, char **argv) } while ((ch = getopt(argc, argv, - "a:b:Cc:Dd:E:e:F:f:hi:LlMm:NnO:o:Pp:Ss:t:Uv:w:X")) != -1) + "a:b:Cc:Dd:E:e:F:f:hi:LlMm:NnO:o:Pp:Ss:tUv:w:X")) != -1) switch (ch) { case 'a': argappend(&newfs_arg, "-a %s", optarg); @@ -212,6 +212,9 @@ main(int argc, char **argv) case 's': argappend(&mdconfig_arg, "-s %s", optarg); break; + case 't': + argappend(&newfs_arg, "-t"); + break; case 'U': softdep = true; break; @@ -282,7 +285,7 @@ argappend(char **dstp, const char *fmt, { char *old, *new; va_list ap; - + old = *dstp; assert(old != NULL); @@ -417,7 +420,7 @@ do_mdconfig_detach(void) rv = run(NULL, "%s -d -u %s%d", path_mdconfig, mdname, unit); if (rv && debug) /* This is allowed to fail. */ warnx("mdconfig (detach) exited with error code %d (ignored)", - rv); + rv); } /* @@ -656,7 +659,7 @@ usage(void) { fprintf(stderr, -"usage: %s [-DLlMNnPSUX] [-a maxcontig] [-b block-size]\n" +"usage: %s [-DLlMNnPStUX] [-a maxcontig] [-b block-size]\n" "\t[-c blocks-per-cylinder-group][-d max-extent-size] [-E path-mdconfig]\n" "\t[-e maxbpg] [-F file] [-f frag-size] [-i bytes] [-m percent-free]\n" "\t[-O optimization] [-o mount-options]\n" From owner-svn-src-all@FreeBSD.ORG Tue Sep 6 10:21:34 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 226ED106564A; Tue, 6 Sep 2011 10:21:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 07AE78FC14; Tue, 6 Sep 2011 10:21:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p86ALXnQ078725; Tue, 6 Sep 2011 10:21:33 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p86ALXBF078723; Tue, 6 Sep 2011 10:21:33 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201109061021.p86ALXBF078723@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 6 Sep 2011 10:21:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225417 - head/libexec/rtld-elf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Sep 2011 10:21:34 -0000 Author: kib Date: Tue Sep 6 10:21:33 2011 New Revision: 225417 URL: http://svn.freebsd.org/changeset/base/225417 Log: Do not use the function pointers for the internal operation of rtld_printf() functions. The _rtld_error() function might be called early during the rtld bootstrap, in which case function pointers are not yet functional on ia64 due to required relocations not yet performed. Reported, reviewed and tested by: marcel Approved by: re (bz) Modified: head/libexec/rtld-elf/rtld_printf.c Modified: head/libexec/rtld-elf/rtld_printf.c ============================================================================== --- head/libexec/rtld-elf/rtld_printf.c Tue Sep 6 10:19:01 2011 (r225416) +++ head/libexec/rtld-elf/rtld_printf.c Tue Sep 6 10:21:33 2011 (r225417) @@ -46,7 +46,11 @@ #define MAXNBUF (sizeof(intmax_t) * NBBY + 1) +#define PRINT_METHOD_SNPRINTF 1 +#define PRINT_METHOD_WRITE 2 + struct snprintf_arg { + int method; char *str; char *buf; size_t remain; @@ -55,16 +59,6 @@ struct snprintf_arg { }; static void -snprintf_func(int ch, struct snprintf_arg *const info) -{ - - if (info->remain >= 2) { - *info->str++ = ch; - info->remain--; - } -} - -static void printf_out(struct snprintf_arg *info) { @@ -76,14 +70,24 @@ printf_out(struct snprintf_arg *info) } static void -printf_func(int ch, struct snprintf_arg *const info) +snprintf_func(int ch, struct snprintf_arg *const info) { - if (info->remain > 0) { - *info->str++ = ch; - info->remain--; - } else - printf_out(info); + switch (info->method) { + case PRINT_METHOD_SNPRINTF: + if (info->remain >= 2) { + *info->str++ = ch; + info->remain--; + } + break; + case PRINT_METHOD_WRITE: + if (info->remain > 0) { + *info->str++ = ch; + info->remain--; + } else + printf_out(info); + break; + } } static char const hex2ascii_data[] = "0123456789abcdefghijklmnopqrstuvwxyz"; @@ -113,10 +117,9 @@ ksprintn(char *nbuf, uintmax_t num, int } static int -kvprintf(char const *fmt, void (*func)(int c, struct snprintf_arg *const arg), - struct snprintf_arg *arg, int radix, va_list ap) +kvprintf(char const *fmt, struct snprintf_arg *arg, int radix, va_list ap) { -#define PCHAR(c) func((c), arg) +#define PCHAR(c) snprintf_func((c), arg) char nbuf[MAXNBUF]; const char *p, *percent, *q; u_char *up; @@ -429,10 +432,11 @@ rtld_vsnprintf(char *buf, size_t bufsize struct snprintf_arg info; int retval; + info.method = PRINT_METHOD_SNPRINTF; info.buf = info.str = buf; info.buf_total = info.remain = bufsize; info.fd = -1; - retval = kvprintf(fmt, snprintf_func, &info, 10, ap); + retval = kvprintf(fmt, &info, 10, ap); if (info.remain >= 1) *info.str++ = '\0'; return (retval); @@ -445,10 +449,11 @@ rtld_vfdprintf(int fd, const char *fmt, struct snprintf_arg info; int retval; + info.method = PRINT_METHOD_WRITE; info.buf = info.str = buf; info.buf_total = info.remain = sizeof(buf); info.fd = fd; - retval = kvprintf(fmt, printf_func, &info, 10, ap); + retval = kvprintf(fmt, &info, 10, ap); printf_out(&info); return (retval); } From owner-svn-src-all@FreeBSD.ORG Tue Sep 6 10:30:11 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E28961065672; Tue, 6 Sep 2011 10:30:11 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CE2918FC0C; Tue, 6 Sep 2011 10:30:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p86AUBVU079037; Tue, 6 Sep 2011 10:30:11 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p86AUBi8079026; Tue, 6 Sep 2011 10:30:11 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201109061030.p86AUBi8079026@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 6 Sep 2011 10:30:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225418 - in head/sys: amd64/amd64 arm/arm cddl/contrib/opensolaris/uts/common/fs/zfs fs/tmpfs i386/i386 i386/xen ia64/ia64 mips/mips powerpc/aim powerpc/booke powerpc/powerpc sparc64/s... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Sep 2011 10:30:12 -0000 Author: kib Date: Tue Sep 6 10:30:11 2011 New Revision: 225418 URL: http://svn.freebsd.org/changeset/base/225418 Log: Split the vm_page flags PG_WRITEABLE and PG_REFERENCED into atomic flags field. Updates to the atomic flags are performed using the atomic ops on the containing word, do not require any vm lock to be held, and are non-blocking. The vm_page_aflag_set(9) and vm_page_aflag_clear(9) functions are provided to modify afalgs. Document the changes to flags field to only require the page lock. Introduce vm_page_reference(9) function to provide a stable KPI and KBI for filesystems like tmpfs and zfs which need to mark a page as referenced. Reviewed by: alc, attilio Tested by: marius, flo (sparc64); andreast (powerpc, powerpc64) Approved by: re (bz) Modified: head/sys/amd64/amd64/pmap.c head/sys/arm/arm/pmap.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c head/sys/fs/tmpfs/tmpfs_vnops.c head/sys/i386/i386/pmap.c head/sys/i386/xen/pmap.c head/sys/ia64/ia64/pmap.c head/sys/mips/mips/pmap.c head/sys/powerpc/aim/mmu_oea.c head/sys/powerpc/aim/mmu_oea64.c head/sys/powerpc/booke/pmap.c head/sys/powerpc/powerpc/mmu_if.m head/sys/sparc64/sparc64/pmap.c head/sys/vm/swap_pager.c head/sys/vm/vm_fault.c head/sys/vm/vm_mmap.c head/sys/vm/vm_object.c head/sys/vm/vm_page.c head/sys/vm/vm_page.h head/sys/vm/vm_pageout.c head/sys/vm/vnode_pager.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Tue Sep 6 10:21:33 2011 (r225417) +++ head/sys/amd64/amd64/pmap.c Tue Sep 6 10:30:11 2011 (r225418) @@ -2123,7 +2123,7 @@ pmap_collect(pmap_t locked_pmap, struct KASSERT((tpte & PG_W) == 0, ("pmap_collect: wired pte %#lx", tpte)); if (tpte & PG_A) - vm_page_flag_set(m, PG_REFERENCED); + vm_page_aflag_set(m, PGA_REFERENCED); if ((tpte & (PG_M | PG_RW)) == (PG_M | PG_RW)) vm_page_dirty(m); free = NULL; @@ -2137,7 +2137,7 @@ pmap_collect(pmap_t locked_pmap, struct } if (TAILQ_EMPTY(&m->md.pv_list) && TAILQ_EMPTY(&pa_to_pvh(VM_PAGE_TO_PHYS(m))->pv_list)) - vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_aflag_clear(m, PGA_WRITEABLE); } } @@ -2391,7 +2391,7 @@ pmap_remove_entry(pmap_t pmap, vm_page_t if (TAILQ_EMPTY(&m->md.pv_list)) { pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); if (TAILQ_EMPTY(&pvh->pv_list)) - vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_aflag_clear(m, PGA_WRITEABLE); } } @@ -2615,10 +2615,10 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t if ((oldpde & (PG_M | PG_RW)) == (PG_M | PG_RW)) vm_page_dirty(m); if (oldpde & PG_A) - vm_page_flag_set(m, PG_REFERENCED); + vm_page_aflag_set(m, PGA_REFERENCED); if (TAILQ_EMPTY(&m->md.pv_list) && TAILQ_EMPTY(&pvh->pv_list)) - vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_aflag_clear(m, PGA_WRITEABLE); } } if (pmap == kernel_pmap) { @@ -2659,7 +2659,7 @@ pmap_remove_pte(pmap_t pmap, pt_entry_t if ((oldpte & (PG_M | PG_RW)) == (PG_M | PG_RW)) vm_page_dirty(m); if (oldpte & PG_A) - vm_page_flag_set(m, PG_REFERENCED); + vm_page_aflag_set(m, PGA_REFERENCED); pmap_remove_entry(pmap, m, va); } return (pmap_unuse_pt(pmap, va, ptepde, free)); @@ -2872,7 +2872,7 @@ pmap_remove_all(vm_page_t m) if (tpte & PG_W) pmap->pm_stats.wired_count--; if (tpte & PG_A) - vm_page_flag_set(m, PG_REFERENCED); + vm_page_aflag_set(m, PGA_REFERENCED); /* * Update the vm_page_t clean and reference bits. @@ -2885,7 +2885,7 @@ pmap_remove_all(vm_page_t m) free_pv_entry(pmap, pv); PMAP_UNLOCK(pmap); } - vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_aflag_clear(m, PGA_WRITEABLE); vm_page_unlock_queues(); pmap_free_zero_pages(free); } @@ -3301,7 +3301,7 @@ validate: if ((prot & VM_PROT_WRITE) != 0) { newpte |= PG_RW; if ((newpte & PG_MANAGED) != 0) - vm_page_flag_set(m, PG_WRITEABLE); + vm_page_aflag_set(m, PGA_WRITEABLE); } if ((prot & VM_PROT_EXECUTE) == 0) newpte |= pg_nx; @@ -3325,7 +3325,7 @@ validate: origpte = pte_load_store(pte, newpte); if (origpte & PG_A) { if (origpte & PG_MANAGED) - vm_page_flag_set(om, PG_REFERENCED); + vm_page_aflag_set(om, PGA_REFERENCED); if (opa != VM_PAGE_TO_PHYS(m) || ((origpte & PG_NX) == 0 && (newpte & PG_NX))) invlva = TRUE; @@ -3339,7 +3339,7 @@ validate: if ((origpte & PG_MANAGED) != 0 && TAILQ_EMPTY(&om->md.pv_list) && TAILQ_EMPTY(&pa_to_pvh(opa)->pv_list)) - vm_page_flag_clear(om, PG_WRITEABLE); + vm_page_aflag_clear(om, PGA_WRITEABLE); if (invlva) pmap_invalidate_page(pmap, va); } else @@ -4147,7 +4147,7 @@ pmap_remove_pages(pmap_t pmap) if (TAILQ_EMPTY(&pvh->pv_list)) { for (mt = m; mt < &m[NBPDR / PAGE_SIZE]; mt++) if (TAILQ_EMPTY(&mt->md.pv_list)) - vm_page_flag_clear(mt, PG_WRITEABLE); + vm_page_aflag_clear(mt, PGA_WRITEABLE); } mpte = pmap_lookup_pt_page(pmap, pv->pv_va); if (mpte != NULL) { @@ -4165,7 +4165,7 @@ pmap_remove_pages(pmap_t pmap) if (TAILQ_EMPTY(&m->md.pv_list)) { pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); if (TAILQ_EMPTY(&pvh->pv_list)) - vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_aflag_clear(m, PGA_WRITEABLE); } } pmap_unuse_pt(pmap, pv->pv_va, ptepde, &free); @@ -4203,13 +4203,13 @@ pmap_is_modified(vm_page_t m) ("pmap_is_modified: page %p is not managed", m)); /* - * If the page is not VPO_BUSY, then PG_WRITEABLE cannot be - * concurrently set while the object is locked. Thus, if PG_WRITEABLE + * If the page is not VPO_BUSY, then PGA_WRITEABLE cannot be + * concurrently set while the object is locked. Thus, if PGA_WRITEABLE * is clear, no PTEs can have PG_M set. */ VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); if ((m->oflags & VPO_BUSY) == 0 && - (m->flags & PG_WRITEABLE) == 0) + (m->aflags & PGA_WRITEABLE) == 0) return (FALSE); vm_page_lock_queues(); rv = pmap_is_modified_pvh(&m->md) || @@ -4332,13 +4332,13 @@ pmap_remove_write(vm_page_t m) ("pmap_remove_write: page %p is not managed", m)); /* - * If the page is not VPO_BUSY, then PG_WRITEABLE cannot be set by - * another thread while the object is locked. Thus, if PG_WRITEABLE + * If the page is not VPO_BUSY, then PGA_WRITEABLE cannot be set by + * another thread while the object is locked. Thus, if PGA_WRITEABLE * is clear, no page table entries need updating. */ VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); if ((m->oflags & VPO_BUSY) == 0 && - (m->flags & PG_WRITEABLE) == 0) + (m->aflags & PGA_WRITEABLE) == 0) return; vm_page_lock_queues(); pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); @@ -4370,7 +4370,7 @@ retry: } PMAP_UNLOCK(pmap); } - vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_aflag_clear(m, PGA_WRITEABLE); vm_page_unlock_queues(); } @@ -4478,11 +4478,11 @@ pmap_clear_modify(vm_page_t m) ("pmap_clear_modify: page %p is busy", m)); /* - * If the page is not PG_WRITEABLE, then no PTEs can have PG_M set. + * If the page is not PGA_WRITEABLE, then no PTEs can have PG_M set. * If the object containing the page is locked and the page is not - * VPO_BUSY, then PG_WRITEABLE cannot be concurrently set. + * VPO_BUSY, then PGA_WRITEABLE cannot be concurrently set. */ - if ((m->flags & PG_WRITEABLE) == 0) + if ((m->aflags & PGA_WRITEABLE) == 0) return; vm_page_lock_queues(); pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); Modified: head/sys/arm/arm/pmap.c ============================================================================== --- head/sys/arm/arm/pmap.c Tue Sep 6 10:21:33 2011 (r225417) +++ head/sys/arm/arm/pmap.c Tue Sep 6 10:30:11 2011 (r225418) @@ -1402,7 +1402,7 @@ pmap_fix_cache(struct vm_page *pg, pmap_ if ((kwritable == 0) && (writable == 0)) { pg->md.pvh_attrs &= ~PVF_MOD; - vm_page_flag_clear(pg, PG_WRITEABLE); + vm_page_aflag_clear(pg, PGA_WRITEABLE); return; } } @@ -1568,7 +1568,7 @@ pmap_clearbit(struct vm_page *pg, u_int } if (maskbits & PVF_WRITE) - vm_page_flag_clear(pg, PG_WRITEABLE); + vm_page_aflag_clear(pg, PGA_WRITEABLE); vm_page_unlock_queues(); return (count); } @@ -1630,7 +1630,7 @@ pmap_enter_pv(struct vm_page *pg, struct pg->md.pvh_attrs |= flags & (PVF_REF | PVF_MOD); if (pve->pv_flags & PVF_WIRED) ++pm->pm_stats.wired_count; - vm_page_flag_set(pg, PG_REFERENCED); + vm_page_aflag_set(pg, PGA_REFERENCED); } /* @@ -1699,7 +1699,7 @@ pmap_nuke_pv(struct vm_page *pg, pmap_t if (TAILQ_FIRST(&pg->md.pv_list) == NULL) pg->md.pvh_attrs &= ~PVF_REF; else - vm_page_flag_set(pg, PG_REFERENCED); + vm_page_aflag_set(pg, PGA_REFERENCED); if ((pve->pv_flags & PVF_NC) && ((pm == pmap_kernel()) || (pve->pv_flags & PVF_WRITE) || !(pve->pv_flags & PVF_MWC))) pmap_fix_cache(pg, pm, 0); @@ -1709,7 +1709,7 @@ pmap_nuke_pv(struct vm_page *pg, pmap_t break; if (!pve) { pg->md.pvh_attrs &= ~PVF_MOD; - vm_page_flag_clear(pg, PG_WRITEABLE); + vm_page_aflag_clear(pg, PGA_WRITEABLE); } } pv = TAILQ_FIRST(&pg->md.pv_list); @@ -1724,7 +1724,7 @@ pmap_nuke_pv(struct vm_page *pg, pmap_t --pm->pm_stats.wired_count; pg->md.pvh_attrs &= ~PVF_REF; pg->md.pvh_attrs &= ~PVF_MOD; - vm_page_flag_clear(pg, PG_WRITEABLE); + vm_page_aflag_clear(pg, PGA_WRITEABLE); pmap_free_pv_entry(pv); } } @@ -2695,7 +2695,7 @@ pmap_remove_pages(pmap_t pmap) npv = TAILQ_NEXT(pv, pv_plist); pmap_nuke_pv(m, pmap, pv); if (TAILQ_EMPTY(&m->md.pv_list)) - vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_aflag_clear(m, PGA_WRITEABLE); pmap_free_pv_entry(pv); pmap_free_l2_bucket(pmap, l2b, 1); } @@ -3172,7 +3172,7 @@ pmap_remove_all(vm_page_t m) else pmap_tlb_flushD(curpm); } - vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_aflag_clear(m, PGA_WRITEABLE); vm_page_unlock_queues(); } @@ -3406,7 +3406,7 @@ do_l2b_alloc: vm_page_dirty(m); } if (m && opte) - vm_page_flag_set(m, PG_REFERENCED); + vm_page_aflag_set(m, PGA_REFERENCED); } else { /* * Need to do page referenced emulation. @@ -3418,7 +3418,7 @@ do_l2b_alloc: npte |= L2_S_PROT_W; if (m != NULL && (m->oflags & VPO_UNMANAGED) == 0) - vm_page_flag_set(m, PG_WRITEABLE); + vm_page_aflag_set(m, PGA_WRITEABLE); } npte |= pte_l2_s_cache_mode; if (m && m == opg) { @@ -4505,11 +4505,11 @@ pmap_clear_modify(vm_page_t m) ("pmap_clear_modify: page %p is busy", m)); /* - * If the page is not PG_WRITEABLE, then no mappings can be modified. + * If the page is not PGA_WRITEABLE, then no mappings can be modified. * If the object containing the page is locked and the page is not - * VPO_BUSY, then PG_WRITEABLE cannot be concurrently set. + * VPO_BUSY, then PGA_WRITEABLE cannot be concurrently set. */ - if ((m->flags & PG_WRITEABLE) == 0) + if ((m->aflags & PGA_WRITEABLE) == 0) return; if (m->md.pvh_attrs & PVF_MOD) pmap_clearbit(m, PVF_MOD); @@ -4558,13 +4558,13 @@ pmap_remove_write(vm_page_t m) ("pmap_remove_write: page %p is not managed", m)); /* - * If the page is not VPO_BUSY, then PG_WRITEABLE cannot be set by - * another thread while the object is locked. Thus, if PG_WRITEABLE + * If the page is not VPO_BUSY, then PGA_WRITEABLE cannot be set by + * another thread while the object is locked. Thus, if PGA_WRITEABLE * is clear, no page table entries need updating. */ VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); if ((m->oflags & VPO_BUSY) != 0 || - (m->flags & PG_WRITEABLE) != 0) + (m->aflags & PGA_WRITEABLE) != 0) pmap_clearbit(m, PVF_WRITE); } Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue Sep 6 10:21:33 2011 (r225417) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue Sep 6 10:30:11 2011 (r225418) @@ -331,8 +331,7 @@ page_lookup(vnode_t *vp, int64_t start, * sleeping so that the page daemon is less * likely to reclaim it. */ - vm_page_lock_queues(); - vm_page_flag_set(pp, PG_REFERENCED); + vm_page_reference(pp); vm_page_sleep(pp, "zfsmwb"); continue; } Modified: head/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vnops.c Tue Sep 6 10:21:33 2011 (r225417) +++ head/sys/fs/tmpfs/tmpfs_vnops.c Tue Sep 6 10:30:11 2011 (r225418) @@ -518,8 +518,7 @@ lookupvpg: * Reference the page before unlocking and sleeping so * that the page daemon is less likely to reclaim it. */ - vm_page_lock_queues(); - vm_page_flag_set(m, PG_REFERENCED); + vm_page_reference(m); vm_page_sleep(m, "tmfsmr"); goto lookupvpg; } @@ -538,8 +537,7 @@ lookupvpg: * Reference the page before unlocking and sleeping so * that the page daemon is less likely to reclaim it. */ - vm_page_lock_queues(); - vm_page_flag_set(m, PG_REFERENCED); + vm_page_reference(m); vm_page_sleep(m, "tmfsmr"); goto lookupvpg; } @@ -650,8 +648,7 @@ lookupvpg: * Reference the page before unlocking and sleeping so * that the page daemon is less likely to reclaim it. */ - vm_page_lock_queues(); - vm_page_flag_set(vpg, PG_REFERENCED); + vm_page_reference(vpg); vm_page_sleep(vpg, "tmfsmw"); goto lookupvpg; } Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Tue Sep 6 10:21:33 2011 (r225417) +++ head/sys/i386/i386/pmap.c Tue Sep 6 10:30:11 2011 (r225418) @@ -2207,7 +2207,7 @@ pmap_collect(pmap_t locked_pmap, struct KASSERT((tpte & PG_W) == 0, ("pmap_collect: wired pte %#jx", (uintmax_t)tpte)); if (tpte & PG_A) - vm_page_flag_set(m, PG_REFERENCED); + vm_page_aflag_set(m, PGA_REFERENCED); if ((tpte & (PG_M | PG_RW)) == (PG_M | PG_RW)) vm_page_dirty(m); free = NULL; @@ -2221,7 +2221,7 @@ pmap_collect(pmap_t locked_pmap, struct } if (TAILQ_EMPTY(&m->md.pv_list) && TAILQ_EMPTY(&pa_to_pvh(VM_PAGE_TO_PHYS(m))->pv_list)) - vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_aflag_clear(m, PGA_WRITEABLE); } sched_unpin(); } @@ -2461,7 +2461,7 @@ pmap_remove_entry(pmap_t pmap, vm_page_t if (TAILQ_EMPTY(&m->md.pv_list)) { pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); if (TAILQ_EMPTY(&pvh->pv_list)) - vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_aflag_clear(m, PGA_WRITEABLE); } } @@ -2714,10 +2714,10 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t if ((oldpde & (PG_M | PG_RW)) == (PG_M | PG_RW)) vm_page_dirty(m); if (oldpde & PG_A) - vm_page_flag_set(m, PG_REFERENCED); + vm_page_aflag_set(m, PGA_REFERENCED); if (TAILQ_EMPTY(&m->md.pv_list) && TAILQ_EMPTY(&pvh->pv_list)) - vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_aflag_clear(m, PGA_WRITEABLE); } } if (pmap == kernel_pmap) { @@ -2763,7 +2763,7 @@ pmap_remove_pte(pmap_t pmap, pt_entry_t if ((oldpte & (PG_M | PG_RW)) == (PG_M | PG_RW)) vm_page_dirty(m); if (oldpte & PG_A) - vm_page_flag_set(m, PG_REFERENCED); + vm_page_aflag_set(m, PGA_REFERENCED); pmap_remove_entry(pmap, m, va); } return (pmap_unuse_pt(pmap, va, free)); @@ -2953,7 +2953,7 @@ pmap_remove_all(vm_page_t m) if (tpte & PG_W) pmap->pm_stats.wired_count--; if (tpte & PG_A) - vm_page_flag_set(m, PG_REFERENCED); + vm_page_aflag_set(m, PGA_REFERENCED); /* * Update the vm_page_t clean and reference bits. @@ -2966,7 +2966,7 @@ pmap_remove_all(vm_page_t m) free_pv_entry(pmap, pv); PMAP_UNLOCK(pmap); } - vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_aflag_clear(m, PGA_WRITEABLE); sched_unpin(); vm_page_unlock_queues(); pmap_free_zero_pages(free); @@ -3413,7 +3413,7 @@ validate: if ((prot & VM_PROT_WRITE) != 0) { newpte |= PG_RW; if ((newpte & PG_MANAGED) != 0) - vm_page_flag_set(m, PG_WRITEABLE); + vm_page_aflag_set(m, PGA_WRITEABLE); } #ifdef PAE if ((prot & VM_PROT_EXECUTE) == 0) @@ -3439,7 +3439,7 @@ validate: origpte = pte_load_store(pte, newpte); if (origpte & PG_A) { if (origpte & PG_MANAGED) - vm_page_flag_set(om, PG_REFERENCED); + vm_page_aflag_set(om, PGA_REFERENCED); if (opa != VM_PAGE_TO_PHYS(m)) invlva = TRUE; #ifdef PAE @@ -3457,7 +3457,7 @@ validate: if ((origpte & PG_MANAGED) != 0 && TAILQ_EMPTY(&om->md.pv_list) && TAILQ_EMPTY(&pa_to_pvh(opa)->pv_list)) - vm_page_flag_clear(om, PG_WRITEABLE); + vm_page_aflag_clear(om, PGA_WRITEABLE); if (invlva) pmap_invalidate_page(pmap, va); } else @@ -4287,7 +4287,7 @@ pmap_remove_pages(pmap_t pmap) if (TAILQ_EMPTY(&pvh->pv_list)) { for (mt = m; mt < &m[NBPDR / PAGE_SIZE]; mt++) if (TAILQ_EMPTY(&mt->md.pv_list)) - vm_page_flag_clear(mt, PG_WRITEABLE); + vm_page_aflag_clear(mt, PGA_WRITEABLE); } mpte = pmap_lookup_pt_page(pmap, pv->pv_va); if (mpte != NULL) { @@ -4305,7 +4305,7 @@ pmap_remove_pages(pmap_t pmap) if (TAILQ_EMPTY(&m->md.pv_list)) { pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m)); if (TAILQ_EMPTY(&pvh->pv_list)) - vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_aflag_clear(m, PGA_WRITEABLE); } pmap_unuse_pt(pmap, pv->pv_va, &free); } @@ -4345,13 +4345,13 @@ pmap_is_modified(vm_page_t m) ("pmap_is_modified: page %p is not managed", m)); /* - * If the page is not VPO_BUSY, then PG_WRITEABLE cannot be - * concurrently set while the object is locked. Thus, if PG_WRITEABLE + * If the page is not VPO_BUSY, then PGA_WRITEABLE cannot be + * concurrently set while the object is locked. Thus, if PGA_WRITEABLE * is clear, no PTEs can have PG_M set. */ VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); if ((m->oflags & VPO_BUSY) == 0 && - (m->flags & PG_WRITEABLE) == 0) + (m->aflags & PGA_WRITEABLE) == 0) return (FALSE); vm_page_lock_queues(); rv = pmap_is_modified_pvh(&m->md) || @@ -4478,13 +4478,13 @@ pmap_remove_write(vm_page_t m) ("pmap_remove_write: page %p is not managed", m)); /* - * If the page is not VPO_BUSY, then PG_WRITEABLE cannot be set by - * another thread while the object is locked. Thus, if PG_WRITEABLE + * If the page is not VPO_BUSY, then PGA_WRITEABLE cannot be set by + * another thread while the object is locked. Thus, if PGA_WRITEABLE * is clear, no page table entries need updating. */ VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); if ((m->oflags & VPO_BUSY) == 0 && - (m->flags & PG_WRITEABLE) == 0) + (m->aflags & PGA_WRITEABLE) == 0) return; vm_page_lock_queues(); sched_pin(); @@ -4522,7 +4522,7 @@ retry: } PMAP_UNLOCK(pmap); } - vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_aflag_clear(m, PGA_WRITEABLE); sched_unpin(); vm_page_unlock_queues(); } @@ -4633,11 +4633,11 @@ pmap_clear_modify(vm_page_t m) ("pmap_clear_modify: page %p is busy", m)); /* - * If the page is not PG_WRITEABLE, then no PTEs can have PG_M set. + * If the page is not PGA_WRITEABLE, then no PTEs can have PG_M set. * If the object containing the page is locked and the page is not - * VPO_BUSY, then PG_WRITEABLE cannot be concurrently set. + * VPO_BUSY, then PGA_WRITEABLE cannot be concurrently set. */ - if ((m->flags & PG_WRITEABLE) == 0) + if ((m->aflags & PGA_WRITEABLE) == 0) return; vm_page_lock_queues(); sched_pin(); Modified: head/sys/i386/xen/pmap.c ============================================================================== --- head/sys/i386/xen/pmap.c Tue Sep 6 10:21:33 2011 (r225417) +++ head/sys/i386/xen/pmap.c Tue Sep 6 10:30:11 2011 (r225418) @@ -2037,7 +2037,7 @@ pmap_collect(pmap_t locked_pmap, struct KASSERT((tpte & PG_W) == 0, ("pmap_collect: wired pte %#jx", (uintmax_t)tpte)); if (tpte & PG_A) - vm_page_flag_set(m, PG_REFERENCED); + vm_page_aflag_set(m, PGA_REFERENCED); if ((tpte & (PG_M | PG_RW)) == (PG_M | PG_RW)) vm_page_dirty(m); free = NULL; @@ -2050,7 +2050,7 @@ pmap_collect(pmap_t locked_pmap, struct PMAP_UNLOCK(pmap); } if (TAILQ_EMPTY(&m->md.pv_list)) - vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_aflag_clear(m, PGA_WRITEABLE); } sched_unpin(); } @@ -2222,7 +2222,7 @@ pmap_remove_entry(pmap_t pmap, vm_page_t mtx_assert(&vm_page_queue_mtx, MA_OWNED); pmap_pvh_free(&m->md, pmap, va); if (TAILQ_EMPTY(&m->md.pv_list)) - vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_aflag_clear(m, PGA_WRITEABLE); } /* @@ -2274,7 +2274,7 @@ pmap_remove_pte(pmap_t pmap, pt_entry_t if ((oldpte & (PG_M | PG_RW)) == (PG_M | PG_RW)) vm_page_dirty(m); if (oldpte & PG_A) - vm_page_flag_set(m, PG_REFERENCED); + vm_page_aflag_set(m, PGA_REFERENCED); pmap_remove_entry(pmap, m, va); } return (pmap_unuse_pt(pmap, va, free)); @@ -2446,7 +2446,7 @@ pmap_remove_all(vm_page_t m) if (tpte & PG_W) pmap->pm_stats.wired_count--; if (tpte & PG_A) - vm_page_flag_set(m, PG_REFERENCED); + vm_page_aflag_set(m, PGA_REFERENCED); /* * Update the vm_page_t clean and reference bits. @@ -2459,7 +2459,7 @@ pmap_remove_all(vm_page_t m) free_pv_entry(pmap, pv); PMAP_UNLOCK(pmap); } - vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_aflag_clear(m, PGA_WRITEABLE); PT_UPDATES_FLUSH(); if (*PMAP1) PT_SET_MA(PADDR1, 0); @@ -2739,7 +2739,7 @@ validate: if ((prot & VM_PROT_WRITE) != 0) { newpte |= PG_RW; if ((newpte & PG_MANAGED) != 0) - vm_page_flag_set(m, PG_WRITEABLE); + vm_page_aflag_set(m, PGA_WRITEABLE); } #ifdef PAE if ((prot & VM_PROT_EXECUTE) == 0) @@ -2764,7 +2764,7 @@ validate: PT_SET_VA(pte, newpte | PG_A, FALSE); if (origpte & PG_A) { if (origpte & PG_MANAGED) - vm_page_flag_set(om, PG_REFERENCED); + vm_page_aflag_set(om, PGA_REFERENCED); if (opa != VM_PAGE_TO_PHYS(m)) invlva = TRUE; #ifdef PAE @@ -2781,7 +2781,7 @@ validate: } if ((origpte & PG_MANAGED) != 0 && TAILQ_EMPTY(&om->md.pv_list)) - vm_page_flag_clear(om, PG_WRITEABLE); + vm_page_aflag_clear(om, PGA_WRITEABLE); if (invlva) pmap_invalidate_page(pmap, va); } else{ @@ -3549,7 +3549,7 @@ pmap_remove_pages(pmap_t pmap) TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); if (TAILQ_EMPTY(&m->md.pv_list)) - vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_aflag_clear(m, PGA_WRITEABLE); pmap_unuse_pt(pmap, pv->pv_va, &free); @@ -3604,13 +3604,13 @@ pmap_is_modified(vm_page_t m) rv = FALSE; /* - * If the page is not VPO_BUSY, then PG_WRITEABLE cannot be - * concurrently set while the object is locked. Thus, if PG_WRITEABLE + * If the page is not VPO_BUSY, then PGA_WRITEABLE cannot be + * concurrently set while the object is locked. Thus, if PGA_WRITEABLE * is clear, no PTEs can have PG_M set. */ VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); if ((m->oflags & VPO_BUSY) == 0 && - (m->flags & PG_WRITEABLE) == 0) + (m->aflags & PGA_WRITEABLE) == 0) return (rv); vm_page_lock_queues(); sched_pin(); @@ -3735,13 +3735,13 @@ pmap_remove_write(vm_page_t m) ("pmap_remove_write: page %p is not managed", m)); /* - * If the page is not VPO_BUSY, then PG_WRITEABLE cannot be set by - * another thread while the object is locked. Thus, if PG_WRITEABLE + * If the page is not VPO_BUSY, then PGA_WRITEABLE cannot be set by + * another thread while the object is locked. Thus, if PGA_WRITEABLE * is clear, no page table entries need updating. */ VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); if ((m->oflags & VPO_BUSY) == 0 && - (m->flags & PG_WRITEABLE) == 0) + (m->aflags & PGA_WRITEABLE) == 0) return; vm_page_lock_queues(); sched_pin(); @@ -3769,7 +3769,7 @@ retry: } PMAP_UNLOCK(pmap); } - vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_aflag_clear(m, PGA_WRITEABLE); PT_UPDATES_FLUSH(); if (*PMAP1) PT_SET_MA(PADDR1, 0); @@ -3846,11 +3846,11 @@ pmap_clear_modify(vm_page_t m) ("pmap_clear_modify: page %p is busy", m)); /* - * If the page is not PG_WRITEABLE, then no PTEs can have PG_M set. + * If the page is not PGA_WRITEABLE, then no PTEs can have PG_M set. * If the object containing the page is locked and the page is not - * VPO_BUSY, then PG_WRITEABLE cannot be concurrently set. + * VPO_BUSY, then PGA_WRITEABLE cannot be concurrently set. */ - if ((m->flags & PG_WRITEABLE) == 0) + if ((m->aflags & PGA_WRITEABLE) == 0) return; vm_page_lock_queues(); sched_pin(); Modified: head/sys/ia64/ia64/pmap.c ============================================================================== --- head/sys/ia64/ia64/pmap.c Tue Sep 6 10:21:33 2011 (r225417) +++ head/sys/ia64/ia64/pmap.c Tue Sep 6 10:30:11 2011 (r225418) @@ -804,7 +804,7 @@ retry: pmap_invalidate_page(va); pmap_switch(oldpmap); if (pmap_accessed(pte)) - vm_page_flag_set(m, PG_REFERENCED); + vm_page_aflag_set(m, PGA_REFERENCED); if (pmap_dirty(pte)) vm_page_dirty(m); pmap_free_pte(pte, va); @@ -819,7 +819,7 @@ retry: free_pv_entry(pv); } if (TAILQ_EMPTY(&m->md.pv_list)) - vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_aflag_clear(m, PGA_WRITEABLE); } if (allocated_pv == NULL) { if (vpq == &vm_page_queues[PQ_INACTIVE]) { @@ -972,7 +972,7 @@ pmap_remove_entry(pmap_t pmap, vm_page_t TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); m->md.pv_list_count--; if (TAILQ_FIRST(&m->md.pv_list) == NULL) - vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_aflag_clear(m, PGA_WRITEABLE); TAILQ_REMOVE(&pmap->pm_pvlist, pv, pv_plist); free_pv_entry(pv); @@ -1198,7 +1198,7 @@ pmap_remove_pte(pmap_t pmap, struct ia64 if (pmap_dirty(pte)) vm_page_dirty(m); if (pmap_accessed(pte)) - vm_page_flag_set(m, PG_REFERENCED); + vm_page_aflag_set(m, PGA_REFERENCED); error = pmap_remove_entry(pmap, m, va, pv); } @@ -1460,7 +1460,7 @@ pmap_remove_all(vm_page_t m) pmap_switch(oldpmap); PMAP_UNLOCK(pmap); } - vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_aflag_clear(m, PGA_WRITEABLE); vm_page_unlock_queues(); } @@ -1647,7 +1647,7 @@ validate: ia64_sync_icache(va, PAGE_SIZE); if ((prot & VM_PROT_WRITE) != 0 && managed) - vm_page_flag_set(m, PG_WRITEABLE); + vm_page_aflag_set(m, PGA_WRITEABLE); vm_page_unlock_queues(); pmap_switch(oldpmap); PMAP_UNLOCK(pmap); @@ -2048,13 +2048,13 @@ pmap_is_modified(vm_page_t m) rv = FALSE; /* - * If the page is not VPO_BUSY, then PG_WRITEABLE cannot be - * concurrently set while the object is locked. Thus, if PG_WRITEABLE + * If the page is not VPO_BUSY, then PGA_WRITEABLE cannot be + * concurrently set while the object is locked. Thus, if PGA_WRITEABLE * is clear, no PTEs can be dirty. */ VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); if ((m->oflags & VPO_BUSY) == 0 && - (m->flags & PG_WRITEABLE) == 0) + (m->aflags & PGA_WRITEABLE) == 0) return (rv); vm_page_lock_queues(); TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { @@ -2139,11 +2139,11 @@ pmap_clear_modify(vm_page_t m) ("pmap_clear_modify: page %p is busy", m)); /* - * If the page is not PG_WRITEABLE, then no PTEs can be modified. + * If the page is not PGA_WRITEABLE, then no PTEs can be modified. * If the object containing the page is locked and the page is not - * VPO_BUSY, then PG_WRITEABLE cannot be concurrently set. + * VPO_BUSY, then PGA_WRITEABLE cannot be concurrently set. */ - if ((m->flags & PG_WRITEABLE) == 0) + if ((m->aflags & PGA_WRITEABLE) == 0) return; vm_page_lock_queues(); TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { @@ -2206,13 +2206,13 @@ pmap_remove_write(vm_page_t m) ("pmap_remove_write: page %p is not managed", m)); /* - * If the page is not VPO_BUSY, then PG_WRITEABLE cannot be set by - * another thread while the object is locked. Thus, if PG_WRITEABLE + * If the page is not VPO_BUSY, then PGA_WRITEABLE cannot be set by + * another thread while the object is locked. Thus, if PGA_WRITEABLE * is clear, no page table entries need updating. */ VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); if ((m->oflags & VPO_BUSY) == 0 && - (m->flags & PG_WRITEABLE) == 0) + (m->aflags & PGA_WRITEABLE) == 0) return; vm_page_lock_queues(); TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { @@ -2235,7 +2235,7 @@ pmap_remove_write(vm_page_t m) pmap_switch(oldpmap); PMAP_UNLOCK(pmap); } - vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_aflag_clear(m, PGA_WRITEABLE); vm_page_unlock_queues(); } Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Tue Sep 6 10:21:33 2011 (r225417) +++ head/sys/mips/mips/pmap.c Tue Sep 6 10:30:11 2011 (r225418) @@ -1432,7 +1432,7 @@ retry: KASSERT(!pte_test(&oldpte, PTE_W), ("wired pte for unwired page")); if (m->md.pv_flags & PV_TABLE_REF) - vm_page_flag_set(m, PG_REFERENCED); + vm_page_aflag_set(m, PGA_REFERENCED); if (pte_test(&oldpte, PTE_D)) vm_page_dirty(m); pmap_invalidate_page(pmap, va); @@ -1448,7 +1448,7 @@ retry: free_pv_entry(pv); } if (TAILQ_EMPTY(&m->md.pv_list)) { - vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_aflag_clear(m, PGA_WRITEABLE); m->md.pv_flags &= ~(PV_TABLE_REF | PV_TABLE_MOD); } } @@ -1527,7 +1527,7 @@ pmap_remove_entry(pmap_t pmap, vm_page_t mtx_assert(&vm_page_queue_mtx, MA_OWNED); pmap_pvh_free(&m->md, pmap, va); if (TAILQ_EMPTY(&m->md.pv_list)) - vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_aflag_clear(m, PGA_WRITEABLE); } /* @@ -1589,7 +1589,7 @@ pmap_remove_pte(struct pmap *pmap, pt_en vm_page_dirty(m); } if (m->md.pv_flags & PV_TABLE_REF) - vm_page_flag_set(m, PG_REFERENCED); + vm_page_aflag_set(m, PGA_REFERENCED); m->md.pv_flags &= ~(PV_TABLE_REF | PV_TABLE_MOD); pmap_remove_entry(pmap, m, va); @@ -1713,7 +1713,7 @@ pmap_remove_all(vm_page_t m) vm_page_lock_queues(); if (m->md.pv_flags & PV_TABLE_REF) - vm_page_flag_set(m, PG_REFERENCED); + vm_page_aflag_set(m, PGA_REFERENCED); while ((pv = TAILQ_FIRST(&m->md.pv_list)) != NULL) { PMAP_LOCK(pv->pv_pmap); @@ -1757,7 +1757,7 @@ pmap_remove_all(vm_page_t m) free_pv_entry(pv); } - vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_aflag_clear(m, PGA_WRITEABLE); m->md.pv_flags &= ~(PV_TABLE_REF | PV_TABLE_MOD); vm_page_unlock_queues(); } @@ -2004,7 +2004,7 @@ validate: *pte = newpte; if (page_is_managed(opa) && (opa != pa)) { if (om->md.pv_flags & PV_TABLE_REF) - vm_page_flag_set(om, PG_REFERENCED); + vm_page_aflag_set(om, PGA_REFERENCED); om->md.pv_flags &= ~(PV_TABLE_REF | PV_TABLE_MOD); } @@ -2017,7 +2017,7 @@ validate: } if (page_is_managed(opa) && TAILQ_EMPTY(&om->md.pv_list)) - vm_page_flag_clear(om, PG_WRITEABLE); + vm_page_aflag_clear(om, PGA_WRITEABLE); } else { *pte = newpte; } @@ -2535,7 +2535,7 @@ pmap_remove_pages(pmap_t pmap) m->md.pv_list_count--; TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); if (TAILQ_FIRST(&m->md.pv_list) == NULL) { - vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_aflag_clear(m, PGA_WRITEABLE); } pmap_unuse_pt(pv->pv_pmap, pv->pv_va, pv->pv_ptem); free_pv_entry(pv); @@ -2615,7 +2615,7 @@ pmap_changebit(vm_page_t m, int bit, boo PMAP_UNLOCK(pv->pv_pmap); } if (!setem && bit == PTE_D) - vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_aflag_clear(m, PGA_WRITEABLE); } /* @@ -2662,13 +2662,13 @@ pmap_remove_write(vm_page_t m) ("pmap_remove_write: page %p is not managed", m)); /* - * If the page is not VPO_BUSY, then PG_WRITEABLE cannot be set by - * another thread while the object is locked. Thus, if PG_WRITEABLE + * If the page is not VPO_BUSY, then PGA_WRITEABLE cannot be set by + * another thread while the object is locked. Thus, if PGA_WRITEABLE * is clear, no page table entries need updating. */ VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); if ((m->oflags & VPO_BUSY) == 0 && - (m->flags & PG_WRITEABLE) == 0) + (m->aflags & PGA_WRITEABLE) == 0) return; /* @@ -2685,7 +2685,7 @@ pmap_remove_write(vm_page_t m) pmap_protect(pv->pv_pmap, va, va + PAGE_SIZE, VM_PROT_READ | VM_PROT_EXECUTE); } - vm_page_flag_clear(m, PG_WRITEABLE); + vm_page_aflag_clear(m, PGA_WRITEABLE); vm_page_unlock_queues(); } @@ -2724,13 +2724,13 @@ pmap_is_modified(vm_page_t m) ("pmap_is_modified: page %p is not managed", m)); /* - * If the page is not VPO_BUSY, then PG_WRITEABLE cannot be - * concurrently set while the object is locked. Thus, if PG_WRITEABLE + * If the page is not VPO_BUSY, then PGA_WRITEABLE cannot be + * concurrently set while the object is locked. Thus, if PGA_WRITEABLE * is clear, no PTEs can have PTE_D set. */ VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); if ((m->oflags & VPO_BUSY) == 0 && - (m->flags & PG_WRITEABLE) == 0) + (m->aflags & PGA_WRITEABLE) == 0) return (FALSE); vm_page_lock_queues(); if (m->md.pv_flags & PV_TABLE_MOD) @@ -2781,11 +2781,11 @@ pmap_clear_modify(vm_page_t m) ("pmap_clear_modify: page %p is busy", m)); /* - * If the page is not PG_WRITEABLE, then no PTEs can have PTE_D set. + * If the page is not PGA_WRITEABLE, then no PTEs can have PTE_D set. * If the object containing the page is locked and the page is not - * VPO_BUSY, then PG_WRITEABLE cannot be concurrently set. + * VPO_BUSY, then PGA_WRITEABLE cannot be concurrently set. */ - if ((m->flags & PG_WRITEABLE) == 0) + if ((m->aflags & PGA_WRITEABLE) == 0) return; vm_page_lock_queues(); if (m->md.pv_flags & PV_TABLE_MOD) { @@ -2929,7 +2929,7 @@ retry: * determine if the address is MINCORE_REFERENCED. */ m = PHYS_TO_VM_PAGE(pa); - if ((m->flags & PG_REFERENCED) != 0) + if ((m->aflags & PGA_REFERENCED) != 0) val |= MINCORE_REFERENCED | MINCORE_REFERENCED_OTHER; } if ((val & (MINCORE_MODIFIED_OTHER | MINCORE_REFERENCED_OTHER)) != @@ -3185,7 +3185,7 @@ init_pte_prot(vm_offset_t va, vm_page_t rw = PTE_V | PTE_D | PTE_C_CACHE; else rw = PTE_V | PTE_C_CACHE; - vm_page_flag_set(m, PG_WRITEABLE); + vm_page_aflag_set(m, PGA_WRITEABLE); } else /* Needn't emulate a modified bit for unmanaged pages. */ rw = PTE_V | PTE_D | PTE_C_CACHE; Modified: head/sys/powerpc/aim/mmu_oea.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea.c Tue Sep 6 10:21:33 2011 (r225417) +++ head/sys/powerpc/aim/mmu_oea.c Tue Sep 6 10:30:11 2011 (r225418) @@ -1102,7 +1102,7 @@ moea_enter_locked(pmap_t pmap, vm_offset pte_lo |= PTE_BW; if (pmap_bootstrapped && (m->oflags & VPO_UNMANAGED) == 0) - vm_page_flag_set(m, PG_WRITEABLE); + vm_page_aflag_set(m, PGA_WRITEABLE); } else pte_lo |= PTE_BR; @@ -1255,13 +1255,13 @@ moea_is_modified(mmu_t mmu, vm_page_t m) ("moea_is_modified: page %p is not managed", m)); /* - * If the page is not VPO_BUSY, then PG_WRITEABLE cannot be - * concurrently set while the object is locked. Thus, if PG_WRITEABLE + * If the page is not VPO_BUSY, then PGA_WRITEABLE cannot be + * concurrently set while the object is locked. Thus, if PGA_WRITEABLE * is clear, no PTEs can have PTE_CHG set. */ VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); if ((m->oflags & VPO_BUSY) == 0 && - (m->flags & PG_WRITEABLE) == 0) + (m->aflags & PGA_WRITEABLE) == 0) return (FALSE); return (moea_query_bit(m, PTE_CHG)); } @@ -1299,11 +1299,11 @@ moea_clear_modify(mmu_t mmu, vm_page_t m ("moea_clear_modify: page %p is busy", m)); /* - * If the page is not PG_WRITEABLE, then no PTEs can have PTE_CHG + * If the page is not PGA_WRITEABLE, then no PTEs can have PTE_CHG * set. If the object containing the page is locked and the page is - * not VPO_BUSY, then PG_WRITEABLE cannot be concurrently set. + * not VPO_BUSY, then PGA_WRITEABLE cannot be concurrently set. */ - if ((m->flags & PG_WRITEABLE) == 0) + if ((m->aflags & PGA_WRITEABLE) == 0) return; moea_clear_bit(m, PTE_CHG); } @@ -1323,13 +1323,13 @@ moea_remove_write(mmu_t mmu, vm_page_t m ("moea_remove_write: page %p is not managed", m)); /* - * If the page is not VPO_BUSY, then PG_WRITEABLE cannot be set by - * another thread while the object is locked. Thus, if PG_WRITEABLE + * If the page is not VPO_BUSY, then PGA_WRITEABLE cannot be set by + * another thread while the object is locked. Thus, if PGA_WRITEABLE * is clear, no page table entries need updating. */ VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); if ((m->oflags & VPO_BUSY) == 0 && - (m->flags & PG_WRITEABLE) == 0) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Tue Sep 6 10:40:22 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 081C01065689; Tue, 6 Sep 2011 10:40:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E16D98FC20; Tue, 6 Sep 2011 10:40:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p86AeLJR079433; Tue, 6 Sep 2011 10:40:21 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p86AeLCq079429; Tue, 6 Sep 2011 10:40:21 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201109061040.p86AeLCq079429@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 6 Sep 2011 10:40:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225419 - in head: . share/man/man9 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Sep 2011 10:40:22 -0000 Author: kib Date: Tue Sep 6 10:40:21 2011 New Revision: 225419 URL: http://svn.freebsd.org/changeset/base/225419 Log: Document vm_page_aflag_set(9), vm_page_aflag_clear(9) and vm_page_reference(9). Retire vm_page_flag_set() and vm_page_flag_clear() functions. Reviewed by: alc Approved by: re (bz) Added: head/share/man/man9/vm_page_aflag.9 - copied, changed from r225418, head/share/man/man9/vm_page_flag.9 Deleted: head/share/man/man9/vm_page_flag.9 Modified: head/ObsoleteFiles.inc head/share/man/man9/Makefile Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Tue Sep 6 10:30:11 2011 (r225418) +++ head/ObsoleteFiles.inc Tue Sep 6 10:40:21 2011 (r225419) @@ -38,6 +38,10 @@ # xargs -n1 | sort | uniq -d; # done +# 20110831: atomic page flags operations +OLD_FILES+=usr/share/man/man9/vm_page_flag.9.gz +OLD_FILES+=usr/share/man/man9/vm_page_flag_clear.9.gz +OLD_FILES+=usr/share/man/man9/vm_page_flag_set.9.gz # 20110828: library version bump for 9.0 OLD_LIBS+=lib/libcam.so.5 OLD_LIBS+=lib/libpcap.so.7 Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Tue Sep 6 10:30:11 2011 (r225418) +++ head/share/man/man9/Makefile Tue Sep 6 10:40:21 2011 (r225419) @@ -320,7 +320,7 @@ MAN= accept_filter.9 \ vm_page_cache.9 \ vm_page_deactivate.9 \ vm_page_dontneed.9 \ - vm_page_flag.9 \ + vm_page_aflag.9 \ vm_page_free.9 \ vm_page_grab.9 \ vm_page_hold.9 \ @@ -1372,8 +1372,9 @@ MLINKS+=vm_page_bits.9 vm_page_clear_dir vm_page_bits.9 vm_page_test_dirty.9 \ vm_page_bits.9 vm_page_undirty.9 \ vm_page_bits.9 vm_page_zero_invalid.9 -MLINKS+=vm_page_flag.9 vm_page_flag_clear.9 \ - vm_page_flag.9 vm_page_flag_set.9 +MLINKS+=vm_page_aflag.9 vm_page_aflag_clear.9 \ + vm_page_aflag.9 vm_page_aflag_set.9 \ + vm_page_aflag.9 vm_page_reference.9 MLINKS+=vm_page_free.9 vm_page_free_toq.9 \ vm_page_free.9 vm_page_free_zero.9 \ vm_page_free.9 vm_page_try_to_free.9 Copied and modified: head/share/man/man9/vm_page_aflag.9 (from r225418, head/share/man/man9/vm_page_flag.9) ============================================================================== --- head/share/man/man9/vm_page_flag.9 Tue Sep 6 10:30:11 2011 (r225418, copy source) +++ head/share/man/man9/vm_page_aflag.9 Tue Sep 6 10:40:21 2011 (r225419) @@ -26,36 +26,75 @@ .\" .\" $FreeBSD$ .\" -.Dd July 14, 2001 +.Dd August 31, 2011 .Dt VM_PAGE_FLAG 9 .Os .Sh NAME -.Nm vm_page_flag_clear , vm_page_flag_set -.Nd "change page flags" +.Nm vm_page_aflag_clear , vm_page_aflag_set , vm_page_reference +.Nd "change page atomic flags" .Sh SYNOPSIS .In sys/param.h .In vm/vm.h .In vm/vm_page.h .Ft void -.Fn vm_page_flag_clear "vm_page_t m" "unsigned short bits" +.Fn vm_page_aflag_clear "vm_page_t m" "uint8_t bits" .Ft void -.Fn vm_page_flag_set "vm_page_t m" "unsigned short bits" +.Fn vm_page_aflag_set "vm_page_t m" "uint8_t bits" +.Ft void +.Fn vm_page_reference "vm_page_t m" .Sh DESCRIPTION The -.Fn vm_page_flag_clear -atomically clears the specified bits on the page's flags. +.Fn vm_page_aflag_clear +atomically clears the specified bits on the page's +.Va aflags . +.Pp +The +.Fn vm_page_aflag_set +atomically sets the specified bits on the page's +.Va aflags . .Pp The -.Fn vm_page_flag_set -atomically sets the specified bits on the page's flags. +.Fn vm_page_reference m +call is the same as +.Bd -literal -offset indent +vm_page_aflag_set(m, PGA_REFERENCED); +.Ed +.Lp +and is the recommended way to mark the page as referenced from +third-party kernel modules. +.Pp +These functions neither block nor require any locks to be held +around the calls for correctness. .Pp The functions arguments are: .Bl -tag -width ".Fa bits" .It Fa m -The page whose flags are updated. +The page whose +.Va aflags +are updated. .It Fa bits The bits that are set or cleared on the page's flags. .El +.Pp +The following +.Va aflags +can be set or cleared: +.Bl -tag -width ".Fa PGA_REFERENCED" +.It Fa PGA_REFERENCED +The bit may be set to indicate that the page has been recently accessed. +For instance, +.Xr pmap 9 +sets this bit to reflect the accessed attribute of the page mapping +typically updated by processor's memory management unit on the page access. +.It Fa PGA_WRITEABLE +A writeable mapping for the page may exist. +.El +.Pp +Both +.Dv PGA_REFERENCED +and +.Dv PGA_WRITEABLE +bits are only valid for the managed pages. .Sh AUTHORS This manual page was written by .An Chad David Aq davidc@acns.ab.ca . From owner-svn-src-all@FreeBSD.ORG Tue Sep 6 10:49:06 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3B185106575E; Tue, 6 Sep 2011 10:49:06 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2A81B8FC0A; Tue, 6 Sep 2011 10:49:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p86An6xY081597; Tue, 6 Sep 2011 10:49:06 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p86An63i081595; Tue, 6 Sep 2011 10:49:06 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109061049.p86An63i081595@svn.freebsd.org> From: Adrian Chadd Date: Tue, 6 Sep 2011 10:49:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225420 - head/sys/dev/ath/ath_hal/ar5416 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Sep 2011 10:49:06 -0000 Author: adrian Date: Tue Sep 6 10:49:05 2011 New Revision: 225420 URL: http://svn.freebsd.org/changeset/base/225420 Log: Fix the addac serial load register write for AR5416. Obtained from: Linux, Atheros Approved by: re (kib) Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.ini Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.ini ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416.ini Tue Sep 6 10:40:21 2011 (r225419) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416.ini Tue Sep 6 10:49:05 2011 (r225420) @@ -687,7 +687,7 @@ static const uint32_t ar5416Addac[][2] = {0x0000989c, 0x00000000 }, {0x0000989c, 0x00000000 }, {0x0000989c, 0x00000000 }, - {0x000098cc, 0x00000000 }, + {0x000098c4, 0x00000000 }, }; /* hand-crafted from code that does explicit register writes */ From owner-svn-src-all@FreeBSD.ORG Tue Sep 6 10:54:56 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B244E106564A; Tue, 6 Sep 2011 10:54:56 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A1E608FC16; Tue, 6 Sep 2011 10:54:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p86AsuVs081807; Tue, 6 Sep 2011 10:54:56 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p86Asu9w081805; Tue, 6 Sep 2011 10:54:56 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109061054.p86Asu9w081805@svn.freebsd.org> From: Adrian Chadd Date: Tue, 6 Sep 2011 10:54:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225421 - head/sys/dev/ath/ath_hal/ar5416 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Sep 2011 10:54:56 -0000 Author: adrian Date: Tue Sep 6 10:54:56 2011 New Revision: 225421 URL: http://svn.freebsd.org/changeset/base/225421 Log: Fix 5ghz calibration logic when using AR9280 w/ fast clock. When the fast clock (44mhz) is enabled for 5ghz HT20, the dual ADCs aren't enabled. Trying to do the ADC calibrations here would result in calibration never completing; this resulted in IQ calibration never running and thus performance issues in 11a/11n HT20 mode. Leave it enabled for non-fastclock (40mhz) 11a mode and HT40 modes. This has been fixed in discussion with Felix Fietkau (nbd) and discussions with the Atheros baseband team. Linux ath9k now has a similar fix. Approved by: re (kib) Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Tue Sep 6 10:49:05 2011 (r225420) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Tue Sep 6 10:54:56 2011 (r225421) @@ -72,16 +72,17 @@ ar5416IsCalSupp(struct ath_hal *ah, cons return !IEEE80211_IS_CHAN_B(chan); case ADC_GAIN_CAL: case ADC_DC_CAL: - /* Run ADC Gain Cal for either 5ghz any or 2ghz HT40 */ /* - * Merlin (AR9280) doesn't ever complete ADC calibrations - * in 5ghz non-HT40 mode (ie, HT20, 11a). For now, disable - * it for Merlin only until further information is - * available. + * Run ADC Gain Cal for either 5ghz any or 2ghz HT40. + * + * Don't run ADC calibrations for 5ghz fast clock mode + * in HT20 - only one ADC is used. */ - if (! AR_SREV_MERLIN(ah)) - if (IEEE80211_IS_CHAN_5GHZ(chan)) - return AH_TRUE; + if (IEEE80211_IS_CHAN_HT20(chan) && + (IS_5GHZ_FAST_CLOCK_EN(ah, chan))) + return AH_FALSE; + if (IEEE80211_IS_CHAN_5GHZ(chan)) + return AH_TRUE; if (IEEE80211_IS_CHAN_HT40(chan)) return AH_TRUE; return AH_FALSE; From owner-svn-src-all@FreeBSD.ORG Tue Sep 6 14:49:39 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 761E11065670; Tue, 6 Sep 2011 14:49:39 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4C63C8FC12; Tue, 6 Sep 2011 14:49:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p86Endkd088955; Tue, 6 Sep 2011 14:49:39 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p86EndiD088953; Tue, 6 Sep 2011 14:49:39 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201109061449.p86EndiD088953@svn.freebsd.org> From: John Baldwin Date: Tue, 6 Sep 2011 14:49:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org X-SVN-Group: svnadmin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225422 - svnadmin/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Sep 2011 14:49:39 -0000 Author: jhb Date: Tue Sep 6 14:49:38 2011 New Revision: 225422 URL: http://svn.freebsd.org/changeset/base/225422 Log: Take Hellmuth's commit bit into safe keeping per his request to core@. Approved by: core Modified: svnadmin/conf/access Modified: svnadmin/conf/access ============================================================================== --- svnadmin/conf/access Tue Sep 6 10:54:56 2011 (r225421) +++ svnadmin/conf/access Tue Sep 6 14:49:38 2011 (r225422) @@ -98,7 +98,6 @@ grog gshapiro freebsd-cvs-committers@g.gshapiro.net guido harti -hm hmp hrs hselasky From owner-svn-src-all@FreeBSD.ORG Tue Sep 6 16:34:34 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E81E6106566C; Tue, 6 Sep 2011 16:34:34 +0000 (UTC) (envelope-from marcel@xcllnt.net) Received: from mail.xcllnt.net (mail.xcllnt.net [70.36.220.4]) by mx1.freebsd.org (Postfix) with ESMTP id B69238FC1E; Tue, 6 Sep 2011 16:34:34 +0000 (UTC) Received: from sa-nc-common-128.static.jnpr.net (natint3.juniper.net [66.129.224.36]) (authenticated bits=0) by mail.xcllnt.net (8.14.5/8.14.5) with ESMTP id p86GYR1I042543 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Tue, 6 Sep 2011 09:34:33 -0700 (PDT) (envelope-from marcel@xcllnt.net) Mime-Version: 1.0 (Apple Message framework v1244.3) Content-Type: text/plain; charset=us-ascii From: Marcel Moolenaar In-Reply-To: <201109061021.p86ALXBF078723@svn.freebsd.org> Date: Tue, 6 Sep 2011 09:34:25 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <9B3A5F0E-4F7D-4F63-B940-65572CEF6841@xcllnt.net> References: <201109061021.p86ALXBF078723@svn.freebsd.org> To: Konstantin Belousov X-Mailer: Apple Mail (2.1244.3) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r225417 - head/libexec/rtld-elf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Sep 2011 16:34:35 -0000 On Sep 6, 2011, at 3:21 AM, Konstantin Belousov wrote: > Author: kib > Date: Tue Sep 6 10:21:33 2011 > New Revision: 225417 > URL: http://svn.freebsd.org/changeset/base/225417 >=20 > Log: > Do not use the function pointers for the internal operation of = rtld_printf() > functions. The _rtld_error() function might be called early during = the rtld > bootstrap, in which case function pointers are not yet functional on = ia64 > due to required relocations not yet performed. Thanks! --=20 Marcel Moolenaar marcel@xcllnt.net From owner-svn-src-all@FreeBSD.ORG Tue Sep 6 17:22:41 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 452FC106564A; Tue, 6 Sep 2011 17:22:41 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 343328FC16; Tue, 6 Sep 2011 17:22:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p86HMfZc094439; Tue, 6 Sep 2011 17:22:41 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p86HMf0P094437; Tue, 6 Sep 2011 17:22:41 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201109061722.p86HMf0P094437@svn.freebsd.org> From: Edward Tomasz Napierala Date: Tue, 6 Sep 2011 17:22:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225426 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Sep 2011 17:22:41 -0000 Author: trasz Date: Tue Sep 6 17:22:40 2011 New Revision: 225426 URL: http://svn.freebsd.org/changeset/base/225426 Log: Work around a kernel panic triggered by forkbomb with an rctl rule such as j:name:maxproc:sigkill=100. Proper fix - deferring psignal to a taskqueue - is somewhat complicated and thus will happen after 9.0. Approved by: re (kib) Modified: head/sys/kern/kern_rctl.c Modified: head/sys/kern/kern_rctl.c ============================================================================== --- head/sys/kern/kern_rctl.c Tue Sep 6 17:21:39 2011 (r225425) +++ head/sys/kern/kern_rctl.c Tue Sep 6 17:22:40 2011 (r225426) @@ -363,6 +363,17 @@ rctl_enforce(struct proc *p, int resourc rule->rr_action)); /* + * We're supposed to send a signal, but the process + * is not fully initialized yet, probably because we + * got called from fork1(). For now just deny the + * allocation instead. + */ + if (p->p_state != PRS_NORMAL) { + should_deny = 1; + continue; + } + + /* * We're using the fact that RCTL_ACTION_SIG* values * are equal to their counterparts from sys/signal.h. */ From owner-svn-src-all@FreeBSD.ORG Wed Sep 7 00:43:29 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 43ACA1065670; Wed, 7 Sep 2011 00:43:29 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 32F998FC17; Wed, 7 Sep 2011 00:43:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p870hT2R008124; Wed, 7 Sep 2011 00:43:29 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p870hTxb008122; Wed, 7 Sep 2011 00:43:29 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201109070043.p870hTxb008122@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Wed, 7 Sep 2011 00:43:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225428 - head/sys/dev/mfi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Sep 2011 00:43:29 -0000 Author: bz Date: Wed Sep 7 00:43:28 2011 New Revision: 225428 URL: http://svn.freebsd.org/changeset/base/225428 Log: Shorten a variable access some using a cached value rather than casting the input argument again, making the code more readable. Reviewed by: jhb MFC after: 2 weeks Approved by: re (kib) Modified: head/sys/dev/mfi/mfi.c Modified: head/sys/dev/mfi/mfi.c ============================================================================== --- head/sys/dev/mfi/mfi.c Wed Sep 7 00:16:36 2011 (r225427) +++ head/sys/dev/mfi/mfi.c Wed Sep 7 00:43:28 2011 (r225428) @@ -2132,8 +2132,7 @@ mfi_ioctl(struct cdev *dev, u_long cmd, if (ioc->mfi_sense_len) { /* get user-space sense ptr then copy out sense */ - bcopy(&((struct mfi_ioc_packet*)arg) - ->mfi_frame.raw[ioc->mfi_sense_off], + bcopy(&ioc->mfi_frame.raw[ioc->mfi_sense_off], &sense_ptr.sense_ptr_data[0], sizeof(sense_ptr.sense_ptr_data)); #ifdef __amd64__ From owner-svn-src-all@FreeBSD.ORG Wed Sep 7 00:45:15 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BC58110656EE; Wed, 7 Sep 2011 00:45:15 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AB2888FC0C; Wed, 7 Sep 2011 00:45:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p870jFFF008234; Wed, 7 Sep 2011 00:45:15 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p870jFrb008231; Wed, 7 Sep 2011 00:45:15 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201109070045.p870jFrb008231@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Wed, 7 Sep 2011 00:45:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225429 - head/usr.sbin/bsdinstall/scripts X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Sep 2011 00:45:15 -0000 Author: bz Date: Wed Sep 7 00:45:15 2011 New Revision: 225429 URL: http://svn.freebsd.org/changeset/base/225429 Log: Fix two problems: 1) if no default gateway is given the route command will fail and the script will abort with an error leading to an endless loop unless configuration is cancelled or changed. [1] 2) In the IPv6 case add -inet6 to not alter the legacy IP default route. Reported by: Oleg Ginzburg (olevole olevole.ru) [1] Tested by: Oleg Ginzburg (olevole olevole.ru) [1] Approved by: re (kib) Modified: head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 head/usr.sbin/bsdinstall/scripts/netconfig_ipv6 Modified: head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 ============================================================================== --- head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Wed Sep 7 00:43:28 2011 (r225428) +++ head/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Wed Sep 7 00:45:15 2011 (r225429) @@ -79,7 +79,9 @@ echo $INTERFACE $IF_CONFIG | if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then . $BSDINSTALL_TMPETC/._rc.conf.net ifconfig $INTERFACE `eval echo \\\$ifconfig_$INTERFACE` - route delete -inet default - route add -inet default $defaultrouter + if [ -n "${defaultrouter}" ]; then + route delete -inet default + route add -inet default $defaultrouter + fi fi Modified: head/usr.sbin/bsdinstall/scripts/netconfig_ipv6 ============================================================================== --- head/usr.sbin/bsdinstall/scripts/netconfig_ipv6 Wed Sep 7 00:43:28 2011 (r225428) +++ head/usr.sbin/bsdinstall/scripts/netconfig_ipv6 Wed Sep 7 00:45:15 2011 (r225429) @@ -142,7 +142,9 @@ BEGIN { if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then . $BSDINSTALL_TMPETC/._rc.conf.net ifconfig ${INTERFACE} `eval echo \\\$ifconfig_${INTERFACE}_ipv6` - route delete default - route add default ${ipv6_defaultrouter} + if [ -n "${ipv6_defaultrouter}" ]; then + route delete -inet6 default + route add -inet6 default ${ipv6_defaultrouter} + fi fi From owner-svn-src-all@FreeBSD.ORG Wed Sep 7 00:48:58 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D2DD61065781; Wed, 7 Sep 2011 00:48:58 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C201F8FC14; Wed, 7 Sep 2011 00:48:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p870mwxF008386; Wed, 7 Sep 2011 00:48:58 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p870mw6H008384; Wed, 7 Sep 2011 00:48:58 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201109070048.p870mw6H008384@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Wed, 7 Sep 2011 00:48:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225430 - head/usr.sbin/bsdinstall/scripts X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Sep 2011 00:48:58 -0000 Author: bz Date: Wed Sep 7 00:48:58 2011 New Revision: 225430 URL: http://svn.freebsd.org/changeset/base/225430 Log: Correct a typo. Submitted by: gcooper Reviewed by: nwhitehorn Approved by: re (kib) Modified: head/usr.sbin/bsdinstall/scripts/netconfig Modified: head/usr.sbin/bsdinstall/scripts/netconfig ============================================================================== --- head/usr.sbin/bsdinstall/scripts/netconfig Wed Sep 7 00:45:15 2011 (r225429) +++ head/usr.sbin/bsdinstall/scripts/netconfig Wed Sep 7 00:48:58 2011 (r225430) @@ -165,7 +165,7 @@ fi exec 3>&1 RESOLV=$(echo "${RESOLV}" | xargs dialog --backtitle 'FreeBSD Installer' \ --title 'Network Configuration' \ - --mixedform 'Resovler Configuration' 0 0 0 \ + --mixedform 'Resolver Configuration' 0 0 0 \ 2>&1 1>&3) if [ $? -eq $DIALOG_CANCEL ]; then exec $0; fi exec 3>&- From owner-svn-src-all@FreeBSD.ORG Wed Sep 7 03:00:59 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2843E106575A; Wed, 7 Sep 2011 03:00:59 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 16E858FC08; Wed, 7 Sep 2011 03:00:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8730wYH012328; Wed, 7 Sep 2011 03:00:58 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8730wc3012326; Wed, 7 Sep 2011 03:00:58 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109070300.p8730wc3012326@svn.freebsd.org> From: Adrian Chadd Date: Wed, 7 Sep 2011 03:00:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225431 - head/sys/dev/ath/ath_hal/ar5416 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Sep 2011 03:00:59 -0000 Author: adrian Date: Wed Sep 7 03:00:58 2011 New Revision: 225431 URL: http://svn.freebsd.org/changeset/base/225431 Log: Add a definition for ASYNC_CAUSE_CLR. It's not used yet, but the reference driver does clear the async interrupts after each service. I'll tinker with this in a future commit. Obtained from: Atheros Approved by: re (kib) Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416reg.h Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416reg.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416reg.h Wed Sep 7 00:48:58 2011 (r225430) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416reg.h Wed Sep 7 03:00:58 2011 (r225431) @@ -40,6 +40,7 @@ #define AR_INTR_ASYNC_MASK 0x4030 /* asynchronous interrupt mask */ #define AR_INTR_SYNC_MASK 0x4034 /* synchronous interrupt mask */ #define AR_INTR_ASYNC_CAUSE 0x4038 /* check pending interrupts */ +#define AR_INTR_ASYNC_CAUSE_CLR 0x4038 /* clear pending interrupts */ #define AR_INTR_ASYNC_ENABLE 0x403c /* enable interrupts */ #define AR5416_PCIE_SERDES 0x4040 #define AR5416_PCIE_SERDES2 0x4044 From owner-svn-src-all@FreeBSD.ORG Wed Sep 7 07:52:45 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DFF6A106566B; Wed, 7 Sep 2011 07:52:45 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CEF798FC14; Wed, 7 Sep 2011 07:52:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p877qjxb021464; Wed, 7 Sep 2011 07:52:45 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p877qjH8021462; Wed, 7 Sep 2011 07:52:45 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201109070752.p877qjH8021462@svn.freebsd.org> From: Edward Tomasz Napierala Date: Wed, 7 Sep 2011 07:52:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225433 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Sep 2011 07:52:46 -0000 Author: trasz Date: Wed Sep 7 07:52:45 2011 New Revision: 225433 URL: http://svn.freebsd.org/changeset/base/225433 Log: Fix whitespace. Submitted by: amdmi3 Approved by: re (rwatson) Modified: head/sys/kern/kern_rctl.c Modified: head/sys/kern/kern_rctl.c ============================================================================== --- head/sys/kern/kern_rctl.c Wed Sep 7 07:24:46 2011 (r225432) +++ head/sys/kern/kern_rctl.c Wed Sep 7 07:52:45 2011 (r225433) @@ -368,7 +368,7 @@ rctl_enforce(struct proc *p, int resourc * got called from fork1(). For now just deny the * allocation instead. */ - if (p->p_state != PRS_NORMAL) { + if (p->p_state != PRS_NORMAL) { should_deny = 1; continue; } From owner-svn-src-all@FreeBSD.ORG Wed Sep 7 16:57:44 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4E32F106564A; Wed, 7 Sep 2011 16:57:44 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 32C3E8FC0A; Wed, 7 Sep 2011 16:57:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p87Gviog048309; Wed, 7 Sep 2011 16:57:44 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p87GviWT048306; Wed, 7 Sep 2011 16:57:44 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201109071657.p87GviWT048306@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 7 Sep 2011 16:57:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225440 - head/sys/dev/vge X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Sep 2011 16:57:44 -0000 Author: yongari Date: Wed Sep 7 16:57:43 2011 New Revision: 225440 URL: http://svn.freebsd.org/changeset/base/225440 Log: vge(4) hardwares poll media status and generates an interrupt whenever the link state is changed. Using software based polling for media status tracking is known to cause MII access failure under certain conditions once link is established so vge(4) used to rely on link status change interrupt. However DEVICE_POLLING completely disables generation of all kind of interrupts on vge(4) such that this resulted in not detecting link state change event. This means vge(4) does not correctly detect established/lost link with DEVICE_POLLING. Losing the interrupt made vge(4) not to send any packets to peer since vge(4) does not try to send any packets when there is no established link. Work around the issue by generating link state change interrupt with DEVICE_POLLING. PR: kern/160442 Approved by: re (kib) Modified: head/sys/dev/vge/if_vge.c head/sys/dev/vge/if_vgereg.h Modified: head/sys/dev/vge/if_vge.c ============================================================================== --- head/sys/dev/vge/if_vge.c Wed Sep 7 14:37:51 2011 (r225439) +++ head/sys/dev/vge/if_vge.c Wed Sep 7 16:57:43 2011 (r225440) @@ -1752,6 +1752,10 @@ vge_intr(void *arg) #ifdef DEVICE_POLLING if (ifp->if_capenable & IFCAP_POLLING) { + status = CSR_READ_4(sc, VGE_ISR); + CSR_WRITE_4(sc, VGE_ISR, status); + if (status != 0xFFFFFFFF && (status & VGE_ISR_LINKSTS) != 0) + vge_link_statchg(sc); VGE_UNLOCK(sc); return; } @@ -2109,11 +2113,10 @@ vge_init_locked(struct vge_softc *sc) #ifdef DEVICE_POLLING /* - * Disable interrupts if we are polling. + * Disable interrupts except link state change if we are polling. */ if (ifp->if_capenable & IFCAP_POLLING) { - CSR_WRITE_4(sc, VGE_IMR, 0); - CSR_WRITE_1(sc, VGE_CRC3, VGE_CR3_INT_GMSK); + CSR_WRITE_4(sc, VGE_IMR, VGE_INTRS_POLLING); } else /* otherwise ... */ #endif { @@ -2121,9 +2124,9 @@ vge_init_locked(struct vge_softc *sc) * Enable interrupts. */ CSR_WRITE_4(sc, VGE_IMR, VGE_INTRS); - CSR_WRITE_4(sc, VGE_ISR, 0xFFFFFFFF); - CSR_WRITE_1(sc, VGE_CRS3, VGE_CR3_INT_GMSK); } + CSR_WRITE_4(sc, VGE_ISR, 0xFFFFFFFF); + CSR_WRITE_1(sc, VGE_CRS3, VGE_CR3_INT_GMSK); sc->vge_flags &= ~VGE_FLAG_LINK; mii_mediachg(mii); @@ -2280,8 +2283,9 @@ vge_ioctl(struct ifnet *ifp, u_long comm return (error); VGE_LOCK(sc); /* Disable interrupts */ - CSR_WRITE_4(sc, VGE_IMR, 0); - CSR_WRITE_1(sc, VGE_CRC3, VGE_CR3_INT_GMSK); + CSR_WRITE_4(sc, VGE_IMR, VGE_INTRS_POLLING); + CSR_WRITE_4(sc, VGE_ISR, 0xFFFFFFFF); + CSR_WRITE_1(sc, VGE_CRS3, VGE_CR3_INT_GMSK); ifp->if_capenable |= IFCAP_POLLING; VGE_UNLOCK(sc); } else { Modified: head/sys/dev/vge/if_vgereg.h ============================================================================== --- head/sys/dev/vge/if_vgereg.h Wed Sep 7 14:37:51 2011 (r225439) +++ head/sys/dev/vge/if_vgereg.h Wed Sep 7 16:57:43 2011 (r225440) @@ -302,6 +302,8 @@ VGE_ISR_LINKSTS|VGE_ISR_RXNODESC| \ VGE_ISR_RXDMA_STALL|VGE_ISR_TXDMA_STALL) +#define VGE_INTRS_POLLING (VGE_ISR_PHYINT|VGE_ISR_LINKSTS) + /* Interrupt mask register */ #define VGE_IMR_RXOK_HIPRIO 0x00000001 /* hi prio RX int */ From owner-svn-src-all@FreeBSD.ORG Thu Sep 8 00:45:28 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E079E1065674; Thu, 8 Sep 2011 00:45:28 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B638E8FC13; Thu, 8 Sep 2011 00:45:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p880jSZh062428; Thu, 8 Sep 2011 00:45:28 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p880jSOG062426; Thu, 8 Sep 2011 00:45:28 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201109080045.p880jSOG062426@svn.freebsd.org> From: Rick Macklem Date: Thu, 8 Sep 2011 00:45:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225442 - stable/8/usr.bin/nfsstat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Sep 2011 00:45:29 -0000 Author: rmacklem Date: Thu Sep 8 00:45:28 2011 New Revision: 225442 URL: http://svn.freebsd.org/changeset/base/225442 Log: MFC: r225109 Fix nfsstat(1) so that it prints out correct stats for the new NFS server when the "-w" option is used. The problem was spotted by hrs@ during testing where srvrpcnt[] must be indexed by NFSV4OP_XXX and not NFSPROC_XXX. Modified: stable/8/usr.bin/nfsstat/nfsstat.c Directory Properties: stable/8/usr.bin/nfsstat/ (props changed) Modified: stable/8/usr.bin/nfsstat/nfsstat.c ============================================================================== --- stable/8/usr.bin/nfsstat/nfsstat.c Wed Sep 7 18:00:05 2011 (r225441) +++ stable/8/usr.bin/nfsstat/nfsstat.c Thu Sep 8 00:45:28 2011 (r225442) @@ -857,24 +857,24 @@ exp_sidewaysintpr(u_int interval, int cl if (serverOnly) { printf("%s %6d %6d %6d %6d %6d %6d %6d %6d", ((clientOnly && serverOnly) ? "Server:" : ""), - nfsstats.srvrpccnt[NFSPROC_GETATTR] - - lastst.srvrpccnt[NFSPROC_GETATTR], - nfsstats.srvrpccnt[NFSPROC_LOOKUP] - - lastst.srvrpccnt[NFSPROC_LOOKUP], - nfsstats.srvrpccnt[NFSPROC_READLINK] - - lastst.srvrpccnt[NFSPROC_READLINK], - nfsstats.srvrpccnt[NFSPROC_READ] - - lastst.srvrpccnt[NFSPROC_READ], - nfsstats.srvrpccnt[NFSPROC_WRITE] - - lastst.srvrpccnt[NFSPROC_WRITE], - nfsstats.srvrpccnt[NFSPROC_RENAME] - - lastst.srvrpccnt[NFSPROC_RENAME], - nfsstats.srvrpccnt[NFSPROC_ACCESS] - - lastst.srvrpccnt[NFSPROC_ACCESS], - (nfsstats.srvrpccnt[NFSPROC_READDIR] - - lastst.srvrpccnt[NFSPROC_READDIR]) + - (nfsstats.srvrpccnt[NFSPROC_READDIRPLUS] - - lastst.srvrpccnt[NFSPROC_READDIRPLUS])); + nfsstats.srvrpccnt[NFSV4OP_GETATTR] - + lastst.srvrpccnt[NFSV4OP_GETATTR], + nfsstats.srvrpccnt[NFSV4OP_LOOKUP] - + lastst.srvrpccnt[NFSV4OP_LOOKUP], + nfsstats.srvrpccnt[NFSV4OP_READLINK] - + lastst.srvrpccnt[NFSV4OP_READLINK], + nfsstats.srvrpccnt[NFSV4OP_READ] - + lastst.srvrpccnt[NFSV4OP_READ], + nfsstats.srvrpccnt[NFSV4OP_WRITE] - + lastst.srvrpccnt[NFSV4OP_WRITE], + nfsstats.srvrpccnt[NFSV4OP_RENAME] - + lastst.srvrpccnt[NFSV4OP_RENAME], + nfsstats.srvrpccnt[NFSV4OP_ACCESS] - + lastst.srvrpccnt[NFSV4OP_ACCESS], + (nfsstats.srvrpccnt[NFSV4OP_READDIR] - + lastst.srvrpccnt[NFSV4OP_READDIR]) + + (nfsstats.srvrpccnt[NFSV4OP_READDIRPLUS] - + lastst.srvrpccnt[NFSV4OP_READDIRPLUS])); printf("\n"); lastst = nfsstats; } From owner-svn-src-all@FreeBSD.ORG Thu Sep 8 01:23:06 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 331D91065675; Thu, 8 Sep 2011 01:23:06 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 20E258FC16; Thu, 8 Sep 2011 01:23:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p881N6XM063624; Thu, 8 Sep 2011 01:23:06 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p881N5eA063604; Thu, 8 Sep 2011 01:23:05 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109080123.p881N5eA063604@svn.freebsd.org> From: Adrian Chadd Date: Thu, 8 Sep 2011 01:23:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225444 - in head/sys/dev/ath: . ath_hal ath_hal/ar5210 ath_hal/ar5211 ath_hal/ar5212 ath_hal/ar5416 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Sep 2011 01:23:06 -0000 Author: adrian Date: Thu Sep 8 01:23:05 2011 New Revision: 225444 URL: http://svn.freebsd.org/changeset/base/225444 Log: Update the TSF and next-TBTT methods to work for the AR5416 and later NICs. This is another commit in a series of TDMA support fixes for the 11n NICs. * Move ath_hal_getnexttbtt() into the HAL; write methods for it. This returns a timer value in TSF, rather than TU. * Move ath_hal_getcca() and ath_hal_setcca() into the HAL too, where they likely now belong. * Create a new HAL capability: HAL_CAP_LONG_RXDESC_TSF. The pre-11n NICs write 15 bit TSF snapshots into the RX descriptor; the AR5416 and later write 32 bit TSF snapshots into the RX descriptor. * Use the new capability to choose between 15 and 31 bit TSF adjustment functions in ath_extend_tsf(). * Write ar5416GetTsf64() and ar5416SetTsf64() methods. ar5416GetTsf64() tries to compensate for TSF changes at the 32 bit boundary. According to yin, this fixes the TDMA beaconing on 11n chipsets and TDMA stations can now associate/talk, but there are still issues with traffic stability which need to be investigated. The ath_hal_extendtsf() function is also used in RX packet timestamping; this may improve adhoc mode on the 11n chipsets. It also will affect the timestamps seen in radiotap frames. Submitted by: Kang Yin Su Approved by: re (kib) Modified: head/sys/dev/ath/ath_hal/ah.c head/sys/dev/ath/ath_hal/ah.h head/sys/dev/ath/ath_hal/ah_internal.h head/sys/dev/ath/ath_hal/ar5210/ar5210.h head/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c head/sys/dev/ath/ath_hal/ar5210/ar5210_beacon.c head/sys/dev/ath/ath_hal/ar5211/ar5211.h head/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c head/sys/dev/ath/ath_hal/ar5211/ar5211_beacon.c head/sys/dev/ath/ath_hal/ar5212/ar5212.h head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c head/sys/dev/ath/ath_hal/ar5212/ar5212_beacon.c head/sys/dev/ath/ath_hal/ar5416/ar5416.h head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c head/sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c head/sys/dev/ath/if_ath.c head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/ath_hal/ah.c ============================================================================== --- head/sys/dev/ath/ath_hal/ah.c Thu Sep 8 00:55:48 2011 (r225443) +++ head/sys/dev/ath/ath_hal/ah.c Thu Sep 8 01:23:05 2011 (r225444) @@ -657,6 +657,8 @@ ath_hal_getcapability(struct ath_hal *ah } case HAL_CAP_RXDESC_SELFLINK: /* hardware supports self-linked final RX descriptors correctly */ return pCap->halHasRxSelfLinkedTail ? HAL_OK : HAL_ENOTSUPP; + case HAL_CAP_LONG_RXDESC_TSF: /* 32 bit TSF in RX descriptor? */ + return pCap->halHasLongRxDescTsf ? HAL_OK : HAL_ENOTSUPP; default: return HAL_EINVAL; } @@ -1222,3 +1224,37 @@ ath_ee_interpolate(uint16_t target, uint } return rv; } + +/* + * Adjust the TSF. + */ +void +ath_hal_adjusttsf(struct ath_hal *ah, int32_t tsfdelta) +{ + /* XXX handle wrap/overflow */ + OS_REG_WRITE(ah, AR_TSF_L32, OS_REG_READ(ah, AR_TSF_L32) + tsfdelta); +} + +/* + * Enable or disable CCA. + */ +void +ath_hal_setcca(struct ath_hal *ah, int ena) +{ + /* + * NB: fill me in; this is not provided by default because disabling + * CCA in most locales violates regulatory. + */ +} + +/* + * Get CCA setting. + */ +int +ath_hal_getcca(struct ath_hal *ah) +{ + u_int32_t diag; + if (ath_hal_getcapability(ah, HAL_CAP_DIAG, 0, &diag) != HAL_OK) + return 1; + return ((diag & 0x500000) == 0); +} Modified: head/sys/dev/ath/ath_hal/ah.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah.h Thu Sep 8 00:55:48 2011 (r225443) +++ head/sys/dev/ath/ath_hal/ah.h Thu Sep 8 01:23:05 2011 (r225444) @@ -148,6 +148,7 @@ typedef enum { HAL_CAP_BSSIDMATCH = 238, /* hardware has disable bssid match */ HAL_CAP_STREAMS = 239, /* how many 802.11n spatial streams are available */ HAL_CAP_RXDESC_SELFLINK = 242, /* support a self-linked tail RX descriptor */ + HAL_CAP_LONG_RXDESC_TSF = 243, /* hardware supports 32bit TSF in RX descriptor */ } HAL_CAPABILITY_TYPE; /* @@ -996,6 +997,7 @@ struct ath_hal { void __ahdecl(*ah_setStationBeaconTimers)(struct ath_hal*, const HAL_BEACON_STATE *); void __ahdecl(*ah_resetStationBeaconTimers)(struct ath_hal*); + uint64_t __ahdecl(*ah_getNextTBTT)(struct ath_hal *); /* 802.11n Functions */ HAL_BOOL __ahdecl(*ah_chainTxDesc)(struct ath_hal *, @@ -1138,4 +1140,20 @@ extern uint32_t __ahdecl ath_computedur_ extern uint16_t __ahdecl ath_hal_computetxtime(struct ath_hal *, const HAL_RATE_TABLE *rates, uint32_t frameLen, uint16_t rateix, HAL_BOOL shortPreamble); + +/* + * Adjust the TSF. + */ +extern void __ahdecl ath_hal_adjusttsf(struct ath_hal *ah, int32_t tsfdelta); + +/* + * Enable or disable CCA. + */ +void __ahdecl ath_hal_setcca(struct ath_hal *ah, int ena); + +/* + * Get CCA setting. + */ +int __ahdecl ath_hal_getcca(struct ath_hal *ah); + #endif /* _ATH_AH_H_ */ Modified: head/sys/dev/ath/ath_hal/ah_internal.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah_internal.h Thu Sep 8 00:55:48 2011 (r225443) +++ head/sys/dev/ath/ath_hal/ah_internal.h Thu Sep 8 01:23:05 2011 (r225444) @@ -208,7 +208,8 @@ typedef struct { halBssidMatchSupport : 1, hal4kbSplitTransSupport : 1, halHasRxSelfLinkedTail : 1, - halSupportsFastClock5GHz : 1; /* Hardware supports 5ghz fast clock; check eeprom/channel before using */ + halSupportsFastClock5GHz : 1, /* Hardware supports 5ghz fast clock; check eeprom/channel before using */ + halHasLongRxDescTsf : 1; uint32_t halWirelessModes; uint16_t halTotalQueues; uint16_t halKeyCacheSize; Modified: head/sys/dev/ath/ath_hal/ar5210/ar5210.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5210/ar5210.h Thu Sep 8 00:55:48 2011 (r225443) +++ head/sys/dev/ath/ath_hal/ar5210/ar5210.h Thu Sep 8 01:23:05 2011 (r225444) @@ -268,6 +268,7 @@ extern void ar5210BeaconInit(struct ath_ extern void ar5210SetStaBeaconTimers(struct ath_hal *, const HAL_BEACON_STATE *); extern void ar5210ResetStaBeaconTimers(struct ath_hal *); +extern uint64_t ar5210GetNextTBTT(struct ath_hal *); extern HAL_BOOL ar5210IsInterruptPending(struct ath_hal *); extern HAL_BOOL ar5210GetPendingInterrupts(struct ath_hal *, HAL_INT *); Modified: head/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c Thu Sep 8 00:55:48 2011 (r225443) +++ head/sys/dev/ath/ath_hal/ar5210/ar5210_attach.c Thu Sep 8 01:23:05 2011 (r225444) @@ -148,6 +148,7 @@ static const struct ath_hal_private ar52 .ah_beaconInit = ar5210BeaconInit, .ah_setStationBeaconTimers = ar5210SetStaBeaconTimers, .ah_resetStationBeaconTimers = ar5210ResetStaBeaconTimers, + .ah_getNextTBTT = ar5210GetNextTBTT, /* Interrupt Functions */ .ah_isInterruptPending = ar5210IsInterruptPending, Modified: head/sys/dev/ath/ath_hal/ar5210/ar5210_beacon.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5210/ar5210_beacon.c Thu Sep 8 00:55:48 2011 (r225443) +++ head/sys/dev/ath/ath_hal/ar5210/ar5210_beacon.c Thu Sep 8 01:23:05 2011 (r225444) @@ -27,6 +27,17 @@ #include "ar5210/ar5210desc.h" /* + * Return the hardware NextTBTT in TSF + */ +uint64_t +ar5210GetNextTBTT(struct ath_hal *ah) +{ +#define TU_TO_TSF(_tu) (((uint64_t)(_tu)) << 10) + return TU_TO_TSF(OS_REG_READ(ah, AR_TIMER0)); +#undef TU_TO_TSF +} + +/* * Initialize all of the hardware registers used to send beacons. */ void Modified: head/sys/dev/ath/ath_hal/ar5211/ar5211.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5211/ar5211.h Thu Sep 8 00:55:48 2011 (r225443) +++ head/sys/dev/ath/ath_hal/ar5211/ar5211.h Thu Sep 8 01:23:05 2011 (r225444) @@ -296,6 +296,7 @@ extern void ar5211BeaconInit(struct ath_ extern void ar5211SetStaBeaconTimers(struct ath_hal *, const HAL_BEACON_STATE *); extern void ar5211ResetStaBeaconTimers(struct ath_hal *); +extern uint64_t ar5211GetNextTBTT(struct ath_hal *); extern HAL_BOOL ar5211IsInterruptPending(struct ath_hal *); extern HAL_BOOL ar5211GetPendingInterrupts(struct ath_hal *, HAL_INT *); Modified: head/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c Thu Sep 8 00:55:48 2011 (r225443) +++ head/sys/dev/ath/ath_hal/ar5211/ar5211_attach.c Thu Sep 8 01:23:05 2011 (r225444) @@ -148,6 +148,7 @@ static const struct ath_hal_private ar52 .ah_beaconInit = ar5211BeaconInit, .ah_setStationBeaconTimers = ar5211SetStaBeaconTimers, .ah_resetStationBeaconTimers = ar5211ResetStaBeaconTimers, + .ah_getNextTBTT = ar5211GetNextTBTT, /* Interrupt Functions */ .ah_isInterruptPending = ar5211IsInterruptPending, Modified: head/sys/dev/ath/ath_hal/ar5211/ar5211_beacon.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5211/ar5211_beacon.c Thu Sep 8 00:55:48 2011 (r225443) +++ head/sys/dev/ath/ath_hal/ar5211/ar5211_beacon.c Thu Sep 8 01:23:05 2011 (r225444) @@ -30,6 +30,17 @@ */ /* + * Return the hardware NextTBTT in TSF + */ +uint64_t +ar5211GetNextTBTT(struct ath_hal *ah) +{ +#define TU_TO_TSF(_tu) (((uint64_t)(_tu)) << 10) + return TU_TO_TSF(OS_REG_READ(ah, AR_TIMER0)); +#undef TU_TO_TSF +} + +/* * Initialize all of the hardware registers used to send beacons. */ void Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5212/ar5212.h Thu Sep 8 00:55:48 2011 (r225443) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212.h Thu Sep 8 01:23:05 2011 (r225444) @@ -430,6 +430,7 @@ extern void ar5212BeaconInit(struct ath_ extern void ar5212ResetStaBeaconTimers(struct ath_hal *ah); extern void ar5212SetStaBeaconTimers(struct ath_hal *ah, const HAL_BEACON_STATE *); +extern uint64_t ar5212GetNextTBTT(struct ath_hal *); extern HAL_BOOL ar5212IsInterruptPending(struct ath_hal *ah); extern HAL_BOOL ar5212GetPendingInterrupts(struct ath_hal *ah, HAL_INT *); Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c Thu Sep 8 00:55:48 2011 (r225443) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c Thu Sep 8 01:23:05 2011 (r225444) @@ -151,6 +151,7 @@ static const struct ath_hal_private ar52 .ah_beaconInit = ar5212BeaconInit, .ah_setStationBeaconTimers = ar5212SetStaBeaconTimers, .ah_resetStationBeaconTimers = ar5212ResetStaBeaconTimers, + .ah_getNextTBTT = ar5212GetNextTBTT, /* Interrupt Functions */ .ah_isInterruptPending = ar5212IsInterruptPending, Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_beacon.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5212/ar5212_beacon.c Thu Sep 8 00:55:48 2011 (r225443) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212_beacon.c Thu Sep 8 01:23:05 2011 (r225444) @@ -26,6 +26,17 @@ #include "ar5212/ar5212desc.h" /* + * Return the hardware NextTBTT in TSF + */ +uint64_t +ar5212GetNextTBTT(struct ath_hal *ah) +{ +#define TU_TO_TSF(_tu) (((uint64_t)(_tu)) << 10) + return TU_TO_TSF(OS_REG_READ(ah, AR_TIMER0)); +#undef TU_TO_TSF +} + +/* * Initialize all of the hardware registers used to * send beacons. Note that for station operation the * driver calls ar5212SetStaBeaconTimers instead. Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.h ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416.h Thu Sep 8 00:55:48 2011 (r225443) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416.h Thu Sep 8 01:23:05 2011 (r225444) @@ -169,6 +169,7 @@ extern void ar5416BeaconInit(struct ath_ extern void ar5416ResetStaBeaconTimers(struct ath_hal *ah); extern void ar5416SetStaBeaconTimers(struct ath_hal *ah, const HAL_BEACON_STATE *); +extern uint64_t ar5416GetNextTBTT(struct ath_hal *); extern HAL_BOOL ar5416EepromRead(struct ath_hal *, u_int off, uint16_t *data); extern HAL_BOOL ar5416EepromWrite(struct ath_hal *, u_int off, uint16_t data); @@ -186,6 +187,8 @@ extern void ar5416GpioSetIntr(struct ath extern u_int ar5416GetWirelessModes(struct ath_hal *ah); extern void ar5416SetLedState(struct ath_hal *ah, HAL_LED_STATE state); +extern uint64_t ar5416GetTsf64(struct ath_hal *ah); +extern void ar5416SetTsf64(struct ath_hal *ah, uint64_t tsf64); extern void ar5416ResetTsf(struct ath_hal *ah); extern HAL_BOOL ar5416SetAntennaSwitch(struct ath_hal *, HAL_ANT_SETTING); extern HAL_BOOL ar5416SetDecompMask(struct ath_hal *, uint16_t, int); Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Thu Sep 8 00:55:48 2011 (r225443) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Thu Sep 8 01:23:05 2011 (r225444) @@ -136,6 +136,7 @@ ar5416InitState(struct ath_hal_5416 *ahp ah->ah_gpioGet = ar5416GpioGet; ah->ah_gpioSet = ar5416GpioSet; ah->ah_gpioSetIntr = ar5416GpioSetIntr; + ah->ah_getTsf64 = ar5416GetTsf64; ah->ah_resetTsf = ar5416ResetTsf; ah->ah_getRfGain = ar5416GetRfgain; ah->ah_setAntennaSwitch = ar5416SetAntennaSwitch; @@ -160,6 +161,7 @@ ar5416InitState(struct ath_hal_5416 *ahp ah->ah_beaconInit = ar5416BeaconInit; ah->ah_setStationBeaconTimers = ar5416SetStaBeaconTimers; ah->ah_resetStationBeaconTimers = ar5416ResetStaBeaconTimers; + ah->ah_getNextTBTT = ar5416GetNextTBTT; /* 802.11n Functions */ ah->ah_chainTxDesc = ar5416ChainTxDesc; @@ -888,6 +890,8 @@ ar5416FillCapabilityInfo(struct ath_hal pCap->halGTTSupport = AH_TRUE; pCap->halCSTSupport = AH_TRUE; pCap->halEnhancedDfsSupport = AH_FALSE; + /* Hardware supports 32 bit TSF values in the RX descriptor */ + pCap->halHasLongRxDescTsf = AH_TRUE; if (ath_hal_eepromGetFlag(ah, AR_EEP_RFKILL) && ath_hal_eepromGet(ah, AR_EEP_RFSILENT, &ahpriv->ah_rfsilent) == HAL_OK) { Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c Thu Sep 8 00:55:48 2011 (r225443) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_beacon.c Thu Sep 8 01:23:05 2011 (r225444) @@ -29,6 +29,15 @@ #define ONE_EIGHTH_TU_TO_USEC(_tu8) ((_tu8) << 7) /* + * Return the hardware NextTBTT in TSF + */ +uint64_t +ar5416GetNextTBTT(struct ath_hal *ah) +{ + return OS_REG_READ(ah, AR_NEXT_TBTT); +} + +/* * Initialize all of the hardware registers used to * send beacons. Note that for station operation the * driver calls ar5416SetStaBeaconTimers instead. Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Thu Sep 8 00:55:48 2011 (r225443) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Thu Sep 8 01:23:05 2011 (r225444) @@ -93,6 +93,41 @@ ar5416SetLedState(struct ath_hal *ah, HA } /* + * Get the current hardware tsf for stamlme + */ +uint64_t +ar5416GetTsf64(struct ath_hal *ah) +{ + uint32_t low1, low2, u32; + + /* sync multi-word read */ + low1 = OS_REG_READ(ah, AR_TSF_L32); + u32 = OS_REG_READ(ah, AR_TSF_U32); + low2 = OS_REG_READ(ah, AR_TSF_L32); + if (low2 < low1) { /* roll over */ + /* + * If we are not preempted this will work. If we are + * then we re-reading AR_TSF_U32 does no good as the + * low bits will be meaningless. Likewise reading + * L32, U32, U32, then comparing the last two reads + * to check for rollover doesn't help if preempted--so + * we take this approach as it costs one less PCI read + * which can be noticeable when doing things like + * timestamping packets in monitor mode. + */ + u32++; + } + return (((uint64_t) u32) << 32) | ((uint64_t) low2); +} + +void +ar5416SetTsf64(struct ath_hal *ah, uint64_t tsf64) +{ + OS_REG_WRITE(ah, AR_TSF_L32, tsf64 & 0xffffffff); + OS_REG_WRITE(ah, AR_TSF_U32, (tsf64 >> 32) & 0xffffffff); +} + +/* * Reset the current hardware tsf for stamlme. */ void Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Thu Sep 8 00:55:48 2011 (r225443) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Thu Sep 8 01:23:05 2011 (r225444) @@ -147,7 +147,7 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMO /* For chips on which the RTC reset is done, save TSF before it gets cleared */ if (AR_SREV_HOWL(ah) || (AR_SREV_MERLIN(ah) && ath_hal_eepromGetFlag(ah, AR_EEP_OL_PWRCTRL))) - tsf = ar5212GetTsf64(ah); + tsf = ar5416GetTsf64(ah); /* Mark PHY as inactive; marked active in ar5416InitBB() */ ar5416MarkPhyInactive(ah); @@ -159,7 +159,7 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMO /* Restore TSF */ if (tsf) - ar5212SetTsf64(ah, tsf); + ar5416SetTsf64(ah, tsf); OS_MARK(ah, AH_MARK_RESET_LINE, __LINE__); if (AR_SREV_MERLIN_10_OR_LATER(ah)) @@ -192,9 +192,9 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMO * value after the initvals have been applied, with an offset * based on measured time difference */ - if (AR_SREV_HOWL(ah) && (ar5212GetTsf64(ah) < tsf)) { + if (AR_SREV_HOWL(ah) && (ar5416GetTsf64(ah) < tsf)) { tsf += 1500; - ar5212SetTsf64(ah, tsf); + ar5416SetTsf64(ah, tsf); } HALDEBUG(ah, HAL_DEBUG_RESET, ">>>2 %s: AR_PHY_DAG_CTRLCCK=0x%x\n", @@ -364,8 +364,7 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMO OS_REG_RMW_FIELD(ah, AR_RIMT, AR_RIMT_FIRST, 2000); OS_REG_RMW_FIELD(ah, AR_TIMT, AR_TIMT_LAST, 300); OS_REG_RMW_FIELD(ah, AR_TIMT, AR_TIMT_FIRST, 750); -#endif - +#endif ar5416InitBB(ah, chan); /* Setup compression registers */ @@ -503,7 +502,7 @@ ar5416ChannelChange(struct ath_hal *ah, chan->ic_state &= ~IEEE80211_CHANSTATE_CWINT; ichan->channel_time = 0; - ichan->tsf_last = ar5212GetTsf64(ah); + ichan->tsf_last = ar5416GetTsf64(ah); ar5212TxEnable(ah, AH_TRUE); return AH_TRUE; } Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Thu Sep 8 00:55:48 2011 (r225443) +++ head/sys/dev/ath/if_ath.c Thu Sep 8 01:23:05 2011 (r225444) @@ -214,24 +214,6 @@ static void ath_tdma_update(struct ieee8 static void ath_tdma_beacon_send(struct ath_softc *sc, struct ieee80211vap *vap); -static __inline void -ath_hal_setcca(struct ath_hal *ah, int ena) -{ - /* - * NB: fill me in; this is not provided by default because disabling - * CCA in most locales violates regulatory. - */ -} - -static __inline int -ath_hal_getcca(struct ath_hal *ah) -{ - u_int32_t diag; - if (ath_hal_getcapability(ah, HAL_CAP_DIAG, 0, &diag) != HAL_OK) - return 1; - return ((diag & 0x500000) == 0); -} - #define TDMA_EP_MULTIPLIER (1<<10) /* pow2 to optimize out * and / */ #define TDMA_LPF_LEN 6 #define TDMA_DUMMY_MARKER 0x127 @@ -613,6 +595,7 @@ ath_attach(u_int16_t devid, struct ath_s sc->sc_hasbmatch = ath_hal_hasbssidmatch(ah); sc->sc_hastsfadd = ath_hal_hastsfadjust(ah); sc->sc_rxslink = ath_hal_self_linked_final_rxdesc(ah); + sc->sc_rxtsf32 = ath_hal_has_long_rxdesc_tsf(ah); if (ath_hal_hasfastframes(ah)) ic->ic_caps |= IEEE80211_C_FF; wmodes = ath_hal_getwirelessmodes(ah); @@ -3294,14 +3277,49 @@ ath_rxbuf_init(struct ath_softc *sc, str * a full 64-bit TSF using the specified TSF. */ static __inline u_int64_t -ath_extend_tsf(u_int32_t rstamp, u_int64_t tsf) +ath_extend_tsf15(u_int32_t rstamp, u_int64_t tsf) { if ((tsf & 0x7fff) < rstamp) tsf -= 0x8000; + return ((tsf &~ 0x7fff) | rstamp); } /* + * Extend 32-bit time stamp from rx descriptor to + * a full 64-bit TSF using the specified TSF. + */ +static __inline u_int64_t +ath_extend_tsf32(u_int32_t rstamp, u_int64_t tsf) +{ + u_int32_t tsf_low = tsf & 0xffffffff; + u_int64_t tsf64 = (tsf & ~0xffffffffULL) | rstamp; + + if (rstamp > tsf_low && (rstamp - tsf_low > 0x10000000)) + tsf64 -= 0x100000000ULL; + + if (rstamp < tsf_low && (tsf_low - rstamp > 0x10000000)) + tsf64 += 0x100000000ULL; + + return tsf64; +} + +/* + * Extend the TSF from the RX descriptor to a full 64 bit TSF. + * Earlier hardware versions only wrote the low 15 bits of the + * TSF into the RX descriptor; later versions (AR5416 and up) + * include the 32 bit TSF value. + */ +static __inline u_int64_t +ath_extend_tsf(struct ath_softc *sc, u_int32_t rstamp, u_int64_t tsf) +{ + if (sc->sc_rxtsf32) + return ath_extend_tsf32(rstamp, tsf); + else + return ath_extend_tsf15(rstamp, tsf); +} + +/* * Intercept management frames to collect beacon rssi data * and to do ibss merges. */ @@ -3334,7 +3352,7 @@ ath_recv_mgmt(struct ieee80211_node *ni, if (vap->iv_opmode == IEEE80211_M_IBSS && vap->iv_state == IEEE80211_S_RUN) { uint32_t rstamp = sc->sc_lastrs->rs_tstamp; - uint64_t tsf = ath_extend_tsf(rstamp, + uint64_t tsf = ath_extend_tsf(sc, rstamp, ath_hal_gettsf64(sc->sc_ah)); /* * Handle ibss merge as needed; check the tsf on the @@ -3406,7 +3424,7 @@ ath_rx_tap(struct ifnet *ifp, struct mbu sc->sc_rx_th.wr_flags |= IEEE80211_RADIOTAP_F_SHORTGI; } #endif - sc->sc_rx_th.wr_tsf = htole64(ath_extend_tsf(rs->rs_tstamp, tsf)); + sc->sc_rx_th.wr_tsf = htole64(ath_extend_tsf(sc, rs->rs_tstamp, tsf)); if (rs->rs_status & HAL_RXERR_CRC) sc->sc_rx_th.wr_flags |= IEEE80211_RADIOTAP_F_BADFCS; /* XXX propagate other error flags from descriptor */ @@ -5460,20 +5478,6 @@ ath_announce(struct ath_softc *sc) } #ifdef IEEE80211_SUPPORT_TDMA -static __inline uint32_t -ath_hal_getnexttbtt(struct ath_hal *ah) -{ -#define AR_TIMER0 0x8028 - return OS_REG_READ(ah, AR_TIMER0); -} - -static __inline void -ath_hal_adjusttsf(struct ath_hal *ah, int32_t tsfdelta) -{ - /* XXX handle wrap/overflow */ - OS_REG_WRITE(ah, AR_TSF_L32, OS_REG_READ(ah, AR_TSF_L32) + tsfdelta); -} - static void ath_tdma_settimers(struct ath_softc *sc, u_int32_t nexttbtt, u_int32_t bintval) { @@ -5629,8 +5633,8 @@ ath_tdma_update(struct ieee80211_node *n struct ath_softc *sc = ic->ic_ifp->if_softc; struct ath_hal *ah = sc->sc_ah; const HAL_RATE_TABLE *rt = sc->sc_currates; - u_int64_t tsf, rstamp, nextslot; - u_int32_t txtime, nextslottu, timer0; + u_int64_t tsf, rstamp, nextslot, nexttbtt; + u_int32_t txtime, nextslottu; int32_t tudelta, tsfdelta; const struct ath_rx_status *rs; int rix; @@ -5661,7 +5665,7 @@ ath_tdma_update(struct ieee80211_node *n /* extend rx timestamp to 64 bits */ rs = sc->sc_lastrs; tsf = ath_hal_gettsf64(ah); - rstamp = ath_extend_tsf(rs->rs_tstamp, tsf); + rstamp = ath_extend_tsf(sc, rs->rs_tstamp, tsf); /* * The rx timestamp is set by the hardware on completing * reception (at the point where the rx descriptor is DMA'd @@ -5677,15 +5681,15 @@ ath_tdma_update(struct ieee80211_node *n nextslottu = TSF_TO_TU(nextslot>>32, nextslot) & HAL_BEACON_PERIOD; /* - * TIMER0 is the h/w's idea of NextTBTT (in TU's). Convert - * to usecs and calculate the difference between what the + * Retrieve the hardware NextTBTT in usecs + * and calculate the difference between what the * other station thinks and what we have programmed. This * lets us figure how to adjust our timers to match. The * adjustments are done by pulling the TSF forward and possibly * rewriting the beacon timers. */ - timer0 = ath_hal_getnexttbtt(ah); - tsfdelta = (int32_t)((nextslot % TU_TO_TSF(HAL_BEACON_PERIOD+1)) - TU_TO_TSF(timer0)); + nexttbtt = ath_hal_getnexttbtt(ah); + tsfdelta = (int32_t)((nextslot % TU_TO_TSF(HAL_BEACON_PERIOD + 1)) - nexttbtt); DPRINTF(sc, ATH_DEBUG_TDMA_TIMER, "tsfdelta %d avg +%d/-%d\n", tsfdelta, @@ -5705,7 +5709,7 @@ ath_tdma_update(struct ieee80211_node *n TDMA_SAMPLE(sc->sc_avgtsfdeltap, 0); TDMA_SAMPLE(sc->sc_avgtsfdeltam, 0); } - tudelta = nextslottu - timer0; + tudelta = nextslottu - TSF_TO_TU(nexttbtt >> 32, nexttbtt); /* * Copy sender's timetstamp into tdma ie so they can @@ -5724,10 +5728,9 @@ ath_tdma_update(struct ieee80211_node *n &ni->ni_tstamp.data, 8); #if 0 DPRINTF(sc, ATH_DEBUG_TDMA_TIMER, - "tsf %llu nextslot %llu (%d, %d) nextslottu %u timer0 %u (%d)\n", + "tsf %llu nextslot %llu (%d, %d) nextslottu %u nexttbtt %llu (%d)\n", (unsigned long long) tsf, (unsigned long long) nextslot, - (int)(nextslot - tsf), tsfdelta, - nextslottu, timer0, tudelta); + (int)(nextslot - tsf), tsfdelta, nextslottu, nexttbtt, tudelta); #endif /* * Adjust the beacon timers only when pulling them forward Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Thu Sep 8 00:55:48 2011 (r225443) +++ head/sys/dev/ath/if_athvar.h Thu Sep 8 01:23:05 2011 (r225444) @@ -255,7 +255,8 @@ struct ath_softc { sc_setcca : 1,/* set/clr CCA with TDMA */ sc_resetcal : 1,/* reset cal state next trip */ sc_rxslink : 1,/* do self-linked final descriptor */ - sc_kickpcu : 1;/* kick PCU RX on next RX proc */ + sc_kickpcu : 1,/* kick PCU RX on next RX proc */ + sc_rxtsf32 : 1;/* RX dec TSF is 32 bits */ uint32_t sc_eerd; /* regdomain from EEPROM */ uint32_t sc_eecc; /* country code from EEPROM */ /* rate tables */ @@ -482,6 +483,8 @@ void ath_intr(void *); ((*(_ah)->ah_setBeaconTimers)((_ah), (_bt))) #define ath_hal_beacontimers(_ah, _bs) \ ((*(_ah)->ah_setStationBeaconTimers)((_ah), (_bs))) +#define ath_hal_getnexttbtt(_ah) \ + ((*(_ah)->ah_getNextTBTT)((_ah))) #define ath_hal_setassocid(_ah, _bss, _associd) \ ((*(_ah)->ah_writeAssocid)((_ah), (_bss), (_associd))) #define ath_hal_phydisable(_ah) \ @@ -657,6 +660,8 @@ void ath_intr(void *); (ath_hal_getcapability(_ah, HAL_CAP_RXDESC_SELFLINK, 0, NULL) == HAL_OK) #define ath_hal_gtxto_supported(_ah) \ (ath_hal_getcapability(_ah, HAL_CAP_GTXTO, 0, NULL) == HAL_OK) +#define ath_hal_has_long_rxdesc_tsf(_ah) \ + (ath_hal_getcapability(_ah, HAL_CAP_LONG_RXDESC_TSF, 0, NULL) == HAL_OK) #define ath_hal_setuprxdesc(_ah, _ds, _size, _intreq) \ ((*(_ah)->ah_setupRxDesc)((_ah), (_ds), (_size), (_intreq))) From owner-svn-src-all@FreeBSD.ORG Thu Sep 8 04:14:17 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 489731065670; Thu, 8 Sep 2011 04:14:17 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1E7AE8FC17; Thu, 8 Sep 2011 04:14:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p884EHVp069000; Thu, 8 Sep 2011 04:14:17 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p884EHC3068998; Thu, 8 Sep 2011 04:14:17 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201109080414.p884EHC3068998@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 8 Sep 2011 04:14:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225445 - head/sbin/geom/class/part X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Sep 2011 04:14:17 -0000 Author: ae Date: Thu Sep 8 04:14:16 2011 New Revision: 225445 URL: http://svn.freebsd.org/changeset/base/225445 Log: Don't use the whole free space when resizing partition to a larger size on a disk with non zero stripesize (e.g. disks with 4k sector size)[1]. Also do not use automatic alignment when size is exactly specified, but an alignment is not. Use automatic alignment only for case when user omits both "-s" and "-a" options. Reported by: Mikael Fridh [1] Approved by: re (kib) MFC after: 1 week Modified: head/sbin/geom/class/part/geom_part.c Modified: head/sbin/geom/class/part/geom_part.c ============================================================================== --- head/sbin/geom/class/part/geom_part.c Thu Sep 8 01:23:05 2011 (r225444) +++ head/sbin/geom/class/part/geom_part.c Thu Sep 8 04:14:16 2011 (r225445) @@ -308,7 +308,7 @@ gpart_autofill_resize(struct gctl_req *r off_t last, size, start, new_size; off_t lba, new_lba, alignment, offset; const char *s; - int error, idx; + int error, idx, has_alignment; idx = (int)gctl_get_intmax(req, GPART_PARAM_INDEX); if (idx < 1) @@ -334,8 +334,9 @@ gpart_autofill_resize(struct gctl_req *r errx(EXIT_FAILURE, "Provider for geom %s not found.", s); s = gctl_get_ascii(req, "alignment"); + has_alignment = (*s == '*') ? 0 : 1; alignment = 1; - if (*s != '*') { + if (has_alignment) { error = g_parse_lba(s, pp->lg_sectorsize, &alignment); if (error) errc(EXIT_FAILURE, error, "Invalid alignment param"); @@ -358,7 +359,7 @@ gpart_autofill_resize(struct gctl_req *r if (error) errc(EXIT_FAILURE, error, "Invalid size param"); /* no autofill necessary. */ - if (alignment == 1) + if (has_alignment == 0) goto done; } @@ -380,7 +381,8 @@ gpart_autofill_resize(struct gctl_req *r lba = (off_t)strtoimax(s, NULL, 0); size = lba - start + 1; - if (new_size > 0 && new_size <= size) { + pp = find_provider(gp, lba + 1); + if (new_size > 0 && (new_size <= size || pp == NULL)) { /* The start offset may be not aligned, so we align the end * offset and then calculate the size. */ @@ -388,8 +390,6 @@ gpart_autofill_resize(struct gctl_req *r alignment) - start - offset; goto done; } - - pp = find_provider(gp, lba + 1); if (pp == NULL) { new_size = ALIGNDOWN(last + offset + 1, alignment) - start - offset; From owner-svn-src-all@FreeBSD.ORG Thu Sep 8 09:33:50 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DA7661065673; Thu, 8 Sep 2011 09:33:49 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BFF618FC0A; Thu, 8 Sep 2011 09:33:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p889Xnqe078595; Thu, 8 Sep 2011 09:33:49 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p889Xnxm078592; Thu, 8 Sep 2011 09:33:49 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201109080933.p889Xnxm078592@svn.freebsd.org> From: Xin LI Date: Thu, 8 Sep 2011 09:33:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225446 - head/crypto/openssl/ssl X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Sep 2011 09:33:50 -0000 Author: delphij Date: Thu Sep 8 09:33:49 2011 New Revision: 225446 URL: http://svn.freebsd.org/changeset/base/225446 Log: Fix SSL memory handlig for (EC)DH cipher suites, in particular for multi-threaded use of ECDH. Security: CVE-2011-3210 Reviewed by: stas Obtained from: OpenSSL CVS Approved by: re (kib) Modified: head/crypto/openssl/ssl/s3_lib.c head/crypto/openssl/ssl/s3_srvr.c Modified: head/crypto/openssl/ssl/s3_lib.c ============================================================================== --- head/crypto/openssl/ssl/s3_lib.c Thu Sep 8 04:14:16 2011 (r225445) +++ head/crypto/openssl/ssl/s3_lib.c Thu Sep 8 09:33:49 2011 (r225446) @@ -1722,11 +1722,17 @@ void ssl3_clear(SSL *s) } #ifndef OPENSSL_NO_DH if (s->s3->tmp.dh != NULL) + { DH_free(s->s3->tmp.dh); + s->s3->tmp.dh = NULL; + } #endif #ifndef OPENSSL_NO_ECDH if (s->s3->tmp.ecdh != NULL) + { EC_KEY_free(s->s3->tmp.ecdh); + s->s3->tmp.ecdh = NULL; + } #endif rp = s->s3->rbuf.buf; Modified: head/crypto/openssl/ssl/s3_srvr.c ============================================================================== --- head/crypto/openssl/ssl/s3_srvr.c Thu Sep 8 04:14:16 2011 (r225445) +++ head/crypto/openssl/ssl/s3_srvr.c Thu Sep 8 09:33:49 2011 (r225446) @@ -710,9 +710,7 @@ int ssl3_check_client_hello(SSL *s) if (s->s3->tmp.message_type == SSL3_MT_CLIENT_HELLO) { /* Throw away what we have done so far in the current handshake, - * which will now be aborted. (A full SSL_clear would be too much.) - * I hope that tmp.dh is the only thing that may need to be cleared - * when a handshake is not completed ... */ + * which will now be aborted. (A full SSL_clear would be too much.) */ #ifndef OPENSSL_NO_DH if (s->s3->tmp.dh != NULL) { @@ -720,6 +718,13 @@ int ssl3_check_client_hello(SSL *s) s->s3->tmp.dh = NULL; } #endif +#ifndef OPENSSL_NO_ECDH + if (s->s3->tmp.ecdh != NULL) + { + EC_KEY_free(s->s3->tmp.ecdh); + s->s3->tmp.ecdh = NULL; + } +#endif return 2; } return 1; @@ -1329,7 +1334,6 @@ int ssl3_send_server_key_exchange(SSL *s if (s->s3->tmp.dh != NULL) { - DH_free(dh); SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto err; } @@ -1390,7 +1394,6 @@ int ssl3_send_server_key_exchange(SSL *s if (s->s3->tmp.ecdh != NULL) { - EC_KEY_free(s->s3->tmp.ecdh); SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto err; } @@ -1401,12 +1404,11 @@ int ssl3_send_server_key_exchange(SSL *s SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE,ERR_R_ECDH_LIB); goto err; } - if (!EC_KEY_up_ref(ecdhp)) + if ((ecdh = EC_KEY_dup(ecdhp)) == NULL) { SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE,ERR_R_ECDH_LIB); goto err; } - ecdh = ecdhp; s->s3->tmp.ecdh=ecdh; if ((EC_KEY_get0_public_key(ecdh) == NULL) || @@ -2262,6 +2264,12 @@ int ssl3_get_client_key_exchange(SSL *s) /* Get encoded point length */ i = *p; p += 1; + if (n != 1 + i) + { + SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE, + ERR_R_EC_LIB); + goto err; + } if (EC_POINT_oct2point(group, clnt_ecpoint, p, i, bn_ctx) == 0) { From owner-svn-src-all@FreeBSD.ORG Thu Sep 8 12:56:26 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3A591065670; Thu, 8 Sep 2011 12:56:26 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C1D408FC13; Thu, 8 Sep 2011 12:56:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p88CuQL1091687; Thu, 8 Sep 2011 12:56:26 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p88CuQHi091681; Thu, 8 Sep 2011 12:56:26 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201109081256.p88CuQHi091681@svn.freebsd.org> From: Attilio Rao Date: Thu, 8 Sep 2011 12:56:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225448 - in head/sys: conf kern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Sep 2011 12:56:26 -0000 Author: attilio Date: Thu Sep 8 12:56:26 2011 New Revision: 225448 URL: http://svn.freebsd.org/changeset/base/225448 Log: Improve the informations reported in case of busy buffers during the shutdown: - Axe out the SHOW_BUSYBUFS option and uses a tunable for selectively enable/disable it, which is defaulted for not printing anything (0 value) but can be changed for printing (1 value) and be verbose (2 value) - Improves the informations outputed: right now, there is no track of the actual struct buf object or vnode which are referenced by the shutdown process, but it is printed the related struct bufobj object which is not really helpful - Add more verbosity about the state of the struct buf lock and the vnode informations, with the latter to be activated separately by the sysctl Sponsored by: Sandvine Incorporated Reviewed by: emaste, kib Approved by: re (ksmith) MFC after: 10 days Modified: head/sys/conf/NOTES head/sys/conf/options head/sys/kern/kern_shutdown.c head/sys/kern/vfs_bio.c head/sys/sys/buf.h Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Thu Sep 8 12:19:58 2011 (r225447) +++ head/sys/conf/NOTES Thu Sep 8 12:56:26 2011 (r225448) @@ -2929,7 +2929,6 @@ options SCSI_NCR_MYADDR=7 options SC_DEBUG_LEVEL=5 # Syscons debug level options SC_RENDER_DEBUG # syscons rendering debugging -options SHOW_BUSYBUFS # List buffers that prevent root unmount options VFS_BIO_DEBUG # VFS buffer I/O debugging options KSTACK_MAX_PAGES=32 # Maximum pages to give the kernel stack Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Thu Sep 8 12:19:58 2011 (r225447) +++ head/sys/conf/options Thu Sep 8 12:56:26 2011 (r225448) @@ -156,7 +156,6 @@ QUOTA SCHED_4BSD opt_sched.h SCHED_STATS opt_sched.h SCHED_ULE opt_sched.h -SHOW_BUSYBUFS SLEEPQUEUE_PROFILING SLHCI_DEBUG opt_slhci.h SPX_HACK Modified: head/sys/kern/kern_shutdown.c ============================================================================== --- head/sys/kern/kern_shutdown.c Thu Sep 8 12:19:58 2011 (r225447) +++ head/sys/kern/kern_shutdown.c Thu Sep 8 12:56:26 2011 (r225448) @@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$"); #include "opt_ddb.h" #include "opt_kdb.h" #include "opt_panic.h" -#include "opt_show_busybufs.h" #include "opt_sched.h" #include "opt_watchdog.h" @@ -66,6 +65,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef SW_WATCHDOG #include #endif @@ -123,6 +123,14 @@ TUNABLE_INT("kern.sync_on_panic", &sync_ SYSCTL_NODE(_kern, OID_AUTO, shutdown, CTLFLAG_RW, 0, "Shutdown environment"); +#ifndef DIAGNOSTIC +static int show_busybufs; +#else +static int show_busybufs = 1; +#endif +SYSCTL_INT(_kern_shutdown, OID_AUTO, show_busybufs, CTLFLAG_RW, + &show_busybufs, 0, ""); + /* * Variable panicstr contains argument to first call to panic; used as flag * to indicate that the kernel has already called panic. @@ -389,13 +397,17 @@ kern_reboot(int howto) } #endif nbusy++; -#if defined(SHOW_BUSYBUFS) || defined(DIAGNOSTIC) - printf( - "%d: bufobj:%p, flags:%0x, blkno:%ld, lblkno:%ld\n", - nbusy, bp->b_bufobj, - bp->b_flags, (long)bp->b_blkno, - (long)bp->b_lblkno); -#endif + if (show_busybufs > 0) { + printf( + "%d: buf:%p, vnode:%p, flags:%0x, blkno:%jd, lblkno:%jd, buflock:", + nbusy, bp, bp->b_vp, bp->b_flags, + (intmax_t)bp->b_blkno, + (intmax_t)bp->b_lblkno); + BUF_LOCKPRINTINFO(bp); + if (show_busybufs > 1) + vn_printf(bp->b_vp, + "vnode content: "); + } } } if (nbusy) { Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Thu Sep 8 12:19:58 2011 (r225447) +++ head/sys/kern/vfs_bio.c Thu Sep 8 12:56:26 2011 (r225448) @@ -4020,7 +4020,7 @@ DB_SHOW_COMMAND(buffer, db_show_buffer) db_printf("\n"); } db_printf(" "); - lockmgr_printinfo(&bp->b_lock); + BUF_LOCKPRINTINFO(bp); } DB_SHOW_COMMAND(lockedbufs, lockedbufs) Modified: head/sys/sys/buf.h ============================================================================== --- head/sys/sys/buf.h Thu Sep 8 12:19:58 2011 (r225447) +++ head/sys/sys/buf.h Thu Sep 8 12:56:26 2011 (r225448) @@ -311,6 +311,12 @@ extern const char *buf_wmesg; /* Defaul lockdestroy(&(bp)->b_lock) /* + * Print informations on a buffer lock. + */ +#define BUF_LOCKPRINTINFO(bp) \ + lockmgr_printinfo(&(bp)->b_lock) + +/* * Buffer lock assertions. */ #if defined(INVARIANTS) && defined(INVARIANT_SUPPORT) From owner-svn-src-all@FreeBSD.ORG Thu Sep 8 16:22:58 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D48141065673; Thu, 8 Sep 2011 16:22:58 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C166E8FC1D; Thu, 8 Sep 2011 16:22:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p88GMwPS098101; Thu, 8 Sep 2011 16:22:58 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p88GMw2R098098; Thu, 8 Sep 2011 16:22:58 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201109081622.p88GMw2R098098@svn.freebsd.org> From: Xin LI Date: Thu, 8 Sep 2011 16:22:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225449 - in stable: 7/crypto/openssl/ssl 8/crypto/openssl/ssl X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Sep 2011 16:22:59 -0000 Author: delphij Date: Thu Sep 8 16:22:58 2011 New Revision: 225449 URL: http://svn.freebsd.org/changeset/base/225449 Log: MFC r225446: Fix SSL memory handlig for (EC)DH cipher suites, in particular for multi-threaded use of ECDH. Security: CVE-2011-3210 Reviewed by: stas Obtained from: OpenSSL CVS Modified: stable/8/crypto/openssl/ssl/s3_lib.c stable/8/crypto/openssl/ssl/s3_srvr.c Directory Properties: stable/8/crypto/openssl/ (props changed) Changes in other areas also in this revision: Modified: stable/7/crypto/openssl/ssl/s3_lib.c stable/7/crypto/openssl/ssl/s3_srvr.c Directory Properties: stable/7/crypto/openssl/ (props changed) Modified: stable/8/crypto/openssl/ssl/s3_lib.c ============================================================================== --- stable/8/crypto/openssl/ssl/s3_lib.c Thu Sep 8 12:56:26 2011 (r225448) +++ stable/8/crypto/openssl/ssl/s3_lib.c Thu Sep 8 16:22:58 2011 (r225449) @@ -1722,11 +1722,17 @@ void ssl3_clear(SSL *s) } #ifndef OPENSSL_NO_DH if (s->s3->tmp.dh != NULL) + { DH_free(s->s3->tmp.dh); + s->s3->tmp.dh = NULL; + } #endif #ifndef OPENSSL_NO_ECDH if (s->s3->tmp.ecdh != NULL) + { EC_KEY_free(s->s3->tmp.ecdh); + s->s3->tmp.ecdh = NULL; + } #endif rp = s->s3->rbuf.buf; Modified: stable/8/crypto/openssl/ssl/s3_srvr.c ============================================================================== --- stable/8/crypto/openssl/ssl/s3_srvr.c Thu Sep 8 12:56:26 2011 (r225448) +++ stable/8/crypto/openssl/ssl/s3_srvr.c Thu Sep 8 16:22:58 2011 (r225449) @@ -710,9 +710,7 @@ int ssl3_check_client_hello(SSL *s) if (s->s3->tmp.message_type == SSL3_MT_CLIENT_HELLO) { /* Throw away what we have done so far in the current handshake, - * which will now be aborted. (A full SSL_clear would be too much.) - * I hope that tmp.dh is the only thing that may need to be cleared - * when a handshake is not completed ... */ + * which will now be aborted. (A full SSL_clear would be too much.) */ #ifndef OPENSSL_NO_DH if (s->s3->tmp.dh != NULL) { @@ -720,6 +718,13 @@ int ssl3_check_client_hello(SSL *s) s->s3->tmp.dh = NULL; } #endif +#ifndef OPENSSL_NO_ECDH + if (s->s3->tmp.ecdh != NULL) + { + EC_KEY_free(s->s3->tmp.ecdh); + s->s3->tmp.ecdh = NULL; + } +#endif return 2; } return 1; @@ -1329,7 +1334,6 @@ int ssl3_send_server_key_exchange(SSL *s if (s->s3->tmp.dh != NULL) { - DH_free(dh); SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto err; } @@ -1390,7 +1394,6 @@ int ssl3_send_server_key_exchange(SSL *s if (s->s3->tmp.ecdh != NULL) { - EC_KEY_free(s->s3->tmp.ecdh); SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto err; } @@ -1401,12 +1404,11 @@ int ssl3_send_server_key_exchange(SSL *s SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE,ERR_R_ECDH_LIB); goto err; } - if (!EC_KEY_up_ref(ecdhp)) + if ((ecdh = EC_KEY_dup(ecdhp)) == NULL) { SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE,ERR_R_ECDH_LIB); goto err; } - ecdh = ecdhp; s->s3->tmp.ecdh=ecdh; if ((EC_KEY_get0_public_key(ecdh) == NULL) || @@ -2262,6 +2264,12 @@ int ssl3_get_client_key_exchange(SSL *s) /* Get encoded point length */ i = *p; p += 1; + if (n != 1 + i) + { + SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE, + ERR_R_EC_LIB); + goto err; + } if (EC_POINT_oct2point(group, clnt_ecpoint, p, i, bn_ctx) == 0) { From owner-svn-src-all@FreeBSD.ORG Thu Sep 8 16:22:59 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 043221065674; Thu, 8 Sep 2011 16:22:59 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E53FC8FC1E; Thu, 8 Sep 2011 16:22:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p88GMwKx098108; Thu, 8 Sep 2011 16:22:58 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p88GMw8m098105; Thu, 8 Sep 2011 16:22:58 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201109081622.p88GMw8m098105@svn.freebsd.org> From: Xin LI Date: Thu, 8 Sep 2011 16:22:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225449 - in stable: 7/crypto/openssl/ssl 8/crypto/openssl/ssl X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Sep 2011 16:22:59 -0000 Author: delphij Date: Thu Sep 8 16:22:58 2011 New Revision: 225449 URL: http://svn.freebsd.org/changeset/base/225449 Log: MFC r225446: Fix SSL memory handlig for (EC)DH cipher suites, in particular for multi-threaded use of ECDH. Security: CVE-2011-3210 Reviewed by: stas Obtained from: OpenSSL CVS Modified: stable/7/crypto/openssl/ssl/s3_lib.c stable/7/crypto/openssl/ssl/s3_srvr.c Directory Properties: stable/7/crypto/openssl/ (props changed) Changes in other areas also in this revision: Modified: stable/8/crypto/openssl/ssl/s3_lib.c stable/8/crypto/openssl/ssl/s3_srvr.c Directory Properties: stable/8/crypto/openssl/ (props changed) Modified: stable/7/crypto/openssl/ssl/s3_lib.c ============================================================================== --- stable/7/crypto/openssl/ssl/s3_lib.c Thu Sep 8 12:56:26 2011 (r225448) +++ stable/7/crypto/openssl/ssl/s3_lib.c Thu Sep 8 16:22:58 2011 (r225449) @@ -1722,11 +1722,17 @@ void ssl3_clear(SSL *s) } #ifndef OPENSSL_NO_DH if (s->s3->tmp.dh != NULL) + { DH_free(s->s3->tmp.dh); + s->s3->tmp.dh = NULL; + } #endif #ifndef OPENSSL_NO_ECDH if (s->s3->tmp.ecdh != NULL) + { EC_KEY_free(s->s3->tmp.ecdh); + s->s3->tmp.ecdh = NULL; + } #endif rp = s->s3->rbuf.buf; Modified: stable/7/crypto/openssl/ssl/s3_srvr.c ============================================================================== --- stable/7/crypto/openssl/ssl/s3_srvr.c Thu Sep 8 12:56:26 2011 (r225448) +++ stable/7/crypto/openssl/ssl/s3_srvr.c Thu Sep 8 16:22:58 2011 (r225449) @@ -710,9 +710,7 @@ int ssl3_check_client_hello(SSL *s) if (s->s3->tmp.message_type == SSL3_MT_CLIENT_HELLO) { /* Throw away what we have done so far in the current handshake, - * which will now be aborted. (A full SSL_clear would be too much.) - * I hope that tmp.dh is the only thing that may need to be cleared - * when a handshake is not completed ... */ + * which will now be aborted. (A full SSL_clear would be too much.) */ #ifndef OPENSSL_NO_DH if (s->s3->tmp.dh != NULL) { @@ -720,6 +718,13 @@ int ssl3_check_client_hello(SSL *s) s->s3->tmp.dh = NULL; } #endif +#ifndef OPENSSL_NO_ECDH + if (s->s3->tmp.ecdh != NULL) + { + EC_KEY_free(s->s3->tmp.ecdh); + s->s3->tmp.ecdh = NULL; + } +#endif return 2; } return 1; @@ -1329,7 +1334,6 @@ int ssl3_send_server_key_exchange(SSL *s if (s->s3->tmp.dh != NULL) { - DH_free(dh); SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto err; } @@ -1390,7 +1394,6 @@ int ssl3_send_server_key_exchange(SSL *s if (s->s3->tmp.ecdh != NULL) { - EC_KEY_free(s->s3->tmp.ecdh); SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto err; } @@ -1401,12 +1404,11 @@ int ssl3_send_server_key_exchange(SSL *s SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE,ERR_R_ECDH_LIB); goto err; } - if (!EC_KEY_up_ref(ecdhp)) + if ((ecdh = EC_KEY_dup(ecdhp)) == NULL) { SSLerr(SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE,ERR_R_ECDH_LIB); goto err; } - ecdh = ecdhp; s->s3->tmp.ecdh=ecdh; if ((EC_KEY_get0_public_key(ecdh) == NULL) || @@ -2262,6 +2264,12 @@ int ssl3_get_client_key_exchange(SSL *s) /* Get encoded point length */ i = *p; p += 1; + if (n != 1 + i) + { + SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE, + ERR_R_EC_LIB); + goto err; + } if (EC_POINT_oct2point(group, clnt_ecpoint, p, i, bn_ctx) == 0) { From owner-svn-src-all@FreeBSD.ORG Thu Sep 8 23:46:07 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 91CD3106564A; Thu, 8 Sep 2011 23:46:07 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6874B8FC15; Thu, 8 Sep 2011 23:46:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p88Nk79I012278; Thu, 8 Sep 2011 23:46:07 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p88Nk7UW012275; Thu, 8 Sep 2011 23:46:07 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201109082346.p88Nk7UW012275@svn.freebsd.org> From: Xin LI Date: Thu, 8 Sep 2011 23:46:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225452 - head/etc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Sep 2011 23:46:07 -0000 Author: delphij Date: Thu Sep 8 23:46:07 2011 New Revision: 225452 URL: http://svn.freebsd.org/changeset/base/225452 Log: Sync pf.os with OpenBSD: - Update OpenBSD fingerprints through OpenBSD 4.9 - Fix typos. Obtained from: OpenBSD MFC after: 2 weeks Approved by: re (kib) Modified: head/etc/pf.os Modified: head/etc/pf.os ============================================================================== --- head/etc/pf.os Thu Sep 8 17:24:44 2011 (r225451) +++ head/etc/pf.os Thu Sep 8 23:46:07 2011 (r225452) @@ -1,5 +1,5 @@ # $FreeBSD$ -# $OpenBSD: pf.os,v 1.21 2006/07/28 21:51:12 david Exp $ +# $OpenBSD: pf.os,v 1.25 2010/10/18 15:55:27 deraadt Exp $ # passive OS fingerprinting # ------------------------- # @@ -299,13 +299,16 @@ S22:64:1:52:M*,N,N,S,N,W0: Linux:2.2:ts: # ----------------- OpenBSD ----------------- 16384:64:0:60:M*,N,W0,N,N,T: OpenBSD:2.6::NetBSD 1.3 (or OpenBSD 2.6) -16384:64:1:64:M*,N,N,S,N,W0,N,N,T: OpenBSD:3.0-4.0::OpenBSD 3.0-4.0 -16384:64:0:64:M*,N,N,S,N,W0,N,N,T: OpenBSD:3.0-4.0:no-df:OpenBSD 3.0-4.0 (scrub no-df) +16384:64:1:64:M*,N,N,S,N,W0,N,N,T: OpenBSD:3.0-4.8::OpenBSD 3.0-4.8 +16384:64:0:64:M*,N,N,S,N,W0,N,N,T: OpenBSD:3.0-4.8:no-df:OpenBSD 3.0-4.8 (scrub no-df) 57344:64:1:64:M*,N,N,S,N,W0,N,N,T: OpenBSD:3.3-4.0::OpenBSD 3.3-4.0 57344:64:0:64:M*,N,N,S,N,W0,N,N,T: OpenBSD:3.3-4.0:no-df:OpenBSD 3.3-4.0 (scrub no-df) 65535:64:1:64:M*,N,N,S,N,W0,N,N,T: OpenBSD:3.0-4.0:opera:OpenBSD 3.0-4.0 (Opera) +16384:64:1:64:M*,N,N,S,N,W3,N,N,T: OpenBSD:4.9::OpenBSD 4.9 +16384:64:0:64:M*,N,N,S,N,W3,N,N,T: OpenBSD:4.9:no-df:OpenBSD 4.9 (scrub no-df) + # ----------------- Solaris ----------------- S17:64:1:64:N,W3,N,N,T0,N,N,S,M*: Solaris:8:RFC1323:Solaris 8 RFC1323 @@ -362,7 +365,7 @@ S34:64:1:52:M*,N,W0,N,N,S: Solaris:10:b # ----------------- Windows ----------------- # Windows TCP/IP stack is a mess. For most recent XP, 2000 and -# even 98, the pathlevel, not the actual OS version, is more +# even 98, the patchlevel, not the actual OS version, is more # relevant to the signature. They share the same code, so it would # seem. Luckily for us, almost all Windows 9x boxes have an # awkward MSS of 536, which I use to tell one from another From owner-svn-src-all@FreeBSD.ORG Fri Sep 9 01:39:20 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1B4AA1065678; Fri, 9 Sep 2011 01:39:20 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E51968FC12; Fri, 9 Sep 2011 01:39:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p891dJOn015763; Fri, 9 Sep 2011 01:39:19 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p891dJM9015759; Fri, 9 Sep 2011 01:39:19 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201109090139.p891dJM9015759@svn.freebsd.org> From: Xin LI Date: Fri, 9 Sep 2011 01:39:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225454 - stable/8/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Sep 2011 01:39:20 -0000 Author: delphij Date: Fri Sep 9 01:39:19 2011 New Revision: 225454 URL: http://svn.freebsd.org/changeset/base/225454 Log: MFC r225199: Fix format strings for KTR_STATE in 4BSD ad ULE schedulers. Submitted by: Ivan Klymenko PR: kern/159904, kern/159905 Modified: stable/8/sys/kern/sched_4bsd.c stable/8/sys/kern/sched_ule.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/kern/sched_4bsd.c ============================================================================== --- stable/8/sys/kern/sched_4bsd.c Thu Sep 8 23:59:16 2011 (r225453) +++ stable/8/sys/kern/sched_4bsd.c Fri Sep 9 01:39:19 2011 (r225454) @@ -717,7 +717,7 @@ sched_exit(struct proc *p, struct thread { KTR_STATE1(KTR_SCHED, "thread", sched_tdname(td), "proc exit", - "prio:td", td->td_priority); + "prio:%d", td->td_priority); PROC_LOCK_ASSERT(p, MA_OWNED); sched_exit_thread(FIRST_THREAD_IN_PROC(p), td); @@ -728,7 +728,7 @@ sched_exit_thread(struct thread *td, str { KTR_STATE1(KTR_SCHED, "thread", sched_tdname(child), "exit", - "prio:td", child->td_priority); + "prio:%d", child->td_priority); thread_lock(td); td->td_estcpu = ESTCPULIM(td->td_estcpu + child->td_estcpu); thread_unlock(td); Modified: stable/8/sys/kern/sched_ule.c ============================================================================== --- stable/8/sys/kern/sched_ule.c Thu Sep 8 23:59:16 2011 (r225453) +++ stable/8/sys/kern/sched_ule.c Fri Sep 9 01:39:19 2011 (r225454) @@ -2032,7 +2032,7 @@ sched_exit(struct proc *p, struct thread struct thread *td; KTR_STATE1(KTR_SCHED, "thread", sched_tdname(child), "proc exit", - "prio:td", child->td_priority); + "prio:%d", child->td_priority); PROC_LOCK_ASSERT(p, MA_OWNED); td = FIRST_THREAD_IN_PROC(p); sched_exit_thread(td, child); @@ -2049,7 +2049,7 @@ sched_exit_thread(struct thread *td, str { KTR_STATE1(KTR_SCHED, "thread", sched_tdname(child), "thread exit", - "prio:td", child->td_priority); + "prio:%d", child->td_priority); /* * Give the child's runtime to the parent without returning the * sleep time as a penalty to the parent. This causes shells that From owner-svn-src-all@FreeBSD.ORG Fri Sep 9 07:44:14 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ED408106566B; Fri, 9 Sep 2011 07:44:14 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D228B8FC15; Fri, 9 Sep 2011 07:44:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p897iEt8027246; Fri, 9 Sep 2011 07:44:14 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p897iE9x027234; Fri, 9 Sep 2011 07:44:14 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201109090744.p897iE9x027234@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 9 Sep 2011 07:44:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225458 - in stable/8/sys: dev/usb dev/usb/quirk dev/usb/storage sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Sep 2011 07:44:15 -0000 Author: hselasky Date: Fri Sep 9 07:44:14 2011 New Revision: 225458 URL: http://svn.freebsd.org/changeset/base/225458 Log: MFC r225350 and r225400: This patch adds automatic detection of USB mass storage devices which does not support the no synchronize cache SCSI command. The __FreeBSD_version version macro has been bumped and external kernel modules needs to be recompiled after this patch. PR: usb/160299 Modified: stable/8/sys/dev/usb/quirk/usb_quirk.c stable/8/sys/dev/usb/storage/umass.c stable/8/sys/dev/usb/usb_device.c stable/8/sys/dev/usb/usb_device.h stable/8/sys/dev/usb/usb_dynamic.c stable/8/sys/dev/usb/usb_dynamic.h stable/8/sys/dev/usb/usb_freebsd.h stable/8/sys/dev/usb/usb_msctest.c stable/8/sys/dev/usb/usb_msctest.h stable/8/sys/dev/usb/usbdi.h stable/8/sys/sys/param.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/usb/quirk/usb_quirk.c ============================================================================== --- stable/8/sys/dev/usb/quirk/usb_quirk.c Fri Sep 9 04:42:11 2011 (r225457) +++ stable/8/sys/dev/usb/quirk/usb_quirk.c Fri Sep 9 07:44:14 2011 (r225458) @@ -148,12 +148,10 @@ static struct usb_quirk_entry usb_quirks UQ_MSC_FORCE_PROTO_SCSI), USB_QUIRK(AIPTEK, POCKETCAM3M, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI), - USB_QUIRK(AIPTEK2, SUNPLUS_TECH, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(ALCOR, SDCR_6335, 0x0000, 0xffff, UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(ALCOR, SDCR_6362, 0x0000, 0xffff, UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_SYNC_CACHE), - USB_QUIRK(ALCOR, AU6390, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(ALCOR, UMCR_9361, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_GETMAXLUN), USB_QUIRK(ALCOR, TRANSCEND, 0x0000, 0xffff, UQ_MSC_NO_GETMAXLUN, @@ -173,14 +171,12 @@ static struct usb_quirk_entry usb_quirks USB_QUIRK(CENTURY, EX35QUAT, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_FORCE_SHORT_INQ, UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE), - USB_QUIRK(CENTURY, EX35SW4_SB4, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(CYPRESS, XX6830XX, 0x0000, 0xffff, UQ_MSC_NO_GETMAXLUN, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(DESKNOTE, UCR_61S2B, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI), USB_QUIRK(DMI, CFSM_RW, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_GETMAXLUN), - USB_QUIRK(DMI, DISK, 0x000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(EPSON, STYLUS_875DC, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY), USB_QUIRK(EPSON, STYLUS_895, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, @@ -188,7 +184,6 @@ static struct usb_quirk_entry usb_quirks USB_QUIRK(FEIYA, 5IN1, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI), USB_QUIRK(FREECOM, DVD, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI), - USB_QUIRK(FREECOM, HDD, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(FUJIPHOTO, MASS0100, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI_I, UQ_MSC_FORCE_PROTO_ATAPI, UQ_MSC_NO_RS_CLEAR_UA, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(GENESYS, GL641USB2IDE, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, @@ -232,7 +227,6 @@ static struct usb_quirk_entry usb_quirks USB_QUIRK(IOMEGA, ZIP100, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_TEST_UNIT_READY), /* XXX ZIP drives can also use ATAPI */ - USB_QUIRK(JMICRON, JM20336, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(JMICRON, JM20337, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_SYNC_CACHE), @@ -279,8 +273,6 @@ static struct usb_quirk_entry usb_quirks UQ_MSC_FORCE_PROTO_ATAPI), USB_QUIRK(MYSON, HEDEN, 0x0000, 0xffff, UQ_MSC_IGNORE_RESIDUE, UQ_MSC_NO_SYNC_CACHE), - USB_QUIRK(MYSON, HEDEN_8813, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), - USB_QUIRK(MYSON, STARREADER, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(NEODIO, ND3260, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_FORCE_SHORT_INQ), USB_QUIRK(NETAC, CF_CARD, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, @@ -317,7 +309,6 @@ static struct usb_quirk_entry usb_quirks USB_QUIRK(PANASONIC, KXLCB35AN, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI), USB_QUIRK(PANASONIC, LS120CAM, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_UFI), - USB_QUIRK(PHILIPS, SPE3030CC, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(PLEXTOR, 40_12_40U, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_TEST_UNIT_READY), USB_QUIRK(PNY, ATTACHE2, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, @@ -328,7 +319,6 @@ static struct usb_quirk_entry usb_quirks USB_QUIRK_VP(USB_VENDOR_SAMSUNG_TECHWIN, USB_PRODUCT_SAMSUNG_TECHWIN_DIGIMAX_410, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY), - USB_QUIRK(SAMSUNG, YP_U4, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(SANDISK, SDDR05A, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_READ_CAP_OFFBY1, UQ_MSC_NO_GETMAXLUN), @@ -448,12 +438,6 @@ static struct usb_quirk_entry usb_quirks UQ_MSC_FORCE_PROTO_ATAPI), USB_QUIRK(MEIZU, M6_SL, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY, UQ_MSC_NO_SYNC_CACHE), - USB_QUIRK(ACTIONS, MP4, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, - UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_SYNC_CACHE), - USB_QUIRK(ASUS, GMSC, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), - USB_QUIRK(CHIPSBANK, USBMEMSTICK, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), - USB_QUIRK(CHIPSBANK, USBMEMSTICK1, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), - USB_QUIRK(NEWLINK, USB2IDEBRIDGE, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), /* Non-standard USB MIDI devices */ USB_QUIRK(ROLAND, UM1, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), @@ -567,9 +551,9 @@ usb_test_quirk_by_info(const struct usbd uint16_t x; uint16_t y; - if (quirk == UQ_NONE) { - return (0); - } + if (quirk == UQ_NONE) + goto done; + mtx_lock(&usb_quirk_mtx); for (x = 0; x != USB_DEV_QUIRKS_MAX; x++) { @@ -603,7 +587,8 @@ usb_test_quirk_by_info(const struct usbd break; } mtx_unlock(&usb_quirk_mtx); - return (0); +done: + return (usb_test_quirk_w(info, quirk)); } static struct usb_quirk_entry * Modified: stable/8/sys/dev/usb/storage/umass.c ============================================================================== --- stable/8/sys/dev/usb/storage/umass.c Fri Sep 9 04:42:11 2011 (r225457) +++ stable/8/sys/dev/usb/storage/umass.c Fri Sep 9 07:44:14 2011 (r225458) @@ -1025,12 +1025,6 @@ umass_attach(device_t dev) sc->cam_scsi_sense.opcode = REQUEST_SENSE; sc->cam_scsi_test_unit_ready.opcode = TEST_UNIT_READY; - /* - * some devices need a delay after that the configuration value is - * set to function properly: - */ - usb_pause_mtx(NULL, hz); - /* register the SIM */ err = umass_cam_attach_sim(sc); if (err) { Modified: stable/8/sys/dev/usb/usb_device.c ============================================================================== --- stable/8/sys/dev/usb/usb_device.c Fri Sep 9 04:42:11 2011 (r225457) +++ stable/8/sys/dev/usb/usb_device.c Fri Sep 9 07:44:14 2011 (r225458) @@ -1239,7 +1239,9 @@ static void usb_init_attach_arg(struct usb_device *udev, struct usb_attach_arg *uaa) { - bzero(uaa, sizeof(*uaa)); + uint8_t x; + + memset(uaa, 0, sizeof(*uaa)); uaa->device = udev; uaa->usb_mode = udev->flags.usb_mode; @@ -1254,6 +1256,9 @@ usb_init_attach_arg(struct usb_device *u uaa->info.bDeviceProtocol = udev->ddesc.bDeviceProtocol; uaa->info.bConfigIndex = udev->curr_config_index; uaa->info.bConfigNum = udev->curr_config_no; + + for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) + uaa->info.autoQuirk[x] = udev->autoQuirk[x]; } /*------------------------------------------------------------------------* @@ -1850,6 +1855,20 @@ repeat_set_config: } } } + if (set_config_failed == 0 && config_index == 0 && + usb_test_quirk(&uaa, UQ_MSC_NO_SYNC_CACHE) == 0) { + + /* + * Try to figure out if there are any MSC quirks we + * should apply automatically: + */ + err = usb_msc_auto_quirk(udev, 0); + + if (err != 0) { + set_config_failed = 1; + goto repeat_set_config; + } + } config_done: DPRINTF("new dev (addr %d), udev=%p, parent_hub=%p\n", @@ -2773,3 +2792,16 @@ usbd_set_pnpinfo(struct usb_device *udev return (0); /* success */ } +usb_error_t +usbd_add_dynamic_quirk(struct usb_device *udev, uint16_t quirk) +{ + uint8_t x; + + for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) { + if (udev->autoQuirk[x] == 0) { + udev->autoQuirk[x] = quirk; + return (0); /* success */ + } + } + return (USB_ERR_NOMEM); +} Modified: stable/8/sys/dev/usb/usb_device.h ============================================================================== --- stable/8/sys/dev/usb/usb_device.h Fri Sep 9 04:42:11 2011 (r225457) +++ stable/8/sys/dev/usb/usb_device.h Fri Sep 9 07:44:14 2011 (r225458) @@ -149,6 +149,7 @@ struct usb_device { uint16_t power; /* mA the device uses */ uint16_t langid; /* language for strings */ + uint16_t autoQuirk[USB_MAX_AUTO_QUIRK]; /* dynamic quirks */ uint8_t address; /* device addess */ uint8_t device_index; /* device index in "bus->devices" */ Modified: stable/8/sys/dev/usb/usb_dynamic.c ============================================================================== --- stable/8/sys/dev/usb/usb_dynamic.c Fri Sep 9 04:42:11 2011 (r225457) +++ stable/8/sys/dev/usb/usb_dynamic.c Fri Sep 9 07:44:14 2011 (r225458) @@ -50,12 +50,12 @@ #include #include #include +#include /* function prototypes */ static usb_handle_req_t usb_temp_get_desc_w; static usb_temp_setup_by_index_t usb_temp_setup_by_index_w; static usb_temp_unsetup_t usb_temp_unsetup_w; -static usb_test_quirk_t usb_test_quirk_w; static usb_quirk_ioctl_t usb_quirk_ioctl_w; /* global variables */ @@ -72,9 +72,19 @@ usb_temp_setup_by_index_w(struct usb_dev return (USB_ERR_INVAL); } -static uint8_t +uint8_t usb_test_quirk_w(const struct usbd_lookup_info *info, uint16_t quirk) { + uint8_t x; + + if (quirk == UQ_NONE) + return (0); /* no match */ + + for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) { + if (info->autoQuirk[x] == quirk) + return (1); /* match */ + } + return (0); /* no match */ } Modified: stable/8/sys/dev/usb/usb_dynamic.h ============================================================================== --- stable/8/sys/dev/usb/usb_dynamic.h Fri Sep 9 04:42:11 2011 (r225457) +++ stable/8/sys/dev/usb/usb_dynamic.h Fri Sep 9 07:44:14 2011 (r225458) @@ -57,5 +57,6 @@ extern devclass_t usb_devclass_ptr; void usb_temp_unload(void *); void usb_quirk_unload(void *); void usb_bus_unload(void *); +usb_test_quirk_t usb_test_quirk_w; #endif /* _USB_DYNAMIC_H_ */ Modified: stable/8/sys/dev/usb/usb_freebsd.h ============================================================================== --- stable/8/sys/dev/usb/usb_freebsd.h Fri Sep 9 04:42:11 2011 (r225457) +++ stable/8/sys/dev/usb/usb_freebsd.h Fri Sep 9 07:44:14 2011 (r225458) @@ -60,6 +60,8 @@ #define USB_EP0_BUFSIZE 1024 /* bytes */ #define USB_CS_RESET_LIMIT 20 /* failures = 20 * 50 ms = 1sec */ +#define USB_MAX_AUTO_QUIRK 4 /* maximum number of dynamic quirks */ + typedef uint32_t usb_timeout_t; /* milliseconds */ typedef uint32_t usb_frlength_t; /* bytes */ typedef uint32_t usb_frcount_t; /* units */ Modified: stable/8/sys/dev/usb/usb_msctest.c ============================================================================== --- stable/8/sys/dev/usb/usb_msctest.c Fri Sep 9 04:42:11 2011 (r225457) +++ stable/8/sys/dev/usb/usb_msctest.c Fri Sep 9 07:44:14 2011 (r225458) @@ -1,6 +1,6 @@ /* $FreeBSD$ */ /*- - * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. + * Copyright (c) 2008,2011 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -84,7 +84,10 @@ enum { DIR_NONE, }; +#define SCSI_MAX_LEN 0x100 #define SCSI_INQ_LEN 0x24 +#define SCSI_SENSE_LEN 0xFF + static uint8_t scsi_test_unit_ready[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; static uint8_t scsi_inquiry[] = { 0x12, 0x00, 0x00, 0x00, SCSI_INQ_LEN, 0x00 }; static uint8_t scsi_rezero_init[] = { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 }; @@ -97,6 +100,10 @@ static uint8_t scsi_huawei_eject[] = { 0 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; static uint8_t scsi_tct_eject[] = { 0x06, 0xf5, 0x04, 0x02, 0x52, 0x70 }; +static uint8_t scsi_sync_cache[] = { 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 }; +static uint8_t scsi_request_sense[] = { 0x03, 0x00, 0x00, 0x00, 0x12, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; #define BULK_SIZE 64 /* dummy */ #define ERR_CSW_FAILED -1 @@ -150,7 +157,7 @@ struct bbb_transfer { uint8_t status_try; int error; - uint8_t buffer[256]; + uint8_t buffer[SCSI_MAX_LEN] __aligned(4); }; static usb_callback_t bbb_command_callback; @@ -164,7 +171,7 @@ static void bbb_done(struct bbb_transfer static void bbb_transfer_start(struct bbb_transfer *, uint8_t); static void bbb_data_clear_stall_callback(struct usb_xfer *, uint8_t, uint8_t); -static uint8_t bbb_command_start(struct bbb_transfer *, uint8_t, uint8_t, +static int bbb_command_start(struct bbb_transfer *, uint8_t, uint8_t, void *, size_t, void *, size_t, usb_timeout_t); static struct bbb_transfer *bbb_attach(struct usb_device *, uint8_t); static void bbb_detach(struct bbb_transfer *); @@ -455,7 +462,7 @@ bbb_status_callback(struct usb_xfer *xfe * 0: Success * Else: Failure *------------------------------------------------------------------------*/ -static uint8_t +static int bbb_command_start(struct bbb_transfer *sc, uint8_t dir, uint8_t lun, void *data_ptr, size_t data_len, void *cmd_ptr, size_t cmd_len, usb_timeout_t data_timeout) @@ -567,9 +574,10 @@ int usb_iface_is_cdrom(struct usb_device *udev, uint8_t iface_index) { struct bbb_transfer *sc; - usb_error_t err; - uint8_t timeout, is_cdrom; + uint8_t timeout; + uint8_t is_cdrom; uint8_t sid_type; + int err; sc = bbb_attach(udev, iface_index); if (sc == NULL) @@ -596,6 +604,114 @@ usb_iface_is_cdrom(struct usb_device *ud } usb_error_t +usb_msc_auto_quirk(struct usb_device *udev, uint8_t iface_index) +{ + struct bbb_transfer *sc; + uint8_t timeout; + uint8_t is_no_direct; + uint8_t sid_type; + int err; + + sc = bbb_attach(udev, iface_index); + if (sc == NULL) + return (0); + + /* + * Some devices need a delay after that the configuration + * value is set to function properly: + */ + usb_pause_mtx(NULL, hz); + + is_no_direct = 1; + for (timeout = 4; timeout; timeout--) { + err = bbb_command_start(sc, DIR_IN, 0, sc->buffer, + SCSI_INQ_LEN, &scsi_inquiry, sizeof(scsi_inquiry), + USB_MS_HZ); + + if (err == 0 && sc->actlen > 0) { + sid_type = sc->buffer[0] & 0x1F; + if (sid_type == 0x00) + is_no_direct = 0; + break; + } else if (err != ERR_CSW_FAILED) + break; /* non retryable error */ + usb_pause_mtx(NULL, hz); + } + + if (is_no_direct) { + DPRINTF("Device is not direct access.\n"); + goto done; + } + + err = bbb_command_start(sc, DIR_IN, 0, NULL, 0, + &scsi_test_unit_ready, sizeof(scsi_test_unit_ready), + USB_MS_HZ); + + if (err != 0) { + + if (err != ERR_CSW_FAILED) + goto error; + } + + err = bbb_command_start(sc, DIR_IN, 0, NULL, 0, + &scsi_sync_cache, sizeof(scsi_sync_cache), + USB_MS_HZ); + + if (err != 0) { + + if (err != ERR_CSW_FAILED) + goto error; + + DPRINTF("Device doesn't handle synchronize cache\n"); + + usbd_add_dynamic_quirk(udev, UQ_MSC_NO_SYNC_CACHE); + } + + /* clear sense status of any failed commands on the device */ + + err = bbb_command_start(sc, DIR_IN, 0, sc->buffer, + SCSI_INQ_LEN, &scsi_inquiry, sizeof(scsi_inquiry), + USB_MS_HZ); + + DPRINTF("Inquiry = %d\n", err); + + if (err != 0) { + + if (err != ERR_CSW_FAILED) + goto error; + } + + err = bbb_command_start(sc, DIR_IN, 0, sc->buffer, + SCSI_SENSE_LEN, &scsi_request_sense, + sizeof(scsi_request_sense), USB_MS_HZ); + + DPRINTF("Request sense = %d\n", err); + + if (err != 0) { + + if (err != ERR_CSW_FAILED) + goto error; + } + +done: + bbb_detach(sc); + return (0); + +error: + bbb_detach(sc); + + DPRINTF("Device did not respond, enabling all quirks\n"); + + usbd_add_dynamic_quirk(udev, UQ_MSC_NO_SYNC_CACHE); + usbd_add_dynamic_quirk(udev, UQ_MSC_NO_TEST_UNIT_READY); + + /* Need to re-enumerate the device */ + usbd_req_re_enumerate(udev, NULL); + + return (USB_ERR_STALLED); +} + +usb_error_t usb_msc_eject(struct usb_device *udev, uint8_t iface_index, int method) { struct bbb_transfer *sc; Modified: stable/8/sys/dev/usb/usb_msctest.h ============================================================================== --- stable/8/sys/dev/usb/usb_msctest.h Fri Sep 9 04:42:11 2011 (r225457) +++ stable/8/sys/dev/usb/usb_msctest.h Fri Sep 9 07:44:14 2011 (r225458) @@ -40,5 +40,7 @@ int usb_iface_is_cdrom(struct usb_device uint8_t iface_index); usb_error_t usb_msc_eject(struct usb_device *udev, uint8_t iface_index, int method); +usb_error_t usb_msc_auto_quirk(struct usb_device *udev, + uint8_t iface_index); #endif /* _USB_MSCTEST_H_ */ Modified: stable/8/sys/dev/usb/usbdi.h ============================================================================== --- stable/8/sys/dev/usb/usbdi.h Fri Sep 9 04:42:11 2011 (r225457) +++ stable/8/sys/dev/usb/usbdi.h Fri Sep 9 07:44:14 2011 (r225458) @@ -353,6 +353,7 @@ struct usbd_lookup_info { uint16_t idVendor; uint16_t idProduct; uint16_t bcdDevice; + uint16_t autoQuirk[USB_MAX_AUTO_QUIRK]; uint8_t bDeviceClass; uint8_t bDeviceSubClass; uint8_t bDeviceProtocol; @@ -475,6 +476,8 @@ void device_set_usb_desc(device_t dev); void usb_pause_mtx(struct mtx *mtx, int _ticks); usb_error_t usbd_set_pnpinfo(struct usb_device *udev, uint8_t iface_index, const char *pnpinfo); +usb_error_t usbd_add_dynamic_quirk(struct usb_device *udev, + uint16_t quirk); const struct usb_device_id *usbd_lookup_id_by_info( const struct usb_device_id *id, usb_size_t sizeof_id, Modified: stable/8/sys/sys/param.h ============================================================================== --- stable/8/sys/sys/param.h Fri Sep 9 04:42:11 2011 (r225457) +++ stable/8/sys/sys/param.h Fri Sep 9 07:44:14 2011 (r225458) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 802510 /* Master, propagated to newvers */ +#define __FreeBSD_version 802511 /* Master, propagated to newvers */ #ifdef _KERNEL #define P_OSREL_SIGSEGV 700004 From owner-svn-src-all@FreeBSD.ORG Fri Sep 9 13:52:38 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 409CA106566B; Fri, 9 Sep 2011 13:52:38 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 16E258FC0C; Fri, 9 Sep 2011 13:52:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p89DqbxH040714; Fri, 9 Sep 2011 13:52:37 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p89DqbHD040712; Fri, 9 Sep 2011 13:52:37 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201109091352.p89DqbHD040712@svn.freebsd.org> From: Michael Tuexen Date: Fri, 9 Sep 2011 13:52:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225462 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Sep 2011 13:52:38 -0000 Author: tuexen Date: Fri Sep 9 13:52:37 2011 New Revision: 225462 URL: http://svn.freebsd.org/changeset/base/225462 Log: Improve implementation of the Nagle algorithm for SCTP: Don't delay the final fragment of a fragmented user message. Approved by: re MFC after: 4 weeks Modified: head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Fri Sep 9 11:59:59 2011 (r225461) +++ head/sys/netinet/sctp_output.c Fri Sep 9 13:52:37 2011 (r225462) @@ -9821,19 +9821,22 @@ sctp_chunk_output(struct sctp_inpcb *inp unsigned int burst_cnt = 0; struct timeval now; int now_filled = 0; - int nagle_on = 0; + int nagle_on; int frag_point = sctp_get_frag_point(stcb, &stcb->asoc); int un_sent = 0; int fr_done; unsigned int tot_frs = 0; asoc = &stcb->asoc; + /* The Nagle algorithm is only applied when handling a send call. */ if (from_where == SCTP_OUTPUT_FROM_USR_SEND) { if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_NODELAY)) { nagle_on = 0; } else { nagle_on = 1; } + } else { + nagle_on = 0; } SCTP_TCB_LOCK_ASSERT(stcb); @@ -10007,15 +10010,18 @@ sctp_chunk_output(struct sctp_inpcb *inp } } if (nagle_on) { - /*- - * When nagle is on, we look at how much is un_sent, then - * if its smaller than an MTU and we have data in - * flight we stop. + /* + * When the Nagle algorithm is used, look at how + * much is unsent, then if its smaller than an MTU + * and we have data in flight we stop, except if we + * are handling a fragmented user message. */ un_sent = ((stcb->asoc.total_output_queue_size - stcb->asoc.total_flight) + (stcb->asoc.stream_queue_cnt * sizeof(struct sctp_data_chunk))); if ((un_sent < (int)(stcb->asoc.smallest_mtu - SCTP_MIN_OVERHEAD)) && - (stcb->asoc.total_flight > 0)) { + (stcb->asoc.total_flight > 0) && + ((stcb->asoc.locked_on_sending == NULL) || + sctp_is_feature_on(inp, SCTP_PCB_FLAGS_EXPLICIT_EOR))) { break; } } From owner-svn-src-all@FreeBSD.ORG Fri Sep 9 19:39:54 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 68F33106566C; Fri, 9 Sep 2011 19:39:54 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 57D798FC1D; Fri, 9 Sep 2011 19:39:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p89JdsdA051435; Fri, 9 Sep 2011 19:39:54 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p89JdsIt051433; Fri, 9 Sep 2011 19:39:54 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201109091939.p89JdsIt051433@svn.freebsd.org> From: Christian Brueffer Date: Fri, 9 Sep 2011 19:39:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225464 - stable/8/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Sep 2011 19:39:54 -0000 Author: brueffer Date: Fri Sep 9 19:39:54 2011 New Revision: 225464 URL: http://svn.freebsd.org/changeset/base/225464 Log: MFC: r225348 Remove an incorrect apostrophe. Modified: stable/8/share/man/man4/wlan.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/wlan.4 ============================================================================== --- stable/8/share/man/man4/wlan.4 Fri Sep 9 15:03:52 2011 (r225463) +++ stable/8/share/man/man4/wlan.4 Fri Sep 9 19:39:54 2011 (r225464) @@ -121,7 +121,7 @@ Note that an interface's type cannot be .Pp .Nm defines several mechanisms by which plugin modules may -be used to extend its' functionality. +be used to extend its functionality. Cryptographic support such as WEP, TKIP, and AES-CCMP are implemented as standalone modules (if not statically configured into a system) that register with From owner-svn-src-all@FreeBSD.ORG Sat Sep 10 09:40:00 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 820021065677; Sat, 10 Sep 2011 09:40:00 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6F2408FC19; Sat, 10 Sep 2011 09:40:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8A9e0n3078237; Sat, 10 Sep 2011 09:40:00 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8A9e0dn078234; Sat, 10 Sep 2011 09:40:00 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201109100940.p8A9e0dn078234@svn.freebsd.org> From: Christian Brueffer Date: Sat, 10 Sep 2011 09:40:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225467 - in head/usr.sbin: bsdinstall/scripts pc-sysinstall/backend X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Sep 2011 09:40:00 -0000 Author: brueffer Date: Sat Sep 10 09:40:00 2011 New Revision: 225467 URL: http://svn.freebsd.org/changeset/base/225467 Log: Add ftp4.se.freebsd.org to the IPv4 and IPv6 mirror lists. PR: 157210, 157211 Submitted by: Niclas Zeising Approved by: re (kib) Modified: head/usr.sbin/bsdinstall/scripts/mirrorselect head/usr.sbin/pc-sysinstall/backend/functions-ftp.sh Modified: head/usr.sbin/bsdinstall/scripts/mirrorselect ============================================================================== --- head/usr.sbin/bsdinstall/scripts/mirrorselect Sat Sep 10 08:00:26 2011 (r225466) +++ head/usr.sbin/bsdinstall/scripts/mirrorselect Sat Sep 10 09:40:00 2011 (r225467) @@ -45,6 +45,7 @@ MIRROR=`dialog --backtitle "FreeBSD Inst ftp://ftp3.ie.freebsd.org "IPv6 Ireland"\ ftp://ftp.il.freebsd.org "IPv6 Israel"\ ftp://ftp2.jp.freebsd.org "IPv6 Japan"\ + ftp://ftp4.se.freebsd.org "IPv6 Sweden"\ ftp://ftp4.us.freebsd.org "IPv6 USA"\ ftp://ftp2.tr.freebsd.org "IPv6 Turkey"\ ftp://ftp1.freebsd.org "Primary"\ Modified: head/usr.sbin/pc-sysinstall/backend/functions-ftp.sh ============================================================================== --- head/usr.sbin/pc-sysinstall/backend/functions-ftp.sh Sat Sep 10 08:00:26 2011 (r225466) +++ head/usr.sbin/pc-sysinstall/backend/functions-ftp.sh Sat Sep 10 09:40:00 2011 (r225467) @@ -40,6 +40,7 @@ IPv6 Main Site: ftp.freebsd.org|\ IPv6 Ireland: ftp3.ie.freebsd.org|\ IPv6 Israel: ftp.il.freebsd.org|\ IPv6 Japan: ftp2.jp.freebsd.org|\ +IPv6 Sweden: ftp4.se.freebsd.org|\ IPv6 USA: ftp4.us.freebsd.org|\ IPv6 Turkey: ftp2.tr.freebsd.org" @@ -212,6 +213,7 @@ SWEDEN_FTP_SERVERS="\ Sweden: ftp.se.freebsd.org|\ Sweden #2: ftp2.se.freebsd.org|\ Sweden #3: ftp3.se.freebsd.org|\ +Sweden #4: ftp4.se.freebsd.org|\ Sweden #5: ftp5.se.freebsd.org" SWITZERLAND_FTP_SERVERS="\ From owner-svn-src-all@FreeBSD.ORG Sat Sep 10 10:54:08 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D37B3106564A; Sat, 10 Sep 2011 10:54:08 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id AF6CB8FC14; Sat, 10 Sep 2011 10:54:08 +0000 (UTC) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 4E6C446B09; Sat, 10 Sep 2011 06:54:08 -0400 (EDT) Date: Sat, 10 Sep 2011 11:54:08 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Hans Petter Selasky In-Reply-To: <201109090744.p897iE9x027234@svn.freebsd.org> Message-ID: References: <201109090744.p897iE9x027234@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r225458 - in stable/8/sys: dev/usb dev/usb/quirk dev/usb/storage sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Sep 2011 10:54:08 -0000 On Fri, 9 Sep 2011, Hans Petter Selasky wrote: > Log: > MFC r225350 and r225400: > > This patch adds automatic detection of USB mass storage devices > which does not support the no synchronize cache SCSI command. > > The __FreeBSD_version version macro has been bumped and > external kernel modules needs to be recompiled after > this patch. > > PR: usb/160299 For most other classes of hardware device driver framework KPIs -- especially things like PCI bus attachment, busdma, CAM, ifnet, and GEOM frameworks, our MFC rules would strictly disallow this sort of change, on the grounds that it is our KBI policy that we not break common classes of third-party device drivers (i.e., require them to be recompiled). My suspicion is that we should be applying the same rules to the USB framework -- however, I don't know if we have any third-party USB device drivers? (If we do, then this change should not have been MFC'd.) Robert From owner-svn-src-all@FreeBSD.ORG Sat Sep 10 11:21:07 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B13FF1065670; Sat, 10 Sep 2011 11:21:07 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) by mx1.freebsd.org (Postfix) with ESMTP id 3E4988FC1A; Sat, 10 Sep 2011 11:21:07 +0000 (UTC) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id EB94025D385D; Sat, 10 Sep 2011 11:21:05 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 06379BD3D1C; Sat, 10 Sep 2011 11:21:05 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id fub+b+R41qGA; Sat, 10 Sep 2011 11:21:03 +0000 (UTC) Received: from [IPv6:::1] (shell.eq4-01.sbone.de [IPv6:fde9:577b:c1a9:3161::401:22]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 70586BD3BF0; Sat, 10 Sep 2011 11:21:02 +0000 (UTC) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: "Bjoern A. Zeeb" In-Reply-To: Date: Sat, 10 Sep 2011 11:21:00 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <28707761-AA24-43D5-AE8B-B0D8842C6F13@lists.zabbadoz.net> References: <201109090744.p897iE9x027234@svn.freebsd.org> To: Robert Watson X-Mailer: Apple Mail (2.1084) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org, Hans Petter Selasky Subject: Re: svn commit: r225458 - in stable/8/sys: dev/usb dev/usb/quirk dev/usb/storage sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Sep 2011 11:21:07 -0000 On Sep 10, 2011, at 10:54 AM, Robert Watson wrote: > On Fri, 9 Sep 2011, Hans Petter Selasky wrote: >=20 >> Log: >> MFC r225350 and r225400: >>=20 >> This patch adds automatic detection of USB mass storage devices >> which does not support the no synchronize cache SCSI command. >>=20 >> The __FreeBSD_version version macro has been bumped and >> external kernel modules needs to be recompiled after >> this patch. >>=20 >> PR: usb/160299 >=20 > For most other classes of hardware device driver framework KPIs -- = especially things like PCI bus attachment, busdma, CAM, ifnet, and GEOM = frameworks, our MFC rules would strictly disallow this sort of change, = on the grounds that it is our KBI policy that we not break common = classes of third-party device drivers (i.e., require them to be = recompiled). My suspicion is that we should be applying the same rules = to the USB framework -- however, I don't know if we have any third-party = USB device drivers? >=20 > (If we do, then this change should not have been MFC'd.) We do have FreeBSD consumers with private USB drivers, yes. /bz --=20 Bjoern A. Zeeb You have to have visions! Stop bit received. Insert coin for new address family. From owner-svn-src-all@FreeBSD.ORG Sat Sep 10 11:23:20 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6C3211065672; Sat, 10 Sep 2011 11:23:20 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe03.c2i.net [212.247.154.66]) by mx1.freebsd.org (Postfix) with ESMTP id 1E8098FC16; Sat, 10 Sep 2011 11:23:18 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.1 cv=yVKV3zusvCapyMfYJBNW2j35FMEuTKq6vh/tt/1L5+g= c=1 sm=1 a=SvYTsOw2Z4kA:10 a=6b_Q_48HAbEA:10 a=WQU8e4WWZSUA:10 a=N659UExz7-8A:10 a=CL8lFSKtTFcA:10 a=i9M/sDlu2rpZ9XS819oYzg==:17 a=6aILc7Gg3D_yVBswW-IA:9 a=pILNOxqGKmIA:10 a=i9M/sDlu2rpZ9XS819oYzg==:117 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe03.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 10046282; Sat, 10 Sep 2011 13:13:08 +0200 From: Hans Petter Selasky To: Robert Watson Date: Sat, 10 Sep 2011 13:10:24 +0200 User-Agent: KMail/1.13.5 (FreeBSD/8.2-STABLE; KDE/4.4.5; amd64; ; ) References: <201109090744.p897iE9x027234@svn.freebsd.org> In-Reply-To: X-Face: *nPdTl_}RuAI6^PVpA02T?$%Xa^>@hE0uyUIoiha$pC:9TVgl.Oq,NwSZ4V" =?windows-1252?q?=7CLR=2E+tj=7Dg5=0A=09=25V?=,x^qOs~mnU3]Gn; cQLv&.N>TrxmSFf+p6(30a/{)KUU!s}w\IhQBj}[g}bj0I3^glmC( =?windows-1252?q?=0A=09=3AAuzV9=3A=2EhESm-x4h240C=609=3Dw?= MIME-Version: 1.0 Content-Type: Text/Plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Message-Id: <201109101310.24841.hselasky@c2i.net> Cc: "svn-src-stable@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , "svn-src-stable-8@freebsd.org" Subject: Re: svn commit: r225458 - in stable/8/sys: dev/usb dev/usb/quirk dev/usb/storage sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Sep 2011 11:23:20 -0000 On Saturday 10 September 2011 12:54:08 Robert Watson wrote: > On Fri, 9 Sep 2011, Hans Petter Selasky wrote: > > Log: > > MFC r225350 and r225400: > > > > This patch adds automatic detection of USB mass storage devices > > which does not support the no synchronize cache SCSI command. > > > > The __FreeBSD_version version macro has been bumped and > > external kernel modules needs to be recompiled after > > this patch. > > > > PR: usb/160299 > > For most other classes of hardware device driver framework KPIs -- > especially things like PCI bus attachment, busdma, CAM, ifnet, and GEOM > frameworks, our MFC rules would strictly disallow this sort of change, on > the grounds that it is our KBI policy that we not break common classes of > third-party device drivers (i.e., require them to be recompiled). My > suspicion is that we should be applying the same rules to the USB > framework -- however, I don't know if we have any third-party USB device > drivers? > > (If we do, then this change should not have been MFC'd.) Hi Robert, I understand your point. The change is not breaking any KPIs towards userspace. The structure in question is only used within the kernel and kernel modules. --HPS From owner-svn-src-all@FreeBSD.ORG Sat Sep 10 11:31:59 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 981611065675; Sat, 10 Sep 2011 11:31:59 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 0A6358FC1B; Sat, 10 Sep 2011 11:31:58 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id p8ABVtVM043283 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 10 Sep 2011 14:31:55 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id p8ABVte0058357; Sat, 10 Sep 2011 14:31:55 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id p8ABVtA7058356; Sat, 10 Sep 2011 14:31:55 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 10 Sep 2011 14:31:55 +0300 From: Kostik Belousov To: "Bjoern A. Zeeb" Message-ID: <20110910113155.GJ17489@deviant.kiev.zoral.com.ua> References: <201109090744.p897iE9x027234@svn.freebsd.org> <28707761-AA24-43D5-AE8B-B0D8842C6F13@lists.zabbadoz.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="7m2Ta+5QzzfNUVnL" Content-Disposition: inline In-Reply-To: <28707761-AA24-43D5-AE8B-B0D8842C6F13@lists.zabbadoz.net> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: src-committers@freebsd.org, Hans Petter Selasky , svn-src-stable@freebsd.org, svn-src-all@freebsd.org, Robert Watson , svn-src-stable-8@freebsd.org Subject: Re: svn commit: r225458 - in stable/8/sys: dev/usb dev/usb/quirk dev/usb/storage sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Sep 2011 11:31:59 -0000 --7m2Ta+5QzzfNUVnL Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Sep 10, 2011 at 11:21:00AM +0000, Bjoern A. Zeeb wrote: >=20 > On Sep 10, 2011, at 10:54 AM, Robert Watson wrote: >=20 > > On Fri, 9 Sep 2011, Hans Petter Selasky wrote: > >=20 > >> Log: > >> MFC r225350 and r225400: > >>=20 > >> This patch adds automatic detection of USB mass storage devices > >> which does not support the no synchronize cache SCSI command. > >>=20 > >> The __FreeBSD_version version macro has been bumped and > >> external kernel modules needs to be recompiled after > >> this patch. > >>=20 > >> PR: usb/160299 > >=20 > > For most other classes of hardware device driver framework KPIs -- espe= cially things like PCI bus attachment, busdma, CAM, ifnet, and GEOM framewo= rks, our MFC rules would strictly disallow this sort of change, on the grou= nds that it is our KBI policy that we not break common classes of third-par= ty device drivers (i.e., require them to be recompiled). My suspicion is t= hat we should be applying the same rules to the USB framework -- however, I= don't know if we have any third-party USB device drivers? > >=20 > > (If we do, then this change should not have been MFC'd.) >=20 > We do have FreeBSD consumers with private USB drivers, yes. It seems that most of the damage can be mitigated by placing the added fields at the end of the structures, at least for stable/8. --7m2Ta+5QzzfNUVnL Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAk5rSqoACgkQC3+MBN1Mb4it4wCgp9EuWsJWR3iiFemfYXRCaZqE ULIAnim6ed6WfR5PsJZgPsG4Z75+IQjZ =HOTy -----END PGP SIGNATURE----- --7m2Ta+5QzzfNUVnL-- From owner-svn-src-all@FreeBSD.ORG Sat Sep 10 11:35:54 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 36D621065672; Sat, 10 Sep 2011 11:35:54 +0000 (UTC) (envelope-from rwatson@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 0F0518FC0A; Sat, 10 Sep 2011 11:35:54 +0000 (UTC) Received: from [192.168.2.112] (host86-162-157-222.range86-162.btcentralplus.com [86.162.157.222]) by cyrus.watson.org (Postfix) with ESMTPSA id D622946B09; Sat, 10 Sep 2011 07:35:52 -0400 (EDT) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: "Robert N. M. Watson" In-Reply-To: <201109101310.24841.hselasky@c2i.net> Date: Sat, 10 Sep 2011 12:35:51 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201109090744.p897iE9x027234@svn.freebsd.org> <201109101310.24841.hselasky@c2i.net> To: Hans Petter Selasky X-Mailer: Apple Mail (2.1084) Cc: "svn-src-stable@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , "svn-src-stable-8@freebsd.org" Subject: Re: svn commit: r225458 - in stable/8/sys: dev/usb dev/usb/quirk dev/usb/storage sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Sep 2011 11:35:54 -0000 On 10 Sep 2011, at 12:10, Hans Petter Selasky wrote: >> For most other classes of hardware device driver framework KPIs -- >> especially things like PCI bus attachment, busdma, CAM, ifnet, and = GEOM >> frameworks, our MFC rules would strictly disallow this sort of = change, on >> the grounds that it is our KBI policy that we not break common = classes of >> third-party device drivers (i.e., require them to be recompiled). My >> suspicion is that we should be applying the same rules to the USB >> framework -- however, I don't know if we have any third-party USB = device >> drivers? >>=20 >> (If we do, then this change should not have been MFC'd.) >=20 > I understand your point. The change is not breaking any KPIs towards=20= > userspace. The structure in question is only used within the kernel = and kernel=20 > modules. Right -- exactly my point. If this change breaks third-party compiled = USB device drivers, then our current approach to device driver KBIs does = not allow it to be MFC'd in this form. Are there ways you can = reformulate the change to avoid breaking those drivers? Sometimes this = can be done by adding new symbols, rather than replacing currently = symbols, although mileage varies. Robert= From owner-svn-src-all@FreeBSD.ORG Sat Sep 10 12:24:34 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9A2C31065670; Sat, 10 Sep 2011 12:24:34 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 5B0EE8FC14; Sat, 10 Sep 2011 12:24:34 +0000 (UTC) Received: from [192.168.2.112] (host86-162-157-222.range86-162.btcentralplus.com [86.162.157.222]) by cyrus.watson.org (Postfix) with ESMTPSA id CC34A46B06; Sat, 10 Sep 2011 08:24:32 -0400 (EDT) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: "Robert N. M. Watson" In-Reply-To: Date: Sat, 10 Sep 2011 13:24:30 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <3406F3E2-56E6-47FF-8A60-10DD9F3B3D10@FreeBSD.org> References: <201109090744.p897iE9x027234@svn.freebsd.org> <201109101310.24841.hselasky@c2i.net> To: Hans Petter Selasky X-Mailer: Apple Mail (2.1084) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r225458 - in stable/8/sys: dev/usb dev/usb/quirk dev/usb/storage sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Sep 2011 12:24:34 -0000 On 10 Sep 2011, at 12:35, Robert N. M. Watson wrote: >> I understand your point. The change is not breaking any KPIs towards=20= >> userspace. The structure in question is only used within the kernel = and kernel=20 >> modules. >=20 > Right -- exactly my point. If this change breaks third-party compiled = USB device drivers, then our current approach to device driver KBIs does = not allow it to be MFC'd in this form. Are there ways you can = reformulate the change to avoid breaking those drivers? Sometimes this = can be done by adding new symbols, rather than replacing currently = symbols, although mileage varies. FYI, you can find our rules for modifications to many network stack data = structures here: http://wiki.freebsd.org/NetKPIKBI We're willing to make rather extensive changes to in-kernel data = structures between major releases, but between minor releases we modify = kernel structures frequently used by device drivers only according to = specific rules. Some are essentially immutable -- for example, struct mbuf, as = assumptions about their size, layout, and interpretation are embedded in = hundreds of kernel modules. Others, such as struct ipq, are only = allocated by base kernel components, so you can safely extend them = without breaking device drivers that incorporate earlier assumptions = about layout (they just don't see new fields, which is often fine). Some = contain explicit padding put in before the .0 release to allow new = features to be added subject to constrained rules -- for example, we = often put additional padding fields into struct inpcb so that we can add = new well-defined features after the release, but can't grow the = structure due to it being embedded. Over time, we've been trying to make the ABI/KBI more robust by... (1) Attempting to divorce kernel data structures from user data = structures as much as possible, allowing kernel data structures to be = changed without requiring application modification. (2) Attempting to document which data structures can change and in what = ways (vis the above wiki page) so that there's a mutual understanding = about what can be done. (3) Think about what features will be added early in major release = cycles -- hence announcements of a "padding day" earlier in the 9.0 = cycle, and explicit commits to add necessary padding. (4) Avoid embedding base kernel data structures within module data = structures or allowing use of stack allocation of those structures. For = example, historically, BSD device drivers would embed "struct ifnet" = inside their per-drive softc. Now, the base kernel is responsible for = allocating struct ifnet's, and per-driver softc's have a pointer to the = ifnet allocated by the kernel. This adds more indirection in some cases, = but can significantly improve robustness. (5) In more extreme cases, disallow direct field access on data = structures entirely, requiring modules to treat them as opaque and = access fields via accessor functions. We don't use this approach all = that much, but have (for example) used it in inpcb locking, as it = allowed us to migrate from mutexes to rwlocks transparently, as well as = change other aspects of locking strategy. We use this in the MAC = Framework and a number of other places to achieve higher levels of = abstraction that will allow us to change (for example) label allocation = strategies between minor versions. Apple takes this much further than = us: in XNU, all access to mbuf fields is done via accessor functions, = allowing them to change the layout of mbufs without breaking device = drivers (such that device drivers can work with multiple major Mac OS X = versions). This presumably comes at a measurable cost that they deem = appropriate given the specifics of their end-user requirements. Another advantage to documenting KPIs/KBIs in a formal way is that it = actually gives us more flexibility to break other interfaces -- they = aren't on the list we advertise as being stable. We would benefit from = doing a much better job at this, but have been trying to be more = structured in the network stack, especially, due to a high demand for = fundamental code changes in support of new features. Robert= From owner-svn-src-all@FreeBSD.ORG Sat Sep 10 13:43:04 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 786A3106564A; Sat, 10 Sep 2011 13:43:04 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe09.c2i.net [212.247.155.2]) by mx1.freebsd.org (Postfix) with ESMTP id E68C68FC12; Sat, 10 Sep 2011 13:43:02 +0000 (UTC) Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe09.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 1389927; Sat, 10 Sep 2011 15:42:59 +0200 From: Hans Petter Selasky To: "Robert N. M. Watson" Date: Sat, 10 Sep 2011 15:40:16 +0200 User-Agent: KMail/1.13.5 (FreeBSD/8.2-STABLE; KDE/4.4.5; amd64; ; ) References: <3406F3E2-56E6-47FF-8A60-10DD9F3B3D10@FreeBSD.org> In-Reply-To: <3406F3E2-56E6-47FF-8A60-10DD9F3B3D10@FreeBSD.org> X-Face: *nPdTl_}RuAI6^PVpA02T?$%Xa^>@hE0uyUIoiha$pC:9TVgl.Oq, NwSZ4V"|LR.+tj}g5 %V,x^qOs~mnU3]Gn; cQLv&.N>TrxmSFf+p6(30a/{)KUU!s}w\IhQBj}[g}bj0I3^glmC( :AuzV9:.hESm-x4h240C`9=w MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_Aj2aOn1c6cYTFr5" Message-Id: <201109101540.16656.hselasky@c2i.net> Cc: "svn-src-stable@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , "svn-src-stable-8@freebsd.org" , re@freebsd.org Subject: Request for patch approval (Re: svn commit: r225458 - in stable/8/sys: dev/usb dev/usb/quirk dev/usb/storage sys) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Sep 2011 13:43:04 -0000 --Boundary-00=_Aj2aOn1c6cYTFr5 Content-Type: Text/Plain; charset="windows-1252" Content-Transfer-Encoding: 7bit > Right -- exactly my point. If this change breaks third-party compiled USB > device drivers, then our current approach to device driver KBIs does not > allow it to be MFC'd in this form. Are there ways you can reformulate the > change to avoid breaking those drivers? Sometimes this can be done by > adding new symbols, rather than replacing currently symbols, although > mileage varies. Hi, Here is my proposal: Implement test for automatic quirks in function which has access to the USB device structure. This decouples the structure change in "struct usbd_lookup_info". The only structure which needs change is "struct usb_device". In 9-current this structure will be kept as is. In 8-stable the new element will be moved to the end of the structure like suggested, and then there shouldn't be any problems. Please find patches attached. --HPS Commit message: Refactor auto-quirk solution so that we break as few external drivers as possible. PR: usb/160299 Approved by: re (kib) Suggested by: rwatson MFC after: 0 days --Boundary-00=_Aj2aOn1c6cYTFr5 Content-Type: text/x-patch; charset="windows-1252"; name="msc_auto_quirk_8_stable.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="msc_auto_quirk_8_stable.patch" Index: sys/dev/usb/usb_dynamic.h =================================================================== --- sys/dev/usb/usb_dynamic.h (revision 225458) +++ sys/dev/usb/usb_dynamic.h (working copy) @@ -57,6 +57,5 @@ void usb_temp_unload(void *); void usb_quirk_unload(void *); void usb_bus_unload(void *); -usb_test_quirk_t usb_test_quirk_w; #endif /* _USB_DYNAMIC_H_ */ Index: sys/dev/usb/quirk/usb_quirk.c =================================================================== --- sys/dev/usb/quirk/usb_quirk.c (revision 225458) +++ sys/dev/usb/quirk/usb_quirk.c (working copy) @@ -588,7 +588,7 @@ } mtx_unlock(&usb_quirk_mtx); done: - return (usb_test_quirk_w(info, quirk)); + return (0); /* no quirk match */ } static struct usb_quirk_entry * Index: sys/dev/usb/usbdi.h =================================================================== --- sys/dev/usb/usbdi.h (revision 225458) +++ sys/dev/usb/usbdi.h (working copy) @@ -353,7 +353,6 @@ uint16_t idVendor; uint16_t idProduct; uint16_t bcdDevice; - uint16_t autoQuirk[USB_MAX_AUTO_QUIRK]; uint8_t bDeviceClass; uint8_t bDeviceSubClass; uint8_t bDeviceProtocol; Index: sys/dev/usb/usb_device.c =================================================================== --- sys/dev/usb/usb_device.c (revision 225458) +++ sys/dev/usb/usb_device.c (working copy) @@ -1239,8 +1239,6 @@ usb_init_attach_arg(struct usb_device *udev, struct usb_attach_arg *uaa) { - uint8_t x; - memset(uaa, 0, sizeof(*uaa)); uaa->device = udev; @@ -1256,9 +1254,6 @@ uaa->info.bDeviceProtocol = udev->ddesc.bDeviceProtocol; uaa->info.bConfigIndex = udev->curr_config_index; uaa->info.bConfigNum = udev->curr_config_no; - - for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) - uaa->info.autoQuirk[x] = udev->autoQuirk[x]; } /*------------------------------------------------------------------------* @@ -2389,8 +2384,22 @@ usb_test_quirk(const struct usb_attach_arg *uaa, uint16_t quirk) { uint8_t found; + uint8_t x; + if (quirk == UQ_NONE) + return (0); + + /* search the automatic per device quirks first */ + + for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) { + if (uaa->device->autoQuirk[x] == quirk) + return (1); + } + + /* search global quirk table, if any */ + found = (usb_test_quirk_p) (&uaa->info, quirk); + return (found); } @@ -2798,7 +2807,8 @@ uint8_t x; for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) { - if (udev->autoQuirk[x] == 0) { + if (udev->autoQuirk[x] == 0 || + udev->autoQuirk[x] == quirk) { udev->autoQuirk[x] = quirk; return (0); /* success */ } Index: sys/dev/usb/usb_device.h =================================================================== --- sys/dev/usb/usb_device.h (revision 225458) +++ sys/dev/usb/usb_device.h (working copy) @@ -149,7 +149,6 @@ uint16_t power; /* mA the device uses */ uint16_t langid; /* language for strings */ - uint16_t autoQuirk[USB_MAX_AUTO_QUIRK]; /* dynamic quirks */ uint8_t address; /* device addess */ uint8_t device_index; /* device index in "bus->devices" */ @@ -191,6 +190,8 @@ #endif uint32_t clear_stall_errors; /* number of clear-stall failures */ + + uint16_t autoQuirk[USB_MAX_AUTO_QUIRK]; /* dynamic quirks */ }; /* globals */ Index: sys/dev/usb/usb_dynamic.c =================================================================== --- sys/dev/usb/usb_dynamic.c (revision 225458) +++ sys/dev/usb/usb_dynamic.c (working copy) @@ -50,12 +50,12 @@ #include #include #include -#include /* function prototypes */ static usb_handle_req_t usb_temp_get_desc_w; static usb_temp_setup_by_index_t usb_temp_setup_by_index_w; static usb_temp_unsetup_t usb_temp_unsetup_w; +static usb_test_quirk_t usb_test_quirk_w; static usb_quirk_ioctl_t usb_quirk_ioctl_w; /* global variables */ @@ -72,19 +72,9 @@ return (USB_ERR_INVAL); } -uint8_t +static uint8_t usb_test_quirk_w(const struct usbd_lookup_info *info, uint16_t quirk) { - uint8_t x; - - if (quirk == UQ_NONE) - return (0); /* no match */ - - for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) { - if (info->autoQuirk[x] == quirk) - return (1); /* match */ - } - return (0); /* no match */ } Index: sys/sys/param.h =================================================================== --- sys/sys/param.h (revision 225458) +++ sys/sys/param.h (working copy) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 802511 /* Master, propagated to newvers */ +#define __FreeBSD_version 802510 /* Master, propagated to newvers */ #ifdef _KERNEL #define P_OSREL_SIGSEGV 700004 --Boundary-00=_Aj2aOn1c6cYTFr5 Content-Type: text/x-patch; charset="windows-1252"; name="msc_auto_quirk_9_current.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="msc_auto_quirk_9_current.patch" === sys/dev/usb/quirk/usb_quirk.c ================================================================== --- sys/dev/usb/quirk/usb_quirk.c (revision 225404) +++ sys/dev/usb/quirk/usb_quirk.c (local) @@ -588,7 +588,7 @@ } mtx_unlock(&usb_quirk_mtx); done: - return (usb_test_quirk_w(info, quirk)); + return (0); /* no quirk match */ } static struct usb_quirk_entry * === sys/dev/usb/usb_device.c ================================================================== --- sys/dev/usb/usb_device.c (revision 225404) +++ sys/dev/usb/usb_device.c (local) @@ -1239,8 +1239,6 @@ usb_init_attach_arg(struct usb_device *udev, struct usb_attach_arg *uaa) { - uint8_t x; - memset(uaa, 0, sizeof(*uaa)); uaa->device = udev; @@ -1256,9 +1254,6 @@ uaa->info.bDeviceProtocol = udev->ddesc.bDeviceProtocol; uaa->info.bConfigIndex = udev->curr_config_index; uaa->info.bConfigNum = udev->curr_config_no; - - for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) - uaa->info.autoQuirk[x] = udev->autoQuirk[x]; } /*------------------------------------------------------------------------* @@ -2389,8 +2384,22 @@ usb_test_quirk(const struct usb_attach_arg *uaa, uint16_t quirk) { uint8_t found; + uint8_t x; + if (quirk == UQ_NONE) + return (0); + + /* search the automatic per device quirks first */ + + for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) { + if (uaa->device->autoQuirk[x] == quirk) + return (1); + } + + /* search global quirk table, if any */ + found = (usb_test_quirk_p) (&uaa->info, quirk); + return (found); } @@ -2723,7 +2732,8 @@ uint8_t x; for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) { - if (udev->autoQuirk[x] == 0) { + if (udev->autoQuirk[x] == 0 || + udev->autoQuirk[x] == quirk) { udev->autoQuirk[x] = quirk; return (0); /* success */ } === sys/dev/usb/usb_dynamic.c ================================================================== --- sys/dev/usb/usb_dynamic.c (revision 225404) +++ sys/dev/usb/usb_dynamic.c (local) @@ -50,12 +50,12 @@ #include #include #include -#include /* function prototypes */ static usb_handle_req_t usb_temp_get_desc_w; static usb_temp_setup_by_index_t usb_temp_setup_by_index_w; static usb_temp_unsetup_t usb_temp_unsetup_w; +static usb_test_quirk_t usb_test_quirk_w; static usb_quirk_ioctl_t usb_quirk_ioctl_w; /* global variables */ @@ -72,19 +72,9 @@ return (USB_ERR_INVAL); } -uint8_t +static uint8_t usb_test_quirk_w(const struct usbd_lookup_info *info, uint16_t quirk) { - uint8_t x; - - if (quirk == UQ_NONE) - return (0); /* no match */ - - for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) { - if (info->autoQuirk[x] == quirk) - return (1); /* match */ - } - return (0); /* no match */ } === sys/dev/usb/usb_dynamic.h ================================================================== --- sys/dev/usb/usb_dynamic.h (revision 225404) +++ sys/dev/usb/usb_dynamic.h (local) @@ -57,6 +57,5 @@ void usb_temp_unload(void *); void usb_quirk_unload(void *); void usb_bus_unload(void *); -usb_test_quirk_t usb_test_quirk_w; #endif /* _USB_DYNAMIC_H_ */ === sys/dev/usb/usbdi.h ================================================================== --- sys/dev/usb/usbdi.h (revision 225404) +++ sys/dev/usb/usbdi.h (local) @@ -353,7 +353,6 @@ uint16_t idVendor; uint16_t idProduct; uint16_t bcdDevice; - uint16_t autoQuirk[USB_MAX_AUTO_QUIRK]; uint8_t bDeviceClass; uint8_t bDeviceSubClass; uint8_t bDeviceProtocol; === sys/sys/param.h ================================================================== --- sys/sys/param.h (revision 225404) +++ sys/sys/param.h (local) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 900043 /* Master, propagated to newvers */ +#define __FreeBSD_version 900044 /* Master, propagated to newvers */ #ifdef _KERNEL #define P_OSREL_SIGSEGV 700004 --Boundary-00=_Aj2aOn1c6cYTFr5-- From owner-svn-src-all@FreeBSD.ORG Sat Sep 10 14:28:17 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EF54D1065670; Sat, 10 Sep 2011 14:28:16 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 8EB2A8FC12; Sat, 10 Sep 2011 14:28:16 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id p8AESCUr060827 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 10 Sep 2011 17:28:12 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id p8AESCD9064768; Sat, 10 Sep 2011 17:28:12 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id p8AESCBL064767; Sat, 10 Sep 2011 17:28:12 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 10 Sep 2011 17:28:12 +0300 From: Kostik Belousov To: Hans Petter Selasky Message-ID: <20110910142812.GO17489@deviant.kiev.zoral.com.ua> References: <3406F3E2-56E6-47FF-8A60-10DD9F3B3D10@FreeBSD.org> <201109101540.16656.hselasky@c2i.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="hp0y2R9lOm5A3xbf" Content-Disposition: inline In-Reply-To: <201109101540.16656.hselasky@c2i.net> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: "src-committers@freebsd.org" , re@freebsd.org, "svn-src-stable@freebsd.org" , "svn-src-all@freebsd.org" , "Robert N. M. Watson" , "svn-src-stable-8@freebsd.org" Subject: Re: Request for patch approval (Re: svn commit: r225458 - in stable/8/sys: dev/usb dev/usb/quirk dev/usb/storage sys) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Sep 2011 14:28:17 -0000 --hp0y2R9lOm5A3xbf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Sep 10, 2011 at 03:40:16PM +0200, Hans Petter Selasky wrote: >=20 > > Right -- exactly my point. If this change breaks third-party compiled U= SB > > device drivers, then our current approach to device driver KBIs does not > > allow it to be MFC'd in this form. Are there ways you can reformulate t= he > > change to avoid breaking those drivers? Sometimes this can be done by > > adding new symbols, rather than replacing currently symbols, although > > mileage varies. >=20 > Hi, >=20 > Here is my proposal: >=20 > Implement test for automatic quirks in function which has access to the U= SB=20 > device structure. This decouples the structure change in "struct=20 > usbd_lookup_info". >=20 > The only structure which needs change is "struct usb_device". In 9-curren= t=20 > this structure will be kept as is. In 8-stable the new element will be mo= ved=20 > to the end of the structure like suggested, and then there shouldn't be a= ny=20 > problems. >=20 > Please find patches attached. >=20 > --HPS >=20 > Commit message: >=20 > Refactor auto-quirk solution so that we break as few external > drivers as possible. >=20 > PR: usb/160299 > Approved by: re (kib) > Suggested by: rwatson > MFC after: 0 days >=20 First, can you, please, regenerate the diff for stable/8 against the code before r225458 ? I want to read diff to see ABI change, assuming r225458 was not done at all. Second, you cannot decrement __FreeBSD_version. In fact, you shall increment it once more in the patch for stable/8. --hp0y2R9lOm5A3xbf Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAk5rc/sACgkQC3+MBN1Mb4jVFACgjL7UAnc6xBYTPg6siFESXQWR u1AAoOYptIt4IoKezFbzPJdrrOKgqfcm =jOV4 -----END PGP SIGNATURE----- --hp0y2R9lOm5A3xbf-- From owner-svn-src-all@FreeBSD.ORG Sat Sep 10 14:42:25 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C273C106566C; Sat, 10 Sep 2011 14:42:25 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe03.c2i.net [212.247.154.66]) by mx1.freebsd.org (Postfix) with ESMTP id EE9708FC12; Sat, 10 Sep 2011 14:42:23 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.1 cv=yVKV3zusvCapyMfYJBNW2j35FMEuTKq6vh/tt/1L5+g= c=1 sm=1 a=SvYTsOw2Z4kA:10 a=Ekku6H27AP4A:10 a=WQU8e4WWZSUA:10 a=CL8lFSKtTFcA:10 a=i9M/sDlu2rpZ9XS819oYzg==:17 a=QMWWIGcYDrvM78CjWykA:9 a=PUjeQqilurYA:10 a=rOWTAMzTc4FwWwihKJsA:9 a=e7wMW3arecuqJuRIhuMA:7 a=vKMc8lnkdStDIWEj:21 a=YLMQWj6e9IJUa7VA:21 a=i9M/sDlu2rpZ9XS819oYzg==:117 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe03.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 10087964; Sat, 10 Sep 2011 16:42:20 +0200 From: Hans Petter Selasky To: Kostik Belousov Date: Sat, 10 Sep 2011 16:39:37 +0200 User-Agent: KMail/1.13.5 (FreeBSD/8.2-STABLE; KDE/4.4.5; amd64; ; ) References: <201109101540.16656.hselasky@c2i.net> <20110910142812.GO17489@deviant.kiev.zoral.com.ua> In-Reply-To: <20110910142812.GO17489@deviant.kiev.zoral.com.ua> X-Face: *nPdTl_}RuAI6^PVpA02T?$%Xa^>@hE0uyUIoiha$pC:9TVgl.Oq, NwSZ4V"|LR.+tj}g5 %V,x^qOs~mnU3]Gn; cQLv&.N>TrxmSFf+p6(30a/{)KUU!s}w\IhQBj}[g}bj0I3^glmC( :AuzV9:.hESm-x4h240C`9=w MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_pa3aOWOl7VtjcsR" Message-Id: <201109101639.37581.hselasky@c2i.net> Cc: "src-committers@freebsd.org" , "re@freebsd.org" , "svn-src-stable@freebsd.org" , "svn-src-all@freebsd.org" , "Robert N. M. Watson" , "svn-src-stable-8@freebsd.org" Subject: Re: Request for patch approval (Re: svn commit: r225458 - in stable/8/sys: dev/usb dev/usb/quirk dev/usb/storage sys) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Sep 2011 14:42:25 -0000 --Boundary-00=_pa3aOWOl7VtjcsR Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit On Saturday 10 September 2011 16:28:12 Kostik Belousov wrote: > On Sat, Sep 10, 2011 at 03:40:16PM +0200, Hans Petter Selasky wrote: > > > Right -- exactly my point. If this change breaks third-party compiled > > > USB device drivers, then our current approach to device driver KBIs > > > does not allow it to be MFC'd in this form. Are there ways you can > > > reformulate the change to avoid breaking those drivers? Sometimes this > > > can be done by adding new symbols, rather than replacing currently > > > symbols, although mileage varies. > > > > Hi, > > > > Here is my proposal: > > > > Implement test for automatic quirks in function which has access to the > > USB device structure. This decouples the structure change in "struct > > usbd_lookup_info". > > > > The only structure which needs change is "struct usb_device". In > > 9-current this structure will be kept as is. In 8-stable the new element > > will be moved to the end of the structure like suggested, and then there > > shouldn't be any problems. > > > > Please find patches attached. > > > > --HPS > > > > Commit message: > > > > Refactor auto-quirk solution so that we break as few external > > drivers as possible. > > > > PR: usb/160299 > > Approved by: re (kib) > > Suggested by: rwatson > > MFC after: 0 days > > First, can you, please, regenerate the diff for stable/8 against the > code before r225458 ? I want to read diff to see ABI change, assuming > r225458 was not done at all. > > Second, you cannot decrement __FreeBSD_version. In fact, you shall > increment it once more in the patch for stable/8. Ok. Please find attached output from: svn diff -r 225457 sys/ --HPS --Boundary-00=_pa3aOWOl7VtjcsR Content-Type: text/plain; charset="iso-8859-15"; name="msc_auto_quirk_8_stable_against_r225457.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="msc_auto_quirk_8_stable_against_r225457.txt" Index: sys/dev/usb/usb_msctest.h =================================================================== --- sys/dev/usb/usb_msctest.h (revision 225457) +++ sys/dev/usb/usb_msctest.h (working copy) @@ -40,5 +40,7 @@ uint8_t iface_index); usb_error_t usb_msc_eject(struct usb_device *udev, uint8_t iface_index, int method); +usb_error_t usb_msc_auto_quirk(struct usb_device *udev, + uint8_t iface_index); #endif /* _USB_MSCTEST_H_ */ Index: sys/dev/usb/quirk/usb_quirk.c =================================================================== --- sys/dev/usb/quirk/usb_quirk.c (revision 225457) +++ sys/dev/usb/quirk/usb_quirk.c (working copy) @@ -148,12 +148,10 @@ UQ_MSC_FORCE_PROTO_SCSI), USB_QUIRK(AIPTEK, POCKETCAM3M, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI), - USB_QUIRK(AIPTEK2, SUNPLUS_TECH, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(ALCOR, SDCR_6335, 0x0000, 0xffff, UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(ALCOR, SDCR_6362, 0x0000, 0xffff, UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_SYNC_CACHE), - USB_QUIRK(ALCOR, AU6390, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(ALCOR, UMCR_9361, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_GETMAXLUN), USB_QUIRK(ALCOR, TRANSCEND, 0x0000, 0xffff, UQ_MSC_NO_GETMAXLUN, @@ -173,14 +171,12 @@ USB_QUIRK(CENTURY, EX35QUAT, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_FORCE_SHORT_INQ, UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE), - USB_QUIRK(CENTURY, EX35SW4_SB4, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(CYPRESS, XX6830XX, 0x0000, 0xffff, UQ_MSC_NO_GETMAXLUN, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(DESKNOTE, UCR_61S2B, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI), USB_QUIRK(DMI, CFSM_RW, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_GETMAXLUN), - USB_QUIRK(DMI, DISK, 0x000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(EPSON, STYLUS_875DC, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY), USB_QUIRK(EPSON, STYLUS_895, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, @@ -188,7 +184,6 @@ USB_QUIRK(FEIYA, 5IN1, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI), USB_QUIRK(FREECOM, DVD, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI), - USB_QUIRK(FREECOM, HDD, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(FUJIPHOTO, MASS0100, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI_I, UQ_MSC_FORCE_PROTO_ATAPI, UQ_MSC_NO_RS_CLEAR_UA, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(GENESYS, GL641USB2IDE, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, @@ -232,7 +227,6 @@ USB_QUIRK(IOMEGA, ZIP100, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_TEST_UNIT_READY), /* XXX ZIP drives can also use ATAPI */ - USB_QUIRK(JMICRON, JM20336, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(JMICRON, JM20337, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_SYNC_CACHE), @@ -279,8 +273,6 @@ UQ_MSC_FORCE_PROTO_ATAPI), USB_QUIRK(MYSON, HEDEN, 0x0000, 0xffff, UQ_MSC_IGNORE_RESIDUE, UQ_MSC_NO_SYNC_CACHE), - USB_QUIRK(MYSON, HEDEN_8813, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), - USB_QUIRK(MYSON, STARREADER, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(NEODIO, ND3260, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_FORCE_SHORT_INQ), USB_QUIRK(NETAC, CF_CARD, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, @@ -317,7 +309,6 @@ USB_QUIRK(PANASONIC, KXLCB35AN, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI), USB_QUIRK(PANASONIC, LS120CAM, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_UFI), - USB_QUIRK(PHILIPS, SPE3030CC, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(PLEXTOR, 40_12_40U, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_TEST_UNIT_READY), USB_QUIRK(PNY, ATTACHE2, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, @@ -328,7 +319,6 @@ USB_QUIRK_VP(USB_VENDOR_SAMSUNG_TECHWIN, USB_PRODUCT_SAMSUNG_TECHWIN_DIGIMAX_410, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY), - USB_QUIRK(SAMSUNG, YP_U4, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(SANDISK, SDDR05A, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_READ_CAP_OFFBY1, UQ_MSC_NO_GETMAXLUN), @@ -448,12 +438,6 @@ UQ_MSC_FORCE_PROTO_ATAPI), USB_QUIRK(MEIZU, M6_SL, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY, UQ_MSC_NO_SYNC_CACHE), - USB_QUIRK(ACTIONS, MP4, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, - UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_SYNC_CACHE), - USB_QUIRK(ASUS, GMSC, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), - USB_QUIRK(CHIPSBANK, USBMEMSTICK, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), - USB_QUIRK(CHIPSBANK, USBMEMSTICK1, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), - USB_QUIRK(NEWLINK, USB2IDEBRIDGE, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE), /* Non-standard USB MIDI devices */ USB_QUIRK(ROLAND, UM1, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), @@ -567,9 +551,9 @@ uint16_t x; uint16_t y; - if (quirk == UQ_NONE) { - return (0); - } + if (quirk == UQ_NONE) + goto done; + mtx_lock(&usb_quirk_mtx); for (x = 0; x != USB_DEV_QUIRKS_MAX; x++) { @@ -603,7 +587,8 @@ break; } mtx_unlock(&usb_quirk_mtx); - return (0); +done: + return (0); /* no quirk match */ } static struct usb_quirk_entry * Index: sys/dev/usb/usbdi.h =================================================================== --- sys/dev/usb/usbdi.h (revision 225457) +++ sys/dev/usb/usbdi.h (working copy) @@ -475,6 +475,8 @@ void usb_pause_mtx(struct mtx *mtx, int _ticks); usb_error_t usbd_set_pnpinfo(struct usb_device *udev, uint8_t iface_index, const char *pnpinfo); +usb_error_t usbd_add_dynamic_quirk(struct usb_device *udev, + uint16_t quirk); const struct usb_device_id *usbd_lookup_id_by_info( const struct usb_device_id *id, usb_size_t sizeof_id, Index: sys/dev/usb/storage/umass.c =================================================================== --- sys/dev/usb/storage/umass.c (revision 225457) +++ sys/dev/usb/storage/umass.c (working copy) @@ -1025,12 +1025,6 @@ sc->cam_scsi_sense.opcode = REQUEST_SENSE; sc->cam_scsi_test_unit_ready.opcode = TEST_UNIT_READY; - /* - * some devices need a delay after that the configuration value is - * set to function properly: - */ - usb_pause_mtx(NULL, hz); - /* register the SIM */ err = umass_cam_attach_sim(sc); if (err) { Index: sys/dev/usb/usb_freebsd.h =================================================================== --- sys/dev/usb/usb_freebsd.h (revision 225457) +++ sys/dev/usb/usb_freebsd.h (working copy) @@ -60,6 +60,8 @@ #define USB_EP0_BUFSIZE 1024 /* bytes */ #define USB_CS_RESET_LIMIT 20 /* failures = 20 * 50 ms = 1sec */ +#define USB_MAX_AUTO_QUIRK 4 /* maximum number of dynamic quirks */ + typedef uint32_t usb_timeout_t; /* milliseconds */ typedef uint32_t usb_frlength_t; /* bytes */ typedef uint32_t usb_frcount_t; /* units */ Index: sys/dev/usb/usb_device.c =================================================================== --- sys/dev/usb/usb_device.c (revision 225457) +++ sys/dev/usb/usb_device.c (working copy) @@ -1239,7 +1239,7 @@ usb_init_attach_arg(struct usb_device *udev, struct usb_attach_arg *uaa) { - bzero(uaa, sizeof(*uaa)); + memset(uaa, 0, sizeof(*uaa)); uaa->device = udev; uaa->usb_mode = udev->flags.usb_mode; @@ -1850,7 +1850,21 @@ } } } + if (set_config_failed == 0 && config_index == 0 && + usb_test_quirk(&uaa, UQ_MSC_NO_SYNC_CACHE) == 0) { + /* + * Try to figure out if there are any MSC quirks we + * should apply automatically: + */ + err = usb_msc_auto_quirk(udev, 0); + + if (err != 0) { + set_config_failed = 1; + goto repeat_set_config; + } + } + config_done: DPRINTF("new dev (addr %d), udev=%p, parent_hub=%p\n", udev->address, udev, udev->parent_hub); @@ -2370,8 +2384,22 @@ usb_test_quirk(const struct usb_attach_arg *uaa, uint16_t quirk) { uint8_t found; + uint8_t x; + if (quirk == UQ_NONE) + return (0); + + /* search the automatic per device quirks first */ + + for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) { + if (uaa->device->autoQuirk[x] == quirk) + return (1); + } + + /* search global quirk table, if any */ + found = (usb_test_quirk_p) (&uaa->info, quirk); + return (found); } @@ -2773,3 +2801,17 @@ return (0); /* success */ } +usb_error_t +usbd_add_dynamic_quirk(struct usb_device *udev, uint16_t quirk) +{ + uint8_t x; + + for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) { + if (udev->autoQuirk[x] == 0 || + udev->autoQuirk[x] == quirk) { + udev->autoQuirk[x] = quirk; + return (0); /* success */ + } + } + return (USB_ERR_NOMEM); +} Index: sys/dev/usb/usb_device.h =================================================================== --- sys/dev/usb/usb_device.h (revision 225457) +++ sys/dev/usb/usb_device.h (working copy) @@ -190,6 +190,8 @@ #endif uint32_t clear_stall_errors; /* number of clear-stall failures */ + + uint16_t autoQuirk[USB_MAX_AUTO_QUIRK]; /* dynamic quirks */ }; /* globals */ Index: sys/dev/usb/usb_msctest.c =================================================================== --- sys/dev/usb/usb_msctest.c (revision 225457) +++ sys/dev/usb/usb_msctest.c (working copy) @@ -1,6 +1,6 @@ /* $FreeBSD$ */ /*- - * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. + * Copyright (c) 2008,2011 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -84,7 +84,10 @@ DIR_NONE, }; +#define SCSI_MAX_LEN 0x100 #define SCSI_INQ_LEN 0x24 +#define SCSI_SENSE_LEN 0xFF + static uint8_t scsi_test_unit_ready[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; static uint8_t scsi_inquiry[] = { 0x12, 0x00, 0x00, 0x00, SCSI_INQ_LEN, 0x00 }; static uint8_t scsi_rezero_init[] = { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 }; @@ -97,6 +100,10 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; static uint8_t scsi_tct_eject[] = { 0x06, 0xf5, 0x04, 0x02, 0x52, 0x70 }; +static uint8_t scsi_sync_cache[] = { 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 }; +static uint8_t scsi_request_sense[] = { 0x03, 0x00, 0x00, 0x00, 0x12, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; #define BULK_SIZE 64 /* dummy */ #define ERR_CSW_FAILED -1 @@ -150,7 +157,7 @@ uint8_t status_try; int error; - uint8_t buffer[256]; + uint8_t buffer[SCSI_MAX_LEN] __aligned(4); }; static usb_callback_t bbb_command_callback; @@ -164,7 +171,7 @@ static void bbb_transfer_start(struct bbb_transfer *, uint8_t); static void bbb_data_clear_stall_callback(struct usb_xfer *, uint8_t, uint8_t); -static uint8_t bbb_command_start(struct bbb_transfer *, uint8_t, uint8_t, +static int bbb_command_start(struct bbb_transfer *, uint8_t, uint8_t, void *, size_t, void *, size_t, usb_timeout_t); static struct bbb_transfer *bbb_attach(struct usb_device *, uint8_t); static void bbb_detach(struct bbb_transfer *); @@ -455,7 +462,7 @@ * 0: Success * Else: Failure *------------------------------------------------------------------------*/ -static uint8_t +static int bbb_command_start(struct bbb_transfer *sc, uint8_t dir, uint8_t lun, void *data_ptr, size_t data_len, void *cmd_ptr, size_t cmd_len, usb_timeout_t data_timeout) @@ -567,9 +574,10 @@ usb_iface_is_cdrom(struct usb_device *udev, uint8_t iface_index) { struct bbb_transfer *sc; - usb_error_t err; - uint8_t timeout, is_cdrom; + uint8_t timeout; + uint8_t is_cdrom; uint8_t sid_type; + int err; sc = bbb_attach(udev, iface_index); if (sc == NULL) @@ -596,6 +604,114 @@ } usb_error_t +usb_msc_auto_quirk(struct usb_device *udev, uint8_t iface_index) +{ + struct bbb_transfer *sc; + uint8_t timeout; + uint8_t is_no_direct; + uint8_t sid_type; + int err; + + sc = bbb_attach(udev, iface_index); + if (sc == NULL) + return (0); + + /* + * Some devices need a delay after that the configuration + * value is set to function properly: + */ + usb_pause_mtx(NULL, hz); + + is_no_direct = 1; + for (timeout = 4; timeout; timeout--) { + err = bbb_command_start(sc, DIR_IN, 0, sc->buffer, + SCSI_INQ_LEN, &scsi_inquiry, sizeof(scsi_inquiry), + USB_MS_HZ); + + if (err == 0 && sc->actlen > 0) { + sid_type = sc->buffer[0] & 0x1F; + if (sid_type == 0x00) + is_no_direct = 0; + break; + } else if (err != ERR_CSW_FAILED) + break; /* non retryable error */ + usb_pause_mtx(NULL, hz); + } + + if (is_no_direct) { + DPRINTF("Device is not direct access.\n"); + goto done; + } + + err = bbb_command_start(sc, DIR_IN, 0, NULL, 0, + &scsi_test_unit_ready, sizeof(scsi_test_unit_ready), + USB_MS_HZ); + + if (err != 0) { + + if (err != ERR_CSW_FAILED) + goto error; + } + + err = bbb_command_start(sc, DIR_IN, 0, NULL, 0, + &scsi_sync_cache, sizeof(scsi_sync_cache), + USB_MS_HZ); + + if (err != 0) { + + if (err != ERR_CSW_FAILED) + goto error; + + DPRINTF("Device doesn't handle synchronize cache\n"); + + usbd_add_dynamic_quirk(udev, UQ_MSC_NO_SYNC_CACHE); + } + + /* clear sense status of any failed commands on the device */ + + err = bbb_command_start(sc, DIR_IN, 0, sc->buffer, + SCSI_INQ_LEN, &scsi_inquiry, sizeof(scsi_inquiry), + USB_MS_HZ); + + DPRINTF("Inquiry = %d\n", err); + + if (err != 0) { + + if (err != ERR_CSW_FAILED) + goto error; + } + + err = bbb_command_start(sc, DIR_IN, 0, sc->buffer, + SCSI_SENSE_LEN, &scsi_request_sense, + sizeof(scsi_request_sense), USB_MS_HZ); + + DPRINTF("Request sense = %d\n", err); + + if (err != 0) { + + if (err != ERR_CSW_FAILED) + goto error; + } + +done: + bbb_detach(sc); + return (0); + +error: + bbb_detach(sc); + + DPRINTF("Device did not respond, enabling all quirks\n"); + + usbd_add_dynamic_quirk(udev, UQ_MSC_NO_SYNC_CACHE); + usbd_add_dynamic_quirk(udev, UQ_MSC_NO_TEST_UNIT_READY); + + /* Need to re-enumerate the device */ + usbd_req_re_enumerate(udev, NULL); + + return (USB_ERR_STALLED); +} + +usb_error_t usb_msc_eject(struct usb_device *udev, uint8_t iface_index, int method) { struct bbb_transfer *sc; Property changes on: sys/contrib/pf ___________________________________________________________________ Modified: svn:mergeinfo Merged /head/sys/contrib/pf:r225350,225400 Property changes on: sys/contrib/dev/acpica ___________________________________________________________________ Modified: svn:mergeinfo Merged /head/sys/contrib/dev/acpica:r225350,225400 Property changes on: sys/cddl/contrib/opensolaris ___________________________________________________________________ Modified: svn:mergeinfo Merged /head/sys/cddl/contrib/opensolaris:r225350,225400 Property changes on: sys/amd64/include/xen ___________________________________________________________________ Modified: svn:mergeinfo Merged /head/sys/amd64/include/xen:r225350,225400 Index: sys/sys/param.h =================================================================== --- sys/sys/param.h (revision 225457) +++ sys/sys/param.h (working copy) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 802510 /* Master, propagated to newvers */ +#define __FreeBSD_version 802512 /* Master, propagated to newvers */ #ifdef _KERNEL #define P_OSREL_SIGSEGV 700004 Property changes on: sys ___________________________________________________________________ Modified: svn:mergeinfo Merged /head/sys:r225350,225400 --Boundary-00=_pa3aOWOl7VtjcsR-- From owner-svn-src-all@FreeBSD.ORG Sat Sep 10 15:33:11 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DFBEA106566B; Sat, 10 Sep 2011 15:33:10 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 7BB398FC0A; Sat, 10 Sep 2011 15:33:10 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id p8AFX60R067119 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 10 Sep 2011 18:33:06 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id p8AFX62Z067166; Sat, 10 Sep 2011 18:33:06 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id p8AFX63w067164; Sat, 10 Sep 2011 18:33:06 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 10 Sep 2011 18:33:06 +0300 From: Kostik Belousov To: Hans Petter Selasky Message-ID: <20110910153306.GP17489@deviant.kiev.zoral.com.ua> References: <201109101540.16656.hselasky@c2i.net> <20110910142812.GO17489@deviant.kiev.zoral.com.ua> <201109101639.37581.hselasky@c2i.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="j4NZwBEUS1+1fgbv" Content-Disposition: inline In-Reply-To: <201109101639.37581.hselasky@c2i.net> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: "src-committers@freebsd.org" , "re@freebsd.org" , "svn-src-stable@freebsd.org" , "svn-src-all@freebsd.org" , "Robert N. M. Watson" , "svn-src-stable-8@freebsd.org" Subject: Re: Request for patch approval (Re: svn commit: r225458 - in stable/8/sys: dev/usb dev/usb/quirk dev/usb/storage sys) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Sep 2011 15:33:11 -0000 --j4NZwBEUS1+1fgbv Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Sep 10, 2011 at 04:39:37PM +0200, Hans Petter Selasky wrote: > On Saturday 10 September 2011 16:28:12 Kostik Belousov wrote: > > On Sat, Sep 10, 2011 at 03:40:16PM +0200, Hans Petter Selasky wrote: > > > > Right -- exactly my point. If this change breaks third-party compil= ed > > > > USB device drivers, then our current approach to device driver KBIs > > > > does not allow it to be MFC'd in this form. Are there ways you can > > > > reformulate the change to avoid breaking those drivers? Sometimes t= his > > > > can be done by adding new symbols, rather than replacing currently > > > > symbols, although mileage varies. > > >=20 > > > Hi, > > >=20 > > > Here is my proposal: > > >=20 > > > Implement test for automatic quirks in function which has access to t= he > > > USB device structure. This decouples the structure change in "struct > > > usbd_lookup_info". > > >=20 > > > The only structure which needs change is "struct usb_device". In > > > 9-current this structure will be kept as is. In 8-stable the new elem= ent > > > will be moved to the end of the structure like suggested, and then th= ere > > > shouldn't be any problems. > > >=20 > > > Please find patches attached. > > >=20 > > > --HPS > > >=20 > > > Commit message: > > >=20 > > > Refactor auto-quirk solution so that we break as few external > > > drivers as possible. > > >=20 > > > PR: usb/160299 > > > Approved by: re (kib) > > > Suggested by: rwatson > > > MFC after: 0 days > >=20 > > First, can you, please, regenerate the diff for stable/8 against the > > code before r225458 ? I want to read diff to see ABI change, assuming > > r225458 was not done at all. > >=20 > > Second, you cannot decrement __FreeBSD_version. In fact, you shall > > increment it once more in the patch for stable/8. >=20 > Ok. >=20 > Please find attached output from: >=20 > svn diff -r 225457 sys/ For me, it looks fine. Thank you. --j4NZwBEUS1+1fgbv Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAk5rgzIACgkQC3+MBN1Mb4i5zgCgh9IPhqLP+C5z2t38F9mG18u+ FFYAn3y+HEP1C3MSduZ6Us4fz3H1hhV6 =u5W0 -----END PGP SIGNATURE----- --j4NZwBEUS1+1fgbv-- From owner-svn-src-all@FreeBSD.ORG Sat Sep 10 15:55:37 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 72C1C106566C; Sat, 10 Sep 2011 15:55:37 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 624BA8FC08; Sat, 10 Sep 2011 15:55:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8AFtbZb098297; Sat, 10 Sep 2011 15:55:37 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8AFtavQ098290; Sat, 10 Sep 2011 15:55:36 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201109101555.p8AFtavQ098290@svn.freebsd.org> From: Hans Petter Selasky Date: Sat, 10 Sep 2011 15:55:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225469 - in head/sys: dev/usb dev/usb/quirk sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Sep 2011 15:55:37 -0000 Author: hselasky Date: Sat Sep 10 15:55:36 2011 New Revision: 225469 URL: http://svn.freebsd.org/changeset/base/225469 Log: Refactor auto-quirk solution so that we break as few external drivers as possible. PR: usb/160299 Approved by: re (kib) Suggested by: rwatson MFC after: 0 days Modified: head/sys/dev/usb/quirk/usb_quirk.c head/sys/dev/usb/usb_device.c head/sys/dev/usb/usb_dynamic.c head/sys/dev/usb/usb_dynamic.h head/sys/dev/usb/usbdi.h head/sys/sys/param.h Modified: head/sys/dev/usb/quirk/usb_quirk.c ============================================================================== --- head/sys/dev/usb/quirk/usb_quirk.c Sat Sep 10 12:36:11 2011 (r225468) +++ head/sys/dev/usb/quirk/usb_quirk.c Sat Sep 10 15:55:36 2011 (r225469) @@ -588,7 +588,7 @@ usb_test_quirk_by_info(const struct usbd } mtx_unlock(&usb_quirk_mtx); done: - return (usb_test_quirk_w(info, quirk)); + return (0); /* no quirk match */ } static struct usb_quirk_entry * Modified: head/sys/dev/usb/usb_device.c ============================================================================== --- head/sys/dev/usb/usb_device.c Sat Sep 10 12:36:11 2011 (r225468) +++ head/sys/dev/usb/usb_device.c Sat Sep 10 15:55:36 2011 (r225469) @@ -1239,8 +1239,6 @@ static void usb_init_attach_arg(struct usb_device *udev, struct usb_attach_arg *uaa) { - uint8_t x; - memset(uaa, 0, sizeof(*uaa)); uaa->device = udev; @@ -1256,9 +1254,6 @@ usb_init_attach_arg(struct usb_device *u uaa->info.bDeviceProtocol = udev->ddesc.bDeviceProtocol; uaa->info.bConfigIndex = udev->curr_config_index; uaa->info.bConfigNum = udev->curr_config_no; - - for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) - uaa->info.autoQuirk[x] = udev->autoQuirk[x]; } /*------------------------------------------------------------------------* @@ -2389,8 +2384,22 @@ uint8_t usb_test_quirk(const struct usb_attach_arg *uaa, uint16_t quirk) { uint8_t found; + uint8_t x; + + if (quirk == UQ_NONE) + return (0); + + /* search the automatic per device quirks first */ + + for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) { + if (uaa->device->autoQuirk[x] == quirk) + return (1); + } + + /* search global quirk table, if any */ found = (usb_test_quirk_p) (&uaa->info, quirk); + return (found); } @@ -2723,7 +2732,8 @@ usbd_add_dynamic_quirk(struct usb_device uint8_t x; for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) { - if (udev->autoQuirk[x] == 0) { + if (udev->autoQuirk[x] == 0 || + udev->autoQuirk[x] == quirk) { udev->autoQuirk[x] = quirk; return (0); /* success */ } Modified: head/sys/dev/usb/usb_dynamic.c ============================================================================== --- head/sys/dev/usb/usb_dynamic.c Sat Sep 10 12:36:11 2011 (r225468) +++ head/sys/dev/usb/usb_dynamic.c Sat Sep 10 15:55:36 2011 (r225469) @@ -50,12 +50,12 @@ #include #include #include -#include /* function prototypes */ static usb_handle_req_t usb_temp_get_desc_w; static usb_temp_setup_by_index_t usb_temp_setup_by_index_w; static usb_temp_unsetup_t usb_temp_unsetup_w; +static usb_test_quirk_t usb_test_quirk_w; static usb_quirk_ioctl_t usb_quirk_ioctl_w; /* global variables */ @@ -72,19 +72,9 @@ usb_temp_setup_by_index_w(struct usb_dev return (USB_ERR_INVAL); } -uint8_t +static uint8_t usb_test_quirk_w(const struct usbd_lookup_info *info, uint16_t quirk) { - uint8_t x; - - if (quirk == UQ_NONE) - return (0); /* no match */ - - for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) { - if (info->autoQuirk[x] == quirk) - return (1); /* match */ - } - return (0); /* no match */ } Modified: head/sys/dev/usb/usb_dynamic.h ============================================================================== --- head/sys/dev/usb/usb_dynamic.h Sat Sep 10 12:36:11 2011 (r225468) +++ head/sys/dev/usb/usb_dynamic.h Sat Sep 10 15:55:36 2011 (r225469) @@ -57,6 +57,5 @@ extern devclass_t usb_devclass_ptr; void usb_temp_unload(void *); void usb_quirk_unload(void *); void usb_bus_unload(void *); -usb_test_quirk_t usb_test_quirk_w; #endif /* _USB_DYNAMIC_H_ */ Modified: head/sys/dev/usb/usbdi.h ============================================================================== --- head/sys/dev/usb/usbdi.h Sat Sep 10 12:36:11 2011 (r225468) +++ head/sys/dev/usb/usbdi.h Sat Sep 10 15:55:36 2011 (r225469) @@ -353,7 +353,6 @@ struct usbd_lookup_info { uint16_t idVendor; uint16_t idProduct; uint16_t bcdDevice; - uint16_t autoQuirk[USB_MAX_AUTO_QUIRK]; uint8_t bDeviceClass; uint8_t bDeviceSubClass; uint8_t bDeviceProtocol; Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Sat Sep 10 12:36:11 2011 (r225468) +++ head/sys/sys/param.h Sat Sep 10 15:55:36 2011 (r225469) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 900043 /* Master, propagated to newvers */ +#define __FreeBSD_version 900044 /* Master, propagated to newvers */ #ifdef _KERNEL #define P_OSREL_SIGSEGV 700004 From owner-svn-src-all@FreeBSD.ORG Sat Sep 10 16:52:16 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 38E4B106566C; Sat, 10 Sep 2011 16:52:16 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2802E8FC08; Sat, 10 Sep 2011 16:52:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8AGqGqn001361; Sat, 10 Sep 2011 16:52:16 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8AGqF6u001353; Sat, 10 Sep 2011 16:52:15 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201109101652.p8AGqF6u001353@svn.freebsd.org> From: Hans Petter Selasky Date: Sat, 10 Sep 2011 16:52:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225470 - in stable/8/sys: dev/usb dev/usb/quirk sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Sep 2011 16:52:16 -0000 Author: hselasky Date: Sat Sep 10 16:52:15 2011 New Revision: 225470 URL: http://svn.freebsd.org/changeset/base/225470 Log: MFC r225469: Refactor auto-quirk solution so that we break as few external drivers as possible. PR: usb/160299 Suggested by: rwatson Modified: stable/8/sys/dev/usb/quirk/usb_quirk.c stable/8/sys/dev/usb/usb_device.c stable/8/sys/dev/usb/usb_device.h stable/8/sys/dev/usb/usb_dynamic.c stable/8/sys/dev/usb/usb_dynamic.h stable/8/sys/dev/usb/usbdi.h stable/8/sys/sys/param.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/usb/quirk/usb_quirk.c ============================================================================== --- stable/8/sys/dev/usb/quirk/usb_quirk.c Sat Sep 10 15:55:36 2011 (r225469) +++ stable/8/sys/dev/usb/quirk/usb_quirk.c Sat Sep 10 16:52:15 2011 (r225470) @@ -588,7 +588,7 @@ usb_test_quirk_by_info(const struct usbd } mtx_unlock(&usb_quirk_mtx); done: - return (usb_test_quirk_w(info, quirk)); + return (0); /* no quirk match */ } static struct usb_quirk_entry * Modified: stable/8/sys/dev/usb/usb_device.c ============================================================================== --- stable/8/sys/dev/usb/usb_device.c Sat Sep 10 15:55:36 2011 (r225469) +++ stable/8/sys/dev/usb/usb_device.c Sat Sep 10 16:52:15 2011 (r225470) @@ -1239,8 +1239,6 @@ static void usb_init_attach_arg(struct usb_device *udev, struct usb_attach_arg *uaa) { - uint8_t x; - memset(uaa, 0, sizeof(*uaa)); uaa->device = udev; @@ -1256,9 +1254,6 @@ usb_init_attach_arg(struct usb_device *u uaa->info.bDeviceProtocol = udev->ddesc.bDeviceProtocol; uaa->info.bConfigIndex = udev->curr_config_index; uaa->info.bConfigNum = udev->curr_config_no; - - for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) - uaa->info.autoQuirk[x] = udev->autoQuirk[x]; } /*------------------------------------------------------------------------* @@ -2389,8 +2384,22 @@ uint8_t usb_test_quirk(const struct usb_attach_arg *uaa, uint16_t quirk) { uint8_t found; + uint8_t x; + + if (quirk == UQ_NONE) + return (0); + + /* search the automatic per device quirks first */ + + for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) { + if (uaa->device->autoQuirk[x] == quirk) + return (1); + } + + /* search global quirk table, if any */ found = (usb_test_quirk_p) (&uaa->info, quirk); + return (found); } @@ -2798,7 +2807,8 @@ usbd_add_dynamic_quirk(struct usb_device uint8_t x; for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) { - if (udev->autoQuirk[x] == 0) { + if (udev->autoQuirk[x] == 0 || + udev->autoQuirk[x] == quirk) { udev->autoQuirk[x] = quirk; return (0); /* success */ } Modified: stable/8/sys/dev/usb/usb_device.h ============================================================================== --- stable/8/sys/dev/usb/usb_device.h Sat Sep 10 15:55:36 2011 (r225469) +++ stable/8/sys/dev/usb/usb_device.h Sat Sep 10 16:52:15 2011 (r225470) @@ -149,7 +149,6 @@ struct usb_device { uint16_t power; /* mA the device uses */ uint16_t langid; /* language for strings */ - uint16_t autoQuirk[USB_MAX_AUTO_QUIRK]; /* dynamic quirks */ uint8_t address; /* device addess */ uint8_t device_index; /* device index in "bus->devices" */ @@ -191,6 +190,8 @@ struct usb_device { #endif uint32_t clear_stall_errors; /* number of clear-stall failures */ + + uint16_t autoQuirk[USB_MAX_AUTO_QUIRK]; /* dynamic quirks */ }; /* globals */ Modified: stable/8/sys/dev/usb/usb_dynamic.c ============================================================================== --- stable/8/sys/dev/usb/usb_dynamic.c Sat Sep 10 15:55:36 2011 (r225469) +++ stable/8/sys/dev/usb/usb_dynamic.c Sat Sep 10 16:52:15 2011 (r225470) @@ -50,12 +50,12 @@ #include #include #include -#include /* function prototypes */ static usb_handle_req_t usb_temp_get_desc_w; static usb_temp_setup_by_index_t usb_temp_setup_by_index_w; static usb_temp_unsetup_t usb_temp_unsetup_w; +static usb_test_quirk_t usb_test_quirk_w; static usb_quirk_ioctl_t usb_quirk_ioctl_w; /* global variables */ @@ -72,19 +72,9 @@ usb_temp_setup_by_index_w(struct usb_dev return (USB_ERR_INVAL); } -uint8_t +static uint8_t usb_test_quirk_w(const struct usbd_lookup_info *info, uint16_t quirk) { - uint8_t x; - - if (quirk == UQ_NONE) - return (0); /* no match */ - - for (x = 0; x != USB_MAX_AUTO_QUIRK; x++) { - if (info->autoQuirk[x] == quirk) - return (1); /* match */ - } - return (0); /* no match */ } Modified: stable/8/sys/dev/usb/usb_dynamic.h ============================================================================== --- stable/8/sys/dev/usb/usb_dynamic.h Sat Sep 10 15:55:36 2011 (r225469) +++ stable/8/sys/dev/usb/usb_dynamic.h Sat Sep 10 16:52:15 2011 (r225470) @@ -57,6 +57,5 @@ extern devclass_t usb_devclass_ptr; void usb_temp_unload(void *); void usb_quirk_unload(void *); void usb_bus_unload(void *); -usb_test_quirk_t usb_test_quirk_w; #endif /* _USB_DYNAMIC_H_ */ Modified: stable/8/sys/dev/usb/usbdi.h ============================================================================== --- stable/8/sys/dev/usb/usbdi.h Sat Sep 10 15:55:36 2011 (r225469) +++ stable/8/sys/dev/usb/usbdi.h Sat Sep 10 16:52:15 2011 (r225470) @@ -353,7 +353,6 @@ struct usbd_lookup_info { uint16_t idVendor; uint16_t idProduct; uint16_t bcdDevice; - uint16_t autoQuirk[USB_MAX_AUTO_QUIRK]; uint8_t bDeviceClass; uint8_t bDeviceSubClass; uint8_t bDeviceProtocol; Modified: stable/8/sys/sys/param.h ============================================================================== --- stable/8/sys/sys/param.h Sat Sep 10 15:55:36 2011 (r225469) +++ stable/8/sys/sys/param.h Sat Sep 10 16:52:15 2011 (r225470) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 802511 /* Master, propagated to newvers */ +#define __FreeBSD_version 802512 /* Master, propagated to newvers */ #ifdef _KERNEL #define P_OSREL_SIGSEGV 700004 From owner-svn-src-all@FreeBSD.ORG Sat Sep 10 16:56:38 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A439C106566C; Sat, 10 Sep 2011 16:56:38 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 877128FC14; Sat, 10 Sep 2011 16:56:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8AGucKl001635; Sat, 10 Sep 2011 16:56:38 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8AGuckS001633; Sat, 10 Sep 2011 16:56:38 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201109101656.p8AGuckS001633@svn.freebsd.org> From: Hans Petter Selasky Date: Sat, 10 Sep 2011 16:56:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225471 - stable/8/sys/dev/sound/usb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Sep 2011 16:56:38 -0000 Author: hselasky Date: Sat Sep 10 16:56:38 2011 New Revision: 225471 URL: http://svn.freebsd.org/changeset/base/225471 Log: MFC r225414: Fix precedence warning when compiling kernel with clang. Modified: stable/8/sys/dev/sound/usb/uaudio.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/sound/usb/uaudio.c ============================================================================== --- stable/8/sys/dev/sound/usb/uaudio.c Sat Sep 10 16:52:15 2011 (r225470) +++ stable/8/sys/dev/sound/usb/uaudio.c Sat Sep 10 16:56:38 2011 (r225471) @@ -927,8 +927,8 @@ uaudio_chan_fill_info_sub(struct uaudio_ continue; } if (asf1d->bLength < (sizeof(*asf1d) + - (asf1d->bSamFreqType == 0) ? 6 : - (asf1d->bSamFreqType * 3))) { + ((asf1d->bSamFreqType == 0) ? 6 : + (asf1d->bSamFreqType * 3)))) { DPRINTFN(11, "'asf1d' descriptor is too short\n"); asf1d = NULL; continue;