From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 00:23:32 2012 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 654D21065672; Sun, 1 Jan 2012 00:23:32 +0000 (UTC) (envelope-from jgh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 53BCE8FC1A; Sun, 1 Jan 2012 00:23: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 q010NWgf089493; Sun, 1 Jan 2012 00:23:32 GMT (envelope-from jgh@svn.freebsd.org) Received: (from jgh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q010NWRk089491; Sun, 1 Jan 2012 00:23:32 GMT (envelope-from jgh@svn.freebsd.org) Message-Id: <201201010023.q010NWRk089491@svn.freebsd.org> From: Jason Helfman Date: Sun, 1 Jan 2012 00:23: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: r229164 - head/usr.bin/calendar/calendars 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, 01 Jan 2012 00:23:32 -0000 Author: jgh (ports committer) Date: Sun Jan 1 00:23:32 2012 New Revision: 229164 URL: http://svn.freebsd.org/changeset/base/229164 Log: - add myself to the calendar (jgh) Approved by: crees (mentor) Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Sat Dec 31 23:56:58 2011 (r229163) +++ head/usr.bin/calendar/calendars/calendar.freebsd Sun Jan 1 00:23:32 2012 (r229164) @@ -48,6 +48,7 @@ 02/02 Michael W Lucas born in Detroit, Michigan, United States, 1967 02/02 Dmitry Chagin born in Stalingrad, USSR, 1976 02/02 Yoichi Nakayama born in Tsu, Mie, Japan, 1976 +02/03 Jason Helfman born in Royal Oak, Michigan, United States, 1972 02/04 Eitan Adler born in West Hempstead, New York, United States, 1991 02/05 Frank Laszlo born in Howell, Michigan, United States, 1983 02/10 David Greenman born in Portland, Oregon, United States, 1968 From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 00:32:46 2012 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 00F20106564A; Sun, 1 Jan 2012 00:32:46 +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 82BFD8FC08; Sun, 1 Jan 2012 00:32:45 +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 3EC9C25D389F; Sun, 1 Jan 2012 00:32:44 +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 67D7DBD73A8; Sun, 1 Jan 2012 00:32:43 +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 QY3RWLnjXIGf; Sun, 1 Jan 2012 00:32:41 +0000 (UTC) Received: from orange-en1.sbone.de (orange-en1.sbone.de [IPv6:fde9:577b:c1a9:31:cabc:c8ff:fecf:e8e3]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id A8DA7BD73A6; Sun, 1 Jan 2012 00:32:41 +0000 (UTC) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: "Bjoern A. Zeeb" In-Reply-To: <20111231164830.GI90831@alchemy.franken.de> Date: Sun, 1 Jan 2012 00:32:41 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <96FE9A64-A995-42F6-9F71-7B20F5CF5F1D@lists.zabbadoz.net> References: <201112302122.pBULMAuS031216@svn.freebsd.org> <20111231155931.GH90831@alchemy.franken.de> <20111231164830.GI90831@alchemy.franken.de> To: Marius Strobl 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: r229032 - head/sys/modules/cfi 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, 01 Jan 2012 00:32:46 -0000 On 31. Dec 2011, at 16:48 , Marius Strobl wrote: > On Sat, Dec 31, 2011 at 04:26:04PM +0000, Bjoern A. Zeeb wrote: >>=20 >> On 31. Dec 2011, at 15:59 , Marius Strobl wrote: >>=20 >>> On Sat, Dec 31, 2011 at 02:05:40PM +0000, Bjoern A. Zeeb wrote: >>>>=20 >>>> On 30. Dec 2011, at 21:22 , Marius Strobl wrote: >>>>=20 >>>>> Author: marius >>>>> Date: Fri Dec 30 21:22:10 2011 >>>>> New Revision: 229032 >>>>> URL: http://svn.freebsd.org/changeset/base/229032 >>>>>=20 >>>>> Log: >>>>> Add header required by cfi_bus_fdt.c. >>>>>=20 >>>>> Modified: >>>>> head/sys/modules/cfi/Makefile >>>>>=20 >>>>=20 >>>> This (most likely) broke at least the arm KB920X config: >>>>=20 >>>> In file included from @/arm/xscale/ixp425/ixp425var.h:47, >>>> from = /scratch/tmp/bz/head.universe/sys/modules/cfi/../../dev/cfi/cfi_bus_ixp4xx= .c:45: >>>> @/dev/pci/pcivar.h:219:20: error: pci_if.h: No such file or = directory >>>> mkdep: compile failed >>>>=20 >>>=20 >>> It didn't, the original r228981 just reveals a problem with = ixp425var.h. >>> The funny thing is that while it's pretty much clear from your above >>> snippet what's going on I can't reproduce this, also not part of an >>> universe build and apparently also not the tinderbox. >>=20 >> The tinderbox does not build it if you look at the details;-) >=20 > I was referring to the absence of any new breakage report by the > tinderbox after r229032, which IMO should have occurred by now. Oh, it's been arm not mips; yeah it should have built that and failed. Not sure why not. make universe is happy now at least as well. Thanks a lot! --=20 Bjoern A. Zeeb You have to have visions! It does not matter how good you are. It matters what good you do! From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 01:08:52 2012 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 014AB106566C; Sun, 1 Jan 2012 01:08:52 +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 E43F98FC08; Sun, 1 Jan 2012 01:08:51 +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 q0118pwC090838; Sun, 1 Jan 2012 01:08:51 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0118pCt090836; Sun, 1 Jan 2012 01:08:51 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201201010108.q0118pCt090836@svn.freebsd.org> From: Adrian Chadd Date: Sun, 1 Jan 2012 01:08:51 +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: r229165 - head/sys/dev/ath 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, 01 Jan 2012 01:08:52 -0000 Author: adrian Date: Sun Jan 1 01:08:51 2012 New Revision: 229165 URL: http://svn.freebsd.org/changeset/base/229165 Log: If frames are dumped out of the queue, let's at least see what they are. This shows that the majority of the weird traffic I see here are probe frames that haven't been sent out, but I can also trigger this condition by doing ICMP w/ -i 0.3 - enough to trigger the TX during actual scanning, but not fast enough to stop scanning from occuring. PR: kern/163689 Modified: head/sys/dev/ath/if_ath_tx.c Modified: head/sys/dev/ath/if_ath_tx.c ============================================================================== --- head/sys/dev/ath/if_ath_tx.c Sun Jan 1 00:23:32 2012 (r229164) +++ head/sys/dev/ath/if_ath_tx.c Sun Jan 1 01:08:51 2012 (r229165) @@ -2405,6 +2405,12 @@ ath_tx_tid_drain(struct ath_softc *sc, s tid->hwq_depth, tid->incomp, tid->baw_head, tid->baw_tail, tap == NULL ? -1 : tap->txa_start, ni->ni_txseqs[tid->tid]); + + /* XXX Dump the frame, see what it is? */ + ieee80211_dump_pkt(ni->ni_ic, + mtod(bf->bf_m, const uint8_t *), + bf->bf_m->m_len, 0, -1); + t = 1; } From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 02:04:43 2012 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 80274106564A; Sun, 1 Jan 2012 02:04:43 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (ZIM.MIT.EDU [18.95.3.101]) by mx1.freebsd.org (Postfix) with ESMTP id 430708FC13; Sun, 1 Jan 2012 02:04:43 +0000 (UTC) Received: from zim.MIT.EDU (localhost [127.0.0.1]) by zim.MIT.EDU (8.14.5/8.14.2) with ESMTP id q0124gxl094656; Sat, 31 Dec 2011 21:04:42 -0500 (EST) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by zim.MIT.EDU (8.14.5/8.14.2/Submit) id q0124g0R094655; Sat, 31 Dec 2011 21:04:42 -0500 (EST) (envelope-from das@FreeBSD.ORG) Date: Sat, 31 Dec 2011 21:04:42 -0500 From: David Schultz To: Dimitry Andric Message-ID: <20120101020442.GA94452@zim.MIT.EDU> Mail-Followup-To: Dimitry Andric , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201112221503.pBMF3m0w021930@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201112221503.pBMF3m0w021930@svn.freebsd.org> Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG Subject: Re: svn commit: r228801 - 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: Sun, 01 Jan 2012 02:04:43 -0000 On Thu, Dec 22, 2011, Dimitry Andric wrote: > Remove -mfancy-math from LIB32CPUFLAGS for amd64. It has been default > for our gcc since more than three years (see r181534, which is also in > stable/9 and stable/8). This flag used to be for the benefit of the old > in-kernel math emulator, which was removed more than eight years ago. Quite the opposite, actually. gcc/freebsd used to be hard-coded to use -mno-fancy-math-387 by default, which was really only appropriate for FPUless x86 chips back when FreeBSD supported them. The makefile setting overrides the old gcc default. The flag isn't "for the benefit of the in-kernel math emulator"; it's actually to reap the benefits of *not* having an in-kernel math emulator! Do you know if clang has the correct default here, or if it picked up trunk gcc's bogus default? It doesn't seem to support the flag to change the behavior, and it seems to default to -mno-fancy-math-387. (The flag should only affect things when -ffast-math is also specified.) From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 02:54:25 2012 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 D5A9B106566C; Sun, 1 Jan 2012 02:54:25 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (ZIM.MIT.EDU [18.95.3.101]) by mx1.freebsd.org (Postfix) with ESMTP id 958498FC0A; Sun, 1 Jan 2012 02:54:25 +0000 (UTC) Received: from zim.MIT.EDU (localhost [127.0.0.1]) by zim.MIT.EDU (8.14.5/8.14.2) with ESMTP id q012sMAl094870; Sat, 31 Dec 2011 21:54:22 -0500 (EST) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by zim.MIT.EDU (8.14.5/8.14.2/Submit) id q012sMuP094869; Sat, 31 Dec 2011 21:54:22 -0500 (EST) (envelope-from das@FreeBSD.ORG) Date: Sat, 31 Dec 2011 21:54:22 -0500 From: David Schultz To: Ed Schouten Message-ID: <20120101025422.GD94452@zim.MIT.EDU> Mail-Followup-To: Ed Schouten , Steve Kargl , Andreas Tobler , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201112291441.pBTEfI8l060127@svn.freebsd.org> <4EFCA6A6.6080103@FreeBSD.org> <20111229183213.GK1895@hoeg.nl> <20111229184934.GA47885@troutmask.apl.washington.edu> <20111229192359.GM1895@hoeg.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20111229192359.GM1895@hoeg.nl> Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG, Andreas Tobler , Steve Kargl Subject: Re: svn commit: r228955 - head/include 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, 01 Jan 2012 02:54:25 -0000 On Thu, Dec 29, 2011, Ed Schouten wrote: > Hi Steve, > > * Steve Kargl , 20111229 19:49: > > Are you going to submit a bug report to GCC? Because, as of now, > > you've broken my ability to do development work on bleeding edge > > freebsd and bleeding edge gcc. > > Here you go: > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51705 > > In the future, could you write such bug reports yourself? I am really > not that interested in GCC's development process. I'm out of town and don't remember the details of this, but is there a reason we couldn't simply have an appropriate #ifdef that uses __attribute((__noreturn__)) instead of [[noreturn]]? We have plenty of ifdefs in the tree already to work around deficiencies in various compilers. Saying "it's the compiler's fault and we're not going to work around it" is a significant departure from historical precedent, and it punishes the wrong people. Easier than arguing with the GNU folks about fixing it, too... From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 03:34:16 2012 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 466C0106564A; Sun, 1 Jan 2012 03:34:16 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.95.76.21]) by mx1.freebsd.org (Postfix) with ESMTP id 03C2D8FC13; Sun, 1 Jan 2012 03:34:15 +0000 (UTC) Received: from troutmask.apl.washington.edu (localhost.apl.washington.edu [127.0.0.1]) by troutmask.apl.washington.edu (8.14.5/8.14.5) with ESMTP id q013YCkI062798; Sat, 31 Dec 2011 19:34:12 -0800 (PST) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.14.5/8.14.5/Submit) id q013YCcN062797; Sat, 31 Dec 2011 19:34:12 -0800 (PST) (envelope-from sgk) Date: Sat, 31 Dec 2011 19:34:12 -0800 From: Steve Kargl To: Ed Schouten , Andreas Tobler , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <20120101033412.GB62729@troutmask.apl.washington.edu> References: <201112291441.pBTEfI8l060127@svn.freebsd.org> <4EFCA6A6.6080103@FreeBSD.org> <20111229183213.GK1895@hoeg.nl> <20111229184934.GA47885@troutmask.apl.washington.edu> <20111229192359.GM1895@hoeg.nl> <20120101025422.GD94452@zim.MIT.EDU> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120101025422.GD94452@zim.MIT.EDU> User-Agent: Mutt/1.4.2.3i Cc: Subject: Re: svn commit: r228955 - head/include 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, 01 Jan 2012 03:34:16 -0000 On Sat, Dec 31, 2011 at 09:54:22PM -0500, David Schultz wrote: > On Thu, Dec 29, 2011, Ed Schouten wrote: > > Hi Steve, > > > > * Steve Kargl , 20111229 19:49: > > > Are you going to submit a bug report to GCC? Because, as of now, > > > you've broken my ability to do development work on bleeding edge > > > freebsd and bleeding edge gcc. > > > > Here you go: > > > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51705 > > > > In the future, could you write such bug reports yourself? I am really > > not that interested in GCC's development process. > > I'm out of town and don't remember the details of this, but is there a > reason we couldn't simply have an appropriate #ifdef that uses > __attribute((__noreturn__)) instead of [[noreturn]]? We have plenty > of ifdefs in the tree already to work around deficiencies in various > compilers. Saying "it's the compiler's fault and we're not going to > work around it" is a significant departure from historical precedent, > and it punishes the wrong people. Easier than arguing with the GNU > folks about fixing it, too... I've already sent a patch to GCC to work around the problem. FreeBSD is still considered to be a primary platform for GCC, so problem is a P1 issue in bugzilla. Unfortunately, I think that there are no active FreeBSD gcc maintainer. This means the patch may linger in bugzilla for awhile. -- Steve From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 09:12:22 2012 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 B5C09106564A; Sun, 1 Jan 2012 09:12:22 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A37FA8FC08; Sun, 1 Jan 2012 09:12: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 q019CMj2005792; Sun, 1 Jan 2012 09:12:22 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q019CM1Z005789; Sun, 1 Jan 2012 09:12:22 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201201010912.q019CM1Z005789@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Sun, 1 Jan 2012 09:12:22 +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: r229168 - head/sys/mips/cavium/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: Sun, 01 Jan 2012 09:12:22 -0000 Author: gonzo Date: Sun Jan 1 09:12:21 2012 New Revision: 229168 URL: http://svn.freebsd.org/changeset/base/229168 Log: - Properly set IRQ handlers for all USB ports Modified: head/sys/mips/cavium/usb/octusb.h head/sys/mips/cavium/usb/octusb_octeon.c Modified: head/sys/mips/cavium/usb/octusb.h ============================================================================== --- head/sys/mips/cavium/usb/octusb.h Sun Jan 1 03:38:36 2012 (r229167) +++ head/sys/mips/cavium/usb/octusb.h Sun Jan 1 09:12:21 2012 (r229168) @@ -29,14 +29,7 @@ #define _OCTUSB_H_ #define OCTUSB_MAX_DEVICES MIN(USB_MAX_DEVICES, 64) -/* - * The second port is on a different IRQ and so we disable it for now. - */ -#if 1 -#define OCTUSB_MAX_PORTS 1 /* hardcoded */ -#else #define OCTUSB_MAX_PORTS 2 /* hardcoded */ -#endif #define OCTUSB_MAX_FIXUP 4096 /* bytes */ #define OCTUSB_INTR_ENDPT 0x01 @@ -121,8 +114,8 @@ struct octusb_softc { struct usb_device *sc_devices[OCTUSB_MAX_DEVICES]; - struct resource *sc_irq_res; - void *sc_intr_hdl; + struct resource *sc_irq_res[OCTUSB_MAX_PORTS]; + void *sc_intr_hdl[OCTUSB_MAX_PORTS]; struct octusb_port sc_port[OCTUSB_MAX_PORTS]; device_t sc_dev; Modified: head/sys/mips/cavium/usb/octusb_octeon.c ============================================================================== --- head/sys/mips/cavium/usb/octusb_octeon.c Sun Jan 1 03:38:36 2012 (r229167) +++ head/sys/mips/cavium/usb/octusb_octeon.c Sun Jan 1 09:12:21 2012 (r229168) @@ -94,6 +94,8 @@ octusb_octeon_attach(device_t dev) struct octusb_octeon_softc *sc = device_get_softc(dev); int err; int rid; + int nports; + int i; /* setup controller interface softc */ @@ -107,12 +109,29 @@ octusb_octeon_attach(device_t dev) USB_GET_DMA_TAG(dev), NULL)) { return (ENOMEM); } - rid = 0; - sc->sc_dci.sc_irq_res = - bus_alloc_resource(dev, SYS_RES_IRQ, &rid, - CVMX_IRQ_USB, CVMX_IRQ_USB, 1, RF_ACTIVE); - if (!(sc->sc_dci.sc_irq_res)) { - goto error; + nports = cvmx_usb_get_num_ports(); + if (nports > OCTUSB_MAX_PORTS) + panic("octusb: too many USB ports %d", nports); + for (i = 0; i < nports; i++) { + rid = 0; + sc->sc_dci.sc_irq_res[i] = + bus_alloc_resource(dev, SYS_RES_IRQ, &rid, + CVMX_IRQ_USB0 + i, CVMX_IRQ_USB0 + i, 1, RF_ACTIVE); + if (!(sc->sc_dci.sc_irq_res[i])) { + goto error; + } + +#if (__FreeBSD_version >= 700031) + err = bus_setup_intr(dev, sc->sc_dci.sc_irq_res[i], INTR_TYPE_BIO | INTR_MPSAFE, + NULL, (driver_intr_t *)octusb_interrupt, sc, &sc->sc_dci.sc_intr_hdl[i]); +#else + err = bus_setup_intr(dev, sc->sc_dci.sc_irq_res[i], INTR_TYPE_BIO | INTR_MPSAFE, + (driver_intr_t *)octusb_interrupt, sc, &sc->sc_dci.sc_intr_hdl[i]); +#endif + if (err) { + sc->sc_dci.sc_intr_hdl[i] = NULL; + goto error; + } } sc->sc_dci.sc_bus.bdev = device_add_child(dev, "usbus", -1); @@ -121,17 +140,7 @@ octusb_octeon_attach(device_t dev) } device_set_ivars(sc->sc_dci.sc_bus.bdev, &sc->sc_dci.sc_bus); -#if (__FreeBSD_version >= 700031) - err = bus_setup_intr(dev, sc->sc_dci.sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE, - NULL, (driver_intr_t *)octusb_interrupt, sc, &sc->sc_dci.sc_intr_hdl); -#else - err = bus_setup_intr(dev, sc->sc_dci.sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE, - (driver_intr_t *)octusb_interrupt, sc, &sc->sc_dci.sc_intr_hdl); -#endif - if (err) { - sc->sc_dci.sc_intr_hdl = NULL; - goto error; - } + err = octusb_init(&sc->sc_dci); if (!err) { err = device_probe_and_attach(sc->sc_dci.sc_bus.bdev); @@ -152,6 +161,8 @@ octusb_octeon_detach(device_t dev) struct octusb_octeon_softc *sc = device_get_softc(dev); device_t bdev; int err; + int nports; + int i; if (sc->sc_dci.sc_bus.bdev) { bdev = sc->sc_dci.sc_bus.bdev; @@ -161,20 +172,26 @@ octusb_octeon_detach(device_t dev) /* during module unload there are lots of children leftover */ device_delete_children(dev); - if (sc->sc_dci.sc_irq_res && sc->sc_dci.sc_intr_hdl) { + if (sc->sc_dci.sc_irq_res[0] && sc->sc_dci.sc_intr_hdl[0]) /* - * only call octusb_octeon_uninit() after octusb_octeon_init() - */ + * only call octusb_octeon_uninit() after octusb_octeon_init() + */ octusb_uninit(&sc->sc_dci); - err = bus_teardown_intr(dev, sc->sc_dci.sc_irq_res, - sc->sc_dci.sc_intr_hdl); - sc->sc_dci.sc_intr_hdl = NULL; - } - if (sc->sc_dci.sc_irq_res) { - bus_release_resource(dev, SYS_RES_IRQ, 0, - sc->sc_dci.sc_irq_res); - sc->sc_dci.sc_irq_res = NULL; + nports = cvmx_usb_get_num_ports(); + if (nports > OCTUSB_MAX_PORTS) + panic("octusb: too many USB ports %d", nports); + for (i = 0; i < nports; i++) { + if (sc->sc_dci.sc_irq_res[0] && sc->sc_dci.sc_intr_hdl[0]) { + err = bus_teardown_intr(dev, sc->sc_dci.sc_irq_res[i], + sc->sc_dci.sc_intr_hdl[i]); + sc->sc_dci.sc_intr_hdl[i] = NULL; + } + if (sc->sc_dci.sc_irq_res) { + bus_release_resource(dev, SYS_RES_IRQ, 0, + sc->sc_dci.sc_irq_res[i]); + sc->sc_dci.sc_irq_res[i] = NULL; + } } usb_bus_mem_free_all(&sc->sc_dci.sc_bus, NULL); From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 09:29:26 2012 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 D3761106564A; Sun, 1 Jan 2012 09:29:26 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from mx0.hoeg.nl (mx0.hoeg.nl [IPv6:2a01:4f8:101:5343::aa]) by mx1.freebsd.org (Postfix) with ESMTP id 6F6138FC08; Sun, 1 Jan 2012 09:29:26 +0000 (UTC) Received: by mx0.hoeg.nl (Postfix, from userid 1000) id A62A42A28E69; Sun, 1 Jan 2012 10:29:25 +0100 (CET) Date: Sun, 1 Jan 2012 10:29:25 +0100 From: Ed Schouten To: Steve Kargl , Andreas Tobler , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <20120101092925.GZ1895@hoeg.nl> References: <201112291441.pBTEfI8l060127@svn.freebsd.org> <4EFCA6A6.6080103@FreeBSD.org> <20111229183213.GK1895@hoeg.nl> <20111229184934.GA47885@troutmask.apl.washington.edu> <20111229192359.GM1895@hoeg.nl> <20120101025422.GD94452@zim.MIT.EDU> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="N6OI5UwltL9FF6Nb" Content-Disposition: inline In-Reply-To: <20120101025422.GD94452@zim.MIT.EDU> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Subject: Re: svn commit: r228955 - head/include 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, 01 Jan 2012 09:29:26 -0000 --N6OI5UwltL9FF6Nb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable David, * David Schultz , 20120101 03:54: > I'm out of town and don't remember the details of this, but is there a > reason we couldn't simply have an appropriate #ifdef that uses > __attribute((__noreturn__)) instead of [[noreturn]]? We have plenty > of ifdefs in the tree already to work around deficiencies in various > compilers. Saying "it's the compiler's fault and we're not going to > work around it" is a significant departure from historical precedent, > and it punishes the wrong people. Easier than arguing with the GNU > folks about fixing it, too... Right now GCC 4.7 is still an unreleased piece of software. If GCC 4.7 was a released piece of software, I would of course agree that we should add the workaround. The problem isn't that GCC 4.7 doesn't support [[noreturn]]. The problem is that GCC only implements parts of C++11, yet it forces the compiler into C++11 mode while bootstrapping. Even if we add a workaround for this in sys/cdefs.h, we can likely never ever get rid of it. Because if someone wants to install GCC 4.7 on a FreeBSD 14.0 box in 2020 to build an old piece of software, he still needs the workaround. But there's nothing serious going on here. The issue is already discussed in GCC Bugzilla and there is a patch that fixes the build. Let's just wait to see what happens. --=20 Ed Schouten WWW: http://80386.nl/ --N6OI5UwltL9FF6Nb Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iQIcBAEBAgAGBQJPACd1AAoJEG5e2P40kaK7XUwP/1V1bGGtT9AnlJ9oX/ITiSu0 rTwOoSMGSPIN+xyilNPiJR30RaESAGPWhAwC2DmakUrFRw+mMmGlvkrlHv/cqKGu vZOWd+7tbOIShjEsEeOZZXVmAZXar7BtfKPhwpY/zGdiniOaLAAbFoa7yzCCMu1a xpUwgVC6SAGW2vik3jsqU0KFR+6iWVnw9U7CC5HiYkcUdJU2wdr/io7tz737t4iJ 8PhJh2t829Oh8oh4euZgHWi9yIjU4widD7poZX2TAtPVclDfFaDyWL5RTl2HNp8b rCqrNL/Mk/+Bu2fCcs2M2aynWA4CkbIi7EYFuiZkvdA5fXht8zie+0bDCTcbDk5v AGbylRSDy9QugueFmrk1nE7Ba5zYu9v+Jj2e2XYIqQuFsdPZljEgd9afDxmittQB gFpyrAaYikZMfr97V1+9L/ndk/0++9GnlcDXxkJtQ41vhb3Ar/8eq1zTC+nya1cc Wuw2fRqKet3f3zxTmy4VlOHOqMCCDhvYOhmy5JMYggur1PFHFqtVst7iwTTnO9Ut xUfds9BPB3Zd4cC+MjVHdtP4OknwrhveLCk/TeyxBJE3FHFwRvzi+hMcOgo4fZBN VLgWx1Grdr6OLomLZaXRNnK1WzaECQTapKfs2QHRGoexzy3+z2L6wtjkI85oYGpF L3D6F+hZpd8QRtsDI1IN =4pLG -----END PGP SIGNATURE----- --N6OI5UwltL9FF6Nb-- From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 15:56:16 2012 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 51A4D106566B; Sun, 1 Jan 2012 15:56:16 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BCCB28FC0C; Sun, 1 Jan 2012 15:56: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 q01FuF5s019344; Sun, 1 Jan 2012 15:56:15 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01FuF5V019342; Sun, 1 Jan 2012 15:56:15 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201201011556.q01FuF5V019342@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 1 Jan 2012 15:56: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: r229169 - head/lib/clang 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, 01 Jan 2012 15:56:16 -0000 Author: nwhitehorn Date: Sun Jan 1 15:56:15 2012 New Revision: 229169 URL: http://svn.freebsd.org/changeset/base/229169 Log: Instead of forcing -O1 on PowerPC for LLVM and clang, fix the actual problem by adding -fno-strict-aliasing to CFLAGS. Since this is a global issue that just happened to manifest on PowerPC, add this to CFLAGS unconditionally. MFC after: 1 week Modified: head/lib/clang/clang.build.mk Modified: head/lib/clang/clang.build.mk ============================================================================== --- head/lib/clang/clang.build.mk Sun Jan 1 09:12:21 2012 (r229168) +++ head/lib/clang/clang.build.mk Sun Jan 1 15:56:15 2012 (r229169) @@ -8,10 +8,8 @@ CFLAGS+=-I${LLVM_SRCS}/include -I${CLANG -DLLVM_ON_UNIX -DLLVM_ON_FREEBSD \ -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS #-DNDEBUG -# Correct for gcc miscompilation when compiling on PPC with -O2 -.if ${MACHINE_CPUARCH} == "powerpc" -CFLAGS+= -O1 -.endif +# LLVM is not strict aliasing safe as of 12/31/2011 +CFLAGS+= -fno-strict-aliasing TARGET_ARCH?= ${MACHINE_ARCH} CFLAGS+=-DLLVM_HOSTTRIPLE=\"${TARGET_ARCH:C/amd64/x86_64/}-unknown-freebsd10.0\" From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 16:04:03 2012 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 308E3106566C; Sun, 1 Jan 2012 16:04:03 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F3EC38FC0A; Sun, 1 Jan 2012 16:04: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 q01G42KK019676; Sun, 1 Jan 2012 16:04:02 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01G42TW019674; Sun, 1 Jan 2012 16:04:02 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201201011604.q01G42TW019674@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 1 Jan 2012 16:04:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229170 - stable/9/sys/powerpc/include 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, 01 Jan 2012 16:04:03 -0000 Author: nwhitehorn Date: Sun Jan 1 16:04:02 2012 New Revision: 229170 URL: http://svn.freebsd.org/changeset/base/229170 Log: Increase the available virtual address space for user programs on PowerPC AIM systems to 4 GB on 32-bit systems and 2^64 bytes on 64-bit systems. VM_MAXUSER_ADDRESS remains at 2 GB on Book-E, due to a different memory layout used on this platform. Modified: stable/9/sys/powerpc/include/vmparam.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/powerpc/include/vmparam.h ============================================================================== --- stable/9/sys/powerpc/include/vmparam.h Sun Jan 1 15:56:15 2012 (r229169) +++ stable/9/sys/powerpc/include/vmparam.h Sun Jan 1 16:04:02 2012 (r229170) @@ -57,29 +57,34 @@ #define MAXSSIZ (64*1024*1024) /* max stack size */ #endif +#ifdef AIM +#define VM_MAXUSER_ADDRESS32 ((vm_offset_t)0xfffff000) +#else +#define VM_MAXUSER_ADDRESS32 ((vm_offset_t)0x7ffff000) +#endif + /* * Would like to have MAX addresses = 0, but this doesn't (currently) work */ #if !defined(LOCORE) #ifdef __powerpc64__ #define VM_MIN_ADDRESS (0x0000000000000000UL) -#define VM_MAXUSER_ADDRESS (0x7ffffffffffff000UL) -#define SHAREDPAGE (VM_MAXUSER_ADDRESS - PAGE_SIZE) +#define VM_MAXUSER_ADDRESS (0xfffffffffffff000UL) #define VM_MAX_ADDRESS (0xffffffffffffffffUL) #else #define VM_MIN_ADDRESS ((vm_offset_t)0) -#define VM_MAXUSER_ADDRESS ((vm_offset_t)0x7ffff000) -#define SHAREDPAGE (VM_MAXUSER_ADDRESS - PAGE_SIZE) -#define VM_MAX_ADDRESS VM_MAXUSER_ADDRESS +#define VM_MAXUSER_ADDRESS VM_MAXUSER_ADDRESS32 +#define VM_MAX_ADDRESS ((vm_offset_t)0xffffffff) #endif +#define SHAREDPAGE (VM_MAXUSER_ADDRESS - PAGE_SIZE) #else /* LOCORE */ -#ifndef __powerpc64__ +#if !defined(__powerpc64__) && defined(E500) #define VM_MIN_ADDRESS 0 #define VM_MAXUSER_ADDRESS 0x7ffff000 #endif #endif /* LOCORE */ -#define FREEBSD32_SHAREDPAGE (0x7ffff000 - PAGE_SIZE) +#define FREEBSD32_SHAREDPAGE (VM_MAXUSER_ADDRESS32 - PAGE_SIZE) #define FREEBSD32_USRSTACK FREEBSD32_SHAREDPAGE #ifdef AIM From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 16:05:37 2012 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 24BCD106564A; Sun, 1 Jan 2012 16:05:37 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0D3E98FC08; Sun, 1 Jan 2012 16:05: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 q01G5a5b019842; Sun, 1 Jan 2012 16:05:36 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01G5aMn019838; Sun, 1 Jan 2012 16:05:36 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201201011605.q01G5aMn019838@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 1 Jan 2012 16:05:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229171 - in stable/9/sys/powerpc: aim include 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, 01 Jan 2012 16:05:37 -0000 Author: nwhitehorn Date: Sun Jan 1 16:05:36 2012 New Revision: 229171 URL: http://svn.freebsd.org/changeset/base/229171 Log: Keep track of PVO entries in each pmap, which allows much faster pmap_remove() for large sparse requests. This can prevent pmap_remove() operations on 64-bit process destruction or swapout that would take several hundred times the lifetime of the universe to complete. This behavior is largely indistinguishable from a hang. Modified: stable/9/sys/powerpc/aim/mmu_oea.c stable/9/sys/powerpc/aim/mmu_oea64.c stable/9/sys/powerpc/include/pmap.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/powerpc/aim/mmu_oea.c ============================================================================== --- stable/9/sys/powerpc/aim/mmu_oea.c Sun Jan 1 16:04:02 2012 (r229170) +++ stable/9/sys/powerpc/aim/mmu_oea.c Sun Jan 1 16:05:36 2012 (r229171) @@ -824,6 +824,7 @@ moea_bootstrap(mmu_t mmup, vm_offset_t k for (i = 0; i < 16; i++) kernel_pmap->pm_sr[i] = EMPTY_SEGMENT + i; CPU_FILL(&kernel_pmap->pm_active); + LIST_INIT(&kernel_pmap->pmap_pvo); /* * Set up the Open Firmware mappings @@ -1582,6 +1583,7 @@ moea_pinit(mmu_t mmu, pmap_t pmap) KASSERT((int)pmap < VM_MIN_KERNEL_ADDRESS, ("moea_pinit: virt pmap")); PMAP_LOCK_INIT(pmap); + LIST_INIT(&pmap->pmap_pvo); entropy = 0; __asm __volatile("mftb %0" : "=r"(entropy)); @@ -1763,10 +1765,17 @@ moea_remove(mmu_t mmu, pmap_t pm, vm_off vm_page_lock_queues(); PMAP_LOCK(pm); - for (; sva < eva; sva += PAGE_SIZE) { - pvo = moea_pvo_find_va(pm, sva, &pteidx); - if (pvo != NULL) { - moea_pvo_remove(pvo, pteidx); + if ((eva - sva)/PAGE_SIZE < 10) { + for (; sva < eva; sva += PAGE_SIZE) { + pvo = moea_pvo_find_va(pm, sva, &pteidx); + if (pvo != NULL) + moea_pvo_remove(pvo, pteidx); + } + } else { + LIST_FOREACH(pvo, &pm->pmap_pvo, pvo_plink) { + if (PVO_VADDR(pvo) < sva || PVO_VADDR(pvo) >= eva) + continue; + moea_pvo_remove(pvo, -1); } } PMAP_UNLOCK(pm); @@ -1929,6 +1938,11 @@ moea_pvo_enter(pmap_t pm, uma_zone_t zon moea_pte_create(&pvo->pvo_pte.pte, sr, va, pa | pte_lo); /* + * Add to pmap list + */ + LIST_INSERT_HEAD(&pm->pmap_pvo, pvo, pvo_plink); + + /* * Remember if the list was empty and therefore will be the first * item. */ @@ -1994,9 +2008,10 @@ moea_pvo_remove(struct pvo_entry *pvo, i } /* - * Remove this PVO from the PV list. + * Remove this PVO from the PV and pmap lists. */ LIST_REMOVE(pvo, pvo_vlink); + LIST_REMOVE(pvo, pvo_plink); /* * Remove this from the overflow list and return it to the pool Modified: stable/9/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- stable/9/sys/powerpc/aim/mmu_oea64.c Sun Jan 1 16:04:02 2012 (r229170) +++ stable/9/sys/powerpc/aim/mmu_oea64.c Sun Jan 1 16:05:36 2012 (r229171) @@ -831,6 +831,7 @@ moea64_mid_bootstrap(mmu_t mmup, vm_offs kernel_pmap->pmap_phys = kernel_pmap; CPU_FILL(&kernel_pmap->pm_active); + LIST_INIT(&kernel_pmap->pmap_pvo); PMAP_LOCK_INIT(kernel_pmap); @@ -1855,6 +1856,7 @@ void moea64_pinit(mmu_t mmu, pmap_t pmap) { PMAP_LOCK_INIT(pmap); + LIST_INIT(&pmap->pmap_pvo); pmap->pm_slb_tree_root = slb_alloc_tree(); pmap->pm_slb = slb_alloc_user_cache(); @@ -1868,6 +1870,7 @@ moea64_pinit(mmu_t mmu, pmap_t pmap) uint32_t hash; PMAP_LOCK_INIT(pmap); + LIST_INIT(&pmap->pmap_pvo); if (pmap_bootstrapped) pmap->pmap_phys = (pmap_t)moea64_kextract(mmu, @@ -2034,10 +2037,18 @@ moea64_remove(mmu_t mmu, pmap_t pm, vm_o vm_page_lock_queues(); PMAP_LOCK(pm); - for (; sva < eva; sva += PAGE_SIZE) { - pvo = moea64_pvo_find_va(pm, sva); - if (pvo != NULL) + if ((eva - sva)/PAGE_SIZE < 10) { + for (; sva < eva; sva += PAGE_SIZE) { + pvo = moea64_pvo_find_va(pm, sva); + if (pvo != NULL) + moea64_pvo_remove(mmu, pvo); + } + } else { + LIST_FOREACH(pvo, &pm->pmap_pvo, pvo_plink) { + if (PVO_VADDR(pvo) < sva || PVO_VADDR(pvo) >= eva) + continue; moea64_pvo_remove(mmu, pvo); + } } vm_page_unlock_queues(); PMAP_UNLOCK(pm); @@ -2231,6 +2242,11 @@ moea64_pvo_enter(mmu_t mmu, pmap_t pm, u (uint64_t)(pa) | pte_lo, flags); /* + * Add to pmap list + */ + LIST_INSERT_HEAD(&pm->pmap_pvo, pvo, pvo_plink); + + /* * Remember if the list was empty and therefore will be the first * item. */ @@ -2311,9 +2327,10 @@ moea64_pvo_remove(mmu_t mmu, struct pvo_ } /* - * Remove this PVO from the PV list. + * Remove this PVO from the PV and pmap lists. */ LIST_REMOVE(pvo, pvo_vlink); + LIST_REMOVE(pvo, pvo_plink); /* * Remove this from the overflow list and return it to the pool Modified: stable/9/sys/powerpc/include/pmap.h ============================================================================== --- stable/9/sys/powerpc/include/pmap.h Sun Jan 1 16:04:02 2012 (r229170) +++ stable/9/sys/powerpc/include/pmap.h Sun Jan 1 16:05:36 2012 (r229171) @@ -88,28 +88,13 @@ struct pmap_md { #endif /* !defined(NPMAPS) */ struct slbtnode; - -struct pmap { - struct mtx pm_mtx; - - #ifdef __powerpc64__ - struct slbtnode *pm_slb_tree_root; - struct slb **pm_slb; - int pm_slb_len; - #else - register_t pm_sr[16]; - #endif - cpuset_t pm_active; - - struct pmap *pmap_phys; - struct pmap_statistics pm_stats; -}; - +struct pmap; typedef struct pmap *pmap_t; struct pvo_entry { LIST_ENTRY(pvo_entry) pvo_vlink; /* Link to common virt page */ LIST_ENTRY(pvo_entry) pvo_olink; /* Link to overflow entry */ + LIST_ENTRY(pvo_entry) pvo_plink; /* Link to pmap entries */ union { struct pte pte; /* 32 bit PTE */ struct lpte lpte; /* 64 bit PTE */ @@ -137,6 +122,23 @@ LIST_HEAD(pvo_head, pvo_entry); ((void)((pvo)->pvo_vaddr |= (i)|PVO_PTEGIDX_VALID)) #define PVO_VSID(pvo) ((pvo)->pvo_vpn >> 16) +struct pmap { + struct mtx pm_mtx; + + #ifdef __powerpc64__ + struct slbtnode *pm_slb_tree_root; + struct slb **pm_slb; + int pm_slb_len; + #else + register_t pm_sr[16]; + #endif + cpuset_t pm_active; + + struct pmap *pmap_phys; + struct pmap_statistics pm_stats; + struct pvo_head pmap_pvo; +}; + struct md_page { u_int64_t mdpg_attrs; vm_memattr_t mdpg_cache_attrs; From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 16:11:12 2012 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 10792106564A; Sun, 1 Jan 2012 16:11:12 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id C165A8FC16; Sun, 1 Jan 2012 16:11:11 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:e165:a097:747b:93eb] (unknown [IPv6:2001:7b8:3a7:0:e165:a097:747b:93eb]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id E12B45C37; Sun, 1 Jan 2012 17:11:10 +0100 (CET) Message-ID: <4F00859C.5020205@FreeBSD.org> Date: Sun, 01 Jan 2012 17:11:08 +0100 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 MIME-Version: 1.0 To: Nathan Whitehorn References: <201201011556.q01FuF5V019342@svn.freebsd.org> In-Reply-To: <201201011556.q01FuF5V019342@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r229169 - head/lib/clang 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, 01 Jan 2012 16:11:12 -0000 On 2012-01-01 16:56, Nathan Whitehorn wrote: > Author: nwhitehorn > Date: Sun Jan 1 15:56:15 2012 > New Revision: 229169 > URL: http://svn.freebsd.org/changeset/base/229169 > > Log: > Instead of forcing -O1 on PowerPC for LLVM and clang, fix the actual > problem by adding -fno-strict-aliasing to CFLAGS. Since this is a global > issue that just happened to manifest on PowerPC, add this to CFLAGS > unconditionally. > > MFC after: 1 week > > Modified: > head/lib/clang/clang.build.mk > > Modified: head/lib/clang/clang.build.mk > ============================================================================== > --- head/lib/clang/clang.build.mk Sun Jan 1 09:12:21 2012 (r229168) > +++ head/lib/clang/clang.build.mk Sun Jan 1 15:56:15 2012 (r229169) > @@ -8,10 +8,8 @@ CFLAGS+=-I${LLVM_SRCS}/include -I${CLANG > -DLLVM_ON_UNIX -DLLVM_ON_FREEBSD \ > -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS #-DNDEBUG > > -# Correct for gcc miscompilation when compiling on PPC with -O2 > -.if ${MACHINE_CPUARCH} == "powerpc" > -CFLAGS+= -O1 > -.endif > +# LLVM is not strict aliasing safe as of 12/31/2011 > +CFLAGS+= -fno-strict-aliasing Actually, LLVM is strict-aliasing safe, but not for gcc 4.2.1. :) There is some sort of problem with gcc's optimizer that made a few LLVM tests fails mysteriously in the past. At a certain point, these problems went away for x86, but apparently not for non-x86... In any case, this option should only have to be added when the compiler is base gcc. From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 16:24:48 2012 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 574EC106564A; Sun, 1 Jan 2012 16:24:48 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from argol.doit.wisc.edu (argol.doit.wisc.edu [144.92.197.212]) by mx1.freebsd.org (Postfix) with ESMTP id 2342C8FC14; Sun, 1 Jan 2012 16:24:47 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII; format=flowed Received: from avs-daemon.smtpauth3.wiscmail.wisc.edu by smtpauth3.wiscmail.wisc.edu (Sun Java(tm) System Messaging Server 7u2-7.05 32bit (built Jul 30 2009)) id <0LX400000O9B2C00@smtpauth3.wiscmail.wisc.edu>; Sun, 01 Jan 2012 10:24:47 -0600 (CST) Received: from comporellon.tachypleus.net ([unknown] [76.210.61.211]) by smtpauth3.wiscmail.wisc.edu (Sun Java(tm) System Messaging Server 7u2-7.05 32bit (built Jul 30 2009)) with ESMTPSA id <0LX400F6MO99WL20@smtpauth3.wiscmail.wisc.edu>; Sun, 01 Jan 2012 10:24:46 -0600 (CST) Date: Sun, 01 Jan 2012 10:24:45 -0600 From: Nathan Whitehorn In-reply-to: <4F00859C.5020205@FreeBSD.org> To: Dimitry Andric Message-id: <4F0088CD.5010202@freebsd.org> X-Spam-Report: AuthenticatedSender=yes, SenderIP=76.210.61.211 X-Spam-PmxInfo: Server=avs-14, Version=5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2012.1.1.161517, SenderIP=76.210.61.211 References: <201201011556.q01FuF5V019342@svn.freebsd.org> <4F00859C.5020205@FreeBSD.org> User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:8.0) Gecko/20111113 Thunderbird/8.0 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r229169 - head/lib/clang 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, 01 Jan 2012 16:24:48 -0000 On 01/01/12 10:11, Dimitry Andric wrote: > On 2012-01-01 16:56, Nathan Whitehorn wrote: >> Author: nwhitehorn >> Date: Sun Jan 1 15:56:15 2012 >> New Revision: 229169 >> URL: http://svn.freebsd.org/changeset/base/229169 >> >> Log: >> Instead of forcing -O1 on PowerPC for LLVM and clang, fix the actual >> problem by adding -fno-strict-aliasing to CFLAGS. Since this is a >> global >> issue that just happened to manifest on PowerPC, add this to CFLAGS >> unconditionally. >> >> MFC after: 1 week >> >> Modified: >> head/lib/clang/clang.build.mk >> >> Modified: head/lib/clang/clang.build.mk >> ============================================================================== >> >> --- head/lib/clang/clang.build.mk Sun Jan 1 09:12:21 2012 >> (r229168) >> +++ head/lib/clang/clang.build.mk Sun Jan 1 15:56:15 2012 >> (r229169) >> @@ -8,10 +8,8 @@ CFLAGS+=-I${LLVM_SRCS}/include -I${CLANG >> -DLLVM_ON_UNIX -DLLVM_ON_FREEBSD \ >> -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS #-DNDEBUG >> >> -# Correct for gcc miscompilation when compiling on PPC with -O2 >> -.if ${MACHINE_CPUARCH} == "powerpc" >> -CFLAGS+= -O1 >> -.endif >> +# LLVM is not strict aliasing safe as of 12/31/2011 >> +CFLAGS+= -fno-strict-aliasing > > Actually, LLVM is strict-aliasing safe, but not for gcc 4.2.1. :) > > There is some sort of problem with gcc's optimizer that made a few LLVM > tests fails mysteriously in the past. At a certain point, these > problems went away for x86, but apparently not for non-x86... > > In any case, this option should only have to be added when the compiler > is base gcc. Ah, interesting. I'm not quite sure how to express "is compiler base GCC", but I'm guessing you have more experience there. Would you mind fixing that? -Nathan From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 16:41:33 2012 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 D527F106564A; Sun, 1 Jan 2012 16:41:33 +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 A61658FC16; Sun, 1 Jan 2012 16:41:33 +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 q01GfXIa020957; Sun, 1 Jan 2012 16:41:33 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01GfXm8020955; Sun, 1 Jan 2012 16:41:33 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201201011641.q01GfXm8020955@svn.freebsd.org> From: Rick Macklem Date: Sun, 1 Jan 2012 16:41:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229172 - stable/9/sys/fs/nfsclient 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, 01 Jan 2012 16:41:33 -0000 Author: rmacklem Date: Sun Jan 1 16:41:33 2012 New Revision: 229172 URL: http://svn.freebsd.org/changeset/base/229172 Log: MFC: r227493 Move the assignment of default values for some mount options to before the nfs_decode_args() call in the new NFS client, so they don't overwrite the value specified on the command line. Modified: stable/9/sys/fs/nfsclient/nfs_clvfsops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- stable/9/sys/fs/nfsclient/nfs_clvfsops.c Sun Jan 1 16:05:36 2012 (r229171) +++ stable/9/sys/fs/nfsclient/nfs_clvfsops.c Sun Jan 1 16:41:33 2012 (r229172) @@ -1212,7 +1212,16 @@ mountnfs(struct nfs_args *argp, struct m vfs_getnewfsid(mp); nmp->nm_mountp = mp; mtx_init(&nmp->nm_mtx, "NFSmount lock", NULL, MTX_DEF | MTX_DUPOK); + + /* + * Since nfs_decode_args() might optionally set them, these need to + * set to defaults before the call, so that the optional settings + * aren't overwritten. + */ nmp->nm_negnametimeo = negnametimeo; + nmp->nm_timeo = NFS_TIMEO; + nmp->nm_retry = NFS_RETRANS; + nmp->nm_readahead = NFS_DEFRAHEAD; nfs_decode_args(mp, nmp, argp, hst, cred, td); @@ -1231,8 +1240,6 @@ mountnfs(struct nfs_args *argp, struct m else nmp->nm_maxfilesize = OFF_MAX; - nmp->nm_timeo = NFS_TIMEO; - nmp->nm_retry = NFS_RETRANS; if ((argp->flags & (NFSMNT_NFSV3 | NFSMNT_NFSV4)) == 0) { nmp->nm_wsize = NFS_WSIZE; nmp->nm_rsize = NFS_RSIZE; @@ -1240,7 +1247,6 @@ mountnfs(struct nfs_args *argp, struct m } nmp->nm_wcommitsize = hibufspace / (desiredvnodes / 1000); nmp->nm_numgrps = NFS_MAXGRPS; - nmp->nm_readahead = NFS_DEFRAHEAD; nmp->nm_tprintf_delay = nfs_tprintf_delay; if (nmp->nm_tprintf_delay < 0) nmp->nm_tprintf_delay = 0; From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 16:49:36 2012 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 2E6E7106564A; Sun, 1 Jan 2012 16:49:36 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id E10C48FC0A; Sun, 1 Jan 2012 16:49:35 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:e165:a097:747b:93eb] (unknown [IPv6:2001:7b8:3a7:0:e165:a097:747b:93eb]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 3365A5C37; Sun, 1 Jan 2012 17:49:35 +0100 (CET) Message-ID: <4F008EA0.3080800@FreeBSD.org> Date: Sun, 01 Jan 2012 17:49:36 +0100 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 MIME-Version: 1.0 To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201112221503.pBMF3m0w021930@svn.freebsd.org> <20120101020442.GA94452@zim.MIT.EDU> In-Reply-To: <20120101020442.GA94452@zim.MIT.EDU> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Subject: Re: svn commit: r228801 - 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: Sun, 01 Jan 2012 16:49:36 -0000 On 2012-01-01 03:04, David Schultz wrote: > On Thu, Dec 22, 2011, Dimitry Andric wrote: >> Remove -mfancy-math from LIB32CPUFLAGS for amd64. It has been default >> for our gcc since more than three years (see r181534, which is also in >> stable/9 and stable/8). This flag used to be for the benefit of the old >> in-kernel math emulator, which was removed more than eight years ago. > > Quite the opposite, actually. gcc/freebsd used to be hard-coded to > use -mno-fancy-math-387 by default, which was really only appropriate for > FPUless x86 chips back when FreeBSD supported them. The makefile > setting overrides the old gcc default. The flag isn't "for the > benefit of the in-kernel math emulator"; it's actually to reap the > benefits of *not* having an in-kernel math emulator! > > Do you know if clang has the correct default here, or if it picked up > trunk gcc's bogus default? It doesn't seem to support the flag to > change the behavior, and it seems to default to -mno-fancy-math-387. > (The flag should only affect things when -ffast-math is also specified.) As far as I can see, clang always generates calls to sin(), cos() etc. It never inlines them to direct 387 instructions. Isn't that what we want? In any case, I don't see a quick way of getting it to emit 387 instructions directly. It simply looks like it is not supported. The -funsafe-math-optimizations is not recognized, and the -ffast-math option is accepted, but ignored. From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 17:05:25 2012 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 A6370106564A; Sun, 1 Jan 2012 17:05:25 +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 753808FC12; Sun, 1 Jan 2012 17:05:25 +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 q01H5P7n021737; Sun, 1 Jan 2012 17:05:25 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01H5Pig021735; Sun, 1 Jan 2012 17:05:25 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201201011705.q01H5Pig021735@svn.freebsd.org> From: Rick Macklem Date: Sun, 1 Jan 2012 17:05:25 +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: r229173 - in stable/8/sys: conf fs/nfsclient 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, 01 Jan 2012 17:05:25 -0000 Author: rmacklem Date: Sun Jan 1 17:05:24 2012 New Revision: 229173 URL: http://svn.freebsd.org/changeset/base/229173 Log: MFC: r227493 Move the assignment of default values for some mount options to before the nfs_decode_args() call in the new NFS client, so they don't overwrite the value specified on the command line. Modified: stable/8/sys/fs/nfsclient/nfs_clvfsops.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/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clvfsops.c Sun Jan 1 16:41:33 2012 (r229172) +++ stable/8/sys/fs/nfsclient/nfs_clvfsops.c Sun Jan 1 17:05:24 2012 (r229173) @@ -1208,7 +1208,16 @@ mountnfs(struct nfs_args *argp, struct m vfs_getnewfsid(mp); nmp->nm_mountp = mp; mtx_init(&nmp->nm_mtx, "NFSmount lock", NULL, MTX_DEF | MTX_DUPOK); + + /* + * Since nfs_decode_args() might optionally set them, these need to + * set to defaults before the call, so that the optional settings + * aren't overwritten. + */ nmp->nm_negnametimeo = negnametimeo; + nmp->nm_timeo = NFS_TIMEO; + nmp->nm_retry = NFS_RETRANS; + nmp->nm_readahead = NFS_DEFRAHEAD; nfs_decode_args(mp, nmp, argp, hst, cred, td); @@ -1227,8 +1236,6 @@ mountnfs(struct nfs_args *argp, struct m else nmp->nm_maxfilesize = OFF_MAX; - nmp->nm_timeo = NFS_TIMEO; - nmp->nm_retry = NFS_RETRANS; if ((argp->flags & (NFSMNT_NFSV3 | NFSMNT_NFSV4)) == 0) { nmp->nm_wsize = NFS_WSIZE; nmp->nm_rsize = NFS_RSIZE; @@ -1236,7 +1243,6 @@ mountnfs(struct nfs_args *argp, struct m } nmp->nm_wcommitsize = hibufspace / (desiredvnodes / 1000); nmp->nm_numgrps = NFS_MAXGRPS; - nmp->nm_readahead = NFS_DEFRAHEAD; nmp->nm_tprintf_delay = nfs_tprintf_delay; if (nmp->nm_tprintf_delay < 0) nmp->nm_tprintf_delay = 0; From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 17:13:26 2012 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 74C9F1065672; Sun, 1 Jan 2012 17:13:26 +0000 (UTC) (envelope-from uqs@freebsd.org) Received: from acme.spoerlein.net (acme.spoerlein.net [IPv6:2a01:4f8:131:23c2::1]) by mx1.freebsd.org (Postfix) with ESMTP id 077D58FC0C; Sun, 1 Jan 2012 17:13:25 +0000 (UTC) Received: from localhost (acme.spoerlein.net [IPv6:2a01:4f8:131:23c2::1]) by acme.spoerlein.net (8.14.4/8.14.4) with ESMTP id q01HDO1v074168 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Sun, 1 Jan 2012 18:13:24 +0100 (CET) (envelope-from uqs@freebsd.org) Date: Sun, 1 Jan 2012 18:13:24 +0100 From: Ulrich Spoerlein To: Harti Brandt Message-ID: <20120101171324.GM83814@acme.spoerlein.net> Mail-Followup-To: Ulrich Spoerlein , Harti Brandt , Ben Kaduk , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201112301058.pBUAwFsw010478@svn.freebsd.org> <20111230204653.Y31442@beagle.kn.op.dlr.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20111230204653.Y31442@beagle.kn.op.dlr.de> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Ben Kaduk Subject: Re: svn commit: r228990 - in head/usr.sbin: IPXrouted adduser bluetooth/btpand bluetooth/sdpd bootparamd/bootparamd bsnmpd/modules/snmp_bridge bsnmpd/modules/snmp_hostres bsnmpd/modules/snmp_wlan bsnmp... 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, 01 Jan 2012 17:13:26 -0000 Sorry for the delay. On Fri, 2011-12-30 at 20:50:16 +0100, Harti Brandt wrote: > On Fri, 30 Dec 2011, Ben Kaduk wrote: > >On Fri, Dec 30, 2011 at 5:58 AM, Ulrich Spoerlein wrote: > >> Modified: head/usr.sbin/bsnmpd/modules/snmp_wlan/BEGEMOT-WIRELESS-MIB.txt > >> ============================================================================== > >> --- head/usr.sbin/bsnmpd/modules/snmp_wlan/BEGEMOT-WIRELESS-MIB.txt     Fri Dec 30 10:45:00 2011        (r228989) > >> +++ head/usr.sbin/bsnmpd/modules/snmp_wlan/BEGEMOT-WIRELESS-MIB.txt     Fri Dec 30 10:58:14 2011        (r228990) > >> @@ -82,8 +82,8 @@ WlanMgmtReasonCode ::= TEXTUAL-CONVENTIO > >>                    associationLeave(8), > >>                    associationNotAuthenticated(9), > >>  -- XXX: TODO - FIXME > >> -                   dissasocPwrcapBad(10), > >> -                   dissasocSuperchanBad(11), > >> +                   disassocPwrcapBad(10), > >> +                   disassocSuperchanBad(11), > > > >This file looks like it might be intended to be machine-readable -- I > >would worry about changing it without test/review. > >Perhaps this spelling "error" is even the reason for the XXX comment above. > > Absolutely. If there is a spelling error in an SNMP MIB outside comments > or description strings it must stay there. Otherwise applications reading > that file will break. > > This is also true for the corresponding .def file. > > harti Neither Google, Bing nor Google Code Search can find any occurrence of any of the two words in either spelling, except in our tree, of course. This leads me to believe that at least no known Open Source project will be affected by the change. But that doesn't say much. Is this a non-backwards compatible change that we can do when going from 9.x to 10.0? I'm fine with backing it out, too, if you think this will actually break anything for third parties. Just say the word. Thanks Uli From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 17:23:04 2012 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 63199106566B; Sun, 1 Jan 2012 17:23:04 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4DA788FC0A; Sun, 1 Jan 2012 17:23:04 +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 q01HN47f022309; Sun, 1 Jan 2012 17:23:04 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01HN4ul022307; Sun, 1 Jan 2012 17:23:04 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201011723.q01HN4ul022307@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 17:23:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229174 - stable/9/sbin/gbde 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, 01 Jan 2012 17:23:04 -0000 Author: dim Date: Sun Jan 1 17:23:03 2012 New Revision: 229174 URL: http://svn.freebsd.org/changeset/base/229174 Log: MFC r228610: Use NO_WCAST_ALIGN for sbin/gbde, this is more appropriate to fix the alignment warnings than using WARNS=3, and it also works for clang. Modified: stable/9/sbin/gbde/Makefile Directory Properties: stable/9/sbin/gbde/ (props changed) Modified: stable/9/sbin/gbde/Makefile ============================================================================== --- stable/9/sbin/gbde/Makefile Sun Jan 1 17:05:24 2012 (r229173) +++ stable/9/sbin/gbde/Makefile Sun Jan 1 17:23:03 2012 (r229174) @@ -7,11 +7,9 @@ SRCS+= rijndael-api-fst.c SRCS+= sha2.c SRCS+= g_bde_lock.c -# rijndael-fst.c does evil casting things which results in warnings on -# 64 bit machines, the test-vectors check out however, so it works right. -.if ${MACHINE_CPUARCH} != "i386" -WARNS?= 3 -.endif +# rijndael-fst.c does evil casting things which can results in warnings, +# the test-vectors check out however, so it works right. +NO_WCAST_ALIGN= CFLAGS+= -I${.CURDIR}/../../sys .PATH: ${.CURDIR}/../../sys/geom/bde \ From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 17:27:32 2012 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 93AF0106564A; Sun, 1 Jan 2012 17:27:32 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7E82A8FC13; Sun, 1 Jan 2012 17:27: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 q01HRWta022478; Sun, 1 Jan 2012 17:27:32 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01HRWSJ022476; Sun, 1 Jan 2012 17:27:32 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201011727.q01HRWSJ022476@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 17:27:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229175 - stable/9/sbin/atm/atmconfig 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, 01 Jan 2012 17:27:32 -0000 Author: dim Date: Sun Jan 1 17:27:31 2012 New Revision: 229175 URL: http://svn.freebsd.org/changeset/base/229175 Log: MFC r228611: In sbin/atm/atmconfig/diag.c, fix a few warnings about format strings not being literals. Modified: stable/9/sbin/atm/atmconfig/diag.c Directory Properties: stable/9/sbin/atm/atmconfig/ (props changed) Modified: stable/9/sbin/atm/atmconfig/diag.c ============================================================================== --- stable/9/sbin/atm/atmconfig/diag.c Sun Jan 1 17:23:03 2012 (r229174) +++ stable/9/sbin/atm/atmconfig/diag.c Sun Jan 1 17:27:31 2012 (r229175) @@ -426,7 +426,7 @@ diag_loop(int argc, char *argv[], const for (i = 0; i < argc; i++) { TAILQ_FOREACH(aif, &diagif_list, link) { if (strcmp(argv[i], aif->ifname) == 0) { - heading(text); + heading("%s", text); (*func)(aif); break; } @@ -436,7 +436,7 @@ diag_loop(int argc, char *argv[], const } } else { TAILQ_FOREACH(aif, &diagif_list, link) { - heading(text); + heading("%s", text); (*func)(aif); } } @@ -992,7 +992,7 @@ diag_vcc_loop(void (*func)(const struct TAILQ_FOREACH(aif, &diagif_list, link) { diagif_fetch_vcc(aif, fd); if (aif->vtab->count != 0) { - heading(text); + heading("%s", text); (*func)(aif); } } @@ -1003,7 +1003,7 @@ diag_vcc_loop(void (*func)(const struct if (strcmp(aif->ifname, argv[optind]) == 0) { diagif_fetch_vcc(aif, fd); if (aif->vtab->count != 0) { - heading(text); + heading("%s", text); (*func)(aif); } break; From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 17:33:44 2012 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 4C721106564A; Sun, 1 Jan 2012 17:33:44 +0000 (UTC) (envelope-from uqs@freebsd.org) Received: from acme.spoerlein.net (acme.spoerlein.net [IPv6:2a01:4f8:131:23c2::1]) by mx1.freebsd.org (Postfix) with ESMTP id AB28A8FC0A; Sun, 1 Jan 2012 17:33:43 +0000 (UTC) Received: from localhost (acme.spoerlein.net [IPv6:2a01:4f8:131:23c2::1]) by acme.spoerlein.net (8.14.4/8.14.4) with ESMTP id q01HXgYx074783 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Sun, 1 Jan 2012 18:33:42 +0100 (CET) (envelope-from uqs@freebsd.org) Date: Sun, 1 Jan 2012 18:33:42 +0100 From: Ulrich Spoerlein To: Ben Kaduk Message-ID: <20120101173342.GN83814@acme.spoerlein.net> Mail-Followup-To: Ulrich Spoerlein , Ben Kaduk , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201112301058.pBUAwFsw010478@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228990 - in head/usr.sbin: IPXrouted adduser bluetooth/btpand bluetooth/sdpd bootparamd/bootparamd bsnmpd/modules/snmp_bridge bsnmpd/modules/snmp_hostres bsnmpd/modules/snmp_wlan bsnmp... 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, 01 Jan 2012 17:33:44 -0000 On Fri, 2011-12-30 at 14:43:22 -0500, Ben Kaduk wrote: > On Fri, Dec 30, 2011 at 5:58 AM, Ulrich Spoerlein wrote: > > Modified: head/usr.sbin/cron/doc/CHANGES > > ============================================================================== > > --- head/usr.sbin/cron/doc/CHANGES      Fri Dec 30 10:45:00 2011        (r228989) > > +++ head/usr.sbin/cron/doc/CHANGES      Fri Dec 30 10:58:14 2011        (r228990) > > @@ -1,3 +1,6 @@ > > +$FreeBSD$ > > +-------- > > + > >  Vixie Cron             Changes from V2 to V3 > >  Paul Vixie > >  29-Dec-1993 > > @@ -20,7 +23,7 @@ be reread whenever it changes. > > > >  I also added a "-e" option to crontab(1).  Nine people also sent me diffs > >  to add this option, but I had already implemented it on my own.  I actually > > -released an interrim version (V2.2, I think) for limited testing, and got a > > +released an interim version (V2.2, I think) for limited testing, and got a > > Should we really be in the business of modifying Vixie's changelog? I'm replying here, but same goes for your comments on the other revision (thanks for all those, btw). Warning, rant ahead: Our current SVN repo is in an inconsistent state thanks to the dubious introduction of svn keywords. There are files in there, converted over via cvs2svn and never touched since, but our presubmit checks want to either see a $FreeBSD$ tag in modified files, or have fbsd:nokeywords set. The latter is kinda a no-brainer for everything under contrib/ but I'm struggling with what to do exactly for files that are non-contrib and may or may not be non-code. Should the keywords be set on $subdir/* or can I punch holes in the web of keywords as I see fit? (e.g. $subdir/{README,CHANGES,foo.txt}) What's the point then anyway? SVN doesn't track files, but changesets. Gah! Oh wait, this ain't about the $FreeBSD$ keyword, but the typo-fix? I'm sure that Vixie won't mind and do believe that correctness of spelling is a worthy goal as we always tout the quality of our documentation. FWIW, I'm not going to touch stuff under contrib/, etc. > >  /* > > - * Delete a rotated logfiles, when using clasic filenames. > > + * Delete a rotated logfiles, when using classic filenames. > > "a logfiles" is inconsistent. Without looking up the implementation, > I'm going to guess that "a rotated logfile" is correct. When proofreading the spell-checked output I focused too narrowly on just the typo that I fixed so that other typos in the same line/sentence mostly went unnoticed. Will do better in the next couple of commits. > >  */ > >  static void > >  delete_clasiclog(const char *archive_dir, const char *namepart, int numlog_c) > > > > Modified: head/usr.sbin/ntp/doc/ntp.conf.5 > > ============================================================================== > > --- head/usr.sbin/ntp/doc/ntp.conf.5    Fri Dec 30 10:45:00 2011        (r228989) > > +++ head/usr.sbin/ntp/doc/ntp.conf.5    Fri Dec 30 10:58:14 2011        (r228990) > > @@ -783,7 +783,7 @@ The remaining files are necessary only f > >  Autokey protocol. > >  .Pp > >  Certificates imported from OpenSSL or public certificate > > -authorities have certian limitations. > > > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > > Hmm, that's unfortunate. > Pulling out a svn client, it looks like: > usr.sbin/pkg_install/lib/plist.c changes a misspelled form to the > still-misspelled "occurrance" (not occurrence) Thanks, will follow up on that! > Thanks for doing this cleanup along with the encoding cleanup! > > -Ben Kaduk > From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 17:37:17 2012 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 B64F0106566C; Sun, 1 Jan 2012 17:37:17 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A07268FC0A; Sun, 1 Jan 2012 17:37: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 q01HbHAl022806; Sun, 1 Jan 2012 17:37:17 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01HbHjN022804; Sun, 1 Jan 2012 17:37:17 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201011737.q01HbHjN022804@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 17:37:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229176 - stable/9/sbin/ipf 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, 01 Jan 2012 17:37:17 -0000 Author: dim Date: Sun Jan 1 17:37:17 2012 New Revision: 229176 URL: http://svn.freebsd.org/changeset/base/229176 Log: MFC r228612 Use both NO_WFORMAT and NO_WARRAY_BOUNDS for sbin/ipf, it would be too disruptive to actually fix all the warnings, and the code hasn't been maintained for several years. Modified: stable/9/sbin/ipf/Makefile.inc Directory Properties: stable/9/sbin/ipf/ (props changed) Modified: stable/9/sbin/ipf/Makefile.inc ============================================================================== --- stable/9/sbin/ipf/Makefile.inc Sun Jan 1 17:27:31 2012 (r229175) +++ stable/9/sbin/ipf/Makefile.inc Sun Jan 1 17:37:17 2012 (r229176) @@ -1,6 +1,8 @@ # $FreeBSD$ WARNS?= 2 +NO_WFORMAT= +NO_WARRAY_BOUNDS= CFLAGS+= -I${.CURDIR}/../../../contrib/ipfilter CFLAGS+= -I${.CURDIR}/../../../contrib/ipfilter/tools From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 17:42:03 2012 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 3FF41106566C; Sun, 1 Jan 2012 17:42:03 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0FF5D8FC14; Sun, 1 Jan 2012 17:42:03 +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 q01Hg2W1022999; Sun, 1 Jan 2012 17:42:02 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01Hg2nC022996; Sun, 1 Jan 2012 17:42:02 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201011742.q01Hg2nC022996@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 17:42:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229177 - stable/9/sbin/dhclient 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, 01 Jan 2012 17:42:03 -0000 Author: dim Date: Sun Jan 1 17:42:02 2012 New Revision: 229177 URL: http://svn.freebsd.org/changeset/base/229177 Log: MFC r228614: In sbin/dhclient, work around warnings about the size argument to strlcpy appearing to be the size of the source buffer, instead of the destination. MFC r228615: In sbin/dhclient, since we know the size of the source strings anyway, we might as well use memcpy; strlcpy is really unnecessary here. Modified: stable/9/sbin/dhclient/clparse.c stable/9/sbin/dhclient/parse.c Directory Properties: stable/9/sbin/dhclient/ (props changed) Modified: stable/9/sbin/dhclient/clparse.c ============================================================================== --- stable/9/sbin/dhclient/clparse.c Sun Jan 1 17:37:17 2012 (r229176) +++ stable/9/sbin/dhclient/clparse.c Sun Jan 1 17:42:02 2012 (r229177) @@ -871,6 +871,7 @@ parse_string_list(FILE *cfile, struct st { int token; char *val; + size_t valsize; struct string_list *cur, *tmp; /* Find the last medium in the media list. */ @@ -888,10 +889,11 @@ parse_string_list(FILE *cfile, struct st return; } - tmp = new_string_list(strlen(val) + 1); + valsize = strlen(val) + 1; + tmp = new_string_list(valsize); if (tmp == NULL) error("no memory for string list entry."); - strlcpy(tmp->string, val, strlen(val) + 1); + memcpy(tmp->string, val, valsize); tmp->next = NULL; /* Store this medium at the end of the media list. */ Modified: stable/9/sbin/dhclient/parse.c ============================================================================== --- stable/9/sbin/dhclient/parse.c Sun Jan 1 17:37:17 2012 (r229176) +++ stable/9/sbin/dhclient/parse.c Sun Jan 1 17:42:02 2012 (r229177) @@ -116,6 +116,7 @@ char * parse_string(FILE *cfile) { char *val, *s; + size_t valsize; int token; token = next_token(&val, cfile); @@ -124,10 +125,11 @@ parse_string(FILE *cfile) skip_to_semi(cfile); return (NULL); } - s = malloc(strlen(val) + 1); + valsize = strlen(val) + 1; + s = malloc(valsize); if (!s) error("no memory for string %s.", val); - strlcpy(s, val, strlen(val) + 1); + memcpy(s, val, valsize); if (!parse_semi(cfile)) return (NULL); @@ -242,6 +244,7 @@ parse_numeric_aggregate(FILE *cfile, uns unsigned char *bufp = buf, *s = NULL; int token, count = 0; char *val, *t; + size_t valsize; pair c = NULL; if (!bufp && *max) { @@ -288,10 +291,11 @@ parse_numeric_aggregate(FILE *cfile, uns convert_num(s, val, base, size); s += size / 8; } else { - t = malloc(strlen(val) + 1); + valsize = strlen(val) + 1; + t = malloc(valsize); if (!t) error("no temp space for number."); - strlcpy(t, val, strlen(val) + 1); + memcpy(t, val, valsize); c = cons(t, c); } } while (++count != *max); From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 17:44:26 2012 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 BAE711065670; Sun, 1 Jan 2012 17:44:26 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A47E88FC08; Sun, 1 Jan 2012 17:44: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 q01HiQmB023125; Sun, 1 Jan 2012 17:44:26 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01HiQjU023123; Sun, 1 Jan 2012 17:44:26 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201011744.q01HiQjU023123@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 17:44:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229178 - stable/9/usr.bin/tar 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, 01 Jan 2012 17:44:26 -0000 Author: dim Date: Sun Jan 1 17:44:26 2012 New Revision: 229178 URL: http://svn.freebsd.org/changeset/base/229178 Log: MFC r228616: In usr.bin/tar/tree.c, if you really want to poke to NULL, you must use volatile, otherwise the indirection will not be emitted. Modified: stable/9/usr.bin/tar/tree.c Directory Properties: stable/9/usr.bin/tar/ (props changed) Modified: stable/9/usr.bin/tar/tree.c ============================================================================== --- stable/9/usr.bin/tar/tree.c Sun Jan 1 17:42:02 2012 (r229177) +++ stable/9/usr.bin/tar/tree.c Sun Jan 1 17:44:26 2012 (r229178) @@ -315,7 +315,7 @@ tree_next(struct tree *t) const char *msg = "Unable to continue traversing" " directory hierarchy after a fatal error."; write(2, msg, strlen(msg)); - *(int *)0 = 1; /* Deliberate SEGV; NULL pointer dereference. */ + *(volatile int *)0 = 1; /* Deliberate SEGV; NULL pointer dereference. */ exit(1); /* In case the SEGV didn't work. */ } From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 17:47:53 2012 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 69839106564A; Sun, 1 Jan 2012 17:47:53 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 53DC18FC0C; Sun, 1 Jan 2012 17:47:53 +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 q01HlrTe023276; Sun, 1 Jan 2012 17:47:53 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01HlrC8023274; Sun, 1 Jan 2012 17:47:53 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201011747.q01HlrC8023274@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 17:47:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229179 - stable/9/sbin/devd 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, 01 Jan 2012 17:47:53 -0000 Author: dim Date: Sun Jan 1 17:47:52 2012 New Revision: 229179 URL: http://svn.freebsd.org/changeset/base/229179 Log: MFC r228618 In sbin/devd/devd.h, 'event_proc' and 'eps' are declared as structs. In devd.hh, they are redeclared as classes. Fix the inconsistency. Modified: stable/9/sbin/devd/devd.hh Directory Properties: stable/9/sbin/devd/ (props changed) Modified: stable/9/sbin/devd/devd.hh ============================================================================== --- stable/9/sbin/devd/devd.hh Sun Jan 1 17:44:26 2012 (r229178) +++ stable/9/sbin/devd/devd.hh Sun Jan 1 17:47:52 2012 (r229179) @@ -65,7 +65,7 @@ private: * eps is short for event_proc_single. It is a single entry in an * event_proc. Each keyword needs its own subclass from eps. */ -class eps +struct eps { public: eps() {} @@ -125,7 +125,7 @@ private: std::string _cmd; }; -class event_proc +struct event_proc { public: event_proc(); From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 17:49:02 2012 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 563BD106567C; Sun, 1 Jan 2012 17:49:02 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail07.syd.optusnet.com.au (mail07.syd.optusnet.com.au [211.29.132.188]) by mx1.freebsd.org (Postfix) with ESMTP id E27378FC1B; Sun, 1 Jan 2012 17:49:01 +0000 (UTC) Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au (c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136]) by mail07.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q01Hmv03010424 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 2 Jan 2012 04:48:59 +1100 Date: Mon, 2 Jan 2012 04:48:57 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Dimitry Andric In-Reply-To: <4F008EA0.3080800@FreeBSD.org> Message-ID: <20120102041718.T54509@besplex.bde.org> References: <201112221503.pBMF3m0w021930@svn.freebsd.org> <20120101020442.GA94452@zim.MIT.EDU> <4F008EA0.3080800@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228801 - 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: Sun, 01 Jan 2012 17:49:02 -0000 On Sun, 1 Jan 2012, Dimitry Andric wrote: > On 2012-01-01 03:04, David Schultz wrote: >> On Thu, Dec 22, 2011, Dimitry Andric wrote: >>> Remove -mfancy-math from LIB32CPUFLAGS for amd64. It has been default >>> for our gcc since more than three years (see r181534, which is also in >>> stable/9 and stable/8). This flag used to be for the benefit of the >>> old >>> in-kernel math emulator, which was removed more than eight years ago. >> >> Quite the opposite, actually. gcc/freebsd used to be hard-coded to >> use -mno-fancy-math-387 by default, which was really only appropriate for >> FPUless x86 chips back when FreeBSD supported them. The makefile >> setting overrides the old gcc default. The flag isn't "for the >> benefit of the in-kernel math emulator"; it's actually to reap the >> benefits of *not* having an in-kernel math emulator! >> >> Do you know if clang has the correct default here, or if it picked up >> trunk gcc's bogus default? It doesn't seem to support the flag to >> change the behavior, and it seems to default to -mno-fancy-math-387. >> (The flag should only affect things when -ffast-math is also specified.) > > As far as I can see, clang always generates calls to sin(), cos() etc. > It never inlines them to direct 387 instructions. Isn't that what we > want? Yes (never inlining is what we want, since the i387 is slow and very innacurate near all multiples of pi/2). > In any case, I don't see a quick way of getting it to emit 387 > instructions directly. It simply looks like it is not supported. The > -funsafe-math-optimizations is not recognized, and the -ffast-math > option is accepted, but ignored. -ffast-math acts strangly for gcc too: - on i386 in FreeBSD-10.0-CURRENT, it gives inline sin(). This is prevented by -mno-fancy-math-387. Apparently, -mno-fancy-math-387 is not the default. - on amd64 in FreeBSD-9.0-BETA1, it doesn't give inline sin(), even on a long double arg. However, it does give inline sinl() on a long double arg. I think this doesn't depend on the FreeBSD version. It should depend on the arch -- the i387 keeps growing relatively slower up to at least core2, and there should be some large numbers in the tables to disfavour it more (but there aren't). The tables would also need to know the speed of the library implementation to make the correct decision based on speed. The decision is accidentally correct for amd64, because the library versions are still quite slow for long doubles, but quite fast for doubles provided the arch later than Athlon64, and very fast for floats provided the arch is later than Pentium1. Bruce From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 18:17:37 2012 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 DC4F3106564A; Sun, 1 Jan 2012 18:17:37 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C66DF8FC0A; Sun, 1 Jan 2012 18:17: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 q01IHbh9024265; Sun, 1 Jan 2012 18:17:37 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01IHbs5024263; Sun, 1 Jan 2012 18:17:37 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201011817.q01IHbs5024263@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 18:17:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229180 - stable/9/lib/libc/stdlib 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, 01 Jan 2012 18:17:38 -0000 Author: dim Date: Sun Jan 1 18:17:37 2012 New Revision: 229180 URL: http://svn.freebsd.org/changeset/base/229180 Log: MFC r227090: Fix a warning emitted by Clang. The size passed to strlcat() must depend on the input length, not the output length. Because the input and output buffers are equal in size, the resulting binary does not change at all. Modified: stable/9/lib/libc/stdlib/realpath.c Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/stdlib/realpath.c ============================================================================== --- stable/9/lib/libc/stdlib/realpath.c Sun Jan 1 17:47:52 2012 (r229179) +++ stable/9/lib/libc/stdlib/realpath.c Sun Jan 1 18:17:37 2012 (r229180) @@ -212,7 +212,8 @@ realpath(const char * __restrict path, c symlink[slen] = '/'; symlink[slen + 1] = 0; } - left_len = strlcat(symlink, left, sizeof(left)); + left_len = strlcat(symlink, left, + sizeof(symlink)); if (left_len >= sizeof(left)) { if (m) free(resolved); From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 18:25:17 2012 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 631DC106564A; Sun, 1 Jan 2012 18:25:17 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4D8428FC1D; Sun, 1 Jan 2012 18:25: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 q01IPHLc024563; Sun, 1 Jan 2012 18:25:17 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01IPHFC024561; Sun, 1 Jan 2012 18:25:17 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201011825.q01IPHFC024561@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 18:25:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229181 - stable/9/usr.bin/mt 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, 01 Jan 2012 18:25:17 -0000 Author: dim Date: Sun Jan 1 18:25:16 2012 New Revision: 229181 URL: http://svn.freebsd.org/changeset/base/229181 Log: MFC r228619: In usr.bin/mt/mt.c, the c_code member of struct commands should really be an unsigned long, since it will contain values of ioctl request codes. On 64-bit arches, these will not fit into an int. Modified: stable/9/usr.bin/mt/mt.c Directory Properties: stable/9/usr.bin/mt/ (props changed) Modified: stable/9/usr.bin/mt/mt.c ============================================================================== --- stable/9/usr.bin/mt/mt.c Sun Jan 1 18:17:37 2012 (r229180) +++ stable/9/usr.bin/mt/mt.c Sun Jan 1 18:25:16 2012 (r229181) @@ -75,7 +75,7 @@ __FBSDID("$FreeBSD$"); struct commands { const char *c_name; - int c_code; + unsigned long c_code; int c_ronly; int c_flags; } com[] = { From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 18:29:38 2012 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 742CD106566B; Sun, 1 Jan 2012 18:29:38 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5E3F18FC1C; Sun, 1 Jan 2012 18:29: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 q01ITc0n024736; Sun, 1 Jan 2012 18:29:38 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01ITciB024734; Sun, 1 Jan 2012 18:29:38 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201011829.q01ITciB024734@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 18:29:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229182 - stable/9/contrib/bzip2 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, 01 Jan 2012 18:29:38 -0000 Author: dim Date: Sun Jan 1 18:29:37 2012 New Revision: 229182 URL: http://svn.freebsd.org/changeset/base/229182 Log: MFC r228624: In contrib/bzip2/bzip2recover.c, use the correct printf length modifier for unsigned long long. Modified: stable/9/contrib/bzip2/bzip2recover.c Directory Properties: stable/9/contrib/bzip2/ (props changed) Modified: stable/9/contrib/bzip2/bzip2recover.c ============================================================================== --- stable/9/contrib/bzip2/bzip2recover.c Sun Jan 1 18:25:16 2012 (r229181) +++ stable/9/contrib/bzip2/bzip2recover.c Sun Jan 1 18:29:37 2012 (r229182) @@ -37,7 +37,7 @@ */ #ifdef __GNUC__ typedef unsigned long long int MaybeUInt64; -# define MaybeUInt64_FMT "%Lu" +# define MaybeUInt64_FMT "%llu" #else #ifdef _MSC_VER typedef unsigned __int64 MaybeUInt64; From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 18:36:42 2012 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 D4D081065675; Sun, 1 Jan 2012 18:36:42 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A3FCC8FC0C; Sun, 1 Jan 2012 18:36:42 +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 q01Iag6U024991; Sun, 1 Jan 2012 18:36:42 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01IagBW024985; Sun, 1 Jan 2012 18:36:42 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201011836.q01IagBW024985@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 18:36:42 +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: r229183 - in head/lib/clang: libllvmarminfo libllvmmipsinfo libllvmpowerpcinfo libllvmx86info 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, 01 Jan 2012 18:36:42 -0000 Author: dim Date: Sun Jan 1 18:36:42 2012 New Revision: 229183 URL: http://svn.freebsd.org/changeset/base/229183 Log: In several llvm library Makefiles, remove extraneous slashes at the end of SRCDIR definitions. MFC after: 3 days Modified: head/lib/clang/libllvmarminfo/Makefile head/lib/clang/libllvmmipsinfo/Makefile head/lib/clang/libllvmpowerpcinfo/Makefile head/lib/clang/libllvmx86info/Makefile Modified: head/lib/clang/libllvmarminfo/Makefile ============================================================================== --- head/lib/clang/libllvmarminfo/Makefile Sun Jan 1 18:29:37 2012 (r229182) +++ head/lib/clang/libllvmarminfo/Makefile Sun Jan 1 18:36:42 2012 (r229183) @@ -2,7 +2,7 @@ LIB= llvmarminfo -SRCDIR= lib/Target/ARM/TargetInfo/ +SRCDIR= lib/Target/ARM/TargetInfo INCDIR= lib/Target/ARM SRCS= ARMTargetInfo.cpp Modified: head/lib/clang/libllvmmipsinfo/Makefile ============================================================================== --- head/lib/clang/libllvmmipsinfo/Makefile Sun Jan 1 18:29:37 2012 (r229182) +++ head/lib/clang/libllvmmipsinfo/Makefile Sun Jan 1 18:36:42 2012 (r229183) @@ -2,7 +2,7 @@ LIB= llvmmipsinfo -SRCDIR= lib/Target/Mips/TargetInfo/ +SRCDIR= lib/Target/Mips/TargetInfo INCDIR= lib/Target/Mips SRCS= MipsTargetInfo.cpp Modified: head/lib/clang/libllvmpowerpcinfo/Makefile ============================================================================== --- head/lib/clang/libllvmpowerpcinfo/Makefile Sun Jan 1 18:29:37 2012 (r229182) +++ head/lib/clang/libllvmpowerpcinfo/Makefile Sun Jan 1 18:36:42 2012 (r229183) @@ -2,7 +2,7 @@ LIB= llvmpowerpcinfo -SRCDIR= lib/Target/PowerPC/TargetInfo/ +SRCDIR= lib/Target/PowerPC/TargetInfo INCDIR= lib/Target/PowerPC SRCS= PowerPCTargetInfo.cpp Modified: head/lib/clang/libllvmx86info/Makefile ============================================================================== --- head/lib/clang/libllvmx86info/Makefile Sun Jan 1 18:29:37 2012 (r229182) +++ head/lib/clang/libllvmx86info/Makefile Sun Jan 1 18:36:42 2012 (r229183) @@ -2,7 +2,7 @@ LIB= llvmx86info -SRCDIR= lib/Target/X86/TargetInfo/ +SRCDIR= lib/Target/X86/TargetInfo INCDIR= lib/Target/X86 SRCS= X86TargetInfo.cpp From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 18:42:00 2012 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 C03411065670; Sun, 1 Jan 2012 18:42:00 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A9A5D8FC1B; Sun, 1 Jan 2012 18:42: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 q01Ig0AW025285; Sun, 1 Jan 2012 18:42:00 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01Ig0GA025282; Sun, 1 Jan 2012 18:42:00 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201011842.q01Ig0GA025282@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 18:42:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229184 - stable/9/usr.bin/csup 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, 01 Jan 2012 18:42:00 -0000 Author: dim Date: Sun Jan 1 18:42:00 2012 New Revision: 229184 URL: http://svn.freebsd.org/changeset/base/229184 Log: MFC r228625: In usr.bin/csup/auth.c, use the correct number of bytes for zeroing the shared secret, and use long long format to snprintf a time_t. MFC r228626: In usr.bin/csup/proto.c, use the correct printf length modifier to print an off_t. MFC r228667: In usr.bin/csup/auth.c, cast time_t to intmax_t instead, and use the corresponding printf length modifier. Requested by: mdf Modified: stable/9/usr.bin/csup/auth.c stable/9/usr.bin/csup/proto.c Directory Properties: stable/9/usr.bin/csup/ (props changed) Modified: stable/9/usr.bin/csup/auth.c ============================================================================== --- stable/9/usr.bin/csup/auth.c Sun Jan 1 18:36:42 2012 (r229183) +++ stable/9/usr.bin/csup/auth.c Sun Jan 1 18:42:00 2012 (r229184) @@ -254,7 +254,7 @@ auth_makesecret(struct srvrecord *auth, MD5_Update(&md5, ":", 1); MD5_Update(&md5, auth->password, strlen(auth->password)); MD5_Final(md5sum, &md5); - memset(secret, 0, sizeof(secret)); + memset(secret, 0, MD5_CHARS_MAX); strcpy(secret, md5salt); auth_readablesum(md5sum, secret + strlen(md5salt)); } @@ -302,8 +302,9 @@ auth_makechallenge(struct config *config } gettimeofday(&tv, NULL); MD5_Init(&md5); - snprintf(buf, sizeof(buf), "%s:%ld:%ld:%ld:%d:%d", - inet_ntoa(laddr.sin_addr), tv.tv_sec, tv.tv_usec, random(), pid, ppid); + snprintf(buf, sizeof(buf), "%s:%jd:%ld:%ld:%d:%d", + inet_ntoa(laddr.sin_addr), (intmax_t)tv.tv_sec, tv.tv_usec, + random(), pid, ppid); MD5_Update(&md5, buf, strlen(buf)); MD5_Final(md5sum, &md5); auth_readablesum(md5sum, challenge); Modified: stable/9/usr.bin/csup/proto.c ============================================================================== --- stable/9/usr.bin/csup/proto.c Sun Jan 1 18:36:42 2012 (r229183) +++ stable/9/usr.bin/csup/proto.c Sun Jan 1 18:42:00 2012 (r229184) @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -751,7 +752,7 @@ proto_printf(struct stream *wr, const ch break; case 'O': off = va_arg(ap, off_t); - rv = stream_printf(wr, "%llu", off); + rv = stream_printf(wr, "%" PRId64, off); break; case 'S': s = va_arg(ap, char *); From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 18:45:59 2012 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 E72B71065672; Sun, 1 Jan 2012 18:45:59 +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 B90388FC0C; Sun, 1 Jan 2012 18:45: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 q01Ijxh6025447; Sun, 1 Jan 2012 18:45:59 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01IjxQS025445; Sun, 1 Jan 2012 18:45:59 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201011845.q01IjxQS025445@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 1 Jan 2012 18:45: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: r229185 - 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, 01 Jan 2012 18:46:00 -0000 Author: kib Date: Sun Jan 1 18:45:59 2012 New Revision: 229185 URL: http://svn.freebsd.org/changeset/base/229185 Log: Avoid double-unlock or double unreference for ndp->ni_dvp when the vnode dp lock upgrade right after the 'success' label fails. In collaboration with: pho MFC after: 1 week Modified: head/sys/kern/vfs_lookup.c Modified: head/sys/kern/vfs_lookup.c ============================================================================== --- head/sys/kern/vfs_lookup.c Sun Jan 1 18:42:00 2012 (r229184) +++ head/sys/kern/vfs_lookup.c Sun Jan 1 18:45:59 2012 (r229185) @@ -508,12 +508,14 @@ lookup(struct nameidata *ndp) int dvfslocked; /* VFS Giant state for parent */ int tvfslocked; int lkflags_save; + int ni_dvp_unlocked; /* * Setup: break out flag bits into variables. */ dvfslocked = (ndp->ni_cnd.cn_flags & GIANTHELD) != 0; vfslocked = 0; + ni_dvp_unlocked = 0; ndp->ni_cnd.cn_flags &= ~GIANTHELD; wantparent = cnp->cn_flags & (LOCKPARENT | WANTPARENT); KASSERT(cnp->cn_nameiop == LOOKUP || wantparent, @@ -861,8 +863,10 @@ unionlookup: /* * Symlink code always expects an unlocked dvp. */ - if (ndp->ni_dvp != ndp->ni_vp) + if (ndp->ni_dvp != ndp->ni_vp) { VOP_UNLOCK(ndp->ni_dvp, 0); + ni_dvp_unlocked = 1; + } goto success; } @@ -909,14 +913,17 @@ nextname: VREF(ndp->ni_startdir); } if (!wantparent) { + ni_dvp_unlocked = 2; if (ndp->ni_dvp != dp) vput(ndp->ni_dvp); else vrele(ndp->ni_dvp); VFS_UNLOCK_GIANT(dvfslocked); dvfslocked = 0; - } else if ((cnp->cn_flags & LOCKPARENT) == 0 && ndp->ni_dvp != dp) + } else if ((cnp->cn_flags & LOCKPARENT) == 0 && ndp->ni_dvp != dp) { VOP_UNLOCK(ndp->ni_dvp, 0); + ni_dvp_unlocked = 1; + } if (cnp->cn_flags & AUDITVNODE1) AUDIT_ARG_VNODE1(dp); @@ -945,10 +952,12 @@ success: return (0); bad2: - if (dp != ndp->ni_dvp) - vput(ndp->ni_dvp); - else - vrele(ndp->ni_dvp); + if (ni_dvp_unlocked != 2) { + if (dp != ndp->ni_dvp && !ni_dvp_unlocked) + vput(ndp->ni_dvp); + else + vrele(ndp->ni_dvp); + } bad: if (!dpunlocked) vput(dp); From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 18:54:30 2012 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 46C3E1065672; Sun, 1 Jan 2012 18:54:30 +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 307588FC08; Sun, 1 Jan 2012 18:54:30 +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 q01IsUk5025751; Sun, 1 Jan 2012 18:54:30 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01IsTSl025748; Sun, 1 Jan 2012 18:54:29 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201011854.q01IsTSl025748@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 1 Jan 2012 18:54:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229186 - in stable/9/sys: amd64/amd64 i386/i386 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, 01 Jan 2012 18:54:30 -0000 Author: kib Date: Sun Jan 1 18:54:29 2012 New Revision: 229186 URL: http://svn.freebsd.org/changeset/base/229186 Log: MFC r227394: Stopped process may legitimately have some threads sleeping and not suspended, if the sleep is uninterruptible. MFC r227442: Weaken the part of assertions added in the r227394. Only check that the process state is stopped. Modified: stable/9/sys/amd64/amd64/machdep.c stable/9/sys/i386/i386/machdep.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/amd64/amd64/machdep.c ============================================================================== --- stable/9/sys/amd64/amd64/machdep.c Sun Jan 1 18:45:59 2012 (r229185) +++ stable/9/sys/amd64/amd64/machdep.c Sun Jan 1 18:54:29 2012 (r229186) @@ -2018,7 +2018,8 @@ int fill_fpregs(struct thread *td, struct fpreg *fpregs) { - KASSERT(td == curthread || TD_IS_SUSPENDED(td), + KASSERT(td == curthread || TD_IS_SUSPENDED(td) || + P_SHOULDSTOP(td->td_proc), ("not suspended thread %p", td)); fpugetregs(td); fill_fpregs_xmm(&td->td_pcb->pcb_user_save, fpregs); Modified: stable/9/sys/i386/i386/machdep.c ============================================================================== --- stable/9/sys/i386/i386/machdep.c Sun Jan 1 18:45:59 2012 (r229185) +++ stable/9/sys/i386/i386/machdep.c Sun Jan 1 18:54:29 2012 (r229186) @@ -3270,7 +3270,8 @@ int fill_fpregs(struct thread *td, struct fpreg *fpregs) { - KASSERT(td == curthread || TD_IS_SUSPENDED(td), + KASSERT(td == curthread || TD_IS_SUSPENDED(td) || + P_SHOULDSTOP(td->td_proc), ("not suspended thread %p", td)); #ifdef DEV_NPX npxgetregs(td); From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 18:59:36 2012 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 05E9C106566B; Sun, 1 Jan 2012 18:59:36 +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 E45E38FC15; Sun, 1 Jan 2012 18:59: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 q01IxZld025982; Sun, 1 Jan 2012 18:59:35 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01IxZSM025979; Sun, 1 Jan 2012 18:59:35 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201011859.q01IxZSM025979@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 1 Jan 2012 18:59:35 +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: r229187 - in stable/8/sys: amd64/amd64 i386/i386 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, 01 Jan 2012 18:59:36 -0000 Author: kib Date: Sun Jan 1 18:59:35 2012 New Revision: 229187 URL: http://svn.freebsd.org/changeset/base/229187 Log: MFC r227394: Stopped process may legitimately have some threads sleeping and not suspended, if the sleep is uninterruptible. MFC r227442: Weaken the part of assertions added in the r227394. Only check that the process state is stopped. Modified: stable/8/sys/amd64/amd64/machdep.c stable/8/sys/i386/i386/machdep.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/amd64/amd64/machdep.c ============================================================================== --- stable/8/sys/amd64/amd64/machdep.c Sun Jan 1 18:54:29 2012 (r229186) +++ stable/8/sys/amd64/amd64/machdep.c Sun Jan 1 18:59:35 2012 (r229187) @@ -1986,7 +1986,8 @@ int fill_fpregs(struct thread *td, struct fpreg *fpregs) { - KASSERT(td == curthread || TD_IS_SUSPENDED(td), + KASSERT(td == curthread || TD_IS_SUSPENDED(td) || + P_SHOULDSTOP(td->td_proc), ("not suspended thread %p", td)); fpugetregs(td); fill_fpregs_xmm(&td->td_pcb->pcb_user_save, fpregs); Modified: stable/8/sys/i386/i386/machdep.c ============================================================================== --- stable/8/sys/i386/i386/machdep.c Sun Jan 1 18:54:29 2012 (r229186) +++ stable/8/sys/i386/i386/machdep.c Sun Jan 1 18:59:35 2012 (r229187) @@ -3220,7 +3220,8 @@ int fill_fpregs(struct thread *td, struct fpreg *fpregs) { - KASSERT(td == curthread || TD_IS_SUSPENDED(td), + KASSERT(td == curthread || TD_IS_SUSPENDED(td) || + P_SHOULDSTOP(td->td_proc), ("not suspended thread %p", td)); #ifdef DEV_NPX npxgetregs(td); From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 19:05:15 2012 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 EE80E1065670; Sun, 1 Jan 2012 19:05:15 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D8E0E8FC0C; Sun, 1 Jan 2012 19:05: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 q01J5FJr026197; Sun, 1 Jan 2012 19:05:15 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01J5F1v026195; Sun, 1 Jan 2012 19:05:15 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201011905.q01J5F1v026195@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 19:05:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229188 - stable/9/contrib/ee 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, 01 Jan 2012 19:05:16 -0000 Author: dim Date: Sun Jan 1 19:05:15 2012 New Revision: 229188 URL: http://svn.freebsd.org/changeset/base/229188 Log: MFC r228627: In contrib/ee/ee.c, fix a few warnings about format strings not being literals. Also, change the direction argument to move_rel() from char to int; K&R function definions cause it to be promoted to an int anyway, and this way we avoid clang warning about it. Modified: stable/9/contrib/ee/ee.c Directory Properties: stable/9/contrib/ee/ (props changed) Modified: stable/9/contrib/ee/ee.c ============================================================================== --- stable/9/contrib/ee/ee.c Sun Jan 1 18:59:35 2012 (r229187) +++ stable/9/contrib/ee/ee.c Sun Jan 1 19:05:15 2012 (r229188) @@ -307,7 +307,7 @@ void undel_word P_((void)); void del_line P_((void)); void undel_line P_((void)); void adv_word P_((void)); -void move_rel P_((char direction, int lines)); +void move_rel P_((int direction, int lines)); void eol P_((void)); void bol P_((void)); void adv_line P_((void)); @@ -2105,10 +2105,10 @@ char *arguments[]; else if (!strcmp("-?", buff)) { fprintf(stderr, usage0, arguments[0]); - fprintf(stderr, usage1); - fprintf(stderr, usage2); - fprintf(stderr, usage3); - fprintf(stderr, usage4); + fputs(usage1, stderr); + fputs(usage2, stderr); + fputs(usage3, stderr); + fputs(usage4, stderr); exit(1); } else if ((*buff == '+') && (start_at_line == NULL)) @@ -2939,7 +2939,7 @@ while ((position < curr_line->line_lengt void move_rel(direction, lines) /* move relative to current line */ -char direction; +int direction; int lines; { int i; @@ -3242,7 +3242,7 @@ char *string; /* string containing user } if (shell_fork) { - printf(continue_msg); + fputs(continue_msg, stdout); fflush(stdout); while ((in = getchar()) != '\n') ; From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 19:08:57 2012 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 569FF106564A; Sun, 1 Jan 2012 19:08: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 408DA8FC0A; Sun, 1 Jan 2012 19:08: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 q01J8vXP026376; Sun, 1 Jan 2012 19:08:57 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01J8vnu026374; Sun, 1 Jan 2012 19:08:57 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201011908.q01J8vnu026374@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 1 Jan 2012 19:08:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229189 - stable/9/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: Sun, 01 Jan 2012 19:08:57 -0000 Author: kib Date: Sun Jan 1 19:08:56 2012 New Revision: 229189 URL: http://svn.freebsd.org/changeset/base/229189 Log: MFC r227529: Remove the condition that is always true. Modified: stable/9/sys/vm/vm_pager.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/vm/vm_pager.c ============================================================================== --- stable/9/sys/vm/vm_pager.c Sun Jan 1 19:05:15 2012 (r229188) +++ stable/9/sys/vm/vm_pager.c Sun Jan 1 19:08:56 2012 (r229189) @@ -188,7 +188,7 @@ vm_pager_init() * Initialize known pagers */ for (pgops = pagertab; pgops < &pagertab[npagers]; pgops++) - if (pgops && ((*pgops)->pgo_init != NULL)) + if ((*pgops)->pgo_init != NULL) (*(*pgops)->pgo_init) (); } From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 19:11:48 2012 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 7CA8B106566B; Sun, 1 Jan 2012 19:11:48 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4C5D98FC14; Sun, 1 Jan 2012 19:11:48 +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 q01JBmuZ026519; Sun, 1 Jan 2012 19:11:48 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01JBm11026516; Sun, 1 Jan 2012 19:11:48 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201011911.q01JBm11026516@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 19:11:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229190 - stable/9/usr.bin/gprof 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, 01 Jan 2012 19:11:48 -0000 Author: dim Date: Sun Jan 1 19:11:47 2012 New Revision: 229190 URL: http://svn.freebsd.org/changeset/base/229190 Log: MFC r228628: In usr.bin/gprof/aout.c, use the correct printf length modifier for a uint32_t. MFC r228629: More fixes for correct printf length modifiers usr.bin/gprof. Modified: stable/9/usr.bin/gprof/aout.c stable/9/usr.bin/gprof/arcs.c Directory Properties: stable/9/usr.bin/gprof/ (props changed) Modified: stable/9/usr.bin/gprof/aout.c ============================================================================== --- stable/9/usr.bin/gprof/aout.c Sun Jan 1 19:08:56 2012 (r229189) +++ stable/9/usr.bin/gprof/aout.c Sun Jan 1 19:11:47 2012 (r229190) @@ -134,7 +134,7 @@ getsymtab(FILE *nfile, const char *filen askfor = nname + 1; nl = (nltype *) calloc( askfor , sizeof(nltype) ); if (nl == 0) - errx( 1 , "no room for %d bytes of symbol table" , + errx( 1 , "no room for %zu bytes of symbol table" , askfor * sizeof(nltype) ); /* pass2 - read symbols */ @@ -175,7 +175,7 @@ gettextspace(FILE *nfile) textspace = (u_char *) malloc( xbuf.a_text ); if ( textspace == 0 ) { - warnx("no room for %lu bytes of text space: can't do -c" , + warnx("no room for %u bytes of text space: can't do -c" , xbuf.a_text ); return; } Modified: stable/9/usr.bin/gprof/arcs.c ============================================================================== --- stable/9/usr.bin/gprof/arcs.c Sun Jan 1 19:08:56 2012 (r229189) +++ stable/9/usr.bin/gprof/arcs.c Sun Jan 1 19:11:47 2012 (r229190) @@ -378,7 +378,7 @@ cyclelink() */ cyclenl = (nltype *) calloc( ncycle + 1 , sizeof( nltype ) ); if ( cyclenl == 0 ) - errx( 1 , "no room for %d bytes of cycle headers" , + errx( 1 , "no room for %zu bytes of cycle headers" , ( ncycle + 1 ) * sizeof( nltype ) ); /* * now link cycles to true cycleheads, @@ -481,7 +481,7 @@ cycleanalyze() done = FALSE; cyclestack = (arctype **) calloc( size + 1 , sizeof( arctype *) ); if ( cyclestack == 0 ) - errx( 1, "no room for %d bytes of cycle stack" , + errx( 1, "no room for %zu bytes of cycle stack" , ( size + 1 ) * sizeof( arctype * ) ); # ifdef DEBUG if ( debug & BREAKCYCLE ) { @@ -599,7 +599,7 @@ addcycle( stkstart , stkend ) clp = (cltype *) calloc( 1 , sizeof ( cltype ) + ( size - 1 ) * sizeof( arctype * ) ); if ( clp == 0 ) { - warnx( "no room for %d bytes of subcycle storage" , + warnx( "no room for %zu bytes of subcycle storage" , sizeof ( cltype ) + ( size - 1 ) * sizeof( arctype * ) ); return( FALSE ); } From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 19:12:07 2012 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 CFA641065670; Sun, 1 Jan 2012 19:12:07 +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 B9A208FC0C; Sun, 1 Jan 2012 19:12: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 q01JC72Y026567; Sun, 1 Jan 2012 19:12:07 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01JC778026565; Sun, 1 Jan 2012 19:12:07 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201011912.q01JC778026565@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 1 Jan 2012 19:12:07 +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: r229191 - 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: Sun, 01 Jan 2012 19:12:07 -0000 Author: kib Date: Sun Jan 1 19:12:07 2012 New Revision: 229191 URL: http://svn.freebsd.org/changeset/base/229191 Log: MFC r227529: Remove the condition that is always true. Modified: stable/8/sys/vm/vm_pager.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/vm/vm_pager.c ============================================================================== --- stable/8/sys/vm/vm_pager.c Sun Jan 1 19:11:47 2012 (r229190) +++ stable/8/sys/vm/vm_pager.c Sun Jan 1 19:12:07 2012 (r229191) @@ -190,7 +190,7 @@ vm_pager_init() * Initialize known pagers */ for (pgops = pagertab; pgops < &pagertab[npagers]; pgops++) - if (pgops && ((*pgops)->pgo_init != NULL)) + if ((*pgops)->pgo_init != NULL) (*(*pgops)->pgo_init) (); } From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 19:15:53 2012 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 7665C106566C; Sun, 1 Jan 2012 19:15:53 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6107D8FC15; Sun, 1 Jan 2012 19:15:53 +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 q01JFrVb026744; Sun, 1 Jan 2012 19:15:53 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01JFrl6026742; Sun, 1 Jan 2012 19:15:53 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201011915.q01JFrl6026742@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 19:15:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229192 - stable/9/usr.bin/hexdump 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, 01 Jan 2012 19:15:53 -0000 Author: dim Date: Sun Jan 1 19:15:52 2012 New Revision: 229192 URL: http://svn.freebsd.org/changeset/base/229192 Log: MFC r228636: Correct a logic error in usr.bin/hexdump/conv.c, found by clang. Whenever the conv_c() function encounters an incomplete multibyte char, it peeks ahead. It also sets p to peekbuf, to indicate it is still processing the incomplete character. However, on the next retry, it compares buf against peekbuf, which always returns false, since both buf and peekbuf are local char arrays, whose addresses are never the same. Fix this by comparing against p instead, which was the intention. Also turn peekbuf into an array of u_char, to prevent conversion warnings. Modified: stable/9/usr.bin/hexdump/conv.c Directory Properties: stable/9/usr.bin/hexdump/ (props changed) Modified: stable/9/usr.bin/hexdump/conv.c ============================================================================== --- stable/9/usr.bin/hexdump/conv.c Sun Jan 1 19:12:07 2012 (r229191) +++ stable/9/usr.bin/hexdump/conv.c Sun Jan 1 19:15:52 2012 (r229192) @@ -53,7 +53,7 @@ conv_c(PR *pr, u_char *p, size_t bufsize wchar_t wc; size_t clen, oclen; int converr, pad, width; - char peekbuf[MB_LEN_MAX]; + u_char peekbuf[MB_LEN_MAX]; if (pr->mbleft > 0) { str = "**"; @@ -103,7 +103,7 @@ retry: if (clen == 0) clen = 1; else if (clen == (size_t)-1 || (clen == (size_t)-2 && - buf == peekbuf)) { + p == peekbuf)) { memset(&pr->mbstate, 0, sizeof(pr->mbstate)); wc = *p; clen = 1; From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 19:19:49 2012 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 279CE106566C; Sun, 1 Jan 2012 19:19:49 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 124C38FC0A; Sun, 1 Jan 2012 19:19: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 q01JJmsr026920; Sun, 1 Jan 2012 19:19:48 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01JJmDh026917; Sun, 1 Jan 2012 19:19:48 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201011919.q01JJmDh026917@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 19:19:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229193 - in stable/9/sbin: hastctl hastd 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, 01 Jan 2012 19:19:49 -0000 Author: dim Date: Sun Jan 1 19:19:48 2012 New Revision: 229193 URL: http://svn.freebsd.org/changeset/base/229193 Log: MFC r228712: Use NO_WCAST_ALIGN for usr.bin/hastctl and usr.bin/hastd; the alignment warnings in sbin/hastd/lzf.c are only emitted for i386 and amd64, and there they can be safely ignored. Modified: stable/9/sbin/hastctl/Makefile stable/9/sbin/hastd/Makefile Directory Properties: stable/9/sbin/hastctl/ (props changed) stable/9/sbin/hastd/ (props changed) Modified: stable/9/sbin/hastctl/Makefile ============================================================================== --- stable/9/sbin/hastctl/Makefile Sun Jan 1 19:15:52 2012 (r229192) +++ stable/9/sbin/hastctl/Makefile Sun Jan 1 19:19:48 2012 (r229193) @@ -20,6 +20,7 @@ SRCS+= y.tab.h MAN= hastctl.8 NO_WFORMAT= +NO_WCAST_ALIGN= CFLAGS+=-I${.CURDIR}/../hastd CFLAGS+=-DHAVE_CAPSICUM CFLAGS+=-DINET Modified: stable/9/sbin/hastd/Makefile ============================================================================== --- stable/9/sbin/hastd/Makefile Sun Jan 1 19:15:52 2012 (r229192) +++ stable/9/sbin/hastd/Makefile Sun Jan 1 19:19:48 2012 (r229193) @@ -20,6 +20,7 @@ SRCS+= y.tab.h MAN= hastd.8 hast.conf.5 NO_WFORMAT= +NO_WCAST_ALIGN= CFLAGS+=-I${.CURDIR} CFLAGS+=-DHAVE_CAPSICUM CFLAGS+=-DPROTO_TCP_DEFAULT_PORT=8457 From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 19:25:44 2012 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 B32CC106564A; Sun, 1 Jan 2012 19:25:44 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 639378FC15; Sun, 1 Jan 2012 19:25: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 q01JPi4H027147; Sun, 1 Jan 2012 19:25:44 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01JPiRd027145; Sun, 1 Jan 2012 19:25:44 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201011925.q01JPiRd027145@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 19:25:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229194 - stable/9/usr.bin/indent 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, 01 Jan 2012 19:25:44 -0000 Author: dim Date: Sun Jan 1 19:25:43 2012 New Revision: 229194 URL: http://svn.freebsd.org/changeset/base/229194 Log: MFC r228639: In usr.bin/indent/io.c, fix a few warnings about format strings not being literals. Modified: stable/9/usr.bin/indent/io.c Directory Properties: stable/9/usr.bin/indent/ (props changed) Modified: stable/9/usr.bin/indent/io.c ============================================================================== --- stable/9/usr.bin/indent/io.c Sun Jan 1 19:19:48 2012 (r229193) +++ stable/9/usr.bin/indent/io.c Sun Jan 1 19:25:43 2012 (r229194) @@ -581,12 +581,12 @@ diag2(int level, const char *msg) found_err = 1; if (output == stdout) { fprintf(stdout, "/**INDENT** %s@%d: ", level == 0 ? "Warning" : "Error", line_no); - fprintf(stdout, msg); + fprintf(stdout, "%s", msg); fprintf(stdout, " */\n"); } else { fprintf(stderr, "%s@%d: ", level == 0 ? "Warning" : "Error", line_no); - fprintf(stderr, msg); + fprintf(stderr, "%s", msg); fprintf(stderr, "\n"); } } From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 20:09:05 2012 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 B2811106564A; Sun, 1 Jan 2012 20:09:05 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 838DE8FC08; Sun, 1 Jan 2012 20:09:05 +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 q01K95dY028502; Sun, 1 Jan 2012 20:09:05 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01K95IO028499; Sun, 1 Jan 2012 20:09:05 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201012009.q01K95IO028499@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 20:09: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: r229195 - head/contrib/less 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, 01 Jan 2012 20:09:05 -0000 Author: dim Date: Sun Jan 1 20:09:05 2012 New Revision: 229195 URL: http://svn.freebsd.org/changeset/base/229195 Log: Revert r228645, which casts away a number of const conversion warnings in contrib/less. I will fix those more properly in the next commit. Modified: head/contrib/less/command.c head/contrib/less/prompt.c Modified: head/contrib/less/command.c ============================================================================== --- head/contrib/less/command.c Sun Jan 1 19:25:43 2012 (r229194) +++ head/contrib/less/command.c Sun Jan 1 20:09:05 2012 (r229195) @@ -1461,7 +1461,7 @@ commands() error("Command not available", NULL_PARG); break; } - start_mca(A_EXAMINE, "Examine: ", (void*)ml_examine, 0); + start_mca(A_EXAMINE, "Examine: ", ml_examine, 0); c = getcc(); goto again; #else @@ -1491,7 +1491,7 @@ commands() error("WARNING: This file was viewed via LESSOPEN", NULL_PARG); } - start_mca(A_SHELL, "!", (void*)ml_shell, 0); + start_mca(A_SHELL, "!", ml_shell, 0); /* * Expand the editor prototype string * and pass it to the system to execute. @@ -1655,7 +1655,7 @@ commands() error("Command not available", NULL_PARG); break; } - start_mca(A_SHELL, "!", (void*)ml_shell, 0); + start_mca(A_SHELL, "!", ml_shell, 0); c = getcc(); goto again; #else @@ -1706,7 +1706,7 @@ commands() if (badmark(c)) break; pipec = c; - start_mca(A_PIPE, "!", (void*)ml_shell, 0); + start_mca(A_PIPE, "!", ml_shell, 0); c = getcc(); goto again; #else Modified: head/contrib/less/prompt.c ============================================================================== --- head/contrib/less/prompt.c Sun Jan 1 19:25:43 2012 (r229194) +++ head/contrib/less/prompt.c Sun Jan 1 20:09:05 2012 (r229195) @@ -555,7 +555,7 @@ pr_expand(proto, maxwidth) public char * eq_message() { - return (pr_expand((char*)eqproto, 0)); + return (pr_expand(eqproto, 0)); } /* @@ -572,7 +572,7 @@ pr_string() type = (!less_is_more) ? pr_type : pr_type ? 0 : 1; prompt = pr_expand((ch_getflags() & CH_HELPFILE) ? - (char*)hproto : prproto[type], + hproto : prproto[type], sc_width-so_s_width-so_e_width-2); new_file = 0; return (prompt); @@ -584,5 +584,5 @@ pr_string() public char * wait_message() { - return (pr_expand((char*)wproto, sc_width-so_s_width-so_e_width-2)); + return (pr_expand(wproto, sc_width-so_s_width-so_e_width-2)); } From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 20:13:03 2012 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 4DABC106566C; Sun, 1 Jan 2012 20:13:03 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 381FD8FC14; Sun, 1 Jan 2012 20:13:03 +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 q01KD35M028665; Sun, 1 Jan 2012 20:13:03 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01KD3QK028662; Sun, 1 Jan 2012 20:13:03 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201012013.q01KD3QK028662@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 20:13: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: r229196 - head/contrib/less 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, 01 Jan 2012 20:13:03 -0000 Author: dim Date: Sun Jan 1 20:13:02 2012 New Revision: 229196 URL: http://svn.freebsd.org/changeset/base/229196 Log: Redo r228645, but instead of casting away const conversion warnings in contrib/less, add a few const qualifiers in the right places. Suggested by: das MFC after: 1 week Modified: head/contrib/less/command.c head/contrib/less/prompt.c Modified: head/contrib/less/command.c ============================================================================== --- head/contrib/less/command.c Sun Jan 1 20:09:05 2012 (r229195) +++ head/contrib/less/command.c Sun Jan 1 20:13:02 2012 (r229196) @@ -105,7 +105,7 @@ cmd_exec() start_mca(action, prompt, mlist, cmdflags) int action; char *prompt; - void *mlist; + void constant *mlist; int cmdflags; { mca = action; @@ -686,7 +686,7 @@ make_display() static void prompt() { - register char *p; + register char constant *p; if (ungot != NULL) { Modified: head/contrib/less/prompt.c ============================================================================== --- head/contrib/less/prompt.c Sun Jan 1 20:09:05 2012 (r229195) +++ head/contrib/less/prompt.c Sun Jan 1 20:13:02 2012 (r229196) @@ -394,9 +394,9 @@ protochar(c, where, iseditproto) * where to resume parsing the string. * We must keep track of nested IFs and skip them properly. */ - static char * + static char constant * skipcond(p) - register char *p; + register char constant *p; { register int iflevel; @@ -452,9 +452,9 @@ skipcond(p) /* * Decode a char that represents a position on the screen. */ - static char * + static char constant * wherechar(p, wp) - char *p; + char constant *p; int *wp; { switch (*p) @@ -478,10 +478,10 @@ wherechar(p, wp) */ public char * pr_expand(proto, maxwidth) - char *proto; + char constant *proto; int maxwidth; { - register char *p; + register char constant *p; register int c; int where; From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 20:26:11 2012 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 CFD2B1065673; Sun, 1 Jan 2012 20:26:11 +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 BA2CF8FC0C; Sun, 1 Jan 2012 20:26: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 q01KQBAS029160; Sun, 1 Jan 2012 20:26:11 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01KQBS5029156; Sun, 1 Jan 2012 20:26:11 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201201012026.q01KQBS5029156@svn.freebsd.org> From: Ed Schouten Date: Sun, 1 Jan 2012 20:26: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: r229198 - in head: share/man/man9 sys/conf sys/libkern sys/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: Sun, 01 Jan 2012 20:26:11 -0000 Author: ed Date: Sun Jan 1 20:26:11 2012 New Revision: 229198 URL: http://svn.freebsd.org/changeset/base/229198 Log: Introducing memcchr(3). It seems two of the file system drivers we have in the tree, namely ufs and ext3, use a function called `skpc()'. The meaning of this function does not seem to be documented in FreeBSD, but it turns out one needs to be a VAX programmer to understand what it does. SPKC is an instruction on the VAX that does the opposite of memchr(). It searches for the non-equal character. Add a new function called memcchr() to the tree that has the following advantages over skpc(): - It has a name that makes more sense than skpc(). Just like strcspn() matches the complement of strspn(), memcchr() is the complement of memchr(). - It is faster than skpc(). Similar to our strlen() in libc, it compares entire words, instead of single bytes. It seems that for this routine this yields a sixfold performance increase on amd64. - It has a man page. Added: head/share/man/man9/memcchr.3 (contents, props changed) head/sys/libkern/memcchr.c (contents, props changed) Modified: head/sys/conf/files head/sys/sys/libkern.h Added: head/share/man/man9/memcchr.3 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man9/memcchr.3 Sun Jan 1 20:26:11 2012 (r229198) @@ -0,0 +1,59 @@ +.\" Copyright (c) 2012 Ed Schouten +.\" 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 THE AUTHOR AND CONTRIBUTORS ``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 THE AUTHOR 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. +.\" +.\" $FreeBSD$ +.\" +.Dd January 1, 2012 +.Dt MEMCCHR 9 +.Os +.Sh NAME +.Nm memcchr +.Nd locate the complement of a byte in byte string +.Sh SYNOPSIS +.In sys/libkern.h +.Ft void * +.Fn memcchr "const void *b" "int c" "size_t len" +.Sh DESCRIPTION +The +.Fn memcchr +function locates the first occurrence of a byte unequal to +.Fa c +(converted to an +.Vt "unsigned char" ) +in string +.Fa b . +.Sh RETURN VALUES +The +.Fn memcchr +function return a pointer to the byte located, or NULL if no such byte +exists within +.Fa len +bytes. +.Sh SEE ALSO +.Xr memchr 3 +.Sh HISTORY +The +.Fn memcchr +function first appeared in +.Fx 10.0 . Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sun Jan 1 20:18:40 2012 (r229197) +++ head/sys/conf/files Sun Jan 1 20:26:11 2012 (r229198) @@ -2557,6 +2557,7 @@ libkern/inet_ntoa.c standard libkern/inet_ntop.c standard libkern/inet_pton.c standard libkern/mcount.c optional profiling-routine +libkern/memcchr.c standard libkern/memcmp.c standard libkern/qsort.c standard libkern/qsort_r.c standard Added: head/sys/libkern/memcchr.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/libkern/memcchr.c Sun Jan 1 20:26:11 2012 (r229198) @@ -0,0 +1,115 @@ +/*- + * Copyright (c) 2012 Ed Schouten + * 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 THE AUTHOR AND CONTRIBUTORS ``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 THE AUTHOR 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +/* + * memcchr(): find first character in buffer not matching `c'. + * + * This function performs the complement of memchr(). To provide decent + * performance, this function compares data from the buffer one word at + * a time. + * + * This code is inspired by libc's strlen(), written by Xin Li. + */ + +#if LONG_BIT != 32 && LONG_BIT != 64 +#error Unsupported word size +#endif + +#define LONGPTR_MASK (sizeof(long) - 1) + +#define TESTBYTE \ + do { \ + if (*p != (unsigned char)c) \ + goto done; \ + p++; \ + } while (0) + +void * +memcchr(const void *begin, int c, size_t n) +{ + const unsigned long *lp; + const unsigned char *p, *end; + unsigned long word; + + /* Four or eight repetitions of `c'. */ + word = (unsigned char)c; + word |= word << 8; + word |= word << 16; +#if LONG_BIT >= 64 + word |= word << 32; +#endif + + /* Don't perform memory I/O when passing a zero-length buffer. */ + if (n == 0) + return (NULL); + + /* + * First determine whether there is a character unequal to `c' + * in the first word. As this word may contain bytes before + * `begin', we may execute this loop spuriously. + */ + lp = (const unsigned long *)((uintptr_t)begin & ~LONGPTR_MASK); + end = (const unsigned char *)begin + n; + if (*lp++ != word) + for (p = begin; p < (const unsigned char *)lp;) + TESTBYTE; + + /* Now compare the data one word at a time. */ + for (; (const unsigned char *)lp < end; lp++) { + if (*lp != word) { + p = (const unsigned char *)lp; + TESTBYTE; + TESTBYTE; + TESTBYTE; +#if LONG_BIT >= 64 + TESTBYTE; + TESTBYTE; + TESTBYTE; + TESTBYTE; +#endif + goto done; + } + } + + return (NULL); + +done: + /* + * If the end of the buffer is not word aligned, the previous + * loops may obtain an address that's beyond the end of the + * buffer. + */ + if (p < end) + return (__DECONST(void *, p)); + return (NULL); +} Modified: head/sys/sys/libkern.h ============================================================================== --- head/sys/sys/libkern.h Sun Jan 1 20:18:40 2012 (r229197) +++ head/sys/sys/libkern.h Sun Jan 1 20:26:11 2012 (r229198) @@ -92,6 +92,7 @@ int flsl(long); int fnmatch(const char *, const char *, int); int locc(int, char *, u_int); void *memchr(const void *s, int c, size_t n); +void *memcchr(const void *s, int c, size_t n); int memcmp(const void *b1, const void *b2, size_t len); void qsort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)); From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 20:30:48 2012 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 BF217106564A; Sun, 1 Jan 2012 20:30:48 +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 AAFAD8FC0A; Sun, 1 Jan 2012 20:30:48 +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 q01KUmcD029323; Sun, 1 Jan 2012 20:30:48 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01KUmHP029321; Sun, 1 Jan 2012 20:30:48 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201201012030.q01KUmHP029321@svn.freebsd.org> From: Ed Schouten Date: Sun, 1 Jan 2012 20:30:48 +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: r229199 - 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: Sun, 01 Jan 2012 20:30:48 -0000 Author: ed Date: Sun Jan 1 20:30:48 2012 New Revision: 229199 URL: http://svn.freebsd.org/changeset/base/229199 Log: Fix typo; return -> returns. Modified: head/share/man/man9/memcchr.3 Modified: head/share/man/man9/memcchr.3 ============================================================================== --- head/share/man/man9/memcchr.3 Sun Jan 1 20:26:11 2012 (r229198) +++ head/share/man/man9/memcchr.3 Sun Jan 1 20:30:48 2012 (r229199) @@ -46,7 +46,7 @@ in string .Sh RETURN VALUES The .Fn memcchr -function return a pointer to the byte located, or NULL if no such byte +function returns a pointer to the byte located, or NULL if no such byte exists within .Fa len bytes. From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 20:47:34 2012 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 89372106564A; Sun, 1 Jan 2012 20:47: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 68C9C8FC0A; Sun, 1 Jan 2012 20:47: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 q01KlYOB029882; Sun, 1 Jan 2012 20:47:34 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01KlYtb029879; Sun, 1 Jan 2012 20:47:34 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201201012047.q01KlYtb029879@svn.freebsd.org> From: Ed Schouten Date: Sun, 1 Jan 2012 20:47: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: r229200 - in head/sys: fs/ext2fs ufs/ffs 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, 01 Jan 2012 20:47:34 -0000 Author: ed Date: Sun Jan 1 20:47:33 2012 New Revision: 229200 URL: http://svn.freebsd.org/changeset/base/229200 Log: Migrate ufs and ext2fs from skpc() to memcchr(). While there, remove a useless check from the code. memcchr() always returns characters unequal to 0xff in this case, so inosused[i] ^ 0xff can never be equal to zero. Also, the fact that memcchr() returns a pointer instead of the number of bytes until the end, makes conversion to an offset far more easy. Modified: head/sys/fs/ext2fs/ext2_alloc.c head/sys/ufs/ffs/ffs_alloc.c Modified: head/sys/fs/ext2fs/ext2_alloc.c ============================================================================== --- head/sys/fs/ext2fs/ext2_alloc.c Sun Jan 1 20:30:48 2012 (r229199) +++ head/sys/fs/ext2fs/ext2_alloc.c Sun Jan 1 20:47:33 2012 (r229200) @@ -886,8 +886,8 @@ ext2_nodealloccg(struct inode *ip, int c struct m_ext2fs *fs; struct buf *bp; struct ext2mount *ump; - int error, start, len, loc, map, i; - char *ibp; + int error, start, len; + char *ibp, *loc; ipref--; /* to avoid a lot of (ipref -1) */ if (ipref == -1) ipref = 0; @@ -921,25 +921,19 @@ ext2_nodealloccg(struct inode *ip, int c } start = ipref / NBBY; len = howmany(fs->e2fs->e2fs_ipg - ipref, NBBY); - loc = skpc(0xff, len, &ibp[start]); - if (loc == 0) { + loc = memcchr(&ibp[start], 0xff, len); + if (loc == NULL) { len = start + 1; start = 0; - loc = skpc(0xff, len, &ibp[0]); - if (loc == 0) { + loc = memcchr(&ibp[start], 0xff, len); + if (loc == NULL) { printf("cg = %d, ipref = %lld, fs = %s\n", cg, (long long)ipref, fs->e2fs_fsmnt); panic("ext2fs_nodealloccg: map corrupted"); /* NOTREACHED */ } } - i = start + len - loc; - map = ibp[i] ^ 0xff; - if (map == 0) { - printf("fs = %s\n", fs->e2fs_fsmnt); - panic("ext2fs_nodealloccg: block not in map"); - } - ipref = i * NBBY + ffs(map) - 1; + ipref = (loc - ibp) * NBBY + ffs(~*loc) - 1; gotit: setbit(ibp, ipref); EXT2_LOCK(ump); @@ -1068,7 +1062,8 @@ ext2_vfree(pvp, ino, mode) static daddr_t ext2_mapsearch(struct m_ext2fs *fs, char *bbp, daddr_t bpref) { - int start, len, loc, i, map; + char *loc; + int start, len; /* * find the fragment by searching through the free block @@ -1079,25 +1074,19 @@ ext2_mapsearch(struct m_ext2fs *fs, char else start = 0; len = howmany(fs->e2fs->e2fs_fpg, NBBY) - start; - loc = skpc(0xff, len, &bbp[start]); - if (loc == 0) { + loc = memcchr(&bbp[start], 0xff, len); + if (loc == NULL) { len = start + 1; start = 0; - loc = skpc(0xff, len, &bbp[start]); - if (loc == 0) { + loc = memcchr(&bbp[start], 0xff, len); + if (loc == NULL) { printf("start = %d, len = %d, fs = %s\n", start, len, fs->e2fs_fsmnt); panic("ext2fs_alloccg: map corrupted"); /* NOTREACHED */ } } - i = start + len - loc; - map = bbp[i] ^ 0xff; - if (map == 0) { - printf("fs = %s\n", fs->e2fs_fsmnt); - panic("ext2fs_mapsearch: block not in map"); - } - return (i * NBBY + ffs(map) - 1); + return ((loc - bbp) * NBBY + ffs(~*loc) - 1); } /* Modified: head/sys/ufs/ffs/ffs_alloc.c ============================================================================== --- head/sys/ufs/ffs/ffs_alloc.c Sun Jan 1 20:30:48 2012 (r229199) +++ head/sys/ufs/ffs/ffs_alloc.c Sun Jan 1 20:47:33 2012 (r229200) @@ -1745,9 +1745,9 @@ ffs_nodealloccg(ip, cg, ipref, mode, unu struct cg *cgp; struct buf *bp, *ibp; struct ufsmount *ump; - u_int8_t *inosused; + u_int8_t *inosused, *loc; struct ufs2_dinode *dp2; - int error, start, len, loc, map, i; + int error, start, len, i; fs = ip->i_fs; ump = ip->i_ump; @@ -1777,25 +1777,19 @@ ffs_nodealloccg(ip, cg, ipref, mode, unu } start = cgp->cg_irotor / NBBY; len = howmany(fs->fs_ipg - cgp->cg_irotor, NBBY); - loc = skpc(0xff, len, &inosused[start]); - if (loc == 0) { + loc = memcchr(&inosused[start], 0xff, len); + if (loc == NULL) { len = start + 1; start = 0; - loc = skpc(0xff, len, &inosused[0]); - if (loc == 0) { + loc = memcchr(&inosused[start], 0xff, len); + if (loc == NULL) { printf("cg = %d, irotor = %ld, fs = %s\n", cg, (long)cgp->cg_irotor, fs->fs_fsmnt); panic("ffs_nodealloccg: map corrupted"); /* NOTREACHED */ } } - i = start + len - loc; - map = inosused[i] ^ 0xff; - if (map == 0) { - printf("fs = %s\n", fs->fs_fsmnt); - panic("ffs_nodealloccg: block not in map"); - } - ipref = i * NBBY + ffs(map) - 1; + ipref = (loc - inosused) * NBBY + ffs(~*loc) - 1; cgp->cg_irotor = ipref; gotit: /* From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 20:50:20 2012 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 33866106566B; Sun, 1 Jan 2012 20:50:20 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1DEE48FC16; Sun, 1 Jan 2012 20:50:20 +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 q01KoJUn030008; Sun, 1 Jan 2012 20:50:19 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01KoJEH030006; Sun, 1 Jan 2012 20:50:19 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201201012050.q01KoJEH030006@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 1 Jan 2012 20:50: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: r229201 - head/bin/sh 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, 01 Jan 2012 20:50:20 -0000 Author: jilles Date: Sun Jan 1 20:50:19 2012 New Revision: 229201 URL: http://svn.freebsd.org/changeset/base/229201 Log: sh: Make patmatch() non-recursive. Modified: head/bin/sh/expand.c Modified: head/bin/sh/expand.c ============================================================================== --- head/bin/sh/expand.c Sun Jan 1 20:47:33 2012 (r229200) +++ head/bin/sh/expand.c Sun Jan 1 20:50:19 2012 (r229201) @@ -1445,57 +1445,63 @@ int patmatch(const char *pattern, const char *string, int squoted) { const char *p, *q, *end; + const char *bt_p, *bt_q; char c; wchar_t wc, wc2; p = pattern; q = string; + bt_p = NULL; + bt_q = NULL; for (;;) { switch (c = *p++) { case '\0': - goto breakloop; + if (*q != '\0') + goto backtrack; + return 1; case CTLESC: if (squoted && *q == CTLESC) q++; if (*q++ != *p++) - return 0; + goto backtrack; break; case CTLQUOTEMARK: continue; case '?': if (squoted && *q == CTLESC) q++; - if (localeisutf8) + if (*q == '\0') + return 0; + if (localeisutf8) { wc = get_wc(&q); - else + /* + * A '?' does not match invalid UTF-8 but a + * '*' does, so backtrack. + */ + if (wc == 0) + goto backtrack; + } else wc = (unsigned char)*q++; - if (wc == '\0') - return 0; break; case '*': c = *p; while (c == CTLQUOTEMARK || c == '*') c = *++p; - if (c != CTLESC && c != CTLQUOTEMARK && - c != '?' && c != '*' && c != '[') { - while (*q != c) { - if (squoted && *q == CTLESC && - q[1] == c) - break; - if (*q == '\0') - return 0; - if (squoted && *q == CTLESC) - q++; - q++; - } - } - do { - if (patmatch(p, q, squoted)) - return 1; - if (squoted && *q == CTLESC) - q++; - } while (*q++ != '\0'); - return 0; + /* + * If the pattern ends here, we know the string + * matches without needing to look at the rest of it. + */ + if (c == '\0') + return 1; + /* + * First try the shortest match for the '*' that + * could work. We can forget any earlier '*' since + * there is no way having it match more characters + * can help us, given that we are already here. + */ + bt_p = p; + bt_q = q; + break; case '[': { const char *endp; int invert, found; @@ -1507,7 +1513,7 @@ patmatch(const char *pattern, const char for (;;) { while (*endp == CTLQUOTEMARK) endp++; - if (*endp == '\0') + if (*endp == 0) goto dft; /* no matching ] */ if (*endp == CTLESC) endp++; @@ -1522,12 +1528,14 @@ patmatch(const char *pattern, const char found = 0; if (squoted && *q == CTLESC) q++; - if (localeisutf8) + if (*q == '\0') + return 0; + if (localeisutf8) { chr = get_wc(&q); - else + if (chr == 0) + goto backtrack; + } else chr = (unsigned char)*q++; - if (chr == '\0') - return 0; c = *p++; do { if (c == CTLQUOTEMARK) @@ -1568,21 +1576,34 @@ patmatch(const char *pattern, const char } } while ((c = *p++) != ']'); if (found == invert) - return 0; + goto backtrack; break; } dft: default: if (squoted && *q == CTLESC) q++; - if (*q++ != c) + if (*q == '\0') + return 0; + if (*q++ == c) + break; +backtrack: + /* + * If we have a mismatch (other than hitting the end + * of the string), go back to the last '*' seen and + * have it match one additional character. + */ + if (bt_p == NULL) + return 0; + if (squoted && *bt_q == CTLESC) + bt_q++; + if (*bt_q == '\0') return 0; + bt_q++; + p = bt_p; + q = bt_q; break; } } -breakloop: - if (*q != '\0') - return 0; - return 1; } From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 20:51:52 2012 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 1FB6E106566C; Sun, 1 Jan 2012 20:51:52 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 08F118FC08; Sun, 1 Jan 2012 20:51:52 +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 q01Kpphp030098; Sun, 1 Jan 2012 20:51:51 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01Kpp9g030095; Sun, 1 Jan 2012 20:51:51 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201012051.q01Kpp9g030095@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 20:51:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229202 - stable/9/usr.bin/mail 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, 01 Jan 2012 20:51:52 -0000 Author: dim Date: Sun Jan 1 20:51:51 2012 New Revision: 229202 URL: http://svn.freebsd.org/changeset/base/229202 Log: MFC r228647: In usr.bin/mail/cmd1.c, use the correct printf length modifier for a ptrdiff_t. In usr.bin/mail/main.c, cast a field width to int. Modified: stable/9/usr.bin/mail/cmd1.c stable/9/usr.bin/mail/main.c Directory Properties: stable/9/usr.bin/mail/ (props changed) Modified: stable/9/usr.bin/mail/cmd1.c ============================================================================== --- stable/9/usr.bin/mail/cmd1.c Sun Jan 1 20:50:19 2012 (r229201) +++ stable/9/usr.bin/mail/cmd1.c Sun Jan 1 20:51:51 2012 (r229202) @@ -210,7 +210,7 @@ printhead(int mesg) int pdot(void) { - printf("%d\n", dot - &message[0] + 1); + printf("%td\n", dot - &message[0] + 1); return (0); } Modified: stable/9/usr.bin/mail/main.c ============================================================================== --- stable/9/usr.bin/mail/main.c Sun Jan 1 20:50:19 2012 (r229201) +++ stable/9/usr.bin/mail/main.c Sun Jan 1 20:51:51 2012 (r229202) @@ -206,7 +206,7 @@ Usage: %s [-dEiInv] [-s subject] [-c cc- %*s [-sendmail-option ...]\n\ %s [-dEHiInNv] [-F] -f [name]\n\ %s [-dEHiInNv] [-F] [-u user]\n\ - %s [-d] -e [-f name]\n", __progname, strlen(__progname), "", + %s [-d] -e [-f name]\n", __progname, (int)strlen(__progname), "", __progname, __progname, __progname); exit(1); } From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 20:53:34 2012 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 3F78E106566C; Sun, 1 Jan 2012 20:53:34 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 28A528FC0A; Sun, 1 Jan 2012 20:53: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 q01KrYSe030205; Sun, 1 Jan 2012 20:53:34 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01KrXU5030203; Sun, 1 Jan 2012 20:53:33 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201012053.q01KrXU5030203@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 20:53:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229203 - stable/9/usr.bin/ncplist 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, 01 Jan 2012 20:53:34 -0000 Author: dim Date: Sun Jan 1 20:53:33 2012 New Revision: 229203 URL: http://svn.freebsd.org/changeset/base/229203 Log: MFC r228649: Use NO_WCAST_ALIGN for usr.bin/ncplist, as there are many potential alignment issues in it. (Though I doubt anyone still cares about NetWare support...) Modified: stable/9/usr.bin/ncplist/Makefile Directory Properties: stable/9/usr.bin/ncplist/ (props changed) Modified: stable/9/usr.bin/ncplist/Makefile ============================================================================== --- stable/9/usr.bin/ncplist/Makefile Sun Jan 1 20:51:51 2012 (r229202) +++ stable/9/usr.bin/ncplist/Makefile Sun Jan 1 20:53:33 2012 (r229203) @@ -1,6 +1,7 @@ # $FreeBSD$ PROG= ncplist +NO_WCAST_ALIGN= WARNS?= 0 From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 20:54:45 2012 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 39968106564A; Sun, 1 Jan 2012 20:54:45 +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 09F228FC0C; Sun, 1 Jan 2012 20:54: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 q01KsiOU030340; Sun, 1 Jan 2012 20:54:44 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01Ksiu9030336; Sun, 1 Jan 2012 20:54:44 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201201012054.q01Ksiu9030336@svn.freebsd.org> From: Ed Schouten Date: Sun, 1 Jan 2012 20:54: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: r229204 - in head/sys: conf libkern 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: Sun, 01 Jan 2012 20:54:45 -0000 Author: ed Date: Sun Jan 1 20:54:44 2012 New Revision: 229204 URL: http://svn.freebsd.org/changeset/base/229204 Log: Remove the now unused skpc() function. It was only used by ufs and ext2 and I have really strong doubts that there are other pieces of code that also use this function. If it turns out that external drivers use this code as well, I'd be happy to migrate or revert. Bump __FreeBSD_version while there. Deleted: head/sys/libkern/skpc.c Modified: head/sys/conf/files head/sys/sys/libkern.h head/sys/sys/param.h Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sun Jan 1 20:53:33 2012 (r229203) +++ head/sys/conf/files Sun Jan 1 20:54:44 2012 (r229204) @@ -2564,7 +2564,6 @@ libkern/qsort_r.c standard libkern/random.c standard libkern/rindex.c standard libkern/scanc.c standard -libkern/skpc.c standard libkern/strcasecmp.c standard libkern/strcat.c standard libkern/strcmp.c standard Modified: head/sys/sys/libkern.h ============================================================================== --- head/sys/sys/libkern.h Sun Jan 1 20:53:33 2012 (r229203) +++ head/sys/sys/libkern.h Sun Jan 1 20:54:44 2012 (r229204) @@ -102,7 +102,6 @@ u_long random(void); char *index(const char *, int); char *rindex(const char *, int); int scanc(u_int, const u_char *, const u_char *, int); -int skpc(int, int, char *); void srandom(u_long); int strcasecmp(const char *, const char *); char *strcat(char * __restrict, const char * __restrict); Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Sun Jan 1 20:53:33 2012 (r229203) +++ head/sys/sys/param.h Sun Jan 1 20:54:44 2012 (r229204) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1000003 /* Master, propagated to newvers */ +#define __FreeBSD_version 1000004 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 20:57:39 2012 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 649A11065676; Sun, 1 Jan 2012 20:57:39 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4E82A8FC16; Sun, 1 Jan 2012 20:57: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 q01KvdpW030496; Sun, 1 Jan 2012 20:57:39 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01KvdMr030494; Sun, 1 Jan 2012 20:57:39 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201012057.q01KvdMr030494@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 20:57:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229205 - stable/9/usr.bin/netstat 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, 01 Jan 2012 20:57:39 -0000 Author: dim Date: Sun Jan 1 20:57:38 2012 New Revision: 229205 URL: http://svn.freebsd.org/changeset/base/229205 Log: MFC r228650: In usr.bin/netstat/atalk.c, work around a clang false positive with printf format warnings and conditional operators. MFC r228668: Revert r228650, and work around the clang false positive with printf formats in usr.bin/netstat/atalk.c by conditionally adding NO_WFORMAT to the Makefile instead. Modified: stable/9/usr.bin/netstat/Makefile Directory Properties: stable/9/usr.bin/netstat/ (props changed) Modified: stable/9/usr.bin/netstat/Makefile ============================================================================== --- stable/9/usr.bin/netstat/Makefile Sun Jan 1 20:54:44 2012 (r229204) +++ stable/9/usr.bin/netstat/Makefile Sun Jan 1 20:57:38 2012 (r229205) @@ -8,6 +8,11 @@ SRCS= if.c inet.c main.c mbuf.c mroute.c unix.c atalk.c mroute6.c ipsec.c bpf.c pfkey.c sctp.c WARNS?= 3 +.if ${CC:T:Mclang} == "clang" +# XXX: Work around a clang false positive with format string warnings +# and ntohs macros (see LLVM PR 11313). +NO_WFORMAT= +.endif CFLAGS+=-fno-strict-aliasing CFLAGS+=-DIPSEC From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 20:59:43 2012 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 DC716106566B; Sun, 1 Jan 2012 20:59:42 +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 BD3478FC0A; Sun, 1 Jan 2012 20:59:42 +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 q01KxgOG030596; Sun, 1 Jan 2012 20:59:42 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01KxglS030593; Sun, 1 Jan 2012 20:59:42 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201201012059.q01KxglS030593@svn.freebsd.org> From: Ed Schouten Date: Sun, 1 Jan 2012 20:59:42 +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: r229206 - 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: Sun, 01 Jan 2012 20:59:43 -0000 Author: ed Date: Sun Jan 1 20:59:42 2012 New Revision: 229206 URL: http://svn.freebsd.org/changeset/base/229206 Log: Fix sloppyness in memcchr() man page. I was considering adding it to libc as well, but last minute I thought it would be good enough to add it to libkern exclusively. I forgot to rename the man page and hook it up. Added: head/share/man/man9/memcchr.9 - copied unchanged from r229199, head/share/man/man9/memcchr.3 Deleted: head/share/man/man9/memcchr.3 Modified: head/share/man/man9/Makefile Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Sun Jan 1 20:57:38 2012 (r229205) +++ head/share/man/man9/Makefile Sun Jan 1 20:59:42 2012 (r229206) @@ -164,6 +164,7 @@ MAN= accept_filter.9 \ mbuf_tags.9 \ MD5.9 \ mdchain.9 \ + memcchr.9 \ memguard.9 \ microseq.9 \ microtime.9 \ Copied: head/share/man/man9/memcchr.9 (from r229199, head/share/man/man9/memcchr.3) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man9/memcchr.9 Sun Jan 1 20:59:42 2012 (r229206, copy of r229199, head/share/man/man9/memcchr.3) @@ -0,0 +1,59 @@ +.\" Copyright (c) 2012 Ed Schouten +.\" 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 THE AUTHOR AND CONTRIBUTORS ``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 THE AUTHOR 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. +.\" +.\" $FreeBSD$ +.\" +.Dd January 1, 2012 +.Dt MEMCCHR 9 +.Os +.Sh NAME +.Nm memcchr +.Nd locate the complement of a byte in byte string +.Sh SYNOPSIS +.In sys/libkern.h +.Ft void * +.Fn memcchr "const void *b" "int c" "size_t len" +.Sh DESCRIPTION +The +.Fn memcchr +function locates the first occurrence of a byte unequal to +.Fa c +(converted to an +.Vt "unsigned char" ) +in string +.Fa b . +.Sh RETURN VALUES +The +.Fn memcchr +function returns a pointer to the byte located, or NULL if no such byte +exists within +.Fa len +bytes. +.Sh SEE ALSO +.Xr memchr 3 +.Sh HISTORY +The +.Fn memcchr +function first appeared in +.Fx 10.0 . From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 21:06:07 2012 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 E3BE5106566B; Sun, 1 Jan 2012 21:06:07 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CE4BD8FC08; Sun, 1 Jan 2012 21:06: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 q01L67L9030852; Sun, 1 Jan 2012 21:06:07 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01L67q6030850; Sun, 1 Jan 2012 21:06:07 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201012106.q01L67q6030850@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 21:06:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229207 - stable/9/contrib/telnet/telnet 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, 01 Jan 2012 21:06:08 -0000 Author: dim Date: Sun Jan 1 21:06:07 2012 New Revision: 229207 URL: http://svn.freebsd.org/changeset/base/229207 Log: MFC r228651: In contrib/telnet/telnet/utilities.c, fix a few warnings about format strings not being literals. Modified: stable/9/contrib/telnet/telnet/utilities.c Directory Properties: stable/9/contrib/telnet/ (props changed) Modified: stable/9/contrib/telnet/telnet/utilities.c ============================================================================== --- stable/9/contrib/telnet/telnet/utilities.c Sun Jan 1 20:59:42 2012 (r229206) +++ stable/9/contrib/telnet/telnet/utilities.c Sun Jan 1 21:06:07 2012 (r229207) @@ -782,7 +782,7 @@ printsub(char direction, unsigned char * fprintf(NetTrace, "\" VAR " + noquote); } else #endif /* OLD_ENVIRON */ - fprintf(NetTrace, "\" VALUE " + noquote); + fprintf(NetTrace, "%s", "\" VALUE " + noquote); noquote = 2; break; @@ -798,17 +798,17 @@ printsub(char direction, unsigned char * fprintf(NetTrace, "\" VALUE " + noquote); } else #endif /* OLD_ENVIRON */ - fprintf(NetTrace, "\" VAR " + noquote); + fprintf(NetTrace, "%s", "\" VAR " + noquote); noquote = 2; break; case ENV_ESC: - fprintf(NetTrace, "\" ESC " + noquote); + fprintf(NetTrace, "%s", "\" ESC " + noquote); noquote = 2; break; case ENV_USERVAR: - fprintf(NetTrace, "\" USERVAR " + noquote); + fprintf(NetTrace, "%s", "\" USERVAR " + noquote); noquote = 2; break; From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 21:12:30 2012 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 90289106566B; Sun, 1 Jan 2012 21:12:30 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5F4318FC08; Sun, 1 Jan 2012 21:12:30 +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 q01LCU9P031086; Sun, 1 Jan 2012 21:12:30 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01LCUj3031083; Sun, 1 Jan 2012 21:12:30 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201012112.q01LCUj3031083@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 21:12:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229208 - stable/9/usr.bin/vmstat 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, 01 Jan 2012 21:12:30 -0000 Author: dim Date: Sun Jan 1 21:12:29 2012 New Revision: 229208 URL: http://svn.freebsd.org/changeset/base/229208 Log: MFC r228654: In usr.bin/vmstat/vmstat.c, cast several printf field widths to int, and use printf format specifiers from inttypes.h for uint64_t's. Modified: stable/9/usr.bin/vmstat/vmstat.c Directory Properties: stable/9/usr.bin/vmstat/ (props changed) Modified: stable/9/usr.bin/vmstat/vmstat.c ============================================================================== --- stable/9/usr.bin/vmstat/vmstat.c Sun Jan 1 21:06:07 2012 (r229207) +++ stable/9/usr.bin/vmstat/vmstat.c Sun Jan 1 21:12:29 2012 (r229208) @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1185,18 +1186,18 @@ dointr(void) istrnamlen = clen; tintrname += clen + 1; } - (void)printf("%-*s %20s %10s\n", istrnamlen, "interrupt", "total", + (void)printf("%-*s %20s %10s\n", (int)istrnamlen, "interrupt", "total", "rate"); inttotal = 0; for (i = 0; i < nintr; i++) { if (intrname[0] != '\0' && (*intrcnt != 0 || aflag)) - (void)printf("%-*s %20lu %10lu\n", istrnamlen, intrname, - *intrcnt, *intrcnt / uptime); + (void)printf("%-*s %20lu %10lu\n", (int)istrnamlen, + intrname, *intrcnt, *intrcnt / uptime); intrname += strlen(intrname) + 1; inttotal += *intrcnt++; } - (void)printf("%-*s %20llu %10llu\n", istrnamlen, "Total", - (long long)inttotal, (long long)(inttotal / uptime)); + (void)printf("%-*s %20" PRIu64 " %10" PRIu64 "\n", (int)istrnamlen, + "Total", inttotal, inttotal / uptime); } static void @@ -1235,9 +1236,9 @@ domemstat_malloc(void) if (memstat_get_numallocs(mtp) == 0 && memstat_get_count(mtp) == 0) continue; - printf("%13s %5lld %5lldK %7s %8lld ", + printf("%13s %5" PRIu64 " %5" PRIu64 "K %7s %8" PRIu64 " ", memstat_get_name(mtp), memstat_get_count(mtp), - ((int64_t)memstat_get_bytes(mtp) + 1023) / 1024, "-", + (memstat_get_bytes(mtp) + 1023) / 1024, "-", memstat_get_numallocs(mtp)); first = 1; for (i = 0; i < 32; i++) { @@ -1289,7 +1290,8 @@ domemstat_zone(void) mtp = memstat_mtl_next(mtp)) { strlcpy(name, memstat_get_name(mtp), MEMTYPE_MAXNAME); strcat(name, ":"); - printf("%-20s %6llu, %6llu,%8llu,%8llu,%8llu,%4llu,%4llu\n",name, + printf("%-20s %6" PRIu64 ", %6" PRIu64 ",%8" PRIu64 ",%8" PRIu64 + ",%8" PRIu64 ",%4" PRIu64 ",%4" PRIu64 "\n", name, memstat_get_size(mtp), memstat_get_countlimit(mtp), memstat_get_count(mtp), memstat_get_free(mtp), memstat_get_numallocs(mtp), memstat_get_failures(mtp), From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 21:21:58 2012 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 48CEF106566C; Sun, 1 Jan 2012 21:21:58 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 32AE78FC08; Sun, 1 Jan 2012 21:21: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 q01LLwCS031416; Sun, 1 Jan 2012 21:21:58 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01LLw4o031413; Sun, 1 Jan 2012 21:21:58 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201012121.q01LLw4o031413@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 21:21:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229209 - stable/9/usr.bin/rwho 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, 01 Jan 2012 21:21:58 -0000 Author: dim Date: Sun Jan 1 21:21:57 2012 New Revision: 229209 URL: http://svn.freebsd.org/changeset/base/229209 Log: MFC r226427: Build rwho(1) with WARNS=6. The only reason why it didn't build with WARNS=6, is because of some simple to fix string formatting bugs. Modified: stable/9/usr.bin/rwho/Makefile stable/9/usr.bin/rwho/rwho.c Directory Properties: stable/9/usr.bin/rwho/ (props changed) Modified: stable/9/usr.bin/rwho/Makefile ============================================================================== --- stable/9/usr.bin/rwho/Makefile Sun Jan 1 21:12:29 2012 (r229208) +++ stable/9/usr.bin/rwho/Makefile Sun Jan 1 21:21:57 2012 (r229209) @@ -3,6 +3,4 @@ PROG= rwho -WARNS?= 1 - .include Modified: stable/9/usr.bin/rwho/rwho.c ============================================================================== --- stable/9/usr.bin/rwho/rwho.c Sun Jan 1 21:12:29 2012 (r229208) +++ stable/9/usr.bin/rwho/rwho.c Sun Jan 1 21:21:57 2012 (r229209) @@ -165,9 +165,10 @@ main(int argc, char *argv[]) d_first ? "%e %b %R" : "%b %e %R", localtime(&t)); (void)sprintf(buf, "%s:%-.*s", mp->myhost, - sizeof(mp->myutmp.out_line), mp->myutmp.out_line); + (int)sizeof(mp->myutmp.out_line), mp->myutmp.out_line); printf("%-*.*s %-*s %s", - sizeof(mp->myutmp.out_name), sizeof(mp->myutmp.out_name), + (int)sizeof(mp->myutmp.out_name), + (int)sizeof(mp->myutmp.out_name), mp->myutmp.out_name, width, buf, From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 21:28:56 2012 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 44D1F106564A; Sun, 1 Jan 2012 21:28:56 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2F1148FC0A; Sun, 1 Jan 2012 21:28: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 q01LSuon031667; Sun, 1 Jan 2012 21:28:56 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01LSujY031665; Sun, 1 Jan 2012 21:28:56 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201012128.q01LSujY031665@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 21:28:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229210 - stable/9/usr.sbin/bluetooth/sdpd 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, 01 Jan 2012 21:28:56 -0000 Author: dim Date: Sun Jan 1 21:28:55 2012 New Revision: 229210 URL: http://svn.freebsd.org/changeset/base/229210 Log: MFC r228655: In usr.sbin/bluetooth/sdpd/server.c, don't use the size of a pointer as the length argument to memset, but the size of the object pointed to. Modified: stable/9/usr.sbin/bluetooth/sdpd/server.c Directory Properties: stable/9/usr.sbin/bluetooth/sdpd/ (props changed) Modified: stable/9/usr.sbin/bluetooth/sdpd/server.c ============================================================================== --- stable/9/usr.sbin/bluetooth/sdpd/server.c Sun Jan 1 21:21:57 2012 (r229209) +++ stable/9/usr.sbin/bluetooth/sdpd/server.c Sun Jan 1 21:28:55 2012 (r229210) @@ -73,7 +73,7 @@ server_init(server_p srv, char const *co assert(srv != NULL); assert(control != NULL); - memset(srv, 0, sizeof(srv)); + memset(srv, 0, sizeof(*srv)); /* Open control socket */ if (unlink(control) < 0 && errno != ENOENT) { From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 21:32:26 2012 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 774B81065670; Sun, 1 Jan 2012 21:32:26 +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 482CD8FC13; Sun, 1 Jan 2012 21:32: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 q01LWQqY031838; Sun, 1 Jan 2012 21:32:26 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01LWQ8N031837; Sun, 1 Jan 2012 21:32:26 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201201012132.q01LWQ8N031837@svn.freebsd.org> From: Adrian Chadd Date: Sun, 1 Jan 2012 21:32: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: r229211 - head/sys/contrib/xz-embedded 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, 01 Jan 2012 21:32:26 -0000 Author: adrian Date: Sun Jan 1 21:32:25 2012 New Revision: 229211 URL: http://svn.freebsd.org/changeset/base/229211 Log: Initial copy of xz-embedded to sys/contrib/. The upcoming geom_compress module (a read-only gzip/ulzma translation layer, similar to what geom_uzip does) will leverage parts of this. Added: head/sys/contrib/xz-embedded/ - copied from r229210, vendor/xz-embedded/dist/ From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 21:38:59 2012 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 5038E106566B; Sun, 1 Jan 2012 21:38:59 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3A8468FC08; Sun, 1 Jan 2012 21:38: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 q01LcxJw032065; Sun, 1 Jan 2012 21:38:59 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01LcxL9032063; Sun, 1 Jan 2012 21:38:59 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201012138.q01LcxL9032063@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 21:38:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229212 - stable/9/usr.sbin/boot0cfg 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, 01 Jan 2012 21:38:59 -0000 Author: dim Date: Sun Jan 1 21:38:58 2012 New Revision: 229212 URL: http://svn.freebsd.org/changeset/base/229212 Log: MFC r228656: Use NO_WCAST_ALIGN for usr.sbin/boot0cfg; because this is only built for x86, any alignment warnings can be safely ignored. Modified: stable/9/usr.sbin/boot0cfg/Makefile Directory Properties: stable/9/usr.sbin/boot0cfg/ (props changed) Modified: stable/9/usr.sbin/boot0cfg/Makefile ============================================================================== --- stable/9/usr.sbin/boot0cfg/Makefile Sun Jan 1 21:32:25 2012 (r229211) +++ stable/9/usr.sbin/boot0cfg/Makefile Sun Jan 1 21:38:58 2012 (r229212) @@ -6,4 +6,6 @@ MAN= boot0cfg.8 DPADD= ${LIBGEOM} ${LIBBSDXML} ${LIBSBUF} LDADD= -lgeom -lbsdxml -lsbuf +NO_WCAST_ALIGN= + .include From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 21:43:14 2012 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 DA0D11065672; Sun, 1 Jan 2012 21:43:14 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C3EDC8FC13; Sun, 1 Jan 2012 21:43: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 q01LhEbU032232; Sun, 1 Jan 2012 21:43:14 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01LhEcE032230; Sun, 1 Jan 2012 21:43:14 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201012143.q01LhEcE032230@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 21:43:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229213 - stable/9/usr.sbin/bsnmpd/modules/snmp_wlan 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, 01 Jan 2012 21:43:15 -0000 Author: dim Date: Sun Jan 1 21:43:14 2012 New Revision: 229213 URL: http://svn.freebsd.org/changeset/base/229213 Log: MFC r228657: In usr.sbin/bsnmpd/modules/snmp_wlan/wlan_snmp.h, use the correct enumeration types for the mesh_peering and mesh_forwarding members of struct wlan_iface, to fix enum conversion warnings. Modified: stable/9/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_snmp.h Directory Properties: stable/9/usr.sbin/bsnmpd/modules/snmp_wlan/ (props changed) Modified: stable/9/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_snmp.h ============================================================================== --- stable/9/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_snmp.h Sun Jan 1 21:38:58 2012 (r229212) +++ stable/9/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_snmp.h Sun Jan 1 21:43:14 2012 (r229213) @@ -175,8 +175,8 @@ struct wlan_iface { struct wlan_maclist mac_maclist; uint32_t mesh_ttl; - enum TruthValue mesh_peering; - enum TruthValue mesh_forwarding; + enum wlanMeshPeeringEnabled mesh_peering; + enum wlanMeshForwardingEnabled mesh_forwarding; enum wlanMeshMetric mesh_metric; enum wlanMeshPath mesh_path; enum wlanHWMPRootMode hwmp_root_mode; From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 21:50:21 2012 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 B84AE106568A; Sun, 1 Jan 2012 21:50:21 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A39B18FC0A; Sun, 1 Jan 2012 21:50: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 q01LoLUU032526; Sun, 1 Jan 2012 21:50:21 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01LoLFx032524; Sun, 1 Jan 2012 21:50:21 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201012150.q01LoLFx032524@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 21:50:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229215 - stable/9/usr.sbin/cpucontrol 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, 01 Jan 2012 21:50:21 -0000 Author: dim Date: Sun Jan 1 21:50:21 2012 New Revision: 229215 URL: http://svn.freebsd.org/changeset/base/229215 Log: MFC r228658: Use NO_WCAST_ALIGN for usr.sbin/cpucontrol; because this is only built for x86, any alignment warnings can be safely ignored. Modified: stable/9/usr.sbin/cpucontrol/Makefile Directory Properties: stable/9/usr.sbin/cpucontrol/ (props changed) Modified: stable/9/usr.sbin/cpucontrol/Makefile ============================================================================== --- stable/9/usr.sbin/cpucontrol/Makefile Sun Jan 1 21:46:16 2012 (r229214) +++ stable/9/usr.sbin/cpucontrol/Makefile Sun Jan 1 21:50:21 2012 (r229215) @@ -4,4 +4,6 @@ PROG= cpucontrol MAN= cpucontrol.8 SRCS= cpucontrol.c intel.c amd.c +NO_WCAST_ALIGN= + .include From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 22:06:42 2012 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 21159106567C; Sun, 1 Jan 2012 22:06:42 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0A88C8FC1D; Sun, 1 Jan 2012 22:06:42 +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 q01M6fKa033055; Sun, 1 Jan 2012 22:06:41 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01M6fMj033053; Sun, 1 Jan 2012 22:06:41 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201012206.q01M6fMj033053@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 22:06:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229216 - stable/9/usr.sbin/ctm/ctm_dequeue 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, 01 Jan 2012 22:06:42 -0000 Author: dim Date: Sun Jan 1 22:06:41 2012 New Revision: 229216 URL: http://svn.freebsd.org/changeset/base/229216 Log: MFC r228659: In usr.sbin/ctm/ctm_dequeue/ctm_dequeue.c, cast a printf field width parameter to int. Modified: stable/9/usr.sbin/ctm/ctm_dequeue/ctm_dequeue.c Directory Properties: stable/9/usr.sbin/ctm/ctm_dequeue/ (props changed) Modified: stable/9/usr.sbin/ctm/ctm_dequeue/ctm_dequeue.c ============================================================================== --- stable/9/usr.sbin/ctm/ctm_dequeue/ctm_dequeue.c Sun Jan 1 21:50:21 2012 (r229215) +++ stable/9/usr.sbin/ctm/ctm_dequeue/ctm_dequeue.c Sun Jan 1 22:06:41 2012 (r229216) @@ -143,7 +143,7 @@ main(int argc, char **argv) */ npieces = atoi(&ftsent->fts_name[ftsent->fts_namelen-3]); piece = atoi(&ftsent->fts_name[ftsent->fts_namelen-7]); - err("%.*s %d/%d sent", ftsent->fts_namelen-8, ftsent->fts_name, + err("%.*s %d/%d sent", (int)(ftsent->fts_namelen-8), ftsent->fts_name, piece, npieces); if (chunk++ == num_to_send) From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 22:08:53 2012 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 103601065673; Sun, 1 Jan 2012 22:08:53 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EE73C8FC1A; Sun, 1 Jan 2012 22:08:52 +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 q01M8qV2033164; Sun, 1 Jan 2012 22:08:52 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01M8qe6033162; Sun, 1 Jan 2012 22:08:52 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201012208.q01M8qe6033162@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 22:08:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229217 - stable/9/usr.sbin/i2c 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, 01 Jan 2012 22:08:53 -0000 Author: dim Date: Sun Jan 1 22:08:52 2012 New Revision: 229217 URL: http://svn.freebsd.org/changeset/base/229217 Log: MFC r228660: In usr.sbin/i2c/i2c.c, fix a few warnings about format strings not being literals. Modified: stable/9/usr.sbin/i2c/i2c.c Directory Properties: stable/9/usr.sbin/i2c/ (props changed) Modified: stable/9/usr.sbin/i2c/i2c.c ============================================================================== --- stable/9/usr.sbin/i2c/i2c.c Sun Jan 1 22:06:41 2012 (r229216) +++ stable/9/usr.sbin/i2c/i2c.c Sun Jan 1 22:08:52 2012 (r229217) @@ -360,7 +360,7 @@ err1: fprintf(stderr, "error sending stop condtion\n"); err2: if (err_msg) - fprintf(stderr, err_msg); + fprintf(stderr, "%s", err_msg); close(fd); return (1); @@ -453,7 +453,7 @@ err1: fprintf(stderr, "error sending stop condtion\n"); err2: if (err_msg) - fprintf(stderr, err_msg); + fprintf(stderr, "%s", err_msg); close(fd); return (1); From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 22:11:22 2012 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 CB9C9106566C; Sun, 1 Jan 2012 22:11:22 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9C7EF8FC13; Sun, 1 Jan 2012 22:11: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 q01MBMIA033300; Sun, 1 Jan 2012 22:11:22 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01MBMbi033298; Sun, 1 Jan 2012 22:11:22 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201012211.q01MBMbi033298@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 22:11:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229218 - stable/9/usr.sbin/iostat 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, 01 Jan 2012 22:11:22 -0000 Author: dim Date: Sun Jan 1 22:11:22 2012 New Revision: 229218 URL: http://svn.freebsd.org/changeset/base/229218 Log: MFC r228661: In usr.sbin/iostat/iostat.c, use printf format specifiers from inttypes.h for u_int64_t's. While here, sort #include directives. Modified: stable/9/usr.sbin/iostat/iostat.c Directory Properties: stable/9/usr.sbin/iostat/ (props changed) Modified: stable/9/usr.sbin/iostat/iostat.c ============================================================================== --- stable/9/usr.sbin/iostat/iostat.c Sun Jan 1 22:08:52 2012 (r229217) +++ stable/9/usr.sbin/iostat/iostat.c Sun Jan 1 22:11:22 2012 (r229218) @@ -101,19 +101,20 @@ #include #include -#include #include +#include +#include #include +#include #include +#include +#include #include #include #include #include #include #include -#include -#include -#include struct nlist namelist[] = { #define X_TK_NIN 0 @@ -818,7 +819,7 @@ devstats(int perf_select, long double et mb_per_second_write > ((long double).0005)/1024 || busy_pct > 0.5) { if (Iflag == 0) - printf("%-8.8s %5.1Lf %5.1Lf %7.1Lf %7.1Lf %4qu %5.1Lf %3.0Lf ", + printf("%-8.8s %5.1Lf %5.1Lf %7.1Lf %7.1Lf %4" PRIu64 " %5.1Lf %3.0Lf ", devname, transfers_per_second_read, transfers_per_second_write, mb_per_second_read * 1024, @@ -826,7 +827,7 @@ devstats(int perf_select, long double et queue_len, ms_per_transaction, busy_pct); else - printf("%-8.8s %5.1Lf %5.1Lf %7.1Lf %7.1Lf %4qu %5.1Lf %3.0Lf ", + printf("%-8.8s %5.1Lf %5.1Lf %7.1Lf %7.1Lf %4" PRIu64 " %5.1Lf %3.0Lf ", devname, (long double)total_transfers_read, (long double)total_transfers_write, @@ -863,7 +864,7 @@ devstats(int perf_select, long double et msdig, ms_per_transaction); else - printf("%4.1qu%4.1qu%5.*Lf ", + printf("%4.1" PRIu64 "%4.1" PRIu64 "%5.*Lf ", total_blocks, total_transfers, msdig, @@ -878,7 +879,7 @@ devstats(int perf_select, long double et total_mb = total_bytes; total_mb /= 1024 * 1024; - printf(" %5.2Lf %3.1qu %5.2Lf ", + printf(" %5.2Lf %3.1" PRIu64 " %5.2Lf ", kb_per_transfer, total_transfers, total_mb); From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 22:15:39 2012 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 2F122106566C; Sun, 1 Jan 2012 22:15:39 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1A9BC8FC08; Sun, 1 Jan 2012 22:15: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 q01MFceU033468; Sun, 1 Jan 2012 22:15:39 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01MFcKO033465; Sun, 1 Jan 2012 22:15:38 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201201012215.q01MFcKO033465@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 1 Jan 2012 22:15:38 +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: r229219 - head/bin/sh 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, 01 Jan 2012 22:15:39 -0000 Author: jilles Date: Sun Jan 1 22:15:38 2012 New Revision: 229219 URL: http://svn.freebsd.org/changeset/base/229219 Log: sh: Remove unused function scopyn(). Modified: head/bin/sh/mystring.c head/bin/sh/mystring.h Modified: head/bin/sh/mystring.c ============================================================================== --- head/bin/sh/mystring.c Sun Jan 1 22:11:22 2012 (r229218) +++ head/bin/sh/mystring.c Sun Jan 1 22:15:38 2012 (r229219) @@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$"); * * equal(s1, s2) Return true if strings are equal. * scopy(from, to) Copy a string. - * scopyn(from, to, n) Like scopy, but checks for overflow. * number(s) Convert a string of digits to an integer. * is_number(s) Return true if s is a string of digits. */ @@ -67,24 +66,6 @@ char nullstr[1]; /* zero length string /* - * scopyn - copy a string from "from" to "to", truncating the string - * if necessary. "To" is always nul terminated, even if - * truncation is performed. "Size" is the size of "to". - */ - -void -scopyn(const char *from, char *to, int size) -{ - - while (--size > 0) { - if ((*to++ = *from++) == '\0') - return; - } - *to = '\0'; -} - - -/* * prefix -- see if pfx is a prefix of string. */ Modified: head/bin/sh/mystring.h ============================================================================== --- head/bin/sh/mystring.h Sun Jan 1 22:11:22 2012 (r229218) +++ head/bin/sh/mystring.h Sun Jan 1 22:15:38 2012 (r229219) @@ -35,7 +35,6 @@ #include -void scopyn(const char *, char *, int); int prefix(const char *, const char *); int number(const char *); int is_number(const char *); From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 22:17:12 2012 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 E9FB4106566C; Sun, 1 Jan 2012 22:17:12 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D39018FC0C; Sun, 1 Jan 2012 22:17:12 +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 q01MHC4R033567; Sun, 1 Jan 2012 22:17:12 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01MHCpN033556; Sun, 1 Jan 2012 22:17:12 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201201012217.q01MHCpN033556@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 1 Jan 2012 22:17:12 +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: r229220 - head/bin/sh 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, 01 Jan 2012 22:17:13 -0000 Author: jilles Date: Sun Jan 1 22:17:12 2012 New Revision: 229220 URL: http://svn.freebsd.org/changeset/base/229220 Log: sh: Make various functions static. Modified: head/bin/sh/exec.c head/bin/sh/exec.h head/bin/sh/expand.c head/bin/sh/expand.h head/bin/sh/histedit.c head/bin/sh/input.c head/bin/sh/input.h head/bin/sh/main.c head/bin/sh/main.h head/bin/sh/myhistedit.h Modified: head/bin/sh/exec.c ============================================================================== --- head/bin/sh/exec.c Sun Jan 1 22:15:38 2012 (r229219) +++ head/bin/sh/exec.c Sun Jan 1 22:17:12 2012 (r229220) @@ -100,6 +100,7 @@ static void tryexec(char *, char **, cha static void printentry(struct tblentry *, int); static struct tblentry *cmdlookup(const char *, int); static void delete_cmd_entry(void); +static void addcmdentry(const char *, struct cmdentry *); @@ -593,7 +594,7 @@ delete_cmd_entry(void) * the same name. */ -void +static void addcmdentry(const char *name, struct cmdentry *entry) { struct tblentry *cmdp; Modified: head/bin/sh/exec.h ============================================================================== --- head/bin/sh/exec.h Sun Jan 1 22:15:38 2012 (r229219) +++ head/bin/sh/exec.h Sun Jan 1 22:17:12 2012 (r229220) @@ -70,7 +70,6 @@ void find_command(const char *, struct c int find_builtin(const char *, int *); void hashcd(void); void changepath(const char *); -void addcmdentry(const char *, struct cmdentry *); void defun(const char *, union node *); int unsetfunc(const char *); int typecmd_impl(int, char **, int, const char *); Modified: head/bin/sh/expand.c ============================================================================== --- head/bin/sh/expand.c Sun Jan 1 22:15:38 2012 (r229219) +++ head/bin/sh/expand.c Sun Jan 1 22:17:12 2012 (r229220) @@ -113,6 +113,7 @@ static void expmeta(char *, char *); static void addfname(char *); static struct strlist *expsort(struct strlist *); static struct strlist *msort(struct strlist *, int); +static int patmatch(const char *, const char *, int); static char *cvtnum(int, char *); static int collate_range_cmp(wchar_t, wchar_t); @@ -1441,7 +1442,7 @@ match_charclass(const char *p, wchar_t c * Returns true if the pattern matches the string. */ -int +static int patmatch(const char *pattern, const char *string, int squoted) { const char *p, *q, *end; Modified: head/bin/sh/expand.h ============================================================================== --- head/bin/sh/expand.h Sun Jan 1 22:15:38 2012 (r229219) +++ head/bin/sh/expand.h Sun Jan 1 22:17:12 2012 (r229220) @@ -60,6 +60,5 @@ union node; void expandhere(union node *, int); void expandarg(union node *, struct arglist *, int); void expari(int); -int patmatch(const char *, const char *, int); void rmescapes(char *); int casematch(union node *, const char *); Modified: head/bin/sh/histedit.c ============================================================================== --- head/bin/sh/histedit.c Sun Jan 1 22:15:38 2012 (r229219) +++ head/bin/sh/histedit.c Sun Jan 1 22:17:12 2012 (r229220) @@ -70,6 +70,8 @@ int displayhist; static FILE *el_in, *el_out, *el_err; static char *fc_replace(const char *, char *, char *); +static int not_fcnumber(const char *); +static int str_to_event(const char *, int); /* * Set history and editing status. Called whenever the status may @@ -425,7 +427,7 @@ fc_replace(const char *s, char *p, char return (dest); } -int +static int not_fcnumber(const char *s) { if (s == NULL) @@ -435,7 +437,7 @@ not_fcnumber(const char *s) return (!is_number(s)); } -int +static int str_to_event(const char *str, int last) { HistEvent he; Modified: head/bin/sh/input.c ============================================================================== --- head/bin/sh/input.c Sun Jan 1 22:15:38 2012 (r229219) +++ head/bin/sh/input.c Sun Jan 1 22:17:12 2012 (r229220) @@ -106,6 +106,7 @@ EditLine *el; /* cookie for editline p static void pushfile(void); static int preadfd(void); +static void popstring(void); #ifdef mkinit INCLUDE "input.h" @@ -372,7 +373,7 @@ pushstring(char *s, int len, void *ap) INTON; } -void +static void popstring(void) { struct strpush *sp = parsefile->strpush; Modified: head/bin/sh/input.h ============================================================================== --- head/bin/sh/input.h Sun Jan 1 22:15:38 2012 (r229219) +++ head/bin/sh/input.h Sun Jan 1 22:17:12 2012 (r229220) @@ -53,7 +53,6 @@ int preadbuffer(void); int preadateof(void); void pungetc(void); void pushstring(char *, int, void *); -void popstring(void); void setinputfile(const char *, int); void setinputfd(int, int); void setinputstring(char *, int); Modified: head/bin/sh/main.c ============================================================================== --- head/bin/sh/main.c Sun Jan 1 22:15:38 2012 (r229219) +++ head/bin/sh/main.c Sun Jan 1 22:17:12 2012 (r229220) @@ -79,6 +79,7 @@ int rootshell; struct jmploc main_handler; int localeisutf8, initial_localeisutf8; +static void cmdloop(int); static void read_profile(char *); static char *find_dot_file(char *); @@ -184,7 +185,7 @@ state4: /* XXX ??? - why isn't this befo * loop; it turns on prompting if the shell is interactive. */ -void +static void cmdloop(int top) { union node *n; Modified: head/bin/sh/main.h ============================================================================== --- head/bin/sh/main.h Sun Jan 1 22:15:38 2012 (r229219) +++ head/bin/sh/main.h Sun Jan 1 22:17:12 2012 (r229220) @@ -38,4 +38,3 @@ extern int rootshell; /* true if we aren extern struct jmploc main_handler; /* top level exception handler */ void readcmdfile(const char *); -void cmdloop(int); Modified: head/bin/sh/myhistedit.h ============================================================================== --- head/bin/sh/myhistedit.h Sun Jan 1 22:15:38 2012 (r229219) +++ head/bin/sh/myhistedit.h Sun Jan 1 22:17:12 2012 (r229220) @@ -39,6 +39,4 @@ extern int displayhist; void histedit(void); void sethistsize(const char *); void setterm(const char *); -int not_fcnumber(const char *); -int str_to_event(const char *, int); From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 22:26:56 2012 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 A4AFD106566B; Sun, 1 Jan 2012 22:26:56 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 849C88FC0A; Sun, 1 Jan 2012 22:26: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 q01MQuEj033969; Sun, 1 Jan 2012 22:26:56 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01MQueA033966; Sun, 1 Jan 2012 22:26:56 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201012226.q01MQueA033966@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 22:26:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229221 - stable/9/usr.sbin/keyserv 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, 01 Jan 2012 22:26:56 -0000 Author: dim Date: Sun Jan 1 22:26:56 2012 New Revision: 229221 URL: http://svn.freebsd.org/changeset/base/229221 Log: MFC r228662: In usr.sbin/keyserv, fix some implicit enum conversions, and use the correct printf length modifiers for uid_t. Modified: stable/9/usr.sbin/keyserv/crypt_server.c stable/9/usr.sbin/keyserv/keyserv.c Directory Properties: stable/9/usr.sbin/keyserv/ (props changed) Modified: stable/9/usr.sbin/keyserv/crypt_server.c ============================================================================== --- stable/9/usr.sbin/keyserv/crypt_server.c Sun Jan 1 22:17:12 2012 (r229220) +++ stable/9/usr.sbin/keyserv/crypt_server.c Sun Jan 1 22:26:56 2012 (r229221) @@ -223,8 +223,8 @@ des_crypt_1_svc(desargs *argp, struct sv bcopy(argp->des_key, dparm.des_key, 8); bcopy(argp->des_ivec, dparm.des_ivec, 8); - dparm.des_mode = argp->des_mode; - dparm.des_dir = argp->des_dir; + dparm.des_mode = (argp->des_mode == CBC_DES) ? CBC : ECB; + dparm.des_dir = (argp->des_dir == ENCRYPT_DES) ? ENCRYPT : DECRYPT; #ifdef BROKEN_DES dparm.UDES.UDES_buf = argp->desbuf.desbuf_val; #endif Modified: stable/9/usr.sbin/keyserv/keyserv.c ============================================================================== --- stable/9/usr.sbin/keyserv/keyserv.c Sun Jan 1 22:17:12 2012 (r229220) +++ stable/9/usr.sbin/keyserv/keyserv.c Sun Jan 1 22:26:56 2012 (r229221) @@ -361,7 +361,7 @@ key_set_1_svc_prog(uid, key) static keystatus status; if (debugging) { - (void) fprintf(stderr, "set(%ld, %.*s) = ", uid, + (void) fprintf(stderr, "set(%u, %.*s) = ", uid, (int) sizeof (keybuf), key); } status = pk_setkey(uid, key); @@ -380,7 +380,7 @@ key_encrypt_pk_2_svc_prog(uid, arg) static cryptkeyres res; if (debugging) { - (void) fprintf(stderr, "encrypt(%ld, %s, %08x%08x) = ", uid, + (void) fprintf(stderr, "encrypt(%u, %s, %08x%08x) = ", uid, arg->remotename, arg->deskey.key.high, arg->deskey.key.low); } @@ -408,7 +408,7 @@ key_decrypt_pk_2_svc_prog(uid, arg) static cryptkeyres res; if (debugging) { - (void) fprintf(stderr, "decrypt(%ld, %s, %08x%08x) = ", uid, + (void) fprintf(stderr, "decrypt(%u, %s, %08x%08x) = ", uid, arg->remotename, arg->deskey.key.high, arg->deskey.key.low); } @@ -460,7 +460,7 @@ key_net_get_2_svc_prog(uid, arg) static key_netstres keynetname; if (debugging) - (void) fprintf(stderr, "net_get(%ld) = ", uid); + (void) fprintf(stderr, "net_get(%u) = ", uid); keynetname.status = pk_netget(uid, &keynetname.key_netstres_u.knet); if (debugging) { @@ -489,8 +489,8 @@ key_get_conv_2_svc_prog(uid, arg) static cryptkeyres res; if (debugging) - (void) fprintf(stderr, "get_conv(%ld, %.*s) = ", uid, - (int)sizeof (arg), arg); + (void) fprintf(stderr, "get_conv(%u, %.*s) = ", uid, + (int)sizeof (keybuf), arg); res.status = pk_get_conv_key(uid, arg, &res); @@ -517,7 +517,7 @@ key_encrypt_1_svc_prog(uid, arg) static cryptkeyres res; if (debugging) { - (void) fprintf(stderr, "encrypt(%ld, %s, %08x%08x) = ", uid, + (void) fprintf(stderr, "encrypt(%u, %s, %08x%08x) = ", uid, arg->remotename, arg->deskey.key.high, arg->deskey.key.low); } @@ -545,7 +545,7 @@ key_decrypt_1_svc_prog(uid, arg) static cryptkeyres res; if (debugging) { - (void) fprintf(stderr, "decrypt(%ld, %s, %08x%08x) = ", uid, + (void) fprintf(stderr, "decrypt(%u, %s, %08x%08x) = ", uid, arg->remotename, arg->deskey.key.high, arg->deskey.key.low); } @@ -789,7 +789,7 @@ root_auth(trans, rqstp) } if (debugging) - fprintf(stderr, "local_uid %ld\n", uid); + fprintf(stderr, "local_uid %u\n", uid); if (uid == 0) return (1); if (rqstp->rq_cred.oa_flavor == AUTH_SYS) { @@ -800,7 +800,7 @@ root_auth(trans, rqstp) } else { if (debugging) fprintf(stderr, - "local_uid %ld mismatches auth %ld\n", uid, + "local_uid %u mismatches auth %u\n", uid, ((uid_t) ((struct authunix_parms *)rqstp->rq_clntcred)->aup_uid)); return (0); } From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 22:33:04 2012 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 B42931065675; Sun, 1 Jan 2012 22:33:04 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 95F868FC0C; Sun, 1 Jan 2012 22:33:04 +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 q01MX4Su034341; Sun, 1 Jan 2012 22:33:04 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01MX2ow034338; Sun, 1 Jan 2012 22:33:02 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201201012233.q01MX2ow034338@svn.freebsd.org> From: Doug Barton Date: Sun, 1 Jan 2012 22:33:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229222 - stable/9/games/fortune/datfiles 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, 01 Jan 2012 22:33:04 -0000 Author: dougb Date: Sun Jan 1 22:33:02 2012 New Revision: 229222 URL: http://svn.freebsd.org/changeset/base/229222 Log: MFC r228909: 1. Remove a bunch of duplicates. Usually this means removing them from fortunes, but occasionally remove them from the other 2 files when they are not offensive, or not murphy'ish enough. Where the version in fortunes had better attribution and/or formatting, copy it over. 2. Fix a few typos 3. Use the full name of François De La Rochefoucauld, fix one of his quotes, and remove the duplicate of it. MFC r228934: Prefer ASCII apostrophes over Unicode ones like the rest of the file. MFC r228938: 1. Correct capitalization of the nobility particle for Francois de La Rochefoucauld introduced in r228909 2. Change c-cedilla introduced in the same commit to ASCII c since non-UTF-8 terminals will choke on the non-ASCII text. Modified: stable/9/games/fortune/datfiles/fortunes stable/9/games/fortune/datfiles/fortunes-o.real stable/9/games/fortune/datfiles/murphy Directory Properties: stable/9/games/fortune/ (props changed) Modified: stable/9/games/fortune/datfiles/fortunes ============================================================================== --- stable/9/games/fortune/datfiles/fortunes Sun Jan 1 22:26:56 2012 (r229221) +++ stable/9/games/fortune/datfiles/fortunes Sun Jan 1 22:33:02 2012 (r229222) @@ -773,40 +773,6 @@ the female, autopsied her, and sure enou "What do you think?" said the first ranger. "The Czech is in the male," replied the second. % - A group of soldiers being prepared for a practice landing on a tropical -island were warned of the one danger the island held, a poisonous snake that -could be readily identified by its alternating orange and black bands. They -were instructed, should they find one of these snakes, to grab the tail end of -the snake with one hand and slide the other hand up the body of the snake to -the snake's head. Then, forcefully, bend the thumb above the snake's head -downward to break the snake's spine. All went well for the landing, the -charge up the beach, and the move into the jungle. At one foxhole site, two -men were starting to dig and wondering what had happened to their partner. -Suddenly he staggered out of the underbrush, uniform in shreds, covered with -blood. He collapsed to the ground. His buddies were so shocked they could -only blurt out, "What happened?" - "I ran from the beachhead to the edge of the jungle, and, as I hit the -ground, I saw an orange and black striped snake right in front of me. I -grabbed its tail end with my left hand. I placed my right hand above my left -hand. I held firmly with my left hand and slid my right hand up the body of -the snake. When I reached the head of the snake I flicked my right thumb down -to break the snake's spine... did you ever goose a tiger?" -% - A guy returns from a long trip to Europe, having left his beloved -dog in his brother's care. The minute he's cleared customs, he calls up his -brother and inquires after his pet. - "Your dog's dead," replies his brother bluntly. - The guy is devastated. "You know how much that dog meant to me," -he moaned into the phone. "Couldn't you at least have thought of a nicer way -of breaking the news? Couldn't you have said, `Well, you know, the dog got -outside one day, and was crossing the street, and a car was speeding around a -corner...' or something...? Why are you always so thoughtless?" - "Look, I'm sorry," said his brother, "I guess I just didn't think." - "Okay, okay, let's just put it behind us. How are you anyway? -How's Mom?" - His brother is silent a moment. "Uh," he stammers, "uh... Mom got -outside one day..." -% A hard-luck actor who appeared in one colossal disaster after another finally got a break, a broken leg to be exact. Someone pointed out that it's the first time the poor fellow's been in the same cast for more than a week. @@ -1137,12 +1103,6 @@ went out to be killed? The Pole pulls a bottle of vodka from the other side of his jacket. He smiles and replies, "Five men on one bottle -- too many." % - A priest was walking along the cliffs at Dover when he came upon -two locals pulling another man ashore on the end of a rope. "That's what -I like to see", said the priest, "A man helping his fellow man". - As he was walking away, one local remarked to the other, "Well, -he sure doesn't know the first thing about shark fishing." -% A program should be light and agile, its subroutines connected like a strings of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little nor too much, neither needless @@ -1361,16 +1321,6 @@ realize the full significance of Pharoah -- Grendel Briarton "Through Time & Space With Ferdinand Feghoot!" % - After watching an extremely attractive maternity-ward patient -earnestly thumbing her way through a telephone directory for several -minutes, a hospital orderly finally asked if he could be of some help. - "No, thanks," smiled the young mother, "I'm just looking for a -name for my baby." - "But the hospital supplies a special booklet that lists hundreds -of first names and their meanings," said the orderly. - "That won't help," said the woman, "my baby already has a first -name." -% All I really need to know about how to live and what to do and how to be I learned in kindergarten. Wisdom was not at the top of the graduate-school mountain, but there in the sandpile at Sunday School. @@ -1470,26 +1420,6 @@ the ideas and frills that were cautiousl The result, as Ovid says, is a "big pile". -- Frederick Brooks, Jr., "The Mythical Man-Month" % - An eighty-year-old woman is rocking away the afternoon on her -porch when she sees an old, tarnished lamp sitting near the steps. She -picks it up, rubs it gently, and lo and behold a genie appears! The genie -tells the woman the he will grant her any three wishes her heart desires. - After a bit of thought, she says, "I wish I were young and -beautiful!" And POOF! In a cloud of smoke she becomes a young, beautiful, -voluptuous woman. - After a little more thought, she says, "I would like to be rich -for the rest of my life." And POOF! When the smoke clears, there are -stacks and stacks of money lying on the porch. - The genie then says, "Now, madam, what is your final wish?" - "Well," says the woman, "I would like for you to transform my -faithful old cat, whom I have loved dearly for fifteen years, into a young -handsome prince!" - And with another billow of smoke the cat is changed into a tall, -handsome, young man, with dark hair, dressed in a dashing uniform. - As they gaze at each other in adoration, the prince leans over to -the woman and whispers into her ear, "Now, aren't you sorry you had me -fixed?" -% An elderly man stands in line for hours at a Warsaw meat store (meat is severely rationed). When the butcher comes out at the end of the day and announces that there is no meat left, the man flies into a rage. @@ -1552,14 +1482,6 @@ young welp with a masochistic streak who up-and-down bureaucracy in the history of mankind." -- R. L. Forward, "Flight of the Dragonfly" % - "Anything else, sir?" asked the attentive bellhop, trying his best -to make the lady and gentleman comfortable in their penthouse suite in the -posh hotel. - "No. No, thank you," replied the gentleman. - "Anything for your wife, sir?" the bellhop asked. - "Why, yes, young man," said the gentleman. "Would you bring me -a postcard?" -% "Anything else you wish to draw to my attention, Mr. Holmes ?" "The curious incident of the stable dog in the nighttime." "But the dog did nothing in the nighttime." @@ -1932,52 +1854,16 @@ said the Duck: "it's generally a frog or The question is, what did the archbishop find?" % - Four Oxford dons were taking their evening walk together and as -usual, were engaged in casual but learned conversation. On this particular -evening, their conversation was about the names given to groups of animals, -such as a "pride of lions" or a "gaggle of geese." - One of the professors noticed a group of prostitutes down the block, -and posed the question, "What name would be given to that group?" The four -fell into silence for a moment, as they pondered the possibilities... - At last, one spoke: "How about `a Jam of Tarts'?" The others nodded -in acknowledgment as they continued to consider the problem. A second -professor spoke: "I'd suggest `an Essay of Trollops.'" Again, the others -nodded. A third spoke: "I propose `a Flourish of Strumpets.'" - They continued their walk in silence, until the first professor -remarked to the remaining professor, who was the most senior and learned of -the four, "You haven't suggested a name for our ladies. What are your -thoughts?" - Replied the fourth professor, "`An Anthology of Prose.'" -% Fred noticed his roommate had a black eye upon returning from a dance. "What happened?" "I was struck by the beauty of the place." % - Friends were surprised, indeed, when Frank and Jennifer broke their -engagement, but Frank had a ready explanation: "Would you marry someone who -was habitually unfaithful, who lied at every turn, who was selfish and lazy -and sarcastic?" - "Of course not," said a sympathetic friend. - "Well," retorted Frank, "neither would Jennifer." -% "Gee, Mudhead, everyone at Morse Science High has an extracurricular activity except you." "Well, gee, doesn't Louise count?" "Only to ten, Mudhead." -- The Firesign Theatre % - "Gentlemen of the jury," said the defense attorney, now beginning -to warm to his summation, "the real question here before you is, shall this -beautiful young woman be forced to languish away her loveliest years in a -dark prison cell? Or shall she be set free to return to her cozy little -apartment at 4134 Mountain Ave. -- there to spend her lonely, loveless hours -in her boudoir, lying beside her little Princess phone, 962-7873?" -% - God decided to take the devil to court and settle their -differences once and for all. - When Satan heard of this, he grinned and said, "And just -where do you think you're going to find a lawyer?" -% Graduating seniors, parents and friends... Let me begin by reassuring you that my remarks today will stand up to the most stringent requirements of the new appropriateness. @@ -2050,33 +1936,6 @@ for it is complete within itself. It ex Software and Hardware, ashamed, returned to their homes. -- Geoffrey James, "The Tao of Programming" % - Harry, a golfing enthusiast if there ever was one, arrived home -from the club to an irate, ranting wife. - "I'm leaving you, Harry," his wife announced bitterly. "You -promised me faithfully that you'd be back before six and here it is almost -nine. It just can't take that long to play 18 holes of golf." - "Honey, wait," said Harry. "Let me explain. I know what I promised -you, but I have a very good reason for being late. Fred and I tee'd off -right on time and everything was fine for the first three holes. Then, on -the fourth tee Fred had a stroke. I ran back to the clubhouse but couldn't -find a doctor. And, by the time I got back to Fred, he was dead. So, for -the next 15 holes, it was hit the ball, drag Fred, hit the ball, drag Fred... -% - Harry constantly irritated his friends with his eternal optimism. -No matter how bad the situation, he would always say, "Well, it could have -been worse." - To cure him of his annoying habit, his friends decided to invent a -situation so completely black, so dreadful, that even Harry could find no -hope in it. Approaching him at the club bar one day, one of them said, -"Harry! Did you hear what happened to George? He came home last night, -found his wife in bed with another man, shot them both, and then turned -the gun on himself!" - "Terrible," said Harry. "But it could have been worse." - "How in hell," demanded his dumbfounded friend, "could it possibly -have been worse?" - "Well," said Harry, "if it had happened the night before, I'd be -dead right now." -% "Has anyone had problems with the computer accounts?" "Yes; I don't have one." "Okay, you can send mail to one of the tutors..." @@ -2112,13 +1971,6 @@ lessening mine; as he who lights his tap without darkening me. -- Thomas Jefferson on patents on ideas % - "Heard you were moving your piano, so I came over to help." - "Thanks. Got it upstairs already." - "Do it alone?" - "Nope. Hitched the cat to it." - "How would that help?" - "Used a whip." -% "Hey, Sam, how about a loan?" "Whattaya need?" "Oh, about $500." @@ -2182,11 +2034,6 @@ could forget that, to within half a perc social climber said to her roommate. "I mean, I've never seen a Porsche full of money before." % - "How'd you get that flat?" - "Ran over a bottle." - "Didn't you see it?" - "Damn kid had it under his coat." -% Human thinking can skip over a great deal, leap over small misunderstandings, can contain ifs and buts in untroubled corners of the mind. But the machine has no corners. Despite all the attempts to @@ -2199,11 +2046,6 @@ line by code line, the programmer confro The ways of human and machine understanding are disjunct. -- Ellen Ullman, "Close to the Machine" % - "I believe you have the wrong number," said the old gentleman into -the phone. "You'll have to call the weather bureau for that information." - "Who was that?" his young wife asked. - "Some guy wanting to know if the coast was clear." -% "I cannot read the fiery letters," said Frito Bugger in a quavering voice. "No," said GoodGulf, "but I can. The letters are Elvish, of @@ -2496,11 +2338,6 @@ it gets so bad you can't handle it alone would destroy the whole point of it." -- Thomas Pynchon, "The Crying of Lot 49" % - "I'm looking for adventure, excitement, beautiful women," cried the -young man to his father as he prepared to leave home. "Don't try to stop me. -I'm on my way." - "Who's trying to stop you?" shouted the father. "Take me along!" -% I'm sure that VMS is completely documented, I just haven't found the right manual yet. I've been working my way through the manuals in the document library and I'm half way through the second cabinet, (3 shelves to go), so I @@ -2558,20 +2395,6 @@ pie-bakers and pie-dividers is way out o been an efficiency expert? -- Motor Trend, May 1983 % - In the beginning, God created the Earth and he said, "Let there be -mud." - And there was mud. - And God said, "Let Us make living creatures out of mud, so the mud -can see what we have done." - And God created every living creature that now moveth, and one was -man. Mud-as-man alone could speak. - "What is the purpose of all this?" man asked politely. - "Everything must have a purpose?" asked God. - "Certainly," said man. - "Then I leave it to you to think of one for all of this," said God. - And He went away. - -- Kurt Vonnegut, Jr., "Between Time and Timbuktu" -% In the beginning there was data. The data was without form and null, and darkness was upon the face of the console; and the Spirit of IBM was moving over the face of the market. And DEC said, "Let there @@ -2926,11 +2749,6 @@ Church soon made its peace with Galileo' earth really does revolve about the sun. -- S. J. Gould, "The Mismeasure of Man" % - "My mother," said the sweet young steno, "says there are some things -a girl should not do before twenty." - "Your mother is right," said the executive, "I don't like a large -audience, either." -% NEW YORK -- Kraft Foods, Inc. announced today that its board of directors unanimously rejected the $11 billion takeover bid by Philip Morris and Co. A Kraft spokesman stated in a press conference that the @@ -3727,14 +3545,6 @@ was solidly entrenched in the market, an improve ... -- Dave Barry, "In Search of Excellence" % - "That wife of mine is a liar," said the angry husband to a -sympathetic pal seated next to him in a bar. - "How do you know?" the friend asked. - "She didn't come home last night, and when I asked her where -she'd been she said she'd spent the night with her sister Shirley." - "So?" - "So, she's a liar. I spent the night with her sister Shirley." -% "That's right; the upper-case shift works fine on the screen, but they're not coming out on the damn printer... Hold? Sure, I'll hold." -- e. e. cummings last service call @@ -3768,13 +3578,6 @@ laughed uproariously. "What's the matte got a sense of humor?" "I don't have to laugh," she said. "I'm leaving Friday anyway. % - The doctor had just finished giving the young man a thorough -physical examination. "The best thing for you to do," the M.D. said, -"is give up drinking, give up smoking, get to bed early and stay away -from women." - "Doc, I don't deserve the best," pleaded his patient. "What's -second best?" -% The FIELD GUIDE to NORTH AMERICAN MALES SPECIES: Cranial Males @@ -3889,22 +3692,6 @@ win through and still know where his tow reckoned with. -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy" % - The honeymooning couple agreed it was a fine day for horseback riding. -After a mile or so, the bride's mount cantered under a low tree and a -branch scraped her forehead lightly. The groom dismounted, glared at his -wife's horse, and said, "That's number one." - The ride then proceeded. After another mile or so, the bride's -horse stumbled over a pebble and the lady suffered a slight jostling. -Again, her man leapt from his saddle and strode over to the nervous animal. -"That's two," he said. - Five miles later, the bride's horse became frightened when a rabbit -crossed its path, reared up and threw the girl. Immediately, the groom was -off his horse. "That's three!", he shouted, and, pulling out a pistol, he -shot the horse between the eyes. - "You brute!" shrieked his bride. "Now I see the kind of man I -married! You're a sadist, that's what!" - The groom turned to her coolly. "That's one," he said. -% "The jig's up, Elman." "Which jig?" -- Jeff Elman @@ -4349,29 +4136,6 @@ of his mortal enemy -- to those both com spread only for demons or for gods." -- Gordon R. Dickson, "Soldier Ask Not" % - "They spend years searching for their natural parents, convinced their -parents will be happy to see them. I mean, really, can you imagine someone -being happy to see an orphan? Nobody wants them... that's why they're orphans!" - The speaker is Anne Baker, founder and guiding force behind -Orphan-Off, an organization dedicated to keeping orphans confused about the -whereabouts of their natural parents. She is a woman with a mission: - "Basically, what we do is band together to exchange information -about which orphans are looking for which parents in what part of the -country. We're completely computerized. - "The idea is to throw the orphans as many red herrings and false -leads as possible. We'll tell some twenty-three-year-old loser that his -real parents can be found at a certain address on the other side of the -country. Well, by the time the kid shows up, the family is prepared. They -look over the kid's photos and information and they say, 'Oh, the Emersons... -yeah, they used to live here... I think they moved out about five years ago. -I think they went to Iowa, or maybe Idaho.' - "Bam, the door shuts in the kid's face and he's back to zero again. -He's got nothing to go on but the orphan's pathetic determination to continue. - "It's really amazing how much these kids will put up with. Last year -we even sent one kid all the way to Australia. I mean, really. Besides, if -your natural parents were Australian, would you want to meet them?" - -- "National Lampoon", September, 1984 -% This is where the bloodthirsty license agreement is supposed to go, explaining that Interactive EasyFlow is a copyrighted package licensed for use by a single person, and sternly warning you not to pirate copies of it @@ -4683,13 +4447,6 @@ men with whom I felt an immediate sympat more satisfactory to me than the opaque vogue word "empathy". -- Alistair Cooke, "Six Men" % - "What the hell are you getting so upset about? I thought you -didn't believe in God". - "I don't," she sobbed, bursting violently into tears, "but the -God I don't believe in is a good God, a just God, a merciful God. He's -not the mean and stupid God you make Him out to be". - -- Joseph Heller -% "What was the worst thing you've ever done?" "I won't tell you that, but I'll tell you the worst thing that ever happened to me... the most dreadful thing." @@ -4806,20 +4563,6 @@ unanswered. Eventually the form for the the section marked "DEDUCTIONS," Rogers listed: "Bad debt, US Government -- $40,000." % - With deep concern, if not alarm, Dick noted that his friend -Conrad was drunker than he'd ever seen him before. "What's the trouble, -buddy?", he asked, sliding onto the stool next to his friend. - "It's a woman, Dick," Conrad replied. - "I guessed that much. Tell me about it." - "I can't," Conrad said. But after a few more drinks his tongue -and resolution both seemed to weaken and, turning to his buddy, he said, -"Okay. It's your wife." - "My wife!!" - "Yeah." - "What about her?" - Conrad pondered the question heavily, and draped his arm around -his pal. "Well, buddy-boy," he said, "I'm afraid she's cheating on us." -% Work Hard. Rock Hard. Eat Hard. @@ -4956,7 +4699,7 @@ the soul. Worry, doubt, self-distrust, long, long years that bow the head and turn the growing spirit back to dust. - Whether seventy or sixteen, there is in every being’s heart a + Whether seventy or sixteen, there is in every being's heart a love of wonder; the sweet amazement at the stars and starlike things and thoughts; the undaunted challenge of events, the unfailing childlike appetite for what comes next, and the joy in the game of life. @@ -6593,9 +6336,6 @@ a fund for his funeral. The Lord Chief a shilling. "Only a shilling?" exclaimed the man. "Only a shilling to bury an attorney? Here's a guinea; go and bury twenty of them." % -A fail-safe circuit will destroy others. - -- Klipstein -% A failure will not appear until a unit has passed final inspection. % A fair exterior is a silent recommendation. @@ -6662,17 +6402,6 @@ go!'" % A few hours grace before the madness begins again. % -A figure with curves always offers a lot of interesting angles. -% -A fisherman from Maine went to Alabama on his vacation. He rented a boat, -rowed out to the middle of the lake, and cast his line, but when he looked -down into the water he was horrified to see a man wrapped in chains lying -on the bottom of the lake. He quickly rowed to shore and ran to the police -station. "Sheriff, sheriff," he gasped, there's a guy wrapped in chains, -drowned in the lake!" - "Now ain't that jest like a Yankee," drawled the sheriff, "to steal -more chain than he can swim with?" -% A fitter fits; Though sinners sin A cutter cuts; And thinners thin And an aircraft spotter spots; And paper-blotters blot @@ -6697,11 +6426,6 @@ A fool and his honey are soon parted. % A fool and his money are soon popular. % -A fool and your money are soon partners. -% -A fool is a man who worries about whether or not his lover has integrity. -A wise man, on the other hand, busies himself with deeper attributes. -% A fool must now and then be right by chance. % A foolish consistency is the hobgoblin of little minds. @@ -6744,8 +6468,6 @@ You'll just be walking down the street a A friend of mine won't get a divorce, because he hates lawyers more than he hates his wife. % -A friend with weed is a friend indeed. -% A full belly makes a dull brain. -- Benjamin Franklin @@ -6809,9 +6531,6 @@ A girl with a future avoids the man with A girl's best friend is her mutter. -- Dorothy Parker % -A girl's conscience doesn't really keep her from doing anything wrong-- -it merely keeps her from enjoying it. -% A gleekzorp without a tornpee is like a quop without a fertsneet (sort of). % @@ -7102,27 +6821,6 @@ A language that doesn't have everything actually easier to program in than some that do. -- Dennis M. Ritchie % -A lanky Texan was mad because Texas had just become the second largest state in -the Union, so he made up his mind to move to Alaska. He drove for three days -and three nights to get there and finally he came to what looked like the state -line. He halted his car and walked up to the border guard. "Hi, there! How -do I become a resident of this here biggest state?" demanded the Texan. - The guard looked him up and down and grinned. "Waal," he answered, -there are three things you gotta do to get in. First, drink down a quart of -110 proof corn liquor without blinkin'. Second, kill a grizzly bear, and -third, make love to an Eskimo woman." - "Sounds easy enough," said the Texan. "Where can I get a quart of -this here corn liquor?" - "Got one right here," replied the guard. - The Texan gulped down the whiskey without batting an eyelash. -"Now, do you happen to know where I can find me a grizzly?" - "Yep," answered the guard, "there's a big b'ar over that way, 'bout -a mile... lives in a cave on that cliff." - The Texan lurched merrily off. About an hour later he returned -with his clothes almost torn off and his face scratched and bloody. He was -smiling happily. "Now," he roared, "where's that damn Eskimo woman you -want killed?" -% A large number of installed systems work by fiat. That is, they work by being declared to work. -- Anatol Holt @@ -7230,33 +6928,16 @@ A lot of people I know believe in positi and so do I. I believe everything positively stinks. -- Lew Col % -A lover without indiscretion is no lover at all. - -- Thomas Hardy -% A major, with wonderful force, Called out in Hyde Park for a horse. All the flowers looked round, But no horse could be found; So he just rhododendron, of course. % -A male gynecologist is like an auto mechanic who has never owned a car. - -- Carrie Snow -% -A man always needs to remember one thing about -a beautiful woman. Somewhere, somebody's tired of her. -% A man always remembers his first love with special tenderness, but after that begins to bunch them. -- H. L. Mencken % -A man arrived home early to find his wife in the arms of his best friend, -who swore how much they were in love. To quiet the enraged husband, the -lover suggested, "Friends shouldn't fight, let's play gin rummy. If I win, -you get a divorce so I can marry her. If you win, I promise never to see -her again. Okay?" - "Alright," agreed the husband. "But how about a quarter a point -on the side to make it interesting?" -% A man can have two, maybe three love affairs while he's married. After that it's cheating. -- Yves Montand @@ -7393,9 +7074,6 @@ in no other way. A man who fishes for marlin in ponds will put his money in Etruscan bonds. % -A man who likes to lie in bed can usually -find a girl willing to listen to him. -% A man who turns green has eschewed protein. % A man with 3 wings and a dictionary is cousin to the turkey. @@ -7403,12 +7081,8 @@ A man with 3 wings and a dictionary is c A man with one watch knows what time it is. A man with two watches is never quite sure. % -A man without a God is like a fish without a bicycle. -% A man without a woman is like a fish without gills. % -A man without a woman is like a statue without pigeons. -% A man would still do something out of sheer perversity - he would create destruction and chaos - just to gain his point... and if all this could in turn be analyzed and prevented by predicting that it would occur, then man @@ -7593,33 +7267,6 @@ will go far towards curing the rascal of A New York City ordinance prohibits the shooting of rabbits from the rear of a Third Avenue street car -- if the car is in motion. % -A New Yorker is riding down the road in his new Mercedes. So intent is he -on the cocaine in his hand he completely misses a turn and his car plunges -over the five-hundred-foot cliff to be smashed into pieces at the bottom. -As the on-lookers rush to the edge of the cliff they see him fifty feet -from the top of the cliff clinging to a stunted bush with all his strength. -"Dear Lord," he prays, "I never asked you for nothin' before, but I'm askin' -you now: Save me, Lord, save me." - Booms the Lord: "LET GO OF THE BRANCH." - "But Lord, if I do that, I'll fall!" - "TRUST ME, LET GO OF THE BRANCH." - "But Lord, I'm gonna fall and die..." - "TRUST ME TO SAVE YOU. LET GO OF THE BRANCH." - Okay, Lord, I'll trust you, here I... here I go!" And he falls -to his death. - "DUMB YANKEE." -% -A New Yorker was driving through Berkeley when he saw a big crowd gathered -by the side of the street. Curiosity got the better of him and he leaned -out of his window to ask an onlooker what was going on. The fellow explained -that a protestor against the U.S. position in South America had doused -himself with gasoline and set himself on fire. "That's terrible," gasped -the man. "But why is everyone still standing around?" - "Well, they're taking up a collection for his wife and kids," the -onlooker explained. "Would you be willing to help?" - "Well, sure," replied the New Yorker. "I suppose I could spare a -gallon or two." -% A newspaper is a circulating library with high blood pressure. -- Arthure "Bugs" Baer % @@ -7684,12 +7331,6 @@ itself, and that is an excellent thing f manufacturers for whom patriotic terrors are an abundant source of gain. -- Anatole France % -A perfectly honest woman, a woman who never flatters, who never manages, -who never cajoles, who never conceals, who never uses her eyes, who never -speculates on the effect which she produces, who never is conscious of -unspoken admiration, what a monster, I say, would such a female be! - -- Thackeray -% A person forgives only when they are in the wrong. % A person is just about as big as the things that make him angry. @@ -7794,8 +7435,6 @@ last pair of shoes, already worn out in of yours to press against my heart. -- Johann Wolfgang von Goethe % -A pretty woman can do anything; an ugly woman must do everything. -% A priest advised Voltaire on his death bed to renounce the devil. Replied Voltaire, "This is no time to make new enemies." % @@ -7881,23 +7520,6 @@ the ball is more than three inches from to make a travesty of the game. -- Donald A. Metz % -A rabbi and a priest are sitting together on a train, and the rabbi leans -over and asks, "So, how high can you advance in your organization?" - The priest replies, "Well, if I am lucky, I guess I could become a -Bishop." - "Well, could you get any higher than that?" - "I suppose that if my works are seen in a very good light that I -might be made an Archbishop." - "Is there any way that you might go higher than that?" - "If all the Saints should smile, I guess I could be made a Cardinal." - "Could you be anything higher than a Cardinal?" - Hesitating a little bit, the priest said, "I suppose that I could -be elected Pope, but only if it's God's will." - "And could you be anything higher than that, is there any way to go -up from being the Pope?" - "What?! I should be the Messiah himself?!" - The rabbi leaned back and smiled. "One of our boys made it." -% A raccoon tangled with a 23,000 volt line today. The results blacked out 1400 homes and, of course, one raccoon. -- Steel City News @@ -7912,17 +7534,6 @@ A real diplomat is one who can cut his n his neighbor notice it. -- Trygve Lie % -A real estate agent, looking over a farmer's house for possible sale, -commented to the farmer how sturdy the house looked. - The farmer replied, "Yep, built it with my bare hands... did it -the hard way. The steps to the front door, here, carved 'em out of -field stones... did it the hard way. That hardwood floor in the living -room, dovetailed the pieces myself... did it the hard way. The ceiling -beams, made 'em out of my own oak trees... did it the hard way." - Just then, the farmer's gorgeous daughter walked in. The farmer -looks over at the real estate agent who is trying not to stare too -obviously and smiles. "Yep... standing up in a canoe." -% A real friend isn't someone you use once and then throw away. A real friend is someone you can use over and over again. % @@ -8180,8 +7791,6 @@ the student with a stick. % A student who changes the course of history is probably taking an exam. % -A stunning blonde, but probably all bean dip above the eyebrows. -% A successful [software] tool is one that was used to do something undreamed of by its author. -- S. C. Johnson @@ -8318,12 +7927,6 @@ than some of the stuff that nature repla A verbal contract isn't worth the paper it's written on. -- Samuel Goldwyn % -A very intelligent turtle -Found programming UNIX a hurdle - The system, you see, - Ran as slow as did he, -And that's not saying much for the turtle. -% A violent man will die a violent death. -- Lao Tsu % @@ -8351,9 +7954,6 @@ Software rots if not used. These are great mysteries. -- Geoffrey James, "The Tao of Programming" % -A widow is more sought after than an old maid of the same age. - -- Addison -% A wise man can see more from a mountain top than a fool can from the bottom of a well. % @@ -8382,27 +7982,14 @@ A woman can look both moral and exciting were quite a struggle. -- Edna Ferber % -A woman can never be too rich or too thin. -% A woman did what a woman had to, the best way she knew how. To do more was impossible, to do less, unthinkable. -- Dirisha, "The Man Who Never Missed" % -A woman employs sincerity only when every other form of deception has failed. - -- Scott -% A woman, especially if she have the misfortune of knowing anything, should conceal it as well as she can. -- Jane Austen % -A woman forgives the audacity of which -her beauty has prompted us to be guilty. - -- LeSage -% -A woman has got to love a bad man once or twice in her life to be -thankful for a good one. - -- Marjorie Kinnan Rawlings -% A woman is like your shadow; follow her, she flies; fly from her, she follows. -- Chamfort @@ -8580,7 +8167,7 @@ Abscond, v.: % Absence diminishes mediocre passions and increases great ones, as the wind blows out candles and fans fires. - -- La Rochefoucauld + -- Francois de La Rochefoucauld % Absence in love is like water upon fire; a little quickens, but much extinguishes it. @@ -8654,11 +8241,6 @@ Accept people for what they are -- compl ACCEPTANCE TESTING: An unsuccessful attempt to find bugs. % -Acceptance without proof is the fundamental characteristic of Western -religion; rejection without proof is the fundamental characteristic of -Western science. - -- Gary Zukav, "The Dancing Wu Li Masters" -% Accident, n.: A condition in which presence of mind is good, but absence of body is better. @@ -8993,8 +8575,6 @@ the unimpeded right to get rich, to use cost to others, to win advancement. -- Norman Thomas % -After I run your program, let's make love like crazed weasels, OK? -% After living in New York, you trust nobody, but you believe everything. Just in case. % @@ -9535,7 +9115,7 @@ All the men on my staff can type. % All the passions make us commit faults; love makes us commit the most ridiculous ones. - -- La Rochefoucauld + -- Francois de La Rochefoucauld % All the really good ideas I ever had came to me while I was milking a cow. -- Grant Wood @@ -10571,8 +10151,6 @@ Any girl can be glamorous; all you have stupid. -- Hedy Lamarr % -Any given program, when running, is obsolete. -% Any given program will expand to fill available memory. % Any great truth can -- and eventually will -- be expressed as a cliche -- @@ -11466,9 +11044,6 @@ Asking a working writer what he thinks a lamp-post how it feels about dogs. -- Christopher Hampton % -Ass, n.: - The masculine of "lass". -% Assembly language experience is [important] for the maturity and understanding of how computers work that it provides. -- D. Gries @@ -12051,11 +11626,6 @@ the wise man saith, "Put all your eggs i basket!" -- Mark Twain % -Behold the unborn foetus and - Weep salt tears crocodilian; -All life is sacred (save, of course, - An enemy civilian). -% Behold the warranty -- the bold print giveth and the fine print taketh away. % @@ -12477,8 +12047,6 @@ Blessed are the forgetful: for they get the better even of their blunders. -- Friedrich Nietzsche % -Blessed are the meek for they shall inhibit the earth. -% Blessed are the young, for they shall inherit the national debt. -- Herbert Hoover % @@ -13660,9 +13228,6 @@ Drinking beer and playing cards neighb plays with elves! -- Elmo and Patsy, "Grandma Got Run Over by a Reindeer" % -Christ: - A man who was born at least 5,000 years ahead of his time. -% Christ died for our sins, so let's not disappoint Him. % Christianity might be a good thing if anyone ever tried it. @@ -13748,8 +13313,6 @@ the walk before it stops snowing. Cleanliness becomes more important when godliness is unlikely. -- P. J. O'Rourke % -Cleanliness is next to impossible. -% CLEVELAND: Where their last tornado did six million dollars worth of improvements. @@ -13890,9 +13453,6 @@ Coincidences are spiritual puns. -- G. K. Chesterton % Cold, adj.: - When the local flashers are handing out written descriptions. -% -Cold, adj.: When the politicians walk around with their hands in their own pockets. % @@ -14184,7 +13744,7 @@ Computers will not be perfected until th than the estimate the job will cost. % Conceit causes more conversation than wit. - -- La Rochefoucauld + -- Francois de La Rochefoucauld % Concept, n.: Any "idea" for which an outside consultant billed you more than @@ -14644,8 +14204,6 @@ DALLAS: The city that chose Astroturf to keep the cheerleaders from grazing. % -Dallas still lives. God MUST be dead. -% Dammit Jim, I'm an actor not a doctor. % Dammit, man, that's unprofessional! A good bartender laughs anyway! @@ -14908,14 +14466,6 @@ of education may be of even greater impo correct current table manners, vital as Miss Manners believes that is. % Dear Miss Manners: - Please list some tactful ways of removing a man's saliva from -your face. - -Gentle Reader: - Please list some decent ways of acquiring a man's saliva on -your face ... -% -Dear Miss Manners: I carry a big black umbrella, even if there's just a thirty percent chance of rain. May I ask a young lady who is a stranger to me to share its protection? This morning, I was waiting for a bus in comparative comfort, my umbrella @@ -15537,16 +15087,12 @@ Do clones have navels? Do I like getting drunk? Depends on who's doing the drinking. -- Amy Gorin % -Do infants have as much fun in infancy as adults do in adultery? -% Do Miami a favor. When you leave, take someone with you. % Do molecular biologists wear designer genes? % Do more than anyone expects, and pretty soon everyone will expect more. % -Do not believe in miracles -- rely on them. -% Do not clog intellect's sluices with bits of knowledge of questionable uses. % Do not count your chickens before they are hatched. @@ -16031,10 +15577,6 @@ want to help you could agree with each o % Don't you wish you had more energy... or less ambition? % -Dope will get you through times of no money better that money will get -you through times of no dope. - -- Gilbert Shelton -% Dorothy: How can you talk if you haven't got a brain? Scarecrow: I don't know. But some people without brains do an awful lot of talking, don't they? @@ -19581,12 +19123,6 @@ GEMINI (May 21 - June 20) the mail carefully, although there won't be anything good in it today, either. % -GEMINI (May 21 - June 20) - You are a quick and intelligent thinker. People like you -because you are bisexual. However, you are inclined to expect too much -for too little. This means you are cheap. Geminis are known for -committing incest. -% GEMINI (May 21 to Jun. 20) Good news and bad news highlighted. Enjoy the good news while you can; the bad news will make you forget it. You will enjoy praise @@ -20001,8 +19537,6 @@ can't find it anywhere. I'm sure he's t would he lie about a thing like that? -- Arthur Naiman, "Every Goy's Guide to Yiddish" % -God gives us relatives; thank goodness we can chose our friends. -% God grant us the serenity to accept the things we cannot change, courage to change the things we can, and wisdom to know the difference. % @@ -20033,8 +19567,6 @@ but by pains and contradictions. % God is a comic playing to an audience that's afraid to laugh. % -God is a polytheist. -% God is Dead. -- Nietzsche Nietzsche is Dead. @@ -20071,8 +19603,6 @@ God made machine language; all the rest God made the integers; all else is the work of Man. -- Kronecker % -God made the world in six days, and was arrested on the seventh. -% God may be subtle, but He isn't plain mean. -- Albert Einstein % @@ -20174,10 +19704,6 @@ Diary of a Young Girl LITE(tm) % Good advice is one of those insults that ought to be forgiven. % -Good advice is something a man gives -when he is too old to set a bad example. - -- La Rochefoucauld -% Good day for a change of scene. Repaper the bedroom wall. % Good day for business affairs. @@ -20373,8 +19899,6 @@ GRAVITY: % Gravity brings me down. % -Gravity is a myth, the Earth sucks. -% Gray's Law of Programming: 'n+1' trivial tasks are expected to be accomplished in the same time as 'n' tasks. @@ -20457,13 +19981,6 @@ Groundhog Day has been observed only onc groundhog came out of its hole, it was killed by a mudslide. -- Johnny Carson % -Grover Cleveland, though constantly at loggerheads with the Senate, got on -better with the House of Representatives. A popular story circulating -during his presidency concerned the night he was roused by his wife crying, -"Wake up! I think there are burglars in the house." - "No, no, my dear," said the president sleepily, "in the Senate -maybe, but not in the House." -% Growing old isn't bad when you consider the alternatives. -- Maurice Chevalier % @@ -21832,8 +21349,6 @@ Him: "Really? That's incredible... Hindsight is always 20:20. -- Billy Wilder % -Hindsight is an exact science. -% Hippogriff, n.: An animal (now extinct) which was half horse and half griffin. The griffin was itself a compound creature, half lion and half @@ -22032,8 +21547,6 @@ Home is the place where, when you have t they have to take you in. -- Robert Frost, "The Death of the Hired Man" % -Home is where the hurt is. -% Home life as we understand it is no more natural to us than a cage is to a cockatoo. -- George Bernard Shaw @@ -25271,9 +24784,6 @@ is a camel's behind. % If a can of Alpo costs 38 cents, would it cost $2.50 in Dog Dollars? % -If a child annoys you, quiet him by brushing their hair. If this doesn't -work, use the other side of the brush on the other end of the child. -% If A equals success, then the formula is _A = _X + _Y + _Z. _X is work. _Y is play. _Z is keep your mouth shut. -- Albert Einstein @@ -25454,8 +24964,6 @@ We're offering a substantial reward. He blind in his left eye, is missing part of his right ear and the tip of his tail. He's been recently fixed. Answers to "Lucky". % -If anything can go wrong, it will. -% If at first you do succeed, try to hide your astonishment. % If at first you don't succeed, destroy all evidence that you tried. @@ -25866,8 +25374,6 @@ of a student-poet to hang on to his ever % If it weren't for the last minute, nothing would ever get done. % -If it's not in the computer, it doesn't exist. -% If it's Tuesday, this must be someone else's fortune. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 22:33:31 2012 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 A2C44106564A; Sun, 1 Jan 2012 22:33:31 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8A46A8FC1A; Sun, 1 Jan 2012 22:33:31 +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 q01MXVLv034395; Sun, 1 Jan 2012 22:33:31 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01MXUic034392; Sun, 1 Jan 2012 22:33:30 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201201012233.q01MXUic034392@svn.freebsd.org> From: Doug Barton Date: Sun, 1 Jan 2012 22:33:30 +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: r229223 - stable/8/games/fortune/datfiles 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, 01 Jan 2012 22:33:31 -0000 Author: dougb Date: Sun Jan 1 22:33:29 2012 New Revision: 229223 URL: http://svn.freebsd.org/changeset/base/229223 Log: MFC r228909: 1. Remove a bunch of duplicates. Usually this means removing them from fortunes, but occasionally remove them from the other 2 files when they are not offensive, or not murphy'ish enough. Where the version in fortunes had better attribution and/or formatting, copy it over. 2. Fix a few typos 3. Use the full name of François De La Rochefoucauld, fix one of his quotes, and remove the duplicate of it. MFC r228934: Prefer ASCII apostrophes over Unicode ones like the rest of the file. MFC r228938: 1. Correct capitalization of the nobility particle for Francois de La Rochefoucauld introduced in r228909 2. Change c-cedilla introduced in the same commit to ASCII c since non-UTF-8 terminals will choke on the non-ASCII text. Modified: stable/8/games/fortune/datfiles/fortunes stable/8/games/fortune/datfiles/fortunes-o.real stable/8/games/fortune/datfiles/murphy Directory Properties: stable/8/games/fortune/ (props changed) Modified: stable/8/games/fortune/datfiles/fortunes ============================================================================== --- stable/8/games/fortune/datfiles/fortunes Sun Jan 1 22:33:02 2012 (r229222) +++ stable/8/games/fortune/datfiles/fortunes Sun Jan 1 22:33:29 2012 (r229223) @@ -773,40 +773,6 @@ the female, autopsied her, and sure enou "What do you think?" said the first ranger. "The Czech is in the male," replied the second. % - A group of soldiers being prepared for a practice landing on a tropical -island were warned of the one danger the island held, a poisonous snake that -could be readily identified by its alternating orange and black bands. They -were instructed, should they find one of these snakes, to grab the tail end of -the snake with one hand and slide the other hand up the body of the snake to -the snake's head. Then, forcefully, bend the thumb above the snake's head -downward to break the snake's spine. All went well for the landing, the -charge up the beach, and the move into the jungle. At one foxhole site, two -men were starting to dig and wondering what had happened to their partner. -Suddenly he staggered out of the underbrush, uniform in shreds, covered with -blood. He collapsed to the ground. His buddies were so shocked they could -only blurt out, "What happened?" - "I ran from the beachhead to the edge of the jungle, and, as I hit the -ground, I saw an orange and black striped snake right in front of me. I -grabbed its tail end with my left hand. I placed my right hand above my left -hand. I held firmly with my left hand and slid my right hand up the body of -the snake. When I reached the head of the snake I flicked my right thumb down -to break the snake's spine... did you ever goose a tiger?" -% - A guy returns from a long trip to Europe, having left his beloved -dog in his brother's care. The minute he's cleared customs, he calls up his -brother and inquires after his pet. - "Your dog's dead," replies his brother bluntly. - The guy is devastated. "You know how much that dog meant to me," -he moaned into the phone. "Couldn't you at least have thought of a nicer way -of breaking the news? Couldn't you have said, `Well, you know, the dog got -outside one day, and was crossing the street, and a car was speeding around a -corner...' or something...? Why are you always so thoughtless?" - "Look, I'm sorry," said his brother, "I guess I just didn't think." - "Okay, okay, let's just put it behind us. How are you anyway? -How's Mom?" - His brother is silent a moment. "Uh," he stammers, "uh... Mom got -outside one day..." -% A hard-luck actor who appeared in one colossal disaster after another finally got a break, a broken leg to be exact. Someone pointed out that it's the first time the poor fellow's been in the same cast for more than a week. @@ -1137,12 +1103,6 @@ went out to be killed? The Pole pulls a bottle of vodka from the other side of his jacket. He smiles and replies, "Five men on one bottle -- too many." % - A priest was walking along the cliffs at Dover when he came upon -two locals pulling another man ashore on the end of a rope. "That's what -I like to see", said the priest, "A man helping his fellow man". - As he was walking away, one local remarked to the other, "Well, -he sure doesn't know the first thing about shark fishing." -% A program should be light and agile, its subroutines connected like a strings of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little nor too much, neither needless @@ -1361,16 +1321,6 @@ realize the full significance of Pharoah -- Grendel Briarton "Through Time & Space With Ferdinand Feghoot!" % - After watching an extremely attractive maternity-ward patient -earnestly thumbing her way through a telephone directory for several -minutes, a hospital orderly finally asked if he could be of some help. - "No, thanks," smiled the young mother, "I'm just looking for a -name for my baby." - "But the hospital supplies a special booklet that lists hundreds -of first names and their meanings," said the orderly. - "That won't help," said the woman, "my baby already has a first -name." -% All I really need to know about how to live and what to do and how to be I learned in kindergarten. Wisdom was not at the top of the graduate-school mountain, but there in the sandpile at Sunday School. @@ -1470,26 +1420,6 @@ the ideas and frills that were cautiousl The result, as Ovid says, is a "big pile". -- Frederick Brooks, Jr., "The Mythical Man-Month" % - An eighty-year-old woman is rocking away the afternoon on her -porch when she sees an old, tarnished lamp sitting near the steps. She -picks it up, rubs it gently, and lo and behold a genie appears! The genie -tells the woman the he will grant her any three wishes her heart desires. - After a bit of thought, she says, "I wish I were young and -beautiful!" And POOF! In a cloud of smoke she becomes a young, beautiful, -voluptuous woman. - After a little more thought, she says, "I would like to be rich -for the rest of my life." And POOF! When the smoke clears, there are -stacks and stacks of money lying on the porch. - The genie then says, "Now, madam, what is your final wish?" - "Well," says the woman, "I would like for you to transform my -faithful old cat, whom I have loved dearly for fifteen years, into a young -handsome prince!" - And with another billow of smoke the cat is changed into a tall, -handsome, young man, with dark hair, dressed in a dashing uniform. - As they gaze at each other in adoration, the prince leans over to -the woman and whispers into her ear, "Now, aren't you sorry you had me -fixed?" -% An elderly man stands in line for hours at a Warsaw meat store (meat is severely rationed). When the butcher comes out at the end of the day and announces that there is no meat left, the man flies into a rage. @@ -1552,14 +1482,6 @@ young welp with a masochistic streak who up-and-down bureaucracy in the history of mankind." -- R. L. Forward, "Flight of the Dragonfly" % - "Anything else, sir?" asked the attentive bellhop, trying his best -to make the lady and gentleman comfortable in their penthouse suite in the -posh hotel. - "No. No, thank you," replied the gentleman. - "Anything for your wife, sir?" the bellhop asked. - "Why, yes, young man," said the gentleman. "Would you bring me -a postcard?" -% "Anything else you wish to draw to my attention, Mr. Holmes ?" "The curious incident of the stable dog in the nighttime." "But the dog did nothing in the nighttime." @@ -1932,52 +1854,16 @@ said the Duck: "it's generally a frog or The question is, what did the archbishop find?" % - Four Oxford dons were taking their evening walk together and as -usual, were engaged in casual but learned conversation. On this particular -evening, their conversation was about the names given to groups of animals, -such as a "pride of lions" or a "gaggle of geese." - One of the professors noticed a group of prostitutes down the block, -and posed the question, "What name would be given to that group?" The four -fell into silence for a moment, as they pondered the possibilities... - At last, one spoke: "How about `a Jam of Tarts'?" The others nodded -in acknowledgment as they continued to consider the problem. A second -professor spoke: "I'd suggest `an Essay of Trollops.'" Again, the others -nodded. A third spoke: "I propose `a Flourish of Strumpets.'" - They continued their walk in silence, until the first professor -remarked to the remaining professor, who was the most senior and learned of -the four, "You haven't suggested a name for our ladies. What are your -thoughts?" - Replied the fourth professor, "`An Anthology of Prose.'" -% Fred noticed his roommate had a black eye upon returning from a dance. "What happened?" "I was struck by the beauty of the place." % - Friends were surprised, indeed, when Frank and Jennifer broke their -engagement, but Frank had a ready explanation: "Would you marry someone who -was habitually unfaithful, who lied at every turn, who was selfish and lazy -and sarcastic?" - "Of course not," said a sympathetic friend. - "Well," retorted Frank, "neither would Jennifer." -% "Gee, Mudhead, everyone at Morse Science High has an extracurricular activity except you." "Well, gee, doesn't Louise count?" "Only to ten, Mudhead." -- The Firesign Theatre % - "Gentlemen of the jury," said the defense attorney, now beginning -to warm to his summation, "the real question here before you is, shall this -beautiful young woman be forced to languish away her loveliest years in a -dark prison cell? Or shall she be set free to return to her cozy little -apartment at 4134 Mountain Ave. -- there to spend her lonely, loveless hours -in her boudoir, lying beside her little Princess phone, 962-7873?" -% - God decided to take the devil to court and settle their -differences once and for all. - When Satan heard of this, he grinned and said, "And just -where do you think you're going to find a lawyer?" -% Graduating seniors, parents and friends... Let me begin by reassuring you that my remarks today will stand up to the most stringent requirements of the new appropriateness. @@ -2050,33 +1936,6 @@ for it is complete within itself. It ex Software and Hardware, ashamed, returned to their homes. -- Geoffrey James, "The Tao of Programming" % - Harry, a golfing enthusiast if there ever was one, arrived home -from the club to an irate, ranting wife. - "I'm leaving you, Harry," his wife announced bitterly. "You -promised me faithfully that you'd be back before six and here it is almost -nine. It just can't take that long to play 18 holes of golf." - "Honey, wait," said Harry. "Let me explain. I know what I promised -you, but I have a very good reason for being late. Fred and I tee'd off -right on time and everything was fine for the first three holes. Then, on -the fourth tee Fred had a stroke. I ran back to the clubhouse but couldn't -find a doctor. And, by the time I got back to Fred, he was dead. So, for -the next 15 holes, it was hit the ball, drag Fred, hit the ball, drag Fred... -% - Harry constantly irritated his friends with his eternal optimism. -No matter how bad the situation, he would always say, "Well, it could have -been worse." - To cure him of his annoying habit, his friends decided to invent a -situation so completely black, so dreadful, that even Harry could find no -hope in it. Approaching him at the club bar one day, one of them said, -"Harry! Did you hear what happened to George? He came home last night, -found his wife in bed with another man, shot them both, and then turned -the gun on himself!" - "Terrible," said Harry. "But it could have been worse." - "How in hell," demanded his dumbfounded friend, "could it possibly -have been worse?" - "Well," said Harry, "if it had happened the night before, I'd be -dead right now." -% "Has anyone had problems with the computer accounts?" "Yes; I don't have one." "Okay, you can send mail to one of the tutors..." @@ -2112,13 +1971,6 @@ lessening mine; as he who lights his tap without darkening me. -- Thomas Jefferson on patents on ideas % - "Heard you were moving your piano, so I came over to help." - "Thanks. Got it upstairs already." - "Do it alone?" - "Nope. Hitched the cat to it." - "How would that help?" - "Used a whip." -% "Hey, Sam, how about a loan?" "Whattaya need?" "Oh, about $500." @@ -2182,11 +2034,6 @@ could forget that, to within half a perc social climber said to her roommate. "I mean, I've never seen a Porsche full of money before." % - "How'd you get that flat?" - "Ran over a bottle." - "Didn't you see it?" - "Damn kid had it under his coat." -% Human thinking can skip over a great deal, leap over small misunderstandings, can contain ifs and buts in untroubled corners of the mind. But the machine has no corners. Despite all the attempts to @@ -2199,11 +2046,6 @@ line by code line, the programmer confro The ways of human and machine understanding are disjunct. -- Ellen Ullman, "Close to the Machine" % - "I believe you have the wrong number," said the old gentleman into -the phone. "You'll have to call the weather bureau for that information." - "Who was that?" his young wife asked. - "Some guy wanting to know if the coast was clear." -% "I cannot read the fiery letters," said Frito Bugger in a quavering voice. "No," said GoodGulf, "but I can. The letters are Elvish, of @@ -2496,11 +2338,6 @@ it gets so bad you can't handle it alone would destroy the whole point of it." -- Thomas Pynchon, "The Crying of Lot 49" % - "I'm looking for adventure, excitement, beautiful women," cried the -young man to his father as he prepared to leave home. "Don't try to stop me. -I'm on my way." - "Who's trying to stop you?" shouted the father. "Take me along!" -% I'm sure that VMS is completely documented, I just haven't found the right manual yet. I've been working my way through the manuals in the document library and I'm half way through the second cabinet, (3 shelves to go), so I @@ -2558,20 +2395,6 @@ pie-bakers and pie-dividers is way out o been an efficiency expert? -- Motor Trend, May 1983 % - In the beginning, God created the Earth and he said, "Let there be -mud." - And there was mud. - And God said, "Let Us make living creatures out of mud, so the mud -can see what we have done." - And God created every living creature that now moveth, and one was -man. Mud-as-man alone could speak. - "What is the purpose of all this?" man asked politely. - "Everything must have a purpose?" asked God. - "Certainly," said man. - "Then I leave it to you to think of one for all of this," said God. - And He went away. - -- Kurt Vonnegut, Jr., "Between Time and Timbuktu" -% In the beginning there was data. The data was without form and null, and darkness was upon the face of the console; and the Spirit of IBM was moving over the face of the market. And DEC said, "Let there @@ -2926,11 +2749,6 @@ Church soon made its peace with Galileo' earth really does revolve about the sun. -- S. J. Gould, "The Mismeasure of Man" % - "My mother," said the sweet young steno, "says there are some things -a girl should not do before twenty." - "Your mother is right," said the executive, "I don't like a large -audience, either." -% NEW YORK -- Kraft Foods, Inc. announced today that its board of directors unanimously rejected the $11 billion takeover bid by Philip Morris and Co. A Kraft spokesman stated in a press conference that the @@ -3727,14 +3545,6 @@ was solidly entrenched in the market, an improve ... -- Dave Barry, "In Search of Excellence" % - "That wife of mine is a liar," said the angry husband to a -sympathetic pal seated next to him in a bar. - "How do you know?" the friend asked. - "She didn't come home last night, and when I asked her where -she'd been she said she'd spent the night with her sister Shirley." - "So?" - "So, she's a liar. I spent the night with her sister Shirley." -% "That's right; the upper-case shift works fine on the screen, but they're not coming out on the damn printer... Hold? Sure, I'll hold." -- e. e. cummings last service call @@ -3768,13 +3578,6 @@ laughed uproariously. "What's the matte got a sense of humor?" "I don't have to laugh," she said. "I'm leaving Friday anyway. % - The doctor had just finished giving the young man a thorough -physical examination. "The best thing for you to do," the M.D. said, -"is give up drinking, give up smoking, get to bed early and stay away -from women." - "Doc, I don't deserve the best," pleaded his patient. "What's -second best?" -% The FIELD GUIDE to NORTH AMERICAN MALES SPECIES: Cranial Males @@ -3889,22 +3692,6 @@ win through and still know where his tow reckoned with. -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy" % - The honeymooning couple agreed it was a fine day for horseback riding. -After a mile or so, the bride's mount cantered under a low tree and a -branch scraped her forehead lightly. The groom dismounted, glared at his -wife's horse, and said, "That's number one." - The ride then proceeded. After another mile or so, the bride's -horse stumbled over a pebble and the lady suffered a slight jostling. -Again, her man leapt from his saddle and strode over to the nervous animal. -"That's two," he said. - Five miles later, the bride's horse became frightened when a rabbit -crossed its path, reared up and threw the girl. Immediately, the groom was -off his horse. "That's three!", he shouted, and, pulling out a pistol, he -shot the horse between the eyes. - "You brute!" shrieked his bride. "Now I see the kind of man I -married! You're a sadist, that's what!" - The groom turned to her coolly. "That's one," he said. -% "The jig's up, Elman." "Which jig?" -- Jeff Elman @@ -4349,29 +4136,6 @@ of his mortal enemy -- to those both com spread only for demons or for gods." -- Gordon R. Dickson, "Soldier Ask Not" % - "They spend years searching for their natural parents, convinced their -parents will be happy to see them. I mean, really, can you imagine someone -being happy to see an orphan? Nobody wants them... that's why they're orphans!" - The speaker is Anne Baker, founder and guiding force behind -Orphan-Off, an organization dedicated to keeping orphans confused about the -whereabouts of their natural parents. She is a woman with a mission: - "Basically, what we do is band together to exchange information -about which orphans are looking for which parents in what part of the -country. We're completely computerized. - "The idea is to throw the orphans as many red herrings and false -leads as possible. We'll tell some twenty-three-year-old loser that his -real parents can be found at a certain address on the other side of the -country. Well, by the time the kid shows up, the family is prepared. They -look over the kid's photos and information and they say, 'Oh, the Emersons... -yeah, they used to live here... I think they moved out about five years ago. -I think they went to Iowa, or maybe Idaho.' - "Bam, the door shuts in the kid's face and he's back to zero again. -He's got nothing to go on but the orphan's pathetic determination to continue. - "It's really amazing how much these kids will put up with. Last year -we even sent one kid all the way to Australia. I mean, really. Besides, if -your natural parents were Australian, would you want to meet them?" - -- "National Lampoon", September, 1984 -% This is where the bloodthirsty license agreement is supposed to go, explaining that Interactive EasyFlow is a copyrighted package licensed for use by a single person, and sternly warning you not to pirate copies of it @@ -4683,13 +4447,6 @@ men with whom I felt an immediate sympat more satisfactory to me than the opaque vogue word "empathy". -- Alistair Cooke, "Six Men" % - "What the hell are you getting so upset about? I thought you -didn't believe in God". - "I don't," she sobbed, bursting violently into tears, "but the -God I don't believe in is a good God, a just God, a merciful God. He's -not the mean and stupid God you make Him out to be". - -- Joseph Heller -% "What was the worst thing you've ever done?" "I won't tell you that, but I'll tell you the worst thing that ever happened to me... the most dreadful thing." @@ -4806,20 +4563,6 @@ unanswered. Eventually the form for the the section marked "DEDUCTIONS," Rogers listed: "Bad debt, US Government -- $40,000." % - With deep concern, if not alarm, Dick noted that his friend -Conrad was drunker than he'd ever seen him before. "What's the trouble, -buddy?", he asked, sliding onto the stool next to his friend. - "It's a woman, Dick," Conrad replied. - "I guessed that much. Tell me about it." - "I can't," Conrad said. But after a few more drinks his tongue -and resolution both seemed to weaken and, turning to his buddy, he said, -"Okay. It's your wife." - "My wife!!" - "Yeah." - "What about her?" - Conrad pondered the question heavily, and draped his arm around -his pal. "Well, buddy-boy," he said, "I'm afraid she's cheating on us." -% Work Hard. Rock Hard. Eat Hard. @@ -4956,7 +4699,7 @@ the soul. Worry, doubt, self-distrust, long, long years that bow the head and turn the growing spirit back to dust. - Whether seventy or sixteen, there is in every being’s heart a + Whether seventy or sixteen, there is in every being's heart a love of wonder; the sweet amazement at the stars and starlike things and thoughts; the undaunted challenge of events, the unfailing childlike appetite for what comes next, and the joy in the game of life. @@ -6593,9 +6336,6 @@ a fund for his funeral. The Lord Chief a shilling. "Only a shilling?" exclaimed the man. "Only a shilling to bury an attorney? Here's a guinea; go and bury twenty of them." % -A fail-safe circuit will destroy others. - -- Klipstein -% A failure will not appear until a unit has passed final inspection. % A fair exterior is a silent recommendation. @@ -6662,17 +6402,6 @@ go!'" % A few hours grace before the madness begins again. % -A figure with curves always offers a lot of interesting angles. -% -A fisherman from Maine went to Alabama on his vacation. He rented a boat, -rowed out to the middle of the lake, and cast his line, but when he looked -down into the water he was horrified to see a man wrapped in chains lying -on the bottom of the lake. He quickly rowed to shore and ran to the police -station. "Sheriff, sheriff," he gasped, there's a guy wrapped in chains, -drowned in the lake!" - "Now ain't that jest like a Yankee," drawled the sheriff, "to steal -more chain than he can swim with?" -% A fitter fits; Though sinners sin A cutter cuts; And thinners thin And an aircraft spotter spots; And paper-blotters blot @@ -6697,11 +6426,6 @@ A fool and his honey are soon parted. % A fool and his money are soon popular. % -A fool and your money are soon partners. -% -A fool is a man who worries about whether or not his lover has integrity. -A wise man, on the other hand, busies himself with deeper attributes. -% A fool must now and then be right by chance. % A foolish consistency is the hobgoblin of little minds. @@ -6744,8 +6468,6 @@ You'll just be walking down the street a A friend of mine won't get a divorce, because he hates lawyers more than he hates his wife. % -A friend with weed is a friend indeed. -% A full belly makes a dull brain. -- Benjamin Franklin @@ -6809,9 +6531,6 @@ A girl with a future avoids the man with A girl's best friend is her mutter. -- Dorothy Parker % -A girl's conscience doesn't really keep her from doing anything wrong-- -it merely keeps her from enjoying it. -% A gleekzorp without a tornpee is like a quop without a fertsneet (sort of). % @@ -7102,27 +6821,6 @@ A language that doesn't have everything actually easier to program in than some that do. -- Dennis M. Ritchie % -A lanky Texan was mad because Texas had just become the second largest state in -the Union, so he made up his mind to move to Alaska. He drove for three days -and three nights to get there and finally he came to what looked like the state -line. He halted his car and walked up to the border guard. "Hi, there! How -do I become a resident of this here biggest state?" demanded the Texan. - The guard looked him up and down and grinned. "Waal," he answered, -there are three things you gotta do to get in. First, drink down a quart of -110 proof corn liquor without blinkin'. Second, kill a grizzly bear, and -third, make love to an Eskimo woman." - "Sounds easy enough," said the Texan. "Where can I get a quart of -this here corn liquor?" - "Got one right here," replied the guard. - The Texan gulped down the whiskey without batting an eyelash. -"Now, do you happen to know where I can find me a grizzly?" - "Yep," answered the guard, "there's a big b'ar over that way, 'bout -a mile... lives in a cave on that cliff." - The Texan lurched merrily off. About an hour later he returned -with his clothes almost torn off and his face scratched and bloody. He was -smiling happily. "Now," he roared, "where's that damn Eskimo woman you -want killed?" -% A large number of installed systems work by fiat. That is, they work by being declared to work. -- Anatol Holt @@ -7230,33 +6928,16 @@ A lot of people I know believe in positi and so do I. I believe everything positively stinks. -- Lew Col % -A lover without indiscretion is no lover at all. - -- Thomas Hardy -% A major, with wonderful force, Called out in Hyde Park for a horse. All the flowers looked round, But no horse could be found; So he just rhododendron, of course. % -A male gynecologist is like an auto mechanic who has never owned a car. - -- Carrie Snow -% -A man always needs to remember one thing about -a beautiful woman. Somewhere, somebody's tired of her. -% A man always remembers his first love with special tenderness, but after that begins to bunch them. -- H. L. Mencken % -A man arrived home early to find his wife in the arms of his best friend, -who swore how much they were in love. To quiet the enraged husband, the -lover suggested, "Friends shouldn't fight, let's play gin rummy. If I win, -you get a divorce so I can marry her. If you win, I promise never to see -her again. Okay?" - "Alright," agreed the husband. "But how about a quarter a point -on the side to make it interesting?" -% A man can have two, maybe three love affairs while he's married. After that it's cheating. -- Yves Montand @@ -7393,9 +7074,6 @@ in no other way. A man who fishes for marlin in ponds will put his money in Etruscan bonds. % -A man who likes to lie in bed can usually -find a girl willing to listen to him. -% A man who turns green has eschewed protein. % A man with 3 wings and a dictionary is cousin to the turkey. @@ -7403,12 +7081,8 @@ A man with 3 wings and a dictionary is c A man with one watch knows what time it is. A man with two watches is never quite sure. % -A man without a God is like a fish without a bicycle. -% A man without a woman is like a fish without gills. % -A man without a woman is like a statue without pigeons. -% A man would still do something out of sheer perversity - he would create destruction and chaos - just to gain his point... and if all this could in turn be analyzed and prevented by predicting that it would occur, then man @@ -7593,33 +7267,6 @@ will go far towards curing the rascal of A New York City ordinance prohibits the shooting of rabbits from the rear of a Third Avenue street car -- if the car is in motion. % -A New Yorker is riding down the road in his new Mercedes. So intent is he -on the cocaine in his hand he completely misses a turn and his car plunges -over the five-hundred-foot cliff to be smashed into pieces at the bottom. -As the on-lookers rush to the edge of the cliff they see him fifty feet -from the top of the cliff clinging to a stunted bush with all his strength. -"Dear Lord," he prays, "I never asked you for nothin' before, but I'm askin' -you now: Save me, Lord, save me." - Booms the Lord: "LET GO OF THE BRANCH." - "But Lord, if I do that, I'll fall!" - "TRUST ME, LET GO OF THE BRANCH." - "But Lord, I'm gonna fall and die..." - "TRUST ME TO SAVE YOU. LET GO OF THE BRANCH." - Okay, Lord, I'll trust you, here I... here I go!" And he falls -to his death. - "DUMB YANKEE." -% -A New Yorker was driving through Berkeley when he saw a big crowd gathered -by the side of the street. Curiosity got the better of him and he leaned -out of his window to ask an onlooker what was going on. The fellow explained -that a protestor against the U.S. position in South America had doused -himself with gasoline and set himself on fire. "That's terrible," gasped -the man. "But why is everyone still standing around?" - "Well, they're taking up a collection for his wife and kids," the -onlooker explained. "Would you be willing to help?" - "Well, sure," replied the New Yorker. "I suppose I could spare a -gallon or two." -% A newspaper is a circulating library with high blood pressure. -- Arthure "Bugs" Baer % @@ -7684,12 +7331,6 @@ itself, and that is an excellent thing f manufacturers for whom patriotic terrors are an abundant source of gain. -- Anatole France % -A perfectly honest woman, a woman who never flatters, who never manages, -who never cajoles, who never conceals, who never uses her eyes, who never -speculates on the effect which she produces, who never is conscious of -unspoken admiration, what a monster, I say, would such a female be! - -- Thackeray -% A person forgives only when they are in the wrong. % A person is just about as big as the things that make him angry. @@ -7794,8 +7435,6 @@ last pair of shoes, already worn out in of yours to press against my heart. -- Johann Wolfgang von Goethe % -A pretty woman can do anything; an ugly woman must do everything. -% A priest advised Voltaire on his death bed to renounce the devil. Replied Voltaire, "This is no time to make new enemies." % @@ -7881,23 +7520,6 @@ the ball is more than three inches from to make a travesty of the game. -- Donald A. Metz % -A rabbi and a priest are sitting together on a train, and the rabbi leans -over and asks, "So, how high can you advance in your organization?" - The priest replies, "Well, if I am lucky, I guess I could become a -Bishop." - "Well, could you get any higher than that?" - "I suppose that if my works are seen in a very good light that I -might be made an Archbishop." - "Is there any way that you might go higher than that?" - "If all the Saints should smile, I guess I could be made a Cardinal." - "Could you be anything higher than a Cardinal?" - Hesitating a little bit, the priest said, "I suppose that I could -be elected Pope, but only if it's God's will." - "And could you be anything higher than that, is there any way to go -up from being the Pope?" - "What?! I should be the Messiah himself?!" - The rabbi leaned back and smiled. "One of our boys made it." -% A raccoon tangled with a 23,000 volt line today. The results blacked out 1400 homes and, of course, one raccoon. -- Steel City News @@ -7912,17 +7534,6 @@ A real diplomat is one who can cut his n his neighbor notice it. -- Trygve Lie % -A real estate agent, looking over a farmer's house for possible sale, -commented to the farmer how sturdy the house looked. - The farmer replied, "Yep, built it with my bare hands... did it -the hard way. The steps to the front door, here, carved 'em out of -field stones... did it the hard way. That hardwood floor in the living -room, dovetailed the pieces myself... did it the hard way. The ceiling -beams, made 'em out of my own oak trees... did it the hard way." - Just then, the farmer's gorgeous daughter walked in. The farmer -looks over at the real estate agent who is trying not to stare too -obviously and smiles. "Yep... standing up in a canoe." -% A real friend isn't someone you use once and then throw away. A real friend is someone you can use over and over again. % @@ -8180,8 +7791,6 @@ the student with a stick. % A student who changes the course of history is probably taking an exam. % -A stunning blonde, but probably all bean dip above the eyebrows. -% A successful [software] tool is one that was used to do something undreamed of by its author. -- S. C. Johnson @@ -8318,12 +7927,6 @@ than some of the stuff that nature repla A verbal contract isn't worth the paper it's written on. -- Samuel Goldwyn % -A very intelligent turtle -Found programming UNIX a hurdle - The system, you see, - Ran as slow as did he, -And that's not saying much for the turtle. -% A violent man will die a violent death. -- Lao Tsu % @@ -8351,9 +7954,6 @@ Software rots if not used. These are great mysteries. -- Geoffrey James, "The Tao of Programming" % -A widow is more sought after than an old maid of the same age. - -- Addison -% A wise man can see more from a mountain top than a fool can from the bottom of a well. % @@ -8382,27 +7982,14 @@ A woman can look both moral and exciting were quite a struggle. -- Edna Ferber % -A woman can never be too rich or too thin. -% A woman did what a woman had to, the best way she knew how. To do more was impossible, to do less, unthinkable. -- Dirisha, "The Man Who Never Missed" % -A woman employs sincerity only when every other form of deception has failed. - -- Scott -% A woman, especially if she have the misfortune of knowing anything, should conceal it as well as she can. -- Jane Austen % -A woman forgives the audacity of which -her beauty has prompted us to be guilty. - -- LeSage -% -A woman has got to love a bad man once or twice in her life to be -thankful for a good one. - -- Marjorie Kinnan Rawlings -% A woman is like your shadow; follow her, she flies; fly from her, she follows. -- Chamfort @@ -8580,7 +8167,7 @@ Abscond, v.: % Absence diminishes mediocre passions and increases great ones, as the wind blows out candles and fans fires. - -- La Rochefoucauld + -- Francois de La Rochefoucauld % Absence in love is like water upon fire; a little quickens, but much extinguishes it. @@ -8654,11 +8241,6 @@ Accept people for what they are -- compl ACCEPTANCE TESTING: An unsuccessful attempt to find bugs. % -Acceptance without proof is the fundamental characteristic of Western -religion; rejection without proof is the fundamental characteristic of -Western science. - -- Gary Zukav, "The Dancing Wu Li Masters" -% Accident, n.: A condition in which presence of mind is good, but absence of body is better. @@ -8993,8 +8575,6 @@ the unimpeded right to get rich, to use cost to others, to win advancement. -- Norman Thomas % -After I run your program, let's make love like crazed weasels, OK? -% After living in New York, you trust nobody, but you believe everything. Just in case. % @@ -9535,7 +9115,7 @@ All the men on my staff can type. % All the passions make us commit faults; love makes us commit the most ridiculous ones. - -- La Rochefoucauld + -- Francois de La Rochefoucauld % All the really good ideas I ever had came to me while I was milking a cow. -- Grant Wood @@ -10571,8 +10151,6 @@ Any girl can be glamorous; all you have stupid. -- Hedy Lamarr % -Any given program, when running, is obsolete. -% Any given program will expand to fill available memory. % Any great truth can -- and eventually will -- be expressed as a cliche -- @@ -11466,9 +11044,6 @@ Asking a working writer what he thinks a lamp-post how it feels about dogs. -- Christopher Hampton % -Ass, n.: - The masculine of "lass". -% Assembly language experience is [important] for the maturity and understanding of how computers work that it provides. -- D. Gries @@ -12051,11 +11626,6 @@ the wise man saith, "Put all your eggs i basket!" -- Mark Twain % -Behold the unborn foetus and - Weep salt tears crocodilian; -All life is sacred (save, of course, - An enemy civilian). -% Behold the warranty -- the bold print giveth and the fine print taketh away. % @@ -12477,8 +12047,6 @@ Blessed are the forgetful: for they get the better even of their blunders. -- Friedrich Nietzsche % -Blessed are the meek for they shall inhibit the earth. -% Blessed are the young, for they shall inherit the national debt. -- Herbert Hoover % @@ -13660,9 +13228,6 @@ Drinking beer and playing cards neighb plays with elves! -- Elmo and Patsy, "Grandma Got Run Over by a Reindeer" % -Christ: - A man who was born at least 5,000 years ahead of his time. -% Christ died for our sins, so let's not disappoint Him. % Christianity might be a good thing if anyone ever tried it. @@ -13748,8 +13313,6 @@ the walk before it stops snowing. Cleanliness becomes more important when godliness is unlikely. -- P. J. O'Rourke % -Cleanliness is next to impossible. -% CLEVELAND: Where their last tornado did six million dollars worth of improvements. @@ -13890,9 +13453,6 @@ Coincidences are spiritual puns. -- G. K. Chesterton % Cold, adj.: - When the local flashers are handing out written descriptions. -% -Cold, adj.: When the politicians walk around with their hands in their own pockets. % @@ -14184,7 +13744,7 @@ Computers will not be perfected until th than the estimate the job will cost. % Conceit causes more conversation than wit. - -- La Rochefoucauld + -- Francois de La Rochefoucauld % Concept, n.: Any "idea" for which an outside consultant billed you more than @@ -14644,8 +14204,6 @@ DALLAS: The city that chose Astroturf to keep the cheerleaders from grazing. % -Dallas still lives. God MUST be dead. -% Dammit Jim, I'm an actor not a doctor. % Dammit, man, that's unprofessional! A good bartender laughs anyway! @@ -14908,14 +14466,6 @@ of education may be of even greater impo correct current table manners, vital as Miss Manners believes that is. % Dear Miss Manners: - Please list some tactful ways of removing a man's saliva from -your face. - -Gentle Reader: - Please list some decent ways of acquiring a man's saliva on -your face ... -% -Dear Miss Manners: I carry a big black umbrella, even if there's just a thirty percent chance of rain. May I ask a young lady who is a stranger to me to share its protection? This morning, I was waiting for a bus in comparative comfort, my umbrella @@ -15537,16 +15087,12 @@ Do clones have navels? Do I like getting drunk? Depends on who's doing the drinking. -- Amy Gorin % -Do infants have as much fun in infancy as adults do in adultery? -% Do Miami a favor. When you leave, take someone with you. % Do molecular biologists wear designer genes? % Do more than anyone expects, and pretty soon everyone will expect more. % -Do not believe in miracles -- rely on them. -% Do not clog intellect's sluices with bits of knowledge of questionable uses. % Do not count your chickens before they are hatched. @@ -16031,10 +15577,6 @@ want to help you could agree with each o % Don't you wish you had more energy... or less ambition? % -Dope will get you through times of no money better that money will get -you through times of no dope. - -- Gilbert Shelton -% Dorothy: How can you talk if you haven't got a brain? Scarecrow: I don't know. But some people without brains do an awful lot of talking, don't they? @@ -19581,12 +19123,6 @@ GEMINI (May 21 - June 20) the mail carefully, although there won't be anything good in it today, either. % -GEMINI (May 21 - June 20) - You are a quick and intelligent thinker. People like you -because you are bisexual. However, you are inclined to expect too much -for too little. This means you are cheap. Geminis are known for -committing incest. -% GEMINI (May 21 to Jun. 20) Good news and bad news highlighted. Enjoy the good news while you can; the bad news will make you forget it. You will enjoy praise @@ -20001,8 +19537,6 @@ can't find it anywhere. I'm sure he's t would he lie about a thing like that? -- Arthur Naiman, "Every Goy's Guide to Yiddish" % -God gives us relatives; thank goodness we can chose our friends. -% God grant us the serenity to accept the things we cannot change, courage to change the things we can, and wisdom to know the difference. % @@ -20033,8 +19567,6 @@ but by pains and contradictions. % God is a comic playing to an audience that's afraid to laugh. % -God is a polytheist. -% God is Dead. -- Nietzsche Nietzsche is Dead. @@ -20071,8 +19603,6 @@ God made machine language; all the rest God made the integers; all else is the work of Man. -- Kronecker % -God made the world in six days, and was arrested on the seventh. -% God may be subtle, but He isn't plain mean. -- Albert Einstein % @@ -20174,10 +19704,6 @@ Diary of a Young Girl LITE(tm) % Good advice is one of those insults that ought to be forgiven. % -Good advice is something a man gives -when he is too old to set a bad example. - -- La Rochefoucauld -% Good day for a change of scene. Repaper the bedroom wall. % Good day for business affairs. @@ -20373,8 +19899,6 @@ GRAVITY: % Gravity brings me down. % -Gravity is a myth, the Earth sucks. -% Gray's Law of Programming: 'n+1' trivial tasks are expected to be accomplished in the same time as 'n' tasks. @@ -20457,13 +19981,6 @@ Groundhog Day has been observed only onc groundhog came out of its hole, it was killed by a mudslide. -- Johnny Carson % -Grover Cleveland, though constantly at loggerheads with the Senate, got on -better with the House of Representatives. A popular story circulating -during his presidency concerned the night he was roused by his wife crying, -"Wake up! I think there are burglars in the house." - "No, no, my dear," said the president sleepily, "in the Senate -maybe, but not in the House." -% Growing old isn't bad when you consider the alternatives. -- Maurice Chevalier % @@ -21832,8 +21349,6 @@ Him: "Really? That's incredible... Hindsight is always 20:20. -- Billy Wilder % -Hindsight is an exact science. -% Hippogriff, n.: An animal (now extinct) which was half horse and half griffin. The griffin was itself a compound creature, half lion and half @@ -22032,8 +21547,6 @@ Home is the place where, when you have t they have to take you in. -- Robert Frost, "The Death of the Hired Man" % -Home is where the hurt is. -% Home life as we understand it is no more natural to us than a cage is to a cockatoo. -- George Bernard Shaw @@ -25271,9 +24784,6 @@ is a camel's behind. % If a can of Alpo costs 38 cents, would it cost $2.50 in Dog Dollars? % -If a child annoys you, quiet him by brushing their hair. If this doesn't -work, use the other side of the brush on the other end of the child. -% If A equals success, then the formula is _A = _X + _Y + _Z. _X is work. _Y is play. _Z is keep your mouth shut. -- Albert Einstein @@ -25454,8 +24964,6 @@ We're offering a substantial reward. He blind in his left eye, is missing part of his right ear and the tip of his tail. He's been recently fixed. Answers to "Lucky". % -If anything can go wrong, it will. -% If at first you do succeed, try to hide your astonishment. % If at first you don't succeed, destroy all evidence that you tried. @@ -25866,8 +25374,6 @@ of a student-poet to hang on to his ever % If it weren't for the last minute, nothing would ever get done. % -If it's not in the computer, it doesn't exist. -% If it's Tuesday, this must be someone else's fortune. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 22:33:57 2012 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 9077C106566C; Sun, 1 Jan 2012 22:33:57 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 78A6D8FC15; Sun, 1 Jan 2012 22:33: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 q01MXvtU034446; Sun, 1 Jan 2012 22:33:57 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01MXt1f034443; Sun, 1 Jan 2012 22:33:55 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201201012233.q01MXt1f034443@svn.freebsd.org> From: Doug Barton Date: Sun, 1 Jan 2012 22:33:55 +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: r229224 - stable/7/games/fortune/datfiles 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, 01 Jan 2012 22:33:57 -0000 Author: dougb Date: Sun Jan 1 22:33:55 2012 New Revision: 229224 URL: http://svn.freebsd.org/changeset/base/229224 Log: MFC r228909: 1. Remove a bunch of duplicates. Usually this means removing them from fortunes, but occasionally remove them from the other 2 files when they are not offensive, or not murphy'ish enough. Where the version in fortunes had better attribution and/or formatting, copy it over. 2. Fix a few typos 3. Use the full name of François De La Rochefoucauld, fix one of his quotes, and remove the duplicate of it. MFC r228934: Prefer ASCII apostrophes over Unicode ones like the rest of the file. MFC r228938: 1. Correct capitalization of the nobility particle for Francois de La Rochefoucauld introduced in r228909 2. Change c-cedilla introduced in the same commit to ASCII c since non-UTF-8 terminals will choke on the non-ASCII text. Modified: stable/7/games/fortune/datfiles/fortunes stable/7/games/fortune/datfiles/fortunes-o.real stable/7/games/fortune/datfiles/murphy Directory Properties: stable/7/games/fortune/ (props changed) Modified: stable/7/games/fortune/datfiles/fortunes ============================================================================== --- stable/7/games/fortune/datfiles/fortunes Sun Jan 1 22:33:29 2012 (r229223) +++ stable/7/games/fortune/datfiles/fortunes Sun Jan 1 22:33:55 2012 (r229224) @@ -773,40 +773,6 @@ the female, autopsied her, and sure enou "What do you think?" said the first ranger. "The Czech is in the male," replied the second. % - A group of soldiers being prepared for a practice landing on a tropical -island were warned of the one danger the island held, a poisonous snake that -could be readily identified by its alternating orange and black bands. They -were instructed, should they find one of these snakes, to grab the tail end of -the snake with one hand and slide the other hand up the body of the snake to -the snake's head. Then, forcefully, bend the thumb above the snake's head -downward to break the snake's spine. All went well for the landing, the -charge up the beach, and the move into the jungle. At one foxhole site, two -men were starting to dig and wondering what had happened to their partner. -Suddenly he staggered out of the underbrush, uniform in shreds, covered with -blood. He collapsed to the ground. His buddies were so shocked they could -only blurt out, "What happened?" - "I ran from the beachhead to the edge of the jungle, and, as I hit the -ground, I saw an orange and black striped snake right in front of me. I -grabbed its tail end with my left hand. I placed my right hand above my left -hand. I held firmly with my left hand and slid my right hand up the body of -the snake. When I reached the head of the snake I flicked my right thumb down -to break the snake's spine... did you ever goose a tiger?" -% - A guy returns from a long trip to Europe, having left his beloved -dog in his brother's care. The minute he's cleared customs, he calls up his -brother and inquires after his pet. - "Your dog's dead," replies his brother bluntly. - The guy is devastated. "You know how much that dog meant to me," -he moaned into the phone. "Couldn't you at least have thought of a nicer way -of breaking the news? Couldn't you have said, `Well, you know, the dog got -outside one day, and was crossing the street, and a car was speeding around a -corner...' or something...? Why are you always so thoughtless?" - "Look, I'm sorry," said his brother, "I guess I just didn't think." - "Okay, okay, let's just put it behind us. How are you anyway? -How's Mom?" - His brother is silent a moment. "Uh," he stammers, "uh... Mom got -outside one day..." -% A hard-luck actor who appeared in one colossal disaster after another finally got a break, a broken leg to be exact. Someone pointed out that it's the first time the poor fellow's been in the same cast for more than a week. @@ -1137,12 +1103,6 @@ went out to be killed? The Pole pulls a bottle of vodka from the other side of his jacket. He smiles and replies, "Five men on one bottle -- too many." % - A priest was walking along the cliffs at Dover when he came upon -two locals pulling another man ashore on the end of a rope. "That's what -I like to see", said the priest, "A man helping his fellow man". - As he was walking away, one local remarked to the other, "Well, -he sure doesn't know the first thing about shark fishing." -% A program should be light and agile, its subroutines connected like a strings of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little nor too much, neither needless @@ -1361,16 +1321,6 @@ realize the full significance of Pharoah -- Grendel Briarton "Through Time & Space With Ferdinand Feghoot!" % - After watching an extremely attractive maternity-ward patient -earnestly thumbing her way through a telephone directory for several -minutes, a hospital orderly finally asked if he could be of some help. - "No, thanks," smiled the young mother, "I'm just looking for a -name for my baby." - "But the hospital supplies a special booklet that lists hundreds -of first names and their meanings," said the orderly. - "That won't help," said the woman, "my baby already has a first -name." -% All I really need to know about how to live and what to do and how to be I learned in kindergarten. Wisdom was not at the top of the graduate-school mountain, but there in the sandpile at Sunday School. @@ -1470,26 +1420,6 @@ the ideas and frills that were cautiousl The result, as Ovid says, is a "big pile". -- Frederick Brooks, Jr., "The Mythical Man-Month" % - An eighty-year-old woman is rocking away the afternoon on her -porch when she sees an old, tarnished lamp sitting near the steps. She -picks it up, rubs it gently, and lo and behold a genie appears! The genie -tells the woman the he will grant her any three wishes her heart desires. - After a bit of thought, she says, "I wish I were young and -beautiful!" And POOF! In a cloud of smoke she becomes a young, beautiful, -voluptuous woman. - After a little more thought, she says, "I would like to be rich -for the rest of my life." And POOF! When the smoke clears, there are -stacks and stacks of money lying on the porch. - The genie then says, "Now, madam, what is your final wish?" - "Well," says the woman, "I would like for you to transform my -faithful old cat, whom I have loved dearly for fifteen years, into a young -handsome prince!" - And with another billow of smoke the cat is changed into a tall, -handsome, young man, with dark hair, dressed in a dashing uniform. - As they gaze at each other in adoration, the prince leans over to -the woman and whispers into her ear, "Now, aren't you sorry you had me -fixed?" -% An elderly man stands in line for hours at a Warsaw meat store (meat is severely rationed). When the butcher comes out at the end of the day and announces that there is no meat left, the man flies into a rage. @@ -1552,14 +1482,6 @@ young welp with a masochistic streak who up-and-down bureaucracy in the history of mankind." -- R. L. Forward, "Flight of the Dragonfly" % - "Anything else, sir?" asked the attentive bellhop, trying his best -to make the lady and gentleman comfortable in their penthouse suite in the -posh hotel. - "No. No, thank you," replied the gentleman. - "Anything for your wife, sir?" the bellhop asked. - "Why, yes, young man," said the gentleman. "Would you bring me -a postcard?" -% "Anything else you wish to draw to my attention, Mr. Holmes ?" "The curious incident of the stable dog in the nighttime." "But the dog did nothing in the nighttime." @@ -1932,52 +1854,16 @@ said the Duck: "it's generally a frog or The question is, what did the archbishop find?" % - Four Oxford dons were taking their evening walk together and as -usual, were engaged in casual but learned conversation. On this particular -evening, their conversation was about the names given to groups of animals, -such as a "pride of lions" or a "gaggle of geese." - One of the professors noticed a group of prostitutes down the block, -and posed the question, "What name would be given to that group?" The four -fell into silence for a moment, as they pondered the possibilities... - At last, one spoke: "How about `a Jam of Tarts'?" The others nodded -in acknowledgment as they continued to consider the problem. A second -professor spoke: "I'd suggest `an Essay of Trollops.'" Again, the others -nodded. A third spoke: "I propose `a Flourish of Strumpets.'" - They continued their walk in silence, until the first professor -remarked to the remaining professor, who was the most senior and learned of -the four, "You haven't suggested a name for our ladies. What are your -thoughts?" - Replied the fourth professor, "`An Anthology of Prose.'" -% Fred noticed his roommate had a black eye upon returning from a dance. "What happened?" "I was struck by the beauty of the place." % - Friends were surprised, indeed, when Frank and Jennifer broke their -engagement, but Frank had a ready explanation: "Would you marry someone who -was habitually unfaithful, who lied at every turn, who was selfish and lazy -and sarcastic?" - "Of course not," said a sympathetic friend. - "Well," retorted Frank, "neither would Jennifer." -% "Gee, Mudhead, everyone at Morse Science High has an extracurricular activity except you." "Well, gee, doesn't Louise count?" "Only to ten, Mudhead." -- The Firesign Theatre % - "Gentlemen of the jury," said the defense attorney, now beginning -to warm to his summation, "the real question here before you is, shall this -beautiful young woman be forced to languish away her loveliest years in a -dark prison cell? Or shall she be set free to return to her cozy little -apartment at 4134 Mountain Ave. -- there to spend her lonely, loveless hours -in her boudoir, lying beside her little Princess phone, 962-7873?" -% - God decided to take the devil to court and settle their -differences once and for all. - When Satan heard of this, he grinned and said, "And just -where do you think you're going to find a lawyer?" -% Graduating seniors, parents and friends... Let me begin by reassuring you that my remarks today will stand up to the most stringent requirements of the new appropriateness. @@ -2050,33 +1936,6 @@ for it is complete within itself. It ex Software and Hardware, ashamed, returned to their homes. -- Geoffrey James, "The Tao of Programming" % - Harry, a golfing enthusiast if there ever was one, arrived home -from the club to an irate, ranting wife. - "I'm leaving you, Harry," his wife announced bitterly. "You -promised me faithfully that you'd be back before six and here it is almost -nine. It just can't take that long to play 18 holes of golf." - "Honey, wait," said Harry. "Let me explain. I know what I promised -you, but I have a very good reason for being late. Fred and I tee'd off -right on time and everything was fine for the first three holes. Then, on -the fourth tee Fred had a stroke. I ran back to the clubhouse but couldn't -find a doctor. And, by the time I got back to Fred, he was dead. So, for -the next 15 holes, it was hit the ball, drag Fred, hit the ball, drag Fred... -% - Harry constantly irritated his friends with his eternal optimism. -No matter how bad the situation, he would always say, "Well, it could have -been worse." - To cure him of his annoying habit, his friends decided to invent a -situation so completely black, so dreadful, that even Harry could find no -hope in it. Approaching him at the club bar one day, one of them said, -"Harry! Did you hear what happened to George? He came home last night, -found his wife in bed with another man, shot them both, and then turned -the gun on himself!" - "Terrible," said Harry. "But it could have been worse." - "How in hell," demanded his dumbfounded friend, "could it possibly -have been worse?" - "Well," said Harry, "if it had happened the night before, I'd be -dead right now." -% "Has anyone had problems with the computer accounts?" "Yes; I don't have one." "Okay, you can send mail to one of the tutors..." @@ -2112,13 +1971,6 @@ lessening mine; as he who lights his tap without darkening me. -- Thomas Jefferson on patents on ideas % - "Heard you were moving your piano, so I came over to help." - "Thanks. Got it upstairs already." - "Do it alone?" - "Nope. Hitched the cat to it." - "How would that help?" - "Used a whip." -% "Hey, Sam, how about a loan?" "Whattaya need?" "Oh, about $500." @@ -2182,11 +2034,6 @@ could forget that, to within half a perc social climber said to her roommate. "I mean, I've never seen a Porsche full of money before." % - "How'd you get that flat?" - "Ran over a bottle." - "Didn't you see it?" - "Damn kid had it under his coat." -% Human thinking can skip over a great deal, leap over small misunderstandings, can contain ifs and buts in untroubled corners of the mind. But the machine has no corners. Despite all the attempts to @@ -2199,11 +2046,6 @@ line by code line, the programmer confro The ways of human and machine understanding are disjunct. -- Ellen Ullman, "Close to the Machine" % - "I believe you have the wrong number," said the old gentleman into -the phone. "You'll have to call the weather bureau for that information." - "Who was that?" his young wife asked. - "Some guy wanting to know if the coast was clear." -% "I cannot read the fiery letters," said Frito Bugger in a quavering voice. "No," said GoodGulf, "but I can. The letters are Elvish, of @@ -2496,11 +2338,6 @@ it gets so bad you can't handle it alone would destroy the whole point of it." -- Thomas Pynchon, "The Crying of Lot 49" % - "I'm looking for adventure, excitement, beautiful women," cried the -young man to his father as he prepared to leave home. "Don't try to stop me. -I'm on my way." - "Who's trying to stop you?" shouted the father. "Take me along!" -% I'm sure that VMS is completely documented, I just haven't found the right manual yet. I've been working my way through the manuals in the document library and I'm half way through the second cabinet, (3 shelves to go), so I @@ -2558,20 +2395,6 @@ pie-bakers and pie-dividers is way out o been an efficiency expert? -- Motor Trend, May 1983 % - In the beginning, God created the Earth and he said, "Let there be -mud." - And there was mud. - And God said, "Let Us make living creatures out of mud, so the mud -can see what we have done." - And God created every living creature that now moveth, and one was -man. Mud-as-man alone could speak. - "What is the purpose of all this?" man asked politely. - "Everything must have a purpose?" asked God. - "Certainly," said man. - "Then I leave it to you to think of one for all of this," said God. - And He went away. - -- Kurt Vonnegut, Jr., "Between Time and Timbuktu" -% In the beginning there was data. The data was without form and null, and darkness was upon the face of the console; and the Spirit of IBM was moving over the face of the market. And DEC said, "Let there @@ -2926,11 +2749,6 @@ Church soon made its peace with Galileo' earth really does revolve about the sun. -- S. J. Gould, "The Mismeasure of Man" % - "My mother," said the sweet young steno, "says there are some things -a girl should not do before twenty." - "Your mother is right," said the executive, "I don't like a large -audience, either." -% NEW YORK -- Kraft Foods, Inc. announced today that its board of directors unanimously rejected the $11 billion takeover bid by Philip Morris and Co. A Kraft spokesman stated in a press conference that the @@ -3727,14 +3545,6 @@ was solidly entrenched in the market, an improve ... -- Dave Barry, "In Search of Excellence" % - "That wife of mine is a liar," said the angry husband to a -sympathetic pal seated next to him in a bar. - "How do you know?" the friend asked. - "She didn't come home last night, and when I asked her where -she'd been she said she'd spent the night with her sister Shirley." - "So?" - "So, she's a liar. I spent the night with her sister Shirley." -% "That's right; the upper-case shift works fine on the screen, but they're not coming out on the damn printer... Hold? Sure, I'll hold." -- e. e. cummings last service call @@ -3768,13 +3578,6 @@ laughed uproariously. "What's the matte got a sense of humor?" "I don't have to laugh," she said. "I'm leaving Friday anyway. % - The doctor had just finished giving the young man a thorough -physical examination. "The best thing for you to do," the M.D. said, -"is give up drinking, give up smoking, get to bed early and stay away -from women." - "Doc, I don't deserve the best," pleaded his patient. "What's -second best?" -% The FIELD GUIDE to NORTH AMERICAN MALES SPECIES: Cranial Males @@ -3889,22 +3692,6 @@ win through and still know where his tow reckoned with. -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy" % - The honeymooning couple agreed it was a fine day for horseback riding. -After a mile or so, the bride's mount cantered under a low tree and a -branch scraped her forehead lightly. The groom dismounted, glared at his -wife's horse, and said, "That's number one." - The ride then proceeded. After another mile or so, the bride's -horse stumbled over a pebble and the lady suffered a slight jostling. -Again, her man leapt from his saddle and strode over to the nervous animal. -"That's two," he said. - Five miles later, the bride's horse became frightened when a rabbit -crossed its path, reared up and threw the girl. Immediately, the groom was -off his horse. "That's three!", he shouted, and, pulling out a pistol, he -shot the horse between the eyes. - "You brute!" shrieked his bride. "Now I see the kind of man I -married! You're a sadist, that's what!" - The groom turned to her coolly. "That's one," he said. -% "The jig's up, Elman." "Which jig?" -- Jeff Elman @@ -4349,29 +4136,6 @@ of his mortal enemy -- to those both com spread only for demons or for gods." -- Gordon R. Dickson, "Soldier Ask Not" % - "They spend years searching for their natural parents, convinced their -parents will be happy to see them. I mean, really, can you imagine someone -being happy to see an orphan? Nobody wants them... that's why they're orphans!" - The speaker is Anne Baker, founder and guiding force behind -Orphan-Off, an organization dedicated to keeping orphans confused about the -whereabouts of their natural parents. She is a woman with a mission: - "Basically, what we do is band together to exchange information -about which orphans are looking for which parents in what part of the -country. We're completely computerized. - "The idea is to throw the orphans as many red herrings and false -leads as possible. We'll tell some twenty-three-year-old loser that his -real parents can be found at a certain address on the other side of the -country. Well, by the time the kid shows up, the family is prepared. They -look over the kid's photos and information and they say, 'Oh, the Emersons... -yeah, they used to live here... I think they moved out about five years ago. -I think they went to Iowa, or maybe Idaho.' - "Bam, the door shuts in the kid's face and he's back to zero again. -He's got nothing to go on but the orphan's pathetic determination to continue. - "It's really amazing how much these kids will put up with. Last year -we even sent one kid all the way to Australia. I mean, really. Besides, if -your natural parents were Australian, would you want to meet them?" - -- "National Lampoon", September, 1984 -% This is where the bloodthirsty license agreement is supposed to go, explaining that Interactive EasyFlow is a copyrighted package licensed for use by a single person, and sternly warning you not to pirate copies of it @@ -4683,13 +4447,6 @@ men with whom I felt an immediate sympat more satisfactory to me than the opaque vogue word "empathy". -- Alistair Cooke, "Six Men" % - "What the hell are you getting so upset about? I thought you -didn't believe in God". - "I don't," she sobbed, bursting violently into tears, "but the -God I don't believe in is a good God, a just God, a merciful God. He's -not the mean and stupid God you make Him out to be". - -- Joseph Heller -% "What was the worst thing you've ever done?" "I won't tell you that, but I'll tell you the worst thing that ever happened to me... the most dreadful thing." @@ -4806,20 +4563,6 @@ unanswered. Eventually the form for the the section marked "DEDUCTIONS," Rogers listed: "Bad debt, US Government -- $40,000." % - With deep concern, if not alarm, Dick noted that his friend -Conrad was drunker than he'd ever seen him before. "What's the trouble, -buddy?", he asked, sliding onto the stool next to his friend. - "It's a woman, Dick," Conrad replied. - "I guessed that much. Tell me about it." - "I can't," Conrad said. But after a few more drinks his tongue -and resolution both seemed to weaken and, turning to his buddy, he said, -"Okay. It's your wife." - "My wife!!" - "Yeah." - "What about her?" - Conrad pondered the question heavily, and draped his arm around -his pal. "Well, buddy-boy," he said, "I'm afraid she's cheating on us." -% Work Hard. Rock Hard. Eat Hard. @@ -4956,7 +4699,7 @@ the soul. Worry, doubt, self-distrust, long, long years that bow the head and turn the growing spirit back to dust. - Whether seventy or sixteen, there is in every being’s heart a + Whether seventy or sixteen, there is in every being's heart a love of wonder; the sweet amazement at the stars and starlike things and thoughts; the undaunted challenge of events, the unfailing childlike appetite for what comes next, and the joy in the game of life. @@ -6593,9 +6336,6 @@ a fund for his funeral. The Lord Chief a shilling. "Only a shilling?" exclaimed the man. "Only a shilling to bury an attorney? Here's a guinea; go and bury twenty of them." % -A fail-safe circuit will destroy others. - -- Klipstein -% A failure will not appear until a unit has passed final inspection. % A fair exterior is a silent recommendation. @@ -6662,17 +6402,6 @@ go!'" % A few hours grace before the madness begins again. % -A figure with curves always offers a lot of interesting angles. -% -A fisherman from Maine went to Alabama on his vacation. He rented a boat, -rowed out to the middle of the lake, and cast his line, but when he looked -down into the water he was horrified to see a man wrapped in chains lying -on the bottom of the lake. He quickly rowed to shore and ran to the police -station. "Sheriff, sheriff," he gasped, there's a guy wrapped in chains, -drowned in the lake!" - "Now ain't that jest like a Yankee," drawled the sheriff, "to steal -more chain than he can swim with?" -% A fitter fits; Though sinners sin A cutter cuts; And thinners thin And an aircraft spotter spots; And paper-blotters blot @@ -6697,11 +6426,6 @@ A fool and his honey are soon parted. % A fool and his money are soon popular. % -A fool and your money are soon partners. -% -A fool is a man who worries about whether or not his lover has integrity. -A wise man, on the other hand, busies himself with deeper attributes. -% A fool must now and then be right by chance. % A foolish consistency is the hobgoblin of little minds. @@ -6744,8 +6468,6 @@ You'll just be walking down the street a A friend of mine won't get a divorce, because he hates lawyers more than he hates his wife. % -A friend with weed is a friend indeed. -% A full belly makes a dull brain. -- Benjamin Franklin @@ -6809,9 +6531,6 @@ A girl with a future avoids the man with A girl's best friend is her mutter. -- Dorothy Parker % -A girl's conscience doesn't really keep her from doing anything wrong-- -it merely keeps her from enjoying it. -% A gleekzorp without a tornpee is like a quop without a fertsneet (sort of). % @@ -7102,27 +6821,6 @@ A language that doesn't have everything actually easier to program in than some that do. -- Dennis M. Ritchie % -A lanky Texan was mad because Texas had just become the second largest state in -the Union, so he made up his mind to move to Alaska. He drove for three days -and three nights to get there and finally he came to what looked like the state -line. He halted his car and walked up to the border guard. "Hi, there! How -do I become a resident of this here biggest state?" demanded the Texan. - The guard looked him up and down and grinned. "Waal," he answered, -there are three things you gotta do to get in. First, drink down a quart of -110 proof corn liquor without blinkin'. Second, kill a grizzly bear, and -third, make love to an Eskimo woman." - "Sounds easy enough," said the Texan. "Where can I get a quart of -this here corn liquor?" - "Got one right here," replied the guard. - The Texan gulped down the whiskey without batting an eyelash. -"Now, do you happen to know where I can find me a grizzly?" - "Yep," answered the guard, "there's a big b'ar over that way, 'bout -a mile... lives in a cave on that cliff." - The Texan lurched merrily off. About an hour later he returned -with his clothes almost torn off and his face scratched and bloody. He was -smiling happily. "Now," he roared, "where's that damn Eskimo woman you -want killed?" -% A large number of installed systems work by fiat. That is, they work by being declared to work. -- Anatol Holt @@ -7230,33 +6928,16 @@ A lot of people I know believe in positi and so do I. I believe everything positively stinks. -- Lew Col % -A lover without indiscretion is no lover at all. - -- Thomas Hardy -% A major, with wonderful force, Called out in Hyde Park for a horse. All the flowers looked round, But no horse could be found; So he just rhododendron, of course. % -A male gynecologist is like an auto mechanic who has never owned a car. - -- Carrie Snow -% -A man always needs to remember one thing about -a beautiful woman. Somewhere, somebody's tired of her. -% A man always remembers his first love with special tenderness, but after that begins to bunch them. -- H. L. Mencken % -A man arrived home early to find his wife in the arms of his best friend, -who swore how much they were in love. To quiet the enraged husband, the -lover suggested, "Friends shouldn't fight, let's play gin rummy. If I win, -you get a divorce so I can marry her. If you win, I promise never to see -her again. Okay?" - "Alright," agreed the husband. "But how about a quarter a point -on the side to make it interesting?" -% A man can have two, maybe three love affairs while he's married. After that it's cheating. -- Yves Montand @@ -7393,9 +7074,6 @@ in no other way. A man who fishes for marlin in ponds will put his money in Etruscan bonds. % -A man who likes to lie in bed can usually -find a girl willing to listen to him. -% A man who turns green has eschewed protein. % A man with 3 wings and a dictionary is cousin to the turkey. @@ -7403,12 +7081,8 @@ A man with 3 wings and a dictionary is c A man with one watch knows what time it is. A man with two watches is never quite sure. % -A man without a God is like a fish without a bicycle. -% A man without a woman is like a fish without gills. % -A man without a woman is like a statue without pigeons. -% A man would still do something out of sheer perversity - he would create destruction and chaos - just to gain his point... and if all this could in turn be analyzed and prevented by predicting that it would occur, then man @@ -7593,33 +7267,6 @@ will go far towards curing the rascal of A New York City ordinance prohibits the shooting of rabbits from the rear of a Third Avenue street car -- if the car is in motion. % -A New Yorker is riding down the road in his new Mercedes. So intent is he -on the cocaine in his hand he completely misses a turn and his car plunges -over the five-hundred-foot cliff to be smashed into pieces at the bottom. -As the on-lookers rush to the edge of the cliff they see him fifty feet -from the top of the cliff clinging to a stunted bush with all his strength. -"Dear Lord," he prays, "I never asked you for nothin' before, but I'm askin' -you now: Save me, Lord, save me." - Booms the Lord: "LET GO OF THE BRANCH." - "But Lord, if I do that, I'll fall!" - "TRUST ME, LET GO OF THE BRANCH." - "But Lord, I'm gonna fall and die..." - "TRUST ME TO SAVE YOU. LET GO OF THE BRANCH." - Okay, Lord, I'll trust you, here I... here I go!" And he falls -to his death. - "DUMB YANKEE." -% -A New Yorker was driving through Berkeley when he saw a big crowd gathered -by the side of the street. Curiosity got the better of him and he leaned -out of his window to ask an onlooker what was going on. The fellow explained -that a protestor against the U.S. position in South America had doused -himself with gasoline and set himself on fire. "That's terrible," gasped -the man. "But why is everyone still standing around?" - "Well, they're taking up a collection for his wife and kids," the -onlooker explained. "Would you be willing to help?" - "Well, sure," replied the New Yorker. "I suppose I could spare a -gallon or two." -% A newspaper is a circulating library with high blood pressure. -- Arthure "Bugs" Baer % @@ -7684,12 +7331,6 @@ itself, and that is an excellent thing f manufacturers for whom patriotic terrors are an abundant source of gain. -- Anatole France % -A perfectly honest woman, a woman who never flatters, who never manages, -who never cajoles, who never conceals, who never uses her eyes, who never -speculates on the effect which she produces, who never is conscious of -unspoken admiration, what a monster, I say, would such a female be! - -- Thackeray -% A person forgives only when they are in the wrong. % A person is just about as big as the things that make him angry. @@ -7794,8 +7435,6 @@ last pair of shoes, already worn out in of yours to press against my heart. -- Johann Wolfgang von Goethe % -A pretty woman can do anything; an ugly woman must do everything. -% A priest advised Voltaire on his death bed to renounce the devil. Replied Voltaire, "This is no time to make new enemies." % @@ -7881,23 +7520,6 @@ the ball is more than three inches from to make a travesty of the game. -- Donald A. Metz % -A rabbi and a priest are sitting together on a train, and the rabbi leans -over and asks, "So, how high can you advance in your organization?" - The priest replies, "Well, if I am lucky, I guess I could become a -Bishop." - "Well, could you get any higher than that?" - "I suppose that if my works are seen in a very good light that I -might be made an Archbishop." - "Is there any way that you might go higher than that?" - "If all the Saints should smile, I guess I could be made a Cardinal." - "Could you be anything higher than a Cardinal?" - Hesitating a little bit, the priest said, "I suppose that I could -be elected Pope, but only if it's God's will." - "And could you be anything higher than that, is there any way to go -up from being the Pope?" - "What?! I should be the Messiah himself?!" - The rabbi leaned back and smiled. "One of our boys made it." -% A raccoon tangled with a 23,000 volt line today. The results blacked out 1400 homes and, of course, one raccoon. -- Steel City News @@ -7912,17 +7534,6 @@ A real diplomat is one who can cut his n his neighbor notice it. -- Trygve Lie % -A real estate agent, looking over a farmer's house for possible sale, -commented to the farmer how sturdy the house looked. - The farmer replied, "Yep, built it with my bare hands... did it -the hard way. The steps to the front door, here, carved 'em out of -field stones... did it the hard way. That hardwood floor in the living -room, dovetailed the pieces myself... did it the hard way. The ceiling -beams, made 'em out of my own oak trees... did it the hard way." - Just then, the farmer's gorgeous daughter walked in. The farmer -looks over at the real estate agent who is trying not to stare too -obviously and smiles. "Yep... standing up in a canoe." -% A real friend isn't someone you use once and then throw away. A real friend is someone you can use over and over again. % @@ -8180,8 +7791,6 @@ the student with a stick. % A student who changes the course of history is probably taking an exam. % -A stunning blonde, but probably all bean dip above the eyebrows. -% A successful [software] tool is one that was used to do something undreamed of by its author. -- S. C. Johnson @@ -8318,12 +7927,6 @@ than some of the stuff that nature repla A verbal contract isn't worth the paper it's written on. -- Samuel Goldwyn % -A very intelligent turtle -Found programming UNIX a hurdle - The system, you see, - Ran as slow as did he, -And that's not saying much for the turtle. -% A violent man will die a violent death. -- Lao Tsu % @@ -8351,9 +7954,6 @@ Software rots if not used. These are great mysteries. -- Geoffrey James, "The Tao of Programming" % -A widow is more sought after than an old maid of the same age. - -- Addison -% A wise man can see more from a mountain top than a fool can from the bottom of a well. % @@ -8382,27 +7982,14 @@ A woman can look both moral and exciting were quite a struggle. -- Edna Ferber % -A woman can never be too rich or too thin. -% A woman did what a woman had to, the best way she knew how. To do more was impossible, to do less, unthinkable. -- Dirisha, "The Man Who Never Missed" % -A woman employs sincerity only when every other form of deception has failed. - -- Scott -% A woman, especially if she have the misfortune of knowing anything, should conceal it as well as she can. -- Jane Austen % -A woman forgives the audacity of which -her beauty has prompted us to be guilty. - -- LeSage -% -A woman has got to love a bad man once or twice in her life to be -thankful for a good one. - -- Marjorie Kinnan Rawlings -% A woman is like your shadow; follow her, she flies; fly from her, she follows. -- Chamfort @@ -8580,7 +8167,7 @@ Abscond, v.: % Absence diminishes mediocre passions and increases great ones, as the wind blows out candles and fans fires. - -- La Rochefoucauld + -- Francois de La Rochefoucauld % Absence in love is like water upon fire; a little quickens, but much extinguishes it. @@ -8654,11 +8241,6 @@ Accept people for what they are -- compl ACCEPTANCE TESTING: An unsuccessful attempt to find bugs. % -Acceptance without proof is the fundamental characteristic of Western -religion; rejection without proof is the fundamental characteristic of -Western science. - -- Gary Zukav, "The Dancing Wu Li Masters" -% Accident, n.: A condition in which presence of mind is good, but absence of body is better. @@ -8993,8 +8575,6 @@ the unimpeded right to get rich, to use cost to others, to win advancement. -- Norman Thomas % -After I run your program, let's make love like crazed weasels, OK? -% After living in New York, you trust nobody, but you believe everything. Just in case. % @@ -9535,7 +9115,7 @@ All the men on my staff can type. % All the passions make us commit faults; love makes us commit the most ridiculous ones. - -- La Rochefoucauld + -- Francois de La Rochefoucauld % All the really good ideas I ever had came to me while I was milking a cow. -- Grant Wood @@ -10571,8 +10151,6 @@ Any girl can be glamorous; all you have stupid. -- Hedy Lamarr % -Any given program, when running, is obsolete. -% Any given program will expand to fill available memory. % Any great truth can -- and eventually will -- be expressed as a cliche -- @@ -11466,9 +11044,6 @@ Asking a working writer what he thinks a lamp-post how it feels about dogs. -- Christopher Hampton % -Ass, n.: - The masculine of "lass". -% Assembly language experience is [important] for the maturity and understanding of how computers work that it provides. -- D. Gries @@ -12051,11 +11626,6 @@ the wise man saith, "Put all your eggs i basket!" -- Mark Twain % -Behold the unborn foetus and - Weep salt tears crocodilian; -All life is sacred (save, of course, - An enemy civilian). -% Behold the warranty -- the bold print giveth and the fine print taketh away. % @@ -12477,8 +12047,6 @@ Blessed are the forgetful: for they get the better even of their blunders. -- Friedrich Nietzsche % -Blessed are the meek for they shall inhibit the earth. -% Blessed are the young, for they shall inherit the national debt. -- Herbert Hoover % @@ -13660,9 +13228,6 @@ Drinking beer and playing cards neighb plays with elves! -- Elmo and Patsy, "Grandma Got Run Over by a Reindeer" % -Christ: - A man who was born at least 5,000 years ahead of his time. -% Christ died for our sins, so let's not disappoint Him. % Christianity might be a good thing if anyone ever tried it. @@ -13748,8 +13313,6 @@ the walk before it stops snowing. Cleanliness becomes more important when godliness is unlikely. -- P. J. O'Rourke % -Cleanliness is next to impossible. -% CLEVELAND: Where their last tornado did six million dollars worth of improvements. @@ -13890,9 +13453,6 @@ Coincidences are spiritual puns. -- G. K. Chesterton % Cold, adj.: - When the local flashers are handing out written descriptions. -% -Cold, adj.: When the politicians walk around with their hands in their own pockets. % @@ -14184,7 +13744,7 @@ Computers will not be perfected until th than the estimate the job will cost. % Conceit causes more conversation than wit. - -- La Rochefoucauld + -- Francois de La Rochefoucauld % Concept, n.: Any "idea" for which an outside consultant billed you more than @@ -14644,8 +14204,6 @@ DALLAS: The city that chose Astroturf to keep the cheerleaders from grazing. % -Dallas still lives. God MUST be dead. -% Dammit Jim, I'm an actor not a doctor. % Dammit, man, that's unprofessional! A good bartender laughs anyway! @@ -14908,14 +14466,6 @@ of education may be of even greater impo correct current table manners, vital as Miss Manners believes that is. % Dear Miss Manners: - Please list some tactful ways of removing a man's saliva from -your face. - -Gentle Reader: - Please list some decent ways of acquiring a man's saliva on -your face ... -% -Dear Miss Manners: I carry a big black umbrella, even if there's just a thirty percent chance of rain. May I ask a young lady who is a stranger to me to share its protection? This morning, I was waiting for a bus in comparative comfort, my umbrella @@ -15537,16 +15087,12 @@ Do clones have navels? Do I like getting drunk? Depends on who's doing the drinking. -- Amy Gorin % -Do infants have as much fun in infancy as adults do in adultery? -% Do Miami a favor. When you leave, take someone with you. % Do molecular biologists wear designer genes? % Do more than anyone expects, and pretty soon everyone will expect more. % -Do not believe in miracles -- rely on them. -% Do not clog intellect's sluices with bits of knowledge of questionable uses. % Do not count your chickens before they are hatched. @@ -16031,10 +15577,6 @@ want to help you could agree with each o % Don't you wish you had more energy... or less ambition? % -Dope will get you through times of no money better that money will get -you through times of no dope. - -- Gilbert Shelton -% Dorothy: How can you talk if you haven't got a brain? Scarecrow: I don't know. But some people without brains do an awful lot of talking, don't they? @@ -19581,12 +19123,6 @@ GEMINI (May 21 - June 20) the mail carefully, although there won't be anything good in it today, either. % -GEMINI (May 21 - June 20) - You are a quick and intelligent thinker. People like you -because you are bisexual. However, you are inclined to expect too much -for too little. This means you are cheap. Geminis are known for -committing incest. -% GEMINI (May 21 to Jun. 20) Good news and bad news highlighted. Enjoy the good news while you can; the bad news will make you forget it. You will enjoy praise @@ -20001,8 +19537,6 @@ can't find it anywhere. I'm sure he's t would he lie about a thing like that? -- Arthur Naiman, "Every Goy's Guide to Yiddish" % -God gives us relatives; thank goodness we can chose our friends. -% God grant us the serenity to accept the things we cannot change, courage to change the things we can, and wisdom to know the difference. % @@ -20033,8 +19567,6 @@ but by pains and contradictions. % God is a comic playing to an audience that's afraid to laugh. % -God is a polytheist. -% God is Dead. -- Nietzsche Nietzsche is Dead. @@ -20071,8 +19603,6 @@ God made machine language; all the rest God made the integers; all else is the work of Man. -- Kronecker % -God made the world in six days, and was arrested on the seventh. -% God may be subtle, but He isn't plain mean. -- Albert Einstein % @@ -20174,10 +19704,6 @@ Diary of a Young Girl LITE(tm) % Good advice is one of those insults that ought to be forgiven. % -Good advice is something a man gives -when he is too old to set a bad example. - -- La Rochefoucauld -% Good day for a change of scene. Repaper the bedroom wall. % Good day for business affairs. @@ -20373,8 +19899,6 @@ GRAVITY: % Gravity brings me down. % -Gravity is a myth, the Earth sucks. -% Gray's Law of Programming: 'n+1' trivial tasks are expected to be accomplished in the same time as 'n' tasks. @@ -20457,13 +19981,6 @@ Groundhog Day has been observed only onc groundhog came out of its hole, it was killed by a mudslide. -- Johnny Carson % -Grover Cleveland, though constantly at loggerheads with the Senate, got on -better with the House of Representatives. A popular story circulating -during his presidency concerned the night he was roused by his wife crying, -"Wake up! I think there are burglars in the house." - "No, no, my dear," said the president sleepily, "in the Senate -maybe, but not in the House." -% Growing old isn't bad when you consider the alternatives. -- Maurice Chevalier % @@ -21832,8 +21349,6 @@ Him: "Really? That's incredible... Hindsight is always 20:20. -- Billy Wilder % -Hindsight is an exact science. -% Hippogriff, n.: An animal (now extinct) which was half horse and half griffin. The griffin was itself a compound creature, half lion and half @@ -22032,8 +21547,6 @@ Home is the place where, when you have t they have to take you in. -- Robert Frost, "The Death of the Hired Man" % -Home is where the hurt is. -% Home life as we understand it is no more natural to us than a cage is to a cockatoo. -- George Bernard Shaw @@ -25271,9 +24784,6 @@ is a camel's behind. % If a can of Alpo costs 38 cents, would it cost $2.50 in Dog Dollars? % -If a child annoys you, quiet him by brushing their hair. If this doesn't -work, use the other side of the brush on the other end of the child. -% If A equals success, then the formula is _A = _X + _Y + _Z. _X is work. _Y is play. _Z is keep your mouth shut. -- Albert Einstein @@ -25454,8 +24964,6 @@ We're offering a substantial reward. He blind in his left eye, is missing part of his right ear and the tip of his tail. He's been recently fixed. Answers to "Lucky". % -If anything can go wrong, it will. -% If at first you do succeed, try to hide your astonishment. % If at first you don't succeed, destroy all evidence that you tried. @@ -25866,8 +25374,6 @@ of a student-poet to hang on to his ever % If it weren't for the last minute, nothing would ever get done. % -If it's not in the computer, it doesn't exist. -% If it's Tuesday, this must be someone else's fortune. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 22:34:38 2012 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 339DE1065673; Sun, 1 Jan 2012 22:34:38 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1DF248FC15; Sun, 1 Jan 2012 22:34: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 q01MYcJ5034511; Sun, 1 Jan 2012 22:34:38 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01MYc29034508; Sun, 1 Jan 2012 22:34:38 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201012234.q01MYc29034508@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 22:34:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229225 - stable/9/usr.sbin/lpr/filters 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, 01 Jan 2012 22:34:38 -0000 Author: dim Date: Sun Jan 1 22:34:37 2012 New Revision: 229225 URL: http://svn.freebsd.org/changeset/base/229225 Log: MFC r228663: In usr.sbin/lpr/filters/lpf.c, use a less obtuse way of clearing the buffer, that also avoids warnings. Modified: stable/9/usr.sbin/lpr/filters/lpf.c Directory Properties: stable/9/usr.sbin/lpr/filters/ (props changed) Modified: stable/9/usr.sbin/lpr/filters/lpf.c ============================================================================== --- stable/9/usr.sbin/lpr/filters/lpf.c Sun Jan 1 22:33:55 2012 (r229224) +++ stable/9/usr.sbin/lpr/filters/lpf.c Sun Jan 1 22:34:37 2012 (r229225) @@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #define MAXWIDTH 132 #define MAXREP 10 @@ -115,7 +116,7 @@ main(int argc, char *argv[]) acctfile = cp; } - for (cp = buf[0], limit = buf[MAXREP]; cp < limit; *cp++ = ' '); + memset(buf, ' ', sizeof(buf)); done = 0; while (!done) { From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 23:04:28 2012 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 12C17106566B; Sun, 1 Jan 2012 23:04:28 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F0E218FC0C; Sun, 1 Jan 2012 23:04:27 +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 q01N4RlN035458; Sun, 1 Jan 2012 23:04:27 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01N4Rrj035456; Sun, 1 Jan 2012 23:04:27 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201012304.q01N4Rrj035456@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 23:04:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229226 - stable/9/usr.sbin/lpr/lpd 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, 01 Jan 2012 23:04:28 -0000 Author: dim Date: Sun Jan 1 23:04:27 2012 New Revision: 229226 URL: http://svn.freebsd.org/changeset/base/229226 Log: MFC r228664: In usr.sbin/lpr/lpd/printjob.c, use the correct printf length modifiers for off_t (aka int64_t). Modified: stable/9/usr.sbin/lpr/lpd/printjob.c Directory Properties: stable/9/usr.sbin/lpr/lpd/ (props changed) Modified: stable/9/usr.sbin/lpr/lpd/printjob.c ============================================================================== --- stable/9/usr.sbin/lpr/lpd/printjob.c Sun Jan 1 22:34:37 2012 (r229225) +++ stable/9/usr.sbin/lpr/lpd/printjob.c Sun Jan 1 23:04:27 2012 (r229226) @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1138,9 +1139,10 @@ sendagain: copycnt++; if (copycnt < 2) - (void) sprintf(buf, "%c%qd %s\n", type, stb.st_size, file); + (void) sprintf(buf, "%c%" PRId64 " %s\n", type, stb.st_size, + file); else - (void) sprintf(buf, "%c%qd %s_c%d\n", type, stb.st_size, + (void) sprintf(buf, "%c%" PRId64 " %s_c%d\n", type, stb.st_size, file, copycnt); amt = strlen(buf); for (i = 0; ; i++) { From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 23:07:14 2012 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 12EA11065670; Sun, 1 Jan 2012 23:07:14 +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 F15DF8FC13; Sun, 1 Jan 2012 23:07: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 q01N7D0q035587; Sun, 1 Jan 2012 23:07:13 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01N7DU0035585; Sun, 1 Jan 2012 23:07:13 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201012307.q01N7DU0035585@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 1 Jan 2012 23:07:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229227 - stable/9/sys/fs/nullfs 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, 01 Jan 2012 23:07:14 -0000 Author: kib Date: Sun Jan 1 23:07:13 2012 New Revision: 229227 URL: http://svn.freebsd.org/changeset/base/229227 Log: MFC r227695: Use the plain panic calls, without additional printing around them. Modified: stable/9/sys/fs/nullfs/null_subr.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/fs/nullfs/null_subr.c ============================================================================== --- stable/9/sys/fs/nullfs/null_subr.c Sun Jan 1 23:04:27 2012 (r229226) +++ stable/9/sys/fs/nullfs/null_subr.c Sun Jan 1 23:07:13 2012 (r229227) @@ -289,22 +289,12 @@ null_checkvp(vp, fil, lno) #endif if (a->null_lowervp == NULLVP) { /* Should never happen */ - int i; u_long *p; - printf("vp = %p, ZERO ptr\n", (void *)vp); - for (p = (u_long *) a, i = 0; i < 8; i++) - printf(" %lx", p[i]); - printf("\n"); - panic("null_checkvp"); + panic("null_checkvp %p", vp); } VI_LOCK_FLAGS(a->null_lowervp, MTX_DUPOK); - if (a->null_lowervp->v_usecount < 1) { - int i; u_long *p; - printf("vp = %p, unref'ed lowervp\n", (void *)vp); - for (p = (u_long *) a, i = 0; i < 8; i++) - printf(" %lx", p[i]); - printf("\n"); - panic ("null with unref'ed lowervp"); - } + if (a->null_lowervp->v_usecount < 1) + panic ("null with unref'ed lowervp, vp %p lvp %p", + vp, a->null_lowervp); VI_UNLOCK(a->null_lowervp); #ifdef notyet printf("null %x/%d -> %x/%d [%s, %d]\n", From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 23:08:20 2012 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 56CAB106566B; Sun, 1 Jan 2012 23:08:20 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 407C88FC16; Sun, 1 Jan 2012 23:08:20 +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 q01N8KbN035671; Sun, 1 Jan 2012 23:08:20 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01N8KtL035668; Sun, 1 Jan 2012 23:08:20 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201012308.q01N8KtL035668@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 23:08:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229228 - stable/9/usr.sbin/ndiscvt 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, 01 Jan 2012 23:08:20 -0000 Author: dim Date: Sun Jan 1 23:08:19 2012 New Revision: 229228 URL: http://svn.freebsd.org/changeset/base/229228 Log: MFC r228665: Use NO_WCAST_ALIGN for usr.sbin/ndiscvt; because this is only built for x86, any alignment warnings can be safely ignored. Define YY_NO_INPUT in usr.sbin/ndiscvt/inf-token.l, so no unused lex functions are defined. Modified: stable/9/usr.sbin/ndiscvt/Makefile stable/9/usr.sbin/ndiscvt/inf-token.l Directory Properties: stable/9/usr.sbin/ndiscvt/ (props changed) Modified: stable/9/usr.sbin/ndiscvt/Makefile ============================================================================== --- stable/9/usr.sbin/ndiscvt/Makefile Sun Jan 1 23:07:13 2012 (r229227) +++ stable/9/usr.sbin/ndiscvt/Makefile Sun Jan 1 23:08:19 2012 (r229228) @@ -11,6 +11,7 @@ MAN= ndiscvt.8 MAN+= ndisgen.8 WARNS?= 4 +NO_WCAST_ALIGN= DPADD= ${LIBL} LDADD= -ll Modified: stable/9/usr.sbin/ndiscvt/inf-token.l ============================================================================== --- stable/9/usr.sbin/ndiscvt/inf-token.l Sun Jan 1 23:07:13 2012 (r229227) +++ stable/9/usr.sbin/ndiscvt/inf-token.l Sun Jan 1 23:08:19 2012 (r229228) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); int lineno = 1; #define YY_NO_UNPUT +#define YY_NO_INPUT int yylex(void); void yyerror(const char *); From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 23:09:58 2012 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 61A7A1065670; Sun, 1 Jan 2012 23:09:58 +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 4BCE68FC12; Sun, 1 Jan 2012 23:09: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 q01N9whh035751; Sun, 1 Jan 2012 23:09:58 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01N9wnD035749; Sun, 1 Jan 2012 23:09:58 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201012309.q01N9wnD035749@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 1 Jan 2012 23:09: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: r229229 - stable/8/sys/fs/nullfs 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, 01 Jan 2012 23:09:58 -0000 Author: kib Date: Sun Jan 1 23:09:57 2012 New Revision: 229229 URL: http://svn.freebsd.org/changeset/base/229229 Log: MFC r227695: Use the plain panic calls, without additional printing around them. Modified: stable/8/sys/fs/nullfs/null_subr.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/fs/nullfs/null_subr.c ============================================================================== --- stable/8/sys/fs/nullfs/null_subr.c Sun Jan 1 23:08:19 2012 (r229228) +++ stable/8/sys/fs/nullfs/null_subr.c Sun Jan 1 23:09:57 2012 (r229229) @@ -289,22 +289,12 @@ null_checkvp(vp, fil, lno) #endif if (a->null_lowervp == NULLVP) { /* Should never happen */ - int i; u_long *p; - printf("vp = %p, ZERO ptr\n", (void *)vp); - for (p = (u_long *) a, i = 0; i < 8; i++) - printf(" %lx", p[i]); - printf("\n"); - panic("null_checkvp"); + panic("null_checkvp %p", vp); } VI_LOCK_FLAGS(a->null_lowervp, MTX_DUPOK); - if (a->null_lowervp->v_usecount < 1) { - int i; u_long *p; - printf("vp = %p, unref'ed lowervp\n", (void *)vp); - for (p = (u_long *) a, i = 0; i < 8; i++) - printf(" %lx", p[i]); - printf("\n"); - panic ("null with unref'ed lowervp"); - } + if (a->null_lowervp->v_usecount < 1) + panic ("null with unref'ed lowervp, vp %p lvp %p", + vp, a->null_lowervp); VI_UNLOCK(a->null_lowervp); #ifdef notyet printf("null %x/%d -> %x/%d [%s, %d]\n", From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 23:12:44 2012 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 2484D1065670; Sun, 1 Jan 2012 23:12:44 +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 0E8EB8FC0A; Sun, 1 Jan 2012 23:12: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 q01NChd6035908; Sun, 1 Jan 2012 23:12:43 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01NChjs035906; Sun, 1 Jan 2012 23:12:43 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201012312.q01NChjs035906@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 1 Jan 2012 23:12:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229230 - stable/9/sys/fs/nullfs 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, 01 Jan 2012 23:12:44 -0000 Author: kib Date: Sun Jan 1 23:12:43 2012 New Revision: 229230 URL: http://svn.freebsd.org/changeset/base/229230 Log: MFC r227696: Do not use NULLVPTOLOWERVP() in the null_print(). If diagnostic is compiled in, and show vnode is used from ddb on the faulty nullfs vnode, we get panic instead of vnode dump. Modified: stable/9/sys/fs/nullfs/null_vnops.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/fs/nullfs/null_vnops.c ============================================================================== --- stable/9/sys/fs/nullfs/null_vnops.c Sun Jan 1 23:09:57 2012 (r229229) +++ stable/9/sys/fs/nullfs/null_vnops.c Sun Jan 1 23:12:43 2012 (r229230) @@ -729,7 +729,7 @@ null_print(struct vop_print_args *ap) { struct vnode *vp = ap->a_vp; - printf("\tvp=%p, lowervp=%p\n", vp, NULLVPTOLOWERVP(vp)); + printf("\tvp=%p, lowervp=%p\n", vp, VTONULL(vp)->null_lowervp); return (0); } From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 23:12:57 2012 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 2EC1A106564A; Sun, 1 Jan 2012 23:12: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 1822D8FC12; Sun, 1 Jan 2012 23:12: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 q01NCulQ035953; Sun, 1 Jan 2012 23:12:56 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01NCu9B035951; Sun, 1 Jan 2012 23:12:56 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201012312.q01NCu9B035951@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 1 Jan 2012 23:12: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: r229231 - stable/8/sys/fs/nullfs 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, 01 Jan 2012 23:12:57 -0000 Author: kib Date: Sun Jan 1 23:12:56 2012 New Revision: 229231 URL: http://svn.freebsd.org/changeset/base/229231 Log: MFC r227696: Do not use NULLVPTOLOWERVP() in the null_print(). If diagnostic is compiled in, and show vnode is used from ddb on the faulty nullfs vnode, we get panic instead of vnode dump. Modified: stable/8/sys/fs/nullfs/null_vnops.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/fs/nullfs/null_vnops.c ============================================================================== --- stable/8/sys/fs/nullfs/null_vnops.c Sun Jan 1 23:12:43 2012 (r229230) +++ stable/8/sys/fs/nullfs/null_vnops.c Sun Jan 1 23:12:56 2012 (r229231) @@ -729,7 +729,7 @@ null_print(struct vop_print_args *ap) { struct vnode *vp = ap->a_vp; - printf("\tvp=%p, lowervp=%p\n", vp, NULLVPTOLOWERVP(vp)); + printf("\tvp=%p, lowervp=%p\n", vp, VTONULL(vp)->null_lowervp); return (0); } From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 23:17:09 2012 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 32351106566B; Sun, 1 Jan 2012 23:17:09 +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 1B0088FC08; Sun, 1 Jan 2012 23:17:09 +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 q01NH90O036229; Sun, 1 Jan 2012 23:17:09 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01NH8Rk036223; Sun, 1 Jan 2012 23:17:08 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201012317.q01NH8Rk036223@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 1 Jan 2012 23:17:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229232 - stable/9/sys/fs/msdosfs 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, 01 Jan 2012 23:17:09 -0000 Author: kib Date: Sun Jan 1 23:17:08 2012 New Revision: 229232 URL: http://svn.freebsd.org/changeset/base/229232 Log: MFC r227817: Put all the messages from msdosfs under the MSDOSFS_DEBUG ifdef. Modified: stable/9/sys/fs/msdosfs/msdosfs_conv.c stable/9/sys/fs/msdosfs/msdosfs_denode.c stable/9/sys/fs/msdosfs/msdosfs_fat.c stable/9/sys/fs/msdosfs/msdosfs_lookup.c stable/9/sys/fs/msdosfs/msdosfs_vfsops.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/fs/msdosfs/msdosfs_conv.c ============================================================================== --- stable/9/sys/fs/msdosfs/msdosfs_conv.c Sun Jan 1 23:12:56 2012 (r229231) +++ stable/9/sys/fs/msdosfs/msdosfs_conv.c Sun Jan 1 23:17:08 2012 (r229232) @@ -1052,8 +1052,10 @@ mbnambuf_write(struct mbnambuf *nbp, cha size_t count, newlen; if (nbp->nb_len != 0 && id != nbp->nb_last_id - 1) { +#ifdef MSDOSFS_DEBUG printf("msdosfs: non-decreasing id: id %d, last id %d\n", id, nbp->nb_last_id); +#endif return; } @@ -1062,7 +1064,9 @@ mbnambuf_write(struct mbnambuf *nbp, cha count = strlen(name); newlen = nbp->nb_len + count; if (newlen > WIN_MAXLEN || newlen > MAXNAMLEN) { +#ifdef MSDOSFS_DEBUG printf("msdosfs: file name length %zu too large\n", newlen); +#endif return; } Modified: stable/9/sys/fs/msdosfs/msdosfs_denode.c ============================================================================== --- stable/9/sys/fs/msdosfs/msdosfs_denode.c Sun Jan 1 23:12:56 2012 (r229231) +++ stable/9/sys/fs/msdosfs/msdosfs_denode.c Sun Jan 1 23:17:08 2012 (r229232) @@ -263,8 +263,10 @@ deget(pmp, dirclust, diroffset, depp) * instead of what is written in directory entry. */ if (diroffset == 0 && ldep->de_StartCluster != dirclust) { +#ifdef MSDOSFS_DEBUG printf("deget(): \".\" entry at clust %lu != %lu\n", dirclust, ldep->de_StartCluster); +#endif ldep->de_StartCluster = dirclust; } @@ -274,8 +276,11 @@ deget(pmp, dirclust, diroffset, depp) if (error == E2BIG) { ldep->de_FileSize = de_cn2off(pmp, size); error = 0; - } else + } else { +#ifdef MSDOSFS_DEBUG printf("deget(): pcbmap returned %d\n", error); +#endif + } } } else nvp->v_type = VREG; @@ -351,8 +356,10 @@ detrunc(dep, length, flags, cred, td) * directory's life. */ if ((DETOV(dep)->v_vflag & VV_ROOT) && !FAT32(pmp)) { +#ifdef MSDOSFS_DEBUG printf("detrunc(): can't truncate root directory, clust %ld, offset %ld\n", dep->de_dirclust, dep->de_diroffset); +#endif return (EINVAL); } Modified: stable/9/sys/fs/msdosfs/msdosfs_fat.c ============================================================================== --- stable/9/sys/fs/msdosfs/msdosfs_fat.c Sun Jan 1 23:12:56 2012 (r229231) +++ stable/9/sys/fs/msdosfs/msdosfs_fat.c Sun Jan 1 23:17:08 2012 (r229232) @@ -503,7 +503,9 @@ fatentry(function, pmp, cn, oldcontents, * Be sure they asked us to do something. */ if ((function & (FAT_SET | FAT_GET)) == 0) { +#ifdef MSDOSFS_DEBUG printf("fatentry(): function code doesn't specify get or set\n"); +#endif return (EINVAL); } @@ -512,7 +514,9 @@ fatentry(function, pmp, cn, oldcontents, * where to put it, give them an error. */ if ((function & FAT_GET) && oldcontents == NULL) { +#ifdef MSDOSFS_DEBUG printf("fatentry(): get function with no place to put result\n"); +#endif return (EINVAL); } #endif @@ -997,7 +1001,9 @@ extendfile(dep, count, bpp, ncp, flags) */ if (dep->de_StartCluster == MSDOSFSROOT && (dep->de_Attributes & ATTR_DIRECTORY)) { +#ifdef MSDOSFS_DEBUG printf("extendfile(): attempt to extend root directory\n"); +#endif return (ENOSPC); } Modified: stable/9/sys/fs/msdosfs/msdosfs_lookup.c ============================================================================== --- stable/9/sys/fs/msdosfs/msdosfs_lookup.c Sun Jan 1 23:12:56 2012 (r229231) +++ stable/9/sys/fs/msdosfs/msdosfs_lookup.c Sun Jan 1 23:17:08 2012 (r229232) @@ -902,8 +902,10 @@ doscheckpath(source, target) out:; if (bp) brelse(bp); +#ifdef MSDOSFS_DEBUG if (error == ENOTDIR) printf("doscheckpath(): .. not a directory?\n"); +#endif if (dep != NULL) vput(DETOV(dep)); return (error); Modified: stable/9/sys/fs/msdosfs/msdosfs_vfsops.c ============================================================================== --- stable/9/sys/fs/msdosfs/msdosfs_vfsops.c Sun Jan 1 23:12:56 2012 (r229231) +++ stable/9/sys/fs/msdosfs/msdosfs_vfsops.c Sun Jan 1 23:17:08 2012 (r229232) @@ -555,7 +555,9 @@ mountmsdosfs(struct vnode *devvp, struct || pmp->pm_FATsecs || getushort(b710->bpbFSVers)) { error = EINVAL; +#ifdef MSDOSFS_DEBUG printf("mountmsdosfs(): bad FAT32 filesystem\n"); +#endif goto error_exit; } pmp->pm_fatmask = FAT32_MASK; @@ -633,8 +635,10 @@ mountmsdosfs(struct vnode *devvp, struct clusters = (pmp->pm_fatsize / pmp->pm_fatmult) * pmp->pm_fatdiv; if (pmp->pm_maxcluster >= clusters) { +#ifdef MSDOSFS_DEBUG printf("Warning: number of clusters (%ld) exceeds FAT " "capacity (%ld)\n", pmp->pm_maxcluster + 1, clusters); +#endif pmp->pm_maxcluster = clusters - 1; } From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 23:17:22 2012 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 6F3831065677; Sun, 1 Jan 2012 23:17: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 57DC18FC0C; Sun, 1 Jan 2012 23:17: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 q01NHMMv036281; Sun, 1 Jan 2012 23:17:22 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01NHM0B036275; Sun, 1 Jan 2012 23:17:22 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201012317.q01NHM0B036275@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 1 Jan 2012 23:17: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: r229233 - stable/8/sys/fs/msdosfs 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, 01 Jan 2012 23:17:22 -0000 Author: kib Date: Sun Jan 1 23:17:21 2012 New Revision: 229233 URL: http://svn.freebsd.org/changeset/base/229233 Log: MFC r227817: Put all the messages from msdosfs under the MSDOSFS_DEBUG ifdef. Modified: stable/8/sys/fs/msdosfs/msdosfs_conv.c stable/8/sys/fs/msdosfs/msdosfs_denode.c stable/8/sys/fs/msdosfs/msdosfs_fat.c stable/8/sys/fs/msdosfs/msdosfs_lookup.c stable/8/sys/fs/msdosfs/msdosfs_vfsops.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/fs/msdosfs/msdosfs_conv.c ============================================================================== --- stable/8/sys/fs/msdosfs/msdosfs_conv.c Sun Jan 1 23:17:08 2012 (r229232) +++ stable/8/sys/fs/msdosfs/msdosfs_conv.c Sun Jan 1 23:17:21 2012 (r229233) @@ -1052,8 +1052,10 @@ mbnambuf_write(struct mbnambuf *nbp, cha size_t count, newlen; if (nbp->nb_len != 0 && id != nbp->nb_last_id - 1) { +#ifdef MSDOSFS_DEBUG printf("msdosfs: non-decreasing id: id %d, last id %d\n", id, nbp->nb_last_id); +#endif return; } @@ -1062,7 +1064,9 @@ mbnambuf_write(struct mbnambuf *nbp, cha count = strlen(name); newlen = nbp->nb_len + count; if (newlen > WIN_MAXLEN || newlen > MAXNAMLEN) { +#ifdef MSDOSFS_DEBUG printf("msdosfs: file name length %zu too large\n", newlen); +#endif return; } Modified: stable/8/sys/fs/msdosfs/msdosfs_denode.c ============================================================================== --- stable/8/sys/fs/msdosfs/msdosfs_denode.c Sun Jan 1 23:17:08 2012 (r229232) +++ stable/8/sys/fs/msdosfs/msdosfs_denode.c Sun Jan 1 23:17:21 2012 (r229233) @@ -263,8 +263,10 @@ deget(pmp, dirclust, diroffset, depp) * instead of what is written in directory entry. */ if (diroffset == 0 && ldep->de_StartCluster != dirclust) { +#ifdef MSDOSFS_DEBUG printf("deget(): \".\" entry at clust %lu != %lu\n", dirclust, ldep->de_StartCluster); +#endif ldep->de_StartCluster = dirclust; } @@ -274,8 +276,11 @@ deget(pmp, dirclust, diroffset, depp) if (error == E2BIG) { ldep->de_FileSize = de_cn2off(pmp, size); error = 0; - } else + } else { +#ifdef MSDOSFS_DEBUG printf("deget(): pcbmap returned %d\n", error); +#endif + } } } else nvp->v_type = VREG; @@ -351,8 +356,10 @@ detrunc(dep, length, flags, cred, td) * directory's life. */ if ((DETOV(dep)->v_vflag & VV_ROOT) && !FAT32(pmp)) { +#ifdef MSDOSFS_DEBUG printf("detrunc(): can't truncate root directory, clust %ld, offset %ld\n", dep->de_dirclust, dep->de_diroffset); +#endif return (EINVAL); } Modified: stable/8/sys/fs/msdosfs/msdosfs_fat.c ============================================================================== --- stable/8/sys/fs/msdosfs/msdosfs_fat.c Sun Jan 1 23:17:08 2012 (r229232) +++ stable/8/sys/fs/msdosfs/msdosfs_fat.c Sun Jan 1 23:17:21 2012 (r229233) @@ -503,7 +503,9 @@ fatentry(function, pmp, cn, oldcontents, * Be sure they asked us to do something. */ if ((function & (FAT_SET | FAT_GET)) == 0) { +#ifdef MSDOSFS_DEBUG printf("fatentry(): function code doesn't specify get or set\n"); +#endif return (EINVAL); } @@ -512,7 +514,9 @@ fatentry(function, pmp, cn, oldcontents, * where to put it, give them an error. */ if ((function & FAT_GET) && oldcontents == NULL) { +#ifdef MSDOSFS_DEBUG printf("fatentry(): get function with no place to put result\n"); +#endif return (EINVAL); } #endif @@ -997,7 +1001,9 @@ extendfile(dep, count, bpp, ncp, flags) */ if (dep->de_StartCluster == MSDOSFSROOT && (dep->de_Attributes & ATTR_DIRECTORY)) { +#ifdef MSDOSFS_DEBUG printf("extendfile(): attempt to extend root directory\n"); +#endif return (ENOSPC); } Modified: stable/8/sys/fs/msdosfs/msdosfs_lookup.c ============================================================================== --- stable/8/sys/fs/msdosfs/msdosfs_lookup.c Sun Jan 1 23:17:08 2012 (r229232) +++ stable/8/sys/fs/msdosfs/msdosfs_lookup.c Sun Jan 1 23:17:21 2012 (r229233) @@ -902,8 +902,10 @@ doscheckpath(source, target) out:; if (bp) brelse(bp); +#ifdef MSDOSFS_DEBUG if (error == ENOTDIR) printf("doscheckpath(): .. not a directory?\n"); +#endif if (dep != NULL) vput(DETOV(dep)); return (error); Modified: stable/8/sys/fs/msdosfs/msdosfs_vfsops.c ============================================================================== --- stable/8/sys/fs/msdosfs/msdosfs_vfsops.c Sun Jan 1 23:17:08 2012 (r229232) +++ stable/8/sys/fs/msdosfs/msdosfs_vfsops.c Sun Jan 1 23:17:21 2012 (r229233) @@ -555,7 +555,9 @@ mountmsdosfs(struct vnode *devvp, struct || pmp->pm_FATsecs || getushort(b710->bpbFSVers)) { error = EINVAL; +#ifdef MSDOSFS_DEBUG printf("mountmsdosfs(): bad FAT32 filesystem\n"); +#endif goto error_exit; } pmp->pm_fatmask = FAT32_MASK; @@ -633,8 +635,10 @@ mountmsdosfs(struct vnode *devvp, struct clusters = (pmp->pm_fatsize / pmp->pm_fatmult) * pmp->pm_fatdiv; if (pmp->pm_maxcluster >= clusters) { +#ifdef MSDOSFS_DEBUG printf("Warning: number of clusters (%ld) exceeds FAT " "capacity (%ld)\n", pmp->pm_maxcluster + 1, clusters); +#endif pmp->pm_maxcluster = clusters - 1; } From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 23:18:35 2012 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 618581065676; Sun, 1 Jan 2012 23:18:35 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4BB878FC1D; Sun, 1 Jan 2012 23:18: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 q01NIZG6036360; Sun, 1 Jan 2012 23:18:35 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01NIZ1r036358; Sun, 1 Jan 2012 23:18:35 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201012318.q01NIZ1r036358@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 23:18:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229234 - stable/9/usr.sbin/pkg_install/updating 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, 01 Jan 2012 23:18:35 -0000 Author: dim Date: Sun Jan 1 23:18:34 2012 New Revision: 229234 URL: http://svn.freebsd.org/changeset/base/229234 Log: MFC r228670: In usr.sbin/pkg_install/updating/main.c, use the size of the destination buffer as size argument to strlcpy(), not the length of the source. Modified: stable/9/usr.sbin/pkg_install/updating/main.c Directory Properties: stable/9/usr.sbin/pkg_install/updating/ (props changed) Modified: stable/9/usr.sbin/pkg_install/updating/main.c ============================================================================== --- stable/9/usr.sbin/pkg_install/updating/main.c Sun Jan 1 23:17:21 2012 (r229233) +++ stable/9/usr.sbin/pkg_install/updating/main.c Sun Jan 1 23:18:34 2012 (r229234) @@ -141,7 +141,7 @@ main(int argc, char *argv[]) strcmp(pkgdbdir->d_name, "..") != 0) { /* Create path to +CONTENTS file for each installed port */ - n = strlcpy(tmp_file, pkgdbpath, strlen(pkgdbpath)+1); + n = strlcpy(tmp_file, pkgdbpath, sizeof(tmp_file)); n = strlcpy(tmp_file + n, "/", sizeof(tmp_file) - n); n = strlcat(tmp_file + n, pkgdbdir->d_name, sizeof(tmp_file) - n); @@ -181,7 +181,7 @@ main(int argc, char *argv[]) (void)exit(EXIT_FAILURE); if (pname[strlen(pname) - 1] == '\n') pname[strlen(pname) - 1] = '\0'; - strlcpy (curr->name, pname, strlen(pname)+1); + strlcpy (curr->name, pname, sizeof(curr->name)); curr->next = head; head = curr; } From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 23:20:37 2012 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 1024A1065673; Sun, 1 Jan 2012 23:20:37 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EEB6A8FC0A; Sun, 1 Jan 2012 23:20:36 +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 q01NKaOs036493; Sun, 1 Jan 2012 23:20:36 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01NKa4p036491; Sun, 1 Jan 2012 23:20:36 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201012320.q01NKa4p036491@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 23:20:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229235 - stable/9/usr.sbin/pmccontrol 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, 01 Jan 2012 23:20:37 -0000 Author: dim Date: Sun Jan 1 23:20:36 2012 New Revision: 229235 URL: http://svn.freebsd.org/changeset/base/229235 Log: MFC r228671: In usr.sbin/pmccontrol/pmccontrol.c, fix a few warnings about format strings not being literals. Modified: stable/9/usr.sbin/pmccontrol/pmccontrol.c Directory Properties: stable/9/usr.sbin/pmccontrol/ (props changed) Modified: stable/9/usr.sbin/pmccontrol/pmccontrol.c ============================================================================== --- stable/9/usr.sbin/pmccontrol/pmccontrol.c Sun Jan 1 23:18:34 2012 (r229234) +++ stable/9/usr.sbin/pmccontrol/pmccontrol.c Sun Jan 1 23:20:36 2012 (r229235) @@ -450,7 +450,7 @@ main(int argc, char **argv) case '?': warnx("Unrecognized option \"-%c\"", optopt); - errx(EX_USAGE, usage_message); + errx(EX_USAGE, "%s", usage_message); break; default: @@ -460,7 +460,7 @@ main(int argc, char **argv) } if (command == PMCC_PRINT_USAGE) - (void) errx(EX_USAGE, usage_message); + (void) errx(EX_USAGE, "%s", usage_message); if (error) exit(EX_USAGE); From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 23:26:50 2012 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 19240106566B; Sun, 1 Jan 2012 23:26:50 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0334F8FC1C; Sun, 1 Jan 2012 23:26:50 +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 q01NQn0L036726; Sun, 1 Jan 2012 23:26:49 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01NQnSo036724; Sun, 1 Jan 2012 23:26:49 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201012326.q01NQnSo036724@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 23:26:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229236 - stable/9/contrib/pnpinfo 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, 01 Jan 2012 23:26:50 -0000 Author: dim Date: Sun Jan 1 23:26:49 2012 New Revision: 229236 URL: http://svn.freebsd.org/changeset/base/229236 Log: MFC r228672: In contrib/pnpinfo/pnpinfo.c, remove an extraneous parameter from the call to isolation_protocol(). Modified: stable/9/contrib/pnpinfo/pnpinfo.c Directory Properties: stable/9/contrib/pnpinfo/ (props changed) Modified: stable/9/contrib/pnpinfo/pnpinfo.c ============================================================================== --- stable/9/contrib/pnpinfo/pnpinfo.c Sun Jan 1 23:20:36 2012 (r229235) +++ stable/9/contrib/pnpinfo/pnpinfo.c Sun Jan 1 23:26:49 2012 (r229236) @@ -599,7 +599,7 @@ main(int argc, char **argv) /* Try various READ_DATA ports from 0x203-0x3ff */ for (rd_port = 0x80; (rd_port < 0xff); rd_port += 0x10) { DEB(printf("Trying Read_Port at %x...\n", (rd_port << 2) | 0x3) ); - num_pnp_devs = isolation_protocol(rd_port); + num_pnp_devs = isolation_protocol(); if (num_pnp_devs) break; } From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 23:33:09 2012 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 5FEC6106564A; Sun, 1 Jan 2012 23:33:09 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4A53E8FC12; Sun, 1 Jan 2012 23:33:09 +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 q01NX9QF036968; Sun, 1 Jan 2012 23:33:09 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01NX91M036966; Sun, 1 Jan 2012 23:33:09 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201012333.q01NX91M036966@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 23:33:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229237 - stable/9/usr.sbin/pw 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, 01 Jan 2012 23:33:09 -0000 Author: dim Date: Sun Jan 1 23:33:08 2012 New Revision: 229237 URL: http://svn.freebsd.org/changeset/base/229237 Log: MFC r228673: In usr.sbin/pw/pw_user.c, use the correct printf length modifier for a ptrdiff_t. Modified: stable/9/usr.sbin/pw/pw_user.c Directory Properties: stable/9/usr.sbin/pw/ (props changed) Modified: stable/9/usr.sbin/pw/pw_user.c ============================================================================== --- stable/9/usr.sbin/pw/pw_user.c Sun Jan 1 23:26:49 2012 (r229236) +++ stable/9/usr.sbin/pw/pw_user.c Sun Jan 1 23:33:08 2012 (r229237) @@ -1208,7 +1208,7 @@ pw_checkname(u_char *name, int gecos) if (reject) { snprintf(showch, sizeof(showch), (*ch >= ' ' && *ch < 127) ? "`%c'" : "0x%02x", *ch); - errx(EX_DATAERR, "invalid character %s at position %d in %s", + errx(EX_DATAERR, "invalid character %s at position %td in %s", showch, (ch - name), showtype); } if (!gecos && (ch - name) > LOGNAMESIZE) From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 23:34:06 2012 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 BE149106566C; Sun, 1 Jan 2012 23:34:06 +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 A3E7A8FC08; Sun, 1 Jan 2012 23:34: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 q01NY6Vu037048; Sun, 1 Jan 2012 23:34:06 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01NY6Pr037046; Sun, 1 Jan 2012 23:34:06 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201012334.q01NY6Pr037046@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 1 Jan 2012 23:34:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229238 - stable/9/sys/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: Sun, 01 Jan 2012 23:34:06 -0000 Author: kib Date: Sun Jan 1 23:34:06 2012 New Revision: 229238 URL: http://svn.freebsd.org/changeset/base/229238 Log: MFC r227656: Use the alternate form of the gcc extension that works even with -ansi -pedantic without issuing a warning, and which is recommended by gcc manual. Modified: stable/9/sys/sys/param.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/sys/param.h ============================================================================== --- stable/9/sys/sys/param.h Sun Jan 1 23:33:08 2012 (r229237) +++ stable/9/sys/sys/param.h Sun Jan 1 23:34:06 2012 (r229238) @@ -324,6 +324,6 @@ __END_DECLS * Access a variable length array that has been declared as a fixed * length array. */ -#define __PAST_END(array, offset) (((typeof(*(array)) *)(array))[offset]) +#define __PAST_END(array, offset) (((__typeof__(*(array)) *)(array))[offset]) #endif /* _SYS_PARAM_H_ */ From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 23:35:00 2012 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 1E1931065676; Sun, 1 Jan 2012 23:35:00 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0843F8FC1B; Sun, 1 Jan 2012 23:35: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 q01NYxtc037118; Sun, 1 Jan 2012 23:34:59 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01NYxwB037116; Sun, 1 Jan 2012 23:34:59 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201012334.q01NYxwB037116@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 23:34:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229239 - stable/9/usr.sbin/route6d 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, 01 Jan 2012 23:35:00 -0000 Author: dim Date: Sun Jan 1 23:34:59 2012 New Revision: 229239 URL: http://svn.freebsd.org/changeset/base/229239 Log: MFC r228674: In usr.sbin/route6d/route6d.c, use the correct printf length modifier for an ssize_t. Modified: stable/9/usr.sbin/route6d/route6d.c Directory Properties: stable/9/usr.sbin/route6d/ (props changed) Modified: stable/9/usr.sbin/route6d/route6d.c ============================================================================== --- stable/9/usr.sbin/route6d/route6d.c Sun Jan 1 23:34:06 2012 (r229238) +++ stable/9/usr.sbin/route6d/route6d.c Sun Jan 1 23:34:59 2012 (r229239) @@ -1238,7 +1238,7 @@ riprecv() if (iff_find(ifcp, 'N') != NULL) return; - tracet(1, "Recv(%s): from %s.%d info(%d)\n", + tracet(1, "Recv(%s): from %s.%d info(%zd)\n", ifcp->ifc_name, inet6_n2p(&nh), ntohs(fsock.sin6_port), nn); t = time(NULL); From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 23:36:13 2012 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 B2FC21065670; Sun, 1 Jan 2012 23:36:13 +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 929728FC15; Sun, 1 Jan 2012 23:36: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 q01NaDch037203; Sun, 1 Jan 2012 23:36:13 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01NaDWR037202; Sun, 1 Jan 2012 23:36:13 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201012336.q01NaDWR037202@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 1 Jan 2012 23:36:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229240 - stable/9/tools/regression/pipe 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, 01 Jan 2012 23:36:13 -0000 Author: kib Date: Sun Jan 1 23:36:13 2012 New Revision: 229240 URL: http://svn.freebsd.org/changeset/base/229240 Log: MFC r228177: Add a simple test for pipe inode numbers reported by fstat(2). Added: stable/9/tools/regression/pipe/pipe-ino.c - copied unchanged from r228177, head/tools/regression/pipe/pipe-ino.c Modified: Directory Properties: stable/9/tools/ (props changed) Copied: stable/9/tools/regression/pipe/pipe-ino.c (from r228177, head/tools/regression/pipe/pipe-ino.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/tools/regression/pipe/pipe-ino.c Sun Jan 1 23:36:13 2012 (r229240, copy of r228177, head/tools/regression/pipe/pipe-ino.c) @@ -0,0 +1,66 @@ +/*- + * Copyright (c) 2011 Giovanni Trematerra + * 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 THE AUTHOR AND CONTRIBUTORS ``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 THE AUTHOR 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. + */ + +/* + * $FreeBSD$ + * Test conformance to stat(2) SUSv4 description: + * "For all other file types defined in this volume of POSIX.1-2008, the + * structure members st_mode, st_ino, st_dev, st_uid, st_gid, st_atim, + * st_ctim, and st_mtim shall have meaningful values ...". + * Check that st_dev and st_ino are meaningful. + */ + +#include +#include +#include +#include +#include + +int +main(int argc, char **argv) +{ + int pipefd[2]; + struct stat st1, st2; + + if (pipe(pipefd) == -1) + err(1, "FAIL: pipe"); + + if (fstat(pipefd[0], &st1) == -1) + err(1, "FAIL: fstat st1"); + if (fstat(pipefd[1], &st2) == -1) + err(1, "FAIL: fstat st2"); + if (st1.st_dev != st2.st_dev || st1.st_dev == 0 || st2.st_dev == 0) { + errx(1, "FAIL: wrong dev number %d %d", + st1.st_dev, st2.st_dev); + } + if (st1.st_ino == st2.st_ino) + errx(1, "FAIL: inode numbers are equal: %d", st1.st_ino); + close(pipefd[0]); + close(pipefd[1]); + printf("PASS\n"); + + return (0); +} From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 23:39:56 2012 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 D98EB1065670; Sun, 1 Jan 2012 23:39:56 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C3ADC8FC14; Sun, 1 Jan 2012 23:39: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 q01NduMj037410; Sun, 1 Jan 2012 23:39:56 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01NduaQ037408; Sun, 1 Jan 2012 23:39:56 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201012339.q01NduaQ037408@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 23:39:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229241 - stable/9/usr.sbin/rpc.ypupdated 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, 01 Jan 2012 23:39:57 -0000 Author: dim Date: Sun Jan 1 23:39:56 2012 New Revision: 229241 URL: http://svn.freebsd.org/changeset/base/229241 Log: MFC r228678: In usr.sbin/rpc.ypupdated/yp_dbupdate.c, use the appropriate printf length modifier for time_t (after casting it to intmax_t). MFC r228679: In usr.sbin/rpc.ypupdated/yp_dbupdate.c, include stdint.h, so intmax_t is known, otherwise it won't build. Pointy hat to: dim MFC r228680: In usr.sbin/rpc.ypupdated/yp_dbupdate.c, since intmax_t is signed, just like time_t, better use %jd instead of %ju. Strangely enough, neither gcc, clang nor gcc 4.6 warn about this discrepancy... Modified: stable/9/usr.sbin/rpc.ypupdated/yp_dbupdate.c Directory Properties: stable/9/usr.sbin/rpc.ypupdated/ (props changed) Modified: stable/9/usr.sbin/rpc.ypupdated/yp_dbupdate.c ============================================================================== --- stable/9/usr.sbin/rpc.ypupdated/yp_dbupdate.c Sun Jan 1 23:36:13 2012 (r229240) +++ stable/9/usr.sbin/rpc.ypupdated/yp_dbupdate.c Sun Jan 1 23:39:56 2012 (r229241) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -130,7 +131,7 @@ ypmap_update(char *netname, char *map, u return(rval); } - snprintf(yplastbuf, sizeof(yplastbuf), "%lu", time(NULL)); + snprintf(yplastbuf, sizeof(yplastbuf), "%jd", (intmax_t)time(NULL)); key.data = yp_last; key.size = strlen(yp_last); data.data = (char *)&yplastbuf; From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 23:41:32 2012 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 60C2C106567A; Sun, 1 Jan 2012 23:41:32 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4B0C28FC08; Sun, 1 Jan 2012 23:41: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 q01NfWmD037505; Sun, 1 Jan 2012 23:41:32 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01NfW7A037503; Sun, 1 Jan 2012 23:41:32 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201012341.q01NfW7A037503@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 23:41:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229242 - stable/9/usr.sbin/sa 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, 01 Jan 2012 23:41:32 -0000 Author: dim Date: Sun Jan 1 23:41:31 2012 New Revision: 229242 URL: http://svn.freebsd.org/changeset/base/229242 Log: MFC r228681: In usr.sbin/sa/db.c, avoid warnings about assigning two const char arrays to non-const void pointers, by casting away const explicitly. Modified: stable/9/usr.sbin/sa/db.c Directory Properties: stable/9/usr.sbin/sa/ (props changed) Modified: stable/9/usr.sbin/sa/db.c ============================================================================== --- stable/9/usr.sbin/sa/db.c Sun Jan 1 23:39:56 2012 (r229241) +++ stable/9/usr.sbin/sa/db.c Sun Jan 1 23:41:31 2012 (r229242) @@ -79,7 +79,7 @@ db_copy_in(DB **mdb, const char *dbname, /* Obtain/set version. */ version = 1; - key.data = &VERSION_KEY; + key.data = (void*)&VERSION_KEY; key.size = sizeof(VERSION_KEY); rv = DB_GET(ddb, &key, &data, 0); @@ -175,7 +175,7 @@ db_copy_out(DB *mdb, const char *dbname, out: /* Add a version record. */ - key.data = &VERSION_KEY; + key.data = (void*)&VERSION_KEY; key.size = sizeof(VERSION_KEY); version = 2; data.data = &version; From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 23:43:45 2012 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 C11C71065688; Sun, 1 Jan 2012 23:43:45 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AAB998FC18; Sun, 1 Jan 2012 23:43: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 q01Nhjwf037627; Sun, 1 Jan 2012 23:43:45 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01Nhjqv037624; Sun, 1 Jan 2012 23:43:45 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201012343.q01Nhjqv037624@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 23:43:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229243 - stable/9/usr.sbin/sade 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, 01 Jan 2012 23:43:45 -0000 Author: dim Date: Sun Jan 1 23:43:45 2012 New Revision: 229243 URL: http://svn.freebsd.org/changeset/base/229243 Log: MFC r228682: In usr.sbin/sade/install.c and usr.sbin/sade/label.c, fix a few warnings about format strings not being literals. MFC r228683: Forgot to add usr.sbin/sade/label.c in the previous commit. Modified: stable/9/usr.sbin/sade/install.c stable/9/usr.sbin/sade/label.c Directory Properties: stable/9/usr.sbin/sade/ (props changed) Modified: stable/9/usr.sbin/sade/install.c ============================================================================== --- stable/9/usr.sbin/sade/install.c Sun Jan 1 23:41:31 2012 (r229242) +++ stable/9/usr.sbin/sade/install.c Sun Jan 1 23:43:45 2012 (r229243) @@ -103,10 +103,10 @@ performNewfs(PartInfo *pi, char *dname, } if (queue == QUEUE_YES) { - command_shell_add(pi->mountpoint, buffer); + command_shell_add(pi->mountpoint, "%s", buffer); return (0); } else - return (vsystem(buffer)); + return (vsystem("%s", buffer)); } return (0); } Modified: stable/9/usr.sbin/sade/label.c ============================================================================== --- stable/9/usr.sbin/sade/label.c Sun Jan 1 23:41:31 2012 (r229242) +++ stable/9/usr.sbin/sade/label.c Sun Jan 1 23:43:45 2012 (r229243) @@ -977,7 +977,7 @@ diskLabel(Device *dev) } if (msg) { if (req) { - msgConfirm(msg); + msgConfirm("%s", msg); clear_wins(); msg = NULL; } From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 23:45:21 2012 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 C9CC0106566C; Sun, 1 Jan 2012 23:45:21 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B43A38FC0C; Sun, 1 Jan 2012 23:45: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 q01NjL0G037740; Sun, 1 Jan 2012 23:45:21 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01NjLP0037737; Sun, 1 Jan 2012 23:45:21 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201012345.q01NjLP0037737@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 23:45:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229244 - stable/9/contrib/tcpdump 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, 01 Jan 2012 23:45:21 -0000 Author: dim Date: Sun Jan 1 23:45:21 2012 New Revision: 229244 URL: http://svn.freebsd.org/changeset/base/229244 Log: MFC r228713: In contrib/tcpdump/print-icmp6.c, fix a problem where the comparison against icmp6_hdr::icmp6_type is done incorrectly. (This fix has already been applied upstream, but we do not have the latest version of tcpdump.) Modified: stable/9/contrib/tcpdump/print-icmp6.c Directory Properties: stable/9/contrib/tcpdump/ (props changed) Modified: stable/9/contrib/tcpdump/print-icmp6.c ============================================================================== --- stable/9/contrib/tcpdump/print-icmp6.c Sun Jan 1 23:43:45 2012 (r229243) +++ stable/9/contrib/tcpdump/print-icmp6.c Sun Jan 1 23:45:21 2012 (r229244) @@ -350,14 +350,13 @@ icmp6_print(netdissect_options *ndo, printf("ICMP6, %s", tok2str(icmp6_type_values,"unknown icmp6 type (%u)",dp->icmp6_type)); /* display cosmetics: print the packet length for printer that use the vflag now */ - if (vflag && (dp->icmp6_type == - ND_ROUTER_SOLICIT || - ND_ROUTER_ADVERT || - ND_NEIGHBOR_ADVERT || - ND_NEIGHBOR_SOLICIT || - ND_REDIRECT || - ICMP6_HADISCOV_REPLY || - ICMP6_MOBILEPREFIX_ADVERT )) + if (vflag && (dp->icmp6_type == ND_ROUTER_SOLICIT || + dp->icmp6_type == ND_ROUTER_ADVERT || + dp->icmp6_type == ND_NEIGHBOR_ADVERT || + dp->icmp6_type == ND_NEIGHBOR_SOLICIT || + dp->icmp6_type == ND_REDIRECT || + dp->icmp6_type == ICMP6_HADISCOV_REPLY || + dp->icmp6_type == ICMP6_MOBILEPREFIX_ADVERT )) printf(", length %u", length); switch (dp->icmp6_type) { From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 23:46:08 2012 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 91682106564A; Sun, 1 Jan 2012 23:46:08 +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 7C7F38FC16; Sun, 1 Jan 2012 23:46:08 +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 q01Nk8XA037823; Sun, 1 Jan 2012 23:46:08 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01Nk8Fx037821; Sun, 1 Jan 2012 23:46:08 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201012346.q01Nk8Fx037821@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 1 Jan 2012 23:46:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229245 - stable/9/sys/fs/fifofs 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, 01 Jan 2012 23:46:08 -0000 Author: kib Date: Sun Jan 1 23:46:08 2012 New Revision: 229245 URL: http://svn.freebsd.org/changeset/base/229245 Log: MFC r228263: Initialize fifoinfo fi_wgen field on open. Modified: stable/9/sys/fs/fifofs/fifo_vnops.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/fs/fifofs/fifo_vnops.c ============================================================================== --- stable/9/sys/fs/fifofs/fifo_vnops.c Sun Jan 1 23:45:21 2012 (r229244) +++ stable/9/sys/fs/fifofs/fifo_vnops.c Sun Jan 1 23:46:08 2012 (r229245) @@ -218,7 +218,7 @@ fail1: free(fip, M_VNODE); return (error); } - fip->fi_readers = fip->fi_writers = 0; + fip->fi_wgen = fip->fi_readers = fip->fi_writers = 0; wso->so_snd.sb_lowat = PIPE_BUF; SOCKBUF_LOCK(&rso->so_rcv); rso->so_rcv.sb_state |= SBS_CANTRCVMORE; From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 23:46:34 2012 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 B5A6D106566C; Sun, 1 Jan 2012 23:46: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 A019F8FC22; Sun, 1 Jan 2012 23:46: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 q01NkYTC037884; Sun, 1 Jan 2012 23:46:34 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01NkY35037882; Sun, 1 Jan 2012 23:46:34 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201012346.q01NkY35037882@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 1 Jan 2012 23:46: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: r229246 - stable/8/sys/fs/fifofs 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, 01 Jan 2012 23:46:34 -0000 Author: kib Date: Sun Jan 1 23:46:34 2012 New Revision: 229246 URL: http://svn.freebsd.org/changeset/base/229246 Log: MFC r228263: Initialize fifoinfo fi_wgen field on open. Modified: stable/8/sys/fs/fifofs/fifo_vnops.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/fs/fifofs/fifo_vnops.c ============================================================================== --- stable/8/sys/fs/fifofs/fifo_vnops.c Sun Jan 1 23:46:08 2012 (r229245) +++ stable/8/sys/fs/fifofs/fifo_vnops.c Sun Jan 1 23:46:34 2012 (r229246) @@ -207,7 +207,7 @@ fail1: free(fip, M_VNODE); return (error); } - fip->fi_readers = fip->fi_writers = 0; + fip->fi_wgen = fip->fi_readers = fip->fi_writers = 0; wso->so_snd.sb_lowat = PIPE_BUF; SOCKBUF_LOCK(&rso->so_rcv); rso->so_rcv.sb_state |= SBS_CANTRCVMORE; From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 23:49:12 2012 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 05DA0106566B; Sun, 1 Jan 2012 23:49:12 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E31F68FC0A; Sun, 1 Jan 2012 23:49: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 q01NnB6i038032; Sun, 1 Jan 2012 23:49:11 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01NnBjT038026; Sun, 1 Jan 2012 23:49:11 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201012349.q01NnBjT038026@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 23:49:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229247 - in stable/9/usr.sbin/timed: timed timedc 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, 01 Jan 2012 23:49:12 -0000 Author: dim Date: Sun Jan 1 23:49:11 2012 New Revision: 229247 URL: http://svn.freebsd.org/changeset/base/229247 Log: MFC r228714: In usr.sbin/timed, fix several issues with printf formats: - Cast time_t's to long, and print them with %ld. - Print ptrdiff_t's with %td. - Print ssize_t's and size_t's with %zd and %zu. - Print int32_t's with %d. Also, replace some int variables with the more appropriate size_t. MFC r228719: Some people pointed out long is 32-bit on some arches, while time_t is 64-bit, so better cast time_t to intmax_t, and use the appropriate printf format strings. MFC r228720: Fix r228719; when you use intmax_t, you need stdint.h. Pointy hat to: dim Modified: stable/9/usr.sbin/timed/timed/correct.c stable/9/usr.sbin/timed/timed/globals.h stable/9/usr.sbin/timed/timed/networkdelta.c stable/9/usr.sbin/timed/timed/readmsg.c stable/9/usr.sbin/timed/timedc/cmds.c Directory Properties: stable/9/usr.sbin/timed/ (props changed) Modified: stable/9/usr.sbin/timed/timed/correct.c ============================================================================== --- stable/9/usr.sbin/timed/timed/correct.c Sun Jan 1 23:46:34 2012 (r229246) +++ stable/9/usr.sbin/timed/timed/correct.c Sun Jan 1 23:49:11 2012 (r229247) @@ -162,8 +162,8 @@ adjclock(corr) } } else { syslog(LOG_WARNING, - "clock correction %ld sec too large to adjust", - adj.tv_sec); + "clock correction %jd sec too large to adjust", + (intmax_t)adj.tv_sec); (void) gettimeofday(&now, 0); timevaladd(&now, corr); if (settimeofday(&now, 0) < 0) Modified: stable/9/usr.sbin/timed/timed/globals.h ============================================================================== --- stable/9/usr.sbin/timed/timed/globals.h Sun Jan 1 23:46:34 2012 (r229246) +++ stable/9/usr.sbin/timed/timed/globals.h Sun Jan 1 23:49:11 2012 (r229247) @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include Modified: stable/9/usr.sbin/timed/timed/networkdelta.c ============================================================================== --- stable/9/usr.sbin/timed/timed/networkdelta.c Sun Jan 1 23:46:34 2012 (r229246) +++ stable/9/usr.sbin/timed/timed/networkdelta.c Sun Jan 1 23:49:11 2012 (r229247) @@ -137,7 +137,7 @@ networkdelta() } if (trace) - fprintf(fd, "median of %d values starting at %ld is ", + fprintf(fd, "median of %td values starting at %ld is ", xp-&x[0], med); return median(med, &eps, &x[0], xp, 1); } Modified: stable/9/usr.sbin/timed/timed/readmsg.c ============================================================================== --- stable/9/usr.sbin/timed/timed/readmsg.c Sun Jan 1 23:46:34 2012 (r229246) +++ stable/9/usr.sbin/timed/timed/readmsg.c Sun Jan 1 23:49:11 2012 (r229247) @@ -182,8 +182,8 @@ again: rwait.tv_usec = 1000000/CLK_TCK; if (trace) { - fprintf(fd, "readmsg: wait %ld.%6ld at %s\n", - rwait.tv_sec, rwait.tv_usec, date()); + fprintf(fd, "readmsg: wait %jd.%6ld at %s\n", + (intmax_t)rwait.tv_sec, rwait.tv_usec, date()); /* Notice a full disk, as we flush trace info. * It is better to flush periodically than at * every line because the tracing consists of bursts @@ -215,7 +215,7 @@ again: */ if (n < (ssize_t)(sizeof(struct tsp) - MAXHOSTNAMELEN + 32)) { syslog(LOG_NOTICE, - "short packet (%u/%u bytes) from %s", + "short packet (%zd/%zu bytes) from %s", n, sizeof(struct tsp) - MAXHOSTNAMELEN + 32, inet_ntoa(from.sin_addr)); continue; @@ -487,7 +487,7 @@ print(msg, addr) break; case TSP_ADJTIME: - fprintf(fd, "%s %d %-6u (%ld,%ld) %-15s %s\n", + fprintf(fd, "%s %d %-6u (%d,%d) %-15s %s\n", tsptype[msg->tsp_type], msg->tsp_vers, msg->tsp_seq, Modified: stable/9/usr.sbin/timed/timedc/cmds.c ============================================================================== --- stable/9/usr.sbin/timed/timedc/cmds.c Sun Jan 1 23:46:34 2012 (r229246) +++ stable/9/usr.sbin/timed/timedc/cmds.c Sun Jan 1 23:49:11 2012 (r229247) @@ -267,7 +267,7 @@ msite(argc, argv) int argc; char *argv[]; { - int cc; + ssize_t cc; fd_set ready; struct sockaddr_in dest; int i, length; @@ -333,7 +333,7 @@ msite(argc, argv) */ if (cc < (sizeof(struct tsp) - MAXHOSTNAMELEN + 32)) { fprintf(stderr, - "short packet (%u/%u bytes) from %s\n", + "short packet (%zd/%zu bytes) from %s\n", cc, sizeof(struct tsp) - MAXHOSTNAMELEN + 32, inet_ntoa(from.sin_addr)); continue; @@ -428,7 +428,7 @@ tracing(argc, argv) { int onflag; int length; - int cc; + ssize_t cc; fd_set ready; struct sockaddr_in dest; struct sockaddr_in from; @@ -489,7 +489,7 @@ tracing(argc, argv) * least long enough to hold a 4.3BSD packet. */ if (cc < (sizeof(struct tsp) - MAXHOSTNAMELEN + 32)) { - fprintf(stderr, "short packet (%u/%u bytes) from %s\n", + fprintf(stderr, "short packet (%zd/%zu bytes) from %s\n", cc, sizeof(struct tsp) - MAXHOSTNAMELEN + 32, inet_ntoa(from.sin_addr)); return; From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 23:51:19 2012 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 34610106564A; Sun, 1 Jan 2012 23:51:19 +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 04D648FC08; Sun, 1 Jan 2012 23:51: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 q01NpIo4038148; Sun, 1 Jan 2012 23:51:18 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01NpIW2038146; Sun, 1 Jan 2012 23:51:18 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201012351.q01NpIW2038146@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 1 Jan 2012 23:51:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229248 - stable/9/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, 01 Jan 2012 23:51:19 -0000 Author: kib Date: Sun Jan 1 23:51:18 2012 New Revision: 229248 URL: http://svn.freebsd.org/changeset/base/229248 Log: MFC r228306: Most users of pipe(2) do not call fstat(2) on the returned pipe descriptors. Optimize for the case, by lazily allocating the pipe inode number at the fstat(2) time. Modified: stable/9/sys/kern/sys_pipe.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/sys_pipe.c ============================================================================== --- stable/9/sys/kern/sys_pipe.c Sun Jan 1 23:49:11 2012 (r229247) +++ stable/9/sys/kern/sys_pipe.c Sun Jan 1 23:51:18 2012 (r229248) @@ -569,12 +569,7 @@ pipe_create(pipe, backing) /* If we're not backing this pipe, no need to do anything. */ error = 0; } - if (error == 0) { - pipe->pipe_ino = alloc_unr(pipeino_unr); - if (pipe->pipe_ino == -1) - /* pipeclose will clear allocated kva */ - error = ENOMEM; - } + pipe->pipe_ino = -1; return (error); } @@ -1398,16 +1393,40 @@ pipe_stat(fp, ub, active_cred, td) struct ucred *active_cred; struct thread *td; { - struct pipe *pipe = fp->f_data; + struct pipe *pipe; + int new_unr; #ifdef MAC int error; +#endif + pipe = fp->f_data; PIPE_LOCK(pipe); +#ifdef MAC error = mac_pipe_check_stat(active_cred, pipe->pipe_pair); - PIPE_UNLOCK(pipe); - if (error) + if (error) { + PIPE_UNLOCK(pipe); return (error); + } #endif + /* + * Lazily allocate an inode number for the pipe. Most pipe + * users do not call fstat(2) on the pipe, which means that + * postponing the inode allocation until it is must be + * returned to userland is useful. If alloc_unr failed, + * assign st_ino zero instead of returning an error. + * Special pipe_ino values: + * -1 - not yet initialized; + * 0 - alloc_unr failed, return 0 as st_ino forever. + */ + if (pipe->pipe_ino == (ino_t)-1) { + new_unr = alloc_unr(pipeino_unr); + if (new_unr != -1) + pipe->pipe_ino = new_unr; + else + pipe->pipe_ino = 0; + } + PIPE_UNLOCK(pipe); + bzero(ub, sizeof(*ub)); ub->st_mode = S_IFIFO; ub->st_blksize = PAGE_SIZE; From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 23:51:39 2012 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 392CD1065781; Sun, 1 Jan 2012 23:51:39 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 232558FC12; Sun, 1 Jan 2012 23:51: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 q01NpdXE038192; Sun, 1 Jan 2012 23:51:39 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01NpdsA038190; Sun, 1 Jan 2012 23:51:39 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201012351.q01NpdsA038190@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 23:51:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229249 - stable/9/usr.sbin/uhsoctl 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, 01 Jan 2012 23:51:39 -0000 Author: dim Date: Sun Jan 1 23:51:38 2012 New Revision: 229249 URL: http://svn.freebsd.org/changeset/base/229249 Log: MFC r228721: In usr.sbin/uhsoctl/uhsoctl.c, fix a few warnings about format strings not being literals. Modified: stable/9/usr.sbin/uhsoctl/uhsoctl.c Directory Properties: stable/9/usr.sbin/uhsoctl/ (props changed) Modified: stable/9/usr.sbin/uhsoctl/uhsoctl.c ============================================================================== --- stable/9/usr.sbin/uhsoctl/uhsoctl.c Sun Jan 1 23:51:18 2012 (r229248) +++ stable/9/usr.sbin/uhsoctl/uhsoctl.c Sun Jan 1 23:51:38 2012 (r229249) @@ -340,7 +340,7 @@ logger(int pri, const char *fmt, ...) va_start(ap, fmt); vasprintf(&buf, fmt, ap); if (syslog_open) - syslog(pri, buf); + syslog(pri, "%s", buf); else { switch (pri) { case LOG_INFO: @@ -1174,7 +1174,7 @@ do_connect(struct ctx *ctx, const char * buf = ra.val[0].ptr; if (strstr(buf[0], "+CME ERROR:") != NULL) { buf[0] += 12; - errx(1, buf[0]); + errx(1, "%s", buf[0]); } freeresp(&ra); } else From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 23:53:16 2012 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 703EF106566B; Sun, 1 Jan 2012 23:53:16 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5A4A08FC0A; Sun, 1 Jan 2012 23:53: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 q01NrGlE038304; Sun, 1 Jan 2012 23:53:16 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01NrGIC038302; Sun, 1 Jan 2012 23:53:16 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201012353.q01NrGIC038302@svn.freebsd.org> From: Dimitry Andric Date: Sun, 1 Jan 2012 23:53:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229250 - stable/9/usr.sbin/yp_mkdb 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, 01 Jan 2012 23:53:16 -0000 Author: dim Date: Sun Jan 1 23:53:16 2012 New Revision: 229250 URL: http://svn.freebsd.org/changeset/base/229250 Log: MFC r228722: In usr.sbin/yp_mkdb/yp_mkdb.c, cast some printf field width parameters to int, cast time_t to intmax_t, and use the corresponding printf length modifier. Modified: stable/9/usr.sbin/yp_mkdb/yp_mkdb.c Directory Properties: stable/9/usr.sbin/yp_mkdb/ (props changed) Modified: stable/9/usr.sbin/yp_mkdb/yp_mkdb.c ============================================================================== --- stable/9/usr.sbin/yp_mkdb/yp_mkdb.c Sun Jan 1 23:51:38 2012 (r229249) +++ stable/9/usr.sbin/yp_mkdb/yp_mkdb.c Sun Jan 1 23:53:16 2012 (r229250) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -87,7 +88,8 @@ unwind(char *map) key.data = NULL; while (yp_next_record(dbp, &key, &data, 1, 1) == YP_TRUE) - printf("%.*s %.*s\n", key.size,key.data,data.size,data.data); + printf("%.*s %.*s\n", (int)key.size, key.data, (int)data.size, + data.data); (void)(dbp->close)(dbp); return; @@ -218,7 +220,7 @@ main(int argc, char *argv[]) key.data = "YP_LAST_MODIFIED"; key.size = sizeof("YP_LAST_MODIFIED") - 1; - snprintf(buf, sizeof(buf), "%lu", time(NULL)); + snprintf(buf, sizeof(buf), "%jd", (intmax_t)time(NULL)); data.data = (char *)&buf; data.size = strlen(buf); yp_put_record(dbp, &key, &data, 0); From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 23:55:18 2012 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 6804E1065670; Sun, 1 Jan 2012 23:55:18 +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 50C078FC0A; Sun, 1 Jan 2012 23:55:18 +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 q01NtIsV038423; Sun, 1 Jan 2012 23:55:18 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01NtIM9038421; Sun, 1 Jan 2012 23:55:18 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201012355.q01NtIM9038421@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 1 Jan 2012 23:55:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229251 - in stable/9/sys: 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: Sun, 01 Jan 2012 23:55:18 -0000 Author: kib Date: Sun Jan 1 23:55:17 2012 New Revision: 229251 URL: http://svn.freebsd.org/changeset/base/229251 Log: MFC r228567: Move kstack_cache_entry into the private header, and make the stack cache list header accessible outside vm_glue.c. Added: stable/9/sys/sys/_kstack_cache.h - copied unchanged from r228567, head/sys/sys/_kstack_cache.h Modified: stable/9/sys/vm/vm_glue.c Directory Properties: stable/9/sys/ (props changed) Copied: stable/9/sys/sys/_kstack_cache.h (from r228567, head/sys/sys/_kstack_cache.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/sys/sys/_kstack_cache.h Sun Jan 1 23:55:17 2012 (r229251, copy of r228567, head/sys/sys/_kstack_cache.h) @@ -0,0 +1,43 @@ +/*- + * Copyright (c) 2009 Konstantin Belousov + * + * 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. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 THE REGENTS 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. + * + * $FreeBSD$ + */ + +#ifndef _SYS__KSTACK_CACHE_H +#define _SYS__KSTACK_CACHE_H + +struct kstack_cache_entry { + struct vm_object *ksobj; + struct kstack_cache_entry *next_ks_entry; +}; + +extern struct kstack_cache_entry *kstack_cache; + +#endif + + Modified: stable/9/sys/vm/vm_glue.c ============================================================================== --- stable/9/sys/vm/vm_glue.c Sun Jan 1 23:53:16 2012 (r229250) +++ stable/9/sys/vm/vm_glue.c Sun Jan 1 23:55:17 2012 (r229251) @@ -77,7 +77,7 @@ __FBSDID("$FreeBSD$"); #include #include #include - +#include #include #include #include @@ -331,12 +331,7 @@ vm_sync_icache(vm_map_t map, vm_offset_t pmap_sync_icache(map->pmap, va, sz); } -struct kstack_cache_entry { - vm_object_t ksobj; - struct kstack_cache_entry *next_ks_entry; -}; - -static struct kstack_cache_entry *kstack_cache; +struct kstack_cache_entry *kstack_cache; static int kstack_cache_size = 128; static int kstacks; static struct mtx kstack_cache_mtx; From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 23:58:20 2012 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 66446106566C; Sun, 1 Jan 2012 23:58:20 +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 50A368FC0A; Sun, 1 Jan 2012 23:58:20 +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 q01NwKlx038569; Sun, 1 Jan 2012 23:58:20 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01NwKU7038567; Sun, 1 Jan 2012 23:58:20 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201012358.q01NwKU7038567@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 1 Jan 2012 23:58:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229252 - stable/9/sys/ddb 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, 01 Jan 2012 23:58:20 -0000 Author: kib Date: Sun Jan 1 23:58:20 2012 New Revision: 229252 URL: http://svn.freebsd.org/changeset/base/229252 Log: Show the thread kernel stack base address for 'show threads'. Modified: stable/9/sys/ddb/db_thread.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ddb/db_thread.c ============================================================================== --- stable/9/sys/ddb/db_thread.c Sun Jan 1 23:55:17 2012 (r229251) +++ stable/9/sys/ddb/db_thread.c Sun Jan 1 23:58:20 2012 (r229252) @@ -94,7 +94,8 @@ db_show_threads(db_expr_t addr, boolean_ thr = kdb_thr_first(); while (!db_pager_quit && thr != NULL) { - db_printf(" %6ld (%p) ", (long)thr->td_tid, thr); + db_printf(" %6ld (%p) (stack %p) ", (long)thr->td_tid, thr, + (void *)thr->td_kstack); prev_jb = kdb_jmpbuf(jb); if (setjmp(jb) == 0) { if (db_trace_thread(thr, 1) != 0) From owner-svn-src-all@FreeBSD.ORG Sun Jan 1 23:58:42 2012 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 B126710656D4; Sun, 1 Jan 2012 23:58:42 +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 9B2A88FC16; Sun, 1 Jan 2012 23:58:42 +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 q01Nwg23038614; Sun, 1 Jan 2012 23:58:42 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q01NwggW038612; Sun, 1 Jan 2012 23:58:42 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201012358.q01NwggW038612@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 1 Jan 2012 23:58:42 +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: r229253 - stable/8/sys/ddb 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, 01 Jan 2012 23:58:42 -0000 Author: kib Date: Sun Jan 1 23:58:42 2012 New Revision: 229253 URL: http://svn.freebsd.org/changeset/base/229253 Log: Show the thread kernel stack base address for 'show threads'. Modified: stable/8/sys/ddb/db_thread.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/ddb/db_thread.c ============================================================================== --- stable/8/sys/ddb/db_thread.c Sun Jan 1 23:58:20 2012 (r229252) +++ stable/8/sys/ddb/db_thread.c Sun Jan 1 23:58:42 2012 (r229253) @@ -94,7 +94,8 @@ db_show_threads(db_expr_t addr, boolean_ thr = kdb_thr_first(); while (!db_pager_quit && thr != NULL) { - db_printf(" %6ld (%p) ", (long)thr->td_tid, thr); + db_printf(" %6ld (%p) (stack %p) ", (long)thr->td_tid, thr, + (void *)thr->td_kstack); prev_jb = kdb_jmpbuf(jb); if (setjmp(jb) == 0) { if (db_trace_thread(thr, 1) != 0) From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 00:01:10 2012 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 59894106566C; Mon, 2 Jan 2012 00:01:10 +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 296FC8FC12; Mon, 2 Jan 2012 00:01: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 q0201A2K038775; Mon, 2 Jan 2012 00:01:10 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0201AlG038771; Mon, 2 Jan 2012 00:01:10 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201020001.q0201AlG038771@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 2 Jan 2012 00:01:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229254 - stable/9/sys/ddb 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, 02 Jan 2012 00:01:10 -0000 Author: kib Date: Mon Jan 2 00:01:09 2012 New Revision: 229254 URL: http://svn.freebsd.org/changeset/base/229254 Log: MFC r228569: Add 'findstack' ddb command to search either the thread kernel stack or cached stack containing the specified kernel virtual address. Modified: stable/9/sys/ddb/db_command.c stable/9/sys/ddb/db_ps.c stable/9/sys/ddb/ddb.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ddb/db_command.c ============================================================================== --- stable/9/sys/ddb/db_command.c Sun Jan 1 23:58:42 2012 (r229253) +++ stable/9/sys/ddb/db_command.c Mon Jan 2 00:01:09 2012 (r229254) @@ -140,6 +140,7 @@ static struct command db_cmds[] = { { "unscript", db_unscript_cmd, CS_OWN, 0 }, { "capture", db_capture_cmd, CS_OWN, 0 }, { "textdump", db_textdump_cmd, CS_OWN, 0 }, + { "findstack", db_findstack_cmd, 0, 0 }, }; struct command_table db_cmd_table = LIST_HEAD_INITIALIZER(db_cmd_table); Modified: stable/9/sys/ddb/db_ps.c ============================================================================== --- stable/9/sys/ddb/db_ps.c Sun Jan 1 23:58:42 2012 (r229253) +++ stable/9/sys/ddb/db_ps.c Mon Jan 2 00:01:09 2012 (r229254) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -429,3 +430,39 @@ DB_SHOW_COMMAND(proc, db_show_proc) break; } } + +void +db_findstack_cmd(db_expr_t addr, boolean_t have_addr, + db_expr_t dummy3 __unused, char *dummy4 __unused) +{ + struct proc *p; + struct thread *td; + struct kstack_cache_entry *ks_ce; + vm_offset_t saddr; + + if (have_addr) + saddr = addr; + else { + db_printf("Usage: findstack
\n"); + return; + } + + for (p = LIST_FIRST(&allproc); p != NULL; p = LIST_NEXT(p, p_list)) { + FOREACH_THREAD_IN_PROC(p, td) { + if (td->td_kstack <= saddr && saddr < td->td_kstack + + PAGE_SIZE * td->td_kstack_pages) { + db_printf("Thread %p\n", td); + return; + } + } + } + + for (ks_ce = kstack_cache; ks_ce != NULL; + ks_ce = ks_ce->next_ks_entry) { + if ((vm_offset_t)ks_ce <= saddr && saddr < (vm_offset_t)ks_ce + + PAGE_SIZE * KSTACK_PAGES) { + db_printf("Cached stack %p\n", ks_ce); + return; + } + } +} Modified: stable/9/sys/ddb/ddb.h ============================================================================== --- stable/9/sys/ddb/ddb.h Sun Jan 1 23:58:42 2012 (r229253) +++ stable/9/sys/ddb/ddb.h Mon Jan 2 00:01:09 2012 (r229254) @@ -226,6 +226,7 @@ db_cmdfcn_t db_delete_cmd; db_cmdfcn_t db_deletehwatch_cmd; db_cmdfcn_t db_deletewatch_cmd; db_cmdfcn_t db_examine_cmd; +db_cmdfcn_t db_findstack_cmd; db_cmdfcn_t db_hwatchpoint_cmd; db_cmdfcn_t db_listbreak_cmd; db_cmdfcn_t db_scripts_cmd; From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 00:02:51 2012 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 1C1E11065676; Mon, 2 Jan 2012 00:02:51 +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 03CDC8FC1F; Mon, 2 Jan 2012 00:02:51 +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 q0202ohT038877; Mon, 2 Jan 2012 00:02:50 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0202o3C038875; Mon, 2 Jan 2012 00:02:50 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201020002.q0202o3C038875@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 2 Jan 2012 00:02:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229255 - stable/9/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: Mon, 02 Jan 2012 00:02:51 -0000 Author: kib Date: Mon Jan 2 00:02:50 2012 New Revision: 229255 URL: http://svn.freebsd.org/changeset/base/229255 Log: MFC r228570: Document 'findstack'. Modified: stable/9/share/man/man4/ddb.4 Directory Properties: stable/9/share/man/man4/ (props changed) Modified: stable/9/share/man/man4/ddb.4 ============================================================================== --- stable/9/share/man/man4/ddb.4 Mon Jan 2 00:01:09 2012 (r229254) +++ stable/9/share/man/man4/ddb.4 Mon Jan 2 00:02:50 2012 (r229255) @@ -60,7 +60,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 5, 2010 +.Dd December 16, 2011 .Dt DDB 4 .Os .Sh NAME @@ -523,6 +523,16 @@ The optional argument limits the search. .\" .Pp +.It Xo +.Ic findstack +.Ar addr +.Xc +Prints the thread address for a thread kernel-mode stack of which contains the +specified address. +If the thread is not found, search the thread stack cache and prints the +cached stack address. +Otherwise, prints nothing. +.Pp .It Ic show Cm all procs Ns Op Li / Ns Cm m .It Ic ps Ns Op Li / Ns Cm m Display all process information. From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 00:04:51 2012 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 678D8106564A; Mon, 2 Jan 2012 00:04:51 +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 517CB8FC08; Mon, 2 Jan 2012 00:04:51 +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 q0204pL8038999; Mon, 2 Jan 2012 00:04:51 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0204pMd038996; Mon, 2 Jan 2012 00:04:51 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201020004.q0204pMd038996@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 2 Jan 2012 00:04:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229256 - stable/9/sbin/fsck_ffs 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, 02 Jan 2012 00:04:51 -0000 Author: kib Date: Mon Jan 2 00:04:51 2012 New Revision: 229256 URL: http://svn.freebsd.org/changeset/base/229256 Log: MFC r228751: Change the type of real_dev_bsize variable from long to u_int. The DIOCGSECTORSIZE takes u_int * as an argument, using long * causes failures on big-endian targets. PR: sparc64/163460 Modified: stable/9/sbin/fsck_ffs/fsck.h stable/9/sbin/fsck_ffs/suj.c Directory Properties: stable/9/sbin/fsck_ffs/ (props changed) Modified: stable/9/sbin/fsck_ffs/fsck.h ============================================================================== --- stable/9/sbin/fsck_ffs/fsck.h Mon Jan 2 00:02:50 2012 (r229255) +++ stable/9/sbin/fsck_ffs/fsck.h Mon Jan 2 00:04:51 2012 (r229256) @@ -268,7 +268,7 @@ char snapname[BUFSIZ]; /* when doing sna char *cdevname; /* name of device being checked */ long dev_bsize; /* computed value of DEV_BSIZE */ long secsize; /* actual disk sector size */ -long real_dev_bsize; +u_int real_dev_bsize; /* actual disk sector size, not overriden */ char nflag; /* assume a no response */ char yflag; /* assume a yes response */ int bkgrdflag; /* use a snapshot to run on an active system */ Modified: stable/9/sbin/fsck_ffs/suj.c ============================================================================== --- stable/9/sbin/fsck_ffs/suj.c Mon Jan 2 00:02:50 2012 (r229255) +++ stable/9/sbin/fsck_ffs/suj.c Mon Jan 2 00:04:51 2012 (r229256) @@ -206,7 +206,7 @@ opendisk(const char *devnam) &real_dev_bsize) == -1) real_dev_bsize = secsize; if (debug) - printf("dev_bsize %ld\n", real_dev_bsize); + printf("dev_bsize %u\n", real_dev_bsize); } /* From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 00:46:13 2012 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 8DECD1065675; Mon, 2 Jan 2012 00:46:13 +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 7902E8FC15; Mon, 2 Jan 2012 00:46: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 q020kDZZ040509; Mon, 2 Jan 2012 00:46:13 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q020kDPU040507; Mon, 2 Jan 2012 00:46:13 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201020046.q020kDPU040507@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 2 Jan 2012 00:46:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229257 - stable/9/sys/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: Mon, 02 Jan 2012 00:46:13 -0000 Author: kib Date: Mon Jan 2 00:46:13 2012 New Revision: 229257 URL: http://svn.freebsd.org/changeset/base/229257 Log: MFC r228434: Add definitions for GNU-specific STT_GNU_IFUNC symbol type, and R_{386,X86_64}_IRELATIVE relocations. Modified: stable/9/sys/sys/elf_common.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/sys/elf_common.h ============================================================================== --- stable/9/sys/sys/elf_common.h Mon Jan 2 00:04:51 2012 (r229256) +++ stable/9/sys/sys/elf_common.h Mon Jan 2 00:46:13 2012 (r229257) @@ -503,6 +503,7 @@ typedef struct { #define STT_TLS 6 /* TLS object. */ #define STT_NUM 7 #define STT_LOOS 10 /* Reserved range for operating system */ +#define STT_GNU_IFUNC 10 #define STT_HIOS 12 /* specific semantics. */ #define STT_LOPROC 13 /* reserved range for processor */ #define STT_HIPROC 15 /* specific semantics. */ @@ -612,6 +613,7 @@ typedef struct { #define R_386_TLS_DTPMOD32 35 /* GOT entry containing TLS index */ #define R_386_TLS_DTPOFF32 36 /* GOT entry containing TLS offset */ #define R_386_TLS_TPOFF32 37 /* GOT entry of -ve static TLS offset */ +#define R_386_IRELATIVE 42 /* PLT entry resolved indirectly at runtime */ #define R_ARM_NONE 0 /* No relocation. */ #define R_ARM_PC24 1 @@ -961,6 +963,7 @@ typedef struct { #define R_X86_64_DTPOFF32 21 /* Offset in TLS block */ #define R_X86_64_GOTTPOFF 22 /* PC relative offset to IE GOT entry */ #define R_X86_64_TPOFF32 23 /* Offset in static TLS block */ +#define R_X86_64_IRELATIVE 37 #endif /* !_SYS_ELF_COMMON_H_ */ From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 02:14:11 2012 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 967E1106564A; Mon, 2 Jan 2012 02:14:11 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (ZIM.MIT.EDU [18.95.3.101]) by mx1.freebsd.org (Postfix) with ESMTP id 521198FC0C; Mon, 2 Jan 2012 02:14:11 +0000 (UTC) Received: from zim.MIT.EDU (localhost [127.0.0.1]) by zim.MIT.EDU (8.14.5/8.14.2) with ESMTP id q022E87G099845; Sun, 1 Jan 2012 21:14:08 -0500 (EST) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by zim.MIT.EDU (8.14.5/8.14.2/Submit) id q022E8P3099844; Sun, 1 Jan 2012 21:14:08 -0500 (EST) (envelope-from das@FreeBSD.ORG) Date: Sun, 1 Jan 2012 21:14:08 -0500 From: David Schultz To: Ed Schouten Message-ID: <20120102021408.GA99780@zim.MIT.EDU> Mail-Followup-To: Ed Schouten , Steve Kargl , Andreas Tobler , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201112291441.pBTEfI8l060127@svn.freebsd.org> <4EFCA6A6.6080103@FreeBSD.org> <20111229183213.GK1895@hoeg.nl> <20111229184934.GA47885@troutmask.apl.washington.edu> <20111229192359.GM1895@hoeg.nl> <20120101025422.GD94452@zim.MIT.EDU> <20120101092925.GZ1895@hoeg.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120101092925.GZ1895@hoeg.nl> Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG, Andreas Tobler , Steve Kargl Subject: Re: svn commit: r228955 - head/include 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, 02 Jan 2012 02:14:11 -0000 On Sun, Jan 01, 2012, Ed Schouten wrote: > David, > > * David Schultz , 20120101 03:54: > > I'm out of town and don't remember the details of this, but is there a > > reason we couldn't simply have an appropriate #ifdef that uses > > __attribute((__noreturn__)) instead of [[noreturn]]? We have plenty > > of ifdefs in the tree already to work around deficiencies in various > > compilers. Saying "it's the compiler's fault and we're not going to > > work around it" is a significant departure from historical precedent, > > and it punishes the wrong people. Easier than arguing with the GNU > > folks about fixing it, too... > > Right now GCC 4.7 is still an unreleased piece of software. If GCC 4.7 > was a released piece of software, I would of course agree that we should > add the workaround. > > The problem isn't that GCC 4.7 doesn't support [[noreturn]]. The problem > is that GCC only implements parts of C++11, yet it forces the compiler > into C++11 mode while bootstrapping. Even if we add a workaround for > this in sys/cdefs.h, we can likely never ever get rid of it. Because if > someone wants to install GCC 4.7 on a FreeBSD 14.0 box in 2020 to build > an old piece of software, he still needs the workaround. > > But there's nothing serious going on here. The issue is already > discussed in GCC Bugzilla and there is a patch that fixes the build. > Let's just wait to see what happens. Since we're talking about a development version of gcc, I agree. We should wait and see if they fix it. It wouldn't surprise me if we wind up needing some workarounds. After all, after well over a decade, we still have workarounds for gcc's (and clang's) lack of complete C99 support. I doubt the gcc developers are going to agree that they need to dot every "i" and cross every "t" before they declare C++11 support and define __cplusplus to be 201103. From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 03:09:59 2012 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 A65A01065672; Mon, 2 Jan 2012 03:09:59 +0000 (UTC) (envelope-from lstewart@freebsd.org) Received: from lauren.room52.net (lauren.room52.net [210.50.193.198]) by mx1.freebsd.org (Postfix) with ESMTP id 103558FC08; Mon, 2 Jan 2012 03:09:58 +0000 (UTC) Received: from lstewart1.loshell.room52.net (ppp59-167-184-191.static.internode.on.net [59.167.184.191]) by lauren.room52.net (Postfix) with ESMTPSA id 55E3C7E824; Mon, 2 Jan 2012 14:09:56 +1100 (EST) Message-ID: <4F012004.8010508@freebsd.org> Date: Mon, 02 Jan 2012 14:09:56 +1100 From: Lawrence Stewart User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:7.0.1) Gecko/20111016 Thunderbird/7.0.1 MIME-Version: 1.0 To: Adrian Chadd References: <201112300857.pBU8vxfP004914@svn.freebsd.org> <4EFEB38F.8010709@freebsd.org> In-Reply-To: <4EFEB38F.8010709@freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY autolearn=unavailable version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on lauren.room52.net Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, rwatson@freebsd.org Subject: Re: svn commit: r228986 - in head: share/man/man4 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: Mon, 02 Jan 2012 03:09:59 -0000 On 12/31/11 18:02, Lawrence Stewart wrote: > On 12/31/11 11:13, Adrian Chadd wrote: >> This just broke wlan. Please consider fixing this patch :) >> >> >> Adrian >> >> *** Interface: wlan0: start >> can't re-use a leaf (wlan0)! >> panic: bpfattach tscfgoid >> KDB: enter: panic >> [ thread pid 166 tid 100048 ]Stopped at kdb_enter+0x4c: lui at,0x8048 >> db> >> db> bt >> Tracing pid 166 tid 100048 td 0x80c37900 >> db_trace_thread+30 (?,?,?,?) ra 80074cc0 sp c40075f0 sz 24 >> 80074bac+114 (0,?,ffffffff,?) ra 8007427c sp c4007608 sz 32 >> 80073ef4+388 (?,?,?,?) ra 80074400 sp c4007628 sz 168 >> db_command_loop+70 (?,?,?,?) ra 80076ac4 sp c40076d0 sz 24 >> 800769d0+f4 (?,?,?,?) ra 801b7560 sp c40076e8 sz 424 >> kdb_trap+110 (?,?,?,?) ra 8035c7ec sp c4007890 sz 48 >> trap+bf4 (?,?,?,?) ra 80354560 sp c40078c0 sz 184 >> MipsKernGenException+134 (0,4,803c089c,113) ra 801b72d8 sp c4007978 sz >> 200 >> kdb_enter+4c (?,?,?,?) ra 8017f88c sp c4007a40 sz 24 >> panic+11c (?,0,80706500,0) ra 802304b8 sp c4007a58 sz 40 >> bpfattach2+cc (?,?,?,?) ra 802305e0 sp c4007a80 sz 64 >> bpfattach+10 (?,?,?,?) ra 802448ec sp c4007ac0 sz 24 >> ether_ifattach+d0 (?,?,?,?) ra 8025f0ac sp c4007ad8 sz 32 >> ieee80211_vap_attach+104 (?,?,?,?) ra 8007ffe8 sp c4007af8 sz 96 >> 8007f960+688 (?,?,0,?) ra 8026a39c sp c4007b58 sz 88 >> 8026a22c+170 (?,?,?,?) ra 802430dc sp c4007bb0 sz 88 >> ifc_simple_create+80 (?,?,?,?) ra 80242b04 sp c4007c08 sz 64 >> 80242ab0+54 (?,?,?,?) ra 80242d78 sp c4007c48 sz 40 >> if_clone_create+a8 (?,?,?,?) ra 8023bdd4 sp c4007c70 sz 40 >> ifioctl+3a4 (?,?,80c7f460,80c37900) ra 801d8070 sp c4007c98 sz 144 >> soo_ioctl+3b0 (?,?,?,?) ra 801d2804 sp c4007d28 sz 40 >> kern_ioctl+248 (?,?,?,?) ra 801d29ac sp c4007d50 sz 64 >> sys_ioctl+130 (?,?,?,?) ra 8035c3ec sp c4007d90 sz 56 >> trap+7f4 (?,?,?,?) ra 8035475c sp c4007dc8 sz 184 >> MipsUserGenException+10c (?,?,?,4061d590) ra 0 sp c4007e80 sz 0 >> pid 166 >> db> reset > > I've managed to reproduce this on my wifi enabled laptop with r228986 > MFCed to a 9-stable kernel. I can't reproduce the panic with regular > interfaces, pseudo interfaces (e.g. lo0 and pflog0) or vlans (which also > have a relationship with an underlying physical interface) i.e. this is > VAP/net80211 specific as far as I can tell. > > The problem is that bpfattach2() is being called twice with the same > interface name i.e. "wlan0". > > I added a debug printf and call to kdb_backtrace() after the > SYSCTL_ADD_PROC() call in bpfattach2() to see the code paths which are > calling into the function. Here's what I see when the kernel runs on my > laptop (I've added inline comments between "## ##"): > > Added tscfg OID for interface wlan0 > KDB: stack backtrace: > #0 0xffffffff808680ce at kdb_backtrace+0x5e > #1 0xffffffff808da5b4 at bpfattach2+0xb4 > #2 0xffffffff808fbe06 at ieee80211_vap_setup+0x266 > #3 0xffffffff80740205 at wpi_vap_create+0x95 > #4 0xffffffff809047fb at wlan_clone_create+0x16b > #5 0xffffffff808e6079 at ifc_simple_create+0x89 > #6 0xffffffff808e5cc5 at if_clone_createif+0x65 > #7 0xffffffff808e4546 at ifioctl+0x306 > #8 0xffffffff80879755 at kern_ioctl+0x115 > #9 0xffffffff8087998d at sys_ioctl+0xfd > #10 0xffffffff80b17d60 at amd64_syscall+0x450 > #11 0xffffffff80b03497 at Xfast_syscall+0xf7 > > ## Here it has successfully added the net.bpf.tscfg.wlan0 sysctl entry > for wlan0 ## > > can't re-use a leaf (wlan0)! > > ## Here SYSCTL_ADD_PROC() failed because leaf name is already used ## > > panic: bpfattach tscfgoid > cpuid = 1 > KDB: stack backtrace: > #0 0xffffffff808680ce at kdb_backtrace+0x5e > #1 0xffffffff80832c87 at panic+0x187 > #2 0xffffffff808da6f6 at bpfattach2+0x1f6 > #3 0xffffffff808e72ee at ether_ifattach+0xae > #4 0xffffffff808fd0a5 at ieee80211_vap_attach+0xb5 > #5 0xffffffff8074023c at wpi_vap_create+0xcc > #6 0xffffffff809047fb at wlan_clone_create+0x16b > #7 0xffffffff808e6079 at ifc_simple_create+0x89 > #8 0xffffffff808e5cc5 at if_clone_createif+0x65 > #9 0xffffffff808e4546 at ifioctl+0x306 > #10 0xffffffff80879755 at kern_ioctl+0x115 > #11 0xffffffff8087998d at sys_ioctl+0xfd > #12 0xffffffff80b17d60 at amd64_syscall+0x450 > #13 0xffffffff80b03497 at Xfast_syscall+0xf7 > > > > So after a bit of digging, ieee80211_vap_setup() calls > ieee80211_radiotap_vattach(), which explicitly calls bpfattach2(), and > then a subsequent call to ieee80211_vap_attach() indirectly calls into > bpfattach2() via the call to ether_ifattach(). > > This smells like a net80211 bug to me. I'm guessing, but I would suspect > ieee80211_vap_setup() shouldn't call ieee80211_radiotap_vattach() and > should let ieee80211_vap_attach() handle the BPF attachment via the call > to ether_ifattach(). > > Thoughts? This turns out not to be a bug in net80211, but rather an oversight on my part. I didn't consider the case where multiple DLTs can be attached to BPF with the same interface name. I reverted r228986 and have reworked the patch to instead store the per-interface time stamp configuration OID pointer and config variable in the ifnet. In testing my new patch, I found another problem. BPF maintains a list (bpf_iflist) of bpf_if structs, one per ifnet/dlt combo. Each call to bpf_attach() prepends a new bpf_if struct to the list. bpfdetach() is expected to reclaim all bpf_if structs which reference the specified ifnet from the list when it is called, but currently only removes the first it finds. As far as I can tell, the implementation of bpfdetach() leaks bpf_if references, and has done so since it was introduced in r58273. See here for the function added in r58273: http://svnweb.freebsd.org/base/head/sys/net/bpf.c?revision=58273&view=markup#l1311 I would like to commit something like the following as a fix: http://people.freebsd.org/~lstewart/patches/misc/bpfdetach_bpfif_leakfix_10.x.r229165.patch With the above patch and my revised r228986 patch both applied, I can no longer produce panics on my laptop. Robert, as you committed r58273, I'm hoping you might have some thoughts on this (even if it's almost 12 years later ;). Am I missing something subtle, or is my analysis sensible? Assuming my analysis and patch are sane, would you mind giving it a quick review so I can commit it? Adrian, would you mind applying both the above bpf leakfix patch followed by the revised sysclocksnap/tscfg patch below and testing to make sure your kernel no longer explodes on boot? http://people.freebsd.org/~lstewart/patches/misc/bpf_sysclocksnap_tscfg_postleakfix_10.x.r229165.patch Cheers, Lawrence From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 03:26:59 2012 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 804DD106566B; Mon, 2 Jan 2012 03:26:59 +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 6E4C28FC0A; Mon, 2 Jan 2012 03:26: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 q023QxJJ045650; Mon, 2 Jan 2012 03:26:59 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q023Qxjr045648; Mon, 2 Jan 2012 03:26:59 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201201020326.q023Qxjr045648@svn.freebsd.org> From: Rick Macklem Date: Mon, 2 Jan 2012 03:26:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229258 - stable/9/sys/fs/nfsclient 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, 02 Jan 2012 03:26:59 -0000 Author: rmacklem Date: Mon Jan 2 03:26:59 2012 New Revision: 229258 URL: http://svn.freebsd.org/changeset/base/229258 Log: MFC: r227494 Since NFSv4 byte range locking only works for regular files, add a sanity check for the vnode type to the NFSv4 client. Modified: stable/9/sys/fs/nfsclient/nfs_clvnops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/9/sys/fs/nfsclient/nfs_clvnops.c Mon Jan 2 00:46:13 2012 (r229257) +++ stable/9/sys/fs/nfsclient/nfs_clvnops.c Mon Jan 2 03:26:59 2012 (r229258) @@ -2941,6 +2941,8 @@ nfs_advlock(struct vop_advlock_args *ap) u_quad_t size; if (NFS_ISV4(vp) && (ap->a_flags & (F_POSIX | F_FLOCK)) != 0) { + if (vp->v_type != VREG) + return (EINVAL); if ((ap->a_flags & F_POSIX) != 0) cred = p->p_ucred; else From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 03:52:35 2012 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 63B50106566C; Mon, 2 Jan 2012 03:52:35 +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 516158FC08; Mon, 2 Jan 2012 03:52: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 q023qZ9K046418; Mon, 2 Jan 2012 03:52:35 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q023qZRr046416; Mon, 2 Jan 2012 03:52:35 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201201020352.q023qZRr046416@svn.freebsd.org> From: Rick Macklem Date: Mon, 2 Jan 2012 03:52:35 +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: r229259 - in stable/8/sys: conf fs/nfsclient 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, 02 Jan 2012 03:52:35 -0000 Author: rmacklem Date: Mon Jan 2 03:52:34 2012 New Revision: 229259 URL: http://svn.freebsd.org/changeset/base/229259 Log: MFC: r227494 Since NFSv4 byte range locking only works for regular files, add a sanity check for the vnode type to the NFSv4 client. Modified: stable/8/sys/fs/nfsclient/nfs_clvnops.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/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clvnops.c Mon Jan 2 03:26:59 2012 (r229258) +++ stable/8/sys/fs/nfsclient/nfs_clvnops.c Mon Jan 2 03:52:34 2012 (r229259) @@ -2877,6 +2877,8 @@ nfs_advlock(struct vop_advlock_args *ap) u_quad_t size; if (NFS_ISV4(vp) && (ap->a_flags & (F_POSIX | F_FLOCK)) != 0) { + if (vp->v_type != VREG) + return (EINVAL); if ((ap->a_flags & F_POSIX) != 0) cred = p->p_ucred; else From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 04:01:35 2012 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 034AB106567E; Mon, 2 Jan 2012 04:01:35 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E5D398FC19; Mon, 2 Jan 2012 04:01: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 q0241YVo046732; Mon, 2 Jan 2012 04:01:34 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0241Yub046730; Mon, 2 Jan 2012 04:01:34 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <201201020401.q0241Yub046730@svn.freebsd.org> From: Ken Smith Date: Mon, 2 Jan 2012 04:01:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229260 - stable/9/release 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, 02 Jan 2012 04:01:35 -0000 Author: kensmith Date: Mon Jan 2 04:01:34 2012 New Revision: 229260 URL: http://svn.freebsd.org/changeset/base/229260 Log: RELENG_9 exists now so updated commented-out branch target. Modified: stable/9/release/Makefile.sysinstall Modified: stable/9/release/Makefile.sysinstall ============================================================================== --- stable/9/release/Makefile.sysinstall Mon Jan 2 03:52:34 2012 (r229259) +++ stable/9/release/Makefile.sysinstall Mon Jan 2 04:01:34 2012 (r229260) @@ -33,7 +33,7 @@ BUILDNAME?=${BASE}-${DATE}-SNAP # #CHROOTDIR=/junk/release # If this is a -stable snapshot, then set -#RELEASETAG=RELENG_8 +#RELEASETAG=RELENG_9 # # To test a release with a source tree containing patches and # other work. This tree will get copied instead of getting the From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 04:11:23 2012 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 0A972106564A; Mon, 2 Jan 2012 04:11:23 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ED6408FC12; Mon, 2 Jan 2012 04:11: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 q024BMJh047097; Mon, 2 Jan 2012 04:11:22 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q024BMvU047095; Mon, 2 Jan 2012 04:11:22 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <201201020411.q024BMvU047095@svn.freebsd.org> From: Ken Smith Date: Mon, 2 Jan 2012 04:11:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229261 - releng/9.0/release 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, 02 Jan 2012 04:11:23 -0000 Author: kensmith Date: Mon Jan 2 04:11:22 2012 New Revision: 229261 URL: http://svn.freebsd.org/changeset/base/229261 Log: MFC r229258: RELENG_9 exists now so updated commented out target branch. Approved by: re (implicit) Modified: releng/9.0/release/Makefile.sysinstall Directory Properties: releng/9.0/release/ (props changed) Modified: releng/9.0/release/Makefile.sysinstall ============================================================================== --- releng/9.0/release/Makefile.sysinstall Mon Jan 2 04:01:34 2012 (r229260) +++ releng/9.0/release/Makefile.sysinstall Mon Jan 2 04:11:22 2012 (r229261) @@ -33,7 +33,7 @@ BUILDNAME?=${BASE}-${DATE}-SNAP # #CHROOTDIR=/junk/release # If this is a -stable snapshot, then set -#RELEASETAG=RELENG_8 +#RELEASETAG=RELENG_9 # # To test a release with a source tree containing patches and # other work. This tree will get copied instead of getting the From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 04:16:45 2012 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 CC644106566B; Mon, 2 Jan 2012 04:16:45 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BB3B68FC0C; Mon, 2 Jan 2012 04:16: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 q024GjI9047286; Mon, 2 Jan 2012 04:16:45 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q024GjDK047284; Mon, 2 Jan 2012 04:16:45 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <201201020416.q024GjDK047284@svn.freebsd.org> From: Ken Smith Date: Mon, 2 Jan 2012 04:16:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229262 - releng/9.0 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, 02 Jan 2012 04:16:45 -0000 Author: kensmith Date: Mon Jan 2 04:16:45 2012 New Revision: 229262 URL: http://svn.freebsd.org/changeset/base/229262 Log: Update branch target for 'make update'. Approved by: re (implicit) Modified: releng/9.0/Makefile.inc1 Modified: releng/9.0/Makefile.inc1 ============================================================================== --- releng/9.0/Makefile.inc1 Mon Jan 2 04:11:22 2012 (r229261) +++ releng/9.0/Makefile.inc1 Mon Jan 2 04:16:45 2012 (r229262) @@ -107,7 +107,7 @@ CLEANDIR= cleandir .endif CVS?= cvs -CVSFLAGS?= -A -P -d -I! +CVSFLAGS?= -r RELENG_9_0 -P -d -I! SVN?= svn SVNFLAGS?= -r HEAD SUP?= /usr/bin/csup From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 04:25:25 2012 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 8431D106564A; Mon, 2 Jan 2012 04:25:25 +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 57BE28FC1B; Mon, 2 Jan 2012 04:25:25 +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 q024PPXm047586; Mon, 2 Jan 2012 04:25:25 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q024PPol047584; Mon, 2 Jan 2012 04:25:25 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201201020425.q024PPol047584@svn.freebsd.org> From: Rick Macklem Date: Mon, 2 Jan 2012 04:25:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229263 - stable/9/sys/fs/nfsclient 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, 02 Jan 2012 04:25:25 -0000 Author: rmacklem Date: Mon Jan 2 04:25:25 2012 New Revision: 229263 URL: http://svn.freebsd.org/changeset/base/229263 Log: MFC: r227517 Move the setting of the default value for nm_wcommitsize to before the nfs_decode_args() call in the new NFS client, so that a specfied command line value won't be overwritten. Also, modify the calculation for small values of desiredvnodes to avoid an unusually large value or a divide by zero crash. It seems that the default value for nm_wcommitsize is very conservative and may need to change at some time. Modified: stable/9/sys/fs/nfsclient/nfs_clvfsops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- stable/9/sys/fs/nfsclient/nfs_clvfsops.c Mon Jan 2 04:16:45 2012 (r229262) +++ stable/9/sys/fs/nfsclient/nfs_clvfsops.c Mon Jan 2 04:25:25 2012 (r229263) @@ -1222,6 +1222,10 @@ mountnfs(struct nfs_args *argp, struct m nmp->nm_timeo = NFS_TIMEO; nmp->nm_retry = NFS_RETRANS; nmp->nm_readahead = NFS_DEFRAHEAD; + if (desiredvnodes >= 11000) + nmp->nm_wcommitsize = hibufspace / (desiredvnodes / 1000); + else + nmp->nm_wcommitsize = hibufspace / 10; nfs_decode_args(mp, nmp, argp, hst, cred, td); @@ -1245,7 +1249,6 @@ mountnfs(struct nfs_args *argp, struct m nmp->nm_rsize = NFS_RSIZE; nmp->nm_readdirsize = NFS_READDIRSIZE; } - nmp->nm_wcommitsize = hibufspace / (desiredvnodes / 1000); nmp->nm_numgrps = NFS_MAXGRPS; nmp->nm_tprintf_delay = nfs_tprintf_delay; if (nmp->nm_tprintf_delay < 0) From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 04:47:39 2012 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 5E0C3106564A; Mon, 2 Jan 2012 04:47:39 +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 4BAB78FC08; Mon, 2 Jan 2012 04:47: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 q024ldUU048340; Mon, 2 Jan 2012 04:47:39 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q024ldHP048338; Mon, 2 Jan 2012 04:47:39 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201201020447.q024ldHP048338@svn.freebsd.org> From: Rick Macklem Date: Mon, 2 Jan 2012 04:47:39 +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: r229264 - in stable/8/sys: conf fs/nfsclient 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, 02 Jan 2012 04:47:39 -0000 Author: rmacklem Date: Mon Jan 2 04:47:38 2012 New Revision: 229264 URL: http://svn.freebsd.org/changeset/base/229264 Log: MFC: r227517 Move the setting of the default value for nm_wcommitsize to before the nfs_decode_args() call in the new NFS client, so that a specfied command line value won't be overwritten. Also, modify the calculation for small values of desiredvnodes to avoid an unusually large value or a divide by zero crash. It seems that the default value for nm_wcommitsize is very conservative and may need to change at some time. Modified: stable/8/sys/fs/nfsclient/nfs_clvfsops.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/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clvfsops.c Mon Jan 2 04:25:25 2012 (r229263) +++ stable/8/sys/fs/nfsclient/nfs_clvfsops.c Mon Jan 2 04:47:38 2012 (r229264) @@ -1218,6 +1218,10 @@ mountnfs(struct nfs_args *argp, struct m nmp->nm_timeo = NFS_TIMEO; nmp->nm_retry = NFS_RETRANS; nmp->nm_readahead = NFS_DEFRAHEAD; + if (desiredvnodes >= 11000) + nmp->nm_wcommitsize = hibufspace / (desiredvnodes / 1000); + else + nmp->nm_wcommitsize = hibufspace / 10; nfs_decode_args(mp, nmp, argp, hst, cred, td); @@ -1241,7 +1245,6 @@ mountnfs(struct nfs_args *argp, struct m nmp->nm_rsize = NFS_RSIZE; nmp->nm_readdirsize = NFS_READDIRSIZE; } - nmp->nm_wcommitsize = hibufspace / (desiredvnodes / 1000); nmp->nm_numgrps = NFS_MAXGRPS; nmp->nm_tprintf_delay = nfs_tprintf_delay; if (nmp->nm_tprintf_delay < 0) From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 05:21:09 2012 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 715AB1065676; Mon, 2 Jan 2012 05:21:09 +0000 (UTC) (envelope-from minimarmot@gmail.com) Received: from mail-gy0-f182.google.com (mail-gy0-f182.google.com [209.85.160.182]) by mx1.freebsd.org (Postfix) with ESMTP id E92138FC08; Mon, 2 Jan 2012 05:21:08 +0000 (UTC) Received: by ghrr16 with SMTP id r16so6234356ghr.13 for ; Sun, 01 Jan 2012 21:21:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=+sRKxrGAArqnj/00FoYJv65tQKDIOFz6Bow18VmZidI=; b=ERtOOS1RsuYirU86CKF1yeK6HjO09DfkMOR7W5SrAv+HxTJ2YUjoDUzpV+/DjzvaDU KJYtdxRwUtSU+n6zeB562NGeJlGWGX4uVQlpzsDrj3lUA0q7vNBuwHx8Bix/snjXZMHu S6x1YEplnMQyV3+WyLTNQiFWuINS1FrOG5g1U= MIME-Version: 1.0 Received: by 10.236.173.234 with SMTP id v70mr10917903yhl.32.1325481668277; Sun, 01 Jan 2012 21:21:08 -0800 (PST) Received: by 10.236.110.40 with HTTP; Sun, 1 Jan 2012 21:21:08 -0800 (PST) In-Reply-To: <20120101173342.GN83814@acme.spoerlein.net> References: <201112301058.pBUAwFsw010478@svn.freebsd.org> <20120101173342.GN83814@acme.spoerlein.net> Date: Mon, 2 Jan 2012 00:21:08 -0500 Message-ID: From: Ben Kaduk To: Ulrich Spoerlein , Ben Kaduk , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Subject: Re: svn commit: r228990 - in head/usr.sbin: IPXrouted adduser bluetooth/btpand bluetooth/sdpd bootparamd/bootparamd bsnmpd/modules/snmp_bridge bsnmpd/modules/snmp_hostres bsnmpd/modules/snmp_wlan bsnmp... 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, 02 Jan 2012 05:21:09 -0000 On Sun, Jan 1, 2012 at 12:33 PM, Ulrich Spoerlein wrote: > On Fri, 2011-12-30 at 14:43:22 -0500, Ben Kaduk wrote: >> On Fri, Dec 30, 2011 at 5:58 AM, Ulrich Spoerlein wrot= e: >> > Modified: head/usr.sbin/cron/doc/CHANGES >> > =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/usr.sbin/cron/doc/CHANGES =A0 =A0 =A0Fri Dec 30 10:45:00 2011= =A0 =A0 =A0 =A0(r228989) >> > +++ head/usr.sbin/cron/doc/CHANGES =A0 =A0 =A0Fri Dec 30 10:58:14 2011= =A0 =A0 =A0 =A0(r228990) >> > @@ -1,3 +1,6 @@ >> > +$FreeBSD$ >> > +-------- >> > + >> > =A0Vixie Cron =A0 =A0 =A0 =A0 =A0 =A0 Changes from V2 to V3 >> > =A0Paul Vixie >> > =A029-Dec-1993 >> > @@ -20,7 +23,7 @@ be reread whenever it changes. >> > >> > =A0I also added a "-e" option to crontab(1). =A0Nine people also sent = me diffs >> > =A0to add this option, but I had already implemented it on my own. =A0= I actually >> > -released an interrim version (V2.2, I think) for limited testing, and= got a >> > +released an interim version (V2.2, I think) for limited testing, and = got a >> >> Should we really be in the business of modifying Vixie's changelog? > > I'm replying here, but same goes for your comments on the other revision > (thanks for all those, btw). > > Warning, rant ahead: I can handle a rant :) > > Our current SVN repo is in an inconsistent state thanks to the dubious > introduction of svn keywords. There are files in there, converted over > via cvs2svn and never touched since, but our presubmit checks want to > either see a $FreeBSD$ tag in modified files, or have fbsd:nokeywords > set. The latter is kinda a no-brainer for everything under contrib/ but > I'm struggling with what to do exactly for files that are non-contrib > and may or may not be non-code. Should the keywords be set on $subdir/* > or can I punch holes in the web of keywords as I see fit? (e.g. > $subdir/{README,CHANGES,foo.txt}) > > What's the point then anyway? SVN doesn't track files, but changesets. > Gah! I guess I did assume that the $FreeBSD$ keyword was being added because of the presubmit checks, but didn't actually say so. Sorry. It definitely is a grey area in which I don't presume to have an opinion, and I sympathize with your frustration. > > Oh wait, this ain't about the $FreeBSD$ keyword, but the typo-fix? I'm > sure that Vixie won't mind and do believe that correctness of spelling > is a worthy goal as we always tout the quality of our documentation. > I can accept that argument -- I mostly wanted to make sure this wasn't just a mechanical "run aspell over everything" or similar (though a later change did reveal that to not be the case). > FWIW, I'm not going to touch stuff under contrib/, etc. Sounds fine. > >> > =A0/* >> > - * Delete a rotated logfiles, when using clasic filenames. >> > + * Delete a rotated logfiles, when using classic filenames. >> >> "a logfiles" is inconsistent. =A0Without looking up the implementation, >> I'm going to guess that "a rotated logfile" is correct. > > When proofreading the spell-checked output I focused too narrowly on > just the typo that I fixed so that other typos in the same line/sentence > mostly went unnoticed. Will do better in the next couple of commits. It's easy to do -- I actually found myself also doing so a couple times when going through these. (There were quite a number of them, and thanks for going through them all by hand!) -Ben Kaduk From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 06:38:38 2012 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 40EEF1065688; Mon, 2 Jan 2012 06:38:38 +0000 (UTC) (envelope-from minimarmot@gmail.com) Received: from mail-gy0-f182.google.com (mail-gy0-f182.google.com [209.85.160.182]) by mx1.freebsd.org (Postfix) with ESMTP id A6AB98FC13; Mon, 2 Jan 2012 06:38:37 +0000 (UTC) Received: by ghrr16 with SMTP id r16so6244918ghr.13 for ; Sun, 01 Jan 2012 22:38:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=R30geHAIyD45NTBNn6c4YOJSSIF2BxJNw98BGnIpd4g=; b=UEH9zEX5CHaAn8BdngrsapGuXxt8MRWzFlsLtCGARj7O0Z1jV7riFQ4xYXwnyeTLKB NrMqeTzCI1X98XVaLbcyMRbBA1QKLNPWg/ZzM3v+l/aP4G3XSdr80339eBH3pecDWjFU E77mElikrWbFw9fz9HuiuoEki1BupHcNjZjR4= MIME-Version: 1.0 Received: by 10.236.173.40 with SMTP id u28mr15218081yhl.15.1325486316971; Sun, 01 Jan 2012 22:38:36 -0800 (PST) Received: by 10.236.110.40 with HTTP; Sun, 1 Jan 2012 22:38:36 -0800 (PST) In-Reply-To: <20111230200405.GA293@glenbarber.us> References: <201112301058.pBUAwFsw010478@svn.freebsd.org> <20111230195444.GA25204@FreeBSD.org> <20111230200405.GA293@glenbarber.us> Date: Mon, 2 Jan 2012 01:38:36 -0500 Message-ID: From: Ben Kaduk To: Glen Barber Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, Alexey Dokuchaev , src-committers@freebsd.org, svn-src-all@freebsd.org, Ulrich Spoerlein Subject: Re: svn commit: r228990 - in head/usr.sbin: IPXrouted adduser bluetooth/btpand bluetooth/sdpd bootparamd/bootparamd bsnmpd/modules/snmp_bridge bsnmpd/modules/snmp_hostres bsnmpd/modules/snmp_wlan bsnmp... 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, 02 Jan 2012 06:38:38 -0000 On Fri, Dec 30, 2011 at 3:04 PM, Glen Barber wrote: > On Fri, Dec 30, 2011 at 07:54:44PM +0000, Alexey Dokuchaev wrote: >> On Fri, Dec 30, 2011 at 02:43:22PM -0500, Ben Kaduk wrote: >> > On Fri, Dec 30, 2011 at 5:58 AM, Ulrich Spoerlein wr= ote: >> > > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* is 11 bit wide that gives us upto= 2048 chunks. >> > > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* is 11 bit wide that gives us up t= o 2048 chunks. >> > >> > Should be "11 bits", no? >> >> I'm not a native speaker, but I think "11 bit wide" is correct here. =A0= I >> could have probably got into specifics, but simple googling for "16 ton = shit >> dropped on me" yielded 525M results, while the same phrase with "tons" o= nly >> 18,9M. =A0:-^ >> > > Considering the full context, maybe it would be better written as: > > rsp_cs is an 11 bit wide field that gives ... (I'm a native speaker, too.) Were I to seriously wordsmith the comment, I would make it: * The minimum L2CAP MTU is 43 bytes. That means we need * ceiling(65536 / 43) =3D 1525 chunks to transfer the maximum * packet size with minimum MTU. Since the "rsp_cs" field in * fd_idx_t is 11 bits wide, that allows up to 2048 chunks which * is more than sufficient. But it may not be worth worrying about it this much. -Ben From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 09:18:59 2012 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 9C0461065670; Mon, 2 Jan 2012 09:18:59 +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 8AE488FC0A; Mon, 2 Jan 2012 09:18: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 q029IxIU056986; Mon, 2 Jan 2012 09:18:59 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q029Ix5E056984; Mon, 2 Jan 2012 09:18:59 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201201020918.q029Ix5E056984@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Mon, 2 Jan 2012 09:18: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: r229265 - 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: Mon, 02 Jan 2012 09:18:59 -0000 Author: bz Date: Mon Jan 2 09:18:58 2012 New Revision: 229265 URL: http://svn.freebsd.org/changeset/base/229265 Log: As I came by and noticed add a comment that inp locking is a bit optistic (read: non-existent) here and should be fixed. Modified: head/sys/netinet/raw_ip.c Modified: head/sys/netinet/raw_ip.c ============================================================================== --- head/sys/netinet/raw_ip.c Mon Jan 2 04:47:38 2012 (r229264) +++ head/sys/netinet/raw_ip.c Mon Jan 2 09:18:58 2012 (r229265) @@ -544,6 +544,8 @@ rip_output(struct mbuf *m, struct socket * * When adding new socket options here, make sure to add access control * checks here as necessary. + * + * XXX-BZ inp locking? */ int rip_ctloutput(struct socket *so, struct sockopt *sopt) From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 12:12:11 2012 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 8A068106564A; Mon, 2 Jan 2012 12:12:11 +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 756AC8FC13; Mon, 2 Jan 2012 12:12: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 q02CCBBJ066110; Mon, 2 Jan 2012 12:12:11 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02CCBLS066089; Mon, 2 Jan 2012 12:12:11 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201201021212.q02CCBLS066089@svn.freebsd.org> From: Ed Schouten Date: Mon, 2 Jan 2012 12:12: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: r229272 - in head/sys: ddb dev/ata dev/mxge dev/uart fs/nfs fs/nwfs fs/smbfs gnu/fs/xfs i386/ibcs2 kern libkern netgraph security/mac_lomac 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, 02 Jan 2012 12:12:11 -0000 Author: ed Date: Mon Jan 2 12:12:10 2012 New Revision: 229272 URL: http://svn.freebsd.org/changeset/base/229272 Log: Use strchr() and strrchr(). It seems strchr() and strrchr() are used more often than index() and rindex(). Therefore, simply migrate all kernel code to use it. For the XFS code, remove an empty line to make the code identical to the code in the Linux kernel. Modified: head/sys/ddb/db_input.c head/sys/dev/ata/ata-disk.c head/sys/dev/mxge/if_mxge.c head/sys/dev/uart/uart_cpu_sparc64.c head/sys/fs/nfs/nfsport.h head/sys/fs/nwfs/nwfs_vfsops.c head/sys/fs/smbfs/smbfs_vfsops.c head/sys/fs/smbfs/smbfs_vnops.c head/sys/gnu/fs/xfs/xfs_vfsops.c head/sys/i386/ibcs2/ibcs2_socksys.c head/sys/i386/ibcs2/ibcs2_stat.c head/sys/kern/kern_intr.c head/sys/kern/kern_ktr.c head/sys/kern/kern_linker.c head/sys/kern/subr_hints.c head/sys/kern/tty_inq.c head/sys/kern/uipc_mqueue.c head/sys/libkern/fnmatch.c head/sys/netgraph/ng_ksocket.c head/sys/security/mac_lomac/mac_lomac.c Modified: head/sys/ddb/db_input.c ============================================================================== --- head/sys/ddb/db_input.c Mon Jan 2 09:58:39 2012 (r229271) +++ head/sys/ddb/db_input.c Mon Jan 2 12:12:10 2012 (r229272) @@ -253,7 +253,7 @@ db_inputchar(c) db_putnchars(BACKUP, db_lc - db_lbuf_start); db_putnchars(BLANK, db_le - db_lbuf_start); db_putnchars(BACKUP, db_le - db_lbuf_start); - db_le = index(db_lbuf_start, '\0'); + db_le = strchr(db_lbuf_start, '\0'); if (db_le[-1] == '\r' || db_le[-1] == '\n') *--db_le = '\0'; db_lc = db_le; Modified: head/sys/dev/ata/ata-disk.c ============================================================================== --- head/sys/dev/ata/ata-disk.c Mon Jan 2 09:58:39 2012 (r229271) +++ head/sys/dev/ata/ata-disk.c Mon Jan 2 12:12:10 2012 (r229272) @@ -532,8 +532,8 @@ ad_describe(device_t dev) u_int8_t *marker, vendor[64], product[64]; /* try to separate the ATA model string into vendor and model parts */ - if ((marker = index(atadev->param.model, ' ')) || - (marker = index(atadev->param.model, '-'))) { + if ((marker = strchr(atadev->param.model, ' ')) || + (marker = strchr(atadev->param.model, '-'))) { int len = (marker - atadev->param.model); strncpy(vendor, atadev->param.model, len); Modified: head/sys/dev/mxge/if_mxge.c ============================================================================== --- head/sys/dev/mxge/if_mxge.c Mon Jan 2 09:58:39 2012 (r229271) +++ head/sys/dev/mxge/if_mxge.c Mon Jan 2 12:12:10 2012 (r229272) @@ -2827,7 +2827,7 @@ mxge_media_init(mxge_softc_t *sc) } for (i = 0; i < 3; i++, ptr++) { - ptr = index(ptr, '-'); + ptr = strchr(ptr, '-'); if (ptr == NULL) { device_printf(sc->dev, "only %d dashes in PC?!?\n", i); Modified: head/sys/dev/uart/uart_cpu_sparc64.c ============================================================================== --- head/sys/dev/uart/uart_cpu_sparc64.c Mon Jan 2 09:58:39 2012 (r229271) +++ head/sys/dev/uart/uart_cpu_sparc64.c Mon Jan 2 12:12:10 2012 (r229272) @@ -71,7 +71,7 @@ uart_cpu_channel(char *dev) if ((aliases = OF_finddevice("/aliases")) != -1) (void)OF_getprop(aliases, dev, alias, sizeof(alias)); len = strlen(alias); - if ((p = rindex(alias, ':')) == NULL) + if ((p = strrchr(alias, ':')) == NULL) return (0); p++; if (p - alias == len - 1 && (*p == 'a' || *p == 'b')) Modified: head/sys/fs/nfs/nfsport.h ============================================================================== --- head/sys/fs/nfs/nfsport.h Mon Jan 2 09:58:39 2012 (r229271) +++ head/sys/fs/nfs/nfsport.h Mon Jan 2 12:12:10 2012 (r229272) @@ -712,7 +712,7 @@ MALLOC_DECLARE(M_NEWNFSDROLLBACK); /* * Set this macro to index() or strchr(), whichever is supported. */ -#define STRCHR(s, c) index((s), (c)) +#define STRCHR(s, c) strchr((s), (c)) /* * Set the n_time in the client write rpc, as required. Modified: head/sys/fs/nwfs/nwfs_vfsops.c ============================================================================== --- head/sys/fs/nwfs/nwfs_vfsops.c Mon Jan 2 09:58:39 2012 (r229271) +++ head/sys/fs/nwfs/nwfs_vfsops.c Mon Jan 2 12:12:10 2012 (r229272) @@ -206,10 +206,10 @@ static int nwfs_mount(struct mount *mp) pe = pc+sizeof(mp->mnt_stat.f_mntfromname); bzero(pc, MNAMELEN); *(pc++) = '/'; - pc = index(strncpy(pc, conn->li.server, pe-pc-2),0); + pc = strchr(strncpy(pc, conn->li.server, pe - pc - 2), 0); if (pc < pe-1) { *(pc++) = ':'; - pc=index(strncpy(pc, conn->li.user, pe-pc-2),0); + pc = strchr(strncpy(pc, conn->li.user, pe - pc - 2), 0); if (pc < pe-1) { *(pc++) = '/'; strncpy(pc, nmp->m.mounted_vol, pe-pc-2); Modified: head/sys/fs/smbfs/smbfs_vfsops.c ============================================================================== --- head/sys/fs/smbfs/smbfs_vfsops.c Mon Jan 2 09:58:39 2012 (r229271) +++ head/sys/fs/smbfs/smbfs_vfsops.c Mon Jan 2 12:12:10 2012 (r229272) @@ -234,10 +234,10 @@ smbfs_mount(struct mount *mp) bzero(pc, MNAMELEN); *pc++ = '/'; *pc++ = '/'; - pc=index(strncpy(pc, vcp->vc_username, pe - pc - 2), 0); + pc = strchr(strncpy(pc, vcp->vc_username, pe - pc - 2), 0); if (pc < pe-1) { *(pc++) = '@'; - pc = index(strncpy(pc, vcp->vc_srvname, pe - pc - 2), 0); + pc = strchr(strncpy(pc, vcp->vc_srvname, pe - pc - 2), 0); if (pc < pe - 1) { *(pc++) = '/'; strncpy(pc, ssp->ss_name, pe - pc - 2); Modified: head/sys/fs/smbfs/smbfs_vnops.c ============================================================================== --- head/sys/fs/smbfs/smbfs_vnops.c Mon Jan 2 09:58:39 2012 (r229271) +++ head/sys/fs/smbfs/smbfs_vnops.c Mon Jan 2 12:12:10 2012 (r229272) @@ -1039,7 +1039,7 @@ smbfs_pathcheck(struct smbmount *smp, co * Backslash characters, being a path delimiter, are prohibited * within a path component even for LOOKUP operations. */ - if (index(name, '\\') != NULL) + if (strchr(name, '\\') != NULL) return ENOENT; if (nameiop == LOOKUP) @@ -1051,20 +1051,20 @@ smbfs_pathcheck(struct smbmount *smp, co */ if (nmlen > 12) return ENAMETOOLONG; - cp = index(name, '.'); + cp = strchr(name, '.'); if (cp == NULL) return error; if (cp == name || (cp - name) > 8) return error; - cp = index(cp + 1, '.'); + cp = strchr(cp + 1, '.'); if (cp != NULL) return error; for (cp = name, i = 0; i < nmlen; i++, cp++) - if (index(badchars83, *cp) != NULL) + if (strchr(badchars83, *cp) != NULL) return error; } for (cp = name, i = 0; i < nmlen; i++, cp++) - if (index(badchars, *cp) != NULL) + if (strchr(badchars, *cp) != NULL) return error; return 0; } Modified: head/sys/gnu/fs/xfs/xfs_vfsops.c ============================================================================== --- head/sys/gnu/fs/xfs/xfs_vfsops.c Mon Jan 2 09:58:39 2012 (r229271) +++ head/sys/gnu/fs/xfs/xfs_vfsops.c Mon Jan 2 12:12:10 2012 (r229272) @@ -1743,8 +1743,7 @@ xfs_parseargs( while ((this_char = strsep(&options, ",")) != NULL) { if (!*this_char) continue; - - if ((value = index(this_char, '=')) != NULL) + if ((value = strchr(this_char, '=')) != NULL) *value++ = 0; if (!strcmp(this_char, MNTOPT_LOGBUFS)) { Modified: head/sys/i386/ibcs2/ibcs2_socksys.c ============================================================================== --- head/sys/i386/ibcs2/ibcs2_socksys.c Mon Jan 2 09:58:39 2012 (r229271) +++ head/sys/i386/ibcs2/ibcs2_socksys.c Mon Jan 2 12:12:10 2012 (r229272) @@ -152,7 +152,7 @@ ibcs2_getipdomainname(td, uap) /* Get the domain name. */ getcredhostname(td->td_ucred, hname, sizeof(hname)); - dptr = index(hname, '.'); + dptr = strchr(hname, '.'); if ( dptr ) dptr++; else @@ -182,7 +182,7 @@ ibcs2_setipdomainname(td, uap) return EINVAL; /* Get the host's unqualified name (strip off the domain) */ - ptr = index(hname, '.'); + ptr = strchr(hname, '.'); if ( ptr != NULL ) { ptr++; *ptr = '\0'; Modified: head/sys/i386/ibcs2/ibcs2_stat.c ============================================================================== --- head/sys/i386/ibcs2/ibcs2_stat.c Mon Jan 2 09:58:39 2012 (r229271) +++ head/sys/i386/ibcs2/ibcs2_stat.c Mon Jan 2 12:12:10 2012 (r229272) @@ -212,7 +212,7 @@ ibcs2_utssys(td, uap) IBCS2_UNAME_VERSION, sizeof(sut.version) - 1); getcredhostname(td->td_ucred, machine_name, sizeof(machine_name) - 1); - p = index(machine_name, '.'); + p = strchr(machine_name, '.'); if ( p ) *p = '\0'; strncpy(sut.nodename, machine_name, sizeof(sut.nodename) - 1); Modified: head/sys/kern/kern_intr.c ============================================================================== --- head/sys/kern/kern_intr.c Mon Jan 2 09:58:39 2012 (r229271) +++ head/sys/kern/kern_intr.c Mon Jan 2 12:12:10 2012 (r229272) @@ -693,9 +693,9 @@ intr_event_describe_handler(struct intr_ * description at that point. If one is not found, find the * end of the name to use as the insertion point. */ - start = index(ih->ih_name, ':'); + start = strchr(ih->ih_name, ':'); if (start == NULL) - start = index(ih->ih_name, 0); + start = strchr(ih->ih_name, 0); /* * See if there is enough remaining room in the string for the @@ -1832,8 +1832,8 @@ DB_SHOW_COMMAND(intr, db_show_intr) struct intr_event *ie; int all, verbose; - verbose = index(modif, 'v') != NULL; - all = index(modif, 'a') != NULL; + verbose = strchr(modif, 'v') != NULL; + all = strchr(modif, 'a') != NULL; TAILQ_FOREACH(ie, &event_list, ie_list) { if (!all && TAILQ_EMPTY(&ie->ie_handlers)) continue; Modified: head/sys/kern/kern_ktr.c ============================================================================== --- head/sys/kern/kern_ktr.c Mon Jan 2 09:58:39 2012 (r229271) +++ head/sys/kern/kern_ktr.c Mon Jan 2 12:12:10 2012 (r229272) @@ -341,9 +341,9 @@ DB_SHOW_COMMAND(ktr, db_ktr_all) tstate.cur = (ktr_idx - 1) & (KTR_ENTRIES - 1); tstate.first = -1; db_ktr_verbose = 0; - db_ktr_verbose |= (index(modif, 'v') != NULL) ? 2 : 0; - db_ktr_verbose |= (index(modif, 'V') != NULL) ? 1 : 0; /* just timestap please */ - if (index(modif, 'a') != NULL) { + db_ktr_verbose |= (strchr(modif, 'v') != NULL) ? 2 : 0; + db_ktr_verbose |= (strchr(modif, 'V') != NULL) ? 1 : 0; /* just timestap please */ + if (strchr(modif, 'a') != NULL) { db_disable_pager(); while (cncheckc() != -1) if (db_mach_vtrace() == 0) Modified: head/sys/kern/kern_linker.c ============================================================================== --- head/sys/kern/kern_linker.c Mon Jan 2 09:58:39 2012 (r229271) +++ head/sys/kern/kern_linker.c Mon Jan 2 12:12:10 2012 (r229272) @@ -1013,7 +1013,7 @@ kern_kldload(struct thread *td, const ch * (kldname.ko, or kldname.ver.ko) treat it as an interface * name. */ - if (index(file, '/') || index(file, '.')) { + if (strchr(file, '/') || strchr(file, '.')) { kldname = file; modname = NULL; } else { @@ -1906,7 +1906,7 @@ linker_search_kld(const char *name) int len; /* qualified at all? */ - if (index(name, '/')) + if (strchr(name, '/')) return (linker_strdup(name)); /* traverse the linker path */ @@ -1927,7 +1927,7 @@ linker_basename(const char *path) { const char *filename; - filename = rindex(path, '/'); + filename = strrchr(path, '/'); if (filename == NULL) return path; if (filename[1]) Modified: head/sys/kern/subr_hints.c ============================================================================== --- head/sys/kern/subr_hints.c Mon Jan 2 09:58:39 2012 (r229271) +++ head/sys/kern/subr_hints.c Mon Jan 2 12:12:10 2012 (r229272) @@ -133,8 +133,7 @@ res_find(int *line, int *startln, r_name, &r_unit, r_resname, r_value); if (hit && n != 4) { printf("CONFIG: invalid hint '%s'\n", cp); - /* XXX: abuse bogus index() declaration */ - p = index(cp, 'h'); + p = strchr(cp, 'h'); *p = 'H'; hit = 0; } @@ -172,18 +171,18 @@ res_find(int *line, int *startln, s = cp; /* This is a bit of a hack, but at least is reentrant */ /* Note that it returns some !unterminated! strings. */ - s = index(s, '.') + 1; /* start of device */ + s = strchr(s, '.') + 1; /* start of device */ if (ret_name) *ret_name = s; - s = index(s, '.') + 1; /* start of unit */ + s = strchr(s, '.') + 1; /* start of unit */ if (ret_namelen && ret_name) *ret_namelen = s - *ret_name - 1; /* device length */ if (ret_unit) *ret_unit = r_unit; - s = index(s, '.') + 1; /* start of resname */ + s = strchr(s, '.') + 1; /* start of resname */ if (ret_resname) *ret_resname = s; - s = index(s, '=') + 1; /* start of value */ + s = strchr(s, '=') + 1; /* start of value */ if (ret_resnamelen && ret_resname) *ret_resnamelen = s - *ret_resname - 1; /* value len */ if (ret_value) Modified: head/sys/kern/tty_inq.c ============================================================================== --- head/sys/kern/tty_inq.c Mon Jan 2 09:58:39 2012 (r229271) +++ head/sys/kern/tty_inq.c Mon Jan 2 12:12:10 2012 (r229272) @@ -355,7 +355,7 @@ ttyinq_findchar(struct ttyinq *ti, const return (0); while (boff < bend) { - if (index(breakc, tib->tib_data[boff]) && !GETBIT(tib, boff)) { + if (strchr(breakc, tib->tib_data[boff]) && !GETBIT(tib, boff)) { *lastc = tib->tib_data[boff]; return (boff - ti->ti_begin + 1); } Modified: head/sys/kern/uipc_mqueue.c ============================================================================== --- head/sys/kern/uipc_mqueue.c Mon Jan 2 09:58:39 2012 (r229271) +++ head/sys/kern/uipc_mqueue.c Mon Jan 2 12:12:10 2012 (r229272) @@ -1974,7 +1974,7 @@ kern_kmq_open(struct thread *td, const c * characters. */ len = strlen(path); - if (len < 2 || path[0] != '/' || index(path + 1, '/') != NULL) + if (len < 2 || path[0] != '/' || strchr(path + 1, '/') != NULL) return (EINVAL); error = falloc(td, &fp, &fd, 0); @@ -2077,7 +2077,7 @@ sys_kmq_unlink(struct thread *td, struct return (error); len = strlen(path); - if (len < 2 || path[0] != '/' || index(path + 1, '/') != NULL) + if (len < 2 || path[0] != '/' || strchr(path + 1, '/') != NULL) return (EINVAL); sx_xlock(&mqfs_data.mi_lock); Modified: head/sys/libkern/fnmatch.c ============================================================================== --- head/sys/libkern/fnmatch.c Mon Jan 2 09:58:39 2012 (r229271) +++ head/sys/libkern/fnmatch.c Mon Jan 2 12:12:10 2012 (r229272) @@ -89,12 +89,12 @@ fnmatch(const char *pattern, const char if (c == EOS) if (flags & FNM_PATHNAME) return ((flags & FNM_LEADING_DIR) || - index(string, '/') == NULL ? + strchr(string, '/') == NULL ? 0 : FNM_NOMATCH); else return (0); else if (c == '/' && flags & FNM_PATHNAME) { - if ((string = index(string, '/')) == NULL) + if ((string = strchr(string, '/')) == NULL) return (FNM_NOMATCH); break; } Modified: head/sys/netgraph/ng_ksocket.c ============================================================================== --- head/sys/netgraph/ng_ksocket.c Mon Jan 2 09:58:39 2012 (r229271) +++ head/sys/netgraph/ng_ksocket.c Mon Jan 2 12:12:10 2012 (r229272) @@ -223,7 +223,7 @@ ng_ksocket_sockaddr_parse(const struct n /* Get socket address family followed by a slash */ while (isspace(s[*off])) (*off)++; - if ((t = index(s + *off, '/')) == NULL) + if ((t = strchr(s + *off, '/')) == NULL) return (EINVAL); if ((len = t - (s + *off)) > sizeof(fambuf) - 1) return (EINVAL); @@ -565,14 +565,14 @@ ng_ksocket_newhook(node_p node, hook_p h /* Extract family, type, and protocol from hook name */ snprintf(name, sizeof(name), "%s", name0); s1 = name; - if ((s2 = index(s1, '/')) == NULL) + if ((s2 = strchr(s1, '/')) == NULL) return (EINVAL); *s2++ = '\0'; family = ng_ksocket_parse(ng_ksocket_families, s1, 0); if (family == -1) return (EINVAL); s1 = s2; - if ((s2 = index(s1, '/')) == NULL) + if ((s2 = strchr(s1, '/')) == NULL) return (EINVAL); *s2++ = '\0'; type = ng_ksocket_parse(ng_ksocket_types, s1, 0); Modified: head/sys/security/mac_lomac/mac_lomac.c ============================================================================== --- head/sys/security/mac_lomac/mac_lomac.c Mon Jan 2 09:58:39 2012 (r229271) +++ head/sys/security/mac_lomac/mac_lomac.c Mon Jan 2 12:12:10 2012 (r229272) @@ -762,10 +762,10 @@ lomac_parse(struct mac_lomac *ml, char * /* Do we have a range? */ single = string; - range = index(string, '('); + range = strchr(string, '('); if (range == single) single = NULL; - auxsingle = index(string, '['); + auxsingle = strchr(string, '['); if (auxsingle == single) single = NULL; if (range != NULL && auxsingle != NULL) @@ -776,13 +776,13 @@ lomac_parse(struct mac_lomac *ml, char * *range = '\0'; range++; rangelow = range; - rangehigh = index(rangelow, '-'); + rangehigh = strchr(rangelow, '-'); if (rangehigh == NULL) return (EINVAL); rangehigh++; if (*rangelow == '\0' || *rangehigh == '\0') return (EINVAL); - rangeend = index(rangehigh, ')'); + rangeend = strchr(rangehigh, ')'); if (rangeend == NULL) return (EINVAL); if (*(rangeend + 1) != '\0') @@ -798,7 +798,7 @@ lomac_parse(struct mac_lomac *ml, char * /* Nul terminate the end of the single string. */ *auxsingle = '\0'; auxsingle++; - auxsingleend = index(auxsingle, ']'); + auxsingleend = strchr(auxsingle, ']'); if (auxsingleend == NULL) return (EINVAL); if (*(auxsingleend + 1) != '\0') From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 12:50:20 2012 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 53C1A1065672; Mon, 2 Jan 2012 12:50:20 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 371248FC0C; Mon, 2 Jan 2012 12:50:20 +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 q02CoK7F067350; Mon, 2 Jan 2012 12:50:20 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02CoJrt067344; Mon, 2 Jan 2012 12:50:19 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201021250.q02CoJrt067344@svn.freebsd.org> From: Dimitry Andric Date: Mon, 2 Jan 2012 12:50:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229273 - in stable/9/sys: conf modules/aic7xxx/ahc/ahc_pci modules/aic7xxx/ahd 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, 02 Jan 2012 12:50:20 -0000 Author: dim Date: Mon Jan 2 12:50:19 2012 New Revision: 229273 URL: http://svn.freebsd.org/changeset/base/229273 Log: MFC r228779: Start selectively disabling a few kernel build warnings for clang, since there are some places in the kernel where fixing them is too disruptive, or where there is a false positive. In this case, disable -Wconstant-conversion for two aic7xxx-related files, as they get the following warning on i386 (and possibly on other 32-bit arches): sys/dev/aic7xxx/ahc_pci.c:112:10: warning: implicit conversion from 'long long' to 'bus_addr_t' (aka 'unsigned int') changes value from 549755813887 to 4294967295 [-Wconstant-conversion] ? 0x7FFFFFFFFFLL ~~^~~~~~~~~~~~~~ This is a false positive, since the code only passes the 0x7FFFFFFFFFLL argument, if sizeof(bus_addr_t) is larger than 4 (e.g. on 64 bit arches, or when PAE is enabled on i386). The code could be refactored to do compile-time checks, but that is more disruptive. MFC r228789: Amend r228779 by also disabling -Wconstant-conversion warnings for the aic7xxx module. MFC r228805: Disable -Wconstant-conversion warnings for the aic7xxx module in a more fine-grained way: only add the option for the specific .c files that need them, like via sys/conf/files. Modified: stable/9/sys/conf/files stable/9/sys/conf/kern.mk stable/9/sys/modules/aic7xxx/ahc/ahc_pci/Makefile stable/9/sys/modules/aic7xxx/ahd/Makefile Directory Properties: stable/9/sys/ (props changed) stable/9/sys/conf/ (props changed) Modified: stable/9/sys/conf/files ============================================================================== --- stable/9/sys/conf/files Mon Jan 2 12:12:10 2012 (r229272) +++ stable/9/sys/conf/files Mon Jan 2 12:50:19 2012 (r229273) @@ -505,8 +505,10 @@ dev/aic/aic.c optional aic dev/aic/aic_pccard.c optional aic pccard dev/aic7xxx/ahc_eisa.c optional ahc eisa dev/aic7xxx/ahc_isa.c optional ahc isa -dev/aic7xxx/ahc_pci.c optional ahc pci -dev/aic7xxx/ahd_pci.c optional ahd pci +dev/aic7xxx/ahc_pci.c optional ahc pci \ + compile-with "${NORMAL_C} ${NO_WCONSTANT_CONVERSION}" +dev/aic7xxx/ahd_pci.c optional ahd pci \ + compile-with "${NORMAL_C} ${NO_WCONSTANT_CONVERSION}" dev/aic7xxx/aic7770.c optional ahc dev/aic7xxx/aic79xx.c optional ahd pci dev/aic7xxx/aic79xx_osm.c optional ahd pci Modified: stable/9/sys/conf/kern.mk ============================================================================== --- stable/9/sys/conf/kern.mk Mon Jan 2 12:12:10 2012 (r229272) +++ stable/9/sys/conf/kern.mk Mon Jan 2 12:50:19 2012 (r229273) @@ -11,6 +11,13 @@ CWARNFLAGS?= -Wall -Wredundant-decls -Wn # The following flags are next up for working on: # -Wextra +# Disable a few warnings for clang, since there are several places in the +# kernel where fixing them is more trouble than it is worth, or where there is +# a false positive. +.if ${CC:T:Mclang} == "clang" +NO_WCONSTANT_CONVERSION= -Wno-constant-conversion +.endif + # # On i386, do not align the stack to 16-byte boundaries. Otherwise GCC 2.95 # and above adds code to the entry and exit point of every function to align the Modified: stable/9/sys/modules/aic7xxx/ahc/ahc_pci/Makefile ============================================================================== --- stable/9/sys/modules/aic7xxx/ahc/ahc_pci/Makefile Mon Jan 2 12:12:10 2012 (r229272) +++ stable/9/sys/modules/aic7xxx/ahc/ahc_pci/Makefile Mon Jan 2 12:50:19 2012 (r229273) @@ -14,3 +14,6 @@ SRCS+= opt_scsi.h opt_cam.h opt_aic7xxx. CFLAGS+= -I${.CURDIR}/../../../../dev/aic7xxx -I.. .include + +CWARNFLAGS.ahc_pci.c= ${NO_WCONSTANT_CONVERSION} +CWARNFLAGS+= ${CWARNFLAGS.${.IMPSRC:T}} Modified: stable/9/sys/modules/aic7xxx/ahd/Makefile ============================================================================== --- stable/9/sys/modules/aic7xxx/ahd/Makefile Mon Jan 2 12:12:10 2012 (r229272) +++ stable/9/sys/modules/aic7xxx/ahd/Makefile Mon Jan 2 12:50:19 2012 (r229273) @@ -36,3 +36,6 @@ SRCS+= device_if.h bus_if.h pci_if.h CLEANFILES= ${GENSRCS} .include + +CWARNFLAGS.ahd_pci.c= ${NO_WCONSTANT_CONVERSION} +CWARNFLAGS+= ${CWARNFLAGS.${.IMPSRC:T}} From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 12:53:12 2012 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 B4E6D1065677; Mon, 2 Jan 2012 12:53:12 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 887F08FC17; Mon, 2 Jan 2012 12:53:12 +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 q02CrCcO067500; Mon, 2 Jan 2012 12:53:12 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02CrC41067496; Mon, 2 Jan 2012 12:53:12 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201021253.q02CrC41067496@svn.freebsd.org> From: Dimitry Andric Date: Mon, 2 Jan 2012 12:53:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229274 - in stable/9/sys: conf modules/asr 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, 02 Jan 2012 12:53:12 -0000 Author: dim Date: Mon Jan 2 12:53:11 2012 New Revision: 229274 URL: http://svn.freebsd.org/changeset/base/229274 Log: MFC r228781: When building with clang, disable -Warray-bounds for sys/dev/asr/asr.c, as it gets the following warning: sys/dev/asr/asr.c:1836:29: warning: array index of '58' indexes past the end of an array (that contains 1 element) [-Warray-bounds] while ((len > 0) && (sg < &((PPRIVATE_SCSI_SCB_EXECUTE_MESSAGE) ^ sys/dev/asr/i2omsg.h:934:8: note: array 'Simple' declared here I2O_SGE_SIMPLE_ELEMENT Simple[1]; ^ This is a false positive, since I2O_SG_ELEMENT::Simple is not declared as a C99 flexible array member, but in the old (but more portable) way. At run-time, the proper number of array elements will hopefully have been allocated. MFC r228865: Amend r228781 by also disabling -Warray-bounds warnings for the asr module. Modified: stable/9/sys/conf/files stable/9/sys/conf/kern.mk stable/9/sys/modules/asr/Makefile Directory Properties: stable/9/sys/ (props changed) stable/9/sys/conf/ (props changed) Modified: stable/9/sys/conf/files ============================================================================== --- stable/9/sys/conf/files Mon Jan 2 12:50:19 2012 (r229273) +++ stable/9/sys/conf/files Mon Jan 2 12:53:11 2012 (r229274) @@ -529,7 +529,8 @@ dev/an/if_an.c optional an dev/an/if_an_isa.c optional an isa dev/an/if_an_pccard.c optional an pccard dev/an/if_an_pci.c optional an pci -dev/asr/asr.c optional asr pci +dev/asr/asr.c optional asr pci \ + compile-with "${NORMAL_C} ${NO_WARRAY_BOUNDS}" # dev/ata/ata_if.m optional ata | atacore dev/ata/ata-all.c optional ata | atacore Modified: stable/9/sys/conf/kern.mk ============================================================================== --- stable/9/sys/conf/kern.mk Mon Jan 2 12:50:19 2012 (r229273) +++ stable/9/sys/conf/kern.mk Mon Jan 2 12:53:11 2012 (r229274) @@ -16,6 +16,7 @@ CWARNFLAGS?= -Wall -Wredundant-decls -Wn # a false positive. .if ${CC:T:Mclang} == "clang" NO_WCONSTANT_CONVERSION= -Wno-constant-conversion +NO_WARRAY_BOUNDS= -Wno-array-bounds .endif # Modified: stable/9/sys/modules/asr/Makefile ============================================================================== --- stable/9/sys/modules/asr/Makefile Mon Jan 2 12:50:19 2012 (r229273) +++ stable/9/sys/modules/asr/Makefile Mon Jan 2 12:53:11 2012 (r229274) @@ -12,3 +12,6 @@ SRCS+= opt_asr.h .endif .include + +CWARNFLAGS.asr.c= ${NO_WARRAY_BOUNDS} +CWARNFLAGS+= ${CWARNFLAGS.${.IMPSRC:T}} From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 13:01:57 2012 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 D07B61065675; Mon, 2 Jan 2012 13:01:57 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B41048FC19; Mon, 2 Jan 2012 13:01: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 q02D1vI4067859; Mon, 2 Jan 2012 13:01:57 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02D1vmg067855; Mon, 2 Jan 2012 13:01:57 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201021301.q02D1vmg067855@svn.freebsd.org> From: Dimitry Andric Date: Mon, 2 Jan 2012 13:01:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229275 - in stable/9/sys: conf modules/ath 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, 02 Jan 2012 13:01:58 -0000 Author: dim Date: Mon Jan 2 13:01:57 2012 New Revision: 229275 URL: http://svn.freebsd.org/changeset/base/229275 Log: MFC r228783: When building with clang, disable -Wshift-count-negative and -Wshift-count-overflow for sys/dev/ath/ath_hal/ah_regdomain.c, as it gets multiple instances of the following warnings: In file included from sys/dev/ath/ath_hal/ah_regdomain.c:99: sys/dev/ath/ath_hal/ah_regdomain/ah_rd_domains.h:69:15: warning: shift count is negative [-Wshift-count-negative] .chan11a = BM4(F1_4950_4980, ^~~~~~~~~~~~~~~~~ sys/dev/ath/ath_hal/ah_regdomain/ah_rd_domains.h:41:4: note: expanded from: W1(_fa) | W1(_fb) | W1(_fc) | W1(_fd) } ^ sys/dev/ath/ath_hal/ah_regdomain/ah_rd_domains.h:34:45: note: expanded from: (((_a) > 63 && (_a) < 128 ? (((uint64_t) 1)<<((_a)-64)) : (uint64_t) 0)) ^ ~~~~~~~~~ and: In file included from sys/dev/ath/ath_hal/ah_regdomain.c:99: sys/dev/ath/ath_hal/ah_regdomain/ah_rd_domains.h:629:15: error: shift count >= width of type [-Werror,-Wshift-count-overflow] .chan11a = BM4(W2_5260_5320, ^~~~~~~~~~~~~~~~~ sys/dev/ath/ath_hal/ah_regdomain/ah_rd_domains.h:40:34: note: expanded from: { W0(_fa) | W0(_fb) | W0(_fc) | W0(_fd), \ ^ sys/dev/ath/ath_hal/ah_regdomain/ah_rd_domains.h:32:44: note: expanded from: (((_a) >= 0 && (_a) < 64 ? (((uint64_t) 1)<<(_a)) : (uint64_t) 0)) ^ ~~~~ Both warnings are false positives, caused by LLVM PR 10030. For global initializations, clang fails to detect that the branch of the ternary operator causing the warning is dead. MFC r228793: Amend r228783 by also disabling -Wshift-count-negative -Wshift-count-overflow warnings for the ath module. MFC r228818: Disable various warnings for the ath module in a more fine-grained way: only add the option for the specific .c files that need them, like via sys/conf/files. Modified: stable/9/sys/conf/files stable/9/sys/conf/kern.mk stable/9/sys/modules/ath/Makefile Directory Properties: stable/9/sys/ (props changed) stable/9/sys/conf/ (props changed) Modified: stable/9/sys/conf/files ============================================================================== --- stable/9/sys/conf/files Mon Jan 2 12:53:11 2012 (r229274) +++ stable/9/sys/conf/files Mon Jan 2 13:01:57 2012 (r229275) @@ -611,7 +611,7 @@ dev/ath/ath_hal/ah_eeprom_9287.c \ optional ath_hal | ath_ar9287 \ compile-with "${NORMAL_C} -I$S/dev/ath" dev/ath/ath_hal/ah_regdomain.c optional ath \ - compile-with "${NORMAL_C} -I$S/dev/ath" + compile-with "${NORMAL_C} ${NO_WSHIFT_COUNT_NEGATIVE} ${NO_WSHIFT_COUNT_OVERFLOW} -I$S/dev/ath" # ar5210 dev/ath/ath_hal/ar5210/ar5210_attach.c optional ath_hal | ath_ar5210 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" Modified: stable/9/sys/conf/kern.mk ============================================================================== --- stable/9/sys/conf/kern.mk Mon Jan 2 12:53:11 2012 (r229274) +++ stable/9/sys/conf/kern.mk Mon Jan 2 13:01:57 2012 (r229275) @@ -17,6 +17,8 @@ CWARNFLAGS?= -Wall -Wredundant-decls -Wn .if ${CC:T:Mclang} == "clang" NO_WCONSTANT_CONVERSION= -Wno-constant-conversion NO_WARRAY_BOUNDS= -Wno-array-bounds +NO_WSHIFT_COUNT_NEGATIVE= -Wno-shift-count-negative +NO_WSHIFT_COUNT_OVERFLOW= -Wno-shift-count-overflow .endif # Modified: stable/9/sys/modules/ath/Makefile ============================================================================== --- stable/9/sys/modules/ath/Makefile Mon Jan 2 12:53:11 2012 (r229274) +++ stable/9/sys/modules/ath/Makefile Mon Jan 2 13:01:57 2012 (r229275) @@ -144,3 +144,6 @@ opt_ah.h: echo '#define AH_SUPPORT_AR5416 1' > $@ .include + +CWARNFLAGS.ah_regdomain.c= ${NO_WSHIFT_COUNT_NEGATIVE} ${NO_WSHIFT_COUNT_OVERFLOW} +CWARNFLAGS+= ${CWARNFLAGS.${.IMPSRC:T}} From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 13:03:14 2012 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 9327C1065670; Mon, 2 Jan 2012 13:03:14 +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 824098FC1D; Mon, 2 Jan 2012 13:03: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 q02D3EvJ067934; Mon, 2 Jan 2012 13:03:14 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02D3ER5067932; Mon, 2 Jan 2012 13:03:14 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201201021303.q02D3ER5067932@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Mon, 2 Jan 2012 13:03:14 +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: r229276 - head/sys/netinet6 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, 02 Jan 2012 13:03:14 -0000 Author: bz Date: Mon Jan 2 13:03:13 2012 New Revision: 229276 URL: http://svn.freebsd.org/changeset/base/229276 Log: Remove an uneeded inpcb forward declaration and align the function declaration following to match the style in the rest of the file. MFC after: 3 days Modified: head/sys/netinet6/in6_var.h Modified: head/sys/netinet6/in6_var.h ============================================================================== --- head/sys/netinet6/in6_var.h Mon Jan 2 13:01:57 2012 (r229275) +++ head/sys/netinet6/in6_var.h Mon Jan 2 13:03:13 2012 (r229276) @@ -791,8 +791,7 @@ void in6_ifremloop(struct ifaddr *); void in6_ifaddloop(struct ifaddr *); int in6_is_addr_deprecated __P((struct sockaddr_in6 *)); -struct inpcb; -int in6_src_ioctl __P((u_long, caddr_t)); +int in6_src_ioctl __P((u_long, caddr_t)); #endif /* _KERNEL */ #endif /* _NETINET6_IN6_VAR_H_ */ From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 13:12:54 2012 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 58497106564A; Mon, 2 Jan 2012 13:12:54 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 46B658FC0A; Mon, 2 Jan 2012 13:12: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 q02DCsvU068282; Mon, 2 Jan 2012 13:12:54 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02DCsjM068280; Mon, 2 Jan 2012 13:12:54 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201021312.q02DCsjM068280@svn.freebsd.org> From: Dimitry Andric Date: Mon, 2 Jan 2012 13:12:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229277 - stable/9 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, 02 Jan 2012 13:12:54 -0000 Author: dim Date: Mon Jan 2 13:12:53 2012 New Revision: 229277 URL: http://svn.freebsd.org/changeset/base/229277 Log: MFC r228801: Remove -mfancy-math from LIB32CPUFLAGS for amd64. It has been default for our gcc since more than three years (see r181534, which is also in stable/9 and stable/8). This flag used to be for the benefit of the old in-kernel math emulator, which was removed more than eight years ago. Pointed out by: arundel Modified: stable/9/Makefile.inc1 (contents, props changed) Modified: stable/9/Makefile.inc1 ============================================================================== --- stable/9/Makefile.inc1 Mon Jan 2 13:03:13 2012 (r229276) +++ stable/9/Makefile.inc1 Mon Jan 2 13:12:53 2012 (r229277) @@ -278,7 +278,6 @@ LIB32CPUFLAGS= -march=i686 -mmmx -msse - .else LIB32CPUFLAGS= -march=${TARGET_CPUTYPE} .endif -LIB32CPUFLAGS+= -mfancy-math-387 LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \ MACHINE_CPU="i686 mmx sse sse2" \ LD="${LD} -m elf_i386_fbsd -Y P,${LIB32TMP}/usr/lib32" \ From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 13:17:32 2012 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 52ECB106566B; Mon, 2 Jan 2012 13:17:32 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 26D468FC12; Mon, 2 Jan 2012 13:17: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 q02DHWpA068503; Mon, 2 Jan 2012 13:17:32 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02DHVqA068501; Mon, 2 Jan 2012 13:17:31 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201021317.q02DHVqA068501@svn.freebsd.org> From: Dimitry Andric Date: Mon, 2 Jan 2012 13:17:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229278 - stable/9/sys/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: Mon, 02 Jan 2012 13:17:32 -0000 Author: dim Date: Mon Jan 2 13:17:31 2012 New Revision: 229278 URL: http://svn.freebsd.org/changeset/base/229278 Log: MFC r228822: When building the kernel with clang, it produces several warnings which might be useful in some cases, but which are not severe enough to error out the whole kernel build. Display them anyway, so there is at least some incentive to fix them eventually. Start with -Wtautological-compare warnings. These usually occur when people check if unsigned quantities are negative, or similar cases. To clean these up would be painful, and might give problems if the base type which is compared against changes to signed later on. MFC r228841: Amend r228822 by not directly adding to CWARNFLAGS, but to an optional CWARNEXTRA variable, which gets included into the initial CWARNFLAGS setting. This makes it easier to override CWARNFLAGS with completely custom settings (including enabling any disabled warnings). Reminded by: arundel MFC r228860: Make another clang warning, -Wempty-body, non-fatal during kernel builds. All the instances of this warning in our tree are completely harmless. (Most of the empty bodies look to be used simply as reminder for the developer to add something later.) While here, assign to CWARNEXTRA with ?=, so it can be overridden easily, if needed. MFC r228867: Make another clang warning, -Wparentheses-equality, non-fatal during kernel builds. All the instances of this warning in our tree are completely harmless, and many people seem to like adding extra parentheses to make precedence clearer. Modified: stable/9/sys/conf/kern.mk Directory Properties: stable/9/sys/ (props changed) stable/9/sys/conf/ (props changed) Modified: stable/9/sys/conf/kern.mk ============================================================================== --- stable/9/sys/conf/kern.mk Mon Jan 2 13:12:53 2012 (r229277) +++ stable/9/sys/conf/kern.mk Mon Jan 2 13:17:31 2012 (r229278) @@ -6,7 +6,8 @@ CWARNFLAGS?= -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes \ -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual \ -Wundef -Wno-pointer-sign -fformat-extensions \ - -Wmissing-include-dirs -fdiagnostics-show-option + -Wmissing-include-dirs -fdiagnostics-show-option \ + ${CWARNEXTRA} # # The following flags are next up for working on: # -Wextra @@ -19,6 +20,11 @@ NO_WCONSTANT_CONVERSION= -Wno-constant-c NO_WARRAY_BOUNDS= -Wno-array-bounds NO_WSHIFT_COUNT_NEGATIVE= -Wno-shift-count-negative NO_WSHIFT_COUNT_OVERFLOW= -Wno-shift-count-overflow +# Several other warnings which might be useful in some cases, but not severe +# enough to error out the whole kernel build. Display them anyway, so there is +# some incentive to fix them eventually. +CWARNEXTRA?= -Wno-error-tautological-compare -Wno-error-empty-body \ + -Wno-error-parentheses-equality .endif # From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 13:20:02 2012 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 84D001065672; Mon, 2 Jan 2012 13:20:02 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7337A8FC08; Mon, 2 Jan 2012 13:20: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 q02DK2bh068636; Mon, 2 Jan 2012 13:20:02 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02DK2Bi068635; Mon, 2 Jan 2012 13:20:02 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201021320.q02DK2Bi068635@svn.freebsd.org> From: Dimitry Andric Date: Mon, 2 Jan 2012 13:20:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229279 - stable/9/sys/modules/nve 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, 02 Jan 2012 13:20:02 -0000 Author: dim Date: Mon Jan 2 13:20:01 2012 New Revision: 229279 URL: http://svn.freebsd.org/changeset/base/229279 Log: MFC r228861: Set WERROR= for the nve(4) module. This driver gives several warnings with clang, which will probably never be fixed, as it is unmaintained, and superseded by nfe(4). Modified: stable/9/sys/modules/nve/Makefile Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/modules/nve/Makefile ============================================================================== --- stable/9/sys/modules/nve/Makefile Mon Jan 2 13:17:31 2012 (r229278) +++ stable/9/sys/modules/nve/Makefile Mon Jan 2 13:20:01 2012 (r229279) @@ -7,6 +7,7 @@ SRCS= if_nve.c if_nvereg.h miidevs.h \ device_if.h bus_if.h pci_if.h miibus_if.h \ os+%DIKED-nve.h OBJS+= nvenetlib.o +WERROR= CLEANFILES+= nvenetlib.o os+%DIKED-nve.h nvenetlib.o: ${.CURDIR}/../../contrib/dev/nve/${MACHINE}/${.TARGET}.bz2.uu From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 13:21:35 2012 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 613D9106566B; Mon, 2 Jan 2012 13:21:35 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4FD068FC12; Mon, 2 Jan 2012 13:21: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 q02DLZjT068730; Mon, 2 Jan 2012 13:21:35 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02DLZuo068728; Mon, 2 Jan 2012 13:21:35 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201021321.q02DLZuo068728@svn.freebsd.org> From: Dimitry Andric Date: Mon, 2 Jan 2012 13:21:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229280 - stable/9/sys/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: Mon, 02 Jan 2012 13:21:35 -0000 Author: dim Date: Mon Jan 2 13:21:34 2012 New Revision: 229280 URL: http://svn.freebsd.org/changeset/base/229280 Log: MFC r228868: When building the kernel for amd64 with clang, don't attempt to use the -frename-registers option, as it is not supported. No change for builds with gcc. Modified: stable/9/sys/conf/kern.pre.mk Directory Properties: stable/9/sys/ (props changed) stable/9/sys/conf/ (props changed) Modified: stable/9/sys/conf/kern.pre.mk ============================================================================== --- stable/9/sys/conf/kern.pre.mk Mon Jan 2 13:20:01 2012 (r229279) +++ stable/9/sys/conf/kern.pre.mk Mon Jan 2 13:21:34 2012 (r229280) @@ -34,8 +34,12 @@ _MINUS_O= -O2 .endif .endif .if ${MACHINE_CPUARCH} == "amd64" +.if ${CC:T:Mclang} != "clang" COPTFLAGS?=-O2 -frename-registers -pipe .else +COPTFLAGS?=-O2 -pipe +.endif +.else COPTFLAGS?=${_MINUS_O} -pipe .endif .if !empty(COPTFLAGS:M-O[23s]) && empty(COPTFLAGS:M-fno-strict-aliasing) From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 14:43:34 2012 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 19291106566C; Mon, 2 Jan 2012 14:43:34 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 07A888FC14; Mon, 2 Jan 2012 14:43: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 q02EhXrD071278; Mon, 2 Jan 2012 14:43:33 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02EhXYR071276; Mon, 2 Jan 2012 14:43:33 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <201201021443.q02EhXYR071276@svn.freebsd.org> From: Ken Smith Date: Mon, 2 Jan 2012 14:43:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229281 - stable/9 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, 02 Jan 2012 14:43:34 -0000 Author: kensmith Date: Mon Jan 2 14:43:33 2012 New Revision: 229281 URL: http://svn.freebsd.org/changeset/base/229281 Log: Guess when we'll be ready to announce 9.0-RELEASE. Modified: stable/9/UPDATING Modified: stable/9/UPDATING ============================================================================== --- stable/9/UPDATING Mon Jan 2 13:21:34 2012 (r229280) +++ stable/9/UPDATING Mon Jan 2 14:43:33 2012 (r229281) @@ -9,6 +9,9 @@ handbook. Items affecting the ports and packages system can be found in /usr/ports/UPDATING. Please read that file before running portupgrade. +20120106: + 9.0-RELEASE. + 20111101: The broken amd(4) driver has been replaced with esp(4) in the amd64, i386 and pc98 GENERIC kernel configuration files. From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 14:44:29 2012 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 2805B106566B; Mon, 2 Jan 2012 14:44:29 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1700F8FC08; Mon, 2 Jan 2012 14:44: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 q02EiSPt071356; Mon, 2 Jan 2012 14:44:28 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02EiST6071354; Mon, 2 Jan 2012 14:44:28 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <201201021444.q02EiST6071354@svn.freebsd.org> From: Ken Smith Date: Mon, 2 Jan 2012 14:44:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229282 - releng/9.0 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, 02 Jan 2012 14:44:29 -0000 Author: kensmith Date: Mon Jan 2 14:44:28 2012 New Revision: 229282 URL: http://svn.freebsd.org/changeset/base/229282 Log: Guess when we'll be ready to announce 9.0-RELEASE. Approved by: re (implicit) Modified: releng/9.0/UPDATING Modified: releng/9.0/UPDATING ============================================================================== --- releng/9.0/UPDATING Mon Jan 2 14:43:33 2012 (r229281) +++ releng/9.0/UPDATING Mon Jan 2 14:44:28 2012 (r229282) @@ -9,6 +9,9 @@ handbook. Items affecting the ports and packages system can be found in /usr/ports/UPDATING. Please read that file before running portupgrade. +20120106: + 9.0-RELEASE. + 20111101: The broken amd(4) driver has been replaced with esp(4) in the amd64, i386 and pc98 GENERIC kernel configuration files. From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 14:45:30 2012 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 B14361065673; Mon, 2 Jan 2012 14:45:30 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A025E8FC17; Mon, 2 Jan 2012 14:45:30 +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 q02EjUEo071426; Mon, 2 Jan 2012 14:45:30 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02EjUqV071424; Mon, 2 Jan 2012 14:45:30 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <201201021445.q02EjUqV071424@svn.freebsd.org> From: Ken Smith Date: Mon, 2 Jan 2012 14:45:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229283 - releng/9.0/sys/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: Mon, 02 Jan 2012 14:45:30 -0000 Author: kensmith Date: Mon Jan 2 14:45:30 2012 New Revision: 229283 URL: http://svn.freebsd.org/changeset/base/229283 Log: Ready to start the 9.0-RELEASE builds. Approved by: re (implicit) Modified: releng/9.0/sys/conf/newvers.sh Modified: releng/9.0/sys/conf/newvers.sh ============================================================================== --- releng/9.0/sys/conf/newvers.sh Mon Jan 2 14:44:28 2012 (r229282) +++ releng/9.0/sys/conf/newvers.sh Mon Jan 2 14:45:30 2012 (r229283) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="9.0" -BRANCH="RC3" +BRANCH="RELEASE" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 16:02:31 2012 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 03253106566C; Mon, 2 Jan 2012 16:02:31 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E600B8FC17; Mon, 2 Jan 2012 16:02:30 +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 q02G2U0E073753; Mon, 2 Jan 2012 16:02:30 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02G2UEF073751; Mon, 2 Jan 2012 16:02:30 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201201021602.q02G2UEF073751@svn.freebsd.org> From: Bernhard Schmidt Date: Mon, 2 Jan 2012 16:02:30 +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: r229284 - head/sys/net80211 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, 02 Jan 2012 16:02:31 -0000 Author: bschmidt Date: Mon Jan 2 16:02:30 2012 New Revision: 229284 URL: http://svn.freebsd.org/changeset/base/229284 Log: MCS32 equals 32, not 8*ic_txstream. Modified: head/sys/net80211/ieee80211_ht.c Modified: head/sys/net80211/ieee80211_ht.c ============================================================================== --- head/sys/net80211/ieee80211_ht.c Mon Jan 2 14:45:30 2012 (r229283) +++ head/sys/net80211/ieee80211_ht.c Mon Jan 2 16:02:30 2012 (r229284) @@ -433,7 +433,7 @@ ieee80211_get_suphtrates(struct ieee8021 ADDRATE(i); if ((ic->ic_htcaps & IEEE80211_HTCAP_CHWIDTH40) && (ic->ic_htcaps & IEEE80211_HTC_TXMCS32)) - ADDRATE(i); + ADDRATE(32); if (ic->ic_htcaps & IEEE80211_HTC_TXUNEQUAL) { if (ic->ic_txstream >= 2) { for (i = 33; i <= 38; i++) From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 16:14:53 2012 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 42F74106564A; Mon, 2 Jan 2012 16:14:53 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 16AEF8FC0C; Mon, 2 Jan 2012 16:14:53 +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 q02GEq1V074215; Mon, 2 Jan 2012 16:14:52 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02GEqMH074211; Mon, 2 Jan 2012 16:14:52 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201201021614.q02GEqMH074211@svn.freebsd.org> From: Matthew D Fleming Date: Mon, 2 Jan 2012 16:14:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229285 - in stable/9: include sys/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: Mon, 02 Jan 2012 16:14:53 -0000 Author: mdf Date: Mon Jan 2 16:14:52 2012 New Revision: 229285 URL: http://svn.freebsd.org/changeset/base/229285 Log: MFC r228444: - Define true and false in sys/types.h for _KERNEL consumers, and typedef bool. Due to macro expansion it seemed better to use a typedef for kernel consumers (specifically ofed won't compile without more changes if a define is used). - should also not re-define bool/true/false if they are defined by . It would probably be a programming error to define _KERNEL for user-space code, but downstream consumers like Isilon have already been including in kernel sources, and this protects that usage. - sizeof(_Bool) is not necessarily the same as sizeof(int), so kernel modules should be rebuilt with this change. Bump __FreeBSD_version. No KBI change is expected based on review of the code. Modified: stable/9/include/stdbool.h stable/9/sys/sys/param.h stable/9/sys/sys/types.h Directory Properties: stable/9/include/ (props changed) stable/9/sys/ (props changed) Modified: stable/9/include/stdbool.h ============================================================================== --- stable/9/include/stdbool.h Mon Jan 2 16:02:30 2012 (r229284) +++ stable/9/include/stdbool.h Mon Jan 2 16:14:52 2012 (r229285) @@ -29,6 +29,7 @@ #ifndef _STDBOOL_H_ #define _STDBOOL_H_ +#ifndef __bool_true_false_are_defined #define __bool_true_false_are_defined 1 #ifndef __cplusplus @@ -42,5 +43,6 @@ typedef int _Bool; #endif #endif /* !__cplusplus */ +#endif /* __bool_true_false_are_defined */ #endif /* !_STDBOOL_H_ */ Modified: stable/9/sys/sys/param.h ============================================================================== --- stable/9/sys/sys/param.h Mon Jan 2 16:02:30 2012 (r229284) +++ stable/9/sys/sys/param.h Mon Jan 2 16:14:52 2012 (r229285) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 900044 /* Master, propagated to newvers */ +#define __FreeBSD_version 900045 /* Master, propagated to newvers */ #ifdef _KERNEL #define P_OSREL_SIGWAIT 700000 Modified: stable/9/sys/sys/types.h ============================================================================== --- stable/9/sys/sys/types.h Mon Jan 2 16:02:30 2012 (r229284) +++ stable/9/sys/sys/types.h Mon Jan 2 16:14:52 2012 (r229285) @@ -261,6 +261,16 @@ typedef __uint64_t uoff_t; typedef char vm_memattr_t; /* memory attribute codes */ typedef struct vm_page *vm_page_t; +#if !defined(__bool_true_false_are_defined) && !defined(__cplusplus) +#define __bool_true_false_are_defined 1 +#define false 0 +#define true 1 +#if __STDC_VERSION__ < 199901L && __GNUC__ < 3 && !defined(__INTEL_COMPILER) +typedef int _Bool; +#endif +typedef _Bool bool; +#endif /* !__bool_true_false_are_defined && !__cplusplus */ + #define offsetof(type, field) __offsetof(type, field) #endif /* !_KERNEL */ From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 16:45:30 2012 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 70281106564A; Mon, 2 Jan 2012 16:45:30 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 44F2D8FC1B; Mon, 2 Jan 2012 16:45:30 +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 q02GjUj4075247; Mon, 2 Jan 2012 16:45:30 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02GjUgA075246; Mon, 2 Jan 2012 16:45:30 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <201201021645.q02GjUgA075246@svn.freebsd.org> From: Ken Smith Date: Mon, 2 Jan 2012 16:45:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-release@freebsd.org X-SVN-Group: release MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229286 - release/9.0.0 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, 02 Jan 2012 16:45:30 -0000 Author: kensmith Date: Mon Jan 2 16:45:29 2012 New Revision: 229286 URL: http://svn.freebsd.org/changeset/base/229286 Log: Copy releng/9.0 to release/9.0.0 for the 9.0-RELEASE builds. Approved by: re (implicit) Added: - copied from r229285, releng/9.0/ Directory Properties: release/9.0.0/ (props changed) From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 16:54:22 2012 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 3898A106564A; Mon, 2 Jan 2012 16:54:22 +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 2683A8FC12; Mon, 2 Jan 2012 16:54: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 q02GsMib075614; Mon, 2 Jan 2012 16:54:22 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02GsLEo075612; Mon, 2 Jan 2012 16:54:21 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201201021654.q02GsLEo075612@svn.freebsd.org> From: Rick Macklem Date: Mon, 2 Jan 2012 16:54:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229287 - stable/9/sys/fs/nfsclient 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, 02 Jan 2012 16:54:22 -0000 Author: rmacklem Date: Mon Jan 2 16:54:21 2012 New Revision: 229287 URL: http://svn.freebsd.org/changeset/base/229287 Log: MFC: r227543 Modify the new NFS client so that nfs_fsync() only calls ncl_flush() for regular files. Since other file types don't write into the buffer cache, calling ncl_flush() is almost a no-op. However, it does clear the NMODIFIED flag and this shouldn't be done by nfs_fsync() for directories. Modified: stable/9/sys/fs/nfsclient/nfs_clvnops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/9/sys/fs/nfsclient/nfs_clvnops.c Mon Jan 2 16:45:29 2012 (r229286) +++ stable/9/sys/fs/nfsclient/nfs_clvnops.c Mon Jan 2 16:54:21 2012 (r229287) @@ -2580,6 +2580,16 @@ nfs_strategy(struct vop_strategy_args *a static int nfs_fsync(struct vop_fsync_args *ap) { + + if (ap->a_vp->v_type != VREG) { + /* + * For NFS, metadata is changed synchronously on the server, + * so there is nothing to flush. Also, ncl_flush() clears + * the NMODIFIED flag and that shouldn't be done here for + * directories. + */ + return (0); + } return (ncl_flush(ap->a_vp, ap->a_waitfor, NULL, ap->a_td, 1, 0)); } From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 17:02:46 2012 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 395B7106566C; Mon, 2 Jan 2012 17:02:45 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E165F8FC08; Mon, 2 Jan 2012 17:02: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 q02H2j6g075922; Mon, 2 Jan 2012 17:02:45 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02H2jct075917; Mon, 2 Jan 2012 17:02:45 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201021702.q02H2jct075917@svn.freebsd.org> From: Alexander Motin Date: Mon, 2 Jan 2012 17:02: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: r229288 - in head/sys/cam: ata scsi 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, 02 Jan 2012 17:02:46 -0000 Author: mav Date: Mon Jan 2 17:02:45 2012 New Revision: 229288 URL: http://svn.freebsd.org/changeset/base/229288 Log: Remove unneeded checks for CAM_DEV_QFRZN after cam_periph_runccb() call. cam_periph_runccb() since the beginning checks it and releases device queue. After r203108 it even clears CAM_DEV_QFRZN flag after that to avoid double release, so removed code is unreachable now. MFC after: 1 month Modified: head/sys/cam/ata/ata_da.c head/sys/cam/scsi/scsi_da.c head/sys/cam/scsi/scsi_sa.c head/sys/cam/scsi/scsi_ses.c Modified: head/sys/cam/ata/ata_da.c ============================================================================== --- head/sys/cam/ata/ata_da.c Mon Jan 2 16:54:21 2012 (r229287) +++ head/sys/cam/ata/ata_da.c Mon Jan 2 17:02:45 2012 (r229288) @@ -493,13 +493,6 @@ adaclose(struct disk *dp) if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) xpt_print(periph->path, "Synchronize cache failed\n"); - - if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) - cam_release_devq(ccb->ccb_h.path, - /*relsim_flags*/0, - /*reduction*/0, - /*timeout*/0, - /*getcount_only*/0); xpt_release_ccb(ccb); } Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Mon Jan 2 16:54:21 2012 (r229287) +++ head/sys/cam/scsi/scsi_da.c Mon Jan 2 17:02:45 2012 (r229288) @@ -990,13 +990,6 @@ daclose(struct disk *dp) } } - if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) - cam_release_devq(ccb->ccb_h.path, - /*relsim_flags*/0, - /*reduction*/0, - /*timeout*/0, - /*getcount_only*/0); - xpt_release_ccb(ccb); } @@ -2281,14 +2274,6 @@ dagetcapacity(struct cam_periph *periph) /*cam_flags*/CAM_RETRY_SELTO, sense_flags, softc->disk->d_devstat); - - if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) - cam_release_devq(ccb->ccb_h.path, - /*relsim_flags*/0, - /*reduction*/0, - /*timeout*/0, - /*getcount_only*/0); - if (error == 0) goto rc16ok; @@ -2326,14 +2311,6 @@ dagetcapacity(struct cam_periph *periph) /*cam_flags*/CAM_RETRY_SELTO, sense_flags, softc->disk->d_devstat); - - if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) - cam_release_devq(ccb->ccb_h.path, - /*relsim_flags*/0, - /*reduction*/0, - /*timeout*/0, - /*getcount_only*/0); - if (error == 0) { block_len = scsi_4btoul(rcap->length); maxsector = scsi_4btoul(rcap->addr); @@ -2360,14 +2337,6 @@ dagetcapacity(struct cam_periph *periph) /*cam_flags*/CAM_RETRY_SELTO, sense_flags, softc->disk->d_devstat); - - if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) - cam_release_devq(ccb->ccb_h.path, - /*relsim_flags*/0, - /*reduction*/0, - /*timeout*/0, - /*getcount_only*/0); - if (error == 0) { rc16ok: block_len = scsi_4btoul(rcaplong->length); Modified: head/sys/cam/scsi/scsi_sa.c ============================================================================== --- head/sys/cam/scsi/scsi_sa.c Mon Jan 2 16:54:21 2012 (r229287) +++ head/sys/cam/scsi/scsi_sa.c Mon Jan 2 17:02:45 2012 (r229288) @@ -1853,14 +1853,12 @@ samount(struct cam_periph *periph, int o MSG_SIMPLE_Q_TAG, SSD_FULL_SIZE, IO_TIMEOUT); error = cam_periph_runccb(ccb, saerror, 0, SF_NO_PRINT, softc->device_stats); - QFRLS(ccb); if (error == ENXIO) { softc->flags &= ~SA_FLAG_TAPE_MOUNTED; scsi_test_unit_ready(&ccb->csio, 0, sadone, MSG_SIMPLE_Q_TAG, SSD_FULL_SIZE, IO_TIMEOUT); error = cam_periph_runccb(ccb, saerror, 0, SF_NO_PRINT, softc->device_stats); - QFRLS(ccb); } else if (error) { /* * We don't need to freeze the tape because we @@ -1882,7 +1880,6 @@ samount(struct cam_periph *periph, int o MSG_SIMPLE_Q_TAG, SSD_FULL_SIZE, IO_TIMEOUT); error = cam_periph_runccb(ccb, saerror, 0, SF_NO_PRINT, softc->device_stats); - QFRLS(ccb); } if ((softc->flags & SA_FLAG_TAPE_MOUNTED) == 0) { @@ -1905,7 +1902,6 @@ samount(struct cam_periph *periph, int o FALSE, FALSE, 1, SSD_FULL_SIZE, REWIND_TIMEOUT); error = cam_periph_runccb(ccb, saerror, 0, SF_NO_PRINT, softc->device_stats); - QFRLS(ccb); /* * In case this doesn't work, do a REWIND instead @@ -1915,7 +1911,6 @@ samount(struct cam_periph *periph, int o FALSE, SSD_FULL_SIZE, REWIND_TIMEOUT); error = cam_periph_runccb(ccb, saerror, 0, SF_NO_PRINT, softc->device_stats); - QFRLS(ccb); } if (error) { xpt_release_ccb(ccb); @@ -1945,13 +1940,11 @@ samount(struct cam_periph *periph, int o IO_TIMEOUT); (void) cam_periph_runccb(ccb, saerror, 0, SF_NO_PRINT, softc->device_stats); - QFRLS(ccb); scsi_rewind(&ccb->csio, 1, sadone, MSG_SIMPLE_Q_TAG, FALSE, SSD_FULL_SIZE, REWIND_TIMEOUT); error = cam_periph_runccb(ccb, saerror, CAM_RETRY_SELTO, SF_NO_PRINT | SF_RETRY_UA, softc->device_stats); - QFRLS(ccb); if (error) { xpt_print(periph->path, "unable to rewind after test read\n"); @@ -1969,7 +1962,6 @@ samount(struct cam_periph *periph, int o error = cam_periph_runccb(ccb, saerror, CAM_RETRY_SELTO, SF_NO_PRINT | SF_RETRY_UA, softc->device_stats); - QFRLS(ccb); xpt_release_ccb(ccb); if (error != 0) { @@ -2580,7 +2572,6 @@ retry: error = cam_periph_runccb(ccb, saerror, 0, SF_NO_PRINT, softc->device_stats); - QFRLS(ccb); status = ccb->ccb_h.status & CAM_STATUS_MASK; @@ -2644,7 +2635,6 @@ retry: error = cam_periph_runccb(ccb, saerror, 0, SF_NO_PRINT, softc->device_stats); - QFRLS(ccb); if (error != 0) goto sagetparamsexit; @@ -2956,7 +2946,6 @@ retry: error = cam_periph_runccb(ccb, saerror, 0, sense_flags, softc->device_stats); - QFRLS(ccb); if (CAM_DEBUGGED(periph->path, CAM_DEBUG_INFO)) { int idx; @@ -3014,7 +3003,6 @@ retry: ccb->ccb_h.retry_count = 1; cam_periph_runccb(ccb, saerror, 0, sense_flags, softc->device_stats); - QFRLS(ccb); } xpt_release_ccb(ccb); @@ -3072,7 +3060,6 @@ saprevent(struct cam_periph *periph, int SSD_FULL_SIZE, SCSIOP_TIMEOUT); error = cam_periph_runccb(ccb, saerror, 0, sf, softc->device_stats); - QFRLS(ccb); if (error == 0) { if (action == PR_ALLOW) softc->flags &= ~SA_FLAG_TAPE_LOCKED; @@ -3102,9 +3089,6 @@ sarewind(struct cam_periph *periph) error = cam_periph_runccb(ccb, saerror, 0, 0, softc->device_stats); softc->dsreg = MTIO_DSREG_REST; - if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) - cam_release_devq(ccb->ccb_h.path, 0, 0, 0, FALSE); - xpt_release_ccb(ccb); if (error == 0) softc->fileno = softc->blkno = (daddr_t) 0; @@ -3138,9 +3122,6 @@ saspace(struct cam_periph *periph, int c error = cam_periph_runccb(ccb, saerror, 0, 0, softc->device_stats); softc->dsreg = MTIO_DSREG_REST; - if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) - cam_release_devq(ccb->ccb_h.path, 0, 0, 0, FALSE); - xpt_release_ccb(ccb); /* @@ -3212,9 +3193,6 @@ sawritefilemarks(struct cam_periph *peri error = cam_periph_runccb(ccb, saerror, 0, 0, softc->device_stats); - if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) - cam_release_devq(ccb->ccb_h.path, 0, 0, 0, FALSE); - if (error == 0 && nmarks) { struct sa_softc *softc = (struct sa_softc *)periph->softc; nwm = nmarks - softc->last_ctl_resid; @@ -3265,8 +3243,6 @@ sardpos(struct cam_periph *periph, int h softc->dsreg = MTIO_DSREG_RBSY; error = cam_periph_runccb(ccb, saerror, 0, 0, softc->device_stats); softc->dsreg = MTIO_DSREG_REST; - if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) - cam_release_devq(ccb->ccb_h.path, 0, 0, 0, 0); if (error == 0) { if (loc.flags & SA_RPOS_UNCERTAIN) { @@ -3306,8 +3282,6 @@ sasetpos(struct cam_periph *periph, int softc->dsreg = MTIO_DSREG_POS; error = cam_periph_runccb(ccb, saerror, 0, 0, softc->device_stats); softc->dsreg = MTIO_DSREG_REST; - if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) - cam_release_devq(ccb->ccb_h.path, 0, 0, 0, 0); xpt_release_ccb(ccb); /* * Note relative file && block number position as now unknown. @@ -3335,8 +3309,6 @@ saretension(struct cam_periph *periph) error = cam_periph_runccb(ccb, saerror, 0, 0, softc->device_stats); softc->dsreg = MTIO_DSREG_REST; - if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) - cam_release_devq(ccb->ccb_h.path, 0, 0, 0, FALSE); xpt_release_ccb(ccb); if (error == 0) softc->fileno = softc->blkno = (daddr_t) 0; @@ -3362,7 +3334,6 @@ sareservereleaseunit(struct cam_periph * error = cam_periph_runccb(ccb, saerror, 0, SF_RETRY_UA | SF_NO_PRINT, softc->device_stats); softc->dsreg = MTIO_DSREG_REST; - QFRLS(ccb); xpt_release_ccb(ccb); /* @@ -3394,7 +3365,6 @@ saloadunload(struct cam_periph *periph, softc->dsreg = (load)? MTIO_DSREG_LD : MTIO_DSREG_UNL; error = cam_periph_runccb(ccb, saerror, 0, 0, softc->device_stats); softc->dsreg = MTIO_DSREG_REST; - QFRLS(ccb); xpt_release_ccb(ccb); if (error || load == 0) @@ -3425,8 +3395,6 @@ saerase(struct cam_periph *periph, int l error = cam_periph_runccb(ccb, saerror, 0, 0, softc->device_stats); softc->dsreg = MTIO_DSREG_REST; - if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) - cam_release_devq(ccb->ccb_h.path, 0, 0, 0, FALSE); xpt_release_ccb(ccb); return (error); } Modified: head/sys/cam/scsi/scsi_ses.c ============================================================================== --- head/sys/cam/scsi/scsi_ses.c Mon Jan 2 16:54:21 2012 (r229287) +++ head/sys/cam/scsi/scsi_ses.c Mon Jan 2 17:02:45 2012 (r229288) @@ -679,8 +679,6 @@ ses_runcmd(struct ses_softc *ssc, char * bcopy(cdb, ccb->csio.cdb_io.cdb_bytes, cdbl); error = cam_periph_runccb(ccb, seserror, SES_CFLAGS, SES_FLAGS, NULL); - if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) - cam_release_devq(ccb->ccb_h.path, 0, 0, 0, FALSE); if (error) { if (dptr) { *dlenp = dlen; From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 17:13:57 2012 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 4D762106564A; Mon, 2 Jan 2012 17:13:57 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2158A8FC08; Mon, 2 Jan 2012 17:13: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 q02HDusO076357; Mon, 2 Jan 2012 17:13:56 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02HDuo7076354; Mon, 2 Jan 2012 17:13:56 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201021713.q02HDuo7076354@svn.freebsd.org> From: Alexander Motin Date: Mon, 2 Jan 2012 17:13:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229289 - stable/9/sys/dev/ahci 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, 02 Jan 2012 17:13:57 -0000 Author: mav Date: Mon Jan 2 17:13:56 2012 New Revision: 229289 URL: http://svn.freebsd.org/changeset/base/229289 Log: MFC r227635: Change the way how "not implemented" AHCI channels handled. Instead of completely skipping them, create ahcich devices for them to allocate unit numbers, but mark them as disabled to prevent driver probe and attach. Last time some BIOSes tend to report unused channels as "not implemented". This change makes ahcichX devices numbering consistent, independently of connected disks. It makes per-channel driver hints usable and CAM devices wiring possible on such systems. Modified: stable/9/sys/dev/ahci/ahci.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/ahci/ahci.c ============================================================================== --- stable/9/sys/dev/ahci/ahci.c Mon Jan 2 17:02:45 2012 (r229288) +++ stable/9/sys/dev/ahci/ahci.c Mon Jan 2 17:13:56 2012 (r229289) @@ -498,13 +498,14 @@ ahci_attach(device_t dev) } /* Attach all channels on this controller */ for (unit = 0; unit < ctlr->channels; unit++) { - if ((ctlr->ichannels & (1 << unit)) == 0) - continue; child = device_add_child(dev, "ahcich", -1); - if (child == NULL) + if (child == NULL) { device_printf(dev, "failed to add channel device\n"); - else - device_set_ivars(child, (void *)(intptr_t)unit); + continue; + } + device_set_ivars(child, (void *)(intptr_t)unit); + if ((ctlr->ichannels & (1 << unit)) == 0) + device_disable(child); } bus_generic_attach(dev); return 0; From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 17:16:09 2012 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 6D8F3106566C; Mon, 2 Jan 2012 17:16:09 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5BAA28FC15; Mon, 2 Jan 2012 17:16:09 +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 q02HG9GR076483; Mon, 2 Jan 2012 17:16:09 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02HG9Yi076481; Mon, 2 Jan 2012 17:16:09 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201021716.q02HG9Yi076481@svn.freebsd.org> From: Alexander Motin Date: Mon, 2 Jan 2012 17:16:09 +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: r229290 - in stable/8/sys: conf dev/ahci 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, 02 Jan 2012 17:16:09 -0000 Author: mav Date: Mon Jan 2 17:16:08 2012 New Revision: 229290 URL: http://svn.freebsd.org/changeset/base/229290 Log: MFC r227635: Change the way how "not implemented" AHCI channels handled. Instead of completely skipping them, create ahcich devices for them to allocate unit numbers, but mark them as disabled to prevent driver probe and attach. Last time some BIOSes tend to report unused channels as "not implemented". This change makes ahcichX devices numbering consistent, independently of connected disks. It makes per-channel driver hints usable and CAM devices wiring possible on such systems. Modified: stable/8/sys/dev/ahci/ahci.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/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/ahci/ahci.c ============================================================================== --- stable/8/sys/dev/ahci/ahci.c Mon Jan 2 17:13:56 2012 (r229289) +++ stable/8/sys/dev/ahci/ahci.c Mon Jan 2 17:16:08 2012 (r229290) @@ -498,13 +498,14 @@ ahci_attach(device_t dev) } /* Attach all channels on this controller */ for (unit = 0; unit < ctlr->channels; unit++) { - if ((ctlr->ichannels & (1 << unit)) == 0) - continue; child = device_add_child(dev, "ahcich", -1); - if (child == NULL) + if (child == NULL) { device_printf(dev, "failed to add channel device\n"); - else - device_set_ivars(child, (void *)(intptr_t)unit); + continue; + } + device_set_ivars(child, (void *)(intptr_t)unit); + if ((ctlr->ichannels & (1 << unit)) == 0) + device_disable(child); } bus_generic_attach(dev); return 0; From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 17:19:58 2012 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 C56D5106566B; Mon, 2 Jan 2012 17:19:58 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A9D268FC0A; Mon, 2 Jan 2012 17:19: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 q02HJwQP076669; Mon, 2 Jan 2012 17:19:58 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02HJw9O076663; Mon, 2 Jan 2012 17:19:58 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201021719.q02HJw9O076663@svn.freebsd.org> From: Alexander Motin Date: Mon, 2 Jan 2012 17:19:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229291 - in stable/9: share/man/man4 sys/dev/ahci sys/dev/ata/chipsets 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, 02 Jan 2012 17:19:58 -0000 Author: mav Date: Mon Jan 2 17:19:58 2012 New Revision: 229291 URL: http://svn.freebsd.org/changeset/base/229291 Log: MFC r228200: Add hw.ahci.force tunable to control whether AHCI drivers should attach to known AHCI-capable chips (AMD/NVIDIA), configured for legacy emulation. Enabled by default to get additional performance and functionality of AHCI when it can't be enabled by BIOS. Can be disabled to honor BIOS settings if needed for some reason. Modified: stable/9/share/man/man4/ahci.4 stable/9/sys/dev/ahci/ahci.c stable/9/sys/dev/ata/chipsets/ata-ati.c stable/9/sys/dev/ata/chipsets/ata-nvidia.c Directory Properties: stable/9/share/man/man4/ (props changed) stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/share/man/man4/ahci.4 ============================================================================== --- stable/9/share/man/man4/ahci.4 Mon Jan 2 17:16:08 2012 (r229290) +++ stable/9/share/man/man4/ahci.4 Mon Jan 2 17:19:58 2012 (r229291) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 17, 2011 +.Dd December 2, 2011 .Dt AHCI 4 .Os .Sh NAME @@ -96,6 +96,9 @@ A manual bus reset is needed on device h .It Va hint.ahcich. Ns Ar X Ns Va .sata_rev setting to nonzero value limits maximum SATA revision (speed). Values 1, 2 and 3 are respectively 1.5, 3 and 6Gbps. +.It Va hw.ahci.force +setting to nonzero value forces driver attach to some known AHCI-capable +chips even if they are configured for legacy IDE emulation. Default is 1. .El .Sh DESCRIPTION This driver provides the Modified: stable/9/sys/dev/ahci/ahci.c ============================================================================== --- stable/9/sys/dev/ahci/ahci.c Mon Jan 2 17:16:08 2012 (r229290) +++ stable/9/sys/dev/ahci/ahci.c Mon Jan 2 17:19:58 2012 (r229291) @@ -291,6 +291,9 @@ static struct { #define RECOVERY_REQUEST_SENSE 2 #define recovery_slot spriv_field1 +static int force_ahci = 1; +TUNABLE_INT("hw.ahci.force", &force_ahci); + static int ahci_probe(device_t dev) { @@ -308,7 +311,8 @@ ahci_probe(device_t dev) for (i = 0; ahci_ids[i].id != 0; i++) { if (ahci_ids[i].id == devid && ahci_ids[i].rev <= revid && - (valid || !(ahci_ids[i].quirks & AHCI_Q_NOFORCE))) { + (valid || (force_ahci == 1 && + !(ahci_ids[i].quirks & AHCI_Q_NOFORCE)))) { /* Do not attach JMicrons with single PCI function. */ if (pci_get_vendor(dev) == 0x197b && (pci_read_config(dev, 0xdf, 1) & 0x40) == 0) Modified: stable/9/sys/dev/ata/chipsets/ata-ati.c ============================================================================== --- stable/9/sys/dev/ata/chipsets/ata-ati.c Mon Jan 2 17:16:08 2012 (r229290) +++ stable/9/sys/dev/ata/chipsets/ata-ati.c Mon Jan 2 17:19:58 2012 (r229291) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); /* local prototypes */ static int ata_ati_chipinit(device_t dev); +static int ata_ati_dumb_ch_attach(device_t dev); static int ata_ati_ixp700_ch_attach(device_t dev); static int ata_ati_setmode(device_t dev, int target, int mode); @@ -63,6 +64,8 @@ static int ata_ati_setmode(device_t dev, #define SII_MEMIO 1 #define SII_BUG 0x04 +static int force_ahci = 1; +TUNABLE_INT("hw.ahci.force", &force_ahci); /* * ATI chipset support functions @@ -111,7 +114,10 @@ ata_ati_probe(device_t dev) ctlr->chipinit = ata_sii_chipinit; break; case ATI_AHCI: - ctlr->chipinit = ata_ahci_chipinit; + if (force_ahci == 1 || pci_get_subclass(dev) != PCIS_STORAGE_IDE) + ctlr->chipinit = ata_ahci_chipinit; + else + ctlr->chipinit = ata_ati_chipinit; break; } return (BUS_PROBE_DEFAULT); @@ -127,6 +133,11 @@ ata_ati_chipinit(device_t dev) if (ata_setup_interrupt(dev, ata_generic_intr)) return ENXIO; + if (ctlr->chip->cfg1 == ATI_AHCI) { + ctlr->ch_attach = ata_ati_dumb_ch_attach; + ctlr->setmode = ata_sata_setmode; + return (0); + } switch (ctlr->chip->chipid) { case ATA_ATI_IXP600: /* IXP600 only has 1 PATA channel */ @@ -165,6 +176,17 @@ ata_ati_chipinit(device_t dev) } static int +ata_ati_dumb_ch_attach(device_t dev) +{ + struct ata_channel *ch = device_get_softc(dev); + + if (ata_pci_ch_attach(dev)) + return ENXIO; + ch->flags |= ATA_SATA; + return (0); +} + +static int ata_ati_ixp700_ch_attach(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); Modified: stable/9/sys/dev/ata/chipsets/ata-nvidia.c ============================================================================== --- stable/9/sys/dev/ata/chipsets/ata-nvidia.c Mon Jan 2 17:16:08 2012 (r229290) +++ stable/9/sys/dev/ata/chipsets/ata-nvidia.c Mon Jan 2 17:19:58 2012 (r229291) @@ -65,6 +65,8 @@ static int ata_nvidia_setmode(device_t d #define NVAHCI 0x04 #define NVNOFORCE 0x08 +static int force_ahci = 1; +TUNABLE_INT("hw.ahci.force", &force_ahci); /* * nVidia chipset support functions @@ -181,7 +183,7 @@ ata_nvidia_probe(device_t dev) ata_set_desc(dev); if ((ctlr->chip->cfg1 & NVAHCI) && - ((ctlr->chip->cfg1 & NVNOFORCE) == 0 || + ((force_ahci == 1 && (ctlr->chip->cfg1 & NVNOFORCE) == 0) || pci_get_subclass(dev) != PCIS_STORAGE_IDE)) ctlr->chipinit = ata_ahci_chipinit; else From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 17:21:42 2012 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 1A463106564A; Mon, 2 Jan 2012 17:21:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F2F318FC0C; Mon, 2 Jan 2012 17:21: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 q02HLfCX076788; Mon, 2 Jan 2012 17:21:41 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02HLfBu076783; Mon, 2 Jan 2012 17:21:41 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201021721.q02HLfBu076783@svn.freebsd.org> From: Alexander Motin Date: Mon, 2 Jan 2012 17:21:41 +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: r229292 - in stable/8: share/man/man4 sys/conf sys/dev/ahci sys/dev/ata/chipsets 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, 02 Jan 2012 17:21:42 -0000 Author: mav Date: Mon Jan 2 17:21:41 2012 New Revision: 229292 URL: http://svn.freebsd.org/changeset/base/229292 Log: MFC r228200: Add hw.ahci.force tunable to control whether AHCI drivers should attach to known AHCI-capable chips (AMD/NVIDIA), configured for legacy emulation. Enabled by default to get additional performance and functionality of AHCI when it can't be enabled by BIOS. Can be disabled to honor BIOS settings if needed for some reason. Modified: stable/8/share/man/man4/ahci.4 stable/8/sys/dev/ahci/ahci.c stable/8/sys/dev/ata/chipsets/ata-ati.c stable/8/sys/dev/ata/chipsets/ata-nvidia.c Directory Properties: stable/8/share/man/man4/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/share/man/man4/ahci.4 ============================================================================== --- stable/8/share/man/man4/ahci.4 Mon Jan 2 17:19:58 2012 (r229291) +++ stable/8/share/man/man4/ahci.4 Mon Jan 2 17:21:41 2012 (r229292) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 17, 2011 +.Dd December 2, 2011 .Dt AHCI 4 .Os .Sh NAME @@ -97,6 +97,9 @@ A manual bus reset is needed on device h .It Va hint.ahcich. Ns Ar X Ns Va .sata_rev setting to nonzero value limits maximum SATA revision (speed). Values 1, 2 and 3 are respectively 1.5, 3 and 6Gbps. +.It Va hw.ahci.force +setting to nonzero value forces driver attach to some known AHCI-capable +chips even if they are configured for legacy IDE emulation. Default is 1. .El .Sh DESCRIPTION This driver provides the Modified: stable/8/sys/dev/ahci/ahci.c ============================================================================== --- stable/8/sys/dev/ahci/ahci.c Mon Jan 2 17:19:58 2012 (r229291) +++ stable/8/sys/dev/ahci/ahci.c Mon Jan 2 17:21:41 2012 (r229292) @@ -291,6 +291,9 @@ static struct { #define RECOVERY_REQUEST_SENSE 2 #define recovery_slot spriv_field1 +static int force_ahci = 1; +TUNABLE_INT("hw.ahci.force", &force_ahci); + static int ahci_probe(device_t dev) { @@ -308,7 +311,8 @@ ahci_probe(device_t dev) for (i = 0; ahci_ids[i].id != 0; i++) { if (ahci_ids[i].id == devid && ahci_ids[i].rev <= revid && - (valid || !(ahci_ids[i].quirks & AHCI_Q_NOFORCE))) { + (valid || (force_ahci == 1 && + !(ahci_ids[i].quirks & AHCI_Q_NOFORCE)))) { /* Do not attach JMicrons with single PCI function. */ if (pci_get_vendor(dev) == 0x197b && (pci_read_config(dev, 0xdf, 1) & 0x40) == 0) Modified: stable/8/sys/dev/ata/chipsets/ata-ati.c ============================================================================== --- stable/8/sys/dev/ata/chipsets/ata-ati.c Mon Jan 2 17:19:58 2012 (r229291) +++ stable/8/sys/dev/ata/chipsets/ata-ati.c Mon Jan 2 17:21:41 2012 (r229292) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); /* local prototypes */ static int ata_ati_chipinit(device_t dev); +static int ata_ati_dumb_ch_attach(device_t dev); static int ata_ati_ixp700_ch_attach(device_t dev); static int ata_ati_setmode(device_t dev, int target, int mode); @@ -63,6 +64,8 @@ static int ata_ati_setmode(device_t dev, #define SII_MEMIO 1 #define SII_BUG 0x04 +static int force_ahci = 1; +TUNABLE_INT("hw.ahci.force", &force_ahci); /* * ATI chipset support functions @@ -111,7 +114,10 @@ ata_ati_probe(device_t dev) ctlr->chipinit = ata_sii_chipinit; break; case ATI_AHCI: - ctlr->chipinit = ata_ahci_chipinit; + if (force_ahci == 1 || pci_get_subclass(dev) != PCIS_STORAGE_IDE) + ctlr->chipinit = ata_ahci_chipinit; + else + ctlr->chipinit = ata_ati_chipinit; break; } return (BUS_PROBE_DEFAULT); @@ -127,6 +133,11 @@ ata_ati_chipinit(device_t dev) if (ata_setup_interrupt(dev, ata_generic_intr)) return ENXIO; + if (ctlr->chip->cfg1 == ATI_AHCI) { + ctlr->ch_attach = ata_ati_dumb_ch_attach; + ctlr->setmode = ata_sata_setmode; + return (0); + } switch (ctlr->chip->chipid) { case ATA_ATI_IXP600: /* IXP600 only has 1 PATA channel */ @@ -165,6 +176,17 @@ ata_ati_chipinit(device_t dev) } static int +ata_ati_dumb_ch_attach(device_t dev) +{ + struct ata_channel *ch = device_get_softc(dev); + + if (ata_pci_ch_attach(dev)) + return ENXIO; + ch->flags |= ATA_SATA; + return (0); +} + +static int ata_ati_ixp700_ch_attach(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); Modified: stable/8/sys/dev/ata/chipsets/ata-nvidia.c ============================================================================== --- stable/8/sys/dev/ata/chipsets/ata-nvidia.c Mon Jan 2 17:19:58 2012 (r229291) +++ stable/8/sys/dev/ata/chipsets/ata-nvidia.c Mon Jan 2 17:21:41 2012 (r229292) @@ -65,6 +65,8 @@ static int ata_nvidia_setmode(device_t d #define NVAHCI 0x04 #define NVNOFORCE 0x08 +static int force_ahci = 1; +TUNABLE_INT("hw.ahci.force", &force_ahci); /* * nVidia chipset support functions @@ -181,7 +183,7 @@ ata_nvidia_probe(device_t dev) ata_set_desc(dev); if ((ctlr->chip->cfg1 & NVAHCI) && - ((ctlr->chip->cfg1 & NVNOFORCE) == 0 || + ((force_ahci == 1 && (ctlr->chip->cfg1 & NVNOFORCE) == 0) || pci_get_subclass(dev) != PCIS_STORAGE_IDE)) ctlr->chipinit = ata_ahci_chipinit; else From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 17:27:08 2012 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 02F76106566B; Mon, 2 Jan 2012 17:27:08 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E4FEB8FC12; Mon, 2 Jan 2012 17:27: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 q02HR7oG077102; Mon, 2 Jan 2012 17:27:07 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02HR73V077098; Mon, 2 Jan 2012 17:27:07 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201021727.q02HR73V077098@svn.freebsd.org> From: Alexander Motin Date: Mon, 2 Jan 2012 17:27:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229293 - stable/9/sys/dev/ata 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, 02 Jan 2012 17:27:08 -0000 Author: mav Date: Mon Jan 2 17:27:07 2012 New Revision: 229293 URL: http://svn.freebsd.org/changeset/base/229293 Log: MFC r226680: Some dmesg cosmetics: - for the legacy PCI ATA channels move channel number out of the device description, same as it is for ahci(4), siis(4) and mvs(4); - add device description for the ISA ATA channels. Modified: stable/9/sys/dev/ata/ata-isa.c stable/9/sys/dev/ata/ata-pci.c stable/9/sys/dev/ata/ata-pci.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/ata/ata-isa.c ============================================================================== --- stable/9/sys/dev/ata/ata-isa.c Mon Jan 2 17:21:41 2012 (r229292) +++ stable/9/sys/dev/ata/ata-isa.c Mon Jan 2 17:27:07 2012 (r229293) @@ -92,6 +92,7 @@ ata_isa_probe(device_t dev) bus_release_resource(dev, SYS_RES_IOPORT, ATA_CTLADDR_RID, ctlio); bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, io); + device_set_desc(dev, "ATA channel"); return (ata_probe(dev)); } Modified: stable/9/sys/dev/ata/ata-pci.c ============================================================================== --- stable/9/sys/dev/ata/ata-pci.c Mon Jan 2 17:21:41 2012 (r229292) +++ stable/9/sys/dev/ata/ata-pci.c Mon Jan 2 17:27:07 2012 (r229293) @@ -540,6 +540,19 @@ ata_pci_dmafini(device_t dev) } int +ata_pci_print_child(device_t dev, device_t child) +{ + int retval; + + retval = bus_print_child_header(dev, child); + retval += printf(" at channel %d", + (int)(intptr_t)device_get_ivars(child)); + retval += bus_print_child_footer(dev, child); + + return (retval); +} + +int ata_pci_child_location_str(device_t dev, device_t child, char *buf, size_t buflen) { @@ -569,6 +582,7 @@ static device_method_t ata_pci_methods[] DEVMETHOD(bus_teardown_intr, ata_pci_teardown_intr), DEVMETHOD(pci_read_config, ata_pci_read_config), DEVMETHOD(pci_write_config, ata_pci_write_config), + DEVMETHOD(bus_print_child, ata_pci_print_child), DEVMETHOD(bus_child_location_str, ata_pci_child_location_str), { 0, 0 } @@ -589,12 +603,10 @@ MODULE_DEPEND(atapci, ata, 1, 1, 1); static int ata_pcichannel_probe(device_t dev) { - char buffer[32]; if ((intptr_t)device_get_ivars(dev) < 0) return (ENXIO); - sprintf(buffer, "ATA channel %d", (int)(intptr_t)device_get_ivars(dev)); - device_set_desc_copy(dev, buffer); + device_set_desc(dev, "ATA channel"); return ata_probe(dev); } Modified: stable/9/sys/dev/ata/ata-pci.h ============================================================================== --- stable/9/sys/dev/ata/ata-pci.h Mon Jan 2 17:21:41 2012 (r229292) +++ stable/9/sys/dev/ata/ata-pci.h Mon Jan 2 17:27:07 2012 (r229293) @@ -549,6 +549,7 @@ int ata_pci_write_ivar(device_t dev, dev uint32_t ata_pci_read_config(device_t dev, device_t child, int reg, int width); void ata_pci_write_config(device_t dev, device_t child, int reg, uint32_t val, int width); +int ata_pci_print_child(device_t dev, device_t child); int ata_pci_child_location_str(device_t dev, device_t child, char *buf, size_t buflen); struct resource * ata_pci_alloc_resource(device_t dev, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags); @@ -601,6 +602,7 @@ static device_method_t __CONCAT(dname,_m DEVMETHOD(bus_teardown_intr, ata_pci_teardown_intr), \ DEVMETHOD(pci_read_config, ata_pci_read_config), \ DEVMETHOD(pci_write_config, ata_pci_write_config), \ + DEVMETHOD(bus_print_child, ata_pci_print_child), \ DEVMETHOD(bus_child_location_str, ata_pci_child_location_str), \ { 0, 0 } \ }; \ From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 17:28:15 2012 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 06C241065675; Mon, 2 Jan 2012 17:28:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E8BF98FC18; Mon, 2 Jan 2012 17:28: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 q02HSEgl077190; Mon, 2 Jan 2012 17:28:14 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02HSEQg077186; Mon, 2 Jan 2012 17:28:14 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201021728.q02HSEQg077186@svn.freebsd.org> From: Alexander Motin Date: Mon, 2 Jan 2012 17:28: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: r229294 - in stable/8/sys: conf dev/ata 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, 02 Jan 2012 17:28:15 -0000 Author: mav Date: Mon Jan 2 17:28:14 2012 New Revision: 229294 URL: http://svn.freebsd.org/changeset/base/229294 Log: MFC r226680: Some dmesg cosmetics: - for the legacy PCI ATA channels move channel number out of the device description, same as it is for ahci(4), siis(4) and mvs(4); - add device description for the ISA ATA channels. Modified: stable/8/sys/dev/ata/ata-isa.c stable/8/sys/dev/ata/ata-pci.c stable/8/sys/dev/ata/ata-pci.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/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/ata/ata-isa.c ============================================================================== --- stable/8/sys/dev/ata/ata-isa.c Mon Jan 2 17:27:07 2012 (r229293) +++ stable/8/sys/dev/ata/ata-isa.c Mon Jan 2 17:28:14 2012 (r229294) @@ -92,6 +92,7 @@ ata_isa_probe(device_t dev) bus_release_resource(dev, SYS_RES_IOPORT, ATA_CTLADDR_RID, ctlio); bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, io); + device_set_desc(dev, "ATA channel"); return (ata_probe(dev)); } Modified: stable/8/sys/dev/ata/ata-pci.c ============================================================================== --- stable/8/sys/dev/ata/ata-pci.c Mon Jan 2 17:27:07 2012 (r229293) +++ stable/8/sys/dev/ata/ata-pci.c Mon Jan 2 17:28:14 2012 (r229294) @@ -545,6 +545,19 @@ ata_pci_dmafini(device_t dev) } int +ata_pci_print_child(device_t dev, device_t child) +{ + int retval; + + retval = bus_print_child_header(dev, child); + retval += printf(" at channel %d", + (int)(intptr_t)device_get_ivars(child)); + retval += bus_print_child_footer(dev, child); + + return (retval); +} + +int ata_pci_child_location_str(device_t dev, device_t child, char *buf, size_t buflen) { @@ -574,6 +587,7 @@ static device_method_t ata_pci_methods[] DEVMETHOD(bus_teardown_intr, ata_pci_teardown_intr), DEVMETHOD(pci_read_config, ata_pci_read_config), DEVMETHOD(pci_write_config, ata_pci_write_config), + DEVMETHOD(bus_print_child, ata_pci_print_child), DEVMETHOD(bus_child_location_str, ata_pci_child_location_str), { 0, 0 } @@ -594,12 +608,10 @@ MODULE_DEPEND(atapci, ata, 1, 1, 1); static int ata_pcichannel_probe(device_t dev) { - char buffer[32]; if ((intptr_t)device_get_ivars(dev) < 0) return (ENXIO); - sprintf(buffer, "ATA channel %d", (int)(intptr_t)device_get_ivars(dev)); - device_set_desc_copy(dev, buffer); + device_set_desc(dev, "ATA channel"); return ata_probe(dev); } Modified: stable/8/sys/dev/ata/ata-pci.h ============================================================================== --- stable/8/sys/dev/ata/ata-pci.h Mon Jan 2 17:27:07 2012 (r229293) +++ stable/8/sys/dev/ata/ata-pci.h Mon Jan 2 17:28:14 2012 (r229294) @@ -549,6 +549,7 @@ int ata_pci_write_ivar(device_t dev, dev uint32_t ata_pci_read_config(device_t dev, device_t child, int reg, int width); void ata_pci_write_config(device_t dev, device_t child, int reg, uint32_t val, int width); +int ata_pci_print_child(device_t dev, device_t child); int ata_pci_child_location_str(device_t dev, device_t child, char *buf, size_t buflen); struct resource * ata_pci_alloc_resource(device_t dev, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags); @@ -601,6 +602,7 @@ static device_method_t __CONCAT(dname,_m DEVMETHOD(bus_teardown_intr, ata_pci_teardown_intr), \ DEVMETHOD(pci_read_config, ata_pci_read_config), \ DEVMETHOD(pci_write_config, ata_pci_write_config), \ + DEVMETHOD(bus_print_child, ata_pci_print_child), \ DEVMETHOD(bus_child_location_str, ata_pci_child_location_str), \ { 0, 0 } \ }; \ From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 17:30:28 2012 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 5CCB1106564A; Mon, 2 Jan 2012 17:30:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 307DA8FC12; Mon, 2 Jan 2012 17:30: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 q02HUSGt077312; Mon, 2 Jan 2012 17:30:28 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02HUR93077309; Mon, 2 Jan 2012 17:30:27 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201021730.q02HUR93077309@svn.freebsd.org> From: Alexander Motin Date: Mon, 2 Jan 2012 17:30:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229295 - in stable/9/sys/dev/ata: . chipsets 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, 02 Jan 2012 17:30:28 -0000 Author: mav Date: Mon Jan 2 17:30:27 2012 New Revision: 229295 URL: http://svn.freebsd.org/changeset/base/229295 Log: MFC r228497: Add PCI IDs for the Intel ICH9M SATA controllers. Modified: stable/9/sys/dev/ata/ata-pci.h stable/9/sys/dev/ata/chipsets/ata-intel.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/ata/ata-pci.h ============================================================================== --- stable/9/sys/dev/ata/ata-pci.h Mon Jan 2 17:28:14 2012 (r229294) +++ stable/9/sys/dev/ata/ata-pci.h Mon Jan 2 17:30:27 2012 (r229295) @@ -193,6 +193,10 @@ struct ata_pci_controller { #define ATA_I82801IB_AH4 0x29238086 #define ATA_I82801IB_R1 0x29258086 #define ATA_I82801IB_S2 0x29268086 +#define ATA_I82801IBM_S1 0x29288086 +#define ATA_I82801IBM_AH 0x29298086 +#define ATA_I82801IBM_R1 0x292a8086 +#define ATA_I82801IBM_S2 0x292d8086 #define ATA_I82801JIB_S1 0x3a208086 #define ATA_I82801JIB_AH 0x3a228086 #define ATA_I82801JIB_R1 0x3a258086 Modified: stable/9/sys/dev/ata/chipsets/ata-intel.c ============================================================================== --- stable/9/sys/dev/ata/chipsets/ata-intel.c Mon Jan 2 17:28:14 2012 (r229294) +++ stable/9/sys/dev/ata/chipsets/ata-intel.c Mon Jan 2 17:30:27 2012 (r229295) @@ -157,6 +157,10 @@ ata_intel_probe(device_t dev) { ATA_I82801IB_AH4, 0, INTEL_AHCI, 0, ATA_SA300, "ICH9" }, { ATA_I82801IB_AH6, 0, INTEL_AHCI, 0, ATA_SA300, "ICH9" }, { ATA_I82801IB_R1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH9" }, + { ATA_I82801IBM_S1, 0, INTEL_6CH2, 0, ATA_SA300, "ICH9M" }, + { ATA_I82801IBM_AH, 0, INTEL_AHCI, 0, ATA_SA300, "ICH9M" }, + { ATA_I82801IBM_R1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH9M" }, + { ATA_I82801IBM_S2, 0, INTEL_6CH2, 0, ATA_SA300, "ICH9M" }, { ATA_I82801JIB_S1, 0, INTEL_6CH, 0, ATA_SA300, "ICH10" }, { ATA_I82801JIB_AH, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, { ATA_I82801JIB_R1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 17:31:29 2012 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 966C0106564A; Mon, 2 Jan 2012 17:31:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6A4168FC1C; Mon, 2 Jan 2012 17:31: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 q02HVToJ077405; Mon, 2 Jan 2012 17:31:29 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02HVTXY077402; Mon, 2 Jan 2012 17:31:29 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201021731.q02HVTXY077402@svn.freebsd.org> From: Alexander Motin Date: Mon, 2 Jan 2012 17:31:29 +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: r229296 - in stable/8/sys: conf dev/ata dev/ata/chipsets 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, 02 Jan 2012 17:31:29 -0000 Author: mav Date: Mon Jan 2 17:31:28 2012 New Revision: 229296 URL: http://svn.freebsd.org/changeset/base/229296 Log: MFC r228497: Add PCI IDs for the Intel ICH9M SATA controllers. Modified: stable/8/sys/dev/ata/ata-pci.h stable/8/sys/dev/ata/chipsets/ata-intel.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/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/ata/ata-pci.h ============================================================================== --- stable/8/sys/dev/ata/ata-pci.h Mon Jan 2 17:30:27 2012 (r229295) +++ stable/8/sys/dev/ata/ata-pci.h Mon Jan 2 17:31:28 2012 (r229296) @@ -193,6 +193,10 @@ struct ata_pci_controller { #define ATA_I82801IB_AH4 0x29238086 #define ATA_I82801IB_R1 0x29258086 #define ATA_I82801IB_S2 0x29268086 +#define ATA_I82801IBM_S1 0x29288086 +#define ATA_I82801IBM_AH 0x29298086 +#define ATA_I82801IBM_R1 0x292a8086 +#define ATA_I82801IBM_S2 0x292d8086 #define ATA_I82801JIB_S1 0x3a208086 #define ATA_I82801JIB_AH 0x3a228086 #define ATA_I82801JIB_R1 0x3a258086 Modified: stable/8/sys/dev/ata/chipsets/ata-intel.c ============================================================================== --- stable/8/sys/dev/ata/chipsets/ata-intel.c Mon Jan 2 17:30:27 2012 (r229295) +++ stable/8/sys/dev/ata/chipsets/ata-intel.c Mon Jan 2 17:31:28 2012 (r229296) @@ -157,6 +157,10 @@ ata_intel_probe(device_t dev) { ATA_I82801IB_AH4, 0, INTEL_AHCI, 0, ATA_SA300, "ICH9" }, { ATA_I82801IB_AH6, 0, INTEL_AHCI, 0, ATA_SA300, "ICH9" }, { ATA_I82801IB_R1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH9" }, + { ATA_I82801IBM_S1, 0, INTEL_6CH2, 0, ATA_SA300, "ICH9M" }, + { ATA_I82801IBM_AH, 0, INTEL_AHCI, 0, ATA_SA300, "ICH9M" }, + { ATA_I82801IBM_R1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH9M" }, + { ATA_I82801IBM_S2, 0, INTEL_6CH2, 0, ATA_SA300, "ICH9M" }, { ATA_I82801JIB_S1, 0, INTEL_6CH, 0, ATA_SA300, "ICH10" }, { ATA_I82801JIB_AH, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, { ATA_I82801JIB_R1, 0, INTEL_AHCI, 0, ATA_SA300, "ICH10" }, From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 17:36:14 2012 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 AA2B7106566B; Mon, 2 Jan 2012 17:36:14 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8F5DC8FC15; Mon, 2 Jan 2012 17:36: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 q02HaEV5077702; Mon, 2 Jan 2012 17:36:14 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02HaEXw077699; Mon, 2 Jan 2012 17:36:14 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201021736.q02HaEXw077699@svn.freebsd.org> From: Alexander Motin Date: Mon, 2 Jan 2012 17:36:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229297 - stable/9/sys/cam 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, 02 Jan 2012 17:36:14 -0000 Author: mav Date: Mon Jan 2 17:36:14 2012 New Revision: 229297 URL: http://svn.freebsd.org/changeset/base/229297 Log: MFC r227637: Introduce CAM_SIM_POLLED SIM flag, indicating that it works in polling mode. It blocks CAM SWI usage on requests completion, unneeded because of polling and denied during kernel dumping because of blocked scheduler. Before r198899 there was periph flag CAM_PERIPH_POLLED, but that was wrong, because there is whole SIM is polled or handled by SWI, not a single periph. Modified: stable/9/sys/cam/cam_sim.h stable/9/sys/cam/cam_xpt.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/cam/cam_sim.h ============================================================================== --- stable/9/sys/cam/cam_sim.h Mon Jan 2 17:31:28 2012 (r229296) +++ stable/9/sys/cam/cam_sim.h Mon Jan 2 17:36:14 2012 (r229297) @@ -104,7 +104,8 @@ struct cam_sim { u_int32_t flags; #define CAM_SIM_REL_TIMEOUT_PENDING 0x01 #define CAM_SIM_MPSAFE 0x02 -#define CAM_SIM_ON_DONEQ 0x04 +#define CAM_SIM_ON_DONEQ 0x04 +#define CAM_SIM_POLLED 0x08 struct callout callout; struct cam_devq *devq; /* Device Queue to use for this SIM */ int refcount; /* References to the SIM. */ Modified: stable/9/sys/cam/cam_xpt.c ============================================================================== --- stable/9/sys/cam/cam_xpt.c Mon Jan 2 17:31:28 2012 (r229296) +++ stable/9/sys/cam/cam_xpt.c Mon Jan 2 17:36:14 2012 (r229297) @@ -2957,6 +2957,9 @@ xpt_polled_action(union ccb *start_ccb) mtx_assert(sim->mtx, MA_OWNED); + /* Don't use ISR for this SIM while polling. */ + sim->flags |= CAM_SIM_POLLED; + /* * Steal an opening so that no other queued requests * can get it before us while we simulate interrupts. @@ -2996,6 +2999,9 @@ xpt_polled_action(union ccb *start_ccb) } else { start_ccb->ccb_h.status = CAM_RESRC_UNAVAIL; } + + /* We will use CAM ISR for this SIM again. */ + sim->flags &= ~CAM_SIM_POLLED; } /* @@ -4224,7 +4230,7 @@ xpt_done(union ccb *done_ccb) TAILQ_INSERT_TAIL(&sim->sim_doneq, &done_ccb->ccb_h, sim_links.tqe); done_ccb->ccb_h.pinfo.index = CAM_DONEQ_INDEX; - if ((sim->flags & CAM_SIM_ON_DONEQ) == 0) { + if ((sim->flags & (CAM_SIM_ON_DONEQ | CAM_SIM_POLLED)) == 0) { mtx_lock(&cam_simq_lock); first = TAILQ_EMPTY(&cam_simq); TAILQ_INSERT_TAIL(&cam_simq, sim, links); From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 17:38:07 2012 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 756801065670; Mon, 2 Jan 2012 17:38:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4936E8FC0C; Mon, 2 Jan 2012 17:38: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 q02Hc7V4077807; Mon, 2 Jan 2012 17:38:07 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02Hc75F077804; Mon, 2 Jan 2012 17:38:07 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201021738.q02Hc75F077804@svn.freebsd.org> From: Alexander Motin Date: Mon, 2 Jan 2012 17:38:07 +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: r229298 - in stable/8/sys: cam 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: Mon, 02 Jan 2012 17:38:07 -0000 Author: mav Date: Mon Jan 2 17:38:06 2012 New Revision: 229298 URL: http://svn.freebsd.org/changeset/base/229298 Log: MFC r227637: Introduce CAM_SIM_POLLED SIM flag, indicating that it works in polling mode. It blocks CAM SWI usage on requests completion, unneeded because of polling and denied during kernel dumping because of blocked scheduler. Before r198899 there was periph flag CAM_PERIPH_POLLED, but that was wrong, because there is whole SIM is polled or handled by SWI, not a single periph. Modified: stable/8/sys/cam/cam_sim.h stable/8/sys/cam/cam_xpt.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/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/cam/cam_sim.h ============================================================================== --- stable/8/sys/cam/cam_sim.h Mon Jan 2 17:36:14 2012 (r229297) +++ stable/8/sys/cam/cam_sim.h Mon Jan 2 17:38:06 2012 (r229298) @@ -104,7 +104,8 @@ struct cam_sim { u_int32_t flags; #define CAM_SIM_REL_TIMEOUT_PENDING 0x01 #define CAM_SIM_MPSAFE 0x02 -#define CAM_SIM_ON_DONEQ 0x04 +#define CAM_SIM_ON_DONEQ 0x04 +#define CAM_SIM_POLLED 0x08 struct callout callout; struct cam_devq *devq; /* Device Queue to use for this SIM */ int refcount; /* References to the SIM. */ Modified: stable/8/sys/cam/cam_xpt.c ============================================================================== --- stable/8/sys/cam/cam_xpt.c Mon Jan 2 17:36:14 2012 (r229297) +++ stable/8/sys/cam/cam_xpt.c Mon Jan 2 17:38:06 2012 (r229298) @@ -2903,6 +2903,9 @@ xpt_polled_action(union ccb *start_ccb) mtx_assert(sim->mtx, MA_OWNED); + /* Don't use ISR for this SIM while polling. */ + sim->flags |= CAM_SIM_POLLED; + /* * Steal an opening so that no other queued requests * can get it before us while we simulate interrupts. @@ -2942,6 +2945,9 @@ xpt_polled_action(union ccb *start_ccb) } else { start_ccb->ccb_h.status = CAM_RESRC_UNAVAIL; } + + /* We will use CAM ISR for this SIM again. */ + sim->flags &= ~CAM_SIM_POLLED; } /* @@ -4103,7 +4109,7 @@ xpt_done(union ccb *done_ccb) TAILQ_INSERT_TAIL(&sim->sim_doneq, &done_ccb->ccb_h, sim_links.tqe); done_ccb->ccb_h.pinfo.index = CAM_DONEQ_INDEX; - if ((sim->flags & CAM_SIM_ON_DONEQ) == 0) { + if ((sim->flags & (CAM_SIM_ON_DONEQ | CAM_SIM_POLLED)) == 0) { mtx_lock(&cam_simq_lock); first = TAILQ_EMPTY(&cam_simq); TAILQ_INSERT_TAIL(&cam_simq, sim, links); From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 17:39:19 2012 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 9C7CA1065676; Mon, 2 Jan 2012 17:39:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 707A68FC0A; Mon, 2 Jan 2012 17: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 q02HdJEw077885; Mon, 2 Jan 2012 17:39:19 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02HdJGL077883; Mon, 2 Jan 2012 17:39:19 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201021739.q02HdJGL077883@svn.freebsd.org> From: Alexander Motin Date: Mon, 2 Jan 2012 17:39:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229299 - stable/9/sys/cam/ata 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, 02 Jan 2012 17:39:19 -0000 Author: mav Date: Mon Jan 2 17:39:18 2012 New Revision: 229299 URL: http://svn.freebsd.org/changeset/base/229299 Log: MFC r228819: Update list of 4K physical sector hard drives. Modified: stable/9/sys/cam/ata/ata_da.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/cam/ata/ata_da.c ============================================================================== --- stable/9/sys/cam/ata/ata_da.c Mon Jan 2 17:38:06 2012 (r229298) +++ stable/9/sys/cam/ata/ata_da.c Mon Jan 2 17:39:18 2012 (r229299) @@ -165,6 +165,11 @@ static struct ada_quirk_entry ada_quirk_ }, { /* Samsung Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "SAMSUNG HD155UI*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* Samsung Advanced Format (4k) drives */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "SAMSUNG HD204UI*", "*" }, /*quirks*/ADA_Q_4K }, @@ -174,6 +179,16 @@ static struct ada_quirk_entry ada_quirk_ /*quirks*/ADA_Q_4K }, { + /* Seagate Barracuda Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST???DM*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* Seagate Barracuda Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST????DM*", "*" }, + /*quirks*/ADA_Q_4K + }, + { /* Seagate Momentus Advanced Format (4k) drives */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST9500423AS*", "*" }, /*quirks*/ADA_Q_4K @@ -185,6 +200,16 @@ static struct ada_quirk_entry ada_quirk_ }, { /* Seagate Momentus Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST9640423AS*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* Seagate Momentus Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST9640424AS*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* Seagate Momentus Advanced Format (4k) drives */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST9750420AS*", "*" }, /*quirks*/ADA_Q_4K }, @@ -194,6 +219,11 @@ static struct ada_quirk_entry ada_quirk_ /*quirks*/ADA_Q_4K }, { + /* Seagate Momentus Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST9750423AS*", "*" }, + /*quirks*/ADA_Q_4K + }, + { /* Seagate Momentus Thin Advanced Format (4k) drives */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST???LT*", "*" }, /*quirks*/ADA_Q_4K From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 17:40:21 2012 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 322F01065689; Mon, 2 Jan 2012 17:40:21 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 05BFA8FC0C; Mon, 2 Jan 2012 17: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 q02HeKg9077970; Mon, 2 Jan 2012 17:40:20 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02HeKq8077968; Mon, 2 Jan 2012 17:40:20 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201021740.q02HeKq8077968@svn.freebsd.org> From: Alexander Motin Date: Mon, 2 Jan 2012 17:40:20 +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: r229300 - in stable/8/sys: cam/ata 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: Mon, 02 Jan 2012 17:40:21 -0000 Author: mav Date: Mon Jan 2 17:40:20 2012 New Revision: 229300 URL: http://svn.freebsd.org/changeset/base/229300 Log: MFC r228819: Update list of 4K physical sector hard drives. Modified: stable/8/sys/cam/ata/ata_da.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/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/cam/ata/ata_da.c ============================================================================== --- stable/8/sys/cam/ata/ata_da.c Mon Jan 2 17:39:18 2012 (r229299) +++ stable/8/sys/cam/ata/ata_da.c Mon Jan 2 17:40:20 2012 (r229300) @@ -163,6 +163,11 @@ static struct ada_quirk_entry ada_quirk_ }, { /* Samsung Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "SAMSUNG HD155UI*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* Samsung Advanced Format (4k) drives */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "SAMSUNG HD204UI*", "*" }, /*quirks*/ADA_Q_4K }, @@ -172,6 +177,16 @@ static struct ada_quirk_entry ada_quirk_ /*quirks*/ADA_Q_4K }, { + /* Seagate Barracuda Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST???DM*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* Seagate Barracuda Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST????DM*", "*" }, + /*quirks*/ADA_Q_4K + }, + { /* Seagate Momentus Advanced Format (4k) drives */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST9500423AS*", "*" }, /*quirks*/ADA_Q_4K @@ -183,6 +198,16 @@ static struct ada_quirk_entry ada_quirk_ }, { /* Seagate Momentus Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST9640423AS*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* Seagate Momentus Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST9640424AS*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* Seagate Momentus Advanced Format (4k) drives */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST9750420AS*", "*" }, /*quirks*/ADA_Q_4K }, @@ -192,6 +217,11 @@ static struct ada_quirk_entry ada_quirk_ /*quirks*/ADA_Q_4K }, { + /* Seagate Momentus Advanced Format (4k) drives */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST9750423AS*", "*" }, + /*quirks*/ADA_Q_4K + }, + { /* Seagate Momentus Thin Advanced Format (4k) drives */ { T_DIRECT, SIP_MEDIA_FIXED, "*", "ST???LT*", "*" }, /*quirks*/ADA_Q_4K From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 17:56:46 2012 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 87EA3106564A; Mon, 2 Jan 2012 17:56:46 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 74ECA8FC0C; Mon, 2 Jan 2012 17:56:46 +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 q02Huk59078726; Mon, 2 Jan 2012 17:56:46 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02HukTK078721; Mon, 2 Jan 2012 17:56:46 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201021756.q02HukTK078721@svn.freebsd.org> From: Alexander Motin Date: Mon, 2 Jan 2012 17:56:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229301 - in stable/9: sbin/geom/class/raid sys/geom/raid 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, 02 Jan 2012 17:56:46 -0000 Author: mav Date: Mon Jan 2 17:56:45 2012 New Revision: 229301 URL: http://svn.freebsd.org/changeset/base/229301 Log: MFC r226816: Clarify disks/volumes above 2TiB support in geom_raid: - add support for volumes above 2TiB with Promise metadata format; - enforse and document other limitations: - Intel and Promise metadata formats do not support disks above 2TiB; - NVIDIA metadata format does not support volumes above 2TiB. Sponsored by: iXsystems, Inc. Modified: stable/9/sbin/geom/class/raid/graid.8 stable/9/sys/geom/raid/md_intel.c stable/9/sys/geom/raid/md_nvidia.c stable/9/sys/geom/raid/md_promise.c Directory Properties: stable/9/sbin/geom/ (props changed) stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sbin/geom/class/raid/graid.8 ============================================================================== --- stable/9/sbin/geom/class/raid/graid.8 Mon Jan 2 17:40:20 2012 (r229300) +++ stable/9/sbin/geom/class/raid/graid.8 Mon Jan 2 17:56:45 2012 (r229301) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 22, 2011 +.Dd October 26, 2011 .Dt GRAID 8 .Os .Sh NAME @@ -250,6 +250,9 @@ If you started migration using BIOS or i complete it there. Do not run GEOM RAID class on migrating volumes under pain of possible data corruption! +.Sh 2TiB BARRIERS +Intel and Promise metadata formats do not support disks above 2TiB. +NVIDIA metadata format does not support volumes above 2TiB. .Sh EXIT STATUS Exit status is 0 on success, and non-zero if the command fails. .Sh SEE ALSO Modified: stable/9/sys/geom/raid/md_intel.c ============================================================================== --- stable/9/sys/geom/raid/md_intel.c Mon Jan 2 17:40:20 2012 (r229300) +++ stable/9/sys/geom/raid/md_intel.c Mon Jan 2 17:56:45 2012 (r229301) @@ -1172,15 +1172,18 @@ g_raid_md_taste_intel(struct g_raid_md_o g_access(cp, -1, 0, 0); if (meta == NULL) { if (g_raid_aggressive_spare) { - if (vendor == 0x8086) { + if (vendor != 0x8086) { + G_RAID_DEBUG(1, + "Intel vendor mismatch 0x%04x != 0x8086", + vendor); + } else if (pp->mediasize / pp->sectorsize > UINT32_MAX) { + G_RAID_DEBUG(1, + "Intel disk '%s' is too big.", pp->name); + } else { G_RAID_DEBUG(1, "No Intel metadata, forcing spare."); spare = 2; goto search; - } else { - G_RAID_DEBUG(1, - "Intel vendor mismatch 0x%04x != 0x8086", - vendor); } } return (G_RAID_MD_TASTE_FAIL); @@ -1194,9 +1197,9 @@ g_raid_md_taste_intel(struct g_raid_md_o } if (meta->disk[disk_pos].sectors != (pp->mediasize / pp->sectorsize)) { - G_RAID_DEBUG(1, "Intel size mismatch %u != %u", - meta->disk[disk_pos].sectors, - (u_int)(pp->mediasize / pp->sectorsize)); + G_RAID_DEBUG(1, "Intel size mismatch %ju != %ju", + (off_t)meta->disk[disk_pos].sectors, + (off_t)(pp->mediasize / pp->sectorsize)); goto fail1; } @@ -1449,6 +1452,13 @@ g_raid_md_ctl_intel(struct g_raid_md_obj cp->private = disk; g_topology_unlock(); + if (pp->mediasize / pp->sectorsize > UINT32_MAX) { + gctl_error(req, + "Disk '%s' is too big.", diskname); + error = -8; + break; + } + error = g_raid_md_get_label(cp, &pd->pd_disk_meta.serial[0], INTEL_SERIAL_LEN); if (error != 0) { @@ -1940,6 +1950,14 @@ g_raid_md_ctl_intel(struct g_raid_md_obj pp = cp->provider; g_topology_unlock(); + if (pp->mediasize / pp->sectorsize > UINT32_MAX) { + gctl_error(req, + "Disk '%s' is too big.", diskname); + g_raid_kill_consumer(sc, cp); + error = -8; + break; + } + /* Read disk serial. */ error = g_raid_md_get_label(cp, &serial[0], INTEL_SERIAL_LEN); Modified: stable/9/sys/geom/raid/md_nvidia.c ============================================================================== --- stable/9/sys/geom/raid/md_nvidia.c Mon Jan 2 17:40:20 2012 (r229300) +++ stable/9/sys/geom/raid/md_nvidia.c Mon Jan 2 17:56:45 2012 (r229301) @@ -1033,7 +1033,7 @@ g_raid_md_ctl_nvidia(struct g_raid_md_ob char arg[16]; const char *verb, *volname, *levelname, *diskname; int *nargs, *force; - off_t size, sectorsize, strip; + off_t size, sectorsize, strip, volsize; intmax_t *sizearg, *striparg; int numdisks, i, len, level, qual, update; int error; @@ -1182,7 +1182,20 @@ g_raid_md_ctl_nvidia(struct g_raid_md_ob gctl_error(req, "Size too small."); return (-13); } - if (size > 0xffffffffffffllu * sectorsize) { + + if (level == G_RAID_VOLUME_RL_RAID0 || + level == G_RAID_VOLUME_RL_CONCAT || + level == G_RAID_VOLUME_RL_SINGLE) + volsize = size * numdisks; + else if (level == G_RAID_VOLUME_RL_RAID1) + volsize = size; + else if (level == G_RAID_VOLUME_RL_RAID5) + volsize = size * (numdisks - 1); + else { /* RAID1E */ + volsize = ((size * numdisks) / strip / 2) * + strip; + } + if (volsize > 0xffffffffllu * sectorsize) { gctl_error(req, "Size too big."); return (-14); } @@ -1196,18 +1209,7 @@ g_raid_md_ctl_nvidia(struct g_raid_md_ob vol->v_raid_level_qualifier = G_RAID_VOLUME_RLQ_NONE; vol->v_strip_size = strip; vol->v_disks_count = numdisks; - if (level == G_RAID_VOLUME_RL_RAID0 || - level == G_RAID_VOLUME_RL_CONCAT || - level == G_RAID_VOLUME_RL_SINGLE) - vol->v_mediasize = size * numdisks; - else if (level == G_RAID_VOLUME_RL_RAID1) - vol->v_mediasize = size; - else if (level == G_RAID_VOLUME_RL_RAID5) - vol->v_mediasize = size * (numdisks - 1); - else { /* RAID1E */ - vol->v_mediasize = ((size * numdisks) / strip / 2) * - strip; - } + vol->v_mediasize = volsize; vol->v_sectorsize = sectorsize; g_raid_start_volume(vol); Modified: stable/9/sys/geom/raid/md_promise.c ============================================================================== --- stable/9/sys/geom/raid/md_promise.c Mon Jan 2 17:40:20 2012 (r229300) +++ stable/9/sys/geom/raid/md_promise.c Mon Jan 2 17:56:45 2012 (r229301) @@ -121,7 +121,8 @@ struct promise_raid_conf { uint64_t rebuild_lba64; /* Per-volume rebuild position. */ uint32_t magic_4; uint32_t magic_5; - uint32_t filler3[325]; + uint32_t total_sectors_high; + uint32_t filler3[324]; uint32_t checksum; } __packed; @@ -213,6 +214,7 @@ g_raid_md_promise_print(struct promise_r printf("rebuild_lba64 %ju\n", meta->rebuild_lba64); printf("magic_4 0x%08x\n", meta->magic_4); printf("magic_5 0x%08x\n", meta->magic_5); + printf("total_sectors_high 0x%08x\n", meta->total_sectors_high); printf("=================================================\n"); } @@ -867,6 +869,9 @@ g_raid_md_promise_start(struct g_raid_vo vol->v_strip_size = 512 << meta->stripe_shift; //ZZZ vol->v_disks_count = meta->total_disks; vol->v_mediasize = (off_t)meta->total_sectors * 512; //ZZZ + if (meta->total_sectors_high < 256) /* If value looks sane. */ + vol->v_mediasize |= + ((off_t)meta->total_sectors_high << 32) * 512; //ZZZ vol->v_sectorsize = 512; //ZZZ for (i = 0; i < vol->v_disks_count; i++) { sd = &vol->v_subdisks[i]; @@ -1318,6 +1323,13 @@ g_raid_md_ctl_promise(struct g_raid_md_o cp->private = disk; g_topology_unlock(); + if (pp->mediasize / pp->sectorsize > UINT32_MAX) { + gctl_error(req, + "Disk '%s' is too big.", diskname); + error = -8; + break; + } + /* Read kernel dumping information. */ disk->d_kd.offset = 0; disk->d_kd.length = OFF_MAX; @@ -1609,8 +1621,17 @@ g_raid_md_ctl_promise(struct g_raid_md_o error = -4; break; } + pp = cp->provider; g_topology_unlock(); + if (pp->mediasize / pp->sectorsize > UINT32_MAX) { + gctl_error(req, + "Disk '%s' is too big.", diskname); + g_raid_kill_consumer(sc, cp); + error = -8; + break; + } + pd = malloc(sizeof(*pd), M_MD_PROMISE, M_WAITOK | M_ZERO); disk = g_raid_create_disk(sc); @@ -1716,6 +1737,8 @@ g_raid_md_write_promise(struct g_raid_md meta->array_width /= 2; meta->array_number = vol->v_global_id; meta->total_sectors = vol->v_mediasize / vol->v_sectorsize; + meta->total_sectors_high = + (vol->v_mediasize / vol->v_sectorsize) >> 32; meta->cylinders = meta->total_sectors / (255 * 63) - 1; meta->heads = 254; meta->sectors = 63; From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 17:58:08 2012 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 F2D64106564A; Mon, 2 Jan 2012 17:58:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DF75F8FC14; Mon, 2 Jan 2012 17:58: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 q02Hw7OA078830; Mon, 2 Jan 2012 17:58:07 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02Hw7BP078824; Mon, 2 Jan 2012 17:58:07 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201021758.q02Hw7BP078824@svn.freebsd.org> From: Alexander Motin Date: Mon, 2 Jan 2012 17:58:07 +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: r229302 - in stable/8: sbin/geom/class/raid sbin/geom/class/sched sys/conf sys/geom/raid 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, 02 Jan 2012 17:58:08 -0000 Author: mav Date: Mon Jan 2 17:58:07 2012 New Revision: 229302 URL: http://svn.freebsd.org/changeset/base/229302 Log: MFC r226816: Clarify disks/volumes above 2TiB support in geom_raid: - add support for volumes above 2TiB with Promise metadata format; - enforse and document other limitations: - Intel and Promise metadata formats do not support disks above 2TiB; - NVIDIA metadata format does not support volumes above 2TiB. Sponsored by: iXsystems, Inc. Modified: stable/8/sbin/geom/class/raid/graid.8 stable/8/sys/geom/raid/md_intel.c stable/8/sys/geom/raid/md_nvidia.c stable/8/sys/geom/raid/md_promise.c Directory Properties: stable/8/sbin/geom/ (props changed) stable/8/sbin/geom/class/multipath/ (props changed) stable/8/sbin/geom/class/part/ (props changed) stable/8/sbin/geom/class/sched/gsched.8 (props changed) stable/8/sbin/geom/class/stripe/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sbin/geom/class/raid/graid.8 ============================================================================== --- stable/8/sbin/geom/class/raid/graid.8 Mon Jan 2 17:56:45 2012 (r229301) +++ stable/8/sbin/geom/class/raid/graid.8 Mon Jan 2 17:58:07 2012 (r229302) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 22, 2011 +.Dd October 26, 2011 .Dt GRAID 8 .Os .Sh NAME @@ -250,6 +250,9 @@ If you started migration using BIOS or i complete it there. Do not run GEOM RAID class on migrating volumes under pain of possible data corruption! +.Sh 2TiB BARRIERS +Intel and Promise metadata formats do not support disks above 2TiB. +NVIDIA metadata format does not support volumes above 2TiB. .Sh EXIT STATUS Exit status is 0 on success, and non-zero if the command fails. .Sh SEE ALSO Modified: stable/8/sys/geom/raid/md_intel.c ============================================================================== --- stable/8/sys/geom/raid/md_intel.c Mon Jan 2 17:56:45 2012 (r229301) +++ stable/8/sys/geom/raid/md_intel.c Mon Jan 2 17:58:07 2012 (r229302) @@ -1172,15 +1172,18 @@ g_raid_md_taste_intel(struct g_raid_md_o g_access(cp, -1, 0, 0); if (meta == NULL) { if (g_raid_aggressive_spare) { - if (vendor == 0x8086) { + if (vendor != 0x8086) { + G_RAID_DEBUG(1, + "Intel vendor mismatch 0x%04x != 0x8086", + vendor); + } else if (pp->mediasize / pp->sectorsize > UINT32_MAX) { + G_RAID_DEBUG(1, + "Intel disk '%s' is too big.", pp->name); + } else { G_RAID_DEBUG(1, "No Intel metadata, forcing spare."); spare = 2; goto search; - } else { - G_RAID_DEBUG(1, - "Intel vendor mismatch 0x%04x != 0x8086", - vendor); } } return (G_RAID_MD_TASTE_FAIL); @@ -1194,9 +1197,9 @@ g_raid_md_taste_intel(struct g_raid_md_o } if (meta->disk[disk_pos].sectors != (pp->mediasize / pp->sectorsize)) { - G_RAID_DEBUG(1, "Intel size mismatch %u != %u", - meta->disk[disk_pos].sectors, - (u_int)(pp->mediasize / pp->sectorsize)); + G_RAID_DEBUG(1, "Intel size mismatch %ju != %ju", + (off_t)meta->disk[disk_pos].sectors, + (off_t)(pp->mediasize / pp->sectorsize)); goto fail1; } @@ -1449,6 +1452,13 @@ g_raid_md_ctl_intel(struct g_raid_md_obj cp->private = disk; g_topology_unlock(); + if (pp->mediasize / pp->sectorsize > UINT32_MAX) { + gctl_error(req, + "Disk '%s' is too big.", diskname); + error = -8; + break; + } + error = g_raid_md_get_label(cp, &pd->pd_disk_meta.serial[0], INTEL_SERIAL_LEN); if (error != 0) { @@ -1940,6 +1950,14 @@ g_raid_md_ctl_intel(struct g_raid_md_obj pp = cp->provider; g_topology_unlock(); + if (pp->mediasize / pp->sectorsize > UINT32_MAX) { + gctl_error(req, + "Disk '%s' is too big.", diskname); + g_raid_kill_consumer(sc, cp); + error = -8; + break; + } + /* Read disk serial. */ error = g_raid_md_get_label(cp, &serial[0], INTEL_SERIAL_LEN); Modified: stable/8/sys/geom/raid/md_nvidia.c ============================================================================== --- stable/8/sys/geom/raid/md_nvidia.c Mon Jan 2 17:56:45 2012 (r229301) +++ stable/8/sys/geom/raid/md_nvidia.c Mon Jan 2 17:58:07 2012 (r229302) @@ -1033,7 +1033,7 @@ g_raid_md_ctl_nvidia(struct g_raid_md_ob char arg[16]; const char *verb, *volname, *levelname, *diskname; int *nargs, *force; - off_t size, sectorsize, strip; + off_t size, sectorsize, strip, volsize; intmax_t *sizearg, *striparg; int numdisks, i, len, level, qual, update; int error; @@ -1182,7 +1182,20 @@ g_raid_md_ctl_nvidia(struct g_raid_md_ob gctl_error(req, "Size too small."); return (-13); } - if (size > 0xffffffffffffllu * sectorsize) { + + if (level == G_RAID_VOLUME_RL_RAID0 || + level == G_RAID_VOLUME_RL_CONCAT || + level == G_RAID_VOLUME_RL_SINGLE) + volsize = size * numdisks; + else if (level == G_RAID_VOLUME_RL_RAID1) + volsize = size; + else if (level == G_RAID_VOLUME_RL_RAID5) + volsize = size * (numdisks - 1); + else { /* RAID1E */ + volsize = ((size * numdisks) / strip / 2) * + strip; + } + if (volsize > 0xffffffffllu * sectorsize) { gctl_error(req, "Size too big."); return (-14); } @@ -1196,18 +1209,7 @@ g_raid_md_ctl_nvidia(struct g_raid_md_ob vol->v_raid_level_qualifier = G_RAID_VOLUME_RLQ_NONE; vol->v_strip_size = strip; vol->v_disks_count = numdisks; - if (level == G_RAID_VOLUME_RL_RAID0 || - level == G_RAID_VOLUME_RL_CONCAT || - level == G_RAID_VOLUME_RL_SINGLE) - vol->v_mediasize = size * numdisks; - else if (level == G_RAID_VOLUME_RL_RAID1) - vol->v_mediasize = size; - else if (level == G_RAID_VOLUME_RL_RAID5) - vol->v_mediasize = size * (numdisks - 1); - else { /* RAID1E */ - vol->v_mediasize = ((size * numdisks) / strip / 2) * - strip; - } + vol->v_mediasize = volsize; vol->v_sectorsize = sectorsize; g_raid_start_volume(vol); Modified: stable/8/sys/geom/raid/md_promise.c ============================================================================== --- stable/8/sys/geom/raid/md_promise.c Mon Jan 2 17:56:45 2012 (r229301) +++ stable/8/sys/geom/raid/md_promise.c Mon Jan 2 17:58:07 2012 (r229302) @@ -121,7 +121,8 @@ struct promise_raid_conf { uint64_t rebuild_lba64; /* Per-volume rebuild position. */ uint32_t magic_4; uint32_t magic_5; - uint32_t filler3[325]; + uint32_t total_sectors_high; + uint32_t filler3[324]; uint32_t checksum; } __packed; @@ -213,6 +214,7 @@ g_raid_md_promise_print(struct promise_r printf("rebuild_lba64 %ju\n", meta->rebuild_lba64); printf("magic_4 0x%08x\n", meta->magic_4); printf("magic_5 0x%08x\n", meta->magic_5); + printf("total_sectors_high 0x%08x\n", meta->total_sectors_high); printf("=================================================\n"); } @@ -867,6 +869,9 @@ g_raid_md_promise_start(struct g_raid_vo vol->v_strip_size = 512 << meta->stripe_shift; //ZZZ vol->v_disks_count = meta->total_disks; vol->v_mediasize = (off_t)meta->total_sectors * 512; //ZZZ + if (meta->total_sectors_high < 256) /* If value looks sane. */ + vol->v_mediasize |= + ((off_t)meta->total_sectors_high << 32) * 512; //ZZZ vol->v_sectorsize = 512; //ZZZ for (i = 0; i < vol->v_disks_count; i++) { sd = &vol->v_subdisks[i]; @@ -1318,6 +1323,13 @@ g_raid_md_ctl_promise(struct g_raid_md_o cp->private = disk; g_topology_unlock(); + if (pp->mediasize / pp->sectorsize > UINT32_MAX) { + gctl_error(req, + "Disk '%s' is too big.", diskname); + error = -8; + break; + } + /* Read kernel dumping information. */ disk->d_kd.offset = 0; disk->d_kd.length = OFF_MAX; @@ -1609,8 +1621,17 @@ g_raid_md_ctl_promise(struct g_raid_md_o error = -4; break; } + pp = cp->provider; g_topology_unlock(); + if (pp->mediasize / pp->sectorsize > UINT32_MAX) { + gctl_error(req, + "Disk '%s' is too big.", diskname); + g_raid_kill_consumer(sc, cp); + error = -8; + break; + } + pd = malloc(sizeof(*pd), M_MD_PROMISE, M_WAITOK | M_ZERO); disk = g_raid_create_disk(sc); @@ -1716,6 +1737,8 @@ g_raid_md_write_promise(struct g_raid_md meta->array_width /= 2; meta->array_number = vol->v_global_id; meta->total_sectors = vol->v_mediasize / vol->v_sectorsize; + meta->total_sectors_high = + (vol->v_mediasize / vol->v_sectorsize) >> 32; meta->cylinders = meta->total_sectors / (255 * 63) - 1; meta->heads = 254; meta->sectors = 63; From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 18:06:49 2012 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 141581065670; Mon, 2 Jan 2012 18:06:49 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0013D8FC16; Mon, 2 Jan 2012 18:06:48 +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 q02I6mrS079226; Mon, 2 Jan 2012 18:06:48 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02I6m2D079221; Mon, 2 Jan 2012 18:06:48 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201021806.q02I6m2D079221@svn.freebsd.org> From: Alexander Motin Date: Mon, 2 Jan 2012 18:06:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229303 - in stable/9: sbin/geom/class/multipath sys/geom/multipath 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, 02 Jan 2012 18:06:49 -0000 Author: mav Date: Mon Jan 2 18:06:48 2012 New Revision: 229303 URL: http://svn.freebsd.org/changeset/base/229303 Log: MFC r227464, r227471 Major GEOM MULTIPATH class rewrite: - Improved locking and destruction process to fix crashes. - Improved "automatic" configuration method to make it consistent and safe by reading metadata back from all specified paths after writing to one. - Added provider size check to reduce chance of ordering conflict with other GEOM classes. - Added "manual" configuration method without using on-disk metadata. - Added "add" and "remove" commands to allow manage paths manually. - Failed paths are no longer dropped from geom, but only marked as FAIL and excluded from I/O operations. - Automatically restore failed paths when all others paths are marked as failed, for example, because of device-caused (not transport) errors. - Added "fail" and "restore" commands to manually control FAIL flag. - geom is now destroyed on last path disconnection. - Added optional Active/Active mode support. Unlike Active/Passive mode, load evenly distributed between all working paths. If supported by the device, it allows to significantly improve performance, utilizing bandwidth of all paths. It is controlled by -A option during creation. Disabled by default now. - Improved `status` and `list` commands output. Sponsored by: iXsystems, inc. Modified: stable/9/sbin/geom/class/multipath/geom_multipath.c stable/9/sbin/geom/class/multipath/gmultipath.8 stable/9/sys/geom/multipath/g_multipath.c stable/9/sys/geom/multipath/g_multipath.h Directory Properties: stable/9/sbin/geom/ (props changed) stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sbin/geom/class/multipath/geom_multipath.c ============================================================================== --- stable/9/sbin/geom/class/multipath/geom_multipath.c Mon Jan 2 17:58:07 2012 (r229302) +++ stable/9/sbin/geom/class/multipath/geom_multipath.c Mon Jan 2 18:06:48 2012 (r229303) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -48,31 +49,58 @@ uint32_t version = G_MULTIPATH_VERSION; static void mp_main(struct gctl_req *, unsigned int); static void mp_label(struct gctl_req *); static void mp_clear(struct gctl_req *); -static void mp_add(struct gctl_req *); struct g_command class_commands[] = { { - "label", G_FLAG_VERBOSE | G_FLAG_LOADKLD, mp_main, G_NULL_OPTS, - "[-v] name prov ..." + "create", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL, + { + { 'A', "active_active", NULL, G_TYPE_BOOL }, + G_OPT_SENTINEL + }, + "[-vA] name prov ..." }, { - "add", G_FLAG_VERBOSE | G_FLAG_LOADKLD, mp_main, G_NULL_OPTS, - "[-v] name prov ..." + "label", G_FLAG_VERBOSE | G_FLAG_LOADKLD, mp_main, + { + { 'A', "active_active", NULL, G_TYPE_BOOL }, + G_OPT_SENTINEL + }, + "[-vA] name prov ..." }, { - "destroy", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, - "[-v] prov ..." + "add", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, + "[-v] name prov" }, { - "clear", G_FLAG_VERBOSE, mp_main, G_NULL_OPTS, - "[-v] prov ..." + "remove", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, + "[-v] name prov" + }, + { + "fail", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, + "[-v] name prov" + }, + { + "restore", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, + "[-v] name prov" }, { "rotate", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, - "[-v] prov ..." + "[-v] name" }, { "getactive", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, + "[-v] name" + }, + { + "destroy", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, + "[-v] name" + }, + { + "stop", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, + "[-v] name" + }, + { + "clear", G_FLAG_VERBOSE, mp_main, G_NULL_OPTS, "[-v] prov ..." }, G_CMD_SENTINEL @@ -90,8 +118,6 @@ mp_main(struct gctl_req *req, unsigned i } if (strcmp(name, "label") == 0) { mp_label(req); - } else if (strcmp(name, "add") == 0) { - mp_add(req); } else if (strcmp(name, "clear") == 0) { mp_clear(req); } else { @@ -103,13 +129,13 @@ static void mp_label(struct gctl_req *req) { struct g_multipath_metadata md; - off_t disksiz = 0, msize; - uint8_t *sector; + off_t disksize = 0, msize; + uint8_t *sector, *rsector; char *ptr; uuid_t uuid; uint32_t secsize = 0, ssize, status; - const char *name, *mpname; - int error, i, nargs; + const char *name, *name2, *mpname; + int error, i, nargs, fd; nargs = gctl_get_int(req, "nargs"); if (nargs < 2) { @@ -132,14 +158,14 @@ mp_label(struct gctl_req *req) } if (i == 1) { secsize = ssize; - disksiz = msize; + disksize = msize; } else { if (secsize != ssize) { gctl_error(req, "%s sector size %u different.", name, ssize); return; } - if (disksiz != msize) { + if (disksize != msize) { gctl_error(req, "%s media size %ju different.", name, (intmax_t)msize); return; @@ -155,7 +181,7 @@ mp_label(struct gctl_req *req) md.md_version = G_MULTIPATH_VERSION; mpname = gctl_get_ascii(req, "arg0"); strlcpy(md.md_name, mpname, sizeof(md.md_name)); - md.md_size = disksiz; + md.md_size = disksize; md.md_sectorsize = secsize; uuid_create(&uuid, &status); if (status != uuid_s_ok) { @@ -168,19 +194,10 @@ mp_label(struct gctl_req *req) return; } strlcpy(md.md_uuid, ptr, sizeof (md.md_uuid)); + md.md_active_active = gctl_get_int(req, "active_active"); free(ptr); /* - * Clear metadata on initial provider first. - */ - name = gctl_get_ascii(req, "arg1"); - error = g_metadata_clear(name, NULL); - if (error != 0) { - gctl_error(req, "cannot clear metadata on %s: %s.", name, strerror(error)); - return; - } - - /* * Allocate a sector to write as metadata. */ sector = malloc(secsize); @@ -189,6 +206,12 @@ mp_label(struct gctl_req *req) return; } memset(sector, 0, secsize); + rsector = malloc(secsize); + if (rsector == NULL) { + free(sector); + gctl_error(req, "unable to allocate metadata buffer"); + return; + } /* * encode the metadata @@ -198,6 +221,7 @@ mp_label(struct gctl_req *req) /* * Store metadata on the initial provider. */ + name = gctl_get_ascii(req, "arg1"); error = g_metadata_store(name, sector, secsize); if (error != 0) { gctl_error(req, "cannot store metadata on %s: %s.", name, strerror(error)); @@ -205,20 +229,29 @@ mp_label(struct gctl_req *req) } /* - * Now add the rest of the providers. + * Now touch the rest of the providers to hint retaste. */ - error = gctl_change_param(req, "verb", -1, "add"); - if (error) { - gctl_error(req, "unable to change verb to \"add\": %s.", strerror(error)); - return; - } for (i = 2; i < nargs; i++) { - error = gctl_change_param(req, "arg1", -1, gctl_get_ascii(req, "arg%d", i)); - if (error) { - gctl_error(req, "unable to add %s to %s: %s.", gctl_get_ascii(req, "arg%d", i), mpname, strerror(error)); + name2 = gctl_get_ascii(req, "arg%d", i); + fd = g_open(name2, 1); + if (fd < 0) { + fprintf(stderr, "Unable to open %s: %s.\n", + name2, strerror(errno)); + continue; + } + if (pread(fd, rsector, secsize, disksize - secsize) != + (ssize_t)secsize) { + fprintf(stderr, "Unable to read metadata from %s: %s.\n", + name2, strerror(errno)); + g_close(fd); continue; } - mp_add(req); + g_close(fd); + if (memcmp(sector, rsector, secsize)) { + fprintf(stderr, "No metadata found on %s." + " It is not a path of %s.\n", + name2, name); + } } } @@ -247,13 +280,3 @@ mp_clear(struct gctl_req *req) } } -static void -mp_add(struct gctl_req *req) -{ - const char *errstr; - - errstr = gctl_issue(req); - if (errstr != NULL && errstr[0] != '\0') { - gctl_error(req, "%s", errstr); - } -} Modified: stable/9/sbin/geom/class/multipath/gmultipath.8 ============================================================================== --- stable/9/sbin/geom/class/multipath/gmultipath.8 Mon Jan 2 17:58:07 2012 (r229302) +++ stable/9/sbin/geom/class/multipath/gmultipath.8 Mon Jan 2 18:06:48 2012 (r229303) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 26, 2007 +.Dd October 31, 2011 .Dt GMULTIPATH 8 .Os .Sh NAME @@ -32,11 +32,48 @@ .Nd "disk multipath control utility" .Sh SYNOPSIS .Nm +.Cm create +.Op Fl Av +.Ar name +.Ar prov ... +.Nm .Cm label -.Op Fl hv +.Op Fl Av .Ar name .Ar prov ... .Nm +.Cm add +.Op Fl v +.Ar name prov +.Nm +.Cm remove +.Op Fl v +.Ar name prov +.Nm +.Cm fail +.Op Fl v +.Ar name prov +.Nm +.Cm restore +.Op Fl v +.Ar name prov +.Nm +.Cm rotate +.Op Fl v +.Ar name +.Nm +.Cm getactive +.Op Fl v +.Ar name +.Nm +.Cm destroy +.Op Fl v +.Ar name +.Nm +.Cm stop +.Op Fl v +.Ar name +.Nm .Cm clear .Op Fl v .Ar prov ... @@ -53,27 +90,79 @@ The .Nm utility is used for device multipath configuration. .Pp -Only automatic configuration is supported at the present time via the -.Cm label -command. -This operation writes a label on the last sector of the underlying -disk device with a contained name and UUID. -The UUID guarantees uniqueness -in a shared storage environment but is in general too cumbersome to use. +The multipath device can be configured using two different methods: +.Dq manual +or +.Dq automatic . +When using the +.Dq manual +method, no metadata are stored on the devices, so the multipath +device has to be configured by hand every time it is needed. +Additional device paths also won't be detected automatically. +The +.Dq automatic +method uses on-disk metadata to detect device and all it's paths. +Metadata use the last sector of the underlying disk device and +include device name and UUID. +The UUID guarantees uniqueness in a shared storage environment +but is in general too cumbersome to use. The name is what is exported via the device interface. .Pp The first argument to .Nm indicates an action to be performed: .Bl -tag -width ".Cm destroy" +.It Cm create +Create multipath device with +.Dq manual +method without writing any on-disk metadata. +It is up to administrator, how to properly identify device paths. +Kernel will only check that all given providers have same media and +sector sizes. +.Pp +.Fl A +option enables Active/Active mode, otherwise Active/Passive mode is used +by default. .It Cm label -Label the given underlying device with the specified +Create multipath device with +.Dq automatic +method. +Label the first given provider with on-disk metadata using the specified .Ar name . -The kernel module -.Pa geom_multipath.ko -will be loaded if it is not loaded already. +The rest of given providers will be retasted to detect these metadata. +It reliably protects against specifying unrelated providers. +Providers with no matching metadata detected will not be added to the device. +.Pp +.Fl A +option enables Active/Active mode, otherwise Active/Passive mode is used +by default. +.It Cm add +Add the given provider as a path to the given multipath device. +Should normally be used only for devices created with +.Dq manual +method, unless you know what you are doing (you are sure that it is another +device path, but tasting its metadata in regular +.Dq automatic +way is not possible). +.It Cm remove +Remove the given provider as a path from the given multipath device. +If the last path removed, the multipath device will be destroyed. +.It Cm fail +Mark specified provider as a path of the specified multipath device as failed. +If there are other paths present, new requests will be forwarded there. +.It Cm restore +Mark specified provider as a path of the specified multipath device as +operational, allowing it to handle requests. +.It Cm rotate +Change the active provider/path in Active/Passive mode. +.It Cm getactive +Get the currently active provider(s)/path(s). +.It Cm destroy +Destroy the given multipath device clearing metadata. +.It Cm stop +Stop the given multipath device without clearing metadata. .It Cm clear -Clear metadata on the given device. +Clear metadata on the given provider. .It Cm list See .Xr geom 8 . @@ -101,14 +190,15 @@ Debug level of the GEOM class. This can be set to 0 (default) or 1 to disable or enable various forms of chattiness. +.It Va kern.geom.multipath.exclusive : No 1 +Open underlying providers exclusively, preventing individual paths access. .El .Sh EXIT STATUS Exit status is 0 on success, and 1 if the command fails. .Sh MULTIPATH ARCHITECTURE .Pp -This is an active/passive -multiple path architecture with no device knowledge or presumptions other -than size matching built in. +This is a multiple path architecture with no device knowledge or +presumptions other than size matching built in. Therefore the user must exercise some care in selecting providers that do indeed represent multiple paths to the same underlying disk device. @@ -133,15 +223,16 @@ of multiple pathnames refer to the same system operator who will use tools and knowledge of their own storage subsystem to make the correct configuration selection. .Pp -As an active/passive architecture, only one path has I/O moving on it +There are Active/Passive and Active/Active operation modes supported. +In Active/Passive mode only one path has I/O moving on it at any point in time. This I/O continues until an I/O is returned with a generic I/O error or a "Nonexistent Device" error. -When this occurs, -the active device is kicked out of the -.Nm MULTIPATH -GEOM class and the next in a list is selected, the failed I/O reissued -and the system proceeds. +When this occurs, that path is marked FAIL, the next path +in a list is selected as active and the failed I/O reissued. +In Active/Active mode all paths not marked FAIL may handle I/O same time. +Requests are distributed between paths to equalize load. +For capable devices it allows to utilize bandwidth of all paths. .Pp When new devices are added to the system the .Nm MULTIPATH @@ -149,9 +240,9 @@ GEOM class is given an opportunity to ta If a new device has a .Nm MULTIPATH -label, the device is used to either create a new +on-disk metadata label, the device is used to either create a new .Nm MULTIPATH -GEOM, or to attach to the end of the list of devices for an existing +GEOM, or been added the list of paths for an existing .Nm MULTIPATH GEOM. .Pp @@ -176,7 +267,7 @@ of an RSCN event from the Fabric Domain a rescan to occur and cause the attachment and configuration of any (now) new devices to occur, causing the taste event described above. .Pp -This means that this active/passive architecture is not a one-shot path +This means that this multipath architecture is not a one-shot path failover, but can be considered to be steady state as long as failed paths are repaired (automatically or otherwise). .Pp @@ -184,7 +275,7 @@ Automatic rescanning is not a requiremen Nor is Fibre Channel. The same failover mechanisms work equally well for traditional "Parallel" -SCSI but require manual intervention with +SCSI but may require manual intervention with .Xr camcontrol 8 to cause the reattachment of repaired device links. .Sh EXAMPLES @@ -226,9 +317,9 @@ mount /dev/multipath/FREDa /mnt.... .Pp The resultant console output looks something like: .Bd -literal -offset indent -GEOM_MULTIPATH: adding da0 to Fred/b631385f-c61c-11db-b884-0011116ae789 -GEOM_MULTIPATH: da0 now active path in Fred -GEOM_MULTIPATH: adding da2 to Fred/b631385f-c61c-11db-b884-0011116ae789 +GEOM_MULTIPATH: da0 added to FRED +GEOM_MULTIPATH: da0 is now active path in FRED +GEOM_MULTIPATH: da2 added to FRED .Ed .Sh SEE ALSO .Xr geom 4 , @@ -240,24 +331,6 @@ GEOM_MULTIPATH: adding da2 to Fred/b6313 .Xr mount 8 , .Xr newfs 8 , .Xr sysctl 8 -.Sh BUGS -The -.Nm -should allow for a manual method of pairing disks. -.Pp -There is currently no way for -.Pa geom_multipath.ko -to distinguish between various label instances of the same provider. -That -is devices such as -.Ar da0 -and -.Ar da0c -can be tasted and instantiated as multiple paths for the same device. -Technically, this is correct, but pretty useless. -This will be fixed soon -(I hope), but to avoid this it is a good idea to destroy any label on -the disk object prior to labelling it with -.Nm . .Sh AUTHOR .An Matthew Jacob Aq mjacob@FreeBSD.org +.An Alexander Motin Aq mav@FreeBSD.org Modified: stable/9/sys/geom/multipath/g_multipath.c ============================================================================== --- stable/9/sys/geom/multipath/g_multipath.c Mon Jan 2 17:58:07 2012 (r229302) +++ stable/9/sys/geom/multipath/g_multipath.c Mon Jan 2 18:06:48 2012 (r229303) @@ -1,4 +1,5 @@ /*- + * Copyright (c) 2011 Alexander Motin * Copyright (c) 2006-2007 Matthew Jacob * All rights reserved. * @@ -53,6 +54,9 @@ SYSCTL_NODE(_kern_geom, OID_AUTO, multip static u_int g_multipath_debug = 0; SYSCTL_UINT(_kern_geom_multipath, OID_AUTO, debug, CTLFLAG_RW, &g_multipath_debug, 0, "Debug level"); +static u_int g_multipath_exclusive = 1; +SYSCTL_UINT(_kern_geom_multipath, OID_AUTO, exclusive, CTLFLAG_RW, + &g_multipath_exclusive, 0, "Exclusively open providers"); static enum { GKT_NIL, @@ -79,6 +83,7 @@ static g_taste_t g_multipath_taste; static g_ctl_req_t g_multipath_config; static g_init_t g_multipath_init; static g_fini_t g_multipath_fini; +static g_dumpconf_t g_multipath_dumpconf; struct g_class g_multipath_class = { .name = G_MULTIPATH_CLASS_NAME, @@ -90,35 +95,144 @@ struct g_class g_multipath_class = { .fini = g_multipath_fini }; -#define MP_BAD 0x1 -#define MP_POSTED 0x2 +#define MP_FAIL 0x00000001 +#define MP_LOST 0x00000002 +#define MP_NEW 0x00000004 +#define MP_POSTED 0x00000008 +#define MP_BAD (MP_FAIL | MP_LOST | MP_NEW) +#define MP_IDLE 0x00000010 +#define MP_IDLE_MASK 0xfffffff0 + +static int +g_multipath_good(struct g_geom *gp) +{ + struct g_consumer *cp; + int n = 0; + + LIST_FOREACH(cp, &gp->consumer, consumer) { + if ((cp->index & MP_BAD) == 0) + n++; + } + return (n); +} + +static void +g_multipath_fault(struct g_consumer *cp, int cause) +{ + struct g_multipath_softc *sc; + struct g_consumer *lcp; + struct g_geom *gp; + + gp = cp->geom; + sc = gp->softc; + cp->index |= cause; + if (g_multipath_good(gp) == 0 && sc->sc_ndisks > 0) { + LIST_FOREACH(lcp, &gp->consumer, consumer) { + if (lcp->provider == NULL || + (lcp->index & (MP_LOST | MP_NEW))) + continue; + if (sc->sc_ndisks > 1 && lcp == cp) + continue; + printf("GEOM_MULTIPATH: " + "all paths in %s were marked FAIL, restore %s\n", + sc->sc_name, lcp->provider->name); + lcp->index &= ~MP_FAIL; + } + } + if (cp != sc->sc_active) + return; + sc->sc_active = NULL; + LIST_FOREACH(lcp, &gp->consumer, consumer) { + if ((lcp->index & MP_BAD) == 0) { + sc->sc_active = lcp; + break; + } + } + if (sc->sc_active == NULL) { + printf("GEOM_MULTIPATH: out of providers for %s\n", + sc->sc_name); + } else if (!sc->sc_active_active) { + printf("GEOM_MULTIPATH: %s is now active path in %s\n", + sc->sc_active->provider->name, sc->sc_name); + } +} + +static struct g_consumer * +g_multipath_choose(struct g_geom *gp) +{ + struct g_multipath_softc *sc; + struct g_consumer *best, *cp; + + sc = gp->softc; + if (!sc->sc_active_active) + return (sc->sc_active); + best = NULL; + LIST_FOREACH(cp, &gp->consumer, consumer) { + if (cp->index & MP_BAD) + continue; + cp->index += MP_IDLE; + if (best == NULL || cp->private < best->private || + (cp->private == best->private && cp->index > best->index)) + best = cp; + } + if (best != NULL) + best->index &= ~MP_IDLE_MASK; + return (best); +} static void g_mpd(void *arg, int flags __unused) { + struct g_geom *gp; + struct g_multipath_softc *sc; struct g_consumer *cp; + int w; g_topology_assert(); cp = arg; - if (cp->acr > 0 || cp->acw > 0 || cp->ace > 0) + gp = cp->geom; + if (cp->acr > 0 || cp->acw > 0 || cp->ace > 0) { + w = cp->acw; g_access(cp, -cp->acr, -cp->acw, -cp->ace); + if (w > 0 && cp->provider != NULL && + (cp->provider->geom->flags & G_GEOM_WITHER) == 0) { + g_post_event(g_mpd, cp, M_WAITOK, NULL); + return; + } + } + sc = gp->softc; + mtx_lock(&sc->sc_mtx); if (cp->provider) { printf("GEOM_MULTIPATH: %s removed from %s\n", - cp->provider->name, cp->geom->name); + cp->provider->name, gp->name); g_detach(cp); } g_destroy_consumer(cp); + mtx_unlock(&sc->sc_mtx); + if (LIST_EMPTY(&gp->consumer)) + g_multipath_destroy(gp); } static void g_multipath_orphan(struct g_consumer *cp) { - if ((cp->index & MP_POSTED) == 0) { + struct g_multipath_softc *sc; + uintptr_t *cnt; + + g_topology_assert(); + printf("GEOM_MULTIPATH: %s in %s was disconnected\n", + cp->provider->name, cp->geom->name); + sc = cp->geom->softc; + cnt = (uintptr_t *)&cp->private; + mtx_lock(&sc->sc_mtx); + sc->sc_ndisks--; + g_multipath_fault(cp, MP_LOST); + if (*cnt == 0 && (cp->index & MP_POSTED) == 0) { cp->index |= MP_POSTED; - printf("GEOM_MULTIPATH: %s orphaned in %s\n", - cp->provider->name, cp->geom->name); + mtx_unlock(&sc->sc_mtx); g_mpd(cp, 0); - } + } else + mtx_unlock(&sc->sc_mtx); } static void @@ -128,20 +242,29 @@ g_multipath_start(struct bio *bp) struct g_geom *gp; struct g_consumer *cp; struct bio *cbp; + uintptr_t *cnt; gp = bp->bio_to->geom; sc = gp->softc; KASSERT(sc != NULL, ("NULL sc")); - cp = sc->cp_active; - if (cp == NULL) { - g_io_deliver(bp, ENXIO); - return; - } cbp = g_clone_bio(bp); if (cbp == NULL) { g_io_deliver(bp, ENOMEM); return; } + mtx_lock(&sc->sc_mtx); + cp = g_multipath_choose(gp); + if (cp == NULL) { + mtx_unlock(&sc->sc_mtx); + g_destroy_bio(cbp); + g_io_deliver(bp, ENXIO); + return; + } + if ((uintptr_t)bp->bio_driver1 < sc->sc_ndisks) + bp->bio_driver1 = (void *)(uintptr_t)sc->sc_ndisks; + cnt = (uintptr_t *)&cp->private; + (*cnt)++; + mtx_unlock(&sc->sc_mtx); cbp->bio_done = g_multipath_done; g_io_request(cbp, cp); } @@ -149,12 +272,27 @@ g_multipath_start(struct bio *bp) static void g_multipath_done(struct bio *bp) { + struct g_multipath_softc *sc; + struct g_consumer *cp; + uintptr_t *cnt; + if (bp->bio_error == ENXIO || bp->bio_error == EIO) { mtx_lock(&gmtbq_mtx); bioq_insert_tail(&gmtbq, bp); - wakeup(&g_multipath_kt_state); mtx_unlock(&gmtbq_mtx); + wakeup(&g_multipath_kt_state); } else { + cp = bp->bio_from; + sc = cp->geom->softc; + cnt = (uintptr_t *)&cp->private; + mtx_lock(&sc->sc_mtx); + (*cnt)--; + if (*cnt == 0 && (cp->index & MP_LOST)) { + cp->index |= MP_POSTED; + mtx_unlock(&sc->sc_mtx); + g_post_event(g_mpd, cp, M_WAITOK, NULL); + } else + mtx_unlock(&sc->sc_mtx); g_std_done(bp); } } @@ -167,6 +305,7 @@ g_multipath_done_error(struct bio *bp) struct g_multipath_softc *sc; struct g_consumer *cp; struct g_provider *pp; + uintptr_t *cnt; /* * If we had a failure, we have to check first to see @@ -176,47 +315,31 @@ g_multipath_done_error(struct bio *bp) * to the next available consumer. */ - g_topology_lock(); pbp = bp->bio_parent; gp = pbp->bio_to->geom; sc = gp->softc; cp = bp->bio_from; pp = cp->provider; + cnt = (uintptr_t *)&cp->private; - cp->index |= MP_BAD; - if (cp->nend == cp->nstart && pp->nend == pp->nstart) { + mtx_lock(&sc->sc_mtx); + printf("GEOM_MULTIPATH: Error %d, %s in %s marked FAIL\n", + bp->bio_error, pp->name, sc->sc_name); + g_multipath_fault(cp, MP_FAIL); + (*cnt)--; + if (*cnt == 0 && (cp->index & (MP_LOST | MP_POSTED)) == MP_LOST) { cp->index |= MP_POSTED; - g_post_event(g_mpd, cp, M_NOWAIT, NULL); - } - if (cp == sc->cp_active) { - struct g_consumer *lcp; - printf("GEOM_MULTIPATH: %s failed in %s\n", - pp->name, sc->sc_name); - sc->cp_active = NULL; - LIST_FOREACH(lcp, &gp->consumer, consumer) { - if ((lcp->index & MP_BAD) == 0) { - sc->cp_active = lcp; - break; - } - } - if (sc->cp_active == NULL || sc->cp_active->provider == NULL) { - printf("GEOM_MULTIPATH: out of providers for %s\n", - sc->sc_name); - g_topology_unlock(); - return; - } else { - printf("GEOM_MULTIPATH: %s now active path in %s\n", - sc->cp_active->provider->name, sc->sc_name); - } - } - g_topology_unlock(); + mtx_unlock(&sc->sc_mtx); + g_post_event(g_mpd, cp, M_WAITOK, NULL); + } else + mtx_unlock(&sc->sc_mtx); /* * If we can fruitfully restart the I/O, do so. */ - if (sc->cp_active) { + if (pbp->bio_children < (uintptr_t)pbp->bio_driver1) { + pbp->bio_inbed++; g_destroy_bio(bp); - pbp->bio_children--; g_multipath_start(pbp); } else { g_std_done(bp); @@ -254,6 +377,7 @@ g_multipath_access(struct g_provider *pp { struct g_geom *gp; struct g_consumer *cp, *badcp = NULL; + struct g_multipath_softc *sc; int error; gp = pp->geom; @@ -265,6 +389,10 @@ g_multipath_access(struct g_provider *pp goto fail; } } + sc = gp->softc; + sc->sc_opened += dr + dw + de; + if (sc->sc_stopping && sc->sc_opened == 0) + g_multipath_destroy(gp); return (0); fail: @@ -286,6 +414,9 @@ g_multipath_create(struct g_class *mp, s g_topology_assert(); LIST_FOREACH(gp, &mp->geom, geom) { + sc = gp->softc; + if (sc == NULL || sc->sc_stopping) + continue; if (strcmp(gp->name, md->md_name) == 0) { printf("GEOM_MULTIPATH: name %s already exists\n", md->md_name); @@ -295,19 +426,25 @@ g_multipath_create(struct g_class *mp, s gp = g_new_geomf(mp, md->md_name); sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO); + mtx_init(&sc->sc_mtx, "multipath", NULL, MTX_DEF); + memcpy(sc->sc_uuid, md->md_uuid, sizeof (sc->sc_uuid)); + memcpy(sc->sc_name, md->md_name, sizeof (sc->sc_name)); + sc->sc_active_active = md->md_active_active; gp->softc = sc; gp->start = g_multipath_start; gp->orphan = g_multipath_orphan; gp->access = g_multipath_access; - memcpy(sc->sc_uuid, md->md_uuid, sizeof (sc->sc_uuid)); - memcpy(sc->sc_name, md->md_name, sizeof (sc->sc_name)); + gp->dumpconf = g_multipath_dumpconf; pp = g_new_providerf(gp, "multipath/%s", md->md_name); - /* limit the provider to not have it stomp on metadata */ - pp->mediasize = md->md_size - md->md_sectorsize; - pp->sectorsize = md->md_sectorsize; - sc->pp = pp; + if (md->md_size != 0) { + pp->mediasize = md->md_size - + ((md->md_uuid[0] != 0) ? md->md_sectorsize : 0); + pp->sectorsize = md->md_sectorsize; + } + sc->sc_pp = pp; g_error_provider(pp, 0); + printf("GEOM_MULTIPATH: %s created\n", gp->name); return (gp); } @@ -316,7 +453,7 @@ g_multipath_add_disk(struct g_geom *gp, { struct g_multipath_softc *sc; struct g_consumer *cp, *nxtcp; - int error; + int error, acr, acw, ace; g_topology_assert(); @@ -337,6 +474,8 @@ g_multipath_add_disk(struct g_geom *gp, } nxtcp = LIST_FIRST(&gp->consumer); cp = g_new_consumer(gp); + cp->private = NULL; + cp->index = MP_NEW; error = g_attach(cp, pp); if (error != 0) { printf("GEOM_MULTIPATH: cannot attach %s to %s", @@ -344,29 +483,51 @@ g_multipath_add_disk(struct g_geom *gp, g_destroy_consumer(cp); return (error); } - cp->private = sc; - cp->index = 0; /* * Set access permissions on new consumer to match other consumers */ - if (nxtcp && (nxtcp->acr + nxtcp->acw + nxtcp->ace)) { - error = g_access(cp, nxtcp->acr, nxtcp->acw, nxtcp->ace); - if (error) { - printf("GEOM_MULTIPATH: cannot set access in " - "attaching %s to %s/%s (%d)\n", - pp->name, sc->sc_name, sc->sc_uuid, error); - g_detach(cp); - g_destroy_consumer(cp); - return (error); - } + if (sc->sc_pp) { + acr = sc->sc_pp->acr; + acw = sc->sc_pp->acw; + ace = sc->sc_pp->ace; + } else + acr = acw = ace = 0; + if (g_multipath_exclusive) { + acr++; + acw++; + ace++; + } + error = g_access(cp, acr, acw, ace); + if (error) { + printf("GEOM_MULTIPATH: cannot set access in " + "attaching %s to %s (%d)\n", + pp->name, sc->sc_name, error); + g_detach(cp); + g_destroy_consumer(cp); + return (error); } - printf("GEOM_MULTIPATH: adding %s to %s/%s\n", - pp->name, sc->sc_name, sc->sc_uuid); - if (sc->cp_active == NULL) { - sc->cp_active = cp; - printf("GEOM_MULTIPATH: %s now active path in %s\n", - pp->name, sc->sc_name); + if (sc->sc_pp != NULL && sc->sc_pp->mediasize == 0) { + sc->sc_pp->mediasize = pp->mediasize - + ((sc->sc_uuid[0] != 0) ? pp->sectorsize : 0); + sc->sc_pp->sectorsize = pp->sectorsize; + } + if (sc->sc_pp != NULL && + sc->sc_pp->stripesize == 0 && sc->sc_pp->stripeoffset == 0) { + sc->sc_pp->stripesize = pp->stripesize; + sc->sc_pp->stripeoffset = pp->stripeoffset; + } + mtx_lock(&sc->sc_mtx); + cp->index = 0; + sc->sc_ndisks++; + mtx_unlock(&sc->sc_mtx); + printf("GEOM_MULTIPATH: %s added to %s\n", + pp->name, sc->sc_name); + if (sc->sc_active == NULL) { + sc->sc_active = cp; + if (!sc->sc_active_active) + printf("GEOM_MULTIPATH: %s is now active path in %s\n", + pp->name, sc->sc_name); } return (0); } @@ -374,17 +535,41 @@ g_multipath_add_disk(struct g_geom *gp, static int g_multipath_destroy(struct g_geom *gp) { - struct g_provider *pp; + struct g_multipath_softc *sc; + struct g_consumer *cp, *cp1; g_topology_assert(); if (gp->softc == NULL) return (ENXIO); - pp = LIST_FIRST(&gp->provider); - if (pp != NULL && (pp->acr != 0 || pp->acw != 0 || pp->ace != 0)) - return (EBUSY); - printf("GEOM_MULTIPATH: destroying %s\n", gp->name); + sc = gp->softc; + if (!sc->sc_stopping) { + printf("GEOM_MULTIPATH: destroying %s\n", gp->name); + sc->sc_stopping = 1; + } + if (sc->sc_opened != 0) { + if (sc->sc_pp != NULL) { + g_wither_provider(sc->sc_pp, ENXIO); + sc->sc_pp = NULL; + } + return (EINPROGRESS); + } + LIST_FOREACH_SAFE(cp, &gp->consumer, consumer, cp1) { + mtx_lock(&sc->sc_mtx); + if ((cp->index & MP_POSTED) == 0) { + cp->index |= MP_POSTED; + mtx_unlock(&sc->sc_mtx); + g_mpd(cp, 0); + if (cp1 == NULL) + return(0); /* Recursion happened. */ + } else + mtx_unlock(&sc->sc_mtx); + } + if (!LIST_EMPTY(&gp->consumer)) + return (EINPROGRESS); + mtx_destroy(&sc->sc_mtx); g_free(gp->softc); gp->softc = NULL; + printf("GEOM_MULTIPATH: %s destroyed\n", gp->name); g_wither_geom(gp, ENXIO); return (0); } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 18:42:30 2012 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 1B0D61065677; Mon, 2 Jan 2012 18:42:30 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 08D9C8FC14; Mon, 2 Jan 2012 18:42:30 +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 q02IgTwH080549; Mon, 2 Jan 2012 18:42:29 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02IgT5T080547; Mon, 2 Jan 2012 18:42:29 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <201201021842.q02IgT5T080547@svn.freebsd.org> From: Ken Smith Date: Mon, 2 Jan 2012 18:42:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229304 - stable/9/usr.sbin/pkg_install/add 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, 02 Jan 2012 18:42:30 -0000 Author: kensmith Date: Mon Jan 2 18:42:29 2012 New Revision: 229304 URL: http://svn.freebsd.org/changeset/base/229304 Log: The portion of r225757 that added the packages-9.0-release directory was supposed to be MFCed closer to the release but that got missed. Pointy hat: kensmith Modified: stable/9/usr.sbin/pkg_install/add/main.c Modified: stable/9/usr.sbin/pkg_install/add/main.c ============================================================================== --- stable/9/usr.sbin/pkg_install/add/main.c Mon Jan 2 18:06:48 2012 (r229303) +++ stable/9/usr.sbin/pkg_install/add/main.c Mon Jan 2 18:42:29 2012 (r229304) @@ -87,6 +87,7 @@ struct { { 800000, 800499, "/packages-8.0-release" }, { 801000, 801499, "/packages-8.1-release" }, { 802000, 802499, "/packages-8.2-release" }, + { 900000, 900499, "/packages-9.0-release" }, { 300000, 399000, "/packages-3-stable" }, { 400000, 499000, "/packages-4-stable" }, { 502100, 502128, "/packages-5-current" }, From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 18:50:17 2012 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 E1853106566C; Mon, 2 Jan 2012 18:50:17 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CFAFD8FC16; Mon, 2 Jan 2012 18:50: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 q02IoH2Y080848; Mon, 2 Jan 2012 18:50:17 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02IoHsS080846; Mon, 2 Jan 2012 18:50:17 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <201201021850.q02IoHsS080846@svn.freebsd.org> From: Ken Smith Date: Mon, 2 Jan 2012 18:50:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229305 - releng/9.0/usr.sbin/pkg_install/add 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, 02 Jan 2012 18:50:18 -0000 Author: kensmith Date: Mon Jan 2 18:50:17 2012 New Revision: 229305 URL: http://svn.freebsd.org/changeset/base/229305 Log: MFC r229304: > The portion of r225757 that added the packages-9.0-release directory > was supposed to be MFCed closer to the release but that got missed. > > Pointy hat: kensmith Approved by: re (implicit) Modified: releng/9.0/usr.sbin/pkg_install/add/main.c Directory Properties: releng/9.0/usr.sbin/pkg_install/ (props changed) Modified: releng/9.0/usr.sbin/pkg_install/add/main.c ============================================================================== --- releng/9.0/usr.sbin/pkg_install/add/main.c Mon Jan 2 18:42:29 2012 (r229304) +++ releng/9.0/usr.sbin/pkg_install/add/main.c Mon Jan 2 18:50:17 2012 (r229305) @@ -87,6 +87,7 @@ struct { { 800000, 800499, "/packages-8.0-release" }, { 801000, 801499, "/packages-8.1-release" }, { 802000, 802499, "/packages-8.2-release" }, + { 900000, 900499, "/packages-9.0-release" }, { 300000, 399000, "/packages-3-stable" }, { 400000, 499000, "/packages-4-stable" }, { 502100, 502128, "/packages-5-current" }, From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 18:59:16 2012 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 4C46A106566B; Mon, 2 Jan 2012 18:59:16 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 209938FC12; Mon, 2 Jan 2012 18:59: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 q02IxFvO081249; Mon, 2 Jan 2012 18:59:15 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02IxFUX081248; Mon, 2 Jan 2012 18:59:15 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <201201021859.q02IxFUX081248@svn.freebsd.org> From: Ken Smith Date: Mon, 2 Jan 2012 18:59:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-release@freebsd.org X-SVN-Group: release MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229306 - release/9.0.0/usr.sbin/pkg_install/add 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, 02 Jan 2012 18:59:16 -0000 Author: kensmith Date: Mon Jan 2 18:59:15 2012 New Revision: 229306 URL: http://svn.freebsd.org/changeset/base/229306 Log: Remove in preparation for re-copying usr.sbin/pkg_install/add/main.c to take into effect r229305. Pointy Hat: kensmith Approved by: re (implicit) Deleted: release/9.0.0/usr.sbin/pkg_install/add/main.c From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 18:59:56 2012 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 EA1E21065672; Mon, 2 Jan 2012 18:59:55 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D6CE08FC17; Mon, 2 Jan 2012 18:59: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 q02Ixtta081307; Mon, 2 Jan 2012 18:59:55 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02Ixt3c081305; Mon, 2 Jan 2012 18:59:55 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <201201021859.q02Ixt3c081305@svn.freebsd.org> From: Ken Smith Date: Mon, 2 Jan 2012 18:59:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-release@freebsd.org X-SVN-Group: release MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229307 - release/9.0.0/usr.sbin/pkg_install/add 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, 02 Jan 2012 18:59:56 -0000 Author: kensmith Date: Mon Jan 2 18:59:55 2012 New Revision: 229307 URL: http://svn.freebsd.org/changeset/base/229307 Log: Re-copy usr.sbin/pkg_install/add/main.c to take into effect r229305. Pointy Hat: kensmith Approved by: re (implicit) Added: - copied unchanged from r229306, releng/9.0/usr.sbin/pkg_install/add/main.c Directory Properties: release/9.0.0/usr.sbin/pkg_install/add/main.c (props changed) Copied: release/9.0.0/usr.sbin/pkg_install/add/main.c (from r229306, releng/9.0/usr.sbin/pkg_install/add/main.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ release/9.0.0/usr.sbin/pkg_install/add/main.c Mon Jan 2 18:59:55 2012 (r229307, copy of r229306, releng/9.0/usr.sbin/pkg_install/add/main.c) @@ -0,0 +1,362 @@ +/* + * + * FreeBSD install - a package for the installation and maintainance + * of non-core utilities. + * + * 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. + * + * Jordan K. Hubbard + * 18 July 1993 + * + * This is the add module. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include "lib.h" +#include "add.h" + +char *Prefix = NULL; +Boolean PrefixRecursive = FALSE; +char *Chroot = NULL; +Boolean NoInstall = FALSE; +Boolean NoRecord = FALSE; +Boolean Remote = FALSE; +Boolean KeepPackage = FALSE; +Boolean FailOnAlreadyInstalled = TRUE; +Boolean IgnoreDeps = FALSE; + +char *Mode = NULL; +char *Owner = NULL; +char *Group = NULL; +char *PkgName = NULL; +char *PkgAddCmd = NULL; +char *Directory = NULL; +char FirstPen[FILENAME_MAX]; +add_mode_t AddMode = NORMAL; + +char **pkgs; + +struct { + int lowver; /* Lowest version number to match */ + int hiver; /* Highest version number to match */ + const char *directory; /* Directory it lives in */ +} releases[] = { + { 410000, 410000, "/packages-4.1-release" }, + { 420000, 420000, "/packages-4.2-release" }, + { 430000, 430000, "/packages-4.3-release" }, + { 440000, 440000, "/packages-4.4-release" }, + { 450000, 450000, "/packages-4.5-release" }, + { 460000, 460001, "/packages-4.6-release" }, + { 460002, 460099, "/packages-4.6.2-release" }, + { 470000, 470099, "/packages-4.7-release" }, + { 480000, 480099, "/packages-4.8-release" }, + { 490000, 490099, "/packages-4.9-release" }, + { 491000, 491099, "/packages-4.10-release" }, + { 492000, 492099, "/packages-4.11-release" }, + { 500000, 500099, "/packages-5.0-release" }, + { 501000, 501099, "/packages-5.1-release" }, + { 502000, 502009, "/packages-5.2-release" }, + { 502010, 502099, "/packages-5.2.1-release" }, + { 503000, 503099, "/packages-5.3-release" }, + { 504000, 504099, "/packages-5.4-release" }, + { 505000, 505099, "/packages-5.5-release" }, + { 600000, 600099, "/packages-6.0-release" }, + { 601000, 601099, "/packages-6.1-release" }, + { 602000, 602099, "/packages-6.2-release" }, + { 603000, 603099, "/packages-6.3-release" }, + { 604000, 604099, "/packages-6.4-release" }, + { 700000, 700099, "/packages-7.0-release" }, + { 701000, 701099, "/packages-7.1-release" }, + { 702000, 702099, "/packages-7.2-release" }, + { 703000, 703099, "/packages-7.3-release" }, + { 704000, 704099, "/packages-7.4-release" }, + { 800000, 800499, "/packages-8.0-release" }, + { 801000, 801499, "/packages-8.1-release" }, + { 802000, 802499, "/packages-8.2-release" }, + { 900000, 900499, "/packages-9.0-release" }, + { 300000, 399000, "/packages-3-stable" }, + { 400000, 499000, "/packages-4-stable" }, + { 502100, 502128, "/packages-5-current" }, + { 503100, 599000, "/packages-5-stable" }, + { 600100, 699000, "/packages-6-stable" }, + { 700100, 799000, "/packages-7-stable" }, + { 800500, 899000, "/packages-8-stable" }, + { 900000, 999000, "/packages-9-current" }, + { 0, 9999999, "/packages-current" }, + { 0, 0, NULL } +}; + +static char *getpackagesite(void); +int getosreldate(void); + +static void usage(void); + +static char opts[] = "hviIRfFnrp:P:SMt:C:K"; +static struct option longopts[] = { + { "chroot", required_argument, NULL, 'C' }, + { "dry-run", no_argument, NULL, 'n' }, + { "force", no_argument, NULL, 'f' }, + { "help", no_argument, NULL, 'h' }, + { "keep", no_argument, NULL, 'K' }, + { "master", no_argument, NULL, 'M' }, + { "no-deps", no_argument, NULL, 'i' }, + { "no-record", no_argument, NULL, 'R' }, + { "no-script", no_argument, NULL, 'I' }, + { "prefix", required_argument, NULL, 'p' }, + { "remote", no_argument, NULL, 'r' }, + { "template", required_argument, NULL, 't' }, + { "slave", no_argument, NULL, 'S' }, + { "verbose", no_argument, NULL, 'v' }, + { NULL, 0, NULL, 0 } +}; + +int +main(int argc, char **argv) +{ + int ch, error; + char **start; + char *cp, *packagesite = NULL, *remotepkg = NULL, *ptr; + static char temppackageroot[MAXPATHLEN]; + static char pkgaddpath[MAXPATHLEN]; + + if (*argv[0] != '/' && strchr(argv[0], '/') != NULL) + PkgAddCmd = realpath(argv[0], pkgaddpath); + else + PkgAddCmd = argv[0]; + + start = argv; + while ((ch = getopt_long(argc, argv, opts, longopts, NULL)) != -1) { + switch(ch) { + case 'v': + Verbose++; + break; + + case 'p': + Prefix = optarg; + PrefixRecursive = FALSE; + break; + + case 'P': + Prefix = optarg; + PrefixRecursive = TRUE; + break; + + case 'I': + NoInstall = TRUE; + break; + + case 'R': + NoRecord = TRUE; + break; + + case 'f': + Force = TRUE; + break; + + case 'F': + FailOnAlreadyInstalled = FALSE; + break; + + case 'K': + KeepPackage = TRUE; + break; + + case 'n': + Fake = TRUE; + break; + + case 'r': + Remote = TRUE; + break; + + case 't': + if (strlcpy(FirstPen, optarg, sizeof(FirstPen)) >= sizeof(FirstPen)) + errx(1, "-t Argument too long."); + break; + + case 'S': + AddMode = SLAVE; + break; + + case 'M': + AddMode = MASTER; + break; + + case 'C': + Chroot = optarg; + break; + + case 'i': + IgnoreDeps = TRUE; + break; + + case 'h': + default: + usage(); + break; + } + } + argc -= optind; + argv += optind; + + if (AddMode != SLAVE) { + pkgs = (char **)malloc((argc+1) * sizeof(char *)); + for (ch = 0; ch <= argc; pkgs[ch++] = NULL) ; + + /* Get all the remaining package names, if any */ + for (ch = 0; *argv; ch++, argv++) { + char temp[MAXPATHLEN]; + if (Remote) { + if ((packagesite = getpackagesite()) == NULL) + errx(1, "package name too long"); + if (strlcpy(temppackageroot, packagesite, + sizeof(temppackageroot)) >= sizeof(temppackageroot)) + errx(1, "package name too long"); + if (strlcat(temppackageroot, *argv, sizeof(temppackageroot)) + >= sizeof(temppackageroot)) + errx(1, "package name too long"); + remotepkg = temppackageroot; + if (!((ptr = strrchr(remotepkg, '.')) && ptr[1] == 't' && + (ptr[2] == 'b' || ptr[2] == 'g' || ptr[2] == 'x') && + ptr[3] == 'z' && !ptr[4])) + if (strlcat(remotepkg, ".tbz", + sizeof(temppackageroot)) >= sizeof(temppackageroot)) + errx(1, "package name too long"); + } + if (!strcmp(*argv, "-")) /* stdin? */ + pkgs[ch] = (char *)"-"; + else if (isURL(*argv)) { /* preserve URLs */ + if (strlcpy(temp, *argv, sizeof(temp)) >= sizeof(temp)) + errx(1, "package name too long"); + pkgs[ch] = strdup(temp); + } + else if ((Remote) && isURL(remotepkg)) { + if (strlcpy(temp, remotepkg, sizeof(temp)) >= sizeof(temp)) + errx(1, "package name too long"); + pkgs[ch] = strdup(temp); + } else { /* expand all pathnames to fullnames */ + if (fexists(*argv)) /* refers to a file directly */ + pkgs[ch] = strdup(realpath(*argv, temp)); + else { /* look for the file in the expected places */ + if (!(cp = fileFindByPath(NULL, *argv))) { + /* let pkg_do() fail later, so that error is reported */ + if (strlcpy(temp, *argv, sizeof(temp)) >= sizeof(temp)) + errx(1, "package name too long"); + pkgs[ch] = strdup(temp); + } else { + if (strlcpy(temp, cp, sizeof(temp)) >= sizeof(temp)) + errx(1, "package name too long"); + pkgs[ch] = strdup(temp); + } + } + } + if (packagesite != NULL) + packagesite[0] = '\0'; + } + } + /* If no packages, yelp */ + if (!ch) { + warnx("missing package name(s)"); + usage(); + } + else if (ch > 1 && AddMode == MASTER) { + warnx("only one package name may be specified with master mode"); + usage(); + } + /* Perform chroot if requested */ + if (Chroot != NULL) { + if (chroot(Chroot)) + errx(1, "chroot to %s failed", Chroot); + } + /* Make sure the sub-execs we invoke get found */ + setenv("PATH", + "/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin", + 1); + + /* Set a reasonable umask */ + umask(022); + + if ((error = pkg_perform(pkgs)) != 0) { + if (Verbose) + warnx("%d package addition(s) failed", error); + return error; + } + else + return 0; +} + +static char * +getpackagesite(void) +{ + int reldate, i; + static char sitepath[MAXPATHLEN]; + int archmib[] = { CTL_HW, HW_MACHINE_ARCH }; + char arch[64]; + size_t archlen = sizeof(arch); + + if (getenv("PACKAGESITE")) { + if (strlcpy(sitepath, getenv("PACKAGESITE"), sizeof(sitepath)) + >= sizeof(sitepath)) + return NULL; + return sitepath; + } + + if (getenv("PACKAGEROOT")) { + if (strlcpy(sitepath, getenv("PACKAGEROOT"), sizeof(sitepath)) + >= sizeof(sitepath)) + return NULL; + } else { + if (strlcat(sitepath, "ftp://ftp.freebsd.org", sizeof(sitepath)) + >= sizeof(sitepath)) + return NULL; + } + + if (strlcat(sitepath, "/pub/FreeBSD/ports/", sizeof(sitepath)) + >= sizeof(sitepath)) + return NULL; + + if (sysctl(archmib, 2, arch, &archlen, NULL, 0) == -1) + return NULL; + arch[archlen-1] = 0; + if (strlcat(sitepath, arch, sizeof(sitepath)) >= sizeof(sitepath)) + return NULL; + + reldate = getosreldate(); + for(i = 0; releases[i].directory != NULL; i++) { + if (reldate >= releases[i].lowver && reldate <= releases[i].hiver) { + if (strlcat(sitepath, releases[i].directory, sizeof(sitepath)) + >= sizeof(sitepath)) + return NULL; + break; + } + } + + if (strlcat(sitepath, "/Latest/", sizeof(sitepath)) >= sizeof(sitepath)) + return NULL; + + return sitepath; + +} + +static void +usage(void) +{ + fprintf(stderr, "%s\n%s\n", + "usage: pkg_add [-viInfFrRMSK] [-t template] [-p prefix] [-P prefix] [-C chrootdir]", + " pkg-name [pkg-name ...]"); + exit(1); +} From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 19:23:53 2012 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 332D2106566B; Mon, 2 Jan 2012 19:23:53 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1C9078FC08; Mon, 2 Jan 2012 19:23:53 +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 q02JNq04082123; Mon, 2 Jan 2012 19:23:52 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02JNqMC082121; Mon, 2 Jan 2012 19:23:52 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201021923.q02JNqMC082121@svn.freebsd.org> From: Alexander Motin Date: Mon, 2 Jan 2012 19:23:52 +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: r229308 - in stable/8/sys: conf geom/multipath 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, 02 Jan 2012 19:23:53 -0000 Author: mav Date: Mon Jan 2 19:23:52 2012 New Revision: 229308 URL: http://svn.freebsd.org/changeset/base/229308 Log: Forcefully reMFC r208082, r208101 (mjacob) MFCed at r207126 and r209278 and for some reason reverted at r209279 without reverting metadatata. Modified: stable/8/sys/geom/multipath/g_multipath.c Directory Properties: stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) Modified: stable/8/sys/geom/multipath/g_multipath.c ============================================================================== --- stable/8/sys/geom/multipath/g_multipath.c Mon Jan 2 18:59:55 2012 (r229307) +++ stable/8/sys/geom/multipath/g_multipath.c Mon Jan 2 19:23:52 2012 (r229308) @@ -197,7 +197,7 @@ g_multipath_done_error(struct bio *bp) break; } } - if (sc->cp_active == NULL) { + if (sc->cp_active == NULL || sc->cp_active->provider == NULL) { printf("GEOM_MULTIPATH: out of providers for %s\n", sc->sc_name); g_topology_unlock(); @@ -743,7 +743,7 @@ g_multipath_ctl_getactive(struct gctl_re return; } sc = gp->softc; - if (sc->cp_active) { + if (sc->cp_active && sc->cp_active->provider) { sbuf_printf(sb, "%s\n", sc->cp_active->provider->name); } else { sbuf_printf(sb, "none\n"); From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 19:27:24 2012 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 98104106564A; Mon, 2 Jan 2012 19:27:24 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7EDE78FC13; Mon, 2 Jan 2012 19:27: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 q02JROYR082278; Mon, 2 Jan 2012 19:27:24 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02JROpO082273; Mon, 2 Jan 2012 19:27:24 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201021927.q02JROpO082273@svn.freebsd.org> From: Alexander Motin Date: Mon, 2 Jan 2012 19:27:24 +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: r229309 - in stable/8: sbin/geom/class/multipath sbin/geom/class/sched sys/conf sys/geom/multipath 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, 02 Jan 2012 19:27:24 -0000 Author: mav Date: Mon Jan 2 19:27:23 2012 New Revision: 229309 URL: http://svn.freebsd.org/changeset/base/229309 Log: MFC r227464, r227471: Major GEOM MULTIPATH class rewrite: - Improved locking and destruction process to fix crashes. - Improved "automatic" configuration method to make it consistent and safe by reading metadata back from all specified paths after writing to one. - Added provider size check to reduce chance of ordering conflict with other GEOM classes. - Added "manual" configuration method without using on-disk metadata. - Added "add" and "remove" commands to allow manage paths manually. - Failed paths are no longer dropped from geom, but only marked as FAIL and excluded from I/O operations. - Automatically restore failed paths when all others paths are marked as failed, for example, because of device-caused (not transport) errors. - Added "fail" and "restore" commands to manually control FAIL flag. - geom is now destroyed on last path disconnection. - Added optional Active/Active mode support. Unlike Active/Passive mode, load evenly distributed between all working paths. If supported by the device, it allows to significantly improve performance, utilizing bandwidth of all paths. It is controlled by -A option during creation. Disabled by default now. - Improved `status` and `list` commands output. Sponsored by: iXsystems, inc. Modified: stable/8/sbin/geom/class/multipath/geom_multipath.c stable/8/sbin/geom/class/multipath/gmultipath.8 stable/8/sys/geom/multipath/g_multipath.c stable/8/sys/geom/multipath/g_multipath.h Directory Properties: stable/8/sbin/geom/ (props changed) stable/8/sbin/geom/class/multipath/ (props changed) stable/8/sbin/geom/class/part/ (props changed) stable/8/sbin/geom/class/sched/gsched.8 (props changed) stable/8/sbin/geom/class/stripe/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sbin/geom/class/multipath/geom_multipath.c ============================================================================== --- stable/8/sbin/geom/class/multipath/geom_multipath.c Mon Jan 2 19:23:52 2012 (r229308) +++ stable/8/sbin/geom/class/multipath/geom_multipath.c Mon Jan 2 19:27:23 2012 (r229309) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -48,31 +49,58 @@ uint32_t version = G_MULTIPATH_VERSION; static void mp_main(struct gctl_req *, unsigned int); static void mp_label(struct gctl_req *); static void mp_clear(struct gctl_req *); -static void mp_add(struct gctl_req *); struct g_command class_commands[] = { { - "label", G_FLAG_VERBOSE | G_FLAG_LOADKLD, mp_main, G_NULL_OPTS, - NULL, "[-v] name prov ..." + "create", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL, + { + { 'A', "active_active", NULL, G_TYPE_BOOL }, + G_OPT_SENTINEL + }, + NULL, "[-vA] name prov ..." }, { - "add", G_FLAG_VERBOSE | G_FLAG_LOADKLD, mp_main, G_NULL_OPTS, - NULL, "[-v] name prov ..." + "label", G_FLAG_VERBOSE | G_FLAG_LOADKLD, mp_main, + { + { 'A', "active_active", NULL, G_TYPE_BOOL }, + G_OPT_SENTINEL + }, + NULL, "[-vA] name prov ..." }, { - "destroy", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, - NULL, "[-v] prov ..." + "add", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, + NULL, "[-v] name prov" }, { - "clear", G_FLAG_VERBOSE, mp_main, G_NULL_OPTS, - NULL, "[-v] prov ..." + "remove", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, + NULL, "[-v] name prov" + }, + { + "fail", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, + NULL, "[-v] name prov" + }, + { + "restore", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, + NULL, "[-v] name prov" }, { "rotate", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, - NULL, "[-v] prov ..." + NULL, "[-v] name" }, { "getactive", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, + NULL, "[-v] name" + }, + { + "destroy", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, + NULL, "[-v] name" + }, + { + "stop", G_FLAG_VERBOSE, NULL, G_NULL_OPTS, + NULL, "[-v] name" + }, + { + "clear", G_FLAG_VERBOSE, mp_main, G_NULL_OPTS, NULL, "[-v] prov ..." }, G_CMD_SENTINEL @@ -90,8 +118,6 @@ mp_main(struct gctl_req *req, unsigned i } if (strcmp(name, "label") == 0) { mp_label(req); - } else if (strcmp(name, "add") == 0) { - mp_add(req); } else if (strcmp(name, "clear") == 0) { mp_clear(req); } else { @@ -103,13 +129,13 @@ static void mp_label(struct gctl_req *req) { struct g_multipath_metadata md; - off_t disksiz = 0, msize; - uint8_t *sector; + off_t disksize = 0, msize; + uint8_t *sector, *rsector; char *ptr; uuid_t uuid; uint32_t secsize = 0, ssize, status; - const char *name, *mpname; - int error, i, nargs; + const char *name, *name2, *mpname; + int error, i, nargs, fd; nargs = gctl_get_int(req, "nargs"); if (nargs < 2) { @@ -132,14 +158,14 @@ mp_label(struct gctl_req *req) } if (i == 1) { secsize = ssize; - disksiz = msize; + disksize = msize; } else { if (secsize != ssize) { gctl_error(req, "%s sector size %u different.", name, ssize); return; } - if (disksiz != msize) { + if (disksize != msize) { gctl_error(req, "%s media size %ju different.", name, (intmax_t)msize); return; @@ -155,7 +181,7 @@ mp_label(struct gctl_req *req) md.md_version = G_MULTIPATH_VERSION; mpname = gctl_get_ascii(req, "arg0"); strlcpy(md.md_name, mpname, sizeof(md.md_name)); - md.md_size = disksiz; + md.md_size = disksize; md.md_sectorsize = secsize; uuid_create(&uuid, &status); if (status != uuid_s_ok) { @@ -168,19 +194,10 @@ mp_label(struct gctl_req *req) return; } strlcpy(md.md_uuid, ptr, sizeof (md.md_uuid)); + md.md_active_active = gctl_get_int(req, "active_active"); free(ptr); /* - * Clear metadata on initial provider first. - */ - name = gctl_get_ascii(req, "arg1"); - error = g_metadata_clear(name, NULL); - if (error != 0) { - gctl_error(req, "cannot clear metadata on %s: %s.", name, strerror(error)); - return; - } - - /* * Allocate a sector to write as metadata. */ sector = malloc(secsize); @@ -189,6 +206,12 @@ mp_label(struct gctl_req *req) return; } memset(sector, 0, secsize); + rsector = malloc(secsize); + if (rsector == NULL) { + free(sector); + gctl_error(req, "unable to allocate metadata buffer"); + return; + } /* * encode the metadata @@ -198,6 +221,7 @@ mp_label(struct gctl_req *req) /* * Store metadata on the initial provider. */ + name = gctl_get_ascii(req, "arg1"); error = g_metadata_store(name, sector, secsize); if (error != 0) { gctl_error(req, "cannot store metadata on %s: %s.", name, strerror(error)); @@ -205,20 +229,29 @@ mp_label(struct gctl_req *req) } /* - * Now add the rest of the providers. + * Now touch the rest of the providers to hint retaste. */ - error = gctl_change_param(req, "verb", -1, "add"); - if (error) { - gctl_error(req, "unable to change verb to \"add\": %s.", strerror(error)); - return; - } for (i = 2; i < nargs; i++) { - error = gctl_change_param(req, "arg1", -1, gctl_get_ascii(req, "arg%d", i)); - if (error) { - gctl_error(req, "unable to add %s to %s: %s.", gctl_get_ascii(req, "arg%d", i), mpname, strerror(error)); + name2 = gctl_get_ascii(req, "arg%d", i); + fd = g_open(name2, 1); + if (fd < 0) { + fprintf(stderr, "Unable to open %s: %s.\n", + name2, strerror(errno)); + continue; + } + if (pread(fd, rsector, secsize, disksize - secsize) != + (ssize_t)secsize) { + fprintf(stderr, "Unable to read metadata from %s: %s.\n", + name2, strerror(errno)); + g_close(fd); continue; } - mp_add(req); + g_close(fd); + if (memcmp(sector, rsector, secsize)) { + fprintf(stderr, "No metadata found on %s." + " It is not a path of %s.\n", + name2, name); + } } } @@ -247,13 +280,3 @@ mp_clear(struct gctl_req *req) } } -static void -mp_add(struct gctl_req *req) -{ - const char *errstr; - - errstr = gctl_issue(req); - if (errstr != NULL && errstr[0] != '\0') { - gctl_error(req, "%s", errstr); - } -} Modified: stable/8/sbin/geom/class/multipath/gmultipath.8 ============================================================================== --- stable/8/sbin/geom/class/multipath/gmultipath.8 Mon Jan 2 19:23:52 2012 (r229308) +++ stable/8/sbin/geom/class/multipath/gmultipath.8 Mon Jan 2 19:27:23 2012 (r229309) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 26, 2007 +.Dd October 31, 2011 .Dt GMULTIPATH 8 .Os .Sh NAME @@ -32,11 +32,48 @@ .Nd "disk multipath control utility" .Sh SYNOPSIS .Nm +.Cm create +.Op Fl Av +.Ar name +.Ar prov ... +.Nm .Cm label -.Op Fl hv +.Op Fl Av .Ar name .Ar prov ... .Nm +.Cm add +.Op Fl v +.Ar name prov +.Nm +.Cm remove +.Op Fl v +.Ar name prov +.Nm +.Cm fail +.Op Fl v +.Ar name prov +.Nm +.Cm restore +.Op Fl v +.Ar name prov +.Nm +.Cm rotate +.Op Fl v +.Ar name +.Nm +.Cm getactive +.Op Fl v +.Ar name +.Nm +.Cm destroy +.Op Fl v +.Ar name +.Nm +.Cm stop +.Op Fl v +.Ar name +.Nm .Cm clear .Op Fl v .Ar prov ... @@ -53,27 +90,79 @@ The .Nm utility is used for device multipath configuration. .Pp -Only automatic configuration is supported at the present time via the -.Cm label -command. -This operation writes a label on the last sector of the underlying -disk device with a contained name and UUID. -The UUID guarantees uniqueness -in a shared storage environment but is in general too cumbersome to use. +The multipath device can be configured using two different methods: +.Dq manual +or +.Dq automatic . +When using the +.Dq manual +method, no metadata are stored on the devices, so the multipath +device has to be configured by hand every time it is needed. +Additional device paths also won't be detected automatically. +The +.Dq automatic +method uses on-disk metadata to detect device and all it's paths. +Metadata use the last sector of the underlying disk device and +include device name and UUID. +The UUID guarantees uniqueness in a shared storage environment +but is in general too cumbersome to use. The name is what is exported via the device interface. .Pp The first argument to .Nm indicates an action to be performed: .Bl -tag -width ".Cm destroy" +.It Cm create +Create multipath device with +.Dq manual +method without writing any on-disk metadata. +It is up to administrator, how to properly identify device paths. +Kernel will only check that all given providers have same media and +sector sizes. +.Pp +.Fl A +option enables Active/Active mode, otherwise Active/Passive mode is used +by default. .It Cm label -Label the given underlying device with the specified +Create multipath device with +.Dq automatic +method. +Label the first given provider with on-disk metadata using the specified .Ar name . -The kernel module -.Pa geom_multipath.ko -will be loaded if it is not loaded already. +The rest of given providers will be retasted to detect these metadata. +It reliably protects against specifying unrelated providers. +Providers with no matching metadata detected will not be added to the device. +.Pp +.Fl A +option enables Active/Active mode, otherwise Active/Passive mode is used +by default. +.It Cm add +Add the given provider as a path to the given multipath device. +Should normally be used only for devices created with +.Dq manual +method, unless you know what you are doing (you are sure that it is another +device path, but tasting its metadata in regular +.Dq automatic +way is not possible). +.It Cm remove +Remove the given provider as a path from the given multipath device. +If the last path removed, the multipath device will be destroyed. +.It Cm fail +Mark specified provider as a path of the specified multipath device as failed. +If there are other paths present, new requests will be forwarded there. +.It Cm restore +Mark specified provider as a path of the specified multipath device as +operational, allowing it to handle requests. +.It Cm rotate +Change the active provider/path in Active/Passive mode. +.It Cm getactive +Get the currently active provider(s)/path(s). +.It Cm destroy +Destroy the given multipath device clearing metadata. +.It Cm stop +Stop the given multipath device without clearing metadata. .It Cm clear -Clear metadata on the given device. +Clear metadata on the given provider. .It Cm list See .Xr geom 8 . @@ -101,14 +190,15 @@ Debug level of the GEOM class. This can be set to 0 (default) or 1 to disable or enable various forms of chattiness. +.It Va kern.geom.multipath.exclusive : No 1 +Open underlying providers exclusively, preventing individual paths access. .El .Sh EXIT STATUS Exit status is 0 on success, and 1 if the command fails. .Sh MULTIPATH ARCHITECTURE .Pp -This is an active/passive -multiple path architecture with no device knowledge or presumptions other -than size matching built in. +This is a multiple path architecture with no device knowledge or +presumptions other than size matching built in. Therefore the user must exercise some care in selecting providers that do indeed represent multiple paths to the same underlying disk device. @@ -133,15 +223,16 @@ of multiple pathnames refer to the same system operator who will use tools and knowledge of their own storage subsystem to make the correct configuration selection. .Pp -As an active/passive architecture, only one path has I/O moving on it +There are Active/Passive and Active/Active operation modes supported. +In Active/Passive mode only one path has I/O moving on it at any point in time. This I/O continues until an I/O is returned with a generic I/O error or a "Nonexistent Device" error. -When this occurs, -the active device is kicked out of the -.Nm MULTIPATH -GEOM class and the next in a list is selected, the failed I/O reissued -and the system proceeds. +When this occurs, that path is marked FAIL, the next path +in a list is selected as active and the failed I/O reissued. +In Active/Active mode all paths not marked FAIL may handle I/O same time. +Requests are distributed between paths to equalize load. +For capable devices it allows to utilize bandwidth of all paths. .Pp When new devices are added to the system the .Nm MULTIPATH @@ -149,9 +240,9 @@ GEOM class is given an opportunity to ta If a new device has a .Nm MULTIPATH -label, the device is used to either create a new +on-disk metadata label, the device is used to either create a new .Nm MULTIPATH -GEOM, or to attach to the end of the list of devices for an existing +GEOM, or been added the list of paths for an existing .Nm MULTIPATH GEOM. .Pp @@ -176,7 +267,7 @@ of an RSCN event from the Fabric Domain a rescan to occur and cause the attachment and configuration of any (now) new devices to occur, causing the taste event described above. .Pp -This means that this active/passive architecture is not a one-shot path +This means that this multipath architecture is not a one-shot path failover, but can be considered to be steady state as long as failed paths are repaired (automatically or otherwise). .Pp @@ -184,7 +275,7 @@ Automatic rescanning is not a requiremen Nor is Fibre Channel. The same failover mechanisms work equally well for traditional "Parallel" -SCSI but require manual intervention with +SCSI but may require manual intervention with .Xr camcontrol 8 to cause the reattachment of repaired device links. .Sh EXAMPLES @@ -226,9 +317,9 @@ mount /dev/multipath/FREDa /mnt.... .Pp The resultant console output looks something like: .Bd -literal -offset indent -GEOM_MULTIPATH: adding da0 to Fred/b631385f-c61c-11db-b884-0011116ae789 -GEOM_MULTIPATH: da0 now active path in Fred -GEOM_MULTIPATH: adding da2 to Fred/b631385f-c61c-11db-b884-0011116ae789 +GEOM_MULTIPATH: da0 added to FRED +GEOM_MULTIPATH: da0 is now active path in FRED +GEOM_MULTIPATH: da2 added to FRED .Ed .Sh SEE ALSO .Xr geom 4 , @@ -240,24 +331,6 @@ GEOM_MULTIPATH: adding da2 to Fred/b6313 .Xr mount 8 , .Xr newfs 8 , .Xr sysctl 8 -.Sh BUGS -The -.Nm -should allow for a manual method of pairing disks. -.Pp -There is currently no way for -.Pa geom_multipath.ko -to distinguish between various label instances of the same provider. -That -is devices such as -.Ar da0 -and -.Ar da0c -can be tasted and instantiated as multiple paths for the same device. -Technically, this is correct, but pretty useless. -This will be fixed soon -(I hope), but to avoid this it is a good idea to destroy any label on -the disk object prior to labelling it with -.Nm . .Sh AUTHOR .An Matthew Jacob Aq mjacob@FreeBSD.org +.An Alexander Motin Aq mav@FreeBSD.org Modified: stable/8/sys/geom/multipath/g_multipath.c ============================================================================== --- stable/8/sys/geom/multipath/g_multipath.c Mon Jan 2 19:23:52 2012 (r229308) +++ stable/8/sys/geom/multipath/g_multipath.c Mon Jan 2 19:27:23 2012 (r229309) @@ -1,4 +1,5 @@ /*- + * Copyright (c) 2011 Alexander Motin * Copyright (c) 2006-2007 Matthew Jacob * All rights reserved. * @@ -51,6 +52,9 @@ SYSCTL_NODE(_kern_geom, OID_AUTO, multip static u_int g_multipath_debug = 0; SYSCTL_UINT(_kern_geom_multipath, OID_AUTO, debug, CTLFLAG_RW, &g_multipath_debug, 0, "Debug level"); +static u_int g_multipath_exclusive = 1; +SYSCTL_UINT(_kern_geom_multipath, OID_AUTO, exclusive, CTLFLAG_RW, + &g_multipath_exclusive, 0, "Exclusively open providers"); static enum { GKT_NIL, @@ -77,6 +81,7 @@ static g_taste_t g_multipath_taste; static g_ctl_req_t g_multipath_config; static g_init_t g_multipath_init; static g_fini_t g_multipath_fini; +static g_dumpconf_t g_multipath_dumpconf; struct g_class g_multipath_class = { .name = G_MULTIPATH_CLASS_NAME, @@ -88,35 +93,144 @@ struct g_class g_multipath_class = { .fini = g_multipath_fini }; -#define MP_BAD 0x1 -#define MP_POSTED 0x2 +#define MP_FAIL 0x00000001 +#define MP_LOST 0x00000002 +#define MP_NEW 0x00000004 +#define MP_POSTED 0x00000008 +#define MP_BAD (MP_FAIL | MP_LOST | MP_NEW) +#define MP_IDLE 0x00000010 +#define MP_IDLE_MASK 0xfffffff0 + +static int +g_multipath_good(struct g_geom *gp) +{ + struct g_consumer *cp; + int n = 0; + + LIST_FOREACH(cp, &gp->consumer, consumer) { + if ((cp->index & MP_BAD) == 0) + n++; + } + return (n); +} + +static void +g_multipath_fault(struct g_consumer *cp, int cause) +{ + struct g_multipath_softc *sc; + struct g_consumer *lcp; + struct g_geom *gp; + + gp = cp->geom; + sc = gp->softc; + cp->index |= cause; + if (g_multipath_good(gp) == 0 && sc->sc_ndisks > 0) { + LIST_FOREACH(lcp, &gp->consumer, consumer) { + if (lcp->provider == NULL || + (lcp->index & (MP_LOST | MP_NEW))) + continue; + if (sc->sc_ndisks > 1 && lcp == cp) + continue; + printf("GEOM_MULTIPATH: " + "all paths in %s were marked FAIL, restore %s\n", + sc->sc_name, lcp->provider->name); + lcp->index &= ~MP_FAIL; + } + } + if (cp != sc->sc_active) + return; + sc->sc_active = NULL; + LIST_FOREACH(lcp, &gp->consumer, consumer) { + if ((lcp->index & MP_BAD) == 0) { + sc->sc_active = lcp; + break; + } + } + if (sc->sc_active == NULL) { + printf("GEOM_MULTIPATH: out of providers for %s\n", + sc->sc_name); + } else if (!sc->sc_active_active) { + printf("GEOM_MULTIPATH: %s is now active path in %s\n", + sc->sc_active->provider->name, sc->sc_name); + } +} + +static struct g_consumer * +g_multipath_choose(struct g_geom *gp) +{ + struct g_multipath_softc *sc; + struct g_consumer *best, *cp; + + sc = gp->softc; + if (!sc->sc_active_active) + return (sc->sc_active); + best = NULL; + LIST_FOREACH(cp, &gp->consumer, consumer) { + if (cp->index & MP_BAD) + continue; + cp->index += MP_IDLE; + if (best == NULL || cp->private < best->private || + (cp->private == best->private && cp->index > best->index)) + best = cp; + } + if (best != NULL) + best->index &= ~MP_IDLE_MASK; + return (best); +} static void g_mpd(void *arg, int flags __unused) { + struct g_geom *gp; + struct g_multipath_softc *sc; struct g_consumer *cp; + int w; g_topology_assert(); cp = arg; - if (cp->acr > 0 || cp->acw > 0 || cp->ace > 0) + gp = cp->geom; + if (cp->acr > 0 || cp->acw > 0 || cp->ace > 0) { + w = cp->acw; g_access(cp, -cp->acr, -cp->acw, -cp->ace); + if (w > 0 && cp->provider != NULL && + (cp->provider->geom->flags & G_GEOM_WITHER) == 0) { + g_post_event(g_mpd, cp, M_WAITOK, NULL); + return; + } + } + sc = gp->softc; + mtx_lock(&sc->sc_mtx); if (cp->provider) { printf("GEOM_MULTIPATH: %s removed from %s\n", - cp->provider->name, cp->geom->name); + cp->provider->name, gp->name); g_detach(cp); } g_destroy_consumer(cp); + mtx_unlock(&sc->sc_mtx); + if (LIST_EMPTY(&gp->consumer)) + g_multipath_destroy(gp); } static void g_multipath_orphan(struct g_consumer *cp) { - if ((cp->index & MP_POSTED) == 0) { + struct g_multipath_softc *sc; + uintptr_t *cnt; + + g_topology_assert(); + printf("GEOM_MULTIPATH: %s in %s was disconnected\n", + cp->provider->name, cp->geom->name); + sc = cp->geom->softc; + cnt = (uintptr_t *)&cp->private; + mtx_lock(&sc->sc_mtx); + sc->sc_ndisks--; + g_multipath_fault(cp, MP_LOST); + if (*cnt == 0 && (cp->index & MP_POSTED) == 0) { cp->index |= MP_POSTED; - printf("GEOM_MULTIPATH: %s orphaned in %s\n", - cp->provider->name, cp->geom->name); + mtx_unlock(&sc->sc_mtx); g_mpd(cp, 0); - } + } else + mtx_unlock(&sc->sc_mtx); } static void @@ -126,20 +240,29 @@ g_multipath_start(struct bio *bp) struct g_geom *gp; struct g_consumer *cp; struct bio *cbp; + uintptr_t *cnt; gp = bp->bio_to->geom; sc = gp->softc; KASSERT(sc != NULL, ("NULL sc")); - cp = sc->cp_active; - if (cp == NULL) { - g_io_deliver(bp, ENXIO); - return; - } cbp = g_clone_bio(bp); if (cbp == NULL) { g_io_deliver(bp, ENOMEM); return; } + mtx_lock(&sc->sc_mtx); + cp = g_multipath_choose(gp); + if (cp == NULL) { + mtx_unlock(&sc->sc_mtx); + g_destroy_bio(cbp); + g_io_deliver(bp, ENXIO); + return; + } + if ((uintptr_t)bp->bio_driver1 < sc->sc_ndisks) + bp->bio_driver1 = (void *)(uintptr_t)sc->sc_ndisks; + cnt = (uintptr_t *)&cp->private; + (*cnt)++; + mtx_unlock(&sc->sc_mtx); cbp->bio_done = g_multipath_done; g_io_request(cbp, cp); } @@ -147,12 +270,27 @@ g_multipath_start(struct bio *bp) static void g_multipath_done(struct bio *bp) { + struct g_multipath_softc *sc; + struct g_consumer *cp; + uintptr_t *cnt; + if (bp->bio_error == ENXIO || bp->bio_error == EIO) { mtx_lock(&gmtbq_mtx); bioq_insert_tail(&gmtbq, bp); - wakeup(&g_multipath_kt_state); mtx_unlock(&gmtbq_mtx); + wakeup(&g_multipath_kt_state); } else { + cp = bp->bio_from; + sc = cp->geom->softc; + cnt = (uintptr_t *)&cp->private; + mtx_lock(&sc->sc_mtx); + (*cnt)--; + if (*cnt == 0 && (cp->index & MP_LOST)) { + cp->index |= MP_POSTED; + mtx_unlock(&sc->sc_mtx); + g_post_event(g_mpd, cp, M_WAITOK, NULL); + } else + mtx_unlock(&sc->sc_mtx); g_std_done(bp); } } @@ -165,6 +303,7 @@ g_multipath_done_error(struct bio *bp) struct g_multipath_softc *sc; struct g_consumer *cp; struct g_provider *pp; + uintptr_t *cnt; /* * If we had a failure, we have to check first to see @@ -174,47 +313,31 @@ g_multipath_done_error(struct bio *bp) * to the next available consumer. */ - g_topology_lock(); pbp = bp->bio_parent; gp = pbp->bio_to->geom; sc = gp->softc; cp = bp->bio_from; pp = cp->provider; + cnt = (uintptr_t *)&cp->private; - cp->index |= MP_BAD; - if (cp->nend == cp->nstart && pp->nend == pp->nstart) { + mtx_lock(&sc->sc_mtx); + printf("GEOM_MULTIPATH: Error %d, %s in %s marked FAIL\n", + bp->bio_error, pp->name, sc->sc_name); + g_multipath_fault(cp, MP_FAIL); + (*cnt)--; + if (*cnt == 0 && (cp->index & (MP_LOST | MP_POSTED)) == MP_LOST) { cp->index |= MP_POSTED; - g_post_event(g_mpd, cp, M_NOWAIT, NULL); - } - if (cp == sc->cp_active) { - struct g_consumer *lcp; - printf("GEOM_MULTIPATH: %s failed in %s\n", - pp->name, sc->sc_name); - sc->cp_active = NULL; - LIST_FOREACH(lcp, &gp->consumer, consumer) { - if ((lcp->index & MP_BAD) == 0) { - sc->cp_active = lcp; - break; - } - } - if (sc->cp_active == NULL || sc->cp_active->provider == NULL) { - printf("GEOM_MULTIPATH: out of providers for %s\n", - sc->sc_name); - g_topology_unlock(); - return; - } else { - printf("GEOM_MULTIPATH: %s now active path in %s\n", - sc->cp_active->provider->name, sc->sc_name); - } - } - g_topology_unlock(); + mtx_unlock(&sc->sc_mtx); + g_post_event(g_mpd, cp, M_WAITOK, NULL); + } else + mtx_unlock(&sc->sc_mtx); /* * If we can fruitfully restart the I/O, do so. */ - if (sc->cp_active) { + if (pbp->bio_children < (uintptr_t)pbp->bio_driver1) { + pbp->bio_inbed++; g_destroy_bio(bp); - pbp->bio_children--; g_multipath_start(pbp); } else { g_std_done(bp); @@ -252,6 +375,7 @@ g_multipath_access(struct g_provider *pp { struct g_geom *gp; struct g_consumer *cp, *badcp = NULL; + struct g_multipath_softc *sc; int error; gp = pp->geom; @@ -263,6 +387,10 @@ g_multipath_access(struct g_provider *pp goto fail; } } + sc = gp->softc; + sc->sc_opened += dr + dw + de; + if (sc->sc_stopping && sc->sc_opened == 0) + g_multipath_destroy(gp); return (0); fail: @@ -284,6 +412,9 @@ g_multipath_create(struct g_class *mp, s g_topology_assert(); LIST_FOREACH(gp, &mp->geom, geom) { + sc = gp->softc; + if (sc == NULL || sc->sc_stopping) + continue; if (strcmp(gp->name, md->md_name) == 0) { printf("GEOM_MULTIPATH: name %s already exists\n", md->md_name); @@ -293,19 +424,25 @@ g_multipath_create(struct g_class *mp, s gp = g_new_geomf(mp, md->md_name); sc = g_malloc(sizeof(*sc), M_WAITOK | M_ZERO); + mtx_init(&sc->sc_mtx, "multipath", NULL, MTX_DEF); + memcpy(sc->sc_uuid, md->md_uuid, sizeof (sc->sc_uuid)); + memcpy(sc->sc_name, md->md_name, sizeof (sc->sc_name)); + sc->sc_active_active = md->md_active_active; gp->softc = sc; gp->start = g_multipath_start; gp->orphan = g_multipath_orphan; gp->access = g_multipath_access; - memcpy(sc->sc_uuid, md->md_uuid, sizeof (sc->sc_uuid)); - memcpy(sc->sc_name, md->md_name, sizeof (sc->sc_name)); + gp->dumpconf = g_multipath_dumpconf; pp = g_new_providerf(gp, "multipath/%s", md->md_name); - /* limit the provider to not have it stomp on metadata */ - pp->mediasize = md->md_size - md->md_sectorsize; - pp->sectorsize = md->md_sectorsize; - sc->pp = pp; + if (md->md_size != 0) { + pp->mediasize = md->md_size - + ((md->md_uuid[0] != 0) ? md->md_sectorsize : 0); + pp->sectorsize = md->md_sectorsize; + } + sc->sc_pp = pp; g_error_provider(pp, 0); + printf("GEOM_MULTIPATH: %s created\n", gp->name); return (gp); } @@ -314,7 +451,7 @@ g_multipath_add_disk(struct g_geom *gp, { struct g_multipath_softc *sc; struct g_consumer *cp, *nxtcp; - int error; + int error, acr, acw, ace; g_topology_assert(); @@ -335,6 +472,8 @@ g_multipath_add_disk(struct g_geom *gp, } nxtcp = LIST_FIRST(&gp->consumer); cp = g_new_consumer(gp); + cp->private = NULL; + cp->index = MP_NEW; error = g_attach(cp, pp); if (error != 0) { printf("GEOM_MULTIPATH: cannot attach %s to %s", @@ -342,29 +481,51 @@ g_multipath_add_disk(struct g_geom *gp, g_destroy_consumer(cp); return (error); } - cp->private = sc; - cp->index = 0; /* * Set access permissions on new consumer to match other consumers */ - if (nxtcp && (nxtcp->acr + nxtcp->acw + nxtcp->ace)) { - error = g_access(cp, nxtcp->acr, nxtcp->acw, nxtcp->ace); - if (error) { - printf("GEOM_MULTIPATH: cannot set access in " - "attaching %s to %s/%s (%d)\n", - pp->name, sc->sc_name, sc->sc_uuid, error); - g_detach(cp); - g_destroy_consumer(cp); - return (error); - } + if (sc->sc_pp) { + acr = sc->sc_pp->acr; + acw = sc->sc_pp->acw; + ace = sc->sc_pp->ace; + } else + acr = acw = ace = 0; + if (g_multipath_exclusive) { + acr++; + acw++; + ace++; + } + error = g_access(cp, acr, acw, ace); + if (error) { + printf("GEOM_MULTIPATH: cannot set access in " + "attaching %s to %s (%d)\n", + pp->name, sc->sc_name, error); + g_detach(cp); + g_destroy_consumer(cp); + return (error); } - printf("GEOM_MULTIPATH: adding %s to %s/%s\n", - pp->name, sc->sc_name, sc->sc_uuid); - if (sc->cp_active == NULL) { - sc->cp_active = cp; - printf("GEOM_MULTIPATH: %s now active path in %s\n", - pp->name, sc->sc_name); + if (sc->sc_pp != NULL && sc->sc_pp->mediasize == 0) { + sc->sc_pp->mediasize = pp->mediasize - + ((sc->sc_uuid[0] != 0) ? pp->sectorsize : 0); + sc->sc_pp->sectorsize = pp->sectorsize; + } + if (sc->sc_pp != NULL && + sc->sc_pp->stripesize == 0 && sc->sc_pp->stripeoffset == 0) { + sc->sc_pp->stripesize = pp->stripesize; + sc->sc_pp->stripeoffset = pp->stripeoffset; + } + mtx_lock(&sc->sc_mtx); + cp->index = 0; + sc->sc_ndisks++; + mtx_unlock(&sc->sc_mtx); + printf("GEOM_MULTIPATH: %s added to %s\n", + pp->name, sc->sc_name); + if (sc->sc_active == NULL) { + sc->sc_active = cp; + if (!sc->sc_active_active) + printf("GEOM_MULTIPATH: %s is now active path in %s\n", + pp->name, sc->sc_name); } return (0); } @@ -372,17 +533,41 @@ g_multipath_add_disk(struct g_geom *gp, static int g_multipath_destroy(struct g_geom *gp) { - struct g_provider *pp; + struct g_multipath_softc *sc; + struct g_consumer *cp, *cp1; g_topology_assert(); if (gp->softc == NULL) return (ENXIO); - pp = LIST_FIRST(&gp->provider); - if (pp != NULL && (pp->acr != 0 || pp->acw != 0 || pp->ace != 0)) - return (EBUSY); - printf("GEOM_MULTIPATH: destroying %s\n", gp->name); + sc = gp->softc; + if (!sc->sc_stopping) { + printf("GEOM_MULTIPATH: destroying %s\n", gp->name); + sc->sc_stopping = 1; + } + if (sc->sc_opened != 0) { + if (sc->sc_pp != NULL) { + g_wither_provider(sc->sc_pp, ENXIO); + sc->sc_pp = NULL; + } + return (EINPROGRESS); + } + LIST_FOREACH_SAFE(cp, &gp->consumer, consumer, cp1) { + mtx_lock(&sc->sc_mtx); + if ((cp->index & MP_POSTED) == 0) { + cp->index |= MP_POSTED; + mtx_unlock(&sc->sc_mtx); + g_mpd(cp, 0); + if (cp1 == NULL) + return(0); /* Recursion happened. */ + } else + mtx_unlock(&sc->sc_mtx); + } + if (!LIST_EMPTY(&gp->consumer)) + return (EINPROGRESS); + mtx_destroy(&sc->sc_mtx); g_free(gp->softc); gp->softc = NULL; + printf("GEOM_MULTIPATH: %s destroyed\n", gp->name); g_wither_geom(gp, ENXIO); return (0); } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 19:27:25 2012 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 0F646106566C; Mon, 2 Jan 2012 19:27:25 +0000 (UTC) (envelope-from Hartmut.Brandt@dlr.de) Received: from mailhost.dlr.de (mailhost.dlr.de [129.247.252.32]) by mx1.freebsd.org (Postfix) with ESMTP id 621848FC08; Mon, 2 Jan 2012 19:27:24 +0000 (UTC) Received: from DLREXHUB01.intra.dlr.de (172.21.152.130) by dlrexedge01.dlr.de (172.21.163.100) with Microsoft SMTP Server (TLS) id 14.1.355.2; Mon, 2 Jan 2012 20:27:00 +0100 Received: from beagle.kn.op.dlr.de (129.247.178.136) by smtp.dlr.de (172.21.152.151) with Microsoft SMTP Server (TLS) id 14.1.355.2; Mon, 2 Jan 2012 20:27:01 +0100 Date: Mon, 2 Jan 2012 20:26:55 +0100 From: Harti Brandt X-X-Sender: brandt_h@beagle.kn.op.dlr.de To: Ulrich Spoerlein In-Reply-To: <20120101171324.GM83814@acme.spoerlein.net> Message-ID: <20120102201549.X41320@beagle.kn.op.dlr.de> References: <201112301058.pBUAwFsw010478@svn.freebsd.org> <20111230204653.Y31442@beagle.kn.op.dlr.de> <20120101171324.GM83814@acme.spoerlein.net> X-OpenPGP-Key: harti@freebsd.org MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="1964543108-640420677-1325532415=:41320" X-Originating-IP: [129.247.178.136] Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Harti Brandt , Ben Kaduk Subject: Re: svn commit: r228990 - in head/usr.sbin: IPXrouted adduser bluetooth/btpand bluetooth/sdpd bootparamd/bootparamd bsnmpd/modules/snmp_bridge bsnmpd/modules/snmp_hostres bsnmpd/modules/snmp_wlan bsnmp... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Harti Brandt 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, 02 Jan 2012 19:27:25 -0000 --1964543108-640420677-1325532415=:41320 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: QUOTED-PRINTABLE Hi Uli, On Sun, 1 Jan 2012, Ulrich Spoerlein wrote: US>Sorry for the delay. US> US>On Fri, 2011-12-30 at 20:50:16 +0100, Harti Brandt wrote: US>> On Fri, 30 Dec 2011, Ben Kaduk wrote: US>> >On Fri, Dec 30, 2011 at 5:58 AM, Ulrich Spoerlein w= rote: US>> >> Modified: head/usr.sbin/bsnmpd/modules/snmp_wlan/BEGEMOT-WIRELESS-M= IB.txt US>> >> =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 US>> >> --- head/usr.sbin/bsnmpd/modules/snmp_wlan/BEGEMOT-WIRELESS-MIB.txt= =9A =9A Fri Dec 30 10:45:00 2011 =9A =9A =9A =9A(r228989) US>> >> +++ head/usr.sbin/bsnmpd/modules/snmp_wlan/BEGEMOT-WIRELESS-MIB.txt= =9A =9A Fri Dec 30 10:58:14 2011 =9A =9A =9A =9A(r228990) US>> >> @@ -82,8 +82,8 @@ WlanMgmtReasonCode ::=3D TEXTUAL-CONVENTIO US>> >> =9A =9A =9A =9A =9A =9A =9A =9A =9A =9AassociationLeave(8), US>> >> =9A =9A =9A =9A =9A =9A =9A =9A =9A =9AassociationNotAuthenticated(= 9), US>> >> =9A-- XXX: TODO - FIXME US>> >> - =9A =9A =9A =9A =9A =9A =9A =9A =9A dissasocPwrcapBad(10), US>> >> - =9A =9A =9A =9A =9A =9A =9A =9A =9A dissasocSuperchanBad(11), US>> >> + =9A =9A =9A =9A =9A =9A =9A =9A =9A disassocPwrcapBad(10), US>> >> + =9A =9A =9A =9A =9A =9A =9A =9A =9A disassocSuperchanBad(11), US>> > US>> >This file looks like it might be intended to be machine-readable -- I US>> >would worry about changing it without test/review. US>> >Perhaps this spelling "error" is even the reason for the XXX comment = above. US>>=20 US>> Absolutely. If there is a spelling error in an SNMP MIB outside commen= ts=20 US>> or description strings it must stay there. Otherwise applications read= ing=20 US>> that file will break. US>>=20 US>> This is also true for the corresponding .def file. US>>=20 US>> harti US> US>Neither Google, Bing nor Google Code Search can find any occurrence of US>any of the two words in either spelling, except in our tree, of course. US>This leads me to believe that at least no known Open Source project will US>be affected by the change. But that doesn't say much. US> US>Is this a non-backwards compatible change that we can do when going from US>9.x to 10.0? I'm fine with backing it out, too, if you think this will US>actually break anything for third parties. Just say the word. Actually there are several RFCs which contain descriptions on doing MIB=20 revisions: RFC 2578, RFC 2579 and RFC 4181. There may be others. 4181=20 contains the following text: "RFC 2579 Section 5 specifies rules that apply to revisions of textual convention definitions. The following guideline corrects an error in these rules: - Bullet (1) allows the labels of named numbers and named bits in SYNTAX clauses of type enumerated INTEGER or BITS to be changed. This can break compilation compatibility, since those labels may be used by DEFVAL clauses in modules that import the definitions of the affected TCs. Therefore, labels of named numbers and named bits MUST NOT be changed when revising IETF MIB modules (except to correct typographical errors), and they SHOULD NOT be changed when revising enterprise MIB modules." So for the given MIB the term "SHOULD NOT" applies. What I would do is: - keep the misspelled definitions and mark them with a comment as=20 deprecated (unfortunately one can formally deprecate MIB objects, but not= =20 integer names). - add correctly spelled definitions - in any case add a revision statement to the MODULE-TYPE macro. Even if you find no open source uses of the MIB, there may be internal=20 uses in companies. I have a number of MIB modules that use FreeBSD modules= =20 (albeit not the WLAN module) that are not intended to be released outside= =20 our institute because they are quite special-purpose and not of use for=20 somebody else. Nevertheless I would try to not break this kind of use. harti --1964543108-640420677-1325532415=:41320-- From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 19:44:35 2012 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 49C94106566C; Mon, 2 Jan 2012 19:44:35 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 33A788FC15; Mon, 2 Jan 2012 19:44: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 q02JiZJB083133; Mon, 2 Jan 2012 19:44:35 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02JiZ14083131; Mon, 2 Jan 2012 19:44:35 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201021944.q02JiZ14083131@svn.freebsd.org> From: Alexander Motin Date: Mon, 2 Jan 2012 19:44:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229310 - stable/9/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: Mon, 02 Jan 2012 19:44:35 -0000 Author: mav Date: Mon Jan 2 19:44:34 2012 New Revision: 229310 URL: http://svn.freebsd.org/changeset/base/229310 Log: MFC r228305: Mention that Cold Presence Detection feature used for hot-plug detection when interface power management is enabled. Modified: stable/9/share/man/man4/ahci.4 Directory Properties: stable/9/share/man/man4/ (props changed) Modified: stable/9/share/man/man4/ahci.4 ============================================================================== --- stable/9/share/man/man4/ahci.4 Mon Jan 2 19:27:23 2012 (r229309) +++ stable/9/share/man/man4/ahci.4 Mon Jan 2 19:44:34 2012 (r229310) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 2, 2011 +.Dd December 6, 2011 .Dt AHCI 4 .Os .Sh NAME @@ -90,9 +90,9 @@ Some controllers, such as ICH8, do not i Because of artificial entering latency, performance degradation in modes 4 and 5 is much smaller then in modes 2 and 3. .Pp -Note that interface Power Management is not compatible with -device presence detection. -A manual bus reset is needed on device hot-plug. +Note that interface Power Management complicates device presence detection. +A manual bus reset/rescan may be needed after device hot-plug, unless hardware +implements Cold Presence Detection. .It Va hint.ahcich. Ns Ar X Ns Va .sata_rev setting to nonzero value limits maximum SATA revision (speed). Values 1, 2 and 3 are respectively 1.5, 3 and 6Gbps. From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 19:45:30 2012 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 D105C106566B; Mon, 2 Jan 2012 19:45:30 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BAD2B8FC16; Mon, 2 Jan 2012 19:45:30 +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 q02JjUVP083208; Mon, 2 Jan 2012 19:45:30 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02JjUhT083206; Mon, 2 Jan 2012 19:45:30 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201021945.q02JjUhT083206@svn.freebsd.org> From: Alexander Motin Date: Mon, 2 Jan 2012 19:45:30 +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: r229311 - 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: Mon, 02 Jan 2012 19:45:30 -0000 Author: mav Date: Mon Jan 2 19:45:30 2012 New Revision: 229311 URL: http://svn.freebsd.org/changeset/base/229311 Log: MFC r228305: Mention that Cold Presence Detection feature used for hot-plug detection when interface power management is enabled. Modified: stable/8/share/man/man4/ahci.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/ahci.4 ============================================================================== --- stable/8/share/man/man4/ahci.4 Mon Jan 2 19:44:34 2012 (r229310) +++ stable/8/share/man/man4/ahci.4 Mon Jan 2 19:45:30 2012 (r229311) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 2, 2011 +.Dd December 6, 2011 .Dt AHCI 4 .Os .Sh NAME @@ -91,9 +91,9 @@ Some controllers, such as ICH8, do not i Because of artificial entering latency, performance degradation in modes 4 and 5 is much smaller then in modes 2 and 3. .Pp -Note that interface Power Management is not compatible with -device presence detection. -A manual bus reset is needed on device hot-plug. +Note that interface Power Management complicates device presence detection. +A manual bus reset/rescan may be needed after device hot-plug, unless hardware +implements Cold Presence Detection. .It Va hint.ahcich. Ns Ar X Ns Va .sata_rev setting to nonzero value limits maximum SATA revision (speed). Values 1, 2 and 3 are respectively 1.5, 3 and 6Gbps. From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 19:47:35 2012 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 E6597106564A; Mon, 2 Jan 2012 19:47:35 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CEDBE8FC0A; Mon, 2 Jan 2012 19:47: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 q02JlZRe083335; Mon, 2 Jan 2012 19:47:35 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02JlZ63083328; Mon, 2 Jan 2012 19:47:35 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201021947.q02JlZ63083328@svn.freebsd.org> From: Alexander Motin Date: Mon, 2 Jan 2012 19:47:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229312 - in stable/9/share/man: man4 man7 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, 02 Jan 2012 19:47:36 -0000 Author: mav Date: Mon Jan 2 19:47:35 2012 New Revision: 229312 URL: http://svn.freebsd.org/changeset/base/229312 Log: MFC r228501: After several suggestions from people, move eventtimers page from 7 to 4. Added: stable/9/share/man/man4/eventtimers.4 - copied unchanged from r228501, head/share/man/man4/eventtimers.4 Deleted: stable/9/share/man/man7/eventtimers.7 Modified: stable/9/share/man/man4/Makefile stable/9/share/man/man4/atrtc.4 stable/9/share/man/man4/attimer.4 stable/9/share/man/man4/hpet.4 stable/9/share/man/man7/Makefile Directory Properties: stable/9/share/man/man4/ (props changed) stable/9/share/man/man7/ (props changed) Modified: stable/9/share/man/man4/Makefile ============================================================================== --- stable/9/share/man/man4/Makefile Mon Jan 2 19:45:30 2012 (r229311) +++ stable/9/share/man/man4/Makefile Mon Jan 2 19:47:35 2012 (r229312) @@ -117,6 +117,7 @@ MAN= aac.4 \ epair.4 \ esp.4 \ et.4 \ + eventtimers.4 \ exca.4 \ faith.4 \ fatm.4 \ Modified: stable/9/share/man/man4/atrtc.4 ============================================================================== --- stable/9/share/man/man4/atrtc.4 Mon Jan 2 19:45:30 2012 (r229311) +++ stable/9/share/man/man4/atrtc.4 Mon Jan 2 19:47:35 2012 (r229312) @@ -53,4 +53,4 @@ Event timer provided by the driver is ir .Sh SEE ALSO .Xr attimer 4 , .Xr hpet 4 , -.Xr eventtimers 7 +.Xr eventtimers 4 Modified: stable/9/share/man/man4/attimer.4 ============================================================================== --- stable/9/share/man/man4/attimer.4 Mon Jan 2 19:45:30 2012 (r229311) +++ stable/9/share/man/man4/attimer.4 Mon Jan 2 19:47:35 2012 (r229312) @@ -72,4 +72,4 @@ Event timer provided by the driver is ir .Sh SEE ALSO .Xr atrtc 4 , .Xr hpet 4 , -.Xr eventtimers 7 +.Xr eventtimers 4 Copied: stable/9/share/man/man4/eventtimers.4 (from r228501, head/share/man/man4/eventtimers.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/share/man/man4/eventtimers.4 Mon Jan 2 19:47:35 2012 (r229312, copy of r228501, head/share/man/man4/eventtimers.4) @@ -0,0 +1,133 @@ +.\" Copyright (c) 2010 Alexander Motin +.\" 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 THE AUTHOR AND CONTRIBUTORS ``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 THE AUTHOR 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. +.\" +.\" $FreeBSD$ +.\" +.Dd September 15, 2010 +.Dt EVENTTIMERS 4 +.Os +.Sh NAME +.Nm eventtimers +.Nd kernel event timers subsystem +.Sh SYNOPSIS +Kernel uses several types of time-related devices, such as: real time clocks, +time counters and event timers. +Real time clocks responsible for tracking real world time, mostly when system +is down. +Time counters are responsible for generation of monotonically increasing +timestamps for precise uptime tracking purposes, when system is running. +Event timers are responsible for generating interrupts at specified time or +periodically, to run different time-based events. +This page is about the last. +.Sh DESCRIPTION +Kernel uses time-based events for many different purposes: scheduling, +statistics, time keeping, profiling and many other things, based on +.Xr callout 9 +mechanism. +These purposes now grouped into three main callbacks: +.Bl -tag +.It hardclock() +.Xr callout 9 +and timekeeping events entry. Called with frequency defined by hz variable, +usually 1000Hz. +.It statclock() +statistics and scheduler events entry. Called with frequency about 128Hz. +.It profclock() +profiler events entry. When enabled, called with frequency about 8KHz. +.El +Different platforms provide different kinds of timer hardware. +The goal of the event timers subsystem is to provide unified way to control +that hardware, and to use it, supplying kernel with all required time-based +events. +.Pp +Each driver implementing event timers, registers them at the subsystem. +It is possible to see the list of present event timers, like this, via +.Va kern.eventtimer +sysctl: +.Bd -literal +kern.eventtimer.choice: HPET(550) LAPIC(400) i8254(100) RTC(0) +kern.eventtimer.et.LAPIC.flags: 15 +kern.eventtimer.et.LAPIC.frequency: 0 +kern.eventtimer.et.LAPIC.quality: 400 +kern.eventtimer.et.i8254.flags: 1 +kern.eventtimer.et.i8254.frequency: 1193182 +kern.eventtimer.et.i8254.quality: 100 +kern.eventtimer.et.RTC.flags: 17 +kern.eventtimer.et.RTC.frequency: 32768 +kern.eventtimer.et.RTC.quality: 0 +kern.eventtimer.et.HPET.flags: 7 +kern.eventtimer.et.HPET.frequency: 14318180 +kern.eventtimer.et.HPET.quality: 550 +.Ed +, where: +.Bl -tag +.It Va kern.eventtimer.et. Ns Ar X Ns Va .flags +bitmask, defining event timer capabilities: +.Bl -tag -compact +.It 1 +periodic mode supported, +.It 2 +one-shot mode supported, +.It 4 +timer is per-CPU, +.It 8 +timer may stop when CPU goes to sleep state, +.It 16 +timer supports only power-of-2 divisors. +.El +.It Va kern.eventtimer.et. Ns Ar X Ns Va .frequency +timer base frequency, +.It Va kern.eventtimer.et. Ns Ar X Ns Va .quality +integral value, defining how good is this timer, comparing to others. +.El +.Pp +Timers management code of the kernel chooses one timer from that list. +Current choice can be read and affected via +.Va kern.eventtimer.timer +tunable/sysctl. +Several other tunables/sysctls are affecting how exactly this timer is used: +.Bl -tag +.It Va kern.eventtimer.periodic +allows to choose periodic and one-shot operation mode. +In periodic mode, periodic interrupts from timer hardware are taken as the +only source of time for time events. +One-shot mode instead uses currently selected time counter to precisely +schedule all needed events and programs event timer to generate interrupt +exactly in specified time. +Default value depends of chosen timer capabilities, but one-shot mode is +preferred, until other is forced by user or hardware. +.It Va kern.eventtimer.singlemul +in periodic mode specifies how much times higher timer frequency should be, +to not strictly alias hardclock() and statclock() events. Default values are +1, 2 or 4, depending on configured HZ value. +.It Va kern.eventtimer.idletick +makes each CPU to receive every timer interrupt independently of whether they +busy or not. By default this options is disabled. If chosen timer is per-CPU +and runs in periodic mode, this option has no effect - all interrupts are +always generating. +.El +.Sh SEE ALSO +.Xr attimer 4 , +.Xr atrtc 4 , +.Xr hpet 4 Modified: stable/9/share/man/man4/hpet.4 ============================================================================== --- stable/9/share/man/man4/hpet.4 Mon Jan 2 19:45:30 2012 (r229311) +++ stable/9/share/man/man4/hpet.4 Mon Jan 2 19:47:35 2012 (r229312) @@ -96,7 +96,7 @@ of these comparators has own unsharable .Xr acpi 4 , .Xr atrtc 4 , .Xr attimer 4 , -.Xr eventtimers 7 +.Xr eventtimers 4 .Sh HISTORY The .Nm Modified: stable/9/share/man/man7/Makefile ============================================================================== --- stable/9/share/man/man7/Makefile Mon Jan 2 19:45:30 2012 (r229311) +++ stable/9/share/man/man7/Makefile Mon Jan 2 19:47:35 2012 (r229312) @@ -10,7 +10,6 @@ MAN= adding_user.7 \ c99.7 \ development.7 \ environ.7 \ - eventtimers.7 \ ffs.7 \ firewall.7 \ hier.7 \ From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 19:49:02 2012 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 DC6AD106566B; Mon, 2 Jan 2012 19:49:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C5F478FC12; Mon, 2 Jan 2012 19:49: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 q02Jn1j7083425; Mon, 2 Jan 2012 19:49:01 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02Jn1Ue083423; Mon, 2 Jan 2012 19:49:01 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201021949.q02Jn1Ue083423@svn.freebsd.org> From: Alexander Motin Date: Mon, 2 Jan 2012 19:49:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229313 - stable/9/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: Mon, 02 Jan 2012 19:49:02 -0000 Author: mav Date: Mon Jan 2 19:49:01 2012 New Revision: 229313 URL: http://svn.freebsd.org/changeset/base/229313 Log: MFC r228575: Some formatting fixes. Modified: stable/9/share/man/man4/eventtimers.4 Directory Properties: stable/9/share/man/man4/ (props changed) Modified: stable/9/share/man/man4/eventtimers.4 ============================================================================== --- stable/9/share/man/man4/eventtimers.4 Mon Jan 2 19:47:35 2012 (r229312) +++ stable/9/share/man/man4/eventtimers.4 Mon Jan 2 19:49:01 2012 (r229313) @@ -46,16 +46,22 @@ statistics, time keeping, profiling and .Xr callout 9 mechanism. These purposes now grouped into three main callbacks: -.Bl -tag -.It hardclock() +.Bl -tag -width ".Fn hardclock" +.It Fn hardclock .Xr callout 9 -and timekeeping events entry. Called with frequency defined by hz variable, +and timekeeping events entry. +Called with frequency defined by +.Va hz +variable, usually 1000Hz. -.It statclock() -statistics and scheduler events entry. Called with frequency about 128Hz. -.It profclock() -profiler events entry. When enabled, called with frequency about 8KHz. +.It Fn statclock +statistics and scheduler events entry. +Called with frequency about 128Hz. +.It Fn profclock +profiler events entry. +When enabled, called with frequency about 8KHz. .El +.Pp Different platforms provide different kinds of timer hardware. The goal of the event timers subsystem is to provide unified way to control that hardware, and to use it, supplying kernel with all required time-based @@ -80,11 +86,13 @@ kern.eventtimer.et.HPET.flags: 7 kern.eventtimer.et.HPET.frequency: 14318180 kern.eventtimer.et.HPET.quality: 550 .Ed -, where: -.Bl -tag +.Pp +where: +.Bl -inset .It Va kern.eventtimer.et. Ns Ar X Ns Va .flags +is a bitmask, defining event timer capabilities: -.Bl -tag -compact +.Bl -tag -offset indent -width indent -compact .It 1 periodic mode supported, .It 2 @@ -97,8 +105,10 @@ timer may stop when CPU goes to sleep st timer supports only power-of-2 divisors. .El .It Va kern.eventtimer.et. Ns Ar X Ns Va .frequency +is a timer base frequency, .It Va kern.eventtimer.et. Ns Ar X Ns Va .quality +is an integral value, defining how good is this timer, comparing to others. .El .Pp @@ -107,7 +117,7 @@ Current choice can be read and affected .Va kern.eventtimer.timer tunable/sysctl. Several other tunables/sysctls are affecting how exactly this timer is used: -.Bl -tag +.Bl -inset .It Va kern.eventtimer.periodic allows to choose periodic and one-shot operation mode. In periodic mode, periodic interrupts from timer hardware are taken as the @@ -119,15 +129,22 @@ Default value depends of chosen timer ca preferred, until other is forced by user or hardware. .It Va kern.eventtimer.singlemul in periodic mode specifies how much times higher timer frequency should be, -to not strictly alias hardclock() and statclock() events. Default values are +to not strictly alias +.Fn hardclock +and +.Fn statclock +events. +Default values are 1, 2 or 4, depending on configured HZ value. .It Va kern.eventtimer.idletick makes each CPU to receive every timer interrupt independently of whether they -busy or not. By default this options is disabled. If chosen timer is per-CPU +busy or not. +By default this options is disabled. +If chosen timer is per-CPU and runs in periodic mode, this option has no effect - all interrupts are always generating. .El .Sh SEE ALSO -.Xr attimer 4 , .Xr atrtc 4 , +.Xr attimer 4 , .Xr hpet 4 From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 19:51:12 2012 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 D9E1B106564A; Mon, 2 Jan 2012 19:51:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B8B8E8FC0C; Mon, 2 Jan 2012 19:51:12 +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 q02JpCW7083564; Mon, 2 Jan 2012 19:51:12 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02JpC1H083560; Mon, 2 Jan 2012 19:51:12 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201021951.q02JpC1H083560@svn.freebsd.org> From: Alexander Motin Date: Mon, 2 Jan 2012 19:51:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229314 - in stable/9/share/man: man4 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: Mon, 02 Jan 2012 19:51:13 -0000 Author: mav Date: Mon Jan 2 19:51:12 2012 New Revision: 229314 URL: http://svn.freebsd.org/changeset/base/229314 Log: MFC r228731: Add eventtimers(9) man page, describing related KPIs. Sponsored by: iXsystems, Inc. Added: stable/9/share/man/man9/eventtimers.9 - copied unchanged from r228731, head/share/man/man9/eventtimers.9 Modified: stable/9/share/man/man4/eventtimers.4 stable/9/share/man/man9/Makefile Directory Properties: stable/9/share/man/man4/ (props changed) stable/9/share/man/man9/ (props changed) Modified: stable/9/share/man/man4/eventtimers.4 ============================================================================== --- stable/9/share/man/man4/eventtimers.4 Mon Jan 2 19:49:01 2012 (r229313) +++ stable/9/share/man/man4/eventtimers.4 Mon Jan 2 19:51:12 2012 (r229314) @@ -147,4 +147,5 @@ always generating. .Sh SEE ALSO .Xr atrtc 4 , .Xr attimer 4 , -.Xr hpet 4 +.Xr hpet 4 , +.Xr eventtimers 9 Modified: stable/9/share/man/man9/Makefile ============================================================================== --- stable/9/share/man/man9/Makefile Mon Jan 2 19:49:01 2012 (r229313) +++ stable/9/share/man/man9/Makefile Mon Jan 2 19:51:12 2012 (r229314) @@ -102,6 +102,7 @@ MAN= accept_filter.9 \ driver.9 \ DRIVER_MODULE.9 \ EVENTHANDLER.9 \ + eventtimers.9 \ extattr.9 \ fail.9 \ fetch.9 \ @@ -613,6 +614,16 @@ MLINKS+=EVENTHANDLER.9 EVENTHANDLER_DECL EVENTHANDLER.9 eventhandler_prune_list.9 \ EVENTHANDLER.9 EVENTHANDLER_REGISTER.9 \ EVENTHANDLER.9 eventhandler_register.9 +MLINKS+=eventtimers.9 et_register.9 \ + eventtimers.9 et_deregister.9 \ + eventtimers.9 et_ban.9 \ + eventtimers.9 et_find.9 \ + eventtimers.9 et_free.9 \ + eventtimers.9 et_init.9 \ + eventtimers.9 ET_LOCK.9 \ + eventtimers.9 ET_UNLOCK.9 \ + eventtimers.9 et_start.9 \ + eventtimers.9 et_stop.9 MLINKS+=fetch.9 fubyte.9 \ fetch.9 fuswintr.9 \ fetch.9 fuword.9 \ Copied: stable/9/share/man/man9/eventtimers.9 (from r228731, head/share/man/man9/eventtimers.9) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/share/man/man9/eventtimers.9 Mon Jan 2 19:51:12 2012 (r229314, copy of r228731, head/share/man/man9/eventtimers.9) @@ -0,0 +1,236 @@ +.\" +.\" Copyright (c) 2011 Alexander Motin +.\" 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 THE DEVELOPERS ``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 THE DEVELOPERS 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. +.\" +.\" $FreeBSD$ +.\" +.Dd December 14, 2011 +.Dt EVENTTIMERS 9 +.Os +.Sh NAME +.Nm eventtimers +.Nd kernel event timers subsystem +.Sh SYNOPSIS +.In sys/timeet.h +.Bd -literal +struct eventtimer; + +typedef int et_start_t(struct eventtimer *et, + struct bintime *first, struct bintime *period); +typedef int et_stop_t(struct eventtimer *et); +typedef void et_event_cb_t(struct eventtimer *et, void *arg); +typedef int et_deregister_cb_t(struct eventtimer *et, void *arg); + +struct eventtimer { + SLIST_ENTRY(eventtimer) et_all; + char *et_name; + int et_flags; +#define ET_FLAGS_PERIODIC 1 +#define ET_FLAGS_ONESHOT 2 +#define ET_FLAGS_PERCPU 4 +#define ET_FLAGS_C3STOP 8 +#define ET_FLAGS_POW2DIV 16 + int et_quality; + int et_active; + u_int64_t et_frequency; + struct bintime et_min_period; + struct bintime et_max_period; + et_start_t *et_start; + et_stop_t *et_stop; + et_event_cb_t *et_event_cb; + et_deregister_cb_t *et_deregister_cb; + void *et_arg; + void *et_priv; + struct sysctl_oid *et_sysctl; +}; +.Ed +.Ft int +.Fn et_register "struct eventtimer *et" +.Ft int +.Fn et_deregister "struct eventtimer *et" +.Fn ET_LOCK +.Fn ET_UNLOCK +.Ft struct eventtimer * +.Fn et_find "const char *name" "int check" "int want" +.Ft int +.Fn et_init "struct eventtimer *et" "et_event_cb_t *event" "et_deregister_cb_t *deregister" "void *arg" +.Ft int +.Fn et_start "struct eventtimer *et" "struct bintime *first" "struct bintime *period" +.Ft int +.Fn et_stop "struct eventtimer *et" +.Ft int +.Fn et_ban "struct eventtimer *et" +.Ft int +.Fn et_free "struct eventtimer *et" +.Sh DESCRIPTION +Event timers are responsible for generating interrupts at specified time +or periodically, to run different time-based events. +Subsystem consists of three main parts: +.Bl -tag +.It Drivers +Manage hardware to generate requested time events. +.It Consumers +.Pa sys/kern/kern_clocksource.c +uses event timers to supply kernel with +.Fn hardclock , +.Fn statclock +and +.Fn profclock +time events. +.It Glue code +.Pa sys/sys/timeet.h , +.Pa sys/kern/kern_et.c +provide APIs for event timer drivers and consumers. +.El +.Sh DRIVER API +Driver API is built around eventtimer structure. +To register its functionality driver allocates that structure and calls +.Fn et_register . +Driver should fill following fields there: +.Bl -tag +.It Va et_name +Unique name of the event timer for management purposes. +.It Va et_flags +Set of flags, describing timer capabilities: +.Bl -tag -width "ET_FLAGS_PERIODIC" -compact +.It ET_FLAGS_PERIODIC +Periodic mode supported. +.It ET_FLAGS_ONESHOT +One-shot mode supported. +.It ET_FLAGS_PERCPU +Timer is per-CPU. +.It ET_FLAGS_C3STOP +Timer may stop in CPU sleep state. +.It ET_FLAGS_POW2DIV +Timer supports only 2^n divisors. +.El +.It Va et_quality +Abstract value to certify whether this timecounter is better than the others. +Higher value means better. +.It Va et_frequency +Timer oscillator's base frequency, if applicable and known. +Used by consumers to predict set of possible frequencies that could be +obtained by dividing it. +Should be zero if not applicable or unknown. +.It Va et_min_period , et_max_period +Minimal and maximal reliably programmable time periods. +.It Va et_start +Driver's timer start function pointer. +.It Va et_stop +Driver's timer stop function pointer. +.It Va et_priv +Driver's private data storage. +.El +.Pp +After the event timer functionality is registered, it is controlled via +.Va et_start +and +.Va et_stop +methods. +.Va et_start +method is called to start the specified event timer. +The last two arguments are used to specify time when events should be +generated. +.Va first +argument specifies time period before the first event generated. +In periodic mode NULL value specifies that first period is equal to the +.Va period +argument value. +.Va period +argument specifies the time period between following events for the +periodic mode. +The NULL value there specifies the one-shot mode. +At least one of these two arguments should be not NULL. +When event time arrive, driver should call +.Va et_event_cb +callback function, passing +.Va et_arg +as the second argument. +.Va et_stop +method is called to stop the specified event timer. +For the per-CPU event timers +.Va et_start +and +.Va et_stop +methods control timers associated with the current CPU. +.Pp +Driver may deregister its functionality by calling +.Fn et_deregister . +.Sh CONSUMER API +.Fn et_find +allows consumer to find available event timer, optionally matching specific +name and/or capability flags. +Consumer may read returned eventtimer structure, but should not modify it. +When wanted event timer is found, +.Fn et_init +should be called for it, submitting +.Va event +and optionally +.Va deregister +callbacks functions, and the opaque argument +.Va arg . +That argument will be passed as argument to the callbacks. +Event callback function will be called on scheduled time events. +It is called from the hardware interrupt context, so no sleep is permitted +there. +Deregister callback function may be called to report consumer that the event +timer functionality is no longer available. +On this call, consumer should stop using event timer before the return. +.Pp +After the timer is found and initialized, it can be controlled via +.Fn et_start +and +.Fn et_stop . +The arguments are the same as described in driver API. +Per-CPU event timers can be controlled only from specific CPUs. +.Pp +.Fn et_ban +allows consumer to mark event timer as broken via clearing both one-shot and +periodic capability flags, if it was somehow detected. +.Fn et_free +is the opposite to +.Fn et_init . +It releases the event timer for other consumers use. +.Pp +.Fn ET_LOCK +and +.Fn ET_UNLOCK +macros should be used to manage +.Xr mutex 9 +lock around +.Fn et_find , +.Fn et_init +and +.Fn et_free +calls to serialize access to the list of the registered event timers and the +pointers returned by +.Fn et_find . +.Fn et_start +and +.Fn et_stop +calls should be serialized in consumer's internal way to avoid concurrent +timer hardware access. +.Sh SEE ALSO +.Xr eventtimers 4 +.Sh AUTHORS +.An Alexander Motin Aq mav@FreeBSD.org From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 19:54:18 2012 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 79D5C1065742; Mon, 2 Jan 2012 19:54:18 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5B45A8FC13; Mon, 2 Jan 2012 19:54:18 +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 q02JsIDk083711; Mon, 2 Jan 2012 19:54:18 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02JsIbL083704; Mon, 2 Jan 2012 19:54:18 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201021954.q02JsIbL083704@svn.freebsd.org> From: Alexander Motin Date: Mon, 2 Jan 2012 19:54:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229315 - stable/9/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: Mon, 02 Jan 2012 19:54:18 -0000 Author: mav Date: Mon Jan 2 19:54:17 2012 New Revision: 229315 URL: http://svn.freebsd.org/changeset/base/229315 Log: MFC r228735, r228737, r228739: Add apic(4) man page, now mostly to cover its event timer functionality. Added: stable/9/share/man/man4/apic.4 - copied, changed from r228735, head/share/man/man4/apic.4 Modified: stable/9/share/man/man4/Makefile stable/9/share/man/man4/atrtc.4 stable/9/share/man/man4/attimer.4 stable/9/share/man/man4/eventtimers.4 stable/9/share/man/man4/hpet.4 Directory Properties: stable/9/share/man/man4/ (props changed) Modified: stable/9/share/man/man4/Makefile ============================================================================== --- stable/9/share/man/man4/Makefile Mon Jan 2 19:51:12 2012 (r229314) +++ stable/9/share/man/man4/Makefile Mon Jan 2 19:54:17 2012 (r229315) @@ -39,6 +39,7 @@ MAN= aac.4 \ ${_amdtemp.4} \ amr.4 \ an.4 \ + ${_apic.4} \ arcmsr.4 \ ${_asmc.4} \ asr.4 \ @@ -671,6 +672,7 @@ _acpi_sony.4= acpi_sony.4 _acpi_toshiba.4=acpi_toshiba.4 _acpi_wmi.4= acpi_wmi.4 _aesni.4= aesni.4 +_apic.4= apic.4 _atrtc.4= atrtc.4 _attimer.4= attimer.4 _aibs.4= aibs.4 Copied and modified: stable/9/share/man/man4/apic.4 (from r228735, head/share/man/man4/apic.4) ============================================================================== --- head/share/man/man4/apic.4 Tue Dec 20 13:49:52 2011 (r228735, copy source) +++ stable/9/share/man/man4/apic.4 Mon Jan 2 19:54:17 2012 (r229315) @@ -51,21 +51,20 @@ Set this to 1 to disable APIC support, f .Sh DESCRIPTION There are two components in the Intel APIC system, the local APIC (LAPIC) and the I/O APIC. -There is one LAPIC in each CPU in the system. +There is one local APIC in each CPU in the system. There is typically one I/O APIC for each peripheral bus in the system. .Pp -LAPICs manage all external and interrupts for specific processor in an -SMP system. +Local APICs manage all external interrupts for a specific processor. In addition, they are able to accept and generate inter-processor interrupts (IPIs). .Pp I/O APICs contain a redirection table, which is used to route the interrupts they receive from peripheral buses to one or more local APICs. .Pp -Each LAPIC includes one 32-bit programable timer. +Each local APIC includes one 32-bit programable timer. This driver uses them to supply kernel with one event timer named "LAPIC". Event timer provided by the driver supports both one-shot an periodic modes. -Because of LAPIC nature it is per-CPU. +Because of local APIC nature it is per-CPU. The timer frequency is not reported by the platform and so automatically measured by the driver on the first use. Depending on CPU model this timer may stop in C3 and deeper CPU sleep states. Modified: stable/9/share/man/man4/atrtc.4 ============================================================================== --- stable/9/share/man/man4/atrtc.4 Mon Jan 2 19:51:12 2012 (r229314) +++ stable/9/share/man/man4/atrtc.4 Mon Jan 2 19:54:17 2012 (r229315) @@ -51,6 +51,7 @@ divisors. .Pp Event timer provided by the driver is irrelevant to CPU power states. .Sh SEE ALSO +.Xr apic 4 , .Xr attimer 4 , -.Xr hpet 4 , -.Xr eventtimers 4 +.Xr eventtimers 4 , +.Xr hpet 4 Modified: stable/9/share/man/man4/attimer.4 ============================================================================== --- stable/9/share/man/man4/attimer.4 Mon Jan 2 19:51:12 2012 (r229314) +++ stable/9/share/man/man4/attimer.4 Mon Jan 2 19:54:17 2012 (r229315) @@ -70,6 +70,7 @@ functionality is disabled. .Pp Event timer provided by the driver is irrelevant to CPU power states. .Sh SEE ALSO +.Xr apic 4 , .Xr atrtc 4 , -.Xr hpet 4 , -.Xr eventtimers 4 +.Xr eventtimers 4 , +.Xr hpet 4 Modified: stable/9/share/man/man4/eventtimers.4 ============================================================================== --- stable/9/share/man/man4/eventtimers.4 Mon Jan 2 19:51:12 2012 (r229314) +++ stable/9/share/man/man4/eventtimers.4 Mon Jan 2 19:54:17 2012 (r229315) @@ -145,6 +145,7 @@ and runs in periodic mode, this option h always generating. .El .Sh SEE ALSO +.Xr apic 4 , .Xr atrtc 4 , .Xr attimer 4 , .Xr hpet 4 , Modified: stable/9/share/man/man4/hpet.4 ============================================================================== --- stable/9/share/man/man4/hpet.4 Mon Jan 2 19:51:12 2012 (r229314) +++ stable/9/share/man/man4/hpet.4 Mon Jan 2 19:54:17 2012 (r229315) @@ -94,6 +94,7 @@ group is bound to specific CPU core. Thi of these comparators has own unsharable IRQ. .Sh SEE ALSO .Xr acpi 4 , +.Xr apic 4 , .Xr atrtc 4 , .Xr attimer 4 , .Xr eventtimers 4 From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 19:56:00 2012 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 89C821065670; Mon, 2 Jan 2012 19:56:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6A0A08FC08; Mon, 2 Jan 2012 19:56: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 q02Ju0WU083821; Mon, 2 Jan 2012 19:56:00 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02JtxE5083815; Mon, 2 Jan 2012 19:55:59 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201021955.q02JtxE5083815@svn.freebsd.org> From: Alexander Motin Date: Mon, 2 Jan 2012 19:55:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229316 - stable/9/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: Mon, 02 Jan 2012 19:56:00 -0000 Author: mav Date: Mon Jan 2 19:55:59 2012 New Revision: 229316 URL: http://svn.freebsd.org/changeset/base/229316 Log: MFC r228741, r228742: Add timecounters(4) man page alike to eventtimers(4). Added: stable/9/share/man/man4/timecounters.4 - copied, changed from r228741, head/share/man/man4/timecounters.4 Modified: stable/9/share/man/man4/Makefile stable/9/share/man/man4/attimer.4 stable/9/share/man/man4/eventtimers.4 stable/9/share/man/man4/hpet.4 Directory Properties: stable/9/share/man/man4/ (props changed) Modified: stable/9/share/man/man4/Makefile ============================================================================== --- stable/9/share/man/man4/Makefile Mon Jan 2 19:54:17 2012 (r229315) +++ stable/9/share/man/man4/Makefile Mon Jan 2 19:55:59 2012 (r229316) @@ -444,6 +444,7 @@ MAN= aac.4 \ termios.4 \ textdump.4 \ ti.4 \ + timecounters.4 \ tl.4 \ tnt4882.4 \ ${_tpm.4} \ Modified: stable/9/share/man/man4/attimer.4 ============================================================================== --- stable/9/share/man/man4/attimer.4 Mon Jan 2 19:54:17 2012 (r229315) +++ stable/9/share/man/man4/attimer.4 Mon Jan 2 19:55:59 2012 (r229316) @@ -73,4 +73,5 @@ Event timer provided by the driver is ir .Xr apic 4 , .Xr atrtc 4 , .Xr eventtimers 4 , -.Xr hpet 4 +.Xr hpet 4 , +.Xr timecounters 4 Modified: stable/9/share/man/man4/eventtimers.4 ============================================================================== --- stable/9/share/man/man4/eventtimers.4 Mon Jan 2 19:54:17 2012 (r229315) +++ stable/9/share/man/man4/eventtimers.4 Mon Jan 2 19:55:59 2012 (r229316) @@ -149,4 +149,5 @@ always generating. .Xr atrtc 4 , .Xr attimer 4 , .Xr hpet 4 , +.Xr timecounters 4 , .Xr eventtimers 9 Modified: stable/9/share/man/man4/hpet.4 ============================================================================== --- stable/9/share/man/man4/hpet.4 Mon Jan 2 19:54:17 2012 (r229315) +++ stable/9/share/man/man4/hpet.4 Mon Jan 2 19:55:59 2012 (r229316) @@ -97,7 +97,8 @@ of these comparators has own unsharable .Xr apic 4 , .Xr atrtc 4 , .Xr attimer 4 , -.Xr eventtimers 4 +.Xr eventtimers 4 , +.Xr timecounters 4 .Sh HISTORY The .Nm Copied and modified: stable/9/share/man/man4/timecounters.4 (from r228741, head/share/man/man4/timecounters.4) ============================================================================== --- head/share/man/man4/timecounters.4 Tue Dec 20 17:10:34 2011 (r228741, copy source) +++ stable/9/share/man/man4/timecounters.4 Mon Jan 2 19:55:59 2012 (r229316) @@ -87,9 +87,9 @@ where: is a bitmask, defining valid counter bits, .It Va kern.timecounter.tc. Ns Ar X Ns Va .counter is a present counter value, -.It Va kern.eventtimer.tc. Ns Ar X Ns Va .frequency +.It Va kern.timecounter.tc. Ns Ar X Ns Va .frequency is a counter update frequency, -.It Va kern.eventtimer.tc. Ns Ar X Ns Va .quality +.It Va kern.timecounter.tc. Ns Ar X Ns Va .quality is an integral value, defining how good is this time counter, comparing to others. Negative value means that this time counter is broken and should not be used. From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 20:28:33 2012 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 AD226106564A; Mon, 2 Jan 2012 20:28:33 +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 968018FC0C; Mon, 2 Jan 2012 20:28:33 +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 q02KSX34085082; Mon, 2 Jan 2012 20:28:33 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02KSXFH085080; Mon, 2 Jan 2012 20:28:33 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201201022028.q02KSXFH085080@svn.freebsd.org> From: Hans Petter Selasky Date: Mon, 2 Jan 2012 20:28: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: r229317 - head/sys/dev/usb/controller 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, 02 Jan 2012 20:28:33 -0000 Author: hselasky Date: Mon Jan 2 20:28:33 2012 New Revision: 229317 URL: http://svn.freebsd.org/changeset/base/229317 Log: Make sure we probe and attach the root HUB after resume else no devices will appear again. MFC after: 1 day Modified: head/sys/dev/usb/controller/usb_controller.c Modified: head/sys/dev/usb/controller/usb_controller.c ============================================================================== --- head/sys/dev/usb/controller/usb_controller.c Mon Jan 2 19:55:59 2012 (r229316) +++ head/sys/dev/usb/controller/usb_controller.c Mon Jan 2 20:28:33 2012 (r229317) @@ -473,10 +473,18 @@ usb_bus_resume(struct usb_proc_msg *pm) if (bus->methods->set_hw_power != NULL) (bus->methods->set_hw_power) (bus); + /* restore USB configuration to index 0 */ err = usbd_set_config_index(udev, 0); if (err) device_printf(bus->bdev, "Could not configure root HUB\n"); + /* probe and attach */ + err = usb_probe_and_attach(udev, USB_IFACE_INDEX_ANY); + if (err) { + device_printf(bus->bdev, "Could not probe and " + "attach root HUB\n"); + } + usbd_enum_unlock(udev); USB_BUS_LOCK(bus); From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 20:40:00 2012 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 4B563106566B; Mon, 2 Jan 2012 20:40:00 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 350B68FC1B; Mon, 2 Jan 2012 20: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 q02Ke0wO085577; Mon, 2 Jan 2012 20:40:00 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02Ke0O1085574; Mon, 2 Jan 2012 20:40:00 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <201201022040.q02Ke0O1085574@svn.freebsd.org> From: Ken Smith Date: Mon, 2 Jan 2012 20:40:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229318 - in stable/9/sys: conf 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: Mon, 02 Jan 2012 20:40:00 -0000 Author: kensmith Date: Mon Jan 2 20:39:59 2012 New Revision: 229318 URL: http://svn.freebsd.org/changeset/base/229318 Log: Since stable/9 has been released from code freeze and the 9.0-RELEASE builds are underway shift stable/9 to 9.0-STABLE. Modified: stable/9/sys/conf/newvers.sh stable/9/sys/sys/param.h Modified: stable/9/sys/conf/newvers.sh ============================================================================== --- stable/9/sys/conf/newvers.sh Mon Jan 2 20:28:33 2012 (r229317) +++ stable/9/sys/conf/newvers.sh Mon Jan 2 20:39:59 2012 (r229318) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="9.0" -BRANCH="PRERELEASE" +BRANCH="STABLE" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi Modified: stable/9/sys/sys/param.h ============================================================================== --- stable/9/sys/sys/param.h Mon Jan 2 20:28:33 2012 (r229317) +++ stable/9/sys/sys/param.h Mon Jan 2 20:39:59 2012 (r229318) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 900045 /* Master, propagated to newvers */ +#define __FreeBSD_version 900500 /* Master, propagated to newvers */ #ifdef _KERNEL #define P_OSREL_SIGWAIT 700000 From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 21:01:17 2012 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 4D683106564A; Mon, 2 Jan 2012 21:01:17 +0000 (UTC) (envelope-from emaste@freebsd.org) Received: from mail1.sandvine.com (Mail1.sandvine.com [64.7.137.134]) by mx1.freebsd.org (Postfix) with ESMTP id 00C0A8FC13; Mon, 2 Jan 2012 21:01:16 +0000 (UTC) Received: from labgw2.phaedrus.sandvine.com (192.168.222.22) by WTL-EXCH-1.sandvine.com (192.168.196.31) with Microsoft SMTP Server id 14.1.339.1; Mon, 2 Jan 2012 15:50:24 -0500 Received: by labgw2.phaedrus.sandvine.com (Postfix, from userid 10332) id DF8CA33C02; Mon, 2 Jan 2012 15:50:23 -0500 (EST) Date: Mon, 2 Jan 2012 15:50:23 -0500 From: Ed Maste To: Hans Petter Selasky Message-ID: <20120102205023.GA24820@sandvine.com> References: <201201022028.q02KSXFH085080@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <201201022028.q02KSXFH085080@svn.freebsd.org> User-Agent: Mutt/1.4.2.1i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r229317 - head/sys/dev/usb/controller 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, 02 Jan 2012 21:01:17 -0000 On Mon, Jan 02, 2012 at 08:28:33PM +0000, Hans Petter Selasky wrote: > Author: hselasky > Date: Mon Jan 2 20:28:33 2012 > New Revision: 229317 > URL: http://svn.freebsd.org/changeset/base/229317 > > Log: > Make sure we probe and attach the root HUB after > resume else no devices will appear again. This fixes my problem with USB devices after resume - Thanks! -Ed From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 21:57:59 2012 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 6E76E1065670; Mon, 2 Jan 2012 21:57:59 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3EAC08FC08; Mon, 2 Jan 2012 21:57: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 q02LvxP4089387; Mon, 2 Jan 2012 21:57:59 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02Lvxmi089384; Mon, 2 Jan 2012 21:57:59 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201201022157.q02Lvxmi089384@svn.freebsd.org> From: Robert Watson Date: Mon, 2 Jan 2012 21:57: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: r229319 - in head: share/man/man5 share/mk tools/build/options 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, 02 Jan 2012 21:57:59 -0000 Author: rwatson Date: Mon Jan 2 21:57:58 2012 New Revision: 229319 URL: http://svn.freebsd.org/changeset/base/229319 Log: Add WITHOUT_CAPSICUM src.conf(5) define, which can be used to compile out use of Capsicum by userspace applications. MFC after: 3 weeks Sponsored by: Google, Inc. Added: head/tools/build/options/WITHOUT_CAPSICUM (contents, props changed) Modified: head/share/man/man5/src.conf.5 head/share/mk/bsd.own.mk Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Mon Jan 2 20:39:59 2012 (r229318) +++ head/share/man/man5/src.conf.5 Mon Jan 2 21:57:58 2012 (r229319) @@ -1,7 +1,7 @@ .\" DO NOT EDIT-- this file is automatically generated. .\" from FreeBSD: head/tools/build/options/makeman 221733 2011-05-10 13:01:11Z ru .\" $FreeBSD$ -.Dd December 2, 2011 +.Dd December 30, 2011 .Dt SRC.CONF 5 .Os .Sh NAME @@ -251,6 +251,9 @@ Set to build some programs without optio .\" from FreeBSD: head/tools/build/options/WITHOUT_CALENDAR 156932 2006-03-21 07:50:50Z ru Set to not build .Xr calendar 1 . +.It Va WITHOUT_CAPSICUM +.\" $FreeBSD$ +Set to not build Capsicum support into system programs. .It Va WITHOUT_CDDL .\" from FreeBSD: head/tools/build/options/WITHOUT_CDDL 163861 2006-11-01 09:02:11Z jb Set to not build code licensed under Sun's CDDL. @@ -821,7 +824,7 @@ Set to not build .Xr ppp 8 and related programs. .It Va WITHOUT_PROFILE -.\" from FreeBSD: head/tools/build/options/WITH_PROFILE 228143 2011-11-29 19:46:17Z fjoe +.\" from FreeBSD: head/tools/build/options/WITHOUT_PROFILE 228196 2011-12-02 09:09:54Z fjoe Set to avoid compiling profiled libraries. .It Va WITHOUT_QUOTAS .\" from FreeBSD: head/tools/build/options/WITHOUT_QUOTAS 183242 2008-09-21 22:02:26Z sam Modified: head/share/mk/bsd.own.mk ============================================================================== --- head/share/mk/bsd.own.mk Mon Jan 2 20:39:59 2012 (r229318) +++ head/share/mk/bsd.own.mk Mon Jan 2 21:57:58 2012 (r229319) @@ -322,6 +322,7 @@ __DEFAULT_YES_OPTIONS = \ BSNMP \ BZIP2 \ CALENDAR \ + CAPSICUM \ CDDL \ CPP \ CRYPT \ Added: head/tools/build/options/WITHOUT_CAPSICUM ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/build/options/WITHOUT_CAPSICUM Mon Jan 2 21:57:58 2012 (r229319) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Set to not build Capsicum support into system programs. From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 22:11:08 2012 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 77F32106566B; Mon, 2 Jan 2012 22:11:08 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 621AD8FC16; Mon, 2 Jan 2012 22:11:08 +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 q02MB8vS089926; Mon, 2 Jan 2012 22:11:08 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02MB86f089924; Mon, 2 Jan 2012 22:11:08 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201201022211.q02MB86f089924@svn.freebsd.org> From: Glen Barber Date: Mon, 2 Jan 2012 22:11:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229320 - stable/9/share/man/man5 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, 02 Jan 2012 22:11:08 -0000 Author: gjb (doc committer) Date: Mon Jan 2 22:11:08 2012 New Revision: 229320 URL: http://svn.freebsd.org/changeset/base/229320 Log: MFC r228418, 228419: r228418: - Document the SVN variable needs to be set in make.conf(5) when SVN_UPDATE is set [1] r228419: - Minor whitespace cleanup to make.conf(5) PR: 163162 [1] Modified: stable/9/share/man/man5/make.conf.5 Directory Properties: stable/9/share/man/man5/ (props changed) Modified: stable/9/share/man/man5/make.conf.5 ============================================================================== --- stable/9/share/man/man5/make.conf.5 Mon Jan 2 21:57:58 2012 (r229319) +++ stable/9/share/man/man5/make.conf.5 Mon Jan 2 22:11:08 2012 (r229320) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 16, 2011 +.Dd December 11, 2011 .Dt MAKE.CONF 5 .Os .Sh NAME @@ -333,6 +333,12 @@ to update your .Pa src tree with .Dq Li "make update" . +Note that since a subversion client is not included in the base system, +you will need to set +.Va SVN +to the full path of a +.Xr svn 1 +binary. .It Va WWWSUPFILE .Pq Vt str The www @@ -494,7 +500,7 @@ rather than load the server's kernel. .Pq Vt bool Defining this and recompiling .Pa /usr/src/sys/boot/i386 -will add +will add .Xr dcons 4 console driver to .Xr loader 8 @@ -634,7 +640,7 @@ The default value is 0640. .Pq Vt str Additional maps to rebuild when using .Pa /etc/mail/Makefile . -The +The .Pa access , .Pa bitdomain , .Pa domaintable , From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 22:12:10 2012 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 C9C35106566C; Mon, 2 Jan 2012 22:12:10 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B3BC38FC17; Mon, 2 Jan 2012 22:12: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 q02MCA0h089997; Mon, 2 Jan 2012 22:12:10 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02MCAe3089995; Mon, 2 Jan 2012 22:12:10 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201201022212.q02MCAe3089995@svn.freebsd.org> From: Glen Barber Date: Mon, 2 Jan 2012 22:12: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: r229321 - stable/8/share/man/man5 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, 02 Jan 2012 22:12:10 -0000 Author: gjb (doc committer) Date: Mon Jan 2 22:12:10 2012 New Revision: 229321 URL: http://svn.freebsd.org/changeset/base/229321 Log: MFC r228419: r228419: - Minor whitespace cleanup to make.conf(5) Modified: stable/8/share/man/man5/make.conf.5 Directory Properties: stable/8/share/man/man5/ (props changed) Modified: stable/8/share/man/man5/make.conf.5 ============================================================================== --- stable/8/share/man/man5/make.conf.5 Mon Jan 2 22:11:08 2012 (r229320) +++ stable/8/share/man/man5/make.conf.5 Mon Jan 2 22:12:10 2012 (r229321) @@ -479,7 +479,7 @@ rather than load the server's kernel. .Pq Vt bool Defining this and recompiling .Pa /usr/src/sys/boot/i386 -will add +will add .Xr dcons 4 console driver to .Xr loader 8 @@ -619,7 +619,7 @@ The default value is 0640. .Pq Vt str Additional maps to rebuild when using .Pa /etc/mail/Makefile . -The +The .Pa access , .Pa bitdomain , .Pa domaintable , From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 22:12:37 2012 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 59FBA106578C; Mon, 2 Jan 2012 22:12:37 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 44FB18FC1F; Mon, 2 Jan 2012 22:12: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 q02MCbpT090048; Mon, 2 Jan 2012 22:12:37 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02MCbTw090046; Mon, 2 Jan 2012 22:12:37 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201201022212.q02MCbTw090046@svn.freebsd.org> From: Glen Barber Date: Mon, 2 Jan 2012 22:12:37 +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: r229322 - stable/7/share/man/man5 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, 02 Jan 2012 22:12:37 -0000 Author: gjb (doc committer) Date: Mon Jan 2 22:12:36 2012 New Revision: 229322 URL: http://svn.freebsd.org/changeset/base/229322 Log: MFC r228419: r228419: - Minor whitespace cleanup to make.conf(5) Modified: stable/7/share/man/man5/make.conf.5 Directory Properties: stable/7/share/man/man5/ (props changed) Modified: stable/7/share/man/man5/make.conf.5 ============================================================================== --- stable/7/share/man/man5/make.conf.5 Mon Jan 2 22:12:10 2012 (r229321) +++ stable/7/share/man/man5/make.conf.5 Mon Jan 2 22:12:36 2012 (r229322) @@ -467,7 +467,7 @@ rather than load the server's kernel. .Pq Vt bool Defining this and recompiling .Pa /usr/src/sys/boot/i386 -will add +will add .Xr dcons 4 console driver to .Xr loader 8 @@ -607,7 +607,7 @@ The default value is 0640. .Pq Vt str Additional maps to rebuild when using .Pa /etc/mail/Makefile . -The +The .Pa access , .Pa bitdomain , .Pa domaintable , From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 22:15:32 2012 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 C1020106566C; Mon, 2 Jan 2012 22:15:32 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AB02D8FC18; Mon, 2 Jan 2012 22:15: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 q02MFWts090208; Mon, 2 Jan 2012 22:15:32 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02MFWK0090206; Mon, 2 Jan 2012 22:15:32 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201201022215.q02MFWK0090206@svn.freebsd.org> From: Glen Barber Date: Mon, 2 Jan 2012 22:15:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229323 - stable/9/usr.bin/ar 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, 02 Jan 2012 22:15:32 -0000 Author: gjb (doc committer) Date: Mon Jan 2 22:15:32 2012 New Revision: 229323 URL: http://svn.freebsd.org/changeset/base/229323 Log: MFC r228823, r228824: r228823: - Properly escape a special character - Enclose tabbed content in quotes r228824: - Remove trailing whitespace Modified: stable/9/usr.bin/ar/ar.1 Directory Properties: stable/9/usr.bin/ar/ (props changed) Modified: stable/9/usr.bin/ar/ar.1 ============================================================================== --- stable/9/usr.bin/ar/ar.1 Mon Jan 2 22:12:36 2012 (r229322) +++ stable/9/usr.bin/ar/ar.1 Mon Jan 2 22:15:32 2012 (r229323) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 17, 2010 +.Dd December 22, 2011 .Dt AR 1 .Os .Sh NAME @@ -198,11 +198,11 @@ from the archive specified by argument The archive's symbol table, if present, is updated to reflect the new contents of the archive. .It Fl D -When used in combination with the +When used in combination with the .Fl r or .Fl q -option, insert 0's instead of the real mtime, uid and gid values +option, insert 0's instead of the real mtime, uid and gid values and 0644 instead of file mode from the members named by arguments .Ar . This ensures that checksums on the resulting archives are reproducible @@ -414,7 +414,7 @@ character. The .Dq Li * and -.Dq Li "\;" +.Dq Li "\&;" characters start a comment. Comments extend till the end of the line. .Pp @@ -531,7 +531,7 @@ using MRI librarian commands, use the fo .Bd -literal -offset indent create ex.a * specify the output archive addmod ex1.o ex2.o * add modules -save * save pending changes +save * save pending changes end * exit the utility .Ed .Sh DIAGNOSTICS From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 22:18:09 2012 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 09E7610656D1; Mon, 2 Jan 2012 22:18:09 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2FE8E8FC1B; Mon, 2 Jan 2012 22:18:08 +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 q02MI8ox090331; Mon, 2 Jan 2012 22:18:08 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02MI8vL090329; Mon, 2 Jan 2012 22:18:08 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201201022218.q02MI8vL090329@svn.freebsd.org> From: Glen Barber Date: Mon, 2 Jan 2012 22:18:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229324 - stable/9/usr.bin/hexdump 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, 02 Jan 2012 22:18:09 -0000 Author: gjb (doc committer) Date: Mon Jan 2 22:18:07 2012 New Revision: 229324 URL: http://svn.freebsd.org/changeset/base/229324 Log: MFC r228823: r228823: - Enclose tabbed content in quotes Modified: stable/9/usr.bin/hexdump/od.1 Directory Properties: stable/9/usr.bin/hexdump/ (props changed) Modified: stable/9/usr.bin/hexdump/od.1 ============================================================================== --- stable/9/usr.bin/hexdump/od.1 Mon Jan 2 22:15:32 2012 (r229323) +++ stable/9/usr.bin/hexdump/od.1 Mon Jan 2 22:18:07 2012 (r229324) @@ -28,7 +28,7 @@ .\" @(#)od.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd February 18, 2010 +.Dd December 22, 2011 .Dt OD 1 .Os .Sh NAME @@ -146,12 +146,12 @@ Named characters .Pq Tn ASCII . Control characters are displayed using the following names: .Bl -column "000 NUL" "001 SOH" "002 STX" "003 ETX" "004 EOT" "005 ENQ" -.It 000 NUL 001 SOH 002 STX 003 ETX 004 EOT 005 ENQ -.It 006 ACK 007 BEL 008 BS 009 HT 00A NL 00B VT -.It 00C FF 00D CR 00E SO 00F SI 010 DLE 011 DC1 -.It 012 DC2 013 DC3 014 DC4 015 NAK 016 SYN 017 ETB -.It 018 CAN 019 EM 01A SUB 01B ESC 01C FS 01D GS -.It 01E RS 01F US 020 SP 07F DEL +.It "000 NUL 001 SOH 002 STX 003 ETX 004 EOT 005 ENQ" +.It "006 ACK 007 BEL 008 BS 009 HT 00A NL 00B VT" +.It "00C FF 00D CR 00E SO 00F SI 010 DLE 011 DC1" +.It "012 DC2 013 DC3 014 DC4 015 NAK 016 SYN 017 ETB" +.It "018 CAN 019 EM 01A SUB 01B ESC 01C FS 01D GS" +.It "01E RS 01F US 020 SP 07F DEL" .El .It Cm c Characters in the default character set. From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 22:19:12 2012 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 2AE561065680; Mon, 2 Jan 2012 22:19:12 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 15A578FC1A; Mon, 2 Jan 2012 22:19:12 +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 q02MJBK9090399; Mon, 2 Jan 2012 22:19:11 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02MJBN8090397; Mon, 2 Jan 2012 22:19:11 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201201022219.q02MJBN8090397@svn.freebsd.org> From: Glen Barber Date: Mon, 2 Jan 2012 22:19:11 +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: r229325 - stable/8/usr.bin/hexdump 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, 02 Jan 2012 22:19:12 -0000 Author: gjb (doc committer) Date: Mon Jan 2 22:19:11 2012 New Revision: 229325 URL: http://svn.freebsd.org/changeset/base/229325 Log: MFC r209035, r228823: r209035 (uqs): - Use same table markup as in hexdump.1 r228823: - Enclose tabbed content in quotes Modified: stable/8/usr.bin/hexdump/od.1 Directory Properties: stable/8/usr.bin/hexdump/ (props changed) Modified: stable/8/usr.bin/hexdump/od.1 ============================================================================== --- stable/8/usr.bin/hexdump/od.1 Mon Jan 2 22:18:07 2012 (r229324) +++ stable/8/usr.bin/hexdump/od.1 Mon Jan 2 22:19:11 2012 (r229325) @@ -32,7 +32,7 @@ .\" @(#)od.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd February 18, 2010 +.Dd December 22, 2011 .Dt OD 1 .Os .Sh NAME @@ -151,11 +151,11 @@ Named characters Control characters are displayed using the following names: .Bl -column "000 NUL" "001 SOH" "002 STX" "003 ETX" "004 EOT" "005 ENQ" .It "000 NUL 001 SOH 002 STX 003 ETX 004 EOT 005 ENQ" -.It "006 ACK 007 BEL 008 BS 009 HT 00a NL 00b VT" -.It "00c FF 00d CR 00e SO 00f SI 010 DLE 011 DC1" +.It "006 ACK 007 BEL 008 BS 009 HT 00A NL 00B VT" +.It "00C FF 00D CR 00E SO 00F SI 010 DLE 011 DC1" .It "012 DC2 013 DC3 014 DC4 015 NAK 016 SYN 017 ETB" -.It "018 CAN 019 EM 01a SUB 01b ESC 01c FS 01d GS" -.It "01e RS 01f US 020 SP 07f DEL" +.It "018 CAN 019 EM 01A SUB 01B ESC 01C FS 01D GS" +.It "01E RS 01F US 020 SP 07F DEL" .El .It Cm c Characters in the default character set. From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 22:19:56 2012 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 4CAF61065675; Mon, 2 Jan 2012 22:19:56 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 276D18FC0C; Mon, 2 Jan 2012 22:19: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 q02MJuCn090464; Mon, 2 Jan 2012 22:19:56 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02MJuVc090462; Mon, 2 Jan 2012 22:19:56 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201201022219.q02MJuVc090462@svn.freebsd.org> From: Glen Barber Date: Mon, 2 Jan 2012 22:19:56 +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: r229326 - stable/7/usr.bin/hexdump 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, 02 Jan 2012 22:19:56 -0000 Author: gjb (doc committer) Date: Mon Jan 2 22:19:55 2012 New Revision: 229326 URL: http://svn.freebsd.org/changeset/base/229326 Log: MFC r209035, r228823: r209035 (uqs): - Use same table markup as in hexdump.1 r228823: - Enclose tabbed content in quotes Modified: stable/7/usr.bin/hexdump/od.1 Directory Properties: stable/7/usr.bin/hexdump/ (props changed) Modified: stable/7/usr.bin/hexdump/od.1 ============================================================================== --- stable/7/usr.bin/hexdump/od.1 Mon Jan 2 22:19:11 2012 (r229325) +++ stable/7/usr.bin/hexdump/od.1 Mon Jan 2 22:19:55 2012 (r229326) @@ -32,7 +32,7 @@ .\" @(#)od.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd February 18, 2010 +.Dd December 22, 2011 .Os .Dt OD 1 .Sh NAME @@ -151,11 +151,11 @@ Named characters Control characters are displayed using the following names: .Bl -column "000 NUL" "001 SOH" "002 STX" "003 ETX" "004 EOT" "005 ENQ" .It "000 NUL 001 SOH 002 STX 003 ETX 004 EOT 005 ENQ" -.It "006 ACK 007 BEL 008 BS 009 HT 00a NL 00b VT" -.It "00c FF 00d CR 00e SO 00f SI 010 DLE 011 DC1" +.It "006 ACK 007 BEL 008 BS 009 HT 00A NL 00B VT" +.It "00C FF 00D CR 00E SO 00F SI 010 DLE 011 DC1" .It "012 DC2 013 DC3 014 DC4 015 NAK 016 SYN 017 ETB" -.It "018 CAN 019 EM 01a SUB 01b ESC 01c FS 01d GS" -.It "01e RS 01f US 020 SP 07f DEL" +.It "018 CAN 019 EM 01A SUB 01B ESC 01C FS 01D GS" +.It "01E RS 01F US 020 SP 07F DEL" .El .It Cm c Characters in the default character set. From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 22:22:20 2012 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 1D81A1065673; Mon, 2 Jan 2012 22:22:20 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 081D08FC20; Mon, 2 Jan 2012 22:22:20 +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 q02MMJRB090606; Mon, 2 Jan 2012 22:22:19 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02MMJEv090604; Mon, 2 Jan 2012 22:22:19 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201201022222.q02MMJEv090604@svn.freebsd.org> From: Glen Barber Date: Mon, 2 Jan 2012 22:22: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: r229327 - stable/8/usr.bin/ar 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, 02 Jan 2012 22:22:20 -0000 Author: gjb (doc committer) Date: Mon Jan 2 22:22:19 2012 New Revision: 229327 URL: http://svn.freebsd.org/changeset/base/229327 Log: MFC r228823, r228824: r228823: - Properly escape a special character - Enclose tabbed content in quotes r228824: - Remove trailing whitespace Modified: stable/8/usr.bin/ar/ar.1 Directory Properties: stable/8/usr.bin/ar/ (props changed) Modified: stable/8/usr.bin/ar/ar.1 ============================================================================== --- stable/8/usr.bin/ar/ar.1 Mon Jan 2 22:19:55 2012 (r229326) +++ stable/8/usr.bin/ar/ar.1 Mon Jan 2 22:22:19 2012 (r229327) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 17, 2010 +.Dd December 22, 2011 .Dt AR 1 .Os .Sh NAME @@ -198,11 +198,11 @@ from the archive specified by argument The archive's symbol table, if present, is updated to reflect the new contents of the archive. .It Fl D -When used in combination with the +When used in combination with the .Fl r or .Fl q -option, insert 0's instead of the real mtime, uid and gid values +option, insert 0's instead of the real mtime, uid and gid values and 0644 instead of file mode from the members named by arguments .Ar . This ensures that checksums on the resulting archives are reproducible @@ -414,7 +414,7 @@ character. The .Dq Li * and -.Dq Li "\;" +.Dq Li "\&;" characters start a comment. Comments extend till the end of the line. .Pp @@ -531,7 +531,7 @@ using MRI librarian commands, use the fo .Bd -literal -offset indent create ex.a * specify the output archive addmod ex1.o ex2.o * add modules -save * save pending changes +save * save pending changes end * exit the utility .Ed .Sh DIAGNOSTICS From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 22:23:26 2012 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 919051065679; Mon, 2 Jan 2012 22:23:26 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7B3C58FC19; Mon, 2 Jan 2012 22:23: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 q02MNQpE090676; Mon, 2 Jan 2012 22:23:26 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02MNQaq090674; Mon, 2 Jan 2012 22:23:26 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201201022223.q02MNQaq090674@svn.freebsd.org> From: Glen Barber Date: Mon, 2 Jan 2012 22:23:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229328 - stable/9/usr.bin/rctl 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, 02 Jan 2012 22:23:26 -0000 Author: gjb (doc committer) Date: Mon Jan 2 22:23:26 2012 New Revision: 229328 URL: http://svn.freebsd.org/changeset/base/229328 Log: MFC r228823: r228823: - Enclose tabbed content in quote - Start a sentence on a newline Modified: stable/9/usr.bin/rctl/rctl.8 Directory Properties: stable/9/usr.bin/rctl/ (props changed) Modified: stable/9/usr.bin/rctl/rctl.8 ============================================================================== --- stable/9/usr.bin/rctl/rctl.8 Mon Jan 2 22:22:19 2012 (r229327) +++ stable/9/usr.bin/rctl/rctl.8 Mon Jan 2 22:23:26 2012 (r229328) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 14, 2011 +.Dd December 22, 2011 .Dt RCTL 8 .Os .Sh NAME @@ -89,8 +89,8 @@ Syntax for a rule is subject:subject-id: Subject defines the kind of entity the rule applies to. It can be either process, user, login class, or jail. .Pp -Subject ID identifies the subject. It can be user name, -numerical user ID, login class name, or jail name. +Subject ID identifies the subject. +It can be user name, numerical user ID, login class name, or jail name. .Pp Resource identifies the resource the rule controls. .Pp @@ -122,35 +122,35 @@ A filter that matches all defined rules .Pp .Sh RESOURCES .Bl -column -offset 3n "pseudoterminals" -.It cputime CPU time, in seconds -.It datasize data size, in bytes -.It stacksize stack size, in bytes -.It coredumpsize core dump size, in bytes -.It memoryuse resident set size, in bytes -.It memorylocked locked memory, in bytes -.It maxproc number of processes -.It openfiles file descriptor table size -.It vmemoryuse address space limit, in bytes -.It pseudoterminals number of PTYs -.It swapuse swap usage, in bytes -.It nthr number of threads -.It msgqqueued number of queued SysV messages -.It msgqsize SysV message queue size, in bytes -.It nmsgq number of SysV message queues -.It nsem number of SysV semaphores -.It nsemop number of SysV semaphores modified in a single semop(2) call -.It nshm number of SysV shared memory segments -.It shmsize SysV shared memory size, in bytes -.It wallclock wallclock time, in seconds +.It "cputime CPU time, in seconds" +.It "datasize data size, in bytes" +.It "stacksize stack size, in bytes" +.It "coredumpsize core dump size, in bytes" +.It "memoryuse resident set size, in bytes" +.It "memorylocked locked memory, in bytes" +.It "maxproc number of processes" +.It "openfiles file descriptor table size" +.It "vmemoryuse address space limit, in bytes" +.It "pseudoterminals number of PTYs" +.It "swapuse swap usage, in bytes" +.It "nthr number of threads" +.It "msgqqueued number of queued SysV messages" +.It "msgqsize SysV message queue size, in bytes" +.It "nmsgq number of SysV message queues" +.It "nsem number of SysV semaphores" +.It "nsemop number of SysV semaphores modified in a single semop(2) call" +.It "nshm number of SysV shared memory segments" +.It "shmsize SysV shared memory size, in bytes" +.It "wallclock wallclock time, in seconds" .El .Pp .Sh ACTIONS .Bl -column -offset 3n "pseudoterminals" -.It deny deny the allocation; not supported for cpu and wallclock -.It log log a warning to the console -.It devctl send notification to +.It "deny deny the allocation; not supported for cpu and wallclock" +.It "log log a warning to the console" +.It "devctl send notification to" .Xr devd 8 -.It sig* e.g. sigterm; send a signal to the offending process +.It "sig* e.g. sigterm; send a signal to the offending process" .El .Pp See From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 22:25:22 2012 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 3EE9F1065670; Mon, 2 Jan 2012 22:25:22 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 28A388FC13; Mon, 2 Jan 2012 22:25: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 q02MPMTj090786; Mon, 2 Jan 2012 22:25:22 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02MPMKJ090783; Mon, 2 Jan 2012 22:25:22 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201201022225.q02MPMKJ090783@svn.freebsd.org> From: Glen Barber Date: Mon, 2 Jan 2012 22:25:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229329 - stable/9/lib/libc/stdlib 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, 02 Jan 2012 22:25:22 -0000 Author: gjb (doc committer) Date: Mon Jan 2 22:25:21 2012 New Revision: 229329 URL: http://svn.freebsd.org/changeset/base/229329 Log: MFC r228885: r228885: - Add missing opening and closing brackets in getopt_long.3 and getsubopt.3 to make the examples reflect reality more closely. Modified: stable/9/lib/libc/stdlib/getopt_long.3 stable/9/lib/libc/stdlib/getsubopt.3 Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/stdlib/getopt_long.3 ============================================================================== --- stable/9/lib/libc/stdlib/getopt_long.3 Mon Jan 2 22:23:26 2012 (r229328) +++ stable/9/lib/libc/stdlib/getopt_long.3 Mon Jan 2 22:25:21 2012 (r229329) @@ -31,7 +31,7 @@ .\" @(#)getopt.3 8.5 (Berkeley) 4/27/95 .\" $FreeBSD$ .\" -.Dd April 1, 2000 +.Dd December 25, 2011 .Dt GETOPT_LONG 3 .Os .Sh NAME @@ -239,7 +239,7 @@ static struct option longopts[] = { }; bflag = 0; -while ((ch = getopt_long(argc, argv, "bf:", longopts, NULL)) != -1) +while ((ch = getopt_long(argc, argv, "bf:", longopts, NULL)) != -1) { switch (ch) { case 'b': bflag = 1; @@ -256,6 +256,7 @@ while ((ch = getopt_long(argc, argv, "bf break; default: usage(); + } } argc -= optind; argv += optind; Modified: stable/9/lib/libc/stdlib/getsubopt.3 ============================================================================== --- stable/9/lib/libc/stdlib/getsubopt.3 Mon Jan 2 22:23:26 2012 (r229328) +++ stable/9/lib/libc/stdlib/getsubopt.3 Mon Jan 2 22:25:21 2012 (r229329) @@ -28,7 +28,7 @@ .\" @(#)getsubopt.3 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd June 9, 1993 +.Dd December 25, 2011 .Dt GETSUBOPT 3 .Os .Sh NAME @@ -131,9 +131,11 @@ while ((ch = getopt(argc, argv, "ab:")) else error("missing sub option"); break; + } } break; } +} .Ed .Sh SEE ALSO .Xr getopt 3 , From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 22:25:54 2012 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 7FFF3106566C; Mon, 2 Jan 2012 22:25:54 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 698D68FC0C; Mon, 2 Jan 2012 22:25: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 q02MPsS1090840; Mon, 2 Jan 2012 22:25:54 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02MPsH1090837; Mon, 2 Jan 2012 22:25:54 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201201022225.q02MPsH1090837@svn.freebsd.org> From: Glen Barber Date: Mon, 2 Jan 2012 22:25: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: r229330 - stable/8/lib/libc/stdlib 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, 02 Jan 2012 22:25:54 -0000 Author: gjb (doc committer) Date: Mon Jan 2 22:25:54 2012 New Revision: 229330 URL: http://svn.freebsd.org/changeset/base/229330 Log: MFC r228885: r228885: - Add missing opening and closing brackets in getopt_long.3 and getsubopt.3 to make the examples reflect reality more closely. Modified: stable/8/lib/libc/stdlib/getopt_long.3 stable/8/lib/libc/stdlib/getsubopt.3 Directory Properties: stable/8/lib/libc/ (props changed) Modified: stable/8/lib/libc/stdlib/getopt_long.3 ============================================================================== --- stable/8/lib/libc/stdlib/getopt_long.3 Mon Jan 2 22:25:21 2012 (r229329) +++ stable/8/lib/libc/stdlib/getopt_long.3 Mon Jan 2 22:25:54 2012 (r229330) @@ -31,7 +31,7 @@ .\" @(#)getopt.3 8.5 (Berkeley) 4/27/95 .\" $FreeBSD$ .\" -.Dd April 1, 2000 +.Dd December 25, 2011 .Dt GETOPT_LONG 3 .Os .Sh NAME @@ -239,7 +239,7 @@ static struct option longopts[] = { }; bflag = 0; -while ((ch = getopt_long(argc, argv, "bf:", longopts, NULL)) != -1) +while ((ch = getopt_long(argc, argv, "bf:", longopts, NULL)) != -1) { switch (ch) { case 'b': bflag = 1; @@ -256,6 +256,7 @@ while ((ch = getopt_long(argc, argv, "bf break; default: usage(); + } } argc -= optind; argv += optind; Modified: stable/8/lib/libc/stdlib/getsubopt.3 ============================================================================== --- stable/8/lib/libc/stdlib/getsubopt.3 Mon Jan 2 22:25:21 2012 (r229329) +++ stable/8/lib/libc/stdlib/getsubopt.3 Mon Jan 2 22:25:54 2012 (r229330) @@ -28,7 +28,7 @@ .\" @(#)getsubopt.3 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd June 9, 1993 +.Dd December 25, 2011 .Dt GETSUBOPT 3 .Os .Sh NAME @@ -131,9 +131,11 @@ while ((ch = getopt(argc, argv, "ab:")) else error("missing sub option"); break; + } } break; } +} .Ed .Sh SEE ALSO .Xr getopt 3 , From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 22:26:26 2012 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 807F41065672; Mon, 2 Jan 2012 22:26:26 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6A7258FC1C; Mon, 2 Jan 2012 22:26: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 q02MQQJF090904; Mon, 2 Jan 2012 22:26:26 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02MQQSQ090901; Mon, 2 Jan 2012 22:26:26 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201201022226.q02MQQSQ090901@svn.freebsd.org> From: Glen Barber Date: Mon, 2 Jan 2012 22:26:26 +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: r229331 - stable/7/lib/libc/stdlib 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, 02 Jan 2012 22:26:26 -0000 Author: gjb (doc committer) Date: Mon Jan 2 22:26:26 2012 New Revision: 229331 URL: http://svn.freebsd.org/changeset/base/229331 Log: MFC r228885: r228885: - Add missing opening and closing brackets in getopt_long.3 and getsubopt.3 to make the examples reflect reality more closely. Modified: stable/7/lib/libc/stdlib/getopt_long.3 stable/7/lib/libc/stdlib/getsubopt.3 Directory Properties: stable/7/lib/libc/ (props changed) Modified: stable/7/lib/libc/stdlib/getopt_long.3 ============================================================================== --- stable/7/lib/libc/stdlib/getopt_long.3 Mon Jan 2 22:25:54 2012 (r229330) +++ stable/7/lib/libc/stdlib/getopt_long.3 Mon Jan 2 22:26:26 2012 (r229331) @@ -31,7 +31,7 @@ .\" @(#)getopt.3 8.5 (Berkeley) 4/27/95 .\" $FreeBSD$ .\" -.Dd April 1, 2000 +.Dd December 25, 2011 .Dt GETOPT_LONG 3 .Os .Sh NAME @@ -239,7 +239,7 @@ static struct option longopts[] = { }; bflag = 0; -while ((ch = getopt_long(argc, argv, "bf:", longopts, NULL)) != -1) +while ((ch = getopt_long(argc, argv, "bf:", longopts, NULL)) != -1) { switch (ch) { case 'b': bflag = 1; @@ -256,6 +256,7 @@ while ((ch = getopt_long(argc, argv, "bf break; default: usage(); + } } argc -= optind; argv += optind; Modified: stable/7/lib/libc/stdlib/getsubopt.3 ============================================================================== --- stable/7/lib/libc/stdlib/getsubopt.3 Mon Jan 2 22:25:54 2012 (r229330) +++ stable/7/lib/libc/stdlib/getsubopt.3 Mon Jan 2 22:26:26 2012 (r229331) @@ -28,7 +28,7 @@ .\" @(#)getsubopt.3 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd June 9, 1993 +.Dd December 25, 2011 .Dt GETSUBOPT 3 .Os .Sh NAME @@ -131,9 +131,11 @@ while ((ch = getopt(argc, argv, "ab:")) else error("missing sub option"); break; + } } break; } +} .Ed .Sh SEE ALSO .Xr getopt 3 , From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 22:42:53 2012 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 BF9301065677; Mon, 2 Jan 2012 22:42:53 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-tul01m020-f182.google.com (mail-tul01m020-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 5C60B8FC0A; Mon, 2 Jan 2012 22:42:53 +0000 (UTC) Received: by obbwd18 with SMTP id wd18so18027974obb.13 for ; Mon, 02 Jan 2012 14:42:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=9Oct8IdXaioou1/618V8W5+jQXLhVp+ctt6PFrQGgds=; b=BQSLmsqJfCAtLF8XZ0sMqsufCAsDUBHS25TgKesdJiMSFJ5Bmj35jD7/a5gcvfQZJk YUW1msEnNf0ya+5kJVU3hHf/Jy4fYlhzxxUIZUGCQ7A4+ed1rzoI9rgZt5aij6pgBj59 ErjC6NqSOJaUZ2tRQF7eI6tu3YBr3Qjx/F8HQ= MIME-Version: 1.0 Received: by 10.182.187.37 with SMTP id fp5mr17935532obc.21.1325544172926; Mon, 02 Jan 2012 14:42:52 -0800 (PST) Received: by 10.182.152.6 with HTTP; Mon, 2 Jan 2012 14:42:52 -0800 (PST) In-Reply-To: <201112191535.pBJFZ6hY063597@svn.freebsd.org> References: <201112191535.pBJFZ6hY063597@svn.freebsd.org> Date: Mon, 2 Jan 2012 14:42:52 -0800 Message-ID: From: Garrett Cooper To: Hans Petter Selasky Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228711 - head/sys/dev/usb/controller 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, 02 Jan 2012 22:42:53 -0000 On Mon, Dec 19, 2011 at 7:35 AM, Hans Petter Selasky wrote: > Author: hselasky > Date: Mon Dec 19 15:35:05 2011 > New Revision: 228711 > URL: http://svn.freebsd.org/changeset/base/228711 > > Log: > =A0Add code to wait for USB shutdown to be executed at system shutdown. > =A0Add sysctl which can be used to skip this waiting. > > =A0MFC after: =A0 =A03 days > > Modified: > =A0head/sys/dev/usb/controller/usb_controller.c > > Modified: head/sys/dev/usb/controller/usb_controller.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/usb/controller/usb_controller.c =A0 =A0 =A0 =A0Mon Dec 1= 9 14:55:14 2011 =A0 =A0 =A0 =A0(r228710) > +++ head/sys/dev/usb/controller/usb_controller.c =A0 =A0 =A0 =A0Mon Dec 1= 9 15:35:05 2011 =A0 =A0 =A0 =A0(r228711) > @@ -87,7 +87,12 @@ SYSCTL_INT(_hw_usb_ctrl, OID_AUTO, debug > =A0static int usb_no_boot_wait =3D 0; > =A0TUNABLE_INT("hw.usb.no_boot_wait", &usb_no_boot_wait); > =A0SYSCTL_INT(_hw_usb, OID_AUTO, no_boot_wait, CTLFLAG_RDTUN, &usb_no_boo= t_wait, 0, > - =A0 =A0"No device enumerate waiting at boot."); > + =A0 =A0"No USB device enumerate waiting at boot."); > + > +static int usb_no_shutdown_wait =3D 0; > +TUNABLE_INT("hw.usb.no_shutdown_wait", &usb_no_shutdown_wait); > +SYSCTL_INT(_hw_usb, OID_AUTO, no_shutdown_wait, CTLFLAG_RDTUN, &usb_no_s= hutdown_wait, 0, > + =A0 =A0"No USB device waiting at system shutdown."); > > =A0static devclass_t usb_devclass; > > @@ -277,11 +282,20 @@ usb_shutdown(device_t dev) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return (0); > =A0 =A0 =A0 =A0} > > + =A0 =A0 =A0 device_printf(bus->bdev, "Controller shutdown\n"); > + > =A0 =A0 =A0 =A0USB_BUS_LOCK(bus); > =A0 =A0 =A0 =A0usb_proc_msignal(&bus->explore_proc, > =A0 =A0 =A0 =A0 =A0 =A0&bus->shutdown_msg[0], &bus->shutdown_msg[1]); > + =A0 =A0 =A0 if (usb_no_shutdown_wait =3D=3D 0) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* wait for shutdown callback to be execute= d */ > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 usb_proc_mwait(&bus->explore_proc, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 &bus->shutdown_msg[0], &bus->shutdo= wn_msg[1]); > + =A0 =A0 =A0 } > =A0 =A0 =A0 =A0USB_BUS_UNLOCK(bus); > > + =A0 =A0 =A0 device_printf(bus->bdev, "Controller shutdown complete\n"); > + These printouts are a bit chatty. Could they be put under USB_DEBUG ? Thanks! -Garrett From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 22:55:08 2012 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 C6A9D106566B; Mon, 2 Jan 2012 22:55:08 +0000 (UTC) (envelope-from luchesar.iliev@gmail.com) Received: from mail-ee0-f54.google.com (mail-ee0-f54.google.com [74.125.83.54]) by mx1.freebsd.org (Postfix) with ESMTP id AD8668FC12; Mon, 2 Jan 2012 22:55:07 +0000 (UTC) Received: by eekc50 with SMTP id c50so18501409eek.13 for ; Mon, 02 Jan 2012 14:55:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:disposition-notification-to:date:from:user-agent :mime-version:to:cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=tkWY2y5s/YNVf77gvdAAQ6kvIC9NLMqPbjzN1Pyhra8=; b=YmMsrHEk7IfMfI69oMn0emfSMXmfZbfzvvMTEAXaJGw2pQbR++RZu9lN2b5Rze13aP 5wcNW+NpZRIwzU9Tv2QR3rc1h7zQJ/zFsZvLfzLXtqUzEK36sFvI3wZ7GSfL9inOXh/A 33JCJL86vi+olJhIYKjzCMkZxGTK1vSJgpZeM= Received: by 10.14.9.228 with SMTP id 76mr1992614eet.30.1325543146827; Mon, 02 Jan 2012 14:25:46 -0800 (PST) Received: from [192.168.1.254] ([79.124.93.41]) by mx.google.com with ESMTPS id 19sm21209633eew.7.2012.01.02.14.25.42 (version=SSLv3 cipher=OTHER); Mon, 02 Jan 2012 14:25:43 -0800 (PST) Message-ID: <4F022EE5.1040100@gmail.com> Date: Tue, 03 Jan 2012 00:25:41 +0200 From: "Luchesar V. ILIEV" User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:9.0) Gecko/20111226 Thunderbird/9.0 MIME-Version: 1.0 To: Ken Smith References: <201201021842.q02IgT5T080547@svn.freebsd.org> In-Reply-To: <201201021842.q02IgT5T080547@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org Subject: Re: svn commit: r229304 - stable/9/usr.sbin/pkg_install/add 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, 02 Jan 2012 22:55:08 -0000 On 02/01/2012 20:42, Ken Smith wrote: > Author: kensmith > Date: Mon Jan 2 18:42:29 2012 > New Revision: 229304 > URL: http://svn.freebsd.org/changeset/base/229304 > > Log: > The portion of r225757 that added the packages-9.0-release directory > was supposed to be MFCed closer to the release but that got missed. > > Pointy hat: kensmith > > Modified: > stable/9/usr.sbin/pkg_install/add/main.c > > Modified: stable/9/usr.sbin/pkg_install/add/main.c > ============================================================================== > --- stable/9/usr.sbin/pkg_install/add/main.c Mon Jan 2 18:06:48 2012 (r229303) > +++ stable/9/usr.sbin/pkg_install/add/main.c Mon Jan 2 18:42:29 2012 (r229304) > @@ -87,6 +87,7 @@ struct { > { 800000, 800499, "/packages-8.0-release" }, > { 801000, 801499, "/packages-8.1-release" }, > { 802000, 802499, "/packages-8.2-release" }, > + { 900000, 900499, "/packages-9.0-release" }, > { 300000, 399000, "/packages-3-stable" }, > { 400000, 499000, "/packages-4-stable" }, > { 502100, 502128, "/packages-5-current" }, Apologies if I'm getting it wrong, but shouldn't the following be MFCed too, as noted in PR 162490? { 600100, 699000, "/packages-6-stable" }, { 700100, 799000, "/packages-7-stable" }, { 800500, 899000, "/packages-8-stable" }, - { 900000, 999000, "/packages-9-current" }, + { 900500, 999000, "/packages-9-stable" }, + { 1000000, 1099000, "/packages-10-current" }, { 0, 9999999, "/packages-current" }, { 0, 0, NULL } }; http://www.freebsd.org/cgi/query-pr.cgi?pr=162490 Cheers, Luchesar From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 22:58:32 2012 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 CA5FC106564A; Mon, 2 Jan 2012 22:58:32 +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 B4C7A8FC16; Mon, 2 Jan 2012 22:58: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 q02MwWKl092155; Mon, 2 Jan 2012 22:58:32 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02MwW44092153; Mon, 2 Jan 2012 22:58:32 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201201022258.q02MwW44092153@svn.freebsd.org> From: Ed Schouten Date: Mon, 2 Jan 2012 22:58: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: r229332 - head/include 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, 02 Jan 2012 22:58:32 -0000 Author: ed Date: Mon Jan 2 22:58:32 2012 New Revision: 229332 URL: http://svn.freebsd.org/changeset/base/229332 Log: Remove extraneous semicolons. These macros are supposed to be invoked as regular functions, so remove them. Modified: head/include/stdatomic.h Modified: head/include/stdatomic.h ============================================================================== --- head/include/stdatomic.h Mon Jan 2 22:26:26 2012 (r229331) +++ head/include/stdatomic.h Mon Jan 2 22:58:32 2012 (r229332) @@ -106,13 +106,13 @@ enum memory_order { #if defined(__CLANG_ATOMICS) #define atomic_thread_fence(order) __atomic_thread_fence(order) -#define atomic_signal_fence(order) __asm volatile ("" : : : "memory"); +#define atomic_signal_fence(order) __asm volatile ("" : : : "memory") #elif defined(__GNUC_ATOMICS) #define atomic_thread_fence(order) __atomic_thread_fence(order) #define atomic_signal_fence(order) __atomic_signal_fence(order) #else #define atomic_thread_fence(order) __sync_synchronize() -#define atomic_signal_fence(order) __asm volatile ("" : : : "memory"); +#define atomic_signal_fence(order) __asm volatile ("" : : : "memory") #endif /* From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 22:59:51 2012 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 4FC42106564A; Mon, 2 Jan 2012 22:59:51 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe02.c2i.net [212.247.154.34]) by mx1.freebsd.org (Postfix) with ESMTP id 6D67B8FC15; Mon, 2 Jan 2012 22:59:50 +0000 (UTC) X-T2-Spam-Status: No, hits=-0.2 required=5.0 tests=ALL_TRUSTED, BAYES_50 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe02.swip.net (CommuniGate Pro SMTP 5.4.2) with ESMTPA id 224762331; Mon, 02 Jan 2012 23:59:48 +0100 From: Hans Petter Selasky To: Garrett Cooper Date: Mon, 2 Jan 2012 23:57:21 +0100 User-Agent: KMail/1.13.5 (FreeBSD/8.2-STABLE; KDE/4.4.5; amd64; ; ) References: <201112191535.pBJFZ6hY063597@svn.freebsd.org> In-Reply-To: X-Face: *nPdTl_}RuAI6^PVpA02T?$%Xa^>@hE0uyUIoiha$pC:9TVgl.Oq,NwSZ4V" =?iso-8859-1?q?=7CLR=2E+tj=7Dg5=0A=09=25V?=,x^qOs~mnU3]Gn; cQLv&.N>TrxmSFf+p6(30a/{)KUU!s}w\IhQBj}[g}bj0I3^glmC( =?iso-8859-1?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: <201201022357.22021.hselasky@c2i.net> Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Subject: Re: svn commit: r228711 - head/sys/dev/usb/controller 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, 02 Jan 2012 22:59:51 -0000 On Monday 02 January 2012 23:42:52 Garrett Cooper wrote: > On Mon, Dec 19, 2011 at 7:35 AM, Hans Petter Selasky > > wrote: > > Author: hselasky > > Date: Mon Dec 19 15:35:05 2011 > > New Revision: 228711 > > URL: http://svn.freebsd.org/changeset/base/228711 > > > > Log: > > Add code to wait for USB shutdown to be executed at system shutdown. > > Add sysctl which can be used to skip this waiting. > > > > MFC after: 3 days > > > > Modified: > > head/sys/dev/usb/controller/usb_controller.c > > > > Modified: head/sys/dev/usb/controller/usb_controller.c > > ========================================================================= > > ===== --- head/sys/dev/usb/controller/usb_controller.c Mon Dec 19 > > 14:55:14 2011 (r228710) +++ > > head/sys/dev/usb/controller/usb_controller.c Mon Dec 19 15:35:05 > > 2011 (r228711) @@ -87,7 +87,12 @@ SYSCTL_INT(_hw_usb_ctrl, > > OID_AUTO, debug > > static int usb_no_boot_wait = 0; > > TUNABLE_INT("hw.usb.no_boot_wait", &usb_no_boot_wait); > > SYSCTL_INT(_hw_usb, OID_AUTO, no_boot_wait, CTLFLAG_RDTUN, > > &usb_no_boot_wait, 0, - "No device enumerate waiting at boot."); > > + "No USB device enumerate waiting at boot."); > > + > > +static int usb_no_shutdown_wait = 0; > > +TUNABLE_INT("hw.usb.no_shutdown_wait", &usb_no_shutdown_wait); > > +SYSCTL_INT(_hw_usb, OID_AUTO, no_shutdown_wait, CTLFLAG_RDTUN, > > &usb_no_shutdown_wait, 0, + "No USB device waiting at system > > shutdown."); > > > > static devclass_t usb_devclass; > > > > @@ -277,11 +282,20 @@ usb_shutdown(device_t dev) > > return (0); > > } > > > > + device_printf(bus->bdev, "Controller shutdown\n"); > > + > > USB_BUS_LOCK(bus); > > usb_proc_msignal(&bus->explore_proc, > > &bus->shutdown_msg[0], &bus->shutdown_msg[1]); > > + if (usb_no_shutdown_wait == 0) { > > + /* wait for shutdown callback to be executed */ > > + usb_proc_mwait(&bus->explore_proc, > > + &bus->shutdown_msg[0], &bus->shutdown_msg[1]); > > + } > > USB_BUS_UNLOCK(bus); > > > > + device_printf(bus->bdev, "Controller shutdown complete\n"); > > + > > These printouts are a bit chatty. Could they be put under USB_DEBUG ? Yes, I can do that if others agree too. --HPS From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 23:17:46 2012 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 64B6A1065670; Mon, 2 Jan 2012 23:17:46 +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 45D238FC08; Mon, 2 Jan 2012 23:17:46 +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 q02NHkqB092905; Mon, 2 Jan 2012 23:17:46 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02NHk8Y092903; Mon, 2 Jan 2012 23:17:46 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201022317.q02NHk8Y092903@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 2 Jan 2012 23:17:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229333 - stable/9/sys/dev/dc 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, 02 Jan 2012 23:17:46 -0000 Author: yongari Date: Mon Jan 2 23:17:45 2012 New Revision: 229333 URL: http://svn.freebsd.org/changeset/base/229333 Log: MFC r226699: When driver is run for the first time there would be no established link such that calling dc_setcfg() right after media change would be meaningless unless controller in question is not Davicom DM9102. Ideally dc_setcfg() should be called when speed/duplex is resolved otherwise it would reprogram controller with wrong speed/duplex information. Because MII status change callback already calls dc_setcfg() I think calling dc_setcfg() in dc_init_locked() is wrong. For instance, it would take some time to establish a link after mii_mediachg(), so blindly calling dc_setcfg() right after mii_mediachg() will always yield wrong media configuration. Extend dc_ifmedia_upd() to handle media change and still allow 21143 and Davidcom controllers program speed/duplex regardless of current resolved speed/duplex of link. In theory 21143 may not need to call dc_setcfg() right after media change, but leave it as it is because there are too many variants to test that change. Probably dc(4) shall need a PHY reset in dc_ifmedia_upd() but it's hard to verify correctness of the change. This change reliably makes ULi M5263 establish a link. While I'm here correctly report media change result. Previously it always reported a success. Modified: stable/9/sys/dev/dc/if_dc.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/dc/if_dc.c ============================================================================== --- stable/9/sys/dev/dc/if_dc.c Mon Jan 2 22:58:32 2012 (r229332) +++ stable/9/sys/dev/dc/if_dc.c Mon Jan 2 23:17:45 2012 (r229333) @@ -253,6 +253,7 @@ static void dc_stop(struct dc_softc *); static void dc_watchdog(void *); static int dc_shutdown(device_t); static int dc_ifmedia_upd(struct ifnet *); +static int dc_ifmedia_upd_locked(struct dc_softc *); static void dc_ifmedia_sts(struct ifnet *, struct ifmediareq *); static int dc_dma_alloc(struct dc_softc *); @@ -3600,8 +3601,7 @@ dc_init_locked(struct dc_softc *sc) ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - mii_mediachg(mii); - dc_setcfg(sc, sc->dc_if_media); + dc_ifmedia_upd_locked(sc); /* Clear missed frames and overflow counter. */ CSR_READ_4(sc, DC_FRAMESDISCARDED); @@ -3627,25 +3627,37 @@ static int dc_ifmedia_upd(struct ifnet *ifp) { struct dc_softc *sc; - struct mii_data *mii; - struct ifmedia *ifm; + int error; sc = ifp->if_softc; - mii = device_get_softc(sc->dc_miibus); DC_LOCK(sc); - mii_mediachg(mii); - ifm = &mii->mii_media; - - if (DC_IS_INTEL(sc)) - dc_setcfg(sc, ifm->ifm_media); - else if (DC_IS_DAVICOM(sc) && - IFM_SUBTYPE(ifm->ifm_media) == IFM_HPNA_1) - dc_setcfg(sc, ifm->ifm_media); - else - sc->dc_link = 0; + error = dc_ifmedia_upd_locked(sc); DC_UNLOCK(sc); + return (error); +} - return (0); +static int +dc_ifmedia_upd_locked(struct dc_softc *sc) +{ + struct mii_data *mii; + struct ifmedia *ifm; + int error; + + DC_LOCK_ASSERT(sc); + + sc->dc_link = 0; + mii = device_get_softc(sc->dc_miibus); + error = mii_mediachg(mii); + if (error == 0) { + ifm = &mii->mii_media; + if (DC_IS_INTEL(sc)) + dc_setcfg(sc, ifm->ifm_media); + else if (DC_IS_DAVICOM(sc) && + IFM_SUBTYPE(ifm->ifm_media) == IFM_HPNA_1) + dc_setcfg(sc, ifm->ifm_media); + } + + return (error); } /* From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 23:20:23 2012 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 CE0B3106566B; Mon, 2 Jan 2012 23:20:23 +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 3130B8FC17; Mon, 2 Jan 2012 23:20: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 q02NKNwa093042; Mon, 2 Jan 2012 23:20:23 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02NKNQO093040; Mon, 2 Jan 2012 23:20:23 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201022320.q02NKNQO093040@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 2 Jan 2012 23:20:23 +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: r229334 - in stable/8/sys: conf dev/dc 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, 02 Jan 2012 23:20:24 -0000 Author: yongari Date: Mon Jan 2 23:20:22 2012 New Revision: 229334 URL: http://svn.freebsd.org/changeset/base/229334 Log: MFC r226699: When driver is run for the first time there would be no established link such that calling dc_setcfg() right after media change would be meaningless unless controller in question is not Davicom DM9102. Ideally dc_setcfg() should be called when speed/duplex is resolved otherwise it would reprogram controller with wrong speed/duplex information. Because MII status change callback already calls dc_setcfg() I think calling dc_setcfg() in dc_init_locked() is wrong. For instance, it would take some time to establish a link after mii_mediachg(), so blindly calling dc_setcfg() right after mii_mediachg() will always yield wrong media configuration. Extend dc_ifmedia_upd() to handle media change and still allow 21143 and Davidcom controllers program speed/duplex regardless of current resolved speed/duplex of link. In theory 21143 may not need to call dc_setcfg() right after media change, but leave it as it is because there are too many variants to test that change. Probably dc(4) shall need a PHY reset in dc_ifmedia_upd() but it's hard to verify correctness of the change. This change reliably makes ULi M5263 establish a link. While I'm here correctly report media change result. Previously it always reported a success. Modified: stable/8/sys/dev/dc/if_dc.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/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/dc/if_dc.c ============================================================================== --- stable/8/sys/dev/dc/if_dc.c Mon Jan 2 23:17:45 2012 (r229333) +++ stable/8/sys/dev/dc/if_dc.c Mon Jan 2 23:20:22 2012 (r229334) @@ -253,6 +253,7 @@ static void dc_stop(struct dc_softc *); static void dc_watchdog(void *); static int dc_shutdown(device_t); static int dc_ifmedia_upd(struct ifnet *); +static int dc_ifmedia_upd_locked(struct dc_softc *); static void dc_ifmedia_sts(struct ifnet *, struct ifmediareq *); static int dc_dma_alloc(struct dc_softc *); @@ -3604,8 +3605,7 @@ dc_init_locked(struct dc_softc *sc) ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - mii_mediachg(mii); - dc_setcfg(sc, sc->dc_if_media); + dc_ifmedia_upd_locked(sc); /* Clear missed frames and overflow counter. */ CSR_READ_4(sc, DC_FRAMESDISCARDED); @@ -3631,25 +3631,37 @@ static int dc_ifmedia_upd(struct ifnet *ifp) { struct dc_softc *sc; - struct mii_data *mii; - struct ifmedia *ifm; + int error; sc = ifp->if_softc; - mii = device_get_softc(sc->dc_miibus); DC_LOCK(sc); - mii_mediachg(mii); - ifm = &mii->mii_media; - - if (DC_IS_INTEL(sc)) - dc_setcfg(sc, ifm->ifm_media); - else if (DC_IS_DAVICOM(sc) && - IFM_SUBTYPE(ifm->ifm_media) == IFM_HPNA_1) - dc_setcfg(sc, ifm->ifm_media); - else - sc->dc_link = 0; + error = dc_ifmedia_upd_locked(sc); DC_UNLOCK(sc); + return (error); +} - return (0); +static int +dc_ifmedia_upd_locked(struct dc_softc *sc) +{ + struct mii_data *mii; + struct ifmedia *ifm; + int error; + + DC_LOCK_ASSERT(sc); + + sc->dc_link = 0; + mii = device_get_softc(sc->dc_miibus); + error = mii_mediachg(mii); + if (error == 0) { + ifm = &mii->mii_media; + if (DC_IS_INTEL(sc)) + dc_setcfg(sc, ifm->ifm_media); + else if (DC_IS_DAVICOM(sc) && + IFM_SUBTYPE(ifm->ifm_media) == IFM_HPNA_1) + dc_setcfg(sc, ifm->ifm_media); + } + + return (error); } /* From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 23:22:12 2012 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 096ED106566B; Mon, 2 Jan 2012 23:22:12 +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 DD6588FC12; Mon, 2 Jan 2012 23:22: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 q02NMBJ4093142; Mon, 2 Jan 2012 23:22:11 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02NMBqW093140; Mon, 2 Jan 2012 23:22:11 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201022322.q02NMBqW093140@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 2 Jan 2012 23:22: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: r229335 - stable/7/sys/dev/dc 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, 02 Jan 2012 23:22:12 -0000 Author: yongari Date: Mon Jan 2 23:22:11 2012 New Revision: 229335 URL: http://svn.freebsd.org/changeset/base/229335 Log: MFC r226699: When driver is run for the first time there would be no established link such that calling dc_setcfg() right after media change would be meaningless unless controller in question is not Davicom DM9102. Ideally dc_setcfg() should be called when speed/duplex is resolved otherwise it would reprogram controller with wrong speed/duplex information. Because MII status change callback already calls dc_setcfg() I think calling dc_setcfg() in dc_init_locked() is wrong. For instance, it would take some time to establish a link after mii_mediachg(), so blindly calling dc_setcfg() right after mii_mediachg() will always yield wrong media configuration. Extend dc_ifmedia_upd() to handle media change and still allow 21143 and Davidcom controllers program speed/duplex regardless of current resolved speed/duplex of link. In theory 21143 may not need to call dc_setcfg() right after media change, but leave it as it is because there are too many variants to test that change. Probably dc(4) shall need a PHY reset in dc_ifmedia_upd() but it's hard to verify correctness of the change. This change reliably makes ULi M5263 establish a link. While I'm here correctly report media change result. Previously it always reported a success. Modified: stable/7/sys/dev/dc/if_dc.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/dc/if_dc.c ============================================================================== --- stable/7/sys/dev/dc/if_dc.c Mon Jan 2 23:20:22 2012 (r229334) +++ stable/7/sys/dev/dc/if_dc.c Mon Jan 2 23:22:11 2012 (r229335) @@ -253,6 +253,7 @@ static void dc_stop(struct dc_softc *); static void dc_watchdog(void *); static int dc_shutdown(device_t); static int dc_ifmedia_upd(struct ifnet *); +static int dc_ifmedia_upd_locked(struct dc_softc *); static void dc_ifmedia_sts(struct ifnet *, struct ifmediareq *); static int dc_dma_alloc(struct dc_softc *); @@ -3603,8 +3604,7 @@ dc_init_locked(struct dc_softc *sc) ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - mii_mediachg(mii); - dc_setcfg(sc, sc->dc_if_media); + dc_ifmedia_upd_locked(sc); /* Clear missed frames and overflow counter. */ CSR_READ_4(sc, DC_FRAMESDISCARDED); @@ -3630,25 +3630,37 @@ static int dc_ifmedia_upd(struct ifnet *ifp) { struct dc_softc *sc; - struct mii_data *mii; - struct ifmedia *ifm; + int error; sc = ifp->if_softc; - mii = device_get_softc(sc->dc_miibus); DC_LOCK(sc); - mii_mediachg(mii); - ifm = &mii->mii_media; - - if (DC_IS_INTEL(sc)) - dc_setcfg(sc, ifm->ifm_media); - else if (DC_IS_DAVICOM(sc) && - IFM_SUBTYPE(ifm->ifm_media) == IFM_HPNA_1) - dc_setcfg(sc, ifm->ifm_media); - else - sc->dc_link = 0; + error = dc_ifmedia_upd_locked(sc); DC_UNLOCK(sc); + return (error); +} - return (0); +static int +dc_ifmedia_upd_locked(struct dc_softc *sc) +{ + struct mii_data *mii; + struct ifmedia *ifm; + int error; + + DC_LOCK_ASSERT(sc); + + sc->dc_link = 0; + mii = device_get_softc(sc->dc_miibus); + error = mii_mediachg(mii); + if (error == 0) { + ifm = &mii->mii_media; + if (DC_IS_INTEL(sc)) + dc_setcfg(sc, ifm->ifm_media); + else if (DC_IS_DAVICOM(sc) && + IFM_SUBTYPE(ifm->ifm_media) == IFM_HPNA_1) + dc_setcfg(sc, ifm->ifm_media); + } + + return (error); } /* From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 23:35:19 2012 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 18577106566B; Mon, 2 Jan 2012 23:35:19 +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 012698FC12; Mon, 2 Jan 2012 23:35: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 q02NZIeb093618; Mon, 2 Jan 2012 23:35:18 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02NZIrv093615; Mon, 2 Jan 2012 23:35:18 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201022335.q02NZIrv093615@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 2 Jan 2012 23:35:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229336 - stable/9/sys/dev/dc 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, 02 Jan 2012 23:35:19 -0000 Author: yongari Date: Mon Jan 2 23:35:18 2012 New Revision: 229336 URL: http://svn.freebsd.org/changeset/base/229336 Log: MFC r226701: Add support for ALi/ULi, now NVIDIA, M5261/M5263 PCI FastEthernet controller which is found on ULi M1563 South Bridge & M1689 Bridge. These controllers look like a tulip clone. M5263 controller does not support MII bitbang so use DC_ROM register to access MII registers. Like other tulip variants, ULi controller uses a setup frame to configure RX filter and uses new setup frame format. It's not clear to me whether the controller supports a hash based multicast filtering so this patch uses 14 perfect multicast filter to filter multicast frames. If number of multicast addresses is greater than 14, controller is put into a mode that receives all multicast frames. Due to lack of access to M5261, this change was not tested with M5261 but it probably works. Many thanks to Marco who provided remote access to M5263. Tested by: Marco Steinbach executive-computing dot de>, Martin MATO orange dot fr> Modified: stable/9/sys/dev/dc/if_dc.c stable/9/sys/dev/dc/if_dcreg.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/dc/if_dc.c ============================================================================== --- stable/9/sys/dev/dc/if_dc.c Mon Jan 2 23:22:11 2012 (r229335) +++ stable/9/sys/dev/dc/if_dc.c Mon Jan 2 23:35:18 2012 (r229336) @@ -225,6 +225,10 @@ static const struct dc_type const dc_dev "Linksys PCMPC200 CardBus 10/100" }, { DC_DEVID(DC_VENDORID_LINKSYS, DC_DEVICEID_PCMPC200_AB09), 0, "Linksys PCMPC200 CardBus 10/100" }, + { DC_DEVID(DC_VENDORID_ULI, DC_DEVICEID_M5261), 0, + "ULi M5261 FastEthernet" }, + { DC_DEVID(DC_VENDORID_ULI, DC_DEVICEID_M5263), 0, + "ULi M5263 FastEthernet" }, { 0, 0, NULL } }; @@ -281,6 +285,7 @@ static uint32_t dc_mchash_be(const uint8 static void dc_setfilt_21143(struct dc_softc *); static void dc_setfilt_asix(struct dc_softc *); static void dc_setfilt_admtek(struct dc_softc *); +static void dc_setfilt_uli(struct dc_softc *); static void dc_setfilt_xircom(struct dc_softc *); static void dc_setfilt(struct dc_softc *); @@ -697,6 +702,23 @@ dc_miibus_readreg(device_t dev, int phy, return (0); } + if (sc->dc_type == DC_TYPE_ULI_M5263) { + CSR_WRITE_4(sc, DC_ROM, + ((phy << DC_ULI_PHY_ADDR_SHIFT) & DC_ULI_PHY_ADDR_MASK) | + ((reg << DC_ULI_PHY_REG_SHIFT) & DC_ULI_PHY_REG_MASK) | + DC_ULI_PHY_OP_READ); + for (i = 0; i < DC_TIMEOUT; i++) { + DELAY(1); + rval = CSR_READ_4(sc, DC_ROM); + if ((rval & DC_ULI_PHY_OP_DONE) != 0) { + return (rval & DC_ULI_PHY_DATA_MASK); + } + } + if (i == DC_TIMEOUT) + device_printf(dev, "phy read timed out\n"); + return (0); + } + if (DC_IS_COMET(sc)) { switch (reg) { case MII_BMCR: @@ -762,6 +784,16 @@ dc_miibus_writereg(device_t dev, int phy return (0); } + if (sc->dc_type == DC_TYPE_ULI_M5263) { + CSR_WRITE_4(sc, DC_ROM, + ((phy << DC_ULI_PHY_ADDR_SHIFT) & DC_ULI_PHY_ADDR_MASK) | + ((reg << DC_ULI_PHY_REG_SHIFT) & DC_ULI_PHY_REG_MASK) | + ((data << DC_ULI_PHY_DATA_SHIFT) & DC_ULI_PHY_DATA_MASK) | + DC_ULI_PHY_OP_WRITE); + DELAY(1); + return (0); + } + if (DC_IS_COMET(sc)) { switch (reg) { case MII_BMCR: @@ -1145,6 +1177,97 @@ dc_setfilt_asix(struct dc_softc *sc) } static void +dc_setfilt_uli(struct dc_softc *sc) +{ + uint8_t eaddr[ETHER_ADDR_LEN]; + struct ifnet *ifp; + struct ifmultiaddr *ifma; + struct dc_desc *sframe; + uint32_t filter, *sp; + uint8_t *ma; + int i, mcnt; + + ifp = sc->dc_ifp; + + i = sc->dc_cdata.dc_tx_prod; + DC_INC(sc->dc_cdata.dc_tx_prod, DC_TX_LIST_CNT); + sc->dc_cdata.dc_tx_cnt++; + sframe = &sc->dc_ldata.dc_tx_list[i]; + sp = sc->dc_cdata.dc_sbuf; + bzero(sp, DC_SFRAME_LEN); + + sframe->dc_data = htole32(DC_ADDR_LO(sc->dc_saddr)); + sframe->dc_ctl = htole32(DC_SFRAME_LEN | DC_TXCTL_SETUP | + DC_TXCTL_TLINK | DC_FILTER_PERFECT | DC_TXCTL_FINT); + + sc->dc_cdata.dc_tx_chain[i] = (struct mbuf *)sc->dc_cdata.dc_sbuf; + + /* Set station address. */ + bcopy(IF_LLADDR(sc->dc_ifp), eaddr, ETHER_ADDR_LEN); + *sp++ = DC_SP_MAC(eaddr[1] << 8 | eaddr[0]); + *sp++ = DC_SP_MAC(eaddr[3] << 8 | eaddr[2]); + *sp++ = DC_SP_MAC(eaddr[5] << 8 | eaddr[4]); + + /* Set broadcast address. */ + *sp++ = DC_SP_MAC(0xFFFF); + *sp++ = DC_SP_MAC(0xFFFF); + *sp++ = DC_SP_MAC(0xFFFF); + + /* Extract current filter configuration. */ + filter = CSR_READ_4(sc, DC_NETCFG); + filter &= ~(DC_NETCFG_RX_PROMISC | DC_NETCFG_RX_ALLMULTI); + + /* Now build perfect filters. */ + mcnt = 0; + if_maddr_rlock(ifp); + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + if (ifma->ifma_addr->sa_family != AF_LINK) + continue; + if (mcnt >= DC_ULI_FILTER_NPERF) { + filter |= DC_NETCFG_RX_ALLMULTI; + break; + } + ma = LLADDR((struct sockaddr_dl *)ifma->ifma_addr); + *sp++ = DC_SP_MAC(ma[1] << 8 | ma[0]); + *sp++ = DC_SP_MAC(ma[3] << 8 | ma[2]); + *sp++ = DC_SP_MAC(ma[5] << 8 | ma[4]); + mcnt++; + } + if_maddr_runlock(ifp); + + for (; mcnt < DC_ULI_FILTER_NPERF; mcnt++) { + *sp++ = DC_SP_MAC(0xFFFF); + *sp++ = DC_SP_MAC(0xFFFF); + *sp++ = DC_SP_MAC(0xFFFF); + } + + if (filter & (DC_NETCFG_TX_ON | DC_NETCFG_RX_ON)) + CSR_WRITE_4(sc, DC_NETCFG, + filter & ~(DC_NETCFG_TX_ON | DC_NETCFG_RX_ON)); + if (ifp->if_flags & IFF_PROMISC) + filter |= DC_NETCFG_RX_PROMISC | DC_NETCFG_RX_ALLMULTI; + if (ifp->if_flags & IFF_ALLMULTI) + filter |= DC_NETCFG_RX_ALLMULTI; + CSR_WRITE_4(sc, DC_NETCFG, + filter & ~(DC_NETCFG_TX_ON | DC_NETCFG_RX_ON)); + if (filter & (DC_NETCFG_TX_ON | DC_NETCFG_RX_ON)) + CSR_WRITE_4(sc, DC_NETCFG, filter); + + sframe->dc_status = htole32(DC_TXSTAT_OWN); + bus_dmamap_sync(sc->dc_tx_ltag, sc->dc_tx_lmap, BUS_DMASYNC_PREREAD | + BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(sc->dc_stag, sc->dc_smap, BUS_DMASYNC_PREWRITE); + CSR_WRITE_4(sc, DC_TXSTART, 0xFFFFFFFF); + + /* + * Wait some time... + */ + DELAY(1000); + + sc->dc_wdog_timer = 5; +} + +static void dc_setfilt_xircom(struct dc_softc *sc) { uint16_t eaddr[(ETHER_ADDR_LEN+1)/2]; @@ -1232,6 +1355,9 @@ dc_setfilt(struct dc_softc *sc) if (DC_IS_ADMTEK(sc)) dc_setfilt_admtek(sc); + if (DC_IS_ULI(sc)) + dc_setfilt_uli(sc); + if (DC_IS_XIRCOM(sc)) dc_setfilt_xircom(sc); } @@ -1400,7 +1526,7 @@ dc_reset(struct dc_softc *sc) } if (DC_IS_ASIX(sc) || DC_IS_ADMTEK(sc) || DC_IS_CONEXANT(sc) || - DC_IS_XIRCOM(sc) || DC_IS_INTEL(sc)) { + DC_IS_XIRCOM(sc) || DC_IS_INTEL(sc) || DC_IS_ULI(sc)) { DELAY(10000); DC_CLRBIT(sc, DC_BUSCTL, DC_BUSCTL_RESET); i = 0; @@ -1612,7 +1738,7 @@ dc_read_srom(struct dc_softc *sc, int bi int size; size = DC_ROM_SIZE(bits); - sc->dc_srom = malloc(size, M_DEVBUF, M_NOWAIT); + sc->dc_srom = malloc(size, M_DEVBUF, M_NOWAIT | M_ZERO); if (sc->dc_srom == NULL) { device_printf(sc->dc_dev, "Could not allocate SROM buffer\n"); return (ENOMEM); @@ -1906,7 +2032,8 @@ dc_attach(device_t dev) struct ifnet *ifp; struct dc_mediainfo *m; uint32_t reg, revision; - int error, mac_offset, phy, rid, tmp; + uint16_t *srom; + int error, mac_offset, n, phy, rid, tmp; uint8_t *mac; sc = device_get_softc(dev); @@ -2086,6 +2213,21 @@ dc_attach(device_t dev) if (error != 0) goto fail; break; + case DC_DEVID(DC_VENDORID_ULI, DC_DEVICEID_M5261): + case DC_DEVID(DC_VENDORID_ULI, DC_DEVICEID_M5263): + if (sc->dc_info->dc_devid == + DC_DEVID(DC_VENDORID_ULI, DC_DEVICEID_M5261)) + sc->dc_type = DC_TYPE_ULI_M5261; + else + sc->dc_type = DC_TYPE_ULI_M5263; + /* TX buffers should be aligned on 4 byte boundary. */ + sc->dc_flags |= DC_TX_INTR_ALWAYS | DC_TX_COALESCE | + DC_TX_ALIGN; + sc->dc_pmode = DC_PMODE_MII; + error = dc_read_srom(sc, sc->dc_romwidth); + if (error != 0) + goto fail; + break; default: device_printf(dev, "unknown device: %x\n", sc->dc_info->dc_devid); @@ -2183,6 +2325,33 @@ dc_attach(device_t dev) } bcopy(mac, eaddr, ETHER_ADDR_LEN); break; + case DC_TYPE_ULI_M5261: + case DC_TYPE_ULI_M5263: + srom = (uint16_t *)sc->dc_srom; + if (srom == NULL || *srom == 0xFFFF || *srom == 0) { + /* + * No valid SROM present, read station address + * from ID Table. + */ + device_printf(dev, + "Reading station address from ID Table.\n"); + CSR_WRITE_4(sc, DC_BUSCTL, 0x10000); + CSR_WRITE_4(sc, DC_SIARESET, 0x01C0); + CSR_WRITE_4(sc, DC_10BTCTRL, 0x0000); + CSR_WRITE_4(sc, DC_10BTCTRL, 0x0010); + CSR_WRITE_4(sc, DC_10BTCTRL, 0x0000); + CSR_WRITE_4(sc, DC_SIARESET, 0x0000); + CSR_WRITE_4(sc, DC_SIARESET, 0x01B0); + mac = (uint8_t *)eaddr; + for (n = 0; n < ETHER_ADDR_LEN; n++) + mac[n] = (uint8_t)CSR_READ_4(sc, DC_10BTCTRL); + CSR_WRITE_4(sc, DC_SIARESET, 0x0000); + CSR_WRITE_4(sc, DC_BUSCTL, 0x0000); + DELAY(10); + } else + dc_read_eeprom(sc, (caddr_t)&eaddr, DC_EE_NODEADDR, 3, + 0); + break; default: dc_read_eeprom(sc, (caddr_t)&eaddr, DC_EE_NODEADDR, 3, 0); break; @@ -3459,7 +3628,7 @@ dc_init_locked(struct dc_softc *sc) /* * Set cache alignment and burst length. */ - if (DC_IS_ASIX(sc) || DC_IS_DAVICOM(sc)) + if (DC_IS_ASIX(sc) || DC_IS_DAVICOM(sc) || DC_IS_ULI(sc)) CSR_WRITE_4(sc, DC_BUSCTL, 0); else CSR_WRITE_4(sc, DC_BUSCTL, DC_BUSCTL_MRME | DC_BUSCTL_MRLE); @@ -3572,6 +3741,11 @@ dc_init_locked(struct dc_softc *sc) CSR_WRITE_4(sc, DC_IMR, DC_INTRS); CSR_WRITE_4(sc, DC_ISR, 0xFFFFFFFF); + /* Initialize TX jabber and RX watchdog timer. */ + if (DC_IS_ULI(sc)) + CSR_WRITE_4(sc, DC_WATCHDOG, DC_WDOG_JABBERCLK | + DC_WDOG_HOSTUNJAB); + /* Enable transmitter. */ DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_TX_ON); Modified: stable/9/sys/dev/dc/if_dcreg.h ============================================================================== --- stable/9/sys/dev/dc/if_dcreg.h Mon Jan 2 23:22:11 2012 (r229335) +++ stable/9/sys/dev/dc/if_dcreg.h Mon Jan 2 23:35:18 2012 (r229336) @@ -78,6 +78,8 @@ #define DC_TYPE_PNIC 0xA /* 82c168/82c169 PNIC I */ #define DC_TYPE_XIRCOM 0xB /* Xircom X3201 */ #define DC_TYPE_CONEXANT 0xC /* Conexant LANfinity RS7112 */ +#define DC_TYPE_ULI_M5261 0xD /* ALi/ULi M5261 */ +#define DC_TYPE_ULI_M5263 0xE /* ALi/ULi M5263 */ #define DC_IS_MACRONIX(x) \ (x->dc_type == DC_TYPE_98713 || \ @@ -88,6 +90,10 @@ (x->dc_type == DC_TYPE_AL981 || \ x->dc_type == DC_TYPE_AN983) +#define DC_IS_ULI(x) \ + (x->dc_type == DC_TYPE_ULI_M5261 || \ + x->dc_type == DC_TYPE_ULI_M5263) + #define DC_IS_INTEL(x) (x->dc_type == DC_TYPE_21143) #define DC_IS_ASIX(x) (x->dc_type == DC_TYPE_ASIX) #define DC_IS_COMET(x) (x->dc_type == DC_TYPE_AL981) @@ -707,6 +713,23 @@ struct dc_type { /* End of CONEXANT specific registers */ +/* + * ULi M5263 specific registers. + */ +#define DC_ULI_FILTER_NPERF 14 + +#define DC_ULI_PHY_DATA_MASK 0x0000FFFF +#define DC_ULI_PHY_REG_MASK 0x001F0000 +#define DC_ULI_PHY_ADDR_MASK 0x03E00000 +#define DC_ULI_PHY_OP_WRITE 0x04000000 +#define DC_ULI_PHY_OP_READ 0x08000000 +#define DC_ULI_PHY_OP_DONE 0x10000000 + +#define DC_ULI_PHY_DATA_SHIFT 0 +#define DC_ULI_PHY_REG_SHIFT 16 +#define DC_ULI_PHY_ADDR_SHIFT 21 + +/* End of ULi M5263 specific registers */ struct dc_softc { struct ifnet *dc_ifp; /* interface info */ @@ -1014,6 +1037,17 @@ struct dc_softc { #define DC_DEVICEID_PCMPC200_AB08 0xab08 #define DC_DEVICEID_PCMPC200_AB09 0xab09 +/* + * ULi vendor ID. + */ +#define DC_VENDORID_ULI 0x10b9 + +/* + * ULi device IDs. + */ +#define DC_DEVICEID_M5261 0x5261 +#define DC_DEVICEID_M5263 0x5263 + #define DC_DEVID(vendor, device) ((device) << 16 | (vendor)) /* From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 23:38:03 2012 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 D721E1065672; Mon, 2 Jan 2012 23:38:03 +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 C02758FC0A; Mon, 2 Jan 2012 23:38:03 +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 q02Nc3u0093749; Mon, 2 Jan 2012 23:38:03 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02Nc3gQ093746; Mon, 2 Jan 2012 23:38:03 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201022338.q02Nc3gQ093746@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 2 Jan 2012 23:38:03 +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: r229337 - in stable/8/sys: conf dev/dc 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, 02 Jan 2012 23:38:04 -0000 Author: yongari Date: Mon Jan 2 23:38:03 2012 New Revision: 229337 URL: http://svn.freebsd.org/changeset/base/229337 Log: MFC r226701: Add support for ALi/ULi, now NVIDIA, M5261/M5263 PCI FastEthernet controller which is found on ULi M1563 South Bridge & M1689 Bridge. These controllers look like a tulip clone. M5263 controller does not support MII bitbang so use DC_ROM register to access MII registers. Like other tulip variants, ULi controller uses a setup frame to configure RX filter and uses new setup frame format. It's not clear to me whether the controller supports a hash based multicast filtering so this patch uses 14 perfect multicast filter to filter multicast frames. If number of multicast addresses is greater than 14, controller is put into a mode that receives all multicast frames. Due to lack of access to M5261, this change was not tested with M5261 but it probably works. Many thanks to Marco who provided remote access to M5263. Tested by: Marco Steinbach executive-computing dot de>, Martin MATO orange dot fr> Modified: stable/8/sys/dev/dc/if_dc.c stable/8/sys/dev/dc/if_dcreg.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/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/dc/if_dc.c ============================================================================== --- stable/8/sys/dev/dc/if_dc.c Mon Jan 2 23:35:18 2012 (r229336) +++ stable/8/sys/dev/dc/if_dc.c Mon Jan 2 23:38:03 2012 (r229337) @@ -225,6 +225,10 @@ static const struct dc_type const dc_dev "Linksys PCMPC200 CardBus 10/100" }, { DC_DEVID(DC_VENDORID_LINKSYS, DC_DEVICEID_PCMPC200_AB09), 0, "Linksys PCMPC200 CardBus 10/100" }, + { DC_DEVID(DC_VENDORID_ULI, DC_DEVICEID_M5261), 0, + "ULi M5261 FastEthernet" }, + { DC_DEVID(DC_VENDORID_ULI, DC_DEVICEID_M5263), 0, + "ULi M5263 FastEthernet" }, { 0, 0, NULL } }; @@ -281,6 +285,7 @@ static uint32_t dc_mchash_be(const uint8 static void dc_setfilt_21143(struct dc_softc *); static void dc_setfilt_asix(struct dc_softc *); static void dc_setfilt_admtek(struct dc_softc *); +static void dc_setfilt_uli(struct dc_softc *); static void dc_setfilt_xircom(struct dc_softc *); static void dc_setfilt(struct dc_softc *); @@ -701,6 +706,23 @@ dc_miibus_readreg(device_t dev, int phy, return (0); } + if (sc->dc_type == DC_TYPE_ULI_M5263) { + CSR_WRITE_4(sc, DC_ROM, + ((phy << DC_ULI_PHY_ADDR_SHIFT) & DC_ULI_PHY_ADDR_MASK) | + ((reg << DC_ULI_PHY_REG_SHIFT) & DC_ULI_PHY_REG_MASK) | + DC_ULI_PHY_OP_READ); + for (i = 0; i < DC_TIMEOUT; i++) { + DELAY(1); + rval = CSR_READ_4(sc, DC_ROM); + if ((rval & DC_ULI_PHY_OP_DONE) != 0) { + return (rval & DC_ULI_PHY_DATA_MASK); + } + } + if (i == DC_TIMEOUT) + device_printf(dev, "phy read timed out\n"); + return (0); + } + if (DC_IS_COMET(sc)) { switch (reg) { case MII_BMCR: @@ -766,6 +788,16 @@ dc_miibus_writereg(device_t dev, int phy return (0); } + if (sc->dc_type == DC_TYPE_ULI_M5263) { + CSR_WRITE_4(sc, DC_ROM, + ((phy << DC_ULI_PHY_ADDR_SHIFT) & DC_ULI_PHY_ADDR_MASK) | + ((reg << DC_ULI_PHY_REG_SHIFT) & DC_ULI_PHY_REG_MASK) | + ((data << DC_ULI_PHY_DATA_SHIFT) & DC_ULI_PHY_DATA_MASK) | + DC_ULI_PHY_OP_WRITE); + DELAY(1); + return (0); + } + if (DC_IS_COMET(sc)) { switch (reg) { case MII_BMCR: @@ -1149,6 +1181,97 @@ dc_setfilt_asix(struct dc_softc *sc) } static void +dc_setfilt_uli(struct dc_softc *sc) +{ + uint8_t eaddr[ETHER_ADDR_LEN]; + struct ifnet *ifp; + struct ifmultiaddr *ifma; + struct dc_desc *sframe; + uint32_t filter, *sp; + uint8_t *ma; + int i, mcnt; + + ifp = sc->dc_ifp; + + i = sc->dc_cdata.dc_tx_prod; + DC_INC(sc->dc_cdata.dc_tx_prod, DC_TX_LIST_CNT); + sc->dc_cdata.dc_tx_cnt++; + sframe = &sc->dc_ldata.dc_tx_list[i]; + sp = sc->dc_cdata.dc_sbuf; + bzero(sp, DC_SFRAME_LEN); + + sframe->dc_data = htole32(DC_ADDR_LO(sc->dc_saddr)); + sframe->dc_ctl = htole32(DC_SFRAME_LEN | DC_TXCTL_SETUP | + DC_TXCTL_TLINK | DC_FILTER_PERFECT | DC_TXCTL_FINT); + + sc->dc_cdata.dc_tx_chain[i] = (struct mbuf *)sc->dc_cdata.dc_sbuf; + + /* Set station address. */ + bcopy(IF_LLADDR(sc->dc_ifp), eaddr, ETHER_ADDR_LEN); + *sp++ = DC_SP_MAC(eaddr[1] << 8 | eaddr[0]); + *sp++ = DC_SP_MAC(eaddr[3] << 8 | eaddr[2]); + *sp++ = DC_SP_MAC(eaddr[5] << 8 | eaddr[4]); + + /* Set broadcast address. */ + *sp++ = DC_SP_MAC(0xFFFF); + *sp++ = DC_SP_MAC(0xFFFF); + *sp++ = DC_SP_MAC(0xFFFF); + + /* Extract current filter configuration. */ + filter = CSR_READ_4(sc, DC_NETCFG); + filter &= ~(DC_NETCFG_RX_PROMISC | DC_NETCFG_RX_ALLMULTI); + + /* Now build perfect filters. */ + mcnt = 0; + if_maddr_rlock(ifp); + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + if (ifma->ifma_addr->sa_family != AF_LINK) + continue; + if (mcnt >= DC_ULI_FILTER_NPERF) { + filter |= DC_NETCFG_RX_ALLMULTI; + break; + } + ma = LLADDR((struct sockaddr_dl *)ifma->ifma_addr); + *sp++ = DC_SP_MAC(ma[1] << 8 | ma[0]); + *sp++ = DC_SP_MAC(ma[3] << 8 | ma[2]); + *sp++ = DC_SP_MAC(ma[5] << 8 | ma[4]); + mcnt++; + } + if_maddr_runlock(ifp); + + for (; mcnt < DC_ULI_FILTER_NPERF; mcnt++) { + *sp++ = DC_SP_MAC(0xFFFF); + *sp++ = DC_SP_MAC(0xFFFF); + *sp++ = DC_SP_MAC(0xFFFF); + } + + if (filter & (DC_NETCFG_TX_ON | DC_NETCFG_RX_ON)) + CSR_WRITE_4(sc, DC_NETCFG, + filter & ~(DC_NETCFG_TX_ON | DC_NETCFG_RX_ON)); + if (ifp->if_flags & IFF_PROMISC) + filter |= DC_NETCFG_RX_PROMISC | DC_NETCFG_RX_ALLMULTI; + if (ifp->if_flags & IFF_ALLMULTI) + filter |= DC_NETCFG_RX_ALLMULTI; + CSR_WRITE_4(sc, DC_NETCFG, + filter & ~(DC_NETCFG_TX_ON | DC_NETCFG_RX_ON)); + if (filter & (DC_NETCFG_TX_ON | DC_NETCFG_RX_ON)) + CSR_WRITE_4(sc, DC_NETCFG, filter); + + sframe->dc_status = htole32(DC_TXSTAT_OWN); + bus_dmamap_sync(sc->dc_tx_ltag, sc->dc_tx_lmap, BUS_DMASYNC_PREREAD | + BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(sc->dc_stag, sc->dc_smap, BUS_DMASYNC_PREWRITE); + CSR_WRITE_4(sc, DC_TXSTART, 0xFFFFFFFF); + + /* + * Wait some time... + */ + DELAY(1000); + + sc->dc_wdog_timer = 5; +} + +static void dc_setfilt_xircom(struct dc_softc *sc) { uint16_t eaddr[(ETHER_ADDR_LEN+1)/2]; @@ -1236,6 +1359,9 @@ dc_setfilt(struct dc_softc *sc) if (DC_IS_ADMTEK(sc)) dc_setfilt_admtek(sc); + if (DC_IS_ULI(sc)) + dc_setfilt_uli(sc); + if (DC_IS_XIRCOM(sc)) dc_setfilt_xircom(sc); } @@ -1404,7 +1530,7 @@ dc_reset(struct dc_softc *sc) } if (DC_IS_ASIX(sc) || DC_IS_ADMTEK(sc) || DC_IS_CONEXANT(sc) || - DC_IS_XIRCOM(sc) || DC_IS_INTEL(sc)) { + DC_IS_XIRCOM(sc) || DC_IS_INTEL(sc) || DC_IS_ULI(sc)) { DELAY(10000); DC_CLRBIT(sc, DC_BUSCTL, DC_BUSCTL_RESET); i = 0; @@ -1616,7 +1742,7 @@ dc_read_srom(struct dc_softc *sc, int bi int size; size = DC_ROM_SIZE(bits); - sc->dc_srom = malloc(size, M_DEVBUF, M_NOWAIT); + sc->dc_srom = malloc(size, M_DEVBUF, M_NOWAIT | M_ZERO); if (sc->dc_srom == NULL) { device_printf(sc->dc_dev, "Could not allocate SROM buffer\n"); return (ENOMEM); @@ -1910,7 +2036,8 @@ dc_attach(device_t dev) struct ifnet *ifp; struct dc_mediainfo *m; uint32_t reg, revision; - int error, mac_offset, phy, rid, tmp; + uint16_t *srom; + int error, mac_offset, n, phy, rid, tmp; uint8_t *mac; sc = device_get_softc(dev); @@ -2090,6 +2217,21 @@ dc_attach(device_t dev) if (error != 0) goto fail; break; + case DC_DEVID(DC_VENDORID_ULI, DC_DEVICEID_M5261): + case DC_DEVID(DC_VENDORID_ULI, DC_DEVICEID_M5263): + if (sc->dc_info->dc_devid == + DC_DEVID(DC_VENDORID_ULI, DC_DEVICEID_M5261)) + sc->dc_type = DC_TYPE_ULI_M5261; + else + sc->dc_type = DC_TYPE_ULI_M5263; + /* TX buffers should be aligned on 4 byte boundary. */ + sc->dc_flags |= DC_TX_INTR_ALWAYS | DC_TX_COALESCE | + DC_TX_ALIGN; + sc->dc_pmode = DC_PMODE_MII; + error = dc_read_srom(sc, sc->dc_romwidth); + if (error != 0) + goto fail; + break; default: device_printf(dev, "unknown device: %x\n", sc->dc_info->dc_devid); @@ -2187,6 +2329,33 @@ dc_attach(device_t dev) } bcopy(mac, eaddr, ETHER_ADDR_LEN); break; + case DC_TYPE_ULI_M5261: + case DC_TYPE_ULI_M5263: + srom = (uint16_t *)sc->dc_srom; + if (srom == NULL || *srom == 0xFFFF || *srom == 0) { + /* + * No valid SROM present, read station address + * from ID Table. + */ + device_printf(dev, + "Reading station address from ID Table.\n"); + CSR_WRITE_4(sc, DC_BUSCTL, 0x10000); + CSR_WRITE_4(sc, DC_SIARESET, 0x01C0); + CSR_WRITE_4(sc, DC_10BTCTRL, 0x0000); + CSR_WRITE_4(sc, DC_10BTCTRL, 0x0010); + CSR_WRITE_4(sc, DC_10BTCTRL, 0x0000); + CSR_WRITE_4(sc, DC_SIARESET, 0x0000); + CSR_WRITE_4(sc, DC_SIARESET, 0x01B0); + mac = (uint8_t *)eaddr; + for (n = 0; n < ETHER_ADDR_LEN; n++) + mac[n] = (uint8_t)CSR_READ_4(sc, DC_10BTCTRL); + CSR_WRITE_4(sc, DC_SIARESET, 0x0000); + CSR_WRITE_4(sc, DC_BUSCTL, 0x0000); + DELAY(10); + } else + dc_read_eeprom(sc, (caddr_t)&eaddr, DC_EE_NODEADDR, 3, + 0); + break; default: dc_read_eeprom(sc, (caddr_t)&eaddr, DC_EE_NODEADDR, 3, 0); break; @@ -3463,7 +3632,7 @@ dc_init_locked(struct dc_softc *sc) /* * Set cache alignment and burst length. */ - if (DC_IS_ASIX(sc) || DC_IS_DAVICOM(sc)) + if (DC_IS_ASIX(sc) || DC_IS_DAVICOM(sc) || DC_IS_ULI(sc)) CSR_WRITE_4(sc, DC_BUSCTL, 0); else CSR_WRITE_4(sc, DC_BUSCTL, DC_BUSCTL_MRME | DC_BUSCTL_MRLE); @@ -3576,6 +3745,11 @@ dc_init_locked(struct dc_softc *sc) CSR_WRITE_4(sc, DC_IMR, DC_INTRS); CSR_WRITE_4(sc, DC_ISR, 0xFFFFFFFF); + /* Initialize TX jabber and RX watchdog timer. */ + if (DC_IS_ULI(sc)) + CSR_WRITE_4(sc, DC_WATCHDOG, DC_WDOG_JABBERCLK | + DC_WDOG_HOSTUNJAB); + /* Enable transmitter. */ DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_TX_ON); Modified: stable/8/sys/dev/dc/if_dcreg.h ============================================================================== --- stable/8/sys/dev/dc/if_dcreg.h Mon Jan 2 23:35:18 2012 (r229336) +++ stable/8/sys/dev/dc/if_dcreg.h Mon Jan 2 23:38:03 2012 (r229337) @@ -78,6 +78,8 @@ #define DC_TYPE_PNIC 0xA /* 82c168/82c169 PNIC I */ #define DC_TYPE_XIRCOM 0xB /* Xircom X3201 */ #define DC_TYPE_CONEXANT 0xC /* Conexant LANfinity RS7112 */ +#define DC_TYPE_ULI_M5261 0xD /* ALi/ULi M5261 */ +#define DC_TYPE_ULI_M5263 0xE /* ALi/ULi M5263 */ #define DC_IS_MACRONIX(x) \ (x->dc_type == DC_TYPE_98713 || \ @@ -88,6 +90,10 @@ (x->dc_type == DC_TYPE_AL981 || \ x->dc_type == DC_TYPE_AN983) +#define DC_IS_ULI(x) \ + (x->dc_type == DC_TYPE_ULI_M5261 || \ + x->dc_type == DC_TYPE_ULI_M5263) + #define DC_IS_INTEL(x) (x->dc_type == DC_TYPE_21143) #define DC_IS_ASIX(x) (x->dc_type == DC_TYPE_ASIX) #define DC_IS_COMET(x) (x->dc_type == DC_TYPE_AL981) @@ -707,6 +713,23 @@ struct dc_type { /* End of CONEXANT specific registers */ +/* + * ULi M5263 specific registers. + */ +#define DC_ULI_FILTER_NPERF 14 + +#define DC_ULI_PHY_DATA_MASK 0x0000FFFF +#define DC_ULI_PHY_REG_MASK 0x001F0000 +#define DC_ULI_PHY_ADDR_MASK 0x03E00000 +#define DC_ULI_PHY_OP_WRITE 0x04000000 +#define DC_ULI_PHY_OP_READ 0x08000000 +#define DC_ULI_PHY_OP_DONE 0x10000000 + +#define DC_ULI_PHY_DATA_SHIFT 0 +#define DC_ULI_PHY_REG_SHIFT 16 +#define DC_ULI_PHY_ADDR_SHIFT 21 + +/* End of ULi M5263 specific registers */ struct dc_softc { struct ifnet *dc_ifp; /* interface info */ @@ -1014,6 +1037,17 @@ struct dc_softc { #define DC_DEVICEID_PCMPC200_AB08 0xab08 #define DC_DEVICEID_PCMPC200_AB09 0xab09 +/* + * ULi vendor ID. + */ +#define DC_VENDORID_ULI 0x10b9 + +/* + * ULi device IDs. + */ +#define DC_DEVICEID_M5261 0x5261 +#define DC_DEVICEID_M5263 0x5263 + #define DC_DEVID(vendor, device) ((device) << 16 | (vendor)) /* From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 23:40:11 2012 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 107551065738; Mon, 2 Jan 2012 23:40:10 +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 1CFC58FC08; Mon, 2 Jan 2012 23:40: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 q02NeA0W093850; Mon, 2 Jan 2012 23:40:10 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02Ne9PJ093847; Mon, 2 Jan 2012 23:40:09 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201022340.q02Ne9PJ093847@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 2 Jan 2012 23:40:09 +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: r229338 - stable/7/sys/dev/dc 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, 02 Jan 2012 23:40:11 -0000 Author: yongari Date: Mon Jan 2 23:40:09 2012 New Revision: 229338 URL: http://svn.freebsd.org/changeset/base/229338 Log: MFC r226701: Add support for ALi/ULi, now NVIDIA, M5261/M5263 PCI FastEthernet controller which is found on ULi M1563 South Bridge & M1689 Bridge. These controllers look like a tulip clone. M5263 controller does not support MII bitbang so use DC_ROM register to access MII registers. Like other tulip variants, ULi controller uses a setup frame to configure RX filter and uses new setup frame format. It's not clear to me whether the controller supports a hash based multicast filtering so this patch uses 14 perfect multicast filter to filter multicast frames. If number of multicast addresses is greater than 14, controller is put into a mode that receives all multicast frames. Due to lack of access to M5261, this change was not tested with M5261 but it probably works. Many thanks to Marco who provided remote access to M5263. Tested by: Marco Steinbach executive-computing dot de>, Martin MATO orange dot fr> Modified: stable/7/sys/dev/dc/if_dc.c stable/7/sys/dev/dc/if_dcreg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/dc/if_dc.c ============================================================================== --- stable/7/sys/dev/dc/if_dc.c Mon Jan 2 23:38:03 2012 (r229337) +++ stable/7/sys/dev/dc/if_dc.c Mon Jan 2 23:40:09 2012 (r229338) @@ -225,6 +225,10 @@ static const struct dc_type const dc_dev "Linksys PCMPC200 CardBus 10/100" }, { DC_DEVID(DC_VENDORID_LINKSYS, DC_DEVICEID_PCMPC200_AB09), 0, "Linksys PCMPC200 CardBus 10/100" }, + { DC_DEVID(DC_VENDORID_ULI, DC_DEVICEID_M5261), 0, + "ULi M5261 FastEthernet" }, + { DC_DEVID(DC_VENDORID_ULI, DC_DEVICEID_M5263), 0, + "ULi M5263 FastEthernet" }, { 0, 0, NULL } }; @@ -281,6 +285,7 @@ static uint32_t dc_mchash_be(const uint8 static void dc_setfilt_21143(struct dc_softc *); static void dc_setfilt_asix(struct dc_softc *); static void dc_setfilt_admtek(struct dc_softc *); +static void dc_setfilt_uli(struct dc_softc *); static void dc_setfilt_xircom(struct dc_softc *); static void dc_setfilt(struct dc_softc *); @@ -702,6 +707,23 @@ dc_miibus_readreg(device_t dev, int phy, return (0); } + if (sc->dc_type == DC_TYPE_ULI_M5263) { + CSR_WRITE_4(sc, DC_ROM, + ((phy << DC_ULI_PHY_ADDR_SHIFT) & DC_ULI_PHY_ADDR_MASK) | + ((reg << DC_ULI_PHY_REG_SHIFT) & DC_ULI_PHY_REG_MASK) | + DC_ULI_PHY_OP_READ); + for (i = 0; i < DC_TIMEOUT; i++) { + DELAY(1); + rval = CSR_READ_4(sc, DC_ROM); + if ((rval & DC_ULI_PHY_OP_DONE) != 0) { + return (rval & DC_ULI_PHY_DATA_MASK); + } + } + if (i == DC_TIMEOUT) + device_printf(dev, "phy read timed out\n"); + return (0); + } + if (DC_IS_COMET(sc)) { switch (reg) { case MII_BMCR: @@ -767,6 +789,16 @@ dc_miibus_writereg(device_t dev, int phy return (0); } + if (sc->dc_type == DC_TYPE_ULI_M5263) { + CSR_WRITE_4(sc, DC_ROM, + ((phy << DC_ULI_PHY_ADDR_SHIFT) & DC_ULI_PHY_ADDR_MASK) | + ((reg << DC_ULI_PHY_REG_SHIFT) & DC_ULI_PHY_REG_MASK) | + ((data << DC_ULI_PHY_DATA_SHIFT) & DC_ULI_PHY_DATA_MASK) | + DC_ULI_PHY_OP_WRITE); + DELAY(1); + return (0); + } + if (DC_IS_COMET(sc)) { switch (reg) { case MII_BMCR: @@ -1150,6 +1182,97 @@ dc_setfilt_asix(struct dc_softc *sc) } static void +dc_setfilt_uli(struct dc_softc *sc) +{ + uint8_t eaddr[ETHER_ADDR_LEN]; + struct ifnet *ifp; + struct ifmultiaddr *ifma; + struct dc_desc *sframe; + uint32_t filter, *sp; + uint8_t *ma; + int i, mcnt; + + ifp = sc->dc_ifp; + + i = sc->dc_cdata.dc_tx_prod; + DC_INC(sc->dc_cdata.dc_tx_prod, DC_TX_LIST_CNT); + sc->dc_cdata.dc_tx_cnt++; + sframe = &sc->dc_ldata.dc_tx_list[i]; + sp = sc->dc_cdata.dc_sbuf; + bzero(sp, DC_SFRAME_LEN); + + sframe->dc_data = htole32(DC_ADDR_LO(sc->dc_saddr)); + sframe->dc_ctl = htole32(DC_SFRAME_LEN | DC_TXCTL_SETUP | + DC_TXCTL_TLINK | DC_FILTER_PERFECT | DC_TXCTL_FINT); + + sc->dc_cdata.dc_tx_chain[i] = (struct mbuf *)sc->dc_cdata.dc_sbuf; + + /* Set station address. */ + bcopy(IF_LLADDR(sc->dc_ifp), eaddr, ETHER_ADDR_LEN); + *sp++ = DC_SP_MAC(eaddr[1] << 8 | eaddr[0]); + *sp++ = DC_SP_MAC(eaddr[3] << 8 | eaddr[2]); + *sp++ = DC_SP_MAC(eaddr[5] << 8 | eaddr[4]); + + /* Set broadcast address. */ + *sp++ = DC_SP_MAC(0xFFFF); + *sp++ = DC_SP_MAC(0xFFFF); + *sp++ = DC_SP_MAC(0xFFFF); + + /* Extract current filter configuration. */ + filter = CSR_READ_4(sc, DC_NETCFG); + filter &= ~(DC_NETCFG_RX_PROMISC | DC_NETCFG_RX_ALLMULTI); + + /* Now build perfect filters. */ + mcnt = 0; + IF_ADDR_LOCK(ifp); + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + if (ifma->ifma_addr->sa_family != AF_LINK) + continue; + if (mcnt >= DC_ULI_FILTER_NPERF) { + filter |= DC_NETCFG_RX_ALLMULTI; + break; + } + ma = LLADDR((struct sockaddr_dl *)ifma->ifma_addr); + *sp++ = DC_SP_MAC(ma[1] << 8 | ma[0]); + *sp++ = DC_SP_MAC(ma[3] << 8 | ma[2]); + *sp++ = DC_SP_MAC(ma[5] << 8 | ma[4]); + mcnt++; + } + IF_ADDR_LOCK(ifp); + + for (; mcnt < DC_ULI_FILTER_NPERF; mcnt++) { + *sp++ = DC_SP_MAC(0xFFFF); + *sp++ = DC_SP_MAC(0xFFFF); + *sp++ = DC_SP_MAC(0xFFFF); + } + + if (filter & (DC_NETCFG_TX_ON | DC_NETCFG_RX_ON)) + CSR_WRITE_4(sc, DC_NETCFG, + filter & ~(DC_NETCFG_TX_ON | DC_NETCFG_RX_ON)); + if (ifp->if_flags & IFF_PROMISC) + filter |= DC_NETCFG_RX_PROMISC | DC_NETCFG_RX_ALLMULTI; + if (ifp->if_flags & IFF_ALLMULTI) + filter |= DC_NETCFG_RX_ALLMULTI; + CSR_WRITE_4(sc, DC_NETCFG, + filter & ~(DC_NETCFG_TX_ON | DC_NETCFG_RX_ON)); + if (filter & (DC_NETCFG_TX_ON | DC_NETCFG_RX_ON)) + CSR_WRITE_4(sc, DC_NETCFG, filter); + + sframe->dc_status = htole32(DC_TXSTAT_OWN); + bus_dmamap_sync(sc->dc_tx_ltag, sc->dc_tx_lmap, BUS_DMASYNC_PREREAD | + BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(sc->dc_stag, sc->dc_smap, BUS_DMASYNC_PREWRITE); + CSR_WRITE_4(sc, DC_TXSTART, 0xFFFFFFFF); + + /* + * Wait some time... + */ + DELAY(1000); + + sc->dc_wdog_timer = 5; +} + +static void dc_setfilt_xircom(struct dc_softc *sc) { uint16_t eaddr[(ETHER_ADDR_LEN+1)/2]; @@ -1237,6 +1360,9 @@ dc_setfilt(struct dc_softc *sc) if (DC_IS_ADMTEK(sc)) dc_setfilt_admtek(sc); + if (DC_IS_ULI(sc)) + dc_setfilt_uli(sc); + if (DC_IS_XIRCOM(sc)) dc_setfilt_xircom(sc); } @@ -1405,7 +1531,7 @@ dc_reset(struct dc_softc *sc) } if (DC_IS_ASIX(sc) || DC_IS_ADMTEK(sc) || DC_IS_CONEXANT(sc) || - DC_IS_XIRCOM(sc) || DC_IS_INTEL(sc)) { + DC_IS_XIRCOM(sc) || DC_IS_INTEL(sc) || DC_IS_ULI(sc)) { DELAY(10000); DC_CLRBIT(sc, DC_BUSCTL, DC_BUSCTL_RESET); i = 0; @@ -1617,7 +1743,7 @@ dc_read_srom(struct dc_softc *sc, int bi int size; size = DC_ROM_SIZE(bits); - sc->dc_srom = malloc(size, M_DEVBUF, M_NOWAIT); + sc->dc_srom = malloc(size, M_DEVBUF, M_NOWAIT | M_ZERO); if (sc->dc_srom == NULL) { device_printf(sc->dc_dev, "Could not allocate SROM buffer\n"); return (ENOMEM); @@ -1911,7 +2037,8 @@ dc_attach(device_t dev) struct ifnet *ifp; struct dc_mediainfo *m; uint32_t reg, revision; - int error, mac_offset, phy, rid, tmp; + uint16_t *srom; + int error, mac_offset, n, phy, rid, tmp; uint8_t *mac; sc = device_get_softc(dev); @@ -2091,6 +2218,21 @@ dc_attach(device_t dev) if (error != 0) goto fail; break; + case DC_DEVID(DC_VENDORID_ULI, DC_DEVICEID_M5261): + case DC_DEVID(DC_VENDORID_ULI, DC_DEVICEID_M5263): + if (sc->dc_info->dc_devid == + DC_DEVID(DC_VENDORID_ULI, DC_DEVICEID_M5261)) + sc->dc_type = DC_TYPE_ULI_M5261; + else + sc->dc_type = DC_TYPE_ULI_M5263; + /* TX buffers should be aligned on 4 byte boundary. */ + sc->dc_flags |= DC_TX_INTR_ALWAYS | DC_TX_COALESCE | + DC_TX_ALIGN; + sc->dc_pmode = DC_PMODE_MII; + error = dc_read_srom(sc, sc->dc_romwidth); + if (error != 0) + goto fail; + break; default: device_printf(dev, "unknown device: %x\n", sc->dc_info->dc_devid); @@ -2188,6 +2330,33 @@ dc_attach(device_t dev) } bcopy(mac, eaddr, ETHER_ADDR_LEN); break; + case DC_TYPE_ULI_M5261: + case DC_TYPE_ULI_M5263: + srom = (uint16_t *)sc->dc_srom; + if (srom == NULL || *srom == 0xFFFF || *srom == 0) { + /* + * No valid SROM present, read station address + * from ID Table. + */ + device_printf(dev, + "Reading station address from ID Table.\n"); + CSR_WRITE_4(sc, DC_BUSCTL, 0x10000); + CSR_WRITE_4(sc, DC_SIARESET, 0x01C0); + CSR_WRITE_4(sc, DC_10BTCTRL, 0x0000); + CSR_WRITE_4(sc, DC_10BTCTRL, 0x0010); + CSR_WRITE_4(sc, DC_10BTCTRL, 0x0000); + CSR_WRITE_4(sc, DC_SIARESET, 0x0000); + CSR_WRITE_4(sc, DC_SIARESET, 0x01B0); + mac = (uint8_t *)eaddr; + for (n = 0; n < ETHER_ADDR_LEN; n++) + mac[n] = (uint8_t)CSR_READ_4(sc, DC_10BTCTRL); + CSR_WRITE_4(sc, DC_SIARESET, 0x0000); + CSR_WRITE_4(sc, DC_BUSCTL, 0x0000); + DELAY(10); + } else + dc_read_eeprom(sc, (caddr_t)&eaddr, DC_EE_NODEADDR, 3, + 0); + break; default: dc_read_eeprom(sc, (caddr_t)&eaddr, DC_EE_NODEADDR, 3, 0); break; @@ -3462,7 +3631,7 @@ dc_init_locked(struct dc_softc *sc) /* * Set cache alignment and burst length. */ - if (DC_IS_ASIX(sc) || DC_IS_DAVICOM(sc)) + if (DC_IS_ASIX(sc) || DC_IS_DAVICOM(sc) || DC_IS_ULI(sc)) CSR_WRITE_4(sc, DC_BUSCTL, 0); else CSR_WRITE_4(sc, DC_BUSCTL, DC_BUSCTL_MRME | DC_BUSCTL_MRLE); @@ -3575,6 +3744,11 @@ dc_init_locked(struct dc_softc *sc) CSR_WRITE_4(sc, DC_IMR, DC_INTRS); CSR_WRITE_4(sc, DC_ISR, 0xFFFFFFFF); + /* Initialize TX jabber and RX watchdog timer. */ + if (DC_IS_ULI(sc)) + CSR_WRITE_4(sc, DC_WATCHDOG, DC_WDOG_JABBERCLK | + DC_WDOG_HOSTUNJAB); + /* Enable transmitter. */ DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_TX_ON); Modified: stable/7/sys/dev/dc/if_dcreg.h ============================================================================== --- stable/7/sys/dev/dc/if_dcreg.h Mon Jan 2 23:38:03 2012 (r229337) +++ stable/7/sys/dev/dc/if_dcreg.h Mon Jan 2 23:40:09 2012 (r229338) @@ -78,6 +78,8 @@ #define DC_TYPE_PNIC 0xA /* 82c168/82c169 PNIC I */ #define DC_TYPE_XIRCOM 0xB /* Xircom X3201 */ #define DC_TYPE_CONEXANT 0xC /* Conexant LANfinity RS7112 */ +#define DC_TYPE_ULI_M5261 0xD /* ALi/ULi M5261 */ +#define DC_TYPE_ULI_M5263 0xE /* ALi/ULi M5263 */ #define DC_IS_MACRONIX(x) \ (x->dc_type == DC_TYPE_98713 || \ @@ -88,6 +90,10 @@ (x->dc_type == DC_TYPE_AL981 || \ x->dc_type == DC_TYPE_AN983) +#define DC_IS_ULI(x) \ + (x->dc_type == DC_TYPE_ULI_M5261 || \ + x->dc_type == DC_TYPE_ULI_M5263) + #define DC_IS_INTEL(x) (x->dc_type == DC_TYPE_21143) #define DC_IS_ASIX(x) (x->dc_type == DC_TYPE_ASIX) #define DC_IS_COMET(x) (x->dc_type == DC_TYPE_AL981) @@ -707,6 +713,23 @@ struct dc_type { /* End of CONEXANT specific registers */ +/* + * ULi M5263 specific registers. + */ +#define DC_ULI_FILTER_NPERF 14 + +#define DC_ULI_PHY_DATA_MASK 0x0000FFFF +#define DC_ULI_PHY_REG_MASK 0x001F0000 +#define DC_ULI_PHY_ADDR_MASK 0x03E00000 +#define DC_ULI_PHY_OP_WRITE 0x04000000 +#define DC_ULI_PHY_OP_READ 0x08000000 +#define DC_ULI_PHY_OP_DONE 0x10000000 + +#define DC_ULI_PHY_DATA_SHIFT 0 +#define DC_ULI_PHY_REG_SHIFT 16 +#define DC_ULI_PHY_ADDR_SHIFT 21 + +/* End of ULi M5263 specific registers */ struct dc_softc { struct ifnet *dc_ifp; /* interface info */ @@ -1014,6 +1037,17 @@ struct dc_softc { #define DC_DEVICEID_PCMPC200_AB08 0xab08 #define DC_DEVICEID_PCMPC200_AB09 0xab09 +/* + * ULi vendor ID. + */ +#define DC_VENDORID_ULI 0x10b9 + +/* + * ULi device IDs. + */ +#define DC_DEVICEID_M5261 0x5261 +#define DC_DEVICEID_M5263 0x5263 + #define DC_DEVID(vendor, device) ((device) << 16 | (vendor)) /* From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 23:43:09 2012 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 0884F106566B; Mon, 2 Jan 2012 23:43:09 +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 E732F8FC12; Mon, 2 Jan 2012 23:43:08 +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 q02Nh8QX094050; Mon, 2 Jan 2012 23:43:08 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02Nh8M4094048; Mon, 2 Jan 2012 23:43:08 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201022343.q02Nh8M4094048@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 2 Jan 2012 23:43:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229339 - stable/9/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: Mon, 02 Jan 2012 23:43:09 -0000 Author: yongari Date: Mon Jan 2 23:43:08 2012 New Revision: 229339 URL: http://svn.freebsd.org/changeset/base/229339 Log: MFC 226703-226704: r226703: Add ALi/ULi M5261/M5263 to supported hardware chipets. r226704: All dc(4) controllers support VLAN over-sized frame. Xr vlan Modified: stable/9/share/man/man4/dc.4 Directory Properties: stable/9/share/man/man4/ (props changed) Modified: stable/9/share/man/man4/dc.4 ============================================================================== --- stable/9/share/man/man4/dc.4 Mon Jan 2 23:40:09 2012 (r229338) +++ stable/9/share/man/man4/dc.4 Mon Jan 2 23:43:08 2012 (r229339) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 23, 2011 +.Dd October 24, 2011 .Dt DC 4 .Os .Sh NAME @@ -160,6 +160,8 @@ DEC/Intel 21143 ADMtek AL981 Comet, AN985 Centaur, ADM9511 Centaur II and ADM9513 Centaur II .It +ALi/ULi M5261 and M5263 +.It ASIX Electronics AX88140A and AX88141 .It Conexant LANfinity RS7112 (miniPCI) @@ -345,6 +347,7 @@ the card should be configured correctly. .Xr netintro 4 , .Xr ng_ether 4 , .Xr polling 4 , +.Xr vlan 4 , .Xr eeprom 8 , .Xr ifconfig 8 .Rs From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 23:43:17 2012 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 6662710657E8; Mon, 2 Jan 2012 23:43:17 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 463B38FC08; Mon, 2 Jan 2012 23:43: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 q02NhHUR094091; Mon, 2 Jan 2012 23:43:17 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02NhHdx094088; Mon, 2 Jan 2012 23:43:17 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201201022343.q02NhHdx094088@svn.freebsd.org> From: Glen Barber Date: Mon, 2 Jan 2012 23:43:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229340 - stable/9/usr.bin/du 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, 02 Jan 2012 23:43:17 -0000 Author: gjb (doc committer) Date: Mon Jan 2 23:43:16 2012 New Revision: 229340 URL: http://svn.freebsd.org/changeset/base/229340 Log: MFC r228356: r228356: - Update du(1): - Sort arguments alphabetically where appropriate - '-B blocksize' is not mutually exclusive of '-h|-k|-m' - Mention '-t' in synopsis - Other wording improvements - Update usage() output to reflect the new synopsis - Other miscellaneous improvements PR: 162438 Modified: stable/9/usr.bin/du/du.1 stable/9/usr.bin/du/du.c Directory Properties: stable/9/usr.bin/du/ (props changed) Modified: stable/9/usr.bin/du/du.1 ============================================================================== --- stable/9/usr.bin/du/du.1 Mon Jan 2 23:43:08 2012 (r229339) +++ stable/9/usr.bin/du/du.1 Mon Jan 2 23:43:16 2012 (r229340) @@ -28,7 +28,7 @@ .\" @(#)du.1 8.2 (Berkeley) 4/1/94 .\" $FreeBSD$ .\" -.Dd November 6, 2008 +.Dd December 8, 2011 .Dt DU 1 .Os .Sh NAME @@ -36,15 +36,13 @@ .Nd display disk usage statistics .Sh SYNOPSIS .Nm -.Op Fl A +.Op Fl Aclnx .Op Fl H | L | P -.Op Fl a | s | d Ar depth | Fl t Ar threshold -.Op Fl c -.Op Fl l -.Op Fl h | k | m | B Ar blocksize -.Op Fl n -.Op Fl x +.Op Fl h | k | m +.Op Fl a | s | d Ar depth +.Op Fl B Ar blocksize .Op Fl I Ar mask +.Op Fl t Ar threshold .Op Ar .Sh DESCRIPTION The @@ -65,7 +63,9 @@ Calculate block counts in .Ar blocksize byte blocks. This is different from the -.Fl k, m +.Fl h, k +and +.Fl m options or setting .Ev BLOCKSIZE and gives an estimate of how much space the examined file hierarchy would @@ -79,48 +79,31 @@ is rounded up to the next multiple of 51 .It Fl H Symbolic links on the command line are followed, symbolic links in file hierarchies are not followed. -.It Fl L -Symbolic links on the command line and in file hierarchies are followed. .It Fl I Ar mask Ignore files and directories matching the specified .Ar mask . +.It Fl L +Symbolic links on the command line and in file hierarchies are followed. .It Fl P No symbolic links are followed. This is the default. .It Fl a Display an entry for each file in a file hierarchy. -.It Fl h -"Human-readable" output. -Use unit suffixes: Byte, Kilobyte, Megabyte, -Gigabyte, Terabyte and Petabyte. -.It Fl r -Generate messages about directories that cannot be read, files -that cannot be opened, and so on. -This is the default case. -This option exists solely for conformance with -.St -xpg4 . -.It Fl s -Display an entry for each specified file. -(Equivalent to -.Fl d Li 0 ) -.It Fl t Ar threshold -Display only entries for which size exceeds -.Ar threshold . -If -.Ar threshold -is negative, display only entries for which size is less than the absolute -value of -.Ar threshold . +.It Fl c +Display a grand total. .It Fl d Ar depth Display an entry for all files and directories .Ar depth directories deep. -.It Fl c -Display a grand total. +.It Fl h +.Dq Human-readable +output. +Use unit suffixes: Byte, Kilobyte, Megabyte, +Gigabyte, Terabyte and Petabyte. .It Fl k Display block counts in 1024-byte (1-Kbyte) blocks. .It Fl l -If a file has multiple hard links, count its size many times. +If a file has multiple hard links, count its size multiple times. The default behavior of .Nm is to count files with multiple hard links only once. @@ -136,6 +119,24 @@ Ignore files and directories with user flag .Pq Dv UF_NODUMP set. +.It Fl r +Generate messages about directories that cannot be read, files +that cannot be opened, and so on. +This is the default case. +This option exists solely for conformance with +.St -xpg4 . +.It Fl s +Display an entry for each specified file. +(Equivalent to +.Fl d Li 0 ) +.It Fl t Ar threshold +Display only entries for which size exceeds +.Ar threshold . +If +.Ar threshold +is negative, display only entries for which size is less than the absolute +value of +.Ar threshold . .It Fl x File system mount points are not traversed. .El @@ -152,25 +153,32 @@ If either the .Fl H or .Fl L -options are specified, storage used by any symbolic links which are -followed is not counted or displayed. +option is specified, storage used by any symbolic links which are +followed is not counted (or displayed). +.Pp +The +.Fl h, k +and +.Fl m +options all override each other; the last one specified determines +the block counts used. .Sh ENVIRONMENT .Bl -tag -width BLOCKSIZE .It Ev BLOCKSIZE If the environment variable .Ev BLOCKSIZE is set, and the -.Fl k, m +.Fl h, k or -.Fl h +.Fl m options are not specified, the block counts will be displayed in units of that block size. If .Ev BLOCKSIZE is not set, and the -.Fl k, m +.Fl h, k or -.Fl h +.Fl m options are not specified, the block counts will be displayed in 512-byte blocks. .El Modified: stable/9/usr.bin/du/du.c ============================================================================== --- stable/9/usr.bin/du/du.c Mon Jan 2 23:43:08 2012 (r229339) +++ stable/9/usr.bin/du/du.c Mon Jan 2 23:43:16 2012 (r229340) @@ -507,9 +507,9 @@ static void usage(void) { (void)fprintf(stderr, - "usage: du [-A] [-H | -L | -P] [-a | -s | -d depth] [-c] " - "[-l] [-h | -k | -m | -B bsize] [-n] [-x] [-I mask] " - "[file ...]\n"); + "usage: du [-Aclnx] [-H | -L | -P] [-h | -k | -m ] " + "[-a | -s | -d depth] [-B blocksize] [-I mask] " + "[-t threshold] [file ...]\n"); exit(EX_USAGE); } From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 23:43:26 2012 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 A9C0310657C7; Mon, 2 Jan 2012 23:43:26 +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 944B48FC0A; Mon, 2 Jan 2012 23:43: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 q02NhQJi094131; Mon, 2 Jan 2012 23:43:26 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02NhQ13094129; Mon, 2 Jan 2012 23:43:26 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201022343.q02NhQ13094129@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 2 Jan 2012 23:43:26 +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: r229341 - 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: Mon, 02 Jan 2012 23:43:26 -0000 Author: yongari Date: Mon Jan 2 23:43:26 2012 New Revision: 229341 URL: http://svn.freebsd.org/changeset/base/229341 Log: MFC 226703-226704: r226703: Add ALi/ULi M5261/M5263 to supported hardware chipets. r226704: All dc(4) controllers support VLAN over-sized frame. Xr vlan Modified: stable/8/share/man/man4/dc.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/dc.4 ============================================================================== --- stable/8/share/man/man4/dc.4 Mon Jan 2 23:43:16 2012 (r229340) +++ stable/8/share/man/man4/dc.4 Mon Jan 2 23:43:26 2012 (r229341) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 23, 2011 +.Dd October 24, 2011 .Dt DC 4 .Os .Sh NAME @@ -162,6 +162,8 @@ DEC/Intel 21143 ADMtek AL981 Comet, AN985 Centaur, ADM9511 Centaur II and ADM9513 Centaur II .It +ALi/ULi M5261 and M5263 +.It ASIX Electronics AX88140A and AX88141 .It Conexant LANfinity RS7112 (miniPCI) @@ -347,6 +349,7 @@ the card should be configured correctly. .Xr netintro 4 , .Xr ng_ether 4 , .Xr polling 4 , +.Xr vlan 4 , .Xr eeprom 8 , .Xr ifconfig 8 .Rs From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 23:43:45 2012 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 649541065672; Mon, 2 Jan 2012 23:43:45 +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 4ED708FC13; Mon, 2 Jan 2012 23:43: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 q02Nhjho094180; Mon, 2 Jan 2012 23:43:45 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02NhjED094178; Mon, 2 Jan 2012 23:43:45 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201022343.q02NhjED094178@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 2 Jan 2012 23:43:45 +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: r229342 - 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: Mon, 02 Jan 2012 23:43:45 -0000 Author: yongari Date: Mon Jan 2 23:43:45 2012 New Revision: 229342 URL: http://svn.freebsd.org/changeset/base/229342 Log: MFC 226703-226704: r226703: Add ALi/ULi M5261/M5263 to supported hardware chipets. r226704: All dc(4) controllers support VLAN over-sized frame. Xr vlan Modified: stable/7/share/man/man4/dc.4 Directory Properties: stable/7/share/man/man4/ (props changed) Modified: stable/7/share/man/man4/dc.4 ============================================================================== --- stable/7/share/man/man4/dc.4 Mon Jan 2 23:43:26 2012 (r229341) +++ stable/7/share/man/man4/dc.4 Mon Jan 2 23:43:45 2012 (r229342) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 23, 2011 +.Dd October 24, 2011 .Dt DC 4 .Os .Sh NAME @@ -162,6 +162,8 @@ DEC/Intel 21143 ADMtek AL981 Comet, AN985 Centaur, ADM9511 Centaur II and ADM9513 Centaur II .It +ALi/ULi M5261 and M5263 +.It ASIX Electronics AX88140A and AX88141 .It Conexant LANfinity RS7112 (miniPCI) @@ -347,6 +349,7 @@ the card should be configured correctly. .Xr netintro 4 , .Xr ng_ether 4 , .Xr polling 4 , +.Xr vlan 4 , .Xr eeprom 8 , .Xr ifconfig 8 .Rs From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 23:44:07 2012 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 ED6DC1065680; Mon, 2 Jan 2012 23:44:07 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D78838FC0C; Mon, 2 Jan 2012 23:44: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 q02Ni7i0094243; Mon, 2 Jan 2012 23:44:07 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02Ni7h4094240; Mon, 2 Jan 2012 23:44:07 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201201022344.q02Ni7h4094240@svn.freebsd.org> From: Glen Barber Date: Mon, 2 Jan 2012 23:44:07 +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: r229343 - stable/8/usr.bin/du 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, 02 Jan 2012 23:44:08 -0000 Author: gjb (doc committer) Date: Mon Jan 2 23:44:07 2012 New Revision: 229343 URL: http://svn.freebsd.org/changeset/base/229343 Log: MFC r210993, r228356: r210933 (joel): - Fix typos and spelling mistakes r228356: [3] - Update du(1): - Sort arguments alphabetically where appropriate - '-B blocksize' is not mutually exclusive of '-h|-k|-m' - Mention '-t' in synopsis - Other wording improvements - Update usage() output to reflect the new synopsis - Other miscellaneous improvements PR: 162438 [3] Modified: stable/8/usr.bin/du/du.1 stable/8/usr.bin/du/du.c Directory Properties: stable/8/usr.bin/du/ (props changed) Modified: stable/8/usr.bin/du/du.1 ============================================================================== --- stable/8/usr.bin/du/du.1 Mon Jan 2 23:43:45 2012 (r229342) +++ stable/8/usr.bin/du/du.1 Mon Jan 2 23:44:07 2012 (r229343) @@ -32,7 +32,7 @@ .\" @(#)du.1 8.2 (Berkeley) 4/1/94 .\" $FreeBSD$ .\" -.Dd November 6, 2008 +.Dd December 8, 2011 .Dt DU 1 .Os .Sh NAME @@ -40,15 +40,13 @@ .Nd display disk usage statistics .Sh SYNOPSIS .Nm -.Op Fl A +.Op Fl Aclnx .Op Fl H | L | P -.Op Fl a | s | d Ar depth | Fl t Ar threshold -.Op Fl c -.Op Fl l -.Op Fl h | k | m | B Ar blocksize -.Op Fl n -.Op Fl x +.Op Fl h | k | m +.Op Fl a | s | d Ar depth +.Op Fl B Ar blocksize .Op Fl I Ar mask +.Op Fl t Ar threshold .Op Ar .Sh DESCRIPTION The @@ -69,10 +67,12 @@ Calculate block counts in .Ar blocksize byte blocks. This is different from the -.Fl k, m +.Fl h, k +and +.Fl m options or setting .Ev BLOCKSIZE -and gives an estimate of how much space the examined file hierachy would +and gives an estimate of how much space the examined file hierarchy would require on a filesystem with the given .Ar blocksize . Unless in @@ -83,48 +83,31 @@ is rounded up to the next multiple of 51 .It Fl H Symbolic links on the command line are followed, symbolic links in file hierarchies are not followed. -.It Fl L -Symbolic links on the command line and in file hierarchies are followed. .It Fl I Ar mask Ignore files and directories matching the specified .Ar mask . +.It Fl L +Symbolic links on the command line and in file hierarchies are followed. .It Fl P No symbolic links are followed. This is the default. .It Fl a Display an entry for each file in a file hierarchy. -.It Fl h -"Human-readable" output. -Use unit suffixes: Byte, Kilobyte, Megabyte, -Gigabyte, Terabyte and Petabyte. -.It Fl r -Generate messages about directories that cannot be read, files -that cannot be opened, and so on. -This is the default case. -This option exists solely for conformance with -.St -xpg4 . -.It Fl s -Display an entry for each specified file. -(Equivalent to -.Fl d Li 0 ) -.It Fl t Ar threshold -Display only entries for which size exceeds -.Ar threshold . -If -.Ar threshold -is negative, display only entries for which size is less than the absolute -value of -.Ar threshold . +.It Fl c +Display a grand total. .It Fl d Ar depth Display an entry for all files and directories .Ar depth directories deep. -.It Fl c -Display a grand total. +.It Fl h +.Dq Human-readable +output. +Use unit suffixes: Byte, Kilobyte, Megabyte, +Gigabyte, Terabyte and Petabyte. .It Fl k Display block counts in 1024-byte (1-Kbyte) blocks. .It Fl l -If a file has multiple hard links, count its size many times. +If a file has multiple hard links, count its size multiple times. The default behavior of .Nm is to count files with multiple hard links only once. @@ -140,6 +123,24 @@ Ignore files and directories with user flag .Pq Dv UF_NODUMP set. +.It Fl r +Generate messages about directories that cannot be read, files +that cannot be opened, and so on. +This is the default case. +This option exists solely for conformance with +.St -xpg4 . +.It Fl s +Display an entry for each specified file. +(Equivalent to +.Fl d Li 0 ) +.It Fl t Ar threshold +Display only entries for which size exceeds +.Ar threshold . +If +.Ar threshold +is negative, display only entries for which size is less than the absolute +value of +.Ar threshold . .It Fl x File system mount points are not traversed. .El @@ -156,25 +157,32 @@ If either the .Fl H or .Fl L -options are specified, storage used by any symbolic links which are -followed is not counted or displayed. +option is specified, storage used by any symbolic links which are +followed is not counted (or displayed). +.Pp +The +.Fl h, k +and +.Fl m +options all override each other; the last one specified determines +the block counts used. .Sh ENVIRONMENT .Bl -tag -width BLOCKSIZE .It Ev BLOCKSIZE If the environment variable .Ev BLOCKSIZE is set, and the -.Fl k, m +.Fl h, k or -.Fl h +.Fl m options are not specified, the block counts will be displayed in units of that block size. If .Ev BLOCKSIZE is not set, and the -.Fl k, m +.Fl h, k or -.Fl h +.Fl m options are not specified, the block counts will be displayed in 512-byte blocks. .El Modified: stable/8/usr.bin/du/du.c ============================================================================== --- stable/8/usr.bin/du/du.c Mon Jan 2 23:43:45 2012 (r229342) +++ stable/8/usr.bin/du/du.c Mon Jan 2 23:44:07 2012 (r229343) @@ -511,9 +511,9 @@ static void usage(void) { (void)fprintf(stderr, - "usage: du [-A] [-H | -L | -P] [-a | -s | -d depth] [-c] " - "[-l] [-h | -k | -m | -B bsize] [-n] [-x] [-I mask] " - "[file ...]\n"); + "usage: du [-Aclnx] [-H | -L | -P] [-h | -k | -m ] " + "[-a | -s | -d depth] [-B blocksize] [-I mask] " + "[-t threshold] [file ...]\n"); exit(EX_USAGE); } From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 23:47:51 2012 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 9D4A4106566B; Mon, 2 Jan 2012 23:47:51 +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 85F608FC08; Mon, 2 Jan 2012 23:47:51 +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 q02Nlpoh094411; Mon, 2 Jan 2012 23:47:51 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02NlpGB094408; Mon, 2 Jan 2012 23:47:51 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201022347.q02NlpGB094408@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 2 Jan 2012 23:47:51 +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: r229344 - in stable/8/sys: conf dev/usb/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: Mon, 02 Jan 2012 23:47:51 -0000 Author: yongari Date: Mon Jan 2 23:47:51 2012 New Revision: 229344 URL: http://svn.freebsd.org/changeset/base/229344 Log: MFC r226709: This change makes it possible to define driver specific attach handler such that driver can announce interface capabilities and can do its own MII attach. Currently all USB ethernet controllers have no way to establish a link with pause capabilities. Lack of checksum offloading support also was one of reason to bring this change in. This change adds a couple of wrappers to USB ethernet drivers (uether_ifmedia_upd, uether_init and uether_start). All exported functions in uether has prefix uether_ so I think it's more consistent to have wrappers that follow the convention. This change preserves ABI/KPI so it should be safe to merge this change to stable/8. While I'm here add missing __FBSDID and clean up headers. Modified: stable/8/sys/dev/usb/net/usb_ethernet.c stable/8/sys/dev/usb/net/usb_ethernet.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/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/usb/net/usb_ethernet.c ============================================================================== --- stable/8/sys/dev/usb/net/usb_ethernet.c Mon Jan 2 23:44:07 2012 (r229343) +++ stable/8/sys/dev/usb/net/usb_ethernet.c Mon Jan 2 23:47:51 2012 (r229344) @@ -24,24 +24,32 @@ * SUCH DAMAGE. */ -#include -#include +#include +__FBSDID("$FreeBSD$"); + #include -#include -#include #include -#include #include -#include +#include +#include #include +#include +#include +#include #include -#include +#include +#include #include #include -#include -#include -#include -#include + +#include +#include +#include +#include +#include + +#include +#include #include #include @@ -197,42 +205,53 @@ ue_attach_post_task(struct usb_proc_msg usb_callout_init_mtx(&ue->ue_watchdog, ue->ue_mtx, 0); sysctl_ctx_init(&ue->ue_sysctl_ctx); + error = 0; ifp = if_alloc(IFT_ETHER); if (ifp == NULL) { device_printf(ue->ue_dev, "could not allocate ifnet\n"); - goto error; + goto fail; } ifp->if_softc = ue; if_initname(ifp, "ue", ue->ue_unit); - ifp->if_mtu = ETHERMTU; - ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; - if (ue->ue_methods->ue_ioctl != NULL) - ifp->if_ioctl = ue->ue_methods->ue_ioctl; - else - ifp->if_ioctl = uether_ioctl; - ifp->if_start = ue_start; - ifp->if_init = ue_init; - IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); - ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; - IFQ_SET_READY(&ifp->if_snd); - ue->ue_ifp = ifp; - - if (ue->ue_methods->ue_mii_upd != NULL && - ue->ue_methods->ue_mii_sts != NULL) { - mtx_lock(&Giant); /* device_xxx() depends on this */ - error = mii_attach(ue->ue_dev, &ue->ue_miibus, ifp, - ue_ifmedia_upd, ue->ue_methods->ue_mii_sts, - BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); - mtx_unlock(&Giant); - if (error) { - device_printf(ue->ue_dev, "attaching PHYs failed\n"); - goto error; + if (ue->ue_methods->ue_attach_post_sub != NULL) { + ue->ue_ifp = ifp; + error = ue->ue_methods->ue_attach_post_sub(ue); + } else { + ifp->if_mtu = ETHERMTU; + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; + if (ue->ue_methods->ue_ioctl != NULL) + ifp->if_ioctl = ue->ue_methods->ue_ioctl; + else + ifp->if_ioctl = uether_ioctl; + ifp->if_start = ue_start; + ifp->if_init = ue_init; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; + IFQ_SET_READY(&ifp->if_snd); + ue->ue_ifp = ifp; + + if (ue->ue_methods->ue_mii_upd != NULL && + ue->ue_methods->ue_mii_sts != NULL) { + /* device_xxx() depends on this */ + mtx_lock(&Giant); + error = mii_attach(ue->ue_dev, &ue->ue_miibus, ifp, + ue_ifmedia_upd, ue->ue_methods->ue_mii_sts, + BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + mtx_unlock(&Giant); } } + if (error) { + device_printf(ue->ue_dev, "attaching PHYs failed\n"); + goto fail; + } + if_printf(ifp, " on %s\n", device_get_nameunit(ue->ue_dev)); ether_ifattach(ifp, ue->ue_eaddr); + /* Tell upper layer we support VLAN oversized frames. */ + if (ifp->if_capabilities & IFCAP_VLAN_MTU) + ifp->if_hdrlen = sizeof(struct ether_vlan_header); snprintf(num, sizeof(num), "%u", ue->ue_unit); ue->ue_sysctl_oid = SYSCTL_ADD_NODE(&ue->ue_sysctl_ctx, @@ -246,7 +265,7 @@ ue_attach_post_task(struct usb_proc_msg UE_LOCK(ue); return; -error: +fail: free_unr(ueunit, ue->ue_unit); if (ue->ue_ifp != NULL) { if_free(ue->ue_ifp); @@ -307,6 +326,13 @@ uether_is_gone(struct usb_ether *ue) return (usb_proc_is_gone(&ue->ue_tq)); } +void +uether_init(void *arg) +{ + + ue_init(arg); +} + static void ue_init(void *arg) { @@ -352,6 +378,13 @@ ue_stop_task(struct usb_proc_msg *_task) ue->ue_methods->ue_stop(ue); } +void +uether_start(struct ifnet *ifp) +{ + + ue_start(ifp); +} + static void ue_start(struct ifnet *ifp) { @@ -385,6 +418,13 @@ ue_setmulti_task(struct usb_proc_msg *_t ue->ue_methods->ue_setmulti(ue); } +int +uether_ifmedia_upd(struct ifnet *ifp) +{ + + return (ue_ifmedia_upd(ifp)); +} + static int ue_ifmedia_upd(struct ifnet *ifp) { Modified: stable/8/sys/dev/usb/net/usb_ethernet.h ============================================================================== --- stable/8/sys/dev/usb/net/usb_ethernet.h Mon Jan 2 23:44:07 2012 (r229343) +++ stable/8/sys/dev/usb/net/usb_ethernet.h Mon Jan 2 23:47:51 2012 (r229344) @@ -22,6 +22,8 @@ * 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. + * + * $FreeBSD$ */ #ifndef _USB_ETHERNET_H_ @@ -66,7 +68,7 @@ struct usb_ether_methods { void (*ue_mii_sts)(struct ifnet *, struct ifmediareq *); int (*ue_ioctl)(struct ifnet *, u_long, caddr_t); - + int (*ue_attach_post_sub)(struct usb_ether *); }; struct usb_ether_cfg_task { @@ -110,6 +112,8 @@ struct mii_data *uether_getmii(struct us void *uether_getsc(struct usb_ether *); int uether_ifattach(struct usb_ether *); void uether_ifdetach(struct usb_ether *); +int uether_ifmedia_upd(struct ifnet *); +void uether_init(void *); int uether_ioctl(struct ifnet *, u_long, caddr_t); struct mbuf *uether_newbuf(void); int uether_rxmbuf(struct usb_ether *, struct mbuf *, @@ -119,4 +123,5 @@ int uether_rxbuf(struct usb_ether *, unsigned int, unsigned int); void uether_rxflush(struct usb_ether *); uint8_t uether_is_gone(struct usb_ether *); +void uether_start(struct ifnet *); #endif /* _USB_ETHERNET_H_ */ From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 23:50:33 2012 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 36305106566C; Mon, 2 Jan 2012 23:50:33 +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 1E0988FC15; Mon, 2 Jan 2012 23:50:33 +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 q02NoXFv094547; Mon, 2 Jan 2012 23:50:33 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02NoXH4094544; Mon, 2 Jan 2012 23:50:33 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201022350.q02NoXH4094544@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 2 Jan 2012 23:50:33 +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: r229345 - in stable/8/sys: conf dev/usb/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: Mon, 02 Jan 2012 23:50:33 -0000 Author: yongari Date: Mon Jan 2 23:50:32 2012 New Revision: 229345 URL: http://svn.freebsd.org/changeset/base/229345 Log: MFC r226743: Implement TX/RX checksum offloading support for ASIX AX88772B controller. AX88772B data sheet does not show detailed information about checksum offloading related things. It seems the controller has lots of options to support checksum offloading but I failed to understand why this feature requires so much complex controller configuration and status bits. One of major difference between AX88772B and its predecessor is AX88772B uses a new RX header format when RX checksum offloading is enabled. It also requires the received length of a frame should be multiple of 4. Controller will pad necessary bytes to make the length of received frame to be multiple of 4. It is driver's responsibility to offset this pad bytes. Note, AX88772B could be configured to get partial checksum value in in RX header. This mode uses different RX header format and currently we don't use that fature. This change makes axe(4) use driver specific MII attach handler to override uether(9)'s default MII attach and announce flow-control capability for AX88178/AX88772A/AX88772B to PHY drivers. It seems original AX88772 also supports flow-control but I didn't enable it due to lack of test/access to the controller. The flow-control threshold parameter is loaded from EEPROM and there is no way to override this value without reprogramming EEPROM. For AX88772B, TX/RX IP/TCP/UDP checksum offloading is announced to network stack. IPv6 and PPPoE checksum offloading is also supported by controller but we have no way to take advantage of these features. Driver already knows PHY address so make PHY driver know that information and remove unnecessary PHY address check used in miibus_readreg/miibus_writereg callbacks. Also announce AX88178, AX88772A and AX88772B support VLAN over-sized frame. While I'm here clean up headers and remove axe_start() in axe_init() because the link wouldn't be available right after media change. Modified: stable/8/sys/dev/usb/net/if_axe.c stable/8/sys/dev/usb/net/if_axereg.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/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/usb/net/if_axe.c ============================================================================== --- stable/8/sys/dev/usb/net/if_axe.c Mon Jan 2 23:47:51 2012 (r229344) +++ stable/8/sys/dev/usb/net/if_axe.c Mon Jan 2 23:50:32 2012 (r229345) @@ -76,24 +76,30 @@ __FBSDID("$FreeBSD$"); * http://www.asix.com.tw/FrootAttach/datasheet/AX88772_datasheet_Rev10.pdf */ -#include -#include #include -#include -#include #include -#include #include -#include +#include +#include +#include #include +#include +#include +#include #include -#include +#include +#include #include #include -#include -#include -#include -#include + +#include +#include +#include +#include +#include + +#include +#include #include #include @@ -122,6 +128,8 @@ __FBSDID("$FreeBSD$"); */ #define AXE_178_MAX_FRAME_BURST 1 +#define AXE_CSUM_FEATURES (CSUM_IP | CSUM_TCP | CSUM_UDP) + #ifdef USB_DEBUG static int axe_debug = 0; @@ -186,6 +194,7 @@ static uether_fn_t axe_tick; static uether_fn_t axe_setmulti; static uether_fn_t axe_setpromisc; +static int axe_attach_post_sub(struct usb_ether *); static int axe_ifmedia_upd(struct ifnet *); static void axe_ifmedia_sts(struct ifnet *, struct ifmediareq *); static int axe_cmd(struct axe_softc *, int, int, int, void *); @@ -195,6 +204,11 @@ static void axe_ax88772_phywake(struct a static void axe_ax88772a_init(struct axe_softc *); static void axe_ax88772b_init(struct axe_softc *); static int axe_get_phyno(struct axe_softc *, int); +static int axe_ioctl(struct ifnet *, u_long, caddr_t); +static int axe_rx_frame(struct usb_ether *, struct usb_page_cache *, int); +static int axe_rxeof(struct usb_ether *, struct usb_page_cache *, + unsigned int offset, unsigned int, struct axe_csum_hdr *); +static void axe_csum_cfg(struct usb_ether *); static const struct usb_config axe_config[AXE_N_TRANSFER] = { @@ -266,6 +280,7 @@ MODULE_VERSION(axe, 1); static const struct usb_ether_methods axe_ue_methods = { .ue_attach_post = axe_attach_post, + .ue_attach_post_sub = axe_attach_post_sub, .ue_start = axe_start, .ue_init = axe_init, .ue_stop = axe_stop, @@ -304,9 +319,6 @@ axe_miibus_readreg(device_t dev, int phy uint16_t val; int locked; - if (sc->sc_phyno != phy) - return (0); - locked = mtx_owned(&sc->sc_mtx); if (!locked) AXE_LOCK(sc); @@ -338,10 +350,6 @@ axe_miibus_writereg(device_t dev, int ph int locked; val = htole32(val); - - if (sc->sc_phyno != phy) - return (0); - locked = mtx_owned(&sc->sc_mtx); if (!locked) AXE_LOCK(sc); @@ -372,7 +380,7 @@ axe_miibus_statchg(device_t dev) if (mii == NULL || ifp == NULL || (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) goto done; - + sc->sc_flags &= ~AXE_FLAG_LINK; if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == (IFM_ACTIVE | IFM_AVALID)) { @@ -390,14 +398,23 @@ axe_miibus_statchg(device_t dev) break; } } - + /* Lost link, do nothing. */ if ((sc->sc_flags & AXE_FLAG_LINK) == 0) goto done; - + val = 0; - if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) != 0) + if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) != 0) { val |= AXE_MEDIA_FULL_DUPLEX; + if (AXE_IS_178_FAMILY(sc)) { + if ((IFM_OPTIONS(mii->mii_media_active) & + IFM_ETH_TXPAUSE) != 0) + val |= AXE_178_MEDIA_TXFLOW_CONTROL_EN; + if ((IFM_OPTIONS(mii->mii_media_active) & + IFM_ETH_RXPAUSE) != 0) + val |= AXE_178_MEDIA_RXFLOW_CONTROL_EN; + } + } if (AXE_IS_178_FAMILY(sc)) { val |= AXE_178_MEDIA_RX_EN | AXE_178_MEDIA_MAGIC; if ((sc->sc_flags & AXE_FLAG_178) != 0) @@ -845,6 +862,53 @@ axe_attach_post(struct usb_ether *ue) axe_cmd(sc, AXE_CMD_READ_IPG012, 0, 0, sc->sc_ipgs); } +static int +axe_attach_post_sub(struct usb_ether *ue) +{ + struct axe_softc *sc; + struct ifnet *ifp; + u_int adv_pause; + int error; + + sc = uether_getsc(ue); + ifp = ue->ue_ifp; + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; + ifp->if_start = uether_start; + ifp->if_ioctl = axe_ioctl; + ifp->if_init = uether_init; + IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); + ifp->if_snd.ifq_drv_maxlen = ifqmaxlen; + IFQ_SET_READY(&ifp->if_snd); + + if (AXE_IS_178_FAMILY(sc)) + ifp->if_capabilities |= IFCAP_VLAN_MTU; + if (sc->sc_flags & AXE_FLAG_772B) { + ifp->if_capabilities |= IFCAP_TXCSUM | IFCAP_RXCSUM; + ifp->if_hwassist = AXE_CSUM_FEATURES; + /* + * Checksum offloading of AX88772B also works with VLAN + * tagged frames but there is no way to take advantage + * of the feature because vlan(4) assumes + * IFCAP_VLAN_HWTAGGING is prerequisite condition to + * support checksum offloading with VLAN. VLAN hardware + * tagging support of AX88772B is very limited so it's + * not possible to announce IFCAP_VLAN_HWTAGGING. + */ + } + ifp->if_capenable = ifp->if_capabilities; + if (sc->sc_flags & (AXE_FLAG_772A | AXE_FLAG_772B | AXE_FLAG_178)) + adv_pause = MIIF_DOPAUSE; + else + adv_pause = 0; + mtx_lock(&Giant); + error = mii_attach(ue->ue_dev, &ue->ue_miibus, ifp, + uether_ifmedia_upd, ue->ue_methods->ue_mii_sts, + BMSR_DEFCAPMASK, sc->sc_phyno, MII_OFFSET_ANY, adv_pause); + mtx_unlock(&Giant); + + return (error); +} + /* * Probe for a AX88172 chip. */ @@ -930,52 +994,15 @@ axe_bulk_read_callback(struct usb_xfer * { struct axe_softc *sc = usbd_xfer_softc(xfer); struct usb_ether *ue = &sc->sc_ue; - struct ifnet *ifp = uether_getifp(ue); - struct axe_sframe_hdr hdr; struct usb_page_cache *pc; - int err, pos, len; int actlen; usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL); switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: - pos = 0; - len = 0; - err = 0; - pc = usbd_xfer_get_frame(xfer, 0); - if (AXE_IS_178_FAMILY(sc)) { - while (pos < actlen) { - if ((pos + sizeof(hdr)) > actlen) { - /* too little data */ - err = EINVAL; - break; - } - usbd_copy_out(pc, pos, &hdr, sizeof(hdr)); - - if ((hdr.len ^ hdr.ilen) != 0xFFFF) { - /* we lost sync */ - err = EINVAL; - break; - } - pos += sizeof(hdr); - - len = le16toh(hdr.len); - if ((pos + len) > actlen) { - /* invalid length */ - err = EINVAL; - break; - } - uether_rxbuf(ue, pc, pos, len); - - pos += len + (len % 2); - } - } else - uether_rxbuf(ue, pc, 0, actlen); - - if (err != 0) - ifp->if_ierrors++; + axe_rx_frame(ue, pc, actlen); /* FALLTHROUGH */ case USB_ST_SETUP: @@ -998,6 +1025,131 @@ tr_setup: } } +static int +axe_rx_frame(struct usb_ether *ue, struct usb_page_cache *pc, int actlen) +{ + struct axe_softc *sc; + struct axe_sframe_hdr hdr; + struct axe_csum_hdr csum_hdr; + int error, len, pos; + + sc = uether_getsc(ue); + pos = 0; + len = 0; + error = 0; + if ((sc->sc_flags & AXE_FLAG_STD_FRAME) != 0) { + while (pos < actlen) { + if ((pos + sizeof(hdr)) > actlen) { + /* too little data */ + error = EINVAL; + break; + } + usbd_copy_out(pc, pos, &hdr, sizeof(hdr)); + + if ((hdr.len ^ hdr.ilen) != sc->sc_lenmask) { + /* we lost sync */ + error = EINVAL; + break; + } + pos += sizeof(hdr); + len = le16toh(hdr.len); + if (pos + len > actlen) { + /* invalid length */ + error = EINVAL; + break; + } + axe_rxeof(ue, pc, pos, len, NULL); + pos += len + (len % 2); + } + } else if ((sc->sc_flags & AXE_FLAG_CSUM_FRAME) != 0) { + while (pos < actlen) { + if ((pos + sizeof(csum_hdr)) > actlen) { + /* too little data */ + error = EINVAL; + break; + } + usbd_copy_out(pc, pos, &csum_hdr, sizeof(csum_hdr)); + + csum_hdr.len = le16toh(csum_hdr.len); + csum_hdr.ilen = le16toh(csum_hdr.ilen); + csum_hdr.cstatus = le16toh(csum_hdr.cstatus); + if ((AXE_CSUM_RXBYTES(csum_hdr.len) ^ + AXE_CSUM_RXBYTES(csum_hdr.ilen)) != + sc->sc_lenmask) { + /* we lost sync */ + error = EINVAL; + break; + } + /* + * Get total transferred frame length including + * checksum header. The length should be multiple + * of 4. + */ + len = sizeof(csum_hdr) + AXE_CSUM_RXBYTES(csum_hdr.len); + len = (len + 3) & ~3; + if (pos + len > actlen) { + /* invalid length */ + error = EINVAL; + break; + } + axe_rxeof(ue, pc, pos + sizeof(csum_hdr), + AXE_CSUM_RXBYTES(csum_hdr.len), &csum_hdr); + pos += len; + } + } else + axe_rxeof(ue, pc, 0, actlen, NULL); + + if (error != 0) + ue->ue_ifp->if_ierrors++; + return (error); +} + +static int +axe_rxeof(struct usb_ether *ue, struct usb_page_cache *pc, unsigned int offset, + unsigned int len, struct axe_csum_hdr *csum_hdr) +{ + struct ifnet *ifp = ue->ue_ifp; + struct mbuf *m; + + if (len < ETHER_HDR_LEN || len > MCLBYTES - ETHER_ALIGN) { + ifp->if_ierrors++; + return (EINVAL); + } + + m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + if (m == NULL) { + ifp->if_iqdrops++; + return (ENOMEM); + } + m->m_len = m->m_pkthdr.len = MCLBYTES; + m_adj(m, ETHER_ALIGN); + + usbd_copy_out(pc, offset, mtod(m, uint8_t *), len); + + ifp->if_ipackets++; + m->m_pkthdr.rcvif = ifp; + m->m_pkthdr.len = m->m_len = len; + + if (csum_hdr != NULL && csum_hdr->cstatus & AXE_CSUM_HDR_L3_TYPE_IPV4) { + if ((csum_hdr->cstatus & (AXE_CSUM_HDR_L4_CSUM_ERR | + AXE_CSUM_HDR_L3_CSUM_ERR)) == 0) { + m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED | + CSUM_IP_VALID; + if ((csum_hdr->cstatus & AXE_CSUM_HDR_L4_TYPE_MASK) == + AXE_CSUM_HDR_L4_TYPE_TCP || + (csum_hdr->cstatus & AXE_CSUM_HDR_L4_TYPE_MASK) == + AXE_CSUM_HDR_L4_TYPE_UDP) { + m->m_pkthdr.csum_flags |= + CSUM_DATA_VALID | CSUM_PSEUDO_HDR; + m->m_pkthdr.csum_data = 0xffff; + } + } + } + + _IF_ENQUEUE(&ue->ue_rxq, m); + return (0); +} + #if ((AXE_BULK_BUF_SIZE >= 0x10000) || (AXE_BULK_BUF_SIZE < (MCLBYTES+4))) #error "Please update axe_bulk_write_callback()!" #endif @@ -1040,6 +1192,21 @@ tr_setup: if (AXE_IS_178_FAMILY(sc)) { hdr.len = htole16(m->m_pkthdr.len); hdr.ilen = ~hdr.len; + /* + * If upper stack computed checksum, driver + * should tell controller not to insert + * computed checksum for checksum offloading + * enabled controller. + */ + if (ifp->if_capabilities & IFCAP_TXCSUM) { + if ((m->m_pkthdr.csum_flags & + AXE_CSUM_FEATURES) != 0) + hdr.len |= htole16( + AXE_TX_CSUM_PSEUDO_HDR); + else + hdr.len |= htole16( + AXE_TX_CSUM_DIS); + } usbd_copy_in(pc, pos, &hdr, sizeof(hdr)); pos += sizeof(hdr); usbd_m_copy_in(pc, pos, m, 0, m->m_pkthdr.len); @@ -1131,6 +1298,34 @@ axe_start(struct usb_ether *ue) } static void +axe_csum_cfg(struct usb_ether *ue) +{ + struct axe_softc *sc; + struct ifnet *ifp; + uint16_t csum1, csum2; + + sc = uether_getsc(ue); + AXE_LOCK_ASSERT(sc, MA_OWNED); + + if ((sc->sc_flags & AXE_FLAG_772B) != 0) { + ifp = uether_getifp(ue); + csum1 = 0; + csum2 = 0; + if ((ifp->if_capenable & IFCAP_TXCSUM) != 0) + csum1 |= AXE_TXCSUM_IP | AXE_TXCSUM_TCP | + AXE_TXCSUM_UDP; + axe_cmd(sc, AXE_772B_CMD_WRITE_TXCSUM, csum2, csum1, NULL); + csum1 = 0; + csum2 = 0; + if ((ifp->if_capenable & IFCAP_RXCSUM) != 0) + csum1 |= AXE_RXCSUM_IP | AXE_RXCSUM_IPVE | + AXE_RXCSUM_TCP | AXE_RXCSUM_UDP | AXE_RXCSUM_ICMP | + AXE_RXCSUM_IGMP; + axe_cmd(sc, AXE_772B_CMD_WRITE_RXCSUM, csum2, csum1, NULL); + } +} + +static void axe_init(struct usb_ether *ue) { struct axe_softc *sc = uether_getsc(ue); @@ -1147,27 +1342,40 @@ axe_init(struct usb_ether *ue) axe_reset(sc); - /* Set MAC address. */ - if (AXE_IS_178_FAMILY(sc)) + /* Set MAC address and transmitter IPG values. */ + if (AXE_IS_178_FAMILY(sc)) { axe_cmd(sc, AXE_178_CMD_WRITE_NODEID, 0, 0, IF_LLADDR(ifp)); - else - axe_cmd(sc, AXE_172_CMD_WRITE_NODEID, 0, 0, IF_LLADDR(ifp)); - - /* Set transmitter IPG values */ - if (AXE_IS_178_FAMILY(sc)) axe_cmd(sc, AXE_178_CMD_WRITE_IPG012, sc->sc_ipgs[2], (sc->sc_ipgs[1] << 8) | (sc->sc_ipgs[0]), NULL); - else { + } else { + axe_cmd(sc, AXE_172_CMD_WRITE_NODEID, 0, 0, IF_LLADDR(ifp)); axe_cmd(sc, AXE_172_CMD_WRITE_IPG0, 0, sc->sc_ipgs[0], NULL); axe_cmd(sc, AXE_172_CMD_WRITE_IPG1, 0, sc->sc_ipgs[1], NULL); axe_cmd(sc, AXE_172_CMD_WRITE_IPG2, 0, sc->sc_ipgs[2], NULL); } - /* AX88772B uses different maximum frame burst configuration. */ - if (sc->sc_flags & AXE_FLAG_772B) + if (AXE_IS_178_FAMILY(sc)) { + sc->sc_flags &= ~(AXE_FLAG_STD_FRAME | AXE_FLAG_CSUM_FRAME); + if ((sc->sc_flags & AXE_FLAG_772B) != 0) + sc->sc_lenmask = AXE_CSUM_HDR_LEN_MASK; + else + sc->sc_lenmask = AXE_HDR_LEN_MASK; + if ((sc->sc_flags & AXE_FLAG_772B) != 0 && + (ifp->if_capenable & IFCAP_RXCSUM) != 0) + sc->sc_flags |= AXE_FLAG_CSUM_FRAME; + else + sc->sc_flags |= AXE_FLAG_STD_FRAME; + } + + /* Configure TX/RX checksum offloading. */ + axe_csum_cfg(ue); + + if (sc->sc_flags & AXE_FLAG_772B) { + /* AX88772B uses different maximum frame burst configuration. */ axe_cmd(sc, AXE_772B_CMD_RXCTL_WRITE_CFG, ax88772b_mfb_table[AX88772B_MFB_16K].threshold, ax88772b_mfb_table[AX88772B_MFB_16K].byte_cnt, NULL); + } /* Enable receiver, set RX mode. */ rxmode = (AXE_RXCMD_MULTICAST | AXE_RXCMD_ENABLE); @@ -1175,11 +1383,17 @@ axe_init(struct usb_ether *ue) if (sc->sc_flags & AXE_FLAG_772B) { /* * Select RX header format type 1. Aligning IP - * header on 4 byte boundary is not needed + * header on 4 byte boundary is not needed when + * checksum offloading feature is not used * because we always copy the received frame in - * RX handler. + * RX handler. When RX checksum offloading is + * active, aligning IP header is required to + * reflect actual frame length including RX + * header size. */ rxmode |= AXE_772B_RXCMD_HDR_TYPE_1; + if ((ifp->if_capenable & IFCAP_RXCSUM) != 0) + rxmode |= AXE_772B_RXCMD_IPHDR_ALIGN; } else { /* * Default Rx buffer size is too small to get @@ -1208,7 +1422,6 @@ axe_init(struct usb_ether *ue) ifp->if_drv_flags |= IFF_DRV_RUNNING; /* Switch to selected media. */ axe_ifmedia_upd(ifp); - axe_start(ue); } static void @@ -1250,3 +1463,45 @@ axe_stop(struct usb_ether *ue) usbd_transfer_stop(sc->sc_xfer[AXE_BULK_DT_WR]); usbd_transfer_stop(sc->sc_xfer[AXE_BULK_DT_RD]); } + +static int +axe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) +{ + struct usb_ether *ue = ifp->if_softc; + struct axe_softc *sc; + struct ifreq *ifr; + int error, mask, reinit; + + sc = uether_getsc(ue); + ifr = (struct ifreq *)data; + error = 0; + reinit = 0; + if (cmd == SIOCSIFCAP) { + AXE_LOCK(sc); + mask = ifr->ifr_reqcap ^ ifp->if_capenable; + if ((mask & IFCAP_TXCSUM) != 0 && + (ifp->if_capabilities & IFCAP_TXCSUM) != 0) { + ifp->if_capenable ^= IFCAP_TXCSUM; + if ((ifp->if_capenable & IFCAP_TXCSUM) != 0) + ifp->if_hwassist |= AXE_CSUM_FEATURES; + else + ifp->if_hwassist &= ~AXE_CSUM_FEATURES; + reinit++; + } + if ((mask & IFCAP_RXCSUM) != 0 && + (ifp->if_capabilities & IFCAP_RXCSUM) != 0) { + ifp->if_capenable ^= IFCAP_RXCSUM; + reinit++; + } + if (reinit > 0 && ifp->if_drv_flags & IFF_DRV_RUNNING) + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + else + reinit = 0; + AXE_UNLOCK(sc); + if (reinit > 0) + uether_init(ue); + } else + error = uether_ioctl(ifp, cmd, data); + + return (error); +} Modified: stable/8/sys/dev/usb/net/if_axereg.h ============================================================================== --- stable/8/sys/dev/usb/net/if_axereg.h Mon Jan 2 23:47:51 2012 (r229344) +++ stable/8/sys/dev/usb/net/if_axereg.h Mon Jan 2 23:50:32 2012 (r229345) @@ -97,6 +97,10 @@ #define AXE_CMD_WRITE_VLAN_CTRL 0x4028 #define AXE_772B_CMD_RXCTL_WRITE_CFG 0x012A +#define AXE_772B_CMD_READ_RXCSUM 0x002B +#define AXE_772B_CMD_WRITE_RXCSUM 0x012C +#define AXE_772B_CMD_READ_TXCSUM 0x002D +#define AXE_772B_CMD_WRITE_TXCSUM 0x012E #define AXE_SW_RESET_CLEAR 0x00 #define AXE_SW_RESET_RR 0x01 @@ -199,6 +203,40 @@ #define AXE_VLAN_CTRL_VID1_MASK 0x00000FFF #define AXE_VLAN_CTRL_VID2_MASK 0x0FFF0000 +#define AXE_RXCSUM_IP 0x0001 +#define AXE_RXCSUM_IPVE 0x0002 +#define AXE_RXCSUM_IPV6E 0x0004 +#define AXE_RXCSUM_TCP 0x0008 +#define AXE_RXCSUM_UDP 0x0010 +#define AXE_RXCSUM_ICMP 0x0020 +#define AXE_RXCSUM_IGMP 0x0040 +#define AXE_RXCSUM_ICMP6 0x0080 +#define AXE_RXCSUM_TCPV6 0x0100 +#define AXE_RXCSUM_UDPV6 0x0200 +#define AXE_RXCSUM_ICMPV6 0x0400 +#define AXE_RXCSUM_IGMPV6 0x0800 +#define AXE_RXCSUM_ICMP6V6 0x1000 +#define AXE_RXCSUM_FOPC 0x8000 + +#define AXE_RXCSUM_64TE 0x0100 +#define AXE_RXCSUM_PPPOE 0x0200 +#define AXE_RXCSUM_RPCE 0x8000 + +#define AXE_TXCSUM_IP 0x0001 +#define AXE_TXCSUM_TCP 0x0002 +#define AXE_TXCSUM_UDP 0x0004 +#define AXE_TXCSUM_ICMP 0x0008 +#define AXE_TXCSUM_IGMP 0x0010 +#define AXE_TXCSUM_ICMP6 0x0020 +#define AXE_TXCSUM_TCPV6 0x0100 +#define AXE_TXCSUM_UDPV6 0x0200 +#define AXE_TXCSUM_ICMPV6 0x0400 +#define AXE_TXCSUM_IGMPV6 0x0800 +#define AXE_TXCSUM_ICMP6V6 0x1000 + +#define AXE_TXCSUM_64TE 0x0001 +#define AXE_TXCSUM_PPPOE 0x0002 + #define AXE_BULK_BUF_SIZE 16384 /* bytes */ #define AXE_CTL_READ 0x01 @@ -227,9 +265,62 @@ struct ax88772b_mfb { struct axe_sframe_hdr { uint16_t len; +#define AXE_HDR_LEN_MASK 0xFFFF + uint16_t ilen; +} __packed; + +#define AXE_TX_CSUM_PSEUDO_HDR 0x4000 +#define AXE_TX_CSUM_DIS 0x8000 + +/* + * When RX checksum offloading is enabled, AX88772B uses new RX header + * format and it's not compatible with previous RX header format. In + * addition, IP header align option should be enabled to get correct + * frame size including RX header. Total transferred size including + * the RX header is multiple of 4 and controller will pad necessary + * bytes if the length is not multiple of 4. + * This driver does not enable partial checksum feature which will + * compute 16bit checksum from 14th byte to the end of the frame. If + * this feature is enabled, computed checksum value is embedded into + * RX header which in turn means it uses different RX header format. + */ +struct axe_csum_hdr { + uint16_t len; +#define AXE_CSUM_HDR_LEN_MASK 0x07FF +#define AXE_CSUM_HDR_CRC_ERR 0x1000 +#define AXE_CSUM_HDR_MII_ERR 0x2000 +#define AXE_CSUM_HDR_RUNT 0x4000 +#define AXE_CSUM_HDR_BMCAST 0x8000 uint16_t ilen; + uint16_t cstatus; +#define AXE_CSUM_HDR_VLAN_MASK 0x0007 +#define AXE_CSUM_HDR_VLAN_STRIP 0x0008 +#define AXE_CSUM_HDR_VLAN_PRI_MASK 0x0070 +#define AXE_CSUM_HDR_L4_CSUM_ERR 0x0100 +#define AXE_CSUM_HDR_L3_CSUM_ERR 0x0200 +#define AXE_CSUM_HDR_L4_TYPE_UDP 0x0400 +#define AXE_CSUM_HDR_L4_TYPE_ICMP 0x0800 +#define AXE_CSUM_HDR_L4_TYPE_IGMP 0x0C00 +#define AXE_CSUM_HDR_L4_TYPE_TCP 0x1000 +#define AXE_CSUM_HDR_L4_TYPE_TCPV6 0x1400 +#define AXE_CSUM_HDR_L4_TYPE_MASK 0x1C00 +#define AXE_CSUM_HDR_L3_TYPE_IPV4 0x2000 +#define AXE_CSUM_HDR_L3_TYPE_IPV6 0x4000 + +#ifdef AXE_APPEND_PARTIAL_CSUM + /* + * These members present only when partial checksum + * offloading is enabled. The checksum value is simple + * 16bit sum of received frame starting at offset 14 of + * the frame to the end of the frame excluding FCS bytes. + */ + uint16_t csum_value; + uint16_t dummy; +#endif } __packed; +#define AXE_CSUM_RXBYTES(x) ((x) & AXE_CSUM_HDR_LEN_MASK) + #define GET_MII(sc) uether_getmii(&(sc)->sc_ue) /* The interrupt endpoint is currently unused by the ASIX part. */ @@ -247,6 +338,8 @@ struct axe_softc { int sc_flags; #define AXE_FLAG_LINK 0x0001 +#define AXE_FLAG_STD_FRAME 0x0010 +#define AXE_FLAG_CSUM_FRAME 0x0020 #define AXE_FLAG_772 0x1000 /* AX88772 */ #define AXE_FLAG_772A 0x2000 /* AX88772A */ #define AXE_FLAG_772B 0x4000 /* AX88772B */ @@ -255,6 +348,7 @@ struct axe_softc { uint8_t sc_ipgs[3]; uint8_t sc_phyaddrs[2]; uint16_t sc_pwrcfg; + uint16_t sc_lenmask; int sc_tx_bufsz; }; From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 23:50:56 2012 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 6ABF2106568C; Mon, 2 Jan 2012 23:50:56 +0000 (UTC) (envelope-from kensmith@buffalo.edu) Received: from localmailB.acsu.buffalo.edu (localmailb.acsu.buffalo.edu [128.205.5.200]) by mx1.freebsd.org (Postfix) with ESMTP id 229968FC16; Mon, 2 Jan 2012 23:50:55 +0000 (UTC) Received: from localmailB.acsu.buffalo.edu (localhost [127.0.0.1]) by localhost (Postfix) with SMTP id 556102E9EC; Mon, 2 Jan 2012 18:33:21 -0500 (EST) Received: from localmailB.acsu.buffalo.edu (localhost [127.0.0.1]) by localmailB.acsu.buffalo.edu (Postfix) with ESMTP id C1A335EE7; Mon, 2 Jan 2012 18:33:18 -0500 (EST) Received: from smtp3.acsu.buffalo.edu (smtp3.acsu.buffalo.edu [128.205.5.226]) by localmailB.acsu.buffalo.edu (Prefixe) with ESMTP id 7161F2E9EC; Mon, 2 Jan 2012 18:33:18 -0500 (EST) Received: from [192.168.1.101] (cpe-72-231-248-9.buffalo.res.rr.com [72.231.248.9]) (Authenticated sender: kensmith@buffalo.edu) by smtp3.acsu.buffalo.edu (Postfix) with ESMTPSA id A76BF49A45; Mon, 2 Jan 2012 18:33:17 -0500 (EST) From: Ken Smith To: "Luchesar V. ILIEV" In-Reply-To: <4F022EE5.1040100@gmail.com> References: <201201021842.q02IgT5T080547@svn.freebsd.org> <4F022EE5.1040100@gmail.com> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-RBOHfbqZj6Pvc/OPuo8g" Organization: U. Buffalo Date: Mon, 02 Jan 2012 18:33:16 -0500 Message-ID: <1325547196.1710.18.camel@neo.cse.buffalo.edu> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port X-PM-EL-Spam-Prob: XX: 28% Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org, Ken Smith Subject: Re: svn commit: r229304 - stable/9/usr.sbin/pkg_install/add 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, 02 Jan 2012 23:50:56 -0000 --=-RBOHfbqZj6Pvc/OPuo8g Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable On Tue, 2012-01-03 at 00:25 +0200, Luchesar V. ILIEV wrote: > On 02/01/2012 20:42, Ken Smith wrote: > > Author: kensmith > > Date: Mon Jan 2 18:42:29 2012 > > New Revision: 229304 > > URL: http://svn.freebsd.org/changeset/base/229304 > > > > Log: > > The portion of r225757 that added the packages-9.0-release directory > > was supposed to be MFCed closer to the release but that got missed. > > > > Pointy hat: kensmith > > > > Modified: > > stable/9/usr.sbin/pkg_install/add/main.c > > > > Modified: stable/9/usr.sbin/pkg_install/add/main.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 > > --- stable/9/usr.sbin/pkg_install/add/main.c Mon Jan 2 18:06:48 2012 (= r229303) > > +++ stable/9/usr.sbin/pkg_install/add/main.c Mon Jan 2 18:42:29 2012 (= r229304) > > @@ -87,6 +87,7 @@ struct { > > { 800000, 800499, "/packages-8.0-release" }, > > { 801000, 801499, "/packages-8.1-release" }, > > { 802000, 802499, "/packages-8.2-release" }, > > + { 900000, 900499, "/packages-9.0-release" }, > > { 300000, 399000, "/packages-3-stable" }, > > { 400000, 499000, "/packages-4-stable" }, > > { 502100, 502128, "/packages-5-current" }, >=20 > Apologies if I'm getting it wrong, but shouldn't the following be MFCed= =20 > too, as noted in PR 162490? >=20 > { 600100, 699000, "/packages-6-stable" }, > { 700100, 799000, "/packages-7-stable" }, > { 800500, 899000, "/packages-8-stable" }, > - { 900000, 999000, "/packages-9-current" }, > + { 900500, 999000, "/packages-9-stable" }, > + { 1000000, 1099000, "/packages-10-current" }, > { 0, 9999999, "/packages-current" }, > { 0, 0, NULL } > }; >=20 > http://www.freebsd.org/cgi/query-pr.cgi?pr=3D162490 >=20 > Cheers, > Luchesar >=20 I'll fix up that and a few more things in stable/9 shortly. This commit was aimed more at the bare minimum needed for releng/9.0. The X.0 releases are always a bit weird when it comes to pieces of what's above. We usually don't release stable/X from code freeze before the release is announced, and that's when for example 900500 would get created. I created it today before the release announcement because we'd released stable/9 from code freeze earlier than we normally do. In other words I probably could have done it but it doesn't hurt that I didn't. --=20 Ken Smith - From there to here, from here to | kensmith@buffalo.edu there, funny things are everywhere. | - Theodore Geisel | --=-RBOHfbqZj6Pvc/OPuo8g Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEABECAAYFAk8CPrwACgkQ/G14VSmup/a2JACfcAZm2j+j+TFkisBzkAWLu4hU XvMAoIIp4t08cLTUjFXDxNoB/+PhrpF0 =5iJm -----END PGP SIGNATURE----- --=-RBOHfbqZj6Pvc/OPuo8g-- From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 23:52:20 2012 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 BCFF4106566C; Mon, 2 Jan 2012 23:52:20 +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 A6E598FC12; Mon, 2 Jan 2012 23:52:20 +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 q02NqKvk094660; Mon, 2 Jan 2012 23:52:20 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02NqKup094658; Mon, 2 Jan 2012 23:52:20 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201022352.q02NqKup094658@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 2 Jan 2012 23:52:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229346 - stable/9/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: Mon, 02 Jan 2012 23:52:20 -0000 Author: yongari Date: Mon Jan 2 23:52:20 2012 New Revision: 229346 URL: http://svn.freebsd.org/changeset/base/229346 Log: MFC r226744: AX88178/AX88772A/AX88772B supports VLAN over-sized frame. Xr vlan. Modified: stable/9/share/man/man4/axe.4 Directory Properties: stable/9/share/man/man4/ (props changed) Modified: stable/9/share/man/man4/axe.4 ============================================================================== --- stable/9/share/man/man4/axe.4 Mon Jan 2 23:50:32 2012 (r229345) +++ stable/9/share/man/man4/axe.4 Mon Jan 2 23:52:20 2012 (r229346) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 14, 2011 +.Dd October 25, 2011 .Dt AXE 4 .Os .Sh NAME @@ -238,6 +238,7 @@ The driver failed to allocate an mbuf fo .Xr netintro 4 , .Xr ng_ether 4 , .Xr rgephy 4 , +.Xr vlan 4 , .Xr ifconfig 8 .Rs .%T "ASIX AX88x7x and AX88760 data sheets" From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 23:52:33 2012 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 557C110656F0; Mon, 2 Jan 2012 23:52:33 +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 3FC638FC13; Mon, 2 Jan 2012 23:52:33 +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 q02NqX95094701; Mon, 2 Jan 2012 23:52:33 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02NqXjD094699; Mon, 2 Jan 2012 23:52:33 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201022352.q02NqXjD094699@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 2 Jan 2012 23:52:33 +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: r229347 - 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: Mon, 02 Jan 2012 23:52:33 -0000 Author: yongari Date: Mon Jan 2 23:52:32 2012 New Revision: 229347 URL: http://svn.freebsd.org/changeset/base/229347 Log: MFC r226744: AX88178/AX88772A/AX88772B supports VLAN over-sized frame. Xr vlan. Modified: stable/8/share/man/man4/axe.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/axe.4 ============================================================================== --- stable/8/share/man/man4/axe.4 Mon Jan 2 23:52:20 2012 (r229346) +++ stable/8/share/man/man4/axe.4 Mon Jan 2 23:52:32 2012 (r229347) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 14, 2011 +.Dd October 25, 2011 .Dt AXE 4 .Os .Sh NAME @@ -238,6 +238,7 @@ The driver failed to allocate an mbuf fo .Xr netintro 4 , .Xr ng_ether 4 , .Xr rgephy 4 , +.Xr vlan 4 , .Xr ifconfig 8 .Rs .%T "ASIX AX88x7x and AX88760 data sheets" From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 23:53:26 2012 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 911F61065679; Mon, 2 Jan 2012 23:53:26 +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 7B4358FC15; Mon, 2 Jan 2012 23:53: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 q02NrQJ1094785; Mon, 2 Jan 2012 23:53:26 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02NrQaT094783; Mon, 2 Jan 2012 23:53:26 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201022353.q02NrQaT094783@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 2 Jan 2012 23:53:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229348 - stable/9/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: Mon, 02 Jan 2012 23:53:26 -0000 Author: yongari Date: Mon Jan 2 23:53:26 2012 New Revision: 229348 URL: http://svn.freebsd.org/changeset/base/229348 Log: MFC r226745: axe(4) got VLAN over-sized frame support. Add axe(4) to the list of interfaces that support VLAN over-sized frame. Modified: stable/9/share/man/man4/vlan.4 Directory Properties: stable/9/share/man/man4/ (props changed) Modified: stable/9/share/man/man4/vlan.4 ============================================================================== --- stable/9/share/man/man4/vlan.4 Mon Jan 2 23:52:32 2012 (r229347) +++ stable/9/share/man/man4/vlan.4 Mon Jan 2 23:53:26 2012 (r229348) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 30, 2010 +.Dd October 25, 2011 .Dt VLAN 4 .Os .Sh NAME @@ -166,6 +166,7 @@ filtering that breaks the Path MTU Disco The following interfaces support long frames for .Nm natively: +.Xr axe 4 , .Xr bfe 4 , .Xr cas 4 , .Xr dc 4 , From owner-svn-src-all@FreeBSD.ORG Mon Jan 2 23:53:36 2012 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 CCB03106568D; Mon, 2 Jan 2012 23:53:36 +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 B6A878FC1C; Mon, 2 Jan 2012 23:53:36 +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 q02Nrag2094825; Mon, 2 Jan 2012 23:53:36 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q02NraE7094823; Mon, 2 Jan 2012 23:53:36 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201022353.q02NraE7094823@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 2 Jan 2012 23:53:36 +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: r229349 - 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: Mon, 02 Jan 2012 23:53:36 -0000 Author: yongari Date: Mon Jan 2 23:53:36 2012 New Revision: 229349 URL: http://svn.freebsd.org/changeset/base/229349 Log: MFC r226745: axe(4) got VLAN over-sized frame support. Add axe(4) to the list of interfaces that support VLAN over-sized frame. Modified: stable/8/share/man/man4/vlan.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/vlan.4 ============================================================================== --- stable/8/share/man/man4/vlan.4 Mon Jan 2 23:53:26 2012 (r229348) +++ stable/8/share/man/man4/vlan.4 Mon Jan 2 23:53:36 2012 (r229349) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 30, 2010 +.Dd October 25, 2011 .Dt VLAN 4 .Os .Sh NAME @@ -166,6 +166,7 @@ filtering that breaks the Path MTU Disco The following interfaces support long frames for .Nm natively: +.Xr axe 4 , .Xr bfe 4 , .Xr cas 4 , .Xr dc 4 , From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 00:07:49 2012 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 79AA1106566B; Tue, 3 Jan 2012 00:07:49 +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 637898FC14; Tue, 3 Jan 2012 00:07: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 q0307nY9095603; Tue, 3 Jan 2012 00:07:49 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0307nrh095600; Tue, 3 Jan 2012 00:07:49 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201030007.q0307nrh095600@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 00:07:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229350 - stable/9/sys/dev/bge 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, 03 Jan 2012 00:07:49 -0000 Author: yongari Date: Tue Jan 3 00:07:49 2012 New Revision: 229350 URL: http://svn.freebsd.org/changeset/base/229350 Log: MFC r226749,226770,226804-226807: r226749: Whitespace nits. r226770: Fix long standing bge_sysctl_debug_info() issues. o Protect bge(4) status block access and register dump with driver lock. o Add missing bus_dmamap_sync() before dumping status block. o Use minimum status block size, 32 bytes, for status block dump on most controllers except BCM5700 AX/BX. While I'm here, make the handler show 5717 Plus in hardware flags. r226804: Make CPMU handle GPHY power down control on controllers that have CPMU capability. r226805: It is known that all Broadcom controllers have 4GB boundary DMA bug. Apply workaround to all controllers. r226806: Broadcom says BCM5755 or higher and BCM5906 have short DMA bug. Apply workaround to these controllers. r226807: BCM5719 cannot handle DMA requests for DMA segments that have larger than 4KB in size. However the maximum DMA segment size created in DMA tag is 4KB, so we wouldn't encounter the issue here. Just record this issue such that let developers not to create a DMA segment that is larger than 4KB for BCM5719. It's possible to split a DMA segment into multiple smaller ones in run time but I believe it's not worth to implement that. Modified: stable/9/sys/dev/bge/if_bge.c stable/9/sys/dev/bge/if_bgereg.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/bge/if_bge.c ============================================================================== --- stable/9/sys/dev/bge/if_bge.c Mon Jan 2 23:53:36 2012 (r229349) +++ stable/9/sys/dev/bge/if_bge.c Tue Jan 3 00:07:49 2012 (r229350) @@ -2824,7 +2824,6 @@ bge_attach(device_t dev) switch (sc->bge_asicrev) { case BGE_ASICREV_BCM5717: case BGE_ASICREV_BCM5719: - sc->bge_flags |= BGE_FLAG_SHORT_DMA_BUG; case BGE_ASICREV_BCM57765: sc->bge_flags |= BGE_FLAG_5717_PLUS | BGE_FLAG_5755_PLUS | BGE_FLAG_575X_PLUS | BGE_FLAG_5705_PLUS | BGE_FLAG_JUMBO | @@ -2859,8 +2858,6 @@ bge_attach(device_t dev) case BGE_ASICREV_BCM5752: case BGE_ASICREV_BCM5906: sc->bge_flags |= BGE_FLAG_575X_PLUS; - if (sc->bge_asicrev == BGE_ASICREV_BCM5906) - sc->bge_flags |= BGE_FLAG_SHORT_DMA_BUG; /* FALLTHROUGH */ case BGE_ASICREV_BCM5705: sc->bge_flags |= BGE_FLAG_5705_PLUS; @@ -2914,15 +2911,26 @@ bge_attach(device_t dev) sc->bge_mi_mode |= BGE_MIMODE_AUTOPOLL; /* - * All controllers that are not 5755 or higher have 4GB - * boundary DMA bug. + * All Broadcom controllers have 4GB boundary DMA bug. * Whenever an address crosses a multiple of the 4GB boundary * (including 4GB, 8Gb, 12Gb, etc.) and makes the transition * from 0xX_FFFF_FFFF to 0x(X+1)_0000_0000 an internal DMA * state machine will lockup and cause the device to hang. */ - if (BGE_IS_5755_PLUS(sc) == 0) - sc->bge_flags |= BGE_FLAG_4G_BNDRY_BUG; + sc->bge_flags |= BGE_FLAG_4G_BNDRY_BUG; + + /* BCM5755 or higher and BCM5906 have short DMA bug. */ + if (BGE_IS_5755_PLUS(sc) || sc->bge_asicrev == BGE_ASICREV_BCM5906) + sc->bge_flags |= BGE_FLAG_SHORT_DMA_BUG; + + /* + * BCM5719 cannot handle DMA requests for DMA segments that + * have larger than 4KB in size. However the maximum DMA + * segment size created in DMA tag is 4KB for TSO, so we + * wouldn't encounter the issue here. + */ + if (sc->bge_asicrev == BGE_ASICREV_BCM5719) + sc->bge_flags |= BGE_FLAG_4K_RDMA_BUG; misccfg = CSR_READ_4(sc, BGE_MISC_CFG) & BGE_MISCCFG_BOARD_ID; if (sc->bge_asicrev == BGE_ASICREV_BCM5705) { @@ -2981,9 +2989,9 @@ bge_attach(device_t dev) sc->bge_flags |= BGE_FLAG_TSO; } - /* + /* * Check if this is a PCI-X or PCI Express device. - */ + */ if (pci_find_cap(dev, PCIY_EXPRESS, ®) == 0) { /* * Found a PCI Express capabilities register, this @@ -3442,7 +3450,8 @@ bge_reset(struct bge_softc *sc) * Set GPHY Power Down Override to leave GPHY * powered up in D0 uninitialized. */ - if (BGE_IS_5705_PLUS(sc)) + if (BGE_IS_5705_PLUS(sc) && + (sc->bge_flags & BGE_FLAG_CPMU_PRESENT) == 0) reset |= BGE_MISCCFG_GPHY_PD_OVERRIDE; /* Issue global reset */ @@ -3991,7 +4000,7 @@ bge_intr_task(void *arg, int pending) if (ifp->if_drv_flags & IFF_DRV_RUNNING) { /* Check TX ring producer/consumer. */ bge_txeof(sc, tx_cons); - if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) bge_start_locked(ifp); } BGE_UNLOCK(sc); @@ -4108,7 +4117,7 @@ bge_tick(void *xsc) /* Synchronize with possible callout reset/stop. */ if (callout_pending(&sc->bge_stat_ch) || !callout_active(&sc->bge_stat_ch)) - return; + return; if (BGE_IS_5705_PLUS(sc)) bge_stats_update_regs(sc); @@ -5032,7 +5041,7 @@ bge_ioctl(struct ifnet *ifp, u_long comm break; } } else if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ETHERMTU) { - error = EINVAL; + error = EINVAL; break; } BGE_LOCK(sc); @@ -5793,8 +5802,7 @@ bge_sysctl_debug_info(SYSCTL_HANDLER_ARG { struct bge_softc *sc; uint16_t *sbdata; - int error; - int result; + int error, result, sbsz; int i, j; result = -1; @@ -5805,14 +5813,21 @@ bge_sysctl_debug_info(SYSCTL_HANDLER_ARG if (result == 1) { sc = (struct bge_softc *)arg1; + if (sc->bge_asicrev == BGE_ASICREV_BCM5700 && + sc->bge_chipid != BGE_CHIPID_BCM5700_C0) + sbsz = BGE_STATUS_BLK_SZ; + else + sbsz = 32; sbdata = (uint16_t *)sc->bge_ldata.bge_status_block; printf("Status Block:\n"); - for (i = 0x0; i < (BGE_STATUS_BLK_SZ / 4); ) { + BGE_LOCK(sc); + bus_dmamap_sync(sc->bge_cdata.bge_status_tag, + sc->bge_cdata.bge_status_map, + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); + for (i = 0x0; i < sbsz / sizeof(uint16_t); ) { printf("%06x:", i); - for (j = 0; j < 8; j++) { - printf(" %04x", sbdata[i]); - i += 4; - } + for (j = 0; j < 8; j++) + printf(" %04x", sbdata[i++]); printf("\n"); } @@ -5825,8 +5840,11 @@ bge_sysctl_debug_info(SYSCTL_HANDLER_ARG } printf("\n"); } + BGE_UNLOCK(sc); printf("Hardware Flags:\n"); + if (BGE_IS_5717_PLUS(sc)) + printf(" - 5717 Plus\n"); if (BGE_IS_5755_PLUS(sc)) printf(" - 5755 Plus\n"); if (BGE_IS_575X_PLUS(sc)) Modified: stable/9/sys/dev/bge/if_bgereg.h ============================================================================== --- stable/9/sys/dev/bge/if_bgereg.h Mon Jan 2 23:53:36 2012 (r229349) +++ stable/9/sys/dev/bge/if_bgereg.h Tue Jan 3 00:07:49 2012 (r229350) @@ -2797,6 +2797,7 @@ struct bge_softc { #define BGE_FLAG_4G_BNDRY_BUG 0x02000000 #define BGE_FLAG_RX_ALIGNBUG 0x04000000 #define BGE_FLAG_SHORT_DMA_BUG 0x08000000 +#define BGE_FLAG_4K_RDMA_BUG 0x10000000 uint32_t bge_phy_flags; #define BGE_PHY_NO_WIRESPEED 0x00000001 #define BGE_PHY_ADC_BUG 0x00000002 From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 00:10:31 2012 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 F40F8106566C; Tue, 3 Jan 2012 00:10:30 +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 D90A18FC1A; Tue, 3 Jan 2012 00:10:30 +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 q030AU2M095724; Tue, 3 Jan 2012 00:10:30 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q030AUEq095721; Tue, 3 Jan 2012 00:10:30 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201030010.q030AUEq095721@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 00:10:30 +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: r229351 - in stable/8/sys: conf dev/bge 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, 03 Jan 2012 00:10:31 -0000 Author: yongari Date: Tue Jan 3 00:10:30 2012 New Revision: 229351 URL: http://svn.freebsd.org/changeset/base/229351 Log: MFC r226749,226770,226804-226807: r226749: Whitespace nits. r226770: Fix long standing bge_sysctl_debug_info() issues. o Protect bge(4) status block access and register dump with driver lock. o Add missing bus_dmamap_sync() before dumping status block. o Use minimum status block size, 32 bytes, for status block dump on most controllers except BCM5700 AX/BX. While I'm here, make the handler show 5717 Plus in hardware flags. r226804: Make CPMU handle GPHY power down control on controllers that have CPMU capability. r226805: It is known that all Broadcom controllers have 4GB boundary DMA bug. Apply workaround to all controllers. r226806: Broadcom says BCM5755 or higher and BCM5906 have short DMA bug. Apply workaround to these controllers. r226807: BCM5719 cannot handle DMA requests for DMA segments that have larger than 4KB in size. However the maximum DMA segment size created in DMA tag is 4KB, so we wouldn't encounter the issue here. Just record this issue such that let developers not to create a DMA segment that is larger than 4KB for BCM5719. It's possible to split a DMA segment into multiple smaller ones in run time but I believe it's not worth to implement that. Modified: stable/8/sys/dev/bge/if_bge.c stable/8/sys/dev/bge/if_bgereg.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/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/bge/if_bge.c ============================================================================== --- stable/8/sys/dev/bge/if_bge.c Tue Jan 3 00:07:49 2012 (r229350) +++ stable/8/sys/dev/bge/if_bge.c Tue Jan 3 00:10:30 2012 (r229351) @@ -2828,7 +2828,6 @@ bge_attach(device_t dev) switch (sc->bge_asicrev) { case BGE_ASICREV_BCM5717: case BGE_ASICREV_BCM5719: - sc->bge_flags |= BGE_FLAG_SHORT_DMA_BUG; case BGE_ASICREV_BCM57765: sc->bge_flags |= BGE_FLAG_5717_PLUS | BGE_FLAG_5755_PLUS | BGE_FLAG_575X_PLUS | BGE_FLAG_5705_PLUS | BGE_FLAG_JUMBO | @@ -2863,8 +2862,6 @@ bge_attach(device_t dev) case BGE_ASICREV_BCM5752: case BGE_ASICREV_BCM5906: sc->bge_flags |= BGE_FLAG_575X_PLUS; - if (sc->bge_asicrev == BGE_ASICREV_BCM5906) - sc->bge_flags |= BGE_FLAG_SHORT_DMA_BUG; /* FALLTHROUGH */ case BGE_ASICREV_BCM5705: sc->bge_flags |= BGE_FLAG_5705_PLUS; @@ -2918,15 +2915,26 @@ bge_attach(device_t dev) sc->bge_mi_mode |= BGE_MIMODE_AUTOPOLL; /* - * All controllers that are not 5755 or higher have 4GB - * boundary DMA bug. + * All Broadcom controllers have 4GB boundary DMA bug. * Whenever an address crosses a multiple of the 4GB boundary * (including 4GB, 8Gb, 12Gb, etc.) and makes the transition * from 0xX_FFFF_FFFF to 0x(X+1)_0000_0000 an internal DMA * state machine will lockup and cause the device to hang. */ - if (BGE_IS_5755_PLUS(sc) == 0) - sc->bge_flags |= BGE_FLAG_4G_BNDRY_BUG; + sc->bge_flags |= BGE_FLAG_4G_BNDRY_BUG; + + /* BCM5755 or higher and BCM5906 have short DMA bug. */ + if (BGE_IS_5755_PLUS(sc) || sc->bge_asicrev == BGE_ASICREV_BCM5906) + sc->bge_flags |= BGE_FLAG_SHORT_DMA_BUG; + + /* + * BCM5719 cannot handle DMA requests for DMA segments that + * have larger than 4KB in size. However the maximum DMA + * segment size created in DMA tag is 4KB for TSO, so we + * wouldn't encounter the issue here. + */ + if (sc->bge_asicrev == BGE_ASICREV_BCM5719) + sc->bge_flags |= BGE_FLAG_4K_RDMA_BUG; misccfg = CSR_READ_4(sc, BGE_MISC_CFG) & BGE_MISCCFG_BOARD_ID; if (sc->bge_asicrev == BGE_ASICREV_BCM5705) { @@ -2985,9 +2993,9 @@ bge_attach(device_t dev) sc->bge_flags |= BGE_FLAG_TSO; } - /* + /* * Check if this is a PCI-X or PCI Express device. - */ + */ if (pci_find_extcap(dev, PCIY_EXPRESS, ®) == 0) { /* * Found a PCI Express capabilities register, this @@ -3446,7 +3454,8 @@ bge_reset(struct bge_softc *sc) * Set GPHY Power Down Override to leave GPHY * powered up in D0 uninitialized. */ - if (BGE_IS_5705_PLUS(sc)) + if (BGE_IS_5705_PLUS(sc) && + (sc->bge_flags & BGE_FLAG_CPMU_PRESENT) == 0) reset |= BGE_MISCCFG_GPHY_PD_OVERRIDE; /* Issue global reset */ @@ -3995,7 +4004,7 @@ bge_intr_task(void *arg, int pending) if (ifp->if_drv_flags & IFF_DRV_RUNNING) { /* Check TX ring producer/consumer. */ bge_txeof(sc, tx_cons); - if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) bge_start_locked(ifp); } BGE_UNLOCK(sc); @@ -4112,7 +4121,7 @@ bge_tick(void *xsc) /* Synchronize with possible callout reset/stop. */ if (callout_pending(&sc->bge_stat_ch) || !callout_active(&sc->bge_stat_ch)) - return; + return; if (BGE_IS_5705_PLUS(sc)) bge_stats_update_regs(sc); @@ -5036,7 +5045,7 @@ bge_ioctl(struct ifnet *ifp, u_long comm break; } } else if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ETHERMTU) { - error = EINVAL; + error = EINVAL; break; } BGE_LOCK(sc); @@ -5797,8 +5806,7 @@ bge_sysctl_debug_info(SYSCTL_HANDLER_ARG { struct bge_softc *sc; uint16_t *sbdata; - int error; - int result; + int error, result, sbsz; int i, j; result = -1; @@ -5809,14 +5817,21 @@ bge_sysctl_debug_info(SYSCTL_HANDLER_ARG if (result == 1) { sc = (struct bge_softc *)arg1; + if (sc->bge_asicrev == BGE_ASICREV_BCM5700 && + sc->bge_chipid != BGE_CHIPID_BCM5700_C0) + sbsz = BGE_STATUS_BLK_SZ; + else + sbsz = 32; sbdata = (uint16_t *)sc->bge_ldata.bge_status_block; printf("Status Block:\n"); - for (i = 0x0; i < (BGE_STATUS_BLK_SZ / 4); ) { + BGE_LOCK(sc); + bus_dmamap_sync(sc->bge_cdata.bge_status_tag, + sc->bge_cdata.bge_status_map, + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); + for (i = 0x0; i < sbsz / sizeof(uint16_t); ) { printf("%06x:", i); - for (j = 0; j < 8; j++) { - printf(" %04x", sbdata[i]); - i += 4; - } + for (j = 0; j < 8; j++) + printf(" %04x", sbdata[i++]); printf("\n"); } @@ -5829,8 +5844,11 @@ bge_sysctl_debug_info(SYSCTL_HANDLER_ARG } printf("\n"); } + BGE_UNLOCK(sc); printf("Hardware Flags:\n"); + if (BGE_IS_5717_PLUS(sc)) + printf(" - 5717 Plus\n"); if (BGE_IS_5755_PLUS(sc)) printf(" - 5755 Plus\n"); if (BGE_IS_575X_PLUS(sc)) Modified: stable/8/sys/dev/bge/if_bgereg.h ============================================================================== --- stable/8/sys/dev/bge/if_bgereg.h Tue Jan 3 00:07:49 2012 (r229350) +++ stable/8/sys/dev/bge/if_bgereg.h Tue Jan 3 00:10:30 2012 (r229351) @@ -2797,6 +2797,7 @@ struct bge_softc { #define BGE_FLAG_4G_BNDRY_BUG 0x02000000 #define BGE_FLAG_RX_ALIGNBUG 0x04000000 #define BGE_FLAG_SHORT_DMA_BUG 0x08000000 +#define BGE_FLAG_4K_RDMA_BUG 0x10000000 uint32_t bge_phy_flags; #define BGE_PHY_NO_WIRESPEED 0x00000001 #define BGE_PHY_ADC_BUG 0x00000002 From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 00:12:06 2012 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 A13A91065672; Tue, 3 Jan 2012 00:12:06 +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 8A7D28FC22; Tue, 3 Jan 2012 00:12: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 q030C6gk095821; Tue, 3 Jan 2012 00:12:06 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q030C6Jc095818; Tue, 3 Jan 2012 00:12:06 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201030012.q030C6Jc095818@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 00:12:06 +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: r229352 - stable/7/sys/dev/bge 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, 03 Jan 2012 00:12:06 -0000 Author: yongari Date: Tue Jan 3 00:12:06 2012 New Revision: 229352 URL: http://svn.freebsd.org/changeset/base/229352 Log: MFC r226749,226770,226804-226807: r226749: Whitespace nits. r226770: Fix long standing bge_sysctl_debug_info() issues. o Protect bge(4) status block access and register dump with driver lock. o Add missing bus_dmamap_sync() before dumping status block. o Use minimum status block size, 32 bytes, for status block dump on most controllers except BCM5700 AX/BX. While I'm here, make the handler show 5717 Plus in hardware flags. r226804: Make CPMU handle GPHY power down control on controllers that have CPMU capability. r226805: It is known that all Broadcom controllers have 4GB boundary DMA bug. Apply workaround to all controllers. r226806: Broadcom says BCM5755 or higher and BCM5906 have short DMA bug. Apply workaround to these controllers. r226807: BCM5719 cannot handle DMA requests for DMA segments that have larger than 4KB in size. However the maximum DMA segment size created in DMA tag is 4KB, so we wouldn't encounter the issue here. Just record this issue such that let developers not to create a DMA segment that is larger than 4KB for BCM5719. It's possible to split a DMA segment into multiple smaller ones in run time but I believe it's not worth to implement that. Modified: stable/7/sys/dev/bge/if_bge.c stable/7/sys/dev/bge/if_bgereg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/bge/if_bge.c ============================================================================== --- stable/7/sys/dev/bge/if_bge.c Tue Jan 3 00:10:30 2012 (r229351) +++ stable/7/sys/dev/bge/if_bge.c Tue Jan 3 00:12:06 2012 (r229352) @@ -2828,7 +2828,6 @@ bge_attach(device_t dev) switch (sc->bge_asicrev) { case BGE_ASICREV_BCM5717: case BGE_ASICREV_BCM5719: - sc->bge_flags |= BGE_FLAG_SHORT_DMA_BUG; case BGE_ASICREV_BCM57765: sc->bge_flags |= BGE_FLAG_5717_PLUS | BGE_FLAG_5755_PLUS | BGE_FLAG_575X_PLUS | BGE_FLAG_5705_PLUS | BGE_FLAG_JUMBO | @@ -2863,8 +2862,6 @@ bge_attach(device_t dev) case BGE_ASICREV_BCM5752: case BGE_ASICREV_BCM5906: sc->bge_flags |= BGE_FLAG_575X_PLUS; - if (sc->bge_asicrev == BGE_ASICREV_BCM5906) - sc->bge_flags |= BGE_FLAG_SHORT_DMA_BUG; /* FALLTHROUGH */ case BGE_ASICREV_BCM5705: sc->bge_flags |= BGE_FLAG_5705_PLUS; @@ -2918,15 +2915,26 @@ bge_attach(device_t dev) sc->bge_mi_mode |= BGE_MIMODE_AUTOPOLL; /* - * All controllers that are not 5755 or higher have 4GB - * boundary DMA bug. + * All Broadcom controllers have 4GB boundary DMA bug. * Whenever an address crosses a multiple of the 4GB boundary * (including 4GB, 8Gb, 12Gb, etc.) and makes the transition * from 0xX_FFFF_FFFF to 0x(X+1)_0000_0000 an internal DMA * state machine will lockup and cause the device to hang. */ - if (BGE_IS_5755_PLUS(sc) == 0) - sc->bge_flags |= BGE_FLAG_4G_BNDRY_BUG; + sc->bge_flags |= BGE_FLAG_4G_BNDRY_BUG; + + /* BCM5755 or higher and BCM5906 have short DMA bug. */ + if (BGE_IS_5755_PLUS(sc) || sc->bge_asicrev == BGE_ASICREV_BCM5906) + sc->bge_flags |= BGE_FLAG_SHORT_DMA_BUG; + + /* + * BCM5719 cannot handle DMA requests for DMA segments that + * have larger than 4KB in size. However the maximum DMA + * segment size created in DMA tag is 4KB for TSO, so we + * wouldn't encounter the issue here. + */ + if (sc->bge_asicrev == BGE_ASICREV_BCM5719) + sc->bge_flags |= BGE_FLAG_4K_RDMA_BUG; misccfg = CSR_READ_4(sc, BGE_MISC_CFG) & BGE_MISCCFG_BOARD_ID; if (sc->bge_asicrev == BGE_ASICREV_BCM5705) { @@ -2985,9 +2993,9 @@ bge_attach(device_t dev) sc->bge_flags |= BGE_FLAG_TSO; } - /* + /* * Check if this is a PCI-X or PCI Express device. - */ + */ if (pci_find_extcap(dev, PCIY_EXPRESS, ®) == 0) { /* * Found a PCI Express capabilities register, this @@ -3446,7 +3454,8 @@ bge_reset(struct bge_softc *sc) * Set GPHY Power Down Override to leave GPHY * powered up in D0 uninitialized. */ - if (BGE_IS_5705_PLUS(sc)) + if (BGE_IS_5705_PLUS(sc) && + (sc->bge_flags & BGE_FLAG_CPMU_PRESENT) == 0) reset |= BGE_MISCCFG_GPHY_PD_OVERRIDE; /* Issue global reset */ @@ -3991,7 +4000,7 @@ bge_intr_task(void *arg, int pending) if (ifp->if_drv_flags & IFF_DRV_RUNNING) { /* Check TX ring producer/consumer. */ bge_txeof(sc, tx_cons); - if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) bge_start_locked(ifp); } BGE_UNLOCK(sc); @@ -4108,7 +4117,7 @@ bge_tick(void *xsc) /* Synchronize with possible callout reset/stop. */ if (callout_pending(&sc->bge_stat_ch) || !callout_active(&sc->bge_stat_ch)) - return; + return; if (BGE_IS_5705_PLUS(sc)) bge_stats_update_regs(sc); @@ -5032,7 +5041,7 @@ bge_ioctl(struct ifnet *ifp, u_long comm break; } } else if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ETHERMTU) { - error = EINVAL; + error = EINVAL; break; } BGE_LOCK(sc); @@ -5793,8 +5802,7 @@ bge_sysctl_debug_info(SYSCTL_HANDLER_ARG { struct bge_softc *sc; uint16_t *sbdata; - int error; - int result; + int error, result, sbsz; int i, j; result = -1; @@ -5805,14 +5813,21 @@ bge_sysctl_debug_info(SYSCTL_HANDLER_ARG if (result == 1) { sc = (struct bge_softc *)arg1; + if (sc->bge_asicrev == BGE_ASICREV_BCM5700 && + sc->bge_chipid != BGE_CHIPID_BCM5700_C0) + sbsz = BGE_STATUS_BLK_SZ; + else + sbsz = 32; sbdata = (uint16_t *)sc->bge_ldata.bge_status_block; printf("Status Block:\n"); - for (i = 0x0; i < (BGE_STATUS_BLK_SZ / 4); ) { + BGE_LOCK(sc); + bus_dmamap_sync(sc->bge_cdata.bge_status_tag, + sc->bge_cdata.bge_status_map, + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); + for (i = 0x0; i < sbsz / sizeof(uint16_t); ) { printf("%06x:", i); - for (j = 0; j < 8; j++) { - printf(" %04x", sbdata[i]); - i += 4; - } + for (j = 0; j < 8; j++) + printf(" %04x", sbdata[i++]); printf("\n"); } @@ -5825,8 +5840,11 @@ bge_sysctl_debug_info(SYSCTL_HANDLER_ARG } printf("\n"); } + BGE_UNLOCK(sc); printf("Hardware Flags:\n"); + if (BGE_IS_5717_PLUS(sc)) + printf(" - 5717 Plus\n"); if (BGE_IS_5755_PLUS(sc)) printf(" - 5755 Plus\n"); if (BGE_IS_575X_PLUS(sc)) Modified: stable/7/sys/dev/bge/if_bgereg.h ============================================================================== --- stable/7/sys/dev/bge/if_bgereg.h Tue Jan 3 00:10:30 2012 (r229351) +++ stable/7/sys/dev/bge/if_bgereg.h Tue Jan 3 00:12:06 2012 (r229352) @@ -2797,6 +2797,7 @@ struct bge_softc { #define BGE_FLAG_4G_BNDRY_BUG 0x02000000 #define BGE_FLAG_RX_ALIGNBUG 0x04000000 #define BGE_FLAG_SHORT_DMA_BUG 0x08000000 +#define BGE_FLAG_4K_RDMA_BUG 0x10000000 uint32_t bge_phy_flags; #define BGE_PHY_NO_WIRESPEED 0x00000001 #define BGE_PHY_ADC_BUG 0x00000002 From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 00:22:09 2012 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 10FB01065670; Tue, 3 Jan 2012 00:22:09 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EFDF38FC13; Tue, 3 Jan 2012 00:22:08 +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 q030M8BU096431; Tue, 3 Jan 2012 00:22:08 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q030M80s096429; Tue, 3 Jan 2012 00:22:08 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201201030022.q030M80s096429@svn.freebsd.org> From: Glen Barber Date: Tue, 3 Jan 2012 00:22:08 +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: r229353 - head/sys/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, 03 Jan 2012 00:22:09 -0000 Author: gjb (doc committer) Date: Tue Jan 3 00:22:08 2012 New Revision: 229353 URL: http://svn.freebsd.org/changeset/base/229353 Log: Trivial standardization to a few comments in kern.pre.mk. Submitted by: arundel MFC after: 3 days Modified: head/sys/conf/kern.pre.mk Modified: head/sys/conf/kern.pre.mk ============================================================================== --- head/sys/conf/kern.pre.mk Tue Jan 3 00:12:06 2012 (r229352) +++ head/sys/conf/kern.pre.mk Tue Jan 3 00:22:08 2012 (r229353) @@ -71,10 +71,10 @@ INCLUDES+= -I$S/dev/ath -I$S/dev/ath/ath # ... and the same for the NgATM stuff INCLUDES+= -I$S/contrib/ngatm -# .. and the same for twa +# ... and the same for twa INCLUDES+= -I$S/dev/twa -# ... and XFS +# ... and the same for XFS INCLUDES+= -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs # ... and the same for cxgb and cxgbe From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 00:22:58 2012 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 5BA451065677; Tue, 3 Jan 2012 00:22:58 +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 445858FC1A; Tue, 3 Jan 2012 00: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 q030MwwG096493; Tue, 3 Jan 2012 00:22:58 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q030Mw5U096490; Tue, 3 Jan 2012 00:22:58 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201030022.q030Mw5U096490@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 00:22:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229354 - stable/9/sys/dev/bge 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, 03 Jan 2012 00:22:58 -0000 Author: yongari Date: Tue Jan 3 00:22:57 2012 New Revision: 229354 URL: http://svn.freebsd.org/changeset/base/229354 Log: MFC r226814-226815,226820-226821,226864,226866-226867: r226814: Rename definition of BGE_SOFTWARE_GENCOMM_* to more readable ones. The origin of GENCOMM seems to come from Alteon Tigon Host/NIC interface definition where it defines general communications region which is active when firmware is loaded and running. This region was used in communication between the host and processor internal to the Tigon chip. Broadcom data sheet also defines the region as 'Software Gencomm' in NetXtreme memory map but lacks detailed description of its interface so it was hard to know which ones are used for which interface. This change shall slightly enhance readability. No functional changes. r226815: Define MAC address mail box and use it instead of using hard-coded value. r226820: Offset 0x6810 is RX-RISC event register. Rename BGE_CPU_EVENT with BGE_RX_CPU_EVENT for readability. Additionally define BGE_TX_CPU_EVENT for TX-RSIC event register(BCM570[0-4] only). r226821: SRAM offset 0x0C04 is used by driver to inform the IPMI/ASF firmware about the various driver events like load, unload, reset, suspend, restart, and ioctl operations. Define driver's event rather than using hard-coded values. We don't still send suspend/resume event to firmware. Previously bge(4) used BGE_SDI_STATUS to send events. Because driver has to access firmware mail box to inform current state, using BGE_SDI_STATUS register was wrong. The end result was the same as BGE_SDI_STATUS is 0x0C04. No functional changes. r226864: Rename BGE_FW_DRV_ALIVE/BGE_FW_PAUSE to BGE_FW_CMD_DRV_ALIVE/BGE_FW_CMD_PAUSE. Also add more firmware commands(not used yet). No functional changes. r226866: Rename hard-coded value 1 << 14 with BGE_RX_CPU_DRV_EVENT. This bit(SW event 7 in publicly available data sheet) is used to make RX CPU handle a firmware command and the bit is automatically cleared after RX CPU completed the command. Generally firmware command takes the following steps. 1. Write BGE_SRAM_FW_CMD_MB with a command. 2. Write BGE_SRAM_FW_CMD_LEN_MB with the length of the command in bytes. 3. Write BGE_SRAM_FW_CMD_DATA_MB with actual command data. 4. Generate BGE_RX_CPU_EVENT and let firmware handle the command. 5. Wait for the ACK of the firmware command. No functional changes. r226867: Define BGE_FW_HB_TIMEOUT_SEC and remove one more magic value. bge(4) sends BGE_FW_CMD_DRV_ALIVE command to firmware every 2 seconds. BGE_FW_CMD_DRV_ALIVE command requires 4 bytes data. This data contains timeout value in seconds until the next BGE_FW_CMD_DRV_ALIVE command. Broadcom recommends driver set the value 3 times longer than the interval that it sends BGE_FW_CMD_DRV_ALIVE. Currently bge(4) uses 3 seconds so probably we have to increase it in future and use different ALIVE command(e.g. BGE_FW_CMD_DRV_ALIVE3). No functional changes. Modified: stable/9/sys/dev/bge/if_bge.c stable/9/sys/dev/bge/if_bgereg.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/bge/if_bge.c ============================================================================== --- stable/9/sys/dev/bge/if_bge.c Tue Jan 3 00:22:08 2012 (r229353) +++ stable/9/sys/dev/bge/if_bge.c Tue Jan 3 00:22:57 2012 (r229354) @@ -1305,15 +1305,17 @@ bge_sig_pre_reset(struct bge_softc *sc, * Some chips don't like this so only do this if ASF is enabled */ if (sc->bge_asf_mode) - bge_writemem_ind(sc, BGE_SOFTWARE_GENCOMM, BGE_MAGIC_NUMBER); + bge_writemem_ind(sc, BGE_SRAM_FW_MB, BGE_SRAM_FW_MB_MAGIC); if (sc->bge_asf_mode & ASF_NEW_HANDSHAKE) { switch (type) { case BGE_RESET_START: - bge_writemem_ind(sc, BGE_SDI_STATUS, 0x1); /* START */ + bge_writemem_ind(sc, BGE_SRAM_FW_DRV_STATE_MB, + BGE_FW_DRV_STATE_START); break; case BGE_RESET_STOP: - bge_writemem_ind(sc, BGE_SDI_STATUS, 0x2); /* UNLOAD */ + bge_writemem_ind(sc, BGE_SRAM_FW_DRV_STATE_MB, + BGE_FW_DRV_STATE_UNLOAD); break; } } @@ -1326,11 +1328,13 @@ bge_sig_post_reset(struct bge_softc *sc, if (sc->bge_asf_mode & ASF_NEW_HANDSHAKE) { switch (type) { case BGE_RESET_START: - bge_writemem_ind(sc, BGE_SDI_STATUS, 0x80000001); + bge_writemem_ind(sc, BGE_SRAM_FW_DRV_STATE_MB, + BGE_FW_DRV_STATE_START_DONE); /* START DONE */ break; case BGE_RESET_STOP: - bge_writemem_ind(sc, BGE_SDI_STATUS, 0x80000002); + bge_writemem_ind(sc, BGE_SRAM_FW_DRV_STATE_MB, + BGE_FW_DRV_STATE_UNLOAD_DONE); break; } } @@ -1343,10 +1347,12 @@ bge_sig_legacy(struct bge_softc *sc, int if (sc->bge_asf_mode) { switch (type) { case BGE_RESET_START: - bge_writemem_ind(sc, BGE_SDI_STATUS, 0x1); /* START */ + bge_writemem_ind(sc, BGE_SRAM_FW_DRV_STATE_MB, + BGE_FW_DRV_STATE_START); break; case BGE_RESET_STOP: - bge_writemem_ind(sc, BGE_SDI_STATUS, 0x2); /* UNLOAD */ + bge_writemem_ind(sc, BGE_SRAM_FW_DRV_STATE_MB, + BGE_FW_DRV_STATE_UNLOAD); break; } } @@ -1358,12 +1364,13 @@ bge_stop_fw(struct bge_softc *sc) int i; if (sc->bge_asf_mode) { - bge_writemem_ind(sc, BGE_SOFTWARE_GENCOMM_FW, BGE_FW_PAUSE); - CSR_WRITE_4(sc, BGE_CPU_EVENT, - CSR_READ_4(sc, BGE_CPU_EVENT) | (1 << 14)); + bge_writemem_ind(sc, BGE_SRAM_FW_CMD_MB, BGE_FW_CMD_PAUSE); + CSR_WRITE_4(sc, BGE_RX_CPU_EVENT, + CSR_READ_4(sc, BGE_RX_CPU_EVENT) | BGE_RX_CPU_DRV_EVENT); for (i = 0; i < 100; i++ ) { - if (!(CSR_READ_4(sc, BGE_CPU_EVENT) & (1 << 14))) + if (!(CSR_READ_4(sc, BGE_RX_CPU_EVENT) & + BGE_RX_CPU_DRV_EVENT)) break; DELAY(10); } @@ -3077,9 +3084,9 @@ bge_attach(device_t dev) } sc->bge_asf_mode = 0; - if (bge_allow_asf && (bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_SIG) - == BGE_MAGIC_NUMBER)) { - if (bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_NICCFG) + if (bge_allow_asf && (bge_readmem_ind(sc, BGE_SRAM_DATA_SIG) == + BGE_SRAM_DATA_SIG_MAGIC)) { + if (bge_readmem_ind(sc, BGE_SRAM_DATA_CFG) & BGE_HWCFG_ASF) { sc->bge_asf_mode |= ASF_ENABLE; sc->bge_asf_mode |= ASF_STACKUP; @@ -3193,8 +3200,8 @@ bge_attach(device_t dev) * by its PCI subsystem ID, as we do below for the SysKonnect * SK-9D41. */ - if (bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_SIG) == BGE_MAGIC_NUMBER) - hwcfg = bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_NICCFG); + if (bge_readmem_ind(sc, BGE_SRAM_DATA_SIG) == BGE_SRAM_DATA_SIG_MAGIC) + hwcfg = bge_readmem_ind(sc, BGE_SRAM_DATA_CFG); else if ((sc->bge_flags & BGE_FLAG_EADDR) && (sc->bge_asicrev != BGE_ASICREV_BCM5906)) { if (bge_read_eeprom(sc, (caddr_t)&hwcfg, BGE_EE_HWCFG_OFFSET, @@ -3429,9 +3436,9 @@ bge_reset(struct bge_softc *sc) /* * Write the magic number to SRAM at offset 0xB50. * When firmware finishes its initialization it will - * write ~BGE_MAGIC_NUMBER to the same location. + * write ~BGE_SRAM_FW_MB_MAGIC to the same location. */ - bge_writemem_ind(sc, BGE_SOFTWARE_GENCOMM, BGE_MAGIC_NUMBER); + bge_writemem_ind(sc, BGE_SRAM_FW_MB, BGE_SRAM_FW_MB_MAGIC); reset = BGE_MISCCFG_RESET_CORE_CLOCKS | BGE_32BITTIME_66MHZ; @@ -3556,8 +3563,8 @@ bge_reset(struct bge_softc *sc) */ for (i = 0; i < BGE_TIMEOUT; i++) { DELAY(10); - val = bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM); - if (val == ~BGE_MAGIC_NUMBER) + val = bge_readmem_ind(sc, BGE_SRAM_FW_MB); + if (val == ~BGE_SRAM_FW_MB_MAGIC) break; } @@ -4096,12 +4103,14 @@ bge_asf_driver_up(struct bge_softc *sc) sc->bge_asf_count --; else { sc->bge_asf_count = 2; - bge_writemem_ind(sc, BGE_SOFTWARE_GENCOMM_FW, - BGE_FW_DRV_ALIVE); - bge_writemem_ind(sc, BGE_SOFTWARE_GENNCOMM_FW_LEN, 4); - bge_writemem_ind(sc, BGE_SOFTWARE_GENNCOMM_FW_DATA, 3); - CSR_WRITE_4(sc, BGE_CPU_EVENT, - CSR_READ_4(sc, BGE_CPU_EVENT) | (1 << 14)); + bge_writemem_ind(sc, BGE_SRAM_FW_CMD_MB, + BGE_FW_CMD_DRV_ALIVE); + bge_writemem_ind(sc, BGE_SRAM_FW_CMD_LEN_MB, 4); + bge_writemem_ind(sc, BGE_SRAM_FW_CMD_DATA_MB, + BGE_FW_HB_TIMEOUT_SEC); + CSR_WRITE_4(sc, BGE_RX_CPU_EVENT, + CSR_READ_4(sc, BGE_RX_CPU_EVENT) | + BGE_RX_CPU_DRV_EVENT); } } } @@ -5934,11 +5943,11 @@ bge_get_eaddr_mem(struct bge_softc *sc, { uint32_t mac_addr; - mac_addr = bge_readmem_ind(sc, 0x0c14); + mac_addr = bge_readmem_ind(sc, BGE_SRAM_MAC_ADDR_HIGH_MB); if ((mac_addr >> 16) == 0x484b) { ether_addr[0] = (uint8_t)(mac_addr >> 8); ether_addr[1] = (uint8_t)mac_addr; - mac_addr = bge_readmem_ind(sc, 0x0c18); + mac_addr = bge_readmem_ind(sc, BGE_SRAM_MAC_ADDR_LOW_MB); ether_addr[2] = (uint8_t)(mac_addr >> 24); ether_addr[3] = (uint8_t)(mac_addr >> 16); ether_addr[4] = (uint8_t)(mac_addr >> 8); Modified: stable/9/sys/dev/bge/if_bgereg.h ============================================================================== --- stable/9/sys/dev/bge/if_bgereg.h Tue Jan 3 00:22:08 2012 (r229353) +++ stable/9/sys/dev/bge/if_bgereg.h Tue Jan 3 00:22:57 2012 (r229354) @@ -71,12 +71,15 @@ #define BGE_STATS_BLOCK_END 0x00000AFF #define BGE_STATUS_BLOCK 0x00000B00 #define BGE_STATUS_BLOCK_END 0x00000B4F -#define BGE_SOFTWARE_GENCOMM 0x00000B50 -#define BGE_SOFTWARE_GENCOMM_SIG 0x00000B54 -#define BGE_SOFTWARE_GENCOMM_NICCFG 0x00000B58 -#define BGE_SOFTWARE_GENCOMM_FW 0x00000B78 -#define BGE_SOFTWARE_GENNCOMM_FW_LEN 0x00000B7C -#define BGE_SOFTWARE_GENNCOMM_FW_DATA 0x00000B80 +#define BGE_SRAM_FW_MB 0x00000B50 +#define BGE_SRAM_DATA_SIG 0x00000B54 +#define BGE_SRAM_DATA_CFG 0x00000B58 +#define BGE_SRAM_FW_CMD_MB 0x00000B78 +#define BGE_SRAM_FW_CMD_LEN_MB 0x00000B7C +#define BGE_SRAM_FW_CMD_DATA_MB 0x00000B80 +#define BGE_SRAM_FW_DRV_STATE_MB 0x00000C04 +#define BGE_SRAM_MAC_ADDR_HIGH_MB 0x00000C14 +#define BGE_SRAM_MAC_ADDR_LOW_MB 0x00000C18 #define BGE_SOFTWARE_GENCOMM_END 0x00000FFF #define BGE_UNMAPPED 0x00001000 #define BGE_UNMAPPED_END 0x00001FFF @@ -87,8 +90,24 @@ #define BGE_SEND_RING_1_TO_4_END 0x00005FFF /* Firmware interface */ -#define BGE_FW_DRV_ALIVE 0x00000001 -#define BGE_FW_PAUSE 0x00000002 +#define BGE_SRAM_DATA_SIG_MAGIC 0x4B657654 /* 'KevT' */ + +#define BGE_FW_CMD_DRV_ALIVE 0x00000001 +#define BGE_FW_CMD_PAUSE 0x00000002 +#define BGE_FW_CMD_IPV4_ADDR_CHANGE 0x00000003 +#define BGE_FW_CMD_IPV6_ADDR_CHANGE 0x00000004 +#define BGE_FW_CMD_LINK_UPDATE 0x0000000C +#define BGE_FW_CMD_DRV_ALIVE2 0x0000000D +#define BGE_FW_CMD_DRV_ALIVE3 0x0000000E + +#define BGE_FW_HB_TIMEOUT_SEC 3 + +#define BGE_FW_DRV_STATE_START 0x00000001 +#define BGE_FW_DRV_STATE_START_DONE 0x80000001 +#define BGE_FW_DRV_STATE_UNLOAD 0x00000002 +#define BGE_FW_DRV_STATE_UNLOAD_DONE 0x80000002 +#define BGE_FW_DRV_STATE_WOL 0x00000003 +#define BGE_FW_DRV_STATE_SUSPEND 0x00000004 /* Mappings for internal memory configuration */ #define BGE_STD_RX_RINGS 0x00006000 @@ -1875,7 +1894,8 @@ #define BGE_MODE_CTL 0x6800 #define BGE_MISC_CFG 0x6804 #define BGE_MISC_LOCAL_CTL 0x6808 -#define BGE_CPU_EVENT 0x6810 +#define BGE_RX_CPU_EVENT 0x6810 +#define BGE_TX_CPU_EVENT 0x6820 #define BGE_EE_ADDR 0x6838 #define BGE_EE_DATA 0x683C #define BGE_EE_CTL 0x6840 @@ -1883,6 +1903,8 @@ #define BGE_EE_DELAY 0x6848 #define BGE_FASTBOOT_PC 0x6894 +#define BGE_RX_CPU_DRV_EVENT 0x00004000 + /* * NVRAM Control registers */ @@ -2052,10 +2074,10 @@ * This magic number is written to the firmware mailbox at 0xb50 * before a software reset is issued. After the internal firmware * has completed its initialization it will write the opposite of - * this value, ~BGE_MAGIC_NUMBER, to the same location, allowing the - * driver to synchronize with the firmware. + * this value, ~BGE_SRAM_FW_MB_MAGIC, to the same location, + * allowing the driver to synchronize with the firmware. */ -#define BGE_MAGIC_NUMBER 0x4B657654 +#define BGE_SRAM_FW_MB_MAGIC 0x4B657654 typedef struct { uint32_t bge_addr_hi; From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 00:24:44 2012 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 C68E9106566B; Tue, 3 Jan 2012 00:24: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 AED578FC0C; Tue, 3 Jan 2012 00:24: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 q030OiJb096596; Tue, 3 Jan 2012 00:24:44 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q030Oiub096593; Tue, 3 Jan 2012 00:24:44 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201030024.q030Oiub096593@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 00:24:44 +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: r229355 - in stable/8/sys: conf dev/bge 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, 03 Jan 2012 00:24:44 -0000 Author: yongari Date: Tue Jan 3 00:24:44 2012 New Revision: 229355 URL: http://svn.freebsd.org/changeset/base/229355 Log: MFC r226814-226815,226820-226821,226864,226866-226867: r226814: Rename definition of BGE_SOFTWARE_GENCOMM_* to more readable ones. The origin of GENCOMM seems to come from Alteon Tigon Host/NIC interface definition where it defines general communications region which is active when firmware is loaded and running. This region was used in communication between the host and processor internal to the Tigon chip. Broadcom data sheet also defines the region as 'Software Gencomm' in NetXtreme memory map but lacks detailed description of its interface so it was hard to know which ones are used for which interface. This change shall slightly enhance readability. No functional changes. r226815: Define MAC address mail box and use it instead of using hard-coded value. r226820: Offset 0x6810 is RX-RISC event register. Rename BGE_CPU_EVENT with BGE_RX_CPU_EVENT for readability. Additionally define BGE_TX_CPU_EVENT for TX-RSIC event register(BCM570[0-4] only). r226821: SRAM offset 0x0C04 is used by driver to inform the IPMI/ASF firmware about the various driver events like load, unload, reset, suspend, restart, and ioctl operations. Define driver's event rather than using hard-coded values. We don't still send suspend/resume event to firmware. Previously bge(4) used BGE_SDI_STATUS to send events. Because driver has to access firmware mail box to inform current state, using BGE_SDI_STATUS register was wrong. The end result was the same as BGE_SDI_STATUS is 0x0C04. No functional changes. r226864: Rename BGE_FW_DRV_ALIVE/BGE_FW_PAUSE to BGE_FW_CMD_DRV_ALIVE/BGE_FW_CMD_PAUSE. Also add more firmware commands(not used yet). No functional changes. r226866: Rename hard-coded value 1 << 14 with BGE_RX_CPU_DRV_EVENT. This bit(SW event 7 in publicly available data sheet) is used to make RX CPU handle a firmware command and the bit is automatically cleared after RX CPU completed the command. Generally firmware command takes the following steps. 1. Write BGE_SRAM_FW_CMD_MB with a command. 2. Write BGE_SRAM_FW_CMD_LEN_MB with the length of the command in bytes. 3. Write BGE_SRAM_FW_CMD_DATA_MB with actual command data. 4. Generate BGE_RX_CPU_EVENT and let firmware handle the command. 5. Wait for the ACK of the firmware command. No functional changes. r226867: Define BGE_FW_HB_TIMEOUT_SEC and remove one more magic value. bge(4) sends BGE_FW_CMD_DRV_ALIVE command to firmware every 2 seconds. BGE_FW_CMD_DRV_ALIVE command requires 4 bytes data. This data contains timeout value in seconds until the next BGE_FW_CMD_DRV_ALIVE command. Broadcom recommends driver set the value 3 times longer than the interval that it sends BGE_FW_CMD_DRV_ALIVE. Currently bge(4) uses 3 seconds so probably we have to increase it in future and use different ALIVE command(e.g. BGE_FW_CMD_DRV_ALIVE3). No functional changes. Modified: stable/8/sys/dev/bge/if_bge.c stable/8/sys/dev/bge/if_bgereg.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/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/bge/if_bge.c ============================================================================== --- stable/8/sys/dev/bge/if_bge.c Tue Jan 3 00:22:57 2012 (r229354) +++ stable/8/sys/dev/bge/if_bge.c Tue Jan 3 00:24:44 2012 (r229355) @@ -1309,15 +1309,17 @@ bge_sig_pre_reset(struct bge_softc *sc, * Some chips don't like this so only do this if ASF is enabled */ if (sc->bge_asf_mode) - bge_writemem_ind(sc, BGE_SOFTWARE_GENCOMM, BGE_MAGIC_NUMBER); + bge_writemem_ind(sc, BGE_SRAM_FW_MB, BGE_SRAM_FW_MB_MAGIC); if (sc->bge_asf_mode & ASF_NEW_HANDSHAKE) { switch (type) { case BGE_RESET_START: - bge_writemem_ind(sc, BGE_SDI_STATUS, 0x1); /* START */ + bge_writemem_ind(sc, BGE_SRAM_FW_DRV_STATE_MB, + BGE_FW_DRV_STATE_START); break; case BGE_RESET_STOP: - bge_writemem_ind(sc, BGE_SDI_STATUS, 0x2); /* UNLOAD */ + bge_writemem_ind(sc, BGE_SRAM_FW_DRV_STATE_MB, + BGE_FW_DRV_STATE_UNLOAD); break; } } @@ -1330,11 +1332,13 @@ bge_sig_post_reset(struct bge_softc *sc, if (sc->bge_asf_mode & ASF_NEW_HANDSHAKE) { switch (type) { case BGE_RESET_START: - bge_writemem_ind(sc, BGE_SDI_STATUS, 0x80000001); + bge_writemem_ind(sc, BGE_SRAM_FW_DRV_STATE_MB, + BGE_FW_DRV_STATE_START_DONE); /* START DONE */ break; case BGE_RESET_STOP: - bge_writemem_ind(sc, BGE_SDI_STATUS, 0x80000002); + bge_writemem_ind(sc, BGE_SRAM_FW_DRV_STATE_MB, + BGE_FW_DRV_STATE_UNLOAD_DONE); break; } } @@ -1347,10 +1351,12 @@ bge_sig_legacy(struct bge_softc *sc, int if (sc->bge_asf_mode) { switch (type) { case BGE_RESET_START: - bge_writemem_ind(sc, BGE_SDI_STATUS, 0x1); /* START */ + bge_writemem_ind(sc, BGE_SRAM_FW_DRV_STATE_MB, + BGE_FW_DRV_STATE_START); break; case BGE_RESET_STOP: - bge_writemem_ind(sc, BGE_SDI_STATUS, 0x2); /* UNLOAD */ + bge_writemem_ind(sc, BGE_SRAM_FW_DRV_STATE_MB, + BGE_FW_DRV_STATE_UNLOAD); break; } } @@ -1362,12 +1368,13 @@ bge_stop_fw(struct bge_softc *sc) int i; if (sc->bge_asf_mode) { - bge_writemem_ind(sc, BGE_SOFTWARE_GENCOMM_FW, BGE_FW_PAUSE); - CSR_WRITE_4(sc, BGE_CPU_EVENT, - CSR_READ_4(sc, BGE_CPU_EVENT) | (1 << 14)); + bge_writemem_ind(sc, BGE_SRAM_FW_CMD_MB, BGE_FW_CMD_PAUSE); + CSR_WRITE_4(sc, BGE_RX_CPU_EVENT, + CSR_READ_4(sc, BGE_RX_CPU_EVENT) | BGE_RX_CPU_DRV_EVENT); for (i = 0; i < 100; i++ ) { - if (!(CSR_READ_4(sc, BGE_CPU_EVENT) & (1 << 14))) + if (!(CSR_READ_4(sc, BGE_RX_CPU_EVENT) & + BGE_RX_CPU_DRV_EVENT)) break; DELAY(10); } @@ -3081,9 +3088,9 @@ bge_attach(device_t dev) } sc->bge_asf_mode = 0; - if (bge_allow_asf && (bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_SIG) - == BGE_MAGIC_NUMBER)) { - if (bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_NICCFG) + if (bge_allow_asf && (bge_readmem_ind(sc, BGE_SRAM_DATA_SIG) == + BGE_SRAM_DATA_SIG_MAGIC)) { + if (bge_readmem_ind(sc, BGE_SRAM_DATA_CFG) & BGE_HWCFG_ASF) { sc->bge_asf_mode |= ASF_ENABLE; sc->bge_asf_mode |= ASF_STACKUP; @@ -3197,8 +3204,8 @@ bge_attach(device_t dev) * by its PCI subsystem ID, as we do below for the SysKonnect * SK-9D41. */ - if (bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_SIG) == BGE_MAGIC_NUMBER) - hwcfg = bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_NICCFG); + if (bge_readmem_ind(sc, BGE_SRAM_DATA_SIG) == BGE_SRAM_DATA_SIG_MAGIC) + hwcfg = bge_readmem_ind(sc, BGE_SRAM_DATA_CFG); else if ((sc->bge_flags & BGE_FLAG_EADDR) && (sc->bge_asicrev != BGE_ASICREV_BCM5906)) { if (bge_read_eeprom(sc, (caddr_t)&hwcfg, BGE_EE_HWCFG_OFFSET, @@ -3433,9 +3440,9 @@ bge_reset(struct bge_softc *sc) /* * Write the magic number to SRAM at offset 0xB50. * When firmware finishes its initialization it will - * write ~BGE_MAGIC_NUMBER to the same location. + * write ~BGE_SRAM_FW_MB_MAGIC to the same location. */ - bge_writemem_ind(sc, BGE_SOFTWARE_GENCOMM, BGE_MAGIC_NUMBER); + bge_writemem_ind(sc, BGE_SRAM_FW_MB, BGE_SRAM_FW_MB_MAGIC); reset = BGE_MISCCFG_RESET_CORE_CLOCKS | BGE_32BITTIME_66MHZ; @@ -3560,8 +3567,8 @@ bge_reset(struct bge_softc *sc) */ for (i = 0; i < BGE_TIMEOUT; i++) { DELAY(10); - val = bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM); - if (val == ~BGE_MAGIC_NUMBER) + val = bge_readmem_ind(sc, BGE_SRAM_FW_MB); + if (val == ~BGE_SRAM_FW_MB_MAGIC) break; } @@ -4100,12 +4107,14 @@ bge_asf_driver_up(struct bge_softc *sc) sc->bge_asf_count --; else { sc->bge_asf_count = 2; - bge_writemem_ind(sc, BGE_SOFTWARE_GENCOMM_FW, - BGE_FW_DRV_ALIVE); - bge_writemem_ind(sc, BGE_SOFTWARE_GENNCOMM_FW_LEN, 4); - bge_writemem_ind(sc, BGE_SOFTWARE_GENNCOMM_FW_DATA, 3); - CSR_WRITE_4(sc, BGE_CPU_EVENT, - CSR_READ_4(sc, BGE_CPU_EVENT) | (1 << 14)); + bge_writemem_ind(sc, BGE_SRAM_FW_CMD_MB, + BGE_FW_CMD_DRV_ALIVE); + bge_writemem_ind(sc, BGE_SRAM_FW_CMD_LEN_MB, 4); + bge_writemem_ind(sc, BGE_SRAM_FW_CMD_DATA_MB, + BGE_FW_HB_TIMEOUT_SEC); + CSR_WRITE_4(sc, BGE_RX_CPU_EVENT, + CSR_READ_4(sc, BGE_RX_CPU_EVENT) | + BGE_RX_CPU_DRV_EVENT); } } } @@ -5938,11 +5947,11 @@ bge_get_eaddr_mem(struct bge_softc *sc, { uint32_t mac_addr; - mac_addr = bge_readmem_ind(sc, 0x0c14); + mac_addr = bge_readmem_ind(sc, BGE_SRAM_MAC_ADDR_HIGH_MB); if ((mac_addr >> 16) == 0x484b) { ether_addr[0] = (uint8_t)(mac_addr >> 8); ether_addr[1] = (uint8_t)mac_addr; - mac_addr = bge_readmem_ind(sc, 0x0c18); + mac_addr = bge_readmem_ind(sc, BGE_SRAM_MAC_ADDR_LOW_MB); ether_addr[2] = (uint8_t)(mac_addr >> 24); ether_addr[3] = (uint8_t)(mac_addr >> 16); ether_addr[4] = (uint8_t)(mac_addr >> 8); Modified: stable/8/sys/dev/bge/if_bgereg.h ============================================================================== --- stable/8/sys/dev/bge/if_bgereg.h Tue Jan 3 00:22:57 2012 (r229354) +++ stable/8/sys/dev/bge/if_bgereg.h Tue Jan 3 00:24:44 2012 (r229355) @@ -71,12 +71,15 @@ #define BGE_STATS_BLOCK_END 0x00000AFF #define BGE_STATUS_BLOCK 0x00000B00 #define BGE_STATUS_BLOCK_END 0x00000B4F -#define BGE_SOFTWARE_GENCOMM 0x00000B50 -#define BGE_SOFTWARE_GENCOMM_SIG 0x00000B54 -#define BGE_SOFTWARE_GENCOMM_NICCFG 0x00000B58 -#define BGE_SOFTWARE_GENCOMM_FW 0x00000B78 -#define BGE_SOFTWARE_GENNCOMM_FW_LEN 0x00000B7C -#define BGE_SOFTWARE_GENNCOMM_FW_DATA 0x00000B80 +#define BGE_SRAM_FW_MB 0x00000B50 +#define BGE_SRAM_DATA_SIG 0x00000B54 +#define BGE_SRAM_DATA_CFG 0x00000B58 +#define BGE_SRAM_FW_CMD_MB 0x00000B78 +#define BGE_SRAM_FW_CMD_LEN_MB 0x00000B7C +#define BGE_SRAM_FW_CMD_DATA_MB 0x00000B80 +#define BGE_SRAM_FW_DRV_STATE_MB 0x00000C04 +#define BGE_SRAM_MAC_ADDR_HIGH_MB 0x00000C14 +#define BGE_SRAM_MAC_ADDR_LOW_MB 0x00000C18 #define BGE_SOFTWARE_GENCOMM_END 0x00000FFF #define BGE_UNMAPPED 0x00001000 #define BGE_UNMAPPED_END 0x00001FFF @@ -87,8 +90,24 @@ #define BGE_SEND_RING_1_TO_4_END 0x00005FFF /* Firmware interface */ -#define BGE_FW_DRV_ALIVE 0x00000001 -#define BGE_FW_PAUSE 0x00000002 +#define BGE_SRAM_DATA_SIG_MAGIC 0x4B657654 /* 'KevT' */ + +#define BGE_FW_CMD_DRV_ALIVE 0x00000001 +#define BGE_FW_CMD_PAUSE 0x00000002 +#define BGE_FW_CMD_IPV4_ADDR_CHANGE 0x00000003 +#define BGE_FW_CMD_IPV6_ADDR_CHANGE 0x00000004 +#define BGE_FW_CMD_LINK_UPDATE 0x0000000C +#define BGE_FW_CMD_DRV_ALIVE2 0x0000000D +#define BGE_FW_CMD_DRV_ALIVE3 0x0000000E + +#define BGE_FW_HB_TIMEOUT_SEC 3 + +#define BGE_FW_DRV_STATE_START 0x00000001 +#define BGE_FW_DRV_STATE_START_DONE 0x80000001 +#define BGE_FW_DRV_STATE_UNLOAD 0x00000002 +#define BGE_FW_DRV_STATE_UNLOAD_DONE 0x80000002 +#define BGE_FW_DRV_STATE_WOL 0x00000003 +#define BGE_FW_DRV_STATE_SUSPEND 0x00000004 /* Mappings for internal memory configuration */ #define BGE_STD_RX_RINGS 0x00006000 @@ -1875,7 +1894,8 @@ #define BGE_MODE_CTL 0x6800 #define BGE_MISC_CFG 0x6804 #define BGE_MISC_LOCAL_CTL 0x6808 -#define BGE_CPU_EVENT 0x6810 +#define BGE_RX_CPU_EVENT 0x6810 +#define BGE_TX_CPU_EVENT 0x6820 #define BGE_EE_ADDR 0x6838 #define BGE_EE_DATA 0x683C #define BGE_EE_CTL 0x6840 @@ -1883,6 +1903,8 @@ #define BGE_EE_DELAY 0x6848 #define BGE_FASTBOOT_PC 0x6894 +#define BGE_RX_CPU_DRV_EVENT 0x00004000 + /* * NVRAM Control registers */ @@ -2052,10 +2074,10 @@ * This magic number is written to the firmware mailbox at 0xb50 * before a software reset is issued. After the internal firmware * has completed its initialization it will write the opposite of - * this value, ~BGE_MAGIC_NUMBER, to the same location, allowing the - * driver to synchronize with the firmware. + * this value, ~BGE_SRAM_FW_MB_MAGIC, to the same location, + * allowing the driver to synchronize with the firmware. */ -#define BGE_MAGIC_NUMBER 0x4B657654 +#define BGE_SRAM_FW_MB_MAGIC 0x4B657654 typedef struct { uint32_t bge_addr_hi; From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 00:26:12 2012 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 17D44106566B; Tue, 3 Jan 2012 00:26:12 +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 008258FC12; Tue, 3 Jan 2012 00:26:12 +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 q030QBHV096695; Tue, 3 Jan 2012 00:26:11 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q030QBMS096692; Tue, 3 Jan 2012 00:26:11 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201030026.q030QBMS096692@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 00:26: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: r229356 - stable/7/sys/dev/bge 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, 03 Jan 2012 00:26:12 -0000 Author: yongari Date: Tue Jan 3 00:26:11 2012 New Revision: 229356 URL: http://svn.freebsd.org/changeset/base/229356 Log: MFC r226814-226815,226820-226821,226864,226866-226867: r226814: Rename definition of BGE_SOFTWARE_GENCOMM_* to more readable ones. The origin of GENCOMM seems to come from Alteon Tigon Host/NIC interface definition where it defines general communications region which is active when firmware is loaded and running. This region was used in communication between the host and processor internal to the Tigon chip. Broadcom data sheet also defines the region as 'Software Gencomm' in NetXtreme memory map but lacks detailed description of its interface so it was hard to know which ones are used for which interface. This change shall slightly enhance readability. No functional changes. r226815: Define MAC address mail box and use it instead of using hard-coded value. r226820: Offset 0x6810 is RX-RISC event register. Rename BGE_CPU_EVENT with BGE_RX_CPU_EVENT for readability. Additionally define BGE_TX_CPU_EVENT for TX-RSIC event register(BCM570[0-4] only). r226821: SRAM offset 0x0C04 is used by driver to inform the IPMI/ASF firmware about the various driver events like load, unload, reset, suspend, restart, and ioctl operations. Define driver's event rather than using hard-coded values. We don't still send suspend/resume event to firmware. Previously bge(4) used BGE_SDI_STATUS to send events. Because driver has to access firmware mail box to inform current state, using BGE_SDI_STATUS register was wrong. The end result was the same as BGE_SDI_STATUS is 0x0C04. No functional changes. r226864: Rename BGE_FW_DRV_ALIVE/BGE_FW_PAUSE to BGE_FW_CMD_DRV_ALIVE/BGE_FW_CMD_PAUSE. Also add more firmware commands(not used yet). No functional changes. r226866: Rename hard-coded value 1 << 14 with BGE_RX_CPU_DRV_EVENT. This bit(SW event 7 in publicly available data sheet) is used to make RX CPU handle a firmware command and the bit is automatically cleared after RX CPU completed the command. Generally firmware command takes the following steps. 1. Write BGE_SRAM_FW_CMD_MB with a command. 2. Write BGE_SRAM_FW_CMD_LEN_MB with the length of the command in bytes. 3. Write BGE_SRAM_FW_CMD_DATA_MB with actual command data. 4. Generate BGE_RX_CPU_EVENT and let firmware handle the command. 5. Wait for the ACK of the firmware command. No functional changes. r226867: Define BGE_FW_HB_TIMEOUT_SEC and remove one more magic value. bge(4) sends BGE_FW_CMD_DRV_ALIVE command to firmware every 2 seconds. BGE_FW_CMD_DRV_ALIVE command requires 4 bytes data. This data contains timeout value in seconds until the next BGE_FW_CMD_DRV_ALIVE command. Broadcom recommends driver set the value 3 times longer than the interval that it sends BGE_FW_CMD_DRV_ALIVE. Currently bge(4) uses 3 seconds so probably we have to increase it in future and use different ALIVE command(e.g. BGE_FW_CMD_DRV_ALIVE3). No functional changes. Modified: stable/7/sys/dev/bge/if_bge.c stable/7/sys/dev/bge/if_bgereg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/bge/if_bge.c ============================================================================== --- stable/7/sys/dev/bge/if_bge.c Tue Jan 3 00:24:44 2012 (r229355) +++ stable/7/sys/dev/bge/if_bge.c Tue Jan 3 00:26:11 2012 (r229356) @@ -1309,15 +1309,17 @@ bge_sig_pre_reset(struct bge_softc *sc, * Some chips don't like this so only do this if ASF is enabled */ if (sc->bge_asf_mode) - bge_writemem_ind(sc, BGE_SOFTWARE_GENCOMM, BGE_MAGIC_NUMBER); + bge_writemem_ind(sc, BGE_SRAM_FW_MB, BGE_SRAM_FW_MB_MAGIC); if (sc->bge_asf_mode & ASF_NEW_HANDSHAKE) { switch (type) { case BGE_RESET_START: - bge_writemem_ind(sc, BGE_SDI_STATUS, 0x1); /* START */ + bge_writemem_ind(sc, BGE_SRAM_FW_DRV_STATE_MB, + BGE_FW_DRV_STATE_START); break; case BGE_RESET_STOP: - bge_writemem_ind(sc, BGE_SDI_STATUS, 0x2); /* UNLOAD */ + bge_writemem_ind(sc, BGE_SRAM_FW_DRV_STATE_MB, + BGE_FW_DRV_STATE_UNLOAD); break; } } @@ -1330,11 +1332,13 @@ bge_sig_post_reset(struct bge_softc *sc, if (sc->bge_asf_mode & ASF_NEW_HANDSHAKE) { switch (type) { case BGE_RESET_START: - bge_writemem_ind(sc, BGE_SDI_STATUS, 0x80000001); + bge_writemem_ind(sc, BGE_SRAM_FW_DRV_STATE_MB, + BGE_FW_DRV_STATE_START_DONE); /* START DONE */ break; case BGE_RESET_STOP: - bge_writemem_ind(sc, BGE_SDI_STATUS, 0x80000002); + bge_writemem_ind(sc, BGE_SRAM_FW_DRV_STATE_MB, + BGE_FW_DRV_STATE_UNLOAD_DONE); break; } } @@ -1347,10 +1351,12 @@ bge_sig_legacy(struct bge_softc *sc, int if (sc->bge_asf_mode) { switch (type) { case BGE_RESET_START: - bge_writemem_ind(sc, BGE_SDI_STATUS, 0x1); /* START */ + bge_writemem_ind(sc, BGE_SRAM_FW_DRV_STATE_MB, + BGE_FW_DRV_STATE_START); break; case BGE_RESET_STOP: - bge_writemem_ind(sc, BGE_SDI_STATUS, 0x2); /* UNLOAD */ + bge_writemem_ind(sc, BGE_SRAM_FW_DRV_STATE_MB, + BGE_FW_DRV_STATE_UNLOAD); break; } } @@ -1362,12 +1368,13 @@ bge_stop_fw(struct bge_softc *sc) int i; if (sc->bge_asf_mode) { - bge_writemem_ind(sc, BGE_SOFTWARE_GENCOMM_FW, BGE_FW_PAUSE); - CSR_WRITE_4(sc, BGE_CPU_EVENT, - CSR_READ_4(sc, BGE_CPU_EVENT) | (1 << 14)); + bge_writemem_ind(sc, BGE_SRAM_FW_CMD_MB, BGE_FW_CMD_PAUSE); + CSR_WRITE_4(sc, BGE_RX_CPU_EVENT, + CSR_READ_4(sc, BGE_RX_CPU_EVENT) | BGE_RX_CPU_DRV_EVENT); for (i = 0; i < 100; i++ ) { - if (!(CSR_READ_4(sc, BGE_CPU_EVENT) & (1 << 14))) + if (!(CSR_READ_4(sc, BGE_RX_CPU_EVENT) & + BGE_RX_CPU_DRV_EVENT)) break; DELAY(10); } @@ -3081,9 +3088,9 @@ bge_attach(device_t dev) } sc->bge_asf_mode = 0; - if (bge_allow_asf && (bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_SIG) - == BGE_MAGIC_NUMBER)) { - if (bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_NICCFG) + if (bge_allow_asf && (bge_readmem_ind(sc, BGE_SRAM_DATA_SIG) == + BGE_SRAM_DATA_SIG_MAGIC)) { + if (bge_readmem_ind(sc, BGE_SRAM_DATA_CFG) & BGE_HWCFG_ASF) { sc->bge_asf_mode |= ASF_ENABLE; sc->bge_asf_mode |= ASF_STACKUP; @@ -3197,8 +3204,8 @@ bge_attach(device_t dev) * by its PCI subsystem ID, as we do below for the SysKonnect * SK-9D41. */ - if (bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_SIG) == BGE_MAGIC_NUMBER) - hwcfg = bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_NICCFG); + if (bge_readmem_ind(sc, BGE_SRAM_DATA_SIG) == BGE_SRAM_DATA_SIG_MAGIC) + hwcfg = bge_readmem_ind(sc, BGE_SRAM_DATA_CFG); else if ((sc->bge_flags & BGE_FLAG_EADDR) && (sc->bge_asicrev != BGE_ASICREV_BCM5906)) { if (bge_read_eeprom(sc, (caddr_t)&hwcfg, BGE_EE_HWCFG_OFFSET, @@ -3433,9 +3440,9 @@ bge_reset(struct bge_softc *sc) /* * Write the magic number to SRAM at offset 0xB50. * When firmware finishes its initialization it will - * write ~BGE_MAGIC_NUMBER to the same location. + * write ~BGE_SRAM_FW_MB_MAGIC to the same location. */ - bge_writemem_ind(sc, BGE_SOFTWARE_GENCOMM, BGE_MAGIC_NUMBER); + bge_writemem_ind(sc, BGE_SRAM_FW_MB, BGE_SRAM_FW_MB_MAGIC); reset = BGE_MISCCFG_RESET_CORE_CLOCKS | BGE_32BITTIME_66MHZ; @@ -3560,8 +3567,8 @@ bge_reset(struct bge_softc *sc) */ for (i = 0; i < BGE_TIMEOUT; i++) { DELAY(10); - val = bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM); - if (val == ~BGE_MAGIC_NUMBER) + val = bge_readmem_ind(sc, BGE_SRAM_FW_MB); + if (val == ~BGE_SRAM_FW_MB_MAGIC) break; } @@ -4096,12 +4103,14 @@ bge_asf_driver_up(struct bge_softc *sc) sc->bge_asf_count --; else { sc->bge_asf_count = 2; - bge_writemem_ind(sc, BGE_SOFTWARE_GENCOMM_FW, - BGE_FW_DRV_ALIVE); - bge_writemem_ind(sc, BGE_SOFTWARE_GENNCOMM_FW_LEN, 4); - bge_writemem_ind(sc, BGE_SOFTWARE_GENNCOMM_FW_DATA, 3); - CSR_WRITE_4(sc, BGE_CPU_EVENT, - CSR_READ_4(sc, BGE_CPU_EVENT) | (1 << 14)); + bge_writemem_ind(sc, BGE_SRAM_FW_CMD_MB, + BGE_FW_CMD_DRV_ALIVE); + bge_writemem_ind(sc, BGE_SRAM_FW_CMD_LEN_MB, 4); + bge_writemem_ind(sc, BGE_SRAM_FW_CMD_DATA_MB, + BGE_FW_HB_TIMEOUT_SEC); + CSR_WRITE_4(sc, BGE_RX_CPU_EVENT, + CSR_READ_4(sc, BGE_RX_CPU_EVENT) | + BGE_RX_CPU_DRV_EVENT); } } } @@ -5934,11 +5943,11 @@ bge_get_eaddr_mem(struct bge_softc *sc, { uint32_t mac_addr; - mac_addr = bge_readmem_ind(sc, 0x0c14); + mac_addr = bge_readmem_ind(sc, BGE_SRAM_MAC_ADDR_HIGH_MB); if ((mac_addr >> 16) == 0x484b) { ether_addr[0] = (uint8_t)(mac_addr >> 8); ether_addr[1] = (uint8_t)mac_addr; - mac_addr = bge_readmem_ind(sc, 0x0c18); + mac_addr = bge_readmem_ind(sc, BGE_SRAM_MAC_ADDR_LOW_MB); ether_addr[2] = (uint8_t)(mac_addr >> 24); ether_addr[3] = (uint8_t)(mac_addr >> 16); ether_addr[4] = (uint8_t)(mac_addr >> 8); Modified: stable/7/sys/dev/bge/if_bgereg.h ============================================================================== --- stable/7/sys/dev/bge/if_bgereg.h Tue Jan 3 00:24:44 2012 (r229355) +++ stable/7/sys/dev/bge/if_bgereg.h Tue Jan 3 00:26:11 2012 (r229356) @@ -71,12 +71,15 @@ #define BGE_STATS_BLOCK_END 0x00000AFF #define BGE_STATUS_BLOCK 0x00000B00 #define BGE_STATUS_BLOCK_END 0x00000B4F -#define BGE_SOFTWARE_GENCOMM 0x00000B50 -#define BGE_SOFTWARE_GENCOMM_SIG 0x00000B54 -#define BGE_SOFTWARE_GENCOMM_NICCFG 0x00000B58 -#define BGE_SOFTWARE_GENCOMM_FW 0x00000B78 -#define BGE_SOFTWARE_GENNCOMM_FW_LEN 0x00000B7C -#define BGE_SOFTWARE_GENNCOMM_FW_DATA 0x00000B80 +#define BGE_SRAM_FW_MB 0x00000B50 +#define BGE_SRAM_DATA_SIG 0x00000B54 +#define BGE_SRAM_DATA_CFG 0x00000B58 +#define BGE_SRAM_FW_CMD_MB 0x00000B78 +#define BGE_SRAM_FW_CMD_LEN_MB 0x00000B7C +#define BGE_SRAM_FW_CMD_DATA_MB 0x00000B80 +#define BGE_SRAM_FW_DRV_STATE_MB 0x00000C04 +#define BGE_SRAM_MAC_ADDR_HIGH_MB 0x00000C14 +#define BGE_SRAM_MAC_ADDR_LOW_MB 0x00000C18 #define BGE_SOFTWARE_GENCOMM_END 0x00000FFF #define BGE_UNMAPPED 0x00001000 #define BGE_UNMAPPED_END 0x00001FFF @@ -87,8 +90,24 @@ #define BGE_SEND_RING_1_TO_4_END 0x00005FFF /* Firmware interface */ -#define BGE_FW_DRV_ALIVE 0x00000001 -#define BGE_FW_PAUSE 0x00000002 +#define BGE_SRAM_DATA_SIG_MAGIC 0x4B657654 /* 'KevT' */ + +#define BGE_FW_CMD_DRV_ALIVE 0x00000001 +#define BGE_FW_CMD_PAUSE 0x00000002 +#define BGE_FW_CMD_IPV4_ADDR_CHANGE 0x00000003 +#define BGE_FW_CMD_IPV6_ADDR_CHANGE 0x00000004 +#define BGE_FW_CMD_LINK_UPDATE 0x0000000C +#define BGE_FW_CMD_DRV_ALIVE2 0x0000000D +#define BGE_FW_CMD_DRV_ALIVE3 0x0000000E + +#define BGE_FW_HB_TIMEOUT_SEC 3 + +#define BGE_FW_DRV_STATE_START 0x00000001 +#define BGE_FW_DRV_STATE_START_DONE 0x80000001 +#define BGE_FW_DRV_STATE_UNLOAD 0x00000002 +#define BGE_FW_DRV_STATE_UNLOAD_DONE 0x80000002 +#define BGE_FW_DRV_STATE_WOL 0x00000003 +#define BGE_FW_DRV_STATE_SUSPEND 0x00000004 /* Mappings for internal memory configuration */ #define BGE_STD_RX_RINGS 0x00006000 @@ -1875,7 +1894,8 @@ #define BGE_MODE_CTL 0x6800 #define BGE_MISC_CFG 0x6804 #define BGE_MISC_LOCAL_CTL 0x6808 -#define BGE_CPU_EVENT 0x6810 +#define BGE_RX_CPU_EVENT 0x6810 +#define BGE_TX_CPU_EVENT 0x6820 #define BGE_EE_ADDR 0x6838 #define BGE_EE_DATA 0x683C #define BGE_EE_CTL 0x6840 @@ -1883,6 +1903,8 @@ #define BGE_EE_DELAY 0x6848 #define BGE_FASTBOOT_PC 0x6894 +#define BGE_RX_CPU_DRV_EVENT 0x00004000 + /* * NVRAM Control registers */ @@ -2052,10 +2074,10 @@ * This magic number is written to the firmware mailbox at 0xb50 * before a software reset is issued. After the internal firmware * has completed its initialization it will write the opposite of - * this value, ~BGE_MAGIC_NUMBER, to the same location, allowing the - * driver to synchronize with the firmware. + * this value, ~BGE_SRAM_FW_MB_MAGIC, to the same location, + * allowing the driver to synchronize with the firmware. */ -#define BGE_MAGIC_NUMBER 0x4B657654 +#define BGE_SRAM_FW_MB_MAGIC 0x4B657654 typedef struct { uint32_t bge_addr_hi; From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 00:41:33 2012 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 C2BA41065672; Tue, 3 Jan 2012 00:41:33 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-vw0-f54.google.com (mail-vw0-f54.google.com [209.85.212.54]) by mx1.freebsd.org (Postfix) with ESMTP id 1A2438FC20; Tue, 3 Jan 2012 00:41:32 +0000 (UTC) Received: by vbbfr13 with SMTP id fr13so21306110vbb.13 for ; Mon, 02 Jan 2012 16:41:32 -0800 (PST) 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:cc:content-type :content-transfer-encoding; bh=l1xG4N2C6llgOcPuyNb6pr7ssGhn0xbJin4iG9jZR7c=; b=vAVuwYge1cDjqKsluFRQXo9l/YFjSTrtOl/lRxyZIeqtROMaHcAXu3tGPpu08IQi62 07JFS6D1AJ85N4w5IZMl7eUfVNXfM1NBlpJy+jWYc1ehFsNZFiLsXUjvJ5OYs5q9jLU1 4gSzOnvQt6DB3oPEAINsyUFuNRQO03XjRM79Q= MIME-Version: 1.0 Received: by 10.52.33.99 with SMTP id q3mr23600106vdi.100.1325551292539; Mon, 02 Jan 2012 16:41:32 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.52.36.5 with HTTP; Mon, 2 Jan 2012 16:41:32 -0800 (PST) In-Reply-To: <201201021602.q02G2UEF073751@svn.freebsd.org> References: <201201021602.q02G2UEF073751@svn.freebsd.org> Date: Mon, 2 Jan 2012 16:41:32 -0800 X-Google-Sender-Auth: KYgF1TQ1vgG-Ja2fTurBL7RekEY Message-ID: From: Adrian Chadd To: Bernhard Schmidt Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r229284 - head/sys/net80211 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, 03 Jan 2012 00:41:33 -0000 On 2 January 2012 08:02, Bernhard Schmidt wrote: > Author: bschmidt > Date: Mon Jan =A02 16:02:30 2012 > New Revision: 229284 > URL: http://svn.freebsd.org/changeset/base/229284 > > Log: > =A0MCS32 equals 32, not 8*ic_txstream. Good catch! Can you MFC it to 9/8 ? Adrian From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 00:45:14 2012 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 A03CE106566B; Tue, 3 Jan 2012 00:45:14 +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 6FAF28FC12; Tue, 3 Jan 2012 00:45: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 q030jEuv097381; Tue, 3 Jan 2012 00:45:14 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q030jEDl097378; Tue, 3 Jan 2012 00:45:14 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201030045.q030jEDl097378@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 00:45:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229357 - stable/9/sys/dev/mii 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, 03 Jan 2012 00:45:14 -0000 Author: yongari Date: Tue Jan 3 00:45:14 2012 New Revision: 229357 URL: http://svn.freebsd.org/changeset/base/229357 Log: MFC r226870: Recognize BCM5720C PHY. Modified: stable/9/sys/dev/mii/brgphy.c stable/9/sys/dev/mii/miidevs Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/mii/brgphy.c ============================================================================== --- stable/9/sys/dev/mii/brgphy.c Tue Jan 3 00:26:11 2012 (r229356) +++ stable/9/sys/dev/mii/brgphy.c Tue Jan 3 00:45:14 2012 (r229357) @@ -141,6 +141,7 @@ static const struct mii_phydesc brgphys[ MII_PHY_DESC(BROADCOM2, BCM5784), MII_PHY_DESC(BROADCOM3, BCM5717C), MII_PHY_DESC(BROADCOM3, BCM5719C), + MII_PHY_DESC(BROADCOM3, BCM5720C), MII_PHY_DESC(BROADCOM3, BCM57765), MII_PHY_DESC(xxBROADCOM_ALT1, BCM5906), MII_PHY_END Modified: stable/9/sys/dev/mii/miidevs ============================================================================== --- stable/9/sys/dev/mii/miidevs Tue Jan 3 00:26:11 2012 (r229356) +++ stable/9/sys/dev/mii/miidevs Tue Jan 3 00:45:14 2012 (r229357) @@ -179,6 +179,7 @@ model BROADCOM2 BCM5709S 0x003f BCM5709S model BROADCOM3 BCM5717C 0x0020 BCM5717C 1000BASE-T media interface model BROADCOM3 BCM5719C 0x0022 BCM5719C 1000BASE-T media interface model BROADCOM3 BCM57765 0x0024 BCM57765 1000BASE-T media interface +model BROADCOM3 BCM5720C 0x0036 BCM5720C 1000BASE-T media interface model xxBROADCOM_ALT1 BCM5906 0x0004 BCM5906 10/100baseTX media interface /* Cicada Semiconductor PHYs (now owned by Vitesse?) */ From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 00:47:54 2012 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 8B6951065672; Tue, 3 Jan 2012 00:47:54 +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 755128FC08; Tue, 3 Jan 2012 00:47: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 q030lsWe097493; Tue, 3 Jan 2012 00:47:54 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q030lsF8097490; Tue, 3 Jan 2012 00:47:54 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201030047.q030lsF8097490@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 00:47: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: r229358 - stable/8/sys/dev/mii 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, 03 Jan 2012 00:47:54 -0000 Author: yongari Date: Tue Jan 3 00:47:54 2012 New Revision: 229358 URL: http://svn.freebsd.org/changeset/base/229358 Log: Recognize BCM5720C PHY. This is a direct commit to stable/8. Modified: stable/8/sys/dev/mii/brgphy.c stable/8/sys/dev/mii/miidevs Modified: stable/8/sys/dev/mii/brgphy.c ============================================================================== --- stable/8/sys/dev/mii/brgphy.c Tue Jan 3 00:45:14 2012 (r229357) +++ stable/8/sys/dev/mii/brgphy.c Tue Jan 3 00:47:54 2012 (r229358) @@ -143,6 +143,7 @@ static const struct mii_phydesc brgphys[ MII_PHY_DESC(xxBROADCOM_ALT1, BCM5709S), MII_PHY_DESC(xxBROADCOM_ALT2, BCM5717C), MII_PHY_DESC(xxBROADCOM_ALT2, BCM5719C), + MII_PHY_DESC(xxBROADCOM_ALT2, BCM5720C), MII_PHY_DESC(xxBROADCOM_ALT2, BCM57765), MII_PHY_DESC(BROADCOM2, BCM5906), MII_PHY_END Modified: stable/8/sys/dev/mii/miidevs ============================================================================== --- stable/8/sys/dev/mii/miidevs Tue Jan 3 00:45:14 2012 (r229357) +++ stable/8/sys/dev/mii/miidevs Tue Jan 3 00:47:54 2012 (r229358) @@ -160,6 +160,7 @@ model xxBROADCOM_ALT1 BCM5709S 0x003f BC model xxBROADCOM_ALT2 BCM5717C 0x0020 BCM5717C 10/100/1000baseTX PHY model xxBROADCOM_ALT2 BCM5719C 0x0022 BCM5719C 10/100/1000baseTX PHY model xxBROADCOM_ALT2 BCM57765 0x0024 BCM57765 10/100/1000baseTX PHY +model xxBROADCOM_ALT2 BCM5720C 0x0036 BCM5720C 10/100/1000baseTX PHY model BROADCOM2 BCM5906 0x0004 BCM5906 10/100baseTX PHY /* Cicada Semiconductor PHYs (now owned by Vitesse?) */ From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 00:49:12 2012 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 BA69C106566C; Tue, 3 Jan 2012 00:49:12 +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 A42BA8FC08; Tue, 3 Jan 2012 00:49:12 +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 q030nCsc097573; Tue, 3 Jan 2012 00:49:12 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q030nCSF097570; Tue, 3 Jan 2012 00:49:12 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201030049.q030nCSF097570@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 00:49:12 +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: r229359 - stable/7/sys/dev/mii 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, 03 Jan 2012 00:49:12 -0000 Author: yongari Date: Tue Jan 3 00:49:12 2012 New Revision: 229359 URL: http://svn.freebsd.org/changeset/base/229359 Log: Recognize BCM5720C PHY. This is a direct commit to stable/7. Modified: stable/7/sys/dev/mii/brgphy.c stable/7/sys/dev/mii/miidevs Modified: stable/7/sys/dev/mii/brgphy.c ============================================================================== --- stable/7/sys/dev/mii/brgphy.c Tue Jan 3 00:47:54 2012 (r229358) +++ stable/7/sys/dev/mii/brgphy.c Tue Jan 3 00:49:12 2012 (r229359) @@ -143,6 +143,7 @@ static const struct mii_phydesc brgphys[ MII_PHY_DESC(xxBROADCOM_ALT1, BCM5709S), MII_PHY_DESC(xxBROADCOM_ALT2, BCM5717C), MII_PHY_DESC(xxBROADCOM_ALT2, BCM5719C), + MII_PHY_DESC(xxBROADCOM_ALT2, BCM5720C), MII_PHY_DESC(xxBROADCOM_ALT2, BCM57765), MII_PHY_DESC(BROADCOM2, BCM5906), MII_PHY_END Modified: stable/7/sys/dev/mii/miidevs ============================================================================== --- stable/7/sys/dev/mii/miidevs Tue Jan 3 00:47:54 2012 (r229358) +++ stable/7/sys/dev/mii/miidevs Tue Jan 3 00:49:12 2012 (r229359) @@ -155,6 +155,7 @@ model xxBROADCOM_ALT1 BCM5709S 0x003f BC model xxBROADCOM_ALT2 BCM5717C 0x0020 BCM5717C 10/100/1000baseTX PHY model xxBROADCOM_ALT2 BCM5719C 0x0022 BCM5719C 10/100/1000baseTX PHY model xxBROADCOM_ALT2 BCM57765 0x0024 BCM57765 10/100/1000baseTX PHY +model xxBROADCOM_ALT2 BCM5720C 0x0036 BCM5720C 10/100/1000baseTX PHY model BROADCOM2 BCM5906 0x0004 BCM5906 10/100baseTX PHY /* Cicada Semiconductor PHYs (now owned by Vitesse?) */ From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 00:56:06 2012 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 5530D106566C; Tue, 3 Jan 2012 00:56:06 +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 3DDC88FC0A; Tue, 3 Jan 2012 00:56: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 q030u6CZ097899; Tue, 3 Jan 2012 00:56:06 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q030u6ZR097896; Tue, 3 Jan 2012 00:56:06 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201030056.q030u6ZR097896@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 00:56:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229360 - stable/9/sys/dev/bge 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, 03 Jan 2012 00:56:06 -0000 Author: yongari Date: Tue Jan 3 00:56:05 2012 New Revision: 229360 URL: http://svn.freebsd.org/changeset/base/229360 Log: MFC r226871-226872: r226871: Add initial BCM5720 support. Many thanks to Broadcom for continuing support of FreeBSD. Submitted by: Geans Pin at Broadcom (initial version) H/W donated by: Broadcom r226872: Disable updating InputDiscards counter for BCM5717, BCM5718, BCM5719 A0 and BCM5720 A0 and add comment why driver does not try to read it. Modified: stable/9/sys/dev/bge/if_bge.c stable/9/sys/dev/bge/if_bgereg.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/bge/if_bge.c ============================================================================== --- stable/9/sys/dev/bge/if_bge.c Tue Jan 3 00:49:12 2012 (r229359) +++ stable/9/sys/dev/bge/if_bge.c Tue Jan 3 00:56:05 2012 (r229360) @@ -301,6 +301,7 @@ static const struct bge_revision { { BGE_CHIPID_BCM5717_A0, "BCM5717 A0" }, { BGE_CHIPID_BCM5717_B0, "BCM5717 B0" }, { BGE_CHIPID_BCM5719_A0, "BCM5719 A0" }, + { BGE_CHIPID_BCM5720_A0, "BCM5720 A0" }, { BGE_CHIPID_BCM5755_A0, "BCM5755 A0" }, { BGE_CHIPID_BCM5755_A1, "BCM5755 A1" }, { BGE_CHIPID_BCM5755_A2, "BCM5755 A2" }, @@ -349,6 +350,7 @@ static const struct bge_revision const b { BGE_ASICREV_BCM57780, "unknown BCM57780" }, { BGE_ASICREV_BCM5717, "unknown BCM5717" }, { BGE_ASICREV_BCM5719, "unknown BCM5719" }, + { BGE_ASICREV_BCM5720, "unknown BCM5720" }, { 0, NULL } }; @@ -437,6 +439,7 @@ static int bge_init_tx_ring(struct bge_s static int bge_chipinit(struct bge_softc *); static int bge_blockinit(struct bge_softc *); +static uint32_t bge_dma_swap_options(struct bge_softc *); static int bge_has_eaddr(struct bge_softc *); static uint32_t bge_readmem_ind(struct bge_softc *, int); @@ -1377,13 +1380,31 @@ bge_stop_fw(struct bge_softc *sc) } } +static uint32_t +bge_dma_swap_options(struct bge_softc *sc) +{ + uint32_t dma_options; + + dma_options = BGE_MODECTL_WORDSWAP_NONFRAME | + BGE_MODECTL_BYTESWAP_DATA | BGE_MODECTL_WORDSWAP_DATA; +#if BYTE_ORDER == BIG_ENDIAN + dma_options |= BGE_MODECTL_BYTESWAP_NONFRAME; +#endif + if ((sc)->bge_asicrev == BGE_ASICREV_BCM5720) + dma_options |= BGE_MODECTL_BYTESWAP_B2HRX_DATA | + BGE_MODECTL_WORDSWAP_B2HRX_DATA | BGE_MODECTL_B2HRX_ENABLE | + BGE_MODECTL_HTX2B_ENABLE; + + return (dma_options); +} + /* * Do endian, PCI and DMA initialization. */ static int bge_chipinit(struct bge_softc *sc) { - uint32_t dma_rw_ctl, misc_ctl; + uint32_t dma_rw_ctl, misc_ctl, mode_ctl; uint16_t val; int i; @@ -1501,9 +1522,8 @@ bge_chipinit(struct bge_softc *sc) /* * Set up general mode register. */ - CSR_WRITE_4(sc, BGE_MODE_CTL, BGE_DMA_SWAP_OPTIONS | - BGE_MODECTL_MAC_ATTN_INTR | BGE_MODECTL_HOST_SEND_BDS | - BGE_MODECTL_TX_NO_PHDR_CSUM); + mode_ctl = bge_dma_swap_options(sc) | BGE_MODECTL_MAC_ATTN_INTR | + BGE_MODECTL_HOST_SEND_BDS | BGE_MODECTL_TX_NO_PHDR_CSUM; /* * BCM5701 B5 have a bug causing data corruption when using @@ -1513,13 +1533,15 @@ bge_chipinit(struct bge_softc *sc) */ if (sc->bge_asicrev == BGE_ASICREV_BCM5701 && sc->bge_chipid == BGE_CHIPID_BCM5701_B5) - BGE_SETBIT(sc, BGE_MODE_CTL, BGE_MODECTL_FORCE_PCI32); + mode_ctl |= BGE_MODECTL_FORCE_PCI32; /* * Tell the firmware the driver is running */ if (sc->bge_asf_mode & ASF_STACKUP) - BGE_SETBIT(sc, BGE_MODE_CTL, BGE_MODECTL_STACKUP); + mode_ctl |= BGE_MODECTL_STACKUP; + + CSR_WRITE_4(sc, BGE_MODE_CTL, mode_ctl); /* * Disable memory write invalidate. Apparently it is not supported @@ -1579,8 +1601,7 @@ bge_blockinit(struct bge_softc *sc) } /* Configure mbuf pool watermarks */ - if (sc->bge_asicrev == BGE_ASICREV_BCM5717 || - sc->bge_asicrev == BGE_ASICREV_BCM57765) { + if (BGE_IS_5717_PLUS(sc)) { CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x0); if (sc->bge_ifp->if_mtu > ETHERMTU) { CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x7e); @@ -1715,7 +1736,8 @@ bge_blockinit(struct bge_softc *sc) BGE_RCB_MAXLEN_FLAGS(BGE_MAX_FRAMELEN, 0); } if (sc->bge_asicrev == BGE_ASICREV_BCM5717 || - sc->bge_asicrev == BGE_ASICREV_BCM5719) + sc->bge_asicrev == BGE_ASICREV_BCM5719 || + sc->bge_asicrev == BGE_ASICREV_BCM5720) rcb->bge_nicaddr = BGE_STD_RX_RINGS_5717; else rcb->bge_nicaddr = BGE_STD_RX_RINGS; @@ -1748,7 +1770,8 @@ bge_blockinit(struct bge_softc *sc) rcb->bge_maxlen_flags = BGE_RCB_MAXLEN_FLAGS(0, BGE_RCB_FLAG_USE_EXT_RX_BD | BGE_RCB_FLAG_RING_DISABLED); if (sc->bge_asicrev == BGE_ASICREV_BCM5717 || - sc->bge_asicrev == BGE_ASICREV_BCM5719) + sc->bge_asicrev == BGE_ASICREV_BCM5719 || + sc->bge_asicrev == BGE_ASICREV_BCM5720) rcb->bge_nicaddr = BGE_JUMBO_RX_RINGS_5717; else rcb->bge_nicaddr = BGE_JUMBO_RX_RINGS; @@ -1837,7 +1860,8 @@ bge_blockinit(struct bge_softc *sc) RCB_WRITE_4(sc, vrcb, bge_hostaddr.bge_addr_hi, taddr.bge_addr_hi); RCB_WRITE_4(sc, vrcb, bge_hostaddr.bge_addr_lo, taddr.bge_addr_lo); if (sc->bge_asicrev == BGE_ASICREV_BCM5717 || - sc->bge_asicrev == BGE_ASICREV_BCM5719) + sc->bge_asicrev == BGE_ASICREV_BCM5719 || + sc->bge_asicrev == BGE_ASICREV_BCM5720) RCB_WRITE_4(sc, vrcb, bge_nicaddr, BGE_SEND_RING_5717); else RCB_WRITE_4(sc, vrcb, bge_nicaddr, @@ -1851,7 +1875,8 @@ bge_blockinit(struct bge_softc *sc) * return ring control blocks, located in NIC memory. */ if (sc->bge_asicrev == BGE_ASICREV_BCM5717 || - sc->bge_asicrev == BGE_ASICREV_BCM5719) { + sc->bge_asicrev == BGE_ASICREV_BCM5719 || + sc->bge_asicrev == BGE_ASICREV_BCM5720) { /* Should be 17, use 16 until we get an SRAM map. */ limit = 16; } else if (!BGE_IS_5705_PLUS(sc)) @@ -1895,7 +1920,11 @@ bge_blockinit(struct bge_softc *sc) BGE_TX_BACKOFF_SEED_MASK); /* Set inter-packet gap */ - CSR_WRITE_4(sc, BGE_TX_LENGTHS, 0x2620); + val = 0x2620; + if (sc->bge_asicrev == BGE_ASICREV_BCM5720) + val |= CSR_READ_4(sc, BGE_TX_LENGTHS) & + (BGE_TXLEN_JMB_FRM_LEN_MSK | BGE_TXLEN_CNT_DN_VAL_MSK); + CSR_WRITE_4(sc, BGE_TX_LENGTHS, val); /* * Specify which ring to use for packets that don't match @@ -2050,6 +2079,11 @@ bge_blockinit(struct bge_softc *sc) sc->bge_asicrev == BGE_ASICREV_BCM57780) val |= BGE_RDMAMODE_TSO6_ENABLE; } + + if (sc->bge_asicrev == BGE_ASICREV_BCM5720) + val |= CSR_READ_4(sc, BGE_RDMA_MODE) & + BGE_RDMAMODE_H2BNC_VLAN_DET; + if (sc->bge_asicrev == BGE_ASICREV_BCM5761 || sc->bge_asicrev == BGE_ASICREV_BCM5784 || sc->bge_asicrev == BGE_ASICREV_BCM5785 || @@ -2060,7 +2094,8 @@ bge_blockinit(struct bge_softc *sc) * Adjust tx margin to prevent TX data corruption and * fix internal FIFO overflow. */ - if (sc->bge_asicrev == BGE_ASICREV_BCM5719) { + if (sc->bge_asicrev == BGE_ASICREV_BCM5719 || + sc->bge_asicrev == BGE_ASICREV_BCM5720) { dmactl &= ~(BGE_RDMA_RSRVCTRL_FIFO_LWM_MASK | BGE_RDMA_RSRVCTRL_FIFO_HWM_MASK | BGE_RDMA_RSRVCTRL_TXMRGN_MASK); @@ -2077,7 +2112,8 @@ bge_blockinit(struct bge_softc *sc) BGE_RDMA_RSRVCTRL_FIFO_OFLW_FIX); } - if (sc->bge_asicrev == BGE_ASICREV_BCM5719) { + if (sc->bge_asicrev == BGE_ASICREV_BCM5719 || + sc->bge_asicrev == BGE_ASICREV_BCM5720) { CSR_WRITE_4(sc, BGE_RDMA_LSO_CRPTEN_CTRL, CSR_READ_4(sc, BGE_RDMA_LSO_CRPTEN_CTRL) | BGE_RDMA_LSO_CRPTEN_CTRL_BLEN_BD_4K | @@ -2236,6 +2272,7 @@ bge_probe(device_t dev) case BCOM_DEVICEID_BCM5717: case BCOM_DEVICEID_BCM5718: case BCOM_DEVICEID_BCM5719: + case BCOM_DEVICEID_BCM5720: id = pci_read_config(dev, BGE_PCI_GEN2_PRODID_ASICREV, 4); break; @@ -2760,6 +2797,7 @@ bge_attach(device_t dev) case BCOM_DEVICEID_BCM5717: case BCOM_DEVICEID_BCM5718: case BCOM_DEVICEID_BCM5719: + case BCOM_DEVICEID_BCM5720: sc->bge_chipid = pci_read_config(dev, BGE_PCI_GEN2_PRODID_ASICREV, 4); break; @@ -2791,12 +2829,14 @@ bge_attach(device_t dev) * BCM5704 | 1 | X | 1 | X | * BCM5717 | 1 | 8 | 2 | 9 | * BCM5719 | 1 | 8 | 2 | 9 | + * BCM5720 | 1 | 8 | 2 | 9 | * * Other addresses may respond but they are not * IEEE compliant PHYs and should be ignored. */ if (sc->bge_asicrev == BGE_ASICREV_BCM5717 || - sc->bge_asicrev == BGE_ASICREV_BCM5719) { + sc->bge_asicrev == BGE_ASICREV_BCM5719 || + sc->bge_asicrev == BGE_ASICREV_BCM5720) { f = pci_get_function(dev); if (sc->bge_chipid == BGE_CHIPID_BCM5717_A0) { if (CSR_READ_4(sc, BGE_SGDIG_STS) & @@ -2831,6 +2871,7 @@ bge_attach(device_t dev) switch (sc->bge_asicrev) { case BGE_ASICREV_BCM5717: case BGE_ASICREV_BCM5719: + case BGE_ASICREV_BCM5720: case BGE_ASICREV_BCM57765: sc->bge_flags |= BGE_FLAG_5717_PLUS | BGE_FLAG_5755_PLUS | BGE_FLAG_575X_PLUS | BGE_FLAG_5705_PLUS | BGE_FLAG_JUMBO | @@ -2886,6 +2927,7 @@ bge_attach(device_t dev) sc->bge_asicrev != BGE_ASICREV_BCM5906 && sc->bge_asicrev != BGE_ASICREV_BCM5717 && sc->bge_asicrev != BGE_ASICREV_BCM5719 && + sc->bge_asicrev != BGE_ASICREV_BCM5720 && sc->bge_asicrev != BGE_ASICREV_BCM5785 && sc->bge_asicrev != BGE_ASICREV_BCM57765 && sc->bge_asicrev != BGE_ASICREV_BCM57780) { @@ -3006,7 +3048,8 @@ bge_attach(device_t dev) */ sc->bge_flags |= BGE_FLAG_PCIE; sc->bge_expcap = reg; - if (sc->bge_asicrev == BGE_ASICREV_BCM5719) + if (sc->bge_asicrev == BGE_ASICREV_BCM5719 || + sc->bge_asicrev == BGE_ASICREV_BCM5720) pci_set_max_read_req(dev, 2048); else if (pci_get_max_read_req(dev) != 4096) pci_set_max_read_req(dev, 4096); @@ -3592,8 +3635,7 @@ bge_reset(struct bge_softc *sc) } /* Fix up byte swapping. */ - CSR_WRITE_4(sc, BGE_MODE_CTL, BGE_DMA_SWAP_OPTIONS | - BGE_MODECTL_BYTESWAP_DATA); + CSR_WRITE_4(sc, BGE_MODE_CTL, bge_dma_swap_options(sc)); /* Tell the ASF firmware we are up */ if (sc->bge_asf_mode & ASF_STACKUP) @@ -3624,6 +3666,10 @@ bge_reset(struct bge_softc *sc) } DELAY(10000); + if (sc->bge_asicrev == BGE_ASICREV_BCM5720) + BGE_CLRBIT(sc, BGE_CPMU_CLCK_ORIDE, + CPMU_CLCK_ORIDE_MAC_ORIDE_EN); + return (0); } @@ -4241,8 +4287,30 @@ bge_stats_update_regs(struct bge_softc * CSR_READ_4(sc, BGE_RXLP_LOCSTAT_DMA_HPWRQ_FULL); stats->NoMoreRxBDs += CSR_READ_4(sc, BGE_RXLP_LOCSTAT_OUT_OF_BDS); - stats->InputDiscards += - CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_DROPS); + /* + * XXX + * Unlike other controllers, BGE_RXLP_LOCSTAT_IFIN_DROPS + * counter of BCM5717, BCM5718, BCM5719 A0 and BCM5720 A0 + * includes number of unwanted multicast frames. This comes + * from silicon bug and known workaround to get rough(not + * exact) counter is to enable interrupt on MBUF low water + * attention. This can be accomplished by setting + * BGE_HCCMODE_ATTN bit of BGE_HCC_MODE, + * BGE_BMANMODE_LOMBUF_ATTN bit of BGE_BMAN_MODE and + * BGE_MODECTL_FLOWCTL_ATTN_INTR bit of BGE_MODE_CTL. + * However that change would generate more interrupts and + * there are still possibilities of losing multiple frames + * during BGE_MODECTL_FLOWCTL_ATTN_INTR interrupt handling. + * Given that the workaround still would not get correct + * counter I don't think it's worth to implement it. So + * ignore reading the counter on controllers that have the + * silicon bug. + */ + if (sc->bge_asicrev != BGE_ASICREV_BCM5717 && + sc->bge_chipid != BGE_CHIPID_BCM5719_A0 && + sc->bge_chipid != BGE_CHIPID_BCM5720_A0) + stats->InputDiscards += + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_DROPS); stats->InputErrors += CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_ERRORS); stats->RecvThresholdHit += @@ -4838,6 +4906,11 @@ bge_init_locked(struct bge_softc *sc) mode = CSR_READ_4(sc, BGE_TX_MODE); if (BGE_IS_5755_PLUS(sc) || sc->bge_asicrev == BGE_ASICREV_BCM5906) mode |= BGE_TXMODE_MBUF_LOCKUP_FIX; + if (sc->bge_asicrev == BGE_ASICREV_BCM5720) { + mode &= ~(BGE_TXMODE_JMB_FRM_LEN | BGE_TXMODE_CNT_DN_MODE); + mode |= CSR_READ_4(sc, BGE_TX_MODE) & + (BGE_TXMODE_JMB_FRM_LEN | BGE_TXMODE_CNT_DN_MODE); + } /* Turn on transmitter. */ CSR_WRITE_4(sc, BGE_TX_MODE, mode | BGE_TXMODE_ENABLE); Modified: stable/9/sys/dev/bge/if_bgereg.h ============================================================================== --- stable/9/sys/dev/bge/if_bgereg.h Tue Jan 3 00:49:12 2012 (r229359) +++ stable/9/sys/dev/bge/if_bgereg.h Tue Jan 3 00:56:05 2012 (r229360) @@ -258,15 +258,6 @@ #define BGE_PCIMISCCTL_ASICREV_SHIFT 16 #define BGE_HIF_SWAP_OPTIONS (BGE_PCIMISCCTL_ENDIAN_WORDSWAP) -#if BYTE_ORDER == LITTLE_ENDIAN -#define BGE_DMA_SWAP_OPTIONS \ - BGE_MODECTL_WORDSWAP_NONFRAME| \ - BGE_MODECTL_BYTESWAP_DATA|BGE_MODECTL_WORDSWAP_DATA -#else -#define BGE_DMA_SWAP_OPTIONS \ - BGE_MODECTL_WORDSWAP_NONFRAME|BGE_MODECTL_BYTESWAP_NONFRAME| \ - BGE_MODECTL_BYTESWAP_DATA|BGE_MODECTL_WORDSWAP_DATA -#endif #define BGE_INIT \ (BGE_HIF_SWAP_OPTIONS|BGE_PCIMISCCTL_CLEAR_INTA| \ @@ -339,6 +330,7 @@ #define BGE_CHIPID_BCM5717_A0 0x05717000 #define BGE_CHIPID_BCM5717_B0 0x05717100 #define BGE_CHIPID_BCM5719_A0 0x05719000 +#define BGE_CHIPID_BCM5720_A0 0x05720000 #define BGE_CHIPID_BCM57765_A0 0x57785000 #define BGE_CHIPID_BCM57765_B0 0x57785100 @@ -363,6 +355,7 @@ /* BGE_PCI_PRODID_ASICREV ASIC rev. identifiers. */ #define BGE_ASICREV_BCM5717 0x5717 #define BGE_ASICREV_BCM5719 0x5719 +#define BGE_ASICREV_BCM5720 0x5720 #define BGE_ASICREV_BCM5761 0x5761 #define BGE_ASICREV_BCM5784 0x5784 #define BGE_ASICREV_BCM5785 0x5785 @@ -807,6 +800,8 @@ #define BGE_TXMODE_BIGBACKOFF_ENABLE 0x00000020 #define BGE_TXMODE_LONGPAUSE_ENABLE 0x00000040 #define BGE_TXMODE_MBUF_LOCKUP_FIX 0x00000100 +#define BGE_TXMODE_JMB_FRM_LEN 0x00400000 +#define BGE_TXMODE_CNT_DN_MODE 0x00800000 /* Transmit MAC status register */ #define BGE_TXSTAT_RX_XOFFED 0x00000001 @@ -820,6 +815,8 @@ #define BGE_TXLEN_SLOTTIME 0x000000FF #define BGE_TXLEN_IPG 0x00000F00 #define BGE_TXLEN_CRS 0x00003000 +#define BGE_TXLEN_JMB_FRM_LEN_MSK 0x00FF0000 +#define BGE_TXLEN_CNT_DN_VAL_MSK 0xFF000000 /* Receive MAC mode register */ #define BGE_RXMODE_RESET 0x00000001 @@ -1277,6 +1274,7 @@ #define BGE_CPMU_LSPD_1000MB_CLK 0x360C #define BGE_CPMU_LNK_AWARE_PWRMD 0x3610 #define BGE_CPMU_HST_ACC 0x361C +#define BGE_CPMU_CLCK_ORIDE 0x3624 #define BGE_CPMU_CLCK_STAT 0x3630 #define BGE_CPMU_MUTEX_REQ 0x365C #define BGE_CPMU_MUTEX_GNT 0x3660 @@ -1304,6 +1302,9 @@ #define BGE_CPMU_HST_ACC_MACCLK_MASK 0x001F0000 #define BGE_CPMU_HST_ACC_MACCLK_6_25 0x00130000 +/* Clock Speed Override Policy register */ +#define CPMU_CLCK_ORIDE_MAC_ORIDE_EN 0x80000000 + /* CPMU Clock Status register */ #define BGE_CPMU_CLCK_STAT_MAC_CLCK_MASK 0x001F0000 #define BGE_CPMU_CLCK_STAT_MAC_CLCK_62_5 0x00000000 @@ -1551,6 +1552,7 @@ #define BGE_RDMAMODE_MULT_DMA_RD_DIS 0x01000000 #define BGE_RDMAMODE_TSO4_ENABLE 0x08000000 #define BGE_RDMAMODE_TSO6_ENABLE 0x10000000 +#define BGE_RDMAMODE_H2BNC_VLAN_DET 0x20000000 /* Read DMA status register */ #define BGE_RDMASTAT_PCI_TGT_ABRT_ATTN 0x00000004 @@ -1961,14 +1963,18 @@ #define BGE_MODECTL_WORDSWAP_NONFRAME 0x00000004 #define BGE_MODECTL_BYTESWAP_DATA 0x00000010 #define BGE_MODECTL_WORDSWAP_DATA 0x00000020 +#define BGE_MODECTL_BYTESWAP_B2HRX_DATA 0x00000040 +#define BGE_MODECTL_WORDSWAP_B2HRX_DATA 0x00000080 #define BGE_MODECTL_NO_FRAME_CRACKING 0x00000200 #define BGE_MODECTL_NO_RX_CRC 0x00000400 #define BGE_MODECTL_RX_BADFRAMES 0x00000800 #define BGE_MODECTL_NO_TX_INTR 0x00002000 #define BGE_MODECTL_NO_RX_INTR 0x00004000 #define BGE_MODECTL_FORCE_PCI32 0x00008000 +#define BGE_MODECTL_B2HRX_ENABLE 0x00008000 #define BGE_MODECTL_STACKUP 0x00010000 #define BGE_MODECTL_HOST_SEND_BDS 0x00020000 +#define BGE_MODECTL_HTX2B_ENABLE 0x00040000 #define BGE_MODECTL_TX_NO_PHDR_CSUM 0x00100000 #define BGE_MODECTL_RX_NO_PHDR_CSUM 0x00800000 #define BGE_MODECTL_TX_ATTN_INTR 0x01000000 @@ -2298,7 +2304,8 @@ struct bge_status_block { #define BCOM_DEVICEID_BCM5717 0x1655 #define BCOM_DEVICEID_BCM5718 0x1656 #define BCOM_DEVICEID_BCM5719 0x1657 -#define BCOM_DEVICEID_BCM5720 0x1658 +#define BCOM_DEVICEID_BCM5720_PP 0x1658 /* Not released to public. */ +#define BCOM_DEVICEID_BCM5720 0x165F #define BCOM_DEVICEID_BCM5721 0x1659 #define BCOM_DEVICEID_BCM5722 0x165A #define BCOM_DEVICEID_BCM5723 0x165B From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 01:02:26 2012 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 B3CED1065687; Tue, 3 Jan 2012 01:02:26 +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 89D1A8FC15; Tue, 3 Jan 2012 01:02: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 q0312Q0f098192; Tue, 3 Jan 2012 01:02:26 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0312Q2u098189; Tue, 3 Jan 2012 01:02:26 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201030102.q0312Q2u098189@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 01:02:26 +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: r229361 - in stable/8/sys: conf dev/bge 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, 03 Jan 2012 01:02:26 -0000 Author: yongari Date: Tue Jan 3 01:02:26 2012 New Revision: 229361 URL: http://svn.freebsd.org/changeset/base/229361 Log: MFC r226871-226872: r226871: Add initial BCM5720 support. Many thanks to Broadcom for continuing support of FreeBSD. Submitted by: Geans Pin at Broadcom (initial version) H/W donated by: Broadcom r226872: Disable updating InputDiscards counter for BCM5717, BCM5718, BCM5719 A0 and BCM5720 A0 and add comment why driver does not try to read it. Modified: stable/8/sys/dev/bge/if_bge.c stable/8/sys/dev/bge/if_bgereg.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/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/bge/if_bge.c ============================================================================== --- stable/8/sys/dev/bge/if_bge.c Tue Jan 3 00:56:05 2012 (r229360) +++ stable/8/sys/dev/bge/if_bge.c Tue Jan 3 01:02:26 2012 (r229361) @@ -301,6 +301,7 @@ static const struct bge_revision { { BGE_CHIPID_BCM5717_A0, "BCM5717 A0" }, { BGE_CHIPID_BCM5717_B0, "BCM5717 B0" }, { BGE_CHIPID_BCM5719_A0, "BCM5719 A0" }, + { BGE_CHIPID_BCM5720_A0, "BCM5720 A0" }, { BGE_CHIPID_BCM5755_A0, "BCM5755 A0" }, { BGE_CHIPID_BCM5755_A1, "BCM5755 A1" }, { BGE_CHIPID_BCM5755_A2, "BCM5755 A2" }, @@ -349,6 +350,7 @@ static const struct bge_revision const b { BGE_ASICREV_BCM57780, "unknown BCM57780" }, { BGE_ASICREV_BCM5717, "unknown BCM5717" }, { BGE_ASICREV_BCM5719, "unknown BCM5719" }, + { BGE_ASICREV_BCM5720, "unknown BCM5720" }, { 0, NULL } }; @@ -437,6 +439,7 @@ static int bge_init_tx_ring(struct bge_s static int bge_chipinit(struct bge_softc *); static int bge_blockinit(struct bge_softc *); +static uint32_t bge_dma_swap_options(struct bge_softc *); static int bge_has_eaddr(struct bge_softc *); static uint32_t bge_readmem_ind(struct bge_softc *, int); @@ -1381,13 +1384,31 @@ bge_stop_fw(struct bge_softc *sc) } } +static uint32_t +bge_dma_swap_options(struct bge_softc *sc) +{ + uint32_t dma_options; + + dma_options = BGE_MODECTL_WORDSWAP_NONFRAME | + BGE_MODECTL_BYTESWAP_DATA | BGE_MODECTL_WORDSWAP_DATA; +#if BYTE_ORDER == BIG_ENDIAN + dma_options |= BGE_MODECTL_BYTESWAP_NONFRAME; +#endif + if ((sc)->bge_asicrev == BGE_ASICREV_BCM5720) + dma_options |= BGE_MODECTL_BYTESWAP_B2HRX_DATA | + BGE_MODECTL_WORDSWAP_B2HRX_DATA | BGE_MODECTL_B2HRX_ENABLE | + BGE_MODECTL_HTX2B_ENABLE; + + return (dma_options); +} + /* * Do endian, PCI and DMA initialization. */ static int bge_chipinit(struct bge_softc *sc) { - uint32_t dma_rw_ctl, misc_ctl; + uint32_t dma_rw_ctl, misc_ctl, mode_ctl; uint16_t val; int i; @@ -1505,9 +1526,8 @@ bge_chipinit(struct bge_softc *sc) /* * Set up general mode register. */ - CSR_WRITE_4(sc, BGE_MODE_CTL, BGE_DMA_SWAP_OPTIONS | - BGE_MODECTL_MAC_ATTN_INTR | BGE_MODECTL_HOST_SEND_BDS | - BGE_MODECTL_TX_NO_PHDR_CSUM); + mode_ctl = bge_dma_swap_options(sc) | BGE_MODECTL_MAC_ATTN_INTR | + BGE_MODECTL_HOST_SEND_BDS | BGE_MODECTL_TX_NO_PHDR_CSUM; /* * BCM5701 B5 have a bug causing data corruption when using @@ -1517,13 +1537,15 @@ bge_chipinit(struct bge_softc *sc) */ if (sc->bge_asicrev == BGE_ASICREV_BCM5701 && sc->bge_chipid == BGE_CHIPID_BCM5701_B5) - BGE_SETBIT(sc, BGE_MODE_CTL, BGE_MODECTL_FORCE_PCI32); + mode_ctl |= BGE_MODECTL_FORCE_PCI32; /* * Tell the firmware the driver is running */ if (sc->bge_asf_mode & ASF_STACKUP) - BGE_SETBIT(sc, BGE_MODE_CTL, BGE_MODECTL_STACKUP); + mode_ctl |= BGE_MODECTL_STACKUP; + + CSR_WRITE_4(sc, BGE_MODE_CTL, mode_ctl); /* * Disable memory write invalidate. Apparently it is not supported @@ -1583,8 +1605,7 @@ bge_blockinit(struct bge_softc *sc) } /* Configure mbuf pool watermarks */ - if (sc->bge_asicrev == BGE_ASICREV_BCM5717 || - sc->bge_asicrev == BGE_ASICREV_BCM57765) { + if (BGE_IS_5717_PLUS(sc)) { CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x0); if (sc->bge_ifp->if_mtu > ETHERMTU) { CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x7e); @@ -1719,7 +1740,8 @@ bge_blockinit(struct bge_softc *sc) BGE_RCB_MAXLEN_FLAGS(BGE_MAX_FRAMELEN, 0); } if (sc->bge_asicrev == BGE_ASICREV_BCM5717 || - sc->bge_asicrev == BGE_ASICREV_BCM5719) + sc->bge_asicrev == BGE_ASICREV_BCM5719 || + sc->bge_asicrev == BGE_ASICREV_BCM5720) rcb->bge_nicaddr = BGE_STD_RX_RINGS_5717; else rcb->bge_nicaddr = BGE_STD_RX_RINGS; @@ -1752,7 +1774,8 @@ bge_blockinit(struct bge_softc *sc) rcb->bge_maxlen_flags = BGE_RCB_MAXLEN_FLAGS(0, BGE_RCB_FLAG_USE_EXT_RX_BD | BGE_RCB_FLAG_RING_DISABLED); if (sc->bge_asicrev == BGE_ASICREV_BCM5717 || - sc->bge_asicrev == BGE_ASICREV_BCM5719) + sc->bge_asicrev == BGE_ASICREV_BCM5719 || + sc->bge_asicrev == BGE_ASICREV_BCM5720) rcb->bge_nicaddr = BGE_JUMBO_RX_RINGS_5717; else rcb->bge_nicaddr = BGE_JUMBO_RX_RINGS; @@ -1841,7 +1864,8 @@ bge_blockinit(struct bge_softc *sc) RCB_WRITE_4(sc, vrcb, bge_hostaddr.bge_addr_hi, taddr.bge_addr_hi); RCB_WRITE_4(sc, vrcb, bge_hostaddr.bge_addr_lo, taddr.bge_addr_lo); if (sc->bge_asicrev == BGE_ASICREV_BCM5717 || - sc->bge_asicrev == BGE_ASICREV_BCM5719) + sc->bge_asicrev == BGE_ASICREV_BCM5719 || + sc->bge_asicrev == BGE_ASICREV_BCM5720) RCB_WRITE_4(sc, vrcb, bge_nicaddr, BGE_SEND_RING_5717); else RCB_WRITE_4(sc, vrcb, bge_nicaddr, @@ -1855,7 +1879,8 @@ bge_blockinit(struct bge_softc *sc) * return ring control blocks, located in NIC memory. */ if (sc->bge_asicrev == BGE_ASICREV_BCM5717 || - sc->bge_asicrev == BGE_ASICREV_BCM5719) { + sc->bge_asicrev == BGE_ASICREV_BCM5719 || + sc->bge_asicrev == BGE_ASICREV_BCM5720) { /* Should be 17, use 16 until we get an SRAM map. */ limit = 16; } else if (!BGE_IS_5705_PLUS(sc)) @@ -1899,7 +1924,11 @@ bge_blockinit(struct bge_softc *sc) BGE_TX_BACKOFF_SEED_MASK); /* Set inter-packet gap */ - CSR_WRITE_4(sc, BGE_TX_LENGTHS, 0x2620); + val = 0x2620; + if (sc->bge_asicrev == BGE_ASICREV_BCM5720) + val |= CSR_READ_4(sc, BGE_TX_LENGTHS) & + (BGE_TXLEN_JMB_FRM_LEN_MSK | BGE_TXLEN_CNT_DN_VAL_MSK); + CSR_WRITE_4(sc, BGE_TX_LENGTHS, val); /* * Specify which ring to use for packets that don't match @@ -2054,6 +2083,11 @@ bge_blockinit(struct bge_softc *sc) sc->bge_asicrev == BGE_ASICREV_BCM57780) val |= BGE_RDMAMODE_TSO6_ENABLE; } + + if (sc->bge_asicrev == BGE_ASICREV_BCM5720) + val |= CSR_READ_4(sc, BGE_RDMA_MODE) & + BGE_RDMAMODE_H2BNC_VLAN_DET; + if (sc->bge_asicrev == BGE_ASICREV_BCM5761 || sc->bge_asicrev == BGE_ASICREV_BCM5784 || sc->bge_asicrev == BGE_ASICREV_BCM5785 || @@ -2064,7 +2098,8 @@ bge_blockinit(struct bge_softc *sc) * Adjust tx margin to prevent TX data corruption and * fix internal FIFO overflow. */ - if (sc->bge_asicrev == BGE_ASICREV_BCM5719) { + if (sc->bge_asicrev == BGE_ASICREV_BCM5719 || + sc->bge_asicrev == BGE_ASICREV_BCM5720) { dmactl &= ~(BGE_RDMA_RSRVCTRL_FIFO_LWM_MASK | BGE_RDMA_RSRVCTRL_FIFO_HWM_MASK | BGE_RDMA_RSRVCTRL_TXMRGN_MASK); @@ -2081,7 +2116,8 @@ bge_blockinit(struct bge_softc *sc) BGE_RDMA_RSRVCTRL_FIFO_OFLW_FIX); } - if (sc->bge_asicrev == BGE_ASICREV_BCM5719) { + if (sc->bge_asicrev == BGE_ASICREV_BCM5719 || + sc->bge_asicrev == BGE_ASICREV_BCM5720) { CSR_WRITE_4(sc, BGE_RDMA_LSO_CRPTEN_CTRL, CSR_READ_4(sc, BGE_RDMA_LSO_CRPTEN_CTRL) | BGE_RDMA_LSO_CRPTEN_CTRL_BLEN_BD_4K | @@ -2240,6 +2276,7 @@ bge_probe(device_t dev) case BCOM_DEVICEID_BCM5717: case BCOM_DEVICEID_BCM5718: case BCOM_DEVICEID_BCM5719: + case BCOM_DEVICEID_BCM5720: id = pci_read_config(dev, BGE_PCI_GEN2_PRODID_ASICREV, 4); break; @@ -2764,6 +2801,7 @@ bge_attach(device_t dev) case BCOM_DEVICEID_BCM5717: case BCOM_DEVICEID_BCM5718: case BCOM_DEVICEID_BCM5719: + case BCOM_DEVICEID_BCM5720: sc->bge_chipid = pci_read_config(dev, BGE_PCI_GEN2_PRODID_ASICREV, 4); break; @@ -2795,12 +2833,14 @@ bge_attach(device_t dev) * BCM5704 | 1 | X | 1 | X | * BCM5717 | 1 | 8 | 2 | 9 | * BCM5719 | 1 | 8 | 2 | 9 | + * BCM5720 | 1 | 8 | 2 | 9 | * * Other addresses may respond but they are not * IEEE compliant PHYs and should be ignored. */ if (sc->bge_asicrev == BGE_ASICREV_BCM5717 || - sc->bge_asicrev == BGE_ASICREV_BCM5719) { + sc->bge_asicrev == BGE_ASICREV_BCM5719 || + sc->bge_asicrev == BGE_ASICREV_BCM5720) { f = pci_get_function(dev); if (sc->bge_chipid == BGE_CHIPID_BCM5717_A0) { if (CSR_READ_4(sc, BGE_SGDIG_STS) & @@ -2835,6 +2875,7 @@ bge_attach(device_t dev) switch (sc->bge_asicrev) { case BGE_ASICREV_BCM5717: case BGE_ASICREV_BCM5719: + case BGE_ASICREV_BCM5720: case BGE_ASICREV_BCM57765: sc->bge_flags |= BGE_FLAG_5717_PLUS | BGE_FLAG_5755_PLUS | BGE_FLAG_575X_PLUS | BGE_FLAG_5705_PLUS | BGE_FLAG_JUMBO | @@ -2890,6 +2931,7 @@ bge_attach(device_t dev) sc->bge_asicrev != BGE_ASICREV_BCM5906 && sc->bge_asicrev != BGE_ASICREV_BCM5717 && sc->bge_asicrev != BGE_ASICREV_BCM5719 && + sc->bge_asicrev != BGE_ASICREV_BCM5720 && sc->bge_asicrev != BGE_ASICREV_BCM5785 && sc->bge_asicrev != BGE_ASICREV_BCM57765 && sc->bge_asicrev != BGE_ASICREV_BCM57780) { @@ -3010,7 +3052,8 @@ bge_attach(device_t dev) */ sc->bge_flags |= BGE_FLAG_PCIE; sc->bge_expcap = reg; - if (sc->bge_asicrev == BGE_ASICREV_BCM5719) + if (sc->bge_asicrev == BGE_ASICREV_BCM5719 || + sc->bge_asicrev == BGE_ASICREV_BCM5720) pci_set_max_read_req(dev, 2048); else if (pci_get_max_read_req(dev) != 4096) pci_set_max_read_req(dev, 4096); @@ -3596,8 +3639,7 @@ bge_reset(struct bge_softc *sc) } /* Fix up byte swapping. */ - CSR_WRITE_4(sc, BGE_MODE_CTL, BGE_DMA_SWAP_OPTIONS | - BGE_MODECTL_BYTESWAP_DATA); + CSR_WRITE_4(sc, BGE_MODE_CTL, bge_dma_swap_options(sc)); /* Tell the ASF firmware we are up */ if (sc->bge_asf_mode & ASF_STACKUP) @@ -3628,6 +3670,10 @@ bge_reset(struct bge_softc *sc) } DELAY(10000); + if (sc->bge_asicrev == BGE_ASICREV_BCM5720) + BGE_CLRBIT(sc, BGE_CPMU_CLCK_ORIDE, + CPMU_CLCK_ORIDE_MAC_ORIDE_EN); + return (0); } @@ -4245,8 +4291,30 @@ bge_stats_update_regs(struct bge_softc * CSR_READ_4(sc, BGE_RXLP_LOCSTAT_DMA_HPWRQ_FULL); stats->NoMoreRxBDs += CSR_READ_4(sc, BGE_RXLP_LOCSTAT_OUT_OF_BDS); - stats->InputDiscards += - CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_DROPS); + /* + * XXX + * Unlike other controllers, BGE_RXLP_LOCSTAT_IFIN_DROPS + * counter of BCM5717, BCM5718, BCM5719 A0 and BCM5720 A0 + * includes number of unwanted multicast frames. This comes + * from silicon bug and known workaround to get rough(not + * exact) counter is to enable interrupt on MBUF low water + * attention. This can be accomplished by setting + * BGE_HCCMODE_ATTN bit of BGE_HCC_MODE, + * BGE_BMANMODE_LOMBUF_ATTN bit of BGE_BMAN_MODE and + * BGE_MODECTL_FLOWCTL_ATTN_INTR bit of BGE_MODE_CTL. + * However that change would generate more interrupts and + * there are still possibilities of losing multiple frames + * during BGE_MODECTL_FLOWCTL_ATTN_INTR interrupt handling. + * Given that the workaround still would not get correct + * counter I don't think it's worth to implement it. So + * ignore reading the counter on controllers that have the + * silicon bug. + */ + if (sc->bge_asicrev != BGE_ASICREV_BCM5717 && + sc->bge_chipid != BGE_CHIPID_BCM5719_A0 && + sc->bge_chipid != BGE_CHIPID_BCM5720_A0) + stats->InputDiscards += + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_DROPS); stats->InputErrors += CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_ERRORS); stats->RecvThresholdHit += @@ -4842,6 +4910,11 @@ bge_init_locked(struct bge_softc *sc) mode = CSR_READ_4(sc, BGE_TX_MODE); if (BGE_IS_5755_PLUS(sc) || sc->bge_asicrev == BGE_ASICREV_BCM5906) mode |= BGE_TXMODE_MBUF_LOCKUP_FIX; + if (sc->bge_asicrev == BGE_ASICREV_BCM5720) { + mode &= ~(BGE_TXMODE_JMB_FRM_LEN | BGE_TXMODE_CNT_DN_MODE); + mode |= CSR_READ_4(sc, BGE_TX_MODE) & + (BGE_TXMODE_JMB_FRM_LEN | BGE_TXMODE_CNT_DN_MODE); + } /* Turn on transmitter. */ CSR_WRITE_4(sc, BGE_TX_MODE, mode | BGE_TXMODE_ENABLE); Modified: stable/8/sys/dev/bge/if_bgereg.h ============================================================================== --- stable/8/sys/dev/bge/if_bgereg.h Tue Jan 3 00:56:05 2012 (r229360) +++ stable/8/sys/dev/bge/if_bgereg.h Tue Jan 3 01:02:26 2012 (r229361) @@ -258,15 +258,6 @@ #define BGE_PCIMISCCTL_ASICREV_SHIFT 16 #define BGE_HIF_SWAP_OPTIONS (BGE_PCIMISCCTL_ENDIAN_WORDSWAP) -#if BYTE_ORDER == LITTLE_ENDIAN -#define BGE_DMA_SWAP_OPTIONS \ - BGE_MODECTL_WORDSWAP_NONFRAME| \ - BGE_MODECTL_BYTESWAP_DATA|BGE_MODECTL_WORDSWAP_DATA -#else -#define BGE_DMA_SWAP_OPTIONS \ - BGE_MODECTL_WORDSWAP_NONFRAME|BGE_MODECTL_BYTESWAP_NONFRAME| \ - BGE_MODECTL_BYTESWAP_DATA|BGE_MODECTL_WORDSWAP_DATA -#endif #define BGE_INIT \ (BGE_HIF_SWAP_OPTIONS|BGE_PCIMISCCTL_CLEAR_INTA| \ @@ -339,6 +330,7 @@ #define BGE_CHIPID_BCM5717_A0 0x05717000 #define BGE_CHIPID_BCM5717_B0 0x05717100 #define BGE_CHIPID_BCM5719_A0 0x05719000 +#define BGE_CHIPID_BCM5720_A0 0x05720000 #define BGE_CHIPID_BCM57765_A0 0x57785000 #define BGE_CHIPID_BCM57765_B0 0x57785100 @@ -363,6 +355,7 @@ /* BGE_PCI_PRODID_ASICREV ASIC rev. identifiers. */ #define BGE_ASICREV_BCM5717 0x5717 #define BGE_ASICREV_BCM5719 0x5719 +#define BGE_ASICREV_BCM5720 0x5720 #define BGE_ASICREV_BCM5761 0x5761 #define BGE_ASICREV_BCM5784 0x5784 #define BGE_ASICREV_BCM5785 0x5785 @@ -807,6 +800,8 @@ #define BGE_TXMODE_BIGBACKOFF_ENABLE 0x00000020 #define BGE_TXMODE_LONGPAUSE_ENABLE 0x00000040 #define BGE_TXMODE_MBUF_LOCKUP_FIX 0x00000100 +#define BGE_TXMODE_JMB_FRM_LEN 0x00400000 +#define BGE_TXMODE_CNT_DN_MODE 0x00800000 /* Transmit MAC status register */ #define BGE_TXSTAT_RX_XOFFED 0x00000001 @@ -820,6 +815,8 @@ #define BGE_TXLEN_SLOTTIME 0x000000FF #define BGE_TXLEN_IPG 0x00000F00 #define BGE_TXLEN_CRS 0x00003000 +#define BGE_TXLEN_JMB_FRM_LEN_MSK 0x00FF0000 +#define BGE_TXLEN_CNT_DN_VAL_MSK 0xFF000000 /* Receive MAC mode register */ #define BGE_RXMODE_RESET 0x00000001 @@ -1277,6 +1274,7 @@ #define BGE_CPMU_LSPD_1000MB_CLK 0x360C #define BGE_CPMU_LNK_AWARE_PWRMD 0x3610 #define BGE_CPMU_HST_ACC 0x361C +#define BGE_CPMU_CLCK_ORIDE 0x3624 #define BGE_CPMU_CLCK_STAT 0x3630 #define BGE_CPMU_MUTEX_REQ 0x365C #define BGE_CPMU_MUTEX_GNT 0x3660 @@ -1304,6 +1302,9 @@ #define BGE_CPMU_HST_ACC_MACCLK_MASK 0x001F0000 #define BGE_CPMU_HST_ACC_MACCLK_6_25 0x00130000 +/* Clock Speed Override Policy register */ +#define CPMU_CLCK_ORIDE_MAC_ORIDE_EN 0x80000000 + /* CPMU Clock Status register */ #define BGE_CPMU_CLCK_STAT_MAC_CLCK_MASK 0x001F0000 #define BGE_CPMU_CLCK_STAT_MAC_CLCK_62_5 0x00000000 @@ -1551,6 +1552,7 @@ #define BGE_RDMAMODE_MULT_DMA_RD_DIS 0x01000000 #define BGE_RDMAMODE_TSO4_ENABLE 0x08000000 #define BGE_RDMAMODE_TSO6_ENABLE 0x10000000 +#define BGE_RDMAMODE_H2BNC_VLAN_DET 0x20000000 /* Read DMA status register */ #define BGE_RDMASTAT_PCI_TGT_ABRT_ATTN 0x00000004 @@ -1961,14 +1963,18 @@ #define BGE_MODECTL_WORDSWAP_NONFRAME 0x00000004 #define BGE_MODECTL_BYTESWAP_DATA 0x00000010 #define BGE_MODECTL_WORDSWAP_DATA 0x00000020 +#define BGE_MODECTL_BYTESWAP_B2HRX_DATA 0x00000040 +#define BGE_MODECTL_WORDSWAP_B2HRX_DATA 0x00000080 #define BGE_MODECTL_NO_FRAME_CRACKING 0x00000200 #define BGE_MODECTL_NO_RX_CRC 0x00000400 #define BGE_MODECTL_RX_BADFRAMES 0x00000800 #define BGE_MODECTL_NO_TX_INTR 0x00002000 #define BGE_MODECTL_NO_RX_INTR 0x00004000 #define BGE_MODECTL_FORCE_PCI32 0x00008000 +#define BGE_MODECTL_B2HRX_ENABLE 0x00008000 #define BGE_MODECTL_STACKUP 0x00010000 #define BGE_MODECTL_HOST_SEND_BDS 0x00020000 +#define BGE_MODECTL_HTX2B_ENABLE 0x00040000 #define BGE_MODECTL_TX_NO_PHDR_CSUM 0x00100000 #define BGE_MODECTL_RX_NO_PHDR_CSUM 0x00800000 #define BGE_MODECTL_TX_ATTN_INTR 0x01000000 @@ -2298,7 +2304,8 @@ struct bge_status_block { #define BCOM_DEVICEID_BCM5717 0x1655 #define BCOM_DEVICEID_BCM5718 0x1656 #define BCOM_DEVICEID_BCM5719 0x1657 -#define BCOM_DEVICEID_BCM5720 0x1658 +#define BCOM_DEVICEID_BCM5720_PP 0x1658 /* Not released to public. */ +#define BCOM_DEVICEID_BCM5720 0x165F #define BCOM_DEVICEID_BCM5721 0x1659 #define BCOM_DEVICEID_BCM5722 0x165A #define BCOM_DEVICEID_BCM5723 0x165B From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 01:07:02 2012 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 6A5F71065676; Tue, 3 Jan 2012 01:07:02 +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 528D38FC1C; Tue, 3 Jan 2012 01: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 q03172Dr098380; Tue, 3 Jan 2012 01:07:02 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03172B1098377; Tue, 3 Jan 2012 01:07:02 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201030107.q03172B1098377@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 01:07:02 +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: r229362 - stable/7/sys/dev/bge 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, 03 Jan 2012 01:07:02 -0000 Author: yongari Date: Tue Jan 3 01:07:02 2012 New Revision: 229362 URL: http://svn.freebsd.org/changeset/base/229362 Log: MFC r226871-226872: r226871: Add initial BCM5720 support. Many thanks to Broadcom for continuing support of FreeBSD. Submitted by: Geans Pin at Broadcom (initial version) H/W donated by: Broadcom r226872: Disable updating InputDiscards counter for BCM5717, BCM5718, BCM5719 A0 and BCM5720 A0 and add comment why driver does not try to read it. Modified: stable/7/sys/dev/bge/if_bge.c stable/7/sys/dev/bge/if_bgereg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/bge/if_bge.c ============================================================================== --- stable/7/sys/dev/bge/if_bge.c Tue Jan 3 01:02:26 2012 (r229361) +++ stable/7/sys/dev/bge/if_bge.c Tue Jan 3 01:07:02 2012 (r229362) @@ -301,6 +301,7 @@ static const struct bge_revision { { BGE_CHIPID_BCM5717_A0, "BCM5717 A0" }, { BGE_CHIPID_BCM5717_B0, "BCM5717 B0" }, { BGE_CHIPID_BCM5719_A0, "BCM5719 A0" }, + { BGE_CHIPID_BCM5720_A0, "BCM5720 A0" }, { BGE_CHIPID_BCM5755_A0, "BCM5755 A0" }, { BGE_CHIPID_BCM5755_A1, "BCM5755 A1" }, { BGE_CHIPID_BCM5755_A2, "BCM5755 A2" }, @@ -349,6 +350,7 @@ static const struct bge_revision const b { BGE_ASICREV_BCM57780, "unknown BCM57780" }, { BGE_ASICREV_BCM5717, "unknown BCM5717" }, { BGE_ASICREV_BCM5719, "unknown BCM5719" }, + { BGE_ASICREV_BCM5720, "unknown BCM5720" }, { 0, NULL } }; @@ -437,6 +439,7 @@ static int bge_init_tx_ring(struct bge_s static int bge_chipinit(struct bge_softc *); static int bge_blockinit(struct bge_softc *); +static uint32_t bge_dma_swap_options(struct bge_softc *); static int bge_has_eaddr(struct bge_softc *); static uint32_t bge_readmem_ind(struct bge_softc *, int); @@ -1381,13 +1384,31 @@ bge_stop_fw(struct bge_softc *sc) } } +static uint32_t +bge_dma_swap_options(struct bge_softc *sc) +{ + uint32_t dma_options; + + dma_options = BGE_MODECTL_WORDSWAP_NONFRAME | + BGE_MODECTL_BYTESWAP_DATA | BGE_MODECTL_WORDSWAP_DATA; +#if BYTE_ORDER == BIG_ENDIAN + dma_options |= BGE_MODECTL_BYTESWAP_NONFRAME; +#endif + if ((sc)->bge_asicrev == BGE_ASICREV_BCM5720) + dma_options |= BGE_MODECTL_BYTESWAP_B2HRX_DATA | + BGE_MODECTL_WORDSWAP_B2HRX_DATA | BGE_MODECTL_B2HRX_ENABLE | + BGE_MODECTL_HTX2B_ENABLE; + + return (dma_options); +} + /* * Do endian, PCI and DMA initialization. */ static int bge_chipinit(struct bge_softc *sc) { - uint32_t dma_rw_ctl, misc_ctl; + uint32_t dma_rw_ctl, misc_ctl, mode_ctl; uint16_t val; int i; @@ -1505,9 +1526,8 @@ bge_chipinit(struct bge_softc *sc) /* * Set up general mode register. */ - CSR_WRITE_4(sc, BGE_MODE_CTL, BGE_DMA_SWAP_OPTIONS | - BGE_MODECTL_MAC_ATTN_INTR | BGE_MODECTL_HOST_SEND_BDS | - BGE_MODECTL_TX_NO_PHDR_CSUM); + mode_ctl = bge_dma_swap_options(sc) | BGE_MODECTL_MAC_ATTN_INTR | + BGE_MODECTL_HOST_SEND_BDS | BGE_MODECTL_TX_NO_PHDR_CSUM; /* * BCM5701 B5 have a bug causing data corruption when using @@ -1517,13 +1537,15 @@ bge_chipinit(struct bge_softc *sc) */ if (sc->bge_asicrev == BGE_ASICREV_BCM5701 && sc->bge_chipid == BGE_CHIPID_BCM5701_B5) - BGE_SETBIT(sc, BGE_MODE_CTL, BGE_MODECTL_FORCE_PCI32); + mode_ctl |= BGE_MODECTL_FORCE_PCI32; /* * Tell the firmware the driver is running */ if (sc->bge_asf_mode & ASF_STACKUP) - BGE_SETBIT(sc, BGE_MODE_CTL, BGE_MODECTL_STACKUP); + mode_ctl |= BGE_MODECTL_STACKUP; + + CSR_WRITE_4(sc, BGE_MODE_CTL, mode_ctl); /* * Disable memory write invalidate. Apparently it is not supported @@ -1583,8 +1605,7 @@ bge_blockinit(struct bge_softc *sc) } /* Configure mbuf pool watermarks */ - if (sc->bge_asicrev == BGE_ASICREV_BCM5717 || - sc->bge_asicrev == BGE_ASICREV_BCM57765) { + if (BGE_IS_5717_PLUS(sc)) { CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x0); if (sc->bge_ifp->if_mtu > ETHERMTU) { CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x7e); @@ -1719,7 +1740,8 @@ bge_blockinit(struct bge_softc *sc) BGE_RCB_MAXLEN_FLAGS(BGE_MAX_FRAMELEN, 0); } if (sc->bge_asicrev == BGE_ASICREV_BCM5717 || - sc->bge_asicrev == BGE_ASICREV_BCM5719) + sc->bge_asicrev == BGE_ASICREV_BCM5719 || + sc->bge_asicrev == BGE_ASICREV_BCM5720) rcb->bge_nicaddr = BGE_STD_RX_RINGS_5717; else rcb->bge_nicaddr = BGE_STD_RX_RINGS; @@ -1752,7 +1774,8 @@ bge_blockinit(struct bge_softc *sc) rcb->bge_maxlen_flags = BGE_RCB_MAXLEN_FLAGS(0, BGE_RCB_FLAG_USE_EXT_RX_BD | BGE_RCB_FLAG_RING_DISABLED); if (sc->bge_asicrev == BGE_ASICREV_BCM5717 || - sc->bge_asicrev == BGE_ASICREV_BCM5719) + sc->bge_asicrev == BGE_ASICREV_BCM5719 || + sc->bge_asicrev == BGE_ASICREV_BCM5720) rcb->bge_nicaddr = BGE_JUMBO_RX_RINGS_5717; else rcb->bge_nicaddr = BGE_JUMBO_RX_RINGS; @@ -1841,7 +1864,8 @@ bge_blockinit(struct bge_softc *sc) RCB_WRITE_4(sc, vrcb, bge_hostaddr.bge_addr_hi, taddr.bge_addr_hi); RCB_WRITE_4(sc, vrcb, bge_hostaddr.bge_addr_lo, taddr.bge_addr_lo); if (sc->bge_asicrev == BGE_ASICREV_BCM5717 || - sc->bge_asicrev == BGE_ASICREV_BCM5719) + sc->bge_asicrev == BGE_ASICREV_BCM5719 || + sc->bge_asicrev == BGE_ASICREV_BCM5720) RCB_WRITE_4(sc, vrcb, bge_nicaddr, BGE_SEND_RING_5717); else RCB_WRITE_4(sc, vrcb, bge_nicaddr, @@ -1855,7 +1879,8 @@ bge_blockinit(struct bge_softc *sc) * return ring control blocks, located in NIC memory. */ if (sc->bge_asicrev == BGE_ASICREV_BCM5717 || - sc->bge_asicrev == BGE_ASICREV_BCM5719) { + sc->bge_asicrev == BGE_ASICREV_BCM5719 || + sc->bge_asicrev == BGE_ASICREV_BCM5720) { /* Should be 17, use 16 until we get an SRAM map. */ limit = 16; } else if (!BGE_IS_5705_PLUS(sc)) @@ -1899,7 +1924,11 @@ bge_blockinit(struct bge_softc *sc) BGE_TX_BACKOFF_SEED_MASK); /* Set inter-packet gap */ - CSR_WRITE_4(sc, BGE_TX_LENGTHS, 0x2620); + val = 0x2620; + if (sc->bge_asicrev == BGE_ASICREV_BCM5720) + val |= CSR_READ_4(sc, BGE_TX_LENGTHS) & + (BGE_TXLEN_JMB_FRM_LEN_MSK | BGE_TXLEN_CNT_DN_VAL_MSK); + CSR_WRITE_4(sc, BGE_TX_LENGTHS, val); /* * Specify which ring to use for packets that don't match @@ -2054,6 +2083,11 @@ bge_blockinit(struct bge_softc *sc) sc->bge_asicrev == BGE_ASICREV_BCM57780) val |= BGE_RDMAMODE_TSO6_ENABLE; } + + if (sc->bge_asicrev == BGE_ASICREV_BCM5720) + val |= CSR_READ_4(sc, BGE_RDMA_MODE) & + BGE_RDMAMODE_H2BNC_VLAN_DET; + if (sc->bge_asicrev == BGE_ASICREV_BCM5761 || sc->bge_asicrev == BGE_ASICREV_BCM5784 || sc->bge_asicrev == BGE_ASICREV_BCM5785 || @@ -2064,7 +2098,8 @@ bge_blockinit(struct bge_softc *sc) * Adjust tx margin to prevent TX data corruption and * fix internal FIFO overflow. */ - if (sc->bge_asicrev == BGE_ASICREV_BCM5719) { + if (sc->bge_asicrev == BGE_ASICREV_BCM5719 || + sc->bge_asicrev == BGE_ASICREV_BCM5720) { dmactl &= ~(BGE_RDMA_RSRVCTRL_FIFO_LWM_MASK | BGE_RDMA_RSRVCTRL_FIFO_HWM_MASK | BGE_RDMA_RSRVCTRL_TXMRGN_MASK); @@ -2081,7 +2116,8 @@ bge_blockinit(struct bge_softc *sc) BGE_RDMA_RSRVCTRL_FIFO_OFLW_FIX); } - if (sc->bge_asicrev == BGE_ASICREV_BCM5719) { + if (sc->bge_asicrev == BGE_ASICREV_BCM5719 || + sc->bge_asicrev == BGE_ASICREV_BCM5720) { CSR_WRITE_4(sc, BGE_RDMA_LSO_CRPTEN_CTRL, CSR_READ_4(sc, BGE_RDMA_LSO_CRPTEN_CTRL) | BGE_RDMA_LSO_CRPTEN_CTRL_BLEN_BD_4K | @@ -2240,6 +2276,7 @@ bge_probe(device_t dev) case BCOM_DEVICEID_BCM5717: case BCOM_DEVICEID_BCM5718: case BCOM_DEVICEID_BCM5719: + case BCOM_DEVICEID_BCM5720: id = pci_read_config(dev, BGE_PCI_GEN2_PRODID_ASICREV, 4); break; @@ -2764,6 +2801,7 @@ bge_attach(device_t dev) case BCOM_DEVICEID_BCM5717: case BCOM_DEVICEID_BCM5718: case BCOM_DEVICEID_BCM5719: + case BCOM_DEVICEID_BCM5720: sc->bge_chipid = pci_read_config(dev, BGE_PCI_GEN2_PRODID_ASICREV, 4); break; @@ -2795,12 +2833,14 @@ bge_attach(device_t dev) * BCM5704 | 1 | X | 1 | X | * BCM5717 | 1 | 8 | 2 | 9 | * BCM5719 | 1 | 8 | 2 | 9 | + * BCM5720 | 1 | 8 | 2 | 9 | * * Other addresses may respond but they are not * IEEE compliant PHYs and should be ignored. */ if (sc->bge_asicrev == BGE_ASICREV_BCM5717 || - sc->bge_asicrev == BGE_ASICREV_BCM5719) { + sc->bge_asicrev == BGE_ASICREV_BCM5719 || + sc->bge_asicrev == BGE_ASICREV_BCM5720) { f = pci_get_function(dev); if (sc->bge_chipid == BGE_CHIPID_BCM5717_A0) { if (CSR_READ_4(sc, BGE_SGDIG_STS) & @@ -2835,6 +2875,7 @@ bge_attach(device_t dev) switch (sc->bge_asicrev) { case BGE_ASICREV_BCM5717: case BGE_ASICREV_BCM5719: + case BGE_ASICREV_BCM5720: case BGE_ASICREV_BCM57765: sc->bge_flags |= BGE_FLAG_5717_PLUS | BGE_FLAG_5755_PLUS | BGE_FLAG_575X_PLUS | BGE_FLAG_5705_PLUS | BGE_FLAG_JUMBO | @@ -2890,6 +2931,7 @@ bge_attach(device_t dev) sc->bge_asicrev != BGE_ASICREV_BCM5906 && sc->bge_asicrev != BGE_ASICREV_BCM5717 && sc->bge_asicrev != BGE_ASICREV_BCM5719 && + sc->bge_asicrev != BGE_ASICREV_BCM5720 && sc->bge_asicrev != BGE_ASICREV_BCM5785 && sc->bge_asicrev != BGE_ASICREV_BCM57765 && sc->bge_asicrev != BGE_ASICREV_BCM57780) { @@ -3010,7 +3052,8 @@ bge_attach(device_t dev) */ sc->bge_flags |= BGE_FLAG_PCIE; sc->bge_expcap = reg; - if (sc->bge_asicrev == BGE_ASICREV_BCM5719) + if (sc->bge_asicrev == BGE_ASICREV_BCM5719 || + sc->bge_asicrev == BGE_ASICREV_BCM5720) pci_set_max_read_req(dev, 2048); else if (pci_get_max_read_req(dev) != 4096) pci_set_max_read_req(dev, 4096); @@ -3596,8 +3639,7 @@ bge_reset(struct bge_softc *sc) } /* Fix up byte swapping. */ - CSR_WRITE_4(sc, BGE_MODE_CTL, BGE_DMA_SWAP_OPTIONS | - BGE_MODECTL_BYTESWAP_DATA); + CSR_WRITE_4(sc, BGE_MODE_CTL, bge_dma_swap_options(sc)); /* Tell the ASF firmware we are up */ if (sc->bge_asf_mode & ASF_STACKUP) @@ -3628,6 +3670,10 @@ bge_reset(struct bge_softc *sc) } DELAY(10000); + if (sc->bge_asicrev == BGE_ASICREV_BCM5720) + BGE_CLRBIT(sc, BGE_CPMU_CLCK_ORIDE, + CPMU_CLCK_ORIDE_MAC_ORIDE_EN); + return (0); } @@ -4241,8 +4287,30 @@ bge_stats_update_regs(struct bge_softc * CSR_READ_4(sc, BGE_RXLP_LOCSTAT_DMA_HPWRQ_FULL); stats->NoMoreRxBDs += CSR_READ_4(sc, BGE_RXLP_LOCSTAT_OUT_OF_BDS); - stats->InputDiscards += - CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_DROPS); + /* + * XXX + * Unlike other controllers, BGE_RXLP_LOCSTAT_IFIN_DROPS + * counter of BCM5717, BCM5718, BCM5719 A0 and BCM5720 A0 + * includes number of unwanted multicast frames. This comes + * from silicon bug and known workaround to get rough(not + * exact) counter is to enable interrupt on MBUF low water + * attention. This can be accomplished by setting + * BGE_HCCMODE_ATTN bit of BGE_HCC_MODE, + * BGE_BMANMODE_LOMBUF_ATTN bit of BGE_BMAN_MODE and + * BGE_MODECTL_FLOWCTL_ATTN_INTR bit of BGE_MODE_CTL. + * However that change would generate more interrupts and + * there are still possibilities of losing multiple frames + * during BGE_MODECTL_FLOWCTL_ATTN_INTR interrupt handling. + * Given that the workaround still would not get correct + * counter I don't think it's worth to implement it. So + * ignore reading the counter on controllers that have the + * silicon bug. + */ + if (sc->bge_asicrev != BGE_ASICREV_BCM5717 && + sc->bge_chipid != BGE_CHIPID_BCM5719_A0 && + sc->bge_chipid != BGE_CHIPID_BCM5720_A0) + stats->InputDiscards += + CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_DROPS); stats->InputErrors += CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_ERRORS); stats->RecvThresholdHit += @@ -4838,6 +4906,11 @@ bge_init_locked(struct bge_softc *sc) mode = CSR_READ_4(sc, BGE_TX_MODE); if (BGE_IS_5755_PLUS(sc) || sc->bge_asicrev == BGE_ASICREV_BCM5906) mode |= BGE_TXMODE_MBUF_LOCKUP_FIX; + if (sc->bge_asicrev == BGE_ASICREV_BCM5720) { + mode &= ~(BGE_TXMODE_JMB_FRM_LEN | BGE_TXMODE_CNT_DN_MODE); + mode |= CSR_READ_4(sc, BGE_TX_MODE) & + (BGE_TXMODE_JMB_FRM_LEN | BGE_TXMODE_CNT_DN_MODE); + } /* Turn on transmitter. */ CSR_WRITE_4(sc, BGE_TX_MODE, mode | BGE_TXMODE_ENABLE); Modified: stable/7/sys/dev/bge/if_bgereg.h ============================================================================== --- stable/7/sys/dev/bge/if_bgereg.h Tue Jan 3 01:02:26 2012 (r229361) +++ stable/7/sys/dev/bge/if_bgereg.h Tue Jan 3 01:07:02 2012 (r229362) @@ -258,15 +258,6 @@ #define BGE_PCIMISCCTL_ASICREV_SHIFT 16 #define BGE_HIF_SWAP_OPTIONS (BGE_PCIMISCCTL_ENDIAN_WORDSWAP) -#if BYTE_ORDER == LITTLE_ENDIAN -#define BGE_DMA_SWAP_OPTIONS \ - BGE_MODECTL_WORDSWAP_NONFRAME| \ - BGE_MODECTL_BYTESWAP_DATA|BGE_MODECTL_WORDSWAP_DATA -#else -#define BGE_DMA_SWAP_OPTIONS \ - BGE_MODECTL_WORDSWAP_NONFRAME|BGE_MODECTL_BYTESWAP_NONFRAME| \ - BGE_MODECTL_BYTESWAP_DATA|BGE_MODECTL_WORDSWAP_DATA -#endif #define BGE_INIT \ (BGE_HIF_SWAP_OPTIONS|BGE_PCIMISCCTL_CLEAR_INTA| \ @@ -339,6 +330,7 @@ #define BGE_CHIPID_BCM5717_A0 0x05717000 #define BGE_CHIPID_BCM5717_B0 0x05717100 #define BGE_CHIPID_BCM5719_A0 0x05719000 +#define BGE_CHIPID_BCM5720_A0 0x05720000 #define BGE_CHIPID_BCM57765_A0 0x57785000 #define BGE_CHIPID_BCM57765_B0 0x57785100 @@ -363,6 +355,7 @@ /* BGE_PCI_PRODID_ASICREV ASIC rev. identifiers. */ #define BGE_ASICREV_BCM5717 0x5717 #define BGE_ASICREV_BCM5719 0x5719 +#define BGE_ASICREV_BCM5720 0x5720 #define BGE_ASICREV_BCM5761 0x5761 #define BGE_ASICREV_BCM5784 0x5784 #define BGE_ASICREV_BCM5785 0x5785 @@ -807,6 +800,8 @@ #define BGE_TXMODE_BIGBACKOFF_ENABLE 0x00000020 #define BGE_TXMODE_LONGPAUSE_ENABLE 0x00000040 #define BGE_TXMODE_MBUF_LOCKUP_FIX 0x00000100 +#define BGE_TXMODE_JMB_FRM_LEN 0x00400000 +#define BGE_TXMODE_CNT_DN_MODE 0x00800000 /* Transmit MAC status register */ #define BGE_TXSTAT_RX_XOFFED 0x00000001 @@ -820,6 +815,8 @@ #define BGE_TXLEN_SLOTTIME 0x000000FF #define BGE_TXLEN_IPG 0x00000F00 #define BGE_TXLEN_CRS 0x00003000 +#define BGE_TXLEN_JMB_FRM_LEN_MSK 0x00FF0000 +#define BGE_TXLEN_CNT_DN_VAL_MSK 0xFF000000 /* Receive MAC mode register */ #define BGE_RXMODE_RESET 0x00000001 @@ -1277,6 +1274,7 @@ #define BGE_CPMU_LSPD_1000MB_CLK 0x360C #define BGE_CPMU_LNK_AWARE_PWRMD 0x3610 #define BGE_CPMU_HST_ACC 0x361C +#define BGE_CPMU_CLCK_ORIDE 0x3624 #define BGE_CPMU_CLCK_STAT 0x3630 #define BGE_CPMU_MUTEX_REQ 0x365C #define BGE_CPMU_MUTEX_GNT 0x3660 @@ -1304,6 +1302,9 @@ #define BGE_CPMU_HST_ACC_MACCLK_MASK 0x001F0000 #define BGE_CPMU_HST_ACC_MACCLK_6_25 0x00130000 +/* Clock Speed Override Policy register */ +#define CPMU_CLCK_ORIDE_MAC_ORIDE_EN 0x80000000 + /* CPMU Clock Status register */ #define BGE_CPMU_CLCK_STAT_MAC_CLCK_MASK 0x001F0000 #define BGE_CPMU_CLCK_STAT_MAC_CLCK_62_5 0x00000000 @@ -1551,6 +1552,7 @@ #define BGE_RDMAMODE_MULT_DMA_RD_DIS 0x01000000 #define BGE_RDMAMODE_TSO4_ENABLE 0x08000000 #define BGE_RDMAMODE_TSO6_ENABLE 0x10000000 +#define BGE_RDMAMODE_H2BNC_VLAN_DET 0x20000000 /* Read DMA status register */ #define BGE_RDMASTAT_PCI_TGT_ABRT_ATTN 0x00000004 @@ -1961,14 +1963,18 @@ #define BGE_MODECTL_WORDSWAP_NONFRAME 0x00000004 #define BGE_MODECTL_BYTESWAP_DATA 0x00000010 #define BGE_MODECTL_WORDSWAP_DATA 0x00000020 +#define BGE_MODECTL_BYTESWAP_B2HRX_DATA 0x00000040 +#define BGE_MODECTL_WORDSWAP_B2HRX_DATA 0x00000080 #define BGE_MODECTL_NO_FRAME_CRACKING 0x00000200 #define BGE_MODECTL_NO_RX_CRC 0x00000400 #define BGE_MODECTL_RX_BADFRAMES 0x00000800 #define BGE_MODECTL_NO_TX_INTR 0x00002000 #define BGE_MODECTL_NO_RX_INTR 0x00004000 #define BGE_MODECTL_FORCE_PCI32 0x00008000 +#define BGE_MODECTL_B2HRX_ENABLE 0x00008000 #define BGE_MODECTL_STACKUP 0x00010000 #define BGE_MODECTL_HOST_SEND_BDS 0x00020000 +#define BGE_MODECTL_HTX2B_ENABLE 0x00040000 #define BGE_MODECTL_TX_NO_PHDR_CSUM 0x00100000 #define BGE_MODECTL_RX_NO_PHDR_CSUM 0x00800000 #define BGE_MODECTL_TX_ATTN_INTR 0x01000000 @@ -2298,7 +2304,8 @@ struct bge_status_block { #define BCOM_DEVICEID_BCM5717 0x1655 #define BCOM_DEVICEID_BCM5718 0x1656 #define BCOM_DEVICEID_BCM5719 0x1657 -#define BCOM_DEVICEID_BCM5720 0x1658 +#define BCOM_DEVICEID_BCM5720_PP 0x1658 /* Not released to public. */ +#define BCOM_DEVICEID_BCM5720 0x165F #define BCOM_DEVICEID_BCM5721 0x1659 #define BCOM_DEVICEID_BCM5722 0x165A #define BCOM_DEVICEID_BCM5723 0x165B From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 01:07:32 2012 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 9476710656D2; Tue, 3 Jan 2012 01:07:32 +0000 (UTC) (envelope-from bschmidt@techwires.net) Received: from mail-ee0-f54.google.com (mail-ee0-f54.google.com [74.125.83.54]) by mx1.freebsd.org (Postfix) with ESMTP id 9CF7F8FC21; Tue, 3 Jan 2012 01:07:31 +0000 (UTC) Received: by eekc50 with SMTP id c50so18544676eek.13 for ; Mon, 02 Jan 2012 17:07:30 -0800 (PST) Received: by 10.14.35.101 with SMTP id t77mr20158234eea.21.1325552850332; Mon, 02 Jan 2012 17:07:30 -0800 (PST) Received: from amy.lab.techwires.net (dslb-088-067-219-219.pools.arcor-ip.net. [88.67.219.219]) by mx.google.com with ESMTPS id e12sm48006191eea.5.2012.01.02.17.07.29 (version=SSLv3 cipher=OTHER); Mon, 02 Jan 2012 17:07:29 -0800 (PST) Sender: Bernhard Schmidt From: Bernhard Schmidt To: Adrian Chadd Date: Tue, 3 Jan 2012 02:07:34 +0100 User-Agent: KMail/1.13.7 (FreeBSD/9.0-PRERELEASE; KDE/4.7.3; amd64; ; ) References: <201201021602.q02G2UEF073751@svn.freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201201030207.34599.bschmidt@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r229284 - head/sys/net80211 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, 03 Jan 2012 01:07:32 -0000 On Tuesday 03 January 2012 01:41:32 Adrian Chadd wrote: > On 2 January 2012 08:02, Bernhard Schmidt wrote: > > Author: bschmidt > > Date: Mon Jan 2 16:02:30 2012 > > New Revision: 229284 > > URL: http://svn.freebsd.org/changeset/base/229284 > > > > Log: > > MCS32 equals 32, not 8*ic_txstream. > > Good catch! Can you MFC it to 9/8 ? Sure, after the usual MFC period. -- Bernhard From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 03:29:01 2012 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 CD8F61065673; Tue, 3 Jan 2012 03:29:01 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B7C128FC0A; Tue, 3 Jan 2012 03:29: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 q033T1CT003058; Tue, 3 Jan 2012 03:29:01 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q033T1wF003056; Tue, 3 Jan 2012 03:29:01 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201201030329.q033T1wF003056@svn.freebsd.org> From: Alan Cox Date: Tue, 3 Jan 2012 03:29: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: r229363 - head/sys/fs/tmpfs 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, 03 Jan 2012 03:29:01 -0000 Author: alc Date: Tue Jan 3 03:29:01 2012 New Revision: 229363 URL: http://svn.freebsd.org/changeset/base/229363 Log: Don't pass VM_ALLOC_ZERO to vm_page_grab() in tmpfs_mappedwrite() and tmpfs_nocacheread(). It is both unnecessary and a pessimization. It results in either the page being zeroed twice or zeroed first and then overwritten by an I/O operation. MFC after: 3 weeks Modified: head/sys/fs/tmpfs/tmpfs_vnops.c Modified: head/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vnops.c Tue Jan 3 01:07:02 2012 (r229362) +++ head/sys/fs/tmpfs/tmpfs_vnops.c Tue Jan 3 03:29:01 2012 (r229363) @@ -442,7 +442,7 @@ tmpfs_nocacheread(vm_object_t tobj, vm_p VM_OBJECT_LOCK(tobj); vm_object_pip_add(tobj, 1); m = vm_page_grab(tobj, idx, VM_ALLOC_WIRED | - VM_ALLOC_ZERO | VM_ALLOC_NORMAL | VM_ALLOC_RETRY); + VM_ALLOC_NORMAL | VM_ALLOC_RETRY); if (m->valid != VM_PAGE_BITS_ALL) { if (vm_pager_has_page(tobj, idx, NULL, NULL)) { error = vm_pager_get_pages(tobj, &m, 1, 0); @@ -666,7 +666,7 @@ nocache: VM_OBJECT_LOCK(tobj); vm_object_pip_add(tobj, 1); tpg = vm_page_grab(tobj, idx, VM_ALLOC_WIRED | - VM_ALLOC_ZERO | VM_ALLOC_NORMAL | VM_ALLOC_RETRY); + VM_ALLOC_NORMAL | VM_ALLOC_RETRY); if (tpg->valid != VM_PAGE_BITS_ALL) { if (vm_pager_has_page(tobj, idx, NULL, NULL)) { error = vm_pager_get_pages(tobj, &tpg, 1, 0); From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 03:38:51 2012 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 3CE17106564A; Tue, 3 Jan 2012 03:38:51 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 267868FC0C; Tue, 3 Jan 2012 03:38:51 +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 q033cpqQ003378; Tue, 3 Jan 2012 03:38:51 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q033cp00003376; Tue, 3 Jan 2012 03:38:51 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201030338.q033cp00003376@svn.freebsd.org> From: Eitan Adler Date: Tue, 3 Jan 2012 03:38:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229364 - stable/9/usr.sbin/pw 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, 03 Jan 2012 03:38:51 -0000 Author: eadler (ports committer) Date: Tue Jan 3 03:38:50 2012 New Revision: 229364 URL: http://svn.freebsd.org/changeset/base/229364 Log: MFC r228795: - document the -l option to usermod Approved by: gjb Modified: stable/9/usr.sbin/pw/pw.8 Directory Properties: stable/9/usr.sbin/pw/ (props changed) Modified: stable/9/usr.sbin/pw/pw.8 ============================================================================== --- stable/9/usr.sbin/pw/pw.8 Tue Jan 3 03:29:01 2012 (r229363) +++ stable/9/usr.sbin/pw/pw.8 Tue Jan 3 03:38:50 2012 (r229364) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 30, 2007 +.Dd December 21, 2011 .Dt PW 8 .Os .Sh NAME @@ -714,6 +714,17 @@ are also removed if the user's uid is un system. .Pp The +.Ar usermod +command adds one additional option: +.Bl -tag -width "-G grouplist" +.It Fl l Ar name +This option allows changing of an existing account name to +.Ql \&name . +The new name must not already exist, and any attempt to duplicate an +existing account name will be rejected. +.El +.Pp +The .Ar usershow command allows viewing of an account in one of two formats. By default, the format is identical to the format used in From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 04:12:41 2012 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 38684106566C; Tue, 3 Jan 2012 04:12:41 +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 21D058FC0C; Tue, 3 Jan 2012 04:12: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 q034CfJL004507; Tue, 3 Jan 2012 04:12:41 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q034Cf4m004504; Tue, 3 Jan 2012 04:12:41 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201201030412.q034Cf4m004504@svn.freebsd.org> From: Rick Macklem Date: Tue, 3 Jan 2012 04:12:41 +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: r229365 - in stable/8/sys: conf fs/nfsclient 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, 03 Jan 2012 04:12:41 -0000 Author: rmacklem Date: Tue Jan 3 04:12:40 2012 New Revision: 229365 URL: http://svn.freebsd.org/changeset/base/229365 Log: MFC: r227543 Modify the new NFS client so that nfs_fsync() only calls ncl_flush() for regular files. Since other file types don't write into the buffer cache, calling ncl_flush() is almost a no-op. However, it does clear the NMODIFIED flag and this shouldn't be done by nfs_fsync() for directories. Modified: stable/8/sys/fs/nfsclient/nfs_clvnops.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/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clvnops.c Tue Jan 3 03:38:50 2012 (r229364) +++ stable/8/sys/fs/nfsclient/nfs_clvnops.c Tue Jan 3 04:12:40 2012 (r229365) @@ -2516,6 +2516,16 @@ nfs_strategy(struct vop_strategy_args *a static int nfs_fsync(struct vop_fsync_args *ap) { + + if (ap->a_vp->v_type != VREG) { + /* + * For NFS, metadata is changed synchronously on the server, + * so there is nothing to flush. Also, ncl_flush() clears + * the NMODIFIED flag and that shouldn't be done here for + * directories. + */ + return (0); + } return (ncl_flush(ap->a_vp, ap->a_waitfor, NULL, ap->a_td, 1, 0)); } From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 07:05:31 2012 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 A2EF61065670; Tue, 3 Jan 2012 07:05:31 +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 877F58FC0A; Tue, 3 Jan 2012 07:05:31 +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 q0375VsM009799; Tue, 3 Jan 2012 07:05:31 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0375V2b009794; Tue, 3 Jan 2012 07:05:31 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201201030705.q0375V2b009794@svn.freebsd.org> From: Ed Schouten Date: Tue, 3 Jan 2012 07:05:31 +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: r229366 - in head/sys: conf libkern 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: Tue, 03 Jan 2012 07:05:31 -0000 Author: ed Date: Tue Jan 3 07:05:30 2012 New Revision: 229366 URL: http://svn.freebsd.org/changeset/base/229366 Log: Implement extensions on top of standards instead of the other way around. Now that index() and rindex() have become unused, simply turn them into wrappers around strchr() and strrchr(), respectively. Added: head/sys/libkern/strchr.c - copied, changed from r229111, head/sys/libkern/index.c head/sys/libkern/strrchr.c - copied, changed from r229111, head/sys/libkern/rindex.c Deleted: head/sys/libkern/index.c head/sys/libkern/rindex.c Modified: head/sys/conf/files head/sys/sys/libkern.h Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Tue Jan 3 04:12:40 2012 (r229365) +++ head/sys/conf/files Tue Jan 3 07:05:30 2012 (r229366) @@ -2551,7 +2551,6 @@ libkern/iconv_converter_if.m optional li libkern/iconv_ucs.c optional libiconv libkern/iconv_xlat.c optional libiconv libkern/iconv_xlat16.c optional libiconv -libkern/index.c standard libkern/inet_aton.c standard libkern/inet_ntoa.c standard libkern/inet_ntop.c standard @@ -2562,10 +2561,10 @@ libkern/memcmp.c standard libkern/qsort.c standard libkern/qsort_r.c standard libkern/random.c standard -libkern/rindex.c standard libkern/scanc.c standard libkern/strcasecmp.c standard libkern/strcat.c standard +libkern/strchr.c standard libkern/strcmp.c standard libkern/strcpy.c standard libkern/strcspn.c standard @@ -2576,6 +2575,7 @@ libkern/strlen.c standard libkern/strncmp.c standard libkern/strncpy.c standard libkern/strnlen.c standard +libkern/strrchr.c standard libkern/strsep.c standard libkern/strspn.c standard libkern/strstr.c standard Copied and modified: head/sys/libkern/strchr.c (from r229111, head/sys/libkern/index.c) ============================================================================== --- head/sys/libkern/index.c Sat Dec 31 14:57:52 2011 (r229111, copy source) +++ head/sys/libkern/strchr.c Tue Jan 3 07:05:30 2012 (r229366) @@ -33,14 +33,8 @@ __FBSDID("$FreeBSD$"); #include #include -/* - * index() is also present as the strchr() in the kernel; it does exactly the - * same thing as it's userland equivalent. - */ char * -index(p, ch) - const char *p; - int ch; +strchr(const char *p, int ch) { union { const char *cp; Copied and modified: head/sys/libkern/strrchr.c (from r229111, head/sys/libkern/rindex.c) ============================================================================== --- head/sys/libkern/rindex.c Sat Dec 31 14:57:52 2011 (r229111, copy source) +++ head/sys/libkern/strrchr.c Tue Jan 3 07:05:30 2012 (r229366) @@ -33,14 +33,8 @@ __FBSDID("$FreeBSD$"); #include #include -/* - * rindex() is also present as the strrchr() in the kernel; it does exactly the - * same thing as it's userland equivalent. - */ char * -rindex(p, ch) - const char *p; - int ch; +strrchr(const char *p, int ch) { union { const char *cp; Modified: head/sys/sys/libkern.h ============================================================================== --- head/sys/sys/libkern.h Tue Jan 3 04:12:40 2012 (r229365) +++ head/sys/sys/libkern.h Tue Jan 3 07:05:30 2012 (r229366) @@ -99,12 +99,11 @@ void qsort(void *base, size_t nmemb, si void qsort_r(void *base, size_t nmemb, size_t size, void *thunk, int (*compar)(void *, const void *, const void *)); u_long random(void); -char *index(const char *, int); -char *rindex(const char *, int); int scanc(u_int, const u_char *, const u_char *, int); void srandom(u_long); int strcasecmp(const char *, const char *); char *strcat(char * __restrict, const char * __restrict); +char *strchr(const char *, int); int strcmp(const char *, const char *); char *strcpy(char * __restrict, const char * __restrict); size_t strcspn(const char * __restrict, const char * __restrict) __pure; @@ -116,6 +115,7 @@ int strncasecmp(const char *, const cha int strncmp(const char *, const char *, size_t); char *strncpy(char * __restrict, const char * __restrict, size_t); size_t strnlen(const char *, size_t); +char *strrchr(const char *, int); char *strsep(char **, const char *delim); size_t strspn(const char *, const char *); char *strstr(const char *, const char *); @@ -164,15 +164,17 @@ memset(void *b, int c, size_t len) #endif static __inline char * -strchr(const char *p, int ch) +index(const char *p, int ch) { - return (index(p, ch)); + + return (strchr(p, ch)); } static __inline char * -strrchr(const char *p, int ch) +rindex(const char *p, int ch) { - return (rindex(p, ch)); + + return (strrchr(p, ch)); } /* fnmatch() return values. */ From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 07:06:35 2012 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 C6CA91065670; Tue, 3 Jan 2012 07:06:35 +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 B59E88FC08; Tue, 3 Jan 2012 07:06: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 q0376Zco009873; Tue, 3 Jan 2012 07:06:35 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0376Zad009871; Tue, 3 Jan 2012 07:06:35 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201201030706.q0376Zad009871@svn.freebsd.org> From: Ed Schouten Date: Tue, 3 Jan 2012 07:06:35 +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: r229367 - head/sys/i386/include 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, 03 Jan 2012 07:06:35 -0000 Author: ed Date: Tue Jan 3 07:06:35 2012 New Revision: 229367 URL: http://svn.freebsd.org/changeset/base/229367 Log: Add support for strong aliasing of symbols in i386 assembly. This macro is a literal copy from the MIPS version of . Modified: head/sys/i386/include/asm.h Modified: head/sys/i386/include/asm.h ============================================================================== --- head/sys/i386/include/asm.h Tue Jan 3 07:05:30 2012 (r229366) +++ head/sys/i386/include/asm.h Tue Jan 3 07:06:35 2012 (r229367) @@ -89,6 +89,13 @@ #define ENTRY(x) _ENTRY(x) #endif +/* + * STRONG_ALIAS: create a strong alias. + */ +#define STRONG_ALIAS(alias,sym) \ + .globl alias; \ + alias = sym + #define RCSID(x) .text; .asciz x #undef __FBSDID From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 07:14:02 2012 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 B47BB106566B; Tue, 3 Jan 2012 07:14:02 +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 9FEE38FC0C; Tue, 3 Jan 2012 07:14: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 q037E2js010139; Tue, 3 Jan 2012 07:14:02 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q037E2qq010125; Tue, 3 Jan 2012 07:14:02 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201201030714.q037E2qq010125@svn.freebsd.org> From: Ed Schouten Date: Tue, 3 Jan 2012 07:14: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: r229368 - in head: lib/libc lib/libc/arm/string lib/libc/i386/string lib/libc/mips/string lib/libc/string lib/libstand sys/boot/userboot/libstand 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, 03 Jan 2012 07:14:02 -0000 Author: ed Date: Tue Jan 3 07:14:01 2012 New Revision: 229368 URL: http://svn.freebsd.org/changeset/base/229368 Log: Merge index() and strchr() together. As I looked through the C library, I noticed the FreeBSD MIPS port has a hand-written version of index(). This is nice, if it weren't for the fact that most applications call strchr() instead. Also, on the other architectures index() and strchr() are identical, meaning we have two identical pieces of code in the C library and statically linked applications. Solve this by naming the actual file strchr.[cS] and let it use __strong_reference()/STRONG_ALIAS() to provide the index() routine. Do the same for rindex()/strrchr(). This seems to make the C libraries and static binaries slightly smaller, but this reduction in size seems negligible. Added: head/lib/libc/mips/string/strchr.S - copied, changed from r229111, head/lib/libc/mips/string/index.S head/lib/libc/mips/string/strrchr.S - copied, changed from r229111, head/lib/libc/mips/string/rindex.S Replaced: head/lib/libc/string/strchr.c - copied, changed from r229111, head/lib/libc/string/index.c head/lib/libc/string/strrchr.c - copied, changed from r229111, head/lib/libc/string/rindex.c Deleted: head/lib/libc/i386/string/index.S head/lib/libc/i386/string/rindex.S head/lib/libc/mips/string/index.S head/lib/libc/mips/string/rindex.S head/lib/libc/string/index.c head/lib/libc/string/rindex.c Modified: head/lib/libc/Makefile head/lib/libc/arm/string/Makefile.inc head/lib/libc/i386/string/Makefile.inc head/lib/libc/i386/string/strchr.S head/lib/libc/i386/string/strrchr.S head/lib/libc/mips/string/Makefile.inc head/lib/libc/string/Makefile.inc head/lib/libstand/Makefile head/sys/boot/userboot/libstand/Makefile Modified: head/lib/libc/Makefile ============================================================================== --- head/lib/libc/Makefile Tue Jan 3 07:06:35 2012 (r229367) +++ head/lib/libc/Makefile Tue Jan 3 07:14:01 2012 (r229368) @@ -127,8 +127,8 @@ SRCS+= ${_src} KQSRCS= adddi3.c anddi3.c ashldi3.c ashrdi3.c cmpdi2.c divdi3.c iordi3.c \ lshldi3.c lshrdi3.c moddi3.c muldi3.c negdi2.c notdi2.c qdivrem.c \ subdi3.c ucmpdi2.c udivdi3.c umoddi3.c xordi3.c -KSRCS= bcmp.c ffs.c ffsl.c fls.c flsl.c index.c mcount.c rindex.c \ - strcat.c strcmp.c strcpy.c strlen.c strncpy.c +KSRCS= bcmp.c ffs.c ffsl.c fls.c flsl.c mcount.c strcat.c strchr.c \ + strcmp.c strcpy.c strlen.c strncpy.c strrchr.c libkern: libkern.gen libkern.${LIBC_ARCH} Modified: head/lib/libc/arm/string/Makefile.inc ============================================================================== --- head/lib/libc/arm/string/Makefile.inc Tue Jan 3 07:06:35 2012 (r229367) +++ head/lib/libc/arm/string/Makefile.inc Tue Jan 3 07:14:01 2012 (r229368) @@ -1,7 +1,6 @@ # @(#)Makefile.inc 8.1 (Berkeley) 6/4/93 # $FreeBSD$ -MDSRCS+=bcmp.c bcopy.S bzero.S ffs.S index.c memchr.c memcmp.S memcpy.S \ - memmove.S memset.S rindex.c strcat.c strchr.c strcmp.S strcpy.c \ - strlen.S strncmp.S strrchr.c swab.c wcschr.c wcscmp.c wcslen.c \ - wmemchr.c +MDSRCS+=bcmp.c bcopy.S bzero.S ffs.S memchr.c memcmp.S memcpy.S \ + memmove.S memset.S strcat.c strchr.c strcmp.S strcpy.c strlen.S \ + strncmp.S strrchr.c swab.c wcschr.c wcscmp.c wcslen.c wmemchr.c Modified: head/lib/libc/i386/string/Makefile.inc ============================================================================== --- head/lib/libc/i386/string/Makefile.inc Tue Jan 3 07:06:35 2012 (r229367) +++ head/lib/libc/i386/string/Makefile.inc Tue Jan 3 07:14:01 2012 (r229368) @@ -1,7 +1,6 @@ # @(#)Makefile.inc 8.1 (Berkeley) 6/4/93 # $FreeBSD$ -MDSRCS+=bcmp.S bcopy.S bzero.S ffs.S index.S memchr.S memcmp.S memcpy.S \ - memmove.S memset.S rindex.S strcat.S strchr.S strcmp.S strcpy.S \ - strncmp.S strrchr.S swab.S wcschr.S wcscmp.S wcslen.S \ - wmemchr.S +MDSRCS+=bcmp.S bcopy.S bzero.S ffs.S memchr.S memcmp.S memcpy.S memmove.S \ + memset.S strcat.S strchr.S strcmp.S strcpy.S strncmp.S strrchr.S \ + swab.S wcschr.S wcscmp.S wcslen.S wmemchr.S Modified: head/lib/libc/i386/string/strchr.S ============================================================================== --- head/lib/libc/i386/string/strchr.S Tue Jan 3 07:06:35 2012 (r229367) +++ head/lib/libc/i386/string/strchr.S Tue Jan 3 07:14:01 2012 (r229368) @@ -63,4 +63,6 @@ L2: ret END(strchr) +STRONG_ALIAS(index, strchr) + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/i386/string/strrchr.S ============================================================================== --- head/lib/libc/i386/string/strrchr.S Tue Jan 3 07:06:35 2012 (r229367) +++ head/lib/libc/i386/string/strrchr.S Tue Jan 3 07:14:01 2012 (r229368) @@ -64,4 +64,6 @@ L2: ret END(strrchr) +STRONG_ALIAS(rindex, strrchr) + .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/mips/string/Makefile.inc ============================================================================== --- head/lib/libc/mips/string/Makefile.inc Tue Jan 3 07:06:35 2012 (r229367) +++ head/lib/libc/mips/string/Makefile.inc Tue Jan 3 07:14:01 2012 (r229368) @@ -1,8 +1,8 @@ # $NetBSD: Makefile.inc,v 1.2 2000/10/10 21:51:54 jeffs Exp $ # $FreeBSD$ -SRCS+= bcmp.S bcopy.S bzero.S ffs.S index.S memchr.c memcmp.c memset.c \ +SRCS+= bcmp.S bcopy.S bzero.S ffs.S memchr.c memcmp.c memset.c \ memcpy.S memmove.S \ - rindex.S strcat.c strcmp.S strcpy.c strcspn.c strlen.S \ - strncat.c strncmp.c strncpy.c strpbrk.c strsep.c \ + strcat.c strchr.S strcmp.S strcpy.c strcspn.c strlen.S \ + strncat.c strncmp.c strncpy.c strrchr.S strpbrk.c strsep.c \ strspn.c strstr.c swab.c Copied and modified: head/lib/libc/mips/string/strchr.S (from r229111, head/lib/libc/mips/string/index.S) ============================================================================== --- head/lib/libc/mips/string/index.S Sat Dec 31 14:57:52 2011 (r229111, copy source) +++ head/lib/libc/mips/string/strchr.S Tue Jan 3 07:14:01 2012 (r229368) @@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$"); .abicalls #endif -LEAF(index) +LEAF(strchr) 1: lbu a2, 0(a0) # get a byte PTR_ADDU a0, a0, 1 @@ -56,4 +56,6 @@ notfnd: fnd: PTR_SUBU v0, a0, 1 j ra -END(index) +END(strchr) + +STRONG_ALIAS(index, strchr) Copied and modified: head/lib/libc/mips/string/strrchr.S (from r229111, head/lib/libc/mips/string/rindex.S) ============================================================================== --- head/lib/libc/mips/string/rindex.S Sat Dec 31 14:57:52 2011 (r229111, copy source) +++ head/lib/libc/mips/string/strrchr.S Tue Jan 3 07:14:01 2012 (r229368) @@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$"); .abicalls #endif -LEAF(rindex) +LEAF(strrchr) move v0, zero # default if not found 1: lbu a3, 0(a0) # get a byte @@ -54,4 +54,6 @@ LEAF(rindex) 2: bne a3, zero, 1b # continue if not end j ra -END(rindex) +END(strrchr) + +STRONG_ALIAS(rindex, strrchr) Modified: head/lib/libc/string/Makefile.inc ============================================================================== --- head/lib/libc/string/Makefile.inc Tue Jan 3 07:06:35 2012 (r229367) +++ head/lib/libc/string/Makefile.inc Tue Jan 3 07:14:01 2012 (r229368) @@ -7,8 +7,8 @@ CFLAGS+= -I${.CURDIR}/locale # machine-independent string sources MISRCS+=bcmp.c bcopy.c bzero.c ffs.c ffsl.c ffsll.c fls.c flsl.c flsll.c \ - index.c memccpy.c memchr.c memrchr.c memcmp.c \ - memcpy.c memmem.c memmove.c memset.c rindex.c \ + memccpy.c memchr.c memrchr.c memcmp.c \ + memcpy.c memmem.c memmove.c memset.c \ stpcpy.c stpncpy.c strcasecmp.c \ strcat.c strcasestr.c strchr.c strcmp.c strcoll.c strcpy.c strcspn.c \ strdup.c strerror.c strlcat.c strlcpy.c strlen.c strmode.c strncat.c \ Copied and modified: head/lib/libc/string/strchr.c (from r229111, head/lib/libc/string/index.c) ============================================================================== --- head/lib/libc/string/index.c Sat Dec 31 14:57:52 2011 (r229111, copy source) +++ head/lib/libc/string/strchr.c Tue Jan 3 07:14:01 2012 (r229368) @@ -34,19 +34,10 @@ static char sccsid[] = "@(#)index.c 8.1 __FBSDID("$FreeBSD$"); #include - -#ifdef STRCHR #include char * -strchr -#else -#include - -char * -index -#endif -(const char *p, int ch) +strchr(const char *p, int ch) { char c; @@ -59,3 +50,5 @@ index } /* NOTREACHED */ } + +__strong_reference(strchr, index); Copied and modified: head/lib/libc/string/strrchr.c (from r229111, head/lib/libc/string/rindex.c) ============================================================================== --- head/lib/libc/string/rindex.c Sat Dec 31 14:57:52 2011 (r229111, copy source) +++ head/lib/libc/string/strrchr.c Tue Jan 3 07:14:01 2012 (r229368) @@ -34,19 +34,10 @@ static char sccsid[] = "@(#)rindex.c 8.1 __FBSDID("$FreeBSD$"); #include - -#ifdef STRRCHR #include char * -strrchr -#else -#include - -char * -rindex -#endif -(const char *p, int ch) +strrchr(const char *p, int ch) { char *save; char c; @@ -60,3 +51,5 @@ rindex } /* NOTREACHED */ } + +__strong_reference(strrchr, rindex); Modified: head/lib/libstand/Makefile ============================================================================== --- head/lib/libstand/Makefile Tue Jan 3 07:06:35 2012 (r229367) +++ head/lib/libstand/Makefile Tue Jan 3 07:14:01 2012 (r229368) @@ -54,10 +54,10 @@ SRCS+= ntoh.c .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "powerpc" || \ ${MACHINE_CPUARCH} == "sparc64" || ${MACHINE_CPUARCH} == "amd64" || \ ${MACHINE_CPUARCH} == "arm" -SRCS+= bcmp.c bcopy.c bzero.c ffs.c index.c memccpy.c memchr.c memcmp.c \ - memcpy.c memmove.c memset.c qdivrem.c rindex.c strcat.c strchr.c \ - strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c strncpy.c \ - strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c +SRCS+= bcmp.c bcopy.c bzero.c ffs.c memccpy.c memchr.c memcmp.c memcpy.c \ + memmove.c memset.c qdivrem.c strcat.c strchr.c strcmp.c strcpy.c \ + strcspn.c strlen.c strncat.c strncmp.c strncpy.c strpbrk.c \ + strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c .endif .if ${MACHINE_CPUARCH} == "arm" .PATH: ${.CURDIR}/../libc/arm/gen @@ -65,10 +65,9 @@ SRCS+= divsi3.S .endif .if ${MACHINE_CPUARCH} == "ia64" .PATH: ${.CURDIR}/../libc/ia64/string -SRCS+= bcmp.c bcopy.S bzero.S ffs.S index.c memccpy.c memchr.c memcmp.c \ - memcpy.S memmove.S memset.c rindex.c strcat.c strchr.c \ - strcmp.c strcpy.c strcspn.c strlen.c \ - strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \ +SRCS+= bcmp.c bcopy.S bzero.S ffs.S memccpy.c memchr.c memcmp.c memcpy.S \ + memmove.S memset.c strcat.c strchr.c strcmp.c strcpy.c strcspn.c \ + strlen.c strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \ strspn.c strstr.c strtok.c swab.c .PATH: ${.CURDIR}/../libc/ia64/gen Modified: head/sys/boot/userboot/libstand/Makefile ============================================================================== --- head/sys/boot/userboot/libstand/Makefile Tue Jan 3 07:06:35 2012 (r229367) +++ head/sys/boot/userboot/libstand/Makefile Tue Jan 3 07:14:01 2012 (r229368) @@ -60,10 +60,10 @@ SRCS+= ntoh.c .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "powerpc" || \ ${MACHINE_CPUARCH} == "sparc64" || ${MACHINE_CPUARCH} == "amd64" || \ ${MACHINE_CPUARCH} == "arm" -SRCS+= bcmp.c bcopy.c bzero.c ffs.c index.c memccpy.c memchr.c memcmp.c \ - memcpy.c memmove.c memset.c qdivrem.c rindex.c strcat.c strchr.c \ - strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c strncpy.c \ - strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c +SRCS+= bcmp.c bcopy.c bzero.c ffs.c memccpy.c memchr.c memcmp.c memcpy.c \ + memmove.c memset.c qdivrem.c strcat.c strchr.c strcmp.c strcpy.c \ + strcspn.c strlen.c strncat.c strncmp.c strncpy.c strpbrk.c \ + strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c .endif .if ${MACHINE_CPUARCH} == "arm" .PATH: ${LIBC}/arm/gen From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 08:31:47 2012 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 F1698106566B; Tue, 3 Jan 2012 08:31:47 +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 DF0208FC0C; Tue, 3 Jan 2012 08:31:47 +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 q038VlOn012631; Tue, 3 Jan 2012 08:31:47 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q038Vl6Q012629; Tue, 3 Jan 2012 08:31:47 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201201030831.q038Vl6Q012629@svn.freebsd.org> From: Hans Petter Selasky Date: Tue, 3 Jan 2012 08:31:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229369 - stable/9/sys/dev/usb/controller 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, 03 Jan 2012 08:31:48 -0000 Author: hselasky Date: Tue Jan 3 08:31:47 2012 New Revision: 229369 URL: http://svn.freebsd.org/changeset/base/229369 Log: MFC r229317: Fix for USB suspend and resume. Modified: stable/9/sys/dev/usb/controller/usb_controller.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/usb/controller/usb_controller.c ============================================================================== --- stable/9/sys/dev/usb/controller/usb_controller.c Tue Jan 3 07:14:01 2012 (r229368) +++ stable/9/sys/dev/usb/controller/usb_controller.c Tue Jan 3 08:31:47 2012 (r229369) @@ -472,10 +472,18 @@ usb_bus_resume(struct usb_proc_msg *pm) if (bus->methods->set_hw_power != NULL) (bus->methods->set_hw_power) (bus); + /* restore USB configuration to index 0 */ err = usbd_set_config_index(udev, 0); if (err) device_printf(bus->bdev, "Could not configure root HUB\n"); + /* probe and attach */ + err = usb_probe_and_attach(udev, USB_IFACE_INDEX_ANY); + if (err) { + device_printf(bus->bdev, "Could not probe and " + "attach root HUB\n"); + } + usbd_enum_unlock(udev); USB_BUS_LOCK(bus); From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 09:15:55 2012 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 13BE71065670; Tue, 3 Jan 2012 09: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 F2B388FC0A; Tue, 3 Jan 2012 09:15: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 q039FsiQ014182; Tue, 3 Jan 2012 09:15:54 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q039Fs1m014168; Tue, 3 Jan 2012 09:15:54 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201201030915.q039Fs1m014168@svn.freebsd.org> From: Hans Petter Selasky Date: Tue, 3 Jan 2012 09:15: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: r229370 - in stable/8/sys: conf dev/usb dev/usb/controller mips/atheros mips/cavium/usb mips/rmi modules/usb modules/usb/avr32dci 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, 03 Jan 2012 09:15:55 -0000 Author: hselasky Date: Tue Jan 3 09:15:54 2012 New Revision: 229370 URL: http://svn.freebsd.org/changeset/base/229370 Log: MFC r228483, r228640, r228709, r228711, r228723 and r229086: - Implement better support for USB controller suspend and resume. - Add code to wait for USB shutdown to be executed at system shutdown. - Add sysctl which can be used to skip this waiting. NOTE: All USB controller drivers needs to be re-compiled after this change due to changes in some USB controller only structures. Added: stable/8/sys/modules/usb/avr32dci/ - copied from r228483, head/sys/modules/usb/avr32dci/ Modified: stable/8/sys/dev/usb/controller/at91dci.c stable/8/sys/dev/usb/controller/at91dci.h stable/8/sys/dev/usb/controller/at91dci_atmelarm.c stable/8/sys/dev/usb/controller/atmegadci.c stable/8/sys/dev/usb/controller/atmegadci.h stable/8/sys/dev/usb/controller/atmegadci_atmelarm.c stable/8/sys/dev/usb/controller/avr32dci.c stable/8/sys/dev/usb/controller/avr32dci.h stable/8/sys/dev/usb/controller/ehci.c stable/8/sys/dev/usb/controller/ehci.h stable/8/sys/dev/usb/controller/ehci_ixp4xx.c stable/8/sys/dev/usb/controller/ehci_pci.c stable/8/sys/dev/usb/controller/musb_otg.c stable/8/sys/dev/usb/controller/musb_otg.h stable/8/sys/dev/usb/controller/musb_otg_atmelarm.c stable/8/sys/dev/usb/controller/ohci.c stable/8/sys/dev/usb/controller/ohci.h stable/8/sys/dev/usb/controller/ohci_atmelarm.c stable/8/sys/dev/usb/controller/ohci_pci.c stable/8/sys/dev/usb/controller/uhci.c stable/8/sys/dev/usb/controller/uhci.h stable/8/sys/dev/usb/controller/uhci_pci.c stable/8/sys/dev/usb/controller/usb_controller.c stable/8/sys/dev/usb/controller/uss820dci.c stable/8/sys/dev/usb/controller/uss820dci.h stable/8/sys/dev/usb/controller/uss820dci_atmelarm.c stable/8/sys/dev/usb/controller/xhci.c stable/8/sys/dev/usb/controller/xhci.h stable/8/sys/dev/usb/controller/xhci_pci.c stable/8/sys/dev/usb/usb_bus.h stable/8/sys/dev/usb/usb_controller.h stable/8/sys/dev/usb/usb_if.m stable/8/sys/mips/atheros/ar71xx_ehci.c stable/8/sys/mips/atheros/ar71xx_ohci.c stable/8/sys/mips/cavium/usb/octusb.c stable/8/sys/mips/cavium/usb/octusb.h stable/8/sys/mips/cavium/usb/octusb_octeon.c stable/8/sys/mips/rmi/xls_ehci.c stable/8/sys/modules/usb/Makefile 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/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/usb/controller/at91dci.c ============================================================================== --- stable/8/sys/dev/usb/controller/at91dci.c Tue Jan 3 08:31:47 2012 (r229369) +++ stable/8/sys/dev/usb/controller/at91dci.c Tue Jan 3 09:15:54 2012 (r229370) @@ -1461,16 +1461,16 @@ at91dci_uninit(struct at91dci_softc *sc) USB_BUS_UNLOCK(&sc->sc_bus); } -void +static void at91dci_suspend(struct at91dci_softc *sc) { - return; + /* TODO */ } -void +static void at91dci_resume(struct at91dci_softc *sc) { - return; + /* TODO */ } static void @@ -2306,6 +2306,26 @@ at91dci_ep_init(struct usb_device *udev, } } +static void +at91dci_set_hw_power_sleep(struct usb_bus *bus, uint32_t state) +{ + struct at91dci_softc *sc = AT9100_DCI_BUS2SC(bus); + + switch (state) { + case USB_HW_POWER_SUSPEND: + at91dci_suspend(sc); + break; + case USB_HW_POWER_SHUTDOWN: + at91dci_uninit(sc); + break; + case USB_HW_POWER_RESUME: + at91dci_resume(sc); + break; + default: + break; + } +} + struct usb_bus_methods at91dci_bus_methods = { .endpoint_init = &at91dci_ep_init, @@ -2316,4 +2336,5 @@ struct usb_bus_methods at91dci_bus_metho .clear_stall = &at91dci_clear_stall, .roothub_exec = &at91dci_roothub_exec, .xfer_poll = &at91dci_do_poll, + .set_hw_power_sleep = &at91dci_set_hw_power_sleep, }; Modified: stable/8/sys/dev/usb/controller/at91dci.h ============================================================================== --- stable/8/sys/dev/usb/controller/at91dci.h Tue Jan 3 08:31:47 2012 (r229369) +++ stable/8/sys/dev/usb/controller/at91dci.h Tue Jan 3 09:15:54 2012 (r229370) @@ -235,8 +235,6 @@ struct at91dci_softc { usb_error_t at91dci_init(struct at91dci_softc *sc); void at91dci_uninit(struct at91dci_softc *sc); -void at91dci_suspend(struct at91dci_softc *sc); -void at91dci_resume(struct at91dci_softc *sc); void at91dci_interrupt(struct at91dci_softc *sc); void at91dci_vbus_interrupt(struct at91dci_softc *sc, uint8_t is_on); Modified: stable/8/sys/dev/usb/controller/at91dci_atmelarm.c ============================================================================== --- stable/8/sys/dev/usb/controller/at91dci_atmelarm.c Tue Jan 3 08:31:47 2012 (r229369) +++ stable/8/sys/dev/usb/controller/at91dci_atmelarm.c Tue Jan 3 09:15:54 2012 (r229370) @@ -77,7 +77,6 @@ __FBSDID("$FreeBSD$"); static device_probe_t at91_udp_probe; static device_attach_t at91_udp_attach; static device_detach_t at91_udp_detach; -static device_shutdown_t at91_udp_shutdown; struct at91_udp_softc { struct at91dci_softc sc_dci; /* must be first */ @@ -324,27 +323,14 @@ at91_udp_detach(device_t dev) return (0); } -static int -at91_udp_shutdown(device_t dev) -{ - struct at91_udp_softc *sc = device_get_softc(dev); - int err; - - err = bus_generic_shutdown(dev); - if (err) - return (err); - - at91dci_uninit(&sc->sc_dci); - - return (0); -} - static device_method_t at91_udp_methods[] = { /* Device interface */ DEVMETHOD(device_probe, at91_udp_probe), DEVMETHOD(device_attach, at91_udp_attach), DEVMETHOD(device_detach, at91_udp_detach), - DEVMETHOD(device_shutdown, at91_udp_shutdown), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + DEVMETHOD(device_shutdown, bus_generic_shutdown), /* Bus interface */ DEVMETHOD(bus_print_child, bus_generic_print_child), @@ -353,9 +339,9 @@ static device_method_t at91_udp_methods[ }; static driver_t at91_udp_driver = { - "at91_udp", - at91_udp_methods, - sizeof(struct at91_udp_softc), + .name = "at91_udp", + .methods = at91_udp_methods, + .size = sizeof(struct at91_udp_softc), }; static devclass_t at91_udp_devclass; Modified: stable/8/sys/dev/usb/controller/atmegadci.c ============================================================================== --- stable/8/sys/dev/usb/controller/atmegadci.c Tue Jan 3 08:31:47 2012 (r229369) +++ stable/8/sys/dev/usb/controller/atmegadci.c Tue Jan 3 09:15:54 2012 (r229370) @@ -1351,16 +1351,16 @@ atmegadci_uninit(struct atmegadci_softc USB_BUS_UNLOCK(&sc->sc_bus); } -void +static void atmegadci_suspend(struct atmegadci_softc *sc) { - return; + /* TODO */ } -void +static void atmegadci_resume(struct atmegadci_softc *sc) { - return; + /* TODO */ } static void @@ -2125,6 +2125,26 @@ atmegadci_ep_init(struct usb_device *ude } } +static void +atmegadci_set_hw_power_sleep(struct usb_bus *bus, uint32_t state) +{ + struct atmegadci_softc *sc = ATMEGA_BUS2SC(bus); + + switch (state) { + case USB_HW_POWER_SUSPEND: + atmegadci_suspend(sc); + break; + case USB_HW_POWER_SHUTDOWN: + atmegadci_uninit(sc); + break; + case USB_HW_POWER_RESUME: + atmegadci_resume(sc); + break; + default: + break; + } +} + struct usb_bus_methods atmegadci_bus_methods = { .endpoint_init = &atmegadci_ep_init, @@ -2135,4 +2155,5 @@ struct usb_bus_methods atmegadci_bus_met .clear_stall = &atmegadci_clear_stall, .roothub_exec = &atmegadci_roothub_exec, .xfer_poll = &atmegadci_do_poll, + .set_hw_power_sleep = &atmegadci_set_hw_power_sleep, }; Modified: stable/8/sys/dev/usb/controller/atmegadci.h ============================================================================== --- stable/8/sys/dev/usb/controller/atmegadci.h Tue Jan 3 08:31:47 2012 (r229369) +++ stable/8/sys/dev/usb/controller/atmegadci.h Tue Jan 3 09:15:54 2012 (r229370) @@ -278,8 +278,6 @@ struct atmegadci_softc { usb_error_t atmegadci_init(struct atmegadci_softc *sc); void atmegadci_uninit(struct atmegadci_softc *sc); -void atmegadci_suspend(struct atmegadci_softc *sc); -void atmegadci_resume(struct atmegadci_softc *sc); void atmegadci_interrupt(struct atmegadci_softc *sc); #endif /* _ATMEGADCI_H_ */ Modified: stable/8/sys/dev/usb/controller/atmegadci_atmelarm.c ============================================================================== --- stable/8/sys/dev/usb/controller/atmegadci_atmelarm.c Tue Jan 3 08:31:47 2012 (r229369) +++ stable/8/sys/dev/usb/controller/atmegadci_atmelarm.c Tue Jan 3 09:15:54 2012 (r229370) @@ -62,7 +62,6 @@ __FBSDID("$FreeBSD$"); static device_probe_t atmegadci_probe; static device_attach_t atmegadci_attach; static device_detach_t atmegadci_detach; -static device_shutdown_t atmegadci_shutdown; struct atmegadci_super_softc { struct atmegadci_softc sc_otg; /* must be first */ @@ -193,27 +192,14 @@ atmegadci_detach(device_t dev) return (0); } -static int -atmegadci_shutdown(device_t dev) -{ - struct atmegadci_super_softc *sc = device_get_softc(dev); - int err; - - err = bus_generic_shutdown(dev); - if (err) - return (err); - - atmegadci_uninit(&sc->sc_otg); - - return (0); -} - static device_method_t atmegadci_methods[] = { /* Device interface */ DEVMETHOD(device_probe, atmegadci_probe), DEVMETHOD(device_attach, atmegadci_attach), DEVMETHOD(device_detach, atmegadci_detach), - DEVMETHOD(device_shutdown, atmegadci_shutdown), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + DEVMETHOD(device_shutdown, bus_generic_shutdown), /* Bus interface */ DEVMETHOD(bus_print_child, bus_generic_print_child), @@ -222,9 +208,9 @@ static device_method_t atmegadci_methods }; static driver_t atmegadci_driver = { - "atmegadci", - atmegadci_methods, - sizeof(struct atmegadci_super_softc), + .name = "atmegadci", + .methods = atmegadci_methods, + .size = sizeof(struct atmegadci_super_softc), }; static devclass_t atmegadci_devclass; Modified: stable/8/sys/dev/usb/controller/avr32dci.c ============================================================================== --- stable/8/sys/dev/usb/controller/avr32dci.c Tue Jan 3 08:31:47 2012 (r229369) +++ stable/8/sys/dev/usb/controller/avr32dci.c Tue Jan 3 09:15:54 2012 (r229370) @@ -265,7 +265,7 @@ avr32dci_set_address(struct avr32dci_sof { DPRINTFN(5, "addr=%d\n", addr); - avr32dci_mod_ctrl(sc, AVR32_UDADDR_ADDEN | addr, 0); + avr32dci_mod_ctrl(sc, AVR32_CTRL_DEV_FADDR_EN | addr, 0); } static uint8_t @@ -501,7 +501,7 @@ repeat: } /* allocate FIFO bank */ - AVR32_WRITE_4(sc, AVR32_EPTCLRSTA(td->ep_no), AVR32_EPTSTA_TX_BK_RDY); + AVR32_WRITE_4(sc, AVR32_EPTCTL(td->ep_no), AVR32_EPTCTL_TX_PK_RDY); /* check remainder */ if (td->remainder == 0) { @@ -754,7 +754,7 @@ avr32dci_setup_standard_chain(struct usb uint8_t need_sync; DPRINTFN(9, "addr=%d endpt=%d sumlen=%d speed=%d\n", - xfer->address, UE_GET_ADDR(xfer->endpoint), + xfer->address, UE_GET_ADDR(xfer->endpointno), xfer->sumlen, usbd_get_speed(xfer->xroot->udev)); temp.max_frame_size = xfer->max_frame_size; @@ -773,7 +773,7 @@ avr32dci_setup_standard_chain(struct usb temp.did_stall = !xfer->flags_int.control_stall; sc = AVR32_BUS2SC(xfer->xroot->bus); - ep_no = (xfer->endpoint & UE_ADDR); + ep_no = (xfer->endpointno & UE_ADDR); /* check if we should prepend a setup message */ @@ -798,7 +798,7 @@ avr32dci_setup_standard_chain(struct usb } if (x != xfer->nframes) { - if (xfer->endpoint & UE_DIR_IN) { + if (xfer->endpointno & UE_DIR_IN) { temp.func = &avr32dci_data_tx; need_sync = 1; } else { @@ -872,7 +872,7 @@ avr32dci_setup_standard_chain(struct usb * Send a DATA1 message and invert the current * endpoint direction. */ - if (xfer->endpoint & UE_DIR_IN) { + if (xfer->endpointno & UE_DIR_IN) { temp.func = &avr32dci_data_rx; need_sync = 0; } else { @@ -913,7 +913,8 @@ avr32dci_start_standard_chain(struct usb /* poll one time - will turn on interrupts */ if (avr32dci_xfer_do_fifo(xfer)) { - uint8_t ep_no = xfer->endpoint & UE_ADDR_MASK; + uint8_t ep_no = xfer->endpointno & UE_ADDR; + struct avr32dci_softc *sc = AVR32_BUS2SC(xfer->xroot->bus); avr32dci_mod_ien(sc, AVR32_INT_EPT_INT(ep_no), 0); @@ -1012,7 +1013,7 @@ avr32dci_standard_done(struct usb_xfer * usb_error_t err = 0; DPRINTFN(13, "xfer=%p pipe=%p transfer done\n", - xfer, xfer->pipe); + xfer, xfer->endpoint); /* reset scanner */ @@ -1064,10 +1065,10 @@ avr32dci_device_done(struct usb_xfer *xf USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); DPRINTFN(9, "xfer=%p, pipe=%p, error=%d\n", - xfer, xfer->pipe, error); + xfer, xfer->endpoint, error); if (xfer->flags_int.usb_mode == USB_MODE_DEVICE) { - ep_no = (xfer->endpoint & UE_ADDR); + ep_no = (xfer->endpointno & UE_ADDR); /* disable endpoint interrupt */ avr32dci_mod_ien(sc, 0, AVR32_INT_EPT_INT(ep_no)); @@ -1080,7 +1081,7 @@ avr32dci_device_done(struct usb_xfer *xf static void avr32dci_set_stall(struct usb_device *udev, struct usb_xfer *xfer, - struct usb_endpoint *ep, uint8_t *did_stall) + struct usb_endpoint *pipe, uint8_t *did_stall) { struct avr32dci_softc *sc; uint8_t ep_no; @@ -1166,7 +1167,7 @@ avr32dci_clear_stall_sub(struct avr32dci } static void -avr32dci_clear_stall(struct usb_device *udev, struct usb_endpoint *ep) +avr32dci_clear_stall(struct usb_device *udev, struct usb_endpoint *pipe) { struct avr32dci_softc *sc; struct usb_endpoint_descriptor *ed; @@ -1226,8 +1227,7 @@ avr32dci_init(struct avr32dci_softc *sc) AVR32_INT_ENDRESET, 0); /* reset all endpoints */ -/**INDENT** Warning@1207: Extra ) */ - AVR32_WRITE_4(sc, AVR32_EPTRST, (1 << AVR32_EP_MAX) - 1)); + AVR32_WRITE_4(sc, AVR32_EPTRST, (1 << AVR32_EP_MAX) - 1); /* disable all endpoints */ for (n = 0; n != AVR32_EP_MAX; n++) { @@ -1262,8 +1262,7 @@ avr32dci_uninit(struct avr32dci_softc *s avr32dci_mod_ien(sc, 0, 0xFFFFFFFF); /* reset all endpoints */ -/**INDENT** Warning@1242: Extra ) */ - AVR32_WRITE_4(sc, AVR32_EPTRST, (1 << AVR32_EP_MAX) - 1)); + AVR32_WRITE_4(sc, AVR32_EPTRST, (1 << AVR32_EP_MAX) - 1); /* disable all endpoints */ for (n = 0; n != AVR32_EP_MAX; n++) { @@ -1284,16 +1283,16 @@ avr32dci_uninit(struct avr32dci_softc *s USB_BUS_UNLOCK(&sc->sc_bus); } -void +static void avr32dci_suspend(struct avr32dci_softc *sc) { - return; + /* TODO */ } -void +static void avr32dci_resume(struct avr32dci_softc *sc) { - return; + /* TODO */ } static void @@ -1369,10 +1368,10 @@ avr32dci_device_isoc_fs_enter(struct usb uint8_t ep_no; DPRINTFN(6, "xfer=%p next=%d nframes=%d\n", - xfer, xfer->pipe->isoc_next, xfer->nframes); + xfer, xfer->endpoint->isoc_next, xfer->nframes); /* get the current frame index */ - ep_no = xfer->endpoint & UE_ADDR_MASK; + ep_no = xfer->endpointno & UE_ADDR; nframes = (AVR32_READ_4(sc, AVR32_FNUM) / 8); nframes &= AVR32_FRAME_MASK; @@ -1381,9 +1380,9 @@ avr32dci_device_isoc_fs_enter(struct usb * check if the frame index is within the window where the frames * will be inserted */ - temp = (nframes - xfer->pipe->isoc_next) & AVR32_FRAME_MASK; + temp = (nframes - xfer->endpoint->isoc_next) & AVR32_FRAME_MASK; - if ((xfer->pipe->is_synced == 0) || + if ((xfer->endpoint->is_synced == 0) || (temp < xfer->nframes)) { /* * If there is data underflow or the pipe queue is @@ -1391,15 +1390,15 @@ avr32dci_device_isoc_fs_enter(struct usb * of the current frame position. Else two isochronous * transfers might overlap. */ - xfer->pipe->isoc_next = (nframes + 3) & AVR32_FRAME_MASK; - xfer->pipe->is_synced = 1; - DPRINTFN(3, "start next=%d\n", xfer->pipe->isoc_next); + xfer->endpoint->isoc_next = (nframes + 3) & AVR32_FRAME_MASK; + xfer->endpoint->is_synced = 1; + DPRINTFN(3, "start next=%d\n", xfer->endpoint->isoc_next); } /* * compute how many milliseconds the insertion is ahead of the * current frame position: */ - temp = (xfer->pipe->isoc_next - nframes) & AVR32_FRAME_MASK; + temp = (xfer->endpoint->isoc_next - nframes) & AVR32_FRAME_MASK; /* * pre-compute when the isochronous transfer will be finished: @@ -1409,7 +1408,7 @@ avr32dci_device_isoc_fs_enter(struct usb xfer->nframes; /* compute frame number for next insertion */ - xfer->pipe->isoc_next += xfer->nframes; + xfer->endpoint->isoc_next += xfer->nframes; /* setup TDs */ avr32dci_setup_standard_chain(xfer); @@ -1832,7 +1831,7 @@ tr_handle_clear_port_feature: AVR32_WRITE_4(sc, AVR32_EPTCLRSTA(0), AVR32_EPTSTA_FRCESTALL); /* configure */ - AVR32_WRITE_4(sc, AVR32_EPTCFG(0), AVR32_EPTCFG_TYPE_CONTROL | + AVR32_WRITE_4(sc, AVR32_EPTCFG(0), AVR32_EPTCFG_TYPE_CTRL | AVR32_EPTCFG_NBANK(1) | AVR32_EPTCFG_EPSIZE(6)); temp = AVR32_READ_4(sc, AVR32_EPTCFG(0)); @@ -1974,7 +1973,7 @@ avr32dci_xfer_setup(struct usb_setup_par /* * compute maximum number of TDs */ - if ((xfer->pipe->edesc->bmAttributes & UE_XFERTYPE) == UE_CONTROL) { + if ((xfer->endpoint->edesc->bmAttributes & UE_XFERTYPE) == UE_CONTROL) { ntd = xfer->nframes + 1 /* STATUS */ + 1 /* SYNC 1 */ + 1 /* SYNC 2 */ ; @@ -1997,7 +1996,7 @@ avr32dci_xfer_setup(struct usb_setup_par /* * get profile stuff */ - ep_no = xfer->endpoint & UE_ADDR; + ep_no = xfer->endpointno & UE_ADDR; avr32dci_get_hw_ep_profile(parm->udev, &pf, ep_no); if (pf == NULL) { @@ -2045,7 +2044,7 @@ avr32dci_xfer_unsetup(struct usb_xfer *x static void avr32dci_ep_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc, - struct usb_endpoint *ep) + struct usb_endpoint *pipe) { struct avr32dci_softc *sc = AVR32_BUS2SC(udev->bus); @@ -2072,6 +2071,26 @@ avr32dci_ep_init(struct usb_device *udev } } +static void +avr32dci_set_hw_power_sleep(struct usb_bus *bus, uint32_t state) +{ + struct avr32dci_softc *sc = AVR32_BUS2SC(bus); + + switch (state) { + case USB_HW_POWER_SUSPEND: + avr32dci_suspend(sc); + break; + case USB_HW_POWER_SHUTDOWN: + avr32dci_uninit(sc); + break; + case USB_HW_POWER_RESUME: + avr32dci_resume(sc); + break; + default: + break; + } +} + struct usb_bus_methods avr32dci_bus_methods = { .endpoint_init = &avr32dci_ep_init, @@ -2082,4 +2101,5 @@ struct usb_bus_methods avr32dci_bus_meth .clear_stall = &avr32dci_clear_stall, .roothub_exec = &avr32dci_roothub_exec, .xfer_poll = &avr32dci_do_poll, + .set_hw_power_sleep = &avr32dci_set_hw_power_sleep, }; Modified: stable/8/sys/dev/usb/controller/avr32dci.h ============================================================================== --- stable/8/sys/dev/usb/controller/avr32dci.h Tue Jan 3 08:31:47 2012 (r229369) +++ stable/8/sys/dev/usb/controller/avr32dci.h Tue Jan 3 09:15:54 2012 (r229370) @@ -166,6 +166,7 @@ struct avr32dci_td { uint32_t offset; uint32_t remainder; uint16_t max_packet_size; + uint8_t bank_shift; uint8_t error:1; uint8_t alt_next:1; uint8_t short_pkt:1; @@ -246,8 +247,6 @@ struct avr32dci_softc { usb_error_t avr32dci_init(struct avr32dci_softc *sc); void avr32dci_uninit(struct avr32dci_softc *sc); -void avr32dci_suspend(struct avr32dci_softc *sc); -void avr32dci_resume(struct avr32dci_softc *sc); void avr32dci_interrupt(struct avr32dci_softc *sc); void avr32dci_vbus_interrupt(struct avr32dci_softc *sc, uint8_t is_on); Modified: stable/8/sys/dev/usb/controller/ehci.c ============================================================================== --- stable/8/sys/dev/usb/controller/ehci.c Tue Jan 3 08:31:47 2012 (r229369) +++ stable/8/sys/dev/usb/controller/ehci.c Tue Jan 3 09:15:54 2012 (r229370) @@ -188,7 +188,7 @@ ehci_reset(ehci_softc_t *sc) EOWRITE4(sc, EHCI_USBCMD, EHCI_CMD_HCRESET); for (i = 0; i < 100; i++) { - usb_pause_mtx(NULL, hz / 1000); + usb_pause_mtx(NULL, hz / 128); hcr = EOREAD4(sc, EHCI_USBCMD) & EHCI_CMD_HCRESET; if (!hcr) { if (sc->sc_flags & (EHCI_SCFLG_SETMODE | EHCI_SCFLG_BIGEMMIO)) { @@ -212,7 +212,7 @@ ehci_reset(ehci_softc_t *sc) return (0); } } - device_printf(sc->sc_bus.bdev, "reset timeout\n"); + device_printf(sc->sc_bus.bdev, "Reset timeout\n"); return (USB_ERR_IOERROR); } @@ -224,7 +224,7 @@ ehci_hcreset(ehci_softc_t *sc) EOWRITE4(sc, EHCI_USBCMD, 0); /* Halt controller */ for (i = 0; i < 100; i++) { - usb_pause_mtx(NULL, hz / 1000); + usb_pause_mtx(NULL, hz / 128); hcr = EOREAD4(sc, EHCI_USBSTS) & EHCI_STS_HCH; if (hcr) break; @@ -237,7 +237,60 @@ ehci_hcreset(ehci_softc_t *sc) */ device_printf(sc->sc_bus.bdev, "stop timeout\n"); - return ehci_reset(sc); + return (ehci_reset(sc)); +} + +static int +ehci_init_sub(struct ehci_softc *sc) +{ + struct usb_page_search buf_res; + uint32_t cparams; + uint32_t hcr; + uint8_t i; + + cparams = EREAD4(sc, EHCI_HCCPARAMS); + + DPRINTF("cparams=0x%x\n", cparams); + + if (EHCI_HCC_64BIT(cparams)) { + DPRINTF("HCC uses 64-bit structures\n"); + + /* MUST clear segment register if 64 bit capable */ + EWRITE4(sc, EHCI_CTRLDSSEGMENT, 0); + } + + usbd_get_page(&sc->sc_hw.pframes_pc, 0, &buf_res); + EOWRITE4(sc, EHCI_PERIODICLISTBASE, buf_res.physaddr); + + usbd_get_page(&sc->sc_hw.async_start_pc, 0, &buf_res); + EOWRITE4(sc, EHCI_ASYNCLISTADDR, buf_res.physaddr | EHCI_LINK_QH); + + /* enable interrupts */ + EOWRITE4(sc, EHCI_USBINTR, sc->sc_eintrs); + + /* turn on controller */ + EOWRITE4(sc, EHCI_USBCMD, + EHCI_CMD_ITC_1 | /* 1 microframes interrupt delay */ + (EOREAD4(sc, EHCI_USBCMD) & EHCI_CMD_FLS_M) | + EHCI_CMD_ASE | + EHCI_CMD_PSE | + EHCI_CMD_RS); + + /* Take over port ownership */ + EOWRITE4(sc, EHCI_CONFIGFLAG, EHCI_CONF_CF); + + for (i = 0; i < 100; i++) { + usb_pause_mtx(NULL, hz / 128); + hcr = EOREAD4(sc, EHCI_USBSTS) & EHCI_STS_HCH; + if (!hcr) { + break; + } + } + if (hcr) { + device_printf(sc->sc_bus.bdev, "Run timeout\n"); + return (USB_ERR_IOERROR); + } + return (USB_ERR_NORMAL_COMPLETION); } usb_error_t @@ -246,8 +299,6 @@ ehci_init(ehci_softc_t *sc) struct usb_page_search buf_res; uint32_t version; uint32_t sparams; - uint32_t cparams; - uint32_t hcr; uint16_t i; uint16_t x; uint16_t y; @@ -279,15 +330,6 @@ ehci_init(ehci_softc_t *sc) DPRINTF("sparams=0x%x\n", sparams); sc->sc_noport = EHCI_HCS_N_PORTS(sparams); - cparams = EREAD4(sc, EHCI_HCCPARAMS); - DPRINTF("cparams=0x%x\n", cparams); - - if (EHCI_HCC_64BIT(cparams)) { - DPRINTF("HCC uses 64-bit structures\n"); - - /* MUST clear segment register if 64 bit capable */ - EWRITE4(sc, EHCI_CTRLDSSEGMENT, 0); - } sc->sc_bus.usbrev = USB_REV_2_0; /* Reset the controller */ @@ -464,9 +506,6 @@ ehci_init(ehci_softc_t *sc) [i & (EHCI_VIRTUAL_FRAMELIST_COUNT - 1)]->itd_self; } } - /* setup sync list pointer */ - EOWRITE4(sc, EHCI_PERIODICLISTBASE, buf_res.physaddr); - usbd_get_page(&sc->sc_hw.async_start_pc, 0, &buf_res); if (1) { @@ -511,35 +550,8 @@ ehci_init(ehci_softc_t *sc) } #endif - /* setup async list pointer */ - EOWRITE4(sc, EHCI_ASYNCLISTADDR, buf_res.physaddr | EHCI_LINK_QH); - - - /* enable interrupts */ - EOWRITE4(sc, EHCI_USBINTR, sc->sc_eintrs); - - /* turn on controller */ - EOWRITE4(sc, EHCI_USBCMD, - EHCI_CMD_ITC_1 | /* 1 microframes interrupt delay */ - (EOREAD4(sc, EHCI_USBCMD) & EHCI_CMD_FLS_M) | - EHCI_CMD_ASE | - EHCI_CMD_PSE | - EHCI_CMD_RS); - - /* Take over port ownership */ - EOWRITE4(sc, EHCI_CONFIGFLAG, EHCI_CONF_CF); - - for (i = 0; i < 100; i++) { - usb_pause_mtx(NULL, hz / 1000); - hcr = EOREAD4(sc, EHCI_USBSTS) & EHCI_STS_HCH; - if (!hcr) { - break; - } - } - if (hcr) { - device_printf(sc->sc_bus.bdev, "run timeout\n"); - return (USB_ERR_IOERROR); - } + /* finial setup */ + err = ehci_init_sub(sc); if (!err) { /* catch any lost interrupts */ @@ -573,137 +585,28 @@ ehci_detach(ehci_softc_t *sc) usb_callout_drain(&sc->sc_tmo_poll); } -void +static void ehci_suspend(ehci_softc_t *sc) { - uint32_t cmd; - uint32_t hcr; - uint8_t i; - - USB_BUS_LOCK(&sc->sc_bus); - - for (i = 1; i <= sc->sc_noport; i++) { - cmd = EOREAD4(sc, EHCI_PORTSC(i)); - if (((cmd & EHCI_PS_PO) == 0) && - ((cmd & EHCI_PS_PE) == EHCI_PS_PE)) { - EOWRITE4(sc, EHCI_PORTSC(i), - cmd | EHCI_PS_SUSP); - } - } - - sc->sc_cmd = EOREAD4(sc, EHCI_USBCMD); - - cmd = sc->sc_cmd & ~(EHCI_CMD_ASE | EHCI_CMD_PSE); - EOWRITE4(sc, EHCI_USBCMD, cmd); - - for (i = 0; i < 100; i++) { - hcr = EOREAD4(sc, EHCI_USBSTS) & - (EHCI_STS_ASS | EHCI_STS_PSS); - - if (hcr == 0) { - break; - } - usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 1000); - } - - if (hcr != 0) { - device_printf(sc->sc_bus.bdev, "reset timeout\n"); - } - cmd &= ~EHCI_CMD_RS; - EOWRITE4(sc, EHCI_USBCMD, cmd); - - for (i = 0; i < 100; i++) { - hcr = EOREAD4(sc, EHCI_USBSTS) & EHCI_STS_HCH; - if (hcr == EHCI_STS_HCH) { - break; - } - usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 1000); - } + DPRINTF("stopping the HC\n"); - if (hcr != EHCI_STS_HCH) { - device_printf(sc->sc_bus.bdev, - "config timeout\n"); - } - USB_BUS_UNLOCK(&sc->sc_bus); + /* reset HC */ + ehci_hcreset(sc); } -void +static void ehci_resume(ehci_softc_t *sc) { - struct usb_page_search buf_res; - uint32_t cmd; - uint32_t hcr; - uint8_t i; - - USB_BUS_LOCK(&sc->sc_bus); + /* reset HC */ + ehci_hcreset(sc); - /* restore things in case the bios doesn't */ - EOWRITE4(sc, EHCI_CTRLDSSEGMENT, 0); - - usbd_get_page(&sc->sc_hw.pframes_pc, 0, &buf_res); - EOWRITE4(sc, EHCI_PERIODICLISTBASE, buf_res.physaddr); - - usbd_get_page(&sc->sc_hw.async_start_pc, 0, &buf_res); - EOWRITE4(sc, EHCI_ASYNCLISTADDR, buf_res.physaddr | EHCI_LINK_QH); - - EOWRITE4(sc, EHCI_USBINTR, sc->sc_eintrs); - - hcr = 0; - for (i = 1; i <= sc->sc_noport; i++) { - cmd = EOREAD4(sc, EHCI_PORTSC(i)); - if (((cmd & EHCI_PS_PO) == 0) && - ((cmd & EHCI_PS_SUSP) == EHCI_PS_SUSP)) { - EOWRITE4(sc, EHCI_PORTSC(i), - cmd | EHCI_PS_FPR); - hcr = 1; - } - } - - if (hcr) { - usb_pause_mtx(&sc->sc_bus.bus_mtx, - USB_MS_TO_TICKS(USB_RESUME_WAIT)); - - for (i = 1; i <= sc->sc_noport; i++) { - cmd = EOREAD4(sc, EHCI_PORTSC(i)); - if (((cmd & EHCI_PS_PO) == 0) && - ((cmd & EHCI_PS_SUSP) == EHCI_PS_SUSP)) { - EOWRITE4(sc, EHCI_PORTSC(i), - cmd & ~EHCI_PS_FPR); - } - } - } - EOWRITE4(sc, EHCI_USBCMD, sc->sc_cmd); - - for (i = 0; i < 100; i++) { - hcr = EOREAD4(sc, EHCI_USBSTS) & EHCI_STS_HCH; - if (hcr != EHCI_STS_HCH) { - break; - } - usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 1000); - } - if (hcr == EHCI_STS_HCH) { - device_printf(sc->sc_bus.bdev, "config timeout\n"); - } - - USB_BUS_UNLOCK(&sc->sc_bus); - - usb_pause_mtx(NULL, - USB_MS_TO_TICKS(USB_RESUME_WAIT)); + /* setup HC */ + ehci_init_sub(sc); /* catch any lost interrupts */ ehci_do_poll(&sc->sc_bus); } -void -ehci_shutdown(ehci_softc_t *sc) -{ - DPRINTF("stopping the HC\n"); - - if (ehci_hcreset(sc)) { - DPRINTF("reset failed!\n"); - } -} - #ifdef USB_DEBUG static void ehci_dump_regs(ehci_softc_t *sc) @@ -3908,8 +3811,24 @@ ehci_device_suspend(struct usb_device *u } USB_BUS_UNLOCK(udev->bus); +} - return; +static void +ehci_set_hw_power_sleep(struct usb_bus *bus, uint32_t state) +{ + struct ehci_softc *sc = EHCI_BUS2SC(bus); + + switch (state) { + case USB_HW_POWER_SUSPEND: + case USB_HW_POWER_SHUTDOWN: + ehci_suspend(sc); + break; + case USB_HW_POWER_RESUME: + ehci_resume(sc); + break; + default: + break; + } } static void @@ -3955,6 +3874,7 @@ struct usb_bus_methods ehci_bus_methods .device_resume = ehci_device_resume, .device_suspend = ehci_device_suspend, .set_hw_power = ehci_set_hw_power, + .set_hw_power_sleep = ehci_set_hw_power_sleep, .roothub_exec = ehci_roothub_exec, .xfer_poll = ehci_do_poll, }; Modified: stable/8/sys/dev/usb/controller/ehci.h ============================================================================== --- stable/8/sys/dev/usb/controller/ehci.h Tue Jan 3 08:31:47 2012 (r229369) +++ stable/8/sys/dev/usb/controller/ehci.h Tue Jan 3 09:15:54 2012 (r229370) @@ -333,8 +333,6 @@ typedef struct ehci_softc { uint32_t sc_terminate_self; /* TD short packet termination pointer */ uint32_t sc_eintrs; - uint32_t sc_cmd; /* shadow of cmd register during - * suspend */ uint16_t sc_intr_stat[EHCI_VIRTUAL_FRAMELIST_COUNT]; uint16_t sc_id_vendor; /* vendor ID for root hub */ @@ -445,9 +443,6 @@ usb_bus_mem_cb_t ehci_iterate_hw_softc; usb_error_t ehci_reset(ehci_softc_t *sc); usb_error_t ehci_init(ehci_softc_t *sc); void ehci_detach(struct ehci_softc *sc); -void ehci_suspend(struct ehci_softc *sc); -void ehci_resume(struct ehci_softc *sc); -void ehci_shutdown(ehci_softc_t *sc); void ehci_interrupt(ehci_softc_t *sc); #endif /* _EHCI_H_ */ Modified: stable/8/sys/dev/usb/controller/ehci_ixp4xx.c ============================================================================== --- stable/8/sys/dev/usb/controller/ehci_ixp4xx.c Tue Jan 3 08:31:47 2012 (r229369) +++ stable/8/sys/dev/usb/controller/ehci_ixp4xx.c Tue Jan 3 09:15:54 2012 (r229370) @@ -78,9 +78,6 @@ struct ixp_ehci_softc { static device_attach_t ehci_ixp_attach; static device_detach_t ehci_ixp_detach; -static device_shutdown_t ehci_ixp_shutdown; -static device_suspend_t ehci_ixp_suspend; -static device_resume_t ehci_ixp_resume; static uint8_t ehci_bs_r_1(void *, bus_space_handle_t, bus_size_t); static void ehci_bs_w_1(void *, bus_space_handle_t, bus_size_t, u_int8_t); @@ -90,45 +87,6 @@ static uint32_t ehci_bs_r_4(void *, bus_ static void ehci_bs_w_4(void *, bus_space_handle_t, bus_size_t, uint32_t); static int -ehci_ixp_suspend(device_t self) -{ - ehci_softc_t *sc = device_get_softc(self); - int err; - - err = bus_generic_suspend(self); - if (err) - return (err); - ehci_suspend(sc); - return (0); -} - -static int -ehci_ixp_resume(device_t self) -{ - ehci_softc_t *sc = device_get_softc(self); - - ehci_resume(sc); - - bus_generic_resume(self); - - return (0); -} - -static int -ehci_ixp_shutdown(device_t self) -{ - ehci_softc_t *sc = device_get_softc(self); - int err; - - err = bus_generic_shutdown(self); - if (err) - return (err); - ehci_shutdown(sc); - - return (0); -} - -static int ehci_ixp_probe(device_t self) { @@ -335,9 +293,9 @@ static device_method_t ehci_methods[] = DEVMETHOD(device_probe, ehci_ixp_probe), DEVMETHOD(device_attach, ehci_ixp_attach), DEVMETHOD(device_detach, ehci_ixp_detach), - DEVMETHOD(device_suspend, ehci_ixp_suspend), - DEVMETHOD(device_resume, ehci_ixp_resume), - DEVMETHOD(device_shutdown, ehci_ixp_shutdown), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + DEVMETHOD(device_shutdown, bus_generic_shutdown), /* Bus interface */ DEVMETHOD(bus_print_child, bus_generic_print_child), Modified: stable/8/sys/dev/usb/controller/ehci_pci.c ============================================================================== --- stable/8/sys/dev/usb/controller/ehci_pci.c Tue Jan 3 08:31:47 2012 (r229369) +++ stable/8/sys/dev/usb/controller/ehci_pci.c Tue Jan 3 09:15:54 2012 (r229370) @@ -77,6 +77,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include "usb_if.h" #define PCI_EHCI_VENDORID_ACERLABS 0x10b9 #define PCI_EHCI_VENDORID_AMD 0x1022 @@ -92,54 +93,10 @@ __FBSDID("$FreeBSD$"); #define PCI_EHCI_VENDORID_NVIDIA2 0x10DE #define PCI_EHCI_VENDORID_VIA 0x1106 -static void ehci_pci_takecontroller(device_t self); - static device_probe_t ehci_pci_probe; static device_attach_t ehci_pci_attach; static device_detach_t ehci_pci_detach; -static device_suspend_t ehci_pci_suspend; -static device_resume_t ehci_pci_resume; -static device_shutdown_t ehci_pci_shutdown; - -static int -ehci_pci_suspend(device_t self) -{ - ehci_softc_t *sc = device_get_softc(self); - int err; - - err = bus_generic_suspend(self); - if (err) - return (err); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 09:17:51 2012 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 44F13106564A; Tue, 3 Jan 2012 09:17:51 +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 326E78FC26; Tue, 3 Jan 2012 09:17:51 +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 q039HoTi014287; Tue, 3 Jan 2012 09:17:50 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q039Houk014285; Tue, 3 Jan 2012 09:17:50 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201201030917.q039Houk014285@svn.freebsd.org> From: Hans Petter Selasky Date: Tue, 3 Jan 2012 09:17:50 +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: r229371 - in stable/8/sys: conf 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: Tue, 03 Jan 2012 09:17:51 -0000 Author: hselasky Date: Tue Jan 3 09:17:50 2012 New Revision: 229371 URL: http://svn.freebsd.org/changeset/base/229371 Log: MFC r228758: - Fix for race against user-space applications trying to change the configuration on USB HUBs. PR: kern/163091 Modified: stable/8/sys/dev/usb/usb_hub.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/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/usb/usb_hub.c ============================================================================== --- stable/8/sys/dev/usb/usb_hub.c Tue Jan 3 09:15:54 2012 (r229370) +++ stable/8/sys/dev/usb/usb_hub.c Tue Jan 3 09:17:50 2012 (r229371) @@ -707,6 +707,13 @@ uhub_explore(struct usb_device *udev) DPRINTF("Device is suspended!\n"); return (0); } + + /* + * Make sure we don't race against user-space applications + * like LibUSB: + */ + usbd_enum_lock(udev); + for (x = 0; x != hub->nports; x++) { up = hub->ports + x; portno = x + 1; @@ -784,6 +791,8 @@ uhub_explore(struct usb_device *udev) up->restartcnt = 0; } + usbd_enum_unlock(udev); + /* initial status checked */ sc->sc_flags |= UHUB_FLAG_DID_EXPLORE; From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 09:27:23 2012 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 8B22D1065680; Tue, 3 Jan 2012 09:27:23 +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 792E58FC0A; Tue, 3 Jan 2012 09:27: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 q039RNsf014635; Tue, 3 Jan 2012 09:27:23 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q039RN4v014633; Tue, 3 Jan 2012 09:27:23 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201030927.q039RN4v014633@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 3 Jan 2012 09:27:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229372 - stable/9/sys/i386/include 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, 03 Jan 2012 09:27:23 -0000 Author: kib Date: Tue Jan 3 09:27:23 2012 New Revision: 229372 URL: http://svn.freebsd.org/changeset/base/229372 Log: MFC r229104: Make the comment in i386/include/ucontext.h identical to the one in amd64/include/ucontext.h. The later is better worded. Modified: stable/9/sys/i386/include/ucontext.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/i386/include/ucontext.h ============================================================================== --- stable/9/sys/i386/include/ucontext.h Tue Jan 3 09:17:50 2012 (r229371) +++ stable/9/sys/i386/include/ucontext.h Tue Jan 3 09:27:23 2012 (r229372) @@ -33,9 +33,10 @@ typedef struct __mcontext { /* - * The definition of mcontext_t shall match the layout of - * struct sigcontext after the sc_mask member. So that we can - * support sigcontext and ucontext_t at the same time. + * The definition of mcontext_t must match the layout of + * struct sigcontext after the sc_mask member. This is so + * that we can support sigcontext and ucontext_t at the same + * time. */ __register_t mc_onstack; /* XXX - sigcontext compat. */ __register_t mc_gs; /* machine state (struct trapframe) */ From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 09:40:31 2012 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 F015D106564A; Tue, 3 Jan 2012 09:40:31 +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 D36E78FC17; Tue, 3 Jan 2012 09:40:31 +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 q039eVL1015095; Tue, 3 Jan 2012 09:40:31 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q039eVVJ015091; Tue, 3 Jan 2012 09:40:31 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201030940.q039eVVJ015091@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 3 Jan 2012 09:40:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229373 - in stable/9/sys/arm: arm include 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, 03 Jan 2012 09:40:32 -0000 Author: kib Date: Tue Jan 3 09:40:31 2012 New Revision: 229373 URL: http://svn.freebsd.org/changeset/base/229373 Log: MFC rr225973: Convert ARM to the syscallenter/syscallret system call sequence handlers. Modified: stable/9/sys/arm/arm/elf_machdep.c stable/9/sys/arm/arm/trap.c stable/9/sys/arm/include/proc.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/arm/arm/elf_machdep.c ============================================================================== --- stable/9/sys/arm/arm/elf_machdep.c Tue Jan 3 09:27:23 2012 (r229372) +++ stable/9/sys/arm/arm/elf_machdep.c Tue Jan 3 09:40:31 2012 (r229373) @@ -76,7 +76,7 @@ struct sysentvec elf32_freebsd_sysvec = .sv_maxssiz = NULL, .sv_flags = SV_ABI_FREEBSD | SV_ILP32, .sv_set_syscall_retval = cpu_set_syscall_retval, - .sv_fetch_syscall_args = NULL, /* XXXKIB */ + .sv_fetch_syscall_args = cpu_fetch_syscall_args, .sv_syscallnames = syscallnames, .sv_schedtail = NULL, }; Modified: stable/9/sys/arm/arm/trap.c ============================================================================== --- stable/9/sys/arm/arm/trap.c Tue Jan 3 09:27:23 2012 (r229372) +++ stable/9/sys/arm/arm/trap.c Tue Jan 3 09:40:31 2012 (r229373) @@ -861,98 +861,68 @@ badaddr_read(void *addr, size_t size, vo return (rv); } -#define MAXARGS 8 +int +cpu_fetch_syscall_args(struct thread *td, struct syscall_args *sa) +{ + struct proc *p; + register_t *ap; + int error; + + sa->code = sa->insn & 0x000fffff; + ap = &td->td_frame->tf_r0; + if (sa->code == SYS_syscall) { + sa->code = *ap++; + sa->nap--; + } else if (sa->code == SYS___syscall) { + sa->code = ap[_QUAD_LOWWORD]; + sa->nap -= 2; + ap += 2; + } + p = td->td_proc; + if (p->p_sysent->sv_mask) + sa->code &= p->p_sysent->sv_mask; + if (sa->code >= p->p_sysent->sv_size) + sa->callp = &p->p_sysent->sv_table[0]; + else + sa->callp = &p->p_sysent->sv_table[sa->code]; + sa->narg = sa->callp->sy_narg; + error = 0; + memcpy(sa->args, ap, sa->nap * sizeof(register_t)); + if (sa->narg > sa->nap) { + error = copyin((void *)td->td_frame->tf_usr_sp, sa->args + + sa->nap, (sa->narg - sa->nap) * sizeof(register_t)); + } + if (error == 0) { + td->td_retval[0] = 0; + td->td_retval[1] = 0; + } + return (error); +} + +#include "../../kern/subr_syscall.c" + static void syscall(struct thread *td, trapframe_t *frame, u_int32_t insn) { - struct proc *p = td->td_proc; - int code, error; - u_int nap, nargs; - register_t *ap, *args, copyargs[MAXARGS]; - struct sysent *callp; + struct syscall_args sa; + int error; - PCPU_INC(cnt.v_syscall); - td->td_pticks = 0; - if (td->td_ucred != td->td_proc->p_ucred) - cred_update_thread(td); + td->td_frame = frame; + sa.insn = insn; switch (insn & SWI_OS_MASK) { case 0: /* XXX: we need our own one. */ - nap = 4; + sa.nap = 4; break; default: call_trapsignal(td, SIGILL, 0); userret(td, frame); return; } - code = insn & 0x000fffff; - td->td_pticks = 0; - ap = &frame->tf_r0; - if (code == SYS_syscall) { - code = *ap++; - - nap--; - } else if (code == SYS___syscall) { - code = ap[_QUAD_LOWWORD]; - nap -= 2; - ap += 2; - } - if (p->p_sysent->sv_mask) - code &= p->p_sysent->sv_mask; - if (code >= p->p_sysent->sv_size) - callp = &p->p_sysent->sv_table[0]; - else - callp = &p->p_sysent->sv_table[code]; - nargs = callp->sy_narg; - memcpy(copyargs, ap, nap * sizeof(register_t)); - if (nargs > nap) { - error = copyin((void *)frame->tf_usr_sp, copyargs + nap, - (nargs - nap) * sizeof(register_t)); - if (error) - goto bad; - } - args = copyargs; - error = 0; -#ifdef KTRACE - if (KTRPOINT(td, KTR_SYSCALL)) - ktrsyscall(code, nargs, args); -#endif - - CTR4(KTR_SYSC, "syscall enter thread %p pid %d proc %s code %d", td, - td->td_proc->p_pid, td->td_name, code); - if (error == 0) { - td->td_retval[0] = 0; - td->td_retval[1] = 0; - STOPEVENT(p, S_SCE, callp->sy_narg); - PTRACESTOP_SC(p, td, S_PT_SCE); - AUDIT_SYSCALL_ENTER(code, td); - error = (*callp->sy_call)(td, args); - AUDIT_SYSCALL_EXIT(error, td); - KASSERT(td->td_ar == NULL, - ("returning from syscall with td_ar set!")); - } -bad: - cpu_set_syscall_retval(td, error); - - WITNESS_WARN(WARN_PANIC, NULL, "System call %s returning", - (code >= 0 && code < SYS_MAXSYSCALL) ? syscallnames[code] : "???"); - KASSERT(td->td_critnest == 0, - ("System call %s returning in a critical section", - (code >= 0 && code < SYS_MAXSYSCALL) ? syscallnames[code] : "???")); - KASSERT(td->td_locks == 0, - ("System call %s returning with %d locks held", - (code >= 0 && code < SYS_MAXSYSCALL) ? syscallnames[code] : "???", - td->td_locks)); - - userret(td, frame); - CTR4(KTR_SYSC, "syscall exit thread %p pid %d proc %s code %d", td, - td->td_proc->p_pid, td->td_name, code); - - STOPEVENT(p, S_SCX, code); - PTRACESTOP_SC(p, td, S_PT_SCX); -#ifdef KTRACE - if (KTRPOINT(td, KTR_SYSRET)) - ktrsysret(code, error, td->td_retval[0]); -#endif + + error = syscallenter(td, &sa); + KASSERT(error != 0 || td->td_ar == NULL, + ("returning from syscall with td_ar set!")); + syscallret(td, error, &sa); } void Modified: stable/9/sys/arm/include/proc.h ============================================================================== --- stable/9/sys/arm/include/proc.h Tue Jan 3 09:27:23 2012 (r229372) +++ stable/9/sys/arm/include/proc.h Tue Jan 3 09:40:31 2012 (r229373) @@ -62,4 +62,15 @@ struct mdproc { #define KINFO_PROC_SIZE 792 +#define MAXARGS 8 +struct syscall_args { + u_int code; + struct sysent *callp; + register_t args[MAXARGS]; + int narg; + u_int nap; + u_int32_t insn; +}; +#define HAVE_SYSCALL_ARGS_DEF 1 + #endif /* !_MACHINE_PROC_H_ */ From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 09:42:09 2012 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 0BC481065670; Tue, 3 Jan 2012 09:42:09 +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 ECC7C8FC0C; Tue, 3 Jan 2012 09:42:08 +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 q039g8VY015210; Tue, 3 Jan 2012 09:42:08 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q039g8kH015205; Tue, 3 Jan 2012 09:42:08 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201030942.q039g8kH015205@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 3 Jan 2012 09:42:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229374 - in stable/9/sys/mips: include mips 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, 03 Jan 2012 09:42:09 -0000 Author: kib Date: Tue Jan 3 09:42:08 2012 New Revision: 229374 URL: http://svn.freebsd.org/changeset/base/229374 Log: MFC r226065: Convert MIPS to the syscallenter/syscallret system call sequence handlers. Modified: stable/9/sys/mips/include/proc.h stable/9/sys/mips/mips/elf64_machdep.c stable/9/sys/mips/mips/elf_machdep.c stable/9/sys/mips/mips/trap.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/mips/include/proc.h ============================================================================== --- stable/9/sys/mips/include/proc.h Tue Jan 3 09:40:31 2012 (r229373) +++ stable/9/sys/mips/include/proc.h Tue Jan 3 09:42:08 2012 (r229374) @@ -67,11 +67,22 @@ struct mdproc { /* empty */ }; +#ifdef _KERNEL struct thread; void mips_cpu_switch(struct thread *, struct thread *, struct mtx *); void mips_cpu_throw(struct thread *, struct thread *); +struct syscall_args { + u_int code; + struct sysent *callp; + register_t args[8]; + int narg; + struct trapframe *trapframe; +}; +#define HAVE_SYSCALL_ARGS_DEF 1 +#endif + #ifdef __mips_n64 #define KINFO_PROC_SIZE 1088 #else Modified: stable/9/sys/mips/mips/elf64_machdep.c ============================================================================== --- stable/9/sys/mips/mips/elf64_machdep.c Tue Jan 3 09:40:31 2012 (r229373) +++ stable/9/sys/mips/mips/elf64_machdep.c Tue Jan 3 09:42:08 2012 (r229374) @@ -80,8 +80,8 @@ struct sysentvec elf64_freebsd_sysvec = .sv_maxssiz = NULL, .sv_flags = SV_ABI_FREEBSD | SV_LP64, .sv_set_syscall_retval = cpu_set_syscall_retval, - .sv_fetch_syscall_args = NULL, /* XXXKIB */ - .sv_syscallnames = NULL, + .sv_fetch_syscall_args = cpu_fetch_syscall_args, + .sv_syscallnames = syscallnames, .sv_schedtail = NULL, }; Modified: stable/9/sys/mips/mips/elf_machdep.c ============================================================================== --- stable/9/sys/mips/mips/elf_machdep.c Tue Jan 3 09:40:31 2012 (r229373) +++ stable/9/sys/mips/mips/elf_machdep.c Tue Jan 3 09:42:08 2012 (r229374) @@ -80,7 +80,7 @@ struct sysentvec elf64_freebsd_sysvec = .sv_maxssiz = NULL, .sv_flags = SV_ABI_FREEBSD | SV_LP64, .sv_set_syscall_retval = cpu_set_syscall_retval, - .sv_fetch_syscall_args = NULL, /* XXXKIB */ + .sv_fetch_syscall_args = cpu_fetch_syscall_args, .sv_syscallnames = syscallnames, .sv_schedtail = NULL, }; @@ -136,7 +136,7 @@ struct sysentvec elf32_freebsd_sysvec = .sv_maxssiz = NULL, .sv_flags = SV_ABI_FREEBSD | SV_ILP32, .sv_set_syscall_retval = cpu_set_syscall_retval, - .sv_fetch_syscall_args = NULL, /* XXXKIB */ + .sv_fetch_syscall_args = cpu_fetch_syscall_args, .sv_syscallnames = syscallnames, .sv_schedtail = NULL, }; Modified: stable/9/sys/mips/mips/trap.c ============================================================================== --- stable/9/sys/mips/mips/trap.c Tue Jan 3 09:40:31 2012 (r229373) +++ stable/9/sys/mips/mips/trap.c Tue Jan 3 09:42:08 2012 (r229374) @@ -261,6 +261,133 @@ static int emulate_unaligned_access(stru extern void fswintrberr(void); /* XXX */ +int +cpu_fetch_syscall_args(struct thread *td, struct syscall_args *sa) +{ + struct trapframe *locr0 = td->td_frame; + struct sysentvec *se; + int error, nsaved; + + bzero(sa->args, sizeof(sa->args)); + + /* compute next PC after syscall instruction */ + td->td_pcb->pcb_tpc = sa->trapframe->pc; /* Remember if restart */ + if (DELAYBRANCH(sa->trapframe->cause)) /* Check BD bit */ + locr0->pc = MipsEmulateBranch(locr0, sa->trapframe->pc, 0, 0); + else + locr0->pc += sizeof(int); + sa->code = locr0->v0; + + switch (sa->code) { +#if defined(__mips_n32) || defined(__mips_n64) + case SYS___syscall: + /* + * Quads fit in a single register in + * new ABIs. + * + * XXX o64? + */ +#endif + case SYS_syscall: + /* + * Code is first argument, followed by + * actual args. + */ + sa->code = locr0->a0; + sa->args[0] = locr0->a1; + sa->args[1] = locr0->a2; + sa->args[2] = locr0->a3; + nsaved = 3; +#if defined(__mips_n32) || defined(__mips_n64) + sa->args[3] = locr0->t4; + sa->args[4] = locr0->t5; + sa->args[5] = locr0->t6; + sa->args[6] = locr0->t7; + nsaved += 4; +#endif + break; + +#if defined(__mips_o32) + case SYS___syscall: + /* + * Like syscall, but code is a quad, so as + * to maintain quad alignment for the rest + * of the arguments. + */ + if (_QUAD_LOWWORD == 0) + sa->code = locr0->a0; + else + sa->code = locr0->a1; + sa->args[0] = locr0->a2; + sa->args[1] = locr0->a3; + nsaved = 2; + break; +#endif + + default: + sa->args[0] = locr0->a0; + sa->args[1] = locr0->a1; + sa->args[2] = locr0->a2; + sa->args[3] = locr0->a3; + nsaved = 4; +#if defined (__mips_n32) || defined(__mips_n64) + sa->args[4] = locr0->t4; + sa->args[5] = locr0->t5; + sa->args[6] = locr0->t6; + sa->args[7] = locr0->t7; + nsaved += 4; +#endif + break; + } +#ifdef TRAP_DEBUG + if (trap_debug) + printf("SYSCALL #%d pid:%u\n", code, p->p_pid); +#endif + + se = td->td_proc->p_sysent; + if (se->sv_mask) + sa->code &= se->sv_mask; + + if (sa->code >= se->sv_size) + sa->callp = &se->sv_table[0]; + else + sa->callp = &se->sv_table[sa->code]; + + sa->narg = sa->callp->sy_narg; + + if (sa->narg > nsaved) { +#if defined(__mips_n32) || defined(__mips_n64) + /* + * XXX + * Is this right for new ABIs? I think the 4 there + * should be 8, size there are 8 registers to skip, + * not 4, but I'm not certain. + */ + printf("SYSCALL #%u pid:%u, nargs > nsaved.\n", sa->code, + td->td_proc->p_pid); +#endif + error = copyin((caddr_t)(intptr_t)(locr0->sp + + 4 * sizeof(register_t)), (caddr_t)&sa->args[nsaved], + (u_int)(sa->narg - nsaved) * sizeof(register_t)); + if (error != 0) { + locr0->v0 = error; + locr0->a3 = 1; + } + } else + error = 0; + + if (error == 0) { + td->td_retval[0] = 0; + td->td_retval[1] = locr0->v1; + } + + return (error); +} + +#undef __FBSDID +#define __FBSDID(x) +#include "../../kern/subr_syscall.c" + /* * Handle an exception. * Called from MipsKernGenException() or MipsUserGenException() @@ -527,177 +654,19 @@ dofault: case T_SYSCALL + T_USER: { - struct trapframe *locr0 = td->td_frame; - struct sysent *callp; - unsigned int code; - int nargs, nsaved; - register_t args[8]; + struct syscall_args sa; + int error; - bzero(args, sizeof args); - - /* - * note: PCPU_LAZY_INC() can only be used if we can - * afford occassional inaccuracy in the count. - */ - PCPU_LAZY_INC(cnt.v_syscall); - if (td->td_ucred != p->p_ucred) - cred_update_thread(td); -#ifdef KSE - if (p->p_flag & P_SA) - thread_user_enter(td); -#endif - /* compute next PC after syscall instruction */ - td->td_pcb->pcb_tpc = trapframe->pc; /* Remember if restart */ - if (DELAYBRANCH(trapframe->cause)) { /* Check BD bit */ - locr0->pc = MipsEmulateBranch(locr0, trapframe->pc, 0, - 0); - } else { - locr0->pc += sizeof(int); - } - code = locr0->v0; - - switch (code) { -#if defined(__mips_n32) || defined(__mips_n64) - case SYS___syscall: - /* - * Quads fit in a single register in - * new ABIs. - * - * XXX o64? - */ -#endif - case SYS_syscall: - /* - * Code is first argument, followed by - * actual args. - */ - code = locr0->a0; - args[0] = locr0->a1; - args[1] = locr0->a2; - args[2] = locr0->a3; - nsaved = 3; -#if defined(__mips_n32) || defined(__mips_n64) - args[3] = locr0->t4; - args[4] = locr0->t5; - args[5] = locr0->t6; - args[6] = locr0->t7; - nsaved += 4; -#endif - break; - -#if defined(__mips_o32) - case SYS___syscall: - /* - * Like syscall, but code is a quad, so as - * to maintain quad alignment for the rest - * of the arguments. - */ - if (_QUAD_LOWWORD == 0) { - code = locr0->a0; - } else { - code = locr0->a1; - } - args[0] = locr0->a2; - args[1] = locr0->a3; - nsaved = 2; - break; -#endif - - default: - args[0] = locr0->a0; - args[1] = locr0->a1; - args[2] = locr0->a2; - args[3] = locr0->a3; - nsaved = 4; -#if defined (__mips_n32) || defined(__mips_n64) - args[4] = locr0->t4; - args[5] = locr0->t5; - args[6] = locr0->t6; - args[7] = locr0->t7; - nsaved += 4; -#endif - } -#ifdef TRAP_DEBUG - if (trap_debug) { - printf("SYSCALL #%d pid:%u\n", code, p->p_pid); - } -#endif - - if (p->p_sysent->sv_mask) - code &= p->p_sysent->sv_mask; - - if (code >= p->p_sysent->sv_size) - callp = &p->p_sysent->sv_table[0]; - else - callp = &p->p_sysent->sv_table[code]; - - nargs = callp->sy_narg; - - if (nargs > nsaved) { -#if defined(__mips_n32) || defined(__mips_n64) - /* - * XXX - * Is this right for new ABIs? I think the 4 there - * should be 8, size there are 8 registers to skip, - * not 4, but I'm not certain. - */ - printf("SYSCALL #%u pid:%u, nargs > nsaved.\n", code, p->p_pid); -#endif - i = copyin((caddr_t)(intptr_t)(locr0->sp + - 4 * sizeof(register_t)), (caddr_t)&args[nsaved], - (u_int)(nargs - nsaved) * sizeof(register_t)); - if (i) { - locr0->v0 = i; - locr0->a3 = 1; -#ifdef KTRACE - if (KTRPOINT(td, KTR_SYSCALL)) - ktrsyscall(code, nargs, args); -#endif - goto done; - } - } -#ifdef TRAP_DEBUG - if (trap_debug) { - for (i = 0; i < nargs; i++) { - printf("args[%d] = %#jx\n", i, (intmax_t)args[i]); - } - } -#endif -#ifdef SYSCALL_TRACING - printf("%s(", syscallnames[code]); - for (i = 0; i < nargs; i++) { - printf("%s%#jx", i == 0 ? "" : ", ", (intmax_t)args[i]); - } - printf(")\n"); -#endif -#ifdef KTRACE - if (KTRPOINT(td, KTR_SYSCALL)) - ktrsyscall(code, nargs, args); -#endif - td->td_retval[0] = 0; - td->td_retval[1] = locr0->v1; + sa.trapframe = trapframe; + error = syscallenter(td, &sa); #if !defined(SMP) && (defined(DDB) || defined(DEBUG)) if (trp == trapdebug) - trapdebug[TRAPSIZE - 1].code = code; + trapdebug[TRAPSIZE - 1].code = sa.code; else - trp[-1].code = code; + trp[-1].code = sa.code; #endif - STOPEVENT(p, S_SCE, nargs); - - PTRACESTOP_SC(p, td, S_PT_SCE); - i = (*callp->sy_call) (td, args); -#if 0 - /* - * Reinitialize proc pointer `p' as it may be - * different if this is a child returning from fork - * syscall. - */ - td = curthread; - locr0 = td->td_frame; -#endif - trapdebug_enter(locr0, -code); - cpu_set_syscall_retval(td, i); + trapdebug_enter(td->td_frame, -sa.code); /* * The sync'ing of I & D caches for SYS_ptrace() is @@ -705,38 +674,7 @@ dofault: * instead of being done here under a special check * for SYS_ptrace(). */ - done: - /* - * Check for misbehavior. - */ - WITNESS_WARN(WARN_PANIC, NULL, "System call %s returning", - (code >= 0 && code < SYS_MAXSYSCALL) ? - syscallnames[code] : "???"); - KASSERT(td->td_critnest == 0, - ("System call %s returning in a critical section", - (code >= 0 && code < SYS_MAXSYSCALL) ? - syscallnames[code] : "???")); - KASSERT(td->td_locks == 0, - ("System call %s returning with %d locks held", - (code >= 0 && code < SYS_MAXSYSCALL) ? - syscallnames[code] : "???", - td->td_locks)); - userret(td, trapframe); -#ifdef KTRACE - if (KTRPOINT(td, KTR_SYSRET)) - ktrsysret(code, i, td->td_retval[0]); -#endif - /* - * This works because errno is findable through the - * register set. If we ever support an emulation - * where this is not the case, this code will need - * to be revisited. - */ - STOPEVENT(p, S_SCX, code); - - PTRACESTOP_SC(p, td, S_PT_SCX); - - mtx_assert(&Giant, MA_NOTOWNED); + syscallret(td, error, &sa); return (trapframe->pc); } From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 09:42:32 2012 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 4D8381065672; Tue, 3 Jan 2012 09:42:32 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3C3C78FC13; Tue, 3 Jan 2012 09:42: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 q039gWcK015260; Tue, 3 Jan 2012 09:42:32 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q039gWv9015258; Tue, 3 Jan 2012 09:42:32 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201201030942.q039gWv9015258@svn.freebsd.org> From: Bernhard Schmidt Date: Tue, 3 Jan 2012 09:42: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: r229375 - head/sys/dev/iwn 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, 03 Jan 2012 09:42:32 -0000 Author: bschmidt Date: Tue Jan 3 09:42:31 2012 New Revision: 229375 URL: http://svn.freebsd.org/changeset/base/229375 Log: Don't rely on MCS7 being at index 7 while determining the amount of antennas to use. Not all APs enable all MCS rates. Poked by: Lucius Windschuh MFC after: 1 week Modified: head/sys/dev/iwn/if_iwn.c Modified: head/sys/dev/iwn/if_iwn.c ============================================================================== --- head/sys/dev/iwn/if_iwn.c Tue Jan 3 09:42:08 2012 (r229374) +++ head/sys/dev/iwn/if_iwn.c Tue Jan 3 09:42:31 2012 (r229375) @@ -2128,7 +2128,7 @@ iwn_newassoc(struct ieee80211_node *ni, plcp |= IWN_RFLAG_SGI; } else if (ni->ni_htcap & IEEE80211_HTCAP_SHORTGI20) plcp |= IWN_RFLAG_SGI; - if (i > 7) + if (RV(ni->ni_htrates.rs_rates[i]) > 7) plcp |= IWN_RFLAG_ANT(txant1 | txant2); else plcp |= IWN_RFLAG_ANT(txant1); From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 09:43:27 2012 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 38BB41065673; Tue, 3 Jan 2012 09:43:27 +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 252F38FC17; Tue, 3 Jan 2012 09:43:27 +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 q039hRU6015344; Tue, 3 Jan 2012 09:43:27 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q039hQ93015335; Tue, 3 Jan 2012 09:43:26 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201030943.q039hQ93015335@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 3 Jan 2012 09:43:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229376 - in stable/9/sys: amd64/include arm/include i386/include ia64/include mips/include powerpc/include sparc64/include 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, 03 Jan 2012 09:43:27 -0000 Author: kib Date: Tue Jan 3 09:43:26 2012 New Revision: 229376 URL: http://svn.freebsd.org/changeset/base/229376 Log: MFC r226112: Remove unused define. Modified: stable/9/sys/amd64/include/proc.h stable/9/sys/arm/include/proc.h stable/9/sys/i386/include/proc.h stable/9/sys/ia64/include/proc.h stable/9/sys/mips/include/proc.h stable/9/sys/powerpc/include/proc.h stable/9/sys/sparc64/include/proc.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/amd64/include/proc.h ============================================================================== --- stable/9/sys/amd64/include/proc.h Tue Jan 3 09:42:31 2012 (r229375) +++ stable/9/sys/amd64/include/proc.h Tue Jan 3 09:43:26 2012 (r229376) @@ -85,8 +85,6 @@ struct syscall_args { register_t args[8]; int narg; }; -#define HAVE_SYSCALL_ARGS_DEF 1 - #endif /* _KERNEL */ #endif /* !_MACHINE_PROC_H_ */ Modified: stable/9/sys/arm/include/proc.h ============================================================================== --- stable/9/sys/arm/include/proc.h Tue Jan 3 09:42:31 2012 (r229375) +++ stable/9/sys/arm/include/proc.h Tue Jan 3 09:43:26 2012 (r229376) @@ -71,6 +71,5 @@ struct syscall_args { u_int nap; u_int32_t insn; }; -#define HAVE_SYSCALL_ARGS_DEF 1 #endif /* !_MACHINE_PROC_H_ */ Modified: stable/9/sys/i386/include/proc.h ============================================================================== --- stable/9/sys/i386/include/proc.h Tue Jan 3 09:42:31 2012 (r229375) +++ stable/9/sys/i386/include/proc.h Tue Jan 3 09:43:26 2012 (r229376) @@ -83,8 +83,6 @@ struct syscall_args { register_t args[8]; int narg; }; -#define HAVE_SYSCALL_ARGS_DEF 1 - #endif /* _KERNEL */ #endif /* !_MACHINE_PROC_H_ */ Modified: stable/9/sys/ia64/include/proc.h ============================================================================== --- stable/9/sys/ia64/include/proc.h Tue Jan 3 09:42:31 2012 (r229375) +++ stable/9/sys/ia64/include/proc.h Tue Jan 3 09:43:26 2012 (r229376) @@ -49,7 +49,6 @@ struct syscall_args { register_t args32[8]; int narg; }; -#define HAVE_SYSCALL_ARGS_DEF 1 #endif #endif /* !_MACHINE_PROC_H_ */ Modified: stable/9/sys/mips/include/proc.h ============================================================================== --- stable/9/sys/mips/include/proc.h Tue Jan 3 09:42:31 2012 (r229375) +++ stable/9/sys/mips/include/proc.h Tue Jan 3 09:43:26 2012 (r229376) @@ -80,7 +80,6 @@ struct syscall_args { int narg; struct trapframe *trapframe; }; -#define HAVE_SYSCALL_ARGS_DEF 1 #endif #ifdef __mips_n64 Modified: stable/9/sys/powerpc/include/proc.h ============================================================================== --- stable/9/sys/powerpc/include/proc.h Tue Jan 3 09:42:31 2012 (r229375) +++ stable/9/sys/powerpc/include/proc.h Tue Jan 3 09:43:26 2012 (r229376) @@ -60,7 +60,6 @@ struct syscall_args { register_t args[10]; int narg; }; -#define HAVE_SYSCALL_ARGS_DEF 1 #endif #endif /* !_MACHINE_PROC_H_ */ Modified: stable/9/sys/sparc64/include/proc.h ============================================================================== --- stable/9/sys/sparc64/include/proc.h Tue Jan 3 09:42:31 2012 (r229375) +++ stable/9/sys/sparc64/include/proc.h Tue Jan 3 09:43:26 2012 (r229376) @@ -61,7 +61,6 @@ struct syscall_args { register_t args[8]; int narg; }; -#define HAVE_SYSCALL_ARGS_DEF 1 #endif From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 09:46:52 2012 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 6491B1065672; Tue, 3 Jan 2012 09:46:52 +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 52A5A8FC0A; Tue, 3 Jan 2012 09:46:52 +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 q039kpoZ015522; Tue, 3 Jan 2012 09:46:51 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q039kpsN015520; Tue, 3 Jan 2012 09:46:51 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201030946.q039kpsN015520@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 3 Jan 2012 09:46:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229377 - stable/9/lib/libc/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: Tue, 03 Jan 2012 09:46:52 -0000 Author: kib Date: Tue Jan 3 09:46:51 2012 New Revision: 229377 URL: http://svn.freebsd.org/changeset/base/229377 Log: MFC r225974: Remove no longer valid statement about ARM. MFC r226066: Remove no longer needed BUGS section. Modified: stable/9/lib/libc/sys/ptrace.2 Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/sys/ptrace.2 ============================================================================== --- stable/9/lib/libc/sys/ptrace.2 Tue Jan 3 09:43:26 2012 (r229376) +++ stable/9/lib/libc/sys/ptrace.2 Tue Jan 3 09:46:51 2012 (r229377) @@ -2,7 +2,7 @@ .\" $NetBSD: ptrace.2,v 1.2 1995/02/27 12:35:37 cgd Exp $ .\" .\" This file is in the public domain. -.Dd January 23, 2011 +.Dd October 5, 2011 .Dt PTRACE 2 .Os .Sh NAME @@ -599,11 +599,3 @@ The .Fn ptrace function appeared in .At v7 . -.Sh BUGS -The -.Dv PL_FLAG_FORKED , -.Dv PL_FLAG_SCE , -.Dv PL_FLAG_SCX -and -.Dv PL_FLAG_EXEC -are not implemented for MIPS and ARM architectures. From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 09:51:34 2012 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 E4218106564A; Tue, 3 Jan 2012 09:51: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 D261B8FC08; Tue, 3 Jan 2012 09:51: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 q039pY6E015709; Tue, 3 Jan 2012 09:51:34 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q039pYCG015707; Tue, 3 Jan 2012 09:51:34 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201030951.q039pYCG015707@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 3 Jan 2012 09:51:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229378 - stable/9/usr.bin/truss 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, 03 Jan 2012 09:51:35 -0000 Author: kib Date: Tue Jan 3 09:51:34 2012 New Revision: 229378 URL: http://svn.freebsd.org/changeset/base/229378 Log: MFC r228261: Use explicit information from the kernel to detect the traps due to syscall entry and leave. Modified: stable/9/usr.bin/truss/setup.c Directory Properties: stable/9/usr.bin/truss/ (props changed) Modified: stable/9/usr.bin/truss/setup.c ============================================================================== --- stable/9/usr.bin/truss/setup.c Tue Jan 3 09:46:51 2012 (r229377) +++ stable/9/usr.bin/truss/setup.c Tue Jan 3 09:51:34 2012 (r229378) @@ -202,9 +202,19 @@ waitevent(struct trussinfo *info) find_thread(info, lwpinfo.pl_lwpid); switch(WSTOPSIG(waitval)) { case SIGTRAP: - info->pr_why = info->curthread->in_syscall?S_SCX:S_SCE; - info->curthread->in_syscall = 1 - info->curthread->in_syscall; - break; + if (lwpinfo.pl_flags & PL_FLAG_SCE) { + info->pr_why = S_SCE; + info->curthread->in_syscall = 1; + break; + } else if (lwpinfo.pl_flags & PL_FLAG_SCX) { + info->pr_why = S_SCX; + info->curthread->in_syscall = 0; + break; + } else { + errx(1, + "pl_flags %x contains neither PL_FLAG_SCE nor PL_FLAG_SCX", + lwpinfo.pl_flags); + } default: info->pr_why = S_SIG; info->pr_data = WSTOPSIG(waitval); From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 10:01:12 2012 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 F1D78106566C; Tue, 3 Jan 2012 10:01:12 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E0A248FC17; Tue, 3 Jan 2012 10:01:12 +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 q03A1Co7016126; Tue, 3 Jan 2012 10:01:12 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03A1C0K016124; Tue, 3 Jan 2012 10:01:12 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201201031001.q03A1C0K016124@svn.freebsd.org> From: Kevin Lo Date: Tue, 3 Jan 2012 10:01:12 +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: r229379 - head/sys/dev/uart 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, 03 Jan 2012 10:01:13 -0000 Author: kevlo Date: Tue Jan 3 10:01:12 2012 New Revision: 229379 URL: http://svn.freebsd.org/changeset/base/229379 Log: Add support for Intel EG20T serial ports Modified: head/sys/dev/uart/uart_bus_pci.c Modified: head/sys/dev/uart/uart_bus_pci.c ============================================================================== --- head/sys/dev/uart/uart_bus_pci.c Tue Jan 3 09:51:34 2012 (r229378) +++ head/sys/dev/uart/uart_bus_pci.c Tue Jan 3 10:01:12 2012 (r229379) @@ -112,6 +112,10 @@ static struct pci_id pci_ns8250_ids[] = 0x10, 16384000 }, { 0x151f, 0x0000, 0xffff, 0, "TOPIC Semiconductor TP560 56k modem", 0x10 }, { 0x8086, 0x1c3d, 0xffff, 0, "Intel AMT - KT Controller", 0x10 }, +{ 0x8086, 0x8811, 0xffff, 0, "Intel EG20T Serial Port 0", 0x10 }, +{ 0x8086, 0x8812, 0xffff, 0, "Intel EG20T Serial Port 1", 0x10 }, +{ 0x8086, 0x8813, 0xffff, 0, "Intel EG20T Serial Port 2", 0x10 }, +{ 0x8086, 0x8814, 0xffff, 0, "Intel EG20T Serial Port 3", 0x10 }, { 0x9710, 0x9820, 0x1000, 1, "NetMos NM9820 Serial Port", 0x10 }, { 0x9710, 0x9835, 0x1000, 1, "NetMos NM9835 Serial Port", 0x10 }, { 0x9710, 0x9865, 0xa000, 0x1000, "NetMos NM9865 Serial Port", 0x10 }, From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 10:02:45 2012 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 86CDD106566B; Tue, 3 Jan 2012 10:02:45 +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 5A5618FC0C; Tue, 3 Jan 2012 10:02: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 q03A2jcn016207; Tue, 3 Jan 2012 10:02:45 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03A2jFq016204; Tue, 3 Jan 2012 10:02:45 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201031002.q03A2jFq016204@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 3 Jan 2012 10:02:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229380 - in stable/9: secure/lib/libcrypto share/mk 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, 03 Jan 2012 10:02:45 -0000 Author: kib Date: Tue Jan 3 10:02:44 2012 New Revision: 229380 URL: http://svn.freebsd.org/changeset/base/229380 Log: MFC r228307: Force linker error when created shared library contains a relocation against text. Provide the override switch to turn off the strict behaviour. Apparently, openssl libcrypto needs it due to assembler code not being PIC. Modified: stable/9/secure/lib/libcrypto/Makefile stable/9/share/mk/bsd.lib.mk Directory Properties: stable/9/secure/lib/libcrypto/ (props changed) stable/9/share/mk/ (props changed) Modified: stable/9/secure/lib/libcrypto/Makefile ============================================================================== --- stable/9/secure/lib/libcrypto/Makefile Tue Jan 3 10:01:12 2012 (r229379) +++ stable/9/secure/lib/libcrypto/Makefile Tue Jan 3 10:02:44 2012 (r229380) @@ -7,6 +7,7 @@ SUBDIR= engines LIB= crypto SHLIB_MAJOR= 6 +ALLOW_SHARED_TEXTREL= NO_LINT= Modified: stable/9/share/mk/bsd.lib.mk ============================================================================== --- stable/9/share/mk/bsd.lib.mk Tue Jan 3 10:01:12 2012 (r229379) +++ stable/9/share/mk/bsd.lib.mk Tue Jan 3 10:02:44 2012 (r229380) @@ -183,6 +183,11 @@ SOBJS+= ${OBJS:.o=.So} .if defined(SHLIB_NAME) _LIBS+= ${SHLIB_NAME} +SOLINKOPTS= -shared -Wl,-x +.if !defined(ALLOW_SHARED_TEXTREL) +SOLINKOPTS+= -Wl,--fatal-warnings -Wl,--warn-shared-textrel +.endif + .if target(beforelinking) ${SHLIB_NAME}: ${SOBJS} beforelinking .else @@ -194,11 +199,11 @@ ${SHLIB_NAME}: ${SOBJS} @ln -fs ${.TARGET} ${SHLIB_LINK} .endif .if !defined(NM) - @${CC} ${LDFLAGS} ${SSP_CFLAGS} -shared -Wl,-x \ + @${CC} ${LDFLAGS} ${SSP_CFLAGS} ${SOLINKOPTS} \ -o ${.TARGET} -Wl,-soname,${SONAME} \ `lorder ${SOBJS} | tsort -q` ${LDADD} .else - @${CC} ${LDFLAGS} ${SSP_CFLAGS} -shared -Wl,-x \ + @${CC} ${LDFLAGS} ${SSP_CFLAGS} ${SOLINKOPTS} \ -o ${.TARGET} -Wl,-soname,${SONAME} \ `NM='${NM}' lorder ${SOBJS} | tsort -q` ${LDADD} .endif From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 10:22:10 2012 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 AAEB6106566B; Tue, 3 Jan 2012 10:22:10 +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 7D9B68FC19; Tue, 3 Jan 2012 10:22: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 q03AMAlU019144; Tue, 3 Jan 2012 10:22:10 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03AMAgU019141; Tue, 3 Jan 2012 10:22:10 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201201031022.q03AMAgU019141@svn.freebsd.org> From: Xin LI Date: Tue, 3 Jan 2012 10:22:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229381 - in stable: 8/etc/defaults 8/etc/periodic/daily 9/etc/defaults 9/etc/periodic/daily 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, 03 Jan 2012 10:22:10 -0000 Author: delphij Date: Tue Jan 3 10:22:09 2012 New Revision: 229381 URL: http://svn.freebsd.org/changeset/base/229381 Log: MFC r226471 (se): Add missing default values for daily/800.scrub-zfs for documentation purposes. No functional change, since all parameters are set to their default values. MFC r226865 (delphij): Increase default scrub threshold from 30 days to 5 weeks. Using whole weeks makes it easier to predicate when the scrub would happen. Requested by: gjb Modified: stable/9/etc/defaults/periodic.conf stable/9/etc/periodic/daily/800.scrub-zfs Directory Properties: stable/9/etc/ (props changed) Changes in other areas also in this revision: Modified: stable/8/etc/defaults/periodic.conf stable/8/etc/periodic/daily/800.scrub-zfs Directory Properties: stable/8/etc/ (props changed) Modified: stable/9/etc/defaults/periodic.conf ============================================================================== --- stable/9/etc/defaults/periodic.conf Tue Jan 3 10:02:44 2012 (r229380) +++ stable/9/etc/defaults/periodic.conf Tue Jan 3 10:22:09 2012 (r229381) @@ -147,6 +147,12 @@ daily_status_pkg_changes_enable="NO" # daily_queuerun_enable="YES" # Run mail queue daily_submit_queuerun="YES" # Also submit queue +# 800.scrub-zfs +daily_scrub_zfs_enable="NO" +daily_scrub_zfs_pools="" # empty string selects all pools +daily_scrub_zfs_default_threshold="35" # days between scrubs +#daily_scrub_zfs_${poolname}_threshold="35" # pool specific threshold + # 999.local daily_local="/etc/daily.local" # Local scripts Modified: stable/9/etc/periodic/daily/800.scrub-zfs ============================================================================== --- stable/9/etc/periodic/daily/800.scrub-zfs Tue Jan 3 10:02:44 2012 (r229380) +++ stable/9/etc/periodic/daily/800.scrub-zfs Tue Jan 3 10:22:09 2012 (r229381) @@ -15,7 +15,7 @@ then source_periodic_confs fi -: ${daily_scrub_zfs_default_threshold=30} +: ${daily_scrub_zfs_default_threshold=35} case "$daily_scrub_zfs_enable" in [Yy][Ee][Ss]) From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 10:22:10 2012 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 E35211065677; Tue, 3 Jan 2012 10:22:10 +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 B5ECC8FC1A; Tue, 3 Jan 2012 10:22: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 q03AMAb5019151; Tue, 3 Jan 2012 10:22:10 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03AMADJ019148; Tue, 3 Jan 2012 10:22:10 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201201031022.q03AMADJ019148@svn.freebsd.org> From: Xin LI Date: Tue, 3 Jan 2012 10:22: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: r229381 - in stable: 8/etc/defaults 8/etc/periodic/daily 9/etc/defaults 9/etc/periodic/daily 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, 03 Jan 2012 10:22:11 -0000 Author: delphij Date: Tue Jan 3 10:22:09 2012 New Revision: 229381 URL: http://svn.freebsd.org/changeset/base/229381 Log: MFC r226471 (se): Add missing default values for daily/800.scrub-zfs for documentation purposes. No functional change, since all parameters are set to their default values. MFC r226865 (delphij): Increase default scrub threshold from 30 days to 5 weeks. Using whole weeks makes it easier to predicate when the scrub would happen. Requested by: gjb Modified: stable/8/etc/defaults/periodic.conf stable/8/etc/periodic/daily/800.scrub-zfs Directory Properties: stable/8/etc/ (props changed) Changes in other areas also in this revision: Modified: stable/9/etc/defaults/periodic.conf stable/9/etc/periodic/daily/800.scrub-zfs Directory Properties: stable/9/etc/ (props changed) Modified: stable/8/etc/defaults/periodic.conf ============================================================================== --- stable/8/etc/defaults/periodic.conf Tue Jan 3 10:02:44 2012 (r229380) +++ stable/8/etc/defaults/periodic.conf Tue Jan 3 10:22:09 2012 (r229381) @@ -144,6 +144,12 @@ daily_status_ntpd_enable="NO" # Check daily_queuerun_enable="YES" # Run mail queue daily_submit_queuerun="YES" # Also submit queue +# 800.scrub-zfs +daily_scrub_zfs_enable="NO" +daily_scrub_zfs_pools="" # empty string selects all pools +daily_scrub_zfs_default_threshold="35" # days between scrubs +#daily_scrub_zfs_${poolname}_threshold="35" # pool specific threshold + # 999.local daily_local="/etc/daily.local" # Local scripts Modified: stable/8/etc/periodic/daily/800.scrub-zfs ============================================================================== --- stable/8/etc/periodic/daily/800.scrub-zfs Tue Jan 3 10:02:44 2012 (r229380) +++ stable/8/etc/periodic/daily/800.scrub-zfs Tue Jan 3 10:22:09 2012 (r229381) @@ -15,7 +15,7 @@ then source_periodic_confs fi -: ${daily_scrub_zfs_default_threshold=30} +: ${daily_scrub_zfs_default_threshold=35} case "$daily_scrub_zfs_enable" in [Yy][Ee][Ss]) From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 10:30:28 2012 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 0458E106566C; Tue, 3 Jan 2012 10:30:28 +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 E5F928FC0C; Tue, 3 Jan 2012 10:30:27 +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 q03AURsU019513; Tue, 3 Jan 2012 10:30:27 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03AUR1l019509; Tue, 3 Jan 2012 10:30:27 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201031030.q03AUR1l019509@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 3 Jan 2012 10:30:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229382 - stable/9/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: Tue, 03 Jan 2012 10:30:28 -0000 Author: kib Date: Tue Jan 3 10:30:27 2012 New Revision: 229382 URL: http://svn.freebsd.org/changeset/base/229382 Log: MFC r227102: Provide typedefs for the type of bit mask for the page bits. Use the defined types instead of int when manipulating masks. Supposedly, it could fix support for 32KB page size in the machine-independend VM layer. MFC r227103: Remove redundand definitions. The chunk was missed from r227102. Modified: stable/9/sys/vm/vm_page.c stable/9/sys/vm/vm_page.h stable/9/sys/vm/vnode_pager.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/vm/vm_page.c ============================================================================== --- stable/9/sys/vm/vm_page.c Tue Jan 3 10:22:09 2012 (r229381) +++ stable/9/sys/vm/vm_page.c Tue Jan 3 10:30:27 2012 (r229382) @@ -137,7 +137,7 @@ SYSCTL_INT(_vm, OID_AUTO, tryrelock_rest static uma_zone_t fakepg_zone; -static void vm_page_clear_dirty_mask(vm_page_t m, int pagebits); +static void vm_page_clear_dirty_mask(vm_page_t m, vm_page_bits_t pagebits); static void vm_page_queue_remove(int queue, vm_page_t m); static void vm_page_enqueue(int queue, vm_page_t m); static void vm_page_init_fakepg(void *dummy); @@ -2315,7 +2315,7 @@ retrylookup: * * Inputs are required to range within a page. */ -int +vm_page_bits_t vm_page_bits(int base, int size) { int first_bit; @@ -2332,7 +2332,8 @@ vm_page_bits(int base, int size) first_bit = base >> DEV_BSHIFT; last_bit = (base + size - 1) >> DEV_BSHIFT; - return ((2 << last_bit) - (1 << first_bit)); + return (((vm_page_bits_t)2 << last_bit) - + ((vm_page_bits_t)1 << first_bit)); } /* @@ -2391,7 +2392,7 @@ vm_page_set_valid(vm_page_t m, int base, * Clear the given bits from the specified page's dirty field. */ static __inline void -vm_page_clear_dirty_mask(vm_page_t m, int pagebits) +vm_page_clear_dirty_mask(vm_page_t m, vm_page_bits_t pagebits) { uintptr_t addr; #if PAGE_SIZE < 16384 @@ -2420,7 +2421,6 @@ vm_page_clear_dirty_mask(vm_page_t m, in */ addr = (uintptr_t)&m->dirty; #if PAGE_SIZE == 32768 -#error pagebits too short atomic_clear_64((uint64_t *)addr, pagebits); #elif PAGE_SIZE == 16384 atomic_clear_32((uint32_t *)addr, pagebits); @@ -2457,8 +2457,8 @@ vm_page_clear_dirty_mask(vm_page_t m, in void vm_page_set_validclean(vm_page_t m, int base, int size) { - u_long oldvalid; - int endoff, frag, pagebits; + vm_page_bits_t oldvalid, pagebits; + int endoff, frag; VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); if (size == 0) /* handle degenerate case */ @@ -2470,7 +2470,7 @@ vm_page_set_validclean(vm_page_t m, int * first block. */ if ((frag = base & ~(DEV_BSIZE - 1)) != base && - (m->valid & (1 << (base >> DEV_BSHIFT))) == 0) + (m->valid & ((vm_page_bits_t)1 << (base >> DEV_BSHIFT))) == 0) pmap_zero_page_area(m, frag, base - frag); /* @@ -2480,7 +2480,7 @@ vm_page_set_validclean(vm_page_t m, int */ endoff = base + size; if ((frag = endoff & ~(DEV_BSIZE - 1)) != endoff && - (m->valid & (1 << (endoff >> DEV_BSHIFT))) == 0) + (m->valid & ((vm_page_bits_t)1 << (endoff >> DEV_BSHIFT))) == 0) pmap_zero_page_area(m, endoff, DEV_BSIZE - (endoff & (DEV_BSIZE - 1))); @@ -2550,7 +2550,7 @@ vm_page_clear_dirty(vm_page_t m, int bas void vm_page_set_invalid(vm_page_t m, int base, int size) { - int bits; + vm_page_bits_t bits; VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); KASSERT((m->oflags & VPO_BUSY) == 0, @@ -2590,8 +2590,7 @@ vm_page_zero_invalid(vm_page_t m, boolea */ for (b = i = 0; i <= PAGE_SIZE / DEV_BSIZE; ++i) { if (i == (PAGE_SIZE / DEV_BSIZE) || - (m->valid & (1 << i)) - ) { + (m->valid & ((vm_page_bits_t)1 << i))) { if (i > b) { pmap_zero_page_area(m, b << DEV_BSHIFT, (i - b) << DEV_BSHIFT); @@ -2621,9 +2620,10 @@ vm_page_zero_invalid(vm_page_t m, boolea int vm_page_is_valid(vm_page_t m, int base, int size) { - int bits = vm_page_bits(base, size); + vm_page_bits_t bits; VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); + bits = vm_page_bits(base, size); if (m->valid && ((m->valid & bits) == bits)) return 1; else Modified: stable/9/sys/vm/vm_page.h ============================================================================== --- stable/9/sys/vm/vm_page.h Tue Jan 3 10:22:09 2012 (r229381) +++ stable/9/sys/vm/vm_page.h Tue Jan 3 10:30:27 2012 (r229382) @@ -113,6 +113,20 @@ TAILQ_HEAD(pglist, vm_page); +#if PAGE_SIZE == 4096 +#define VM_PAGE_BITS_ALL 0xffu +typedef uint8_t vm_page_bits_t; +#elif PAGE_SIZE == 8192 +#define VM_PAGE_BITS_ALL 0xffffu +typedef uint16_t vm_page_bits_t; +#elif PAGE_SIZE == 16384 +#define VM_PAGE_BITS_ALL 0xffffffffu +typedef uint32_t vm_page_bits_t; +#elif PAGE_SIZE == 32768 +#define VM_PAGE_BITS_ALL 0xfffffffffffffffflu +typedef uint64_t vm_page_bits_t; +#endif + struct vm_page { TAILQ_ENTRY(vm_page) pageq; /* queue info for FIFO queue or free list (Q) */ TAILQ_ENTRY(vm_page) listq; /* pages in same object (O) */ @@ -137,20 +151,8 @@ struct vm_page { u_char busy; /* page busy count (O) */ /* NOTE that these must support one bit per DEV_BSIZE in a page!!! */ /* so, on normal X86 kernels, they must be at least 8 bits wide */ - /* In reality, support for 32KB pages is not fully implemented. */ -#if PAGE_SIZE == 4096 - uint8_t valid; /* map of valid DEV_BSIZE chunks (O) */ - uint8_t dirty; /* map of dirty DEV_BSIZE chunks (M) */ -#elif PAGE_SIZE == 8192 - uint16_t valid; /* map of valid DEV_BSIZE chunks (O) */ - uint16_t dirty; /* map of dirty DEV_BSIZE chunks (M) */ -#elif PAGE_SIZE == 16384 - uint32_t valid; /* map of valid DEV_BSIZE chunks (O) */ - uint32_t dirty; /* map of dirty DEV_BSIZE chunks (M) */ -#elif PAGE_SIZE == 32768 - uint64_t valid; /* map of valid DEV_BSIZE chunks (O) */ - uint64_t dirty; /* map of dirty DEV_BSIZE chunks (M) */ -#endif + vm_page_bits_t valid; /* map of valid DEV_BSIZE chunks (O) */ + vm_page_bits_t dirty; /* map of dirty DEV_BSIZE chunks (M) */ }; /* @@ -322,16 +324,6 @@ extern struct vpglocks vm_page_queue_loc #define vm_page_lock_queues() mtx_lock(&vm_page_queue_mtx) #define vm_page_unlock_queues() mtx_unlock(&vm_page_queue_mtx) -#if PAGE_SIZE == 4096 -#define VM_PAGE_BITS_ALL 0xffu -#elif PAGE_SIZE == 8192 -#define VM_PAGE_BITS_ALL 0xffffu -#elif PAGE_SIZE == 16384 -#define VM_PAGE_BITS_ALL 0xffffffffu -#elif PAGE_SIZE == 32768 -#define VM_PAGE_BITS_ALL 0xfffffffffffffffflu -#endif - /* page allocation classes: */ #define VM_ALLOC_NORMAL 0 #define VM_ALLOC_INTERRUPT 1 @@ -403,7 +395,7 @@ void vm_page_clear_dirty (vm_page_t, int void vm_page_set_invalid (vm_page_t, int, int); int vm_page_is_valid (vm_page_t, int, int); void vm_page_test_dirty (vm_page_t); -int vm_page_bits (int, int); +vm_page_bits_t vm_page_bits(int base, int size); void vm_page_zero_invalid(vm_page_t m, boolean_t setvalid); void vm_page_free_toq(vm_page_t m); void vm_page_zero_idle_wakeup(void); Modified: stable/9/sys/vm/vnode_pager.c ============================================================================== --- stable/9/sys/vm/vnode_pager.c Tue Jan 3 10:22:09 2012 (r229381) +++ stable/9/sys/vm/vnode_pager.c Tue Jan 3 10:30:27 2012 (r229382) @@ -486,15 +486,16 @@ vnode_pager_input_smlfs(object, m) vm_object_t object; vm_page_t m; { - int bits, i; struct vnode *vp; struct bufobj *bo; struct buf *bp; struct sf_buf *sf; daddr_t fileaddr; vm_offset_t bsize; - int error = 0; + vm_page_bits_t bits; + int error, i; + error = 0; vp = object->handle; if (vp->v_iflag & VI_DOOMED) return VM_PAGER_BAD; From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 10:36:39 2012 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 2485F106566B; Tue, 3 Jan 2012 10:36:39 +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 073008FC0A; Tue, 3 Jan 2012 10:36: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 q03Aac51019763; Tue, 3 Jan 2012 10:36:38 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03AacXg019759; Tue, 3 Jan 2012 10:36:38 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201031036.q03AacXg019759@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 3 Jan 2012 10:36:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229383 - stable/9/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: Tue, 03 Jan 2012 10:36:39 -0000 Author: kib Date: Tue Jan 3 10:36:38 2012 New Revision: 229383 URL: http://svn.freebsd.org/changeset/base/229383 Log: MFC r227530: Update the device pager interface. Sponsored by: The FreeBSD Foundation Modified: stable/9/sys/vm/device_pager.c stable/9/sys/vm/vm_object.h stable/9/sys/vm/vm_pager.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/vm/device_pager.c ============================================================================== --- stable/9/sys/vm/device_pager.c Tue Jan 3 10:30:27 2012 (r229382) +++ stable/9/sys/vm/device_pager.c Tue Jan 3 10:36:38 2012 (r229383) @@ -76,6 +76,18 @@ struct pagerops devicepagerops = { .pgo_haspage = dev_pager_haspage, }; +static int old_dev_pager_ctor(void *handle, vm_ooffset_t size, vm_prot_t prot, + vm_ooffset_t foff, struct ucred *cred, u_short *color); +static void old_dev_pager_dtor(void *handle); +static int old_dev_pager_fault(vm_object_t object, vm_ooffset_t offset, + int prot, vm_page_t *mres); + +static struct cdev_pager_ops old_dev_pager_ops = { + .cdev_pg_ctor = old_dev_pager_ctor, + .cdev_pg_dtor = old_dev_pager_dtor, + .cdev_pg_fault = old_dev_pager_fault +}; + static void dev_pager_init() { @@ -83,22 +95,28 @@ dev_pager_init() mtx_init(&dev_pager_mtx, "dev_pager list", NULL, MTX_DEF); } -/* - * MPSAFE - */ -static vm_object_t -dev_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, - vm_ooffset_t foff, struct ucred *cred) +vm_object_t +cdev_pager_lookup(void *handle) +{ + vm_object_t object; + + mtx_lock(&dev_pager_mtx); + object = vm_pager_object_lookup(&dev_pager_object_list, handle); + vm_object_reference(object); + mtx_unlock(&dev_pager_mtx); + return (object); +} + +vm_object_t +cdev_pager_allocate(void *handle, enum obj_type tp, struct cdev_pager_ops *ops, + vm_ooffset_t size, vm_prot_t prot, vm_ooffset_t foff, struct ucred *cred) { - struct cdev *dev; vm_object_t object, object1; vm_pindex_t pindex; - unsigned int npages; - vm_paddr_t paddr; - vm_ooffset_t off; - vm_memattr_t dummy; - struct cdevsw *csw; - int ref; + u_short color; + + if (tp != OBJT_DEVICE) + return (NULL); /* * Offset should be page aligned. @@ -109,27 +127,8 @@ dev_pager_alloc(void *handle, vm_ooffset size = round_page(size); pindex = OFF_TO_IDX(foff + size); - /* - * Make sure this device can be mapped. - */ - dev = handle; - csw = dev_refthread(dev, &ref); - if (csw == NULL) + if (ops->cdev_pg_ctor(handle, size, prot, foff, cred, &color) != 0) return (NULL); - - /* - * Check that the specified range of the device allows the desired - * protection. - * - * XXX assumes VM_PROT_* == PROT_* - */ - npages = OFF_TO_IDX(size); - for (off = foff; npages--; off += PAGE_SIZE) - if (csw->d_mmap(dev, off, &paddr, (int)prot, &dummy) != 0) { - dev_relthread(dev, ref); - return (NULL); - } - mtx_lock(&dev_pager_mtx); /* @@ -144,9 +143,11 @@ dev_pager_alloc(void *handle, vm_ooffset * device's memory. */ mtx_unlock(&dev_pager_mtx); - object1 = vm_object_allocate(OBJT_DEVICE, pindex); + object1 = vm_object_allocate(tp, pindex); object1->flags |= OBJ_COLORED; - object1->pg_color = atop(paddr) - OFF_TO_IDX(off - PAGE_SIZE); + object1->pg_color = color; + object1->handle = handle; + object1->un_pager.devp.ops = ops; TAILQ_INIT(&object1->un_pager.devp.devp_pglist); mtx_lock(&dev_pager_mtx); object = vm_pager_object_lookup(&dev_pager_object_list, handle); @@ -162,13 +163,14 @@ dev_pager_alloc(void *handle, vm_ooffset object->handle = handle; TAILQ_INSERT_TAIL(&dev_pager_object_list, object, pager_object_list); + KASSERT(object->type == tp, + ("Inconsistent device pager type %p %d", object, tp)); } } else { if (pindex > object->size) object->size = pindex; } mtx_unlock(&dev_pager_mtx); - dev_relthread(dev, ref); if (object1 != NULL) { object1->handle = object1; mtx_lock(&dev_pager_mtx); @@ -180,6 +182,24 @@ dev_pager_alloc(void *handle, vm_ooffset return (object); } +static vm_object_t +dev_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, + vm_ooffset_t foff, struct ucred *cred) +{ + + return (cdev_pager_allocate(handle, OBJT_DEVICE, &old_dev_pager_ops, + size, prot, foff, cred)); +} + +void +cdev_pager_free_page(vm_object_t object, vm_page_t m) +{ + + VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); + TAILQ_REMOVE(&object->un_pager.devp.devp_pglist, m, pageq); + vm_page_putfake(m); +} + static void dev_pager_dealloc(object) vm_object_t object; @@ -187,6 +207,8 @@ dev_pager_dealloc(object) vm_page_t m; VM_OBJECT_UNLOCK(object); + object->un_pager.devp.ops->cdev_pg_dtor(object->handle); + mtx_lock(&dev_pager_mtx); TAILQ_REMOVE(&dev_pager_object_list, object, pager_object_list); mtx_unlock(&dev_pager_mtx); @@ -194,35 +216,57 @@ dev_pager_dealloc(object) /* * Free up our fake pages. */ - while ((m = TAILQ_FIRST(&object->un_pager.devp.devp_pglist)) != NULL) { - TAILQ_REMOVE(&object->un_pager.devp.devp_pglist, m, pageq); - vm_page_putfake(m); + while ((m = TAILQ_FIRST(&object->un_pager.devp.devp_pglist)) != NULL) + cdev_pager_free_page(object, m); +} + +static int +dev_pager_getpages(vm_object_t object, vm_page_t *ma, int count, int reqpage) +{ + int error, i; + + VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); + error = object->un_pager.devp.ops->cdev_pg_fault(object, + IDX_TO_OFF(ma[reqpage]->pindex), PROT_READ, &ma[reqpage]); + + VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); + + for (i = 0; i < count; i++) { + if (i != reqpage) { + vm_page_lock(ma[i]); + vm_page_free(ma[i]); + vm_page_unlock(ma[i]); + } + } + + if (error == VM_PAGER_OK) { + TAILQ_INSERT_TAIL(&object->un_pager.devp.devp_pglist, + ma[reqpage], pageq); } + + return (error); } static int -dev_pager_getpages(object, m, count, reqpage) - vm_object_t object; - vm_page_t *m; - int count; - int reqpage; +old_dev_pager_fault(vm_object_t object, vm_ooffset_t offset, int prot, + vm_page_t *mres) { - vm_pindex_t offset; + vm_pindex_t pidx; vm_paddr_t paddr; vm_page_t m_paddr, page; - vm_memattr_t memattr; struct cdev *dev; - int i, ref, ret; struct cdevsw *csw; - struct thread *td; struct file *fpop; + struct thread *td; + vm_memattr_t memattr; + int ref, ret; - VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); - dev = object->handle; - page = m[reqpage]; - offset = page->pindex; + pidx = OFF_TO_IDX(offset); memattr = object->memattr; + VM_OBJECT_UNLOCK(object); + + dev = object->handle; csw = dev_refthread(dev, &ref); if (csw == NULL) { VM_OBJECT_LOCK(object); @@ -231,11 +275,16 @@ dev_pager_getpages(object, m, count, req td = curthread; fpop = td->td_fpop; td->td_fpop = NULL; - ret = csw->d_mmap(dev, (vm_ooffset_t)offset << PAGE_SHIFT, &paddr, - PROT_READ, &memattr); - KASSERT(ret == 0, ("dev_pager_getpage: map function returns error")); + ret = csw->d_mmap(dev, offset, &paddr, prot, &memattr); td->td_fpop = fpop; dev_relthread(dev, ref); + if (ret != 0) { + printf( + "WARNING: dev_pager_getpage: map function returns error %d", ret); + VM_OBJECT_LOCK(object); + return (VM_PAGER_FAIL); + } + /* If "paddr" is a real page, perform a sanity check on "memattr". */ if ((m_paddr = vm_phys_paddr_to_vm_page(paddr)) != NULL && pmap_page_get_memattr(m_paddr) != memattr) { @@ -243,23 +292,14 @@ dev_pager_getpages(object, m, count, req printf( "WARNING: A device driver has set \"memattr\" inconsistently.\n"); } - if ((page->flags & PG_FICTITIOUS) != 0) { + if (((*mres)->flags & PG_FICTITIOUS) != 0) { /* - * If the passed in reqpage page is a fake page, update it with + * If the passed in result page is a fake page, update it with * the new physical address. */ + page = *mres; VM_OBJECT_LOCK(object); vm_page_updatefake(page, paddr, memattr); - if (count > 1) { - - for (i = 0; i < count; i++) { - if (i != reqpage) { - vm_page_lock(m[i]); - vm_page_free(m[i]); - vm_page_unlock(m[i]); - } - } - } } else { /* * Replace the passed in reqpage page with our own fake page and @@ -267,14 +307,11 @@ dev_pager_getpages(object, m, count, req */ page = vm_page_getfake(paddr, memattr); VM_OBJECT_LOCK(object); - TAILQ_INSERT_TAIL(&object->un_pager.devp.devp_pglist, page, pageq); - for (i = 0; i < count; i++) { - vm_page_lock(m[i]); - vm_page_free(m[i]); - vm_page_unlock(m[i]); - } - vm_page_insert(page, object, offset); - m[reqpage] = page; + vm_page_lock(*mres); + vm_page_free(*mres); + vm_page_unlock(*mres); + *mres = page; + vm_page_insert(page, object, pidx); } page->valid = VM_PAGE_BITS_ALL; return (VM_PAGER_OK); @@ -288,6 +325,7 @@ dev_pager_putpages(object, m, count, syn boolean_t sync; int *rtvals; { + panic("dev_pager_putpage called"); } @@ -304,3 +342,50 @@ dev_pager_haspage(object, pindex, before *after = 0; return (TRUE); } + +static int +old_dev_pager_ctor(void *handle, vm_ooffset_t size, vm_prot_t prot, + vm_ooffset_t foff, struct ucred *cred, u_short *color) +{ + struct cdev *dev; + struct cdevsw *csw; + vm_memattr_t dummy; + vm_ooffset_t off; + vm_paddr_t paddr; + unsigned int npages; + int ref; + + /* + * Make sure this device can be mapped. + */ + dev = handle; + csw = dev_refthread(dev, &ref); + if (csw == NULL) + return (ENXIO); + + /* + * Check that the specified range of the device allows the desired + * protection. + * + * XXX assumes VM_PROT_* == PROT_* + */ + npages = OFF_TO_IDX(size); + for (off = foff; npages--; off += PAGE_SIZE) { + if (csw->d_mmap(dev, off, &paddr, (int)prot, &dummy) != 0) { + dev_relthread(dev, ref); + return (EINVAL); + } + } + + dev_ref(dev); + dev_relthread(dev, ref); + *color = atop(paddr) - OFF_TO_IDX(off - PAGE_SIZE); + return (0); +} + +static void +old_dev_pager_dtor(void *handle) +{ + + dev_rel(handle); +} Modified: stable/9/sys/vm/vm_object.h ============================================================================== --- stable/9/sys/vm/vm_object.h Tue Jan 3 10:30:27 2012 (r229382) +++ stable/9/sys/vm/vm_object.h Tue Jan 3 10:36:38 2012 (r229383) @@ -121,6 +121,7 @@ struct vm_object { */ struct { TAILQ_HEAD(, vm_page) devp_pglist; + struct cdev_pager_ops *ops; } devp; /* Modified: stable/9/sys/vm/vm_pager.h ============================================================================== --- stable/9/sys/vm/vm_pager.h Tue Jan 3 10:30:27 2012 (r229382) +++ stable/9/sys/vm/vm_pager.h Tue Jan 3 10:36:38 2012 (r229383) @@ -192,5 +192,19 @@ vm_pager_page_unswapped(vm_page_t m) (*pagertab[m->object->type]->pgo_pageunswapped)(m); } +struct cdev_pager_ops { + int (*cdev_pg_fault)(vm_object_t vm_obj, vm_ooffset_t offset, + int prot, vm_page_t *mres); + int (*cdev_pg_ctor)(void *handle, vm_ooffset_t size, vm_prot_t prot, + vm_ooffset_t foff, struct ucred *cred, u_short *color); + void (*cdev_pg_dtor)(void *handle); +}; + +vm_object_t cdev_pager_allocate(void *handle, enum obj_type tp, + struct cdev_pager_ops *ops, vm_ooffset_t size, vm_prot_t prot, + vm_ooffset_t foff, struct ucred *cred); +vm_object_t cdev_pager_lookup(void *handle); +void cdev_pager_free_page(vm_object_t object, vm_page_t m); + #endif /* _KERNEL */ #endif /* _VM_PAGER_ */ From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 11:08:59 2012 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 68B98106568E; Tue, 3 Jan 2012 11:08:59 +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 57AAC8FC12; Tue, 3 Jan 2012 11:08: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 q03B8xJt020839; Tue, 3 Jan 2012 11:08:59 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03B8xh8020837; Tue, 3 Jan 2012 11:08:59 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201201031108.q03B8xh8020837@svn.freebsd.org> From: Ed Schouten Date: Tue, 3 Jan 2012 11:08: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: r229384 - head/usr.sbin/quotaon 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, 03 Jan 2012 11:08:59 -0000 Author: ed Date: Tue Jan 3 11:08:58 2012 New Revision: 229384 URL: http://svn.freebsd.org/changeset/base/229384 Log: Simply use getprogname() to obtain the name of the process. Modified: head/usr.sbin/quotaon/quotaon.c Modified: head/usr.sbin/quotaon/quotaon.c ============================================================================== --- head/usr.sbin/quotaon/quotaon.c Tue Jan 3 10:36:38 2012 (r229383) +++ head/usr.sbin/quotaon/quotaon.c Tue Jan 3 11:08:58 2012 (r229384) @@ -75,13 +75,11 @@ int main(int argc, char **argv) { struct fstab *fs; - char *whoami; + const char *whoami; long argnum, done = 0; int ch, i, offmode = 0, errs = 0; - whoami = rindex(*argv, '/') + 1; - if (whoami == (char *)1) - whoami = *argv; + whoami = getprogname(); if (strcmp(whoami, "quotaoff") == 0) offmode++; else if (strcmp(whoami, "quotaon") != 0) From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 11:10:15 2012 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 BD1631065670; Tue, 3 Jan 2012 11:10:15 +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 AB89F8FC0A; Tue, 3 Jan 2012 11:10: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 q03BAFRA020920; Tue, 3 Jan 2012 11:10:15 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03BAF62020918; Tue, 3 Jan 2012 11:10:15 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201201031110.q03BAF62020918@svn.freebsd.org> From: Ed Schouten Date: Tue, 3 Jan 2012 11:10: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: r229385 - head/usr.sbin/bsnmpd/tools/libbsnmptools 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, 03 Jan 2012 11:10:15 -0000 Author: ed Date: Tue Jan 3 11:10:15 2012 New Revision: 229385 URL: http://svn.freebsd.org/changeset/base/229385 Log: Fix subtle typo: compare against idx -- not index. In this contest, index refers to the index(3) function. In this case it doesn't really harm, as this function is never called with idx == NULL. MFC after: 2 weeks Modified: head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c Modified: head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c ============================================================================== --- head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c Tue Jan 3 11:08:58 2012 (r229384) +++ head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c Tue Jan 3 11:10:15 2012 (r229385) @@ -469,7 +469,7 @@ snmp_leaf_insert(struct snmp_toolinfo *s static int32_t snmp_index_insert(struct snmp_idxlist *headp, struct index *idx) { - if (headp == NULL || index == NULL) + if (headp == NULL || idx == NULL) return (-1); STAILQ_INSERT_TAIL(headp, idx, link); From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 11:13:08 2012 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 5333B106564A; Tue, 3 Jan 2012 11:13:08 +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 4203D8FC17; Tue, 3 Jan 2012 11:13:08 +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 q03BD8xd021048; Tue, 3 Jan 2012 11:13:08 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03BD8Vw021046; Tue, 3 Jan 2012 11:13:08 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201201031113.q03BD8Vw021046@svn.freebsd.org> From: Ed Schouten Date: Tue, 3 Jan 2012 11:13:08 +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: r229386 - head/usr.bin/talk 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, 03 Jan 2012 11:13:08 -0000 Author: ed Date: Tue Jan 3 11:13:07 2012 New Revision: 229386 URL: http://svn.freebsd.org/changeset/base/229386 Log: Remove hand-written version of strcspn(). The code searches for the first occurence of @, : or !. Upon failure, it returns the index of \0. This is exactly what strcspn() does. Modified: head/usr.bin/talk/get_names.c Modified: head/usr.bin/talk/get_names.c ============================================================================== --- head/usr.bin/talk/get_names.c Tue Jan 3 11:10:15 2012 (r229385) +++ head/usr.bin/talk/get_names.c Tue Jan 3 11:13:07 2012 (r229386) @@ -80,8 +80,7 @@ get_names(int argc, char *argv[]) gethostname(hostname, sizeof (hostname)); my_machine_name = hostname; /* check for, and strip out, the machine name of the target */ - for (cp = argv[1]; *cp && !index("@:!", *cp); cp++) - ; + cp = argv[1] + strcspn(argv[1], "@:!"); if (*cp == '\0') { /* this is a local to local talk */ his_name = argv[1]; From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 12:47:55 2012 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 DA9B91065673; Tue, 3 Jan 2012 12:47:55 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C63118FC0A; Tue, 3 Jan 2012 12:47: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 q03CltWU024257; Tue, 3 Jan 2012 12:47:55 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03Clttp024247; Tue, 3 Jan 2012 12:47:55 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201031247.q03Clttp024247@svn.freebsd.org> From: Alexander Motin Date: Tue, 3 Jan 2012 12:47:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229387 - in stable/9: lib/libusbhid sys/dev/usb/input usr.bin/usbhidaction usr.bin/usbhidctl 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, 03 Jan 2012 12:47:56 -0000 Author: mav Date: Tue Jan 3 12:47:55 2012 New Revision: 229387 URL: http://svn.freebsd.org/changeset/base/229387 Log: MFC r225839: Import the rest of HID improvements from the branch: - improve report descriptor parser in libusbhid to handle several kinds of reports same time; - add to the libusbhid API two functions wrapping respective kernel IOCTLs for reading and writing reports; - tune uhid IOCTL interface to allow reading and writing arbitrary report, when multiple supported by the device; - teach usbhidctl to set output and feature reports; - make usbhidaction support all the same item names as bhidctl. Sponsored by: iXsystems, inc. Modified: stable/9/lib/libusbhid/data.c stable/9/lib/libusbhid/parse.c stable/9/lib/libusbhid/usbhid.3 stable/9/lib/libusbhid/usbhid.h stable/9/sys/dev/usb/input/uhid.c stable/9/usr.bin/usbhidaction/usbhidaction.1 stable/9/usr.bin/usbhidaction/usbhidaction.c stable/9/usr.bin/usbhidctl/usbhid.c stable/9/usr.bin/usbhidctl/usbhidctl.1 Directory Properties: stable/9/lib/libusbhid/ (props changed) stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/usr.bin/usbhidaction/ (props changed) stable/9/usr.bin/usbhidctl/ (props changed) Modified: stable/9/lib/libusbhid/data.c ============================================================================== --- stable/9/lib/libusbhid/data.c Tue Jan 3 11:13:07 2012 (r229386) +++ stable/9/lib/libusbhid/data.c Tue Jan 3 12:47:55 2012 (r229387) @@ -32,7 +32,10 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include "usbhid.h" +#include "usbvar.h" int32_t hid_get_data(const void *p, const hid_item_t *h) @@ -114,3 +117,27 @@ hid_set_data(void *p, const hid_item_t * buf[offs + i] = (buf[offs + i] & (mask >> (i*8))) | ((data >> (i*8)) & 0xff); } + +int +hid_get_report(int fd, enum hid_kind k, unsigned char *data, unsigned int size) +{ + struct usb_gen_descriptor ugd; + + memset(&ugd, 0, sizeof(ugd)); + ugd.ugd_data = hid_pass_ptr(data); + ugd.ugd_maxlen = size; + ugd.ugd_report_type = k + 1; + return (ioctl(fd, USB_GET_REPORT, &ugd)); +} + +int +hid_set_report(int fd, enum hid_kind k, unsigned char *data, unsigned int size) +{ + struct usb_gen_descriptor ugd; + + memset(&ugd, 0, sizeof(ugd)); + ugd.ugd_data = hid_pass_ptr(data); + ugd.ugd_maxlen = size; + ugd.ugd_report_type = k + 1; + return (ioctl(fd, USB_SET_REPORT, &ugd)); +} Modified: stable/9/lib/libusbhid/parse.c ============================================================================== --- stable/9/lib/libusbhid/parse.c Tue Jan 3 11:13:07 2012 (r229386) +++ stable/9/lib/libusbhid/parse.c Tue Jan 3 12:47:55 2012 (r229387) @@ -43,10 +43,11 @@ __FBSDID("$FreeBSD$"); #define MAXUSAGE 100 #define MAXPUSH 4 #define MAXID 64 +#define ITEMTYPES 3 struct hid_pos_data { int32_t rid; - uint32_t pos; + uint32_t pos[ITEMTYPES]; }; struct hid_data { @@ -55,6 +56,7 @@ struct hid_data { const uint8_t *p; struct hid_item cur[MAXPUSH]; struct hid_pos_data last_pos[MAXID]; + uint32_t pos[ITEMTYPES]; int32_t usages_min[MAXUSAGE]; int32_t usages_max[MAXUSAGE]; int32_t usage_last; /* last seen usage */ @@ -92,7 +94,7 @@ hid_clear_local(hid_item_t *c) static void hid_switch_rid(struct hid_data *s, struct hid_item *c, int32_t next_rID) { - uint8_t i; + uint8_t i, j; /* check for same report ID - optimise */ @@ -113,7 +115,8 @@ hid_switch_rid(struct hid_data *s, struc } if (i != MAXID) { s->last_pos[i].rid = c->report_ID; - s->last_pos[i].pos = c->pos; + for (j = 0; j < ITEMTYPES; j++) + s->last_pos[i].pos[j] = s->pos[j]; } /* store next report ID */ @@ -134,9 +137,12 @@ hid_switch_rid(struct hid_data *s, struc } if (i != MAXID) { s->last_pos[i].rid = next_rID; - c->pos = s->last_pos[i].pos; - } else - c->pos = 0; /* Out of RID entries. */ + for (j = 0; j < ITEMTYPES; j++) + s->pos[j] = s->last_pos[i].pos[j]; + } else { + for (j = 0; j < ITEMTYPES; j++) + s->pos[j] = 0; /* Out of RID entries. */ + } } /*------------------------------------------------------------------------* @@ -206,7 +212,6 @@ hid_get_item(hid_data_t s, hid_item_t *h { hid_item_t *c; unsigned int bTag, bType, bSize; - uint32_t oldpos; int32_t mask; int32_t dval; @@ -240,7 +245,8 @@ hid_get_item(hid_data_t s, hid_item_t *h */ if (s->kindset & (1 << c->kind)) { *h = *c; - c->pos += c->report_size * c->report_count; + h->pos = s->pos[c->kind]; + s->pos[c->kind] += c->report_size * c->report_count; return (1); } } @@ -406,14 +412,10 @@ hid_get_item(hid_data_t s, hid_item_t *h case 11: /* Pop */ s->pushlevel --; if (s->pushlevel < MAXPUSH) { - /* preserve position */ - oldpos = c->pos; c = &s->cur[s->pushlevel]; /* restore size and count */ s->loc_size = c->report_size; s->loc_count = c->report_count; - /* set default item location */ - c->pos = oldpos; c->report_size = 0; c->report_count = 0; } Modified: stable/9/lib/libusbhid/usbhid.3 ============================================================================== --- stable/9/lib/libusbhid/usbhid.3 Tue Jan 3 11:13:07 2012 (r229386) +++ stable/9/lib/libusbhid/usbhid.3 Tue Jan 3 12:47:55 2012 (r229387) @@ -44,7 +44,9 @@ .Nm hid_usage_in_page , .Nm hid_init , .Nm hid_get_data , -.Nm hid_set_data +.Nm hid_set_data , +.Nm hid_get_report , +.Nm hid_set_report .Nd USB HID access routines .Sh LIBRARY .Lb libusbhid @@ -84,6 +86,10 @@ .Fn hid_get_data "const void *data" "const hid_item_t *h" .Ft void .Fn hid_set_data "void *buf" "const hid_item_t *h" "int data" +.Ft int +.Fn hid_get_report "int fd" "enum hid_kind k" "unsigned char *data" "unsigned int size" +.Ft int +.Fn hid_set_report "int fd" "enum hid_kind k" "unsigned char *data" "unsigned int size" .Sh DESCRIPTION The .Nm @@ -105,6 +111,14 @@ Synchronous HID operation can be enabled If the second argument is zero synchronous HID operation is disabled. Else synchronous HID operation is enabled. The function returns a negative value on failure. +.Pp +.Fn hid_get_report +and +.Fn hid_set_report +functions allow to synchronously get and set specific report if device +supports it. +For devices with multiple report IDs, wanted ID should be provided in the +first byte of the buffer for both get and set. .Ss Descriptor Functions The report descriptor ID can be obtained by calling .Fn hid_get_report_id . Modified: stable/9/lib/libusbhid/usbhid.h ============================================================================== --- stable/9/lib/libusbhid/usbhid.h Tue Jan 3 11:13:07 2012 (r229386) +++ stable/9/lib/libusbhid/usbhid.h Tue Jan 3 12:47:55 2012 (r229387) @@ -76,6 +76,7 @@ typedef struct hid_item { #define HID_PAGE(u) (((u) >> 16) & 0xffff) #define HID_USAGE(u) ((u) & 0xffff) +#define HID_HAS_GET_SET_REPORT 1 __BEGIN_DECLS @@ -104,5 +105,9 @@ int hid_parse_usage_page(const char *nam /* Extracting/insertion of data, data.c: */ int32_t hid_get_data(const void *p, const hid_item_t *h); void hid_set_data(void *p, const hid_item_t *h, int32_t data); +int hid_get_report(int fd, enum hid_kind k, + unsigned char *data, unsigned int size); +int hid_set_report(int fd, enum hid_kind k, + unsigned char *data, unsigned int size); __END_DECLS Modified: stable/9/sys/dev/usb/input/uhid.c ============================================================================== --- stable/9/sys/dev/usb/input/uhid.c Tue Jan 3 11:13:07 2012 (r229386) +++ stable/9/sys/dev/usb/input/uhid.c Tue Jan 3 12:47:55 2012 (r229387) @@ -566,8 +566,10 @@ uhid_ioctl(struct usb_fifo *fifo, u_long default: return (EINVAL); } + if (id != 0) + copyin(ugd->ugd_data, &id, 1); error = uhid_get_report(sc, ugd->ugd_report_type, id, - NULL, ugd->ugd_data, size); + NULL, ugd->ugd_data, imin(ugd->ugd_maxlen, size)); break; case USB_SET_REPORT: @@ -592,8 +594,10 @@ uhid_ioctl(struct usb_fifo *fifo, u_long default: return (EINVAL); } + if (id != 0) + copyin(ugd->ugd_data, &id, 1); error = uhid_set_report(sc, ugd->ugd_report_type, id, - NULL, ugd->ugd_data, size); + NULL, ugd->ugd_data, imin(ugd->ugd_maxlen, size)); break; case USB_GET_REPORT_ID: Modified: stable/9/usr.bin/usbhidaction/usbhidaction.1 ============================================================================== --- stable/9/usr.bin/usbhidaction/usbhidaction.1 Tue Jan 3 11:13:07 2012 (r229386) +++ stable/9/usr.bin/usbhidaction/usbhidaction.1 Tue Jan 3 12:47:55 2012 (r229387) @@ -99,8 +99,7 @@ a debounce value, and an action. There must be whitespace between the parts. .Pp The item names are similar to those used by -.Xr usbhidctl 1 , -but each part must be prefixed by its page name. +.Xr usbhidctl 1 . .Pp The value is simply a numeric value. When the item reports this value, Modified: stable/9/usr.bin/usbhidaction/usbhidaction.c ============================================================================== --- stable/9/usr.bin/usbhidaction/usbhidaction.c Tue Jan 3 11:13:07 2012 (r229386) +++ stable/9/usr.bin/usbhidaction/usbhidaction.c Tue Jan 3 12:47:55 2012 (r229387) @@ -280,12 +280,11 @@ parse_conf(const char *conf, report_desc char *p; int line; char buf[SIZE], name[SIZE], value[SIZE], debounce[SIZE], action[SIZE]; - char usbuf[SIZE], coll[SIZE]; + char usbuf[SIZE], coll[SIZE], *tmp; struct command *cmd, *cmds; struct hid_data *d; struct hid_item h; - int u, lo, hi, range; - + int inst, cinst, u, lo, hi, range, t; f = fopen(conf, "r"); if (f == NULL) @@ -317,6 +316,12 @@ parse_conf(const char *conf, report_desc ", syntax error: %s", conf, line, buf); } } + tmp = strchr(name, '#'); + if (tmp != NULL) { + *tmp = 0; + inst = atoi(tmp + 1); + } else + inst = 0; cmd = malloc(sizeof *cmd); if (cmd == NULL) @@ -361,6 +366,7 @@ parse_conf(const char *conf, report_desc } coll[0] = 0; + cinst = 0; for (d = hid_start_parse(repd, 1 << hid_input, reportid); hid_get_item(d, &h); ) { if (verbose > 2) @@ -380,24 +386,29 @@ parse_conf(const char *conf, report_desc range = 0; } for (u = lo; u <= hi; u++) { - snprintf(usbuf, sizeof usbuf, "%s:%s", - hid_usage_page(HID_PAGE(u)), - hid_usage_in_page(u)); - if (verbose > 2) - printf("usage %s\n", usbuf); - if (!strcasecmp(usbuf, name)) - goto foundhid; if (coll[0]) { snprintf(usbuf, sizeof usbuf, "%s.%s:%s", coll+1, - hid_usage_page(HID_PAGE(u)), + hid_usage_page(HID_PAGE(u)), + hid_usage_in_page(u)); + } else { + snprintf(usbuf, sizeof usbuf, + "%s:%s", + hid_usage_page(HID_PAGE(u)), hid_usage_in_page(u)); - if (verbose > 2) - printf("usage %s\n", - usbuf); - if (!strcasecmp(usbuf, name)) - goto foundhid; } + if (verbose > 2) + printf("usage %s\n", usbuf); + t = strlen(usbuf) - strlen(name); + if (t > 0) { + if (strcmp(usbuf + t, name)) + continue; + if (usbuf[t - 1] != '.') + continue; + } else if (strcmp(usbuf, name)) + continue; + if (inst == cinst++) + goto foundhid; } break; case hid_collection: Modified: stable/9/usr.bin/usbhidctl/usbhid.c ============================================================================== --- stable/9/usr.bin/usbhidctl/usbhid.c Tue Jan 3 11:13:07 2012 (r229386) +++ stable/9/usr.bin/usbhidctl/usbhid.c Tue Jan 3 12:47:55 2012 (r229387) @@ -42,45 +42,141 @@ #include #include +struct variable { + char *name; + int instance; + int val; + struct hid_item h; + struct variable *next; +} *vars; + int verbose = 0; -int all = 0; int noname = 0; int hexdump = 0; +int wflag = 0; +int zflag = 0; -char **names; -int nnames; - -void prbits(int bits, char **strs, int n); -void usage(void); -void dumpitem(const char *label, struct hid_item *h); -void dumpitems(report_desc_t r); -void rev(struct hid_item **p); -void prdata(u_char *buf, struct hid_item *h); -void dumpdata(int f, report_desc_t r, int loop); -int gotname(char *n); +static void usage(void); +static void dumpitem(const char *label, struct hid_item *h); +static void dumpitems(report_desc_t r); +static void prdata(u_char *buf, struct hid_item *h); +static void dumpdata(int f, report_desc_t r, int loop); +static void writedata(int f, report_desc_t r); -int -gotname(char *n) +static void +parceargs(report_desc_t r, int all, int nnames, char **names) { - int i; - - for (i = 0; i < nnames; i++) - if (strcmp(names[i], n) == 0) - return 1; - return 0; -} - -void -prbits(int bits, char **strs, int n) -{ - int i; - - for(i = 0; i < n; i++, bits >>= 1) - if (strs[i*2]) - printf("%s%s", i == 0 ? "" : ", ", strs[i*2 + (bits&1)]); + struct hid_data *d; + struct hid_item h; + char colls[1000]; + char hname[1000], *tmp1, *tmp2; + struct variable *var, **pnext; + int i, instance, cp, t; + + pnext = &vars; + if (all) { + if (wflag) + errx(1, "Must not specify -w to read variables"); + cp = 0; + for (d = hid_start_parse(r, + 1<name, "%s%s%s:%s", + colls, colls[0] != 0 ? "." : "", + hid_usage_page(HID_PAGE(h.usage)), + hid_usage_in_page(h.usage)); + var->h = h; + *pnext = var; + pnext = &var->next; + } + hid_end_parse(d); + return; + } + for (i = 0; i < nnames; i++) { + var = malloc(sizeof(*var)); + memset(var, 0, sizeof(*var)); + tmp1 = tmp2 = strdup(names[i]); + strsep(&tmp2, "="); + var->name = strsep(&tmp1, "#"); + if (tmp1 != NULL) + var->instance = atoi(tmp1); + if (tmp2 != NULL) { + if (!wflag) + errx(1, "Must specify -w to write variables"); + var->val = atoi(tmp2); + } else + if (wflag) + errx(1, "Must not specify -w to read variables"); + *pnext = var; + pnext = &var->next; + + instance = 0; + cp = 0; + for (d = hid_start_parse(r, + 1<name); + if (t > 0) { + if (strcmp(hname + t, var->name) != 0) + continue; + if (hname[t - 1] != '.') + continue; + } else if (strcmp(hname, var->name) != 0) + continue; + if (var->instance != instance++) + continue; + var->h = h; + break; + } + hid_end_parse(d); + if (var->h.usage == 0) + errx(1, "Unknown item '%s'", var->name); + } } -void +static void usage(void) { @@ -92,10 +188,14 @@ usage(void) " %s -f device " "[-l] [-n] [-r] [-t tablefile] [-v] [-x] -a\n", getprogname()); + fprintf(stderr, + " %s -f device " + "[-t tablefile] [-v] [-z] -w name=value\n", + getprogname()); exit(1); } -void +static void dumpitem(const char *label, struct hid_item *h) { if ((h->flags & HIO_CONST) && !verbose) @@ -134,7 +234,7 @@ hid_collection_type(int32_t type) return (num); } -void +static void dumpitems(report_desc_t r) { struct hid_data *d; @@ -174,23 +274,7 @@ dumpitems(report_desc_t r) printf("Total feature size %d bytes\n", size); } -void -rev(struct hid_item **p) -{ - struct hid_item *cur, *prev, *next; - - prev = 0; - cur = *p; - while(cur != 0) { - next = cur->next; - cur->next = prev; - prev = cur; - cur = next; - } - *p = prev; -} - -void +static void prdata(u_char *buf, struct hid_item *h) { u_int data; @@ -212,82 +296,162 @@ prdata(u_char *buf, struct hid_item *h) h->pos = pos; } -void +static void dumpdata(int f, report_desc_t rd, int loop) { - struct hid_data *d; - struct hid_item h, *hids, *n; - int r, dlen; + struct variable *var; + int dlen, havedata, i, match, r, rid, use_rid; u_char *dbuf; - u_int32_t colls[100]; - int sp = 0; - char namebuf[10000], *namep; - - hids = 0; - for (d = hid_start_parse(rd, 1<= 256) { + rid = 0; + kind++; + } + if (kind >= 3) + rid = -1; + for (var = vars; var; var = var->next) { + if (rid == var->h.report_ID && + kind == var->h.kind) + break; + } + if (var == NULL) + continue; + } + dlen = hid_report_size(rd, kind < 3 ? kind : hid_input, rid); + if (dlen <= 0) continue; - h.next = hids; - h.collection = colls[sp]; - hids = malloc(sizeof *hids); - *hids = h; - } - hid_end_parse(d); - rev(&hids); - dlen = hid_report_size(rd, hid_input, -1); - dbuf = malloc(dlen); - if (!loop) - if (hid_set_immed(f, 1) < 0) { - if (errno == EOPNOTSUPP) - warnx("device does not support immediate mode, only changes reported."); - else - err(1, "USB_SET_IMMED"); + dbuf = malloc(dlen); + memset(dbuf, 0, dlen); + if (kind < 3) { + dbuf[0] = rid; + r = hid_get_report(f, kind, dbuf, dlen); + if (r < 0) + warn("hid_get_report(rid %d)", rid); + havedata = !r && (rid == 0 || dbuf[0] == rid); + if (rid != 0) + dbuf[0] = rid; + } else { + r = read(f, dbuf, dlen); + if (r < 1) + err(1, "read error"); + havedata = 1; } - do { - r = read(f, dbuf, dlen); - if (r < 1) { - err(1, "read error"); + if (verbose) { + printf("Got %s report %d (%d bytes):", + kind == hid_output ? "output" : + kind == hid_feature ? "feature" : "input", + use_rid ? dbuf[0] : 0, dlen); + if (havedata) { + for (i = 0; i < dlen; i++) + printf(" %02x", dbuf[i]); + } + printf("\n"); } - for (n = hids; n; n = n->next) { - if (n->report_ID != 0 && dbuf[0] != n->report_ID) + match = 0; + for (var = vars; var; var = var->next) { + if ((kind < 3 ? kind : hid_input) != var->h.kind) continue; - namep = namebuf; - namep += sprintf(namep, "%s:%s.", - hid_usage_page(HID_PAGE(n->collection)), - hid_usage_in_page(n->collection)); - namep += sprintf(namep, "%s:%s", - hid_usage_page(HID_PAGE(n->usage)), - hid_usage_in_page(n->usage)); - if (all || gotname(namebuf)) { - if (!noname) - printf("%s=", namebuf); - prdata(dbuf, n); + if (var->h.report_ID != 0 && + dbuf[0] != var->h.report_ID) + continue; + match = 1; + if (!noname) + printf("%s=", var->name); + if (havedata) + prdata(dbuf, &var->h); + printf("\n"); + } + if (match) + printf("\n"); + free(dbuf); + } while (loop || kind < 3); +} + +static void +writedata(int f, report_desc_t rd) +{ + struct variable *var; + int dlen, i, r, rid; + u_char *dbuf; + enum hid_kind kind; + + kind = 0; + rid = 0; + for (kind = 0; kind < 3; kind ++) { + for (rid = 0; rid < 256; rid ++) { + for (var = vars; var; var = var->next) { + if (rid == var->h.report_ID && kind == var->h.kind) + break; + } + if (var == NULL) + continue; + dlen = hid_report_size(rd, kind, rid); + if (dlen <= 0) + continue; + dbuf = malloc(dlen); + memset(dbuf, 0, dlen); + dbuf[0] = rid; + if (!zflag && hid_get_report(f, kind, dbuf, dlen) == 0) { + if (verbose) { + printf("Got %s report %d (%d bytes):", + kind == hid_input ? "input" : + kind == hid_output ? "output" : "feature", + rid, dlen); + for (i = 0; i < dlen; i++) + printf(" %02x", dbuf[i]); printf("\n"); } + } else if (!zflag) { + warn("hid_get_report(rid %d)", rid); + if (verbose) { + printf("Can't get %s report %d (%d bytes). " + "Will be initialized with zeros.\n", + kind == hid_input ? "input" : + kind == hid_output ? "output" : "feature", + rid, dlen); + } } - if (loop) + for (var = vars; var; var = var->next) { + if (rid != var->h.report_ID || kind != var->h.kind) + continue; + hid_set_data(dbuf, &var->h, var->val); + } + if (verbose) { + printf("Setting %s report %d (%d bytes):", + kind == hid_output ? "output" : + kind == hid_feature ? "feature" : "input", + rid, dlen); + for (i = 0; i < dlen; i++) + printf(" %02x", dbuf[i]); printf("\n"); - } while (loop); - free(dbuf); + } + r = hid_set_report(f, kind, dbuf, dlen); + if (r != 0) + warn("hid_set_report(rid %d)", rid); + free(dbuf); + } + } } int main(int argc, char **argv) { - int f; report_desc_t r; - char devnam[100], *dev = 0; + char *table = 0; + char devnam[100], *dev = NULL; + int f; + int all = 0; int ch; int repdump = 0; int loop = 0; - char *table = 0; - while ((ch = getopt(argc, argv, "af:lnrt:vx")) != -1) { + while ((ch = getopt(argc, argv, "af:lnrt:vwxz")) != -1) { switch(ch) { case 'a': all++; @@ -310,9 +474,15 @@ main(int argc, char **argv) case 'v': verbose++; break; + case 'w': + wflag = 1; + break; case 'x': hexdump = 1; break; + case 'z': + zflag = 1; + break; case '?': default: usage(); @@ -320,12 +490,10 @@ main(int argc, char **argv) } argc -= optind; argv += optind; - if (dev == 0) + if (dev == NULL) usage(); - names = argv; - nnames = argc; - if (nnames == 0 && !all && !repdump) + if (argc == 0 && !all && !repdump) usage(); if (dev[0] != '/') { @@ -350,8 +518,13 @@ main(int argc, char **argv) printf("Report descriptor:\n"); dumpitems(r); } - if (nnames != 0 || all) - dumpdata(f, r, loop); + if (argc != 0 || all) { + parceargs(r, all, argc, argv); + if (wflag) + writedata(f, r); + else + dumpdata(f, r, loop); + } hid_dispose_report_desc(r); exit(0); Modified: stable/9/usr.bin/usbhidctl/usbhidctl.1 ============================================================================== --- stable/9/usr.bin/usbhidctl/usbhidctl.1 Tue Jan 3 11:13:07 2012 (r229386) +++ stable/9/usr.bin/usbhidctl/usbhidctl.1 Tue Jan 3 12:47:55 2012 (r229387) @@ -28,7 +28,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd November 23, 2006 +.Dd August 01, 2011 .Dt USBHIDCTL 1 .Os .Sh NAME @@ -36,27 +36,51 @@ .Nd manipulate USB HID devices .Sh SYNOPSIS .Nm -.Op Fl a .Fl f Ar device +.Op Fl t Ar table +.Op Fl v +.Op Fl x +.Fl r +.Nm +.Fl f Ar device +.Op Fl t Ar table .Op Fl l -.Op Fl n -.Op Fl r +.Op Fl v +.Op Fl x +.Fl a +.Nm +.Fl f Ar device .Op Fl t Ar table +.Op Fl l +.Op Fl n .Op Fl v .Op Fl x -.Op Ar item ... +.Ar item ... +.Nm +.Fl f Ar device +.Op Fl t Ar table +.Op Fl v +.Op Fl z +.Fl w +.Ar item=value ... .Sh DESCRIPTION The .Nm -utility can be used to dump the state of a USB HID (Human Interface Device). +utility can be used to dump and modify the state of a USB HID (Human +Interface Device). Each named .Ar item is printed. +If the +.Fl w +flag is specified +.Nm +attempts to set the specified items to the given values. .Pp The options are as follows: .Bl -tag -width Ds .It Fl a -Show all items. +Show all items and their current values if device returns. .It Fl f Ar device Specify a path name for the device to operate on. .It Fl l @@ -69,9 +93,47 @@ Dump the report descriptor. Specify a path name for the HID usage table file. .It Fl v Be verbose. +.It Fl w +Change item values. +Only 'output' and 'feature' kinds can be set with this option. .It Fl x Dump data in hexadecimal as well as decimal. +.It Fl z +Reset reports to zero before processing +.Fl w +arguments. If not specified, current values will be requested from device. .El +.Sh SYNTAX +.Nm +compares the names of items specified on the command line against the human +interface items reported by the USB device. +Each human interface item is mapped from its native form to a human readable +name, using the HID usage table file. +Command line items are compared with the generated item names, +and the USB HID device is operated on when a match is found. +.Pp +Each human interface item is named by the +.Qq page +it appears in, the +.Qq usage +within that page, and the list of +.Qq collections +containing the item. +Each collection in turn is also identified by page, and +the usage within that page. +.Pp +On the +.Nm +command line the page name is separated from the usage name with the character +.Sq Cm \&: . +The collections are separated by the character +.Sq Cm \&. . +.Pp +Some devices give the same name to more than one item. +.Nm +supports isolating each item by appending a +.Sq Cm \&# . +character and a decimal item instance number, starting at zero. .Sh FILES .Pa /usr/share/misc/usb_hid_usages The default HID usage table. @@ -84,7 +146,3 @@ The .Nm command appeared in .Nx 1.4 . -.Sh BUGS -The -.Nm -utility cannot show nor set output and feature items. From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 13:13:32 2012 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 71EF6106564A; Tue, 3 Jan 2012 13:13:32 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 45DD18FC1D; Tue, 3 Jan 2012 13:13: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 q03DDWDi025304; Tue, 3 Jan 2012 13:13:32 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03DDW7o025300; Tue, 3 Jan 2012 13:13:32 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201031313.q03DDW7o025300@svn.freebsd.org> From: Alexander Motin Date: Tue, 3 Jan 2012 13:13:32 +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: r229388 - stable/8/lib/libusbhid 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, 03 Jan 2012 13:13:32 -0000 Author: mav Date: Tue Jan 3 13:13:31 2012 New Revision: 229388 URL: http://svn.freebsd.org/changeset/base/229388 Log: MFC r213920 (by hselasky): - Add support for libusbhid in 32-bit compatibility mode. - Add missing check for ugd_actlen being too small. - Add missing inclusion guard to usbvar.h header file. Modified: stable/8/lib/libusbhid/Makefile stable/8/lib/libusbhid/descr.c stable/8/lib/libusbhid/usbvar.h Directory Properties: stable/8/lib/libusbhid/ (props changed) Modified: stable/8/lib/libusbhid/Makefile ============================================================================== --- stable/8/lib/libusbhid/Makefile Tue Jan 3 12:47:55 2012 (r229387) +++ stable/8/lib/libusbhid/Makefile Tue Jan 3 13:13:31 2012 (r229388) @@ -19,4 +19,8 @@ SRCS= descr.c descr_compat.c parse.c usa INCS= usbhid.h +.if defined(COMPAT_32BIT) +CFLAGS+= -DCOMPAT_32BIT +.endif + .include Modified: stable/8/lib/libusbhid/descr.c ============================================================================== --- stable/8/lib/libusbhid/descr.c Tue Jan 3 12:47:55 2012 (r229387) +++ stable/8/lib/libusbhid/descr.c Tue Jan 3 13:13:31 2012 (r229388) @@ -103,7 +103,7 @@ hid_get_report_desc(int fd) memset(&ugd, 0, sizeof(ugd)); /* get actual length first */ - ugd.ugd_data = NULL; + ugd.ugd_data = hid_pass_ptr(NULL); ugd.ugd_maxlen = 65535; if (ioctl(fd, USB_GET_REPORT_DESC, &ugd) < 0) { #ifdef HID_COMPAT7 @@ -124,7 +124,7 @@ hid_get_report_desc(int fd) return (NULL); /* fetch actual descriptor */ - ugd.ugd_data = data; + ugd.ugd_data = hid_pass_ptr(data); ugd.ugd_maxlen = ugd.ugd_actlen; if (ioctl(fd, USB_GET_REPORT_DESC, &ugd) < 0) { /* could not read descriptor */ @@ -132,8 +132,15 @@ hid_get_report_desc(int fd) return (NULL); } + /* sanity check */ + if (ugd.ugd_actlen < 1) { + /* invalid report descriptor */ + free(data); + return (NULL); + } + /* check END_COLLECTION */ - if (((unsigned char *)ugd.ugd_data)[ugd.ugd_actlen -1] != 0xC0) { + if (((unsigned char *)data)[ugd.ugd_actlen -1] != 0xC0) { /* invalid end byte */ free(data); return (NULL); Modified: stable/8/lib/libusbhid/usbvar.h ============================================================================== --- stable/8/lib/libusbhid/usbvar.h Tue Jan 3 12:47:55 2012 (r229387) +++ stable/8/lib/libusbhid/usbvar.h Tue Jan 3 13:13:31 2012 (r229388) @@ -29,6 +29,9 @@ * */ +#ifndef _USBVAR_H_ +#define _USBVAR_H_ + struct report_desc { uint32_t size; uint8_t data[1]; @@ -41,3 +44,11 @@ int hid_set_immed_compat7(int fd, int en int hid_get_report_id_compat7(int fd); report_desc_t hid_get_report_desc_compat7(int fd); #endif + +#ifdef COMPAT_32BIT +#define hid_pass_ptr(ptr) ((uint64_t)(uintptr_t)(ptr)) +#else +#define hid_pass_ptr(ptr) (ptr) +#endif + +#endif /* _USBVAR_H_ */ From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 13:16:47 2012 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 C07A9106564A; Tue, 3 Jan 2012 13:16:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ABF9D8FC13; Tue, 3 Jan 2012 13:16:47 +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 q03DGlDX025483; Tue, 3 Jan 2012 13:16:47 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03DGl0D025473; Tue, 3 Jan 2012 13:16:47 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201031316.q03DGl0D025473@svn.freebsd.org> From: Alexander Motin Date: Tue, 3 Jan 2012 13:16:47 +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: r229389 - in stable/8: lib/libusbhid sys/conf sys/dev/usb/input usr.bin/usbhidaction usr.bin/usbhidctl 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, 03 Jan 2012 13:16:47 -0000 Author: mav Date: Tue Jan 3 13:16:47 2012 New Revision: 229389 URL: http://svn.freebsd.org/changeset/base/229389 Log: MFC r225839: Import the rest of HID improvements from the branch: - improve report descriptor parser in libusbhid to handle several kinds of reports same time; - add to the libusbhid API two functions wrapping respective kernel IOCTLs for reading and writing reports; - tune uhid IOCTL interface to allow reading and writing arbitrary report, when multiple supported by the device; - teach usbhidctl to set output and feature reports; - make usbhidaction support all the same item names as bhidctl. Sponsored by: iXsystems, inc. Modified: stable/8/lib/libusbhid/data.c stable/8/lib/libusbhid/parse.c stable/8/lib/libusbhid/usbhid.3 stable/8/lib/libusbhid/usbhid.h stable/8/sys/dev/usb/input/uhid.c stable/8/usr.bin/usbhidaction/usbhidaction.1 stable/8/usr.bin/usbhidaction/usbhidaction.c stable/8/usr.bin/usbhidctl/usbhid.c stable/8/usr.bin/usbhidctl/usbhidctl.1 Directory Properties: stable/8/lib/libusbhid/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/usr.bin/usbhidaction/ (props changed) stable/8/usr.bin/usbhidctl/ (props changed) Modified: stable/8/lib/libusbhid/data.c ============================================================================== --- stable/8/lib/libusbhid/data.c Tue Jan 3 13:13:31 2012 (r229388) +++ stable/8/lib/libusbhid/data.c Tue Jan 3 13:16:47 2012 (r229389) @@ -32,7 +32,10 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include "usbhid.h" +#include "usbvar.h" int32_t hid_get_data(const void *p, const hid_item_t *h) @@ -114,3 +117,27 @@ hid_set_data(void *p, const hid_item_t * buf[offs + i] = (buf[offs + i] & (mask >> (i*8))) | ((data >> (i*8)) & 0xff); } + +int +hid_get_report(int fd, enum hid_kind k, unsigned char *data, unsigned int size) +{ + struct usb_gen_descriptor ugd; + + memset(&ugd, 0, sizeof(ugd)); + ugd.ugd_data = hid_pass_ptr(data); + ugd.ugd_maxlen = size; + ugd.ugd_report_type = k + 1; + return (ioctl(fd, USB_GET_REPORT, &ugd)); +} + +int +hid_set_report(int fd, enum hid_kind k, unsigned char *data, unsigned int size) +{ + struct usb_gen_descriptor ugd; + + memset(&ugd, 0, sizeof(ugd)); + ugd.ugd_data = hid_pass_ptr(data); + ugd.ugd_maxlen = size; + ugd.ugd_report_type = k + 1; + return (ioctl(fd, USB_SET_REPORT, &ugd)); +} Modified: stable/8/lib/libusbhid/parse.c ============================================================================== --- stable/8/lib/libusbhid/parse.c Tue Jan 3 13:13:31 2012 (r229388) +++ stable/8/lib/libusbhid/parse.c Tue Jan 3 13:16:47 2012 (r229389) @@ -43,10 +43,11 @@ __FBSDID("$FreeBSD$"); #define MAXUSAGE 100 #define MAXPUSH 4 #define MAXID 64 +#define ITEMTYPES 3 struct hid_pos_data { int32_t rid; - uint32_t pos; + uint32_t pos[ITEMTYPES]; }; struct hid_data { @@ -55,6 +56,7 @@ struct hid_data { const uint8_t *p; struct hid_item cur[MAXPUSH]; struct hid_pos_data last_pos[MAXID]; + uint32_t pos[ITEMTYPES]; int32_t usages_min[MAXUSAGE]; int32_t usages_max[MAXUSAGE]; int32_t usage_last; /* last seen usage */ @@ -92,7 +94,7 @@ hid_clear_local(hid_item_t *c) static void hid_switch_rid(struct hid_data *s, struct hid_item *c, int32_t next_rID) { - uint8_t i; + uint8_t i, j; /* check for same report ID - optimise */ @@ -113,7 +115,8 @@ hid_switch_rid(struct hid_data *s, struc } if (i != MAXID) { s->last_pos[i].rid = c->report_ID; - s->last_pos[i].pos = c->pos; + for (j = 0; j < ITEMTYPES; j++) + s->last_pos[i].pos[j] = s->pos[j]; } /* store next report ID */ @@ -134,9 +137,12 @@ hid_switch_rid(struct hid_data *s, struc } if (i != MAXID) { s->last_pos[i].rid = next_rID; - c->pos = s->last_pos[i].pos; - } else - c->pos = 0; /* Out of RID entries. */ + for (j = 0; j < ITEMTYPES; j++) + s->pos[j] = s->last_pos[i].pos[j]; + } else { + for (j = 0; j < ITEMTYPES; j++) + s->pos[j] = 0; /* Out of RID entries. */ + } } /*------------------------------------------------------------------------* @@ -206,7 +212,6 @@ hid_get_item(hid_data_t s, hid_item_t *h { hid_item_t *c; unsigned int bTag, bType, bSize; - uint32_t oldpos; int32_t mask; int32_t dval; @@ -240,7 +245,8 @@ hid_get_item(hid_data_t s, hid_item_t *h */ if (s->kindset & (1 << c->kind)) { *h = *c; - c->pos += c->report_size * c->report_count; + h->pos = s->pos[c->kind]; + s->pos[c->kind] += c->report_size * c->report_count; return (1); } } @@ -406,14 +412,10 @@ hid_get_item(hid_data_t s, hid_item_t *h case 11: /* Pop */ s->pushlevel --; if (s->pushlevel < MAXPUSH) { - /* preserve position */ - oldpos = c->pos; c = &s->cur[s->pushlevel]; /* restore size and count */ s->loc_size = c->report_size; s->loc_count = c->report_count; - /* set default item location */ - c->pos = oldpos; c->report_size = 0; c->report_count = 0; } Modified: stable/8/lib/libusbhid/usbhid.3 ============================================================================== --- stable/8/lib/libusbhid/usbhid.3 Tue Jan 3 13:13:31 2012 (r229388) +++ stable/8/lib/libusbhid/usbhid.3 Tue Jan 3 13:16:47 2012 (r229389) @@ -44,7 +44,9 @@ .Nm hid_usage_in_page , .Nm hid_init , .Nm hid_get_data , -.Nm hid_set_data +.Nm hid_set_data , +.Nm hid_get_report , +.Nm hid_set_report .Nd USB HID access routines .Sh LIBRARY .Lb libusbhid @@ -84,6 +86,10 @@ .Fn hid_get_data "const void *data" "const hid_item_t *h" .Ft void .Fn hid_set_data "void *buf" "const hid_item_t *h" "int data" +.Ft int +.Fn hid_get_report "int fd" "enum hid_kind k" "unsigned char *data" "unsigned int size" +.Ft int +.Fn hid_set_report "int fd" "enum hid_kind k" "unsigned char *data" "unsigned int size" .Sh DESCRIPTION The .Nm @@ -105,6 +111,14 @@ Synchronous HID operation can be enabled If the second argument is zero synchronous HID operation is disabled. Else synchronous HID operation is enabled. The function returns a negative value on failure. +.Pp +.Fn hid_get_report +and +.Fn hid_set_report +functions allow to synchronously get and set specific report if device +supports it. +For devices with multiple report IDs, wanted ID should be provided in the +first byte of the buffer for both get and set. .Ss Descriptor Functions The report descriptor ID can be obtained by calling .Fn hid_get_report_id . Modified: stable/8/lib/libusbhid/usbhid.h ============================================================================== --- stable/8/lib/libusbhid/usbhid.h Tue Jan 3 13:13:31 2012 (r229388) +++ stable/8/lib/libusbhid/usbhid.h Tue Jan 3 13:16:47 2012 (r229389) @@ -77,6 +77,7 @@ typedef struct hid_item { #define HID_PAGE(u) (((u) >> 16) & 0xffff) #define HID_USAGE(u) ((u) & 0xffff) +#define HID_HAS_GET_SET_REPORT 1 __BEGIN_DECLS @@ -105,5 +106,9 @@ int hid_parse_usage_page(const char *nam /* Extracting/insertion of data, data.c: */ int32_t hid_get_data(const void *p, const hid_item_t *h); void hid_set_data(void *p, const hid_item_t *h, int32_t data); +int hid_get_report(int fd, enum hid_kind k, + unsigned char *data, unsigned int size); +int hid_set_report(int fd, enum hid_kind k, + unsigned char *data, unsigned int size); __END_DECLS Modified: stable/8/sys/dev/usb/input/uhid.c ============================================================================== --- stable/8/sys/dev/usb/input/uhid.c Tue Jan 3 13:13:31 2012 (r229388) +++ stable/8/sys/dev/usb/input/uhid.c Tue Jan 3 13:16:47 2012 (r229389) @@ -566,8 +566,10 @@ uhid_ioctl(struct usb_fifo *fifo, u_long default: return (EINVAL); } + if (id != 0) + copyin(ugd->ugd_data, &id, 1); error = uhid_get_report(sc, ugd->ugd_report_type, id, - NULL, ugd->ugd_data, size); + NULL, ugd->ugd_data, imin(ugd->ugd_maxlen, size)); break; case USB_SET_REPORT: @@ -592,8 +594,10 @@ uhid_ioctl(struct usb_fifo *fifo, u_long default: return (EINVAL); } + if (id != 0) + copyin(ugd->ugd_data, &id, 1); error = uhid_set_report(sc, ugd->ugd_report_type, id, - NULL, ugd->ugd_data, size); + NULL, ugd->ugd_data, imin(ugd->ugd_maxlen, size)); break; case USB_GET_REPORT_ID: Modified: stable/8/usr.bin/usbhidaction/usbhidaction.1 ============================================================================== --- stable/8/usr.bin/usbhidaction/usbhidaction.1 Tue Jan 3 13:13:31 2012 (r229388) +++ stable/8/usr.bin/usbhidaction/usbhidaction.1 Tue Jan 3 13:16:47 2012 (r229389) @@ -106,8 +106,7 @@ a debounce value, and an action. There must be whitespace between the parts. .Pp The item names are similar to those used by -.Xr usbhidctl 1 , -but each part must be prefixed by its page name. +.Xr usbhidctl 1 . .Pp The value is simply a numeric value. When the item reports this value, Modified: stable/8/usr.bin/usbhidaction/usbhidaction.c ============================================================================== --- stable/8/usr.bin/usbhidaction/usbhidaction.c Tue Jan 3 13:13:31 2012 (r229388) +++ stable/8/usr.bin/usbhidaction/usbhidaction.c Tue Jan 3 13:16:47 2012 (r229389) @@ -286,12 +286,11 @@ parse_conf(const char *conf, report_desc char *p; int line; char buf[SIZE], name[SIZE], value[SIZE], debounce[SIZE], action[SIZE]; - char usbuf[SIZE], coll[SIZE]; + char usbuf[SIZE], coll[SIZE], *tmp; struct command *cmd, *cmds; struct hid_data *d; struct hid_item h; - int u, lo, hi, range; - + int inst, cinst, u, lo, hi, range, t; f = fopen(conf, "r"); if (f == NULL) @@ -323,6 +322,12 @@ parse_conf(const char *conf, report_desc ", syntax error: %s", conf, line, buf); } } + tmp = strchr(name, '#'); + if (tmp != NULL) { + *tmp = 0; + inst = atoi(tmp + 1); + } else + inst = 0; cmd = malloc(sizeof *cmd); if (cmd == NULL) @@ -367,6 +372,7 @@ parse_conf(const char *conf, report_desc } coll[0] = 0; + cinst = 0; for (d = hid_start_parse(repd, 1 << hid_input, reportid); hid_get_item(d, &h); ) { if (verbose > 2) @@ -386,24 +392,29 @@ parse_conf(const char *conf, report_desc range = 0; } for (u = lo; u <= hi; u++) { - snprintf(usbuf, sizeof usbuf, "%s:%s", - hid_usage_page(HID_PAGE(u)), - hid_usage_in_page(u)); - if (verbose > 2) - printf("usage %s\n", usbuf); - if (!strcasecmp(usbuf, name)) - goto foundhid; if (coll[0]) { snprintf(usbuf, sizeof usbuf, "%s.%s:%s", coll+1, - hid_usage_page(HID_PAGE(u)), + hid_usage_page(HID_PAGE(u)), + hid_usage_in_page(u)); + } else { + snprintf(usbuf, sizeof usbuf, + "%s:%s", + hid_usage_page(HID_PAGE(u)), hid_usage_in_page(u)); - if (verbose > 2) - printf("usage %s\n", - usbuf); - if (!strcasecmp(usbuf, name)) - goto foundhid; } + if (verbose > 2) + printf("usage %s\n", usbuf); + t = strlen(usbuf) - strlen(name); + if (t > 0) { + if (strcmp(usbuf + t, name)) + continue; + if (usbuf[t - 1] != '.') + continue; + } else if (strcmp(usbuf, name)) + continue; + if (inst == cinst++) + goto foundhid; } break; case hid_collection: Modified: stable/8/usr.bin/usbhidctl/usbhid.c ============================================================================== --- stable/8/usr.bin/usbhidctl/usbhid.c Tue Jan 3 13:13:31 2012 (r229388) +++ stable/8/usr.bin/usbhidctl/usbhid.c Tue Jan 3 13:16:47 2012 (r229389) @@ -49,45 +49,141 @@ #include #include +struct variable { + char *name; + int instance; + int val; + struct hid_item h; + struct variable *next; +} *vars; + int verbose = 0; -int all = 0; int noname = 0; int hexdump = 0; +int wflag = 0; +int zflag = 0; -char **names; -int nnames; - -void prbits(int bits, char **strs, int n); -void usage(void); -void dumpitem(const char *label, struct hid_item *h); -void dumpitems(report_desc_t r); -void rev(struct hid_item **p); -void prdata(u_char *buf, struct hid_item *h); -void dumpdata(int f, report_desc_t r, int loop); -int gotname(char *n); +static void usage(void); +static void dumpitem(const char *label, struct hid_item *h); +static void dumpitems(report_desc_t r); +static void prdata(u_char *buf, struct hid_item *h); +static void dumpdata(int f, report_desc_t r, int loop); +static void writedata(int f, report_desc_t r); -int -gotname(char *n) +static void +parceargs(report_desc_t r, int all, int nnames, char **names) { - int i; - - for (i = 0; i < nnames; i++) - if (strcmp(names[i], n) == 0) - return 1; - return 0; -} - -void -prbits(int bits, char **strs, int n) -{ - int i; - - for(i = 0; i < n; i++, bits >>= 1) - if (strs[i*2]) - printf("%s%s", i == 0 ? "" : ", ", strs[i*2 + (bits&1)]); + struct hid_data *d; + struct hid_item h; + char colls[1000]; + char hname[1000], *tmp1, *tmp2; + struct variable *var, **pnext; + int i, instance, cp, t; + + pnext = &vars; + if (all) { + if (wflag) + errx(1, "Must not specify -w to read variables"); + cp = 0; + for (d = hid_start_parse(r, + 1<name, "%s%s%s:%s", + colls, colls[0] != 0 ? "." : "", + hid_usage_page(HID_PAGE(h.usage)), + hid_usage_in_page(h.usage)); + var->h = h; + *pnext = var; + pnext = &var->next; + } + hid_end_parse(d); + return; + } + for (i = 0; i < nnames; i++) { + var = malloc(sizeof(*var)); + memset(var, 0, sizeof(*var)); + tmp1 = tmp2 = strdup(names[i]); + strsep(&tmp2, "="); + var->name = strsep(&tmp1, "#"); + if (tmp1 != NULL) + var->instance = atoi(tmp1); + if (tmp2 != NULL) { + if (!wflag) + errx(1, "Must specify -w to write variables"); + var->val = atoi(tmp2); + } else + if (wflag) + errx(1, "Must not specify -w to read variables"); + *pnext = var; + pnext = &var->next; + + instance = 0; + cp = 0; + for (d = hid_start_parse(r, + 1<name); + if (t > 0) { + if (strcmp(hname + t, var->name) != 0) + continue; + if (hname[t - 1] != '.') + continue; + } else if (strcmp(hname, var->name) != 0) + continue; + if (var->instance != instance++) + continue; + var->h = h; + break; + } + hid_end_parse(d); + if (var->h.usage == 0) + errx(1, "Unknown item '%s'", var->name); + } } -void +static void usage(void) { @@ -99,10 +195,14 @@ usage(void) " %s -f device " "[-l] [-n] [-r] [-t tablefile] [-v] [-x] -a\n", getprogname()); + fprintf(stderr, + " %s -f device " + "[-t tablefile] [-v] [-z] -w name=value\n", + getprogname()); exit(1); } -void +static void dumpitem(const char *label, struct hid_item *h) { if ((h->flags & HIO_CONST) && !verbose) @@ -141,7 +241,7 @@ hid_collection_type(int32_t type) return (num); } -void +static void dumpitems(report_desc_t r) { struct hid_data *d; @@ -181,23 +281,7 @@ dumpitems(report_desc_t r) printf("Total feature size %d bytes\n", size); } -void -rev(struct hid_item **p) -{ - struct hid_item *cur, *prev, *next; - - prev = 0; - cur = *p; - while(cur != 0) { - next = cur->next; - cur->next = prev; - prev = cur; - cur = next; - } - *p = prev; -} - -void +static void prdata(u_char *buf, struct hid_item *h) { u_int data; @@ -219,82 +303,162 @@ prdata(u_char *buf, struct hid_item *h) h->pos = pos; } -void +static void dumpdata(int f, report_desc_t rd, int loop) { - struct hid_data *d; - struct hid_item h, *hids, *n; - int r, dlen; + struct variable *var; + int dlen, havedata, i, match, r, rid, use_rid; u_char *dbuf; - u_int32_t colls[100]; - int sp = 0; - char namebuf[10000], *namep; - - hids = 0; - for (d = hid_start_parse(rd, 1<= 256) { + rid = 0; + kind++; + } + if (kind >= 3) + rid = -1; + for (var = vars; var; var = var->next) { + if (rid == var->h.report_ID && + kind == var->h.kind) + break; + } + if (var == NULL) + continue; + } + dlen = hid_report_size(rd, kind < 3 ? kind : hid_input, rid); + if (dlen <= 0) continue; - h.next = hids; - h.collection = colls[sp]; - hids = malloc(sizeof *hids); - *hids = h; - } - hid_end_parse(d); - rev(&hids); - dlen = hid_report_size(rd, hid_input, -1); - dbuf = malloc(dlen); - if (!loop) - if (hid_set_immed(f, 1) < 0) { - if (errno == EOPNOTSUPP) - warnx("device does not support immediate mode, only changes reported."); - else - err(1, "USB_SET_IMMED"); + dbuf = malloc(dlen); + memset(dbuf, 0, dlen); + if (kind < 3) { + dbuf[0] = rid; + r = hid_get_report(f, kind, dbuf, dlen); + if (r < 0) + warn("hid_get_report(rid %d)", rid); + havedata = !r && (rid == 0 || dbuf[0] == rid); + if (rid != 0) + dbuf[0] = rid; + } else { + r = read(f, dbuf, dlen); + if (r < 1) + err(1, "read error"); + havedata = 1; } - do { - r = read(f, dbuf, dlen); - if (r < 1) { - err(1, "read error"); + if (verbose) { + printf("Got %s report %d (%d bytes):", + kind == hid_output ? "output" : + kind == hid_feature ? "feature" : "input", + use_rid ? dbuf[0] : 0, dlen); + if (havedata) { + for (i = 0; i < dlen; i++) + printf(" %02x", dbuf[i]); + } + printf("\n"); } - for (n = hids; n; n = n->next) { - if (n->report_ID != 0 && dbuf[0] != n->report_ID) + match = 0; + for (var = vars; var; var = var->next) { + if ((kind < 3 ? kind : hid_input) != var->h.kind) continue; - namep = namebuf; - namep += sprintf(namep, "%s:%s.", - hid_usage_page(HID_PAGE(n->collection)), - hid_usage_in_page(n->collection)); - namep += sprintf(namep, "%s:%s", - hid_usage_page(HID_PAGE(n->usage)), - hid_usage_in_page(n->usage)); - if (all || gotname(namebuf)) { - if (!noname) - printf("%s=", namebuf); - prdata(dbuf, n); + if (var->h.report_ID != 0 && + dbuf[0] != var->h.report_ID) + continue; + match = 1; + if (!noname) + printf("%s=", var->name); + if (havedata) + prdata(dbuf, &var->h); + printf("\n"); + } + if (match) + printf("\n"); + free(dbuf); + } while (loop || kind < 3); +} + +static void +writedata(int f, report_desc_t rd) +{ + struct variable *var; + int dlen, i, r, rid; + u_char *dbuf; + enum hid_kind kind; + + kind = 0; + rid = 0; + for (kind = 0; kind < 3; kind ++) { + for (rid = 0; rid < 256; rid ++) { + for (var = vars; var; var = var->next) { + if (rid == var->h.report_ID && kind == var->h.kind) + break; + } + if (var == NULL) + continue; + dlen = hid_report_size(rd, kind, rid); + if (dlen <= 0) + continue; + dbuf = malloc(dlen); + memset(dbuf, 0, dlen); + dbuf[0] = rid; + if (!zflag && hid_get_report(f, kind, dbuf, dlen) == 0) { + if (verbose) { + printf("Got %s report %d (%d bytes):", + kind == hid_input ? "input" : + kind == hid_output ? "output" : "feature", + rid, dlen); + for (i = 0; i < dlen; i++) + printf(" %02x", dbuf[i]); printf("\n"); } + } else if (!zflag) { + warn("hid_get_report(rid %d)", rid); + if (verbose) { + printf("Can't get %s report %d (%d bytes). " + "Will be initialized with zeros.\n", + kind == hid_input ? "input" : + kind == hid_output ? "output" : "feature", + rid, dlen); + } } - if (loop) + for (var = vars; var; var = var->next) { + if (rid != var->h.report_ID || kind != var->h.kind) + continue; + hid_set_data(dbuf, &var->h, var->val); + } + if (verbose) { + printf("Setting %s report %d (%d bytes):", + kind == hid_output ? "output" : + kind == hid_feature ? "feature" : "input", + rid, dlen); + for (i = 0; i < dlen; i++) + printf(" %02x", dbuf[i]); printf("\n"); - } while (loop); - free(dbuf); + } + r = hid_set_report(f, kind, dbuf, dlen); + if (r != 0) + warn("hid_set_report(rid %d)", rid); + free(dbuf); + } + } } int main(int argc, char **argv) { - int f; report_desc_t r; - char devnam[100], *dev = 0; + char *table = 0; + char devnam[100], *dev = NULL; + int f; + int all = 0; int ch; int repdump = 0; int loop = 0; - char *table = 0; - while ((ch = getopt(argc, argv, "af:lnrt:vx")) != -1) { + while ((ch = getopt(argc, argv, "af:lnrt:vwxz")) != -1) { switch(ch) { case 'a': all++; @@ -317,9 +481,15 @@ main(int argc, char **argv) case 'v': verbose++; break; + case 'w': + wflag = 1; + break; case 'x': hexdump = 1; break; + case 'z': + zflag = 1; + break; case '?': default: usage(); @@ -327,12 +497,10 @@ main(int argc, char **argv) } argc -= optind; argv += optind; - if (dev == 0) + if (dev == NULL) usage(); - names = argv; - nnames = argc; - if (nnames == 0 && !all && !repdump) + if (argc == 0 && !all && !repdump) usage(); if (dev[0] != '/') { @@ -357,8 +525,13 @@ main(int argc, char **argv) printf("Report descriptor:\n"); dumpitems(r); } - if (nnames != 0 || all) - dumpdata(f, r, loop); + if (argc != 0 || all) { + parceargs(r, all, argc, argv); + if (wflag) + writedata(f, r); + else + dumpdata(f, r, loop); + } hid_dispose_report_desc(r); exit(0); Modified: stable/8/usr.bin/usbhidctl/usbhidctl.1 ============================================================================== --- stable/8/usr.bin/usbhidctl/usbhidctl.1 Tue Jan 3 13:13:31 2012 (r229388) +++ stable/8/usr.bin/usbhidctl/usbhidctl.1 Tue Jan 3 13:16:47 2012 (r229389) @@ -35,7 +35,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd November 23, 2006 +.Dd August 01, 2011 .Dt USBHIDCTL 1 .Os .Sh NAME @@ -43,27 +43,51 @@ .Nd manipulate USB HID devices .Sh SYNOPSIS .Nm -.Op Fl a .Fl f Ar device +.Op Fl t Ar table +.Op Fl v +.Op Fl x +.Fl r +.Nm +.Fl f Ar device +.Op Fl t Ar table .Op Fl l -.Op Fl n -.Op Fl r +.Op Fl v +.Op Fl x +.Fl a +.Nm +.Fl f Ar device .Op Fl t Ar table +.Op Fl l +.Op Fl n .Op Fl v .Op Fl x -.Op Ar item ... +.Ar item ... +.Nm +.Fl f Ar device +.Op Fl t Ar table +.Op Fl v +.Op Fl z +.Fl w +.Ar item=value ... .Sh DESCRIPTION The .Nm -utility can be used to dump the state of a USB HID (Human Interface Device). +utility can be used to dump and modify the state of a USB HID (Human +Interface Device). Each named .Ar item is printed. +If the +.Fl w +flag is specified +.Nm +attempts to set the specified items to the given values. .Pp The options are as follows: .Bl -tag -width Ds .It Fl a -Show all items. +Show all items and their current values if device returns. .It Fl f Ar device Specify a path name for the device to operate on. .It Fl l @@ -76,9 +100,47 @@ Dump the report descriptor. Specify a path name for the HID usage table file. .It Fl v Be verbose. +.It Fl w +Change item values. +Only 'output' and 'feature' kinds can be set with this option. .It Fl x Dump data in hexadecimal as well as decimal. +.It Fl z +Reset reports to zero before processing +.Fl w +arguments. If not specified, current values will be requested from device. .El +.Sh SYNTAX +.Nm +compares the names of items specified on the command line against the human +interface items reported by the USB device. +Each human interface item is mapped from its native form to a human readable +name, using the HID usage table file. +Command line items are compared with the generated item names, +and the USB HID device is operated on when a match is found. +.Pp +Each human interface item is named by the +.Qq page +it appears in, the +.Qq usage +within that page, and the list of +.Qq collections +containing the item. +Each collection in turn is also identified by page, and +the usage within that page. +.Pp +On the +.Nm +command line the page name is separated from the usage name with the character +.Sq Cm \&: . +The collections are separated by the character +.Sq Cm \&. . +.Pp +Some devices give the same name to more than one item. +.Nm +supports isolating each item by appending a +.Sq Cm \&# . +character and a decimal item instance number, starting at zero. .Sh FILES .Pa /usr/share/misc/usb_hid_usages The default HID usage table. @@ -91,7 +153,3 @@ The .Nm command appeared in .Nx 1.4 . -.Sh BUGS -The -.Nm -utility cannot show nor set output and feature items. From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 15:49:36 2012 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 8141A1065676; Tue, 3 Jan 2012 15:49:36 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail09.syd.optusnet.com.au (mail09.syd.optusnet.com.au [211.29.132.190]) by mx1.freebsd.org (Postfix) with ESMTP id 1C26D8FC14; Tue, 3 Jan 2012 15:49:35 +0000 (UTC) Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au (c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136]) by mail09.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q03FnWVf026382 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 4 Jan 2012 02:49:33 +1100 Date: Wed, 4 Jan 2012 02:49:32 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Ed Schouten In-Reply-To: <201201030714.q037E2qq010125@svn.freebsd.org> Message-ID: <20120104013401.S6960@besplex.bde.org> References: <201201030714.q037E2qq010125@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r229368 - in head: lib/libc lib/libc/arm/string lib/libc/i386/string lib/libc/mips/string lib/libc/string lib/libstand sys/boot/userboot/libstand 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, 03 Jan 2012 15:49:36 -0000 On Tue, 3 Jan 2012, Ed Schouten wrote: > Log: > Merge index() and strchr() together. > > As I looked through the C library, I noticed the FreeBSD MIPS port has a > hand-written version of index(). This is nice, if it weren't for the > fact that most applications call strchr() instead. > > Also, on the other architectures index() and strchr() are identical, > meaning we have two identical pieces of code in the C library and > statically linked applications. Only in statically linked applications that used both, since they weren't actually identical -- they were intentionally put in separate object files to avoid this problem. (In asm, you don't need symbol magic to declare strong aliases, but just use 2 .globl labels together. But this is usually wrong since it doesn't keep things separate enough. Some files use #include to implement the multiple copies. For example, amd64 and i386 don't bother optimizing memcpy() over memmove(), but make it a copy in a separate file. The i386 index.S and strchr.S were not so good -- they duplicated the code.) > Solve this by naming the actual file strchr.[cS] and let it use > __strong_reference()/STRONG_ALIAS() to provide the index() routine. Do > the same for rindex()/strrchr(). This breaks the Standard C namespace. When they are in the same object file, there is no way to get the standard name without getting the nonstandard name. So the following C-standard-conforming C program now gets a linkage error (multiple definition of `index'), at least with static linkage: #include int index; void foo(const char *p) { return strchr(p, '1'); } When they were in separate object files, the nonstandard name just added to the general pollution in the libc runtime in a way that doesn't seem to cause any problems in practice, since it is orthogonal to any uses of the name in a conforming application. We mostly use weak references in libraries, to avoid problems like this. In libc, there were just 2 __strong_reference()s and 111 __weak_reference()s. One of the oldest weak references is from __vfscanf to vfscanf. This is used to implement a bug in C90: C90 doesn't have vfscanf, so it must not be in libc in a way that conflicts with any application symbol named vfscanf. libc needs vfscanf's functionality internally, and doesn't want to duplicate the whole thing. So it puts the functionality in __vfscanf and always uses that internally, and provides the duplication solely as a weak symbol. The symbol remains weak, and C90 remains sort of supported, although the bug is fixed in C99 (it has vfscanf). There are also _many_ (but not nearly all?) POSIX symbols that are handled as weak references. Internally, they have names like _open and weak symbols like `open' (for some reason, both _open and `open' are shown by nm as weak). These are implemented more magically using include/*namespace.h and macros in asm files. I got the count of 111 by grepping for the C macro. This missed all the asm macros. Grepping for ' W ' in libc.a shows 1024 weak references. That's almost 30% of all symbols (there are 2195 ' T ' symbols). nm doesn't seem to provide a way to show what the symbols are aliases for. It is worse for strong symbols (shows them both as ' T '). > > This seems to make the C libraries and static binaries slightly smaller, > but this reduction in size seems negligible. Duplication of the object file (except for the global symbols) is best, and may be required, even for the example of memcpy being identical to memmove given above. It is useful to be able to put a breakpoint at memcpy without having it trigger when memmove is called, and the C standard might require memcpy and memmove to have different addresses. Similarly for profiling. You want logically different functions to have different addresses. I wonder if gprof knows enough about symbols to prefer strchr over index if they are strong aliases for each other. Bruce From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 15:53:32 2012 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 9C228106566C; Tue, 3 Jan 2012 15:53:32 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 371E28FC0C; Tue, 3 Jan 2012 15:53:31 +0000 (UTC) Received: from localhost (58.wheelsystems.com [83.12.187.58]) by mail.dawidek.net (Postfix) with ESMTPSA id 02C45700; Tue, 3 Jan 2012 16:53:28 +0100 (CET) Date: Tue, 3 Jan 2012 16:52:21 +0100 From: Pawel Jakub Dawidek To: Ed Schouten Message-ID: <20120103155221.GB1663@garage.freebsd.pl> References: <201201012026.q01KQBS5029156@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="yEPQxsgoJgBvi8ip" Content-Disposition: inline In-Reply-To: <201201012026.q01KQBS5029156@svn.freebsd.org> X-OS: FreeBSD 9.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r229198 - in head: share/man/man9 sys/conf sys/libkern sys/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: Tue, 03 Jan 2012 15:53:32 -0000 --yEPQxsgoJgBvi8ip Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Jan 01, 2012 at 08:26:11PM +0000, Ed Schouten wrote: > Author: ed > Date: Sun Jan 1 20:26:11 2012 > New Revision: 229198 > URL: http://svn.freebsd.org/changeset/base/229198 >=20 > Log: > Introducing memcchr(3). > =20 > It seems two of the file system drivers we have in the tree, namely ufs > and ext3, use a function called `skpc()'. The meaning of this function > does not seem to be documented in FreeBSD, but it turns out one needs to > be a VAX programmer to understand what it does. > =20 > SPKC is an instruction on the VAX that does the opposite of memchr(). It > searches for the non-equal character. Add a new function called > memcchr() to the tree that has the following advantages over skpc(): > =20 > - It has a name that makes more sense than skpc(). Just like strcspn() > matches the complement of strspn(), memcchr() is the complement of > memchr(). > =20 > - It is faster than skpc(). Similar to our strlen() in libc, it compares > entire words, instead of single bytes. It seems that for this routine > this yields a sixfold performance increase on amd64. > =20 > - It has a man page. >=20 > Added: > head/share/man/man9/memcchr.3 (contents, props changed) Shouldn't this be memcchr.9? --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://yomoli.com --yEPQxsgoJgBvi8ip Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAk8DJDUACgkQForvXbEpPzSUlgCfRU8b0la4rX2k3GmkU+uBsj5q 14UAoLti0y6TJbXigPmK7JWM6Xu4V28Z =Czu1 -----END PGP SIGNATURE----- --yEPQxsgoJgBvi8ip-- From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 16:22:29 2012 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 D7C4C106564A; Tue, 3 Jan 2012 16:22:29 +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 C66848FC13; Tue, 3 Jan 2012 16:22: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 q03GMTpi031426; Tue, 3 Jan 2012 16:22:29 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03GMTIs031422; Tue, 3 Jan 2012 16:22:29 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201031622.q03GMTIs031422@svn.freebsd.org> From: John Baldwin Date: Tue, 3 Jan 2012 16:22: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: r229390 - in head/sys: netinet netinet6 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, 03 Jan 2012 16:22:29 -0000 Author: jhb Date: Tue Jan 3 16:22:29 2012 New Revision: 229390 URL: http://svn.freebsd.org/changeset/base/229390 Log: Use TAILQ_FOREACH() instead of TAILQ_FOREACH_SAFE() for some loops that do not modify the queues they iterate over. Submitted by: glebius Modified: head/sys/netinet/igmp.c head/sys/netinet6/in6.c head/sys/netinet6/mld6.c Modified: head/sys/netinet/igmp.c ============================================================================== --- head/sys/netinet/igmp.c Tue Jan 3 13:16:47 2012 (r229389) +++ head/sys/netinet/igmp.c Tue Jan 3 16:22:29 2012 (r229390) @@ -1642,7 +1642,7 @@ igmp_fasttimo_vnet(void) struct ifqueue qrq; /* Query response packets */ struct ifnet *ifp; struct igmp_ifinfo *igi; - struct ifmultiaddr *ifma, *tifma; + struct ifmultiaddr *ifma; struct in_multi *inm; int loop, uri_fasthz; @@ -1709,8 +1709,7 @@ igmp_fasttimo_vnet(void) } IF_ADDR_LOCK(ifp); - TAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, - tifma) { + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) continue; @@ -3321,7 +3320,7 @@ igmp_v3_merge_state_changes(struct in_mu static void igmp_v3_dispatch_general_query(struct igmp_ifinfo *igi) { - struct ifmultiaddr *ifma, *tifma; + struct ifmultiaddr *ifma; struct ifnet *ifp; struct in_multi *inm; int retval, loop; @@ -3335,7 +3334,7 @@ igmp_v3_dispatch_general_query(struct ig ifp = igi->igi_ifp; IF_ADDR_LOCK(ifp); - TAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, tifma) { + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) continue; Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Tue Jan 3 13:16:47 2012 (r229389) +++ head/sys/netinet6/in6.c Tue Jan 3 16:22:29 2012 (r229390) @@ -1325,7 +1325,7 @@ in6_purgeaddr(struct ifaddr *ifa) struct sockaddr_in6 mltaddr, mltmask; int plen, error; struct rtentry *rt; - struct ifaddr *ifa0, *nifa; + struct ifaddr *ifa0; if (ifa->ifa_carp) (*carp_detach_p)(ifa); @@ -1336,7 +1336,7 @@ in6_purgeaddr(struct ifaddr *ifa) * address routes */ IF_ADDR_LOCK(ifp); - TAILQ_FOREACH_SAFE(ifa0, &ifp->if_addrhead, ifa_link, nifa) { + TAILQ_FOREACH(ifa0, &ifp->if_addrhead, ifa_link) { if ((ifa0->ifa_addr->sa_family != AF_INET6) || memcmp(&satosin6(ifa0->ifa_addr)->sin6_addr, &ia->ia_addr.sin6_addr, Modified: head/sys/netinet6/mld6.c ============================================================================== --- head/sys/netinet6/mld6.c Tue Jan 3 13:16:47 2012 (r229389) +++ head/sys/netinet6/mld6.c Tue Jan 3 16:22:29 2012 (r229390) @@ -2976,7 +2976,7 @@ mld_v2_merge_state_changes(struct in6_mu static void mld_v2_dispatch_general_query(struct mld_ifinfo *mli) { - struct ifmultiaddr *ifma, *tifma; + struct ifmultiaddr *ifma; struct ifnet *ifp; struct in6_multi *inm; int retval; @@ -2990,7 +2990,7 @@ mld_v2_dispatch_general_query(struct mld ifp = mli->mli_ifp; IF_ADDR_LOCK(ifp); - TAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, tifma) { + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET6 || ifma->ifma_protospec == NULL) continue; From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 16:23:49 2012 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 7F8801065670; Tue, 3 Jan 2012 16:23:49 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 5348A8FC17; Tue, 3 Jan 2012 16:23:49 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id 0B08C46B0A; Tue, 3 Jan 2012 11:23:49 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 97026B95D; Tue, 3 Jan 2012 11:23:48 -0500 (EST) From: John Baldwin To: =?utf-8?q?G=C3=A1bor_K=C3=B6vesd=C3=A1n?= Date: Tue, 3 Jan 2012 09:29:30 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p8; KDE/4.5.5; amd64; ; ) References: <201112311312.pBVDCBja064475@svn.freebsd.org> <20111231140027.GA3487@reks> <4EFF16E0.7000206@t-hosting.hu> In-Reply-To: <4EFF16E0.7000206@t-hosting.hu> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <201201030929.30656.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 03 Jan 2012 11:23:48 -0500 (EST) Cc: Gleb Kurtsou , src-committers@freebsd.org, svn-src-stable@freebsd.org, svn-src-all@freebsd.org, svn-src-stable-9@freebsd.org, Gabor Kovesdan Subject: Re: svn commit: r229081 - stable/9/usr.bin/grep 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, 03 Jan 2012 16:23:49 -0000 On Saturday, December 31, 2011 9:06:24 am G=C3=A1bor K=C3=B6vesd=C3=A1n wro= te: > On 2011.12.31. 15:00, Gleb Kurtsou wrote: > >> ${BINDIR}/grep ${BINDIR}/fgrep \ > >> > ${BINDIR}/grep ${BINDIR}/zgrep \ > >> > ${BINDIR}/grep ${BINDIR}/zegrep \ > >> > - ${BINDIR}/grep ${BINDIR}/zfgrep \ > >> > - ${BINDIR}/grep ${BINDIR}/xzgrep \ > >> > - ${BINDIR}/grep ${BINDIR}/xzegrep \ > >> > - ${BINDIR}/grep ${BINDIR}/xzfgrep \ > >> > - ${BINDIR}/grep ${BINDIR}/lzgrep \ > >> > - ${BINDIR}/grep ${BINDIR}/lzegrep \ > >> > - ${BINDIR}/grep ${BINDIR}/lzfgrep > >> > + ${BINDIR}/grep ${BINDIR}/zfgrep > > Is there a reason we need all this mess is the first place? 12 grep lin= ks=20 under > > /usr/bin. Why not to make zgrep handle all compression types. Tranparent > > compression handling in tar was a great success. > > > 1, xzgrep comes from archivers/xz so scripts may be using it > 2, the rest to follow the naming convention > 3, auto-detection is not always trivial Presumably the auto-detection is more trivial than that in tar that handles= =20 the combination of various archive formats and various compression formats.= I=20 would definitely prefer to have a single "smart" zgrep that DTRT. =2D-=20 John Baldwin From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 16:32:34 2012 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 10A54106566B; Tue, 3 Jan 2012 16:32:34 +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 F27738FC14; Tue, 3 Jan 2012 16:32:33 +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 q03GWXqS031764; Tue, 3 Jan 2012 16:32:33 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03GWXPv031762; Tue, 3 Jan 2012 16:32:33 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201201031632.q03GWXPv031762@svn.freebsd.org> From: Rick Macklem Date: Tue, 3 Jan 2012 16:32:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229391 - stable/9/sys/nfsclient 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, 03 Jan 2012 16:32:34 -0000 Author: rmacklem Date: Tue Jan 3 16:32:33 2012 New Revision: 229391 URL: http://svn.freebsd.org/changeset/base/229391 Log: MFC: r227690 The old NFS client will crash due to the reply being m_freem()'d twice if the server bogusly returns an error with the NFSERR_RETERR bit (bit 31) set. No actual NFS error has this bit set, but it seems that amd will sometimes do this. This patch makes sure the NFSERR_RETERR bit is cleared to avoid a crash. Modified: stable/9/sys/nfsclient/nfs_krpc.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/nfsclient/nfs_krpc.c ============================================================================== --- stable/9/sys/nfsclient/nfs_krpc.c Tue Jan 3 16:22:29 2012 (r229390) +++ stable/9/sys/nfsclient/nfs_krpc.c Tue Jan 3 16:32:33 2012 (r229391) @@ -540,6 +540,11 @@ tryagain: hz); goto tryagain; } + /* + * Make sure NFSERR_RETERR isn't bogusly set by a server + * such as amd. (No actual NFS error has bit 31 set.) + */ + error &= ~NFSERR_RETERR; /* * If the File Handle was stale, invalidate the lookup From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 16:35:00 2012 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 C595A106566C; Tue, 3 Jan 2012 16:35:00 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B1F3D8FC17; Tue, 3 Jan 2012 16:35: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 q03GZ0Bs031908; Tue, 3 Jan 2012 16:35:00 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03GZ0pE031895; Tue, 3 Jan 2012 16:35:00 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201201031635.q03GZ0pE031895@svn.freebsd.org> From: Fabien Thomas Date: Tue, 3 Jan 2012 16:35:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229392 - in stable/9: lib/libpmc sys/dev/hwpmc sys/sys usr.sbin/pmcstat 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, 03 Jan 2012 16:35:00 -0000 Author: fabient Date: Tue Jan 3 16:35:00 2012 New Revision: 229392 URL: http://svn.freebsd.org/changeset/base/229392 Log: MFC r226514,r226526,r226986: Add a flush of the current PMC log buffer before displaying the next top. As the underlying block is 4KB if the PMC throughput is low the measurement will be reported on the next tick. pmcstat(8) use the modified flush API to reclaim current buffer before displaying next top. Modified: stable/9/lib/libpmc/libpmc.c stable/9/lib/libpmc/pmc.3 stable/9/lib/libpmc/pmc.h stable/9/lib/libpmc/pmc_configure_logfile.3 stable/9/sys/dev/hwpmc/hwpmc_logging.c stable/9/sys/dev/hwpmc/hwpmc_mod.c stable/9/sys/sys/pmc.h stable/9/sys/sys/pmclog.h stable/9/usr.sbin/pmcstat/pmcstat.c stable/9/usr.sbin/pmcstat/pmcstat_log.c Directory Properties: stable/9/lib/libpmc/ (props changed) stable/9/sys/ (props changed) stable/9/usr.sbin/pmcstat/ (props changed) Modified: stable/9/lib/libpmc/libpmc.c ============================================================================== --- stable/9/lib/libpmc/libpmc.c Tue Jan 3 16:32:33 2012 (r229391) +++ stable/9/lib/libpmc/libpmc.c Tue Jan 3 16:35:00 2012 (r229392) @@ -2596,6 +2596,12 @@ pmc_flush_logfile(void) } int +pmc_close_logfile(void) +{ + return (PMC_CALL(CLOSELOG,0)); +} + +int pmc_get_driver_stats(struct pmc_driverstats *ds) { struct pmc_op_getdriverstats gms; Modified: stable/9/lib/libpmc/pmc.3 ============================================================================== --- stable/9/lib/libpmc/pmc.3 Tue Jan 3 16:32:33 2012 (r229391) +++ stable/9/lib/libpmc/pmc.3 Tue Jan 3 16:35:00 2012 (r229392) @@ -322,6 +322,10 @@ to write logged events to. Flush all pending log data in .Xr hwpmc 4 Ns Ap s buffers. +.It Fn pmc_close_logfile +Flush all pending log data and close +.Xr hwpmc 4 Ns Ap s +side of the stream. .It Fn pmc_writelog Append arbitrary user data to the current log file. .El Modified: stable/9/lib/libpmc/pmc.h ============================================================================== --- stable/9/lib/libpmc/pmc.h Tue Jan 3 16:32:33 2012 (r229391) +++ stable/9/lib/libpmc/pmc.h Tue Jan 3 16:35:00 2012 (r229392) @@ -76,6 +76,7 @@ int pmc_attach(pmc_id_t _pmcid, pid_t _p int pmc_capabilities(pmc_id_t _pmc, uint32_t *_caps); int pmc_configure_logfile(int _fd); int pmc_flush_logfile(void); +int pmc_close_logfile(void); int pmc_detach(pmc_id_t _pmcid, pid_t _pid); int pmc_disable(int _cpu, int _pmc); int pmc_enable(int _cpu, int _pmc); Modified: stable/9/lib/libpmc/pmc_configure_logfile.3 ============================================================================== --- stable/9/lib/libpmc/pmc_configure_logfile.3 Tue Jan 3 16:32:33 2012 (r229391) +++ stable/9/lib/libpmc/pmc_configure_logfile.3 Tue Jan 3 16:35:00 2012 (r229392) @@ -29,7 +29,8 @@ .Sh NAME .Nm pmc_configure_logfile , .Nm pmc_flush_logfile , -.Nm pmc_writelog +.Nm pmc_writelog , +.Nm pmc_close_logfile .Nd log file management .Sh LIBRARY .Lb libpmc @@ -41,6 +42,8 @@ .Fn pmc_flush_logfile void .Ft int .Fn pmc_writelog "uint32_t userdata" +.Ft int +.Fn pmc_close_logfile void .Sh DESCRIPTION The functions manage logging of .Xr hwpmc 4 @@ -72,6 +75,12 @@ Function will append a log entry containing the value of argument .Fa userdata to the log file. +.Pp +Function +.Fn pmc_close_logfile +will flush all pending log data and close +.Xr hwpmc 4 Ns Ap s +side of the stream. .Sh RETURN VALUES .Rv -std .Sh ERRORS Modified: stable/9/sys/dev/hwpmc/hwpmc_logging.c ============================================================================== --- stable/9/sys/dev/hwpmc/hwpmc_logging.c Tue Jan 3 16:32:33 2012 (r229391) +++ stable/9/sys/dev/hwpmc/hwpmc_logging.c Tue Jan 3 16:35:00 2012 (r229392) @@ -238,7 +238,7 @@ pmclog_get_buffer(struct pmc_owner *po) static void pmclog_loop(void *arg) { - int error, last_buffer; + int error; struct pmc_owner *po; struct pmclog_buffer *lb; struct proc *p; @@ -253,7 +253,6 @@ pmclog_loop(void *arg) p = po->po_owner; td = curthread; mycred = td->td_ucred; - last_buffer = 0; PROC_LOCK(p); ownercred = crhold(p->p_ucred); @@ -286,14 +285,22 @@ pmclog_loop(void *arg) if ((lb = TAILQ_FIRST(&po->po_logbuffers)) == NULL) { mtx_unlock_spin(&po->po_mtx); + if (po->po_flags & PMC_PO_SHUTDOWN) { + mtx_unlock(&pmc_kthread_mtx); + /* + * Close the file to get PMCLOG_EOF + * error in pmclog(3). + */ + fo_close(po->po_file, curthread); + mtx_lock(&pmc_kthread_mtx); + } + (void) msleep(po, &pmc_kthread_mtx, PWAIT, "pmcloop", 0); continue; } TAILQ_REMOVE(&po->po_logbuffers, lb, plb_next); - if (po->po_flags & PMC_PO_SHUTDOWN) - last_buffer = TAILQ_EMPTY(&po->po_logbuffers); mtx_unlock_spin(&po->po_mtx); } @@ -336,14 +343,6 @@ pmclog_loop(void *arg) break; } - if (last_buffer) { - /* - * Close the file to get PMCLOG_EOF error - * in pmclog(3). - */ - fo_close(po->po_file, curthread); - } - mtx_lock(&pmc_kthread_mtx); /* put the used buffer back into the global pool */ @@ -693,6 +692,7 @@ int pmclog_flush(struct pmc_owner *po) { int error; + struct pmclog_buffer *lb; PMCDBG(LOG,FLS,1, "po=%p", po); @@ -715,11 +715,38 @@ pmclog_flush(struct pmc_owner *po) } /* - * Schedule the current buffer if any. + * Schedule the current buffer if any and not empty. + */ + mtx_lock_spin(&po->po_mtx); + lb = po->po_curbuf; + if (lb && lb->plb_ptr != lb->plb_base) { + pmclog_schedule_io(po); + } else + error = ENOBUFS; + mtx_unlock_spin(&po->po_mtx); + + error: + mtx_unlock(&pmc_kthread_mtx); + + return (error); +} + +int +pmclog_close(struct pmc_owner *po) +{ + + PMCDBG(LOG,CLO,1, "po=%p", po); + + mtx_lock(&pmc_kthread_mtx); + + /* + * Schedule the current buffer. */ mtx_lock_spin(&po->po_mtx); if (po->po_curbuf) pmclog_schedule_io(po); + else + wakeup_one(po); mtx_unlock_spin(&po->po_mtx); /* @@ -728,13 +755,11 @@ pmclog_flush(struct pmc_owner *po) */ po->po_flags |= PMC_PO_SHUTDOWN; - error: mtx_unlock(&pmc_kthread_mtx); - return (error); + return (0); } - void pmclog_process_callchain(struct pmc *pm, struct pmc_sample *ps) { Modified: stable/9/sys/dev/hwpmc/hwpmc_mod.c ============================================================================== --- stable/9/sys/dev/hwpmc/hwpmc_mod.c Tue Jan 3 16:32:33 2012 (r229391) +++ stable/9/sys/dev/hwpmc/hwpmc_mod.c Tue Jan 3 16:35:00 2012 (r229392) @@ -2891,7 +2891,7 @@ pmc_syscall_handler(struct thread *td, v error = pmclog_configure_log(md, po, cl.pm_logfd); } else if (po->po_flags & PMC_PO_OWNS_LOGFILE) { pmclog_process_closelog(po); - error = pmclog_flush(po); + error = pmclog_close(po); if (error == 0) { LIST_FOREACH(pm, &po->po_pmcs, pm_next) if (pm->pm_flags & PMC_F_NEEDS_LOGFILE && @@ -2907,7 +2907,6 @@ pmc_syscall_handler(struct thread *td, v } break; - /* * Flush a log file. */ @@ -2928,6 +2927,25 @@ pmc_syscall_handler(struct thread *td, v break; /* + * Close a log file. + */ + + case PMC_OP_CLOSELOG: + { + struct pmc_owner *po; + + sx_assert(&pmc_sx, SX_XLOCKED); + + if ((po = pmc_find_owner_descriptor(td->td_proc)) == NULL) { + error = EINVAL; + break; + } + + error = pmclog_close(po); + } + break; + + /* * Retrieve hardware configuration. */ Modified: stable/9/sys/sys/pmc.h ============================================================================== --- stable/9/sys/sys/pmc.h Tue Jan 3 16:32:33 2012 (r229391) +++ stable/9/sys/sys/pmc.h Tue Jan 3 16:35:00 2012 (r229392) @@ -302,7 +302,8 @@ enum pmc_event { __PMC_OP(PMCSETCOUNT, "Set initial count/sampling rate") \ __PMC_OP(PMCSTART, "Start a PMC") \ __PMC_OP(PMCSTOP, "Stop a PMC") \ - __PMC_OP(WRITELOG, "Write a cookie to the log file") + __PMC_OP(WRITELOG, "Write a cookie to the log file") \ + __PMC_OP(CLOSELOG, "Close log file") enum pmc_ops { @@ -1039,6 +1040,7 @@ extern struct pmc_debugflags pmc_debugfl #define PMC_DEBUG_MIN_SIO 9 /* schedule i/o */ #define PMC_DEBUG_MIN_FLS 10 /* flush */ #define PMC_DEBUG_MIN_SAM 11 /* sample */ +#define PMC_DEBUG_MIN_CLO 12 /* close */ #else #define PMCDBG(M,N,L,F,...) /* nothing */ Modified: stable/9/sys/sys/pmclog.h ============================================================================== --- stable/9/sys/sys/pmclog.h Tue Jan 3 16:32:33 2012 (r229391) +++ stable/9/sys/sys/pmclog.h Tue Jan 3 16:35:00 2012 (r229392) @@ -243,6 +243,7 @@ int pmclog_configure_log(struct pmc_mdep int _logfd); int pmclog_deconfigure_log(struct pmc_owner *_po); int pmclog_flush(struct pmc_owner *_po); +int pmclog_close(struct pmc_owner *_po); void pmclog_initialize(void); void pmclog_process_callchain(struct pmc *_pm, struct pmc_sample *_ps); void pmclog_process_closelog(struct pmc_owner *po); Modified: stable/9/usr.sbin/pmcstat/pmcstat.c ============================================================================== --- stable/9/usr.sbin/pmcstat/pmcstat.c Tue Jan 3 16:32:33 2012 (r229391) +++ stable/9/usr.sbin/pmcstat/pmcstat.c Tue Jan 3 16:35:00 2012 (r229392) @@ -552,7 +552,7 @@ main(int argc, char **argv) int hcpu, option, npmc, ncpu; int c, check_driver_stats, current_cpu, current_sampling_count; int do_callchain, do_descendants, do_logproccsw, do_logprocexit; - int do_print; + int do_print, do_read; size_t dummy; int graphdepth; int pipefd[2], rfd; @@ -1328,7 +1328,7 @@ main(int argc, char **argv) * are killed by a SIGINT. */ runstate = PMCSTAT_RUNNING; - do_print = 0; + do_print = do_read = 0; do { if ((c = kevent(pmcstat_kq, NULL, 0, &kev, 1, NULL)) <= 0) { if (errno != EINTR) @@ -1351,8 +1351,10 @@ main(int argc, char **argv) (args.pa_flags & FLAG_DO_TOP)) { if (pmcstat_keypress_log()) runstate = pmcstat_close_log(); - } else + } else { + do_read = 0; runstate = pmcstat_process_log(); + } break; case EVFILT_SIGNAL: @@ -1377,9 +1379,6 @@ main(int argc, char **argv) /* Kill the child process if we started it */ if (args.pa_flags & FLAG_HAS_COMMANDLINE) pmcstat_kill_process(); - /* Close the pipe to self, if present. */ - if (args.pa_flags & FLAG_HAS_PIPE) - (void) close(pipefd[READPIPEFD]); runstate = pmcstat_close_log(); } else if (kev.ident == SIGWINCH) { if (ioctl(fileno(args.pa_printfile), @@ -1394,12 +1393,15 @@ main(int argc, char **argv) break; case EVFILT_TIMER: /* print out counting PMCs */ + if ((args.pa_flags & FLAG_DO_TOP) && + pmc_flush_logfile() != ENOBUFS) + do_read = 1; do_print = 1; break; } - if (do_print) { + if (do_print && !do_read) { if ((args.pa_required & FLAG_HAS_OUTPUT_LOGFILE) == 0) { pmcstat_print_pmcs(); if (runstate == PMCSTAT_FINISHED && /* final newline */ @@ -1420,7 +1422,7 @@ main(int argc, char **argv) /* flush any pending log entries */ if (args.pa_flags & (FLAG_HAS_OUTPUT_LOGFILE | FLAG_HAS_PIPE)) - pmc_flush_logfile(); + pmc_close_logfile(); pmcstat_cleanup(); Modified: stable/9/usr.sbin/pmcstat/pmcstat_log.c ============================================================================== --- stable/9/usr.sbin/pmcstat/pmcstat_log.c Tue Jan 3 16:32:33 2012 (r229391) +++ stable/9/usr.sbin/pmcstat/pmcstat_log.c Tue Jan 3 16:35:00 2012 (r229392) @@ -1702,7 +1702,7 @@ pmcstat_close_log(void) * so keep the status to EXITING. */ if (args.pa_logfd != -1) { - if (pmc_flush_logfile() < 0) + if (pmc_close_logfile() < 0) err(EX_OSERR, "ERROR: logging failed"); } From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 16:41:38 2012 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 B526A106566B; Tue, 3 Jan 2012 16:41:38 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A36C58FC08; Tue, 3 Jan 2012 16:41: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 q03GfciA032211; Tue, 3 Jan 2012 16:41:38 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03GfcX3032209; Tue, 3 Jan 2012 16:41:38 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201201031641.q03GfcX3032209@svn.freebsd.org> From: Fabien Thomas Date: Tue, 3 Jan 2012 16:41:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229393 - stable/9/sys/dev/hwpmc 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, 03 Jan 2012 16:41:38 -0000 Author: fabient Date: Tue Jan 3 16:41:38 2012 New Revision: 229393 URL: http://svn.freebsd.org/changeset/base/229393 Log: MFC r228198: Update Westmere uncore event exception list. Modified: stable/9/sys/dev/hwpmc/hwpmc_core.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/hwpmc/hwpmc_core.c ============================================================================== --- stable/9/sys/dev/hwpmc/hwpmc_core.c Tue Jan 3 16:35:00 2012 (r229392) +++ stable/9/sys/dev/hwpmc/hwpmc_core.c Tue Jan 3 16:41:38 2012 (r229393) @@ -1479,6 +1479,10 @@ iap_event_westmere_ok_on_counter(enum pm /* * Events valid only on counter 0. */ + case PMC_EV_IAP_EVENT_60H_01H: + case PMC_EV_IAP_EVENT_60H_02H: + case PMC_EV_IAP_EVENT_60H_04H: + case PMC_EV_IAP_EVENT_60H_08H: case PMC_EV_IAP_EVENT_B3H_01H: case PMC_EV_IAP_EVENT_B3H_02H: case PMC_EV_IAP_EVENT_B3H_04H: @@ -1488,6 +1492,10 @@ iap_event_westmere_ok_on_counter(enum pm /* * Events valid only on counter 0, 1. */ + case PMC_EV_IAP_EVENT_4CH_01H: + case PMC_EV_IAP_EVENT_4EH_01H: + case PMC_EV_IAP_EVENT_4EH_02H: + case PMC_EV_IAP_EVENT_4EH_04H: case PMC_EV_IAP_EVENT_51H_01H: case PMC_EV_IAP_EVENT_51H_02H: case PMC_EV_IAP_EVENT_51H_04H: From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 16:54:48 2012 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 68E6E106564A; Tue, 3 Jan 2012 16:54:48 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 56FB68FC17; Tue, 3 Jan 2012 16:54:48 +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 q03GsmBo032704; Tue, 3 Jan 2012 16:54:48 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03Gsmbn032702; Tue, 3 Jan 2012 16:54:48 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201201031654.q03Gsmbn032702@svn.freebsd.org> From: Fabien Thomas Date: Tue, 3 Jan 2012 16:54:48 +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: r229394 - stable/8/sys/dev/hwpmc 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, 03 Jan 2012 16:54:48 -0000 Author: fabient Date: Tue Jan 3 16:54:47 2012 New Revision: 229394 URL: http://svn.freebsd.org/changeset/base/229394 Log: MFC r228198: Update Westmere uncore event exception list. Modified: stable/8/sys/dev/hwpmc/hwpmc_core.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/hwpmc/hwpmc_core.c ============================================================================== --- stable/8/sys/dev/hwpmc/hwpmc_core.c Tue Jan 3 16:41:38 2012 (r229393) +++ stable/8/sys/dev/hwpmc/hwpmc_core.c Tue Jan 3 16:54:47 2012 (r229394) @@ -1479,6 +1479,10 @@ iap_event_westmere_ok_on_counter(enum pm /* * Events valid only on counter 0. */ + case PMC_EV_IAP_EVENT_60H_01H: + case PMC_EV_IAP_EVENT_60H_02H: + case PMC_EV_IAP_EVENT_60H_04H: + case PMC_EV_IAP_EVENT_60H_08H: case PMC_EV_IAP_EVENT_B3H_01H: case PMC_EV_IAP_EVENT_B3H_02H: case PMC_EV_IAP_EVENT_B3H_04H: @@ -1488,6 +1492,10 @@ iap_event_westmere_ok_on_counter(enum pm /* * Events valid only on counter 0, 1. */ + case PMC_EV_IAP_EVENT_4CH_01H: + case PMC_EV_IAP_EVENT_4EH_01H: + case PMC_EV_IAP_EVENT_4EH_02H: + case PMC_EV_IAP_EVENT_4EH_04H: case PMC_EV_IAP_EVENT_51H_01H: case PMC_EV_IAP_EVENT_51H_02H: case PMC_EV_IAP_EVENT_51H_04H: From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 17:04:10 2012 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 48A161065673; Tue, 3 Jan 2012 17:04:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 37B7B8FC0A; Tue, 3 Jan 2012 17:04: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 q03H4A6G033111; Tue, 3 Jan 2012 17:04:10 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03H4ALs033109; Tue, 3 Jan 2012 17:04:10 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201201031704.q03H4ALs033109@svn.freebsd.org> From: Alexander Motin Date: Tue, 3 Jan 2012 17:04:09 +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: r229395 - head/sys/cam/scsi 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, 03 Jan 2012 17:04:10 -0000 Author: mav Date: Tue Jan 3 17:04:09 2012 New Revision: 229395 URL: http://svn.freebsd.org/changeset/base/229395 Log: Add support for CDRIOCGETBLOCKSIZE and CDRIOCSETBLOCKSIZE IOCTLs to control sector size same as acd driver does. Together with r228808 and r228847 this allows existing multimedia/vlc to play Audio CDs via CAM cd driver. PR: ports/162190 MFC after: 1 week Modified: head/sys/cam/scsi/scsi_cd.c Modified: head/sys/cam/scsi/scsi_cd.c ============================================================================== --- head/sys/cam/scsi/scsi_cd.c Tue Jan 3 16:54:47 2012 (r229394) +++ head/sys/cam/scsi/scsi_cd.c Tue Jan 3 17:04:09 2012 (r229395) @@ -2685,6 +2685,16 @@ cdioctl(struct disk *dp, u_long cmd, voi error = cdsetspeed(periph, CDR_MAX_SPEED, *(u_int32_t *)addr); cam_periph_unlock(periph); break; + case CDRIOCGETBLOCKSIZE: + *(int *)addr = softc->params.blksize; + break; + case CDRIOCSETBLOCKSIZE: + if (*(int *)addr <= 0) { + error = EINVAL; + break; + } + softc->disk->d_sectorsize = softc->params.blksize = *(int *)addr; + break; case DVDIOCSENDKEY: case DVDIOCREPORTKEY: { struct dvd_authinfo *authinfo; From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 17:07:11 2012 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 C23BD106564A; Tue, 3 Jan 2012 17:07:11 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B05368FC13; Tue, 3 Jan 2012 17:07: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 q03H7B8q033250; Tue, 3 Jan 2012 17:07:11 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03H7BuU033248; Tue, 3 Jan 2012 17:07:11 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201201031707.q03H7BuU033248@svn.freebsd.org> From: Fabien Thomas Date: Tue, 3 Jan 2012 17:07: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: r229396 - stable/7/sys/dev/hwpmc 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, 03 Jan 2012 17:07:11 -0000 Author: fabient Date: Tue Jan 3 17:07:11 2012 New Revision: 229396 URL: http://svn.freebsd.org/changeset/base/229396 Log: MFC r228198: Update Westmere uncore event exception list. Modified: stable/7/sys/dev/hwpmc/hwpmc_core.c Directory Properties: stable/7/sys/ (props changed) Modified: stable/7/sys/dev/hwpmc/hwpmc_core.c ============================================================================== --- stable/7/sys/dev/hwpmc/hwpmc_core.c Tue Jan 3 17:04:09 2012 (r229395) +++ stable/7/sys/dev/hwpmc/hwpmc_core.c Tue Jan 3 17:07:11 2012 (r229396) @@ -1479,6 +1479,10 @@ iap_event_westmere_ok_on_counter(enum pm /* * Events valid only on counter 0. */ + case PMC_EV_IAP_EVENT_60H_01H: + case PMC_EV_IAP_EVENT_60H_02H: + case PMC_EV_IAP_EVENT_60H_04H: + case PMC_EV_IAP_EVENT_60H_08H: case PMC_EV_IAP_EVENT_B3H_01H: case PMC_EV_IAP_EVENT_B3H_02H: case PMC_EV_IAP_EVENT_B3H_04H: @@ -1488,6 +1492,10 @@ iap_event_westmere_ok_on_counter(enum pm /* * Events valid only on counter 0, 1. */ + case PMC_EV_IAP_EVENT_4CH_01H: + case PMC_EV_IAP_EVENT_4EH_01H: + case PMC_EV_IAP_EVENT_4EH_02H: + case PMC_EV_IAP_EVENT_4EH_04H: case PMC_EV_IAP_EVENT_51H_01H: case PMC_EV_IAP_EVENT_51H_02H: case PMC_EV_IAP_EVENT_51H_04H: From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 17:15:27 2012 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 A13AE1065676; Tue, 3 Jan 2012 17:15:27 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8F4008FC17; Tue, 3 Jan 2012 17:15:27 +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 q03HFRvi033573; Tue, 3 Jan 2012 17:15:27 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03HFRM4033571; Tue, 3 Jan 2012 17:15:27 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201201031715.q03HFRM4033571@svn.freebsd.org> From: Fabien Thomas Date: Tue, 3 Jan 2012 17:15:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229397 - stable/9/sys/dev/hwpmc 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, 03 Jan 2012 17:15:27 -0000 Author: fabient Date: Tue Jan 3 17:15:27 2012 New Revision: 229397 URL: http://svn.freebsd.org/changeset/base/229397 Log: MFC r228438: There's a small set of events on Nehalem, that are not supported in processors with CPUID signature 06_1AH, 06_1EH, and 06_1FH. Modified: stable/9/sys/dev/hwpmc/hwpmc_core.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/hwpmc/hwpmc_core.c ============================================================================== --- stable/9/sys/dev/hwpmc/hwpmc_core.c Tue Jan 3 17:07:11 2012 (r229396) +++ stable/9/sys/dev/hwpmc/hwpmc_core.c Tue Jan 3 17:15:27 2012 (r229397) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #define CORE_CPUID_REQUEST 0xA @@ -1553,7 +1554,7 @@ static int iap_allocate_pmc(int cpu, int ri, struct pmc *pm, const struct pmc_op_pmcallocate *a) { - int n; + int n, model; enum pmc_event ev; struct iap_event_descr *ie; uint32_t c, caps, config, cpuflag, evsel, mask; @@ -1573,6 +1574,16 @@ iap_allocate_pmc(int cpu, int ri, struct if (iap_architectural_event_is_unsupported(ev)) return (EOPNOTSUPP); + /* + * A small number of events are not supported in all the + * processors based on a given microarchitecture. + */ + if (ev == PMC_EV_IAP_EVENT_0FH_01H || ev == PMC_EV_IAP_EVENT_0FH_80H) { + model = ((cpu_id & 0xF0000) >> 12) | ((cpu_id & 0xF0) >> 4); + if (core_cputype == PMC_CPU_INTEL_COREI7 && model != 0x2E) + return (EINVAL); + } + switch (core_cputype) { case PMC_CPU_INTEL_COREI7: if (iap_event_corei7_ok_on_counter(ev, ri) == 0) From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 17:17:31 2012 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 69E561065673; Tue, 3 Jan 2012 17:17:31 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 582D58FC12; Tue, 3 Jan 2012 17:17:31 +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 q03HHVGw033682; Tue, 3 Jan 2012 17:17:31 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03HHVmr033680; Tue, 3 Jan 2012 17:17:31 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201201031717.q03HHVmr033680@svn.freebsd.org> From: Fabien Thomas Date: Tue, 3 Jan 2012 17:17:31 +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: r229398 - stable/8/sys/dev/hwpmc 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, 03 Jan 2012 17:17:31 -0000 Author: fabient Date: Tue Jan 3 17:17:30 2012 New Revision: 229398 URL: http://svn.freebsd.org/changeset/base/229398 Log: MFC r228438: There's a small set of events on Nehalem, that are not supported in processors with CPUID signature 06_1AH, 06_1EH, and 06_1FH. Modified: stable/8/sys/dev/hwpmc/hwpmc_core.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/hwpmc/hwpmc_core.c ============================================================================== --- stable/8/sys/dev/hwpmc/hwpmc_core.c Tue Jan 3 17:15:27 2012 (r229397) +++ stable/8/sys/dev/hwpmc/hwpmc_core.c Tue Jan 3 17:17:30 2012 (r229398) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #define CORE_CPUID_REQUEST 0xA @@ -1553,7 +1554,7 @@ static int iap_allocate_pmc(int cpu, int ri, struct pmc *pm, const struct pmc_op_pmcallocate *a) { - int n; + int n, model; enum pmc_event ev; struct iap_event_descr *ie; uint32_t c, caps, config, cpuflag, evsel, mask; @@ -1573,6 +1574,16 @@ iap_allocate_pmc(int cpu, int ri, struct if (iap_architectural_event_is_unsupported(ev)) return (EOPNOTSUPP); + /* + * A small number of events are not supported in all the + * processors based on a given microarchitecture. + */ + if (ev == PMC_EV_IAP_EVENT_0FH_01H || ev == PMC_EV_IAP_EVENT_0FH_80H) { + model = ((cpu_id & 0xF0000) >> 12) | ((cpu_id & 0xF0) >> 4); + if (core_cputype == PMC_CPU_INTEL_COREI7 && model != 0x2E) + return (EINVAL); + } + switch (core_cputype) { case PMC_CPU_INTEL_COREI7: if (iap_event_corei7_ok_on_counter(ev, ri) == 0) From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 17:19:57 2012 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 C4A53106564A; Tue, 3 Jan 2012 17:19:57 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B2CF58FC08; Tue, 3 Jan 2012 17:19: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 q03HJvrJ033807; Tue, 3 Jan 2012 17:19:57 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03HJv7e033805; Tue, 3 Jan 2012 17:19:57 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201201031719.q03HJv7e033805@svn.freebsd.org> From: Fabien Thomas Date: Tue, 3 Jan 2012 17:19:57 +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: r229399 - stable/7/sys/dev/hwpmc 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, 03 Jan 2012 17:19:57 -0000 Author: fabient Date: Tue Jan 3 17:19:57 2012 New Revision: 229399 URL: http://svn.freebsd.org/changeset/base/229399 Log: MFC r228438: There's a small set of events on Nehalem, that are not supported in processors with CPUID signature 06_1AH, 06_1EH, and 06_1FH. Modified: stable/7/sys/dev/hwpmc/hwpmc_core.c Directory Properties: stable/7/sys/ (props changed) Modified: stable/7/sys/dev/hwpmc/hwpmc_core.c ============================================================================== --- stable/7/sys/dev/hwpmc/hwpmc_core.c Tue Jan 3 17:17:30 2012 (r229398) +++ stable/7/sys/dev/hwpmc/hwpmc_core.c Tue Jan 3 17:19:57 2012 (r229399) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #define CORE_CPUID_REQUEST 0xA @@ -1553,7 +1554,7 @@ static int iap_allocate_pmc(int cpu, int ri, struct pmc *pm, const struct pmc_op_pmcallocate *a) { - int n; + int n, model; enum pmc_event ev; struct iap_event_descr *ie; uint32_t c, caps, config, cpuflag, evsel, mask; @@ -1573,6 +1574,16 @@ iap_allocate_pmc(int cpu, int ri, struct if (iap_architectural_event_is_unsupported(ev)) return (EOPNOTSUPP); + /* + * A small number of events are not supported in all the + * processors based on a given microarchitecture. + */ + if (ev == PMC_EV_IAP_EVENT_0FH_01H || ev == PMC_EV_IAP_EVENT_0FH_80H) { + model = ((cpu_id & 0xF0000) >> 12) | ((cpu_id & 0xF0) >> 4); + if (core_cputype == PMC_CPU_INTEL_COREI7 && model != 0x2E) + return (EINVAL); + } + switch (core_cputype) { case PMC_CPU_INTEL_COREI7: if (iap_event_corei7_ok_on_counter(ev, ri) == 0) From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 17:31:27 2012 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 B5DDA1065675; Tue, 3 Jan 2012 17:31:27 +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 A55B08FC17; Tue, 3 Jan 2012 17:31:27 +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 q03HVRDL034180; Tue, 3 Jan 2012 17:31:27 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03HVRkK034178; Tue, 3 Jan 2012 17:31:27 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201031731.q03HVRkK034178@svn.freebsd.org> From: John Baldwin Date: Tue, 3 Jan 2012 17:31:27 +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: r229400 - head/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: Tue, 03 Jan 2012 17:31:27 -0000 Author: jhb Date: Tue Jan 3 17:31:27 2012 New Revision: 229400 URL: http://svn.freebsd.org/changeset/base/229400 Log: Improve the cscope target's handling of MD directories. Automatically include the MACHINE_CPUARCH directory if it differents from MACHINE when building an index for a single machine. Also, include the 'x86' directory when building an index for i386, pc98, or amd64. MFC after: 1 week Modified: head/sys/Makefile Modified: head/sys/Makefile ============================================================================== --- head/sys/Makefile Tue Jan 3 17:19:57 2012 (r229399) +++ head/sys/Makefile Tue Jan 3 17:31:27 2012 (r229400) @@ -13,10 +13,18 @@ CSCOPEDIRS= boot bsm cam cddl compat con netgraph netinet netinet6 netipsec netipx netnatm netncp \ netsmb nfs nfsclient nfsserver nlm opencrypto \ pci rpc security sys ufs vm xdr xen ${CSCOPE_ARCHDIR} +.if !defined(CSCOPE_ARCHDIR) .if defined(ALL_ARCH) -CSCOPE_ARCHDIR ?= amd64 arm i386 ia64 mips pc98 powerpc sparc64 x86 +CSCOPE_ARCHDIR = amd64 arm i386 ia64 mips pc98 powerpc sparc64 x86 .else -CSCOPE_ARCHDIR ?= ${MACHINE} +CSCOPE_ARCHDIR = ${MACHINE} +.if ${MACHINE} != ${MACHINE_CPUARCH} +CSCOPE_ARCHDIR += ${MACHINE_CPUARCH} +.endif +.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" +CSCOPE_ARCHDIR += x86 +.endif +.endif .endif # Loadable kernel modules From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 18:20:21 2012 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 7502C106566B; Tue, 3 Jan 2012 18:20:21 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from mx0.hoeg.nl (mx0.hoeg.nl [IPv6:2a01:4f8:101:5343::aa]) by mx1.freebsd.org (Postfix) with ESMTP id 0F7DD8FC12; Tue, 3 Jan 2012 18:20:21 +0000 (UTC) Received: by mx0.hoeg.nl (Postfix, from userid 1000) id 329672A28DF2; Tue, 3 Jan 2012 19:20:20 +0100 (CET) Date: Tue, 3 Jan 2012 19:20:20 +0100 From: Ed Schouten To: Bruce Evans Message-ID: <20120103182020.GH1895@hoeg.nl> References: <201201030714.q037E2qq010125@svn.freebsd.org> <20120104013401.S6960@besplex.bde.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="OXqTiZo38oDXuAlq" Content-Disposition: inline In-Reply-To: <20120104013401.S6960@besplex.bde.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r229368 - in head: lib/libc lib/libc/arm/string lib/libc/i386/string lib/libc/mips/string lib/libc/string lib/libstand sys/boot/userboot/libstand 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, 03 Jan 2012 18:20:21 -0000 --OXqTiZo38oDXuAlq Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Bruce, * Bruce Evans , 20120103 16:49: > This breaks the Standard C namespace. When they are in the same object > file, there is no way to get the standard name without getting the > nonstandard name. So the following C-standard-conforming C program > now gets a linkage error (multiple definition of `index'), at least with > static linkage: >=20 > #include > int index; > void foo(const char *p) { return strchr(p, '1'); } Though I sympathize, this problem is not just limited to strchr(). There are other portions of the C library that use index() as well. For example, if you use , ttyslot(), one of the exec*() functions or the NIS functions, you already get index() linked into your binary. > [...] and the C > standard might require memcpy and memmove to have different addresses. I just skimmed through the standard, and if I haven't overlooked anything, no such requirement is made. Also, I can imagine a compiler with good support for link-time optimisation can already merge equal pieces of code together, making it even harder to reason about inequality of function addresses. Still, I am willing to address the issues you raised. index() and rindex() aren't that important nowadays and I have a patchset ready in my home directory that converts almost all apps in the base system to use strchr() anyway. As I don't feel like polluting the MI strchr() implementations with index()/rindex() support, would it be okay if I implement index() and rindex() as simple C functions that call into strchr() and strrchr()? --=20 Ed Schouten WWW: http://80386.nl/ --OXqTiZo38oDXuAlq Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iQIcBAEBAgAGBQJPA0bjAAoJEG5e2P40kaK7Dp8P/jK/y1yO5Yw4ztVPkhTx2S/K 5+reKjaGBEa6/wvSB3ytoEME6pMIrc4sgs/aKSYVufRaV6MDcVQ2e4llH1oWR9Zg JPNW2S6WYeC0JV0Y3gpXzoIuPaH2W8wYBEVWyhRj0W1+CbUL34NtfJWATsNQxkST Y+vFGCI7Ry3KtllVgJ/IC0N3c9m2EsOh+O0/yLwAS4f/GXjKpQEJsgOuR1EBWUQU tHiRTIzZp6S1upiPTWG5hY0UlvNJfe1jPJ09g8uGrS22a61gLiweTp8nO/VszrLS lIv/4YGt2ycX4UWeEGmfuKng+7qp1NhO2VyWupgLJtCreVbn6I5Y/zhELdfhJPuU hK2MGP2BlkNAK/yylY2IZZa8T7Hnt7SYolb0CT72D1xvJb1FR900Hwq0EKp4YySF 4PdpV5jdK8qINUzVA+zooNwvnvmvdsI0rL1wV5tX0ikkzjTTqjEYLA5aqMn9y4U5 UT3+Dmd12j6c8Uu/NMrnyrbdlqqcRx1ftfONO9meNeYeckuGIZ6klrTHJxgkcb6c oE2Cr++xV1KQLjmbp+biB5xT6mX0J/Sn8TyfYwn34G3E1RVm7ZDh17bJSrjqVXYn TwFBy7199cl9IeSlROCDe6vjKozVUvhCP+zzN4HHFwHscNswUki+xpda7rXX9i5D Qec9D+T7+9EYxezDWCAM =qvDX -----END PGP SIGNATURE----- --OXqTiZo38oDXuAlq-- From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 18:40:42 2012 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 0F54D106566C; Tue, 3 Jan 2012 18:40:42 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F2A448FC08; Tue, 3 Jan 2012 18:40: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 q03IefBd036491; Tue, 3 Jan 2012 18:40:41 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03Iefc5036489; Tue, 3 Jan 2012 18:40:41 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201031840.q03Iefc5036489@svn.freebsd.org> From: Dimitry Andric Date: Tue, 3 Jan 2012 18:40: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: r229401 - head/sys/dev/if_ndis 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, 03 Jan 2012 18:40:42 -0000 Author: dim Date: Tue Jan 3 18:40:41 2012 New Revision: 229401 URL: http://svn.freebsd.org/changeset/base/229401 Log: In sys/dev/if_ndis/if_ndis_pccard.c, fix a bug where a garbage rid was passed to resource_list_add(). The rid that was just returned by bus_alloc_resource_any() should have been used instead. Reviewed by: jhb MFC after: 1 week Modified: head/sys/dev/if_ndis/if_ndis_pccard.c Modified: head/sys/dev/if_ndis/if_ndis_pccard.c ============================================================================== --- head/sys/dev/if_ndis/if_ndis_pccard.c Tue Jan 3 17:31:27 2012 (r229400) +++ head/sys/dev/if_ndis/if_ndis_pccard.c Tue Jan 3 18:40:41 2012 (r229401) @@ -207,7 +207,7 @@ ndis_attach_pccard(dev) goto fail; } sc->ndis_rescnt++; - resource_list_add(&sc->ndis_rl, SYS_RES_IOPORT, rid, + resource_list_add(&sc->ndis_rl, SYS_RES_IOPORT, sc->ndis_io_rid, rman_get_start(sc->ndis_res_io), rman_get_end(sc->ndis_res_io), rman_get_size(sc->ndis_res_io)); From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 18:49:39 2012 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 BCF90106566B; Tue, 3 Jan 2012 18:49:39 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AC6218FC0C; Tue, 3 Jan 2012 18: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 q03IndEK036919; Tue, 3 Jan 2012 18:49:39 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03IndxI036917; Tue, 3 Jan 2012 18:49:39 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201031849.q03IndxI036917@svn.freebsd.org> From: Dimitry Andric Date: Tue, 3 Jan 2012 18:49:39 +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: r229402 - head/sys/compat/linux 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, 03 Jan 2012 18:49:39 -0000 Author: dim Date: Tue Jan 3 18:49:39 2012 New Revision: 229402 URL: http://svn.freebsd.org/changeset/base/229402 Log: In sys/compat/linux/linux_ioctl.c, work around a warning when a pointer is compared to an integer, by casting the pointer to l_uintptr_t. No functional difference on both i386 and amd64. Reviewed by: ed, jhb MFC after: 1 week Modified: head/sys/compat/linux/linux_ioctl.c Modified: head/sys/compat/linux/linux_ioctl.c ============================================================================== --- head/sys/compat/linux/linux_ioctl.c Tue Jan 3 18:40:41 2012 (r229401) +++ head/sys/compat/linux/linux_ioctl.c Tue Jan 3 18:49:39 2012 (r229402) @@ -2182,7 +2182,7 @@ linux_ifconf(struct thread *td, struct i CURVNET_SET(TD_TO_VNET(td)); /* handle the 'request buffer size' case */ - if (ifc.ifc_buf == PTROUT(NULL)) { + if ((l_uintptr_t)ifc.ifc_buf == PTROUT(NULL)) { ifc.ifc_len = 0; IFNET_RLOCK(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 18:52:00 2012 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 372FD1065672; Tue, 3 Jan 2012 18:52:00 +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 221AF8FC0C; Tue, 3 Jan 2012 18:52: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 q03Iq0it037083; Tue, 3 Jan 2012 18:52:00 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03IpxJW037031; Tue, 3 Jan 2012 18:51:59 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201201031851.q03IpxJW037031@svn.freebsd.org> From: Ed Schouten Date: Tue, 3 Jan 2012 18:51: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: r229403 - in head: games/fortune/fortune lib/libc/gen lib/libc/net lib/libcam lib/libstand lib/libutil libexec/mknetid libexec/rlogind sbin/bsdlabel sbin/dump sbin/fsck_ffs sbin/ipfw sb... 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, 03 Jan 2012 18:52:00 -0000 Author: ed Date: Tue Jan 3 18:51:58 2012 New Revision: 229403 URL: http://svn.freebsd.org/changeset/base/229403 Log: Replace index() and rindex() calls with strchr() and strrchr(). The index() and rindex() functions were marked LEGACY in the 2001 revision of POSIX and were subsequently removed from the 2008 revision. The strchr() and strrchr() functions are part of the C standard. This makes the source code a lot more consistent, as most of these C files also call into other str*() routines. In fact, about a dozen already perform strchr() calls. Modified: head/games/fortune/fortune/fortune.c head/lib/libc/gen/exec.c head/lib/libc/gen/getttyent.c head/lib/libc/gen/timezone.c head/lib/libc/net/gethostbynis.c head/lib/libc/net/getnetbynis.c head/lib/libcam/camlib.c head/lib/libstand/bootp.c head/lib/libutil/quotafile.c head/libexec/mknetid/parse_group.c head/libexec/rlogind/rlogind.c head/sbin/bsdlabel/bsdlabel.c head/sbin/dump/main.c head/sbin/fsck_ffs/pass2.c head/sbin/ipfw/main.c head/sbin/shutdown/shutdown.c head/sys/boot/common/interp_parse.c head/sys/boot/ofw/common/main.c head/sys/boot/ofw/libofw/ofw_net.c head/usr.bin/cksum/cksum.c head/usr.bin/compress/compress.c head/usr.bin/finger/finger.c head/usr.bin/hexdump/display.c head/usr.bin/hexdump/hexdump.c head/usr.bin/hexdump/hexsyntax.c head/usr.bin/hexdump/parse.c head/usr.bin/locate/locate/fastfind.c head/usr.bin/locate/locate/util.c head/usr.bin/netstat/if.c head/usr.bin/netstat/inet.c head/usr.bin/netstat/inet6.c head/usr.bin/netstat/sctp.c head/usr.bin/rlogin/rlogin.c head/usr.bin/rpcgen/rpc_main.c head/usr.bin/systat/devs.c head/usr.bin/systat/netcmds.c head/usr.bin/systat/netstat.c head/usr.bin/tftp/main.c head/usr.bin/tr/str.c head/usr.bin/tset/map.c head/usr.bin/tset/term.c head/usr.bin/tset/wrterm.c head/usr.sbin/bootparamd/bootparamd/bootparamd.c head/usr.sbin/config/main.c head/usr.sbin/config/mkmakefile.c head/usr.sbin/inetd/inetd.c head/usr.sbin/ipfwpcap/ipfwpcap.c head/usr.sbin/mtree/spec.c head/usr.sbin/newsyslog/newsyslog.c head/usr.sbin/rwhod/rwhod.c head/usr.sbin/sade/variable.c Modified: head/games/fortune/fortune/fortune.c ============================================================================== --- head/games/fortune/fortune/fortune.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/games/fortune/fortune/fortune.c Tue Jan 3 18:51:58 2012 (r229403) @@ -683,7 +683,7 @@ all_forts(FILEDESC *fp, char *offensive) obscene->fd = fd; obscene->inf = NULL; obscene->path = offensive; - if ((sp = rindex(offensive, '/')) == NULL) + if ((sp = strrchr(offensive, '/')) == NULL) obscene->name = offensive; else obscene->name = ++sp; @@ -785,7 +785,7 @@ is_fortfile(const char *file, char **dat } } - if ((sp = rindex(file, '/')) == NULL) + if ((sp = strrchr(file, '/')) == NULL) sp = file; else sp++; @@ -797,7 +797,7 @@ is_fortfile(const char *file, char **dat DPRINTF(2, (stderr, "FALSE (check fortunes only)\n")); return (FALSE); } - if ((sp = rindex(sp, '.')) != NULL) { + if ((sp = strrchr(sp, '.')) != NULL) { sp++; for (i = 0; suflist[i] != NULL; i++) if (strcmp(sp, suflist[i]) == 0) { Modified: head/lib/libc/gen/exec.c ============================================================================== --- head/lib/libc/gen/exec.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/lib/libc/gen/exec.c Tue Jan 3 18:51:58 2012 (r229403) @@ -159,7 +159,7 @@ execvPe(const char *name, const char *pa eacces = 0; /* If it's an absolute or relative path name, it's easy. */ - if (index(name, '/')) { + if (strchr(name, '/')) { bp = name; cur = NULL; goto retry; Modified: head/lib/libc/gen/getttyent.c ============================================================================== --- head/lib/libc/gen/getttyent.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/lib/libc/gen/getttyent.c Tue Jan 3 18:51:58 2012 (r229403) @@ -78,7 +78,7 @@ getttyent(void) if (!fgets(p = line, lbsize, tf)) return (NULL); /* extend buffer if line was too big, and retry */ - while (!index(p, '\n') && !feof(tf)) { + while (!strchr(p, '\n') && !feof(tf)) { i = strlen(p); lbsize += MALLOCCHUNK; if ((p = realloc(line, lbsize)) == NULL) { @@ -148,7 +148,7 @@ getttyent(void) tty.ty_comment = p; if (*p == 0) tty.ty_comment = 0; - if ( (p = index(p, '\n')) ) + if ((p = strchr(p, '\n'))) *p = '\0'; return (&tty); } @@ -196,7 +196,7 @@ static char * value(char *p) { - return ((p = index(p, '=')) ? ++p : NULL); + return ((p = strchr(p, '=')) ? ++p : NULL); } int Modified: head/lib/libc/gen/timezone.c ============================================================================== --- head/lib/libc/gen/timezone.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/lib/libc/gen/timezone.c Tue Jan 3 18:51:58 2012 (r229403) @@ -59,7 +59,7 @@ timezone(int zone, int dst) *end; if ( (beg = getenv("TZNAME")) ) { /* set in environment */ - if ( (end = index(beg, ',')) ) {/* "PST,PDT" */ + if ((end = strchr(beg, ','))) { /* "PST,PDT" */ if (dst) return(++end); *end = '\0'; Modified: head/lib/libc/net/gethostbynis.c ============================================================================== --- head/lib/libc/net/gethostbynis.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/lib/libc/net/gethostbynis.c Tue Jan 3 18:51:58 2012 (r229403) @@ -91,7 +91,7 @@ _gethostbynis(const char *name, char *ma free(result); result = (char *)&ypbuf; - if ((cp = index(result, '\n'))) + if ((cp = strchr(result, '\n'))) *cp = '\0'; cp = strpbrk(result, " \t"); Modified: head/lib/libc/net/getnetbynis.c ============================================================================== --- head/lib/libc/net/getnetbynis.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/lib/libc/net/getnetbynis.c Tue Jan 3 18:51:58 2012 (r229403) @@ -80,7 +80,7 @@ _getnetbynis(const char *name, char *map free(result); result = (char *)&ypbuf; - if ((cp = index(result, '\n'))) + if ((cp = strchr(result, '\n'))) *cp = '\0'; cp = strpbrk(result, " \t"); Modified: head/lib/libcam/camlib.c ============================================================================== --- head/lib/libcam/camlib.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/lib/libcam/camlib.c Tue Jan 3 18:51:58 2012 (r229403) @@ -137,7 +137,7 @@ cam_get_device(const char *path, char *d */ if (*tmpstr == '/') { tmpstr2 = tmpstr; - tmpstr = (char *)rindex(tmpstr2, '/'); + tmpstr = strrchr(tmpstr2, '/'); if ((tmpstr != NULL) && (*tmpstr != '\0')) tmpstr++; } Modified: head/lib/libstand/bootp.c ============================================================================== --- head/lib/libstand/bootp.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/lib/libstand/bootp.c Tue Jan 3 18:51:58 2012 (r229403) @@ -703,13 +703,13 @@ setenv_(u_char *cp, u_char *ep, struct u_char *s = NULL; /* semicolon ? */ /* skip leading whitespace */ - while (*endv && index(" \t\n\r", *endv)) + while (*endv && strchr(" \t\n\r", *endv)) endv++; - vp = index(endv, '='); /* find name=value separator */ + vp = strchr(endv, '='); /* find name=value separator */ if (!vp) break; *vp++ = 0; - if (op->fmt == __ILIST && (s = index(vp, ';'))) + if (op->fmt == __ILIST && (s = strchr(vp, ';'))) *s++ = '\0'; setenv(endv, vp, 1); vp = s; /* prepare for next round */ Modified: head/lib/libutil/quotafile.c ============================================================================== --- head/lib/libutil/quotafile.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/lib/libutil/quotafile.c Tue Jan 3 18:51:58 2012 (r229403) @@ -84,7 +84,7 @@ hasquota(struct fstab *fs, int type, cha } strcpy(buf, fs->fs_mntops); for (opt = strtok(buf, ","); opt; opt = strtok(NULL, ",")) { - if ((cp = index(opt, '='))) + if ((cp = strchr(opt, '='))) *cp++ = '\0'; if (type == USRQUOTA && strcmp(opt, usrname) == 0) break; Modified: head/libexec/mknetid/parse_group.c ============================================================================== --- head/libexec/mknetid/parse_group.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/libexec/mknetid/parse_group.c Tue Jan 3 18:51:58 2012 (r229403) @@ -114,7 +114,7 @@ grscan(int search, int gid) return(0); bp = line; /* skip lines that are too big */ - if (!index(line, '\n')) { + if (!strchr(line, '\n')) { int ch; while ((ch = getc(_gr_fp)) != '\n' && ch != EOF) Modified: head/libexec/rlogind/rlogind.c ============================================================================== --- head/libexec/rlogind/rlogind.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/libexec/rlogind/rlogind.c Tue Jan 3 18:51:58 2012 (r229403) @@ -543,16 +543,17 @@ extern char **environ; void setup_term(int fd) { - char *cp = index(term+ENVSIZE, '/'); + char *cp; char *speed; struct termios tt, def; + cp = strchr(term + ENVSIZE, '/'); #ifndef notyet tcgetattr(fd, &tt); if (cp) { *cp++ = '\0'; speed = cp; - cp = index(speed, '/'); + cp = strchr(speed, '/'); if (cp) *cp++ = '\0'; cfsetspeed(&tt, atoi(speed)); @@ -567,7 +568,7 @@ setup_term(int fd) if (cp) { *cp++ = '\0'; speed = cp; - cp = index(speed, '/'); + cp = strchr(speed, '/'); if (cp) *cp++ = '\0'; tcgetattr(fd, &tt); Modified: head/sbin/bsdlabel/bsdlabel.c ============================================================================== --- head/sbin/bsdlabel/bsdlabel.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/sbin/bsdlabel/bsdlabel.c Tue Jan 3 18:51:58 2012 (r229403) @@ -782,12 +782,12 @@ getasciilabel(FILE *f, struct disklabel lp->d_sbsize = 0; /* XXX */ while (fgets(line, sizeof(line) - 1, f)) { lineno++; - if ((cp = index(line,'\n')) != 0) + if ((cp = strchr(line,'\n')) != 0) *cp = '\0'; cp = skip(line); if (cp == NULL) continue; - tp = index(cp, ':'); + tp = strchr(cp, ':'); if (tp == NULL) { fprintf(stderr, "line %d: syntax error\n", lineno); errors++; Modified: head/sbin/dump/main.c ============================================================================== --- head/sbin/dump/main.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/sbin/dump/main.c Tue Jan 3 18:51:58 2012 (r229403) @@ -290,7 +290,7 @@ main(int argc, char *argv[]) tape = strchr(host, ':'); *tape++ = '\0'; #ifdef RDUMP - if (index(tape, '\n')) { + if (strchr(tape, '\n')) { (void)fprintf(stderr, "invalid characters in tape\n"); exit(X_STARTUP); } Modified: head/sbin/fsck_ffs/pass2.c ============================================================================== --- head/sbin/fsck_ffs/pass2.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/sbin/fsck_ffs/pass2.c Tue Jan 3 18:51:58 2012 (r229403) @@ -613,7 +613,7 @@ fix_extraneous(struct inoinfo *inp, stru printf(" (IGNORED)\n"); return (0); } - if ((cp = rindex(oldname, '/')) == NULL) { + if ((cp = strchr(oldname, '/')) == NULL) { printf(" (IGNORED)\n"); return (0); } Modified: head/sbin/ipfw/main.c ============================================================================== --- head/sbin/ipfw/main.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/sbin/ipfw/main.c Tue Jan 3 18:51:58 2012 (r229403) @@ -122,9 +122,9 @@ ipfw_main(int oldac, char **oldav) break; if (copy) { arg[j++] = arg[i]; - copy = !index("," WHITESP, arg[i]); + copy = !strchr("," WHITESP, arg[i]); } else { - copy = !index(WHITESP, arg[i]); + copy = !strchr(WHITESP, arg[i]); if (copy) arg[j++] = arg[i]; } @@ -141,7 +141,7 @@ ipfw_main(int oldac, char **oldav) * processing, this is just the number of blanks plus 1. */ for (i = 0, ac = 1; i < l; i++) - if (index(WHITESP, arg[i]) != NULL) + if (strchr(WHITESP, arg[i]) != NULL) ac++; /* @@ -162,7 +162,7 @@ ipfw_main(int oldac, char **oldav) */ av_p = (char *)&av[ac+1]; for (ac = 1, i = j = 0; i < l; i++) { - if (index(WHITESP, arg[i]) != NULL || i == l-1) { + if (strchr(WHITESP, arg[i]) != NULL || i == l-1) { if (i == l-1) i++; bcopy(arg+j, av_p, i-j); @@ -240,7 +240,7 @@ ipfw_main(int oldac, char **oldav) " ipfw sysctl -a\n"); return 0; } - s = index(av[2], '='); + s = strchr(av[2], '='); if (s == NULL) { s = !strcmp(av[2], "-a") ? NULL : av[2]; sysctlbyname(s, NULL, NULL, NULL, 0); Modified: head/sbin/shutdown/shutdown.c ============================================================================== --- head/sbin/shutdown/shutdown.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/sbin/shutdown/shutdown.c Tue Jan 3 18:51:58 2012 (r229403) @@ -123,7 +123,7 @@ main(int argc, char **argv) * Test for the special case where the utility is called as * "poweroff", for which it runs 'shutdown -p now'. */ - if ((p = rindex(argv[0], '/')) == NULL) + if ((p = strrchr(argv[0], '/')) == NULL) p = argv[0]; else ++p; Modified: head/sys/boot/common/interp_parse.c ============================================================================== --- head/sys/boot/common/interp_parse.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/sys/boot/common/interp_parse.c Tue Jan 3 18:51:58 2012 (r229403) @@ -137,7 +137,7 @@ parse(int *argc, char ***argv, char *str case VAR: if (token) { - PARSE_FAIL((q = index(p, token)) == NULL); + PARSE_FAIL((q = strchr(p, token)) == NULL); } else { q = p; while (*q && !isspace(*q)) Modified: head/sys/boot/ofw/common/main.c ============================================================================== --- head/sys/boot/ofw/common/main.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/sys/boot/ofw/common/main.c Tue Jan 3 18:51:58 2012 (r229403) @@ -133,7 +133,7 @@ main(int (*openfirm)(void *)) printf("Memory: %lldKB\n", memsize() / 1024); OF_getprop(chosen, "bootpath", bootpath, 64); - ch = index(bootpath, ':'); + ch = strchr(bootpath, ':'); *ch = '\0'; printf("Booted from: %s\n", bootpath); Modified: head/sys/boot/ofw/libofw/ofw_net.c ============================================================================== --- head/sys/boot/ofw/libofw/ofw_net.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/sys/boot/ofw/libofw/ofw_net.c Tue Jan 3 18:51:58 2012 (r229403) @@ -185,7 +185,7 @@ ofwn_init(struct iodesc *desc, void *mac int pathlen; pathlen = OF_getprop(chosen, "bootpath", path, 64); - if ((ch = index(path, ':')) != NULL) + if ((ch = strchr(path, ':')) != NULL) *ch = '\0'; netdev = OF_finddevice(path); #ifdef __sparc64__ Modified: head/usr.bin/cksum/cksum.c ============================================================================== --- head/usr.bin/cksum/cksum.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/usr.bin/cksum/cksum.c Tue Jan 3 18:51:58 2012 (r229403) @@ -68,7 +68,7 @@ main(int argc, char **argv) int (*cfncn)(int, uint32_t *, off_t *); void (*pfncn)(char *, uint32_t, off_t); - if ((p = rindex(argv[0], '/')) == NULL) + if ((p = strrchr(argv[0], '/')) == NULL) p = argv[0]; else ++p; Modified: head/usr.bin/compress/compress.c ============================================================================== --- head/usr.bin/compress/compress.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/usr.bin/compress/compress.c Tue Jan 3 18:51:58 2012 (r229403) @@ -75,7 +75,7 @@ main(int argc, char *argv[]) char *p, newname[MAXPATHLEN]; cat = 0; - if ((p = rindex(argv[0], '/')) == NULL) + if ((p = strrchr(argv[0], '/')) == NULL) p = argv[0]; else ++p; @@ -141,7 +141,7 @@ main(int argc, char *argv[]) compress(*argv, "/dev/stdout", bits); break; } - if ((p = rindex(*argv, '.')) != NULL && + if ((p = strrchr(*argv, '.')) != NULL && !strcmp(p, ".Z")) { cwarnx("%s: name already has trailing .Z", *argv); @@ -164,7 +164,7 @@ main(int argc, char *argv[]) break; } len = strlen(*argv); - if ((p = rindex(*argv, '.')) == NULL || + if ((p = strrchr(*argv, '.')) == NULL || strcmp(p, ".Z")) { if (len > sizeof(newname) - 3) { cwarnx("%s: name too long", *argv); Modified: head/usr.bin/finger/finger.c ============================================================================== --- head/usr.bin/finger/finger.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/usr.bin/finger/finger.c Tue Jan 3 18:51:58 2012 (r229403) @@ -287,7 +287,7 @@ userlist(int argc, char **argv) /* Pull out all network requests. */ for (ap = p = argv, np = nargv; *p; ++p) - if (index(*p, '@')) + if (strchr(*p, '@')) *np++ = *p; else *ap++ = *p; Modified: head/usr.bin/hexdump/display.c ============================================================================== --- head/usr.bin/hexdump/display.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/usr.bin/hexdump/display.c Tue Jan 3 18:51:58 2012 (r229403) @@ -220,7 +220,7 @@ bpad(PR *pr) pr->cchar[0] = 's'; pr->cchar[1] = '\0'; for (p1 = pr->fmt; *p1 != '%'; ++p1); - for (p2 = ++p1; *p1 && index(spec, *p1); ++p1); + for (p2 = ++p1; *p1 && strchr(spec, *p1); ++p1); while ((*p2++ = *p1++)); } Modified: head/usr.bin/hexdump/hexdump.c ============================================================================== --- head/usr.bin/hexdump/hexdump.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/usr.bin/hexdump/hexdump.c Tue Jan 3 18:51:58 2012 (r229403) @@ -61,7 +61,7 @@ main(int argc, char *argv[]) (void)setlocale(LC_ALL, ""); - if (!(p = rindex(argv[0], 'o')) || strcmp(p, "od")) + if (!(p = strrchr(argv[0], 'o')) || strcmp(p, "od")) newsyntax(argc, &argv); else oldsyntax(argc, &argv); Modified: head/usr.bin/hexdump/hexsyntax.c ============================================================================== --- head/usr.bin/hexdump/hexsyntax.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/usr.bin/hexdump/hexsyntax.c Tue Jan 3 18:51:58 2012 (r229403) @@ -54,7 +54,7 @@ newsyntax(int argc, char ***argvp) char *p, **argv; argv = *argvp; - if ((p = rindex(argv[0], 'h')) != NULL && + if ((p = strrchr(argv[0], 'h')) != NULL && strcmp(p, "hd") == 0) { /* "Canonical" format, implies -C. */ add("\"%08.8_Ax\n\""); Modified: head/usr.bin/hexdump/parse.c ============================================================================== --- head/usr.bin/hexdump/parse.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/usr.bin/hexdump/parse.c Tue Jan 3 18:51:58 2012 (r229403) @@ -58,7 +58,7 @@ addfile(char *name) if ((fp = fopen(name, "r")) == NULL) err(1, "%s", name); while (fgets(buf, sizeof(buf), fp)) { - if (!(p = index(buf, '\n'))) { + if (!(p = strchr(buf, '\n'))) { warnx("line too long"); while ((ch = getchar()) != '\n' && ch != EOF); continue; @@ -167,7 +167,7 @@ size(FS *fs) * skip any special chars -- save precision in * case it's a %s format. */ - while (index(spec + 1, *++fmt)); + while (strchr(spec + 1, *++fmt)); if (*fmt == '.' && isdigit(*++fmt)) { prec = atoi(fmt); while (isdigit(*++fmt)); @@ -243,10 +243,10 @@ rewrite(FS *fs) if (fu->bcnt) { sokay = USEBCNT; /* Skip to conversion character. */ - for (++p1; index(spec, *p1); ++p1); + for (++p1; strchr(spec, *p1); ++p1); } else { /* Skip any special chars, field width. */ - while (index(spec + 1, *++p1)); + while (strchr(spec + 1, *++p1)); if (*p1 == '.' && isdigit(*++p1)) { sokay = USEPREC; prec = atoi(p1); Modified: head/usr.bin/locate/locate/fastfind.c ============================================================================== --- head/usr.bin/locate/locate/fastfind.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/usr.bin/locate/locate/fastfind.c Tue Jan 3 18:51:58 2012 (r229403) @@ -167,7 +167,7 @@ fastfind /* find optimal (last) char for searching */ for (p = pathpart; *p != '\0'; p++) - if (index(LOCATE_REG, *p) != NULL) + if (strchr(LOCATE_REG, *p) != NULL) break; if (*p == '\0') Modified: head/usr.bin/locate/locate/util.c ============================================================================== --- head/usr.bin/locate/locate/util.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/usr.bin/locate/locate/util.c Tue Jan 3 18:51:58 2012 (r229403) @@ -162,7 +162,7 @@ patprep(name) /* skip trailing metacharacters */ for (; p >= name; p--) - if (index(LOCATE_REG, *p) == NULL) + if (strchr(LOCATE_REG, *p) == NULL) break; /* @@ -172,7 +172,7 @@ patprep(name) * |----< p */ if (p >= name && - (index(p, '[') != NULL || index(p, ']') != NULL)) { + (strchr(p, '[') != NULL || strchr(p, ']') != NULL)) { for (p = name; *p != '\0'; p++) if (*p == ']' || *p == '[') break; @@ -183,7 +183,7 @@ patprep(name) * '*\*[a-z]' * |-------< p */ - if (p >= name && index(LOCATE_REG, *p) != NULL) + if (p >= name && strchr(LOCATE_REG, *p) != NULL) p = name - 1; } @@ -193,7 +193,7 @@ patprep(name) else { for (endmark = p; p >= name; p--) - if (index(LOCATE_REG, *p) != NULL) + if (strchr(LOCATE_REG, *p) != NULL) break; for (++p; (p <= endmark) && subp < (globfree + sizeof(globfree));) Modified: head/usr.bin/netstat/if.c ============================================================================== --- head/usr.bin/netstat/if.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/usr.bin/netstat/if.c Tue Jan 3 18:51:58 2012 (r229403) @@ -256,7 +256,7 @@ intpr(int interval1, u_long ifnetaddr, v ifnetaddr = (u_long)TAILQ_NEXT(&ifnet, if_link); if (interface != 0 && strcmp(name, interface) != 0) continue; - cp = index(name, '\0'); + cp = strchr(name, '\0'); if (pfunc) { (*pfunc)(name); Modified: head/usr.bin/netstat/inet.c ============================================================================== --- head/usr.bin/netstat/inet.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/usr.bin/netstat/inet.c Tue Jan 3 18:51:58 2012 (r229403) @@ -1247,7 +1247,7 @@ inetprint(struct in_addr *in, int port, sprintf(line, "%s.", inetname(in)); else sprintf(line, "%.*s.", (Aflag && !num_port) ? 12 : 16, inetname(in)); - cp = index(line, '\0'); + cp = strchr(line, '\0'); if (!num_port && port) sp = getservbyport((int)port, proto); if (sp || port == 0) Modified: head/usr.bin/netstat/inet6.c ============================================================================== --- head/usr.bin/netstat/inet6.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/usr.bin/netstat/inet6.c Tue Jan 3 18:51:58 2012 (r229403) @@ -1100,7 +1100,7 @@ inet6print(struct in6_addr *in6, int por sprintf(line, "%.*s.", Wflag ? 39 : (Aflag && !numeric) ? 12 : 16, inet6name(in6)); - cp = index(line, '\0'); + cp = strchr(line, '\0'); if (!numeric && port) GETSERVBYPORT6(port, proto, sp); if (sp || port == 0) @@ -1129,7 +1129,7 @@ inet6name(struct in6_addr *in6p) if (first && !numeric_addr) { first = 0; if (gethostname(domain, MAXHOSTNAMELEN) == 0 && - (cp = index(domain, '.'))) + (cp = strchr(domain, '.'))) (void) strcpy(domain, cp + 1); else domain[0] = 0; @@ -1138,7 +1138,7 @@ inet6name(struct in6_addr *in6p) if (!numeric_addr && !IN6_IS_ADDR_UNSPECIFIED(in6p)) { hp = gethostbyaddr((char *)in6p, sizeof(*in6p), AF_INET6); if (hp) { - if ((cp = index(hp->h_name, '.')) && + if ((cp = strchr(hp->h_name, '.')) && !strcmp(cp + 1, domain)) *cp = 0; cp = hp->h_name; Modified: head/usr.bin/netstat/sctp.c ============================================================================== --- head/usr.bin/netstat/sctp.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/usr.bin/netstat/sctp.c Tue Jan 3 18:51:58 2012 (r229403) @@ -162,7 +162,7 @@ inet6name(struct in6_addr *in6p) if (first && !numeric_addr) { first = 0; if (gethostname(domain, MAXHOSTNAMELEN) == 0 && - (cp = index(domain, '.'))) + (cp = strchr(domain, '.'))) (void) strcpy(domain, cp + 1); else domain[0] = 0; @@ -171,7 +171,7 @@ inet6name(struct in6_addr *in6p) if (!numeric_addr && !IN6_IS_ADDR_UNSPECIFIED(in6p)) { hp = gethostbyaddr((char *)in6p, sizeof(*in6p), AF_INET6); if (hp) { - if ((cp = index(hp->h_name, '.')) && + if ((cp = strchr(hp->h_name, '.')) && !strcmp(cp + 1, domain)) *cp = 0; cp = hp->h_name; @@ -209,7 +209,7 @@ sctp_print_address(union sctp_sockstore sprintf(line, "%.*s.", Wflag ? 39 : 16, ""); break; } - cp = index(line, '\0'); + cp = strchr(line, '\0'); if (!num_port && port) sp = getservbyport((int)port, "sctp"); if (sp || port == 0) Modified: head/usr.bin/rlogin/rlogin.c ============================================================================== --- head/usr.bin/rlogin/rlogin.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/usr.bin/rlogin/rlogin.c Tue Jan 3 18:51:58 2012 (r229403) @@ -142,7 +142,7 @@ main(int argc, char *argv[]) one = 1; host = localname = user = NULL; - if ((p = rindex(argv[0], '/'))) + if ((p = strrchr(argv[0], '/'))) ++p; else p = argv[0]; Modified: head/usr.bin/rpcgen/rpc_main.c ============================================================================== --- head/usr.bin/rpcgen/rpc_main.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/usr.bin/rpcgen/rpc_main.c Tue Jan 3 18:51:58 2012 (r229403) @@ -64,10 +64,6 @@ static void clnt_output(const char *, co static char *generate_guard(const char *); static void c_initialize(void); -#if !defined(__FreeBSD__) && !defined(__NetBSD__) -char * rindex(); -#endif - static void usage(void); static void options_usage(void); static int do_registers(int, const char **); @@ -233,7 +229,7 @@ extendfile(const char *path, const char const char *p; const char *file; - if ((file = rindex(path, '/')) == NULL) + if ((file = strrchr(path, '/')) == NULL) file = path; else file++; @@ -821,7 +817,7 @@ static void mkfile_output(struct command if (allfiles){ mkftemp = xmalloc(strlen("makefile.") + strlen(cmd->infile) + 1); - temp = (char *)rindex(cmd->infile, '.'); + temp = strrchr(cmd->infile, '.'); strcpy(mkftemp, "makefile."); (void) strncat(mkftemp, cmd->infile, (temp - cmd->infile)); Modified: head/usr.bin/systat/devs.c ============================================================================== --- head/usr.bin/systat/devs.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/usr.bin/systat/devs.c Tue Jan 3 18:51:58 2012 (r229403) @@ -265,7 +265,7 @@ dsselect(const char *args, devstat_selec specified_devices = (char **)malloc(sizeof(char *)); tmpstr = tmpstr1 = strdup(args); - cp = index(tmpstr1, '\n'); + cp = strchr(tmpstr1, '\n'); if (cp) *cp = '\0'; for (;;) { Modified: head/usr.bin/systat/netcmds.c ============================================================================== --- head/usr.bin/systat/netcmds.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/usr.bin/systat/netcmds.c Tue Jan 3 18:51:58 2012 (r229403) @@ -131,7 +131,7 @@ changeitems(const char *args, int onoff) struct in_addr in; tmpstr = tmpstr1 = strdup(args); - cp = index(tmpstr1, '\n'); + cp = strchr(tmpstr1, '\n'); if (cp) *cp = '\0'; for (;;tmpstr1 = cp) { Modified: head/usr.bin/systat/netstat.c ============================================================================== --- head/usr.bin/systat/netstat.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/usr.bin/systat/netstat.c Tue Jan 3 18:51:58 2012 (r229403) @@ -554,7 +554,7 @@ inetprint(struct sockaddr *sa, const cha break; } snprintf(line, sizeof(line), "%.*s.", 16, inetname(sa)); - cp = index(line, '\0'); + cp = strchr(line, '\0'); if (!nflag && port) sp = getservbyport(port, proto); if (sp || port == 0) @@ -564,7 +564,7 @@ inetprint(struct sockaddr *sa, const cha snprintf(cp, sizeof(line) - (cp - line), "%d", ntohs((u_short)port)); /* pad to full column to clear any garbage */ - cp = index(line, '\0'); + cp = strchr(line, '\0'); while (cp - line < 22) *cp++ = ' '; line[22] = '\0'; Modified: head/usr.bin/tftp/main.c ============================================================================== --- head/usr.bin/tftp/main.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/usr.bin/tftp/main.c Tue Jan 3 18:51:58 2012 (r229403) @@ -437,16 +437,16 @@ put(int argc, char *argv[]) return; } targ = argv[argc - 1]; - if (rindex(argv[argc - 1], ':')) { + if (strrchr(argv[argc - 1], ':')) { char *lcp; for (n = 1; n < argc - 1; n++) - if (index(argv[n], ':')) { + if (strchr(argv[n], ':')) { putusage(argv[0]); return; } lcp = argv[argc - 1]; - targ = rindex(lcp, ':'); + targ = strrchr(lcp, ':'); *targ++ = 0; if (lcp[0] == '[' && lcp[strlen(lcp) - 1] == ']') { lcp[strlen(lcp) - 1] = '\0'; @@ -477,7 +477,7 @@ put(int argc, char *argv[]) } /* this assumes the target is a directory */ /* on a remote unix system. hmmmm. */ - cp = index(targ, '\0'); + cp = strchr(targ, '\0'); *cp++ = '/'; for (n = 1; n < argc - 1; n++) { strcpy(cp, tail(argv[n])); @@ -532,7 +532,7 @@ get(int argc, char *argv[]) } if (!connected) { for (n = 1; n < argc ; n++) - if (rindex(argv[n], ':') == 0) { + if (strrchr(argv[n], ':') == 0) { printf("No remote host specified and " "no host given for file '%s'\n", argv[n]); getusage(argv[0]); @@ -540,7 +540,7 @@ get(int argc, char *argv[]) } } for (n = 1; n < argc ; n++) { - src = rindex(argv[n], ':'); + src = strrchr(argv[n], ':'); if (src == NULL) src = argv[n]; else { @@ -681,7 +681,7 @@ tail(char *filename) char *s; while (*filename) { - s = rindex(filename, '/'); + s = strrchr(filename, '/'); if (s == NULL) break; if (s[1]) Modified: head/usr.bin/tr/str.c ============================================================================== --- head/usr.bin/tr/str.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/usr.bin/tr/str.c Tue Jan 3 18:51:58 2012 (r229403) @@ -161,7 +161,7 @@ bracket(STR *s) repeat: if ((p = strpbrk(s->str + 2, "*]")) == NULL) return (0); - if (p[0] != '*' || index(p, ']') == NULL) + if (p[0] != '*' || strchr(p, ']') == NULL) return (0); s->str += 1; genseq(s); Modified: head/usr.bin/tset/map.c ============================================================================== --- head/usr.bin/tset/map.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/usr.bin/tset/map.c Tue Jan 3 18:51:58 2012 (r229403) @@ -132,7 +132,7 @@ next: if (*arg == ':') { goto badmopt; ++arg; } else { /* Optional baudrate. */ - arg = index(p = arg, ':'); + arg = strchr(p = arg, ':'); if (arg == NULL) goto badmopt; *arg++ = '\0'; Modified: head/usr.bin/tset/term.c ============================================================================== --- head/usr.bin/tset/term.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/usr.bin/tset/term.c Tue Jan 3 18:51:58 2012 (r229403) @@ -74,7 +74,7 @@ get_termcap_entry(char *userarg, char ** /* Try ttyname(3); check for dialup or other mapping. */ if ((ttypath = ttyname(STDERR_FILENO))) { - if ((p = rindex(ttypath, '/'))) + if ((p = strrchr(ttypath, '/'))) ++p; else p = ttypath; @@ -146,7 +146,7 @@ askuser(const char *dflt) return (dflt); } - if ((p = index(answer, '\n'))) + if ((p = strchr(answer, '\n'))) *p = '\0'; if (answer[0]) return (answer); Modified: head/usr.bin/tset/wrterm.c ============================================================================== --- head/usr.bin/tset/wrterm.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/usr.bin/tset/wrterm.c Tue Jan 3 18:51:58 2012 (r229403) @@ -56,7 +56,7 @@ wrtermcap(char *bp) char *t, *sep; /* Find the end of the terminal names. */ - if ((t = index(bp, ':')) == NULL) + if ((t = strchr(bp, ':')) == NULL) errx(1, "termcap names not colon terminated"); *t++ = '\0'; Modified: head/usr.sbin/bootparamd/bootparamd/bootparamd.c ============================================================================== --- head/usr.sbin/bootparamd/bootparamd/bootparamd.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/usr.sbin/bootparamd/bootparamd/bootparamd.c Tue Jan 3 18:51:58 2012 (r229403) @@ -114,7 +114,7 @@ bp_getfile_res * bp_getfile_arg *getfile; struct svc_req *req; { - char *where, *index(); + char *where; static bp_getfile_res res; if (debug) @@ -133,7 +133,7 @@ struct svc_req *req; askname[sizeof(askname)-1] = 0; if (getthefile(askname, getfile->file_id,buffer,sizeof(buffer))) { - if ( (where = index(buffer,':')) ) { + if ( (where = strchr(buffer,':')) ) { /* buffer is re-written to contain the name of the info of file */ strncpy(hostname, buffer, where - buffer); hostname[where - buffer] = '\0'; Modified: head/usr.sbin/config/main.c ============================================================================== --- head/usr.sbin/config/main.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/usr.sbin/config/main.c Tue Jan 3 18:51:58 2012 (r229403) @@ -626,7 +626,7 @@ remember(const char *file) else s = ns(file); - if (index(s, '_') && strncmp(s, "opt_", 4) != 0) { + if (strchr(s, '_') && strncmp(s, "opt_", 4) != 0) { free(s); return; } Modified: head/usr.sbin/config/mkmakefile.c ============================================================================== --- head/usr.sbin/config/mkmakefile.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/usr.sbin/config/mkmakefile.c Tue Jan 3 18:51:58 2012 (r229403) @@ -206,12 +206,12 @@ makehints(void) err(1, "%s", hint->hint_name); while (fgets(line, BUFSIZ, ifp) != 0) { /* zap trailing CR and/or LF */ - while ((s = rindex(line, '\n')) != NULL) + while ((s = strrchr(line, '\n')) != NULL) *s = '\0'; - while ((s = rindex(line, '\r')) != NULL) + while ((s = strrchr(line, '\r')) != NULL) *s = '\0'; /* remove # comments */ - s = index(line, '#'); + s = strchr(line, '#'); if (s) *s = '\0'; /* remove any whitespace and " characters */ @@ -268,12 +268,12 @@ makeenv(void) if (ifp) { while (fgets(line, BUFSIZ, ifp) != 0) { /* zap trailing CR and/or LF */ - while ((s = rindex(line, '\n')) != NULL) + while ((s = strrchr(line, '\n')) != NULL) *s = '\0'; - while ((s = rindex(line, '\r')) != NULL) + while ((s = strrchr(line, '\r')) != NULL) *s = '\0'; /* remove # comments */ - s = index(line, '#'); + s = strchr(line, '#'); if (s) *s = '\0'; /* remove any whitespace and " characters */ @@ -689,7 +689,7 @@ tail(char *fn) { char *cp; - cp = rindex(fn, '/'); + cp = strrchr(fn, '/'); if (cp == 0) return (fn); return (cp+1); Modified: head/usr.sbin/inetd/inetd.c ============================================================================== --- head/usr.sbin/inetd/inetd.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/usr.sbin/inetd/inetd.c Tue Jan 3 18:51:58 2012 (r229403) @@ -1764,7 +1764,7 @@ more: sep->se_rpc_lowvers = 0; memcpy(&sep->se_ctrladdr4, bind_sa4, sizeof(sep->se_ctrladdr4)); - if ((versp = rindex(sep->se_service, '/'))) { + if ((versp = strrchr(sep->se_service, '/'))) { *versp++ = '\0'; switch (sscanf(versp, "%u-%u", &sep->se_rpc_lowvers, @@ -1936,7 +1936,7 @@ more: } else sep->se_group = NULL; sep->se_server = newstr(sskip(&cp)); - if ((sep->se_server_name = rindex(sep->se_server, '/'))) + if ((sep->se_server_name = strrchr(sep->se_server, '/'))) sep->se_server_name++; if (strcmp(sep->se_server, "internal") == 0) { struct biltin *bi; Modified: head/usr.sbin/ipfwpcap/ipfwpcap.c ============================================================================== --- head/usr.sbin/ipfwpcap/ipfwpcap.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/usr.sbin/ipfwpcap/ipfwpcap.c Tue Jan 3 18:51:58 2012 (r229403) @@ -87,7 +87,7 @@ okay(int pn) char *p, numbuf[80]; if (pidfile[0] == '\0') { - p = rindex(prog, '/'); + p = strrchr(prog, '/'); p = (p == NULL) ? prog : p + 1; snprintf(pidfile, sizeof pidfile, Modified: head/usr.sbin/mtree/spec.c ============================================================================== --- head/usr.sbin/mtree/spec.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/usr.sbin/mtree/spec.c Tue Jan 3 18:51:58 2012 (r229403) @@ -73,7 +73,7 @@ mtree_readspec(FILE *fi) continue; /* Find end of line. */ - if ((p = index(buf, '\n')) == NULL) + if ((p = strchr(buf, '\n')) == NULL) errx(1, "line %d too long", lineno); /* See if next line is continuation line. */ @@ -118,7 +118,7 @@ mtree_readspec(FILE *fi) continue; } - if (index(p, '/')) + if (strchr(p, '/')) errx(1, "line %d: slash character in file name", lineno); Modified: head/usr.sbin/newsyslog/newsyslog.c ============================================================================== --- head/usr.sbin/newsyslog/newsyslog.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/usr.sbin/newsyslog/newsyslog.c Tue Jan 3 18:51:58 2012 (r229403) @@ -1710,7 +1710,7 @@ do_rotate(const struct conf_entry *ent) } else { /* relative */ /* get directory part of logfile */ strlcpy(dirpart, ent->log, sizeof(dirpart)); - if ((p = rindex(dirpart, '/')) == NULL) + if ((p = strrchr(dirpart, '/')) == NULL) dirpart[0] = '\0'; else *(p + 1) = '\0'; @@ -1722,7 +1722,7 @@ do_rotate(const struct conf_entry *ent) createdir(ent, dirpart); /* get filename part of logfile */ - if ((p = rindex(ent->log, '/')) == NULL) + if ((p = strrchr(ent->log, '/')) == NULL) strlcpy(namepart, ent->log, sizeof(namepart)); else strlcpy(namepart, p + 1, sizeof(namepart)); @@ -2255,7 +2255,7 @@ age_old_log(char *file) } else { /* relative */ /* get directory part of logfile */ strlcpy(tmp, file, sizeof(tmp)); - if ((p = rindex(tmp, '/')) == NULL) + if ((p = strrchr(tmp, '/')) == NULL) tmp[0] = '\0'; else *(p + 1) = '\0'; @@ -2265,7 +2265,7 @@ age_old_log(char *file) strlcat(tmp, "/", sizeof(tmp)); /* get filename part of logfile */ - if ((p = rindex(file, '/')) == NULL) + if ((p = strrchr(file, '/')) == NULL) strlcat(tmp, file, sizeof(tmp)); else strlcat(tmp, p + 1, sizeof(tmp)); Modified: head/usr.sbin/rwhod/rwhod.c ============================================================================== --- head/usr.sbin/rwhod/rwhod.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/usr.sbin/rwhod/rwhod.c Tue Jan 3 18:51:58 2012 (r229403) @@ -227,7 +227,7 @@ main(int argc, char *argv[]) syslog(LOG_ERR, "gethostname: %m"); exit(1); } - if ((cp = index(myname, '.')) != NULL) + if ((cp = strchr(myname, '.')) != NULL) *cp = '\0'; strncpy(mywd.wd_hostname, myname, sizeof(mywd.wd_hostname) - 1); mywd.wd_hostname[sizeof(mywd.wd_hostname) - 1] = '\0'; Modified: head/usr.sbin/sade/variable.c ============================================================================== --- head/usr.sbin/sade/variable.c Tue Jan 3 18:49:39 2012 (r229402) +++ head/usr.sbin/sade/variable.c Tue Jan 3 18:51:58 2012 (r229403) @@ -83,7 +83,7 @@ variable_set(char *var, int dirty) else if (!*var) msgDebug("Warning: Zero length name & value passed to variable_set()\n"); SAFE_STRCPY(tmp, var); - if ((cp = index(tmp, '=')) == NULL) + if ((cp = strchr(tmp, '=')) == NULL) msgFatal("Invalid variable format: %s", var); *(cp++) = '\0'; make_variable(tmp, string_skipwhite(cp), dirty); @@ -123,7 +123,7 @@ variable_unset(char *var) Variable *vp; char name[512], *cp; - if ((cp = index(var, '=')) != NULL) + if ((cp = strchr(var, '=')) != NULL) sstrncpy(name, var, cp - var); else SAFE_STRCPY(name, var); @@ -189,14 +189,14 @@ variable_check2(char *data) if (data == NULL) return -1; SAFE_STRCPY(tmp, data); - if ((cp = index(tmp, '=')) != NULL) { + if ((cp = strchr(tmp, '=')) != NULL) { *(cp++) = '\0'; if (*cp == '"') { /* smash quotes if present */ ++cp; - if ((cp3 = index(cp, '"')) != NULL) + if ((cp3 = strchr(cp, '"')) != NULL) *cp3 = '\0'; } - else if ((cp3 = index(cp, ',')) != NULL) + else if ((cp3 = strchr(cp, ',')) != NULL) *cp3 = '\0'; cp2 = variable_get(tmp); if (cp2 != NULL) { @@ -305,7 +305,7 @@ pvariable_set(char *var) msgDebug("Warning: Zero length name & value passed to variable_set()\n"); /* Add a trivial namespace to whatever name the caller chooses. */ SAFE_STRCPY(tmp, "SYSINSTALL_PVAR"); - if (index(var, '=') == NULL) + if (strchr(var, '=') == NULL) msgFatal("Invalid variable format: %s", var); strlcat(tmp, var, 1024); p = strchr(tmp, '='); From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 18:58:20 2012 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 AFC0B106566C; Tue, 3 Jan 2012 18:58:20 +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 9C7678FC12; Tue, 3 Jan 2012 18:58:20 +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 q03IwKZp037343; Tue, 3 Jan 2012 18:58:20 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03IwK1r037340; Tue, 3 Jan 2012 18:58:20 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201031858.q03IwK1r037340@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 18:58:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229404 - stable/9/sys/dev/ti 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, 03 Jan 2012 18:58:20 -0000 Author: yongari Date: Tue Jan 3 18:58:20 2012 New Revision: 229404 URL: http://svn.freebsd.org/changeset/base/229404 Log: MFC r227086-227089: r227086: Use ANSI function definations. r227087: No functional changes. r227088: Make ti(4) build with 'options TI_PRIVATE_JUMBOS'. This was broken in r175872. We have a UMA backed jumbo allocator and that is much better implementation than having a local jumbo buffer allocator in driver. This local allocator would be removed in near future but fixing build before removal wouldn't be a bad idea. r227089: s/u_intXX_t/uintXX_t/g Modified: stable/9/sys/dev/ti/if_ti.c stable/9/sys/dev/ti/if_tireg.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/ti/if_ti.c ============================================================================== --- stable/9/sys/dev/ti/if_ti.c Tue Jan 3 18:51:58 2012 (r229403) +++ stable/9/sys/dev/ti/if_ti.c Tue Jan 3 18:58:20 2012 (r229404) @@ -140,7 +140,6 @@ typedef enum { TI_SWAP_NTOH } ti_swap_type; - /* * Various supported device vendors/types and their names. */ @@ -199,20 +198,21 @@ static int ti_shutdown(device_t); static int ti_ifmedia_upd(struct ifnet *); static void ti_ifmedia_sts(struct ifnet *, struct ifmediareq *); -static u_int32_t ti_eeprom_putbyte(struct ti_softc *, int); -static u_int8_t ti_eeprom_getbyte(struct ti_softc *, int, u_int8_t *); +static uint32_t ti_eeprom_putbyte(struct ti_softc *, int); +static uint8_t ti_eeprom_getbyte(struct ti_softc *, int, uint8_t *); static int ti_read_eeprom(struct ti_softc *, caddr_t, int, int); static void ti_add_mcast(struct ti_softc *, struct ether_addr *); static void ti_del_mcast(struct ti_softc *, struct ether_addr *); static void ti_setmulti(struct ti_softc *); -static void ti_mem_read(struct ti_softc *, u_int32_t, u_int32_t, void *); -static void ti_mem_write(struct ti_softc *, u_int32_t, u_int32_t, void *); -static void ti_mem_zero(struct ti_softc *, u_int32_t, u_int32_t); -static int ti_copy_mem(struct ti_softc *, u_int32_t, u_int32_t, caddr_t, int, int); -static int ti_copy_scratch(struct ti_softc *, u_int32_t, u_int32_t, caddr_t, - int, int, int); +static void ti_mem_read(struct ti_softc *, uint32_t, uint32_t, void *); +static void ti_mem_write(struct ti_softc *, uint32_t, uint32_t, void *); +static void ti_mem_zero(struct ti_softc *, uint32_t, uint32_t); +static int ti_copy_mem(struct ti_softc *, uint32_t, uint32_t, caddr_t, int, + int); +static int ti_copy_scratch(struct ti_softc *, uint32_t, uint32_t, caddr_t, + int, int, int); static int ti_bcopy_swap(const void *, void *, size_t, ti_swap_type); static void ti_loadfw(struct ti_softc *); static void ti_cmd(struct ti_softc *, struct ti_cmd_desc *); @@ -242,8 +242,8 @@ static int ti_chipinit(struct ti_softc * static int ti_gibinit(struct ti_softc *); #ifdef TI_JUMBO_HDRSPLIT -static __inline void ti_hdr_split (struct mbuf *top, int hdr_len, - int pkt_len, int idx); +static __inline void ti_hdr_split(struct mbuf *top, int hdr_len, int pkt_len, + int idx); #endif /* TI_JUMBO_HDRSPLIT */ static device_method_t ti_methods[] = { @@ -270,11 +270,10 @@ MODULE_DEPEND(ti, ether, 1, 1, 1); /* * Send an instruction or address to the EEPROM, check for ACK. */ -static u_int32_t ti_eeprom_putbyte(sc, byte) - struct ti_softc *sc; - int byte; +static uint32_t +ti_eeprom_putbyte(struct ti_softc *sc, int byte) { - int i, ack = 0; + int i, ack = 0; /* * Make sure we're in TX mode. @@ -316,13 +315,11 @@ static u_int32_t ti_eeprom_putbyte(sc, b * We have to send two address bytes since the EEPROM can hold * more than 256 bytes of data. */ -static u_int8_t ti_eeprom_getbyte(sc, addr, dest) - struct ti_softc *sc; - int addr; - u_int8_t *dest; +static uint8_t +ti_eeprom_getbyte(struct ti_softc *sc, int addr, uint8_t *dest) { - int i; - u_int8_t byte = 0; + int i; + uint8_t byte = 0; EEPROM_START; @@ -393,14 +390,10 @@ static u_int8_t ti_eeprom_getbyte(sc, ad * Read a sequence of bytes from the EEPROM. */ static int -ti_read_eeprom(sc, dest, off, cnt) - struct ti_softc *sc; - caddr_t dest; - int off; - int cnt; +ti_read_eeprom(struct ti_softc *sc, caddr_t dest, int off, int cnt) { - int err = 0, i; - u_int8_t byte = 0; + int err = 0, i; + uint8_t byte = 0; for (i = 0; i < cnt; i++) { err = ti_eeprom_getbyte(sc, off + i, &byte); @@ -417,13 +410,10 @@ ti_read_eeprom(sc, dest, off, cnt) * Can be used to copy data from NIC local memory. */ static void -ti_mem_read(sc, addr, len, buf) - struct ti_softc *sc; - u_int32_t addr, len; - void *buf; +ti_mem_read(struct ti_softc *sc, uint32_t addr, uint32_t len, void *buf) { - int segptr, segsize, cnt; - char *ptr; + int segptr, segsize, cnt; + char *ptr; segptr = addr; cnt = len; @@ -436,7 +426,7 @@ ti_mem_read(sc, addr, len, buf) segsize = TI_WINLEN - (segptr % TI_WINLEN); CSR_WRITE_4(sc, TI_WINBASE, (segptr & ~(TI_WINLEN - 1))); bus_space_read_region_4(sc->ti_btag, sc->ti_bhandle, - TI_WINDOW + (segptr & (TI_WINLEN - 1)), (u_int32_t *)ptr, + TI_WINDOW + (segptr & (TI_WINLEN - 1)), (uint32_t *)ptr, segsize / 4); ptr += segsize; segptr += segsize; @@ -450,13 +440,10 @@ ti_mem_read(sc, addr, len, buf) * Can be used to copy data into NIC local memory. */ static void -ti_mem_write(sc, addr, len, buf) - struct ti_softc *sc; - u_int32_t addr, len; - void *buf; +ti_mem_write(struct ti_softc *sc, uint32_t addr, uint32_t len, void *buf) { - int segptr, segsize, cnt; - char *ptr; + int segptr, segsize, cnt; + char *ptr; segptr = addr; cnt = len; @@ -469,7 +456,7 @@ ti_mem_write(sc, addr, len, buf) segsize = TI_WINLEN - (segptr % TI_WINLEN); CSR_WRITE_4(sc, TI_WINBASE, (segptr & ~(TI_WINLEN - 1))); bus_space_write_region_4(sc->ti_btag, sc->ti_bhandle, - TI_WINDOW + (segptr & (TI_WINLEN - 1)), (u_int32_t *)ptr, + TI_WINDOW + (segptr & (TI_WINLEN - 1)), (uint32_t *)ptr, segsize / 4); ptr += segsize; segptr += segsize; @@ -482,11 +469,9 @@ ti_mem_write(sc, addr, len, buf) * Can be used to clear a section of NIC local memory. */ static void -ti_mem_zero(sc, addr, len) - struct ti_softc *sc; - u_int32_t addr, len; +ti_mem_zero(struct ti_softc *sc, uint32_t addr, uint32_t len) { - int segptr, segsize, cnt; + int segptr, segsize, cnt; segptr = addr; cnt = len; @@ -505,18 +490,15 @@ ti_mem_zero(sc, addr, len) } static int -ti_copy_mem(sc, tigon_addr, len, buf, useraddr, readdata) - struct ti_softc *sc; - u_int32_t tigon_addr, len; - caddr_t buf; - int useraddr, readdata; -{ - int segptr, segsize, cnt; - caddr_t ptr; - u_int32_t origwin; - u_int8_t tmparray[TI_WINLEN], tmparray2[TI_WINLEN]; - int resid, segresid; - int first_pass; +ti_copy_mem(struct ti_softc *sc, uint32_t tigon_addr, uint32_t len, + caddr_t buf, int useraddr, int readdata) +{ + int segptr, segsize, cnt; + caddr_t ptr; + uint32_t origwin; + uint8_t tmparray[TI_WINLEN], tmparray2[TI_WINLEN]; + int resid, segresid; + int first_pass; TI_LOCK_ASSERT(sc); @@ -577,7 +559,7 @@ ti_copy_mem(sc, tigon_addr, len, buf, us bus_space_read_region_4(sc->ti_btag, sc->ti_bhandle, ti_offset, - (u_int32_t *)tmparray, + (uint32_t *)tmparray, segsize >> 2); if (useraddr) { /* @@ -624,7 +606,7 @@ ti_copy_mem(sc, tigon_addr, len, buf, us bus_space_write_region_4(sc->ti_btag, sc->ti_bhandle, ti_offset, - (u_int32_t *)tmparray, + (uint32_t *)tmparray, segsize >> 2); } segptr += segsize; @@ -636,7 +618,7 @@ ti_copy_mem(sc, tigon_addr, len, buf, us * Handle leftover, non-word-aligned bytes. */ if (resid != 0) { - u_int32_t tmpval, tmpval2; + uint32_t tmpval, tmpval2; bus_size_t ti_offset; /* @@ -704,17 +686,13 @@ ti_copy_mem(sc, tigon_addr, len, buf, us } static int -ti_copy_scratch(sc, tigon_addr, len, buf, useraddr, readdata, cpu) - struct ti_softc *sc; - u_int32_t tigon_addr, len; - caddr_t buf; - int useraddr, readdata; - int cpu; -{ - u_int32_t segptr; - int cnt; - u_int32_t tmpval, tmpval2; - caddr_t ptr; +ti_copy_scratch(struct ti_softc *sc, uint32_t tigon_addr, uint32_t len, + caddr_t buf, int useraddr, int readdata, int cpu) +{ + uint32_t segptr; + int cnt; + uint32_t tmpval, tmpval2; + caddr_t ptr; TI_LOCK_ASSERT(sc); @@ -802,14 +780,10 @@ ti_copy_scratch(sc, tigon_addr, len, buf } static int -ti_bcopy_swap(src, dst, len, swap_type) - const void *src; - void *dst; - size_t len; - ti_swap_type swap_type; +ti_bcopy_swap(const void *src, void *dst, size_t len, ti_swap_type swap_type) { - const u_int8_t *tmpsrc; - u_int8_t *tmpdst; + const uint8_t *tmpsrc; + uint8_t *tmpdst; size_t tmplen; if (len & 0x3) { @@ -824,11 +798,11 @@ ti_bcopy_swap(src, dst, len, swap_type) while (tmplen) { if (swap_type == TI_SWAP_NTOH) - *(u_int32_t *)tmpdst = - ntohl(*(const u_int32_t *)tmpsrc); + *(uint32_t *)tmpdst = + ntohl(*(const uint32_t *)tmpsrc); else - *(u_int32_t *)tmpdst = - htonl(*(const u_int32_t *)tmpsrc); + *(uint32_t *)tmpdst = + htonl(*(const uint32_t *)tmpsrc); tmpsrc += 4; tmpdst += 4; @@ -844,8 +818,7 @@ ti_bcopy_swap(src, dst, len, swap_type) * Tigon 2. */ static void -ti_loadfw(sc) - struct ti_softc *sc; +ti_loadfw(struct ti_softc *sc) { TI_LOCK_ASSERT(sc); @@ -902,14 +875,12 @@ ti_loadfw(sc) * Send the NIC a command via the command ring. */ static void -ti_cmd(sc, cmd) - struct ti_softc *sc; - struct ti_cmd_desc *cmd; +ti_cmd(struct ti_softc *sc, struct ti_cmd_desc *cmd) { - int index; + int index; index = sc->ti_cmd_saved_prodidx; - CSR_WRITE_4(sc, TI_GCR_CMDRING + (index * 4), *(u_int32_t *)(cmd)); + CSR_WRITE_4(sc, TI_GCR_CMDRING + (index * 4), *(uint32_t *)(cmd)); TI_INC(index, TI_CMD_RING_CNT); CSR_WRITE_4(sc, TI_MB_CMDPROD_IDX, index); sc->ti_cmd_saved_prodidx = index; @@ -920,21 +891,17 @@ ti_cmd(sc, cmd) * number of command slots to include after the initial command. */ static void -ti_cmd_ext(sc, cmd, arg, len) - struct ti_softc *sc; - struct ti_cmd_desc *cmd; - caddr_t arg; - int len; +ti_cmd_ext(struct ti_softc *sc, struct ti_cmd_desc *cmd, caddr_t arg, int len) { - int index; - int i; + int index; + int i; index = sc->ti_cmd_saved_prodidx; - CSR_WRITE_4(sc, TI_GCR_CMDRING + (index * 4), *(u_int32_t *)(cmd)); + CSR_WRITE_4(sc, TI_GCR_CMDRING + (index * 4), *(uint32_t *)(cmd)); TI_INC(index, TI_CMD_RING_CNT); for (i = 0; i < len; i++) { CSR_WRITE_4(sc, TI_GCR_CMDRING + (index * 4), - *(u_int32_t *)(&arg[i * 4])); + *(uint32_t *)(&arg[i * 4])); TI_INC(index, TI_CMD_RING_CNT); } CSR_WRITE_4(sc, TI_MB_CMDPROD_IDX, index); @@ -945,10 +912,9 @@ ti_cmd_ext(sc, cmd, arg, len) * Handle events that have triggered interrupts. */ static void -ti_handle_events(sc) - struct ti_softc *sc; +ti_handle_events(struct ti_softc *sc) { - struct ti_event_desc *e; + struct ti_event_desc *e; if (sc->ti_rdata->ti_event_ring == NULL) return; @@ -1089,12 +1055,11 @@ ti_free_dmamaps(struct ti_softc *sc) */ static int -ti_alloc_jumbo_mem(sc) - struct ti_softc *sc; +ti_alloc_jumbo_mem(struct ti_softc *sc) { - caddr_t ptr; - int i; - struct ti_jpool_entry *entry; + struct ti_jpool_entry *entry; + caddr_t ptr; + int i; /* * Grab a big chunk o' storage. Since we are chopping this pool up @@ -1152,10 +1117,9 @@ ti_alloc_jumbo_mem(sc) /* * Allocate a jumbo buffer. */ -static void *ti_jalloc(sc) - struct ti_softc *sc; +static void *ti_jalloc(struct ti_softc *sc) { - struct ti_jpool_entry *entry; + struct ti_jpool_entry *entry; entry = SLIST_FIRST(&sc->ti_jfree_listhead); @@ -1173,13 +1137,11 @@ static void *ti_jalloc(sc) * Release a jumbo buffer. */ static void -ti_jfree(buf, args) - void *buf; - void *args; -{ - struct ti_softc *sc; - int i; - struct ti_jpool_entry *entry; +ti_jfree(void *buf, void *args) +{ + struct ti_softc *sc; + int i; + struct ti_jpool_entry *entry; /* Extract the softc struct pointer. */ sc = (struct ti_softc *)args; @@ -1205,8 +1167,7 @@ ti_jfree(buf, args) #else static int -ti_alloc_jumbo_mem(sc) - struct ti_softc *sc; +ti_alloc_jumbo_mem(struct ti_softc *sc) { /* @@ -1237,16 +1198,13 @@ ti_alloc_jumbo_mem(sc) * Intialize a standard receive ring descriptor. */ static int -ti_newbuf_std(sc, i, m) - struct ti_softc *sc; - int i; - struct mbuf *m; -{ - bus_dmamap_t map; - bus_dma_segment_t segs; - struct mbuf *m_new = NULL; - struct ti_rx_desc *r; - int nsegs; +ti_newbuf_std(struct ti_softc *sc, int i, struct mbuf *m) +{ + bus_dmamap_t map; + bus_dma_segment_t segs; + struct mbuf *m_new = NULL; + struct ti_rx_desc *r; + int nsegs; nsegs = 0; if (m == NULL) { @@ -1292,16 +1250,13 @@ ti_newbuf_std(sc, i, m) * the Tigon 2. */ static int -ti_newbuf_mini(sc, i, m) - struct ti_softc *sc; - int i; - struct mbuf *m; -{ - bus_dma_segment_t segs; - bus_dmamap_t map; - struct mbuf *m_new = NULL; - struct ti_rx_desc *r; - int nsegs; +ti_newbuf_mini(struct ti_softc *sc, int i, struct mbuf *m) +{ + bus_dma_segment_t segs; + bus_dmamap_t map; + struct mbuf *m_new = NULL; + struct ti_rx_desc *r; + int nsegs; nsegs = 0; if (m == NULL) { @@ -1344,19 +1299,16 @@ ti_newbuf_mini(sc, i, m) * a jumbo buffer from the pool managed internally by the driver. */ static int -ti_newbuf_jumbo(sc, i, m) - struct ti_softc *sc; - int i; - struct mbuf *m; -{ - bus_dmamap_t map; - struct mbuf *m_new = NULL; - struct ti_rx_desc *r; - int nsegs; - bus_dma_segment_t segs; +ti_newbuf_jumbo(struct ti_softc *sc, int i, struct mbuf *m) +{ + bus_dmamap_t map; + struct mbuf *m_new = NULL; + struct ti_rx_desc *r; + int nsegs; + bus_dma_segment_t segs; if (m == NULL) { - caddr_t *buf = NULL; + caddr_t *buf = NULL; /* Allocate the mbuf. */ MGETHDR(m_new, M_DONTWAIT, MT_DATA); @@ -1376,7 +1328,7 @@ ti_newbuf_jumbo(sc, i, m) /* Attach the buffer to the mbuf. */ m_new->m_data = (void *) buf; m_new->m_len = m_new->m_pkthdr.len = TI_JUMBO_FRAMELEN; - MEXTADD(m_new, buf, TI_JUMBO_FRAMELEN, ti_jfree, + MEXTADD(m_new, buf, TI_JUMBO_FRAMELEN, ti_jfree, buf, (struct ti_softc *)sc, 0, EXT_NET_DRV); } else { m_new = m; @@ -1417,30 +1369,26 @@ ti_newbuf_jumbo(sc, i, m) #define TCP_HDR_LEN (52 + sizeof(struct ether_header)) #define UDP_HDR_LEN (28 + sizeof(struct ether_header)) #define NFS_HDR_LEN (UDP_HDR_LEN) -static int HDR_LEN = TCP_HDR_LEN; - +static int HDR_LEN = TCP_HDR_LEN; /* * Initialize a jumbo receive ring descriptor. This allocates * a jumbo buffer from the pool managed internally by the driver. */ static int -ti_newbuf_jumbo(sc, idx, m_old) - struct ti_softc *sc; - int idx; - struct mbuf *m_old; -{ - bus_dmamap_t map; - struct mbuf *cur, *m_new = NULL; - struct mbuf *m[3] = {NULL, NULL, NULL}; - struct ti_rx_desc_ext *r; - vm_page_t frame; - static int color; - /* 1 extra buf to make nobufs easy*/ - struct sf_buf *sf[3] = {NULL, NULL, NULL}; - int i; - bus_dma_segment_t segs[4]; - int nsegs; +ti_newbuf_jumbo(struct ti_softc *sc, int idx, struct mbuf *m_old) +{ + bus_dmamap_t map; + struct mbuf *cur, *m_new = NULL; + struct mbuf *m[3] = {NULL, NULL, NULL}; + struct ti_rx_desc_ext *r; + vm_page_t frame; + static int color; + /* 1 extra buf to make nobufs easy*/ + struct sf_buf *sf[3] = {NULL, NULL, NULL}; + int i; + bus_dma_segment_t segs[4]; + int nsegs; if (m_old != NULL) { m_new = m_old; @@ -1573,8 +1521,6 @@ nobufs: } #endif - - /* * The standard receive ring has 512 entries in it. At 2K per mbuf cluster, * that's 1MB or memory, which is a lot. For now, we fill only the first @@ -1582,11 +1528,10 @@ nobufs: * the NIC. */ static int -ti_init_rx_ring_std(sc) - struct ti_softc *sc; +ti_init_rx_ring_std(struct ti_softc *sc) { - int i; - struct ti_cmd_desc cmd; + int i; + struct ti_cmd_desc cmd; for (i = 0; i < TI_SSLOTS; i++) { if (ti_newbuf_std(sc, i, NULL) == ENOBUFS) @@ -1600,11 +1545,10 @@ ti_init_rx_ring_std(sc) } static void -ti_free_rx_ring_std(sc) - struct ti_softc *sc; +ti_free_rx_ring_std(struct ti_softc *sc) { - bus_dmamap_t map; - int i; + bus_dmamap_t map; + int i; for (i = 0; i < TI_STD_RX_RING_CNT; i++) { if (sc->ti_cdata.ti_rx_std_chain[i] != NULL) { @@ -1621,11 +1565,10 @@ ti_free_rx_ring_std(sc) } static int -ti_init_rx_ring_jumbo(sc) - struct ti_softc *sc; +ti_init_rx_ring_jumbo(struct ti_softc *sc) { - int i; - struct ti_cmd_desc cmd; + struct ti_cmd_desc cmd; + int i; for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) { if (ti_newbuf_jumbo(sc, i, NULL) == ENOBUFS) @@ -1639,11 +1582,10 @@ ti_init_rx_ring_jumbo(sc) } static void -ti_free_rx_ring_jumbo(sc) - struct ti_softc *sc; +ti_free_rx_ring_jumbo(struct ti_softc *sc) { - bus_dmamap_t map; - int i; + bus_dmamap_t map; + int i; for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) { if (sc->ti_cdata.ti_rx_jumbo_chain[i] != NULL) { @@ -1660,10 +1602,9 @@ ti_free_rx_ring_jumbo(sc) } static int -ti_init_rx_ring_mini(sc) - struct ti_softc *sc; +ti_init_rx_ring_mini(struct ti_softc *sc) { - int i; + int i; for (i = 0; i < TI_MSLOTS; i++) { if (ti_newbuf_mini(sc, i, NULL) == ENOBUFS) @@ -1677,11 +1618,10 @@ ti_init_rx_ring_mini(sc) } static void -ti_free_rx_ring_mini(sc) - struct ti_softc *sc; +ti_free_rx_ring_mini(struct ti_softc *sc) { - bus_dmamap_t map; - int i; + bus_dmamap_t map; + int i; for (i = 0; i < TI_MINI_RX_RING_CNT; i++) { if (sc->ti_cdata.ti_rx_mini_chain[i] != NULL) { @@ -1698,11 +1638,10 @@ ti_free_rx_ring_mini(sc) } static void -ti_free_tx_ring(sc) - struct ti_softc *sc; +ti_free_tx_ring(struct ti_softc *sc) { - struct ti_txdesc *txd; - int i; + struct ti_txdesc *txd; + int i; if (sc->ti_rdata->ti_tx_ring == NULL) return; @@ -1722,11 +1661,10 @@ ti_free_tx_ring(sc) } static int -ti_init_tx_ring(sc) - struct ti_softc *sc; +ti_init_tx_ring(struct ti_softc *sc) { - struct ti_txdesc *txd; - int i; + struct ti_txdesc *txd; + int i; STAILQ_INIT(&sc->ti_cdata.ti_txfreeq); STAILQ_INIT(&sc->ti_cdata.ti_txbusyq); @@ -1747,15 +1685,13 @@ ti_init_tx_ring(sc) * work. */ static void -ti_add_mcast(sc, addr) - struct ti_softc *sc; - struct ether_addr *addr; -{ - struct ti_cmd_desc cmd; - u_int16_t *m; - u_int32_t ext[2] = {0, 0}; +ti_add_mcast(struct ti_softc *sc, struct ether_addr *addr) +{ + struct ti_cmd_desc cmd; + uint16_t *m; + uint32_t ext[2] = {0, 0}; - m = (u_int16_t *)&addr->octet[0]; + m = (uint16_t *)&addr->octet[0]; switch (sc->ti_hwrev) { case TI_HWREV_TIGON: @@ -1775,15 +1711,13 @@ ti_add_mcast(sc, addr) } static void -ti_del_mcast(sc, addr) - struct ti_softc *sc; - struct ether_addr *addr; -{ - struct ti_cmd_desc cmd; - u_int16_t *m; - u_int32_t ext[2] = {0, 0}; +ti_del_mcast(struct ti_softc *sc, struct ether_addr *addr) +{ + struct ti_cmd_desc cmd; + uint16_t *m; + uint32_t ext[2] = {0, 0}; - m = (u_int16_t *)&addr->octet[0]; + m = (uint16_t *)&addr->octet[0]; switch (sc->ti_hwrev) { case TI_HWREV_TIGON: @@ -1817,14 +1751,13 @@ ti_del_mcast(sc, addr) * any given time. */ static void -ti_setmulti(sc) - struct ti_softc *sc; +ti_setmulti(struct ti_softc *sc) { - struct ifnet *ifp; - struct ifmultiaddr *ifma; - struct ti_cmd_desc cmd; - struct ti_mc_entry *mc; - u_int32_t intrs; + struct ifnet *ifp; + struct ifmultiaddr *ifma; + struct ti_cmd_desc cmd; + struct ti_mc_entry *mc; + uint32_t intrs; TI_LOCK_ASSERT(sc); @@ -1877,9 +1810,9 @@ ti_setmulti(sc) * around it on the Tigon 2 by setting a bit in the PCI state register, * but for the Tigon 1 we must give up and abort the interface attach. */ -static int ti_64bitslot_war(sc) - struct ti_softc *sc; +static int ti_64bitslot_war(struct ti_softc *sc) { + if (!(CSR_READ_4(sc, TI_PCI_STATE) & TI_PCISTATE_32BIT_BUS)) { CSR_WRITE_4(sc, 0x600, 0); CSR_WRITE_4(sc, 0x604, 0); @@ -1903,12 +1836,11 @@ static int ti_64bitslot_war(sc) * self-test results. */ static int -ti_chipinit(sc) - struct ti_softc *sc; +ti_chipinit(struct ti_softc *sc) { - u_int32_t cacheline; - u_int32_t pci_writemax = 0; - u_int32_t hdrsplit; + uint32_t cacheline; + uint32_t pci_writemax = 0; + uint32_t hdrsplit; /* Initialize link to down state. */ sc->ti_linkstat = TI_EV_CODE_LINK_DOWN; @@ -2057,13 +1989,12 @@ ti_chipinit(sc) * start the CPU(s) running. */ static int -ti_gibinit(sc) - struct ti_softc *sc; +ti_gibinit(struct ti_softc *sc) { - struct ti_rcb *rcb; - int i; - struct ifnet *ifp; - uint32_t rdphys; + struct ifnet *ifp; + struct ti_rcb *rcb; + uint32_t rdphys; + int i; TI_LOCK_ASSERT(sc); @@ -2244,16 +2175,15 @@ ti_rdata_cb(void *arg, bus_dma_segment_t sc->ti_rdata_phys = segs[0].ds_addr; return; } - + /* * Probe for a Tigon chip. Check the PCI vendor and device IDs * against our list and return its name if we find a match. */ static int -ti_probe(dev) - device_t dev; +ti_probe(device_t dev) { - const struct ti_type *t; + const struct ti_type *t; t = ti_devs; @@ -2270,13 +2200,12 @@ ti_probe(dev) } static int -ti_attach(dev) - device_t dev; +ti_attach(device_t dev) { - struct ifnet *ifp; - struct ti_softc *sc; - int error = 0, rid; - u_char eaddr[6]; + struct ifnet *ifp; + struct ti_softc *sc; + int error = 0, rid; + u_char eaddr[6]; sc = device_get_softc(dev); sc->ti_unit = device_get_unit(dev); @@ -2559,11 +2488,10 @@ fail: * allocated. */ static int -ti_detach(dev) - device_t dev; +ti_detach(device_t dev) { - struct ti_softc *sc; - struct ifnet *ifp; + struct ti_softc *sc; + struct ifnet *ifp; sc = device_get_softc(dev); if (sc->dev) @@ -2686,23 +2614,22 @@ ti_hdr_split(struct mbuf *top, int hdr_l */ static void -ti_rxeof(sc) - struct ti_softc *sc; +ti_rxeof(struct ti_softc *sc) { - bus_dmamap_t map; - struct ifnet *ifp; - struct ti_cmd_desc cmd; + struct ifnet *ifp; + bus_dmamap_t map; + struct ti_cmd_desc cmd; TI_LOCK_ASSERT(sc); ifp = sc->ti_ifp; while (sc->ti_rx_saved_considx != sc->ti_return_prodidx.ti_idx) { - struct ti_rx_desc *cur_rx; - u_int32_t rxidx; - struct mbuf *m = NULL; - u_int16_t vlan_tag = 0; - int have_tag = 0; + struct ti_rx_desc *cur_rx; + struct mbuf *m = NULL; + uint32_t rxidx; + uint16_t vlan_tag = 0; + int have_tag = 0; cur_rx = &sc->ti_rdata->ti_rx_return_ring[sc->ti_rx_saved_considx]; @@ -2820,14 +2747,13 @@ ti_rxeof(sc) } static void -ti_txeof(sc) - struct ti_softc *sc; +ti_txeof(struct ti_softc *sc) { - struct ti_txdesc *txd; - struct ti_tx_desc txdesc; - struct ti_tx_desc *cur_tx = NULL; - struct ifnet *ifp; - int idx; + struct ti_txdesc *txd; + struct ti_tx_desc txdesc; + struct ti_tx_desc *cur_tx = NULL; + struct ifnet *ifp; + int idx; ifp = sc->ti_ifp; @@ -2867,11 +2793,10 @@ ti_txeof(sc) } static void -ti_intr(xsc) - void *xsc; +ti_intr(void *xsc) { - struct ti_softc *sc; - struct ifnet *ifp; + struct ti_softc *sc; + struct ifnet *ifp; sc = xsc; TI_LOCK(sc); @@ -2910,10 +2835,9 @@ ti_intr(xsc) } static void -ti_stats_update(sc) - struct ti_softc *sc; +ti_stats_update(struct ti_softc *sc) { - struct ifnet *ifp; + struct ifnet *ifp; ifp = sc->ti_ifp; @@ -2936,17 +2860,15 @@ ti_stats_update(sc) * pointers to descriptors. */ static int -ti_encap(sc, m_head) - struct ti_softc *sc; - struct mbuf **m_head; -{ - struct ti_txdesc *txd; - struct ti_tx_desc *f; - struct ti_tx_desc txdesc; - struct mbuf *m; - bus_dma_segment_t txsegs[TI_MAXTXSEGS]; - u_int16_t csum_flags; - int error, frag, i, nseg; +ti_encap(struct ti_softc *sc, struct mbuf **m_head) +{ + struct ti_txdesc *txd; + struct ti_tx_desc *f; + struct ti_tx_desc txdesc; + struct mbuf *m; + bus_dma_segment_t txsegs[TI_MAXTXSEGS]; + uint16_t csum_flags; + int error, frag, i, nseg; if ((txd = STAILQ_FIRST(&sc->ti_cdata.ti_txfreeq)) == NULL) return (ENOBUFS); @@ -3041,10 +2963,9 @@ ti_encap(sc, m_head) } static void -ti_start(ifp) - struct ifnet *ifp; +ti_start(struct ifnet *ifp) { - struct ti_softc *sc; + struct ti_softc *sc; sc = ifp->if_softc; TI_LOCK(sc); @@ -3057,12 +2978,11 @@ ti_start(ifp) * to the mbuf data regions directly in the transmit descriptors. */ static void -ti_start_locked(ifp) - struct ifnet *ifp; +ti_start_locked(struct ifnet *ifp) { - struct ti_softc *sc; - struct mbuf *m_head = NULL; - int enq = 0; + struct ti_softc *sc; + struct mbuf *m_head = NULL; + int enq = 0; sc = ifp->if_softc; @@ -3123,10 +3043,9 @@ ti_start_locked(ifp) } static void -ti_init(xsc) - void *xsc; +ti_init(void *xsc) { - struct ti_softc *sc; + struct ti_softc *sc; sc = xsc; TI_LOCK(sc); @@ -3135,10 +3054,9 @@ ti_init(xsc) } static void -ti_init_locked(xsc) - void *xsc; +ti_init_locked(void *xsc) { - struct ti_softc *sc = xsc; + struct ti_softc *sc = xsc; /* Cancel pending I/O and flush buffers. */ ti_stop(sc); @@ -3150,14 +3068,13 @@ ti_init_locked(xsc) } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 19:00:30 2012 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 0A12A106566B; Tue, 3 Jan 2012 19:00:30 +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 EAA648FC14; Tue, 3 Jan 2012 19:00: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 q03J0TiR037465; Tue, 3 Jan 2012 19:00:29 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03J0T0V037462; Tue, 3 Jan 2012 19:00:29 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201031900.q03J0T0V037462@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 19:00:29 +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: r229405 - in stable/8/sys: conf dev/ti 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, 03 Jan 2012 19:00:30 -0000 Author: yongari Date: Tue Jan 3 19:00:29 2012 New Revision: 229405 URL: http://svn.freebsd.org/changeset/base/229405 Log: MFC r227086-227089: r227086: Use ANSI function definations. r227087: No functional changes. r227088: Make ti(4) build with 'options TI_PRIVATE_JUMBOS'. This was broken in r175872. We have a UMA backed jumbo allocator and that is much better implementation than having a local jumbo buffer allocator in driver. This local allocator would be removed in near future but fixing build before removal wouldn't be a bad idea. r227089: s/u_intXX_t/uintXX_t/g Modified: stable/8/sys/dev/ti/if_ti.c stable/8/sys/dev/ti/if_tireg.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/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/ti/if_ti.c ============================================================================== --- stable/8/sys/dev/ti/if_ti.c Tue Jan 3 18:58:20 2012 (r229404) +++ stable/8/sys/dev/ti/if_ti.c Tue Jan 3 19:00:29 2012 (r229405) @@ -140,7 +140,6 @@ typedef enum { TI_SWAP_NTOH } ti_swap_type; - /* * Various supported device vendors/types and their names. */ @@ -199,20 +198,21 @@ static int ti_shutdown(device_t); static int ti_ifmedia_upd(struct ifnet *); static void ti_ifmedia_sts(struct ifnet *, struct ifmediareq *); -static u_int32_t ti_eeprom_putbyte(struct ti_softc *, int); -static u_int8_t ti_eeprom_getbyte(struct ti_softc *, int, u_int8_t *); +static uint32_t ti_eeprom_putbyte(struct ti_softc *, int); +static uint8_t ti_eeprom_getbyte(struct ti_softc *, int, uint8_t *); static int ti_read_eeprom(struct ti_softc *, caddr_t, int, int); static void ti_add_mcast(struct ti_softc *, struct ether_addr *); static void ti_del_mcast(struct ti_softc *, struct ether_addr *); static void ti_setmulti(struct ti_softc *); -static void ti_mem_read(struct ti_softc *, u_int32_t, u_int32_t, void *); -static void ti_mem_write(struct ti_softc *, u_int32_t, u_int32_t, void *); -static void ti_mem_zero(struct ti_softc *, u_int32_t, u_int32_t); -static int ti_copy_mem(struct ti_softc *, u_int32_t, u_int32_t, caddr_t, int, int); -static int ti_copy_scratch(struct ti_softc *, u_int32_t, u_int32_t, caddr_t, - int, int, int); +static void ti_mem_read(struct ti_softc *, uint32_t, uint32_t, void *); +static void ti_mem_write(struct ti_softc *, uint32_t, uint32_t, void *); +static void ti_mem_zero(struct ti_softc *, uint32_t, uint32_t); +static int ti_copy_mem(struct ti_softc *, uint32_t, uint32_t, caddr_t, int, + int); +static int ti_copy_scratch(struct ti_softc *, uint32_t, uint32_t, caddr_t, + int, int, int); static int ti_bcopy_swap(const void *, void *, size_t, ti_swap_type); static void ti_loadfw(struct ti_softc *); static void ti_cmd(struct ti_softc *, struct ti_cmd_desc *); @@ -242,8 +242,8 @@ static int ti_chipinit(struct ti_softc * static int ti_gibinit(struct ti_softc *); #ifdef TI_JUMBO_HDRSPLIT -static __inline void ti_hdr_split (struct mbuf *top, int hdr_len, - int pkt_len, int idx); +static __inline void ti_hdr_split(struct mbuf *top, int hdr_len, int pkt_len, + int idx); #endif /* TI_JUMBO_HDRSPLIT */ static device_method_t ti_methods[] = { @@ -270,11 +270,10 @@ MODULE_DEPEND(ti, ether, 1, 1, 1); /* * Send an instruction or address to the EEPROM, check for ACK. */ -static u_int32_t ti_eeprom_putbyte(sc, byte) - struct ti_softc *sc; - int byte; +static uint32_t +ti_eeprom_putbyte(struct ti_softc *sc, int byte) { - int i, ack = 0; + int i, ack = 0; /* * Make sure we're in TX mode. @@ -316,13 +315,11 @@ static u_int32_t ti_eeprom_putbyte(sc, b * We have to send two address bytes since the EEPROM can hold * more than 256 bytes of data. */ -static u_int8_t ti_eeprom_getbyte(sc, addr, dest) - struct ti_softc *sc; - int addr; - u_int8_t *dest; +static uint8_t +ti_eeprom_getbyte(struct ti_softc *sc, int addr, uint8_t *dest) { - int i; - u_int8_t byte = 0; + int i; + uint8_t byte = 0; EEPROM_START; @@ -393,14 +390,10 @@ static u_int8_t ti_eeprom_getbyte(sc, ad * Read a sequence of bytes from the EEPROM. */ static int -ti_read_eeprom(sc, dest, off, cnt) - struct ti_softc *sc; - caddr_t dest; - int off; - int cnt; +ti_read_eeprom(struct ti_softc *sc, caddr_t dest, int off, int cnt) { - int err = 0, i; - u_int8_t byte = 0; + int err = 0, i; + uint8_t byte = 0; for (i = 0; i < cnt; i++) { err = ti_eeprom_getbyte(sc, off + i, &byte); @@ -417,13 +410,10 @@ ti_read_eeprom(sc, dest, off, cnt) * Can be used to copy data from NIC local memory. */ static void -ti_mem_read(sc, addr, len, buf) - struct ti_softc *sc; - u_int32_t addr, len; - void *buf; +ti_mem_read(struct ti_softc *sc, uint32_t addr, uint32_t len, void *buf) { - int segptr, segsize, cnt; - char *ptr; + int segptr, segsize, cnt; + char *ptr; segptr = addr; cnt = len; @@ -436,7 +426,7 @@ ti_mem_read(sc, addr, len, buf) segsize = TI_WINLEN - (segptr % TI_WINLEN); CSR_WRITE_4(sc, TI_WINBASE, (segptr & ~(TI_WINLEN - 1))); bus_space_read_region_4(sc->ti_btag, sc->ti_bhandle, - TI_WINDOW + (segptr & (TI_WINLEN - 1)), (u_int32_t *)ptr, + TI_WINDOW + (segptr & (TI_WINLEN - 1)), (uint32_t *)ptr, segsize / 4); ptr += segsize; segptr += segsize; @@ -450,13 +440,10 @@ ti_mem_read(sc, addr, len, buf) * Can be used to copy data into NIC local memory. */ static void -ti_mem_write(sc, addr, len, buf) - struct ti_softc *sc; - u_int32_t addr, len; - void *buf; +ti_mem_write(struct ti_softc *sc, uint32_t addr, uint32_t len, void *buf) { - int segptr, segsize, cnt; - char *ptr; + int segptr, segsize, cnt; + char *ptr; segptr = addr; cnt = len; @@ -469,7 +456,7 @@ ti_mem_write(sc, addr, len, buf) segsize = TI_WINLEN - (segptr % TI_WINLEN); CSR_WRITE_4(sc, TI_WINBASE, (segptr & ~(TI_WINLEN - 1))); bus_space_write_region_4(sc->ti_btag, sc->ti_bhandle, - TI_WINDOW + (segptr & (TI_WINLEN - 1)), (u_int32_t *)ptr, + TI_WINDOW + (segptr & (TI_WINLEN - 1)), (uint32_t *)ptr, segsize / 4); ptr += segsize; segptr += segsize; @@ -482,11 +469,9 @@ ti_mem_write(sc, addr, len, buf) * Can be used to clear a section of NIC local memory. */ static void -ti_mem_zero(sc, addr, len) - struct ti_softc *sc; - u_int32_t addr, len; +ti_mem_zero(struct ti_softc *sc, uint32_t addr, uint32_t len) { - int segptr, segsize, cnt; + int segptr, segsize, cnt; segptr = addr; cnt = len; @@ -505,18 +490,15 @@ ti_mem_zero(sc, addr, len) } static int -ti_copy_mem(sc, tigon_addr, len, buf, useraddr, readdata) - struct ti_softc *sc; - u_int32_t tigon_addr, len; - caddr_t buf; - int useraddr, readdata; -{ - int segptr, segsize, cnt; - caddr_t ptr; - u_int32_t origwin; - u_int8_t tmparray[TI_WINLEN], tmparray2[TI_WINLEN]; - int resid, segresid; - int first_pass; +ti_copy_mem(struct ti_softc *sc, uint32_t tigon_addr, uint32_t len, + caddr_t buf, int useraddr, int readdata) +{ + int segptr, segsize, cnt; + caddr_t ptr; + uint32_t origwin; + uint8_t tmparray[TI_WINLEN], tmparray2[TI_WINLEN]; + int resid, segresid; + int first_pass; TI_LOCK_ASSERT(sc); @@ -577,7 +559,7 @@ ti_copy_mem(sc, tigon_addr, len, buf, us bus_space_read_region_4(sc->ti_btag, sc->ti_bhandle, ti_offset, - (u_int32_t *)tmparray, + (uint32_t *)tmparray, segsize >> 2); if (useraddr) { /* @@ -624,7 +606,7 @@ ti_copy_mem(sc, tigon_addr, len, buf, us bus_space_write_region_4(sc->ti_btag, sc->ti_bhandle, ti_offset, - (u_int32_t *)tmparray, + (uint32_t *)tmparray, segsize >> 2); } segptr += segsize; @@ -636,7 +618,7 @@ ti_copy_mem(sc, tigon_addr, len, buf, us * Handle leftover, non-word-aligned bytes. */ if (resid != 0) { - u_int32_t tmpval, tmpval2; + uint32_t tmpval, tmpval2; bus_size_t ti_offset; /* @@ -704,17 +686,13 @@ ti_copy_mem(sc, tigon_addr, len, buf, us } static int -ti_copy_scratch(sc, tigon_addr, len, buf, useraddr, readdata, cpu) - struct ti_softc *sc; - u_int32_t tigon_addr, len; - caddr_t buf; - int useraddr, readdata; - int cpu; -{ - u_int32_t segptr; - int cnt; - u_int32_t tmpval, tmpval2; - caddr_t ptr; +ti_copy_scratch(struct ti_softc *sc, uint32_t tigon_addr, uint32_t len, + caddr_t buf, int useraddr, int readdata, int cpu) +{ + uint32_t segptr; + int cnt; + uint32_t tmpval, tmpval2; + caddr_t ptr; TI_LOCK_ASSERT(sc); @@ -802,14 +780,10 @@ ti_copy_scratch(sc, tigon_addr, len, buf } static int -ti_bcopy_swap(src, dst, len, swap_type) - const void *src; - void *dst; - size_t len; - ti_swap_type swap_type; +ti_bcopy_swap(const void *src, void *dst, size_t len, ti_swap_type swap_type) { - const u_int8_t *tmpsrc; - u_int8_t *tmpdst; + const uint8_t *tmpsrc; + uint8_t *tmpdst; size_t tmplen; if (len & 0x3) { @@ -824,11 +798,11 @@ ti_bcopy_swap(src, dst, len, swap_type) while (tmplen) { if (swap_type == TI_SWAP_NTOH) - *(u_int32_t *)tmpdst = - ntohl(*(const u_int32_t *)tmpsrc); + *(uint32_t *)tmpdst = + ntohl(*(const uint32_t *)tmpsrc); else - *(u_int32_t *)tmpdst = - htonl(*(const u_int32_t *)tmpsrc); + *(uint32_t *)tmpdst = + htonl(*(const uint32_t *)tmpsrc); tmpsrc += 4; tmpdst += 4; @@ -844,8 +818,7 @@ ti_bcopy_swap(src, dst, len, swap_type) * Tigon 2. */ static void -ti_loadfw(sc) - struct ti_softc *sc; +ti_loadfw(struct ti_softc *sc) { TI_LOCK_ASSERT(sc); @@ -902,14 +875,12 @@ ti_loadfw(sc) * Send the NIC a command via the command ring. */ static void -ti_cmd(sc, cmd) - struct ti_softc *sc; - struct ti_cmd_desc *cmd; +ti_cmd(struct ti_softc *sc, struct ti_cmd_desc *cmd) { - int index; + int index; index = sc->ti_cmd_saved_prodidx; - CSR_WRITE_4(sc, TI_GCR_CMDRING + (index * 4), *(u_int32_t *)(cmd)); + CSR_WRITE_4(sc, TI_GCR_CMDRING + (index * 4), *(uint32_t *)(cmd)); TI_INC(index, TI_CMD_RING_CNT); CSR_WRITE_4(sc, TI_MB_CMDPROD_IDX, index); sc->ti_cmd_saved_prodidx = index; @@ -920,21 +891,17 @@ ti_cmd(sc, cmd) * number of command slots to include after the initial command. */ static void -ti_cmd_ext(sc, cmd, arg, len) - struct ti_softc *sc; - struct ti_cmd_desc *cmd; - caddr_t arg; - int len; +ti_cmd_ext(struct ti_softc *sc, struct ti_cmd_desc *cmd, caddr_t arg, int len) { - int index; - int i; + int index; + int i; index = sc->ti_cmd_saved_prodidx; - CSR_WRITE_4(sc, TI_GCR_CMDRING + (index * 4), *(u_int32_t *)(cmd)); + CSR_WRITE_4(sc, TI_GCR_CMDRING + (index * 4), *(uint32_t *)(cmd)); TI_INC(index, TI_CMD_RING_CNT); for (i = 0; i < len; i++) { CSR_WRITE_4(sc, TI_GCR_CMDRING + (index * 4), - *(u_int32_t *)(&arg[i * 4])); + *(uint32_t *)(&arg[i * 4])); TI_INC(index, TI_CMD_RING_CNT); } CSR_WRITE_4(sc, TI_MB_CMDPROD_IDX, index); @@ -945,10 +912,9 @@ ti_cmd_ext(sc, cmd, arg, len) * Handle events that have triggered interrupts. */ static void -ti_handle_events(sc) - struct ti_softc *sc; +ti_handle_events(struct ti_softc *sc) { - struct ti_event_desc *e; + struct ti_event_desc *e; if (sc->ti_rdata->ti_event_ring == NULL) return; @@ -1089,12 +1055,11 @@ ti_free_dmamaps(struct ti_softc *sc) */ static int -ti_alloc_jumbo_mem(sc) - struct ti_softc *sc; +ti_alloc_jumbo_mem(struct ti_softc *sc) { - caddr_t ptr; - int i; - struct ti_jpool_entry *entry; + struct ti_jpool_entry *entry; + caddr_t ptr; + int i; /* * Grab a big chunk o' storage. Since we are chopping this pool up @@ -1152,10 +1117,9 @@ ti_alloc_jumbo_mem(sc) /* * Allocate a jumbo buffer. */ -static void *ti_jalloc(sc) - struct ti_softc *sc; +static void *ti_jalloc(struct ti_softc *sc) { - struct ti_jpool_entry *entry; + struct ti_jpool_entry *entry; entry = SLIST_FIRST(&sc->ti_jfree_listhead); @@ -1173,13 +1137,11 @@ static void *ti_jalloc(sc) * Release a jumbo buffer. */ static void -ti_jfree(buf, args) - void *buf; - void *args; -{ - struct ti_softc *sc; - int i; - struct ti_jpool_entry *entry; +ti_jfree(void *buf, void *args) +{ + struct ti_softc *sc; + int i; + struct ti_jpool_entry *entry; /* Extract the softc struct pointer. */ sc = (struct ti_softc *)args; @@ -1205,8 +1167,7 @@ ti_jfree(buf, args) #else static int -ti_alloc_jumbo_mem(sc) - struct ti_softc *sc; +ti_alloc_jumbo_mem(struct ti_softc *sc) { /* @@ -1237,16 +1198,13 @@ ti_alloc_jumbo_mem(sc) * Intialize a standard receive ring descriptor. */ static int -ti_newbuf_std(sc, i, m) - struct ti_softc *sc; - int i; - struct mbuf *m; -{ - bus_dmamap_t map; - bus_dma_segment_t segs; - struct mbuf *m_new = NULL; - struct ti_rx_desc *r; - int nsegs; +ti_newbuf_std(struct ti_softc *sc, int i, struct mbuf *m) +{ + bus_dmamap_t map; + bus_dma_segment_t segs; + struct mbuf *m_new = NULL; + struct ti_rx_desc *r; + int nsegs; nsegs = 0; if (m == NULL) { @@ -1292,16 +1250,13 @@ ti_newbuf_std(sc, i, m) * the Tigon 2. */ static int -ti_newbuf_mini(sc, i, m) - struct ti_softc *sc; - int i; - struct mbuf *m; -{ - bus_dma_segment_t segs; - bus_dmamap_t map; - struct mbuf *m_new = NULL; - struct ti_rx_desc *r; - int nsegs; +ti_newbuf_mini(struct ti_softc *sc, int i, struct mbuf *m) +{ + bus_dma_segment_t segs; + bus_dmamap_t map; + struct mbuf *m_new = NULL; + struct ti_rx_desc *r; + int nsegs; nsegs = 0; if (m == NULL) { @@ -1344,19 +1299,16 @@ ti_newbuf_mini(sc, i, m) * a jumbo buffer from the pool managed internally by the driver. */ static int -ti_newbuf_jumbo(sc, i, m) - struct ti_softc *sc; - int i; - struct mbuf *m; -{ - bus_dmamap_t map; - struct mbuf *m_new = NULL; - struct ti_rx_desc *r; - int nsegs; - bus_dma_segment_t segs; +ti_newbuf_jumbo(struct ti_softc *sc, int i, struct mbuf *m) +{ + bus_dmamap_t map; + struct mbuf *m_new = NULL; + struct ti_rx_desc *r; + int nsegs; + bus_dma_segment_t segs; if (m == NULL) { - caddr_t *buf = NULL; + caddr_t *buf = NULL; /* Allocate the mbuf. */ MGETHDR(m_new, M_DONTWAIT, MT_DATA); @@ -1376,7 +1328,7 @@ ti_newbuf_jumbo(sc, i, m) /* Attach the buffer to the mbuf. */ m_new->m_data = (void *) buf; m_new->m_len = m_new->m_pkthdr.len = TI_JUMBO_FRAMELEN; - MEXTADD(m_new, buf, TI_JUMBO_FRAMELEN, ti_jfree, + MEXTADD(m_new, buf, TI_JUMBO_FRAMELEN, ti_jfree, buf, (struct ti_softc *)sc, 0, EXT_NET_DRV); } else { m_new = m; @@ -1417,30 +1369,26 @@ ti_newbuf_jumbo(sc, i, m) #define TCP_HDR_LEN (52 + sizeof(struct ether_header)) #define UDP_HDR_LEN (28 + sizeof(struct ether_header)) #define NFS_HDR_LEN (UDP_HDR_LEN) -static int HDR_LEN = TCP_HDR_LEN; - +static int HDR_LEN = TCP_HDR_LEN; /* * Initialize a jumbo receive ring descriptor. This allocates * a jumbo buffer from the pool managed internally by the driver. */ static int -ti_newbuf_jumbo(sc, idx, m_old) - struct ti_softc *sc; - int idx; - struct mbuf *m_old; -{ - bus_dmamap_t map; - struct mbuf *cur, *m_new = NULL; - struct mbuf *m[3] = {NULL, NULL, NULL}; - struct ti_rx_desc_ext *r; - vm_page_t frame; - static int color; - /* 1 extra buf to make nobufs easy*/ - struct sf_buf *sf[3] = {NULL, NULL, NULL}; - int i; - bus_dma_segment_t segs[4]; - int nsegs; +ti_newbuf_jumbo(struct ti_softc *sc, int idx, struct mbuf *m_old) +{ + bus_dmamap_t map; + struct mbuf *cur, *m_new = NULL; + struct mbuf *m[3] = {NULL, NULL, NULL}; + struct ti_rx_desc_ext *r; + vm_page_t frame; + static int color; + /* 1 extra buf to make nobufs easy*/ + struct sf_buf *sf[3] = {NULL, NULL, NULL}; + int i; + bus_dma_segment_t segs[4]; + int nsegs; if (m_old != NULL) { m_new = m_old; @@ -1575,8 +1523,6 @@ nobufs: } #endif - - /* * The standard receive ring has 512 entries in it. At 2K per mbuf cluster, * that's 1MB or memory, which is a lot. For now, we fill only the first @@ -1584,11 +1530,10 @@ nobufs: * the NIC. */ static int -ti_init_rx_ring_std(sc) - struct ti_softc *sc; +ti_init_rx_ring_std(struct ti_softc *sc) { - int i; - struct ti_cmd_desc cmd; + int i; + struct ti_cmd_desc cmd; for (i = 0; i < TI_SSLOTS; i++) { if (ti_newbuf_std(sc, i, NULL) == ENOBUFS) @@ -1602,11 +1547,10 @@ ti_init_rx_ring_std(sc) } static void -ti_free_rx_ring_std(sc) - struct ti_softc *sc; +ti_free_rx_ring_std(struct ti_softc *sc) { - bus_dmamap_t map; - int i; + bus_dmamap_t map; + int i; for (i = 0; i < TI_STD_RX_RING_CNT; i++) { if (sc->ti_cdata.ti_rx_std_chain[i] != NULL) { @@ -1623,11 +1567,10 @@ ti_free_rx_ring_std(sc) } static int -ti_init_rx_ring_jumbo(sc) - struct ti_softc *sc; +ti_init_rx_ring_jumbo(struct ti_softc *sc) { - int i; - struct ti_cmd_desc cmd; + struct ti_cmd_desc cmd; + int i; for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) { if (ti_newbuf_jumbo(sc, i, NULL) == ENOBUFS) @@ -1641,11 +1584,10 @@ ti_init_rx_ring_jumbo(sc) } static void -ti_free_rx_ring_jumbo(sc) - struct ti_softc *sc; +ti_free_rx_ring_jumbo(struct ti_softc *sc) { - bus_dmamap_t map; - int i; + bus_dmamap_t map; + int i; for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) { if (sc->ti_cdata.ti_rx_jumbo_chain[i] != NULL) { @@ -1662,10 +1604,9 @@ ti_free_rx_ring_jumbo(sc) } static int -ti_init_rx_ring_mini(sc) - struct ti_softc *sc; +ti_init_rx_ring_mini(struct ti_softc *sc) { - int i; + int i; for (i = 0; i < TI_MSLOTS; i++) { if (ti_newbuf_mini(sc, i, NULL) == ENOBUFS) @@ -1679,11 +1620,10 @@ ti_init_rx_ring_mini(sc) } static void -ti_free_rx_ring_mini(sc) - struct ti_softc *sc; +ti_free_rx_ring_mini(struct ti_softc *sc) { - bus_dmamap_t map; - int i; + bus_dmamap_t map; + int i; for (i = 0; i < TI_MINI_RX_RING_CNT; i++) { if (sc->ti_cdata.ti_rx_mini_chain[i] != NULL) { @@ -1700,11 +1640,10 @@ ti_free_rx_ring_mini(sc) } static void -ti_free_tx_ring(sc) - struct ti_softc *sc; +ti_free_tx_ring(struct ti_softc *sc) { - struct ti_txdesc *txd; - int i; + struct ti_txdesc *txd; + int i; if (sc->ti_rdata->ti_tx_ring == NULL) return; @@ -1724,11 +1663,10 @@ ti_free_tx_ring(sc) } static int -ti_init_tx_ring(sc) - struct ti_softc *sc; +ti_init_tx_ring(struct ti_softc *sc) { - struct ti_txdesc *txd; - int i; + struct ti_txdesc *txd; + int i; STAILQ_INIT(&sc->ti_cdata.ti_txfreeq); STAILQ_INIT(&sc->ti_cdata.ti_txbusyq); @@ -1749,15 +1687,13 @@ ti_init_tx_ring(sc) * work. */ static void -ti_add_mcast(sc, addr) - struct ti_softc *sc; - struct ether_addr *addr; -{ - struct ti_cmd_desc cmd; - u_int16_t *m; - u_int32_t ext[2] = {0, 0}; +ti_add_mcast(struct ti_softc *sc, struct ether_addr *addr) +{ + struct ti_cmd_desc cmd; + uint16_t *m; + uint32_t ext[2] = {0, 0}; - m = (u_int16_t *)&addr->octet[0]; + m = (uint16_t *)&addr->octet[0]; switch (sc->ti_hwrev) { case TI_HWREV_TIGON: @@ -1777,15 +1713,13 @@ ti_add_mcast(sc, addr) } static void -ti_del_mcast(sc, addr) - struct ti_softc *sc; - struct ether_addr *addr; -{ - struct ti_cmd_desc cmd; - u_int16_t *m; - u_int32_t ext[2] = {0, 0}; +ti_del_mcast(struct ti_softc *sc, struct ether_addr *addr) +{ + struct ti_cmd_desc cmd; + uint16_t *m; + uint32_t ext[2] = {0, 0}; - m = (u_int16_t *)&addr->octet[0]; + m = (uint16_t *)&addr->octet[0]; switch (sc->ti_hwrev) { case TI_HWREV_TIGON: @@ -1819,14 +1753,13 @@ ti_del_mcast(sc, addr) * any given time. */ static void -ti_setmulti(sc) - struct ti_softc *sc; +ti_setmulti(struct ti_softc *sc) { - struct ifnet *ifp; - struct ifmultiaddr *ifma; - struct ti_cmd_desc cmd; - struct ti_mc_entry *mc; - u_int32_t intrs; + struct ifnet *ifp; + struct ifmultiaddr *ifma; + struct ti_cmd_desc cmd; + struct ti_mc_entry *mc; + uint32_t intrs; TI_LOCK_ASSERT(sc); @@ -1879,9 +1812,9 @@ ti_setmulti(sc) * around it on the Tigon 2 by setting a bit in the PCI state register, * but for the Tigon 1 we must give up and abort the interface attach. */ -static int ti_64bitslot_war(sc) - struct ti_softc *sc; +static int ti_64bitslot_war(struct ti_softc *sc) { + if (!(CSR_READ_4(sc, TI_PCI_STATE) & TI_PCISTATE_32BIT_BUS)) { CSR_WRITE_4(sc, 0x600, 0); CSR_WRITE_4(sc, 0x604, 0); @@ -1905,12 +1838,11 @@ static int ti_64bitslot_war(sc) * self-test results. */ static int -ti_chipinit(sc) - struct ti_softc *sc; +ti_chipinit(struct ti_softc *sc) { - u_int32_t cacheline; - u_int32_t pci_writemax = 0; - u_int32_t hdrsplit; + uint32_t cacheline; + uint32_t pci_writemax = 0; + uint32_t hdrsplit; /* Initialize link to down state. */ sc->ti_linkstat = TI_EV_CODE_LINK_DOWN; @@ -2059,13 +1991,12 @@ ti_chipinit(sc) * start the CPU(s) running. */ static int -ti_gibinit(sc) - struct ti_softc *sc; +ti_gibinit(struct ti_softc *sc) { - struct ti_rcb *rcb; - int i; - struct ifnet *ifp; - uint32_t rdphys; + struct ifnet *ifp; + struct ti_rcb *rcb; + uint32_t rdphys; + int i; TI_LOCK_ASSERT(sc); @@ -2246,16 +2177,15 @@ ti_rdata_cb(void *arg, bus_dma_segment_t sc->ti_rdata_phys = segs[0].ds_addr; return; } - + /* * Probe for a Tigon chip. Check the PCI vendor and device IDs * against our list and return its name if we find a match. */ static int -ti_probe(dev) - device_t dev; +ti_probe(device_t dev) { - const struct ti_type *t; + const struct ti_type *t; t = ti_devs; @@ -2272,13 +2202,12 @@ ti_probe(dev) } static int -ti_attach(dev) - device_t dev; +ti_attach(device_t dev) { - struct ifnet *ifp; - struct ti_softc *sc; - int error = 0, rid; - u_char eaddr[6]; + struct ifnet *ifp; + struct ti_softc *sc; + int error = 0, rid; + u_char eaddr[6]; sc = device_get_softc(dev); sc->ti_unit = device_get_unit(dev); @@ -2561,11 +2490,10 @@ fail: * allocated. */ static int -ti_detach(dev) - device_t dev; +ti_detach(device_t dev) { - struct ti_softc *sc; - struct ifnet *ifp; + struct ti_softc *sc; + struct ifnet *ifp; sc = device_get_softc(dev); if (sc->dev) @@ -2688,23 +2616,22 @@ ti_hdr_split(struct mbuf *top, int hdr_l */ static void -ti_rxeof(sc) - struct ti_softc *sc; +ti_rxeof(struct ti_softc *sc) { - bus_dmamap_t map; - struct ifnet *ifp; - struct ti_cmd_desc cmd; + struct ifnet *ifp; + bus_dmamap_t map; + struct ti_cmd_desc cmd; TI_LOCK_ASSERT(sc); ifp = sc->ti_ifp; while (sc->ti_rx_saved_considx != sc->ti_return_prodidx.ti_idx) { - struct ti_rx_desc *cur_rx; - u_int32_t rxidx; - struct mbuf *m = NULL; - u_int16_t vlan_tag = 0; - int have_tag = 0; + struct ti_rx_desc *cur_rx; + struct mbuf *m = NULL; + uint32_t rxidx; + uint16_t vlan_tag = 0; + int have_tag = 0; cur_rx = &sc->ti_rdata->ti_rx_return_ring[sc->ti_rx_saved_considx]; @@ -2822,14 +2749,13 @@ ti_rxeof(sc) } static void -ti_txeof(sc) - struct ti_softc *sc; +ti_txeof(struct ti_softc *sc) { - struct ti_txdesc *txd; - struct ti_tx_desc txdesc; - struct ti_tx_desc *cur_tx = NULL; - struct ifnet *ifp; - int idx; + struct ti_txdesc *txd; + struct ti_tx_desc txdesc; + struct ti_tx_desc *cur_tx = NULL; + struct ifnet *ifp; + int idx; ifp = sc->ti_ifp; @@ -2869,11 +2795,10 @@ ti_txeof(sc) } static void -ti_intr(xsc) - void *xsc; +ti_intr(void *xsc) { - struct ti_softc *sc; - struct ifnet *ifp; + struct ti_softc *sc; + struct ifnet *ifp; sc = xsc; TI_LOCK(sc); @@ -2912,10 +2837,9 @@ ti_intr(xsc) } static void -ti_stats_update(sc) - struct ti_softc *sc; +ti_stats_update(struct ti_softc *sc) { - struct ifnet *ifp; + struct ifnet *ifp; ifp = sc->ti_ifp; @@ -2938,17 +2862,15 @@ ti_stats_update(sc) * pointers to descriptors. */ static int -ti_encap(sc, m_head) - struct ti_softc *sc; - struct mbuf **m_head; -{ - struct ti_txdesc *txd; - struct ti_tx_desc *f; - struct ti_tx_desc txdesc; - struct mbuf *m; - bus_dma_segment_t txsegs[TI_MAXTXSEGS]; - u_int16_t csum_flags; - int error, frag, i, nseg; +ti_encap(struct ti_softc *sc, struct mbuf **m_head) +{ + struct ti_txdesc *txd; + struct ti_tx_desc *f; + struct ti_tx_desc txdesc; + struct mbuf *m; + bus_dma_segment_t txsegs[TI_MAXTXSEGS]; + uint16_t csum_flags; + int error, frag, i, nseg; if ((txd = STAILQ_FIRST(&sc->ti_cdata.ti_txfreeq)) == NULL) return (ENOBUFS); @@ -3043,10 +2965,9 @@ ti_encap(sc, m_head) } static void -ti_start(ifp) - struct ifnet *ifp; +ti_start(struct ifnet *ifp) { - struct ti_softc *sc; + struct ti_softc *sc; sc = ifp->if_softc; TI_LOCK(sc); @@ -3059,12 +2980,11 @@ ti_start(ifp) * to the mbuf data regions directly in the transmit descriptors. */ static void -ti_start_locked(ifp) - struct ifnet *ifp; +ti_start_locked(struct ifnet *ifp) { - struct ti_softc *sc; - struct mbuf *m_head = NULL; - int enq = 0; + struct ti_softc *sc; + struct mbuf *m_head = NULL; + int enq = 0; sc = ifp->if_softc; @@ -3125,10 +3045,9 @@ ti_start_locked(ifp) } static void -ti_init(xsc) - void *xsc; +ti_init(void *xsc) { - struct ti_softc *sc; + struct ti_softc *sc; sc = xsc; TI_LOCK(sc); @@ -3137,10 +3056,9 @@ ti_init(xsc) } static void -ti_init_locked(xsc) - void *xsc; +ti_init_locked(void *xsc) { - struct ti_softc *sc = xsc; + struct ti_softc *sc = xsc; /* Cancel pending I/O and flush buffers. */ ti_stop(sc); @@ -3152,14 +3070,13 @@ ti_init_locked(xsc) } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 19:01:55 2012 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 74ADB1065670; Tue, 3 Jan 2012 19:01:55 +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 6198E8FC19; Tue, 3 Jan 2012 19:01: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 q03J1tLM037549; Tue, 3 Jan 2012 19:01:55 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03J1tQ1037546; Tue, 3 Jan 2012 19:01:55 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201031901.q03J1tQ1037546@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 19:01:55 +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: r229406 - stable/7/sys/dev/ti 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, 03 Jan 2012 19:01:55 -0000 Author: yongari Date: Tue Jan 3 19:01:54 2012 New Revision: 229406 URL: http://svn.freebsd.org/changeset/base/229406 Log: MFC r227086-227089: r227086: Use ANSI function definations. r227087: No functional changes. r227088: Make ti(4) build with 'options TI_PRIVATE_JUMBOS'. This was broken in r175872. We have a UMA backed jumbo allocator and that is much better implementation than having a local jumbo buffer allocator in driver. This local allocator would be removed in near future but fixing build before removal wouldn't be a bad idea. r227089: s/u_intXX_t/uintXX_t/g Modified: stable/7/sys/dev/ti/if_ti.c stable/7/sys/dev/ti/if_tireg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/ti/if_ti.c ============================================================================== --- stable/7/sys/dev/ti/if_ti.c Tue Jan 3 19:00:29 2012 (r229405) +++ stable/7/sys/dev/ti/if_ti.c Tue Jan 3 19:01:54 2012 (r229406) @@ -140,7 +140,6 @@ typedef enum { TI_SWAP_NTOH } ti_swap_type; - /* * Various supported device vendors/types and their names. */ @@ -199,20 +198,21 @@ static int ti_shutdown(device_t); static int ti_ifmedia_upd(struct ifnet *); static void ti_ifmedia_sts(struct ifnet *, struct ifmediareq *); -static u_int32_t ti_eeprom_putbyte(struct ti_softc *, int); -static u_int8_t ti_eeprom_getbyte(struct ti_softc *, int, u_int8_t *); +static uint32_t ti_eeprom_putbyte(struct ti_softc *, int); +static uint8_t ti_eeprom_getbyte(struct ti_softc *, int, uint8_t *); static int ti_read_eeprom(struct ti_softc *, caddr_t, int, int); static void ti_add_mcast(struct ti_softc *, struct ether_addr *); static void ti_del_mcast(struct ti_softc *, struct ether_addr *); static void ti_setmulti(struct ti_softc *); -static void ti_mem_read(struct ti_softc *, u_int32_t, u_int32_t, void *); -static void ti_mem_write(struct ti_softc *, u_int32_t, u_int32_t, void *); -static void ti_mem_zero(struct ti_softc *, u_int32_t, u_int32_t); -static int ti_copy_mem(struct ti_softc *, u_int32_t, u_int32_t, caddr_t, int, int); -static int ti_copy_scratch(struct ti_softc *, u_int32_t, u_int32_t, caddr_t, - int, int, int); +static void ti_mem_read(struct ti_softc *, uint32_t, uint32_t, void *); +static void ti_mem_write(struct ti_softc *, uint32_t, uint32_t, void *); +static void ti_mem_zero(struct ti_softc *, uint32_t, uint32_t); +static int ti_copy_mem(struct ti_softc *, uint32_t, uint32_t, caddr_t, int, + int); +static int ti_copy_scratch(struct ti_softc *, uint32_t, uint32_t, caddr_t, + int, int, int); static int ti_bcopy_swap(const void *, void *, size_t, ti_swap_type); static void ti_loadfw(struct ti_softc *); static void ti_cmd(struct ti_softc *, struct ti_cmd_desc *); @@ -242,8 +242,8 @@ static int ti_chipinit(struct ti_softc * static int ti_gibinit(struct ti_softc *); #ifdef TI_JUMBO_HDRSPLIT -static __inline void ti_hdr_split (struct mbuf *top, int hdr_len, - int pkt_len, int idx); +static __inline void ti_hdr_split(struct mbuf *top, int hdr_len, int pkt_len, + int idx); #endif /* TI_JUMBO_HDRSPLIT */ static device_method_t ti_methods[] = { @@ -270,11 +270,10 @@ MODULE_DEPEND(ti, ether, 1, 1, 1); /* * Send an instruction or address to the EEPROM, check for ACK. */ -static u_int32_t ti_eeprom_putbyte(sc, byte) - struct ti_softc *sc; - int byte; +static uint32_t +ti_eeprom_putbyte(struct ti_softc *sc, int byte) { - int i, ack = 0; + int i, ack = 0; /* * Make sure we're in TX mode. @@ -316,13 +315,11 @@ static u_int32_t ti_eeprom_putbyte(sc, b * We have to send two address bytes since the EEPROM can hold * more than 256 bytes of data. */ -static u_int8_t ti_eeprom_getbyte(sc, addr, dest) - struct ti_softc *sc; - int addr; - u_int8_t *dest; +static uint8_t +ti_eeprom_getbyte(struct ti_softc *sc, int addr, uint8_t *dest) { - int i; - u_int8_t byte = 0; + int i; + uint8_t byte = 0; EEPROM_START; @@ -393,14 +390,10 @@ static u_int8_t ti_eeprom_getbyte(sc, ad * Read a sequence of bytes from the EEPROM. */ static int -ti_read_eeprom(sc, dest, off, cnt) - struct ti_softc *sc; - caddr_t dest; - int off; - int cnt; +ti_read_eeprom(struct ti_softc *sc, caddr_t dest, int off, int cnt) { - int err = 0, i; - u_int8_t byte = 0; + int err = 0, i; + uint8_t byte = 0; for (i = 0; i < cnt; i++) { err = ti_eeprom_getbyte(sc, off + i, &byte); @@ -417,13 +410,10 @@ ti_read_eeprom(sc, dest, off, cnt) * Can be used to copy data from NIC local memory. */ static void -ti_mem_read(sc, addr, len, buf) - struct ti_softc *sc; - u_int32_t addr, len; - void *buf; +ti_mem_read(struct ti_softc *sc, uint32_t addr, uint32_t len, void *buf) { - int segptr, segsize, cnt; - char *ptr; + int segptr, segsize, cnt; + char *ptr; segptr = addr; cnt = len; @@ -436,7 +426,7 @@ ti_mem_read(sc, addr, len, buf) segsize = TI_WINLEN - (segptr % TI_WINLEN); CSR_WRITE_4(sc, TI_WINBASE, (segptr & ~(TI_WINLEN - 1))); bus_space_read_region_4(sc->ti_btag, sc->ti_bhandle, - TI_WINDOW + (segptr & (TI_WINLEN - 1)), (u_int32_t *)ptr, + TI_WINDOW + (segptr & (TI_WINLEN - 1)), (uint32_t *)ptr, segsize / 4); ptr += segsize; segptr += segsize; @@ -450,13 +440,10 @@ ti_mem_read(sc, addr, len, buf) * Can be used to copy data into NIC local memory. */ static void -ti_mem_write(sc, addr, len, buf) - struct ti_softc *sc; - u_int32_t addr, len; - void *buf; +ti_mem_write(struct ti_softc *sc, uint32_t addr, uint32_t len, void *buf) { - int segptr, segsize, cnt; - char *ptr; + int segptr, segsize, cnt; + char *ptr; segptr = addr; cnt = len; @@ -469,7 +456,7 @@ ti_mem_write(sc, addr, len, buf) segsize = TI_WINLEN - (segptr % TI_WINLEN); CSR_WRITE_4(sc, TI_WINBASE, (segptr & ~(TI_WINLEN - 1))); bus_space_write_region_4(sc->ti_btag, sc->ti_bhandle, - TI_WINDOW + (segptr & (TI_WINLEN - 1)), (u_int32_t *)ptr, + TI_WINDOW + (segptr & (TI_WINLEN - 1)), (uint32_t *)ptr, segsize / 4); ptr += segsize; segptr += segsize; @@ -482,11 +469,9 @@ ti_mem_write(sc, addr, len, buf) * Can be used to clear a section of NIC local memory. */ static void -ti_mem_zero(sc, addr, len) - struct ti_softc *sc; - u_int32_t addr, len; +ti_mem_zero(struct ti_softc *sc, uint32_t addr, uint32_t len) { - int segptr, segsize, cnt; + int segptr, segsize, cnt; segptr = addr; cnt = len; @@ -505,18 +490,15 @@ ti_mem_zero(sc, addr, len) } static int -ti_copy_mem(sc, tigon_addr, len, buf, useraddr, readdata) - struct ti_softc *sc; - u_int32_t tigon_addr, len; - caddr_t buf; - int useraddr, readdata; -{ - int segptr, segsize, cnt; - caddr_t ptr; - u_int32_t origwin; - u_int8_t tmparray[TI_WINLEN], tmparray2[TI_WINLEN]; - int resid, segresid; - int first_pass; +ti_copy_mem(struct ti_softc *sc, uint32_t tigon_addr, uint32_t len, + caddr_t buf, int useraddr, int readdata) +{ + int segptr, segsize, cnt; + caddr_t ptr; + uint32_t origwin; + uint8_t tmparray[TI_WINLEN], tmparray2[TI_WINLEN]; + int resid, segresid; + int first_pass; TI_LOCK_ASSERT(sc); @@ -577,7 +559,7 @@ ti_copy_mem(sc, tigon_addr, len, buf, us bus_space_read_region_4(sc->ti_btag, sc->ti_bhandle, ti_offset, - (u_int32_t *)tmparray, + (uint32_t *)tmparray, segsize >> 2); if (useraddr) { /* @@ -624,7 +606,7 @@ ti_copy_mem(sc, tigon_addr, len, buf, us bus_space_write_region_4(sc->ti_btag, sc->ti_bhandle, ti_offset, - (u_int32_t *)tmparray, + (uint32_t *)tmparray, segsize >> 2); } segptr += segsize; @@ -636,7 +618,7 @@ ti_copy_mem(sc, tigon_addr, len, buf, us * Handle leftover, non-word-aligned bytes. */ if (resid != 0) { - u_int32_t tmpval, tmpval2; + uint32_t tmpval, tmpval2; bus_size_t ti_offset; /* @@ -704,17 +686,13 @@ ti_copy_mem(sc, tigon_addr, len, buf, us } static int -ti_copy_scratch(sc, tigon_addr, len, buf, useraddr, readdata, cpu) - struct ti_softc *sc; - u_int32_t tigon_addr, len; - caddr_t buf; - int useraddr, readdata; - int cpu; -{ - u_int32_t segptr; - int cnt; - u_int32_t tmpval, tmpval2; - caddr_t ptr; +ti_copy_scratch(struct ti_softc *sc, uint32_t tigon_addr, uint32_t len, + caddr_t buf, int useraddr, int readdata, int cpu) +{ + uint32_t segptr; + int cnt; + uint32_t tmpval, tmpval2; + caddr_t ptr; TI_LOCK_ASSERT(sc); @@ -802,14 +780,10 @@ ti_copy_scratch(sc, tigon_addr, len, buf } static int -ti_bcopy_swap(src, dst, len, swap_type) - const void *src; - void *dst; - size_t len; - ti_swap_type swap_type; +ti_bcopy_swap(const void *src, void *dst, size_t len, ti_swap_type swap_type) { - const u_int8_t *tmpsrc; - u_int8_t *tmpdst; + const uint8_t *tmpsrc; + uint8_t *tmpdst; size_t tmplen; if (len & 0x3) { @@ -824,11 +798,11 @@ ti_bcopy_swap(src, dst, len, swap_type) while (tmplen) { if (swap_type == TI_SWAP_NTOH) - *(u_int32_t *)tmpdst = - ntohl(*(const u_int32_t *)tmpsrc); + *(uint32_t *)tmpdst = + ntohl(*(const uint32_t *)tmpsrc); else - *(u_int32_t *)tmpdst = - htonl(*(const u_int32_t *)tmpsrc); + *(uint32_t *)tmpdst = + htonl(*(const uint32_t *)tmpsrc); tmpsrc += 4; tmpdst += 4; @@ -844,8 +818,7 @@ ti_bcopy_swap(src, dst, len, swap_type) * Tigon 2. */ static void -ti_loadfw(sc) - struct ti_softc *sc; +ti_loadfw(struct ti_softc *sc) { TI_LOCK_ASSERT(sc); @@ -902,14 +875,12 @@ ti_loadfw(sc) * Send the NIC a command via the command ring. */ static void -ti_cmd(sc, cmd) - struct ti_softc *sc; - struct ti_cmd_desc *cmd; +ti_cmd(struct ti_softc *sc, struct ti_cmd_desc *cmd) { - int index; + int index; index = sc->ti_cmd_saved_prodidx; - CSR_WRITE_4(sc, TI_GCR_CMDRING + (index * 4), *(u_int32_t *)(cmd)); + CSR_WRITE_4(sc, TI_GCR_CMDRING + (index * 4), *(uint32_t *)(cmd)); TI_INC(index, TI_CMD_RING_CNT); CSR_WRITE_4(sc, TI_MB_CMDPROD_IDX, index); sc->ti_cmd_saved_prodidx = index; @@ -920,21 +891,17 @@ ti_cmd(sc, cmd) * number of command slots to include after the initial command. */ static void -ti_cmd_ext(sc, cmd, arg, len) - struct ti_softc *sc; - struct ti_cmd_desc *cmd; - caddr_t arg; - int len; +ti_cmd_ext(struct ti_softc *sc, struct ti_cmd_desc *cmd, caddr_t arg, int len) { - int index; - int i; + int index; + int i; index = sc->ti_cmd_saved_prodidx; - CSR_WRITE_4(sc, TI_GCR_CMDRING + (index * 4), *(u_int32_t *)(cmd)); + CSR_WRITE_4(sc, TI_GCR_CMDRING + (index * 4), *(uint32_t *)(cmd)); TI_INC(index, TI_CMD_RING_CNT); for (i = 0; i < len; i++) { CSR_WRITE_4(sc, TI_GCR_CMDRING + (index * 4), - *(u_int32_t *)(&arg[i * 4])); + *(uint32_t *)(&arg[i * 4])); TI_INC(index, TI_CMD_RING_CNT); } CSR_WRITE_4(sc, TI_MB_CMDPROD_IDX, index); @@ -945,10 +912,9 @@ ti_cmd_ext(sc, cmd, arg, len) * Handle events that have triggered interrupts. */ static void -ti_handle_events(sc) - struct ti_softc *sc; +ti_handle_events(struct ti_softc *sc) { - struct ti_event_desc *e; + struct ti_event_desc *e; if (sc->ti_rdata->ti_event_ring == NULL) return; @@ -1089,12 +1055,11 @@ ti_free_dmamaps(struct ti_softc *sc) */ static int -ti_alloc_jumbo_mem(sc) - struct ti_softc *sc; +ti_alloc_jumbo_mem(struct ti_softc *sc) { - caddr_t ptr; - int i; - struct ti_jpool_entry *entry; + struct ti_jpool_entry *entry; + caddr_t ptr; + int i; /* * Grab a big chunk o' storage. Since we are chopping this pool up @@ -1151,10 +1116,9 @@ ti_alloc_jumbo_mem(sc) /* * Allocate a jumbo buffer. */ -static void *ti_jalloc(sc) - struct ti_softc *sc; +static void *ti_jalloc(struct ti_softc *sc) { - struct ti_jpool_entry *entry; + struct ti_jpool_entry *entry; entry = SLIST_FIRST(&sc->ti_jfree_listhead); @@ -1172,13 +1136,11 @@ static void *ti_jalloc(sc) * Release a jumbo buffer. */ static void -ti_jfree(buf, args) - void *buf; - void *args; -{ - struct ti_softc *sc; - int i; - struct ti_jpool_entry *entry; +ti_jfree(void *buf, void *args) +{ + struct ti_softc *sc; + int i; + struct ti_jpool_entry *entry; /* Extract the softc struct pointer. */ sc = (struct ti_softc *)args; @@ -1204,8 +1166,7 @@ ti_jfree(buf, args) #else static int -ti_alloc_jumbo_mem(sc) - struct ti_softc *sc; +ti_alloc_jumbo_mem(struct ti_softc *sc) { /* @@ -1236,16 +1197,13 @@ ti_alloc_jumbo_mem(sc) * Intialize a standard receive ring descriptor. */ static int -ti_newbuf_std(sc, i, m) - struct ti_softc *sc; - int i; - struct mbuf *m; -{ - bus_dmamap_t map; - bus_dma_segment_t segs; - struct mbuf *m_new = NULL; - struct ti_rx_desc *r; - int nsegs; +ti_newbuf_std(struct ti_softc *sc, int i, struct mbuf *m) +{ + bus_dmamap_t map; + bus_dma_segment_t segs; + struct mbuf *m_new = NULL; + struct ti_rx_desc *r; + int nsegs; nsegs = 0; if (m == NULL) { @@ -1291,16 +1249,13 @@ ti_newbuf_std(sc, i, m) * the Tigon 2. */ static int -ti_newbuf_mini(sc, i, m) - struct ti_softc *sc; - int i; - struct mbuf *m; -{ - bus_dma_segment_t segs; - bus_dmamap_t map; - struct mbuf *m_new = NULL; - struct ti_rx_desc *r; - int nsegs; +ti_newbuf_mini(struct ti_softc *sc, int i, struct mbuf *m) +{ + bus_dma_segment_t segs; + bus_dmamap_t map; + struct mbuf *m_new = NULL; + struct ti_rx_desc *r; + int nsegs; nsegs = 0; if (m == NULL) { @@ -1343,19 +1298,16 @@ ti_newbuf_mini(sc, i, m) * a jumbo buffer from the pool managed internally by the driver. */ static int -ti_newbuf_jumbo(sc, i, m) - struct ti_softc *sc; - int i; - struct mbuf *m; -{ - bus_dmamap_t map; - struct mbuf *m_new = NULL; - struct ti_rx_desc *r; - int nsegs; - bus_dma_segment_t segs; +ti_newbuf_jumbo(struct ti_softc *sc, int i, struct mbuf *m) +{ + bus_dmamap_t map; + struct mbuf *m_new = NULL; + struct ti_rx_desc *r; + int nsegs; + bus_dma_segment_t segs; if (m == NULL) { - caddr_t *buf = NULL; + caddr_t *buf = NULL; /* Allocate the mbuf. */ MGETHDR(m_new, M_DONTWAIT, MT_DATA); @@ -1375,7 +1327,7 @@ ti_newbuf_jumbo(sc, i, m) /* Attach the buffer to the mbuf. */ m_new->m_data = (void *) buf; m_new->m_len = m_new->m_pkthdr.len = TI_JUMBO_FRAMELEN; - MEXTADD(m_new, buf, TI_JUMBO_FRAMELEN, ti_jfree, + MEXTADD(m_new, buf, TI_JUMBO_FRAMELEN, ti_jfree, buf, (struct ti_softc *)sc, 0, EXT_NET_DRV); } else { m_new = m; @@ -1416,30 +1368,26 @@ ti_newbuf_jumbo(sc, i, m) #define TCP_HDR_LEN (52 + sizeof(struct ether_header)) #define UDP_HDR_LEN (28 + sizeof(struct ether_header)) #define NFS_HDR_LEN (UDP_HDR_LEN) -static int HDR_LEN = TCP_HDR_LEN; - +static int HDR_LEN = TCP_HDR_LEN; /* * Initialize a jumbo receive ring descriptor. This allocates * a jumbo buffer from the pool managed internally by the driver. */ static int -ti_newbuf_jumbo(sc, idx, m_old) - struct ti_softc *sc; - int idx; - struct mbuf *m_old; -{ - bus_dmamap_t map; - struct mbuf *cur, *m_new = NULL; - struct mbuf *m[3] = {NULL, NULL, NULL}; - struct ti_rx_desc_ext *r; - vm_page_t frame; - static int color; - /* 1 extra buf to make nobufs easy*/ - struct sf_buf *sf[3] = {NULL, NULL, NULL}; - int i; - bus_dma_segment_t segs[4]; - int nsegs; +ti_newbuf_jumbo(struct ti_softc *sc, int idx, struct mbuf *m_old) +{ + bus_dmamap_t map; + struct mbuf *cur, *m_new = NULL; + struct mbuf *m[3] = {NULL, NULL, NULL}; + struct ti_rx_desc_ext *r; + vm_page_t frame; + static int color; + /* 1 extra buf to make nobufs easy*/ + struct sf_buf *sf[3] = {NULL, NULL, NULL}; + int i; + bus_dma_segment_t segs[4]; + int nsegs; if (m_old != NULL) { m_new = m_old; @@ -1573,8 +1521,6 @@ nobufs: } #endif - - /* * The standard receive ring has 512 entries in it. At 2K per mbuf cluster, * that's 1MB or memory, which is a lot. For now, we fill only the first @@ -1582,11 +1528,10 @@ nobufs: * the NIC. */ static int -ti_init_rx_ring_std(sc) - struct ti_softc *sc; +ti_init_rx_ring_std(struct ti_softc *sc) { - int i; - struct ti_cmd_desc cmd; + int i; + struct ti_cmd_desc cmd; for (i = 0; i < TI_SSLOTS; i++) { if (ti_newbuf_std(sc, i, NULL) == ENOBUFS) @@ -1600,11 +1545,10 @@ ti_init_rx_ring_std(sc) } static void -ti_free_rx_ring_std(sc) - struct ti_softc *sc; +ti_free_rx_ring_std(struct ti_softc *sc) { - bus_dmamap_t map; - int i; + bus_dmamap_t map; + int i; for (i = 0; i < TI_STD_RX_RING_CNT; i++) { if (sc->ti_cdata.ti_rx_std_chain[i] != NULL) { @@ -1621,11 +1565,10 @@ ti_free_rx_ring_std(sc) } static int -ti_init_rx_ring_jumbo(sc) - struct ti_softc *sc; +ti_init_rx_ring_jumbo(struct ti_softc *sc) { - int i; - struct ti_cmd_desc cmd; + struct ti_cmd_desc cmd; + int i; for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) { if (ti_newbuf_jumbo(sc, i, NULL) == ENOBUFS) @@ -1639,11 +1582,10 @@ ti_init_rx_ring_jumbo(sc) } static void -ti_free_rx_ring_jumbo(sc) - struct ti_softc *sc; +ti_free_rx_ring_jumbo(struct ti_softc *sc) { - bus_dmamap_t map; - int i; + bus_dmamap_t map; + int i; for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) { if (sc->ti_cdata.ti_rx_jumbo_chain[i] != NULL) { @@ -1660,10 +1602,9 @@ ti_free_rx_ring_jumbo(sc) } static int -ti_init_rx_ring_mini(sc) - struct ti_softc *sc; +ti_init_rx_ring_mini(struct ti_softc *sc) { - int i; + int i; for (i = 0; i < TI_MSLOTS; i++) { if (ti_newbuf_mini(sc, i, NULL) == ENOBUFS) @@ -1677,11 +1618,10 @@ ti_init_rx_ring_mini(sc) } static void -ti_free_rx_ring_mini(sc) - struct ti_softc *sc; +ti_free_rx_ring_mini(struct ti_softc *sc) { - bus_dmamap_t map; - int i; + bus_dmamap_t map; + int i; for (i = 0; i < TI_MINI_RX_RING_CNT; i++) { if (sc->ti_cdata.ti_rx_mini_chain[i] != NULL) { @@ -1698,11 +1638,10 @@ ti_free_rx_ring_mini(sc) } static void -ti_free_tx_ring(sc) - struct ti_softc *sc; +ti_free_tx_ring(struct ti_softc *sc) { - struct ti_txdesc *txd; - int i; + struct ti_txdesc *txd; + int i; if (sc->ti_rdata->ti_tx_ring == NULL) return; @@ -1722,11 +1661,10 @@ ti_free_tx_ring(sc) } static int -ti_init_tx_ring(sc) - struct ti_softc *sc; +ti_init_tx_ring(struct ti_softc *sc) { - struct ti_txdesc *txd; - int i; + struct ti_txdesc *txd; + int i; STAILQ_INIT(&sc->ti_cdata.ti_txfreeq); STAILQ_INIT(&sc->ti_cdata.ti_txbusyq); @@ -1747,15 +1685,13 @@ ti_init_tx_ring(sc) * work. */ static void -ti_add_mcast(sc, addr) - struct ti_softc *sc; - struct ether_addr *addr; -{ - struct ti_cmd_desc cmd; - u_int16_t *m; - u_int32_t ext[2] = {0, 0}; +ti_add_mcast(struct ti_softc *sc, struct ether_addr *addr) +{ + struct ti_cmd_desc cmd; + uint16_t *m; + uint32_t ext[2] = {0, 0}; - m = (u_int16_t *)&addr->octet[0]; + m = (uint16_t *)&addr->octet[0]; switch (sc->ti_hwrev) { case TI_HWREV_TIGON: @@ -1775,15 +1711,13 @@ ti_add_mcast(sc, addr) } static void -ti_del_mcast(sc, addr) - struct ti_softc *sc; - struct ether_addr *addr; -{ - struct ti_cmd_desc cmd; - u_int16_t *m; - u_int32_t ext[2] = {0, 0}; +ti_del_mcast(struct ti_softc *sc, struct ether_addr *addr) +{ + struct ti_cmd_desc cmd; + uint16_t *m; + uint32_t ext[2] = {0, 0}; - m = (u_int16_t *)&addr->octet[0]; + m = (uint16_t *)&addr->octet[0]; switch (sc->ti_hwrev) { case TI_HWREV_TIGON: @@ -1817,14 +1751,13 @@ ti_del_mcast(sc, addr) * any given time. */ static void -ti_setmulti(sc) - struct ti_softc *sc; +ti_setmulti(struct ti_softc *sc) { - struct ifnet *ifp; - struct ifmultiaddr *ifma; - struct ti_cmd_desc cmd; - struct ti_mc_entry *mc; - u_int32_t intrs; + struct ifnet *ifp; + struct ifmultiaddr *ifma; + struct ti_cmd_desc cmd; + struct ti_mc_entry *mc; + uint32_t intrs; TI_LOCK_ASSERT(sc); @@ -1877,9 +1810,9 @@ ti_setmulti(sc) * around it on the Tigon 2 by setting a bit in the PCI state register, * but for the Tigon 1 we must give up and abort the interface attach. */ -static int ti_64bitslot_war(sc) - struct ti_softc *sc; +static int ti_64bitslot_war(struct ti_softc *sc) { + if (!(CSR_READ_4(sc, TI_PCI_STATE) & TI_PCISTATE_32BIT_BUS)) { CSR_WRITE_4(sc, 0x600, 0); CSR_WRITE_4(sc, 0x604, 0); @@ -1903,12 +1836,11 @@ static int ti_64bitslot_war(sc) * self-test results. */ static int -ti_chipinit(sc) - struct ti_softc *sc; +ti_chipinit(struct ti_softc *sc) { - u_int32_t cacheline; - u_int32_t pci_writemax = 0; - u_int32_t hdrsplit; + uint32_t cacheline; + uint32_t pci_writemax = 0; + uint32_t hdrsplit; /* Initialize link to down state. */ sc->ti_linkstat = TI_EV_CODE_LINK_DOWN; @@ -2068,13 +2000,12 @@ ti_chipinit(sc) * start the CPU(s) running. */ static int -ti_gibinit(sc) - struct ti_softc *sc; +ti_gibinit(struct ti_softc *sc) { - struct ti_rcb *rcb; - int i; - struct ifnet *ifp; - uint32_t rdphys; + struct ifnet *ifp; + struct ti_rcb *rcb; + uint32_t rdphys; + int i; TI_LOCK_ASSERT(sc); @@ -2255,16 +2186,15 @@ ti_rdata_cb(void *arg, bus_dma_segment_t sc->ti_rdata_phys = segs[0].ds_addr; return; } - + /* * Probe for a Tigon chip. Check the PCI vendor and device IDs * against our list and return its name if we find a match. */ static int -ti_probe(dev) - device_t dev; +ti_probe(device_t dev) { - struct ti_type *t; + struct ti_type *t; t = ti_devs; @@ -2281,13 +2211,12 @@ ti_probe(dev) } static int -ti_attach(dev) - device_t dev; +ti_attach(device_t dev) { - struct ifnet *ifp; - struct ti_softc *sc; - int error = 0, rid; - u_char eaddr[6]; + struct ifnet *ifp; + struct ti_softc *sc; + int error = 0, rid; + u_char eaddr[6]; sc = device_get_softc(dev); sc->ti_unit = device_get_unit(dev); @@ -2570,11 +2499,10 @@ fail: * allocated. */ static int -ti_detach(dev) - device_t dev; +ti_detach(device_t dev) { - struct ti_softc *sc; - struct ifnet *ifp; + struct ti_softc *sc; + struct ifnet *ifp; sc = device_get_softc(dev); if (sc->dev) @@ -2697,23 +2625,22 @@ ti_hdr_split(struct mbuf *top, int hdr_l */ static void -ti_rxeof(sc) - struct ti_softc *sc; +ti_rxeof(struct ti_softc *sc) { - bus_dmamap_t map; - struct ifnet *ifp; - struct ti_cmd_desc cmd; + struct ifnet *ifp; + bus_dmamap_t map; + struct ti_cmd_desc cmd; TI_LOCK_ASSERT(sc); ifp = sc->ti_ifp; while (sc->ti_rx_saved_considx != sc->ti_return_prodidx.ti_idx) { - struct ti_rx_desc *cur_rx; - u_int32_t rxidx; - struct mbuf *m = NULL; - u_int16_t vlan_tag = 0; - int have_tag = 0; + struct ti_rx_desc *cur_rx; + struct mbuf *m = NULL; + uint32_t rxidx; + uint16_t vlan_tag = 0; + int have_tag = 0; cur_rx = &sc->ti_rdata->ti_rx_return_ring[sc->ti_rx_saved_considx]; @@ -2831,14 +2758,13 @@ ti_rxeof(sc) } static void -ti_txeof(sc) - struct ti_softc *sc; +ti_txeof(struct ti_softc *sc) { - struct ti_txdesc *txd; - struct ti_tx_desc txdesc; - struct ti_tx_desc *cur_tx = NULL; - struct ifnet *ifp; - int idx; + struct ti_txdesc *txd; + struct ti_tx_desc txdesc; + struct ti_tx_desc *cur_tx = NULL; + struct ifnet *ifp; + int idx; ifp = sc->ti_ifp; @@ -2878,11 +2804,10 @@ ti_txeof(sc) } static void -ti_intr(xsc) - void *xsc; +ti_intr(void *xsc) { - struct ti_softc *sc; - struct ifnet *ifp; + struct ti_softc *sc; + struct ifnet *ifp; sc = xsc; TI_LOCK(sc); @@ -2921,10 +2846,9 @@ ti_intr(xsc) } static void -ti_stats_update(sc) - struct ti_softc *sc; +ti_stats_update(struct ti_softc *sc) { - struct ifnet *ifp; + struct ifnet *ifp; ifp = sc->ti_ifp; @@ -2947,17 +2871,15 @@ ti_stats_update(sc) * pointers to descriptors. */ static int -ti_encap(sc, m_head) - struct ti_softc *sc; - struct mbuf **m_head; -{ - struct ti_txdesc *txd; - struct ti_tx_desc *f; - struct ti_tx_desc txdesc; - struct mbuf *m; - bus_dma_segment_t txsegs[TI_MAXTXSEGS]; - u_int16_t csum_flags; - int error, frag, i, nseg; +ti_encap(struct ti_softc *sc, struct mbuf **m_head) +{ + struct ti_txdesc *txd; + struct ti_tx_desc *f; + struct ti_tx_desc txdesc; + struct mbuf *m; + bus_dma_segment_t txsegs[TI_MAXTXSEGS]; + uint16_t csum_flags; + int error, frag, i, nseg; if ((txd = STAILQ_FIRST(&sc->ti_cdata.ti_txfreeq)) == NULL) return (ENOBUFS); @@ -3052,10 +2974,9 @@ ti_encap(sc, m_head) } static void -ti_start(ifp) - struct ifnet *ifp; +ti_start(struct ifnet *ifp) { - struct ti_softc *sc; + struct ti_softc *sc; sc = ifp->if_softc; TI_LOCK(sc); @@ -3068,12 +2989,11 @@ ti_start(ifp) * to the mbuf data regions directly in the transmit descriptors. */ static void -ti_start_locked(ifp) - struct ifnet *ifp; +ti_start_locked(struct ifnet *ifp) { - struct ti_softc *sc; - struct mbuf *m_head = NULL; - int enq = 0; + struct ti_softc *sc; + struct mbuf *m_head = NULL; + int enq = 0; sc = ifp->if_softc; @@ -3134,10 +3054,9 @@ ti_start_locked(ifp) } static void -ti_init(xsc) - void *xsc; +ti_init(void *xsc) { - struct ti_softc *sc; + struct ti_softc *sc; sc = xsc; TI_LOCK(sc); @@ -3146,10 +3065,9 @@ ti_init(xsc) } static void -ti_init_locked(xsc) - void *xsc; +ti_init_locked(void *xsc) { - struct ti_softc *sc = xsc; + struct ti_softc *sc = xsc; /* Cancel pending I/O and flush buffers. */ ti_stop(sc); @@ -3161,14 +3079,13 @@ ti_init_locked(xsc) } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 19:07:53 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id 79ADF1065672; Tue, 3 Jan 2012 19:07:53 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from 172-17-198-245.globalsuite.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 3DCB71A6ECC; Tue, 3 Jan 2012 19:06:41 +0000 (UTC) Message-ID: <4F0351C0.6050103@FreeBSD.org> Date: Tue, 03 Jan 2012 11:06:40 -0800 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:9.0) Gecko/20111222 Thunderbird/9.0 MIME-Version: 1.0 To: John Baldwin References: <201112311312.pBVDCBja064475@svn.freebsd.org> <20111231140027.GA3487@reks> <4EFF16E0.7000206@t-hosting.hu> <201201030929.30656.jhb@freebsd.org> In-Reply-To: <201201030929.30656.jhb@freebsd.org> X-Enigmail-Version: undefined OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Cc: Gleb Kurtsou , src-committers@freebsd.org, svn-src-stable@freebsd.org, svn-src-all@freebsd.org, svn-src-stable-9@freebsd.org, =?ISO-8859-1?Q?G=E1bor_K=F6vesd=E1n?= , Gabor Kovesdan Subject: Re: svn commit: r229081 - stable/9/usr.bin/grep 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, 03 Jan 2012 19:07:53 -0000 On 01/03/2012 06:29, John Baldwin wrote: > On Saturday, December 31, 2011 9:06:24 am Gábor Kövesdán wrote: >> On 2011.12.31. 15:00, Gleb Kurtsou wrote: >>>> ${BINDIR}/grep ${BINDIR}/fgrep \ >>>>> ${BINDIR}/grep ${BINDIR}/zgrep \ >>>>> ${BINDIR}/grep ${BINDIR}/zegrep \ >>>>> - ${BINDIR}/grep ${BINDIR}/zfgrep \ >>>>> - ${BINDIR}/grep ${BINDIR}/xzgrep \ >>>>> - ${BINDIR}/grep ${BINDIR}/xzegrep \ >>>>> - ${BINDIR}/grep ${BINDIR}/xzfgrep \ >>>>> - ${BINDIR}/grep ${BINDIR}/lzgrep \ >>>>> - ${BINDIR}/grep ${BINDIR}/lzegrep \ >>>>> - ${BINDIR}/grep ${BINDIR}/lzfgrep >>>>> + ${BINDIR}/grep ${BINDIR}/zfgrep >>> Is there a reason we need all this mess is the first place? 12 grep links > under >>> /usr/bin. Why not to make zgrep handle all compression types. Tranparent >>> compression handling in tar was a great success. >>> >> 1, xzgrep comes from archivers/xz so scripts may be using it >> 2, the rest to follow the naming convention >> 3, auto-detection is not always trivial > > Presumably the auto-detection is more trivial than that in tar that handles > the combination of various archive formats and various compression formats. I > would definitely prefer to have a single "smart" zgrep that DTRT. I vaguely recall raising this same issue after the initial commit to HEAD, but just in case, a big +1 from me. Doug -- You can observe a lot just by watching. -- Yogi Berra Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 19:09:02 2012 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 B4AE6106566C; Tue, 3 Jan 2012 19:09:02 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 89AE68FC14; Tue, 3 Jan 2012 19:09: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 q03J92g6037885; Tue, 3 Jan 2012 19:09:02 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03J92Y4037882; Tue, 3 Jan 2012 19:09:02 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201201031909.q03J92Y4037882@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Tue, 3 Jan 2012 19:09: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: r229407 - head/sys/fs/ntfs 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, 03 Jan 2012 19:09:02 -0000 Author: pfg Date: Tue Jan 3 19:09:01 2012 New Revision: 229407 URL: http://svn.freebsd.org/changeset/base/229407 Log: Minor cleanups to ntfs code bzero -> memset rename variables to avoid shadowing. PR: 142401 Obtained from: NetBSD Approved by jhb (mentor) Modified: head/sys/fs/ntfs/ntfs_compr.c head/sys/fs/ntfs/ntfs_subr.c Modified: head/sys/fs/ntfs/ntfs_compr.c ============================================================================== --- head/sys/fs/ntfs/ntfs_compr.c Tue Jan 3 19:01:54 2012 (r229406) +++ head/sys/fs/ntfs/ntfs_compr.c Tue Jan 3 19:09:01 2012 (r229407) @@ -42,7 +42,7 @@ int ntfs_uncompblock( - u_int8_t * buf, + u_int8_t * dbuf, u_int8_t * cbuf) { u_int32_t ctag; @@ -60,8 +60,8 @@ ntfs_uncompblock( dprintf(("ntfs_uncompblock: len: %x instead of %d\n", len, 0xfff)); } - memcpy(buf, cbuf + 2, len + 1); - bzero(buf + len + 1, NTFS_COMPBLOCK_SIZE - 1 - len); + memcpy(dbuf, cbuf + 2, len + 1); + memset(dbuf + len + 1, 0, NTFS_COMPBLOCK_SIZE - 1 - len); return len + 3; } cpos = 2; @@ -78,12 +78,12 @@ ntfs_uncompblock( boff = -1 - (GET_UINT16(cbuf + cpos) >> dshift); blen = 3 + (GET_UINT16(cbuf + cpos) & lmask); for (j = 0; (j < blen) && (pos < NTFS_COMPBLOCK_SIZE); j++) { - buf[pos] = buf[pos + boff]; + dbuf[pos] = dbuf[pos + boff]; pos++; } cpos += 2; } else { - buf[pos++] = cbuf[cpos++]; + dbuf[pos++] = cbuf[cpos++]; } ctag >>= 1; } Modified: head/sys/fs/ntfs/ntfs_subr.c ============================================================================== --- head/sys/fs/ntfs/ntfs_subr.c Tue Jan 3 19:01:54 2012 (r229406) +++ head/sys/fs/ntfs/ntfs_subr.c Tue Jan 3 19:09:01 2012 (r229407) @@ -1636,7 +1636,7 @@ ntfs_readntvattr_plain( for(; remains; remains--) uiomove("", 1, uio); } else - bzero(data, tocopy); + memset(data, 0, tocopy); data = data + tocopy; } cnt++; @@ -1783,7 +1783,7 @@ ntfs_readattr( uiomove("", 1, uio); } else - bzero(data, tocopy); + memset(data, 0, tocopy); } else { error = ntfs_uncompunit(ntmp, uup, cup); if (error) From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 19:10:37 2012 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 96096106566C; Tue, 3 Jan 2012 19:10:37 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8555F8FC0A; Tue, 3 Jan 2012 19:10: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 q03JAbKQ037982; Tue, 3 Jan 2012 19:10:37 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03JAbY6037980; Tue, 3 Jan 2012 19:10:37 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201201031910.q03JAbY6037980@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Tue, 3 Jan 2012 19:10: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: r229408 - head/sys/mips/cavium/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, 03 Jan 2012 19:10:37 -0000 Author: gonzo Date: Tue Jan 3 19:10:37 2012 New Revision: 229408 URL: http://svn.freebsd.org/changeset/base/229408 Log: - Octeon-SDK strictly requires multi_count to be zero for full and low speed devices. Modified: head/sys/mips/cavium/usb/octusb.c Modified: head/sys/mips/cavium/usb/octusb.c ============================================================================== --- head/sys/mips/cavium/usb/octusb.c Tue Jan 3 19:09:01 2012 (r229407) +++ head/sys/mips/cavium/usb/octusb.c Tue Jan 3 19:10:37 2012 (r229408) @@ -169,7 +169,7 @@ octusb_host_alloc_endpoint(struct octusb (td->qh->ep_num & UE_DIR_IN) ? CVMX_USB_DIRECTION_IN : CVMX_USB_DIRECTION_OUT, td->qh->ep_interval, - td->qh->ep_mult, + (td->qh->dev_speed == USB_SPEED_HIGH) ? td->qh->ep_mult : 0, td->qh->hs_hub_addr, td->qh->hs_hub_port); From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 19:22:29 2012 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 9CA9D106566B; Tue, 3 Jan 2012 19:22:29 +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 707F98FC12; Tue, 3 Jan 2012 19:22: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 q03JMT0C038561; Tue, 3 Jan 2012 19:22:29 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03JMT87038558; Tue, 3 Jan 2012 19:22:29 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201031922.q03JMT87038558@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 19:22:29 +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: r229409 - stable/7/sys/dev/ti 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, 03 Jan 2012 19:22:29 -0000 Author: yongari Date: Tue Jan 3 19:22:28 2012 New Revision: 229409 URL: http://svn.freebsd.org/changeset/base/229409 Log: MFC r219547: - Allocate the DMA memory shared between the host and the controller as coherent. - Constify the ti_devs table. - Don't bother to set if_mtu to ETHERMTU, ether_ifattach() does that. Modified: stable/7/sys/dev/ti/if_ti.c stable/7/sys/dev/ti/if_tireg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/ti/if_ti.c ============================================================================== --- stable/7/sys/dev/ti/if_ti.c Tue Jan 3 19:10:37 2012 (r229408) +++ stable/7/sys/dev/ti/if_ti.c Tue Jan 3 19:22:28 2012 (r229409) @@ -144,7 +144,7 @@ typedef enum { * Various supported device vendors/types and their names. */ -static struct ti_type ti_devs[] = { +static const struct ti_type const ti_devs[] = { { ALT_VENDORID, ALT_DEVICEID_ACENIC, "Alteon AceNIC 1000baseSX Gigabit Ethernet" }, { ALT_VENDORID, ALT_DEVICEID_ACENIC_COPPER, @@ -1083,7 +1083,8 @@ ti_alloc_jumbo_mem(struct ti_softc *sc) if (bus_dmamem_alloc(sc->ti_jumbo_dmat, (void**)&sc->ti_cdata.ti_jumbo_buf, - BUS_DMA_NOWAIT, &sc->ti_jumbo_dmamap) != 0) { + BUS_DMA_NOWAIT | BUS_DMA_COHERENT, + &sc->ti_jumbo_dmamap) != 0) { device_printf(sc->ti_dev, "Failed to allocate jumbo memory\n"); return (ENOBUFS); } @@ -2194,7 +2195,7 @@ ti_rdata_cb(void *arg, bus_dma_segment_t static int ti_probe(device_t dev) { - struct ti_type *t; + const struct ti_type *t; t = ti_devs; @@ -2330,7 +2331,8 @@ ti_attach(device_t dev) } if (bus_dmamem_alloc(sc->ti_rdata_dmat, (void**)&sc->ti_rdata, - BUS_DMA_NOWAIT, &sc->ti_rdata_dmamap) != 0) { + BUS_DMA_NOWAIT | BUS_DMA_COHERENT, + &sc->ti_rdata_dmamap) != 0) { device_printf(dev, "Failed to allocate rdata memory\n"); error = ENOMEM; goto fail; @@ -2428,7 +2430,6 @@ ti_attach(device_t dev) ifp->if_start = ti_start; ifp->if_init = ti_init; ifp->if_baudrate = 1000000000; - ifp->if_mtu = ETHERMTU; ifp->if_snd.ifq_maxlen = TI_TX_RING_CNT - 1; /* Set up ifmedia support. */ Modified: stable/7/sys/dev/ti/if_tireg.h ============================================================================== --- stable/7/sys/dev/ti/if_tireg.h Tue Jan 3 19:10:37 2012 (r229408) +++ stable/7/sys/dev/ti/if_tireg.h Tue Jan 3 19:22:28 2012 (r229409) @@ -967,7 +967,7 @@ struct ti_chain_data { struct ti_type { uint16_t ti_vid; uint16_t ti_did; - char *ti_name; + const char *ti_name; }; #define TI_HWREV_TIGON 0x01 From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 19:38:57 2012 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 869A5106566C; Tue, 3 Jan 2012 19:38:57 +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 5B45F8FC18; Tue, 3 Jan 2012 19:38: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 q03Jcv7u039264; Tue, 3 Jan 2012 19:38:57 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03Jcvws039260; Tue, 3 Jan 2012 19:38:57 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201201031938.q03Jcvws039260@svn.freebsd.org> From: Ed Schouten Date: Tue, 3 Jan 2012 19:38:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229411 - in vendor/compiler-rt/dist: . lib 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, 03 Jan 2012 19:38:57 -0000 Author: ed Date: Tue Jan 3 19:38:56 2012 New Revision: 229411 URL: http://svn.freebsd.org/changeset/base/229411 Log: Import compiler-rt r147467. Modified: vendor/compiler-rt/dist/LICENSE.TXT vendor/compiler-rt/dist/lib/clear_cache.c vendor/compiler-rt/dist/lib/trampoline_setup.c Modified: vendor/compiler-rt/dist/LICENSE.TXT ============================================================================== --- vendor/compiler-rt/dist/LICENSE.TXT Tue Jan 3 19:24:33 2012 (r229410) +++ vendor/compiler-rt/dist/LICENSE.TXT Tue Jan 3 19:38:56 2012 (r229411) @@ -14,7 +14,7 @@ Full text of the relevant licenses is in University of Illinois/NCSA Open Source License -Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT +Copyright (c) 2009-2012 by the contributors listed in CREDITS.TXT All rights reserved. @@ -55,7 +55,7 @@ SOFTWARE. ============================================================================== -Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT +Copyright (c) 2009-2012 by the contributors listed in CREDITS.TXT Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal Modified: vendor/compiler-rt/dist/lib/clear_cache.c ============================================================================== --- vendor/compiler-rt/dist/lib/clear_cache.c Tue Jan 3 19:24:33 2012 (r229410) +++ vendor/compiler-rt/dist/lib/clear_cache.c Tue Jan 3 19:38:56 2012 (r229411) @@ -8,6 +8,8 @@ * ===----------------------------------------------------------------------=== */ +#include "int_lib.h" + #if __APPLE__ #include #endif Modified: vendor/compiler-rt/dist/lib/trampoline_setup.c ============================================================================== --- vendor/compiler-rt/dist/lib/trampoline_setup.c Tue Jan 3 19:24:33 2012 (r229410) +++ vendor/compiler-rt/dist/lib/trampoline_setup.c Tue Jan 3 19:38:56 2012 (r229411) @@ -20,7 +20,7 @@ extern void __clear_cache(void* start, v * and then jumps to the target nested function. */ -#if __ppc__ +#if __ppc__ && !defined(__powerpc64__) void __trampoline_setup(uint32_t* trampOnStack, int trampSizeAllocated, const void* realFunc, void* localsPtr) { @@ -44,4 +44,4 @@ void __trampoline_setup(uint32_t* trampO /* clear instruction cache */ __clear_cache(trampOnStack, &trampOnStack[10]); } -#endif /* __ppc__ */ +#endif /* __ppc__ && !defined(__powerpc64__) */ From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 19:39:28 2012 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 1BAAD1065672; Tue, 3 Jan 2012 19:39:28 +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 E4EB68FC1B; Tue, 3 Jan 2012 19:39:27 +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 q03JdRN9039315; Tue, 3 Jan 2012 19:39:27 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03JdRcZ039314; Tue, 3 Jan 2012 19:39:27 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201201031939.q03JdRcZ039314@svn.freebsd.org> From: Ed Schouten Date: Tue, 3 Jan 2012 19:39:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229412 - vendor/compiler-rt/compiler-rt-r147467 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, 03 Jan 2012 19:39:28 -0000 Author: ed Date: Tue Jan 3 19:39:27 2012 New Revision: 229412 URL: http://svn.freebsd.org/changeset/base/229412 Log: Tag compiler-rt r147467. Added: vendor/compiler-rt/compiler-rt-r147467/ - copied from r229411, vendor/compiler-rt/dist/ From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 19:41:37 2012 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 4AB52106566C; Tue, 3 Jan 2012 19:41:37 +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 39E418FC12; Tue, 3 Jan 2012 19:41: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 q03JfbBS039429; Tue, 3 Jan 2012 19:41:37 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03JfboX039426; Tue, 3 Jan 2012 19:41:37 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201201031941.q03JfboX039426@svn.freebsd.org> From: Ed Schouten Date: Tue, 3 Jan 2012 19:41: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: r229413 - in head/contrib/compiler-rt: . lib 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, 03 Jan 2012 19:41:37 -0000 Author: ed Date: Tue Jan 3 19:41:36 2012 New Revision: 229413 URL: http://svn.freebsd.org/changeset/base/229413 Log: Import compiler-rt r147467. The compiler-rt shipped with FreeBSD is now based on unmodified upstream sources. Modified: head/contrib/compiler-rt/LICENSE.TXT head/contrib/compiler-rt/lib/trampoline_setup.c Directory Properties: head/contrib/compiler-rt/ (props changed) Modified: head/contrib/compiler-rt/LICENSE.TXT ============================================================================== --- head/contrib/compiler-rt/LICENSE.TXT Tue Jan 3 19:39:27 2012 (r229412) +++ head/contrib/compiler-rt/LICENSE.TXT Tue Jan 3 19:41:36 2012 (r229413) @@ -14,7 +14,7 @@ Full text of the relevant licenses is in University of Illinois/NCSA Open Source License -Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT +Copyright (c) 2009-2012 by the contributors listed in CREDITS.TXT All rights reserved. @@ -55,7 +55,7 @@ SOFTWARE. ============================================================================== -Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT +Copyright (c) 2009-2012 by the contributors listed in CREDITS.TXT Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal Modified: head/contrib/compiler-rt/lib/trampoline_setup.c ============================================================================== --- head/contrib/compiler-rt/lib/trampoline_setup.c Tue Jan 3 19:39:27 2012 (r229412) +++ head/contrib/compiler-rt/lib/trampoline_setup.c Tue Jan 3 19:41:36 2012 (r229413) @@ -44,4 +44,4 @@ void __trampoline_setup(uint32_t* trampO /* clear instruction cache */ __clear_cache(trampOnStack, &trampOnStack[10]); } -#endif /* __ppc__ */ +#endif /* __ppc__ && !defined(__powerpc64__) */ From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 19:44:37 2012 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 33540106564A; Tue, 3 Jan 2012 19:44:37 +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 0841F8FC12; Tue, 3 Jan 2012 19:44: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 q03JiaCw039561; Tue, 3 Jan 2012 19:44:36 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03Jia46039559; Tue, 3 Jan 2012 19:44:36 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201031944.q03Jia46039559@svn.freebsd.org> From: John Baldwin Date: Tue, 3 Jan 2012 19:44: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: r229414 - head/sys/netinet6 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, 03 Jan 2012 19:44:37 -0000 Author: jhb Date: Tue Jan 3 19:44:36 2012 New Revision: 229414 URL: http://svn.freebsd.org/changeset/base/229414 Log: Grab a reference on the matching interface address (ifa) in the handling of the SIOC[DG]LIFADDR icotls before dropping the IF_ADDR_LOCK() and release the reference after using it. This prevents the address from being potentially freed out from under the ioctl handler. Reviewed by: bz MFC after: 1 week Modified: head/sys/netinet6/in6.c Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Tue Jan 3 19:41:36 2012 (r229413) +++ head/sys/netinet6/in6.c Tue Jan 3 19:44:36 2012 (r229414) @@ -1767,6 +1767,8 @@ in6_lifaddr_ioctl(struct socket *so, u_l if (IN6_ARE_ADDR_EQUAL(&candidate, &match)) break; } + if (ifa != NULL) + ifa_ref(ifa); IF_ADDR_UNLOCK(ifp); if (!ifa) return EADDRNOTAVAIL; @@ -1779,16 +1781,20 @@ in6_lifaddr_ioctl(struct socket *so, u_l bcopy(&ia->ia_addr, &iflr->addr, ia->ia_addr.sin6_len); error = sa6_recoverscope( (struct sockaddr_in6 *)&iflr->addr); - if (error != 0) + if (error != 0) { + ifa_free(ifa); return (error); + } if ((ifp->if_flags & IFF_POINTOPOINT) != 0) { bcopy(&ia->ia_dstaddr, &iflr->dstaddr, ia->ia_dstaddr.sin6_len); error = sa6_recoverscope( (struct sockaddr_in6 *)&iflr->dstaddr); - if (error != 0) + if (error != 0) { + ifa_free(ifa); return (error); + } } else bzero(&iflr->dstaddr, sizeof(iflr->dstaddr)); @@ -1796,6 +1802,7 @@ in6_lifaddr_ioctl(struct socket *so, u_l in6_mask2len(&ia->ia_prefixmask.sin6_addr, NULL); iflr->flags = ia->ia6_flags; /* XXX */ + ifa_free(ifa); return 0; } else { @@ -1819,6 +1826,7 @@ in6_lifaddr_ioctl(struct socket *so, u_l ia->ia_prefixmask.sin6_len); ifra.ifra_flags = ia->ia6_flags; + ifa_free(ifa); return in6_control(so, SIOCDIFADDR_IN6, (caddr_t)&ifra, ifp, td); } From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 19:47:33 2012 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 96FD4106566C; Tue, 3 Jan 2012 19:47:33 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 857CF8FC13; Tue, 3 Jan 2012 19:47:33 +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 q03JlXh4039686; Tue, 3 Jan 2012 19:47:33 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03JlXnx039684; Tue, 3 Jan 2012 19:47:33 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201201031947.q03JlXnx039684@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Tue, 3 Jan 2012 19:47: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: r229415 - head/lib/libvgl 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, 03 Jan 2012 19:47:33 -0000 Author: pfg Date: Tue Jan 3 19:47:32 2012 New Revision: 229415 URL: http://svn.freebsd.org/changeset/base/229415 Log: Integrate the line drawing algorithm from the book "Graphic Gems 1". http://www.graphicsgems.org/ At the time it claimed to be 3-4 times faster than the traditional algorithm. PR: 18769 Approved by: jhb (mentor) MFC after: 2 weeks Modified: head/lib/libvgl/simple.c Modified: head/lib/libvgl/simple.c ============================================================================== --- head/lib/libvgl/simple.c Tue Jan 3 19:44:36 2012 (r229414) +++ head/lib/libvgl/simple.c Tue Jan 3 19:47:32 2012 (r229415) @@ -198,36 +198,205 @@ get_planar: return 0; /* XXX black? */ } + /* + * Symmetric Double Step Line Algorithm by Brian Wyvill from + * "Graphics Gems", Academic Press, 1990. + */ + +#define SL_SWAP(a,b) {a^=b; b^=a; a^=b;} +#define SL_ABSOLUTE(i,j,k) ( (i-j)*(k = ( (i-j)<0 ? -1 : 1))) + +void +plot(VGLBitmap * object, int x, int y, int flag, byte color) +{ + /* non-zero flag indicates the pixels need swapping back. */ + if (flag) + VGLSetXY(object, y, x, color); + else + VGLSetXY(object, x, y, color); +} + + void VGLLine(VGLBitmap *object, int x1, int y1, int x2, int y2, u_long color) { - int d, x, y, ax, ay, sx, sy, dx, dy; + int dx, dy, incr1, incr2, D, x, y, xend, c, pixels_left; + int sign_x, sign_y, step, reverse, i; - dx = x2-x1; ax = ABS(dx)<<1; sx = SGN(dx); x = x1; - dy = y2-y1; ay = ABS(dy)<<1; sy = SGN(dy); y = y1; + dx = SL_ABSOLUTE(x2, x1, sign_x); + dy = SL_ABSOLUTE(y2, y1, sign_y); + /* decide increment sign by the slope sign */ + if (sign_x == sign_y) + step = 1; + else + step = -1; + + if (dy > dx) { /* chooses axis of greatest movement (make dx) */ + SL_SWAP(x1, y1); + SL_SWAP(x2, y2); + SL_SWAP(dx, dy); + reverse = 1; + } else + reverse = 0; + /* note error check for dx==0 should be included here */ + if (x1 > x2) { /* start from the smaller coordinate */ + x = x2; + y = y2; + x1 = x1; + y1 = y1; + } else { + x = x1; + y = y1; + x1 = x2; + y1 = y2; + } + + + /* Note dx=n implies 0 - n or (dx+1) pixels to be set */ + /* Go round loop dx/4 times then plot last 0,1,2 or 3 pixels */ + /* In fact (dx-1)/4 as 2 pixels are already plotted */ + xend = (dx - 1) / 4; + pixels_left = (dx - 1) % 4; /* number of pixels left over at the + * end */ + plot(object, x, y, reverse, color); + if (pixels_left < 0) + return; /* plot only one pixel for zero length + * vectors */ + plot(object, x1, y1, reverse, color); /* plot first two points */ + incr2 = 4 * dy - 2 * dx; + if (incr2 < 0) { /* slope less than 1/2 */ + c = 2 * dy; + incr1 = 2 * c; + D = incr1 - dx; + + for (i = 0; i < xend; i++) { /* plotting loop */ + ++x; + --x1; + if (D < 0) { + /* pattern 1 forwards */ + plot(object, x, y, reverse, color); + plot(object, ++x, y, reverse, color); + /* pattern 1 backwards */ + plot(object, x1, y1, reverse, color); + plot(object, --x1, y1, reverse, color); + D += incr1; + } else { + if (D < c) { + /* pattern 2 forwards */ + plot(object, x, y, reverse, color); + plot(object, ++x, y += step, reverse, + color); + /* pattern 2 backwards */ + plot(object, x1, y1, reverse, color); + plot(object, --x1, y1 -= step, reverse, + color); + } else { + /* pattern 3 forwards */ + plot(object, x, y += step, reverse, color); + plot(object, ++x, y, reverse, color); + /* pattern 3 backwards */ + plot(object, x1, y1 -= step, reverse, + color); + plot(object, --x1, y1, reverse, color); + } + D += incr2; + } + } /* end for */ - if (ax>ay) { /* x dominant */ - d = ay-(ax>>1); - for (;;) { - VGLSetXY(object, x, y, color); - if (x==x2) - break; - if (d>=0) { - y += sy; d -= ax; + /* plot last pattern */ + if (pixels_left) { + if (D < 0) { + plot(object, ++x, y, reverse, color); /* pattern 1 */ + if (pixels_left > 1) + plot(object, ++x, y, reverse, color); + if (pixels_left > 2) + plot(object, --x1, y1, reverse, color); + } else { + if (D < c) { + plot(object, ++x, y, reverse, color); /* pattern 2 */ + if (pixels_left > 1) + plot(object, ++x, y += step, reverse, color); + if (pixels_left > 2) + plot(object, --x1, y1, reverse, color); + } else { + /* pattern 3 */ + plot(object, ++x, y += step, reverse, color); + if (pixels_left > 1) + plot(object, ++x, y, reverse, color); + if (pixels_left > 2) + plot(object, --x1, y1 -= step, reverse, color); + } } - x += sx; d += ay; - } + } /* end if pixels_left */ } - else { /* y dominant */ - d = ax-(ay>>1); - for (;;) { - VGLSetXY(object, x, y, color); - if (y==y2) - break; - if (d>=0) { - x += sx; d -= ay; + /* end slope < 1/2 */ + else { /* slope greater than 1/2 */ + c = 2 * (dy - dx); + incr1 = 2 * c; + D = incr1 + dx; + for (i = 0; i < xend; i++) { + ++x; + --x1; + if (D > 0) { + /* pattern 4 forwards */ + plot(object, x, y += step, reverse, color); + plot(object, ++x, y += step, reverse, color); + /* pattern 4 backwards */ + plot(object, x1, y1 -= step, reverse, color); + plot(object, --x1, y1 -= step, reverse, color); + D += incr1; + } else { + if (D < c) { + /* pattern 2 forwards */ + plot(object, x, y, reverse, color); + plot(object, ++x, y += step, reverse, + color); + + /* pattern 2 backwards */ + plot(object, x1, y1, reverse, color); + plot(object, --x1, y1 -= step, reverse, + color); + } else { + /* pattern 3 forwards */ + plot(object, x, y += step, reverse, color); + plot(object, ++x, y, reverse, color); + /* pattern 3 backwards */ + plot(object, x1, y1 -= step, reverse, color); + plot(object, --x1, y1, reverse, color); + } + D += incr2; + } + } /* end for */ + /* plot last pattern */ + if (pixels_left) { + if (D > 0) { + plot(object, ++x, y += step, reverse, color); /* pattern 4 */ + if (pixels_left > 1) + plot(object, ++x, y += step, reverse, + color); + if (pixels_left > 2) + plot(object, --x1, y1 -= step, reverse, + color); + } else { + if (D < c) { + plot(object, ++x, y, reverse, color); /* pattern 2 */ + if (pixels_left > 1) + plot(object, ++x, y += step, reverse, color); + if (pixels_left > 2) + plot(object, --x1, y1, reverse, color); + } else { + /* pattern 3 */ + plot(object, ++x, y += step, reverse, color); + if (pixels_left > 1) + plot(object, ++x, y, reverse, color); + if (pixels_left > 2) { + if (D > c) /* step 3 */ + plot(object, --x1, y1 -= step, reverse, color); + else /* step 2 */ + plot(object, --x1, y1, reverse, color); + } + } } - y += sy; d += ax; } } } From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 20:17:36 2012 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 431A4106566B; Tue, 3 Jan 2012 20:17:36 +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 327908FC12; Tue, 3 Jan 2012 20:17:36 +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 q03KHaOV040725; Tue, 3 Jan 2012 20:17:36 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03KHZ0Z040723; Tue, 3 Jan 2012 20:17:35 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201201032017.q03KHZ0Z040723@svn.freebsd.org> From: Xin LI Date: Tue, 3 Jan 2012 20:17:35 +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: r229416 - head/sys/dev/tws 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, 03 Jan 2012 20:17:36 -0000 Author: delphij Date: Tue Jan 3 20:17:35 2012 New Revision: 229416 URL: http://svn.freebsd.org/changeset/base/229416 Log: Don't forget to release queue lock when allocation of memory failed. Submitted by: Sascha Wildner Obtained from: DragonFly MFC after: 2 weeks Modified: head/sys/dev/tws/tws.c Modified: head/sys/dev/tws/tws.c ============================================================================== --- head/sys/dev/tws/tws.c Tue Jan 3 19:47:32 2012 (r229415) +++ head/sys/dev/tws/tws.c Tue Jan 3 20:17:35 2012 (r229416) @@ -685,6 +685,7 @@ tws_init_reqs(struct tws_softc *sc, u_in { if (bus_dmamap_create(sc->data_tag, 0, &sc->reqs[i].dma_map)) { /* log a ENOMEM failure msg here */ + mtx_unlock(&sc->q_lock); return(FAILURE); } sc->reqs[i].cmd_pkt = &cmd_buf[i]; From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 20:24:57 2012 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 3F1CF106566C; Tue, 3 Jan 2012 20:24:57 +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 2C8888FC08; Tue, 3 Jan 2012 20:24: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 q03KOvwT040995; Tue, 3 Jan 2012 20:24:57 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03KOvHx040993; Tue, 3 Jan 2012 20:24:57 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201032024.q03KOvHx040993@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 20:24:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229417 - stable/9/sys/dev/ti 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, 03 Jan 2012 20:24:57 -0000 Author: yongari Date: Tue Jan 3 20:24:56 2012 New Revision: 229417 URL: http://svn.freebsd.org/changeset/base/229417 Log: MFC r227091-227095,227098-227099: r227091: Make sure to unload loaded DMA area(descriptor, command, event ring). r227092: Announce IFCAP_LINKSTATE capability and let network stack know link state changes. Hide superfluous link up/down message under bootverbose since if_link_state_change(9) shows that information. While I'm here, change baudrate with the resolved speed of the established link instead of blindly setting it 1G. Unfortunately, it seems there is no way to differentiate 10/100Mbps from non-gigabit link so just assume we established a 100Mbps link if current link is not a gigabit link. r227093: Introduce ti_ifmedia_upd_locked() to use in driver initialization and add missing driver lock for both ti_ifmedia_upd() and ti_ifmedia_sts(). r227094: Don't clear upper 4bits from VLAN tag information. It's responsibility of vlan(4) to extract VLAN id from the tag information and vlan(4) correctly handles it. r227095: Don't abuse if_hwassist and make sure enabling corresponding TX/RX checksum offloading and VLAN hardware tag insertion/stripping from the currently enabled hardware offloading capabilities. Previously if_hwassist, which was initialized to TX/RX checksum offloading, was blindly used to enable both TX and RX checksum offloading such that disabling either TX or RX checksum offloading was not possible. ti(4) controllers support TX/RX checksum offloading with VLAN tagging so announce TX/RX checksum offloading capability over VLAN to vlan(4). Make VLAN hardware tag insertion/stripping honors currently enabled interface capability instead of blindly enabling VLAN hardware tagging. This change allows disabling hardware support of VLAN tag. Because ti(4) supports VLAN oversized frames, make network stack know the capability by setting if_hdrlen. While I'm here, rewrite SIOCSIFCAP handler and make sure to reinitialize controller whenever TX/RX checksum offloading and VLAN hardware tagging option is changed. The requirement of controller reinitialization comes from the limitation of Tigon I/II firmware. Tigon I/II firmware requires all related RCBs should be reinitialized whenever any of its hardware offloading capabilities change. vlan(4) is also notified whenever the parent interface's capability changes such that it can correctly handle TX/RX checksum offloading based on parent interface's enabled offloading capabilities. RX checksum offloading handler was changed to make upper stack use controller computed partial checksum value. Previously, ti(4) just set the computed value for any frames(IPv4, IPv6) and the value was not used in upper stack because driver didn't set CSUM_DATA_VALID such that upper network stack had to recompute checksum of TCP/UDP packets. I have no idea how this was not noticed for a long time. With this change, upper network stack does not have to fully recompute the checksum such that calculating pseudo checksum based on partial checksum is sufficient to know whether received packet's checksum is correct or not. However, I don't know why ti(4) does not have controller compute pseudo checksum as controller has ability to do it. I'm just guessing enabling that feature could trigger a firmware bug or could be slower than computing it on host side so just leave it as it was. In order not to produce false positives, ti(4) now checks whether controller actually computed IP or TCP/UDP checksum by checking ti_flags field. r227098: Because ti(4) drops a driver lock in RX handler, check whether driver is still running before re-enabling interrupts. r227099: Implement altq(4) support. While I'm here fix a logic error in r227098 where it didn't re-enable interrupts when TX queue is empty. Modified: stable/9/sys/dev/ti/if_ti.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/ti/if_ti.c ============================================================================== --- stable/9/sys/dev/ti/if_ti.c Tue Jan 3 20:17:35 2012 (r229416) +++ stable/9/sys/dev/ti/if_ti.c Tue Jan 3 20:24:56 2012 (r229417) @@ -196,6 +196,7 @@ static void ti_stop(struct ti_softc *); static void ti_watchdog(void *); static int ti_shutdown(device_t); static int ti_ifmedia_upd(struct ifnet *); +static int ti_ifmedia_upd_locked(struct ti_softc *); static void ti_ifmedia_sts(struct ifnet *, struct ifmediareq *); static uint32_t ti_eeprom_putbyte(struct ti_softc *, int); @@ -924,12 +925,26 @@ ti_handle_events(struct ti_softc *sc) switch (TI_EVENT_EVENT(e)) { case TI_EV_LINKSTAT_CHANGED: sc->ti_linkstat = TI_EVENT_CODE(e); - if (sc->ti_linkstat == TI_EV_CODE_LINK_UP) - device_printf(sc->ti_dev, "10/100 link up\n"); - else if (sc->ti_linkstat == TI_EV_CODE_GIG_LINK_UP) - device_printf(sc->ti_dev, "gigabit link up\n"); - else if (sc->ti_linkstat == TI_EV_CODE_LINK_DOWN) - device_printf(sc->ti_dev, "link down\n"); + if (sc->ti_linkstat == TI_EV_CODE_LINK_UP) { + if_link_state_change(sc->ti_ifp, LINK_STATE_UP); + sc->ti_ifp->if_baudrate = IF_Mbps(100); + if (bootverbose) + device_printf(sc->ti_dev, + "10/100 link up\n"); + } else if (sc->ti_linkstat == TI_EV_CODE_GIG_LINK_UP) { + if_link_state_change(sc->ti_ifp, LINK_STATE_UP); + sc->ti_ifp->if_baudrate = IF_Gbps(1UL); + if (bootverbose) + device_printf(sc->ti_dev, + "gigabit link up\n"); + } else if (sc->ti_linkstat == TI_EV_CODE_LINK_DOWN) { + if_link_state_change(sc->ti_ifp, + LINK_STATE_DOWN); + sc->ti_ifp->if_baudrate = 0; + if (bootverbose) + device_printf(sc->ti_dev, + "link down\n"); + } break; case TI_EV_ERROR: if (TI_EVENT_CODE(e) == TI_EV_CODE_ERR_INVAL_CMD) @@ -1237,7 +1252,7 @@ ti_newbuf_std(struct ti_softc *sc, int i r->ti_len = segs.ds_len; r->ti_type = TI_BDTYPE_RECV_BD; r->ti_flags = 0; - if (sc->ti_ifp->if_hwassist) + if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; r->ti_idx = i; @@ -1284,7 +1299,7 @@ ti_newbuf_mini(struct ti_softc *sc, int r->ti_len = segs.ds_len; r->ti_type = TI_BDTYPE_RECV_BD; r->ti_flags = TI_BDFLAG_MINI_RING; - if (sc->ti_ifp->if_hwassist) + if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; r->ti_idx = i; @@ -1350,7 +1365,7 @@ ti_newbuf_jumbo(struct ti_softc *sc, int r->ti_len = segs.ds_len; r->ti_type = TI_BDTYPE_RECV_JUMBO_BD; r->ti_flags = TI_BDFLAG_JUMBO_RING; - if (sc->ti_ifp->if_hwassist) + if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; r->ti_idx = i; @@ -1492,7 +1507,7 @@ ti_newbuf_jumbo(struct ti_softc *sc, int r->ti_flags = TI_BDFLAG_JUMBO_RING|TI_RCB_FLAG_USE_EXT_RX_BD; - if (sc->ti_ifp->if_hwassist) + if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM|TI_BDFLAG_IP_CKSUM; r->ti_idx = idx; @@ -1845,11 +1860,6 @@ ti_chipinit(struct ti_softc *sc) /* Initialize link to down state. */ sc->ti_linkstat = TI_EV_CODE_LINK_DOWN; - if (sc->ti_ifp->if_capenable & IFCAP_HWCSUM) - sc->ti_ifp->if_hwassist = TI_CSUM_FEATURES; - else - sc->ti_ifp->if_hwassist = 0; - /* Set endianness before we access any non-PCI registers. */ #if 0 && BYTE_ORDER == BIG_ENDIAN CSR_WRITE_4(sc, TI_MISC_HOST_CTL, @@ -1968,7 +1978,7 @@ ti_chipinit(struct ti_softc *sc) * the firmware racks up lots of nicDmaReadRingFull * errors. This is not compatible with hardware checksums. */ - if (sc->ti_ifp->if_hwassist == 0) + if ((sc->ti_ifp->if_capenable & (IFCAP_TXCSUM | IFCAP_RXCSUM)) == 0) TI_SETBIT(sc, TI_GCR_OPMODE, TI_OPMODE_1_DMA_ACTIVE); /* Recommended settings from Tigon manual. */ @@ -2055,10 +2065,11 @@ ti_gibinit(struct ti_softc *sc) TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_rx_std_ring); rcb->ti_max_len = TI_FRAMELEN; rcb->ti_flags = 0; - if (sc->ti_ifp->if_hwassist) + if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) rcb->ti_flags |= TI_RCB_FLAG_TCP_UDP_CKSUM | TI_RCB_FLAG_IP_CKSUM | TI_RCB_FLAG_NO_PHDR_CKSUM; - rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; + if (sc->ti_ifp->if_capenable & IFCAP_VLAN_HWTAGGING) + rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; /* Set up the jumbo receive ring. */ rcb = &sc->ti_rdata->ti_info.ti_jumbo_rx_rcb; @@ -2071,10 +2082,11 @@ ti_gibinit(struct ti_softc *sc) rcb->ti_max_len = PAGE_SIZE; rcb->ti_flags = TI_RCB_FLAG_USE_EXT_RX_BD; #endif - if (sc->ti_ifp->if_hwassist) + if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) rcb->ti_flags |= TI_RCB_FLAG_TCP_UDP_CKSUM | TI_RCB_FLAG_IP_CKSUM | TI_RCB_FLAG_NO_PHDR_CKSUM; - rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; + if (sc->ti_ifp->if_capenable & IFCAP_VLAN_HWTAGGING) + rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; /* * Set up the mini ring. Only activated on the @@ -2088,10 +2100,11 @@ ti_gibinit(struct ti_softc *sc) rcb->ti_flags = TI_RCB_FLAG_RING_DISABLED; else rcb->ti_flags = 0; - if (sc->ti_ifp->if_hwassist) + if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) rcb->ti_flags |= TI_RCB_FLAG_TCP_UDP_CKSUM | TI_RCB_FLAG_IP_CKSUM | TI_RCB_FLAG_NO_PHDR_CKSUM; - rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; + if (sc->ti_ifp->if_capenable & IFCAP_VLAN_HWTAGGING) + rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; /* * Set up the receive return ring. @@ -2120,8 +2133,9 @@ ti_gibinit(struct ti_softc *sc) rcb->ti_flags = 0; else rcb->ti_flags = TI_RCB_FLAG_HOST_RING; - rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; - if (sc->ti_ifp->if_hwassist) + if (sc->ti_ifp->if_capenable & IFCAP_VLAN_HWTAGGING) + rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; + if (sc->ti_ifp->if_capenable & IFCAP_TXCSUM) rcb->ti_flags |= TI_RCB_FLAG_TCP_UDP_CKSUM | TI_RCB_FLAG_IP_CKSUM | TI_RCB_FLAG_NO_PHDR_CKSUM; rcb->ti_max_len = TI_TX_RING_CNT; @@ -2221,8 +2235,8 @@ ti_attach(device_t dev) error = ENOSPC; goto fail; } - sc->ti_ifp->if_capabilities = IFCAP_HWCSUM | - IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; + sc->ti_ifp->if_hwassist = TI_CSUM_FEATURES; + sc->ti_ifp->if_capabilities = IFCAP_TXCSUM | IFCAP_RXCSUM; sc->ti_ifp->if_capenable = sc->ti_ifp->if_capabilities; /* @@ -2417,8 +2431,10 @@ ti_attach(device_t dev) ifp->if_ioctl = ti_ioctl; ifp->if_start = ti_start; ifp->if_init = ti_init; - ifp->if_baudrate = 1000000000; - ifp->if_snd.ifq_maxlen = TI_TX_RING_CNT - 1; + ifp->if_baudrate = IF_Gbps(1UL); + ifp->if_snd.ifq_drv_maxlen = TI_TX_RING_CNT - 1; + IFQ_SET_MAXLEN(&ifp->if_snd, ifp->if_snd.ifq_drv_maxlen); + IFQ_SET_READY(&ifp->if_snd); /* Set up ifmedia support. */ if (sc->ti_copper) { @@ -2464,6 +2480,17 @@ ti_attach(device_t dev) */ ether_ifattach(ifp, eaddr); + /* VLAN capability setup. */ + ifp->if_capabilities |= IFCAP_VLAN_MTU | IFCAP_VLAN_HWCSUM | + IFCAP_VLAN_HWTAGGING; + ifp->if_capenable = ifp->if_capabilities; + /* Tell the upper layer we support VLAN over-sized frames. */ + ifp->if_hdrlen = sizeof(struct ether_vlan_header); + + /* Driver supports link state tracking. */ + ifp->if_capabilities |= IFCAP_LINKSTATE; + ifp->if_capenable |= IFCAP_LINKSTATE; + /* Hook interrupt last to avoid having to lock softc */ error = bus_setup_intr(dev, sc->ti_irq, INTR_TYPE_NET|INTR_MPSAFE, NULL, ti_intr, sc, &sc->ti_intrhand); @@ -2522,6 +2549,8 @@ ti_detach(device_t dev) bus_dma_tag_destroy(sc->ti_mbuftx_dmat); if (sc->ti_mbufrx_dmat) bus_dma_tag_destroy(sc->ti_mbufrx_dmat); + if (sc->ti_rdata && sc->ti_rdata_dmamap) + bus_dmamap_unload(sc->ti_rdata_dmat, sc->ti_rdata_dmamap); if (sc->ti_rdata) bus_dmamem_free(sc->ti_rdata_dmat, sc->ti_rdata, sc->ti_rdata_dmamap); @@ -2638,7 +2667,7 @@ ti_rxeof(struct ti_softc *sc) if (cur_rx->ti_flags & TI_BDFLAG_VLAN_TAG) { have_tag = 1; - vlan_tag = cur_rx->ti_vlan_tag & 0xfff; + vlan_tag = cur_rx->ti_vlan_tag; } if (cur_rx->ti_flags & TI_BDFLAG_JUMBO_RING) { @@ -2715,12 +2744,17 @@ ti_rxeof(struct ti_softc *sc) ifp->if_ipackets++; m->m_pkthdr.rcvif = ifp; - if (ifp->if_hwassist) { - m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED | - CSUM_DATA_VALID; - if ((cur_rx->ti_ip_cksum ^ 0xffff) == 0) - m->m_pkthdr.csum_flags |= CSUM_IP_VALID; - m->m_pkthdr.csum_data = cur_rx->ti_tcp_udp_cksum; + if (ifp->if_capenable & IFCAP_RXCSUM) { + if (cur_rx->ti_flags & TI_BDFLAG_IP_CKSUM) { + m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED; + if ((cur_rx->ti_ip_cksum ^ 0xffff) == 0) + m->m_pkthdr.csum_flags |= CSUM_IP_VALID; + } + if (cur_rx->ti_flags & TI_BDFLAG_TCP_UDP_CKSUM) { + m->m_pkthdr.csum_data = + cur_rx->ti_tcp_udp_cksum; + m->m_pkthdr.csum_flags |= CSUM_DATA_VALID; + } } /* @@ -2824,12 +2858,12 @@ ti_intr(void *xsc) ti_handle_events(sc); - /* Re-enable interrupts. */ - CSR_WRITE_4(sc, TI_MB_HOSTINTR, 0); - - if (ifp->if_drv_flags & IFF_DRV_RUNNING && - ifp->if_snd.ifq_head != NULL) - ti_start_locked(ifp); + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + /* Re-enable interrupts. */ + CSR_WRITE_4(sc, TI_MB_HOSTINTR, 0); + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + ti_start_locked(ifp); + } TI_UNLOCK(sc); } @@ -2933,7 +2967,7 @@ ti_encap(struct ti_softc *sc, struct mbu f->ti_flags = csum_flags; if (m->m_flags & M_VLANTAG) { f->ti_flags |= TI_BDFLAG_VLAN_TAG; - f->ti_vlan_tag = m->m_pkthdr.ether_vtag & 0xfff; + f->ti_vlan_tag = m->m_pkthdr.ether_vtag; } else { f->ti_vlan_tag = 0; } @@ -2986,9 +3020,9 @@ ti_start_locked(struct ifnet *ifp) sc = ifp->if_softc; - for (; ifp->if_snd.ifq_head != NULL && + for (; !IFQ_DRV_IS_EMPTY(&ifp->if_snd) && sc->ti_txcnt < (TI_TX_RING_CNT - 16);) { - IF_DEQUEUE(&ifp->if_snd, m_head); + IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head); if (m_head == NULL) break; @@ -3004,7 +3038,7 @@ ti_start_locked(struct ifnet *ifp) m_head->m_pkthdr.csum_flags & (CSUM_DELAY_DATA)) { if ((TI_TX_RING_CNT - sc->ti_txcnt) < m_head->m_pkthdr.csum_data + 16) { - IF_PREPEND(&ifp->if_snd, m_head); + IFQ_DRV_PREPEND(&ifp->if_snd, m_head); ifp->if_drv_flags |= IFF_DRV_OACTIVE; break; } @@ -3018,7 +3052,7 @@ ti_start_locked(struct ifnet *ifp) if (ti_encap(sc, &m_head)) { if (m_head == NULL) break; - IF_PREPEND(&ifp->if_snd, m_head); + IFQ_DRV_PREPEND(&ifp->if_snd, m_head); ifp->if_drv_flags |= IFF_DRV_OACTIVE; break; } @@ -3150,7 +3184,7 @@ static void ti_init2(struct ti_softc *sc ifm = &sc->ifmedia; tmp = ifm->ifm_media; ifm->ifm_media = ifm->ifm_cur->ifm_media; - ti_ifmedia_upd(ifp); + ti_ifmedia_upd_locked(sc); ifm->ifm_media = tmp; } @@ -3161,11 +3195,23 @@ static int ti_ifmedia_upd(struct ifnet *ifp) { struct ti_softc *sc; + int error; + + sc = ifp->if_softc; + TI_LOCK(sc); + error = ti_ifmedia_upd(ifp); + TI_UNLOCK(sc); + + return (error); +} + +static int +ti_ifmedia_upd_locked(struct ti_softc *sc) +{ struct ifmedia *ifm; struct ti_cmd_desc cmd; uint32_t flowctl; - sc = ifp->if_softc; ifm = &sc->ifmedia; if (IFM_TYPE(ifm->ifm_media) != IFM_ETHER) @@ -3266,11 +3312,15 @@ ti_ifmedia_sts(struct ifnet *ifp, struct sc = ifp->if_softc; + TI_LOCK(sc); + ifmr->ifm_status = IFM_AVALID; ifmr->ifm_active = IFM_ETHER; - if (sc->ti_linkstat == TI_EV_CODE_LINK_DOWN) + if (sc->ti_linkstat == TI_EV_CODE_LINK_DOWN) { + TI_UNLOCK(sc); return; + } ifmr->ifm_status |= IFM_ACTIVE; @@ -3302,6 +3352,7 @@ ti_ifmedia_sts(struct ifnet *ifp, struct if (media & TI_LNK_HALF_DUPLEX) ifmr->ifm_active |= IFM_HDX; } + TI_UNLOCK(sc); } static int @@ -3368,15 +3419,32 @@ ti_ioctl(struct ifnet *ifp, u_long comma case SIOCSIFCAP: TI_LOCK(sc); mask = ifr->ifr_reqcap ^ ifp->if_capenable; - if (mask & IFCAP_HWCSUM) { - if (IFCAP_HWCSUM & ifp->if_capenable) - ifp->if_capenable &= ~IFCAP_HWCSUM; - else - ifp->if_capenable |= IFCAP_HWCSUM; - if (ifp->if_drv_flags & IFF_DRV_RUNNING) + if ((mask & IFCAP_TXCSUM) != 0 && + (ifp->if_capabilities & IFCAP_TXCSUM) != 0) { + ifp->if_capenable ^= IFCAP_TXCSUM; + if ((ifp->if_capenable & IFCAP_TXCSUM) != 0) + ifp->if_hwassist |= TI_CSUM_FEATURES; + else + ifp->if_hwassist &= ~TI_CSUM_FEATURES; + } + if ((mask & IFCAP_RXCSUM) != 0 && + (ifp->if_capabilities & IFCAP_RXCSUM) != 0) + ifp->if_capenable ^= IFCAP_RXCSUM; + if ((mask & IFCAP_VLAN_HWTAGGING) != 0 && + (ifp->if_capabilities & IFCAP_VLAN_HWTAGGING) != 0) + ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; + if ((mask & IFCAP_VLAN_HWCSUM) != 0 && + (ifp->if_capabilities & IFCAP_VLAN_HWCSUM) != 0) + ifp->if_capenable ^= IFCAP_VLAN_HWCSUM; + if ((mask & (IFCAP_TXCSUM | IFCAP_RXCSUM | + IFCAP_VLAN_HWTAGGING)) != 0) { + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; ti_init_locked(sc); + } } TI_UNLOCK(sc); + VLAN_CAPABILITIES(ifp); break; default: error = ether_ioctl(ifp, command, data); From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 20:26:28 2012 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 83C73106568B; Tue, 3 Jan 2012 20:26:28 +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 714628FC17; Tue, 3 Jan 2012 20:26: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 q03KQS1Q041141; Tue, 3 Jan 2012 20:26:28 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03KQSiF041139; Tue, 3 Jan 2012 20:26:28 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201032026.q03KQSiF041139@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 20:26: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: r229418 - in stable/8/sys: conf dev/ti 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, 03 Jan 2012 20:26:28 -0000 Author: yongari Date: Tue Jan 3 20:26:28 2012 New Revision: 229418 URL: http://svn.freebsd.org/changeset/base/229418 Log: MFC r227091-227095,227098-227099: r227091: Make sure to unload loaded DMA area(descriptor, command, event ring). r227092: Announce IFCAP_LINKSTATE capability and let network stack know link state changes. Hide superfluous link up/down message under bootverbose since if_link_state_change(9) shows that information. While I'm here, change baudrate with the resolved speed of the established link instead of blindly setting it 1G. Unfortunately, it seems there is no way to differentiate 10/100Mbps from non-gigabit link so just assume we established a 100Mbps link if current link is not a gigabit link. r227093: Introduce ti_ifmedia_upd_locked() to use in driver initialization and add missing driver lock for both ti_ifmedia_upd() and ti_ifmedia_sts(). r227094: Don't clear upper 4bits from VLAN tag information. It's responsibility of vlan(4) to extract VLAN id from the tag information and vlan(4) correctly handles it. r227095: Don't abuse if_hwassist and make sure enabling corresponding TX/RX checksum offloading and VLAN hardware tag insertion/stripping from the currently enabled hardware offloading capabilities. Previously if_hwassist, which was initialized to TX/RX checksum offloading, was blindly used to enable both TX and RX checksum offloading such that disabling either TX or RX checksum offloading was not possible. ti(4) controllers support TX/RX checksum offloading with VLAN tagging so announce TX/RX checksum offloading capability over VLAN to vlan(4). Make VLAN hardware tag insertion/stripping honors currently enabled interface capability instead of blindly enabling VLAN hardware tagging. This change allows disabling hardware support of VLAN tag. Because ti(4) supports VLAN oversized frames, make network stack know the capability by setting if_hdrlen. While I'm here, rewrite SIOCSIFCAP handler and make sure to reinitialize controller whenever TX/RX checksum offloading and VLAN hardware tagging option is changed. The requirement of controller reinitialization comes from the limitation of Tigon I/II firmware. Tigon I/II firmware requires all related RCBs should be reinitialized whenever any of its hardware offloading capabilities change. vlan(4) is also notified whenever the parent interface's capability changes such that it can correctly handle TX/RX checksum offloading based on parent interface's enabled offloading capabilities. RX checksum offloading handler was changed to make upper stack use controller computed partial checksum value. Previously, ti(4) just set the computed value for any frames(IPv4, IPv6) and the value was not used in upper stack because driver didn't set CSUM_DATA_VALID such that upper network stack had to recompute checksum of TCP/UDP packets. I have no idea how this was not noticed for a long time. With this change, upper network stack does not have to fully recompute the checksum such that calculating pseudo checksum based on partial checksum is sufficient to know whether received packet's checksum is correct or not. However, I don't know why ti(4) does not have controller compute pseudo checksum as controller has ability to do it. I'm just guessing enabling that feature could trigger a firmware bug or could be slower than computing it on host side so just leave it as it was. In order not to produce false positives, ti(4) now checks whether controller actually computed IP or TCP/UDP checksum by checking ti_flags field. r227098: Because ti(4) drops a driver lock in RX handler, check whether driver is still running before re-enabling interrupts. r227099: Implement altq(4) support. While I'm here fix a logic error in r227098 where it didn't re-enable interrupts when TX queue is empty. Modified: stable/8/sys/dev/ti/if_ti.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/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/ti/if_ti.c ============================================================================== --- stable/8/sys/dev/ti/if_ti.c Tue Jan 3 20:24:56 2012 (r229417) +++ stable/8/sys/dev/ti/if_ti.c Tue Jan 3 20:26:28 2012 (r229418) @@ -196,6 +196,7 @@ static void ti_stop(struct ti_softc *); static void ti_watchdog(void *); static int ti_shutdown(device_t); static int ti_ifmedia_upd(struct ifnet *); +static int ti_ifmedia_upd_locked(struct ti_softc *); static void ti_ifmedia_sts(struct ifnet *, struct ifmediareq *); static uint32_t ti_eeprom_putbyte(struct ti_softc *, int); @@ -924,12 +925,26 @@ ti_handle_events(struct ti_softc *sc) switch (TI_EVENT_EVENT(e)) { case TI_EV_LINKSTAT_CHANGED: sc->ti_linkstat = TI_EVENT_CODE(e); - if (sc->ti_linkstat == TI_EV_CODE_LINK_UP) - device_printf(sc->ti_dev, "10/100 link up\n"); - else if (sc->ti_linkstat == TI_EV_CODE_GIG_LINK_UP) - device_printf(sc->ti_dev, "gigabit link up\n"); - else if (sc->ti_linkstat == TI_EV_CODE_LINK_DOWN) - device_printf(sc->ti_dev, "link down\n"); + if (sc->ti_linkstat == TI_EV_CODE_LINK_UP) { + if_link_state_change(sc->ti_ifp, LINK_STATE_UP); + sc->ti_ifp->if_baudrate = IF_Mbps(100); + if (bootverbose) + device_printf(sc->ti_dev, + "10/100 link up\n"); + } else if (sc->ti_linkstat == TI_EV_CODE_GIG_LINK_UP) { + if_link_state_change(sc->ti_ifp, LINK_STATE_UP); + sc->ti_ifp->if_baudrate = IF_Gbps(1UL); + if (bootverbose) + device_printf(sc->ti_dev, + "gigabit link up\n"); + } else if (sc->ti_linkstat == TI_EV_CODE_LINK_DOWN) { + if_link_state_change(sc->ti_ifp, + LINK_STATE_DOWN); + sc->ti_ifp->if_baudrate = 0; + if (bootverbose) + device_printf(sc->ti_dev, + "link down\n"); + } break; case TI_EV_ERROR: if (TI_EVENT_CODE(e) == TI_EV_CODE_ERR_INVAL_CMD) @@ -1237,7 +1252,7 @@ ti_newbuf_std(struct ti_softc *sc, int i r->ti_len = segs.ds_len; r->ti_type = TI_BDTYPE_RECV_BD; r->ti_flags = 0; - if (sc->ti_ifp->if_hwassist) + if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; r->ti_idx = i; @@ -1284,7 +1299,7 @@ ti_newbuf_mini(struct ti_softc *sc, int r->ti_len = segs.ds_len; r->ti_type = TI_BDTYPE_RECV_BD; r->ti_flags = TI_BDFLAG_MINI_RING; - if (sc->ti_ifp->if_hwassist) + if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; r->ti_idx = i; @@ -1350,7 +1365,7 @@ ti_newbuf_jumbo(struct ti_softc *sc, int r->ti_len = segs.ds_len; r->ti_type = TI_BDTYPE_RECV_JUMBO_BD; r->ti_flags = TI_BDFLAG_JUMBO_RING; - if (sc->ti_ifp->if_hwassist) + if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; r->ti_idx = i; @@ -1494,7 +1509,7 @@ ti_newbuf_jumbo(struct ti_softc *sc, int r->ti_flags = TI_BDFLAG_JUMBO_RING|TI_RCB_FLAG_USE_EXT_RX_BD; - if (sc->ti_ifp->if_hwassist) + if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM|TI_BDFLAG_IP_CKSUM; r->ti_idx = idx; @@ -1847,11 +1862,6 @@ ti_chipinit(struct ti_softc *sc) /* Initialize link to down state. */ sc->ti_linkstat = TI_EV_CODE_LINK_DOWN; - if (sc->ti_ifp->if_capenable & IFCAP_HWCSUM) - sc->ti_ifp->if_hwassist = TI_CSUM_FEATURES; - else - sc->ti_ifp->if_hwassist = 0; - /* Set endianness before we access any non-PCI registers. */ #if 0 && BYTE_ORDER == BIG_ENDIAN CSR_WRITE_4(sc, TI_MISC_HOST_CTL, @@ -1970,7 +1980,7 @@ ti_chipinit(struct ti_softc *sc) * the firmware racks up lots of nicDmaReadRingFull * errors. This is not compatible with hardware checksums. */ - if (sc->ti_ifp->if_hwassist == 0) + if ((sc->ti_ifp->if_capenable & (IFCAP_TXCSUM | IFCAP_RXCSUM)) == 0) TI_SETBIT(sc, TI_GCR_OPMODE, TI_OPMODE_1_DMA_ACTIVE); /* Recommended settings from Tigon manual. */ @@ -2057,10 +2067,11 @@ ti_gibinit(struct ti_softc *sc) TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_rx_std_ring); rcb->ti_max_len = TI_FRAMELEN; rcb->ti_flags = 0; - if (sc->ti_ifp->if_hwassist) + if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) rcb->ti_flags |= TI_RCB_FLAG_TCP_UDP_CKSUM | TI_RCB_FLAG_IP_CKSUM | TI_RCB_FLAG_NO_PHDR_CKSUM; - rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; + if (sc->ti_ifp->if_capenable & IFCAP_VLAN_HWTAGGING) + rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; /* Set up the jumbo receive ring. */ rcb = &sc->ti_rdata->ti_info.ti_jumbo_rx_rcb; @@ -2073,10 +2084,11 @@ ti_gibinit(struct ti_softc *sc) rcb->ti_max_len = PAGE_SIZE; rcb->ti_flags = TI_RCB_FLAG_USE_EXT_RX_BD; #endif - if (sc->ti_ifp->if_hwassist) + if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) rcb->ti_flags |= TI_RCB_FLAG_TCP_UDP_CKSUM | TI_RCB_FLAG_IP_CKSUM | TI_RCB_FLAG_NO_PHDR_CKSUM; - rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; + if (sc->ti_ifp->if_capenable & IFCAP_VLAN_HWTAGGING) + rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; /* * Set up the mini ring. Only activated on the @@ -2090,10 +2102,11 @@ ti_gibinit(struct ti_softc *sc) rcb->ti_flags = TI_RCB_FLAG_RING_DISABLED; else rcb->ti_flags = 0; - if (sc->ti_ifp->if_hwassist) + if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) rcb->ti_flags |= TI_RCB_FLAG_TCP_UDP_CKSUM | TI_RCB_FLAG_IP_CKSUM | TI_RCB_FLAG_NO_PHDR_CKSUM; - rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; + if (sc->ti_ifp->if_capenable & IFCAP_VLAN_HWTAGGING) + rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; /* * Set up the receive return ring. @@ -2122,8 +2135,9 @@ ti_gibinit(struct ti_softc *sc) rcb->ti_flags = 0; else rcb->ti_flags = TI_RCB_FLAG_HOST_RING; - rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; - if (sc->ti_ifp->if_hwassist) + if (sc->ti_ifp->if_capenable & IFCAP_VLAN_HWTAGGING) + rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; + if (sc->ti_ifp->if_capenable & IFCAP_TXCSUM) rcb->ti_flags |= TI_RCB_FLAG_TCP_UDP_CKSUM | TI_RCB_FLAG_IP_CKSUM | TI_RCB_FLAG_NO_PHDR_CKSUM; rcb->ti_max_len = TI_TX_RING_CNT; @@ -2223,8 +2237,8 @@ ti_attach(device_t dev) error = ENOSPC; goto fail; } - sc->ti_ifp->if_capabilities = IFCAP_HWCSUM | - IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; + sc->ti_ifp->if_hwassist = TI_CSUM_FEATURES; + sc->ti_ifp->if_capabilities = IFCAP_TXCSUM | IFCAP_RXCSUM; sc->ti_ifp->if_capenable = sc->ti_ifp->if_capabilities; /* @@ -2419,8 +2433,10 @@ ti_attach(device_t dev) ifp->if_ioctl = ti_ioctl; ifp->if_start = ti_start; ifp->if_init = ti_init; - ifp->if_baudrate = 1000000000; - ifp->if_snd.ifq_maxlen = TI_TX_RING_CNT - 1; + ifp->if_baudrate = IF_Gbps(1UL); + ifp->if_snd.ifq_drv_maxlen = TI_TX_RING_CNT - 1; + IFQ_SET_MAXLEN(&ifp->if_snd, ifp->if_snd.ifq_drv_maxlen); + IFQ_SET_READY(&ifp->if_snd); /* Set up ifmedia support. */ if (sc->ti_copper) { @@ -2466,6 +2482,17 @@ ti_attach(device_t dev) */ ether_ifattach(ifp, eaddr); + /* VLAN capability setup. */ + ifp->if_capabilities |= IFCAP_VLAN_MTU | IFCAP_VLAN_HWCSUM | + IFCAP_VLAN_HWTAGGING; + ifp->if_capenable = ifp->if_capabilities; + /* Tell the upper layer we support VLAN over-sized frames. */ + ifp->if_hdrlen = sizeof(struct ether_vlan_header); + + /* Driver supports link state tracking. */ + ifp->if_capabilities |= IFCAP_LINKSTATE; + ifp->if_capenable |= IFCAP_LINKSTATE; + /* Hook interrupt last to avoid having to lock softc */ error = bus_setup_intr(dev, sc->ti_irq, INTR_TYPE_NET|INTR_MPSAFE, NULL, ti_intr, sc, &sc->ti_intrhand); @@ -2524,6 +2551,8 @@ ti_detach(device_t dev) bus_dma_tag_destroy(sc->ti_mbuftx_dmat); if (sc->ti_mbufrx_dmat) bus_dma_tag_destroy(sc->ti_mbufrx_dmat); + if (sc->ti_rdata && sc->ti_rdata_dmamap) + bus_dmamap_unload(sc->ti_rdata_dmat, sc->ti_rdata_dmamap); if (sc->ti_rdata) bus_dmamem_free(sc->ti_rdata_dmat, sc->ti_rdata, sc->ti_rdata_dmamap); @@ -2640,7 +2669,7 @@ ti_rxeof(struct ti_softc *sc) if (cur_rx->ti_flags & TI_BDFLAG_VLAN_TAG) { have_tag = 1; - vlan_tag = cur_rx->ti_vlan_tag & 0xfff; + vlan_tag = cur_rx->ti_vlan_tag; } if (cur_rx->ti_flags & TI_BDFLAG_JUMBO_RING) { @@ -2717,12 +2746,17 @@ ti_rxeof(struct ti_softc *sc) ifp->if_ipackets++; m->m_pkthdr.rcvif = ifp; - if (ifp->if_hwassist) { - m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED | - CSUM_DATA_VALID; - if ((cur_rx->ti_ip_cksum ^ 0xffff) == 0) - m->m_pkthdr.csum_flags |= CSUM_IP_VALID; - m->m_pkthdr.csum_data = cur_rx->ti_tcp_udp_cksum; + if (ifp->if_capenable & IFCAP_RXCSUM) { + if (cur_rx->ti_flags & TI_BDFLAG_IP_CKSUM) { + m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED; + if ((cur_rx->ti_ip_cksum ^ 0xffff) == 0) + m->m_pkthdr.csum_flags |= CSUM_IP_VALID; + } + if (cur_rx->ti_flags & TI_BDFLAG_TCP_UDP_CKSUM) { + m->m_pkthdr.csum_data = + cur_rx->ti_tcp_udp_cksum; + m->m_pkthdr.csum_flags |= CSUM_DATA_VALID; + } } /* @@ -2826,12 +2860,12 @@ ti_intr(void *xsc) ti_handle_events(sc); - /* Re-enable interrupts. */ - CSR_WRITE_4(sc, TI_MB_HOSTINTR, 0); - - if (ifp->if_drv_flags & IFF_DRV_RUNNING && - ifp->if_snd.ifq_head != NULL) - ti_start_locked(ifp); + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + /* Re-enable interrupts. */ + CSR_WRITE_4(sc, TI_MB_HOSTINTR, 0); + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + ti_start_locked(ifp); + } TI_UNLOCK(sc); } @@ -2935,7 +2969,7 @@ ti_encap(struct ti_softc *sc, struct mbu f->ti_flags = csum_flags; if (m->m_flags & M_VLANTAG) { f->ti_flags |= TI_BDFLAG_VLAN_TAG; - f->ti_vlan_tag = m->m_pkthdr.ether_vtag & 0xfff; + f->ti_vlan_tag = m->m_pkthdr.ether_vtag; } else { f->ti_vlan_tag = 0; } @@ -2988,9 +3022,9 @@ ti_start_locked(struct ifnet *ifp) sc = ifp->if_softc; - for (; ifp->if_snd.ifq_head != NULL && + for (; !IFQ_DRV_IS_EMPTY(&ifp->if_snd) && sc->ti_txcnt < (TI_TX_RING_CNT - 16);) { - IF_DEQUEUE(&ifp->if_snd, m_head); + IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head); if (m_head == NULL) break; @@ -3006,7 +3040,7 @@ ti_start_locked(struct ifnet *ifp) m_head->m_pkthdr.csum_flags & (CSUM_DELAY_DATA)) { if ((TI_TX_RING_CNT - sc->ti_txcnt) < m_head->m_pkthdr.csum_data + 16) { - IF_PREPEND(&ifp->if_snd, m_head); + IFQ_DRV_PREPEND(&ifp->if_snd, m_head); ifp->if_drv_flags |= IFF_DRV_OACTIVE; break; } @@ -3020,7 +3054,7 @@ ti_start_locked(struct ifnet *ifp) if (ti_encap(sc, &m_head)) { if (m_head == NULL) break; - IF_PREPEND(&ifp->if_snd, m_head); + IFQ_DRV_PREPEND(&ifp->if_snd, m_head); ifp->if_drv_flags |= IFF_DRV_OACTIVE; break; } @@ -3152,7 +3186,7 @@ static void ti_init2(struct ti_softc *sc ifm = &sc->ifmedia; tmp = ifm->ifm_media; ifm->ifm_media = ifm->ifm_cur->ifm_media; - ti_ifmedia_upd(ifp); + ti_ifmedia_upd_locked(sc); ifm->ifm_media = tmp; } @@ -3163,11 +3197,23 @@ static int ti_ifmedia_upd(struct ifnet *ifp) { struct ti_softc *sc; + int error; + + sc = ifp->if_softc; + TI_LOCK(sc); + error = ti_ifmedia_upd(ifp); + TI_UNLOCK(sc); + + return (error); +} + +static int +ti_ifmedia_upd_locked(struct ti_softc *sc) +{ struct ifmedia *ifm; struct ti_cmd_desc cmd; uint32_t flowctl; - sc = ifp->if_softc; ifm = &sc->ifmedia; if (IFM_TYPE(ifm->ifm_media) != IFM_ETHER) @@ -3268,11 +3314,15 @@ ti_ifmedia_sts(struct ifnet *ifp, struct sc = ifp->if_softc; + TI_LOCK(sc); + ifmr->ifm_status = IFM_AVALID; ifmr->ifm_active = IFM_ETHER; - if (sc->ti_linkstat == TI_EV_CODE_LINK_DOWN) + if (sc->ti_linkstat == TI_EV_CODE_LINK_DOWN) { + TI_UNLOCK(sc); return; + } ifmr->ifm_status |= IFM_ACTIVE; @@ -3304,6 +3354,7 @@ ti_ifmedia_sts(struct ifnet *ifp, struct if (media & TI_LNK_HALF_DUPLEX) ifmr->ifm_active |= IFM_HDX; } + TI_UNLOCK(sc); } static int @@ -3370,15 +3421,32 @@ ti_ioctl(struct ifnet *ifp, u_long comma case SIOCSIFCAP: TI_LOCK(sc); mask = ifr->ifr_reqcap ^ ifp->if_capenable; - if (mask & IFCAP_HWCSUM) { - if (IFCAP_HWCSUM & ifp->if_capenable) - ifp->if_capenable &= ~IFCAP_HWCSUM; - else - ifp->if_capenable |= IFCAP_HWCSUM; - if (ifp->if_drv_flags & IFF_DRV_RUNNING) + if ((mask & IFCAP_TXCSUM) != 0 && + (ifp->if_capabilities & IFCAP_TXCSUM) != 0) { + ifp->if_capenable ^= IFCAP_TXCSUM; + if ((ifp->if_capenable & IFCAP_TXCSUM) != 0) + ifp->if_hwassist |= TI_CSUM_FEATURES; + else + ifp->if_hwassist &= ~TI_CSUM_FEATURES; + } + if ((mask & IFCAP_RXCSUM) != 0 && + (ifp->if_capabilities & IFCAP_RXCSUM) != 0) + ifp->if_capenable ^= IFCAP_RXCSUM; + if ((mask & IFCAP_VLAN_HWTAGGING) != 0 && + (ifp->if_capabilities & IFCAP_VLAN_HWTAGGING) != 0) + ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; + if ((mask & IFCAP_VLAN_HWCSUM) != 0 && + (ifp->if_capabilities & IFCAP_VLAN_HWCSUM) != 0) + ifp->if_capenable ^= IFCAP_VLAN_HWCSUM; + if ((mask & (IFCAP_TXCSUM | IFCAP_RXCSUM | + IFCAP_VLAN_HWTAGGING)) != 0) { + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; ti_init_locked(sc); + } } TI_UNLOCK(sc); + VLAN_CAPABILITIES(ifp); break; default: error = ether_ioctl(ifp, command, data); From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 20:28:17 2012 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 4A59B1065675; Tue, 3 Jan 2012 20:28:17 +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 380508FC20; Tue, 3 Jan 2012 20:28: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 q03KSHcF041246; Tue, 3 Jan 2012 20:28:17 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03KSHw6041244; Tue, 3 Jan 2012 20:28:17 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201032028.q03KSHw6041244@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 20:28:17 +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: r229419 - stable/7/sys/dev/ti 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, 03 Jan 2012 20:28:17 -0000 Author: yongari Date: Tue Jan 3 20:28:17 2012 New Revision: 229419 URL: http://svn.freebsd.org/changeset/base/229419 Log: MFC r227091-227095,227098-227099: r227091: Make sure to unload loaded DMA area(descriptor, command, event ring). r227092: Paritial merge since IFCAP_LINKSTATE capability is not available on stable/7. Hide superfluous link up/down message under bootverbose since if_link_state_change(9) shows that information. While I'm here, change baudrate with the resolved speed of the established link instead of blindly setting it 1G. Unfortunately, it seems there is no way to differentiate 10/100Mbps from non-gigabit link so just assume we established a 100Mbps link if current link is not a gigabit link. r227093: Introduce ti_ifmedia_upd_locked() to use in driver initialization and add missing driver lock for both ti_ifmedia_upd() and ti_ifmedia_sts(). r227094: Don't clear upper 4bits from VLAN tag information. It's responsibility of vlan(4) to extract VLAN id from the tag information and vlan(4) correctly handles it. r227095: Don't abuse if_hwassist and make sure enabling corresponding TX/RX checksum offloading and VLAN hardware tag insertion/stripping from the currently enabled hardware offloading capabilities. Previously if_hwassist, which was initialized to TX/RX checksum offloading, was blindly used to enable both TX and RX checksum offloading such that disabling either TX or RX checksum offloading was not possible. ti(4) controllers support TX/RX checksum offloading with VLAN tagging so announce TX/RX checksum offloading capability over VLAN to vlan(4). Make VLAN hardware tag insertion/stripping honors currently enabled interface capability instead of blindly enabling VLAN hardware tagging. This change allows disabling hardware support of VLAN tag. Because ti(4) supports VLAN oversized frames, make network stack know the capability by setting if_hdrlen. While I'm here, rewrite SIOCSIFCAP handler and make sure to reinitialize controller whenever TX/RX checksum offloading and VLAN hardware tagging option is changed. The requirement of controller reinitialization comes from the limitation of Tigon I/II firmware. Tigon I/II firmware requires all related RCBs should be reinitialized whenever any of its hardware offloading capabilities change. vlan(4) is also notified whenever the parent interface's capability changes such that it can correctly handle TX/RX checksum offloading based on parent interface's enabled offloading capabilities. RX checksum offloading handler was changed to make upper stack use controller computed partial checksum value. Previously, ti(4) just set the computed value for any frames(IPv4, IPv6) and the value was not used in upper stack because driver didn't set CSUM_DATA_VALID such that upper network stack had to recompute checksum of TCP/UDP packets. I have no idea how this was not noticed for a long time. With this change, upper network stack does not have to fully recompute the checksum such that calculating pseudo checksum based on partial checksum is sufficient to know whether received packet's checksum is correct or not. However, I don't know why ti(4) does not have controller compute pseudo checksum as controller has ability to do it. I'm just guessing enabling that feature could trigger a firmware bug or could be slower than computing it on host side so just leave it as it was. In order not to produce false positives, ti(4) now checks whether controller actually computed IP or TCP/UDP checksum by checking ti_flags field. r227098: Because ti(4) drops a driver lock in RX handler, check whether driver is still running before re-enabling interrupts. r227099: Implement altq(4) support. While I'm here fix a logic error in r227098 where it didn't re-enable interrupts when TX queue is empty. Modified: stable/7/sys/dev/ti/if_ti.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/ti/if_ti.c ============================================================================== --- stable/7/sys/dev/ti/if_ti.c Tue Jan 3 20:26:28 2012 (r229418) +++ stable/7/sys/dev/ti/if_ti.c Tue Jan 3 20:28:17 2012 (r229419) @@ -196,6 +196,7 @@ static void ti_stop(struct ti_softc *); static void ti_watchdog(void *); static int ti_shutdown(device_t); static int ti_ifmedia_upd(struct ifnet *); +static int ti_ifmedia_upd_locked(struct ti_softc *); static void ti_ifmedia_sts(struct ifnet *, struct ifmediareq *); static uint32_t ti_eeprom_putbyte(struct ti_softc *, int); @@ -924,12 +925,26 @@ ti_handle_events(struct ti_softc *sc) switch (TI_EVENT_EVENT(e)) { case TI_EV_LINKSTAT_CHANGED: sc->ti_linkstat = TI_EVENT_CODE(e); - if (sc->ti_linkstat == TI_EV_CODE_LINK_UP) - device_printf(sc->ti_dev, "10/100 link up\n"); - else if (sc->ti_linkstat == TI_EV_CODE_GIG_LINK_UP) - device_printf(sc->ti_dev, "gigabit link up\n"); - else if (sc->ti_linkstat == TI_EV_CODE_LINK_DOWN) - device_printf(sc->ti_dev, "link down\n"); + if (sc->ti_linkstat == TI_EV_CODE_LINK_UP) { + if_link_state_change(sc->ti_ifp, LINK_STATE_UP); + sc->ti_ifp->if_baudrate = IF_Mbps(100); + if (bootverbose) + device_printf(sc->ti_dev, + "10/100 link up\n"); + } else if (sc->ti_linkstat == TI_EV_CODE_GIG_LINK_UP) { + if_link_state_change(sc->ti_ifp, LINK_STATE_UP); + sc->ti_ifp->if_baudrate = IF_Gbps(1UL); + if (bootverbose) + device_printf(sc->ti_dev, + "gigabit link up\n"); + } else if (sc->ti_linkstat == TI_EV_CODE_LINK_DOWN) { + if_link_state_change(sc->ti_ifp, + LINK_STATE_DOWN); + sc->ti_ifp->if_baudrate = 0; + if (bootverbose) + device_printf(sc->ti_dev, + "link down\n"); + } break; case TI_EV_ERROR: if (TI_EVENT_CODE(e) == TI_EV_CODE_ERR_INVAL_CMD) @@ -1237,7 +1252,7 @@ ti_newbuf_std(struct ti_softc *sc, int i r->ti_len = segs.ds_len; r->ti_type = TI_BDTYPE_RECV_BD; r->ti_flags = 0; - if (sc->ti_ifp->if_hwassist) + if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; r->ti_idx = i; @@ -1284,7 +1299,7 @@ ti_newbuf_mini(struct ti_softc *sc, int r->ti_len = segs.ds_len; r->ti_type = TI_BDTYPE_RECV_BD; r->ti_flags = TI_BDFLAG_MINI_RING; - if (sc->ti_ifp->if_hwassist) + if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; r->ti_idx = i; @@ -1350,7 +1365,7 @@ ti_newbuf_jumbo(struct ti_softc *sc, int r->ti_len = segs.ds_len; r->ti_type = TI_BDTYPE_RECV_JUMBO_BD; r->ti_flags = TI_BDFLAG_JUMBO_RING; - if (sc->ti_ifp->if_hwassist) + if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; r->ti_idx = i; @@ -1493,7 +1508,7 @@ ti_newbuf_jumbo(struct ti_softc *sc, int r->ti_flags = TI_BDFLAG_JUMBO_RING|TI_RCB_FLAG_USE_EXT_RX_BD; - if (sc->ti_ifp->if_hwassist) + if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM|TI_BDFLAG_IP_CKSUM; r->ti_idx = idx; @@ -1846,11 +1861,6 @@ ti_chipinit(struct ti_softc *sc) /* Initialize link to down state. */ sc->ti_linkstat = TI_EV_CODE_LINK_DOWN; - if (sc->ti_ifp->if_capenable & IFCAP_HWCSUM) - sc->ti_ifp->if_hwassist = TI_CSUM_FEATURES; - else - sc->ti_ifp->if_hwassist = 0; - /* Set endianness before we access any non-PCI registers. */ #if 0 && BYTE_ORDER == BIG_ENDIAN CSR_WRITE_4(sc, TI_MISC_HOST_CTL, @@ -1980,7 +1990,7 @@ ti_chipinit(struct ti_softc *sc) * the firmware racks up lots of nicDmaReadRingFull * errors. This is not compatible with hardware checksums. */ - if (sc->ti_ifp->if_hwassist == 0) + if ((sc->ti_ifp->if_capenable & (IFCAP_TXCSUM | IFCAP_RXCSUM)) == 0) TI_SETBIT(sc, TI_GCR_OPMODE, TI_OPMODE_1_DMA_ACTIVE); /* Recommended settings from Tigon manual. */ @@ -2067,10 +2077,11 @@ ti_gibinit(struct ti_softc *sc) TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_rx_std_ring); rcb->ti_max_len = TI_FRAMELEN; rcb->ti_flags = 0; - if (sc->ti_ifp->if_hwassist) + if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) rcb->ti_flags |= TI_RCB_FLAG_TCP_UDP_CKSUM | TI_RCB_FLAG_IP_CKSUM | TI_RCB_FLAG_NO_PHDR_CKSUM; - rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; + if (sc->ti_ifp->if_capenable & IFCAP_VLAN_HWTAGGING) + rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; /* Set up the jumbo receive ring. */ rcb = &sc->ti_rdata->ti_info.ti_jumbo_rx_rcb; @@ -2083,10 +2094,11 @@ ti_gibinit(struct ti_softc *sc) rcb->ti_max_len = PAGE_SIZE; rcb->ti_flags = TI_RCB_FLAG_USE_EXT_RX_BD; #endif - if (sc->ti_ifp->if_hwassist) + if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) rcb->ti_flags |= TI_RCB_FLAG_TCP_UDP_CKSUM | TI_RCB_FLAG_IP_CKSUM | TI_RCB_FLAG_NO_PHDR_CKSUM; - rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; + if (sc->ti_ifp->if_capenable & IFCAP_VLAN_HWTAGGING) + rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; /* * Set up the mini ring. Only activated on the @@ -2100,10 +2112,11 @@ ti_gibinit(struct ti_softc *sc) rcb->ti_flags = TI_RCB_FLAG_RING_DISABLED; else rcb->ti_flags = 0; - if (sc->ti_ifp->if_hwassist) + if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) rcb->ti_flags |= TI_RCB_FLAG_TCP_UDP_CKSUM | TI_RCB_FLAG_IP_CKSUM | TI_RCB_FLAG_NO_PHDR_CKSUM; - rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; + if (sc->ti_ifp->if_capenable & IFCAP_VLAN_HWTAGGING) + rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; /* * Set up the receive return ring. @@ -2132,8 +2145,9 @@ ti_gibinit(struct ti_softc *sc) rcb->ti_flags = 0; else rcb->ti_flags = TI_RCB_FLAG_HOST_RING; - rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; - if (sc->ti_ifp->if_hwassist) + if (sc->ti_ifp->if_capenable & IFCAP_VLAN_HWTAGGING) + rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; + if (sc->ti_ifp->if_capenable & IFCAP_TXCSUM) rcb->ti_flags |= TI_RCB_FLAG_TCP_UDP_CKSUM | TI_RCB_FLAG_IP_CKSUM | TI_RCB_FLAG_NO_PHDR_CKSUM; rcb->ti_max_len = TI_TX_RING_CNT; @@ -2233,8 +2247,8 @@ ti_attach(device_t dev) error = ENOSPC; goto fail; } - sc->ti_ifp->if_capabilities = IFCAP_HWCSUM | - IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; + sc->ti_ifp->if_hwassist = TI_CSUM_FEATURES; + sc->ti_ifp->if_capabilities = IFCAP_TXCSUM | IFCAP_RXCSUM; sc->ti_ifp->if_capenable = sc->ti_ifp->if_capabilities; /* @@ -2429,8 +2443,10 @@ ti_attach(device_t dev) ifp->if_ioctl = ti_ioctl; ifp->if_start = ti_start; ifp->if_init = ti_init; - ifp->if_baudrate = 1000000000; - ifp->if_snd.ifq_maxlen = TI_TX_RING_CNT - 1; + ifp->if_baudrate = IF_Gbps(1UL); + ifp->if_snd.ifq_drv_maxlen = TI_TX_RING_CNT - 1; + IFQ_SET_MAXLEN(&ifp->if_snd, ifp->if_snd.ifq_drv_maxlen); + IFQ_SET_READY(&ifp->if_snd); /* Set up ifmedia support. */ if (sc->ti_copper) { @@ -2476,6 +2492,13 @@ ti_attach(device_t dev) */ ether_ifattach(ifp, eaddr); + /* VLAN capability setup. */ + ifp->if_capabilities |= IFCAP_VLAN_MTU | IFCAP_VLAN_HWCSUM | + IFCAP_VLAN_HWTAGGING; + ifp->if_capenable = ifp->if_capabilities; + /* Tell the upper layer we support VLAN over-sized frames. */ + ifp->if_hdrlen = sizeof(struct ether_vlan_header); + /* Hook interrupt last to avoid having to lock softc */ error = bus_setup_intr(dev, sc->ti_irq, INTR_TYPE_NET|INTR_MPSAFE, NULL, ti_intr, sc, &sc->ti_intrhand); @@ -2534,6 +2557,8 @@ ti_detach(device_t dev) bus_dma_tag_destroy(sc->ti_mbuftx_dmat); if (sc->ti_mbufrx_dmat) bus_dma_tag_destroy(sc->ti_mbufrx_dmat); + if (sc->ti_rdata && sc->ti_rdata_dmamap) + bus_dmamap_unload(sc->ti_rdata_dmat, sc->ti_rdata_dmamap); if (sc->ti_rdata) bus_dmamem_free(sc->ti_rdata_dmat, sc->ti_rdata, sc->ti_rdata_dmamap); @@ -2650,7 +2675,7 @@ ti_rxeof(struct ti_softc *sc) if (cur_rx->ti_flags & TI_BDFLAG_VLAN_TAG) { have_tag = 1; - vlan_tag = cur_rx->ti_vlan_tag & 0xfff; + vlan_tag = cur_rx->ti_vlan_tag; } if (cur_rx->ti_flags & TI_BDFLAG_JUMBO_RING) { @@ -2727,12 +2752,17 @@ ti_rxeof(struct ti_softc *sc) ifp->if_ipackets++; m->m_pkthdr.rcvif = ifp; - if (ifp->if_hwassist) { - m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED | - CSUM_DATA_VALID; - if ((cur_rx->ti_ip_cksum ^ 0xffff) == 0) - m->m_pkthdr.csum_flags |= CSUM_IP_VALID; - m->m_pkthdr.csum_data = cur_rx->ti_tcp_udp_cksum; + if (ifp->if_capenable & IFCAP_RXCSUM) { + if (cur_rx->ti_flags & TI_BDFLAG_IP_CKSUM) { + m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED; + if ((cur_rx->ti_ip_cksum ^ 0xffff) == 0) + m->m_pkthdr.csum_flags |= CSUM_IP_VALID; + } + if (cur_rx->ti_flags & TI_BDFLAG_TCP_UDP_CKSUM) { + m->m_pkthdr.csum_data = + cur_rx->ti_tcp_udp_cksum; + m->m_pkthdr.csum_flags |= CSUM_DATA_VALID; + } } /* @@ -2836,12 +2866,12 @@ ti_intr(void *xsc) ti_handle_events(sc); - /* Re-enable interrupts. */ - CSR_WRITE_4(sc, TI_MB_HOSTINTR, 0); - - if (ifp->if_drv_flags & IFF_DRV_RUNNING && - ifp->if_snd.ifq_head != NULL) - ti_start_locked(ifp); + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + /* Re-enable interrupts. */ + CSR_WRITE_4(sc, TI_MB_HOSTINTR, 0); + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + ti_start_locked(ifp); + } TI_UNLOCK(sc); } @@ -2945,7 +2975,7 @@ ti_encap(struct ti_softc *sc, struct mbu f->ti_flags = csum_flags; if (m->m_flags & M_VLANTAG) { f->ti_flags |= TI_BDFLAG_VLAN_TAG; - f->ti_vlan_tag = m->m_pkthdr.ether_vtag & 0xfff; + f->ti_vlan_tag = m->m_pkthdr.ether_vtag; } else { f->ti_vlan_tag = 0; } @@ -2998,9 +3028,9 @@ ti_start_locked(struct ifnet *ifp) sc = ifp->if_softc; - for (; ifp->if_snd.ifq_head != NULL && + for (; !IFQ_DRV_IS_EMPTY(&ifp->if_snd) && sc->ti_txcnt < (TI_TX_RING_CNT - 16);) { - IF_DEQUEUE(&ifp->if_snd, m_head); + IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head); if (m_head == NULL) break; @@ -3016,7 +3046,7 @@ ti_start_locked(struct ifnet *ifp) m_head->m_pkthdr.csum_flags & (CSUM_DELAY_DATA)) { if ((TI_TX_RING_CNT - sc->ti_txcnt) < m_head->m_pkthdr.csum_data + 16) { - IF_PREPEND(&ifp->if_snd, m_head); + IFQ_DRV_PREPEND(&ifp->if_snd, m_head); ifp->if_drv_flags |= IFF_DRV_OACTIVE; break; } @@ -3030,7 +3060,7 @@ ti_start_locked(struct ifnet *ifp) if (ti_encap(sc, &m_head)) { if (m_head == NULL) break; - IF_PREPEND(&ifp->if_snd, m_head); + IFQ_DRV_PREPEND(&ifp->if_snd, m_head); ifp->if_drv_flags |= IFF_DRV_OACTIVE; break; } @@ -3162,7 +3192,7 @@ static void ti_init2(struct ti_softc *sc ifm = &sc->ifmedia; tmp = ifm->ifm_media; ifm->ifm_media = ifm->ifm_cur->ifm_media; - ti_ifmedia_upd(ifp); + ti_ifmedia_upd_locked(sc); ifm->ifm_media = tmp; } @@ -3173,11 +3203,23 @@ static int ti_ifmedia_upd(struct ifnet *ifp) { struct ti_softc *sc; + int error; + + sc = ifp->if_softc; + TI_LOCK(sc); + error = ti_ifmedia_upd(ifp); + TI_UNLOCK(sc); + + return (error); +} + +static int +ti_ifmedia_upd_locked(struct ti_softc *sc) +{ struct ifmedia *ifm; struct ti_cmd_desc cmd; uint32_t flowctl; - sc = ifp->if_softc; ifm = &sc->ifmedia; if (IFM_TYPE(ifm->ifm_media) != IFM_ETHER) @@ -3278,11 +3320,15 @@ ti_ifmedia_sts(struct ifnet *ifp, struct sc = ifp->if_softc; + TI_LOCK(sc); + ifmr->ifm_status = IFM_AVALID; ifmr->ifm_active = IFM_ETHER; - if (sc->ti_linkstat == TI_EV_CODE_LINK_DOWN) + if (sc->ti_linkstat == TI_EV_CODE_LINK_DOWN) { + TI_UNLOCK(sc); return; + } ifmr->ifm_status |= IFM_ACTIVE; @@ -3314,6 +3360,7 @@ ti_ifmedia_sts(struct ifnet *ifp, struct if (media & TI_LNK_HALF_DUPLEX) ifmr->ifm_active |= IFM_HDX; } + TI_UNLOCK(sc); } static int @@ -3380,15 +3427,32 @@ ti_ioctl(struct ifnet *ifp, u_long comma case SIOCSIFCAP: TI_LOCK(sc); mask = ifr->ifr_reqcap ^ ifp->if_capenable; - if (mask & IFCAP_HWCSUM) { - if (IFCAP_HWCSUM & ifp->if_capenable) - ifp->if_capenable &= ~IFCAP_HWCSUM; - else - ifp->if_capenable |= IFCAP_HWCSUM; - if (ifp->if_drv_flags & IFF_DRV_RUNNING) + if ((mask & IFCAP_TXCSUM) != 0 && + (ifp->if_capabilities & IFCAP_TXCSUM) != 0) { + ifp->if_capenable ^= IFCAP_TXCSUM; + if ((ifp->if_capenable & IFCAP_TXCSUM) != 0) + ifp->if_hwassist |= TI_CSUM_FEATURES; + else + ifp->if_hwassist &= ~TI_CSUM_FEATURES; + } + if ((mask & IFCAP_RXCSUM) != 0 && + (ifp->if_capabilities & IFCAP_RXCSUM) != 0) + ifp->if_capenable ^= IFCAP_RXCSUM; + if ((mask & IFCAP_VLAN_HWTAGGING) != 0 && + (ifp->if_capabilities & IFCAP_VLAN_HWTAGGING) != 0) + ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; + if ((mask & IFCAP_VLAN_HWCSUM) != 0 && + (ifp->if_capabilities & IFCAP_VLAN_HWCSUM) != 0) + ifp->if_capenable ^= IFCAP_VLAN_HWCSUM; + if ((mask & (IFCAP_TXCSUM | IFCAP_RXCSUM | + IFCAP_VLAN_HWTAGGING)) != 0) { + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; ti_init_locked(sc); + } } TI_UNLOCK(sc); + VLAN_CAPABILITIES(ifp); break; default: error = ether_ioctl(ifp, command, data); From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 20:34:53 2012 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 48C9F106564A; Tue, 3 Jan 2012 20:34:53 +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 2C72A8FC0A; Tue, 3 Jan 2012 20:34:53 +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 q03KYrC2041609; Tue, 3 Jan 2012 20:34:53 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03KYrrb041606; Tue, 3 Jan 2012 20:34:53 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201032034.q03KYrrb041606@svn.freebsd.org> From: John Baldwin Date: Tue, 3 Jan 2012 20:34:53 +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: r229420 - in head/sys: netinet netinet6 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, 03 Jan 2012 20:34:53 -0000 Author: jhb Date: Tue Jan 3 20:34:52 2012 New Revision: 229420 URL: http://svn.freebsd.org/changeset/base/229420 Log: When cancelling multicast timers on an interface, don't release the reference on a group in the leaving state while iterating over the loop. Instead, use the same approach used in igmp_ifdetach() and mld_ifdetach() of placing the groups to free on pending release list and then releasing the references after dropping the IF_ADDR_LOCK. This closes an ugly race where the code was dropping the lock in the middle of iterating over the list. It also fixes some additional potential use-after-free bugs since the cancellation routine also applied other changes to the group after dropping the reference. Now those changes are performed before the reference is dropped and the group is potentially freed. Prodded to fix by: glebius Reviewed by: bz MFC after: 1 week Modified: head/sys/netinet/igmp.c head/sys/netinet6/mld6.c Modified: head/sys/netinet/igmp.c ============================================================================== --- head/sys/netinet/igmp.c Tue Jan 3 20:28:17 2012 (r229419) +++ head/sys/netinet/igmp.c Tue Jan 3 20:34:52 2012 (r229420) @@ -2003,7 +2003,7 @@ igmp_v3_cancel_link_timers(struct igmp_i { struct ifmultiaddr *ifma; struct ifnet *ifp; - struct in_multi *inm; + struct in_multi *inm, *tinm; CTR3(KTR_IGMPV3, "%s: cancel v3 timers on ifp %p(%s)", __func__, igi->igi_ifp, igi->igi_ifp->if_xname); @@ -2049,14 +2049,8 @@ igmp_v3_cancel_link_timers(struct igmp_i * transition to REPORTING to ensure the host leave * message is sent upstream to the old querier -- * transition to NOT would lose the leave and race. - * - * SMPNG: Must drop and re-acquire IF_ADDR_LOCK - * around inm_release_locked(), as it is not - * a recursive mutex. */ - IF_ADDR_UNLOCK(ifp); - inm_release_locked(inm); - IF_ADDR_LOCK(ifp); + SLIST_INSERT_HEAD(&igi->igi_relinmhead, inm, inm_nrele); /* FALLTHROUGH */ case IGMP_G_QUERY_PENDING_MEMBER: case IGMP_SG_QUERY_PENDING_MEMBER: @@ -2075,6 +2069,10 @@ igmp_v3_cancel_link_timers(struct igmp_i _IF_DRAIN(&inm->inm_scq); } IF_ADDR_UNLOCK(ifp); + SLIST_FOREACH_SAFE(inm, &igi->igi_relinmhead, inm_nrele, tinm) { + SLIST_REMOVE_HEAD(&igi->igi_relinmhead, inm_nrele); + inm_release_locked(inm); + } } /* Modified: head/sys/netinet6/mld6.c ============================================================================== --- head/sys/netinet6/mld6.c Tue Jan 3 20:28:17 2012 (r229419) +++ head/sys/netinet6/mld6.c Tue Jan 3 20:34:52 2012 (r229420) @@ -1656,7 +1656,7 @@ mld_v2_cancel_link_timers(struct mld_ifi { struct ifmultiaddr *ifma; struct ifnet *ifp; - struct in6_multi *inm; + struct in6_multi *inm, *tinm; CTR3(KTR_MLD, "%s: cancel v2 timers on ifp %p(%s)", __func__, mli->mli_ifp, mli->mli_ifp->if_xname); @@ -1695,14 +1695,9 @@ mld_v2_cancel_link_timers(struct mld_ifi * If we are leaving the group and switching * version, we need to release the final * reference held for issuing the INCLUDE {}. - * - * SMPNG: Must drop and re-acquire IF_ADDR_LOCK - * around in6m_release_locked(), as it is not - * a recursive mutex. */ - IF_ADDR_UNLOCK(ifp); - in6m_release_locked(inm); - IF_ADDR_LOCK(ifp); + SLIST_INSERT_HEAD(&mli->mli_relinmhead, inm, + in6m_nrele); /* FALLTHROUGH */ case MLD_G_QUERY_PENDING_MEMBER: case MLD_SG_QUERY_PENDING_MEMBER: @@ -1720,6 +1715,10 @@ mld_v2_cancel_link_timers(struct mld_ifi } } IF_ADDR_UNLOCK(ifp); + SLIST_FOREACH_SAFE(inm, &mli->mli_relinmhead, in6m_nrele, tinm) { + SLIST_REMOVE_HEAD(&mli->mli_relinmhead, in6m_nrele); + in6m_release_locked(inm); + } } /* From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 20:48:28 2012 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 831811065670; Tue, 3 Jan 2012 20:48:28 +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 7077C8FC08; Tue, 3 Jan 2012 20:48: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 q03KmSrA042242; Tue, 3 Jan 2012 20:48:28 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03KmSQG042239; Tue, 3 Jan 2012 20:48:28 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201032048.q03KmSQG042239@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 20:48:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229421 - stable/9/sys/dev/ti 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, 03 Jan 2012 20:48:28 -0000 Author: yongari Date: Tue Jan 3 20:48:28 2012 New Revision: 229421 URL: http://svn.freebsd.org/changeset/base/229421 Log: MFC r227311-227312,227318-227319,227322-227324: r227311: Remove ti_unit member variable in softc. While I'm here use PCIR_BAR macro. r227312: o Remove unnecessary controller reinitialization. o Do not blindly UP controller when MTU is changed. Reinitialize controller only if driver is running. o Remove useless ti_stop() in ti_watchdog() since ti_init_locked() always invokes ti_stop(). r227318: Track which ring was updated in RX handler and update only modified ring. This should reduce unnecessary register accesses. r227319: Mini ring is not available on Tigon 1 so do not create DMA maps for mini ring on Tigon 1 to save resources. r227322: Show RX buffer allocation failure and do not blindly send alive message to firmware. Probably the correct way for this error is to send a TI_CMD_CODE_STACK_DOWN message to firmware and let firmware handle the rest. r227323: If ti_chipinit() fails in ti_stop(), ignore the error and release all allocated TX/RX buffer resources. If the interface is brought to up again after the error, we will leak allocated TX/RX buffers. r227324: Do not allow changing MTU to be less than the minimum. Modified: stable/9/sys/dev/ti/if_ti.c stable/9/sys/dev/ti/if_tireg.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/ti/if_ti.c ============================================================================== --- stable/9/sys/dev/ti/if_ti.c Tue Jan 3 20:34:52 2012 (r229420) +++ stable/9/sys/dev/ti/if_ti.c Tue Jan 3 20:48:28 2012 (r229421) @@ -998,6 +998,11 @@ ti_alloc_dmamaps(struct ti_softc *sc) &sc->ti_cdata.ti_rx_jumbo_maps[i])) return (ENOBUFS); } + + /* Mini ring is not available on Tigon 1. */ + if (sc->ti_hwrev == TI_HWREV_TIGON) + return (0); + for (i = 0; i < TI_MINI_RX_RING_CNT; i++) { if (bus_dmamap_create(sc->ti_mbufrx_dmat, 0, &sc->ti_cdata.ti_rx_mini_maps[i])) @@ -2222,7 +2227,6 @@ ti_attach(device_t dev) u_char eaddr[6]; sc = device_get_softc(dev); - sc->ti_unit = device_get_unit(dev); sc->ti_dev = dev; mtx_init(&sc->ti_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, @@ -2244,7 +2248,7 @@ ti_attach(device_t dev) */ pci_enable_busmaster(dev); - rid = TI_PCI_LOMEM; + rid = PCIR_BAR(0); sc->ti_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); @@ -2471,8 +2475,8 @@ ti_attach(device_t dev) */ /* Register the device */ - sc->dev = make_dev(&ti_cdevsw, sc->ti_unit, UID_ROOT, GID_OPERATOR, - 0600, "ti%d", sc->ti_unit); + sc->dev = make_dev(&ti_cdevsw, device_get_unit(dev), UID_ROOT, + GID_OPERATOR, 0600, "ti%d", device_get_unit(dev)); sc->dev->si_drv1 = sc; /* @@ -2563,7 +2567,7 @@ ti_detach(device_t dev) if (sc->ti_irq) bus_release_resource(dev, SYS_RES_IRQ, 0, sc->ti_irq); if (sc->ti_res) { - bus_release_resource(dev, SYS_RES_MEMORY, TI_PCI_LOMEM, + bus_release_resource(dev, SYS_RES_MEMORY, PCIR_BAR(0), sc->ti_res); } if (ifp) @@ -2648,15 +2652,17 @@ ti_rxeof(struct ti_softc *sc) struct ifnet *ifp; bus_dmamap_t map; struct ti_cmd_desc cmd; + int jumbocnt, minicnt, stdcnt; TI_LOCK_ASSERT(sc); ifp = sc->ti_ifp; + jumbocnt = minicnt = stdcnt = 0; while (sc->ti_rx_saved_considx != sc->ti_return_prodidx.ti_idx) { struct ti_rx_desc *cur_rx; - struct mbuf *m = NULL; uint32_t rxidx; + struct mbuf *m = NULL; uint16_t vlan_tag = 0; int have_tag = 0; @@ -2671,7 +2677,7 @@ ti_rxeof(struct ti_softc *sc) } if (cur_rx->ti_flags & TI_BDFLAG_JUMBO_RING) { - + jumbocnt++; TI_INC(sc->ti_jumbo, TI_JUMBO_RX_RING_CNT); m = sc->ti_cdata.ti_rx_jumbo_chain[rxidx]; sc->ti_cdata.ti_rx_jumbo_chain[rxidx] = NULL; @@ -2701,6 +2707,7 @@ ti_rxeof(struct ti_softc *sc) m_adj(m, cur_rx->ti_len - m->m_pkthdr.len); #endif /* TI_PRIVATE_JUMBOS */ } else if (cur_rx->ti_flags & TI_BDFLAG_MINI_RING) { + minicnt++; TI_INC(sc->ti_mini, TI_MINI_RX_RING_CNT); m = sc->ti_cdata.ti_rx_mini_chain[rxidx]; sc->ti_cdata.ti_rx_mini_chain[rxidx] = NULL; @@ -2720,6 +2727,7 @@ ti_rxeof(struct ti_softc *sc) } m->m_len = cur_rx->ti_len; } else { + stdcnt++; TI_INC(sc->ti_std, TI_STD_RX_RING_CNT); m = sc->ti_cdata.ti_rx_std_chain[rxidx]; sc->ti_cdata.ti_rx_std_chain[rxidx] = NULL; @@ -2775,9 +2783,12 @@ ti_rxeof(struct ti_softc *sc) CSR_WRITE_4(sc, TI_GCR_RXRETURNCONS_IDX, sc->ti_rx_saved_considx); - TI_UPDATE_STDPROD(sc, sc->ti_std); - TI_UPDATE_MINIPROD(sc, sc->ti_mini); - TI_UPDATE_JUMBOPROD(sc, sc->ti_jumbo); + if (stdcnt > 0) + TI_UPDATE_STDPROD(sc, sc->ti_std); + if (minicnt > 0) + TI_UPDATE_MINIPROD(sc, sc->ti_mini); + if (jumbocnt > 0) + TI_UPDATE_JUMBOPROD(sc, sc->ti_jumbo); } static void @@ -3092,6 +3103,9 @@ ti_init_locked(void *xsc) { struct ti_softc *sc = xsc; + if (sc->ti_ifp->if_drv_flags & IFF_DRV_RUNNING) + return; + /* Cancel pending I/O and flush buffers. */ ti_stop(sc); @@ -3115,7 +3129,7 @@ static void ti_init2(struct ti_softc *sc ifp = sc->ti_ifp; /* Specify MTU and interface index. */ - CSR_WRITE_4(sc, TI_GCR_IFINDEX, sc->ti_unit); + CSR_WRITE_4(sc, TI_GCR_IFINDEX, device_get_unit(sc->ti_dev)); CSR_WRITE_4(sc, TI_GCR_IFMTU, ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN + ETHER_VLAN_ENCAP_LEN); TI_DO_CMD(TI_CMD_UPDATE_GENCOM, 0, 0); @@ -3146,18 +3160,34 @@ static void ti_init2(struct ti_softc *sc } /* Init RX ring. */ - ti_init_rx_ring_std(sc); + if (ti_init_rx_ring_std(sc) != 0) { + /* XXX */ + device_printf(sc->ti_dev, "no memory for std Rx buffers.\n"); + return; + } /* Init jumbo RX ring. */ - if (ifp->if_mtu > (ETHERMTU + ETHER_HDR_LEN + ETHER_CRC_LEN)) - ti_init_rx_ring_jumbo(sc); + if (ifp->if_mtu > (ETHERMTU + ETHER_HDR_LEN + ETHER_CRC_LEN)) { + if (ti_init_rx_ring_jumbo(sc) != 0) { + /* XXX */ + device_printf(sc->ti_dev, + "no memory for jumbo Rx buffers.\n"); + return; + } + } /* * If this is a Tigon 2, we can also configure the * mini ring. */ - if (sc->ti_hwrev == TI_HWREV_TIGON_II) - ti_init_rx_ring_mini(sc); + if (sc->ti_hwrev == TI_HWREV_TIGON_II) { + if (ti_init_rx_ring_mini(sc) != 0) { + /* XXX */ + device_printf(sc->ti_dev, + "no memory for mini Rx buffers.\n"); + return; + } + } CSR_WRITE_4(sc, TI_GCR_RXRETURNCONS_IDX, 0); sc->ti_rx_saved_considx = 0; @@ -3366,11 +3396,14 @@ ti_ioctl(struct ifnet *ifp, u_long comma switch (command) { case SIOCSIFMTU: TI_LOCK(sc); - if (ifr->ifr_mtu > TI_JUMBO_MTU) + if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > TI_JUMBO_MTU) error = EINVAL; else { ifp->if_mtu = ifr->ifr_mtu; - ti_init_locked(sc); + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + ti_init_locked(sc); + } } TI_UNLOCK(sc); break; @@ -3784,7 +3817,7 @@ ti_watchdog(void *arg) ifp = sc->ti_ifp; if_printf(ifp, "watchdog timeout -- resetting\n"); - ti_stop(sc); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; ti_init_locked(sc); ifp->if_oerrors++; @@ -3812,11 +3845,11 @@ ti_stop(struct ti_softc *sc) TI_DO_CMD(TI_CMD_HOST_STATE, TI_CMD_CODE_STACK_DOWN, 0); /* Halt and reinitialize. */ - if (ti_chipinit(sc) != 0) - return; - ti_mem_zero(sc, 0x2000, 0x100000 - 0x2000); - if (ti_chipinit(sc) != 0) - return; + if (ti_chipinit(sc) == 0) { + ti_mem_zero(sc, 0x2000, 0x100000 - 0x2000); + /* XXX ignore init errors. */ + ti_chipinit(sc); + } /* Free the RX lists. */ ti_free_rx_ring_std(sc); Modified: stable/9/sys/dev/ti/if_tireg.h ============================================================================== --- stable/9/sys/dev/ti/if_tireg.h Tue Jan 3 20:34:52 2012 (r229420) +++ stable/9/sys/dev/ti/if_tireg.h Tue Jan 3 20:48:28 2012 (r229421) @@ -1000,7 +1000,6 @@ struct ti_softc { struct resource *ti_irq; struct resource *ti_res; struct ifmedia ifmedia; /* media info */ - uint8_t ti_unit; /* interface number */ uint8_t ti_hwrev; /* Tigon rev (1 or 2) */ uint8_t ti_copper; /* 1000baseTX card */ uint8_t ti_linkstat; /* Link state */ From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 20:50:48 2012 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 C66CB106564A; Tue, 3 Jan 2012 20:50:48 +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 B3DF98FC1B; Tue, 3 Jan 2012 20:50:48 +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 q03KomUh042363; Tue, 3 Jan 2012 20:50:48 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03Komjg042360; Tue, 3 Jan 2012 20:50:48 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201032050.q03Komjg042360@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 20:50:48 +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: r229422 - in stable/8/sys: conf dev/ti 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, 03 Jan 2012 20:50:48 -0000 Author: yongari Date: Tue Jan 3 20:50:48 2012 New Revision: 229422 URL: http://svn.freebsd.org/changeset/base/229422 Log: MFC r227311-227312,227318-227319,227322-227324: r227311: Remove ti_unit member variable in softc. While I'm here use PCIR_BAR macro. r227312: o Remove unnecessary controller reinitialization. o Do not blindly UP controller when MTU is changed. Reinitialize controller only if driver is running. o Remove useless ti_stop() in ti_watchdog() since ti_init_locked() always invokes ti_stop(). r227318: Track which ring was updated in RX handler and update only modified ring. This should reduce unnecessary register accesses. r227319: Mini ring is not available on Tigon 1 so do not create DMA maps for mini ring on Tigon 1 to save resources. r227322: Show RX buffer allocation failure and do not blindly send alive message to firmware. Probably the correct way for this error is to send a TI_CMD_CODE_STACK_DOWN message to firmware and let firmware handle the rest. r227323: If ti_chipinit() fails in ti_stop(), ignore the error and release all allocated TX/RX buffer resources. If the interface is brought to up again after the error, we will leak allocated TX/RX buffers. r227324: Do not allow changing MTU to be less than the minimum. Modified: stable/8/sys/dev/ti/if_ti.c stable/8/sys/dev/ti/if_tireg.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/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/ti/if_ti.c ============================================================================== --- stable/8/sys/dev/ti/if_ti.c Tue Jan 3 20:48:28 2012 (r229421) +++ stable/8/sys/dev/ti/if_ti.c Tue Jan 3 20:50:48 2012 (r229422) @@ -998,6 +998,11 @@ ti_alloc_dmamaps(struct ti_softc *sc) &sc->ti_cdata.ti_rx_jumbo_maps[i])) return (ENOBUFS); } + + /* Mini ring is not available on Tigon 1. */ + if (sc->ti_hwrev == TI_HWREV_TIGON) + return (0); + for (i = 0; i < TI_MINI_RX_RING_CNT; i++) { if (bus_dmamap_create(sc->ti_mbufrx_dmat, 0, &sc->ti_cdata.ti_rx_mini_maps[i])) @@ -2224,7 +2229,6 @@ ti_attach(device_t dev) u_char eaddr[6]; sc = device_get_softc(dev); - sc->ti_unit = device_get_unit(dev); sc->ti_dev = dev; mtx_init(&sc->ti_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, @@ -2246,7 +2250,7 @@ ti_attach(device_t dev) */ pci_enable_busmaster(dev); - rid = TI_PCI_LOMEM; + rid = PCIR_BAR(0); sc->ti_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); @@ -2473,8 +2477,8 @@ ti_attach(device_t dev) */ /* Register the device */ - sc->dev = make_dev(&ti_cdevsw, sc->ti_unit, UID_ROOT, GID_OPERATOR, - 0600, "ti%d", sc->ti_unit); + sc->dev = make_dev(&ti_cdevsw, device_get_unit(dev), UID_ROOT, + GID_OPERATOR, 0600, "ti%d", device_get_unit(dev)); sc->dev->si_drv1 = sc; /* @@ -2565,7 +2569,7 @@ ti_detach(device_t dev) if (sc->ti_irq) bus_release_resource(dev, SYS_RES_IRQ, 0, sc->ti_irq); if (sc->ti_res) { - bus_release_resource(dev, SYS_RES_MEMORY, TI_PCI_LOMEM, + bus_release_resource(dev, SYS_RES_MEMORY, PCIR_BAR(0), sc->ti_res); } if (ifp) @@ -2650,15 +2654,17 @@ ti_rxeof(struct ti_softc *sc) struct ifnet *ifp; bus_dmamap_t map; struct ti_cmd_desc cmd; + int jumbocnt, minicnt, stdcnt; TI_LOCK_ASSERT(sc); ifp = sc->ti_ifp; + jumbocnt = minicnt = stdcnt = 0; while (sc->ti_rx_saved_considx != sc->ti_return_prodidx.ti_idx) { struct ti_rx_desc *cur_rx; - struct mbuf *m = NULL; uint32_t rxidx; + struct mbuf *m = NULL; uint16_t vlan_tag = 0; int have_tag = 0; @@ -2673,7 +2679,7 @@ ti_rxeof(struct ti_softc *sc) } if (cur_rx->ti_flags & TI_BDFLAG_JUMBO_RING) { - + jumbocnt++; TI_INC(sc->ti_jumbo, TI_JUMBO_RX_RING_CNT); m = sc->ti_cdata.ti_rx_jumbo_chain[rxidx]; sc->ti_cdata.ti_rx_jumbo_chain[rxidx] = NULL; @@ -2703,6 +2709,7 @@ ti_rxeof(struct ti_softc *sc) m_adj(m, cur_rx->ti_len - m->m_pkthdr.len); #endif /* TI_PRIVATE_JUMBOS */ } else if (cur_rx->ti_flags & TI_BDFLAG_MINI_RING) { + minicnt++; TI_INC(sc->ti_mini, TI_MINI_RX_RING_CNT); m = sc->ti_cdata.ti_rx_mini_chain[rxidx]; sc->ti_cdata.ti_rx_mini_chain[rxidx] = NULL; @@ -2722,6 +2729,7 @@ ti_rxeof(struct ti_softc *sc) } m->m_len = cur_rx->ti_len; } else { + stdcnt++; TI_INC(sc->ti_std, TI_STD_RX_RING_CNT); m = sc->ti_cdata.ti_rx_std_chain[rxidx]; sc->ti_cdata.ti_rx_std_chain[rxidx] = NULL; @@ -2777,9 +2785,12 @@ ti_rxeof(struct ti_softc *sc) CSR_WRITE_4(sc, TI_GCR_RXRETURNCONS_IDX, sc->ti_rx_saved_considx); - TI_UPDATE_STDPROD(sc, sc->ti_std); - TI_UPDATE_MINIPROD(sc, sc->ti_mini); - TI_UPDATE_JUMBOPROD(sc, sc->ti_jumbo); + if (stdcnt > 0) + TI_UPDATE_STDPROD(sc, sc->ti_std); + if (minicnt > 0) + TI_UPDATE_MINIPROD(sc, sc->ti_mini); + if (jumbocnt > 0) + TI_UPDATE_JUMBOPROD(sc, sc->ti_jumbo); } static void @@ -3094,6 +3105,9 @@ ti_init_locked(void *xsc) { struct ti_softc *sc = xsc; + if (sc->ti_ifp->if_drv_flags & IFF_DRV_RUNNING) + return; + /* Cancel pending I/O and flush buffers. */ ti_stop(sc); @@ -3117,7 +3131,7 @@ static void ti_init2(struct ti_softc *sc ifp = sc->ti_ifp; /* Specify MTU and interface index. */ - CSR_WRITE_4(sc, TI_GCR_IFINDEX, sc->ti_unit); + CSR_WRITE_4(sc, TI_GCR_IFINDEX, device_get_unit(sc->ti_dev)); CSR_WRITE_4(sc, TI_GCR_IFMTU, ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN + ETHER_VLAN_ENCAP_LEN); TI_DO_CMD(TI_CMD_UPDATE_GENCOM, 0, 0); @@ -3148,18 +3162,34 @@ static void ti_init2(struct ti_softc *sc } /* Init RX ring. */ - ti_init_rx_ring_std(sc); + if (ti_init_rx_ring_std(sc) != 0) { + /* XXX */ + device_printf(sc->ti_dev, "no memory for std Rx buffers.\n"); + return; + } /* Init jumbo RX ring. */ - if (ifp->if_mtu > (ETHERMTU + ETHER_HDR_LEN + ETHER_CRC_LEN)) - ti_init_rx_ring_jumbo(sc); + if (ifp->if_mtu > (ETHERMTU + ETHER_HDR_LEN + ETHER_CRC_LEN)) { + if (ti_init_rx_ring_jumbo(sc) != 0) { + /* XXX */ + device_printf(sc->ti_dev, + "no memory for jumbo Rx buffers.\n"); + return; + } + } /* * If this is a Tigon 2, we can also configure the * mini ring. */ - if (sc->ti_hwrev == TI_HWREV_TIGON_II) - ti_init_rx_ring_mini(sc); + if (sc->ti_hwrev == TI_HWREV_TIGON_II) { + if (ti_init_rx_ring_mini(sc) != 0) { + /* XXX */ + device_printf(sc->ti_dev, + "no memory for mini Rx buffers.\n"); + return; + } + } CSR_WRITE_4(sc, TI_GCR_RXRETURNCONS_IDX, 0); sc->ti_rx_saved_considx = 0; @@ -3368,11 +3398,14 @@ ti_ioctl(struct ifnet *ifp, u_long comma switch (command) { case SIOCSIFMTU: TI_LOCK(sc); - if (ifr->ifr_mtu > TI_JUMBO_MTU) + if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > TI_JUMBO_MTU) error = EINVAL; else { ifp->if_mtu = ifr->ifr_mtu; - ti_init_locked(sc); + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + ti_init_locked(sc); + } } TI_UNLOCK(sc); break; @@ -3786,7 +3819,7 @@ ti_watchdog(void *arg) ifp = sc->ti_ifp; if_printf(ifp, "watchdog timeout -- resetting\n"); - ti_stop(sc); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; ti_init_locked(sc); ifp->if_oerrors++; @@ -3814,11 +3847,11 @@ ti_stop(struct ti_softc *sc) TI_DO_CMD(TI_CMD_HOST_STATE, TI_CMD_CODE_STACK_DOWN, 0); /* Halt and reinitialize. */ - if (ti_chipinit(sc) != 0) - return; - ti_mem_zero(sc, 0x2000, 0x100000 - 0x2000); - if (ti_chipinit(sc) != 0) - return; + if (ti_chipinit(sc) == 0) { + ti_mem_zero(sc, 0x2000, 0x100000 - 0x2000); + /* XXX ignore init errors. */ + ti_chipinit(sc); + } /* Free the RX lists. */ ti_free_rx_ring_std(sc); Modified: stable/8/sys/dev/ti/if_tireg.h ============================================================================== --- stable/8/sys/dev/ti/if_tireg.h Tue Jan 3 20:48:28 2012 (r229421) +++ stable/8/sys/dev/ti/if_tireg.h Tue Jan 3 20:50:48 2012 (r229422) @@ -1000,7 +1000,6 @@ struct ti_softc { struct resource *ti_irq; struct resource *ti_res; struct ifmedia ifmedia; /* media info */ - uint8_t ti_unit; /* interface number */ uint8_t ti_hwrev; /* Tigon rev (1 or 2) */ uint8_t ti_copper; /* 1000baseTX card */ uint8_t ti_linkstat; /* Link state */ From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 20:51:26 2012 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 97F941065672; Tue, 3 Jan 2012 20:51:26 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8727F8FC16; Tue, 3 Jan 2012 20:51: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 q03KpQ9n042433; Tue, 3 Jan 2012 20:51:26 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03KpQrj042431; Tue, 3 Jan 2012 20:51:26 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201032051.q03KpQrj042431@svn.freebsd.org> From: Dimitry Andric Date: Tue, 3 Jan 2012 20:51: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: r229423 - head/sys/dev/qlxgb 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, 03 Jan 2012 20:51:26 -0000 Author: dim Date: Tue Jan 3 20:51:26 2012 New Revision: 229423 URL: http://svn.freebsd.org/changeset/base/229423 Log: In sys/dev/qlxgb/qla_misc.c, fix a copy/paste issue. Clang complained the variable 'val' was uninitialized when used. Instead, 'sig' should have been printed. Reviewed by: davidcs MFC after: 1 week Modified: head/sys/dev/qlxgb/qla_misc.c Modified: head/sys/dev/qlxgb/qla_misc.c ============================================================================== --- head/sys/dev/qlxgb/qla_misc.c Tue Jan 3 20:50:48 2012 (r229422) +++ head/sys/dev/qlxgb/qla_misc.c Tue Jan 3 20:51:26 2012 (r229423) @@ -407,7 +407,7 @@ qla_crb_init(qla_host_t *ha) addr_val_t *addr_val_map, *avmap; qla_rd_flash32(ha, 0, &sig); - QL_DPRINT2((ha->pci_dev, "%s: val[0] = 0x%08x\n", __func__, val)); + QL_DPRINT2((ha->pci_dev, "%s: val[0] = 0x%08x\n", __func__, sig)); qla_rd_flash32(ha, 4, &val); QL_DPRINT2((ha->pci_dev, "%s: val[4] = 0x%08x\n", __func__, val)); From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 20:52:06 2012 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 4D13E1065705; Tue, 3 Jan 2012 20:52:06 +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 3A7E08FC1A; Tue, 3 Jan 2012 20:52: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 q03Kq6NC042496; Tue, 3 Jan 2012 20:52:06 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03Kq6GY042493; Tue, 3 Jan 2012 20:52:06 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201032052.q03Kq6GY042493@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 20:52:06 +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: r229424 - stable/7/sys/dev/ti 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, 03 Jan 2012 20:52:06 -0000 Author: yongari Date: Tue Jan 3 20:52:05 2012 New Revision: 229424 URL: http://svn.freebsd.org/changeset/base/229424 Log: MFC r227311-227312,227318-227319,227322-227324: r227311: Remove ti_unit member variable in softc. While I'm here use PCIR_BAR macro. r227312: o Remove unnecessary controller reinitialization. o Do not blindly UP controller when MTU is changed. Reinitialize controller only if driver is running. o Remove useless ti_stop() in ti_watchdog() since ti_init_locked() always invokes ti_stop(). r227318: Track which ring was updated in RX handler and update only modified ring. This should reduce unnecessary register accesses. r227319: Mini ring is not available on Tigon 1 so do not create DMA maps for mini ring on Tigon 1 to save resources. r227322: Show RX buffer allocation failure and do not blindly send alive message to firmware. Probably the correct way for this error is to send a TI_CMD_CODE_STACK_DOWN message to firmware and let firmware handle the rest. r227323: If ti_chipinit() fails in ti_stop(), ignore the error and release all allocated TX/RX buffer resources. If the interface is brought to up again after the error, we will leak allocated TX/RX buffers. r227324: Do not allow changing MTU to be less than the minimum. Modified: stable/7/sys/dev/ti/if_ti.c stable/7/sys/dev/ti/if_tireg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/ti/if_ti.c ============================================================================== --- stable/7/sys/dev/ti/if_ti.c Tue Jan 3 20:51:26 2012 (r229423) +++ stable/7/sys/dev/ti/if_ti.c Tue Jan 3 20:52:05 2012 (r229424) @@ -998,6 +998,11 @@ ti_alloc_dmamaps(struct ti_softc *sc) &sc->ti_cdata.ti_rx_jumbo_maps[i])) return (ENOBUFS); } + + /* Mini ring is not available on Tigon 1. */ + if (sc->ti_hwrev == TI_HWREV_TIGON) + return (0); + for (i = 0; i < TI_MINI_RX_RING_CNT; i++) { if (bus_dmamap_create(sc->ti_mbufrx_dmat, 0, &sc->ti_cdata.ti_rx_mini_maps[i])) @@ -2234,7 +2239,6 @@ ti_attach(device_t dev) u_char eaddr[6]; sc = device_get_softc(dev); - sc->ti_unit = device_get_unit(dev); sc->ti_dev = dev; mtx_init(&sc->ti_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, @@ -2256,7 +2260,7 @@ ti_attach(device_t dev) */ pci_enable_busmaster(dev); - rid = TI_PCI_LOMEM; + rid = PCIR_BAR(0); sc->ti_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE|PCI_RF_DENSE); @@ -2483,8 +2487,8 @@ ti_attach(device_t dev) */ /* Register the device */ - sc->dev = make_dev(&ti_cdevsw, sc->ti_unit, UID_ROOT, GID_OPERATOR, - 0600, "ti%d", sc->ti_unit); + sc->dev = make_dev(&ti_cdevsw, device_get_unit(dev), UID_ROOT, + GID_OPERATOR, 0600, "ti%d", device_get_unit(dev)); sc->dev->si_drv1 = sc; /* @@ -2571,7 +2575,7 @@ ti_detach(device_t dev) if (sc->ti_irq) bus_release_resource(dev, SYS_RES_IRQ, 0, sc->ti_irq); if (sc->ti_res) { - bus_release_resource(dev, SYS_RES_MEMORY, TI_PCI_LOMEM, + bus_release_resource(dev, SYS_RES_MEMORY, PCIR_BAR(0), sc->ti_res); } if (ifp) @@ -2656,15 +2660,17 @@ ti_rxeof(struct ti_softc *sc) struct ifnet *ifp; bus_dmamap_t map; struct ti_cmd_desc cmd; + int jumbocnt, minicnt, stdcnt; TI_LOCK_ASSERT(sc); ifp = sc->ti_ifp; + jumbocnt = minicnt = stdcnt = 0; while (sc->ti_rx_saved_considx != sc->ti_return_prodidx.ti_idx) { struct ti_rx_desc *cur_rx; - struct mbuf *m = NULL; uint32_t rxidx; + struct mbuf *m = NULL; uint16_t vlan_tag = 0; int have_tag = 0; @@ -2679,7 +2685,7 @@ ti_rxeof(struct ti_softc *sc) } if (cur_rx->ti_flags & TI_BDFLAG_JUMBO_RING) { - + jumbocnt++; TI_INC(sc->ti_jumbo, TI_JUMBO_RX_RING_CNT); m = sc->ti_cdata.ti_rx_jumbo_chain[rxidx]; sc->ti_cdata.ti_rx_jumbo_chain[rxidx] = NULL; @@ -2709,6 +2715,7 @@ ti_rxeof(struct ti_softc *sc) m_adj(m, cur_rx->ti_len - m->m_pkthdr.len); #endif /* TI_PRIVATE_JUMBOS */ } else if (cur_rx->ti_flags & TI_BDFLAG_MINI_RING) { + minicnt++; TI_INC(sc->ti_mini, TI_MINI_RX_RING_CNT); m = sc->ti_cdata.ti_rx_mini_chain[rxidx]; sc->ti_cdata.ti_rx_mini_chain[rxidx] = NULL; @@ -2728,6 +2735,7 @@ ti_rxeof(struct ti_softc *sc) } m->m_len = cur_rx->ti_len; } else { + stdcnt++; TI_INC(sc->ti_std, TI_STD_RX_RING_CNT); m = sc->ti_cdata.ti_rx_std_chain[rxidx]; sc->ti_cdata.ti_rx_std_chain[rxidx] = NULL; @@ -2783,9 +2791,12 @@ ti_rxeof(struct ti_softc *sc) CSR_WRITE_4(sc, TI_GCR_RXRETURNCONS_IDX, sc->ti_rx_saved_considx); - TI_UPDATE_STDPROD(sc, sc->ti_std); - TI_UPDATE_MINIPROD(sc, sc->ti_mini); - TI_UPDATE_JUMBOPROD(sc, sc->ti_jumbo); + if (stdcnt > 0) + TI_UPDATE_STDPROD(sc, sc->ti_std); + if (minicnt > 0) + TI_UPDATE_MINIPROD(sc, sc->ti_mini); + if (jumbocnt > 0) + TI_UPDATE_JUMBOPROD(sc, sc->ti_jumbo); } static void @@ -3100,6 +3111,9 @@ ti_init_locked(void *xsc) { struct ti_softc *sc = xsc; + if (sc->ti_ifp->if_drv_flags & IFF_DRV_RUNNING) + return; + /* Cancel pending I/O and flush buffers. */ ti_stop(sc); @@ -3123,7 +3137,7 @@ static void ti_init2(struct ti_softc *sc ifp = sc->ti_ifp; /* Specify MTU and interface index. */ - CSR_WRITE_4(sc, TI_GCR_IFINDEX, sc->ti_unit); + CSR_WRITE_4(sc, TI_GCR_IFINDEX, device_get_unit(sc->ti_dev)); CSR_WRITE_4(sc, TI_GCR_IFMTU, ifp->if_mtu + ETHER_HDR_LEN + ETHER_CRC_LEN + ETHER_VLAN_ENCAP_LEN); TI_DO_CMD(TI_CMD_UPDATE_GENCOM, 0, 0); @@ -3154,18 +3168,34 @@ static void ti_init2(struct ti_softc *sc } /* Init RX ring. */ - ti_init_rx_ring_std(sc); + if (ti_init_rx_ring_std(sc) != 0) { + /* XXX */ + device_printf(sc->ti_dev, "no memory for std Rx buffers.\n"); + return; + } /* Init jumbo RX ring. */ - if (ifp->if_mtu > (ETHERMTU + ETHER_HDR_LEN + ETHER_CRC_LEN)) - ti_init_rx_ring_jumbo(sc); + if (ifp->if_mtu > (ETHERMTU + ETHER_HDR_LEN + ETHER_CRC_LEN)) { + if (ti_init_rx_ring_jumbo(sc) != 0) { + /* XXX */ + device_printf(sc->ti_dev, + "no memory for jumbo Rx buffers.\n"); + return; + } + } /* * If this is a Tigon 2, we can also configure the * mini ring. */ - if (sc->ti_hwrev == TI_HWREV_TIGON_II) - ti_init_rx_ring_mini(sc); + if (sc->ti_hwrev == TI_HWREV_TIGON_II) { + if (ti_init_rx_ring_mini(sc) != 0) { + /* XXX */ + device_printf(sc->ti_dev, + "no memory for mini Rx buffers.\n"); + return; + } + } CSR_WRITE_4(sc, TI_GCR_RXRETURNCONS_IDX, 0); sc->ti_rx_saved_considx = 0; @@ -3374,11 +3404,14 @@ ti_ioctl(struct ifnet *ifp, u_long comma switch (command) { case SIOCSIFMTU: TI_LOCK(sc); - if (ifr->ifr_mtu > TI_JUMBO_MTU) + if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > TI_JUMBO_MTU) error = EINVAL; else { ifp->if_mtu = ifr->ifr_mtu; - ti_init_locked(sc); + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + ti_init_locked(sc); + } } TI_UNLOCK(sc); break; @@ -3792,7 +3825,7 @@ ti_watchdog(void *arg) ifp = sc->ti_ifp; if_printf(ifp, "watchdog timeout -- resetting\n"); - ti_stop(sc); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; ti_init_locked(sc); ifp->if_oerrors++; @@ -3820,11 +3853,11 @@ ti_stop(struct ti_softc *sc) TI_DO_CMD(TI_CMD_HOST_STATE, TI_CMD_CODE_STACK_DOWN, 0); /* Halt and reinitialize. */ - if (ti_chipinit(sc) != 0) - return; - ti_mem_zero(sc, 0x2000, 0x100000 - 0x2000); - if (ti_chipinit(sc) != 0) - return; + if (ti_chipinit(sc) == 0) { + ti_mem_zero(sc, 0x2000, 0x100000 - 0x2000); + /* XXX ignore init errors. */ + ti_chipinit(sc); + } /* Free the RX lists. */ ti_free_rx_ring_std(sc); Modified: stable/7/sys/dev/ti/if_tireg.h ============================================================================== --- stable/7/sys/dev/ti/if_tireg.h Tue Jan 3 20:51:26 2012 (r229423) +++ stable/7/sys/dev/ti/if_tireg.h Tue Jan 3 20:52:05 2012 (r229424) @@ -1000,7 +1000,6 @@ struct ti_softc { struct resource *ti_irq; struct resource *ti_res; struct ifmedia ifmedia; /* media info */ - uint8_t ti_unit; /* interface number */ uint8_t ti_hwrev; /* Tigon rev (1 or 2) */ uint8_t ti_copper; /* 1000baseTX card */ uint8_t ti_linkstat; /* Link state */ From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 20:53:07 2012 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 A18AE106564A; Tue, 3 Jan 2012 20:53:07 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9052B8FC14; Tue, 3 Jan 2012 20:53: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 q03Kr7SP042562; Tue, 3 Jan 2012 20:53:07 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03Kr7de042560; Tue, 3 Jan 2012 20:53:07 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201032053.q03Kr7de042560@svn.freebsd.org> From: Dimitry Andric Date: Tue, 3 Jan 2012 20:53: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: r229425 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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, 03 Jan 2012 20:53:07 -0000 Author: dim Date: Tue Jan 3 20:53:07 2012 New Revision: 229425 URL: http://svn.freebsd.org/changeset/base/229425 Log: In sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c, check the the number of links against LINK_MAX (which is INT16_MAX), not against UINT32_MAX. Otherwise, the constant would implicitly be converted to -1. Reviewed by: pjd MFC after: 1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c 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 Jan 3 20:52:05 2012 (r229424) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue Jan 3 20:53:07 2012 (r229425) @@ -2698,7 +2698,7 @@ zfs_getattr(vnode_t *vp, vattr_t *vap, i links = zp->z_links + 1; else links = zp->z_links; - vap->va_nlink = MIN(links, UINT32_MAX); /* nlink_t limit! */ + vap->va_nlink = MIN(links, LINK_MAX); /* nlink_t limit! */ vap->va_size = zp->z_size; #ifdef sun vap->va_rdev = vp->v_rdev; From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 20:53:16 2012 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 9D7A3106567E; Tue, 3 Jan 2012 20:53:16 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8BD718FC0C; Tue, 3 Jan 2012 20:53: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 q03KrGG5042603; Tue, 3 Jan 2012 20:53:16 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03KrGu6042601; Tue, 3 Jan 2012 20:53:16 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201201032053.q03KrGu6042601@svn.freebsd.org> From: Mikolaj Golub Date: Tue, 3 Jan 2012 20:53:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229426 - stable/9/contrib/bsnmp/snmpd 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, 03 Jan 2012 20:53:16 -0000 Author: trociny Date: Tue Jan 3 20:53:16 2012 New Revision: 229426 URL: http://svn.freebsd.org/changeset/base/229426 Log: MFC r228411: Include sys/queue.h: snmpmod.h uses TAILQ. PR: bin/153153 Modified: stable/9/contrib/bsnmp/snmpd/snmpmod.h Directory Properties: stable/9/contrib/bsnmp/ (props changed) Modified: stable/9/contrib/bsnmp/snmpd/snmpmod.h ============================================================================== --- stable/9/contrib/bsnmp/snmpd/snmpmod.h Tue Jan 3 20:53:07 2012 (r229425) +++ stable/9/contrib/bsnmp/snmpd/snmpmod.h Tue Jan 3 20:53:16 2012 (r229426) @@ -40,6 +40,7 @@ #define snmpmod_h_ #include +#include #include #include #include From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 20:53:59 2012 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 29E6F106568F; Tue, 3 Jan 2012 20:53:59 +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 F322D8FC14; Tue, 3 Jan 2012 20:53: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 q03KrwW5042661; Tue, 3 Jan 2012 20:53:58 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03KrwAk042659; Tue, 3 Jan 2012 20:53:58 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201032053.q03KrwAk042659@svn.freebsd.org> From: John Baldwin Date: Tue, 3 Jan 2012 20:53: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: r229427 - head/sys/x86/acpica 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, 03 Jan 2012 20:53:59 -0000 Author: jhb Date: Tue Jan 3 20:53:58 2012 New Revision: 229427 URL: http://svn.freebsd.org/changeset/base/229427 Log: Fix a few bugs in the SRAT parsing code: - Actually increment ndomain when building our list of known domains so that we can properly renumber them to be 0-based and dense. - If the number of domains exceeds the configured maximum (VM_NDOMAIN), bail out of processing the SRAT and disable NUMA rather than hitting an obscure panic later. - Don't bother parsing the SRAT at all if VM_NDOMAIN is set to 1 to disable NUMA (the default). Reported by: phk (2) MFC after: 1 week Modified: head/sys/x86/acpica/srat.c Modified: head/sys/x86/acpica/srat.c ============================================================================== --- head/sys/x86/acpica/srat.c Tue Jan 3 20:53:16 2012 (r229426) +++ head/sys/x86/acpica/srat.c Tue Jan 3 20:53:58 2012 (r229427) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include +#if VM_NDOMAIN > 1 struct cpu_info { int enabled:1; int has_memory:1; @@ -237,9 +238,9 @@ check_phys_avail(void) /* * Renumber the memory domains to be compact and zero-based if not - * already. + * already. Returns an error if there are too many domains. */ -static void +static int renumber_domains(void) { int domains[VM_PHYSSEG_MAX]; @@ -261,6 +262,11 @@ renumber_domains(void) for (j = ndomain; j > slot; j--) domains[j] = domains[j - 1]; domains[slot] = mem_info[i].domain; + ndomain++; + if (ndomain > VM_NDOMAIN) { + printf("SRAT: Too many memory domains\n"); + return (EFBIG); + } } /* Renumber each domain to its index in the sorted 'domains' list. */ @@ -280,6 +286,7 @@ renumber_domains(void) if (cpus[j].enabled && cpus[j].domain == domains[i]) cpus[j].domain = i; } + return (0); } /* @@ -306,13 +313,12 @@ parse_srat(void *dummy) srat_walk_table(srat_parse_entry, &error); acpi_unmap_table(srat); srat = NULL; - if (error || check_domains() != 0 || check_phys_avail() != 0) { + if (error || check_domains() != 0 || check_phys_avail() != 0 || + renumber_domains() != 0) { srat_physaddr = 0; return; } - renumber_domains(); - /* Point vm_phys at our memory affinity table. */ mem_affinity = mem_info; } @@ -354,3 +360,4 @@ srat_set_cpus(void *dummy) } } SYSINIT(srat_set_cpus, SI_SUB_CPU, SI_ORDER_ANY, srat_set_cpus, NULL); +#endif /* VM_NDOMAIN > 1 */ From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 21:03:21 2012 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 4A87D106567D; Tue, 3 Jan 2012 21:03:21 +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 39A808FC1F; Tue, 3 Jan 2012 21:03: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 q03L3LQA043031; Tue, 3 Jan 2012 21:03:21 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03L3Lan043029; Tue, 3 Jan 2012 21:03:21 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201032103.q03L3Lan043029@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 3 Jan 2012 21:03: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: r229428 - head/sys/fs/nullfs 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, 03 Jan 2012 21:03:21 -0000 Author: kib Date: Tue Jan 3 21:03:20 2012 New Revision: 229428 URL: http://svn.freebsd.org/changeset/base/229428 Log: Document the state of the lowervp vnode for null_nodeget(). Tested by: pho MFC after: 1 week Modified: head/sys/fs/nullfs/null_subr.c Modified: head/sys/fs/nullfs/null_subr.c ============================================================================== --- head/sys/fs/nullfs/null_subr.c Tue Jan 3 20:53:58 2012 (r229427) +++ head/sys/fs/nullfs/null_subr.c Tue Jan 3 21:03:20 2012 (r229428) @@ -198,6 +198,9 @@ null_nodeget(mp, lowervp, vpp) struct vnode *vp; int error; + ASSERT_VOP_LOCKED(lowervp, "lowervp"); + KASSERT(lowervp->v_usecount >= 1, ("Unreferenced vnode %p\n", vp)); + /* Lookup the hash firstly */ *vpp = null_hashget(mp, lowervp); if (*vpp != NULL) { From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 21:03:28 2012 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 C22AD10657C9; Tue, 3 Jan 2012 21:03:28 +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 AF1758FC0A; Tue, 3 Jan 2012 21:03: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 q03L3SIt043073; Tue, 3 Jan 2012 21:03:28 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03L3SSQ043069; Tue, 3 Jan 2012 21:03:28 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201032103.q03L3SSQ043069@svn.freebsd.org> From: John Baldwin Date: Tue, 3 Jan 2012 21:03:28 +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: r229429 - 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, 03 Jan 2012 21:03:29 -0000 Author: jhb Date: Tue Jan 3 21:03:28 2012 New Revision: 229429 URL: http://svn.freebsd.org/changeset/base/229429 Log: Some small fixes to CPU accounting for threads: - Only initialize the per-cpu switchticks and switchtime in sched_throw() for the very first context switch on APs during boot. This avoids a small gap between the middle of thread_exit() and sched_throw() where time is not accounted to any thread. - In thread_exit(), update the timestamp bookkeeping to track the changes to mi_switch() introduced by td_rux so that the code once again matches the comment claiming it is mimicing mi_switch(). Specifically, only update the per-thread stats directly and depend on ruxagg() to update p_rux rather than adjusting p_rux directly. While here, move the timestamp bookkeeping as late in the function as possible. Reviewed by: bde, kib MFC after: 1 week Modified: head/sys/kern/kern_thread.c head/sys/kern/sched_4bsd.c head/sys/kern/sched_ule.c Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Tue Jan 3 21:03:20 2012 (r229428) +++ head/sys/kern/kern_thread.c Tue Jan 3 21:03:28 2012 (r229429) @@ -381,7 +381,7 @@ thread_free(struct thread *td) void thread_exit(void) { - uint64_t new_switchtime; + uint64_t runtime, new_switchtime; struct thread *td; struct thread *td2; struct proc *p; @@ -410,15 +410,6 @@ thread_exit(void) */ cpu_thread_exit(td); /* XXXSMP */ - /* Do the same timestamp bookkeeping that mi_switch() would do. */ - new_switchtime = cpu_ticks(); - p->p_rux.rux_runtime += (new_switchtime - PCPU_GET(switchtime)); - PCPU_SET(switchtime, new_switchtime); - PCPU_SET(switchticks, ticks); - PCPU_INC(cnt.v_swtch); - /* Save our resource usage in our process. */ - td->td_ru.ru_nvcsw++; - rucollect(&p->p_ru, &td->td_ru); /* * The last thread is left attached to the process * So that the whole bundle gets recycled. Skip @@ -467,7 +458,21 @@ thread_exit(void) PMC_SWITCH_CONTEXT(td, PMC_FN_CSW_OUT); #endif PROC_UNLOCK(p); + + /* Do the same timestamp bookkeeping that mi_switch() would do. */ + new_switchtime = cpu_ticks(); + runtime = new_switchtime - PCPU_GET(switchtime); + td->td_runtime += runtime; + td->td_incruntime += runtime; + PCPU_SET(switchtime, new_switchtime); + PCPU_SET(switchticks, ticks); + PCPU_INC(cnt.v_swtch); + + /* Save our resource usage in our process. */ + td->td_ru.ru_nvcsw++; ruxagg(p, td); + rucollect(&p->p_ru, &td->td_ru); + thread_lock(td); PROC_SUNLOCK(p); td->td_state = TDS_INACTIVE; Modified: head/sys/kern/sched_4bsd.c ============================================================================== --- head/sys/kern/sched_4bsd.c Tue Jan 3 21:03:20 2012 (r229428) +++ head/sys/kern/sched_4bsd.c Tue Jan 3 21:03:28 2012 (r229429) @@ -1572,14 +1572,14 @@ sched_throw(struct thread *td) if (td == NULL) { mtx_lock_spin(&sched_lock); spinlock_exit(); + PCPU_SET(switchtime, cpu_ticks()); + PCPU_SET(switchticks, ticks); } else { lock_profile_release_lock(&sched_lock.lock_object); MPASS(td->td_lock == &sched_lock); } mtx_assert(&sched_lock, MA_OWNED); KASSERT(curthread->td_md.md_spinlock_count == 1, ("invalid count")); - PCPU_SET(switchtime, cpu_ticks()); - PCPU_SET(switchticks, ticks); cpu_throw(td, choosethread()); /* doesn't return */ } Modified: head/sys/kern/sched_ule.c ============================================================================== --- head/sys/kern/sched_ule.c Tue Jan 3 21:03:20 2012 (r229428) +++ head/sys/kern/sched_ule.c Tue Jan 3 21:03:28 2012 (r229429) @@ -2587,6 +2587,8 @@ sched_throw(struct thread *td) /* Correct spinlock nesting and acquire the correct lock. */ TDQ_LOCK(tdq); spinlock_exit(); + PCPU_SET(switchtime, cpu_ticks()); + PCPU_SET(switchticks, ticks); } else { MPASS(td->td_lock == TDQ_LOCKPTR(tdq)); tdq_load_rem(tdq, td); @@ -2595,8 +2597,6 @@ sched_throw(struct thread *td) KASSERT(curthread->td_md.md_spinlock_count == 1, ("invalid count")); newtd = choosethread(); TDQ_LOCKPTR(tdq)->mtx_lock = (uintptr_t)newtd; - PCPU_SET(switchtime, cpu_ticks()); - PCPU_SET(switchticks, ticks); cpu_throw(td, newtd); /* doesn't return */ } From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 21:04:54 2012 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 975FC1065678; Tue, 3 Jan 2012 21:04:54 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 845F28FC22; Tue, 3 Jan 2012 21:04: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 q03L4sPO043163; Tue, 3 Jan 2012 21:04:54 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03L4sTm043158; Tue, 3 Jan 2012 21:04:54 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201201032104.q03L4sTm043158@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Tue, 3 Jan 2012 21:04:54 +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: r229430 - in head/sys: conf dev/sound/pci modules/sound/driver/emu10k1 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, 03 Jan 2012 21:04:54 -0000 Author: pfg Date: Tue Jan 3 21:04:54 2012 New Revision: 229430 URL: http://svn.freebsd.org/changeset/base/229430 Log: Replace a GPL'd header in the emu10k1 snd driver code. This brings in the emuxkireg.h from NetBSD (dev/pci) which is used for the same purpose but is smaller. The emu10k1 is now free from the GPL. PR: 153901 Obtained from: NetBSD Approved by: core (mentor implicit) MFC after: 2 weeks Added: head/sys/dev/sound/pci/emuxkireg.h (contents, props changed) Modified: head/sys/conf/files head/sys/dev/sound/pci/emu10k1.c head/sys/modules/sound/driver/emu10k1/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Tue Jan 3 21:03:28 2012 (r229429) +++ head/sys/conf/files Tue Jan 3 21:04:54 2012 (r229430) @@ -50,7 +50,7 @@ aic79xx_reg_print.c optional ahd pci aic79xx_reg_print.o optional ahd pci ahd_reg_pretty_print \ compile-with "${NORMAL_C}" \ no-implicit-rule local -emu10k1-alsa%diked.h optional snd_emu10k1 | snd_emu10kx \ +emu10k1-alsa%diked.h optional snd_emu10kx \ dependency "$S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/emu10k1-alsa.h" \ compile-with "CC='${CC}' AWK=${AWK} sh $S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/emu10k1-alsa.h emu10k1-alsa%diked.h" \ no-obj no-implicit-rule before-depend \ @@ -1732,9 +1732,7 @@ dev/sound/pci/csa.c optional snd_csa pc warning "kernel contains GPL contaminated csaimg.h header" dev/sound/pci/csapcm.c optional snd_csa pci dev/sound/pci/ds1.c optional snd_ds1 pci -dev/sound/pci/emu10k1.c optional snd_emu10k1 pci \ - dependency "emu10k1-alsa%diked.h" \ - warning "kernel contains GPL contaminated emu10k1 headers" +dev/sound/pci/emu10k1.c optional snd_emu10k1 pci dev/sound/pci/emu10kx.c optional snd_emu10kx pci \ dependency "emu10k1-alsa%diked.h" \ dependency "p16v-alsa%diked.h" \ Modified: head/sys/dev/sound/pci/emu10k1.c ============================================================================== --- head/sys/dev/sound/pci/emu10k1.c Tue Jan 3 21:03:28 2012 (r229429) +++ head/sys/dev/sound/pci/emu10k1.c Tue Jan 3 21:04:54 2012 (r229430) @@ -32,7 +32,7 @@ #include #include -#include "emu10k1-alsa%diked.h" +#include #include #include @@ -66,12 +66,94 @@ SND_DECLARE_FILE("$FreeBSD$"); #define ENABLE 0xffffffff #define DISABLE 0x00000000 -#define ENV_ON DCYSUSV_CHANNELENABLE_MASK +#define ENV_ON EMU_CHAN_DCYSUSV_CHANNELENABLE_MASK #define ENV_OFF 0x00 /* XXX: should this be 1? */ -#define A_IOCFG_GPOUT_A 0x40 /* Analog Output */ -#define A_IOCFG_GPOUT_D 0x04 /* Digital Output */ -#define A_IOCFG_GPOUT_AD (A_IOCFG_GPOUT_A|A_IOCFG_GPOUT_D) /* A_IOCFG_GPOUT0 */ +#define EMU_A_IOCFG_GPOUT_A 0x40 +#define EMU_A_IOCFG_GPOUT_D 0x04 +#define EMU_A_IOCFG_GPOUT_AD (EMU_A_IOCFG_GPOUT_A|EMU_A_IOCFG_GPOUT_D) /* EMU_A_IOCFG_GPOUT0 */ + +#define EMU_HCFG_GPOUT1 0x00000800 + +/* instruction set */ +#define iACC3 0x06 +#define iMACINT0 0x04 +#define iINTERP 0x0e + +#define C_00000000 0x40 +#define C_00000001 0x41 +#define C_00000004 0x44 +#define C_40000000 0x4d +/* Audigy constants */ +#define A_C_00000000 0xc0 +#define A_C_40000000 0xcd + +/* GPRs */ +#define FXBUS(x) (0x00 + (x)) +#define EXTIN(x) (0x10 + (x)) +#define EXTOUT(x) (0x20 + (x)) + +#define GPR(x) (EMU_FXGPREGBASE + (x)) +#define A_EXTIN(x) (0x40 + (x)) +#define A_FXBUS(x) (0x00 + (x)) +#define A_EXTOUT(x) (0x60 + (x)) +#define A_GPR(x) (EMU_A_FXGPREGBASE + (x)) + +/* FX buses */ +#define FXBUS_PCM_LEFT 0x00 +#define FXBUS_PCM_RIGHT 0x01 +#define FXBUS_MIDI_LEFT 0x04 +#define FXBUS_MIDI_RIGHT 0x05 +#define FXBUS_MIDI_REVERB 0x0c +#define FXBUS_MIDI_CHORUS 0x0d + +/* Inputs */ +#define EXTIN_AC97_L 0x00 +#define EXTIN_AC97_R 0x01 +#define EXTIN_SPDIF_CD_L 0x02 +#define EXTIN_SPDIF_CD_R 0x03 +#define EXTIN_TOSLINK_L 0x06 +#define EXTIN_TOSLINK_R 0x07 +#define EXTIN_COAX_SPDIF_L 0x0a +#define EXTIN_COAX_SPDIF_R 0x0b +/* Audigy Inputs */ +#define A_EXTIN_AC97_L 0x00 +#define A_EXTIN_AC97_R 0x01 + +/* Outputs */ +#define EXTOUT_AC97_L 0x00 +#define EXTOUT_AC97_R 0x01 +#define EXTOUT_TOSLINK_L 0x02 +#define EXTOUT_TOSLINK_R 0x03 +#define EXTOUT_AC97_CENTER 0x04 +#define EXTOUT_AC97_LFE 0x05 +#define EXTOUT_HEADPHONE_L 0x06 +#define EXTOUT_HEADPHONE_R 0x07 +#define EXTOUT_REAR_L 0x08 +#define EXTOUT_REAR_R 0x09 +#define EXTOUT_ADC_CAP_L 0x0a +#define EXTOUT_ADC_CAP_R 0x0b +#define EXTOUT_ACENTER 0x11 +#define EXTOUT_ALFE 0x12 +/* Audigy Outputs */ +#define A_EXTOUT_FRONT_L 0x00 +#define A_EXTOUT_FRONT_R 0x01 +#define A_EXTOUT_CENTER 0x02 +#define A_EXTOUT_LFE 0x03 +#define A_EXTOUT_HEADPHONE_L 0x04 +#define A_EXTOUT_HEADPHONE_R 0x05 +#define A_EXTOUT_REAR_L 0x06 +#define A_EXTOUT_REAR_R 0x07 +#define A_EXTOUT_AFRONT_L 0x08 +#define A_EXTOUT_AFRONT_R 0x09 +#define A_EXTOUT_ACENTER 0x0a +#define A_EXTOUT_ALFE 0x0b +#define A_EXTOUT_AREAR_L 0x0e +#define A_EXTOUT_AREAR_R 0x0f +#define A_EXTOUT_AC97_L 0x10 +#define A_EXTOUT_AC97_R 0x11 +#define A_EXTOUT_ADC_CAP_L 0x16 +#define A_EXTOUT_ADC_CAP_R 0x17 struct emu_memblk { SLIST_ENTRY(emu_memblk) link; @@ -247,9 +329,9 @@ emu_rdptr(struct sc_info *sc, int chn, i { u_int32_t ptr, val, mask, size, offset; - ptr = ((reg << 16) & sc->addrmask) | (chn & PTR_CHANNELNUM_MASK); - emu_wr(sc, PTR, ptr, 4); - val = emu_rd(sc, DATA, 4); + ptr = ((reg << 16) & sc->addrmask) | (chn & EMU_PTR_CHNO_MASK); + emu_wr(sc, EMU_PTR, ptr, 4); + val = emu_rd(sc, EMU_DATA, 4); if (reg & 0xff000000) { size = (reg >> 24) & 0x3f; offset = (reg >> 16) & 0x1f; @@ -265,23 +347,23 @@ emu_wrptr(struct sc_info *sc, int chn, i { u_int32_t ptr, mask, size, offset; - ptr = ((reg << 16) & sc->addrmask) | (chn & PTR_CHANNELNUM_MASK); - emu_wr(sc, PTR, ptr, 4); + ptr = ((reg << 16) & sc->addrmask) | (chn & EMU_PTR_CHNO_MASK); + emu_wr(sc, EMU_PTR, ptr, 4); if (reg & 0xff000000) { size = (reg >> 24) & 0x3f; offset = (reg >> 16) & 0x1f; mask = ((1 << size) - 1) << offset; data <<= offset; data &= mask; - data |= emu_rd(sc, DATA, 4) & ~mask; + data |= emu_rd(sc, EMU_DATA, 4) & ~mask; } - emu_wr(sc, DATA, data, 4); + emu_wr(sc, EMU_DATA, data, 4); } static void emu_wrefx(struct sc_info *sc, unsigned int pc, unsigned int data) { - pc += sc->audigy ? A_MICROCODEBASE : MICROCODEBASE; + pc += sc->audigy ? EMU_A_MICROCODEBASE : EMU_MICROCODEBASE; emu_wrptr(sc, 0, pc, data); } @@ -294,8 +376,8 @@ emu_rdcd(kobj_t obj, void *devinfo, int { struct sc_info *sc = (struct sc_info *)devinfo; - emu_wr(sc, AC97ADDRESS, regno, 1); - return emu_rd(sc, AC97DATA, 2); + emu_wr(sc, EMU_AC97ADDR, regno, 1); + return emu_rd(sc, EMU_AC97DATA, 2); } static int @@ -303,8 +385,8 @@ emu_wrcd(kobj_t obj, void *devinfo, int { struct sc_info *sc = (struct sc_info *)devinfo; - emu_wr(sc, AC97ADDRESS, regno, 1); - emu_wr(sc, AC97DATA, data, 2); + emu_wr(sc, EMU_AC97ADDR, regno, 1); + emu_wr(sc, EMU_AC97DATA, data, 2); return 0; } @@ -346,7 +428,7 @@ emu_settimer(struct sc_info *sc) } RANGE(rate, 48, 9600); sc->timerinterval = 48000 / rate; - emu_wr(sc, TIMER, sc->timerinterval & 0x03ff, 2); + emu_wr(sc, EMU_TIMER, sc->timerinterval & 0x03ff, 2); return sc->timerinterval; } @@ -357,15 +439,15 @@ emu_enatimer(struct sc_info *sc, int go) u_int32_t x; if (go) { if (sc->timer++ == 0) { - x = emu_rd(sc, INTE, 4); - x |= INTE_INTERVALTIMERENB; - emu_wr(sc, INTE, x, 4); + x = emu_rd(sc, EMU_INTE, 4); + x |= EMU_INTE_INTERTIMERENB; + emu_wr(sc, EMU_INTE, x, 4); } } else { sc->timer = 0; - x = emu_rd(sc, INTE, 4); - x &= ~INTE_INTERVALTIMERENB; - emu_wr(sc, INTE, x, 4); + x = emu_rd(sc, EMU_INTE, 4); + x &= ~EMU_INTE_INTERTIMERENB; + emu_wr(sc, EMU_INTE, x, 4); } return 0; } @@ -373,7 +455,7 @@ emu_enatimer(struct sc_info *sc, int go) static void emu_enastop(struct sc_info *sc, char channel, int enable) { - int reg = (channel & 0x20) ? SOLEH : SOLEL; + int reg = (channel & 0x20) ? EMU_SOLEH : EMU_SOLEL; channel &= 0x1f; reg |= 1 << 24; reg |= channel << 16; @@ -568,49 +650,49 @@ emu_vwrite(struct sc_info *sc, struct em r = v->ismaster ? 0 : r; } - emu_wrptr(sc, v->vnum, CPF, v->stereo ? CPF_STEREO_MASK : 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_CPF, v->stereo ? EMU_CHAN_CPF_STEREO_MASK : 0); val = v->stereo ? 28 : 30; val *= v->b16 ? 1 : 2; start = sa + val; if (sc->audigy) { - emu_wrptr(sc, v->vnum, A_FXRT1, v->fxrt1); - emu_wrptr(sc, v->vnum, A_FXRT2, v->fxrt2); - emu_wrptr(sc, v->vnum, A_SENDAMOUNTS, 0); + emu_wrptr(sc, v->vnum, EMU_A_CHAN_FXRT1, v->fxrt1); + emu_wrptr(sc, v->vnum, EMU_A_CHAN_FXRT2, v->fxrt2); + emu_wrptr(sc, v->vnum, EMU_A_CHAN_SENDAMOUNTS, 0); } else - emu_wrptr(sc, v->vnum, FXRT, v->fxrt1 << 16); + emu_wrptr(sc, v->vnum, EMU_CHAN_FXRT, v->fxrt1 << 16); - emu_wrptr(sc, v->vnum, PTRX, (x << 8) | r); - emu_wrptr(sc, v->vnum, DSL, ea | (y << 24)); - emu_wrptr(sc, v->vnum, PSST, sa | (l << 24)); - emu_wrptr(sc, v->vnum, CCCA, start | (v->b16 ? 0 : CCCA_8BITSELECT)); + emu_wrptr(sc, v->vnum, EMU_CHAN_PTRX, (x << 8) | r); + emu_wrptr(sc, v->vnum, EMU_CHAN_DSL, ea | (y << 24)); + emu_wrptr(sc, v->vnum, EMU_CHAN_PSST, sa | (l << 24)); + emu_wrptr(sc, v->vnum, EMU_CHAN_CCCA, start | (v->b16 ? 0 : EMU_CHAN_CCCA_8BITSELECT)); - emu_wrptr(sc, v->vnum, Z1, 0); - emu_wrptr(sc, v->vnum, Z2, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_Z1, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_Z2, 0); silent_page = ((u_int32_t)(sc->mem.silent_page_addr) << 1) - | MAP_PTI_MASK; - emu_wrptr(sc, v->vnum, MAPA, silent_page); - emu_wrptr(sc, v->vnum, MAPB, silent_page); - - emu_wrptr(sc, v->vnum, CVCF, CVCF_CURRENTFILTER_MASK); - emu_wrptr(sc, v->vnum, VTFT, VTFT_FILTERTARGET_MASK); - emu_wrptr(sc, v->vnum, ATKHLDM, 0); - emu_wrptr(sc, v->vnum, DCYSUSM, DCYSUSM_DECAYTIME_MASK); - emu_wrptr(sc, v->vnum, LFOVAL1, 0x8000); - emu_wrptr(sc, v->vnum, LFOVAL2, 0x8000); - emu_wrptr(sc, v->vnum, FMMOD, 0); - emu_wrptr(sc, v->vnum, TREMFRQ, 0); - emu_wrptr(sc, v->vnum, FM2FRQ2, 0); - emu_wrptr(sc, v->vnum, ENVVAL, 0x8000); - - emu_wrptr(sc, v->vnum, ATKHLDV, - ATKHLDV_HOLDTIME_MASK | ATKHLDV_ATTACKTIME_MASK); - emu_wrptr(sc, v->vnum, ENVVOL, 0x8000); + | EMU_CHAN_MAP_PTI_MASK; + emu_wrptr(sc, v->vnum, EMU_CHAN_MAPA, silent_page); + emu_wrptr(sc, v->vnum, EMU_CHAN_MAPB, silent_page); + + emu_wrptr(sc, v->vnum, EMU_CHAN_CVCF, EMU_CHAN_CVCF_CURRFILTER_MASK); + emu_wrptr(sc, v->vnum, EMU_CHAN_VTFT, EMU_CHAN_VTFT_FILTERTARGET_MASK); + emu_wrptr(sc, v->vnum, EMU_CHAN_ATKHLDM, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_DCYSUSM, EMU_CHAN_DCYSUSM_DECAYTIME_MASK); + emu_wrptr(sc, v->vnum, EMU_CHAN_LFOVAL1, 0x8000); + emu_wrptr(sc, v->vnum, EMU_CHAN_LFOVAL2, 0x8000); + emu_wrptr(sc, v->vnum, EMU_CHAN_FMMOD, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_TREMFRQ, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_FM2FRQ2, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_ENVVAL, 0x8000); + + emu_wrptr(sc, v->vnum, EMU_CHAN_ATKHLDV, + EMU_CHAN_ATKHLDV_HOLDTIME_MASK | EMU_CHAN_ATKHLDV_ATTACKTIME_MASK); + emu_wrptr(sc, v->vnum, EMU_CHAN_ENVVOL, 0x8000); - emu_wrptr(sc, v->vnum, PEFE_FILTERAMOUNT, 0x7f); - emu_wrptr(sc, v->vnum, PEFE_PITCHAMOUNT, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_PEFE_FILTERAMOUNT, 0x7f); + emu_wrptr(sc, v->vnum, EMU_CHAN_PEFE_PITCHAMOUNT, 0); if (v->slave != NULL) emu_vwrite(sc, v->slave); @@ -631,29 +713,29 @@ emu_vtrigger(struct sc_info *sc, struct sample = v->b16 ? 0x00000000 : 0x80808080; for (i = 0; i < cs; i++) - emu_wrptr(sc, v->vnum, CD0 + i, sample); - emu_wrptr(sc, v->vnum, CCR_CACHEINVALIDSIZE, 0); - emu_wrptr(sc, v->vnum, CCR_READADDRESS, cra); - emu_wrptr(sc, v->vnum, CCR_CACHEINVALIDSIZE, ccis); - - emu_wrptr(sc, v->vnum, IFATN, 0xff00); - emu_wrptr(sc, v->vnum, VTFT, 0xffffffff); - emu_wrptr(sc, v->vnum, CVCF, 0xffffffff); - emu_wrptr(sc, v->vnum, DCYSUSV, 0x00007f7f); + emu_wrptr(sc, v->vnum, EMU_CHAN_CD0 + i, sample); + emu_wrptr(sc, v->vnum, EMU_CHAN_CCR_CACHEINVALIDSIZE, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_CCR_READADDRESS, cra); + emu_wrptr(sc, v->vnum, EMU_CHAN_CCR_CACHEINVALIDSIZE, ccis); + + emu_wrptr(sc, v->vnum, EMU_CHAN_IFATN, 0xff00); + emu_wrptr(sc, v->vnum, EMU_CHAN_VTFT, 0xffffffff); + emu_wrptr(sc, v->vnum, EMU_CHAN_CVCF, 0xffffffff); + emu_wrptr(sc, v->vnum, EMU_CHAN_DCYSUSV, 0x00007f7f); emu_enastop(sc, v->vnum, 0); pitch_target = emu_rate_to_linearpitch(v->speed); initial_pitch = emu_rate_to_pitch(v->speed) >> 8; - emu_wrptr(sc, v->vnum, PTRX_PITCHTARGET, pitch_target); - emu_wrptr(sc, v->vnum, CPF_CURRENTPITCH, pitch_target); - emu_wrptr(sc, v->vnum, IP, initial_pitch); + emu_wrptr(sc, v->vnum, EMU_CHAN_PTRX_PITCHTARGET, pitch_target); + emu_wrptr(sc, v->vnum, EMU_CHAN_CPF_PITCH, pitch_target); + emu_wrptr(sc, v->vnum, EMU_CHAN_IP, initial_pitch); } else { - emu_wrptr(sc, v->vnum, PTRX_PITCHTARGET, 0); - emu_wrptr(sc, v->vnum, CPF_CURRENTPITCH, 0); - emu_wrptr(sc, v->vnum, IFATN, 0xffff); - emu_wrptr(sc, v->vnum, VTFT, 0x0000ffff); - emu_wrptr(sc, v->vnum, CVCF, 0x0000ffff); - emu_wrptr(sc, v->vnum, IP, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_PTRX_PITCHTARGET, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_CPF_PITCH, 0); + emu_wrptr(sc, v->vnum, EMU_CHAN_IFATN, 0xffff); + emu_wrptr(sc, v->vnum, EMU_CHAN_VTFT, 0x0000ffff); + emu_wrptr(sc, v->vnum, EMU_CHAN_CVCF, 0x0000ffff); + emu_wrptr(sc, v->vnum, EMU_CHAN_IP, 0); emu_enastop(sc, v->vnum, 1); } if (v->slave != NULL) @@ -666,7 +748,7 @@ emu_vpos(struct sc_info *sc, struct emu_ int s, ptr; s = (v->b16 ? 1 : 0) + (v->stereo ? 1 : 0); - ptr = (emu_rdptr(sc, v->vnum, CCCA_CURRADDR) - (v->start >> s)) << s; + ptr = (emu_rdptr(sc, v->vnum, EMU_CHAN_CCCA_CURRADDR) - (v->start >> s)) << s; return ptr & ~0x0000001f; } @@ -875,27 +957,27 @@ emurchan_init(kobj_t obj, void *devinfo, ch->num = sc->rnum; switch(sc->rnum) { case 0: - ch->idxreg = sc->audigy ? A_ADCIDX : ADCIDX; - ch->basereg = ADCBA; - ch->sizereg = ADCBS; - ch->setupreg = ADCCR; - ch->irqmask = INTE_ADCBUFENABLE; + ch->idxreg = sc->audigy ? EMU_A_ADCIDX : EMU_ADCIDX; + ch->basereg = EMU_ADCBA; + ch->sizereg = EMU_ADCBS; + ch->setupreg = EMU_ADCCR; + ch->irqmask = EMU_INTE_ADCBUFENABLE; break; case 1: - ch->idxreg = FXIDX; - ch->basereg = FXBA; - ch->sizereg = FXBS; - ch->setupreg = FXWC; - ch->irqmask = INTE_EFXBUFENABLE; + ch->idxreg = EMU_FXIDX; + ch->basereg = EMU_FXBA; + ch->sizereg = EMU_FXBS; + ch->setupreg = EMU_FXWC; + ch->irqmask = EMU_INTE_EFXBUFENABLE; break; case 2: - ch->idxreg = MICIDX; - ch->basereg = MICBA; - ch->sizereg = MICBS; + ch->idxreg = EMU_MICIDX; + ch->basereg = EMU_MICBA; + ch->sizereg = EMU_MICBS; ch->setupreg = 0; - ch->irqmask = INTE_MICBUFENABLE; + ch->irqmask = EMU_INTE_MICBUFENABLE; break; } sc->rnum++; @@ -967,27 +1049,27 @@ emurchan_trigger(kobj_t obj, void *data, switch(sc->bufsz) { case 4096: - sz = ADCBS_BUFSIZE_4096; + sz = EMU_RECBS_BUFSIZE_4096; break; case 8192: - sz = ADCBS_BUFSIZE_8192; + sz = EMU_RECBS_BUFSIZE_8192; break; case 16384: - sz = ADCBS_BUFSIZE_16384; + sz = EMU_RECBS_BUFSIZE_16384; break; case 32768: - sz = ADCBS_BUFSIZE_32768; + sz = EMU_RECBS_BUFSIZE_32768; break; case 65536: - sz = ADCBS_BUFSIZE_65536; + sz = EMU_RECBS_BUFSIZE_65536; break; default: - sz = ADCBS_BUFSIZE_4096; + sz = EMU_RECBS_BUFSIZE_4096; } snd_mtxlock(sc->lock); @@ -997,23 +1079,23 @@ emurchan_trigger(kobj_t obj, void *data, emu_wrptr(sc, 0, ch->sizereg, sz); if (ch->num == 0) { if (sc->audigy) { - val = A_ADCCR_LCHANENABLE; + val = EMU_ADCCR_LCHANENABLE; if (AFMT_CHANNEL(ch->fmt) > 1) - val |= A_ADCCR_RCHANENABLE; + val |= EMU_ADCCR_RCHANENABLE; val |= audigy_recval(ch->spd); } else { - val = ADCCR_LCHANENABLE; + val = EMU_ADCCR_LCHANENABLE; if (AFMT_CHANNEL(ch->fmt) > 1) - val |= ADCCR_RCHANENABLE; + val |= EMU_ADCCR_RCHANENABLE; val |= emu_recval(ch->spd); } emu_wrptr(sc, 0, ch->setupreg, 0); emu_wrptr(sc, 0, ch->setupreg, val); } - val = emu_rd(sc, INTE, 4); + val = emu_rd(sc, EMU_INTE, 4); val |= ch->irqmask; - emu_wr(sc, INTE, val, 4); + emu_wr(sc, EMU_INTE, val, 4); break; case PCMTRIG_STOP: @@ -1022,9 +1104,9 @@ emurchan_trigger(kobj_t obj, void *data, emu_wrptr(sc, 0, ch->sizereg, 0); if (ch->setupreg) emu_wrptr(sc, 0, ch->setupreg, 0); - val = emu_rd(sc, INTE, 4); + val = emu_rd(sc, EMU_INTE, 4); val &= ~ch->irqmask; - emu_wr(sc, INTE, val, 4); + emu_wr(sc, EMU_INTE, val, 4); break; case PCMTRIG_EMLDMAWR: @@ -1122,9 +1204,9 @@ emu_midiattach(struct sc_info *sc) { int i; - i = emu_rd(sc, INTE, 4); - i |= INTE_MIDIRXENABLE; - emu_wr(sc, INTE, i, 4); + i = emu_rd(sc, EMU_INTE, 4); + i |= EMU_INTE_MIDIRXENABLE; + emu_wr(sc, EMU_INTE, i, 4); sc->mpu = mpu401_init(&emu_mpu_class, sc, emu_intr2, &sc->mpu_intr); } @@ -1139,52 +1221,52 @@ emu_intr(void *data) snd_mtxlock(sc->lock); while (1) { - stat = emu_rd(sc, IPR, 4); + stat = emu_rd(sc, EMU_IPR, 4); if (stat == 0) break; ack = 0; /* process irq */ - if (stat & IPR_INTERVALTIMER) - ack |= IPR_INTERVALTIMER; + if (stat & EMU_IPR_INTERVALTIMER) + ack |= EMU_IPR_INTERVALTIMER; - if (stat & (IPR_ADCBUFFULL | IPR_ADCBUFHALFFULL)) - ack |= stat & (IPR_ADCBUFFULL | IPR_ADCBUFHALFFULL); + if (stat & (EMU_IPR_ADCBUFFULL | EMU_IPR_ADCBUFHALFFULL)) + ack |= stat & (EMU_IPR_ADCBUFFULL | EMU_IPR_ADCBUFHALFFULL); - if (stat & (IPR_EFXBUFFULL | IPR_EFXBUFHALFFULL)) - ack |= stat & (IPR_EFXBUFFULL | IPR_EFXBUFHALFFULL); + if (stat & (EMU_IPR_EFXBUFFULL | EMU_IPR_EFXBUFHALFFULL)) + ack |= stat & (EMU_IPR_EFXBUFFULL | EMU_IPR_EFXBUFHALFFULL); - if (stat & (IPR_MICBUFFULL | IPR_MICBUFHALFFULL)) - ack |= stat & (IPR_MICBUFFULL | IPR_MICBUFHALFFULL); + if (stat & (EMU_IPR_MICBUFFULL | EMU_IPR_MICBUFHALFFULL)) + ack |= stat & (EMU_IPR_MICBUFFULL | EMU_IPR_MICBUFHALFFULL); - if (stat & IPR_PCIERROR) { - ack |= IPR_PCIERROR; + if (stat & EMU_PCIERROR) { + ack |= EMU_PCIERROR; device_printf(sc->dev, "pci error\n"); /* we still get an nmi with ecc ram even if we ack this */ } - if (stat & IPR_SAMPLERATETRACKER) { - ack |= IPR_SAMPLERATETRACKER; + if (stat & EMU_IPR_RATETRCHANGE) { + ack |= EMU_IPR_RATETRCHANGE; #ifdef EMUDEBUG device_printf(sc->dev, "sample rate tracker lock status change\n"); #endif } - if (stat & IPR_MIDIRECVBUFEMPTY) + if (stat & EMU_IPR_MIDIRECVBUFE) if (sc->mpu_intr) { (sc->mpu_intr)(sc->mpu); - ack |= IPR_MIDIRECVBUFEMPTY | IPR_MIDITRANSBUFEMPTY; + ack |= EMU_IPR_MIDIRECVBUFE | EMU_IPR_MIDITRANSBUFE; } if (stat & ~ack) device_printf(sc->dev, "dodgy irq: %x (harmless)\n", stat & ~ack); - emu_wr(sc, IPR, stat, 4); + emu_wr(sc, EMU_IPR, stat, 4); if (ack) { snd_mtxunlock(sc->lock); - if (ack & IPR_INTERVALTIMER) { + if (ack & EMU_IPR_INTERVALTIMER) { x = 0; for (i = 0; i < sc->nchans; i++) { if (sc->pch[i].run) { @@ -1197,15 +1279,15 @@ emu_intr(void *data) } - if (ack & (IPR_ADCBUFFULL | IPR_ADCBUFHALFFULL)) { + if (ack & (EMU_IPR_ADCBUFFULL | EMU_IPR_ADCBUFHALFFULL)) { if (sc->rch[0].channel) chn_intr(sc->rch[0].channel); } - if (ack & (IPR_EFXBUFFULL | IPR_EFXBUFHALFFULL)) { + if (ack & (EMU_IPR_EFXBUFFULL | EMU_IPR_EFXBUFHALFFULL)) { if (sc->rch[1].channel) chn_intr(sc->rch[1].channel); } - if (ack & (IPR_MICBUFFULL | IPR_MICBUFHALFFULL)) { + if (ack & (EMU_IPR_MICBUFFULL | EMU_IPR_MICBUFHALFFULL)) { if (sc->rch[2].channel) chn_intr(sc->rch[2].channel); } @@ -1378,12 +1460,12 @@ audigy_initefx(struct sc_info *sc) audigy_addefxop(sc, 0x0f, 0x0c0, 0x0c0, 0x0cf, 0x0c0, &pc); for (i = 0; i < 512; i++) - emu_wrptr(sc, 0, A_FXGPREGBASE + i, 0x0); + emu_wrptr(sc, 0, EMU_A_FXGPREGBASE + i, 0x0); pc = 16; /* stop fx processor */ - emu_wrptr(sc, 0, A_DBG, A_DBG_SINGLE_STEP); + emu_wrptr(sc, 0, EMU_A_DBG, EMU_A_DBG_SINGLE_STEP); /* Audigy 2 (EMU10K2) DSP Registers: FX Bus @@ -1518,7 +1600,7 @@ audigy_initefx(struct sc_info *sc) A_C_00000000, A_EXTIN(A_EXTIN_AC97_R), &pc); /* resume normal operations */ - emu_wrptr(sc, 0, A_DBG, 0); + emu_wrptr(sc, 0, EMU_A_DBG, 0); } static void @@ -1534,7 +1616,7 @@ emu_initefx(struct sc_info *sc) } for (i = 0; i < 256; i++) - emu_wrptr(sc, 0, FXGPREGBASE + i, 0); + emu_wrptr(sc, 0, EMU_FXGPREGBASE + i, 0); /* FX-8010 DSP Registers: FX Bus @@ -1654,7 +1736,7 @@ emu_initefx(struct sc_info *sc) C_00000000, EXTIN(EXTIN_AC97_R), &pc); /* resume normal operations */ - emu_wrptr(sc, 0, DBG, 0); + emu_wrptr(sc, 0, EMU_DBG, 0); } /* Probe and attach the card */ @@ -1665,69 +1747,69 @@ emu_init(struct sc_info *sc) if (sc->audigy) { /* enable additional AC97 slots */ - emu_wrptr(sc, 0, AC97SLOT, AC97SLOT_CNTR | AC97SLOT_LFE); + emu_wrptr(sc, 0, EMU_AC97SLOT, EMU_AC97SLOT_CENTER | EMU_AC97SLOT_LFE); } /* disable audio and lock cache */ - emu_wr(sc, HCFG, - HCFG_LOCKSOUNDCACHE | HCFG_LOCKTANKCACHE_MASK | HCFG_MUTEBUTTONENABLE, + emu_wr(sc, EMU_HCFG, + EMU_HCFG_LOCKSOUNDCACHE | EMU_HCFG_LOCKTANKCACHE_MASK | EMU_HCFG_MUTEBUTTONENABLE, 4); /* reset recording buffers */ - emu_wrptr(sc, 0, MICBS, ADCBS_BUFSIZE_NONE); - emu_wrptr(sc, 0, MICBA, 0); - emu_wrptr(sc, 0, FXBS, ADCBS_BUFSIZE_NONE); - emu_wrptr(sc, 0, FXBA, 0); - emu_wrptr(sc, 0, ADCBS, ADCBS_BUFSIZE_NONE); - emu_wrptr(sc, 0, ADCBA, 0); + emu_wrptr(sc, 0, EMU_MICBS, EMU_RECBS_BUFSIZE_NONE); + emu_wrptr(sc, 0, EMU_MICBA, 0); + emu_wrptr(sc, 0, EMU_FXBS, EMU_RECBS_BUFSIZE_NONE); + emu_wrptr(sc, 0, EMU_FXBA, 0); + emu_wrptr(sc, 0, EMU_ADCBS, EMU_RECBS_BUFSIZE_NONE); + emu_wrptr(sc, 0, EMU_ADCBA, 0); /* disable channel interrupt */ - emu_wr(sc, INTE, - INTE_INTERVALTIMERENB | INTE_SAMPLERATETRACKER | INTE_PCIERRORENABLE, + emu_wr(sc, EMU_INTE, + EMU_INTE_INTERTIMERENB | EMU_INTE_SAMPLERATER | EMU_INTE_PCIERRENABLE, 4); - emu_wrptr(sc, 0, CLIEL, 0); - emu_wrptr(sc, 0, CLIEH, 0); - emu_wrptr(sc, 0, SOLEL, 0); - emu_wrptr(sc, 0, SOLEH, 0); + emu_wrptr(sc, 0, EMU_CLIEL, 0); + emu_wrptr(sc, 0, EMU_CLIEH, 0); + emu_wrptr(sc, 0, EMU_SOLEL, 0); + emu_wrptr(sc, 0, EMU_SOLEH, 0); /* wonder what these do... */ if (sc->audigy) { - emu_wrptr(sc, 0, SPBYPASS, 0xf00); - emu_wrptr(sc, 0, AC97SLOT, 0x3); + emu_wrptr(sc, 0, EMU_SPBYPASS, 0xf00); + emu_wrptr(sc, 0, EMU_AC97SLOT, 0x3); } /* init envelope engine */ for (ch = 0; ch < NUM_G; ch++) { - emu_wrptr(sc, ch, DCYSUSV, ENV_OFF); - emu_wrptr(sc, ch, IP, 0); - emu_wrptr(sc, ch, VTFT, 0xffff); - emu_wrptr(sc, ch, CVCF, 0xffff); - emu_wrptr(sc, ch, PTRX, 0); - emu_wrptr(sc, ch, CPF, 0); - emu_wrptr(sc, ch, CCR, 0); - - emu_wrptr(sc, ch, PSST, 0); - emu_wrptr(sc, ch, DSL, 0x10); - emu_wrptr(sc, ch, CCCA, 0); - emu_wrptr(sc, ch, Z1, 0); - emu_wrptr(sc, ch, Z2, 0); - emu_wrptr(sc, ch, FXRT, 0xd01c0000); - - emu_wrptr(sc, ch, ATKHLDM, 0); - emu_wrptr(sc, ch, DCYSUSM, 0); - emu_wrptr(sc, ch, IFATN, 0xffff); - emu_wrptr(sc, ch, PEFE, 0); - emu_wrptr(sc, ch, FMMOD, 0); - emu_wrptr(sc, ch, TREMFRQ, 24); /* 1 Hz */ - emu_wrptr(sc, ch, FM2FRQ2, 24); /* 1 Hz */ - emu_wrptr(sc, ch, TEMPENV, 0); + emu_wrptr(sc, ch, EMU_CHAN_DCYSUSV, ENV_OFF); + emu_wrptr(sc, ch, EMU_CHAN_IP, 0); + emu_wrptr(sc, ch, EMU_CHAN_VTFT, 0xffff); + emu_wrptr(sc, ch, EMU_CHAN_CVCF, 0xffff); + emu_wrptr(sc, ch, EMU_CHAN_PTRX, 0); + emu_wrptr(sc, ch, EMU_CHAN_CPF, 0); + emu_wrptr(sc, ch, EMU_CHAN_CCR, 0); + + emu_wrptr(sc, ch, EMU_CHAN_PSST, 0); + emu_wrptr(sc, ch, EMU_CHAN_DSL, 0x10); + emu_wrptr(sc, ch, EMU_CHAN_CCCA, 0); + emu_wrptr(sc, ch, EMU_CHAN_Z1, 0); + emu_wrptr(sc, ch, EMU_CHAN_Z2, 0); + emu_wrptr(sc, ch, EMU_CHAN_FXRT, 0xd01c0000); + + emu_wrptr(sc, ch, EMU_CHAN_ATKHLDM, 0); + emu_wrptr(sc, ch, EMU_CHAN_DCYSUSM, 0); + emu_wrptr(sc, ch, EMU_CHAN_IFATN, 0xffff); + emu_wrptr(sc, ch, EMU_CHAN_PEFE, 0); + emu_wrptr(sc, ch, EMU_CHAN_FMMOD, 0); + emu_wrptr(sc, ch, EMU_CHAN_TREMFRQ, 24); /* 1 Hz */ + emu_wrptr(sc, ch, EMU_CHAN_FM2FRQ2, 24); /* 1 Hz */ + emu_wrptr(sc, ch, EMU_CHAN_TEMPENV, 0); /*** these are last so OFF prevents writing ***/ - emu_wrptr(sc, ch, LFOVAL2, 0); - emu_wrptr(sc, ch, LFOVAL1, 0); - emu_wrptr(sc, ch, ATKHLDV, 0); - emu_wrptr(sc, ch, ENVVOL, 0); - emu_wrptr(sc, ch, ENVVAL, 0); + emu_wrptr(sc, ch, EMU_CHAN_LFOVAL2, 0); + emu_wrptr(sc, ch, EMU_CHAN_LFOVAL1, 0); + emu_wrptr(sc, ch, EMU_CHAN_ATKHLDV, 0); + emu_wrptr(sc, ch, EMU_CHAN_ENVVOL, 0); + emu_wrptr(sc, ch, EMU_CHAN_ENVVAL, 0); if (sc->audigy) { /* audigy cards need this to initialize correctly */ @@ -1736,9 +1818,9 @@ emu_init(struct sc_info *sc) emu_wrptr(sc, ch, 0x4e, 0); emu_wrptr(sc, ch, 0x4f, 0); /* set default routing */ - emu_wrptr(sc, ch, A_FXRT1, 0x03020100); - emu_wrptr(sc, ch, A_FXRT2, 0x3f3f3f3f); - emu_wrptr(sc, ch, A_SENDAMOUNTS, 0); + emu_wrptr(sc, ch, EMU_A_CHAN_FXRT1, 0x03020100); + emu_wrptr(sc, ch, EMU_A_CHAN_FXRT2, 0x3f3f3f3f); + emu_wrptr(sc, ch, EMU_A_CHAN_SENDAMOUNTS, 0); } sc->voice[ch].vnum = ch; @@ -1769,13 +1851,13 @@ emu_init(struct sc_info *sc) * AN = 0 (Audio data) * P = 0 (Consumer) */ - spcs = SPCS_CLKACCY_1000PPM | SPCS_SAMPLERATE_48 | - SPCS_CHANNELNUM_LEFT | SPCS_SOURCENUM_UNSPEC | - SPCS_GENERATIONSTATUS | 0x00001200 | 0x00000000 | - SPCS_EMPHASIS_NONE | SPCS_COPYRIGHT; - emu_wrptr(sc, 0, SPCS0, spcs); - emu_wrptr(sc, 0, SPCS1, spcs); - emu_wrptr(sc, 0, SPCS2, spcs); + spcs = EMU_SPCS_CLKACCY_1000PPM | EMU_SPCS_SAMPLERATE_48 | + EMU_SPCS_CHANNELNUM_LEFT | EMU_SPCS_SOURCENUM_UNSPEC | + EMU_SPCS_GENERATIONSTATUS | 0x00001200 | 0x00000000 | + EMU_SPCS_EMPHASIS_NONE | EMU_SPCS_COPYRIGHT; + emu_wrptr(sc, 0, EMU_SPCS0, spcs); + emu_wrptr(sc, 0, EMU_SPCS1, spcs); + emu_wrptr(sc, 0, EMU_SPCS2, spcs); if (!sc->audigy) emu_initefx(sc); @@ -1786,8 +1868,8 @@ emu_init(struct sc_info *sc) u_int32_t tmp; /* Setup SRCMulti_I2S SamplingRate */ - tmp = emu_rdptr(sc, 0, A_SPDIF_SAMPLERATE) & 0xfffff1ff; - emu_wrptr(sc, 0, A_SPDIF_SAMPLERATE, tmp | 0x400); + tmp = emu_rdptr(sc, 0, EMU_A_SPDIF_SAMPLERATE) & 0xfffff1ff; + emu_wrptr(sc, 0, EMU_A_SPDIF_SAMPLERATE, tmp | 0x400); /* Setup SRCSel (Enable SPDIF, I2S SRCMulti) */ emu_wr(sc, 0x20, 0x00600000, 4); @@ -1816,13 +1898,13 @@ emu_init(struct sc_info *sc) for (i = 0; i < EMUMAXPAGES; i++) sc->mem.ptb_pages[i] = tmp | i; - emu_wrptr(sc, 0, PTB, (sc->mem.ptb_pages_addr)); - emu_wrptr(sc, 0, TCB, 0); /* taken from original driver */ - emu_wrptr(sc, 0, TCBS, 0); /* taken from original driver */ + emu_wrptr(sc, 0, EMU_PTB, (sc->mem.ptb_pages_addr)); + emu_wrptr(sc, 0, EMU_TCB, 0); /* taken from original driver */ + emu_wrptr(sc, 0, EMU_TCBS, 0); /* taken from original driver */ for (ch = 0; ch < NUM_G; ch++) { - emu_wrptr(sc, ch, MAPA, tmp | MAP_PTI_MASK); - emu_wrptr(sc, ch, MAPB, tmp | MAP_PTI_MASK); + emu_wrptr(sc, ch, EMU_CHAN_MAPA, tmp | EMU_CHAN_MAP_PTI_MASK); + emu_wrptr(sc, ch, EMU_CHAN_MAPB, tmp | EMU_CHAN_MAP_PTI_MASK); } /* emu_memalloc(sc, EMUPAGESIZE); */ @@ -1850,19 +1932,19 @@ emu_init(struct sc_info *sc) */ if (sc->audigy) { - tmp = HCFG_AUTOMUTE | HCFG_JOYENABLE; + tmp = EMU_HCFG_AUTOMUTE | EMU_HCFG_JOYENABLE; if (sc->audigy2) /* Audigy 2 */ - tmp = HCFG_AUDIOENABLE | HCFG_AC3ENABLE_CDSPDIF | - HCFG_AC3ENABLE_GPSPDIF; - emu_wr(sc, HCFG, tmp, 4); + tmp = EMU_HCFG_AUDIOENABLE | EMU_HCFG_AC3ENABLE_CDSPDIF | + EMU_HCFG_AC3ENABLE_GPSPDIF; + emu_wr(sc, EMU_HCFG, tmp, 4); audigy_initefx(sc); /* from ALSA initialization code: */ /* enable audio and disable both audio/digital outputs */ - emu_wr(sc, HCFG, emu_rd(sc, HCFG, 4) | HCFG_AUDIOENABLE, 4); - emu_wr(sc, A_IOCFG, emu_rd(sc, A_IOCFG, 4) & ~A_IOCFG_GPOUT_AD, + emu_wr(sc, EMU_HCFG, emu_rd(sc, EMU_HCFG, 4) | EMU_HCFG_AUDIOENABLE, 4); + emu_wr(sc, EMU_A_IOCFG, emu_rd(sc, EMU_A_IOCFG, 4) & ~EMU_A_IOCFG_GPOUT_AD, 4); if (sc->audigy2) { /* Audigy 2 */ /* Unmute Analog. @@ -1870,27 +1952,27 @@ emu_init(struct sc_info *sc) * init Alice3 I2SOut beyond 48kHz. * So, sequence is important. */ - emu_wr(sc, A_IOCFG, - emu_rd(sc, A_IOCFG, 4) | A_IOCFG_GPOUT_A, 4); + emu_wr(sc, EMU_A_IOCFG, + emu_rd(sc, EMU_A_IOCFG, 4) | EMU_A_IOCFG_GPOUT_A, 4); } } else { /* EMU10K1 initialization code */ - tmp = HCFG_AUDIOENABLE | HCFG_LOCKTANKCACHE_MASK - | HCFG_AUTOMUTE; + tmp = EMU_HCFG_AUDIOENABLE | EMU_HCFG_LOCKTANKCACHE_MASK + | EMU_HCFG_AUTOMUTE; if (sc->rev >= 6) - tmp |= HCFG_JOYENABLE; + tmp |= EMU_HCFG_JOYENABLE; - emu_wr(sc, HCFG, tmp, 4); + emu_wr(sc, EMU_HCFG, tmp, 4); /* TOSLink detection */ sc->tos_link = 0; - tmp = emu_rd(sc, HCFG, 4); - if (tmp & (HCFG_GPINPUT0 | HCFG_GPINPUT1)) { - emu_wr(sc, HCFG, tmp | HCFG_GPOUT1, 4); + tmp = emu_rd(sc, EMU_HCFG, 4); + if (tmp & (EMU_HCFG_GPINPUT0 | EMU_HCFG_GPINPUT1)) { + emu_wr(sc, EMU_HCFG, tmp | EMU_HCFG_GPOUT1, 4); DELAY(50); - if (tmp != (emu_rd(sc, HCFG, 4) & ~HCFG_GPOUT1)) { + if (tmp != (emu_rd(sc, EMU_HCFG, 4) & ~EMU_HCFG_GPOUT1)) { sc->tos_link = 1; - emu_wr(sc, HCFG, tmp, 4); + emu_wr(sc, EMU_HCFG, tmp, 4); } } } @@ -1903,42 +1985,42 @@ emu_uninit(struct sc_info *sc) { u_int32_t ch; - emu_wr(sc, INTE, 0, 4); + emu_wr(sc, EMU_INTE, 0, 4); for (ch = 0; ch < NUM_G; ch++) - emu_wrptr(sc, ch, DCYSUSV, ENV_OFF); + emu_wrptr(sc, ch, EMU_CHAN_DCYSUSV, ENV_OFF); for (ch = 0; ch < NUM_G; ch++) { - emu_wrptr(sc, ch, VTFT, 0); - emu_wrptr(sc, ch, CVCF, 0); - emu_wrptr(sc, ch, PTRX, 0); - emu_wrptr(sc, ch, CPF, 0); + emu_wrptr(sc, ch, EMU_CHAN_VTFT, 0); + emu_wrptr(sc, ch, EMU_CHAN_CVCF, 0); + emu_wrptr(sc, ch, EMU_CHAN_PTRX, 0); + emu_wrptr(sc, ch, EMU_CHAN_CPF, 0); } if (sc->audigy) { /* stop fx processor */ - emu_wrptr(sc, 0, A_DBG, A_DBG_SINGLE_STEP); + emu_wrptr(sc, 0, EMU_A_DBG, EMU_A_DBG_SINGLE_STEP); } /* disable audio and lock cache */ - emu_wr(sc, HCFG, - HCFG_LOCKSOUNDCACHE | HCFG_LOCKTANKCACHE_MASK | HCFG_MUTEBUTTONENABLE, + emu_wr(sc, EMU_HCFG, + EMU_HCFG_LOCKSOUNDCACHE | EMU_HCFG_LOCKTANKCACHE_MASK | EMU_HCFG_MUTEBUTTONENABLE, 4); - emu_wrptr(sc, 0, PTB, 0); + emu_wrptr(sc, 0, EMU_PTB, 0); /* reset recording buffers */ - emu_wrptr(sc, 0, MICBS, ADCBS_BUFSIZE_NONE); - emu_wrptr(sc, 0, MICBA, 0); - emu_wrptr(sc, 0, FXBS, ADCBS_BUFSIZE_NONE); - emu_wrptr(sc, 0, FXBA, 0); - emu_wrptr(sc, 0, FXWC, 0); - emu_wrptr(sc, 0, ADCBS, ADCBS_BUFSIZE_NONE); - emu_wrptr(sc, 0, ADCBA, 0); - emu_wrptr(sc, 0, TCB, 0); - emu_wrptr(sc, 0, TCBS, 0); + emu_wrptr(sc, 0, EMU_MICBS, EMU_RECBS_BUFSIZE_NONE); + emu_wrptr(sc, 0, EMU_MICBA, 0); + emu_wrptr(sc, 0, EMU_FXBS, EMU_RECBS_BUFSIZE_NONE); + emu_wrptr(sc, 0, EMU_FXBA, 0); + emu_wrptr(sc, 0, EMU_FXWC, 0); + emu_wrptr(sc, 0, EMU_ADCBS, EMU_RECBS_BUFSIZE_NONE); + emu_wrptr(sc, 0, EMU_ADCBA, 0); + emu_wrptr(sc, 0, EMU_TCB, 0); + emu_wrptr(sc, 0, EMU_TCBS, 0); /* disable channel interrupt */ - emu_wrptr(sc, 0, CLIEL, 0); - emu_wrptr(sc, 0, CLIEH, 0); - emu_wrptr(sc, 0, SOLEL, 0); - emu_wrptr(sc, 0, SOLEH, 0); + emu_wrptr(sc, 0, EMU_CLIEL, 0); + emu_wrptr(sc, 0, EMU_CLIEH, 0); + emu_wrptr(sc, 0, EMU_SOLEL, 0); + emu_wrptr(sc, 0, EMU_SOLEH, 0); /* init envelope engine */ if (!SLIST_EMPTY(&sc->mem.blocks)) @@ -1997,7 +2079,7 @@ emu_pci_attach(device_t dev) sc->audigy = sc->type == EMU10K2_PCI_ID || sc->type == EMU10K3_PCI_ID; sc->audigy2 = (sc->audigy && sc->rev == 0x04); sc->nchans = sc->audigy ? 8 : 4; - sc->addrmask = sc->audigy ? A_PTR_ADDRESS_MASK : PTR_ADDRESS_MASK; + sc->addrmask = sc->audigy ? EMU_A_PTR_ADDR_MASK : EMU_PTR_ADDR_MASK; data = pci_read_config(dev, PCIR_COMMAND, 2); data |= (PCIM_CMD_PORTEN | PCIM_CMD_BUSMASTEREN); Added: head/sys/dev/sound/pci/emuxkireg.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/sound/pci/emuxkireg.h Tue Jan 3 21:04:54 2012 (r229430) @@ -0,0 +1,689 @@ +/* $FreeBSD$ */ +/* $NetBSD: emuxkireg.h,v 1.8 2008/04/28 20:23:54 martin Exp $ */ + +/*- + * Copyright (c) 2001 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Yannick Montulet. + * + * 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 THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``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 THE FOUNDATION 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. + */ + +#ifndef _DEV_PCI_EMUXKIREG_H_ +#define _DEV_PCI_EMUXKIREG_H_ + +/* + * Register values for Creative EMU10000. The register values have been + * taken from GPLed SBLive! header file published by Creative. The comments + * have been stripped to avoid GPL pollution in kernel. The Creative version + * including comments is available in Linux 2.4.* kernel as file + * drivers/sound/emu10k1/8010.h + */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 21:09:08 2012 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 0D7491065672; Tue, 3 Jan 2012 21:09:08 +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 D65F28FC1B; Tue, 3 Jan 2012 21:09: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 q03L97PN043349; Tue, 3 Jan 2012 21:09:07 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03L97Mv043345; Tue, 3 Jan 2012 21:09:07 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201032109.q03L97Mv043345@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 3 Jan 2012 21:09: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: r229431 - head/sys/fs/nullfs 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, 03 Jan 2012 21:09:08 -0000 Author: kib Date: Tue Jan 3 21:09:07 2012 New Revision: 229431 URL: http://svn.freebsd.org/changeset/base/229431 Log: Do the vput() for the lowervp in the null_nodeget() for error case too. Several callers of null_nodeget() did the cleanup itself, but several missed it, most prominent being null_bypass(). Remove the cleanup from the callers, now null_nodeget() handles lowervp free itself. Reported and tested by: pho MFC after: 1 week Modified: head/sys/fs/nullfs/null_subr.c head/sys/fs/nullfs/null_vfsops.c head/sys/fs/nullfs/null_vnops.c Modified: head/sys/fs/nullfs/null_subr.c ============================================================================== --- head/sys/fs/nullfs/null_subr.c Tue Jan 3 21:04:54 2012 (r229430) +++ head/sys/fs/nullfs/null_subr.c Tue Jan 3 21:09:07 2012 (r229431) @@ -171,6 +171,8 @@ null_hashins(mp, xp) static void null_insmntque_dtr(struct vnode *vp, void *xp) { + + vput(((struct null_node *)xp)->null_lowervp); vp->v_data = NULL; vp->v_vnlock = &vp->v_lock; free(xp, M_NULLFSNODE); @@ -226,6 +228,7 @@ null_nodeget(mp, lowervp, vpp) error = getnewvnode("null", mp, &null_vnodeops, &vp); if (error) { + vput(lowervp); free(xp, M_NULLFSNODE); return (error); } Modified: head/sys/fs/nullfs/null_vfsops.c ============================================================================== --- head/sys/fs/nullfs/null_vfsops.c Tue Jan 3 21:04:54 2012 (r229430) +++ head/sys/fs/nullfs/null_vfsops.c Tue Jan 3 21:09:07 2012 (r229431) @@ -157,8 +157,7 @@ nullfs_mount(struct mount *mp) * Make sure the node alias worked */ if (error) { - vrele(lowerrootvp); - free(xmp, M_NULLFSMNT); /* XXX */ + free(xmp, M_NULLFSMNT); return (error); } Modified: head/sys/fs/nullfs/null_vnops.c ============================================================================== --- head/sys/fs/nullfs/null_vnops.c Tue Jan 3 21:04:54 2012 (r229430) +++ head/sys/fs/nullfs/null_vnops.c Tue Jan 3 21:09:07 2012 (r229431) @@ -365,9 +365,7 @@ null_lookup(struct vop_lookup_args *ap) vrele(lvp); } else { error = null_nodeget(dvp->v_mount, lvp, &vp); - if (error) - vput(lvp); - else + if (error == 0) *ap->a_vpp = vp; } } @@ -809,9 +807,7 @@ null_vptocnp(struct vop_vptocnp_args *ap NULLVPTOLOWERVP(*dvp); #endif VOP_UNLOCK(*dvp, 0); /* keep reference on *dvp */ - } else - vput(ldvp); - + } vn_lock(vp, locked | LK_RETRY); return (error); } From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 21:16:01 2012 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 40B96106564A; Tue, 3 Jan 2012 21:16:01 +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 2DB3B8FC18; Tue, 3 Jan 2012 21:16: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 q03LG1UZ043664; Tue, 3 Jan 2012 21:16:01 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03LG1Vk043659; Tue, 3 Jan 2012 21:16:01 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201032116.q03LG1Vk043659@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 21:16:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229432 - in stable/9/sys: conf dev/ti 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, 03 Jan 2012 21:16:01 -0000 Author: yongari Date: Tue Jan 3 21:16:00 2012 New Revision: 229432 URL: http://svn.freebsd.org/changeset/base/229432 Log: MFC r227347,227367: r227347: Retire 'options TI_PRIVATE_JUMBOS' and replace local jumbo allocator with UMA backed jumbo allocator by default. Previously ti(4) used sf_buf(9) interface for jumbo buffers but it was broken at this moment such that enabling jumbo frame caused instant panic. Due to the nature of sf_buf(9) it heavily relies on VM changes but it seems ti(4) was not received much blessing from VM gurus. I don't understand VM magic and implications used in driver either. Switching to UMA backed jumbo allocator like other network drivers will make jumbo frame work on ti(4). While I'm here, fully allocate all RX buffers. This means ti(4) now uses 512 RX buffer and 1024 mini RX buffers. To use sf_buf(9) interface for jumbo buffers, introduce a new 'options TI_SF_BUF_JUMBO'. If it is proven that sf_buf(9) is better for jumbo buffers, interesting developers can fix the issue in future. ti(4) still needs more bus_dma(9) cleanups and should use separate DMA tag/map for each ring(standard, jumbo, mini, command, event etc) but it should work on all platforms except PAE. Special thanks to Jay[1] who provided complete remote debugging access. r227367: Comment out TI_JUMBO_HDRSPLIT. TI_JUMBO_HDRSPLIT requires TI_SF_BUF_JUMBO. Modified: stable/9/sys/conf/NOTES stable/9/sys/conf/options stable/9/sys/dev/ti/if_ti.c stable/9/sys/dev/ti/if_tireg.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/conf/NOTES ============================================================================== --- stable/9/sys/conf/NOTES Tue Jan 3 21:09:07 2012 (r229431) +++ stable/9/sys/conf/NOTES Tue Jan 3 21:16:00 2012 (r229432) @@ -2138,12 +2138,12 @@ device malo # Marvell Libertas wireles device mwl # Marvell 88W8363 802.11n wireless NICs. device ral # Ralink Technology RT2500 wireless NICs. -# Use "private" jumbo buffers allocated exclusively for the ti(4) driver. -# This option is incompatible with the TI_JUMBO_HDRSPLIT option below. -#options TI_PRIVATE_JUMBOS +# Use sf_buf(9) interface for jumbo buffers on ti(4) controllers. +#options TI_SF_BUF_JUMBO # Turn on the header splitting option for the ti(4) driver firmware. This # only works for Tigon II chips, and has no effect for Tigon I chips. -options TI_JUMBO_HDRSPLIT +# This option requires the TI_SF_BUF_JUMBO option above. +#options TI_JUMBO_HDRSPLIT # # Use header splitting feature on bce(4) adapters. Modified: stable/9/sys/conf/options ============================================================================== --- stable/9/sys/conf/options Tue Jan 3 21:09:07 2012 (r229431) +++ stable/9/sys/conf/options Tue Jan 3 21:16:00 2012 (r229432) @@ -524,7 +524,7 @@ NGATM_CCATM opt_netgraph.h DRM_DEBUG opt_drm.h ZERO_COPY_SOCKETS opt_zero.h -TI_PRIVATE_JUMBOS opt_ti.h +TI_SF_BUF_JUMBO opt_ti.h TI_JUMBO_HDRSPLIT opt_ti.h BCE_JUMBO_HDRSPLIT opt_bce.h Modified: stable/9/sys/dev/ti/if_ti.c ============================================================================== --- stable/9/sys/dev/ti/if_ti.c Tue Jan 3 21:09:07 2012 (r229431) +++ stable/9/sys/dev/ti/if_ti.c Tue Jan 3 21:16:00 2012 (r229432) @@ -112,8 +112,7 @@ __FBSDID("$FreeBSD$"); #include #include -/* #define TI_PRIVATE_JUMBOS */ -#ifndef TI_PRIVATE_JUMBOS +#ifdef TI_SF_BUF_JUMBO #include #include #endif @@ -131,9 +130,9 @@ __FBSDID("$FreeBSD$"); * We can only turn on header splitting if we're using extended receive * BDs. */ -#if defined(TI_JUMBO_HDRSPLIT) && defined(TI_PRIVATE_JUMBOS) -#error "options TI_JUMBO_HDRSPLIT and TI_PRIVATE_JUMBOS are mutually exclusive" -#endif /* TI_JUMBO_HDRSPLIT && TI_JUMBO_HDRSPLIT */ +#if defined(TI_JUMBO_HDRSPLIT) && !defined(TI_SF_BUF_JUMBO) +#error "options TI_JUMBO_HDRSPLIT requires TI_SF_BUF_JUMBO" +#endif /* TI_JUMBO_HDRSPLIT && !TI_SF_BUF_JUMBO */ typedef enum { TI_SWAP_HTON, @@ -222,12 +221,8 @@ static void ti_handle_events(struct ti_s static int ti_alloc_dmamaps(struct ti_softc *); static void ti_free_dmamaps(struct ti_softc *); static int ti_alloc_jumbo_mem(struct ti_softc *); -#ifdef TI_PRIVATE_JUMBOS -static void *ti_jalloc(struct ti_softc *); -static void ti_jfree(void *, void *); -#endif /* TI_PRIVATE_JUMBOS */ -static int ti_newbuf_std(struct ti_softc *, int, struct mbuf *); -static int ti_newbuf_mini(struct ti_softc *, int, struct mbuf *); +static int ti_newbuf_std(struct ti_softc *, int); +static int ti_newbuf_mini(struct ti_softc *, int); static int ti_newbuf_jumbo(struct ti_softc *, int, struct mbuf *); static int ti_init_rx_ring_std(struct ti_softc *); static void ti_free_rx_ring_std(struct ti_softc *); @@ -237,6 +232,11 @@ static int ti_init_rx_ring_mini(struct t static void ti_free_rx_ring_mini(struct ti_softc *); static void ti_free_tx_ring(struct ti_softc *); static int ti_init_tx_ring(struct ti_softc *); +static void ti_discard_std(struct ti_softc *, int); +#ifndef TI_SF_BUF_JUMBO +static void ti_discard_jumbo(struct ti_softc *, int); +#endif +static void ti_discard_mini(struct ti_softc *, int); static int ti_64bitslot_war(struct ti_softc *); static int ti_chipinit(struct ti_softc *); @@ -982,21 +982,42 @@ ti_alloc_dmamaps(struct ti_softc *sc) for (i = 0; i < TI_TX_RING_CNT; i++) { sc->ti_cdata.ti_txdesc[i].tx_m = NULL; - sc->ti_cdata.ti_txdesc[i].tx_dmamap = 0; + sc->ti_cdata.ti_txdesc[i].tx_dmamap = NULL; if (bus_dmamap_create(sc->ti_mbuftx_dmat, 0, - &sc->ti_cdata.ti_txdesc[i].tx_dmamap)) + &sc->ti_cdata.ti_txdesc[i].tx_dmamap)) { + device_printf(sc->ti_dev, + "cannot create DMA map for TX\n"); return (ENOBUFS); + } } for (i = 0; i < TI_STD_RX_RING_CNT; i++) { if (bus_dmamap_create(sc->ti_mbufrx_dmat, 0, - &sc->ti_cdata.ti_rx_std_maps[i])) + &sc->ti_cdata.ti_rx_std_maps[i])) { + device_printf(sc->ti_dev, + "cannot create DMA map for RX\n"); return (ENOBUFS); + } + } + if (bus_dmamap_create(sc->ti_mbufrx_dmat, 0, + &sc->ti_cdata.ti_rx_std_sparemap)) { + device_printf(sc->ti_dev, + "cannot create spare DMA map for RX\n"); + return (ENOBUFS); } for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) { if (bus_dmamap_create(sc->ti_jumbo_dmat, 0, - &sc->ti_cdata.ti_rx_jumbo_maps[i])) + &sc->ti_cdata.ti_rx_jumbo_maps[i])) { + device_printf(sc->ti_dev, + "cannot create DMA map for jumbo RX\n"); return (ENOBUFS); + } + } + if (bus_dmamap_create(sc->ti_jumbo_dmat, 0, + &sc->ti_cdata.ti_rx_jumbo_sparemap)) { + device_printf(sc->ti_dev, + "cannot create spare DMA map for jumbo RX\n"); + return (ENOBUFS); } /* Mini ring is not available on Tigon 1. */ @@ -1005,8 +1026,17 @@ ti_alloc_dmamaps(struct ti_softc *sc) for (i = 0; i < TI_MINI_RX_RING_CNT; i++) { if (bus_dmamap_create(sc->ti_mbufrx_dmat, 0, - &sc->ti_cdata.ti_rx_mini_maps[i])) + &sc->ti_cdata.ti_rx_mini_maps[i])) { + device_printf(sc->ti_dev, + "cannot create DMA map for mini RX\n"); return (ENOBUFS); + } + } + if (bus_dmamap_create(sc->ti_mbufrx_dmat, 0, + &sc->ti_cdata.ti_rx_mini_sparemap)) { + device_printf(sc->ti_dev, + "cannot create DMA map for mini RX\n"); + return (ENOBUFS); } return (0); @@ -1017,173 +1047,77 @@ ti_free_dmamaps(struct ti_softc *sc) { int i; - if (sc->ti_mbuftx_dmat) - for (i = 0; i < TI_TX_RING_CNT; i++) + if (sc->ti_mbuftx_dmat) { + for (i = 0; i < TI_TX_RING_CNT; i++) { if (sc->ti_cdata.ti_txdesc[i].tx_dmamap) { bus_dmamap_destroy(sc->ti_mbuftx_dmat, sc->ti_cdata.ti_txdesc[i].tx_dmamap); - sc->ti_cdata.ti_txdesc[i].tx_dmamap = 0; + sc->ti_cdata.ti_txdesc[i].tx_dmamap = NULL; } + } + } - if (sc->ti_mbufrx_dmat) - for (i = 0; i < TI_STD_RX_RING_CNT; i++) + if (sc->ti_mbufrx_dmat) { + for (i = 0; i < TI_STD_RX_RING_CNT; i++) { if (sc->ti_cdata.ti_rx_std_maps[i]) { bus_dmamap_destroy(sc->ti_mbufrx_dmat, sc->ti_cdata.ti_rx_std_maps[i]); - sc->ti_cdata.ti_rx_std_maps[i] = 0; + sc->ti_cdata.ti_rx_std_maps[i] = NULL; } + } + if (sc->ti_cdata.ti_rx_std_sparemap) { + bus_dmamap_destroy(sc->ti_mbufrx_dmat, + sc->ti_cdata.ti_rx_std_sparemap); + sc->ti_cdata.ti_rx_std_sparemap = NULL; + } + } - if (sc->ti_jumbo_dmat) - for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) + if (sc->ti_jumbo_dmat) { + for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) { if (sc->ti_cdata.ti_rx_jumbo_maps[i]) { bus_dmamap_destroy(sc->ti_jumbo_dmat, sc->ti_cdata.ti_rx_jumbo_maps[i]); - sc->ti_cdata.ti_rx_jumbo_maps[i] = 0; + sc->ti_cdata.ti_rx_jumbo_maps[i] = NULL; } - if (sc->ti_mbufrx_dmat) - for (i = 0; i < TI_MINI_RX_RING_CNT; i++) + } + if (sc->ti_cdata.ti_rx_jumbo_sparemap) { + bus_dmamap_destroy(sc->ti_jumbo_dmat, + sc->ti_cdata.ti_rx_jumbo_sparemap); + sc->ti_cdata.ti_rx_jumbo_sparemap = NULL; + } + } + + if (sc->ti_mbufrx_dmat) { + for (i = 0; i < TI_MINI_RX_RING_CNT; i++) { if (sc->ti_cdata.ti_rx_mini_maps[i]) { bus_dmamap_destroy(sc->ti_mbufrx_dmat, sc->ti_cdata.ti_rx_mini_maps[i]); - sc->ti_cdata.ti_rx_mini_maps[i] = 0; + sc->ti_cdata.ti_rx_mini_maps[i] = NULL; } + } + if (sc->ti_cdata.ti_rx_mini_sparemap) { + bus_dmamap_destroy(sc->ti_mbufrx_dmat, + sc->ti_cdata.ti_rx_mini_sparemap); + sc->ti_cdata.ti_rx_mini_sparemap = NULL; + } + } } -#ifdef TI_PRIVATE_JUMBOS - -/* - * Memory management for the jumbo receive ring is a pain in the - * butt. We need to allocate at least 9018 bytes of space per frame, - * _and_ it has to be contiguous (unless you use the extended - * jumbo descriptor format). Using malloc() all the time won't - * work: malloc() allocates memory in powers of two, which means we - * would end up wasting a considerable amount of space by allocating - * 9K chunks. We don't have a jumbo mbuf cluster pool. Thus, we have - * to do our own memory management. - * - * The driver needs to allocate a contiguous chunk of memory at boot - * time. We then chop this up ourselves into 9K pieces and use them - * as external mbuf storage. - * - * One issue here is how much memory to allocate. The jumbo ring has - * 256 slots in it, but at 9K per slot than can consume over 2MB of - * RAM. This is a bit much, especially considering we also need - * RAM for the standard ring and mini ring (on the Tigon 2). To - * save space, we only actually allocate enough memory for 64 slots - * by default, which works out to between 500 and 600K. This can - * be tuned by changing a #define in if_tireg.h. - */ +#ifndef TI_SF_BUF_JUMBO static int ti_alloc_jumbo_mem(struct ti_softc *sc) { - struct ti_jpool_entry *entry; - caddr_t ptr; - int i; - /* - * Grab a big chunk o' storage. Since we are chopping this pool up - * into ~9k chunks, there doesn't appear to be a need to use page - * alignment. - */ - if (bus_dma_tag_create(sc->ti_parent_dmat, /* parent */ - 1, 0, /* algnmnt, boundary */ - BUS_SPACE_MAXADDR, /* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - TI_JMEM, /* maxsize */ - 1, /* nsegments */ - TI_JMEM, /* maxsegsize */ - 0, /* flags */ - NULL, NULL, /* lockfunc, lockarg */ - &sc->ti_jumbo_dmat) != 0) { + if (bus_dma_tag_create(sc->ti_parent_dmat, 1, 0, BUS_SPACE_MAXADDR, + BUS_SPACE_MAXADDR, NULL, NULL, MJUM9BYTES, 1, MJUM9BYTES, 0, NULL, + NULL, &sc->ti_jumbo_dmat) != 0) { device_printf(sc->ti_dev, "Failed to allocate jumbo dmat\n"); - return (ENOBUFS); + return (ENOBUFS); } - - if (bus_dmamem_alloc(sc->ti_jumbo_dmat, - (void**)&sc->ti_cdata.ti_jumbo_buf, - BUS_DMA_NOWAIT | BUS_DMA_COHERENT, - &sc->ti_jumbo_dmamap) != 0) { - device_printf(sc->ti_dev, "Failed to allocate jumbo memory\n"); - return (ENOBUFS); - } - - SLIST_INIT(&sc->ti_jfree_listhead); - SLIST_INIT(&sc->ti_jinuse_listhead); - - /* - * Now divide it up into 9K pieces and save the addresses - * in an array. - */ - ptr = sc->ti_cdata.ti_jumbo_buf; - for (i = 0; i < TI_JSLOTS; i++) { - sc->ti_cdata.ti_jslots[i] = ptr; - ptr += TI_JLEN; - entry = malloc(sizeof(struct ti_jpool_entry), - M_DEVBUF, M_NOWAIT); - if (entry == NULL) { - device_printf(sc->ti_dev, "no memory for jumbo " - "buffer queue!\n"); - return (ENOBUFS); - } - entry->slot = i; - SLIST_INSERT_HEAD(&sc->ti_jfree_listhead, entry, jpool_entries); - } - return (0); } -/* - * Allocate a jumbo buffer. - */ -static void *ti_jalloc(struct ti_softc *sc) -{ - struct ti_jpool_entry *entry; - - entry = SLIST_FIRST(&sc->ti_jfree_listhead); - - if (entry == NULL) { - device_printf(sc->ti_dev, "no free jumbo buffers\n"); - return (NULL); - } - - SLIST_REMOVE_HEAD(&sc->ti_jfree_listhead, jpool_entries); - SLIST_INSERT_HEAD(&sc->ti_jinuse_listhead, entry, jpool_entries); - return (sc->ti_cdata.ti_jslots[entry->slot]); -} - -/* - * Release a jumbo buffer. - */ -static void -ti_jfree(void *buf, void *args) -{ - struct ti_softc *sc; - int i; - struct ti_jpool_entry *entry; - - /* Extract the softc struct pointer. */ - sc = (struct ti_softc *)args; - - if (sc == NULL) - panic("ti_jfree: didn't get softc pointer!"); - - /* calculate the slot this buffer belongs to */ - i = ((vm_offset_t)buf - - (vm_offset_t)sc->ti_cdata.ti_jumbo_buf) / TI_JLEN; - - if ((i < 0) || (i >= TI_JSLOTS)) - panic("ti_jfree: asked to free buffer that we don't manage!"); - - entry = SLIST_FIRST(&sc->ti_jinuse_listhead); - if (entry == NULL) - panic("ti_jfree: buffer not in use!"); - entry->slot = i; - SLIST_REMOVE_HEAD(&sc->ti_jinuse_listhead, jpool_entries); - SLIST_INSERT_HEAD(&sc->ti_jfree_listhead, entry, jpool_entries); -} - #else static int @@ -1212,56 +1146,59 @@ ti_alloc_jumbo_mem(struct ti_softc *sc) return (0); } -#endif /* TI_PRIVATE_JUMBOS */ +#endif /* TI_SF_BUF_JUMBO */ /* * Intialize a standard receive ring descriptor. */ static int -ti_newbuf_std(struct ti_softc *sc, int i, struct mbuf *m) +ti_newbuf_std(struct ti_softc *sc, int i) { bus_dmamap_t map; - bus_dma_segment_t segs; - struct mbuf *m_new = NULL; + bus_dma_segment_t segs[1]; + struct mbuf *m; struct ti_rx_desc *r; - int nsegs; + int error, nsegs; - nsegs = 0; - if (m == NULL) { - MGETHDR(m_new, M_DONTWAIT, MT_DATA); - if (m_new == NULL) - return (ENOBUFS); + m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + if (m == NULL) + return (ENOBUFS); + m->m_len = m->m_pkthdr.len = MCLBYTES; + m_adj(m, ETHER_ALIGN); - MCLGET(m_new, M_DONTWAIT); - if (!(m_new->m_flags & M_EXT)) { - m_freem(m_new); - return (ENOBUFS); - } - m_new->m_len = m_new->m_pkthdr.len = MCLBYTES; - } else { - m_new = m; - m_new->m_len = m_new->m_pkthdr.len = MCLBYTES; - m_new->m_data = m_new->m_ext.ext_buf; + error = bus_dmamap_load_mbuf_sg(sc->ti_mbufrx_dmat, + sc->ti_cdata.ti_rx_std_sparemap, m, segs, &nsegs, 0); + if (error != 0) { + m_freem(m); + return (error); + } + KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); + + if (sc->ti_cdata.ti_rx_std_chain[i] != NULL) { + bus_dmamap_sync(sc->ti_mbufrx_dmat, + sc->ti_cdata.ti_rx_std_maps[i], BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->ti_mbufrx_dmat, + sc->ti_cdata.ti_rx_std_maps[i]); } - m_adj(m_new, ETHER_ALIGN); - sc->ti_cdata.ti_rx_std_chain[i] = m_new; - r = &sc->ti_rdata->ti_rx_std_ring[i]; map = sc->ti_cdata.ti_rx_std_maps[i]; - if (bus_dmamap_load_mbuf_sg(sc->ti_mbufrx_dmat, map, m_new, &segs, - &nsegs, 0)) - return (ENOBUFS); - if (nsegs != 1) - return (ENOBUFS); - ti_hostaddr64(&r->ti_addr, segs.ds_addr); - r->ti_len = segs.ds_len; + sc->ti_cdata.ti_rx_std_maps[i] = sc->ti_cdata.ti_rx_std_sparemap; + sc->ti_cdata.ti_rx_std_sparemap = map; + sc->ti_cdata.ti_rx_std_chain[i] = m; + + r = &sc->ti_rdata->ti_rx_std_ring[i]; + ti_hostaddr64(&r->ti_addr, segs[0].ds_addr); + r->ti_len = segs[0].ds_len; r->ti_type = TI_BDTYPE_RECV_BD; r->ti_flags = 0; + r->ti_vlan_tag = 0; + r->ti_tcp_udp_cksum = 0; if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; r->ti_idx = i; - bus_dmamap_sync(sc->ti_mbufrx_dmat, map, BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->ti_mbufrx_dmat, sc->ti_cdata.ti_rx_std_maps[i], + BUS_DMASYNC_PREREAD); return (0); } @@ -1270,111 +1207,112 @@ ti_newbuf_std(struct ti_softc *sc, int i * the Tigon 2. */ static int -ti_newbuf_mini(struct ti_softc *sc, int i, struct mbuf *m) +ti_newbuf_mini(struct ti_softc *sc, int i) { - bus_dma_segment_t segs; bus_dmamap_t map; - struct mbuf *m_new = NULL; + bus_dma_segment_t segs[1]; + struct mbuf *m; struct ti_rx_desc *r; - int nsegs; + int error, nsegs; - nsegs = 0; - if (m == NULL) { - MGETHDR(m_new, M_DONTWAIT, MT_DATA); - if (m_new == NULL) { - return (ENOBUFS); - } - m_new->m_len = m_new->m_pkthdr.len = MHLEN; - } else { - m_new = m; - m_new->m_data = m_new->m_pktdat; - m_new->m_len = m_new->m_pkthdr.len = MHLEN; + MGETHDR(m, M_DONTWAIT, MT_DATA); + if (m == NULL) + return (ENOBUFS); + m->m_len = m->m_pkthdr.len = MHLEN; + m_adj(m, ETHER_ALIGN); + + error = bus_dmamap_load_mbuf_sg(sc->ti_mbufrx_dmat, + sc->ti_cdata.ti_rx_mini_sparemap, m, segs, &nsegs, 0); + if (error != 0) { + m_freem(m); + return (error); + } + KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); + + if (sc->ti_cdata.ti_rx_mini_chain[i] != NULL) { + bus_dmamap_sync(sc->ti_mbufrx_dmat, + sc->ti_cdata.ti_rx_mini_maps[i], BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->ti_mbufrx_dmat, + sc->ti_cdata.ti_rx_mini_maps[i]); } - m_adj(m_new, ETHER_ALIGN); - r = &sc->ti_rdata->ti_rx_mini_ring[i]; - sc->ti_cdata.ti_rx_mini_chain[i] = m_new; map = sc->ti_cdata.ti_rx_mini_maps[i]; - if (bus_dmamap_load_mbuf_sg(sc->ti_mbufrx_dmat, map, m_new, &segs, - &nsegs, 0)) - return (ENOBUFS); - if (nsegs != 1) - return (ENOBUFS); - ti_hostaddr64(&r->ti_addr, segs.ds_addr); - r->ti_len = segs.ds_len; + sc->ti_cdata.ti_rx_mini_maps[i] = sc->ti_cdata.ti_rx_mini_sparemap; + sc->ti_cdata.ti_rx_mini_sparemap = map; + sc->ti_cdata.ti_rx_mini_chain[i] = m; + + r = &sc->ti_rdata->ti_rx_mini_ring[i]; + ti_hostaddr64(&r->ti_addr, segs[0].ds_addr); + r->ti_len = segs[0].ds_len; r->ti_type = TI_BDTYPE_RECV_BD; r->ti_flags = TI_BDFLAG_MINI_RING; + r->ti_vlan_tag = 0; + r->ti_tcp_udp_cksum = 0; if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; r->ti_idx = i; - bus_dmamap_sync(sc->ti_mbufrx_dmat, map, BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->ti_mbufrx_dmat, sc->ti_cdata.ti_rx_mini_maps[i], + BUS_DMASYNC_PREREAD); return (0); } -#ifdef TI_PRIVATE_JUMBOS +#ifndef TI_SF_BUF_JUMBO /* * Initialize a jumbo receive ring descriptor. This allocates * a jumbo buffer from the pool managed internally by the driver. */ static int -ti_newbuf_jumbo(struct ti_softc *sc, int i, struct mbuf *m) +ti_newbuf_jumbo(struct ti_softc *sc, int i, struct mbuf *dummy) { bus_dmamap_t map; - struct mbuf *m_new = NULL; + bus_dma_segment_t segs[1]; + struct mbuf *m; struct ti_rx_desc *r; - int nsegs; - bus_dma_segment_t segs; + int error, nsegs; - if (m == NULL) { - caddr_t *buf = NULL; + (void)dummy; - /* Allocate the mbuf. */ - MGETHDR(m_new, M_DONTWAIT, MT_DATA); - if (m_new == NULL) { - return (ENOBUFS); - } + m = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, MJUM9BYTES); + if (m == NULL) + return (ENOBUFS); + m->m_len = m->m_pkthdr.len = MJUM9BYTES; + m_adj(m, ETHER_ALIGN); - /* Allocate the jumbo buffer */ - buf = ti_jalloc(sc); - if (buf == NULL) { - m_freem(m_new); - device_printf(sc->ti_dev, "jumbo allocation failed " - "-- packet dropped!\n"); - return (ENOBUFS); - } + error = bus_dmamap_load_mbuf_sg(sc->ti_jumbo_dmat, + sc->ti_cdata.ti_rx_jumbo_sparemap, m, segs, &nsegs, 0); + if (error != 0) { + m_freem(m); + return (error); + } + KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); - /* Attach the buffer to the mbuf. */ - m_new->m_data = (void *) buf; - m_new->m_len = m_new->m_pkthdr.len = TI_JUMBO_FRAMELEN; - MEXTADD(m_new, buf, TI_JUMBO_FRAMELEN, ti_jfree, buf, - (struct ti_softc *)sc, 0, EXT_NET_DRV); - } else { - m_new = m; - m_new->m_data = m_new->m_ext.ext_buf; - m_new->m_ext.ext_size = TI_JUMBO_FRAMELEN; + if (sc->ti_cdata.ti_rx_jumbo_chain[i] != NULL) { + bus_dmamap_sync(sc->ti_jumbo_dmat, + sc->ti_cdata.ti_rx_jumbo_maps[i], BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->ti_jumbo_dmat, + sc->ti_cdata.ti_rx_jumbo_maps[i]); } - m_adj(m_new, ETHER_ALIGN); - /* Set up the descriptor. */ - r = &sc->ti_rdata->ti_rx_jumbo_ring[i]; - sc->ti_cdata.ti_rx_jumbo_chain[i] = m_new; map = sc->ti_cdata.ti_rx_jumbo_maps[i]; - if (bus_dmamap_load_mbuf_sg(sc->ti_jumbo_dmat, map, m_new, &segs, - &nsegs, 0)) - return (ENOBUFS); - if (nsegs != 1) - return (ENOBUFS); - ti_hostaddr64(&r->ti_addr, segs.ds_addr); - r->ti_len = segs.ds_len; + sc->ti_cdata.ti_rx_jumbo_maps[i] = sc->ti_cdata.ti_rx_jumbo_sparemap; + sc->ti_cdata.ti_rx_jumbo_sparemap = map; + sc->ti_cdata.ti_rx_jumbo_chain[i] = m; + + r = &sc->ti_rdata->ti_rx_jumbo_ring[i]; + ti_hostaddr64(&r->ti_addr, segs[0].ds_addr); + r->ti_len = segs[0].ds_len; r->ti_type = TI_BDTYPE_RECV_JUMBO_BD; r->ti_flags = TI_BDFLAG_JUMBO_RING; + r->ti_vlan_tag = 0; + r->ti_tcp_udp_cksum = 0; if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; r->ti_idx = i; - bus_dmamap_sync(sc->ti_jumbo_dmat, map, BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->ti_jumbo_dmat, sc->ti_cdata.ti_rx_jumbo_maps[i], + BUS_DMASYNC_PREREAD); return (0); } @@ -1553,13 +1491,13 @@ ti_init_rx_ring_std(struct ti_softc *sc) int i; struct ti_cmd_desc cmd; - for (i = 0; i < TI_SSLOTS; i++) { - if (ti_newbuf_std(sc, i, NULL) == ENOBUFS) + for (i = 0; i < TI_STD_RX_RING_CNT; i++) { + if (ti_newbuf_std(sc, i) != 0) return (ENOBUFS); }; - TI_UPDATE_STDPROD(sc, i - 1); - sc->ti_std = i - 1; + sc->ti_std = TI_STD_RX_RING_CNT - 1; + TI_UPDATE_STDPROD(sc, TI_STD_RX_RING_CNT - 1); return (0); } @@ -1591,12 +1529,12 @@ ti_init_rx_ring_jumbo(struct ti_softc *s int i; for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) { - if (ti_newbuf_jumbo(sc, i, NULL) == ENOBUFS) + if (ti_newbuf_jumbo(sc, i, NULL) != 0) return (ENOBUFS); }; - TI_UPDATE_JUMBOPROD(sc, i - 1); - sc->ti_jumbo = i - 1; + sc->ti_jumbo = TI_JUMBO_RX_RING_CNT - 1; + TI_UPDATE_JUMBOPROD(sc, TI_JUMBO_RX_RING_CNT - 1); return (0); } @@ -1626,13 +1564,13 @@ ti_init_rx_ring_mini(struct ti_softc *sc { int i; - for (i = 0; i < TI_MSLOTS; i++) { - if (ti_newbuf_mini(sc, i, NULL) == ENOBUFS) + for (i = 0; i < TI_MINI_RX_RING_CNT; i++) { + if (ti_newbuf_mini(sc, i) != 0) return (ENOBUFS); }; - TI_UPDATE_MINIPROD(sc, i - 1); - sc->ti_mini = i - 1; + sc->ti_mini = TI_MINI_RX_RING_CNT - 1; + TI_UPDATE_MINIPROD(sc, TI_MINI_RX_RING_CNT - 1); return (0); } @@ -2080,8 +2018,8 @@ ti_gibinit(struct ti_softc *sc) rcb = &sc->ti_rdata->ti_info.ti_jumbo_rx_rcb; TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_rx_jumbo_ring); -#ifdef TI_PRIVATE_JUMBOS - rcb->ti_max_len = TI_JUMBO_FRAMELEN; +#ifndef TI_SF_BUF_JUMBO + rcb->ti_max_len = MJUM9BYTES - ETHER_ALIGN; rcb->ti_flags = 0; #else rcb->ti_max_len = PAGE_SIZE; @@ -2394,7 +2332,6 @@ ti_attach(device_t dev) } if (ti_alloc_dmamaps(sc)) { - device_printf(dev, "dma map creation failed\n"); error = ENXIO; goto fail; } @@ -2542,11 +2479,6 @@ ti_detach(device_t dev) ti_free_dmamaps(sc); ifmedia_removeall(&sc->ifmedia); -#ifdef TI_PRIVATE_JUMBOS - if (sc->ti_cdata.ti_jumbo_buf) - bus_dmamem_free(sc->ti_jumbo_dmat, sc->ti_cdata.ti_jumbo_buf, - sc->ti_jumbo_dmamap); -#endif if (sc->ti_jumbo_dmat) bus_dma_tag_destroy(sc->ti_jumbo_dmat); if (sc->ti_mbuftx_dmat) @@ -2635,6 +2567,59 @@ ti_hdr_split(struct mbuf *top, int hdr_l } #endif /* TI_JUMBO_HDRSPLIT */ +static void +ti_discard_std(struct ti_softc *sc, int i) +{ + + struct ti_rx_desc *r; + + r = &sc->ti_rdata->ti_rx_std_ring[i]; + r->ti_len = MCLBYTES - ETHER_ALIGN; + r->ti_type = TI_BDTYPE_RECV_BD; + r->ti_flags = 0; + r->ti_vlan_tag = 0; + r->ti_tcp_udp_cksum = 0; + if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) + r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; + r->ti_idx = i; +} + +static void +ti_discard_mini(struct ti_softc *sc, int i) +{ + + struct ti_rx_desc *r; + + r = &sc->ti_rdata->ti_rx_mini_ring[i]; + r->ti_len = MHLEN - ETHER_ALIGN; + r->ti_type = TI_BDTYPE_RECV_BD; + r->ti_flags = TI_BDFLAG_MINI_RING; + r->ti_vlan_tag = 0; + r->ti_tcp_udp_cksum = 0; + if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) + r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; + r->ti_idx = i; +} + +#ifndef TI_SF_BUF_JUMBO +static void +ti_discard_jumbo(struct ti_softc *sc, int i) +{ + + struct ti_rx_desc *r; + + r = &sc->ti_rdata->ti_rx_mini_ring[i]; + r->ti_len = MJUM9BYTES - ETHER_ALIGN; + r->ti_type = TI_BDTYPE_RECV_JUMBO_BD; + r->ti_flags = TI_BDFLAG_JUMBO_RING; + r->ti_vlan_tag = 0; + r->ti_tcp_udp_cksum = 0; + if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) + r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; + r->ti_idx = i; +} +#endif + /* * Frame reception handling. This is called if there's a frame * on the receive return list. @@ -2650,9 +2635,11 @@ static void ti_rxeof(struct ti_softc *sc) { struct ifnet *ifp; +#ifdef TI_SF_BUF_JUMBO bus_dmamap_t map; +#endif struct ti_cmd_desc cmd; - int jumbocnt, minicnt, stdcnt; + int jumbocnt, minicnt, stdcnt, ti_len; TI_LOCK_ASSERT(sc); @@ -2669,6 +2656,7 @@ ti_rxeof(struct ti_softc *sc) cur_rx = &sc->ti_rdata->ti_rx_return_ring[sc->ti_rx_saved_considx]; rxidx = cur_rx->ti_idx; + ti_len = cur_rx->ti_len; TI_INC(sc->ti_rx_saved_considx, TI_RETURN_RING_CNT); if (cur_rx->ti_flags & TI_BDFLAG_VLAN_TAG) { @@ -2680,6 +2668,19 @@ ti_rxeof(struct ti_softc *sc) jumbocnt++; TI_INC(sc->ti_jumbo, TI_JUMBO_RX_RING_CNT); m = sc->ti_cdata.ti_rx_jumbo_chain[rxidx]; +#ifndef TI_SF_BUF_JUMBO + if (cur_rx->ti_flags & TI_BDFLAG_ERROR) { + ifp->if_ierrors++; + ti_discard_jumbo(sc, rxidx); + continue; + } + if (ti_newbuf_jumbo(sc, rxidx, NULL) != 0) { + ifp->if_iqdrops++; + ti_discard_jumbo(sc, rxidx); + continue; + } + m->m_len = ti_len; +#else /* !TI_SF_BUF_JUMBO */ sc->ti_cdata.ti_rx_jumbo_chain[rxidx] = NULL; map = sc->ti_cdata.ti_rx_jumbo_maps[rxidx]; bus_dmamap_sync(sc->ti_jumbo_dmat, map, @@ -2691,64 +2692,51 @@ ti_rxeof(struct ti_softc *sc) continue; } if (ti_newbuf_jumbo(sc, sc->ti_jumbo, NULL) == ENOBUFS) { - ifp->if_ierrors++; + ifp->if_iqdrops++; ti_newbuf_jumbo(sc, sc->ti_jumbo, m); continue; } -#ifdef TI_PRIVATE_JUMBOS - m->m_len = cur_rx->ti_len; -#else /* TI_PRIVATE_JUMBOS */ #ifdef TI_JUMBO_HDRSPLIT if (sc->ti_hdrsplit) ti_hdr_split(m, TI_HOSTADDR(cur_rx->ti_addr), - cur_rx->ti_len, rxidx); + ti_len, rxidx); else #endif /* TI_JUMBO_HDRSPLIT */ - m_adj(m, cur_rx->ti_len - m->m_pkthdr.len); -#endif /* TI_PRIVATE_JUMBOS */ + m_adj(m, ti_len - m->m_pkthdr.len); +#endif /* TI_SF_BUF_JUMBO */ } else if (cur_rx->ti_flags & TI_BDFLAG_MINI_RING) { minicnt++; TI_INC(sc->ti_mini, TI_MINI_RX_RING_CNT); m = sc->ti_cdata.ti_rx_mini_chain[rxidx]; - sc->ti_cdata.ti_rx_mini_chain[rxidx] = NULL; - map = sc->ti_cdata.ti_rx_mini_maps[rxidx]; - bus_dmamap_sync(sc->ti_mbufrx_dmat, map, - BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(sc->ti_mbufrx_dmat, map); if (cur_rx->ti_flags & TI_BDFLAG_ERROR) { ifp->if_ierrors++; - ti_newbuf_mini(sc, sc->ti_mini, m); + ti_discard_mini(sc, rxidx); continue; } - if (ti_newbuf_mini(sc, sc->ti_mini, NULL) == ENOBUFS) { - ifp->if_ierrors++; - ti_newbuf_mini(sc, sc->ti_mini, m); + if (ti_newbuf_mini(sc, rxidx) != 0) { + ifp->if_iqdrops++; + ti_discard_mini(sc, rxidx); continue; } - m->m_len = cur_rx->ti_len; + m->m_len = ti_len; } else { stdcnt++; TI_INC(sc->ti_std, TI_STD_RX_RING_CNT); m = sc->ti_cdata.ti_rx_std_chain[rxidx]; - sc->ti_cdata.ti_rx_std_chain[rxidx] = NULL; - map = sc->ti_cdata.ti_rx_std_maps[rxidx]; - bus_dmamap_sync(sc->ti_mbufrx_dmat, map, - BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(sc->ti_mbufrx_dmat, map); if (cur_rx->ti_flags & TI_BDFLAG_ERROR) { ifp->if_ierrors++; - ti_newbuf_std(sc, sc->ti_std, m); + ti_discard_std(sc, rxidx); continue; } - if (ti_newbuf_std(sc, sc->ti_std, NULL) == ENOBUFS) { - ifp->if_ierrors++; - ti_newbuf_std(sc, sc->ti_std, m); + if (ti_newbuf_std(sc, rxidx) != 0) { + ifp->if_iqdrops++; + ti_discard_std(sc, rxidx); continue; } - m->m_len = cur_rx->ti_len; + m->m_len = ti_len; } - m->m_pkthdr.len = cur_rx->ti_len; + m->m_pkthdr.len = ti_len; ifp->if_ipackets++; m->m_pkthdr.rcvif = ifp; Modified: stable/9/sys/dev/ti/if_tireg.h ============================================================================== --- stable/9/sys/dev/ti/if_tireg.h Tue Jan 3 21:09:07 2012 (r229431) +++ stable/9/sys/dev/ti/if_tireg.h Tue Jan 3 21:16:00 2012 (r229432) @@ -887,23 +887,6 @@ struct ti_event_desc { #define TI_CLRBIT(sc, reg, x) \ CSR_WRITE_4((sc), (reg), (CSR_READ_4((sc), (reg)) & ~(x))) -/* - * Memory management stuff. Note: the SSLOTS, MSLOTS and JSLOTS - * values are tuneable. They control the actual amount of buffers - * allocated for the standard, mini and jumbo receive rings. - */ - -#define TI_SSLOTS 256 -#define TI_MSLOTS 256 -#define TI_JSLOTS 256 - -#define TI_JRAWLEN (TI_JUMBO_FRAMELEN + ETHER_ALIGN) -#define TI_JLEN (TI_JRAWLEN + (sizeof(uint64_t) - \ - (TI_JRAWLEN % sizeof(uint64_t)))) -#define TI_JPAGESZ PAGE_SIZE -#define TI_RESID (TI_JPAGESZ - (TI_JLEN * TI_JSLOTS) % TI_JPAGESZ) -#define TI_JMEM ((TI_JLEN * TI_JSLOTS) + TI_RESID) - struct ti_txdesc { struct mbuf *tx_m; bus_dmamap_t tx_dmamap; @@ -920,7 +903,7 @@ STAILQ_HEAD(ti_txdq, ti_txdesc); */ struct ti_ring_data { struct ti_rx_desc ti_rx_std_ring[TI_STD_RX_RING_CNT]; -#ifdef TI_PRIVATE_JUMBOS +#ifndef TI_SF_BUF_JUMBO struct ti_rx_desc ti_rx_jumbo_ring[TI_JUMBO_RX_RING_CNT]; #else struct ti_rx_desc_ext ti_rx_jumbo_ring[TI_JUMBO_RX_RING_CNT]; @@ -955,13 +938,13 @@ struct ti_chain_data { struct ti_txdq ti_txbusyq; struct mbuf *ti_rx_std_chain[TI_STD_RX_RING_CNT]; bus_dmamap_t ti_rx_std_maps[TI_STD_RX_RING_CNT]; + bus_dmamap_t ti_rx_std_sparemap; struct mbuf *ti_rx_jumbo_chain[TI_JUMBO_RX_RING_CNT]; bus_dmamap_t ti_rx_jumbo_maps[TI_JUMBO_RX_RING_CNT]; + bus_dmamap_t ti_rx_jumbo_sparemap; struct mbuf *ti_rx_mini_chain[TI_MINI_RX_RING_CNT]; bus_dmamap_t ti_rx_mini_maps[TI_MINI_RX_RING_CNT]; - /* Stick the jumbo mem management stuff here too. */ - caddr_t ti_jslots[TI_JSLOTS]; - void *ti_jumbo_buf; + bus_dmamap_t ti_rx_mini_sparemap; }; struct ti_type { @@ -980,11 +963,6 @@ struct ti_mc_entry { SLIST_ENTRY(ti_mc_entry) mc_entries; }; -struct ti_jpool_entry { - int slot; - SLIST_ENTRY(ti_jpool_entry) jpool_entries; -}; - typedef enum { TI_FLAG_NONE = 0x00, TI_FLAG_DEBUGING = 0x01, @@ -1006,7 +984,6 @@ struct ti_softc { int ti_hdrsplit; /* enable header splitting */ bus_dma_tag_t ti_parent_dmat; bus_dma_tag_t ti_jumbo_dmat; - bus_dmamap_t ti_jumbo_dmamap; bus_dma_tag_t ti_mbuftx_dmat; bus_dma_tag_t ti_mbufrx_dmat; bus_dma_tag_t ti_rdata_dmat; @@ -1026,8 +1003,6 @@ struct ti_softc { int ti_mini; /* current mini ring head */ int ti_jumbo; /* current jumo ring head */ SLIST_HEAD(__ti_mchead, ti_mc_entry) ti_mc_listhead; - SLIST_HEAD(__ti_jfreehead, ti_jpool_entry) ti_jfree_listhead; - SLIST_HEAD(__ti_jinusehead, ti_jpool_entry) ti_jinuse_listhead; uint32_t ti_stat_ticks; uint32_t ti_rx_coal_ticks; uint32_t ti_tx_coal_ticks; From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 21:17:59 2012 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 B4FB81065670; Tue, 3 Jan 2012 21:17:59 +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 A1E3A8FC1A; Tue, 3 Jan 2012 21:17: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 q03LHxdi043757; Tue, 3 Jan 2012 21:17:59 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03LHx7F043752; Tue, 3 Jan 2012 21:17:59 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201032117.q03LHx7F043752@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 21:17:59 +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: r229433 - in stable/8/sys: conf dev/ti 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, 03 Jan 2012 21:17:59 -0000 Author: yongari Date: Tue Jan 3 21:17:59 2012 New Revision: 229433 URL: http://svn.freebsd.org/changeset/base/229433 Log: MFC r227347,227367: r227347: Retire 'options TI_PRIVATE_JUMBOS' and replace local jumbo allocator with UMA backed jumbo allocator by default. Previously ti(4) used sf_buf(9) interface for jumbo buffers but it was broken at this moment such that enabling jumbo frame caused instant panic. Due to the nature of sf_buf(9) it heavily relies on VM changes but it seems ti(4) was not received much blessing from VM gurus. I don't understand VM magic and implications used in driver either. Switching to UMA backed jumbo allocator like other network drivers will make jumbo frame work on ti(4). While I'm here, fully allocate all RX buffers. This means ti(4) now uses 512 RX buffer and 1024 mini RX buffers. To use sf_buf(9) interface for jumbo buffers, introduce a new 'options TI_SF_BUF_JUMBO'. If it is proven that sf_buf(9) is better for jumbo buffers, interesting developers can fix the issue in future. ti(4) still needs more bus_dma(9) cleanups and should use separate DMA tag/map for each ring(standard, jumbo, mini, command, event etc) but it should work on all platforms except PAE. Special thanks to Jay[1] who provided complete remote debugging access. r227367: Comment out TI_JUMBO_HDRSPLIT. TI_JUMBO_HDRSPLIT requires TI_SF_BUF_JUMBO. Modified: stable/8/sys/conf/NOTES stable/8/sys/conf/options stable/8/sys/dev/ti/if_ti.c stable/8/sys/dev/ti/if_tireg.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/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/conf/NOTES ============================================================================== --- stable/8/sys/conf/NOTES Tue Jan 3 21:16:00 2012 (r229432) +++ stable/8/sys/conf/NOTES Tue Jan 3 21:17:59 2012 (r229433) @@ -2072,12 +2072,12 @@ device fpa # PCI WAN adapters. device lmc -# Use "private" jumbo buffers allocated exclusively for the ti(4) driver. -# This option is incompatible with the TI_JUMBO_HDRSPLIT option below. -#options TI_PRIVATE_JUMBOS +# Use sf_buf(9) interface for jumbo buffers on ti(4) controllers. +#options TI_SF_BUF_JUMBO # Turn on the header splitting option for the ti(4) driver firmware. This # only works for Tigon II chips, and has no effect for Tigon I chips. -options TI_JUMBO_HDRSPLIT +# This option requires the TI_SF_BUF_JUMBO option above. +#options TI_JUMBO_HDRSPLIT # # Use header splitting feature on bce(4) adapters. Modified: stable/8/sys/conf/options ============================================================================== --- stable/8/sys/conf/options Tue Jan 3 21:16:00 2012 (r229432) +++ stable/8/sys/conf/options Tue Jan 3 21:17:59 2012 (r229433) @@ -515,7 +515,7 @@ NGATM_CCATM opt_netgraph.h DRM_DEBUG opt_drm.h ZERO_COPY_SOCKETS opt_zero.h -TI_PRIVATE_JUMBOS opt_ti.h +TI_SF_BUF_JUMBO opt_ti.h TI_JUMBO_HDRSPLIT opt_ti.h BCE_JUMBO_HDRSPLIT opt_bce.h Modified: stable/8/sys/dev/ti/if_ti.c ============================================================================== --- stable/8/sys/dev/ti/if_ti.c Tue Jan 3 21:16:00 2012 (r229432) +++ stable/8/sys/dev/ti/if_ti.c Tue Jan 3 21:17:59 2012 (r229433) @@ -112,8 +112,7 @@ __FBSDID("$FreeBSD$"); #include #include -/* #define TI_PRIVATE_JUMBOS */ -#ifndef TI_PRIVATE_JUMBOS +#ifdef TI_SF_BUF_JUMBO #include #include #endif @@ -131,9 +130,9 @@ __FBSDID("$FreeBSD$"); * We can only turn on header splitting if we're using extended receive * BDs. */ -#if defined(TI_JUMBO_HDRSPLIT) && defined(TI_PRIVATE_JUMBOS) -#error "options TI_JUMBO_HDRSPLIT and TI_PRIVATE_JUMBOS are mutually exclusive" -#endif /* TI_JUMBO_HDRSPLIT && TI_JUMBO_HDRSPLIT */ +#if defined(TI_JUMBO_HDRSPLIT) && !defined(TI_SF_BUF_JUMBO) +#error "options TI_JUMBO_HDRSPLIT requires TI_SF_BUF_JUMBO" +#endif /* TI_JUMBO_HDRSPLIT && !TI_SF_BUF_JUMBO */ typedef enum { TI_SWAP_HTON, @@ -222,12 +221,8 @@ static void ti_handle_events(struct ti_s static int ti_alloc_dmamaps(struct ti_softc *); static void ti_free_dmamaps(struct ti_softc *); static int ti_alloc_jumbo_mem(struct ti_softc *); -#ifdef TI_PRIVATE_JUMBOS -static void *ti_jalloc(struct ti_softc *); -static void ti_jfree(void *, void *); -#endif /* TI_PRIVATE_JUMBOS */ -static int ti_newbuf_std(struct ti_softc *, int, struct mbuf *); -static int ti_newbuf_mini(struct ti_softc *, int, struct mbuf *); +static int ti_newbuf_std(struct ti_softc *, int); +static int ti_newbuf_mini(struct ti_softc *, int); static int ti_newbuf_jumbo(struct ti_softc *, int, struct mbuf *); static int ti_init_rx_ring_std(struct ti_softc *); static void ti_free_rx_ring_std(struct ti_softc *); @@ -237,6 +232,11 @@ static int ti_init_rx_ring_mini(struct t static void ti_free_rx_ring_mini(struct ti_softc *); static void ti_free_tx_ring(struct ti_softc *); static int ti_init_tx_ring(struct ti_softc *); +static void ti_discard_std(struct ti_softc *, int); +#ifndef TI_SF_BUF_JUMBO +static void ti_discard_jumbo(struct ti_softc *, int); +#endif +static void ti_discard_mini(struct ti_softc *, int); static int ti_64bitslot_war(struct ti_softc *); static int ti_chipinit(struct ti_softc *); @@ -982,21 +982,42 @@ ti_alloc_dmamaps(struct ti_softc *sc) for (i = 0; i < TI_TX_RING_CNT; i++) { sc->ti_cdata.ti_txdesc[i].tx_m = NULL; - sc->ti_cdata.ti_txdesc[i].tx_dmamap = 0; + sc->ti_cdata.ti_txdesc[i].tx_dmamap = NULL; if (bus_dmamap_create(sc->ti_mbuftx_dmat, 0, - &sc->ti_cdata.ti_txdesc[i].tx_dmamap)) + &sc->ti_cdata.ti_txdesc[i].tx_dmamap)) { + device_printf(sc->ti_dev, + "cannot create DMA map for TX\n"); return (ENOBUFS); + } } for (i = 0; i < TI_STD_RX_RING_CNT; i++) { if (bus_dmamap_create(sc->ti_mbufrx_dmat, 0, - &sc->ti_cdata.ti_rx_std_maps[i])) + &sc->ti_cdata.ti_rx_std_maps[i])) { + device_printf(sc->ti_dev, + "cannot create DMA map for RX\n"); return (ENOBUFS); + } + } + if (bus_dmamap_create(sc->ti_mbufrx_dmat, 0, + &sc->ti_cdata.ti_rx_std_sparemap)) { + device_printf(sc->ti_dev, + "cannot create spare DMA map for RX\n"); + return (ENOBUFS); } for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) { if (bus_dmamap_create(sc->ti_jumbo_dmat, 0, - &sc->ti_cdata.ti_rx_jumbo_maps[i])) + &sc->ti_cdata.ti_rx_jumbo_maps[i])) { + device_printf(sc->ti_dev, + "cannot create DMA map for jumbo RX\n"); return (ENOBUFS); + } + } + if (bus_dmamap_create(sc->ti_jumbo_dmat, 0, + &sc->ti_cdata.ti_rx_jumbo_sparemap)) { + device_printf(sc->ti_dev, + "cannot create spare DMA map for jumbo RX\n"); + return (ENOBUFS); } /* Mini ring is not available on Tigon 1. */ @@ -1005,8 +1026,17 @@ ti_alloc_dmamaps(struct ti_softc *sc) for (i = 0; i < TI_MINI_RX_RING_CNT; i++) { if (bus_dmamap_create(sc->ti_mbufrx_dmat, 0, - &sc->ti_cdata.ti_rx_mini_maps[i])) + &sc->ti_cdata.ti_rx_mini_maps[i])) { + device_printf(sc->ti_dev, + "cannot create DMA map for mini RX\n"); return (ENOBUFS); + } + } + if (bus_dmamap_create(sc->ti_mbufrx_dmat, 0, + &sc->ti_cdata.ti_rx_mini_sparemap)) { + device_printf(sc->ti_dev, + "cannot create DMA map for mini RX\n"); + return (ENOBUFS); } return (0); @@ -1017,173 +1047,77 @@ ti_free_dmamaps(struct ti_softc *sc) { int i; - if (sc->ti_mbuftx_dmat) - for (i = 0; i < TI_TX_RING_CNT; i++) + if (sc->ti_mbuftx_dmat) { + for (i = 0; i < TI_TX_RING_CNT; i++) { if (sc->ti_cdata.ti_txdesc[i].tx_dmamap) { bus_dmamap_destroy(sc->ti_mbuftx_dmat, sc->ti_cdata.ti_txdesc[i].tx_dmamap); - sc->ti_cdata.ti_txdesc[i].tx_dmamap = 0; + sc->ti_cdata.ti_txdesc[i].tx_dmamap = NULL; } + } + } - if (sc->ti_mbufrx_dmat) - for (i = 0; i < TI_STD_RX_RING_CNT; i++) + if (sc->ti_mbufrx_dmat) { + for (i = 0; i < TI_STD_RX_RING_CNT; i++) { if (sc->ti_cdata.ti_rx_std_maps[i]) { bus_dmamap_destroy(sc->ti_mbufrx_dmat, sc->ti_cdata.ti_rx_std_maps[i]); - sc->ti_cdata.ti_rx_std_maps[i] = 0; + sc->ti_cdata.ti_rx_std_maps[i] = NULL; } + } + if (sc->ti_cdata.ti_rx_std_sparemap) { + bus_dmamap_destroy(sc->ti_mbufrx_dmat, + sc->ti_cdata.ti_rx_std_sparemap); + sc->ti_cdata.ti_rx_std_sparemap = NULL; + } + } - if (sc->ti_jumbo_dmat) - for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) + if (sc->ti_jumbo_dmat) { + for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) { if (sc->ti_cdata.ti_rx_jumbo_maps[i]) { bus_dmamap_destroy(sc->ti_jumbo_dmat, sc->ti_cdata.ti_rx_jumbo_maps[i]); - sc->ti_cdata.ti_rx_jumbo_maps[i] = 0; + sc->ti_cdata.ti_rx_jumbo_maps[i] = NULL; } - if (sc->ti_mbufrx_dmat) - for (i = 0; i < TI_MINI_RX_RING_CNT; i++) + } + if (sc->ti_cdata.ti_rx_jumbo_sparemap) { + bus_dmamap_destroy(sc->ti_jumbo_dmat, + sc->ti_cdata.ti_rx_jumbo_sparemap); + sc->ti_cdata.ti_rx_jumbo_sparemap = NULL; + } + } + + if (sc->ti_mbufrx_dmat) { + for (i = 0; i < TI_MINI_RX_RING_CNT; i++) { if (sc->ti_cdata.ti_rx_mini_maps[i]) { bus_dmamap_destroy(sc->ti_mbufrx_dmat, sc->ti_cdata.ti_rx_mini_maps[i]); - sc->ti_cdata.ti_rx_mini_maps[i] = 0; + sc->ti_cdata.ti_rx_mini_maps[i] = NULL; } + } + if (sc->ti_cdata.ti_rx_mini_sparemap) { + bus_dmamap_destroy(sc->ti_mbufrx_dmat, + sc->ti_cdata.ti_rx_mini_sparemap); + sc->ti_cdata.ti_rx_mini_sparemap = NULL; + } + } } -#ifdef TI_PRIVATE_JUMBOS - -/* - * Memory management for the jumbo receive ring is a pain in the - * butt. We need to allocate at least 9018 bytes of space per frame, - * _and_ it has to be contiguous (unless you use the extended - * jumbo descriptor format). Using malloc() all the time won't - * work: malloc() allocates memory in powers of two, which means we - * would end up wasting a considerable amount of space by allocating - * 9K chunks. We don't have a jumbo mbuf cluster pool. Thus, we have - * to do our own memory management. - * - * The driver needs to allocate a contiguous chunk of memory at boot - * time. We then chop this up ourselves into 9K pieces and use them - * as external mbuf storage. - * - * One issue here is how much memory to allocate. The jumbo ring has - * 256 slots in it, but at 9K per slot than can consume over 2MB of - * RAM. This is a bit much, especially considering we also need - * RAM for the standard ring and mini ring (on the Tigon 2). To - * save space, we only actually allocate enough memory for 64 slots - * by default, which works out to between 500 and 600K. This can - * be tuned by changing a #define in if_tireg.h. - */ +#ifndef TI_SF_BUF_JUMBO static int ti_alloc_jumbo_mem(struct ti_softc *sc) { - struct ti_jpool_entry *entry; - caddr_t ptr; - int i; - /* - * Grab a big chunk o' storage. Since we are chopping this pool up - * into ~9k chunks, there doesn't appear to be a need to use page - * alignment. - */ - if (bus_dma_tag_create(sc->ti_parent_dmat, /* parent */ - 1, 0, /* algnmnt, boundary */ - BUS_SPACE_MAXADDR, /* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - TI_JMEM, /* maxsize */ - 1, /* nsegments */ - TI_JMEM, /* maxsegsize */ - 0, /* flags */ - NULL, NULL, /* lockfunc, lockarg */ - &sc->ti_jumbo_dmat) != 0) { + if (bus_dma_tag_create(sc->ti_parent_dmat, 1, 0, BUS_SPACE_MAXADDR, + BUS_SPACE_MAXADDR, NULL, NULL, MJUM9BYTES, 1, MJUM9BYTES, 0, NULL, + NULL, &sc->ti_jumbo_dmat) != 0) { device_printf(sc->ti_dev, "Failed to allocate jumbo dmat\n"); - return (ENOBUFS); + return (ENOBUFS); } - - if (bus_dmamem_alloc(sc->ti_jumbo_dmat, - (void**)&sc->ti_cdata.ti_jumbo_buf, - BUS_DMA_NOWAIT | BUS_DMA_COHERENT, - &sc->ti_jumbo_dmamap) != 0) { - device_printf(sc->ti_dev, "Failed to allocate jumbo memory\n"); - return (ENOBUFS); - } - - SLIST_INIT(&sc->ti_jfree_listhead); - SLIST_INIT(&sc->ti_jinuse_listhead); - - /* - * Now divide it up into 9K pieces and save the addresses - * in an array. - */ - ptr = sc->ti_cdata.ti_jumbo_buf; - for (i = 0; i < TI_JSLOTS; i++) { - sc->ti_cdata.ti_jslots[i] = ptr; - ptr += TI_JLEN; - entry = malloc(sizeof(struct ti_jpool_entry), - M_DEVBUF, M_NOWAIT); - if (entry == NULL) { - device_printf(sc->ti_dev, "no memory for jumbo " - "buffer queue!\n"); - return (ENOBUFS); - } - entry->slot = i; - SLIST_INSERT_HEAD(&sc->ti_jfree_listhead, entry, jpool_entries); - } - return (0); } -/* - * Allocate a jumbo buffer. - */ -static void *ti_jalloc(struct ti_softc *sc) -{ - struct ti_jpool_entry *entry; - - entry = SLIST_FIRST(&sc->ti_jfree_listhead); - - if (entry == NULL) { - device_printf(sc->ti_dev, "no free jumbo buffers\n"); - return (NULL); - } - - SLIST_REMOVE_HEAD(&sc->ti_jfree_listhead, jpool_entries); - SLIST_INSERT_HEAD(&sc->ti_jinuse_listhead, entry, jpool_entries); - return (sc->ti_cdata.ti_jslots[entry->slot]); -} - -/* - * Release a jumbo buffer. - */ -static void -ti_jfree(void *buf, void *args) -{ - struct ti_softc *sc; - int i; - struct ti_jpool_entry *entry; - - /* Extract the softc struct pointer. */ - sc = (struct ti_softc *)args; - - if (sc == NULL) - panic("ti_jfree: didn't get softc pointer!"); - - /* calculate the slot this buffer belongs to */ - i = ((vm_offset_t)buf - - (vm_offset_t)sc->ti_cdata.ti_jumbo_buf) / TI_JLEN; - - if ((i < 0) || (i >= TI_JSLOTS)) - panic("ti_jfree: asked to free buffer that we don't manage!"); - - entry = SLIST_FIRST(&sc->ti_jinuse_listhead); - if (entry == NULL) - panic("ti_jfree: buffer not in use!"); - entry->slot = i; - SLIST_REMOVE_HEAD(&sc->ti_jinuse_listhead, jpool_entries); - SLIST_INSERT_HEAD(&sc->ti_jfree_listhead, entry, jpool_entries); -} - #else static int @@ -1212,56 +1146,59 @@ ti_alloc_jumbo_mem(struct ti_softc *sc) return (0); } -#endif /* TI_PRIVATE_JUMBOS */ +#endif /* TI_SF_BUF_JUMBO */ /* * Intialize a standard receive ring descriptor. */ static int -ti_newbuf_std(struct ti_softc *sc, int i, struct mbuf *m) +ti_newbuf_std(struct ti_softc *sc, int i) { bus_dmamap_t map; - bus_dma_segment_t segs; - struct mbuf *m_new = NULL; + bus_dma_segment_t segs[1]; + struct mbuf *m; struct ti_rx_desc *r; - int nsegs; + int error, nsegs; - nsegs = 0; - if (m == NULL) { - MGETHDR(m_new, M_DONTWAIT, MT_DATA); - if (m_new == NULL) - return (ENOBUFS); + m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + if (m == NULL) + return (ENOBUFS); + m->m_len = m->m_pkthdr.len = MCLBYTES; + m_adj(m, ETHER_ALIGN); - MCLGET(m_new, M_DONTWAIT); - if (!(m_new->m_flags & M_EXT)) { - m_freem(m_new); - return (ENOBUFS); - } - m_new->m_len = m_new->m_pkthdr.len = MCLBYTES; - } else { - m_new = m; - m_new->m_len = m_new->m_pkthdr.len = MCLBYTES; - m_new->m_data = m_new->m_ext.ext_buf; + error = bus_dmamap_load_mbuf_sg(sc->ti_mbufrx_dmat, + sc->ti_cdata.ti_rx_std_sparemap, m, segs, &nsegs, 0); + if (error != 0) { + m_freem(m); + return (error); + } + KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); + + if (sc->ti_cdata.ti_rx_std_chain[i] != NULL) { + bus_dmamap_sync(sc->ti_mbufrx_dmat, + sc->ti_cdata.ti_rx_std_maps[i], BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->ti_mbufrx_dmat, + sc->ti_cdata.ti_rx_std_maps[i]); } - m_adj(m_new, ETHER_ALIGN); - sc->ti_cdata.ti_rx_std_chain[i] = m_new; - r = &sc->ti_rdata->ti_rx_std_ring[i]; map = sc->ti_cdata.ti_rx_std_maps[i]; - if (bus_dmamap_load_mbuf_sg(sc->ti_mbufrx_dmat, map, m_new, &segs, - &nsegs, 0)) - return (ENOBUFS); - if (nsegs != 1) - return (ENOBUFS); - ti_hostaddr64(&r->ti_addr, segs.ds_addr); - r->ti_len = segs.ds_len; + sc->ti_cdata.ti_rx_std_maps[i] = sc->ti_cdata.ti_rx_std_sparemap; + sc->ti_cdata.ti_rx_std_sparemap = map; + sc->ti_cdata.ti_rx_std_chain[i] = m; + + r = &sc->ti_rdata->ti_rx_std_ring[i]; + ti_hostaddr64(&r->ti_addr, segs[0].ds_addr); + r->ti_len = segs[0].ds_len; r->ti_type = TI_BDTYPE_RECV_BD; r->ti_flags = 0; + r->ti_vlan_tag = 0; + r->ti_tcp_udp_cksum = 0; if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; r->ti_idx = i; - bus_dmamap_sync(sc->ti_mbufrx_dmat, map, BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->ti_mbufrx_dmat, sc->ti_cdata.ti_rx_std_maps[i], + BUS_DMASYNC_PREREAD); return (0); } @@ -1270,111 +1207,112 @@ ti_newbuf_std(struct ti_softc *sc, int i * the Tigon 2. */ static int -ti_newbuf_mini(struct ti_softc *sc, int i, struct mbuf *m) +ti_newbuf_mini(struct ti_softc *sc, int i) { - bus_dma_segment_t segs; bus_dmamap_t map; - struct mbuf *m_new = NULL; + bus_dma_segment_t segs[1]; + struct mbuf *m; struct ti_rx_desc *r; - int nsegs; + int error, nsegs; - nsegs = 0; - if (m == NULL) { - MGETHDR(m_new, M_DONTWAIT, MT_DATA); - if (m_new == NULL) { - return (ENOBUFS); - } - m_new->m_len = m_new->m_pkthdr.len = MHLEN; - } else { - m_new = m; - m_new->m_data = m_new->m_pktdat; - m_new->m_len = m_new->m_pkthdr.len = MHLEN; + MGETHDR(m, M_DONTWAIT, MT_DATA); + if (m == NULL) + return (ENOBUFS); + m->m_len = m->m_pkthdr.len = MHLEN; + m_adj(m, ETHER_ALIGN); + + error = bus_dmamap_load_mbuf_sg(sc->ti_mbufrx_dmat, + sc->ti_cdata.ti_rx_mini_sparemap, m, segs, &nsegs, 0); + if (error != 0) { + m_freem(m); + return (error); + } + KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); + + if (sc->ti_cdata.ti_rx_mini_chain[i] != NULL) { + bus_dmamap_sync(sc->ti_mbufrx_dmat, + sc->ti_cdata.ti_rx_mini_maps[i], BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->ti_mbufrx_dmat, + sc->ti_cdata.ti_rx_mini_maps[i]); } - m_adj(m_new, ETHER_ALIGN); - r = &sc->ti_rdata->ti_rx_mini_ring[i]; - sc->ti_cdata.ti_rx_mini_chain[i] = m_new; map = sc->ti_cdata.ti_rx_mini_maps[i]; - if (bus_dmamap_load_mbuf_sg(sc->ti_mbufrx_dmat, map, m_new, &segs, - &nsegs, 0)) - return (ENOBUFS); - if (nsegs != 1) - return (ENOBUFS); - ti_hostaddr64(&r->ti_addr, segs.ds_addr); - r->ti_len = segs.ds_len; + sc->ti_cdata.ti_rx_mini_maps[i] = sc->ti_cdata.ti_rx_mini_sparemap; + sc->ti_cdata.ti_rx_mini_sparemap = map; + sc->ti_cdata.ti_rx_mini_chain[i] = m; + + r = &sc->ti_rdata->ti_rx_mini_ring[i]; + ti_hostaddr64(&r->ti_addr, segs[0].ds_addr); + r->ti_len = segs[0].ds_len; r->ti_type = TI_BDTYPE_RECV_BD; r->ti_flags = TI_BDFLAG_MINI_RING; + r->ti_vlan_tag = 0; + r->ti_tcp_udp_cksum = 0; if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; r->ti_idx = i; - bus_dmamap_sync(sc->ti_mbufrx_dmat, map, BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->ti_mbufrx_dmat, sc->ti_cdata.ti_rx_mini_maps[i], + BUS_DMASYNC_PREREAD); return (0); } -#ifdef TI_PRIVATE_JUMBOS +#ifndef TI_SF_BUF_JUMBO /* * Initialize a jumbo receive ring descriptor. This allocates * a jumbo buffer from the pool managed internally by the driver. */ static int -ti_newbuf_jumbo(struct ti_softc *sc, int i, struct mbuf *m) +ti_newbuf_jumbo(struct ti_softc *sc, int i, struct mbuf *dummy) { bus_dmamap_t map; - struct mbuf *m_new = NULL; + bus_dma_segment_t segs[1]; + struct mbuf *m; struct ti_rx_desc *r; - int nsegs; - bus_dma_segment_t segs; + int error, nsegs; - if (m == NULL) { - caddr_t *buf = NULL; + (void)dummy; - /* Allocate the mbuf. */ - MGETHDR(m_new, M_DONTWAIT, MT_DATA); - if (m_new == NULL) { - return (ENOBUFS); - } + m = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, MJUM9BYTES); + if (m == NULL) + return (ENOBUFS); + m->m_len = m->m_pkthdr.len = MJUM9BYTES; + m_adj(m, ETHER_ALIGN); - /* Allocate the jumbo buffer */ - buf = ti_jalloc(sc); - if (buf == NULL) { - m_freem(m_new); - device_printf(sc->ti_dev, "jumbo allocation failed " - "-- packet dropped!\n"); - return (ENOBUFS); - } + error = bus_dmamap_load_mbuf_sg(sc->ti_jumbo_dmat, + sc->ti_cdata.ti_rx_jumbo_sparemap, m, segs, &nsegs, 0); + if (error != 0) { + m_freem(m); + return (error); + } + KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); - /* Attach the buffer to the mbuf. */ - m_new->m_data = (void *) buf; - m_new->m_len = m_new->m_pkthdr.len = TI_JUMBO_FRAMELEN; - MEXTADD(m_new, buf, TI_JUMBO_FRAMELEN, ti_jfree, buf, - (struct ti_softc *)sc, 0, EXT_NET_DRV); - } else { - m_new = m; - m_new->m_data = m_new->m_ext.ext_buf; - m_new->m_ext.ext_size = TI_JUMBO_FRAMELEN; + if (sc->ti_cdata.ti_rx_jumbo_chain[i] != NULL) { + bus_dmamap_sync(sc->ti_jumbo_dmat, + sc->ti_cdata.ti_rx_jumbo_maps[i], BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->ti_jumbo_dmat, + sc->ti_cdata.ti_rx_jumbo_maps[i]); } - m_adj(m_new, ETHER_ALIGN); - /* Set up the descriptor. */ - r = &sc->ti_rdata->ti_rx_jumbo_ring[i]; - sc->ti_cdata.ti_rx_jumbo_chain[i] = m_new; map = sc->ti_cdata.ti_rx_jumbo_maps[i]; - if (bus_dmamap_load_mbuf_sg(sc->ti_jumbo_dmat, map, m_new, &segs, - &nsegs, 0)) - return (ENOBUFS); - if (nsegs != 1) - return (ENOBUFS); - ti_hostaddr64(&r->ti_addr, segs.ds_addr); - r->ti_len = segs.ds_len; + sc->ti_cdata.ti_rx_jumbo_maps[i] = sc->ti_cdata.ti_rx_jumbo_sparemap; + sc->ti_cdata.ti_rx_jumbo_sparemap = map; + sc->ti_cdata.ti_rx_jumbo_chain[i] = m; + + r = &sc->ti_rdata->ti_rx_jumbo_ring[i]; + ti_hostaddr64(&r->ti_addr, segs[0].ds_addr); + r->ti_len = segs[0].ds_len; r->ti_type = TI_BDTYPE_RECV_JUMBO_BD; r->ti_flags = TI_BDFLAG_JUMBO_RING; + r->ti_vlan_tag = 0; + r->ti_tcp_udp_cksum = 0; if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; r->ti_idx = i; - bus_dmamap_sync(sc->ti_jumbo_dmat, map, BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->ti_jumbo_dmat, sc->ti_cdata.ti_rx_jumbo_maps[i], + BUS_DMASYNC_PREREAD); return (0); } @@ -1555,13 +1493,13 @@ ti_init_rx_ring_std(struct ti_softc *sc) int i; struct ti_cmd_desc cmd; - for (i = 0; i < TI_SSLOTS; i++) { - if (ti_newbuf_std(sc, i, NULL) == ENOBUFS) + for (i = 0; i < TI_STD_RX_RING_CNT; i++) { + if (ti_newbuf_std(sc, i) != 0) return (ENOBUFS); }; - TI_UPDATE_STDPROD(sc, i - 1); - sc->ti_std = i - 1; + sc->ti_std = TI_STD_RX_RING_CNT - 1; + TI_UPDATE_STDPROD(sc, TI_STD_RX_RING_CNT - 1); return (0); } @@ -1593,12 +1531,12 @@ ti_init_rx_ring_jumbo(struct ti_softc *s int i; for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) { - if (ti_newbuf_jumbo(sc, i, NULL) == ENOBUFS) + if (ti_newbuf_jumbo(sc, i, NULL) != 0) return (ENOBUFS); }; - TI_UPDATE_JUMBOPROD(sc, i - 1); - sc->ti_jumbo = i - 1; + sc->ti_jumbo = TI_JUMBO_RX_RING_CNT - 1; + TI_UPDATE_JUMBOPROD(sc, TI_JUMBO_RX_RING_CNT - 1); return (0); } @@ -1628,13 +1566,13 @@ ti_init_rx_ring_mini(struct ti_softc *sc { int i; - for (i = 0; i < TI_MSLOTS; i++) { - if (ti_newbuf_mini(sc, i, NULL) == ENOBUFS) + for (i = 0; i < TI_MINI_RX_RING_CNT; i++) { + if (ti_newbuf_mini(sc, i) != 0) return (ENOBUFS); }; - TI_UPDATE_MINIPROD(sc, i - 1); - sc->ti_mini = i - 1; + sc->ti_mini = TI_MINI_RX_RING_CNT - 1; + TI_UPDATE_MINIPROD(sc, TI_MINI_RX_RING_CNT - 1); return (0); } @@ -2082,8 +2020,8 @@ ti_gibinit(struct ti_softc *sc) rcb = &sc->ti_rdata->ti_info.ti_jumbo_rx_rcb; TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_rx_jumbo_ring); -#ifdef TI_PRIVATE_JUMBOS - rcb->ti_max_len = TI_JUMBO_FRAMELEN; +#ifndef TI_SF_BUF_JUMBO + rcb->ti_max_len = MJUM9BYTES - ETHER_ALIGN; rcb->ti_flags = 0; #else rcb->ti_max_len = PAGE_SIZE; @@ -2396,7 +2334,6 @@ ti_attach(device_t dev) } if (ti_alloc_dmamaps(sc)) { - device_printf(dev, "dma map creation failed\n"); error = ENXIO; goto fail; } @@ -2544,11 +2481,6 @@ ti_detach(device_t dev) ti_free_dmamaps(sc); ifmedia_removeall(&sc->ifmedia); -#ifdef TI_PRIVATE_JUMBOS - if (sc->ti_cdata.ti_jumbo_buf) - bus_dmamem_free(sc->ti_jumbo_dmat, sc->ti_cdata.ti_jumbo_buf, - sc->ti_jumbo_dmamap); -#endif if (sc->ti_jumbo_dmat) bus_dma_tag_destroy(sc->ti_jumbo_dmat); if (sc->ti_mbuftx_dmat) @@ -2637,6 +2569,59 @@ ti_hdr_split(struct mbuf *top, int hdr_l } #endif /* TI_JUMBO_HDRSPLIT */ +static void +ti_discard_std(struct ti_softc *sc, int i) +{ + + struct ti_rx_desc *r; + + r = &sc->ti_rdata->ti_rx_std_ring[i]; + r->ti_len = MCLBYTES - ETHER_ALIGN; + r->ti_type = TI_BDTYPE_RECV_BD; + r->ti_flags = 0; + r->ti_vlan_tag = 0; + r->ti_tcp_udp_cksum = 0; + if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) + r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; + r->ti_idx = i; +} + +static void +ti_discard_mini(struct ti_softc *sc, int i) +{ + + struct ti_rx_desc *r; + + r = &sc->ti_rdata->ti_rx_mini_ring[i]; + r->ti_len = MHLEN - ETHER_ALIGN; + r->ti_type = TI_BDTYPE_RECV_BD; + r->ti_flags = TI_BDFLAG_MINI_RING; + r->ti_vlan_tag = 0; + r->ti_tcp_udp_cksum = 0; + if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) + r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; + r->ti_idx = i; +} + +#ifndef TI_SF_BUF_JUMBO +static void +ti_discard_jumbo(struct ti_softc *sc, int i) +{ + + struct ti_rx_desc *r; + + r = &sc->ti_rdata->ti_rx_mini_ring[i]; + r->ti_len = MJUM9BYTES - ETHER_ALIGN; + r->ti_type = TI_BDTYPE_RECV_JUMBO_BD; + r->ti_flags = TI_BDFLAG_JUMBO_RING; + r->ti_vlan_tag = 0; + r->ti_tcp_udp_cksum = 0; + if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) + r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; + r->ti_idx = i; +} +#endif + /* * Frame reception handling. This is called if there's a frame * on the receive return list. @@ -2652,9 +2637,11 @@ static void ti_rxeof(struct ti_softc *sc) { struct ifnet *ifp; +#ifdef TI_SF_BUF_JUMBO bus_dmamap_t map; +#endif struct ti_cmd_desc cmd; - int jumbocnt, minicnt, stdcnt; + int jumbocnt, minicnt, stdcnt, ti_len; TI_LOCK_ASSERT(sc); @@ -2671,6 +2658,7 @@ ti_rxeof(struct ti_softc *sc) cur_rx = &sc->ti_rdata->ti_rx_return_ring[sc->ti_rx_saved_considx]; rxidx = cur_rx->ti_idx; + ti_len = cur_rx->ti_len; TI_INC(sc->ti_rx_saved_considx, TI_RETURN_RING_CNT); if (cur_rx->ti_flags & TI_BDFLAG_VLAN_TAG) { @@ -2682,6 +2670,19 @@ ti_rxeof(struct ti_softc *sc) jumbocnt++; TI_INC(sc->ti_jumbo, TI_JUMBO_RX_RING_CNT); m = sc->ti_cdata.ti_rx_jumbo_chain[rxidx]; +#ifndef TI_SF_BUF_JUMBO + if (cur_rx->ti_flags & TI_BDFLAG_ERROR) { + ifp->if_ierrors++; + ti_discard_jumbo(sc, rxidx); + continue; + } + if (ti_newbuf_jumbo(sc, rxidx, NULL) != 0) { + ifp->if_iqdrops++; + ti_discard_jumbo(sc, rxidx); + continue; + } + m->m_len = ti_len; +#else /* !TI_SF_BUF_JUMBO */ sc->ti_cdata.ti_rx_jumbo_chain[rxidx] = NULL; map = sc->ti_cdata.ti_rx_jumbo_maps[rxidx]; bus_dmamap_sync(sc->ti_jumbo_dmat, map, @@ -2693,64 +2694,51 @@ ti_rxeof(struct ti_softc *sc) continue; } if (ti_newbuf_jumbo(sc, sc->ti_jumbo, NULL) == ENOBUFS) { - ifp->if_ierrors++; + ifp->if_iqdrops++; ti_newbuf_jumbo(sc, sc->ti_jumbo, m); continue; } -#ifdef TI_PRIVATE_JUMBOS - m->m_len = cur_rx->ti_len; -#else /* TI_PRIVATE_JUMBOS */ #ifdef TI_JUMBO_HDRSPLIT if (sc->ti_hdrsplit) ti_hdr_split(m, TI_HOSTADDR(cur_rx->ti_addr), - cur_rx->ti_len, rxidx); + ti_len, rxidx); else #endif /* TI_JUMBO_HDRSPLIT */ - m_adj(m, cur_rx->ti_len - m->m_pkthdr.len); -#endif /* TI_PRIVATE_JUMBOS */ + m_adj(m, ti_len - m->m_pkthdr.len); +#endif /* TI_SF_BUF_JUMBO */ } else if (cur_rx->ti_flags & TI_BDFLAG_MINI_RING) { minicnt++; TI_INC(sc->ti_mini, TI_MINI_RX_RING_CNT); m = sc->ti_cdata.ti_rx_mini_chain[rxidx]; - sc->ti_cdata.ti_rx_mini_chain[rxidx] = NULL; - map = sc->ti_cdata.ti_rx_mini_maps[rxidx]; - bus_dmamap_sync(sc->ti_mbufrx_dmat, map, - BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(sc->ti_mbufrx_dmat, map); if (cur_rx->ti_flags & TI_BDFLAG_ERROR) { ifp->if_ierrors++; - ti_newbuf_mini(sc, sc->ti_mini, m); + ti_discard_mini(sc, rxidx); continue; } - if (ti_newbuf_mini(sc, sc->ti_mini, NULL) == ENOBUFS) { - ifp->if_ierrors++; - ti_newbuf_mini(sc, sc->ti_mini, m); + if (ti_newbuf_mini(sc, rxidx) != 0) { + ifp->if_iqdrops++; + ti_discard_mini(sc, rxidx); continue; } - m->m_len = cur_rx->ti_len; + m->m_len = ti_len; } else { stdcnt++; TI_INC(sc->ti_std, TI_STD_RX_RING_CNT); m = sc->ti_cdata.ti_rx_std_chain[rxidx]; - sc->ti_cdata.ti_rx_std_chain[rxidx] = NULL; - map = sc->ti_cdata.ti_rx_std_maps[rxidx]; - bus_dmamap_sync(sc->ti_mbufrx_dmat, map, - BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(sc->ti_mbufrx_dmat, map); if (cur_rx->ti_flags & TI_BDFLAG_ERROR) { ifp->if_ierrors++; - ti_newbuf_std(sc, sc->ti_std, m); + ti_discard_std(sc, rxidx); continue; } - if (ti_newbuf_std(sc, sc->ti_std, NULL) == ENOBUFS) { - ifp->if_ierrors++; - ti_newbuf_std(sc, sc->ti_std, m); + if (ti_newbuf_std(sc, rxidx) != 0) { + ifp->if_iqdrops++; + ti_discard_std(sc, rxidx); continue; } - m->m_len = cur_rx->ti_len; + m->m_len = ti_len; } - m->m_pkthdr.len = cur_rx->ti_len; + m->m_pkthdr.len = ti_len; ifp->if_ipackets++; m->m_pkthdr.rcvif = ifp; Modified: stable/8/sys/dev/ti/if_tireg.h ============================================================================== --- stable/8/sys/dev/ti/if_tireg.h Tue Jan 3 21:16:00 2012 (r229432) +++ stable/8/sys/dev/ti/if_tireg.h Tue Jan 3 21:17:59 2012 (r229433) @@ -887,23 +887,6 @@ struct ti_event_desc { #define TI_CLRBIT(sc, reg, x) \ CSR_WRITE_4((sc), (reg), (CSR_READ_4((sc), (reg)) & ~(x))) -/* - * Memory management stuff. Note: the SSLOTS, MSLOTS and JSLOTS - * values are tuneable. They control the actual amount of buffers - * allocated for the standard, mini and jumbo receive rings. - */ - -#define TI_SSLOTS 256 -#define TI_MSLOTS 256 -#define TI_JSLOTS 256 - -#define TI_JRAWLEN (TI_JUMBO_FRAMELEN + ETHER_ALIGN) -#define TI_JLEN (TI_JRAWLEN + (sizeof(uint64_t) - \ - (TI_JRAWLEN % sizeof(uint64_t)))) -#define TI_JPAGESZ PAGE_SIZE -#define TI_RESID (TI_JPAGESZ - (TI_JLEN * TI_JSLOTS) % TI_JPAGESZ) -#define TI_JMEM ((TI_JLEN * TI_JSLOTS) + TI_RESID) - struct ti_txdesc { struct mbuf *tx_m; bus_dmamap_t tx_dmamap; @@ -920,7 +903,7 @@ STAILQ_HEAD(ti_txdq, ti_txdesc); */ struct ti_ring_data { struct ti_rx_desc ti_rx_std_ring[TI_STD_RX_RING_CNT]; -#ifdef TI_PRIVATE_JUMBOS +#ifndef TI_SF_BUF_JUMBO struct ti_rx_desc ti_rx_jumbo_ring[TI_JUMBO_RX_RING_CNT]; #else struct ti_rx_desc_ext ti_rx_jumbo_ring[TI_JUMBO_RX_RING_CNT]; @@ -955,13 +938,13 @@ struct ti_chain_data { struct ti_txdq ti_txbusyq; struct mbuf *ti_rx_std_chain[TI_STD_RX_RING_CNT]; bus_dmamap_t ti_rx_std_maps[TI_STD_RX_RING_CNT]; + bus_dmamap_t ti_rx_std_sparemap; struct mbuf *ti_rx_jumbo_chain[TI_JUMBO_RX_RING_CNT]; bus_dmamap_t ti_rx_jumbo_maps[TI_JUMBO_RX_RING_CNT]; + bus_dmamap_t ti_rx_jumbo_sparemap; struct mbuf *ti_rx_mini_chain[TI_MINI_RX_RING_CNT]; bus_dmamap_t ti_rx_mini_maps[TI_MINI_RX_RING_CNT]; - /* Stick the jumbo mem management stuff here too. */ - caddr_t ti_jslots[TI_JSLOTS]; - void *ti_jumbo_buf; + bus_dmamap_t ti_rx_mini_sparemap; }; struct ti_type { @@ -980,11 +963,6 @@ struct ti_mc_entry { SLIST_ENTRY(ti_mc_entry) mc_entries; }; -struct ti_jpool_entry { - int slot; - SLIST_ENTRY(ti_jpool_entry) jpool_entries; -}; - typedef enum { TI_FLAG_NONE = 0x00, TI_FLAG_DEBUGING = 0x01, @@ -1006,7 +984,6 @@ struct ti_softc { int ti_hdrsplit; /* enable header splitting */ bus_dma_tag_t ti_parent_dmat; bus_dma_tag_t ti_jumbo_dmat; - bus_dmamap_t ti_jumbo_dmamap; bus_dma_tag_t ti_mbuftx_dmat; bus_dma_tag_t ti_mbufrx_dmat; bus_dma_tag_t ti_rdata_dmat; @@ -1026,8 +1003,6 @@ struct ti_softc { int ti_mini; /* current mini ring head */ int ti_jumbo; /* current jumo ring head */ SLIST_HEAD(__ti_mchead, ti_mc_entry) ti_mc_listhead; - SLIST_HEAD(__ti_jfreehead, ti_jpool_entry) ti_jfree_listhead; - SLIST_HEAD(__ti_jinusehead, ti_jpool_entry) ti_jinuse_listhead; uint32_t ti_stat_ticks; uint32_t ti_rx_coal_ticks; uint32_t ti_tx_coal_ticks; From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 21:21:25 2012 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 88A79106564A; Tue, 3 Jan 2012 21:21:25 +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 759CC8FC13; Tue, 3 Jan 2012 21:21:25 +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 q03LLPAI043901; Tue, 3 Jan 2012 21:21:25 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03LLPp3043896; Tue, 3 Jan 2012 21:21:25 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201032121.q03LLPp3043896@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 21:21:25 +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: r229434 - in stable/7/sys: conf dev/ti 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, 03 Jan 2012 21:21:25 -0000 Author: yongari Date: Tue Jan 3 21:21:25 2012 New Revision: 229434 URL: http://svn.freebsd.org/changeset/base/229434 Log: MFC r227347,227367: r227347: Retire 'options TI_PRIVATE_JUMBOS' and replace local jumbo allocator with UMA backed jumbo allocator by default. Previously ti(4) used sf_buf(9) interface for jumbo buffers but it was broken at this moment such that enabling jumbo frame caused instant panic. Due to the nature of sf_buf(9) it heavily relies on VM changes but it seems ti(4) was not received much blessing from VM gurus. I don't understand VM magic and implications used in driver either. Switching to UMA backed jumbo allocator like other network drivers will make jumbo frame work on ti(4). While I'm here, fully allocate all RX buffers. This means ti(4) now uses 512 RX buffer and 1024 mini RX buffers. To use sf_buf(9) interface for jumbo buffers, introduce a new 'options TI_SF_BUF_JUMBO'. If it is proven that sf_buf(9) is better for jumbo buffers, interesting developers can fix the issue in future. ti(4) still needs more bus_dma(9) cleanups and should use separate DMA tag/map for each ring(standard, jumbo, mini, command, event etc) but it should work on all platforms except PAE. Special thanks to Jay[1] who provided complete remote debugging access. r227367: Comment out TI_JUMBO_HDRSPLIT. TI_JUMBO_HDRSPLIT requires TI_SF_BUF_JUMBO. Modified: stable/7/sys/conf/NOTES stable/7/sys/conf/options stable/7/sys/dev/ti/if_ti.c stable/7/sys/dev/ti/if_tireg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/conf/NOTES ============================================================================== --- stable/7/sys/conf/NOTES Tue Jan 3 21:17:59 2012 (r229433) +++ stable/7/sys/conf/NOTES Tue Jan 3 21:21:25 2012 (r229434) @@ -1966,12 +1966,12 @@ device fpa # PCI WAN adapters. device lmc -# Use "private" jumbo buffers allocated exclusively for the ti(4) driver. -# This option is incompatible with the TI_JUMBO_HDRSPLIT option below. -#options TI_PRIVATE_JUMBOS +# Use sf_buf(9) interface for jumbo buffers on ti(4) controllers. +#options TI_SF_BUF_JUMBO # Turn on the header splitting option for the ti(4) driver firmware. This # only works for Tigon II chips, and has no effect for Tigon I chips. -options TI_JUMBO_HDRSPLIT +# This option requires the TI_SF_BUF_JUMBO option above. +#options TI_JUMBO_HDRSPLIT # # Use header splitting feature on bce(4) adapters. Modified: stable/7/sys/conf/options ============================================================================== --- stable/7/sys/conf/options Tue Jan 3 21:17:59 2012 (r229433) +++ stable/7/sys/conf/options Tue Jan 3 21:21:25 2012 (r229434) @@ -492,7 +492,7 @@ NGATM_CCATM opt_netgraph.h DRM_DEBUG opt_drm.h ZERO_COPY_SOCKETS opt_zero.h -TI_PRIVATE_JUMBOS opt_ti.h +TI_SF_BUF_JUMBO opt_ti.h TI_JUMBO_HDRSPLIT opt_ti.h BCE_JUMBO_HDRSPLIT opt_bce.h Modified: stable/7/sys/dev/ti/if_ti.c ============================================================================== --- stable/7/sys/dev/ti/if_ti.c Tue Jan 3 21:17:59 2012 (r229433) +++ stable/7/sys/dev/ti/if_ti.c Tue Jan 3 21:21:25 2012 (r229434) @@ -112,8 +112,7 @@ __FBSDID("$FreeBSD$"); #include #include -/* #define TI_PRIVATE_JUMBOS */ -#ifndef TI_PRIVATE_JUMBOS +#ifdef TI_SF_BUF_JUMBO #include #include #endif @@ -131,9 +130,9 @@ __FBSDID("$FreeBSD$"); * We can only turn on header splitting if we're using extended receive * BDs. */ -#if defined(TI_JUMBO_HDRSPLIT) && defined(TI_PRIVATE_JUMBOS) -#error "options TI_JUMBO_HDRSPLIT and TI_PRIVATE_JUMBOS are mutually exclusive" -#endif /* TI_JUMBO_HDRSPLIT && TI_JUMBO_HDRSPLIT */ +#if defined(TI_JUMBO_HDRSPLIT) && !defined(TI_SF_BUF_JUMBO) +#error "options TI_JUMBO_HDRSPLIT requires TI_SF_BUF_JUMBO" +#endif /* TI_JUMBO_HDRSPLIT && !TI_SF_BUF_JUMBO */ typedef enum { TI_SWAP_HTON, @@ -222,12 +221,8 @@ static void ti_handle_events(struct ti_s static int ti_alloc_dmamaps(struct ti_softc *); static void ti_free_dmamaps(struct ti_softc *); static int ti_alloc_jumbo_mem(struct ti_softc *); -#ifdef TI_PRIVATE_JUMBOS -static void *ti_jalloc(struct ti_softc *); -static void ti_jfree(void *, void *); -#endif /* TI_PRIVATE_JUMBOS */ -static int ti_newbuf_std(struct ti_softc *, int, struct mbuf *); -static int ti_newbuf_mini(struct ti_softc *, int, struct mbuf *); +static int ti_newbuf_std(struct ti_softc *, int); +static int ti_newbuf_mini(struct ti_softc *, int); static int ti_newbuf_jumbo(struct ti_softc *, int, struct mbuf *); static int ti_init_rx_ring_std(struct ti_softc *); static void ti_free_rx_ring_std(struct ti_softc *); @@ -237,6 +232,11 @@ static int ti_init_rx_ring_mini(struct t static void ti_free_rx_ring_mini(struct ti_softc *); static void ti_free_tx_ring(struct ti_softc *); static int ti_init_tx_ring(struct ti_softc *); +static void ti_discard_std(struct ti_softc *, int); +#ifndef TI_SF_BUF_JUMBO +static void ti_discard_jumbo(struct ti_softc *, int); +#endif +static void ti_discard_mini(struct ti_softc *, int); static int ti_64bitslot_war(struct ti_softc *); static int ti_chipinit(struct ti_softc *); @@ -982,21 +982,42 @@ ti_alloc_dmamaps(struct ti_softc *sc) for (i = 0; i < TI_TX_RING_CNT; i++) { sc->ti_cdata.ti_txdesc[i].tx_m = NULL; - sc->ti_cdata.ti_txdesc[i].tx_dmamap = 0; + sc->ti_cdata.ti_txdesc[i].tx_dmamap = NULL; if (bus_dmamap_create(sc->ti_mbuftx_dmat, 0, - &sc->ti_cdata.ti_txdesc[i].tx_dmamap)) + &sc->ti_cdata.ti_txdesc[i].tx_dmamap)) { + device_printf(sc->ti_dev, + "cannot create DMA map for TX\n"); return (ENOBUFS); + } } for (i = 0; i < TI_STD_RX_RING_CNT; i++) { if (bus_dmamap_create(sc->ti_mbufrx_dmat, 0, - &sc->ti_cdata.ti_rx_std_maps[i])) + &sc->ti_cdata.ti_rx_std_maps[i])) { + device_printf(sc->ti_dev, + "cannot create DMA map for RX\n"); return (ENOBUFS); + } + } + if (bus_dmamap_create(sc->ti_mbufrx_dmat, 0, + &sc->ti_cdata.ti_rx_std_sparemap)) { + device_printf(sc->ti_dev, + "cannot create spare DMA map for RX\n"); + return (ENOBUFS); } for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) { if (bus_dmamap_create(sc->ti_jumbo_dmat, 0, - &sc->ti_cdata.ti_rx_jumbo_maps[i])) + &sc->ti_cdata.ti_rx_jumbo_maps[i])) { + device_printf(sc->ti_dev, + "cannot create DMA map for jumbo RX\n"); return (ENOBUFS); + } + } + if (bus_dmamap_create(sc->ti_jumbo_dmat, 0, + &sc->ti_cdata.ti_rx_jumbo_sparemap)) { + device_printf(sc->ti_dev, + "cannot create spare DMA map for jumbo RX\n"); + return (ENOBUFS); } /* Mini ring is not available on Tigon 1. */ @@ -1005,8 +1026,17 @@ ti_alloc_dmamaps(struct ti_softc *sc) for (i = 0; i < TI_MINI_RX_RING_CNT; i++) { if (bus_dmamap_create(sc->ti_mbufrx_dmat, 0, - &sc->ti_cdata.ti_rx_mini_maps[i])) + &sc->ti_cdata.ti_rx_mini_maps[i])) { + device_printf(sc->ti_dev, + "cannot create DMA map for mini RX\n"); return (ENOBUFS); + } + } + if (bus_dmamap_create(sc->ti_mbufrx_dmat, 0, + &sc->ti_cdata.ti_rx_mini_sparemap)) { + device_printf(sc->ti_dev, + "cannot create DMA map for mini RX\n"); + return (ENOBUFS); } return (0); @@ -1017,173 +1047,77 @@ ti_free_dmamaps(struct ti_softc *sc) { int i; - if (sc->ti_mbuftx_dmat) - for (i = 0; i < TI_TX_RING_CNT; i++) + if (sc->ti_mbuftx_dmat) { + for (i = 0; i < TI_TX_RING_CNT; i++) { if (sc->ti_cdata.ti_txdesc[i].tx_dmamap) { bus_dmamap_destroy(sc->ti_mbuftx_dmat, sc->ti_cdata.ti_txdesc[i].tx_dmamap); - sc->ti_cdata.ti_txdesc[i].tx_dmamap = 0; + sc->ti_cdata.ti_txdesc[i].tx_dmamap = NULL; } + } + } - if (sc->ti_mbufrx_dmat) - for (i = 0; i < TI_STD_RX_RING_CNT; i++) + if (sc->ti_mbufrx_dmat) { + for (i = 0; i < TI_STD_RX_RING_CNT; i++) { if (sc->ti_cdata.ti_rx_std_maps[i]) { bus_dmamap_destroy(sc->ti_mbufrx_dmat, sc->ti_cdata.ti_rx_std_maps[i]); - sc->ti_cdata.ti_rx_std_maps[i] = 0; + sc->ti_cdata.ti_rx_std_maps[i] = NULL; } + } + if (sc->ti_cdata.ti_rx_std_sparemap) { + bus_dmamap_destroy(sc->ti_mbufrx_dmat, + sc->ti_cdata.ti_rx_std_sparemap); + sc->ti_cdata.ti_rx_std_sparemap = NULL; + } + } - if (sc->ti_jumbo_dmat) - for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) + if (sc->ti_jumbo_dmat) { + for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) { if (sc->ti_cdata.ti_rx_jumbo_maps[i]) { bus_dmamap_destroy(sc->ti_jumbo_dmat, sc->ti_cdata.ti_rx_jumbo_maps[i]); - sc->ti_cdata.ti_rx_jumbo_maps[i] = 0; + sc->ti_cdata.ti_rx_jumbo_maps[i] = NULL; } - if (sc->ti_mbufrx_dmat) - for (i = 0; i < TI_MINI_RX_RING_CNT; i++) + } + if (sc->ti_cdata.ti_rx_jumbo_sparemap) { + bus_dmamap_destroy(sc->ti_jumbo_dmat, + sc->ti_cdata.ti_rx_jumbo_sparemap); + sc->ti_cdata.ti_rx_jumbo_sparemap = NULL; + } + } + + if (sc->ti_mbufrx_dmat) { + for (i = 0; i < TI_MINI_RX_RING_CNT; i++) { if (sc->ti_cdata.ti_rx_mini_maps[i]) { bus_dmamap_destroy(sc->ti_mbufrx_dmat, sc->ti_cdata.ti_rx_mini_maps[i]); - sc->ti_cdata.ti_rx_mini_maps[i] = 0; + sc->ti_cdata.ti_rx_mini_maps[i] = NULL; } + } + if (sc->ti_cdata.ti_rx_mini_sparemap) { + bus_dmamap_destroy(sc->ti_mbufrx_dmat, + sc->ti_cdata.ti_rx_mini_sparemap); + sc->ti_cdata.ti_rx_mini_sparemap = NULL; + } + } } -#ifdef TI_PRIVATE_JUMBOS - -/* - * Memory management for the jumbo receive ring is a pain in the - * butt. We need to allocate at least 9018 bytes of space per frame, - * _and_ it has to be contiguous (unless you use the extended - * jumbo descriptor format). Using malloc() all the time won't - * work: malloc() allocates memory in powers of two, which means we - * would end up wasting a considerable amount of space by allocating - * 9K chunks. We don't have a jumbo mbuf cluster pool. Thus, we have - * to do our own memory management. - * - * The driver needs to allocate a contiguous chunk of memory at boot - * time. We then chop this up ourselves into 9K pieces and use them - * as external mbuf storage. - * - * One issue here is how much memory to allocate. The jumbo ring has - * 256 slots in it, but at 9K per slot than can consume over 2MB of - * RAM. This is a bit much, especially considering we also need - * RAM for the standard ring and mini ring (on the Tigon 2). To - * save space, we only actually allocate enough memory for 64 slots - * by default, which works out to between 500 and 600K. This can - * be tuned by changing a #define in if_tireg.h. - */ +#ifndef TI_SF_BUF_JUMBO static int ti_alloc_jumbo_mem(struct ti_softc *sc) { - struct ti_jpool_entry *entry; - caddr_t ptr; - int i; - /* - * Grab a big chunk o' storage. Since we are chopping this pool up - * into ~9k chunks, there doesn't appear to be a need to use page - * alignment. - */ - if (bus_dma_tag_create(sc->ti_parent_dmat, /* parent */ - 1, 0, /* algnmnt, boundary */ - BUS_SPACE_MAXADDR, /* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - TI_JMEM, /* maxsize */ - 1, /* nsegments */ - TI_JMEM, /* maxsegsize */ - 0, /* flags */ - NULL, NULL, /* lockfunc, lockarg */ - &sc->ti_jumbo_dmat) != 0) { + if (bus_dma_tag_create(sc->ti_parent_dmat, 1, 0, BUS_SPACE_MAXADDR, + BUS_SPACE_MAXADDR, NULL, NULL, MJUM9BYTES, 1, MJUM9BYTES, 0, NULL, + NULL, &sc->ti_jumbo_dmat) != 0) { device_printf(sc->ti_dev, "Failed to allocate jumbo dmat\n"); - return (ENOBUFS); + return (ENOBUFS); } - - if (bus_dmamem_alloc(sc->ti_jumbo_dmat, - (void**)&sc->ti_cdata.ti_jumbo_buf, - BUS_DMA_NOWAIT | BUS_DMA_COHERENT, - &sc->ti_jumbo_dmamap) != 0) { - device_printf(sc->ti_dev, "Failed to allocate jumbo memory\n"); - return (ENOBUFS); - } - - SLIST_INIT(&sc->ti_jfree_listhead); - SLIST_INIT(&sc->ti_jinuse_listhead); - - /* - * Now divide it up into 9K pieces and save the addresses - * in an array. - */ - ptr = sc->ti_cdata.ti_jumbo_buf; - for (i = 0; i < TI_JSLOTS; i++) { - sc->ti_cdata.ti_jslots[i] = ptr; - ptr += TI_JLEN; - entry = malloc(sizeof(struct ti_jpool_entry), - M_DEVBUF, M_NOWAIT); - if (entry == NULL) { - device_printf(sc->ti_dev, "no memory for jumbo " - "buffer queue!\n"); - return (ENOBUFS); - } - entry->slot = i; - SLIST_INSERT_HEAD(&sc->ti_jfree_listhead, entry, jpool_entries); - } - return (0); } -/* - * Allocate a jumbo buffer. - */ -static void *ti_jalloc(struct ti_softc *sc) -{ - struct ti_jpool_entry *entry; - - entry = SLIST_FIRST(&sc->ti_jfree_listhead); - - if (entry == NULL) { - device_printf(sc->ti_dev, "no free jumbo buffers\n"); - return (NULL); - } - - SLIST_REMOVE_HEAD(&sc->ti_jfree_listhead, jpool_entries); - SLIST_INSERT_HEAD(&sc->ti_jinuse_listhead, entry, jpool_entries); - return (sc->ti_cdata.ti_jslots[entry->slot]); -} - -/* - * Release a jumbo buffer. - */ -static void -ti_jfree(void *buf, void *args) -{ - struct ti_softc *sc; - int i; - struct ti_jpool_entry *entry; - - /* Extract the softc struct pointer. */ - sc = (struct ti_softc *)args; - - if (sc == NULL) - panic("ti_jfree: didn't get softc pointer!"); - - /* calculate the slot this buffer belongs to */ - i = ((vm_offset_t)buf - - (vm_offset_t)sc->ti_cdata.ti_jumbo_buf) / TI_JLEN; - - if ((i < 0) || (i >= TI_JSLOTS)) - panic("ti_jfree: asked to free buffer that we don't manage!"); - - entry = SLIST_FIRST(&sc->ti_jinuse_listhead); - if (entry == NULL) - panic("ti_jfree: buffer not in use!"); - entry->slot = i; - SLIST_REMOVE_HEAD(&sc->ti_jinuse_listhead, jpool_entries); - SLIST_INSERT_HEAD(&sc->ti_jfree_listhead, entry, jpool_entries); -} - #else static int @@ -1212,56 +1146,59 @@ ti_alloc_jumbo_mem(struct ti_softc *sc) return (0); } -#endif /* TI_PRIVATE_JUMBOS */ +#endif /* TI_SF_BUF_JUMBO */ /* * Intialize a standard receive ring descriptor. */ static int -ti_newbuf_std(struct ti_softc *sc, int i, struct mbuf *m) +ti_newbuf_std(struct ti_softc *sc, int i) { bus_dmamap_t map; - bus_dma_segment_t segs; - struct mbuf *m_new = NULL; + bus_dma_segment_t segs[1]; + struct mbuf *m; struct ti_rx_desc *r; - int nsegs; + int error, nsegs; - nsegs = 0; - if (m == NULL) { - MGETHDR(m_new, M_DONTWAIT, MT_DATA); - if (m_new == NULL) - return (ENOBUFS); + m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + if (m == NULL) + return (ENOBUFS); + m->m_len = m->m_pkthdr.len = MCLBYTES; + m_adj(m, ETHER_ALIGN); - MCLGET(m_new, M_DONTWAIT); - if (!(m_new->m_flags & M_EXT)) { - m_freem(m_new); - return (ENOBUFS); - } - m_new->m_len = m_new->m_pkthdr.len = MCLBYTES; - } else { - m_new = m; - m_new->m_len = m_new->m_pkthdr.len = MCLBYTES; - m_new->m_data = m_new->m_ext.ext_buf; + error = bus_dmamap_load_mbuf_sg(sc->ti_mbufrx_dmat, + sc->ti_cdata.ti_rx_std_sparemap, m, segs, &nsegs, 0); + if (error != 0) { + m_freem(m); + return (error); + } + KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); + + if (sc->ti_cdata.ti_rx_std_chain[i] != NULL) { + bus_dmamap_sync(sc->ti_mbufrx_dmat, + sc->ti_cdata.ti_rx_std_maps[i], BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->ti_mbufrx_dmat, + sc->ti_cdata.ti_rx_std_maps[i]); } - m_adj(m_new, ETHER_ALIGN); - sc->ti_cdata.ti_rx_std_chain[i] = m_new; - r = &sc->ti_rdata->ti_rx_std_ring[i]; map = sc->ti_cdata.ti_rx_std_maps[i]; - if (bus_dmamap_load_mbuf_sg(sc->ti_mbufrx_dmat, map, m_new, &segs, - &nsegs, 0)) - return (ENOBUFS); - if (nsegs != 1) - return (ENOBUFS); - ti_hostaddr64(&r->ti_addr, segs.ds_addr); - r->ti_len = segs.ds_len; + sc->ti_cdata.ti_rx_std_maps[i] = sc->ti_cdata.ti_rx_std_sparemap; + sc->ti_cdata.ti_rx_std_sparemap = map; + sc->ti_cdata.ti_rx_std_chain[i] = m; + + r = &sc->ti_rdata->ti_rx_std_ring[i]; + ti_hostaddr64(&r->ti_addr, segs[0].ds_addr); + r->ti_len = segs[0].ds_len; r->ti_type = TI_BDTYPE_RECV_BD; r->ti_flags = 0; + r->ti_vlan_tag = 0; + r->ti_tcp_udp_cksum = 0; if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; r->ti_idx = i; - bus_dmamap_sync(sc->ti_mbufrx_dmat, map, BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->ti_mbufrx_dmat, sc->ti_cdata.ti_rx_std_maps[i], + BUS_DMASYNC_PREREAD); return (0); } @@ -1270,111 +1207,112 @@ ti_newbuf_std(struct ti_softc *sc, int i * the Tigon 2. */ static int -ti_newbuf_mini(struct ti_softc *sc, int i, struct mbuf *m) +ti_newbuf_mini(struct ti_softc *sc, int i) { - bus_dma_segment_t segs; bus_dmamap_t map; - struct mbuf *m_new = NULL; + bus_dma_segment_t segs[1]; + struct mbuf *m; struct ti_rx_desc *r; - int nsegs; + int error, nsegs; - nsegs = 0; - if (m == NULL) { - MGETHDR(m_new, M_DONTWAIT, MT_DATA); - if (m_new == NULL) { - return (ENOBUFS); - } - m_new->m_len = m_new->m_pkthdr.len = MHLEN; - } else { - m_new = m; - m_new->m_data = m_new->m_pktdat; - m_new->m_len = m_new->m_pkthdr.len = MHLEN; + MGETHDR(m, M_DONTWAIT, MT_DATA); + if (m == NULL) + return (ENOBUFS); + m->m_len = m->m_pkthdr.len = MHLEN; + m_adj(m, ETHER_ALIGN); + + error = bus_dmamap_load_mbuf_sg(sc->ti_mbufrx_dmat, + sc->ti_cdata.ti_rx_mini_sparemap, m, segs, &nsegs, 0); + if (error != 0) { + m_freem(m); + return (error); + } + KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); + + if (sc->ti_cdata.ti_rx_mini_chain[i] != NULL) { + bus_dmamap_sync(sc->ti_mbufrx_dmat, + sc->ti_cdata.ti_rx_mini_maps[i], BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->ti_mbufrx_dmat, + sc->ti_cdata.ti_rx_mini_maps[i]); } - m_adj(m_new, ETHER_ALIGN); - r = &sc->ti_rdata->ti_rx_mini_ring[i]; - sc->ti_cdata.ti_rx_mini_chain[i] = m_new; map = sc->ti_cdata.ti_rx_mini_maps[i]; - if (bus_dmamap_load_mbuf_sg(sc->ti_mbufrx_dmat, map, m_new, &segs, - &nsegs, 0)) - return (ENOBUFS); - if (nsegs != 1) - return (ENOBUFS); - ti_hostaddr64(&r->ti_addr, segs.ds_addr); - r->ti_len = segs.ds_len; + sc->ti_cdata.ti_rx_mini_maps[i] = sc->ti_cdata.ti_rx_mini_sparemap; + sc->ti_cdata.ti_rx_mini_sparemap = map; + sc->ti_cdata.ti_rx_mini_chain[i] = m; + + r = &sc->ti_rdata->ti_rx_mini_ring[i]; + ti_hostaddr64(&r->ti_addr, segs[0].ds_addr); + r->ti_len = segs[0].ds_len; r->ti_type = TI_BDTYPE_RECV_BD; r->ti_flags = TI_BDFLAG_MINI_RING; + r->ti_vlan_tag = 0; + r->ti_tcp_udp_cksum = 0; if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; r->ti_idx = i; - bus_dmamap_sync(sc->ti_mbufrx_dmat, map, BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->ti_mbufrx_dmat, sc->ti_cdata.ti_rx_mini_maps[i], + BUS_DMASYNC_PREREAD); return (0); } -#ifdef TI_PRIVATE_JUMBOS +#ifndef TI_SF_BUF_JUMBO /* * Initialize a jumbo receive ring descriptor. This allocates * a jumbo buffer from the pool managed internally by the driver. */ static int -ti_newbuf_jumbo(struct ti_softc *sc, int i, struct mbuf *m) +ti_newbuf_jumbo(struct ti_softc *sc, int i, struct mbuf *dummy) { bus_dmamap_t map; - struct mbuf *m_new = NULL; + bus_dma_segment_t segs[1]; + struct mbuf *m; struct ti_rx_desc *r; - int nsegs; - bus_dma_segment_t segs; + int error, nsegs; - if (m == NULL) { - caddr_t *buf = NULL; + (void)dummy; - /* Allocate the mbuf. */ - MGETHDR(m_new, M_DONTWAIT, MT_DATA); - if (m_new == NULL) { - return (ENOBUFS); - } + m = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, MJUM9BYTES); + if (m == NULL) + return (ENOBUFS); + m->m_len = m->m_pkthdr.len = MJUM9BYTES; + m_adj(m, ETHER_ALIGN); - /* Allocate the jumbo buffer */ - buf = ti_jalloc(sc); - if (buf == NULL) { - m_freem(m_new); - device_printf(sc->ti_dev, "jumbo allocation failed " - "-- packet dropped!\n"); - return (ENOBUFS); - } + error = bus_dmamap_load_mbuf_sg(sc->ti_jumbo_dmat, + sc->ti_cdata.ti_rx_jumbo_sparemap, m, segs, &nsegs, 0); + if (error != 0) { + m_freem(m); + return (error); + } + KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); - /* Attach the buffer to the mbuf. */ - m_new->m_data = (void *) buf; - m_new->m_len = m_new->m_pkthdr.len = TI_JUMBO_FRAMELEN; - MEXTADD(m_new, buf, TI_JUMBO_FRAMELEN, ti_jfree, buf, - (struct ti_softc *)sc, 0, EXT_NET_DRV); - } else { - m_new = m; - m_new->m_data = m_new->m_ext.ext_buf; - m_new->m_ext.ext_size = TI_JUMBO_FRAMELEN; + if (sc->ti_cdata.ti_rx_jumbo_chain[i] != NULL) { + bus_dmamap_sync(sc->ti_jumbo_dmat, + sc->ti_cdata.ti_rx_jumbo_maps[i], BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->ti_jumbo_dmat, + sc->ti_cdata.ti_rx_jumbo_maps[i]); } - m_adj(m_new, ETHER_ALIGN); - /* Set up the descriptor. */ - r = &sc->ti_rdata->ti_rx_jumbo_ring[i]; - sc->ti_cdata.ti_rx_jumbo_chain[i] = m_new; map = sc->ti_cdata.ti_rx_jumbo_maps[i]; - if (bus_dmamap_load_mbuf_sg(sc->ti_jumbo_dmat, map, m_new, &segs, - &nsegs, 0)) - return (ENOBUFS); - if (nsegs != 1) - return (ENOBUFS); - ti_hostaddr64(&r->ti_addr, segs.ds_addr); - r->ti_len = segs.ds_len; + sc->ti_cdata.ti_rx_jumbo_maps[i] = sc->ti_cdata.ti_rx_jumbo_sparemap; + sc->ti_cdata.ti_rx_jumbo_sparemap = map; + sc->ti_cdata.ti_rx_jumbo_chain[i] = m; + + r = &sc->ti_rdata->ti_rx_jumbo_ring[i]; + ti_hostaddr64(&r->ti_addr, segs[0].ds_addr); + r->ti_len = segs[0].ds_len; r->ti_type = TI_BDTYPE_RECV_JUMBO_BD; r->ti_flags = TI_BDFLAG_JUMBO_RING; + r->ti_vlan_tag = 0; + r->ti_tcp_udp_cksum = 0; if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; r->ti_idx = i; - bus_dmamap_sync(sc->ti_jumbo_dmat, map, BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->ti_jumbo_dmat, sc->ti_cdata.ti_rx_jumbo_maps[i], + BUS_DMASYNC_PREREAD); return (0); } @@ -1554,13 +1492,13 @@ ti_init_rx_ring_std(struct ti_softc *sc) int i; struct ti_cmd_desc cmd; - for (i = 0; i < TI_SSLOTS; i++) { - if (ti_newbuf_std(sc, i, NULL) == ENOBUFS) + for (i = 0; i < TI_STD_RX_RING_CNT; i++) { + if (ti_newbuf_std(sc, i) != 0) return (ENOBUFS); }; - TI_UPDATE_STDPROD(sc, i - 1); - sc->ti_std = i - 1; + sc->ti_std = TI_STD_RX_RING_CNT - 1; + TI_UPDATE_STDPROD(sc, TI_STD_RX_RING_CNT - 1); return (0); } @@ -1592,12 +1530,12 @@ ti_init_rx_ring_jumbo(struct ti_softc *s int i; for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) { - if (ti_newbuf_jumbo(sc, i, NULL) == ENOBUFS) + if (ti_newbuf_jumbo(sc, i, NULL) != 0) return (ENOBUFS); }; - TI_UPDATE_JUMBOPROD(sc, i - 1); - sc->ti_jumbo = i - 1; + sc->ti_jumbo = TI_JUMBO_RX_RING_CNT - 1; + TI_UPDATE_JUMBOPROD(sc, TI_JUMBO_RX_RING_CNT - 1); return (0); } @@ -1627,13 +1565,13 @@ ti_init_rx_ring_mini(struct ti_softc *sc { int i; - for (i = 0; i < TI_MSLOTS; i++) { - if (ti_newbuf_mini(sc, i, NULL) == ENOBUFS) + for (i = 0; i < TI_MINI_RX_RING_CNT; i++) { + if (ti_newbuf_mini(sc, i) != 0) return (ENOBUFS); }; - TI_UPDATE_MINIPROD(sc, i - 1); - sc->ti_mini = i - 1; + sc->ti_mini = TI_MINI_RX_RING_CNT - 1; + TI_UPDATE_MINIPROD(sc, TI_MINI_RX_RING_CNT - 1); return (0); } @@ -2092,8 +2030,8 @@ ti_gibinit(struct ti_softc *sc) rcb = &sc->ti_rdata->ti_info.ti_jumbo_rx_rcb; TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_rx_jumbo_ring); -#ifdef TI_PRIVATE_JUMBOS - rcb->ti_max_len = TI_JUMBO_FRAMELEN; +#ifndef TI_SF_BUF_JUMBO + rcb->ti_max_len = MJUM9BYTES - ETHER_ALIGN; rcb->ti_flags = 0; #else rcb->ti_max_len = PAGE_SIZE; @@ -2406,7 +2344,6 @@ ti_attach(device_t dev) } if (ti_alloc_dmamaps(sc)) { - device_printf(dev, "dma map creation failed\n"); error = ENXIO; goto fail; } @@ -2550,11 +2487,6 @@ ti_detach(device_t dev) ti_free_dmamaps(sc); ifmedia_removeall(&sc->ifmedia); -#ifdef TI_PRIVATE_JUMBOS - if (sc->ti_cdata.ti_jumbo_buf) - bus_dmamem_free(sc->ti_jumbo_dmat, sc->ti_cdata.ti_jumbo_buf, - sc->ti_jumbo_dmamap); -#endif if (sc->ti_jumbo_dmat) bus_dma_tag_destroy(sc->ti_jumbo_dmat); if (sc->ti_mbuftx_dmat) @@ -2643,6 +2575,59 @@ ti_hdr_split(struct mbuf *top, int hdr_l } #endif /* TI_JUMBO_HDRSPLIT */ +static void +ti_discard_std(struct ti_softc *sc, int i) +{ + + struct ti_rx_desc *r; + + r = &sc->ti_rdata->ti_rx_std_ring[i]; + r->ti_len = MCLBYTES - ETHER_ALIGN; + r->ti_type = TI_BDTYPE_RECV_BD; + r->ti_flags = 0; + r->ti_vlan_tag = 0; + r->ti_tcp_udp_cksum = 0; + if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) + r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; + r->ti_idx = i; +} + +static void +ti_discard_mini(struct ti_softc *sc, int i) +{ + + struct ti_rx_desc *r; + + r = &sc->ti_rdata->ti_rx_mini_ring[i]; + r->ti_len = MHLEN - ETHER_ALIGN; + r->ti_type = TI_BDTYPE_RECV_BD; + r->ti_flags = TI_BDFLAG_MINI_RING; + r->ti_vlan_tag = 0; + r->ti_tcp_udp_cksum = 0; + if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) + r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; + r->ti_idx = i; +} + +#ifndef TI_SF_BUF_JUMBO +static void +ti_discard_jumbo(struct ti_softc *sc, int i) +{ + + struct ti_rx_desc *r; + + r = &sc->ti_rdata->ti_rx_mini_ring[i]; + r->ti_len = MJUM9BYTES - ETHER_ALIGN; + r->ti_type = TI_BDTYPE_RECV_JUMBO_BD; + r->ti_flags = TI_BDFLAG_JUMBO_RING; + r->ti_vlan_tag = 0; + r->ti_tcp_udp_cksum = 0; + if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) + r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; + r->ti_idx = i; +} +#endif + /* * Frame reception handling. This is called if there's a frame * on the receive return list. @@ -2658,9 +2643,11 @@ static void ti_rxeof(struct ti_softc *sc) { struct ifnet *ifp; +#ifdef TI_SF_BUF_JUMBO bus_dmamap_t map; +#endif struct ti_cmd_desc cmd; - int jumbocnt, minicnt, stdcnt; + int jumbocnt, minicnt, stdcnt, ti_len; TI_LOCK_ASSERT(sc); @@ -2677,6 +2664,7 @@ ti_rxeof(struct ti_softc *sc) cur_rx = &sc->ti_rdata->ti_rx_return_ring[sc->ti_rx_saved_considx]; rxidx = cur_rx->ti_idx; + ti_len = cur_rx->ti_len; TI_INC(sc->ti_rx_saved_considx, TI_RETURN_RING_CNT); if (cur_rx->ti_flags & TI_BDFLAG_VLAN_TAG) { @@ -2688,6 +2676,19 @@ ti_rxeof(struct ti_softc *sc) jumbocnt++; TI_INC(sc->ti_jumbo, TI_JUMBO_RX_RING_CNT); m = sc->ti_cdata.ti_rx_jumbo_chain[rxidx]; +#ifndef TI_SF_BUF_JUMBO + if (cur_rx->ti_flags & TI_BDFLAG_ERROR) { + ifp->if_ierrors++; + ti_discard_jumbo(sc, rxidx); + continue; + } + if (ti_newbuf_jumbo(sc, rxidx, NULL) != 0) { + ifp->if_iqdrops++; + ti_discard_jumbo(sc, rxidx); + continue; + } + m->m_len = ti_len; +#else /* !TI_SF_BUF_JUMBO */ sc->ti_cdata.ti_rx_jumbo_chain[rxidx] = NULL; map = sc->ti_cdata.ti_rx_jumbo_maps[rxidx]; bus_dmamap_sync(sc->ti_jumbo_dmat, map, @@ -2699,64 +2700,51 @@ ti_rxeof(struct ti_softc *sc) continue; } if (ti_newbuf_jumbo(sc, sc->ti_jumbo, NULL) == ENOBUFS) { - ifp->if_ierrors++; + ifp->if_iqdrops++; ti_newbuf_jumbo(sc, sc->ti_jumbo, m); continue; } -#ifdef TI_PRIVATE_JUMBOS - m->m_len = cur_rx->ti_len; -#else /* TI_PRIVATE_JUMBOS */ #ifdef TI_JUMBO_HDRSPLIT if (sc->ti_hdrsplit) ti_hdr_split(m, TI_HOSTADDR(cur_rx->ti_addr), - cur_rx->ti_len, rxidx); + ti_len, rxidx); else #endif /* TI_JUMBO_HDRSPLIT */ - m_adj(m, cur_rx->ti_len - m->m_pkthdr.len); -#endif /* TI_PRIVATE_JUMBOS */ + m_adj(m, ti_len - m->m_pkthdr.len); +#endif /* TI_SF_BUF_JUMBO */ } else if (cur_rx->ti_flags & TI_BDFLAG_MINI_RING) { minicnt++; TI_INC(sc->ti_mini, TI_MINI_RX_RING_CNT); m = sc->ti_cdata.ti_rx_mini_chain[rxidx]; - sc->ti_cdata.ti_rx_mini_chain[rxidx] = NULL; - map = sc->ti_cdata.ti_rx_mini_maps[rxidx]; - bus_dmamap_sync(sc->ti_mbufrx_dmat, map, - BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(sc->ti_mbufrx_dmat, map); if (cur_rx->ti_flags & TI_BDFLAG_ERROR) { ifp->if_ierrors++; - ti_newbuf_mini(sc, sc->ti_mini, m); + ti_discard_mini(sc, rxidx); continue; } - if (ti_newbuf_mini(sc, sc->ti_mini, NULL) == ENOBUFS) { - ifp->if_ierrors++; - ti_newbuf_mini(sc, sc->ti_mini, m); + if (ti_newbuf_mini(sc, rxidx) != 0) { + ifp->if_iqdrops++; + ti_discard_mini(sc, rxidx); continue; } - m->m_len = cur_rx->ti_len; + m->m_len = ti_len; } else { stdcnt++; TI_INC(sc->ti_std, TI_STD_RX_RING_CNT); m = sc->ti_cdata.ti_rx_std_chain[rxidx]; - sc->ti_cdata.ti_rx_std_chain[rxidx] = NULL; - map = sc->ti_cdata.ti_rx_std_maps[rxidx]; - bus_dmamap_sync(sc->ti_mbufrx_dmat, map, - BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(sc->ti_mbufrx_dmat, map); if (cur_rx->ti_flags & TI_BDFLAG_ERROR) { ifp->if_ierrors++; - ti_newbuf_std(sc, sc->ti_std, m); + ti_discard_std(sc, rxidx); continue; } - if (ti_newbuf_std(sc, sc->ti_std, NULL) == ENOBUFS) { - ifp->if_ierrors++; - ti_newbuf_std(sc, sc->ti_std, m); + if (ti_newbuf_std(sc, rxidx) != 0) { + ifp->if_iqdrops++; + ti_discard_std(sc, rxidx); continue; } - m->m_len = cur_rx->ti_len; + m->m_len = ti_len; } - m->m_pkthdr.len = cur_rx->ti_len; + m->m_pkthdr.len = ti_len; ifp->if_ipackets++; m->m_pkthdr.rcvif = ifp; Modified: stable/7/sys/dev/ti/if_tireg.h ============================================================================== --- stable/7/sys/dev/ti/if_tireg.h Tue Jan 3 21:17:59 2012 (r229433) +++ stable/7/sys/dev/ti/if_tireg.h Tue Jan 3 21:21:25 2012 (r229434) @@ -887,23 +887,6 @@ struct ti_event_desc { #define TI_CLRBIT(sc, reg, x) \ CSR_WRITE_4((sc), (reg), (CSR_READ_4((sc), (reg)) & ~(x))) -/* - * Memory management stuff. Note: the SSLOTS, MSLOTS and JSLOTS - * values are tuneable. They control the actual amount of buffers - * allocated for the standard, mini and jumbo receive rings. - */ - -#define TI_SSLOTS 256 -#define TI_MSLOTS 256 -#define TI_JSLOTS 256 - -#define TI_JRAWLEN (TI_JUMBO_FRAMELEN + ETHER_ALIGN) -#define TI_JLEN (TI_JRAWLEN + (sizeof(uint64_t) - \ - (TI_JRAWLEN % sizeof(uint64_t)))) -#define TI_JPAGESZ PAGE_SIZE -#define TI_RESID (TI_JPAGESZ - (TI_JLEN * TI_JSLOTS) % TI_JPAGESZ) -#define TI_JMEM ((TI_JLEN * TI_JSLOTS) + TI_RESID) - struct ti_txdesc { struct mbuf *tx_m; bus_dmamap_t tx_dmamap; @@ -920,7 +903,7 @@ STAILQ_HEAD(ti_txdq, ti_txdesc); */ struct ti_ring_data { struct ti_rx_desc ti_rx_std_ring[TI_STD_RX_RING_CNT]; -#ifdef TI_PRIVATE_JUMBOS +#ifndef TI_SF_BUF_JUMBO struct ti_rx_desc ti_rx_jumbo_ring[TI_JUMBO_RX_RING_CNT]; #else struct ti_rx_desc_ext ti_rx_jumbo_ring[TI_JUMBO_RX_RING_CNT]; @@ -955,13 +938,13 @@ struct ti_chain_data { struct ti_txdq ti_txbusyq; struct mbuf *ti_rx_std_chain[TI_STD_RX_RING_CNT]; bus_dmamap_t ti_rx_std_maps[TI_STD_RX_RING_CNT]; + bus_dmamap_t ti_rx_std_sparemap; struct mbuf *ti_rx_jumbo_chain[TI_JUMBO_RX_RING_CNT]; bus_dmamap_t ti_rx_jumbo_maps[TI_JUMBO_RX_RING_CNT]; + bus_dmamap_t ti_rx_jumbo_sparemap; struct mbuf *ti_rx_mini_chain[TI_MINI_RX_RING_CNT]; bus_dmamap_t ti_rx_mini_maps[TI_MINI_RX_RING_CNT]; - /* Stick the jumbo mem management stuff here too. */ - caddr_t ti_jslots[TI_JSLOTS]; - void *ti_jumbo_buf; + bus_dmamap_t ti_rx_mini_sparemap; }; struct ti_type { @@ -980,11 +963,6 @@ struct ti_mc_entry { SLIST_ENTRY(ti_mc_entry) mc_entries; }; -struct ti_jpool_entry { - int slot; - SLIST_ENTRY(ti_jpool_entry) jpool_entries; -}; - typedef enum { TI_FLAG_NONE = 0x00, TI_FLAG_DEBUGING = 0x01, @@ -1006,7 +984,6 @@ struct ti_softc { int ti_hdrsplit; /* enable header splitting */ bus_dma_tag_t ti_parent_dmat; bus_dma_tag_t ti_jumbo_dmat; - bus_dmamap_t ti_jumbo_dmamap; bus_dma_tag_t ti_mbuftx_dmat; bus_dma_tag_t ti_mbufrx_dmat; bus_dma_tag_t ti_rdata_dmat; @@ -1026,8 +1003,6 @@ struct ti_softc { int ti_mini; /* current mini ring head */ int ti_jumbo; /* current jumo ring head */ SLIST_HEAD(__ti_mchead, ti_mc_entry) ti_mc_listhead; - SLIST_HEAD(__ti_jfreehead, ti_jpool_entry) ti_jfree_listhead; - SLIST_HEAD(__ti_jinusehead, ti_jpool_entry) ti_jinuse_listhead; uint32_t ti_stat_ticks; uint32_t ti_rx_coal_ticks; uint32_t ti_tx_coal_ticks; From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 21:45:35 2012 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 837D0106567B; Tue, 3 Jan 2012 21:45:35 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 594D08FC1D; Tue, 3 Jan 2012 21:45:35 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id 1170746B2D; Tue, 3 Jan 2012 16:45:35 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 68CC9B949; Tue, 3 Jan 2012 16:45:34 -0500 (EST) From: John Baldwin To: "Pedro F. Giffuni" Date: Tue, 3 Jan 2012 16:15:06 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p8; KDE/4.5.5; amd64; ; ) References: <201201032104.q03L4sTm043158@svn.freebsd.org> In-Reply-To: <201201032104.q03L4sTm043158@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201201031615.06873.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 03 Jan 2012 16:45:34 -0500 (EST) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, joel@freebsd.org Subject: Re: svn commit: r229430 - in head/sys: conf dev/sound/pci modules/sound/driver/emu10k1 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, 03 Jan 2012 21:45:35 -0000 On Tuesday, January 03, 2012 4:04:54 pm Pedro F. Giffuni wrote: > Author: pfg > Date: Tue Jan 3 21:04:54 2012 > New Revision: 229430 > URL: http://svn.freebsd.org/changeset/base/229430 > > Log: > Replace a GPL'd header in the emu10k1 snd driver code. > > This brings in the emuxkireg.h from NetBSD (dev/pci) which > is used for the same purpose but is smaller. The emu10k1 > is now free from the GPL. Is this a common-enough chipset to enable in GENERIC now that it is safe to do so? -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 21:48:25 2012 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 9E7F4106567B; Tue, 3 Jan 2012 21:48:25 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from mx0.hoeg.nl (mx0.hoeg.nl [IPv6:2a01:4f8:101:5343::aa]) by mx1.freebsd.org (Postfix) with ESMTP id 387808FC0C; Tue, 3 Jan 2012 21:48:25 +0000 (UTC) Received: by mx0.hoeg.nl (Postfix, from userid 1000) id 701E12A28DEC; Tue, 3 Jan 2012 22:48:24 +0100 (CET) Date: Tue, 3 Jan 2012 22:48:24 +0100 From: Ed Schouten To: John Baldwin Message-ID: <20120103214824.GK1895@hoeg.nl> References: <201201032104.q03L4sTm043158@svn.freebsd.org> <201201031615.06873.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Oe/xgtOcljDBCKHf" Content-Disposition: inline In-Reply-To: <201201031615.06873.jhb@freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, "Pedro F. Giffuni" , src-committers@freebsd.org, joel@freebsd.org Subject: Re: svn commit: r229430 - in head/sys: conf dev/sound/pci modules/sound/driver/emu10k1 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, 03 Jan 2012 21:48:25 -0000 --Oe/xgtOcljDBCKHf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi John, * John Baldwin , 20120103 22:15: > Is this a common-enough chipset to enable in GENERIC now that it is safe = to > do so? I would guess so, especially on i386 boxes. --=20 Ed Schouten WWW: http://80386.nl/ --Oe/xgtOcljDBCKHf Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iQIcBAEBAgAGBQJPA3eoAAoJEG5e2P40kaK7RdoP/2y+r4Gwey7iPPyED921c++j n08rsMtUq9YdmbpNt94r96Ti4dCgi+R7SpjyuJODGeiCZdrOwbaIrdAtYru5cw46 94tmt6W3F8GXe07GWsaBcXNdmhFG7QyJuJZF31TjlijdoyWS51Znu06l37RHELHu E31/fAbNBi3LWdGHFYhGMeVUL8g19H20PDS2sH1Edkk8E2nDnOLE3ozAwojZCGxP 3Sykk7b8gfbWY0OGaKhwfJyyOy3RVFv7MCl5mP9i08XNsxtXUVgFEAoFggXDZPXx fhzYoZkJNj56beAao9M3VSfUlwfWWjz0JNf63o2vQum3C5H4DjurkWZyrOlLYIJd 4ZFrgckvmNf+1ALwd0+QIlhasWp4lczvQfe1hTI8mRl+ou/L4QAixg/KjwismeDf x06vhT7E3dC+ZhEGVSyTH5IblCIv/eSifSHPOM5iuDzyAp1DfFu/YCwIKoo029BX Bq+QPPXR8eVV5auIjL/8pssPadOXT43kvcxtnshgBNbveO4pT394Hxqhj4yJc2zF ib79XOWejY2CISIbLC/omUyLxIf84ihBtsGOqogSSF1F9e+6LY/Kk2GlKe68g1nm 8vYisUGFvKnTqYMECa4AADS3TsqvviU+Yn+Lyb2iqMs43xYi5p2Ghg4xvxPA836O JWGnBGbSBcccpNxCvd0e =ndZU -----END PGP SIGNATURE----- --Oe/xgtOcljDBCKHf-- From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 22:21:39 2012 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 E9B5F106564A; Tue, 3 Jan 2012 22:21:39 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-tul01m020-f182.google.com (mail-tul01m020-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 6C8148FC18; Tue, 3 Jan 2012 22:21:39 +0000 (UTC) Received: by obbwd18 with SMTP id wd18so19396001obb.13 for ; Tue, 03 Jan 2012 14:21:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=wycnfdiWcKRp4Ug3yJeX+tvz3pwXgw4CO2MnvIOnimk=; b=hXt/IYGhqO2YVwfO81ONruj8suduQLwJqpfyqiW4nS+pp5zxzniFIhd9VL0u+CkCI6 Zna9gVSiTj0ZgGpHG+elTzMWGTqbex49xyJM6liZwIuF5iLsAJ0TNJPDeIWlH48pTxqi l/Ads6/vOv+2gHEO1SBndIXQ2FXKRHle/k9JY= MIME-Version: 1.0 Received: by 10.182.164.106 with SMTP id yp10mr3503924obb.71.1325629298950; Tue, 03 Jan 2012 14:21:38 -0800 (PST) Received: by 10.182.152.6 with HTTP; Tue, 3 Jan 2012 14:21:38 -0800 (PST) In-Reply-To: <1325629000.43247.YahooMailClassic@web113515.mail.gq1.yahoo.com> References: <201201031615.06873.jhb@freebsd.org> <1325629000.43247.YahooMailClassic@web113515.mail.gq1.yahoo.com> Date: Tue, 3 Jan 2012 14:21:38 -0800 Message-ID: From: Garrett Cooper To: pfg@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, John Baldwin , joel@freebsd.org Subject: Re: svn commit: r229430 - in head/sys: conf dev/sound/pci modules/sound/driver/emu10k1 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, 03 Jan 2012 22:21:40 -0000 On Tue, Jan 3, 2012 at 2:16 PM, Pedro Giffuni wrote: > Hi; > > --- Mar 3/1/12, John Baldwin ha scritto: > ... >> On Tuesday, January 03, 2012 4:04:54 >> pm Pedro F. Giffuni wrote: >> > Author: pfg >> > Date: Tue Jan=A0 3 21:04:54 2012 >> > New Revision: 229430 >> > URL: http://svn.freebsd.org/changeset/base/229430 >> > >> > Log: >> >=A0=A0=A0Replace a GPL'd header in the emu10k1 >> snd driver code. >> > >> >=A0=A0=A0This brings in the emuxkireg.h from >> NetBSD (dev/pci) which >> >=A0=A0=A0is used for the same purpose but is >> smaller. The emu10k1 >> >=A0=A0=A0is now free from the GPL. >> >> Is this a common-enough chipset to enable in GENERIC now >> that it is safe to do so? >> > > It's probably very common in PC emulators so it will be > important to MFC into stable. > > FWIW, two other cards (maestro3 and csaimg) are based on > headers from OSS that are now under a BSD license. > > The maestro3 is done (kern/153920) and is next in my > list but it's getting difficult to find testers for > this old stuff. Can the same be done for emu10kx ? Someday it would be nice to have xfi support in the tree, but that's a missing driver that even the OSS maintainer was scared to touch because of the complexity of the code. Thanks! -Garrett From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 22:29:01 2012 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 425B4106566B for ; Tue, 3 Jan 2012 22:29:01 +0000 (UTC) (envelope-from pfg@freebsd.org) Received: from nm6.bullet.mail.sp2.yahoo.com (nm6.bullet.mail.sp2.yahoo.com [98.139.91.76]) by mx1.freebsd.org (Postfix) with SMTP id 19FE48FC08 for ; Tue, 3 Jan 2012 22:29:00 +0000 (UTC) Received: from [98.139.91.67] by nm6.bullet.mail.sp2.yahoo.com with NNFMP; 03 Jan 2012 22:16:41 -0000 Received: from [72.30.22.76] by tm7.bullet.mail.sp2.yahoo.com with NNFMP; 03 Jan 2012 22:16:41 -0000 Received: from [127.0.0.1] by omp1070.mail.sp2.yahoo.com with NNFMP; 03 Jan 2012 22:16:41 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 100481.61952.bm@omp1070.mail.sp2.yahoo.com Received: (qmail 57176 invoked by uid 60001); 3 Jan 2012 22:16:40 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1325629000; bh=GctYWR7EMhAUf6UpWHYbGSMHwHQBOBYEAufesNqDgwc=; h=X-YMail-OSG:Received:X-RocketYMMF:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=2LqQ5sWe8+8Pb/1OctqP8t7GKjnPnZm73gwHC2LSJQZPnLjB6oWSWGQ2FP4qKtGkXVMCXMjThcQYuJqprqKWK+l1JLz8RskQK3b81Bv81z33UYX9IlyxwGJdeYkpuh4euGFra3s9072uDxwUAhbx7uZjOycxkOIImM50wpO3GgY= X-YMail-OSG: 6URbJaIVM1mQXApBF3EW6iPg9io_HcaHzWG9EzZNNntoreY KmgVHTmrXB6ZIKy4_2eo4UsPU9RN7sk4HEYb55WP0tVDcVV5_NDQwZF_hxtj xbtpWsVtR0cX1aTutHZiU9pE8X.x0KGsPUH3O6wRoMgnYAWkWrPxeUifdXh6 rC8qFOIuLyBC9tn_AURQB7dGqTH.xdkWCkKc2hlUUKyh2bufZSPJcZoFaSNQ q5JGM2tfi0WNSNf10dAJsqDo30weI0A.PcORnDQ4on2pdIf95PfBkf1T25.J wlnO4IKlYrHWo7Wlhmz1VT5XwfT4L5qLr1RVZAS95S5Keb1s8MVESjdyvtFl WegX8dny1hgCzAyRJe6yO_g5b2BHUc70epAO0W2gRCXMVak2UVZuTwaUaT1l 434k7.qdS0svGyInJy7LOJg9FTftjeCNmrGYf03Iu6W6XFGOZsXNkN9znzpi vpiWitTZc4zMRDfgbzuO7pHy36A-- Received: from [200.118.157.7] by web113515.mail.gq1.yahoo.com via HTTP; Tue, 03 Jan 2012 14:16:40 PST X-RocketYMMF: giffunip X-Mailer: YahooMailClassic/15.0.4 YahooMailWebService/0.8.115.331698 Message-ID: <1325629000.43247.YahooMailClassic@web113515.mail.gq1.yahoo.com> Date: Tue, 3 Jan 2012 14:16:40 -0800 (PST) From: Pedro Giffuni To: John Baldwin In-Reply-To: <201201031615.06873.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, joel@freebsd.org Subject: Re: svn commit: r229430 - in head/sys: conf dev/sound/pci modules/sound/driver/emu10k1 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: pfg@freebsd.org 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, 03 Jan 2012 22:29:01 -0000 Hi;=0A=0A--- Mar 3/1/12, John Baldwin ha scritto:=0A...= =0A> On Tuesday, January 03, 2012 4:04:54=0A> pm Pedro F. Giffuni wrote:=0A= > > Author: pfg=0A> > Date: Tue Jan=A0 3 21:04:54 2012=0A> > New Revision: = 229430=0A> > URL: http://svn.freebsd.org/changeset/base/229430=0A> > =0A> >= Log:=0A> >=A0=A0=A0Replace a GPL'd header in the emu10k1=0A> snd driver co= de.=0A> >=A0=A0=A0=0A> >=A0=A0=A0This brings in the emuxkireg.h from=0A> Ne= tBSD (dev/pci) which=0A> >=A0=A0=A0is used for the same purpose but is=0A> = smaller. The emu10k1=0A> >=A0=A0=A0is now free from the GPL.=0A> =0A> Is th= is a common-enough chipset to enable in GENERIC now=0A> that it is safe to = do so?=0A> =0A=0AIt's probably very common in PC emulators so it will be=0A= important to MFC into stable.=0A=0AFWIW, two other cards (maestro3 and csai= mg) are based on=0Aheaders from OSS that are now under a BSD license.=0A=0A= The maestro3 is done (kern/153920) and is next in my=0Alist but it's gettin= g difficult to find testers for=0Athis old stuff.=0A=0ACheers,=0A=0APedro.= =0A From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 22:36:12 2012 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 79E05106564A; Tue, 3 Jan 2012 22:36:12 +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 5E3998FC08; Tue, 3 Jan 2012 22:36:12 +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 q03MaCqI046225; Tue, 3 Jan 2012 22:36:12 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03MaCNM046221; Tue, 3 Jan 2012 22:36:12 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201032236.q03MaCNM046221@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 3 Jan 2012 22:36:12 +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: r229435 - head/sys/boot/i386/libi386 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, 03 Jan 2012 22:36:12 -0000 Author: kib Date: Tue Jan 3 22:36:12 2012 New Revision: 229435 URL: http://svn.freebsd.org/changeset/base/229435 Log: Add special loader environment variables 'comconsole_port' and 'comconsole_pcidev'. The former allows to set the base address of the serial console i/o port. The later takes the string of the format 'bus:device:function:[bar]' as a value and uses the serial port attached as PCI device at the specified location for console. Both variants pass 'hw.uart.console' variable to the uart driver to properly hand-over the kernel console. Change allows to use ISA serial ports other than COM1 for the loader/kernel console without loader recompilation. Also, you can use PCI-attached port as the console, e.g. Intel AMT serial pseudo-port on some motherboards based on Q67 chipset. Reviewed by: jhb MFC after: 2 weeks Modified: head/sys/boot/i386/libi386/biospci.c head/sys/boot/i386/libi386/comconsole.c head/sys/boot/i386/libi386/libi386.h Modified: head/sys/boot/i386/libi386/biospci.c ============================================================================== --- head/sys/boot/i386/libi386/biospci.c Tue Jan 3 21:21:25 2012 (r229434) +++ head/sys/boot/i386/libi386/biospci.c Tue Jan 3 22:36:12 2012 (r229435) @@ -342,3 +342,9 @@ biospci_read_config(uint32_t locator, in return (0); } +uint32_t +biospci_locator(int8_t bus, uint8_t device, uint8_t function) +{ + + return ((bus << 8) | ((device & 0x1f) << 3) | (function & 0x7)); +} Modified: head/sys/boot/i386/libi386/comconsole.c ============================================================================== --- head/sys/boot/i386/libi386/comconsole.c Tue Jan 3 21:21:25 2012 (r229434) +++ head/sys/boot/i386/libi386/comconsole.c Tue Jan 3 22:36:12 2012 (r229435) @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "libi386.h" #define COMC_FMT 0x3 /* 8N1 */ @@ -49,14 +50,23 @@ static int comc_init(int arg); static void comc_putchar(int c); static int comc_getchar(void); static int comc_getspeed(void); +static void set_hw_console_hint(void); static int comc_ischar(void); -static int comc_parsespeed(const char *string); -static void comc_setup(int speed); +static int comc_parseint(const char *string); +static uint32_t comc_parse_pcidev(const char *string); +static int comc_pcidev_set(struct env_var *ev, int flags, + const void *value); +static int comc_pcidev_handle(uint32_t locator); +static int comc_port_set(struct env_var *ev, int flags, + const void *value); +static void comc_setup(int speed, int port); static int comc_speed_set(struct env_var *ev, int flags, const void *value); static int comc_started; static int comc_curspeed; +static int comc_port = COMPORT; +static uint32_t comc_locator; struct console comconsole = { "comconsole", @@ -72,9 +82,10 @@ struct console comconsole = { static void comc_probe(struct console *cp) { - char speedbuf[16]; - char *cons, *speedenv; - int speed; + char intbuf[16]; + char *cons, *env; + int speed, port; + uint32_t locator; /* XXX check the BIOS equipment list? */ cp->c_flags |= (C_PRESENTIN | C_PRESENTOUT); @@ -90,16 +101,40 @@ comc_probe(struct console *cp) getenv("boot_multicons") != NULL) { comc_curspeed = comc_getspeed(); } - speedenv = getenv("comconsole_speed"); - if (speedenv != NULL) { - speed = comc_parsespeed(speedenv); + + env = getenv("comconsole_speed"); + if (env != NULL) { + speed = comc_parseint(env); if (speed > 0) comc_curspeed = speed; } - sprintf(speedbuf, "%d", comc_curspeed); + sprintf(intbuf, "%d", comc_curspeed); unsetenv("comconsole_speed"); - env_setenv("comconsole_speed", EV_VOLATILE, speedbuf, comc_speed_set, + env_setenv("comconsole_speed", EV_VOLATILE, intbuf, comc_speed_set, + env_nounset); + + env = getenv("comconsole_port"); + if (env != NULL) { + port = comc_parseint(env); + if (port > 0) + comc_port = port; + } + + sprintf(intbuf, "%d", comc_port); + unsetenv("comconsole_port"); + env_setenv("comconsole_port", EV_VOLATILE, intbuf, comc_port_set, + env_nounset); + + env = getenv("comconsole_pcidev"); + if (env != NULL) { + locator = comc_parse_pcidev(env); + if (locator != 0) + comc_pcidev_handle(locator); + } + + unsetenv("comconsole_pcidev"); + env_setenv("comconsole_pcidev", EV_VOLATILE, env, comc_pcidev_set, env_nounset); } } @@ -111,7 +146,7 @@ comc_init(int arg) return 0; comc_started = 1; - comc_setup(comc_curspeed); + comc_setup(comc_curspeed, comc_port); return(0); } @@ -122,8 +157,8 @@ comc_putchar(int c) int wait; for (wait = COMC_TXWAIT; wait > 0; wait--) - if (inb(COMPORT + com_lsr) & LSR_TXRDY) { - outb(COMPORT + com_data, (u_char)c); + if (inb(comc_port + com_lsr) & LSR_TXRDY) { + outb(comc_port + com_data, (u_char)c); break; } } @@ -131,13 +166,13 @@ comc_putchar(int c) static int comc_getchar(void) { - return(comc_ischar() ? inb(COMPORT + com_data) : -1); + return(comc_ischar() ? inb(comc_port + com_data) : -1); } static int comc_ischar(void) { - return(inb(COMPORT + com_lsr) & LSR_RXRDY); + return(inb(comc_port + com_lsr) & LSR_RXRDY); } static int @@ -145,13 +180,33 @@ comc_speed_set(struct env_var *ev, int f { int speed; - if (value == NULL || (speed = comc_parsespeed(value)) <= 0) { + if (value == NULL || (speed = comc_parseint(value)) <= 0) { printf("Invalid speed\n"); return (CMD_ERROR); } if (comc_started && comc_curspeed != speed) - comc_setup(speed); + comc_setup(speed, comc_port); + + env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); + + return (CMD_OK); +} + +static int +comc_port_set(struct env_var *ev, int flags, const void *value) +{ + int port; + + if (value == NULL || (port = comc_parseint(value)) <= 0) { + printf("Invalid port\n"); + return (CMD_ERROR); + } + + if (comc_started && comc_port != port) { + comc_setup(comc_curspeed, port); + set_hw_console_hint(); + } env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); @@ -159,24 +214,126 @@ comc_speed_set(struct env_var *ev, int f } static void -comc_setup(int speed) +set_hw_console_hint(void) +{ + char intbuf[64]; + + unsetenv("hw.uart.console"); + sprintf(intbuf, "io:%d,br:%d", comc_port, comc_curspeed); + env_setenv("hw.uart.console", EV_VOLATILE, intbuf, + env_noset, env_nounset); +} + +/* + * Input: bus:dev:func[:bar]. If bar is not specified, it is 0x10. + * Output: bar[24:16] bus[15:8] dev[7:3] func[2:0] + */ +static uint32_t +comc_parse_pcidev(const char *string) +{ + char *p, *p1; + uint8_t bus, dev, func, bar; + uint32_t locator; + int pres; + + pres = strtol(string, &p, 0); + if (p == string || *p != ':' || pres < 0 ) + return (0); + bus = pres; + p1 = ++p; + + pres = strtol(p1, &p, 0); + if (p == string || *p != ':' || pres < 0 ) + return (0); + dev = pres; + p1 = ++p; + + pres = strtol(p1, &p, 0); + if (p == string || (*p != ':' && *p != '\0') || pres < 0 ) + return (0); + func = pres; + + if (*p == ':') { + p1 = ++p; + pres = strtol(p1, &p, 0); + if (p == string || *p != '\0' || pres <= 0 ) + return (0); + bar = pres; + } else + bar = 0x10; + + locator = (bar << 16) | biospci_locator(bus, dev, func); + return (locator); +} + +static int +comc_pcidev_handle(uint32_t locator) +{ + char intbuf[64]; + uint32_t port; + + if (biospci_read_config(locator & 0xffff, + (locator & 0xff0000) >> 16, 2, &port) == -1) { + printf("Cannot read bar at 0x%x\n", locator); + return (CMD_ERROR); + } + if (!PCI_BAR_IO(port)) { + printf("Memory bar at 0x%x\n", locator); + return (CMD_ERROR); + } + port &= PCIM_BAR_IO_BASE; + + sprintf(intbuf, "%d", port); + unsetenv("comconsole_port"); + env_setenv("comconsole_port", EV_VOLATILE, intbuf, + comc_port_set, env_nounset); + + comc_setup(comc_curspeed, port); + set_hw_console_hint(); + comc_locator = locator; + + return (CMD_OK); +} + +static int +comc_pcidev_set(struct env_var *ev, int flags, const void *value) +{ + uint32_t locator; + int error; + + if (value == NULL || (locator = comc_parse_pcidev(value)) <= 0) { + printf("Invalid pcidev\n"); + return (CMD_ERROR); + } + if (comc_started && comc_locator != locator) { + error = comc_pcidev_handle(locator); + if (error != CMD_OK) + return (error); + } + env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); + return (CMD_OK); +} + +static void +comc_setup(int speed, int port) { comc_curspeed = speed; + comc_port = port; - outb(COMPORT + com_cfcr, CFCR_DLAB | COMC_FMT); - outb(COMPORT + com_dlbl, COMC_BPS(speed) & 0xff); - outb(COMPORT + com_dlbh, COMC_BPS(speed) >> 8); - outb(COMPORT + com_cfcr, COMC_FMT); - outb(COMPORT + com_mcr, MCR_RTS | MCR_DTR); + outb(comc_port + com_cfcr, CFCR_DLAB | COMC_FMT); + outb(comc_port + com_dlbl, COMC_BPS(speed) & 0xff); + outb(comc_port + com_dlbh, COMC_BPS(speed) >> 8); + outb(comc_port + com_cfcr, COMC_FMT); + outb(comc_port + com_mcr, MCR_RTS | MCR_DTR); do - inb(COMPORT + com_data); - while (inb(COMPORT + com_lsr) & LSR_RXRDY); + inb(comc_port + com_data); + while (inb(comc_port + com_lsr) & LSR_RXRDY); } static int -comc_parsespeed(const char *speedstr) +comc_parseint(const char *speedstr) { char *p; int speed; @@ -196,13 +353,13 @@ comc_getspeed(void) u_char dlbl; u_char cfcr; - cfcr = inb(COMPORT + com_cfcr); - outb(COMPORT + com_cfcr, CFCR_DLAB | cfcr); + cfcr = inb(comc_port + com_cfcr); + outb(comc_port + com_cfcr, CFCR_DLAB | cfcr); - dlbl = inb(COMPORT + com_dlbl); - dlbh = inb(COMPORT + com_dlbh); + dlbl = inb(comc_port + com_dlbl); + dlbh = inb(comc_port + com_dlbh); - outb(COMPORT + com_cfcr, cfcr); + outb(comc_port + com_cfcr, cfcr); divisor = dlbh << 8 | dlbl; Modified: head/sys/boot/i386/libi386/libi386.h ============================================================================== --- head/sys/boot/i386/libi386/libi386.h Tue Jan 3 21:21:25 2012 (r229434) +++ head/sys/boot/i386/libi386/libi386.h Tue Jan 3 22:36:12 2012 (r229435) @@ -97,6 +97,7 @@ extern vm_offset_t high_heap_base; /* fo int biospci_find_devclass(uint32_t class, int index, uint32_t *locator); int biospci_write_config(uint32_t locator, int offset, int width, uint32_t val); int biospci_read_config(uint32_t locator, int offset, int width, uint32_t *val); +uint32_t biospci_locator(int8_t bus, uint8_t device, uint8_t function); void biosacpi_detect(void); From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 22:45:29 2012 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 BF2FE106566C for ; Tue, 3 Jan 2012 22:45:29 +0000 (UTC) (envelope-from pfg@freebsd.org) Received: from nm24.bullet.mail.sp2.yahoo.com (nm24.bullet.mail.sp2.yahoo.com [98.139.91.94]) by mx1.freebsd.org (Postfix) with SMTP id 959EB8FC14 for ; Tue, 3 Jan 2012 22:45:29 +0000 (UTC) Received: from [98.139.91.64] by nm24.bullet.mail.sp2.yahoo.com with NNFMP; 03 Jan 2012 22:45:29 -0000 Received: from [98.139.91.9] by tm4.bullet.mail.sp2.yahoo.com with NNFMP; 03 Jan 2012 22:44:34 -0000 Received: from [127.0.0.1] by omp1009.mail.sp2.yahoo.com with NNFMP; 03 Jan 2012 22:44:34 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 325249.95794.bm@omp1009.mail.sp2.yahoo.com Received: (qmail 92817 invoked by uid 60001); 3 Jan 2012 22:44:33 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1325630673; bh=0ZaM9rZdSug1EXP4z4KRuUnD+abcHblhhdGFNUr2g0o=; h=X-YMail-OSG:Received:X-RocketYMMF:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=NYsO/1xGXkV8A3fuuhJshsgZpau822hIOxVdGYrWClDdRkLHlFAWjxWgsxyKLNDzkhBk3ijcXuUN0RLAnibNnDRlRCcrU/0hjPiW6I4+Yx7IHp5+xwUVEmm9f1ta7VrrojrGg+Dsfc/DsZAtrj35Z2PZzbPQWHeJVaWwV+XpZEY= X-YMail-OSG: yTVES1sVM1laz.yYnWHWIzkYykzQ77fVIyacY4pRX.ekHX. lBx6qvQWnq9w3zLJekwetBLpDFQu5TwMIF3CHP.snDXAfwUwYyHcb4wdUaEj h36WmNyU2MlrYhqw1o7VvtBZYFKdwkgY_AvvEMLpdd3TwT.LwzDgnnXYknjR FDihgbfzHqwkoWuhCg_GoVMGvOkTBPz0ifxZGdllc_7mo7MwROVze.WIhFmm 5tLTvGvLVjib2Ex1UUdFlbwlsPzHJnBg_b_NxNF8sYyD4EbfdcBHOud_VF60 hQstH08f4nvpLw7ITqmGmQVphvxO_C4_NaUObcFATV9j93oOuqVRgRLIKexQ tzLJDa9XUoNSOgyMlAKaOa3yHeBLx3AaBUVmgLNoeYaZVdBR_KFl7v_Drasb jdKcoVwRU29DfO8wyznKfW.VRlQnv.Rft.DVa9SFjfgB3fLj8qa1pKC3PCus J.erkeoL5p4uifKL3JOjnSH0- Received: from [200.118.157.7] by web113514.mail.gq1.yahoo.com via HTTP; Tue, 03 Jan 2012 14:44:33 PST X-RocketYMMF: giffunip X-Mailer: YahooMailClassic/15.0.4 YahooMailWebService/0.8.115.331698 Message-ID: <1325630673.90694.YahooMailClassic@web113514.mail.gq1.yahoo.com> Date: Tue, 3 Jan 2012 14:44:33 -0800 (PST) From: Pedro Giffuni To: Garrett Cooper In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, John Baldwin , joel@freebsd.org Subject: Re: svn commit: r229430 - in head/sys: conf dev/sound/pci modules/sound/driver/emu10k1 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: pfg@freebsd.org 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, 03 Jan 2012 22:45:29 -0000 =0A=0A--- Mar 3/1/12, Garrett Cooper ha scritto:=0A...= =0A> =0A> Can the same be done for emu10kx ?=0A> =0ANo :(. The two extra he= aders are GPL'd and the author doesn't=0Awant to hear about BSDs.=0A=0A> So= meday it would be nice to have xfi support in the tree,=0A> but that's a mi= ssing driver that even the OSS maintainer=0A> was scared to touch because o= f the complexity of the code.=0A> =0A=0AApparently Creative released a GPLd= driver for linux(ALSA),=0Abut it was not in working shape.=0A=0ACheers,=0A= =0APedro. From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 22:52:29 2012 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 E8C57106566B; Tue, 3 Jan 2012 22:52:29 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D75348FC08; Tue, 3 Jan 2012 22:52: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 q03MqTA3046861; Tue, 3 Jan 2012 22:52:29 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03MqTkc046859; Tue, 3 Jan 2012 22:52:29 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201201032252.q03MqTkc046859@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 3 Jan 2012 22:52: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: r229436 - head/tools/tools/net80211/wesside/wesside 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, 03 Jan 2012 22:52:30 -0000 Author: pjd Date: Tue Jan 3 22:52:29 2012 New Revision: 229436 URL: http://svn.freebsd.org/changeset/base/229436 Log: Fix an obvious typo. We do want to specify file permission when we pass O_CREAT. Modified: head/tools/tools/net80211/wesside/wesside/wesside.c Modified: head/tools/tools/net80211/wesside/wesside/wesside.c ============================================================================== --- head/tools/tools/net80211/wesside/wesside/wesside.c Tue Jan 3 22:36:12 2012 (r229435) +++ head/tools/tools/net80211/wesside/wesside/wesside.c Tue Jan 3 22:52:29 2012 (r229436) @@ -2091,7 +2091,7 @@ void save_key(unsigned char *key, int le strcat(k, ":"); } - fd = open(KEY_FILE, O_WRONLY | O_CREAT | 0644); + fd = open(KEY_FILE, O_WRONLY | O_CREAT, 0644); if (fd == -1) err(1, "open()"); From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 23:05:24 2012 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 0E09B1065670; Tue, 3 Jan 2012 23:05:24 +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 F14FA8FC14; Tue, 3 Jan 2012 23:05: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 q03N5NVe047349; Tue, 3 Jan 2012 23:05:23 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03N5NWH047347; Tue, 3 Jan 2012 23:05:23 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201201032305.q03N5NWH047347@svn.freebsd.org> From: Ed Schouten Date: Tue, 3 Jan 2012 23:05:23 +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: r229437 - head/include 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, 03 Jan 2012 23:05:24 -0000 Author: ed Date: Tue Jan 3 23:05:23 2012 New Revision: 229437 URL: http://svn.freebsd.org/changeset/base/229437 Log: Simply disallow to be used in combination with C++. There is no way one could possibly use this header file in combination with C++ code. The problem is that in C11 the `noreturn' macro expands to the `_Noreturn' function specifier, while in C++11 the `noreturn' keyword is an attribute. So in C11 you have to write: noreturn void exit(int status); While in C++11 you have to write: [[noreturn]] void exit(int status); It is impossible to #define noreturn for C++ in such a way that it allows both conventions. By intentionally breaking this header this way, we prevent people from using this header in their C++<11 sources. Modified: head/include/stdnoreturn.h Modified: head/include/stdnoreturn.h ============================================================================== --- head/include/stdnoreturn.h Tue Jan 3 22:52:29 2012 (r229436) +++ head/include/stdnoreturn.h Tue Jan 3 23:05:23 2012 (r229437) @@ -26,11 +26,13 @@ * $FreeBSD$ */ +#ifdef __cplusplus +#error " cannot be used in combination with C++11." +#endif + #ifndef noreturn -#if !defined(__cplusplus) || __cplusplus < 201103L #include #define noreturn _Noreturn -#endif #endif /* !noreturn */ From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 23:30:53 2012 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 3FCC4106564A; Tue, 3 Jan 2012 23:30:53 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-tul01m020-f182.google.com (mail-tul01m020-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id B3DB68FC0A; Tue, 3 Jan 2012 23:30:52 +0000 (UTC) Received: by obbwd18 with SMTP id wd18so19473070obb.13 for ; Tue, 03 Jan 2012 15:30:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=8cXOO3tXPCUCcmGProW9cgcEaTANOZmWJDOA7RmGsqc=; b=t6CqmbiKn+V+8CVbsR9cKIY4S8V9UK/KboJYhw5shZyPVsui/vSwL0rQgozJkUrAWB 0mLnnn1QyyxnDtv5AtfcJSgNnlRcBvms2+6hfZf7e14AV2qD7djxdNLg0RX+tW60UnxZ ZGrxhD6am5fwV/69UZORvfm1Nwht6LSVoRlNk= MIME-Version: 1.0 Received: by 10.182.193.99 with SMTP id hn3mr46073110obc.61.1325633452116; Tue, 03 Jan 2012 15:30:52 -0800 (PST) Received: by 10.182.152.6 with HTTP; Tue, 3 Jan 2012 15:30:52 -0800 (PST) In-Reply-To: <1325630673.90694.YahooMailClassic@web113514.mail.gq1.yahoo.com> References: <1325630673.90694.YahooMailClassic@web113514.mail.gq1.yahoo.com> Date: Tue, 3 Jan 2012 15:30:52 -0800 Message-ID: From: Garrett Cooper To: pfg@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, John Baldwin , joel@freebsd.org Subject: Re: svn commit: r229430 - in head/sys: conf dev/sound/pci modules/sound/driver/emu10k1 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, 03 Jan 2012 23:30:53 -0000 On Tue, Jan 3, 2012 at 2:44 PM, Pedro Giffuni wrote: > > > --- Mar 3/1/12, Garrett Cooper ha scritto: > ... >> >> Can the same be done for emu10kx ? >> > No :(. The two extra headers are GPL'd and the author doesn't > want to hear about BSDs. > >> Someday it would be nice to have xfi support in the tree, >> but that's a missing driver that even the OSS maintainer >> was scared to touch because of the complexity of the code. >> > > Apparently Creative released a GPLd driver for linux(ALSA), > but it was not in working shape. The ALSA driver worked back when I tried it out 2 years ago. I asked for them to release an OSS version, but of course they ignored by request, then some months later released an ALSA version. There's a preliminary xfi driver in OSS 4.x (and OSS still has a BSD compatible license), but it's far from complete [and the author is aware of this :)]. Thanks! -Garrett From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 23:36:29 2012 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 BFD01106564A; Tue, 3 Jan 2012 23:36:29 +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 A6C228FC0C; Tue, 3 Jan 2012 23:36: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 q03NaTYO048695; Tue, 3 Jan 2012 23:36:29 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03NaTBp048692; Tue, 3 Jan 2012 23:36:29 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201032336.q03NaTBp048692@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 23:36:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229438 - stable/9/sys/dev/ti 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, 03 Jan 2012 23:36:29 -0000 Author: yongari Date: Tue Jan 3 23:36:29 2012 New Revision: 229438 URL: http://svn.freebsd.org/changeset/base/229438 Log: MFC r227431-227432,227505,227509: r227431: style. No functional changes. r227432: Remove dead ifdef. Driver should always check raised interrupt is for the device. r227505: It's bad idea to allocate large memory, 4KB, from stack. Pre-allocate the memory in device attach time. While I'm here remove unnecessary reassignment of error variable as it was already initialized. Also added a missing driver lock in TIIOCSETTRACE handler. r227509: Export sysctl node for various interrupt moderation parameters and have administrators control them. ti(4) provides a character device to control various other features of driver via ioctls but users had to write their own code to manipulate these parameters. It seems some default values for these parameters are not optimal on today's system but leave it as it was and let administrators change them. The following parameters could be changed: dev.ti.%d.rx_coal_ticks dev.ti.%d.rx_max_coal_bds dev.ti.%d.tx_coal_ticks dev.ti.%d.tx_max_coal_bds dev.ti.%d.tx_buf_ratio dev.ti.%d.stat_ticks The interface has to be brought down and up again before a change takes effect. ti(4) controller supports hardware MAC counters with additional DMA statistics. So it's doable to export these counters via sysctl interface. Unfortunately, these counters are cumulative such that driver have to either send an explicit clear command to controller after extracting them or have to maintain internal counters to get actual changes. Neither look good to me so counters were not exported via sysctl. Modified: stable/9/sys/dev/ti/if_ti.c stable/9/sys/dev/ti/if_tireg.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/ti/if_ti.c ============================================================================== --- stable/9/sys/dev/ti/if_ti.c Tue Jan 3 23:05:23 2012 (r229437) +++ stable/9/sys/dev/ti/if_ti.c Tue Jan 3 23:36:29 2012 (r229438) @@ -125,6 +125,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #define TI_CSUM_FEATURES (CSUM_IP | CSUM_TCP | CSUM_UDP | CSUM_IP_FRAGS) /* * We can only turn on header splitting if we're using extended receive @@ -247,6 +249,8 @@ static __inline void ti_hdr_split(struct int idx); #endif /* TI_JUMBO_HDRSPLIT */ +static void ti_sysctl_node(struct ti_softc *); + static device_method_t ti_methods[] = { /* Device interface */ DEVMETHOD(device_probe, ti_probe), @@ -497,7 +501,6 @@ ti_copy_mem(struct ti_softc *sc, uint32_ int segptr, segsize, cnt; caddr_t ptr; uint32_t origwin; - uint8_t tmparray[TI_WINLEN], tmparray2[TI_WINLEN]; int resid, segresid; int first_pass; @@ -507,8 +510,7 @@ ti_copy_mem(struct ti_softc *sc, uint32_ * At the moment, we don't handle non-aligned cases, we just bail. * If this proves to be a problem, it will be fixed. */ - if ((readdata == 0) - && (tigon_addr & 0x3)) { + if (readdata == 0 && (tigon_addr & 0x3) != 0) { device_printf(sc->ti_dev, "%s: tigon address %#x isn't " "word-aligned\n", __func__, tigon_addr); device_printf(sc->ti_dev, "%s: unaligned writes aren't " @@ -557,58 +559,54 @@ ti_copy_mem(struct ti_softc *sc, uint32_ ti_offset = TI_WINDOW + (segptr & (TI_WINLEN -1)); if (readdata) { - - bus_space_read_region_4(sc->ti_btag, - sc->ti_bhandle, ti_offset, - (uint32_t *)tmparray, - segsize >> 2); + bus_space_read_region_4(sc->ti_btag, sc->ti_bhandle, + ti_offset, (uint32_t *)sc->ti_membuf, segsize >> 2); if (useraddr) { /* * Yeah, this is a little on the kludgy * side, but at least this code is only * used for debugging. */ - ti_bcopy_swap(tmparray, tmparray2, segsize, - TI_SWAP_NTOH); + ti_bcopy_swap(sc->ti_membuf, sc->ti_membuf2, + segsize, TI_SWAP_NTOH); TI_UNLOCK(sc); if (first_pass) { - copyout(&tmparray2[segresid], ptr, - segsize - segresid); + copyout(&sc->ti_membuf2[segresid], ptr, + segsize - segresid); first_pass = 0; } else - copyout(tmparray2, ptr, segsize); + copyout(sc->ti_membuf2, ptr, segsize); TI_LOCK(sc); } else { if (first_pass) { - ti_bcopy_swap(tmparray, tmparray2, - segsize, TI_SWAP_NTOH); + ti_bcopy_swap(sc->ti_membuf, + sc->ti_membuf2, segsize, + TI_SWAP_NTOH); TI_UNLOCK(sc); - bcopy(&tmparray2[segresid], ptr, - segsize - segresid); + bcopy(&sc->ti_membuf2[segresid], ptr, + segsize - segresid); TI_LOCK(sc); first_pass = 0; } else - ti_bcopy_swap(tmparray, ptr, segsize, - TI_SWAP_NTOH); + ti_bcopy_swap(sc->ti_membuf, ptr, + segsize, TI_SWAP_NTOH); } } else { if (useraddr) { TI_UNLOCK(sc); - copyin(ptr, tmparray2, segsize); + copyin(ptr, sc->ti_membuf2, segsize); TI_LOCK(sc); - ti_bcopy_swap(tmparray2, tmparray, segsize, - TI_SWAP_HTON); + ti_bcopy_swap(sc->ti_membuf2, sc->ti_membuf, + segsize, TI_SWAP_HTON); } else - ti_bcopy_swap(ptr, tmparray, segsize, - TI_SWAP_HTON); + ti_bcopy_swap(ptr, sc->ti_membuf, segsize, + TI_SWAP_HTON); - bus_space_write_region_4(sc->ti_btag, - sc->ti_bhandle, ti_offset, - (uint32_t *)tmparray, - segsize >> 2); + bus_space_write_region_4(sc->ti_btag, sc->ti_bhandle, + ti_offset, (uint32_t *)sc->ti_membuf, segsize >> 2); } segptr += segsize; ptr += segsize; @@ -619,8 +617,8 @@ ti_copy_mem(struct ti_softc *sc, uint32_ * Handle leftover, non-word-aligned bytes. */ if (resid != 0) { - uint32_t tmpval, tmpval2; - bus_size_t ti_offset; + uint32_t tmpval, tmpval2; + bus_size_t ti_offset; /* * Set the segment pointer. @@ -635,7 +633,7 @@ ti_copy_mem(struct ti_softc *sc, uint32_ * writes, since we'll be doing read/modify/write. */ bus_space_read_region_4(sc->ti_btag, sc->ti_bhandle, - ti_offset, &tmpval, 1); + ti_offset, &tmpval, 1); /* * Next, translate this from little-endian to big-endian @@ -677,7 +675,7 @@ ti_copy_mem(struct ti_softc *sc, uint32_ tmpval = htonl(tmpval2); bus_space_write_region_4(sc->ti_btag, sc->ti_bhandle, - ti_offset, &tmpval, 1); + ti_offset, &tmpval, 1); } } @@ -788,8 +786,7 @@ ti_bcopy_swap(const void *src, void *dst size_t tmplen; if (len & 0x3) { - printf("ti_bcopy_swap: length %zd isn't 32-bit aligned\n", - len); + printf("ti_bcopy_swap: length %zd isn't 32-bit aligned\n", len); return (-1); } @@ -799,12 +796,9 @@ ti_bcopy_swap(const void *src, void *dst while (tmplen) { if (swap_type == TI_SWAP_NTOH) - *(uint32_t *)tmpdst = - ntohl(*(const uint32_t *)tmpsrc); + *(uint32_t *)tmpdst = ntohl(*(const uint32_t *)tmpsrc); else - *(uint32_t *)tmpdst = - htonl(*(const uint32_t *)tmpsrc); - + *(uint32_t *)tmpdst = htonl(*(const uint32_t *)tmpsrc); tmpsrc += 4; tmpdst += 4; tmplen -= 4; @@ -1768,7 +1762,8 @@ ti_setmulti(struct ti_softc *sc) * around it on the Tigon 2 by setting a bit in the PCI state register, * but for the Tigon 1 we must give up and abort the interface attach. */ -static int ti_64bitslot_war(struct ti_softc *sc) +static int +ti_64bitslot_war(struct ti_softc *sc) { if (!(CSR_READ_4(sc, TI_PCI_STATE) & TI_PCISTATE_32BIT_BUS)) { @@ -2092,7 +2087,7 @@ ti_gibinit(struct ti_softc *sc) bus_dmamap_sync(sc->ti_rdata_dmat, sc->ti_rdata_dmamap, BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); - /* Set up tuneables */ + /* Set up tunables */ #if 0 if (ifp->if_mtu > (ETHERMTU + ETHER_HDR_LEN + ETHER_CRC_LEN)) CSR_WRITE_4(sc, TI_GCR_RX_COAL_TICKS, @@ -2241,6 +2236,16 @@ ti_attach(device_t dev) goto fail; } + /* Allocate working area for memory dump. */ + sc->ti_membuf = malloc(sizeof(uint8_t) * TI_WINLEN, M_DEVBUF, M_NOWAIT); + sc->ti_membuf2 = malloc(sizeof(uint8_t) * TI_WINLEN, M_DEVBUF, + M_NOWAIT); + if (sc->ti_membuf == NULL || sc->ti_membuf2 == NULL) { + device_printf(dev, "cannot allocate memory buffer\n"); + error = ENOMEM; + goto fail; + } + /* Allocate the general information block and ring buffers. */ if (bus_dma_tag_create(bus_get_dma_tag(dev), /* parent */ 1, 0, /* algnmnt, boundary */ @@ -2351,19 +2356,8 @@ ti_attach(device_t dev) pci_get_device(dev) == NG_DEVICEID_GA620T) sc->ti_copper = 1; - /* Set default tuneable values. */ - sc->ti_stat_ticks = 2 * TI_TICKS_PER_SEC; -#if 0 - sc->ti_rx_coal_ticks = TI_TICKS_PER_SEC / 5000; -#endif - sc->ti_rx_coal_ticks = 170; - sc->ti_tx_coal_ticks = TI_TICKS_PER_SEC / 500; - sc->ti_rx_max_coal_bds = 64; -#if 0 - sc->ti_tx_max_coal_bds = 128; -#endif - sc->ti_tx_max_coal_bds = 32; - sc->ti_tx_buf_ratio = 21; + /* Set default tunable values. */ + ti_sysctl_node(sc); /* Set up ifnet structure */ ifp->if_softc = sc; @@ -2504,6 +2498,10 @@ ti_detach(device_t dev) } if (ifp) if_free(ifp); + if (sc->ti_membuf) + free(sc->ti_membuf, M_DEVBUF); + if (sc->ti_membuf2) + free(sc->ti_membuf2, M_DEVBUF); mtx_destroy(&sc->ti_mtx); @@ -2835,14 +2833,11 @@ ti_intr(void *xsc) TI_LOCK(sc); ifp = sc->ti_ifp; -/*#ifdef notdef*/ - /* Avoid this for now -- checking this register is expensive. */ /* Make sure this is really our interrupt. */ if (!(CSR_READ_4(sc, TI_MISC_HOST_CTL) & TI_MHC_INTSTATE)) { TI_UNLOCK(sc); return; } -/*#endif*/ /* Ack interrupt and stop others from occuring. */ CSR_WRITE_4(sc, TI_MB_HOSTINTR, 1); @@ -3532,7 +3527,7 @@ ti_ioctl2(struct cdev *dev, u_long cmd, TI_LOCK(sc); bcopy(&sc->ti_rdata->ti_info.ti_stats, outstats, - sizeof(struct ti_stats)); + sizeof(struct ti_stats)); TI_UNLOCK(sc); break; } @@ -3551,9 +3546,6 @@ ti_ioctl2(struct cdev *dev, u_long cmd, params->ti_tx_buf_ratio = sc->ti_tx_buf_ratio; params->param_mask = TI_PARAM_ALL; TI_UNLOCK(sc); - - error = 0; - break; } case TIIOCSETPARAMS: @@ -3598,13 +3590,10 @@ ti_ioctl2(struct cdev *dev, u_long cmd, sc->ti_tx_buf_ratio); } TI_UNLOCK(sc); - - error = 0; - break; } case TIIOCSETTRACE: { - ti_trace_type trace_type; + ti_trace_type trace_type; trace_type = *(ti_trace_type *)addr; @@ -3613,10 +3602,9 @@ ti_ioctl2(struct cdev *dev, u_long cmd, * this register to 0 should have the effect of disabling * tracing. */ + TI_LOCK(sc); CSR_WRITE_4(sc, TI_GCR_NIC_TRACING, trace_type); - - error = 0; - + TI_UNLOCK(sc); break; } case TIIOCGETTRACE: { @@ -3629,7 +3617,6 @@ ti_ioctl2(struct cdev *dev, u_long cmd, trace_start = CSR_READ_4(sc, TI_GCR_NICTRACE_START); cur_trace_ptr = CSR_READ_4(sc, TI_GCR_NICTRACE_PTR); trace_len = CSR_READ_4(sc, TI_GCR_NICTRACE_LEN); - #if 0 if_printf(sc->ti_ifp, "trace_start = %#x, cur_trace_ptr = %#x, " "trace_len = %d\n", trace_start, @@ -3637,24 +3624,20 @@ ti_ioctl2(struct cdev *dev, u_long cmd, if_printf(sc->ti_ifp, "trace_buf->buf_len = %d\n", trace_buf->buf_len); #endif - error = ti_copy_mem(sc, trace_start, min(trace_len, - trace_buf->buf_len), - (caddr_t)trace_buf->buf, 1, 1); - + trace_buf->buf_len), (caddr_t)trace_buf->buf, 1, 1); if (error == 0) { trace_buf->fill_len = min(trace_len, - trace_buf->buf_len); + trace_buf->buf_len); if (cur_trace_ptr < trace_start) trace_buf->cur_trace_ptr = - trace_start - cur_trace_ptr; + trace_start - cur_trace_ptr; else trace_buf->cur_trace_ptr = - cur_trace_ptr - trace_start; + cur_trace_ptr - trace_start; } else trace_buf->fill_len = 0; TI_UNLOCK(sc); - break; } @@ -3676,7 +3659,6 @@ ti_ioctl2(struct cdev *dev, u_long cmd, * you're interested in every ioctl, you'll only be * able to debug one board at a time. */ - error = 0; break; case ALT_READ_TG_MEM: case ALT_WRITE_TG_MEM: @@ -3699,25 +3681,22 @@ ti_ioctl2(struct cdev *dev, u_long cmd, * nothing else. */ TI_LOCK(sc); - if ((mem_param->tgAddr >= TI_BEG_SRAM) - && ((mem_param->tgAddr + mem_param->len) <= sram_end)) { + if (mem_param->tgAddr >= TI_BEG_SRAM && + mem_param->tgAddr + mem_param->len <= sram_end) { /* * In this instance, we always copy to/from user * space, so the user space argument is set to 1. */ error = ti_copy_mem(sc, mem_param->tgAddr, - mem_param->len, - mem_param->userAddr, 1, - (cmd == ALT_READ_TG_MEM) ? 1 : 0); - } else if ((mem_param->tgAddr >= TI_BEG_SCRATCH) - && (mem_param->tgAddr <= scratch_end)) { + mem_param->len, mem_param->userAddr, 1, + cmd == ALT_READ_TG_MEM ? 1 : 0); + } else if (mem_param->tgAddr >= TI_BEG_SCRATCH && + mem_param->tgAddr <= scratch_end) { error = ti_copy_scratch(sc, mem_param->tgAddr, - mem_param->len, - mem_param->userAddr, 1, - (cmd == ALT_READ_TG_MEM) ? - 1 : 0, TI_PROCESSOR_A); - } else if ((mem_param->tgAddr >= TI_BEG_SCRATCH_B_DEBUG) - && (mem_param->tgAddr <= TI_BEG_SCRATCH_B_DEBUG)) { + mem_param->len, mem_param->userAddr, 1, + cmd == ALT_READ_TG_MEM ? 1 : 0, TI_PROCESSOR_A); + } else if (mem_param->tgAddr >= TI_BEG_SCRATCH_B_DEBUG && + mem_param->tgAddr <= TI_BEG_SCRATCH_B_DEBUG) { if (sc->ti_hwrev == TI_HWREV_TIGON) { if_printf(sc->ti_ifp, "invalid memory range for Tigon I\n"); @@ -3725,11 +3704,9 @@ ti_ioctl2(struct cdev *dev, u_long cmd, break; } error = ti_copy_scratch(sc, mem_param->tgAddr - - TI_SCRATCH_DEBUG_OFF, - mem_param->len, - mem_param->userAddr, 1, - (cmd == ALT_READ_TG_MEM) ? - 1 : 0, TI_PROCESSOR_B); + TI_SCRATCH_DEBUG_OFF, mem_param->len, + mem_param->userAddr, 1, + cmd == ALT_READ_TG_MEM ? 1 : 0, TI_PROCESSOR_B); } else { if_printf(sc->ti_ifp, "memory address %#x len %d is " "out of supported range\n", @@ -3737,14 +3714,13 @@ ti_ioctl2(struct cdev *dev, u_long cmd, error = EINVAL; } TI_UNLOCK(sc); - break; } case ALT_READ_TG_REG: case ALT_WRITE_TG_REG: { - struct tg_reg *regs; - uint32_t tmpval; + struct tg_reg *regs; + uint32_t tmpval; regs = (struct tg_reg *)addr; @@ -3758,7 +3734,7 @@ ti_ioctl2(struct cdev *dev, u_long cmd, TI_LOCK(sc); if (cmd == ALT_READ_TG_REG) { bus_space_read_region_4(sc->ti_btag, sc->ti_bhandle, - regs->addr, &tmpval, 1); + regs->addr, &tmpval, 1); regs->data = ntohl(tmpval); #if 0 if ((regs->addr == TI_CPU_STATE) @@ -3770,10 +3746,9 @@ ti_ioctl2(struct cdev *dev, u_long cmd, } else { tmpval = htonl(regs->data); bus_space_write_region_4(sc->ti_btag, sc->ti_bhandle, - regs->addr, &tmpval, 1); + regs->addr, &tmpval, 1); } TI_UNLOCK(sc); - break; } default: @@ -3876,3 +3851,58 @@ ti_shutdown(device_t dev) return (0); } + +static void +ti_sysctl_node(struct ti_softc *sc) +{ + struct sysctl_ctx_list *ctx; + struct sysctl_oid_list *child; + + ctx = device_get_sysctl_ctx(sc->ti_dev); + child = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->ti_dev)); + + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "rx_coal_ticks", CTLFLAG_RW, + &sc->ti_rx_coal_ticks, 0, "Receive coalcesced ticks"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "rx_max_coal_bds", CTLFLAG_RW, + &sc->ti_rx_max_coal_bds, 0, "Receive max coalcesced BDs"); + + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tx_coal_ticks", CTLFLAG_RW, + &sc->ti_tx_coal_ticks, 0, "Send coalcesced ticks"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tx_max_coal_bds", CTLFLAG_RW, + &sc->ti_tx_max_coal_bds, 0, "Send max coalcesced BDs"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tx_buf_ratio", CTLFLAG_RW, + &sc->ti_tx_buf_ratio, 0, + "Ratio of NIC memory devoted to TX buffer"); + + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "stat_ticks", CTLFLAG_RW, + &sc->ti_stat_ticks, 0, + "Number of clock ticks for statistics update interval"); + + /* Pull in device tunables. */ + sc->ti_rx_coal_ticks = 170; + resource_int_value(device_get_name(sc->ti_dev), + device_get_unit(sc->ti_dev), "rx_coal_ticks", + &sc->ti_rx_coal_ticks); + sc->ti_rx_max_coal_bds = 64; + resource_int_value(device_get_name(sc->ti_dev), + device_get_unit(sc->ti_dev), "rx_max_coal_bds", + &sc->ti_rx_max_coal_bds); + + sc->ti_tx_coal_ticks = TI_TICKS_PER_SEC / 500; + resource_int_value(device_get_name(sc->ti_dev), + device_get_unit(sc->ti_dev), "tx_coal_ticks", + &sc->ti_tx_coal_ticks); + sc->ti_tx_max_coal_bds = 32; + resource_int_value(device_get_name(sc->ti_dev), + device_get_unit(sc->ti_dev), "tx_max_coal_bds", + &sc->ti_tx_max_coal_bds); + sc->ti_tx_buf_ratio = 21; + resource_int_value(device_get_name(sc->ti_dev), + device_get_unit(sc->ti_dev), "tx_buf_ratio", + &sc->ti_tx_buf_ratio); + + sc->ti_stat_ticks = 2 * TI_TICKS_PER_SEC; + resource_int_value(device_get_name(sc->ti_dev), + device_get_unit(sc->ti_dev), "stat_ticks", + &sc->ti_stat_ticks); +} Modified: stable/9/sys/dev/ti/if_tireg.h ============================================================================== --- stable/9/sys/dev/ti/if_tireg.h Tue Jan 3 23:05:23 2012 (r229437) +++ stable/9/sys/dev/ti/if_tireg.h Tue Jan 3 23:36:29 2012 (r229438) @@ -1015,6 +1015,8 @@ struct ti_softc { struct callout ti_watchdog; int ti_timer; ti_flag_vals ti_flags; + uint8_t *ti_membuf; + uint8_t *ti_membuf2; struct cdev *dev; }; From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 23:38:17 2012 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 1ECBB1065677; Tue, 3 Jan 2012 23:38:17 +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 060488FC1C; Tue, 3 Jan 2012 23:38: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 q03NcHUU048796; Tue, 3 Jan 2012 23:38:17 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03NcGKC048793; Tue, 3 Jan 2012 23:38:16 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201032338.q03NcGKC048793@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 23:38:16 +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: r229439 - in stable/8/sys: conf dev/ti 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, 03 Jan 2012 23:38:17 -0000 Author: yongari Date: Tue Jan 3 23:38:16 2012 New Revision: 229439 URL: http://svn.freebsd.org/changeset/base/229439 Log: MFC r227431-227432,227505,227509: r227431: style. No functional changes. r227432: Remove dead ifdef. Driver should always check raised interrupt is for the device. r227505: It's bad idea to allocate large memory, 4KB, from stack. Pre-allocate the memory in device attach time. While I'm here remove unnecessary reassignment of error variable as it was already initialized. Also added a missing driver lock in TIIOCSETTRACE handler. r227509: Export sysctl node for various interrupt moderation parameters and have administrators control them. ti(4) provides a character device to control various other features of driver via ioctls but users had to write their own code to manipulate these parameters. It seems some default values for these parameters are not optimal on today's system but leave it as it was and let administrators change them. The following parameters could be changed: dev.ti.%d.rx_coal_ticks dev.ti.%d.rx_max_coal_bds dev.ti.%d.tx_coal_ticks dev.ti.%d.tx_max_coal_bds dev.ti.%d.tx_buf_ratio dev.ti.%d.stat_ticks The interface has to be brought down and up again before a change takes effect. ti(4) controller supports hardware MAC counters with additional DMA statistics. So it's doable to export these counters via sysctl interface. Unfortunately, these counters are cumulative such that driver have to either send an explicit clear command to controller after extracting them or have to maintain internal counters to get actual changes. Neither look good to me so counters were not exported via sysctl. Modified: stable/8/sys/dev/ti/if_ti.c stable/8/sys/dev/ti/if_tireg.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/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/ti/if_ti.c ============================================================================== --- stable/8/sys/dev/ti/if_ti.c Tue Jan 3 23:36:29 2012 (r229438) +++ stable/8/sys/dev/ti/if_ti.c Tue Jan 3 23:38:16 2012 (r229439) @@ -125,6 +125,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #define TI_CSUM_FEATURES (CSUM_IP | CSUM_TCP | CSUM_UDP | CSUM_IP_FRAGS) /* * We can only turn on header splitting if we're using extended receive @@ -247,6 +249,8 @@ static __inline void ti_hdr_split(struct int idx); #endif /* TI_JUMBO_HDRSPLIT */ +static void ti_sysctl_node(struct ti_softc *); + static device_method_t ti_methods[] = { /* Device interface */ DEVMETHOD(device_probe, ti_probe), @@ -497,7 +501,6 @@ ti_copy_mem(struct ti_softc *sc, uint32_ int segptr, segsize, cnt; caddr_t ptr; uint32_t origwin; - uint8_t tmparray[TI_WINLEN], tmparray2[TI_WINLEN]; int resid, segresid; int first_pass; @@ -507,8 +510,7 @@ ti_copy_mem(struct ti_softc *sc, uint32_ * At the moment, we don't handle non-aligned cases, we just bail. * If this proves to be a problem, it will be fixed. */ - if ((readdata == 0) - && (tigon_addr & 0x3)) { + if (readdata == 0 && (tigon_addr & 0x3) != 0) { device_printf(sc->ti_dev, "%s: tigon address %#x isn't " "word-aligned\n", __func__, tigon_addr); device_printf(sc->ti_dev, "%s: unaligned writes aren't " @@ -557,58 +559,54 @@ ti_copy_mem(struct ti_softc *sc, uint32_ ti_offset = TI_WINDOW + (segptr & (TI_WINLEN -1)); if (readdata) { - - bus_space_read_region_4(sc->ti_btag, - sc->ti_bhandle, ti_offset, - (uint32_t *)tmparray, - segsize >> 2); + bus_space_read_region_4(sc->ti_btag, sc->ti_bhandle, + ti_offset, (uint32_t *)sc->ti_membuf, segsize >> 2); if (useraddr) { /* * Yeah, this is a little on the kludgy * side, but at least this code is only * used for debugging. */ - ti_bcopy_swap(tmparray, tmparray2, segsize, - TI_SWAP_NTOH); + ti_bcopy_swap(sc->ti_membuf, sc->ti_membuf2, + segsize, TI_SWAP_NTOH); TI_UNLOCK(sc); if (first_pass) { - copyout(&tmparray2[segresid], ptr, - segsize - segresid); + copyout(&sc->ti_membuf2[segresid], ptr, + segsize - segresid); first_pass = 0; } else - copyout(tmparray2, ptr, segsize); + copyout(sc->ti_membuf2, ptr, segsize); TI_LOCK(sc); } else { if (first_pass) { - ti_bcopy_swap(tmparray, tmparray2, - segsize, TI_SWAP_NTOH); + ti_bcopy_swap(sc->ti_membuf, + sc->ti_membuf2, segsize, + TI_SWAP_NTOH); TI_UNLOCK(sc); - bcopy(&tmparray2[segresid], ptr, - segsize - segresid); + bcopy(&sc->ti_membuf2[segresid], ptr, + segsize - segresid); TI_LOCK(sc); first_pass = 0; } else - ti_bcopy_swap(tmparray, ptr, segsize, - TI_SWAP_NTOH); + ti_bcopy_swap(sc->ti_membuf, ptr, + segsize, TI_SWAP_NTOH); } } else { if (useraddr) { TI_UNLOCK(sc); - copyin(ptr, tmparray2, segsize); + copyin(ptr, sc->ti_membuf2, segsize); TI_LOCK(sc); - ti_bcopy_swap(tmparray2, tmparray, segsize, - TI_SWAP_HTON); + ti_bcopy_swap(sc->ti_membuf2, sc->ti_membuf, + segsize, TI_SWAP_HTON); } else - ti_bcopy_swap(ptr, tmparray, segsize, - TI_SWAP_HTON); + ti_bcopy_swap(ptr, sc->ti_membuf, segsize, + TI_SWAP_HTON); - bus_space_write_region_4(sc->ti_btag, - sc->ti_bhandle, ti_offset, - (uint32_t *)tmparray, - segsize >> 2); + bus_space_write_region_4(sc->ti_btag, sc->ti_bhandle, + ti_offset, (uint32_t *)sc->ti_membuf, segsize >> 2); } segptr += segsize; ptr += segsize; @@ -619,8 +617,8 @@ ti_copy_mem(struct ti_softc *sc, uint32_ * Handle leftover, non-word-aligned bytes. */ if (resid != 0) { - uint32_t tmpval, tmpval2; - bus_size_t ti_offset; + uint32_t tmpval, tmpval2; + bus_size_t ti_offset; /* * Set the segment pointer. @@ -635,7 +633,7 @@ ti_copy_mem(struct ti_softc *sc, uint32_ * writes, since we'll be doing read/modify/write. */ bus_space_read_region_4(sc->ti_btag, sc->ti_bhandle, - ti_offset, &tmpval, 1); + ti_offset, &tmpval, 1); /* * Next, translate this from little-endian to big-endian @@ -677,7 +675,7 @@ ti_copy_mem(struct ti_softc *sc, uint32_ tmpval = htonl(tmpval2); bus_space_write_region_4(sc->ti_btag, sc->ti_bhandle, - ti_offset, &tmpval, 1); + ti_offset, &tmpval, 1); } } @@ -788,8 +786,7 @@ ti_bcopy_swap(const void *src, void *dst size_t tmplen; if (len & 0x3) { - printf("ti_bcopy_swap: length %zd isn't 32-bit aligned\n", - len); + printf("ti_bcopy_swap: length %zd isn't 32-bit aligned\n", len); return (-1); } @@ -799,12 +796,9 @@ ti_bcopy_swap(const void *src, void *dst while (tmplen) { if (swap_type == TI_SWAP_NTOH) - *(uint32_t *)tmpdst = - ntohl(*(const uint32_t *)tmpsrc); + *(uint32_t *)tmpdst = ntohl(*(const uint32_t *)tmpsrc); else - *(uint32_t *)tmpdst = - htonl(*(const uint32_t *)tmpsrc); - + *(uint32_t *)tmpdst = htonl(*(const uint32_t *)tmpsrc); tmpsrc += 4; tmpdst += 4; tmplen -= 4; @@ -1770,7 +1764,8 @@ ti_setmulti(struct ti_softc *sc) * around it on the Tigon 2 by setting a bit in the PCI state register, * but for the Tigon 1 we must give up and abort the interface attach. */ -static int ti_64bitslot_war(struct ti_softc *sc) +static int +ti_64bitslot_war(struct ti_softc *sc) { if (!(CSR_READ_4(sc, TI_PCI_STATE) & TI_PCISTATE_32BIT_BUS)) { @@ -2094,7 +2089,7 @@ ti_gibinit(struct ti_softc *sc) bus_dmamap_sync(sc->ti_rdata_dmat, sc->ti_rdata_dmamap, BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); - /* Set up tuneables */ + /* Set up tunables */ #if 0 if (ifp->if_mtu > (ETHERMTU + ETHER_HDR_LEN + ETHER_CRC_LEN)) CSR_WRITE_4(sc, TI_GCR_RX_COAL_TICKS, @@ -2243,6 +2238,16 @@ ti_attach(device_t dev) goto fail; } + /* Allocate working area for memory dump. */ + sc->ti_membuf = malloc(sizeof(uint8_t) * TI_WINLEN, M_DEVBUF, M_NOWAIT); + sc->ti_membuf2 = malloc(sizeof(uint8_t) * TI_WINLEN, M_DEVBUF, + M_NOWAIT); + if (sc->ti_membuf == NULL || sc->ti_membuf2 == NULL) { + device_printf(dev, "cannot allocate memory buffer\n"); + error = ENOMEM; + goto fail; + } + /* Allocate the general information block and ring buffers. */ if (bus_dma_tag_create(bus_get_dma_tag(dev), /* parent */ 1, 0, /* algnmnt, boundary */ @@ -2353,19 +2358,8 @@ ti_attach(device_t dev) pci_get_device(dev) == NG_DEVICEID_GA620T) sc->ti_copper = 1; - /* Set default tuneable values. */ - sc->ti_stat_ticks = 2 * TI_TICKS_PER_SEC; -#if 0 - sc->ti_rx_coal_ticks = TI_TICKS_PER_SEC / 5000; -#endif - sc->ti_rx_coal_ticks = 170; - sc->ti_tx_coal_ticks = TI_TICKS_PER_SEC / 500; - sc->ti_rx_max_coal_bds = 64; -#if 0 - sc->ti_tx_max_coal_bds = 128; -#endif - sc->ti_tx_max_coal_bds = 32; - sc->ti_tx_buf_ratio = 21; + /* Set default tunable values. */ + ti_sysctl_node(sc); /* Set up ifnet structure */ ifp->if_softc = sc; @@ -2506,6 +2500,10 @@ ti_detach(device_t dev) } if (ifp) if_free(ifp); + if (sc->ti_membuf) + free(sc->ti_membuf, M_DEVBUF); + if (sc->ti_membuf2) + free(sc->ti_membuf2, M_DEVBUF); mtx_destroy(&sc->ti_mtx); @@ -2837,14 +2835,11 @@ ti_intr(void *xsc) TI_LOCK(sc); ifp = sc->ti_ifp; -/*#ifdef notdef*/ - /* Avoid this for now -- checking this register is expensive. */ /* Make sure this is really our interrupt. */ if (!(CSR_READ_4(sc, TI_MISC_HOST_CTL) & TI_MHC_INTSTATE)) { TI_UNLOCK(sc); return; } -/*#endif*/ /* Ack interrupt and stop others from occuring. */ CSR_WRITE_4(sc, TI_MB_HOSTINTR, 1); @@ -3534,7 +3529,7 @@ ti_ioctl2(struct cdev *dev, u_long cmd, TI_LOCK(sc); bcopy(&sc->ti_rdata->ti_info.ti_stats, outstats, - sizeof(struct ti_stats)); + sizeof(struct ti_stats)); TI_UNLOCK(sc); break; } @@ -3553,9 +3548,6 @@ ti_ioctl2(struct cdev *dev, u_long cmd, params->ti_tx_buf_ratio = sc->ti_tx_buf_ratio; params->param_mask = TI_PARAM_ALL; TI_UNLOCK(sc); - - error = 0; - break; } case TIIOCSETPARAMS: @@ -3600,13 +3592,10 @@ ti_ioctl2(struct cdev *dev, u_long cmd, sc->ti_tx_buf_ratio); } TI_UNLOCK(sc); - - error = 0; - break; } case TIIOCSETTRACE: { - ti_trace_type trace_type; + ti_trace_type trace_type; trace_type = *(ti_trace_type *)addr; @@ -3615,10 +3604,9 @@ ti_ioctl2(struct cdev *dev, u_long cmd, * this register to 0 should have the effect of disabling * tracing. */ + TI_LOCK(sc); CSR_WRITE_4(sc, TI_GCR_NIC_TRACING, trace_type); - - error = 0; - + TI_UNLOCK(sc); break; } case TIIOCGETTRACE: { @@ -3631,7 +3619,6 @@ ti_ioctl2(struct cdev *dev, u_long cmd, trace_start = CSR_READ_4(sc, TI_GCR_NICTRACE_START); cur_trace_ptr = CSR_READ_4(sc, TI_GCR_NICTRACE_PTR); trace_len = CSR_READ_4(sc, TI_GCR_NICTRACE_LEN); - #if 0 if_printf(sc->ti_ifp, "trace_start = %#x, cur_trace_ptr = %#x, " "trace_len = %d\n", trace_start, @@ -3639,24 +3626,20 @@ ti_ioctl2(struct cdev *dev, u_long cmd, if_printf(sc->ti_ifp, "trace_buf->buf_len = %d\n", trace_buf->buf_len); #endif - error = ti_copy_mem(sc, trace_start, min(trace_len, - trace_buf->buf_len), - (caddr_t)trace_buf->buf, 1, 1); - + trace_buf->buf_len), (caddr_t)trace_buf->buf, 1, 1); if (error == 0) { trace_buf->fill_len = min(trace_len, - trace_buf->buf_len); + trace_buf->buf_len); if (cur_trace_ptr < trace_start) trace_buf->cur_trace_ptr = - trace_start - cur_trace_ptr; + trace_start - cur_trace_ptr; else trace_buf->cur_trace_ptr = - cur_trace_ptr - trace_start; + cur_trace_ptr - trace_start; } else trace_buf->fill_len = 0; TI_UNLOCK(sc); - break; } @@ -3678,7 +3661,6 @@ ti_ioctl2(struct cdev *dev, u_long cmd, * you're interested in every ioctl, you'll only be * able to debug one board at a time. */ - error = 0; break; case ALT_READ_TG_MEM: case ALT_WRITE_TG_MEM: @@ -3701,25 +3683,22 @@ ti_ioctl2(struct cdev *dev, u_long cmd, * nothing else. */ TI_LOCK(sc); - if ((mem_param->tgAddr >= TI_BEG_SRAM) - && ((mem_param->tgAddr + mem_param->len) <= sram_end)) { + if (mem_param->tgAddr >= TI_BEG_SRAM && + mem_param->tgAddr + mem_param->len <= sram_end) { /* * In this instance, we always copy to/from user * space, so the user space argument is set to 1. */ error = ti_copy_mem(sc, mem_param->tgAddr, - mem_param->len, - mem_param->userAddr, 1, - (cmd == ALT_READ_TG_MEM) ? 1 : 0); - } else if ((mem_param->tgAddr >= TI_BEG_SCRATCH) - && (mem_param->tgAddr <= scratch_end)) { + mem_param->len, mem_param->userAddr, 1, + cmd == ALT_READ_TG_MEM ? 1 : 0); + } else if (mem_param->tgAddr >= TI_BEG_SCRATCH && + mem_param->tgAddr <= scratch_end) { error = ti_copy_scratch(sc, mem_param->tgAddr, - mem_param->len, - mem_param->userAddr, 1, - (cmd == ALT_READ_TG_MEM) ? - 1 : 0, TI_PROCESSOR_A); - } else if ((mem_param->tgAddr >= TI_BEG_SCRATCH_B_DEBUG) - && (mem_param->tgAddr <= TI_BEG_SCRATCH_B_DEBUG)) { + mem_param->len, mem_param->userAddr, 1, + cmd == ALT_READ_TG_MEM ? 1 : 0, TI_PROCESSOR_A); + } else if (mem_param->tgAddr >= TI_BEG_SCRATCH_B_DEBUG && + mem_param->tgAddr <= TI_BEG_SCRATCH_B_DEBUG) { if (sc->ti_hwrev == TI_HWREV_TIGON) { if_printf(sc->ti_ifp, "invalid memory range for Tigon I\n"); @@ -3727,11 +3706,9 @@ ti_ioctl2(struct cdev *dev, u_long cmd, break; } error = ti_copy_scratch(sc, mem_param->tgAddr - - TI_SCRATCH_DEBUG_OFF, - mem_param->len, - mem_param->userAddr, 1, - (cmd == ALT_READ_TG_MEM) ? - 1 : 0, TI_PROCESSOR_B); + TI_SCRATCH_DEBUG_OFF, mem_param->len, + mem_param->userAddr, 1, + cmd == ALT_READ_TG_MEM ? 1 : 0, TI_PROCESSOR_B); } else { if_printf(sc->ti_ifp, "memory address %#x len %d is " "out of supported range\n", @@ -3739,14 +3716,13 @@ ti_ioctl2(struct cdev *dev, u_long cmd, error = EINVAL; } TI_UNLOCK(sc); - break; } case ALT_READ_TG_REG: case ALT_WRITE_TG_REG: { - struct tg_reg *regs; - uint32_t tmpval; + struct tg_reg *regs; + uint32_t tmpval; regs = (struct tg_reg *)addr; @@ -3760,7 +3736,7 @@ ti_ioctl2(struct cdev *dev, u_long cmd, TI_LOCK(sc); if (cmd == ALT_READ_TG_REG) { bus_space_read_region_4(sc->ti_btag, sc->ti_bhandle, - regs->addr, &tmpval, 1); + regs->addr, &tmpval, 1); regs->data = ntohl(tmpval); #if 0 if ((regs->addr == TI_CPU_STATE) @@ -3772,10 +3748,9 @@ ti_ioctl2(struct cdev *dev, u_long cmd, } else { tmpval = htonl(regs->data); bus_space_write_region_4(sc->ti_btag, sc->ti_bhandle, - regs->addr, &tmpval, 1); + regs->addr, &tmpval, 1); } TI_UNLOCK(sc); - break; } default: @@ -3878,3 +3853,58 @@ ti_shutdown(device_t dev) return (0); } + +static void +ti_sysctl_node(struct ti_softc *sc) +{ + struct sysctl_ctx_list *ctx; + struct sysctl_oid_list *child; + + ctx = device_get_sysctl_ctx(sc->ti_dev); + child = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->ti_dev)); + + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "rx_coal_ticks", CTLFLAG_RW, + &sc->ti_rx_coal_ticks, 0, "Receive coalcesced ticks"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "rx_max_coal_bds", CTLFLAG_RW, + &sc->ti_rx_max_coal_bds, 0, "Receive max coalcesced BDs"); + + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tx_coal_ticks", CTLFLAG_RW, + &sc->ti_tx_coal_ticks, 0, "Send coalcesced ticks"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tx_max_coal_bds", CTLFLAG_RW, + &sc->ti_tx_max_coal_bds, 0, "Send max coalcesced BDs"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tx_buf_ratio", CTLFLAG_RW, + &sc->ti_tx_buf_ratio, 0, + "Ratio of NIC memory devoted to TX buffer"); + + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "stat_ticks", CTLFLAG_RW, + &sc->ti_stat_ticks, 0, + "Number of clock ticks for statistics update interval"); + + /* Pull in device tunables. */ + sc->ti_rx_coal_ticks = 170; + resource_int_value(device_get_name(sc->ti_dev), + device_get_unit(sc->ti_dev), "rx_coal_ticks", + &sc->ti_rx_coal_ticks); + sc->ti_rx_max_coal_bds = 64; + resource_int_value(device_get_name(sc->ti_dev), + device_get_unit(sc->ti_dev), "rx_max_coal_bds", + &sc->ti_rx_max_coal_bds); + + sc->ti_tx_coal_ticks = TI_TICKS_PER_SEC / 500; + resource_int_value(device_get_name(sc->ti_dev), + device_get_unit(sc->ti_dev), "tx_coal_ticks", + &sc->ti_tx_coal_ticks); + sc->ti_tx_max_coal_bds = 32; + resource_int_value(device_get_name(sc->ti_dev), + device_get_unit(sc->ti_dev), "tx_max_coal_bds", + &sc->ti_tx_max_coal_bds); + sc->ti_tx_buf_ratio = 21; + resource_int_value(device_get_name(sc->ti_dev), + device_get_unit(sc->ti_dev), "tx_buf_ratio", + &sc->ti_tx_buf_ratio); + + sc->ti_stat_ticks = 2 * TI_TICKS_PER_SEC; + resource_int_value(device_get_name(sc->ti_dev), + device_get_unit(sc->ti_dev), "stat_ticks", + &sc->ti_stat_ticks); +} Modified: stable/8/sys/dev/ti/if_tireg.h ============================================================================== --- stable/8/sys/dev/ti/if_tireg.h Tue Jan 3 23:36:29 2012 (r229438) +++ stable/8/sys/dev/ti/if_tireg.h Tue Jan 3 23:38:16 2012 (r229439) @@ -1015,6 +1015,8 @@ struct ti_softc { struct callout ti_watchdog; int ti_timer; ti_flag_vals ti_flags; + uint8_t *ti_membuf; + uint8_t *ti_membuf2; struct cdev *dev; }; From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 23:39:30 2012 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 9F7A21065675; Tue, 3 Jan 2012 23:39:30 +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 860388FC21; Tue, 3 Jan 2012 23:39:30 +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 q03NdUVq048887; Tue, 3 Jan 2012 23:39:30 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03NdUGD048884; Tue, 3 Jan 2012 23:39:30 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201032339.q03NdUGD048884@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 23:39:30 +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: r229440 - stable/7/sys/dev/ti 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, 03 Jan 2012 23:39:30 -0000 Author: yongari Date: Tue Jan 3 23:39:30 2012 New Revision: 229440 URL: http://svn.freebsd.org/changeset/base/229440 Log: MFC r227431-227432,227505,227509: r227431: style. No functional changes. r227432: Remove dead ifdef. Driver should always check raised interrupt is for the device. r227505: It's bad idea to allocate large memory, 4KB, from stack. Pre-allocate the memory in device attach time. While I'm here remove unnecessary reassignment of error variable as it was already initialized. Also added a missing driver lock in TIIOCSETTRACE handler. r227509: Export sysctl node for various interrupt moderation parameters and have administrators control them. ti(4) provides a character device to control various other features of driver via ioctls but users had to write their own code to manipulate these parameters. It seems some default values for these parameters are not optimal on today's system but leave it as it was and let administrators change them. The following parameters could be changed: dev.ti.%d.rx_coal_ticks dev.ti.%d.rx_max_coal_bds dev.ti.%d.tx_coal_ticks dev.ti.%d.tx_max_coal_bds dev.ti.%d.tx_buf_ratio dev.ti.%d.stat_ticks The interface has to be brought down and up again before a change takes effect. ti(4) controller supports hardware MAC counters with additional DMA statistics. So it's doable to export these counters via sysctl interface. Unfortunately, these counters are cumulative such that driver have to either send an explicit clear command to controller after extracting them or have to maintain internal counters to get actual changes. Neither look good to me so counters were not exported via sysctl. Modified: stable/7/sys/dev/ti/if_ti.c stable/7/sys/dev/ti/if_tireg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/ti/if_ti.c ============================================================================== --- stable/7/sys/dev/ti/if_ti.c Tue Jan 3 23:38:16 2012 (r229439) +++ stable/7/sys/dev/ti/if_ti.c Tue Jan 3 23:39:30 2012 (r229440) @@ -125,6 +125,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #define TI_CSUM_FEATURES (CSUM_IP | CSUM_TCP | CSUM_UDP | CSUM_IP_FRAGS) /* * We can only turn on header splitting if we're using extended receive @@ -247,6 +249,8 @@ static __inline void ti_hdr_split(struct int idx); #endif /* TI_JUMBO_HDRSPLIT */ +static void ti_sysctl_node(struct ti_softc *); + static device_method_t ti_methods[] = { /* Device interface */ DEVMETHOD(device_probe, ti_probe), @@ -497,7 +501,6 @@ ti_copy_mem(struct ti_softc *sc, uint32_ int segptr, segsize, cnt; caddr_t ptr; uint32_t origwin; - uint8_t tmparray[TI_WINLEN], tmparray2[TI_WINLEN]; int resid, segresid; int first_pass; @@ -507,8 +510,7 @@ ti_copy_mem(struct ti_softc *sc, uint32_ * At the moment, we don't handle non-aligned cases, we just bail. * If this proves to be a problem, it will be fixed. */ - if ((readdata == 0) - && (tigon_addr & 0x3)) { + if (readdata == 0 && (tigon_addr & 0x3) != 0) { device_printf(sc->ti_dev, "%s: tigon address %#x isn't " "word-aligned\n", __func__, tigon_addr); device_printf(sc->ti_dev, "%s: unaligned writes aren't " @@ -557,58 +559,54 @@ ti_copy_mem(struct ti_softc *sc, uint32_ ti_offset = TI_WINDOW + (segptr & (TI_WINLEN -1)); if (readdata) { - - bus_space_read_region_4(sc->ti_btag, - sc->ti_bhandle, ti_offset, - (uint32_t *)tmparray, - segsize >> 2); + bus_space_read_region_4(sc->ti_btag, sc->ti_bhandle, + ti_offset, (uint32_t *)sc->ti_membuf, segsize >> 2); if (useraddr) { /* * Yeah, this is a little on the kludgy * side, but at least this code is only * used for debugging. */ - ti_bcopy_swap(tmparray, tmparray2, segsize, - TI_SWAP_NTOH); + ti_bcopy_swap(sc->ti_membuf, sc->ti_membuf2, + segsize, TI_SWAP_NTOH); TI_UNLOCK(sc); if (first_pass) { - copyout(&tmparray2[segresid], ptr, - segsize - segresid); + copyout(&sc->ti_membuf2[segresid], ptr, + segsize - segresid); first_pass = 0; } else - copyout(tmparray2, ptr, segsize); + copyout(sc->ti_membuf2, ptr, segsize); TI_LOCK(sc); } else { if (first_pass) { - ti_bcopy_swap(tmparray, tmparray2, - segsize, TI_SWAP_NTOH); + ti_bcopy_swap(sc->ti_membuf, + sc->ti_membuf2, segsize, + TI_SWAP_NTOH); TI_UNLOCK(sc); - bcopy(&tmparray2[segresid], ptr, - segsize - segresid); + bcopy(&sc->ti_membuf2[segresid], ptr, + segsize - segresid); TI_LOCK(sc); first_pass = 0; } else - ti_bcopy_swap(tmparray, ptr, segsize, - TI_SWAP_NTOH); + ti_bcopy_swap(sc->ti_membuf, ptr, + segsize, TI_SWAP_NTOH); } } else { if (useraddr) { TI_UNLOCK(sc); - copyin(ptr, tmparray2, segsize); + copyin(ptr, sc->ti_membuf2, segsize); TI_LOCK(sc); - ti_bcopy_swap(tmparray2, tmparray, segsize, - TI_SWAP_HTON); + ti_bcopy_swap(sc->ti_membuf2, sc->ti_membuf, + segsize, TI_SWAP_HTON); } else - ti_bcopy_swap(ptr, tmparray, segsize, - TI_SWAP_HTON); + ti_bcopy_swap(ptr, sc->ti_membuf, segsize, + TI_SWAP_HTON); - bus_space_write_region_4(sc->ti_btag, - sc->ti_bhandle, ti_offset, - (uint32_t *)tmparray, - segsize >> 2); + bus_space_write_region_4(sc->ti_btag, sc->ti_bhandle, + ti_offset, (uint32_t *)sc->ti_membuf, segsize >> 2); } segptr += segsize; ptr += segsize; @@ -619,8 +617,8 @@ ti_copy_mem(struct ti_softc *sc, uint32_ * Handle leftover, non-word-aligned bytes. */ if (resid != 0) { - uint32_t tmpval, tmpval2; - bus_size_t ti_offset; + uint32_t tmpval, tmpval2; + bus_size_t ti_offset; /* * Set the segment pointer. @@ -635,7 +633,7 @@ ti_copy_mem(struct ti_softc *sc, uint32_ * writes, since we'll be doing read/modify/write. */ bus_space_read_region_4(sc->ti_btag, sc->ti_bhandle, - ti_offset, &tmpval, 1); + ti_offset, &tmpval, 1); /* * Next, translate this from little-endian to big-endian @@ -677,7 +675,7 @@ ti_copy_mem(struct ti_softc *sc, uint32_ tmpval = htonl(tmpval2); bus_space_write_region_4(sc->ti_btag, sc->ti_bhandle, - ti_offset, &tmpval, 1); + ti_offset, &tmpval, 1); } } @@ -788,8 +786,7 @@ ti_bcopy_swap(const void *src, void *dst size_t tmplen; if (len & 0x3) { - printf("ti_bcopy_swap: length %zd isn't 32-bit aligned\n", - len); + printf("ti_bcopy_swap: length %zd isn't 32-bit aligned\n", len); return (-1); } @@ -799,12 +796,9 @@ ti_bcopy_swap(const void *src, void *dst while (tmplen) { if (swap_type == TI_SWAP_NTOH) - *(uint32_t *)tmpdst = - ntohl(*(const uint32_t *)tmpsrc); + *(uint32_t *)tmpdst = ntohl(*(const uint32_t *)tmpsrc); else - *(uint32_t *)tmpdst = - htonl(*(const uint32_t *)tmpsrc); - + *(uint32_t *)tmpdst = htonl(*(const uint32_t *)tmpsrc); tmpsrc += 4; tmpdst += 4; tmplen -= 4; @@ -1769,7 +1763,8 @@ ti_setmulti(struct ti_softc *sc) * around it on the Tigon 2 by setting a bit in the PCI state register, * but for the Tigon 1 we must give up and abort the interface attach. */ -static int ti_64bitslot_war(struct ti_softc *sc) +static int +ti_64bitslot_war(struct ti_softc *sc) { if (!(CSR_READ_4(sc, TI_PCI_STATE) & TI_PCISTATE_32BIT_BUS)) { @@ -2104,7 +2099,7 @@ ti_gibinit(struct ti_softc *sc) bus_dmamap_sync(sc->ti_rdata_dmat, sc->ti_rdata_dmamap, BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); - /* Set up tuneables */ + /* Set up tunables */ #if 0 if (ifp->if_mtu > (ETHERMTU + ETHER_HDR_LEN + ETHER_CRC_LEN)) CSR_WRITE_4(sc, TI_GCR_RX_COAL_TICKS, @@ -2253,6 +2248,16 @@ ti_attach(device_t dev) goto fail; } + /* Allocate working area for memory dump. */ + sc->ti_membuf = malloc(sizeof(uint8_t) * TI_WINLEN, M_DEVBUF, M_NOWAIT); + sc->ti_membuf2 = malloc(sizeof(uint8_t) * TI_WINLEN, M_DEVBUF, + M_NOWAIT); + if (sc->ti_membuf == NULL || sc->ti_membuf2 == NULL) { + device_printf(dev, "cannot allocate memory buffer\n"); + error = ENOMEM; + goto fail; + } + /* Allocate the general information block and ring buffers. */ if (bus_dma_tag_create(bus_get_dma_tag(dev), /* parent */ 1, 0, /* algnmnt, boundary */ @@ -2363,19 +2368,8 @@ ti_attach(device_t dev) pci_get_device(dev) == NG_DEVICEID_GA620T) sc->ti_copper = 1; - /* Set default tuneable values. */ - sc->ti_stat_ticks = 2 * TI_TICKS_PER_SEC; -#if 0 - sc->ti_rx_coal_ticks = TI_TICKS_PER_SEC / 5000; -#endif - sc->ti_rx_coal_ticks = 170; - sc->ti_tx_coal_ticks = TI_TICKS_PER_SEC / 500; - sc->ti_rx_max_coal_bds = 64; -#if 0 - sc->ti_tx_max_coal_bds = 128; -#endif - sc->ti_tx_max_coal_bds = 32; - sc->ti_tx_buf_ratio = 21; + /* Set default tunable values. */ + ti_sysctl_node(sc); /* Set up ifnet structure */ ifp->if_softc = sc; @@ -2512,6 +2506,10 @@ ti_detach(device_t dev) } if (ifp) if_free(ifp); + if (sc->ti_membuf) + free(sc->ti_membuf, M_DEVBUF); + if (sc->ti_membuf2) + free(sc->ti_membuf2, M_DEVBUF); mtx_destroy(&sc->ti_mtx); @@ -2843,14 +2841,11 @@ ti_intr(void *xsc) TI_LOCK(sc); ifp = sc->ti_ifp; -/*#ifdef notdef*/ - /* Avoid this for now -- checking this register is expensive. */ /* Make sure this is really our interrupt. */ if (!(CSR_READ_4(sc, TI_MISC_HOST_CTL) & TI_MHC_INTSTATE)) { TI_UNLOCK(sc); return; } -/*#endif*/ /* Ack interrupt and stop others from occuring. */ CSR_WRITE_4(sc, TI_MB_HOSTINTR, 1); @@ -3540,7 +3535,7 @@ ti_ioctl2(struct cdev *dev, u_long cmd, TI_LOCK(sc); bcopy(&sc->ti_rdata->ti_info.ti_stats, outstats, - sizeof(struct ti_stats)); + sizeof(struct ti_stats)); TI_UNLOCK(sc); break; } @@ -3559,9 +3554,6 @@ ti_ioctl2(struct cdev *dev, u_long cmd, params->ti_tx_buf_ratio = sc->ti_tx_buf_ratio; params->param_mask = TI_PARAM_ALL; TI_UNLOCK(sc); - - error = 0; - break; } case TIIOCSETPARAMS: @@ -3606,13 +3598,10 @@ ti_ioctl2(struct cdev *dev, u_long cmd, sc->ti_tx_buf_ratio); } TI_UNLOCK(sc); - - error = 0; - break; } case TIIOCSETTRACE: { - ti_trace_type trace_type; + ti_trace_type trace_type; trace_type = *(ti_trace_type *)addr; @@ -3621,10 +3610,9 @@ ti_ioctl2(struct cdev *dev, u_long cmd, * this register to 0 should have the effect of disabling * tracing. */ + TI_LOCK(sc); CSR_WRITE_4(sc, TI_GCR_NIC_TRACING, trace_type); - - error = 0; - + TI_UNLOCK(sc); break; } case TIIOCGETTRACE: { @@ -3637,7 +3625,6 @@ ti_ioctl2(struct cdev *dev, u_long cmd, trace_start = CSR_READ_4(sc, TI_GCR_NICTRACE_START); cur_trace_ptr = CSR_READ_4(sc, TI_GCR_NICTRACE_PTR); trace_len = CSR_READ_4(sc, TI_GCR_NICTRACE_LEN); - #if 0 if_printf(sc->ti_ifp, "trace_start = %#x, cur_trace_ptr = %#x, " "trace_len = %d\n", trace_start, @@ -3645,24 +3632,20 @@ ti_ioctl2(struct cdev *dev, u_long cmd, if_printf(sc->ti_ifp, "trace_buf->buf_len = %d\n", trace_buf->buf_len); #endif - error = ti_copy_mem(sc, trace_start, min(trace_len, - trace_buf->buf_len), - (caddr_t)trace_buf->buf, 1, 1); - + trace_buf->buf_len), (caddr_t)trace_buf->buf, 1, 1); if (error == 0) { trace_buf->fill_len = min(trace_len, - trace_buf->buf_len); + trace_buf->buf_len); if (cur_trace_ptr < trace_start) trace_buf->cur_trace_ptr = - trace_start - cur_trace_ptr; + trace_start - cur_trace_ptr; else trace_buf->cur_trace_ptr = - cur_trace_ptr - trace_start; + cur_trace_ptr - trace_start; } else trace_buf->fill_len = 0; TI_UNLOCK(sc); - break; } @@ -3684,7 +3667,6 @@ ti_ioctl2(struct cdev *dev, u_long cmd, * you're interested in every ioctl, you'll only be * able to debug one board at a time. */ - error = 0; break; case ALT_READ_TG_MEM: case ALT_WRITE_TG_MEM: @@ -3707,25 +3689,22 @@ ti_ioctl2(struct cdev *dev, u_long cmd, * nothing else. */ TI_LOCK(sc); - if ((mem_param->tgAddr >= TI_BEG_SRAM) - && ((mem_param->tgAddr + mem_param->len) <= sram_end)) { + if (mem_param->tgAddr >= TI_BEG_SRAM && + mem_param->tgAddr + mem_param->len <= sram_end) { /* * In this instance, we always copy to/from user * space, so the user space argument is set to 1. */ error = ti_copy_mem(sc, mem_param->tgAddr, - mem_param->len, - mem_param->userAddr, 1, - (cmd == ALT_READ_TG_MEM) ? 1 : 0); - } else if ((mem_param->tgAddr >= TI_BEG_SCRATCH) - && (mem_param->tgAddr <= scratch_end)) { + mem_param->len, mem_param->userAddr, 1, + cmd == ALT_READ_TG_MEM ? 1 : 0); + } else if (mem_param->tgAddr >= TI_BEG_SCRATCH && + mem_param->tgAddr <= scratch_end) { error = ti_copy_scratch(sc, mem_param->tgAddr, - mem_param->len, - mem_param->userAddr, 1, - (cmd == ALT_READ_TG_MEM) ? - 1 : 0, TI_PROCESSOR_A); - } else if ((mem_param->tgAddr >= TI_BEG_SCRATCH_B_DEBUG) - && (mem_param->tgAddr <= TI_BEG_SCRATCH_B_DEBUG)) { + mem_param->len, mem_param->userAddr, 1, + cmd == ALT_READ_TG_MEM ? 1 : 0, TI_PROCESSOR_A); + } else if (mem_param->tgAddr >= TI_BEG_SCRATCH_B_DEBUG && + mem_param->tgAddr <= TI_BEG_SCRATCH_B_DEBUG) { if (sc->ti_hwrev == TI_HWREV_TIGON) { if_printf(sc->ti_ifp, "invalid memory range for Tigon I\n"); @@ -3733,11 +3712,9 @@ ti_ioctl2(struct cdev *dev, u_long cmd, break; } error = ti_copy_scratch(sc, mem_param->tgAddr - - TI_SCRATCH_DEBUG_OFF, - mem_param->len, - mem_param->userAddr, 1, - (cmd == ALT_READ_TG_MEM) ? - 1 : 0, TI_PROCESSOR_B); + TI_SCRATCH_DEBUG_OFF, mem_param->len, + mem_param->userAddr, 1, + cmd == ALT_READ_TG_MEM ? 1 : 0, TI_PROCESSOR_B); } else { if_printf(sc->ti_ifp, "memory address %#x len %d is " "out of supported range\n", @@ -3745,14 +3722,13 @@ ti_ioctl2(struct cdev *dev, u_long cmd, error = EINVAL; } TI_UNLOCK(sc); - break; } case ALT_READ_TG_REG: case ALT_WRITE_TG_REG: { - struct tg_reg *regs; - uint32_t tmpval; + struct tg_reg *regs; + uint32_t tmpval; regs = (struct tg_reg *)addr; @@ -3766,7 +3742,7 @@ ti_ioctl2(struct cdev *dev, u_long cmd, TI_LOCK(sc); if (cmd == ALT_READ_TG_REG) { bus_space_read_region_4(sc->ti_btag, sc->ti_bhandle, - regs->addr, &tmpval, 1); + regs->addr, &tmpval, 1); regs->data = ntohl(tmpval); #if 0 if ((regs->addr == TI_CPU_STATE) @@ -3778,10 +3754,9 @@ ti_ioctl2(struct cdev *dev, u_long cmd, } else { tmpval = htonl(regs->data); bus_space_write_region_4(sc->ti_btag, sc->ti_bhandle, - regs->addr, &tmpval, 1); + regs->addr, &tmpval, 1); } TI_UNLOCK(sc); - break; } default: @@ -3884,3 +3859,58 @@ ti_shutdown(device_t dev) return (0); } + +static void +ti_sysctl_node(struct ti_softc *sc) +{ + struct sysctl_ctx_list *ctx; + struct sysctl_oid_list *child; + + ctx = device_get_sysctl_ctx(sc->ti_dev); + child = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->ti_dev)); + + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "rx_coal_ticks", CTLFLAG_RW, + &sc->ti_rx_coal_ticks, 0, "Receive coalcesced ticks"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "rx_max_coal_bds", CTLFLAG_RW, + &sc->ti_rx_max_coal_bds, 0, "Receive max coalcesced BDs"); + + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tx_coal_ticks", CTLFLAG_RW, + &sc->ti_tx_coal_ticks, 0, "Send coalcesced ticks"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tx_max_coal_bds", CTLFLAG_RW, + &sc->ti_tx_max_coal_bds, 0, "Send max coalcesced BDs"); + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "tx_buf_ratio", CTLFLAG_RW, + &sc->ti_tx_buf_ratio, 0, + "Ratio of NIC memory devoted to TX buffer"); + + SYSCTL_ADD_UINT(ctx, child, OID_AUTO, "stat_ticks", CTLFLAG_RW, + &sc->ti_stat_ticks, 0, + "Number of clock ticks for statistics update interval"); + + /* Pull in device tunables. */ + sc->ti_rx_coal_ticks = 170; + resource_int_value(device_get_name(sc->ti_dev), + device_get_unit(sc->ti_dev), "rx_coal_ticks", + &sc->ti_rx_coal_ticks); + sc->ti_rx_max_coal_bds = 64; + resource_int_value(device_get_name(sc->ti_dev), + device_get_unit(sc->ti_dev), "rx_max_coal_bds", + &sc->ti_rx_max_coal_bds); + + sc->ti_tx_coal_ticks = TI_TICKS_PER_SEC / 500; + resource_int_value(device_get_name(sc->ti_dev), + device_get_unit(sc->ti_dev), "tx_coal_ticks", + &sc->ti_tx_coal_ticks); + sc->ti_tx_max_coal_bds = 32; + resource_int_value(device_get_name(sc->ti_dev), + device_get_unit(sc->ti_dev), "tx_max_coal_bds", + &sc->ti_tx_max_coal_bds); + sc->ti_tx_buf_ratio = 21; + resource_int_value(device_get_name(sc->ti_dev), + device_get_unit(sc->ti_dev), "tx_buf_ratio", + &sc->ti_tx_buf_ratio); + + sc->ti_stat_ticks = 2 * TI_TICKS_PER_SEC; + resource_int_value(device_get_name(sc->ti_dev), + device_get_unit(sc->ti_dev), "stat_ticks", + &sc->ti_stat_ticks); +} Modified: stable/7/sys/dev/ti/if_tireg.h ============================================================================== --- stable/7/sys/dev/ti/if_tireg.h Tue Jan 3 23:38:16 2012 (r229439) +++ stable/7/sys/dev/ti/if_tireg.h Tue Jan 3 23:39:30 2012 (r229440) @@ -1015,6 +1015,8 @@ struct ti_softc { struct callout ti_watchdog; int ti_timer; ti_flag_vals ti_flags; + uint8_t *ti_membuf; + uint8_t *ti_membuf2; struct cdev *dev; }; From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 23:44:05 2012 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 DA5461065672; Tue, 3 Jan 2012 23:44:05 +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 C2D9D8FC0A; Tue, 3 Jan 2012 23:44:05 +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 q03Ni5pN049145; Tue, 3 Jan 2012 23:44:05 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03Ni5Yo049142; Tue, 3 Jan 2012 23:44:05 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201032344.q03Ni5Yo049142@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 23:44:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229441 - stable/9/sys/dev/ti 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, 03 Jan 2012 23:44:06 -0000 Author: yongari Date: Tue Jan 3 23:44:05 2012 New Revision: 229441 URL: http://svn.freebsd.org/changeset/base/229441 Log: MFC r227512: Overhaul bus_dma(9) usage in driver: - Don't use a single big DMA block for all rings. Create separate DMA area for each ring instead. Currently the following DMA areas are created: Event ring, standard RX ring, jumbo RX ring, RX return ring, hardware MAC statistics and producer/consumer status area. For Tigon II, mini RX ring and TX ring are additionally created. - Added missing bus_dmamap_sync(9) in various TX/RX paths. - TX ring is no longer created for Tigon 1 such that it saves more resources on Tigon 1. - Data sheet is not clear about alignment requirement of each ring so use 32 bytes alignment for normal DMA area but use 64 bytes alignment for jumbo RX ring where the extended RX descriptor size is 64 bytes. - For each TX/RX buffers use separate DMA tag(e.g. the size of a DMA segment, total size of DMA segments etc). - Tigon allows separate DMA area for event producer, RX return producer and TX consumer which is really cool feature. This means TX and RX path could be independently run in parallel. However ti(4) uses a single driver lock so it's meaningless to have separate DMA area for these producer/consumer such that this change creates a single status DMA area. - It seems Tigon has no limits on DMA address space and I also don't see any problem with that but old comments in driver indicates there could be issues on descriptors being located in 64bit region. Introduce a tunable, dev.ti.%d.dac, to disable using 64bit DMA in driver. The default is 0 which means it would use full 64bit DMA. If there are DMA issues, users can disable it by setting the tunable to 0. - Do not increase watchdog timer in ti_txeof(). Previously driver increased the watchdog timer whenever there are queued TX frames. - When stat ticks is set to 0, skip processing ti_stats_update(), avoiding bus_dmamap_sync(9) and updating if_collisions counter. - MTU does not include FCS bytes, replace it with ETHER_VLAN_ENCAP_LEN. With these changes, ti(4) should work on PAE environments. Many thanks to Jay Borkenhagen for remote hardware access. Modified: stable/9/sys/dev/ti/if_ti.c stable/9/sys/dev/ti/if_tireg.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/ti/if_ti.c ============================================================================== --- stable/9/sys/dev/ti/if_ti.c Tue Jan 3 23:39:30 2012 (r229440) +++ stable/9/sys/dev/ti/if_ti.c Tue Jan 3 23:44:05 2012 (r229441) @@ -220,9 +220,13 @@ static void ti_loadfw(struct ti_softc *) static void ti_cmd(struct ti_softc *, struct ti_cmd_desc *); static void ti_cmd_ext(struct ti_softc *, struct ti_cmd_desc *, caddr_t, int); static void ti_handle_events(struct ti_softc *); -static int ti_alloc_dmamaps(struct ti_softc *); -static void ti_free_dmamaps(struct ti_softc *); -static int ti_alloc_jumbo_mem(struct ti_softc *); +static void ti_dma_map_addr(void *, bus_dma_segment_t *, int, int); +static int ti_dma_alloc(struct ti_softc *); +static void ti_dma_free(struct ti_softc *); +static int ti_dma_ring_alloc(struct ti_softc *, bus_size_t, bus_size_t, + bus_dma_tag_t *, uint8_t **, bus_dmamap_t *, bus_addr_t *, const char *); +static void ti_dma_ring_free(struct ti_softc *, bus_dma_tag_t *, uint8_t **, + bus_dmamap_t *); static int ti_newbuf_std(struct ti_softc *, int); static int ti_newbuf_mini(struct ti_softc *, int); static int ti_newbuf_jumbo(struct ti_softc *, int, struct mbuf *); @@ -911,11 +915,13 @@ ti_handle_events(struct ti_softc *sc) { struct ti_event_desc *e; - if (sc->ti_rdata->ti_event_ring == NULL) + if (sc->ti_rdata.ti_event_ring == NULL) return; + bus_dmamap_sync(sc->ti_cdata.ti_event_ring_tag, + sc->ti_cdata.ti_event_ring_map, BUS_DMASYNC_POSTREAD); while (sc->ti_ev_saved_considx != sc->ti_ev_prodidx.ti_idx) { - e = &sc->ti_rdata->ti_event_ring[sc->ti_ev_saved_considx]; + e = &sc->ti_rdata.ti_event_ring[sc->ti_ev_saved_considx]; switch (TI_EVENT_EVENT(e)) { case TI_EV_LINKSTAT_CHANGED: sc->ti_linkstat = TI_EVENT_CODE(e); @@ -967,181 +973,402 @@ ti_handle_events(struct ti_softc *sc) TI_INC(sc->ti_ev_saved_considx, TI_EVENT_RING_CNT); CSR_WRITE_4(sc, TI_GCR_EVENTCONS_IDX, sc->ti_ev_saved_considx); } + bus_dmamap_sync(sc->ti_cdata.ti_event_ring_tag, + sc->ti_cdata.ti_event_ring_map, BUS_DMASYNC_PREREAD); +} + +struct ti_dmamap_arg { + bus_addr_t ti_busaddr; +}; + +static void +ti_dma_map_addr(void *arg, bus_dma_segment_t *segs, int nseg, int error) +{ + struct ti_dmamap_arg *ctx; + + if (error) + return; + + KASSERT(nseg == 1, ("%s: %d segments returned!", __func__, nseg)); + + ctx = arg; + ctx->ti_busaddr = segs->ds_addr; } static int -ti_alloc_dmamaps(struct ti_softc *sc) +ti_dma_ring_alloc(struct ti_softc *sc, bus_size_t alignment, bus_size_t maxsize, + bus_dma_tag_t *tag, uint8_t **ring, bus_dmamap_t *map, bus_addr_t *paddr, + const char *msg) { - int i; + struct ti_dmamap_arg ctx; + int error; - for (i = 0; i < TI_TX_RING_CNT; i++) { - sc->ti_cdata.ti_txdesc[i].tx_m = NULL; - sc->ti_cdata.ti_txdesc[i].tx_dmamap = NULL; - if (bus_dmamap_create(sc->ti_mbuftx_dmat, 0, - &sc->ti_cdata.ti_txdesc[i].tx_dmamap)) { - device_printf(sc->ti_dev, - "cannot create DMA map for TX\n"); - return (ENOBUFS); - } + error = bus_dma_tag_create(sc->ti_cdata.ti_parent_tag, + alignment, 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, + NULL, maxsize, 1, maxsize, 0, NULL, NULL, tag); + if (error != 0) { + device_printf(sc->ti_dev, + "could not create %s dma tag\n", msg); + return (error); + } + /* Allocate DMA'able memory for ring. */ + error = bus_dmamem_alloc(*tag, (void **)ring, + BUS_DMA_NOWAIT | BUS_DMA_ZERO | BUS_DMA_COHERENT, map); + if (error != 0) { + device_printf(sc->ti_dev, + "could not allocate DMA'able memory for %s\n", msg); + return (error); } + /* Load the address of the ring. */ + ctx.ti_busaddr = 0; + error = bus_dmamap_load(*tag, *map, *ring, maxsize, ti_dma_map_addr, + &ctx, BUS_DMA_NOWAIT); + if (error != 0) { + device_printf(sc->ti_dev, + "could not load DMA'able memory for %s\n", msg); + return (error); + } + *paddr = ctx.ti_busaddr; + return (0); +} + +static void +ti_dma_ring_free(struct ti_softc *sc, bus_dma_tag_t *tag, uint8_t **ring, + bus_dmamap_t *map) +{ + + if (*map != NULL) + bus_dmamap_unload(*tag, *map); + if (*map != NULL && *ring != NULL) { + bus_dmamem_free(*tag, *ring, *map); + *ring = NULL; + *map = NULL; + } + if (*tag) { + bus_dma_tag_destroy(*tag); + *tag = NULL; + } +} + +static int +ti_dma_alloc(struct ti_softc *sc) +{ + bus_addr_t lowaddr; + int i, error; + + lowaddr = BUS_SPACE_MAXADDR; + if (sc->ti_dac == 0) + lowaddr = BUS_SPACE_MAXADDR_32BIT; + + error = bus_dma_tag_create(bus_get_dma_tag(sc->ti_dev), 1, 0, lowaddr, + BUS_SPACE_MAXADDR, NULL, NULL, BUS_SPACE_MAXSIZE_32BIT, 0, + BUS_SPACE_MAXSIZE_32BIT, 0, NULL, NULL, + &sc->ti_cdata.ti_parent_tag); + if (error != 0) { + device_printf(sc->ti_dev, + "could not allocate parent dma tag\n"); + return (ENOMEM); + } + + error = ti_dma_ring_alloc(sc, TI_RING_ALIGN, sizeof(struct ti_gib), + &sc->ti_cdata.ti_gib_tag, (uint8_t **)&sc->ti_rdata.ti_info, + &sc->ti_cdata.ti_gib_map, &sc->ti_rdata.ti_info_paddr, "GIB"); + if (error) + return (error); + + /* Producer/consumer status */ + error = ti_dma_ring_alloc(sc, TI_RING_ALIGN, sizeof(struct ti_status), + &sc->ti_cdata.ti_status_tag, (uint8_t **)&sc->ti_rdata.ti_status, + &sc->ti_cdata.ti_status_map, &sc->ti_rdata.ti_status_paddr, + "event ring"); + if (error) + return (error); + + /* Event ring */ + error = ti_dma_ring_alloc(sc, TI_RING_ALIGN, TI_EVENT_RING_SZ, + &sc->ti_cdata.ti_event_ring_tag, + (uint8_t **)&sc->ti_rdata.ti_event_ring, + &sc->ti_cdata.ti_event_ring_map, &sc->ti_rdata.ti_event_ring_paddr, + "event ring"); + if (error) + return (error); + + /* Command ring lives in shared memory so no need to create DMA area. */ + + /* Standard RX ring */ + error = ti_dma_ring_alloc(sc, TI_RING_ALIGN, TI_STD_RX_RING_SZ, + &sc->ti_cdata.ti_rx_std_ring_tag, + (uint8_t **)&sc->ti_rdata.ti_rx_std_ring, + &sc->ti_cdata.ti_rx_std_ring_map, + &sc->ti_rdata.ti_rx_std_ring_paddr, "RX ring"); + if (error) + return (error); + + /* Jumbo RX ring */ + error = ti_dma_ring_alloc(sc, TI_JUMBO_RING_ALIGN, TI_JUMBO_RX_RING_SZ, + &sc->ti_cdata.ti_rx_jumbo_ring_tag, + (uint8_t **)&sc->ti_rdata.ti_rx_jumbo_ring, + &sc->ti_cdata.ti_rx_jumbo_ring_map, + &sc->ti_rdata.ti_rx_jumbo_ring_paddr, "jumbo RX ring"); + if (error) + return (error); + + /* RX return ring */ + error = ti_dma_ring_alloc(sc, TI_RING_ALIGN, TI_RX_RETURN_RING_SZ, + &sc->ti_cdata.ti_rx_return_ring_tag, + (uint8_t **)&sc->ti_rdata.ti_rx_return_ring, + &sc->ti_cdata.ti_rx_return_ring_map, + &sc->ti_rdata.ti_rx_return_ring_paddr, "RX return ring"); + if (error) + return (error); + + /* Create DMA tag for standard RX mbufs. */ + error = bus_dma_tag_create(sc->ti_cdata.ti_parent_tag, 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES, 1, + MCLBYTES, 0, NULL, NULL, &sc->ti_cdata.ti_rx_std_tag); + if (error) { + device_printf(sc->ti_dev, "could not allocate RX dma tag\n"); + return (error); + } + + /* Create DMA tag for jumbo RX mbufs. */ +#ifdef TI_SF_BUF_JUMBO + /* + * The VM system will take care of providing aligned pages. Alignment + * is set to 1 here so that busdma resources won't be wasted. + */ + error = bus_dma_tag_create(sc->ti_cdata.ti_parent_tag, 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, PAGE_SIZE * 4, 4, + PAGE_SIZE, 0, NULL, NULL, &sc->ti_cdata.ti_rx_jumbo_tag); +#else + error = bus_dma_tag_create(sc->ti_cdata.ti_parent_tag, 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, MJUM9BYTES, 1, + MJUM9BYTES, 0, NULL, NULL, &sc->ti_cdata.ti_rx_jumbo_tag); +#endif + if (error) { + device_printf(sc->ti_dev, + "could not allocate jumbo RX dma tag\n"); + return (error); + } + + /* Create DMA tag for TX mbufs. */ + error = bus_dma_tag_create(sc->ti_cdata.ti_parent_tag, 1, + 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, + MCLBYTES * TI_MAXTXSEGS, TI_MAXTXSEGS, MCLBYTES, 0, NULL, NULL, + &sc->ti_cdata.ti_tx_tag); + if (error) { + device_printf(sc->ti_dev, "could not allocate TX dma tag\n"); + return (ENOMEM); + } + + /* Create DMA maps for RX buffers. */ for (i = 0; i < TI_STD_RX_RING_CNT; i++) { - if (bus_dmamap_create(sc->ti_mbufrx_dmat, 0, - &sc->ti_cdata.ti_rx_std_maps[i])) { + error = bus_dmamap_create(sc->ti_cdata.ti_rx_std_tag, 0, + &sc->ti_cdata.ti_rx_std_maps[i]); + if (error) { device_printf(sc->ti_dev, - "cannot create DMA map for RX\n"); - return (ENOBUFS); + "could not create DMA map for RX\n"); + return (error); } } - if (bus_dmamap_create(sc->ti_mbufrx_dmat, 0, - &sc->ti_cdata.ti_rx_std_sparemap)) { + error = bus_dmamap_create(sc->ti_cdata.ti_rx_std_tag, 0, + &sc->ti_cdata.ti_rx_std_sparemap); + if (error) { device_printf(sc->ti_dev, - "cannot create spare DMA map for RX\n"); - return (ENOBUFS); + "could not create spare DMA map for RX\n"); + return (error); } + /* Create DMA maps for jumbo RX buffers. */ for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) { - if (bus_dmamap_create(sc->ti_jumbo_dmat, 0, - &sc->ti_cdata.ti_rx_jumbo_maps[i])) { + error = bus_dmamap_create(sc->ti_cdata.ti_rx_jumbo_tag, 0, + &sc->ti_cdata.ti_rx_jumbo_maps[i]); + if (error) { device_printf(sc->ti_dev, - "cannot create DMA map for jumbo RX\n"); - return (ENOBUFS); + "could not create DMA map for jumbo RX\n"); + return (error); } } - if (bus_dmamap_create(sc->ti_jumbo_dmat, 0, - &sc->ti_cdata.ti_rx_jumbo_sparemap)) { + error = bus_dmamap_create(sc->ti_cdata.ti_rx_jumbo_tag, 0, + &sc->ti_cdata.ti_rx_jumbo_sparemap); + if (error) { device_printf(sc->ti_dev, - "cannot create spare DMA map for jumbo RX\n"); - return (ENOBUFS); + "could not create spare DMA map for jumbo RX\n"); + return (error); + } + + /* Create DMA maps for TX buffers. */ + for (i = 0; i < TI_TX_RING_CNT; i++) { + error = bus_dmamap_create(sc->ti_cdata.ti_tx_tag, 0, + &sc->ti_cdata.ti_txdesc[i].tx_dmamap); + if (error) { + device_printf(sc->ti_dev, + "could not create DMA map for TX\n"); + return (ENOMEM); + } } - /* Mini ring is not available on Tigon 1. */ + /* Mini ring and TX ring is not available on Tigon 1. */ if (sc->ti_hwrev == TI_HWREV_TIGON) return (0); + /* TX ring */ + error = ti_dma_ring_alloc(sc, TI_RING_ALIGN, TI_TX_RING_SZ, + &sc->ti_cdata.ti_tx_ring_tag, (uint8_t **)&sc->ti_rdata.ti_tx_ring, + &sc->ti_cdata.ti_tx_ring_map, &sc->ti_rdata.ti_tx_ring_paddr, + "TX ring"); + if (error) + return (error); + + /* Mini RX ring */ + error = ti_dma_ring_alloc(sc, TI_RING_ALIGN, TI_MINI_RX_RING_SZ, + &sc->ti_cdata.ti_rx_mini_ring_tag, + (uint8_t **)&sc->ti_rdata.ti_rx_mini_ring, + &sc->ti_cdata.ti_rx_mini_ring_map, + &sc->ti_rdata.ti_rx_mini_ring_paddr, "mini RX ring"); + if (error) + return (error); + + /* Create DMA tag for mini RX mbufs. */ + error = bus_dma_tag_create(sc->ti_cdata.ti_parent_tag, 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, MHLEN, 1, + MHLEN, 0, NULL, NULL, &sc->ti_cdata.ti_rx_mini_tag); + if (error) { + device_printf(sc->ti_dev, + "could not allocate mini RX dma tag\n"); + return (error); + } + + /* Create DMA maps for mini RX buffers. */ for (i = 0; i < TI_MINI_RX_RING_CNT; i++) { - if (bus_dmamap_create(sc->ti_mbufrx_dmat, 0, - &sc->ti_cdata.ti_rx_mini_maps[i])) { + error = bus_dmamap_create(sc->ti_cdata.ti_rx_mini_tag, 0, + &sc->ti_cdata.ti_rx_mini_maps[i]); + if (error) { device_printf(sc->ti_dev, - "cannot create DMA map for mini RX\n"); - return (ENOBUFS); + "could not create DMA map for mini RX\n"); + return (error); } } - if (bus_dmamap_create(sc->ti_mbufrx_dmat, 0, - &sc->ti_cdata.ti_rx_mini_sparemap)) { + error = bus_dmamap_create(sc->ti_cdata.ti_rx_mini_tag, 0, + &sc->ti_cdata.ti_rx_mini_sparemap); + if (error) { device_printf(sc->ti_dev, - "cannot create DMA map for mini RX\n"); - return (ENOBUFS); + "could not create spare DMA map for mini RX\n"); + return (error); } return (0); } static void -ti_free_dmamaps(struct ti_softc *sc) +ti_dma_free(struct ti_softc *sc) { int i; - if (sc->ti_mbuftx_dmat) { - for (i = 0; i < TI_TX_RING_CNT; i++) { - if (sc->ti_cdata.ti_txdesc[i].tx_dmamap) { - bus_dmamap_destroy(sc->ti_mbuftx_dmat, - sc->ti_cdata.ti_txdesc[i].tx_dmamap); - sc->ti_cdata.ti_txdesc[i].tx_dmamap = NULL; - } + /* Destroy DMA maps for RX buffers. */ + for (i = 0; i < TI_STD_RX_RING_CNT; i++) { + if (sc->ti_cdata.ti_rx_std_maps[i]) { + bus_dmamap_destroy(sc->ti_cdata.ti_rx_std_tag, + sc->ti_cdata.ti_rx_std_maps[i]); + sc->ti_cdata.ti_rx_std_maps[i] = NULL; } } - - if (sc->ti_mbufrx_dmat) { - for (i = 0; i < TI_STD_RX_RING_CNT; i++) { - if (sc->ti_cdata.ti_rx_std_maps[i]) { - bus_dmamap_destroy(sc->ti_mbufrx_dmat, - sc->ti_cdata.ti_rx_std_maps[i]); - sc->ti_cdata.ti_rx_std_maps[i] = NULL; - } - } - if (sc->ti_cdata.ti_rx_std_sparemap) { - bus_dmamap_destroy(sc->ti_mbufrx_dmat, - sc->ti_cdata.ti_rx_std_sparemap); - sc->ti_cdata.ti_rx_std_sparemap = NULL; - } + if (sc->ti_cdata.ti_rx_std_sparemap) { + bus_dmamap_destroy(sc->ti_cdata.ti_rx_std_tag, + sc->ti_cdata.ti_rx_std_sparemap); + sc->ti_cdata.ti_rx_std_sparemap = NULL; + } + if (sc->ti_cdata.ti_rx_std_tag) { + bus_dma_tag_destroy(sc->ti_cdata.ti_rx_std_tag); + sc->ti_cdata.ti_rx_std_tag = NULL; } - if (sc->ti_jumbo_dmat) { - for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) { - if (sc->ti_cdata.ti_rx_jumbo_maps[i]) { - bus_dmamap_destroy(sc->ti_jumbo_dmat, - sc->ti_cdata.ti_rx_jumbo_maps[i]); - sc->ti_cdata.ti_rx_jumbo_maps[i] = NULL; - } - } - if (sc->ti_cdata.ti_rx_jumbo_sparemap) { - bus_dmamap_destroy(sc->ti_jumbo_dmat, - sc->ti_cdata.ti_rx_jumbo_sparemap); - sc->ti_cdata.ti_rx_jumbo_sparemap = NULL; + /* Destroy DMA maps for jumbo RX buffers. */ + for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) { + if (sc->ti_cdata.ti_rx_jumbo_maps[i]) { + bus_dmamap_destroy(sc->ti_cdata.ti_rx_jumbo_tag, + sc->ti_cdata.ti_rx_jumbo_maps[i]); + sc->ti_cdata.ti_rx_jumbo_maps[i] = NULL; } } + if (sc->ti_cdata.ti_rx_jumbo_sparemap) { + bus_dmamap_destroy(sc->ti_cdata.ti_rx_jumbo_tag, + sc->ti_cdata.ti_rx_jumbo_sparemap); + sc->ti_cdata.ti_rx_jumbo_sparemap = NULL; + } + if (sc->ti_cdata.ti_rx_jumbo_tag) { + bus_dma_tag_destroy(sc->ti_cdata.ti_rx_jumbo_tag); + sc->ti_cdata.ti_rx_jumbo_tag = NULL; + } - if (sc->ti_mbufrx_dmat) { - for (i = 0; i < TI_MINI_RX_RING_CNT; i++) { - if (sc->ti_cdata.ti_rx_mini_maps[i]) { - bus_dmamap_destroy(sc->ti_mbufrx_dmat, - sc->ti_cdata.ti_rx_mini_maps[i]); - sc->ti_cdata.ti_rx_mini_maps[i] = NULL; - } - } - if (sc->ti_cdata.ti_rx_mini_sparemap) { - bus_dmamap_destroy(sc->ti_mbufrx_dmat, - sc->ti_cdata.ti_rx_mini_sparemap); - sc->ti_cdata.ti_rx_mini_sparemap = NULL; + /* Destroy DMA maps for mini RX buffers. */ + for (i = 0; i < TI_MINI_RX_RING_CNT; i++) { + if (sc->ti_cdata.ti_rx_mini_maps[i]) { + bus_dmamap_destroy(sc->ti_cdata.ti_rx_mini_tag, + sc->ti_cdata.ti_rx_mini_maps[i]); + sc->ti_cdata.ti_rx_mini_maps[i] = NULL; } } -} - -#ifndef TI_SF_BUF_JUMBO - -static int -ti_alloc_jumbo_mem(struct ti_softc *sc) -{ - - if (bus_dma_tag_create(sc->ti_parent_dmat, 1, 0, BUS_SPACE_MAXADDR, - BUS_SPACE_MAXADDR, NULL, NULL, MJUM9BYTES, 1, MJUM9BYTES, 0, NULL, - NULL, &sc->ti_jumbo_dmat) != 0) { - device_printf(sc->ti_dev, "Failed to allocate jumbo dmat\n"); - return (ENOBUFS); + if (sc->ti_cdata.ti_rx_mini_sparemap) { + bus_dmamap_destroy(sc->ti_cdata.ti_rx_mini_tag, + sc->ti_cdata.ti_rx_mini_sparemap); + sc->ti_cdata.ti_rx_mini_sparemap = NULL; } - return (0); -} - -#else - -static int -ti_alloc_jumbo_mem(struct ti_softc *sc) -{ - - /* - * The VM system will take care of providing aligned pages. Alignment - * is set to 1 here so that busdma resources won't be wasted. - */ - if (bus_dma_tag_create(sc->ti_parent_dmat, /* parent */ - 1, 0, /* algnmnt, boundary */ - BUS_SPACE_MAXADDR, /* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - PAGE_SIZE * 4 /*XXX*/, /* maxsize */ - 4, /* nsegments */ - PAGE_SIZE, /* maxsegsize */ - 0, /* flags */ - NULL, NULL, /* lockfunc, lockarg */ - &sc->ti_jumbo_dmat) != 0) { - device_printf(sc->ti_dev, "Failed to allocate jumbo dmat\n"); - return (ENOBUFS); + if (sc->ti_cdata.ti_rx_mini_tag) { + bus_dma_tag_destroy(sc->ti_cdata.ti_rx_mini_tag); + sc->ti_cdata.ti_rx_mini_tag = NULL; } - return (0); + /* Destroy DMA maps for TX buffers. */ + for (i = 0; i < TI_TX_RING_CNT; i++) { + if (sc->ti_cdata.ti_txdesc[i].tx_dmamap) { + bus_dmamap_destroy(sc->ti_cdata.ti_tx_tag, + sc->ti_cdata.ti_txdesc[i].tx_dmamap); + sc->ti_cdata.ti_txdesc[i].tx_dmamap = NULL; + } + } + if (sc->ti_cdata.ti_tx_tag) { + bus_dma_tag_destroy(sc->ti_cdata.ti_tx_tag); + sc->ti_cdata.ti_tx_tag = NULL; + } + + /* Destroy standard RX ring. */ + ti_dma_ring_free(sc, &sc->ti_cdata.ti_rx_std_ring_tag, + (void *)&sc->ti_rdata.ti_rx_std_ring, + &sc->ti_cdata.ti_rx_std_ring_map); + /* Destroy jumbo RX ring. */ + ti_dma_ring_free(sc, &sc->ti_cdata.ti_rx_jumbo_ring_tag, + (void *)&sc->ti_rdata.ti_rx_jumbo_ring, + &sc->ti_cdata.ti_rx_jumbo_ring_map); + /* Destroy mini RX ring. */ + ti_dma_ring_free(sc, &sc->ti_cdata.ti_rx_mini_ring_tag, + (void *)&sc->ti_rdata.ti_rx_mini_ring, + &sc->ti_cdata.ti_rx_mini_ring_map); + /* Destroy RX return ring. */ + ti_dma_ring_free(sc, &sc->ti_cdata.ti_rx_return_ring_tag, + (void *)&sc->ti_rdata.ti_rx_return_ring, + &sc->ti_cdata.ti_rx_return_ring_map); + /* Destroy TX ring. */ + ti_dma_ring_free(sc, &sc->ti_cdata.ti_tx_ring_tag, + (void *)&sc->ti_rdata.ti_tx_ring, &sc->ti_cdata.ti_tx_ring_map); + /* Destroy status block. */ + ti_dma_ring_free(sc, &sc->ti_cdata.ti_status_tag, + (void *)&sc->ti_rdata.ti_status, &sc->ti_cdata.ti_status_map); + /* Destroy event ring. */ + ti_dma_ring_free(sc, &sc->ti_cdata.ti_event_ring_tag, + (void *)&sc->ti_rdata.ti_event_ring, + &sc->ti_cdata.ti_event_ring_map); + /* Destroy GIB */ + ti_dma_ring_free(sc, &sc->ti_cdata.ti_gib_tag, + (void *)&sc->ti_rdata.ti_info, &sc->ti_cdata.ti_gib_map); + + /* Destroy the parent tag. */ + if (sc->ti_cdata.ti_parent_tag) { + bus_dma_tag_destroy(sc->ti_cdata.ti_parent_tag); + sc->ti_cdata.ti_parent_tag = NULL; + } } -#endif /* TI_SF_BUF_JUMBO */ - /* * Intialize a standard receive ring descriptor. */ @@ -1160,7 +1387,7 @@ ti_newbuf_std(struct ti_softc *sc, int i m->m_len = m->m_pkthdr.len = MCLBYTES; m_adj(m, ETHER_ALIGN); - error = bus_dmamap_load_mbuf_sg(sc->ti_mbufrx_dmat, + error = bus_dmamap_load_mbuf_sg(sc->ti_cdata.ti_rx_std_tag, sc->ti_cdata.ti_rx_std_sparemap, m, segs, &nsegs, 0); if (error != 0) { m_freem(m); @@ -1169,9 +1396,9 @@ ti_newbuf_std(struct ti_softc *sc, int i KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); if (sc->ti_cdata.ti_rx_std_chain[i] != NULL) { - bus_dmamap_sync(sc->ti_mbufrx_dmat, + bus_dmamap_sync(sc->ti_cdata.ti_rx_std_tag, sc->ti_cdata.ti_rx_std_maps[i], BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(sc->ti_mbufrx_dmat, + bus_dmamap_unload(sc->ti_cdata.ti_rx_std_tag, sc->ti_cdata.ti_rx_std_maps[i]); } @@ -1180,7 +1407,7 @@ ti_newbuf_std(struct ti_softc *sc, int i sc->ti_cdata.ti_rx_std_sparemap = map; sc->ti_cdata.ti_rx_std_chain[i] = m; - r = &sc->ti_rdata->ti_rx_std_ring[i]; + r = &sc->ti_rdata.ti_rx_std_ring[i]; ti_hostaddr64(&r->ti_addr, segs[0].ds_addr); r->ti_len = segs[0].ds_len; r->ti_type = TI_BDTYPE_RECV_BD; @@ -1191,8 +1418,8 @@ ti_newbuf_std(struct ti_softc *sc, int i r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; r->ti_idx = i; - bus_dmamap_sync(sc->ti_mbufrx_dmat, sc->ti_cdata.ti_rx_std_maps[i], - BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->ti_cdata.ti_rx_std_tag, + sc->ti_cdata.ti_rx_std_maps[i], BUS_DMASYNC_PREREAD); return (0); } @@ -1215,7 +1442,7 @@ ti_newbuf_mini(struct ti_softc *sc, int m->m_len = m->m_pkthdr.len = MHLEN; m_adj(m, ETHER_ALIGN); - error = bus_dmamap_load_mbuf_sg(sc->ti_mbufrx_dmat, + error = bus_dmamap_load_mbuf_sg(sc->ti_cdata.ti_rx_mini_tag, sc->ti_cdata.ti_rx_mini_sparemap, m, segs, &nsegs, 0); if (error != 0) { m_freem(m); @@ -1224,9 +1451,9 @@ ti_newbuf_mini(struct ti_softc *sc, int KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); if (sc->ti_cdata.ti_rx_mini_chain[i] != NULL) { - bus_dmamap_sync(sc->ti_mbufrx_dmat, + bus_dmamap_sync(sc->ti_cdata.ti_rx_mini_tag, sc->ti_cdata.ti_rx_mini_maps[i], BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(sc->ti_mbufrx_dmat, + bus_dmamap_unload(sc->ti_cdata.ti_rx_mini_tag, sc->ti_cdata.ti_rx_mini_maps[i]); } @@ -1235,7 +1462,7 @@ ti_newbuf_mini(struct ti_softc *sc, int sc->ti_cdata.ti_rx_mini_sparemap = map; sc->ti_cdata.ti_rx_mini_chain[i] = m; - r = &sc->ti_rdata->ti_rx_mini_ring[i]; + r = &sc->ti_rdata.ti_rx_mini_ring[i]; ti_hostaddr64(&r->ti_addr, segs[0].ds_addr); r->ti_len = segs[0].ds_len; r->ti_type = TI_BDTYPE_RECV_BD; @@ -1246,8 +1473,8 @@ ti_newbuf_mini(struct ti_softc *sc, int r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; r->ti_idx = i; - bus_dmamap_sync(sc->ti_mbufrx_dmat, sc->ti_cdata.ti_rx_mini_maps[i], - BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->ti_cdata.ti_rx_mini_tag, + sc->ti_cdata.ti_rx_mini_maps[i], BUS_DMASYNC_PREREAD); return (0); } @@ -1274,7 +1501,7 @@ ti_newbuf_jumbo(struct ti_softc *sc, int m->m_len = m->m_pkthdr.len = MJUM9BYTES; m_adj(m, ETHER_ALIGN); - error = bus_dmamap_load_mbuf_sg(sc->ti_jumbo_dmat, + error = bus_dmamap_load_mbuf_sg(sc->ti_cdata.ti_rx_jumbo_tag, sc->ti_cdata.ti_rx_jumbo_sparemap, m, segs, &nsegs, 0); if (error != 0) { m_freem(m); @@ -1283,9 +1510,9 @@ ti_newbuf_jumbo(struct ti_softc *sc, int KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); if (sc->ti_cdata.ti_rx_jumbo_chain[i] != NULL) { - bus_dmamap_sync(sc->ti_jumbo_dmat, + bus_dmamap_sync(sc->ti_cdata.ti_rx_jumbo_tag, sc->ti_cdata.ti_rx_jumbo_maps[i], BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(sc->ti_jumbo_dmat, + bus_dmamap_unload(sc->ti_cdata.ti_rx_jumbo_tag, sc->ti_cdata.ti_rx_jumbo_maps[i]); } @@ -1294,7 +1521,7 @@ ti_newbuf_jumbo(struct ti_softc *sc, int sc->ti_cdata.ti_rx_jumbo_sparemap = map; sc->ti_cdata.ti_rx_jumbo_chain[i] = m; - r = &sc->ti_rdata->ti_rx_jumbo_ring[i]; + r = &sc->ti_rdata.ti_rx_jumbo_ring[i]; ti_hostaddr64(&r->ti_addr, segs[0].ds_addr); r->ti_len = segs[0].ds_len; r->ti_type = TI_BDTYPE_RECV_JUMBO_BD; @@ -1305,8 +1532,8 @@ ti_newbuf_jumbo(struct ti_softc *sc, int r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; r->ti_idx = i; - bus_dmamap_sync(sc->ti_jumbo_dmat, sc->ti_cdata.ti_rx_jumbo_maps[i], - BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->ti_cdata.ti_rx_jumbo_tag, + sc->ti_cdata.ti_rx_jumbo_maps[i], BUS_DMASYNC_PREREAD); return (0); } @@ -1417,11 +1644,11 @@ ti_newbuf_jumbo(struct ti_softc *sc, int } /* Set up the descriptor. */ - r = &sc->ti_rdata->ti_rx_jumbo_ring[idx]; + r = &sc->ti_rdata.ti_rx_jumbo_ring[idx]; sc->ti_cdata.ti_rx_jumbo_chain[idx] = m_new; map = sc->ti_cdata.ti_rx_jumbo_maps[i]; - if (bus_dmamap_load_mbuf_sg(sc->ti_jumbo_dmat, map, m_new, segs, - &nsegs, 0)) + if (bus_dmamap_load_mbuf_sg(sc->ti_cdata.ti_rx_jumbo_tag, map, m_new, + segs, &nsegs, 0)) return (ENOBUFS); if ((nsegs < 1) || (nsegs > 4)) return (ENOBUFS); @@ -1449,7 +1676,7 @@ ti_newbuf_jumbo(struct ti_softc *sc, int r->ti_idx = idx; - bus_dmamap_sync(sc->ti_jumbo_dmat, map, BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->ti_cdata.ti_rx_jumbo_tag, map, BUS_DMASYNC_PREREAD); return (0); nobufs: @@ -1505,15 +1732,16 @@ ti_free_rx_ring_std(struct ti_softc *sc) for (i = 0; i < TI_STD_RX_RING_CNT; i++) { if (sc->ti_cdata.ti_rx_std_chain[i] != NULL) { map = sc->ti_cdata.ti_rx_std_maps[i]; - bus_dmamap_sync(sc->ti_mbufrx_dmat, map, + bus_dmamap_sync(sc->ti_cdata.ti_rx_std_tag, map, BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(sc->ti_mbufrx_dmat, map); + bus_dmamap_unload(sc->ti_cdata.ti_rx_std_tag, map); m_freem(sc->ti_cdata.ti_rx_std_chain[i]); sc->ti_cdata.ti_rx_std_chain[i] = NULL; } - bzero((char *)&sc->ti_rdata->ti_rx_std_ring[i], - sizeof(struct ti_rx_desc)); } + bzero(sc->ti_rdata.ti_rx_std_ring, TI_STD_RX_RING_SZ); + bus_dmamap_sync(sc->ti_cdata.ti_rx_std_ring_tag, + sc->ti_cdata.ti_rx_std_ring_map, BUS_DMASYNC_PREWRITE); } static int @@ -1542,15 +1770,16 @@ ti_free_rx_ring_jumbo(struct ti_softc *s for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) { if (sc->ti_cdata.ti_rx_jumbo_chain[i] != NULL) { map = sc->ti_cdata.ti_rx_jumbo_maps[i]; - bus_dmamap_sync(sc->ti_jumbo_dmat, map, + bus_dmamap_sync(sc->ti_cdata.ti_rx_jumbo_tag, map, BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(sc->ti_jumbo_dmat, map); + bus_dmamap_unload(sc->ti_cdata.ti_rx_jumbo_tag, map); m_freem(sc->ti_cdata.ti_rx_jumbo_chain[i]); sc->ti_cdata.ti_rx_jumbo_chain[i] = NULL; } - bzero((char *)&sc->ti_rdata->ti_rx_jumbo_ring[i], - sizeof(struct ti_rx_desc)); } + bzero(sc->ti_rdata.ti_rx_jumbo_ring, TI_JUMBO_RX_RING_SZ); + bus_dmamap_sync(sc->ti_cdata.ti_rx_jumbo_ring_tag, + sc->ti_cdata.ti_rx_jumbo_ring_map, BUS_DMASYNC_PREWRITE); } static int @@ -1575,18 +1804,22 @@ ti_free_rx_ring_mini(struct ti_softc *sc bus_dmamap_t map; int i; + if (sc->ti_rdata.ti_rx_mini_ring == NULL) + return; + for (i = 0; i < TI_MINI_RX_RING_CNT; i++) { if (sc->ti_cdata.ti_rx_mini_chain[i] != NULL) { map = sc->ti_cdata.ti_rx_mini_maps[i]; - bus_dmamap_sync(sc->ti_mbufrx_dmat, map, + bus_dmamap_sync(sc->ti_cdata.ti_rx_mini_tag, map, BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(sc->ti_mbufrx_dmat, map); + bus_dmamap_unload(sc->ti_cdata.ti_rx_mini_tag, map); m_freem(sc->ti_cdata.ti_rx_mini_chain[i]); sc->ti_cdata.ti_rx_mini_chain[i] = NULL; } - bzero((char *)&sc->ti_rdata->ti_rx_mini_ring[i], - sizeof(struct ti_rx_desc)); } + bzero(sc->ti_rdata.ti_rx_mini_ring, TI_MINI_RX_RING_SZ); + bus_dmamap_sync(sc->ti_cdata.ti_rx_mini_ring_tag, + sc->ti_cdata.ti_rx_mini_ring_map, BUS_DMASYNC_PREWRITE); } static void @@ -1595,21 +1828,23 @@ ti_free_tx_ring(struct ti_softc *sc) struct ti_txdesc *txd; int i; - if (sc->ti_rdata->ti_tx_ring == NULL) + if (sc->ti_rdata.ti_tx_ring == NULL) return; for (i = 0; i < TI_TX_RING_CNT; i++) { txd = &sc->ti_cdata.ti_txdesc[i]; if (txd->tx_m != NULL) { - bus_dmamap_sync(sc->ti_mbuftx_dmat, txd->tx_dmamap, + bus_dmamap_sync(sc->ti_cdata.ti_tx_tag, txd->tx_dmamap, BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(sc->ti_mbuftx_dmat, txd->tx_dmamap); + bus_dmamap_unload(sc->ti_cdata.ti_tx_tag, + txd->tx_dmamap); m_freem(txd->tx_m); txd->tx_m = NULL; } - bzero((char *)&sc->ti_rdata->ti_tx_ring[i], - sizeof(struct ti_tx_desc)); } + bzero(sc->ti_rdata.ti_tx_ring, TI_TX_RING_SZ); + bus_dmamap_sync(sc->ti_cdata.ti_tx_ring_tag, + sc->ti_cdata.ti_tx_ring_map, BUS_DMASYNC_PREWRITE); } static int @@ -1941,25 +2176,20 @@ ti_gibinit(struct ti_softc *sc) { struct ifnet *ifp; struct ti_rcb *rcb; - uint32_t rdphys; int i; TI_LOCK_ASSERT(sc); ifp = sc->ti_ifp; - rdphys = sc->ti_rdata_phys; /* Disable interrupts for now. */ CSR_WRITE_4(sc, TI_MB_HOSTINTR, 1); - /* - * Tell the chip where to find the general information block. - * While this struct could go into >4GB memory, we allocate it in a - * single slab with the other descriptors, and those don't seem to - * support being located in a 64-bit region. - */ - CSR_WRITE_4(sc, TI_GCR_GENINFO_HI, 0); - CSR_WRITE_4(sc, TI_GCR_GENINFO_LO, rdphys + TI_RD_OFF(ti_info)); + /* Tell the chip where to find the general information block. */ + CSR_WRITE_4(sc, TI_GCR_GENINFO_HI, + (uint64_t)sc->ti_rdata.ti_info_paddr >> 32); + CSR_WRITE_4(sc, TI_GCR_GENINFO_LO, + sc->ti_rdata.ti_info_paddr & 0xFFFFFFFF); /* Load the firmware into SRAM. */ ti_loadfw(sc); @@ -1967,20 +2197,20 @@ ti_gibinit(struct ti_softc *sc) /* Set up the contents of the general info and ring control blocks. */ /* Set up the event ring and producer pointer. */ - rcb = &sc->ti_rdata->ti_info.ti_ev_rcb; - - TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_event_ring); + bzero(sc->ti_rdata.ti_event_ring, TI_EVENT_RING_SZ); + rcb = &sc->ti_rdata.ti_info->ti_ev_rcb; + ti_hostaddr64(&rcb->ti_hostaddr, sc->ti_rdata.ti_event_ring_paddr); rcb->ti_flags = 0; - TI_HOSTADDR(sc->ti_rdata->ti_info.ti_ev_prodidx_ptr) = - rdphys + TI_RD_OFF(ti_ev_prodidx_r); + ti_hostaddr64(&sc->ti_rdata.ti_info->ti_ev_prodidx_ptr, + sc->ti_rdata.ti_status_paddr + + offsetof(struct ti_status, ti_ev_prodidx_r)); sc->ti_ev_prodidx.ti_idx = 0; CSR_WRITE_4(sc, TI_GCR_EVENTCONS_IDX, 0); sc->ti_ev_saved_considx = 0; /* Set up the command ring and producer mailbox. */ - rcb = &sc->ti_rdata->ti_info.ti_cmd_rcb; - - TI_HOSTADDR(rcb->ti_hostaddr) = TI_GCR_NIC_ADDR(TI_GCR_CMDRING); + rcb = &sc->ti_rdata.ti_info->ti_cmd_rcb; + ti_hostaddr64(&rcb->ti_hostaddr, TI_GCR_NIC_ADDR(TI_GCR_CMDRING)); rcb->ti_flags = 0; rcb->ti_max_len = 0; for (i = 0; i < TI_CMD_RING_CNT; i++) { @@ -1995,12 +2225,13 @@ ti_gibinit(struct ti_softc *sc) * We re-use the current stats buffer for this to * conserve memory. */ - TI_HOSTADDR(sc->ti_rdata->ti_info.ti_refresh_stats_ptr) = - rdphys + TI_RD_OFF(ti_info.ti_stats); + bzero(&sc->ti_rdata.ti_info->ti_stats, sizeof(struct ti_stats)); + ti_hostaddr64(&sc->ti_rdata.ti_info->ti_refresh_stats_ptr, + sc->ti_rdata.ti_info_paddr + offsetof(struct ti_gib, ti_stats)); /* Set up the standard receive ring. */ - rcb = &sc->ti_rdata->ti_info.ti_std_rx_rcb; - TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_rx_std_ring); + rcb = &sc->ti_rdata.ti_info->ti_std_rx_rcb; + ti_hostaddr64(&rcb->ti_hostaddr, sc->ti_rdata.ti_rx_std_ring_paddr); rcb->ti_max_len = TI_FRAMELEN; rcb->ti_flags = 0; if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) @@ -2010,8 +2241,8 @@ ti_gibinit(struct ti_softc *sc) rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; /* Set up the jumbo receive ring. */ - rcb = &sc->ti_rdata->ti_info.ti_jumbo_rx_rcb; - TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_rx_jumbo_ring); + rcb = &sc->ti_rdata.ti_info->ti_jumbo_rx_rcb; + ti_hostaddr64(&rcb->ti_hostaddr, sc->ti_rdata.ti_rx_jumbo_ring_paddr); #ifndef TI_SF_BUF_JUMBO rcb->ti_max_len = MJUM9BYTES - ETHER_ALIGN; @@ -2031,8 +2262,8 @@ ti_gibinit(struct ti_softc *sc) * Tigon 2 but the slot in the config block is * still there on the Tigon 1. */ - rcb = &sc->ti_rdata->ti_info.ti_mini_rx_rcb; - TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_rx_mini_ring); + rcb = &sc->ti_rdata.ti_info->ti_mini_rx_rcb; + ti_hostaddr64(&rcb->ti_hostaddr, sc->ti_rdata.ti_rx_mini_ring_paddr); rcb->ti_max_len = MHLEN - ETHER_ALIGN; if (sc->ti_hwrev == TI_HWREV_TIGON) rcb->ti_flags = TI_RCB_FLAG_RING_DISABLED; @@ -2047,12 +2278,13 @@ ti_gibinit(struct ti_softc *sc) /* * Set up the receive return ring. */ - rcb = &sc->ti_rdata->ti_info.ti_return_rcb; - TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_rx_return_ring); + rcb = &sc->ti_rdata.ti_info->ti_return_rcb; + ti_hostaddr64(&rcb->ti_hostaddr, sc->ti_rdata.ti_rx_return_ring_paddr); rcb->ti_flags = 0; rcb->ti_max_len = TI_RETURN_RING_CNT; - TI_HOSTADDR(sc->ti_rdata->ti_info.ti_return_prodidx_ptr) = - rdphys + TI_RD_OFF(ti_return_prodidx_r); + ti_hostaddr64(&sc->ti_rdata.ti_info->ti_return_prodidx_ptr, + sc->ti_rdata.ti_status_paddr + + offsetof(struct ti_status, ti_return_prodidx_r)); /* * Set up the tx ring. Note: for the Tigon 2, we have the option @@ -2064,9 +2296,9 @@ ti_gibinit(struct ti_softc *sc) * a Tigon 1 chip. */ CSR_WRITE_4(sc, TI_WINBASE, TI_TX_RING_BASE); - bzero((char *)sc->ti_rdata->ti_tx_ring, - TI_TX_RING_CNT * sizeof(struct ti_tx_desc)); - rcb = &sc->ti_rdata->ti_info.ti_tx_rcb; + if (sc->ti_rdata.ti_tx_ring != NULL) + bzero(sc->ti_rdata.ti_tx_ring, TI_TX_RING_SZ); + rcb = &sc->ti_rdata.ti_info->ti_tx_rcb; if (sc->ti_hwrev == TI_HWREV_TIGON) rcb->ti_flags = 0; else @@ -2078,18 +2310,28 @@ ti_gibinit(struct ti_softc *sc) TI_RCB_FLAG_IP_CKSUM | TI_RCB_FLAG_NO_PHDR_CKSUM; rcb->ti_max_len = TI_TX_RING_CNT; if (sc->ti_hwrev == TI_HWREV_TIGON) - TI_HOSTADDR(rcb->ti_hostaddr) = TI_TX_RING_BASE; + ti_hostaddr64(&rcb->ti_hostaddr, TI_TX_RING_BASE); else - TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_tx_ring); - TI_HOSTADDR(sc->ti_rdata->ti_info.ti_tx_considx_ptr) = - rdphys + TI_RD_OFF(ti_tx_considx_r); - - bus_dmamap_sync(sc->ti_rdata_dmat, sc->ti_rdata_dmamap, - BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); + ti_hostaddr64(&rcb->ti_hostaddr, + sc->ti_rdata.ti_tx_ring_paddr); + ti_hostaddr64(&sc->ti_rdata.ti_info->ti_tx_considx_ptr, + sc->ti_rdata.ti_status_paddr + + offsetof(struct ti_status, ti_tx_considx_r)); + + bus_dmamap_sync(sc->ti_cdata.ti_gib_tag, sc->ti_cdata.ti_gib_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(sc->ti_cdata.ti_status_tag, sc->ti_cdata.ti_status_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(sc->ti_cdata.ti_event_ring_tag, + sc->ti_cdata.ti_event_ring_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + if (sc->ti_rdata.ti_tx_ring != NULL) + bus_dmamap_sync(sc->ti_cdata.ti_tx_ring_tag, + sc->ti_cdata.ti_tx_ring_map, BUS_DMASYNC_PREWRITE); /* Set up tunables */ #if 0 - if (ifp->if_mtu > (ETHERMTU + ETHER_HDR_LEN + ETHER_CRC_LEN)) + if (ifp->if_mtu > ETHERMTU + ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN) CSR_WRITE_4(sc, TI_GCR_RX_COAL_TICKS, (sc->ti_rx_coal_ticks / 10)); else @@ -2111,23 +2353,6 @@ ti_gibinit(struct ti_softc *sc) return (0); } -static void -ti_rdata_cb(void *arg, bus_dma_segment_t *segs, int nseg, int error) -{ - struct ti_softc *sc; - - sc = arg; - if (error || nseg != 1) - return; - - /* - * All of the Tigon data structures need to live at <4GB. This - * cast is fine since busdma was told about this constraint. - */ - sc->ti_rdata_phys = segs[0].ds_addr; - return; -} - /* * Probe for a Tigon chip. Check the PCI vendor and device IDs * against our list and return its name if we find a match. @@ -2229,8 +2454,7 @@ ti_attach(device_t dev) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 23:45:45 2012 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 C29201065672; Tue, 3 Jan 2012 23:45: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 AA6BD8FC1C; Tue, 3 Jan 2012 23:45: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 q03NjiOI049245; Tue, 3 Jan 2012 23:45:44 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03Njir7049242; Tue, 3 Jan 2012 23:45:44 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201032345.q03Njir7049242@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 23:45:44 +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: r229442 - in stable/8/sys: conf dev/ti 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, 03 Jan 2012 23:45:46 -0000 Author: yongari Date: Tue Jan 3 23:45:44 2012 New Revision: 229442 URL: http://svn.freebsd.org/changeset/base/229442 Log: MFC r227512: Overhaul bus_dma(9) usage in driver: - Don't use a single big DMA block for all rings. Create separate DMA area for each ring instead. Currently the following DMA areas are created: Event ring, standard RX ring, jumbo RX ring, RX return ring, hardware MAC statistics and producer/consumer status area. For Tigon II, mini RX ring and TX ring are additionally created. - Added missing bus_dmamap_sync(9) in various TX/RX paths. - TX ring is no longer created for Tigon 1 such that it saves more resources on Tigon 1. - Data sheet is not clear about alignment requirement of each ring so use 32 bytes alignment for normal DMA area but use 64 bytes alignment for jumbo RX ring where the extended RX descriptor size is 64 bytes. - For each TX/RX buffers use separate DMA tag(e.g. the size of a DMA segment, total size of DMA segments etc). - Tigon allows separate DMA area for event producer, RX return producer and TX consumer which is really cool feature. This means TX and RX path could be independently run in parallel. However ti(4) uses a single driver lock so it's meaningless to have separate DMA area for these producer/consumer such that this change creates a single status DMA area. - It seems Tigon has no limits on DMA address space and I also don't see any problem with that but old comments in driver indicates there could be issues on descriptors being located in 64bit region. Introduce a tunable, dev.ti.%d.dac, to disable using 64bit DMA in driver. The default is 0 which means it would use full 64bit DMA. If there are DMA issues, users can disable it by setting the tunable to 0. - Do not increase watchdog timer in ti_txeof(). Previously driver increased the watchdog timer whenever there are queued TX frames. - When stat ticks is set to 0, skip processing ti_stats_update(), avoiding bus_dmamap_sync(9) and updating if_collisions counter. - MTU does not include FCS bytes, replace it with ETHER_VLAN_ENCAP_LEN. With these changes, ti(4) should work on PAE environments. Many thanks to Jay Borkenhagen for remote hardware access. Modified: stable/8/sys/dev/ti/if_ti.c stable/8/sys/dev/ti/if_tireg.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/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/ti/if_ti.c ============================================================================== --- stable/8/sys/dev/ti/if_ti.c Tue Jan 3 23:44:05 2012 (r229441) +++ stable/8/sys/dev/ti/if_ti.c Tue Jan 3 23:45:44 2012 (r229442) @@ -220,9 +220,13 @@ static void ti_loadfw(struct ti_softc *) static void ti_cmd(struct ti_softc *, struct ti_cmd_desc *); static void ti_cmd_ext(struct ti_softc *, struct ti_cmd_desc *, caddr_t, int); static void ti_handle_events(struct ti_softc *); -static int ti_alloc_dmamaps(struct ti_softc *); -static void ti_free_dmamaps(struct ti_softc *); -static int ti_alloc_jumbo_mem(struct ti_softc *); +static void ti_dma_map_addr(void *, bus_dma_segment_t *, int, int); +static int ti_dma_alloc(struct ti_softc *); +static void ti_dma_free(struct ti_softc *); +static int ti_dma_ring_alloc(struct ti_softc *, bus_size_t, bus_size_t, + bus_dma_tag_t *, uint8_t **, bus_dmamap_t *, bus_addr_t *, const char *); +static void ti_dma_ring_free(struct ti_softc *, bus_dma_tag_t *, uint8_t **, + bus_dmamap_t *); static int ti_newbuf_std(struct ti_softc *, int); static int ti_newbuf_mini(struct ti_softc *, int); static int ti_newbuf_jumbo(struct ti_softc *, int, struct mbuf *); @@ -911,11 +915,13 @@ ti_handle_events(struct ti_softc *sc) { struct ti_event_desc *e; - if (sc->ti_rdata->ti_event_ring == NULL) + if (sc->ti_rdata.ti_event_ring == NULL) return; + bus_dmamap_sync(sc->ti_cdata.ti_event_ring_tag, + sc->ti_cdata.ti_event_ring_map, BUS_DMASYNC_POSTREAD); while (sc->ti_ev_saved_considx != sc->ti_ev_prodidx.ti_idx) { - e = &sc->ti_rdata->ti_event_ring[sc->ti_ev_saved_considx]; + e = &sc->ti_rdata.ti_event_ring[sc->ti_ev_saved_considx]; switch (TI_EVENT_EVENT(e)) { case TI_EV_LINKSTAT_CHANGED: sc->ti_linkstat = TI_EVENT_CODE(e); @@ -967,181 +973,402 @@ ti_handle_events(struct ti_softc *sc) TI_INC(sc->ti_ev_saved_considx, TI_EVENT_RING_CNT); CSR_WRITE_4(sc, TI_GCR_EVENTCONS_IDX, sc->ti_ev_saved_considx); } + bus_dmamap_sync(sc->ti_cdata.ti_event_ring_tag, + sc->ti_cdata.ti_event_ring_map, BUS_DMASYNC_PREREAD); +} + +struct ti_dmamap_arg { + bus_addr_t ti_busaddr; +}; + +static void +ti_dma_map_addr(void *arg, bus_dma_segment_t *segs, int nseg, int error) +{ + struct ti_dmamap_arg *ctx; + + if (error) + return; + + KASSERT(nseg == 1, ("%s: %d segments returned!", __func__, nseg)); + + ctx = arg; + ctx->ti_busaddr = segs->ds_addr; } static int -ti_alloc_dmamaps(struct ti_softc *sc) +ti_dma_ring_alloc(struct ti_softc *sc, bus_size_t alignment, bus_size_t maxsize, + bus_dma_tag_t *tag, uint8_t **ring, bus_dmamap_t *map, bus_addr_t *paddr, + const char *msg) { - int i; + struct ti_dmamap_arg ctx; + int error; - for (i = 0; i < TI_TX_RING_CNT; i++) { - sc->ti_cdata.ti_txdesc[i].tx_m = NULL; - sc->ti_cdata.ti_txdesc[i].tx_dmamap = NULL; - if (bus_dmamap_create(sc->ti_mbuftx_dmat, 0, - &sc->ti_cdata.ti_txdesc[i].tx_dmamap)) { - device_printf(sc->ti_dev, - "cannot create DMA map for TX\n"); - return (ENOBUFS); - } + error = bus_dma_tag_create(sc->ti_cdata.ti_parent_tag, + alignment, 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, + NULL, maxsize, 1, maxsize, 0, NULL, NULL, tag); + if (error != 0) { + device_printf(sc->ti_dev, + "could not create %s dma tag\n", msg); + return (error); + } + /* Allocate DMA'able memory for ring. */ + error = bus_dmamem_alloc(*tag, (void **)ring, + BUS_DMA_NOWAIT | BUS_DMA_ZERO | BUS_DMA_COHERENT, map); + if (error != 0) { + device_printf(sc->ti_dev, + "could not allocate DMA'able memory for %s\n", msg); + return (error); } + /* Load the address of the ring. */ + ctx.ti_busaddr = 0; + error = bus_dmamap_load(*tag, *map, *ring, maxsize, ti_dma_map_addr, + &ctx, BUS_DMA_NOWAIT); + if (error != 0) { + device_printf(sc->ti_dev, + "could not load DMA'able memory for %s\n", msg); + return (error); + } + *paddr = ctx.ti_busaddr; + return (0); +} + +static void +ti_dma_ring_free(struct ti_softc *sc, bus_dma_tag_t *tag, uint8_t **ring, + bus_dmamap_t *map) +{ + + if (*map != NULL) + bus_dmamap_unload(*tag, *map); + if (*map != NULL && *ring != NULL) { + bus_dmamem_free(*tag, *ring, *map); + *ring = NULL; + *map = NULL; + } + if (*tag) { + bus_dma_tag_destroy(*tag); + *tag = NULL; + } +} + +static int +ti_dma_alloc(struct ti_softc *sc) +{ + bus_addr_t lowaddr; + int i, error; + + lowaddr = BUS_SPACE_MAXADDR; + if (sc->ti_dac == 0) + lowaddr = BUS_SPACE_MAXADDR_32BIT; + + error = bus_dma_tag_create(bus_get_dma_tag(sc->ti_dev), 1, 0, lowaddr, + BUS_SPACE_MAXADDR, NULL, NULL, BUS_SPACE_MAXSIZE_32BIT, 0, + BUS_SPACE_MAXSIZE_32BIT, 0, NULL, NULL, + &sc->ti_cdata.ti_parent_tag); + if (error != 0) { + device_printf(sc->ti_dev, + "could not allocate parent dma tag\n"); + return (ENOMEM); + } + + error = ti_dma_ring_alloc(sc, TI_RING_ALIGN, sizeof(struct ti_gib), + &sc->ti_cdata.ti_gib_tag, (uint8_t **)&sc->ti_rdata.ti_info, + &sc->ti_cdata.ti_gib_map, &sc->ti_rdata.ti_info_paddr, "GIB"); + if (error) + return (error); + + /* Producer/consumer status */ + error = ti_dma_ring_alloc(sc, TI_RING_ALIGN, sizeof(struct ti_status), + &sc->ti_cdata.ti_status_tag, (uint8_t **)&sc->ti_rdata.ti_status, + &sc->ti_cdata.ti_status_map, &sc->ti_rdata.ti_status_paddr, + "event ring"); + if (error) + return (error); + + /* Event ring */ + error = ti_dma_ring_alloc(sc, TI_RING_ALIGN, TI_EVENT_RING_SZ, + &sc->ti_cdata.ti_event_ring_tag, + (uint8_t **)&sc->ti_rdata.ti_event_ring, + &sc->ti_cdata.ti_event_ring_map, &sc->ti_rdata.ti_event_ring_paddr, + "event ring"); + if (error) + return (error); + + /* Command ring lives in shared memory so no need to create DMA area. */ + + /* Standard RX ring */ + error = ti_dma_ring_alloc(sc, TI_RING_ALIGN, TI_STD_RX_RING_SZ, + &sc->ti_cdata.ti_rx_std_ring_tag, + (uint8_t **)&sc->ti_rdata.ti_rx_std_ring, + &sc->ti_cdata.ti_rx_std_ring_map, + &sc->ti_rdata.ti_rx_std_ring_paddr, "RX ring"); + if (error) + return (error); + + /* Jumbo RX ring */ + error = ti_dma_ring_alloc(sc, TI_JUMBO_RING_ALIGN, TI_JUMBO_RX_RING_SZ, + &sc->ti_cdata.ti_rx_jumbo_ring_tag, + (uint8_t **)&sc->ti_rdata.ti_rx_jumbo_ring, + &sc->ti_cdata.ti_rx_jumbo_ring_map, + &sc->ti_rdata.ti_rx_jumbo_ring_paddr, "jumbo RX ring"); + if (error) + return (error); + + /* RX return ring */ + error = ti_dma_ring_alloc(sc, TI_RING_ALIGN, TI_RX_RETURN_RING_SZ, + &sc->ti_cdata.ti_rx_return_ring_tag, + (uint8_t **)&sc->ti_rdata.ti_rx_return_ring, + &sc->ti_cdata.ti_rx_return_ring_map, + &sc->ti_rdata.ti_rx_return_ring_paddr, "RX return ring"); + if (error) + return (error); + + /* Create DMA tag for standard RX mbufs. */ + error = bus_dma_tag_create(sc->ti_cdata.ti_parent_tag, 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES, 1, + MCLBYTES, 0, NULL, NULL, &sc->ti_cdata.ti_rx_std_tag); + if (error) { + device_printf(sc->ti_dev, "could not allocate RX dma tag\n"); + return (error); + } + + /* Create DMA tag for jumbo RX mbufs. */ +#ifdef TI_SF_BUF_JUMBO + /* + * The VM system will take care of providing aligned pages. Alignment + * is set to 1 here so that busdma resources won't be wasted. + */ + error = bus_dma_tag_create(sc->ti_cdata.ti_parent_tag, 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, PAGE_SIZE * 4, 4, + PAGE_SIZE, 0, NULL, NULL, &sc->ti_cdata.ti_rx_jumbo_tag); +#else + error = bus_dma_tag_create(sc->ti_cdata.ti_parent_tag, 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, MJUM9BYTES, 1, + MJUM9BYTES, 0, NULL, NULL, &sc->ti_cdata.ti_rx_jumbo_tag); +#endif + if (error) { + device_printf(sc->ti_dev, + "could not allocate jumbo RX dma tag\n"); + return (error); + } + + /* Create DMA tag for TX mbufs. */ + error = bus_dma_tag_create(sc->ti_cdata.ti_parent_tag, 1, + 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, + MCLBYTES * TI_MAXTXSEGS, TI_MAXTXSEGS, MCLBYTES, 0, NULL, NULL, + &sc->ti_cdata.ti_tx_tag); + if (error) { + device_printf(sc->ti_dev, "could not allocate TX dma tag\n"); + return (ENOMEM); + } + + /* Create DMA maps for RX buffers. */ for (i = 0; i < TI_STD_RX_RING_CNT; i++) { - if (bus_dmamap_create(sc->ti_mbufrx_dmat, 0, - &sc->ti_cdata.ti_rx_std_maps[i])) { + error = bus_dmamap_create(sc->ti_cdata.ti_rx_std_tag, 0, + &sc->ti_cdata.ti_rx_std_maps[i]); + if (error) { device_printf(sc->ti_dev, - "cannot create DMA map for RX\n"); - return (ENOBUFS); + "could not create DMA map for RX\n"); + return (error); } } - if (bus_dmamap_create(sc->ti_mbufrx_dmat, 0, - &sc->ti_cdata.ti_rx_std_sparemap)) { + error = bus_dmamap_create(sc->ti_cdata.ti_rx_std_tag, 0, + &sc->ti_cdata.ti_rx_std_sparemap); + if (error) { device_printf(sc->ti_dev, - "cannot create spare DMA map for RX\n"); - return (ENOBUFS); + "could not create spare DMA map for RX\n"); + return (error); } + /* Create DMA maps for jumbo RX buffers. */ for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) { - if (bus_dmamap_create(sc->ti_jumbo_dmat, 0, - &sc->ti_cdata.ti_rx_jumbo_maps[i])) { + error = bus_dmamap_create(sc->ti_cdata.ti_rx_jumbo_tag, 0, + &sc->ti_cdata.ti_rx_jumbo_maps[i]); + if (error) { device_printf(sc->ti_dev, - "cannot create DMA map for jumbo RX\n"); - return (ENOBUFS); + "could not create DMA map for jumbo RX\n"); + return (error); } } - if (bus_dmamap_create(sc->ti_jumbo_dmat, 0, - &sc->ti_cdata.ti_rx_jumbo_sparemap)) { + error = bus_dmamap_create(sc->ti_cdata.ti_rx_jumbo_tag, 0, + &sc->ti_cdata.ti_rx_jumbo_sparemap); + if (error) { device_printf(sc->ti_dev, - "cannot create spare DMA map for jumbo RX\n"); - return (ENOBUFS); + "could not create spare DMA map for jumbo RX\n"); + return (error); + } + + /* Create DMA maps for TX buffers. */ + for (i = 0; i < TI_TX_RING_CNT; i++) { + error = bus_dmamap_create(sc->ti_cdata.ti_tx_tag, 0, + &sc->ti_cdata.ti_txdesc[i].tx_dmamap); + if (error) { + device_printf(sc->ti_dev, + "could not create DMA map for TX\n"); + return (ENOMEM); + } } - /* Mini ring is not available on Tigon 1. */ + /* Mini ring and TX ring is not available on Tigon 1. */ if (sc->ti_hwrev == TI_HWREV_TIGON) return (0); + /* TX ring */ + error = ti_dma_ring_alloc(sc, TI_RING_ALIGN, TI_TX_RING_SZ, + &sc->ti_cdata.ti_tx_ring_tag, (uint8_t **)&sc->ti_rdata.ti_tx_ring, + &sc->ti_cdata.ti_tx_ring_map, &sc->ti_rdata.ti_tx_ring_paddr, + "TX ring"); + if (error) + return (error); + + /* Mini RX ring */ + error = ti_dma_ring_alloc(sc, TI_RING_ALIGN, TI_MINI_RX_RING_SZ, + &sc->ti_cdata.ti_rx_mini_ring_tag, + (uint8_t **)&sc->ti_rdata.ti_rx_mini_ring, + &sc->ti_cdata.ti_rx_mini_ring_map, + &sc->ti_rdata.ti_rx_mini_ring_paddr, "mini RX ring"); + if (error) + return (error); + + /* Create DMA tag for mini RX mbufs. */ + error = bus_dma_tag_create(sc->ti_cdata.ti_parent_tag, 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, MHLEN, 1, + MHLEN, 0, NULL, NULL, &sc->ti_cdata.ti_rx_mini_tag); + if (error) { + device_printf(sc->ti_dev, + "could not allocate mini RX dma tag\n"); + return (error); + } + + /* Create DMA maps for mini RX buffers. */ for (i = 0; i < TI_MINI_RX_RING_CNT; i++) { - if (bus_dmamap_create(sc->ti_mbufrx_dmat, 0, - &sc->ti_cdata.ti_rx_mini_maps[i])) { + error = bus_dmamap_create(sc->ti_cdata.ti_rx_mini_tag, 0, + &sc->ti_cdata.ti_rx_mini_maps[i]); + if (error) { device_printf(sc->ti_dev, - "cannot create DMA map for mini RX\n"); - return (ENOBUFS); + "could not create DMA map for mini RX\n"); + return (error); } } - if (bus_dmamap_create(sc->ti_mbufrx_dmat, 0, - &sc->ti_cdata.ti_rx_mini_sparemap)) { + error = bus_dmamap_create(sc->ti_cdata.ti_rx_mini_tag, 0, + &sc->ti_cdata.ti_rx_mini_sparemap); + if (error) { device_printf(sc->ti_dev, - "cannot create DMA map for mini RX\n"); - return (ENOBUFS); + "could not create spare DMA map for mini RX\n"); + return (error); } return (0); } static void -ti_free_dmamaps(struct ti_softc *sc) +ti_dma_free(struct ti_softc *sc) { int i; - if (sc->ti_mbuftx_dmat) { - for (i = 0; i < TI_TX_RING_CNT; i++) { - if (sc->ti_cdata.ti_txdesc[i].tx_dmamap) { - bus_dmamap_destroy(sc->ti_mbuftx_dmat, - sc->ti_cdata.ti_txdesc[i].tx_dmamap); - sc->ti_cdata.ti_txdesc[i].tx_dmamap = NULL; - } + /* Destroy DMA maps for RX buffers. */ + for (i = 0; i < TI_STD_RX_RING_CNT; i++) { + if (sc->ti_cdata.ti_rx_std_maps[i]) { + bus_dmamap_destroy(sc->ti_cdata.ti_rx_std_tag, + sc->ti_cdata.ti_rx_std_maps[i]); + sc->ti_cdata.ti_rx_std_maps[i] = NULL; } } - - if (sc->ti_mbufrx_dmat) { - for (i = 0; i < TI_STD_RX_RING_CNT; i++) { - if (sc->ti_cdata.ti_rx_std_maps[i]) { - bus_dmamap_destroy(sc->ti_mbufrx_dmat, - sc->ti_cdata.ti_rx_std_maps[i]); - sc->ti_cdata.ti_rx_std_maps[i] = NULL; - } - } - if (sc->ti_cdata.ti_rx_std_sparemap) { - bus_dmamap_destroy(sc->ti_mbufrx_dmat, - sc->ti_cdata.ti_rx_std_sparemap); - sc->ti_cdata.ti_rx_std_sparemap = NULL; - } + if (sc->ti_cdata.ti_rx_std_sparemap) { + bus_dmamap_destroy(sc->ti_cdata.ti_rx_std_tag, + sc->ti_cdata.ti_rx_std_sparemap); + sc->ti_cdata.ti_rx_std_sparemap = NULL; + } + if (sc->ti_cdata.ti_rx_std_tag) { + bus_dma_tag_destroy(sc->ti_cdata.ti_rx_std_tag); + sc->ti_cdata.ti_rx_std_tag = NULL; } - if (sc->ti_jumbo_dmat) { - for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) { - if (sc->ti_cdata.ti_rx_jumbo_maps[i]) { - bus_dmamap_destroy(sc->ti_jumbo_dmat, - sc->ti_cdata.ti_rx_jumbo_maps[i]); - sc->ti_cdata.ti_rx_jumbo_maps[i] = NULL; - } - } - if (sc->ti_cdata.ti_rx_jumbo_sparemap) { - bus_dmamap_destroy(sc->ti_jumbo_dmat, - sc->ti_cdata.ti_rx_jumbo_sparemap); - sc->ti_cdata.ti_rx_jumbo_sparemap = NULL; + /* Destroy DMA maps for jumbo RX buffers. */ + for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) { + if (sc->ti_cdata.ti_rx_jumbo_maps[i]) { + bus_dmamap_destroy(sc->ti_cdata.ti_rx_jumbo_tag, + sc->ti_cdata.ti_rx_jumbo_maps[i]); + sc->ti_cdata.ti_rx_jumbo_maps[i] = NULL; } } + if (sc->ti_cdata.ti_rx_jumbo_sparemap) { + bus_dmamap_destroy(sc->ti_cdata.ti_rx_jumbo_tag, + sc->ti_cdata.ti_rx_jumbo_sparemap); + sc->ti_cdata.ti_rx_jumbo_sparemap = NULL; + } + if (sc->ti_cdata.ti_rx_jumbo_tag) { + bus_dma_tag_destroy(sc->ti_cdata.ti_rx_jumbo_tag); + sc->ti_cdata.ti_rx_jumbo_tag = NULL; + } - if (sc->ti_mbufrx_dmat) { - for (i = 0; i < TI_MINI_RX_RING_CNT; i++) { - if (sc->ti_cdata.ti_rx_mini_maps[i]) { - bus_dmamap_destroy(sc->ti_mbufrx_dmat, - sc->ti_cdata.ti_rx_mini_maps[i]); - sc->ti_cdata.ti_rx_mini_maps[i] = NULL; - } - } - if (sc->ti_cdata.ti_rx_mini_sparemap) { - bus_dmamap_destroy(sc->ti_mbufrx_dmat, - sc->ti_cdata.ti_rx_mini_sparemap); - sc->ti_cdata.ti_rx_mini_sparemap = NULL; + /* Destroy DMA maps for mini RX buffers. */ + for (i = 0; i < TI_MINI_RX_RING_CNT; i++) { + if (sc->ti_cdata.ti_rx_mini_maps[i]) { + bus_dmamap_destroy(sc->ti_cdata.ti_rx_mini_tag, + sc->ti_cdata.ti_rx_mini_maps[i]); + sc->ti_cdata.ti_rx_mini_maps[i] = NULL; } } -} - -#ifndef TI_SF_BUF_JUMBO - -static int -ti_alloc_jumbo_mem(struct ti_softc *sc) -{ - - if (bus_dma_tag_create(sc->ti_parent_dmat, 1, 0, BUS_SPACE_MAXADDR, - BUS_SPACE_MAXADDR, NULL, NULL, MJUM9BYTES, 1, MJUM9BYTES, 0, NULL, - NULL, &sc->ti_jumbo_dmat) != 0) { - device_printf(sc->ti_dev, "Failed to allocate jumbo dmat\n"); - return (ENOBUFS); + if (sc->ti_cdata.ti_rx_mini_sparemap) { + bus_dmamap_destroy(sc->ti_cdata.ti_rx_mini_tag, + sc->ti_cdata.ti_rx_mini_sparemap); + sc->ti_cdata.ti_rx_mini_sparemap = NULL; } - return (0); -} - -#else - -static int -ti_alloc_jumbo_mem(struct ti_softc *sc) -{ - - /* - * The VM system will take care of providing aligned pages. Alignment - * is set to 1 here so that busdma resources won't be wasted. - */ - if (bus_dma_tag_create(sc->ti_parent_dmat, /* parent */ - 1, 0, /* algnmnt, boundary */ - BUS_SPACE_MAXADDR, /* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - PAGE_SIZE * 4 /*XXX*/, /* maxsize */ - 4, /* nsegments */ - PAGE_SIZE, /* maxsegsize */ - 0, /* flags */ - NULL, NULL, /* lockfunc, lockarg */ - &sc->ti_jumbo_dmat) != 0) { - device_printf(sc->ti_dev, "Failed to allocate jumbo dmat\n"); - return (ENOBUFS); + if (sc->ti_cdata.ti_rx_mini_tag) { + bus_dma_tag_destroy(sc->ti_cdata.ti_rx_mini_tag); + sc->ti_cdata.ti_rx_mini_tag = NULL; } - return (0); + /* Destroy DMA maps for TX buffers. */ + for (i = 0; i < TI_TX_RING_CNT; i++) { + if (sc->ti_cdata.ti_txdesc[i].tx_dmamap) { + bus_dmamap_destroy(sc->ti_cdata.ti_tx_tag, + sc->ti_cdata.ti_txdesc[i].tx_dmamap); + sc->ti_cdata.ti_txdesc[i].tx_dmamap = NULL; + } + } + if (sc->ti_cdata.ti_tx_tag) { + bus_dma_tag_destroy(sc->ti_cdata.ti_tx_tag); + sc->ti_cdata.ti_tx_tag = NULL; + } + + /* Destroy standard RX ring. */ + ti_dma_ring_free(sc, &sc->ti_cdata.ti_rx_std_ring_tag, + (void *)&sc->ti_rdata.ti_rx_std_ring, + &sc->ti_cdata.ti_rx_std_ring_map); + /* Destroy jumbo RX ring. */ + ti_dma_ring_free(sc, &sc->ti_cdata.ti_rx_jumbo_ring_tag, + (void *)&sc->ti_rdata.ti_rx_jumbo_ring, + &sc->ti_cdata.ti_rx_jumbo_ring_map); + /* Destroy mini RX ring. */ + ti_dma_ring_free(sc, &sc->ti_cdata.ti_rx_mini_ring_tag, + (void *)&sc->ti_rdata.ti_rx_mini_ring, + &sc->ti_cdata.ti_rx_mini_ring_map); + /* Destroy RX return ring. */ + ti_dma_ring_free(sc, &sc->ti_cdata.ti_rx_return_ring_tag, + (void *)&sc->ti_rdata.ti_rx_return_ring, + &sc->ti_cdata.ti_rx_return_ring_map); + /* Destroy TX ring. */ + ti_dma_ring_free(sc, &sc->ti_cdata.ti_tx_ring_tag, + (void *)&sc->ti_rdata.ti_tx_ring, &sc->ti_cdata.ti_tx_ring_map); + /* Destroy status block. */ + ti_dma_ring_free(sc, &sc->ti_cdata.ti_status_tag, + (void *)&sc->ti_rdata.ti_status, &sc->ti_cdata.ti_status_map); + /* Destroy event ring. */ + ti_dma_ring_free(sc, &sc->ti_cdata.ti_event_ring_tag, + (void *)&sc->ti_rdata.ti_event_ring, + &sc->ti_cdata.ti_event_ring_map); + /* Destroy GIB */ + ti_dma_ring_free(sc, &sc->ti_cdata.ti_gib_tag, + (void *)&sc->ti_rdata.ti_info, &sc->ti_cdata.ti_gib_map); + + /* Destroy the parent tag. */ + if (sc->ti_cdata.ti_parent_tag) { + bus_dma_tag_destroy(sc->ti_cdata.ti_parent_tag); + sc->ti_cdata.ti_parent_tag = NULL; + } } -#endif /* TI_SF_BUF_JUMBO */ - /* * Intialize a standard receive ring descriptor. */ @@ -1160,7 +1387,7 @@ ti_newbuf_std(struct ti_softc *sc, int i m->m_len = m->m_pkthdr.len = MCLBYTES; m_adj(m, ETHER_ALIGN); - error = bus_dmamap_load_mbuf_sg(sc->ti_mbufrx_dmat, + error = bus_dmamap_load_mbuf_sg(sc->ti_cdata.ti_rx_std_tag, sc->ti_cdata.ti_rx_std_sparemap, m, segs, &nsegs, 0); if (error != 0) { m_freem(m); @@ -1169,9 +1396,9 @@ ti_newbuf_std(struct ti_softc *sc, int i KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); if (sc->ti_cdata.ti_rx_std_chain[i] != NULL) { - bus_dmamap_sync(sc->ti_mbufrx_dmat, + bus_dmamap_sync(sc->ti_cdata.ti_rx_std_tag, sc->ti_cdata.ti_rx_std_maps[i], BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(sc->ti_mbufrx_dmat, + bus_dmamap_unload(sc->ti_cdata.ti_rx_std_tag, sc->ti_cdata.ti_rx_std_maps[i]); } @@ -1180,7 +1407,7 @@ ti_newbuf_std(struct ti_softc *sc, int i sc->ti_cdata.ti_rx_std_sparemap = map; sc->ti_cdata.ti_rx_std_chain[i] = m; - r = &sc->ti_rdata->ti_rx_std_ring[i]; + r = &sc->ti_rdata.ti_rx_std_ring[i]; ti_hostaddr64(&r->ti_addr, segs[0].ds_addr); r->ti_len = segs[0].ds_len; r->ti_type = TI_BDTYPE_RECV_BD; @@ -1191,8 +1418,8 @@ ti_newbuf_std(struct ti_softc *sc, int i r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; r->ti_idx = i; - bus_dmamap_sync(sc->ti_mbufrx_dmat, sc->ti_cdata.ti_rx_std_maps[i], - BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->ti_cdata.ti_rx_std_tag, + sc->ti_cdata.ti_rx_std_maps[i], BUS_DMASYNC_PREREAD); return (0); } @@ -1215,7 +1442,7 @@ ti_newbuf_mini(struct ti_softc *sc, int m->m_len = m->m_pkthdr.len = MHLEN; m_adj(m, ETHER_ALIGN); - error = bus_dmamap_load_mbuf_sg(sc->ti_mbufrx_dmat, + error = bus_dmamap_load_mbuf_sg(sc->ti_cdata.ti_rx_mini_tag, sc->ti_cdata.ti_rx_mini_sparemap, m, segs, &nsegs, 0); if (error != 0) { m_freem(m); @@ -1224,9 +1451,9 @@ ti_newbuf_mini(struct ti_softc *sc, int KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); if (sc->ti_cdata.ti_rx_mini_chain[i] != NULL) { - bus_dmamap_sync(sc->ti_mbufrx_dmat, + bus_dmamap_sync(sc->ti_cdata.ti_rx_mini_tag, sc->ti_cdata.ti_rx_mini_maps[i], BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(sc->ti_mbufrx_dmat, + bus_dmamap_unload(sc->ti_cdata.ti_rx_mini_tag, sc->ti_cdata.ti_rx_mini_maps[i]); } @@ -1235,7 +1462,7 @@ ti_newbuf_mini(struct ti_softc *sc, int sc->ti_cdata.ti_rx_mini_sparemap = map; sc->ti_cdata.ti_rx_mini_chain[i] = m; - r = &sc->ti_rdata->ti_rx_mini_ring[i]; + r = &sc->ti_rdata.ti_rx_mini_ring[i]; ti_hostaddr64(&r->ti_addr, segs[0].ds_addr); r->ti_len = segs[0].ds_len; r->ti_type = TI_BDTYPE_RECV_BD; @@ -1246,8 +1473,8 @@ ti_newbuf_mini(struct ti_softc *sc, int r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; r->ti_idx = i; - bus_dmamap_sync(sc->ti_mbufrx_dmat, sc->ti_cdata.ti_rx_mini_maps[i], - BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->ti_cdata.ti_rx_mini_tag, + sc->ti_cdata.ti_rx_mini_maps[i], BUS_DMASYNC_PREREAD); return (0); } @@ -1274,7 +1501,7 @@ ti_newbuf_jumbo(struct ti_softc *sc, int m->m_len = m->m_pkthdr.len = MJUM9BYTES; m_adj(m, ETHER_ALIGN); - error = bus_dmamap_load_mbuf_sg(sc->ti_jumbo_dmat, + error = bus_dmamap_load_mbuf_sg(sc->ti_cdata.ti_rx_jumbo_tag, sc->ti_cdata.ti_rx_jumbo_sparemap, m, segs, &nsegs, 0); if (error != 0) { m_freem(m); @@ -1283,9 +1510,9 @@ ti_newbuf_jumbo(struct ti_softc *sc, int KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); if (sc->ti_cdata.ti_rx_jumbo_chain[i] != NULL) { - bus_dmamap_sync(sc->ti_jumbo_dmat, + bus_dmamap_sync(sc->ti_cdata.ti_rx_jumbo_tag, sc->ti_cdata.ti_rx_jumbo_maps[i], BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(sc->ti_jumbo_dmat, + bus_dmamap_unload(sc->ti_cdata.ti_rx_jumbo_tag, sc->ti_cdata.ti_rx_jumbo_maps[i]); } @@ -1294,7 +1521,7 @@ ti_newbuf_jumbo(struct ti_softc *sc, int sc->ti_cdata.ti_rx_jumbo_sparemap = map; sc->ti_cdata.ti_rx_jumbo_chain[i] = m; - r = &sc->ti_rdata->ti_rx_jumbo_ring[i]; + r = &sc->ti_rdata.ti_rx_jumbo_ring[i]; ti_hostaddr64(&r->ti_addr, segs[0].ds_addr); r->ti_len = segs[0].ds_len; r->ti_type = TI_BDTYPE_RECV_JUMBO_BD; @@ -1305,8 +1532,8 @@ ti_newbuf_jumbo(struct ti_softc *sc, int r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; r->ti_idx = i; - bus_dmamap_sync(sc->ti_jumbo_dmat, sc->ti_cdata.ti_rx_jumbo_maps[i], - BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->ti_cdata.ti_rx_jumbo_tag, + sc->ti_cdata.ti_rx_jumbo_maps[i], BUS_DMASYNC_PREREAD); return (0); } @@ -1419,11 +1646,11 @@ ti_newbuf_jumbo(struct ti_softc *sc, int } /* Set up the descriptor. */ - r = &sc->ti_rdata->ti_rx_jumbo_ring[idx]; + r = &sc->ti_rdata.ti_rx_jumbo_ring[idx]; sc->ti_cdata.ti_rx_jumbo_chain[idx] = m_new; map = sc->ti_cdata.ti_rx_jumbo_maps[i]; - if (bus_dmamap_load_mbuf_sg(sc->ti_jumbo_dmat, map, m_new, segs, - &nsegs, 0)) + if (bus_dmamap_load_mbuf_sg(sc->ti_cdata.ti_rx_jumbo_tag, map, m_new, + segs, &nsegs, 0)) return (ENOBUFS); if ((nsegs < 1) || (nsegs > 4)) return (ENOBUFS); @@ -1451,7 +1678,7 @@ ti_newbuf_jumbo(struct ti_softc *sc, int r->ti_idx = idx; - bus_dmamap_sync(sc->ti_jumbo_dmat, map, BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->ti_cdata.ti_rx_jumbo_tag, map, BUS_DMASYNC_PREREAD); return (0); nobufs: @@ -1507,15 +1734,16 @@ ti_free_rx_ring_std(struct ti_softc *sc) for (i = 0; i < TI_STD_RX_RING_CNT; i++) { if (sc->ti_cdata.ti_rx_std_chain[i] != NULL) { map = sc->ti_cdata.ti_rx_std_maps[i]; - bus_dmamap_sync(sc->ti_mbufrx_dmat, map, + bus_dmamap_sync(sc->ti_cdata.ti_rx_std_tag, map, BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(sc->ti_mbufrx_dmat, map); + bus_dmamap_unload(sc->ti_cdata.ti_rx_std_tag, map); m_freem(sc->ti_cdata.ti_rx_std_chain[i]); sc->ti_cdata.ti_rx_std_chain[i] = NULL; } - bzero((char *)&sc->ti_rdata->ti_rx_std_ring[i], - sizeof(struct ti_rx_desc)); } + bzero(sc->ti_rdata.ti_rx_std_ring, TI_STD_RX_RING_SZ); + bus_dmamap_sync(sc->ti_cdata.ti_rx_std_ring_tag, + sc->ti_cdata.ti_rx_std_ring_map, BUS_DMASYNC_PREWRITE); } static int @@ -1544,15 +1772,16 @@ ti_free_rx_ring_jumbo(struct ti_softc *s for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) { if (sc->ti_cdata.ti_rx_jumbo_chain[i] != NULL) { map = sc->ti_cdata.ti_rx_jumbo_maps[i]; - bus_dmamap_sync(sc->ti_jumbo_dmat, map, + bus_dmamap_sync(sc->ti_cdata.ti_rx_jumbo_tag, map, BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(sc->ti_jumbo_dmat, map); + bus_dmamap_unload(sc->ti_cdata.ti_rx_jumbo_tag, map); m_freem(sc->ti_cdata.ti_rx_jumbo_chain[i]); sc->ti_cdata.ti_rx_jumbo_chain[i] = NULL; } - bzero((char *)&sc->ti_rdata->ti_rx_jumbo_ring[i], - sizeof(struct ti_rx_desc)); } + bzero(sc->ti_rdata.ti_rx_jumbo_ring, TI_JUMBO_RX_RING_SZ); + bus_dmamap_sync(sc->ti_cdata.ti_rx_jumbo_ring_tag, + sc->ti_cdata.ti_rx_jumbo_ring_map, BUS_DMASYNC_PREWRITE); } static int @@ -1577,18 +1806,22 @@ ti_free_rx_ring_mini(struct ti_softc *sc bus_dmamap_t map; int i; + if (sc->ti_rdata.ti_rx_mini_ring == NULL) + return; + for (i = 0; i < TI_MINI_RX_RING_CNT; i++) { if (sc->ti_cdata.ti_rx_mini_chain[i] != NULL) { map = sc->ti_cdata.ti_rx_mini_maps[i]; - bus_dmamap_sync(sc->ti_mbufrx_dmat, map, + bus_dmamap_sync(sc->ti_cdata.ti_rx_mini_tag, map, BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(sc->ti_mbufrx_dmat, map); + bus_dmamap_unload(sc->ti_cdata.ti_rx_mini_tag, map); m_freem(sc->ti_cdata.ti_rx_mini_chain[i]); sc->ti_cdata.ti_rx_mini_chain[i] = NULL; } - bzero((char *)&sc->ti_rdata->ti_rx_mini_ring[i], - sizeof(struct ti_rx_desc)); } + bzero(sc->ti_rdata.ti_rx_mini_ring, TI_MINI_RX_RING_SZ); + bus_dmamap_sync(sc->ti_cdata.ti_rx_mini_ring_tag, + sc->ti_cdata.ti_rx_mini_ring_map, BUS_DMASYNC_PREWRITE); } static void @@ -1597,21 +1830,23 @@ ti_free_tx_ring(struct ti_softc *sc) struct ti_txdesc *txd; int i; - if (sc->ti_rdata->ti_tx_ring == NULL) + if (sc->ti_rdata.ti_tx_ring == NULL) return; for (i = 0; i < TI_TX_RING_CNT; i++) { txd = &sc->ti_cdata.ti_txdesc[i]; if (txd->tx_m != NULL) { - bus_dmamap_sync(sc->ti_mbuftx_dmat, txd->tx_dmamap, + bus_dmamap_sync(sc->ti_cdata.ti_tx_tag, txd->tx_dmamap, BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(sc->ti_mbuftx_dmat, txd->tx_dmamap); + bus_dmamap_unload(sc->ti_cdata.ti_tx_tag, + txd->tx_dmamap); m_freem(txd->tx_m); txd->tx_m = NULL; } - bzero((char *)&sc->ti_rdata->ti_tx_ring[i], - sizeof(struct ti_tx_desc)); } + bzero(sc->ti_rdata.ti_tx_ring, TI_TX_RING_SZ); + bus_dmamap_sync(sc->ti_cdata.ti_tx_ring_tag, + sc->ti_cdata.ti_tx_ring_map, BUS_DMASYNC_PREWRITE); } static int @@ -1943,25 +2178,20 @@ ti_gibinit(struct ti_softc *sc) { struct ifnet *ifp; struct ti_rcb *rcb; - uint32_t rdphys; int i; TI_LOCK_ASSERT(sc); ifp = sc->ti_ifp; - rdphys = sc->ti_rdata_phys; /* Disable interrupts for now. */ CSR_WRITE_4(sc, TI_MB_HOSTINTR, 1); - /* - * Tell the chip where to find the general information block. - * While this struct could go into >4GB memory, we allocate it in a - * single slab with the other descriptors, and those don't seem to - * support being located in a 64-bit region. - */ - CSR_WRITE_4(sc, TI_GCR_GENINFO_HI, 0); - CSR_WRITE_4(sc, TI_GCR_GENINFO_LO, rdphys + TI_RD_OFF(ti_info)); + /* Tell the chip where to find the general information block. */ + CSR_WRITE_4(sc, TI_GCR_GENINFO_HI, + (uint64_t)sc->ti_rdata.ti_info_paddr >> 32); + CSR_WRITE_4(sc, TI_GCR_GENINFO_LO, + sc->ti_rdata.ti_info_paddr & 0xFFFFFFFF); /* Load the firmware into SRAM. */ ti_loadfw(sc); @@ -1969,20 +2199,20 @@ ti_gibinit(struct ti_softc *sc) /* Set up the contents of the general info and ring control blocks. */ /* Set up the event ring and producer pointer. */ - rcb = &sc->ti_rdata->ti_info.ti_ev_rcb; - - TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_event_ring); + bzero(sc->ti_rdata.ti_event_ring, TI_EVENT_RING_SZ); + rcb = &sc->ti_rdata.ti_info->ti_ev_rcb; + ti_hostaddr64(&rcb->ti_hostaddr, sc->ti_rdata.ti_event_ring_paddr); rcb->ti_flags = 0; - TI_HOSTADDR(sc->ti_rdata->ti_info.ti_ev_prodidx_ptr) = - rdphys + TI_RD_OFF(ti_ev_prodidx_r); + ti_hostaddr64(&sc->ti_rdata.ti_info->ti_ev_prodidx_ptr, + sc->ti_rdata.ti_status_paddr + + offsetof(struct ti_status, ti_ev_prodidx_r)); sc->ti_ev_prodidx.ti_idx = 0; CSR_WRITE_4(sc, TI_GCR_EVENTCONS_IDX, 0); sc->ti_ev_saved_considx = 0; /* Set up the command ring and producer mailbox. */ - rcb = &sc->ti_rdata->ti_info.ti_cmd_rcb; - - TI_HOSTADDR(rcb->ti_hostaddr) = TI_GCR_NIC_ADDR(TI_GCR_CMDRING); + rcb = &sc->ti_rdata.ti_info->ti_cmd_rcb; + ti_hostaddr64(&rcb->ti_hostaddr, TI_GCR_NIC_ADDR(TI_GCR_CMDRING)); rcb->ti_flags = 0; rcb->ti_max_len = 0; for (i = 0; i < TI_CMD_RING_CNT; i++) { @@ -1997,12 +2227,13 @@ ti_gibinit(struct ti_softc *sc) * We re-use the current stats buffer for this to * conserve memory. */ - TI_HOSTADDR(sc->ti_rdata->ti_info.ti_refresh_stats_ptr) = - rdphys + TI_RD_OFF(ti_info.ti_stats); + bzero(&sc->ti_rdata.ti_info->ti_stats, sizeof(struct ti_stats)); + ti_hostaddr64(&sc->ti_rdata.ti_info->ti_refresh_stats_ptr, + sc->ti_rdata.ti_info_paddr + offsetof(struct ti_gib, ti_stats)); /* Set up the standard receive ring. */ - rcb = &sc->ti_rdata->ti_info.ti_std_rx_rcb; - TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_rx_std_ring); + rcb = &sc->ti_rdata.ti_info->ti_std_rx_rcb; + ti_hostaddr64(&rcb->ti_hostaddr, sc->ti_rdata.ti_rx_std_ring_paddr); rcb->ti_max_len = TI_FRAMELEN; rcb->ti_flags = 0; if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) @@ -2012,8 +2243,8 @@ ti_gibinit(struct ti_softc *sc) rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; /* Set up the jumbo receive ring. */ - rcb = &sc->ti_rdata->ti_info.ti_jumbo_rx_rcb; - TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_rx_jumbo_ring); + rcb = &sc->ti_rdata.ti_info->ti_jumbo_rx_rcb; + ti_hostaddr64(&rcb->ti_hostaddr, sc->ti_rdata.ti_rx_jumbo_ring_paddr); #ifndef TI_SF_BUF_JUMBO rcb->ti_max_len = MJUM9BYTES - ETHER_ALIGN; @@ -2033,8 +2264,8 @@ ti_gibinit(struct ti_softc *sc) * Tigon 2 but the slot in the config block is * still there on the Tigon 1. */ - rcb = &sc->ti_rdata->ti_info.ti_mini_rx_rcb; - TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_rx_mini_ring); + rcb = &sc->ti_rdata.ti_info->ti_mini_rx_rcb; + ti_hostaddr64(&rcb->ti_hostaddr, sc->ti_rdata.ti_rx_mini_ring_paddr); rcb->ti_max_len = MHLEN - ETHER_ALIGN; if (sc->ti_hwrev == TI_HWREV_TIGON) rcb->ti_flags = TI_RCB_FLAG_RING_DISABLED; @@ -2049,12 +2280,13 @@ ti_gibinit(struct ti_softc *sc) /* * Set up the receive return ring. */ - rcb = &sc->ti_rdata->ti_info.ti_return_rcb; - TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_rx_return_ring); + rcb = &sc->ti_rdata.ti_info->ti_return_rcb; + ti_hostaddr64(&rcb->ti_hostaddr, sc->ti_rdata.ti_rx_return_ring_paddr); rcb->ti_flags = 0; rcb->ti_max_len = TI_RETURN_RING_CNT; - TI_HOSTADDR(sc->ti_rdata->ti_info.ti_return_prodidx_ptr) = - rdphys + TI_RD_OFF(ti_return_prodidx_r); + ti_hostaddr64(&sc->ti_rdata.ti_info->ti_return_prodidx_ptr, + sc->ti_rdata.ti_status_paddr + + offsetof(struct ti_status, ti_return_prodidx_r)); /* * Set up the tx ring. Note: for the Tigon 2, we have the option @@ -2066,9 +2298,9 @@ ti_gibinit(struct ti_softc *sc) * a Tigon 1 chip. */ CSR_WRITE_4(sc, TI_WINBASE, TI_TX_RING_BASE); - bzero((char *)sc->ti_rdata->ti_tx_ring, - TI_TX_RING_CNT * sizeof(struct ti_tx_desc)); - rcb = &sc->ti_rdata->ti_info.ti_tx_rcb; + if (sc->ti_rdata.ti_tx_ring != NULL) + bzero(sc->ti_rdata.ti_tx_ring, TI_TX_RING_SZ); + rcb = &sc->ti_rdata.ti_info->ti_tx_rcb; if (sc->ti_hwrev == TI_HWREV_TIGON) rcb->ti_flags = 0; else @@ -2080,18 +2312,28 @@ ti_gibinit(struct ti_softc *sc) TI_RCB_FLAG_IP_CKSUM | TI_RCB_FLAG_NO_PHDR_CKSUM; rcb->ti_max_len = TI_TX_RING_CNT; if (sc->ti_hwrev == TI_HWREV_TIGON) - TI_HOSTADDR(rcb->ti_hostaddr) = TI_TX_RING_BASE; + ti_hostaddr64(&rcb->ti_hostaddr, TI_TX_RING_BASE); else - TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_tx_ring); - TI_HOSTADDR(sc->ti_rdata->ti_info.ti_tx_considx_ptr) = - rdphys + TI_RD_OFF(ti_tx_considx_r); - - bus_dmamap_sync(sc->ti_rdata_dmat, sc->ti_rdata_dmamap, - BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); + ti_hostaddr64(&rcb->ti_hostaddr, + sc->ti_rdata.ti_tx_ring_paddr); + ti_hostaddr64(&sc->ti_rdata.ti_info->ti_tx_considx_ptr, + sc->ti_rdata.ti_status_paddr + + offsetof(struct ti_status, ti_tx_considx_r)); + + bus_dmamap_sync(sc->ti_cdata.ti_gib_tag, sc->ti_cdata.ti_gib_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(sc->ti_cdata.ti_status_tag, sc->ti_cdata.ti_status_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(sc->ti_cdata.ti_event_ring_tag, + sc->ti_cdata.ti_event_ring_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + if (sc->ti_rdata.ti_tx_ring != NULL) + bus_dmamap_sync(sc->ti_cdata.ti_tx_ring_tag, + sc->ti_cdata.ti_tx_ring_map, BUS_DMASYNC_PREWRITE); /* Set up tunables */ #if 0 - if (ifp->if_mtu > (ETHERMTU + ETHER_HDR_LEN + ETHER_CRC_LEN)) + if (ifp->if_mtu > ETHERMTU + ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN) CSR_WRITE_4(sc, TI_GCR_RX_COAL_TICKS, (sc->ti_rx_coal_ticks / 10)); else @@ -2113,23 +2355,6 @@ ti_gibinit(struct ti_softc *sc) return (0); } -static void -ti_rdata_cb(void *arg, bus_dma_segment_t *segs, int nseg, int error) -{ - struct ti_softc *sc; - - sc = arg; - if (error || nseg != 1) - return; - - /* - * All of the Tigon data structures need to live at <4GB. This - * cast is fine since busdma was told about this constraint. - */ - sc->ti_rdata_phys = segs[0].ds_addr; - return; -} - /* * Probe for a Tigon chip. Check the PCI vendor and device IDs * against our list and return its name if we find a match. @@ -2231,8 +2456,7 @@ ti_attach(device_t dev) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 23:46:45 2012 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 6FE0E106566B; Tue, 3 Jan 2012 23:46:45 +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 582138FC19; Tue, 3 Jan 2012 23:46: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 q03Nkjes049322; Tue, 3 Jan 2012 23:46:45 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03Nkjat049319; Tue, 3 Jan 2012 23:46:45 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201032346.q03Nkjat049319@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 23:46:45 +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: r229443 - stable/7/sys/dev/ti 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, 03 Jan 2012 23:46:45 -0000 Author: yongari Date: Tue Jan 3 23:46:45 2012 New Revision: 229443 URL: http://svn.freebsd.org/changeset/base/229443 Log: MFC r227512: Overhaul bus_dma(9) usage in driver: - Don't use a single big DMA block for all rings. Create separate DMA area for each ring instead. Currently the following DMA areas are created: Event ring, standard RX ring, jumbo RX ring, RX return ring, hardware MAC statistics and producer/consumer status area. For Tigon II, mini RX ring and TX ring are additionally created. - Added missing bus_dmamap_sync(9) in various TX/RX paths. - TX ring is no longer created for Tigon 1 such that it saves more resources on Tigon 1. - Data sheet is not clear about alignment requirement of each ring so use 32 bytes alignment for normal DMA area but use 64 bytes alignment for jumbo RX ring where the extended RX descriptor size is 64 bytes. - For each TX/RX buffers use separate DMA tag(e.g. the size of a DMA segment, total size of DMA segments etc). - Tigon allows separate DMA area for event producer, RX return producer and TX consumer which is really cool feature. This means TX and RX path could be independently run in parallel. However ti(4) uses a single driver lock so it's meaningless to have separate DMA area for these producer/consumer such that this change creates a single status DMA area. - It seems Tigon has no limits on DMA address space and I also don't see any problem with that but old comments in driver indicates there could be issues on descriptors being located in 64bit region. Introduce a tunable, dev.ti.%d.dac, to disable using 64bit DMA in driver. The default is 0 which means it would use full 64bit DMA. If there are DMA issues, users can disable it by setting the tunable to 0. - Do not increase watchdog timer in ti_txeof(). Previously driver increased the watchdog timer whenever there are queued TX frames. - When stat ticks is set to 0, skip processing ti_stats_update(), avoiding bus_dmamap_sync(9) and updating if_collisions counter. - MTU does not include FCS bytes, replace it with ETHER_VLAN_ENCAP_LEN. With these changes, ti(4) should work on PAE environments. Many thanks to Jay Borkenhagen for remote hardware access. Modified: stable/7/sys/dev/ti/if_ti.c stable/7/sys/dev/ti/if_tireg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/ti/if_ti.c ============================================================================== --- stable/7/sys/dev/ti/if_ti.c Tue Jan 3 23:45:44 2012 (r229442) +++ stable/7/sys/dev/ti/if_ti.c Tue Jan 3 23:46:45 2012 (r229443) @@ -220,9 +220,13 @@ static void ti_loadfw(struct ti_softc *) static void ti_cmd(struct ti_softc *, struct ti_cmd_desc *); static void ti_cmd_ext(struct ti_softc *, struct ti_cmd_desc *, caddr_t, int); static void ti_handle_events(struct ti_softc *); -static int ti_alloc_dmamaps(struct ti_softc *); -static void ti_free_dmamaps(struct ti_softc *); -static int ti_alloc_jumbo_mem(struct ti_softc *); +static void ti_dma_map_addr(void *, bus_dma_segment_t *, int, int); +static int ti_dma_alloc(struct ti_softc *); +static void ti_dma_free(struct ti_softc *); +static int ti_dma_ring_alloc(struct ti_softc *, bus_size_t, bus_size_t, + bus_dma_tag_t *, uint8_t **, bus_dmamap_t *, bus_addr_t *, const char *); +static void ti_dma_ring_free(struct ti_softc *, bus_dma_tag_t *, uint8_t **, + bus_dmamap_t *); static int ti_newbuf_std(struct ti_softc *, int); static int ti_newbuf_mini(struct ti_softc *, int); static int ti_newbuf_jumbo(struct ti_softc *, int, struct mbuf *); @@ -911,11 +915,13 @@ ti_handle_events(struct ti_softc *sc) { struct ti_event_desc *e; - if (sc->ti_rdata->ti_event_ring == NULL) + if (sc->ti_rdata.ti_event_ring == NULL) return; + bus_dmamap_sync(sc->ti_cdata.ti_event_ring_tag, + sc->ti_cdata.ti_event_ring_map, BUS_DMASYNC_POSTREAD); while (sc->ti_ev_saved_considx != sc->ti_ev_prodidx.ti_idx) { - e = &sc->ti_rdata->ti_event_ring[sc->ti_ev_saved_considx]; + e = &sc->ti_rdata.ti_event_ring[sc->ti_ev_saved_considx]; switch (TI_EVENT_EVENT(e)) { case TI_EV_LINKSTAT_CHANGED: sc->ti_linkstat = TI_EVENT_CODE(e); @@ -967,181 +973,402 @@ ti_handle_events(struct ti_softc *sc) TI_INC(sc->ti_ev_saved_considx, TI_EVENT_RING_CNT); CSR_WRITE_4(sc, TI_GCR_EVENTCONS_IDX, sc->ti_ev_saved_considx); } + bus_dmamap_sync(sc->ti_cdata.ti_event_ring_tag, + sc->ti_cdata.ti_event_ring_map, BUS_DMASYNC_PREREAD); +} + +struct ti_dmamap_arg { + bus_addr_t ti_busaddr; +}; + +static void +ti_dma_map_addr(void *arg, bus_dma_segment_t *segs, int nseg, int error) +{ + struct ti_dmamap_arg *ctx; + + if (error) + return; + + KASSERT(nseg == 1, ("%s: %d segments returned!", __func__, nseg)); + + ctx = arg; + ctx->ti_busaddr = segs->ds_addr; } static int -ti_alloc_dmamaps(struct ti_softc *sc) +ti_dma_ring_alloc(struct ti_softc *sc, bus_size_t alignment, bus_size_t maxsize, + bus_dma_tag_t *tag, uint8_t **ring, bus_dmamap_t *map, bus_addr_t *paddr, + const char *msg) { - int i; + struct ti_dmamap_arg ctx; + int error; - for (i = 0; i < TI_TX_RING_CNT; i++) { - sc->ti_cdata.ti_txdesc[i].tx_m = NULL; - sc->ti_cdata.ti_txdesc[i].tx_dmamap = NULL; - if (bus_dmamap_create(sc->ti_mbuftx_dmat, 0, - &sc->ti_cdata.ti_txdesc[i].tx_dmamap)) { - device_printf(sc->ti_dev, - "cannot create DMA map for TX\n"); - return (ENOBUFS); - } + error = bus_dma_tag_create(sc->ti_cdata.ti_parent_tag, + alignment, 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, + NULL, maxsize, 1, maxsize, 0, NULL, NULL, tag); + if (error != 0) { + device_printf(sc->ti_dev, + "could not create %s dma tag\n", msg); + return (error); + } + /* Allocate DMA'able memory for ring. */ + error = bus_dmamem_alloc(*tag, (void **)ring, + BUS_DMA_NOWAIT | BUS_DMA_ZERO | BUS_DMA_COHERENT, map); + if (error != 0) { + device_printf(sc->ti_dev, + "could not allocate DMA'able memory for %s\n", msg); + return (error); } + /* Load the address of the ring. */ + ctx.ti_busaddr = 0; + error = bus_dmamap_load(*tag, *map, *ring, maxsize, ti_dma_map_addr, + &ctx, BUS_DMA_NOWAIT); + if (error != 0) { + device_printf(sc->ti_dev, + "could not load DMA'able memory for %s\n", msg); + return (error); + } + *paddr = ctx.ti_busaddr; + return (0); +} + +static void +ti_dma_ring_free(struct ti_softc *sc, bus_dma_tag_t *tag, uint8_t **ring, + bus_dmamap_t *map) +{ + + if (*map != NULL) + bus_dmamap_unload(*tag, *map); + if (*map != NULL && *ring != NULL) { + bus_dmamem_free(*tag, *ring, *map); + *ring = NULL; + *map = NULL; + } + if (*tag) { + bus_dma_tag_destroy(*tag); + *tag = NULL; + } +} + +static int +ti_dma_alloc(struct ti_softc *sc) +{ + bus_addr_t lowaddr; + int i, error; + + lowaddr = BUS_SPACE_MAXADDR; + if (sc->ti_dac == 0) + lowaddr = BUS_SPACE_MAXADDR_32BIT; + + error = bus_dma_tag_create(bus_get_dma_tag(sc->ti_dev), 1, 0, lowaddr, + BUS_SPACE_MAXADDR, NULL, NULL, BUS_SPACE_MAXSIZE_32BIT, 0, + BUS_SPACE_MAXSIZE_32BIT, 0, NULL, NULL, + &sc->ti_cdata.ti_parent_tag); + if (error != 0) { + device_printf(sc->ti_dev, + "could not allocate parent dma tag\n"); + return (ENOMEM); + } + + error = ti_dma_ring_alloc(sc, TI_RING_ALIGN, sizeof(struct ti_gib), + &sc->ti_cdata.ti_gib_tag, (uint8_t **)&sc->ti_rdata.ti_info, + &sc->ti_cdata.ti_gib_map, &sc->ti_rdata.ti_info_paddr, "GIB"); + if (error) + return (error); + + /* Producer/consumer status */ + error = ti_dma_ring_alloc(sc, TI_RING_ALIGN, sizeof(struct ti_status), + &sc->ti_cdata.ti_status_tag, (uint8_t **)&sc->ti_rdata.ti_status, + &sc->ti_cdata.ti_status_map, &sc->ti_rdata.ti_status_paddr, + "event ring"); + if (error) + return (error); + + /* Event ring */ + error = ti_dma_ring_alloc(sc, TI_RING_ALIGN, TI_EVENT_RING_SZ, + &sc->ti_cdata.ti_event_ring_tag, + (uint8_t **)&sc->ti_rdata.ti_event_ring, + &sc->ti_cdata.ti_event_ring_map, &sc->ti_rdata.ti_event_ring_paddr, + "event ring"); + if (error) + return (error); + + /* Command ring lives in shared memory so no need to create DMA area. */ + + /* Standard RX ring */ + error = ti_dma_ring_alloc(sc, TI_RING_ALIGN, TI_STD_RX_RING_SZ, + &sc->ti_cdata.ti_rx_std_ring_tag, + (uint8_t **)&sc->ti_rdata.ti_rx_std_ring, + &sc->ti_cdata.ti_rx_std_ring_map, + &sc->ti_rdata.ti_rx_std_ring_paddr, "RX ring"); + if (error) + return (error); + + /* Jumbo RX ring */ + error = ti_dma_ring_alloc(sc, TI_JUMBO_RING_ALIGN, TI_JUMBO_RX_RING_SZ, + &sc->ti_cdata.ti_rx_jumbo_ring_tag, + (uint8_t **)&sc->ti_rdata.ti_rx_jumbo_ring, + &sc->ti_cdata.ti_rx_jumbo_ring_map, + &sc->ti_rdata.ti_rx_jumbo_ring_paddr, "jumbo RX ring"); + if (error) + return (error); + + /* RX return ring */ + error = ti_dma_ring_alloc(sc, TI_RING_ALIGN, TI_RX_RETURN_RING_SZ, + &sc->ti_cdata.ti_rx_return_ring_tag, + (uint8_t **)&sc->ti_rdata.ti_rx_return_ring, + &sc->ti_cdata.ti_rx_return_ring_map, + &sc->ti_rdata.ti_rx_return_ring_paddr, "RX return ring"); + if (error) + return (error); + + /* Create DMA tag for standard RX mbufs. */ + error = bus_dma_tag_create(sc->ti_cdata.ti_parent_tag, 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES, 1, + MCLBYTES, 0, NULL, NULL, &sc->ti_cdata.ti_rx_std_tag); + if (error) { + device_printf(sc->ti_dev, "could not allocate RX dma tag\n"); + return (error); + } + + /* Create DMA tag for jumbo RX mbufs. */ +#ifdef TI_SF_BUF_JUMBO + /* + * The VM system will take care of providing aligned pages. Alignment + * is set to 1 here so that busdma resources won't be wasted. + */ + error = bus_dma_tag_create(sc->ti_cdata.ti_parent_tag, 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, PAGE_SIZE * 4, 4, + PAGE_SIZE, 0, NULL, NULL, &sc->ti_cdata.ti_rx_jumbo_tag); +#else + error = bus_dma_tag_create(sc->ti_cdata.ti_parent_tag, 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, MJUM9BYTES, 1, + MJUM9BYTES, 0, NULL, NULL, &sc->ti_cdata.ti_rx_jumbo_tag); +#endif + if (error) { + device_printf(sc->ti_dev, + "could not allocate jumbo RX dma tag\n"); + return (error); + } + + /* Create DMA tag for TX mbufs. */ + error = bus_dma_tag_create(sc->ti_cdata.ti_parent_tag, 1, + 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, + MCLBYTES * TI_MAXTXSEGS, TI_MAXTXSEGS, MCLBYTES, 0, NULL, NULL, + &sc->ti_cdata.ti_tx_tag); + if (error) { + device_printf(sc->ti_dev, "could not allocate TX dma tag\n"); + return (ENOMEM); + } + + /* Create DMA maps for RX buffers. */ for (i = 0; i < TI_STD_RX_RING_CNT; i++) { - if (bus_dmamap_create(sc->ti_mbufrx_dmat, 0, - &sc->ti_cdata.ti_rx_std_maps[i])) { + error = bus_dmamap_create(sc->ti_cdata.ti_rx_std_tag, 0, + &sc->ti_cdata.ti_rx_std_maps[i]); + if (error) { device_printf(sc->ti_dev, - "cannot create DMA map for RX\n"); - return (ENOBUFS); + "could not create DMA map for RX\n"); + return (error); } } - if (bus_dmamap_create(sc->ti_mbufrx_dmat, 0, - &sc->ti_cdata.ti_rx_std_sparemap)) { + error = bus_dmamap_create(sc->ti_cdata.ti_rx_std_tag, 0, + &sc->ti_cdata.ti_rx_std_sparemap); + if (error) { device_printf(sc->ti_dev, - "cannot create spare DMA map for RX\n"); - return (ENOBUFS); + "could not create spare DMA map for RX\n"); + return (error); } + /* Create DMA maps for jumbo RX buffers. */ for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) { - if (bus_dmamap_create(sc->ti_jumbo_dmat, 0, - &sc->ti_cdata.ti_rx_jumbo_maps[i])) { + error = bus_dmamap_create(sc->ti_cdata.ti_rx_jumbo_tag, 0, + &sc->ti_cdata.ti_rx_jumbo_maps[i]); + if (error) { device_printf(sc->ti_dev, - "cannot create DMA map for jumbo RX\n"); - return (ENOBUFS); + "could not create DMA map for jumbo RX\n"); + return (error); } } - if (bus_dmamap_create(sc->ti_jumbo_dmat, 0, - &sc->ti_cdata.ti_rx_jumbo_sparemap)) { + error = bus_dmamap_create(sc->ti_cdata.ti_rx_jumbo_tag, 0, + &sc->ti_cdata.ti_rx_jumbo_sparemap); + if (error) { device_printf(sc->ti_dev, - "cannot create spare DMA map for jumbo RX\n"); - return (ENOBUFS); + "could not create spare DMA map for jumbo RX\n"); + return (error); + } + + /* Create DMA maps for TX buffers. */ + for (i = 0; i < TI_TX_RING_CNT; i++) { + error = bus_dmamap_create(sc->ti_cdata.ti_tx_tag, 0, + &sc->ti_cdata.ti_txdesc[i].tx_dmamap); + if (error) { + device_printf(sc->ti_dev, + "could not create DMA map for TX\n"); + return (ENOMEM); + } } - /* Mini ring is not available on Tigon 1. */ + /* Mini ring and TX ring is not available on Tigon 1. */ if (sc->ti_hwrev == TI_HWREV_TIGON) return (0); + /* TX ring */ + error = ti_dma_ring_alloc(sc, TI_RING_ALIGN, TI_TX_RING_SZ, + &sc->ti_cdata.ti_tx_ring_tag, (uint8_t **)&sc->ti_rdata.ti_tx_ring, + &sc->ti_cdata.ti_tx_ring_map, &sc->ti_rdata.ti_tx_ring_paddr, + "TX ring"); + if (error) + return (error); + + /* Mini RX ring */ + error = ti_dma_ring_alloc(sc, TI_RING_ALIGN, TI_MINI_RX_RING_SZ, + &sc->ti_cdata.ti_rx_mini_ring_tag, + (uint8_t **)&sc->ti_rdata.ti_rx_mini_ring, + &sc->ti_cdata.ti_rx_mini_ring_map, + &sc->ti_rdata.ti_rx_mini_ring_paddr, "mini RX ring"); + if (error) + return (error); + + /* Create DMA tag for mini RX mbufs. */ + error = bus_dma_tag_create(sc->ti_cdata.ti_parent_tag, 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, MHLEN, 1, + MHLEN, 0, NULL, NULL, &sc->ti_cdata.ti_rx_mini_tag); + if (error) { + device_printf(sc->ti_dev, + "could not allocate mini RX dma tag\n"); + return (error); + } + + /* Create DMA maps for mini RX buffers. */ for (i = 0; i < TI_MINI_RX_RING_CNT; i++) { - if (bus_dmamap_create(sc->ti_mbufrx_dmat, 0, - &sc->ti_cdata.ti_rx_mini_maps[i])) { + error = bus_dmamap_create(sc->ti_cdata.ti_rx_mini_tag, 0, + &sc->ti_cdata.ti_rx_mini_maps[i]); + if (error) { device_printf(sc->ti_dev, - "cannot create DMA map for mini RX\n"); - return (ENOBUFS); + "could not create DMA map for mini RX\n"); + return (error); } } - if (bus_dmamap_create(sc->ti_mbufrx_dmat, 0, - &sc->ti_cdata.ti_rx_mini_sparemap)) { + error = bus_dmamap_create(sc->ti_cdata.ti_rx_mini_tag, 0, + &sc->ti_cdata.ti_rx_mini_sparemap); + if (error) { device_printf(sc->ti_dev, - "cannot create DMA map for mini RX\n"); - return (ENOBUFS); + "could not create spare DMA map for mini RX\n"); + return (error); } return (0); } static void -ti_free_dmamaps(struct ti_softc *sc) +ti_dma_free(struct ti_softc *sc) { int i; - if (sc->ti_mbuftx_dmat) { - for (i = 0; i < TI_TX_RING_CNT; i++) { - if (sc->ti_cdata.ti_txdesc[i].tx_dmamap) { - bus_dmamap_destroy(sc->ti_mbuftx_dmat, - sc->ti_cdata.ti_txdesc[i].tx_dmamap); - sc->ti_cdata.ti_txdesc[i].tx_dmamap = NULL; - } + /* Destroy DMA maps for RX buffers. */ + for (i = 0; i < TI_STD_RX_RING_CNT; i++) { + if (sc->ti_cdata.ti_rx_std_maps[i]) { + bus_dmamap_destroy(sc->ti_cdata.ti_rx_std_tag, + sc->ti_cdata.ti_rx_std_maps[i]); + sc->ti_cdata.ti_rx_std_maps[i] = NULL; } } - - if (sc->ti_mbufrx_dmat) { - for (i = 0; i < TI_STD_RX_RING_CNT; i++) { - if (sc->ti_cdata.ti_rx_std_maps[i]) { - bus_dmamap_destroy(sc->ti_mbufrx_dmat, - sc->ti_cdata.ti_rx_std_maps[i]); - sc->ti_cdata.ti_rx_std_maps[i] = NULL; - } - } - if (sc->ti_cdata.ti_rx_std_sparemap) { - bus_dmamap_destroy(sc->ti_mbufrx_dmat, - sc->ti_cdata.ti_rx_std_sparemap); - sc->ti_cdata.ti_rx_std_sparemap = NULL; - } + if (sc->ti_cdata.ti_rx_std_sparemap) { + bus_dmamap_destroy(sc->ti_cdata.ti_rx_std_tag, + sc->ti_cdata.ti_rx_std_sparemap); + sc->ti_cdata.ti_rx_std_sparemap = NULL; + } + if (sc->ti_cdata.ti_rx_std_tag) { + bus_dma_tag_destroy(sc->ti_cdata.ti_rx_std_tag); + sc->ti_cdata.ti_rx_std_tag = NULL; } - if (sc->ti_jumbo_dmat) { - for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) { - if (sc->ti_cdata.ti_rx_jumbo_maps[i]) { - bus_dmamap_destroy(sc->ti_jumbo_dmat, - sc->ti_cdata.ti_rx_jumbo_maps[i]); - sc->ti_cdata.ti_rx_jumbo_maps[i] = NULL; - } - } - if (sc->ti_cdata.ti_rx_jumbo_sparemap) { - bus_dmamap_destroy(sc->ti_jumbo_dmat, - sc->ti_cdata.ti_rx_jumbo_sparemap); - sc->ti_cdata.ti_rx_jumbo_sparemap = NULL; + /* Destroy DMA maps for jumbo RX buffers. */ + for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) { + if (sc->ti_cdata.ti_rx_jumbo_maps[i]) { + bus_dmamap_destroy(sc->ti_cdata.ti_rx_jumbo_tag, + sc->ti_cdata.ti_rx_jumbo_maps[i]); + sc->ti_cdata.ti_rx_jumbo_maps[i] = NULL; } } + if (sc->ti_cdata.ti_rx_jumbo_sparemap) { + bus_dmamap_destroy(sc->ti_cdata.ti_rx_jumbo_tag, + sc->ti_cdata.ti_rx_jumbo_sparemap); + sc->ti_cdata.ti_rx_jumbo_sparemap = NULL; + } + if (sc->ti_cdata.ti_rx_jumbo_tag) { + bus_dma_tag_destroy(sc->ti_cdata.ti_rx_jumbo_tag); + sc->ti_cdata.ti_rx_jumbo_tag = NULL; + } - if (sc->ti_mbufrx_dmat) { - for (i = 0; i < TI_MINI_RX_RING_CNT; i++) { - if (sc->ti_cdata.ti_rx_mini_maps[i]) { - bus_dmamap_destroy(sc->ti_mbufrx_dmat, - sc->ti_cdata.ti_rx_mini_maps[i]); - sc->ti_cdata.ti_rx_mini_maps[i] = NULL; - } - } - if (sc->ti_cdata.ti_rx_mini_sparemap) { - bus_dmamap_destroy(sc->ti_mbufrx_dmat, - sc->ti_cdata.ti_rx_mini_sparemap); - sc->ti_cdata.ti_rx_mini_sparemap = NULL; + /* Destroy DMA maps for mini RX buffers. */ + for (i = 0; i < TI_MINI_RX_RING_CNT; i++) { + if (sc->ti_cdata.ti_rx_mini_maps[i]) { + bus_dmamap_destroy(sc->ti_cdata.ti_rx_mini_tag, + sc->ti_cdata.ti_rx_mini_maps[i]); + sc->ti_cdata.ti_rx_mini_maps[i] = NULL; } } -} - -#ifndef TI_SF_BUF_JUMBO - -static int -ti_alloc_jumbo_mem(struct ti_softc *sc) -{ - - if (bus_dma_tag_create(sc->ti_parent_dmat, 1, 0, BUS_SPACE_MAXADDR, - BUS_SPACE_MAXADDR, NULL, NULL, MJUM9BYTES, 1, MJUM9BYTES, 0, NULL, - NULL, &sc->ti_jumbo_dmat) != 0) { - device_printf(sc->ti_dev, "Failed to allocate jumbo dmat\n"); - return (ENOBUFS); + if (sc->ti_cdata.ti_rx_mini_sparemap) { + bus_dmamap_destroy(sc->ti_cdata.ti_rx_mini_tag, + sc->ti_cdata.ti_rx_mini_sparemap); + sc->ti_cdata.ti_rx_mini_sparemap = NULL; } - return (0); -} - -#else - -static int -ti_alloc_jumbo_mem(struct ti_softc *sc) -{ - - /* - * The VM system will take care of providing aligned pages. Alignment - * is set to 1 here so that busdma resources won't be wasted. - */ - if (bus_dma_tag_create(sc->ti_parent_dmat, /* parent */ - 1, 0, /* algnmnt, boundary */ - BUS_SPACE_MAXADDR, /* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - PAGE_SIZE * 4 /*XXX*/, /* maxsize */ - 4, /* nsegments */ - PAGE_SIZE, /* maxsegsize */ - 0, /* flags */ - NULL, NULL, /* lockfunc, lockarg */ - &sc->ti_jumbo_dmat) != 0) { - device_printf(sc->ti_dev, "Failed to allocate jumbo dmat\n"); - return (ENOBUFS); + if (sc->ti_cdata.ti_rx_mini_tag) { + bus_dma_tag_destroy(sc->ti_cdata.ti_rx_mini_tag); + sc->ti_cdata.ti_rx_mini_tag = NULL; } - return (0); + /* Destroy DMA maps for TX buffers. */ + for (i = 0; i < TI_TX_RING_CNT; i++) { + if (sc->ti_cdata.ti_txdesc[i].tx_dmamap) { + bus_dmamap_destroy(sc->ti_cdata.ti_tx_tag, + sc->ti_cdata.ti_txdesc[i].tx_dmamap); + sc->ti_cdata.ti_txdesc[i].tx_dmamap = NULL; + } + } + if (sc->ti_cdata.ti_tx_tag) { + bus_dma_tag_destroy(sc->ti_cdata.ti_tx_tag); + sc->ti_cdata.ti_tx_tag = NULL; + } + + /* Destroy standard RX ring. */ + ti_dma_ring_free(sc, &sc->ti_cdata.ti_rx_std_ring_tag, + (void *)&sc->ti_rdata.ti_rx_std_ring, + &sc->ti_cdata.ti_rx_std_ring_map); + /* Destroy jumbo RX ring. */ + ti_dma_ring_free(sc, &sc->ti_cdata.ti_rx_jumbo_ring_tag, + (void *)&sc->ti_rdata.ti_rx_jumbo_ring, + &sc->ti_cdata.ti_rx_jumbo_ring_map); + /* Destroy mini RX ring. */ + ti_dma_ring_free(sc, &sc->ti_cdata.ti_rx_mini_ring_tag, + (void *)&sc->ti_rdata.ti_rx_mini_ring, + &sc->ti_cdata.ti_rx_mini_ring_map); + /* Destroy RX return ring. */ + ti_dma_ring_free(sc, &sc->ti_cdata.ti_rx_return_ring_tag, + (void *)&sc->ti_rdata.ti_rx_return_ring, + &sc->ti_cdata.ti_rx_return_ring_map); + /* Destroy TX ring. */ + ti_dma_ring_free(sc, &sc->ti_cdata.ti_tx_ring_tag, + (void *)&sc->ti_rdata.ti_tx_ring, &sc->ti_cdata.ti_tx_ring_map); + /* Destroy status block. */ + ti_dma_ring_free(sc, &sc->ti_cdata.ti_status_tag, + (void *)&sc->ti_rdata.ti_status, &sc->ti_cdata.ti_status_map); + /* Destroy event ring. */ + ti_dma_ring_free(sc, &sc->ti_cdata.ti_event_ring_tag, + (void *)&sc->ti_rdata.ti_event_ring, + &sc->ti_cdata.ti_event_ring_map); + /* Destroy GIB */ + ti_dma_ring_free(sc, &sc->ti_cdata.ti_gib_tag, + (void *)&sc->ti_rdata.ti_info, &sc->ti_cdata.ti_gib_map); + + /* Destroy the parent tag. */ + if (sc->ti_cdata.ti_parent_tag) { + bus_dma_tag_destroy(sc->ti_cdata.ti_parent_tag); + sc->ti_cdata.ti_parent_tag = NULL; + } } -#endif /* TI_SF_BUF_JUMBO */ - /* * Intialize a standard receive ring descriptor. */ @@ -1160,7 +1387,7 @@ ti_newbuf_std(struct ti_softc *sc, int i m->m_len = m->m_pkthdr.len = MCLBYTES; m_adj(m, ETHER_ALIGN); - error = bus_dmamap_load_mbuf_sg(sc->ti_mbufrx_dmat, + error = bus_dmamap_load_mbuf_sg(sc->ti_cdata.ti_rx_std_tag, sc->ti_cdata.ti_rx_std_sparemap, m, segs, &nsegs, 0); if (error != 0) { m_freem(m); @@ -1169,9 +1396,9 @@ ti_newbuf_std(struct ti_softc *sc, int i KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); if (sc->ti_cdata.ti_rx_std_chain[i] != NULL) { - bus_dmamap_sync(sc->ti_mbufrx_dmat, + bus_dmamap_sync(sc->ti_cdata.ti_rx_std_tag, sc->ti_cdata.ti_rx_std_maps[i], BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(sc->ti_mbufrx_dmat, + bus_dmamap_unload(sc->ti_cdata.ti_rx_std_tag, sc->ti_cdata.ti_rx_std_maps[i]); } @@ -1180,7 +1407,7 @@ ti_newbuf_std(struct ti_softc *sc, int i sc->ti_cdata.ti_rx_std_sparemap = map; sc->ti_cdata.ti_rx_std_chain[i] = m; - r = &sc->ti_rdata->ti_rx_std_ring[i]; + r = &sc->ti_rdata.ti_rx_std_ring[i]; ti_hostaddr64(&r->ti_addr, segs[0].ds_addr); r->ti_len = segs[0].ds_len; r->ti_type = TI_BDTYPE_RECV_BD; @@ -1191,8 +1418,8 @@ ti_newbuf_std(struct ti_softc *sc, int i r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; r->ti_idx = i; - bus_dmamap_sync(sc->ti_mbufrx_dmat, sc->ti_cdata.ti_rx_std_maps[i], - BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->ti_cdata.ti_rx_std_tag, + sc->ti_cdata.ti_rx_std_maps[i], BUS_DMASYNC_PREREAD); return (0); } @@ -1215,7 +1442,7 @@ ti_newbuf_mini(struct ti_softc *sc, int m->m_len = m->m_pkthdr.len = MHLEN; m_adj(m, ETHER_ALIGN); - error = bus_dmamap_load_mbuf_sg(sc->ti_mbufrx_dmat, + error = bus_dmamap_load_mbuf_sg(sc->ti_cdata.ti_rx_mini_tag, sc->ti_cdata.ti_rx_mini_sparemap, m, segs, &nsegs, 0); if (error != 0) { m_freem(m); @@ -1224,9 +1451,9 @@ ti_newbuf_mini(struct ti_softc *sc, int KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); if (sc->ti_cdata.ti_rx_mini_chain[i] != NULL) { - bus_dmamap_sync(sc->ti_mbufrx_dmat, + bus_dmamap_sync(sc->ti_cdata.ti_rx_mini_tag, sc->ti_cdata.ti_rx_mini_maps[i], BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(sc->ti_mbufrx_dmat, + bus_dmamap_unload(sc->ti_cdata.ti_rx_mini_tag, sc->ti_cdata.ti_rx_mini_maps[i]); } @@ -1235,7 +1462,7 @@ ti_newbuf_mini(struct ti_softc *sc, int sc->ti_cdata.ti_rx_mini_sparemap = map; sc->ti_cdata.ti_rx_mini_chain[i] = m; - r = &sc->ti_rdata->ti_rx_mini_ring[i]; + r = &sc->ti_rdata.ti_rx_mini_ring[i]; ti_hostaddr64(&r->ti_addr, segs[0].ds_addr); r->ti_len = segs[0].ds_len; r->ti_type = TI_BDTYPE_RECV_BD; @@ -1246,8 +1473,8 @@ ti_newbuf_mini(struct ti_softc *sc, int r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; r->ti_idx = i; - bus_dmamap_sync(sc->ti_mbufrx_dmat, sc->ti_cdata.ti_rx_mini_maps[i], - BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->ti_cdata.ti_rx_mini_tag, + sc->ti_cdata.ti_rx_mini_maps[i], BUS_DMASYNC_PREREAD); return (0); } @@ -1274,7 +1501,7 @@ ti_newbuf_jumbo(struct ti_softc *sc, int m->m_len = m->m_pkthdr.len = MJUM9BYTES; m_adj(m, ETHER_ALIGN); - error = bus_dmamap_load_mbuf_sg(sc->ti_jumbo_dmat, + error = bus_dmamap_load_mbuf_sg(sc->ti_cdata.ti_rx_jumbo_tag, sc->ti_cdata.ti_rx_jumbo_sparemap, m, segs, &nsegs, 0); if (error != 0) { m_freem(m); @@ -1283,9 +1510,9 @@ ti_newbuf_jumbo(struct ti_softc *sc, int KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); if (sc->ti_cdata.ti_rx_jumbo_chain[i] != NULL) { - bus_dmamap_sync(sc->ti_jumbo_dmat, + bus_dmamap_sync(sc->ti_cdata.ti_rx_jumbo_tag, sc->ti_cdata.ti_rx_jumbo_maps[i], BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(sc->ti_jumbo_dmat, + bus_dmamap_unload(sc->ti_cdata.ti_rx_jumbo_tag, sc->ti_cdata.ti_rx_jumbo_maps[i]); } @@ -1294,7 +1521,7 @@ ti_newbuf_jumbo(struct ti_softc *sc, int sc->ti_cdata.ti_rx_jumbo_sparemap = map; sc->ti_cdata.ti_rx_jumbo_chain[i] = m; - r = &sc->ti_rdata->ti_rx_jumbo_ring[i]; + r = &sc->ti_rdata.ti_rx_jumbo_ring[i]; ti_hostaddr64(&r->ti_addr, segs[0].ds_addr); r->ti_len = segs[0].ds_len; r->ti_type = TI_BDTYPE_RECV_JUMBO_BD; @@ -1305,8 +1532,8 @@ ti_newbuf_jumbo(struct ti_softc *sc, int r->ti_flags |= TI_BDFLAG_TCP_UDP_CKSUM | TI_BDFLAG_IP_CKSUM; r->ti_idx = i; - bus_dmamap_sync(sc->ti_jumbo_dmat, sc->ti_cdata.ti_rx_jumbo_maps[i], - BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->ti_cdata.ti_rx_jumbo_tag, + sc->ti_cdata.ti_rx_jumbo_maps[i], BUS_DMASYNC_PREREAD); return (0); } @@ -1418,11 +1645,11 @@ ti_newbuf_jumbo(struct ti_softc *sc, int } /* Set up the descriptor. */ - r = &sc->ti_rdata->ti_rx_jumbo_ring[idx]; + r = &sc->ti_rdata.ti_rx_jumbo_ring[idx]; sc->ti_cdata.ti_rx_jumbo_chain[idx] = m_new; map = sc->ti_cdata.ti_rx_jumbo_maps[i]; - if (bus_dmamap_load_mbuf_sg(sc->ti_jumbo_dmat, map, m_new, segs, - &nsegs, 0)) + if (bus_dmamap_load_mbuf_sg(sc->ti_cdata.ti_rx_jumbo_tag, map, m_new, + segs, &nsegs, 0)) return (ENOBUFS); if ((nsegs < 1) || (nsegs > 4)) return (ENOBUFS); @@ -1450,7 +1677,7 @@ ti_newbuf_jumbo(struct ti_softc *sc, int r->ti_idx = idx; - bus_dmamap_sync(sc->ti_jumbo_dmat, map, BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->ti_cdata.ti_rx_jumbo_tag, map, BUS_DMASYNC_PREREAD); return (0); nobufs: @@ -1506,15 +1733,16 @@ ti_free_rx_ring_std(struct ti_softc *sc) for (i = 0; i < TI_STD_RX_RING_CNT; i++) { if (sc->ti_cdata.ti_rx_std_chain[i] != NULL) { map = sc->ti_cdata.ti_rx_std_maps[i]; - bus_dmamap_sync(sc->ti_mbufrx_dmat, map, + bus_dmamap_sync(sc->ti_cdata.ti_rx_std_tag, map, BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(sc->ti_mbufrx_dmat, map); + bus_dmamap_unload(sc->ti_cdata.ti_rx_std_tag, map); m_freem(sc->ti_cdata.ti_rx_std_chain[i]); sc->ti_cdata.ti_rx_std_chain[i] = NULL; } - bzero((char *)&sc->ti_rdata->ti_rx_std_ring[i], - sizeof(struct ti_rx_desc)); } + bzero(sc->ti_rdata.ti_rx_std_ring, TI_STD_RX_RING_SZ); + bus_dmamap_sync(sc->ti_cdata.ti_rx_std_ring_tag, + sc->ti_cdata.ti_rx_std_ring_map, BUS_DMASYNC_PREWRITE); } static int @@ -1543,15 +1771,16 @@ ti_free_rx_ring_jumbo(struct ti_softc *s for (i = 0; i < TI_JUMBO_RX_RING_CNT; i++) { if (sc->ti_cdata.ti_rx_jumbo_chain[i] != NULL) { map = sc->ti_cdata.ti_rx_jumbo_maps[i]; - bus_dmamap_sync(sc->ti_jumbo_dmat, map, + bus_dmamap_sync(sc->ti_cdata.ti_rx_jumbo_tag, map, BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(sc->ti_jumbo_dmat, map); + bus_dmamap_unload(sc->ti_cdata.ti_rx_jumbo_tag, map); m_freem(sc->ti_cdata.ti_rx_jumbo_chain[i]); sc->ti_cdata.ti_rx_jumbo_chain[i] = NULL; } - bzero((char *)&sc->ti_rdata->ti_rx_jumbo_ring[i], - sizeof(struct ti_rx_desc)); } + bzero(sc->ti_rdata.ti_rx_jumbo_ring, TI_JUMBO_RX_RING_SZ); + bus_dmamap_sync(sc->ti_cdata.ti_rx_jumbo_ring_tag, + sc->ti_cdata.ti_rx_jumbo_ring_map, BUS_DMASYNC_PREWRITE); } static int @@ -1576,18 +1805,22 @@ ti_free_rx_ring_mini(struct ti_softc *sc bus_dmamap_t map; int i; + if (sc->ti_rdata.ti_rx_mini_ring == NULL) + return; + for (i = 0; i < TI_MINI_RX_RING_CNT; i++) { if (sc->ti_cdata.ti_rx_mini_chain[i] != NULL) { map = sc->ti_cdata.ti_rx_mini_maps[i]; - bus_dmamap_sync(sc->ti_mbufrx_dmat, map, + bus_dmamap_sync(sc->ti_cdata.ti_rx_mini_tag, map, BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(sc->ti_mbufrx_dmat, map); + bus_dmamap_unload(sc->ti_cdata.ti_rx_mini_tag, map); m_freem(sc->ti_cdata.ti_rx_mini_chain[i]); sc->ti_cdata.ti_rx_mini_chain[i] = NULL; } - bzero((char *)&sc->ti_rdata->ti_rx_mini_ring[i], - sizeof(struct ti_rx_desc)); } + bzero(sc->ti_rdata.ti_rx_mini_ring, TI_MINI_RX_RING_SZ); + bus_dmamap_sync(sc->ti_cdata.ti_rx_mini_ring_tag, + sc->ti_cdata.ti_rx_mini_ring_map, BUS_DMASYNC_PREWRITE); } static void @@ -1596,21 +1829,23 @@ ti_free_tx_ring(struct ti_softc *sc) struct ti_txdesc *txd; int i; - if (sc->ti_rdata->ti_tx_ring == NULL) + if (sc->ti_rdata.ti_tx_ring == NULL) return; for (i = 0; i < TI_TX_RING_CNT; i++) { txd = &sc->ti_cdata.ti_txdesc[i]; if (txd->tx_m != NULL) { - bus_dmamap_sync(sc->ti_mbuftx_dmat, txd->tx_dmamap, + bus_dmamap_sync(sc->ti_cdata.ti_tx_tag, txd->tx_dmamap, BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(sc->ti_mbuftx_dmat, txd->tx_dmamap); + bus_dmamap_unload(sc->ti_cdata.ti_tx_tag, + txd->tx_dmamap); m_freem(txd->tx_m); txd->tx_m = NULL; } - bzero((char *)&sc->ti_rdata->ti_tx_ring[i], - sizeof(struct ti_tx_desc)); } + bzero(sc->ti_rdata.ti_tx_ring, TI_TX_RING_SZ); + bus_dmamap_sync(sc->ti_cdata.ti_tx_ring_tag, + sc->ti_cdata.ti_tx_ring_map, BUS_DMASYNC_PREWRITE); } static int @@ -1953,25 +2188,20 @@ ti_gibinit(struct ti_softc *sc) { struct ifnet *ifp; struct ti_rcb *rcb; - uint32_t rdphys; int i; TI_LOCK_ASSERT(sc); ifp = sc->ti_ifp; - rdphys = sc->ti_rdata_phys; /* Disable interrupts for now. */ CSR_WRITE_4(sc, TI_MB_HOSTINTR, 1); - /* - * Tell the chip where to find the general information block. - * While this struct could go into >4GB memory, we allocate it in a - * single slab with the other descriptors, and those don't seem to - * support being located in a 64-bit region. - */ - CSR_WRITE_4(sc, TI_GCR_GENINFO_HI, 0); - CSR_WRITE_4(sc, TI_GCR_GENINFO_LO, rdphys + TI_RD_OFF(ti_info)); + /* Tell the chip where to find the general information block. */ + CSR_WRITE_4(sc, TI_GCR_GENINFO_HI, + (uint64_t)sc->ti_rdata.ti_info_paddr >> 32); + CSR_WRITE_4(sc, TI_GCR_GENINFO_LO, + sc->ti_rdata.ti_info_paddr & 0xFFFFFFFF); /* Load the firmware into SRAM. */ ti_loadfw(sc); @@ -1979,20 +2209,20 @@ ti_gibinit(struct ti_softc *sc) /* Set up the contents of the general info and ring control blocks. */ /* Set up the event ring and producer pointer. */ - rcb = &sc->ti_rdata->ti_info.ti_ev_rcb; - - TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_event_ring); + bzero(sc->ti_rdata.ti_event_ring, TI_EVENT_RING_SZ); + rcb = &sc->ti_rdata.ti_info->ti_ev_rcb; + ti_hostaddr64(&rcb->ti_hostaddr, sc->ti_rdata.ti_event_ring_paddr); rcb->ti_flags = 0; - TI_HOSTADDR(sc->ti_rdata->ti_info.ti_ev_prodidx_ptr) = - rdphys + TI_RD_OFF(ti_ev_prodidx_r); + ti_hostaddr64(&sc->ti_rdata.ti_info->ti_ev_prodidx_ptr, + sc->ti_rdata.ti_status_paddr + + offsetof(struct ti_status, ti_ev_prodidx_r)); sc->ti_ev_prodidx.ti_idx = 0; CSR_WRITE_4(sc, TI_GCR_EVENTCONS_IDX, 0); sc->ti_ev_saved_considx = 0; /* Set up the command ring and producer mailbox. */ - rcb = &sc->ti_rdata->ti_info.ti_cmd_rcb; - - TI_HOSTADDR(rcb->ti_hostaddr) = TI_GCR_NIC_ADDR(TI_GCR_CMDRING); + rcb = &sc->ti_rdata.ti_info->ti_cmd_rcb; + ti_hostaddr64(&rcb->ti_hostaddr, TI_GCR_NIC_ADDR(TI_GCR_CMDRING)); rcb->ti_flags = 0; rcb->ti_max_len = 0; for (i = 0; i < TI_CMD_RING_CNT; i++) { @@ -2007,12 +2237,13 @@ ti_gibinit(struct ti_softc *sc) * We re-use the current stats buffer for this to * conserve memory. */ - TI_HOSTADDR(sc->ti_rdata->ti_info.ti_refresh_stats_ptr) = - rdphys + TI_RD_OFF(ti_info.ti_stats); + bzero(&sc->ti_rdata.ti_info->ti_stats, sizeof(struct ti_stats)); + ti_hostaddr64(&sc->ti_rdata.ti_info->ti_refresh_stats_ptr, + sc->ti_rdata.ti_info_paddr + offsetof(struct ti_gib, ti_stats)); /* Set up the standard receive ring. */ - rcb = &sc->ti_rdata->ti_info.ti_std_rx_rcb; - TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_rx_std_ring); + rcb = &sc->ti_rdata.ti_info->ti_std_rx_rcb; + ti_hostaddr64(&rcb->ti_hostaddr, sc->ti_rdata.ti_rx_std_ring_paddr); rcb->ti_max_len = TI_FRAMELEN; rcb->ti_flags = 0; if (sc->ti_ifp->if_capenable & IFCAP_RXCSUM) @@ -2022,8 +2253,8 @@ ti_gibinit(struct ti_softc *sc) rcb->ti_flags |= TI_RCB_FLAG_VLAN_ASSIST; /* Set up the jumbo receive ring. */ - rcb = &sc->ti_rdata->ti_info.ti_jumbo_rx_rcb; - TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_rx_jumbo_ring); + rcb = &sc->ti_rdata.ti_info->ti_jumbo_rx_rcb; + ti_hostaddr64(&rcb->ti_hostaddr, sc->ti_rdata.ti_rx_jumbo_ring_paddr); #ifndef TI_SF_BUF_JUMBO rcb->ti_max_len = MJUM9BYTES - ETHER_ALIGN; @@ -2043,8 +2274,8 @@ ti_gibinit(struct ti_softc *sc) * Tigon 2 but the slot in the config block is * still there on the Tigon 1. */ - rcb = &sc->ti_rdata->ti_info.ti_mini_rx_rcb; - TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_rx_mini_ring); + rcb = &sc->ti_rdata.ti_info->ti_mini_rx_rcb; + ti_hostaddr64(&rcb->ti_hostaddr, sc->ti_rdata.ti_rx_mini_ring_paddr); rcb->ti_max_len = MHLEN - ETHER_ALIGN; if (sc->ti_hwrev == TI_HWREV_TIGON) rcb->ti_flags = TI_RCB_FLAG_RING_DISABLED; @@ -2059,12 +2290,13 @@ ti_gibinit(struct ti_softc *sc) /* * Set up the receive return ring. */ - rcb = &sc->ti_rdata->ti_info.ti_return_rcb; - TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_rx_return_ring); + rcb = &sc->ti_rdata.ti_info->ti_return_rcb; + ti_hostaddr64(&rcb->ti_hostaddr, sc->ti_rdata.ti_rx_return_ring_paddr); rcb->ti_flags = 0; rcb->ti_max_len = TI_RETURN_RING_CNT; - TI_HOSTADDR(sc->ti_rdata->ti_info.ti_return_prodidx_ptr) = - rdphys + TI_RD_OFF(ti_return_prodidx_r); + ti_hostaddr64(&sc->ti_rdata.ti_info->ti_return_prodidx_ptr, + sc->ti_rdata.ti_status_paddr + + offsetof(struct ti_status, ti_return_prodidx_r)); /* * Set up the tx ring. Note: for the Tigon 2, we have the option @@ -2076,9 +2308,9 @@ ti_gibinit(struct ti_softc *sc) * a Tigon 1 chip. */ CSR_WRITE_4(sc, TI_WINBASE, TI_TX_RING_BASE); - bzero((char *)sc->ti_rdata->ti_tx_ring, - TI_TX_RING_CNT * sizeof(struct ti_tx_desc)); - rcb = &sc->ti_rdata->ti_info.ti_tx_rcb; + if (sc->ti_rdata.ti_tx_ring != NULL) + bzero(sc->ti_rdata.ti_tx_ring, TI_TX_RING_SZ); + rcb = &sc->ti_rdata.ti_info->ti_tx_rcb; if (sc->ti_hwrev == TI_HWREV_TIGON) rcb->ti_flags = 0; else @@ -2090,18 +2322,28 @@ ti_gibinit(struct ti_softc *sc) TI_RCB_FLAG_IP_CKSUM | TI_RCB_FLAG_NO_PHDR_CKSUM; rcb->ti_max_len = TI_TX_RING_CNT; if (sc->ti_hwrev == TI_HWREV_TIGON) - TI_HOSTADDR(rcb->ti_hostaddr) = TI_TX_RING_BASE; + ti_hostaddr64(&rcb->ti_hostaddr, TI_TX_RING_BASE); else - TI_HOSTADDR(rcb->ti_hostaddr) = rdphys + TI_RD_OFF(ti_tx_ring); - TI_HOSTADDR(sc->ti_rdata->ti_info.ti_tx_considx_ptr) = - rdphys + TI_RD_OFF(ti_tx_considx_r); - - bus_dmamap_sync(sc->ti_rdata_dmat, sc->ti_rdata_dmamap, - BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); + ti_hostaddr64(&rcb->ti_hostaddr, + sc->ti_rdata.ti_tx_ring_paddr); + ti_hostaddr64(&sc->ti_rdata.ti_info->ti_tx_considx_ptr, + sc->ti_rdata.ti_status_paddr + + offsetof(struct ti_status, ti_tx_considx_r)); + + bus_dmamap_sync(sc->ti_cdata.ti_gib_tag, sc->ti_cdata.ti_gib_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(sc->ti_cdata.ti_status_tag, sc->ti_cdata.ti_status_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(sc->ti_cdata.ti_event_ring_tag, + sc->ti_cdata.ti_event_ring_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + if (sc->ti_rdata.ti_tx_ring != NULL) + bus_dmamap_sync(sc->ti_cdata.ti_tx_ring_tag, + sc->ti_cdata.ti_tx_ring_map, BUS_DMASYNC_PREWRITE); /* Set up tunables */ #if 0 - if (ifp->if_mtu > (ETHERMTU + ETHER_HDR_LEN + ETHER_CRC_LEN)) + if (ifp->if_mtu > ETHERMTU + ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN) CSR_WRITE_4(sc, TI_GCR_RX_COAL_TICKS, (sc->ti_rx_coal_ticks / 10)); else @@ -2123,23 +2365,6 @@ ti_gibinit(struct ti_softc *sc) return (0); } -static void -ti_rdata_cb(void *arg, bus_dma_segment_t *segs, int nseg, int error) -{ - struct ti_softc *sc; - - sc = arg; - if (error || nseg != 1) - return; - - /* - * All of the Tigon data structures need to live at <4GB. This - * cast is fine since busdma was told about this constraint. - */ - sc->ti_rdata_phys = segs[0].ds_addr; - return; -} - /* * Probe for a Tigon chip. Check the PCI vendor and device IDs * against our list and return its name if we find a match. @@ -2241,8 +2466,7 @@ ti_attach(device_t dev) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 23:57:28 2012 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 636DF1065672; Tue, 3 Jan 2012 23:57:28 +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 4CE488FC17; Tue, 3 Jan 2012 23:57: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 q03NvSmh049781; Tue, 3 Jan 2012 23:57:28 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03NvSgI049779; Tue, 3 Jan 2012 23:57:28 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201032357.q03NvSgI049779@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 23:57:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229444 - stable/9/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: Tue, 03 Jan 2012 23:57:28 -0000 Author: yongari Date: Tue Jan 3 23:57:27 2012 New Revision: 229444 URL: http://svn.freebsd.org/changeset/base/229444 Log: MFC r227348: ti(4) supports altq(4). Modified: stable/9/share/man/man4/altq.4 Directory Properties: stable/9/share/man/man4/ (props changed) Modified: stable/9/share/man/man4/altq.4 ============================================================================== --- stable/9/share/man/man4/altq.4 Tue Jan 3 23:46:45 2012 (r229443) +++ stable/9/share/man/man4/altq.4 Tue Jan 3 23:57:27 2012 (r229444) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 6, 2011 +.Dd November 8, 2011 .Dt ALTQ 4 .Os .Sh NAME @@ -161,6 +161,7 @@ They have been applied to the following .Xr sk 4 , .Xr ste 4 , .Xr stge 4 , +.Xr ti 4 , .Xr txp 4 , .Xr udav 4 , .Xr ural 4 , From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 23:57:47 2012 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 D5725106564A; Tue, 3 Jan 2012 23:57:47 +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 BF6A48FC08; Tue, 3 Jan 2012 23:57:47 +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 q03NvlbG049829; Tue, 3 Jan 2012 23:57:47 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03Nvl51049827; Tue, 3 Jan 2012 23:57:47 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201032357.q03Nvl51049827@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 23:57:47 +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: r229445 - 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: Tue, 03 Jan 2012 23:57:47 -0000 Author: yongari Date: Tue Jan 3 23:57:47 2012 New Revision: 229445 URL: http://svn.freebsd.org/changeset/base/229445 Log: MFC r227348: ti(4) supports altq(4). Modified: stable/8/share/man/man4/altq.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/altq.4 ============================================================================== --- stable/8/share/man/man4/altq.4 Tue Jan 3 23:57:27 2012 (r229444) +++ stable/8/share/man/man4/altq.4 Tue Jan 3 23:57:47 2012 (r229445) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 30, 2010 +.Dd November 8, 2011 .Dt ALTQ 4 .Os .Sh NAME @@ -160,6 +160,7 @@ They have been applied to the following .Xr sk 4 , .Xr ste 4 , .Xr stge 4 , +.Xr ti 4 , .Xr txp 4 , .Xr udav 4 , .Xr ural 4 , From owner-svn-src-all@FreeBSD.ORG Tue Jan 3 23:58:02 2012 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 8073C10657D5; Tue, 3 Jan 2012 23:58:02 +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 6A4D28FC14; Tue, 3 Jan 2012 23:58: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 q03Nw2Nw049877; Tue, 3 Jan 2012 23:58:02 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q03Nw21a049875; Tue, 3 Jan 2012 23:58:02 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201032358.q03Nw21a049875@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 3 Jan 2012 23:58:02 +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: r229446 - 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: Tue, 03 Jan 2012 23:58:02 -0000 Author: yongari Date: Tue Jan 3 23:58:02 2012 New Revision: 229446 URL: http://svn.freebsd.org/changeset/base/229446 Log: MFC r227348: ti(4) supports altq(4). Modified: stable/7/share/man/man4/altq.4 Directory Properties: stable/7/share/man/man4/ (props changed) Modified: stable/7/share/man/man4/altq.4 ============================================================================== --- stable/7/share/man/man4/altq.4 Tue Jan 3 23:57:47 2012 (r229445) +++ stable/7/share/man/man4/altq.4 Tue Jan 3 23:58:02 2012 (r229446) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 30, 2010 +.Dd November 8, 2011 .Dt ALTQ 4 .Os .Sh NAME @@ -159,6 +159,7 @@ They have been applied to the following .Xr sk 4 , .Xr ste 4 , .Xr stge 4 , +.Xr ti 4 , .Xr txp 4 , .Xr udav 4 , .Xr ural 4 , From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 00:03:33 2012 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 99DCC1065676; Wed, 4 Jan 2012 00:03:33 +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 83BC48FC15; Wed, 4 Jan 2012 00:03:33 +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 q0403XDE050234; Wed, 4 Jan 2012 00:03:33 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0403XRT050232; Wed, 4 Jan 2012 00:03:33 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201040003.q0403XRT050232@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 4 Jan 2012 00:03:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229447 - stable/9/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: Wed, 04 Jan 2012 00:03:33 -0000 Author: yongari Date: Wed Jan 4 00:03:33 2012 New Revision: 229447 URL: http://svn.freebsd.org/changeset/base/229447 Log: MFC r227349,227513-227514: r227349: Document TI_SF_BUF_JUMBO and Xr altq. r227513: Document newly introduced a loader tunable and sysctl variables. r227514: Clarify hw.ti.%d.dac tunable. Modified: stable/9/share/man/man4/ti.4 Directory Properties: stable/9/share/man/man4/ (props changed) Modified: stable/9/share/man/man4/ti.4 ============================================================================== --- stable/9/share/man/man4/ti.4 Tue Jan 3 23:58:02 2012 (r229446) +++ stable/9/share/man/man4/ti.4 Wed Jan 4 00:03:33 2012 (r229447) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 16, 2005 +.Dd November 14, 2011 .Dt TI 4 .Os .Sh NAME @@ -42,7 +42,7 @@ place the following lines in your kernel configuration file: .Bd -ragged -offset indent .Cd "device ti" -.Cd "options TI_PRIVATE_JUMBOS" +.Cd "options TI_SF_BUF_JUMBO" .Cd "options TI_JUMBO_HDRSPLIT" .Ed .Pp @@ -97,13 +97,14 @@ for more discussion on zero copy receive .Pp The .Nm -driver normally uses jumbo receive buffers allocated by the +driver uses UMA backed jumbo receive buffers, but can be configured +to use .Xr sendfile 2 -buffer allocator, but can be configured to use its own private pool of -jumbo buffers that are contiguous instead of buffers from the jumbo -allocator, which are made up of multiple page sized chunks. -To turn on private jumbos, use the -.Dv TI_PRIVATE_JUMBOS +buffer allocator. +To turn on +.Xr sendfile 2 +buffer allocator, use the +.Dv TI_SF_BUF_JUMBO option. .Pp Support for vlans is also available using the @@ -201,6 +202,93 @@ NEC Gigabit Ethernet .It Silicon Graphics PCI Gigabit Ethernet adapter .El +.Sh LOADER TUNABLES +Tunables can be set at the +.Xr loader 8 +prompt before booting the kernel or stored in +.Xr loader.conf 5 . +.Bl -tag -width "xxxxxx" +.It Va hw.ti.%d.dac +If this tunable is set to 0 it will disable DAC (Dual Address Cycle). +The default value is 1 which means driver will use full 64bit +DMA addressing. +.El +.Sh SYSCTL VARIABLES +The following variables are available as both +.Xr sysctl 8 +variables and +.Xr loader 8 +tunables. +The interface has to be brought down and up again before a +change takes effect when any of the following tunables are +changed. +The one microsecond clock tick referenced below is a nominal +time and the actual hardware may not provide granularity to +this level. +For example, on Tigon 2 (revision 6) cards with release 12.0 +the clock granularity is 5 microseconds. +.Bl -tag -width "xxxxxx" +.It Va dev.ti.%d.rx_coal_ticks +This value, receive coalesced ticks, controls the number of clock +ticks (of 1 microseconds each) that must elapse before the NIC DMAs +the receive return producer pointer to the Host and generates an +interrupt. +This parameter works in conjunction with the rx_max_coal_bds, +receive max coalesced BDs, tunable parameter. +The NIC will return the receive return producer pointer to the Host +when either of the thresholds is exceeded. +A value of 0 means that this parameter is ignored and receive BDs +will only be returned when the receive max coalesced BDs value is +reached. +The default valus is 170. +.It Va dev.ti.%d.rx_max_coal_bds +This value, receive max coalesced BDs, controls the number of +receive buffer descriptors that will be coalesced before the NIC +updates the receive return ring producer index. +If this value is set to 0 it will disable receive buffer descriptor +coalescing. +The default valus is 64. +.It Va dev.ti.%d.ti_tx_coal_ticks +This value, send coalesced ticks, controls the number of clock +ticks (of 1 microseconds each) that must elapse before the NIC DMAs +the send consumer pointer to the Host and generates an interrupt. +This parameter works in conjunction with the tx_max_coal_bds, +send max coalesced BDs, tunable parameter. +The NIC will return the send consumer pointer to the Host when +either of the thresholds is exceeded. +A value of 0 means that this parameter is ignored and send BDs will +only be returned when the send max coalesced BDs value is reached. +The default value is 2000. +.It Va dev.ti.%d.tx_max_coal_bds +This value, send max coalesced BDs, controls the number of send +buffer descriptors that will be coalesced before the NIC updates +the send consumer index. +If this valus is set to 0 it will disable send buffer descriptor +coalescing. +The default valus is 32. +.It Va dev.ti.%d.tx_buf_ratio +This value controls the ratio of the remaining memory in the NIC +that should be devoted to transmit buffer vs. receive buffer. +The lower 7 bits are used to indicate the ratio in 1/64th increments. +For example, setting this value to 16 will set the transmit buffer +to 1/4 of the remaining buffer space. +In no cases will the transmit or receive buffer be reduced below +68 KB. +For a 1 MB NIC the approximate total space for data buffers is +800 KB. +For a 512 KB NIC that number is 300 KB. +The default value is 21. +.It Va dev.ti.%d.stat_ticks +The value, stat ticks, controls the number of clock ticks +(of 1 microseconds each) that must elapse before the NIC DMAs +the statistics block to the Host and generates a STATS_UPDATED +event. +If set to zero then statistics are never DMAed to the Host. +It is recommended that this value be set to a high enough +frequency to not mislead someone reading statistics refreshes. +Several times a second is enough. +The default value is 2000000 (2 seconds). +.El .Sh IOCTLS In addition to the standard .Xr socket 2 @@ -311,6 +399,7 @@ the network connection (cable). .El .Sh SEE ALSO .Xr sendfile 2 , +.Xr altq 4 , .Xr arp 4 , .Xr netintro 4 , .Xr ng_ether 4 , From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 00:03:50 2012 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 B6387106567A; Wed, 4 Jan 2012 00:03:50 +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 9F77A8FC0C; Wed, 4 Jan 2012 00:03:50 +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 q0403oZk050277; Wed, 4 Jan 2012 00:03:50 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0403oZC050275; Wed, 4 Jan 2012 00:03:50 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201040003.q0403oZC050275@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 4 Jan 2012 00:03:50 +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: r229448 - 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: Wed, 04 Jan 2012 00:03:50 -0000 Author: yongari Date: Wed Jan 4 00:03:50 2012 New Revision: 229448 URL: http://svn.freebsd.org/changeset/base/229448 Log: MFC r227349,227513-227514: r227349: Document TI_SF_BUF_JUMBO and Xr altq. r227513: Document newly introduced a loader tunable and sysctl variables. r227514: Clarify hw.ti.%d.dac tunable. Modified: stable/8/share/man/man4/ti.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/ti.4 ============================================================================== --- stable/8/share/man/man4/ti.4 Wed Jan 4 00:03:33 2012 (r229447) +++ stable/8/share/man/man4/ti.4 Wed Jan 4 00:03:50 2012 (r229448) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 16, 2005 +.Dd November 14, 2011 .Dt TI 4 .Os .Sh NAME @@ -42,7 +42,7 @@ place the following lines in your kernel configuration file: .Bd -ragged -offset indent .Cd "device ti" -.Cd "options TI_PRIVATE_JUMBOS" +.Cd "options TI_SF_BUF_JUMBO" .Cd "options TI_JUMBO_HDRSPLIT" .Ed .Pp @@ -97,13 +97,14 @@ for more discussion on zero copy receive .Pp The .Nm -driver normally uses jumbo receive buffers allocated by the +driver uses UMA backed jumbo receive buffers, but can be configured +to use .Xr sendfile 2 -buffer allocator, but can be configured to use its own private pool of -jumbo buffers that are contiguous instead of buffers from the jumbo -allocator, which are made up of multiple page sized chunks. -To turn on private jumbos, use the -.Dv TI_PRIVATE_JUMBOS +buffer allocator. +To turn on +.Xr sendfile 2 +buffer allocator, use the +.Dv TI_SF_BUF_JUMBO option. .Pp Support for vlans is also available using the @@ -203,6 +204,93 @@ NEC Gigabit Ethernet .It Silicon Graphics PCI Gigabit Ethernet adapter .El +.Sh LOADER TUNABLES +Tunables can be set at the +.Xr loader 8 +prompt before booting the kernel or stored in +.Xr loader.conf 5 . +.Bl -tag -width "xxxxxx" +.It Va hw.ti.%d.dac +If this tunable is set to 0 it will disable DAC (Dual Address Cycle). +The default value is 1 which means driver will use full 64bit +DMA addressing. +.El +.Sh SYSCTL VARIABLES +The following variables are available as both +.Xr sysctl 8 +variables and +.Xr loader 8 +tunables. +The interface has to be brought down and up again before a +change takes effect when any of the following tunables are +changed. +The one microsecond clock tick referenced below is a nominal +time and the actual hardware may not provide granularity to +this level. +For example, on Tigon 2 (revision 6) cards with release 12.0 +the clock granularity is 5 microseconds. +.Bl -tag -width "xxxxxx" +.It Va dev.ti.%d.rx_coal_ticks +This value, receive coalesced ticks, controls the number of clock +ticks (of 1 microseconds each) that must elapse before the NIC DMAs +the receive return producer pointer to the Host and generates an +interrupt. +This parameter works in conjunction with the rx_max_coal_bds, +receive max coalesced BDs, tunable parameter. +The NIC will return the receive return producer pointer to the Host +when either of the thresholds is exceeded. +A value of 0 means that this parameter is ignored and receive BDs +will only be returned when the receive max coalesced BDs value is +reached. +The default valus is 170. +.It Va dev.ti.%d.rx_max_coal_bds +This value, receive max coalesced BDs, controls the number of +receive buffer descriptors that will be coalesced before the NIC +updates the receive return ring producer index. +If this value is set to 0 it will disable receive buffer descriptor +coalescing. +The default valus is 64. +.It Va dev.ti.%d.ti_tx_coal_ticks +This value, send coalesced ticks, controls the number of clock +ticks (of 1 microseconds each) that must elapse before the NIC DMAs +the send consumer pointer to the Host and generates an interrupt. +This parameter works in conjunction with the tx_max_coal_bds, +send max coalesced BDs, tunable parameter. +The NIC will return the send consumer pointer to the Host when +either of the thresholds is exceeded. +A value of 0 means that this parameter is ignored and send BDs will +only be returned when the send max coalesced BDs value is reached. +The default value is 2000. +.It Va dev.ti.%d.tx_max_coal_bds +This value, send max coalesced BDs, controls the number of send +buffer descriptors that will be coalesced before the NIC updates +the send consumer index. +If this valus is set to 0 it will disable send buffer descriptor +coalescing. +The default valus is 32. +.It Va dev.ti.%d.tx_buf_ratio +This value controls the ratio of the remaining memory in the NIC +that should be devoted to transmit buffer vs. receive buffer. +The lower 7 bits are used to indicate the ratio in 1/64th increments. +For example, setting this value to 16 will set the transmit buffer +to 1/4 of the remaining buffer space. +In no cases will the transmit or receive buffer be reduced below +68 KB. +For a 1 MB NIC the approximate total space for data buffers is +800 KB. +For a 512 KB NIC that number is 300 KB. +The default value is 21. +.It Va dev.ti.%d.stat_ticks +The value, stat ticks, controls the number of clock ticks +(of 1 microseconds each) that must elapse before the NIC DMAs +the statistics block to the Host and generates a STATS_UPDATED +event. +If set to zero then statistics are never DMAed to the Host. +It is recommended that this value be set to a high enough +frequency to not mislead someone reading statistics refreshes. +Several times a second is enough. +The default value is 2000000 (2 seconds). +.El .Sh IOCTLS In addition to the standard .Xr socket 2 @@ -313,6 +401,7 @@ the network connection (cable). .El .Sh SEE ALSO .Xr sendfile 2 , +.Xr altq 4 , .Xr arp 4 , .Xr netintro 4 , .Xr ng_ether 4 , From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 00:04:01 2012 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 CB7BE10657AE; Wed, 4 Jan 2012 00:04:01 +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 ABCCE8FC0A; Wed, 4 Jan 2012 00:04: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 q04041PP050323; Wed, 4 Jan 2012 00:04:01 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04041I7050321; Wed, 4 Jan 2012 00:04:01 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201040004.q04041I7050321@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 4 Jan 2012 00:04:01 +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: r229449 - 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: Wed, 04 Jan 2012 00:04:01 -0000 Author: yongari Date: Wed Jan 4 00:04:01 2012 New Revision: 229449 URL: http://svn.freebsd.org/changeset/base/229449 Log: MFC r227349,227513-227514: r227349: Document TI_SF_BUF_JUMBO and Xr altq. r227513: Document newly introduced a loader tunable and sysctl variables. r227514: Clarify hw.ti.%d.dac tunable. Modified: stable/7/share/man/man4/ti.4 Directory Properties: stable/7/share/man/man4/ (props changed) Modified: stable/7/share/man/man4/ti.4 ============================================================================== --- stable/7/share/man/man4/ti.4 Wed Jan 4 00:03:50 2012 (r229448) +++ stable/7/share/man/man4/ti.4 Wed Jan 4 00:04:01 2012 (r229449) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 16, 2005 +.Dd November 14, 2011 .Dt TI 4 .Os .Sh NAME @@ -42,7 +42,7 @@ place the following lines in your kernel configuration file: .Bd -ragged -offset indent .Cd "device ti" -.Cd "options TI_PRIVATE_JUMBOS" +.Cd "options TI_SF_BUF_JUMBO" .Cd "options TI_JUMBO_HDRSPLIT" .Ed .Pp @@ -97,13 +97,14 @@ for more discussion on zero copy receive .Pp The .Nm -driver normally uses jumbo receive buffers allocated by the +driver uses UMA backed jumbo receive buffers, but can be configured +to use .Xr sendfile 2 -buffer allocator, but can be configured to use its own private pool of -jumbo buffers that are contiguous instead of buffers from the jumbo -allocator, which are made up of multiple page sized chunks. -To turn on private jumbos, use the -.Dv TI_PRIVATE_JUMBOS +buffer allocator. +To turn on +.Xr sendfile 2 +buffer allocator, use the +.Dv TI_SF_BUF_JUMBO option. .Pp Support for vlans is also available using the @@ -203,6 +204,93 @@ NEC Gigabit Ethernet .It Silicon Graphics PCI Gigabit Ethernet adapter .El +.Sh LOADER TUNABLES +Tunables can be set at the +.Xr loader 8 +prompt before booting the kernel or stored in +.Xr loader.conf 5 . +.Bl -tag -width "xxxxxx" +.It Va hw.ti.%d.dac +If this tunable is set to 0 it will disable DAC (Dual Address Cycle). +The default value is 1 which means driver will use full 64bit +DMA addressing. +.El +.Sh SYSCTL VARIABLES +The following variables are available as both +.Xr sysctl 8 +variables and +.Xr loader 8 +tunables. +The interface has to be brought down and up again before a +change takes effect when any of the following tunables are +changed. +The one microsecond clock tick referenced below is a nominal +time and the actual hardware may not provide granularity to +this level. +For example, on Tigon 2 (revision 6) cards with release 12.0 +the clock granularity is 5 microseconds. +.Bl -tag -width "xxxxxx" +.It Va dev.ti.%d.rx_coal_ticks +This value, receive coalesced ticks, controls the number of clock +ticks (of 1 microseconds each) that must elapse before the NIC DMAs +the receive return producer pointer to the Host and generates an +interrupt. +This parameter works in conjunction with the rx_max_coal_bds, +receive max coalesced BDs, tunable parameter. +The NIC will return the receive return producer pointer to the Host +when either of the thresholds is exceeded. +A value of 0 means that this parameter is ignored and receive BDs +will only be returned when the receive max coalesced BDs value is +reached. +The default valus is 170. +.It Va dev.ti.%d.rx_max_coal_bds +This value, receive max coalesced BDs, controls the number of +receive buffer descriptors that will be coalesced before the NIC +updates the receive return ring producer index. +If this value is set to 0 it will disable receive buffer descriptor +coalescing. +The default valus is 64. +.It Va dev.ti.%d.ti_tx_coal_ticks +This value, send coalesced ticks, controls the number of clock +ticks (of 1 microseconds each) that must elapse before the NIC DMAs +the send consumer pointer to the Host and generates an interrupt. +This parameter works in conjunction with the tx_max_coal_bds, +send max coalesced BDs, tunable parameter. +The NIC will return the send consumer pointer to the Host when +either of the thresholds is exceeded. +A value of 0 means that this parameter is ignored and send BDs will +only be returned when the send max coalesced BDs value is reached. +The default value is 2000. +.It Va dev.ti.%d.tx_max_coal_bds +This value, send max coalesced BDs, controls the number of send +buffer descriptors that will be coalesced before the NIC updates +the send consumer index. +If this valus is set to 0 it will disable send buffer descriptor +coalescing. +The default valus is 32. +.It Va dev.ti.%d.tx_buf_ratio +This value controls the ratio of the remaining memory in the NIC +that should be devoted to transmit buffer vs. receive buffer. +The lower 7 bits are used to indicate the ratio in 1/64th increments. +For example, setting this value to 16 will set the transmit buffer +to 1/4 of the remaining buffer space. +In no cases will the transmit or receive buffer be reduced below +68 KB. +For a 1 MB NIC the approximate total space for data buffers is +800 KB. +For a 512 KB NIC that number is 300 KB. +The default value is 21. +.It Va dev.ti.%d.stat_ticks +The value, stat ticks, controls the number of clock ticks +(of 1 microseconds each) that must elapse before the NIC DMAs +the statistics block to the Host and generates a STATS_UPDATED +event. +If set to zero then statistics are never DMAed to the Host. +It is recommended that this value be set to a high enough +frequency to not mislead someone reading statistics refreshes. +Several times a second is enough. +The default value is 2000000 (2 seconds). +.El .Sh IOCTLS In addition to the standard .Xr socket 2 @@ -313,6 +401,7 @@ the network connection (cable). .El .Sh SEE ALSO .Xr sendfile 2 , +.Xr altq 4 , .Xr arp 4 , .Xr netintro 4 , .Xr ng_ether 4 , From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 00:24:10 2012 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 40BE8106566B; Wed, 4 Jan 2012 00:24:10 +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 29C478FC0A; Wed, 4 Jan 2012 00:24: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 q040OAbL051180; Wed, 4 Jan 2012 00:24:10 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q040OAxX051178; Wed, 4 Jan 2012 00:24:10 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201201040024.q040OAxX051178@svn.freebsd.org> From: Rick Macklem Date: Wed, 4 Jan 2012 00:24: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: r229450 - in stable/8/sys: conf nfsclient 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, 04 Jan 2012 00:24:10 -0000 Author: rmacklem Date: Wed Jan 4 00:24:09 2012 New Revision: 229450 URL: http://svn.freebsd.org/changeset/base/229450 Log: MFC: r227690 The old NFS client will crash due to the reply being m_freem()'d twice if the server bogusly returns an error with the NFSERR_RETERR bit (bit 31) set. No actual NFS error has this bit set, but it seems that amd will sometimes do this. This patch makes sure the NFSERR_RETERR bit is cleared to avoid a crash. Modified: stable/8/sys/nfsclient/nfs_krpc.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/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/nfsclient/nfs_krpc.c ============================================================================== --- stable/8/sys/nfsclient/nfs_krpc.c Wed Jan 4 00:04:01 2012 (r229449) +++ stable/8/sys/nfsclient/nfs_krpc.c Wed Jan 4 00:24:09 2012 (r229450) @@ -540,6 +540,11 @@ tryagain: hz); goto tryagain; } + /* + * Make sure NFSERR_RETERR isn't bogusly set by a server + * such as amd. (No actual NFS error has bit 31 set.) + */ + error &= ~NFSERR_RETERR; /* * If the File Handle was stale, invalidate the lookup From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 00:51:06 2012 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 16C691065733; Wed, 4 Jan 2012 00:51:06 +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 00B788FC1A; Wed, 4 Jan 2012 00:51: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 q040p5Xe052031; Wed, 4 Jan 2012 00:51:05 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q040p5Hc052029; Wed, 4 Jan 2012 00:51:05 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201201040051.q040p5Hc052029@svn.freebsd.org> From: Rick Macklem Date: Wed, 4 Jan 2012 00:51:05 +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: r229451 - stable/7/sys/nfsclient 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, 04 Jan 2012 00:51:06 -0000 Author: rmacklem Date: Wed Jan 4 00:51:05 2012 New Revision: 229451 URL: http://svn.freebsd.org/changeset/base/229451 Log: MFC: r227690 The old NFS client will crash due to the reply being m_freem()'d twice if the server bogusly returns an error with the NFSERR_RETERR bit (bit 31) set. No actual NFS error has this bit set, but it seems that amd will sometimes do this. This patch makes sure the NFSERR_RETERR bit is cleared to avoid a crash. This is not exactly a merge, since the code is in sys/nfsclient/nfs_socket.c, which does not exist in head. Tested by: martin at lispworks.com PR: kern/153847 Modified: stable/7/sys/nfsclient/nfs_socket.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/nfsclient/nfs_socket.c ============================================================================== --- stable/7/sys/nfsclient/nfs_socket.c Wed Jan 4 00:24:09 2012 (r229450) +++ stable/7/sys/nfsclient/nfs_socket.c Wed Jan 4 00:51:05 2012 (r229451) @@ -1351,6 +1351,12 @@ wait_for_pinned_req: rep->r_xid = *xidp = txdr_unsigned(nfs_xid_gen()); goto tryagain; } + /* + * Make sure NFSERR_RETERR isn't bogusly set by a + * server such as amd. (No actual NFS error has bit 31 + * set.) + */ + error &= ~NFSERR_RETERR; /* * If the File Handle was stale, invalidate the From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 01:38:52 2012 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 8C4AE10656B1; Wed, 4 Jan 2012 01:38:52 +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 5C5A78FC14; Wed, 4 Jan 2012 01:38:52 +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 q041cq4R053521; Wed, 4 Jan 2012 01:38:52 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q041cqXi053518; Wed, 4 Jan 2012 01:38:52 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201040138.q041cqXi053518@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 4 Jan 2012 01:38:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229452 - stable/9/sys/dev/dc 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, 04 Jan 2012 01:38:52 -0000 Author: yongari Date: Wed Jan 4 01:38:52 2012 New Revision: 229452 URL: http://svn.freebsd.org/changeset/base/229452 Log: MFC r227675: Partially revert r218788. r218788 removed calling dc_setcfg() for !DC_IS_ADMTEK in dc_miibus_statchg(). This change broke link establishment of Intel 21143 with dcphy(4) where it stuck in "ability detect" state without completing auto-negotiation. Also nuke dc_if_media as it's not actually used. Modified: stable/9/sys/dev/dc/if_dc.c stable/9/sys/dev/dc/if_dcreg.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/dc/if_dc.c ============================================================================== --- stable/9/sys/dev/dc/if_dc.c Wed Jan 4 00:51:05 2012 (r229451) +++ stable/9/sys/dev/dc/if_dc.c Wed Jan 4 01:38:52 2012 (r229452) @@ -856,12 +856,11 @@ dc_miibus_statchg(device_t dev) return; ifm = &mii->mii_media; - if (DC_IS_DAVICOM(sc) && - IFM_SUBTYPE(ifm->ifm_media) == IFM_HPNA_1) { + if (DC_IS_DAVICOM(sc) && IFM_SUBTYPE(ifm->ifm_media) == IFM_HPNA_1) { dc_setcfg(sc, ifm->ifm_media); - sc->dc_if_media = ifm->ifm_media; return; - } + } else if (!DC_IS_ADMTEK(sc)) + dc_setcfg(sc, mii->mii_media_active); sc->dc_link = 0; if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == @@ -871,17 +870,8 @@ dc_miibus_statchg(device_t dev) case IFM_100_TX: sc->dc_link = 1; break; - default: - break; } } - if (sc->dc_link == 0) - return; - - sc->dc_if_media = mii->mii_media_active; - if (DC_IS_ADMTEK(sc)) - return; - dc_setcfg(sc, mii->mii_media_active); } /* Modified: stable/9/sys/dev/dc/if_dcreg.h ============================================================================== --- stable/9/sys/dev/dc/if_dcreg.h Wed Jan 4 00:51:05 2012 (r229451) +++ stable/9/sys/dev/dc/if_dcreg.h Wed Jan 4 01:38:52 2012 (r229452) @@ -760,7 +760,6 @@ struct dc_softc { int dc_pnic_rx_bug_save; unsigned char *dc_pnic_rx_buf; int dc_if_flags; - int dc_if_media; uint32_t dc_flags; uint32_t dc_txthresh; uint32_t dc_eaddr[2]; From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 01:45:53 2012 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 0738B106566C; Wed, 4 Jan 2012 01:45:53 +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 CB3D68FC15; Wed, 4 Jan 2012 01:45:52 +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 q041jqrv053784; Wed, 4 Jan 2012 01:45:52 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q041jqXb053781; Wed, 4 Jan 2012 01:45:52 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201040145.q041jqXb053781@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 4 Jan 2012 01:45:52 +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: r229453 - in stable/8/sys: conf dev/dc 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, 04 Jan 2012 01:45:53 -0000 Author: yongari Date: Wed Jan 4 01:45:52 2012 New Revision: 229453 URL: http://svn.freebsd.org/changeset/base/229453 Log: MFC r227675: Partially revert r218788. r218788 removed calling dc_setcfg() for !DC_IS_ADMTEK in dc_miibus_statchg(). This change broke link establishment of Intel 21143 with dcphy(4) where it stuck in "ability detect" state without completing auto-negotiation. Also nuke dc_if_media as it's not actually used. Modified: stable/8/sys/dev/dc/if_dc.c stable/8/sys/dev/dc/if_dcreg.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/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/dc/if_dc.c ============================================================================== --- stable/8/sys/dev/dc/if_dc.c Wed Jan 4 01:38:52 2012 (r229452) +++ stable/8/sys/dev/dc/if_dc.c Wed Jan 4 01:45:52 2012 (r229453) @@ -860,12 +860,11 @@ dc_miibus_statchg(device_t dev) return; ifm = &mii->mii_media; - if (DC_IS_DAVICOM(sc) && - IFM_SUBTYPE(ifm->ifm_media) == IFM_HPNA_1) { + if (DC_IS_DAVICOM(sc) && IFM_SUBTYPE(ifm->ifm_media) == IFM_HPNA_1) { dc_setcfg(sc, ifm->ifm_media); - sc->dc_if_media = ifm->ifm_media; return; - } + } else if (!DC_IS_ADMTEK(sc)) + dc_setcfg(sc, mii->mii_media_active); sc->dc_link = 0; if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == @@ -875,17 +874,8 @@ dc_miibus_statchg(device_t dev) case IFM_100_TX: sc->dc_link = 1; break; - default: - break; } } - if (sc->dc_link == 0) - return; - - sc->dc_if_media = mii->mii_media_active; - if (DC_IS_ADMTEK(sc)) - return; - dc_setcfg(sc, mii->mii_media_active); } /* Modified: stable/8/sys/dev/dc/if_dcreg.h ============================================================================== --- stable/8/sys/dev/dc/if_dcreg.h Wed Jan 4 01:38:52 2012 (r229452) +++ stable/8/sys/dev/dc/if_dcreg.h Wed Jan 4 01:45:52 2012 (r229453) @@ -760,7 +760,6 @@ struct dc_softc { int dc_pnic_rx_bug_save; unsigned char *dc_pnic_rx_buf; int dc_if_flags; - int dc_if_media; uint32_t dc_flags; uint32_t dc_txthresh; uint32_t dc_eaddr[2]; From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 01:53:54 2012 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 73830106564A; Wed, 4 Jan 2012 01:53:54 +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 442098FC14; Wed, 4 Jan 2012 01:53: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 q041rsTL054044; Wed, 4 Jan 2012 01:53:54 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q041rs3e054041; Wed, 4 Jan 2012 01:53:54 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201040153.q041rs3e054041@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 4 Jan 2012 01:53:54 +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: r229454 - stable/7/sys/dev/dc 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, 04 Jan 2012 01:53:54 -0000 Author: yongari Date: Wed Jan 4 01:53:53 2012 New Revision: 229454 URL: http://svn.freebsd.org/changeset/base/229454 Log: MFC r227675: Partially revert r218788. r218788 removed calling dc_setcfg() for !DC_IS_ADMTEK in dc_miibus_statchg(). This change broke link establishment of Intel 21143 with dcphy(4) where it stuck in "ability detect" state without completing auto-negotiation. Also nuke dc_if_media as it's not actually used. Modified: stable/7/sys/dev/dc/if_dc.c stable/7/sys/dev/dc/if_dcreg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/dc/if_dc.c ============================================================================== --- stable/7/sys/dev/dc/if_dc.c Wed Jan 4 01:45:52 2012 (r229453) +++ stable/7/sys/dev/dc/if_dc.c Wed Jan 4 01:53:53 2012 (r229454) @@ -861,12 +861,11 @@ dc_miibus_statchg(device_t dev) return; ifm = &mii->mii_media; - if (DC_IS_DAVICOM(sc) && - IFM_SUBTYPE(ifm->ifm_media) == IFM_HPNA_1) { + if (DC_IS_DAVICOM(sc) && IFM_SUBTYPE(ifm->ifm_media) == IFM_HPNA_1) { dc_setcfg(sc, ifm->ifm_media); - sc->dc_if_media = ifm->ifm_media; return; - } + } else if (!DC_IS_ADMTEK(sc)) + dc_setcfg(sc, mii->mii_media_active); sc->dc_link = 0; if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == @@ -876,17 +875,8 @@ dc_miibus_statchg(device_t dev) case IFM_100_TX: sc->dc_link = 1; break; - default: - break; } } - if (sc->dc_link == 0) - return; - - sc->dc_if_media = mii->mii_media_active; - if (DC_IS_ADMTEK(sc)) - return; - dc_setcfg(sc, mii->mii_media_active); } /* Modified: stable/7/sys/dev/dc/if_dcreg.h ============================================================================== --- stable/7/sys/dev/dc/if_dcreg.h Wed Jan 4 01:45:52 2012 (r229453) +++ stable/7/sys/dev/dc/if_dcreg.h Wed Jan 4 01:53:53 2012 (r229454) @@ -760,7 +760,6 @@ struct dc_softc { int dc_pnic_rx_bug_save; unsigned char *dc_pnic_rx_buf; int dc_if_flags; - int dc_if_media; uint32_t dc_flags; uint32_t dc_txthresh; uint32_t dc_eaddr[2]; From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 02:02:58 2012 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 B658D106566B; Wed, 4 Jan 2012 02:02:58 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A040F8FC08; Wed, 4 Jan 2012 02:02: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 q0422wMM054432; Wed, 4 Jan 2012 02:02:58 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0422w50054430; Wed, 4 Jan 2012 02:02:58 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201040202.q0422w50054430@svn.freebsd.org> From: Eitan Adler Date: Wed, 4 Jan 2012 02:02:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229456 - stable/9/usr.sbin/makefs 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, 04 Jan 2012 02:02:58 -0000 Author: eadler (ports committer) Date: Wed Jan 4 02:02:58 2012 New Revision: 229456 URL: http://svn.freebsd.org/changeset/base/229456 Log: MFC r226482 - remove device keyword from makefs manpage Approved by: gjb Modified: stable/9/usr.sbin/makefs/makefs.8 Directory Properties: stable/9/usr.sbin/makefs/ (props changed) Modified: stable/9/usr.sbin/makefs/makefs.8 ============================================================================== --- stable/9/usr.sbin/makefs/makefs.8 Wed Jan 4 02:01:27 2012 (r229455) +++ stable/9/usr.sbin/makefs/makefs.8 Wed Jan 4 02:02:58 2012 (r229456) @@ -134,8 +134,7 @@ and .Sy uname or .Sy uid , -.Sy device -(in the case of block or character devices), and +and .Sy link (in the case of symbolic links). If From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 02:03:10 2012 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 94B65106567C; Wed, 4 Jan 2012 02:03:10 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7F2568FC13; Wed, 4 Jan 2012 02:03: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 q0423AjR054478; Wed, 4 Jan 2012 02:03:10 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0423AMH054476; Wed, 4 Jan 2012 02:03:10 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201040203.q0423AMH054476@svn.freebsd.org> From: Eitan Adler Date: Wed, 4 Jan 2012 02:03: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: r229457 - stable/8/usr.sbin/makefs 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, 04 Jan 2012 02:03:10 -0000 Author: eadler (ports committer) Date: Wed Jan 4 02:03:10 2012 New Revision: 229457 URL: http://svn.freebsd.org/changeset/base/229457 Log: MFC r226482 - remove device keyword from makefs manpage Approved by: gjb Modified: stable/8/usr.sbin/makefs/makefs.8 Directory Properties: stable/8/usr.sbin/makefs/ (props changed) Modified: stable/8/usr.sbin/makefs/makefs.8 ============================================================================== --- stable/8/usr.sbin/makefs/makefs.8 Wed Jan 4 02:02:58 2012 (r229456) +++ stable/8/usr.sbin/makefs/makefs.8 Wed Jan 4 02:03:10 2012 (r229457) @@ -130,8 +130,7 @@ and .Sy uname or .Sy uid , -.Sy device -(in the case of block or character devices), and +and .Sy link (in the case of symbolic links). If From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 02:03:16 2012 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 05C8E1065808; Wed, 4 Jan 2012 02:03:16 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E27238FC0A; Wed, 4 Jan 2012 02:03: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 q0423Fxj054518; Wed, 4 Jan 2012 02:03:15 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0423FNI054516; Wed, 4 Jan 2012 02:03:15 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201040203.q0423FNI054516@svn.freebsd.org> From: Eitan Adler Date: Wed, 4 Jan 2012 02:03:15 +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: r229458 - stable/7/usr.sbin/makefs 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, 04 Jan 2012 02:03:16 -0000 Author: eadler (ports committer) Date: Wed Jan 4 02:03:15 2012 New Revision: 229458 URL: http://svn.freebsd.org/changeset/base/229458 Log: MFC r226482 - remove device keyword from makefs manpage Approved by: gjb Modified: stable/7/usr.sbin/makefs/makefs.8 Directory Properties: stable/7/usr.sbin/makefs/ (props changed) Modified: stable/7/usr.sbin/makefs/makefs.8 ============================================================================== --- stable/7/usr.sbin/makefs/makefs.8 Wed Jan 4 02:03:10 2012 (r229457) +++ stable/7/usr.sbin/makefs/makefs.8 Wed Jan 4 02:03:15 2012 (r229458) @@ -130,8 +130,7 @@ and .Sy uname or .Sy uid , -.Sy device -(in the case of block or character devices), and +and .Sy link (in the case of symbolic links). If From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 02:04:20 2012 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 C58AE106566B; Wed, 4 Jan 2012 02:04: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 B01A88FC19; Wed, 4 Jan 2012 02:04:20 +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 q0424KYO054583; Wed, 4 Jan 2012 02:04:20 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0424KwA054581; Wed, 4 Jan 2012 02:04:20 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201201040204.q0424KwA054581@svn.freebsd.org> From: Xin LI Date: Wed, 4 Jan 2012 02:04:20 +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: r229459 - head/lib/libc/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: Wed, 04 Jan 2012 02:04:20 -0000 Author: delphij Date: Wed Jan 4 02:04:20 2012 New Revision: 229459 URL: http://svn.freebsd.org/changeset/base/229459 Log: Document the fact that chroot(2) is no longer part of POSIX since SUSv3 and add a SECURITY CONSIDERATIONS section for recommended practices. Modified: head/lib/libc/sys/chroot.2 Modified: head/lib/libc/sys/chroot.2 ============================================================================== --- head/lib/libc/sys/chroot.2 Wed Jan 4 02:03:15 2012 (r229458) +++ head/lib/libc/sys/chroot.2 Wed Jan 4 02:04:20 2012 (r229459) @@ -28,7 +28,7 @@ .\" @(#)chroot.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd January 3, 2012 .Dt CHROOT 2 .Os .Sh NAME @@ -134,9 +134,27 @@ The .Fn chroot system call appeared in .Bx 4.2 . +It was marked as +.Dq legacy +in +.St -susv2 , +and was removed in subsequent standards. .Sh BUGS If the process is able to change its working directory to the target directory, but another access control check fails (such as a check for open directories, or a MAC check), it is possible that this system call may return an error, with the working directory of the process left changed. +.Sh SECURITY CONSIDERATIONS +The system have many hardcoded paths to files where it may load after +the process starts. +It is generally recommended to drop privileges immediately after a +successful +.Nm +call, +and restrict write access to a limited subtree of the +.Nm +root, +for instance, +setup the sandbox so that the sandboxed user will have no write +access to any well-known system directories. From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 03:37:42 2012 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 727D3106564A; Wed, 4 Jan 2012 03:37:42 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 57FED8FC08; Wed, 4 Jan 2012 03:37:42 +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 q043bgKn058161; Wed, 4 Jan 2012 03:37:42 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q043bf3T058131; Wed, 4 Jan 2012 03:37:41 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201040337.q043bf3T058131@svn.freebsd.org> From: Eitan Adler Date: Wed, 4 Jan 2012 03:37:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229461 - in stable/9: . lib/libc/gen lib/libelf lib/libipsec lib/libpmc lib/msun/man libexec/rtld-elf/amd64 libexec/rtld-elf/i386 sbin/geom/class/part sbin/init share/doc/psd/03.iosys ... 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, 04 Jan 2012 03:37:42 -0000 Author: eadler (ports committer) Date: Wed Jan 4 03:37:41 2012 New Revision: 229461 URL: http://svn.freebsd.org/changeset/base/229461 Log: MFC r227458, r226436: - change "is is" to "is" or "it is" - change "the the" to "the" - other typo fixes Approved by: lstewart Modified: stable/9/UPDATING (contents, props changed) stable/9/lib/libc/gen/getutxent.3 stable/9/lib/libelf/elf_update.3 stable/9/lib/libipsec/ipsec_strerror.3 stable/9/lib/libpmc/pmc.core.3 stable/9/lib/msun/man/ieee.3 stable/9/libexec/rtld-elf/amd64/rtld_start.S stable/9/libexec/rtld-elf/i386/rtld_start.S stable/9/sbin/geom/class/part/gpart.8 stable/9/sbin/init/init.8 stable/9/share/doc/psd/03.iosys/iosys stable/9/share/doc/psd/23.rpc/rpc.prog.ms stable/9/share/doc/psd/24.xdr/xdr.nts.ms stable/9/share/doc/psd/27.nfsrpc/nfs.rfc.ms stable/9/share/man/man4/dc.4 stable/9/share/man/man9/sleepqueue.9 stable/9/sys/boot/powerpc/boot1.chrp/generate-hfs.sh stable/9/sys/dev/ath/ath_dfs/null/dfs_null.c stable/9/sys/dev/bxe/bxe_link.c stable/9/sys/dev/e1000/e1000_82575.c stable/9/sys/dev/isp/DriverManual.txt stable/9/sys/dev/vxge/include/vxgehal-config.h stable/9/sys/dev/vxge/include/vxgehal-ll.h stable/9/sys/dev/vxge/vxgehal/vxgehal-ring.c stable/9/sys/mips/nlm/cms.c stable/9/sys/netinet/ipfw/dummynet.txt stable/9/sys/ofed/drivers/infiniband/ulp/sdp/Kconfig stable/9/usr.bin/compress/doc/NOTES stable/9/usr.sbin/pkg_install/lib/version.c Directory Properties: stable/9/lib/libc/gen/ (props changed) stable/9/lib/libelf/ (props changed) stable/9/lib/libipsec/ (props changed) stable/9/lib/libpmc/ (props changed) stable/9/lib/msun/man/ (props changed) stable/9/libexec/rtld-elf/ (props changed) stable/9/sbin/geom/ (props changed) stable/9/sbin/init/ (props changed) stable/9/share/doc/ (props changed) stable/9/share/man/ (props changed) stable/9/share/man/man4/ (props changed) stable/9/share/man/man9/ (props changed) stable/9/sys/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/usr.bin/compress/ (props changed) stable/9/usr.sbin/pkg_install/ (props changed) Modified: stable/9/UPDATING ============================================================================== --- stable/9/UPDATING Wed Jan 4 03:14:10 2012 (r229460) +++ stable/9/UPDATING Wed Jan 4 03:37:41 2012 (r229461) @@ -449,7 +449,7 @@ Items affecting the ports and packages s There's one kernel module for each firmware. Adding "device iwnfw" to the kernel configuration file means including all three firmware images inside the kernel. If you want to include just the one for - your wireless card, use the the devices iwn4965fw, iwn5000fw or + your wireless card, use the devices iwn4965fw, iwn5000fw or iwn5150fw. 20090926: Modified: stable/9/lib/libc/gen/getutxent.3 ============================================================================== --- stable/9/lib/libc/gen/getutxent.3 Wed Jan 4 03:14:10 2012 (r229460) +++ stable/9/lib/libc/gen/getutxent.3 Wed Jan 4 03:37:41 2012 (r229461) @@ -243,7 +243,7 @@ or .Dv LOGIN_PROCESS and whose .Fa ut_line -is equal to the the same field in +is equal to the same field in .Fa line . .Pp The Modified: stable/9/lib/libelf/elf_update.3 ============================================================================== --- stable/9/lib/libelf/elf_update.3 Wed Jan 4 03:14:10 2012 (r229460) +++ stable/9/lib/libelf/elf_update.3 Wed Jan 4 03:37:41 2012 (r229461) @@ -66,7 +66,7 @@ responsibility for the layout of the ELF If this flag is not set, the ELF library will compute the layout of the file from its associated section descriptors. .Pp -It is the application's responsibility to manage the the following +It is the application's responsibility to manage the following structure members in the ELF file: .Bl -tag -width indent .It "Executable Header" Modified: stable/9/lib/libipsec/ipsec_strerror.3 ============================================================================== --- stable/9/lib/libipsec/ipsec_strerror.3 Wed Jan 4 03:14:10 2012 (r229460) +++ stable/9/lib/libipsec/ipsec_strerror.3 Wed Jan 4 03:37:41 2012 (r229461) @@ -63,7 +63,7 @@ as an underlying function, calling .Xr strerror 3 after .Fn ipsec_strerror -would overwrite the the return value from +would overwrite the return value from .Fn ipsec_strerror and make it invalid. .\" Modified: stable/9/lib/libpmc/pmc.core.3 ============================================================================== --- stable/9/lib/libpmc/pmc.core.3 Wed Jan 4 03:14:10 2012 (r229460) +++ stable/9/lib/libpmc/pmc.core.3 Wed Jan 4 03:37:41 2012 (r229461) @@ -459,7 +459,7 @@ The number of instruction fetch misses i streaming buffers. .It Li ICache_Reads .Pq Event 80H , Umask 00H -The number of instruction fetches from the the instruction cache and +The number of instruction fetches from the instruction cache and streaming buffers counting both cacheable and un-cacheable fetches. .It Li IFU_Mem_Stall .Pq Event 86H , Umask 00H Modified: stable/9/lib/msun/man/ieee.3 ============================================================================== --- stable/9/lib/msun/man/ieee.3 Wed Jan 4 03:14:10 2012 (r229460) +++ stable/9/lib/msun/man/ieee.3 Wed Jan 4 03:37:41 2012 (r229461) @@ -183,7 +183,7 @@ Type name: .Bd -ragged -offset indent -compact On some architectures, .Vt long double -is the the same as +is the same as .Vt double . .Ed .Pp Modified: stable/9/libexec/rtld-elf/amd64/rtld_start.S ============================================================================== --- stable/9/libexec/rtld-elf/amd64/rtld_start.S Wed Jan 4 03:14:10 2012 (r229460) +++ stable/9/libexec/rtld-elf/amd64/rtld_start.S Wed Jan 4 03:37:41 2012 (r229461) @@ -56,7 +56,7 @@ * and (2) "reloff", the byte offset of the appropriate relocation entry * in the PLT relocation table. * - * We are careful to preserve all registers, even the the caller-save + * We are careful to preserve all registers, even the caller-save * registers. That is because this code may be invoked by low-level * assembly-language code that is not ABI-compliant. * Modified: stable/9/libexec/rtld-elf/i386/rtld_start.S ============================================================================== --- stable/9/libexec/rtld-elf/i386/rtld_start.S Wed Jan 4 03:14:10 2012 (r229460) +++ stable/9/libexec/rtld-elf/i386/rtld_start.S Wed Jan 4 03:37:41 2012 (r229461) @@ -63,7 +63,7 @@ * and (2) "reloff", the byte offset of the appropriate relocation entry * in the PLT relocation table. * - * We are careful to preserve all registers, even the the caller-save + * We are careful to preserve all registers, even the caller-save * registers. That is because this code may be invoked by low-level * assembly-language code that is not ABI-compliant. */ Modified: stable/9/sbin/geom/class/part/gpart.8 ============================================================================== --- stable/9/sbin/geom/class/part/gpart.8 Wed Jan 4 03:14:10 2012 (r229460) +++ stable/9/sbin/geom/class/part/gpart.8 Wed Jan 4 03:37:41 2012 (r229461) @@ -371,7 +371,7 @@ Modify a partition from geom and further identified by the .Fl i Ar index option. -Only the the type and/or label of the partition can be modified. +Only the type and/or label of the partition can be modified. To change the type of a partition, specify the new type with the .Fl t Ar type option. Modified: stable/9/sbin/init/init.8 ============================================================================== --- stable/9/sbin/init/init.8 Wed Jan 4 03:14:10 2012 (r229460) +++ stable/9/sbin/init/init.8 Wed Jan 4 03:37:41 2012 (r229461) @@ -147,7 +147,7 @@ When this shell dies, either because the user logged out or an abnormal termination occurred (a signal), .Nm login -records the logout in the the user accounting +records the logout in the user accounting database (see .Xr getutxent 3) and terminates. Modified: stable/9/share/doc/psd/03.iosys/iosys ============================================================================== --- stable/9/share/doc/psd/03.iosys/iosys Wed Jan 4 03:14:10 2012 (r229460) +++ stable/9/share/doc/psd/03.iosys/iosys Wed Jan 4 03:37:41 2012 (r229461) @@ -813,7 +813,7 @@ which have a separate argument which indicates read or write. .IP B_DONE 10 This bit is set -to 0 when a block is handed to the the device strategy +to 0 when a block is handed to the device strategy routine and is turned on when the operation completes, whether normally as the result of an error. It is also used as part of the return argument of Modified: stable/9/share/doc/psd/23.rpc/rpc.prog.ms ============================================================================== --- stable/9/share/doc/psd/23.rpc/rpc.prog.ms Wed Jan 4 03:14:10 2012 (r229460) +++ stable/9/share/doc/psd/23.rpc/rpc.prog.ms Wed Jan 4 03:37:41 2012 (r229461) @@ -317,7 +317,7 @@ look up the appropriate program, version in a manual, just as you look up the name of a memory allocator when you want to allocate memory. .LP -The simplest way of making remote procedure calls is with the the RPC +The simplest way of making remote procedure calls is with the RPC library routine .I callrpc() It has eight parameters. The first is the name of the remote server @@ -1105,7 +1105,7 @@ Note that, after being used, the charact .I svc_freeargs() .I svc_freeargs() will not attempt to free any memory if the variable indicating it -is NULL. For example, in the the routine +is NULL. For example, in the routine .I xdr_finalexample (), given earlier, if .I finalp->string Modified: stable/9/share/doc/psd/24.xdr/xdr.nts.ms ============================================================================== --- stable/9/share/doc/psd/24.xdr/xdr.nts.ms Wed Jan 4 03:14:10 2012 (r229460) +++ stable/9/share/doc/psd/24.xdr/xdr.nts.ms Wed Jan 4 03:37:41 2012 (r229461) @@ -721,7 +721,7 @@ it must not exceed .I maxlength . Next .I sp -is dereferenced; if the the value is +is dereferenced; if the value is .I NULL , then a string of the appropriate length is allocated and .I *sp Modified: stable/9/share/doc/psd/27.nfsrpc/nfs.rfc.ms ============================================================================== --- stable/9/share/doc/psd/27.nfsrpc/nfs.rfc.ms Wed Jan 4 03:14:10 2012 (r229460) +++ stable/9/share/doc/psd/27.nfsrpc/nfs.rfc.ms Wed Jan 4 03:37:41 2012 (r229461) @@ -961,7 +961,7 @@ call to get more entries starting at a given point in the directory. The special cookie zero (all bits zero) can be used to get the entries starting at the beginning of the directory. The "fileid" field should be the same number as the -"fileid" in the the attributes of the file. (See the +"fileid" in the attributes of the file. (See the .I "Basic Data Types" section.) The "eof" flag has a value of Modified: stable/9/share/man/man4/dc.4 ============================================================================== --- stable/9/share/man/man4/dc.4 Wed Jan 4 03:14:10 2012 (r229460) +++ stable/9/share/man/man4/dc.4 Wed Jan 4 03:37:41 2012 (r229461) @@ -55,7 +55,7 @@ if_dc_load="YES" The .Nm driver provides support for several PCI Fast Ethernet adapters and -embedded controllers based on the the DEC/Intel 21143 chipset and clones. +embedded controllers based on the DEC/Intel 21143 chipset and clones. .Pp All of supported chipsets have the same general register layout, DMA descriptor format and method of operation. Modified: stable/9/share/man/man9/sleepqueue.9 ============================================================================== --- stable/9/share/man/man9/sleepqueue.9 Wed Jan 4 03:14:10 2012 (r229460) +++ stable/9/share/man/man9/sleepqueue.9 Wed Jan 4 03:37:41 2012 (r229461) @@ -351,7 +351,7 @@ argument specifies the thread to awaken argument specifies the wait channel to awaken it from. If the thread .Fa td -is not blocked on the the wait channel +is not blocked on the wait channel .Fa wchan then this function will not do anything, even if the thread is asleep on a different wait channel. Modified: stable/9/sys/boot/powerpc/boot1.chrp/generate-hfs.sh ============================================================================== --- stable/9/sys/boot/powerpc/boot1.chrp/generate-hfs.sh Wed Jan 4 03:14:10 2012 (r229460) +++ stable/9/sys/boot/powerpc/boot1.chrp/generate-hfs.sh Wed Jan 4 03:37:41 2012 (r229461) @@ -29,7 +29,7 @@ hmkdir ppc hattrib -b ppc hcd ppc -# Make two dummy files for the the CHRP boot script and boot1 +# Make two dummy files for the CHRP boot script and boot1 echo 'Bootinfo START' | dd of=bootinfo.txt.tmp cbs=$CHRPBOOT_SIZE count=1 conv=block echo 'Boot1 START' | dd of=boot1.elf.tmp cbs=$BOOT1_SIZE count=1 conv=block Modified: stable/9/sys/dev/ath/ath_dfs/null/dfs_null.c ============================================================================== --- stable/9/sys/dev/ath/ath_dfs/null/dfs_null.c Wed Jan 4 03:14:10 2012 (r229460) +++ stable/9/sys/dev/ath/ath_dfs/null/dfs_null.c Wed Jan 4 03:37:41 2012 (r229461) @@ -128,7 +128,7 @@ ath_dfs_process_radar_event(struct ath_s } /* - * Determine whether the the DFS check task needs to be queued. + * Determine whether the DFS check task needs to be queued. * * This is called in the RX task when the current batch of packets * have been received. It will return whether there are any radar Modified: stable/9/sys/dev/bxe/bxe_link.c ============================================================================== --- stable/9/sys/dev/bxe/bxe_link.c Wed Jan 4 03:14:10 2012 (r229460) +++ stable/9/sys/dev/bxe/bxe_link.c Wed Jan 4 03:37:41 2012 (r229461) @@ -2586,7 +2586,7 @@ bxe_8726_read_sfp_module_eeprom(struct l if (byte_cnt > 16) { DBPRINT(sc, BXE_VERBOSE_PHY, - "Reading from eeprom is is limited to 0xf\n"); + "Reading from eeprom is limited to 0xf\n"); return (-EINVAL); } /* Set the read command byte count. */ @@ -2655,7 +2655,7 @@ bxe_8727_read_sfp_module_eeprom(struct l if (byte_cnt > 16) { DBPRINT(sc, BXE_VERBOSE_PHY, - "Reading from eeprom is is limited to 0xf\n"); + "Reading from eeprom is limited to 0xf\n"); return (-EINVAL); } Modified: stable/9/sys/dev/e1000/e1000_82575.c ============================================================================== --- stable/9/sys/dev/e1000/e1000_82575.c Wed Jan 4 03:14:10 2012 (r229460) +++ stable/9/sys/dev/e1000/e1000_82575.c Wed Jan 4 03:37:41 2012 (r229461) @@ -1983,7 +1983,7 @@ out: * e1000_reset_mdicnfg_82580 - Reset MDICNFG destination and com_mdio bits * @hw: pointer to the HW structure * - * This resets the the MDICNFG.Destination and MDICNFG.Com_MDIO bits based on + * This resets the MDICNFG.Destination and MDICNFG.Com_MDIO bits based on * the values found in the EEPROM. This addresses an issue in which these * bits are not restored from EEPROM after reset. **/ Modified: stable/9/sys/dev/isp/DriverManual.txt ============================================================================== --- stable/9/sys/dev/isp/DriverManual.txt Wed Jan 4 03:14:10 2012 (r229460) +++ stable/9/sys/dev/isp/DriverManual.txt Wed Jan 4 03:37:41 2012 (r229461) @@ -165,7 +165,7 @@ and saves the QLogic HBA from having to The QLogic HBA is an interrupting card, and when servicing an interrupt you really only have to check for either a mailbox interrupt or an -interrupt notification that the the response queue has an entry to +interrupt notification that the response queue has an entry to be dequeued. 4.3 Fibre Channel SCSI out of SCSI @@ -327,7 +327,7 @@ here in clarifying some of this. A succesful execution of isp_init will lead to the driver 'registering' itself with this platform's SCSI subsystem. One assumed action for this -is the registry of a function the the SCSI subsystem for this platform +is the registry of a function that the SCSI subsystem for this platform will call when it has a SCSI command to run. The platform specific module function that receives this will do whatever Modified: stable/9/sys/dev/vxge/include/vxgehal-config.h ============================================================================== --- stable/9/sys/dev/vxge/include/vxgehal-config.h Wed Jan 4 03:14:10 2012 (r229460) +++ stable/9/sys/dev/vxge/include/vxgehal-config.h Wed Jan 4 03:37:41 2012 (r229461) @@ -1665,7 +1665,7 @@ typedef struct vxge_hal_mrpcim_config_t * the interrupt is triggered. * @rtimer_event_sf: Restriction Timer Event Scale Factor. A scale factor that * is to be applied to the current event count before it is added - * to the restriction timer value when the the restriction timer + * to the restriction timer value when the restriction timer * is started. * The scale factor is applied as a right or left shift to multiply * or divide by the event count. The programmable values are as Modified: stable/9/sys/dev/vxge/include/vxgehal-ll.h ============================================================================== --- stable/9/sys/dev/vxge/include/vxgehal-ll.h Wed Jan 4 03:14:10 2012 (r229460) +++ stable/9/sys/dev/vxge/include/vxgehal-ll.h Wed Jan 4 03:37:41 2012 (r229461) @@ -1590,7 +1590,7 @@ vxge_hal_ring_rxd_post( * vxge_hal_ring_is_next_rxd_completed - Check if the next rxd is completed * @vpath_handle: Virtual Path handle. * - * Checks if the the _next_ completed descriptor is in host memory + * Checks if the _next_ completed descriptor is in host memory * * Returns: VXGE_HAL_OK - success. * VXGE_HAL_INF_NO_MORE_COMPLETED_DESCRIPTORS - No completed descriptors Modified: stable/9/sys/dev/vxge/vxgehal/vxgehal-ring.c ============================================================================== --- stable/9/sys/dev/vxge/vxgehal/vxgehal-ring.c Wed Jan 4 03:14:10 2012 (r229460) +++ stable/9/sys/dev/vxge/vxgehal/vxgehal-ring.c Wed Jan 4 03:37:41 2012 (r229461) @@ -1339,7 +1339,7 @@ vxge_hal_ring_rxd_post_post_db( * vxge_hal_ring_is_next_rxd_completed - Check if the next rxd is completed * @vpath_handle: Virtual Path handle. * - * Checks if the the _next_ completed descriptor is in host memory + * Checks if the _next_ completed descriptor is in host memory * * Returns: VXGE_HAL_OK - success. * VXGE_HAL_INF_NO_MORE_COMPLETED_DESCRIPTORS - No completed descriptors Modified: stable/9/sys/mips/nlm/cms.c ============================================================================== --- stable/9/sys/mips/nlm/cms.c Wed Jan 4 03:14:10 2012 (r229460) +++ stable/9/sys/mips/nlm/cms.c Wed Jan 4 03:37:41 2012 (r229461) @@ -82,7 +82,7 @@ static struct msgring_thread msgring_thr static struct proc *msgring_proc; /* all threads are under a proc */ /* - * The device drivers can register a handler for the the messages sent + * The device drivers can register a handler for the messages sent * from a station (corresponding to the device). */ struct tx_stn_handler { Modified: stable/9/sys/netinet/ipfw/dummynet.txt ============================================================================== --- stable/9/sys/netinet/ipfw/dummynet.txt Wed Jan 4 03:14:10 2012 (r229460) +++ stable/9/sys/netinet/ipfw/dummynet.txt Wed Jan 4 03:37:41 2012 (r229461) @@ -325,7 +325,7 @@ we do the following: dummynet_task() =============== -The dummynet_task() is the the main dummynet processing function and is +The dummynet_task() function is the main dummynet processing function and is called every tick. This function first calculate the new current time, then it checks if it is the time to wake up object from the system_heap comparing the current time and the key of the heap. Two types of object (really the Modified: stable/9/sys/ofed/drivers/infiniband/ulp/sdp/Kconfig ============================================================================== --- stable/9/sys/ofed/drivers/infiniband/ulp/sdp/Kconfig Wed Jan 4 03:14:10 2012 (r229460) +++ stable/9/sys/ofed/drivers/infiniband/ulp/sdp/Kconfig Wed Jan 4 03:37:41 2012 (r229461) @@ -21,7 +21,7 @@ config INFINIBAND_SDP_DEBUG_DATA bool "Sockets Direct Protocol data path debugging" depends on INFINIBAND_SDP_DEBUG ---help--- - This option compiles debugging code into the the data path + This option compiles debugging code into the data path of the SDP driver. The output can be turned on via the data_debug_level module parameter; however, even with output turned off, this debugging code will have some performance Modified: stable/9/usr.bin/compress/doc/NOTES ============================================================================== --- stable/9/usr.bin/compress/doc/NOTES Wed Jan 4 03:14:10 2012 (r229460) +++ stable/9/usr.bin/compress/doc/NOTES Wed Jan 4 03:37:41 2012 (r229461) @@ -51,7 +51,7 @@ comprehensive survey of an area which wi Until the dust clears, how you approach ideas which are patented depends on how paranoid you are of a legal onslaught. Arbitrary? Yes. But -the patent bar the the CCPA (Court of Customs and Patent Appeals) +the patent bar of the CCPA (Court of Customs and Patent Appeals) thanks you for any uncertainty as they, at least, stand to gain from any trouble. Modified: stable/9/usr.sbin/pkg_install/lib/version.c ============================================================================== --- stable/9/usr.sbin/pkg_install/lib/version.c Wed Jan 4 03:14:10 2012 (r229460) +++ stable/9/usr.sbin/pkg_install/lib/version.c Wed Jan 4 03:37:41 2012 (r229461) @@ -66,7 +66,7 @@ split_version(const char *pkgname, const if (pkgname == NULL) errx(2, "%s: Passed NULL pkgname.", __func__); - /* Look for the last '-' the the pkgname */ + /* Look for the last '-' in the pkgname */ ch = strrchr(pkgname, '-'); /* Cheat if we are just passed a version, not a valid package name */ versionstr = ch ? ch + 1 : pkgname; From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 03:49:42 2012 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 17BFE106566B; Wed, 4 Jan 2012 03:49:42 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 026668FC0A; Wed, 4 Jan 2012 03:49:42 +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 q043nfab058686; Wed, 4 Jan 2012 03:49:41 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q043nf8p058684; Wed, 4 Jan 2012 03:49:41 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <201201040349.q043nf8p058684@svn.freebsd.org> From: Takahashi Yoshihiro Date: Wed, 4 Jan 2012 03:49: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: r229462 - head/sys/boot/pc98/boot2 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, 04 Jan 2012 03:49:42 -0000 Author: nyan Date: Wed Jan 4 03:49:41 2012 New Revision: 229462 URL: http://svn.freebsd.org/changeset/base/229462 Log: Fix 230MB MO support. Submitted by: Kaho Toshikazu MFC after: 1 week Modified: head/sys/boot/pc98/boot2/boot1.S Modified: head/sys/boot/pc98/boot2/boot1.S ============================================================================== --- head/sys/boot/pc98/boot2/boot1.S Wed Jan 4 03:37:41 2012 (r229461) +++ head/sys/boot/pc98/boot2/boot1.S Wed Jan 4 03:49:41 2012 (r229462) @@ -219,7 +219,7 @@ read: xor %ax,%ax jc read_load and $0xff7f,%si /* SCSI MO */ mov %di,%cx - shr $16,%di + shr $16,%edi mov %di,%dx jmp read_load read_fd: or $0xd000,%si From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 03:54:30 2012 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 D2ED81065672; Wed, 4 Jan 2012 03:54:30 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BC39D8FC12; Wed, 4 Jan 2012 03:54:30 +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 q043sUtv058912; Wed, 4 Jan 2012 03:54:30 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q043sUPf058910; Wed, 4 Jan 2012 03:54:30 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <201201040354.q043sUPf058910@svn.freebsd.org> From: Takahashi Yoshihiro Date: Wed, 4 Jan 2012 03:54:30 +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: r229463 - head/sys/boot/pc98/libpc98 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, 04 Jan 2012 03:54:30 -0000 Author: nyan Date: Wed Jan 4 03:54:30 2012 New Revision: 229463 URL: http://svn.freebsd.org/changeset/base/229463 Log: MFi386: revision 229435 Add special loader environment variables 'comconsole_port' and 'comconsole_pcidev'. MFC after: 2 weeks Modified: head/sys/boot/pc98/libpc98/comconsole.c Modified: head/sys/boot/pc98/libpc98/comconsole.c ============================================================================== --- head/sys/boot/pc98/libpc98/comconsole.c Wed Jan 4 03:49:41 2012 (r229462) +++ head/sys/boot/pc98/libpc98/comconsole.c Wed Jan 4 03:54:30 2012 (r229463) @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "libi386.h" #define COMC_FMT 0x3 /* 8N1 */ @@ -49,14 +50,23 @@ static int comc_init(int arg); static void comc_putchar(int c); static int comc_getchar(void); static int comc_getspeed(void); +static void set_hw_console_hint(void); static int comc_ischar(void); -static int comc_parsespeed(const char *string); -static void comc_setup(int speed); +static int comc_parseint(const char *string); +static uint32_t comc_parse_pcidev(const char *string); +static int comc_pcidev_set(struct env_var *ev, int flags, + const void *value); +static int comc_pcidev_handle(uint32_t locator); +static int comc_port_set(struct env_var *ev, int flags, + const void *value); +static void comc_setup(int speed, int port); static int comc_speed_set(struct env_var *ev, int flags, const void *value); static int comc_started; static int comc_curspeed; +static int comc_port = COMPORT; +static uint32_t comc_locator; struct console comconsole = { "comconsole", @@ -72,9 +82,10 @@ struct console comconsole = { static void comc_probe(struct console *cp) { - char speedbuf[16]; - char *cons, *speedenv; - int speed; + char intbuf[16]; + char *cons, *env; + int speed, port; + uint32_t locator; /* XXX check the BIOS equipment list? */ cp->c_flags |= (C_PRESENTIN | C_PRESENTOUT); @@ -90,16 +101,40 @@ comc_probe(struct console *cp) getenv("boot_multicons") != NULL) { comc_curspeed = comc_getspeed(); } - speedenv = getenv("comconsole_speed"); - if (speedenv != NULL) { - speed = comc_parsespeed(speedenv); + + env = getenv("comconsole_speed"); + if (env != NULL) { + speed = comc_parseint(env); if (speed > 0) comc_curspeed = speed; } - sprintf(speedbuf, "%d", comc_curspeed); + sprintf(intbuf, "%d", comc_curspeed); unsetenv("comconsole_speed"); - env_setenv("comconsole_speed", EV_VOLATILE, speedbuf, comc_speed_set, + env_setenv("comconsole_speed", EV_VOLATILE, intbuf, comc_speed_set, + env_nounset); + + env = getenv("comconsole_port"); + if (env != NULL) { + port = comc_parseint(env); + if (port > 0) + comc_port = port; + } + + sprintf(intbuf, "%d", comc_port); + unsetenv("comconsole_port"); + env_setenv("comconsole_port", EV_VOLATILE, intbuf, comc_port_set, + env_nounset); + + env = getenv("comconsole_pcidev"); + if (env != NULL) { + locator = comc_parse_pcidev(env); + if (locator != 0) + comc_pcidev_handle(locator); + } + + unsetenv("comconsole_pcidev"); + env_setenv("comconsole_pcidev", EV_VOLATILE, env, comc_pcidev_set, env_nounset); } } @@ -111,7 +146,7 @@ comc_init(int arg) return 0; comc_started = 1; - comc_setup(comc_curspeed); + comc_setup(comc_curspeed, comc_port); return(0); } @@ -122,8 +157,8 @@ comc_putchar(int c) int wait; for (wait = COMC_TXWAIT; wait > 0; wait--) - if (inb(COMPORT + com_lsr) & LSR_TXRDY) { - outb(COMPORT + com_data, (u_char)c); + if (inb(comc_port + com_lsr) & LSR_TXRDY) { + outb(comc_port + com_data, (u_char)c); break; } } @@ -131,13 +166,13 @@ comc_putchar(int c) static int comc_getchar(void) { - return(comc_ischar() ? inb(COMPORT + com_data) : -1); + return(comc_ischar() ? inb(comc_port + com_data) : -1); } static int comc_ischar(void) { - return(inb(COMPORT + com_lsr) & LSR_RXRDY); + return(inb(comc_port + com_lsr) & LSR_RXRDY); } static int @@ -145,13 +180,33 @@ comc_speed_set(struct env_var *ev, int f { int speed; - if (value == NULL || (speed = comc_parsespeed(value)) <= 0) { + if (value == NULL || (speed = comc_parseint(value)) <= 0) { printf("Invalid speed\n"); return (CMD_ERROR); } if (comc_started && comc_curspeed != speed) - comc_setup(speed); + comc_setup(speed, comc_port); + + env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); + + return (CMD_OK); +} + +static int +comc_port_set(struct env_var *ev, int flags, const void *value) +{ + int port; + + if (value == NULL || (port = comc_parseint(value)) <= 0) { + printf("Invalid port\n"); + return (CMD_ERROR); + } + + if (comc_started && comc_port != port) { + comc_setup(comc_curspeed, port); + set_hw_console_hint(); + } env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); @@ -159,24 +214,126 @@ comc_speed_set(struct env_var *ev, int f } static void -comc_setup(int speed) +set_hw_console_hint(void) +{ + char intbuf[64]; + + unsetenv("hw.uart.console"); + sprintf(intbuf, "io:%d,br:%d", comc_port, comc_curspeed); + env_setenv("hw.uart.console", EV_VOLATILE, intbuf, + env_noset, env_nounset); +} + +/* + * Input: bus:dev:func[:bar]. If bar is not specified, it is 0x10. + * Output: bar[24:16] bus[15:8] dev[7:3] func[2:0] + */ +static uint32_t +comc_parse_pcidev(const char *string) +{ + char *p, *p1; + uint8_t bus, dev, func, bar; + uint32_t locator; + int pres; + + pres = strtol(string, &p, 0); + if (p == string || *p != ':' || pres < 0 ) + return (0); + bus = pres; + p1 = ++p; + + pres = strtol(p1, &p, 0); + if (p == string || *p != ':' || pres < 0 ) + return (0); + dev = pres; + p1 = ++p; + + pres = strtol(p1, &p, 0); + if (p == string || (*p != ':' && *p != '\0') || pres < 0 ) + return (0); + func = pres; + + if (*p == ':') { + p1 = ++p; + pres = strtol(p1, &p, 0); + if (p == string || *p != '\0' || pres <= 0 ) + return (0); + bar = pres; + } else + bar = 0x10; + + locator = (bar << 16) | biospci_locator(bus, dev, func); + return (locator); +} + +static int +comc_pcidev_handle(uint32_t locator) +{ + char intbuf[64]; + uint32_t port; + + if (biospci_read_config(locator & 0xffff, + (locator & 0xff0000) >> 16, 2, &port) == -1) { + printf("Cannot read bar at 0x%x\n", locator); + return (CMD_ERROR); + } + if (!PCI_BAR_IO(port)) { + printf("Memory bar at 0x%x\n", locator); + return (CMD_ERROR); + } + port &= PCIM_BAR_IO_BASE; + + sprintf(intbuf, "%d", port); + unsetenv("comconsole_port"); + env_setenv("comconsole_port", EV_VOLATILE, intbuf, + comc_port_set, env_nounset); + + comc_setup(comc_curspeed, port); + set_hw_console_hint(); + comc_locator = locator; + + return (CMD_OK); +} + +static int +comc_pcidev_set(struct env_var *ev, int flags, const void *value) +{ + uint32_t locator; + int error; + + if (value == NULL || (locator = comc_parse_pcidev(value)) <= 0) { + printf("Invalid pcidev\n"); + return (CMD_ERROR); + } + if (comc_started && comc_locator != locator) { + error = comc_pcidev_handle(locator); + if (error != CMD_OK) + return (error); + } + env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); + return (CMD_OK); +} + +static void +comc_setup(int speed, int port) { comc_curspeed = speed; + comc_port = port; - outb(COMPORT + com_cfcr, CFCR_DLAB | COMC_FMT); - outb(COMPORT + com_dlbl, COMC_BPS(speed) & 0xff); - outb(COMPORT + com_dlbh, COMC_BPS(speed) >> 8); - outb(COMPORT + com_cfcr, COMC_FMT); - outb(COMPORT + com_mcr, MCR_RTS | MCR_DTR); + outb(comc_port + com_cfcr, CFCR_DLAB | COMC_FMT); + outb(comc_port + com_dlbl, COMC_BPS(speed) & 0xff); + outb(comc_port + com_dlbh, COMC_BPS(speed) >> 8); + outb(comc_port + com_cfcr, COMC_FMT); + outb(comc_port + com_mcr, MCR_RTS | MCR_DTR); do - inb(COMPORT + com_data); - while (inb(COMPORT + com_lsr) & LSR_RXRDY); + inb(comc_port + com_data); + while (inb(comc_port + com_lsr) & LSR_RXRDY); } static int -comc_parsespeed(const char *speedstr) +comc_parseint(const char *speedstr) { char *p; int speed; @@ -196,13 +353,13 @@ comc_getspeed(void) u_char dlbl; u_char cfcr; - cfcr = inb(COMPORT + com_cfcr); - outb(COMPORT + com_cfcr, CFCR_DLAB | cfcr); + cfcr = inb(comc_port + com_cfcr); + outb(comc_port + com_cfcr, CFCR_DLAB | cfcr); - dlbl = inb(COMPORT + com_dlbl); - dlbh = inb(COMPORT + com_dlbh); + dlbl = inb(comc_port + com_dlbl); + dlbh = inb(comc_port + com_dlbh); - outb(COMPORT + com_cfcr, cfcr); + outb(comc_port + com_cfcr, cfcr); divisor = dlbh << 8 | dlbl; From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 04:17:03 2012 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 A9A20106566C; Wed, 4 Jan 2012 04:17:03 +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 93F838FC0A; Wed, 4 Jan 2012 04:17:03 +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 q044H3x0060133; Wed, 4 Jan 2012 04:17:03 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q044H3YP060131; Wed, 4 Jan 2012 04:17:03 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201201040417.q044H3YP060131@svn.freebsd.org> From: Adrian Chadd Date: Wed, 4 Jan 2012 04:17:03 +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: r229464 - head/sys/dev/flash 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, 04 Jan 2012 04:17:03 -0000 Author: adrian Date: Wed Jan 4 04:17:03 2012 New Revision: 229464 URL: http://svn.freebsd.org/changeset/base/229464 Log: Add a couple more SPI flash device IDs found in commercial consumer wireless kit. Submitted by: Stefan Bethke Modified: head/sys/dev/flash/mx25l.c Modified: head/sys/dev/flash/mx25l.c ============================================================================== --- head/sys/dev/flash/mx25l.c Wed Jan 4 03:54:30 2012 (r229463) +++ head/sys/dev/flash/mx25l.c Wed Jan 4 04:17:03 2012 (r229464) @@ -101,7 +101,9 @@ struct mx25l_flash_ident flash_devices[] { "mx25ll64", 0xc2, 0x2017, 64 * 1024, 128, FL_NONE }, { "mx25ll128", 0xc2, 0x2018, 64 * 1024, 256, FL_ERASE_4K | FL_ERASE_32K }, { "s25fl128", 0x01, 0x2018, 64 * 1024, 256, FL_NONE }, + { "s25s1032", 0x01, 0x0215, 64 * 1024, 64, FL_NONE }, { "s25sl064a", 0x01, 0x0216, 64 * 1024, 128, FL_NONE }, + { "w25q64bv", 0xef, 0x4017, 64 * 1024, 128, FL_ERASE_4K }, }; static uint8_t From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 07:01:23 2012 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 E4700106566B; Wed, 4 Jan 2012 07:01:23 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CEC108FC13; Wed, 4 Jan 2012 07:01: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 q0471Nkf065162; Wed, 4 Jan 2012 07:01:23 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0471NUl065160; Wed, 4 Jan 2012 07:01:23 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201201040701.q0471NUl065160@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 4 Jan 2012 07:01:23 +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: r229465 - head/sys/netinet6 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, 04 Jan 2012 07:01:24 -0000 Author: glebius Date: Wed Jan 4 07:01:23 2012 New Revision: 229465 URL: http://svn.freebsd.org/changeset/base/229465 Log: Use correct locking when traversing interface address list. Reviewed by: bz Modified: head/sys/netinet6/in6.c Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Wed Jan 4 04:17:03 2012 (r229464) +++ head/sys/netinet6/in6.c Wed Jan 4 07:01:23 2012 (r229465) @@ -2244,9 +2244,7 @@ in6_ifawithifp(struct ifnet *ifp, struct IF_ADDR_UNLOCK(ifp); return (besta); } - IF_ADDR_UNLOCK(ifp); - IN6_IFADDR_RLOCK(); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; @@ -2264,10 +2262,10 @@ in6_ifawithifp(struct ifnet *ifp, struct if (ifa != NULL) ifa_ref(ifa); - IN6_IFADDR_RUNLOCK(); + IF_ADDR_UNLOCK(ifp); return (struct in6_ifaddr *)ifa; } - IN6_IFADDR_RUNLOCK(); + IF_ADDR_UNLOCK(ifp); /* use the last-resort values, that are, deprecated addresses */ if (dep[0]) From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 07:04:44 2012 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 83973106566B; Wed, 4 Jan 2012 07:04:44 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6E5478FC08; Wed, 4 Jan 2012 07:04: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 q0474iRc065301; Wed, 4 Jan 2012 07:04:44 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0474iIe065299; Wed, 4 Jan 2012 07:04:44 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201201040704.q0474iIe065299@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 4 Jan 2012 07:04: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: r229466 - head/usr.sbin/mptable 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, 04 Jan 2012 07:04:44 -0000 Author: pjd Date: Wed Jan 4 07:04:43 2012 New Revision: 229466 URL: http://svn.freebsd.org/changeset/base/229466 Log: Add an missing argument to open(2). If O_CREAT flag is specified, file permission has to be specified as well. Modified: head/usr.sbin/mptable/mptable.c Modified: head/usr.sbin/mptable/mptable.c ============================================================================== --- head/usr.sbin/mptable/mptable.c Wed Jan 4 07:01:23 2012 (r229465) +++ head/usr.sbin/mptable/mptable.c Wed Jan 4 07:04:43 2012 (r229466) @@ -828,7 +828,7 @@ MPConfigTableHeader( u_int32_t pap ) int ofd; u_char dumpbuf[ 4096 ]; - ofd = open( "/tmp/mpdump", O_CREAT | O_RDWR ); + ofd = open( "/tmp/mpdump", O_CREAT | O_RDWR, 0666 ); seekEntry( paddr ); readEntry( dumpbuf, 1024 ); write( ofd, dumpbuf, 1024 ); From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 07:21:37 2012 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 E7AE61065672; Wed, 4 Jan 2012 07:21:37 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D2C378FC12; Wed, 4 Jan 2012 07:21: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 q047LbXO065868; Wed, 4 Jan 2012 07:21:37 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q047LbnF065866; Wed, 4 Jan 2012 07:21:37 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201201040721.q047LbnF065866@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 4 Jan 2012 07:21: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: r229467 - head/usr.sbin/uhsoctl 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, 04 Jan 2012 07:21:38 -0000 Author: pjd Date: Wed Jan 4 07:21:37 2012 New Revision: 229467 URL: http://svn.freebsd.org/changeset/base/229467 Log: Add an missing argument to open(2). If O_CREAT flag is specified, file permission has to be specified as well. Modified: head/usr.sbin/uhsoctl/uhsoctl.c Modified: head/usr.sbin/uhsoctl/uhsoctl.c ============================================================================== --- head/usr.sbin/uhsoctl/uhsoctl.c Wed Jan 4 07:04:43 2012 (r229466) +++ head/usr.sbin/uhsoctl/uhsoctl.c Wed Jan 4 07:21:37 2012 (r229467) @@ -455,7 +455,7 @@ set_nameservers(struct ctx *ctx, const c free(ctx->ns); } - fd = open(respath, O_RDWR | O_CREAT | O_NOFOLLOW); + fd = open(respath, O_RDWR | O_CREAT | O_NOFOLLOW, 0666); if (fd < 0) return (-1); From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 07:25:11 2012 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 58886106566C; Wed, 4 Jan 2012 07:25:11 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 439D18FC0A; Wed, 4 Jan 2012 07:25: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 q047PB33066020; Wed, 4 Jan 2012 07:25:11 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q047PBgS066018; Wed, 4 Jan 2012 07:25:11 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201201040725.q047PBgS066018@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 4 Jan 2012 07:25: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: r229468 - head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/io 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, 04 Jan 2012 07:25:11 -0000 Author: pjd Date: Wed Jan 4 07:25:10 2012 New Revision: 229468 URL: http://svn.freebsd.org/changeset/base/229468 Log: Add missing file permission to open(O_CREAT) call. This doesn't really matter here, as we open /dev/null for test purposes, but it is useful for consistency and further grepping for such bugs. Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/io/tst.fds.c Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/io/tst.fds.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/io/tst.fds.c Wed Jan 4 07:21:37 2012 (r229467) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/io/tst.fds.c Wed Jan 4 07:25:10 2012 (r229468) @@ -82,7 +82,7 @@ main(int argc, char *argv[]) fds[n++] = open(file, O_RDWR | O_APPEND | O_CREAT | O_DSYNC | O_LARGEFILE | O_NOCTTY | O_NONBLOCK | O_NDELAY | O_RSYNC | - O_SYNC | O_TRUNC | O_XATTR); + O_SYNC | O_TRUNC | O_XATTR, 0666); fds[n++] = open(file, O_RDWR); (void) lseek(fds[n - 1], 123, SEEK_SET); From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 07:33:07 2012 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 8834B106566C; Wed, 4 Jan 2012 07:33:07 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7263C8FC17; Wed, 4 Jan 2012 07:33: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 q047X7jM066301; Wed, 4 Jan 2012 07:33:07 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q047X7wK066297; Wed, 4 Jan 2012 07:33:07 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201201040733.q047X7wK066297@svn.freebsd.org> From: Fabien Thomas Date: Wed, 4 Jan 2012 07:33: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: r229469 - head/sys/dev/hwpmc 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, 04 Jan 2012 07:33:07 -0000 Author: fabient Date: Wed Jan 4 07:33:06 2012 New Revision: 229469 URL: http://svn.freebsd.org/changeset/base/229469 Log: Add missing MSR programming for some events. Submitted by: Davide Italiano MFC after: 3 days Modified: head/sys/dev/hwpmc/hwpmc_uncore.c head/sys/dev/hwpmc/hwpmc_uncore.h head/sys/dev/hwpmc/pmc_events.h Modified: head/sys/dev/hwpmc/hwpmc_uncore.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_uncore.c Wed Jan 4 07:25:10 2012 (r229468) +++ head/sys/dev/hwpmc/hwpmc_uncore.c Wed Jan 4 07:33:06 2012 (r229469) @@ -545,8 +545,14 @@ static struct ucp_event_descr ucp_events UCPDESCR(0CH_01H, 0x0C, 0x01, UCP_F_FM | UCP_F_WM), UCPDESCR(0CH_02H, 0x0C, 0x02, UCP_F_FM | UCP_F_WM), - UCPDESCR(0CH_04H, 0x0C, 0x04, UCP_F_FM | UCP_F_WM), - UCPDESCR(0CH_08H, 0x0C, 0x08, UCP_F_FM | UCP_F_WM), + UCPDESCR(0CH_04H_E, 0x0C, 0x04, UCP_F_FM | UCP_F_WM), + UCPDESCR(0CH_04H_F, 0x0C, 0x04, UCP_F_FM | UCP_F_WM), + UCPDESCR(0CH_04H_M, 0x0C, 0x04, UCP_F_FM | UCP_F_WM), + UCPDESCR(0CH_04H_S, 0x0C, 0x04, UCP_F_FM | UCP_F_WM), + UCPDESCR(0CH_08H_E, 0x0C, 0x08, UCP_F_FM | UCP_F_WM), + UCPDESCR(0CH_08H_F, 0x0C, 0x08, UCP_F_FM | UCP_F_WM), + UCPDESCR(0CH_08H_M, 0x0C, 0x08, UCP_F_FM | UCP_F_WM), + UCPDESCR(0CH_08H_S, 0x0C, 0x08, UCP_F_FM | UCP_F_WM), UCPDESCR(20H_01H, 0x20, 0x01, UCP_F_FM | UCP_F_I7 | UCP_F_WM), UCPDESCR(20H_02H, 0x20, 0x02, UCP_F_FM | UCP_F_I7 | UCP_F_WM), @@ -965,6 +971,36 @@ ucp_start_pmc(int cpu, int ri) PMCDBG(MDP,STA,2, "ucp-start/2 cpu=%d ri=%d evselmsr=0x%x evsel=0x%x", cpu, ri, UCP_EVSEL0 + ri, evsel); + /* Event specific configuration. */ + switch (pm->pm_event) { + case PMC_EV_UCP_EVENT_0CH_04H_E: + wrmsr(MSR_GQ_SNOOP_MESF,0x2); + break; + case PMC_EV_UCP_EVENT_0CH_04H_F: + wrmsr(MSR_GQ_SNOOP_MESF,0x8); + break; + case PMC_EV_UCP_EVENT_0CH_04H_M: + wrmsr(MSR_GQ_SNOOP_MESF,0x1); + break; + case PMC_EV_UCP_EVENT_0CH_04H_S: + wrmsr(MSR_GQ_SNOOP_MESF,0x4); + break; + case PMC_EV_UCP_EVENT_0CH_08H_E: + wrmsr(MSR_GQ_SNOOP_MESF,0x2); + break; + case PMC_EV_UCP_EVENT_0CH_08H_F: + wrmsr(MSR_GQ_SNOOP_MESF,0x8); + break; + case PMC_EV_UCP_EVENT_0CH_08H_M: + wrmsr(MSR_GQ_SNOOP_MESF,0x1); + break; + case PMC_EV_UCP_EVENT_0CH_08H_S: + wrmsr(MSR_GQ_SNOOP_MESF,0x4); + break; + default: + break; + } + wrmsr(UCP_EVSEL0 + ri, evsel); do { Modified: head/sys/dev/hwpmc/hwpmc_uncore.h ============================================================================== --- head/sys/dev/hwpmc/hwpmc_uncore.h Wed Jan 4 07:25:10 2012 (r229468) +++ head/sys/dev/hwpmc/hwpmc_uncore.h Wed Jan 4 07:33:06 2012 (r229469) @@ -87,11 +87,18 @@ struct pmc_md_ucp_op_pmcallocate { #define UC_GLOBAL_CTRL 0x391 #define UC_GLOBAL_OVF_CTRL 0x393 + #define UC_GLOBAL_STATUS_FLAG_CLRCHG (1ULL << 63) #define UC_GLOBAL_STATUS_FLAG_OVFPMI (1ULL << 61) #define UC_GLOBAL_CTRL_FLAG_FRZ (1ULL << 63) #define UC_GLOBAL_CTRL_FLAG_ENPMICORE0 (1ULL << 48) +/* + * Model specific registers. + */ + +#define MSR_GQ_SNOOP_MESF 0x301 + struct pmc_md_ucf_pmc { uint64_t pm_ucf_ctrl; }; Modified: head/sys/dev/hwpmc/pmc_events.h ============================================================================== --- head/sys/dev/hwpmc/pmc_events.h Wed Jan 4 07:25:10 2012 (r229468) +++ head/sys/dev/hwpmc/pmc_events.h Wed Jan 4 07:33:06 2012 (r229469) @@ -2388,8 +2388,14 @@ __PMC_EV(UCP, EVENT_0BH_10H) \ __PMC_EV(UCP, EVENT_0BH_1FH) \ __PMC_EV(UCP, EVENT_0CH_01H) \ __PMC_EV(UCP, EVENT_0CH_02H) \ -__PMC_EV(UCP, EVENT_0CH_04H) \ -__PMC_EV(UCP, EVENT_0CH_08H) \ +__PMC_EV(UCP, EVENT_0CH_04H_E) \ +__PMC_EV(UCP, EVENT_0CH_04H_F) \ +__PMC_EV(UCP, EVENT_0CH_04H_M) \ +__PMC_EV(UCP, EVENT_0CH_04H_S) \ +__PMC_EV(UCP, EVENT_0CH_08H_E) \ +__PMC_EV(UCP, EVENT_0CH_08H_F) \ +__PMC_EV(UCP, EVENT_0CH_08H_M) \ +__PMC_EV(UCP, EVENT_0CH_08H_S) \ __PMC_EV(UCP, EVENT_20H_01H) \ __PMC_EV(UCP, EVENT_20H_02H) \ __PMC_EV(UCP, EVENT_20H_04H) \ @@ -2789,8 +2795,14 @@ __PMC_EV_ALIAS("L3_LINES_OUT.F_STATE", U __PMC_EV_ALIAS("L3_LINES_OUT.ANY", UCP_EVENT_0BH_1FH) \ __PMC_EV_ALIAS("GQ_SNOOP.GOTO_S", UCP_EVENT_0CH_01H) \ __PMC_EV_ALIAS("GQ_SNOOP.GOTO_I", UCP_EVENT_0CH_02H) \ -__PMC_EV_ALIAS("GQ_SNOOP.GOTO_S_HIT", UCP_EVENT_0CH_04H) \ -__PMC_EV_ALIAS("GQ_SNOOP.GOTO_I_HIT", UCP_EVENT_0CH_08H) \ +__PMC_EV_ALIAS("GQ_SNOOP.GOTO_S_HIT_E", UCP_EVENT_0CH_04H_E) \ +__PMC_EV_ALIAS("GQ_SNOOP.GOTO_S_HIT_F", UCP_EVENT_0CH_04H_F) \ +__PMC_EV_ALIAS("GQ_SNOOP.GOTO_S_HIT_M", UCP_EVENT_0CH_04H_M) \ +__PMC_EV_ALIAS("GQ_SNOOP.GOTO_S_HIT_S", UCP_EVENT_0CH_04H_S) \ +__PMC_EV_ALIAS("GQ_SNOOP.GOTO_I_HIT_E", UCP_EVENT_0CH_08H_E) \ +__PMC_EV_ALIAS("GQ_SNOOP.GOTO_I_HIT_F", UCP_EVENT_0CH_08H_F) \ +__PMC_EV_ALIAS("GQ_SNOOP.GOTO_I_HIT_M", UCP_EVENT_0CH_08H_M) \ +__PMC_EV_ALIAS("GQ_SNOOP.GOTO_I_HIT_S", UCP_EVENT_0CH_08H_S) \ __PMC_EV_ALIAS("QHL_REQUESTS.IOH_READS", UCP_EVENT_20H_01H) \ __PMC_EV_ALIAS("QHL_REQUESTS.IOH_WRITES", UCP_EVENT_20H_02H) \ __PMC_EV_ALIAS("QHL_REQUESTS.REMOTE_READS", UCP_EVENT_20H_04H) \ From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 07:58:37 2012 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 40D02106564A; Wed, 4 Jan 2012 07:58:37 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 289EE8FC08; Wed, 4 Jan 2012 07:58: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 q047wbOl067078; Wed, 4 Jan 2012 07:58:37 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q047waQi067074; Wed, 4 Jan 2012 07:58:36 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201201040758.q047waQi067074@svn.freebsd.org> From: Fabien Thomas Date: Wed, 4 Jan 2012 07:58: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: r229470 - in head: lib/libpmc sys/dev/hwpmc 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, 04 Jan 2012 07:58:37 -0000 Author: fabient Date: Wed Jan 4 07:58:36 2012 New Revision: 229470 URL: http://svn.freebsd.org/changeset/base/229470 Log: Update PMC events from October 2011 Intel documentation. Submitted by: Davide Italiano MFC after: 3 days Modified: head/lib/libpmc/pmc.corei7.3 head/sys/dev/hwpmc/hwpmc_core.c head/sys/dev/hwpmc/pmc_events.h Modified: head/lib/libpmc/pmc.corei7.3 ============================================================================== --- head/lib/libpmc/pmc.corei7.3 Wed Jan 4 07:33:06 2012 (r229469) +++ head/lib/libpmc/pmc.corei7.3 Wed Jan 4 07:58:36 2012 (r229470) @@ -200,10 +200,6 @@ Number of cache load STLB hits .Pq Event 08H , Umask 20H Number of DTLB cache load misses where the low part of the linear to physical address translation was missed. -.It Li DTLB_LOAD_MISSES.PDP_MISS -.Pq Event 08H , Umask 40H -Number of DTLB cache load misses where the high part of the linear to -physical address translation was missed. .It Li DTLB_LOAD_MISSES.LARGE_WALK_COMPLETED .Pq Event 08H , Umask 80H Counts number of completed large page walks due to load miss in the STLB. @@ -646,10 +642,6 @@ Counter 0, 1 only Counts all data reads and writes (speculated and retired) from cacheable memory, including locked operations. Counter 0, 1 only -.It Li L1D_PEND_MISS.LOAD_BUFFERS_FULL -.Pq Event 48H , Umask 02H -Counts cycles of L1 data cache load fill buffers full. -Counter 0, 1 only .It Li DTLB_MISSES.ANY .Pq Event 49H , Umask 01H Counts the number of misses in the STLB which causes a page walk. @@ -660,6 +652,12 @@ Counts number of misses in the STLB whic .Pq Event 49H , Umask 10H Counts the number of DTLB first level misses that hit in the second level TLB. This event is only relevant if the core contains multiple DTLB levels. +.It Li DTLB_MISSES.PDE_MISS +.Pq Event 49H , Umask 20H +Number of DTLB misses caused by low part of address, includes references to 2M pages because 2M pages do not use the PDE. +.It Li DTLB_MISSES.LARGE_WALK_COMPLETED +.Pq Event 49H , Umask 80H +Counts number of misses in the STLB which resulted in a completed page walk for large pages. .It Li LOAD_HIT_PRE .Pq Event 4CH , Umask 01H Counts load operations sent to the L1 data cache while a previous SSE @@ -1205,9 +1203,6 @@ The BPU clear leads to 2 cycle bubble in .Pq Event E8H , Umask 02H Counts late Branch Prediction Unit clears due to Most Recently Used conflicts. The PBU clear leads to a 3 cycle bubble in the Front End. -.It Li BPU_CLEARS.ANY -.Pq Event E8H , Umask 03H -Counts all BPU clears. .It Li L2_TRANSACTIONS.LOAD .Pq Event F0H , Umask 01H Counts L2 load operations due to HW prefetch or demand loads. Modified: head/sys/dev/hwpmc/hwpmc_core.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_core.c Wed Jan 4 07:33:06 2012 (r229469) +++ head/sys/dev/hwpmc/hwpmc_core.c Wed Jan 4 07:58:36 2012 (r229470) @@ -642,7 +642,7 @@ static struct iap_event_descr iap_events IAPDESCR(08H_09H, 0x08, 0x09, IAP_F_FM | IAP_F_CA), IAPDESCR(08H_10H, 0x08, 0x10, IAP_F_FM | IAP_F_I7 | IAP_F_WM), IAPDESCR(08H_20H, 0x08, 0x20, IAP_F_FM | IAP_F_I7 | IAP_F_WM), - IAPDESCR(08H_40H, 0x08, 0x40, IAP_F_FM | IAP_F_I7), + IAPDESCR(08H_40H, 0x08, 0x40, IAP_F_FM | IAP_F_I7O), IAPDESCR(08H_80H, 0x08, 0x80, IAP_F_FM | IAP_F_I7), IAPDESCR(09H_01H, 0x09, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7O), @@ -845,7 +845,7 @@ static struct iap_event_descr iap_events IAPDESCR(47H_00H, 0x47, 0x00, IAP_F_FM | IAP_F_ALLCPUSCORE2), IAPDESCR(48H_00H, 0x48, 0x00, IAP_F_FM | IAP_F_ALLCPUSCORE2), - IAPDESCR(48H_02H, 0x48, 0x02, IAP_F_FM | IAP_F_I7), + IAPDESCR(48H_02H, 0x48, 0x02, IAP_F_FM | IAP_F_I7O), IAPDESCR(49H_00H, 0x49, 0x00, IAP_F_FM | IAP_F_CC), IAPDESCR(49H_01H, 0x49, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | @@ -854,9 +854,9 @@ static struct iap_event_descr iap_events IAP_F_I7 | IAP_F_WM), IAPDESCR(49H_04H, 0x49, 0x04, IAP_F_FM | IAP_F_WM), IAPDESCR(49H_10H, 0x49, 0x10, IAP_F_FM | IAP_F_I7 | IAP_F_WM), - IAPDESCR(49H_20H, 0x49, 0x20, IAP_F_FM | IAP_F_I7O), + IAPDESCR(49H_20H, 0x49, 0x20, IAP_F_FM | IAP_F_I7), IAPDESCR(49H_40H, 0x49, 0x40, IAP_F_FM | IAP_F_I7O), - IAPDESCR(49H_80H, 0x49, 0x80, IAP_F_FM | IAP_F_WM | IAP_F_I7O), + IAPDESCR(49H_80H, 0x49, 0x80, IAP_F_FM | IAP_F_WM | IAP_F_I7), IAPDESCR(4BH_00H, 0x4B, 0x00, IAP_F_FM | IAP_F_ALLCPUSCORE2), IAPDESCR(4BH_01H, 0x4B, 0x01, IAP_F_FM | IAP_F_ALLCPUSCORE2 | IAP_F_I7O), @@ -1306,7 +1306,7 @@ static struct iap_event_descr iap_events IAPDESCR(E8H_01H, 0xE8, 0x01, IAP_F_FM | IAP_F_I7 | IAP_F_WM), IAPDESCR(E8H_02H, 0xE8, 0x02, IAP_F_FM | IAP_F_I7 | IAP_F_WM), - IAPDESCR(E8H_03H, 0xE8, 0x03, IAP_F_FM | IAP_F_I7), + IAPDESCR(E8H_03H, 0xE8, 0x03, IAP_F_FM | IAP_F_I7O), IAPDESCR(ECH_01H, 0xEC, 0x01, IAP_F_FM | IAP_F_WM), @@ -1454,7 +1454,6 @@ iap_event_corei7_ok_on_counter(enum pmc_ case PMC_EV_IAP_EVENT_42H_08H: case PMC_EV_IAP_EVENT_43H_01H: case PMC_EV_IAP_EVENT_43H_02H: - case PMC_EV_IAP_EVENT_48H_02H: case PMC_EV_IAP_EVENT_51H_01H: case PMC_EV_IAP_EVENT_51H_02H: case PMC_EV_IAP_EVENT_51H_04H: Modified: head/sys/dev/hwpmc/pmc_events.h ============================================================================== --- head/sys/dev/hwpmc/pmc_events.h Wed Jan 4 07:33:06 2012 (r229469) +++ head/sys/dev/hwpmc/pmc_events.h Wed Jan 4 07:58:36 2012 (r229470) @@ -1669,7 +1669,7 @@ __PMC_EV_ALIAS("X87_OPS_RETIRED.FXCH", /* * Core i7 and Xeon 5500 events removed between 253669-031US June 2009 - * and 253669-033US December 2009. + * and 253669-040US October 2011. */ #define __PMC_EV_ALIAS_COREI7_OLD() \ __PMC_EV_ALIAS("SB_FORWARD.ANY", IAP_EVENT_02H_01H) \ @@ -1682,6 +1682,7 @@ __PMC_EV_ALIAS("MISALIGN_MEM_REF.ANY", I __PMC_EV_ALIAS("STORE_BLOCKS.NOT_STA", IAP_EVENT_06H_01H) \ __PMC_EV_ALIAS("STORE_BLOCKS.STA", IAP_EVENT_06H_02H) \ __PMC_EV_ALIAS("STORE_BLOCKS.ANY", IAP_EVENT_06H_0FH) \ +__PMC_EV_ALIAS("DTLB_LOAD_MISSES.PDP_MISS", IAP_EVENT_08H_40H) \ __PMC_EV_ALIAS("MEMORY_DISAMBIGURATION.RESET", IAP_EVENT_09H_01H) \ __PMC_EV_ALIAS("MEMORY_DISAMBIGURATION.SUCCESS", IAP_EVENT_09H_02H) \ __PMC_EV_ALIAS("MEMORY_DISAMBIGURATION.WATCHDOG", IAP_EVENT_09H_04H) \ @@ -1693,9 +1694,8 @@ __PMC_EV_ALIAS("L2_WRITE.RFO.E_STATE", I __PMC_EV_ALIAS("UOPS_DECODED.DEC0", IAP_EVENT_3DH_01H) \ __PMC_EV_ALIAS("L1D_CACHE_ST.I_STATE", IAP_EVENT_41H_01H) \ __PMC_EV_ALIAS("L1D_CACHE_ST.MESI", IAP_EVENT_41H_0FH) \ -__PMC_EV_ALIAS("DTLB_MISSES.PDE_MISS", IAP_EVENT_49H_20H) \ +__PMC_EV_ALIAS("L1D_PEND_MISS.LOAD_BUFFERS_FULL", IAP_EVENT_48H_02H) \ __PMC_EV_ALIAS("DTLB_MISSES.PDP_MISS", IAP_EVENT_49H_40H) \ -__PMC_EV_ALIAS("DTLB_MISSES.LARGE_WALK_COMPLETED", IAP_EVENT_49H_80H) \ __PMC_EV_ALIAS("SSE_MEM_EXEC.NTA", IAP_EVENT_4BH_01H) \ __PMC_EV_ALIAS("SSE_MEM_EXEC.STREAMING_STORES", IAP_EVENT_4BH_08H) \ __PMC_EV_ALIAS("SFENCE_CYCLES", IAP_EVENT_4DH_01H) \ @@ -1734,6 +1734,7 @@ __PMC_EV_ALIAS("PIC_ACCESSES.TPR_READS", __PMC_EV_ALIAS("PIC_ACCESSES.TPR_WRITES", IAP_EVENT_BAH_02H) \ __PMC_EV_ALIAS("MACHINE_CLEARS.FUSION_ASSIST", IAP_EVENT_C3H_10H) \ __PMC_EV_ALIAS("BOGUS_BR", IAP_EVENT_E4H_01H) \ +__PMC_EV_ALIAS("BPU_CLEARS.ANY", IAP_EVENT_E8H_03H) \ __PMC_EV_ALIAS("L2_HW_PREFETCH.HIT", IAP_EVENT_F3H_01H) \ __PMC_EV_ALIAS("L2_HW_PREFETCH.ALLOC", IAP_EVENT_F3H_02H) \ __PMC_EV_ALIAS("L2_HW_PREFETCH.DATA_TRIGGER", IAP_EVENT_F3H_04H) \ @@ -1759,7 +1760,6 @@ __PMC_EV_ALIAS("DTLB_LOAD_MISSES.ANY", I __PMC_EV_ALIAS("DTLB_LOAD_MISSES.WALK_COMPLETED", IAP_EVENT_08H_02H) \ __PMC_EV_ALIAS("DTLB_LOAD_MISSES.STLB_HIT", IAP_EVENT_08H_10H) \ __PMC_EV_ALIAS("DTLB_LOAD_MISSES.PDE_MISS", IAP_EVENT_08H_20H) \ -__PMC_EV_ALIAS("DTLB_LOAD_MISSES.PDP_MISS", IAP_EVENT_08H_40H) \ __PMC_EV_ALIAS("DTLB_LOAD_MISSES.LARGE_WALK_COMPLETED", \ IAP_EVENT_08H_80H) \ __PMC_EV_ALIAS("MEM_INST_RETIRED.LOADS", IAP_EVENT_0BH_01H) \ @@ -1867,10 +1867,11 @@ __PMC_EV_ALIAS("L1D_CACHE_LOCK.E_STATE", __PMC_EV_ALIAS("L1D_CACHE_LOCK.M_STATE", IAP_EVENT_42H_08H) \ __PMC_EV_ALIAS("L1D_ALL_REF.ANY", IAP_EVENT_43H_01H) \ __PMC_EV_ALIAS("L1D_ALL_REF.CACHEABLE", IAP_EVENT_43H_02H) \ -__PMC_EV_ALIAS("L1D_PEND_MISS.LOAD_BUFFERS_FULL", IAP_EVENT_48H_02H) \ __PMC_EV_ALIAS("DTLB_MISSES.ANY", IAP_EVENT_49H_01H) \ __PMC_EV_ALIAS("DTLB_MISSES.WALK_COMPLETED", IAP_EVENT_49H_02H) \ __PMC_EV_ALIAS("DTLB_MISSES.STLB_HIT", IAP_EVENT_49H_10H) \ +__PMC_EV_ALIAS("DTLB_MISSES.PDE_MISS", IAP_EVENT_49H_20H) \ +__PMC_EV_ALIAS("DTLB_MISSES.LARGE_WALK_COMPLETED", IAP_EVENT_49H_80H) \ __PMC_EV_ALIAS("LOAD_HIT_PRE", IAP_EVENT_4CH_01H) \ __PMC_EV_ALIAS("L1D_PREFETCH.REQUESTS", IAP_EVENT_4EH_01H) \ __PMC_EV_ALIAS("L1D_PREFETCH.MISS", IAP_EVENT_4EH_02H) \ @@ -1996,7 +1997,6 @@ __PMC_EV_ALIAS("BACLEAR.CLEAR", IAP_EVEN __PMC_EV_ALIAS("BACLEAR.BAD_TARGET", IAP_EVENT_E6H_02H) \ __PMC_EV_ALIAS("BPU_CLEARS.EARLY", IAP_EVENT_E8H_01H) \ __PMC_EV_ALIAS("BPU_CLEARS.LATE", IAP_EVENT_E8H_02H) \ -__PMC_EV_ALIAS("BPU_CLEARS.ANY", IAP_EVENT_E8H_03H) \ __PMC_EV_ALIAS("L2_TRANSACTIONS.LOAD", IAP_EVENT_F0H_01H) \ __PMC_EV_ALIAS("L2_TRANSACTIONS.RFO", IAP_EVENT_F0H_02H) \ __PMC_EV_ALIAS("L2_TRANSACTIONS.IFETCH", IAP_EVENT_F0H_04H) \ From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 08:14:05 2012 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 AF4FF106564A; Wed, 4 Jan 2012 08:14:05 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 980B98FC08; Wed, 4 Jan 2012 08:14:05 +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 q048E5DD067641; Wed, 4 Jan 2012 08:14:05 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q048E5aR067635; Wed, 4 Jan 2012 08:14:05 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201201040814.q048E5aR067635@svn.freebsd.org> From: Fabien Thomas Date: Wed, 4 Jan 2012 08:14:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229471 - in stable/9: sys/dev/cpuctl usr.sbin/cpucontrol 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, 04 Jan 2012 08:14:05 -0000 Author: fabient Date: Wed Jan 4 08:14:05 2012 New Revision: 229471 URL: http://svn.freebsd.org/changeset/base/229471 Log: MFC r228436: Add VIA microde update support to cpuctl(4) and cpucontrol(8). Added: stable/9/usr.sbin/cpucontrol/via.c - copied unchanged from r228436, head/usr.sbin/cpucontrol/via.c stable/9/usr.sbin/cpucontrol/via.h - copied unchanged from r228436, head/usr.sbin/cpucontrol/via.h Modified: stable/9/sys/dev/cpuctl/cpuctl.c stable/9/usr.sbin/cpucontrol/Makefile stable/9/usr.sbin/cpucontrol/cpucontrol.c Directory Properties: stable/9/sys/ (props changed) stable/9/usr.sbin/cpucontrol/ (props changed) Modified: stable/9/sys/dev/cpuctl/cpuctl.c ============================================================================== --- stable/9/sys/dev/cpuctl/cpuctl.c Wed Jan 4 07:58:36 2012 (r229470) +++ stable/9/sys/dev/cpuctl/cpuctl.c Wed Jan 4 08:14:05 2012 (r229471) @@ -74,6 +74,8 @@ static int cpuctl_do_update(int cpu, cpu static int update_intel(int cpu, cpuctl_update_args_t *args, struct thread *td); static int update_amd(int cpu, cpuctl_update_args_t *args, struct thread *td); +static int update_via(int cpu, cpuctl_update_args_t *args, + struct thread *td); static struct cdev **cpuctl_devs; static MALLOC_DEFINE(M_CPUCTL, "cpuctl", "CPUCTL buffer"); @@ -281,8 +283,10 @@ cpuctl_do_update(int cpu, cpuctl_update_ vendor[12] = '\0'; if (strncmp(vendor, INTEL_VENDOR_ID, sizeof(INTEL_VENDOR_ID)) == 0) ret = update_intel(cpu, data, td); - else if(strncmp(vendor, INTEL_VENDOR_ID, sizeof(AMD_VENDOR_ID)) == 0) + else if(strncmp(vendor, AMD_VENDOR_ID, sizeof(AMD_VENDOR_ID)) == 0) ret = update_amd(cpu, data, td); + else if(strncmp(vendor, CENTAUR_VENDOR_ID, sizeof(CENTAUR_VENDOR_ID)) == 0) + ret = update_via(cpu, data, td); else ret = ENXIO; return (ret); @@ -402,6 +406,81 @@ fail: return (ret); } +static int +update_via(int cpu, cpuctl_update_args_t *args, struct thread *td) +{ + void *ptr = NULL; + uint64_t rev0, rev1, res; + uint32_t tmp[4]; + int is_bound = 0; + int oldcpu; + int ret; + + if (args->size == 0 || args->data == NULL) { + DPRINTF("[cpuctl,%d]: zero-sized firmware image", __LINE__); + return (EINVAL); + } + if (args->size > UCODE_SIZE_MAX) { + DPRINTF("[cpuctl,%d]: firmware image too large", __LINE__); + return (EINVAL); + } + + /* + * 4 byte alignment required. + */ + ptr = malloc(args->size + 16, M_CPUCTL, M_WAITOK); + ptr = (void *)(16 + ((intptr_t)ptr & ~0xf)); + if (copyin(args->data, ptr, args->size) != 0) { + DPRINTF("[cpuctl,%d]: copyin %p->%p of %zd bytes failed", + __LINE__, args->data, ptr, args->size); + ret = EFAULT; + goto fail; + } + oldcpu = td->td_oncpu; + is_bound = cpu_sched_is_bound(td); + set_cpu(cpu, td); + critical_enter(); + rdmsr_safe(MSR_BIOS_SIGN, &rev0); /* Get current micorcode revision. */ + + /* + * Perform update. + */ + wrmsr_safe(MSR_BIOS_UPDT_TRIG, (uintptr_t)(ptr)); + do_cpuid(1, tmp); + + /* + * Result are in low byte of MSR FCR5: + * 0x00: No update has been attempted since RESET. + * 0x01: The last attempted update was successful. + * 0x02: The last attempted update was unsuccessful due to a bad + * environment. No update was loaded and any preexisting + * patches are still active. + * 0x03: The last attempted update was not applicable to this processor. + * No update was loaded and any preexisting patches are still + * active. + * 0x04: The last attempted update was not successful due to an invalid + * update data block. No update was loaded and any preexisting + * patches are still active + */ + rdmsr_safe(0x1205, &res); + res &= 0xff; + critical_exit(); + rdmsr_safe(MSR_BIOS_SIGN, &rev1); /* Get new microcode revision. */ + restore_cpu(oldcpu, is_bound, td); + + DPRINTF("[cpu,%d]: rev0=%x rev1=%x res=%x\n", __LINE__, + (unsigned)(rev0 >> 32), (unsigned)(rev1 >> 32), (unsigned)res); + + if (res != 0x01) + ret = EINVAL; + else + ret = 0; +fail: + if (ptr != NULL) + contigfree(ptr, args->size, M_CPUCTL); + return (ret); +} + int cpuctl_open(struct cdev *dev, int flags, int fmt __unused, struct thread *td) { Modified: stable/9/usr.sbin/cpucontrol/Makefile ============================================================================== --- stable/9/usr.sbin/cpucontrol/Makefile Wed Jan 4 07:58:36 2012 (r229470) +++ stable/9/usr.sbin/cpucontrol/Makefile Wed Jan 4 08:14:05 2012 (r229471) @@ -2,7 +2,7 @@ PROG= cpucontrol MAN= cpucontrol.8 -SRCS= cpucontrol.c intel.c amd.c +SRCS= cpucontrol.c intel.c amd.c via.c NO_WCAST_ALIGN= Modified: stable/9/usr.sbin/cpucontrol/cpucontrol.c ============================================================================== --- stable/9/usr.sbin/cpucontrol/cpucontrol.c Wed Jan 4 07:58:36 2012 (r229470) +++ stable/9/usr.sbin/cpucontrol/cpucontrol.c Wed Jan 4 08:14:05 2012 (r229471) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include "cpucontrol.h" #include "amd.h" #include "intel.h" +#include "via.h" int verbosity_level = 0; @@ -91,6 +92,7 @@ struct ucode_handler { } handlers[] = { { intel_probe, intel_update }, { amd_probe, amd_update }, + { via_probe, via_update }, }; #define NHANDLERS (sizeof(handlers) / sizeof(*handlers)) Copied: stable/9/usr.sbin/cpucontrol/via.c (from r228436, head/usr.sbin/cpucontrol/via.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/usr.sbin/cpucontrol/via.c Wed Jan 4 08:14:05 2012 (r229471, copy of r228436, head/usr.sbin/cpucontrol/via.c) @@ -0,0 +1,222 @@ +/*- + * Copyright (c) 2011 Fabien Thomas . + * 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 THE AUTHOR ``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 THE AUTHOR 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "cpucontrol.h" +#include "via.h" + +int +via_probe(int fd) +{ + char vendor[13]; + int error; + cpuctl_cpuid_args_t idargs = { + .level = 0, + }; + + error = ioctl(fd, CPUCTL_CPUID, &idargs); + if (error < 0) { + WARN(0, "ioctl()"); + return (1); + } + ((uint32_t *)vendor)[0] = idargs.data[1]; + ((uint32_t *)vendor)[1] = idargs.data[3]; + ((uint32_t *)vendor)[2] = idargs.data[2]; + vendor[12] = '\0'; + if (strncmp(vendor, CENTAUR_VENDOR_ID, sizeof(CENTAUR_VENDOR_ID)) != 0) + return (1); + + /* TODO: detect Nano CPU. */ + return (0); +} + +void +via_update(const char *dev, const char *path) +{ + int fd, devfd; + struct stat st; + uint32_t *fw_image; + uint32_t sum; + unsigned int i; + size_t payload_size; + via_fw_header_t *fw_header; + uint32_t signature, flags; + int32_t revision; + void *fw_data; + size_t data_size, total_size; + cpuctl_msr_args_t msrargs = { + .msr = MSR_IA32_PLATFORM_ID, + }; + cpuctl_cpuid_args_t idargs = { + .level = 1, /* Signature. */ + }; + cpuctl_update_args_t args; + int error; + + assert(path); + assert(dev); + + fd = -1; + devfd = -1; + fw_image = MAP_FAILED; + devfd = open(dev, O_RDWR); + if (devfd < 0) { + WARN(0, "could not open %s for writing", dev); + return; + } + error = ioctl(devfd, CPUCTL_CPUID, &idargs); + if (error < 0) { + WARN(0, "ioctl(%s)", dev); + goto fail; + } + signature = idargs.data[0]; + error = ioctl(devfd, CPUCTL_RDMSR, &msrargs); + if (error < 0) { + WARN(0, "ioctl(%s)", dev); + goto fail; + } + + /* + * MSR_IA32_PLATFORM_ID contains flag in BCD in bits 52-50. + */ + flags = 1 << ((msrargs.data >> 50) & 7); + msrargs.msr = MSR_BIOS_SIGN; + error = ioctl(devfd, CPUCTL_RDMSR, &msrargs); + if (error < 0) { + WARN(0, "ioctl(%s)", dev); + goto fail; + } + revision = msrargs.data >> 32; /* Revision in the high dword. */ + WARNX(2, "found cpu type %#x family %#x model %#x stepping %#x.", + (signature >> 12) & 0x03, (signature >> 8) & 0x0f, + (signature >> 4) & 0x0f, (signature >> 0) & 0x0f); + /* + * Open firmware image. + */ + fd = open(path, O_RDONLY, 0); + if (fd < 0) { + WARN(0, "open(%s)", path); + return; + } + error = fstat(fd, &st); + if (error != 0) { + WARN(0, "fstat(%s)", path); + goto fail; + } + if (st.st_size < 0 || (unsigned)st.st_size < sizeof(*fw_header)) { + WARNX(2, "file too short: %s", path); + goto fail; + } + + /* + * mmap the whole image. + */ + fw_image = (uint32_t *)mmap(NULL, st.st_size, PROT_READ, + MAP_PRIVATE, fd, 0); + if (fw_image == MAP_FAILED) { + WARN(0, "mmap(%s)", path); + goto fail; + } + fw_header = (via_fw_header_t *)fw_image; + if (fw_header->signature != VIA_HEADER_SIGNATURE || + fw_header->loader_revision != VIA_LOADER_REVISION) { + WARNX(2, "%s is not a valid via firmware: version mismatch", + path); + goto fail; + } + data_size = fw_header->data_size; + total_size = fw_header->total_size; + if (total_size > (unsigned)st.st_size || st.st_size < 0) { + WARNX(2, "file too short: %s", path); + goto fail; + } + payload_size = data_size + sizeof(*fw_header); + + /* + * Check the primary checksum. + */ + sum = 0; + for (i = 0; i < (payload_size / sizeof(uint32_t)); i++) + sum += *((uint32_t *)fw_image + i); + if (sum != 0) { + WARNX(2, "%s: update data checksum invalid", path); + goto fail; + } + + fw_data = fw_header + 1; /* Pointer to the update data. */ + + /* + * Check if the given image is ok for this cpu. + */ + if (signature != fw_header->cpu_signature) + goto fail; + + if (fw_header->revision != 0 && revision >= fw_header->revision) { + WARNX(1, "skipping %s of rev %#x: up to date", + path, fw_header->revision); + goto fail; + } + fprintf(stderr, "%s: updating cpu %s from rev %#x to rev %#x... ", + path, dev, revision, fw_header->revision); + args.data = fw_data; + args.size = data_size; + error = ioctl(devfd, CPUCTL_UPDATE, &args); + if (error < 0) { + fprintf(stderr, "failed.\n"); + WARN(0, "ioctl()"); + goto fail; + } + fprintf(stderr, "done.\n"); + +fail: + if (fw_image != MAP_FAILED) + if (munmap(fw_image, st.st_size) != 0) + warn("munmap(%s)", path); + if (devfd >= 0) + close(devfd); + if (fd >= 0) + close(fd); + return; +} Copied: stable/9/usr.sbin/cpucontrol/via.h (from r228436, head/usr.sbin/cpucontrol/via.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/usr.sbin/cpucontrol/via.h Wed Jan 4 08:14:05 2012 (r229471, copy of r228436, head/usr.sbin/cpucontrol/via.h) @@ -0,0 +1,63 @@ +/*- + * Copyright (c) 2011 Fabien Thomas . + * 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 THE AUTHOR ``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 THE AUTHOR 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. + * + * $FreeBSD$ + */ + +#ifndef VIA_H +#define VIA_H + +/* + * Prototypes. + */ +ucode_probe_t via_probe; +ucode_update_t via_update; + +typedef struct via_fw_header { + uint32_t signature; /* Signature. */ + int32_t revision; /* Unique version number. */ + uint32_t date; /* Date of creation in BCD. */ + uint32_t cpu_signature; /* Extended family, extended + model, type, family, model + and stepping. */ + uint32_t checksum; /* Sum of all DWORDS should + be 0. */ + uint32_t loader_revision; /* Version of the loader + required to load update. */ + uint32_t reserverd1; /* Platform IDs encoded in + the lower 8 bits. */ + uint32_t data_size; + uint32_t total_size; + uint8_t reserved2[12]; +} via_fw_header_t; + +typedef struct via_cpu_signature { + uint32_t cpu_signature; + uint32_t checksum; +} via_cpu_signature_t; + +#define VIA_HEADER_SIGNATURE 0x53415252 +#define VIA_LOADER_REVISION 0x00000001 + +#endif /* !VIA_H */ From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 08:47:01 2012 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 8A571106564A; Wed, 4 Jan 2012 08:47:01 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 70CBF8FC08; Wed, 4 Jan 2012 08:47: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 q048l1QG068792; Wed, 4 Jan 2012 08:47:01 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q048l1Zo068786; Wed, 4 Jan 2012 08:47:01 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201201040847.q048l1Zo068786@svn.freebsd.org> From: Fabien Thomas Date: Wed, 4 Jan 2012 08:47:01 +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: r229472 - in stable/8: sys/dev/cpuctl usr.sbin/cpucontrol 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, 04 Jan 2012 08:47:01 -0000 Author: fabient Date: Wed Jan 4 08:47:00 2012 New Revision: 229472 URL: http://svn.freebsd.org/changeset/base/229472 Log: MFC r228436: Add VIA microcode update support to cpuctl(4) and cpucontrol(8). Added: stable/8/usr.sbin/cpucontrol/via.c - copied unchanged from r228436, head/usr.sbin/cpucontrol/via.c stable/8/usr.sbin/cpucontrol/via.h - copied unchanged from r228436, head/usr.sbin/cpucontrol/via.h Modified: stable/8/sys/dev/cpuctl/cpuctl.c stable/8/usr.sbin/cpucontrol/Makefile stable/8/usr.sbin/cpucontrol/cpucontrol.c Directory Properties: stable/8/sys/ (props changed) stable/8/usr.sbin/cpucontrol/ (props changed) Modified: stable/8/sys/dev/cpuctl/cpuctl.c ============================================================================== --- stable/8/sys/dev/cpuctl/cpuctl.c Wed Jan 4 08:14:05 2012 (r229471) +++ stable/8/sys/dev/cpuctl/cpuctl.c Wed Jan 4 08:47:00 2012 (r229472) @@ -74,6 +74,8 @@ static int cpuctl_do_update(int cpu, cpu static int update_intel(int cpu, cpuctl_update_args_t *args, struct thread *td); static int update_amd(int cpu, cpuctl_update_args_t *args, struct thread *td); +static int update_via(int cpu, cpuctl_update_args_t *args, + struct thread *td); static struct cdev **cpuctl_devs; static MALLOC_DEFINE(M_CPUCTL, "cpuctl", "CPUCTL buffer"); @@ -281,8 +283,10 @@ cpuctl_do_update(int cpu, cpuctl_update_ vendor[12] = '\0'; if (strncmp(vendor, INTEL_VENDOR_ID, sizeof(INTEL_VENDOR_ID)) == 0) ret = update_intel(cpu, data, td); - else if(strncmp(vendor, INTEL_VENDOR_ID, sizeof(AMD_VENDOR_ID)) == 0) + else if(strncmp(vendor, AMD_VENDOR_ID, sizeof(AMD_VENDOR_ID)) == 0) ret = update_amd(cpu, data, td); + else if(strncmp(vendor, CENTAUR_VENDOR_ID, sizeof(CENTAUR_VENDOR_ID)) == 0) + ret = update_via(cpu, data, td); else ret = ENXIO; return (ret); @@ -402,6 +406,81 @@ fail: return (ret); } +static int +update_via(int cpu, cpuctl_update_args_t *args, struct thread *td) +{ + void *ptr = NULL; + uint64_t rev0, rev1, res; + uint32_t tmp[4]; + int is_bound = 0; + int oldcpu; + int ret; + + if (args->size == 0 || args->data == NULL) { + DPRINTF("[cpuctl,%d]: zero-sized firmware image", __LINE__); + return (EINVAL); + } + if (args->size > UCODE_SIZE_MAX) { + DPRINTF("[cpuctl,%d]: firmware image too large", __LINE__); + return (EINVAL); + } + + /* + * 4 byte alignment required. + */ + ptr = malloc(args->size + 16, M_CPUCTL, M_WAITOK); + ptr = (void *)(16 + ((intptr_t)ptr & ~0xf)); + if (copyin(args->data, ptr, args->size) != 0) { + DPRINTF("[cpuctl,%d]: copyin %p->%p of %zd bytes failed", + __LINE__, args->data, ptr, args->size); + ret = EFAULT; + goto fail; + } + oldcpu = td->td_oncpu; + is_bound = cpu_sched_is_bound(td); + set_cpu(cpu, td); + critical_enter(); + rdmsr_safe(MSR_BIOS_SIGN, &rev0); /* Get current micorcode revision. */ + + /* + * Perform update. + */ + wrmsr_safe(MSR_BIOS_UPDT_TRIG, (uintptr_t)(ptr)); + do_cpuid(1, tmp); + + /* + * Result are in low byte of MSR FCR5: + * 0x00: No update has been attempted since RESET. + * 0x01: The last attempted update was successful. + * 0x02: The last attempted update was unsuccessful due to a bad + * environment. No update was loaded and any preexisting + * patches are still active. + * 0x03: The last attempted update was not applicable to this processor. + * No update was loaded and any preexisting patches are still + * active. + * 0x04: The last attempted update was not successful due to an invalid + * update data block. No update was loaded and any preexisting + * patches are still active + */ + rdmsr_safe(0x1205, &res); + res &= 0xff; + critical_exit(); + rdmsr_safe(MSR_BIOS_SIGN, &rev1); /* Get new microcode revision. */ + restore_cpu(oldcpu, is_bound, td); + + DPRINTF("[cpu,%d]: rev0=%x rev1=%x res=%x\n", __LINE__, + (unsigned)(rev0 >> 32), (unsigned)(rev1 >> 32), (unsigned)res); + + if (res != 0x01) + ret = EINVAL; + else + ret = 0; +fail: + if (ptr != NULL) + contigfree(ptr, args->size, M_CPUCTL); + return (ret); +} + int cpuctl_open(struct cdev *dev, int flags, int fmt __unused, struct thread *td) { Modified: stable/8/usr.sbin/cpucontrol/Makefile ============================================================================== --- stable/8/usr.sbin/cpucontrol/Makefile Wed Jan 4 08:14:05 2012 (r229471) +++ stable/8/usr.sbin/cpucontrol/Makefile Wed Jan 4 08:47:00 2012 (r229472) @@ -2,7 +2,7 @@ PROG= cpucontrol MAN= cpucontrol.8 -SRCS= cpucontrol.c intel.c amd.c +SRCS= cpucontrol.c intel.c amd.c via.c WARNS?= 6 Modified: stable/8/usr.sbin/cpucontrol/cpucontrol.c ============================================================================== --- stable/8/usr.sbin/cpucontrol/cpucontrol.c Wed Jan 4 08:14:05 2012 (r229471) +++ stable/8/usr.sbin/cpucontrol/cpucontrol.c Wed Jan 4 08:47:00 2012 (r229472) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include "cpucontrol.h" #include "amd.h" #include "intel.h" +#include "via.h" int verbosity_level = 0; @@ -91,6 +92,7 @@ struct ucode_handler { } handlers[] = { { intel_probe, intel_update }, { amd_probe, amd_update }, + { via_probe, via_update }, }; #define NHANDLERS (sizeof(handlers) / sizeof(*handlers)) Copied: stable/8/usr.sbin/cpucontrol/via.c (from r228436, head/usr.sbin/cpucontrol/via.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/usr.sbin/cpucontrol/via.c Wed Jan 4 08:47:00 2012 (r229472, copy of r228436, head/usr.sbin/cpucontrol/via.c) @@ -0,0 +1,222 @@ +/*- + * Copyright (c) 2011 Fabien Thomas . + * 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 THE AUTHOR ``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 THE AUTHOR 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "cpucontrol.h" +#include "via.h" + +int +via_probe(int fd) +{ + char vendor[13]; + int error; + cpuctl_cpuid_args_t idargs = { + .level = 0, + }; + + error = ioctl(fd, CPUCTL_CPUID, &idargs); + if (error < 0) { + WARN(0, "ioctl()"); + return (1); + } + ((uint32_t *)vendor)[0] = idargs.data[1]; + ((uint32_t *)vendor)[1] = idargs.data[3]; + ((uint32_t *)vendor)[2] = idargs.data[2]; + vendor[12] = '\0'; + if (strncmp(vendor, CENTAUR_VENDOR_ID, sizeof(CENTAUR_VENDOR_ID)) != 0) + return (1); + + /* TODO: detect Nano CPU. */ + return (0); +} + +void +via_update(const char *dev, const char *path) +{ + int fd, devfd; + struct stat st; + uint32_t *fw_image; + uint32_t sum; + unsigned int i; + size_t payload_size; + via_fw_header_t *fw_header; + uint32_t signature, flags; + int32_t revision; + void *fw_data; + size_t data_size, total_size; + cpuctl_msr_args_t msrargs = { + .msr = MSR_IA32_PLATFORM_ID, + }; + cpuctl_cpuid_args_t idargs = { + .level = 1, /* Signature. */ + }; + cpuctl_update_args_t args; + int error; + + assert(path); + assert(dev); + + fd = -1; + devfd = -1; + fw_image = MAP_FAILED; + devfd = open(dev, O_RDWR); + if (devfd < 0) { + WARN(0, "could not open %s for writing", dev); + return; + } + error = ioctl(devfd, CPUCTL_CPUID, &idargs); + if (error < 0) { + WARN(0, "ioctl(%s)", dev); + goto fail; + } + signature = idargs.data[0]; + error = ioctl(devfd, CPUCTL_RDMSR, &msrargs); + if (error < 0) { + WARN(0, "ioctl(%s)", dev); + goto fail; + } + + /* + * MSR_IA32_PLATFORM_ID contains flag in BCD in bits 52-50. + */ + flags = 1 << ((msrargs.data >> 50) & 7); + msrargs.msr = MSR_BIOS_SIGN; + error = ioctl(devfd, CPUCTL_RDMSR, &msrargs); + if (error < 0) { + WARN(0, "ioctl(%s)", dev); + goto fail; + } + revision = msrargs.data >> 32; /* Revision in the high dword. */ + WARNX(2, "found cpu type %#x family %#x model %#x stepping %#x.", + (signature >> 12) & 0x03, (signature >> 8) & 0x0f, + (signature >> 4) & 0x0f, (signature >> 0) & 0x0f); + /* + * Open firmware image. + */ + fd = open(path, O_RDONLY, 0); + if (fd < 0) { + WARN(0, "open(%s)", path); + return; + } + error = fstat(fd, &st); + if (error != 0) { + WARN(0, "fstat(%s)", path); + goto fail; + } + if (st.st_size < 0 || (unsigned)st.st_size < sizeof(*fw_header)) { + WARNX(2, "file too short: %s", path); + goto fail; + } + + /* + * mmap the whole image. + */ + fw_image = (uint32_t *)mmap(NULL, st.st_size, PROT_READ, + MAP_PRIVATE, fd, 0); + if (fw_image == MAP_FAILED) { + WARN(0, "mmap(%s)", path); + goto fail; + } + fw_header = (via_fw_header_t *)fw_image; + if (fw_header->signature != VIA_HEADER_SIGNATURE || + fw_header->loader_revision != VIA_LOADER_REVISION) { + WARNX(2, "%s is not a valid via firmware: version mismatch", + path); + goto fail; + } + data_size = fw_header->data_size; + total_size = fw_header->total_size; + if (total_size > (unsigned)st.st_size || st.st_size < 0) { + WARNX(2, "file too short: %s", path); + goto fail; + } + payload_size = data_size + sizeof(*fw_header); + + /* + * Check the primary checksum. + */ + sum = 0; + for (i = 0; i < (payload_size / sizeof(uint32_t)); i++) + sum += *((uint32_t *)fw_image + i); + if (sum != 0) { + WARNX(2, "%s: update data checksum invalid", path); + goto fail; + } + + fw_data = fw_header + 1; /* Pointer to the update data. */ + + /* + * Check if the given image is ok for this cpu. + */ + if (signature != fw_header->cpu_signature) + goto fail; + + if (fw_header->revision != 0 && revision >= fw_header->revision) { + WARNX(1, "skipping %s of rev %#x: up to date", + path, fw_header->revision); + goto fail; + } + fprintf(stderr, "%s: updating cpu %s from rev %#x to rev %#x... ", + path, dev, revision, fw_header->revision); + args.data = fw_data; + args.size = data_size; + error = ioctl(devfd, CPUCTL_UPDATE, &args); + if (error < 0) { + fprintf(stderr, "failed.\n"); + WARN(0, "ioctl()"); + goto fail; + } + fprintf(stderr, "done.\n"); + +fail: + if (fw_image != MAP_FAILED) + if (munmap(fw_image, st.st_size) != 0) + warn("munmap(%s)", path); + if (devfd >= 0) + close(devfd); + if (fd >= 0) + close(fd); + return; +} Copied: stable/8/usr.sbin/cpucontrol/via.h (from r228436, head/usr.sbin/cpucontrol/via.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/usr.sbin/cpucontrol/via.h Wed Jan 4 08:47:00 2012 (r229472, copy of r228436, head/usr.sbin/cpucontrol/via.h) @@ -0,0 +1,63 @@ +/*- + * Copyright (c) 2011 Fabien Thomas . + * 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 THE AUTHOR ``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 THE AUTHOR 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. + * + * $FreeBSD$ + */ + +#ifndef VIA_H +#define VIA_H + +/* + * Prototypes. + */ +ucode_probe_t via_probe; +ucode_update_t via_update; + +typedef struct via_fw_header { + uint32_t signature; /* Signature. */ + int32_t revision; /* Unique version number. */ + uint32_t date; /* Date of creation in BCD. */ + uint32_t cpu_signature; /* Extended family, extended + model, type, family, model + and stepping. */ + uint32_t checksum; /* Sum of all DWORDS should + be 0. */ + uint32_t loader_revision; /* Version of the loader + required to load update. */ + uint32_t reserverd1; /* Platform IDs encoded in + the lower 8 bits. */ + uint32_t data_size; + uint32_t total_size; + uint8_t reserved2[12]; +} via_fw_header_t; + +typedef struct via_cpu_signature { + uint32_t cpu_signature; + uint32_t checksum; +} via_cpu_signature_t; + +#define VIA_HEADER_SIGNATURE 0x53415252 +#define VIA_LOADER_REVISION 0x00000001 + +#endif /* !VIA_H */ From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 08:54:59 2012 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 F17631065673; Wed, 4 Jan 2012 08:54:59 +0000 (UTC) (envelope-from joel@freebsd.org) Received: from mail.vnode.se (mail.vnode.se [62.119.52.80]) by mx1.freebsd.org (Postfix) with ESMTP id 9BC9C8FC12; Wed, 4 Jan 2012 08:54:59 +0000 (UTC) Received: from mail.vnode.se (localhost [127.0.0.1]) by mail.vnode.se (Postfix) with ESMTP id 8E6E3E3F07A; Wed, 4 Jan 2012 09:54:58 +0100 (CET) X-Virus-Scanned: amavisd-new at vnode.se Received: from mail.vnode.se ([127.0.0.1]) by mail.vnode.se (mail.vnode.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id R2+XXgqKZrsw; Wed, 4 Jan 2012 09:54:56 +0100 (CET) Received: from goofy01.vnodelab.local (unknown [212.247.52.12]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.vnode.se (Postfix) with ESMTPSA id 84CF0E3F079; Wed, 4 Jan 2012 09:54:55 +0100 (CET) Date: Wed, 4 Jan 2012 09:54:53 +0100 From: Joel Dahl To: John Baldwin Message-ID: <20120104085453.GD61584@goofy01.vnodelab.local> References: <201201032104.q03L4sTm043158@svn.freebsd.org> <201201031615.06873.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201201031615.06873.jhb@freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, "Pedro F. Giffuni" , src-committers@freebsd.org Subject: Re: svn commit: r229430 - in head/sys: conf dev/sound/pci modules/sound/driver/emu10k1 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, 04 Jan 2012 08:55:00 -0000 On 03-01-2012 16:15, John Baldwin wrote: > On Tuesday, January 03, 2012 4:04:54 pm Pedro F. Giffuni wrote: > > Author: pfg > > Date: Tue Jan 3 21:04:54 2012 > > New Revision: 229430 > > URL: http://svn.freebsd.org/changeset/base/229430 > > > > Log: > > Replace a GPL'd header in the emu10k1 snd driver code. > > > > This brings in the emuxkireg.h from NetBSD (dev/pci) which > > is used for the same purpose but is smaller. The emu10k1 > > is now free from the GPL. > > Is this a common-enough chipset to enable in GENERIC now that it is safe to > do so? I think so, but I also think we should decide what to do with emu10kx (if anything) as I suspect it will remain GPL polluted. The emu10k1 and emu10kx drivers essentially support the same hardware, with a few exceptions (if memory serves me right -- I think there are a few cards that emu10kx does not support, someone should check with Yuriy). However, emu10kx has a few nice features like optional multichannel and MIDI I/O support... -- Joel From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 11:07:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1033) id C58E51065673; Wed, 4 Jan 2012 11:07:15 +0000 (UTC) Date: Wed, 4 Jan 2012 11:07:15 +0000 From: Alexey Dokuchaev To: Joel Dahl Message-ID: <20120104110715.GB3811@FreeBSD.org> References: <201201032104.q03L4sTm043158@svn.freebsd.org> <201201031615.06873.jhb@freebsd.org> <20120104085453.GD61584@goofy01.vnodelab.local> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <20120104085453.GD61584@goofy01.vnodelab.local> User-Agent: Mutt/1.4.2.1i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, "Pedro F. Giffuni" , src-committers@freebsd.org, John Baldwin Subject: Re: svn commit: r229430 - in head/sys: conf dev/sound/pci modules/sound/driver/emu10k1 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, 04 Jan 2012 11:07:15 -0000 On Wed, Jan 04, 2012 at 09:54:53AM +0100, Joel Dahl wrote: > The emu10k1 and emu10kx drivers essentially support the same hardware, with > a few exceptions (if memory serves me right -- I think there are a few cards > that emu10kx does not support, someone should check with Yuriy). However, > emu10kx has a few nice features like optional multichannel and MIDI I/O > support... How hard would it be to (re)implement missing features with emu10k1 and nuke GPL-polluted emu10kx? ./danfe From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 12:39:53 2012 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 9D269106566B; Wed, 4 Jan 2012 12:39:53 +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 80CC38FC08; Wed, 4 Jan 2012 12:39:53 +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 q04CdroU078081; Wed, 4 Jan 2012 12:39:53 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04CdrOL078076; Wed, 4 Jan 2012 12:39:53 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201201041239.q04CdrOL078076@svn.freebsd.org> From: Sergey Kandaurov Date: Wed, 4 Jan 2012 12:39:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229473 - in stable/9/sys: boot/common boot/forth conf 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, 04 Jan 2012 12:39:53 -0000 Author: pluknet Date: Wed Jan 4 12:39:52 2012 New Revision: 229473 URL: http://svn.freebsd.org/changeset/base/229473 Log: MFC r226833,r227056: Remove the long reprecated ``/stand/sysinstall'' from the init_path. Modified: stable/9/sys/boot/common/loader.8 stable/9/sys/boot/forth/loader.conf stable/9/sys/conf/NOTES stable/9/sys/kern/init_main.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/boot/common/loader.8 ============================================================================== --- stable/9/sys/boot/common/loader.8 Wed Jan 4 08:47:00 2012 (r229472) +++ stable/9/sys/boot/common/loader.8 Wed Jan 4 12:39:52 2012 (r229473) @@ -443,7 +443,7 @@ Sets the list of binaries which the kern process. The first matching binary is used. The default list is -.Dq Li /sbin/init:/sbin/oinit:/sbin/init.bak:\:/rescue/init:/stand/sysinstall . +.Dq Li /sbin/init:/sbin/oinit:/sbin/init.bak:\:/rescue/init . .It Va init_script If set to a valid file name in the root file system, instructs Modified: stable/9/sys/boot/forth/loader.conf ============================================================================== --- stable/9/sys/boot/forth/loader.conf Wed Jan 4 08:47:00 2012 (r229472) +++ stable/9/sys/boot/forth/loader.conf Wed Jan 4 12:39:52 2012 (r229473) @@ -81,7 +81,7 @@ module_path="/boot/modules" # Set the mo #boot_serial="" # -h: Use serial console #boot_single="" # -s: Start system in single-user mode #boot_verbose="" # -v: Causes extra debugging information to be printed -#init_path="/sbin/init:/sbin/oinit:/sbin/init.bak:/rescue/init:/stand/sysinstall" +#init_path="/sbin/init:/sbin/oinit:/sbin/init.bak:/rescue/init" # Sets the list of init candidates #init_shell="/bin/sh" # The shell binary used by init(8). #init_script="" # Initial script to run by init(8) before chrooting. Modified: stable/9/sys/conf/NOTES ============================================================================== --- stable/9/sys/conf/NOTES Wed Jan 4 08:47:00 2012 (r229472) +++ stable/9/sys/conf/NOTES Wed Jan 4 12:39:52 2012 (r229473) @@ -2812,7 +2812,7 @@ options UBSEC_RNDTEST # enable rndtest # Embedded system options: # # An embedded system might want to run something other than init. -options INIT_PATH=/sbin/init:/stand/sysinstall +options INIT_PATH=/sbin/init:/rescue/init # Debug options options BUS_DEBUG # enable newbus debugging Modified: stable/9/sys/kern/init_main.c ============================================================================== --- stable/9/sys/kern/init_main.c Wed Jan 4 08:47:00 2012 (r229472) +++ stable/9/sys/kern/init_main.c Wed Jan 4 12:39:52 2012 (r229473) @@ -641,7 +641,7 @@ static char init_path[MAXPATHLEN] = #ifdef INIT_PATH __XSTRING(INIT_PATH); #else - "/sbin/init:/sbin/oinit:/sbin/init.bak:/rescue/init:/stand/sysinstall"; + "/sbin/init:/sbin/oinit:/sbin/init.bak:/rescue/init"; #endif SYSCTL_STRING(_kern, OID_AUTO, init_path, CTLFLAG_RD, init_path, 0, "Path used to search the init process"); From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 12:48:24 2012 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 CF74D106566C; Wed, 4 Jan 2012 12:48:24 +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 BCAC88FC13; Wed, 4 Jan 2012 12:48: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 q04CmOa7078410; Wed, 4 Jan 2012 12:48:24 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04CmOti078405; Wed, 4 Jan 2012 12:48:24 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201201041248.q04CmOti078405@svn.freebsd.org> From: Sergey Kandaurov Date: Wed, 4 Jan 2012 12:48:24 +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: r229474 - in stable/8/sys: boot/common boot/forth conf 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, 04 Jan 2012 12:48:24 -0000 Author: pluknet Date: Wed Jan 4 12:48:24 2012 New Revision: 229474 URL: http://svn.freebsd.org/changeset/base/229474 Log: MFC r226833,r227056: Remove the long reprecated ``/stand/sysinstall'' from the init_path. Modified: stable/8/sys/boot/common/loader.8 stable/8/sys/boot/forth/loader.conf stable/8/sys/conf/NOTES stable/8/sys/kern/init_main.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/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/boot/common/loader.8 ============================================================================== --- stable/8/sys/boot/common/loader.8 Wed Jan 4 12:39:52 2012 (r229473) +++ stable/8/sys/boot/common/loader.8 Wed Jan 4 12:48:24 2012 (r229474) @@ -449,7 +449,7 @@ Sets the list of binaries which the kern process. The first matching binary is used. The default list is -.Dq Li /sbin/init:/sbin/oinit:/sbin/init.bak:\:/rescue/init:/stand/sysinstall . +.Dq Li /sbin/init:/sbin/oinit:/sbin/init.bak:\:/rescue/init . .It Va init_script If set to a valid file name in the root file system, instructs Modified: stable/8/sys/boot/forth/loader.conf ============================================================================== --- stable/8/sys/boot/forth/loader.conf Wed Jan 4 12:39:52 2012 (r229473) +++ stable/8/sys/boot/forth/loader.conf Wed Jan 4 12:48:24 2012 (r229474) @@ -76,7 +76,7 @@ module_path="/boot/modules" # Set the mo #boot_serial="" # -h: Use serial console #boot_single="" # -s: Start system in single-user mode #boot_verbose="" # -v: Causes extra debugging information to be printed -#init_path="/sbin/init:/sbin/oinit:/sbin/init.bak:/rescue/init:/stand/sysinstall" +#init_path="/sbin/init:/sbin/oinit:/sbin/init.bak:/rescue/init" # Sets the list of init candidates #init_shell="/bin/sh" # The shell binary used by init(8). #init_script="" # Initial script to run by init(8) before chrooting. Modified: stable/8/sys/conf/NOTES ============================================================================== --- stable/8/sys/conf/NOTES Wed Jan 4 12:39:52 2012 (r229473) +++ stable/8/sys/conf/NOTES Wed Jan 4 12:48:24 2012 (r229474) @@ -2733,7 +2733,7 @@ options UBSEC_RNDTEST # enable rndtest # Embedded system options: # # An embedded system might want to run something other than init. -options INIT_PATH=/sbin/init:/stand/sysinstall +options INIT_PATH=/sbin/init:/rescue/init # Debug options options BUS_DEBUG # enable newbus debugging Modified: stable/8/sys/kern/init_main.c ============================================================================== --- stable/8/sys/kern/init_main.c Wed Jan 4 12:39:52 2012 (r229473) +++ stable/8/sys/kern/init_main.c Wed Jan 4 12:48:24 2012 (r229474) @@ -623,7 +623,7 @@ static char init_path[MAXPATHLEN] = #ifdef INIT_PATH __XSTRING(INIT_PATH); #else - "/sbin/init:/sbin/oinit:/sbin/init.bak:/rescue/init:/stand/sysinstall"; + "/sbin/init:/sbin/oinit:/sbin/init.bak:/rescue/init"; #endif SYSCTL_STRING(_kern, OID_AUTO, init_path, CTLFLAG_RD, init_path, 0, "Path used to search the init process"); From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 12:54:36 2012 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 22AD7106566C; Wed, 4 Jan 2012 12:54:36 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 10D538FC17; Wed, 4 Jan 2012 12:54:36 +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 q04CsZCb078656; Wed, 4 Jan 2012 12:54:35 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04CsZxk078654; Wed, 4 Jan 2012 12:54:35 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <201201041254.q04CsZxk078654@svn.freebsd.org> From: Peter Holm Date: Wed, 4 Jan 2012 12:54:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229475 - stable/9/sys/fs/pseudofs 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, 04 Jan 2012 12:54:36 -0000 Author: pho Date: Wed Jan 4 12:54:35 2012 New Revision: 229475 URL: http://svn.freebsd.org/changeset/base/229475 Log: MFC: r227527 Removed extra PRELE() call. Modified: stable/9/sys/fs/pseudofs/pseudofs_vnops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/fs/pseudofs/pseudofs_vnops.c ============================================================================== --- stable/9/sys/fs/pseudofs/pseudofs_vnops.c Wed Jan 4 12:48:24 2012 (r229474) +++ stable/9/sys/fs/pseudofs/pseudofs_vnops.c Wed Jan 4 12:54:35 2012 (r229475) @@ -632,8 +632,6 @@ pfs_read(struct vop_read_args *va) (offset = uio->uio_offset) != uio->uio_offset || (resid = uio->uio_resid) != uio->uio_resid || (buflen = offset + resid + 1) < offset || buflen > INT_MAX) { - if (proc != NULL) - PRELE(proc); error = EINVAL; goto ret; } From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 12:54:53 2012 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 ACD6E106578B; Wed, 4 Jan 2012 12:54:53 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 8297C8FC0C; Wed, 4 Jan 2012 12:54:53 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id 39E6146B0A; Wed, 4 Jan 2012 07:54:53 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 89163B96C; Wed, 4 Jan 2012 07:54:52 -0500 (EST) From: John Baldwin To: Sergey Kandaurov Date: Wed, 4 Jan 2012 07:54:00 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p8; KDE/4.5.5; amd64; ; ) References: <201201041239.q04CdrOL078076@svn.freebsd.org> In-Reply-To: <201201041239.q04CdrOL078076@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201201040754.00824.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 04 Jan 2012 07:54:52 -0500 (EST) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org Subject: Re: svn commit: r229473 - in stable/9/sys: boot/common boot/forth conf 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, 04 Jan 2012 12:54:53 -0000 On Wednesday, January 04, 2012 7:39:53 am Sergey Kandaurov wrote: > Author: pluknet > Date: Wed Jan 4 12:39:52 2012 > New Revision: 229473 > URL: http://svn.freebsd.org/changeset/base/229473 > > Log: > MFC r226833,r227056: > > Remove the long reprecated ``/stand/sysinstall'' from the init_path. I think this is premature for 9. sysinstall still exists in 9 along with src/release/Makefile.sysinstall. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 12:54:54 2012 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 833F91065678; Wed, 4 Jan 2012 12:54:54 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 58A708FC13; Wed, 4 Jan 2012 12:54:54 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id 11EEB46B0C; Wed, 4 Jan 2012 07:54:54 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 16CA1B924; Wed, 4 Jan 2012 07:54:53 -0500 (EST) From: John Baldwin To: Sergey Kandaurov Date: Wed, 4 Jan 2012 07:54:50 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p8; KDE/4.5.5; amd64; ; ) References: <201201041248.q04CmOti078405@svn.freebsd.org> In-Reply-To: <201201041248.q04CmOti078405@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201201040754.50457.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 04 Jan 2012 07:54:53 -0500 (EST) 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: r229474 - in stable/8/sys: boot/common boot/forth conf 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, 04 Jan 2012 12:54:54 -0000 On Wednesday, January 04, 2012 7:48:24 am Sergey Kandaurov wrote: > Author: pluknet > Date: Wed Jan 4 12:48:24 2012 > New Revision: 229474 > URL: http://svn.freebsd.org/changeset/base/229474 > > Log: > MFC r226833,r227056: > > Remove the long reprecated ``/stand/sysinstall'' from the init_path. Uh, you need to revert this or 8.3 won't install. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 12:55:15 2012 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 7D29F10656E4; Wed, 4 Jan 2012 12:55:15 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail08.syd.optusnet.com.au (mail08.syd.optusnet.com.au [211.29.132.189]) by mx1.freebsd.org (Postfix) with ESMTP id 040038FC23; Wed, 4 Jan 2012 12:55:14 +0000 (UTC) Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au (c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136]) by mail08.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q04Ct5UV002978 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 4 Jan 2012 23:55:08 +1100 Date: Wed, 4 Jan 2012 23:55:05 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Ed Schouten In-Reply-To: <20120103182020.GH1895@hoeg.nl> Message-ID: <20120104214707.Q1935@besplex.bde.org> References: <201201030714.q037E2qq010125@svn.freebsd.org> <20120104013401.S6960@besplex.bde.org> <20120103182020.GH1895@hoeg.nl> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Bruce Evans Subject: Re: svn commit: r229368 - in head: lib/libc lib/libc/arm/string lib/libc/i386/string lib/libc/mips/string lib/libc/string lib/libstand sys/boot/userboot/libstand 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, 04 Jan 2012 12:55:15 -0000 On Tue, 3 Jan 2012, Ed Schouten wrote: > * Bruce Evans , 20120103 16:49: >> This breaks the Standard C namespace. When they are in the same object >> file, there is no way to get the standard name without getting the >> nonstandard name. So the following C-standard-conforming C program >> now gets a linkage error (multiple definition of `index'), at least with >> static linkage: >> >> #include >> int index; >> void foo(const char *p) { return strchr(p, '1'); } > > Though I sympathize, this problem is not just limited to strchr(). There > are other portions of the C library that use index() as well. For > example, if you use , ttyslot(), one of the exec*() functions > or the NIS functions, you already get index() linked into your binary. These are standard C or very often used parts of libc though. Your change gives the bizarre behaviour that any use of strchr() by an application prevents all uses of index by the application (except calling the library index()), while the only point of of cleaning up libraries to not use index() is to allow applications to use it for whatever they want. >> [...] and the C >> standard might require memcpy and memmove to have different addresses. > > I just skimmed through the standard, and if I haven't overlooked > anything, no such requirement is made. Also, I can imagine a compiler > with good support for link-time optimisation can already merge equal > pieces of code together, making it even harder to reason about > inequality of function addresses. > > Still, I am willing to address the issues you raised. index() and > rindex() aren't that important nowadays and I have a patchset ready in > my home directory that converts almost all apps in the base system to > use strchr() anyway. > > As I don't feel like polluting the MI strchr() implementations with > index()/rindex() support, would it be okay if I implement index() and > rindex() as simple C functions that call into strchr() and strrchr()? Just use a weak symbol. This is good enough for hundreds or thousands or existing aliases. I did a quick check what gprof does with the alises. It seems to be random. gprof reports that the symbol for open(2) is `open', irrespective of whether I spell it `open' or _open in the source code. OTOH, gprof reports that the symbol for vfscanf(3) is __vfscanf, irrespective of whether I spell it vfscanf or __vfscanf in the source code. The object code contains both symbols of course (after linking to libc). I think gprof just picks one of the symbols semi-randomly (for these 2 pairs, it uses the last symbol in symbol table order). To do the right thing, the object linked object code would have to contain a hint about which symbol the application used (which is only possible if the application only used 1 of the aliases), and gprof would have to understand the hint. I think there is no such hint. To do the next best thing, gprof would have to prefer the non-weak symbol. Is this possible? nm output doesn't distinguish the symbols. I tried doing something using chained aliases with a weak link, and only found lots of bugs. E.g.: % #include % % /* % * XXX __strong_alias() is unusable since it acts at the C level, but our % * intermediate symbol only exists at the asm level. % */ % #undef __strong_reference % #define __strong_reference(sym, alias) \ % __asm(".global " #alias); \ % __asm(#alias " = " #sym) % % void xstrchr(void) {} % % __weak_reference(xstrchr, __xindex); % __strong_reference(__xindex, xindex); This reimplementation of __strong_reference() worked like I wanted (on i386), but the chain didn't do anything interesting or fix gprof. I copied it from the STRONG_ALIAS() that you added in i386/include/asm.h, except STRONG_ALIAS() has the parameters reversed relative to all the macros in cdefs.h. STRONG_ALIAS() only exists on mips and now i386. The section that defines symbol macros in cdefs.h has lots of bugs: - wrong conditional. Old versions of gcc don't support the attribute that it uses, or __attribute__(()) at all. - __strong_reference() is only defined for !__INTEL_COMPILER. It is now used unconditionally in libc (in ptsname.c alone). Thus, icc cannot possibly compile libc. The above reemplmentation of __strong_reference() may be less unportable. All of these symbol definitions are unportable and don't belong in MI cdefs.h. They assume a particular dialect of asm and much more. But they are portable enough in practice since we only use the gas dialect. The rest are just style bugs: - no space after commas in parameter lists. The !STDC or the !ELF case may need this. Otherwise, it is just a style bug (copied from the older !ELF code). The !STDC case has probably never been used in FreeBSD. Both subcases of the ELF case were added in 1998 just before K&R support started being dismantled. Some !STDC support remains. But ELF support was removed soon after. I think it is only the removed !ELF && !STDC case that needs to misformat the parameter lists, since IIRC spaces in the list get into parameters for STDC, and this matters for !ELF since we want to add a prefix of `_' to symbol names. - __asm is misspelled __asm__ - there is a tab instead of a space before the comments on #endif's. More on the above reimplementation of __strong_reference(): here it is again: % #define __strong_reference(sym, alias) \ % __asm(".global " #alias); \ % __asm(#alias " = " #sym) I remembered that I can never remember the difference between "=" and "equ". In fact, there seems to be no difference, and "=" is just an alternative spelling with a difference syntax for the ".equ" directive. Using ".equ" is safer because "=" might be an arithmetic operator. And in cdefs.h, using "=" is a style bug because all other places (just the 2 implementations of __weak_reference()) use ".equ". Changing the above to use ".equ" as in __weak_reference gives: #define __strong_reference(sym, alias) \ __asm(".global " #alias); \ __asm(".equ " #alias ", " #sym) Now the only difference between __strong_reference() and the STDC __weak_reference() are: - one declares #alias as .global and the other declares it as .weak. Oops, I forgot to fix the misspelling of .globl as .global. It is spelled traditionally (to satisfy the limit of 6 characters in identifiers) in all instances in amd64 and mips, and in all places in i386 except in STRONG_REFERENCE(). The rest are just style differences: - I didn't duplicate the fancy formatting that puts extra spaces in the source code to line up the '#alias's. These should really be tabs to line up the symbols in the asm output, but tabs in strings in source code are even harder to format well (they should be spelled \t, but the macros are hard enough to read already. - I didn't duplicate the misspelling of __asm as __asm__. So it seems that __strong_reference() can be implemented in a way that is identically unportable to __weak_reference(). Bruce From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 13:05:34 2012 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 00F51106574D; Wed, 4 Jan 2012 13:05:34 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-tul01m020-f182.google.com (mail-tul01m020-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 85A3F8FC14; Wed, 4 Jan 2012 13:05:33 +0000 (UTC) Received: by obbwd18 with SMTP id wd18so20273747obb.13 for ; Wed, 04 Jan 2012 05:05:33 -0800 (PST) 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:cc:content-type :content-transfer-encoding; bh=0EjtbS1cdj3StcXNONRBz8BPadQZQZ2T/bfVQH/WFaI=; b=LsXx7OmMy18/7Rgv2cR99xaWC9iNDBhC4myjgsN+528dzyTQBxRew8oetlvsk6DAOX UpTb7w/FmXfCDkK+xne0NppFn1tO9ljWTachkJFb2+UAkdHcUm36/tFkFyzXrB/Nsotk aVYyGlICI7ZZadSehmsbdUJ8lmqSimT1TIk68= MIME-Version: 1.0 Received: by 10.182.45.102 with SMTP id l6mr48435977obm.0.1325682333008; Wed, 04 Jan 2012 05:05:33 -0800 (PST) Sender: pluknet@gmail.com Received: by 10.182.171.67 with HTTP; Wed, 4 Jan 2012 05:05:32 -0800 (PST) In-Reply-To: <201201040754.00824.jhb@freebsd.org> References: <201201041239.q04CdrOL078076@svn.freebsd.org> <201201040754.00824.jhb@freebsd.org> Date: Wed, 4 Jan 2012 16:05:32 +0300 X-Google-Sender-Auth: MtpG6YFhdw0Y8Ui5Vk2Y4CW-dLg Message-ID: From: Sergey Kandaurov To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org Subject: Re: svn commit: r229473 - in stable/9/sys: boot/common boot/forth conf 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, 04 Jan 2012 13:05:34 -0000 On 4 January 2012 16:54, John Baldwin wrote: > On Wednesday, January 04, 2012 7:39:53 am Sergey Kandaurov wrote: >> Author: pluknet >> Date: Wed Jan =A04 12:39:52 2012 >> New Revision: 229473 >> URL: http://svn.freebsd.org/changeset/base/229473 >> >> Log: >> =A0 MFC r226833,r227056: >> >> =A0 Remove the long reprecated ``/stand/sysinstall'' from the init_path. > > I think this is premature for 9. =A0sysinstall still exists in 9 along wi= th > src/release/Makefile.sysinstall. Yes, but /stand do not (since 5.3 ?). That was the reason to merge this back. --=20 wbr, pluknet From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 13:09:52 2012 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 BBCD5106564A; Wed, 4 Jan 2012 13:09:52 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-tul01m020-f182.google.com (mail-tul01m020-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 588588FC13; Wed, 4 Jan 2012 13:09:51 +0000 (UTC) Received: by obbwd18 with SMTP id wd18so20279846obb.13 for ; Wed, 04 Jan 2012 05:09:51 -0800 (PST) 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:cc:content-type :content-transfer-encoding; bh=xSoHF6n7zu2FcTQTSiLvX6H9wlWRFYy7nGIGLY1WPjA=; b=MtSpse16lL+vvpIJvpYUXnHkSdYYxObmKLwBXmtTFrR7YpEJy4l1+xv329JzIEh2Mo QYQQjIYnpQtVrvcaYkdIU1rE/vD+9Phg6Rp3p0qJCgTyGQMnshQRMcegY0Z20d+3nwQi HZE4lgPVR0Z2WzCX19fphfIX7HFF5M2Er+PoE= MIME-Version: 1.0 Received: by 10.182.160.1 with SMTP id xg1mr48407978obb.30.1325682591679; Wed, 04 Jan 2012 05:09:51 -0800 (PST) Sender: pluknet@gmail.com Received: by 10.182.171.67 with HTTP; Wed, 4 Jan 2012 05:09:51 -0800 (PST) In-Reply-To: <201201040754.50457.jhb@freebsd.org> References: <201201041248.q04CmOti078405@svn.freebsd.org> <201201040754.50457.jhb@freebsd.org> Date: Wed, 4 Jan 2012 16:09:51 +0300 X-Google-Sender-Auth: Um9A-vx7riz2Ee0ARlbNo4rIfzo Message-ID: From: Sergey Kandaurov To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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: r229474 - in stable/8/sys: boot/common boot/forth conf 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, 04 Jan 2012 13:09:52 -0000 On 4 January 2012 16:54, John Baldwin wrote: > On Wednesday, January 04, 2012 7:48:24 am Sergey Kandaurov wrote: >> Author: pluknet >> Date: Wed Jan =A04 12:48:24 2012 >> New Revision: 229474 >> URL: http://svn.freebsd.org/changeset/base/229474 >> >> Log: >> =A0 MFC r226833,r227056: >> >> =A0 Remove the long reprecated ``/stand/sysinstall'' from the init_path. > > Uh, you need to revert this or 8.3 won't install. So, /stand was removed exactly 5.3 timeframe. I see no reason why we still should reference it 3 major versions later. Please correct me if I'm wrong. http://www.mavetju.org/mail/view_message.php?list=3Dfreebsd-arch&id=3D17497= 48 --=20 wbr, pluknet From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 13:14:11 2012 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 32E5E1065676; Wed, 4 Jan 2012 13:14:11 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 06A5D8FC16; Wed, 4 Jan 2012 13:14:11 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id B459246B1A; Wed, 4 Jan 2012 08:14:10 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 1C890B944; Wed, 4 Jan 2012 08:14:10 -0500 (EST) From: John Baldwin To: Sergey Kandaurov Date: Wed, 4 Jan 2012 08:14:07 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p8; KDE/4.5.5; amd64; ; ) References: <201201041239.q04CdrOL078076@svn.freebsd.org> <201201040754.00824.jhb@freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201201040814.07578.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 04 Jan 2012 08:14:10 -0500 (EST) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org Subject: Re: svn commit: r229473 - in stable/9/sys: boot/common boot/forth conf 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, 04 Jan 2012 13:14:11 -0000 On Wednesday, January 04, 2012 8:05:32 am Sergey Kandaurov wrote: > On 4 January 2012 16:54, John Baldwin wrote: > > On Wednesday, January 04, 2012 7:39:53 am Sergey Kandaurov wrote: > >> Author: pluknet > >> Date: Wed Jan 4 12:39:52 2012 > >> New Revision: 229473 > >> URL: http://svn.freebsd.org/changeset/base/229473 > >> > >> Log: > >> MFC r226833,r227056: > >> > >> Remove the long reprecated ``/stand/sysinstall'' from the init_path. > > > > I think this is premature for 9. sysinstall still exists in 9 along with > > src/release/Makefile.sysinstall. > > Yes, but /stand do not (since 5.3 ?). > That was the reason to merge this back. /stand exists in the MFS root used during a sysinstall-based install. That is how the install starts up (/stand/sysinstall from the MFS root is invoked as the init process by the kernel). -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 13:23:52 2012 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 484A6106566B; Wed, 4 Jan 2012 13:23:52 +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 3734B8FC12; Wed, 4 Jan 2012 13:23:52 +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 q04DNqC8079597; Wed, 4 Jan 2012 13:23:52 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04DNppc079595; Wed, 4 Jan 2012 13:23:51 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201041323.q04DNppc079595@svn.freebsd.org> From: John Baldwin Date: Wed, 4 Jan 2012 13:23:51 +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: r229476 - 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: Wed, 04 Jan 2012 13:23:52 -0000 Author: jhb Date: Wed Jan 4 13:23:51 2012 New Revision: 229476 URL: http://svn.freebsd.org/changeset/base/229476 Log: Fix the SIOC[DG]LIFADDR ioctls in in_lifaddr_ioctl() to work with IPv4 interface address rather than IPv6. Submitted by: hrs Reviewed by: bz MFC after: 1 week Modified: head/sys/netinet/in.c Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Wed Jan 4 12:54:35 2012 (r229475) +++ head/sys/netinet/in.c Wed Jan 4 13:23:51 2012 (r229476) @@ -735,7 +735,7 @@ in_lifaddr_ioctl(struct socket *so, u_lo if (iflr->flags & IFLR_PREFIX) return (EINVAL); - /* copy args to in_aliasreq, perform ioctl(SIOCAIFADDR_IN6). */ + /* copy args to in_aliasreq, perform ioctl(SIOCAIFADDR). */ bzero(&ifra, sizeof(ifra)); bcopy(iflr->iflr_name, ifra.ifra_name, sizeof(ifra.ifra_name)); @@ -785,7 +785,7 @@ in_lifaddr_ioctl(struct socket *so, u_lo } TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { - if (ifa->ifa_addr->sa_family != AF_INET6) + if (ifa->ifa_addr->sa_family != AF_INET) continue; if (match.s_addr == 0) break; @@ -817,7 +817,7 @@ in_lifaddr_ioctl(struct socket *so, u_lo } else { struct in_aliasreq ifra; - /* fill in_aliasreq and do ioctl(SIOCDIFADDR_IN6) */ + /* fill in_aliasreq and do ioctl(SIOCDIFADDR) */ bzero(&ifra, sizeof(ifra)); bcopy(iflr->iflr_name, ifra.ifra_name, sizeof(ifra.ifra_name)); From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 13:26:57 2012 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 88E97106564A; Wed, 4 Jan 2012 13:26:57 +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 77E368FC13; Wed, 4 Jan 2012 13:26: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 q04DQvlO079719; Wed, 4 Jan 2012 13:26:57 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04DQv1k079717; Wed, 4 Jan 2012 13:26:57 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201041326.q04DQv1k079717@svn.freebsd.org> From: John Baldwin Date: Wed, 4 Jan 2012 13:26:57 +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: r229477 - 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: Wed, 04 Jan 2012 13:26:57 -0000 Author: jhb Date: Wed Jan 4 13:26:56 2012 New Revision: 229477 URL: http://svn.freebsd.org/changeset/base/229477 Log: In the handling of the SIOC[DG]LIFADDR icotls in in_lifaddr_ioctl(), add missing interface address list locking and grab a reference on the matching interface address after dropping the lock while it is used to avoid a potential use after free. Reviewed by: bz MFC after: 1 week Modified: head/sys/netinet/in.c Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Wed Jan 4 13:23:51 2012 (r229476) +++ head/sys/netinet/in.c Wed Jan 4 13:26:56 2012 (r229477) @@ -784,6 +784,7 @@ in_lifaddr_ioctl(struct socket *so, u_lo } } + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET) continue; @@ -794,6 +795,9 @@ in_lifaddr_ioctl(struct socket *so, u_lo if (candidate.s_addr == match.s_addr) break; } + if (ifa != NULL) + ifa_ref(ifa); + IF_ADDR_UNLOCK(ifp); if (ifa == NULL) return (EADDRNOTAVAIL); ia = (struct in_ifaddr *)ifa; @@ -812,6 +816,7 @@ in_lifaddr_ioctl(struct socket *so, u_lo in_mask2len(&ia->ia_sockmask.sin_addr); iflr->flags = 0; /*XXX*/ + ifa_free(ifa); return (0); } else { @@ -830,6 +835,7 @@ in_lifaddr_ioctl(struct socket *so, u_lo } bcopy(&ia->ia_sockmask, &ifra.ifra_dstaddr, ia->ia_sockmask.sin_len); + ifa_free(ifa); return (in_control(so, SIOCDIFADDR, (caddr_t)&ifra, ifp, td)); From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 13:29:26 2012 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 EBBFB106566B; Wed, 4 Jan 2012 13:29:26 +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 DAEBB8FC08; Wed, 4 Jan 2012 13:29: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 q04DTQZp079826; Wed, 4 Jan 2012 13:29:26 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04DTQc7079824; Wed, 4 Jan 2012 13:29:26 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201041329.q04DTQc7079824@svn.freebsd.org> From: John Baldwin Date: Wed, 4 Jan 2012 13:29: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: r229478 - 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: Wed, 04 Jan 2012 13:29:27 -0000 Author: jhb Date: Wed Jan 4 13:29:26 2012 New Revision: 229478 URL: http://svn.freebsd.org/changeset/base/229478 Log: Use a helper variable to wrap a long line. Modified: head/sys/netinet/in.c Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Wed Jan 4 13:26:56 2012 (r229477) +++ head/sys/netinet/in.c Wed Jan 4 13:29:26 2012 (r229478) @@ -790,7 +790,8 @@ in_lifaddr_ioctl(struct socket *so, u_lo continue; if (match.s_addr == 0) break; - candidate.s_addr = ((struct sockaddr_in *)&ifa->ifa_addr)->sin_addr.s_addr; + sin = (struct sockaddr_in *)&ifa->ifa_addr; + candidate.s_addr = sin->sin_addr.s_addr; candidate.s_addr &= mask.s_addr; if (candidate.s_addr == match.s_addr) break; From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 13:31:38 2012 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 24E0B1065670; Wed, 4 Jan 2012 13:31:38 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id EC8DA8FC19; Wed, 4 Jan 2012 13:31:37 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id A41AB46B1A; Wed, 4 Jan 2012 08:31:37 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 32438B944; Wed, 4 Jan 2012 08:31:37 -0500 (EST) From: John Baldwin To: Sergey Kandaurov Date: Wed, 4 Jan 2012 08:31:36 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p8; KDE/4.5.5; amd64; ; ) References: <201201041248.q04CmOti078405@svn.freebsd.org> <201201040754.50457.jhb@freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201201040831.36693.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 04 Jan 2012 08:31:37 -0500 (EST) 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: r229474 - in stable/8/sys: boot/common boot/forth conf 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, 04 Jan 2012 13:31:38 -0000 On Wednesday, January 04, 2012 8:09:51 am Sergey Kandaurov wrote: > On 4 January 2012 16:54, John Baldwin wrote: > > On Wednesday, January 04, 2012 7:48:24 am Sergey Kandaurov wrote: > >> Author: pluknet > >> Date: Wed Jan 4 12:48:24 2012 > >> New Revision: 229474 > >> URL: http://svn.freebsd.org/changeset/base/229474 > >> > >> Log: > >> MFC r226833,r227056: > >> > >> Remove the long reprecated ``/stand/sysinstall'' from the init_path. > > > > Uh, you need to revert this or 8.3 won't install. > > So, /stand was removed exactly 5.3 timeframe. I see no reason > why we still should reference it 3 major versions later. > Please correct me if I'm wrong. > > http://www.mavetju.org/mail/view_message.php?list=freebsd-arch&id=1749748 That only stops making a copy of it from the MFS root onto the installed system. The entry in the init path is to allow the MFS root to boot during an install. If you go grab the mfsroot from 8.2-RELEASE and mount it via mdconfig you will find that it has no /sbin/init file. Instead, it uses /stand/sysinstall as its init. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 13:35:21 2012 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 88A54106567A; Wed, 4 Jan 2012 13:35:21 +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 6BEB88FC0C; Wed, 4 Jan 2012 13:35: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 q04DZLVe080058; Wed, 4 Jan 2012 13:35:21 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04DZLen080056; Wed, 4 Jan 2012 13:35:21 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201041335.q04DZLen080056@svn.freebsd.org> From: John Baldwin Date: Wed, 4 Jan 2012 13:35: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: r229479 - head/sys/netinet6 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, 04 Jan 2012 13:35:21 -0000 Author: jhb Date: Wed Jan 4 13:35:20 2012 New Revision: 229479 URL: http://svn.freebsd.org/changeset/base/229479 Log: Use the mli_relinmhead list normally used to defer calls to in6m_release_locked() to defer calls to mld_v1_transmit_report() until after the IF_ADDR_LOCK is dropped. This removes a race where the lock is dropped and reacquired while attempting to walk an interface's address list. Reviewed by: bz MFC after: 1 week Modified: head/sys/netinet6/mld6.c Modified: head/sys/netinet6/mld6.c ============================================================================== --- head/sys/netinet6/mld6.c Wed Jan 4 13:29:26 2012 (r229478) +++ head/sys/netinet6/mld6.c Wed Jan 4 13:35:20 2012 (r229479) @@ -121,7 +121,8 @@ static int mld_v1_input_query(struct ifn /*const*/ struct mld_hdr *); static int mld_v1_input_report(struct ifnet *, const struct ip6_hdr *, /*const*/ struct mld_hdr *); -static void mld_v1_process_group_timer(struct in6_multi *, const int); +static void mld_v1_process_group_timer(struct mld_ifinfo *, + struct in6_multi *); static void mld_v1_process_querier_timers(struct mld_ifinfo *); static int mld_v1_transmit_report(struct in6_multi *, const int); static void mld_v1_update_group(struct in6_multi *, const int); @@ -1336,8 +1337,8 @@ mld_fasttimo_vnet(void) struct ifqueue qrq; /* Query response packets */ struct ifnet *ifp; struct mld_ifinfo *mli; - struct ifmultiaddr *ifma, *tifma; - struct in6_multi *inm; + struct ifmultiaddr *ifma; + struct in6_multi *inm, *tinm; int uri_fasthz; uri_fasthz = 0; @@ -1401,24 +1402,14 @@ mld_fasttimo_vnet(void) } IF_ADDR_LOCK(ifp); - TAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, - tifma) { + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET6 || ifma->ifma_protospec == NULL) continue; inm = (struct in6_multi *)ifma->ifma_protospec; switch (mli->mli_version) { case MLD_VERSION_1: - /* - * XXX Drop IF_ADDR lock temporarily to - * avoid recursion caused by a potential - * call by in6ifa_ifpforlinklocal(). - * rwlock candidate? - */ - IF_ADDR_UNLOCK(ifp); - mld_v1_process_group_timer(inm, - mli->mli_version); - IF_ADDR_LOCK(ifp); + mld_v1_process_group_timer(mli, inm); break; case MLD_VERSION_2: mld_v2_process_group_timers(mli, &qrq, @@ -1428,9 +1419,25 @@ mld_fasttimo_vnet(void) } IF_ADDR_UNLOCK(ifp); - if (mli->mli_version == MLD_VERSION_2) { - struct in6_multi *tinm; - + switch (mli->mli_version) { + case MLD_VERSION_1: + /* + * Transmit reports for this lifecycle. This + * is done while not holding IF_ADDR_LOCK + * since this can call + * in6ifa_ifpforlinklocal() which locks + * IF_ADDR_LOCK internally as well as + * ip6_output() to transmit a packet. + */ + SLIST_FOREACH_SAFE(inm, &mli->mli_relinmhead, + in6m_nrele, tinm) { + SLIST_REMOVE_HEAD(&mli->mli_relinmhead, + in6m_nrele); + (void)mld_v1_transmit_report(inm, + MLD_LISTENER_REPORT); + } + break; + case MLD_VERSION_2: mld_dispatch_queue(&qrq, 0); mld_dispatch_queue(&scq, 0); @@ -1444,6 +1451,7 @@ mld_fasttimo_vnet(void) in6m_nrele); in6m_release_locked(inm); } + break; } } @@ -1457,7 +1465,7 @@ out_locked: * Will update the global pending timer flags. */ static void -mld_v1_process_group_timer(struct in6_multi *inm, const int version) +mld_v1_process_group_timer(struct mld_ifinfo *mli, struct in6_multi *inm) { int report_timer_expired; @@ -1484,8 +1492,8 @@ mld_v1_process_group_timer(struct in6_mu case MLD_REPORTING_MEMBER: if (report_timer_expired) { inm->in6m_state = MLD_IDLE_MEMBER; - (void)mld_v1_transmit_report(inm, - MLD_LISTENER_REPORT); + SLIST_INSERT_HEAD(&mli->mli_relinmhead, inm, + in6m_nrele); } break; case MLD_G_QUERY_PENDING_MEMBER: From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 13:40:42 2012 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 978B5106564A; Wed, 4 Jan 2012 13:40:42 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-tul01m020-f182.google.com (mail-tul01m020-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 263148FC12; Wed, 4 Jan 2012 13:40:41 +0000 (UTC) Received: by obbwd18 with SMTP id wd18so20326276obb.13 for ; Wed, 04 Jan 2012 05:40:41 -0800 (PST) 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:cc:content-type :content-transfer-encoding; bh=thvAHwXLh7InJkMXW+R1xXu+cvOBdn31BuRTviUrbzQ=; b=V1eQDn7V+XaDMzn9WeV0MPUPqYwF3XrDpuAlQINXgT6S3grKUsBDKPosAB0tewuVmT pcGDOPukeF09eBrvPa8vDtnCrVAz0RYYkxXc0GpNwONVapwr1JYTINExOc/xNzBdzzdo zARlOlLhR1LGQR2M89l50tycR00OMC2ALlqqM= MIME-Version: 1.0 Received: by 10.182.117.97 with SMTP id kd1mr21975476obb.50.1325684441602; Wed, 04 Jan 2012 05:40:41 -0800 (PST) Sender: pluknet@gmail.com Received: by 10.182.171.67 with HTTP; Wed, 4 Jan 2012 05:40:41 -0800 (PST) In-Reply-To: <201201040831.36693.jhb@freebsd.org> References: <201201041248.q04CmOti078405@svn.freebsd.org> <201201040754.50457.jhb@freebsd.org> <201201040831.36693.jhb@freebsd.org> Date: Wed, 4 Jan 2012 16:40:41 +0300 X-Google-Sender-Auth: w2zF_8lKT41XpMWo-HeQahKuCkU Message-ID: From: Sergey Kandaurov To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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: r229474 - in stable/8/sys: boot/common boot/forth conf 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, 04 Jan 2012 13:40:42 -0000 On 4 January 2012 17:31, John Baldwin wrote: > On Wednesday, January 04, 2012 8:09:51 am Sergey Kandaurov wrote: >> On 4 January 2012 16:54, John Baldwin wrote: >> > On Wednesday, January 04, 2012 7:48:24 am Sergey Kandaurov wrote: >> >> Author: pluknet >> >> Date: Wed Jan =A04 12:48:24 2012 >> >> New Revision: 229474 >> >> URL: http://svn.freebsd.org/changeset/base/229474 >> >> >> >> Log: >> >> =A0 MFC r226833,r227056: >> >> >> >> =A0 Remove the long reprecated ``/stand/sysinstall'' from the init_pa= th. >> > >> > Uh, you need to revert this or 8.3 won't install. >> >> So, /stand was removed exactly 5.3 timeframe. I see no reason >> why we still should reference it 3 major versions later. >> Please correct me if I'm wrong. >> >> http://www.mavetju.org/mail/view_message.php?list=3Dfreebsd-arch&id=3D17= 49748 > > That only stops making a copy of it from the MFS root onto the installed > system. =A0The entry in the init path is to allow the MFS root to boot du= ring an > install. =A0If you go grab the mfsroot from 8.2-RELEASE and mount it via > mdconfig you will find that it has no /sbin/init file. =A0Instead, it use= s > /stand/sysinstall as its init. Doh, indeed. I will revert it right now, sorry. --=20 wbr, pluknet From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 13:49:46 2012 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 A2DFA106566B; Wed, 4 Jan 2012 13:49:46 +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 8621D8FC14; Wed, 4 Jan 2012 13:49:46 +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 q04Dnkpp080532; Wed, 4 Jan 2012 13:49:46 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04DnkqE080527; Wed, 4 Jan 2012 13:49:46 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201201041349.q04DnkqE080527@svn.freebsd.org> From: Sergey Kandaurov Date: Wed, 4 Jan 2012 13:49:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229480 - in stable/9/sys: boot/common boot/forth conf 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, 04 Jan 2012 13:49:46 -0000 Author: pluknet Date: Wed Jan 4 13:49:46 2012 New Revision: 229480 URL: http://svn.freebsd.org/changeset/base/229480 Log: Revert MFC r226833,227056. /stand exists in the MFS root used during a sysinstall-based install. Reported by: jhb Pointy hat to: pluknet Modified: stable/9/sys/boot/common/loader.8 stable/9/sys/boot/forth/loader.conf stable/9/sys/conf/NOTES stable/9/sys/kern/init_main.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/boot/common/loader.8 ============================================================================== --- stable/9/sys/boot/common/loader.8 Wed Jan 4 13:35:20 2012 (r229479) +++ stable/9/sys/boot/common/loader.8 Wed Jan 4 13:49:46 2012 (r229480) @@ -443,7 +443,7 @@ Sets the list of binaries which the kern process. The first matching binary is used. The default list is -.Dq Li /sbin/init:/sbin/oinit:/sbin/init.bak:\:/rescue/init . +.Dq Li /sbin/init:/sbin/oinit:/sbin/init.bak:\:/rescue/init:/stand/sysinstall . .It Va init_script If set to a valid file name in the root file system, instructs Modified: stable/9/sys/boot/forth/loader.conf ============================================================================== --- stable/9/sys/boot/forth/loader.conf Wed Jan 4 13:35:20 2012 (r229479) +++ stable/9/sys/boot/forth/loader.conf Wed Jan 4 13:49:46 2012 (r229480) @@ -81,7 +81,7 @@ module_path="/boot/modules" # Set the mo #boot_serial="" # -h: Use serial console #boot_single="" # -s: Start system in single-user mode #boot_verbose="" # -v: Causes extra debugging information to be printed -#init_path="/sbin/init:/sbin/oinit:/sbin/init.bak:/rescue/init" +#init_path="/sbin/init:/sbin/oinit:/sbin/init.bak:/rescue/init:/stand/sysinstall" # Sets the list of init candidates #init_shell="/bin/sh" # The shell binary used by init(8). #init_script="" # Initial script to run by init(8) before chrooting. Modified: stable/9/sys/conf/NOTES ============================================================================== --- stable/9/sys/conf/NOTES Wed Jan 4 13:35:20 2012 (r229479) +++ stable/9/sys/conf/NOTES Wed Jan 4 13:49:46 2012 (r229480) @@ -2812,7 +2812,7 @@ options UBSEC_RNDTEST # enable rndtest # Embedded system options: # # An embedded system might want to run something other than init. -options INIT_PATH=/sbin/init:/rescue/init +options INIT_PATH=/sbin/init:/stand/sysinstall # Debug options options BUS_DEBUG # enable newbus debugging Modified: stable/9/sys/kern/init_main.c ============================================================================== --- stable/9/sys/kern/init_main.c Wed Jan 4 13:35:20 2012 (r229479) +++ stable/9/sys/kern/init_main.c Wed Jan 4 13:49:46 2012 (r229480) @@ -641,7 +641,7 @@ static char init_path[MAXPATHLEN] = #ifdef INIT_PATH __XSTRING(INIT_PATH); #else - "/sbin/init:/sbin/oinit:/sbin/init.bak:/rescue/init"; + "/sbin/init:/sbin/oinit:/sbin/init.bak:/rescue/init:/stand/sysinstall"; #endif SYSCTL_STRING(_kern, OID_AUTO, init_path, CTLFLAG_RD, init_path, 0, "Path used to search the init process"); From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 13:53:51 2012 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 4FBC21065673; Wed, 4 Jan 2012 13:53:51 +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 3CFA28FC0A; Wed, 4 Jan 2012 13:53:51 +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 q04DrpTm080707; Wed, 4 Jan 2012 13:53:51 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04DroP4080702; Wed, 4 Jan 2012 13:53:50 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201201041353.q04DroP4080702@svn.freebsd.org> From: Sergey Kandaurov Date: Wed, 4 Jan 2012 13:53:50 +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: r229481 - in stable/8/sys: boot/common boot/forth conf 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, 04 Jan 2012 13:53:51 -0000 Author: pluknet Date: Wed Jan 4 13:53:50 2012 New Revision: 229481 URL: http://svn.freebsd.org/changeset/base/229481 Log: Revert MFC r226833,227056. /stand exists in the MFS root used during a sysinstall-based install. Reported by: jhb Pointy hat to: pluknet Modified: stable/8/sys/boot/common/loader.8 stable/8/sys/boot/forth/loader.conf stable/8/sys/conf/NOTES stable/8/sys/kern/init_main.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/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/boot/common/loader.8 ============================================================================== --- stable/8/sys/boot/common/loader.8 Wed Jan 4 13:49:46 2012 (r229480) +++ stable/8/sys/boot/common/loader.8 Wed Jan 4 13:53:50 2012 (r229481) @@ -449,7 +449,7 @@ Sets the list of binaries which the kern process. The first matching binary is used. The default list is -.Dq Li /sbin/init:/sbin/oinit:/sbin/init.bak:\:/rescue/init . +.Dq Li /sbin/init:/sbin/oinit:/sbin/init.bak:\:/rescue/init:/stand/sysinstall . .It Va init_script If set to a valid file name in the root file system, instructs Modified: stable/8/sys/boot/forth/loader.conf ============================================================================== --- stable/8/sys/boot/forth/loader.conf Wed Jan 4 13:49:46 2012 (r229480) +++ stable/8/sys/boot/forth/loader.conf Wed Jan 4 13:53:50 2012 (r229481) @@ -76,7 +76,7 @@ module_path="/boot/modules" # Set the mo #boot_serial="" # -h: Use serial console #boot_single="" # -s: Start system in single-user mode #boot_verbose="" # -v: Causes extra debugging information to be printed -#init_path="/sbin/init:/sbin/oinit:/sbin/init.bak:/rescue/init" +#init_path="/sbin/init:/sbin/oinit:/sbin/init.bak:/rescue/init:/stand/sysinstall" # Sets the list of init candidates #init_shell="/bin/sh" # The shell binary used by init(8). #init_script="" # Initial script to run by init(8) before chrooting. Modified: stable/8/sys/conf/NOTES ============================================================================== --- stable/8/sys/conf/NOTES Wed Jan 4 13:49:46 2012 (r229480) +++ stable/8/sys/conf/NOTES Wed Jan 4 13:53:50 2012 (r229481) @@ -2733,7 +2733,7 @@ options UBSEC_RNDTEST # enable rndtest # Embedded system options: # # An embedded system might want to run something other than init. -options INIT_PATH=/sbin/init:/rescue/init +options INIT_PATH=/sbin/init:/stand/sysinstall # Debug options options BUS_DEBUG # enable newbus debugging Modified: stable/8/sys/kern/init_main.c ============================================================================== --- stable/8/sys/kern/init_main.c Wed Jan 4 13:49:46 2012 (r229480) +++ stable/8/sys/kern/init_main.c Wed Jan 4 13:53:50 2012 (r229481) @@ -623,7 +623,7 @@ static char init_path[MAXPATHLEN] = #ifdef INIT_PATH __XSTRING(INIT_PATH); #else - "/sbin/init:/sbin/oinit:/sbin/init.bak:/rescue/init"; + "/sbin/init:/sbin/oinit:/sbin/init.bak:/rescue/init:/stand/sysinstall"; #endif SYSCTL_STRING(_kern, OID_AUTO, init_path, CTLFLAG_RD, init_path, 0, "Path used to search the init process"); From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 13:58:11 2012 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 73B96106566B for ; Wed, 4 Jan 2012 13:58:11 +0000 (UTC) (envelope-from pfg@freebsd.org) Received: from nm16-vm0.bullet.mail.sp2.yahoo.com (nm16-vm0.bullet.mail.sp2.yahoo.com [98.139.91.210]) by mx1.freebsd.org (Postfix) with SMTP id 49E538FC16 for ; Wed, 4 Jan 2012 13:58:11 +0000 (UTC) Received: from [98.139.91.67] by nm16.bullet.mail.sp2.yahoo.com with NNFMP; 04 Jan 2012 13:58:10 -0000 Received: from [72.30.22.202] by tm7.bullet.mail.sp2.yahoo.com with NNFMP; 04 Jan 2012 13:58:10 -0000 Received: from [127.0.0.1] by omp1064.mail.sp2.yahoo.com with NNFMP; 04 Jan 2012 13:58:10 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 966417.64483.bm@omp1064.mail.sp2.yahoo.com Received: (qmail 643 invoked by uid 60001); 4 Jan 2012 13:58:10 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1325685490; bh=zYNZgQ0Oijtvf3Mh/hiPTF8b30X3C5TeDP6ejwTseqI=; h=X-YMail-OSG:Received:X-RocketYMMF:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=kBW7pZXBTkBCJyziGafq1n5EDw82+P0sr0JPbdN4Y4NTvCZZuEki62/OLkTSJrtEO7waAf9rGhG3wMAaahArvAt2bfQeYXZO/W8GXcl8Jc2BK1UnGeKjGEfug5G1JoRwt/+K4JUngAOpb4xtiQ4Tez8eTbstAhMQa4znOh1JDu4= X-YMail-OSG: dB7t2lsVM1kT92iZu6hm6kj1wur2Jq2IUX3hoBVWkeuMa2i y3QeWpdQeWlI4mOssaWNRZnCXc1VZNp_4GUBaPF_YKT4liKiRm4tUjj4nSYW 5k0S5S_jObbMSgyIh.uh49j2EP2fpx0vnOtSaEwVtcBE_4pwCk.bfioLHO8A Ax1DGfUd69e9X3BOo65SjQb_UJPxil.WsHtsZA6cJ1WOxzK6xCuBfam5eQ7O ykf_gPSzIOUruMgqg2dZclAq.DJV.xLg3Aqe3WUnO46xuQP8AmIQ6__anA2L r3YBCxjUWjXFuxZ0WIHrvfKqtaOYj79FAgqcBooZE.Cc1BOyqbW9zeePTFVE 6mdQvMX5AyWnpdc2EHFX5xOcnfZTS7Legw8I2ZOXGpvr1Z5iYLVwBKTZMJab bpn9nnOMD8GPmMNTdyzBDOGbnN3N_Maiki2b._FGl0D2x6IxooPIFtr4HrzE _D1_6UU9zuNJOTEz8ZFaq77Po_g-- Received: from [200.118.157.7] by web113511.mail.gq1.yahoo.com via HTTP; Wed, 04 Jan 2012 05:58:10 PST X-RocketYMMF: giffunip X-Mailer: YahooMailClassic/15.0.4 YahooMailWebService/0.8.115.331698 Message-ID: <1325685490.99537.YahooMailClassic@web113511.mail.gq1.yahoo.com> Date: Wed, 4 Jan 2012 05:58:10 -0800 (PST) From: Pedro Giffuni To: Joel Dahl , Alexey Dokuchaev In-Reply-To: <20120104110715.GB3811@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, John Baldwin Subject: Re: svn commit: r229430 - in head/sys: conf dev/sound/pci modules/sound/driver/emu10k1 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: pfg@freebsd.org 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, 04 Jan 2012 13:58:11 -0000 Hello;=0A=0A--- Mer 4/1/12, Alexey Dokuchaev ha scritto= :=0A=0A...=0A> =0A> How hard would it be to (re)implement missing features = with=0A> emu10k1 and nuke GPL-polluted emu10kx?=0A> =0A=0AThe emu10kx start= ed from the emu10k1 and is mostly BSD licensed,=0AI did start cleaning it i= n kern/153901 but I didn't commit the=0Athe emu10kx part.=0A=0AThe only iss= ue is getting rid of the remaining (small)=0AGPL'd headers. Alternatively t= his driver is already available=0Aas a port (audio/emu10kx).=0A=0Acheers,= =0A=0APedro.=0A From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 14:02:01 2012 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 28E7A1065673; Wed, 4 Jan 2012 14:02:01 +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 16CE88FC1F; Wed, 4 Jan 2012 14:02: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 q04E2012081049; Wed, 4 Jan 2012 14:02:00 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04E20tm081046; Wed, 4 Jan 2012 14:02:00 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201201041402.q04E20tm081046@svn.freebsd.org> From: Sergey Kandaurov Date: Wed, 4 Jan 2012 14:02:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229482 - stable/9/sys/netinet6 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, 04 Jan 2012 14:02:01 -0000 Author: pluknet Date: Wed Jan 4 14:02:00 2012 New Revision: 229482 URL: http://svn.freebsd.org/changeset/base/229482 Log: MFC r227055: Remove a couple of write-only variables. Modified: stable/9/sys/netinet6/icmp6.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/netinet6/icmp6.c ============================================================================== --- stable/9/sys/netinet6/icmp6.c Wed Jan 4 13:53:50 2012 (r229481) +++ stable/9/sys/netinet6/icmp6.c Wed Jan 4 14:02:00 2012 (r229482) @@ -2351,8 +2351,6 @@ icmp6_redirect_input(struct mbuf *m, int int icmp6len = ntohs(ip6->ip6_plen); char *lladdr = NULL; int lladdrlen = 0; - u_char *redirhdr = NULL; - int redirhdrlen = 0; struct rtentry *rt = NULL; int is_router; int is_onlink; @@ -2488,11 +2486,6 @@ icmp6_redirect_input(struct mbuf *m, int lladdrlen = ndopts.nd_opts_tgt_lladdr->nd_opt_len << 3; } - if (ndopts.nd_opts_rh) { - redirhdrlen = ndopts.nd_opts_rh->nd_opt_rh_len; - redirhdr = (u_char *)(ndopts.nd_opts_rh + 1); /* xxx */ - } - if (lladdr && ((ifp->if_addrlen + 2 + 7) & ~7) != lladdrlen) { nd6log((LOG_INFO, "icmp6_redirect_input: lladdrlen mismatch for %s " From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 14:03:46 2012 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 326CB1065673; Wed, 4 Jan 2012 14:03:46 +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 204A38FC26; Wed, 4 Jan 2012 14:03:46 +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 q04E3j5N081149; Wed, 4 Jan 2012 14:03:45 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04E3jLT081147; Wed, 4 Jan 2012 14:03:45 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201201041403.q04E3jLT081147@svn.freebsd.org> From: Sergey Kandaurov Date: Wed, 4 Jan 2012 14:03:45 +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: r229483 - in stable/8/sys: conf netinet6 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, 04 Jan 2012 14:03:46 -0000 Author: pluknet Date: Wed Jan 4 14:03:45 2012 New Revision: 229483 URL: http://svn.freebsd.org/changeset/base/229483 Log: MFC r227055: Remove a couple of write-only variables. Modified: stable/8/sys/netinet6/icmp6.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/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/netinet6/icmp6.c ============================================================================== --- stable/8/sys/netinet6/icmp6.c Wed Jan 4 14:02:00 2012 (r229482) +++ stable/8/sys/netinet6/icmp6.c Wed Jan 4 14:03:45 2012 (r229483) @@ -2266,8 +2266,6 @@ icmp6_redirect_input(struct mbuf *m, int int icmp6len = ntohs(ip6->ip6_plen); char *lladdr = NULL; int lladdrlen = 0; - u_char *redirhdr = NULL; - int redirhdrlen = 0; struct rtentry *rt = NULL; int is_router; int is_onlink; @@ -2403,11 +2401,6 @@ icmp6_redirect_input(struct mbuf *m, int lladdrlen = ndopts.nd_opts_tgt_lladdr->nd_opt_len << 3; } - if (ndopts.nd_opts_rh) { - redirhdrlen = ndopts.nd_opts_rh->nd_opt_rh_len; - redirhdr = (u_char *)(ndopts.nd_opts_rh + 1); /* xxx */ - } - if (lladdr && ((ifp->if_addrlen + 2 + 7) & ~7) != lladdrlen) { nd6log((LOG_INFO, "icmp6_redirect_input: lladdrlen mismatch for %s " From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 14:06:18 2012 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 F3DE3106566C; Wed, 4 Jan 2012 14:06:17 +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 E1EC18FC0C; Wed, 4 Jan 2012 14:06: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 q04E6Hc2081282; Wed, 4 Jan 2012 14:06:17 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04E6HbN081280; Wed, 4 Jan 2012 14:06:17 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201201041406.q04E6HbN081280@svn.freebsd.org> From: Sergey Kandaurov Date: Wed, 4 Jan 2012 14:06:17 +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: r229484 - stable/7/sys/netinet6 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, 04 Jan 2012 14:06:18 -0000 Author: pluknet Date: Wed Jan 4 14:06:17 2012 New Revision: 229484 URL: http://svn.freebsd.org/changeset/base/229484 Log: MFC r227055: Remove a couple of write-only variables. Modified: stable/7/sys/netinet6/icmp6.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/netinet6/icmp6.c ============================================================================== --- stable/7/sys/netinet6/icmp6.c Wed Jan 4 14:03:45 2012 (r229483) +++ stable/7/sys/netinet6/icmp6.c Wed Jan 4 14:06:17 2012 (r229484) @@ -2212,8 +2212,6 @@ icmp6_redirect_input(struct mbuf *m, int int icmp6len = ntohs(ip6->ip6_plen); char *lladdr = NULL; int lladdrlen = 0; - u_char *redirhdr = NULL; - int redirhdrlen = 0; struct rtentry *rt = NULL; int is_router; int is_onlink; @@ -2349,11 +2347,6 @@ icmp6_redirect_input(struct mbuf *m, int lladdrlen = ndopts.nd_opts_tgt_lladdr->nd_opt_len << 3; } - if (ndopts.nd_opts_rh) { - redirhdrlen = ndopts.nd_opts_rh->nd_opt_rh_len; - redirhdr = (u_char *)(ndopts.nd_opts_rh + 1); /* xxx */ - } - if (lladdr && ((ifp->if_addrlen + 2 + 7) & ~7) != lladdrlen) { nd6log((LOG_INFO, "icmp6_redirect_input: lladdrlen mismatch for %s " From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 14:11:42 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1033) id 1552C1065673; Wed, 4 Jan 2012 14:11:42 +0000 (UTC) Date: Wed, 4 Jan 2012 14:11:42 +0000 From: Alexey Dokuchaev To: Pedro Giffuni Message-ID: <20120104141141.GA34976@FreeBSD.org> References: <20120104110715.GB3811@FreeBSD.org> <1325685490.99537.YahooMailClassic@web113511.mail.gq1.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <1325685490.99537.YahooMailClassic@web113511.mail.gq1.yahoo.com> User-Agent: Mutt/1.4.2.1i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, John Baldwin , Joel Dahl Subject: Re: svn commit: r229430 - in head/sys: conf dev/sound/pci modules/sound/driver/emu10k1 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, 04 Jan 2012 14:11:42 -0000 On Wed, Jan 04, 2012 at 05:58:10AM -0800, Pedro Giffuni wrote: > --- Mer 4/1/12, Alexey Dokuchaev ha scritto: > > How hard would it be to (re)implement missing features with > > emu10k1 and nuke GPL-polluted emu10kx? > > The emu10kx started from the emu10k1 and is mostly BSD licensed, > I did start cleaning it in kern/153901 but I didn't commit the > the emu10kx part. > > The only issue is getting rid of the remaining (small) > GPL'd headers. Alternatively this driver is already available > as a port (audio/emu10kx). Yes, I am aware of the port existence. My point was to leave just one, BSD licensed, full featured emu10k driver in the base (i.e. merge emu10k1 and emu10kx into one). Good to know that you're up to this; I hope we'll get there eventually. :-) ./danfe From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 14:18:48 2012 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 2DE861065676; Wed, 4 Jan 2012 14:18:48 +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 1BEA28FC1C; Wed, 4 Jan 2012 14:18:48 +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 q04EIlWL081798; Wed, 4 Jan 2012 14:18:47 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04EIli8081796; Wed, 4 Jan 2012 14:18:47 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201201041418.q04EIli8081796@svn.freebsd.org> From: Sergey Kandaurov Date: Wed, 4 Jan 2012 14:18:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229485 - stable/9/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, 04 Jan 2012 14:18:48 -0000 Author: pluknet Date: Wed Jan 4 14:18:47 2012 New Revision: 229485 URL: http://svn.freebsd.org/changeset/base/229485 Log: MFC r226882: Fix arguments list for proc:::signal-discard DTrace probe. Reported by: Anton Yuzhaninov Modified: stable/9/sys/kern/kern_sig.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/kern/kern_sig.c ============================================================================== --- stable/9/sys/kern/kern_sig.c Wed Jan 4 14:06:17 2012 (r229484) +++ stable/9/sys/kern/kern_sig.c Wed Jan 4 14:18:47 2012 (r229485) @@ -2058,7 +2058,7 @@ tdsendsignal(struct proc *p, struct thre */ mtx_lock(&ps->ps_mtx); if (SIGISMEMBER(ps->ps_sigignore, sig)) { - SDT_PROBE(proc, kernel, , signal_discard, ps, td, sig, 0, 0 ); + SDT_PROBE(proc, kernel, , signal_discard, td, p, sig, 0, 0 ); mtx_unlock(&ps->ps_mtx); if (ksi && (ksi->ksi_flags & KSI_INS)) From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 14:21:31 2012 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 69857106566B; Wed, 4 Jan 2012 14:21:31 +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 577218FC19; Wed, 4 Jan 2012 14:21:31 +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 q04ELV58081923; Wed, 4 Jan 2012 14:21:31 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04ELV7A081921; Wed, 4 Jan 2012 14:21:31 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201201041421.q04ELV7A081921@svn.freebsd.org> From: Sergey Kandaurov Date: Wed, 4 Jan 2012 14:21:31 +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: r229486 - in stable/8/sys: conf 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, 04 Jan 2012 14:21:31 -0000 Author: pluknet Date: Wed Jan 4 14:21:30 2012 New Revision: 229486 URL: http://svn.freebsd.org/changeset/base/229486 Log: MFC r226882: Fix arguments list for proc:::signal-discard DTrace probe. Reported by: Anton Yuzhaninov Modified: stable/8/sys/kern/kern_sig.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/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/kern/kern_sig.c ============================================================================== --- stable/8/sys/kern/kern_sig.c Wed Jan 4 14:18:47 2012 (r229485) +++ stable/8/sys/kern/kern_sig.c Wed Jan 4 14:21:30 2012 (r229486) @@ -2058,7 +2058,7 @@ tdsignal(struct proc *p, struct thread * */ mtx_lock(&ps->ps_mtx); if (SIGISMEMBER(ps->ps_sigignore, sig)) { - SDT_PROBE(proc, kernel, , signal_discard, ps, td, sig, 0, 0 ); + SDT_PROBE(proc, kernel, , signal_discard, td, p, sig, 0, 0 ); mtx_unlock(&ps->ps_mtx); if (ksi && (ksi->ksi_flags & KSI_INS)) From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 14:26:25 2012 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 03BE9106564A for ; Wed, 4 Jan 2012 14:26:25 +0000 (UTC) (envelope-from pfg@freebsd.org) Received: from nm30-vm0.bullet.mail.sp2.yahoo.com (nm30-vm0.bullet.mail.sp2.yahoo.com [98.139.91.238]) by mx1.freebsd.org (Postfix) with SMTP id B35618FC18 for ; Wed, 4 Jan 2012 14:26:24 +0000 (UTC) Received: from [98.139.91.61] by nm30.bullet.mail.sp2.yahoo.com with NNFMP; 04 Jan 2012 14:26:24 -0000 Received: from [98.139.91.33] by tm1.bullet.mail.sp2.yahoo.com with NNFMP; 04 Jan 2012 14:25:24 -0000 Received: from [127.0.0.1] by omp1033.mail.sp2.yahoo.com with NNFMP; 04 Jan 2012 14:25:24 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 351760.12928.bm@omp1033.mail.sp2.yahoo.com Received: (qmail 14559 invoked by uid 60001); 4 Jan 2012 14:25:23 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1325687123; bh=UHIfQtXJ7B73g6+PbhmUlA6fdgwjitz1KOxS3cg1Ymc=; h=X-YMail-OSG:Received:X-RocketYMMF:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=WcT8gAC4j+GBf2TtHFLbk/VvUegxxVAvlBenuat7fbmamofqLeG7ZNfVptdOK1FqfJ+0h8kFhdm/yS5xpYA4nTcMNr9jZeKayuRlmAAZe8lJKJDbnCreZ/FuRE6//UxxbGDQPYjRP7CJbTfWinu9WgZgGOf0FgpqaH/5W3xILxc= X-YMail-OSG: 3z8yXZQVM1mfrIY4uGhBgaOjrcJuqEpYDqGtXw82HRHO_uX g0VFmP8PDVszKN9Xzghd5U8VvBHyCHeC0fhipYzwKfdyapOnBiI8P_EdYB.t y7anN.avN_gVZNbD79LRQvi8tJZ1qvtqKZRDBsT6Np1.nvP8ps5eZS5XJCrt Hp0TdQVHIJUHdvSfAkpp_VSGRHCwX1WBtsAiJo6o4j.UgA3KMelwGr1kF.99 IHbo0s7842jpokC8PH4AzviT1lvl6S7jMcrH2iTcoB3nKhX6Obf0Z.xmaV5M _hKls9XGEjnHQcdhn56rb.NLgz8.uS4j_q80X45xpVkAbTGS8v6O_55kDI2S TPOAFBmhE9kUa3ysMnU1_QAXanZlZ1ZBYegsKDL2_IGesMwYuj_ATvJb.oh1 zGOHdU53Sgt2DqXVv8eKdvaUCQNgOVdG4oPzanWJ3z5X_6NUjla9BxyOSOCU ZKtItwkhllSxL_IgbByuD1W2Neg-- Received: from [200.118.157.7] by web113504.mail.gq1.yahoo.com via HTTP; Wed, 04 Jan 2012 06:25:23 PST X-RocketYMMF: giffunip X-Mailer: YahooMailClassic/15.0.4 YahooMailWebService/0.8.115.331698 Message-ID: <1325687123.3425.YahooMailClassic@web113504.mail.gq1.yahoo.com> Date: Wed, 4 Jan 2012 06:25:23 -0800 (PST) From: Pedro Giffuni To: Alexey Dokuchaev In-Reply-To: <20120104141141.GA34976@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, John Baldwin , Joel Dahl Subject: Re: svn commit: r229430 - in head/sys: conf dev/sound/pci modules/sound/driver/emu10k1 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: pfg@freebsd.org 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, 04 Jan 2012 14:26:25 -0000 =0A=0A--- Mer 4/1/12, Alexey Dokuchaev ha scritto:=0A..= .=0A> > The only issue is getting rid of the remaining=0A> (small)=0A> > GP= L'd headers. Alternatively this driver is already=0A> available=0A> > as a = port (audio/emu10kx).=0A> =0A> Yes, I am aware of the port existence.=A0 My= point was=0A> to leave just one, BSD licensed, full featured emu10k=0A> dr= iver in the base (i.e. merge emu10k1 and=0A> emu10kx into one).=A0 Good to = know that you're up to=0A> this; I hope we'll get there eventually.=A0 :-)= =0A> =0A=0AWell, when I made the changes for emu10k1 it was easy=0Ato do th= em for emu10kx too but I don't have the card so I=0Aam not really up to it = (sorry). =0A=0AI will be glad to help if someone else is interested.=0A=0AP= edro. From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 14:33:55 2012 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 5EA921065672; Wed, 4 Jan 2012 14:33:55 +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 4C8498FC12; Wed, 4 Jan 2012 14:33: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 q04EXtwJ082363; Wed, 4 Jan 2012 14:33:55 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04EXtaa082361; Wed, 4 Jan 2012 14:33:55 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201201041433.q04EXtaa082361@svn.freebsd.org> From: Sergey Kandaurov Date: Wed, 4 Jan 2012 14:33:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229487 - stable/9/sys/compat/freebsd32 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, 04 Jan 2012 14:33:55 -0000 Author: pluknet Date: Wed Jan 4 14:33:54 2012 New Revision: 229487 URL: http://svn.freebsd.org/changeset/base/229487 Log: MFC r227447: struct timespec32: change types of tv_sec and tv_nsec fields to signed to match native struct timespec ABI on __LP32__. Modified: stable/9/sys/compat/freebsd32/freebsd32.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/compat/freebsd32/freebsd32.h ============================================================================== --- stable/9/sys/compat/freebsd32/freebsd32.h Wed Jan 4 14:21:30 2012 (r229486) +++ stable/9/sys/compat/freebsd32/freebsd32.h Wed Jan 4 14:33:54 2012 (r229487) @@ -52,8 +52,8 @@ struct timeval32 { } while (0) struct timespec32 { - u_int32_t tv_sec; - u_int32_t tv_nsec; + int32_t tv_sec; + int32_t tv_nsec; }; #define TS_CP(src,dst,fld) do { \ CP((src).fld,(dst).fld,tv_sec); \ From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 14:34:46 2012 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 4203B106564A; Wed, 4 Jan 2012 14:34:46 +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 2FD3A8FC17; Wed, 4 Jan 2012 14:34:46 +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 q04EYkMZ082429; Wed, 4 Jan 2012 14:34:46 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04EYjrg082427; Wed, 4 Jan 2012 14:34:45 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201201041434.q04EYjrg082427@svn.freebsd.org> From: Sergey Kandaurov Date: Wed, 4 Jan 2012 14:34:45 +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: r229488 - in stable/8/sys: compat/freebsd32 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: Wed, 04 Jan 2012 14:34:46 -0000 Author: pluknet Date: Wed Jan 4 14:34:45 2012 New Revision: 229488 URL: http://svn.freebsd.org/changeset/base/229488 Log: MFC r227447: struct timespec32: change types of tv_sec and tv_nsec fields to signed to match native struct timespec ABI on __LP32__. Modified: stable/8/sys/compat/freebsd32/freebsd32.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/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/compat/freebsd32/freebsd32.h ============================================================================== --- stable/8/sys/compat/freebsd32/freebsd32.h Wed Jan 4 14:33:54 2012 (r229487) +++ stable/8/sys/compat/freebsd32/freebsd32.h Wed Jan 4 14:34:45 2012 (r229488) @@ -52,8 +52,8 @@ struct timeval32 { } while (0) struct timespec32 { - u_int32_t tv_sec; - u_int32_t tv_nsec; + int32_t tv_sec; + int32_t tv_nsec; }; #define TS_CP(src,dst,fld) do { \ CP((src).fld,(dst).fld,tv_sec); \ From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 14:43:13 2012 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 177D61065670; Wed, 4 Jan 2012 14:43:13 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-ee0-f54.google.com (mail-ee0-f54.google.com [74.125.83.54]) by mx1.freebsd.org (Postfix) with ESMTP id 972D08FC27; Wed, 4 Jan 2012 14:43:11 +0000 (UTC) Received: by eekc50 with SMTP id c50so19870346eek.13 for ; Wed, 04 Jan 2012 06:43:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=2OwleSnXTdza3gej/K6bzidB0aD1J8HZjeTGZCfYVKM=; b=W7ZaqAIptgR9h7v4mRJ3+IibinP92JvcaiuJrc6nS8O4BXksHdJsDh5uc80iQs7s5R Sdk0uGwFvw8TrOc4Mgg9B5iUI2aGnYQxcdAH9sKtay6VKjFelCOXENbDbXw0uxhLcgEp Eq3VHzPfLH0p6GiGaXdy8IGUKCDrJxUGqMoL4= Received: by 10.14.127.68 with SMTP id c44mr23757008eei.47.1325688190355; Wed, 04 Jan 2012 06:43:10 -0800 (PST) Received: from mavbook2.mavhome.dp.ua (pc.mavhome.dp.ua. [212.86.226.226]) by mx.google.com with ESMTPS id e12sm69549991eea.5.2012.01.04.06.43.07 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 04 Jan 2012 06:43:08 -0800 (PST) Sender: Alexander Motin Message-ID: <4F046579.2020502@FreeBSD.org> Date: Wed, 04 Jan 2012 16:43:05 +0200 From: Alexander Motin User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:9.0) Gecko/20111227 Thunderbird/9.0 MIME-Version: 1.0 To: pfg@freebsd.org References: <1325687123.3425.YahooMailClassic@web113504.mail.gq1.yahoo.com> In-Reply-To: <1325687123.3425.YahooMailClassic@web113504.mail.gq1.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Alexey Dokuchaev , src-committers@freebsd.org, John Baldwin , svn-src-all@freebsd.org, Joel Dahl , svn-src-head@freebsd.org Subject: Re: svn commit: r229430 - in head/sys: conf dev/sound/pci modules/sound/driver/emu10k1 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, 04 Jan 2012 14:43:13 -0000 On 01/04/12 16:25, Pedro Giffuni wrote: > --- Mer 4/1/12, Alexey Dokuchaev ha scritto: > ... >>> The only issue is getting rid of the remaining >> (small) >>> GPL'd headers. Alternatively this driver is already >> available >>> as a port (audio/emu10kx). >> >> Yes, I am aware of the port existence. My point was >> to leave just one, BSD licensed, full featured emu10k >> driver in the base (i.e. merge emu10k1 and >> emu10kx into one). Good to know that you're up to >> this; I hope we'll get there eventually. :-) > > Well, when I made the changes for emu10k1 it was easy > to do them for emu10kx too but I don't have the card so I > am not really up to it (sorry). > > I will be glad to help if someone else is interested. I have Audigy2ZS (model SB0350) in my table if any help with testing needed, but I've never looked into emu10k code, preferring to hack more widespread and documented HDA. -- Alexander Motin From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 14:47:33 2012 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 44D671065670; Wed, 4 Jan 2012 14:47:33 +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 32A618FC0C; Wed, 4 Jan 2012 14:47:33 +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 q04ElX21082880; Wed, 4 Jan 2012 14:47:33 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04ElWmQ082878; Wed, 4 Jan 2012 14:47:33 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201201041447.q04ElWmQ082878@svn.freebsd.org> From: Sergey Kandaurov Date: Wed, 4 Jan 2012 14:47:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229489 - stable/9/lib/libc/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: Wed, 04 Jan 2012 14:47:33 -0000 Author: pluknet Date: Wed Jan 4 14:47:32 2012 New Revision: 229489 URL: http://svn.freebsd.org/changeset/base/229489 Log: MFC r227792: Add history for setsockopt(2). PR: docs/162719 Submitted by: Niclas Zeising Modified: stable/9/lib/libc/sys/getsockopt.2 Directory Properties: stable/9/lib/libc/ (props changed) stable/9/lib/libc/gen/ (props changed) stable/9/lib/libc/stdtime/ (props changed) Modified: stable/9/lib/libc/sys/getsockopt.2 ============================================================================== --- stable/9/lib/libc/sys/getsockopt.2 Wed Jan 4 14:34:45 2012 (r229488) +++ stable/9/lib/libc/sys/getsockopt.2 Wed Jan 4 14:47:32 2012 (r229489) @@ -28,7 +28,7 @@ .\" @(#)getsockopt.2 8.4 (Berkeley) 5/2/95 .\" $FreeBSD$ .\" -.Dd June 13, 2008 +.Dd November 21, 2011 .Dt GETSOCKOPT 2 .Os .Sh NAME @@ -533,7 +533,9 @@ on a non-listening socket was attempted. .Sh HISTORY The .Fn getsockopt -system call appeared in +and +.Fn setsockopt +system calls appeared in .Bx 4.2 . .Sh BUGS Several of the socket options should be handled at lower levels of the system. From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 14:49:29 2012 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 DC2211065673; Wed, 4 Jan 2012 14:49:29 +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 CA1C68FC0C; Wed, 4 Jan 2012 14:49: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 q04EnTw6082976; Wed, 4 Jan 2012 14:49:29 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04EnTPi082974; Wed, 4 Jan 2012 14:49:29 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201201041449.q04EnTPi082974@svn.freebsd.org> From: Sergey Kandaurov Date: Wed, 4 Jan 2012 14:49:29 +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: r229490 - stable/8/lib/libc/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: Wed, 04 Jan 2012 14:49:30 -0000 Author: pluknet Date: Wed Jan 4 14:49:29 2012 New Revision: 229490 URL: http://svn.freebsd.org/changeset/base/229490 Log: MFC r227792: Add history for setsockopt(2). PR: docs/162719 Submitted by: Niclas Zeising Modified: stable/8/lib/libc/sys/getsockopt.2 Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libc/stdtime/ (props changed) Modified: stable/8/lib/libc/sys/getsockopt.2 ============================================================================== --- stable/8/lib/libc/sys/getsockopt.2 Wed Jan 4 14:47:32 2012 (r229489) +++ stable/8/lib/libc/sys/getsockopt.2 Wed Jan 4 14:49:29 2012 (r229490) @@ -28,7 +28,7 @@ .\" @(#)getsockopt.2 8.4 (Berkeley) 5/2/95 .\" $FreeBSD$ .\" -.Dd June 13, 2008 +.Dd November 21, 2011 .Dt GETSOCKOPT 2 .Os .Sh NAME @@ -515,7 +515,9 @@ on a non-listening socket was attempted. .Sh HISTORY The .Fn getsockopt -system call appeared in +and +.Fn setsockopt +system calls appeared in .Bx 4.2 . .Sh BUGS Several of the socket options should be handled at lower levels of the system. From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 14:52:18 2012 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 43498106566B; Wed, 4 Jan 2012 14:52:18 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-tul01m020-f182.google.com (mail-tul01m020-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 9E0CB8FC0A; Wed, 4 Jan 2012 14:52:17 +0000 (UTC) Received: by obbwd18 with SMTP id wd18so20436386obb.13 for ; Wed, 04 Jan 2012 06:52:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=NIDrei+btHo6CiGr6RiD7fybKWfkmAYgV5RVb2PnLss=; b=JZtkqV/NZB01y0qmngy7LfaNKlW5tZmevZlNQGOvElbCsDZwg9wez9tjQ8LD7sYeKx cw+QYyCWHiHSscVYjuVaA7NaZOflHV0oLgR9BY9waY/TX/J/jICkfzuV4efHGYxMtEDF WM69rG0dSrJwROvlsYXKiMRhzuBGuI4pZMW4M= MIME-Version: 1.0 Received: by 10.182.1.67 with SMTP id 3mr48580510obk.31.1325688737053; Wed, 04 Jan 2012 06:52:17 -0800 (PST) Received: by 10.182.152.6 with HTTP; Wed, 4 Jan 2012 06:52:17 -0800 (PST) In-Reply-To: <4F046579.2020502@FreeBSD.org> References: <1325687123.3425.YahooMailClassic@web113504.mail.gq1.yahoo.com> <4F046579.2020502@FreeBSD.org> Date: Wed, 4 Jan 2012 06:52:17 -0800 Message-ID: From: Garrett Cooper To: Alexander Motin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Alexey Dokuchaev , src-committers@freebsd.org, John Baldwin , svn-src-all@freebsd.org, pfg@freebsd.org, Joel Dahl , svn-src-head@freebsd.org Subject: Re: svn commit: r229430 - in head/sys: conf dev/sound/pci modules/sound/driver/emu10k1 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, 04 Jan 2012 14:52:18 -0000 On Wed, Jan 4, 2012 at 6:43 AM, Alexander Motin wrote: > On 01/04/12 16:25, Pedro Giffuni wrote: >> >> --- Mer 4/1/12, Alexey Dokuchaev =A0ha scritto: >> ... >>>> >>>> The only issue is getting rid of the remaining >>> >>> (small) >>>> >>>> GPL'd headers. Alternatively this driver is already >>> >>> available >>>> >>>> as a port (audio/emu10kx). >>> >>> >>> Yes, I am aware of the port existence. =A0My point was >>> to leave just one, BSD licensed, full featured emu10k >>> driver in the base (i.e. merge emu10k1 and >>> emu10kx into one). =A0Good to know that you're up to >>> this; I hope we'll get there eventually. =A0:-) >> >> >> Well, when I made the changes for emu10k1 it was easy >> to do them for emu10kx too but I don't have the card so I >> am not really up to it (sorry). >> >> I will be glad to help if someone else is interested. > > > I have Audigy2ZS (model SB0350) in my table if any help with testing need= ed, > but I've never looked into emu10k code, preferring to hack more widesprea= d > and documented HDA. I have an Audigy 4 I can slap into the machine at work. Thanks, -Garrett From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 14:55:25 2012 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 2CF27106564A; Wed, 4 Jan 2012 14:55:25 +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 1AA008FC12; Wed, 4 Jan 2012 14:55:25 +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 q04EtOTH083214; Wed, 4 Jan 2012 14:55:24 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04EtOYv083212; Wed, 4 Jan 2012 14:55:24 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201201041455.q04EtOYv083212@svn.freebsd.org> From: Sergey Kandaurov Date: Wed, 4 Jan 2012 14:55: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: r229491 - stable/7/lib/libc/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: Wed, 04 Jan 2012 14:55:25 -0000 Author: pluknet Date: Wed Jan 4 14:55:24 2012 New Revision: 229491 URL: http://svn.freebsd.org/changeset/base/229491 Log: MFC r227792: Add history for setsockopt(2). PR: docs/162719 Submitted by: Niclas Zeising Modified: stable/7/lib/libc/sys/getsockopt.2 Directory Properties: stable/7/lib/libc/ (props changed) stable/7/lib/libc/stdtime/ (props changed) Modified: stable/7/lib/libc/sys/getsockopt.2 ============================================================================== --- stable/7/lib/libc/sys/getsockopt.2 Wed Jan 4 14:49:29 2012 (r229490) +++ stable/7/lib/libc/sys/getsockopt.2 Wed Jan 4 14:55:24 2012 (r229491) @@ -28,7 +28,7 @@ .\" @(#)getsockopt.2 8.4 (Berkeley) 5/2/95 .\" $FreeBSD$ .\" -.Dd March 8, 2007 +.Dd November 21, 2011 .Dt GETSOCKOPT 2 .Os .Sh NAME @@ -479,7 +479,9 @@ on a non-listening socket was attempted. .Sh HISTORY The .Fn getsockopt -system call appeared in +and +.Fn setsockopt +system calls appeared in .Bx 4.2 . .Sh BUGS Several of the socket options should be handled at lower levels of the system. From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 15:26:02 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1033) id 450671065672; Wed, 4 Jan 2012 15:26:02 +0000 (UTC) Date: Wed, 4 Jan 2012 15:26:02 +0000 From: Alexey Dokuchaev To: Garrett Cooper Message-ID: <20120104152602.GA46922@FreeBSD.org> References: <1325687123.3425.YahooMailClassic@web113504.mail.gq1.yahoo.com> <4F046579.2020502@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.1i Cc: src-committers@freebsd.org, John Baldwin , Alexander Motin , pfg@freebsd.org, Joel Dahl , svn-src-head@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r229430 - in head/sys: conf dev/sound/pci modules/sound/driver/emu10k1 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, 04 Jan 2012 15:26:02 -0000 On Wed, Jan 04, 2012 at 06:52:17AM -0800, Garrett Cooper wrote: > On Wed, Jan 4, 2012 at 6:43 AM, Alexander Motin wrote: > > I have Audigy2ZS (model SB0350) in my table if any help with testing > > needed, but I've never looked into emu10k code, preferring to hack more > > widespread and documented HDA. > > I have an Audigy 4 I can slap into the machine at work. OK, how about this: I have an E-MU 1212m. Any takers? :-) ./danfe From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 15:58:36 2012 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 D0F9E106564A; Wed, 4 Jan 2012 15:58:36 +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 BE8688FC08; Wed, 4 Jan 2012 15:58:36 +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 q04Fwacd085216; Wed, 4 Jan 2012 15:58:36 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04Fwa2t085214; Wed, 4 Jan 2012 15:58:36 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201201041558.q04Fwa2t085214@svn.freebsd.org> From: Sergey Kandaurov Date: Wed, 4 Jan 2012 15:58:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229492 - stable/9/sys/boot/common 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, 04 Jan 2012 15:58:36 -0000 Author: pluknet Date: Wed Jan 4 15:58:35 2012 New Revision: 229492 URL: http://svn.freebsd.org/changeset/base/229492 Log: MFC r228916: Clean up from the 4.x era. In an example of boot command: - rename wd(4) IDE disk drives name to ad(4) for the time being. - update the used kernel path "/kernel" to the current default. Bump .Dd for this and previous changes. Modified: stable/9/sys/boot/common/loader.8 Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/boot/common/loader.8 ============================================================================== --- stable/9/sys/boot/common/loader.8 Wed Jan 4 14:55:24 2012 (r229491) +++ stable/9/sys/boot/common/loader.8 Wed Jan 4 15:58:35 2012 (r229492) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 15, 2009 +.Dd December 27, 2011 .Dt LOADER 8 .Os .Sh NAME @@ -926,10 +926,10 @@ autoboot 5 .Pp Set the disk unit of the root device to 2, and then boot. This would be needed in a system with two IDE disks, -with the second IDE disk hardwired to wd2 instead of wd1. +with the second IDE disk hardwired to ad2 instead of ad1. .Bd -literal -offset indent set root_disk_unit=2 -boot /kernel +boot /boot/kernel/kernel .Ed .Pp See also: From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 15:59:49 2012 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 D3D51106564A; Wed, 4 Jan 2012 15:59:49 +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 C14268FC16; Wed, 4 Jan 2012 15:59: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 q04Fxns4085284; Wed, 4 Jan 2012 15:59:49 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04Fxnep085282; Wed, 4 Jan 2012 15:59:49 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201201041559.q04Fxnep085282@svn.freebsd.org> From: Sergey Kandaurov Date: Wed, 4 Jan 2012 15:59:49 +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: r229493 - in stable/8/sys: boot/common 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: Wed, 04 Jan 2012 15:59:49 -0000 Author: pluknet Date: Wed Jan 4 15:59:49 2012 New Revision: 229493 URL: http://svn.freebsd.org/changeset/base/229493 Log: MFC r228916: Clean up from the 4.x era. In an example of boot command: - rename wd(4) IDE disk drives name to ad(4). - update the used kernel path "/kernel" to the current default. Bump .Dd for this and previous changes. Modified: stable/8/sys/boot/common/loader.8 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/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/boot/common/loader.8 ============================================================================== --- stable/8/sys/boot/common/loader.8 Wed Jan 4 15:58:35 2012 (r229492) +++ stable/8/sys/boot/common/loader.8 Wed Jan 4 15:59:49 2012 (r229493) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 15, 2009 +.Dd December 27, 2011 .Dt LOADER 8 .Os .Sh NAME @@ -933,10 +933,10 @@ autoboot 5 .Pp Set the disk unit of the root device to 2, and then boot. This would be needed in a system with two IDE disks, -with the second IDE disk hardwired to wd2 instead of wd1. +with the second IDE disk hardwired to ad2 instead of ad1. .Bd -literal -offset indent set root_disk_unit=2 -boot /kernel +boot /boot/kernel/kernel .Ed .Pp See also: From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 16:02:52 2012 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 B08F0106564A; Wed, 4 Jan 2012 16:02:52 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9F0518FC08; Wed, 4 Jan 2012 16:02:52 +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 q04G2qSH085437; Wed, 4 Jan 2012 16:02:52 GMT (envelope-from andreast@svn.freebsd.org) Received: (from andreast@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04G2qjX085435; Wed, 4 Jan 2012 16:02:52 GMT (envelope-from andreast@svn.freebsd.org) Message-Id: <201201041602.q04G2qjX085435@svn.freebsd.org> From: Andreas Tobler Date: Wed, 4 Jan 2012 16:02:52 +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: r229494 - head/sys/powerpc/include 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, 04 Jan 2012 16:02:52 -0000 Author: andreast Date: Wed Jan 4 16:02:52 2012 New Revision: 229494 URL: http://svn.freebsd.org/changeset/base/229494 Log: Introduce internal macros for __U/INT64_C to define the U/INT64_MAX/MIN values properly. The previous definition only worked if __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS were defined at the same time. Modified: head/sys/powerpc/include/_stdint.h Modified: head/sys/powerpc/include/_stdint.h ============================================================================== --- head/sys/powerpc/include/_stdint.h Wed Jan 4 15:59:49 2012 (r229493) +++ head/sys/powerpc/include/_stdint.h Wed Jan 4 16:02:52 2012 (r229494) @@ -65,6 +65,14 @@ #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) +#ifdef __LP64__ +#define __INT64_C(c) (c ## L) +#define __UINT64_C(c) (c ## UL) +#else +#define __INT64_C(c) (c ## LL) +#define __UINT64_C(c) (c ## ULL) +#endif + /* * ISO/IEC 9899:1999 * 7.18.2.1 Limits of exact-width integer types @@ -73,19 +81,19 @@ #define INT8_MIN (-0x7f-1) #define INT16_MIN (-0x7fff-1) #define INT32_MIN (-0x7fffffff-1) -#define INT64_MIN (-INT64_C(0x7fffffffffffffff)-1) +#define INT64_MIN (-__INT64_C(0x7fffffffffffffff)-1) /* Maximum values of exact-width signed integer types. */ #define INT8_MAX 0x7f #define INT16_MAX 0x7fff #define INT32_MAX 0x7fffffff -#define INT64_MAX INT64_C(0x7fffffffffffffff) +#define INT64_MAX __INT64_C(0x7fffffffffffffff) /* Maximum values of exact-width unsigned integer types. */ #define UINT8_MAX 0xff #define UINT16_MAX 0xffff #define UINT32_MAX 0xffffffff -#define UINT64_MAX UINT64_C(0xffffffffffffffff) +#define UINT64_MAX __UINT64_C(0xffffffffffffffff) /* * ISO/IEC 9899:1999 From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 16:04:20 2012 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 D2767106564A; Wed, 4 Jan 2012 16:04:20 +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 C177A8FC23; Wed, 4 Jan 2012 16:04:20 +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 q04G4KBC085519; Wed, 4 Jan 2012 16:04:20 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04G4KoP085517; Wed, 4 Jan 2012 16:04:20 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201041604.q04G4KoP085517@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 4 Jan 2012 16:04:20 +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: r229495 - head/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: Wed, 04 Jan 2012 16:04:20 -0000 Author: kib Date: Wed Jan 4 16:04:20 2012 New Revision: 229495 URL: http://svn.freebsd.org/changeset/base/229495 Log: Do not restart the scan in vm_object_page_clean() on the object generation change if requested mode is async. The object generation is only changed when the object is marked as OBJ_MIGHTBEDIRTY. For async mode it is enough to write each dirty page, not to make a guarantee that all pages are cleared after the vm_object_page_clean() returned. Diagnosed by: truckman Tested by: flo Reviewed by: alc, truckman MFC after: 2 weeks Modified: head/sys/vm/vm_object.c Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Wed Jan 4 16:02:52 2012 (r229494) +++ head/sys/vm/vm_object.c Wed Jan 4 16:04:20 2012 (r229495) @@ -841,8 +841,12 @@ rescan: if (p->valid == 0) continue; if (vm_page_sleep_if_busy(p, TRUE, "vpcwai")) { - if (object->generation != curgeneration) - goto rescan; + if (object->generation != curgeneration) { + if ((flags & OBJPC_SYNC) != 0) + goto rescan; + else + clearobjflags = 0; + } np = vm_page_find_least(object, pi); continue; } @@ -851,8 +855,12 @@ rescan: n = vm_object_page_collect_flush(object, p, pagerflags, flags, &clearobjflags); - if (object->generation != curgeneration) - goto rescan; + if (object->generation != curgeneration) { + if ((flags & OBJPC_SYNC) != 0) + goto rescan; + else + clearobjflags = 0; + } /* * If the VOP_PUTPAGES() did a truncated write, so From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 16:07:16 2012 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 C9BB1106566B; Wed, 4 Jan 2012 16:07:16 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B83848FC19; Wed, 4 Jan 2012 16:07: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 q04G7G7Y085645; Wed, 4 Jan 2012 16:07:16 GMT (envelope-from andreast@svn.freebsd.org) Received: (from andreast@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04G7GqM085643; Wed, 4 Jan 2012 16:07:16 GMT (envelope-from andreast@svn.freebsd.org) Message-Id: <201201041607.q04G7GqM085643@svn.freebsd.org> From: Andreas Tobler Date: Wed, 4 Jan 2012 16:07: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: r229496 - head/sys/mips/include 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, 04 Jan 2012 16:07:16 -0000 Author: andreast Date: Wed Jan 4 16:07:16 2012 New Revision: 229496 URL: http://svn.freebsd.org/changeset/base/229496 Log: Apply the same change as in r229494. Requested by: ed Modified: head/sys/mips/include/_stdint.h Modified: head/sys/mips/include/_stdint.h ============================================================================== --- head/sys/mips/include/_stdint.h Wed Jan 4 16:04:20 2012 (r229495) +++ head/sys/mips/include/_stdint.h Wed Jan 4 16:07:16 2012 (r229496) @@ -66,6 +66,14 @@ #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) +#ifdef __mips_n64 +#define __INT64_C(c) (c ## L) +#define __UINT64_C(c) (c ## UL) +#else +#define __INT64_C(c) (c ## LL) +#define __UINT64_C(c) (c ## ULL) +#endif + /* * ISO/IEC 9899:1999 * 7.18.2.1 Limits of exact-width integer types @@ -74,19 +82,19 @@ #define INT8_MIN (-0x7f-1) #define INT16_MIN (-0x7fff-1) #define INT32_MIN (-0x7fffffff-1) -#define INT64_MIN (-INT64_C(0x7fffffffffffffff)-1) +#define INT64_MIN (-__INT64_C(0x7fffffffffffffff)-1) /* Maximum values of exact-width signed integer types. */ #define INT8_MAX 0x7f #define INT16_MAX 0x7fff #define INT32_MAX 0x7fffffff -#define INT64_MAX INT64_C(0x7fffffffffffffff) +#define INT64_MAX __INT64_C(0x7fffffffffffffff) /* Maximum values of exact-width unsigned integer types. */ #define UINT8_MAX 0xff #define UINT16_MAX 0xffff #define UINT32_MAX 0xffffffff -#define UINT64_MAX UINT64_C(0xffffffffffffffff) +#define UINT64_MAX __UINT64_C(0xffffffffffffffff) /* * ISO/IEC 9899:1999 From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 16:20:56 2012 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 8840C106564A; Wed, 4 Jan 2012 16:20:56 +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 74B708FC19; Wed, 4 Jan 2012 16:20: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 q04GKu1f086205; Wed, 4 Jan 2012 16:20:56 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04GKupF086196; Wed, 4 Jan 2012 16:20:56 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201041620.q04GKupF086196@svn.freebsd.org> From: John Baldwin Date: Wed, 4 Jan 2012 16:20: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: r229497 - in stable/8/sys: conf modules modules/ipfw netinet/ipfw 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, 04 Jan 2012 16:20:56 -0000 Author: jhb Date: Wed Jan 4 16:20:55 2012 New Revision: 229497 URL: http://svn.freebsd.org/changeset/base/229497 Log: MFC 225518,225793,227085: Allow the ipfw.ko module built with a kernel to honor any options defined in the kernel config. This more closely matches the behavior of other modules which inherit configuration settings from the kernel configuration during a kernel + modules build. Do not try to build the module in case of no INET support but keep #error calls for now in case we would compile it into the kernel. While here garbage collect unneeded opt_*.h includes. opt_ipdn.h is not used anywhere but we need to leave the DUMMYNET entry in options for conditional inclusion in kernel so keep the file with the same name. Modified: stable/8/sys/modules/Makefile stable/8/sys/modules/ipfw/Makefile stable/8/sys/netinet/ipfw/ip_fw2.c stable/8/sys/netinet/ipfw/ip_fw_dynamic.c stable/8/sys/netinet/ipfw/ip_fw_log.c stable/8/sys/netinet/ipfw/ip_fw_pfil.c stable/8/sys/netinet/ipfw/ip_fw_sockopt.c stable/8/sys/netinet/ipfw/ip_fw_table.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/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/modules/Makefile ============================================================================== --- stable/8/sys/modules/Makefile Wed Jan 4 16:07:16 2012 (r229496) +++ stable/8/sys/modules/Makefile Wed Jan 4 16:20:55 2012 (r229497) @@ -134,7 +134,7 @@ SUBDIR= ${_3dfx} \ ${_io} \ ipdivert \ ${_ipfilter} \ - ipfw \ + ${_ipfw} \ ipfw_nat \ ${_ipmi} \ ip_mroute_mod \ @@ -366,6 +366,10 @@ _random= random _ipfilter= ipfilter .endif +.if ${MK_INET_SUPPORT} != "no" || defined(ALL_MODULES) +_ipfw= ipfw +.endif + .if ${MK_NETGRAPH} != "no" || defined(ALL_MODULES) _netgraph= netgraph .endif Modified: stable/8/sys/modules/ipfw/Makefile ============================================================================== --- stable/8/sys/modules/ipfw/Makefile Wed Jan 4 16:07:16 2012 (r229496) +++ stable/8/sys/modules/ipfw/Makefile Wed Jan 4 16:20:55 2012 (r229497) @@ -8,7 +8,7 @@ KMOD= ipfw SRCS= ip_fw2.c ip_fw_pfil.c SRCS+= ip_fw_dynamic.c ip_fw_log.c SRCS+= ip_fw_sockopt.c ip_fw_table.c -SRCS+= opt_inet6.h opt_ipsec.h +SRCS+= opt_inet.h opt_inet6.h opt_ipdivert.h opt_ipfw.h opt_ipsec.h CFLAGS+= -DIPFIREWALL CFLAGS+= -I${.CURDIR}/../../contrib/pf @@ -22,6 +22,10 @@ CFLAGS+= -I${.CURDIR}/../../contrib/pf # .if !defined(KERNBUILDDIR) +.if ${MK_INET_SUPPORT} != "no" +opt_inet.h: + echo "#define INET 1" > ${.TARGET} +.endif .if ${MK_INET6_SUPPORT} != "no" opt_inet6.h: echo "#define INET6 1" > ${.TARGET} Modified: stable/8/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- stable/8/sys/netinet/ipfw/ip_fw2.c Wed Jan 4 16:07:16 2012 (r229496) +++ stable/8/sys/netinet/ipfw/ip_fw2.c Wed Jan 4 16:20:55 2012 (r229497) @@ -30,15 +30,12 @@ __FBSDID("$FreeBSD$"); * The FreeBSD IP packet firewall, main file */ -#if !defined(KLD_MODULE) #include "opt_ipfw.h" #include "opt_ipdivert.h" -#include "opt_ipdn.h" #include "opt_inet.h" #ifndef INET #error IPFIREWALL requires INET. #endif /* INET */ -#endif #include "opt_inet6.h" #include "opt_ipsec.h" Modified: stable/8/sys/netinet/ipfw/ip_fw_dynamic.c ============================================================================== --- stable/8/sys/netinet/ipfw/ip_fw_dynamic.c Wed Jan 4 16:07:16 2012 (r229496) +++ stable/8/sys/netinet/ipfw/ip_fw_dynamic.c Wed Jan 4 16:20:55 2012 (r229497) @@ -33,17 +33,12 @@ __FBSDID("$FreeBSD$"); * Dynamic rule support for ipfw */ -#if !defined(KLD_MODULE) #include "opt_ipfw.h" -#include "opt_ipdivert.h" -#include "opt_ipdn.h" #include "opt_inet.h" #ifndef INET #error IPFIREWALL requires INET. #endif /* INET */ -#endif #include "opt_inet6.h" -#include "opt_ipsec.h" #include #include Modified: stable/8/sys/netinet/ipfw/ip_fw_log.c ============================================================================== --- stable/8/sys/netinet/ipfw/ip_fw_log.c Wed Jan 4 16:07:16 2012 (r229496) +++ stable/8/sys/netinet/ipfw/ip_fw_log.c Wed Jan 4 16:20:55 2012 (r229497) @@ -30,17 +30,12 @@ __FBSDID("$FreeBSD$"); * Logging support for ipfw */ -#if !defined(KLD_MODULE) #include "opt_ipfw.h" -#include "opt_ipdivert.h" -#include "opt_ipdn.h" #include "opt_inet.h" #ifndef INET #error IPFIREWALL requires INET. #endif /* INET */ -#endif #include "opt_inet6.h" -#include "opt_ipsec.h" #include #include Modified: stable/8/sys/netinet/ipfw/ip_fw_pfil.c ============================================================================== --- stable/8/sys/netinet/ipfw/ip_fw_pfil.c Wed Jan 4 16:07:16 2012 (r229496) +++ stable/8/sys/netinet/ipfw/ip_fw_pfil.c Wed Jan 4 16:20:55 2012 (r229497) @@ -27,15 +27,12 @@ #include __FBSDID("$FreeBSD$"); -#if !defined(KLD_MODULE) #include "opt_ipfw.h" -#include "opt_ipdn.h" #include "opt_inet.h" +#include "opt_inet6.h" #ifndef INET #error IPFIREWALL requires INET. #endif /* INET */ -#endif /* KLD_MODULE */ -#include "opt_inet6.h" #include #include @@ -150,7 +147,7 @@ again: /* next_hop may be set by ipfw_chk */ if (args.next_hop == NULL) break; /* pass */ -#ifndef IPFIREWALL_FORWARD +#if !defined(IPFIREWALL_FORWARD) || (!defined(INET6) && !defined(INET)) ret = EACCES; #else { @@ -178,7 +175,7 @@ again: if (in_localip(args.next_hop->sin_addr)) (*m0)->m_flags |= M_FASTFWD_OURS; } -#endif +#endif /* IPFIREWALL_FORWARD */ break; case IP_FW_DENY: Modified: stable/8/sys/netinet/ipfw/ip_fw_sockopt.c ============================================================================== --- stable/8/sys/netinet/ipfw/ip_fw_sockopt.c Wed Jan 4 16:07:16 2012 (r229496) +++ stable/8/sys/netinet/ipfw/ip_fw_sockopt.c Wed Jan 4 16:20:55 2012 (r229497) @@ -33,17 +33,12 @@ __FBSDID("$FreeBSD$"); * the upper half of the ipfw code. */ -#if !defined(KLD_MODULE) #include "opt_ipfw.h" -#include "opt_ipdivert.h" -#include "opt_ipdn.h" #include "opt_inet.h" #ifndef INET #error IPFIREWALL requires INET. #endif /* INET */ -#endif #include "opt_inet6.h" -#include "opt_ipsec.h" #include #include Modified: stable/8/sys/netinet/ipfw/ip_fw_table.c ============================================================================== --- stable/8/sys/netinet/ipfw/ip_fw_table.c Wed Jan 4 16:07:16 2012 (r229496) +++ stable/8/sys/netinet/ipfw/ip_fw_table.c Wed Jan 4 16:20:55 2012 (r229497) @@ -39,17 +39,12 @@ __FBSDID("$FreeBSD$"); * from userland, because operations are typically fast. */ -#if !defined(KLD_MODULE) #include "opt_ipfw.h" -#include "opt_ipdivert.h" -#include "opt_ipdn.h" #include "opt_inet.h" #ifndef INET #error IPFIREWALL requires INET. #endif /* INET */ -#endif #include "opt_inet6.h" -#include "opt_ipsec.h" #include #include From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 16:24:33 2012 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 EFF10106566B; Wed, 4 Jan 2012 16:24:33 +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 C44F58FC08; Wed, 4 Jan 2012 16:24:33 +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 q04GOX07086385; Wed, 4 Jan 2012 16:24:33 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04GOXZA086384; Wed, 4 Jan 2012 16:24:33 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201041624.q04GOXZA086384@svn.freebsd.org> From: John Baldwin Date: Wed, 4 Jan 2012 16:24:33 +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: r229498 - stable/8/sys/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: Wed, 04 Jan 2012 16:24:34 -0000 Author: jhb Date: Wed Jan 4 16:24:33 2012 New Revision: 229498 URL: http://svn.freebsd.org/changeset/base/229498 Log: Remove unnecessary mergeinfo from these two files. Modified: Directory Properties: stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 16:26:46 2012 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 330BB106566C; Wed, 4 Jan 2012 16:26:46 +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 06CD08FC0A; Wed, 4 Jan 2012 16:26:46 +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 q04GQjcm086488; Wed, 4 Jan 2012 16:26:45 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04GQjXQ086486; Wed, 4 Jan 2012 16:26:45 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201041626.q04GQjXQ086486@svn.freebsd.org> From: John Baldwin Date: Wed, 4 Jan 2012 16:26:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229499 - stable/9/sys/x86/acpica 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, 04 Jan 2012 16:26:46 -0000 Author: jhb Date: Wed Jan 4 16:26:45 2012 New Revision: 229499 URL: http://svn.freebsd.org/changeset/base/229499 Log: MFC 226039: Ignore SRAT memory entries if the memory range does not overlap with an existing phys_avail[] entry. If a hw.physmem setting causes a memory domain to not be present in phys_avail[], the SRAT table will now be ignored rather than triggering a panic when a CPU in the missing domain tries to allocate a page. Modified: stable/9/sys/x86/acpica/srat.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/x86/acpica/srat.c ============================================================================== --- stable/9/sys/x86/acpica/srat.c Wed Jan 4 16:24:33 2012 (r229498) +++ stable/9/sys/x86/acpica/srat.c Wed Jan 4 16:26:45 2012 (r229499) @@ -59,6 +59,26 @@ static vm_paddr_t srat_physaddr; static void srat_walk_table(acpi_subtable_handler *handler, void *arg); +/* + * Returns true if a memory range overlaps with at least one range in + * phys_avail[]. + */ +static int +overlaps_phys_avail(vm_paddr_t start, vm_paddr_t end) +{ + int i; + + for (i = 0; phys_avail[i] != 0 && phys_avail[i + 1] != 0; i += 2) { + if (phys_avail[i + 1] < start) + continue; + if (phys_avail[i] < end) + return (1); + break; + } + return (0); + +} + static void srat_parse_entry(ACPI_SUBTABLE_HEADER *entry, void *arg) { @@ -111,6 +131,12 @@ srat_parse_entry(ACPI_SUBTABLE_HEADER *e "enabled" : "disabled"); if (!(mem->Flags & ACPI_SRAT_MEM_ENABLED)) break; + if (!overlaps_phys_avail(mem->BaseAddress, + mem->BaseAddress + mem->Length)) { + printf("SRAT: Ignoring memory at addr %jx\n", + (uintmax_t)mem->BaseAddress); + break; + } if (num_mem == VM_PHYSSEG_MAX) { printf("SRAT: Too many memory regions\n"); *(int *)arg = ENXIO; From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 16:29:46 2012 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 6A96B106566B; Wed, 4 Jan 2012 16:29:46 +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 3DF2C8FC0A; Wed, 4 Jan 2012 16:29:46 +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 q04GTkCL086646; Wed, 4 Jan 2012 16:29:46 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04GTkFe086643; Wed, 4 Jan 2012 16:29:46 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201041629.q04GTkFe086643@svn.freebsd.org> From: John Baldwin Date: Wed, 4 Jan 2012 16:29:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229500 - stable/9/sys/compat/freebsd32 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, 04 Jan 2012 16:29:46 -0000 Author: jhb Date: Wed Jan 4 16:29:45 2012 New Revision: 229500 URL: http://svn.freebsd.org/changeset/base/229500 Log: MFC 226364: Use PAIR32TO64() for the offset and length parameters to freebsd32_posix_fallocate() to properly handle big-endian platforms. Modified: stable/9/sys/compat/freebsd32/freebsd32_misc.c stable/9/sys/compat/freebsd32/syscalls.master Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- stable/9/sys/compat/freebsd32/freebsd32_misc.c Wed Jan 4 16:26:45 2012 (r229499) +++ stable/9/sys/compat/freebsd32/freebsd32_misc.c Wed Jan 4 16:29:45 2012 (r229500) @@ -2811,7 +2811,7 @@ freebsd32_posix_fallocate(struct thread struct posix_fallocate_args ap; ap.fd = uap->fd; - ap.offset = (uap->offsetlo | ((off_t)uap->offsethi << 32)); - ap.len = (uap->lenlo | ((off_t)uap->lenhi << 32)); + ap.offset = PAIR32TO64(off_t, uap->offset); + ap.len = PAIR32TO64(off_t, uap->len); return (sys_posix_fallocate(td, &ap)); } Modified: stable/9/sys/compat/freebsd32/syscalls.master ============================================================================== --- stable/9/sys/compat/freebsd32/syscalls.master Wed Jan 4 16:26:45 2012 (r229499) +++ stable/9/sys/compat/freebsd32/syscalls.master Wed Jan 4 16:29:45 2012 (r229500) @@ -989,6 +989,6 @@ size_t inbuflen, void *outbufp, \ size_t outbuflen); } 530 AUE_NULL STD { int freebsd32_posix_fallocate(int fd,\ - uint32_t offsetlo, uint32_t offsethi,\ - uint32_t lenlo, uint32_t lenhi); } + uint32_t offset1, uint32_t offset2,\ + uint32_t len1, uint32_t len2); } 531 AUE_NULL UNIMPL posix_fadvise From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 16:39:40 2012 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 611D71065670; Wed, 4 Jan 2012 16:39:40 +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 45C328FC13; Wed, 4 Jan 2012 16:39:40 +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 q04GdeDK087040; Wed, 4 Jan 2012 16:39:40 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04GddBs087024; Wed, 4 Jan 2012 16:39:39 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201041639.q04GddBs087024@svn.freebsd.org> From: John Baldwin Date: Wed, 4 Jan 2012 16:39:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229501 - in stable/9/sys/boot: i386/boot2 i386/btx/lib i386/common i386/libi386 pc98/boot2 pc98/btx/lib pc98/libpc98 pc98/loader 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, 04 Jan 2012 16:39:40 -0000 Author: jhb Date: Wed Jan 4 16:39:39 2012 New Revision: 229501 URL: http://svn.freebsd.org/changeset/base/229501 Log: MFC 226746: Consolidate duplicate definitions of V86_CY() and V86_ZR() which check for the carry and zero flags being set, respectively, in and use them throughout the x86 boot code. Modified: stable/9/sys/boot/i386/boot2/boot2.c stable/9/sys/boot/i386/btx/lib/btxv86.h stable/9/sys/boot/i386/common/cons.c stable/9/sys/boot/i386/common/drv.c stable/9/sys/boot/i386/libi386/bioscd.c stable/9/sys/boot/i386/libi386/biosdisk.c stable/9/sys/boot/i386/libi386/biosmem.c stable/9/sys/boot/i386/libi386/biospci.c stable/9/sys/boot/i386/libi386/biossmap.c stable/9/sys/boot/i386/libi386/vidconsole.c stable/9/sys/boot/pc98/boot2/boot2.c stable/9/sys/boot/pc98/btx/lib/btxv86.h stable/9/sys/boot/pc98/libpc98/bioscd.c stable/9/sys/boot/pc98/libpc98/vidconsole.c stable/9/sys/boot/pc98/loader/main.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/boot/i386/boot2/boot2.c ============================================================================== --- stable/9/sys/boot/i386/boot2/boot2.c Wed Jan 4 16:29:45 2012 (r229500) +++ stable/9/sys/boot/i386/boot2/boot2.c Wed Jan 4 16:39:39 2012 (r229501) @@ -24,7 +24,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include @@ -84,8 +83,6 @@ __FBSDID("$FreeBSD$"); #define NDEV 3 #define MEM_BASE 0x12 #define MEM_EXT 0x15 -#define V86_CY(x) ((x) & PSL_C) -#define V86_ZR(x) ((x) & PSL_Z) #define DRV_HARD 0x80 #define DRV_MASK 0x7f Modified: stable/9/sys/boot/i386/btx/lib/btxv86.h ============================================================================== --- stable/9/sys/boot/i386/btx/lib/btxv86.h Wed Jan 4 16:29:45 2012 (r229500) +++ stable/9/sys/boot/i386/btx/lib/btxv86.h Wed Jan 4 16:39:39 2012 (r229501) @@ -21,6 +21,7 @@ #define _BTXV86_H_ #include +#include #define V86_ADDR 0x10000 /* Segment:offset address */ #define V86_CALLF 0x20000 /* Emulate far call */ @@ -57,6 +58,9 @@ extern u_int32_t __args; #define VTOPSEG(va) (u_int16_t)(VTOP((caddr_t)va) >> 4) #define VTOPOFF(va) (u_int16_t)(VTOP((caddr_t)va) & 0xf) +#define V86_CY(x) ((x) & PSL_C) +#define V86_ZR(x) ((x) & PSL_Z) + void __exit(int) __attribute__((__noreturn__)); void __exec(caddr_t, ...); Modified: stable/9/sys/boot/i386/common/cons.c ============================================================================== --- stable/9/sys/boot/i386/common/cons.c Wed Jan 4 16:29:45 2012 (r229500) +++ stable/9/sys/boot/i386/common/cons.c Wed Jan 4 16:39:39 2012 (r229501) @@ -27,8 +27,6 @@ __FBSDID("$FreeBSD$"); #include "util.h" #include "cons.h" -#define V86_ZR(x) ((x) & PSL_Z) - #define SECOND 18 /* Circa that many ticks in a second. */ uint8_t ioctrl = IO_KEYBOARD; Modified: stable/9/sys/boot/i386/common/drv.c ============================================================================== --- stable/9/sys/boot/i386/common/drv.c Wed Jan 4 16:29:45 2012 (r229500) +++ stable/9/sys/boot/i386/common/drv.c Wed Jan 4 16:39:39 2012 (r229501) @@ -19,8 +19,6 @@ __FBSDID("$FreeBSD$"); #include -#include - #include #include "rbx.h" @@ -31,9 +29,6 @@ __FBSDID("$FreeBSD$"); #include "xreadorg.h" #endif -#define V86_CY(x) ((x) & PSL_C) -#define V86_ZR(x) ((x) & PSL_Z) - #ifdef GPT static struct edd_params params; Modified: stable/9/sys/boot/i386/libi386/bioscd.c ============================================================================== --- stable/9/sys/boot/i386/libi386/bioscd.c Wed Jan 4 16:29:45 2012 (r229500) +++ stable/9/sys/boot/i386/libi386/bioscd.c Wed Jan 4 16:39:39 2012 (r229501) @@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include @@ -334,7 +333,7 @@ bc_read(int unit, daddr_t dblk, int blks v86.ds = VTOPSEG(&packet); v86.esi = VTOPOFF(&packet); v86int(); - result = (v86.efl & PSL_C); + result = V86_CY(v86.efl); if (result == 0) break; } Modified: stable/9/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- stable/9/sys/boot/i386/libi386/biosdisk.c Wed Jan 4 16:29:45 2012 (r229500) +++ stable/9/sys/boot/i386/libi386/biosdisk.c Wed Jan 4 16:39:39 2012 (r229501) @@ -251,7 +251,7 @@ bd_int13probe(struct bdinfo *bd) v86.edx = bd->bd_unit; v86int(); - if (!(v86.efl & 0x1) && /* carry clear */ + if (!(V86_CY(v86.efl)) && /* carry clear */ ((v86.edx & 0xff) > ((unsigned)bd->bd_unit & 0x7f))) { /* unit # OK */ if ((v86.ecx & 0x3f) == 0) { /* absurd sector size */ DEBUG("Invalid geometry for unit %d", bd->bd_unit); @@ -265,11 +265,11 @@ bd_int13probe(struct bdinfo *bd) v86.edx = bd->bd_unit; v86.ebx = 0x55aa; v86int(); - if (!(v86.efl & 0x1) && /* carry clear */ + if (!(V86_CY(v86.efl)) && /* carry clear */ ((v86.ebx & 0xffff) == 0xaa55) && /* signature */ (v86.ecx & EDD_INTERFACE_FIXED_DISK)) { /* packets mode ok */ bd->bd_flags |= BD_MODEEDD1; - if((v86.eax & 0xff00) >= 0x3000) + if ((v86.eax & 0xff00) >= 0x3000) bd->bd_flags |= BD_MODEEDD3; } return(1); @@ -563,7 +563,7 @@ bd_opendisk(struct open_disk **odp, stru return (ENOMEM); } - /* Look up BIOS unit number, intialise open_disk structure */ + /* Look up BIOS unit number, initalise open_disk structure */ od->od_dkunit = dev->d_unit; od->od_unit = bdinfo[od->od_dkunit].bd_unit; od->od_flags = bdinfo[od->od_dkunit].bd_flags; @@ -1151,7 +1151,7 @@ bd_edd_io(struct open_disk *od, daddr_t v86.ds = VTOPSEG(&packet); v86.esi = VTOPOFF(&packet); v86int(); - return (v86.efl & 0x1); + return (V86_CY(v86.efl)); } static int @@ -1184,7 +1184,7 @@ bd_chs_io(struct open_disk *od, daddr_t v86.es = VTOPSEG(dest); v86.ebx = VTOPOFF(dest); v86int(); - return (v86.efl & 0x1); + return (V86_CY(v86.efl)); } static int @@ -1312,7 +1312,7 @@ bd_getgeom(struct open_disk *od) v86.edx = od->od_unit; v86int(); - if ((v86.efl & 0x1) || /* carry set */ + if ((V86_CY(v86.efl)) || /* carry set */ ((v86.edx & 0xff) <= (unsigned)(od->od_unit & 0x7f))) /* unit # bad */ return(1); @@ -1349,7 +1349,7 @@ bd_getbigeom(int bunit) v86.eax = 0x800; v86.edx = 0x80 + bunit; v86int(); - if (v86.efl & 0x1) + if (V86_CY(v86.efl)) return 0x4f010f; return ((v86.ecx & 0xc0) << 18) | ((v86.ecx & 0xff00) << 8) | (v86.edx & 0xff00) | (v86.ecx & 0x3f); Modified: stable/9/sys/boot/i386/libi386/biosmem.c ============================================================================== --- stable/9/sys/boot/i386/libi386/biosmem.c Wed Jan 4 16:29:45 2012 (r229500) +++ stable/9/sys/boot/i386/libi386/biosmem.c Wed Jan 4 16:39:39 2012 (r229501) @@ -61,7 +61,7 @@ bios_getmem(void) v86.es = VTOPSEG(&smap); v86.edi = VTOPOFF(&smap); v86int(); - if ((v86.efl & 1) || (v86.eax != SMAP_SIG)) + if ((V86_CY(v86.efl)) || (v86.eax != SMAP_SIG)) break; /* look for a low-memory segment that's large enough */ if ((smap.type == SMAP_TYPE_MEMORY) && (smap.base == 0) && @@ -108,7 +108,7 @@ bios_getmem(void) v86.addr = 0x15; /* int 0x15 function 0xe801*/ v86.eax = 0xe801; v86int(); - if (!(v86.efl & 1)) { + if (!(V86_CY(v86.efl))) { bios_extmem = ((v86.ecx & 0xffff) + ((v86.edx & 0xffff) * 64)) * 1024; } } Modified: stable/9/sys/boot/i386/libi386/biospci.c ============================================================================== --- stable/9/sys/boot/i386/libi386/biospci.c Wed Jan 4 16:29:45 2012 (r229500) +++ stable/9/sys/boot/i386/libi386/biospci.c Wed Jan 4 16:39:39 2012 (r229501) @@ -218,7 +218,8 @@ biospci_enumerate(void) v86int(); /* Check for OK response */ - if ((v86.efl & 1) || ((v86.eax & 0xff00) != 0) || (v86.edx != 0x20494350)) + if (V86_CY(v86.efl) || ((v86.eax & 0xff00) != 0) || + (v86.edx != 0x20494350)) return; biospci_version = v86.ebx & 0xffff; @@ -295,7 +296,7 @@ biospci_find_devclass(uint32_t class, in v86int(); /* error */ - if ((v86.efl & 1) || (v86.eax & 0xff00)) + if (V86_CY(v86.efl) || (v86.eax & 0xff00)) return (-1); *locator = v86.ebx; @@ -317,7 +318,7 @@ biospci_write_config(uint32_t locator, i v86int(); /* error */ - if ((v86.efl & 1) || (v86.eax & 0xff00)) + if (V86_CY(v86.efl) || (v86.eax & 0xff00)) return (-1); return(0); @@ -334,7 +335,7 @@ biospci_read_config(uint32_t locator, in v86int(); /* error */ - if ((v86.efl & 1) || (v86.eax & 0xff00)) + if (V86_CY(v86.efl) || (v86.eax & 0xff00)) return (-1); *val = v86.ecx; Modified: stable/9/sys/boot/i386/libi386/biossmap.c ============================================================================== --- stable/9/sys/boot/i386/libi386/biossmap.c Wed Jan 4 16:29:45 2012 (r229500) +++ stable/9/sys/boot/i386/libi386/biossmap.c Wed Jan 4 16:39:39 2012 (r229501) @@ -36,14 +36,11 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include "bootstrap.h" #include "libi386.h" #include "btxv86.h" -#define V86_CY(x) ((x) & PSL_C) - struct smap_buf { struct bios_smap smap; uint32_t xattr; /* Extended attribute from ACPI 3.0 */ Modified: stable/9/sys/boot/i386/libi386/vidconsole.c ============================================================================== --- stable/9/sys/boot/i386/libi386/vidconsole.c Wed Jan 4 16:29:45 2012 (r229500) +++ stable/9/sys/boot/i386/libi386/vidconsole.c Wed Jan 4 16:39:39 2012 (r229501) @@ -516,7 +516,7 @@ vidc_ischar(void) v86.addr = 0x16; v86.eax = 0x100; v86int(); - return (!(v86.efl & PSL_Z)); + return (!V86_ZR(v86.efl)); } #if KEYBOARD_PROBE Modified: stable/9/sys/boot/pc98/boot2/boot2.c ============================================================================== --- stable/9/sys/boot/pc98/boot2/boot2.c Wed Jan 4 16:29:45 2012 (r229500) +++ stable/9/sys/boot/pc98/boot2/boot2.c Wed Jan 4 16:39:39 2012 (r229501) @@ -26,7 +26,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include @@ -84,8 +83,6 @@ __FBSDID("$FreeBSD$"); #define ARGS 0x900 #define NOPT 14 #define NDEV 3 -#define V86_CY(x) ((x) & PSL_C) -#define V86_ZR(x) ((x) & PSL_Z) #define DRV_DISK 0xf0 #define DRV_UNIT 0x0f Modified: stable/9/sys/boot/pc98/btx/lib/btxv86.h ============================================================================== --- stable/9/sys/boot/pc98/btx/lib/btxv86.h Wed Jan 4 16:29:45 2012 (r229500) +++ stable/9/sys/boot/pc98/btx/lib/btxv86.h Wed Jan 4 16:39:39 2012 (r229501) @@ -21,6 +21,7 @@ #define _BTXV86_H_ #include +#include #define V86_ADDR 0x10000 /* Segment:offset address */ #define V86_CALLF 0x20000 /* Emulate far call */ @@ -57,6 +58,9 @@ extern u_int32_t __args; #define VTOPSEG(va) (u_int16_t)(VTOP((caddr_t)va) >> 4) #define VTOPOFF(va) (u_int16_t)(VTOP((caddr_t)va) & 0xf) +#define V86_CY(x) ((x) & PSL_C) +#define V86_ZR(x) ((x) & PSL_Z) + void __exit(int) __attribute__((__noreturn__)); void __exec(caddr_t, ...); Modified: stable/9/sys/boot/pc98/libpc98/bioscd.c ============================================================================== --- stable/9/sys/boot/pc98/libpc98/bioscd.c Wed Jan 4 16:29:45 2012 (r229500) +++ stable/9/sys/boot/pc98/libpc98/bioscd.c Wed Jan 4 16:39:39 2012 (r229501) @@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include @@ -325,7 +324,7 @@ bc_read(int unit, daddr_t dblk, int blks v86.ebp = VTOPOFF(xp); v86.es = VTOPSEG(xp); v86int(); - result = (v86.efl & PSL_C); + result = V86_CY(v86.efl); if (result == 0) break; } Modified: stable/9/sys/boot/pc98/libpc98/vidconsole.c ============================================================================== --- stable/9/sys/boot/pc98/libpc98/vidconsole.c Wed Jan 4 16:29:45 2012 (r229500) +++ stable/9/sys/boot/pc98/libpc98/vidconsole.c Wed Jan 4 16:39:39 2012 (r229501) @@ -33,7 +33,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include "libi386.h" Modified: stable/9/sys/boot/pc98/loader/main.c ============================================================================== --- stable/9/sys/boot/pc98/loader/main.c Wed Jan 4 16:29:45 2012 (r229500) +++ stable/9/sys/boot/pc98/loader/main.c Wed Jan 4 16:39:39 2012 (r229501) @@ -35,7 +35,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 16:43:09 2012 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 A3400106564A; Wed, 4 Jan 2012 16:43:09 +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 8E7C28FC13; Wed, 4 Jan 2012 16:43:09 +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 q04Gh955087207; Wed, 4 Jan 2012 16:43:09 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04Gh9h9087191; Wed, 4 Jan 2012 16:43:09 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201041643.q04Gh9h9087191@svn.freebsd.org> From: John Baldwin Date: Wed, 4 Jan 2012 16:43:09 +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: r229502 - in stable/8/sys/boot: i386/boot2 i386/btx/lib i386/common i386/libi386 pc98/boot2 pc98/btx/lib pc98/libpc98 pc98/loader 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, 04 Jan 2012 16:43:09 -0000 Author: jhb Date: Wed Jan 4 16:43:08 2012 New Revision: 229502 URL: http://svn.freebsd.org/changeset/base/229502 Log: MFC 226746: Consolidate duplicate definitions of V86_CY() and V86_ZR() which check for the carry and zero flags being set, respectively, in and use them throughout the x86 boot code. Modified: stable/8/sys/boot/i386/boot2/boot2.c stable/8/sys/boot/i386/btx/lib/btxv86.h stable/8/sys/boot/i386/common/cons.c stable/8/sys/boot/i386/common/drv.c stable/8/sys/boot/i386/libi386/bioscd.c stable/8/sys/boot/i386/libi386/biosdisk.c stable/8/sys/boot/i386/libi386/biosmem.c stable/8/sys/boot/i386/libi386/biospci.c stable/8/sys/boot/i386/libi386/biossmap.c stable/8/sys/boot/i386/libi386/vidconsole.c stable/8/sys/boot/pc98/boot2/boot2.c stable/8/sys/boot/pc98/btx/lib/btxv86.h stable/8/sys/boot/pc98/libpc98/bioscd.c stable/8/sys/boot/pc98/libpc98/vidconsole.c stable/8/sys/boot/pc98/loader/main.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/boot/i386/boot2/boot2.c ============================================================================== --- stable/8/sys/boot/i386/boot2/boot2.c Wed Jan 4 16:39:39 2012 (r229501) +++ stable/8/sys/boot/i386/boot2/boot2.c Wed Jan 4 16:43:08 2012 (r229502) @@ -24,7 +24,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include @@ -84,8 +83,6 @@ __FBSDID("$FreeBSD$"); #define NDEV 3 #define MEM_BASE 0x12 #define MEM_EXT 0x15 -#define V86_CY(x) ((x) & PSL_C) -#define V86_ZR(x) ((x) & PSL_Z) #define DRV_HARD 0x80 #define DRV_MASK 0x7f Modified: stable/8/sys/boot/i386/btx/lib/btxv86.h ============================================================================== --- stable/8/sys/boot/i386/btx/lib/btxv86.h Wed Jan 4 16:39:39 2012 (r229501) +++ stable/8/sys/boot/i386/btx/lib/btxv86.h Wed Jan 4 16:43:08 2012 (r229502) @@ -21,6 +21,7 @@ #define _BTXV86_H_ #include +#include #define V86_ADDR 0x10000 /* Segment:offset address */ #define V86_CALLF 0x20000 /* Emulate far call */ @@ -57,6 +58,9 @@ extern u_int32_t __args; #define VTOPSEG(va) (u_int16_t)(VTOP((caddr_t)va) >> 4) #define VTOPOFF(va) (u_int16_t)(VTOP((caddr_t)va) & 0xf) +#define V86_CY(x) ((x) & PSL_C) +#define V86_ZR(x) ((x) & PSL_Z) + void __exit(int) __attribute__((__noreturn__)); void __exec(caddr_t, ...); Modified: stable/8/sys/boot/i386/common/cons.c ============================================================================== --- stable/8/sys/boot/i386/common/cons.c Wed Jan 4 16:39:39 2012 (r229501) +++ stable/8/sys/boot/i386/common/cons.c Wed Jan 4 16:43:08 2012 (r229502) @@ -27,8 +27,6 @@ __FBSDID("$FreeBSD$"); #include "util.h" #include "cons.h" -#define V86_ZR(x) ((x) & PSL_Z) - #define SECOND 18 /* Circa that many ticks in a second. */ uint8_t ioctrl = IO_KEYBOARD; Modified: stable/8/sys/boot/i386/common/drv.c ============================================================================== --- stable/8/sys/boot/i386/common/drv.c Wed Jan 4 16:39:39 2012 (r229501) +++ stable/8/sys/boot/i386/common/drv.c Wed Jan 4 16:43:08 2012 (r229502) @@ -19,8 +19,6 @@ __FBSDID("$FreeBSD$"); #include -#include - #include #include "rbx.h" @@ -30,9 +28,6 @@ __FBSDID("$FreeBSD$"); #include "xreadorg.h" #endif -#define V86_CY(x) ((x) & PSL_C) -#define V86_ZR(x) ((x) & PSL_Z) - #ifdef GPT uint64_t drvsize(struct dsk *dskp) Modified: stable/8/sys/boot/i386/libi386/bioscd.c ============================================================================== --- stable/8/sys/boot/i386/libi386/bioscd.c Wed Jan 4 16:39:39 2012 (r229501) +++ stable/8/sys/boot/i386/libi386/bioscd.c Wed Jan 4 16:43:08 2012 (r229502) @@ -42,12 +42,12 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include +#include #include "libi386.h" #define BIOSCD_SECSIZE 2048 @@ -333,7 +333,7 @@ bc_read(int unit, daddr_t dblk, int blks v86.ds = VTOPSEG(&packet); v86.esi = VTOPOFF(&packet); v86int(); - result = (v86.efl & PSL_C); + result = V86_CY(v86.efl); if (result == 0) break; } Modified: stable/8/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- stable/8/sys/boot/i386/libi386/biosdisk.c Wed Jan 4 16:39:39 2012 (r229501) +++ stable/8/sys/boot/i386/libi386/biosdisk.c Wed Jan 4 16:43:08 2012 (r229502) @@ -248,7 +248,7 @@ bd_int13probe(struct bdinfo *bd) v86.edx = bd->bd_unit; v86int(); - if (!(v86.efl & 0x1) && /* carry clear */ + if (!(V86_CY(v86.efl)) && /* carry clear */ ((v86.edx & 0xff) > ((unsigned)bd->bd_unit & 0x7f))) { /* unit # OK */ if ((v86.ecx & 0x3f) == 0) { /* absurd sector size */ DEBUG("Invalid geometry for unit %d", bd->bd_unit); @@ -262,11 +262,11 @@ bd_int13probe(struct bdinfo *bd) v86.edx = bd->bd_unit; v86.ebx = 0x55aa; v86int(); - if (!(v86.efl & 0x1) && /* carry clear */ + if (!(V86_CY(v86.efl)) && /* carry clear */ ((v86.ebx & 0xffff) == 0xaa55) && /* signature */ (v86.ecx & 0x1)) { /* packets mode ok */ bd->bd_flags |= BD_MODEEDD1; - if((v86.eax & 0xff00) >= 0x3000) + if ((v86.eax & 0xff00) >= 0x3000) bd->bd_flags |= BD_MODEEDD3; } return(1); @@ -560,7 +560,7 @@ bd_opendisk(struct open_disk **odp, stru return (ENOMEM); } - /* Look up BIOS unit number, intialise open_disk structure */ + /* Look up BIOS unit number, initalise open_disk structure */ od->od_dkunit = dev->d_unit; od->od_unit = bdinfo[od->od_dkunit].bd_unit; od->od_flags = bdinfo[od->od_dkunit].bd_flags; @@ -1148,7 +1148,7 @@ bd_edd_io(struct open_disk *od, daddr_t v86.ds = VTOPSEG(&packet); v86.esi = VTOPOFF(&packet); v86int(); - return (v86.efl & 0x1); + return (V86_CY(v86.efl)); } static int @@ -1181,7 +1181,7 @@ bd_chs_io(struct open_disk *od, daddr_t v86.es = VTOPSEG(dest); v86.ebx = VTOPOFF(dest); v86int(); - return (v86.efl & 0x1); + return (V86_CY(v86.efl)); } static int @@ -1309,7 +1309,7 @@ bd_getgeom(struct open_disk *od) v86.edx = od->od_unit; v86int(); - if ((v86.efl & 0x1) || /* carry set */ + if ((V86_CY(v86.efl)) || /* carry set */ ((v86.edx & 0xff) <= (unsigned)(od->od_unit & 0x7f))) /* unit # bad */ return(1); @@ -1346,7 +1346,7 @@ bd_getbigeom(int bunit) v86.eax = 0x800; v86.edx = 0x80 + bunit; v86int(); - if (v86.efl & 0x1) + if (V86_CY(v86.efl)) return 0x4f010f; return ((v86.ecx & 0xc0) << 18) | ((v86.ecx & 0xff00) << 8) | (v86.edx & 0xff00) | (v86.ecx & 0x3f); Modified: stable/8/sys/boot/i386/libi386/biosmem.c ============================================================================== --- stable/8/sys/boot/i386/libi386/biosmem.c Wed Jan 4 16:39:39 2012 (r229501) +++ stable/8/sys/boot/i386/libi386/biosmem.c Wed Jan 4 16:43:08 2012 (r229502) @@ -61,7 +61,7 @@ bios_getmem(void) v86.es = VTOPSEG(&smap); v86.edi = VTOPOFF(&smap); v86int(); - if ((v86.efl & 1) || (v86.eax != SMAP_SIG)) + if ((V86_CY(v86.efl)) || (v86.eax != SMAP_SIG)) break; /* look for a low-memory segment that's large enough */ if ((smap.type == SMAP_TYPE_MEMORY) && (smap.base == 0) && @@ -108,7 +108,7 @@ bios_getmem(void) v86.addr = 0x15; /* int 0x15 function 0xe801*/ v86.eax = 0xe801; v86int(); - if (!(v86.efl & 1)) { + if (!(V86_CY(v86.efl))) { bios_extmem = ((v86.ecx & 0xffff) + ((v86.edx & 0xffff) * 64)) * 1024; } } Modified: stable/8/sys/boot/i386/libi386/biospci.c ============================================================================== --- stable/8/sys/boot/i386/libi386/biospci.c Wed Jan 4 16:39:39 2012 (r229501) +++ stable/8/sys/boot/i386/libi386/biospci.c Wed Jan 4 16:43:08 2012 (r229502) @@ -218,7 +218,8 @@ biospci_enumerate(void) v86int(); /* Check for OK response */ - if ((v86.efl & 1) || ((v86.eax & 0xff00) != 0) || (v86.edx != 0x20494350)) + if (V86_CY(v86.efl) || ((v86.eax & 0xff00) != 0) || + (v86.edx != 0x20494350)) return; biospci_version = v86.ebx & 0xffff; @@ -295,7 +296,7 @@ biospci_find_devclass(uint32_t class, in v86int(); /* error */ - if ((v86.efl & 1) || (v86.eax & 0xff00)) + if (V86_CY(v86.efl) || (v86.eax & 0xff00)) return (-1); *locator = v86.ebx; @@ -317,7 +318,7 @@ biospci_write_config(uint32_t locator, i v86int(); /* error */ - if ((v86.efl & 1) || (v86.eax & 0xff00)) + if (V86_CY(v86.efl) || (v86.eax & 0xff00)) return (-1); return(0); @@ -334,7 +335,7 @@ biospci_read_config(uint32_t locator, in v86int(); /* error */ - if ((v86.efl & 1) || (v86.eax & 0xff00)) + if (V86_CY(v86.efl) || (v86.eax & 0xff00)) return (-1); *val = v86.ecx; Modified: stable/8/sys/boot/i386/libi386/biossmap.c ============================================================================== --- stable/8/sys/boot/i386/libi386/biossmap.c Wed Jan 4 16:39:39 2012 (r229501) +++ stable/8/sys/boot/i386/libi386/biossmap.c Wed Jan 4 16:43:08 2012 (r229502) @@ -36,14 +36,11 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include "bootstrap.h" #include "libi386.h" #include "btxv86.h" -#define V86_CY(x) ((x) & PSL_C) - struct smap_buf { struct bios_smap smap; uint32_t xattr; /* Extended attribute from ACPI 3.0 */ Modified: stable/8/sys/boot/i386/libi386/vidconsole.c ============================================================================== --- stable/8/sys/boot/i386/libi386/vidconsole.c Wed Jan 4 16:39:39 2012 (r229501) +++ stable/8/sys/boot/i386/libi386/vidconsole.c Wed Jan 4 16:43:08 2012 (r229502) @@ -516,7 +516,7 @@ vidc_ischar(void) v86.addr = 0x16; v86.eax = 0x100; v86int(); - return (!(v86.efl & PSL_Z)); + return (!V86_ZR(v86.efl)); } #if KEYBOARD_PROBE Modified: stable/8/sys/boot/pc98/boot2/boot2.c ============================================================================== --- stable/8/sys/boot/pc98/boot2/boot2.c Wed Jan 4 16:39:39 2012 (r229501) +++ stable/8/sys/boot/pc98/boot2/boot2.c Wed Jan 4 16:43:08 2012 (r229502) @@ -26,7 +26,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include @@ -84,8 +83,6 @@ __FBSDID("$FreeBSD$"); #define ARGS 0x900 #define NOPT 14 #define NDEV 3 -#define V86_CY(x) ((x) & PSL_C) -#define V86_ZR(x) ((x) & PSL_Z) #define DRV_DISK 0xf0 #define DRV_UNIT 0x0f Modified: stable/8/sys/boot/pc98/btx/lib/btxv86.h ============================================================================== --- stable/8/sys/boot/pc98/btx/lib/btxv86.h Wed Jan 4 16:39:39 2012 (r229501) +++ stable/8/sys/boot/pc98/btx/lib/btxv86.h Wed Jan 4 16:43:08 2012 (r229502) @@ -21,6 +21,7 @@ #define _BTXV86_H_ #include +#include #define V86_ADDR 0x10000 /* Segment:offset address */ #define V86_CALLF 0x20000 /* Emulate far call */ @@ -57,6 +58,9 @@ extern u_int32_t __args; #define VTOPSEG(va) (u_int16_t)(VTOP((caddr_t)va) >> 4) #define VTOPOFF(va) (u_int16_t)(VTOP((caddr_t)va) & 0xf) +#define V86_CY(x) ((x) & PSL_C) +#define V86_ZR(x) ((x) & PSL_Z) + void __exit(int) __attribute__((__noreturn__)); void __exec(caddr_t, ...); Modified: stable/8/sys/boot/pc98/libpc98/bioscd.c ============================================================================== --- stable/8/sys/boot/pc98/libpc98/bioscd.c Wed Jan 4 16:39:39 2012 (r229501) +++ stable/8/sys/boot/pc98/libpc98/bioscd.c Wed Jan 4 16:43:08 2012 (r229502) @@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include @@ -325,7 +324,7 @@ bc_read(int unit, daddr_t dblk, int blks v86.ebp = VTOPOFF(xp); v86.es = VTOPSEG(xp); v86int(); - result = (v86.efl & PSL_C); + result = V86_CY(v86.efl); if (result == 0) break; } Modified: stable/8/sys/boot/pc98/libpc98/vidconsole.c ============================================================================== --- stable/8/sys/boot/pc98/libpc98/vidconsole.c Wed Jan 4 16:39:39 2012 (r229501) +++ stable/8/sys/boot/pc98/libpc98/vidconsole.c Wed Jan 4 16:43:08 2012 (r229502) @@ -33,7 +33,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include "libi386.h" Modified: stable/8/sys/boot/pc98/loader/main.c ============================================================================== --- stable/8/sys/boot/pc98/loader/main.c Wed Jan 4 16:39:39 2012 (r229501) +++ stable/8/sys/boot/pc98/loader/main.c Wed Jan 4 16:43:08 2012 (r229502) @@ -35,7 +35,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include "bootstrap.h" From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 16:43:29 2012 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 C1F311065700; Wed, 4 Jan 2012 16:43:29 +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 ADE208FC08; Wed, 4 Jan 2012 16: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 q04GhTBi087262; Wed, 4 Jan 2012 16:43:29 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04GhTvb087251; Wed, 4 Jan 2012 16:43:29 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201041643.q04GhTvb087251@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 4 Jan 2012 16:43:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229503 - in stable/9/libexec/rtld-elf: . amd64 arm i386 ia64 mips powerpc powerpc64 sparc64 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, 04 Jan 2012 16:43:29 -0000 Author: kib Date: Wed Jan 4 16:43:29 2012 New Revision: 229503 URL: http://svn.freebsd.org/changeset/base/229503 Log: MFC r228435: Add support for STT_GNU_IFUNC and R_MACHINE_IRELATIVE GNU extensions to rtld on 386 and amd64. MFC r228503: Postpone the resolution for irelative/ifunc right before initializers are called, and drop bind lock around calls to dispatcher. Use initlist to iterate over the objects instead of the ->next, due to drop of the bind lock in iteration. For i386/reloc.c:reloc_iresolve(), fix calculation of the dispatch function address for dso, by taking into account possible non-zero relocbase. MFC r228635 (by nwhitehorn): Fix RTLD on PowerPC after r228435. Changing the order of init_pltgot() caused the icache to be invalidated at the wrong time, resulting in an icache full of nonsense in the PLT section. Modified: stable/9/libexec/rtld-elf/amd64/reloc.c stable/9/libexec/rtld-elf/arm/reloc.c stable/9/libexec/rtld-elf/i386/reloc.c stable/9/libexec/rtld-elf/ia64/reloc.c stable/9/libexec/rtld-elf/mips/reloc.c stable/9/libexec/rtld-elf/powerpc/reloc.c stable/9/libexec/rtld-elf/powerpc64/reloc.c stable/9/libexec/rtld-elf/rtld.c stable/9/libexec/rtld-elf/rtld.h stable/9/libexec/rtld-elf/sparc64/reloc.c Directory Properties: stable/9/libexec/rtld-elf/ (props changed) Modified: stable/9/libexec/rtld-elf/amd64/reloc.c ============================================================================== --- stable/9/libexec/rtld-elf/amd64/reloc.c Wed Jan 4 16:43:08 2012 (r229502) +++ stable/9/libexec/rtld-elf/amd64/reloc.c Wed Jan 4 16:43:29 2012 (r229503) @@ -344,11 +344,22 @@ reloc_plt(Obj_Entry *obj) for (rela = obj->pltrela; rela < relalim; rela++) { Elf_Addr *where; - assert(ELF_R_TYPE(rela->r_info) == R_X86_64_JMP_SLOT); - - /* Relocate the GOT slot pointing into the PLT. */ - where = (Elf_Addr *)(obj->relocbase + rela->r_offset); - *where += (Elf_Addr)obj->relocbase; + switch(ELF_R_TYPE(rela->r_info)) { + case R_X86_64_JMP_SLOT: + /* Relocate the GOT slot pointing into the PLT. */ + where = (Elf_Addr *)(obj->relocbase + rela->r_offset); + *where += (Elf_Addr)obj->relocbase; + break; + + case R_X86_64_IRELATIVE: + obj->irelative = true; + break; + + default: + _rtld_error("Unknown relocation type %x in PLT", + (unsigned int)ELF_R_TYPE(rela->r_info)); + return (-1); + } } return 0; } @@ -368,19 +379,98 @@ reloc_jmpslots(Obj_Entry *obj, RtldLockS const Elf_Sym *def; const Obj_Entry *defobj; - assert(ELF_R_TYPE(rela->r_info) == R_X86_64_JMP_SLOT); - where = (Elf_Addr *)(obj->relocbase + rela->r_offset); - def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj, true, NULL, - lockstate); - if (def == NULL) - return -1; - target = (Elf_Addr)(defobj->relocbase + def->st_value + rela->r_addend); - reloc_jmpslot(where, target, defobj, obj, (const Elf_Rel *)rela); + switch (ELF_R_TYPE(rela->r_info)) { + case R_X86_64_JMP_SLOT: + where = (Elf_Addr *)(obj->relocbase + rela->r_offset); + def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj, true, NULL, + lockstate); + if (def == NULL) + return (-1); + if (ELF_ST_TYPE(def->st_info) == STT_GNU_IFUNC) { + obj->gnu_ifunc = true; + continue; + } + target = (Elf_Addr)(defobj->relocbase + def->st_value + rela->r_addend); + reloc_jmpslot(where, target, defobj, obj, (const Elf_Rel *)rela); + break; + + case R_X86_64_IRELATIVE: + break; + + default: + _rtld_error("Unknown relocation type %x in PLT", + (unsigned int)ELF_R_TYPE(rela->r_info)); + return (-1); + } } obj->jmpslots_done = true; return 0; } +int +reloc_iresolve(Obj_Entry *obj, RtldLockState *lockstate) +{ + const Elf_Rela *relalim; + const Elf_Rela *rela; + + if (!obj->irelative) + return (0); + relalim = (const Elf_Rela *)((char *)obj->pltrela + obj->pltrelasize); + for (rela = obj->pltrela; rela < relalim; rela++) { + Elf_Addr *where, target, *ptr; + + switch (ELF_R_TYPE(rela->r_info)) { + case R_X86_64_JMP_SLOT: + break; + + case R_X86_64_IRELATIVE: + ptr = (Elf_Addr *)(obj->relocbase + rela->r_addend); + where = (Elf_Addr *)(obj->relocbase + rela->r_offset); + lock_release(rtld_bind_lock, lockstate); + target = ((Elf_Addr (*)(void))ptr)(); + wlock_acquire(rtld_bind_lock, lockstate); + *where = target; + break; + } + } + obj->irelative = false; + return (0); +} + +int +reloc_gnu_ifunc(Obj_Entry *obj, RtldLockState *lockstate) +{ + const Elf_Rela *relalim; + const Elf_Rela *rela; + + if (!obj->gnu_ifunc) + return (0); + relalim = (const Elf_Rela *)((char *)obj->pltrela + obj->pltrelasize); + for (rela = obj->pltrela; rela < relalim; rela++) { + Elf_Addr *where, target; + const Elf_Sym *def; + const Obj_Entry *defobj; + + switch (ELF_R_TYPE(rela->r_info)) { + case R_X86_64_JMP_SLOT: + where = (Elf_Addr *)(obj->relocbase + rela->r_offset); + def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj, true, NULL, + lockstate); + if (def == NULL) + return (-1); + if (ELF_ST_TYPE(def->st_info) != STT_GNU_IFUNC) + continue; + lock_release(rtld_bind_lock, lockstate); + target = (Elf_Addr)rtld_resolve_ifunc(defobj, def); + wlock_acquire(rtld_bind_lock, lockstate); + reloc_jmpslot(where, target, defobj, obj, (const Elf_Rel *)rela); + break; + } + } + obj->gnu_ifunc = false; + return (0); +} + void allocate_initial_tls(Obj_Entry *objs) { Modified: stable/9/libexec/rtld-elf/arm/reloc.c ============================================================================== --- stable/9/libexec/rtld-elf/arm/reloc.c Wed Jan 4 16:43:08 2012 (r229502) +++ stable/9/libexec/rtld-elf/arm/reloc.c Wed Jan 4 16:43:29 2012 (r229503) @@ -337,6 +337,22 @@ reloc_jmpslots(Obj_Entry *obj, RtldLockS return (0); } +int +reloc_iresolve(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) +{ + + /* XXX not implemented */ + return (0); +} + +int +reloc_gnu_ifunc(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) +{ + + /* XXX not implemented */ + return (0); +} + Elf_Addr reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const Obj_Entry *defobj, const Obj_Entry *obj, const Elf_Rel *rel) Modified: stable/9/libexec/rtld-elf/i386/reloc.c ============================================================================== --- stable/9/libexec/rtld-elf/i386/reloc.c Wed Jan 4 16:43:08 2012 (r229502) +++ stable/9/libexec/rtld-elf/i386/reloc.c Wed Jan 4 16:43:29 2012 (r229503) @@ -298,13 +298,24 @@ reloc_plt(Obj_Entry *obj) rellim = (const Elf_Rel *)((char *)obj->pltrel + obj->pltrelsize); for (rel = obj->pltrel; rel < rellim; rel++) { - Elf_Addr *where; + Elf_Addr *where/*, val*/; - assert(ELF_R_TYPE(rel->r_info) == R_386_JMP_SLOT); - - /* Relocate the GOT slot pointing into the PLT. */ - where = (Elf_Addr *)(obj->relocbase + rel->r_offset); - *where += (Elf_Addr)obj->relocbase; + switch (ELF_R_TYPE(rel->r_info)) { + case R_386_JMP_SLOT: + /* Relocate the GOT slot pointing into the PLT. */ + where = (Elf_Addr *)(obj->relocbase + rel->r_offset); + *where += (Elf_Addr)obj->relocbase; + break; + + case R_386_IRELATIVE: + obj->irelative = true; + break; + + default: + _rtld_error("Unknown relocation type %x in PLT", + ELF_R_TYPE(rel->r_info)); + return (-1); + } } return 0; } @@ -324,19 +335,95 @@ reloc_jmpslots(Obj_Entry *obj, RtldLockS const Elf_Sym *def; const Obj_Entry *defobj; - assert(ELF_R_TYPE(rel->r_info) == R_386_JMP_SLOT); - where = (Elf_Addr *)(obj->relocbase + rel->r_offset); - def = find_symdef(ELF_R_SYM(rel->r_info), obj, &defobj, true, NULL, - lockstate); - if (def == NULL) - return -1; - target = (Elf_Addr)(defobj->relocbase + def->st_value); - reloc_jmpslot(where, target, defobj, obj, rel); + switch (ELF_R_TYPE(rel->r_info)) { + case R_386_JMP_SLOT: + where = (Elf_Addr *)(obj->relocbase + rel->r_offset); + def = find_symdef(ELF_R_SYM(rel->r_info), obj, &defobj, true, NULL, + lockstate); + if (def == NULL) + return (-1); + if (ELF_ST_TYPE(def->st_info) == STT_GNU_IFUNC) { + obj->gnu_ifunc = true; + continue; + } + target = (Elf_Addr)(defobj->relocbase + def->st_value); + reloc_jmpslot(where, target, defobj, obj, rel); + break; + + case R_386_IRELATIVE: + break; + + default: + _rtld_error("Unknown relocation type %x in PLT", + ELF_R_TYPE(rel->r_info)); + return (-1); + } } + obj->jmpslots_done = true; return 0; } +int +reloc_iresolve(Obj_Entry *obj, RtldLockState *lockstate) +{ + const Elf_Rel *rellim; + const Elf_Rel *rel; + Elf_Addr *where, target; + + if (!obj->irelative) + return (0); + rellim = (const Elf_Rel *)((char *)obj->pltrel + obj->pltrelsize); + for (rel = obj->pltrel; rel < rellim; rel++) { + switch (ELF_R_TYPE(rel->r_info)) { + case R_386_IRELATIVE: + where = (Elf_Addr *)(obj->relocbase + rel->r_offset); + lock_release(rtld_bind_lock, lockstate); + target = ((Elf_Addr (*)(void))(obj->relocbase + *where))(); + wlock_acquire(rtld_bind_lock, lockstate); + *where = target; + break; + } + } + obj->irelative = false; + return (0); +} + +int +reloc_gnu_ifunc(Obj_Entry *obj, RtldLockState *lockstate) +{ + const Elf_Rel *rellim; + const Elf_Rel *rel; + + if (!obj->gnu_ifunc) + return (0); + rellim = (const Elf_Rel *)((char *)obj->pltrel + obj->pltrelsize); + for (rel = obj->pltrel; rel < rellim; rel++) { + Elf_Addr *where, target; + const Elf_Sym *def; + const Obj_Entry *defobj; + + switch (ELF_R_TYPE(rel->r_info)) { + case R_386_JMP_SLOT: + where = (Elf_Addr *)(obj->relocbase + rel->r_offset); + def = find_symdef(ELF_R_SYM(rel->r_info), obj, &defobj, true, NULL, + lockstate); + if (def == NULL) + return (-1); + if (ELF_ST_TYPE(def->st_info) != STT_GNU_IFUNC) + continue; + lock_release(rtld_bind_lock, lockstate); + target = (Elf_Addr)rtld_resolve_ifunc(defobj, def); + wlock_acquire(rtld_bind_lock, lockstate); + reloc_jmpslot(where, target, defobj, obj, rel); + break; + } + } + + obj->gnu_ifunc = false; + return (0); +} + void allocate_initial_tls(Obj_Entry *objs) { Modified: stable/9/libexec/rtld-elf/ia64/reloc.c ============================================================================== --- stable/9/libexec/rtld-elf/ia64/reloc.c Wed Jan 4 16:43:08 2012 (r229502) +++ stable/9/libexec/rtld-elf/ia64/reloc.c Wed Jan 4 16:43:29 2012 (r229503) @@ -435,6 +435,22 @@ reloc_plt(Obj_Entry *obj) return 0; } +int +reloc_iresolve(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) +{ + + /* XXX not implemented */ + return (0); +} + +int +reloc_gnu_ifunc(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) +{ + + /* XXX not implemented */ + return (0); +} + /* Relocate the jump slots in an object. */ int reloc_jmpslots(Obj_Entry *obj, RtldLockState *lockstate) Modified: stable/9/libexec/rtld-elf/mips/reloc.c ============================================================================== --- stable/9/libexec/rtld-elf/mips/reloc.c Wed Jan 4 16:43:08 2012 (r229502) +++ stable/9/libexec/rtld-elf/mips/reloc.c Wed Jan 4 16:43:29 2012 (r229503) @@ -498,6 +498,22 @@ reloc_jmpslots(Obj_Entry *obj, RtldLockS return (0); } +int +reloc_iresolve(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) +{ + + /* XXX not implemented */ + return (0); +} + +int +reloc_gnu_ifunc(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) +{ + + /* XXX not implemented */ + return (0); +} + Elf_Addr reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const Obj_Entry *defobj, const Obj_Entry *obj, const Elf_Rel *rel) Modified: stable/9/libexec/rtld-elf/powerpc/reloc.c ============================================================================== --- stable/9/libexec/rtld-elf/powerpc/reloc.c Wed Jan 4 16:43:08 2012 (r229502) +++ stable/9/libexec/rtld-elf/powerpc/reloc.c Wed Jan 4 16:43:29 2012 (r229503) @@ -370,7 +370,7 @@ reloc_plt_object(Obj_Entry *obj, const E /* - * The icache will be sync'd in init_pltgot, which is called + * The icache will be sync'd in reloc_plt, which is called * after all the slots have been updated */ @@ -386,6 +386,7 @@ reloc_plt(Obj_Entry *obj) { const Elf_Rela *relalim; const Elf_Rela *rela; + int N = obj->pltrelasize / sizeof(Elf_Rela); if (obj->pltrelasize != 0) { @@ -400,6 +401,13 @@ reloc_plt(Obj_Entry *obj) } } + /* + * Sync the icache for the byte range represented by the + * trampoline routines and call slots. + */ + if (obj->pltgot != NULL) + __syncicache(obj->pltgot, JMPTAB_BASE(N)*4); + return (0); } @@ -508,6 +516,21 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr return (target); } +int +reloc_iresolve(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) +{ + + /* XXX not implemented */ + return (0); +} + +int +reloc_gnu_ifunc(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) +{ + + /* XXX not implemented */ + return (0); +} /* * Setup the plt glue routines. @@ -584,10 +607,9 @@ init_pltgot(Obj_Entry *obj) pltresolve[4] |= _ppc_la(obj); /* - * Sync the icache for the byte range represented by the - * trampoline routines and call slots. + * The icache will be sync'd in reloc_plt, which is called + * after all the slots have been updated */ - __syncicache(obj->pltgot, JMPTAB_BASE(N)*4); } void Modified: stable/9/libexec/rtld-elf/powerpc64/reloc.c ============================================================================== --- stable/9/libexec/rtld-elf/powerpc64/reloc.c Wed Jan 4 16:43:08 2012 (r229502) +++ stable/9/libexec/rtld-elf/powerpc64/reloc.c Wed Jan 4 16:43:29 2012 (r229503) @@ -459,6 +459,22 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr return (target); } +int +reloc_iresolve(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) +{ + + /* XXX not implemented */ + return (0); +} + +int +reloc_gnu_ifunc(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) +{ + + /* XXX not implemented */ + return (0); +} + void init_pltgot(Obj_Entry *obj) { Modified: stable/9/libexec/rtld-elf/rtld.c ============================================================================== --- stable/9/libexec/rtld-elf/rtld.c Wed Jan 4 16:43:08 2012 (r229502) +++ stable/9/libexec/rtld-elf/rtld.c Wed Jan 4 16:43:29 2012 (r229503) @@ -116,6 +116,8 @@ static void objlist_push_tail(Objlist *, static void objlist_remove(Objlist *, Obj_Entry *); static void *path_enumerate(const char *, path_enum_proc, void *); static int relocate_objects(Obj_Entry *, bool, Obj_Entry *, RtldLockState *); +static int resolve_objects_ifunc(Obj_Entry *first, bool bind_now, + RtldLockState *lockstate); static int rtld_dirname(const char *, char *); static int rtld_dirname_abs(const char *, char *); static void rtld_exit(void); @@ -513,6 +515,10 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_ ld_bind_now != NULL && *ld_bind_now != '\0', &obj_rtld, NULL) == -1) die(); + if (resolve_objects_ifunc(obj_main, + ld_bind_now != NULL && *ld_bind_now != '\0', NULL) == -1) + die(); + dbg("doing copy relocations"); if (do_copy_relocations(obj_main) == -1) die(); @@ -561,6 +567,17 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_ return (func_ptr_type) obj_main->entry; } +void * +rtld_resolve_ifunc(const Obj_Entry *obj, const Elf_Sym *def) +{ + void *ptr; + Elf_Addr target; + + ptr = (void *)make_function_pointer(def, obj); + target = ((Elf_Addr (*)(void))ptr)(); + return ((void *)target); +} + Elf_Addr _rtld_bind(Obj_Entry *obj, Elf_Size reloff) { @@ -584,8 +601,10 @@ _rtld_bind(Obj_Entry *obj, Elf_Size relo &lockstate); if (def == NULL) die(); - - target = (Elf_Addr)(defobj->relocbase + def->st_value); + if (ELF_ST_TYPE(def->st_info) == STT_GNU_IFUNC) + target = (Elf_Addr)rtld_resolve_ifunc(defobj, def); + else + target = (Elf_Addr)(defobj->relocbase + def->st_value); dbg("\"%s\" in \"%s\" ==> %p in \"%s\"", defobj->strtab + def->st_name, basename(obj->path), @@ -1944,6 +1963,10 @@ relocate_objects(Obj_Entry *first, bool } } + + /* Set the special PLT or GOT entries. */ + init_pltgot(obj); + /* Process the PLT relocations. */ if (reloc_plt(obj) == -1) return -1; @@ -1952,7 +1975,6 @@ relocate_objects(Obj_Entry *first, bool if (reloc_jmpslots(obj, lockstate) == -1) return -1; - /* * Set up the magic number and version in the Obj_Entry. These * were checked in the crt1.o from the original ElfKit, so we @@ -1960,12 +1982,55 @@ relocate_objects(Obj_Entry *first, bool */ obj->magic = RTLD_MAGIC; obj->version = RTLD_VERSION; - - /* Set the special PLT or GOT entries. */ - init_pltgot(obj); } - return 0; + return (0); +} + +/* + * The handling of R_MACHINE_IRELATIVE relocations and jumpslots + * referencing STT_GNU_IFUNC symbols is postponed till the other + * relocations are done. The indirect functions specified as + * ifunc are allowed to call other symbols, so we need to have + * objects relocated before asking for resolution from indirects. + * + * The R_MACHINE_IRELATIVE slots are resolved in greedy fashion, + * instead of the usual lazy handling of PLT slots. It is + * consistent with how GNU does it. + */ +static int +resolve_object_ifunc(Obj_Entry *obj, bool bind_now, RtldLockState *lockstate) +{ + if (obj->irelative && reloc_iresolve(obj, lockstate) == -1) + return (-1); + if ((obj->bind_now || bind_now) && obj->gnu_ifunc && + reloc_gnu_ifunc(obj, lockstate) == -1) + return (-1); + return (0); +} + +static int +resolve_objects_ifunc(Obj_Entry *first, bool bind_now, RtldLockState *lockstate) +{ + Obj_Entry *obj; + + for (obj = first; obj != NULL; obj = obj->next) { + if (resolve_object_ifunc(obj, bind_now, lockstate) == -1) + return (-1); + } + return (0); +} + +static int +initlist_objects_ifunc(Objlist *list, bool bind_now, RtldLockState *lockstate) +{ + Objlist_Entry *elm; + + STAILQ_FOREACH(elm, list, link) { + if (resolve_object_ifunc(elm->obj, bind_now, lockstate) == -1) + return (-1); + } + return (0); } /* @@ -2170,6 +2235,16 @@ dlopen(const char *name, int mode) mode & (RTLD_MODEMASK | RTLD_GLOBAL))); } +static void +dlopen_cleanup(Obj_Entry *obj) +{ + + obj->dl_refcount--; + unref_dag(obj); + if (obj->refcount == 0) + unload_object(obj); +} + static Obj_Entry * dlopen_object(const char *name, Obj_Entry *refobj, int lo_flags, int mode) { @@ -2208,10 +2283,7 @@ dlopen_object(const char *name, Obj_Entr goto trace; if (result == -1 || (relocate_objects(obj, (mode & RTLD_MODEMASK) == RTLD_NOW, &obj_rtld, &lockstate)) == -1) { - obj->dl_refcount--; - unref_dag(obj); - if (obj->refcount == 0) - unload_object(obj); + dlopen_cleanup(obj); obj = NULL; } else { /* Make list of init functions to call. */ @@ -2245,6 +2317,14 @@ dlopen_object(const char *name, Obj_Entr map_stacks_exec(&lockstate); + if (initlist_objects_ifunc(&initlist, (mode & RTLD_MODEMASK) == RTLD_NOW, + &lockstate) == -1) { + objlist_clear(&initlist); + dlopen_cleanup(obj); + lock_release(rtld_bind_lock, &lockstate); + return (NULL); + } + /* Call the init functions. */ objlist_call_init(&initlist, &lockstate); objlist_clear(&initlist); @@ -2376,9 +2456,11 @@ do_dlsym(void *handle, const char *name, * the relocated value of the symbol. */ if (ELF_ST_TYPE(def->st_info) == STT_FUNC) - return make_function_pointer(def, defobj); + return (make_function_pointer(def, defobj)); + else if (ELF_ST_TYPE(def->st_info) == STT_GNU_IFUNC) + return (rtld_resolve_ifunc(defobj, def)); else - return defobj->relocbase + def->st_value; + return (defobj->relocbase + def->st_value); } _rtld_error("Undefined symbol \"%s\"", name); @@ -2822,6 +2904,8 @@ get_program_var_addr(const char *name, R if (ELF_ST_TYPE(req.sym_out->st_info) == STT_FUNC) return ((const void **)make_function_pointer(req.sym_out, req.defobj_out)); + else if (ELF_ST_TYPE(req.sym_out->st_info) == STT_GNU_IFUNC) + return ((const void **)rtld_resolve_ifunc(req.defobj_out, req.sym_out)); else return ((const void **)(req.defobj_out->relocbase + req.sym_out->st_value)); @@ -3088,6 +3172,7 @@ symlook_obj1(SymLook *req, const Obj_Ent case STT_FUNC: case STT_NOTYPE: case STT_OBJECT: + case STT_GNU_IFUNC: if (symp->st_value == 0) continue; /* fallthrough */ Modified: stable/9/libexec/rtld-elf/rtld.h ============================================================================== --- stable/9/libexec/rtld-elf/rtld.h Wed Jan 4 16:43:08 2012 (r229502) +++ stable/9/libexec/rtld-elf/rtld.h Wed Jan 4 16:43:29 2012 (r229503) @@ -230,6 +230,8 @@ typedef struct Struct_Obj_Entry { bool on_fini_list: 1; /* Object is already on fini list. */ bool dag_inited : 1; /* Object has its DAG initialized. */ bool filtees_loaded : 1; /* Filtees loaded */ + bool irelative : 1; /* Object has R_MACHDEP_IRELATIVE relocs */ + bool gnu_ifunc : 1; /* Object has references to STT_GNU_IFUNC */ struct link_map linkmap; /* For GDB and dlinfo() */ Objlist dldags; /* Object belongs to these dlopened DAGs (%) */ @@ -317,6 +319,7 @@ void lockdflt_init(void); void obj_free(Obj_Entry *); Obj_Entry *obj_new(void); void _rtld_bind_start(void); +void *rtld_resolve_ifunc(const Obj_Entry *obj, const Elf_Sym *def); void symlook_init(SymLook *, const char *); int symlook_obj(SymLook *, const Obj_Entry *); void *tls_get_addr_common(Elf_Addr** dtvp, int index, size_t offset); @@ -334,6 +337,8 @@ int do_copy_relocations(Obj_Entry *); int reloc_non_plt(Obj_Entry *, Obj_Entry *, struct Struct_RtldLockState *); int reloc_plt(Obj_Entry *); int reloc_jmpslots(Obj_Entry *, struct Struct_RtldLockState *); +int reloc_iresolve(Obj_Entry *, struct Struct_RtldLockState *); +int reloc_gnu_ifunc(Obj_Entry *, struct Struct_RtldLockState *); void allocate_initial_tls(Obj_Entry *); #endif /* } */ Modified: stable/9/libexec/rtld-elf/sparc64/reloc.c ============================================================================== --- stable/9/libexec/rtld-elf/sparc64/reloc.c Wed Jan 4 16:43:08 2012 (r229502) +++ stable/9/libexec/rtld-elf/sparc64/reloc.c Wed Jan 4 16:43:29 2012 (r229503) @@ -550,6 +550,22 @@ reloc_jmpslots(Obj_Entry *obj, RtldLockS return (0); } +int +reloc_iresolve(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) +{ + + /* XXX not implemented */ + return (0); +} + +int +reloc_gnu_ifunc(Obj_Entry *obj, struct Struct_RtldLockState *lockstate) +{ + + /* XXX not implemented */ + return (0); +} + Elf_Addr reloc_jmpslot(Elf_Addr *wherep, Elf_Addr target, const Obj_Entry *obj, const Obj_Entry *refobj, const Elf_Rel *rel) From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 16:45:13 2012 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 DEDB7106564A; Wed, 4 Jan 2012 16:45:12 +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 CB4D18FC08; Wed, 4 Jan 2012 16:45:12 +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 q04GjCng087390; Wed, 4 Jan 2012 16:45:12 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04GjCOn087383; Wed, 4 Jan 2012 16:45:12 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201041645.q04GjCOn087383@svn.freebsd.org> From: John Baldwin Date: Wed, 4 Jan 2012 16:45:12 +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: r229504 - in stable/8/sys/boot/i386: common libi386 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, 04 Jan 2012 16:45:13 -0000 Author: jhb Date: Wed Jan 4 16:45:12 2012 New Revision: 229504 URL: http://svn.freebsd.org/changeset/base/229504 Log: MFC 226748: - Add a new header for the x86 boot code that defines various structures and constants related to the BIOS Enhanced Disk Drive Specification. - Use this header instead of magic numbers and various duplicate structure definitions for doing I/O. - Use an actual structure for the request to fetch drive parameters in drvsize() rather than a gross hack of a char array with some magic size. While here, change drvsize() to only pass the 1.1 version of the structure and not request device path information. If we want device path information you have to set the length of the device path information as an input (along with probably checking the actual EDD version to see which size one should use as the device path information is variable-length). This fixes data smashing problems from passing an EDD 3 structure to BIOSes supporting EDD 4. Added: stable/8/sys/boot/i386/common/edd.h - copied unchanged from r226748, head/sys/boot/i386/common/edd.h Modified: stable/8/sys/boot/i386/common/drv.c stable/8/sys/boot/i386/libi386/Makefile stable/8/sys/boot/i386/libi386/bioscd.c stable/8/sys/boot/i386/libi386/biosdisk.c stable/8/sys/boot/i386/libi386/libi386.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/boot/i386/common/drv.c ============================================================================== --- stable/8/sys/boot/i386/common/drv.c Wed Jan 4 16:43:29 2012 (r229503) +++ stable/8/sys/boot/i386/common/drv.c Wed Jan 4 16:45:12 2012 (r229504) @@ -24,43 +24,36 @@ __FBSDID("$FreeBSD$"); #include "rbx.h" #include "util.h" #include "drv.h" +#include "edd.h" #ifdef USE_XREAD #include "xreadorg.h" #endif #ifdef GPT +static struct edd_params params; + uint64_t drvsize(struct dsk *dskp) { - unsigned char params[0x42]; - uint64_t sectors; - - *(uint32_t *)params = sizeof(params); + params.len = sizeof(struct edd_params); v86.ctl = V86_FLAGS; v86.addr = 0x13; v86.eax = 0x4800; v86.edx = dskp->drive; - v86.ds = VTOPSEG(params); - v86.esi = VTOPOFF(params); + v86.ds = VTOPSEG(¶ms); + v86.esi = VTOPOFF(¶ms); v86int(); if (V86_CY(v86.efl)) { printf("error %u\n", v86.eax >> 8 & 0xff); return (0); } - memcpy(§ors, params + 0x10, sizeof(sectors)); - return (sectors); + return (params.sectors); } #endif /* GPT */ #ifndef USE_XREAD -static struct { - uint16_t len; - uint16_t count; - uint16_t off; - uint16_t seg; - uint64_t lba; -} packet; +static struct edd_packet packet; #endif int @@ -71,7 +64,7 @@ drvread(struct dsk *dskp, void *buf, dad if (!OPT_CHECK(RBX_QUIET)) printf("%c\b", c = c << 8 | c >> 24); #ifndef USE_XREAD - packet.len = 0x10; + packet.len = sizeof(struct edd_packet); packet.count = nblk; packet.off = VTOPOFF(buf); packet.seg = VTOPSEG(buf); @@ -105,7 +98,7 @@ int drvwrite(struct dsk *dskp, void *buf, daddr_t lba, unsigned nblk) { - packet.len = 0x10; + packet.len = sizeof(struct edd_packet); packet.count = nblk; packet.off = VTOPOFF(buf); packet.seg = VTOPSEG(buf); Copied: stable/8/sys/boot/i386/common/edd.h (from r226748, head/sys/boot/i386/common/edd.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/boot/i386/common/edd.h Wed Jan 4 16:45:12 2012 (r229504, copy of r226748, head/sys/boot/i386/common/edd.h) @@ -0,0 +1,110 @@ +/*- + * Copyright (c) 2011 Advanced Computing Technologies LLC + * Written by: John H. Baldwin + * 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 THE AUTHOR AND CONTRIBUTORS ``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 THE AUTHOR 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. + * + * $FreeBSD$ + */ + +#ifndef _EDD_H_ +#define _EDD_H_ + +/* Supported interfaces for "Check Extensions Present". */ +#define EDD_INTERFACE_FIXED_DISK 0x01 +#define EDD_INTERFACE_EJECT 0x02 +#define EDD_INTERFACE_EDD 0x04 + +struct edd_packet { + uint16_t len; + uint16_t count; + uint16_t off; + uint16_t seg; + uint64_t lba; +}; + +struct edd_packet_v3 { + uint16_t len; + uint16_t count; + uint16_t off; + uint16_t seg; + uint64_t lba; + uint64_t phys_addr; +}; + +struct edd_params { + uint16_t len; + uint16_t flags; + uint32_t cylinders; + uint32_t heads; + uint32_t sectors_per_track; + uint64_t sectors; + uint16_t sector_size; + uint16_t edd_params_seg; + uint16_t edd_params_off; +}; + +struct edd_device_path_v3 { + uint16_t key; + uint8_t len; + uint8_t reserved[3]; + char host_bus[4]; + char interface[8]; + uint64_t interface_path; + uint64_t device_path; + uint8_t reserved2[1]; + uint8_t checksum; +}; + +struct edd_params_v3 { + struct edd_params params; + struct edd_device_path_v3 device_path; +}; + +struct edd_device_path_v4 { + uint16_t key; + uint8_t len; + uint8_t reserved[3]; + char host_bus[4]; + char interface[8]; + uint64_t interface_path; + uint64_t device_path[2]; + uint8_t reserved2[1]; + uint8_t checksum; +}; + +struct edd_params_v4 { + struct edd_params params; + struct edd_device_path_v4 device_path; +}; + +#define EDD_FLAGS_DMA_BOUNDARY_HANDLING 0x0001 +#define EDD_FLAGS_REMOVABLE_MEDIA 0x0002 +#define EDD_FLAGS_WRITE_VERIFY 0x0004 +#define EDD_FLAGS_MEDIA_CHANGE_NOTIFICATION 0x0008 +#define EDD_FLAGS_LOCKABLE_MEDIA 0x0010 +#define EDD_FLAGS_NO_MEDIA_PRESENT 0x0020 + +#define EDD_DEVICE_PATH_KEY 0xbedd + +#endif /* !_EDD_H_ */ Modified: stable/8/sys/boot/i386/libi386/Makefile ============================================================================== --- stable/8/sys/boot/i386/libi386/Makefile Wed Jan 4 16:43:29 2012 (r229503) +++ stable/8/sys/boot/i386/libi386/Makefile Wed Jan 4 16:45:12 2012 (r229504) @@ -47,7 +47,8 @@ CFLAGS+= -DTERM_EMU # XXX: make alloca() useable CFLAGS+= -Dalloca=__builtin_alloca -CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../btx/lib \ +CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../common \ + -I${.CURDIR}/../btx/lib \ -I${.CURDIR}/../../../contrib/dev/acpica/include \ -I${.CURDIR}/../../.. -I. # the location of libstand Modified: stable/8/sys/boot/i386/libi386/bioscd.c ============================================================================== --- stable/8/sys/boot/i386/libi386/bioscd.c Wed Jan 4 16:43:29 2012 (r229503) +++ stable/8/sys/boot/i386/libi386/bioscd.c Wed Jan 4 16:45:12 2012 (r229504) @@ -321,9 +321,9 @@ bc_read(int unit, daddr_t dblk, int blks v86int(); } - packet.len = 0x10; + packet.len = sizeof(struct edd_packet); packet.count = x; - packet.offset = VTOPOFF(xp); + packet.off = VTOPOFF(xp); packet.seg = VTOPSEG(xp); packet.lba = dblk; v86.ctl = V86_FLAGS; Modified: stable/8/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- stable/8/sys/boot/i386/libi386/biosdisk.c Wed Jan 4 16:43:29 2012 (r229503) +++ stable/8/sys/boot/i386/libi386/biosdisk.c Wed Jan 4 16:45:12 2012 (r229504) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include "libi386.h" #define BIOS_NUMDRIVES 0x475 @@ -264,7 +265,7 @@ bd_int13probe(struct bdinfo *bd) v86int(); if (!(V86_CY(v86.efl)) && /* carry clear */ ((v86.ebx & 0xffff) == 0xaa55) && /* signature */ - (v86.ecx & 0x1)) { /* packets mode ok */ + (v86.ecx & EDD_INTERFACE_FIXED_DISK)) { /* packets mode ok */ bd->bd_flags |= BD_MODEEDD1; if ((v86.eax & 0xff00) >= 0x3000) bd->bd_flags |= BD_MODEEDD3; @@ -1132,9 +1133,9 @@ bd_edd_io(struct open_disk *od, daddr_t { static struct edd_packet packet; - packet.len = 0x10; + packet.len = sizeof(struct edd_packet); packet.count = blks; - packet.offset = VTOPOFF(dest); + packet.off = VTOPOFF(dest); packet.seg = VTOPSEG(dest); packet.lba = dblk; v86.ctl = V86_FLAGS; Modified: stable/8/sys/boot/i386/libi386/libi386.h ============================================================================== --- stable/8/sys/boot/i386/libi386/libi386.h Wed Jan 4 16:43:29 2012 (r229503) +++ stable/8/sys/boot/i386/libi386/libi386.h Wed Jan 4 16:45:12 2012 (r229504) @@ -52,14 +52,6 @@ struct i386_devdesc } d_kind; }; -struct edd_packet { - uint16_t len; - uint16_t count; - uint16_t offset; - uint16_t seg; - uint64_t lba; -}; - int i386_getdev(void **vdev, const char *devspec, const char **path); char *i386_fmtdev(void *vdev); int i386_setcurrdev(struct env_var *ev, int flags, const void *value); From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 16:50:13 2012 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 13C751065670; Wed, 4 Jan 2012 16:50:13 +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 DB9A98FC0A; Wed, 4 Jan 2012 16:50:12 +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 q04GoCR4087597; Wed, 4 Jan 2012 16:50:12 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04GoCmw087594; Wed, 4 Jan 2012 16:50:12 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201041650.q04GoCmw087594@svn.freebsd.org> From: John Baldwin Date: Wed, 4 Jan 2012 16:50:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229505 - in stable/9/sys: fs/devfs 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, 04 Jan 2012 16:50:13 -0000 Author: jhb Date: Wed Jan 4 16:50:12 2012 New Revision: 229505 URL: http://svn.freebsd.org/changeset/base/229505 Log: MFC 227069: Move the cleanup of f_cdevpriv when the reference count of a devfs file descriptor drops to zero out of _fdrop() and into devfs_close_f() as it is only relevant for devfs file descriptors. Modified: stable/9/sys/fs/devfs/devfs_vnops.c stable/9/sys/kern/kern_descrip.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/fs/devfs/devfs_vnops.c ============================================================================== --- stable/9/sys/fs/devfs/devfs_vnops.c Wed Jan 4 16:45:12 2012 (r229504) +++ stable/9/sys/fs/devfs/devfs_vnops.c Wed Jan 4 16:50:12 2012 (r229505) @@ -604,6 +604,13 @@ devfs_close_f(struct file *fp, struct th td->td_fpop = fp; error = vnops.fo_close(fp, td); td->td_fpop = fpop; + + /* + * The f_cdevpriv cannot be assigned non-NULL value while we + * are destroying the file. + */ + if (fp->f_cdevpriv != NULL) + devfs_fpdrop(fp); return (error); } Modified: stable/9/sys/kern/kern_descrip.c ============================================================================== --- stable/9/sys/kern/kern_descrip.c Wed Jan 4 16:45:12 2012 (r229504) +++ stable/9/sys/kern/kern_descrip.c Wed Jan 4 16:50:12 2012 (r229505) @@ -2575,12 +2575,6 @@ _fdrop(struct file *fp, struct thread *t panic("fdrop: count %d", fp->f_count); if (fp->f_ops != &badfileops) error = fo_close(fp, td); - /* - * The f_cdevpriv cannot be assigned non-NULL value while we - * are destroying the file. - */ - if (fp->f_cdevpriv != NULL) - devfs_fpdrop(fp); atomic_subtract_int(&openfiles, 1); crfree(fp->f_cred); uma_zfree(file_zone, fp); From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 16:51:04 2012 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 BDF89106564A; Wed, 4 Jan 2012 16:51:04 +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 ABCAE8FC25; Wed, 4 Jan 2012 16:51:04 +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 q04Gp4AD087661; Wed, 4 Jan 2012 16:51:04 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04Gp4eD087658; Wed, 4 Jan 2012 16:51:04 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201041651.q04Gp4eD087658@svn.freebsd.org> From: John Baldwin Date: Wed, 4 Jan 2012 16:51:04 +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: r229506 - in stable/8/sys: fs/devfs 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, 04 Jan 2012 16:51:04 -0000 Author: jhb Date: Wed Jan 4 16:51:04 2012 New Revision: 229506 URL: http://svn.freebsd.org/changeset/base/229506 Log: MFC 227069: Move the cleanup of f_cdevpriv when the reference count of a devfs file descriptor drops to zero out of _fdrop() and into devfs_close_f() as it is only relevant for devfs file descriptors. Modified: stable/8/sys/fs/devfs/devfs_vnops.c stable/8/sys/kern/kern_descrip.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/fs/devfs/devfs_vnops.c ============================================================================== --- stable/8/sys/fs/devfs/devfs_vnops.c Wed Jan 4 16:50:12 2012 (r229505) +++ stable/8/sys/fs/devfs/devfs_vnops.c Wed Jan 4 16:51:04 2012 (r229506) @@ -552,6 +552,13 @@ devfs_close_f(struct file *fp, struct th td->td_fpop = fp; error = vnops.fo_close(fp, td); td->td_fpop = fpop; + + /* + * The f_cdevpriv cannot be assigned non-NULL value while we + * are destroying the file. + */ + if (fp->f_cdevpriv != NULL) + devfs_fpdrop(fp); return (error); } Modified: stable/8/sys/kern/kern_descrip.c ============================================================================== --- stable/8/sys/kern/kern_descrip.c Wed Jan 4 16:50:12 2012 (r229505) +++ stable/8/sys/kern/kern_descrip.c Wed Jan 4 16:51:04 2012 (r229506) @@ -2359,12 +2359,6 @@ _fdrop(struct file *fp, struct thread *t panic("fdrop: count %d", fp->f_count); if (fp->f_ops != &badfileops) error = fo_close(fp, td); - /* - * The f_cdevpriv cannot be assigned non-NULL value while we - * are destroying the file. - */ - if (fp->f_cdevpriv != NULL) - devfs_fpdrop(fp); atomic_subtract_int(&openfiles, 1); crfree(fp->f_cred); uma_zfree(file_zone, fp); From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 17:17:12 2012 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 7EF3D1065679; Wed, 4 Jan 2012 17:17:12 +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 6D9648FC19; Wed, 4 Jan 2012 17:17:12 +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 q04HHCES088507; Wed, 4 Jan 2012 17:17:12 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04HHCBr088505; Wed, 4 Jan 2012 17:17:12 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201041717.q04HHCBr088505@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 4 Jan 2012 17:17:12 +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: r229508 - 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: Wed, 04 Jan 2012 17:17:12 -0000 Author: kib Date: Wed Jan 4 17:17:11 2012 New Revision: 229508 URL: http://svn.freebsd.org/changeset/base/229508 Log: Postpone the resolution of IRELATIVE relocations and IFUNC-targeted relocations until tls is initialized and stacks permissions correctly set. This allows the ifunc to call malloc(3) and some other heavy services. Add debug banner. MFC after: 3 days Modified: head/libexec/rtld-elf/rtld.c Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Wed Jan 4 17:01:12 2012 (r229507) +++ head/libexec/rtld-elf/rtld.c Wed Jan 4 17:17:11 2012 (r229508) @@ -515,10 +515,6 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_ ld_bind_now != NULL && *ld_bind_now != '\0', &obj_rtld, NULL) == -1) die(); - if (resolve_objects_ifunc(obj_main, - ld_bind_now != NULL && *ld_bind_now != '\0', NULL) == -1) - die(); - dbg("doing copy relocations"); if (do_copy_relocations(obj_main) == -1) die(); @@ -549,6 +545,11 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_ map_stacks_exec(NULL); + dbg("resolving ifuncs"); + if (resolve_objects_ifunc(obj_main, + ld_bind_now != NULL && *ld_bind_now != '\0', NULL) == -1) + die(); + wlock_acquire(rtld_bind_lock, &lockstate); objlist_call_init(&initlist, &lockstate); objlist_clear(&initlist); From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 17:22:11 2012 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 9ABFB1065677; Wed, 4 Jan 2012 17:22:11 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4D04D8FC16; Wed, 4 Jan 2012 17:22: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 q04HMBk4088704; Wed, 4 Jan 2012 17:22:11 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04HMBe2088691; Wed, 4 Jan 2012 17:22:11 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201201041722.q04HMBe2088691@svn.freebsd.org> From: Mikolaj Golub Date: Wed, 4 Jan 2012 17:22:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229509 - in stable/9/sbin: hastctl hastd 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, 04 Jan 2012 17:22:11 -0000 Author: trociny Date: Wed Jan 4 17:22:10 2012 New Revision: 229509 URL: http://svn.freebsd.org/changeset/base/229509 Log: MFC r225773, r225781, r225782, r225783, r225784, 225785, r225786, r225787, r225830, r225831, r225832, r225835, r226461, r226462, r226463, r226842, r226851, r226852, r226854, r226855, r226856, r226857, r226859, r226861, r228542, r228542, r228543, r228544, r228695, r228696: r225773 (pjd): Ensure that pjdlog functions don't modify errno. r225781 (pjd): No need to use KEEP_ERRNO() macro around pjdlog functions, as they don't modify errno. r225782 (pjd): Prefer PJDLOG_ASSERT() and PJDLOG_ABORT() over assert() and abort(). pjdlog versions will log problem to syslog when application is running in background. r225783 (pjd): Correct two mistakes when converting asserts to PJDLOG_ASSERT()/PJDLOG_ABORT(). r225784 (pjd): - Convert some impossible conditions into assertions. - Add missing 'if' in comment. r225785 (pjd): Prefer PJDLOG_ASSERT()/PJDLOG_ABORT() over assert(). r225786 (pjd): No need to wrap pjdlog functions around with KEEP_ERRNO() macro. r225787 (pjd): Use PJDLOG_ASSERT() and PJDLOG_ABORT() everywhere instead of assert(). r225830 (pjd): After every activemap change flush disk's write cache, so that write reordering won't make the actual write to be committed before marking the coresponding extent as dirty. It can be disabled in configuration file. If BIO_FLUSH is not supported by the underlying file system we log a warning and never send BIO_FLUSH again to that GEOM provider. r225831 (pjd): Break a bit earlier. r225832 (pjd): If the underlying provider doesn't support BIO_FLUSH, log it only once and don't bother trying in the future. r225835 (pjd): Correct typo. r226461 (pjd): When path to the configuration file is relative, obtain full path, so we can always find the file, even after daemonizing and changing working directory to /. r226462 (pjd): Remove redundant space. r226463 (pjd): Allow to specify pidfile in HAST configuration file. r226842 (pjd): Correct comments. r226851 (pjd): Delay resuid generation until first connection to secondary, not until first write. This way on first connection we will synchronize only the extents that were modified during the lifetime of primary node, not entire GEOM provider. r226852 (pjd): Minor cleanups. r226854 (pjd): - Eliminate the need for hio_nv. - Introduce hio_clear() function for clearing hio before returning it onto free queue. r226855 (pjd): Improve comment so it doesn't suggest race is possible, but that we handle the race. r226856 (pjd): Reduce indentation. r226857 (pjd): Minor cleanups. r226859 (pjd): Implement 'async' mode for HAST. r226861 (pjd): Remove redundant space. r228542 (pjd): Remove redundant setting of the error variable. Found by: Clang Static Analyzer r228543 (pjd): Simplify code by changing functions types from int to avoid, as the functions always return 0. Found by: Clang Static Analyzer r228544 (pjd): Remove redundant assignment. Found by: Clang Static Analyzer r228695 (pjd): Don't use function name as format string. Detected by: clang r228696 (pjd): Use lex's standard way of not generating unused function. Inspired by: r228555 Modified: stable/9/sbin/hastctl/hastctl.c stable/9/sbin/hastd/Makefile stable/9/sbin/hastd/activemap.c stable/9/sbin/hastd/control.c stable/9/sbin/hastd/ebuf.c stable/9/sbin/hastd/event.c stable/9/sbin/hastd/hast.conf.5 stable/9/sbin/hastd/hast.h stable/9/sbin/hastd/hast_checksum.c stable/9/sbin/hastd/hast_proto.c stable/9/sbin/hastd/hastd.c stable/9/sbin/hastd/hooks.c stable/9/sbin/hastd/metadata.c stable/9/sbin/hastd/nv.c stable/9/sbin/hastd/parse.y stable/9/sbin/hastd/pjdlog.c stable/9/sbin/hastd/pjdlog.h stable/9/sbin/hastd/primary.c stable/9/sbin/hastd/proto_tcp.c stable/9/sbin/hastd/rangelock.c stable/9/sbin/hastd/secondary.c stable/9/sbin/hastd/subr.c stable/9/sbin/hastd/synch.h stable/9/sbin/hastd/token.l Directory Properties: stable/9/sbin/hastctl/ (props changed) stable/9/sbin/hastd/ (props changed) Modified: stable/9/sbin/hastctl/hastctl.c ============================================================================== --- stable/9/sbin/hastctl/hastctl.c Wed Jan 4 17:17:11 2012 (r229508) +++ stable/9/sbin/hastctl/hastctl.c Wed Jan 4 17:22:10 2012 (r229509) @@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include @@ -433,19 +432,19 @@ main(int argc, char *argv[]) pjdlog_debug_set(debug); cfg = yy_config_parse(cfgpath, true); - assert(cfg != NULL); + PJDLOG_ASSERT(cfg != NULL); switch (cmd) { case CMD_CREATE: control_create(argc, argv, mediasize, extentsize, keepdirty); /* NOTREACHED */ - assert(!"What are we doing here?!"); + PJDLOG_ABORT("What are we doing here?!"); break; case CMD_DUMP: /* Dump metadata from local component of the given resource. */ control_dump(argc, argv); /* NOTREACHED */ - assert(!"What are we doing here?!"); + PJDLOG_ABORT("What are we doing here?!"); break; case CMD_ROLE: /* Change role for the given resources. */ @@ -476,7 +475,7 @@ main(int argc, char *argv[]) } break; default: - assert(!"Impossible command!"); + PJDLOG_ABORT("Impossible command!"); } /* Setup control connection... */ @@ -523,7 +522,7 @@ main(int argc, char *argv[]) error = control_status(nv); break; default: - assert(!"Impossible command!"); + PJDLOG_ABORT("Impossible command!"); } exit(error); Modified: stable/9/sbin/hastd/Makefile ============================================================================== --- stable/9/sbin/hastd/Makefile Wed Jan 4 17:17:11 2012 (r229508) +++ stable/9/sbin/hastd/Makefile Wed Jan 4 17:22:10 2012 (r229509) @@ -28,9 +28,6 @@ CFLAGS+=-DINET .if ${MK_INET6_SUPPORT} != "no" CFLAGS+=-DINET6 .endif -# This is needed to have WARNS > 1. -CFLAGS+=-DYY_NO_UNPUT -CFLAGS+=-DYY_NO_INPUT DPADD= ${LIBGEOM} ${LIBBSDXML} ${LIBSBUF} ${LIBL} ${LIBPTHREAD} ${LIBUTIL} LDADD= -lgeom -lbsdxml -lsbuf -ll -lpthread -lutil Modified: stable/9/sbin/hastd/activemap.c ============================================================================== --- stable/9/sbin/hastd/activemap.c Wed Jan 4 17:17:11 2012 (r229508) +++ stable/9/sbin/hastd/activemap.c Wed Jan 4 17:22:10 2012 (r229509) @@ -33,7 +33,6 @@ __FBSDID("$FreeBSD$"); #include /* powerof2() */ #include -#include #include #include #include @@ -41,7 +40,14 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include + +#include "activemap.h" + +#ifndef PJDLOG_ASSERT +#include +#define PJDLOG_ASSERT(...) assert(__VA_ARGS__) +#endif #define ACTIVEMAP_MAGIC 0xac71e4 struct activemap { @@ -93,9 +99,9 @@ off2ext(const struct activemap *amp, off { int extent; - assert(offset >= 0 && offset < amp->am_mediasize); + PJDLOG_ASSERT(offset >= 0 && offset < amp->am_mediasize); extent = (offset >> amp->am_extentshift); - assert(extent >= 0 && extent < amp->am_nextents); + PJDLOG_ASSERT(extent >= 0 && extent < amp->am_nextents); return (extent); } @@ -104,9 +110,9 @@ ext2off(const struct activemap *amp, int { off_t offset; - assert(extent >= 0 && extent < amp->am_nextents); + PJDLOG_ASSERT(extent >= 0 && extent < amp->am_nextents); offset = ((off_t)extent << amp->am_extentshift); - assert(offset >= 0 && offset < amp->am_mediasize); + PJDLOG_ASSERT(offset >= 0 && offset < amp->am_mediasize); return (offset); } @@ -122,7 +128,7 @@ ext2reqs(const struct activemap *amp, in if (ext < amp->am_nextents - 1) return (((amp->am_extentsize - 1) / MAXPHYS) + 1); - assert(ext == amp->am_nextents - 1); + PJDLOG_ASSERT(ext == amp->am_nextents - 1); left = amp->am_mediasize % amp->am_extentsize; if (left == 0) left = amp->am_extentsize; @@ -139,13 +145,13 @@ activemap_init(struct activemap **ampp, { struct activemap *amp; - assert(ampp != NULL); - assert(mediasize > 0); - assert(extentsize > 0); - assert(powerof2(extentsize)); - assert(sectorsize > 0); - assert(powerof2(sectorsize)); - assert(keepdirty > 0); + PJDLOG_ASSERT(ampp != NULL); + PJDLOG_ASSERT(mediasize > 0); + PJDLOG_ASSERT(extentsize > 0); + PJDLOG_ASSERT(powerof2(extentsize)); + PJDLOG_ASSERT(sectorsize > 0); + PJDLOG_ASSERT(powerof2(sectorsize)); + PJDLOG_ASSERT(keepdirty > 0); amp = malloc(sizeof(*amp)); if (amp == NULL) @@ -225,10 +231,10 @@ keepdirty_add(struct activemap *amp, int */ if (amp->am_nkeepdirty >= amp->am_nkeepdirty_limit) { kd = TAILQ_LAST(&->am_keepdirty, skeepdirty); - assert(kd != NULL); + PJDLOG_ASSERT(kd != NULL); TAILQ_REMOVE(&->am_keepdirty, kd, kd_next); amp->am_nkeepdirty--; - assert(amp->am_nkeepdirty > 0); + PJDLOG_ASSERT(amp->am_nkeepdirty > 0); } if (kd == NULL) kd = malloc(sizeof(*kd)); @@ -261,7 +267,7 @@ keepdirty_free(struct activemap *amp) amp->am_nkeepdirty--; free(kd); } - assert(amp->am_nkeepdirty == 0); + PJDLOG_ASSERT(amp->am_nkeepdirty == 0); } /* @@ -271,7 +277,7 @@ void activemap_free(struct activemap *amp) { - assert(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); amp->am_magic = 0; @@ -293,8 +299,8 @@ activemap_write_start(struct activemap * off_t end; int ext; - assert(amp->am_magic == ACTIVEMAP_MAGIC); - assert(length > 0); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(length > 0); modified = false; end = offset + length - 1; @@ -307,7 +313,7 @@ activemap_write_start(struct activemap * * was modified and has to be flushed to disk. */ if (amp->am_memtab[ext]++ == 0) { - assert(!bit_test(amp->am_memmap, ext)); + PJDLOG_ASSERT(!bit_test(amp->am_memmap, ext)); bit_set(amp->am_memmap, ext); amp->am_ndirty++; } @@ -329,8 +335,8 @@ activemap_write_complete(struct activema off_t end; int ext; - assert(amp->am_magic == ACTIVEMAP_MAGIC); - assert(length > 0); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(length > 0); modified = false; end = offset + length - 1; @@ -342,8 +348,8 @@ activemap_write_complete(struct activema * By returning true we inform the caller that on-disk bitmap * was modified and has to be flushed to disk. */ - assert(amp->am_memtab[ext] > 0); - assert(bit_test(amp->am_memmap, ext)); + PJDLOG_ASSERT(amp->am_memtab[ext] > 0); + PJDLOG_ASSERT(bit_test(amp->am_memmap, ext)); if (--amp->am_memtab[ext] == 0) { bit_clear(amp->am_memmap, ext); amp->am_ndirty--; @@ -365,15 +371,15 @@ activemap_extent_complete(struct activem bool modified; int reqs; - assert(amp->am_magic == ACTIVEMAP_MAGIC); - assert(extent >= 0 && extent < amp->am_nextents); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(extent >= 0 && extent < amp->am_nextents); modified = false; reqs = ext2reqs(amp, extent); - assert(amp->am_memtab[extent] >= reqs); + PJDLOG_ASSERT(amp->am_memtab[extent] >= reqs); amp->am_memtab[extent] -= reqs; - assert(bit_test(amp->am_memmap, extent)); + PJDLOG_ASSERT(bit_test(amp->am_memmap, extent)); if (amp->am_memtab[extent] == 0) { bit_clear(amp->am_memmap, extent); amp->am_ndirty--; @@ -390,7 +396,7 @@ uint64_t activemap_ndirty(const struct activemap *amp) { - assert(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); return (amp->am_ndirty); } @@ -403,7 +409,7 @@ bool activemap_differ(const struct activemap *amp) { - assert(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); return (memcmp(amp->am_diskmap, amp->am_memmap, amp->am_mapsize) != 0); @@ -416,7 +422,7 @@ size_t activemap_size(const struct activemap *amp) { - assert(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); return (amp->am_mapsize); } @@ -429,7 +435,7 @@ size_t activemap_ondisk_size(const struct activemap *amp) { - assert(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); return (amp->am_diskmapsize); } @@ -442,8 +448,8 @@ activemap_copyin(struct activemap *amp, { int ext; - assert(amp->am_magic == ACTIVEMAP_MAGIC); - assert(size >= amp->am_mapsize); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(size >= amp->am_mapsize); memcpy(amp->am_diskmap, buf, amp->am_mapsize); memcpy(amp->am_memmap, buf, amp->am_mapsize); @@ -481,8 +487,8 @@ activemap_merge(struct activemap *amp, c bitstr_t *remmap = __DECONST(bitstr_t *, buf); int ext; - assert(amp->am_magic == ACTIVEMAP_MAGIC); - assert(size >= amp->am_mapsize); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(size >= amp->am_mapsize); bit_ffs(remmap, amp->am_nextents, &ext); if (ext == -1) { @@ -521,7 +527,7 @@ const unsigned char * activemap_bitmap(struct activemap *amp, size_t *sizep) { - assert(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); if (sizep != NULL) *sizep = amp->am_diskmapsize; @@ -539,11 +545,11 @@ activemap_calc_ondisk_size(uint64_t medi { uint64_t nextents, mapsize; - assert(mediasize > 0); - assert(extentsize > 0); - assert(powerof2(extentsize)); - assert(sectorsize > 0); - assert(powerof2(sectorsize)); + PJDLOG_ASSERT(mediasize > 0); + PJDLOG_ASSERT(extentsize > 0); + PJDLOG_ASSERT(powerof2(extentsize)); + PJDLOG_ASSERT(sectorsize > 0); + PJDLOG_ASSERT(powerof2(sectorsize)); nextents = ((mediasize - 1) / extentsize) + 1; mapsize = sizeof(bitstr_t) * bitstr_size(nextents); @@ -558,7 +564,7 @@ activemap_sync_rewind(struct activemap * { int ext; - assert(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); bit_ffs(amp->am_syncmap, amp->am_nextents, &ext); if (ext == -1) { @@ -581,9 +587,9 @@ activemap_sync_offset(struct activemap * off_t syncoff, left; int ext; - assert(amp->am_magic == ACTIVEMAP_MAGIC); - assert(lengthp != NULL); - assert(syncextp != NULL); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(lengthp != NULL); + PJDLOG_ASSERT(syncextp != NULL); *syncextp = -1; @@ -632,9 +638,10 @@ activemap_sync_offset(struct activemap * if (left > MAXPHYS) left = MAXPHYS; - assert(left >= 0 && left <= MAXPHYS); - assert(syncoff >= 0 && syncoff < amp->am_mediasize); - assert(syncoff + left >= 0 && syncoff + left <= amp->am_mediasize); + PJDLOG_ASSERT(left >= 0 && left <= MAXPHYS); + PJDLOG_ASSERT(syncoff >= 0 && syncoff < amp->am_mediasize); + PJDLOG_ASSERT(syncoff + left >= 0 && + syncoff + left <= amp->am_mediasize); *lengthp = left; return (syncoff); @@ -651,7 +658,7 @@ activemap_need_sync(struct activemap *am off_t end; int ext; - assert(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); modified = false; end = offset + length - 1; @@ -659,7 +666,7 @@ activemap_need_sync(struct activemap *am for (ext = off2ext(amp, offset); ext <= off2ext(amp, end); ext++) { if (bit_test(amp->am_syncmap, ext)) { /* Already marked for synchronization. */ - assert(bit_test(amp->am_memmap, ext)); + PJDLOG_ASSERT(bit_test(amp->am_memmap, ext)); continue; } bit_set(amp->am_syncmap, ext); Modified: stable/9/sbin/hastd/control.c ============================================================================== --- stable/9/sbin/hastd/control.c Wed Jan 4 17:17:11 2012 (r229508) +++ stable/9/sbin/hastd/control.c Wed Jan 4 17:22:10 2012 (r229509) @@ -33,7 +33,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include @@ -82,8 +81,8 @@ control_set_role_common(struct hastd_con nv_add_string(nvout, name, "resource%u", no); if (res == NULL) { - assert(cfg != NULL); - assert(name != NULL); + PJDLOG_ASSERT(cfg != NULL); + PJDLOG_ASSERT(name != NULL); TAILQ_FOREACH(res, &cfg->hc_resources, hr_next) { if (strcmp(res->hr_name, name) == 0) @@ -94,7 +93,7 @@ control_set_role_common(struct hastd_con return; } } - assert(res != NULL); + PJDLOG_ASSERT(res != NULL); /* Send previous role back. */ nv_add_string(nvout, role2str(res->hr_role), "role%u", no); @@ -222,9 +221,9 @@ control_status(struct hastd_config *cfg, struct hast_resource *res, const char *name, unsigned int no) { - assert(cfg != NULL); - assert(nvout != NULL); - assert(name != NULL); + PJDLOG_ASSERT(cfg != NULL); + PJDLOG_ASSERT(nvout != NULL); + PJDLOG_ASSERT(name != NULL); /* Name is always needed. */ nv_add_string(nvout, name, "resource%u", no); @@ -239,7 +238,7 @@ control_status(struct hastd_config *cfg, return; } } - assert(res != NULL); + PJDLOG_ASSERT(res != NULL); nv_add_string(nvout, res->hr_provname, "provname%u", no); nv_add_string(nvout, res->hr_localpath, "localpath%u", no); nv_add_string(nvout, res->hr_remoteaddr, "remoteaddr%u", no); @@ -267,7 +266,7 @@ control_status(struct hastd_config *cfg, switch (res->hr_role) { case HAST_ROLE_PRIMARY: - assert(res->hr_workerpid != 0); + PJDLOG_ASSERT(res->hr_workerpid != 0); /* FALLTHROUGH */ case HAST_ROLE_SECONDARY: if (res->hr_workerpid != 0) @@ -313,7 +312,6 @@ control_handle(struct hastd_config *cfg) cmd = nv_get_uint8(nvin, "cmd"); if (cmd == 0) { pjdlog_error("Control header is missing 'cmd' field."); - error = EHAST_INVALID; goto close; } @@ -321,7 +319,6 @@ control_handle(struct hastd_config *cfg) nvout = nv_alloc(); if (nvout == NULL) { pjdlog_error("Unable to allocate header for control response."); - error = EHAST_NOMEMORY; goto close; } @@ -470,7 +467,7 @@ ctrl_thread(void *arg) * something related to us has changes, it sends reload * message to us. */ - assert(res->hr_role == HAST_ROLE_PRIMARY); + PJDLOG_ASSERT(res->hr_role == HAST_ROLE_PRIMARY); primary_config_reload(res, nvin); nv_add_int16(nvout, 0, "error"); break; Modified: stable/9/sbin/hastd/ebuf.c ============================================================================== --- stable/9/sbin/hastd/ebuf.c Wed Jan 4 17:17:11 2012 (r229508) +++ stable/9/sbin/hastd/ebuf.c Wed Jan 4 17:22:10 2012 (r229509) @@ -32,15 +32,21 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include #include #include #include +#include + #include "ebuf.h" +#ifndef PJDLOG_ASSERT +#include +#define PJDLOG_ASSERT(...) assert(__VA_ARGS__) +#endif + #define EBUF_MAGIC 0xeb0f41c struct ebuf { /* Magic to assert the caller uses valid structure. */ @@ -91,7 +97,7 @@ void ebuf_free(struct ebuf *eb) { - assert(eb != NULL && eb->eb_magic == EBUF_MAGIC); + PJDLOG_ASSERT(eb != NULL && eb->eb_magic == EBUF_MAGIC); eb->eb_magic = 0; @@ -103,7 +109,7 @@ int ebuf_add_head(struct ebuf *eb, const void *data, size_t size) { - assert(eb != NULL && eb->eb_magic == EBUF_MAGIC); + PJDLOG_ASSERT(eb != NULL && eb->eb_magic == EBUF_MAGIC); if (size > (size_t)(eb->eb_used - eb->eb_start)) { /* @@ -113,7 +119,7 @@ ebuf_add_head(struct ebuf *eb, const voi if (ebuf_head_extend(eb, size) < 0) return (-1); } - assert(size <= (size_t)(eb->eb_used - eb->eb_start)); + PJDLOG_ASSERT(size <= (size_t)(eb->eb_used - eb->eb_start)); eb->eb_size += size; eb->eb_used -= size; @@ -130,7 +136,7 @@ int ebuf_add_tail(struct ebuf *eb, const void *data, size_t size) { - assert(eb != NULL && eb->eb_magic == EBUF_MAGIC); + PJDLOG_ASSERT(eb != NULL && eb->eb_magic == EBUF_MAGIC); if (size > (size_t)(eb->eb_end - (eb->eb_used + eb->eb_size))) { /* @@ -140,7 +146,8 @@ ebuf_add_tail(struct ebuf *eb, const voi if (ebuf_tail_extend(eb, size) < 0) return (-1); } - assert(size <= (size_t)(eb->eb_end - (eb->eb_used + eb->eb_size))); + PJDLOG_ASSERT(size <= + (size_t)(eb->eb_end - (eb->eb_used + eb->eb_size))); /* * If data is NULL the caller just wants to reserve space. @@ -156,8 +163,8 @@ void ebuf_del_head(struct ebuf *eb, size_t size) { - assert(eb != NULL && eb->eb_magic == EBUF_MAGIC); - assert(size <= eb->eb_size); + PJDLOG_ASSERT(eb != NULL && eb->eb_magic == EBUF_MAGIC); + PJDLOG_ASSERT(size <= eb->eb_size); eb->eb_used += size; eb->eb_size -= size; @@ -167,8 +174,8 @@ void ebuf_del_tail(struct ebuf *eb, size_t size) { - assert(eb != NULL && eb->eb_magic == EBUF_MAGIC); - assert(size <= eb->eb_size); + PJDLOG_ASSERT(eb != NULL && eb->eb_magic == EBUF_MAGIC); + PJDLOG_ASSERT(size <= eb->eb_size); eb->eb_size -= size; } @@ -180,7 +187,7 @@ void * ebuf_data(struct ebuf *eb, size_t *sizep) { - assert(eb != NULL && eb->eb_magic == EBUF_MAGIC); + PJDLOG_ASSERT(eb != NULL && eb->eb_magic == EBUF_MAGIC); if (sizep != NULL) *sizep = eb->eb_size; @@ -194,7 +201,7 @@ size_t ebuf_size(struct ebuf *eb) { - assert(eb != NULL && eb->eb_magic == EBUF_MAGIC); + PJDLOG_ASSERT(eb != NULL && eb->eb_magic == EBUF_MAGIC); return (eb->eb_size); } @@ -208,7 +215,7 @@ ebuf_head_extend(struct ebuf *eb, size_t unsigned char *newstart, *newused; size_t newsize; - assert(eb != NULL && eb->eb_magic == EBUF_MAGIC); + PJDLOG_ASSERT(eb != NULL && eb->eb_magic == EBUF_MAGIC); newsize = eb->eb_end - eb->eb_start + (PAGE_SIZE / 4) + size; @@ -236,7 +243,7 @@ ebuf_tail_extend(struct ebuf *eb, size_t unsigned char *newstart; size_t newsize; - assert(eb != NULL && eb->eb_magic == EBUF_MAGIC); + PJDLOG_ASSERT(eb != NULL && eb->eb_magic == EBUF_MAGIC); newsize = eb->eb_end - eb->eb_start + size + ((3 * PAGE_SIZE) / 4); Modified: stable/9/sbin/hastd/event.c ============================================================================== --- stable/9/sbin/hastd/event.c Wed Jan 4 17:17:11 2012 (r229508) +++ stable/9/sbin/hastd/event.c Wed Jan 4 17:22:10 2012 (r229509) @@ -27,7 +27,6 @@ #include __FBSDID("$FreeBSD$"); -#include #include #include "hast.h" @@ -46,8 +45,8 @@ event_send(const struct hast_resource *r struct nv *nvin, *nvout; int error; - assert(res != NULL); - assert(event >= EVENT_MIN && event <= EVENT_MAX); + PJDLOG_ASSERT(res != NULL); + PJDLOG_ASSERT(event >= EVENT_MIN && event <= EVENT_MAX); nvin = nvout = NULL; @@ -89,7 +88,7 @@ event_recv(const struct hast_resource *r uint8_t event; int error; - assert(res != NULL); + PJDLOG_ASSERT(res != NULL); nvin = nvout = NULL; Modified: stable/9/sbin/hastd/hast.conf.5 ============================================================================== --- stable/9/sbin/hastd/hast.conf.5 Wed Jan 4 17:17:11 2012 (r229508) +++ stable/9/sbin/hastd/hast.conf.5 Wed Jan 4 17:22:10 2012 (r229509) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 20, 2011 +.Dd October 27, 2011 .Dt HAST.CONF 5 .Os .Sh NAME @@ -63,17 +63,21 @@ checksum compression timeout exec +metaflush "on" | "off" +pidfile on { # Node section control listen + pidfile } on { # Node section control listen + pidfile } resource { @@ -85,12 +89,14 @@ resource { local timeout exec + metaflush "on" | "off" on { # Resource-node section name # Required local + metaflush "on" | "off" # Required remote source @@ -100,6 +106,7 @@ resource { name # Required local + metaflush "on" | "off" # Required remote source @@ -142,6 +149,14 @@ unix:///var/run/hastctl .Pp The default value is .Pa uds:///var/run/hastctl . +.It Ic pidfile Aq path +.Pp +File in which to store the process ID of the main +.Xr hastd 8 +process. +.Pp +The default value is +.Pa /var/run/hastd.pid . .It Ic listen Aq addr .Pp Address to listen on in form of: @@ -209,9 +224,6 @@ completes. This is the fastest and the most dangerous replication mode. This mode should be used when replicating to a distant node where latency is too high for other modes. -The -.Ic async -replication mode is currently not implemented. .El .It Ic checksum Aq algorithm .Pp @@ -318,6 +330,25 @@ It can be one of: .Ar secondary , .Ar primary . .Pp +.It Ic metaflush on | off +.Pp +When set to +.Va on , +flush write cache of the local provider after every metadata (activemap) update. +Flushing write cache ensures that provider will not reorder writes and that +metadata will be properly updated before real data is stored. +If the local provider does not support flushing write cache (it returns +.Er EOPNOTSUPP +on the +.Cm BIO_FLUSH +request), +.Nm hastd +will disable +.Ic metaflush +automatically. +The default value is +.Va on . +.Pp .It Ic name Aq name .Pp GEOM provider name that will appear as Modified: stable/9/sbin/hastd/hast.h ============================================================================== --- stable/9/sbin/hastd/hast.h Wed Jan 4 17:17:11 2012 (r229508) +++ stable/9/sbin/hastd/hast.h Wed Jan 4 17:22:10 2012 (r229509) @@ -111,11 +111,13 @@ struct hastd_listen { struct hastd_config { /* Address to communicate with hastctl(8). */ - char hc_controladdr[HAST_ADDRSIZE]; + char hc_controladdr[HAST_ADDRSIZE]; /* Protocol-specific data. */ struct proto_conn *hc_controlconn; /* Incoming control connection. */ struct proto_conn *hc_controlin; + /* PID file path. */ + char hc_pidfile[PATH_MAX]; /* List of addresses to listen on. */ TAILQ_HEAD(, hastd_listen) hc_listen; /* List of resources. */ @@ -167,6 +169,10 @@ struct hast_resource { off_t hr_local_mediasize; /* Sector size of local provider. */ unsigned int hr_local_sectorsize; + /* Is flushing write cache supported by the local provider? */ + bool hr_localflush; + /* Flush write cache on metadata updates? */ + int hr_metaflush; /* Descriptor for /dev/ggctl communication. */ int hr_ggatefd; Modified: stable/9/sbin/hastd/hast_checksum.c ============================================================================== --- stable/9/sbin/hastd/hast_checksum.c Wed Jan 4 17:17:11 2012 (r229508) +++ stable/9/sbin/hastd/hast_checksum.c Wed Jan 4 17:22:10 2012 (r229509) @@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$"); #define MAX_HASH_SIZE 4 #endif -static int +static void hast_crc32_checksum(const unsigned char *data, size_t size, unsigned char *hash, size_t *hsizep) { @@ -58,12 +58,10 @@ hast_crc32_checksum(const unsigned char /* XXXPJD: Do we have to use htole32() on crc first? */ bcopy(&crc, hash, sizeof(crc)); *hsizep = sizeof(crc); - - return (0); } #ifdef HAVE_CRYPTO -static int +static void hast_sha256_checksum(const unsigned char *data, size_t size, unsigned char *hash, size_t *hsizep) { @@ -73,8 +71,6 @@ hast_sha256_checksum(const unsigned char SHA256_Update(&ctx, data, size); SHA256_Final(hash, &ctx); *hsizep = SHA256_DIGEST_LENGTH; - - return (0); } #endif /* HAVE_CRYPTO */ @@ -99,25 +95,21 @@ checksum_send(const struct hast_resource { unsigned char hash[MAX_HASH_SIZE]; size_t hsize; - int ret; switch (res->hr_checksum) { case HAST_CHECKSUM_NONE: return (0); case HAST_CHECKSUM_CRC32: - ret = hast_crc32_checksum(*datap, *sizep, hash, &hsize); + hast_crc32_checksum(*datap, *sizep, hash, &hsize); break; #ifdef HAVE_CRYPTO case HAST_CHECKSUM_SHA256: - ret = hast_sha256_checksum(*datap, *sizep, hash, &hsize); + hast_sha256_checksum(*datap, *sizep, hash, &hsize); break; #endif default: PJDLOG_ABORT("Invalid checksum: %d.", res->hr_checksum); } - - if (ret != 0) - return (ret); nv_add_string(nv, checksum_name(res->hr_checksum), "checksum"); nv_add_uint8_array(nv, hash, hsize, "hash"); if (nv_error(nv) != 0) { @@ -135,7 +127,6 @@ checksum_recv(const struct hast_resource const unsigned char *rhash; size_t chsize, rhsize; const char *algo; - int ret; algo = nv_get_string(nv, "checksum"); if (algo == NULL) @@ -146,10 +137,10 @@ checksum_recv(const struct hast_resource return (-1); /* Hash not found. */ } if (strcmp(algo, "crc32") == 0) - ret = hast_crc32_checksum(*datap, *sizep, chash, &chsize); + hast_crc32_checksum(*datap, *sizep, chash, &chsize); #ifdef HAVE_CRYPTO else if (strcmp(algo, "sha256") == 0) - ret = hast_sha256_checksum(*datap, *sizep, chash, &chsize); + hast_sha256_checksum(*datap, *sizep, chash, &chsize); #endif else { pjdlog_error("Unknown checksum algorithm '%s'.", algo); Modified: stable/9/sbin/hastd/hast_proto.c ============================================================================== --- stable/9/sbin/hastd/hast_proto.c Wed Jan 4 17:17:11 2012 (r229508) +++ stable/9/sbin/hastd/hast_proto.c Wed Jan 4 17:22:10 2012 (r229509) @@ -33,7 +33,6 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include @@ -158,7 +157,7 @@ hast_proto_recv_hdr(const struct proto_c if (ebuf_add_tail(eb, NULL, hdr.size) < 0) goto fail; hptr = ebuf_data(eb, NULL); - assert(hptr != NULL); + PJDLOG_ASSERT(hptr != NULL); if (proto_recv(conn, hptr, hdr.size) < 0) goto fail; nv = nv_ntoh(eb); @@ -183,8 +182,8 @@ hast_proto_recv_data(const struct hast_r void *dptr; int ret; - assert(data != NULL); - assert(size > 0); + PJDLOG_ASSERT(data != NULL); + PJDLOG_ASSERT(size > 0); ret = -1; freedata = false; Modified: stable/9/sbin/hastd/hastd.c ============================================================================== --- stable/9/sbin/hastd/hastd.c Wed Jan 4 17:17:11 2012 (r229508) +++ stable/9/sbin/hastd/hastd.c Wed Jan 4 17:22:10 2012 (r229509) @@ -386,6 +386,12 @@ resource_needs_restart(const struct hast return (true); if (strcmp(res0->hr_exec, res1->hr_exec) != 0) return (true); + /* + * When metaflush has changed we don't really need restart, + * but it is just easier this way. + */ + if (res0->hr_metaflush != res1->hr_metaflush) + return (true); } return (false); } @@ -416,6 +422,8 @@ resource_needs_reload(const struct hast_ return (true); if (strcmp(res0->hr_exec, res1->hr_exec) != 0) return (true); + if (res0->hr_metaflush != res1->hr_metaflush) + return (true); return (false); } @@ -436,6 +444,7 @@ resource_reload(const struct hast_resour nv_add_int32(nvout, (int32_t)res->hr_compression, "compression"); nv_add_int32(nvout, (int32_t)res->hr_timeout, "timeout"); nv_add_string(nvout, res->hr_exec, "exec"); + nv_add_int32(nvout, (int32_t)res->hr_metaflush, "metaflush"); if (nv_error(nvout) != 0) { nv_free(nvout); pjdlog_error("Unable to allocate header for reload message."); @@ -467,11 +476,15 @@ hastd_reload(void) struct hastd_config *newcfg; struct hast_resource *nres, *cres, *tres; struct hastd_listen *nlst, *clst; + struct pidfh *newpfh; unsigned int nlisten; uint8_t role; + pid_t otherpid; pjdlog_info("Reloading configuration..."); + newpfh = NULL; + newcfg = yy_config_parse(cfgpath, false); if (newcfg == NULL) goto failed; @@ -515,6 +528,31 @@ hastd_reload(void) pjdlog_error("No addresses to listen on."); goto failed; } + /* + * Check if pidfile's path has changed. + */ + if (strcmp(cfg->hc_pidfile, newcfg->hc_pidfile) != 0) { + newpfh = pidfile_open(newcfg->hc_pidfile, 0600, &otherpid); + if (newpfh == NULL) { + if (errno == EEXIST) { + pjdlog_errno(LOG_WARNING, + "Another hastd is already running, pidfile: %s, pid: %jd.", + newcfg->hc_pidfile, (intmax_t)otherpid); + } else { + pjdlog_errno(LOG_WARNING, + "Unable to open or create pidfile %s", + newcfg->hc_pidfile); + } + } else if (pidfile_write(newpfh) < 0) { + /* Write PID to a file. */ + pjdlog_errno(LOG_WARNING, + "Unable to write PID to file %s", + newcfg->hc_pidfile); + } else { + pjdlog_debug(1, "PID stored in %s.", + newcfg->hc_pidfile); + } + } /* No failures from now on. */ @@ -531,6 +569,13 @@ hastd_reload(void) sizeof(cfg->hc_controladdr)); } /* + * Switch to new pidfile. + */ + (void)pidfile_remove(pfh); + pfh = newpfh; + (void)strlcpy(cfg->hc_pidfile, newcfg->hc_pidfile, + sizeof(cfg->hc_pidfile)); + /* * Switch to new listen addresses. Close all that were removed. */ while ((clst = TAILQ_FIRST(&cfg->hc_listen)) != NULL) { @@ -591,12 +636,13 @@ hastd_reload(void) * recreating it. * * We do just reload (send SIGHUP to worker process) if we act as - * PRIMARY, but only if remote address, replication mode, timeout or - * execution path has changed. For those, there is no need to restart - * worker process. + * PRIMARY, but only if remote address, source address, replication + * mode, timeout, execution path or metaflush has changed. + * For those, there is no need to restart worker process. * If PRIMARY receives SIGHUP, it will reconnect if remote address or - * replication mode has changed or simply set new timeout if only - * timeout has changed. + * source address has changed or it will set new timeout if only timeout + * has changed or it will update metaflush if only metaflush has + * changed. */ TAILQ_FOREACH_SAFE(nres, &newcfg->hc_resources, hr_next, tres) { TAILQ_FOREACH(cres, &cfg->hc_resources, hr_next) { @@ -627,6 +673,7 @@ hastd_reload(void) cres->hr_timeout = nres->hr_timeout; strlcpy(cres->hr_exec, nres->hr_exec, sizeof(cres->hr_exec)); + cres->hr_metaflush = nres->hr_metaflush; if (cres->hr_workerpid != 0) resource_reload(cres); } @@ -655,6 +702,8 @@ failed: } yy_config_free(newcfg); } + if (newpfh != NULL) + (void)pidfile_remove(newpfh); pjdlog_warning("Configuration not reloaded."); } @@ -1112,7 +1161,7 @@ main(int argc, char *argv[]) foreground = false; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 17:25:42 2012 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 31C12106564A; Wed, 4 Jan 2012 17:25:42 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1DDD28FC14; Wed, 4 Jan 2012 17:25:42 +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 q04HPgJN088854; Wed, 4 Jan 2012 17:25:42 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04HPfPF088841; Wed, 4 Jan 2012 17:25:41 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201201041725.q04HPfPF088841@svn.freebsd.org> From: Mikolaj Golub Date: Wed, 4 Jan 2012 17:25:41 +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: r229510 - in stable/8/sbin: hastctl hastd 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, 04 Jan 2012 17:25:42 -0000 Author: trociny Date: Wed Jan 4 17:25:41 2012 New Revision: 229510 URL: http://svn.freebsd.org/changeset/base/229510 Log: MFC r219843, r225773, r225781, r225782, r225783, r225784, 225785, r225786, r225787, r225830, r225831, r225832, r225835, r226461, r226462, r226463, r226842, r226851, r226852, r226854, r226855, r226856, r226857, r226859, r226861, r228542, r228542, r228543, r228544, r228695, r228696: r219843 (pjd): Fix typo. r225773 (pjd): Ensure that pjdlog functions don't modify errno. r225781 (pjd): No need to use KEEP_ERRNO() macro around pjdlog functions, as they don't modify errno. r225782 (pjd): Prefer PJDLOG_ASSERT() and PJDLOG_ABORT() over assert() and abort(). pjdlog versions will log problem to syslog when application is running in background. r225783 (pjd): Correct two mistakes when converting asserts to PJDLOG_ASSERT()/PJDLOG_ABORT(). r225784 (pjd): - Convert some impossible conditions into assertions. - Add missing 'if' in comment. r225785 (pjd): Prefer PJDLOG_ASSERT()/PJDLOG_ABORT() over assert(). r225786 (pjd): No need to wrap pjdlog functions around with KEEP_ERRNO() macro. r225787 (pjd): Use PJDLOG_ASSERT() and PJDLOG_ABORT() everywhere instead of assert(). r225830 (pjd): After every activemap change flush disk's write cache, so that write reordering won't make the actual write to be committed before marking the coresponding extent as dirty. It can be disabled in configuration file. If BIO_FLUSH is not supported by the underlying file system we log a warning and never send BIO_FLUSH again to that GEOM provider. r225831 (pjd): Break a bit earlier. r225832 (pjd): If the underlying provider doesn't support BIO_FLUSH, log it only once and don't bother trying in the future. r225835 (pjd): Correct typo. r226461 (pjd): When path to the configuration file is relative, obtain full path, so we can always find the file, even after daemonizing and changing working directory to /. r226462 (pjd): Remove redundant space. r226463 (pjd): Allow to specify pidfile in HAST configuration file. r226842 (pjd): Correct comments. r226851 (pjd): Delay resuid generation until first connection to secondary, not until first write. This way on first connection we will synchronize only the extents that were modified during the lifetime of primary node, not entire GEOM provider. r226852 (pjd): Minor cleanups. r226854 (pjd): - Eliminate the need for hio_nv. - Introduce hio_clear() function for clearing hio before returning it onto free queue. r226855 (pjd): Improve comment so it doesn't suggest race is possible, but that we handle the race. r226856 (pjd): Reduce indentation. r226857 (pjd): Minor cleanups. r226859 (pjd): Implement 'async' mode for HAST. r226861 (pjd): Remove redundant space. r228542 (pjd): Remove redundant setting of the error variable. Found by: Clang Static Analyzer r228543 (pjd): Simplify code by changing functions types from int to avoid, as the functions always return 0. Found by: Clang Static Analyzer r228544 (pjd): Remove redundant assignment. Found by: Clang Static Analyzer r228695 (pjd): Don't use function name as format string. Detected by: clang r228696 (pjd): Use lex's standard way of not generating unused function. Inspired by: r228555 Modified: stable/8/sbin/hastctl/hastctl.c stable/8/sbin/hastd/Makefile stable/8/sbin/hastd/activemap.c stable/8/sbin/hastd/control.c stable/8/sbin/hastd/ebuf.c stable/8/sbin/hastd/event.c stable/8/sbin/hastd/hast.conf.5 stable/8/sbin/hastd/hast.h stable/8/sbin/hastd/hast_checksum.c stable/8/sbin/hastd/hast_proto.c stable/8/sbin/hastd/hastd.c stable/8/sbin/hastd/hooks.c stable/8/sbin/hastd/metadata.c stable/8/sbin/hastd/nv.c stable/8/sbin/hastd/parse.y stable/8/sbin/hastd/pjdlog.c stable/8/sbin/hastd/pjdlog.h stable/8/sbin/hastd/primary.c stable/8/sbin/hastd/proto_tcp.c stable/8/sbin/hastd/rangelock.c stable/8/sbin/hastd/secondary.c stable/8/sbin/hastd/subr.c stable/8/sbin/hastd/synch.h stable/8/sbin/hastd/token.l Directory Properties: stable/8/sbin/hastctl/ (props changed) stable/8/sbin/hastd/ (props changed) Modified: stable/8/sbin/hastctl/hastctl.c ============================================================================== --- stable/8/sbin/hastctl/hastctl.c Wed Jan 4 17:22:10 2012 (r229509) +++ stable/8/sbin/hastctl/hastctl.c Wed Jan 4 17:25:41 2012 (r229510) @@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include @@ -433,19 +432,19 @@ main(int argc, char *argv[]) pjdlog_debug_set(debug); cfg = yy_config_parse(cfgpath, true); - assert(cfg != NULL); + PJDLOG_ASSERT(cfg != NULL); switch (cmd) { case CMD_CREATE: control_create(argc, argv, mediasize, extentsize, keepdirty); /* NOTREACHED */ - assert(!"What are we doing here?!"); + PJDLOG_ABORT("What are we doing here?!"); break; case CMD_DUMP: /* Dump metadata from local component of the given resource. */ control_dump(argc, argv); /* NOTREACHED */ - assert(!"What are we doing here?!"); + PJDLOG_ABORT("What are we doing here?!"); break; case CMD_ROLE: /* Change role for the given resources. */ @@ -476,7 +475,7 @@ main(int argc, char *argv[]) } break; default: - assert(!"Impossible command!"); + PJDLOG_ABORT("Impossible command!"); } /* Setup control connection... */ @@ -523,7 +522,7 @@ main(int argc, char *argv[]) error = control_status(nv); break; default: - assert(!"Impossible command!"); + PJDLOG_ABORT("Impossible command!"); } exit(error); Modified: stable/8/sbin/hastd/Makefile ============================================================================== --- stable/8/sbin/hastd/Makefile Wed Jan 4 17:22:10 2012 (r229509) +++ stable/8/sbin/hastd/Makefile Wed Jan 4 17:25:41 2012 (r229510) @@ -27,9 +27,6 @@ CFLAGS+=-DINET .if ${MK_INET6_SUPPORT} != "no" CFLAGS+=-DINET6 .endif -# This is needed to have WARNS > 1. -CFLAGS+=-DYY_NO_UNPUT -CFLAGS+=-DYY_NO_INPUT DPADD= ${LIBGEOM} ${LIBBSDXML} ${LIBSBUF} ${LIBL} ${LIBPTHREAD} ${LIBUTIL} LDADD= -lgeom -lbsdxml -lsbuf -ll -lpthread -lutil Modified: stable/8/sbin/hastd/activemap.c ============================================================================== --- stable/8/sbin/hastd/activemap.c Wed Jan 4 17:22:10 2012 (r229509) +++ stable/8/sbin/hastd/activemap.c Wed Jan 4 17:25:41 2012 (r229510) @@ -33,7 +33,6 @@ __FBSDID("$FreeBSD$"); #include /* powerof2() */ #include -#include #include #include #include @@ -41,7 +40,14 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include + +#include "activemap.h" + +#ifndef PJDLOG_ASSERT +#include +#define PJDLOG_ASSERT(...) assert(__VA_ARGS__) +#endif #define ACTIVEMAP_MAGIC 0xac71e4 struct activemap { @@ -93,9 +99,9 @@ off2ext(const struct activemap *amp, off { int extent; - assert(offset >= 0 && offset < amp->am_mediasize); + PJDLOG_ASSERT(offset >= 0 && offset < amp->am_mediasize); extent = (offset >> amp->am_extentshift); - assert(extent >= 0 && extent < amp->am_nextents); + PJDLOG_ASSERT(extent >= 0 && extent < amp->am_nextents); return (extent); } @@ -104,9 +110,9 @@ ext2off(const struct activemap *amp, int { off_t offset; - assert(extent >= 0 && extent < amp->am_nextents); + PJDLOG_ASSERT(extent >= 0 && extent < amp->am_nextents); offset = ((off_t)extent << amp->am_extentshift); - assert(offset >= 0 && offset < amp->am_mediasize); + PJDLOG_ASSERT(offset >= 0 && offset < amp->am_mediasize); return (offset); } @@ -122,7 +128,7 @@ ext2reqs(const struct activemap *amp, in if (ext < amp->am_nextents - 1) return (((amp->am_extentsize - 1) / MAXPHYS) + 1); - assert(ext == amp->am_nextents - 1); + PJDLOG_ASSERT(ext == amp->am_nextents - 1); left = amp->am_mediasize % amp->am_extentsize; if (left == 0) left = amp->am_extentsize; @@ -139,13 +145,13 @@ activemap_init(struct activemap **ampp, { struct activemap *amp; - assert(ampp != NULL); - assert(mediasize > 0); - assert(extentsize > 0); - assert(powerof2(extentsize)); - assert(sectorsize > 0); - assert(powerof2(sectorsize)); - assert(keepdirty > 0); + PJDLOG_ASSERT(ampp != NULL); + PJDLOG_ASSERT(mediasize > 0); + PJDLOG_ASSERT(extentsize > 0); + PJDLOG_ASSERT(powerof2(extentsize)); + PJDLOG_ASSERT(sectorsize > 0); + PJDLOG_ASSERT(powerof2(sectorsize)); + PJDLOG_ASSERT(keepdirty > 0); amp = malloc(sizeof(*amp)); if (amp == NULL) @@ -225,10 +231,10 @@ keepdirty_add(struct activemap *amp, int */ if (amp->am_nkeepdirty >= amp->am_nkeepdirty_limit) { kd = TAILQ_LAST(&->am_keepdirty, skeepdirty); - assert(kd != NULL); + PJDLOG_ASSERT(kd != NULL); TAILQ_REMOVE(&->am_keepdirty, kd, kd_next); amp->am_nkeepdirty--; - assert(amp->am_nkeepdirty > 0); + PJDLOG_ASSERT(amp->am_nkeepdirty > 0); } if (kd == NULL) kd = malloc(sizeof(*kd)); @@ -261,7 +267,7 @@ keepdirty_free(struct activemap *amp) amp->am_nkeepdirty--; free(kd); } - assert(amp->am_nkeepdirty == 0); + PJDLOG_ASSERT(amp->am_nkeepdirty == 0); } /* @@ -271,7 +277,7 @@ void activemap_free(struct activemap *amp) { - assert(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); amp->am_magic = 0; @@ -293,8 +299,8 @@ activemap_write_start(struct activemap * off_t end; int ext; - assert(amp->am_magic == ACTIVEMAP_MAGIC); - assert(length > 0); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(length > 0); modified = false; end = offset + length - 1; @@ -307,7 +313,7 @@ activemap_write_start(struct activemap * * was modified and has to be flushed to disk. */ if (amp->am_memtab[ext]++ == 0) { - assert(!bit_test(amp->am_memmap, ext)); + PJDLOG_ASSERT(!bit_test(amp->am_memmap, ext)); bit_set(amp->am_memmap, ext); amp->am_ndirty++; } @@ -329,8 +335,8 @@ activemap_write_complete(struct activema off_t end; int ext; - assert(amp->am_magic == ACTIVEMAP_MAGIC); - assert(length > 0); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(length > 0); modified = false; end = offset + length - 1; @@ -342,8 +348,8 @@ activemap_write_complete(struct activema * By returning true we inform the caller that on-disk bitmap * was modified and has to be flushed to disk. */ - assert(amp->am_memtab[ext] > 0); - assert(bit_test(amp->am_memmap, ext)); + PJDLOG_ASSERT(amp->am_memtab[ext] > 0); + PJDLOG_ASSERT(bit_test(amp->am_memmap, ext)); if (--amp->am_memtab[ext] == 0) { bit_clear(amp->am_memmap, ext); amp->am_ndirty--; @@ -365,15 +371,15 @@ activemap_extent_complete(struct activem bool modified; int reqs; - assert(amp->am_magic == ACTIVEMAP_MAGIC); - assert(extent >= 0 && extent < amp->am_nextents); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(extent >= 0 && extent < amp->am_nextents); modified = false; reqs = ext2reqs(amp, extent); - assert(amp->am_memtab[extent] >= reqs); + PJDLOG_ASSERT(amp->am_memtab[extent] >= reqs); amp->am_memtab[extent] -= reqs; - assert(bit_test(amp->am_memmap, extent)); + PJDLOG_ASSERT(bit_test(amp->am_memmap, extent)); if (amp->am_memtab[extent] == 0) { bit_clear(amp->am_memmap, extent); amp->am_ndirty--; @@ -390,7 +396,7 @@ uint64_t activemap_ndirty(const struct activemap *amp) { - assert(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); return (amp->am_ndirty); } @@ -403,7 +409,7 @@ bool activemap_differ(const struct activemap *amp) { - assert(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); return (memcmp(amp->am_diskmap, amp->am_memmap, amp->am_mapsize) != 0); @@ -416,7 +422,7 @@ size_t activemap_size(const struct activemap *amp) { - assert(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); return (amp->am_mapsize); } @@ -429,7 +435,7 @@ size_t activemap_ondisk_size(const struct activemap *amp) { - assert(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); return (amp->am_diskmapsize); } @@ -442,8 +448,8 @@ activemap_copyin(struct activemap *amp, { int ext; - assert(amp->am_magic == ACTIVEMAP_MAGIC); - assert(size >= amp->am_mapsize); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(size >= amp->am_mapsize); memcpy(amp->am_diskmap, buf, amp->am_mapsize); memcpy(amp->am_memmap, buf, amp->am_mapsize); @@ -481,8 +487,8 @@ activemap_merge(struct activemap *amp, c bitstr_t *remmap = __DECONST(bitstr_t *, buf); int ext; - assert(amp->am_magic == ACTIVEMAP_MAGIC); - assert(size >= amp->am_mapsize); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(size >= amp->am_mapsize); bit_ffs(remmap, amp->am_nextents, &ext); if (ext == -1) { @@ -521,7 +527,7 @@ const unsigned char * activemap_bitmap(struct activemap *amp, size_t *sizep) { - assert(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); if (sizep != NULL) *sizep = amp->am_diskmapsize; @@ -539,11 +545,11 @@ activemap_calc_ondisk_size(uint64_t medi { uint64_t nextents, mapsize; - assert(mediasize > 0); - assert(extentsize > 0); - assert(powerof2(extentsize)); - assert(sectorsize > 0); - assert(powerof2(sectorsize)); + PJDLOG_ASSERT(mediasize > 0); + PJDLOG_ASSERT(extentsize > 0); + PJDLOG_ASSERT(powerof2(extentsize)); + PJDLOG_ASSERT(sectorsize > 0); + PJDLOG_ASSERT(powerof2(sectorsize)); nextents = ((mediasize - 1) / extentsize) + 1; mapsize = sizeof(bitstr_t) * bitstr_size(nextents); @@ -558,7 +564,7 @@ activemap_sync_rewind(struct activemap * { int ext; - assert(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); bit_ffs(amp->am_syncmap, amp->am_nextents, &ext); if (ext == -1) { @@ -581,9 +587,9 @@ activemap_sync_offset(struct activemap * off_t syncoff, left; int ext; - assert(amp->am_magic == ACTIVEMAP_MAGIC); - assert(lengthp != NULL); - assert(syncextp != NULL); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(lengthp != NULL); + PJDLOG_ASSERT(syncextp != NULL); *syncextp = -1; @@ -632,9 +638,10 @@ activemap_sync_offset(struct activemap * if (left > MAXPHYS) left = MAXPHYS; - assert(left >= 0 && left <= MAXPHYS); - assert(syncoff >= 0 && syncoff < amp->am_mediasize); - assert(syncoff + left >= 0 && syncoff + left <= amp->am_mediasize); + PJDLOG_ASSERT(left >= 0 && left <= MAXPHYS); + PJDLOG_ASSERT(syncoff >= 0 && syncoff < amp->am_mediasize); + PJDLOG_ASSERT(syncoff + left >= 0 && + syncoff + left <= amp->am_mediasize); *lengthp = left; return (syncoff); @@ -651,7 +658,7 @@ activemap_need_sync(struct activemap *am off_t end; int ext; - assert(amp->am_magic == ACTIVEMAP_MAGIC); + PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC); modified = false; end = offset + length - 1; @@ -659,7 +666,7 @@ activemap_need_sync(struct activemap *am for (ext = off2ext(amp, offset); ext <= off2ext(amp, end); ext++) { if (bit_test(amp->am_syncmap, ext)) { /* Already marked for synchronization. */ - assert(bit_test(amp->am_memmap, ext)); + PJDLOG_ASSERT(bit_test(amp->am_memmap, ext)); continue; } bit_set(amp->am_syncmap, ext); Modified: stable/8/sbin/hastd/control.c ============================================================================== --- stable/8/sbin/hastd/control.c Wed Jan 4 17:22:10 2012 (r229509) +++ stable/8/sbin/hastd/control.c Wed Jan 4 17:25:41 2012 (r229510) @@ -33,7 +33,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include @@ -82,8 +81,8 @@ control_set_role_common(struct hastd_con nv_add_string(nvout, name, "resource%u", no); if (res == NULL) { - assert(cfg != NULL); - assert(name != NULL); + PJDLOG_ASSERT(cfg != NULL); + PJDLOG_ASSERT(name != NULL); TAILQ_FOREACH(res, &cfg->hc_resources, hr_next) { if (strcmp(res->hr_name, name) == 0) @@ -94,7 +93,7 @@ control_set_role_common(struct hastd_con return; } } - assert(res != NULL); + PJDLOG_ASSERT(res != NULL); /* Send previous role back. */ nv_add_string(nvout, role2str(res->hr_role), "role%u", no); @@ -222,9 +221,9 @@ control_status(struct hastd_config *cfg, struct hast_resource *res, const char *name, unsigned int no) { - assert(cfg != NULL); - assert(nvout != NULL); - assert(name != NULL); + PJDLOG_ASSERT(cfg != NULL); + PJDLOG_ASSERT(nvout != NULL); + PJDLOG_ASSERT(name != NULL); /* Name is always needed. */ nv_add_string(nvout, name, "resource%u", no); @@ -239,7 +238,7 @@ control_status(struct hastd_config *cfg, return; } } - assert(res != NULL); + PJDLOG_ASSERT(res != NULL); nv_add_string(nvout, res->hr_provname, "provname%u", no); nv_add_string(nvout, res->hr_localpath, "localpath%u", no); nv_add_string(nvout, res->hr_remoteaddr, "remoteaddr%u", no); @@ -267,7 +266,7 @@ control_status(struct hastd_config *cfg, switch (res->hr_role) { case HAST_ROLE_PRIMARY: - assert(res->hr_workerpid != 0); + PJDLOG_ASSERT(res->hr_workerpid != 0); /* FALLTHROUGH */ case HAST_ROLE_SECONDARY: if (res->hr_workerpid != 0) @@ -313,7 +312,6 @@ control_handle(struct hastd_config *cfg) cmd = nv_get_uint8(nvin, "cmd"); if (cmd == 0) { pjdlog_error("Control header is missing 'cmd' field."); - error = EHAST_INVALID; goto close; } @@ -321,7 +319,6 @@ control_handle(struct hastd_config *cfg) nvout = nv_alloc(); if (nvout == NULL) { pjdlog_error("Unable to allocate header for control response."); - error = EHAST_NOMEMORY; goto close; } @@ -470,7 +467,7 @@ ctrl_thread(void *arg) * something related to us has changes, it sends reload * message to us. */ - assert(res->hr_role == HAST_ROLE_PRIMARY); + PJDLOG_ASSERT(res->hr_role == HAST_ROLE_PRIMARY); primary_config_reload(res, nvin); nv_add_int16(nvout, 0, "error"); break; Modified: stable/8/sbin/hastd/ebuf.c ============================================================================== --- stable/8/sbin/hastd/ebuf.c Wed Jan 4 17:22:10 2012 (r229509) +++ stable/8/sbin/hastd/ebuf.c Wed Jan 4 17:25:41 2012 (r229510) @@ -32,15 +32,21 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include #include #include #include +#include + #include "ebuf.h" +#ifndef PJDLOG_ASSERT +#include +#define PJDLOG_ASSERT(...) assert(__VA_ARGS__) +#endif + #define EBUF_MAGIC 0xeb0f41c struct ebuf { /* Magic to assert the caller uses valid structure. */ @@ -91,7 +97,7 @@ void ebuf_free(struct ebuf *eb) { - assert(eb != NULL && eb->eb_magic == EBUF_MAGIC); + PJDLOG_ASSERT(eb != NULL && eb->eb_magic == EBUF_MAGIC); eb->eb_magic = 0; @@ -103,7 +109,7 @@ int ebuf_add_head(struct ebuf *eb, const void *data, size_t size) { - assert(eb != NULL && eb->eb_magic == EBUF_MAGIC); + PJDLOG_ASSERT(eb != NULL && eb->eb_magic == EBUF_MAGIC); if (size > (size_t)(eb->eb_used - eb->eb_start)) { /* @@ -113,7 +119,7 @@ ebuf_add_head(struct ebuf *eb, const voi if (ebuf_head_extend(eb, size) < 0) return (-1); } - assert(size <= (size_t)(eb->eb_used - eb->eb_start)); + PJDLOG_ASSERT(size <= (size_t)(eb->eb_used - eb->eb_start)); eb->eb_size += size; eb->eb_used -= size; @@ -130,7 +136,7 @@ int ebuf_add_tail(struct ebuf *eb, const void *data, size_t size) { - assert(eb != NULL && eb->eb_magic == EBUF_MAGIC); + PJDLOG_ASSERT(eb != NULL && eb->eb_magic == EBUF_MAGIC); if (size > (size_t)(eb->eb_end - (eb->eb_used + eb->eb_size))) { /* @@ -140,7 +146,8 @@ ebuf_add_tail(struct ebuf *eb, const voi if (ebuf_tail_extend(eb, size) < 0) return (-1); } - assert(size <= (size_t)(eb->eb_end - (eb->eb_used + eb->eb_size))); + PJDLOG_ASSERT(size <= + (size_t)(eb->eb_end - (eb->eb_used + eb->eb_size))); /* * If data is NULL the caller just wants to reserve space. @@ -156,8 +163,8 @@ void ebuf_del_head(struct ebuf *eb, size_t size) { - assert(eb != NULL && eb->eb_magic == EBUF_MAGIC); - assert(size <= eb->eb_size); + PJDLOG_ASSERT(eb != NULL && eb->eb_magic == EBUF_MAGIC); + PJDLOG_ASSERT(size <= eb->eb_size); eb->eb_used += size; eb->eb_size -= size; @@ -167,8 +174,8 @@ void ebuf_del_tail(struct ebuf *eb, size_t size) { - assert(eb != NULL && eb->eb_magic == EBUF_MAGIC); - assert(size <= eb->eb_size); + PJDLOG_ASSERT(eb != NULL && eb->eb_magic == EBUF_MAGIC); + PJDLOG_ASSERT(size <= eb->eb_size); eb->eb_size -= size; } @@ -180,7 +187,7 @@ void * ebuf_data(struct ebuf *eb, size_t *sizep) { - assert(eb != NULL && eb->eb_magic == EBUF_MAGIC); + PJDLOG_ASSERT(eb != NULL && eb->eb_magic == EBUF_MAGIC); if (sizep != NULL) *sizep = eb->eb_size; @@ -194,7 +201,7 @@ size_t ebuf_size(struct ebuf *eb) { - assert(eb != NULL && eb->eb_magic == EBUF_MAGIC); + PJDLOG_ASSERT(eb != NULL && eb->eb_magic == EBUF_MAGIC); return (eb->eb_size); } @@ -208,7 +215,7 @@ ebuf_head_extend(struct ebuf *eb, size_t unsigned char *newstart, *newused; size_t newsize; - assert(eb != NULL && eb->eb_magic == EBUF_MAGIC); + PJDLOG_ASSERT(eb != NULL && eb->eb_magic == EBUF_MAGIC); newsize = eb->eb_end - eb->eb_start + (PAGE_SIZE / 4) + size; @@ -236,7 +243,7 @@ ebuf_tail_extend(struct ebuf *eb, size_t unsigned char *newstart; size_t newsize; - assert(eb != NULL && eb->eb_magic == EBUF_MAGIC); + PJDLOG_ASSERT(eb != NULL && eb->eb_magic == EBUF_MAGIC); newsize = eb->eb_end - eb->eb_start + size + ((3 * PAGE_SIZE) / 4); Modified: stable/8/sbin/hastd/event.c ============================================================================== --- stable/8/sbin/hastd/event.c Wed Jan 4 17:22:10 2012 (r229509) +++ stable/8/sbin/hastd/event.c Wed Jan 4 17:25:41 2012 (r229510) @@ -27,7 +27,6 @@ #include __FBSDID("$FreeBSD$"); -#include #include #include "hast.h" @@ -46,8 +45,8 @@ event_send(const struct hast_resource *r struct nv *nvin, *nvout; int error; - assert(res != NULL); - assert(event >= EVENT_MIN && event <= EVENT_MAX); + PJDLOG_ASSERT(res != NULL); + PJDLOG_ASSERT(event >= EVENT_MIN && event <= EVENT_MAX); nvin = nvout = NULL; @@ -89,7 +88,7 @@ event_recv(const struct hast_resource *r uint8_t event; int error; - assert(res != NULL); + PJDLOG_ASSERT(res != NULL); nvin = nvout = NULL; Modified: stable/8/sbin/hastd/hast.conf.5 ============================================================================== --- stable/8/sbin/hastd/hast.conf.5 Wed Jan 4 17:22:10 2012 (r229509) +++ stable/8/sbin/hastd/hast.conf.5 Wed Jan 4 17:25:41 2012 (r229510) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 20, 2011 +.Dd October 27, 2011 .Dt HAST.CONF 5 .Os .Sh NAME @@ -63,17 +63,21 @@ checksum compression timeout exec +metaflush "on" | "off" +pidfile on { # Node section control listen + pidfile } on { # Node section control listen + pidfile } resource { @@ -85,12 +89,14 @@ resource { local timeout exec + metaflush "on" | "off" on { # Resource-node section name # Required local + metaflush "on" | "off" # Required remote source @@ -100,6 +106,7 @@ resource { name # Required local + metaflush "on" | "off" # Required remote source @@ -142,6 +149,14 @@ unix:///var/run/hastctl .Pp The default value is .Pa uds:///var/run/hastctl . +.It Ic pidfile Aq path +.Pp +File in which to store the process ID of the main +.Xr hastd 8 +process. +.Pp +The default value is +.Pa /var/run/hastd.pid . .It Ic listen Aq addr .Pp Address to listen on in form of: @@ -209,9 +224,6 @@ completes. This is the fastest and the most dangerous replication mode. This mode should be used when replicating to a distant node where latency is too high for other modes. -The -.Ic async -replication mode is currently not implemented. .El .It Ic checksum Aq algorithm .Pp @@ -318,6 +330,25 @@ It can be one of: .Ar secondary , .Ar primary . .Pp +.It Ic metaflush on | off +.Pp +When set to +.Va on , +flush write cache of the local provider after every metadata (activemap) update. +Flushing write cache ensures that provider will not reorder writes and that +metadata will be properly updated before real data is stored. +If the local provider does not support flushing write cache (it returns +.Er EOPNOTSUPP +on the +.Cm BIO_FLUSH +request), +.Nm hastd +will disable +.Ic metaflush +automatically. +The default value is +.Va on . +.Pp .It Ic name Aq name .Pp GEOM provider name that will appear as Modified: stable/8/sbin/hastd/hast.h ============================================================================== --- stable/8/sbin/hastd/hast.h Wed Jan 4 17:22:10 2012 (r229509) +++ stable/8/sbin/hastd/hast.h Wed Jan 4 17:25:41 2012 (r229510) @@ -111,11 +111,13 @@ struct hastd_listen { struct hastd_config { /* Address to communicate with hastctl(8). */ - char hc_controladdr[HAST_ADDRSIZE]; + char hc_controladdr[HAST_ADDRSIZE]; /* Protocol-specific data. */ struct proto_conn *hc_controlconn; /* Incoming control connection. */ struct proto_conn *hc_controlin; + /* PID file path. */ + char hc_pidfile[PATH_MAX]; /* List of addresses to listen on. */ TAILQ_HEAD(, hastd_listen) hc_listen; /* List of resources. */ @@ -167,6 +169,10 @@ struct hast_resource { off_t hr_local_mediasize; /* Sector size of local provider. */ unsigned int hr_local_sectorsize; + /* Is flushing write cache supported by the local provider? */ + bool hr_localflush; + /* Flush write cache on metadata updates? */ + int hr_metaflush; /* Descriptor for /dev/ggctl communication. */ int hr_ggatefd; Modified: stable/8/sbin/hastd/hast_checksum.c ============================================================================== --- stable/8/sbin/hastd/hast_checksum.c Wed Jan 4 17:22:10 2012 (r229509) +++ stable/8/sbin/hastd/hast_checksum.c Wed Jan 4 17:25:41 2012 (r229510) @@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$"); #define MAX_HASH_SIZE 4 #endif -static int +static void hast_crc32_checksum(const unsigned char *data, size_t size, unsigned char *hash, size_t *hsizep) { @@ -58,12 +58,10 @@ hast_crc32_checksum(const unsigned char /* XXXPJD: Do we have to use htole32() on crc first? */ bcopy(&crc, hash, sizeof(crc)); *hsizep = sizeof(crc); - - return (0); } #ifdef HAVE_CRYPTO -static int +static void hast_sha256_checksum(const unsigned char *data, size_t size, unsigned char *hash, size_t *hsizep) { @@ -73,8 +71,6 @@ hast_sha256_checksum(const unsigned char SHA256_Update(&ctx, data, size); SHA256_Final(hash, &ctx); *hsizep = SHA256_DIGEST_LENGTH; - - return (0); } #endif /* HAVE_CRYPTO */ @@ -99,25 +95,21 @@ checksum_send(const struct hast_resource { unsigned char hash[MAX_HASH_SIZE]; size_t hsize; - int ret; switch (res->hr_checksum) { case HAST_CHECKSUM_NONE: return (0); case HAST_CHECKSUM_CRC32: - ret = hast_crc32_checksum(*datap, *sizep, hash, &hsize); + hast_crc32_checksum(*datap, *sizep, hash, &hsize); break; #ifdef HAVE_CRYPTO case HAST_CHECKSUM_SHA256: - ret = hast_sha256_checksum(*datap, *sizep, hash, &hsize); + hast_sha256_checksum(*datap, *sizep, hash, &hsize); break; #endif default: PJDLOG_ABORT("Invalid checksum: %d.", res->hr_checksum); } - - if (ret != 0) - return (ret); nv_add_string(nv, checksum_name(res->hr_checksum), "checksum"); nv_add_uint8_array(nv, hash, hsize, "hash"); if (nv_error(nv) != 0) { @@ -135,7 +127,6 @@ checksum_recv(const struct hast_resource const unsigned char *rhash; size_t chsize, rhsize; const char *algo; - int ret; algo = nv_get_string(nv, "checksum"); if (algo == NULL) @@ -146,10 +137,10 @@ checksum_recv(const struct hast_resource return (-1); /* Hash not found. */ } if (strcmp(algo, "crc32") == 0) - ret = hast_crc32_checksum(*datap, *sizep, chash, &chsize); + hast_crc32_checksum(*datap, *sizep, chash, &chsize); #ifdef HAVE_CRYPTO else if (strcmp(algo, "sha256") == 0) - ret = hast_sha256_checksum(*datap, *sizep, chash, &chsize); + hast_sha256_checksum(*datap, *sizep, chash, &chsize); #endif else { pjdlog_error("Unknown checksum algorithm '%s'.", algo); Modified: stable/8/sbin/hastd/hast_proto.c ============================================================================== --- stable/8/sbin/hastd/hast_proto.c Wed Jan 4 17:22:10 2012 (r229509) +++ stable/8/sbin/hastd/hast_proto.c Wed Jan 4 17:25:41 2012 (r229510) @@ -33,7 +33,6 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include @@ -158,7 +157,7 @@ hast_proto_recv_hdr(const struct proto_c if (ebuf_add_tail(eb, NULL, hdr.size) < 0) goto fail; hptr = ebuf_data(eb, NULL); - assert(hptr != NULL); + PJDLOG_ASSERT(hptr != NULL); if (proto_recv(conn, hptr, hdr.size) < 0) goto fail; nv = nv_ntoh(eb); @@ -183,8 +182,8 @@ hast_proto_recv_data(const struct hast_r void *dptr; int ret; - assert(data != NULL); - assert(size > 0); + PJDLOG_ASSERT(data != NULL); + PJDLOG_ASSERT(size > 0); ret = -1; freedata = false; Modified: stable/8/sbin/hastd/hastd.c ============================================================================== --- stable/8/sbin/hastd/hastd.c Wed Jan 4 17:22:10 2012 (r229509) +++ stable/8/sbin/hastd/hastd.c Wed Jan 4 17:25:41 2012 (r229510) @@ -386,6 +386,12 @@ resource_needs_restart(const struct hast return (true); if (strcmp(res0->hr_exec, res1->hr_exec) != 0) return (true); + /* + * When metaflush has changed we don't really need restart, + * but it is just easier this way. + */ + if (res0->hr_metaflush != res1->hr_metaflush) + return (true); } return (false); } @@ -416,6 +422,8 @@ resource_needs_reload(const struct hast_ return (true); if (strcmp(res0->hr_exec, res1->hr_exec) != 0) return (true); + if (res0->hr_metaflush != res1->hr_metaflush) + return (true); return (false); } @@ -436,6 +444,7 @@ resource_reload(const struct hast_resour nv_add_int32(nvout, (int32_t)res->hr_compression, "compression"); nv_add_int32(nvout, (int32_t)res->hr_timeout, "timeout"); nv_add_string(nvout, res->hr_exec, "exec"); + nv_add_int32(nvout, (int32_t)res->hr_metaflush, "metaflush"); if (nv_error(nvout) != 0) { nv_free(nvout); pjdlog_error("Unable to allocate header for reload message."); @@ -467,11 +476,15 @@ hastd_reload(void) struct hastd_config *newcfg; struct hast_resource *nres, *cres, *tres; struct hastd_listen *nlst, *clst; + struct pidfh *newpfh; unsigned int nlisten; uint8_t role; + pid_t otherpid; pjdlog_info("Reloading configuration..."); + newpfh = NULL; + newcfg = yy_config_parse(cfgpath, false); if (newcfg == NULL) goto failed; @@ -515,6 +528,31 @@ hastd_reload(void) pjdlog_error("No addresses to listen on."); goto failed; } + /* + * Check if pidfile's path has changed. + */ + if (strcmp(cfg->hc_pidfile, newcfg->hc_pidfile) != 0) { + newpfh = pidfile_open(newcfg->hc_pidfile, 0600, &otherpid); + if (newpfh == NULL) { + if (errno == EEXIST) { + pjdlog_errno(LOG_WARNING, + "Another hastd is already running, pidfile: %s, pid: %jd.", + newcfg->hc_pidfile, (intmax_t)otherpid); + } else { + pjdlog_errno(LOG_WARNING, + "Unable to open or create pidfile %s", + newcfg->hc_pidfile); + } + } else if (pidfile_write(newpfh) < 0) { + /* Write PID to a file. */ + pjdlog_errno(LOG_WARNING, + "Unable to write PID to file %s", + newcfg->hc_pidfile); + } else { + pjdlog_debug(1, "PID stored in %s.", + newcfg->hc_pidfile); + } + } /* No failures from now on. */ @@ -531,6 +569,13 @@ hastd_reload(void) sizeof(cfg->hc_controladdr)); } /* + * Switch to new pidfile. + */ + (void)pidfile_remove(pfh); + pfh = newpfh; + (void)strlcpy(cfg->hc_pidfile, newcfg->hc_pidfile, + sizeof(cfg->hc_pidfile)); + /* * Switch to new listen addresses. Close all that were removed. */ while ((clst = TAILQ_FIRST(&cfg->hc_listen)) != NULL) { @@ -591,12 +636,13 @@ hastd_reload(void) * recreating it. * * We do just reload (send SIGHUP to worker process) if we act as - * PRIMARY, but only if remote address, replication mode, timeout or - * execution path has changed. For those, there is no need to restart - * worker process. + * PRIMARY, but only if remote address, source address, replication + * mode, timeout, execution path or metaflush has changed. + * For those, there is no need to restart worker process. * If PRIMARY receives SIGHUP, it will reconnect if remote address or - * replication mode has changed or simply set new timeout if only - * timeout has changed. + * source address has changed or it will set new timeout if only timeout + * has changed or it will update metaflush if only metaflush has + * changed. */ TAILQ_FOREACH_SAFE(nres, &newcfg->hc_resources, hr_next, tres) { TAILQ_FOREACH(cres, &cfg->hc_resources, hr_next) { @@ -627,6 +673,7 @@ hastd_reload(void) cres->hr_timeout = nres->hr_timeout; strlcpy(cres->hr_exec, nres->hr_exec, sizeof(cres->hr_exec)); + cres->hr_metaflush = nres->hr_metaflush; if (cres->hr_workerpid != 0) resource_reload(cres); } @@ -655,6 +702,8 @@ failed: } yy_config_free(newcfg); } + if (newpfh != NULL) + (void)pidfile_remove(newpfh); pjdlog_warning("Configuration not reloaded."); } @@ -1112,7 +1161,7 @@ main(int argc, char *argv[]) foreground = false; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 19:37:26 2012 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 388FB106566B; Wed, 4 Jan 2012 19:37:26 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1CF658FC1D; Wed, 4 Jan 2012 19:37: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 q04JbP6J092992; Wed, 4 Jan 2012 19:37:25 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04JbPdT092989; Wed, 4 Jan 2012 19:37:25 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201201041937.q04JbPdT092989@svn.freebsd.org> From: Luigi Rizzo Date: Wed, 4 Jan 2012 19:37:25 +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: r229511 - head/release/picobsd/build 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, 04 Jan 2012 19:37:26 -0000 Author: luigi Date: Wed Jan 4 19:37:25 2012 New Revision: 229511 URL: http://svn.freebsd.org/changeset/base/229511 Log: remove some stale options (such as running without /boot/loader) improve support for multi-arch and cross-arch builds, by adding a suffix to the kernel config file and build_directory. (cross builds not clean yet, a cross-built kernel boots but fails when starting /sbin/init) Modified: head/release/picobsd/build/Makefile.conf head/release/picobsd/build/picobsd Modified: head/release/picobsd/build/Makefile.conf ============================================================================== --- head/release/picobsd/build/Makefile.conf Wed Jan 4 17:25:41 2012 (r229510) +++ head/release/picobsd/build/Makefile.conf Wed Jan 4 19:37:25 2012 (r229511) @@ -13,6 +13,7 @@ BINMAKE?=make SRC?=/usr/src CONFIG?=config MODULES?=-DNO_MODULES # do not build them as a default +KERNCONF ?= PICOBSD # caller will set MODULES to empty if modules are needed. # Indeed, it can be used to specify other Makefile options as well. @@ -45,10 +46,10 @@ ${COMPILE}: ${CONF}/${CONFFILE} (cd ${CONF}; ${CONFIG} -d ${COMPILE} ${CONFFILE}; \ cd ${COMPILE}; ${BINMAKE} KERNEL=kernel ${MODULES} depend ) -${CONF}/${CONFFILE}: PICOBSD +${CONF}/${CONFFILE}: ${KERNCONF} # -mkdir -p ${CONF} # XXX not needed yet. cp ${.OODATE} ${.TARGET} - if [ -f PICOBSD.hints ] ; then cp PICOBSD.hints ${CONF}/PICOBSD.hints ; fi + [ -f PICOBSD.hints ] && cp PICOBSD.hints ${CONF}/ # This part creates crunch1.conf and crunch.mk from crunch.conf ${BUILDDIR}/crunch.mk: ${BUILDDIR}/crunch1.conf Modified: head/release/picobsd/build/picobsd ============================================================================== --- head/release/picobsd/build/picobsd Wed Jan 4 17:25:41 2012 (r229510) +++ head/release/picobsd/build/picobsd Wed Jan 4 19:37:25 2012 (r229511) @@ -105,11 +105,6 @@ set_defaults() { # no arguments EDITOR=${EDITOR:-vi} fd_size=${fd_size:-1440} - o_use_loader="yes" # use /boot/loader - # You should not change it unless you are really short - # of space, and your kernel is small enough that the - # bootblocks manage to load it. - o_all_in_mfs="yes" # put all files in mfs so you can boot # and run the image via diskless boot. o_clean="" # set if you want to clean prev.builds. @@ -179,7 +174,17 @@ create_includes_and_libraries2() { # opt if [ -d "$1" ] ; then cd $1 ; ${BINMAKE} ${o_par} $2 # specific target, e.g. ld-elf.so else - ${BINMAKE} ${o_par} _+_= $no toolchain _includes _libraries + # export WITH_RESCUE=yes # build crunchide + # ${BINMAKE} ${o_par} _+_= $no toolchain _includes _libraries + ( + # eval export `cd ${SRC}; ${BINMAKE} -f Makefile.inc1 -V BMAKEENV` + eval "export XMAKE=\"`cd ${SRC}; make -f Makefile -V XMAKE`\"" + ${BINMAKE} ${o_par} _+_= $no toolchain + ) + eval export `cd ${SRC}; ${BINMAKE} -f Makefile.inc1 -V WMAKEENV` + ${BINMAKE} ${o_par} _+_= $no _includes _libraries + [ ${o_arch} != `uname -m` ] && \ + (cd ${l_objtree}; ln -s . ${o_arch}.${o_arch} || true ) fi ) } @@ -242,16 +247,19 @@ set_type() { # the_type the_site name="" # clear in case of errors for i in ${c_startdir}/${a} ${PICO_TREE}/${a} ; do log "set_type: checking $i" - [ -d $i -a -f $i/PICOBSD -a -f $i/crunch.conf ] || continue - set -- `cat $i/PICOBSD | \ + [ -d $i -a -f $i/crunch.conf ] || continue + # look for a kernel config file, privilege arch-specific + l_kernconf=$i/PICOBSD.${o_arch} + [ -f $l_kernconf ] || l_kernconf=$i/PICOBSD + [ -f $l_kernconf ] || continue + set -- `cat $l_kernconf | \ awk '/^#PicoBSD/ {print $2, $3, $4, $5, $6}'` [ x"$1" != "x" ] || continue - MFS_SIZE=$1 ; init_name=$2 - mfs_inodes=$3 ; fd_inodes=$4 + MFS_SIZE=$1 name=`(cd $i ; pwd) ` name=`basename $name` MY_TREE=$i - BUILDDIR=${c_startdir}/build_dir-${name} + BUILDDIR=${c_startdir}/build_dir-${name}-${o_arch} log "Matching file $name in $i" return ; done @@ -328,10 +336,7 @@ main_dialog() { K "edit Kernel config file" \ E "Edit crunch.conf file" \ S "MFS Size: ${MFS_SIZE}kB" \ - I "Init type: ${init_name}" \ F "Floppy size: ${fd_size}kB" \ - M "MFS bytes per inode: ${mfs_inodes}" \ - U "UFS bytes per inode: ${fd_inodes}" \ $ "Site-info: ${SITE}" \ Q "Quit" \ 2> ${c_reply} @@ -349,12 +354,6 @@ main_dialog() { { dialog --menu "Setup the type of configuration" 12 70 5 $l \ 2> ${c_reply} && set_type "`cat ${c_reply}`" ${SITE} ; } || true ;; - I) - { dialog --menu "Choose your init(8) program" \ - 10 70 2 init "Standard init (requires getty)" \ - oinit "small init from TinyWare" 2> ${c_reply} \ - && init_name=`cat ${c_reply}` ; } || true - ;; K) ${EDITOR} ${MY_TREE}/PICOBSD ;; @@ -386,20 +385,6 @@ this as small as possible. " 10 70 2> ${ 2> ${c_reply} && fd_size=`cat ${c_reply}` ; } || true ;; - M) - { dialog --title "MFS bytes per inode:" --inputbox \ - "Enter MFS bytes per inode (typically 4096..65536). \ - A larger value means fewer inodes but more space on MFS" \ - 10 70 2> ${c_reply} && mfs_inodes=`cat ${c_reply}` ; } || true - ;; - - U) - { dialog --title "Floppy bytes per inode:" --inputbox \ - "Enter floppy bytes per inode (typically 3072..65536). \ - A larger value means fewer inodes but more space on the floppy." \ - 10 70 2> ${c_reply} && fd_inodes=`cat ${c_reply}` ; } || true - ;; - N) break 2 ;; @@ -454,8 +439,9 @@ do_kernel() { # OK # export CONFIG export WARNS CWARNFLAGS [ "${o_do_modules}" = "yes" ] && export MODULES="" - ${BINMAKE} ${o_par} -v -f ${PICO_TREE}/build/Makefile.conf ) || \ - fail $? missing_kernel + ${BINMAKE} ${o_par} KERNCONF=${l_kernconf} \ + -v -f ${PICO_TREE}/build/Makefile.conf ) || \ + fail $? missing_kernel } # Populate the variable part of the floppy filesystem. Must be done before @@ -604,6 +590,7 @@ find_progs() { # programs i="`( LD_LIBRARY_PATH=$lp ldd ${u_progs} ) | \ grep -v '^/' | awk '{print $1}' | sort | uniq`" u_libs="`find_progs_helper $o $i`" + log "--- done find_progs ---" return 0 } @@ -637,8 +624,12 @@ find_progs_helper() { # programs [ -d "${ldir}/${i}" ] && places="${places} ${ldir}/${i}" done fi + for i in $progs ; do + # full pathnames are just listed + [ -f "$i" ] && echo $i && continue + find ${places} -maxdepth 3 -type f -name ${i} | head -1 + done # use maxdepth 3 because some libs are way down - find ${places} -maxdepth 3 -type f \( ${names} \) } # Populate the memory filesystem with binaries and non-variable @@ -788,7 +779,6 @@ populate_mfs_tree() { final_cleanup() { log "final_cleanup()" rm -rf ${c_mnt} ${c_reply} 2> /dev/null || true - rm -f ${c_reply} } # fail errno errcode @@ -857,17 +847,6 @@ fill_floppy_image() { fi log "Labeling floppy image" - b2=${BUILDDIR}/boot2 # modified boot2 - cp -f ${c_boot2} ${b2} - chmod 0644 ${b2} - - if [ ${o_use_loader} = "no" ] ; then - log "patch ${c_boot2} to boot /kernel right away" - set `strings -at d ${b2} | grep "/boot/loader"` - echo -e "/kernel\0\0\0\0\0" | \ - dd of=${b2} obs=$1 oseek=1 conv=notrunc 2>/dev/null - fi - chmod 0444 ${b2} dst=${BUILDDIR}/image.tree rm -rf ${dst} @@ -893,17 +872,13 @@ fill_floppy_image() { log "not loading mfs, size ${mfs_size} img ${imgsize}" fi log "Compress with kgzip and copy to floppy image" - if [ ${o_use_loader} = "no" ] ; then - kgzip -o kernel.gz kernel - cp -p kernel.gz ${dst}/kernel || fail $? no_space "copying kernel" - else - gzip kernel - mkdir -p ${dst}/boot/kernel - echo "hint.acpi.0.disabled=\"1\"" > ${dst}/boot/loader.conf - echo "console=\"comconsole\"" >> ${dst}/boot/loader.conf - cp -p /boot/loader ${dst}/boot/loader || fail $? no_space "copying bootloader" - cp -p kernel.gz ${dst}/boot/kernel/kernel.gz || fail $? no_space "copying kernel" - fi + + mkdir -p ${dst}/boot/kernel + # XXX update loader.conf + echo "hint.acpi.0.disabled=\"1\"" > ${dst}/boot/loader.conf + echo "console=\"comconsole\"" >> ${dst}/boot/loader.conf + cp -p /boot/loader ${dst}/boot/loader || fail $? no_space "copying bootloader" + gzip -c kernel > ${dst}/boot/kernel/kernel.gz || fail $? no_space "copying kernel" # now transfer the floppy tree. If it is already in mfs, dont bother. if [ "${o_all_in_mfs}" != "yes" ] ; then @@ -953,10 +928,13 @@ fill_floppy_image() { # so we skip 276 from the source, and 276+512=788 from dst # the old style blocks used 512 and 1024 respectively - dd if=${b2} iseek=1 ibs=276 2> /dev/null | \ + dd if=${c_boot2} iseek=1 ibs=276 2> /dev/null | \ dd of=${BUILDDIR}/${c_img} oseek=1 obs=788 conv=notrunc 2>/dev/null log "done disk image" # XXX (log "Fixing permissions"; cd ${dst}; chown -R root *) + # leave build stuff if verbose + [ ${o_verbose} -gt 0 ] && return + rm -rf ${BUILDDIR}/floppy.tree || true # cleanup # df -ik ${dst} | colrm 70 > .build.reply rm -rf ${dst} @@ -984,9 +962,10 @@ set_build_parameters() { if [ ${OSVERSION} -ge 500035 ] ; then export MAKEOBJDIRPREFIX=${l_objtree} export TARGET_ARCH=${o_arch} TARGET=${o_arch} + # XXX why change machine_arch ? + #-- export MACHINE_ARCH=`uname -m` MACHINE=`uname -m` # export CWARNFLAGS="-Wextra -Wno-sign-compare -Wno-missing-field-initializers" eval "export BINMAKE=\"`cd ${SRC}; make -f Makefile -V BINMAKE`\"" - eval export `cd ${SRC}; ${BINMAKE} -f Makefile.inc1 -V WMAKEENV` fi if [ "${o_init_src}" != "" ] ; then @@ -995,6 +974,8 @@ set_build_parameters() { else create_includes_and_libraries2 fi + else + eval export `cd ${SRC}; ${BINMAKE} -f Makefile.inc1 -V WMAKEENV` fi if [ ${OSVERSION} -lt 500035 ] ; then # Create the right LIBS and CFLAGS for further builds. @@ -1030,29 +1011,29 @@ set_defaults while [ true ]; do log "Parsing $1" case $1 in + --par) + o_par="-j 8" + ;; + --src) # set the source path instead of /usr/src SRC=`realpath $2` shift ;; - --init) + + --init) # run a partial buildworld on the source tree o_init_src="YES" ;; - --arch) + --arch) # override the target architecture o_arch=$2 shift ;; - --floppy_size) + --floppy_size) # image size fd_size=$2 shift ;; - --no_loader) # omit /boot/loader, just rely on boot2 - # (it may have problems with kernels > 4MB) - o_use_loader="no" - ;; - --all_in_mfs) o_all_in_mfs="yes" ;; @@ -1064,6 +1045,7 @@ while [ true ]; do --modules) # also build kernel modules o_do_modules="yes" ;; + -n) o_interactive="NO" ;; From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 19:38:36 2012 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 B9EBF106568C; Wed, 4 Jan 2012 19:38:36 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7053E8FC18; Wed, 4 Jan 2012 19:38:36 +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 q04Jca1i093062; Wed, 4 Jan 2012 19:38:36 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04Jca8a093060; Wed, 4 Jan 2012 19:38:36 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <201201041938.q04Jca8a093060@svn.freebsd.org> From: Ken Smith Date: Wed, 4 Jan 2012 19:38:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229512 - stable/9/release/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, 04 Jan 2012 19:38:37 -0000 Author: kensmith Date: Wed Jan 4 19:38:35 2012 New Revision: 229512 URL: http://svn.freebsd.org/changeset/base/229512 Log: The list of packages we will put on the 9.0-RELEASE DVD images was worked out a bit late so this won't make it into releng/9.0 or release/9.0.0 but it's worth committing to stable/9 for reference when 9.1-RELEASE rolls around. The new installer doesn't handle installing packages itself like sysinstall had done so in that respect packages are no longer as closely tied to doing an install. We'll provide a "disc1" image that has no packages on it at all. For the "dvd1" image there will be a /packages directory with the set of pre-built packages generated by this script (and all the dependencies of these packages...). The idea is to provide enough packages on the DVD for a user to get a minimal graphical workstation installed without needing to do a network based install if their network link is so-so... Discussed with: portmgr, re Modified: stable/9/release/scripts/package-split.py Modified: stable/9/release/scripts/package-split.py ============================================================================== --- stable/9/release/scripts/package-split.py Wed Jan 4 19:37:25 2012 (r229511) +++ stable/9/release/scripts/package-split.py Wed Jan 4 19:38:35 2012 (r229512) @@ -23,87 +23,32 @@ if 'PKG_VERBOSE' in os.environ: else: verbose = 0 -if 'PKG_DVD' in os.environ: - doing_dvd = 1 -else: - doing_dvd = 0 - -# List of packages for disc1. -def disc1_packages(): - pkgs = ['misc/freebsd-doc-bn', - 'misc/freebsd-doc-da', - 'misc/freebsd-doc-de', - 'misc/freebsd-doc-el', - 'misc/freebsd-doc-en', - 'misc/freebsd-doc-es', - 'misc/freebsd-doc-fr', - 'misc/freebsd-doc-hu', - 'misc/freebsd-doc-it', - 'misc/freebsd-doc-ja', - 'misc/freebsd-doc-mn', - 'misc/freebsd-doc-nl', - 'misc/freebsd-doc-pl', - 'misc/freebsd-doc-pt', - 'misc/freebsd-doc-ru', - 'misc/freebsd-doc-sr', - 'misc/freebsd-doc-tr', - 'misc/freebsd-doc-zh_cn', - 'misc/freebsd-doc-zh_tw'] - - if doing_dvd: - pkgs.extend(['archivers/unzip', - 'astro/xearth', - 'devel/gmake', - 'devel/imake', - 'editors/emacs', - 'editors/vim-lite', +# List of packages for dvd1. +def dvd1_packages(): + pkgs = ['archivers/unzip', 'emulators/linux_base-f10', - 'emulators/mtools', - 'graphics/png', - 'graphics/xv', - 'irc/xchat', - 'lang/perl5.8', - 'mail/alpine', - 'mail/exim', - 'mail/fetchmail', - 'mail/mutt', - 'mail/popd', - 'mail/postfix', - 'mail/xfmail', - 'net/cvsup-without-gui', + 'lang/perl5.12', + 'misc/freebsd-doc-all', + 'net/mpd5', 'net/rsync', - 'net/samba3', - 'news/slrn', - 'news/tin', - 'ports-mgmt/p5-FreeBSD-Portindex', 'ports-mgmt/portaudit', 'ports-mgmt/portmaster', - 'ports-mgmt/portupgrade', - 'print/a2ps-letter', - 'print/apsfilter', - 'print/ghostscript7-nox11', - 'print/psutils-letter', - 'print/gv', 'shells/bash', - 'shells/pdksh', 'shells/zsh', 'security/sudo', 'sysutils/screen', + 'www/firefox', 'www/links', - 'www/lynx', + 'x11-drivers/xf86-video-vmware', 'x11/gnome2', 'x11/kde4', - 'x11/rxvt', - 'x11/xorg', - 'x11-wm/afterstep', - 'x11-wm/fvwm2', - 'x11-wm/windowmaker']) + 'x11/xorg']; return pkgs # The list of desired packages def desired_packages(): - disc1 = disc1_packages() - return [disc1] + dvd1 = dvd1_packages() + return [dvd1] # Suck the entire INDEX file into a two different dictionaries. The first # dictionary maps port names (origins) to package names. The second From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 19:43:53 2012 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 DA4AF106566C; Wed, 4 Jan 2012 19:43:53 +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 C814E8FC0C; Wed, 4 Jan 2012 19:43:53 +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 q04JhrKP093279; Wed, 4 Jan 2012 19:43:53 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04Jhrhp093273; Wed, 4 Jan 2012 19:43:53 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201041943.q04Jhrhp093273@svn.freebsd.org> From: John Baldwin Date: Wed, 4 Jan 2012 19:43:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229513 - stable/9/sys/compat/freebsd32 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, 04 Jan 2012 19:43:54 -0000 Author: jhb Date: Wed Jan 4 19:43:53 2012 New Revision: 229513 URL: http://svn.freebsd.org/changeset/base/229513 Log: Regen. Reminded by: kib Modified: stable/9/sys/compat/freebsd32/freebsd32_proto.h stable/9/sys/compat/freebsd32/freebsd32_syscall.h stable/9/sys/compat/freebsd32/freebsd32_syscalls.c stable/9/sys/compat/freebsd32/freebsd32_sysent.c stable/9/sys/compat/freebsd32/freebsd32_systrace_args.c Modified: stable/9/sys/compat/freebsd32/freebsd32_proto.h ============================================================================== --- stable/9/sys/compat/freebsd32/freebsd32_proto.h Wed Jan 4 19:38:35 2012 (r229512) +++ stable/9/sys/compat/freebsd32/freebsd32_proto.h Wed Jan 4 19:43:53 2012 (r229513) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 224066 2011-07-15 18:26:19Z jonathan + * created from FreeBSD: stable/9/sys/compat/freebsd32/syscalls.master 229500 2012-01-04 16:29:45Z jhb */ #ifndef _FREEBSD32_SYSPROTO_H_ @@ -570,10 +570,10 @@ struct freebsd32_pselect_args { }; struct freebsd32_posix_fallocate_args { char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; - char offsetlo_l_[PADL_(uint32_t)]; uint32_t offsetlo; char offsetlo_r_[PADR_(uint32_t)]; - char offsethi_l_[PADL_(uint32_t)]; uint32_t offsethi; char offsethi_r_[PADR_(uint32_t)]; - char lenlo_l_[PADL_(uint32_t)]; uint32_t lenlo; char lenlo_r_[PADR_(uint32_t)]; - char lenhi_l_[PADL_(uint32_t)]; uint32_t lenhi; char lenhi_r_[PADR_(uint32_t)]; + char offset1_l_[PADL_(uint32_t)]; uint32_t offset1; char offset1_r_[PADR_(uint32_t)]; + char offset2_l_[PADL_(uint32_t)]; uint32_t offset2; char offset2_r_[PADR_(uint32_t)]; + char len1_l_[PADL_(uint32_t)]; uint32_t len1; char len1_r_[PADR_(uint32_t)]; + char len2_l_[PADL_(uint32_t)]; uint32_t len2; char len2_r_[PADR_(uint32_t)]; }; #if !defined(PAD64_REQUIRED) && defined(__powerpc__) #define PAD64_REQUIRED Modified: stable/9/sys/compat/freebsd32/freebsd32_syscall.h ============================================================================== --- stable/9/sys/compat/freebsd32/freebsd32_syscall.h Wed Jan 4 19:38:35 2012 (r229512) +++ stable/9/sys/compat/freebsd32/freebsd32_syscall.h Wed Jan 4 19:43:53 2012 (r229513) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 224066 2011-07-15 18:26:19Z jonathan + * created from FreeBSD: stable/9/sys/compat/freebsd32/syscalls.master 229500 2012-01-04 16:29:45Z jhb */ #define FREEBSD32_SYS_syscall 0 Modified: stable/9/sys/compat/freebsd32/freebsd32_syscalls.c ============================================================================== --- stable/9/sys/compat/freebsd32/freebsd32_syscalls.c Wed Jan 4 19:38:35 2012 (r229512) +++ stable/9/sys/compat/freebsd32/freebsd32_syscalls.c Wed Jan 4 19:43:53 2012 (r229513) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 224066 2011-07-15 18:26:19Z jonathan + * created from FreeBSD: stable/9/sys/compat/freebsd32/syscalls.master 229500 2012-01-04 16:29:45Z jhb */ const char *freebsd32_syscallnames[] = { Modified: stable/9/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- stable/9/sys/compat/freebsd32/freebsd32_sysent.c Wed Jan 4 19:38:35 2012 (r229512) +++ stable/9/sys/compat/freebsd32/freebsd32_sysent.c Wed Jan 4 19:43:53 2012 (r229513) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 224066 2011-07-15 18:26:19Z jonathan + * created from FreeBSD: stable/9/sys/compat/freebsd32/syscalls.master 229500 2012-01-04 16:29:45Z jhb */ #include "opt_compat.h" Modified: stable/9/sys/compat/freebsd32/freebsd32_systrace_args.c ============================================================================== --- stable/9/sys/compat/freebsd32/freebsd32_systrace_args.c Wed Jan 4 19:38:35 2012 (r229512) +++ stable/9/sys/compat/freebsd32/freebsd32_systrace_args.c Wed Jan 4 19:43:53 2012 (r229513) @@ -3027,10 +3027,10 @@ systrace_args(int sysnum, void *params, case 530: { struct freebsd32_posix_fallocate_args *p = params; iarg[0] = p->fd; /* int */ - uarg[1] = p->offsetlo; /* uint32_t */ - uarg[2] = p->offsethi; /* uint32_t */ - uarg[3] = p->lenlo; /* uint32_t */ - uarg[4] = p->lenhi; /* uint32_t */ + uarg[1] = p->offset1; /* uint32_t */ + uarg[2] = p->offset2; /* uint32_t */ + uarg[3] = p->len1; /* uint32_t */ + uarg[4] = p->len2; /* uint32_t */ *n_args = 5; break; } From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 19:50:11 2012 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 AC69D1065672; Wed, 4 Jan 2012 19:50:11 +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 7FB0A8FC12; Wed, 4 Jan 2012 19:50: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 q04JoBvZ093560; Wed, 4 Jan 2012 19:50:11 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04JoBSY093556; Wed, 4 Jan 2012 19:50:11 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201201041950.q04JoBSY093556@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Wed, 4 Jan 2012 19:50:11 +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: r229514 - in stable/8: share/mk tools/build/options 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, 04 Jan 2012 19:50:11 -0000 Author: bz Date: Wed Jan 4 19:50:10 2012 New Revision: 229514 URL: http://svn.freebsd.org/changeset/base/229514 Log: MFC r221266: Introduce two new options MK_INET and MK_INET_SUPPORT analogically with INET6 equivalents. Added: stable/8/tools/build/options/WITHOUT_INET - copied unchanged from r221266, head/tools/build/options/WITHOUT_INET stable/8/tools/build/options/WITHOUT_INET_SUPPORT - copied unchanged from r221266, head/tools/build/options/WITHOUT_INET_SUPPORT Modified: stable/8/share/mk/bsd.own.mk Directory Properties: stable/8/share/mk/ (props changed) stable/8/tools/build/options/ (props changed) Modified: stable/8/share/mk/bsd.own.mk ============================================================================== --- stable/8/share/mk/bsd.own.mk Wed Jan 4 19:43:53 2012 (r229513) +++ stable/8/share/mk/bsd.own.mk Wed Jan 4 19:50:10 2012 (r229514) @@ -325,6 +325,7 @@ WITH_IDEA= GPIB \ GROFF \ HTML \ + INET \ INET6 \ INFO \ INSTALLLIB \ @@ -500,6 +501,7 @@ MK_GDB:= no .for var in \ BZIP2 \ GNU \ + INET \ INET6 \ IPX \ KERBEROS \ Copied: stable/8/tools/build/options/WITHOUT_INET (from r221266, head/tools/build/options/WITHOUT_INET) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/build/options/WITHOUT_INET Wed Jan 4 19:50:10 2012 (r229514, copy of r221266, head/tools/build/options/WITHOUT_INET) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Set to not build programs and libraries related to IPv4 networking. Copied: stable/8/tools/build/options/WITHOUT_INET_SUPPORT (from r221266, head/tools/build/options/WITHOUT_INET_SUPPORT) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/build/options/WITHOUT_INET_SUPPORT Wed Jan 4 19:50:10 2012 (r229514, copy of r221266, head/tools/build/options/WITHOUT_INET_SUPPORT) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Set to build libraries, programs, and kernel modules without IPv4 support. From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 19:53:33 2012 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 F28A7106566C; Wed, 4 Jan 2012 19:53:32 +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 E098D8FC0A; Wed, 4 Jan 2012 19:53: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 q04JrWdl093690; Wed, 4 Jan 2012 19:53:32 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04JrW9g093688; Wed, 4 Jan 2012 19:53:32 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201201041953.q04JrW9g093688@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Wed, 4 Jan 2012 19:53:32 +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: r229515 - stable/8/share/man/man5 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, 04 Jan 2012 19:53:33 -0000 Author: bz Date: Wed Jan 4 19:53:32 2012 New Revision: 229515 URL: http://svn.freebsd.org/changeset/base/229515 Log: Regen src.conf(5) after merge of WITHOUT_INET{,_SUPPORT} in r229514. Modified: stable/8/share/man/man5/src.conf.5 Modified: stable/8/share/man/man5/src.conf.5 ============================================================================== --- stable/8/share/man/man5/src.conf.5 Wed Jan 4 19:50:10 2012 (r229514) +++ stable/8/share/man/man5/src.conf.5 Wed Jan 4 19:53:32 2012 (r229515) @@ -1,7 +1,7 @@ .\" DO NOT EDIT-- this file is automatically generated. .\" from FreeBSD: stable/8/tools/build/options/makeman 188848 2009-02-20 11:09:55Z mtm .\" $FreeBSD$ -.Dd May 25, 2010 +.Dd January 4, 2012 .Dt SRC.CONF 5 .Os .Sh NAME @@ -368,6 +368,15 @@ This code is patented in the USA and man It is .Em "YOUR RESPONSIBILITY" to determine if you can legally use IDEA. +.It Va WITHOUT_INET +.\" from FreeBSD: stable/8/tools/build/options/WITHOUT_INET 229514 2012-01-04 19:50:10Z bz +Set to not build programs and libraries related to IPv4 networking. +When set, it also enforces the following options: +.Pp +.Bl -item -compact +.It +.Va WITHOUT_INET_SUPPORT +.El .It Va WITHOUT_INET6 .\" from FreeBSD: stable/8/tools/build/options/WITHOUT_INET6 156932 2006-03-21 07:50:50Z ru Set to not build @@ -381,6 +390,9 @@ When set, it also enforces the following .It Va WITHOUT_INET6_SUPPORT .\" from FreeBSD: stable/8/tools/build/options/WITHOUT_INET6_SUPPORT 156932 2006-03-21 07:50:50Z ru Set to build libraries, programs, and kernel modules without IPv6 support. +.It Va WITHOUT_INET_SUPPORT +.\" from FreeBSD: stable/8/tools/build/options/WITHOUT_INET_SUPPORT 229514 2012-01-04 19:50:10Z bz +Set to build libraries, programs, and kernel modules without IPv4 support. .It Va WITHOUT_INFO .\" from FreeBSD: stable/8/tools/build/options/WITHOUT_INFO 156932 2006-03-21 07:50:50Z ru Set to not make or install From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 20:05:38 2012 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 E3CEE106566B; Wed, 4 Jan 2012 20:05:38 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D2E3C8FC08; Wed, 4 Jan 2012 20:05: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 q04K5cqk094139; Wed, 4 Jan 2012 20:05:38 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04K5cCg094137; Wed, 4 Jan 2012 20:05:38 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201201042005.q04K5cCg094137@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Wed, 4 Jan 2012 20:05:38 +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: r229516 - head/lib/libvgl 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, 04 Jan 2012 20:05:39 -0000 Author: pfg Date: Wed Jan 4 20:05:38 2012 New Revision: 229516 URL: http://svn.freebsd.org/changeset/base/229516 Log: Quiet down clang -Werror. Reported by: Pawel Worach Approved by: jhb (mentor) Modified: head/lib/libvgl/simple.c Modified: head/lib/libvgl/simple.c ============================================================================== --- head/lib/libvgl/simple.c Wed Jan 4 19:53:32 2012 (r229515) +++ head/lib/libvgl/simple.c Wed Jan 4 20:05:38 2012 (r229516) @@ -242,8 +242,8 @@ VGLLine(VGLBitmap *object, int x1, int y if (x1 > x2) { /* start from the smaller coordinate */ x = x2; y = y2; - x1 = x1; - y1 = y1; +/* x1 = x1; + y1 = y1; */ } else { x = x1; y = y1; From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 20:14:08 2012 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 3167C106566C; Wed, 4 Jan 2012 20:14:08 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 04AAE8FC08; Wed, 4 Jan 2012 20:14:08 +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 q04KE7mZ094461; Wed, 4 Jan 2012 20:14:07 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04KE7pH094456; Wed, 4 Jan 2012 20:14:07 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201042014.q04KE7pH094456@svn.freebsd.org> From: Dimitry Andric Date: Wed, 4 Jan 2012 20:14:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229517 - in stable/9/lib/clang: libllvmarminfo libllvmmipsinfo libllvmpowerpcinfo libllvmx86info 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, 04 Jan 2012 20:14:08 -0000 Author: dim Date: Wed Jan 4 20:14:07 2012 New Revision: 229517 URL: http://svn.freebsd.org/changeset/base/229517 Log: MFC r229183: In several llvm library Makefiles, remove extraneous slashes at the end of SRCDIR definitions. Modified: stable/9/lib/clang/libllvmarminfo/Makefile stable/9/lib/clang/libllvmmipsinfo/Makefile stable/9/lib/clang/libllvmpowerpcinfo/Makefile stable/9/lib/clang/libllvmx86info/Makefile Directory Properties: stable/9/lib/clang/ (props changed) Modified: stable/9/lib/clang/libllvmarminfo/Makefile ============================================================================== --- stable/9/lib/clang/libllvmarminfo/Makefile Wed Jan 4 20:05:38 2012 (r229516) +++ stable/9/lib/clang/libllvmarminfo/Makefile Wed Jan 4 20:14:07 2012 (r229517) @@ -2,7 +2,7 @@ LIB= llvmarminfo -SRCDIR= lib/Target/ARM/TargetInfo/ +SRCDIR= lib/Target/ARM/TargetInfo INCDIR= lib/Target/ARM SRCS= ARMTargetInfo.cpp Modified: stable/9/lib/clang/libllvmmipsinfo/Makefile ============================================================================== --- stable/9/lib/clang/libllvmmipsinfo/Makefile Wed Jan 4 20:05:38 2012 (r229516) +++ stable/9/lib/clang/libllvmmipsinfo/Makefile Wed Jan 4 20:14:07 2012 (r229517) @@ -2,7 +2,7 @@ LIB= llvmmipsinfo -SRCDIR= lib/Target/Mips/TargetInfo/ +SRCDIR= lib/Target/Mips/TargetInfo INCDIR= lib/Target/Mips SRCS= MipsTargetInfo.cpp Modified: stable/9/lib/clang/libllvmpowerpcinfo/Makefile ============================================================================== --- stable/9/lib/clang/libllvmpowerpcinfo/Makefile Wed Jan 4 20:05:38 2012 (r229516) +++ stable/9/lib/clang/libllvmpowerpcinfo/Makefile Wed Jan 4 20:14:07 2012 (r229517) @@ -2,7 +2,7 @@ LIB= llvmpowerpcinfo -SRCDIR= lib/Target/PowerPC/TargetInfo/ +SRCDIR= lib/Target/PowerPC/TargetInfo INCDIR= lib/Target/PowerPC SRCS= PowerPCTargetInfo.cpp Modified: stable/9/lib/clang/libllvmx86info/Makefile ============================================================================== --- stable/9/lib/clang/libllvmx86info/Makefile Wed Jan 4 20:05:38 2012 (r229516) +++ stable/9/lib/clang/libllvmx86info/Makefile Wed Jan 4 20:14:07 2012 (r229517) @@ -2,7 +2,7 @@ LIB= llvmx86info -SRCDIR= lib/Target/X86/TargetInfo/ +SRCDIR= lib/Target/X86/TargetInfo INCDIR= lib/Target/X86 SRCS= X86TargetInfo.cpp From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 21:04:57 2012 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 CCA1A106566B; Wed, 4 Jan 2012 21:04:57 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BB9BF8FC1B; Wed, 4 Jan 2012 21:04: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 q04L4vc6096190; Wed, 4 Jan 2012 21:04:57 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04L4vSG096187; Wed, 4 Jan 2012 21:04:57 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201201042104.q04L4vSG096187@svn.freebsd.org> From: Robert Watson Date: Wed, 4 Jan 2012 21:04:57 +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: r229518 - head/sbin/ifconfig 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, 04 Jan 2012 21:04:57 -0000 Author: rwatson Date: Wed Jan 4 21:04:57 2012 New Revision: 229518 URL: http://svn.freebsd.org/changeset/base/229518 Log: Adjust the VLAN section of the ifconfig(8) man page to better reflect reality: 1. Only 12-bit VLAN Identifiers, not full 16-bit VLAN tags can be set using ifconfig vlan. 2. When we mean VLAN Identifiers, spell it that way, rather than as VLAN tag. MFC after: 3 days Sponsored by: Adara Networks, Inc. Modified: head/sbin/ifconfig/ifconfig.8 Modified: head/sbin/ifconfig/ifconfig.8 ============================================================================== --- head/sbin/ifconfig/ifconfig.8 Wed Jan 4 20:14:07 2012 (r229517) +++ head/sbin/ifconfig/ifconfig.8 Wed Jan 4 21:04:57 2012 (r229518) @@ -28,7 +28,7 @@ .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94 .\" $FreeBSD$ .\" -.Dd December 17, 2011 +.Dd January 4, 2012 .Dt IFCONFIG 8 .Os .Sh NAME @@ -2378,7 +2378,7 @@ interfaces: .It Cm vlan Ar vlan_tag Set the VLAN tag value to .Ar vlan_tag . -This value is a 16-bit number which is used to create an 802.1Q +This value is a 12-bit VLAN Identifier (VID) which is used to create an 802.1Q VLAN header for packets sent from the .Xr vlan 4 interface. @@ -2400,7 +2400,7 @@ diverted to the specified physical inter .Ar iface with 802.1Q VLAN encapsulation. Packets with 802.1Q encapsulation received -by the parent interface with the correct VLAN tag will be diverted to +by the parent interface with the correct VLAN Identifier will be diverted to the associated .Xr vlan 4 pseudo-interface. @@ -2439,7 +2439,8 @@ pseudo device, disassociate the parent i This breaks the link between the .Xr vlan 4 interface and its parent, -clears its VLAN tag, flags and its link address and shuts the interface down. +clears its VLAN Identifier, flags and its link address and shuts the interface +down. The .Ar iface argument is useless and hence deprecated. From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 21:14:23 2012 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 0AE381065675; Wed, 4 Jan 2012 21:14:23 +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 EE36A8FC0A; Wed, 4 Jan 2012 21:14: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 q04LEMFL096524; Wed, 4 Jan 2012 21:14:22 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04LEMOt096522; Wed, 4 Jan 2012 21:14:22 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201042114.q04LEMOt096522@svn.freebsd.org> From: John Baldwin Date: Wed, 4 Jan 2012 21:14:22 +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: r229519 - head/sys/modules/kgssapi_krb5 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, 04 Jan 2012 21:14:23 -0000 Author: jhb Date: Wed Jan 4 21:14:22 2012 New Revision: 229519 URL: http://svn.freebsd.org/changeset/base/229519 Log: Fix 'make clean' for this module so it cleans up the generated gssd.h. MFC after: 1 week Modified: head/sys/modules/kgssapi_krb5/Makefile Modified: head/sys/modules/kgssapi_krb5/Makefile ============================================================================== --- head/sys/modules/kgssapi_krb5/Makefile Wed Jan 4 21:04:57 2012 (r229518) +++ head/sys/modules/kgssapi_krb5/Makefile Wed Jan 4 21:14:22 2012 (r229519) @@ -13,6 +13,7 @@ SRCS= krb5_mech.c \ SRCS+= kgss_if.h gssd.h MFILES= kgssapi/kgss_if.m +CLEANFILES= gssd.h S= ${.CURDIR}/../.. From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 21:25:12 2012 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 58B121065670; Wed, 4 Jan 2012 21:25:12 +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 3DDF48FC20; Wed, 4 Jan 2012 21:25:12 +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 q04LPCob096919; Wed, 4 Jan 2012 21:25:12 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04LPCY5096917; Wed, 4 Jan 2012 21:25:12 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201042125.q04LPCY5096917@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 4 Jan 2012 21:25:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229520 - stable/9/sys/dev/ae 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, 04 Jan 2012 21:25:12 -0000 Author: yongari Date: Wed Jan 4 21:25:11 2012 New Revision: 229520 URL: http://svn.freebsd.org/changeset/base/229520 Log: MFC r227452: To send a frame, controller requires a prepended TX header and the length of frame should be treated as multiple of 4. Actual frame length is set in the TX header. The TX header position should be aligned on 4 byte boundary and actual frame start position should be aligned on 4 byte boundary as well. This means we need 4(TX header length) + 3(frame length fixup) additional free space in TX buffer in addition to actual frame length. Make sure TX handler check these additional bytes. ae_tx_avail_size() returns actual free space in TX buffer to ease the calculation of available TX buffer space in caller. While I'm here, replace magic number to appropriate sizeof operator to enhance readability. This change should fix controller lockup issue happened under certain conditions but it still does not fix watchdog timeout. It seems the watchdog timeout is side-effect of TxS and TxD mismatches. The root cause of TxD/TxD mismatch is not known yet but it looks like silicon bug. I guess driver may have to reinitialize controller whenever it sees TxS and TxD mismatches but leave it as it was at this moment. PR: kern/145918 Modified: stable/9/sys/dev/ae/if_ae.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/ae/if_ae.c ============================================================================== --- stable/9/sys/dev/ae/if_ae.c Wed Jan 4 21:14:22 2012 (r229519) +++ stable/9/sys/dev/ae/if_ae.c Wed Jan 4 21:25:11 2012 (r229520) @@ -1431,7 +1431,7 @@ ae_tx_avail_size(ae_softc_t *sc) else avail = sc->txd_ack - sc->txd_cur; - return (avail - 4); /* 4-byte header. */ + return (avail); } static int @@ -1448,7 +1448,7 @@ ae_encap(ae_softc_t *sc, struct mbuf **m len = m0->m_pkthdr.len; if ((sc->flags & AE_FLAG_TXAVAIL) == 0 || - ae_tx_avail_size(sc) < len) { + len + sizeof(ae_txd_t) + 3 > ae_tx_avail_size(sc)) { #ifdef AE_DEBUG if_printf(sc->ifp, "No free Tx available.\n"); #endif @@ -1457,11 +1457,10 @@ ae_encap(ae_softc_t *sc, struct mbuf **m hdr = (ae_txd_t *)(sc->txd_base + sc->txd_cur); bzero(hdr, sizeof(*hdr)); - sc->txd_cur = (sc->txd_cur + 4) % AE_TXD_BUFSIZE_DEFAULT; /* Header - size. */ - to_end = AE_TXD_BUFSIZE_DEFAULT - sc->txd_cur; /* Space available to - * the end of the ring - */ + /* Skip header size. */ + sc->txd_cur = (sc->txd_cur + sizeof(ae_txd_t)) % AE_TXD_BUFSIZE_DEFAULT; + /* Space available to the end of the ring */ + to_end = AE_TXD_BUFSIZE_DEFAULT - sc->txd_cur; if (to_end >= len) { m_copydata(m0, 0, len, (caddr_t)(sc->txd_base + sc->txd_cur)); } else { @@ -1840,8 +1839,8 @@ ae_tx_intr(ae_softc_t *sc) /* * Move txd ack and align on 4-byte boundary. */ - sc->txd_ack = ((sc->txd_ack + le16toh(txd->len) + 4 + 3) & ~3) % - AE_TXD_BUFSIZE_DEFAULT; + sc->txd_ack = ((sc->txd_ack + le16toh(txd->len) + + sizeof(ae_txs_t) + 3) & ~3) % AE_TXD_BUFSIZE_DEFAULT; if ((flags & AE_TXS_SUCCESS) != 0) ifp->if_opackets++; From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 21:26:47 2012 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 EA1F9106566B; Wed, 4 Jan 2012 21:26:47 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D90BB8FC0C; Wed, 4 Jan 2012 21:26:47 +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 q04LQlM4096997; Wed, 4 Jan 2012 21:26:47 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04LQlWV096995; Wed, 4 Jan 2012 21:26:47 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201201042126.q04LQlWV096995@svn.freebsd.org> From: Robert Watson Date: Wed, 4 Jan 2012 21:26:47 +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: r229521 - head/gnu/usr.bin/gdb/kgdb 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, 04 Jan 2012 21:26:48 -0000 Author: rwatson Date: Wed Jan 4 21:26:47 2012 New Revision: 229521 URL: http://svn.freebsd.org/changeset/base/229521 Log: Add missing -w to kgdb(1)'s usage(). Sponsored by: Adara Networks, Inc. MFC after: 3 days Modified: head/gnu/usr.bin/gdb/kgdb/main.c Modified: head/gnu/usr.bin/gdb/kgdb/main.c ============================================================================== --- head/gnu/usr.bin/gdb/kgdb/main.c Wed Jan 4 21:25:11 2012 (r229520) +++ head/gnu/usr.bin/gdb/kgdb/main.c Wed Jan 4 21:26:47 2012 (r229521) @@ -83,7 +83,7 @@ usage(void) { fprintf(stderr, - "usage: %s [-afqv] [-d crashdir] [-c core | -n dumpnr | -r device]\n" + "usage: %s [-afqvw] [-d crashdir] [-c core | -n dumpnr | -r device]\n" "\t[kernel [core]]\n", getprogname()); exit(1); } From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 21:27:03 2012 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 CD4C7106566B; Wed, 4 Jan 2012 21:27:03 +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 BB3F38FC08; Wed, 4 Jan 2012 21:27:03 +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 q04LR3UU097041; Wed, 4 Jan 2012 21:27:03 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04LR37w097039; Wed, 4 Jan 2012 21:27:03 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201042127.q04LR37w097039@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 4 Jan 2012 21:27:03 +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: r229522 - stable/8/sys/dev/ae 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, 04 Jan 2012 21:27:04 -0000 Author: yongari Date: Wed Jan 4 21:27:03 2012 New Revision: 229522 URL: http://svn.freebsd.org/changeset/base/229522 Log: MFC r227452: To send a frame, controller requires a prepended TX header and the length of frame should be treated as multiple of 4. Actual frame length is set in the TX header. The TX header position should be aligned on 4 byte boundary and actual frame start position should be aligned on 4 byte boundary as well. This means we need 4(TX header length) + 3(frame length fixup) additional free space in TX buffer in addition to actual frame length. Make sure TX handler check these additional bytes. ae_tx_avail_size() returns actual free space in TX buffer to ease the calculation of available TX buffer space in caller. While I'm here, replace magic number to appropriate sizeof operator to enhance readability. This change should fix controller lockup issue happened under certain conditions but it still does not fix watchdog timeout. It seems the watchdog timeout is side-effect of TxS and TxD mismatches. The root cause of TxD/TxD mismatch is not known yet but it looks like silicon bug. I guess driver may have to reinitialize controller whenever it sees TxS and TxD mismatches but leave it as it was at this moment. PR: kern/145918 Modified: stable/8/sys/dev/ae/if_ae.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/ae/if_ae.c ============================================================================== --- stable/8/sys/dev/ae/if_ae.c Wed Jan 4 21:26:47 2012 (r229521) +++ stable/8/sys/dev/ae/if_ae.c Wed Jan 4 21:27:03 2012 (r229522) @@ -1432,7 +1432,7 @@ ae_tx_avail_size(ae_softc_t *sc) else avail = sc->txd_ack - sc->txd_cur; - return (avail - 4); /* 4-byte header. */ + return (avail); } static int @@ -1449,7 +1449,7 @@ ae_encap(ae_softc_t *sc, struct mbuf **m len = m0->m_pkthdr.len; if ((sc->flags & AE_FLAG_TXAVAIL) == 0 || - ae_tx_avail_size(sc) < len) { + len + sizeof(ae_txd_t) + 3 > ae_tx_avail_size(sc)) { #ifdef AE_DEBUG if_printf(sc->ifp, "No free Tx available.\n"); #endif @@ -1458,11 +1458,10 @@ ae_encap(ae_softc_t *sc, struct mbuf **m hdr = (ae_txd_t *)(sc->txd_base + sc->txd_cur); bzero(hdr, sizeof(*hdr)); - sc->txd_cur = (sc->txd_cur + 4) % AE_TXD_BUFSIZE_DEFAULT; /* Header - size. */ - to_end = AE_TXD_BUFSIZE_DEFAULT - sc->txd_cur; /* Space available to - * the end of the ring - */ + /* Skip header size. */ + sc->txd_cur = (sc->txd_cur + sizeof(ae_txd_t)) % AE_TXD_BUFSIZE_DEFAULT; + /* Space available to the end of the ring */ + to_end = AE_TXD_BUFSIZE_DEFAULT - sc->txd_cur; if (to_end >= len) { m_copydata(m0, 0, len, (caddr_t)(sc->txd_base + sc->txd_cur)); } else { @@ -1841,8 +1840,8 @@ ae_tx_intr(ae_softc_t *sc) /* * Move txd ack and align on 4-byte boundary. */ - sc->txd_ack = ((sc->txd_ack + le16toh(txd->len) + 4 + 3) & ~3) % - AE_TXD_BUFSIZE_DEFAULT; + sc->txd_ack = ((sc->txd_ack + le16toh(txd->len) + + sizeof(ae_txs_t) + 3) & ~3) % AE_TXD_BUFSIZE_DEFAULT; if ((flags & AE_TXS_SUCCESS) != 0) ifp->if_opackets++; From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 21:28:50 2012 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 1FD0D106567B; Wed, 4 Jan 2012 21:28:50 +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 045BA8FC1B; Wed, 4 Jan 2012 21:28:50 +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 q04LSnF8097134; Wed, 4 Jan 2012 21:28:49 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04LSnvO097132; Wed, 4 Jan 2012 21:28:49 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201042128.q04LSnvO097132@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 4 Jan 2012 21:28:49 +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: r229523 - stable/7/sys/dev/ae 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, 04 Jan 2012 21:28:50 -0000 Author: yongari Date: Wed Jan 4 21:28:49 2012 New Revision: 229523 URL: http://svn.freebsd.org/changeset/base/229523 Log: MFC r227452: To send a frame, controller requires a prepended TX header and the length of frame should be treated as multiple of 4. Actual frame length is set in the TX header. The TX header position should be aligned on 4 byte boundary and actual frame start position should be aligned on 4 byte boundary as well. This means we need 4(TX header length) + 3(frame length fixup) additional free space in TX buffer in addition to actual frame length. Make sure TX handler check these additional bytes. ae_tx_avail_size() returns actual free space in TX buffer to ease the calculation of available TX buffer space in caller. While I'm here, replace magic number to appropriate sizeof operator to enhance readability. This change should fix controller lockup issue happened under certain conditions but it still does not fix watchdog timeout. It seems the watchdog timeout is side-effect of TxS and TxD mismatches. The root cause of TxD/TxD mismatch is not known yet but it looks like silicon bug. I guess driver may have to reinitialize controller whenever it sees TxS and TxD mismatches but leave it as it was at this moment. PR: kern/145918 Modified: stable/7/sys/dev/ae/if_ae.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/ae/if_ae.c ============================================================================== --- stable/7/sys/dev/ae/if_ae.c Wed Jan 4 21:27:03 2012 (r229522) +++ stable/7/sys/dev/ae/if_ae.c Wed Jan 4 21:28:49 2012 (r229523) @@ -1432,7 +1432,7 @@ ae_tx_avail_size(ae_softc_t *sc) else avail = sc->txd_ack - sc->txd_cur; - return (avail - 4); /* 4-byte header. */ + return (avail); } static int @@ -1449,7 +1449,7 @@ ae_encap(ae_softc_t *sc, struct mbuf **m len = m0->m_pkthdr.len; if ((sc->flags & AE_FLAG_TXAVAIL) == 0 || - ae_tx_avail_size(sc) < len) { + len + sizeof(ae_txd_t) + 3 > ae_tx_avail_size(sc)) { #ifdef AE_DEBUG if_printf(sc->ifp, "No free Tx available.\n"); #endif @@ -1458,11 +1458,10 @@ ae_encap(ae_softc_t *sc, struct mbuf **m hdr = (ae_txd_t *)(sc->txd_base + sc->txd_cur); bzero(hdr, sizeof(*hdr)); - sc->txd_cur = (sc->txd_cur + 4) % AE_TXD_BUFSIZE_DEFAULT; /* Header - size. */ - to_end = AE_TXD_BUFSIZE_DEFAULT - sc->txd_cur; /* Space available to - * the end of the ring - */ + /* Skip header size. */ + sc->txd_cur = (sc->txd_cur + sizeof(ae_txd_t)) % AE_TXD_BUFSIZE_DEFAULT; + /* Space available to the end of the ring */ + to_end = AE_TXD_BUFSIZE_DEFAULT - sc->txd_cur; if (to_end >= len) { m_copydata(m0, 0, len, (caddr_t)(sc->txd_base + sc->txd_cur)); } else { @@ -1841,8 +1840,8 @@ ae_tx_intr(ae_softc_t *sc) /* * Move txd ack and align on 4-byte boundary. */ - sc->txd_ack = ((sc->txd_ack + le16toh(txd->len) + 4 + 3) & ~3) % - AE_TXD_BUFSIZE_DEFAULT; + sc->txd_ack = ((sc->txd_ack + le16toh(txd->len) + + sizeof(ae_txs_t) + 3) & ~3) % AE_TXD_BUFSIZE_DEFAULT; if ((flags & AE_TXS_SUCCESS) != 0) ifp->if_opackets++; From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 21:50:59 2012 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 6985E1065675; Wed, 4 Jan 2012 21:50:59 +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 568558FC18; Wed, 4 Jan 2012 21:50: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 q04Lox20097901; Wed, 4 Jan 2012 21:50:59 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04LoxpY097898; Wed, 4 Jan 2012 21:50:59 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201042150.q04LoxpY097898@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 4 Jan 2012 21:50:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229524 - stable/9/sys/dev/msk 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, 04 Jan 2012 21:50:59 -0000 Author: yongari Date: Wed Jan 4 21:50:59 2012 New Revision: 229524 URL: http://svn.freebsd.org/changeset/base/229524 Log: MFC r227582: Enable 64bit DMA addressing support for all msk(4) controllers. Unnecessarily complex LE format used on Marvell controller was main reason not to enable 64bit DMA addressing in driver. If high 32bit address of DMA address of TX/RX buffer is changed, driver has to generate a new LE. In TX path, driver will keep track of lastly used high 32bit address of DMA address and generate a new LE whenever it sees high address change in the DMA address. In RX path, driver will always use two LEs to specify 64bit DMA address of RX buffer. If the high 32bit address of DMA address of RX buffer is the same as previous DMA address of RX buffer, driver does not have to use two LEs but driver will use two LEs for simplicity in RX ring management. One of draw back for switching to 64bit DMA addressing is that the large amount of LEs are used to specify 64bit DMA address such that number of available LEs for TX/RX buffers are considerably reduced. To mitigate the issue, increase number of available LEs from 256 to 384 for TX and from 256 to 512 for RX. For 32bit architectures, msk(4) does not use 64bit DMA addressing to save resources. Modified: stable/9/sys/dev/msk/if_msk.c stable/9/sys/dev/msk/if_mskreg.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/msk/if_msk.c ============================================================================== --- stable/9/sys/dev/msk/if_msk.c Wed Jan 4 21:28:49 2012 (r229523) +++ stable/9/sys/dev/msk/if_msk.c Wed Jan 4 21:50:59 2012 (r229524) @@ -692,7 +692,7 @@ msk_init_rx_ring(struct msk_if_softc *sc { struct msk_ring_data *rd; struct msk_rxdesc *rxd; - int i, prod; + int i, nbuf, prod; MSK_IF_LOCK_ASSERT(sc_if); @@ -702,11 +702,18 @@ msk_init_rx_ring(struct msk_if_softc *sc rd = &sc_if->msk_rdata; bzero(rd->msk_rx_ring, sizeof(struct msk_rx_desc) * MSK_RX_RING_CNT); - prod = sc_if->msk_cdata.msk_rx_prod; - i = 0; + for (i = prod = 0; i < MSK_RX_RING_CNT; i++) { + rxd = &sc_if->msk_cdata.msk_rxdesc[prod]; + rxd->rx_m = NULL; + rxd->rx_le = &rd->msk_rx_ring[prod]; + MSK_INC(prod, MSK_RX_RING_CNT); + } + nbuf = MSK_RX_BUF_CNT; + prod = 0; /* Have controller know how to compute Rx checksum. */ if ((sc_if->msk_flags & MSK_FLAG_DESCV2) == 0 && (sc_if->msk_ifp->if_capenable & IFCAP_RXCSUM) != 0) { +#ifdef MSK_64BIT_DMA rxd = &sc_if->msk_cdata.msk_rxdesc[prod]; rxd->rx_m = NULL; rxd->rx_le = &rd->msk_rx_ring[prod]; @@ -715,15 +722,21 @@ msk_init_rx_ring(struct msk_if_softc *sc rxd->rx_le->msk_control = htole32(OP_TCPSTART | HW_OWNER); MSK_INC(prod, MSK_RX_RING_CNT); MSK_INC(sc_if->msk_cdata.msk_rx_cons, MSK_RX_RING_CNT); - i++; - } - for (; i < MSK_RX_RING_CNT; i++) { +#endif rxd = &sc_if->msk_cdata.msk_rxdesc[prod]; rxd->rx_m = NULL; rxd->rx_le = &rd->msk_rx_ring[prod]; + rxd->rx_le->msk_addr = htole32(ETHER_HDR_LEN << 16 | + ETHER_HDR_LEN); + rxd->rx_le->msk_control = htole32(OP_TCPSTART | HW_OWNER); + MSK_INC(prod, MSK_RX_RING_CNT); + MSK_INC(sc_if->msk_cdata.msk_rx_cons, MSK_RX_RING_CNT); + nbuf--; + } + for (i = 0; i < nbuf; i++) { if (msk_newbuf(sc_if, prod) != 0) return (ENOBUFS); - MSK_INC(prod, MSK_RX_RING_CNT); + MSK_RX_INC(prod, MSK_RX_RING_CNT); } bus_dmamap_sync(sc_if->msk_cdata.msk_rx_ring_tag, @@ -731,10 +744,11 @@ msk_init_rx_ring(struct msk_if_softc *sc BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); /* Update prefetch unit. */ - sc_if->msk_cdata.msk_rx_prod = MSK_RX_RING_CNT - 1; + sc_if->msk_cdata.msk_rx_prod = prod; CSR_WRITE_2(sc_if->msk_softc, Y2_PREF_Q_ADDR(sc_if->msk_rxq, PREF_UNIT_PUT_IDX_REG), - sc_if->msk_cdata.msk_rx_prod); + (sc_if->msk_cdata.msk_rx_prod + MSK_RX_RING_CNT - 1) % + MSK_RX_RING_CNT); if (msk_rx_fill(sc_if, 0) != 0) return (ENOBUFS); return (0); @@ -745,7 +759,7 @@ msk_init_jumbo_rx_ring(struct msk_if_sof { struct msk_ring_data *rd; struct msk_rxdesc *rxd; - int i, prod; + int i, nbuf, prod; MSK_IF_LOCK_ASSERT(sc_if); @@ -756,11 +770,18 @@ msk_init_jumbo_rx_ring(struct msk_if_sof rd = &sc_if->msk_rdata; bzero(rd->msk_jumbo_rx_ring, sizeof(struct msk_rx_desc) * MSK_JUMBO_RX_RING_CNT); - prod = sc_if->msk_cdata.msk_rx_prod; - i = 0; + for (i = prod = 0; i < MSK_JUMBO_RX_RING_CNT; i++) { + rxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[prod]; + rxd->rx_m = NULL; + rxd->rx_le = &rd->msk_jumbo_rx_ring[prod]; + MSK_INC(prod, MSK_JUMBO_RX_RING_CNT); + } + nbuf = MSK_RX_BUF_CNT; + prod = 0; /* Have controller know how to compute Rx checksum. */ if ((sc_if->msk_flags & MSK_FLAG_DESCV2) == 0 && (sc_if->msk_ifp->if_capenable & IFCAP_RXCSUM) != 0) { +#ifdef MSK_64BIT_DMA rxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[prod]; rxd->rx_m = NULL; rxd->rx_le = &rd->msk_jumbo_rx_ring[prod]; @@ -769,25 +790,33 @@ msk_init_jumbo_rx_ring(struct msk_if_sof rxd->rx_le->msk_control = htole32(OP_TCPSTART | HW_OWNER); MSK_INC(prod, MSK_JUMBO_RX_RING_CNT); MSK_INC(sc_if->msk_cdata.msk_rx_cons, MSK_JUMBO_RX_RING_CNT); - i++; - } - for (; i < MSK_JUMBO_RX_RING_CNT; i++) { +#endif rxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[prod]; rxd->rx_m = NULL; rxd->rx_le = &rd->msk_jumbo_rx_ring[prod]; + rxd->rx_le->msk_addr = htole32(ETHER_HDR_LEN << 16 | + ETHER_HDR_LEN); + rxd->rx_le->msk_control = htole32(OP_TCPSTART | HW_OWNER); + MSK_INC(prod, MSK_JUMBO_RX_RING_CNT); + MSK_INC(sc_if->msk_cdata.msk_rx_cons, MSK_JUMBO_RX_RING_CNT); + nbuf--; + } + for (i = 0; i < nbuf; i++) { if (msk_jumbo_newbuf(sc_if, prod) != 0) return (ENOBUFS); - MSK_INC(prod, MSK_JUMBO_RX_RING_CNT); + MSK_RX_INC(prod, MSK_JUMBO_RX_RING_CNT); } bus_dmamap_sync(sc_if->msk_cdata.msk_jumbo_rx_ring_tag, sc_if->msk_cdata.msk_jumbo_rx_ring_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); - sc_if->msk_cdata.msk_rx_prod = MSK_JUMBO_RX_RING_CNT - 1; + /* Update prefetch unit. */ + sc_if->msk_cdata.msk_rx_prod = prod; CSR_WRITE_2(sc_if->msk_softc, Y2_PREF_Q_ADDR(sc_if->msk_rxq, PREF_UNIT_PUT_IDX_REG), - sc_if->msk_cdata.msk_rx_prod); + (sc_if->msk_cdata.msk_rx_prod + MSK_JUMBO_RX_RING_CNT - 1) % + MSK_JUMBO_RX_RING_CNT); if (msk_rx_fill(sc_if, 1) != 0) return (ENOBUFS); return (0); @@ -805,6 +834,7 @@ msk_init_tx_ring(struct msk_if_softc *sc sc_if->msk_cdata.msk_tx_prod = 0; sc_if->msk_cdata.msk_tx_cons = 0; sc_if->msk_cdata.msk_tx_cnt = 0; + sc_if->msk_cdata.msk_tx_high_addr = 0; rd = &sc_if->msk_rdata; bzero(rd->msk_tx_ring, sizeof(struct msk_tx_desc) * MSK_TX_RING_CNT); @@ -826,6 +856,12 @@ msk_discard_rxbuf(struct msk_if_softc *s struct msk_rxdesc *rxd; struct mbuf *m; +#ifdef MSK_64BIT_DMA + rxd = &sc_if->msk_cdata.msk_rxdesc[idx]; + rx_le = rxd->rx_le; + rx_le->msk_control = htole32(OP_ADDR64 | HW_OWNER); + MSK_INC(idx, MSK_RX_RING_CNT); +#endif rxd = &sc_if->msk_cdata.msk_rxdesc[idx]; m = rxd->rx_m; rx_le = rxd->rx_le; @@ -839,6 +875,12 @@ msk_discard_jumbo_rxbuf(struct msk_if_so struct msk_rxdesc *rxd; struct mbuf *m; +#ifdef MSK_64BIT_DMA + rxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[idx]; + rx_le = rxd->rx_le; + rx_le->msk_control = htole32(OP_ADDR64 | HW_OWNER); + MSK_INC(idx, MSK_JUMBO_RX_RING_CNT); +#endif rxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[idx]; m = rxd->rx_m; rx_le = rxd->rx_le; @@ -876,10 +918,18 @@ msk_newbuf(struct msk_if_softc *sc_if, i KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); rxd = &sc_if->msk_cdata.msk_rxdesc[idx]; +#ifdef MSK_64BIT_DMA + rx_le = rxd->rx_le; + rx_le->msk_addr = htole32(MSK_ADDR_HI(segs[0].ds_addr)); + rx_le->msk_control = htole32(OP_ADDR64 | HW_OWNER); + MSK_INC(idx, MSK_RX_RING_CNT); + rxd = &sc_if->msk_cdata.msk_rxdesc[idx]; +#endif if (rxd->rx_m != NULL) { bus_dmamap_sync(sc_if->msk_cdata.msk_rx_tag, rxd->rx_dmamap, BUS_DMASYNC_POSTREAD); bus_dmamap_unload(sc_if->msk_cdata.msk_rx_tag, rxd->rx_dmamap); + rxd->rx_m = NULL; } map = rxd->rx_dmamap; rxd->rx_dmamap = sc_if->msk_cdata.msk_rx_sparemap; @@ -929,11 +979,19 @@ msk_jumbo_newbuf(struct msk_if_softc *sc KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); rxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[idx]; +#ifdef MSK_64BIT_DMA + rx_le = rxd->rx_le; + rx_le->msk_addr = htole32(MSK_ADDR_HI(segs[0].ds_addr)); + rx_le->msk_control = htole32(OP_ADDR64 | HW_OWNER); + MSK_INC(idx, MSK_JUMBO_RX_RING_CNT); + rxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[idx]; +#endif if (rxd->rx_m != NULL) { bus_dmamap_sync(sc_if->msk_cdata.msk_jumbo_rx_tag, rxd->rx_dmamap, BUS_DMASYNC_POSTREAD); bus_dmamap_unload(sc_if->msk_cdata.msk_jumbo_rx_tag, rxd->rx_dmamap); + rxd->rx_m = NULL; } map = rxd->rx_dmamap; rxd->rx_dmamap = sc_if->msk_cdata.msk_jumbo_rx_sparemap; @@ -1464,7 +1522,7 @@ mskc_reset(struct msk_softc *sc) /* Clear status list. */ bzero(sc->msk_stat_ring, - sizeof(struct msk_stat_desc) * MSK_STAT_RING_CNT); + sizeof(struct msk_stat_desc) * sc->msk_stat_count); sc->msk_stat_cons = 0; bus_dmamap_sync(sc->msk_stat_tag, sc->msk_stat_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); @@ -1475,7 +1533,7 @@ mskc_reset(struct msk_softc *sc) CSR_WRITE_4(sc, STAT_LIST_ADDR_LO, MSK_ADDR_LO(addr)); CSR_WRITE_4(sc, STAT_LIST_ADDR_HI, MSK_ADDR_HI(addr)); /* Set the status list last index. */ - CSR_WRITE_2(sc, STAT_LAST_IDX, MSK_STAT_RING_CNT - 1); + CSR_WRITE_2(sc, STAT_LAST_IDX, sc->msk_stat_count - 1); if (sc->msk_hw_id == CHIP_ID_YUKON_EC && sc->msk_hw_rev == CHIP_REV_YU_EC_A1) { /* WA for dev. #4.3 */ @@ -2075,17 +2133,29 @@ static int msk_status_dma_alloc(struct msk_softc *sc) { struct msk_dmamap_arg ctx; - int error; + bus_size_t stat_sz; + int count, error; + /* + * It seems controller requires number of status LE entries + * is power of 2 and the maximum number of status LE entries + * is 4096. For dual-port controllers, the number of status + * LE entries should be large enough to hold both port's + * status updates. + */ + count = 3 * MSK_RX_RING_CNT + MSK_TX_RING_CNT; + count = imin(4096, roundup2(count, 1024)); + sc->msk_stat_count = count; + stat_sz = count * sizeof(struct msk_stat_desc); error = bus_dma_tag_create( bus_get_dma_tag(sc->msk_dev), /* parent */ MSK_STAT_ALIGN, 0, /* alignment, boundary */ BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ - MSK_STAT_RING_SZ, /* maxsize */ + stat_sz, /* maxsize */ 1, /* nsegments */ - MSK_STAT_RING_SZ, /* maxsegsize */ + stat_sz, /* maxsegsize */ 0, /* flags */ NULL, NULL, /* lockfunc, lockarg */ &sc->msk_stat_tag); @@ -2106,9 +2176,8 @@ msk_status_dma_alloc(struct msk_softc *s } ctx.msk_busaddr = 0; - error = bus_dmamap_load(sc->msk_stat_tag, - sc->msk_stat_map, sc->msk_stat_ring, MSK_STAT_RING_SZ, - msk_dmamap_cb, &ctx, 0); + error = bus_dmamap_load(sc->msk_stat_tag, sc->msk_stat_map, + sc->msk_stat_ring, stat_sz, msk_dmamap_cb, &ctx, BUS_DMA_NOWAIT); if (error != 0) { device_printf(sc->msk_dev, "failed to load DMA'able memory for status ring\n"); @@ -2149,27 +2218,10 @@ msk_txrx_dma_alloc(struct msk_if_softc * int error, i; /* Create parent DMA tag. */ - /* - * XXX - * It seems that Yukon II supports full 64bits DMA operations. But - * it needs two descriptors(list elements) for 64bits DMA operations. - * Since we don't know what DMA address mappings(32bits or 64bits) - * would be used in advance for each mbufs, we limits its DMA space - * to be in range of 32bits address space. Otherwise, we should check - * what DMA address is used and chain another descriptor for the - * 64bits DMA operation. This also means descriptor ring size is - * variable. Limiting DMA address to be in 32bit address space greatly - * simplifies descriptor handling and possibly would increase - * performance a bit due to efficient handling of descriptors. - * Apart from harassing checksum offloading mechanisms, it seems - * it's really bad idea to use a separate descriptor for 64bit - * DMA operation to save small descriptor memory. Anyway, I've - * never seen these exotic scheme on ethernet interface hardware. - */ error = bus_dma_tag_create( bus_get_dma_tag(sc_if->msk_if_dev), /* parent */ 1, 0, /* alignment, boundary */ - BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ + BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ BUS_SPACE_MAXSIZE_32BIT, /* maxsize */ @@ -2275,7 +2327,7 @@ msk_txrx_dma_alloc(struct msk_if_softc * ctx.msk_busaddr = 0; error = bus_dmamap_load(sc_if->msk_cdata.msk_tx_ring_tag, sc_if->msk_cdata.msk_tx_ring_map, sc_if->msk_rdata.msk_tx_ring, - MSK_TX_RING_SZ, msk_dmamap_cb, &ctx, 0); + MSK_TX_RING_SZ, msk_dmamap_cb, &ctx, BUS_DMA_NOWAIT); if (error != 0) { device_printf(sc_if->msk_if_dev, "failed to load DMA'able memory for Tx ring\n"); @@ -2296,7 +2348,7 @@ msk_txrx_dma_alloc(struct msk_if_softc * ctx.msk_busaddr = 0; error = bus_dmamap_load(sc_if->msk_cdata.msk_rx_ring_tag, sc_if->msk_cdata.msk_rx_ring_map, sc_if->msk_rdata.msk_rx_ring, - MSK_RX_RING_SZ, msk_dmamap_cb, &ctx, 0); + MSK_RX_RING_SZ, msk_dmamap_cb, &ctx, BUS_DMA_NOWAIT); if (error != 0) { device_printf(sc_if->msk_if_dev, "failed to load DMA'able memory for Rx ring\n"); @@ -2413,7 +2465,7 @@ msk_rx_dma_jalloc(struct msk_if_softc *s error = bus_dmamap_load(sc_if->msk_cdata.msk_jumbo_rx_ring_tag, sc_if->msk_cdata.msk_jumbo_rx_ring_map, sc_if->msk_rdata.msk_jumbo_rx_ring, MSK_JUMBO_RX_RING_SZ, - msk_dmamap_cb, &ctx, 0); + msk_dmamap_cb, &ctx, BUS_DMA_NOWAIT); if (error != 0) { device_printf(sc_if->msk_if_dev, "failed to load DMA'able memory for jumbo Rx ring\n"); @@ -2773,6 +2825,18 @@ msk_encap(struct msk_if_softc *sc_if, st } } +#ifdef MSK_64BIT_DMA + if (MSK_ADDR_HI(txsegs[0].ds_addr) != + sc_if->msk_cdata.msk_tx_high_addr) { + sc_if->msk_cdata.msk_tx_high_addr = + MSK_ADDR_HI(txsegs[0].ds_addr); + tx_le = &sc_if->msk_rdata.msk_tx_ring[prod]; + tx_le->msk_addr = htole32(MSK_ADDR_HI(txsegs[0].ds_addr)); + tx_le->msk_control = htole32(OP_ADDR64 | HW_OWNER); + sc_if->msk_cdata.msk_tx_cnt++; + MSK_INC(prod, MSK_TX_RING_CNT); + } +#endif si = prod; tx_le = &sc_if->msk_rdata.msk_tx_ring[prod]; tx_le->msk_addr = htole32(MSK_ADDR_LO(txsegs[0].ds_addr)); @@ -2787,6 +2851,20 @@ msk_encap(struct msk_if_softc *sc_if, st for (i = 1; i < nseg; i++) { tx_le = &sc_if->msk_rdata.msk_tx_ring[prod]; +#ifdef MSK_64BIT_DMA + if (MSK_ADDR_HI(txsegs[i].ds_addr) != + sc_if->msk_cdata.msk_tx_high_addr) { + sc_if->msk_cdata.msk_tx_high_addr = + MSK_ADDR_HI(txsegs[i].ds_addr); + tx_le = &sc_if->msk_rdata.msk_tx_ring[prod]; + tx_le->msk_addr = + htole32(MSK_ADDR_HI(txsegs[i].ds_addr)); + tx_le->msk_control = htole32(OP_ADDR64 | HW_OWNER); + sc_if->msk_cdata.msk_tx_cnt++; + MSK_INC(prod, MSK_TX_RING_CNT); + tx_le = &sc_if->msk_rdata.msk_tx_ring[prod]; + } +#endif tx_le->msk_addr = htole32(MSK_ADDR_LO(txsegs[i].ds_addr)); tx_le->msk_control = htole32(txsegs[i].ds_len | control | OP_BUFFER | HW_OWNER); @@ -3139,7 +3217,12 @@ msk_rxeof(struct msk_if_softc *sc_if, ui msk_discard_rxbuf(sc_if, cons); break; } +#ifdef MSK_64BIT_DMA + rxd = &sc_if->msk_cdata.msk_rxdesc[(cons + 1) % + MSK_RX_RING_CNT]; +#else rxd = &sc_if->msk_cdata.msk_rxdesc[cons]; +#endif m = rxd->rx_m; if (msk_newbuf(sc_if, cons) != 0) { ifp->if_iqdrops++; @@ -3167,8 +3250,8 @@ msk_rxeof(struct msk_if_softc *sc_if, ui MSK_IF_LOCK(sc_if); } while (0); - MSK_INC(sc_if->msk_cdata.msk_rx_cons, MSK_RX_RING_CNT); - MSK_INC(sc_if->msk_cdata.msk_rx_prod, MSK_RX_RING_CNT); + MSK_RX_INC(sc_if->msk_cdata.msk_rx_cons, MSK_RX_RING_CNT); + MSK_RX_INC(sc_if->msk_cdata.msk_rx_prod, MSK_RX_RING_CNT); } static void @@ -3199,7 +3282,12 @@ msk_jumbo_rxeof(struct msk_if_softc *sc_ msk_discard_jumbo_rxbuf(sc_if, cons); break; } +#ifdef MSK_64BIT_DMA + jrxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[(cons + 1) % + MSK_JUMBO_RX_RING_CNT]; +#else jrxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[cons]; +#endif m = jrxd->rx_m; if (msk_jumbo_newbuf(sc_if, cons) != 0) { ifp->if_iqdrops++; @@ -3227,8 +3315,8 @@ msk_jumbo_rxeof(struct msk_if_softc *sc_ MSK_IF_LOCK(sc_if); } while (0); - MSK_INC(sc_if->msk_cdata.msk_rx_cons, MSK_JUMBO_RX_RING_CNT); - MSK_INC(sc_if->msk_cdata.msk_rx_prod, MSK_JUMBO_RX_RING_CNT); + MSK_RX_INC(sc_if->msk_cdata.msk_rx_cons, MSK_JUMBO_RX_RING_CNT); + MSK_RX_INC(sc_if->msk_cdata.msk_rx_prod, MSK_JUMBO_RX_RING_CNT); } static void @@ -3573,7 +3661,7 @@ msk_handle_events(struct msk_softc *sc) control & STLE_OP_MASK); break; } - MSK_INC(cons, MSK_STAT_RING_CNT); + MSK_INC(cons, sc->msk_stat_count); if (rxprog > sc->msk_process_limit) break; } Modified: stable/9/sys/dev/msk/if_mskreg.h ============================================================================== --- stable/9/sys/dev/msk/if_mskreg.h Wed Jan 4 21:28:49 2012 (r229523) +++ stable/9/sys/dev/msk/if_mskreg.h Wed Jan 4 21:50:59 2012 (r229524) @@ -2315,35 +2315,48 @@ struct msk_stat_desc { #define BMU_UDP_CHECK (0x57<<16) /* Descr with UDP ext (YUKON only) */ #define BMU_BBC 0xffff /* Bit 15.. 0: Buffer Byte Counter */ +/* + * Controller requires an additional LE op code for 64bit DMA operation. + * Driver uses fixed number of RX buffers such that this limitation + * reduces number of available RX buffers with 64bit DMA so double + * number of RX buffers on platforms that support 64bit DMA. For TX + * side, controller requires an additional OP_ADDR64 op code if a TX + * buffer uses different high address value than previously used one. + * Driver monitors high DMA address change in TX and inserts an + * OP_ADDR64 op code if the high DMA address is changed. Driver + * allocates 50% more total TX buffers on platforms that support 64bit + * DMA. + */ +#if (BUS_SPACE_MAXADDR > 0xFFFFFFFF) +#define MSK_64BIT_DMA +#define MSK_TX_RING_CNT 384 +#define MSK_RX_RING_CNT 512 +#else +#undef MSK_64BIT_DMA #define MSK_TX_RING_CNT 256 #define MSK_RX_RING_CNT 256 +#endif #define MSK_RX_BUF_ALIGN 8 #define MSK_JUMBO_RX_RING_CNT MSK_RX_RING_CNT -#define MSK_STAT_RING_CNT ((1 + 3) * (MSK_TX_RING_CNT + MSK_RX_RING_CNT)) #define MSK_MAXTXSEGS 32 #define MSK_TSO_MAXSGSIZE 4096 #define MSK_TSO_MAXSIZE (65535 + sizeof(struct ether_vlan_header)) /* - * It seems that the hardware requires extra decriptors(LEs) to offload - * TCP/UDP checksum, VLAN hardware tag inserstion and TSO. + * It seems that the hardware requires extra descriptors(LEs) to offload + * TCP/UDP checksum, VLAN hardware tag insertion and TSO. * * 1 descriptor for TCP/UDP checksum offload. * 1 descriptor VLAN hardware tag insertion. * 1 descriptor for TSO(TCP Segmentation Offload) - * 1 descriptor for 64bits DMA : Not applicatable due to the use of - * BUS_SPACE_MAXADDR_32BIT in parent DMA tag creation. + * 1 descriptor for each 64bits DMA transfers */ +#ifdef MSK_64BIT_DMA +#define MSK_RESERVED_TX_DESC_CNT (MSK_MAXTXSEGS + 3) +#else #define MSK_RESERVED_TX_DESC_CNT 3 +#endif -/* - * Jumbo buffer stuff. Note that we must allocate more jumbo - * buffers than there are descriptors in the receive ring. This - * is because we don't know how long it will take for a packet - * to be released after we hand it off to the upper protocol - * layers. To be safe, we allocate 1.5 times the number of - * receive descriptors. - */ #define MSK_JUMBO_FRAMELEN 9022 #define MSK_JUMBO_MTU (MSK_JUMBO_FRAMELEN-ETHER_HDR_LEN-ETHER_CRC_LEN) #define MSK_MAX_FRAMELEN \ @@ -2380,6 +2393,7 @@ struct msk_chain_data { bus_dmamap_t msk_jumbo_rx_sparemap; uint16_t msk_tso_mtu; uint32_t msk_last_csum; + uint32_t msk_tx_high_addr; int msk_tx_prod; int msk_tx_cons; int msk_tx_cnt; @@ -2411,10 +2425,17 @@ struct msk_ring_data { (sizeof(struct msk_rx_desc) * MSK_RX_RING_CNT) #define MSK_JUMBO_RX_RING_SZ \ (sizeof(struct msk_rx_desc) * MSK_JUMBO_RX_RING_CNT) -#define MSK_STAT_RING_SZ \ - (sizeof(struct msk_stat_desc) * MSK_STAT_RING_CNT) #define MSK_INC(x, y) (x) = (x + 1) % y +#ifdef MSK_64BIT_DMA +#define MSK_RX_INC(x, y) (x) = (x + 2) % y +#define MSK_RX_BUF_CNT (MSK_RX_RING_CNT / 2) +#define MSK_JUMBO_RX_BUF_CNT (MSK_JUMBO_RX_RING_CNT / 2) +#else +#define MSK_RX_INC(x, y) (x) = (x + 1) % y +#define MSK_RX_BUF_CNT MSK_RX_RING_CNT +#define MSK_JUMBO_RX_BUF_CNT MSK_JUMBO_RX_RING_CNT +#endif #define MSK_PCI_BUS 0 #define MSK_PCIX_BUS 1 @@ -2519,6 +2540,7 @@ struct msk_softc { int msk_int_holdoff; int msk_process_limit; int msk_stat_cons; + int msk_stat_count; struct mtx msk_mtx; }; From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 21:52:56 2012 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 DB5FE106564A; Wed, 4 Jan 2012 21:52:56 +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 C83F38FC08; Wed, 4 Jan 2012 21:52: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 q04Lquwl097998; Wed, 4 Jan 2012 21:52:56 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04Lqug9097995; Wed, 4 Jan 2012 21:52:56 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201042152.q04Lqug9097995@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 4 Jan 2012 21:52: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: r229525 - stable/8/sys/dev/msk 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, 04 Jan 2012 21:52:57 -0000 Author: yongari Date: Wed Jan 4 21:52:56 2012 New Revision: 229525 URL: http://svn.freebsd.org/changeset/base/229525 Log: MFC r227582: Enable 64bit DMA addressing support for all msk(4) controllers. Unnecessarily complex LE format used on Marvell controller was main reason not to enable 64bit DMA addressing in driver. If high 32bit address of DMA address of TX/RX buffer is changed, driver has to generate a new LE. In TX path, driver will keep track of lastly used high 32bit address of DMA address and generate a new LE whenever it sees high address change in the DMA address. In RX path, driver will always use two LEs to specify 64bit DMA address of RX buffer. If the high 32bit address of DMA address of RX buffer is the same as previous DMA address of RX buffer, driver does not have to use two LEs but driver will use two LEs for simplicity in RX ring management. One of draw back for switching to 64bit DMA addressing is that the large amount of LEs are used to specify 64bit DMA address such that number of available LEs for TX/RX buffers are considerably reduced. To mitigate the issue, increase number of available LEs from 256 to 384 for TX and from 256 to 512 for RX. For 32bit architectures, msk(4) does not use 64bit DMA addressing to save resources. Modified: stable/8/sys/dev/msk/if_msk.c stable/8/sys/dev/msk/if_mskreg.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/msk/if_msk.c ============================================================================== --- stable/8/sys/dev/msk/if_msk.c Wed Jan 4 21:50:59 2012 (r229524) +++ stable/8/sys/dev/msk/if_msk.c Wed Jan 4 21:52:56 2012 (r229525) @@ -700,7 +700,7 @@ msk_init_rx_ring(struct msk_if_softc *sc { struct msk_ring_data *rd; struct msk_rxdesc *rxd; - int i, prod; + int i, nbuf, prod; MSK_IF_LOCK_ASSERT(sc_if); @@ -710,11 +710,18 @@ msk_init_rx_ring(struct msk_if_softc *sc rd = &sc_if->msk_rdata; bzero(rd->msk_rx_ring, sizeof(struct msk_rx_desc) * MSK_RX_RING_CNT); - prod = sc_if->msk_cdata.msk_rx_prod; - i = 0; + for (i = prod = 0; i < MSK_RX_RING_CNT; i++) { + rxd = &sc_if->msk_cdata.msk_rxdesc[prod]; + rxd->rx_m = NULL; + rxd->rx_le = &rd->msk_rx_ring[prod]; + MSK_INC(prod, MSK_RX_RING_CNT); + } + nbuf = MSK_RX_BUF_CNT; + prod = 0; /* Have controller know how to compute Rx checksum. */ if ((sc_if->msk_flags & MSK_FLAG_DESCV2) == 0 && (sc_if->msk_ifp->if_capenable & IFCAP_RXCSUM) != 0) { +#ifdef MSK_64BIT_DMA rxd = &sc_if->msk_cdata.msk_rxdesc[prod]; rxd->rx_m = NULL; rxd->rx_le = &rd->msk_rx_ring[prod]; @@ -723,15 +730,21 @@ msk_init_rx_ring(struct msk_if_softc *sc rxd->rx_le->msk_control = htole32(OP_TCPSTART | HW_OWNER); MSK_INC(prod, MSK_RX_RING_CNT); MSK_INC(sc_if->msk_cdata.msk_rx_cons, MSK_RX_RING_CNT); - i++; - } - for (; i < MSK_RX_RING_CNT; i++) { +#endif rxd = &sc_if->msk_cdata.msk_rxdesc[prod]; rxd->rx_m = NULL; rxd->rx_le = &rd->msk_rx_ring[prod]; + rxd->rx_le->msk_addr = htole32(ETHER_HDR_LEN << 16 | + ETHER_HDR_LEN); + rxd->rx_le->msk_control = htole32(OP_TCPSTART | HW_OWNER); + MSK_INC(prod, MSK_RX_RING_CNT); + MSK_INC(sc_if->msk_cdata.msk_rx_cons, MSK_RX_RING_CNT); + nbuf--; + } + for (i = 0; i < nbuf; i++) { if (msk_newbuf(sc_if, prod) != 0) return (ENOBUFS); - MSK_INC(prod, MSK_RX_RING_CNT); + MSK_RX_INC(prod, MSK_RX_RING_CNT); } bus_dmamap_sync(sc_if->msk_cdata.msk_rx_ring_tag, @@ -739,10 +752,11 @@ msk_init_rx_ring(struct msk_if_softc *sc BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); /* Update prefetch unit. */ - sc_if->msk_cdata.msk_rx_prod = MSK_RX_RING_CNT - 1; + sc_if->msk_cdata.msk_rx_prod = prod; CSR_WRITE_2(sc_if->msk_softc, Y2_PREF_Q_ADDR(sc_if->msk_rxq, PREF_UNIT_PUT_IDX_REG), - sc_if->msk_cdata.msk_rx_prod); + (sc_if->msk_cdata.msk_rx_prod + MSK_RX_RING_CNT - 1) % + MSK_RX_RING_CNT); if (msk_rx_fill(sc_if, 0) != 0) return (ENOBUFS); return (0); @@ -753,7 +767,7 @@ msk_init_jumbo_rx_ring(struct msk_if_sof { struct msk_ring_data *rd; struct msk_rxdesc *rxd; - int i, prod; + int i, nbuf, prod; MSK_IF_LOCK_ASSERT(sc_if); @@ -764,11 +778,18 @@ msk_init_jumbo_rx_ring(struct msk_if_sof rd = &sc_if->msk_rdata; bzero(rd->msk_jumbo_rx_ring, sizeof(struct msk_rx_desc) * MSK_JUMBO_RX_RING_CNT); - prod = sc_if->msk_cdata.msk_rx_prod; - i = 0; + for (i = prod = 0; i < MSK_JUMBO_RX_RING_CNT; i++) { + rxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[prod]; + rxd->rx_m = NULL; + rxd->rx_le = &rd->msk_jumbo_rx_ring[prod]; + MSK_INC(prod, MSK_JUMBO_RX_RING_CNT); + } + nbuf = MSK_RX_BUF_CNT; + prod = 0; /* Have controller know how to compute Rx checksum. */ if ((sc_if->msk_flags & MSK_FLAG_DESCV2) == 0 && (sc_if->msk_ifp->if_capenable & IFCAP_RXCSUM) != 0) { +#ifdef MSK_64BIT_DMA rxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[prod]; rxd->rx_m = NULL; rxd->rx_le = &rd->msk_jumbo_rx_ring[prod]; @@ -777,25 +798,33 @@ msk_init_jumbo_rx_ring(struct msk_if_sof rxd->rx_le->msk_control = htole32(OP_TCPSTART | HW_OWNER); MSK_INC(prod, MSK_JUMBO_RX_RING_CNT); MSK_INC(sc_if->msk_cdata.msk_rx_cons, MSK_JUMBO_RX_RING_CNT); - i++; - } - for (; i < MSK_JUMBO_RX_RING_CNT; i++) { +#endif rxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[prod]; rxd->rx_m = NULL; rxd->rx_le = &rd->msk_jumbo_rx_ring[prod]; + rxd->rx_le->msk_addr = htole32(ETHER_HDR_LEN << 16 | + ETHER_HDR_LEN); + rxd->rx_le->msk_control = htole32(OP_TCPSTART | HW_OWNER); + MSK_INC(prod, MSK_JUMBO_RX_RING_CNT); + MSK_INC(sc_if->msk_cdata.msk_rx_cons, MSK_JUMBO_RX_RING_CNT); + nbuf--; + } + for (i = 0; i < nbuf; i++) { if (msk_jumbo_newbuf(sc_if, prod) != 0) return (ENOBUFS); - MSK_INC(prod, MSK_JUMBO_RX_RING_CNT); + MSK_RX_INC(prod, MSK_JUMBO_RX_RING_CNT); } bus_dmamap_sync(sc_if->msk_cdata.msk_jumbo_rx_ring_tag, sc_if->msk_cdata.msk_jumbo_rx_ring_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); - sc_if->msk_cdata.msk_rx_prod = MSK_JUMBO_RX_RING_CNT - 1; + /* Update prefetch unit. */ + sc_if->msk_cdata.msk_rx_prod = prod; CSR_WRITE_2(sc_if->msk_softc, Y2_PREF_Q_ADDR(sc_if->msk_rxq, PREF_UNIT_PUT_IDX_REG), - sc_if->msk_cdata.msk_rx_prod); + (sc_if->msk_cdata.msk_rx_prod + MSK_JUMBO_RX_RING_CNT - 1) % + MSK_JUMBO_RX_RING_CNT); if (msk_rx_fill(sc_if, 1) != 0) return (ENOBUFS); return (0); @@ -813,6 +842,7 @@ msk_init_tx_ring(struct msk_if_softc *sc sc_if->msk_cdata.msk_tx_prod = 0; sc_if->msk_cdata.msk_tx_cons = 0; sc_if->msk_cdata.msk_tx_cnt = 0; + sc_if->msk_cdata.msk_tx_high_addr = 0; rd = &sc_if->msk_rdata; bzero(rd->msk_tx_ring, sizeof(struct msk_tx_desc) * MSK_TX_RING_CNT); @@ -834,6 +864,12 @@ msk_discard_rxbuf(struct msk_if_softc *s struct msk_rxdesc *rxd; struct mbuf *m; +#ifdef MSK_64BIT_DMA + rxd = &sc_if->msk_cdata.msk_rxdesc[idx]; + rx_le = rxd->rx_le; + rx_le->msk_control = htole32(OP_ADDR64 | HW_OWNER); + MSK_INC(idx, MSK_RX_RING_CNT); +#endif rxd = &sc_if->msk_cdata.msk_rxdesc[idx]; m = rxd->rx_m; rx_le = rxd->rx_le; @@ -847,6 +883,12 @@ msk_discard_jumbo_rxbuf(struct msk_if_so struct msk_rxdesc *rxd; struct mbuf *m; +#ifdef MSK_64BIT_DMA + rxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[idx]; + rx_le = rxd->rx_le; + rx_le->msk_control = htole32(OP_ADDR64 | HW_OWNER); + MSK_INC(idx, MSK_JUMBO_RX_RING_CNT); +#endif rxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[idx]; m = rxd->rx_m; rx_le = rxd->rx_le; @@ -884,10 +926,18 @@ msk_newbuf(struct msk_if_softc *sc_if, i KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); rxd = &sc_if->msk_cdata.msk_rxdesc[idx]; +#ifdef MSK_64BIT_DMA + rx_le = rxd->rx_le; + rx_le->msk_addr = htole32(MSK_ADDR_HI(segs[0].ds_addr)); + rx_le->msk_control = htole32(OP_ADDR64 | HW_OWNER); + MSK_INC(idx, MSK_RX_RING_CNT); + rxd = &sc_if->msk_cdata.msk_rxdesc[idx]; +#endif if (rxd->rx_m != NULL) { bus_dmamap_sync(sc_if->msk_cdata.msk_rx_tag, rxd->rx_dmamap, BUS_DMASYNC_POSTREAD); bus_dmamap_unload(sc_if->msk_cdata.msk_rx_tag, rxd->rx_dmamap); + rxd->rx_m = NULL; } map = rxd->rx_dmamap; rxd->rx_dmamap = sc_if->msk_cdata.msk_rx_sparemap; @@ -937,11 +987,19 @@ msk_jumbo_newbuf(struct msk_if_softc *sc KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); rxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[idx]; +#ifdef MSK_64BIT_DMA + rx_le = rxd->rx_le; + rx_le->msk_addr = htole32(MSK_ADDR_HI(segs[0].ds_addr)); + rx_le->msk_control = htole32(OP_ADDR64 | HW_OWNER); + MSK_INC(idx, MSK_JUMBO_RX_RING_CNT); + rxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[idx]; +#endif if (rxd->rx_m != NULL) { bus_dmamap_sync(sc_if->msk_cdata.msk_jumbo_rx_tag, rxd->rx_dmamap, BUS_DMASYNC_POSTREAD); bus_dmamap_unload(sc_if->msk_cdata.msk_jumbo_rx_tag, rxd->rx_dmamap); + rxd->rx_m = NULL; } map = rxd->rx_dmamap; rxd->rx_dmamap = sc_if->msk_cdata.msk_jumbo_rx_sparemap; @@ -1472,7 +1530,7 @@ mskc_reset(struct msk_softc *sc) /* Clear status list. */ bzero(sc->msk_stat_ring, - sizeof(struct msk_stat_desc) * MSK_STAT_RING_CNT); + sizeof(struct msk_stat_desc) * sc->msk_stat_count); sc->msk_stat_cons = 0; bus_dmamap_sync(sc->msk_stat_tag, sc->msk_stat_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); @@ -1483,7 +1541,7 @@ mskc_reset(struct msk_softc *sc) CSR_WRITE_4(sc, STAT_LIST_ADDR_LO, MSK_ADDR_LO(addr)); CSR_WRITE_4(sc, STAT_LIST_ADDR_HI, MSK_ADDR_HI(addr)); /* Set the status list last index. */ - CSR_WRITE_2(sc, STAT_LAST_IDX, MSK_STAT_RING_CNT - 1); + CSR_WRITE_2(sc, STAT_LAST_IDX, sc->msk_stat_count - 1); if (sc->msk_hw_id == CHIP_ID_YUKON_EC && sc->msk_hw_rev == CHIP_REV_YU_EC_A1) { /* WA for dev. #4.3 */ @@ -2084,17 +2142,29 @@ static int msk_status_dma_alloc(struct msk_softc *sc) { struct msk_dmamap_arg ctx; - int error; + bus_size_t stat_sz; + int count, error; + /* + * It seems controller requires number of status LE entries + * is power of 2 and the maximum number of status LE entries + * is 4096. For dual-port controllers, the number of status + * LE entries should be large enough to hold both port's + * status updates. + */ + count = 3 * MSK_RX_RING_CNT + MSK_TX_RING_CNT; + count = imin(4096, roundup2(count, 1024)); + sc->msk_stat_count = count; + stat_sz = count * sizeof(struct msk_stat_desc); error = bus_dma_tag_create( bus_get_dma_tag(sc->msk_dev), /* parent */ MSK_STAT_ALIGN, 0, /* alignment, boundary */ BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ - MSK_STAT_RING_SZ, /* maxsize */ + stat_sz, /* maxsize */ 1, /* nsegments */ - MSK_STAT_RING_SZ, /* maxsegsize */ + stat_sz, /* maxsegsize */ 0, /* flags */ NULL, NULL, /* lockfunc, lockarg */ &sc->msk_stat_tag); @@ -2115,9 +2185,8 @@ msk_status_dma_alloc(struct msk_softc *s } ctx.msk_busaddr = 0; - error = bus_dmamap_load(sc->msk_stat_tag, - sc->msk_stat_map, sc->msk_stat_ring, MSK_STAT_RING_SZ, - msk_dmamap_cb, &ctx, 0); + error = bus_dmamap_load(sc->msk_stat_tag, sc->msk_stat_map, + sc->msk_stat_ring, stat_sz, msk_dmamap_cb, &ctx, BUS_DMA_NOWAIT); if (error != 0) { device_printf(sc->msk_dev, "failed to load DMA'able memory for status ring\n"); @@ -2158,27 +2227,10 @@ msk_txrx_dma_alloc(struct msk_if_softc * int error, i; /* Create parent DMA tag. */ - /* - * XXX - * It seems that Yukon II supports full 64bits DMA operations. But - * it needs two descriptors(list elements) for 64bits DMA operations. - * Since we don't know what DMA address mappings(32bits or 64bits) - * would be used in advance for each mbufs, we limits its DMA space - * to be in range of 32bits address space. Otherwise, we should check - * what DMA address is used and chain another descriptor for the - * 64bits DMA operation. This also means descriptor ring size is - * variable. Limiting DMA address to be in 32bit address space greatly - * simplifies descriptor handling and possibly would increase - * performance a bit due to efficient handling of descriptors. - * Apart from harassing checksum offloading mechanisms, it seems - * it's really bad idea to use a separate descriptor for 64bit - * DMA operation to save small descriptor memory. Anyway, I've - * never seen these exotic scheme on ethernet interface hardware. - */ error = bus_dma_tag_create( bus_get_dma_tag(sc_if->msk_if_dev), /* parent */ 1, 0, /* alignment, boundary */ - BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ + BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ BUS_SPACE_MAXSIZE_32BIT, /* maxsize */ @@ -2284,7 +2336,7 @@ msk_txrx_dma_alloc(struct msk_if_softc * ctx.msk_busaddr = 0; error = bus_dmamap_load(sc_if->msk_cdata.msk_tx_ring_tag, sc_if->msk_cdata.msk_tx_ring_map, sc_if->msk_rdata.msk_tx_ring, - MSK_TX_RING_SZ, msk_dmamap_cb, &ctx, 0); + MSK_TX_RING_SZ, msk_dmamap_cb, &ctx, BUS_DMA_NOWAIT); if (error != 0) { device_printf(sc_if->msk_if_dev, "failed to load DMA'able memory for Tx ring\n"); @@ -2305,7 +2357,7 @@ msk_txrx_dma_alloc(struct msk_if_softc * ctx.msk_busaddr = 0; error = bus_dmamap_load(sc_if->msk_cdata.msk_rx_ring_tag, sc_if->msk_cdata.msk_rx_ring_map, sc_if->msk_rdata.msk_rx_ring, - MSK_RX_RING_SZ, msk_dmamap_cb, &ctx, 0); + MSK_RX_RING_SZ, msk_dmamap_cb, &ctx, BUS_DMA_NOWAIT); if (error != 0) { device_printf(sc_if->msk_if_dev, "failed to load DMA'able memory for Rx ring\n"); @@ -2422,7 +2474,7 @@ msk_rx_dma_jalloc(struct msk_if_softc *s error = bus_dmamap_load(sc_if->msk_cdata.msk_jumbo_rx_ring_tag, sc_if->msk_cdata.msk_jumbo_rx_ring_map, sc_if->msk_rdata.msk_jumbo_rx_ring, MSK_JUMBO_RX_RING_SZ, - msk_dmamap_cb, &ctx, 0); + msk_dmamap_cb, &ctx, BUS_DMA_NOWAIT); if (error != 0) { device_printf(sc_if->msk_if_dev, "failed to load DMA'able memory for jumbo Rx ring\n"); @@ -2782,6 +2834,18 @@ msk_encap(struct msk_if_softc *sc_if, st } } +#ifdef MSK_64BIT_DMA + if (MSK_ADDR_HI(txsegs[0].ds_addr) != + sc_if->msk_cdata.msk_tx_high_addr) { + sc_if->msk_cdata.msk_tx_high_addr = + MSK_ADDR_HI(txsegs[0].ds_addr); + tx_le = &sc_if->msk_rdata.msk_tx_ring[prod]; + tx_le->msk_addr = htole32(MSK_ADDR_HI(txsegs[0].ds_addr)); + tx_le->msk_control = htole32(OP_ADDR64 | HW_OWNER); + sc_if->msk_cdata.msk_tx_cnt++; + MSK_INC(prod, MSK_TX_RING_CNT); + } +#endif si = prod; tx_le = &sc_if->msk_rdata.msk_tx_ring[prod]; tx_le->msk_addr = htole32(MSK_ADDR_LO(txsegs[0].ds_addr)); @@ -2796,6 +2860,20 @@ msk_encap(struct msk_if_softc *sc_if, st for (i = 1; i < nseg; i++) { tx_le = &sc_if->msk_rdata.msk_tx_ring[prod]; +#ifdef MSK_64BIT_DMA + if (MSK_ADDR_HI(txsegs[i].ds_addr) != + sc_if->msk_cdata.msk_tx_high_addr) { + sc_if->msk_cdata.msk_tx_high_addr = + MSK_ADDR_HI(txsegs[i].ds_addr); + tx_le = &sc_if->msk_rdata.msk_tx_ring[prod]; + tx_le->msk_addr = + htole32(MSK_ADDR_HI(txsegs[i].ds_addr)); + tx_le->msk_control = htole32(OP_ADDR64 | HW_OWNER); + sc_if->msk_cdata.msk_tx_cnt++; + MSK_INC(prod, MSK_TX_RING_CNT); + tx_le = &sc_if->msk_rdata.msk_tx_ring[prod]; + } +#endif tx_le->msk_addr = htole32(MSK_ADDR_LO(txsegs[i].ds_addr)); tx_le->msk_control = htole32(txsegs[i].ds_len | control | OP_BUFFER | HW_OWNER); @@ -3148,7 +3226,12 @@ msk_rxeof(struct msk_if_softc *sc_if, ui msk_discard_rxbuf(sc_if, cons); break; } +#ifdef MSK_64BIT_DMA + rxd = &sc_if->msk_cdata.msk_rxdesc[(cons + 1) % + MSK_RX_RING_CNT]; +#else rxd = &sc_if->msk_cdata.msk_rxdesc[cons]; +#endif m = rxd->rx_m; if (msk_newbuf(sc_if, cons) != 0) { ifp->if_iqdrops++; @@ -3176,8 +3259,8 @@ msk_rxeof(struct msk_if_softc *sc_if, ui MSK_IF_LOCK(sc_if); } while (0); - MSK_INC(sc_if->msk_cdata.msk_rx_cons, MSK_RX_RING_CNT); - MSK_INC(sc_if->msk_cdata.msk_rx_prod, MSK_RX_RING_CNT); + MSK_RX_INC(sc_if->msk_cdata.msk_rx_cons, MSK_RX_RING_CNT); + MSK_RX_INC(sc_if->msk_cdata.msk_rx_prod, MSK_RX_RING_CNT); } static void @@ -3208,7 +3291,12 @@ msk_jumbo_rxeof(struct msk_if_softc *sc_ msk_discard_jumbo_rxbuf(sc_if, cons); break; } +#ifdef MSK_64BIT_DMA + jrxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[(cons + 1) % + MSK_JUMBO_RX_RING_CNT]; +#else jrxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[cons]; +#endif m = jrxd->rx_m; if (msk_jumbo_newbuf(sc_if, cons) != 0) { ifp->if_iqdrops++; @@ -3236,8 +3324,8 @@ msk_jumbo_rxeof(struct msk_if_softc *sc_ MSK_IF_LOCK(sc_if); } while (0); - MSK_INC(sc_if->msk_cdata.msk_rx_cons, MSK_JUMBO_RX_RING_CNT); - MSK_INC(sc_if->msk_cdata.msk_rx_prod, MSK_JUMBO_RX_RING_CNT); + MSK_RX_INC(sc_if->msk_cdata.msk_rx_cons, MSK_JUMBO_RX_RING_CNT); + MSK_RX_INC(sc_if->msk_cdata.msk_rx_prod, MSK_JUMBO_RX_RING_CNT); } static void @@ -3582,7 +3670,7 @@ msk_handle_events(struct msk_softc *sc) control & STLE_OP_MASK); break; } - MSK_INC(cons, MSK_STAT_RING_CNT); + MSK_INC(cons, sc->msk_stat_count); if (rxprog > sc->msk_process_limit) break; } Modified: stable/8/sys/dev/msk/if_mskreg.h ============================================================================== --- stable/8/sys/dev/msk/if_mskreg.h Wed Jan 4 21:50:59 2012 (r229524) +++ stable/8/sys/dev/msk/if_mskreg.h Wed Jan 4 21:52:56 2012 (r229525) @@ -2315,35 +2315,48 @@ struct msk_stat_desc { #define BMU_UDP_CHECK (0x57<<16) /* Descr with UDP ext (YUKON only) */ #define BMU_BBC 0xffff /* Bit 15.. 0: Buffer Byte Counter */ +/* + * Controller requires an additional LE op code for 64bit DMA operation. + * Driver uses fixed number of RX buffers such that this limitation + * reduces number of available RX buffers with 64bit DMA so double + * number of RX buffers on platforms that support 64bit DMA. For TX + * side, controller requires an additional OP_ADDR64 op code if a TX + * buffer uses different high address value than previously used one. + * Driver monitors high DMA address change in TX and inserts an + * OP_ADDR64 op code if the high DMA address is changed. Driver + * allocates 50% more total TX buffers on platforms that support 64bit + * DMA. + */ +#if (BUS_SPACE_MAXADDR > 0xFFFFFFFF) +#define MSK_64BIT_DMA +#define MSK_TX_RING_CNT 384 +#define MSK_RX_RING_CNT 512 +#else +#undef MSK_64BIT_DMA #define MSK_TX_RING_CNT 256 #define MSK_RX_RING_CNT 256 +#endif #define MSK_RX_BUF_ALIGN 8 #define MSK_JUMBO_RX_RING_CNT MSK_RX_RING_CNT -#define MSK_STAT_RING_CNT ((1 + 3) * (MSK_TX_RING_CNT + MSK_RX_RING_CNT)) #define MSK_MAXTXSEGS 32 #define MSK_TSO_MAXSGSIZE 4096 #define MSK_TSO_MAXSIZE (65535 + sizeof(struct ether_vlan_header)) /* - * It seems that the hardware requires extra decriptors(LEs) to offload - * TCP/UDP checksum, VLAN hardware tag inserstion and TSO. + * It seems that the hardware requires extra descriptors(LEs) to offload + * TCP/UDP checksum, VLAN hardware tag insertion and TSO. * * 1 descriptor for TCP/UDP checksum offload. * 1 descriptor VLAN hardware tag insertion. * 1 descriptor for TSO(TCP Segmentation Offload) - * 1 descriptor for 64bits DMA : Not applicatable due to the use of - * BUS_SPACE_MAXADDR_32BIT in parent DMA tag creation. + * 1 descriptor for each 64bits DMA transfers */ +#ifdef MSK_64BIT_DMA +#define MSK_RESERVED_TX_DESC_CNT (MSK_MAXTXSEGS + 3) +#else #define MSK_RESERVED_TX_DESC_CNT 3 +#endif -/* - * Jumbo buffer stuff. Note that we must allocate more jumbo - * buffers than there are descriptors in the receive ring. This - * is because we don't know how long it will take for a packet - * to be released after we hand it off to the upper protocol - * layers. To be safe, we allocate 1.5 times the number of - * receive descriptors. - */ #define MSK_JUMBO_FRAMELEN 9022 #define MSK_JUMBO_MTU (MSK_JUMBO_FRAMELEN-ETHER_HDR_LEN-ETHER_CRC_LEN) #define MSK_MAX_FRAMELEN \ @@ -2380,6 +2393,7 @@ struct msk_chain_data { bus_dmamap_t msk_jumbo_rx_sparemap; uint16_t msk_tso_mtu; uint32_t msk_last_csum; + uint32_t msk_tx_high_addr; int msk_tx_prod; int msk_tx_cons; int msk_tx_cnt; @@ -2411,10 +2425,17 @@ struct msk_ring_data { (sizeof(struct msk_rx_desc) * MSK_RX_RING_CNT) #define MSK_JUMBO_RX_RING_SZ \ (sizeof(struct msk_rx_desc) * MSK_JUMBO_RX_RING_CNT) -#define MSK_STAT_RING_SZ \ - (sizeof(struct msk_stat_desc) * MSK_STAT_RING_CNT) #define MSK_INC(x, y) (x) = (x + 1) % y +#ifdef MSK_64BIT_DMA +#define MSK_RX_INC(x, y) (x) = (x + 2) % y +#define MSK_RX_BUF_CNT (MSK_RX_RING_CNT / 2) +#define MSK_JUMBO_RX_BUF_CNT (MSK_JUMBO_RX_RING_CNT / 2) +#else +#define MSK_RX_INC(x, y) (x) = (x + 1) % y +#define MSK_RX_BUF_CNT MSK_RX_RING_CNT +#define MSK_JUMBO_RX_BUF_CNT MSK_JUMBO_RX_RING_CNT +#endif #define MSK_PCI_BUS 0 #define MSK_PCIX_BUS 1 @@ -2519,6 +2540,7 @@ struct msk_softc { int msk_int_holdoff; int msk_process_limit; int msk_stat_cons; + int msk_stat_count; struct mtx msk_mtx; }; From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 21:54:20 2012 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 546EA106566C; Wed, 4 Jan 2012 21:54:20 +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 416E58FC13; Wed, 4 Jan 2012 21:54:20 +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 q04LsKQK098080; Wed, 4 Jan 2012 21:54:20 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04LsKud098076; Wed, 4 Jan 2012 21:54:20 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201042154.q04LsKud098076@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 4 Jan 2012 21:54:20 +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: r229526 - stable/7/sys/dev/msk 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, 04 Jan 2012 21:54:20 -0000 Author: yongari Date: Wed Jan 4 21:54:20 2012 New Revision: 229526 URL: http://svn.freebsd.org/changeset/base/229526 Log: MFC r227582: Enable 64bit DMA addressing support for all msk(4) controllers. Unnecessarily complex LE format used on Marvell controller was main reason not to enable 64bit DMA addressing in driver. If high 32bit address of DMA address of TX/RX buffer is changed, driver has to generate a new LE. In TX path, driver will keep track of lastly used high 32bit address of DMA address and generate a new LE whenever it sees high address change in the DMA address. In RX path, driver will always use two LEs to specify 64bit DMA address of RX buffer. If the high 32bit address of DMA address of RX buffer is the same as previous DMA address of RX buffer, driver does not have to use two LEs but driver will use two LEs for simplicity in RX ring management. One of draw back for switching to 64bit DMA addressing is that the large amount of LEs are used to specify 64bit DMA address such that number of available LEs for TX/RX buffers are considerably reduced. To mitigate the issue, increase number of available LEs from 256 to 384 for TX and from 256 to 512 for RX. For 32bit architectures, msk(4) does not use 64bit DMA addressing to save resources. Modified: stable/7/sys/dev/msk/if_msk.c stable/7/sys/dev/msk/if_mskreg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/msk/if_msk.c ============================================================================== --- stable/7/sys/dev/msk/if_msk.c Wed Jan 4 21:52:56 2012 (r229525) +++ stable/7/sys/dev/msk/if_msk.c Wed Jan 4 21:54:20 2012 (r229526) @@ -700,7 +700,7 @@ msk_init_rx_ring(struct msk_if_softc *sc { struct msk_ring_data *rd; struct msk_rxdesc *rxd; - int i, prod; + int i, nbuf, prod; MSK_IF_LOCK_ASSERT(sc_if); @@ -710,11 +710,18 @@ msk_init_rx_ring(struct msk_if_softc *sc rd = &sc_if->msk_rdata; bzero(rd->msk_rx_ring, sizeof(struct msk_rx_desc) * MSK_RX_RING_CNT); - prod = sc_if->msk_cdata.msk_rx_prod; - i = 0; + for (i = prod = 0; i < MSK_RX_RING_CNT; i++) { + rxd = &sc_if->msk_cdata.msk_rxdesc[prod]; + rxd->rx_m = NULL; + rxd->rx_le = &rd->msk_rx_ring[prod]; + MSK_INC(prod, MSK_RX_RING_CNT); + } + nbuf = MSK_RX_BUF_CNT; + prod = 0; /* Have controller know how to compute Rx checksum. */ if ((sc_if->msk_flags & MSK_FLAG_DESCV2) == 0 && (sc_if->msk_ifp->if_capenable & IFCAP_RXCSUM) != 0) { +#ifdef MSK_64BIT_DMA rxd = &sc_if->msk_cdata.msk_rxdesc[prod]; rxd->rx_m = NULL; rxd->rx_le = &rd->msk_rx_ring[prod]; @@ -723,15 +730,21 @@ msk_init_rx_ring(struct msk_if_softc *sc rxd->rx_le->msk_control = htole32(OP_TCPSTART | HW_OWNER); MSK_INC(prod, MSK_RX_RING_CNT); MSK_INC(sc_if->msk_cdata.msk_rx_cons, MSK_RX_RING_CNT); - i++; - } - for (; i < MSK_RX_RING_CNT; i++) { +#endif rxd = &sc_if->msk_cdata.msk_rxdesc[prod]; rxd->rx_m = NULL; rxd->rx_le = &rd->msk_rx_ring[prod]; + rxd->rx_le->msk_addr = htole32(ETHER_HDR_LEN << 16 | + ETHER_HDR_LEN); + rxd->rx_le->msk_control = htole32(OP_TCPSTART | HW_OWNER); + MSK_INC(prod, MSK_RX_RING_CNT); + MSK_INC(sc_if->msk_cdata.msk_rx_cons, MSK_RX_RING_CNT); + nbuf--; + } + for (i = 0; i < nbuf; i++) { if (msk_newbuf(sc_if, prod) != 0) return (ENOBUFS); - MSK_INC(prod, MSK_RX_RING_CNT); + MSK_RX_INC(prod, MSK_RX_RING_CNT); } bus_dmamap_sync(sc_if->msk_cdata.msk_rx_ring_tag, @@ -739,10 +752,11 @@ msk_init_rx_ring(struct msk_if_softc *sc BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); /* Update prefetch unit. */ - sc_if->msk_cdata.msk_rx_prod = MSK_RX_RING_CNT - 1; + sc_if->msk_cdata.msk_rx_prod = prod; CSR_WRITE_2(sc_if->msk_softc, Y2_PREF_Q_ADDR(sc_if->msk_rxq, PREF_UNIT_PUT_IDX_REG), - sc_if->msk_cdata.msk_rx_prod); + (sc_if->msk_cdata.msk_rx_prod + MSK_RX_RING_CNT - 1) % + MSK_RX_RING_CNT); if (msk_rx_fill(sc_if, 0) != 0) return (ENOBUFS); return (0); @@ -753,7 +767,7 @@ msk_init_jumbo_rx_ring(struct msk_if_sof { struct msk_ring_data *rd; struct msk_rxdesc *rxd; - int i, prod; + int i, nbuf, prod; MSK_IF_LOCK_ASSERT(sc_if); @@ -764,11 +778,18 @@ msk_init_jumbo_rx_ring(struct msk_if_sof rd = &sc_if->msk_rdata; bzero(rd->msk_jumbo_rx_ring, sizeof(struct msk_rx_desc) * MSK_JUMBO_RX_RING_CNT); - prod = sc_if->msk_cdata.msk_rx_prod; - i = 0; + for (i = prod = 0; i < MSK_JUMBO_RX_RING_CNT; i++) { + rxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[prod]; + rxd->rx_m = NULL; + rxd->rx_le = &rd->msk_jumbo_rx_ring[prod]; + MSK_INC(prod, MSK_JUMBO_RX_RING_CNT); + } + nbuf = MSK_RX_BUF_CNT; + prod = 0; /* Have controller know how to compute Rx checksum. */ if ((sc_if->msk_flags & MSK_FLAG_DESCV2) == 0 && (sc_if->msk_ifp->if_capenable & IFCAP_RXCSUM) != 0) { +#ifdef MSK_64BIT_DMA rxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[prod]; rxd->rx_m = NULL; rxd->rx_le = &rd->msk_jumbo_rx_ring[prod]; @@ -777,25 +798,33 @@ msk_init_jumbo_rx_ring(struct msk_if_sof rxd->rx_le->msk_control = htole32(OP_TCPSTART | HW_OWNER); MSK_INC(prod, MSK_JUMBO_RX_RING_CNT); MSK_INC(sc_if->msk_cdata.msk_rx_cons, MSK_JUMBO_RX_RING_CNT); - i++; - } - for (; i < MSK_JUMBO_RX_RING_CNT; i++) { +#endif rxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[prod]; rxd->rx_m = NULL; rxd->rx_le = &rd->msk_jumbo_rx_ring[prod]; + rxd->rx_le->msk_addr = htole32(ETHER_HDR_LEN << 16 | + ETHER_HDR_LEN); + rxd->rx_le->msk_control = htole32(OP_TCPSTART | HW_OWNER); + MSK_INC(prod, MSK_JUMBO_RX_RING_CNT); + MSK_INC(sc_if->msk_cdata.msk_rx_cons, MSK_JUMBO_RX_RING_CNT); + nbuf--; + } + for (i = 0; i < nbuf; i++) { if (msk_jumbo_newbuf(sc_if, prod) != 0) return (ENOBUFS); - MSK_INC(prod, MSK_JUMBO_RX_RING_CNT); + MSK_RX_INC(prod, MSK_JUMBO_RX_RING_CNT); } bus_dmamap_sync(sc_if->msk_cdata.msk_jumbo_rx_ring_tag, sc_if->msk_cdata.msk_jumbo_rx_ring_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); - sc_if->msk_cdata.msk_rx_prod = MSK_JUMBO_RX_RING_CNT - 1; + /* Update prefetch unit. */ + sc_if->msk_cdata.msk_rx_prod = prod; CSR_WRITE_2(sc_if->msk_softc, Y2_PREF_Q_ADDR(sc_if->msk_rxq, PREF_UNIT_PUT_IDX_REG), - sc_if->msk_cdata.msk_rx_prod); + (sc_if->msk_cdata.msk_rx_prod + MSK_JUMBO_RX_RING_CNT - 1) % + MSK_JUMBO_RX_RING_CNT); if (msk_rx_fill(sc_if, 1) != 0) return (ENOBUFS); return (0); @@ -813,6 +842,7 @@ msk_init_tx_ring(struct msk_if_softc *sc sc_if->msk_cdata.msk_tx_prod = 0; sc_if->msk_cdata.msk_tx_cons = 0; sc_if->msk_cdata.msk_tx_cnt = 0; + sc_if->msk_cdata.msk_tx_high_addr = 0; rd = &sc_if->msk_rdata; bzero(rd->msk_tx_ring, sizeof(struct msk_tx_desc) * MSK_TX_RING_CNT); @@ -834,6 +864,12 @@ msk_discard_rxbuf(struct msk_if_softc *s struct msk_rxdesc *rxd; struct mbuf *m; +#ifdef MSK_64BIT_DMA + rxd = &sc_if->msk_cdata.msk_rxdesc[idx]; + rx_le = rxd->rx_le; + rx_le->msk_control = htole32(OP_ADDR64 | HW_OWNER); + MSK_INC(idx, MSK_RX_RING_CNT); +#endif rxd = &sc_if->msk_cdata.msk_rxdesc[idx]; m = rxd->rx_m; rx_le = rxd->rx_le; @@ -847,6 +883,12 @@ msk_discard_jumbo_rxbuf(struct msk_if_so struct msk_rxdesc *rxd; struct mbuf *m; +#ifdef MSK_64BIT_DMA + rxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[idx]; + rx_le = rxd->rx_le; + rx_le->msk_control = htole32(OP_ADDR64 | HW_OWNER); + MSK_INC(idx, MSK_JUMBO_RX_RING_CNT); +#endif rxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[idx]; m = rxd->rx_m; rx_le = rxd->rx_le; @@ -884,10 +926,18 @@ msk_newbuf(struct msk_if_softc *sc_if, i KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); rxd = &sc_if->msk_cdata.msk_rxdesc[idx]; +#ifdef MSK_64BIT_DMA + rx_le = rxd->rx_le; + rx_le->msk_addr = htole32(MSK_ADDR_HI(segs[0].ds_addr)); + rx_le->msk_control = htole32(OP_ADDR64 | HW_OWNER); + MSK_INC(idx, MSK_RX_RING_CNT); + rxd = &sc_if->msk_cdata.msk_rxdesc[idx]; +#endif if (rxd->rx_m != NULL) { bus_dmamap_sync(sc_if->msk_cdata.msk_rx_tag, rxd->rx_dmamap, BUS_DMASYNC_POSTREAD); bus_dmamap_unload(sc_if->msk_cdata.msk_rx_tag, rxd->rx_dmamap); + rxd->rx_m = NULL; } map = rxd->rx_dmamap; rxd->rx_dmamap = sc_if->msk_cdata.msk_rx_sparemap; @@ -937,11 +987,19 @@ msk_jumbo_newbuf(struct msk_if_softc *sc KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); rxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[idx]; +#ifdef MSK_64BIT_DMA + rx_le = rxd->rx_le; + rx_le->msk_addr = htole32(MSK_ADDR_HI(segs[0].ds_addr)); + rx_le->msk_control = htole32(OP_ADDR64 | HW_OWNER); + MSK_INC(idx, MSK_JUMBO_RX_RING_CNT); + rxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[idx]; +#endif if (rxd->rx_m != NULL) { bus_dmamap_sync(sc_if->msk_cdata.msk_jumbo_rx_tag, rxd->rx_dmamap, BUS_DMASYNC_POSTREAD); bus_dmamap_unload(sc_if->msk_cdata.msk_jumbo_rx_tag, rxd->rx_dmamap); + rxd->rx_m = NULL; } map = rxd->rx_dmamap; rxd->rx_dmamap = sc_if->msk_cdata.msk_jumbo_rx_sparemap; @@ -1472,7 +1530,7 @@ mskc_reset(struct msk_softc *sc) /* Clear status list. */ bzero(sc->msk_stat_ring, - sizeof(struct msk_stat_desc) * MSK_STAT_RING_CNT); + sizeof(struct msk_stat_desc) * sc->msk_stat_count); sc->msk_stat_cons = 0; bus_dmamap_sync(sc->msk_stat_tag, sc->msk_stat_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); @@ -1483,7 +1541,7 @@ mskc_reset(struct msk_softc *sc) CSR_WRITE_4(sc, STAT_LIST_ADDR_LO, MSK_ADDR_LO(addr)); CSR_WRITE_4(sc, STAT_LIST_ADDR_HI, MSK_ADDR_HI(addr)); /* Set the status list last index. */ - CSR_WRITE_2(sc, STAT_LAST_IDX, MSK_STAT_RING_CNT - 1); + CSR_WRITE_2(sc, STAT_LAST_IDX, sc->msk_stat_count - 1); if (sc->msk_hw_id == CHIP_ID_YUKON_EC && sc->msk_hw_rev == CHIP_REV_YU_EC_A1) { /* WA for dev. #4.3 */ @@ -2084,17 +2142,29 @@ static int msk_status_dma_alloc(struct msk_softc *sc) { struct msk_dmamap_arg ctx; - int error; + bus_size_t stat_sz; + int count, error; + /* + * It seems controller requires number of status LE entries + * is power of 2 and the maximum number of status LE entries + * is 4096. For dual-port controllers, the number of status + * LE entries should be large enough to hold both port's + * status updates. + */ + count = 3 * MSK_RX_RING_CNT + MSK_TX_RING_CNT; + count = imin(4096, roundup2(count, 1024)); + sc->msk_stat_count = count; + stat_sz = count * sizeof(struct msk_stat_desc); error = bus_dma_tag_create( bus_get_dma_tag(sc->msk_dev), /* parent */ MSK_STAT_ALIGN, 0, /* alignment, boundary */ BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ - MSK_STAT_RING_SZ, /* maxsize */ + stat_sz, /* maxsize */ 1, /* nsegments */ - MSK_STAT_RING_SZ, /* maxsegsize */ + stat_sz, /* maxsegsize */ 0, /* flags */ NULL, NULL, /* lockfunc, lockarg */ &sc->msk_stat_tag); @@ -2115,9 +2185,8 @@ msk_status_dma_alloc(struct msk_softc *s } ctx.msk_busaddr = 0; - error = bus_dmamap_load(sc->msk_stat_tag, - sc->msk_stat_map, sc->msk_stat_ring, MSK_STAT_RING_SZ, - msk_dmamap_cb, &ctx, 0); + error = bus_dmamap_load(sc->msk_stat_tag, sc->msk_stat_map, + sc->msk_stat_ring, stat_sz, msk_dmamap_cb, &ctx, BUS_DMA_NOWAIT); if (error != 0) { device_printf(sc->msk_dev, "failed to load DMA'able memory for status ring\n"); @@ -2158,27 +2227,10 @@ msk_txrx_dma_alloc(struct msk_if_softc * int error, i; /* Create parent DMA tag. */ - /* - * XXX - * It seems that Yukon II supports full 64bits DMA operations. But - * it needs two descriptors(list elements) for 64bits DMA operations. - * Since we don't know what DMA address mappings(32bits or 64bits) - * would be used in advance for each mbufs, we limits its DMA space - * to be in range of 32bits address space. Otherwise, we should check - * what DMA address is used and chain another descriptor for the - * 64bits DMA operation. This also means descriptor ring size is - * variable. Limiting DMA address to be in 32bit address space greatly - * simplyfies descriptor handling and possibly would increase - * performance a bit due to efficient handling of descriptors. - * Apart from harassing checksum offloading mechanisms, it seems - * it's really bad idea to use a seperate descriptor for 64bit - * DMA operation to save small descriptor memory. Anyway, I've - * never seen these exotic scheme on ethernet interface hardware. - */ error = bus_dma_tag_create( bus_get_dma_tag(sc_if->msk_if_dev), /* parent */ 1, 0, /* alignment, boundary */ - BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ + BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ BUS_SPACE_MAXSIZE_32BIT, /* maxsize */ @@ -2284,7 +2336,7 @@ msk_txrx_dma_alloc(struct msk_if_softc * ctx.msk_busaddr = 0; error = bus_dmamap_load(sc_if->msk_cdata.msk_tx_ring_tag, sc_if->msk_cdata.msk_tx_ring_map, sc_if->msk_rdata.msk_tx_ring, - MSK_TX_RING_SZ, msk_dmamap_cb, &ctx, 0); + MSK_TX_RING_SZ, msk_dmamap_cb, &ctx, BUS_DMA_NOWAIT); if (error != 0) { device_printf(sc_if->msk_if_dev, "failed to load DMA'able memory for Tx ring\n"); @@ -2305,7 +2357,7 @@ msk_txrx_dma_alloc(struct msk_if_softc * ctx.msk_busaddr = 0; error = bus_dmamap_load(sc_if->msk_cdata.msk_rx_ring_tag, sc_if->msk_cdata.msk_rx_ring_map, sc_if->msk_rdata.msk_rx_ring, - MSK_RX_RING_SZ, msk_dmamap_cb, &ctx, 0); + MSK_RX_RING_SZ, msk_dmamap_cb, &ctx, BUS_DMA_NOWAIT); if (error != 0) { device_printf(sc_if->msk_if_dev, "failed to load DMA'able memory for Rx ring\n"); @@ -2422,7 +2474,7 @@ msk_rx_dma_jalloc(struct msk_if_softc *s error = bus_dmamap_load(sc_if->msk_cdata.msk_jumbo_rx_ring_tag, sc_if->msk_cdata.msk_jumbo_rx_ring_map, sc_if->msk_rdata.msk_jumbo_rx_ring, MSK_JUMBO_RX_RING_SZ, - msk_dmamap_cb, &ctx, 0); + msk_dmamap_cb, &ctx, BUS_DMA_NOWAIT); if (error != 0) { device_printf(sc_if->msk_if_dev, "failed to load DMA'able memory for jumbo Rx ring\n"); @@ -2782,6 +2834,18 @@ msk_encap(struct msk_if_softc *sc_if, st } } +#ifdef MSK_64BIT_DMA + if (MSK_ADDR_HI(txsegs[0].ds_addr) != + sc_if->msk_cdata.msk_tx_high_addr) { + sc_if->msk_cdata.msk_tx_high_addr = + MSK_ADDR_HI(txsegs[0].ds_addr); + tx_le = &sc_if->msk_rdata.msk_tx_ring[prod]; + tx_le->msk_addr = htole32(MSK_ADDR_HI(txsegs[0].ds_addr)); + tx_le->msk_control = htole32(OP_ADDR64 | HW_OWNER); + sc_if->msk_cdata.msk_tx_cnt++; + MSK_INC(prod, MSK_TX_RING_CNT); + } +#endif si = prod; tx_le = &sc_if->msk_rdata.msk_tx_ring[prod]; tx_le->msk_addr = htole32(MSK_ADDR_LO(txsegs[0].ds_addr)); @@ -2796,6 +2860,20 @@ msk_encap(struct msk_if_softc *sc_if, st for (i = 1; i < nseg; i++) { tx_le = &sc_if->msk_rdata.msk_tx_ring[prod]; +#ifdef MSK_64BIT_DMA + if (MSK_ADDR_HI(txsegs[i].ds_addr) != + sc_if->msk_cdata.msk_tx_high_addr) { + sc_if->msk_cdata.msk_tx_high_addr = + MSK_ADDR_HI(txsegs[i].ds_addr); + tx_le = &sc_if->msk_rdata.msk_tx_ring[prod]; + tx_le->msk_addr = + htole32(MSK_ADDR_HI(txsegs[i].ds_addr)); + tx_le->msk_control = htole32(OP_ADDR64 | HW_OWNER); + sc_if->msk_cdata.msk_tx_cnt++; + MSK_INC(prod, MSK_TX_RING_CNT); + tx_le = &sc_if->msk_rdata.msk_tx_ring[prod]; + } +#endif tx_le->msk_addr = htole32(MSK_ADDR_LO(txsegs[i].ds_addr)); tx_le->msk_control = htole32(txsegs[i].ds_len | control | OP_BUFFER | HW_OWNER); @@ -3148,7 +3226,12 @@ msk_rxeof(struct msk_if_softc *sc_if, ui msk_discard_rxbuf(sc_if, cons); break; } +#ifdef MSK_64BIT_DMA + rxd = &sc_if->msk_cdata.msk_rxdesc[(cons + 1) % + MSK_RX_RING_CNT]; +#else rxd = &sc_if->msk_cdata.msk_rxdesc[cons]; +#endif m = rxd->rx_m; if (msk_newbuf(sc_if, cons) != 0) { ifp->if_iqdrops++; @@ -3176,8 +3259,8 @@ msk_rxeof(struct msk_if_softc *sc_if, ui MSK_IF_LOCK(sc_if); } while (0); - MSK_INC(sc_if->msk_cdata.msk_rx_cons, MSK_RX_RING_CNT); - MSK_INC(sc_if->msk_cdata.msk_rx_prod, MSK_RX_RING_CNT); + MSK_RX_INC(sc_if->msk_cdata.msk_rx_cons, MSK_RX_RING_CNT); + MSK_RX_INC(sc_if->msk_cdata.msk_rx_prod, MSK_RX_RING_CNT); } static void @@ -3208,7 +3291,12 @@ msk_jumbo_rxeof(struct msk_if_softc *sc_ msk_discard_jumbo_rxbuf(sc_if, cons); break; } +#ifdef MSK_64BIT_DMA + jrxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[(cons + 1) % + MSK_JUMBO_RX_RING_CNT]; +#else jrxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[cons]; +#endif m = jrxd->rx_m; if (msk_jumbo_newbuf(sc_if, cons) != 0) { ifp->if_iqdrops++; @@ -3236,8 +3324,8 @@ msk_jumbo_rxeof(struct msk_if_softc *sc_ MSK_IF_LOCK(sc_if); } while (0); - MSK_INC(sc_if->msk_cdata.msk_rx_cons, MSK_JUMBO_RX_RING_CNT); - MSK_INC(sc_if->msk_cdata.msk_rx_prod, MSK_JUMBO_RX_RING_CNT); + MSK_RX_INC(sc_if->msk_cdata.msk_rx_cons, MSK_JUMBO_RX_RING_CNT); + MSK_RX_INC(sc_if->msk_cdata.msk_rx_prod, MSK_JUMBO_RX_RING_CNT); } static void @@ -3582,7 +3670,7 @@ msk_handle_events(struct msk_softc *sc) control & STLE_OP_MASK); break; } - MSK_INC(cons, MSK_STAT_RING_CNT); + MSK_INC(cons, sc->msk_stat_count); if (rxprog > sc->msk_process_limit) break; } Modified: stable/7/sys/dev/msk/if_mskreg.h ============================================================================== --- stable/7/sys/dev/msk/if_mskreg.h Wed Jan 4 21:52:56 2012 (r229525) +++ stable/7/sys/dev/msk/if_mskreg.h Wed Jan 4 21:54:20 2012 (r229526) @@ -2315,35 +2315,48 @@ struct msk_stat_desc { #define BMU_UDP_CHECK (0x57<<16) /* Descr with UDP ext (YUKON only) */ #define BMU_BBC 0xffff /* Bit 15.. 0: Buffer Byte Counter */ +/* + * Controller requires an additional LE op code for 64bit DMA operation. + * Driver uses fixed number of RX buffers such that this limitation + * reduces number of available RX buffers with 64bit DMA so double + * number of RX buffers on platforms that support 64bit DMA. For TX + * side, controller requires an additional OP_ADDR64 op code if a TX + * buffer uses different high address value than previously used one. + * Driver monitors high DMA address change in TX and inserts an + * OP_ADDR64 op code if the high DMA address is changed. Driver + * allocates 50% more total TX buffers on platforms that support 64bit + * DMA. + */ +#if (BUS_SPACE_MAXADDR > 0xFFFFFFFF) +#define MSK_64BIT_DMA +#define MSK_TX_RING_CNT 384 +#define MSK_RX_RING_CNT 512 +#else +#undef MSK_64BIT_DMA #define MSK_TX_RING_CNT 256 #define MSK_RX_RING_CNT 256 +#endif #define MSK_RX_BUF_ALIGN 8 #define MSK_JUMBO_RX_RING_CNT MSK_RX_RING_CNT -#define MSK_STAT_RING_CNT ((1 + 3) * (MSK_TX_RING_CNT + MSK_RX_RING_CNT)) #define MSK_MAXTXSEGS 32 #define MSK_TSO_MAXSGSIZE 4096 #define MSK_TSO_MAXSIZE (65535 + sizeof(struct ether_vlan_header)) /* - * It seems that the hardware requires extra decriptors(LEs) to offload - * TCP/UDP checksum, VLAN hardware tag inserstion and TSO. + * It seems that the hardware requires extra descriptors(LEs) to offload + * TCP/UDP checksum, VLAN hardware tag insertion and TSO. * * 1 descriptor for TCP/UDP checksum offload. * 1 descriptor VLAN hardware tag insertion. * 1 descriptor for TSO(TCP Segmentation Offload) - * 1 descriptor for 64bits DMA : Not applicatable due to the use of - * BUS_SPACE_MAXADDR_32BIT in parent DMA tag creation. + * 1 descriptor for each 64bits DMA transfers */ +#ifdef MSK_64BIT_DMA +#define MSK_RESERVED_TX_DESC_CNT (MSK_MAXTXSEGS + 3) +#else #define MSK_RESERVED_TX_DESC_CNT 3 +#endif -/* - * Jumbo buffer stuff. Note that we must allocate more jumbo - * buffers than there are descriptors in the receive ring. This - * is because we don't know how long it will take for a packet - * to be released after we hand it off to the upper protocol - * layers. To be safe, we allocate 1.5 times the number of - * receive descriptors. - */ #define MSK_JUMBO_FRAMELEN 9022 #define MSK_JUMBO_MTU (MSK_JUMBO_FRAMELEN-ETHER_HDR_LEN-ETHER_CRC_LEN) #define MSK_MAX_FRAMELEN \ @@ -2380,6 +2393,7 @@ struct msk_chain_data { bus_dmamap_t msk_jumbo_rx_sparemap; uint16_t msk_tso_mtu; uint32_t msk_last_csum; + uint32_t msk_tx_high_addr; int msk_tx_prod; int msk_tx_cons; int msk_tx_cnt; @@ -2411,10 +2425,17 @@ struct msk_ring_data { (sizeof(struct msk_rx_desc) * MSK_RX_RING_CNT) #define MSK_JUMBO_RX_RING_SZ \ (sizeof(struct msk_rx_desc) * MSK_JUMBO_RX_RING_CNT) -#define MSK_STAT_RING_SZ \ - (sizeof(struct msk_stat_desc) * MSK_STAT_RING_CNT) #define MSK_INC(x, y) (x) = (x + 1) % y +#ifdef MSK_64BIT_DMA +#define MSK_RX_INC(x, y) (x) = (x + 2) % y +#define MSK_RX_BUF_CNT (MSK_RX_RING_CNT / 2) +#define MSK_JUMBO_RX_BUF_CNT (MSK_JUMBO_RX_RING_CNT / 2) +#else +#define MSK_RX_INC(x, y) (x) = (x + 1) % y +#define MSK_RX_BUF_CNT MSK_RX_RING_CNT +#define MSK_JUMBO_RX_BUF_CNT MSK_JUMBO_RX_RING_CNT +#endif #define MSK_PCI_BUS 0 #define MSK_PCIX_BUS 1 @@ -2519,6 +2540,7 @@ struct msk_softc { int msk_int_holdoff; int msk_process_limit; int msk_stat_cons; + int msk_stat_count; struct mtx msk_mtx; }; From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 21:56:47 2012 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 C58A2106564A; Wed, 4 Jan 2012 21:56:47 +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 B3D898FC1A; Wed, 4 Jan 2012 21:56:47 +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 q04Lul9Y098212; Wed, 4 Jan 2012 21:56:47 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04Luldb098210; Wed, 4 Jan 2012 21:56:47 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201201042156.q04Luldb098210@svn.freebsd.org> From: Christian Brueffer Date: Wed, 4 Jan 2012 21:56:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229527 - stable/9/sbin/dumpfs 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, 04 Jan 2012 21:56:47 -0000 Author: brueffer Date: Wed Jan 4 21:56:47 2012 New Revision: 229527 URL: http://svn.freebsd.org/changeset/base/229527 Log: MFC: r228898 Add missing -l flag to usage(). Modified: stable/9/sbin/dumpfs/dumpfs.c Directory Properties: stable/9/sbin/dumpfs/ (props changed) Modified: stable/9/sbin/dumpfs/dumpfs.c ============================================================================== --- stable/9/sbin/dumpfs/dumpfs.c Wed Jan 4 21:54:20 2012 (r229526) +++ stable/9/sbin/dumpfs/dumpfs.c Wed Jan 4 21:56:47 2012 (r229527) @@ -499,6 +499,6 @@ ufserr(const char *name) void usage(void) { - (void)fprintf(stderr, "usage: dumpfs [-fm] filesys | device\n"); + (void)fprintf(stderr, "usage: dumpfs [-flm] filesys | device\n"); exit(1); } From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 21:57:12 2012 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 1B2761065678; Wed, 4 Jan 2012 21:57:12 +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 09A038FC14; Wed, 4 Jan 2012 21:57:12 +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 q04LvBkL098261; Wed, 4 Jan 2012 21:57:11 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04LvBiO098259; Wed, 4 Jan 2012 21:57:11 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201201042157.q04LvBiO098259@svn.freebsd.org> From: Christian Brueffer Date: Wed, 4 Jan 2012 21:57:11 +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: r229528 - stable/8/sbin/dumpfs 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, 04 Jan 2012 21:57:12 -0000 Author: brueffer Date: Wed Jan 4 21:57:11 2012 New Revision: 229528 URL: http://svn.freebsd.org/changeset/base/229528 Log: MFC: r228898 Add missing -l flag to usage(). Modified: stable/8/sbin/dumpfs/dumpfs.c Directory Properties: stable/8/sbin/dumpfs/ (props changed) Modified: stable/8/sbin/dumpfs/dumpfs.c ============================================================================== --- stable/8/sbin/dumpfs/dumpfs.c Wed Jan 4 21:56:47 2012 (r229527) +++ stable/8/sbin/dumpfs/dumpfs.c Wed Jan 4 21:57:11 2012 (r229528) @@ -495,6 +495,6 @@ ufserr(const char *name) void usage(void) { - (void)fprintf(stderr, "usage: dumpfs [-fm] filesys | device\n"); + (void)fprintf(stderr, "usage: dumpfs [-flm] filesys | device\n"); exit(1); } From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 22:53:18 2012 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 73478106564A; Wed, 4 Jan 2012 22:53:18 +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 60B068FC0A; Wed, 4 Jan 2012 22:53:18 +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 q04MrICJ000459; Wed, 4 Jan 2012 22:53:18 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04MrIQ1000456; Wed, 4 Jan 2012 22:53:18 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201042253.q04MrIQ1000456@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 4 Jan 2012 22:53:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229529 - in stable/9/sys: dev/re pci 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, 04 Jan 2012 22:53:18 -0000 Author: yongari Date: Wed Jan 4 22:53:18 2012 New Revision: 229529 URL: http://svn.freebsd.org/changeset/base/229529 Log: MFC r227587,227590-227591,227593,227638-227639: r227587: Add preliminary support for RTL8402 PCIe FastEthernet with integrated card reader. r227590: Add preliminary support for RTL8411 PCIe Gigabit ethernet with integrated card reader. r227591: Add missing driver lock in SIOCSIFCAP handler. r227593: Disable PCIe ASPM (Active State Power Management) for all controllers. More and more RealTek controllers started to implement EEE feature. Vendor driver seems to load a kind of firmware for EEE with additional PHY fixups. It is known that the EEE feature may need ASPM support. Unfortunately there is no documentation for EEE of the controller so enabling ASPM may cause more problems. r227638: Add preliminary support for second generation RTL8105E PCIe FastEthernet. r227639: Add preliminary support for RTL8168/8111F PCIe Gigabit ethernet. Modified: stable/9/sys/dev/re/if_re.c stable/9/sys/pci/if_rlreg.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/re/if_re.c ============================================================================== --- stable/9/sys/dev/re/if_re.c Wed Jan 4 21:57:11 2012 (r229528) +++ stable/9/sys/dev/re/if_re.c Wed Jan 4 22:53:18 2012 (r229529) @@ -181,7 +181,7 @@ static struct rl_type re_devs[] = { { RT_VENDORID, RT_DEVICEID_8101E, 0, "RealTek 810xE PCIe 10/100baseTX" }, { RT_VENDORID, RT_DEVICEID_8168, 0, - "RealTek 8168/8111 B/C/CP/D/DP/E PCIe Gigabit Ethernet" }, + "RealTek 8168/8111 B/C/CP/D/DP/E/F PCIe Gigabit Ethernet" }, { RT_VENDORID, RT_DEVICEID_8169, 0, "RealTek 8169/8169S/8169SB(L)/8110S/8110SB(L) Gigabit Ethernet" }, { RT_VENDORID, RT_DEVICEID_8169SC, 0, @@ -220,7 +220,9 @@ static struct rl_hwrev re_hwrevs[] = { { RL_HWREV_8102EL_SPIN1, RL_8169, "8102EL", RL_MTU }, { RL_HWREV_8103E, RL_8169, "8103E", RL_MTU }, { RL_HWREV_8401E, RL_8169, "8401E", RL_MTU }, + { RL_HWREV_8402, RL_8169, "8402", RL_MTU }, { RL_HWREV_8105E, RL_8169, "8105E", RL_MTU }, + { RL_HWREV_8105E_SPIN1, RL_8169, "8105E", RL_MTU }, { RL_HWREV_8168B_SPIN2, RL_8169, "8168", RL_JUMBO_MTU }, { RL_HWREV_8168B_SPIN3, RL_8169, "8168", RL_JUMBO_MTU }, { RL_HWREV_8168C, RL_8169, "8168C/8111C", RL_JUMBO_MTU_6K }, @@ -230,6 +232,8 @@ static struct rl_hwrev re_hwrevs[] = { { RL_HWREV_8168DP, RL_8169, "8168DP/8111DP", RL_JUMBO_MTU_9K }, { RL_HWREV_8168E, RL_8169, "8168E/8111E", RL_JUMBO_MTU_9K}, { RL_HWREV_8168E_VL, RL_8169, "8168E/8111E-VL", RL_JUMBO_MTU_6K}, + { RL_HWREV_8168F, RL_8169, "8168F/8111F", RL_JUMBO_MTU_9K}, + { RL_HWREV_8411, RL_8169, "8411", RL_JUMBO_MTU_9K}, { 0, 0, NULL, 0 } }; @@ -1180,6 +1184,7 @@ re_attach(device_t dev) struct rl_softc *sc; struct ifnet *ifp; struct rl_hwrev *hw_rev; + u_int32_t cap, ctl; int hwrev; u_int16_t devid, re_did = 0; int error = 0, i, phy, rid; @@ -1235,8 +1240,10 @@ re_attach(device_t dev) msic = pci_msi_count(dev); msixc = pci_msix_count(dev); - if (pci_find_cap(dev, PCIY_EXPRESS, ®) == 0) + if (pci_find_cap(dev, PCIY_EXPRESS, ®) == 0) { sc->rl_flags |= RL_FLAG_PCIE; + sc->rl_expcap = reg; + } if (bootverbose) { device_printf(dev, "MSI count : %d\n", msic); device_printf(dev, "MSI-X count : %d\n", msixc); @@ -1328,6 +1335,23 @@ re_attach(device_t dev) CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_OFF); } + /* Disable ASPM L0S/L1. */ + if (sc->rl_expcap != 0) { + cap = pci_read_config(dev, sc->rl_expcap + + PCIR_EXPRESS_LINK_CAP, 2); + if ((cap & PCIM_LINK_CAP_ASPM) != 0) { + ctl = pci_read_config(dev, sc->rl_expcap + + PCIR_EXPRESS_LINK_CTL, 2); + if ((ctl & 0x0003) != 0) { + ctl &= ~0x0003; + pci_write_config(dev, sc->rl_expcap + + PCIR_EXPRESS_LINK_CTL, ctl, 2); + device_printf(dev, "ASPM disabled\n"); + } + } else + device_printf(dev, "no ASPM capability\n"); + } + hw_rev = re_hwrevs; hwrev = CSR_READ_4(sc, RL_TXCFG); switch (hwrev & 0x70000000) { @@ -1377,7 +1401,9 @@ re_attach(device_t dev) RL_FLAG_AUTOPAD | RL_FLAG_MACSLEEP; break; case RL_HWREV_8401E: + case RL_HWREV_8402: case RL_HWREV_8105E: + case RL_HWREV_8105E_SPIN1: sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PHYWAKE_PM | RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | RL_FLAG_FASTETHER | RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD; @@ -1409,6 +1435,8 @@ re_attach(device_t dev) RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD | RL_FLAG_JUMBOV2; break; case RL_HWREV_8168E_VL: + case RL_HWREV_8168F: + case RL_HWREV_8411: sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD | RL_FLAG_JUMBOV2; @@ -3304,6 +3332,7 @@ re_ioctl(struct ifnet *ifp, u_long comma } } #endif /* DEVICE_POLLING */ + RL_LOCK(sc); if ((mask & IFCAP_TXCSUM) != 0 && (ifp->if_capabilities & IFCAP_TXCSUM) != 0) { ifp->if_capenable ^= IFCAP_TXCSUM; @@ -3362,8 +3391,9 @@ re_ioctl(struct ifnet *ifp, u_long comma } if (reinit && ifp->if_drv_flags & IFF_DRV_RUNNING) { ifp->if_drv_flags &= ~IFF_DRV_RUNNING; - re_init(sc); + re_init_locked(sc); } + RL_UNLOCK(sc); VLAN_CAPABILITIES(ifp); } break; Modified: stable/9/sys/pci/if_rlreg.h ============================================================================== --- stable/9/sys/pci/if_rlreg.h Wed Jan 4 21:57:11 2012 (r229528) +++ stable/9/sys/pci/if_rlreg.h Wed Jan 4 22:53:18 2012 (r229529) @@ -178,6 +178,10 @@ #define RL_HWREV_8168C_SPIN2 0x3C400000 #define RL_HWREV_8168CP 0x3C800000 #define RL_HWREV_8105E 0x40800000 +#define RL_HWREV_8105E_SPIN1 0x40C00000 +#define RL_HWREV_8402 0x44000000 +#define RL_HWREV_8168F 0x48000000 +#define RL_HWREV_8411 0x48800000 #define RL_HWREV_8139 0x60000000 #define RL_HWREV_8139A 0x70000000 #define RL_HWREV_8139AG 0x70800000 @@ -866,6 +870,7 @@ struct rl_softc { const struct rl_hwrev *rl_hwrev; int rl_eecmd_read; int rl_eewidth; + int rl_expcap; int rl_txthresh; struct rl_chain_data rl_cdata; struct rl_list_data rl_ldata; From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 22:55:17 2012 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 9AE0C106566B; Wed, 4 Jan 2012 22:55:15 +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 8854A8FC16; Wed, 4 Jan 2012 22:55: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 q04MtFmN000570; Wed, 4 Jan 2012 22:55:15 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04MtFY0000567; Wed, 4 Jan 2012 22:55:15 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201042255.q04MtFY0000567@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 4 Jan 2012 22:55: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: r229530 - in stable/8/sys: dev/re pci 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, 04 Jan 2012 22:55:17 -0000 Author: yongari Date: Wed Jan 4 22:55:15 2012 New Revision: 229530 URL: http://svn.freebsd.org/changeset/base/229530 Log: MFC r227587,227590-227591,227593,227638-227639: r227587: Add preliminary support for RTL8402 PCIe FastEthernet with integrated card reader. r227590: Add preliminary support for RTL8411 PCIe Gigabit ethernet with integrated card reader. r227591: Add missing driver lock in SIOCSIFCAP handler. r227593: Disable PCIe ASPM (Active State Power Management) for all controllers. More and more RealTek controllers started to implement EEE feature. Vendor driver seems to load a kind of firmware for EEE with additional PHY fixups. It is known that the EEE feature may need ASPM support. Unfortunately there is no documentation for EEE of the controller so enabling ASPM may cause more problems. r227638: Add preliminary support for second generation RTL8105E PCIe FastEthernet. r227639: Add preliminary support for RTL8168/8111F PCIe Gigabit ethernet. Modified: stable/8/sys/dev/re/if_re.c stable/8/sys/pci/if_rlreg.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/re/if_re.c ============================================================================== --- stable/8/sys/dev/re/if_re.c Wed Jan 4 22:53:18 2012 (r229529) +++ stable/8/sys/dev/re/if_re.c Wed Jan 4 22:55:15 2012 (r229530) @@ -181,7 +181,7 @@ static struct rl_type re_devs[] = { { RT_VENDORID, RT_DEVICEID_8101E, 0, "RealTek 810xE PCIe 10/100baseTX" }, { RT_VENDORID, RT_DEVICEID_8168, 0, - "RealTek 8168/8111 B/C/CP/D/DP/E PCIe Gigabit Ethernet" }, + "RealTek 8168/8111 B/C/CP/D/DP/E/F PCIe Gigabit Ethernet" }, { RT_VENDORID, RT_DEVICEID_8169, 0, "RealTek 8169/8169S/8169SB(L)/8110S/8110SB(L) Gigabit Ethernet" }, { RT_VENDORID, RT_DEVICEID_8169SC, 0, @@ -220,7 +220,9 @@ static struct rl_hwrev re_hwrevs[] = { { RL_HWREV_8102EL_SPIN1, RL_8169, "8102EL", RL_MTU }, { RL_HWREV_8103E, RL_8169, "8103E", RL_MTU }, { RL_HWREV_8401E, RL_8169, "8401E", RL_MTU }, + { RL_HWREV_8402, RL_8169, "8402", RL_MTU }, { RL_HWREV_8105E, RL_8169, "8105E", RL_MTU }, + { RL_HWREV_8105E_SPIN1, RL_8169, "8105E", RL_MTU }, { RL_HWREV_8168B_SPIN2, RL_8169, "8168", RL_JUMBO_MTU }, { RL_HWREV_8168B_SPIN3, RL_8169, "8168", RL_JUMBO_MTU }, { RL_HWREV_8168C, RL_8169, "8168C/8111C", RL_JUMBO_MTU_6K }, @@ -230,6 +232,8 @@ static struct rl_hwrev re_hwrevs[] = { { RL_HWREV_8168DP, RL_8169, "8168DP/8111DP", RL_JUMBO_MTU_9K }, { RL_HWREV_8168E, RL_8169, "8168E/8111E", RL_JUMBO_MTU_9K}, { RL_HWREV_8168E_VL, RL_8169, "8168E/8111E-VL", RL_JUMBO_MTU_6K}, + { RL_HWREV_8168F, RL_8169, "8168F/8111F", RL_JUMBO_MTU_9K}, + { RL_HWREV_8411, RL_8169, "8411", RL_JUMBO_MTU_9K}, { 0, 0, NULL, 0 } }; @@ -1184,6 +1188,7 @@ re_attach(device_t dev) struct rl_softc *sc; struct ifnet *ifp; struct rl_hwrev *hw_rev; + u_int32_t cap, ctl; int hwrev; u_int16_t devid, re_did = 0; int error = 0, i, phy, rid; @@ -1239,8 +1244,10 @@ re_attach(device_t dev) msic = pci_msi_count(dev); msixc = pci_msix_count(dev); - if (pci_find_extcap(dev, PCIY_EXPRESS, ®) == 0) + if (pci_find_extcap(dev, PCIY_EXPRESS, ®) == 0) { sc->rl_flags |= RL_FLAG_PCIE; + sc->rl_expcap = reg; + } if (bootverbose) { device_printf(dev, "MSI count : %d\n", msic); device_printf(dev, "MSI-X count : %d\n", msixc); @@ -1332,6 +1339,23 @@ re_attach(device_t dev) CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_OFF); } + /* Disable ASPM L0S/L1. */ + if (sc->rl_expcap != 0) { + cap = pci_read_config(dev, sc->rl_expcap + + PCIR_EXPRESS_LINK_CAP, 2); + if ((cap & PCIM_LINK_CAP_ASPM) != 0) { + ctl = pci_read_config(dev, sc->rl_expcap + + PCIR_EXPRESS_LINK_CTL, 2); + if ((ctl & 0x0003) != 0) { + ctl &= ~0x0003; + pci_write_config(dev, sc->rl_expcap + + PCIR_EXPRESS_LINK_CTL, ctl, 2); + device_printf(dev, "ASPM disabled\n"); + } + } else + device_printf(dev, "no ASPM capability\n"); + } + hw_rev = re_hwrevs; hwrev = CSR_READ_4(sc, RL_TXCFG); switch (hwrev & 0x70000000) { @@ -1381,7 +1405,9 @@ re_attach(device_t dev) RL_FLAG_AUTOPAD | RL_FLAG_MACSLEEP; break; case RL_HWREV_8401E: + case RL_HWREV_8402: case RL_HWREV_8105E: + case RL_HWREV_8105E_SPIN1: sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PHYWAKE_PM | RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | RL_FLAG_FASTETHER | RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD; @@ -1413,6 +1439,8 @@ re_attach(device_t dev) RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD | RL_FLAG_JUMBOV2; break; case RL_HWREV_8168E_VL: + case RL_HWREV_8168F: + case RL_HWREV_8411: sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD | RL_FLAG_JUMBOV2; @@ -3308,6 +3336,7 @@ re_ioctl(struct ifnet *ifp, u_long comma } } #endif /* DEVICE_POLLING */ + RL_LOCK(sc); if ((mask & IFCAP_TXCSUM) != 0 && (ifp->if_capabilities & IFCAP_TXCSUM) != 0) { ifp->if_capenable ^= IFCAP_TXCSUM; @@ -3366,8 +3395,9 @@ re_ioctl(struct ifnet *ifp, u_long comma } if (reinit && ifp->if_drv_flags & IFF_DRV_RUNNING) { ifp->if_drv_flags &= ~IFF_DRV_RUNNING; - re_init(sc); + re_init_locked(sc); } + RL_UNLOCK(sc); VLAN_CAPABILITIES(ifp); } break; Modified: stable/8/sys/pci/if_rlreg.h ============================================================================== --- stable/8/sys/pci/if_rlreg.h Wed Jan 4 22:53:18 2012 (r229529) +++ stable/8/sys/pci/if_rlreg.h Wed Jan 4 22:55:15 2012 (r229530) @@ -178,6 +178,10 @@ #define RL_HWREV_8168C_SPIN2 0x3C400000 #define RL_HWREV_8168CP 0x3C800000 #define RL_HWREV_8105E 0x40800000 +#define RL_HWREV_8105E_SPIN1 0x40C00000 +#define RL_HWREV_8402 0x44000000 +#define RL_HWREV_8168F 0x48000000 +#define RL_HWREV_8411 0x48800000 #define RL_HWREV_8139 0x60000000 #define RL_HWREV_8139A 0x70000000 #define RL_HWREV_8139AG 0x70800000 @@ -866,6 +870,7 @@ struct rl_softc { const struct rl_hwrev *rl_hwrev; int rl_eecmd_read; int rl_eewidth; + int rl_expcap; int rl_txthresh; struct rl_chain_data rl_cdata; struct rl_list_data rl_ldata; From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 22:57:05 2012 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 618AF1065675; Wed, 4 Jan 2012 22:57:05 +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 4F3648FC0A; Wed, 4 Jan 2012 22:57:05 +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 q04Mv5wg000656; Wed, 4 Jan 2012 22:57:05 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04Mv58E000653; Wed, 4 Jan 2012 22:57:05 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201042257.q04Mv58E000653@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 4 Jan 2012 22:57:05 +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: r229531 - in stable/7/sys: dev/re pci 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, 04 Jan 2012 22:57:05 -0000 Author: yongari Date: Wed Jan 4 22:57:04 2012 New Revision: 229531 URL: http://svn.freebsd.org/changeset/base/229531 Log: MFC r227587,227590-227591,227593,227638-227639: r227587: Add preliminary support for RTL8402 PCIe FastEthernet with integrated card reader. r227590: Add preliminary support for RTL8411 PCIe Gigabit ethernet with integrated card reader. r227591: Add missing driver lock in SIOCSIFCAP handler. r227593: Disable PCIe ASPM (Active State Power Management) for all controllers. More and more RealTek controllers started to implement EEE feature. Vendor driver seems to load a kind of firmware for EEE with additional PHY fixups. It is known that the EEE feature may need ASPM support. Unfortunately there is no documentation for EEE of the controller so enabling ASPM may cause more problems. r227638: Add preliminary support for second generation RTL8105E PCIe FastEthernet. r227639: Add preliminary support for RTL8168/8111F PCIe Gigabit ethernet. Modified: stable/7/sys/dev/re/if_re.c stable/7/sys/pci/if_rlreg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/re/if_re.c ============================================================================== --- stable/7/sys/dev/re/if_re.c Wed Jan 4 22:55:15 2012 (r229530) +++ stable/7/sys/dev/re/if_re.c Wed Jan 4 22:57:04 2012 (r229531) @@ -181,7 +181,7 @@ static struct rl_type re_devs[] = { { RT_VENDORID, RT_DEVICEID_8101E, 0, "RealTek 810xE PCIe 10/100baseTX" }, { RT_VENDORID, RT_DEVICEID_8168, 0, - "RealTek 8168/8111 B/C/CP/D/DP/E PCIe Gigabit Ethernet" }, + "RealTek 8168/8111 B/C/CP/D/DP/E/F PCIe Gigabit Ethernet" }, { RT_VENDORID, RT_DEVICEID_8169, 0, "RealTek 8169/8169S/8169SB(L)/8110S/8110SB(L) Gigabit Ethernet" }, { RT_VENDORID, RT_DEVICEID_8169SC, 0, @@ -220,7 +220,9 @@ static struct rl_hwrev re_hwrevs[] = { { RL_HWREV_8102EL_SPIN1, RL_8169, "8102EL", RL_MTU }, { RL_HWREV_8103E, RL_8169, "8103E", RL_MTU }, { RL_HWREV_8401E, RL_8169, "8401E", RL_MTU }, + { RL_HWREV_8402, RL_8169, "8402", RL_MTU }, { RL_HWREV_8105E, RL_8169, "8105E", RL_MTU }, + { RL_HWREV_8105E_SPIN1, RL_8169, "8105E", RL_MTU }, { RL_HWREV_8168B_SPIN2, RL_8169, "8168", RL_JUMBO_MTU }, { RL_HWREV_8168B_SPIN3, RL_8169, "8168", RL_JUMBO_MTU }, { RL_HWREV_8168C, RL_8169, "8168C/8111C", RL_JUMBO_MTU_6K }, @@ -230,6 +232,8 @@ static struct rl_hwrev re_hwrevs[] = { { RL_HWREV_8168DP, RL_8169, "8168DP/8111DP", RL_JUMBO_MTU_9K }, { RL_HWREV_8168E, RL_8169, "8168E/8111E", RL_JUMBO_MTU_9K}, { RL_HWREV_8168E_VL, RL_8169, "8168E/8111E-VL", RL_JUMBO_MTU_6K}, + { RL_HWREV_8168F, RL_8169, "8168F/8111F", RL_JUMBO_MTU_9K}, + { RL_HWREV_8411, RL_8169, "8411", RL_JUMBO_MTU_9K}, { 0, 0, NULL, 0 } }; @@ -1185,6 +1189,7 @@ re_attach(device_t dev) struct rl_softc *sc; struct ifnet *ifp; struct rl_hwrev *hw_rev; + u_int32_t cap, ctl; int hwrev; u_int16_t devid, re_did = 0; int error = 0, i, phy, rid; @@ -1240,8 +1245,10 @@ re_attach(device_t dev) msic = pci_msi_count(dev); msixc = pci_msix_count(dev); - if (pci_find_extcap(dev, PCIY_EXPRESS, ®) == 0) + if (pci_find_extcap(dev, PCIY_EXPRESS, ®) == 0) { sc->rl_flags |= RL_FLAG_PCIE; + sc->rl_expcap = reg; + } if (bootverbose) { device_printf(dev, "MSI count : %d\n", msic); device_printf(dev, "MSI-X count : %d\n", msixc); @@ -1333,6 +1340,23 @@ re_attach(device_t dev) CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_OFF); } + /* Disable ASPM L0S/L1. */ + if (sc->rl_expcap != 0) { + cap = pci_read_config(dev, sc->rl_expcap + + PCIR_EXPRESS_LINK_CAP, 2); + if ((cap & PCIM_LINK_CAP_ASPM) != 0) { + ctl = pci_read_config(dev, sc->rl_expcap + + PCIR_EXPRESS_LINK_CTL, 2); + if ((ctl & 0x0003) != 0) { + ctl &= ~0x0003; + pci_write_config(dev, sc->rl_expcap + + PCIR_EXPRESS_LINK_CTL, ctl, 2); + device_printf(dev, "ASPM disabled\n"); + } + } else + device_printf(dev, "no ASPM capability\n"); + } + hw_rev = re_hwrevs; hwrev = CSR_READ_4(sc, RL_TXCFG); switch (hwrev & 0x70000000) { @@ -1382,7 +1406,9 @@ re_attach(device_t dev) RL_FLAG_AUTOPAD | RL_FLAG_MACSLEEP; break; case RL_HWREV_8401E: + case RL_HWREV_8402: case RL_HWREV_8105E: + case RL_HWREV_8105E_SPIN1: sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PHYWAKE_PM | RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | RL_FLAG_FASTETHER | RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD; @@ -1414,6 +1440,8 @@ re_attach(device_t dev) RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD | RL_FLAG_JUMBOV2; break; case RL_HWREV_8168E_VL: + case RL_HWREV_8168F: + case RL_HWREV_8411: sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD | RL_FLAG_JUMBOV2; @@ -3302,6 +3330,7 @@ re_ioctl(struct ifnet *ifp, u_long comma } } #endif /* DEVICE_POLLING */ + RL_LOCK(sc); if ((mask & IFCAP_TXCSUM) != 0 && (ifp->if_capabilities & IFCAP_TXCSUM) != 0) { ifp->if_capenable ^= IFCAP_TXCSUM; @@ -3360,8 +3389,9 @@ re_ioctl(struct ifnet *ifp, u_long comma } if (reinit && ifp->if_drv_flags & IFF_DRV_RUNNING) { ifp->if_drv_flags &= ~IFF_DRV_RUNNING; - re_init(sc); + re_init_locked(sc); } + RL_UNLOCK(sc); VLAN_CAPABILITIES(ifp); } break; Modified: stable/7/sys/pci/if_rlreg.h ============================================================================== --- stable/7/sys/pci/if_rlreg.h Wed Jan 4 22:55:15 2012 (r229530) +++ stable/7/sys/pci/if_rlreg.h Wed Jan 4 22:57:04 2012 (r229531) @@ -178,6 +178,10 @@ #define RL_HWREV_8168C_SPIN2 0x3C400000 #define RL_HWREV_8168CP 0x3C800000 #define RL_HWREV_8105E 0x40800000 +#define RL_HWREV_8105E_SPIN1 0x40C00000 +#define RL_HWREV_8402 0x44000000 +#define RL_HWREV_8168F 0x48000000 +#define RL_HWREV_8411 0x48800000 #define RL_HWREV_8139 0x60000000 #define RL_HWREV_8139A 0x70000000 #define RL_HWREV_8139AG 0x70800000 @@ -883,6 +887,7 @@ struct rl_softc { struct rl_hwrev *rl_hwrev; int rl_eecmd_read; int rl_eewidth; + int rl_expcap; int rl_txthresh; struct rl_chain_data rl_cdata; struct rl_list_data rl_ldata; From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 23:00:27 2012 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 D8125106564A; Wed, 4 Jan 2012 23:00:25 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C6F9D8FC08; Wed, 4 Jan 2012 23:00:25 +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 q04N0PBV000830; Wed, 4 Jan 2012 23:00:25 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04N0PYJ000828; Wed, 4 Jan 2012 23:00:25 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201201042300.q04N0PYJ000828@svn.freebsd.org> From: Luigi Rizzo Date: Wed, 4 Jan 2012 23:00:25 +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: r229532 - head/release/picobsd/build 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, 04 Jan 2012 23:00:28 -0000 Author: luigi Date: Wed Jan 4 23:00:25 2012 New Revision: 229532 URL: http://svn.freebsd.org/changeset/base/229532 Log: now picobsd cross builds work (tried with host amd64, target i386 ). The fix involved adding a proper build of ld-elf.so.1 , and also replacing ldd with objdump (suggested by Garrett Cooper) to build the list of shared libraries needed by the binaries and libraries on the target. Modified: head/release/picobsd/build/picobsd Modified: head/release/picobsd/build/picobsd ============================================================================== --- head/release/picobsd/build/picobsd Wed Jan 4 22:57:04 2012 (r229531) +++ head/release/picobsd/build/picobsd Wed Jan 4 23:00:25 2012 (r229532) @@ -161,19 +161,19 @@ set_defaults() { # no arguments # and also to build a specific target create_includes_and_libraries2() { # opt_dir opt_target local no - log "create_includes_and_libraries2() for ${SRC}" + log "create_includes_and_libraries2() for ${SRC} $1" if [ ${OSVERSION} -ge 600000 ] ; then no="-DNO_CLEAN -DNO_PROFILE -DNO_GAMES -DNO_LIBC_R" # WITHOUT_CDDL=1" else no="-DNOCLEAN -DNOPROFILE -DNOGAMES -DNOLIBC_R" fi - MAKEOBJDIRPREFIX=${l_objtree} - export MAKEOBJDIRPREFIX ( cd ${SRC}; # make -DNOCLEAN -DNOPROFILE -DNOGAMES -DNOLIBC_R -DPICOBSD buildworld if [ -d "$1" ] ; then cd $1 ; ${BINMAKE} ${o_par} $2 # specific target, e.g. ld-elf.so else + MAKEOBJDIRPREFIX=${l_objtree} + export MAKEOBJDIRPREFIX # export WITH_RESCUE=yes # build crunchide # ${BINMAKE} ${o_par} _+_= $no toolchain _includes _libraries ( @@ -551,7 +551,7 @@ do_links() { # rootdir varname # find_progs is a helper function to locate the named programs # or libraries in ${o_objdir} or ${_SHLIBDIRPREFIX}, # and return the full pathnames. -# Called as "find_progs [-L libpath] [-P binpath] prog1 prog2 ... " +# Called as "find_progs [[-L libpath] [-P binpath]] prog1 prog2 ... " # On return it sets ${u_progs} to the list of programs, and ${u_libs} # to the list of shared libraries used. # @@ -574,24 +574,32 @@ do_links() { # rootdir varname # } find_progs() { # programs - local i - local oo=${o_objdir:-${_SHLIBDIRPREFIX}} # default objdir - local lp=$oo/lib # default lib.prefix - local o="" # additional objdir + local pass i old_libs="" tmp o="" if [ x"$1" = "x-L" -a -d "$2" ] ; then # set lib search path - o=$2; shift; shift - lp="$lp:$o/lib:$o/usr/lib:$o/usr/local/lib" - o="-P $o" + o="-P $2"; shift; shift fi - u_libs="" - u_progs="`find_progs_helper $*`" - log "looking for libs for <$u_progs> in $lp" + # Result returned in global variables + u_libs="" ; u_progs="`find_progs_helper $*`" [ -z "${u_progs}" ] && return 1 # not found, error - i="`( LD_LIBRARY_PATH=$lp ldd ${u_progs} ) | \ - grep -v '^/' | awk '{print $1}' | sort | uniq`" - u_libs="`find_progs_helper $o $i`" - log "--- done find_progs ---" - return 0 + # use objdump to find libraries. Iterate to fetch recursive + # dependencies. + tmp="${u_progs}" ; pass=1 + while [ $pass -lt 10 ] ; do + pass=$(($pass + 1)) + i="`objdump -x ${tmp} | \ + awk '$1 == "NEEDED" { print $2 }' | sort | uniq`" + if [ "$old_libs" = "$i" ] ; then + log "libraries for: $my_progs ($u_progs) are ($i) $u_libs" + log "--- done find_progs ---" + return 0 + else + # logverbose "old--- $old_libs --- new +++ $i +++" + fi + u_libs="`find_progs_helper $o $i`" + old_libs="$i" + tmp="$tmp $u_libs" + done + log "WARNING: Too many passes, giving up" } find_progs_helper() { # programs From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 23:26:22 2012 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 70FB71065678; Wed, 4 Jan 2012 23:26:22 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5D1FD8FC1C; Wed, 4 Jan 2012 23:26: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 q04NQMdK003273; Wed, 4 Jan 2012 23:26:22 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04NQMLK003266; Wed, 4 Jan 2012 23:26:22 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201201042326.q04NQMLK003266@svn.freebsd.org> From: Aleksandr Rybalko Date: Wed, 4 Jan 2012 23:26:22 +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: r229533 - in head/sys: conf contrib/xz-embedded/freebsd contrib/xz-embedded/linux/include/linux contrib/xz-embedded/linux/lib/xz 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, 04 Jan 2012 23:26:22 -0000 Author: ray Date: Wed Jan 4 23:26:22 2012 New Revision: 229533 URL: http://svn.freebsd.org/changeset/base/229533 Log: Update contrib/xz-embedded to build with new GEOM_UNCOMPRESS module. Approved by: adrian (mentor) Added: head/sys/contrib/xz-embedded/freebsd/ head/sys/contrib/xz-embedded/freebsd/xz_config.h (contents, props changed) head/sys/contrib/xz-embedded/freebsd/xz_malloc.c (contents, props changed) head/sys/contrib/xz-embedded/freebsd/xz_malloc.h (contents, props changed) Modified: head/sys/conf/files head/sys/contrib/xz-embedded/linux/include/linux/xz.h head/sys/contrib/xz-embedded/linux/lib/xz/xz_private.h Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Wed Jan 4 23:00:25 2012 (r229532) +++ head/sys/conf/files Wed Jan 4 23:26:22 2012 (r229533) @@ -2266,6 +2266,21 @@ geom/raid3/g_raid3.c optional geom_raid geom/raid3/g_raid3_ctl.c optional geom_raid3 geom/shsec/g_shsec.c optional geom_shsec geom/stripe/g_stripe.c optional geom_stripe +contrib/xz-embedded/freebsd/xz_malloc.c \ + optional xz_embedded \ + compile-with "${NORMAL_C} -I$S/contrib/xz-embedded/freebsd/ -I$S/contrib/xz-embedded/linux/lib/xz/ -I$S/contrib/xz-embedded/linux/include/linux/" +contrib/xz-embedded/linux/lib/xz/xz_crc32.c \ + optional xz_embedded \ + compile-with "${NORMAL_C} -I$S/contrib/xz-embedded/freebsd/ -I$S/contrib/xz-embedded/linux/lib/xz/ -I$S/contrib/xz-embedded/linux/include/linux/" +contrib/xz-embedded/linux/lib/xz/xz_dec_bcj.c \ + optional xz_embedded \ + compile-with "${NORMAL_C} -I$S/contrib/xz-embedded/freebsd/ -I$S/contrib/xz-embedded/linux/lib/xz/ -I$S/contrib/xz-embedded/linux/include/linux/" +contrib/xz-embedded/linux/lib/xz/xz_dec_lzma2.c \ + optional xz_embedded \ + compile-with "${NORMAL_C} -I$S/contrib/xz-embedded/freebsd/ -I$S/contrib/xz-embedded/linux/lib/xz/ -I$S/contrib/xz-embedded/linux/include/linux/" +contrib/xz-embedded/linux/lib/xz/xz_dec_stream.c \ + optional xz_embedded \ + compile-with "${NORMAL_C} -I$S/contrib/xz-embedded/freebsd/ -I$S/contrib/xz-embedded/linux/lib/xz/ -I$S/contrib/xz-embedded/linux/include/linux/" geom/uzip/g_uzip.c optional geom_uzip geom/virstor/binstream.c optional geom_virstor geom/virstor/g_virstor.c optional geom_virstor Added: head/sys/contrib/xz-embedded/freebsd/xz_config.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/contrib/xz-embedded/freebsd/xz_config.h Wed Jan 4 23:26:22 2012 (r229533) @@ -0,0 +1,73 @@ +/*- + * Copyright (c) 2010-2012 Aleksandr Rybalko + * 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 THE AUTHOR AND CONTRIBUTORS ``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 THE AUTHOR 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. + */ + +#ifndef __FREEBSD_XZ_CONFIG_H__ +#define __FREEBSD_XZ_CONFIG_H__ + +#include +#include +#include +#include + +#include +#include "xz_malloc.h" + +#define XZ_DEC_SINGLE 1 +#define XZ_PREBOOT 1 + +#undef XZ_EXTERN +#define XZ_EXTERN extern + +#undef STATIC +#define STATIC + +#undef INIT +#define INIT + +#undef bool +#undef true +#undef false +#define bool int +#define true 1 +#define false 0 + +#define kmalloc(size, flags) xz_malloc(size) +#define kfree(ptr) xz_free(ptr) +#define vmalloc(size) xz_malloc(size) +#define vfree(ptr) xz_free(ptr) + +#define memeq(a, b, size) (memcmp((a), (b), (size)) == 0) +#define memzero(buf, size) bzero((buf), (size)) + +#ifndef min +# define min(x, y) MIN((x), (y)) +#endif + +#define min_t(type, x, y) min((x), (y)) + +#define get_le32(ptr) le32toh(*(const uint32_t *)(ptr)) + +#endif /* __FREEBSD_XZ_CONFIG_H__ */ Added: head/sys/contrib/xz-embedded/freebsd/xz_malloc.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/contrib/xz-embedded/freebsd/xz_malloc.c Wed Jan 4 23:26:22 2012 (r229533) @@ -0,0 +1,49 @@ +/*- + * Copyright (c) 2010-2012 Aleksandr Rybalko + * 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 THE AUTHOR AND CONTRIBUTORS ``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 THE AUTHOR 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. + */ + +#include +#include +#include "xz_malloc.h" + +/* Wraper for XZ decompressor memmory pool */ + +static MALLOC_DEFINE(XZ_DEC, "XZ_DEC", "XZ decompressor data"); + +void * +xz_malloc(unsigned long size) +{ + void *addr; + + addr = malloc(size, XZ_DEC, M_NOWAIT); + return (addr); +} + +void +xz_free(void *addr) +{ + + free(addr, XZ_DEC); +} Added: head/sys/contrib/xz-embedded/freebsd/xz_malloc.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/contrib/xz-embedded/freebsd/xz_malloc.h Wed Jan 4 23:26:22 2012 (r229533) @@ -0,0 +1,34 @@ +/*- + * Copyright (c) 2010-2012 Aleksandr Rybalko + * 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 THE AUTHOR AND CONTRIBUTORS ``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 THE AUTHOR 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. + */ + +#ifndef __XZ_MALLOC_H__ +#define __XZ_MALLOC_H__ + +extern void *xz_malloc(unsigned long size); +extern void xz_free(void *addr); + +#endif /* __XZ_MALLOC_H__ */ + Modified: head/sys/contrib/xz-embedded/linux/include/linux/xz.h ============================================================================== --- head/sys/contrib/xz-embedded/linux/include/linux/xz.h Wed Jan 4 23:00:25 2012 (r229532) +++ head/sys/contrib/xz-embedded/linux/include/linux/xz.h Wed Jan 4 23:26:22 2012 (r229533) @@ -15,9 +15,14 @@ # include # include #else +#ifdef __FreeBSD__ +# include +# include +#else # include # include #endif +#endif #ifdef __cplusplus extern "C" { Modified: head/sys/contrib/xz-embedded/linux/lib/xz/xz_private.h ============================================================================== --- head/sys/contrib/xz-embedded/linux/lib/xz/xz_private.h Wed Jan 4 23:00:25 2012 (r229532) +++ head/sys/contrib/xz-embedded/linux/lib/xz/xz_private.h Wed Jan 4 23:26:22 2012 (r229533) @@ -47,7 +47,7 @@ * macros and functions. This makes it easier to adapt the code into * different environments and avoids clutter in the Linux kernel tree. */ -# include "xz_config.h" +# include #endif /* If no specific decoding mode is requested, enable support for all modes. */ From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 23:29:57 2012 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 75ED41065673; Wed, 4 Jan 2012 23:29:57 +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 631698FC0A; Wed, 4 Jan 2012 23:29: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 q04NTvuI003414; Wed, 4 Jan 2012 23:29:57 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04NTv5a003411; Wed, 4 Jan 2012 23:29:57 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201042329.q04NTv5a003411@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 4 Jan 2012 23:29:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229534 - in stable/9/sys: dev/re pci 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, 04 Jan 2012 23:29:57 -0000 Author: yongari Date: Wed Jan 4 23:29:57 2012 New Revision: 229534 URL: http://svn.freebsd.org/changeset/base/229534 Log: MFC r227850-227851,227854,227914,227916: r227850: Writing access to RL_CFG5 register also requires EEPROM write access. While I'm here, enable WOL through magic packet but disable waking up system via unicast, multicast and broadcast frames. Otherwise, multicast or unicast frame(e.g. ICMP echo request) can wake up system which is not probably wanted behavior on most environments. This was not known as problem because RL_CFG5 register access had not effect until this change. The capability to wake up system with unicast/multicast frames are still set in driver, default off, so users who need that feature can still activate it with ifconfig(8). r227851: Perform media change after setting IFF_DRV_RUNNING flag. Without it, driver would ignore the first link state update if controller already established a link such that it would have to take additional link state handling in re_tick(). r227854: Disable accepting frames in re_stop() to put RX MAC into idle state. Because there is no reliable way to know whether RX MAC is in stopped state, rejecting all frames would be the only way to minimize possible races. Otherwise it's possible to receive frames while stop command execution is in progress and controller can DMA the frame to freed RX buffer during that period. This was observed on recent PCIe controllers(i.e. RTL8111F). While this change may not be required on old controllers it wouldn't make negative effects on old controllers. One side effect of this change is disabling receive so driver reprograms RL_RXCFG to receive WOL frames when it is put into suspend or shutdown. This should address occasional 'memory modified free' errors seen on recent RealTek controllers. r227914: Make sure to stop TX MAC before freeing queued TX frames. For RTL8111DP, check if the TX MAC is active by reading RL_GTXSTART register. For RTL8402/8168E-VL/8168F/8411, wait until TX queue is empty. r227916: To save more power, switch to 10/100Mbps link when controller is put into suspend/shutdown. Old PCI controllers performed that operation in firmware but for RTL8111C or newer controllers, it's responsibility of driver. It's not clear whether the firmware of RTL8111B still downgrades its speed to 10/100Mbps so leave it as it was. Modified: stable/9/sys/dev/re/if_re.c stable/9/sys/pci/if_rlreg.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/re/if_re.c ============================================================================== --- stable/9/sys/dev/re/if_re.c Wed Jan 4 23:26:22 2012 (r229533) +++ stable/9/sys/dev/re/if_re.c Wed Jan 4 23:29:57 2012 (r229534) @@ -294,6 +294,7 @@ static void re_set_rxmode (struct rl_so static void re_reset (struct rl_softc *); static void re_setwol (struct rl_softc *); static void re_clrwol (struct rl_softc *); +static void re_set_linkspeed (struct rl_softc *); #ifdef RE_DIAG static int re_diag (struct rl_softc *); @@ -1401,13 +1402,18 @@ re_attach(device_t dev) RL_FLAG_AUTOPAD | RL_FLAG_MACSLEEP; break; case RL_HWREV_8401E: - case RL_HWREV_8402: case RL_HWREV_8105E: case RL_HWREV_8105E_SPIN1: sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PHYWAKE_PM | RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | RL_FLAG_FASTETHER | RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD; break; + case RL_HWREV_8402: + sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PHYWAKE_PM | + RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | + RL_FLAG_FASTETHER | RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD | + RL_FLAG_CMDSTOP_WAIT_TXQ; + break; case RL_HWREV_8168B_SPIN1: case RL_HWREV_8168B_SPIN2: sc->rl_flags |= RL_FLAG_WOLRXENB; @@ -1424,22 +1430,28 @@ re_attach(device_t dev) /* FALLTHROUGH */ case RL_HWREV_8168CP: case RL_HWREV_8168D: - case RL_HWREV_8168DP: sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | RL_FLAG_CMDSTOP | - RL_FLAG_AUTOPAD | RL_FLAG_JUMBOV2; + RL_FLAG_AUTOPAD | RL_FLAG_JUMBOV2 | RL_FLAG_WOL_MANLINK; + break; + case RL_HWREV_8168DP: + sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PAR | + RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | RL_FLAG_AUTOPAD | + RL_FLAG_JUMBOV2 | RL_FLAG_WAIT_TXPOLL | RL_FLAG_WOL_MANLINK; break; case RL_HWREV_8168E: sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PHYWAKE_PM | RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | - RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD | RL_FLAG_JUMBOV2; + RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD | RL_FLAG_JUMBOV2 | + RL_FLAG_WOL_MANLINK; break; case RL_HWREV_8168E_VL: case RL_HWREV_8168F: case RL_HWREV_8411: sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | RL_FLAG_CMDSTOP | - RL_FLAG_AUTOPAD | RL_FLAG_JUMBOV2; + RL_FLAG_AUTOPAD | RL_FLAG_JUMBOV2 | + RL_FLAG_CMDSTOP_WAIT_TXQ | RL_FLAG_WOL_MANLINK; break; case RL_HWREV_8169_8110SB: case RL_HWREV_8169_8110SBL: @@ -1590,6 +1602,7 @@ re_attach(device_t dev) if (pci_find_cap(sc->rl_dev, PCIY_PMG, ®) == 0) ifp->if_capabilities |= IFCAP_WOL; ifp->if_capenable = ifp->if_capabilities; + ifp->if_capenable &= ~(IFCAP_WOL_UCAST | IFCAP_WOL_MCAST); /* * Don't enable TSO by default. It is known to generate * corrupted TCP segments(bad TCP options) under certain @@ -3193,14 +3206,14 @@ re_init_locked(struct rl_softc *sc) if (sc->rl_testmode) return; - mii_mediachg(mii); - CSR_WRITE_1(sc, RL_CFG1, CSR_READ_1(sc, RL_CFG1) | RL_CFG1_DRVLOAD); ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; sc->rl_flags &= ~RL_FLAG_LINK; + mii_mediachg(mii); + sc->rl_watchdog_timer = 0; callout_reset(&sc->rl_stat_callout, hz, re_tick, sc); } @@ -3455,10 +3468,42 @@ re_stop(struct rl_softc *sc) callout_stop(&sc->rl_stat_callout); ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); - if ((sc->rl_flags & RL_FLAG_CMDSTOP) != 0) + /* + * Disable accepting frames to put RX MAC into idle state. + * Otherwise it's possible to get frames while stop command + * execution is in progress and controller can DMA the frame + * to already freed RX buffer during that period. + */ + CSR_WRITE_4(sc, RL_RXCFG, CSR_READ_4(sc, RL_RXCFG) & + ~(RL_RXCFG_RX_ALLPHYS | RL_RXCFG_RX_INDIV | RL_RXCFG_RX_MULTI | + RL_RXCFG_RX_BROAD)); + + if ((sc->rl_flags & RL_FLAG_WAIT_TXPOLL) != 0) { + for (i = RL_TIMEOUT; i > 0; i--) { + if ((CSR_READ_1(sc, sc->rl_txstart) & + RL_TXSTART_START) == 0) + break; + DELAY(20); + } + if (i == 0) + device_printf(sc->rl_dev, + "stopping TX poll timed out!\n"); + CSR_WRITE_1(sc, RL_COMMAND, 0x00); + } else if ((sc->rl_flags & RL_FLAG_CMDSTOP) != 0) { CSR_WRITE_1(sc, RL_COMMAND, RL_CMD_STOPREQ | RL_CMD_TX_ENB | RL_CMD_RX_ENB); - else + if ((sc->rl_flags & RL_FLAG_CMDSTOP_WAIT_TXQ) != 0) { + for (i = RL_TIMEOUT; i > 0; i--) { + if ((CSR_READ_4(sc, RL_TXCFG) & + RL_TXCFG_QUEUE_EMPTY) != 0) + break; + DELAY(100); + } + if (i == 0) + device_printf(sc->rl_dev, + "stopping TXQ timed out!\n"); + } + } else CSR_WRITE_1(sc, RL_COMMAND, 0x00); DELAY(1000); CSR_WRITE_2(sc, RL_IMR, 0x0000); @@ -3584,6 +3629,74 @@ re_shutdown(device_t dev) } static void +re_set_linkspeed(struct rl_softc *sc) +{ + struct mii_softc *miisc; + struct mii_data *mii; + int aneg, i, phyno; + + RL_LOCK_ASSERT(sc); + + mii = device_get_softc(sc->rl_miibus); + mii_pollstat(mii); + aneg = 0; + if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == + (IFM_ACTIVE | IFM_AVALID)) { + switch IFM_SUBTYPE(mii->mii_media_active) { + case IFM_10_T: + case IFM_100_TX: + return; + case IFM_1000_T: + aneg++; + break; + default: + break; + } + } + miisc = LIST_FIRST(&mii->mii_phys); + phyno = miisc->mii_phy; + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) + PHY_RESET(miisc); + re_miibus_writereg(sc->rl_dev, phyno, MII_100T2CR, 0); + re_miibus_writereg(sc->rl_dev, phyno, + MII_ANAR, ANAR_TX_FD | ANAR_TX | ANAR_10_FD | ANAR_10 | ANAR_CSMA); + re_miibus_writereg(sc->rl_dev, phyno, + MII_BMCR, BMCR_AUTOEN | BMCR_STARTNEG); + DELAY(1000); + if (aneg != 0) { + /* + * Poll link state until re(4) get a 10/100Mbps link. + */ + for (i = 0; i < MII_ANEGTICKS_GIGE; i++) { + mii_pollstat(mii); + if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) + == (IFM_ACTIVE | IFM_AVALID)) { + switch (IFM_SUBTYPE(mii->mii_media_active)) { + case IFM_10_T: + case IFM_100_TX: + return; + default: + break; + } + } + RL_UNLOCK(sc); + pause("relnk", hz); + RL_LOCK(sc); + } + if (i == MII_ANEGTICKS_GIGE) + device_printf(sc->rl_dev, + "establishing a link failed, WOL may not work!"); + } + /* + * No link, force MAC to have 100Mbps, full-duplex link. + * MAC does not require reprogramming on resolved speed/duplex, + * so this is just for completeness. + */ + mii->mii_media_status = IFM_AVALID | IFM_ACTIVE; + mii->mii_media_active = IFM_ETHER | IFM_100_TX | IFM_FDX; +} + +static void re_setwol(struct rl_softc *sc) { struct ifnet *ifp; @@ -3603,9 +3716,13 @@ re_setwol(struct rl_softc *sc) CSR_WRITE_1(sc, RL_GPIO, CSR_READ_1(sc, RL_GPIO) & ~0x01); } - if ((ifp->if_capenable & IFCAP_WOL) != 0 && - (sc->rl_flags & RL_FLAG_WOLRXENB) != 0) - CSR_WRITE_1(sc, RL_COMMAND, RL_CMD_RX_ENB); + if ((ifp->if_capenable & IFCAP_WOL) != 0) { + re_set_rxmode(sc); + if ((sc->rl_flags & RL_FLAG_WOL_MANLINK) != 0) + re_set_linkspeed(sc); + if ((sc->rl_flags & RL_FLAG_WOLRXENB) != 0) + CSR_WRITE_1(sc, RL_COMMAND, RL_CMD_RX_ENB); + } /* Enable config register write. */ CSR_WRITE_1(sc, RL_EECMD, RL_EE_MODE); @@ -3622,12 +3739,9 @@ re_setwol(struct rl_softc *sc) v |= RL_CFG3_WOL_MAGIC; CSR_WRITE_1(sc, RL_CFG3, v); - /* Config register write done. */ - CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_OFF); - v = CSR_READ_1(sc, RL_CFG5); - v &= ~(RL_CFG5_WOL_BCAST | RL_CFG5_WOL_MCAST | RL_CFG5_WOL_UCAST); - v &= ~RL_CFG5_WOL_LANWAKE; + v &= ~(RL_CFG5_WOL_BCAST | RL_CFG5_WOL_MCAST | RL_CFG5_WOL_UCAST | + RL_CFG5_WOL_LANWAKE); if ((ifp->if_capenable & IFCAP_WOL_UCAST) != 0) v |= RL_CFG5_WOL_UCAST; if ((ifp->if_capenable & IFCAP_WOL_MCAST) != 0) @@ -3636,6 +3750,9 @@ re_setwol(struct rl_softc *sc) v |= RL_CFG5_WOL_LANWAKE; CSR_WRITE_1(sc, RL_CFG5, v); + /* Config register write done. */ + CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_OFF); + if ((ifp->if_capenable & IFCAP_WOL) != 0 && (sc->rl_flags & RL_FLAG_PHYWAKE_PM) != 0) CSR_WRITE_1(sc, RL_PMCH, CSR_READ_1(sc, RL_PMCH) & ~0x80); Modified: stable/9/sys/pci/if_rlreg.h ============================================================================== --- stable/9/sys/pci/if_rlreg.h Wed Jan 4 23:26:22 2012 (r229533) +++ stable/9/sys/pci/if_rlreg.h Wed Jan 4 23:29:57 2012 (r229534) @@ -143,6 +143,7 @@ */ #define RL_TXCFG_CLRABRT 0x00000001 /* retransmit aborted pkt */ #define RL_TXCFG_MAXDMA 0x00000700 /* max DMA burst size */ +#define RL_TXCFG_QUEUE_EMPTY 0x00000800 /* 8168E-VL or higher */ #define RL_TXCFG_CRCAPPEND 0x00010000 /* CRC append (0 = yes) */ #define RL_TXCFG_LOOPBKTST 0x00060000 /* loopback test */ #define RL_TXCFG_IFG2 0x00080000 /* 8169 only */ @@ -897,22 +898,25 @@ struct rl_softc { int rl_int_rx_act; int rl_int_rx_mod; uint32_t rl_flags; -#define RL_FLAG_MSI 0x0001 -#define RL_FLAG_AUTOPAD 0x0002 -#define RL_FLAG_PHYWAKE_PM 0x0004 -#define RL_FLAG_PHYWAKE 0x0008 -#define RL_FLAG_JUMBOV2 0x0010 -#define RL_FLAG_PAR 0x0020 -#define RL_FLAG_DESCV2 0x0040 -#define RL_FLAG_MACSTAT 0x0080 -#define RL_FLAG_FASTETHER 0x0100 -#define RL_FLAG_CMDSTOP 0x0200 -#define RL_FLAG_MACRESET 0x0400 -#define RL_FLAG_MSIX 0x0800 -#define RL_FLAG_WOLRXENB 0x1000 -#define RL_FLAG_MACSLEEP 0x2000 -#define RL_FLAG_PCIE 0x4000 -#define RL_FLAG_LINK 0x8000 +#define RL_FLAG_MSI 0x00000001 +#define RL_FLAG_AUTOPAD 0x00000002 +#define RL_FLAG_PHYWAKE_PM 0x00000004 +#define RL_FLAG_PHYWAKE 0x00000008 +#define RL_FLAG_JUMBOV2 0x00000010 +#define RL_FLAG_PAR 0x00000020 +#define RL_FLAG_DESCV2 0x00000040 +#define RL_FLAG_MACSTAT 0x00000080 +#define RL_FLAG_FASTETHER 0x00000100 +#define RL_FLAG_CMDSTOP 0x00000200 +#define RL_FLAG_MACRESET 0x00000400 +#define RL_FLAG_MSIX 0x00000800 +#define RL_FLAG_WOLRXENB 0x00001000 +#define RL_FLAG_MACSLEEP 0x00002000 +#define RL_FLAG_WAIT_TXPOLL 0x00004000 +#define RL_FLAG_CMDSTOP_WAIT_TXQ 0x00008000 +#define RL_FLAG_WOL_MANLINK 0x00010000 +#define RL_FLAG_PCIE 0x40000000 +#define RL_FLAG_LINK 0x80000000 }; #define RL_LOCK(_sc) mtx_lock(&(_sc)->rl_mtx) From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 23:31:43 2012 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 CA49D1065670; Wed, 4 Jan 2012 23:31:43 +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 ADDE38FC1A; Wed, 4 Jan 2012 23:31:43 +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 q04NVh1E003649; Wed, 4 Jan 2012 23:31:43 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04NVh8p003646; Wed, 4 Jan 2012 23:31:43 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201042331.q04NVh8p003646@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 4 Jan 2012 23:31:43 +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: r229535 - in stable/8/sys: dev/re pci 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, 04 Jan 2012 23:31:44 -0000 Author: yongari Date: Wed Jan 4 23:31:43 2012 New Revision: 229535 URL: http://svn.freebsd.org/changeset/base/229535 Log: MFC r227850-227851,227854,227914,227916: r227850: Writing access to RL_CFG5 register also requires EEPROM write access. While I'm here, enable WOL through magic packet but disable waking up system via unicast, multicast and broadcast frames. Otherwise, multicast or unicast frame(e.g. ICMP echo request) can wake up system which is not probably wanted behavior on most environments. This was not known as problem because RL_CFG5 register access had not effect until this change. The capability to wake up system with unicast/multicast frames are still set in driver, default off, so users who need that feature can still activate it with ifconfig(8). r227851: Perform media change after setting IFF_DRV_RUNNING flag. Without it, driver would ignore the first link state update if controller already established a link such that it would have to take additional link state handling in re_tick(). r227854: Disable accepting frames in re_stop() to put RX MAC into idle state. Because there is no reliable way to know whether RX MAC is in stopped state, rejecting all frames would be the only way to minimize possible races. Otherwise it's possible to receive frames while stop command execution is in progress and controller can DMA the frame to freed RX buffer during that period. This was observed on recent PCIe controllers(i.e. RTL8111F). While this change may not be required on old controllers it wouldn't make negative effects on old controllers. One side effect of this change is disabling receive so driver reprograms RL_RXCFG to receive WOL frames when it is put into suspend or shutdown. This should address occasional 'memory modified free' errors seen on recent RealTek controllers. r227914: Make sure to stop TX MAC before freeing queued TX frames. For RTL8111DP, check if the TX MAC is active by reading RL_GTXSTART register. For RTL8402/8168E-VL/8168F/8411, wait until TX queue is empty. r227916: To save more power, switch to 10/100Mbps link when controller is put into suspend/shutdown. Old PCI controllers performed that operation in firmware but for RTL8111C or newer controllers, it's responsibility of driver. It's not clear whether the firmware of RTL8111B still downgrades its speed to 10/100Mbps so leave it as it was. Modified: stable/8/sys/dev/re/if_re.c stable/8/sys/pci/if_rlreg.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/re/if_re.c ============================================================================== --- stable/8/sys/dev/re/if_re.c Wed Jan 4 23:29:57 2012 (r229534) +++ stable/8/sys/dev/re/if_re.c Wed Jan 4 23:31:43 2012 (r229535) @@ -294,6 +294,7 @@ static void re_set_rxmode (struct rl_so static void re_reset (struct rl_softc *); static void re_setwol (struct rl_softc *); static void re_clrwol (struct rl_softc *); +static void re_set_linkspeed (struct rl_softc *); #ifdef RE_DIAG static int re_diag (struct rl_softc *); @@ -1405,13 +1406,18 @@ re_attach(device_t dev) RL_FLAG_AUTOPAD | RL_FLAG_MACSLEEP; break; case RL_HWREV_8401E: - case RL_HWREV_8402: case RL_HWREV_8105E: case RL_HWREV_8105E_SPIN1: sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PHYWAKE_PM | RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | RL_FLAG_FASTETHER | RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD; break; + case RL_HWREV_8402: + sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PHYWAKE_PM | + RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | + RL_FLAG_FASTETHER | RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD | + RL_FLAG_CMDSTOP_WAIT_TXQ; + break; case RL_HWREV_8168B_SPIN1: case RL_HWREV_8168B_SPIN2: sc->rl_flags |= RL_FLAG_WOLRXENB; @@ -1428,22 +1434,28 @@ re_attach(device_t dev) /* FALLTHROUGH */ case RL_HWREV_8168CP: case RL_HWREV_8168D: - case RL_HWREV_8168DP: sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | RL_FLAG_CMDSTOP | - RL_FLAG_AUTOPAD | RL_FLAG_JUMBOV2; + RL_FLAG_AUTOPAD | RL_FLAG_JUMBOV2 | RL_FLAG_WOL_MANLINK; + break; + case RL_HWREV_8168DP: + sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PAR | + RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | RL_FLAG_AUTOPAD | + RL_FLAG_JUMBOV2 | RL_FLAG_WAIT_TXPOLL | RL_FLAG_WOL_MANLINK; break; case RL_HWREV_8168E: sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PHYWAKE_PM | RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | - RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD | RL_FLAG_JUMBOV2; + RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD | RL_FLAG_JUMBOV2 | + RL_FLAG_WOL_MANLINK; break; case RL_HWREV_8168E_VL: case RL_HWREV_8168F: case RL_HWREV_8411: sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | RL_FLAG_CMDSTOP | - RL_FLAG_AUTOPAD | RL_FLAG_JUMBOV2; + RL_FLAG_AUTOPAD | RL_FLAG_JUMBOV2 | + RL_FLAG_CMDSTOP_WAIT_TXQ | RL_FLAG_WOL_MANLINK; break; case RL_HWREV_8169_8110SB: case RL_HWREV_8169_8110SBL: @@ -1594,6 +1606,7 @@ re_attach(device_t dev) if (pci_find_extcap(sc->rl_dev, PCIY_PMG, ®) == 0) ifp->if_capabilities |= IFCAP_WOL; ifp->if_capenable = ifp->if_capabilities; + ifp->if_capenable &= ~(IFCAP_WOL_UCAST | IFCAP_WOL_MCAST); /* * Don't enable TSO by default. It is known to generate * corrupted TCP segments(bad TCP options) under certain @@ -3197,14 +3210,14 @@ re_init_locked(struct rl_softc *sc) if (sc->rl_testmode) return; - mii_mediachg(mii); - CSR_WRITE_1(sc, RL_CFG1, CSR_READ_1(sc, RL_CFG1) | RL_CFG1_DRVLOAD); ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; sc->rl_flags &= ~RL_FLAG_LINK; + mii_mediachg(mii); + sc->rl_watchdog_timer = 0; callout_reset(&sc->rl_stat_callout, hz, re_tick, sc); } @@ -3459,10 +3472,42 @@ re_stop(struct rl_softc *sc) callout_stop(&sc->rl_stat_callout); ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); - if ((sc->rl_flags & RL_FLAG_CMDSTOP) != 0) + /* + * Disable accepting frames to put RX MAC into idle state. + * Otherwise it's possible to get frames while stop command + * execution is in progress and controller can DMA the frame + * to already freed RX buffer during that period. + */ + CSR_WRITE_4(sc, RL_RXCFG, CSR_READ_4(sc, RL_RXCFG) & + ~(RL_RXCFG_RX_ALLPHYS | RL_RXCFG_RX_INDIV | RL_RXCFG_RX_MULTI | + RL_RXCFG_RX_BROAD)); + + if ((sc->rl_flags & RL_FLAG_WAIT_TXPOLL) != 0) { + for (i = RL_TIMEOUT; i > 0; i--) { + if ((CSR_READ_1(sc, sc->rl_txstart) & + RL_TXSTART_START) == 0) + break; + DELAY(20); + } + if (i == 0) + device_printf(sc->rl_dev, + "stopping TX poll timed out!\n"); + CSR_WRITE_1(sc, RL_COMMAND, 0x00); + } else if ((sc->rl_flags & RL_FLAG_CMDSTOP) != 0) { CSR_WRITE_1(sc, RL_COMMAND, RL_CMD_STOPREQ | RL_CMD_TX_ENB | RL_CMD_RX_ENB); - else + if ((sc->rl_flags & RL_FLAG_CMDSTOP_WAIT_TXQ) != 0) { + for (i = RL_TIMEOUT; i > 0; i--) { + if ((CSR_READ_4(sc, RL_TXCFG) & + RL_TXCFG_QUEUE_EMPTY) != 0) + break; + DELAY(100); + } + if (i == 0) + device_printf(sc->rl_dev, + "stopping TXQ timed out!\n"); + } + } else CSR_WRITE_1(sc, RL_COMMAND, 0x00); DELAY(1000); CSR_WRITE_2(sc, RL_IMR, 0x0000); @@ -3588,6 +3633,74 @@ re_shutdown(device_t dev) } static void +re_set_linkspeed(struct rl_softc *sc) +{ + struct mii_softc *miisc; + struct mii_data *mii; + int aneg, i, phyno; + + RL_LOCK_ASSERT(sc); + + mii = device_get_softc(sc->rl_miibus); + mii_pollstat(mii); + aneg = 0; + if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == + (IFM_ACTIVE | IFM_AVALID)) { + switch IFM_SUBTYPE(mii->mii_media_active) { + case IFM_10_T: + case IFM_100_TX: + return; + case IFM_1000_T: + aneg++; + break; + default: + break; + } + } + miisc = LIST_FIRST(&mii->mii_phys); + phyno = miisc->mii_phy; + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) + mii_phy_reset(miisc); + re_miibus_writereg(sc->rl_dev, phyno, MII_100T2CR, 0); + re_miibus_writereg(sc->rl_dev, phyno, + MII_ANAR, ANAR_TX_FD | ANAR_TX | ANAR_10_FD | ANAR_10 | ANAR_CSMA); + re_miibus_writereg(sc->rl_dev, phyno, + MII_BMCR, BMCR_AUTOEN | BMCR_STARTNEG); + DELAY(1000); + if (aneg != 0) { + /* + * Poll link state until re(4) get a 10/100Mbps link. + */ + for (i = 0; i < MII_ANEGTICKS_GIGE; i++) { + mii_pollstat(mii); + if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) + == (IFM_ACTIVE | IFM_AVALID)) { + switch (IFM_SUBTYPE(mii->mii_media_active)) { + case IFM_10_T: + case IFM_100_TX: + return; + default: + break; + } + } + RL_UNLOCK(sc); + pause("relnk", hz); + RL_LOCK(sc); + } + if (i == MII_ANEGTICKS_GIGE) + device_printf(sc->rl_dev, + "establishing a link failed, WOL may not work!"); + } + /* + * No link, force MAC to have 100Mbps, full-duplex link. + * MAC does not require reprogramming on resolved speed/duplex, + * so this is just for completeness. + */ + mii->mii_media_status = IFM_AVALID | IFM_ACTIVE; + mii->mii_media_active = IFM_ETHER | IFM_100_TX | IFM_FDX; +} + +static void re_setwol(struct rl_softc *sc) { struct ifnet *ifp; @@ -3607,9 +3720,13 @@ re_setwol(struct rl_softc *sc) CSR_WRITE_1(sc, RL_GPIO, CSR_READ_1(sc, RL_GPIO) & ~0x01); } - if ((ifp->if_capenable & IFCAP_WOL) != 0 && - (sc->rl_flags & RL_FLAG_WOLRXENB) != 0) - CSR_WRITE_1(sc, RL_COMMAND, RL_CMD_RX_ENB); + if ((ifp->if_capenable & IFCAP_WOL) != 0) { + re_set_rxmode(sc); + if ((sc->rl_flags & RL_FLAG_WOL_MANLINK) != 0) + re_set_linkspeed(sc); + if ((sc->rl_flags & RL_FLAG_WOLRXENB) != 0) + CSR_WRITE_1(sc, RL_COMMAND, RL_CMD_RX_ENB); + } /* Enable config register write. */ CSR_WRITE_1(sc, RL_EECMD, RL_EE_MODE); @@ -3626,12 +3743,9 @@ re_setwol(struct rl_softc *sc) v |= RL_CFG3_WOL_MAGIC; CSR_WRITE_1(sc, RL_CFG3, v); - /* Config register write done. */ - CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_OFF); - v = CSR_READ_1(sc, RL_CFG5); - v &= ~(RL_CFG5_WOL_BCAST | RL_CFG5_WOL_MCAST | RL_CFG5_WOL_UCAST); - v &= ~RL_CFG5_WOL_LANWAKE; + v &= ~(RL_CFG5_WOL_BCAST | RL_CFG5_WOL_MCAST | RL_CFG5_WOL_UCAST | + RL_CFG5_WOL_LANWAKE); if ((ifp->if_capenable & IFCAP_WOL_UCAST) != 0) v |= RL_CFG5_WOL_UCAST; if ((ifp->if_capenable & IFCAP_WOL_MCAST) != 0) @@ -3640,6 +3754,9 @@ re_setwol(struct rl_softc *sc) v |= RL_CFG5_WOL_LANWAKE; CSR_WRITE_1(sc, RL_CFG5, v); + /* Config register write done. */ + CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_OFF); + if ((ifp->if_capenable & IFCAP_WOL) != 0 && (sc->rl_flags & RL_FLAG_PHYWAKE_PM) != 0) CSR_WRITE_1(sc, RL_PMCH, CSR_READ_1(sc, RL_PMCH) & ~0x80); Modified: stable/8/sys/pci/if_rlreg.h ============================================================================== --- stable/8/sys/pci/if_rlreg.h Wed Jan 4 23:29:57 2012 (r229534) +++ stable/8/sys/pci/if_rlreg.h Wed Jan 4 23:31:43 2012 (r229535) @@ -143,6 +143,7 @@ */ #define RL_TXCFG_CLRABRT 0x00000001 /* retransmit aborted pkt */ #define RL_TXCFG_MAXDMA 0x00000700 /* max DMA burst size */ +#define RL_TXCFG_QUEUE_EMPTY 0x00000800 /* 8168E-VL or higher */ #define RL_TXCFG_CRCAPPEND 0x00010000 /* CRC append (0 = yes) */ #define RL_TXCFG_LOOPBKTST 0x00060000 /* loopback test */ #define RL_TXCFG_IFG2 0x00080000 /* 8169 only */ @@ -897,22 +898,25 @@ struct rl_softc { int rl_int_rx_act; int rl_int_rx_mod; uint32_t rl_flags; -#define RL_FLAG_MSI 0x0001 -#define RL_FLAG_AUTOPAD 0x0002 -#define RL_FLAG_PHYWAKE_PM 0x0004 -#define RL_FLAG_PHYWAKE 0x0008 -#define RL_FLAG_JUMBOV2 0x0010 -#define RL_FLAG_PAR 0x0020 -#define RL_FLAG_DESCV2 0x0040 -#define RL_FLAG_MACSTAT 0x0080 -#define RL_FLAG_FASTETHER 0x0100 -#define RL_FLAG_CMDSTOP 0x0200 -#define RL_FLAG_MACRESET 0x0400 -#define RL_FLAG_MSIX 0x0800 -#define RL_FLAG_WOLRXENB 0x1000 -#define RL_FLAG_MACSLEEP 0x2000 -#define RL_FLAG_PCIE 0x4000 -#define RL_FLAG_LINK 0x8000 +#define RL_FLAG_MSI 0x00000001 +#define RL_FLAG_AUTOPAD 0x00000002 +#define RL_FLAG_PHYWAKE_PM 0x00000004 +#define RL_FLAG_PHYWAKE 0x00000008 +#define RL_FLAG_JUMBOV2 0x00000010 +#define RL_FLAG_PAR 0x00000020 +#define RL_FLAG_DESCV2 0x00000040 +#define RL_FLAG_MACSTAT 0x00000080 +#define RL_FLAG_FASTETHER 0x00000100 +#define RL_FLAG_CMDSTOP 0x00000200 +#define RL_FLAG_MACRESET 0x00000400 +#define RL_FLAG_MSIX 0x00000800 +#define RL_FLAG_WOLRXENB 0x00001000 +#define RL_FLAG_MACSLEEP 0x00002000 +#define RL_FLAG_WAIT_TXPOLL 0x00004000 +#define RL_FLAG_CMDSTOP_WAIT_TXQ 0x00008000 +#define RL_FLAG_WOL_MANLINK 0x00010000 +#define RL_FLAG_PCIE 0x40000000 +#define RL_FLAG_LINK 0x80000000 }; #define RL_LOCK(_sc) mtx_lock(&(_sc)->rl_mtx) From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 23:32:51 2012 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 0E87F1065676; Wed, 4 Jan 2012 23:32:51 +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 EFCD28FC08; Wed, 4 Jan 2012 23:32:50 +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 q04NWo6O003717; Wed, 4 Jan 2012 23:32:50 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04NWo2u003714; Wed, 4 Jan 2012 23:32:50 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201042332.q04NWo2u003714@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 4 Jan 2012 23:32:50 +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: r229536 - in stable/7/sys: dev/re pci 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, 04 Jan 2012 23:32:51 -0000 Author: yongari Date: Wed Jan 4 23:32:50 2012 New Revision: 229536 URL: http://svn.freebsd.org/changeset/base/229536 Log: MFC r227850-227851,227854,227914,227916: r227850: Writing access to RL_CFG5 register also requires EEPROM write access. While I'm here, enable WOL through magic packet but disable waking up system via unicast, multicast and broadcast frames. Otherwise, multicast or unicast frame(e.g. ICMP echo request) can wake up system which is not probably wanted behavior on most environments. This was not known as problem because RL_CFG5 register access had not effect until this change. The capability to wake up system with unicast/multicast frames are still set in driver, default off, so users who need that feature can still activate it with ifconfig(8). r227851: Perform media change after setting IFF_DRV_RUNNING flag. Without it, driver would ignore the first link state update if controller already established a link such that it would have to take additional link state handling in re_tick(). r227854: Disable accepting frames in re_stop() to put RX MAC into idle state. Because there is no reliable way to know whether RX MAC is in stopped state, rejecting all frames would be the only way to minimize possible races. Otherwise it's possible to receive frames while stop command execution is in progress and controller can DMA the frame to freed RX buffer during that period. This was observed on recent PCIe controllers(i.e. RTL8111F). While this change may not be required on old controllers it wouldn't make negative effects on old controllers. One side effect of this change is disabling receive so driver reprograms RL_RXCFG to receive WOL frames when it is put into suspend or shutdown. This should address occasional 'memory modified free' errors seen on recent RealTek controllers. r227914: Make sure to stop TX MAC before freeing queued TX frames. For RTL8111DP, check if the TX MAC is active by reading RL_GTXSTART register. For RTL8402/8168E-VL/8168F/8411, wait until TX queue is empty. r227916: To save more power, switch to 10/100Mbps link when controller is put into suspend/shutdown. Old PCI controllers performed that operation in firmware but for RTL8111C or newer controllers, it's responsibility of driver. It's not clear whether the firmware of RTL8111B still downgrades its speed to 10/100Mbps so leave it as it was. Modified: stable/7/sys/dev/re/if_re.c stable/7/sys/pci/if_rlreg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/re/if_re.c ============================================================================== --- stable/7/sys/dev/re/if_re.c Wed Jan 4 23:31:43 2012 (r229535) +++ stable/7/sys/dev/re/if_re.c Wed Jan 4 23:32:50 2012 (r229536) @@ -294,6 +294,7 @@ static void re_set_rxmode (struct rl_so static void re_reset (struct rl_softc *); static void re_setwol (struct rl_softc *); static void re_clrwol (struct rl_softc *); +static void re_set_linkspeed (struct rl_softc *); #ifdef RE_DIAG static int re_diag (struct rl_softc *); @@ -1406,13 +1407,18 @@ re_attach(device_t dev) RL_FLAG_AUTOPAD | RL_FLAG_MACSLEEP; break; case RL_HWREV_8401E: - case RL_HWREV_8402: case RL_HWREV_8105E: case RL_HWREV_8105E_SPIN1: sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PHYWAKE_PM | RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | RL_FLAG_FASTETHER | RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD; break; + case RL_HWREV_8402: + sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PHYWAKE_PM | + RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | + RL_FLAG_FASTETHER | RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD | + RL_FLAG_CMDSTOP_WAIT_TXQ; + break; case RL_HWREV_8168B_SPIN1: case RL_HWREV_8168B_SPIN2: sc->rl_flags |= RL_FLAG_WOLRXENB; @@ -1429,22 +1435,28 @@ re_attach(device_t dev) /* FALLTHROUGH */ case RL_HWREV_8168CP: case RL_HWREV_8168D: - case RL_HWREV_8168DP: sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | RL_FLAG_CMDSTOP | - RL_FLAG_AUTOPAD | RL_FLAG_JUMBOV2; + RL_FLAG_AUTOPAD | RL_FLAG_JUMBOV2 | RL_FLAG_WOL_MANLINK; + break; + case RL_HWREV_8168DP: + sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PAR | + RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | RL_FLAG_AUTOPAD | + RL_FLAG_JUMBOV2 | RL_FLAG_WAIT_TXPOLL | RL_FLAG_WOL_MANLINK; break; case RL_HWREV_8168E: sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PHYWAKE_PM | RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | - RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD | RL_FLAG_JUMBOV2; + RL_FLAG_CMDSTOP | RL_FLAG_AUTOPAD | RL_FLAG_JUMBOV2 | + RL_FLAG_WOL_MANLINK; break; case RL_HWREV_8168E_VL: case RL_HWREV_8168F: case RL_HWREV_8411: sc->rl_flags |= RL_FLAG_PHYWAKE | RL_FLAG_PAR | RL_FLAG_DESCV2 | RL_FLAG_MACSTAT | RL_FLAG_CMDSTOP | - RL_FLAG_AUTOPAD | RL_FLAG_JUMBOV2; + RL_FLAG_AUTOPAD | RL_FLAG_JUMBOV2 | + RL_FLAG_CMDSTOP_WAIT_TXQ | RL_FLAG_WOL_MANLINK; break; case RL_HWREV_8169_8110SB: case RL_HWREV_8169_8110SBL: @@ -1595,6 +1607,7 @@ re_attach(device_t dev) if (pci_find_extcap(sc->rl_dev, PCIY_PMG, ®) == 0) ifp->if_capabilities |= IFCAP_WOL; ifp->if_capenable = ifp->if_capabilities; + ifp->if_capenable &= ~(IFCAP_WOL_UCAST | IFCAP_WOL_MCAST); /* * Don't enable TSO by default. It is known to generate * corrupted TCP segments(bad TCP options) under certain @@ -3191,14 +3204,14 @@ re_init_locked(struct rl_softc *sc) if (sc->rl_testmode) return; - mii_mediachg(mii); - CSR_WRITE_1(sc, RL_CFG1, CSR_READ_1(sc, RL_CFG1) | RL_CFG1_DRVLOAD); ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; sc->rl_flags &= ~RL_FLAG_LINK; + mii_mediachg(mii); + sc->rl_watchdog_timer = 0; callout_reset(&sc->rl_stat_callout, hz, re_tick, sc); } @@ -3453,10 +3466,42 @@ re_stop(struct rl_softc *sc) callout_stop(&sc->rl_stat_callout); ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); - if ((sc->rl_flags & RL_FLAG_CMDSTOP) != 0) + /* + * Disable accepting frames to put RX MAC into idle state. + * Otherwise it's possible to get frames while stop command + * execution is in progress and controller can DMA the frame + * to already freed RX buffer during that period. + */ + CSR_WRITE_4(sc, RL_RXCFG, CSR_READ_4(sc, RL_RXCFG) & + ~(RL_RXCFG_RX_ALLPHYS | RL_RXCFG_RX_INDIV | RL_RXCFG_RX_MULTI | + RL_RXCFG_RX_BROAD)); + + if ((sc->rl_flags & RL_FLAG_WAIT_TXPOLL) != 0) { + for (i = RL_TIMEOUT; i > 0; i--) { + if ((CSR_READ_1(sc, sc->rl_txstart) & + RL_TXSTART_START) == 0) + break; + DELAY(20); + } + if (i == 0) + device_printf(sc->rl_dev, + "stopping TX poll timed out!\n"); + CSR_WRITE_1(sc, RL_COMMAND, 0x00); + } else if ((sc->rl_flags & RL_FLAG_CMDSTOP) != 0) { CSR_WRITE_1(sc, RL_COMMAND, RL_CMD_STOPREQ | RL_CMD_TX_ENB | RL_CMD_RX_ENB); - else + if ((sc->rl_flags & RL_FLAG_CMDSTOP_WAIT_TXQ) != 0) { + for (i = RL_TIMEOUT; i > 0; i--) { + if ((CSR_READ_4(sc, RL_TXCFG) & + RL_TXCFG_QUEUE_EMPTY) != 0) + break; + DELAY(100); + } + if (i == 0) + device_printf(sc->rl_dev, + "stopping TXQ timed out!\n"); + } + } else CSR_WRITE_1(sc, RL_COMMAND, 0x00); DELAY(1000); CSR_WRITE_2(sc, RL_IMR, 0x0000); @@ -3582,6 +3627,74 @@ re_shutdown(device_t dev) } static void +re_set_linkspeed(struct rl_softc *sc) +{ + struct mii_softc *miisc; + struct mii_data *mii; + int aneg, i, phyno; + + RL_LOCK_ASSERT(sc); + + mii = device_get_softc(sc->rl_miibus); + mii_pollstat(mii); + aneg = 0; + if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == + (IFM_ACTIVE | IFM_AVALID)) { + switch IFM_SUBTYPE(mii->mii_media_active) { + case IFM_10_T: + case IFM_100_TX: + return; + case IFM_1000_T: + aneg++; + break; + default: + break; + } + } + miisc = LIST_FIRST(&mii->mii_phys); + phyno = miisc->mii_phy; + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) + mii_phy_reset(miisc); + re_miibus_writereg(sc->rl_dev, phyno, MII_100T2CR, 0); + re_miibus_writereg(sc->rl_dev, phyno, + MII_ANAR, ANAR_TX_FD | ANAR_TX | ANAR_10_FD | ANAR_10 | ANAR_CSMA); + re_miibus_writereg(sc->rl_dev, phyno, + MII_BMCR, BMCR_AUTOEN | BMCR_STARTNEG); + DELAY(1000); + if (aneg != 0) { + /* + * Poll link state until re(4) get a 10/100Mbps link. + */ + for (i = 0; i < MII_ANEGTICKS_GIGE; i++) { + mii_pollstat(mii); + if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) + == (IFM_ACTIVE | IFM_AVALID)) { + switch (IFM_SUBTYPE(mii->mii_media_active)) { + case IFM_10_T: + case IFM_100_TX: + return; + default: + break; + } + } + RL_UNLOCK(sc); + pause("relnk", hz); + RL_LOCK(sc); + } + if (i == MII_ANEGTICKS_GIGE) + device_printf(sc->rl_dev, + "establishing a link failed, WOL may not work!"); + } + /* + * No link, force MAC to have 100Mbps, full-duplex link. + * MAC does not require reprogramming on resolved speed/duplex, + * so this is just for completeness. + */ + mii->mii_media_status = IFM_AVALID | IFM_ACTIVE; + mii->mii_media_active = IFM_ETHER | IFM_100_TX | IFM_FDX; +} + +static void re_setwol(struct rl_softc *sc) { struct ifnet *ifp; @@ -3601,9 +3714,13 @@ re_setwol(struct rl_softc *sc) CSR_WRITE_1(sc, RL_GPIO, CSR_READ_1(sc, RL_GPIO) & ~0x01); } - if ((ifp->if_capenable & IFCAP_WOL) != 0 && - (sc->rl_flags & RL_FLAG_WOLRXENB) != 0) - CSR_WRITE_1(sc, RL_COMMAND, RL_CMD_RX_ENB); + if ((ifp->if_capenable & IFCAP_WOL) != 0) { + re_set_rxmode(sc); + if ((sc->rl_flags & RL_FLAG_WOL_MANLINK) != 0) + re_set_linkspeed(sc); + if ((sc->rl_flags & RL_FLAG_WOLRXENB) != 0) + CSR_WRITE_1(sc, RL_COMMAND, RL_CMD_RX_ENB); + } /* Enable config register write. */ CSR_WRITE_1(sc, RL_EECMD, RL_EE_MODE); @@ -3620,12 +3737,9 @@ re_setwol(struct rl_softc *sc) v |= RL_CFG3_WOL_MAGIC; CSR_WRITE_1(sc, RL_CFG3, v); - /* Config register write done. */ - CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_OFF); - v = CSR_READ_1(sc, RL_CFG5); - v &= ~(RL_CFG5_WOL_BCAST | RL_CFG5_WOL_MCAST | RL_CFG5_WOL_UCAST); - v &= ~RL_CFG5_WOL_LANWAKE; + v &= ~(RL_CFG5_WOL_BCAST | RL_CFG5_WOL_MCAST | RL_CFG5_WOL_UCAST | + RL_CFG5_WOL_LANWAKE); if ((ifp->if_capenable & IFCAP_WOL_UCAST) != 0) v |= RL_CFG5_WOL_UCAST; if ((ifp->if_capenable & IFCAP_WOL_MCAST) != 0) @@ -3634,6 +3748,9 @@ re_setwol(struct rl_softc *sc) v |= RL_CFG5_WOL_LANWAKE; CSR_WRITE_1(sc, RL_CFG5, v); + /* Config register write done. */ + CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_OFF); + if ((ifp->if_capenable & IFCAP_WOL) != 0 && (sc->rl_flags & RL_FLAG_PHYWAKE_PM) != 0) CSR_WRITE_1(sc, RL_PMCH, CSR_READ_1(sc, RL_PMCH) & ~0x80); Modified: stable/7/sys/pci/if_rlreg.h ============================================================================== --- stable/7/sys/pci/if_rlreg.h Wed Jan 4 23:31:43 2012 (r229535) +++ stable/7/sys/pci/if_rlreg.h Wed Jan 4 23:32:50 2012 (r229536) @@ -143,6 +143,7 @@ */ #define RL_TXCFG_CLRABRT 0x00000001 /* retransmit aborted pkt */ #define RL_TXCFG_MAXDMA 0x00000700 /* max DMA burst size */ +#define RL_TXCFG_QUEUE_EMPTY 0x00000800 /* 8168E-VL or higher */ #define RL_TXCFG_CRCAPPEND 0x00010000 /* CRC append (0 = yes) */ #define RL_TXCFG_LOOPBKTST 0x00060000 /* loopback test */ #define RL_TXCFG_IFG2 0x00080000 /* 8169 only */ @@ -914,22 +915,25 @@ struct rl_softc { int rl_int_rx_act; int rl_int_rx_mod; uint32_t rl_flags; -#define RL_FLAG_MSI 0x0001 -#define RL_FLAG_AUTOPAD 0x0002 -#define RL_FLAG_PHYWAKE_PM 0x0004 -#define RL_FLAG_PHYWAKE 0x0008 -#define RL_FLAG_JUMBOV2 0x0010 -#define RL_FLAG_PAR 0x0020 -#define RL_FLAG_DESCV2 0x0040 -#define RL_FLAG_MACSTAT 0x0080 -#define RL_FLAG_FASTETHER 0x0100 -#define RL_FLAG_CMDSTOP 0x0200 -#define RL_FLAG_MACRESET 0x0400 -#define RL_FLAG_MSIX 0x0800 -#define RL_FLAG_WOLRXENB 0x1000 -#define RL_FLAG_MACSLEEP 0x2000 -#define RL_FLAG_PCIE 0x4000 -#define RL_FLAG_LINK 0x8000 +#define RL_FLAG_MSI 0x00000001 +#define RL_FLAG_AUTOPAD 0x00000002 +#define RL_FLAG_PHYWAKE_PM 0x00000004 +#define RL_FLAG_PHYWAKE 0x00000008 +#define RL_FLAG_JUMBOV2 0x00000010 +#define RL_FLAG_PAR 0x00000020 +#define RL_FLAG_DESCV2 0x00000040 +#define RL_FLAG_MACSTAT 0x00000080 +#define RL_FLAG_FASTETHER 0x00000100 +#define RL_FLAG_CMDSTOP 0x00000200 +#define RL_FLAG_MACRESET 0x00000400 +#define RL_FLAG_MSIX 0x00000800 +#define RL_FLAG_WOLRXENB 0x00001000 +#define RL_FLAG_MACSLEEP 0x00002000 +#define RL_FLAG_WAIT_TXPOLL 0x00004000 +#define RL_FLAG_CMDSTOP_WAIT_TXQ 0x00008000 +#define RL_FLAG_WOL_MANLINK 0x00010000 +#define RL_FLAG_PCIE 0x40000000 +#define RL_FLAG_LINK 0x80000000 }; #define RL_LOCK(_sc) mtx_lock(&(_sc)->rl_mtx) From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 23:39:11 2012 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 C47331065673; Wed, 4 Jan 2012 23:39:11 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B1A2E8FC0C; Wed, 4 Jan 2012 23:39: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 q04NdB6V003995; Wed, 4 Jan 2012 23:39:11 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04NdBB4003990; Wed, 4 Jan 2012 23:39:11 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201201042339.q04NdBB4003990@svn.freebsd.org> From: Aleksandr Rybalko Date: Wed, 4 Jan 2012 23:39: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: r229537 - in head/sys: conf geom/uncompress modules/geom/geom_uncompress 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, 04 Jan 2012 23:39:11 -0000 Author: ray Date: Wed Jan 4 23:39:11 2012 New Revision: 229537 URL: http://svn.freebsd.org/changeset/base/229537 Log: GEOM_UNCOMPRESS module, can be used with uzip images and with new ulzma images. Approved by: adrian (mentor) Added: head/sys/geom/uncompress/ head/sys/geom/uncompress/g_uncompress.c (contents, props changed) head/sys/modules/geom/geom_uncompress/ head/sys/modules/geom/geom_uncompress/Makefile (contents, props changed) Modified: head/sys/conf/files head/sys/conf/options Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Wed Jan 4 23:32:50 2012 (r229536) +++ head/sys/conf/files Wed Jan 4 23:39:11 2012 (r229537) @@ -2266,20 +2266,21 @@ geom/raid3/g_raid3.c optional geom_raid geom/raid3/g_raid3_ctl.c optional geom_raid3 geom/shsec/g_shsec.c optional geom_shsec geom/stripe/g_stripe.c optional geom_stripe +geom/uncompress/g_uncompress.c optional geom_uncompress contrib/xz-embedded/freebsd/xz_malloc.c \ - optional xz_embedded \ + optional xz_embedded | geom_uncompress \ compile-with "${NORMAL_C} -I$S/contrib/xz-embedded/freebsd/ -I$S/contrib/xz-embedded/linux/lib/xz/ -I$S/contrib/xz-embedded/linux/include/linux/" contrib/xz-embedded/linux/lib/xz/xz_crc32.c \ - optional xz_embedded \ + optional xz_embedded | geom_uncompress \ compile-with "${NORMAL_C} -I$S/contrib/xz-embedded/freebsd/ -I$S/contrib/xz-embedded/linux/lib/xz/ -I$S/contrib/xz-embedded/linux/include/linux/" contrib/xz-embedded/linux/lib/xz/xz_dec_bcj.c \ - optional xz_embedded \ + optional xz_embedded | geom_uncompress \ compile-with "${NORMAL_C} -I$S/contrib/xz-embedded/freebsd/ -I$S/contrib/xz-embedded/linux/lib/xz/ -I$S/contrib/xz-embedded/linux/include/linux/" contrib/xz-embedded/linux/lib/xz/xz_dec_lzma2.c \ - optional xz_embedded \ + optional xz_embedded | geom_uncompress \ compile-with "${NORMAL_C} -I$S/contrib/xz-embedded/freebsd/ -I$S/contrib/xz-embedded/linux/lib/xz/ -I$S/contrib/xz-embedded/linux/include/linux/" contrib/xz-embedded/linux/lib/xz/xz_dec_stream.c \ - optional xz_embedded \ + optional xz_embedded | geom_uncompress \ compile-with "${NORMAL_C} -I$S/contrib/xz-embedded/freebsd/ -I$S/contrib/xz-embedded/linux/lib/xz/ -I$S/contrib/xz-embedded/linux/include/linux/" geom/uzip/g_uzip.c optional geom_uzip geom/virstor/binstream.c optional geom_virstor @@ -2651,7 +2652,7 @@ net/slcompress.c optional netgraph_vjc net/vnet.c optional vimage net/zlib.c optional crypto | geom_uzip | ipsec | \ mxge | netgraph_deflate | \ - ddb_ctf | gzio + ddb_ctf | gzio | geom_uncompress net80211/ieee80211.c optional wlan net80211/ieee80211_acl.c optional wlan wlan_acl net80211/ieee80211_action.c optional wlan Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Wed Jan 4 23:32:50 2012 (r229536) +++ head/sys/conf/options Wed Jan 4 23:39:11 2012 (r229537) @@ -112,6 +112,7 @@ GEOM_RAID3 opt_geom.h GEOM_SHSEC opt_geom.h GEOM_STRIPE opt_geom.h GEOM_SUNLABEL opt_geom.h +GEOM_UNCOMPRESS opt_geom.h GEOM_UZIP opt_geom.h GEOM_VIRSTOR opt_geom.h GEOM_VOL opt_geom.h Added: head/sys/geom/uncompress/g_uncompress.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/geom/uncompress/g_uncompress.c Wed Jan 4 23:39:11 2012 (r229537) @@ -0,0 +1,670 @@ +/*- + * Copyright (c) 2010-2012 Aleksandr Rybalko + * Copyright (c) 2004 Max Khon + * 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 THE AUTHOR AND CONTRIBUTORS ``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 THE AUTHOR 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. + */ + +/* + * GEOM UNCOMPRESS module - simple decompression module for use with read-only + * copressed images maked by mkuzip(8) or mkulzma(8) utilities. + * + * To enable module in kernel config, put this line: + * device geom_uncompress + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#ifdef GEOM_UNCOMPRESS_DEBUG +#define DPRINTF(a) printf a +extern int g_debugflags; +#else +#define DPRINTF(a) +#endif + +static MALLOC_DEFINE(M_GEOM_UNCOMPRESS, "geom_uncompress", + "GEOM UNCOMPRESS data structures"); + +#define UNCOMPRESS_CLASS_NAME "UNCOMPRESS" +#define GEOM_UZIP_MAJVER '2' +#define GEOM_ULZMA_MAJVER '3' + +/* + * Maximum allowed valid block size (to prevent foot-shooting) + */ +#define MAX_BLKSZ (MAXPHYS) + +/* + * Integer values (block size, number of blocks, offsets) + * are stored in big-endian (network) order on disk and struct cloop_header + * and in native order in struct g_uncompress_softc + */ + +#define CLOOP_MAGIC_LEN 128 +static char CLOOP_MAGIC_START[] = "#!/bin/sh\n"; + +struct cloop_header { + char magic[CLOOP_MAGIC_LEN]; /* cloop magic */ + uint32_t blksz; /* block size */ + uint32_t nblocks; /* number of blocks */ +}; + +struct g_uncompress_softc { + uint32_t blksz; /* block size */ + uint32_t nblocks; /* number of blocks */ + uint64_t *offsets; + enum { + GEOM_UZIP = 1, + GEOM_ULZMA + } type; + + struct mtx last_mtx; + uint32_t last_blk; /* last blk no */ + char *last_buf; /* last blk data */ + int req_total; /* total requests */ + int req_cached; /* cached requests */ + + /* XZ decoder structs */ + struct xz_buf *b; + struct xz_dec *s; + z_stream *zs; +}; + +static void +g_uncompress_softc_free(struct g_uncompress_softc *sc, struct g_geom *gp) +{ + + if (gp != NULL) { + printf("%s: %d requests, %d cached\n", + gp->name, sc->req_total, sc->req_cached); + } + if (sc->offsets != NULL) { + free(sc->offsets, M_GEOM_UNCOMPRESS); + sc->offsets = 0; + } + + switch (sc->type) { + case GEOM_ULZMA: + if (sc->b) { + free(sc->b, M_GEOM_UNCOMPRESS); + sc->b = 0; + } + if (sc->s) { + xz_dec_end(sc->s); + sc->s = 0; + } + break; + case GEOM_UZIP: + if (sc->zs) { + inflateEnd(sc->zs); + free(sc->zs, M_GEOM_UNCOMPRESS); + sc->zs = 0; + } + break; + } + + mtx_destroy(&sc->last_mtx); + free(sc->last_buf, M_GEOM_UNCOMPRESS); + free(sc, M_GEOM_UNCOMPRESS); +} + +static void * +z_alloc(void *nil, u_int type, u_int size) +{ + void *ptr; + + ptr = malloc(type * size, M_GEOM_UNCOMPRESS, M_NOWAIT); + return (ptr); +} + +static void +z_free(void *nil, void *ptr) +{ + + free(ptr, M_GEOM_UNCOMPRESS); +} + +static void +g_uncompress_done(struct bio *bp) +{ + struct g_uncompress_softc *sc; + struct g_provider *pp, *pp2; + struct g_consumer *cp; + struct g_geom *gp; + struct bio *bp2; + uint32_t start_blk, i; + off_t pos, upos; + size_t bsize; + int err; + + err = 0; + bp2 = bp->bio_parent; + pp = bp2->bio_to; + gp = pp->geom; + cp = LIST_FIRST(&gp->consumer); + pp2 = cp->provider; + sc = gp->softc; + DPRINTF(("%s: done\n", gp->name)); + + bp2->bio_error = bp->bio_error; + if (bp2->bio_error != 0) + goto done; + + /* + * Example: + * Uncompressed block size = 65536 + * User request: 65540-261632 + * (4 uncompressed blocks -4B at start, -512B at end) + * + * We have 512(secsize)*63(nsec) = 32256B at offset 1024 + * From: 1024 bp->bio_offset = 1024 + * To: 33280 bp->bio_length = 33280 - 1024 = 32256 + * Compressed blocks: 0-1020, 1020-1080, 1080-4845, 4845-12444, + * 12444-33210, 33210-44100, ... + * + * Get start_blk from user request: + * start_blk = bp2->bio_offset / 65536 = 65540/65536 = 1 + * bsize (block size of parent) = pp2->sectorsize (Now is 4B) + * pos(in stream from parent) = sc->offsets[start_blk] % bsize = + * = sc->offsets[1] % 4 = 1020 % 4 = 0 + */ + + /* + * Uncompress data. + */ + start_blk = bp2->bio_offset / sc->blksz; + bsize = pp2->sectorsize; + pos = sc->offsets[start_blk] % bsize; + upos = 0; + + DPRINTF(("%s: done: bio_length %lld bio_completed %lld start_blk %d, " + "pos %lld, upos %lld (%lld, %d, %d)\n", + gp->name, bp->bio_length, bp->bio_completed, start_blk, pos, upos, + bp2->bio_offset, sc->blksz, bsize)); + + for (i = start_blk; upos < bp2->bio_length; i++) { + off_t len, dlen, ulen, uoff; + + uoff = i == start_blk ? bp2->bio_offset % sc->blksz : 0; + ulen = MIN(sc->blksz - uoff, bp2->bio_length - upos); + dlen = len = sc->offsets[i + 1] - sc->offsets[i]; + + DPRINTF(("%s: done: inflate block %d, start %lld, end %lld " + "len %lld\n", + gp->name, i, sc->offsets[i], sc->offsets[i + 1], len)); + + if (len == 0) { + /* All zero block: no cache update */ + bzero(bp2->bio_data + upos, ulen); + upos += ulen; + bp2->bio_completed += ulen; + continue; + } + + mtx_lock(&sc->last_mtx); + +#ifdef GEOM_UNCOMPRESS_DEBUG + if (g_debugflags & 32) + hexdump(bp->bio_data + pos, dlen, 0, 0); +#endif + + switch (sc->type) { + case GEOM_ULZMA: + sc->b->in = bp->bio_data + pos; + sc->b->out = sc->last_buf; + sc->b->in_pos = sc->b->out_pos = 0; + sc->b->in_size = dlen; + sc->b->out_size = (size_t)-1; + + err = (xz_dec_run(sc->s, sc->b) != XZ_STREAM_END) ? + 1 : 0; + /* TODO decoder recovery, if needed */ + break; + case GEOM_UZIP: + sc->zs->next_in = bp->bio_data + pos; + sc->zs->avail_in = dlen; + sc->zs->next_out = sc->last_buf; + sc->zs->avail_out = sc->blksz; + + err = (inflate(sc->zs, Z_FINISH) != Z_STREAM_END) ? + 1 : 0; + if ((err) && (inflateReset(sc->zs) != Z_OK)) + printf("%s: UZIP decoder reset failed\n", + gp->name); + break; + } + + if (err) { + sc->last_blk = -1; + mtx_unlock(&sc->last_mtx); + DPRINTF(("%s: done: inflate failed, code=%d\n", + gp->name, err)); + bp2->bio_error = EIO; + goto done; + } + +#ifdef GEOM_UNCOMPRESS_DEBUG + if (g_debugflags & 32) + hexdump(sc->last_buf, sc->b->out_size, 0, 0); +#endif + + sc->last_blk = i; + DPRINTF(("%s: done: inflated \n", gp->name)); + memcpy(bp2->bio_data + upos, sc->last_buf + uoff, ulen); + mtx_unlock(&sc->last_mtx); + + pos += len; + upos += ulen; + bp2->bio_completed += ulen; + } + +done: + /* + * Finish processing the request. + */ + DPRINTF(("%s: done: (%d, %lld, %ld)\n", + gp->name, bp2->bio_error, bp2->bio_completed, bp2->bio_resid)); + free(bp->bio_data, M_GEOM_UNCOMPRESS); + g_destroy_bio(bp); + g_io_deliver(bp2, bp2->bio_error); +} + +static void +g_uncompress_start(struct bio *bp) +{ + struct g_uncompress_softc *sc; + struct g_provider *pp, *pp2; + struct g_consumer *cp; + struct g_geom *gp; + struct bio *bp2; + uint32_t start_blk, end_blk; + size_t bsize; + + + pp = bp->bio_to; + gp = pp->geom; + DPRINTF(("%s: start (%s) to %s off=%lld len=%lld\n", gp->name, + (bp->bio_cmd==BIO_READ) ? "BIO_READ" : "BIO_WRITE*", + pp->name, bp->bio_offset, bp->bio_length)); + + if (bp->bio_cmd != BIO_READ) { + g_io_deliver(bp, EOPNOTSUPP); + return; + } + + cp = LIST_FIRST(&gp->consumer); + pp2 = cp->provider; + sc = gp->softc; + + start_blk = bp->bio_offset / sc->blksz; + end_blk = howmany(bp->bio_offset + bp->bio_length, sc->blksz); + KASSERT(start_blk < sc->nblocks, + ("start_blk out of range")); + KASSERT(end_blk <= sc->nblocks, + ("end_blk out of range")); + + sc->req_total++; + if (start_blk + 1 == end_blk) { + mtx_lock(&sc->last_mtx); + if (start_blk == sc->last_blk) { + off_t uoff; + + uoff = bp->bio_offset % sc->blksz; + KASSERT(bp->bio_length <= sc->blksz - uoff, + ("cached data error")); + memcpy(bp->bio_data, sc->last_buf + uoff, + bp->bio_length); + sc->req_cached++; + mtx_unlock(&sc->last_mtx); + + DPRINTF(("%s: start: cached 0 + %lld, " + "%lld + 0 + %lld\n", + gp->name, bp->bio_length, uoff, bp->bio_length)); + bp->bio_completed = bp->bio_length; + g_io_deliver(bp, 0); + return; + } + mtx_unlock(&sc->last_mtx); + } + + bp2 = g_clone_bio(bp); + if (bp2 == NULL) { + g_io_deliver(bp, ENOMEM); + return; + } + DPRINTF(("%s: start (%d..%d), %s: %d + %llu, %s: %d + %llu\n", + gp->name, start_blk, end_blk, + pp->name, pp->sectorsize, pp->mediasize, + pp2->name, pp2->sectorsize, pp2->mediasize)); + + bsize = pp2->sectorsize; + + bp2->bio_done = g_uncompress_done; + bp2->bio_offset = rounddown(sc->offsets[start_blk],bsize); + bp2->bio_length = roundup(sc->offsets[end_blk],bsize) - + bp2->bio_offset; + bp2->bio_data = malloc(bp2->bio_length, M_GEOM_UNCOMPRESS, M_NOWAIT); + + DPRINTF(("%s: start %lld + %lld -> %lld + %lld -> %lld + %lld\n", + gp->name, + bp->bio_offset, bp->bio_length, + sc->offsets[start_blk], + sc->offsets[end_blk] - sc->offsets[start_blk], + bp2->bio_offset, bp2->bio_length)); + + if (bp2->bio_data == NULL) { + g_destroy_bio(bp2); + g_io_deliver(bp, ENOMEM); + return; + } + + g_io_request(bp2, cp); + DPRINTF(("%s: start ok\n", gp->name)); +} + +static void +g_uncompress_orphan(struct g_consumer *cp) +{ + struct g_geom *gp; + + g_trace(G_T_TOPOLOGY, "%s(%p/%s)", __func__, cp, + cp->provider->name); + g_topology_assert(); + KASSERT(cp->provider->error != 0, + ("g_uncompress_orphan with error == 0")); + + gp = cp->geom; + g_uncompress_softc_free(gp->softc, gp); + gp->softc = NULL; + g_wither_geom(gp, cp->provider->error); +} + +static int +g_uncompress_access(struct g_provider *pp, int dr, int dw, int de) +{ + struct g_consumer *cp; + struct g_geom *gp; + + gp = pp->geom; + cp = LIST_FIRST(&gp->consumer); + KASSERT (cp != NULL, ("g_uncompress_access but no consumer")); + + if (cp->acw + dw > 0) + return (EROFS); + + return (g_access(cp, dr, dw, de)); +} + +static void +g_uncompress_spoiled(struct g_consumer *cp) +{ + struct g_geom *gp; + + gp = cp->geom; + g_trace(G_T_TOPOLOGY, "%s(%p/%s)", __func__, cp, gp->name); + g_topology_assert(); + + g_uncompress_softc_free(gp->softc, gp); + gp->softc = NULL; + g_wither_geom(gp, ENXIO); +} + +static struct g_geom * +g_uncompress_taste(struct g_class *mp, struct g_provider *pp, int flags) +{ + struct cloop_header *header; + struct g_uncompress_softc *sc; + struct g_provider *pp2; + struct g_consumer *cp; + struct g_geom *gp; + uint32_t i, total_offsets, offsets_read, type; + uint8_t *buf; + int error; + + g_trace(G_T_TOPOLOGY, "%s(%s,%s)", __func__, mp->name, pp->name); + g_topology_assert(); + + /* Skip providers that are already open for writing. */ + if (pp->acw > 0) + return (NULL); + + buf = NULL; + + /* + * Create geom instance. + */ + gp = g_new_geomf(mp, "%s.uncompress", pp->name); + cp = g_new_consumer(gp); + error = g_attach(cp, pp); + if (error == 0) + error = g_access(cp, 1, 0, 0); + if (error) { + g_detach(cp); + g_destroy_consumer(cp); + g_destroy_geom(gp); + return (NULL); + } + g_topology_unlock(); + + /* + * Read cloop header, look for CLOOP magic, perform + * other validity checks. + */ + DPRINTF(("%s: media sectorsize %u, mediasize %lld\n", + gp->name, pp->sectorsize, pp->mediasize)); + + i = roundup(sizeof(struct cloop_header), pp->sectorsize); + buf = g_read_data(cp, 0, i, NULL); + if (buf == NULL) + goto err; + + header = (struct cloop_header *) buf; + if (strncmp(header->magic, CLOOP_MAGIC_START, + sizeof(CLOOP_MAGIC_START) - 1) != 0) { + DPRINTF(("%s: no CLOOP magic\n", gp->name)); + goto err; + } + + switch (header->magic[0x0b]) { + case 'L': + type = GEOM_ULZMA; + if (header->magic[0x0c] < GEOM_ULZMA_MAJVER) { + DPRINTF(("%s: image version too old\n", gp->name)); + goto err; + } + printf("%s: GEOM_ULZMA image found\n", gp->name); + break; + case 'V': + type = GEOM_UZIP; + if (header->magic[0x0c] < GEOM_UZIP_MAJVER) { + DPRINTF(("%s: image version too old\n", gp->name)); + goto err; + } + printf("%s: GEOM_UZIP image found\n", gp->name); + break; + default: + DPRINTF(("%s: unsupported image type\n", gp->name)); + goto err; + } + + DPRINTF(("%s: found CLOOP magic\n", gp->name)); + /* + * Initialize softc and read offsets. + */ + sc = malloc(sizeof(*sc), M_GEOM_UNCOMPRESS, M_WAITOK | M_ZERO); + gp->softc = sc; + sc->type = type; + sc->blksz = ntohl(header->blksz); + sc->nblocks = ntohl(header->nblocks); + if (sc->blksz % 4 != 0) { + printf("%s: block size (%u) should be multiple of 4.\n", + gp->name, sc->blksz); + goto err; + } + if (sc->blksz > MAX_BLKSZ) { + printf("%s: block size (%u) should not be larger than %d.\n", + gp->name, sc->blksz, MAX_BLKSZ); + } + total_offsets = sc->nblocks + 1; + if (sizeof(struct cloop_header) + + total_offsets * sizeof(uint64_t) > pp->mediasize) { + printf("%s: media too small for %u blocks\n", + gp->name, sc->nblocks); + goto err; + } + sc->offsets = malloc( + total_offsets * sizeof(uint64_t), M_GEOM_UNCOMPRESS, M_WAITOK); + offsets_read = MIN(total_offsets, + (pp->sectorsize - sizeof(*header)) / sizeof(uint64_t)); + for (i = 0; i < offsets_read; i++) + sc->offsets[i] = be64toh(((uint64_t *) (header + 1))[i]); + DPRINTF(("%s: %u offsets in the first sector\n", + gp->name, offsets_read)); + + free(buf, M_GEOM); + i = roundup((sizeof(struct cloop_header) + + total_offsets * sizeof(uint64_t)),pp->sectorsize); + buf = g_read_data(cp, 0, i, NULL); + if (buf == NULL) + goto err; + for (i = 0; i <= total_offsets; i++) { + sc->offsets[i] = be64toh(((uint64_t *) + (buf+sizeof(struct cloop_header)))[i]); + } + DPRINTF(("%s: done reading offsets\n", gp->name)); + mtx_init(&sc->last_mtx, "geom_uncompress cache", NULL, MTX_DEF); + sc->last_blk = -1; + sc->last_buf = malloc(sc->blksz, M_GEOM_UNCOMPRESS, M_WAITOK); + sc->req_total = 0; + sc->req_cached = 0; + + switch (sc->type) { + case GEOM_ULZMA: + xz_crc32_init(); + sc->s = xz_dec_init(XZ_SINGLE, 0); + sc->b = (struct xz_buf*)malloc(sizeof(struct xz_buf), + M_GEOM_UNCOMPRESS, M_WAITOK); + break; + case GEOM_UZIP: + sc->zs = (z_stream *)malloc(sizeof(z_stream), + M_GEOM_UNCOMPRESS, M_WAITOK); + sc->zs->zalloc = z_alloc; + sc->zs->zfree = z_free; + if (inflateInit(sc->zs) != Z_OK) { + goto err; + } + break; + } + + g_topology_lock(); + pp2 = g_new_providerf(gp, "%s", gp->name); + pp2->sectorsize = 512; + pp2->mediasize = (off_t)sc->nblocks * sc->blksz; + pp2->flags = pp->flags & G_PF_CANDELETE; + if (pp->stripesize > 0) { + pp2->stripesize = pp->stripesize; + pp2->stripeoffset = pp->stripeoffset; + } + g_error_provider(pp2, 0); + free(buf, M_GEOM); + g_access(cp, -1, 0, 0); + + DPRINTF(("%s: taste ok (%d, %lld), (%d, %d), %x\n", + gp->name, + pp2->sectorsize, pp2->mediasize, + pp2->stripeoffset, pp2->stripesize, pp2->flags)); + printf("%s: %u x %u blocks\n", + gp->name, sc->nblocks, sc->blksz); + return (gp); + +err: + g_topology_lock(); + g_access(cp, -1, 0, 0); + if (buf != NULL) + free(buf, M_GEOM); + if (gp->softc != NULL) { + g_uncompress_softc_free(gp->softc, NULL); + gp->softc = NULL; + } + g_detach(cp); + g_destroy_consumer(cp); + g_destroy_geom(gp); + return (NULL); +} + +static int +g_uncompress_destroy_geom(struct gctl_req *req, struct g_class *mp, + struct g_geom *gp) +{ + struct g_provider *pp; + + g_trace(G_T_TOPOLOGY, "%s(%s, %s)", __func__, mp->name, gp->name); + g_topology_assert(); + + if (gp->softc == NULL) { + printf("%s(%s): gp->softc == NULL\n", __func__, gp->name); + return (ENXIO); + } + + KASSERT(gp != NULL, ("NULL geom")); + pp = LIST_FIRST(&gp->provider); + KASSERT(pp != NULL, ("NULL provider")); + if (pp->acr > 0 || pp->acw > 0 || pp->ace > 0) + return (EBUSY); + + g_uncompress_softc_free(gp->softc, gp); + gp->softc = NULL; + g_wither_geom(gp, ENXIO); + return (0); +} + +static struct g_class g_uncompress_class = { + .name = UNCOMPRESS_CLASS_NAME, + .version = G_VERSION, + .taste = g_uncompress_taste, + .destroy_geom = g_uncompress_destroy_geom, + + .start = g_uncompress_start, + .orphan = g_uncompress_orphan, + .access = g_uncompress_access, + .spoiled = g_uncompress_spoiled, +}; + +DECLARE_GEOM_CLASS(g_uncompress_class, g_uncompress); + Added: head/sys/modules/geom/geom_uncompress/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/geom/geom_uncompress/Makefile Wed Jan 4 23:39:11 2012 (r229537) @@ -0,0 +1,17 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR}/../../../geom/uncompress \ + ${.CURDIR}/../../../contrib/xz-embedded/freebsd/ \ + ${.CURDIR}/../../../contrib/xz-embedded/linux/lib/xz/ \ + ${.CURDIR}/../../../contrib/xz-embedded/linux/include/linux/ \ + ${.CURDIR}/../../../net + +KMOD= geom_uncompress +CFLAGS= -I${.CURDIR}/../../../geom/uncompress/ \ + -I${.CURDIR}/../../../contrib/xz-embedded/freebsd \ + -I${.CURDIR}/../../../contrib/xz-embedded/linux/lib/xz/ +SRCS= g_uncompress.c xz_crc32.c xz_dec_bcj.c xz_dec_lzma2.c xz_dec_stream.c \ + xz_malloc.c zlib.c +SRCS+= xz.h xz_config.h xz_lzma2.h xz_malloc.h xz_private.h xz_stream.h zlib.h + +.include From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 23:45:11 2012 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 588D9106564A; Wed, 4 Jan 2012 23:45:11 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 460ED8FC08; Wed, 4 Jan 2012 23:45: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 q04NjBmu004258; Wed, 4 Jan 2012 23:45:11 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04NjBBD004255; Wed, 4 Jan 2012 23:45:11 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201201042345.q04NjBBD004255@svn.freebsd.org> From: Aleksandr Rybalko Date: Wed, 4 Jan 2012 23:45: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: r229538 - head/usr.bin/mkulzma 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, 04 Jan 2012 23:45:11 -0000 Author: ray Date: Wed Jan 4 23:45:10 2012 New Revision: 229538 URL: http://svn.freebsd.org/changeset/base/229538 Log: mkulzma used to create lzma compressed images, just like mkuzip do. Approved by: adrian (mentor) Added: head/usr.bin/mkulzma/ head/usr.bin/mkulzma/Makefile (contents, props changed) head/usr.bin/mkulzma/mkulzma.8 (contents, props changed) head/usr.bin/mkulzma/mkulzma.c (contents, props changed) Added: head/usr.bin/mkulzma/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/mkulzma/Makefile Wed Jan 4 23:45:10 2012 (r229538) @@ -0,0 +1,8 @@ +# $FreeBSD$ + +PROG= mkulzma +MAN= mkulzma.8 +DPADD= ${LIBLZMA} +LDADD= -llzma + +.include Added: head/usr.bin/mkulzma/mkulzma.8 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/mkulzma/mkulzma.8 Wed Jan 4 23:45:10 2012 (r229538) @@ -0,0 +1,107 @@ +.\" ---------------------------------------------------------------------------- +.\" Derived from mkuzip.8 by Aleksandr Rybalko +.\" ---------------------------------------------------------------------------- +.\" "THE BEER-WARE LICENSE" (Revision 42): +.\" wrote this file. As long as you retain this notice you +.\" can do whatever you want with this stuff. If we meet some day, and you think +.\" this stuff is worth it, you can buy me a beer in return. Maxim Sobolev +.\" ---------------------------------------------------------------------------- +.\" +.\" $FreeBSD$ +.\" +.Dd March 17, 2006 +.Dt mkulzma 8 +.Os +.Sh NAME +.Nm mkulzma +.Nd compress disk image for use with +.Xr geom_uncompress 4 +class +.Sh SYNOPSIS +.Nm +.Op Fl v +.Op Fl o Ar outfile +.Op Fl s Ar cluster_size +.Ar infile +.Sh DESCRIPTION +The +.Nm +utility compresses a disk image file so that the +.Xr geom_uncompress 4 +class will be able to decompress the resulting image at run-time. +This allows for a significant reduction of size of disk image at +the expense of some CPU time required to decompress the data each +time it is read. +The +.Nm +utility +works in two phases: +.Bl -enum +.It +An +.Ar infile +image is split into clusters; each cluster is compressed using liblzma. +.It +The resulting set of compressed clusters along with headers that allow +locating each individual cluster is written to the output file. +.El +.Pp +The options are: +.Bl -tag -width indent +.It Fl o Ar outfile +Name of the output file +.Ar outfile . +The default is to use the input name with the suffix +.Pa .ulzma . +.It Fl s Ar cluster_size +Split the image into clusters of +.Ar cluster_size +bytes, 16384 bytes by default. +The +.Ar cluster_size +should be a multiple of 512 bytes. +.It Fl v +Display verbose messages. +.El +.Sh NOTES +The compression ratio largely depends on the cluster size used. +.\" The following two sentences are unclear: how can xz(1) be +.\" used in a comparable fashion, and wouldn't a lzma-compressed +.\" image suffer from larger cluster sizes as well? +For large cluster sizes (16K and higher), typical compression ratios +are only 1-2% less than those achieved with +.Xr lzma 1 . +However, it should be kept in mind that larger cluster +sizes lead to higher overhead in the +.Xr geom_uncompress 4 +class, as the class has to decompress the whole cluster even if +only a few bytes from that cluster have to be read. +.Pp +The +.Nm +utility +inserts a short shell script at the beginning of the generated image, +which makes it possible to +.Dq run +the image just like any other shell script. +The script tries to load the +.Xr geom_uncompress 4 +class if it is not loaded, configure the image as an +.Xr md 4 +disk device using +.Xr mdconfig 8 , +and automatically mount it using +.Xr mount_cd9660 8 +on the mount point provided as the first argument to the script. +.Sh EXIT STATUS +.Ex -std +.Sh SEE ALSO +.Xr lzma 1 , +.Xr geom 4 , +.Xr geom_uncompress 4 , +.Xr md 4 , +.Xr mdconfig 8 , +.Xr mount_cd9660 8 +.Sh AUTHORS +.An Maxim Sobolev Aq sobomax@FreeBSD.org +.An Aleksandr Rybalko Aq ray@ddteam.net Added: head/usr.bin/mkulzma/mkulzma.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/mkulzma/mkulzma.c Wed Jan 4 23:45:10 2012 (r229538) @@ -0,0 +1,330 @@ +/* + * ---------------------------------------------------------------------------- + * Derived from mkuzip.c by Aleksandr Rybalko + * ---------------------------------------------------------------------------- + * "THE BEER-WARE LICENSE" (Revision 42): + * wrote this file. As long as you retain this notice you + * can do whatever you want with this stuff. If we meet some day, and you think + * this stuff is worth it, you can buy me a beer in return. Maxim Sobolev + * ---------------------------------------------------------------------------- + * + * $FreeBSD$ + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#define CLSTSIZE 16384 +#define DEFAULT_SUFX ".ulzma" + +#define USED_BLOCKSIZE DEV_BSIZE + +#define CLOOP_MAGIC_LEN 128 +/* Format L3.0, since we move to XZ API */ +static char CLOOP_MAGIC_START[] = + "#!/bin/sh\n" + "#L3.0\n" + "n=uncompress\n" + "m=geom_$n\n" + "(kldstat -m $m 2>&-||kldload $m)>&-&&" + "mount_cd9660 /dev/`mdconfig -af $0`.$n $1\n" + "exit $?\n"; + +static char *readblock(int, char *, u_int32_t); +static void usage(void); +static void *safe_malloc(size_t); +static void cleanup(void); + +static char *cleanfile = NULL; + +int main(int argc, char **argv) +{ + char *iname, *oname, *obuf, *ibuf; + int fdr, fdw, i, opt, verbose, tmp; + struct iovec iov[2]; + struct stat sb; + uint32_t destlen; + uint64_t offset; + uint64_t *toc; + lzma_filter filters[2]; + lzma_options_lzma opt_lzma; + lzma_ret ret; + lzma_stream strm = LZMA_STREAM_INIT; + struct cloop_header { + char magic[CLOOP_MAGIC_LEN]; /* cloop magic */ + uint32_t blksz; /* block size */ + uint32_t nblocks; /* number of blocks */ + } hdr; + + memset(&hdr, 0, sizeof(hdr)); + hdr.blksz = CLSTSIZE; + strcpy(hdr.magic, CLOOP_MAGIC_START); + oname = NULL; + verbose = 0; + + while((opt = getopt(argc, argv, "o:s:v")) != -1) { + switch(opt) { + case 'o': + oname = optarg; + break; + + case 's': + tmp = atoi(optarg); + if (tmp <= 0) { + errx(1, + "invalid cluster size specified: %s", + optarg); + /* Not reached */ + } + if (tmp % USED_BLOCKSIZE != 0) { + errx(1, + "cluster size should be multiple of %d", + USED_BLOCKSIZE); + /* Not reached */ + } + if ( tmp > MAXPHYS) { + errx(1, "cluster size is too large"); + /* Not reached */ + } + hdr.blksz = tmp; + break; + + case 'v': + verbose = 1; + break; + + default: + usage(); + /* Not reached */ + } + } + argc -= optind; + argv += optind; + + if (argc != 1) { + usage(); + /* Not reached */ + } + + iname = argv[0]; + if (oname == NULL) { + asprintf(&oname, "%s%s", iname, DEFAULT_SUFX); + if (oname == NULL) { + err(1, "can't allocate memory"); + /* Not reached */ + } + } + + obuf = safe_malloc(hdr.blksz*2); + ibuf = safe_malloc(hdr.blksz); + + signal(SIGHUP, exit); + signal(SIGINT, exit); + signal(SIGTERM, exit); + signal(SIGXCPU, exit); + signal(SIGXFSZ, exit); + atexit(cleanup); + + fdr = open(iname, O_RDONLY); + if (fdr < 0) { + err(1, "open(%s)", iname); + /* Not reached */ + } + if (fstat(fdr, &sb) != 0) { + err(1, "fstat(%s)", iname); + /* Not reached */ + } + if (S_ISCHR(sb.st_mode)) { + off_t ms; + + if (ioctl(fdr, DIOCGMEDIASIZE, &ms) < 0) { + err(1, "ioctl(DIOCGMEDIASIZE)"); + /* Not reached */ + } + sb.st_size = ms; + } else if (!S_ISREG(sb.st_mode)) { + fprintf(stderr, + "%s: not a character device or regular file\n", + iname); + exit(1); + } + hdr.nblocks = sb.st_size / hdr.blksz; + if ((sb.st_size % hdr.blksz) != 0) { + if (verbose != 0) + fprintf(stderr, "file size is not multiple " + "of %d, padding data\n", hdr.blksz); + hdr.nblocks++; + } + toc = safe_malloc((hdr.nblocks + 1) * sizeof(*toc)); + + fdw = open(oname, O_WRONLY | O_TRUNC | O_CREAT, + S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH); + if (fdw < 0) { + err(1, "open(%s)", oname); + /* Not reached */ + } + cleanfile = oname; + + /* + * Prepare header that we will write later when we have index ready. + */ + iov[0].iov_base = (char *)&hdr; + iov[0].iov_len = sizeof(hdr); + iov[1].iov_base = (char *)toc; + iov[1].iov_len = (hdr.nblocks + 1) * sizeof(*toc); + offset = iov[0].iov_len + iov[1].iov_len; + + /* Reserve space for header */ + lseek(fdw, offset, SEEK_SET); + + if (verbose != 0) + fprintf(stderr, "data size %ju bytes, number of clusters " + "%u, index length %zu bytes\n", sb.st_size, + hdr.nblocks, iov[1].iov_len); + + /* Init lzma encoder */ + if (lzma_lzma_preset(&opt_lzma, LZMA_PRESET_DEFAULT)) + errx(1, "Error loading LZMA preset"); + + filters[0].id = LZMA_FILTER_LZMA2; + filters[0].options = &opt_lzma; + filters[1].id = LZMA_VLI_UNKNOWN; + + for(i = 0; i == 0 || ibuf != NULL; i++) { + ibuf = readblock(fdr, ibuf, hdr.blksz); + if (ibuf != NULL) { + destlen = hdr.blksz*2; + + ret = lzma_stream_encoder(&strm, filters, + LZMA_CHECK_CRC32); + if (ret != LZMA_OK) { + if (ret == LZMA_MEMLIMIT_ERROR) + errx(1, "can't compress data: " + "LZMA_MEMLIMIT_ERROR"); + + errx(1, "can't compress data: " + "LZMA compressor ERROR"); + } + + strm.next_in = ibuf; + strm.avail_in = hdr.blksz; + strm.next_out = obuf; + strm.avail_out = hdr.blksz*2; + + ret = lzma_code(&strm, LZMA_FINISH); + + if (ret != LZMA_STREAM_END) { + /* Error */ + errx(1, "lzma_code FINISH failed, code=%d, " + "pos(in=%zd, out=%zd)", + ret, + (hdr.blksz - strm.avail_in), + (hdr.blksz*2 - strm.avail_out)); + } + + destlen -= strm.avail_out; + + lzma_end(&strm); + + if (verbose != 0) + fprintf(stderr, "cluster #%d, in %u bytes, " + "out %u bytes\n", i, hdr.blksz, destlen); + } else { + destlen = USED_BLOCKSIZE - (offset % USED_BLOCKSIZE); + memset(obuf, 0, destlen); + if (verbose != 0) + fprintf(stderr, "padding data with %u bytes" + " so that file size is multiple of %d\n", + destlen, + USED_BLOCKSIZE); + } + if (write(fdw, obuf, destlen) < 0) { + err(1, "write(%s)", oname); + /* Not reached */ + } + toc[i] = htobe64(offset); + offset += destlen; + } + close(fdr); + + if (verbose != 0) + fprintf(stderr, "compressed data to %ju bytes, saved %lld " + "bytes, %.2f%% decrease.\n", offset, + (long long)(sb.st_size - offset), + 100.0 * (long long)(sb.st_size - offset) / + (float)sb.st_size); + + /* Convert to big endian */ + hdr.blksz = htonl(hdr.blksz); + hdr.nblocks = htonl(hdr.nblocks); + /* Write headers into pre-allocated space */ + lseek(fdw, 0, SEEK_SET); + if (writev(fdw, iov, 2) < 0) { + err(1, "writev(%s)", oname); + /* Not reached */ + } + cleanfile = NULL; + close(fdw); + + exit(0); +} + +static char * +readblock(int fd, char *ibuf, u_int32_t clstsize) +{ + int numread; + + bzero(ibuf, clstsize); + numread = read(fd, ibuf, clstsize); + if (numread < 0) { + err(1, "read() failed"); + /* Not reached */ + } + if (numread == 0) { + return NULL; + } + return ibuf; +} + +static void +usage(void) +{ + + fprintf(stderr, "usage: mkulzma [-v] [-o outfile] [-s cluster_size] " + "infile\n"); + exit(1); +} + +static void * +safe_malloc(size_t size) +{ + void *retval; + + retval = malloc(size); + if (retval == NULL) { + err(1, "can't allocate memory"); + /* Not reached */ + } + return retval; +} + +static void +cleanup(void) +{ + + if (cleanfile != NULL) + unlink(cleanfile); +} From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 23:47:21 2012 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 7D41B106564A; Wed, 4 Jan 2012 23:47:21 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 683098FC14; Wed, 4 Jan 2012 23:47: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 q04NlL6i004365; Wed, 4 Jan 2012 23:47:21 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04NlLLs004352; Wed, 4 Jan 2012 23:47:21 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201201042347.q04NlLLs004352@svn.freebsd.org> From: Colin Percival Date: Wed, 4 Jan 2012 23:47:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229539 - in releng: 7.3 7.3/sys/conf 7.3/usr.sbin/freebsd-update 7.4 7.4/sys/conf 7.4/usr.sbin/freebsd-update 8.1 8.1/sys/conf 8.1/usr.sbin/freebsd-update 8.2 8.2/sys/conf 8.2/usr.sbin... 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, 04 Jan 2012 23:47:21 -0000 Author: cperciva Date: Wed Jan 4 23:47:20 2012 New Revision: 229539 URL: http://svn.freebsd.org/changeset/base/229539 Log: Extend the character set accepted by freebsd-update(8) in file names in order to allow upgrades to FreeBSD 9.0-RELEASE. Approved by: so (cperciva) Errata Notice: FreeBSD-EN-12:01.freebsd-update Modified: releng/7.3/UPDATING releng/7.3/sys/conf/newvers.sh releng/7.3/usr.sbin/freebsd-update/freebsd-update.sh releng/7.4/UPDATING releng/7.4/sys/conf/newvers.sh releng/7.4/usr.sbin/freebsd-update/freebsd-update.sh releng/8.1/UPDATING releng/8.1/sys/conf/newvers.sh releng/8.1/usr.sbin/freebsd-update/freebsd-update.sh releng/8.2/UPDATING releng/8.2/sys/conf/newvers.sh releng/8.2/usr.sbin/freebsd-update/freebsd-update.sh Modified: releng/7.3/UPDATING ============================================================================== --- releng/7.3/UPDATING Wed Jan 4 23:45:10 2012 (r229538) +++ releng/7.3/UPDATING Wed Jan 4 23:47:20 2012 (r229539) @@ -8,6 +8,10 @@ Items affecting the ports and packages s /usr/ports/UPDATING. Please read that file before running portupgrade. +20120104: p10 FreeBSD-EN-12:01.freebsd-update + Extend the character set accepted by freebsd-update(8) in file + names in order to allow upgrades to FreeBSD 9.0-RELEASE. + 20111223: p9 FreeBSD-SA-11:06.bind, FreeBSD-SA-11:07.chroot FreeBSD-SA-11:08.telnetd, FreeBSD-SA-11:09.pam_ssh FreeBSD-SA-11:10.pam Modified: releng/7.3/sys/conf/newvers.sh ============================================================================== --- releng/7.3/sys/conf/newvers.sh Wed Jan 4 23:45:10 2012 (r229538) +++ releng/7.3/sys/conf/newvers.sh Wed Jan 4 23:47:20 2012 (r229539) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="7.3" -BRANCH="RELEASE-p9" +BRANCH="RELEASE-p10" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi Modified: releng/7.3/usr.sbin/freebsd-update/freebsd-update.sh ============================================================================== --- releng/7.3/usr.sbin/freebsd-update/freebsd-update.sh Wed Jan 4 23:45:10 2012 (r229538) +++ releng/7.3/usr.sbin/freebsd-update/freebsd-update.sh Wed Jan 4 23:47:20 2012 (r229539) @@ -1110,7 +1110,7 @@ fetch_metadata_sanity () { # Some aliases to save space later: ${P} is a character which can # appear in a path; ${M} is the four numeric metadata fields; and # ${H} is a sha256 hash. - P="[-+./:=_[[:alnum:]]" + P="[-+./:=%@_[[:alnum:]]" M="[0-9]+\|[0-9]+\|[0-9]+\|[0-9]+" H="[0-9a-f]{64}" Modified: releng/7.4/UPDATING ============================================================================== --- releng/7.4/UPDATING Wed Jan 4 23:45:10 2012 (r229538) +++ releng/7.4/UPDATING Wed Jan 4 23:47:20 2012 (r229539) @@ -8,6 +8,10 @@ Items affecting the ports and packages s /usr/ports/UPDATING. Please read that file before running portupgrade. +20120104: p6 FreeBSD-EN-12:01.freebsd-update + Extend the character set accepted by freebsd-update(8) in file + names in order to allow upgrades to FreeBSD 9.0-RELEASE. + 20111223: p5 FreeBSD-SA-11:06.bind, FreeBSD-SA-11:07.chroot FreeBSD-SA-11:08.telnetd, FreeBSD-SA-11:09.pam_ssh FreeBSD-SA-11:10.pam Modified: releng/7.4/sys/conf/newvers.sh ============================================================================== --- releng/7.4/sys/conf/newvers.sh Wed Jan 4 23:45:10 2012 (r229538) +++ releng/7.4/sys/conf/newvers.sh Wed Jan 4 23:47:20 2012 (r229539) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="7.4" -BRANCH="RELEASE-p5" +BRANCH="RELEASE-p6" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi Modified: releng/7.4/usr.sbin/freebsd-update/freebsd-update.sh ============================================================================== --- releng/7.4/usr.sbin/freebsd-update/freebsd-update.sh Wed Jan 4 23:45:10 2012 (r229538) +++ releng/7.4/usr.sbin/freebsd-update/freebsd-update.sh Wed Jan 4 23:47:20 2012 (r229539) @@ -1110,7 +1110,7 @@ fetch_metadata_sanity () { # Some aliases to save space later: ${P} is a character which can # appear in a path; ${M} is the four numeric metadata fields; and # ${H} is a sha256 hash. - P="[-+./:=_[[:alnum:]]" + P="[-+./:=%@_[[:alnum:]]" M="[0-9]+\|[0-9]+\|[0-9]+\|[0-9]+" H="[0-9a-f]{64}" Modified: releng/8.1/UPDATING ============================================================================== --- releng/8.1/UPDATING Wed Jan 4 23:45:10 2012 (r229538) +++ releng/8.1/UPDATING Wed Jan 4 23:47:20 2012 (r229539) @@ -15,6 +15,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. debugging tools present in HEAD were left in place because sun4v support still needs work to become production ready. +20120104: p8 FreeBSD-EN-12:01.freebsd-update + Extend the character set accepted by freebsd-update(8) in file + names in order to allow upgrades to FreeBSD 9.0-RELEASE. + 20111223: p7 FreeBSD-SA-11:06.bind, FreeBSD-SA-11:07.chroot FreeBSD-SA-11:08.telnetd, FreeBSD-SA-11:09.pam_ssh FreeBSD-SA-11:10.pam Modified: releng/8.1/sys/conf/newvers.sh ============================================================================== --- releng/8.1/sys/conf/newvers.sh Wed Jan 4 23:45:10 2012 (r229538) +++ releng/8.1/sys/conf/newvers.sh Wed Jan 4 23:47:20 2012 (r229539) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="8.1" -BRANCH="RELEASE-p7" +BRANCH="RELEASE-p8" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi Modified: releng/8.1/usr.sbin/freebsd-update/freebsd-update.sh ============================================================================== --- releng/8.1/usr.sbin/freebsd-update/freebsd-update.sh Wed Jan 4 23:45:10 2012 (r229538) +++ releng/8.1/usr.sbin/freebsd-update/freebsd-update.sh Wed Jan 4 23:47:20 2012 (r229539) @@ -1185,7 +1185,7 @@ fetch_metadata_sanity () { # Some aliases to save space later: ${P} is a character which can # appear in a path; ${M} is the four numeric metadata fields; and # ${H} is a sha256 hash. - P="[-+./:=_[[:alnum:]]" + P="[-+./:=%@_[[:alnum:]]" M="[0-9]+\|[0-9]+\|[0-9]+\|[0-9]+" H="[0-9a-f]{64}" Modified: releng/8.2/UPDATING ============================================================================== --- releng/8.2/UPDATING Wed Jan 4 23:45:10 2012 (r229538) +++ releng/8.2/UPDATING Wed Jan 4 23:47:20 2012 (r229539) @@ -15,6 +15,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. debugging tools present in HEAD were left in place because sun4v support still needs work to become production ready. +20120104: p6 FreeBSD-EN-12:01.freebsd-update + Extend the character set accepted by freebsd-update(8) in file + names in order to allow upgrades to FreeBSD 9.0-RELEASE. + 20111223: p5 FreeBSD-SA-11:06.bind, FreeBSD-SA-11:07.chroot FreeBSD-SA-11:08.telnetd, FreeBSD-SA-11:09.pam_ssh FreeBSD-SA-11:10.pam Modified: releng/8.2/sys/conf/newvers.sh ============================================================================== --- releng/8.2/sys/conf/newvers.sh Wed Jan 4 23:45:10 2012 (r229538) +++ releng/8.2/sys/conf/newvers.sh Wed Jan 4 23:47:20 2012 (r229539) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="8.2" -BRANCH="RELEASE-p5" +BRANCH="RELEASE-p6" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi Modified: releng/8.2/usr.sbin/freebsd-update/freebsd-update.sh ============================================================================== --- releng/8.2/usr.sbin/freebsd-update/freebsd-update.sh Wed Jan 4 23:45:10 2012 (r229538) +++ releng/8.2/usr.sbin/freebsd-update/freebsd-update.sh Wed Jan 4 23:47:20 2012 (r229539) @@ -1185,7 +1185,7 @@ fetch_metadata_sanity () { # Some aliases to save space later: ${P} is a character which can # appear in a path; ${M} is the four numeric metadata fields; and # ${H} is a sha256 hash. - P="[-+./:=_[[:alnum:]]" + P="[-+./:=%@_[[:alnum:]]" M="[0-9]+\|[0-9]+\|[0-9]+\|[0-9]+" H="[0-9a-f]{64}" From owner-svn-src-all@FreeBSD.ORG Wed Jan 4 23:58:55 2012 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 1B25D1065680; Wed, 4 Jan 2012 23:58:55 +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 0889B8FC14; Wed, 4 Jan 2012 23:58: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 q04Nwsqa004875; Wed, 4 Jan 2012 23:58:54 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q04Nws4j004873; Wed, 4 Jan 2012 23:58:54 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201042358.q04Nws4j004873@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 4 Jan 2012 23:58:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229540 - stable/9/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, 04 Jan 2012 23:58:55 -0000 Author: yongari Date: Wed Jan 4 23:58:54 2012 New Revision: 229540 URL: http://svn.freebsd.org/changeset/base/229540 Log: MFC r227828,227835,227837: r227828: Always start MII auto polling before accessing any MII registers. r227835: Rework link establishment and link state detection logic. - Remove MIIBUS statchg callback and program VGE_DIAGCTL before initiating link establishment. Previously driver used to program VGE_DIAGCTL after getting a link in statchg callback. It seems the VGE_DIAGCTL register works like a kind of MII register such that it requires setting a 'to be' mode in advance rather than relying on resolved speed/duplex of established link. This means the statchg callback is not needed in driver. In addition, if there was no link at the time of media change, this was not called at all. - Introduce vge_ifmedia_upd_locked() to change current media to configured one. Actual media change is performed only after PHY reset and VGE_DIAGCTL setup. - In WOL configuration, make sure to clear forced mode such that controller can rely on auto-negotiation. - Unlike most other drivers that use miibus(4), vge(4) used controller's auto-polling feature for link state tracking via interrupt. This came from controller's inefficient mechanism to access MII registers. On link state change interrupt, vge(4) used to get current link state with series of MII register accesses. Because vge(4) already enabled auto polling, read PHY status register to resolved speed/duplex/flow control parameters. vge(4) still does not drive MII_TICK to reduce number of MII register accesses which in turn means the driver does not know the status of auto-negotiation. This was a one of long standing issue of vge(4). Probably driver may be able to implement a timer that keeps track of auto-negotiation state and restart auto-negotiation when driver couldn't establish a link within a specified period. However the controller does not provide a reliable way to detect auto-negotiation failure so I'm not sure whether it's worth to implement it in driver. Alternatively driver can completely disable MII auto-polling and let miibus(4) poll link state by driving MII_TICK. This may reduce unnecessary overhead of stopping/restarting MII auto-polling of controller. Unfortunately it was known that some variants of controller does not work correctly if MII auto-polling is disabled. r227837: Announce flow control capability to underlying PHY driver. Pause timer value is initialized to 0xFFFF. Controller allows just 4 different TX pause thresholds. The lowest possible threshold value looks too aggressive so use next available threshold value. Modified: stable/9/sys/dev/vge/if_vge.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/vge/if_vge.c ============================================================================== --- stable/9/sys/dev/vge/if_vge.c Wed Jan 4 23:47:20 2012 (r229539) +++ stable/9/sys/dev/vge/if_vge.c Wed Jan 4 23:58:54 2012 (r229540) @@ -173,6 +173,7 @@ static __inline void static void vge_freebufs(struct vge_softc *); static void vge_ifmedia_sts(struct ifnet *, struct ifmediareq *); static int vge_ifmedia_upd(struct ifnet *); +static int vge_ifmedia_upd_locked(struct vge_softc *); static void vge_init(void *); static void vge_init_locked(struct vge_softc *); static void vge_intr(void *); @@ -180,7 +181,6 @@ static void vge_intr_holdoff(struct vge_ static int vge_ioctl(struct ifnet *, u_long, caddr_t); static void vge_link_statchg(void *); static int vge_miibus_readreg(device_t, int, int); -static void vge_miibus_statchg(device_t); static int vge_miibus_writereg(device_t, int, int, int); static void vge_miipoll_start(struct vge_softc *); static void vge_miipoll_stop(struct vge_softc *); @@ -190,6 +190,7 @@ static void vge_reset(struct vge_softc * static int vge_rx_list_init(struct vge_softc *); static int vge_rxeof(struct vge_softc *, int); static void vge_rxfilter(struct vge_softc *); +static void vge_setmedia(struct vge_softc *); static void vge_setvlan(struct vge_softc *); static void vge_setwol(struct vge_softc *); static void vge_start(struct ifnet *); @@ -214,7 +215,6 @@ static device_method_t vge_methods[] = { /* MII interface */ DEVMETHOD(miibus_readreg, vge_miibus_readreg), DEVMETHOD(miibus_writereg, vge_miibus_writereg), - DEVMETHOD(miibus_statchg, vge_miibus_statchg), DEVMETHOD_END }; @@ -1095,10 +1095,11 @@ vge_attach(device_t dev) goto fail; } + vge_miipoll_start(sc); /* Do MII setup */ error = mii_attach(dev, &sc->vge_miibus, ifp, vge_ifmedia_upd, vge_ifmedia_sts, BMSR_DEFCAPMASK, sc->vge_phyaddr, MII_OFFSET_ANY, - 0); + MIIF_DOPAUSE); if (error != 0) { device_printf(dev, "attaching PHYs failed\n"); goto fail; @@ -1656,30 +1657,41 @@ vge_link_statchg(void *xsc) { struct vge_softc *sc; struct ifnet *ifp; - struct mii_data *mii; + uint8_t physts; sc = xsc; ifp = sc->vge_ifp; VGE_LOCK_ASSERT(sc); - mii = device_get_softc(sc->vge_miibus); - mii_pollstat(mii); - if ((sc->vge_flags & VGE_FLAG_LINK) != 0) { - if (!(mii->mii_media_status & IFM_ACTIVE)) { + physts = CSR_READ_1(sc, VGE_PHYSTS0); + if ((physts & VGE_PHYSTS_RESETSTS) == 0) { + if ((physts & VGE_PHYSTS_LINK) == 0) { sc->vge_flags &= ~VGE_FLAG_LINK; if_link_state_change(sc->vge_ifp, LINK_STATE_DOWN); - } - } else { - if (mii->mii_media_status & IFM_ACTIVE && - IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) { + } else { sc->vge_flags |= VGE_FLAG_LINK; if_link_state_change(sc->vge_ifp, LINK_STATE_UP); + CSR_WRITE_1(sc, VGE_CRC2, VGE_CR2_FDX_TXFLOWCTL_ENABLE | + VGE_CR2_FDX_RXFLOWCTL_ENABLE); + if ((physts & VGE_PHYSTS_FDX) != 0) { + if ((physts & VGE_PHYSTS_TXFLOWCAP) != 0) + CSR_WRITE_1(sc, VGE_CRS2, + VGE_CR2_FDX_TXFLOWCTL_ENABLE); + if ((physts & VGE_PHYSTS_RXFLOWCAP) != 0) + CSR_WRITE_1(sc, VGE_CRS2, + VGE_CR2_FDX_RXFLOWCTL_ENABLE); + } if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) vge_start_locked(ifp); } } + /* + * Restart MII auto-polling because link state change interrupt + * will disable it. + */ + vge_miipoll_start(sc); } #ifdef DEVICE_POLLING @@ -2024,6 +2036,7 @@ vge_init_locked(struct vge_softc *sc) */ vge_stop(sc); vge_reset(sc); + vge_miipoll_start(sc); /* * Initialize the RX and TX descriptors and mbufs. @@ -2095,9 +2108,16 @@ vge_init_locked(struct vge_softc *sc) vge_rxfilter(sc); vge_setvlan(sc); - /* Enable flow control */ - - CSR_WRITE_1(sc, VGE_CRS2, 0x8B); + /* Initialize pause timer. */ + CSR_WRITE_2(sc, VGE_TX_PAUSE_TIMER, 0xFFFF); + /* + * Initialize flow control parameters. + * TX XON high threshold : 48 + * TX pause low threshold : 24 + * Disable hald-duplex flow control + */ + CSR_WRITE_1(sc, VGE_CRC2, 0xFF); + CSR_WRITE_1(sc, VGE_CRS2, VGE_CR2_XON_ENABLE | 0x0B); /* Enable jumbo frame reception (if desired) */ @@ -2125,7 +2145,7 @@ vge_init_locked(struct vge_softc *sc) CSR_WRITE_1(sc, VGE_CRS3, VGE_CR3_INT_GMSK); sc->vge_flags &= ~VGE_FLAG_LINK; - mii_mediachg(mii); + vge_ifmedia_upd_locked(sc); ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; @@ -2139,14 +2159,28 @@ static int vge_ifmedia_upd(struct ifnet *ifp) { struct vge_softc *sc; - struct mii_data *mii; int error; sc = ifp->if_softc; VGE_LOCK(sc); + error = vge_ifmedia_upd_locked(sc); + VGE_UNLOCK(sc); + + return (error); +} + +static int +vge_ifmedia_upd_locked(struct vge_softc *sc) +{ + struct mii_data *mii; + struct mii_softc *miisc; + int error; + mii = device_get_softc(sc->vge_miibus); + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) + PHY_RESET(miisc); + vge_setmedia(sc); error = mii_mediachg(mii); - VGE_UNLOCK(sc); return (error); } @@ -2175,13 +2209,11 @@ vge_ifmedia_sts(struct ifnet *ifp, struc } static void -vge_miibus_statchg(device_t dev) +vge_setmedia(struct vge_softc *sc) { - struct vge_softc *sc; struct mii_data *mii; struct ifmedia_entry *ife; - sc = device_get_softc(dev); mii = device_get_softc(sc->vge_miibus); ife = mii->mii_media.ifm_cur; @@ -2215,7 +2247,7 @@ vge_miibus_statchg(device_t dev) } break; default: - device_printf(dev, "unknown media type: %x\n", + device_printf(sc->vge_dev, "unknown media type: %x\n", IFM_SUBTYPE(ife->ifm_media)); break; } @@ -2768,6 +2800,9 @@ vge_setlinkspeed(struct vge_softc *sc) break; } } + /* Clear forced MAC speed/duplex configuration. */ + CSR_CLRBIT_1(sc, VGE_DIAGCTL, VGE_DIAGCTL_MACFORCE); + CSR_CLRBIT_1(sc, VGE_DIAGCTL, VGE_DIAGCTL_FDXFORCE); vge_miibus_writereg(sc->vge_dev, sc->vge_phyaddr, MII_100T2CR, 0); vge_miibus_writereg(sc->vge_dev, sc->vge_phyaddr, MII_ANAR, ANAR_TX_FD | ANAR_TX | ANAR_10_FD | ANAR_10 | ANAR_CSMA); From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 00:00:31 2012 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 24B78106567D; Thu, 5 Jan 2012 00:00:31 +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 11CCE8FC17; Thu, 5 Jan 2012 00:00:31 +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 q0500U8J004995; Thu, 5 Jan 2012 00:00:30 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0500UOZ004993; Thu, 5 Jan 2012 00:00:30 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201050000.q0500UOZ004993@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 5 Jan 2012 00:00:30 +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: r229541 - stable/8/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: Thu, 05 Jan 2012 00:00:31 -0000 Author: yongari Date: Thu Jan 5 00:00:30 2012 New Revision: 229541 URL: http://svn.freebsd.org/changeset/base/229541 Log: MFC r227828,227835,227837: r227828: Always start MII auto polling before accessing any MII registers. r227835: Rework link establishment and link state detection logic. - Remove MIIBUS statchg callback and program VGE_DIAGCTL before initiating link establishment. Previously driver used to program VGE_DIAGCTL after getting a link in statchg callback. It seems the VGE_DIAGCTL register works like a kind of MII register such that it requires setting a 'to be' mode in advance rather than relying on resolved speed/duplex of established link. This means the statchg callback is not needed in driver. In addition, if there was no link at the time of media change, this was not called at all. - Introduce vge_ifmedia_upd_locked() to change current media to configured one. Actual media change is performed only after PHY reset and VGE_DIAGCTL setup. - In WOL configuration, make sure to clear forced mode such that controller can rely on auto-negotiation. - Unlike most other drivers that use miibus(4), vge(4) used controller's auto-polling feature for link state tracking via interrupt. This came from controller's inefficient mechanism to access MII registers. On link state change interrupt, vge(4) used to get current link state with series of MII register accesses. Because vge(4) already enabled auto polling, read PHY status register to resolved speed/duplex/flow control parameters. vge(4) still does not drive MII_TICK to reduce number of MII register accesses which in turn means the driver does not know the status of auto-negotiation. This was a one of long standing issue of vge(4). Probably driver may be able to implement a timer that keeps track of auto-negotiation state and restart auto-negotiation when driver couldn't establish a link within a specified period. However the controller does not provide a reliable way to detect auto-negotiation failure so I'm not sure whether it's worth to implement it in driver. Alternatively driver can completely disable MII auto-polling and let miibus(4) poll link state by driving MII_TICK. This may reduce unnecessary overhead of stopping/restarting MII auto-polling of controller. Unfortunately it was known that some variants of controller does not work correctly if MII auto-polling is disabled. r227837: Announce flow control capability to underlying PHY driver. Pause timer value is initialized to 0xFFFF. Controller allows just 4 different TX pause thresholds. The lowest possible threshold value looks too aggressive so use next available threshold value. Modified: stable/8/sys/dev/vge/if_vge.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/vge/if_vge.c ============================================================================== --- stable/8/sys/dev/vge/if_vge.c Wed Jan 4 23:58:54 2012 (r229540) +++ stable/8/sys/dev/vge/if_vge.c Thu Jan 5 00:00:30 2012 (r229541) @@ -173,6 +173,7 @@ static __inline void static void vge_freebufs(struct vge_softc *); static void vge_ifmedia_sts(struct ifnet *, struct ifmediareq *); static int vge_ifmedia_upd(struct ifnet *); +static int vge_ifmedia_upd_locked(struct vge_softc *); static void vge_init(void *); static void vge_init_locked(struct vge_softc *); static void vge_intr(void *); @@ -180,7 +181,6 @@ static void vge_intr_holdoff(struct vge_ static int vge_ioctl(struct ifnet *, u_long, caddr_t); static void vge_link_statchg(void *); static int vge_miibus_readreg(device_t, int, int); -static void vge_miibus_statchg(device_t); static int vge_miibus_writereg(device_t, int, int, int); static void vge_miipoll_start(struct vge_softc *); static void vge_miipoll_stop(struct vge_softc *); @@ -190,6 +190,7 @@ static void vge_reset(struct vge_softc * static int vge_rx_list_init(struct vge_softc *); static int vge_rxeof(struct vge_softc *, int); static void vge_rxfilter(struct vge_softc *); +static void vge_setmedia(struct vge_softc *); static void vge_setvlan(struct vge_softc *); static void vge_setwol(struct vge_softc *); static void vge_start(struct ifnet *); @@ -218,7 +219,6 @@ static device_method_t vge_methods[] = { /* MII interface */ DEVMETHOD(miibus_readreg, vge_miibus_readreg), DEVMETHOD(miibus_writereg, vge_miibus_writereg), - DEVMETHOD(miibus_statchg, vge_miibus_statchg), { 0, 0 } }; @@ -1099,10 +1099,11 @@ vge_attach(device_t dev) goto fail; } + vge_miipoll_start(sc); /* Do MII setup */ error = mii_attach(dev, &sc->vge_miibus, ifp, vge_ifmedia_upd, vge_ifmedia_sts, BMSR_DEFCAPMASK, sc->vge_phyaddr, MII_OFFSET_ANY, - 0); + MIIF_DOPAUSE); if (error != 0) { device_printf(dev, "attaching PHYs failed\n"); goto fail; @@ -1660,30 +1661,41 @@ vge_link_statchg(void *xsc) { struct vge_softc *sc; struct ifnet *ifp; - struct mii_data *mii; + uint8_t physts; sc = xsc; ifp = sc->vge_ifp; VGE_LOCK_ASSERT(sc); - mii = device_get_softc(sc->vge_miibus); - mii_pollstat(mii); - if ((sc->vge_flags & VGE_FLAG_LINK) != 0) { - if (!(mii->mii_media_status & IFM_ACTIVE)) { + physts = CSR_READ_1(sc, VGE_PHYSTS0); + if ((physts & VGE_PHYSTS_RESETSTS) == 0) { + if ((physts & VGE_PHYSTS_LINK) == 0) { sc->vge_flags &= ~VGE_FLAG_LINK; if_link_state_change(sc->vge_ifp, LINK_STATE_DOWN); - } - } else { - if (mii->mii_media_status & IFM_ACTIVE && - IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) { + } else { sc->vge_flags |= VGE_FLAG_LINK; if_link_state_change(sc->vge_ifp, LINK_STATE_UP); + CSR_WRITE_1(sc, VGE_CRC2, VGE_CR2_FDX_TXFLOWCTL_ENABLE | + VGE_CR2_FDX_RXFLOWCTL_ENABLE); + if ((physts & VGE_PHYSTS_FDX) != 0) { + if ((physts & VGE_PHYSTS_TXFLOWCAP) != 0) + CSR_WRITE_1(sc, VGE_CRS2, + VGE_CR2_FDX_TXFLOWCTL_ENABLE); + if ((physts & VGE_PHYSTS_RXFLOWCAP) != 0) + CSR_WRITE_1(sc, VGE_CRS2, + VGE_CR2_FDX_RXFLOWCTL_ENABLE); + } if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) vge_start_locked(ifp); } } + /* + * Restart MII auto-polling because link state change interrupt + * will disable it. + */ + vge_miipoll_start(sc); } #ifdef DEVICE_POLLING @@ -2028,6 +2040,7 @@ vge_init_locked(struct vge_softc *sc) */ vge_stop(sc); vge_reset(sc); + vge_miipoll_start(sc); /* * Initialize the RX and TX descriptors and mbufs. @@ -2099,9 +2112,16 @@ vge_init_locked(struct vge_softc *sc) vge_rxfilter(sc); vge_setvlan(sc); - /* Enable flow control */ - - CSR_WRITE_1(sc, VGE_CRS2, 0x8B); + /* Initialize pause timer. */ + CSR_WRITE_2(sc, VGE_TX_PAUSE_TIMER, 0xFFFF); + /* + * Initialize flow control parameters. + * TX XON high threshold : 48 + * TX pause low threshold : 24 + * Disable hald-duplex flow control + */ + CSR_WRITE_1(sc, VGE_CRC2, 0xFF); + CSR_WRITE_1(sc, VGE_CRS2, VGE_CR2_XON_ENABLE | 0x0B); /* Enable jumbo frame reception (if desired) */ @@ -2129,7 +2149,7 @@ vge_init_locked(struct vge_softc *sc) CSR_WRITE_1(sc, VGE_CRS3, VGE_CR3_INT_GMSK); sc->vge_flags &= ~VGE_FLAG_LINK; - mii_mediachg(mii); + vge_ifmedia_upd_locked(sc); ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; @@ -2143,14 +2163,28 @@ static int vge_ifmedia_upd(struct ifnet *ifp) { struct vge_softc *sc; - struct mii_data *mii; int error; sc = ifp->if_softc; VGE_LOCK(sc); + error = vge_ifmedia_upd_locked(sc); + VGE_UNLOCK(sc); + + return (error); +} + +static int +vge_ifmedia_upd_locked(struct vge_softc *sc) +{ + struct mii_data *mii; + struct mii_softc *miisc; + int error; + mii = device_get_softc(sc->vge_miibus); + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) + mii_phy_reset(miisc); + vge_setmedia(sc); error = mii_mediachg(mii); - VGE_UNLOCK(sc); return (error); } @@ -2179,13 +2213,11 @@ vge_ifmedia_sts(struct ifnet *ifp, struc } static void -vge_miibus_statchg(device_t dev) +vge_setmedia(struct vge_softc *sc) { - struct vge_softc *sc; struct mii_data *mii; struct ifmedia_entry *ife; - sc = device_get_softc(dev); mii = device_get_softc(sc->vge_miibus); ife = mii->mii_media.ifm_cur; @@ -2219,7 +2251,7 @@ vge_miibus_statchg(device_t dev) } break; default: - device_printf(dev, "unknown media type: %x\n", + device_printf(sc->vge_dev, "unknown media type: %x\n", IFM_SUBTYPE(ife->ifm_media)); break; } @@ -2772,6 +2804,9 @@ vge_setlinkspeed(struct vge_softc *sc) break; } } + /* Clear forced MAC speed/duplex configuration. */ + CSR_CLRBIT_1(sc, VGE_DIAGCTL, VGE_DIAGCTL_MACFORCE); + CSR_CLRBIT_1(sc, VGE_DIAGCTL, VGE_DIAGCTL_FDXFORCE); vge_miibus_writereg(sc->vge_dev, sc->vge_phyaddr, MII_100T2CR, 0); vge_miibus_writereg(sc->vge_dev, sc->vge_phyaddr, MII_ANAR, ANAR_TX_FD | ANAR_TX | ANAR_10_FD | ANAR_10 | ANAR_CSMA); From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 00:01:50 2012 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 3CC351065672; Thu, 5 Jan 2012 00:01:50 +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 2A4608FC1C; Thu, 5 Jan 2012 00:01:50 +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 q0501owt005099; Thu, 5 Jan 2012 00:01:50 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0501oem005097; Thu, 5 Jan 2012 00:01:50 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201050001.q0501oem005097@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 5 Jan 2012 00:01:50 +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: r229542 - stable/7/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: Thu, 05 Jan 2012 00:01:50 -0000 Author: yongari Date: Thu Jan 5 00:01:49 2012 New Revision: 229542 URL: http://svn.freebsd.org/changeset/base/229542 Log: MFC r227828,227835,227837: r227828: Always start MII auto polling before accessing any MII registers. r227835: Rework link establishment and link state detection logic. - Remove MIIBUS statchg callback and program VGE_DIAGCTL before initiating link establishment. Previously driver used to program VGE_DIAGCTL after getting a link in statchg callback. It seems the VGE_DIAGCTL register works like a kind of MII register such that it requires setting a 'to be' mode in advance rather than relying on resolved speed/duplex of established link. This means the statchg callback is not needed in driver. In addition, if there was no link at the time of media change, this was not called at all. - Introduce vge_ifmedia_upd_locked() to change current media to configured one. Actual media change is performed only after PHY reset and VGE_DIAGCTL setup. - In WOL configuration, make sure to clear forced mode such that controller can rely on auto-negotiation. - Unlike most other drivers that use miibus(4), vge(4) used controller's auto-polling feature for link state tracking via interrupt. This came from controller's inefficient mechanism to access MII registers. On link state change interrupt, vge(4) used to get current link state with series of MII register accesses. Because vge(4) already enabled auto polling, read PHY status register to resolved speed/duplex/flow control parameters. vge(4) still does not drive MII_TICK to reduce number of MII register accesses which in turn means the driver does not know the status of auto-negotiation. This was a one of long standing issue of vge(4). Probably driver may be able to implement a timer that keeps track of auto-negotiation state and restart auto-negotiation when driver couldn't establish a link within a specified period. However the controller does not provide a reliable way to detect auto-negotiation failure so I'm not sure whether it's worth to implement it in driver. Alternatively driver can completely disable MII auto-polling and let miibus(4) poll link state by driving MII_TICK. This may reduce unnecessary overhead of stopping/restarting MII auto-polling of controller. Unfortunately it was known that some variants of controller does not work correctly if MII auto-polling is disabled. r227837: Announce flow control capability to underlying PHY driver. Pause timer value is initialized to 0xFFFF. Controller allows just 4 different TX pause thresholds. The lowest possible threshold value looks too aggressive so use next available threshold value. Modified: stable/7/sys/dev/vge/if_vge.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/vge/if_vge.c ============================================================================== --- stable/7/sys/dev/vge/if_vge.c Thu Jan 5 00:00:30 2012 (r229541) +++ stable/7/sys/dev/vge/if_vge.c Thu Jan 5 00:01:49 2012 (r229542) @@ -173,6 +173,7 @@ static __inline void static void vge_freebufs(struct vge_softc *); static void vge_ifmedia_sts(struct ifnet *, struct ifmediareq *); static int vge_ifmedia_upd(struct ifnet *); +static int vge_ifmedia_upd_locked(struct vge_softc *); static void vge_init(void *); static void vge_init_locked(struct vge_softc *); static void vge_intr(void *); @@ -180,7 +181,6 @@ static void vge_intr_holdoff(struct vge_ static int vge_ioctl(struct ifnet *, u_long, caddr_t); static void vge_link_statchg(void *); static int vge_miibus_readreg(device_t, int, int); -static void vge_miibus_statchg(device_t); static int vge_miibus_writereg(device_t, int, int, int); static void vge_miipoll_start(struct vge_softc *); static void vge_miipoll_stop(struct vge_softc *); @@ -190,6 +190,7 @@ static void vge_reset(struct vge_softc * static int vge_rx_list_init(struct vge_softc *); static int vge_rxeof(struct vge_softc *, int); static void vge_rxfilter(struct vge_softc *); +static void vge_setmedia(struct vge_softc *); static void vge_setvlan(struct vge_softc *); static void vge_setwol(struct vge_softc *); static void vge_start(struct ifnet *); @@ -218,7 +219,6 @@ static device_method_t vge_methods[] = { /* MII interface */ DEVMETHOD(miibus_readreg, vge_miibus_readreg), DEVMETHOD(miibus_writereg, vge_miibus_writereg), - DEVMETHOD(miibus_statchg, vge_miibus_statchg), { 0, 0 } }; @@ -1102,10 +1102,11 @@ vge_attach(device_t dev) goto fail; } + vge_miipoll_start(sc); /* Do MII setup */ error = mii_attach(dev, &sc->vge_miibus, ifp, vge_ifmedia_upd, vge_ifmedia_sts, BMSR_DEFCAPMASK, sc->vge_phyaddr, MII_OFFSET_ANY, - 0); + MIIF_DOPAUSE); if (error != 0) { device_printf(dev, "attaching PHYs failed\n"); goto fail; @@ -1663,30 +1664,41 @@ vge_link_statchg(void *xsc) { struct vge_softc *sc; struct ifnet *ifp; - struct mii_data *mii; + uint8_t physts; sc = xsc; ifp = sc->vge_ifp; VGE_LOCK_ASSERT(sc); - mii = device_get_softc(sc->vge_miibus); - mii_pollstat(mii); - if ((sc->vge_flags & VGE_FLAG_LINK) != 0) { - if (!(mii->mii_media_status & IFM_ACTIVE)) { + physts = CSR_READ_1(sc, VGE_PHYSTS0); + if ((physts & VGE_PHYSTS_RESETSTS) == 0) { + if ((physts & VGE_PHYSTS_LINK) == 0) { sc->vge_flags &= ~VGE_FLAG_LINK; if_link_state_change(sc->vge_ifp, LINK_STATE_DOWN); - } - } else { - if (mii->mii_media_status & IFM_ACTIVE && - IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) { + } else { sc->vge_flags |= VGE_FLAG_LINK; if_link_state_change(sc->vge_ifp, LINK_STATE_UP); + CSR_WRITE_1(sc, VGE_CRC2, VGE_CR2_FDX_TXFLOWCTL_ENABLE | + VGE_CR2_FDX_RXFLOWCTL_ENABLE); + if ((physts & VGE_PHYSTS_FDX) != 0) { + if ((physts & VGE_PHYSTS_TXFLOWCAP) != 0) + CSR_WRITE_1(sc, VGE_CRS2, + VGE_CR2_FDX_TXFLOWCTL_ENABLE); + if ((physts & VGE_PHYSTS_RXFLOWCAP) != 0) + CSR_WRITE_1(sc, VGE_CRS2, + VGE_CR2_FDX_RXFLOWCTL_ENABLE); + } if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) vge_start_locked(ifp); } } + /* + * Restart MII auto-polling because link state change interrupt + * will disable it. + */ + vge_miipoll_start(sc); } #ifdef DEVICE_POLLING @@ -2029,6 +2041,7 @@ vge_init_locked(struct vge_softc *sc) */ vge_stop(sc); vge_reset(sc); + vge_miipoll_start(sc); /* * Initialize the RX and TX descriptors and mbufs. @@ -2100,9 +2113,16 @@ vge_init_locked(struct vge_softc *sc) vge_rxfilter(sc); vge_setvlan(sc); - /* Enable flow control */ - - CSR_WRITE_1(sc, VGE_CRS2, 0x8B); + /* Initialize pause timer. */ + CSR_WRITE_2(sc, VGE_TX_PAUSE_TIMER, 0xFFFF); + /* + * Initialize flow control parameters. + * TX XON high threshold : 48 + * TX pause low threshold : 24 + * Disable hald-duplex flow control + */ + CSR_WRITE_1(sc, VGE_CRC2, 0xFF); + CSR_WRITE_1(sc, VGE_CRS2, VGE_CR2_XON_ENABLE | 0x0B); /* Enable jumbo frame reception (if desired) */ @@ -2130,7 +2150,7 @@ vge_init_locked(struct vge_softc *sc) CSR_WRITE_1(sc, VGE_CRS3, VGE_CR3_INT_GMSK); sc->vge_flags &= ~VGE_FLAG_LINK; - mii_mediachg(mii); + vge_ifmedia_upd_locked(sc); ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; @@ -2144,14 +2164,28 @@ static int vge_ifmedia_upd(struct ifnet *ifp) { struct vge_softc *sc; - struct mii_data *mii; int error; sc = ifp->if_softc; VGE_LOCK(sc); + error = vge_ifmedia_upd_locked(sc); + VGE_UNLOCK(sc); + + return (error); +} + +static int +vge_ifmedia_upd_locked(struct vge_softc *sc) +{ + struct mii_data *mii; + struct mii_softc *miisc; + int error; + mii = device_get_softc(sc->vge_miibus); + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) + mii_phy_reset(miisc); + vge_setmedia(sc); error = mii_mediachg(mii); - VGE_UNLOCK(sc); return (error); } @@ -2180,13 +2214,11 @@ vge_ifmedia_sts(struct ifnet *ifp, struc } static void -vge_miibus_statchg(device_t dev) +vge_setmedia(struct vge_softc *sc) { - struct vge_softc *sc; struct mii_data *mii; struct ifmedia_entry *ife; - sc = device_get_softc(dev); mii = device_get_softc(sc->vge_miibus); ife = mii->mii_media.ifm_cur; @@ -2220,7 +2252,7 @@ vge_miibus_statchg(device_t dev) } break; default: - device_printf(dev, "unknown media type: %x\n", + device_printf(sc->vge_dev, "unknown media type: %x\n", IFM_SUBTYPE(ife->ifm_media)); break; } @@ -2773,6 +2805,9 @@ vge_setlinkspeed(struct vge_softc *sc) break; } } + /* Clear forced MAC speed/duplex configuration. */ + CSR_CLRBIT_1(sc, VGE_DIAGCTL, VGE_DIAGCTL_MACFORCE); + CSR_CLRBIT_1(sc, VGE_DIAGCTL, VGE_DIAGCTL_FDXFORCE); vge_miibus_writereg(sc->vge_dev, sc->vge_phyaddr, MII_100T2CR, 0); vge_miibus_writereg(sc->vge_dev, sc->vge_phyaddr, MII_ANAR, ANAR_TX_FD | ANAR_TX | ANAR_10_FD | ANAR_10 | ANAR_CSMA); From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 00:08:16 2012 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 E6A4E1065800; Thu, 5 Jan 2012 00:08:16 +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 BA4CF8FC19; Thu, 5 Jan 2012 00:08: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 q0508GeC005362; Thu, 5 Jan 2012 00:08:16 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0508GgF005360; Thu, 5 Jan 2012 00:08:16 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201050008.q0508GgF005360@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 5 Jan 2012 00:08:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229543 - stable/9/sys/dev/mii 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, 05 Jan 2012 00:08:17 -0000 Author: yongari Date: Thu Jan 5 00:08:16 2012 New Revision: 229543 URL: http://svn.freebsd.org/changeset/base/229543 Log: MFC r227842: For IP1001 PHY, do not set multi-port device(MASTER). Ideally this bit should not affect link establishment process of auto-negotiation if manual configuration is not used, which is true in auto-negotiation. However it seems setting this bit interfere with IP1001 PHY's down-shifting feature such that establishing a 10/100Mbps link failed when 1000baseT link is not available during auto-negotiation process. Modified: stable/9/sys/dev/mii/ip1000phy.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/mii/ip1000phy.c ============================================================================== --- stable/9/sys/dev/mii/ip1000phy.c Thu Jan 5 00:01:49 2012 (r229542) +++ stable/9/sys/dev/mii/ip1000phy.c Thu Jan 5 00:08:16 2012 (r229543) @@ -324,7 +324,8 @@ ip1000phy_mii_phy_auto(struct mii_softc PHY_WRITE(sc, IP1000PHY_MII_ANAR, reg | IP1000PHY_ANAR_CSMA); reg = IP1000PHY_1000CR_1000T | IP1000PHY_1000CR_1000T_FDX; - reg |= IP1000PHY_1000CR_MASTER; + if (sc->mii_mpd_model != MII_MODEL_xxICPLUS_IP1001) + reg |= IP1000PHY_1000CR_MASTER; PHY_WRITE(sc, IP1000PHY_MII_1000CR, reg); PHY_WRITE(sc, IP1000PHY_MII_BMCR, (IP1000PHY_BMCR_FDX | IP1000PHY_BMCR_AUTOEN | IP1000PHY_BMCR_STARTNEG)); From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 00:09:50 2012 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 180EF1065670; Thu, 5 Jan 2012 00:09:50 +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 D82288FC12; Thu, 5 Jan 2012 00:09: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 q0509nEa005442; Thu, 5 Jan 2012 00:09:49 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0509nK1005440; Thu, 5 Jan 2012 00:09:49 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201050009.q0509nK1005440@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 5 Jan 2012 00:09:49 +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: r229544 - stable/8/sys/dev/mii 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, 05 Jan 2012 00:09:50 -0000 Author: yongari Date: Thu Jan 5 00:09:49 2012 New Revision: 229544 URL: http://svn.freebsd.org/changeset/base/229544 Log: MFC r227842: For IP1001 PHY, do not set multi-port device(MASTER). Ideally this bit should not affect link establishment process of auto-negotiation if manual configuration is not used, which is true in auto-negotiation. However it seems setting this bit interfere with IP1001 PHY's down-shifting feature such that establishing a 10/100Mbps link failed when 1000baseT link is not available during auto-negotiation process. Modified: stable/8/sys/dev/mii/ip1000phy.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/mii/ip1000phy.c ============================================================================== --- stable/8/sys/dev/mii/ip1000phy.c Thu Jan 5 00:08:16 2012 (r229543) +++ stable/8/sys/dev/mii/ip1000phy.c Thu Jan 5 00:09:49 2012 (r229544) @@ -357,7 +357,8 @@ ip1000phy_mii_phy_auto(struct mii_softc PHY_WRITE(sc, IP1000PHY_MII_ANAR, reg | IP1000PHY_ANAR_CSMA); reg = IP1000PHY_1000CR_1000T | IP1000PHY_1000CR_1000T_FDX; - reg |= IP1000PHY_1000CR_MASTER; + if (isc->model != MII_MODEL_ICPLUS_IP1001) + reg |= IP1000PHY_1000CR_MASTER; PHY_WRITE(sc, IP1000PHY_MII_1000CR, reg); PHY_WRITE(sc, IP1000PHY_MII_BMCR, (IP1000PHY_BMCR_FDX | IP1000PHY_BMCR_AUTOEN | IP1000PHY_BMCR_STARTNEG)); From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 00:11:04 2012 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 9990F1065676; Thu, 5 Jan 2012 00:11:04 +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 87E098FC21; Thu, 5 Jan 2012 00:11:04 +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 q050B4uU005546; Thu, 5 Jan 2012 00:11:04 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q050B4sh005544; Thu, 5 Jan 2012 00:11:04 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201050011.q050B4sh005544@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 5 Jan 2012 00:11:04 +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: r229545 - stable/7/sys/dev/mii 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, 05 Jan 2012 00:11:04 -0000 Author: yongari Date: Thu Jan 5 00:11:04 2012 New Revision: 229545 URL: http://svn.freebsd.org/changeset/base/229545 Log: MFC r227842: For IP1001 PHY, do not set multi-port device(MASTER). Ideally this bit should not affect link establishment process of auto-negotiation if manual configuration is not used, which is true in auto-negotiation. However it seems setting this bit interfere with IP1001 PHY's down-shifting feature such that establishing a 10/100Mbps link failed when 1000baseT link is not available during auto-negotiation process. Modified: stable/7/sys/dev/mii/ip1000phy.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/mii/ip1000phy.c ============================================================================== --- stable/7/sys/dev/mii/ip1000phy.c Thu Jan 5 00:09:49 2012 (r229544) +++ stable/7/sys/dev/mii/ip1000phy.c Thu Jan 5 00:11:04 2012 (r229545) @@ -357,7 +357,8 @@ ip1000phy_mii_phy_auto(struct mii_softc PHY_WRITE(sc, IP1000PHY_MII_ANAR, reg | IP1000PHY_ANAR_CSMA); reg = IP1000PHY_1000CR_1000T | IP1000PHY_1000CR_1000T_FDX; - reg |= IP1000PHY_1000CR_MASTER; + if (isc->model != MII_MODEL_ICPLUS_IP1001) + reg |= IP1000PHY_1000CR_MASTER; PHY_WRITE(sc, IP1000PHY_MII_1000CR, reg); PHY_WRITE(sc, IP1000PHY_MII_BMCR, (IP1000PHY_BMCR_FDX | IP1000PHY_BMCR_AUTOEN | IP1000PHY_BMCR_STARTNEG)); From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 01:13:25 2012 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 B4E4B106566B; Thu, 5 Jan 2012 01:13:25 +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 A3E548FC0A; Thu, 5 Jan 2012 01:13:25 +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 q051DP5p007565; Thu, 5 Jan 2012 01:13:25 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q051DPbn007563; Thu, 5 Jan 2012 01:13:25 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201201050113.q051DPbn007563@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Thu, 5 Jan 2012 01:13:25 +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: r229546 - head/sys/netinet6 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, 05 Jan 2012 01:13:25 -0000 Author: bz Date: Thu Jan 5 01:13:25 2012 New Revision: 229546 URL: http://svn.freebsd.org/changeset/base/229546 Log: Convert an #ifdef DIAGNOSTIC if/panic to a KASSERT. MFC after: 1 week Modified: head/sys/netinet6/in6_ifattach.c Modified: head/sys/netinet6/in6_ifattach.c ============================================================================== --- head/sys/netinet6/in6_ifattach.c Thu Jan 5 00:11:04 2012 (r229545) +++ head/sys/netinet6/in6_ifattach.c Thu Jan 5 01:13:25 2012 (r229546) @@ -513,12 +513,8 @@ in6_ifattach_linklocal(struct ifnet *ifp } ia = in6ifa_ifpforlinklocal(ifp, 0); /* ia must not be NULL */ -#ifdef DIAGNOSTIC - if (!ia) { - panic("ia == NULL in in6_ifattach_linklocal"); - /* NOTREACHED */ - } -#endif + KASSERT(ia != NULL, ("%s: ia == NULL, ifp=%p", __func__, ifp)); + ifa_free(&ia->ia_ifa); /* From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 01:14:36 2012 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 3CDC0106564A; Thu, 5 Jan 2012 01:14:36 +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 1180D8FC0C; Thu, 5 Jan 2012 01:14:36 +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 q051EZrE007644; Thu, 5 Jan 2012 01:14:35 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q051EZBI007641; Thu, 5 Jan 2012 01:14:35 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201201050114.q051EZBI007641@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Thu, 5 Jan 2012 01:14:35 +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: r229547 - head/sys/netinet6 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, 05 Jan 2012 01:14:36 -0000 Author: bz Date: Thu Jan 5 01:14:35 2012 New Revision: 229547 URL: http://svn.freebsd.org/changeset/base/229547 Log: Mark a couple of file local functions static and stop exporting them. MFC after: 1 week Modified: head/sys/netinet6/nd6.h head/sys/netinet6/nd6_rtr.c Modified: head/sys/netinet6/nd6.h ============================================================================== --- head/sys/netinet6/nd6.h Thu Jan 5 01:13:25 2012 (r229546) +++ head/sys/netinet6/nd6.h Thu Jan 5 01:14:35 2012 (r229547) @@ -434,15 +434,12 @@ void nd6_dad_duplicated __P((struct ifad void nd6_rs_input __P((struct mbuf *, int, int)); void nd6_ra_input __P((struct mbuf *, int, int)); void prelist_del __P((struct nd_prefix *)); -void defrouter_addreq __P((struct nd_defrouter *)); void defrouter_reset __P((void)); void defrouter_select __P((void)); void defrtrlist_del __P((struct nd_defrouter *)); void prelist_remove __P((struct nd_prefix *)); int nd6_prelist_add __P((struct nd_prefixctl *, struct nd_defrouter *, struct nd_prefix **)); -int nd6_prefix_onlink __P((struct nd_prefix *)); -int nd6_prefix_offlink __P((struct nd_prefix *)); void pfxlist_onlink_check __P((void)); struct nd_defrouter *defrouter_lookup __P((struct in6_addr *, struct ifnet *)); struct nd_prefix *nd6_prefix_lookup __P((struct nd_prefixctl *)); Modified: head/sys/netinet6/nd6_rtr.c ============================================================================== --- head/sys/netinet6/nd6_rtr.c Thu Jan 5 01:13:25 2012 (r229546) +++ head/sys/netinet6/nd6_rtr.c Thu Jan 5 01:14:35 2012 (r229547) @@ -84,6 +84,9 @@ static int in6_init_prefix_ltimes(struct static void in6_init_address_ltimes __P((struct nd_prefix *, struct in6_addrlifetime *)); +static int nd6_prefix_onlink(struct nd_prefix *); +static int nd6_prefix_offlink(struct nd_prefix *); + static int rt6_deleteroute(struct radix_node *, void *); VNET_DECLARE(int, nd6_recalc_reachtm_interval); @@ -465,7 +468,7 @@ nd6_rtmsg(int cmd, struct rtentry *rt) ifa_free(ifa); } -void +static void defrouter_addreq(struct nd_defrouter *new) { struct sockaddr_in6 def, mask, gate; @@ -1537,7 +1540,7 @@ pfxlist_onlink_check() } } -int +static int nd6_prefix_onlink(struct nd_prefix *pr) { struct ifaddr *ifa; @@ -1662,7 +1665,7 @@ nd6_prefix_onlink(struct nd_prefix *pr) return (error); } -int +static int nd6_prefix_offlink(struct nd_prefix *pr) { int error = 0; From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 01:25:47 2012 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 97F4E106566C; Thu, 5 Jan 2012 01:25:47 +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 850D38FC13; Thu, 5 Jan 2012 01:25:47 +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 q051Plj6008078; Thu, 5 Jan 2012 01:25:47 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q051PlHt008075; Thu, 5 Jan 2012 01:25:47 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201201050125.q051PlHt008075@svn.freebsd.org> From: Rick Macklem Date: Thu, 5 Jan 2012 01:25:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229548 - in stable/9/sys/fs: nfs nfsclient 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, 05 Jan 2012 01:25:47 -0000 Author: rmacklem Date: Thu Jan 5 01:25:47 2012 New Revision: 229548 URL: http://svn.freebsd.org/changeset/base/229548 Log: MFC: r227743 Post r223774 the NFSv4 client never uses the linked list with the head nfsc_defunctlockowner. This patch simply removes the code that loops through this always empty list, since the code no longer does anything useful. It should not have any effect on the client's behaviour. Modified: stable/9/sys/fs/nfs/nfsclstate.h stable/9/sys/fs/nfsclient/nfs_clstate.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/fs/nfs/nfsclstate.h ============================================================================== --- stable/9/sys/fs/nfs/nfsclstate.h Thu Jan 5 01:14:35 2012 (r229547) +++ stable/9/sys/fs/nfs/nfsclstate.h Thu Jan 5 01:25:47 2012 (r229548) @@ -48,7 +48,6 @@ struct nfsclclient { struct nfsclownerhead nfsc_owner; struct nfscldeleghead nfsc_deleg; struct nfscldeleghash nfsc_deleghash[NFSCLDELEGHASHSIZE]; - struct nfscllockownerhead nfsc_defunctlockowner; struct nfsv4lock nfsc_lock; struct proc *nfsc_renewthread; struct nfsmount *nfsc_nmp; Modified: stable/9/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- stable/9/sys/fs/nfsclient/nfs_clstate.c Thu Jan 5 01:14:35 2012 (r229547) +++ stable/9/sys/fs/nfsclient/nfs_clstate.c Thu Jan 5 01:25:47 2012 (r229548) @@ -699,7 +699,6 @@ nfscl_getcl(vnode_t vp, struct ucred *cr { struct nfsclclient *clp; struct nfsclclient *newclp = NULL; - struct nfscllockowner *lp, *nlp; struct mount *mp; struct nfsmount *nmp; char uuid[HOSTUUIDLEN]; @@ -744,7 +743,6 @@ nfscl_getcl(vnode_t vp, struct ucred *cr TAILQ_INIT(&clp->nfsc_deleg); for (i = 0; i < NFSCLDELEGHASHSIZE; i++) LIST_INIT(&clp->nfsc_deleghash[i]); - LIST_INIT(&clp->nfsc_defunctlockowner); clp->nfsc_flags = NFSCLFLAGS_INITED; clp->nfsc_clientidrev = 1; clp->nfsc_cbident = nfscl_nextcbident(); @@ -793,11 +791,6 @@ nfscl_getcl(vnode_t vp, struct ucred *cr NFSUNLOCKCLSTATE(); return (EACCES); } - /* get rid of defunct lockowners */ - LIST_FOREACH_SAFE(lp, &clp->nfsc_defunctlockowner, nfsl_list, - nlp) { - nfscl_freelockowner(lp, 0); - } /* * If RFC3530 Sec. 14.2.33 is taken literally, * NFSERR_CLIDINUSE will be returned persistently for the @@ -1537,13 +1530,6 @@ nfscl_cleanclient(struct nfsclclient *cl { struct nfsclowner *owp, *nowp; struct nfsclopen *op, *nop; - struct nfscllockowner *lp, *nlp; - - - /* get rid of defunct lockowners */ - LIST_FOREACH_SAFE(lp, &clp->nfsc_defunctlockowner, nfsl_list, nlp) { - nfscl_freelockowner(lp, 0); - } /* Now, all the OpenOwners, etc. */ LIST_FOREACH_SAFE(owp, &clp->nfsc_owner, nfsow_list, nowp) { @@ -1717,12 +1703,6 @@ nfscl_cleanup_common(struct nfsclclient } owp = nowp; } - - /* and check the defunct list */ - LIST_FOREACH(lp, &clp->nfsc_defunctlockowner, nfsl_list) { - if (!NFSBCMP(lp->nfsl_owner, own, NFSV4CL_LOCKNAMELEN)) - lp->nfsl_defunct = 1; - } } #if defined(APPLEKEXT) || defined(__FreeBSD__) @@ -1735,7 +1715,6 @@ static void nfscl_cleanupkext(struct nfsclclient *clp) { struct nfsclowner *owp, *nowp; - struct nfscllockowner *lp; NFSPROCLISTLOCK(); NFSLOCKCLSTATE(); @@ -1743,12 +1722,6 @@ nfscl_cleanupkext(struct nfsclclient *cl if (nfscl_procdoesntexist(owp->nfsow_owner)) nfscl_cleanup_common(clp, owp->nfsow_owner); } - - /* and check the defunct list */ - LIST_FOREACH(lp, &clp->nfsc_defunctlockowner, nfsl_list) { - if (nfscl_procdoesntexist(lp->nfsl_owner)) - lp->nfsl_defunct = 1; - } NFSUNLOCKCLSTATE(); NFSPROCLISTUNLOCK(); } @@ -1905,11 +1878,6 @@ nfscl_recover(struct nfsclclient *clp, s NFSUNLOCKREQ(); splx(s); - /* get rid of defunct lockowners */ - LIST_FOREACH_SAFE(lp, &clp->nfsc_defunctlockowner, nfsl_list, nlp) { - nfscl_freelockowner(lp, 0); - } - /* * Now, mark all delegations "need reclaim". */ @@ -2157,7 +2125,6 @@ nfscl_recover(struct nfsclclient *clp, s APPLESTATIC int nfscl_hasexpired(struct nfsclclient *clp, u_int32_t clidrev, NFSPROC_T *p) { - struct nfscllockowner *lp, *nlp; struct nfsmount *nmp; struct ucred *cred; int igotlock = 0, error, trycnt; @@ -2207,12 +2174,6 @@ nfscl_hasexpired(struct nfsclclient *clp clp->nfsc_flags &= ~(NFSCLFLAGS_HASCLIENTID | NFSCLFLAGS_RECOVER); } else { - /* get rid of defunct lockowners */ - LIST_FOREACH_SAFE(lp, &clp->nfsc_defunctlockowner, nfsl_list, - nlp) { - nfscl_freelockowner(lp, 0); - } - /* * Expire the state for the client. */ @@ -2486,25 +2447,6 @@ nfscl_renewthread(struct nfsclclient *cl owp = nowp; } - /* also search the defunct list */ - lp = LIST_FIRST(&clp->nfsc_defunctlockowner); - while (lp != NULL) { - nlp = LIST_NEXT(lp, nfsl_list); - if (lp->nfsl_defunct) { - LIST_FOREACH(olp, &lh, nfsl_list) { - if (!NFSBCMP(olp->nfsl_owner, lp->nfsl_owner, - NFSV4CL_LOCKNAMELEN)) - break; - } - if (olp == NULL) { - LIST_REMOVE(lp, nfsl_list); - LIST_INSERT_HEAD(&lh, lp, nfsl_list); - } else { - nfscl_freelockowner(lp, 0); - } - } - lp = nlp; - } /* and release defunct lock owners */ LIST_FOREACH_SAFE(lp, &lh, nfsl_list, nlp) { nfscl_freelockowner(lp, 0); From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 01:35:02 2012 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 0D7961065673; Thu, 5 Jan 2012 01:35:02 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EE2AB8FC0A; Thu, 5 Jan 2012 01:35: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 q051Z1hv008420; Thu, 5 Jan 2012 01:35:01 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q051Z1t5008409; Thu, 5 Jan 2012 01:35:01 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201201050135.q051Z1t5008409@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Thu, 5 Jan 2012 01:35:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229549 - stable/9/sys/fs/ext2fs 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, 05 Jan 2012 01:35:02 -0000 Author: pfg Date: Thu Jan 5 01:35:01 2012 New Revision: 229549 URL: http://svn.freebsd.org/changeset/base/229549 Log: MFC: r228507, r228539, r228583 Merge ext2_readwrite.c into ext2_vnops.c as done in UFS. Bring in reallocblk to ext2fs: new feature implemented by Zheng Liu as GSoC 2010. Many style fixes by jh@. PR: 159232, 159233 and 162564 Approved by: jhb (mentor) Deleted: stable/9/sys/fs/ext2fs/ext2_readwrite.c Modified: stable/9/sys/fs/ext2fs/ext2_alloc.c stable/9/sys/fs/ext2fs/ext2_balloc.c stable/9/sys/fs/ext2fs/ext2_bmap.c stable/9/sys/fs/ext2fs/ext2_extern.h stable/9/sys/fs/ext2fs/ext2_inode.c stable/9/sys/fs/ext2fs/ext2_lookup.c stable/9/sys/fs/ext2fs/ext2_subr.c stable/9/sys/fs/ext2fs/ext2_vfsops.c stable/9/sys/fs/ext2fs/ext2_vnops.c stable/9/sys/fs/ext2fs/ext2fs.h stable/9/sys/fs/ext2fs/fs.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/fs/ext2fs/ext2_alloc.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_alloc.c Thu Jan 5 01:25:47 2012 (r229548) +++ stable/9/sys/fs/ext2fs/ext2_alloc.c Thu Jan 5 01:35:01 2012 (r229549) @@ -42,6 +42,7 @@ #include #include #include +#include #include #include @@ -52,6 +53,7 @@ #include static daddr_t ext2_alloccg(struct inode *, int, daddr_t, int); +static daddr_t ext2_clusteralloc(struct inode *, int, daddr_t, int); static u_long ext2_dirpref(struct inode *); static void ext2_fserr(struct m_ext2fs *, uid_t, char *); static u_long ext2_hashalloc(struct inode *, int, long, int, @@ -59,9 +61,6 @@ static u_long ext2_hashalloc(struct inod int)); static daddr_t ext2_nodealloccg(struct inode *, int, daddr_t, int); static daddr_t ext2_mapsearch(struct m_ext2fs *, char *, daddr_t); -#ifdef FANCY_REALLOC -static int ext2_reallocblks(struct vop_reallocblks_args *); -#endif /* * Allocate a block in the file system. @@ -113,20 +112,20 @@ ext2_alloc(ip, lbn, bpref, size, cred, b if (bpref >= fs->e2fs->e2fs_bcount) bpref = 0; if (bpref == 0) - cg = ino_to_cg(fs, ip->i_number); - else - cg = dtog(fs, bpref); - bno = (daddr_t)ext2_hashalloc(ip, cg, bpref, fs->e2fs_bsize, - ext2_alloccg); - if (bno > 0) { + cg = ino_to_cg(fs, ip->i_number); + else + cg = dtog(fs, bpref); + bno = (daddr_t)ext2_hashalloc(ip, cg, bpref, fs->e2fs_bsize, + ext2_alloccg); + if (bno > 0) { /* set next_alloc fields as done in block_getblk */ ip->i_next_alloc_block = lbn; ip->i_next_alloc_goal = bno; - ip->i_blocks += btodb(fs->e2fs_bsize); - ip->i_flag |= IN_CHANGE | IN_UPDATE; - *bnp = bno; - return (0); + ip->i_blocks += btodb(fs->e2fs_bsize); + ip->i_flag |= IN_CHANGE | IN_UPDATE; + *bnp = bno; + return (0); } nospace: EXT2_UNLOCK(ump); @@ -150,7 +149,6 @@ nospace: * the previous block allocation will be used. */ -#ifdef FANCY_REALLOC SYSCTL_NODE(_vfs, OID_AUTO, ext2fs, CTLFLAG_RW, 0, "EXT2FS filesystem"); static int doasyncfree = 1; @@ -159,7 +157,6 @@ SYSCTL_INT(_vfs_ext2fs, OID_AUTO, doasyn static int doreallocblks = 1; SYSCTL_INT(_vfs_ext2fs, OID_AUTO, doreallocblks, CTLFLAG_RW, &doreallocblks, 0, ""); -#endif int ext2_reallocblks(ap) @@ -168,11 +165,6 @@ ext2_reallocblks(ap) struct cluster_save *a_buflist; } */ *ap; { -#ifndef FANCY_REALLOC -/* printf("ext2_reallocblks not implemented\n"); */ -return ENOSPC; -#else - struct m_ext2fs *fs; struct inode *ip; struct vnode *vp; @@ -184,14 +176,17 @@ return ENOSPC; int32_t start_lbn, end_lbn, soff, newblk, blkno; int i, len, start_lvl, end_lvl, pref, ssize; + if (doreallocblks == 0) + return (ENOSPC); + vp = ap->a_vp; ip = VTOI(vp); fs = ip->i_e2fs; ump = ip->i_ump; -#ifdef UNKLAR - if (fs->fs_contigsumsize <= 0) + + if (fs->e2fs_contigsumsize <= 0) return (ENOSPC); -#endif + buflist = ap->a_buflist; len = buflist->bs_nchildren; start_lbn = buflist->bs_children[0]->b_lblkno; @@ -228,11 +223,6 @@ return ENOSPC; soff = idp->in_off; } /* - * Find the preferred location for the cluster. - */ - EXT2_LOCK(ump); - pref = ext2_blkpref(ip, start_lbn, soff, sbap, 0); - /* * If the block range spans two block maps, get the second map. */ if (end_lvl == 0 || (idp = &end_ap[end_lvl - 1])->in_off + 1 >= len) { @@ -243,13 +233,16 @@ return ENOSPC; panic("ext2_reallocblk: start == end"); #endif ssize = len - (idp->in_off + 1); - if (bread(vp, idp->in_lbn, (int)fs->e2fs_bsize, NOCRED, &ebp)){ - EXT2_UNLOCK(ump); + if (bread(vp, idp->in_lbn, (int)fs->e2fs_bsize, NOCRED, &ebp)) goto fail; - } ebap = (int32_t *)ebp->b_data; } /* + * Find the preferred location for the cluster. + */ + EXT2_LOCK(ump); + pref = ext2_blkpref(ip, start_lbn, soff, sbap, 0); + /* * Search the block map looking for an allocation of the desired size. */ if ((newblk = (int32_t)ext2_hashalloc(ip, dtog(fs, pref), pref, @@ -264,15 +257,23 @@ return ENOSPC; * block pointers in the inode and indirect blocks associated * with the file. */ +#ifdef DEBUG + printf("realloc: ino %d, lbns %jd-%jd\n\told:", ip->i_number, + (intmax_t)start_lbn, (intmax_t)end_lbn); +#endif /* DEBUG */ blkno = newblk; for (bap = &sbap[soff], i = 0; i < len; i++, blkno += fs->e2fs_fpb) { - if (i == ssize) + if (i == ssize) { bap = ebap; soff = -i; + } #ifdef DIAGNOSTIC if (buflist->bs_children[i]->b_blkno != fsbtodb(fs, *bap)) panic("ext2_reallocblks: alloc mismatch"); #endif +#ifdef DEBUG + printf(" %d,", *bap); +#endif /* DEBUG */ *bap++ = blkno; } /* @@ -308,11 +309,20 @@ return ENOSPC; /* * Last, free the old blocks and assign the new blocks to the buffers. */ +#ifdef DEBUG + printf("\n\tnew:"); +#endif /* DEBUG */ for (blkno = newblk, i = 0; i < len; i++, blkno += fs->e2fs_fpb) { ext2_blkfree(ip, dbtofsb(fs, buflist->bs_children[i]->b_blkno), fs->e2fs_bsize); buflist->bs_children[i]->b_blkno = fsbtodb(fs, blkno); - } +#ifdef DEBUG + printf(" %d,", blkno); +#endif /* DEBUG */ + } +#ifdef DEBUG + printf("\n"); +#endif /* DEBUG */ return (0); fail: @@ -321,8 +331,6 @@ fail: if (sbap != &ip->i_db[0]) brelse(sbp); return (ENOSPC); - -#endif /* FANCY_REALLOC */ } /* @@ -356,7 +364,7 @@ ext2_valloc(pvp, mode, cred, vpp) * ext2_dirpref else obtain it using ino_to_cg. The preferred inode is * always the next inode. */ - if((mode & IFMT) == IFDIR) { + if ((mode & IFMT) == IFDIR) { cg = ext2_dirpref(pip); if (fs->e2fs_contigdirs[cg] < 255) fs->e2fs_contigdirs[cg]++; @@ -549,13 +557,13 @@ ext2_blkpref(ip, lbn, indx, bap, blocknr /* if the next block is actually what we thought it is, then set the goal to what we thought it should be */ - if(ip->i_next_alloc_block == lbn && ip->i_next_alloc_goal != 0) + if (ip->i_next_alloc_block == lbn && ip->i_next_alloc_goal != 0) return ip->i_next_alloc_goal; /* now check whether we were provided with an array that basically tells us previous blocks to which we want to stay closeby */ - if(bap) + if (bap) for (tmp = indx - 1; tmp >= 0; tmp--) if (bap[tmp]) return bap[tmp]; @@ -747,6 +755,7 @@ gotit: #endif setbit(bbp, bno); EXT2_LOCK(ump); + ext2_clusteracct(fs, bbp, cg, bno, -1); fs->e2fs->e2fs_fbcount--; fs->e2fs_gd[cg].ext2bgd_nbfree--; fs->e2fs_fmod = 1; @@ -756,6 +765,116 @@ gotit: } /* + * Determine whether a cluster can be allocated. + */ +static daddr_t +ext2_clusteralloc(struct inode *ip, int cg, daddr_t bpref, int len) +{ + struct m_ext2fs *fs; + struct ext2mount *ump; + struct buf *bp; + char *bbp; + int bit, error, got, i, loc, run; + int32_t *lp; + daddr_t bno; + + fs = ip->i_e2fs; + ump = ip->i_ump; + + if (fs->e2fs_maxcluster[cg] < len) + return (0); + + EXT2_UNLOCK(ump); + error = bread(ip->i_devvp, + fsbtodb(fs, fs->e2fs_gd[cg].ext2bgd_b_bitmap), + (int)fs->e2fs_bsize, NOCRED, &bp); + if (error) + goto fail_lock; + + bbp = (char *)bp->b_data; + bp->b_xflags |= BX_BKGRDWRITE; + + EXT2_LOCK(ump); + /* + * Check to see if a cluster of the needed size (or bigger) is + * available in this cylinder group. + */ + lp = &fs->e2fs_clustersum[cg].cs_sum[len]; + for (i = len; i <= fs->e2fs_contigsumsize; i++) + if (*lp++ > 0) + break; + if (i > fs->e2fs_contigsumsize) { + /* + * Update the cluster summary information to reflect + * the true maximum-sized cluster so that future cluster + * allocation requests can avoid reading the bitmap only + * to find no cluster. + */ + lp = &fs->e2fs_clustersum[cg].cs_sum[len - 1]; + for (i = len - 1; i > 0; i--) + if (*lp-- > 0) + break; + fs->e2fs_maxcluster[cg] = i; + goto fail; + } + EXT2_UNLOCK(ump); + + /* Search the bitmap to find a big enough cluster like in FFS. */ + if (dtog(fs, bpref) != cg) + bpref = 0; + if (bpref != 0) + bpref = dtogd(fs, bpref); + loc = bpref / NBBY; + bit = 1 << (bpref % NBBY); + for (run = 0, got = bpref; got < fs->e2fs->e2fs_fpg; got++) { + if ((bbp[loc] & bit) != 0) + run = 0; + else { + run++; + if (run == len) + break; + } + if ((got & (NBBY - 1)) != (NBBY - 1)) + bit <<= 1; + else { + loc++; + bit = 1; + } + } + + if (got >= fs->e2fs->e2fs_fpg) + goto fail_lock; + + /* Allocate the cluster that we found. */ + for (i = 1; i < len; i++) + if (!isclr(bbp, got - run + i)) + panic("ext2_clusteralloc: map mismatch"); + + bno = got - run + 1; + if (bno >= fs->e2fs->e2fs_fpg) + panic("ext2_clusteralloc: allocated out of group"); + + EXT2_LOCK(ump); + for (i = 0; i < len; i += fs->e2fs_fpb) { + setbit(bbp, bno + i); + ext2_clusteracct(fs, bbp, cg, bno + i, -1); + fs->e2fs->e2fs_fbcount--; + fs->e2fs_gd[cg].ext2bgd_nbfree--; + } + fs->e2fs_fmod = 1; + EXT2_UNLOCK(ump); + + bdwrite(bp); + return (cg * fs->e2fs->e2fs_fpg + fs->e2fs->e2fs_first_dblock + bno); + +fail_lock: + EXT2_LOCK(ump); +fail: + brelse(bp); + return (0); +} + +/* * Determine whether an inode can be allocated. * * Check to see if an inode is available, and if it is, @@ -877,6 +996,7 @@ ext2_blkfree(ip, bno, size) } clrbit(bbp, bno); EXT2_LOCK(ump); + ext2_clusteracct(fs, bbp, cg, bno, 1); fs->e2fs->e2fs_fbcount++; fs->e2fs_gd[cg].ext2bgd_nbfree++; fs->e2fs_fmod = 1; Modified: stable/9/sys/fs/ext2fs/ext2_balloc.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_balloc.c Thu Jan 5 01:25:47 2012 (r229548) +++ stable/9/sys/fs/ext2fs/ext2_balloc.c Thu Jan 5 01:35:01 2012 (r229549) @@ -156,7 +156,7 @@ ext2_balloc(ip, lbn, size, cred, bpp, fl */ pref = 0; if ((error = ext2_getlbns(vp, lbn, indirs, &num)) != 0) - return(error); + return (error); #ifdef DIAGNOSTIC if (num < 1) panic ("ext2_balloc: ext2_getlbns returned indirect block"); Modified: stable/9/sys/fs/ext2fs/ext2_bmap.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_bmap.c Thu Jan 5 01:25:47 2012 (r229548) +++ stable/9/sys/fs/ext2fs/ext2_bmap.c Thu Jan 5 01:35:01 2012 (r229549) @@ -215,7 +215,7 @@ ext2_bmaparray(vp, bn, bnp, runp, runb) ++bn, ++*runp); bn = ap->in_off; if (runb && bn) { - for(--bn; bn >= 0 && *runb < maxrun && + for (--bn; bn >= 0 && *runb < maxrun && is_sequential(ump, ((int32_t *)bp->b_data)[bn], ((int32_t *)bp->b_data)[bn+1]); --bn, ++*runb); Modified: stable/9/sys/fs/ext2fs/ext2_extern.h ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_extern.h Thu Jan 5 01:25:47 2012 (r229548) +++ stable/9/sys/fs/ext2fs/ext2_extern.h Thu Jan 5 01:35:01 2012 (r229549) @@ -55,12 +55,13 @@ void ext2_blkfree(struct inode *, int32_ int32_t ext2_blkpref(struct inode *, int32_t, int, int32_t *, int32_t); int ext2_bmap(struct vop_bmap_args *); int ext2_bmaparray(struct vnode *, int32_t, int32_t *, int *, int *); +void ext2_clusteracct(struct m_ext2fs *, char *, int, daddr_t, int); void ext2_dirbad(struct inode *ip, doff_t offset, char *how); void ext2_ei2i(struct ext2fs_dinode *, struct inode *); int ext2_getlbns(struct vnode *, int32_t, struct indir *, int *); void ext2_i2ei(struct inode *, struct ext2fs_dinode *); +int ext2_reallocblks(struct vop_reallocblks_args *); void ext2_itimes(struct vnode *vp); -int ext2_reallocblks(struct vop_reallocblks_args *); int ext2_reclaim(struct vop_reclaim_args *); void ext2_setblock(struct m_ext2fs *, u_char *, int32_t); int ext2_truncate(struct vnode *, off_t, int, struct ucred *, struct thread *); Modified: stable/9/sys/fs/ext2fs/ext2_inode.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_inode.c Thu Jan 5 01:25:47 2012 (r229548) +++ stable/9/sys/fs/ext2fs/ext2_inode.c Thu Jan 5 01:35:01 2012 (r229549) @@ -229,7 +229,7 @@ ext2_truncate(vp, length, flags, cred, t * will be returned to the free list. lastiblock values are also * normalized to -1 for calls to ext2_indirtrunc below. */ - bcopy((caddr_t)&oip->i_db[0], (caddr_t)oldblks, sizeof oldblks); + bcopy((caddr_t)&oip->i_db[0], (caddr_t)oldblks, sizeof(oldblks)); for (level = TRIPLE; level >= SINGLE; level--) if (lastiblock[level] < 0) { oip->i_ib[level] = 0; @@ -246,8 +246,8 @@ ext2_truncate(vp, length, flags, cred, t * Note that we save the new block configuration so we can check it * when we are done. */ - bcopy((caddr_t)&oip->i_db[0], (caddr_t)newblks, sizeof newblks); - bcopy((caddr_t)oldblks, (caddr_t)&oip->i_db[0], sizeof oldblks); + bcopy((caddr_t)&oip->i_db[0], (caddr_t)newblks, sizeof(newblks)); + bcopy((caddr_t)oldblks, (caddr_t)&oip->i_db[0], sizeof(oldblks)); oip->i_size = osize; error = vtruncbuf(ovp, cred, td, length, (int)fs->e2fs_bsize); if (error && (allerror == 0)) @@ -418,7 +418,7 @@ ext2_indirtrunc(ip, lbn, dbn, lastbn, le copy = malloc(fs->e2fs_bsize, M_TEMP, M_WAITOK); bcopy((caddr_t)bap, (caddr_t)copy, (u_int)fs->e2fs_bsize); bzero((caddr_t)&bap[last + 1], - (u_int)(NINDIR(fs) - (last + 1)) * sizeof (int32_t)); + (u_int)(NINDIR(fs) - (last + 1)) * sizeof(int32_t)); if (last == -1) bp->b_flags |= B_INVAL; error = bwrite(bp); Modified: stable/9/sys/fs/ext2fs/ext2_lookup.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_lookup.c Thu Jan 5 01:25:47 2012 (r229548) +++ stable/9/sys/fs/ext2fs/ext2_lookup.c Thu Jan 5 01:35:01 2012 (r229549) @@ -1002,7 +1002,7 @@ ext2_dirempty(ip, parentino, cred) struct dirtemplate dbuf; struct ext2fs_direct_2 *dp = (struct ext2fs_direct_2 *)&dbuf; int error, count, namlen; -#define MINDIRSIZ (sizeof (struct dirtemplate) / 2) +#define MINDIRSIZ (sizeof(struct dirtemplate) / 2) for (off = 0; off < ip->i_size; off += dp->e2d_reclen) { error = vn_rdwr(UIO_READ, ITOV(ip), (caddr_t)dp, MINDIRSIZ, @@ -1070,7 +1070,7 @@ ext2_checkpath(source, target, cred) break; } error = vn_rdwr(UIO_READ, vp, (caddr_t)&dirbuf, - sizeof (struct dirtemplate), (off_t)0, UIO_SYSSPACE, + sizeof(struct dirtemplate), (off_t)0, UIO_SYSSPACE, IO_NODELOCKED | IO_NOMACCHECK, cred, NOCRED, NULL, NULL); if (error != 0) Modified: stable/9/sys/fs/ext2fs/ext2_subr.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_subr.c Thu Jan 5 01:25:47 2012 (r229548) +++ stable/9/sys/fs/ext2fs/ext2_subr.c Thu Jan 5 01:35:01 2012 (r229549) @@ -120,3 +120,107 @@ ext2_checkoverlap(bp, ip) } } #endif /* KDB */ + +/* + * Update the cluster map because of an allocation of free like ffs. + * + * Cnt == 1 means free; cnt == -1 means allocating. + */ +void +ext2_clusteracct(struct m_ext2fs *fs, char *bbp, int cg, daddr_t bno, int cnt) +{ + int32_t *sump = fs->e2fs_clustersum[cg].cs_sum; + int32_t *lp; + int back, bit, end, forw, i, loc, start; + + /* Initialize the cluster summary array. */ + if (fs->e2fs_clustersum[cg].cs_init == 0) { + int run = 0; + bit = 1; + loc = 0; + + for (i = 0; i < fs->e2fs->e2fs_fpg; i++) { + if ((bbp[loc] & bit) == 0) + run++; + else if (run != 0) { + if (run > fs->e2fs_contigsumsize) + run = fs->e2fs_contigsumsize; + sump[run]++; + run = 0; + } + if ((i & (NBBY - 1)) != (NBBY - 1)) + bit <<= 1; + else { + loc++; + bit = 1; + } + } + if (run != 0) { + if (run > fs->e2fs_contigsumsize) + run = fs->e2fs_contigsumsize; + sump[run]++; + } + fs->e2fs_clustersum[cg].cs_init = 1; + } + + if (fs->e2fs_contigsumsize <= 0) + return; + + /* Find the size of the cluster going forward. */ + start = bno + 1; + end = start + fs->e2fs_contigsumsize; + if (end > fs->e2fs->e2fs_fpg) + end = fs->e2fs->e2fs_fpg; + loc = start / NBBY; + bit = 1 << (start % NBBY); + for (i = start; i < end; i++) { + if ((bbp[loc] & bit) != 0) + break; + if ((i & (NBBY - 1)) != (NBBY - 1)) + bit <<= 1; + else { + loc++; + bit = 1; + } + } + forw = i - start; + + /* Find the size of the cluster going backward. */ + start = bno - 1; + end = start - fs->e2fs_contigsumsize; + if (end < 0) + end = -1; + loc = start / NBBY; + bit = 1 << (start % NBBY); + for (i = start; i > end; i--) { + if ((bbp[loc] & bit) != 0) + break; + if ((i & (NBBY - 1)) != 0) + bit >>= 1; + else { + loc--; + bit = 1 << (NBBY - 1); + } + } + back = start - i; + + /* + * Account for old cluster and the possibly new forward and + * back clusters. + */ + i = back + forw + 1; + if (i > fs->e2fs_contigsumsize) + i = fs->e2fs_contigsumsize; + sump[i] += cnt; + if (back > 0) + sump[back] -= cnt; + if (forw > 0) + sump[forw] -= cnt; + + /* Update cluster summary information. */ + lp = &sump[fs->e2fs_contigsumsize]; + for (i = fs->e2fs_contigsumsize; i > 0; i--) + if (*lp-- > 0) + break; + fs->e2fs_maxcluster[cg] = i; +} Modified: stable/9/sys/fs/ext2fs/ext2_vfsops.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_vfsops.c Thu Jan 5 01:25:47 2012 (r229548) +++ stable/9/sys/fs/ext2fs/ext2_vfsops.c Thu Jan 5 01:35:01 2012 (r229549) @@ -349,7 +349,7 @@ compute_sb_data(struct vnode *devvp, str } fs->e2fs_ipb = fs->e2fs_bsize / EXT2_INODE_SIZE(fs); fs->e2fs_itpg = fs->e2fs_ipg /fs->e2fs_ipb; - fs->e2fs_descpb = fs->e2fs_bsize / sizeof (struct ext2_gd); + fs->e2fs_descpb = fs->e2fs_bsize / sizeof(struct ext2_gd); /* s_resuid / s_resgid ? */ fs->e2fs_gcount = (es->e2fs_bcount - es->e2fs_first_dblock + EXT2_BLOCKS_PER_GROUP(fs) - 1) / EXT2_BLOCKS_PER_GROUP(fs); @@ -405,7 +405,7 @@ compute_sb_data(struct vnode *devvp, str * Things to do to update the mount: * 1) invalidate all cached meta-data. * 2) re-read superblock from disk. - * 3) re-read summary information from disk. + * 3) invalidate all cluster summary information. * 4) invalidate all inactive vnodes. * 5) invalidate all cached file data. * 6) re-read inode data for all active vnodes. @@ -419,7 +419,9 @@ ext2_reload(struct mount *mp, struct thr struct buf *bp; struct ext2fs *es; struct m_ext2fs *fs; - int error; + struct csum *sump; + int error, i; + int32_t *lp; if ((mp->mnt_flag & MNT_RDONLY) == 0) return (EINVAL); @@ -456,6 +458,19 @@ ext2_reload(struct mount *mp, struct thr #endif brelse(bp); + /* + * Step 3: invalidate all cluster summary information. + */ + if (fs->e2fs_contigsumsize > 0) { + lp = fs->e2fs_maxcluster; + sump = fs->e2fs_clustersum; + for (i = 0; i < fs->e2fs_gcount; i++, sump++) { + *lp++ = fs->e2fs_contigsumsize; + sump->cs_init = 0; + bzero(sump->cs_sum, fs->e2fs_contigsumsize + 1); + } + } + loop: MNT_ILOCK(mp); MNT_VNODE_FOREACH(vp, mp, mvp) { @@ -511,8 +526,11 @@ ext2_mountfs(struct vnode *devvp, struct struct cdev *dev = devvp->v_rdev; struct g_consumer *cp; struct bufobj *bo; + struct csum *sump; int error; int ronly; + int i, size; + int32_t *lp; ronly = vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0); /* XXX: use VOP_ACESS to check FS perms */ @@ -565,8 +583,7 @@ ext2_mountfs(struct vnode *devvp, struct goto out; } } - ump = malloc(sizeof *ump, M_EXT2MNT, M_WAITOK); - bzero((caddr_t)ump, sizeof *ump); + ump = malloc(sizeof(*ump), M_EXT2MNT, M_WAITOK | M_ZERO); /* * I don't know whether this is the right strategy. Note that @@ -582,6 +599,33 @@ ext2_mountfs(struct vnode *devvp, struct if ((error = compute_sb_data(devvp, ump->um_e2fs->e2fs, ump->um_e2fs))) goto out; + /* + * Calculate the maximum contiguous blocks and size of cluster summary + * array. In FFS this is done by newfs; however, the superblock + * in ext2fs doesn't have these variables, so we can calculate + * them here. + */ + ump->um_e2fs->e2fs_maxcontig = MAX(1, MAXPHYS / ump->um_e2fs->e2fs_bsize); + if (ump->um_e2fs->e2fs_maxcontig > 0) + ump->um_e2fs->e2fs_contigsumsize = + MIN(ump->um_e2fs->e2fs_maxcontig, EXT2_MAXCONTIG); + else + ump->um_e2fs->e2fs_contigsumsize = 0; + if (ump->um_e2fs->e2fs_contigsumsize > 0) { + size = ump->um_e2fs->e2fs_gcount * sizeof(int32_t); + ump->um_e2fs->e2fs_maxcluster = malloc(size, M_EXT2MNT, M_WAITOK); + size = ump->um_e2fs->e2fs_gcount * sizeof(struct csum); + ump->um_e2fs->e2fs_clustersum = malloc(size, M_EXT2MNT, M_WAITOK); + lp = ump->um_e2fs->e2fs_maxcluster; + sump = ump->um_e2fs->e2fs_clustersum; + for (i = 0; i < ump->um_e2fs->e2fs_gcount; i++, sump++) { + *lp++ = ump->um_e2fs->e2fs_contigsumsize; + sump->cs_init = 0; + sump->cs_sum = malloc((ump->um_e2fs->e2fs_contigsumsize + 1) * + sizeof(int32_t), M_EXT2MNT, M_WAITOK | M_ZERO); + } + } + brelse(bp); bp = NULL; fs = ump->um_e2fs; @@ -656,7 +700,8 @@ ext2_unmount(struct mount *mp, int mntfl { struct ext2mount *ump; struct m_ext2fs *fs; - int error, flags, ronly; + struct csum *sump; + int error, flags, i, ronly; flags = 0; if (mntflags & MNT_FORCE) { @@ -681,6 +726,11 @@ ext2_unmount(struct mount *mp, int mntfl g_topology_unlock(); PICKUP_GIANT(); vrele(ump->um_devvp); + sump = fs->e2fs_clustersum; + for (i = 0; i < fs->e2fs_gcount; i++, sump++) + free(sump->cs_sum, M_EXT2MNT); + free(fs->e2fs_clustersum, M_EXT2MNT); + free(fs->e2fs_maxcluster, M_EXT2MNT); free(fs->e2fs_gd, M_EXT2MNT); free(fs->e2fs_contigdirs, M_EXT2MNT); free(fs->e2fs, M_EXT2MNT); @@ -927,7 +977,7 @@ ext2_vget(struct mount *mp, ino_t ino, i */ if(S_ISDIR(ip->i_mode) || S_ISREG(ip->i_mode)) { used_blocks = (ip->i_size+fs->e2fs_bsize-1) / fs->e2fs_bsize; - for(i = used_blocks; i < EXT2_NDIR_BLOCKS; i++) + for (i = used_blocks; i < EXT2_NDIR_BLOCKS; i++) ip->i_db[i] = 0; } /* Modified: stable/9/sys/fs/ext2fs/ext2_vnops.c ============================================================================== --- stable/9/sys/fs/ext2fs/ext2_vnops.c Thu Jan 5 01:25:47 2012 (r229548) +++ stable/9/sys/fs/ext2fs/ext2_vnops.c Thu Jan 5 01:35:01 2012 (r229549) @@ -64,9 +64,13 @@ #include #include +#include +#include #include #include +#include "opt_directio.h" + #include #include @@ -159,8 +163,6 @@ struct vop_vector ext2_fifoops = { .vop_vptofh = ext2_vptofh, }; -#include - /* * A virgin directory (no blushing please). * Note that the type and namlen fields are reversed relative to ext2. @@ -1078,7 +1080,7 @@ abortit: dp->i_nlink--; dp->i_flag |= IN_CHANGE; error = vn_rdwr(UIO_READ, fvp, (caddr_t)&dirbuf, - sizeof (struct dirtemplate), (off_t)0, + sizeof(struct dirtemplate), (off_t)0, UIO_SYSSPACE, IO_NODELOCKED | IO_NOMACCHECK, tcnp->cn_cred, NOCRED, NULL, NULL); if (error == 0) { @@ -1093,7 +1095,7 @@ abortit: dirbuf.dotdot_ino = newparent; (void) vn_rdwr(UIO_WRITE, fvp, (caddr_t)&dirbuf, - sizeof (struct dirtemplate), + sizeof(struct dirtemplate), (off_t)0, UIO_SYSSPACE, IO_NODELOCKED | IO_SYNC | IO_NOMACCHECK, tcnp->cn_cred, @@ -1231,7 +1233,7 @@ ext2_mkdir(ap) #define DIRBLKSIZ VTOI(dvp)->i_e2fs->e2fs_bsize dirtemplate.dotdot_reclen = DIRBLKSIZ - 12; error = vn_rdwr(UIO_WRITE, tvp, (caddr_t)&dirtemplate, - sizeof (dirtemplate), (off_t)0, UIO_SYSSPACE, + sizeof(dirtemplate), (off_t)0, UIO_SYSSPACE, IO_NODELOCKED | IO_SYNC | IO_NOMACCHECK, cnp->cn_cred, NOCRED, NULL, NULL); if (error) { @@ -1675,3 +1677,328 @@ bad: vput(tvp); return (error); } + +/* + * Vnode op for reading. + */ +static int +ext2_read(ap) + struct vop_read_args /* { + struct vnode *a_vp; + struct uio *a_uio; + int a_ioflag; + struct ucred *a_cred; + } */ *ap; +{ + struct vnode *vp; + struct inode *ip; + struct uio *uio; + struct m_ext2fs *fs; + struct buf *bp; + daddr_t lbn, nextlbn; + off_t bytesinfile; + long size, xfersize, blkoffset; + int error, orig_resid, seqcount; + int ioflag; + + vp = ap->a_vp; + uio = ap->a_uio; + ioflag = ap->a_ioflag; + + seqcount = ap->a_ioflag >> IO_SEQSHIFT; + ip = VTOI(vp); + +#ifdef INVARIANTS + if (uio->uio_rw != UIO_READ) + panic("%s: mode", "ext2_read"); + + if (vp->v_type == VLNK) { + if ((int)ip->i_size < vp->v_mount->mnt_maxsymlinklen) + panic("%s: short symlink", "ext2_read"); + } else if (vp->v_type != VREG && vp->v_type != VDIR) + panic("%s: type %d", "ext2_read", vp->v_type); +#endif + orig_resid = uio->uio_resid; + KASSERT(orig_resid >= 0, ("ext2_read: uio->uio_resid < 0")); + if (orig_resid == 0) + return (0); + KASSERT(uio->uio_offset >= 0, ("ext2_read: uio->uio_offset < 0")); + fs = ip->i_e2fs; + if (uio->uio_offset < ip->i_size && + uio->uio_offset >= fs->e2fs_maxfilesize) + return (EOVERFLOW); + + for (error = 0, bp = NULL; uio->uio_resid > 0; bp = NULL) { + if ((bytesinfile = ip->i_size - uio->uio_offset) <= 0) + break; + lbn = lblkno(fs, uio->uio_offset); + nextlbn = lbn + 1; + size = blksize(fs, ip, lbn); + blkoffset = blkoff(fs, uio->uio_offset); + + xfersize = fs->e2fs_fsize - blkoffset; + if (uio->uio_resid < xfersize) + xfersize = uio->uio_resid; + if (bytesinfile < xfersize) + xfersize = bytesinfile; + + if (lblktosize(fs, nextlbn) >= ip->i_size) + error = bread(vp, lbn, size, NOCRED, &bp); + else if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERR) == 0) + error = cluster_read(vp, ip->i_size, lbn, size, + NOCRED, blkoffset + uio->uio_resid, seqcount, &bp); + else if (seqcount > 1) { + int nextsize = blksize(fs, ip, nextlbn); + error = breadn(vp, lbn, + size, &nextlbn, &nextsize, 1, NOCRED, &bp); + } else + error = bread(vp, lbn, size, NOCRED, &bp); + if (error) { + brelse(bp); + bp = NULL; + break; + } + + /* + * If IO_DIRECT then set B_DIRECT for the buffer. This + * will cause us to attempt to release the buffer later on + * and will cause the buffer cache to attempt to free the + * underlying pages. + */ + if (ioflag & IO_DIRECT) + bp->b_flags |= B_DIRECT; + + /* + * We should only get non-zero b_resid when an I/O error + * has occurred, which should cause us to break above. + * However, if the short read did not cause an error, + * then we want to ensure that we do not uiomove bad + * or uninitialized data. + */ + size -= bp->b_resid; + if (size < xfersize) { + if (size == 0) + break; + xfersize = size; + } + error = uiomove((char *)bp->b_data + blkoffset, + (int)xfersize, uio); + if (error) + break; + + if (ioflag & (IO_VMIO|IO_DIRECT)) { + /* + * If it's VMIO or direct I/O, then we don't + * need the buf, mark it available for + * freeing. If it's non-direct VMIO, the VM has + * the data. + */ + bp->b_flags |= B_RELBUF; + brelse(bp); + } else { + /* + * Otherwise let whoever + * made the request take care of + * freeing it. We just queue + * it onto another list. + */ + bqrelse(bp); + } + } + + /* + * This can only happen in the case of an error + * because the loop above resets bp to NULL on each iteration + * and on normal completion has not set a new value into it. + * so it must have come from a 'break' statement + */ + if (bp != NULL) { + if (ioflag & (IO_VMIO|IO_DIRECT)) { + bp->b_flags |= B_RELBUF; + brelse(bp); + } else { + bqrelse(bp); + } + } + + if ((error == 0 || uio->uio_resid != orig_resid) && + (vp->v_mount->mnt_flag & MNT_NOATIME) == 0) + ip->i_flag |= IN_ACCESS; + return (error); +} + +/* + * Vnode op for writing. + */ +static int +ext2_write(ap) + struct vop_write_args /* { + struct vnode *a_vp; + struct uio *a_uio; + int a_ioflag; + struct ucred *a_cred; + } */ *ap; +{ + struct vnode *vp; + struct uio *uio; + struct inode *ip; + struct m_ext2fs *fs; + struct buf *bp; + daddr_t lbn; + off_t osize; + int blkoffset, error, flags, ioflag, resid, size, seqcount, xfersize; + + ioflag = ap->a_ioflag; + uio = ap->a_uio; + vp = ap->a_vp; + + seqcount = ioflag >> IO_SEQSHIFT; + ip = VTOI(vp); + +#ifdef INVARIANTS + if (uio->uio_rw != UIO_WRITE) + panic("%s: mode", "ext2_write"); +#endif + + switch (vp->v_type) { + case VREG: + if (ioflag & IO_APPEND) + uio->uio_offset = ip->i_size; + if ((ip->i_flags & APPEND) && uio->uio_offset != ip->i_size) + return (EPERM); + /* FALLTHROUGH */ + case VLNK: + break; + case VDIR: + /* XXX differs from ffs -- this is called from ext2_mkdir(). */ + if ((ioflag & IO_SYNC) == 0) + panic("ext2_write: nonsync dir write"); + break; + default: + panic("ext2_write: type %p %d (%jd,%jd)", (void *)vp, + vp->v_type, (intmax_t)uio->uio_offset, + (intmax_t)uio->uio_resid); + } + + KASSERT(uio->uio_resid >= 0, ("ext2_write: uio->uio_resid < 0")); + KASSERT(uio->uio_offset >= 0, ("ext2_write: uio->uio_offset < 0")); + fs = ip->i_e2fs; + if ((uoff_t)uio->uio_offset + uio->uio_resid > fs->e2fs_maxfilesize) + return (EFBIG); + /* + * Maybe this should be above the vnode op call, but so long as + * file servers have no limits, I don't think it matters. + */ + if (vn_rlimit_fsize(vp, uio, uio->uio_td)) + return (EFBIG); + + resid = uio->uio_resid; + osize = ip->i_size; + if (seqcount > BA_SEQMAX) + flags = BA_SEQMAX << BA_SEQSHIFT; + else + flags = seqcount << BA_SEQSHIFT; + if ((ioflag & IO_SYNC) && !DOINGASYNC(vp)) + flags |= IO_SYNC; + + for (error = 0; uio->uio_resid > 0;) { + lbn = lblkno(fs, uio->uio_offset); + blkoffset = blkoff(fs, uio->uio_offset); + xfersize = fs->e2fs_fsize - blkoffset; + if (uio->uio_resid < xfersize) + xfersize = uio->uio_resid; + if (uio->uio_offset + xfersize > ip->i_size) + vnode_pager_setsize(vp, uio->uio_offset + xfersize); + + /* + * We must perform a read-before-write if the transfer size + * does not cover the entire buffer. + */ + if (fs->e2fs_bsize > xfersize) + flags |= BA_CLRBUF; + else + flags &= ~BA_CLRBUF; + error = ext2_balloc(ip, lbn, blkoffset + xfersize, + ap->a_cred, &bp, flags); + if (error != 0) + break; + + /* + * If the buffer is not valid and we did not clear garbage + * out above, we have to do so here even though the write + * covers the entire buffer in order to avoid a mmap()/write + * race where another process may see the garbage prior to + * the uiomove() for a write replacing it. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 01:40:42 2012 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 94461106566C; Thu, 5 Jan 2012 01:40:42 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 477048FC13; Thu, 5 Jan 2012 01:40:42 +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 q051egsS008631; Thu, 5 Jan 2012 01:40:42 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q051egNX008628; Thu, 5 Jan 2012 01:40:42 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201201050140.q051egNX008628@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Thu, 5 Jan 2012 01:40:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229550 - stable/9/sbin/newfs_msdos 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, 05 Jan 2012 01:40:42 -0000 Author: pfg Date: Thu Jan 5 01:40:42 2012 New Revision: 229550 URL: http://svn.freebsd.org/changeset/base/229550 Log: MFC: r228740 Many style fixes. Remove C99 initializers: they don't help in this case. Set errno to 0 before strtoll() (from NetBSD). PR: 151850 Suggested by: bde Approved by: jhb (Mentor) Modified: stable/9/sbin/newfs_msdos/newfs_msdos.8 stable/9/sbin/newfs_msdos/newfs_msdos.c Directory Properties: stable/9/sbin/newfs_msdos/ (props changed) Modified: stable/9/sbin/newfs_msdos/newfs_msdos.8 ============================================================================== --- stable/9/sbin/newfs_msdos/newfs_msdos.8 Thu Jan 5 01:35:01 2012 (r229549) +++ stable/9/sbin/newfs_msdos/newfs_msdos.8 Thu Jan 5 01:40:42 2012 (r229550) @@ -180,27 +180,27 @@ For reference purposes, this structure i below. .Bd -literal struct bsbpb { - u_int16_t bps; /* [-S] bytes per sector */ - u_int8_t spc; /* [-c] sectors per cluster */ - u_int16_t res; /* [-r] reserved sectors */ - u_int8_t nft; /* [-n] number of FATs */ - u_int16_t rde; /* [-e] root directory entries */ - u_int16_t sec; /* [-s] total sectors */ - u_int8_t mid; /* [-m] media descriptor */ - u_int16_t spf; /* [-a] sectors per FAT */ - u_int16_t spt; /* [-u] sectors per track */ - u_int16_t hds; /* [-h] drive heads */ - u_int32_t hid; /* [-o] hidden sectors */ - u_int32_t bsec; /* [-s] big total sectors */ + u_int16_t bpbBytesPerSec; /* [-S] bytes per sector */ + u_int8_t bpbSecPerClust; /* [-c] sectors per cluster */ + u_int16_t bpbResSectors; /* [-r] reserved sectors */ + u_int8_t bpbFATs; /* [-n] number of FATs */ + u_int16_t bpbRootDirEnts; /* [-e] root directory entries */ + u_int16_t bpbSectors; /* [-s] total sectors */ + u_int8_t bpbMedia; /* [-m] media descriptor */ + u_int16_t bpbFATsecs; /* [-a] sectors per FAT */ + u_int16_t bpbSecPerTrack; /* [-u] sectors per track */ + u_int16_t bpbHeads; /* [-h] drive heads */ + u_int32_t bpbHiddenSecs; /* [-o] hidden sectors */ + u_int32_t bpbHugeSectors; /* [-s] big total sectors */ }; /* FAT32 extensions */ struct bsxbpb { - u_int32_t bspf; /* [-a] big sectors per FAT */ - u_int16_t xflg; /* control flags */ - u_int16_t vers; /* file system version */ - u_int32_t rdcl; /* root directory start cluster */ - u_int16_t infs; /* [-i] file system info sector */ - u_int16_t bkbs; /* [-k] backup boot sector */ + u_int32_t bpbBigFATsecs; /* [-a] big sectors per FAT */ + u_int16_t bpbExtFlags; /* control flags */ + u_int16_t bpbFSVers; /* file system version */ + u_int32_t bpbRootClust; /* root directory start cluster */ + u_int16_t bpbFSInfo; /* [-i] file system info sector */ + u_int16_t bpbBackup; /* [-k] backup boot sector */ }; .Ed .Sh LIMITATION Modified: stable/9/sbin/newfs_msdos/newfs_msdos.c ============================================================================== --- stable/9/sbin/newfs_msdos/newfs_msdos.c Thu Jan 5 01:35:01 2012 (r229549) +++ stable/9/sbin/newfs_msdos/newfs_msdos.c Thu Jan 5 01:40:42 2012 (r229550) @@ -66,7 +66,7 @@ static const char rcsid[] = #define MINCLS12 1U /* minimum FAT12 clusters */ #define MINCLS16 0x1000U /* minimum FAT16 clusters */ #define MINCLS32 2U /* minimum FAT32 clusters */ -#define MAXCLS12 0xfedU /* maximum FAT12 clusters */ +#define MAXCLS12 0xfedU /* maximum FAT12 clusters */ #define MAXCLS16 0xfff5U /* maximum FAT16 clusters */ #define MAXCLS32 0xffffff5U /* maximum FAT32 clusters */ @@ -97,7 +97,7 @@ static const char rcsid[] = #define argtox(arg, lo, msg) argtou(arg, lo, UINT_MAX, msg) struct bs { - u_int8_t bsJump[3]; /* bootstrap entry point */ + u_int8_t bsJump[3]; /* bootstrap entry point */ u_int8_t bsOemName[8]; /* OEM name and version */ }; @@ -123,7 +123,7 @@ struct bsxbpb { u_int8_t bpbRootClust[4]; /* root directory start cluster */ u_int8_t bpbFSInfo[2]; /* file system info sector */ u_int8_t bpbBackup[2]; /* backup boot sector */ - u_int8_t bpbReserved[12]; /* reserved */ + u_int8_t bpbReserved[12]; /* reserved */ }; struct bsx { @@ -136,13 +136,13 @@ struct bsx { }; struct de { - u_int8_t deName[11]; /* name and extension */ - u_int8_t deAttributes; /* attributes */ - u_int8_t rsvd[10]; /* reserved */ - u_int8_t deMTime[2]; /* creation time */ - u_int8_t deMDate[2]; /* creation date */ - u_int8_t deStartCluster[2]; /* starting cluster */ - u_int8_t deFileSize[4]; /* size */ + u_int8_t deName[11]; /* name and extension */ + u_int8_t deAttributes; /* attributes */ + u_int8_t rsvd[10]; /* reserved */ + u_int8_t deMTime[2]; /* creation time */ + u_int8_t deMDate[2]; /* creation date */ + u_int8_t deStartCluster[2]; /* starting cluster */ + u_int8_t deFileSize[4]; /* size */ }; struct bpb { @@ -160,29 +160,26 @@ struct bpb { u_int bpbHugeSectors; /* big total sectors */ u_int bpbBigFATsecs; /* big sectors per FAT */ u_int bpbRootClust; /* root directory start cluster */ - u_int bpbFSInfo; /* file system info sector */ - u_int bpbBackup; /* backup boot sector */ + u_int bpbFSInfo; /* file system info sector */ + u_int bpbBackup; /* backup boot sector */ }; #define BPBGAP 0, 0, 0, 0, 0, 0 -#define INIT(a, b, c, d, e, f, g, h, i, j) \ - { .bpbBytesPerSec = a, .bpbSecPerClust = b, .bpbResSectors = c, .bpbFATs = d, .bpbRootDirEnts = e, \ - .bpbSectors = f, .bpbMedia = g, .bpbFATsecs = h, .bpbSecPerTrack = i, .bpbHeads = j, } static struct { const char *name; struct bpb bpb; } const stdfmt[] = { - {"160", INIT(512, 1, 1, 2, 64, 320, 0xfe, 1, 8, 1)}, - {"180", INIT(512, 1, 1, 2, 64, 360, 0xfc, 2, 9, 1)}, - {"320", INIT(512, 2, 1, 2, 112, 640, 0xff, 1, 8, 2)}, - {"360", INIT(512, 2, 1, 2, 112, 720, 0xfd, 2, 9, 2)}, - {"640", INIT(512, 2, 1, 2, 112, 1280, 0xfb, 2, 8, 2)}, - {"720", INIT(512, 2, 1, 2, 112, 1440, 0xf9, 3, 9, 2)}, - {"1200", INIT(512, 1, 1, 2, 224, 2400, 0xf9, 7, 15, 2)}, - {"1232", INIT(1024,1, 1, 2, 192, 1232, 0xfe, 2, 8, 2)}, - {"1440", INIT(512, 1, 1, 2, 224, 2880, 0xf0, 9, 18, 2)}, - {"2880", INIT(512, 2, 1, 2, 240, 5760, 0xf0, 9, 36, 2)} + {"160", {512, 1, 1, 2, 64, 320, 0xfe, 1, 8, 1, BPBGAP}}, + {"180", {512, 1, 1, 2, 64, 360, 0xfc, 2, 9, 1, BPBGAP}}, + {"320", {512, 2, 1, 2, 112, 640, 0xff, 1, 8, 2, BPBGAP}}, + {"360", {512, 2, 1, 2, 112, 720, 0xfd, 2, 9, 2, BPBGAP}}, + {"640", {512, 2, 1, 2, 112, 1280, 0xfb, 2, 8, 2, BPBGAP}}, + {"720", {512, 2, 1, 2, 112, 1440, 0xf9, 3, 9, 2, BPBGAP}}, + {"1200", {512, 1, 1, 2, 224, 2400, 0xf9, 7, 15, 2, BPBGAP}}, + {"1232", {1024,1, 1, 2, 192, 1232, 0xfe, 2, 8, 2, BPBGAP}}, + {"1440", {512, 1, 1, 2, 224, 2880, 0xf0, 9, 18, 2, BPBGAP}}, + {"2880", {512, 2, 1, 2, 240, 5760, 0xf0, 9, 36, 2, BPBGAP}} }; static const u_int8_t bootcode[] = { @@ -494,7 +491,8 @@ main(int argc, char *argv[]) if ((fd1 = open(bname, O_RDONLY)) == -1 || fstat(fd1, &sb)) err(1, "%s", bname); if (!S_ISREG(sb.st_mode) || sb.st_size % bpb.bpbBytesPerSec || - sb.st_size < bpb.bpbBytesPerSec || sb.st_size > bpb.bpbBytesPerSec * MAXU16) + sb.st_size < bpb.bpbBytesPerSec || + sb.st_size > bpb.bpbBytesPerSec * MAXU16) errx(1, "%s: inappropriate file type or format", bname); bss = sb.st_size / bpb.bpbBytesPerSec; } @@ -503,19 +501,23 @@ main(int argc, char *argv[]) if (!fat) { if (bpb.bpbHugeSectors < (bpb.bpbResSectors ? bpb.bpbResSectors : bss) + howmany((RESFTE + (bpb.bpbSecPerClust ? MINCLS16 : MAXCLS12 + 1)) * - ((bpb.bpbSecPerClust ? 16 : 12) / BPN), bpb.bpbBytesPerSec * NPB) * + (bpb.bpbSecPerClust ? 16 : 12) / BPN, + bpb.bpbBytesPerSec * NPB) * bpb.bpbFATs + howmany(bpb.bpbRootDirEnts ? bpb.bpbRootDirEnts : DEFRDE, bpb.bpbBytesPerSec / sizeof(struct de)) + (bpb.bpbSecPerClust ? MINCLS16 : MAXCLS12 + 1) * - (bpb.bpbSecPerClust ? bpb.bpbSecPerClust : howmany(DEFBLK, bpb.bpbBytesPerSec))) + (bpb.bpbSecPerClust ? bpb.bpbSecPerClust : + howmany(DEFBLK, bpb.bpbBytesPerSec))) fat = 12; else if (bpb.bpbRootDirEnts || bpb.bpbHugeSectors < (bpb.bpbResSectors ? bpb.bpbResSectors : bss) + - howmany((RESFTE + MAXCLS16) * 2, bpb.bpbBytesPerSec) * bpb.bpbFATs + + howmany((RESFTE + MAXCLS16) * 2, bpb.bpbBytesPerSec) * + bpb.bpbFATs + howmany(DEFRDE, bpb.bpbBytesPerSec / sizeof(struct de)) + (MAXCLS16 + 1) * - (bpb.bpbSecPerClust ? bpb.bpbSecPerClust : howmany(8192, bpb.bpbBytesPerSec))) + (bpb.bpbSecPerClust ? bpb.bpbSecPerClust : + howmany(8192, bpb.bpbBytesPerSec))) fat = 16; else fat = 32; @@ -539,21 +541,27 @@ main(int argc, char *argv[]) x = bpb.bpbBackup + 1; } if (!bpb.bpbResSectors) - bpb.bpbResSectors = fat == 32 ? MAX(x, MAX(16384 / bpb.bpbBytesPerSec, 4)) : x; + bpb.bpbResSectors = fat == 32 ? + MAX(x, MAX(16384 / bpb.bpbBytesPerSec, 4)) : x; else if (bpb.bpbResSectors < x) - errx(1, "too few reserved sectors (need %d have %d)", x, bpb.bpbResSectors); + errx(1, "too few reserved sectors (need %d have %d)", x, + bpb.bpbResSectors); if (fat != 32 && !bpb.bpbRootDirEnts) bpb.bpbRootDirEnts = DEFRDE; rds = howmany(bpb.bpbRootDirEnts, bpb.bpbBytesPerSec / sizeof(struct de)); if (!bpb.bpbSecPerClust) - for (bpb.bpbSecPerClust = howmany(fat == 16 ? DEFBLK16 : DEFBLK, bpb.bpbBytesPerSec); + for (bpb.bpbSecPerClust = howmany(fat == 16 ? DEFBLK16 : + DEFBLK, bpb.bpbBytesPerSec); bpb.bpbSecPerClust < MAXSPC && bpb.bpbResSectors + howmany((RESFTE + maxcls(fat)) * (fat / BPN), - bpb.bpbBytesPerSec * NPB) * bpb.bpbFATs + + bpb.bpbBytesPerSec * NPB) * + bpb.bpbFATs + rds + - (u_int64_t)(maxcls(fat) + 1) * bpb.bpbSecPerClust <= bpb.bpbHugeSectors; - bpb.bpbSecPerClust <<= 1); + (u_int64_t) (maxcls(fat) + 1) * + bpb.bpbSecPerClust <= bpb.bpbHugeSectors; + bpb.bpbSecPerClust <<= 1) + continue; if (fat != 32 && bpb.bpbBigFATsecs > MAXU16) errx(1, "too many sectors/FAT for FAT12/16"); x1 = bpb.bpbResSectors + rds; @@ -562,7 +570,8 @@ main(int argc, char *argv[]) errx(1, "meta data exceeds file system size"); x1 += x * bpb.bpbFATs; x = (u_int64_t)(bpb.bpbHugeSectors - x1) * bpb.bpbBytesPerSec * NPB / - (bpb.bpbSecPerClust * bpb.bpbBytesPerSec * NPB + fat / BPN * bpb.bpbFATs); + (bpb.bpbSecPerClust * bpb.bpbBytesPerSec * NPB + fat / + BPN * bpb.bpbFATs); x2 = howmany((RESFTE + MIN(x, maxcls(fat))) * (fat / BPN), bpb.bpbBytesPerSec * NPB); if (!bpb.bpbBigFATsecs) { @@ -570,7 +579,8 @@ main(int argc, char *argv[]) x1 += (bpb.bpbBigFATsecs - 1) * bpb.bpbFATs; } cls = (bpb.bpbHugeSectors - x1) / bpb.bpbSecPerClust; - x = (u_int64_t)bpb.bpbBigFATsecs * bpb.bpbBytesPerSec * NPB / (fat / BPN) - RESFTE; + x = (u_int64_t)bpb.bpbBigFATsecs * bpb.bpbBytesPerSec * NPB / (fat / BPN) - + RESFTE; if (cls > x) cls = x; if (bpb.bpbBigFATsecs < x2) @@ -608,7 +618,8 @@ main(int argc, char *argv[]) tm = localtime(&now); if (!(img = malloc(bpb.bpbBytesPerSec))) err(1, NULL); - dir = bpb.bpbResSectors + (bpb.bpbFATsecs ? bpb.bpbFATsecs : bpb.bpbBigFATsecs) * bpb.bpbFATs; + dir = bpb.bpbResSectors + (bpb.bpbFATsecs ? bpb.bpbFATsecs : + bpb.bpbBigFATsecs) * bpb.bpbFATs; memset(&si_sa, 0, sizeof(si_sa)); si_sa.sa_handler = infohandler; if (sigaction(SIGINFO, &si_sa, NULL) == -1) @@ -638,7 +649,8 @@ main(int argc, char *argv[]) } else memset(img, 0, bpb.bpbBytesPerSec); if (!lsn || - (fat == 32 && bpb.bpbBackup != MAXU16 && lsn == bpb.bpbBackup)) { + (fat == 32 && bpb.bpbBackup != MAXU16 && + lsn == bpb.bpbBackup)) { x1 = sizeof(struct bs); bsbpb = (struct bsbpb *)(img + x1); mk2(bsbpb->bpbBytesPerSec, bpb.bpbBytesPerSec); @@ -702,7 +714,8 @@ main(int argc, char *argv[]) mk2(img + MINBPS - 2, DOSMAGIC); } else if (lsn >= bpb.bpbResSectors && lsn < dir && !((lsn - bpb.bpbResSectors) % - (bpb.bpbFATsecs ? bpb.bpbFATsecs : bpb.bpbBigFATsecs))) { + (bpb.bpbFATsecs ? bpb.bpbFATsecs : + bpb.bpbBigFATsecs))) { mk1(img[0], bpb.bpbMedia); for (x = 1; x < fat * (fat == 32 ? 3 : 2) / 8; x++) mk1(img[x], fat == 32 && x % 4 == 3 ? 0x0f : 0xff); @@ -817,16 +830,19 @@ getdiskinfo(int fd, const char *fname, c if (bpb->bpbBytesPerSec) dlp.d_secsize = bpb->bpbBytesPerSec; if (ioctl(fd, DIOCGDINFO, &dlp) == -1) { - if (bpb->bpbBytesPerSec == 0 && ioctl(fd, DIOCGSECTORSIZE, &dlp.d_secsize) == -1) + if (bpb->bpbBytesPerSec == 0 && ioctl(fd, DIOCGSECTORSIZE, + &dlp.d_secsize) == -1) errx(1, "Cannot get sector size, %s", strerror(errno)); dlp.d_secperunit = ms / dlp.d_secsize; - if (bpb->bpbSecPerTrack == 0 && ioctl(fd, DIOCGFWSECTORS, &dlp.d_nsectors) == -1) { + if (bpb->bpbSecPerTrack == 0 && ioctl(fd, DIOCGFWSECTORS, + &dlp.d_nsectors) == -1) { warnx("Cannot get number of sectors per track, %s", strerror(errno)); dlp.d_nsectors = 63; } - if (bpb->bpbHeads == 0 && ioctl(fd, DIOCGFWHEADS, &dlp.d_ntracks) == -1) { + if (bpb->bpbHeads == 0 && + ioctl(fd, DIOCGFWHEADS, &dlp.d_ntracks) == -1) { warnx("Cannot get number of heads, %s", strerror(errno)); if (dlp.d_secperunit <= 63*1*1024) dlp.d_ntracks = 1; @@ -859,7 +875,8 @@ getdiskinfo(int fd, const char *fname, c static void print_bpb(struct bpb *bpb) { - printf("BytesPerSec=%u SecPerClust=%u ResSectors=%u FATs=%u", bpb->bpbBytesPerSec, bpb->bpbSecPerClust, bpb->bpbResSectors, + printf("BytesPerSec=%u SecPerClust=%u ResSectors=%u FATs=%u", + bpb->bpbBytesPerSec, bpb->bpbSecPerClust, bpb->bpbResSectors, bpb->bpbFATs); if (bpb->bpbRootDirEnts) printf(" RootDirEnts=%u", bpb->bpbRootDirEnts); @@ -868,11 +885,13 @@ print_bpb(struct bpb *bpb) printf(" Media=%#x", bpb->bpbMedia); if (bpb->bpbFATsecs) printf(" FATsecs=%u", bpb->bpbFATsecs); - printf(" SecPerTrack=%u Heads=%u HiddenSecs=%u", bpb->bpbSecPerTrack, bpb->bpbHeads, bpb->bpbHiddenSecs); + printf(" SecPerTrack=%u Heads=%u HiddenSecs=%u", bpb->bpbSecPerTrack, + bpb->bpbHeads, bpb->bpbHiddenSecs); if (bpb->bpbHugeSectors) printf(" HugeSectors=%u", bpb->bpbHugeSectors); if (!bpb->bpbFATsecs) { - printf(" FATsecs=%u RootCluster=%u", bpb->bpbBigFATsecs, bpb->bpbRootClust); + printf(" FATsecs=%u RootCluster=%u", bpb->bpbBigFATsecs, + bpb->bpbRootClust); printf(" FSInfo="); printf(bpb->bpbFSInfo == MAXU16 ? "%#x" : "%u", bpb->bpbFSInfo); printf(" Backup="); @@ -919,6 +938,7 @@ argtooff(const char *arg, const char *ms char *s; off_t x; + errno = 0; x = strtoll(arg, &s, 0); /* allow at most one extra char */ if (errno || x < 0 || (s[0] && s[1]) ) @@ -929,30 +949,30 @@ argtooff(const char *arg, const char *ms errx(1, "%s: bad %s", arg, msg); /* notreached */ - case 's': /* sector */ + case 's': /* sector */ case 'S': - x <<= 9; /* times 512 */ + x <<= 9; /* times 512 */ break; - case 'k': /* kilobyte */ + case 'k': /* kilobyte */ case 'K': - x <<= 10; /* times 1024 */ + x <<= 10; /* times 1024 */ break; - case 'm': /* megabyte */ + case 'm': /* megabyte */ case 'M': - x <<= 20; /* times 1024*1024 */ + x <<= 20; /* times 1024*1024 */ break; - case 'g': /* gigabyte */ + case 'g': /* gigabyte */ case 'G': - x <<= 30; /* times 1024*1024*1024 */ + x <<= 30; /* times 1024*1024*1024 */ break; - case 'p': /* partition start */ - case 'P': /* partition start */ - case 'l': /* partition length */ - case 'L': /* partition length */ + case 'p': /* partition start */ + case 'P': + case 'l': /* partition length */ + case 'L': errx(1, "%s: not supported yet %s", arg, msg); /* notreached */ } From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 01:48:26 2012 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 7025A1065672; Thu, 5 Jan 2012 01:48:26 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5B37B8FC15; Thu, 5 Jan 2012 01:48: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 q051mQZh008930; Thu, 5 Jan 2012 01:48:26 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q051mQl5008914; Thu, 5 Jan 2012 01:48:26 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201201050148.q051mQl5008914@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Thu, 5 Jan 2012 01:48:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229551 - in stable/9/contrib/libstdc++: . config/os/aix include/bits include/ext include/tr1 libsupc++ src 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, 05 Jan 2012 01:48:26 -0000 Author: pfg Date: Thu Jan 5 01:48:25 2012 New Revision: 229551 URL: http://svn.freebsd.org/changeset/base/229551 Log: MFC: r228780 Update libstdc++ with small changes up to the latest rev. (135556) from the gcc 4.2 branch. The libraries in the gcc-4_2-branch remained under the LGPLv2. Reviewed by: mm Approved by: jhb (mentor) Modified: stable/9/contrib/libstdc++/ChangeLog stable/9/contrib/libstdc++/config/os/aix/os_defines.h stable/9/contrib/libstdc++/include/bits/allocator.h stable/9/contrib/libstdc++/include/bits/basic_string.h stable/9/contrib/libstdc++/include/bits/fstream.tcc stable/9/contrib/libstdc++/include/bits/locale_facets.tcc stable/9/contrib/libstdc++/include/ext/atomicity.h stable/9/contrib/libstdc++/include/ext/codecvt_specializations.h stable/9/contrib/libstdc++/include/ext/concurrence.h stable/9/contrib/libstdc++/include/ext/vstring.h stable/9/contrib/libstdc++/include/tr1/boost_shared_ptr.h stable/9/contrib/libstdc++/include/tr1/random stable/9/contrib/libstdc++/libsupc++/eh_personality.cc stable/9/contrib/libstdc++/libsupc++/typeinfo stable/9/contrib/libstdc++/src/valarray-inst.cc Directory Properties: stable/9/contrib/libstdc++/ (props changed) Modified: stable/9/contrib/libstdc++/ChangeLog ============================================================================== --- stable/9/contrib/libstdc++/ChangeLog Thu Jan 5 01:40:42 2012 (r229550) +++ stable/9/contrib/libstdc++/ChangeLog Thu Jan 5 01:48:25 2012 (r229551) @@ -1,3 +1,133 @@ +2008-05-19 Release Manager + + * GCC 4.2.4 released. + +2008-03-13 David Edelsohn + + Backport from mainline: + 2008-01-26 David Edelsohn + + PR target/34794 + * config/os/aix/os_defines.h: Define __COMPATMATH__. + +2008-02-14 Kaveh R. Ghazi + + * testsuite/27_io/fpos/14320-1.cc: Check for "long long" and + remove XFAIL. + +2008-02-01 Release Manager + + * GCC 4.2.3 released. + +2008-01-06 Ted Phelps + + PR c++/34152 + * libsupc++/eh_personality.cc (PERSONALITY_FUNCTION): Check + _GLIBCXX_HAVE_GETIPINFO instead of HAVE_GETIPINFO. + +2008-01-05 Paolo Carlini + + PR libstdc++/34680 + + Revert: + 2007-12-17 Jonathan Wakely + * include/bits/locale_facets.tcc (has_facet, use_facet): Simplify + RTTI checks. + + 2007-12-14 Benjamin Kosnik + + PR libstdc++/30127 + PR libstdc++/34449 + * include/bits/locale_facets.tcc (use_facet): Check facet hierarchy. + (has_facet): Same. + * testsuite/22_locale/global_templates/user_facet_hierarchies.cc: New. + * testsuite/22_locale/global_templates/ + standard_facet_hierarchies.cc: New. + +2007-12-17 Jonathan Wakely + + * include/bits/locale_facets.tcc (has_facet, use_facet): Simplify + RTTI checks. + +2007-12-17 Benjamin Kosnik + + * testsuite/22_locale/global_templates/ + standard_facet_hierarchies.cc: Fix for generic locale model. + +2007-12-14 Benjamin Kosnik + + PR libstdc++/30127 + PR libstdc++/34449 + * include/bits/locale_facets.tcc (use_facet): Check facet hierarchy. + (has_facet): Same. + * testsuite/22_locale/global_templates/user_facet_hierarchies.cc: New. + * testsuite/22_locale/global_templates/ + standard_facet_hierarchies.cc: New. + +2007-11-26 Paolo Carlini + + * include/bits/locale_facets.tcc (num_put<>::_M_insert_int): When + ios_base::showpos and the type is signed and the value is zero, + prepend +. + * testsuite/22_locale/num_put/put/char/12.cc: New. + * testsuite/22_locale/num_put/put/wchar_t/12.cc: Likewise. + +2007-10-20 Paolo Carlini + + * include/tr1/random + (uniform_int<>::_M_call(_UniformRandomNumberGenerator&, result_type, + result_type, true_type)): Fix small thinko. + +2007-10-19 Paolo Carlini + + PR libstdc++/33815 + * include/tr1/random + (uniform_int<>::_M_call(_UniformRandomNumberGenerator&, result_type, + result_type, true_type)): Avoid the modulo (which uses the low-order + bits). + +2007-10-18 Paolo Carlini + + PR libstdc++/33807 + * include/bits/allocator.h (operator==(const allocator<_Tp>&, + const allocator<_Tp>&), operator!=(const allocator<_Tp>&, + const allocator<_Tp>&)): Add. + * testsuite/20_util/memory/allocator/33807.cc: New. + +2007-10-14 Jonathan Wakely + + * docs/html/Makefile: Follow up to libstdc++/14991, remove target. + +2007-10-14 Jonathan Wakely + + * src/valarray-inst.cc, include/ext/atomicity.h, + include/ext/concurrence.h, include/bits/basic_string.h, + include/bits/fstream.tcc, include/ext/vstring.h: Fix comment typos. + +2007-10-14 Jonathan Wakely + + * include/tr1_impl/boost_shared_ptr.h: (__weak_ptr::lock()): Add + missing template argument. + * testsuite/tr1/2_general_utilities/memory/shared_ptr/ + explicit_instantiation/2.cc: New. + * testsuite/tr1/2_general_utilities/memory/weak_ptr/ + explicit_instantiation/2.cc: New. + +2007-10-11 Paolo Carlini + + PR libstdc++/33734 + * include/ext/codecvt_specializations.h (encoding_state::good, + init, destroy): Use cast notation instead of reinterpret_cast. + +2007-10-07 Release Manager + + * GCC 4.2.2 released. + +2007-10-06 Benjamin Kosnik + + PR libstdc++/33678 + * libsupc++/typeinfo (typeinfo): Revert ordering of virtual components. + 2007-08-28 Paolo Carlini PR libstdc++/33128 Modified: stable/9/contrib/libstdc++/config/os/aix/os_defines.h ============================================================================== --- stable/9/contrib/libstdc++/config/os/aix/os_defines.h Thu Jan 5 01:40:42 2012 (r229550) +++ stable/9/contrib/libstdc++/config/os/aix/os_defines.h Thu Jan 5 01:48:25 2012 (r229551) @@ -1,6 +1,6 @@ // Specific definitions for AIX -*- C++ -*- -// Copyright (C) 2000, 2002, 2005 Free Software Foundation, Inc. +// Copyright (C) 2000, 2002, 2005, 2008 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -48,4 +48,9 @@ #define _ALL_SOURCE #endif +// C99 math +#ifndef __COMPATMATH__ +#define __COMPATMATH__ +#endif + #endif Modified: stable/9/contrib/libstdc++/include/bits/allocator.h ============================================================================== --- stable/9/contrib/libstdc++/include/bits/allocator.h Thu Jan 5 01:40:42 2012 (r229550) +++ stable/9/contrib/libstdc++/include/bits/allocator.h Thu Jan 5 01:48:25 2012 (r229551) @@ -115,11 +115,21 @@ _GLIBCXX_BEGIN_NAMESPACE(std) operator==(const allocator<_T1>&, const allocator<_T2>&) { return true; } + template + inline bool + operator==(const allocator<_Tp>&, const allocator<_Tp>&) + { return true; } + template inline bool operator!=(const allocator<_T1>&, const allocator<_T2>&) { return false; } + template + inline bool + operator!=(const allocator<_Tp>&, const allocator<_Tp>&) + { return false; } + // Inhibit implicit instantiations for required instantiations, // which are defined via explicit instantiations elsewhere. // NB: This syntax is a GNU extension. Modified: stable/9/contrib/libstdc++/include/bits/basic_string.h ============================================================================== --- stable/9/contrib/libstdc++/include/bits/basic_string.h Thu Jan 5 01:40:42 2012 (r229550) +++ stable/9/contrib/libstdc++/include/bits/basic_string.h Thu Jan 5 01:48:25 2012 (r229551) @@ -1672,7 +1672,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) /** * @brief Find position of a character of C substring. * @param s String containing characters to locate. - * @param pos Index of character to search from (default 0). + * @param pos Index of character to search from. * @param n Number of characters from s to search for. * @return Index of first occurrence. * @@ -1733,7 +1733,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) /** * @brief Find last position of a character of C substring. * @param s C string containing characters to locate. - * @param pos Index of character to search back from (default end). + * @param pos Index of character to search back from. * @param n Number of characters from s to search for. * @return Index of last occurrence. * @@ -1764,7 +1764,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) /** * @brief Find last position of a character. * @param c Character to locate. - * @param pos Index of character to search back from (default 0). + * @param pos Index of character to search back from (default end). * @return Index of last occurrence. * * Starting from @a pos, searches backward for @a c within this string. @@ -1794,7 +1794,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) /** * @brief Find position of a character not in C substring. * @param s C string containing characters to avoid. - * @param pos Index of character to search from (default 0). + * @param pos Index of character to search from. * @param n Number of characters from s to consider. * @return Index of first occurrence. * @@ -1839,8 +1839,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) /** * @brief Find last position of a character not in string. * @param str String containing characters to avoid. - * @param pos Index of character to search from (default 0). - * @return Index of first occurrence. + * @param pos Index of character to search back from (default end). + * @return Index of last occurrence. * * Starting from @a pos, searches backward for a character not * contained in @a str within this string. If found, returns the index @@ -1853,9 +1853,9 @@ _GLIBCXX_BEGIN_NAMESPACE(std) /** * @brief Find last position of a character not in C substring. * @param s C string containing characters to avoid. - * @param pos Index of character to search from (default 0). + * @param pos Index of character to search back from. * @param n Number of characters from s to consider. - * @return Index of first occurrence. + * @return Index of last occurrence. * * Starting from @a pos, searches backward for a character not * contained in the first @a n characters of @a s within this string. @@ -1866,10 +1866,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std) find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const; /** - * @brief Find position of a character not in C string. + * @brief Find last position of a character not in C string. * @param s C string containing characters to avoid. - * @param pos Index of character to search from (default 0). - * @return Index of first occurrence. + * @param pos Index of character to search back from (default end). + * @return Index of last occurrence. * * Starting from @a pos, searches backward for a character not * contained in @a s within this string. If found, returns the index @@ -1885,8 +1885,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) /** * @brief Find last position of a different character. * @param c Character to avoid. - * @param pos Index of character to search from (default 0). - * @return Index of first occurrence. + * @param pos Index of character to search back from (default end). + * @return Index of last occurrence. * * Starting from @a pos, searches backward for a character other than * @a c within this string. If found, returns the index where it was Modified: stable/9/contrib/libstdc++/include/bits/fstream.tcc ============================================================================== --- stable/9/contrib/libstdc++/include/bits/fstream.tcc Thu Jan 5 01:40:42 2012 (r229550) +++ stable/9/contrib/libstdc++/include/bits/fstream.tcc Thu Jan 5 01:48:25 2012 (r229551) @@ -194,7 +194,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) const bool __testin = _M_mode & ios_base::in; if (__testin && !_M_writing) { - // Check for pback madness, and if so swich back to the + // Check for pback madness, and if so switch back to the // normal buffers and jet outta here before expensive // fileops happen... _M_destroy_pback(); Modified: stable/9/contrib/libstdc++/include/bits/locale_facets.tcc ============================================================================== --- stable/9/contrib/libstdc++/include/bits/locale_facets.tcc Thu Jan 5 01:40:42 2012 (r229550) +++ stable/9/contrib/libstdc++/include/bits/locale_facets.tcc Thu Jan 5 01:48:25 2012 (r229551) @@ -1,6 +1,7 @@ // Locale support -*- C++ -*- -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, +// 2006, 2007, 2008 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -117,6 +118,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) return static_cast(*__facets[__i]); } + // Routine to access a cache for the facet. If the cache didn't // exist before, it gets constructed on the fly. template @@ -1015,13 +1017,13 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE if (__builtin_expect(__dec, true)) { // Decimal. - if (__v > 0) + if (__v >= 0) { if (__flags & ios_base::showpos && numeric_limits<_ValueT>::is_signed) *--__cs = __lit[__num_base::_S_oplus], ++__len; } - else if (__v) + else *--__cs = __lit[__num_base::_S_ominus], ++__len; } else if (__flags & ios_base::showbase && __v) Modified: stable/9/contrib/libstdc++/include/ext/atomicity.h ============================================================================== --- stable/9/contrib/libstdc++/include/ext/atomicity.h Thu Jan 5 01:40:42 2012 (r229550) +++ stable/9/contrib/libstdc++/include/ext/atomicity.h Thu Jan 5 01:48:25 2012 (r229551) @@ -42,7 +42,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) // Functions for portable atomic access. - // To abstract locking primatives across all thread policies, use: + // To abstract locking primitives across all thread policies, use: // __exchange_and_add_dispatch // __atomic_add_dispatch #ifdef _GLIBCXX_ATOMIC_BUILTINS Modified: stable/9/contrib/libstdc++/include/ext/codecvt_specializations.h ============================================================================== --- stable/9/contrib/libstdc++/include/ext/codecvt_specializations.h Thu Jan 5 01:40:42 2012 (r229550) +++ stable/9/contrib/libstdc++/include/ext/codecvt_specializations.h Thu Jan 5 01:48:25 2012 (r229551) @@ -128,7 +128,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) bool good() const throw() { - const descriptor_type __err = reinterpret_cast(-1); + const descriptor_type __err = (iconv_t)(-1); bool __test = _M_in_desc && _M_in_desc != __err; __test &= _M_out_desc && _M_out_desc != __err; return __test; @@ -166,7 +166,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) void init() { - const descriptor_type __err = reinterpret_cast(-1); + const descriptor_type __err = (iconv_t)(-1); const bool __have_encodings = _M_int_enc.size() && _M_ext_enc.size(); if (!_M_in_desc && __have_encodings) { @@ -199,7 +199,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) void destroy() throw() { - const descriptor_type __err = reinterpret_cast(-1); + const descriptor_type __err = (iconv_t)(-1); if (_M_in_desc && _M_in_desc != __err) { iconv_close(_M_in_desc); Modified: stable/9/contrib/libstdc++/include/ext/concurrence.h ============================================================================== --- stable/9/contrib/libstdc++/include/ext/concurrence.h Thu Jan 5 01:40:42 2012 (r229550) +++ stable/9/contrib/libstdc++/include/ext/concurrence.h Thu Jan 5 01:48:25 2012 (r229551) @@ -46,7 +46,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) // Available locking policies: // _S_single single-threaded code that doesn't need to be locked. // _S_mutex multi-threaded code that requires additional support - // from gthr.h or abstraction layers in concurrance.h. + // from gthr.h or abstraction layers in concurrence.h. // _S_atomic multi-threaded code using atomic operations. enum _Lock_policy { _S_single, _S_mutex, _S_atomic }; Modified: stable/9/contrib/libstdc++/include/ext/vstring.h ============================================================================== --- stable/9/contrib/libstdc++/include/ext/vstring.h Thu Jan 5 01:40:42 2012 (r229550) +++ stable/9/contrib/libstdc++/include/ext/vstring.h Thu Jan 5 01:48:25 2012 (r229551) @@ -1407,7 +1407,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) /** * @brief Find position of a character of C substring. * @param s String containing characters to locate. - * @param pos Index of character to search from (default 0). + * @param pos Index of character to search from. * @param n Number of characters from s to search for. * @return Index of first occurrence. * @@ -1468,7 +1468,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) /** * @brief Find last position of a character of C substring. * @param s C string containing characters to locate. - * @param pos Index of character to search back from (default end). + * @param pos Index of character to search back from. * @param n Number of characters from s to search for. * @return Index of last occurrence. * @@ -1499,7 +1499,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) /** * @brief Find last position of a character. * @param c Character to locate. - * @param pos Index of character to search back from (default 0). + * @param pos Index of character to search back from (default end). * @return Index of last occurrence. * * Starting from @a pos, searches backward for @a c within this string. @@ -1529,7 +1529,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) /** * @brief Find position of a character not in C substring. * @param s C string containing characters to avoid. - * @param pos Index of character to search from (default 0). + * @param pos Index of character to search from. * @param n Number of characters from s to consider. * @return Index of first occurrence. * @@ -1574,8 +1574,8 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) /** * @brief Find last position of a character not in string. * @param str String containing characters to avoid. - * @param pos Index of character to search from (default 0). - * @return Index of first occurrence. + * @param pos Index of character to search back from (default end). + * @return Index of last occurrence. * * Starting from @a pos, searches backward for a character not * contained in @a str within this string. If found, returns the index @@ -1589,9 +1589,9 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) /** * @brief Find last position of a character not in C substring. * @param s C string containing characters to avoid. - * @param pos Index of character to search from (default 0). + * @param pos Index of character to search back from. * @param n Number of characters from s to consider. - * @return Index of first occurrence. + * @return Index of last occurrence. * * Starting from @a pos, searches backward for a character not * contained in the first @a n characters of @a s within this string. @@ -1602,10 +1602,10 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const; /** - * @brief Find position of a character not in C string. + * @brief Find last position of a character not in C string. * @param s C string containing characters to avoid. - * @param pos Index of character to search from (default 0). - * @return Index of first occurrence. + * @param pos Index of character to search back from (default end). + * @return Index of last occurrence. * * Starting from @a pos, searches backward for a character not * contained in @a s within this string. If found, returns the index @@ -1621,8 +1621,8 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) /** * @brief Find last position of a different character. * @param c Character to avoid. - * @param pos Index of character to search from (default 0). - * @return Index of first occurrence. + * @param pos Index of character to search back from (default end). + * @return Index of last occurrence. * * Starting from @a pos, searches backward for a character other than * @a c within this string. If found, returns the index where it was Modified: stable/9/contrib/libstdc++/include/tr1/boost_shared_ptr.h ============================================================================== --- stable/9/contrib/libstdc++/include/tr1/boost_shared_ptr.h Thu Jan 5 01:40:42 2012 (r229550) +++ stable/9/contrib/libstdc++/include/tr1/boost_shared_ptr.h Thu Jan 5 01:48:25 2012 (r229551) @@ -857,7 +857,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) // Q: How can we get here? // A: Another thread may have invalidated r after the // use_count test above. - return __shared_ptr(); + return __shared_ptr(); } #else Modified: stable/9/contrib/libstdc++/include/tr1/random ============================================================================== --- stable/9/contrib/libstdc++/include/tr1/random Thu Jan 5 01:40:42 2012 (r229550) +++ stable/9/contrib/libstdc++/include/tr1/random Thu Jan 5 01:48:25 2012 (r229551) @@ -1618,10 +1618,15 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) result_type _M_call(_UniformRandomNumberGenerator& __urng, result_type __min, result_type __max, true_type) - { + { + // XXX Must be fixed to also work when __urng.max() - __urng.min() + // is smaller than __max - __min. typedef typename __gnu_cxx::__add_unsigned::__type __utype; - return result_type(__utype(__urng()) % (__max - __min + 1)) + __min; + return result_type((__max - __min + 1.0L) + * (__utype(__urng()) - __utype(__urng.min())) + / (__utype(__urng.max()) + - __utype(__urng.min()) + 1.0L)) + __min; } template Modified: stable/9/contrib/libstdc++/libsupc++/eh_personality.cc ============================================================================== --- stable/9/contrib/libstdc++/libsupc++/eh_personality.cc Thu Jan 5 01:40:42 2012 (r229550) +++ stable/9/contrib/libstdc++/libsupc++/eh_personality.cc Thu Jan 5 01:48:25 2012 (r229551) @@ -1,5 +1,5 @@ // -*- C++ -*- The GNU C++ exception personality routine. -// Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc. +// Copyright (C) 2001, 2002, 2003, 2006, 2008 Free Software Foundation, Inc. // // This file is part of GCC. // @@ -434,7 +434,7 @@ PERSONALITY_FUNCTION (int version, // Parse the LSDA header. p = parse_lsda_header (context, language_specific_data, &info); info.ttype_base = base_of_encoded_value (info.ttype_encoding, context); -#ifdef HAVE_GETIPINFO +#ifdef _GLIBCXX_HAVE_GETIPINFO ip = _Unwind_GetIPInfo (context, &ip_before_insn); #else ip = _Unwind_GetIP (context); Modified: stable/9/contrib/libstdc++/libsupc++/typeinfo ============================================================================== --- stable/9/contrib/libstdc++/libsupc++/typeinfo Thu Jan 5 01:40:42 2012 (r229550) +++ stable/9/contrib/libstdc++/libsupc++/typeinfo Thu Jan 5 01:48:25 2012 (r229551) @@ -99,7 +99,13 @@ namespace std #endif bool operator!=(const type_info& __arg) const { return !operator==(__arg); } - + + // Return true if this is a pointer type of some kind + virtual bool __is_pointer_p() const; + + // Return true if this is a function type + virtual bool __is_function_p() const; + // Try and catch a thrown type. Store an adjusted pointer to the // caught type in THR_OBJ. If THR_TYPE is not a pointer type, then // THR_OBJ points to the thrown object. If THR_TYPE is a pointer @@ -113,12 +119,6 @@ namespace std virtual bool __do_upcast(const __cxxabiv1::__class_type_info *__target, void **__obj_ptr) const; - // Return true if this is a pointer type of some kind - virtual bool __is_pointer_p() const; - - // Return true if this is a function type - virtual bool __is_function_p() const; - protected: const char *__name; Modified: stable/9/contrib/libstdc++/src/valarray-inst.cc ============================================================================== --- stable/9/contrib/libstdc++/src/valarray-inst.cc Thu Jan 5 01:40:42 2012 (r229550) +++ stable/9/contrib/libstdc++/src/valarray-inst.cc Thu Jan 5 01:48:25 2012 (r229551) @@ -68,7 +68,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) __gslice_to_index(size_t __o, const valarray& __l, const valarray& __s, valarray& __i) { - // There are as much as dimensions as there are strides. + // There are as many dimensions as there are strides. size_t __n = __l.size(); // Get a buffer to hold current multi-index as we go through From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 02:05:16 2012 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 58F3E106566C; Thu, 5 Jan 2012 02:05:16 +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 0C7F38FC15; Thu, 5 Jan 2012 02:05: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 q0525Fps009573; Thu, 5 Jan 2012 02:05:15 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0525F9d009570; Thu, 5 Jan 2012 02:05:15 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201201050205.q0525F9d009570@svn.freebsd.org> From: Rick Macklem Date: Thu, 5 Jan 2012 02:05: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: r229552 - in stable/8/sys/fs: nfs nfsclient 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, 05 Jan 2012 02:05:16 -0000 Author: rmacklem Date: Thu Jan 5 02:05:15 2012 New Revision: 229552 URL: http://svn.freebsd.org/changeset/base/229552 Log: MFC: r227743 Post r223774 the NFSv4 client never uses the linked list with the head nfsc_defunctlockowner. This patch simply removes the code that loops through this always empty list, since the code no longer does anything useful. It should not have any effect on the client's behaviour. Modified: stable/8/sys/fs/nfs/nfsclstate.h stable/8/sys/fs/nfsclient/nfs_clstate.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/fs/nfs/nfsclstate.h ============================================================================== --- stable/8/sys/fs/nfs/nfsclstate.h Thu Jan 5 01:48:25 2012 (r229551) +++ stable/8/sys/fs/nfs/nfsclstate.h Thu Jan 5 02:05:15 2012 (r229552) @@ -48,7 +48,6 @@ struct nfsclclient { struct nfsclownerhead nfsc_owner; struct nfscldeleghead nfsc_deleg; struct nfscldeleghash nfsc_deleghash[NFSCLDELEGHASHSIZE]; - struct nfscllockownerhead nfsc_defunctlockowner; struct nfsv4lock nfsc_lock; struct proc *nfsc_renewthread; struct nfsmount *nfsc_nmp; Modified: stable/8/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clstate.c Thu Jan 5 01:48:25 2012 (r229551) +++ stable/8/sys/fs/nfsclient/nfs_clstate.c Thu Jan 5 02:05:15 2012 (r229552) @@ -699,7 +699,6 @@ nfscl_getcl(vnode_t vp, struct ucred *cr { struct nfsclclient *clp; struct nfsclclient *newclp = NULL; - struct nfscllockowner *lp, *nlp; struct mount *mp; struct nfsmount *nmp; char uuid[HOSTUUIDLEN]; @@ -744,7 +743,6 @@ nfscl_getcl(vnode_t vp, struct ucred *cr TAILQ_INIT(&clp->nfsc_deleg); for (i = 0; i < NFSCLDELEGHASHSIZE; i++) LIST_INIT(&clp->nfsc_deleghash[i]); - LIST_INIT(&clp->nfsc_defunctlockowner); clp->nfsc_flags = NFSCLFLAGS_INITED; clp->nfsc_clientidrev = 1; clp->nfsc_cbident = nfscl_nextcbident(); @@ -793,11 +791,6 @@ nfscl_getcl(vnode_t vp, struct ucred *cr NFSUNLOCKCLSTATE(); return (EACCES); } - /* get rid of defunct lockowners */ - LIST_FOREACH_SAFE(lp, &clp->nfsc_defunctlockowner, nfsl_list, - nlp) { - nfscl_freelockowner(lp, 0); - } /* * If RFC3530 Sec. 14.2.33 is taken literally, * NFSERR_CLIDINUSE will be returned persistently for the @@ -1537,13 +1530,6 @@ nfscl_cleanclient(struct nfsclclient *cl { struct nfsclowner *owp, *nowp; struct nfsclopen *op, *nop; - struct nfscllockowner *lp, *nlp; - - - /* get rid of defunct lockowners */ - LIST_FOREACH_SAFE(lp, &clp->nfsc_defunctlockowner, nfsl_list, nlp) { - nfscl_freelockowner(lp, 0); - } /* Now, all the OpenOwners, etc. */ LIST_FOREACH_SAFE(owp, &clp->nfsc_owner, nfsow_list, nowp) { @@ -1717,12 +1703,6 @@ nfscl_cleanup_common(struct nfsclclient } owp = nowp; } - - /* and check the defunct list */ - LIST_FOREACH(lp, &clp->nfsc_defunctlockowner, nfsl_list) { - if (!NFSBCMP(lp->nfsl_owner, own, NFSV4CL_LOCKNAMELEN)) - lp->nfsl_defunct = 1; - } } #if defined(APPLEKEXT) || defined(__FreeBSD__) @@ -1735,7 +1715,6 @@ static void nfscl_cleanupkext(struct nfsclclient *clp) { struct nfsclowner *owp, *nowp; - struct nfscllockowner *lp; NFSPROCLISTLOCK(); NFSLOCKCLSTATE(); @@ -1743,12 +1722,6 @@ nfscl_cleanupkext(struct nfsclclient *cl if (nfscl_procdoesntexist(owp->nfsow_owner)) nfscl_cleanup_common(clp, owp->nfsow_owner); } - - /* and check the defunct list */ - LIST_FOREACH(lp, &clp->nfsc_defunctlockowner, nfsl_list) { - if (nfscl_procdoesntexist(lp->nfsl_owner)) - lp->nfsl_defunct = 1; - } NFSUNLOCKCLSTATE(); NFSPROCLISTUNLOCK(); } @@ -1905,11 +1878,6 @@ nfscl_recover(struct nfsclclient *clp, s NFSUNLOCKREQ(); splx(s); - /* get rid of defunct lockowners */ - LIST_FOREACH_SAFE(lp, &clp->nfsc_defunctlockowner, nfsl_list, nlp) { - nfscl_freelockowner(lp, 0); - } - /* * Now, mark all delegations "need reclaim". */ @@ -2157,7 +2125,6 @@ nfscl_recover(struct nfsclclient *clp, s APPLESTATIC int nfscl_hasexpired(struct nfsclclient *clp, u_int32_t clidrev, NFSPROC_T *p) { - struct nfscllockowner *lp, *nlp; struct nfsmount *nmp; struct ucred *cred; int igotlock = 0, error, trycnt; @@ -2207,12 +2174,6 @@ nfscl_hasexpired(struct nfsclclient *clp clp->nfsc_flags &= ~(NFSCLFLAGS_HASCLIENTID | NFSCLFLAGS_RECOVER); } else { - /* get rid of defunct lockowners */ - LIST_FOREACH_SAFE(lp, &clp->nfsc_defunctlockowner, nfsl_list, - nlp) { - nfscl_freelockowner(lp, 0); - } - /* * Expire the state for the client. */ @@ -2486,25 +2447,6 @@ nfscl_renewthread(struct nfsclclient *cl owp = nowp; } - /* also search the defunct list */ - lp = LIST_FIRST(&clp->nfsc_defunctlockowner); - while (lp != NULL) { - nlp = LIST_NEXT(lp, nfsl_list); - if (lp->nfsl_defunct) { - LIST_FOREACH(olp, &lh, nfsl_list) { - if (!NFSBCMP(olp->nfsl_owner, lp->nfsl_owner, - NFSV4CL_LOCKNAMELEN)) - break; - } - if (olp == NULL) { - LIST_REMOVE(lp, nfsl_list); - LIST_INSERT_HEAD(&lh, lp, nfsl_list); - } else { - nfscl_freelockowner(lp, 0); - } - } - lp = nlp; - } /* and release defunct lock owners */ LIST_FOREACH_SAFE(lp, &lh, nfsl_list, nlp) { nfscl_freelockowner(lp, 0); From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 02:36:37 2012 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 AB868106564A; Thu, 5 Jan 2012 02:36:37 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8FD798FC13; Thu, 5 Jan 2012 02:36: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 q052abah010643; Thu, 5 Jan 2012 02:36:37 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q052abDj010640; Thu, 5 Jan 2012 02:36:37 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201201050236.q052abDj010640@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Thu, 5 Jan 2012 02:36:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229554 - stable/9/contrib/gcc 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, 05 Jan 2012 02:36:37 -0000 Author: pfg Date: Thu Jan 5 02:36:37 2012 New Revision: 229554 URL: http://svn.freebsd.org/changeset/base/229554 Log: MFC: r228756 Clean an inconsistency with -ffinite-math-only. Backported from the gcc-4_3-branch, revision (118001) under the GPLv2. This issue was also fixed in Apple's gcc. PR: 157025 Reviewed by: mm Approved by: jhb (mentor) Modified: stable/9/contrib/gcc/ChangeLog.gcc43 stable/9/contrib/gcc/builtins.c Directory Properties: stable/9/contrib/gcc/ (props changed) Modified: stable/9/contrib/gcc/ChangeLog.gcc43 ============================================================================== --- stable/9/contrib/gcc/ChangeLog.gcc43 Thu Jan 5 02:16:55 2012 (r229553) +++ stable/9/contrib/gcc/ChangeLog.gcc43 Thu Jan 5 02:36:37 2012 (r229554) @@ -96,6 +96,14 @@ * doc/invoke.texi: Add entry about geode processor. +2006-10-24 Richard Guenther + + PR middle-end/28796 + * builtins.c (fold_builtin_classify): Use HONOR_INFINITIES + and HONOR_NANS instead of MODE_HAS_INFINITIES and MODE_HAS_NANS + for deciding optimizations in consistency with fold-const.c + (fold_builtin_unordered_cmp): Likewise. + 2006-10-22 H.J. Lu (r117958) * config.gcc (i[34567]86-*-*): Add tmmintrin.h to extra_headers. Modified: stable/9/contrib/gcc/builtins.c ============================================================================== --- stable/9/contrib/gcc/builtins.c Thu Jan 5 02:16:55 2012 (r229553) +++ stable/9/contrib/gcc/builtins.c Thu Jan 5 02:36:37 2012 (r229554) @@ -8720,7 +8720,7 @@ fold_builtin_classify (tree fndecl, tree switch (builtin_index) { case BUILT_IN_ISINF: - if (!MODE_HAS_INFINITIES (TYPE_MODE (TREE_TYPE (arg)))) + if (!HONOR_INFINITIES (TYPE_MODE (TREE_TYPE (arg)))) return omit_one_operand (type, integer_zero_node, arg); if (TREE_CODE (arg) == REAL_CST) @@ -8736,8 +8736,8 @@ fold_builtin_classify (tree fndecl, tree return NULL_TREE; case BUILT_IN_FINITE: - if (!MODE_HAS_NANS (TYPE_MODE (TREE_TYPE (arg))) - && !MODE_HAS_INFINITIES (TYPE_MODE (TREE_TYPE (arg)))) + if (!HONOR_NANS (TYPE_MODE (TREE_TYPE (arg))) + && !HONOR_INFINITIES (TYPE_MODE (TREE_TYPE (arg)))) return omit_one_operand (type, integer_zero_node, arg); if (TREE_CODE (arg) == REAL_CST) @@ -8750,7 +8750,7 @@ fold_builtin_classify (tree fndecl, tree return NULL_TREE; case BUILT_IN_ISNAN: - if (!MODE_HAS_NANS (TYPE_MODE (TREE_TYPE (arg)))) + if (!HONOR_NANS (TYPE_MODE (TREE_TYPE (arg)))) return omit_one_operand (type, integer_zero_node, arg); if (TREE_CODE (arg) == REAL_CST) @@ -8833,13 +8833,13 @@ fold_builtin_unordered_cmp (tree fndecl, if (unordered_code == UNORDERED_EXPR) { - if (!MODE_HAS_NANS (TYPE_MODE (TREE_TYPE (arg0)))) + if (!HONOR_NANS (TYPE_MODE (TREE_TYPE (arg0)))) return omit_two_operands (type, integer_zero_node, arg0, arg1); return fold_build2 (UNORDERED_EXPR, type, arg0, arg1); } - code = MODE_HAS_NANS (TYPE_MODE (TREE_TYPE (arg0))) ? unordered_code - : ordered_code; + code = HONOR_NANS (TYPE_MODE (TREE_TYPE (arg0))) ? unordered_code + : ordered_code; return fold_build1 (TRUTH_NOT_EXPR, type, fold_build2 (code, type, arg0, arg1)); } From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 03:38:35 2012 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 336FB106564A; Thu, 5 Jan 2012 03:38:35 +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 21DC78FC08; Thu, 5 Jan 2012 03:38: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 q053cZnL012839; Thu, 5 Jan 2012 03:38:35 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q053cZs5012837; Thu, 5 Jan 2012 03:38:35 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201201050338.q053cZs5012837@svn.freebsd.org> From: Adrian Chadd Date: Thu, 5 Jan 2012 03:38:35 +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: r229556 - head/sys/mips/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: Thu, 05 Jan 2012 03:38:35 -0000 Author: adrian Date: Thu Jan 5 03:38:34 2012 New Revision: 229556 URL: http://svn.freebsd.org/changeset/base/229556 Log: Use geom_uncompress now, rather than geom_uzip. This results in a much smaller rootfs image and it easily fits in the 8MB flash. Modified: head/sys/mips/conf/PB47 Modified: head/sys/mips/conf/PB47 ============================================================================== --- head/sys/mips/conf/PB47 Thu Jan 5 03:22:21 2012 (r229555) +++ head/sys/mips/conf/PB47 Thu Jan 5 03:38:34 2012 (r229556) @@ -40,12 +40,12 @@ nooptions IEEE80211_SUPPORT_TDMA #options GEOM_PART_MBR #options MSDOSFS -# uzip - to boot natively from flash -device geom_uzip -options GEOM_UZIP +# uncompress - to boot read-only lzma natively from flash +device geom_uncompress +options GEOM_UNCOMPRESS # Used for the static uboot partition map device geom_map # Boot off of the rootfs, as defined in the geom_map setup. -options ROOTDEVNAME=\"ufs:map/rootfs.uzip\" +options ROOTDEVNAME=\"ufs:map/rootfs.uncompress\" From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 04:36:57 2012 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 9C539106564A; Thu, 5 Jan 2012 04:36:57 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 858D48FC13; Thu, 5 Jan 2012 04:36: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 q054avA7014704; Thu, 5 Jan 2012 04:36:57 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q054avK8014703; Thu, 5 Jan 2012 04:36:57 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201050436.q054avK8014703@svn.freebsd.org> From: Eitan Adler Date: Thu, 5 Jan 2012 04:36:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229557 - in stable/9/lib: libc libc/gen libc/stdtime msun msun/man 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, 05 Jan 2012 04:36:57 -0000 Author: eadler (ports committer) Date: Thu Jan 5 04:36:57 2012 New Revision: 229557 URL: http://svn.freebsd.org/changeset/base/229557 Log: Reparent mergeinfo introduced in r229461 on lib/msun/man and lib/libc/gen to more appropriate directories. This is an intentional direct commit to the stable/9 branch. Approved by: lstewart Modified: Directory Properties: stable/9/lib/libc/ (props changed) stable/9/lib/libc/gen/ (props changed) stable/9/lib/libc/stdtime/ (props changed) stable/9/lib/msun/ (props changed) stable/9/lib/msun/man/ (props changed) From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 04:50:11 2012 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 505A91065673; Thu, 5 Jan 2012 04:50:11 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2CFCE8FC0C; Thu, 5 Jan 2012 04:50: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 q054oB1E015159; Thu, 5 Jan 2012 04:50:11 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q054oAdu015149; Thu, 5 Jan 2012 04:50:10 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201050450.q054oAdu015149@svn.freebsd.org> From: Eitan Adler Date: Thu, 5 Jan 2012 04:50:10 +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: r229558 - in stable/7: lib/libelf lib/libipsec lib/libpmc lib/msun/man sbin/geom/class/part share/doc/psd/03.iosys share/man/man4 share/man/man9 usr.bin/compress/doc usr.sbin/pkg_instal... 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, 05 Jan 2012 04:50:11 -0000 Author: eadler (ports committer) Date: Thu Jan 5 04:50:10 2012 New Revision: 229558 URL: http://svn.freebsd.org/changeset/base/229558 Log: MFC r227458, r226436: - change "is is" to "is" or "it is" - change "the the" to "the" - other typo fixes Approved by: lstewart Modified: stable/7/lib/libelf/elf_update.3 stable/7/lib/libipsec/ipsec_strerror.3 stable/7/lib/libpmc/pmc.core.3 stable/7/lib/msun/man/ieee.3 stable/7/sbin/geom/class/part/gpart.8 stable/7/share/doc/psd/03.iosys/iosys stable/7/share/man/man4/dc.4 stable/7/share/man/man9/sleepqueue.9 stable/7/usr.bin/compress/doc/NOTES stable/7/usr.sbin/pkg_install/lib/version.c Directory Properties: stable/7/lib/libc/ (props changed) stable/7/lib/libelf/ (props changed) stable/7/lib/libipsec/ (props changed) stable/7/lib/libpmc/ (props changed) stable/7/lib/msun/ (props changed) stable/7/sbin/geom/ (props changed) stable/7/sbin/geom/class/part/ (props changed) stable/7/share/doc/ (props changed) stable/7/share/man/ (props changed) stable/7/share/man/man4/ (props changed) stable/7/share/man/man9/ (props changed) stable/7/usr.bin/compress/ (props changed) stable/7/usr.sbin/pkg_install/ (props changed) Modified: stable/7/lib/libelf/elf_update.3 ============================================================================== --- stable/7/lib/libelf/elf_update.3 Thu Jan 5 04:36:57 2012 (r229557) +++ stable/7/lib/libelf/elf_update.3 Thu Jan 5 04:50:10 2012 (r229558) @@ -66,7 +66,7 @@ responsibility for the layout of the ELF If this bit is not set, the ELF library will compute the layout of the file from its associated section descriptors. .Pp -It is the application's responsibility to manage the the following +It is the application's responsibility to manage the following structure members in the ELF file: .Bl -tag -width indent .It "Executable Header" Modified: stable/7/lib/libipsec/ipsec_strerror.3 ============================================================================== --- stable/7/lib/libipsec/ipsec_strerror.3 Thu Jan 5 04:36:57 2012 (r229557) +++ stable/7/lib/libipsec/ipsec_strerror.3 Thu Jan 5 04:50:10 2012 (r229558) @@ -63,7 +63,7 @@ as an underlying function, calling .Xr strerror 3 after .Fn ipsec_strerror -would overwrite the the return value from +would overwrite the return value from .Fn ipsec_strerror and make it invalid. .\" Modified: stable/7/lib/libpmc/pmc.core.3 ============================================================================== --- stable/7/lib/libpmc/pmc.core.3 Thu Jan 5 04:36:57 2012 (r229557) +++ stable/7/lib/libpmc/pmc.core.3 Thu Jan 5 04:50:10 2012 (r229558) @@ -459,7 +459,7 @@ The number of instruction fetch misses i streaming buffers. .It Li ICache_Reads .Pq Event 80H , Umask 00H -The number of instruction fetches from the the instruction cache and +The number of instruction fetches from the instruction cache and streaming buffers counting both cacheable and uncacheable fetches. .It Li IFU_Mem_Stall .Pq Event 86H , Umask 00H Modified: stable/7/lib/msun/man/ieee.3 ============================================================================== --- stable/7/lib/msun/man/ieee.3 Thu Jan 5 04:36:57 2012 (r229557) +++ stable/7/lib/msun/man/ieee.3 Thu Jan 5 04:50:10 2012 (r229558) @@ -183,7 +183,7 @@ Type name: .Bd -ragged -offset indent -compact On some architectures, .Vt long double -is the the same as +is the same as .Vt double . .Ed .Pp Modified: stable/7/sbin/geom/class/part/gpart.8 ============================================================================== --- stable/7/sbin/geom/class/part/gpart.8 Thu Jan 5 04:36:57 2012 (r229557) +++ stable/7/sbin/geom/class/part/gpart.8 Thu Jan 5 04:50:10 2012 (r229558) @@ -289,7 +289,7 @@ Modify a partition from geom and further identified by the .Fl i Ar index option. -Only the the type and/or label of the partition can be modified. +Only the type and/or label of the partition can be modified. To change the type of a partition, specify the new type with the .Fl t Ar type option. Modified: stable/7/share/doc/psd/03.iosys/iosys ============================================================================== --- stable/7/share/doc/psd/03.iosys/iosys Thu Jan 5 04:36:57 2012 (r229557) +++ stable/7/share/doc/psd/03.iosys/iosys Thu Jan 5 04:50:10 2012 (r229558) @@ -813,7 +813,7 @@ which have a separate argument which indicates read or write. .IP B_DONE 10 This bit is set -to 0 when a block is handed to the the device strategy +to 0 when a block is handed to the device strategy routine and is turned on when the operation completes, whether normally as the result of an error. It is also used as part of the return argument of Modified: stable/7/share/man/man4/dc.4 ============================================================================== --- stable/7/share/man/man4/dc.4 Thu Jan 5 04:36:57 2012 (r229557) +++ stable/7/share/man/man4/dc.4 Thu Jan 5 04:50:10 2012 (r229558) @@ -55,7 +55,7 @@ if_dc_load="YES" The .Nm driver provides support for several PCI Fast Ethernet adapters and -embedded controllers based on the the DEC/Intel 21143 chipset and clones. +embedded controllers based on the DEC/Intel 21143 chipset and clones. .Pp All of supported chipsets have the same general register layout, DMA descriptor format and method of operation. Modified: stable/7/share/man/man9/sleepqueue.9 ============================================================================== --- stable/7/share/man/man9/sleepqueue.9 Thu Jan 5 04:36:57 2012 (r229557) +++ stable/7/share/man/man9/sleepqueue.9 Thu Jan 5 04:50:10 2012 (r229558) @@ -338,7 +338,7 @@ argument specifies the thread to awaken argument specifies the wait channel to awaken it from. If the thread .Fa td -is not blocked on the the wait channel +is not blocked on the wait channel .Fa wchan then this function will not do anything, even if the thread is asleep on a different wait channel. Modified: stable/7/usr.bin/compress/doc/NOTES ============================================================================== --- stable/7/usr.bin/compress/doc/NOTES Thu Jan 5 04:36:57 2012 (r229557) +++ stable/7/usr.bin/compress/doc/NOTES Thu Jan 5 04:50:10 2012 (r229558) @@ -51,7 +51,7 @@ comprehensive survey of an area which wi Until the dust clears, how you approach ideas which are patented depends on how paranoid you are of a legal onslaught. Arbitrary? Yes. But -the patent bar the the CCPA (Court of Customs and Patent Appeals) +the patent bar of the CCPA (Court of Customs and Patent Appeals) thanks you for any uncertainty as they, at least, stand to gain from any trouble. Modified: stable/7/usr.sbin/pkg_install/lib/version.c ============================================================================== --- stable/7/usr.sbin/pkg_install/lib/version.c Thu Jan 5 04:36:57 2012 (r229557) +++ stable/7/usr.sbin/pkg_install/lib/version.c Thu Jan 5 04:50:10 2012 (r229558) @@ -66,7 +66,7 @@ split_version(const char *pkgname, const if (pkgname == NULL) errx(2, "%s: Passed NULL pkgname.", __func__); - /* Look for the last '-' the the pkgname */ + /* Look for the last '-' in the pkgname */ ch = strrchr(pkgname, '-'); /* Cheat if we are just passed a version, not a valid package name */ versionstr = ch ? ch + 1 : pkgname; From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 04:50:29 2012 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 2C81C10657B2; Thu, 5 Jan 2012 04:50:29 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 11EDB8FC16; Thu, 5 Jan 2012 04:50: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 q054oSNa015213; Thu, 5 Jan 2012 04:50:28 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q054oSU1015202; Thu, 5 Jan 2012 04:50:28 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201050450.q054oSU1015202@svn.freebsd.org> From: Eitan Adler Date: Thu, 5 Jan 2012 04:50: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: r229559 - in stable/8: lib/libelf lib/libipsec lib/libpmc lib/msun/man sbin/geom/class/part share/doc/psd/03.iosys share/man/man4 share/man/man9 usr.bin/compress/doc usr.sbin/pkg_instal... 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, 05 Jan 2012 04:50:29 -0000 Author: eadler (ports committer) Date: Thu Jan 5 04:50:28 2012 New Revision: 229559 URL: http://svn.freebsd.org/changeset/base/229559 Log: MFC r227458, r226436: - change "is is" to "is" or "it is" - change "the the" to "the" - other typo fixes Approved by: lstewart Modified: stable/8/lib/libelf/elf_update.3 stable/8/lib/libipsec/ipsec_strerror.3 stable/8/lib/libpmc/pmc.core.3 stable/8/lib/msun/man/ieee.3 stable/8/sbin/geom/class/part/gpart.8 stable/8/share/doc/psd/03.iosys/iosys stable/8/share/man/man4/dc.4 stable/8/share/man/man9/sleepqueue.9 stable/8/usr.bin/compress/doc/NOTES stable/8/usr.sbin/pkg_install/lib/version.c Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libelf/ (props changed) stable/8/lib/libipsec/ (props changed) stable/8/lib/libpmc/ (props changed) stable/8/lib/msun/ (props changed) stable/8/sbin/geom/ (props changed) stable/8/sbin/geom/class/part/ (props changed) stable/8/share/doc/ (props changed) stable/8/share/man/ (props changed) stable/8/share/man/man4/ (props changed) stable/8/share/man/man9/ (props changed) stable/8/usr.bin/compress/ (props changed) stable/8/usr.sbin/pkg_install/ (props changed) Modified: stable/8/lib/libelf/elf_update.3 ============================================================================== --- stable/8/lib/libelf/elf_update.3 Thu Jan 5 04:50:10 2012 (r229558) +++ stable/8/lib/libelf/elf_update.3 Thu Jan 5 04:50:28 2012 (r229559) @@ -66,7 +66,7 @@ responsibility for the layout of the ELF If this flag is not set, the ELF library will compute the layout of the file from its associated section descriptors. .Pp -It is the application's responsibility to manage the the following +It is the application's responsibility to manage the following structure members in the ELF file: .Bl -tag -width indent .It "Executable Header" Modified: stable/8/lib/libipsec/ipsec_strerror.3 ============================================================================== --- stable/8/lib/libipsec/ipsec_strerror.3 Thu Jan 5 04:50:10 2012 (r229558) +++ stable/8/lib/libipsec/ipsec_strerror.3 Thu Jan 5 04:50:28 2012 (r229559) @@ -63,7 +63,7 @@ as an underlying function, calling .Xr strerror 3 after .Fn ipsec_strerror -would overwrite the the return value from +would overwrite the return value from .Fn ipsec_strerror and make it invalid. .\" Modified: stable/8/lib/libpmc/pmc.core.3 ============================================================================== --- stable/8/lib/libpmc/pmc.core.3 Thu Jan 5 04:50:10 2012 (r229558) +++ stable/8/lib/libpmc/pmc.core.3 Thu Jan 5 04:50:28 2012 (r229559) @@ -459,7 +459,7 @@ The number of instruction fetch misses i streaming buffers. .It Li ICache_Reads .Pq Event 80H , Umask 00H -The number of instruction fetches from the the instruction cache and +The number of instruction fetches from the instruction cache and streaming buffers counting both cacheable and uncacheable fetches. .It Li IFU_Mem_Stall .Pq Event 86H , Umask 00H Modified: stable/8/lib/msun/man/ieee.3 ============================================================================== --- stable/8/lib/msun/man/ieee.3 Thu Jan 5 04:50:10 2012 (r229558) +++ stable/8/lib/msun/man/ieee.3 Thu Jan 5 04:50:28 2012 (r229559) @@ -183,7 +183,7 @@ Type name: .Bd -ragged -offset indent -compact On some architectures, .Vt long double -is the the same as +is the same as .Vt double . .Ed .Pp Modified: stable/8/sbin/geom/class/part/gpart.8 ============================================================================== --- stable/8/sbin/geom/class/part/gpart.8 Thu Jan 5 04:50:10 2012 (r229558) +++ stable/8/sbin/geom/class/part/gpart.8 Thu Jan 5 04:50:28 2012 (r229559) @@ -366,7 +366,7 @@ Modify a partition from geom and further identified by the .Fl i Ar index option. -Only the the type and/or label of the partition can be modified. +Only the type and/or label of the partition can be modified. To change the type of a partition, specify the new type with the .Fl t Ar type option. Modified: stable/8/share/doc/psd/03.iosys/iosys ============================================================================== --- stable/8/share/doc/psd/03.iosys/iosys Thu Jan 5 04:50:10 2012 (r229558) +++ stable/8/share/doc/psd/03.iosys/iosys Thu Jan 5 04:50:28 2012 (r229559) @@ -813,7 +813,7 @@ which have a separate argument which indicates read or write. .IP B_DONE 10 This bit is set -to 0 when a block is handed to the the device strategy +to 0 when a block is handed to the device strategy routine and is turned on when the operation completes, whether normally as the result of an error. It is also used as part of the return argument of Modified: stable/8/share/man/man4/dc.4 ============================================================================== --- stable/8/share/man/man4/dc.4 Thu Jan 5 04:50:10 2012 (r229558) +++ stable/8/share/man/man4/dc.4 Thu Jan 5 04:50:28 2012 (r229559) @@ -55,7 +55,7 @@ if_dc_load="YES" The .Nm driver provides support for several PCI Fast Ethernet adapters and -embedded controllers based on the the DEC/Intel 21143 chipset and clones. +embedded controllers based on the DEC/Intel 21143 chipset and clones. .Pp All of supported chipsets have the same general register layout, DMA descriptor format and method of operation. Modified: stable/8/share/man/man9/sleepqueue.9 ============================================================================== --- stable/8/share/man/man9/sleepqueue.9 Thu Jan 5 04:50:10 2012 (r229558) +++ stable/8/share/man/man9/sleepqueue.9 Thu Jan 5 04:50:28 2012 (r229559) @@ -351,7 +351,7 @@ argument specifies the thread to awaken argument specifies the wait channel to awaken it from. If the thread .Fa td -is not blocked on the the wait channel +is not blocked on the wait channel .Fa wchan then this function will not do anything, even if the thread is asleep on a different wait channel. Modified: stable/8/usr.bin/compress/doc/NOTES ============================================================================== --- stable/8/usr.bin/compress/doc/NOTES Thu Jan 5 04:50:10 2012 (r229558) +++ stable/8/usr.bin/compress/doc/NOTES Thu Jan 5 04:50:28 2012 (r229559) @@ -51,7 +51,7 @@ comprehensive survey of an area which wi Until the dust clears, how you approach ideas which are patented depends on how paranoid you are of a legal onslaught. Arbitrary? Yes. But -the patent bar the the CCPA (Court of Customs and Patent Appeals) +the patent bar of the CCPA (Court of Customs and Patent Appeals) thanks you for any uncertainty as they, at least, stand to gain from any trouble. Modified: stable/8/usr.sbin/pkg_install/lib/version.c ============================================================================== --- stable/8/usr.sbin/pkg_install/lib/version.c Thu Jan 5 04:50:10 2012 (r229558) +++ stable/8/usr.sbin/pkg_install/lib/version.c Thu Jan 5 04:50:28 2012 (r229559) @@ -66,7 +66,7 @@ split_version(const char *pkgname, const if (pkgname == NULL) errx(2, "%s: Passed NULL pkgname.", __func__); - /* Look for the last '-' the the pkgname */ + /* Look for the last '-' in the pkgname */ ch = strrchr(pkgname, '-'); /* Cheat if we are just passed a version, not a valid package name */ versionstr = ch ? ch + 1 : pkgname; From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 06:22:09 2012 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 E6464106564A; Thu, 5 Jan 2012 06:22:09 +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 D0DBF8FC08; Thu, 5 Jan 2012 06:22:09 +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 q056M9sf018049; Thu, 5 Jan 2012 06:22:09 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q056M9EW018047; Thu, 5 Jan 2012 06:22:09 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201201050622.q056M9EW018047@svn.freebsd.org> From: Adrian Chadd Date: Thu, 5 Jan 2012 06:22:09 +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: r229560 - head/sys/modules/ath 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, 05 Jan 2012 06:22:10 -0000 Author: adrian Date: Thu Jan 5 06:22:09 2012 New Revision: 229560 URL: http://svn.freebsd.org/changeset/base/229560 Log: Re-enable this bit of logic from before, which only sets a default opt_ah.h file if KERNBUILDDIR isn't defined. For now, AH_SUPPORT_AR5416 is required, so I'll just fix any configuration file in /usr/src which is missing this option. Pointy hat when things do break to: adrian Modified: head/sys/modules/ath/Makefile Modified: head/sys/modules/ath/Makefile ============================================================================== --- head/sys/modules/ath/Makefile Thu Jan 5 04:50:28 2012 (r229559) +++ head/sys/modules/ath/Makefile Thu Jan 5 06:22:09 2012 (r229560) @@ -140,8 +140,10 @@ SRCS+= dfs_null.c CFLAGS+= -I. -I${.CURDIR}/../../dev/ath -I${.CURDIR}/../../dev/ath/ath_hal +.if !defined(KERNBUILDDIR) opt_ah.h: echo '#define AH_SUPPORT_AR5416 1' > $@ +.endif .include From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 07:19:06 2012 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 6873C106566B; Thu, 5 Jan 2012 07:19: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 52BD38FC0A; Thu, 5 Jan 2012 07:19: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 q057J6Cj019745; Thu, 5 Jan 2012 07:19:06 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q057J5d2019743; Thu, 5 Jan 2012 07:19:05 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201201050719.q057J5d2019743@svn.freebsd.org> From: Adrian Chadd Date: Thu, 5 Jan 2012 07:19: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: r229561 - head/sys/mips/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: Thu, 05 Jan 2012 07:19:06 -0000 Author: adrian Date: Thu Jan 5 07:19:05 2012 New Revision: 229561 URL: http://svn.freebsd.org/changeset/base/229561 Log: This isn't required any longer - it turns out the flash has ~ 1.7MB of space for a kernel. There's thus plenty of space for a full, non-module kernel. Modified: head/sys/mips/conf/PB47 Modified: head/sys/mips/conf/PB47 ============================================================================== --- head/sys/mips/conf/PB47 Thu Jan 5 06:22:09 2012 (r229560) +++ head/sys/mips/conf/PB47 Thu Jan 5 07:19:05 2012 (r229561) @@ -24,21 +24,12 @@ options AR71XX_ENV_UBOOT # XXX TODO: add uboot boot parameter parsing to extract MAC, RAM. # Right now it will just detect 32mb out of 64mb, as well as # return a garbage MAC address. - -# don't compile these in - the default flash area for kernel space -# is only 1.2 megabytes. To keep the flash allocation in line with -# what the documentation says for this board, we'll just have to keep -# the kernel smaller than that. -nodevice wlan, wlan_wep, wlan_ccmp, wlan_tkip, wlan_xauth -nodevice ath, ath_pci, ath_hal, ath_rate_sample - -# Since the module build doesn't like TDMA.. -nooptions IEEE80211_SUPPORT_TDMA +options AR71XX_REALMEM=64*1024*1024 # For DOS - enable if required -#options GEOM_PART_BSD -#options GEOM_PART_MBR -#options MSDOSFS +options GEOM_PART_BSD +options GEOM_PART_MBR +options MSDOSFS # uncompress - to boot read-only lzma natively from flash device geom_uncompress From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 08:51:07 2012 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 647111065672; Thu, 5 Jan 2012 08:51:07 +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 4F7368FC15; Thu, 5 Jan 2012 08:51: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 q058p7mm022646; Thu, 5 Jan 2012 08:51:07 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q058p7IP022644; Thu, 5 Jan 2012 08:51:07 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201201050851.q058p7IP022644@svn.freebsd.org> From: Ed Schouten Date: Thu, 5 Jan 2012 08:51: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: r229562 - head/sys/i386/include 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, 05 Jan 2012 08:51:07 -0000 Author: ed Date: Thu Jan 5 08:51:06 2012 New Revision: 229562 URL: http://svn.freebsd.org/changeset/base/229562 Log: Also import WEAK_ALIAS() from the MIPS code. Modified: head/sys/i386/include/asm.h Modified: head/sys/i386/include/asm.h ============================================================================== --- head/sys/i386/include/asm.h Thu Jan 5 07:19:05 2012 (r229561) +++ head/sys/i386/include/asm.h Thu Jan 5 08:51:06 2012 (r229562) @@ -90,6 +90,13 @@ #endif /* + * WEAK_ALIAS: create a weak alias. + */ +#define WEAK_ALIAS(alias,sym) \ + .weak alias; \ + alias = sym + +/* * STRONG_ALIAS: create a strong alias. */ #define STRONG_ALIAS(alias,sym) \ From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 08:53:55 2012 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 226B41065677; Thu, 5 Jan 2012 08:53:55 +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 0B5C38FC13; Thu, 5 Jan 2012 08:53: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 q058rsox022759; Thu, 5 Jan 2012 08:53:54 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q058rsMC022756; Thu, 5 Jan 2012 08:53:54 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201050853.q058rsMC022756@svn.freebsd.org> From: Martin Matuska Date: Thu, 5 Jan 2012 08:53:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229563 - in stable/9/cddl/contrib/opensolaris/cmd: zfs zpool 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, 05 Jan 2012 08:53:55 -0000 Author: mm Date: Thu Jan 5 08:53:54 2012 New Revision: 229563 URL: http://svn.freebsd.org/changeset/base/229563 Log: MFC r227497, r228020: MFC r227497 [1]: Import upstream changesets for the output of the "zpool" command: 952 separate intent logs should be obvious in 'zpool iostat' output 1337 `zpool status -D' should tell if there are no DDT entries References: https://www.illumos.org/issues/952 https://www.illumos.org/issues/1337 MFC r228020: Fix zfs(8) and zpool(8) context help to repport supported flags. Obtained from: Illumos (issues 952, 1337; changesets 13384, 13432) [1] Modified: stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Directory Properties: stable/9/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Thu Jan 5 08:51:06 2012 (r229562) +++ stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Thu Jan 5 08:53:54 2012 (r229563) @@ -257,7 +257,8 @@ get_usage(zfs_help_t idx) case HELP_ROLLBACK: return (gettext("\trollback [-rRf] \n")); case HELP_SEND: - return (gettext("\tsend [-RDp] [-[iI] snapshot] \n")); + return (gettext("\tsend [-DvRp] " + "[-i snapshot | -I snapshot] \n")); case HELP_SET: return (gettext("\tset " " ...\n")); @@ -293,11 +294,11 @@ get_usage(zfs_help_t idx) "\tunallow [-r] -s @setname [[,...]] " "\n")); case HELP_USERSPACE: - return (gettext("\tuserspace [-hniHp] [-o field[,...]] " + return (gettext("\tuserspace [-niHp] [-o field[,...]] " "[-sS field] ... [-t type[,...]]\n" "\t \n")); case HELP_GROUPSPACE: - return (gettext("\tgroupspace [-hniHpU] [-o field[,...]] " + return (gettext("\tgroupspace [-niHp] [-o field[,...]] " "[-sS field] ... [-t type[,...]]\n" "\t \n")); case HELP_HOLD: Modified: stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Jan 5 08:51:06 2012 (r229562) +++ stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Jan 5 08:53:54 2012 (r229563) @@ -21,6 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright 2011 Nexenta Systems, Inc. All rights reserved. */ #include @@ -227,7 +228,7 @@ get_usage(zpool_help_t idx) { case HELP_OFFLINE: return (gettext("\toffline [-t] ...\n")); case HELP_ONLINE: - return (gettext("\tonline ...\n")); + return (gettext("\tonline [-e] ...\n")); case HELP_REPLACE: return (gettext("\treplace [-f] " "[new-device]\n")); @@ -239,8 +240,7 @@ get_usage(zpool_help_t idx) { return (gettext("\tstatus [-vx] [-T d|u] [pool] ... [interval " "[count]]\n")); case HELP_UPGRADE: - return (gettext("\tupgrade\n" - "\tupgrade -v\n" + return (gettext("\tupgrade [-v]\n" "\tupgrade [-V version] <-a | pool ...>\n")); case HELP_GET: return (gettext("\tget <\"all\" | property[,...]> " @@ -2206,10 +2206,15 @@ print_vdev_stats(zpool_handle_t *zhp, co return; for (c = 0; c < children; c++) { - uint64_t ishole = B_FALSE; + uint64_t ishole = B_FALSE, islog = B_FALSE; - if (nvlist_lookup_uint64(newchild[c], - ZPOOL_CONFIG_IS_HOLE, &ishole) == 0 && ishole) + (void) nvlist_lookup_uint64(newchild[c], ZPOOL_CONFIG_IS_HOLE, + &ishole); + + (void) nvlist_lookup_uint64(newchild[c], ZPOOL_CONFIG_IS_LOG, + &islog); + + if (ishole || islog) continue; vname = zpool_vdev_name(g_zfs, zhp, newchild[c], B_FALSE); @@ -2219,6 +2224,31 @@ print_vdev_stats(zpool_handle_t *zhp, co } /* + * Log device section + */ + + if (num_logs(newnv) > 0) { + (void) printf("%-*s - - - - - " + "-\n", cb->cb_namewidth, "logs"); + + for (c = 0; c < children; c++) { + uint64_t islog = B_FALSE; + (void) nvlist_lookup_uint64(newchild[c], + ZPOOL_CONFIG_IS_LOG, &islog); + + if (islog) { + vname = zpool_vdev_name(g_zfs, zhp, newchild[c], + B_FALSE); + print_vdev_stats(zhp, vname, oldnv ? + oldchild[c] : NULL, newchild[c], + cb, depth + 2); + free(vname); + } + } + + } + + /* * Include level 2 ARC devices in iostat output */ if (nvlist_lookup_nvlist_array(newnv, ZPOOL_CONFIG_L2CACHE, @@ -3377,7 +3407,7 @@ print_scan_status(pool_scan_stat_t *ps) double fraction_done; char processed_buf[7], examined_buf[7], total_buf[7], rate_buf[7]; - (void) printf(gettext(" scan: ")); + (void) printf(gettext(" scan: ")); /* If there's never been a scan, there's not much to say. */ if (ps == NULL || ps->pss_func == POOL_SCAN_NONE || @@ -3457,7 +3487,7 @@ print_scan_status(pool_scan_stat_t *ps) /* * do not print estimated time if hours_left is more than 30 days */ - (void) printf(gettext(" %s scanned out of %s at %s/s"), + (void) printf(gettext(" %s scanned out of %s at %s/s"), examined_buf, total_buf, rate_buf); if (hours_left < (30 * 24)) { (void) printf(gettext(", %lluh%um to go\n"), @@ -3468,10 +3498,10 @@ print_scan_status(pool_scan_stat_t *ps) } if (ps->pss_func == POOL_SCAN_RESILVER) { - (void) printf(gettext(" %s resilvered, %.2f%% done\n"), + (void) printf(gettext(" %s resilvered, %.2f%% done\n"), processed_buf, 100 * fraction_done); } else if (ps->pss_func == POOL_SCAN_SCRUB) { - (void) printf(gettext(" %s repaired, %.2f%% done\n"), + (void) printf(gettext(" %s repaired, %.2f%% done\n"), processed_buf, 100 * fraction_done); } } @@ -3565,10 +3595,16 @@ print_dedup_stats(nvlist_t *config) * table continue processing the stats. */ if (nvlist_lookup_uint64_array(config, ZPOOL_CONFIG_DDT_OBJ_STATS, - (uint64_t **)&ddo, &c) != 0 || ddo->ddo_count == 0) + (uint64_t **)&ddo, &c) != 0) return; (void) printf("\n"); + (void) printf(gettext(" dedup: ")); + if (ddo->ddo_count == 0) { + (void) printf(gettext("no DDT entries\n")); + return; + } + (void) printf("DDT entries %llu, size %llu on disk, %llu in core\n", (u_longlong_t)ddo->ddo_count, (u_longlong_t)ddo->ddo_dspace, From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 08:54:16 2012 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 5BEEF10657CA; Thu, 5 Jan 2012 08:54:16 +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 458398FC17; Thu, 5 Jan 2012 08:54: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 q058sGxp022813; Thu, 5 Jan 2012 08:54:16 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q058sGXH022810; Thu, 5 Jan 2012 08:54:16 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201050854.q058sGXH022810@svn.freebsd.org> From: Martin Matuska Date: Thu, 5 Jan 2012 08:54:16 +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: r229564 - in stable/8/cddl/contrib/opensolaris/cmd: zfs zpool 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, 05 Jan 2012 08:54:16 -0000 Author: mm Date: Thu Jan 5 08:54:15 2012 New Revision: 229564 URL: http://svn.freebsd.org/changeset/base/229564 Log: MFC r227497, r228020: MFC r227497 [1]: Import upstream changesets for the output of the "zpool" command: 952 separate intent logs should be obvious in 'zpool iostat' output 1337 `zpool status -D' should tell if there are no DDT entries References: https://www.illumos.org/issues/952 https://www.illumos.org/issues/1337 MFC r228020: Fix zfs(8) and zpool(8) context help to repport supported flags. Obtained from: Illumos (issues 952, 1337; changesets 13384, 13432) [1] Modified: stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Thu Jan 5 08:53:54 2012 (r229563) +++ stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Thu Jan 5 08:54:15 2012 (r229564) @@ -257,7 +257,8 @@ get_usage(zfs_help_t idx) case HELP_ROLLBACK: return (gettext("\trollback [-rRf] \n")); case HELP_SEND: - return (gettext("\tsend [-RDp] [-[iI] snapshot] \n")); + return (gettext("\tsend [-DvRp] " + "[-i snapshot | -I snapshot] \n")); case HELP_SET: return (gettext("\tset " " ...\n")); @@ -293,11 +294,11 @@ get_usage(zfs_help_t idx) "\tunallow [-r] -s @setname [[,...]] " "\n")); case HELP_USERSPACE: - return (gettext("\tuserspace [-hniHp] [-o field[,...]] " + return (gettext("\tuserspace [-niHp] [-o field[,...]] " "[-sS field] ... [-t type[,...]]\n" "\t \n")); case HELP_GROUPSPACE: - return (gettext("\tgroupspace [-hniHpU] [-o field[,...]] " + return (gettext("\tgroupspace [-niHp] [-o field[,...]] " "[-sS field] ... [-t type[,...]]\n" "\t \n")); case HELP_HOLD: Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Jan 5 08:53:54 2012 (r229563) +++ stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Jan 5 08:54:15 2012 (r229564) @@ -21,6 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright 2011 Nexenta Systems, Inc. All rights reserved. */ #include @@ -221,7 +222,7 @@ get_usage(zpool_help_t idx) { case HELP_OFFLINE: return (gettext("\toffline [-t] ...\n")); case HELP_ONLINE: - return (gettext("\tonline ...\n")); + return (gettext("\tonline [-e] ...\n")); case HELP_REPLACE: return (gettext("\treplace [-f] " "[new-device]\n")); @@ -233,8 +234,7 @@ get_usage(zpool_help_t idx) { return (gettext("\tstatus [-vx] [-T d|u] [pool] ... [interval " "[count]]\n")); case HELP_UPGRADE: - return (gettext("\tupgrade\n" - "\tupgrade -v\n" + return (gettext("\tupgrade [-v]\n" "\tupgrade [-V version] <-a | pool ...>\n")); case HELP_GET: return (gettext("\tget <\"all\" | property[,...]> " @@ -2080,10 +2080,15 @@ print_vdev_stats(zpool_handle_t *zhp, co return; for (c = 0; c < children; c++) { - uint64_t ishole = B_FALSE; + uint64_t ishole = B_FALSE, islog = B_FALSE; - if (nvlist_lookup_uint64(newchild[c], - ZPOOL_CONFIG_IS_HOLE, &ishole) == 0 && ishole) + (void) nvlist_lookup_uint64(newchild[c], ZPOOL_CONFIG_IS_HOLE, + &ishole); + + (void) nvlist_lookup_uint64(newchild[c], ZPOOL_CONFIG_IS_LOG, + &islog); + + if (ishole || islog) continue; vname = zpool_vdev_name(g_zfs, zhp, newchild[c], B_FALSE); @@ -2093,6 +2098,31 @@ print_vdev_stats(zpool_handle_t *zhp, co } /* + * Log device section + */ + + if (num_logs(newnv) > 0) { + (void) printf("%-*s - - - - - " + "-\n", cb->cb_namewidth, "logs"); + + for (c = 0; c < children; c++) { + uint64_t islog = B_FALSE; + (void) nvlist_lookup_uint64(newchild[c], + ZPOOL_CONFIG_IS_LOG, &islog); + + if (islog) { + vname = zpool_vdev_name(g_zfs, zhp, newchild[c], + B_FALSE); + print_vdev_stats(zhp, vname, oldnv ? + oldchild[c] : NULL, newchild[c], + cb, depth + 2); + free(vname); + } + } + + } + + /* * Include level 2 ARC devices in iostat output */ if (nvlist_lookup_nvlist_array(newnv, ZPOOL_CONFIG_L2CACHE, @@ -3439,10 +3469,16 @@ print_dedup_stats(nvlist_t *config) * table continue processing the stats. */ if (nvlist_lookup_uint64_array(config, ZPOOL_CONFIG_DDT_OBJ_STATS, - (uint64_t **)&ddo, &c) != 0 || ddo->ddo_count == 0) + (uint64_t **)&ddo, &c) != 0) return; (void) printf("\n"); + (void) printf(gettext(" dedup: ")); + if (ddo->ddo_count == 0) { + (void) printf(gettext("no DDT entries\n")); + return; + } + (void) printf("DDT entries %llu, size %llu on disk, %llu in core\n", (u_longlong_t)ddo->ddo_count, (u_longlong_t)ddo->ddo_dspace, From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 09:37:32 2012 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 28213106566C; Thu, 5 Jan 2012 09:37:32 +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 0BAF18FC16; Thu, 5 Jan 2012 09:37: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 q059bVtC024439; Thu, 5 Jan 2012 09:37:31 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q059bVaf024424; Thu, 5 Jan 2012 09:37:31 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201050937.q059bVaf024424@svn.freebsd.org> From: Martin Matuska Date: Thu, 5 Jan 2012 09:37:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229565 - in stable/9: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common... 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, 05 Jan 2012 09:37:32 -0000 Author: mm Date: Thu Jan 5 09:37:31 2012 New Revision: 229565 URL: http://svn.freebsd.org/changeset/base/229565 Log: MFC r226676, r226678, r226700, r226705, r226706, r226707: MFC r226676 (pjd): Allow to rename file systems without remounting if it is possible. It is possible for file systems with 'mountpoint' preperty set to 'legacy' or 'none' - we don't have to change mount directory for them. Currently such file systems are unmounted on rename and not even mounted back. This introduces layering violation, as we need to update 'f_mntfromname' field in statfs structure related to mountpoint (for the dataset we are renaming and all its children). In my opinion it is worth it, as it allow to update FreeBSD in even cleaner way - in ZFS-only configuration root file system is ZFS file system with 'mountpoint' property set to 'legacy'. If root dataset is named system/rootfs, we can snapshot it (system/rootfs@upgrade), clone it (system/oldrootfs), update FreeBSD and if it doesn't boot we can boot back from system/oldrootfs and rename it back to system/rootfs while it is mounted as /. Before it was not possible, because unmounting / was not possible. MFC r227768 (pjd): Include only when compiling kernel module. MFC r226700 (pjd): Don't forget to rename mounted snapshots of the file system being renamed. MFC r226705 (pjd): Extend r226676 to allow rename without unmount even for file systems with non-legacy mountpoints. It is better to be able to rename such file systems and let them be mounted in old places until next reboot than using live CD, etc. to rename with remount. This is implemented by adding -u option to 'zfs rename'. If file system's mountpoint property is set to 'legacy' or 'none', there is no need to specify -u. Update zfs(8) manual page to reflect this addition. MFC r226706 (pjd): Update copyright to include myself. MFC r226707 (pjd): - Use better naming now that we allow to rename any mounted file system (not only legacy). - Update copyright to include myself. Approved by: pjd Modified: stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs.8 stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dir.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Directory Properties: stable/9/cddl/contrib/opensolaris/ (props changed) stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Jan 5 08:54:15 2012 (r229564) +++ stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Jan 5 09:37:31 2012 (r229565) @@ -76,6 +76,11 @@ zfs \- configures ZFS file systems .LP .nf +\fBzfs\fR \fBrename\fR \fB-u\fR [\fB-p\fR] \fIfilesystem\fR \fIfilesystem\fR +.fi + +.LP +.nf \fBzfs\fR \fBlist\fR [\fB-r\fR|\fB-d\fR \fIdepth\fR][\fB-H\fR][\fB-o\fR \fIproperty\fR[,...]] [\fB-t\fR \fItype\fR[,...]] [\fB-s\fR \fIproperty\fR] ... [\fB-S\fR \fIproperty\fR] ... [\fIfilesystem\fR|\fIvolume\fR|\fIsnapshot\fR] ... .fi @@ -1479,6 +1484,10 @@ The snapshot that was cloned, and any sn .na \fB\fBzfs rename\fR [\fB-p\fR] \fIfilesystem\fR|\fIvolume\fR \fIfilesystem\fR|\fIvolume\fR\fR .ad +.br +.na +\fB\fBzfs rename\fR \fB-u\fR [\fB-p\fR] \fIfilesystem\fR \fIfilesystem\fR\fR +.ad .sp .6 .RS 4n Renames the given dataset. The new target can be located anywhere in the \fBZFS\fR hierarchy, with the exception of snapshots. Snapshots can only be renamed within the parent file system or volume. When renaming a snapshot, the parent file system of the snapshot does not need to be specified as part of the second argument. Renamed file systems can inherit new mount points, in which case they are unmounted and remounted at the new mount point. @@ -1493,6 +1502,17 @@ Renames the given dataset. The new targe Creates all the nonexistent parent datasets. Datasets created in this manner are automatically mounted according to the \fBmountpoint\fR property inherited from their parent. .RE +.sp +.ne 2 +.mk +.na +\fB\fB-u\fR\fR +.ad +.sp .6 +.RS 4n +Do not remount file systems during rename. If a file system's \fBmountpoint\fR property is set to \fBlegacy\fR or \fBnone\fR, file system is not unmounted even if this option is not given. +.RE + .RE .sp Modified: stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Thu Jan 5 08:54:15 2012 (r229564) +++ stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Thu Jan 5 09:37:31 2012 (r229565) @@ -22,6 +22,8 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + * Copyright (c) 2011 Pawel Jakub Dawidek . + * All rights reserved. */ #include @@ -253,7 +255,8 @@ get_usage(zfs_help_t idx) return (gettext("\trename " "\n" "\trename -p \n" - "\trename -r ")); + "\trename -r \n" + "\trename -u [-p] ")); case HELP_ROLLBACK: return (gettext("\trollback [-rRf] \n")); case HELP_SEND: @@ -2852,6 +2855,7 @@ zfs_do_list(int argc, char **argv) * zfs rename * zfs rename -p * zfs rename -r + * zfs rename -u [-p] * * Renames the given dataset to another of the same type. * @@ -2862,19 +2866,21 @@ static int zfs_do_rename(int argc, char **argv) { zfs_handle_t *zhp; - int c; - int ret; - boolean_t recurse = B_FALSE; + renameflags_t flags = { 0 }; + int c, ret, types; boolean_t parents = B_FALSE; /* check options */ - while ((c = getopt(argc, argv, "pr")) != -1) { + while ((c = getopt(argc, argv, "pru")) != -1) { switch (c) { case 'p': parents = B_TRUE; break; case 'r': - recurse = B_TRUE; + flags.recurse = B_TRUE; + break; + case 'u': + flags.nounmount = B_TRUE; break; case '?': default: @@ -2903,20 +2909,32 @@ zfs_do_rename(int argc, char **argv) usage(B_FALSE); } - if (recurse && parents) { + if (flags.recurse && parents) { (void) fprintf(stderr, gettext("-p and -r options are mutually " "exclusive\n")); usage(B_FALSE); } - if (recurse && strchr(argv[0], '@') == 0) { + if (flags.recurse && strchr(argv[0], '@') == 0) { (void) fprintf(stderr, gettext("source dataset for recursive " "rename must be a snapshot\n")); usage(B_FALSE); } - if ((zhp = zfs_open(g_zfs, argv[0], parents ? ZFS_TYPE_FILESYSTEM | - ZFS_TYPE_VOLUME : ZFS_TYPE_DATASET)) == NULL) + if (flags.nounmount && parents) { + (void) fprintf(stderr, gettext("-u and -r options are mutually " + "exclusive\n")); + usage(B_FALSE); + } + + if (flags.nounmount) + types = ZFS_TYPE_FILESYSTEM; + else if (parents) + types = ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME; + else + types = ZFS_TYPE_DATASET; + + if ((zhp = zfs_open(g_zfs, argv[0], types)) == NULL) return (1); /* If we were asked and the name looks good, try to create ancestors. */ @@ -2926,7 +2944,7 @@ zfs_do_rename(int argc, char **argv) return (1); } - ret = (zfs_rename(zhp, argv[1], recurse) != 0); + ret = (zfs_rename(zhp, argv[1], flags) != 0); zfs_close(zhp); return (ret); Modified: stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Thu Jan 5 08:54:15 2012 (r229564) +++ stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Thu Jan 5 09:37:31 2012 (r229565) @@ -22,6 +22,8 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2010 Nexenta Systems, Inc. All rights reserved. + * Copyright (c) 2011 Pawel Jakub Dawidek . + * All rights reserved. */ #ifndef _LIBZFS_H @@ -518,7 +520,16 @@ extern int zfs_destroy_snaps(zfs_handle_ extern int zfs_clone(zfs_handle_t *, const char *, nvlist_t *); extern int zfs_snapshot(libzfs_handle_t *, const char *, boolean_t, nvlist_t *); extern int zfs_rollback(zfs_handle_t *, zfs_handle_t *, boolean_t); -extern int zfs_rename(zfs_handle_t *, const char *, boolean_t); + +typedef struct renameflags { + /* recursive rename */ + int recurse : 1; + + /* don't unmount file systems */ + int nounmount : 1; +} renameflags_t; + +extern int zfs_rename(zfs_handle_t *, const char *, renameflags_t flags); typedef struct sendflags { /* print informational messages (ie, -v was specified) */ Modified: stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c ============================================================================== --- stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c Thu Jan 5 08:54:15 2012 (r229564) +++ stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c Thu Jan 5 09:37:31 2012 (r229565) @@ -24,6 +24,9 @@ * Use is subject to license terms. * * Portions Copyright 2007 Ramprakash Jelari + * + * Copyright (c) 2011 Pawel Jakub Dawidek . + * All rights reserved. */ #include @@ -122,6 +125,8 @@ changelist_prefix(prop_changelist_t *clp */ switch (clp->cl_prop) { case ZFS_PROP_MOUNTPOINT: + if (clp->cl_gflags & CL_GATHER_DONT_UNMOUNT) + break; if (zfs_unmount(cn->cn_handle, NULL, clp->cl_mflags) != 0) { ret = -1; @@ -168,8 +173,10 @@ changelist_postfix(prop_changelist_t *cl if ((cn = uu_list_last(clp->cl_list)) == NULL) return (0); - if (clp->cl_prop == ZFS_PROP_MOUNTPOINT) + if (clp->cl_prop == ZFS_PROP_MOUNTPOINT && + !(clp->cl_gflags & CL_GATHER_DONT_UNMOUNT)) { remove_mountpoint(cn->cn_handle); + } /* * It is possible that the changelist_prefix() used libshare @@ -224,7 +231,8 @@ changelist_postfix(prop_changelist_t *cl shareopts, sizeof (shareopts), NULL, NULL, 0, B_FALSE) == 0) && (strcmp(shareopts, "off") != 0)); - mounted = zfs_is_mounted(cn->cn_handle, NULL); + mounted = (clp->cl_gflags & CL_GATHER_DONT_UNMOUNT) || + zfs_is_mounted(cn->cn_handle, NULL); if (!mounted && (cn->cn_mounted || ((sharenfs || sharesmb || clp->cl_waslegacy) && Modified: stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Thu Jan 5 08:54:15 2012 (r229564) +++ stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Thu Jan 5 09:37:31 2012 (r229565) @@ -23,6 +23,8 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2010 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2011 Pawel Jakub Dawidek . + * All rights reserved. */ #include @@ -3480,7 +3482,7 @@ zfs_iter_dependents(zfs_handle_t *zhp, b * Renames the given dataset. */ int -zfs_rename(zfs_handle_t *zhp, const char *target, boolean_t recursive) +zfs_rename(zfs_handle_t *zhp, const char *target, renameflags_t flags) { int ret; zfs_cmd_t zc = { 0 }; @@ -3489,6 +3491,7 @@ zfs_rename(zfs_handle_t *zhp, const char zfs_handle_t *zhrp = NULL; char *parentname = NULL; char parent[ZFS_MAXNAMELEN]; + char property[ZFS_MAXPROPLEN]; libzfs_handle_t *hdl = zhp->zfs_hdl; char errbuf[1024]; @@ -3535,7 +3538,7 @@ zfs_rename(zfs_handle_t *zhp, const char if (!zfs_validate_name(hdl, target, zhp->zfs_type, B_TRUE)) return (zfs_error(hdl, EZFS_INVALIDNAME, errbuf)); } else { - if (recursive) { + if (flags.recurse) { zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "recursive rename must be a snapshot")); return (zfs_error(hdl, EZFS_BADTYPE, errbuf)); @@ -3576,7 +3579,20 @@ zfs_rename(zfs_handle_t *zhp, const char return (zfs_error(hdl, EZFS_ZONED, errbuf)); } - if (recursive) { + /* + * Avoid unmounting file systems with mountpoint property set to + * 'legacy' or 'none' even if -u option is not given. + */ + if (zhp->zfs_type == ZFS_TYPE_FILESYSTEM && + !flags.recurse && !flags.nounmount && + zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, property, + sizeof (property), NULL, NULL, 0, B_FALSE) == 0 && + (strcmp(property, "legacy") == 0 || + strcmp(property, "none") == 0)) { + flags.nounmount = B_TRUE; + } + + if (flags.recurse) { parentname = zfs_strdup(zhp->zfs_hdl, zhp->zfs_name); if (parentname == NULL) { @@ -3592,8 +3608,10 @@ zfs_rename(zfs_handle_t *zhp, const char } } else { - if ((cl = changelist_gather(zhp, ZFS_PROP_NAME, 0, 0)) == NULL) + if ((cl = changelist_gather(zhp, ZFS_PROP_NAME, + flags.nounmount ? CL_GATHER_DONT_UNMOUNT : 0, 0)) == NULL) { return (-1); + } if (changelist_haszonedchild(cl)) { zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, @@ -3615,7 +3633,9 @@ zfs_rename(zfs_handle_t *zhp, const char (void) strlcpy(zc.zc_name, zhp->zfs_name, sizeof (zc.zc_name)); (void) strlcpy(zc.zc_value, target, sizeof (zc.zc_value)); - zc.zc_cookie = recursive; + zc.zc_cookie = flags.recurse ? 1 : 0; + if (flags.nounmount) + zc.zc_cookie |= 2; if ((ret = zfs_ioctl(zhp->zfs_hdl, ZFS_IOC_RENAME, &zc)) != 0) { /* @@ -3625,7 +3645,7 @@ zfs_rename(zfs_handle_t *zhp, const char (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN, "cannot rename '%s'"), zc.zc_name); - if (recursive && errno == EEXIST) { + if (flags.recurse && errno == EEXIST) { zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "a child dataset already has a snapshot " "with the new name")); @@ -3638,10 +3658,10 @@ zfs_rename(zfs_handle_t *zhp, const char * On failure, we still want to remount any filesystems that * were previously mounted, so we don't alter the system state. */ - if (!recursive) + if (!flags.recurse) (void) changelist_postfix(cl); } else { - if (!recursive) { + if (!flags.recurse) { changelist_rename(cl, zfs_get_name(zhp), target); ret = changelist_postfix(cl); } Modified: stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h ============================================================================== --- stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h Thu Jan 5 08:54:15 2012 (r229564) +++ stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h Thu Jan 5 09:37:31 2012 (r229565) @@ -21,6 +21,8 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011 Pawel Jakub Dawidek . + * All rights reserved. */ #ifndef _LIBFS_IMPL_H @@ -158,7 +160,11 @@ int zprop_expand_list(libzfs_handle_t *h * on each change node regardless of whether or not it is currently * mounted. */ -#define CL_GATHER_MOUNT_ALWAYS 1 +#define CL_GATHER_MOUNT_ALWAYS 0x01 +/* + * Use this changelist_gather() flag to prevent unmounting of file systems. + */ +#define CL_GATHER_DONT_UNMOUNT 0x02 typedef struct prop_changelist prop_changelist_t; Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Thu Jan 5 08:54:15 2012 (r229564) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Thu Jan 5 09:37:31 2012 (r229565) @@ -21,6 +21,8 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2011 Pawel Jakub Dawidek . + * All rights reserved. */ #include @@ -2461,7 +2463,7 @@ dsl_valid_rename(const char *oldname, vo #pragma weak dmu_objset_rename = dsl_dataset_rename int -dsl_dataset_rename(char *oldname, const char *newname, boolean_t recursive) +dsl_dataset_rename(char *oldname, const char *newname, int flags) { dsl_dir_t *dd; dsl_dataset_t *ds; @@ -2481,7 +2483,7 @@ dsl_dataset_rename(char *oldname, const &delta, DS_FIND_CHILDREN | DS_FIND_SNAPSHOTS); if (err == 0) - err = dsl_dir_rename(dd, newname); + err = dsl_dir_rename(dd, newname, flags); dsl_dir_close(dd, FTAG); return (err); } @@ -2502,7 +2504,7 @@ dsl_dataset_rename(char *oldname, const if (strncmp(oldname, newname, tail - newname) != 0) return (EXDEV); - if (recursive) { + if (flags & ZFS_RENAME_RECURSIVE) { err = dsl_recursive_rename(oldname, newname); } else { err = dsl_dataset_hold(oldname, FTAG, &ds); Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c Thu Jan 5 08:54:15 2012 (r229564) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c Thu Jan 5 09:37:31 2012 (r229565) @@ -20,6 +20,8 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011 Pawel Jakub Dawidek . + * All rights reserved. */ #include @@ -37,6 +39,9 @@ #include #include #include +#ifdef _KERNEL +#include +#endif #include "zfs_namecheck.h" static uint64_t dsl_dir_space_towrite(dsl_dir_t *dd); @@ -1245,6 +1250,7 @@ would_change(dsl_dir_t *dd, int64_t delt struct renamearg { dsl_dir_t *newparent; const char *mynewname; + boolean_t allowmounted; }; static int @@ -1263,9 +1269,12 @@ dsl_dir_rename_check(void *arg1, void *a * stats), but any that are present in open context will likely * be gone by syncing context, so only fail from syncing * context. + * Don't check if we allow renaming of busy (mounted) dataset. */ - if (dmu_tx_is_syncing(tx) && dmu_buf_refcount(dd->dd_dbuf) > 1) + if (!ra->allowmounted && dmu_tx_is_syncing(tx) && + dmu_buf_refcount(dd->dd_dbuf) > 1) { return (EBUSY); + } /* check for existing name */ err = zap_lookup(mos, ra->newparent->dd_phys->dd_child_dir_zapobj, @@ -1302,7 +1311,7 @@ dsl_dir_rename_sync(void *arg1, void *ar objset_t *mos = dp->dp_meta_objset; int err; - ASSERT(dmu_buf_refcount(dd->dd_dbuf) <= 2); + ASSERT(ra->allowmounted || dmu_buf_refcount(dd->dd_dbuf) <= 2); if (ra->newparent != dd->dd_parent) { dsl_dir_diduse_space(dd->dd_parent, DD_USED_CHILD, @@ -1345,6 +1354,7 @@ dsl_dir_rename_sync(void *arg1, void *ar ASSERT3U(err, ==, 0); dsl_dir_name(dd, newname); #ifdef _KERNEL + zfsvfs_update_fromname(oldname, newname); zvol_rename_minors(oldname, newname); #endif @@ -1353,7 +1363,7 @@ dsl_dir_rename_sync(void *arg1, void *ar } int -dsl_dir_rename(dsl_dir_t *dd, const char *newname) +dsl_dir_rename(dsl_dir_t *dd, const char *newname, int flags) { struct renamearg ra; int err; @@ -1375,6 +1385,8 @@ dsl_dir_rename(dsl_dir_t *dd, const char goto out; } + ra.allowmounted = !!(flags & ZFS_RENAME_ALLOW_MOUNTED); + err = dsl_sync_task_do(dd->dd_pool, dsl_dir_rename_check, dsl_dir_rename_sync, dd, &ra, 3); Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h Thu Jan 5 08:54:15 2012 (r229564) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h Thu Jan 5 09:37:31 2012 (r229565) @@ -20,6 +20,8 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011 Pawel Jakub Dawidek . + * All rights reserved. */ #ifndef _SYS_DSL_DATASET_H @@ -178,6 +180,12 @@ struct dsl_ds_holdarg { char failed[MAXPATHLEN]; }; +/* + * Flags for dsl_dataset_rename(). + */ +#define ZFS_RENAME_RECURSIVE 0x01 +#define ZFS_RENAME_ALLOW_MOUNTED 0x02 + #define dsl_dataset_is_snapshot(ds) \ ((ds)->ds_phys->ds_num_children != 0) @@ -211,7 +219,7 @@ dsl_syncfunc_t dsl_dataset_destroy_sync; dsl_checkfunc_t dsl_dataset_snapshot_check; dsl_syncfunc_t dsl_dataset_snapshot_sync; dsl_syncfunc_t dsl_dataset_user_hold_sync; -int dsl_dataset_rename(char *name, const char *newname, boolean_t recursive); +int dsl_dataset_rename(char *name, const char *newname, int flags); int dsl_dataset_promote(const char *name, char *conflsnap); int dsl_dataset_clone_swap(dsl_dataset_t *clone, dsl_dataset_t *origin_head, boolean_t force); Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dir.h ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dir.h Thu Jan 5 08:54:15 2012 (r229564) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dir.h Thu Jan 5 09:37:31 2012 (r229565) @@ -20,6 +20,8 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011 Pawel Jakub Dawidek . + * All rights reserved. */ #ifndef _SYS_DSL_DIR_H @@ -131,7 +133,7 @@ int dsl_dir_set_quota(const char *ddname uint64_t quota); int dsl_dir_set_reservation(const char *ddname, zprop_source_t source, uint64_t reservation); -int dsl_dir_rename(dsl_dir_t *dd, const char *newname); +int dsl_dir_rename(dsl_dir_t *dd, const char *newname, int flags); int dsl_dir_transfer_possible(dsl_dir_t *sdd, dsl_dir_t *tdd, uint64_t space); int dsl_dir_set_reservation_check(void *arg1, void *arg2, dmu_tx_t *tx); boolean_t dsl_dir_is_clone(dsl_dir_t *dd); Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h Thu Jan 5 08:54:15 2012 (r229564) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h Thu Jan 5 09:37:31 2012 (r229565) @@ -20,6 +20,8 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011 Pawel Jakub Dawidek . + * All rights reserved. */ #ifndef _SYS_FS_ZFS_VFSOPS_H @@ -153,6 +155,10 @@ extern void zfsvfs_free(zfsvfs_t *zfsvfs extern int zfs_check_global_label(const char *dsname, const char *hexsl); extern int zfs_vnode_lock(vnode_t *vp, int flags); +#ifdef _KERNEL +extern void zfsvfs_update_fromname(const char *oldname, const char *newname); +#endif + #ifdef __cplusplus } #endif Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Thu Jan 5 08:54:15 2012 (r229564) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Thu Jan 5 09:37:31 2012 (r229565) @@ -20,6 +20,8 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011 Pawel Jakub Dawidek . + * All rights reserved. */ /* @@ -785,7 +787,7 @@ zfsctl_snapdir_rename(vnode_t *sdvp, cha return (ENOENT); } - err = dmu_objset_rename(from, to, B_FALSE); + err = dmu_objset_rename(from, to, 0); if (err == 0) zfsctl_rename_snap(sdp, sep, tnm); Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Thu Jan 5 08:54:15 2012 (r229564) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Thu Jan 5 09:37:31 2012 (r229565) @@ -20,6 +20,8 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011 Pawel Jakub Dawidek . + * All rights reserved. * Portions Copyright 2011 Martin Matuska */ @@ -3262,7 +3264,12 @@ out: static int zfs_ioc_rename(zfs_cmd_t *zc) { - boolean_t recursive = zc->zc_cookie & 1; + int flags = 0; + + if (zc->zc_cookie & 1) + flags |= ZFS_RENAME_RECURSIVE; + if (zc->zc_cookie & 2) + flags |= ZFS_RENAME_ALLOW_MOUNTED; zc->zc_value[sizeof (zc->zc_value) - 1] = '\0'; if (dataset_namecheck(zc->zc_value, NULL, NULL) != 0 || @@ -3274,13 +3281,14 @@ zfs_ioc_rename(zfs_cmd_t *zc) * in which case the dataset code figures out which snapshots * to unmount. */ - if (!recursive && strchr(zc->zc_name, '@') != NULL && + if (!(flags & ZFS_RENAME_RECURSIVE) && + strchr(zc->zc_name, '@') != NULL && zc->zc_objset_type == DMU_OST_ZFS) { int err = zfs_unmount_snap(zc->zc_name, NULL); if (err) return (err); } - return (dmu_objset_rename(zc->zc_name, zc->zc_value, recursive)); + return (dmu_objset_rename(zc->zc_name, zc->zc_value, flags)); } static int Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Thu Jan 5 08:54:15 2012 (r229564) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Thu Jan 5 09:37:31 2012 (r229565) @@ -20,6 +20,8 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011 Pawel Jakub Dawidek . + * All rights reserved. */ /* Portions Copyright 2010 Robert Milkowski */ @@ -2416,3 +2418,35 @@ zfs_get_zplprop(objset_t *os, zfs_prop_t } return (error); } + +#ifdef _KERNEL +void +zfsvfs_update_fromname(const char *oldname, const char *newname) +{ + char tmpbuf[MAXPATHLEN]; + struct mount *mp; + char *fromname; + size_t oldlen; + + oldlen = strlen(oldname); + + mtx_lock(&mountlist_mtx); + TAILQ_FOREACH(mp, &mountlist, mnt_list) { + fromname = mp->mnt_stat.f_mntfromname; + if (strcmp(fromname, oldname) == 0) { + (void)strlcpy(fromname, newname, + sizeof(mp->mnt_stat.f_mntfromname)); + continue; + } + if (strncmp(fromname, oldname, oldlen) == 0 && + (fromname[oldlen] == '/' || fromname[oldlen] == '@')) { + (void)snprintf(tmpbuf, sizeof(tmpbuf), "%s%s", + newname, fromname + oldlen); + (void)strlcpy(fromname, tmpbuf, + sizeof(mp->mnt_stat.f_mntfromname)); + continue; + } + } + mtx_unlock(&mountlist_mtx); +} +#endif From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 09:39:30 2012 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 4D4EE106566B; Thu, 5 Jan 2012 09:39:30 +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 3350A8FC0A; Thu, 5 Jan 2012 09:39:30 +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 q059dUvU024547; Thu, 5 Jan 2012 09:39:30 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q059dTr7024532; Thu, 5 Jan 2012 09:39:29 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201050939.q059dTr7024532@svn.freebsd.org> From: Martin Matuska Date: Thu, 5 Jan 2012 09:39:29 +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: r229566 - in stable/8: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common... 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, 05 Jan 2012 09:39:30 -0000 Author: mm Date: Thu Jan 5 09:39:29 2012 New Revision: 229566 URL: http://svn.freebsd.org/changeset/base/229566 Log: MFC r226676, r226678, r226700, r226705, r226706, r226707: MFC r226676 (pjd): Allow to rename file systems without remounting if it is possible. It is possible for file systems with 'mountpoint' preperty set to 'legacy' or 'none' - we don't have to change mount directory for them. Currently such file systems are unmounted on rename and not even mounted back. This introduces layering violation, as we need to update 'f_mntfromname' field in statfs structure related to mountpoint (for the dataset we are renaming and all its children). In my opinion it is worth it, as it allow to update FreeBSD in even cleaner way - in ZFS-only configuration root file system is ZFS file system with 'mountpoint' property set to 'legacy'. If root dataset is named system/rootfs, we can snapshot it (system/rootfs@upgrade), clone it (system/oldrootfs), update FreeBSD and if it doesn't boot we can boot back from system/oldrootfs and rename it back to system/rootfs while it is mounted as /. Before it was not possible, because unmounting / was not possible. MFC r227768 (pjd): Include only when compiling kernel module. MFC r226700 (pjd): Don't forget to rename mounted snapshots of the file system being renamed. MFC r226705 (pjd): Extend r226676 to allow rename without unmount even for file systems with non-legacy mountpoints. It is better to be able to rename such file systems and let them be mounted in old places until next reboot than using live CD, etc. to rename with remount. This is implemented by adding -u option to 'zfs rename'. If file system's mountpoint property is set to 'legacy' or 'none', there is no need to specify -u. Update zfs(8) manual page to reflect this addition. MFC r226706 (pjd): Update copyright to include myself. MFC r226707 (pjd): - Use better naming now that we allow to rename any mounted file system (not only legacy). - Update copyright to include myself. Approved by: pjd Modified: stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs.8 stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dir.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) stable/8/sys/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Jan 5 09:37:31 2012 (r229565) +++ stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Jan 5 09:39:29 2012 (r229566) @@ -76,6 +76,11 @@ zfs \- configures ZFS file systems .LP .nf +\fBzfs\fR \fBrename\fR \fB-u\fR [\fB-p\fR] \fIfilesystem\fR \fIfilesystem\fR +.fi + +.LP +.nf \fBzfs\fR \fBlist\fR [\fB-r\fR|\fB-d\fR \fIdepth\fR][\fB-H\fR][\fB-o\fR \fIproperty\fR[,...]] [\fB-t\fR \fItype\fR[,...]] [\fB-s\fR \fIproperty\fR] ... [\fB-S\fR \fIproperty\fR] ... [\fIfilesystem\fR|\fIvolume\fR|\fIsnapshot\fR] ... .fi @@ -1479,6 +1484,10 @@ The snapshot that was cloned, and any sn .na \fB\fBzfs rename\fR [\fB-p\fR] \fIfilesystem\fR|\fIvolume\fR \fIfilesystem\fR|\fIvolume\fR\fR .ad +.br +.na +\fB\fBzfs rename\fR \fB-u\fR [\fB-p\fR] \fIfilesystem\fR \fIfilesystem\fR\fR +.ad .sp .6 .RS 4n Renames the given dataset. The new target can be located anywhere in the \fBZFS\fR hierarchy, with the exception of snapshots. Snapshots can only be renamed within the parent file system or volume. When renaming a snapshot, the parent file system of the snapshot does not need to be specified as part of the second argument. Renamed file systems can inherit new mount points, in which case they are unmounted and remounted at the new mount point. @@ -1493,6 +1502,17 @@ Renames the given dataset. The new targe Creates all the nonexistent parent datasets. Datasets created in this manner are automatically mounted according to the \fBmountpoint\fR property inherited from their parent. .RE +.sp +.ne 2 +.mk +.na +\fB\fB-u\fR\fR +.ad +.sp .6 +.RS 4n +Do not remount file systems during rename. If a file system's \fBmountpoint\fR property is set to \fBlegacy\fR or \fBnone\fR, file system is not unmounted even if this option is not given. +.RE + .RE .sp Modified: stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Thu Jan 5 09:37:31 2012 (r229565) +++ stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Thu Jan 5 09:39:29 2012 (r229566) @@ -22,6 +22,8 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + * Copyright (c) 2011 Pawel Jakub Dawidek . + * All rights reserved. */ #include @@ -253,7 +255,8 @@ get_usage(zfs_help_t idx) return (gettext("\trename " "\n" "\trename -p \n" - "\trename -r ")); + "\trename -r \n" + "\trename -u [-p] ")); case HELP_ROLLBACK: return (gettext("\trollback [-rRf] \n")); case HELP_SEND: @@ -2852,6 +2855,7 @@ zfs_do_list(int argc, char **argv) * zfs rename * zfs rename -p * zfs rename -r + * zfs rename -u [-p] * * Renames the given dataset to another of the same type. * @@ -2862,19 +2866,21 @@ static int zfs_do_rename(int argc, char **argv) { zfs_handle_t *zhp; - int c; - int ret; - boolean_t recurse = B_FALSE; + renameflags_t flags = { 0 }; + int c, ret, types; boolean_t parents = B_FALSE; /* check options */ - while ((c = getopt(argc, argv, "pr")) != -1) { + while ((c = getopt(argc, argv, "pru")) != -1) { switch (c) { case 'p': parents = B_TRUE; break; case 'r': - recurse = B_TRUE; + flags.recurse = B_TRUE; + break; + case 'u': + flags.nounmount = B_TRUE; break; case '?': default: @@ -2903,20 +2909,32 @@ zfs_do_rename(int argc, char **argv) usage(B_FALSE); } - if (recurse && parents) { + if (flags.recurse && parents) { (void) fprintf(stderr, gettext("-p and -r options are mutually " "exclusive\n")); usage(B_FALSE); } - if (recurse && strchr(argv[0], '@') == 0) { + if (flags.recurse && strchr(argv[0], '@') == 0) { (void) fprintf(stderr, gettext("source dataset for recursive " "rename must be a snapshot\n")); usage(B_FALSE); } - if ((zhp = zfs_open(g_zfs, argv[0], parents ? ZFS_TYPE_FILESYSTEM | - ZFS_TYPE_VOLUME : ZFS_TYPE_DATASET)) == NULL) + if (flags.nounmount && parents) { + (void) fprintf(stderr, gettext("-u and -r options are mutually " + "exclusive\n")); + usage(B_FALSE); + } + + if (flags.nounmount) + types = ZFS_TYPE_FILESYSTEM; + else if (parents) + types = ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME; + else + types = ZFS_TYPE_DATASET; + + if ((zhp = zfs_open(g_zfs, argv[0], types)) == NULL) return (1); /* If we were asked and the name looks good, try to create ancestors. */ @@ -2926,7 +2944,7 @@ zfs_do_rename(int argc, char **argv) return (1); } - ret = (zfs_rename(zhp, argv[1], recurse) != 0); + ret = (zfs_rename(zhp, argv[1], flags) != 0); zfs_close(zhp); return (ret); Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Thu Jan 5 09:37:31 2012 (r229565) +++ stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Thu Jan 5 09:39:29 2012 (r229566) @@ -22,6 +22,8 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2010 Nexenta Systems, Inc. All rights reserved. + * Copyright (c) 2011 Pawel Jakub Dawidek . + * All rights reserved. */ #ifndef _LIBZFS_H @@ -517,7 +519,16 @@ extern int zfs_destroy_snaps(zfs_handle_ extern int zfs_clone(zfs_handle_t *, const char *, nvlist_t *); extern int zfs_snapshot(libzfs_handle_t *, const char *, boolean_t, nvlist_t *); extern int zfs_rollback(zfs_handle_t *, zfs_handle_t *, boolean_t); -extern int zfs_rename(zfs_handle_t *, const char *, boolean_t); + +typedef struct renameflags { + /* recursive rename */ + int recurse : 1; + + /* don't unmount file systems */ + int nounmount : 1; +} renameflags_t; + +extern int zfs_rename(zfs_handle_t *, const char *, renameflags_t flags); typedef struct sendflags { /* print informational messages (ie, -v was specified) */ Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c Thu Jan 5 09:37:31 2012 (r229565) +++ stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c Thu Jan 5 09:39:29 2012 (r229566) @@ -24,6 +24,9 @@ * Use is subject to license terms. * * Portions Copyright 2007 Ramprakash Jelari + * + * Copyright (c) 2011 Pawel Jakub Dawidek . + * All rights reserved. */ #include @@ -122,6 +125,8 @@ changelist_prefix(prop_changelist_t *clp */ switch (clp->cl_prop) { case ZFS_PROP_MOUNTPOINT: + if (clp->cl_gflags & CL_GATHER_DONT_UNMOUNT) + break; if (zfs_unmount(cn->cn_handle, NULL, clp->cl_mflags) != 0) { ret = -1; @@ -168,8 +173,10 @@ changelist_postfix(prop_changelist_t *cl if ((cn = uu_list_last(clp->cl_list)) == NULL) return (0); - if (clp->cl_prop == ZFS_PROP_MOUNTPOINT) + if (clp->cl_prop == ZFS_PROP_MOUNTPOINT && + !(clp->cl_gflags & CL_GATHER_DONT_UNMOUNT)) { remove_mountpoint(cn->cn_handle); + } /* * It is possible that the changelist_prefix() used libshare @@ -224,7 +231,8 @@ changelist_postfix(prop_changelist_t *cl shareopts, sizeof (shareopts), NULL, NULL, 0, B_FALSE) == 0) && (strcmp(shareopts, "off") != 0)); - mounted = zfs_is_mounted(cn->cn_handle, NULL); + mounted = (clp->cl_gflags & CL_GATHER_DONT_UNMOUNT) || + zfs_is_mounted(cn->cn_handle, NULL); if (!mounted && (cn->cn_mounted || ((sharenfs || sharesmb || clp->cl_waslegacy) && Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Thu Jan 5 09:37:31 2012 (r229565) +++ stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Thu Jan 5 09:39:29 2012 (r229566) @@ -23,6 +23,8 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2010 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2011 Pawel Jakub Dawidek . + * All rights reserved. */ #include @@ -3480,7 +3482,7 @@ zfs_iter_dependents(zfs_handle_t *zhp, b * Renames the given dataset. */ int -zfs_rename(zfs_handle_t *zhp, const char *target, boolean_t recursive) +zfs_rename(zfs_handle_t *zhp, const char *target, renameflags_t flags) { int ret; zfs_cmd_t zc = { 0 }; @@ -3489,6 +3491,7 @@ zfs_rename(zfs_handle_t *zhp, const char zfs_handle_t *zhrp = NULL; char *parentname = NULL; char parent[ZFS_MAXNAMELEN]; + char property[ZFS_MAXPROPLEN]; libzfs_handle_t *hdl = zhp->zfs_hdl; char errbuf[1024]; @@ -3535,7 +3538,7 @@ zfs_rename(zfs_handle_t *zhp, const char if (!zfs_validate_name(hdl, target, zhp->zfs_type, B_TRUE)) return (zfs_error(hdl, EZFS_INVALIDNAME, errbuf)); } else { - if (recursive) { + if (flags.recurse) { zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "recursive rename must be a snapshot")); return (zfs_error(hdl, EZFS_BADTYPE, errbuf)); @@ -3576,7 +3579,20 @@ zfs_rename(zfs_handle_t *zhp, const char return (zfs_error(hdl, EZFS_ZONED, errbuf)); } - if (recursive) { + /* + * Avoid unmounting file systems with mountpoint property set to + * 'legacy' or 'none' even if -u option is not given. + */ + if (zhp->zfs_type == ZFS_TYPE_FILESYSTEM && + !flags.recurse && !flags.nounmount && + zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, property, + sizeof (property), NULL, NULL, 0, B_FALSE) == 0 && + (strcmp(property, "legacy") == 0 || + strcmp(property, "none") == 0)) { + flags.nounmount = B_TRUE; + } + + if (flags.recurse) { parentname = zfs_strdup(zhp->zfs_hdl, zhp->zfs_name); if (parentname == NULL) { @@ -3592,8 +3608,10 @@ zfs_rename(zfs_handle_t *zhp, const char } } else { - if ((cl = changelist_gather(zhp, ZFS_PROP_NAME, 0, 0)) == NULL) + if ((cl = changelist_gather(zhp, ZFS_PROP_NAME, + flags.nounmount ? CL_GATHER_DONT_UNMOUNT : 0, 0)) == NULL) { return (-1); + } if (changelist_haszonedchild(cl)) { zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, @@ -3615,7 +3633,9 @@ zfs_rename(zfs_handle_t *zhp, const char (void) strlcpy(zc.zc_name, zhp->zfs_name, sizeof (zc.zc_name)); (void) strlcpy(zc.zc_value, target, sizeof (zc.zc_value)); - zc.zc_cookie = recursive; + zc.zc_cookie = flags.recurse ? 1 : 0; + if (flags.nounmount) + zc.zc_cookie |= 2; if ((ret = zfs_ioctl(zhp->zfs_hdl, ZFS_IOC_RENAME, &zc)) != 0) { /* @@ -3625,7 +3645,7 @@ zfs_rename(zfs_handle_t *zhp, const char (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN, "cannot rename '%s'"), zc.zc_name); - if (recursive && errno == EEXIST) { + if (flags.recurse && errno == EEXIST) { zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "a child dataset already has a snapshot " "with the new name")); @@ -3638,10 +3658,10 @@ zfs_rename(zfs_handle_t *zhp, const char * On failure, we still want to remount any filesystems that * were previously mounted, so we don't alter the system state. */ - if (!recursive) + if (!flags.recurse) (void) changelist_postfix(cl); } else { - if (!recursive) { + if (!flags.recurse) { changelist_rename(cl, zfs_get_name(zhp), target); ret = changelist_postfix(cl); } Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h ============================================================================== --- stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h Thu Jan 5 09:37:31 2012 (r229565) +++ stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h Thu Jan 5 09:39:29 2012 (r229566) @@ -21,6 +21,8 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011 Pawel Jakub Dawidek . + * All rights reserved. */ #ifndef _LIBFS_IMPL_H @@ -158,7 +160,11 @@ int zprop_expand_list(libzfs_handle_t *h * on each change node regardless of whether or not it is currently * mounted. */ -#define CL_GATHER_MOUNT_ALWAYS 1 +#define CL_GATHER_MOUNT_ALWAYS 0x01 +/* + * Use this changelist_gather() flag to prevent unmounting of file systems. + */ +#define CL_GATHER_DONT_UNMOUNT 0x02 typedef struct prop_changelist prop_changelist_t; Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Thu Jan 5 09:37:31 2012 (r229565) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Thu Jan 5 09:39:29 2012 (r229566) @@ -21,6 +21,8 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2011 Pawel Jakub Dawidek . + * All rights reserved. */ #include @@ -2461,7 +2463,7 @@ dsl_valid_rename(const char *oldname, vo #pragma weak dmu_objset_rename = dsl_dataset_rename int -dsl_dataset_rename(char *oldname, const char *newname, boolean_t recursive) +dsl_dataset_rename(char *oldname, const char *newname, int flags) { dsl_dir_t *dd; dsl_dataset_t *ds; @@ -2481,7 +2483,7 @@ dsl_dataset_rename(char *oldname, const &delta, DS_FIND_CHILDREN | DS_FIND_SNAPSHOTS); if (err == 0) - err = dsl_dir_rename(dd, newname); + err = dsl_dir_rename(dd, newname, flags); dsl_dir_close(dd, FTAG); return (err); } @@ -2502,7 +2504,7 @@ dsl_dataset_rename(char *oldname, const if (strncmp(oldname, newname, tail - newname) != 0) return (EXDEV); - if (recursive) { + if (flags & ZFS_RENAME_RECURSIVE) { err = dsl_recursive_rename(oldname, newname); } else { err = dsl_dataset_hold(oldname, FTAG, &ds); Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c Thu Jan 5 09:37:31 2012 (r229565) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c Thu Jan 5 09:39:29 2012 (r229566) @@ -20,6 +20,8 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011 Pawel Jakub Dawidek . + * All rights reserved. */ #include @@ -37,6 +39,9 @@ #include #include #include +#ifdef _KERNEL +#include +#endif #include "zfs_namecheck.h" static uint64_t dsl_dir_space_towrite(dsl_dir_t *dd); @@ -1245,6 +1250,7 @@ would_change(dsl_dir_t *dd, int64_t delt struct renamearg { dsl_dir_t *newparent; const char *mynewname; + boolean_t allowmounted; }; static int @@ -1263,9 +1269,12 @@ dsl_dir_rename_check(void *arg1, void *a * stats), but any that are present in open context will likely * be gone by syncing context, so only fail from syncing * context. + * Don't check if we allow renaming of busy (mounted) dataset. */ - if (dmu_tx_is_syncing(tx) && dmu_buf_refcount(dd->dd_dbuf) > 1) + if (!ra->allowmounted && dmu_tx_is_syncing(tx) && + dmu_buf_refcount(dd->dd_dbuf) > 1) { return (EBUSY); + } /* check for existing name */ err = zap_lookup(mos, ra->newparent->dd_phys->dd_child_dir_zapobj, @@ -1302,7 +1311,7 @@ dsl_dir_rename_sync(void *arg1, void *ar objset_t *mos = dp->dp_meta_objset; int err; - ASSERT(dmu_buf_refcount(dd->dd_dbuf) <= 2); + ASSERT(ra->allowmounted || dmu_buf_refcount(dd->dd_dbuf) <= 2); if (ra->newparent != dd->dd_parent) { dsl_dir_diduse_space(dd->dd_parent, DD_USED_CHILD, @@ -1345,6 +1354,7 @@ dsl_dir_rename_sync(void *arg1, void *ar ASSERT3U(err, ==, 0); dsl_dir_name(dd, newname); #ifdef _KERNEL + zfsvfs_update_fromname(oldname, newname); zvol_rename_minors(oldname, newname); #endif @@ -1353,7 +1363,7 @@ dsl_dir_rename_sync(void *arg1, void *ar } int -dsl_dir_rename(dsl_dir_t *dd, const char *newname) +dsl_dir_rename(dsl_dir_t *dd, const char *newname, int flags) { struct renamearg ra; int err; @@ -1375,6 +1385,8 @@ dsl_dir_rename(dsl_dir_t *dd, const char goto out; } + ra.allowmounted = !!(flags & ZFS_RENAME_ALLOW_MOUNTED); + err = dsl_sync_task_do(dd->dd_pool, dsl_dir_rename_check, dsl_dir_rename_sync, dd, &ra, 3); Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h Thu Jan 5 09:37:31 2012 (r229565) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h Thu Jan 5 09:39:29 2012 (r229566) @@ -20,6 +20,8 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011 Pawel Jakub Dawidek . + * All rights reserved. */ #ifndef _SYS_DSL_DATASET_H @@ -178,6 +180,12 @@ struct dsl_ds_holdarg { char failed[MAXPATHLEN]; }; +/* + * Flags for dsl_dataset_rename(). + */ +#define ZFS_RENAME_RECURSIVE 0x01 +#define ZFS_RENAME_ALLOW_MOUNTED 0x02 + #define dsl_dataset_is_snapshot(ds) \ ((ds)->ds_phys->ds_num_children != 0) @@ -211,7 +219,7 @@ dsl_syncfunc_t dsl_dataset_destroy_sync; dsl_checkfunc_t dsl_dataset_snapshot_check; dsl_syncfunc_t dsl_dataset_snapshot_sync; dsl_syncfunc_t dsl_dataset_user_hold_sync; -int dsl_dataset_rename(char *name, const char *newname, boolean_t recursive); +int dsl_dataset_rename(char *name, const char *newname, int flags); int dsl_dataset_promote(const char *name, char *conflsnap); int dsl_dataset_clone_swap(dsl_dataset_t *clone, dsl_dataset_t *origin_head, boolean_t force); Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dir.h ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dir.h Thu Jan 5 09:37:31 2012 (r229565) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dir.h Thu Jan 5 09:39:29 2012 (r229566) @@ -20,6 +20,8 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011 Pawel Jakub Dawidek . + * All rights reserved. */ #ifndef _SYS_DSL_DIR_H @@ -131,7 +133,7 @@ int dsl_dir_set_quota(const char *ddname uint64_t quota); int dsl_dir_set_reservation(const char *ddname, zprop_source_t source, uint64_t reservation); -int dsl_dir_rename(dsl_dir_t *dd, const char *newname); +int dsl_dir_rename(dsl_dir_t *dd, const char *newname, int flags); int dsl_dir_transfer_possible(dsl_dir_t *sdd, dsl_dir_t *tdd, uint64_t space); int dsl_dir_set_reservation_check(void *arg1, void *arg2, dmu_tx_t *tx); boolean_t dsl_dir_is_clone(dsl_dir_t *dd); Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h Thu Jan 5 09:37:31 2012 (r229565) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h Thu Jan 5 09:39:29 2012 (r229566) @@ -20,6 +20,8 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011 Pawel Jakub Dawidek . + * All rights reserved. */ #ifndef _SYS_FS_ZFS_VFSOPS_H @@ -153,6 +155,10 @@ extern void zfsvfs_free(zfsvfs_t *zfsvfs extern int zfs_check_global_label(const char *dsname, const char *hexsl); extern int zfs_vnode_lock(vnode_t *vp, int flags); +#ifdef _KERNEL +extern void zfsvfs_update_fromname(const char *oldname, const char *newname); +#endif + #ifdef __cplusplus } #endif Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Thu Jan 5 09:37:31 2012 (r229565) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Thu Jan 5 09:39:29 2012 (r229566) @@ -20,6 +20,8 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011 Pawel Jakub Dawidek . + * All rights reserved. */ /* @@ -785,7 +787,7 @@ zfsctl_snapdir_rename(vnode_t *sdvp, cha return (ENOENT); } - err = dmu_objset_rename(from, to, B_FALSE); + err = dmu_objset_rename(from, to, 0); if (err == 0) zfsctl_rename_snap(sdp, sep, tnm); Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Thu Jan 5 09:37:31 2012 (r229565) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Thu Jan 5 09:39:29 2012 (r229566) @@ -20,6 +20,8 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011 Pawel Jakub Dawidek . + * All rights reserved. * Portions Copyright 2011 Martin Matuska */ @@ -3262,7 +3264,12 @@ out: static int zfs_ioc_rename(zfs_cmd_t *zc) { - boolean_t recursive = zc->zc_cookie & 1; + int flags = 0; + + if (zc->zc_cookie & 1) + flags |= ZFS_RENAME_RECURSIVE; + if (zc->zc_cookie & 2) + flags |= ZFS_RENAME_ALLOW_MOUNTED; zc->zc_value[sizeof (zc->zc_value) - 1] = '\0'; if (dataset_namecheck(zc->zc_value, NULL, NULL) != 0 || @@ -3274,13 +3281,14 @@ zfs_ioc_rename(zfs_cmd_t *zc) * in which case the dataset code figures out which snapshots * to unmount. */ - if (!recursive && strchr(zc->zc_name, '@') != NULL && + if (!(flags & ZFS_RENAME_RECURSIVE) && + strchr(zc->zc_name, '@') != NULL && zc->zc_objset_type == DMU_OST_ZFS) { int err = zfs_unmount_snap(zc->zc_name, NULL); if (err) return (err); } - return (dmu_objset_rename(zc->zc_name, zc->zc_value, recursive)); + return (dmu_objset_rename(zc->zc_name, zc->zc_value, flags)); } static int Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Thu Jan 5 09:37:31 2012 (r229565) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Thu Jan 5 09:39:29 2012 (r229566) @@ -20,6 +20,8 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011 Pawel Jakub Dawidek . + * All rights reserved. */ /* Portions Copyright 2010 Robert Milkowski */ @@ -2416,3 +2418,35 @@ zfs_get_zplprop(objset_t *os, zfs_prop_t } return (error); } + +#ifdef _KERNEL +void +zfsvfs_update_fromname(const char *oldname, const char *newname) +{ + char tmpbuf[MAXPATHLEN]; + struct mount *mp; + char *fromname; + size_t oldlen; + + oldlen = strlen(oldname); + + mtx_lock(&mountlist_mtx); + TAILQ_FOREACH(mp, &mountlist, mnt_list) { + fromname = mp->mnt_stat.f_mntfromname; + if (strcmp(fromname, oldname) == 0) { + (void)strlcpy(fromname, newname, + sizeof(mp->mnt_stat.f_mntfromname)); + continue; + } + if (strncmp(fromname, oldname, oldlen) == 0 && + (fromname[oldlen] == '/' || fromname[oldlen] == '@')) { + (void)snprintf(tmpbuf, sizeof(tmpbuf), "%s%s", + newname, fromname + oldlen); + (void)strlcpy(fromname, tmpbuf, + sizeof(mp->mnt_stat.f_mntfromname)); + continue; + } + } + mtx_unlock(&mountlist_mtx); +} +#endif From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 09:50:47 2012 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 B71C3106564A; Thu, 5 Jan 2012 09:50:47 +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 A01D28FC0C; Thu, 5 Jan 2012 09:50:47 +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 q059olYe025010; Thu, 5 Jan 2012 09:50:47 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q059olU0025008; Thu, 5 Jan 2012 09:50:47 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201050950.q059olU0025008@svn.freebsd.org> From: Martin Matuska Date: Thu, 5 Jan 2012 09:50:47 +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: r229567 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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, 05 Jan 2012 09:50:47 -0000 Author: mm Date: Thu Jan 5 09:50:47 2012 New Revision: 229567 URL: http://svn.freebsd.org/changeset/base/229567 Log: MFC r227110, r227111: MFC r227110 (pjd) [1]: In zvol_open() if the spa_namespace_lock is already held, it means that ZFS is trying to open and taste ZVOL as its VDEV. This is not supported, so return an error instead of panicing on spa_namespace_lock recursion. MFC r227111 (pjd) [2]: Correct typo in comment. PR: kern/162008 Reported by: Robert Millan [1] Fabian Keil [2] Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Thu Jan 5 09:39:29 2012 (r229566) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Thu Jan 5 09:50:47 2012 (r229567) @@ -875,6 +875,14 @@ zvol_open(struct g_provider *pp, int fla zvol_state_t *zv; int err = 0; + if (MUTEX_HELD(&spa_namespace_lock)) { + /* + * If the spa_namespace_lock is being held, it means that ZFS + * is trying to open ZVOL as its VDEV. This is not supported. + */ + return (EOPNOTSUPP); + } + mutex_enter(&spa_namespace_lock); zv = pp->private; From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 10:03:15 2012 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 3D25D106564A; Thu, 5 Jan 2012 10:03:15 +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 0C1828FC0A; Thu, 5 Jan 2012 10:03: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 q05A3Elm025576; Thu, 5 Jan 2012 10:03:14 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05A3EeZ025572; Thu, 5 Jan 2012 10:03:14 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201051003.q05A3EeZ025572@svn.freebsd.org> From: Martin Matuska Date: Thu, 5 Jan 2012 10:03:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229568 - stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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, 05 Jan 2012 10:03:15 -0000 Author: mm Date: Thu Jan 5 10:03:14 2012 New Revision: 229568 URL: http://svn.freebsd.org/changeset/base/229568 Log: MFC r228363, r228392: MFC r228363 (pjd): The vfs.zfs.txg.timeout sysctl can be safely modified at run time. MFC r228392 (pjd) [1]: Move ru_inblock increment into arc_read_nolock() so we don't account for cached reads. Discussed with: gibbs No objections from: avg Tested by: Marcus Reid [1] Approved by: pjd Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Thu Jan 5 09:50:47 2012 (r229567) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Thu Jan 5 10:03:14 2012 (r229568) @@ -3103,6 +3103,9 @@ top: ARCSTAT_CONDSTAT(!(hdr->b_flags & ARC_PREFETCH), demand, prefetch, hdr->b_type != ARC_BUFC_METADATA, data, metadata, misses); +#ifdef _KERNEL + curthread->td_ru.ru_inblock++; +#endif if (vd != NULL && l2arc_ndev != 0 && !(l2arc_norw && devw)) { /* Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Thu Jan 5 09:50:47 2012 (r229567) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Thu Jan 5 10:03:14 2012 (r229568) @@ -627,10 +627,6 @@ dbuf_read(dmu_buf_impl_t *db, zio_t *zio } else if (db->db_state == DB_UNCACHED) { spa_t *spa = dn->dn_objset->os_spa; -#ifdef _KERNEL - curthread->td_ru.ru_inblock++; -#endif - if (zio == NULL) zio = zio_root(spa, NULL, NULL, ZIO_FLAG_CANFAIL); dbuf_read_impl(db, zio, &flags); Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c Thu Jan 5 09:50:47 2012 (r229567) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c Thu Jan 5 10:03:14 2012 (r229568) @@ -43,7 +43,7 @@ int zfs_txg_timeout = 5; /* max seconds SYSCTL_DECL(_vfs_zfs); SYSCTL_NODE(_vfs_zfs, OID_AUTO, txg, CTLFLAG_RW, 0, "ZFS TXG"); TUNABLE_INT("vfs.zfs.txg.timeout", &zfs_txg_timeout); -SYSCTL_INT(_vfs_zfs_txg, OID_AUTO, timeout, CTLFLAG_RDTUN, &zfs_txg_timeout, 0, +SYSCTL_INT(_vfs_zfs_txg, OID_AUTO, timeout, CTLFLAG_RW, &zfs_txg_timeout, 0, "Maximum seconds worth of delta per txg"); /* From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 10:09:23 2012 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 9F8E11065677; Thu, 5 Jan 2012 10:09:23 +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 6F09B8FC08; Thu, 5 Jan 2012 10:09: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 q05A9NZw025829; Thu, 5 Jan 2012 10:09:23 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05A9NeQ025826; Thu, 5 Jan 2012 10:09:23 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201051009.q05A9NeQ025826@svn.freebsd.org> From: Martin Matuska Date: Thu, 5 Jan 2012 10:09:23 +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: r229569 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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, 05 Jan 2012 10:09:23 -0000 Author: mm Date: Thu Jan 5 10:09:22 2012 New Revision: 229569 URL: http://svn.freebsd.org/changeset/base/229569 Log: MFC r226620, r228392: MFC r226620 (pjd): Update per-thread I/O statistics collection in ZFS. This allows to see processes I/O activity in 'top -m io' output. MFC r228392 (pjd): Move ru_inblock increment into arc_read_nolock() so we don't account for cached reads. PR: kern/156218 Reported by: Marcus Reid Patch by: avg Approved by: pjd Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Thu Jan 5 10:03:14 2012 (r229568) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Thu Jan 5 10:09:22 2012 (r229569) @@ -3103,6 +3103,9 @@ top: ARCSTAT_CONDSTAT(!(hdr->b_flags & ARC_PREFETCH), demand, prefetch, hdr->b_type != ARC_BUFC_METADATA, data, metadata, misses); +#ifdef _KERNEL + curthread->td_ru.ru_inblock++; +#endif if (vd != NULL && l2arc_ndev != 0 && !(l2arc_norw && devw)) { /* Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Thu Jan 5 10:03:14 2012 (r229568) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c Thu Jan 5 10:09:22 2012 (r229569) @@ -397,9 +397,12 @@ dmu_buf_hold_array_by_dnode(dnode_t *dn, return (EIO); } /* initiate async i/o */ - if (read) { + if (read) (void) dbuf_read(db, zio, dbuf_flags); - } +#ifdef _KERNEL + else + curthread->td_ru.ru_oublock++; +#endif dbp[i] = &db->db; } rw_exit(&dn->dn_struct_rwlock); From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 10:24:07 2012 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 76EA6106566C; Thu, 5 Jan 2012 10:24:07 +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 5F8DE8FC14; Thu, 5 Jan 2012 10:24: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 q05AO7Sp026472; Thu, 5 Jan 2012 10:24:07 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05AO76V026468; Thu, 5 Jan 2012 10:24:07 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201051024.q05AO76V026468@svn.freebsd.org> From: Martin Matuska Date: Thu, 5 Jan 2012 10:24:07 +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: r229570 - in stable/8/cddl/contrib/opensolaris: cmd/zpool lib/libzfs/common 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, 05 Jan 2012 10:24:07 -0000 Author: mm Date: Thu Jan 5 10:24:06 2012 New Revision: 229570 URL: http://svn.freebsd.org/changeset/base/229570 Log: MFC r224171 (gibbs): Add the "zpool labelclear" command. This command can be used to wipe the label data from a drive that is not active in a pool. The optional "-f" argument can be used to treat an exported or foreign vdev as "inactive" thus allowing its label information to be cleared. Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Thu Jan 5 10:09:22 2012 (r229569) +++ stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Thu Jan 5 10:24:06 2012 (r229570) @@ -82,6 +82,11 @@ zpool \- configures ZFS storage pools .LP .nf +\fBzpool labelclear\fR [\fB-f\fR] \fIdevice\fR +.fi + +.LP +.nf \fBzpool list\fR [\fB-H\fR] [\fB-o\fR \fIproperty\fR[,...]] [\fIpool\fR] ... .fi @@ -1205,6 +1210,28 @@ Verbose statistics. Reports usage statis .ne 2 .mk .na +\fB\fBzpool labelclear\fR [\fB-f\fR] \fIdevice\fR +.ad +.sp .6 +.RS 4n +Removes ZFS label information from the specified device. The device must not be part of an active pool configuration. +.sp +.ne 2 +.mk +.na +\fB\fB-f\fR\fR +.ad +.RS 12n +.rt +Treat exported or foreign devices as inactive. +.RE + +.RE + +.sp +.ne 2 +.mk +.na \fB\fBzpool list\fR [\fB-H\fR] [\fB-o\fR \fIprops\fR[,...]] [\fIpool\fR] ...\fR .ad .sp .6 Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Jan 5 10:09:22 2012 (r229569) +++ stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Jan 5 10:24:06 2012 (r229570) @@ -58,6 +58,7 @@ static int zpool_do_destroy(int, char ** static int zpool_do_add(int, char **); static int zpool_do_remove(int, char **); +static int zpool_do_labelclear(int, char **); static int zpool_do_list(int, char **); static int zpool_do_iostat(int, char **); @@ -114,6 +115,7 @@ typedef enum { HELP_HISTORY, HELP_IMPORT, HELP_IOSTAT, + HELP_LABELCLEAR, HELP_LIST, HELP_OFFLINE, HELP_ONLINE, @@ -150,6 +152,8 @@ static zpool_command_t command_table[] = { "add", zpool_do_add, HELP_ADD }, { "remove", zpool_do_remove, HELP_REMOVE }, { NULL }, + { "labelclear", zpool_do_labelclear, HELP_LABELCLEAR }, + { NULL }, { "list", zpool_do_list, HELP_LIST }, { "iostat", zpool_do_iostat, HELP_IOSTAT }, { "status", zpool_do_status, HELP_STATUS }, @@ -216,6 +220,8 @@ get_usage(zpool_help_t idx) { case HELP_IOSTAT: return (gettext("\tiostat [-v] [-T d|u] [pool] ... [interval " "[count]]\n")); + case HELP_LABELCLEAR: + return (gettext("\tlabelclear [-f] \n")); case HELP_LIST: return (gettext("\tlist [-H] [-o property[,...]] " "[-T d|u] [pool] ... [interval [count]]\n")); @@ -561,6 +567,125 @@ zpool_do_remove(int argc, char **argv) } /* + * zpool labelclear + * + * Verifies that the vdev is not active and zeros out the label information + * on the device. + */ +int +zpool_do_labelclear(int argc, char **argv) +{ + char *vdev, *name; + int c, fd = -1, ret = 0; + pool_state_t state; + boolean_t inuse = B_FALSE; + boolean_t force = B_FALSE; + + /* check options */ + while ((c = getopt(argc, argv, "f")) != -1) { + switch (c) { + case 'f': + force = B_TRUE; + break; + default: + (void) fprintf(stderr, gettext("invalid option '%c'\n"), + optopt); + usage(B_FALSE); + } + } + + argc -= optind; + argv += optind; + + /* get vdev name */ + if (argc < 1) { + (void) fprintf(stderr, gettext("missing vdev device name\n")); + usage(B_FALSE); + } + + vdev = argv[0]; + if ((fd = open(vdev, O_RDWR)) < 0) { + (void) fprintf(stderr, gettext("Unable to open %s\n"), vdev); + return (B_FALSE); + } + + name = NULL; + if (zpool_in_use(g_zfs, fd, &state, &name, &inuse) != 0) { + if (force) + goto wipe_label; + + (void) fprintf(stderr, + gettext("Unable to determine pool state for %s\n" + "Use -f to force the clearing any label data\n"), vdev); + + return (1); + } + + if (inuse) { + switch (state) { + default: + case POOL_STATE_ACTIVE: + case POOL_STATE_SPARE: + case POOL_STATE_L2CACHE: + (void) fprintf(stderr, +gettext("labelclear operation failed.\n" + "\tVdev %s is a member (%s), of pool \"%s\".\n" + "\tTo remove label information from this device, export or destroy\n" + "\tthe pool, or remove %s from the configuration of this pool\n" + "\tand retry the labelclear operation\n"), + vdev, zpool_pool_state_to_name(state), name, vdev); + ret = 1; + goto errout; + + case POOL_STATE_EXPORTED: + if (force) + break; + + (void) fprintf(stderr, +gettext("labelclear operation failed.\n" + "\tVdev %s is a member of the exported pool \"%s\".\n" + "\tUse \"zpool labelclear -f %s\" to force the removal of label\n" + "\tinformation.\n"), + vdev, name, vdev); + ret = 1; + goto errout; + + case POOL_STATE_POTENTIALLY_ACTIVE: + if (force) + break; + + (void) fprintf(stderr, +gettext("labelclear operation failed.\n" + "\tVdev %s is a member of the pool \"%s\".\n" + "\tThis pool is unknown to this system, but may be active on\n" + "\tanother system. Use \'zpool labelclear -f %s\' to force the\n" + "\tremoval of label information.\n"), + vdev, name, vdev); + ret = 1; + goto errout; + + case POOL_STATE_DESTROYED: + /* inuse should never be set for a destoryed pool... */ + break; + } + } + +wipe_label: + if (zpool_clear_label(fd) != 0) { + (void) fprintf(stderr, + gettext("Label clear failed on vdev %s\n"), vdev); + ret = 1; + } + +errout: + close(fd); + if (name != NULL) + free(name); + + return (ret); +} + +/* * zpool create [-fn] [-o property=value] ... * [-O file-system-property=value] ... * [-R root] [-m mountpoint] ... Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Thu Jan 5 10:09:22 2012 (r229569) +++ stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c Thu Jan 5 10:24:06 2012 (r229570) @@ -1084,8 +1084,8 @@ zpool_open_func(void *arg) /* * Given a file descriptor, clear (zero) the label information. This function - * is currently only used in the appliance stack as part of the ZFS sysevent - * module. + * is used in the appliance stack as part of the ZFS sysevent module and + * to implement the "zpool labelclear" command. */ int zpool_clear_label(int fd) From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 10:32:53 2012 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 D5A52106566B; Thu, 5 Jan 2012 10:32:53 +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 A61578FC15; Thu, 5 Jan 2012 10:32:53 +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 q05AWrkh027260; Thu, 5 Jan 2012 10:32:53 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05AWriJ027252; Thu, 5 Jan 2012 10:32:53 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201201051032.q05AWriJ027252@svn.freebsd.org> From: Ed Schouten Date: Thu, 5 Jan 2012 10:32:53 +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: r229571 - in head/lib/libc: i386/string mips/string string 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, 05 Jan 2012 10:32:53 -0000 Author: ed Date: Thu Jan 5 10:32:53 2012 New Revision: 229571 URL: http://svn.freebsd.org/changeset/base/229571 Log: Change index() and rindex() to a weak alias. This allows people to still write statically linked applications that call strchr() or strrchr() and have a local variable or function called index. Discussed with: bde@ Modified: head/lib/libc/i386/string/strchr.S head/lib/libc/i386/string/strrchr.S head/lib/libc/mips/string/strchr.S head/lib/libc/mips/string/strrchr.S head/lib/libc/string/strchr.c head/lib/libc/string/strrchr.c Modified: head/lib/libc/i386/string/strchr.S ============================================================================== --- head/lib/libc/i386/string/strchr.S Thu Jan 5 10:24:06 2012 (r229570) +++ head/lib/libc/i386/string/strchr.S Thu Jan 5 10:32:53 2012 (r229571) @@ -63,6 +63,6 @@ L2: ret END(strchr) -STRONG_ALIAS(index, strchr) +WEAK_ALIAS(index, strchr) .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/i386/string/strrchr.S ============================================================================== --- head/lib/libc/i386/string/strrchr.S Thu Jan 5 10:24:06 2012 (r229570) +++ head/lib/libc/i386/string/strrchr.S Thu Jan 5 10:32:53 2012 (r229571) @@ -64,6 +64,6 @@ L2: ret END(strrchr) -STRONG_ALIAS(rindex, strrchr) +WEAK_ALIAS(rindex, strrchr) .section .note.GNU-stack,"",%progbits Modified: head/lib/libc/mips/string/strchr.S ============================================================================== --- head/lib/libc/mips/string/strchr.S Thu Jan 5 10:24:06 2012 (r229570) +++ head/lib/libc/mips/string/strchr.S Thu Jan 5 10:32:53 2012 (r229571) @@ -58,4 +58,4 @@ fnd: j ra END(strchr) -STRONG_ALIAS(index, strchr) +WEAK_ALIAS(index, strchr) Modified: head/lib/libc/mips/string/strrchr.S ============================================================================== --- head/lib/libc/mips/string/strrchr.S Thu Jan 5 10:24:06 2012 (r229570) +++ head/lib/libc/mips/string/strrchr.S Thu Jan 5 10:32:53 2012 (r229571) @@ -56,4 +56,4 @@ LEAF(strrchr) j ra END(strrchr) -STRONG_ALIAS(rindex, strrchr) +WEAK_ALIAS(rindex, strrchr) Modified: head/lib/libc/string/strchr.c ============================================================================== --- head/lib/libc/string/strchr.c Thu Jan 5 10:24:06 2012 (r229570) +++ head/lib/libc/string/strchr.c Thu Jan 5 10:32:53 2012 (r229571) @@ -51,4 +51,4 @@ strchr(const char *p, int ch) /* NOTREACHED */ } -__strong_reference(strchr, index); +__weak_reference(strchr, index); Modified: head/lib/libc/string/strrchr.c ============================================================================== --- head/lib/libc/string/strrchr.c Thu Jan 5 10:24:06 2012 (r229570) +++ head/lib/libc/string/strrchr.c Thu Jan 5 10:32:53 2012 (r229571) @@ -52,4 +52,4 @@ strrchr(const char *p, int ch) /* NOTREACHED */ } -__strong_reference(strrchr, rindex); +__weak_reference(strrchr, rindex); From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 10:40:25 2012 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 6ABB3106566B; Thu, 5 Jan 2012 10:40:25 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5514A8FC08; Thu, 5 Jan 2012 10:40:25 +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 q05AePGB027830; Thu, 5 Jan 2012 10:40:25 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05AePQI027827; Thu, 5 Jan 2012 10:40:25 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201201051040.q05AePQI027827@svn.freebsd.org> From: Baptiste Daroussin Date: Thu, 5 Jan 2012 10:40:25 +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: r229572 - head/lib/libutil 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, 05 Jan 2012 10:40:25 -0000 Author: bapt Date: Thu Jan 5 10:40:24 2012 New Revision: 229572 URL: http://svn.freebsd.org/changeset/base/229572 Log: Add new pw_make_v7 to make a passwd line (in v7 format) out of a struct passwd while here, fix missing parentheses of the return statement of pw_make. Approved by: des (mentor) Modified: head/lib/libutil/libutil.h head/lib/libutil/pw_util.c Modified: head/lib/libutil/libutil.h ============================================================================== --- head/lib/libutil/libutil.h Thu Jan 5 10:32:53 2012 (r229571) +++ head/lib/libutil/libutil.h Thu Jan 5 10:40:24 2012 (r229572) @@ -144,6 +144,7 @@ int pw_equal(const struct passwd *_pw1, void pw_fini(void); int pw_init(const char *_dir, const char *_master); char *pw_make(const struct passwd *_pw); +char *pw_make_v7(const struct passwd *_pw); int pw_mkdb(const char *_user); int pw_lock(void); struct passwd *pw_scan(const char *_line, int _flags); Modified: head/lib/libutil/pw_util.c ============================================================================== --- head/lib/libutil/pw_util.c Thu Jan 5 10:32:53 2012 (r229571) +++ head/lib/libutil/pw_util.c Thu Jan 5 10:40:24 2012 (r229572) @@ -406,7 +406,21 @@ pw_make(const struct passwd *pw) pw->pw_passwd, (uintmax_t)pw->pw_uid, (uintmax_t)pw->pw_gid, pw->pw_class, (uintmax_t)pw->pw_change, (uintmax_t)pw->pw_expire, pw->pw_gecos, pw->pw_dir, pw->pw_shell); - return line; + return (line); +} + +/* + * Make a passwd line (in v7 format) out of a struct passwd + */ +char * +pw_make_v7(const struct passwd *pw) +{ + char *line; + + asprintf(&line, "%s:*:%ju:%ju:%s:%s:%s", pw->pw_name, + (uintmax_t)pw->pw_uid, (uintmax_t)pw->pw_gid, + pw->pw_gecos, pw->pw_dir, pw->pw_shell); + return (line); } /* From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 10:42:20 2012 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 06C7E1065672; Thu, 5 Jan 2012 10:42:20 +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 E4EB98FC0A; Thu, 5 Jan 2012 10:42: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 q05AgJhS028026; Thu, 5 Jan 2012 10:42:19 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05AgJ8B028024; Thu, 5 Jan 2012 10:42:19 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201051042.q05AgJ8B028024@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 5 Jan 2012 10:42:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229573 - stable/9/sys/dev/uart 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, 05 Jan 2012 10:42:20 -0000 Author: kib Date: Thu Jan 5 10:42:19 2012 New Revision: 229573 URL: http://svn.freebsd.org/changeset/base/229573 Log: MFC r228947: Add PCI Id for the Intel AMT serial interface as found on my DQ67OW. Modified: stable/9/sys/dev/uart/uart_bus_pci.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/uart/uart_bus_pci.c ============================================================================== --- stable/9/sys/dev/uart/uart_bus_pci.c Thu Jan 5 10:40:24 2012 (r229572) +++ stable/9/sys/dev/uart/uart_bus_pci.c Thu Jan 5 10:42:19 2012 (r229573) @@ -111,6 +111,7 @@ static struct pci_id pci_ns8250_ids[] = { 0x1415, 0x950b, 0xffff, 0, "Oxford Semiconductor OXCB950 Cardbus 16950 UART", 0x10, 16384000 }, { 0x151f, 0x0000, 0xffff, 0, "TOPIC Semiconductor TP560 56k modem", 0x10 }, +{ 0x8086, 0x1c3d, 0xffff, 0, "Intel AMT - KT Controller", 0x10 }, { 0x9710, 0x9820, 0x1000, 1, "NetMos NM9820 Serial Port", 0x10 }, { 0x9710, 0x9835, 0x1000, 1, "NetMos NM9835 Serial Port", 0x10 }, { 0x9710, 0x9865, 0xa000, 0x1000, "NetMos NM9865 Serial Port", 0x10 }, From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 10:43:04 2012 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 88BDC1065672; Thu, 5 Jan 2012 10:43:04 +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 73E7D8FC0C; Thu, 5 Jan 2012 10:43:04 +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 q05Ah4hE028124; Thu, 5 Jan 2012 10:43:04 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05Ah4ea028122; Thu, 5 Jan 2012 10:43:04 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201201051043.q05Ah4ea028122@svn.freebsd.org> From: Ed Schouten Date: Thu, 5 Jan 2012 10:43:04 +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: r229574 - head/sys/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, 05 Jan 2012 10:43:04 -0000 Author: ed Date: Thu Jan 5 10:43:03 2012 New Revision: 229574 URL: http://svn.freebsd.org/changeset/base/229574 Log: Add __generic(), to be able to use a very simple _Generic(). Already introducing this allows us to be forward compatible with C11 compilers. By implementing on top of this interface, it becomes trivial to support both our existing GCC and newer compilers. Modified: head/sys/sys/cdefs.h Modified: head/sys/sys/cdefs.h ============================================================================== --- head/sys/sys/cdefs.h Thu Jan 5 10:42:19 2012 (r229573) +++ head/sys/sys/cdefs.h Thu Jan 5 10:43:03 2012 (r229574) @@ -248,6 +248,24 @@ #endif #endif +/* + * Emulation of C11 _Generic(). Unlike the previously defined C11 + * keywords, it is not possible to implement this using exactly the same + * syntax. Therefore implement something similar under the name + * __generic(). Unlike _Generic(), this macro can only distinguish + * between a single type, so it requires nested invocations to + * distinguish multiple cases. + */ + +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +#define __generic(expr, t, yes, no) \ + _Generic(expr, t: yes, default: no) +#elif __GNUC_PREREQ__(3, 1) +#define __generic(expr, t, yes, no) \ + __builtin_choose_expr( \ + __builtin_types_compatible_p(__typeof(expr), t), yes, no) +#endif + #if __GNUC_PREREQ__(2, 96) #define __malloc_like __attribute__((__malloc__)) #define __pure __attribute__((__pure__)) From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 10:46:23 2012 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 8A20A1065678; Thu, 5 Jan 2012 10:46:23 +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 734E68FC14; Thu, 5 Jan 2012 10:46: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 q05AkNM2028464; Thu, 5 Jan 2012 10:46:23 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05AkNAU028461; Thu, 5 Jan 2012 10:46:23 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201201051046.q05AkNAU028461@svn.freebsd.org> From: Ed Schouten Date: Thu, 5 Jan 2012 10:46:23 +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: r229575 - in head: include share/man/man3 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, 05 Jan 2012 10:46:23 -0000 Author: ed Date: Thu Jan 5 10:46:22 2012 New Revision: 229575 URL: http://svn.freebsd.org/changeset/base/229575 Log: Reimplement on top of __generic(). The macro construction used now, is almost identical to the code provided in C11 proposal N1404. This new version doesn't seem to introduce any regressions according to the regression test in tools/, but still seems to malfunction with Clang on certain aspects. The new code does work successfully with GCC 4.2, 4.6 and 4.7. With 4.7, it also works when __generic() is implemented on top of _Generic(). Discussed with: stefanf Modified: head/include/tgmath.h head/share/man/man3/tgmath.3 Modified: head/include/tgmath.h ============================================================================== --- head/include/tgmath.h Thu Jan 5 10:43:03 2012 (r229574) +++ head/include/tgmath.h Thu Jan 5 10:46:22 2012 (r229575) @@ -2,6 +2,9 @@ * Copyright (c) 2004 Stefan Farfeleder. * All rights reserved. * + * Copyright (c) 2012 Ed Schouten + * All rights reserved. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -33,64 +36,83 @@ #include /* - * This implementation of requires two implementation-dependent - * macros to be defined: - * __tg_impl_simple(x, y, z, fn, fnf, fnl, ...) + * This implementation of uses the two following macros, + * which are based on the macros described in C11 proposal N1404: + * __tg_impl_simple(x, y, z, fnl, fn, fnf, ...) * Invokes fnl() if the corresponding real type of x, y or z is long * double, fn() if it is double or any has an integer type, and fnf() * otherwise. - * __tg_impl_full(x, y, z, fn, fnf, fnl, cfn, cfnf, cfnl, ...) - * Invokes [c]fnl() if the corresponding real type of x, y or z is long + * __tg_impl_full(x, y, cfnl, cfn, cfnf, fnl, fn, fnf, ...) + * Invokes [c]fnl() if the corresponding real type of x or y is long * double, [c]fn() if it is double or any has an integer type, and * [c]fnf() otherwise. The function with the 'c' prefix is called if - * any of x, y or z is a complex number. + * any of x or y is a complex number. * Both macros call the chosen function with all additional arguments passed * to them, as given by __VA_ARGS__. * * Note that these macros cannot be implemented with C's ?: operator, * because the return type of the whole expression would incorrectly be long * double complex regardless of the argument types. + * + * The _Complex_I distinction should not be needed, but due to a bug in + * GCC 4.2, _Complex_I is not of type float _Complex. */ -#if __GNUC_PREREQ__(3, 1) -#define __tg_type(e, t) __builtin_types_compatible_p(__typeof__(e), t) -#define __tg_type3(e1, e2, e3, t) \ - (__tg_type(e1, t) || __tg_type(e2, t) || __tg_type(e3, t)) -#define __tg_type_corr(e1, e2, e3, t) \ - (__tg_type3(e1, e2, e3, t) || __tg_type3(e1, e2, e3, t _Complex)) -#define __tg_integer(e1, e2, e3) \ - (((__typeof__(e1))1.5 == 1) || ((__typeof__(e2))1.5 == 1) || \ - ((__typeof__(e3))1.5 == 1)) -#define __tg_is_complex(e1, e2, e3) \ - (__tg_type3(e1, e2, e3, float _Complex) || \ - __tg_type3(e1, e2, e3, double _Complex) || \ - __tg_type3(e1, e2, e3, long double _Complex) || \ - __tg_type3(e1, e2, e3, __typeof__(_Complex_I))) - -#define __tg_impl_simple(x, y, z, fn, fnf, fnl, ...) \ - __builtin_choose_expr(__tg_type_corr(x, y, z, long double), \ - fnl(__VA_ARGS__), __builtin_choose_expr( \ - __tg_type_corr(x, y, z, double) || __tg_integer(x, y, z),\ - fn(__VA_ARGS__), fnf(__VA_ARGS__))) - -#define __tg_impl_full(x, y, z, fn, fnf, fnl, cfn, cfnf, cfnl, ...) \ - __builtin_choose_expr(__tg_is_complex(x, y, z), \ - __tg_impl_simple(x, y, z, cfn, cfnf, cfnl, __VA_ARGS__), \ - __tg_impl_simple(x, y, z, fn, fnf, fnl, __VA_ARGS__)) - -#else /* __GNUC__ */ +#ifndef __generic #error " not implemented for this compiler" -#endif /* !__GNUC__ */ +#endif + +#define __tg_generic_simple(x, fnl, fn, fnf) \ + __generic(x, long double _Complex, fnl, \ + __generic(x, double _Complex, fn, \ + __generic(x, float _Complex, fnf, \ + __generic(x, __typeof(_Complex_I), fnf, \ + __generic(x, long double, fnl, \ + __generic(x, float, fnf, fn)))))) +#define __tg_impl_simple(x, y, z, fnl, fn, fnf, ...) \ + __tg_generic_simple(x, \ + __tg_generic_simple(y, \ + __tg_generic_simple(z, fnl, fnl, fnl), \ + __tg_generic_simple(z, fnl, fnl, fnl), \ + __tg_generic_simple(z, fnl, fnl, fnl)), \ + __tg_generic_simple(y, \ + __tg_generic_simple(z, fnl, fnl, fnl), \ + __tg_generic_simple(z, fnl, fn , fn ), \ + __tg_generic_simple(z, fnl, fn , fn )), \ + __tg_generic_simple(y, \ + __tg_generic_simple(z, fnl, fnl, fnl), \ + __tg_generic_simple(z, fnl, fn , fn ), \ + __tg_generic_simple(z, fnl, fn , fnf)))(__VA_ARGS__) +#define __tg_generic_full(x, cfnl, cfn, cfnf, fnl, fn, fnf) \ + __generic(x, long double _Complex, cfnl, \ + __generic(x, double _Complex, cfn, \ + __generic(x, float _Complex, cfnf, \ + __generic(x, __typeof(_Complex_I), cfnf, \ + __generic(x, long double, fnl, \ + __generic(x, float, fnf, fn)))))) +#define __tg_impl_full(x, y, cfnl, cfn, cfnf, fnl, fn, fnf, ...) \ + __tg_generic_full(x, \ + __tg_generic_full(y, cfnl, cfnl, cfnl, cfnl, cfnl, cfnl), \ + __tg_generic_full(y, cfnl, cfn , cfn , cfnl, cfn , cfn ), \ + __tg_generic_full(y, cfnl, cfn , cfnf, cfnl, cfn , cfnf), \ + __tg_generic_full(y, cfnl, cfnl, cfnl, fnl , fnl , fnl ), \ + __tg_generic_full(y, cfnl, cfn , cfn , fnl , fn , fn ), \ + __tg_generic_full(y, cfnl, cfn , cfnf, fnl , fn , fnf )) \ + (__VA_ARGS__) /* Macros to save lots of repetition below */ #define __tg_simple(x, fn) \ - __tg_impl_simple(x, x, x, fn, fn##f, fn##l, x) + __tg_impl_simple(x, x, x, fn##l, fn, fn##f, x) #define __tg_simple2(x, y, fn) \ - __tg_impl_simple(x, x, y, fn, fn##f, fn##l, x, y) + __tg_impl_simple(x, x, y, fn##l, fn, fn##f, x, y) +#define __tg_simple3(x, y, z, fn) \ + __tg_impl_simple(x, y, z, fn##l, fn, fn##f, x, y, z) #define __tg_simplev(x, fn, ...) \ - __tg_impl_simple(x, x, x, fn, fn##f, fn##l, __VA_ARGS__) + __tg_impl_simple(x, x, x, fn##l, fn, fn##f, __VA_ARGS__) #define __tg_full(x, fn) \ - __tg_impl_full(x, x, x, fn, fn##f, fn##l, c##fn, c##fn##f, c##fn##l, x) + __tg_impl_full(x, x, c##fn##l, c##fn, c##fn##f, fn##l, fn, fn##f, x) +#define __tg_full2(x, y, fn) \ + __tg_impl_full(x, y, c##fn##l, c##fn, c##fn##f, fn##l, fn, fn##f, x, y) /* 7.22#4 -- These macros expand to real or complex functions, depending on * the type of their arguments. */ @@ -108,13 +130,12 @@ #define tanh(x) __tg_full(x, tanh) #define exp(x) __tg_full(x, exp) #define log(x) __tg_full(x, log) -#define pow(x, y) __tg_impl_full(x, x, y, pow, powf, powl, \ - cpow, cpowf, cpowl, x, y) +#define pow(x, y) __tg_full2(x, y, pow) #define sqrt(x) __tg_full(x, sqrt) /* "The corresponding type-generic macro for fabs and cabs is fabs." */ -#define fabs(x) __tg_impl_full(x, x, x, fabs, fabsf, fabsl, \ - cabs, cabsf, cabsl, x) +#define fabs(x) __tg_impl_full(x, x, cabsl, cabs, cabsf, \ + fabsl, fabs, fabsf, x) /* 7.22#5 -- These macros are only defined for arguments with real type. */ #define atan2(x, y) __tg_simple2(x, y, atan2) @@ -127,7 +148,7 @@ #define expm1(x) __tg_simple(x, expm1) #define fdim(x, y) __tg_simple2(x, y, fdim) #define floor(x) __tg_simple(x, floor) -#define fma(x, y, z) __tg_impl_simple(x, y, z, fma, fmaf, fmal, x, y, z) +#define fma(x, y, z) __tg_simple3(x, y, z, fma) #define fmax(x, y) __tg_simple2(x, y, fmax) #define fmin(x, y) __tg_simple2(x, y, fmin) #define fmod(x, y) __tg_simple2(x, y, fmod) @@ -148,8 +169,8 @@ #define nextafter(x, y) __tg_simple2(x, y, nextafter) #define nexttoward(x, y) __tg_simplev(x, nexttoward, x, y) #define remainder(x, y) __tg_simple2(x, y, remainder) -#define remquo(x, y, z) __tg_impl_simple(x, x, y, remquo, remquof, \ - remquol, x, y, z) +#define remquo(x, y, z) __tg_impl_simple(x, x, y, remquol, remquo, \ + remquof, x, y, z) #define rint(x) __tg_simple(x, rint) #define round(x) __tg_simple(x, round) #define scalbn(x, y) __tg_simplev(x, scalbn, x, y) Modified: head/share/man/man3/tgmath.3 ============================================================================== --- head/share/man/man3/tgmath.3 Thu Jan 5 10:43:03 2012 (r229574) +++ head/share/man/man3/tgmath.3 Thu Jan 5 10:46:22 2012 (r229575) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 14, 2004 +.Dd January 4, 2012 .Dt TGMATH 3 .Os .Sh NAME @@ -139,15 +139,24 @@ The header .In tgmath.h first appeared in .Fx 5.3 . -.Sh BUGS -The header +.Sh COMPILER SUPPORT +Before +.St -isoC-11 , +the header .In tgmath.h -cannot be implemented with strictly conforming C code and needs +could not be implemented with strictly conforming C code and needed special compiler support. -The current implementation only works for GCC. -.Pp +As of +.St -isoC-11 , +this header file can be implemented using the +.Fn _Generic +language keyword. +In addition to compilers that support this keyword, this header file +works with GCC. +.Sh BUGS Many of the functions mentioned here are not prototyped in .In math.h or .In complex.h as they are not yet implemented. +This prevents the corresponding type-generic macro from working at all. From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 10:55:17 2012 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 ADD3B106566B; Thu, 5 Jan 2012 10:55:17 +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 943B08FC12; Thu, 5 Jan 2012 10:55: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 q05AtHSK030146; Thu, 5 Jan 2012 10:55:17 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05AtHnY030142; Thu, 5 Jan 2012 10:55:17 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201051055.q05AtHnY030142@svn.freebsd.org> From: Martin Matuska Date: Thu, 5 Jan 2012 10:55:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229576 - in stable/9/cddl/contrib/opensolaris/cmd: zdb zfs zpool zstreamdump 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, 05 Jan 2012 10:55:17 -0000 Author: mm Date: Thu Jan 5 10:55:17 2012 New Revision: 229576 URL: http://svn.freebsd.org/changeset/base/229576 Log: MFC zfs manpage update (r227646, r227648, r227649, r227752, r228019, r228045, r228054, r228055) MFC r227646 (partial): Update and desolarization of zfs(8) and zpool(8) manual pages: - synchronized to match new vendor code (Illumos rev. 13513) [1] - removed references to sun commands (replaced with FreeBSD commands) - removed ATTRIBUTES sections - updated SEE ALSO sections - properly updated copyright information (required by CDDL) zfs(8) only: - replaced "Zones" section with new "Jails" section - removed misleading "ZFS Volumes as Swap or Dump Devices" section - updated shareiscsi and sharesmb option information (not supported on FreeBSD) - replace zoned property with jailed property zpool(8) only: - updated device names in examples MFC r227648: Fix reference to fsync(2). Add more references to SEE ALSO section. MFC r227649: More zfs(8) manpage fixes: - remove shareiscsi property - mark casesensitivity property as unsupported - remove reference to Solaris Administration Guide MFC r227752 (partial): Update and desolarization of zdb(8) and zstreamdump(1) manual pages: - synchronized to match new vendor code [1] - removed ATTRIBUTES sections - updated SEE ALSO sections - properly updated copyright information (required by CDDL) MFC r228019: Update ZFS manual pages to a mdoc(7) reimplementation. The zfs(8) and zpool(8) manual pages now match the state of the ZFS module and have been customized for FreeBSD. The new texts of the "Deduplication" subsection in zfs(8), the zpool "split" command, the zfs "dedup" property and several other missing parts have been added from illumos or OpenSolaris snv_134 (CDDL-licensed). The mdoc(7) reimplementation of whole manual pages, the descriptions of the zpool "readonly" property, "zfs diff" command and descriptions of several other missing command flags and/or options were authored by myself. MFC r228045: Add missing -n flag to "zpool import" description. MFC r228054: Add missing warning to zfs(8) for using "zfs destroy" with -r and -R flags. MFC r228055: Use singular form for zfs destroy snapshot in zfs(8). Obtained from: Illumos (as of rev. 13513:f84d4672fdbd) [1] Modified: stable/9/cddl/contrib/opensolaris/cmd/zdb/zdb.8 stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs.8 stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool.8 stable/9/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.1 Directory Properties: stable/9/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/cddl/contrib/opensolaris/cmd/zdb/zdb.8 ============================================================================== --- stable/9/cddl/contrib/opensolaris/cmd/zdb/zdb.8 Thu Jan 5 10:46:22 2012 (r229575) +++ stable/9/cddl/contrib/opensolaris/cmd/zdb/zdb.8 Thu Jan 5 10:55:17 2012 (r229576) @@ -1,84 +1,79 @@ '\" te +.\" Copyright (c) 2011, Martin Matuska . +.\" All Rights Reserved. +.\" +.\" The contents of this file are subject to the terms of the +.\" Common Development and Distribution License (the "License"). +.\" You may not use this file except in compliance with the License. +.\" +.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +.\" or http://www.opensolaris.org/os/licensing. +.\" See the License for the specific language governing permissions +.\" and limitations under the License. +.\" +.\" When distributing Covered Code, include this CDDL HEADER in each +.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE. +.\" If applicable, add the following below this CDDL HEADER, with the +.\" fields enclosed by brackets "[]" replaced with your own identifying +.\" information: Portions Copyright [yyyy] [name of copyright owner] +.\" .\" Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved. -.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. -.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. -.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH zdb 1M "31 Oct 2005" "SunOS 5.11" "System Administration Commands" -.SH NAME -zdb \- ZFS debugger -.SH SYNOPSIS -.LP -.nf -\fBzdb\fR \fIpool\fR -.fi - -.SH DESCRIPTION -.sp -.LP -The \fBzdb\fR command is used by support engineers to diagnose failures and gather statistics. Since the \fBZFS\fR file system is always consistent on disk and is self-repairing, \fBzdb\fR should only be run under the direction by a support engineer. -.sp -.LP -If no arguments are specified, \fBzdb\fR, performs basic consistency checks on the pool and associated datasets, and report any problems detected. -.sp -.LP -Any options supported by this command are internal to Sun and subject to change at any time. -.SH EXIT STATUS -.sp -.LP +.\" +.\" $FreeBSD$ +.\" +.Dd November 26, 2011 +.Dt ZDB 8 +.Os +.Sh NAME +.Nm zdb +.Nd ZFS debugger +.Sh SYNOPSIS +.Nm +.Ar pool +.Sh DESCRIPTION +The +.Nm +command is used by support engineers to diagnose failures and +gather statistics. Since the +.Tn ZFS +file system is always consistent on disk and is self-repairing, +.Nm +should only be run under the direction by a support engineer. +.Pp +If no arguments are specified, +.Nm +performs basic consistency checks on the pool and associated datasets, and +report any problems detected. +.Nm +Any options supported by this command are internal to Sun and subject to change +at any time. +.Sh EXIT STATUS The following exit values are returned: -.sp -.ne 2 -.mk -.na -\fB\fB0\fR\fR -.ad -.RS 5n -.rt +.Bl -tag -offset 2n -width 2n +.It 0 The pool is consistent. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fB1\fR\fR -.ad -.RS 5n -.rt +.It 1 An error was detected. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fB2\fR\fR -.ad -.RS 5n -.rt +.It 2 Invalid command line options were specified. -.RE - -.SH ATTRIBUTES -.sp -.LP -See \fBattributes\fR(5) for descriptions of the following attributes: -.sp - -.sp -.TS -tab() box; -cw(2.75i) |cw(2.75i) -lw(2.75i) |lw(2.75i) -. -ATTRIBUTE TYPEATTRIBUTE VALUE -_ -AvailabilitySUNWzfsu -_ -Interface StabilityUnstable -.TE - -.SH SEE ALSO -.sp -.LP -\fBzfs\fR(1M), \fBzpool\fR(1M), \fBattributes\fR(5) +.El +.Sh SEE ALSO +.Xr zfs 8 , +.Xr zpool 8 +.Sh AUTHORS +This manual page is a +.Xr mdoc 7 +reimplementation of the +.Tn OpenSolaris +manual page +.Em zdb(1M) , +modified and customized for +.Fx +and licensed under the +.Tn Common Development and Distribution License +.Pq Tn CDDL . +.Pp +The +.Xr mdoc 7 +implementation of this manual page was initially written by +.An Martin Matuska Aq mm@FreeBSD.org . Modified: stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Jan 5 10:46:22 2012 (r229575) +++ stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Jan 5 10:55:17 2012 (r229576) @@ -1,2701 +1,2726 @@ '\" te -.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved. -.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. -.\" See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with -.\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. -.\" See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with -.\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] +.\" Copyright (c) 2011, Martin Matuska . +.\" All Rights Reserved. +.\" +.\" The contents of this file are subject to the terms of the +.\" Common Development and Distribution License (the "License"). +.\" You may not use this file except in compliance with the License. +.\" +.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +.\" or http://www.opensolaris.org/os/licensing. +.\" See the License for the specific language governing permissions +.\" and limitations under the License. +.\" +.\" When distributing Covered Code, include this CDDL HEADER in each +.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE. +.\" If applicable, add the following below this CDDL HEADER, with the +.\" fields enclosed by brackets "[]" replaced with your own identifying +.\" information: Portions Copyright [yyyy] [name of copyright owner] +.\" +.\" Copyright (c) 2010, Sun Microsystems, Inc. All Rights Reserved. .\" Copyright 2011 Nexenta Systems, Inc. All rights reserved. -.\" Copyright 2011 by Delphix. All rights reserved. -.TH zfs 1M "24 Sep 2009" "SunOS 5.11" "System Administration Commands" -.SH NAME -zfs \- configures ZFS file systems -.SH SYNOPSIS -.LP -.nf -\fBzfs\fR [\fB-?\fR] -.fi - -.LP -.nf -\fBzfs\fR \fBcreate\fR [\fB-p\fR] [\fB-o\fR \fIproperty\fR=\fIvalue\fR] ... \fIfilesystem\fR -.fi - -.LP -.nf -\fBzfs\fR \fBcreate\fR [\fB-ps\fR] [\fB-b\fR \fIblocksize\fR] [\fB-o\fR \fIproperty\fR=\fIvalue\fR] ... \fB-V\fR \fIsize\fR \fIvolume\fR -.fi - -.LP -.nf -\fBzfs\fR \fBdestroy\fR [\fB-rRf\fR] \fIfilesystem\fR|\fIvolume\fR -.fi - -.LP -.nf -\fBzfs\fR \fBdestroy\fR [\fB-rRd\fR] \fIsnapshot\fR -.fi - -.LP -.nf -\fBzfs\fR \fBsnapshot\fR [\fB-r\fR] [\fB-o\fR \fIproperty\fR=\fIvalue\fR]... - \fIfilesystem@snapname\fR|\fIvolume@snapname\fR -.fi - -.LP -.nf -\fBzfs\fR \fBrollback\fR [\fB-rRf\fR] \fIsnapshot\fR -.fi - -.LP -.nf -\fBzfs\fR \fBclone\fR [\fB-p\fR] [\fB-o\fR \fIproperty\fR=\fIvalue\fR] ... \fIsnapshot\fR \fIfilesystem\fR|\fIvolume\fR -.fi - -.LP -.nf -\fBzfs\fR \fBpromote\fR \fIclone-filesystem\fR -.fi - -.LP -.nf -\fBzfs\fR \fBrename\fR \fIfilesystem\fR|\fIvolume\fR|\fIsnapshot\fR - \fIfilesystem\fR|\fIvolume\fR|\fIsnapshot\fR -.fi - -.LP -.nf -\fBzfs\fR \fBrename\fR [\fB-p\fR] \fIfilesystem\fR|\fIvolume\fR \fIfilesystem\fR|\fIvolume\fR -.fi - -.LP -.nf -\fBzfs\fR \fBrename\fR \fB-r\fR \fIsnapshot\fR \fIsnapshot\fR -.fi - -.LP -.nf -\fBzfs\fR \fBrename\fR \fB-u\fR [\fB-p\fR] \fIfilesystem\fR \fIfilesystem\fR -.fi - -.LP -.nf -\fBzfs\fR \fBlist\fR [\fB-r\fR|\fB-d\fR \fIdepth\fR][\fB-H\fR][\fB-o\fR \fIproperty\fR[,...]] [\fB-t\fR \fItype\fR[,...]] - [\fB-s\fR \fIproperty\fR] ... [\fB-S\fR \fIproperty\fR] ... [\fIfilesystem\fR|\fIvolume\fR|\fIsnapshot\fR] ... -.fi - -.LP -.nf -\fBzfs\fR \fBset\fR \fIproperty\fR=\fIvalue\fR \fIfilesystem\fR|\fIvolume\fR|\fIsnapshot\fR ... -.fi - -.LP -.nf -\fBzfs\fR \fBget\fR [\fB-r\fR|\fB-d\fR \fIdepth\fR][\fB-Hp\fR][\fB-o\fR \fIfield\fR[,...]] [\fB-s\fR \fIsource\fR[,...]] - "\fIall\fR" | \fIproperty\fR[,...] \fIfilesystem\fR|\fIvolume\fR|\fIsnapshot\fR ... -.fi - -.LP -.nf -\fBzfs\fR \fBinherit\fR [\fB-r\fR] \fIproperty\fR \fIfilesystem\fR|\fIvolume|snapshot\fR ... -.fi - -.LP -.nf -\fBzfs\fR \fBupgrade\fR [\fB-v\fR] -.fi - -.LP -.nf -\fBzfs\fR \fBupgrade\fR [\fB-r\fR] [\fB-V\fR \fIversion\fR] \fB-a\fR | \fIfilesystem\fR -.fi - -.LP -.nf -\fBzfs\fR \fBuserspace\fR [\fB-niHp\fR] [\fB-o\fR \fIfield\fR[,...]] [\fB-sS\fR \fIfield\fR] ... - [\fB-t\fR \fItype\fR [,...]] \fIfilesystem\fR|\fIsnapshot\fR -.fi - -.LP -.nf -\fBzfs\fR \fBgroupspace\fR [\fB-niHp\fR] [\fB-o\fR \fIfield\fR[,...]] [\fB-sS\fR \fIfield\fR] ... - [\fB-t\fR \fItype\fR [,...]] \fIfilesystem\fR|\fIsnapshot\fR -.fi - -.LP -.nf -\fBzfs\fR \fBmount\fR -.fi - -.LP -.nf -\fBzfs\fR \fBmount\fR [\fB-vO\fR] [\fB-o \fIoptions\fR\fR] \fB-a\fR | \fIfilesystem\fR -.fi - -.LP -.nf -\fBzfs\fR \fBunmount\fR [\fB-f\fR] \fB-a\fR | \fIfilesystem\fR|\fImountpoint\fR -.fi - -.LP -.nf -\fBzfs\fR \fBshare\fR \fB-a\fR | \fIfilesystem\fR -.fi - -.LP -.nf -\fBzfs\fR \fBunshare\fR \fB-a\fR \fIfilesystem\fR|\fImountpoint\fR -.fi - -.LP -.nf -\fBzfs\fR \fBsend\fR [\fB-vR\fR] [\fB-\fR[\fBiI\fR] \fIsnapshot\fR] \fIsnapshot\fR -.fi - -.LP -.nf -\fBzfs\fR \fBreceive\fR [\fB-vnFu\fR] \fIfilesystem\fR|\fIvolume\fR|\fIsnapshot\fR -.fi - -.LP -.nf -\fBzfs\fR \fBreceive\fR [\fB-vnFu\fR] \fB-d\fR \fIfilesystem\fR -.fi - -.LP -.nf -\fBzfs\fR \fBallow\fR \fIfilesystem\fR|\fIvolume\fR -.fi - -.LP -.nf -\fBzfs\fR \fBallow\fR [\fB-ldug\fR] "\fIeveryone\fR"|\fIuser\fR|\fIgroup\fR[,...] \fIperm\fR|\fI@setname\fR[,...] - \fIfilesystem\fR|\fIvolume\fR -.fi - -.LP -.nf -\fBzfs\fR \fBallow\fR [\fB-ld\fR] \fB-e\fR \fIperm\fR|@\fIsetname\fR[,...] \fIfilesystem\fR|\fIvolume\fR -.fi - -.LP -.nf -\fBzfs\fR \fBallow\fR \fB-c\fR \fIperm\fR|@\fIsetname\fR[,...] \fIfilesystem\fR|\fIvolume\fR -.fi - -.LP -.nf -\fBzfs\fR \fBallow\fR \fB-s\fR @\fIsetname\fR \fIperm\fR|@\fIsetname\fR[,...] \fIfilesystem\fR|\fIvolume\fR -.fi - -.LP -.nf -\fBzfs\fR \fBunallow\fR [\fB-rldug\fR] "\fIeveryone\fR"|\fIuser\fR|\fIgroup\fR[,...] [\fIperm\fR|@\fIsetname\fR[,... ]] - \fIfilesystem\fR|\fIvolume\fR -.fi - -.LP -.nf -\fBzfs\fR \fBunallow\fR [\fB-rld\fR] \fB-e\fR [\fIperm\fR|@\fIsetname\fR[,... ]] \fIfilesystem\fR|\fIvolume\fR -.fi - -.LP -.nf -\fBzfs\fR \fBunallow\fR [\fB-r\fR] \fB-c\fR [\fIperm\fR|@\fIsetname\fR[ ... ]] \fIfilesystem\fR|\fIvolume\fR -.fi - -.LP -.nf -\fBzfs\fR \fBunallow\fR [\fB-r\fR] \fB-s\fR @\fIsetname\fR [\fIperm\fR|@\fIsetname\fR[,... ]] \fIfilesystem\fR|\fIvolume\fR -.fi - -.LP -.nf -\fBzfs\fR \fBhold\fR [\fB-r\fR] \fItag\fR \fIsnapshot\fR... -.fi - -.LP -.nf -\fBzfs\fR \fBholds\fR [\fB-r\fR] \fIsnapshot\fR... -.fi - -.LP -.nf -\fBzfs\fR \fBrelease\fR [\fB-r\fR] \fItag\fR \fIsnapshot\fR... -.fi - -\fBzfs\fR \fBjail\fR \fBjailid\fR \fB\fIfilesystem\fR\fR -.fi -.LP -.nf -\fBzfs\fR \fBunjail\fR \fBjailid\fR \fB\fIfilesystem\fR\fR -.fi - -.SH DESCRIPTION -.sp -.LP -The \fBzfs\fR command configures \fBZFS\fR datasets within a \fBZFS\fR storage pool, as described in \fBzpool\fR(1M). A dataset is identified by a unique path within the \fBZFS\fR namespace. For example: -.sp -.in +2 -.nf -pool/{filesystem,volume,snapshot} -.fi -.in -2 -.sp - -.sp -.LP -where the maximum length of a dataset name is \fBMAXNAMELEN\fR (256 bytes). -.sp -.LP +.\" Copyright (c) 2011 by Delphix. All rights reserved. +.\" Copyright (c) 2011, Pawel Jakub Dawidek +.\" +.\" $FreeBSD$ +.\" +.Dd November 26, 2011 +.Dt ZFS 8 +.Os +.Sh NAME +.Nm zfs +.Nd configures ZFS file systems +.Sh SYNOPSIS +.Nm +.Op Fl \&? +.Nm +.Cm create +.Op Fl p +.Op Fl o Ar property Ns = Ns Ar value +.Ar ... filesystem +.Nm +.Cm create +.Op Fl ps +.Op Fl b Ar blocksize +.Op Fl o Ar property Ns = Ns Ar value +.Ar ... +.Fl V +.Ar size volume +.Nm +.Cm destroy +.Op Fl rRf +.Ar filesystem Ns | Ns Ar volume +.Nm +.Cm destroy +.Op Fl rRd +.Ar snapshot +.Nm +.Cm snapshot +.Op Fl r +.Op Fl o Ar property Ns = Ns Ar value +.Ar ... filesystem@snapname Ns | Ns Ar volume@snapname +.Nm +.Cm rollback +.Op Fl rRf +.Ar snapshot +.Nm +.Cm clone +.Op Fl p +.Op Fl o Ar property Ns = Ns Ar value +.Ar ... snapshot filesystem Ns | Ns Ar volume +.Nm +.Cm promote +.Ar clone-filesystem +.Nm +.Cm rename +.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot +.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot +.Nm +.Cm rename +.Fl p +.Ar filesystem Ns | Ns Ar volume +.Ar filesystem Ns | Ns Ar volume +.Nm +.Cm rename +.Fl r +.Ar snapshot snapshot +.Nm +.Cm rename +.Fl u +.Op Fl p +.Ar filesystem filesystem +.Nm +.Cm list +.Op Fl r Ns | Ns Fl d Ar depth +.Op Fl H +.Op Fl o Ar property Ns Op , Ns Ar ... +.Op Fl t Ar type Ns Op , Ns Ar ... +.Op Fl s Ar property +.Ar ... +.Op Fl S Ar property +.Ar ... +.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot +.Nm +.Cm set +.Ar property Ns = Ns Ar value +.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot +.Nm +.Cm get +.Op Fl r Ns | Ns Fl d Ar depth +.Op Fl Hp +.Op Fl o Ar all | field Ns Op , Ns Ar ... +.Op Fl s Ar source Ns Op , Ns Ar ... +.Ar all | property Ns Op , Ns Ar ... +.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot +.Nm +.Cm inherit +.Op Fl rS +.Ar property +.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot +.Nm +.Cm upgrade +.Op Fl v +.Nm +.Cm upgrade +.Op Fl r +.Op Fl V Ar version +.Fl a | Ar filesystem +.Nm +.Cm userspace +.Op Fl niHp +.Op Fl o Ar field Ns Op , Ns Ar ... +.Op Fl sS Ar field +.Ar ... +.Op Fl t Ar type Ns Op , Ns Ar ... +.Ar filesystem Ns | Ns Ar snapshot +.Nm +.Cm groupspace +.Op Fl niHp +.Op Fl o Ar field Ns Op , Ns Ar ... +.Op Fl sS Ar field +.Ar ... +.Op Fl t Ar type Ns Op , Ns Ar ... +.Ar filesystem Ns | Ns Ar snapshot +.Nm +.Cm mount +.Nm +.Cm mount +.Op Fl vO +.Op Fl o Ar property Ns Op , Ns Ar ... +.Fl a | Ar filesystem +.Nm +.Cm unmount +.Op Fl f +.Fl a | Ar filesystem Ns | Ns Ar mountpoint +.Nm +.Cm share +.Fl a | Ar filesystem +.Nm +.Cm unshare +.Fl a | Ar filesystem Ns | Ns Ar mountpoint +.Nm +.Cm send +.Op Fl DvRp +.Op Fl i Ar snapshot | Fl I Ar snapshot +.Ar snapshot +.Nm +.Cm receive +.Op Fl vnFu +.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot +.Nm +.Cm receive +.Op Fl vnFu +.Op Fl d | e +.Ar filesystem +.Nm +.Cm allow +.Ar filesystem Ns | Ns Ar volume +.Nm +.Cm allow +.Op Fl ldug +.Cm everyone Ns | Ns Ar user Ns | Ns Ar group Ns Op , Ns Ar ... +.Ar perm Ns | Ns Ar @setname Ns Op , Ns Ar ... +.Ar filesystem Ns | Ns Ar volume +.Nm +.Cm allow +.Op Fl ld +.Fl e +.Ar perm Ns | Ns Ar @setname Ns Op , Ns Ar ... +.Ar filesystem Ns | Ns Ar volume +.Nm +.Cm allow +.Fl c +.Ar perm Ns | Ns Ar @setname Ns Op , Ns Ar ... +.Ar filesystem Ns | Ns Ar volume +.Nm +.Cm allow +.Fl s +.Ar @setname +.Ar perm Ns | Ns Ar @setname Ns Op , Ns Ar ... +.Ar filesystem Ns | Ns Ar volume +.Nm +.Cm unallow +.Op Fl rldug +.Cm everyone Ns | Ns Ar user Ns | Ns Ar group Ns Op , Ns Ar ... +.Op Ar perm Ns | Ns Ar @setname Ns Op , Ns Ar ... +.Ar filesystem Ns | Ns Ar volume +.Nm +.Cm unallow +.Op Fl rld +.Fl e +.Op Ar perm Ns | Ns Ar @setname Ns Op , Ns Ar ... +.Ar filesystem Ns | Ns Ar volume +.Nm +.Cm unallow +.Op Fl r +.Fl c +.Op Ar perm Ns | Ns Ar @setname Ns Op , Ns Ar ... +.Ar filesystem Ns | Ns Ar volume +.Nm +.Cm unallow +.Op Fl r +.Fl s +.Ar @setname +.Ar perm Ns | Ns Ar @setname Ns Op , Ns Ar ... +.Ar filesystem Ns | Ns Ar volume +.Nm +.Cm hold +.Op Fl r +.Ar tag snapshot ... +.Nm +.Cm holds +.Op Fl r +.Ar snapshot ... +.Nm +.Cm release +.Op Fl r +.Ar tag snapshot ... +.Nm +.Cm diff +.Op Fl FHt +.Ar snapshot +.Op Ar snapshot Ns | Ns Ar filesystem +.Nm +.Cm jail +.Ar jailid filesystem +.Nm +.Cm unjail +.Ar jailid filesystem +.Sh DESCRIPTION +The +.Nm +command configures +.Tn ZFS +datasets within a +.Tn ZFS +storage pool, as described in +.Xr zpool 8 . +A dataset is identified by a unique path within the +.Tn ZFS +namespace. For example: +.Bd -ragged -offset 4n +.No pool/ Ns Brq filesystem,volume,snapshot +.Ed +.Pp +where the maximum length of a dataset name is +.Dv MAXNAMELEN +(256 bytes). +.Pp A dataset can be one of the following: -.sp -.ne 2 -.mk -.na -\fB\fIfile system\fR\fR -.ad -.sp .6 -.RS 4n -A \fBZFS\fR dataset of type \fBfilesystem\fR can be mounted within the standard system namespace and behaves like other file systems. While \fBZFS\fR file systems are designed to be \fBPOSIX\fR compliant, known issues exist that prevent compliance in some cases. Applications that depend on standards conformance might fail due to nonstandard behavior when checking file system free space. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fIvolume\fR\fR -.ad -.sp .6 -.RS 4n -A logical volume exported as a raw or block device. This type of dataset should only be used under special circumstances. File systems are typically used in most environments. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fIsnapshot\fR\fR -.ad -.sp .6 -.RS 4n -A read-only version of a file system or volume at a given point in time. It is specified as \fIfilesystem@name\fR or \fIvolume@name\fR. -.RE - -.SS "ZFS File System Hierarchy" -.sp -.LP -A \fBZFS\fR storage pool is a logical collection of devices that provide space for datasets. A storage pool is also the root of the \fBZFS\fR file system hierarchy. -.sp -.LP -The root of the pool can be accessed as a file system, such as mounting and unmounting, taking snapshots, and setting properties. The physical storage characteristics, however, are managed by the \fBzpool\fR(1M) command. -.sp -.LP -See \fBzpool\fR(1M) for more information on creating and administering pools. -.SS "Snapshots" -.sp -.LP -A snapshot is a read-only copy of a file system or volume. Snapshots can be created extremely quickly, and initially consume no additional space within the pool. As data within the active dataset changes, the snapshot consumes more data than would otherwise be shared with the active dataset. -.sp -.LP -Snapshots can have arbitrary names. Snapshots of volumes can be cloned or rolled back, but cannot be accessed independently. -.sp -.LP -File system snapshots can be accessed under the \fB\&.zfs/snapshot\fR directory in the root of the file system. Snapshots are automatically mounted on demand and may be unmounted at regular intervals. The visibility of the \fB\&.zfs\fR directory can be controlled by the \fBsnapdir\fR property. -.SS "Clones" -.sp -.LP -A clone is a writable volume or file system whose initial contents are the same as another dataset. As with snapshots, creating a clone is nearly instantaneous, and initially consumes no additional space. -.sp -.LP -Clones can only be created from a snapshot. When a snapshot is cloned, it creates an implicit dependency between the parent and child. Even though the clone is created somewhere else in the dataset hierarchy, the original snapshot cannot be destroyed as long as a clone exists. The \fBorigin\fR property exposes this dependency, and the \fBdestroy\fR command lists any such dependencies, if they exist. -.sp -.LP -The clone parent-child dependency relationship can be reversed by using the \fBpromote\fR subcommand. This causes the "origin" file system to become a clone of the specified file system, which makes it possible to destroy the file system that the clone was created from. -.SS "Mount Points" -.sp -.LP -Creating a \fBZFS\fR file system is a simple operation, so the number of file systems per system is likely to be numerous. To cope with this, \fBZFS\fR automatically manages mounting and unmounting file systems without the need to edit the \fB/etc/vfstab\fR file. All automatically managed file systems are mounted by \fBZFS\fR at boot time. -.sp -.LP -By default, file systems are mounted under \fB/\fIpath\fR\fR, where \fIpath\fR is the name of the file system in the \fBZFS\fR namespace. Directories are created and destroyed as needed. -.sp -.LP -A file system can also have a mount point set in the \fBmountpoint\fR property. This directory is created as needed, and \fBZFS\fR automatically mounts the file system when the \fBzfs mount -a\fR command is invoked (without editing \fB/etc/vfstab\fR). The \fBmountpoint\fR property can be inherited, so if \fBpool/home\fR has a mount point of \fB/export/stuff\fR, then \fBpool/home/user\fR automatically inherits a mount point of \fB/export/stuff/user\fR. -.sp -.LP -A file system \fBmountpoint\fR property of \fBnone\fR prevents the file system from being mounted. -.sp -.LP -If needed, \fBZFS\fR file systems can also be managed with traditional tools (\fBmount\fR, \fBumount\fR, \fB/etc/vfstab\fR). If a file system's mount point is set to \fBlegacy\fR, \fBZFS\fR makes no attempt to manage the file system, and the administrator is responsible for mounting and unmounting the file system. -.SS "Zones" -.sp -.LP -A \fBZFS\fR file system can be added to a non-global zone by using the \fBzonecfg\fR \fBadd fs\fR subcommand. A \fBZFS\fR file system that is added to a non-global zone must have its \fBmountpoint\fR property set to \fBlegacy\fR. -.sp -.LP -The physical properties of an added file system are controlled by the global administrator. However, the zone administrator can create, modify, or destroy files within the added file system, depending on how the file system is mounted. -.sp -.LP -A dataset can also be delegated to a non-global zone by using the \fBzonecfg\fR \fBadd dataset\fR subcommand. You cannot delegate a dataset to one zone and the children of the same dataset to another zone. The zone administrator can change properties of the dataset or any of its children. However, the \fBquota\fR property is controlled by the global administrator. -.sp -.LP -A \fBZFS\fR volume can be added as a device to a non-global zone by using the \fBzonecfg\fR \fBadd device\fR subcommand. However, its physical properties can be modified only by the global administrator. -.sp -.LP -For more information about \fBzonecfg\fR syntax, see \fBzonecfg\fR(1M). -.sp -.LP -After a dataset is delegated to a non-global zone, the \fBzoned\fR property is automatically set. A zoned file system cannot be mounted in the global zone, since the zone administrator might have to set the mount point to an unacceptable value. -.sp -.LP -The global administrator can forcibly clear the \fBzoned\fR property, though this should be done with extreme care. The global administrator should verify that all the mount points are acceptable before clearing the property. -.SS "Native Properties" -.sp -.LP -Properties are divided into two types, native properties and user-defined (or "user") properties. Native properties either export internal statistics or control \fBZFS\fR behavior. In addition, native properties are either editable or read-only. User properties have no effect on \fBZFS\fR behavior, but you can use them to annotate datasets in a way that is meaningful in your environment. For more information about user properties, see the "User Properties" section, below. -.sp -.LP -Every dataset has a set of properties that export statistics about the dataset as well as control various behaviors. Properties are inherited from the parent unless overridden by the child. Some properties apply only to certain types of datasets (file systems, volumes, or snapshots). -.sp -.LP -The values of numeric properties can be specified using human-readable suffixes (for example, \fBk\fR, \fBKB\fR, \fBM\fR, \fBGb\fR, and so forth, up to \fBZ\fR for zettabyte). The following are all valid (and equal) specifications: -.sp -.in +2 -.nf +.Bl -hang -width 12n +.It Sy file system +A +.Tn ZFS +dataset of type +.Em filesystem +can be mounted within the standard system namespace and behaves like other file +systems. While +.Tn ZFS +file systems are designed to be +.Tn POSIX +compliant, known issues exist that prevent compliance in some cases. +Applications that depend on standards conformance might fail due to nonstandard +behavior when checking file system free space. +.It Sy volume +A logical volume exported as a raw or block device. This type of dataset should +only be used under special circumstances. File systems are typically used in +most environments. +.It Sy snapshot +A read-only version of a file system or volume at a given point in time. It is +specified as +.Em filesystem@name +or +.Em volume@name . +.El +.Ss ZFS File System Hierarchy +A +.Tn ZFS +storage pool is a logical collection of devices that provide space for +datasets. A storage pool is also the root of the +.Tn ZFS +file system hierarchy. +.Pp +The root of the pool can be accessed as a file system, such as mounting and +unmounting, taking snapshots, and setting properties. The physical storage +characteristics, however, are managed by the +.Xr zpool 8 +command. +.Pp +See +.Xr zpool 8 +for more information on creating and administering pools. +.Ss Snapshots +A snapshot is a read-only copy of a file system or volume. Snapshots can be +created extremely quickly, and initially consume no additional space within the +pool. As data within the active dataset changes, the snapshot consumes more +data than would otherwise be shared with the active dataset. +.Pp +Snapshots can have arbitrary names. Snapshots of volumes can be cloned or +rolled back, but cannot be accessed independently. +.Pp +File system snapshots can be accessed under the +.Pa \&.zfs/snapshot +directory in the root of the file system. Snapshots are automatically mounted +on demand and may be unmounted at regular intervals. The visibility of the +.Pa \&.zfs +directory can be controlled by the +.Sy snapdir +property. +.Ss Clones +A clone is a writable volume or file system whose initial contents are the same +as another dataset. As with snapshots, creating a clone is nearly +instantaneous, and initially consumes no additional space. +.Pp +Clones can only be created from a snapshot. When a snapshot is cloned, it +creates an implicit dependency between the parent and child. Even though the +clone is created somewhere else in the dataset hierarchy, the original snapshot +cannot be destroyed as long as a clone exists. The +.Sy origin +property exposes this dependency, and the +.Cm destroy +command lists any such dependencies, if they exist. +.Pp +The clone parent-child dependency relationship can be reversed by using the +.Cm promote +subcommand. This causes the "origin" file system to become a clone of the +specified file system, which makes it possible to destroy the file system that +the clone was created from. +.Ss Mount Points +Creating a +.Tn ZFS +file system is a simple operation, so the number of file systems per system is +likely to be numerous. To cope with this, +.Tn ZFS +automatically manages mounting and unmounting file systems without the need to +edit the +.Pa /etc/fstab +file. All automatically managed file systems are mounted by +.Tn ZFS +at boot time. +.Pp +By default, file systems are mounted under +.Pa /path , +where +.Ar path +is the name of the file system in the +.Tn ZFS +namespace. Directories are created and destroyed as needed. +.Pp +A file system can also have a mount point set in the +.Sy mountpoint +property. This directory is created as needed, and +.Tn ZFS +automatically mounts the file system when the +.Qq Nm Cm mount Fl a +command is invoked (without editing +.Pa /etc/fstab Ns ). +The +.Sy mountpoint +property can be inherited, so if +.Em pool/home +has a mount point of +.Pa /home , +then +.Em pool/home/user +automatically inherits a mount point of +.Pa /home/user . +.Pp +A file system +.Sy mountpoint +property of +.Cm none +prevents the file system from being mounted. +.Pp +If needed, +.Tn ZFS +file systems can also be managed with traditional tools +.Pq Xr mount 8 , Xr umount 8 , Xr fstab 5 . +If a file system's mount point is set to +.Cm legacy , +.Tn ZFS +makes no attempt to manage the file system, and the administrator is +responsible for mounting and unmounting the file system. +.Ss Jails +.No A Tn ZFS +dataset can be attached to a jail by using the +.Qq Nm Cm jail +subcommand. You cannot attach a dataset to one jail and the children of the +same dataset to another jails. To allow managment of the dataset from within +a jail, the +.Sy jailed +property has to be set. The +.Sy quota +property cannot be changed from within a jail. +.Pp +.No A Tn ZFS +dataset can be detached from a jail using the +.Qq Nm Cm unjail +subcommand. +.Pp +After a dataset is attached to a jail and the jailed property is set, a jailed +file system cannot be mounted outside the jail, since the jail administrator +might have set the mount point to an unacceptable value. +.Ss Deduplication +Deduplication is the process for removing redundant data at the block-level, +reducing the total amount of data stored. If a file system has the +.Cm dedup +property enabled, duplicate data blocks are removed synchronously. The result +is that only unique data is stored and common components are shared among +files. +.Ss Native Properties +Properties are divided into two types, native properties and user-defined (or +"user") properties. Native properties either export internal statistics or +control +.Tn ZFS +behavior. In addition, native properties are either editable or read-only. User +properties have no effect on +.Tn ZFS +behavior, but you can use them to annotate datasets in a way that is meaningful +in your environment. For more information about user properties, see the +.Qq Sx User Properties +section, below. +.Pp +Every dataset has a set of properties that export statistics about the dataset +as well as control various behaviors. Properties are inherited from the parent +unless overridden by the child. Some properties apply only to certain types of +datasets (file systems, volumes, or snapshots). +.Pp +The values of numeric properties can be specified using human-readable suffixes +(for example, +.Sy k , KB , M , Gb , +and so forth, up to +.Sy Z +for zettabyte). The following are all valid (and equal) specifications: +.Bd -ragged -offset 4n 1536M, 1.5g, 1.50GB -.fi -.in -2 -.sp - -.sp -.LP -The values of non-numeric properties are case sensitive and must be lowercase, except for \fBmountpoint\fR, \fBsharenfs\fR, and \fBsharesmb\fR. -.sp -.LP -The following native properties consist of read-only statistics about the dataset. These properties can be neither set, nor inherited. Native properties apply to all dataset types unless otherwise noted. -.sp -.ne 2 -.mk -.na -\fB\fBavailable\fR\fR -.ad -.sp .6 -.RS 4n -The amount of space available to the dataset and all its children, assuming that there is no other activity in the pool. Because space is shared within a pool, availability can be limited by any number of factors, including physical pool size, quotas, reservations, or other datasets within the pool. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 10:55:55 2012 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 B211E1065676; Thu, 5 Jan 2012 10:55:55 +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 999188FC1E; Thu, 5 Jan 2012 10:55: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 q05Attpq030201; Thu, 5 Jan 2012 10:55:55 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05AttM3030197; Thu, 5 Jan 2012 10:55:55 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201051055.q05AttM3030197@svn.freebsd.org> From: Martin Matuska Date: Thu, 5 Jan 2012 10:55:55 +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: r229577 - in stable/8/cddl/contrib/opensolaris/cmd: zdb zfs zpool zstreamdump 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, 05 Jan 2012 10:55:55 -0000 Author: mm Date: Thu Jan 5 10:55:55 2012 New Revision: 229577 URL: http://svn.freebsd.org/changeset/base/229577 Log: MFC zfs manpage update (r227646, r227648, r227649, r227752, r228019, r228045, r228054, r228055) MFC r227646 (partial): Update and desolarization of zfs(8) and zpool(8) manual pages: - synchronized to match new vendor code (Illumos rev. 13513) [1] - removed references to sun commands (replaced with FreeBSD commands) - removed ATTRIBUTES sections - updated SEE ALSO sections - properly updated copyright information (required by CDDL) zfs(8) only: - replaced "Zones" section with new "Jails" section - removed misleading "ZFS Volumes as Swap or Dump Devices" section - updated shareiscsi and sharesmb option information (not supported on FreeBSD) - replace zoned property with jailed property zpool(8) only: - updated device names in examples MFC r227648: Fix reference to fsync(2). Add more references to SEE ALSO section. MFC r227649: More zfs(8) manpage fixes: - remove shareiscsi property - mark casesensitivity property as unsupported - remove reference to Solaris Administration Guide MFC r227752 (partial): Update and desolarization of zdb(8) and zstreamdump(1) manual pages: - synchronized to match new vendor code [1] - removed ATTRIBUTES sections - updated SEE ALSO sections - properly updated copyright information (required by CDDL) MFC r228019: Update ZFS manual pages to a mdoc(7) reimplementation. The zfs(8) and zpool(8) manual pages now match the state of the ZFS module and have been customized for FreeBSD. The new texts of the "Deduplication" subsection in zfs(8), the zpool "split" command, the zfs "dedup" property and several other missing parts have been added from illumos or OpenSolaris snv_134 (CDDL-licensed). The mdoc(7) reimplementation of whole manual pages, the descriptions of the zpool "readonly" property, "zfs diff" command and descriptions of several other missing command flags and/or options were authored by myself. MFC r228045: Add missing -n flag to "zpool import" description. MFC r228054: Add missing warning to zfs(8) for using "zfs destroy" with -r and -R flags. MFC r228055: Use singular form for zfs destroy snapshot in zfs(8). Obtained from: Illumos (as of rev. 13513:f84d4672fdbd) [1] Modified: stable/8/cddl/contrib/opensolaris/cmd/zdb/zdb.8 stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs.8 stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 stable/8/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.1 Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/cmd/zdb/zdb.8 ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zdb/zdb.8 Thu Jan 5 10:55:17 2012 (r229576) +++ stable/8/cddl/contrib/opensolaris/cmd/zdb/zdb.8 Thu Jan 5 10:55:55 2012 (r229577) @@ -1,84 +1,79 @@ '\" te +.\" Copyright (c) 2011, Martin Matuska . +.\" All Rights Reserved. +.\" +.\" The contents of this file are subject to the terms of the +.\" Common Development and Distribution License (the "License"). +.\" You may not use this file except in compliance with the License. +.\" +.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +.\" or http://www.opensolaris.org/os/licensing. +.\" See the License for the specific language governing permissions +.\" and limitations under the License. +.\" +.\" When distributing Covered Code, include this CDDL HEADER in each +.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE. +.\" If applicable, add the following below this CDDL HEADER, with the +.\" fields enclosed by brackets "[]" replaced with your own identifying +.\" information: Portions Copyright [yyyy] [name of copyright owner] +.\" .\" Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved. -.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. -.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. -.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH zdb 1M "31 Oct 2005" "SunOS 5.11" "System Administration Commands" -.SH NAME -zdb \- ZFS debugger -.SH SYNOPSIS -.LP -.nf -\fBzdb\fR \fIpool\fR -.fi - -.SH DESCRIPTION -.sp -.LP -The \fBzdb\fR command is used by support engineers to diagnose failures and gather statistics. Since the \fBZFS\fR file system is always consistent on disk and is self-repairing, \fBzdb\fR should only be run under the direction by a support engineer. -.sp -.LP -If no arguments are specified, \fBzdb\fR, performs basic consistency checks on the pool and associated datasets, and report any problems detected. -.sp -.LP -Any options supported by this command are internal to Sun and subject to change at any time. -.SH EXIT STATUS -.sp -.LP +.\" +.\" $FreeBSD$ +.\" +.Dd November 26, 2011 +.Dt ZDB 8 +.Os +.Sh NAME +.Nm zdb +.Nd ZFS debugger +.Sh SYNOPSIS +.Nm +.Ar pool +.Sh DESCRIPTION +The +.Nm +command is used by support engineers to diagnose failures and +gather statistics. Since the +.Tn ZFS +file system is always consistent on disk and is self-repairing, +.Nm +should only be run under the direction by a support engineer. +.Pp +If no arguments are specified, +.Nm +performs basic consistency checks on the pool and associated datasets, and +report any problems detected. +.Nm +Any options supported by this command are internal to Sun and subject to change +at any time. +.Sh EXIT STATUS The following exit values are returned: -.sp -.ne 2 -.mk -.na -\fB\fB0\fR\fR -.ad -.RS 5n -.rt +.Bl -tag -offset 2n -width 2n +.It 0 The pool is consistent. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fB1\fR\fR -.ad -.RS 5n -.rt +.It 1 An error was detected. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fB2\fR\fR -.ad -.RS 5n -.rt +.It 2 Invalid command line options were specified. -.RE - -.SH ATTRIBUTES -.sp -.LP -See \fBattributes\fR(5) for descriptions of the following attributes: -.sp - -.sp -.TS -tab() box; -cw(2.75i) |cw(2.75i) -lw(2.75i) |lw(2.75i) -. -ATTRIBUTE TYPEATTRIBUTE VALUE -_ -AvailabilitySUNWzfsu -_ -Interface StabilityUnstable -.TE - -.SH SEE ALSO -.sp -.LP -\fBzfs\fR(1M), \fBzpool\fR(1M), \fBattributes\fR(5) +.El +.Sh SEE ALSO +.Xr zfs 8 , +.Xr zpool 8 +.Sh AUTHORS +This manual page is a +.Xr mdoc 7 +reimplementation of the +.Tn OpenSolaris +manual page +.Em zdb(1M) , +modified and customized for +.Fx +and licensed under the +.Tn Common Development and Distribution License +.Pq Tn CDDL . +.Pp +The +.Xr mdoc 7 +implementation of this manual page was initially written by +.An Martin Matuska Aq mm@FreeBSD.org . Modified: stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Jan 5 10:55:17 2012 (r229576) +++ stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Jan 5 10:55:55 2012 (r229577) @@ -1,2701 +1,2726 @@ '\" te -.\" Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved. -.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. -.\" See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with -.\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. -.\" See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with -.\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] +.\" Copyright (c) 2011, Martin Matuska . +.\" All Rights Reserved. +.\" +.\" The contents of this file are subject to the terms of the +.\" Common Development and Distribution License (the "License"). +.\" You may not use this file except in compliance with the License. +.\" +.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +.\" or http://www.opensolaris.org/os/licensing. +.\" See the License for the specific language governing permissions +.\" and limitations under the License. +.\" +.\" When distributing Covered Code, include this CDDL HEADER in each +.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE. +.\" If applicable, add the following below this CDDL HEADER, with the +.\" fields enclosed by brackets "[]" replaced with your own identifying +.\" information: Portions Copyright [yyyy] [name of copyright owner] +.\" +.\" Copyright (c) 2010, Sun Microsystems, Inc. All Rights Reserved. .\" Copyright 2011 Nexenta Systems, Inc. All rights reserved. -.\" Copyright 2011 by Delphix. All rights reserved. -.TH zfs 1M "24 Sep 2009" "SunOS 5.11" "System Administration Commands" -.SH NAME -zfs \- configures ZFS file systems -.SH SYNOPSIS -.LP -.nf -\fBzfs\fR [\fB-?\fR] -.fi - -.LP -.nf -\fBzfs\fR \fBcreate\fR [\fB-p\fR] [\fB-o\fR \fIproperty\fR=\fIvalue\fR] ... \fIfilesystem\fR -.fi - -.LP -.nf -\fBzfs\fR \fBcreate\fR [\fB-ps\fR] [\fB-b\fR \fIblocksize\fR] [\fB-o\fR \fIproperty\fR=\fIvalue\fR] ... \fB-V\fR \fIsize\fR \fIvolume\fR -.fi - -.LP -.nf -\fBzfs\fR \fBdestroy\fR [\fB-rRf\fR] \fIfilesystem\fR|\fIvolume\fR -.fi - -.LP -.nf -\fBzfs\fR \fBdestroy\fR [\fB-rRd\fR] \fIsnapshot\fR -.fi - -.LP -.nf -\fBzfs\fR \fBsnapshot\fR [\fB-r\fR] [\fB-o\fR \fIproperty\fR=\fIvalue\fR]... - \fIfilesystem@snapname\fR|\fIvolume@snapname\fR -.fi - -.LP -.nf -\fBzfs\fR \fBrollback\fR [\fB-rRf\fR] \fIsnapshot\fR -.fi - -.LP -.nf -\fBzfs\fR \fBclone\fR [\fB-p\fR] [\fB-o\fR \fIproperty\fR=\fIvalue\fR] ... \fIsnapshot\fR \fIfilesystem\fR|\fIvolume\fR -.fi - -.LP -.nf -\fBzfs\fR \fBpromote\fR \fIclone-filesystem\fR -.fi - -.LP -.nf -\fBzfs\fR \fBrename\fR \fIfilesystem\fR|\fIvolume\fR|\fIsnapshot\fR - \fIfilesystem\fR|\fIvolume\fR|\fIsnapshot\fR -.fi - -.LP -.nf -\fBzfs\fR \fBrename\fR [\fB-p\fR] \fIfilesystem\fR|\fIvolume\fR \fIfilesystem\fR|\fIvolume\fR -.fi - -.LP -.nf -\fBzfs\fR \fBrename\fR \fB-r\fR \fIsnapshot\fR \fIsnapshot\fR -.fi - -.LP -.nf -\fBzfs\fR \fBrename\fR \fB-u\fR [\fB-p\fR] \fIfilesystem\fR \fIfilesystem\fR -.fi - -.LP -.nf -\fBzfs\fR \fBlist\fR [\fB-r\fR|\fB-d\fR \fIdepth\fR][\fB-H\fR][\fB-o\fR \fIproperty\fR[,...]] [\fB-t\fR \fItype\fR[,...]] - [\fB-s\fR \fIproperty\fR] ... [\fB-S\fR \fIproperty\fR] ... [\fIfilesystem\fR|\fIvolume\fR|\fIsnapshot\fR] ... -.fi - -.LP -.nf -\fBzfs\fR \fBset\fR \fIproperty\fR=\fIvalue\fR \fIfilesystem\fR|\fIvolume\fR|\fIsnapshot\fR ... -.fi - -.LP -.nf -\fBzfs\fR \fBget\fR [\fB-r\fR|\fB-d\fR \fIdepth\fR][\fB-Hp\fR][\fB-o\fR \fIfield\fR[,...]] [\fB-s\fR \fIsource\fR[,...]] - "\fIall\fR" | \fIproperty\fR[,...] \fIfilesystem\fR|\fIvolume\fR|\fIsnapshot\fR ... -.fi - -.LP -.nf -\fBzfs\fR \fBinherit\fR [\fB-r\fR] \fIproperty\fR \fIfilesystem\fR|\fIvolume|snapshot\fR ... -.fi - -.LP -.nf -\fBzfs\fR \fBupgrade\fR [\fB-v\fR] -.fi - -.LP -.nf -\fBzfs\fR \fBupgrade\fR [\fB-r\fR] [\fB-V\fR \fIversion\fR] \fB-a\fR | \fIfilesystem\fR -.fi - -.LP -.nf -\fBzfs\fR \fBuserspace\fR [\fB-niHp\fR] [\fB-o\fR \fIfield\fR[,...]] [\fB-sS\fR \fIfield\fR] ... - [\fB-t\fR \fItype\fR [,...]] \fIfilesystem\fR|\fIsnapshot\fR -.fi - -.LP -.nf -\fBzfs\fR \fBgroupspace\fR [\fB-niHp\fR] [\fB-o\fR \fIfield\fR[,...]] [\fB-sS\fR \fIfield\fR] ... - [\fB-t\fR \fItype\fR [,...]] \fIfilesystem\fR|\fIsnapshot\fR -.fi - -.LP -.nf -\fBzfs\fR \fBmount\fR -.fi - -.LP -.nf -\fBzfs\fR \fBmount\fR [\fB-vO\fR] [\fB-o \fIoptions\fR\fR] \fB-a\fR | \fIfilesystem\fR -.fi - -.LP -.nf -\fBzfs\fR \fBunmount\fR [\fB-f\fR] \fB-a\fR | \fIfilesystem\fR|\fImountpoint\fR -.fi - -.LP -.nf -\fBzfs\fR \fBshare\fR \fB-a\fR | \fIfilesystem\fR -.fi - -.LP -.nf -\fBzfs\fR \fBunshare\fR \fB-a\fR \fIfilesystem\fR|\fImountpoint\fR -.fi - -.LP -.nf -\fBzfs\fR \fBsend\fR [\fB-vR\fR] [\fB-\fR[\fBiI\fR] \fIsnapshot\fR] \fIsnapshot\fR -.fi - -.LP -.nf -\fBzfs\fR \fBreceive\fR [\fB-vnFu\fR] \fIfilesystem\fR|\fIvolume\fR|\fIsnapshot\fR -.fi - -.LP -.nf -\fBzfs\fR \fBreceive\fR [\fB-vnFu\fR] \fB-d\fR \fIfilesystem\fR -.fi - -.LP -.nf -\fBzfs\fR \fBallow\fR \fIfilesystem\fR|\fIvolume\fR -.fi - -.LP -.nf -\fBzfs\fR \fBallow\fR [\fB-ldug\fR] "\fIeveryone\fR"|\fIuser\fR|\fIgroup\fR[,...] \fIperm\fR|\fI@setname\fR[,...] - \fIfilesystem\fR|\fIvolume\fR -.fi - -.LP -.nf -\fBzfs\fR \fBallow\fR [\fB-ld\fR] \fB-e\fR \fIperm\fR|@\fIsetname\fR[,...] \fIfilesystem\fR|\fIvolume\fR -.fi - -.LP -.nf -\fBzfs\fR \fBallow\fR \fB-c\fR \fIperm\fR|@\fIsetname\fR[,...] \fIfilesystem\fR|\fIvolume\fR -.fi - -.LP -.nf -\fBzfs\fR \fBallow\fR \fB-s\fR @\fIsetname\fR \fIperm\fR|@\fIsetname\fR[,...] \fIfilesystem\fR|\fIvolume\fR -.fi - -.LP -.nf -\fBzfs\fR \fBunallow\fR [\fB-rldug\fR] "\fIeveryone\fR"|\fIuser\fR|\fIgroup\fR[,...] [\fIperm\fR|@\fIsetname\fR[,... ]] - \fIfilesystem\fR|\fIvolume\fR -.fi - -.LP -.nf -\fBzfs\fR \fBunallow\fR [\fB-rld\fR] \fB-e\fR [\fIperm\fR|@\fIsetname\fR[,... ]] \fIfilesystem\fR|\fIvolume\fR -.fi - -.LP -.nf -\fBzfs\fR \fBunallow\fR [\fB-r\fR] \fB-c\fR [\fIperm\fR|@\fIsetname\fR[ ... ]] \fIfilesystem\fR|\fIvolume\fR -.fi - -.LP -.nf -\fBzfs\fR \fBunallow\fR [\fB-r\fR] \fB-s\fR @\fIsetname\fR [\fIperm\fR|@\fIsetname\fR[,... ]] \fIfilesystem\fR|\fIvolume\fR -.fi - -.LP -.nf -\fBzfs\fR \fBhold\fR [\fB-r\fR] \fItag\fR \fIsnapshot\fR... -.fi - -.LP -.nf -\fBzfs\fR \fBholds\fR [\fB-r\fR] \fIsnapshot\fR... -.fi - -.LP -.nf -\fBzfs\fR \fBrelease\fR [\fB-r\fR] \fItag\fR \fIsnapshot\fR... -.fi - -\fBzfs\fR \fBjail\fR \fBjailid\fR \fB\fIfilesystem\fR\fR -.fi -.LP -.nf -\fBzfs\fR \fBunjail\fR \fBjailid\fR \fB\fIfilesystem\fR\fR -.fi - -.SH DESCRIPTION -.sp -.LP -The \fBzfs\fR command configures \fBZFS\fR datasets within a \fBZFS\fR storage pool, as described in \fBzpool\fR(1M). A dataset is identified by a unique path within the \fBZFS\fR namespace. For example: -.sp -.in +2 -.nf -pool/{filesystem,volume,snapshot} -.fi -.in -2 -.sp - -.sp -.LP -where the maximum length of a dataset name is \fBMAXNAMELEN\fR (256 bytes). -.sp -.LP +.\" Copyright (c) 2011 by Delphix. All rights reserved. +.\" Copyright (c) 2011, Pawel Jakub Dawidek +.\" +.\" $FreeBSD$ +.\" +.Dd November 26, 2011 +.Dt ZFS 8 +.Os +.Sh NAME +.Nm zfs +.Nd configures ZFS file systems +.Sh SYNOPSIS +.Nm +.Op Fl \&? +.Nm +.Cm create +.Op Fl p +.Op Fl o Ar property Ns = Ns Ar value +.Ar ... filesystem +.Nm +.Cm create +.Op Fl ps +.Op Fl b Ar blocksize +.Op Fl o Ar property Ns = Ns Ar value +.Ar ... +.Fl V +.Ar size volume +.Nm +.Cm destroy +.Op Fl rRf +.Ar filesystem Ns | Ns Ar volume +.Nm +.Cm destroy +.Op Fl rRd +.Ar snapshot +.Nm +.Cm snapshot +.Op Fl r +.Op Fl o Ar property Ns = Ns Ar value +.Ar ... filesystem@snapname Ns | Ns Ar volume@snapname +.Nm +.Cm rollback +.Op Fl rRf +.Ar snapshot +.Nm +.Cm clone +.Op Fl p +.Op Fl o Ar property Ns = Ns Ar value +.Ar ... snapshot filesystem Ns | Ns Ar volume +.Nm +.Cm promote +.Ar clone-filesystem +.Nm +.Cm rename +.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot +.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot +.Nm +.Cm rename +.Fl p +.Ar filesystem Ns | Ns Ar volume +.Ar filesystem Ns | Ns Ar volume +.Nm +.Cm rename +.Fl r +.Ar snapshot snapshot +.Nm +.Cm rename +.Fl u +.Op Fl p +.Ar filesystem filesystem +.Nm +.Cm list +.Op Fl r Ns | Ns Fl d Ar depth +.Op Fl H +.Op Fl o Ar property Ns Op , Ns Ar ... +.Op Fl t Ar type Ns Op , Ns Ar ... +.Op Fl s Ar property +.Ar ... +.Op Fl S Ar property +.Ar ... +.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot +.Nm +.Cm set +.Ar property Ns = Ns Ar value +.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot +.Nm +.Cm get +.Op Fl r Ns | Ns Fl d Ar depth +.Op Fl Hp +.Op Fl o Ar all | field Ns Op , Ns Ar ... +.Op Fl s Ar source Ns Op , Ns Ar ... +.Ar all | property Ns Op , Ns Ar ... +.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot +.Nm +.Cm inherit +.Op Fl rS +.Ar property +.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot +.Nm +.Cm upgrade +.Op Fl v +.Nm +.Cm upgrade +.Op Fl r +.Op Fl V Ar version +.Fl a | Ar filesystem +.Nm +.Cm userspace +.Op Fl niHp +.Op Fl o Ar field Ns Op , Ns Ar ... +.Op Fl sS Ar field +.Ar ... +.Op Fl t Ar type Ns Op , Ns Ar ... +.Ar filesystem Ns | Ns Ar snapshot +.Nm +.Cm groupspace +.Op Fl niHp +.Op Fl o Ar field Ns Op , Ns Ar ... +.Op Fl sS Ar field +.Ar ... +.Op Fl t Ar type Ns Op , Ns Ar ... +.Ar filesystem Ns | Ns Ar snapshot +.Nm +.Cm mount +.Nm +.Cm mount +.Op Fl vO +.Op Fl o Ar property Ns Op , Ns Ar ... +.Fl a | Ar filesystem +.Nm +.Cm unmount +.Op Fl f +.Fl a | Ar filesystem Ns | Ns Ar mountpoint +.Nm +.Cm share +.Fl a | Ar filesystem +.Nm +.Cm unshare +.Fl a | Ar filesystem Ns | Ns Ar mountpoint +.Nm +.Cm send +.Op Fl DvRp +.Op Fl i Ar snapshot | Fl I Ar snapshot +.Ar snapshot +.Nm +.Cm receive +.Op Fl vnFu +.Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot +.Nm +.Cm receive +.Op Fl vnFu +.Op Fl d | e +.Ar filesystem +.Nm +.Cm allow +.Ar filesystem Ns | Ns Ar volume +.Nm +.Cm allow +.Op Fl ldug +.Cm everyone Ns | Ns Ar user Ns | Ns Ar group Ns Op , Ns Ar ... +.Ar perm Ns | Ns Ar @setname Ns Op , Ns Ar ... +.Ar filesystem Ns | Ns Ar volume +.Nm +.Cm allow +.Op Fl ld +.Fl e +.Ar perm Ns | Ns Ar @setname Ns Op , Ns Ar ... +.Ar filesystem Ns | Ns Ar volume +.Nm +.Cm allow +.Fl c +.Ar perm Ns | Ns Ar @setname Ns Op , Ns Ar ... +.Ar filesystem Ns | Ns Ar volume +.Nm +.Cm allow +.Fl s +.Ar @setname +.Ar perm Ns | Ns Ar @setname Ns Op , Ns Ar ... +.Ar filesystem Ns | Ns Ar volume +.Nm +.Cm unallow +.Op Fl rldug +.Cm everyone Ns | Ns Ar user Ns | Ns Ar group Ns Op , Ns Ar ... +.Op Ar perm Ns | Ns Ar @setname Ns Op , Ns Ar ... +.Ar filesystem Ns | Ns Ar volume +.Nm +.Cm unallow +.Op Fl rld +.Fl e +.Op Ar perm Ns | Ns Ar @setname Ns Op , Ns Ar ... +.Ar filesystem Ns | Ns Ar volume +.Nm +.Cm unallow +.Op Fl r +.Fl c +.Op Ar perm Ns | Ns Ar @setname Ns Op , Ns Ar ... +.Ar filesystem Ns | Ns Ar volume +.Nm +.Cm unallow +.Op Fl r +.Fl s +.Ar @setname +.Ar perm Ns | Ns Ar @setname Ns Op , Ns Ar ... +.Ar filesystem Ns | Ns Ar volume +.Nm +.Cm hold +.Op Fl r +.Ar tag snapshot ... +.Nm +.Cm holds +.Op Fl r +.Ar snapshot ... +.Nm +.Cm release +.Op Fl r +.Ar tag snapshot ... +.Nm +.Cm diff +.Op Fl FHt +.Ar snapshot +.Op Ar snapshot Ns | Ns Ar filesystem +.Nm +.Cm jail +.Ar jailid filesystem +.Nm +.Cm unjail +.Ar jailid filesystem +.Sh DESCRIPTION +The +.Nm +command configures +.Tn ZFS +datasets within a +.Tn ZFS +storage pool, as described in +.Xr zpool 8 . +A dataset is identified by a unique path within the +.Tn ZFS +namespace. For example: +.Bd -ragged -offset 4n +.No pool/ Ns Brq filesystem,volume,snapshot +.Ed +.Pp +where the maximum length of a dataset name is +.Dv MAXNAMELEN +(256 bytes). +.Pp A dataset can be one of the following: -.sp -.ne 2 -.mk -.na -\fB\fIfile system\fR\fR -.ad -.sp .6 -.RS 4n -A \fBZFS\fR dataset of type \fBfilesystem\fR can be mounted within the standard system namespace and behaves like other file systems. While \fBZFS\fR file systems are designed to be \fBPOSIX\fR compliant, known issues exist that prevent compliance in some cases. Applications that depend on standards conformance might fail due to nonstandard behavior when checking file system free space. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fIvolume\fR\fR -.ad -.sp .6 -.RS 4n -A logical volume exported as a raw or block device. This type of dataset should only be used under special circumstances. File systems are typically used in most environments. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fIsnapshot\fR\fR -.ad -.sp .6 -.RS 4n -A read-only version of a file system or volume at a given point in time. It is specified as \fIfilesystem@name\fR or \fIvolume@name\fR. -.RE - -.SS "ZFS File System Hierarchy" -.sp -.LP -A \fBZFS\fR storage pool is a logical collection of devices that provide space for datasets. A storage pool is also the root of the \fBZFS\fR file system hierarchy. -.sp -.LP -The root of the pool can be accessed as a file system, such as mounting and unmounting, taking snapshots, and setting properties. The physical storage characteristics, however, are managed by the \fBzpool\fR(1M) command. -.sp -.LP -See \fBzpool\fR(1M) for more information on creating and administering pools. -.SS "Snapshots" -.sp -.LP -A snapshot is a read-only copy of a file system or volume. Snapshots can be created extremely quickly, and initially consume no additional space within the pool. As data within the active dataset changes, the snapshot consumes more data than would otherwise be shared with the active dataset. -.sp -.LP -Snapshots can have arbitrary names. Snapshots of volumes can be cloned or rolled back, but cannot be accessed independently. -.sp -.LP -File system snapshots can be accessed under the \fB\&.zfs/snapshot\fR directory in the root of the file system. Snapshots are automatically mounted on demand and may be unmounted at regular intervals. The visibility of the \fB\&.zfs\fR directory can be controlled by the \fBsnapdir\fR property. -.SS "Clones" -.sp -.LP -A clone is a writable volume or file system whose initial contents are the same as another dataset. As with snapshots, creating a clone is nearly instantaneous, and initially consumes no additional space. -.sp -.LP -Clones can only be created from a snapshot. When a snapshot is cloned, it creates an implicit dependency between the parent and child. Even though the clone is created somewhere else in the dataset hierarchy, the original snapshot cannot be destroyed as long as a clone exists. The \fBorigin\fR property exposes this dependency, and the \fBdestroy\fR command lists any such dependencies, if they exist. -.sp -.LP -The clone parent-child dependency relationship can be reversed by using the \fBpromote\fR subcommand. This causes the "origin" file system to become a clone of the specified file system, which makes it possible to destroy the file system that the clone was created from. -.SS "Mount Points" -.sp -.LP -Creating a \fBZFS\fR file system is a simple operation, so the number of file systems per system is likely to be numerous. To cope with this, \fBZFS\fR automatically manages mounting and unmounting file systems without the need to edit the \fB/etc/vfstab\fR file. All automatically managed file systems are mounted by \fBZFS\fR at boot time. -.sp -.LP -By default, file systems are mounted under \fB/\fIpath\fR\fR, where \fIpath\fR is the name of the file system in the \fBZFS\fR namespace. Directories are created and destroyed as needed. -.sp -.LP -A file system can also have a mount point set in the \fBmountpoint\fR property. This directory is created as needed, and \fBZFS\fR automatically mounts the file system when the \fBzfs mount -a\fR command is invoked (without editing \fB/etc/vfstab\fR). The \fBmountpoint\fR property can be inherited, so if \fBpool/home\fR has a mount point of \fB/export/stuff\fR, then \fBpool/home/user\fR automatically inherits a mount point of \fB/export/stuff/user\fR. -.sp -.LP -A file system \fBmountpoint\fR property of \fBnone\fR prevents the file system from being mounted. -.sp -.LP -If needed, \fBZFS\fR file systems can also be managed with traditional tools (\fBmount\fR, \fBumount\fR, \fB/etc/vfstab\fR). If a file system's mount point is set to \fBlegacy\fR, \fBZFS\fR makes no attempt to manage the file system, and the administrator is responsible for mounting and unmounting the file system. -.SS "Zones" -.sp -.LP -A \fBZFS\fR file system can be added to a non-global zone by using the \fBzonecfg\fR \fBadd fs\fR subcommand. A \fBZFS\fR file system that is added to a non-global zone must have its \fBmountpoint\fR property set to \fBlegacy\fR. -.sp -.LP -The physical properties of an added file system are controlled by the global administrator. However, the zone administrator can create, modify, or destroy files within the added file system, depending on how the file system is mounted. -.sp -.LP -A dataset can also be delegated to a non-global zone by using the \fBzonecfg\fR \fBadd dataset\fR subcommand. You cannot delegate a dataset to one zone and the children of the same dataset to another zone. The zone administrator can change properties of the dataset or any of its children. However, the \fBquota\fR property is controlled by the global administrator. -.sp -.LP -A \fBZFS\fR volume can be added as a device to a non-global zone by using the \fBzonecfg\fR \fBadd device\fR subcommand. However, its physical properties can be modified only by the global administrator. -.sp -.LP -For more information about \fBzonecfg\fR syntax, see \fBzonecfg\fR(1M). -.sp -.LP -After a dataset is delegated to a non-global zone, the \fBzoned\fR property is automatically set. A zoned file system cannot be mounted in the global zone, since the zone administrator might have to set the mount point to an unacceptable value. -.sp -.LP -The global administrator can forcibly clear the \fBzoned\fR property, though this should be done with extreme care. The global administrator should verify that all the mount points are acceptable before clearing the property. -.SS "Native Properties" -.sp -.LP -Properties are divided into two types, native properties and user-defined (or "user") properties. Native properties either export internal statistics or control \fBZFS\fR behavior. In addition, native properties are either editable or read-only. User properties have no effect on \fBZFS\fR behavior, but you can use them to annotate datasets in a way that is meaningful in your environment. For more information about user properties, see the "User Properties" section, below. -.sp -.LP -Every dataset has a set of properties that export statistics about the dataset as well as control various behaviors. Properties are inherited from the parent unless overridden by the child. Some properties apply only to certain types of datasets (file systems, volumes, or snapshots). -.sp -.LP -The values of numeric properties can be specified using human-readable suffixes (for example, \fBk\fR, \fBKB\fR, \fBM\fR, \fBGb\fR, and so forth, up to \fBZ\fR for zettabyte). The following are all valid (and equal) specifications: -.sp -.in +2 -.nf +.Bl -hang -width 12n +.It Sy file system +A +.Tn ZFS +dataset of type +.Em filesystem +can be mounted within the standard system namespace and behaves like other file +systems. While +.Tn ZFS +file systems are designed to be +.Tn POSIX +compliant, known issues exist that prevent compliance in some cases. +Applications that depend on standards conformance might fail due to nonstandard +behavior when checking file system free space. +.It Sy volume +A logical volume exported as a raw or block device. This type of dataset should +only be used under special circumstances. File systems are typically used in +most environments. +.It Sy snapshot +A read-only version of a file system or volume at a given point in time. It is +specified as +.Em filesystem@name +or +.Em volume@name . +.El +.Ss ZFS File System Hierarchy +A +.Tn ZFS +storage pool is a logical collection of devices that provide space for +datasets. A storage pool is also the root of the +.Tn ZFS +file system hierarchy. +.Pp +The root of the pool can be accessed as a file system, such as mounting and +unmounting, taking snapshots, and setting properties. The physical storage +characteristics, however, are managed by the +.Xr zpool 8 +command. +.Pp +See +.Xr zpool 8 +for more information on creating and administering pools. +.Ss Snapshots +A snapshot is a read-only copy of a file system or volume. Snapshots can be +created extremely quickly, and initially consume no additional space within the +pool. As data within the active dataset changes, the snapshot consumes more +data than would otherwise be shared with the active dataset. +.Pp +Snapshots can have arbitrary names. Snapshots of volumes can be cloned or +rolled back, but cannot be accessed independently. +.Pp +File system snapshots can be accessed under the +.Pa \&.zfs/snapshot +directory in the root of the file system. Snapshots are automatically mounted +on demand and may be unmounted at regular intervals. The visibility of the +.Pa \&.zfs +directory can be controlled by the +.Sy snapdir +property. +.Ss Clones +A clone is a writable volume or file system whose initial contents are the same +as another dataset. As with snapshots, creating a clone is nearly +instantaneous, and initially consumes no additional space. +.Pp +Clones can only be created from a snapshot. When a snapshot is cloned, it +creates an implicit dependency between the parent and child. Even though the +clone is created somewhere else in the dataset hierarchy, the original snapshot +cannot be destroyed as long as a clone exists. The +.Sy origin +property exposes this dependency, and the +.Cm destroy +command lists any such dependencies, if they exist. +.Pp +The clone parent-child dependency relationship can be reversed by using the +.Cm promote +subcommand. This causes the "origin" file system to become a clone of the +specified file system, which makes it possible to destroy the file system that +the clone was created from. +.Ss Mount Points +Creating a +.Tn ZFS +file system is a simple operation, so the number of file systems per system is +likely to be numerous. To cope with this, +.Tn ZFS +automatically manages mounting and unmounting file systems without the need to +edit the +.Pa /etc/fstab +file. All automatically managed file systems are mounted by +.Tn ZFS +at boot time. +.Pp +By default, file systems are mounted under +.Pa /path , +where +.Ar path +is the name of the file system in the +.Tn ZFS +namespace. Directories are created and destroyed as needed. +.Pp +A file system can also have a mount point set in the +.Sy mountpoint +property. This directory is created as needed, and +.Tn ZFS +automatically mounts the file system when the +.Qq Nm Cm mount Fl a +command is invoked (without editing +.Pa /etc/fstab Ns ). +The +.Sy mountpoint +property can be inherited, so if +.Em pool/home +has a mount point of +.Pa /home , +then +.Em pool/home/user +automatically inherits a mount point of +.Pa /home/user . +.Pp +A file system +.Sy mountpoint +property of +.Cm none +prevents the file system from being mounted. +.Pp +If needed, +.Tn ZFS +file systems can also be managed with traditional tools +.Pq Xr mount 8 , Xr umount 8 , Xr fstab 5 . +If a file system's mount point is set to +.Cm legacy , +.Tn ZFS +makes no attempt to manage the file system, and the administrator is +responsible for mounting and unmounting the file system. +.Ss Jails +.No A Tn ZFS +dataset can be attached to a jail by using the +.Qq Nm Cm jail +subcommand. You cannot attach a dataset to one jail and the children of the +same dataset to another jails. To allow managment of the dataset from within +a jail, the +.Sy jailed +property has to be set. The +.Sy quota +property cannot be changed from within a jail. +.Pp +.No A Tn ZFS +dataset can be detached from a jail using the +.Qq Nm Cm unjail +subcommand. +.Pp +After a dataset is attached to a jail and the jailed property is set, a jailed +file system cannot be mounted outside the jail, since the jail administrator +might have set the mount point to an unacceptable value. +.Ss Deduplication +Deduplication is the process for removing redundant data at the block-level, +reducing the total amount of data stored. If a file system has the +.Cm dedup +property enabled, duplicate data blocks are removed synchronously. The result +is that only unique data is stored and common components are shared among +files. +.Ss Native Properties +Properties are divided into two types, native properties and user-defined (or +"user") properties. Native properties either export internal statistics or +control +.Tn ZFS +behavior. In addition, native properties are either editable or read-only. User +properties have no effect on +.Tn ZFS +behavior, but you can use them to annotate datasets in a way that is meaningful +in your environment. For more information about user properties, see the +.Qq Sx User Properties +section, below. +.Pp +Every dataset has a set of properties that export statistics about the dataset +as well as control various behaviors. Properties are inherited from the parent +unless overridden by the child. Some properties apply only to certain types of +datasets (file systems, volumes, or snapshots). +.Pp +The values of numeric properties can be specified using human-readable suffixes +(for example, +.Sy k , KB , M , Gb , +and so forth, up to +.Sy Z +for zettabyte). The following are all valid (and equal) specifications: +.Bd -ragged -offset 4n 1536M, 1.5g, 1.50GB -.fi -.in -2 -.sp - -.sp -.LP -The values of non-numeric properties are case sensitive and must be lowercase, except for \fBmountpoint\fR, \fBsharenfs\fR, and \fBsharesmb\fR. -.sp -.LP -The following native properties consist of read-only statistics about the dataset. These properties can be neither set, nor inherited. Native properties apply to all dataset types unless otherwise noted. -.sp -.ne 2 -.mk -.na -\fB\fBavailable\fR\fR -.ad -.sp .6 -.RS 4n -The amount of space available to the dataset and all its children, assuming that there is no other activity in the pool. Because space is shared within a pool, availability can be limited by any number of factors, including physical pool size, quotas, reservations, or other datasets within the pool. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 11:06:05 2012 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 C6481106566B; Thu, 5 Jan 2012 11:06:05 +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 AB8108FC0C; Thu, 5 Jan 2012 11:06:05 +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 q05B65H2030675; Thu, 5 Jan 2012 11:06:05 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05B654T030669; Thu, 5 Jan 2012 11:06:05 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201051106.q05B654T030669@svn.freebsd.org> From: Martin Matuska Date: Thu, 5 Jan 2012 11:06:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229578 - in stable/9: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/cmd/ztest cddl/contrib/opensolaris/lib/libzfs/common cddl/lib/libzfs ... 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, 05 Jan 2012 11:06:05 -0000 Author: mm Date: Thu Jan 5 11:06:05 2012 New Revision: 229578 URL: http://svn.freebsd.org/changeset/base/229578 Log: MFC r228103, r228104: MFC r228103: Merge new ZFS features from illumos: 1644 add ZFS "clones" property https://www.illumos.org/issues/1644 1645 add ZFS "written" and "written@..." properties https://www.illumos.org/issues/1645 1646 "zfs send" should estimate size of stream https://www.illumos.org/issues/1646 1647 "zfs destroy" should determine space reclaimed by destroying multiple snapshots https://www.illumos.org/issues/1647 1693 persistent 'comment' field for a zpool https://www.illumos.org/issues/1693 1708 adjust size of zpool history data https://www.illumos.org/issues/1708 1748 desire support for reguid in zfs https://www.illumos.org/issues/1748 MFC r228104: Fix typo in copyright notice. Obtained from: illumos (changesets 13514, 13524, 13525) Added: stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c - copied unchanged from r228103, head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c Deleted: stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_graph.c Modified: stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs.8 stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool.8 stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c stable/9/cddl/contrib/opensolaris/cmd/ztest/ztest.c stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c stable/9/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c stable/9/cddl/lib/libzfs/Makefile stable/9/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c stable/9/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.h stable/9/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bpobj.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deadlist.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deleg.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_deleg.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c stable/9/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h stable/9/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h Directory Properties: stable/9/cddl/contrib/opensolaris/ (props changed) stable/9/cddl/lib/ (props changed) stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Jan 5 10:55:55 2012 (r229577) +++ stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Jan 5 11:06:05 2012 (r229578) @@ -48,12 +48,16 @@ .Ar size volume .Nm .Cm destroy -.Op Fl rRf +.Op Fl fnpRrv .Ar filesystem Ns | Ns Ar volume .Nm .Cm destroy -.Op Fl rRd +.Op Fl dnpRrv +.Sm off .Ar snapshot +.Ns Op % Ns Ar snapname +.Ns Op , Ns Ar ... +.Sm on .Nm .Cm snapshot .Op Fl r @@ -160,7 +164,7 @@ .Fl a | Ar filesystem Ns | Ns Ar mountpoint .Nm .Cm send -.Op Fl DvRp +.Op Fl DnPpRrv .Op Fl i Ar snapshot | Fl I Ar snapshot .Ar snapshot .Nm @@ -487,6 +491,17 @@ The default value is .Cm off . .It Sy creation The time this dataset was created. +.It Sy clones +For snapshots, this property is a comma-separated list of filesystems or +volumes which are clones of this snapshot. The clones' +.Sy origin +property is this snapshot. If the +.Sy clones +property is not empty, then this snapshot can not be destroyed (even with the +.Fl r +or +.Fl f +options). .It Sy defer_destroy This property is .Cm on @@ -644,6 +659,28 @@ power of 2 from 512 bytes to 128 Kbytes .Pp This property can also be referred to by its shortened column name, .Sy volblock . +.It Sy written +The amount of +.Sy referenced +space written to this dataset since the previous snapshot. +.It Sy written@ Ns Ar snapshot +The amount of +.Sy referenced +space written to this dataset since the specified snapshot. This is the space +that is referenced by this dataset but was not referenced by the specified +snapshot. +.Pp +The +.Ar snapshot +may be specified as a short snapshot name (just the part after the +.Sy @ Ns ), +in which case it will be interpreted as a snapshot in the same filesystem as +this dataset. The +.Ar snapshot +may be a full snapshot name +.Pq Em filesystem@snapshot , +which for clones may be a snapshot in the origin's filesystem (or the origin of +the origin's filesystem, etc). .El .Pp The following native properties can be used to change the behavior of a @@ -1403,7 +1440,7 @@ options. .It Xo .Nm .Cm destroy -.Op Fl rRf +.Op Fl fnpRrv .Ar filesystem Ns | Ns Ar volume .Xc .Pp @@ -1422,6 +1459,17 @@ Force an unmount of any file systems usi .Qq Nm Cm unmount Fl f command. This option has no effect on non-file systems or unmounted file systems. +.It Fl n +Do a dry-run ("No-op") deletion. No data will be deleted. This is useful in +conjunction with the +.Fl v +or +.Fl p +flags to determine what data would be deleted. +.It Fl p +Print machine-parsable verbose information about the deleted data. +.It Fl v +Print verbose information about the deleted data. .El .Pp Extreme care should be taken when applying either the @@ -1433,11 +1481,15 @@ behavior for mounted file systems in use .It Xo .Nm .Cm destroy -.Op Fl rRd +.Op Fl dnpRrv +.Sm off .Ar snapshot +.Ns Op % Ns Ar snapname +.Ns Op , Ns Ar ... +.Sm on .Xc .Pp -The given snapshot is destroyed immediately if and only if the +The given snapshots are destroyed immediately if and only if the .Qq Nm Cm destroy command without the .Fl d @@ -1445,15 +1497,41 @@ option would have destroyed it. Such imm example, if the snapshot had no clones and the user-initiated reference count were zero. .Pp -If the snapshot does not qualify for immediate destruction, it is marked for +If a snapshot does not qualify for immediate destruction, it is marked for deferred deletion. In this state, it exists as a usable, visible snapshot until both of the preconditions listed above are met, at which point it is destroyed. +.Pp +An inclusive range of snapshots may be specified by separating the +first and last snapshots with a percent sign +.Pq Sy % . +The first and/or last snapshots may be left blank, in which case the +filesystem's oldest or newest snapshot will be implied. +.Pp +Multiple snapshots +(or ranges of snapshots) of the same filesystem or volume may be specified +in a comma-separated list of snapshots. +Only the snapshot's short name (the +part after the +.Sy @ ) +should be specified when using a range or comma-separated list to identify +multiple snapshots. .Bl -tag -width indent .It Fl r Destroy (or mark for deferred deletion) all snapshots with this name in descendent file systems. .It Fl R Recursively destroy all dependents. +.It Fl n +Do a dry-run ("No-op") deletion. No data will be deleted. This is useful in +conjunction with the +.Fl v +or +.Fl p +flags to determine what data would be deleted. +.It Fl p +Print machine-parsable verbose information about the deleted data. +.It Fl v +Print verbose information about the deleted data. .It Fl d Defer snapshot deletion. .El @@ -2080,7 +2158,7 @@ file system shared on the system. .It Xo .Nm .Cm send -.Op Fl DvRp +.Op Fl DnPpRrv .Op Fl i Ar snapshot | Fl I Ar snapshot .Ar snapshot .Xc @@ -2151,10 +2229,26 @@ be used regardless of the dataset's property, but performance will be much better if the filesystem uses a dedup-capable checksum (eg. .Sy sha256 Ns ). +.It Fl r +Recursively send all descendant snapshots. This is similar to the +.Fl R +flag, but information about deleted and renamed datasets is not included, and +property information is only included if the +.Fl p +flag is specified. .It Fl p Include the dataset's properties in the stream. This flag is implicit when .Fl R is specified. The receiving system must also support this feature. +.It Fl n +Do a dry-run ("No-op") send. Do not generate any actual send data. This is +useful in conjunction with the +.Fl v +or +.Fl P +flags to determine what data will be sent. +.It Fl P +Print machine-parsable verbose information about the stream package generated. .It Fl v Print verbose information about the stream package generated. .El Modified: stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Thu Jan 5 10:55:55 2012 (r229577) +++ stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Thu Jan 5 11:06:05 2012 (r229578) @@ -22,8 +22,9 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + * Copyright (c) 2011 by Delphix. All rights reserved. * Copyright (c) 2011 Pawel Jakub Dawidek . - * All rights reserved. + * Copyright (c) 2011 Martin Matuska . All rights reserved. */ #include @@ -145,7 +146,7 @@ typedef enum { HELP_HOLD, HELP_HOLDS, HELP_RELEASE, - HELP_DIFF + HELP_DIFF, } zfs_help_t; typedef struct zfs_command { @@ -220,8 +221,9 @@ get_usage(zfs_help_t idx) "\tcreate [-ps] [-b blocksize] [-o property=value] ... " "-V \n")); case HELP_DESTROY: - return (gettext("\tdestroy [-rRf] \n" - "\tdestroy [-rRd] \n")); + return (gettext("\tdestroy [-fnpRrv] \n" + "\tdestroy [-dnpRrv] " + "[%][,...]\n")); case HELP_GET: return (gettext("\tget [-rHp] [-d max] " "[-o \"all\" | field[,...]] [-s source[,...]]\n" @@ -260,7 +262,7 @@ get_usage(zfs_help_t idx) case HELP_ROLLBACK: return (gettext("\trollback [-rRf] \n")); case HELP_SEND: - return (gettext("\tsend [-DvRp] " + return (gettext("\tsend [-DnPpRrv] " "[-i snapshot | -I snapshot] \n")); case HELP_SET: return (gettext("\tset " @@ -440,6 +442,8 @@ usage(boolean_t requested) (void) fprintf(fp, "YES NO | none\n"); (void) fprintf(fp, "\t%-15s ", "groupquota@..."); (void) fprintf(fp, "YES NO | none\n"); + (void) fprintf(fp, "\t%-15s ", "written@"); + (void) fprintf(fp, " NO NO \n"); (void) fprintf(fp, gettext("\nSizes are specified in bytes " "with standard units such as K, M, G, etc.\n")); @@ -885,15 +889,23 @@ badusage: */ typedef struct destroy_cbdata { boolean_t cb_first; - int cb_force; - int cb_recurse; - int cb_error; - int cb_needforce; - int cb_doclones; - boolean_t cb_closezhp; + boolean_t cb_force; + boolean_t cb_recurse; + boolean_t cb_error; + boolean_t cb_doclones; zfs_handle_t *cb_target; - char *cb_snapname; boolean_t cb_defer_destroy; + boolean_t cb_verbose; + boolean_t cb_parsable; + boolean_t cb_dryrun; + nvlist_t *cb_nvl; + + /* first snap in contiguous run */ + zfs_handle_t *cb_firstsnap; + /* previous snap in contiguous run */ + zfs_handle_t *cb_prevsnap; + int64_t cb_snapused; + char *cb_snapspec; } destroy_cbdata_t; /* @@ -923,7 +935,7 @@ destroy_check_dependent(zfs_handle_t *zh (void) fprintf(stderr, gettext("use '-r' to destroy " "the following datasets:\n")); cbp->cb_first = B_FALSE; - cbp->cb_error = 1; + cbp->cb_error = B_TRUE; } (void) fprintf(stderr, "%s\n", zfs_get_name(zhp)); @@ -944,7 +956,8 @@ destroy_check_dependent(zfs_handle_t *zh (void) fprintf(stderr, gettext("use '-R' to destroy " "the following datasets:\n")); cbp->cb_first = B_FALSE; - cbp->cb_error = 1; + cbp->cb_error = B_TRUE; + cbp->cb_dryrun = B_TRUE; } (void) fprintf(stderr, "%s\n", zfs_get_name(zhp)); @@ -958,7 +971,20 @@ out: static int destroy_callback(zfs_handle_t *zhp, void *data) { - destroy_cbdata_t *cbp = data; + destroy_cbdata_t *cb = data; + const char *name = zfs_get_name(zhp); + + if (cb->cb_verbose) { + if (cb->cb_parsable) { + (void) printf("destroy\t%s\n", name); + } else if (cb->cb_dryrun) { + (void) printf(gettext("would destroy %s\n"), + name); + } else { + (void) printf(gettext("will destroy %s\n"), + name); + } + } /* * Ignore pools (which we've already flagged as an error before getting @@ -970,13 +996,12 @@ destroy_callback(zfs_handle_t *zhp, void return (0); } - /* - * Bail out on the first error. - */ - if (zfs_unmount(zhp, NULL, cbp->cb_force ? MS_FORCE : 0) != 0 || - zfs_destroy(zhp, cbp->cb_defer_destroy) != 0) { - zfs_close(zhp); - return (-1); + if (!cb->cb_dryrun) { + if (zfs_unmount(zhp, NULL, cb->cb_force ? MS_FORCE : 0) != 0 || + zfs_destroy(zhp, cb->cb_defer_destroy) != 0) { + zfs_close(zhp); + return (-1); + } } zfs_close(zhp); @@ -984,39 +1009,142 @@ destroy_callback(zfs_handle_t *zhp, void } static int -destroy_snap_clones(zfs_handle_t *zhp, void *arg) +destroy_print_cb(zfs_handle_t *zhp, void *arg) { - destroy_cbdata_t *cbp = arg; - char thissnap[MAXPATHLEN]; - zfs_handle_t *szhp; - boolean_t closezhp = cbp->cb_closezhp; - int rv; + destroy_cbdata_t *cb = arg; + const char *name = zfs_get_name(zhp); + int err = 0; - (void) snprintf(thissnap, sizeof (thissnap), - "%s@%s", zfs_get_name(zhp), cbp->cb_snapname); + if (nvlist_exists(cb->cb_nvl, name)) { + if (cb->cb_firstsnap == NULL) + cb->cb_firstsnap = zfs_handle_dup(zhp); + if (cb->cb_prevsnap != NULL) + zfs_close(cb->cb_prevsnap); + /* this snap continues the current range */ + cb->cb_prevsnap = zfs_handle_dup(zhp); + if (cb->cb_verbose) { + if (cb->cb_parsable) { + (void) printf("destroy\t%s\n", name); + } else if (cb->cb_dryrun) { + (void) printf(gettext("would destroy %s\n"), + name); + } else { + (void) printf(gettext("will destroy %s\n"), + name); + } + } + } else if (cb->cb_firstsnap != NULL) { + /* end of this range */ + uint64_t used = 0; + err = zfs_get_snapused_int(cb->cb_firstsnap, + cb->cb_prevsnap, &used); + cb->cb_snapused += used; + zfs_close(cb->cb_firstsnap); + cb->cb_firstsnap = NULL; + zfs_close(cb->cb_prevsnap); + cb->cb_prevsnap = NULL; + } + zfs_close(zhp); + return (err); +} - libzfs_print_on_error(g_zfs, B_FALSE); - szhp = zfs_open(g_zfs, thissnap, ZFS_TYPE_SNAPSHOT); - libzfs_print_on_error(g_zfs, B_TRUE); - if (szhp) { - /* - * Destroy any clones of this snapshot - */ - if (zfs_iter_dependents(szhp, B_FALSE, destroy_callback, - cbp) != 0) { - zfs_close(szhp); - if (closezhp) - zfs_close(zhp); - return (-1); +static int +destroy_print_snapshots(zfs_handle_t *fs_zhp, destroy_cbdata_t *cb) +{ + int err; + assert(cb->cb_firstsnap == NULL); + assert(cb->cb_prevsnap == NULL); + err = zfs_iter_snapshots_sorted(fs_zhp, destroy_print_cb, cb); + if (cb->cb_firstsnap != NULL) { + uint64_t used = 0; + if (err == 0) { + err = zfs_get_snapused_int(cb->cb_firstsnap, + cb->cb_prevsnap, &used); } - zfs_close(szhp); + cb->cb_snapused += used; + zfs_close(cb->cb_firstsnap); + cb->cb_firstsnap = NULL; + zfs_close(cb->cb_prevsnap); + cb->cb_prevsnap = NULL; } + return (err); +} - cbp->cb_closezhp = B_TRUE; - rv = zfs_iter_filesystems(zhp, destroy_snap_clones, arg); - if (closezhp) - zfs_close(zhp); - return (rv); +static int +snapshot_to_nvl_cb(zfs_handle_t *zhp, void *arg) +{ + destroy_cbdata_t *cb = arg; + int err = 0; + + /* Check for clones. */ + if (!cb->cb_doclones) { + cb->cb_target = zhp; + cb->cb_first = B_TRUE; + err = zfs_iter_dependents(zhp, B_TRUE, + destroy_check_dependent, cb); + } + + if (err == 0) { + if (nvlist_add_boolean(cb->cb_nvl, zfs_get_name(zhp))) + nomem(); + } + zfs_close(zhp); + return (err); +} + +static int +gather_snapshots(zfs_handle_t *zhp, void *arg) +{ + destroy_cbdata_t *cb = arg; + int err = 0; + + err = zfs_iter_snapspec(zhp, cb->cb_snapspec, snapshot_to_nvl_cb, cb); + if (err == ENOENT) + err = 0; + if (err != 0) + goto out; + + if (cb->cb_verbose) { + err = destroy_print_snapshots(zhp, cb); + if (err != 0) + goto out; + } + + if (cb->cb_recurse) + err = zfs_iter_filesystems(zhp, gather_snapshots, cb); + +out: + zfs_close(zhp); + return (err); +} + +static int +destroy_clones(destroy_cbdata_t *cb) +{ + nvpair_t *pair; + for (pair = nvlist_next_nvpair(cb->cb_nvl, NULL); + pair != NULL; + pair = nvlist_next_nvpair(cb->cb_nvl, pair)) { + zfs_handle_t *zhp = zfs_open(g_zfs, nvpair_name(pair), + ZFS_TYPE_SNAPSHOT); + if (zhp != NULL) { + boolean_t defer = cb->cb_defer_destroy; + int err; + + /* + * We can't defer destroy non-snapshots, so set it to + * false while destroying the clones. + */ + cb->cb_defer_destroy = B_FALSE; + err = zfs_iter_dependents(zhp, B_FALSE, + destroy_callback, cb); + cb->cb_defer_destroy = defer; + zfs_close(zhp); + if (err != 0) + return (err); + } + } + return (0); } static int @@ -1025,25 +1153,35 @@ zfs_do_destroy(int argc, char **argv) destroy_cbdata_t cb = { 0 }; int c; zfs_handle_t *zhp; - char *cp; + char *at; zfs_type_t type = ZFS_TYPE_DATASET; /* check options */ - while ((c = getopt(argc, argv, "dfrR")) != -1) { + while ((c = getopt(argc, argv, "vpndfrR")) != -1) { switch (c) { + case 'v': + cb.cb_verbose = B_TRUE; + break; + case 'p': + cb.cb_verbose = B_TRUE; + cb.cb_parsable = B_TRUE; + break; + case 'n': + cb.cb_dryrun = B_TRUE; + break; case 'd': cb.cb_defer_destroy = B_TRUE; type = ZFS_TYPE_SNAPSHOT; break; case 'f': - cb.cb_force = 1; + cb.cb_force = B_TRUE; break; case 'r': - cb.cb_recurse = 1; + cb.cb_recurse = B_TRUE; break; case 'R': - cb.cb_recurse = 1; - cb.cb_doclones = 1; + cb.cb_recurse = B_TRUE; + cb.cb_doclones = B_TRUE; break; case '?': default: @@ -1058,7 +1196,7 @@ zfs_do_destroy(int argc, char **argv) /* check number of arguments */ if (argc == 0) { - (void) fprintf(stderr, gettext("missing path argument\n")); + (void) fprintf(stderr, gettext("missing dataset argument\n")); usage(B_FALSE); } if (argc > 1) { @@ -1066,91 +1204,117 @@ zfs_do_destroy(int argc, char **argv) usage(B_FALSE); } - /* - * If we are doing recursive destroy of a snapshot, then the - * named snapshot may not exist. Go straight to libzfs. - */ - if (cb.cb_recurse && (cp = strchr(argv[0], '@'))) { - int ret; + at = strchr(argv[0], '@'); + if (at != NULL) { + int err; - *cp = '\0'; - if ((zhp = zfs_open(g_zfs, argv[0], ZFS_TYPE_DATASET)) == NULL) + /* Build the list of snaps to destroy in cb_nvl. */ + if (nvlist_alloc(&cb.cb_nvl, NV_UNIQUE_NAME, 0) != 0) + nomem(); + + *at = '\0'; + zhp = zfs_open(g_zfs, argv[0], + ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME); + if (zhp == NULL) return (1); - *cp = '@'; - cp++; - if (cb.cb_doclones) { - boolean_t defer = cb.cb_defer_destroy; + cb.cb_snapspec = at + 1; + if (gather_snapshots(zfs_handle_dup(zhp), &cb) != 0 || + cb.cb_error) { + zfs_close(zhp); + nvlist_free(cb.cb_nvl); + return (1); + } - /* - * Temporarily ignore the defer_destroy setting since - * it's not supported for clones. - */ - cb.cb_defer_destroy = B_FALSE; - cb.cb_snapname = cp; - if (destroy_snap_clones(zhp, &cb) != 0) { - zfs_close(zhp); - return (1); + if (nvlist_empty(cb.cb_nvl)) { + (void) fprintf(stderr, gettext("could not find any " + "snapshots to destroy; check snapshot names.\n")); + zfs_close(zhp); + nvlist_free(cb.cb_nvl); + return (1); + } + + if (cb.cb_verbose) { + char buf[16]; + zfs_nicenum(cb.cb_snapused, buf, sizeof (buf)); + if (cb.cb_parsable) { + (void) printf("reclaim\t%llu\n", + cb.cb_snapused); + } else if (cb.cb_dryrun) { + (void) printf(gettext("would reclaim %s\n"), + buf); + } else { + (void) printf(gettext("will reclaim %s\n"), + buf); } - cb.cb_defer_destroy = defer; } - ret = zfs_destroy_snaps(zhp, cp, cb.cb_defer_destroy); - zfs_close(zhp); - if (ret) { - (void) fprintf(stderr, - gettext("no snapshots destroyed\n")); + if (!cb.cb_dryrun) { + if (cb.cb_doclones) + err = destroy_clones(&cb); + if (err == 0) { + err = zfs_destroy_snaps_nvl(zhp, cb.cb_nvl, + cb.cb_defer_destroy); + } } - return (ret != 0); - } - /* Open the given dataset */ - if ((zhp = zfs_open(g_zfs, argv[0], type)) == NULL) - return (1); + zfs_close(zhp); + nvlist_free(cb.cb_nvl); + if (err != 0) + return (1); + } else { + /* Open the given dataset */ + if ((zhp = zfs_open(g_zfs, argv[0], type)) == NULL) + return (1); - cb.cb_target = zhp; + cb.cb_target = zhp; - /* - * Perform an explicit check for pools before going any further. - */ - if (!cb.cb_recurse && strchr(zfs_get_name(zhp), '/') == NULL && - zfs_get_type(zhp) == ZFS_TYPE_FILESYSTEM) { - (void) fprintf(stderr, gettext("cannot destroy '%s': " - "operation does not apply to pools\n"), - zfs_get_name(zhp)); - (void) fprintf(stderr, gettext("use 'zfs destroy -r " - "%s' to destroy all datasets in the pool\n"), - zfs_get_name(zhp)); - (void) fprintf(stderr, gettext("use 'zpool destroy %s' " - "to destroy the pool itself\n"), zfs_get_name(zhp)); - zfs_close(zhp); - return (1); - } + /* + * Perform an explicit check for pools before going any further. + */ + if (!cb.cb_recurse && strchr(zfs_get_name(zhp), '/') == NULL && + zfs_get_type(zhp) == ZFS_TYPE_FILESYSTEM) { + (void) fprintf(stderr, gettext("cannot destroy '%s': " + "operation does not apply to pools\n"), + zfs_get_name(zhp)); + (void) fprintf(stderr, gettext("use 'zfs destroy -r " + "%s' to destroy all datasets in the pool\n"), + zfs_get_name(zhp)); + (void) fprintf(stderr, gettext("use 'zpool destroy %s' " + "to destroy the pool itself\n"), zfs_get_name(zhp)); + zfs_close(zhp); + return (1); + } - /* - * Check for any dependents and/or clones. - */ - cb.cb_first = B_TRUE; - if (!cb.cb_doclones && !cb.cb_defer_destroy && - zfs_iter_dependents(zhp, B_TRUE, destroy_check_dependent, - &cb) != 0) { - zfs_close(zhp); - return (1); - } + /* + * Check for any dependents and/or clones. + */ + cb.cb_first = B_TRUE; + if (!cb.cb_doclones && + zfs_iter_dependents(zhp, B_TRUE, destroy_check_dependent, + &cb) != 0) { + zfs_close(zhp); + return (1); + } - if (cb.cb_error || (!cb.cb_defer_destroy && - (zfs_iter_dependents(zhp, B_FALSE, destroy_callback, &cb) != 0))) { - zfs_close(zhp); - return (1); - } + if (cb.cb_error) { + zfs_close(zhp); + return (1); + } - /* - * Do the real thing. The callback will close the handle regardless of - * whether it succeeds or not. - */ + if (zfs_iter_dependents(zhp, B_FALSE, destroy_callback, + &cb) != 0) { + zfs_close(zhp); + return (1); + } - if (destroy_callback(zhp, &cb) != 0) - return (1); + /* + * Do the real thing. The callback will close the + * handle regardless of whether it succeeds or not. + */ + if (destroy_callback(zhp, &cb) != 0) + return (1); + } return (0); } @@ -1252,6 +1416,17 @@ get_callback(zfs_handle_t *zhp, void *da zprop_print_one_property(zfs_get_name(zhp), cbp, pl->pl_user_prop, buf, sourcetype, source, NULL); + } else if (zfs_prop_written(pl->pl_user_prop)) { + sourcetype = ZPROP_SRC_LOCAL; + + if (zfs_prop_get_written(zhp, pl->pl_user_prop, + buf, sizeof (buf), cbp->cb_literal) != 0) { + sourcetype = ZPROP_SRC_NONE; + (void) strlcpy(buf, "-", sizeof (buf)); + } + + zprop_print_one_property(zfs_get_name(zhp), cbp, + pl->pl_user_prop, buf, sourcetype, source, NULL); } else { if (nvlist_lookup_nvlist(user_props, pl->pl_user_prop, &propval) != 0) { @@ -1796,8 +1971,8 @@ zfs_do_upgrade(int argc, char **argv) "---------------\n"); (void) printf(gettext(" 1 Initial ZFS filesystem version\n")); (void) printf(gettext(" 2 Enhanced directory entries\n")); - (void) printf(gettext(" 3 Case insensitive and File system " - "unique identifier (FUID)\n")); + (void) printf(gettext(" 3 Case insensitive and filesystem " + "user identifier (FUID)\n")); (void) printf(gettext(" 4 userquota, groupquota " "properties\n")); (void) printf(gettext(" 5 System attributes\n")); @@ -2677,6 +2852,13 @@ print_dataset(zfs_handle_t *zhp, zprop_l else propstr = property; right_justify = B_TRUE; + } else if (zfs_prop_written(pl->pl_user_prop)) { + if (zfs_prop_get_written(zhp, pl->pl_user_prop, + property, sizeof (property), B_FALSE) != 0) + propstr = "-"; + else + propstr = property; + right_justify = B_TRUE; } else { if (nvlist_lookup_nvlist(userprops, pl->pl_user_prop, &propval) != 0) @@ -3303,9 +3485,6 @@ usage: } /* - * zfs send [-vDp] -R [-i|-I <@snap>] - * zfs send [-vDp] [-i|-I <@snap>] - * * Send a backup stream to stdout. */ static int @@ -3317,11 +3496,11 @@ zfs_do_send(int argc, char **argv) zfs_handle_t *zhp; sendflags_t flags = { 0 }; int c, err; - nvlist_t *dbgnv; + nvlist_t *dbgnv = NULL; boolean_t extraverbose = B_FALSE; /* check options */ - while ((c = getopt(argc, argv, ":i:I:RDpv")) != -1) { + while ((c = getopt(argc, argv, ":i:I:RDpvnP")) != -1) { switch (c) { case 'i': if (fromname) @@ -3340,6 +3519,10 @@ zfs_do_send(int argc, char **argv) case 'p': flags.props = B_TRUE; break; + case 'P': + flags.parsable = B_TRUE; + flags.verbose = B_TRUE; + break; case 'v': if (flags.verbose) extraverbose = B_TRUE; @@ -3348,6 +3531,9 @@ zfs_do_send(int argc, char **argv) case 'D': flags.dedup = B_TRUE; break; + case 'n': + flags.dryrun = B_TRUE; + break; case ':': (void) fprintf(stderr, gettext("missing argument for " "'%c' option\n"), optopt); @@ -3373,7 +3559,7 @@ zfs_do_send(int argc, char **argv) usage(B_FALSE); } - if (isatty(STDOUT_FILENO)) { + if (!flags.dryrun && isatty(STDOUT_FILENO)) { (void) fprintf(stderr, gettext("Error: Stream can not be written to a terminal.\n" "You must redirect standard output.\n")); @@ -3427,10 +3613,10 @@ zfs_do_send(int argc, char **argv) if (flags.replicate && fromname == NULL) flags.doall = B_TRUE; - err = zfs_send(zhp, fromname, toname, flags, STDOUT_FILENO, NULL, 0, + err = zfs_send(zhp, fromname, toname, &flags, STDOUT_FILENO, NULL, 0, extraverbose ? &dbgnv : NULL); - if (extraverbose) { + if (extraverbose && dbgnv != NULL) { /* * dump_nvlist prints to stdout, but that's been * redirected to a file. Make it print to stderr @@ -3511,7 +3697,7 @@ zfs_do_receive(int argc, char **argv) return (1); } - err = zfs_receive(g_zfs, argv[0], flags, STDIN_FILENO, NULL); + err = zfs_receive(g_zfs, argv[0], &flags, STDIN_FILENO, NULL); return (err != 0); } Modified: stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool.8 ============================================================================== --- stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Thu Jan 5 10:55:55 2012 (r229577) +++ stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Thu Jan 5 11:06:05 2012 (r229578) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 26, 2011 +.Dd November 28, 2011 .Dt ZPOOL 8 .Os .Sh NAME @@ -133,6 +133,9 @@ .Op Fl e .Ar pool device ... .Nm +.Cm reguid +.Ar pool +.Nm .Cm remove .Ar pool device ... .Nm @@ -1346,6 +1349,14 @@ available to the pool. .El .It Xo .Nm +.Cm reguid +.Ar pool +.Xc +.Pp +Generates a new unique identifier for the pool. You must ensure that all +devices in this pool are online and healthy before performing this action. +.It Xo +.Nm .Cm remove .Ar pool device ... .Xc Modified: stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Jan 5 10:55:55 2012 (r229577) +++ stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Jan 5 11:06:05 2012 (r229578) @@ -22,6 +22,8 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2011 Martin Matuska . All rights reserved. */ #include @@ -68,6 +70,8 @@ static int zpool_do_online(int, char **) static int zpool_do_offline(int, char **); static int zpool_do_clear(int, char **); +static int zpool_do_reguid(int, char **); + static int zpool_do_attach(int, char **); static int zpool_do_detach(int, char **); static int zpool_do_replace(int, char **); @@ -126,7 +130,8 @@ typedef enum { HELP_UPGRADE, HELP_GET, HELP_SET, - HELP_SPLIT + HELP_SPLIT, + HELP_REGUID } zpool_help_t; @@ -172,6 +177,7 @@ static zpool_command_t command_table[] = { "import", zpool_do_import, HELP_IMPORT }, { "export", zpool_do_export, HELP_EXPORT }, { "upgrade", zpool_do_upgrade, HELP_UPGRADE }, + { "reguid", zpool_do_reguid, HELP_REGUID }, { NULL }, { "history", zpool_do_history, HELP_HISTORY }, { "get", zpool_do_get, HELP_GET }, @@ -251,6 +257,8 @@ get_usage(zpool_help_t idx) { return (gettext("\tsplit [-n] [-R altroot] [-o mntopts]\n" "\t [-o property=value] " "[ ...]\n")); + case HELP_REGUID: + return (gettext("\treguid \n")); } abort(); @@ -1454,6 +1462,7 @@ show_import(nvlist_t *config) const char *health; uint_t vsc; int namewidth; + char *comment; verify(nvlist_lookup_string(config, ZPOOL_CONFIG_POOL_NAME, &name) == 0); @@ -1470,9 +1479,9 @@ show_import(nvlist_t *config) reason = zpool_import_status(config, &msgid); - (void) printf(gettext(" pool: %s\n"), name); - (void) printf(gettext(" id: %llu\n"), (u_longlong_t)guid); - (void) printf(gettext(" state: %s"), health); + (void) printf(gettext(" pool: %s\n"), name); + (void) printf(gettext(" id: %llu\n"), (u_longlong_t)guid); + (void) printf(gettext(" state: %s"), health); if (pool_state == POOL_STATE_DESTROYED) (void) printf(gettext(" (DESTROYED)")); (void) printf("\n"); @@ -1481,58 +1490,59 @@ show_import(nvlist_t *config) case ZPOOL_STATUS_MISSING_DEV_R: case ZPOOL_STATUS_MISSING_DEV_NR: case ZPOOL_STATUS_BAD_GUID_SUM: - (void) printf(gettext("status: One or more devices are missing " - "from the system.\n")); + (void) printf(gettext(" status: One or more devices are " + "missing from the system.\n")); break; case ZPOOL_STATUS_CORRUPT_LABEL_R: case ZPOOL_STATUS_CORRUPT_LABEL_NR: - (void) printf(gettext("status: One or more devices contains " + (void) printf(gettext(" status: One or more devices contains " "corrupted data.\n")); break; case ZPOOL_STATUS_CORRUPT_DATA: - (void) printf(gettext("status: The pool data is corrupted.\n")); + (void) printf( + gettext(" status: The pool data is corrupted.\n")); break; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 11:07:08 2012 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 95BE21065670; Thu, 5 Jan 2012 11:07:08 +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 7A0928FC0A; Thu, 5 Jan 2012 11:07:08 +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 q05B78nt030742; Thu, 5 Jan 2012 11:07:08 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05B78NF030735; Thu, 5 Jan 2012 11:07:08 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201051107.q05B78NF030735@svn.freebsd.org> From: Martin Matuska Date: Thu, 5 Jan 2012 11:07:08 +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: r229579 - in stable/8: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/cmd/ztest cddl/contrib/opensolaris/lib/libzfs/common cddl/lib/libzfs ... 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, 05 Jan 2012 11:07:08 -0000 Author: mm Date: Thu Jan 5 11:07:07 2012 New Revision: 229579 URL: http://svn.freebsd.org/changeset/base/229579 Log: MFC r228103, r228104: MFC r228103: Merge new ZFS features from illumos: 1644 add ZFS "clones" property https://www.illumos.org/issues/1644 1645 add ZFS "written" and "written@..." properties https://www.illumos.org/issues/1645 1646 "zfs send" should estimate size of stream https://www.illumos.org/issues/1646 1647 "zfs destroy" should determine space reclaimed by destroying multiple snapshots https://www.illumos.org/issues/1647 1693 persistent 'comment' field for a zpool https://www.illumos.org/issues/1693 1708 adjust size of zpool history data https://www.illumos.org/issues/1708 1748 desire support for reguid in zfs https://www.illumos.org/issues/1748 MFC r228104: Fix typo in copyright notice. Obtained from: illumos (changesets 13514, 13524, 13525) Added: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c - copied unchanged from r228103, head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c Deleted: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_graph.c Modified: stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs.8 stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c stable/8/cddl/contrib/opensolaris/cmd/ztest/ztest.c stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c stable/8/cddl/lib/libzfs/Makefile stable/8/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c stable/8/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.h stable/8/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bpobj.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deadlist.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deleg.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_deleg.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c stable/8/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h stable/8/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) stable/8/cddl/lib/ (props changed) stable/8/sys/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Jan 5 11:06:05 2012 (r229578) +++ stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Jan 5 11:07:07 2012 (r229579) @@ -48,12 +48,16 @@ .Ar size volume .Nm .Cm destroy -.Op Fl rRf +.Op Fl fnpRrv .Ar filesystem Ns | Ns Ar volume .Nm .Cm destroy -.Op Fl rRd +.Op Fl dnpRrv +.Sm off .Ar snapshot +.Ns Op % Ns Ar snapname +.Ns Op , Ns Ar ... +.Sm on .Nm .Cm snapshot .Op Fl r @@ -160,7 +164,7 @@ .Fl a | Ar filesystem Ns | Ns Ar mountpoint .Nm .Cm send -.Op Fl DvRp +.Op Fl DnPpRrv .Op Fl i Ar snapshot | Fl I Ar snapshot .Ar snapshot .Nm @@ -487,6 +491,17 @@ The default value is .Cm off . .It Sy creation The time this dataset was created. +.It Sy clones +For snapshots, this property is a comma-separated list of filesystems or +volumes which are clones of this snapshot. The clones' +.Sy origin +property is this snapshot. If the +.Sy clones +property is not empty, then this snapshot can not be destroyed (even with the +.Fl r +or +.Fl f +options). .It Sy defer_destroy This property is .Cm on @@ -644,6 +659,28 @@ power of 2 from 512 bytes to 128 Kbytes .Pp This property can also be referred to by its shortened column name, .Sy volblock . +.It Sy written +The amount of +.Sy referenced +space written to this dataset since the previous snapshot. +.It Sy written@ Ns Ar snapshot +The amount of +.Sy referenced +space written to this dataset since the specified snapshot. This is the space +that is referenced by this dataset but was not referenced by the specified +snapshot. +.Pp +The +.Ar snapshot +may be specified as a short snapshot name (just the part after the +.Sy @ Ns ), +in which case it will be interpreted as a snapshot in the same filesystem as +this dataset. The +.Ar snapshot +may be a full snapshot name +.Pq Em filesystem@snapshot , +which for clones may be a snapshot in the origin's filesystem (or the origin of +the origin's filesystem, etc). .El .Pp The following native properties can be used to change the behavior of a @@ -1403,7 +1440,7 @@ options. .It Xo .Nm .Cm destroy -.Op Fl rRf +.Op Fl fnpRrv .Ar filesystem Ns | Ns Ar volume .Xc .Pp @@ -1422,6 +1459,17 @@ Force an unmount of any file systems usi .Qq Nm Cm unmount Fl f command. This option has no effect on non-file systems or unmounted file systems. +.It Fl n +Do a dry-run ("No-op") deletion. No data will be deleted. This is useful in +conjunction with the +.Fl v +or +.Fl p +flags to determine what data would be deleted. +.It Fl p +Print machine-parsable verbose information about the deleted data. +.It Fl v +Print verbose information about the deleted data. .El .Pp Extreme care should be taken when applying either the @@ -1433,11 +1481,15 @@ behavior for mounted file systems in use .It Xo .Nm .Cm destroy -.Op Fl rRd +.Op Fl dnpRrv +.Sm off .Ar snapshot +.Ns Op % Ns Ar snapname +.Ns Op , Ns Ar ... +.Sm on .Xc .Pp -The given snapshot is destroyed immediately if and only if the +The given snapshots are destroyed immediately if and only if the .Qq Nm Cm destroy command without the .Fl d @@ -1445,15 +1497,41 @@ option would have destroyed it. Such imm example, if the snapshot had no clones and the user-initiated reference count were zero. .Pp -If the snapshot does not qualify for immediate destruction, it is marked for +If a snapshot does not qualify for immediate destruction, it is marked for deferred deletion. In this state, it exists as a usable, visible snapshot until both of the preconditions listed above are met, at which point it is destroyed. +.Pp +An inclusive range of snapshots may be specified by separating the +first and last snapshots with a percent sign +.Pq Sy % . +The first and/or last snapshots may be left blank, in which case the +filesystem's oldest or newest snapshot will be implied. +.Pp +Multiple snapshots +(or ranges of snapshots) of the same filesystem or volume may be specified +in a comma-separated list of snapshots. +Only the snapshot's short name (the +part after the +.Sy @ ) +should be specified when using a range or comma-separated list to identify +multiple snapshots. .Bl -tag -width indent .It Fl r Destroy (or mark for deferred deletion) all snapshots with this name in descendent file systems. .It Fl R Recursively destroy all dependents. +.It Fl n +Do a dry-run ("No-op") deletion. No data will be deleted. This is useful in +conjunction with the +.Fl v +or +.Fl p +flags to determine what data would be deleted. +.It Fl p +Print machine-parsable verbose information about the deleted data. +.It Fl v +Print verbose information about the deleted data. .It Fl d Defer snapshot deletion. .El @@ -2080,7 +2158,7 @@ file system shared on the system. .It Xo .Nm .Cm send -.Op Fl DvRp +.Op Fl DnPpRrv .Op Fl i Ar snapshot | Fl I Ar snapshot .Ar snapshot .Xc @@ -2151,10 +2229,26 @@ be used regardless of the dataset's property, but performance will be much better if the filesystem uses a dedup-capable checksum (eg. .Sy sha256 Ns ). +.It Fl r +Recursively send all descendant snapshots. This is similar to the +.Fl R +flag, but information about deleted and renamed datasets is not included, and +property information is only included if the +.Fl p +flag is specified. .It Fl p Include the dataset's properties in the stream. This flag is implicit when .Fl R is specified. The receiving system must also support this feature. +.It Fl n +Do a dry-run ("No-op") send. Do not generate any actual send data. This is +useful in conjunction with the +.Fl v +or +.Fl P +flags to determine what data will be sent. +.It Fl P +Print machine-parsable verbose information about the stream package generated. .It Fl v Print verbose information about the stream package generated. .El Modified: stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Thu Jan 5 11:06:05 2012 (r229578) +++ stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Thu Jan 5 11:07:07 2012 (r229579) @@ -22,8 +22,9 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + * Copyright (c) 2011 by Delphix. All rights reserved. * Copyright (c) 2011 Pawel Jakub Dawidek . - * All rights reserved. + * Copyright (c) 2011 Martin Matuska . All rights reserved. */ #include @@ -145,7 +146,7 @@ typedef enum { HELP_HOLD, HELP_HOLDS, HELP_RELEASE, - HELP_DIFF + HELP_DIFF, } zfs_help_t; typedef struct zfs_command { @@ -220,8 +221,9 @@ get_usage(zfs_help_t idx) "\tcreate [-ps] [-b blocksize] [-o property=value] ... " "-V \n")); case HELP_DESTROY: - return (gettext("\tdestroy [-rRf] \n" - "\tdestroy [-rRd] \n")); + return (gettext("\tdestroy [-fnpRrv] \n" + "\tdestroy [-dnpRrv] " + "[%][,...]\n")); case HELP_GET: return (gettext("\tget [-rHp] [-d max] " "[-o \"all\" | field[,...]] [-s source[,...]]\n" @@ -260,7 +262,7 @@ get_usage(zfs_help_t idx) case HELP_ROLLBACK: return (gettext("\trollback [-rRf] \n")); case HELP_SEND: - return (gettext("\tsend [-DvRp] " + return (gettext("\tsend [-DnPpRrv] " "[-i snapshot | -I snapshot] \n")); case HELP_SET: return (gettext("\tset " @@ -440,6 +442,8 @@ usage(boolean_t requested) (void) fprintf(fp, "YES NO | none\n"); (void) fprintf(fp, "\t%-15s ", "groupquota@..."); (void) fprintf(fp, "YES NO | none\n"); + (void) fprintf(fp, "\t%-15s ", "written@"); + (void) fprintf(fp, " NO NO \n"); (void) fprintf(fp, gettext("\nSizes are specified in bytes " "with standard units such as K, M, G, etc.\n")); @@ -885,15 +889,23 @@ badusage: */ typedef struct destroy_cbdata { boolean_t cb_first; - int cb_force; - int cb_recurse; - int cb_error; - int cb_needforce; - int cb_doclones; - boolean_t cb_closezhp; + boolean_t cb_force; + boolean_t cb_recurse; + boolean_t cb_error; + boolean_t cb_doclones; zfs_handle_t *cb_target; - char *cb_snapname; boolean_t cb_defer_destroy; + boolean_t cb_verbose; + boolean_t cb_parsable; + boolean_t cb_dryrun; + nvlist_t *cb_nvl; + + /* first snap in contiguous run */ + zfs_handle_t *cb_firstsnap; + /* previous snap in contiguous run */ + zfs_handle_t *cb_prevsnap; + int64_t cb_snapused; + char *cb_snapspec; } destroy_cbdata_t; /* @@ -923,7 +935,7 @@ destroy_check_dependent(zfs_handle_t *zh (void) fprintf(stderr, gettext("use '-r' to destroy " "the following datasets:\n")); cbp->cb_first = B_FALSE; - cbp->cb_error = 1; + cbp->cb_error = B_TRUE; } (void) fprintf(stderr, "%s\n", zfs_get_name(zhp)); @@ -944,7 +956,8 @@ destroy_check_dependent(zfs_handle_t *zh (void) fprintf(stderr, gettext("use '-R' to destroy " "the following datasets:\n")); cbp->cb_first = B_FALSE; - cbp->cb_error = 1; + cbp->cb_error = B_TRUE; + cbp->cb_dryrun = B_TRUE; } (void) fprintf(stderr, "%s\n", zfs_get_name(zhp)); @@ -958,7 +971,20 @@ out: static int destroy_callback(zfs_handle_t *zhp, void *data) { - destroy_cbdata_t *cbp = data; + destroy_cbdata_t *cb = data; + const char *name = zfs_get_name(zhp); + + if (cb->cb_verbose) { + if (cb->cb_parsable) { + (void) printf("destroy\t%s\n", name); + } else if (cb->cb_dryrun) { + (void) printf(gettext("would destroy %s\n"), + name); + } else { + (void) printf(gettext("will destroy %s\n"), + name); + } + } /* * Ignore pools (which we've already flagged as an error before getting @@ -970,13 +996,12 @@ destroy_callback(zfs_handle_t *zhp, void return (0); } - /* - * Bail out on the first error. - */ - if (zfs_unmount(zhp, NULL, cbp->cb_force ? MS_FORCE : 0) != 0 || - zfs_destroy(zhp, cbp->cb_defer_destroy) != 0) { - zfs_close(zhp); - return (-1); + if (!cb->cb_dryrun) { + if (zfs_unmount(zhp, NULL, cb->cb_force ? MS_FORCE : 0) != 0 || + zfs_destroy(zhp, cb->cb_defer_destroy) != 0) { + zfs_close(zhp); + return (-1); + } } zfs_close(zhp); @@ -984,39 +1009,142 @@ destroy_callback(zfs_handle_t *zhp, void } static int -destroy_snap_clones(zfs_handle_t *zhp, void *arg) +destroy_print_cb(zfs_handle_t *zhp, void *arg) { - destroy_cbdata_t *cbp = arg; - char thissnap[MAXPATHLEN]; - zfs_handle_t *szhp; - boolean_t closezhp = cbp->cb_closezhp; - int rv; + destroy_cbdata_t *cb = arg; + const char *name = zfs_get_name(zhp); + int err = 0; - (void) snprintf(thissnap, sizeof (thissnap), - "%s@%s", zfs_get_name(zhp), cbp->cb_snapname); + if (nvlist_exists(cb->cb_nvl, name)) { + if (cb->cb_firstsnap == NULL) + cb->cb_firstsnap = zfs_handle_dup(zhp); + if (cb->cb_prevsnap != NULL) + zfs_close(cb->cb_prevsnap); + /* this snap continues the current range */ + cb->cb_prevsnap = zfs_handle_dup(zhp); + if (cb->cb_verbose) { + if (cb->cb_parsable) { + (void) printf("destroy\t%s\n", name); + } else if (cb->cb_dryrun) { + (void) printf(gettext("would destroy %s\n"), + name); + } else { + (void) printf(gettext("will destroy %s\n"), + name); + } + } + } else if (cb->cb_firstsnap != NULL) { + /* end of this range */ + uint64_t used = 0; + err = zfs_get_snapused_int(cb->cb_firstsnap, + cb->cb_prevsnap, &used); + cb->cb_snapused += used; + zfs_close(cb->cb_firstsnap); + cb->cb_firstsnap = NULL; + zfs_close(cb->cb_prevsnap); + cb->cb_prevsnap = NULL; + } + zfs_close(zhp); + return (err); +} - libzfs_print_on_error(g_zfs, B_FALSE); - szhp = zfs_open(g_zfs, thissnap, ZFS_TYPE_SNAPSHOT); - libzfs_print_on_error(g_zfs, B_TRUE); - if (szhp) { - /* - * Destroy any clones of this snapshot - */ - if (zfs_iter_dependents(szhp, B_FALSE, destroy_callback, - cbp) != 0) { - zfs_close(szhp); - if (closezhp) - zfs_close(zhp); - return (-1); +static int +destroy_print_snapshots(zfs_handle_t *fs_zhp, destroy_cbdata_t *cb) +{ + int err; + assert(cb->cb_firstsnap == NULL); + assert(cb->cb_prevsnap == NULL); + err = zfs_iter_snapshots_sorted(fs_zhp, destroy_print_cb, cb); + if (cb->cb_firstsnap != NULL) { + uint64_t used = 0; + if (err == 0) { + err = zfs_get_snapused_int(cb->cb_firstsnap, + cb->cb_prevsnap, &used); } - zfs_close(szhp); + cb->cb_snapused += used; + zfs_close(cb->cb_firstsnap); + cb->cb_firstsnap = NULL; + zfs_close(cb->cb_prevsnap); + cb->cb_prevsnap = NULL; } + return (err); +} - cbp->cb_closezhp = B_TRUE; - rv = zfs_iter_filesystems(zhp, destroy_snap_clones, arg); - if (closezhp) - zfs_close(zhp); - return (rv); +static int +snapshot_to_nvl_cb(zfs_handle_t *zhp, void *arg) +{ + destroy_cbdata_t *cb = arg; + int err = 0; + + /* Check for clones. */ + if (!cb->cb_doclones) { + cb->cb_target = zhp; + cb->cb_first = B_TRUE; + err = zfs_iter_dependents(zhp, B_TRUE, + destroy_check_dependent, cb); + } + + if (err == 0) { + if (nvlist_add_boolean(cb->cb_nvl, zfs_get_name(zhp))) + nomem(); + } + zfs_close(zhp); + return (err); +} + +static int +gather_snapshots(zfs_handle_t *zhp, void *arg) +{ + destroy_cbdata_t *cb = arg; + int err = 0; + + err = zfs_iter_snapspec(zhp, cb->cb_snapspec, snapshot_to_nvl_cb, cb); + if (err == ENOENT) + err = 0; + if (err != 0) + goto out; + + if (cb->cb_verbose) { + err = destroy_print_snapshots(zhp, cb); + if (err != 0) + goto out; + } + + if (cb->cb_recurse) + err = zfs_iter_filesystems(zhp, gather_snapshots, cb); + +out: + zfs_close(zhp); + return (err); +} + +static int +destroy_clones(destroy_cbdata_t *cb) +{ + nvpair_t *pair; + for (pair = nvlist_next_nvpair(cb->cb_nvl, NULL); + pair != NULL; + pair = nvlist_next_nvpair(cb->cb_nvl, pair)) { + zfs_handle_t *zhp = zfs_open(g_zfs, nvpair_name(pair), + ZFS_TYPE_SNAPSHOT); + if (zhp != NULL) { + boolean_t defer = cb->cb_defer_destroy; + int err; + + /* + * We can't defer destroy non-snapshots, so set it to + * false while destroying the clones. + */ + cb->cb_defer_destroy = B_FALSE; + err = zfs_iter_dependents(zhp, B_FALSE, + destroy_callback, cb); + cb->cb_defer_destroy = defer; + zfs_close(zhp); + if (err != 0) + return (err); + } + } + return (0); } static int @@ -1025,25 +1153,35 @@ zfs_do_destroy(int argc, char **argv) destroy_cbdata_t cb = { 0 }; int c; zfs_handle_t *zhp; - char *cp; + char *at; zfs_type_t type = ZFS_TYPE_DATASET; /* check options */ - while ((c = getopt(argc, argv, "dfrR")) != -1) { + while ((c = getopt(argc, argv, "vpndfrR")) != -1) { switch (c) { + case 'v': + cb.cb_verbose = B_TRUE; + break; + case 'p': + cb.cb_verbose = B_TRUE; + cb.cb_parsable = B_TRUE; + break; + case 'n': + cb.cb_dryrun = B_TRUE; + break; case 'd': cb.cb_defer_destroy = B_TRUE; type = ZFS_TYPE_SNAPSHOT; break; case 'f': - cb.cb_force = 1; + cb.cb_force = B_TRUE; break; case 'r': - cb.cb_recurse = 1; + cb.cb_recurse = B_TRUE; break; case 'R': - cb.cb_recurse = 1; - cb.cb_doclones = 1; + cb.cb_recurse = B_TRUE; + cb.cb_doclones = B_TRUE; break; case '?': default: @@ -1058,7 +1196,7 @@ zfs_do_destroy(int argc, char **argv) /* check number of arguments */ if (argc == 0) { - (void) fprintf(stderr, gettext("missing path argument\n")); + (void) fprintf(stderr, gettext("missing dataset argument\n")); usage(B_FALSE); } if (argc > 1) { @@ -1066,91 +1204,117 @@ zfs_do_destroy(int argc, char **argv) usage(B_FALSE); } - /* - * If we are doing recursive destroy of a snapshot, then the - * named snapshot may not exist. Go straight to libzfs. - */ - if (cb.cb_recurse && (cp = strchr(argv[0], '@'))) { - int ret; + at = strchr(argv[0], '@'); + if (at != NULL) { + int err; - *cp = '\0'; - if ((zhp = zfs_open(g_zfs, argv[0], ZFS_TYPE_DATASET)) == NULL) + /* Build the list of snaps to destroy in cb_nvl. */ + if (nvlist_alloc(&cb.cb_nvl, NV_UNIQUE_NAME, 0) != 0) + nomem(); + + *at = '\0'; + zhp = zfs_open(g_zfs, argv[0], + ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME); + if (zhp == NULL) return (1); - *cp = '@'; - cp++; - if (cb.cb_doclones) { - boolean_t defer = cb.cb_defer_destroy; + cb.cb_snapspec = at + 1; + if (gather_snapshots(zfs_handle_dup(zhp), &cb) != 0 || + cb.cb_error) { + zfs_close(zhp); + nvlist_free(cb.cb_nvl); + return (1); + } - /* - * Temporarily ignore the defer_destroy setting since - * it's not supported for clones. - */ - cb.cb_defer_destroy = B_FALSE; - cb.cb_snapname = cp; - if (destroy_snap_clones(zhp, &cb) != 0) { - zfs_close(zhp); - return (1); + if (nvlist_empty(cb.cb_nvl)) { + (void) fprintf(stderr, gettext("could not find any " + "snapshots to destroy; check snapshot names.\n")); + zfs_close(zhp); + nvlist_free(cb.cb_nvl); + return (1); + } + + if (cb.cb_verbose) { + char buf[16]; + zfs_nicenum(cb.cb_snapused, buf, sizeof (buf)); + if (cb.cb_parsable) { + (void) printf("reclaim\t%llu\n", + cb.cb_snapused); + } else if (cb.cb_dryrun) { + (void) printf(gettext("would reclaim %s\n"), + buf); + } else { + (void) printf(gettext("will reclaim %s\n"), + buf); } - cb.cb_defer_destroy = defer; } - ret = zfs_destroy_snaps(zhp, cp, cb.cb_defer_destroy); - zfs_close(zhp); - if (ret) { - (void) fprintf(stderr, - gettext("no snapshots destroyed\n")); + if (!cb.cb_dryrun) { + if (cb.cb_doclones) + err = destroy_clones(&cb); + if (err == 0) { + err = zfs_destroy_snaps_nvl(zhp, cb.cb_nvl, + cb.cb_defer_destroy); + } } - return (ret != 0); - } - /* Open the given dataset */ - if ((zhp = zfs_open(g_zfs, argv[0], type)) == NULL) - return (1); + zfs_close(zhp); + nvlist_free(cb.cb_nvl); + if (err != 0) + return (1); + } else { + /* Open the given dataset */ + if ((zhp = zfs_open(g_zfs, argv[0], type)) == NULL) + return (1); - cb.cb_target = zhp; + cb.cb_target = zhp; - /* - * Perform an explicit check for pools before going any further. - */ - if (!cb.cb_recurse && strchr(zfs_get_name(zhp), '/') == NULL && - zfs_get_type(zhp) == ZFS_TYPE_FILESYSTEM) { - (void) fprintf(stderr, gettext("cannot destroy '%s': " - "operation does not apply to pools\n"), - zfs_get_name(zhp)); - (void) fprintf(stderr, gettext("use 'zfs destroy -r " - "%s' to destroy all datasets in the pool\n"), - zfs_get_name(zhp)); - (void) fprintf(stderr, gettext("use 'zpool destroy %s' " - "to destroy the pool itself\n"), zfs_get_name(zhp)); - zfs_close(zhp); - return (1); - } + /* + * Perform an explicit check for pools before going any further. + */ + if (!cb.cb_recurse && strchr(zfs_get_name(zhp), '/') == NULL && + zfs_get_type(zhp) == ZFS_TYPE_FILESYSTEM) { + (void) fprintf(stderr, gettext("cannot destroy '%s': " + "operation does not apply to pools\n"), + zfs_get_name(zhp)); + (void) fprintf(stderr, gettext("use 'zfs destroy -r " + "%s' to destroy all datasets in the pool\n"), + zfs_get_name(zhp)); + (void) fprintf(stderr, gettext("use 'zpool destroy %s' " + "to destroy the pool itself\n"), zfs_get_name(zhp)); + zfs_close(zhp); + return (1); + } - /* - * Check for any dependents and/or clones. - */ - cb.cb_first = B_TRUE; - if (!cb.cb_doclones && !cb.cb_defer_destroy && - zfs_iter_dependents(zhp, B_TRUE, destroy_check_dependent, - &cb) != 0) { - zfs_close(zhp); - return (1); - } + /* + * Check for any dependents and/or clones. + */ + cb.cb_first = B_TRUE; + if (!cb.cb_doclones && + zfs_iter_dependents(zhp, B_TRUE, destroy_check_dependent, + &cb) != 0) { + zfs_close(zhp); + return (1); + } - if (cb.cb_error || (!cb.cb_defer_destroy && - (zfs_iter_dependents(zhp, B_FALSE, destroy_callback, &cb) != 0))) { - zfs_close(zhp); - return (1); - } + if (cb.cb_error) { + zfs_close(zhp); + return (1); + } - /* - * Do the real thing. The callback will close the handle regardless of - * whether it succeeds or not. - */ + if (zfs_iter_dependents(zhp, B_FALSE, destroy_callback, + &cb) != 0) { + zfs_close(zhp); + return (1); + } - if (destroy_callback(zhp, &cb) != 0) - return (1); + /* + * Do the real thing. The callback will close the + * handle regardless of whether it succeeds or not. + */ + if (destroy_callback(zhp, &cb) != 0) + return (1); + } return (0); } @@ -1252,6 +1416,17 @@ get_callback(zfs_handle_t *zhp, void *da zprop_print_one_property(zfs_get_name(zhp), cbp, pl->pl_user_prop, buf, sourcetype, source, NULL); + } else if (zfs_prop_written(pl->pl_user_prop)) { + sourcetype = ZPROP_SRC_LOCAL; + + if (zfs_prop_get_written(zhp, pl->pl_user_prop, + buf, sizeof (buf), cbp->cb_literal) != 0) { + sourcetype = ZPROP_SRC_NONE; + (void) strlcpy(buf, "-", sizeof (buf)); + } + + zprop_print_one_property(zfs_get_name(zhp), cbp, + pl->pl_user_prop, buf, sourcetype, source, NULL); } else { if (nvlist_lookup_nvlist(user_props, pl->pl_user_prop, &propval) != 0) { @@ -1796,8 +1971,8 @@ zfs_do_upgrade(int argc, char **argv) "---------------\n"); (void) printf(gettext(" 1 Initial ZFS filesystem version\n")); (void) printf(gettext(" 2 Enhanced directory entries\n")); - (void) printf(gettext(" 3 Case insensitive and File system " - "unique identifier (FUID)\n")); + (void) printf(gettext(" 3 Case insensitive and filesystem " + "user identifier (FUID)\n")); (void) printf(gettext(" 4 userquota, groupquota " "properties\n")); (void) printf(gettext(" 5 System attributes\n")); @@ -2677,6 +2852,13 @@ print_dataset(zfs_handle_t *zhp, zprop_l else propstr = property; right_justify = B_TRUE; + } else if (zfs_prop_written(pl->pl_user_prop)) { + if (zfs_prop_get_written(zhp, pl->pl_user_prop, + property, sizeof (property), B_FALSE) != 0) + propstr = "-"; + else + propstr = property; + right_justify = B_TRUE; } else { if (nvlist_lookup_nvlist(userprops, pl->pl_user_prop, &propval) != 0) @@ -3303,9 +3485,6 @@ usage: } /* - * zfs send [-vDp] -R [-i|-I <@snap>] - * zfs send [-vDp] [-i|-I <@snap>] - * * Send a backup stream to stdout. */ static int @@ -3317,11 +3496,11 @@ zfs_do_send(int argc, char **argv) zfs_handle_t *zhp; sendflags_t flags = { 0 }; int c, err; - nvlist_t *dbgnv; + nvlist_t *dbgnv = NULL; boolean_t extraverbose = B_FALSE; /* check options */ - while ((c = getopt(argc, argv, ":i:I:RDpv")) != -1) { + while ((c = getopt(argc, argv, ":i:I:RDpvnP")) != -1) { switch (c) { case 'i': if (fromname) @@ -3340,6 +3519,10 @@ zfs_do_send(int argc, char **argv) case 'p': flags.props = B_TRUE; break; + case 'P': + flags.parsable = B_TRUE; + flags.verbose = B_TRUE; + break; case 'v': if (flags.verbose) extraverbose = B_TRUE; @@ -3348,6 +3531,9 @@ zfs_do_send(int argc, char **argv) case 'D': flags.dedup = B_TRUE; break; + case 'n': + flags.dryrun = B_TRUE; + break; case ':': (void) fprintf(stderr, gettext("missing argument for " "'%c' option\n"), optopt); @@ -3373,7 +3559,7 @@ zfs_do_send(int argc, char **argv) usage(B_FALSE); } - if (isatty(STDOUT_FILENO)) { + if (!flags.dryrun && isatty(STDOUT_FILENO)) { (void) fprintf(stderr, gettext("Error: Stream can not be written to a terminal.\n" "You must redirect standard output.\n")); @@ -3427,10 +3613,10 @@ zfs_do_send(int argc, char **argv) if (flags.replicate && fromname == NULL) flags.doall = B_TRUE; - err = zfs_send(zhp, fromname, toname, flags, STDOUT_FILENO, NULL, 0, + err = zfs_send(zhp, fromname, toname, &flags, STDOUT_FILENO, NULL, 0, extraverbose ? &dbgnv : NULL); - if (extraverbose) { + if (extraverbose && dbgnv != NULL) { /* * dump_nvlist prints to stdout, but that's been * redirected to a file. Make it print to stderr @@ -3511,7 +3697,7 @@ zfs_do_receive(int argc, char **argv) return (1); } - err = zfs_receive(g_zfs, argv[0], flags, STDIN_FILENO, NULL); + err = zfs_receive(g_zfs, argv[0], &flags, STDIN_FILENO, NULL); return (err != 0); } Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Thu Jan 5 11:06:05 2012 (r229578) +++ stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Thu Jan 5 11:07:07 2012 (r229579) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 26, 2011 +.Dd November 28, 2011 .Dt ZPOOL 8 .Os .Sh NAME @@ -133,6 +133,9 @@ .Op Fl e .Ar pool device ... .Nm +.Cm reguid +.Ar pool +.Nm .Cm remove .Ar pool device ... .Nm @@ -1346,6 +1349,14 @@ available to the pool. .El .It Xo .Nm +.Cm reguid +.Ar pool +.Xc +.Pp +Generates a new unique identifier for the pool. You must ensure that all +devices in this pool are online and healthy before performing this action. +.It Xo +.Nm .Cm remove .Ar pool device ... .Xc Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Jan 5 11:06:05 2012 (r229578) +++ stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Jan 5 11:07:07 2012 (r229579) @@ -22,6 +22,8 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. + * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2011 Martin Matuska . All rights reserved. */ #include @@ -68,6 +70,8 @@ static int zpool_do_online(int, char **) static int zpool_do_offline(int, char **); static int zpool_do_clear(int, char **); +static int zpool_do_reguid(int, char **); + static int zpool_do_attach(int, char **); static int zpool_do_detach(int, char **); static int zpool_do_replace(int, char **); @@ -126,7 +130,8 @@ typedef enum { HELP_UPGRADE, HELP_GET, HELP_SET, - HELP_SPLIT + HELP_SPLIT, + HELP_REGUID } zpool_help_t; @@ -172,6 +177,7 @@ static zpool_command_t command_table[] = { "import", zpool_do_import, HELP_IMPORT }, { "export", zpool_do_export, HELP_EXPORT }, { "upgrade", zpool_do_upgrade, HELP_UPGRADE }, + { "reguid", zpool_do_reguid, HELP_REGUID }, { NULL }, { "history", zpool_do_history, HELP_HISTORY }, { "get", zpool_do_get, HELP_GET }, @@ -251,6 +257,8 @@ get_usage(zpool_help_t idx) { return (gettext("\tsplit [-n] [-R altroot] [-o mntopts]\n" "\t [-o property=value] " "[ ...]\n")); + case HELP_REGUID: + return (gettext("\treguid \n")); } abort(); @@ -1453,6 +1461,7 @@ show_import(nvlist_t *config) const char *health; uint_t vsc; int namewidth; + char *comment; verify(nvlist_lookup_string(config, ZPOOL_CONFIG_POOL_NAME, &name) == 0); @@ -1469,9 +1478,9 @@ show_import(nvlist_t *config) reason = zpool_import_status(config, &msgid); - (void) printf(gettext(" pool: %s\n"), name); - (void) printf(gettext(" id: %llu\n"), (u_longlong_t)guid); - (void) printf(gettext(" state: %s"), health); + (void) printf(gettext(" pool: %s\n"), name); + (void) printf(gettext(" id: %llu\n"), (u_longlong_t)guid); + (void) printf(gettext(" state: %s"), health); if (pool_state == POOL_STATE_DESTROYED) (void) printf(gettext(" (DESTROYED)")); (void) printf("\n"); @@ -1480,58 +1489,59 @@ show_import(nvlist_t *config) case ZPOOL_STATUS_MISSING_DEV_R: case ZPOOL_STATUS_MISSING_DEV_NR: case ZPOOL_STATUS_BAD_GUID_SUM: - (void) printf(gettext("status: One or more devices are missing " - "from the system.\n")); + (void) printf(gettext(" status: One or more devices are " + "missing from the system.\n")); break; case ZPOOL_STATUS_CORRUPT_LABEL_R: case ZPOOL_STATUS_CORRUPT_LABEL_NR: - (void) printf(gettext("status: One or more devices contains " + (void) printf(gettext(" status: One or more devices contains " "corrupted data.\n")); break; case ZPOOL_STATUS_CORRUPT_DATA: - (void) printf(gettext("status: The pool data is corrupted.\n")); + (void) printf( + gettext(" status: The pool data is corrupted.\n")); break; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 11:11:34 2012 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 46354106566B; Thu, 5 Jan 2012 11:11:34 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2E2D58FC0A; Thu, 5 Jan 2012 11:11: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 q05BBYhk031111; Thu, 5 Jan 2012 11:11:34 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05BBYKe031109; Thu, 5 Jan 2012 11:11:34 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201201051111.q05BBYKe031109@svn.freebsd.org> From: Gleb Smirnoff Date: Thu, 5 Jan 2012 11:11:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229580 - stable/9/sys/netgraph 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, 05 Jan 2012 11:11:34 -0000 Author: glebius Date: Thu Jan 5 11:11:33 2012 New Revision: 229580 URL: http://svn.freebsd.org/changeset/base/229580 Log: Merge r229003: style(9), whitespace and spelling nits. Modified: stable/9/sys/netgraph/ng_base.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netgraph/ng_base.c ============================================================================== --- stable/9/sys/netgraph/ng_base.c Thu Jan 5 11:07:07 2012 (r229579) +++ stable/9/sys/netgraph/ng_base.c Thu Jan 5 11:11:33 2012 (r229580) @@ -1,7 +1,3 @@ -/* - * ng_base.c - */ - /*- * Copyright (c) 1996-1999 Whistle Communications, Inc. * All rights reserved. @@ -330,18 +326,18 @@ ng_alloc_node(void) #define NG_FREE_HOOK(hook) \ do { \ - mtx_lock(&ng_nodelist_mtx); \ + mtx_lock(&ng_nodelist_mtx); \ LIST_INSERT_HEAD(&ng_freehooks, hook, hk_hooks); \ hook->hk_magic = 0; \ - mtx_unlock(&ng_nodelist_mtx); \ + mtx_unlock(&ng_nodelist_mtx); \ } while (0) #define NG_FREE_NODE(node) \ do { \ - mtx_lock(&ng_nodelist_mtx); \ + mtx_lock(&ng_nodelist_mtx); \ LIST_INSERT_HEAD(&ng_freenodes, node, nd_nodes); \ node->nd_magic = 0; \ - mtx_unlock(&ng_nodelist_mtx); \ + mtx_unlock(&ng_nodelist_mtx); \ } while (0) #else /* NETGRAPH_DEBUG */ /*----------------------------------------------*/ @@ -667,8 +663,8 @@ ng_make_node_common(struct ng_type *type break; } } - LIST_INSERT_HEAD(&V_ng_ID_hash[NG_IDHASH_FN(node->nd_ID)], - node, nd_idnodes); + LIST_INSERT_HEAD(&V_ng_ID_hash[NG_IDHASH_FN(node->nd_ID)], node, + nd_idnodes); mtx_unlock(&ng_idhash_mtx); /* Done */ @@ -821,7 +817,7 @@ ng_node2ID(node_p node) ************************************************************************/ /* - * Assign a node a name. Once assigned, the name cannot be changed. + * Assign a node a name. */ int ng_name_node(node_p node, const char *name) @@ -918,27 +914,21 @@ ng_decodeidname(const char *name) u_long val; /* Check for proper length, brackets, no leading junk */ - if ((len < 3) - || (name[0] != '[') - || (name[len - 1] != ']') - || (!isxdigit(name[1]))) { + if ((len < 3) || (name[0] != '[') || (name[len - 1] != ']') || + (!isxdigit(name[1]))) return ((ng_ID_t)0); - } /* Decode number */ val = strtoul(name + 1, &eptr, 16); - if ((eptr - name != len - 1) - || (val == ULONG_MAX) - || (val == 0)) { + if ((eptr - name != len - 1) || (val == ULONG_MAX) || (val == 0)) return ((ng_ID_t)0); - } - return (ng_ID_t)val; + + return ((ng_ID_t)val); } /* * Remove a name from a node. This should only be called * when shutting down and removing the node. - * IF we allow name changing this may be more resurrected. */ void ng_unname(node_p node) @@ -1042,8 +1032,8 @@ ng_findhook(node_p node, const char *nam if (node->nd_type->findhook != NULL) return (*node->nd_type->findhook)(node, name); LIST_FOREACH(hook, &node->nd_hooks, hk_hooks) { - if (NG_HOOK_IS_VALID(hook) - && (strcmp(NG_HOOK_NAME(hook), name) == 0)) + if (NG_HOOK_IS_VALID(hook) && + (strcmp(NG_HOOK_NAME(hook), name) == 0)) return (hook); } return (NULL); @@ -1179,12 +1169,12 @@ ng_newtype(struct ng_type *tp) const size_t namelen = strlen(tp->name); /* Check version and type name fields */ - if ((tp->version != NG_ABI_VERSION) - || (namelen == 0) - || (namelen >= NG_TYPESIZ)) { + if ((tp->version != NG_ABI_VERSION) || (namelen == 0) || + (namelen >= NG_TYPESIZ)) { TRAP_ERROR(); if (tp->version != NG_ABI_VERSION) { - printf("Netgraph: Node type rejected. ABI mismatch. Suggest recompile\n"); + printf("Netgraph: Node type rejected. ABI mismatch. " + "Suggest recompile\n"); } return (EINVAL); } @@ -1632,8 +1622,8 @@ ng_path_parse(char *addr, char **nodep, * return the destination node. */ int -ng_path2noderef(node_p here, const char *address, - node_p *destp, hook_p *lasthook) +ng_path2noderef(node_p here, const char *address, node_p *destp, + hook_p *lasthook) { char fullpath[NG_PATHSIZ]; char *nodename, *path; @@ -1712,10 +1702,9 @@ ng_path2noderef(node_p here, const char mtx_lock(&ng_topo_mtx); /* Can't get there from here... */ - if (hook == NULL - || NG_HOOK_PEER(hook) == NULL - || NG_HOOK_NOT_VALID(hook) - || NG_HOOK_NOT_VALID(NG_HOOK_PEER(hook))) { + if (hook == NULL || NG_HOOK_PEER(hook) == NULL || + NG_HOOK_NOT_VALID(hook) || + NG_HOOK_NOT_VALID(NG_HOOK_PEER(hook))) { TRAP_ERROR(); NG_NODE_UNREF(node); mtx_unlock(&ng_topo_mtx); @@ -1879,9 +1868,9 @@ ng_dequeue(node_p node, int *rw) long t = ngq->q_flags; if (t & WRITER_ACTIVE) { /* There is writer, reader can't proceed. */ - CTR4(KTR_NET, "%20s: node [%x] (%p) queued reader " - "can't proceed; queue flags 0x%lx", __func__, - node->nd_ID, node, t); + CTR4(KTR_NET, "%20s: node [%x] (%p) queued " + "reader can't proceed; queue flags 0x%lx", + __func__, node->nd_ID, node, t); return (NULL); } if (atomic_cmpset_acq_int(&ngq->q_flags, t, @@ -1897,9 +1886,9 @@ ng_dequeue(node_p node, int *rw) *rw = NGQRW_W; } else { /* There is somebody other, writer can't proceed. */ - CTR4(KTR_NET, "%20s: node [%x] (%p) queued writer " - "can't proceed; queue flags 0x%lx", __func__, - node->nd_ID, node, ngq->q_flags); + CTR4(KTR_NET, "%20s: node [%x] (%p) queued writer can't " + "proceed; queue flags 0x%lx", __func__, node->nd_ID, node, + ngq->q_flags); return (NULL); } @@ -1911,10 +1900,9 @@ ng_dequeue(node_p node, int *rw) STAILQ_REMOVE_HEAD(&ngq->queue, el_next); if (STAILQ_EMPTY(&ngq->queue)) atomic_clear_int(&ngq->q_flags, OP_PENDING); - CTR6(KTR_NET, "%20s: node [%x] (%p) returning item %p as %s; " - "queue flags 0x%lx", __func__, - node->nd_ID, node, item, *rw ? "WRITER" : "READER" , - ngq->q_flags); + CTR6(KTR_NET, "%20s: node [%x] (%p) returning item %p as %s; queue " + "flags 0x%lx", __func__, node->nd_ID, node, item, *rw ? "WRITER" : + "READER", ngq->q_flags); return (item); } @@ -1938,7 +1926,7 @@ ng_queue_rw(node_p node, item_p item, i CTR5(KTR_NET, "%20s: node [%x] (%p) queued item %p as %s", __func__, node->nd_ID, node, item, rw ? "WRITER" : "READER" ); - + /* * We can take the worklist lock with the node locked * BUT NOT THE REVERSE! @@ -1956,12 +1944,12 @@ ng_acquire_read(node_p node, item_p item ("%s: working on deadnode", __func__)); /* Reader needs node without writer and pending items. */ - while (1) { + for (;;) { long t = node->nd_input_queue.q_flags; if (t & NGQ_RMASK) break; /* Node is not ready for reader. */ - if (atomic_cmpset_acq_int(&node->nd_input_queue.q_flags, - t, t + READER_INCREMENT)) { + if (atomic_cmpset_acq_int(&node->nd_input_queue.q_flags, t, + t + READER_INCREMENT)) { /* Successfully grabbed node */ CTR4(KTR_NET, "%20s: node [%x] (%p) acquired item %p", __func__, node->nd_ID, node, item); @@ -1984,8 +1972,8 @@ ng_acquire_write(node_p node, item_p ite ("%s: working on deadnode", __func__)); /* Writer needs completely idle node. */ - if (atomic_cmpset_acq_int(&node->nd_input_queue.q_flags, - 0, WRITER_ACTIVE)) { + if (atomic_cmpset_acq_int(&node->nd_input_queue.q_flags, 0, + WRITER_ACTIVE)) { /* Successfully grabbed node */ CTR4(KTR_NET, "%20s: node [%x] (%p) acquired item %p", __func__, node->nd_ID, node, item); @@ -2029,11 +2017,10 @@ ng_upgrade_write(node_p node, item_p ite ng_apply_item(node, item, 0); /* - * Having acted on the item, atomically - * down grade back to READER and finish up + * Having acted on the item, atomically + * downgrade back to READER and finish up. */ - atomic_add_int(&ngq->q_flags, - READER_INCREMENT - WRITER_ACTIVE); + atomic_add_int(&ngq->q_flags, READER_INCREMENT - WRITER_ACTIVE); /* Our caller will call ng_leave_read() */ return; @@ -2201,11 +2188,10 @@ ng_snd_item(item_p item, int flags) size_t st, su, sl; GET_STACK_USAGE(st, su); sl = st - su; - if ((sl * 4 < st) || - ((sl * 2 < st) && ((node->nd_flags & NGF_HI_STACK) || - (hook && (hook->hk_flags & HK_HI_STACK))))) { + if ((sl * 4 < st) || ((sl * 2 < st) && + ((node->nd_flags & NGF_HI_STACK) || (hook && + (hook->hk_flags & HK_HI_STACK))))) queue = 1; - } #endif } @@ -2307,10 +2293,10 @@ ng_apply_item(node_p node, item_p item, } /* * If no receive method, just silently drop it. - * Give preference to the hook over-ride method + * Give preference to the hook over-ride method. */ - if ((!(rcvdata = hook->hk_rcvdata)) - && (!(rcvdata = NG_HOOK_NODE(hook)->nd_type->rcvdata))) { + if ((!(rcvdata = hook->hk_rcvdata)) && + (!(rcvdata = NG_HOOK_NODE(hook)->nd_type->rcvdata))) { error = 0; NG_FREE_ITEM(item); break; @@ -2530,8 +2516,8 @@ ng_generic_msg(node_p here, item_p item, hook_p hook; /* Get response struct */ - NG_MKRESPONSE(resp, msg, sizeof(*hl) - + (nhooks * sizeof(struct linkinfo)), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(*hl) + + (nhooks * sizeof(struct linkinfo)), M_NOWAIT); if (resp == NULL) { error = ENOMEM; break; @@ -2592,8 +2578,8 @@ ng_generic_msg(node_p here, item_p item, mtx_unlock(&ng_namehash_mtx); /* Get response struct */ - NG_MKRESPONSE(resp, msg, sizeof(*nl) - + (num * sizeof(struct nodeinfo)), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(*nl) + + (num * sizeof(struct nodeinfo)), M_NOWAIT); if (resp == NULL) { error = ENOMEM; break; @@ -2643,8 +2629,8 @@ ng_generic_msg(node_p here, item_p item, mtx_unlock(&ng_typelist_mtx); /* Get response struct */ - NG_MKRESPONSE(resp, msg, sizeof(*tl) - + (num * sizeof(struct typeinfo)), M_NOWAIT); + NG_MKRESPONSE(resp, msg, sizeof(*tl) + + (num * sizeof(struct typeinfo)), M_NOWAIT); if (resp == NULL) { error = ENOMEM; break; @@ -2699,16 +2685,16 @@ ng_generic_msg(node_p here, item_p item, bcopy(binary, ascii, sizeof(*binary)); /* Find command by matching typecookie and command number */ - for (c = here->nd_type->cmdlist; - c != NULL && c->name != NULL; c++) { - if (binary->header.typecookie == c->cookie - && binary->header.cmd == c->cmd) + for (c = here->nd_type->cmdlist; c != NULL && c->name != NULL; + c++) { + if (binary->header.typecookie == c->cookie && + binary->header.cmd == c->cmd) break; } if (c == NULL || c->name == NULL) { for (c = ng_generic_cmds; c->name != NULL; c++) { - if (binary->header.typecookie == c->cookie - && binary->header.cmd == c->cmd) + if (binary->header.typecookie == c->cookie && + binary->header.cmd == c->cmd) break; } if (c->name == NULL) { @@ -2802,8 +2788,8 @@ ng_generic_msg(node_p here, item_p item, if (argstype == NULL) { bufSize = 0; } else { - if ((error = ng_parse(argstype, ascii->data, - &off, (u_char *)binary->data, &bufSize)) != 0) { + if ((error = ng_parse(argstype, ascii->data, &off, + (u_char *)binary->data, &bufSize)) != 0) { NG_FREE_MSG(resp); break; } @@ -2834,7 +2820,7 @@ ng_generic_msg(node_p here, item_p item, } /* * Sometimes a generic message may be statically allocated - * to avoid problems with allocating when in tight memeory situations. + * to avoid problems with allocating when in tight memory situations. * Don't free it if it is so. * I break them appart here, because erros may cause a free if the item * in which case we'd be doing it twice. @@ -2868,7 +2854,7 @@ SYSCTL_INT(_net_graph, OID_AUTO, maxdata #ifdef NETGRAPH_DEBUG static TAILQ_HEAD(, ng_item) ng_itemlist = TAILQ_HEAD_INITIALIZER(ng_itemlist); -static int allocated; /* number of items malloc'd */ +static int allocated; /* number of items malloc'd */ #endif /* @@ -2886,7 +2872,7 @@ ng_alloc_item(int type, int flags) KASSERT(((type & ~NGQF_TYPE) == 0), ("%s: incorrect item type: %d", __func__, type)); - item = uma_zalloc((type == NGQF_DATA)?ng_qdzone:ng_qzone, + item = uma_zalloc((type == NGQF_DATA) ? ng_qdzone : ng_qzone, ((flags & NG_WAITOK) ? M_WAITOK : M_NOWAIT) | M_ZERO); if (item) { @@ -2942,8 +2928,8 @@ ng_free_item(item_p item) allocated--; mtx_unlock(&ngq_mtx); #endif - uma_zfree(((item->el_flags & NGQF_TYPE) == NGQF_DATA)? - ng_qdzone:ng_qzone, item); + uma_zfree(((item->el_flags & NGQF_TYPE) == NGQF_DATA) ? + ng_qdzone : ng_qzone, item); } /* @@ -2988,17 +2974,14 @@ int ng_mod_event(module_t mod, int event, void *data) { struct ng_type *const type = data; - int s, error = 0; + int error = 0; switch (event) { case MOD_LOAD: /* Register new netgraph node type */ - s = splnet(); - if ((error = ng_newtype(type)) != 0) { - splx(s); + if ((error = ng_newtype(type)) != 0) break; - } /* Call type specific code */ if (type->mod_event != NULL) @@ -3008,31 +2991,23 @@ ng_mod_event(module_t mod, int event, vo LIST_REMOVE(type, types); mtx_unlock(&ng_typelist_mtx); } - splx(s); break; case MOD_UNLOAD: - s = splnet(); if (type->refs > 1) { /* make sure no nodes exist! */ error = EBUSY; } else { - if (type->refs == 0) { - /* failed load, nothing to undo */ - splx(s); + if (type->refs == 0) /* failed load, nothing to undo */ break; - } if (type->mod_event != NULL) { /* check with type */ error = (*type->mod_event)(mod, event, data); - if (error != 0) { /* type refuses.. */ - splx(s); + if (error != 0) /* type refuses.. */ break; - } } mtx_lock(&ng_typelist_mtx); LIST_REMOVE(type, types); mtx_unlock(&ng_typelist_mtx); } - splx(s); break; default: @@ -3045,7 +3020,7 @@ ng_mod_event(module_t mod, int event, vo return (error); } -#ifdef VIMAGE +#ifdef VIMAGE static void vnet_netgraph_uninit(const void *unused __unused) { @@ -3071,8 +3046,8 @@ vnet_netgraph_uninit(const void *unused if (node != NULL) { if (node == last_killed) { /* This should never happen */ - printf("ng node %s needs" - "NGF_REALLY_DIE\n", node->nd_name); + printf("ng node %s needs NGF_REALLY_DIE\n", + node->nd_name); if (node->nd_flags & NGF_REALLY_DIE) panic("ng node %s won't die", node->nd_name); @@ -3120,8 +3095,9 @@ ngb_mod_event(module_t mod, int event, v ng_qzone = uma_zcreate("NetGraph items", sizeof(struct ng_item), NULL, NULL, NULL, NULL, UMA_ALIGN_CACHE, 0); uma_zone_set_max(ng_qzone, maxalloc); - ng_qdzone = uma_zcreate("NetGraph data items", sizeof(struct ng_item), - NULL, NULL, NULL, NULL, UMA_ALIGN_CACHE, 0); + ng_qdzone = uma_zcreate("NetGraph data items", + sizeof(struct ng_item), NULL, NULL, NULL, NULL, + UMA_ALIGN_CACHE, 0); uma_zone_set_max(ng_qdzone, maxdata); /* Autoconfigure number of threads. */ if (numthreads <= 0) @@ -3356,7 +3332,7 @@ ng_worklist_add(node_p node) * then put us on. */ node->nd_input_queue.q_flags2 |= NGQ2_WORKQ; - NG_NODE_REF(node); /* XXX fafe in mutex? */ + NG_NODE_REF(node); /* XXX safe in mutex? */ NG_WORKLIST_LOCK(); STAILQ_INSERT_TAIL(&ng_worklist, node, nd_input_queue.q_work); NG_WORKLIST_UNLOCK(); @@ -3484,8 +3460,7 @@ ng_address_hook(node_p here, item_p item * that the peer node is present, though maybe invalid. */ mtx_lock(&ng_topo_mtx); - if ((hook == NULL) || - NG_HOOK_NOT_VALID(hook) || + if ((hook == NULL) || NG_HOOK_NOT_VALID(hook) || NG_HOOK_NOT_VALID(peer = NG_HOOK_PEER(hook)) || NG_NODE_NOT_VALID(peernode = NG_PEER_NODE(hook))) { NG_FREE_ITEM(item); @@ -3777,4 +3752,3 @@ ng_macro_test(item_p item) NG_FWD_MSG_HOOK(error, node, item, hook, retaddr); } #endif /* TESTING */ - From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 11:11:46 2012 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 E5B9F106567C; Thu, 5 Jan 2012 11:11:46 +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 CD8538FC0C; Thu, 5 Jan 2012 11:11:46 +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 q05BBkg1031153; Thu, 5 Jan 2012 11:11:46 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05BBkU3031150; Thu, 5 Jan 2012 11:11:46 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201051111.q05BBkU3031150@svn.freebsd.org> From: Martin Matuska Date: Thu, 5 Jan 2012 11:11:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229581 - in stable/9/cddl/contrib/opensolaris/cmd: zfs zpool 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, 05 Jan 2012 11:11:47 -0000 Author: mm Date: Thu Jan 5 11:11:46 2012 New Revision: 229581 URL: http://svn.freebsd.org/changeset/base/229581 Log: MFC r228206, r228353: MFC r228206: Remove unnecesary "Ns" macros and add missing command example to zpool(8). MFC r228353: Some mdoc(7) style and typo fixes to zfs(8). Submitted by: Nobuyuki Koganemaru Modified: stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs.8 stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Directory Properties: stable/9/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Jan 5 11:11:33 2012 (r229580) +++ stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Jan 5 11:11:46 2012 (r229581) @@ -377,7 +377,7 @@ property. This directory is created as n automatically mounts the file system when the .Qq Nm Cm mount Fl a command is invoked (without editing -.Pa /etc/fstab Ns ). +.Pa /etc/fstab ) . The .Sy mountpoint property can be inherited, so if @@ -409,7 +409,7 @@ responsible for mounting and unmounting dataset can be attached to a jail by using the .Qq Nm Cm jail subcommand. You cannot attach a dataset to one jail and the children of the -same dataset to another jails. To allow managment of the dataset from within +same dataset to another jails. To allow management of the dataset from within a jail, the .Sy jailed property has to be set. The @@ -624,10 +624,10 @@ symbol, using one of the following forms .Bl -bullet -offset 2n .It POSIX name (for example, -.Em joe Ns ) +.Em joe ) .It POSIX numeric ID (for example, -.Em 1001 Ns ) +.Em 1001 ) .El .It Sy userrefs This property is set to the number of user holds on this snapshot. User holds @@ -673,7 +673,7 @@ snapshot. The .Ar snapshot may be specified as a short snapshot name (just the part after the -.Sy @ Ns ), +.Sy @ ) , in which case it will be interpreted as a snapshot in the same filesystem as this dataset. The .Ar snapshot @@ -847,7 +847,7 @@ is an integer from 1 (fastest) to 9 (bes is equivalent to .Cm gzip-6 (which is also the default for -.Xr gzip 1 Ns ). +.Xr gzip 1 ) . The .Cm zle compression algorithm compresses runs of zeros. @@ -952,7 +952,7 @@ space calculation does not include space such as snapshots and clones. User space consumption is identified by the .Sy userspace@ Ns Ar user property. -.sp +.Pp Enforcement of user quotas may be delayed by several seconds. This delay means that a user might exceed their quota before the system notices that they are over quota and begins to refuse additional writes with the @@ -960,14 +960,14 @@ over quota and begins to refuse addition error message. See the .Cm userspace subcommand for more information. -.sp +.Pp Unprivileged users can only access their own groups' space usage. The root user, or a user who has been granted the .Sy userquota privilege with .Qq Nm Cm allow , can get and set everyone's quota. -.sp +.Pp This property is not available on volumes, on file systems before version 4, or on pools before version 15. The .Sy userquota@ Ns ... @@ -979,17 +979,17 @@ symbol, using one of the following forms .Bl -bullet -offset 2n .It POSIX name (for example, -.Em joe Ns ) +.Em joe ) .It POSIX numeric ID (for example, -.Em 1001 Ns ) +.Em 1001 ) .El .It Sy groupquota@ Ns Ar group Ns = Ns Ar size | Cm none Limits the amount of space consumed by the specified group. Group space consumption is identified by the .Sy userquota@ Ns Ar user property. -.sp +.Pp Unprivileged users can access only their own groups' space usage. The root user, or a user who has been granted the .Sy groupquota @@ -1020,7 +1020,7 @@ than or equal to 128 Kbytes. Changing the file system's .Sy recordsize affects only files created afterward; existing files are unaffected. -.sp +.Pp This property can also be referred to by its shortened column name, .Sy recsize . .It Sy refquota Ns = Ns Ar size | Cm none @@ -1036,13 +1036,13 @@ The .Sy refreservation reservation is accounted for in the parent datasets' space used, and counts against the parent datasets' quotas and reservations. -.sp +.Pp If .Sy refreservation is set, a snapshot is only allowed if there is enough free pool space outside of this reservation to accommodate the current number of "referenced" bytes in the dataset. -.sp +.Pp This property can also be referred to by its shortened column name, .Sy refreserv . .It Sy reservation Ns = Ns Ar size | Cm none @@ -1161,7 +1161,7 @@ version number of 9 or higher, a is set instead. Any changes to .Sy volsize are reflected in an equivalent change to the reservation (or -.Sy refreservation Ns ). +.Sy refreservation ) . The .Sy volsize can only be set to a multiple of @@ -1174,7 +1174,7 @@ run out of space, resulting in undefined on how the volume is used. These effects can also occur when the volume size is changed while it is in use (particularly when shrinking the size). Extreme care should be used when adjusting the volume size. -.sp +.Pp Though not recommended, a "sparse volume" (also known as "thin provisioning") can be created by specifying the .Fl s @@ -1708,7 +1708,7 @@ Snapshots are displayed if the property is .Cm on (the default is -.Cm off Ns ). +.Cm off ) . The following fields are displayed, .Sy name , used , available , referenced , mountpoint . .Bl -tag -width indent @@ -2168,10 +2168,10 @@ Creates a stream representation of the l argument (not part of .Fl i or -.Fl I Ns ) +.Fl I ) which is written to standard output. The output can be redirected to a file or to a different system (for example, using -.Xr ssh 1 Ns ). +.Xr ssh 1 ) . By default, a full stream is generated. .Bl -tag -width indent .It Fl i Ar snapshot @@ -2180,10 +2180,10 @@ Generate an incremental stream from the to the last .Ar snapshot . The incremental source (the -.Fl i Ar snapshot Ns ) +.Fl i Ar snapshot ) can be specified as the last component of the snapshot name (for example, the part after the -.Sy @ Ns ), +.Sy @ ) , and it is assumed to be from the same file system as the last .Ar snapshot . .Pp @@ -2191,14 +2191,16 @@ If the destination is a clone, the sourc must be fully specified (for example, .Cm pool/fs@origin , not just -.Cm @origin Ns ). +.Cm @origin ) . .It Fl I Ar snapshot Generate a stream package that sends all intermediary snapshots from the -.Fl I Ar snapshot to the last -.Ar snapshot . For example, +.Fl I Ar snapshot +to the last +.Ar snapshot . +For example, .Ic -I @a fs@d is similar to -.Ic -i @a fs@b; -i @b fs@c; -i @c fs@d Ns . +.Ic -i @a fs@b; -i @b fs@c; -i @c fs@d . The incremental source snapshot may be specified as with the .Fl i option. @@ -2223,12 +2225,12 @@ flag is specified when this stream is re .It Fl D Generate a deduplicated stream. Blocks which would have been sent multiple times in the send stream will only be sent once. The receiving system must -also support this feature to recieve a deduplicated stream. This flag can +also support this feature to receive a deduplicated stream. This flag can be used regardless of the dataset's .Sy dedup property, but performance will be much better if the filesystem uses a dedup-capable checksum (eg. -.Sy sha256 Ns ). +.Sy sha256 ) . .It Fl r Recursively send all descendant snapshots. This is similar to the .Fl R @@ -2323,14 +2325,14 @@ option is specified, all but the pool na appended (for example, .Sy b/c@1 appended from sent snapshot -.Sy a/b/c@1 Ns ), +.Sy a/b/c@1 ) , and if the .Fl e option is specified, only the tail of the sent snapshot path is appended (for example, .Sy c@1 appended from sent snapshot -.Sy a/b/c@1 Ns ). +.Sy a/b/c@1 ) . In the case of .Fl d , any file systems needed to replicate the path of the sent snapshot are created @@ -2349,13 +2351,13 @@ Print verbose information about the stre receive operation. .It Fl n Do not actually receive the stream. This can be useful in conjunction with the -.It Fl v +.Fl v option to verify the name the receive operation would use. .It Fl F Force a rollback of the file system to the most recent snapshot before performing the receive operation. If receiving an incremental replication stream (for example, one generated by -.Qq Nm Cm send Fl R Fi iI Ns ) , +.Qq Nm Cm send Fl R Fi iI ) , destroy snapshots and file systems that do not exist on the sending side. .El .It Xo @@ -2409,12 +2411,13 @@ option. .Op Fl e .Ar perm Ns | Ns Ar @setname Ns Op , Ns Ar ... .Xc -Specifies that the permissions be delegated to "everyone." Multiple permissions +Specifies that the permissions be delegated to "everyone". +Multiple permissions may be specified as a comma-separated list. Permission names are the same as .Tn ZFS subcommand and property names. See the property list below. Property set names, which begin with an at sign -.Pq Sy @ Ns , +.Pq Sy @ , may be specified. See the .Fl s form below for details. @@ -2536,7 +2539,7 @@ commands for the specified file system a dynamically, so changes to a set are immediately reflected. Permission sets follow the same naming restrictions as ZFS file systems, but the name must begin with an "at sign" -.Pq Sy @ Ns , +.Pq Sy @ , and can be no more than 64 characters long. .It Xo .Nm @@ -2655,7 +2658,7 @@ Describes differences between a snapshot successor dataset can be a later snapshot or the current filesystem. .Pp The changed files are displayed including the change type. The change type -is displayed ussing a single character. If a file or directory was renamed, +is displayed useing a single character. If a file or directory was renamed, the old and the new names are displayed. .Pp The following change types can be displayed: @@ -2680,9 +2683,9 @@ The following file types can be displaye .It \&B Ta block device .It \&@ Ta symbolic link .It \&= Ta socket -.It \&> Ta door (not supported on Fx Ns ) -.It \&| Ta FIFO (not supported on Fx Ns ) -.It \&P Ta event portal (not supported on Fx Ns ) +.It \&> Ta door (not supported on Fx ) +.It \&| Ta FIFO (not supported on Fx ) +.It \&P Ta event portal (not supported on Fx ) .El .It Fl H Machine-parseable output, fields separated a tab character. Modified: stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool.8 ============================================================================== --- stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Thu Jan 5 11:11:33 2012 (r229580) +++ stable/9/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Thu Jan 5 11:11:46 2012 (r229581) @@ -195,7 +195,7 @@ are supported: .Bl -tag .It Sy disk A block device, typically located under -.Pa /dev Ns . +.Pa /dev . .Tn ZFS can use individual slices or partitions, though the recommended mode of operation is to use whole disks. A disk can be specified by a full path to the @@ -221,13 +221,14 @@ bytes and can withstand .Pq Em N-1 devices failing before data integrity is compromised. .It Sy raidz -.No ( or Sy raidz1 raidz2 raidz3 Ns ). +(or +.Sy raidz1 raidz2 raidz3 ) . A variation on .Sy RAID-5 that allows for better distribution of parity and eliminates the -.Qq Sy RAID-5 No write hole -(in which data and parity become inconsistent after a power loss). Data and -parity is striped across all disks within a +.Qq Sy RAID-5 +write hole (in which data and parity become inconsistent after a power loss). +Data and parity is striped across all disks within a .No raidz group. .Pp @@ -251,7 +252,7 @@ type specifies a triple-parity group. The .Sy raidz No vdev type is an alias for -.Sy raidz1 Ns . +.Sy raidz1 . .Pp A .No raidz @@ -322,6 +323,9 @@ are used to distinguish where a group en following creates two root .No vdev Ns s, each a mirror of two disks: +.Bd -literal -offset 2n +.Li # Ic zpool create mypool mirror da0 da1 mirror da2 da3 +.Ed .Ss Device Failure and Recovery .Tn ZFS supports a rich set of mechanisms for handling device failure and data @@ -421,7 +425,7 @@ hardware-dependent and might not be supp .Ss Hot Spares .Tn ZFS allows devices to be associated with pools as -.Qq hot spares Ns . +.Qq hot spares . These devices are not actively used in the pool, but when an active device fails, it is automatically replaced by a hot spare. To create a pool with hot spares, specify a @@ -537,12 +541,13 @@ Number of blocks within the pool that ar A unique identifier for the pool. .It Sy health The current health of the pool. Health can be -.Qq Sy ONLINE Ns , -.Qq Sy DEGRADED Ns , -.Qq Sy FAULTED Ns , -.Qq Sy OFFLINE Ns , -.Qq Sy REMOVED Ns , or -.Qq Sy UNAVAIL Ns . +.Qq Sy ONLINE , +.Qq Sy DEGRADED , +.Qq Sy FAULTED , +.Qq Sy OFFLINE , +.Qq Sy REMOVED , +or +.Qq Sy UNAVAIL . .It Sy size Total size of the storage pool. .It Sy used @@ -577,7 +582,7 @@ is not a persistent property. It is vali Setting .Sy altroot defaults to using -.Cm cachefile=none Ns , +.Cm cachefile=none , though this may be overridden using an explicit setting. .El .Pp @@ -585,7 +590,7 @@ The following property can only be set a .Bl -tag -width 2n .It Sy readonly Ns = Ns Cm on No | Cm off If set to -.Cm on Ns , +.Cm on , pool will be imported in read-only mode with the following restrictions: .Bl -bullet -offset 2n .It @@ -606,7 +611,7 @@ command: .Bl -tag -width 2n .It Sy autoexpand Ns = Ns Cm on No | Cm off Controls automatic pool expansion when the underlying LUN is grown. If set to -.Qq Cm on Ns , +.Qq Cm on , the pool will be resized according to the size of the expanded device. If the device is part of a mirror or .No raidz @@ -614,20 +619,20 @@ then all devices within that .No mirror/ Ns No raidz group must be expanded before the new space is made available to the pool. The default behavior is -.Qq off Ns . +.Qq off . This property can also be referred to by its shortened column name, -.Sy expand Ns . +.Sy expand . .It Sy autoreplace Ns = Ns Cm on No | Cm off Controls automatic device replacement. If set to -.Qq Cm off Ns , +.Qq Cm off , device replacement must be initiated by the administrator by using the .Qq Nm Cm replace command. If set to -.Qq Cm on Ns , +.Qq Cm on , any new device, found in the same physical location as a device that previously belonged to the pool, is automatically formatted and replaced. The default behavior is -.Qq Cm off Ns . +.Qq Cm off . This property can also be referred to by its shortened column name, "replace". .It Sy bootfs Ns = Ns Ar pool Ns / Ns Ar dataset Identifies the default bootable dataset for the root pool. This property is @@ -650,7 +655,7 @@ creates a temporary pool that is never c Threshold for the number of block ditto copies. If the reference count for a deduplicated block increases above this number, a new ditto copy of this block is automatically stored. Deafult setting is -.Cm 0 Ns . +.Cm 0 . .It Sy delegation Ns = Ns Cm on No | Cm off Controls whether a non-privileged user is granted access based on the dataset permissions defined on the dataset. See @@ -694,7 +699,7 @@ decreased. The preferred method of updat command, though this property can be used when a specific version is needed for backwards compatibility. This property can be any number between 1 and the current version reported by -.Qo Ic zpool upgrade -v Qc Ns . +.Qo Ic zpool upgrade -v Qc . .El .Sh SUBCOMMANDS All subcommands that modify state are logged persistently to the pool in their @@ -731,7 +736,7 @@ subcommand. .Bl -tag -width indent .It Fl f Forces use of -.Ar vdev Ns , +.Ar vdev , even if they appear in use or specify a conflicting replication level. Not all devices can be overridden in this manner. .It Fl n @@ -762,7 +767,8 @@ configuration. If is not currently part of a mirrored configuration, .Ar device automatically transforms into a two-way mirror of -.Ar device No and Ar new_device Ns . If +.Ar device No and Ar new_device . +If .Ar device is part of a two-way mirror, attaching .Ar new_device @@ -772,7 +778,7 @@ begins to resilver immediately. .Bl -tag -width indent .It Fl f Forces use of -.Ar new_device Ns , +.Ar new_device , even if its appears to be in use. Not all devices can be overridden in this manner. .El @@ -846,7 +852,7 @@ is specified. Unless the .Fl R option is specified, the default mount point is -.Qq Pa /pool Ns . +.Qq Pa /pool . The mount point must not exist or must be empty, or else the root dataset cannot be mounted. This can be overridden with the .Fl m @@ -890,9 +896,11 @@ or if .Sy altroot is specified. The mount point must be an absolute path, -.Qq Cm legacy Ns , or Qq Cm none Ns . +.Qq Cm legacy , +or +.Qq Cm none . For more information on dataset mount points, see -.Xr zfs 8 Ns \&. +.Xr zfs 8 . .El .It Xo .Nm @@ -1000,7 +1008,7 @@ performed. Lists pools available to import. If the .Fl d option is not specified, this command searches for devices in -.Qq Pa /dev Ns . +.Qq Pa /dev . The .Fl d option can be specified multiple times, and all directories are searched. If @@ -1028,7 +1036,7 @@ pool property. This is used instead of searching for devices. .It Fl d Ar dir Searches for devices or files in -.Ar dir Ns . +.Ar dir . The .Fl d option can be specified multiple times. @@ -1078,7 +1086,7 @@ pool property. This is used instead of searching for devices. .It Fl d Ar dir Searches for devices or files in -.Ar dir Ns . +.Ar dir . The .Fl d option can be specified multiple times. This option is incompatible with the @@ -1141,7 +1149,7 @@ Imports a specific pool. A pool can be i identifier. If .Ar newpool is specified, the pool is imported using the name -.Ar newpool Ns . +.Ar newpool . Otherwise, it is imported with the same name as its exported name. .Pp If a device is removed from a system without running @@ -1171,7 +1179,7 @@ pool property. This is used instead of searching for devices. .It Fl d Ar dir Searches for devices or files in -.Ar dir Ns . +.Ar dir . The .Fl d option can be specified multiple times. This option is incompatible with the @@ -1236,11 +1244,11 @@ Print a timestamp. Use modifier .Cm d for standard date format. See -.Xr date 1 Ns . +.Xr date 1 . Use modifier .Cm u for unixtime -.Pq equals Qq Ic date +%s Ns . +.Pq equals Qq Ic date +%s . .It Fl v Verbose statistics. Reports usage statistics for individual .No vdev Ns s @@ -1256,7 +1264,7 @@ within the pool, in addition to the pool Removes .Tn ZFS label information from the specified -.Ar device Ns . +.Ar device . The .Ar device must not be part of an active pool configuration. @@ -1295,24 +1303,24 @@ instead of arbitrary space. Comma-separated list of properties to display. See the .Qq Sx Properties section for a list of valid properties. The default list is -.Sy name Ns , -.Sy size Ns , -.Sy used Ns , -.Sy available Ns , -.Sy capacity Ns , -.Sy health Ns , -.Sy altroot Ns . +.Sy name , +.Sy size , +.Sy used , +.Sy available , +.Sy capacity , +.Sy health , +.Sy altroot . .It Fl T Cm d Ns | Ns Cm u Print a timestamp. .Pp Use modifier .Cm d for standard date format. See -.Xr date 1 Ns . +.Xr date 1 . Use modifier .Cm u for unixtime -.Pq equals Qq Ic date +%s Ns . +.Pq equals Qq Ic date +%s . .El .It Xo .Nm @@ -1380,11 +1388,11 @@ devices cannot be removed from a pool. Replaces .Ar old_device with -.Ar new_device Ns . +.Ar new_device . This is equivalent to attaching -.Ar new_device Ns , +.Ar new_device , waiting for it to resilver, and then detaching -.Ar old_device Ns . +.Ar old_device . .Pp The size of .Ar new_device @@ -1397,7 +1405,7 @@ configuration. is required if the pool is not redundant. If .Ar new_device is not specified, it defaults to -.Ar old_device Ns . +.Ar old_device . This form of replacement is useful after an existing disk has failed and has been physically replaced. In this case, the new disk may have the same .Pa /dev @@ -1407,7 +1415,7 @@ recognizes this. .Bl -tag -width indent .It Fl f Forces use of -.Ar new_device Ns , +.Ar new_device , even if its appears to be in use. Not all devices can be overridden in this manner. .El @@ -1420,7 +1428,7 @@ manner. .Pp Begins a scrub. The scrub examines all data in the specified pools to verify that it checksums correctly. For replicated (mirror or -.No raidz Ns ) +.No raidz ) devices, .Tn ZFS automatically repairs any damage discovered during the scrub. The @@ -1565,11 +1573,11 @@ Print a timestamp. Use modifier .Cm d for standard date format. See -.Xr date 1 Ns . +.Xr date 1 . Use modifier .Cm u for unixtime -.Pq equals Qq Ic date +%s Ns . +.Pq equals Qq Ic date +%s . .El .It Xo .Nm @@ -1649,7 +1657,7 @@ recommended, a pool based on files can b .It Sy Example 5 No Adding a Mirror to a Tn ZFS No Storage Pool .Pp The following command adds two mirrored disks to the pool -.Em tank Ns , +.Em tank , assuming the pool is already made up of two-way mirrors. The additional space is immediately available to any datasets within the pool. .Bd -literal -offset 2n @@ -1793,7 +1801,7 @@ subcommand as follows: .It Sy Example 15 No Removing a Mirrored Log Device .Pp The following command removes the mirrored log device -.Em mirror-2 Ns . +.Em mirror-2 . .Pp Given this configuration: .Bd -literal -offset 2n From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 11:12:03 2012 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 3502A1065670; Thu, 5 Jan 2012 11:12:03 +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 1BC9C8FC1E; Thu, 5 Jan 2012 11:12:03 +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 q05BC3Qc031202; Thu, 5 Jan 2012 11:12:03 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05BC2fW031199; Thu, 5 Jan 2012 11:12:02 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201051112.q05BC2fW031199@svn.freebsd.org> From: Martin Matuska Date: Thu, 5 Jan 2012 11:12:02 +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: r229582 - in stable/8/cddl/contrib/opensolaris/cmd: zfs zpool 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, 05 Jan 2012 11:12:03 -0000 Author: mm Date: Thu Jan 5 11:12:02 2012 New Revision: 229582 URL: http://svn.freebsd.org/changeset/base/229582 Log: MFC r228206, r228353: MFC r228206: Remove unnecesary "Ns" macros and add missing command example to zpool(8). MFC r228353: Some mdoc(7) style and typo fixes to zfs(8). Submitted by: Nobuyuki Koganemaru Modified: stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs.8 stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Jan 5 11:11:46 2012 (r229581) +++ stable/8/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Jan 5 11:12:02 2012 (r229582) @@ -377,7 +377,7 @@ property. This directory is created as n automatically mounts the file system when the .Qq Nm Cm mount Fl a command is invoked (without editing -.Pa /etc/fstab Ns ). +.Pa /etc/fstab ) . The .Sy mountpoint property can be inherited, so if @@ -409,7 +409,7 @@ responsible for mounting and unmounting dataset can be attached to a jail by using the .Qq Nm Cm jail subcommand. You cannot attach a dataset to one jail and the children of the -same dataset to another jails. To allow managment of the dataset from within +same dataset to another jails. To allow management of the dataset from within a jail, the .Sy jailed property has to be set. The @@ -624,10 +624,10 @@ symbol, using one of the following forms .Bl -bullet -offset 2n .It POSIX name (for example, -.Em joe Ns ) +.Em joe ) .It POSIX numeric ID (for example, -.Em 1001 Ns ) +.Em 1001 ) .El .It Sy userrefs This property is set to the number of user holds on this snapshot. User holds @@ -673,7 +673,7 @@ snapshot. The .Ar snapshot may be specified as a short snapshot name (just the part after the -.Sy @ Ns ), +.Sy @ ) , in which case it will be interpreted as a snapshot in the same filesystem as this dataset. The .Ar snapshot @@ -847,7 +847,7 @@ is an integer from 1 (fastest) to 9 (bes is equivalent to .Cm gzip-6 (which is also the default for -.Xr gzip 1 Ns ). +.Xr gzip 1 ) . The .Cm zle compression algorithm compresses runs of zeros. @@ -952,7 +952,7 @@ space calculation does not include space such as snapshots and clones. User space consumption is identified by the .Sy userspace@ Ns Ar user property. -.sp +.Pp Enforcement of user quotas may be delayed by several seconds. This delay means that a user might exceed their quota before the system notices that they are over quota and begins to refuse additional writes with the @@ -960,14 +960,14 @@ over quota and begins to refuse addition error message. See the .Cm userspace subcommand for more information. -.sp +.Pp Unprivileged users can only access their own groups' space usage. The root user, or a user who has been granted the .Sy userquota privilege with .Qq Nm Cm allow , can get and set everyone's quota. -.sp +.Pp This property is not available on volumes, on file systems before version 4, or on pools before version 15. The .Sy userquota@ Ns ... @@ -979,17 +979,17 @@ symbol, using one of the following forms .Bl -bullet -offset 2n .It POSIX name (for example, -.Em joe Ns ) +.Em joe ) .It POSIX numeric ID (for example, -.Em 1001 Ns ) +.Em 1001 ) .El .It Sy groupquota@ Ns Ar group Ns = Ns Ar size | Cm none Limits the amount of space consumed by the specified group. Group space consumption is identified by the .Sy userquota@ Ns Ar user property. -.sp +.Pp Unprivileged users can access only their own groups' space usage. The root user, or a user who has been granted the .Sy groupquota @@ -1020,7 +1020,7 @@ than or equal to 128 Kbytes. Changing the file system's .Sy recordsize affects only files created afterward; existing files are unaffected. -.sp +.Pp This property can also be referred to by its shortened column name, .Sy recsize . .It Sy refquota Ns = Ns Ar size | Cm none @@ -1036,13 +1036,13 @@ The .Sy refreservation reservation is accounted for in the parent datasets' space used, and counts against the parent datasets' quotas and reservations. -.sp +.Pp If .Sy refreservation is set, a snapshot is only allowed if there is enough free pool space outside of this reservation to accommodate the current number of "referenced" bytes in the dataset. -.sp +.Pp This property can also be referred to by its shortened column name, .Sy refreserv . .It Sy reservation Ns = Ns Ar size | Cm none @@ -1161,7 +1161,7 @@ version number of 9 or higher, a is set instead. Any changes to .Sy volsize are reflected in an equivalent change to the reservation (or -.Sy refreservation Ns ). +.Sy refreservation ) . The .Sy volsize can only be set to a multiple of @@ -1174,7 +1174,7 @@ run out of space, resulting in undefined on how the volume is used. These effects can also occur when the volume size is changed while it is in use (particularly when shrinking the size). Extreme care should be used when adjusting the volume size. -.sp +.Pp Though not recommended, a "sparse volume" (also known as "thin provisioning") can be created by specifying the .Fl s @@ -1708,7 +1708,7 @@ Snapshots are displayed if the property is .Cm on (the default is -.Cm off Ns ). +.Cm off ) . The following fields are displayed, .Sy name , used , available , referenced , mountpoint . .Bl -tag -width indent @@ -2168,10 +2168,10 @@ Creates a stream representation of the l argument (not part of .Fl i or -.Fl I Ns ) +.Fl I ) which is written to standard output. The output can be redirected to a file or to a different system (for example, using -.Xr ssh 1 Ns ). +.Xr ssh 1 ) . By default, a full stream is generated. .Bl -tag -width indent .It Fl i Ar snapshot @@ -2180,10 +2180,10 @@ Generate an incremental stream from the to the last .Ar snapshot . The incremental source (the -.Fl i Ar snapshot Ns ) +.Fl i Ar snapshot ) can be specified as the last component of the snapshot name (for example, the part after the -.Sy @ Ns ), +.Sy @ ) , and it is assumed to be from the same file system as the last .Ar snapshot . .Pp @@ -2191,14 +2191,16 @@ If the destination is a clone, the sourc must be fully specified (for example, .Cm pool/fs@origin , not just -.Cm @origin Ns ). +.Cm @origin ) . .It Fl I Ar snapshot Generate a stream package that sends all intermediary snapshots from the -.Fl I Ar snapshot to the last -.Ar snapshot . For example, +.Fl I Ar snapshot +to the last +.Ar snapshot . +For example, .Ic -I @a fs@d is similar to -.Ic -i @a fs@b; -i @b fs@c; -i @c fs@d Ns . +.Ic -i @a fs@b; -i @b fs@c; -i @c fs@d . The incremental source snapshot may be specified as with the .Fl i option. @@ -2223,12 +2225,12 @@ flag is specified when this stream is re .It Fl D Generate a deduplicated stream. Blocks which would have been sent multiple times in the send stream will only be sent once. The receiving system must -also support this feature to recieve a deduplicated stream. This flag can +also support this feature to receive a deduplicated stream. This flag can be used regardless of the dataset's .Sy dedup property, but performance will be much better if the filesystem uses a dedup-capable checksum (eg. -.Sy sha256 Ns ). +.Sy sha256 ) . .It Fl r Recursively send all descendant snapshots. This is similar to the .Fl R @@ -2323,14 +2325,14 @@ option is specified, all but the pool na appended (for example, .Sy b/c@1 appended from sent snapshot -.Sy a/b/c@1 Ns ), +.Sy a/b/c@1 ) , and if the .Fl e option is specified, only the tail of the sent snapshot path is appended (for example, .Sy c@1 appended from sent snapshot -.Sy a/b/c@1 Ns ). +.Sy a/b/c@1 ) . In the case of .Fl d , any file systems needed to replicate the path of the sent snapshot are created @@ -2349,13 +2351,13 @@ Print verbose information about the stre receive operation. .It Fl n Do not actually receive the stream. This can be useful in conjunction with the -.It Fl v +.Fl v option to verify the name the receive operation would use. .It Fl F Force a rollback of the file system to the most recent snapshot before performing the receive operation. If receiving an incremental replication stream (for example, one generated by -.Qq Nm Cm send Fl R Fi iI Ns ) , +.Qq Nm Cm send Fl R Fi iI ) , destroy snapshots and file systems that do not exist on the sending side. .El .It Xo @@ -2409,12 +2411,13 @@ option. .Op Fl e .Ar perm Ns | Ns Ar @setname Ns Op , Ns Ar ... .Xc -Specifies that the permissions be delegated to "everyone." Multiple permissions +Specifies that the permissions be delegated to "everyone". +Multiple permissions may be specified as a comma-separated list. Permission names are the same as .Tn ZFS subcommand and property names. See the property list below. Property set names, which begin with an at sign -.Pq Sy @ Ns , +.Pq Sy @ , may be specified. See the .Fl s form below for details. @@ -2536,7 +2539,7 @@ commands for the specified file system a dynamically, so changes to a set are immediately reflected. Permission sets follow the same naming restrictions as ZFS file systems, but the name must begin with an "at sign" -.Pq Sy @ Ns , +.Pq Sy @ , and can be no more than 64 characters long. .It Xo .Nm @@ -2655,7 +2658,7 @@ Describes differences between a snapshot successor dataset can be a later snapshot or the current filesystem. .Pp The changed files are displayed including the change type. The change type -is displayed ussing a single character. If a file or directory was renamed, +is displayed useing a single character. If a file or directory was renamed, the old and the new names are displayed. .Pp The following change types can be displayed: @@ -2680,9 +2683,9 @@ The following file types can be displaye .It \&B Ta block device .It \&@ Ta symbolic link .It \&= Ta socket -.It \&> Ta door (not supported on Fx Ns ) -.It \&| Ta FIFO (not supported on Fx Ns ) -.It \&P Ta event portal (not supported on Fx Ns ) +.It \&> Ta door (not supported on Fx ) +.It \&| Ta FIFO (not supported on Fx ) +.It \&P Ta event portal (not supported on Fx ) .El .It Fl H Machine-parseable output, fields separated a tab character. Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Thu Jan 5 11:11:46 2012 (r229581) +++ stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Thu Jan 5 11:12:02 2012 (r229582) @@ -195,7 +195,7 @@ are supported: .Bl -tag .It Sy disk A block device, typically located under -.Pa /dev Ns . +.Pa /dev . .Tn ZFS can use individual slices or partitions, though the recommended mode of operation is to use whole disks. A disk can be specified by a full path to the @@ -221,13 +221,14 @@ bytes and can withstand .Pq Em N-1 devices failing before data integrity is compromised. .It Sy raidz -.No ( or Sy raidz1 raidz2 raidz3 Ns ). +(or +.Sy raidz1 raidz2 raidz3 ) . A variation on .Sy RAID-5 that allows for better distribution of parity and eliminates the -.Qq Sy RAID-5 No write hole -(in which data and parity become inconsistent after a power loss). Data and -parity is striped across all disks within a +.Qq Sy RAID-5 +write hole (in which data and parity become inconsistent after a power loss). +Data and parity is striped across all disks within a .No raidz group. .Pp @@ -251,7 +252,7 @@ type specifies a triple-parity group. The .Sy raidz No vdev type is an alias for -.Sy raidz1 Ns . +.Sy raidz1 . .Pp A .No raidz @@ -322,6 +323,9 @@ are used to distinguish where a group en following creates two root .No vdev Ns s, each a mirror of two disks: +.Bd -literal -offset 2n +.Li # Ic zpool create mypool mirror da0 da1 mirror da2 da3 +.Ed .Ss Device Failure and Recovery .Tn ZFS supports a rich set of mechanisms for handling device failure and data @@ -421,7 +425,7 @@ hardware-dependent and might not be supp .Ss Hot Spares .Tn ZFS allows devices to be associated with pools as -.Qq hot spares Ns . +.Qq hot spares . These devices are not actively used in the pool, but when an active device fails, it is automatically replaced by a hot spare. To create a pool with hot spares, specify a @@ -537,12 +541,13 @@ Number of blocks within the pool that ar A unique identifier for the pool. .It Sy health The current health of the pool. Health can be -.Qq Sy ONLINE Ns , -.Qq Sy DEGRADED Ns , -.Qq Sy FAULTED Ns , -.Qq Sy OFFLINE Ns , -.Qq Sy REMOVED Ns , or -.Qq Sy UNAVAIL Ns . +.Qq Sy ONLINE , +.Qq Sy DEGRADED , +.Qq Sy FAULTED , +.Qq Sy OFFLINE , +.Qq Sy REMOVED , +or +.Qq Sy UNAVAIL . .It Sy size Total size of the storage pool. .It Sy used @@ -577,7 +582,7 @@ is not a persistent property. It is vali Setting .Sy altroot defaults to using -.Cm cachefile=none Ns , +.Cm cachefile=none , though this may be overridden using an explicit setting. .El .Pp @@ -585,7 +590,7 @@ The following property can only be set a .Bl -tag -width 2n .It Sy readonly Ns = Ns Cm on No | Cm off If set to -.Cm on Ns , +.Cm on , pool will be imported in read-only mode with the following restrictions: .Bl -bullet -offset 2n .It @@ -606,7 +611,7 @@ command: .Bl -tag -width 2n .It Sy autoexpand Ns = Ns Cm on No | Cm off Controls automatic pool expansion when the underlying LUN is grown. If set to -.Qq Cm on Ns , +.Qq Cm on , the pool will be resized according to the size of the expanded device. If the device is part of a mirror or .No raidz @@ -614,20 +619,20 @@ then all devices within that .No mirror/ Ns No raidz group must be expanded before the new space is made available to the pool. The default behavior is -.Qq off Ns . +.Qq off . This property can also be referred to by its shortened column name, -.Sy expand Ns . +.Sy expand . .It Sy autoreplace Ns = Ns Cm on No | Cm off Controls automatic device replacement. If set to -.Qq Cm off Ns , +.Qq Cm off , device replacement must be initiated by the administrator by using the .Qq Nm Cm replace command. If set to -.Qq Cm on Ns , +.Qq Cm on , any new device, found in the same physical location as a device that previously belonged to the pool, is automatically formatted and replaced. The default behavior is -.Qq Cm off Ns . +.Qq Cm off . This property can also be referred to by its shortened column name, "replace". .It Sy bootfs Ns = Ns Ar pool Ns / Ns Ar dataset Identifies the default bootable dataset for the root pool. This property is @@ -650,7 +655,7 @@ creates a temporary pool that is never c Threshold for the number of block ditto copies. If the reference count for a deduplicated block increases above this number, a new ditto copy of this block is automatically stored. Deafult setting is -.Cm 0 Ns . +.Cm 0 . .It Sy delegation Ns = Ns Cm on No | Cm off Controls whether a non-privileged user is granted access based on the dataset permissions defined on the dataset. See @@ -694,7 +699,7 @@ decreased. The preferred method of updat command, though this property can be used when a specific version is needed for backwards compatibility. This property can be any number between 1 and the current version reported by -.Qo Ic zpool upgrade -v Qc Ns . +.Qo Ic zpool upgrade -v Qc . .El .Sh SUBCOMMANDS All subcommands that modify state are logged persistently to the pool in their @@ -731,7 +736,7 @@ subcommand. .Bl -tag -width indent .It Fl f Forces use of -.Ar vdev Ns , +.Ar vdev , even if they appear in use or specify a conflicting replication level. Not all devices can be overridden in this manner. .It Fl n @@ -762,7 +767,8 @@ configuration. If is not currently part of a mirrored configuration, .Ar device automatically transforms into a two-way mirror of -.Ar device No and Ar new_device Ns . If +.Ar device No and Ar new_device . +If .Ar device is part of a two-way mirror, attaching .Ar new_device @@ -772,7 +778,7 @@ begins to resilver immediately. .Bl -tag -width indent .It Fl f Forces use of -.Ar new_device Ns , +.Ar new_device , even if its appears to be in use. Not all devices can be overridden in this manner. .El @@ -846,7 +852,7 @@ is specified. Unless the .Fl R option is specified, the default mount point is -.Qq Pa /pool Ns . +.Qq Pa /pool . The mount point must not exist or must be empty, or else the root dataset cannot be mounted. This can be overridden with the .Fl m @@ -890,9 +896,11 @@ or if .Sy altroot is specified. The mount point must be an absolute path, -.Qq Cm legacy Ns , or Qq Cm none Ns . +.Qq Cm legacy , +or +.Qq Cm none . For more information on dataset mount points, see -.Xr zfs 8 Ns \&. +.Xr zfs 8 . .El .It Xo .Nm @@ -1000,7 +1008,7 @@ performed. Lists pools available to import. If the .Fl d option is not specified, this command searches for devices in -.Qq Pa /dev Ns . +.Qq Pa /dev . The .Fl d option can be specified multiple times, and all directories are searched. If @@ -1028,7 +1036,7 @@ pool property. This is used instead of searching for devices. .It Fl d Ar dir Searches for devices or files in -.Ar dir Ns . +.Ar dir . The .Fl d option can be specified multiple times. @@ -1078,7 +1086,7 @@ pool property. This is used instead of searching for devices. .It Fl d Ar dir Searches for devices or files in -.Ar dir Ns . +.Ar dir . The .Fl d option can be specified multiple times. This option is incompatible with the @@ -1141,7 +1149,7 @@ Imports a specific pool. A pool can be i identifier. If .Ar newpool is specified, the pool is imported using the name -.Ar newpool Ns . +.Ar newpool . Otherwise, it is imported with the same name as its exported name. .Pp If a device is removed from a system without running @@ -1171,7 +1179,7 @@ pool property. This is used instead of searching for devices. .It Fl d Ar dir Searches for devices or files in -.Ar dir Ns . +.Ar dir . The .Fl d option can be specified multiple times. This option is incompatible with the @@ -1236,11 +1244,11 @@ Print a timestamp. Use modifier .Cm d for standard date format. See -.Xr date 1 Ns . +.Xr date 1 . Use modifier .Cm u for unixtime -.Pq equals Qq Ic date +%s Ns . +.Pq equals Qq Ic date +%s . .It Fl v Verbose statistics. Reports usage statistics for individual .No vdev Ns s @@ -1256,7 +1264,7 @@ within the pool, in addition to the pool Removes .Tn ZFS label information from the specified -.Ar device Ns . +.Ar device . The .Ar device must not be part of an active pool configuration. @@ -1295,24 +1303,24 @@ instead of arbitrary space. Comma-separated list of properties to display. See the .Qq Sx Properties section for a list of valid properties. The default list is -.Sy name Ns , -.Sy size Ns , -.Sy used Ns , -.Sy available Ns , -.Sy capacity Ns , -.Sy health Ns , -.Sy altroot Ns . +.Sy name , +.Sy size , +.Sy used , +.Sy available , +.Sy capacity , +.Sy health , +.Sy altroot . .It Fl T Cm d Ns | Ns Cm u Print a timestamp. .Pp Use modifier .Cm d for standard date format. See -.Xr date 1 Ns . +.Xr date 1 . Use modifier .Cm u for unixtime -.Pq equals Qq Ic date +%s Ns . +.Pq equals Qq Ic date +%s . .El .It Xo .Nm @@ -1380,11 +1388,11 @@ devices cannot be removed from a pool. Replaces .Ar old_device with -.Ar new_device Ns . +.Ar new_device . This is equivalent to attaching -.Ar new_device Ns , +.Ar new_device , waiting for it to resilver, and then detaching -.Ar old_device Ns . +.Ar old_device . .Pp The size of .Ar new_device @@ -1397,7 +1405,7 @@ configuration. is required if the pool is not redundant. If .Ar new_device is not specified, it defaults to -.Ar old_device Ns . +.Ar old_device . This form of replacement is useful after an existing disk has failed and has been physically replaced. In this case, the new disk may have the same .Pa /dev @@ -1407,7 +1415,7 @@ recognizes this. .Bl -tag -width indent .It Fl f Forces use of -.Ar new_device Ns , +.Ar new_device , even if its appears to be in use. Not all devices can be overridden in this manner. .El @@ -1420,7 +1428,7 @@ manner. .Pp Begins a scrub. The scrub examines all data in the specified pools to verify that it checksums correctly. For replicated (mirror or -.No raidz Ns ) +.No raidz ) devices, .Tn ZFS automatically repairs any damage discovered during the scrub. The @@ -1565,11 +1573,11 @@ Print a timestamp. Use modifier .Cm d for standard date format. See -.Xr date 1 Ns . +.Xr date 1 . Use modifier .Cm u for unixtime -.Pq equals Qq Ic date +%s Ns . +.Pq equals Qq Ic date +%s . .El .It Xo .Nm @@ -1649,7 +1657,7 @@ recommended, a pool based on files can b .It Sy Example 5 No Adding a Mirror to a Tn ZFS No Storage Pool .Pp The following command adds two mirrored disks to the pool -.Em tank Ns , +.Em tank , assuming the pool is already made up of two-way mirrors. The additional space is immediately available to any datasets within the pool. .Bd -literal -offset 2n @@ -1793,7 +1801,7 @@ subcommand as follows: .It Sy Example 15 No Removing a Mirrored Log Device .Pp The following command removes the mirrored log device -.Em mirror-2 Ns . +.Em mirror-2 . .Pp Given this configuration: .Bd -literal -offset 2n From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 11:14:29 2012 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 4F7C71065672; Thu, 5 Jan 2012 11:14:29 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 391CD8FC12; Thu, 5 Jan 2012 11:14: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 q05BETNW031370; Thu, 5 Jan 2012 11:14:29 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05BESQu031368; Thu, 5 Jan 2012 11:14:28 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201201051114.q05BESQu031368@svn.freebsd.org> From: Gleb Smirnoff Date: Thu, 5 Jan 2012 11:14:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229583 - stable/9/sbin/dhclient 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, 05 Jan 2012 11:14:29 -0000 Author: glebius Date: Thu Jan 5 11:14:28 2012 New Revision: 229583 URL: http://svn.freebsd.org/changeset/base/229583 Log: Merge r228463, that explicily uses 255.0.0.0 mask for the temporary prefix. This change isn't actually needed in the stable/9, but let it be here, in case if anyone tries to run stable/9 world on a head/ kernel. Modified: stable/9/sbin/dhclient/dhclient-script Directory Properties: stable/9/sbin/dhclient/ (props changed) Modified: stable/9/sbin/dhclient/dhclient-script ============================================================================== --- stable/9/sbin/dhclient/dhclient-script Thu Jan 5 11:12:02 2012 (r229582) +++ stable/9/sbin/dhclient/dhclient-script Thu Jan 5 11:14:28 2012 (r229583) @@ -318,7 +318,7 @@ MEDIUM) PREINIT) delete_old_alias - $IFCONFIG $interface inet alias 0.0.0.0 netmask 0.0.0.0 broadcast 255.255.255.255 up + $IFCONFIG $interface inet alias 0.0.0.0 netmask 255.0.0.0 broadcast 255.255.255.255 up ;; ARPCHECK|ARPSEND) From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 11:14:54 2012 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 D23681065703; Thu, 5 Jan 2012 11:14:54 +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 BC2778FC12; Thu, 5 Jan 2012 11:14: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 q05BEs5l031427; Thu, 5 Jan 2012 11:14:54 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05BEsEP031425; Thu, 5 Jan 2012 11:14:54 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201051114.q05BEsEP031425@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 5 Jan 2012 11:14: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: r229584 - stable/8/sys/dev/uart 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, 05 Jan 2012 11:14:54 -0000 Author: kib Date: Thu Jan 5 11:14:54 2012 New Revision: 229584 URL: http://svn.freebsd.org/changeset/base/229584 Log: MFC r200257 (by mav): Add ID for NetMos NM9820 Serial Port chip, found on CardBus serial adapter. MFC r228947: Add PCI Id for the Intel AMT serial interface as found on my DQ67OW. Modified: stable/8/sys/dev/uart/uart_bus_pci.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/uart/uart_bus_pci.c ============================================================================== --- stable/8/sys/dev/uart/uart_bus_pci.c Thu Jan 5 11:14:28 2012 (r229583) +++ stable/8/sys/dev/uart/uart_bus_pci.c Thu Jan 5 11:14:54 2012 (r229584) @@ -111,6 +111,8 @@ static struct pci_id pci_ns8250_ids[] = { 0x1415, 0x950b, 0xffff, 0, "Oxford Semiconductor OXCB950 Cardbus 16950 UART", 0x10, 16384000 }, { 0x151f, 0x0000, 0xffff, 0, "TOPIC Semiconductor TP560 56k modem", 0x10 }, +{ 0x8086, 0x1c3d, 0xffff, 0, "Intel AMT - KT Controller", 0x10 }, +{ 0x9710, 0x9820, 0x1000, 1, "NetMos NM9820 Serial Port", 0x10 }, { 0x9710, 0x9835, 0x1000, 1, "NetMos NM9835 Serial Port", 0x10 }, { 0x9710, 0x9865, 0xa000, 0x1000, "NetMos NM9865 Serial Port", 0x10 }, { 0x9710, 0x9900, 0xa000, 0x1000, From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 11:16:43 2012 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 8F69B1065672; Thu, 5 Jan 2012 11:16:43 +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 7A9E48FC12; Thu, 5 Jan 2012 11:16:43 +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 q05BGhFX031526; Thu, 5 Jan 2012 11:16:43 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05BGhvI031524; Thu, 5 Jan 2012 11:16:43 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201201051116.q05BGhvI031524@svn.freebsd.org> From: Christian Brueffer Date: Thu, 5 Jan 2012 11:16:43 +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: r229585 - head/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: Thu, 05 Jan 2012 11:16:43 -0000 Author: brueffer Date: Thu Jan 5 11:16:42 2012 New Revision: 229585 URL: http://svn.freebsd.org/changeset/base/229585 Log: Fix typo. MFC after: 1 week Modified: head/share/man/man4/bce.4 Modified: head/share/man/man4/bce.4 ============================================================================== --- head/share/man/man4/bce.4 Thu Jan 5 11:14:54 2012 (r229584) +++ head/share/man/man4/bce.4 Thu Jan 5 11:16:42 2012 (r229585) @@ -251,7 +251,7 @@ status block. .It "bce%d: Could not allocate status block DMA memory!" The driver could not allocate DMA addressable memory for the controller's status block. -.It "bce_d: Could not map status block DMA memory!" +.It "bce%d: Could not map status block DMA memory!" The driver could not map the status block memory into the controller's DMA address space. .It "bce%d: Could not allocate statistics block DMA tag!" From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 11:24:23 2012 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 F318F106566C; Thu, 5 Jan 2012 11:24:22 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DDF578FC08; Thu, 5 Jan 2012 11:24: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 q05BOMwj032165; Thu, 5 Jan 2012 11:24:22 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05BOMhf032163; Thu, 5 Jan 2012 11:24:22 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201201051124.q05BOMhf032163@svn.freebsd.org> From: Robert Watson Date: Thu, 5 Jan 2012 11:24:22 +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: r229586 - 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: Thu, 05 Jan 2012 11:24:23 -0000 Author: rwatson Date: Thu Jan 5 11:24:22 2012 New Revision: 229586 URL: http://svn.freebsd.org/changeset/base/229586 Log: Add comment to the VLAN code about its integration with VIMAGE: we see what the code is doing, we recognise the legitimacy of its goal, but we're not quite sure it's going about it the right way. More pondering is clearly required. Sponsored by: ADARA Networks, Inc. Discussed with: bz MFC after: 3 days Modified: head/sys/net/if_vlan.c Modified: head/sys/net/if_vlan.c ============================================================================== --- head/sys/net/if_vlan.c Thu Jan 5 11:16:42 2012 (r229585) +++ head/sys/net/if_vlan.c Thu Jan 5 11:24:22 2012 (r229586) @@ -1597,6 +1597,13 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd case SIOCSETVLAN: #ifdef VIMAGE + /* + * XXXRW/XXXBZ: The goal in these checks is to allow a VLAN + * interface to be delegated to a jail without allowing the + * jail to change what underlying interface/VID it is + * associated with. We are not entirely convinced that this + * is the right way to accomplish that goal policy goal. + */ if (ifp->if_vnet != ifp->if_home_vnet) { error = EPERM; break; From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 11:42:35 2012 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 5A9FA106566B; Thu, 5 Jan 2012 11:42:35 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4585A8FC17; Thu, 5 Jan 2012 11:42: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 q05BgZ1k033222; Thu, 5 Jan 2012 11:42:35 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05BgZ92033220; Thu, 5 Jan 2012 11:42:35 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201201051142.q05BgZ92033220@svn.freebsd.org> From: Robert Watson Date: Thu, 5 Jan 2012 11:42:35 +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: r229587 - 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: Thu, 05 Jan 2012 11:42:35 -0000 Author: rwatson Date: Thu Jan 5 11:42:34 2012 New Revision: 229587 URL: http://svn.freebsd.org/changeset/base/229587 Log: Refine last comment. Submitted by: joeld Sponsored by: ADARA Networks, Inc. MFC after: 3 days Modified: head/sys/net/if_vlan.c Modified: head/sys/net/if_vlan.c ============================================================================== --- head/sys/net/if_vlan.c Thu Jan 5 11:24:22 2012 (r229586) +++ head/sys/net/if_vlan.c Thu Jan 5 11:42:34 2012 (r229587) @@ -1602,7 +1602,7 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd * interface to be delegated to a jail without allowing the * jail to change what underlying interface/VID it is * associated with. We are not entirely convinced that this - * is the right way to accomplish that goal policy goal. + * is the right way to accomplish that policy goal. */ if (ifp->if_vnet != ifp->if_home_vnet) { error = EPERM; From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 11:44:56 2012 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 AB7C3106564A; Thu, 5 Jan 2012 11:44:56 +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 9286F8FC08; Thu, 5 Jan 2012 11:44: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 q05Biu2d033368; Thu, 5 Jan 2012 11:44:56 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05BiuZb033339; Thu, 5 Jan 2012 11:44:56 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201051144.q05BiuZb033339@svn.freebsd.org> From: Martin Matuska Date: Thu, 5 Jan 2012 11:44:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229588 - in stable/9: lib/libarchive lib/libarchive/test usr.bin/cpio usr.bin/tar 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, 05 Jan 2012 11:44:56 -0000 Author: mm Date: Thu Jan 5 11:44:55 2012 New Revision: 229588 URL: http://svn.freebsd.org/changeset/base/229588 Log: MFC r228744, r228745, r228748: MFC r228744 [1]: Merge vendor revision 3723: Fixes extraction of Zip entries that use length-at-end without specifying either the compressed or uncompressed length. In particular, fixes bsdtar extraction of such files. Reported by: Patrick Lamaiziere (freebsd-stable@) MFC r228745: Update libarchive, tar and cpio to version 2.8.5 The following additional vendor revisions are applied: Revision 3740: Use archive_clear_error() to clear the error markers. Obtained from: http://code.google.com/p/libarchive MFC r228748: Sync libarchive with vendor branch release/2.8: 3730: Fix issue 174 (Windows path names, not relevant for FreeBSD) 3734: Merge r1989: archive_clear_error should set errno to 0. 3735: Merge r3247 from trunk: Clear errors before returning from archive_read_support_format_all() 3799: Check the position before dereferencing the pointer. This avoids dereferencing one byte past the end of a string 3824: Merge r3823 from trunk for issue 199 (hang in iso9660 reading) Obtained from: http://code.google.com/p/libarchive Added: stable/9/lib/libarchive/test/test_read_format_iso_Z.c - copied unchanged from r228745, head/lib/libarchive/test/test_read_format_iso_Z.c Deleted: stable/9/lib/libarchive/test/test_read_format_iso_gz.c Modified: stable/9/lib/libarchive/archive.h stable/9/lib/libarchive/archive_read.c stable/9/lib/libarchive/archive_read_extract.c stable/9/lib/libarchive/archive_read_support_compression_bzip2.c stable/9/lib/libarchive/archive_read_support_compression_uu.c stable/9/lib/libarchive/archive_read_support_format_all.c stable/9/lib/libarchive/archive_read_support_format_cpio.c stable/9/lib/libarchive/archive_read_support_format_iso9660.c stable/9/lib/libarchive/archive_read_support_format_tar.c stable/9/lib/libarchive/archive_read_support_format_zip.c stable/9/lib/libarchive/archive_string.c stable/9/lib/libarchive/archive_string.h stable/9/lib/libarchive/archive_util.c stable/9/lib/libarchive/archive_write_disk.c stable/9/lib/libarchive/archive_write_set_compression_xz.c stable/9/lib/libarchive/archive_write_set_format_ar.c stable/9/lib/libarchive/archive_write_set_format_shar.c stable/9/lib/libarchive/archive_write_set_format_ustar.c stable/9/lib/libarchive/config_freebsd.h stable/9/lib/libarchive/libarchive-formats.5 stable/9/lib/libarchive/libarchive.3 stable/9/lib/libarchive/test/Makefile stable/9/lib/libarchive/test/test_compat_zip.c stable/9/usr.bin/cpio/Makefile stable/9/usr.bin/tar/Makefile stable/9/usr.bin/tar/tree.c Directory Properties: stable/9/lib/libarchive/ (props changed) stable/9/usr.bin/cpio/ (props changed) stable/9/usr.bin/tar/ (props changed) Modified: stable/9/lib/libarchive/archive.h ============================================================================== --- stable/9/lib/libarchive/archive.h Thu Jan 5 11:42:34 2012 (r229587) +++ stable/9/lib/libarchive/archive.h Thu Jan 5 11:44:55 2012 (r229588) @@ -52,7 +52,7 @@ /* These should match the types used in 'struct stat' */ #if defined(_WIN32) && !defined(__CYGWIN__) #define __LA_INT64_T __int64 -# if defined(_SSIZE_T_DEFINED) +# if defined(_SSIZE_T_DEFINED) || defined(_SSIZE_T_) # define __LA_SSIZE_T ssize_t # elif defined(_WIN64) # define __LA_SSIZE_T __int64 @@ -98,6 +98,13 @@ # define __LA_DECL #endif +#if defined(__GNUC__) && __GNUC__ >= 3 +#define __LA_PRINTF(fmtarg, firstvararg) \ + __attribute__((__format__ (__printf__, fmtarg, firstvararg))) +#else +#define __LA_PRINTF(fmtarg, firstvararg) /* nothing */ +#endif + #ifdef __cplusplus extern "C" { #endif @@ -129,13 +136,13 @@ extern "C" { * (ARCHIVE_API_VERSION * 1000000 + ARCHIVE_API_FEATURE * 1000) * #endif */ -#define ARCHIVE_VERSION_NUMBER 2008004 +#define ARCHIVE_VERSION_NUMBER 2008005 __LA_DECL int archive_version_number(void); /* * Textual name/version of the library, useful for version displays. */ -#define ARCHIVE_VERSION_STRING "libarchive 2.8.4" +#define ARCHIVE_VERSION_STRING "libarchive 2.8.5" __LA_DECL const char * archive_version_string(void); #if ARCHIVE_VERSION_NUMBER < 3000000 @@ -717,7 +724,7 @@ __LA_DECL const char *archive_format_nam __LA_DECL int archive_format(struct archive *); __LA_DECL void archive_clear_error(struct archive *); __LA_DECL void archive_set_error(struct archive *, int _err, - const char *fmt, ...); + const char *fmt, ...) __LA_PRINTF(3, 4); __LA_DECL void archive_copy_error(struct archive *dest, struct archive *src); __LA_DECL int archive_file_count(struct archive *); Modified: stable/9/lib/libarchive/archive_read.c ============================================================================== --- stable/9/lib/libarchive/archive_read.c Thu Jan 5 11:42:34 2012 (r229587) +++ stable/9/lib/libarchive/archive_read.c Thu Jan 5 11:44:55 2012 (r229588) @@ -715,7 +715,7 @@ archive_read_data_block(struct archive * /* * Close the file and release most resources. * - * Be careful: client might just call read_new and then read_finish. + * Be careful: client might just call read_new and then read_free. * Don't assume we actually read anything or performed any non-trivial * initialization. */ Modified: stable/9/lib/libarchive/archive_read_extract.c ============================================================================== --- stable/9/lib/libarchive/archive_read_extract.c Thu Jan 5 11:42:34 2012 (r229587) +++ stable/9/lib/libarchive/archive_read_extract.c Thu Jan 5 11:44:55 2012 (r229588) @@ -108,7 +108,7 @@ archive_read_extract2(struct archive *_a if (r != ARCHIVE_OK) /* If _write_header failed, copy the error. */ archive_copy_error(&a->archive, ad); - else if (archive_entry_size(entry) > 0) + else if (!archive_entry_size_is_set(entry) || archive_entry_size(entry) > 0) /* Otherwise, pour data into the entry. */ r = copy_data(_a, ad); r2 = archive_write_finish_entry(ad); Modified: stable/9/lib/libarchive/archive_read_support_compression_bzip2.c ============================================================================== --- stable/9/lib/libarchive/archive_read_support_compression_bzip2.c Thu Jan 5 11:42:34 2012 (r229587) +++ stable/9/lib/libarchive/archive_read_support_compression_bzip2.c Thu Jan 5 11:44:55 2012 (r229588) @@ -350,4 +350,4 @@ bzip2_filter_close(struct archive_read_f return (ret); } -#endif /* HAVE_BZLIB_H */ +#endif /* HAVE_BZLIB_H && BZ_CONFIG_ERROR */ Modified: stable/9/lib/libarchive/archive_read_support_compression_uu.c ============================================================================== --- stable/9/lib/libarchive/archive_read_support_compression_uu.c Thu Jan 5 11:42:34 2012 (r229587) +++ stable/9/lib/libarchive/archive_read_support_compression_uu.c Thu Jan 5 11:44:55 2012 (r229588) @@ -488,9 +488,9 @@ read_more: switch (uudecode->state) { default: case ST_FIND_HEAD: - if (len - nl > 13 && memcmp(b, "begin ", 6) == 0) + if (len - nl >= 11 && memcmp(b, "begin ", 6) == 0) l = 6; - else if (len - nl > 18 && + else if (len - nl >= 18 && memcmp(b, "begin-base64 ", 13) == 0) l = 13; else Modified: stable/9/lib/libarchive/archive_read_support_format_all.c ============================================================================== --- stable/9/lib/libarchive/archive_read_support_format_all.c Thu Jan 5 11:42:34 2012 (r229587) +++ stable/9/lib/libarchive/archive_read_support_format_all.c Thu Jan 5 11:44:55 2012 (r229588) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2003-2007 Tim Kientzle + * Copyright (c) 2003-2011 Tim Kientzle * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -39,5 +39,13 @@ archive_read_support_format_all(struct a archive_read_support_format_tar(a); archive_read_support_format_xar(a); archive_read_support_format_zip(a); + + /* Note: We always return ARCHIVE_OK here, even if some of the + * above return ARCHIVE_WARN. The intent here is to enable + * "as much as possible." Clients who need specific + * compression should enable those individually so they can + * verify the level of support. */ + /* Clear any warning messages set by the above functions. */ + archive_clear_error(a); return (ARCHIVE_OK); } Modified: stable/9/lib/libarchive/archive_read_support_format_cpio.c ============================================================================== --- stable/9/lib/libarchive/archive_read_support_format_cpio.c Thu Jan 5 11:42:34 2012 (r229587) +++ stable/9/lib/libarchive/archive_read_support_format_cpio.c Thu Jan 5 11:44:55 2012 (r229588) @@ -264,9 +264,9 @@ archive_read_format_cpio_read_header(str /* Compare name to "TRAILER!!!" to test for end-of-archive. */ if (namelength == 11 && strcmp((const char *)h, "TRAILER!!!") == 0) { - /* TODO: Store file location of start of block. */ - archive_set_error(&a->archive, 0, NULL); - return (ARCHIVE_EOF); + /* TODO: Store file location of start of block. */ + archive_clear_error(&a->archive); + return (ARCHIVE_EOF); } /* Detect and record hardlinks to previously-extracted entries. */ Modified: stable/9/lib/libarchive/archive_read_support_format_iso9660.c ============================================================================== --- stable/9/lib/libarchive/archive_read_support_format_iso9660.c Thu Jan 5 11:42:34 2012 (r229587) +++ stable/9/lib/libarchive/archive_read_support_format_iso9660.c Thu Jan 5 11:44:55 2012 (r229588) @@ -302,6 +302,8 @@ struct file_info { struct file_info *first; struct file_info **last; } rede_files; + /* To check a ininity loop. */ + struct file_info *loop_by; }; struct heap_queue { @@ -934,14 +936,14 @@ read_children(struct archive_read *a, st archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Ignoring out-of-order directory (%s) %jd > %jd", parent->name.s, - iso9660->current_position, - parent->offset); + (intmax_t)iso9660->current_position, + (intmax_t)parent->offset); return (ARCHIVE_WARN); } if (parent->offset + parent->size > iso9660->volume_size) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Directory is beyond end-of-media: %s", - parent->name); + parent->name.s); return (ARCHIVE_WARN); } if (iso9660->current_position < parent->offset) { @@ -1139,7 +1141,7 @@ archive_read_format_iso9660_read_header( if (file->offset + file->size > iso9660->volume_size) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, - "File is beyond end-of-media: %s", file->name); + "File is beyond end-of-media: %s", file->name.s); iso9660->entry_bytes_remaining = 0; iso9660->entry_sparse_offset = 0; return (ARCHIVE_WARN); @@ -1198,10 +1200,10 @@ archive_read_format_iso9660_read_header( if ((file->mode & AE_IFMT) != AE_IFDIR && file->offset < iso9660->current_position) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, - "Ignoring out-of-order file @%x (%s) %jd < %jd", - file, + "Ignoring out-of-order file (%s) %jd < %jd", iso9660->pathname.s, - file->offset, iso9660->current_position); + (intmax_t)file->offset, + (intmax_t)iso9660->current_position); iso9660->entry_bytes_remaining = 0; iso9660->entry_sparse_offset = 0; return (ARCHIVE_WARN); @@ -1524,8 +1526,8 @@ archive_read_format_iso9660_read_data(st archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Ignoring out-of-order file (%s) %jd < %jd", iso9660->pathname.s, - iso9660->entry_content->offset, - iso9660->current_position); + (intmax_t)iso9660->entry_content->offset, + (intmax_t)iso9660->current_position); *buff = NULL; *size = 0; *offset = iso9660->entry_sparse_offset; @@ -1626,8 +1628,8 @@ parse_file_info(struct archive_read *a, */ if (location > 0 && (location + ((fsize + iso9660->logical_block_size -1) - / iso9660->logical_block_size)) > - (unsigned int)iso9660->volume_block) { + / iso9660->logical_block_size)) + > (uint32_t)iso9660->volume_block) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Invalid location of extent of file"); return (NULL); @@ -2699,8 +2701,14 @@ rede_add_entry(struct file_info *file) struct file_info *re; re = file->parent; - while (re != NULL && !re->re) + while (re != NULL && !re->re) { + /* Sanity check to prevent a infinity loop + * cause by a currupted iso file. */ + if (re->loop_by == file) + return (-1); + re->loop_by = file; re = re->parent; + } if (re == NULL) return (-1); Modified: stable/9/lib/libarchive/archive_read_support_format_tar.c ============================================================================== --- stable/9/lib/libarchive/archive_read_support_format_tar.c Thu Jan 5 11:42:34 2012 (r229587) +++ stable/9/lib/libarchive/archive_read_support_format_tar.c Thu Jan 5 11:44:55 2012 (r229588) @@ -576,7 +576,7 @@ tar_read_header(struct archive_read *a, h = __archive_read_ahead(a, 512, NULL); if (h != NULL) __archive_read_consume(a, 512); - archive_set_error(&a->archive, 0, NULL); + archive_clear_error(&a->archive); if (a->archive.archive_format_name == NULL) { a->archive.archive_format = ARCHIVE_FORMAT_TAR; a->archive.archive_format_name = "tar"; Modified: stable/9/lib/libarchive/archive_read_support_format_zip.c ============================================================================== --- stable/9/lib/libarchive/archive_read_support_format_zip.c Thu Jan 5 11:42:34 2012 (r229587) +++ stable/9/lib/libarchive/archive_read_support_format_zip.c Thu Jan 5 11:44:55 2012 (r229588) @@ -211,7 +211,7 @@ archive_read_format_zip_bid(struct archi /* Get 4k of data beyond where we stopped. */ buff = __archive_read_ahead(a, offset + 4096, &bytes_avail); - if (bytes_avail < offset + 1) + if (buff == NULL) break; p = (const char *)buff + offset; while (p + 9 < (const char *)buff + bytes_avail) { Modified: stable/9/lib/libarchive/archive_string.c ============================================================================== --- stable/9/lib/libarchive/archive_string.c Thu Jan 5 11:42:34 2012 (r229587) +++ stable/9/lib/libarchive/archive_string.c Thu Jan 5 11:44:55 2012 (r229588) @@ -152,7 +152,7 @@ __archive_strncat(struct archive_string /* Like strlen(p), except won't examine positions beyond p[n]. */ s = 0; pp = p; - while (*pp && s < n) { + while (s < n && *pp) { pp++; s++; } Modified: stable/9/lib/libarchive/archive_string.h ============================================================================== --- stable/9/lib/libarchive/archive_string.h Thu Jan 5 11:42:34 2012 (r229587) +++ stable/9/lib/libarchive/archive_string.h Thu Jan 5 11:44:55 2012 (r229588) @@ -44,6 +44,8 @@ #include #endif +#include "archive.h" + /* * Basic resizable/reusable string support a la Java's "StringBuffer." * @@ -134,10 +136,11 @@ void __archive_string_free(struct archiv /* Like 'vsprintf', but resizes the underlying string as necessary. */ void __archive_string_vsprintf(struct archive_string *, const char *, - va_list); + va_list) __LA_PRINTF(2, 0); #define archive_string_vsprintf __archive_string_vsprintf -void __archive_string_sprintf(struct archive_string *, const char *, ...); +void __archive_string_sprintf(struct archive_string *, const char *, ...) + __LA_PRINTF(2, 3); #define archive_string_sprintf __archive_string_sprintf /* Allocates a fresh buffer and converts as (assumed to be UTF-8) into it. Modified: stable/9/lib/libarchive/archive_util.c ============================================================================== --- stable/9/lib/libarchive/archive_util.c Thu Jan 5 11:42:34 2012 (r229587) +++ stable/9/lib/libarchive/archive_util.c Thu Jan 5 11:44:55 2012 (r229588) @@ -155,6 +155,7 @@ archive_clear_error(struct archive *a) { archive_string_empty(&a->error_string); a->error = NULL; + a->archive_error_number = 0; } void Modified: stable/9/lib/libarchive/archive_write_disk.c ============================================================================== --- stable/9/lib/libarchive/archive_write_disk.c Thu Jan 5 11:42:34 2012 (r229587) +++ stable/9/lib/libarchive/archive_write_disk.c Thu Jan 5 11:44:55 2012 (r229588) @@ -1513,6 +1513,22 @@ check_symlinks(struct archive_write_disk } #if defined(_WIN32) || defined(__CYGWIN__) +static int +guidword(const char *p, int n) +{ + int i; + + for (i = 0; i < n; i++) { + if ((*p >= '0' && *p <= '9') || + (*p >= 'a' && *p <= 'f') || + (*p >= 'A' && *p <= 'F')) + p++; + else + return (-1); + } + return (0); +} + /* * 1. Convert a path separator from '\' to '/' . * We shouldn't check multi-byte character directly because some @@ -1521,26 +1537,92 @@ check_symlinks(struct archive_write_disk * 2. Replace unusable characters in Windows with underscore('_'). * See also : http://msdn.microsoft.com/en-us/library/aa365247.aspx */ -static void +static int cleanup_pathname_win(struct archive_write_disk *a) { wchar_t wc; char *p; size_t alen, l; - alen = 0; - l = 0; - for (p = a->name; *p != '\0'; p++) { - ++alen; - if (*p == '\\') - l = 1; + p = a->name; + /* Skip leading "\\.\" or "\\?\" or "\\?\UNC\" or + * "\\?\Volume{GUID}\" + * (absolute path prefixes used by Windows API) */ + if ((p[0] == '\\' || p[0] == '/') && (p[1] == '\\' || p[1] == '/' ) && + (p[2] == '.' || p[2] == '?') && (p[3] == '\\' || p[3] == '/')) + { + /* A path begin with "\\?\UNC\" */ + if (p[2] == '?' && + (p[4] == 'U' || p[4] == 'u') && + (p[5] == 'N' || p[5] == 'n') && + (p[6] == 'C' || p[6] == 'c') && + (p[7] == '\\' || p[7] == '/')) + p += 8; + /* A path begin with "\\?\Volume{GUID}\" */ + else if (p[2] == '?' && + (p[4] == 'V' || p[4] == 'v') && + (p[5] == 'O' || p[5] == 'o') && + (p[6] == 'L' || p[6] == 'l') && + (p[7] == 'U' || p[7] == 'u') && + (p[8] == 'M' || p[8] == 'm') && + (p[9] == 'E' || p[9] == 'e') && + p[10] == '{') { + if (guidword(p+11, 8) == 0 && p[19] == '-' && + guidword(p+20, 4) == 0 && p[24] == '-' && + guidword(p+25, 4) == 0 && p[29] == '-' && + guidword(p+30, 4) == 0 && p[34] == '-' && + guidword(p+35, 12) == 0 && p[47] == '}' && + (p[48] == '\\' || p[48] == '/')) + p += 49; + else + p += 4; + /* A path begin with "\\.\PhysicalDriveX" */ + } else if (p[2] == '.' && + (p[4] == 'P' || p[4] == 'p') && + (p[5] == 'H' || p[5] == 'h') && + (p[6] == 'Y' || p[6] == 'y') && + (p[7] == 'S' || p[7] == 's') && + (p[8] == 'I' || p[8] == 'i') && + (p[9] == 'C' || p[9] == 'c') && + (p[9] == 'A' || p[9] == 'a') && + (p[9] == 'L' || p[9] == 'l') && + (p[9] == 'D' || p[9] == 'd') && + (p[9] == 'R' || p[9] == 'r') && + (p[9] == 'I' || p[9] == 'i') && + (p[9] == 'V' || p[9] == 'v') && + (p[9] == 'E' || p[9] == 'e') && + (p[10] >= '0' && p[10] <= '9') && + p[11] == '\0') { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Path is a physical drive name"); + return (ARCHIVE_FAILED); + } else + p += 4; + } + + /* Skip leading drive letter from archives created + * on Windows. */ + if (((p[0] >= 'a' && p[0] <= 'z') || + (p[0] >= 'A' && p[0] <= 'Z')) && + p[1] == ':') { + if (p[2] == '\0') { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Path is a drive name"); + return (ARCHIVE_FAILED); + } + if (p[2] == '\\' || p[2] == '/') + p += 3; + } + + for (; *p != '\0'; p++) { /* Rewrite the path name if its character is a unusable. */ if (*p == ':' || *p == '*' || *p == '?' || *p == '"' || *p == '<' || *p == '>' || *p == '|') *p = '_'; } - if (alen == 0 || l == 0) - return; + alen = p - a->name; + if (alen == 0 || strchr(a->name, '\\') == NULL) + return (ARCHIVE_OK); /* * Convert path separator. */ @@ -1560,6 +1642,7 @@ cleanup_pathname_win(struct archive_writ p += l; alen -= l; } + return (ARCHIVE_OK); } #endif @@ -1583,7 +1666,8 @@ cleanup_pathname(struct archive_write_di } #if defined(_WIN32) || defined(__CYGWIN__) - cleanup_pathname_win(a); + if (cleanup_pathname_win(a) != ARCHIVE_OK) + return (ARCHIVE_FAILED); #endif /* Skip leading '/'. */ if (*src == '/') @@ -1730,7 +1814,7 @@ create_dir(struct archive_write_disk *a, if (unlink(path) != 0) { archive_set_error(&a->archive, errno, "Can't create directory '%s': " - "Conflicting file cannot be removed"); + "Conflicting file cannot be removed", path); return (ARCHIVE_FAILED); } } else if (errno != ENOENT && errno != ENOTDIR) { Modified: stable/9/lib/libarchive/archive_write_set_compression_xz.c ============================================================================== --- stable/9/lib/libarchive/archive_write_set_compression_xz.c Thu Jan 5 11:42:34 2012 (r229587) +++ stable/9/lib/libarchive/archive_write_set_compression_xz.c Thu Jan 5 11:44:55 2012 (r229588) @@ -132,9 +132,10 @@ static int archive_compressor_xz_init_stream(struct archive_write *a, struct private_data *state) { + static const lzma_stream lzma_stream_init_data = LZMA_STREAM_INIT; int ret; - state->stream = (lzma_stream)LZMA_STREAM_INIT; + state->stream = lzma_stream_init_data; state->stream.next_out = state->compressed; state->stream.avail_out = state->compressed_buffer_size; if (a->archive.compression_code == ARCHIVE_COMPRESSION_XZ) Modified: stable/9/lib/libarchive/archive_write_set_format_ar.c ============================================================================== --- stable/9/lib/libarchive/archive_write_set_format_ar.c Thu Jan 5 11:42:34 2012 (r229587) +++ stable/9/lib/libarchive/archive_write_set_format_ar.c Thu Jan 5 11:44:55 2012 (r229588) @@ -440,7 +440,7 @@ archive_write_ar_finish_entry(struct arc if (ar->entry_padding != 1) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Padding wrong size: %d should be 1 or 0", - ar->entry_padding); + (int)ar->entry_padding); return (ARCHIVE_WARN); } Modified: stable/9/lib/libarchive/archive_write_set_format_shar.c ============================================================================== --- stable/9/lib/libarchive/archive_write_set_format_shar.c Thu Jan 5 11:42:34 2012 (r229587) +++ stable/9/lib/libarchive/archive_write_set_format_shar.c Thu Jan 5 11:44:55 2012 (r229588) @@ -537,8 +537,7 @@ archive_write_shar_finish_entry(struct a } if ((p = archive_entry_fflags_text(shar->entry)) != NULL) { - archive_string_sprintf(&shar->work, "chflags %s ", - p, archive_entry_pathname(shar->entry)); + archive_string_sprintf(&shar->work, "chflags %s ", p); shar_quote(&shar->work, archive_entry_pathname(shar->entry), 1); archive_strcat(&shar->work, "\n"); Modified: stable/9/lib/libarchive/archive_write_set_format_ustar.c ============================================================================== --- stable/9/lib/libarchive/archive_write_set_format_ustar.c Thu Jan 5 11:42:34 2012 (r229587) +++ stable/9/lib/libarchive/archive_write_set_format_ustar.c Thu Jan 5 11:44:55 2012 (r229588) @@ -168,7 +168,7 @@ archive_write_set_format_ustar(struct ar /* Basic internal sanity test. */ if (sizeof(template_header) != 512) { - archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Internal: template_header wrong size: %d should be 512", sizeof(template_header)); + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Internal: template_header wrong size: %d should be 512", (int)sizeof(template_header)); return (ARCHIVE_FATAL); } Modified: stable/9/lib/libarchive/config_freebsd.h ============================================================================== --- stable/9/lib/libarchive/config_freebsd.h Thu Jan 5 11:42:34 2012 (r229587) +++ stable/9/lib/libarchive/config_freebsd.h Thu Jan 5 11:44:55 2012 (r229588) @@ -68,6 +68,7 @@ #endif #define HAVE_BSDXML_H 1 +#define HAVE_BZLIB_H 1 #define HAVE_CHFLAGS 1 #define HAVE_CHOWN 1 #define HAVE_DECL_EXTATTR_NAMESPACE_USER 1 Modified: stable/9/lib/libarchive/libarchive-formats.5 ============================================================================== --- stable/9/lib/libarchive/libarchive-formats.5 Thu Jan 5 11:42:34 2012 (r229587) +++ stable/9/lib/libarchive/libarchive-formats.5 Thu Jan 5 11:44:55 2012 (r229588) @@ -65,6 +65,7 @@ Later variants have extended this by eit areas of the header record, extending the header to multiple records, or by storing special entries that modify the interpretation of subsequent entries. +.Pp .Bl -tag -width indent .It Cm gnutar The Modified: stable/9/lib/libarchive/libarchive.3 ============================================================================== --- stable/9/lib/libarchive/libarchive.3 Thu Jan 5 11:42:34 2012 (r229587) +++ stable/9/lib/libarchive/libarchive.3 Thu Jan 5 11:44:55 2012 (r229588) @@ -177,6 +177,8 @@ which provides a slightly more efficient You may prefer to use the higher-level .Fn archive_read_data_skip , which reads and discards the data for this entry, +.Fn archive_read_data_to_buffer , +which reads the data into an in-memory buffer, .Fn archive_read_data_to_file , which copies the data to the provided file descriptor, or .Fn archive_read_extract , Modified: stable/9/lib/libarchive/test/Makefile ============================================================================== --- stable/9/lib/libarchive/test/Makefile Thu Jan 5 11:42:34 2012 (r229587) +++ stable/9/lib/libarchive/test/Makefile Thu Jan 5 11:44:55 2012 (r229588) @@ -52,7 +52,7 @@ TESTS= \ test_read_format_gtar_gz.c \ test_read_format_gtar_lzma.c \ test_read_format_gtar_sparse.c \ - test_read_format_iso_gz.c \ + test_read_format_iso_Z.c \ test_read_format_iso_multi_extent.c \ test_read_format_isorr_rr_moved.c \ test_read_format_isojoliet_bz2.c \ Modified: stable/9/lib/libarchive/test/test_compat_zip.c ============================================================================== --- stable/9/lib/libarchive/test/test_compat_zip.c Thu Jan 5 11:42:34 2012 (r229587) +++ stable/9/lib/libarchive/test/test_compat_zip.c Thu Jan 5 11:44:55 2012 (r229588) @@ -67,7 +67,7 @@ finish: #if ARCHIVE_VERSION_NUMBER < 2000000 archive_read_finish(a); #else - assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); #endif } Copied: stable/9/lib/libarchive/test/test_read_format_iso_Z.c (from r228745, head/lib/libarchive/test/test_read_format_iso_Z.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/lib/libarchive/test/test_read_format_iso_Z.c Thu Jan 5 11:44:55 2012 (r229588, copy of r228745, head/lib/libarchive/test/test_read_format_iso_Z.c) @@ -0,0 +1,99 @@ +/*- + * Copyright (c) 2003-2007 Tim Kientzle + * 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 THE AUTHOR(S) ``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 THE AUTHOR(S) 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. + */ +#include "test.h" +__FBSDID("$FreeBSD$"); + +static void +test1(void) +{ + struct archive_entry *ae; + struct archive *a; + const char *name = "test_read_format_iso.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)); + 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_free(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_free(a)); +} + +DEFINE_TEST(test_read_format_iso_Z) +{ + test1(); + test2(); +} + + Modified: stable/9/usr.bin/cpio/Makefile ============================================================================== --- stable/9/usr.bin/cpio/Makefile Thu Jan 5 11:42:34 2012 (r229587) +++ stable/9/usr.bin/cpio/Makefile Thu Jan 5 11:44:55 2012 (r229588) @@ -3,7 +3,7 @@ .include PROG= bsdcpio -BSDCPIO_VERSION_STRING=2.8.4 +BSDCPIO_VERSION_STRING=2.8.5 SRCS= cpio.c cmdline.c Modified: stable/9/usr.bin/tar/Makefile ============================================================================== --- stable/9/usr.bin/tar/Makefile Thu Jan 5 11:42:34 2012 (r229587) +++ stable/9/usr.bin/tar/Makefile Thu Jan 5 11:44:55 2012 (r229588) @@ -2,7 +2,7 @@ .include PROG= bsdtar -BSDTAR_VERSION_STRING=2.8.4 +BSDTAR_VERSION_STRING=2.8.5 SRCS= bsdtar.c \ cmdline.c \ getdate.c \ Modified: stable/9/usr.bin/tar/tree.c ============================================================================== --- stable/9/usr.bin/tar/tree.c Thu Jan 5 11:42:34 2012 (r229587) +++ stable/9/usr.bin/tar/tree.c Thu Jan 5 11:44:55 2012 (r229588) @@ -48,6 +48,9 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_STAT_H #include #endif +#ifdef HAVE_DIRECT_H +#include +#endif #ifdef HAVE_DIRENT_H #include #endif @@ -66,6 +69,9 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_UNISTD_H #include #endif +#if defined(HAVE_WINDOWS_H) && !defined(__CYGWIN__) +#include +#endif #include "tree.h" @@ -76,27 +82,38 @@ __FBSDID("$FreeBSD$"); */ struct tree_entry { + int depth; struct tree_entry *next; struct tree_entry *parent; char *name; size_t dirname_length; dev_t dev; ino_t ino; + int flags; + /* How to return back to the parent of a symlink. */ #ifdef HAVE_FCHDIR - int fd; + int symlink_parent_fd; #elif defined(_WIN32) && !defined(__CYGWIN__) - char *fullpath; + char *symlink_parent_path; #else #error fchdir function required. #endif - int flags; }; /* Definitions for tree_entry.flags bitmap. */ #define isDir 1 /* This entry is a regular directory. */ #define isDirLink 2 /* This entry is a symbolic link to a directory. */ -#define needsPreVisit 4 /* This entry needs to be previsited. */ -#define needsPostVisit 8 /* This entry needs to be postvisited. */ +#define needsFirstVisit 4 /* This is an initial entry. */ +#define needsDescent 8 /* This entry needs to be previsited. */ +#define needsOpen 16 /* This is a directory that needs to be opened. */ +#define needsAscent 32 /* This entry needs to be postvisited. */ + +/* + * On Windows, "first visit" is handled as a pattern to be handed to + * _findfirst(). This is consistent with Windows conventions that + * file patterns are handled within the application. On Posix, + * "first visit" is just returned to the client. + */ /* * Local data for this package. @@ -104,21 +121,28 @@ struct tree_entry { struct tree { struct tree_entry *stack; struct tree_entry *current; +#if defined(HAVE_WINDOWS_H) && !defined(__CYGWIN__) + HANDLE d; + BY_HANDLE_FILE_INFORMATION fileInfo; +#define INVALID_DIR_HANDLE INVALID_HANDLE_VALUE + WIN32_FIND_DATA _findData; + WIN32_FIND_DATA *findData; +#else DIR *d; -#ifdef HAVE_FCHDIR - int initialDirFd; -#elif defined(_WIN32) && !defined(__CYGWIN__) - char *initialDir; +#define INVALID_DIR_HANDLE NULL + struct dirent *de; #endif int flags; int visit_type; int tree_errno; /* Error code from last failed operation. */ + /* Dynamically-sized buffer for holding path */ char *buff; - const char *basename; size_t buff_length; - size_t path_length; - size_t dirname_length; + + const char *basename; /* Last path element */ + size_t dirname_length; /* Leading dir length */ + size_t path_length; /* Total path length */ int depth; int openCount; @@ -129,10 +153,17 @@ struct tree { }; /* Definitions for tree.flags bitmap. */ -#define needsReturn 8 /* Marks first entry as not having been returned yet. */ -#define hasStat 16 /* The st entry is set. */ -#define hasLstat 32 /* The lst entry is set. */ +#define hasStat 16 /* The st entry is valid. */ +#define hasLstat 32 /* The lst entry is valid. */ +#define hasFileInfo 64 /* The Windows fileInfo entry is valid. */ +#if defined(_WIN32) && !defined(__CYGWIN__) +static int +tree_dir_next_windows(struct tree *t, const char *pattern); +#else +static int +tree_dir_next_posix(struct tree *t); +#endif #ifdef HAVE_DIRENT_D_NAMLEN /* BSD extension; avoids need for a strlen() call. */ @@ -141,25 +172,32 @@ struct tree { #define D_NAMELEN(dp) (strlen((dp)->d_name)) #endif -#if 0 #include void tree_dump(struct tree *t, FILE *out) { + char buff[300]; struct tree_entry *te; fprintf(out, "\tdepth: %d\n", t->depth); fprintf(out, "\tbuff: %s\n", t->buff); - fprintf(out, "\tpwd: "); fflush(stdout); system("pwd"); - fprintf(out, "\taccess: %s\n", t->basename); + fprintf(out, "\tpwd: %s\n", getcwd(buff, sizeof(buff))); + fprintf(out, "\tbasename: %s\n", t->basename); fprintf(out, "\tstack:\n"); for (te = t->stack; te != NULL; te = te->next) { - fprintf(out, "\t\tte->name: %s%s%s\n", te->name, - te->flags & needsPreVisit ? "" : " *", - t->current == te ? " (current)" : ""); + fprintf(out, "\t\t%s%d:\"%s\" %s%s%s%s%s%s\n", + t->current == te ? "*" : " ", + te->depth, + te->name, + te->flags & needsFirstVisit ? "V" : "", + te->flags & needsDescent ? "D" : "", + te->flags & needsOpen ? "O" : "", + te->flags & needsAscent ? "A" : "", + te->flags & isDirLink ? "L" : "", + (t->current == te && t->d) ? "+" : "" + ); } } -#endif /* * Add a directory path to the current stack. @@ -172,24 +210,29 @@ tree_push(struct tree *t, const char *pa te = malloc(sizeof(*te)); memset(te, 0, sizeof(*te)); te->next = t->stack; + te->parent = t->current; + if (te->parent) + te->depth = te->parent->depth + 1; t->stack = te; #ifdef HAVE_FCHDIR - te->fd = -1; + te->symlink_parent_fd = -1; + te->name = strdup(path); #elif defined(_WIN32) && !defined(__CYGWIN__) - te->fullpath = NULL; -#endif + te->symlink_parent_path = NULL; te->name = strdup(path); - te->flags = needsPreVisit | needsPostVisit; +#endif + te->flags = needsDescent | needsOpen | needsAscent; te->dirname_length = t->dirname_length; } /* - * Append a name to the current path. + * Append a name to the current dir path. */ static void tree_append(struct tree *t, const char *name, size_t name_length) { char *p; + size_t size_needed; if (t->buff != NULL) t->buff[t->dirname_length] = '\0'; @@ -198,12 +241,16 @@ tree_append(struct tree *t, const char * name_length--; /* Resize pathname buffer as needed. */ - while (name_length + 1 + t->dirname_length >= t->buff_length) { - t->buff_length *= 2; + size_needed = name_length + 1 + t->dirname_length; + if (t->buff_length < size_needed) { if (t->buff_length < 1024) t->buff_length = 1024; + while (t->buff_length < size_needed) + t->buff_length *= 2; t->buff = realloc(t->buff, t->buff_length); } + if (t->buff == NULL) + abort(); p = t->buff + t->dirname_length; t->path_length = t->dirname_length + name_length; /* Add a separating '/' if it's needed. */ @@ -211,7 +258,11 @@ tree_append(struct tree *t, const char * *p++ = '/'; t->path_length ++; } +#if HAVE_STRNCPY_S + strncpy_s(p, t->buff_length - (p - t->buff), name, name_length); +#else strncpy(p, name, name_length); +#endif p[name_length] = '\0'; t->basename = p; } @@ -222,24 +273,55 @@ tree_append(struct tree *t, const char * struct tree * tree_open(const char *path) { +#ifdef HAVE_FCHDIR struct tree *t; t = malloc(sizeof(*t)); memset(t, 0, sizeof(*t)); - tree_append(t, path, strlen(path)); -#ifdef HAVE_FCHDIR - t->initialDirFd = open(".", O_RDONLY); + /* First item is set up a lot like a symlink traversal. */ + tree_push(t, path); + t->stack->flags = needsFirstVisit | isDirLink | needsAscent; + t->stack->symlink_parent_fd = open(".", O_RDONLY); + t->openCount++; + t->d = INVALID_DIR_HANDLE; + return (t); #elif defined(_WIN32) && !defined(__CYGWIN__) - t->initialDir = getcwd(NULL, 0); -#endif - /* - * During most of the traversal, items are set up and then - * returned immediately from tree_next(). That doesn't work - * for the very first entry, so we set a flag for this special - * case. - */ - t->flags = needsReturn; + struct tree *t; + char *cwd = _getcwd(NULL, 0); + char *pathname = strdup(path), *p, *base; + + if (pathname == NULL) + abort(); + for (p = pathname; *p != '\0'; ++p) { + if (*p == '\\') + *p = '/'; + } + base = pathname; + + t = malloc(sizeof(*t)); + memset(t, 0, sizeof(*t)); + /* First item is set up a lot like a symlink traversal. */ + /* printf("Looking for wildcard in %s\n", path); */ + /* TODO: wildcard detection here screws up on \\?\c:\ UNC names */ + if (strchr(base, '*') || strchr(base, '?')) { + // It has a wildcard in it... + // Separate the last element. + p = strrchr(base, '/'); + if (p != NULL) { + *p = '\0'; + chdir(base); + tree_append(t, base, p - base); + t->dirname_length = t->path_length; + base = p + 1; + } + } + tree_push(t, base); + free(pathname); + t->stack->flags = needsFirstVisit | isDirLink | needsAscent; + t->stack->symlink_parent_path = cwd; + t->d = INVALID_DIR_HANDLE; return (t); +#endif } /* @@ -255,22 +337,26 @@ tree_ascend(struct tree *t) t->depth--; if (te->flags & isDirLink) { #ifdef HAVE_FCHDIR - if (fchdir(te->fd) != 0) { + if (fchdir(te->symlink_parent_fd) != 0) { t->tree_errno = errno; r = TREE_ERROR_FATAL; } - close(te->fd); + close(te->symlink_parent_fd); #elif defined(_WIN32) && !defined(__CYGWIN__) - if (chdir(te->fullpath) != 0) { + if (SetCurrentDirectory(te->symlink_parent_path) == 0) { t->tree_errno = errno; r = TREE_ERROR_FATAL; } - free(te->fullpath); - te->fullpath = NULL; + free(te->symlink_parent_path); + te->symlink_parent_path = NULL; #endif t->openCount--; } else { +#if defined(_WIN32) && !defined(__CYGWIN__) + if (SetCurrentDirectory("..") == 0) { +#else if (chdir("..") != 0) { +#endif t->tree_errno = errno; r = TREE_ERROR_FATAL; } @@ -286,16 +372,18 @@ tree_pop(struct tree *t) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 11:45:23 2012 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 159B310656DB; Thu, 5 Jan 2012 11:45:23 +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 F105C8FC14; Thu, 5 Jan 2012 11: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 q05BjMML033447; Thu, 5 Jan 2012 11:45:22 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05BjMAi033419; Thu, 5 Jan 2012 11:45:22 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201051145.q05BjMAi033419@svn.freebsd.org> From: Martin Matuska Date: Thu, 5 Jan 2012 11: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: r229589 - in stable/8: lib/libarchive lib/libarchive/test usr.bin/cpio usr.bin/tar 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, 05 Jan 2012 11:45:23 -0000 Author: mm Date: Thu Jan 5 11:45:22 2012 New Revision: 229589 URL: http://svn.freebsd.org/changeset/base/229589 Log: MFC r228744, r228745, r228748: MFC r228744 [1]: Merge vendor revision 3723: Fixes extraction of Zip entries that use length-at-end without specifying either the compressed or uncompressed length. In particular, fixes bsdtar extraction of such files. Reported by: Patrick Lamaiziere (freebsd-stable@) MFC r228745: Update libarchive, tar and cpio to version 2.8.5 The following additional vendor revisions are applied: Revision 3740: Use archive_clear_error() to clear the error markers. Obtained from: http://code.google.com/p/libarchive MFC r228748: Sync libarchive with vendor branch release/2.8: 3730: Fix issue 174 (Windows path names, not relevant for FreeBSD) 3734: Merge r1989: archive_clear_error should set errno to 0. 3735: Merge r3247 from trunk: Clear errors before returning from archive_read_support_format_all() 3799: Check the position before dereferencing the pointer. This avoids dereferencing one byte past the end of a string 3824: Merge r3823 from trunk for issue 199 (hang in iso9660 reading) Obtained from: http://code.google.com/p/libarchive Added: stable/8/lib/libarchive/test/test_read_format_iso_Z.c - copied unchanged from r228745, head/lib/libarchive/test/test_read_format_iso_Z.c Deleted: stable/8/lib/libarchive/test/test_read_format_iso_gz.c Modified: stable/8/lib/libarchive/archive.h stable/8/lib/libarchive/archive_read.c stable/8/lib/libarchive/archive_read_extract.c stable/8/lib/libarchive/archive_read_support_compression_bzip2.c stable/8/lib/libarchive/archive_read_support_compression_uu.c stable/8/lib/libarchive/archive_read_support_format_all.c stable/8/lib/libarchive/archive_read_support_format_cpio.c stable/8/lib/libarchive/archive_read_support_format_iso9660.c stable/8/lib/libarchive/archive_read_support_format_tar.c stable/8/lib/libarchive/archive_read_support_format_zip.c stable/8/lib/libarchive/archive_string.c stable/8/lib/libarchive/archive_string.h stable/8/lib/libarchive/archive_util.c stable/8/lib/libarchive/archive_write_disk.c stable/8/lib/libarchive/archive_write_set_compression_xz.c stable/8/lib/libarchive/archive_write_set_format_ar.c stable/8/lib/libarchive/archive_write_set_format_shar.c stable/8/lib/libarchive/archive_write_set_format_ustar.c stable/8/lib/libarchive/config_freebsd.h stable/8/lib/libarchive/libarchive-formats.5 stable/8/lib/libarchive/libarchive.3 stable/8/lib/libarchive/test/Makefile stable/8/lib/libarchive/test/test_compat_zip.c stable/8/usr.bin/cpio/Makefile stable/8/usr.bin/tar/Makefile stable/8/usr.bin/tar/tree.c Directory Properties: stable/8/lib/libarchive/ (props changed) stable/8/usr.bin/cpio/ (props changed) stable/8/usr.bin/tar/ (props changed) Modified: stable/8/lib/libarchive/archive.h ============================================================================== --- stable/8/lib/libarchive/archive.h Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/archive.h Thu Jan 5 11:45:22 2012 (r229589) @@ -52,7 +52,7 @@ /* These should match the types used in 'struct stat' */ #if defined(_WIN32) && !defined(__CYGWIN__) #define __LA_INT64_T __int64 -# if defined(_SSIZE_T_DEFINED) +# if defined(_SSIZE_T_DEFINED) || defined(_SSIZE_T_) # define __LA_SSIZE_T ssize_t # elif defined(_WIN64) # define __LA_SSIZE_T __int64 @@ -98,6 +98,13 @@ # define __LA_DECL #endif +#if defined(__GNUC__) && __GNUC__ >= 3 +#define __LA_PRINTF(fmtarg, firstvararg) \ + __attribute__((__format__ (__printf__, fmtarg, firstvararg))) +#else +#define __LA_PRINTF(fmtarg, firstvararg) /* nothing */ +#endif + #ifdef __cplusplus extern "C" { #endif @@ -129,13 +136,13 @@ extern "C" { * (ARCHIVE_API_VERSION * 1000000 + ARCHIVE_API_FEATURE * 1000) * #endif */ -#define ARCHIVE_VERSION_NUMBER 2008004 +#define ARCHIVE_VERSION_NUMBER 2008005 __LA_DECL int archive_version_number(void); /* * Textual name/version of the library, useful for version displays. */ -#define ARCHIVE_VERSION_STRING "libarchive 2.8.4" +#define ARCHIVE_VERSION_STRING "libarchive 2.8.5" __LA_DECL const char * archive_version_string(void); #if ARCHIVE_VERSION_NUMBER < 3000000 @@ -717,7 +724,7 @@ __LA_DECL const char *archive_format_nam __LA_DECL int archive_format(struct archive *); __LA_DECL void archive_clear_error(struct archive *); __LA_DECL void archive_set_error(struct archive *, int _err, - const char *fmt, ...); + const char *fmt, ...) __LA_PRINTF(3, 4); __LA_DECL void archive_copy_error(struct archive *dest, struct archive *src); __LA_DECL int archive_file_count(struct archive *); Modified: stable/8/lib/libarchive/archive_read.c ============================================================================== --- stable/8/lib/libarchive/archive_read.c Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/archive_read.c Thu Jan 5 11:45:22 2012 (r229589) @@ -715,7 +715,7 @@ archive_read_data_block(struct archive * /* * Close the file and release most resources. * - * Be careful: client might just call read_new and then read_finish. + * Be careful: client might just call read_new and then read_free. * Don't assume we actually read anything or performed any non-trivial * initialization. */ Modified: stable/8/lib/libarchive/archive_read_extract.c ============================================================================== --- stable/8/lib/libarchive/archive_read_extract.c Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/archive_read_extract.c Thu Jan 5 11:45:22 2012 (r229589) @@ -108,7 +108,7 @@ archive_read_extract2(struct archive *_a if (r != ARCHIVE_OK) /* If _write_header failed, copy the error. */ archive_copy_error(&a->archive, ad); - else if (archive_entry_size(entry) > 0) + else if (!archive_entry_size_is_set(entry) || archive_entry_size(entry) > 0) /* Otherwise, pour data into the entry. */ r = copy_data(_a, ad); r2 = archive_write_finish_entry(ad); Modified: stable/8/lib/libarchive/archive_read_support_compression_bzip2.c ============================================================================== --- stable/8/lib/libarchive/archive_read_support_compression_bzip2.c Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/archive_read_support_compression_bzip2.c Thu Jan 5 11:45:22 2012 (r229589) @@ -350,4 +350,4 @@ bzip2_filter_close(struct archive_read_f return (ret); } -#endif /* HAVE_BZLIB_H */ +#endif /* HAVE_BZLIB_H && BZ_CONFIG_ERROR */ Modified: stable/8/lib/libarchive/archive_read_support_compression_uu.c ============================================================================== --- stable/8/lib/libarchive/archive_read_support_compression_uu.c Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/archive_read_support_compression_uu.c Thu Jan 5 11:45:22 2012 (r229589) @@ -488,9 +488,9 @@ read_more: switch (uudecode->state) { default: case ST_FIND_HEAD: - if (len - nl > 13 && memcmp(b, "begin ", 6) == 0) + if (len - nl >= 11 && memcmp(b, "begin ", 6) == 0) l = 6; - else if (len - nl > 18 && + else if (len - nl >= 18 && memcmp(b, "begin-base64 ", 13) == 0) l = 13; else Modified: stable/8/lib/libarchive/archive_read_support_format_all.c ============================================================================== --- stable/8/lib/libarchive/archive_read_support_format_all.c Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/archive_read_support_format_all.c Thu Jan 5 11:45:22 2012 (r229589) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2003-2007 Tim Kientzle + * Copyright (c) 2003-2011 Tim Kientzle * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -39,5 +39,13 @@ archive_read_support_format_all(struct a archive_read_support_format_tar(a); archive_read_support_format_xar(a); archive_read_support_format_zip(a); + + /* Note: We always return ARCHIVE_OK here, even if some of the + * above return ARCHIVE_WARN. The intent here is to enable + * "as much as possible." Clients who need specific + * compression should enable those individually so they can + * verify the level of support. */ + /* Clear any warning messages set by the above functions. */ + archive_clear_error(a); return (ARCHIVE_OK); } Modified: stable/8/lib/libarchive/archive_read_support_format_cpio.c ============================================================================== --- stable/8/lib/libarchive/archive_read_support_format_cpio.c Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/archive_read_support_format_cpio.c Thu Jan 5 11:45:22 2012 (r229589) @@ -264,9 +264,9 @@ archive_read_format_cpio_read_header(str /* Compare name to "TRAILER!!!" to test for end-of-archive. */ if (namelength == 11 && strcmp((const char *)h, "TRAILER!!!") == 0) { - /* TODO: Store file location of start of block. */ - archive_set_error(&a->archive, 0, NULL); - return (ARCHIVE_EOF); + /* TODO: Store file location of start of block. */ + archive_clear_error(&a->archive); + return (ARCHIVE_EOF); } /* Detect and record hardlinks to previously-extracted entries. */ Modified: stable/8/lib/libarchive/archive_read_support_format_iso9660.c ============================================================================== --- stable/8/lib/libarchive/archive_read_support_format_iso9660.c Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/archive_read_support_format_iso9660.c Thu Jan 5 11:45:22 2012 (r229589) @@ -302,6 +302,8 @@ struct file_info { struct file_info *first; struct file_info **last; } rede_files; + /* To check a ininity loop. */ + struct file_info *loop_by; }; struct heap_queue { @@ -934,14 +936,14 @@ read_children(struct archive_read *a, st archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Ignoring out-of-order directory (%s) %jd > %jd", parent->name.s, - iso9660->current_position, - parent->offset); + (intmax_t)iso9660->current_position, + (intmax_t)parent->offset); return (ARCHIVE_WARN); } if (parent->offset + parent->size > iso9660->volume_size) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Directory is beyond end-of-media: %s", - parent->name); + parent->name.s); return (ARCHIVE_WARN); } if (iso9660->current_position < parent->offset) { @@ -1139,7 +1141,7 @@ archive_read_format_iso9660_read_header( if (file->offset + file->size > iso9660->volume_size) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, - "File is beyond end-of-media: %s", file->name); + "File is beyond end-of-media: %s", file->name.s); iso9660->entry_bytes_remaining = 0; iso9660->entry_sparse_offset = 0; return (ARCHIVE_WARN); @@ -1198,10 +1200,10 @@ archive_read_format_iso9660_read_header( if ((file->mode & AE_IFMT) != AE_IFDIR && file->offset < iso9660->current_position) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, - "Ignoring out-of-order file @%x (%s) %jd < %jd", - file, + "Ignoring out-of-order file (%s) %jd < %jd", iso9660->pathname.s, - file->offset, iso9660->current_position); + (intmax_t)file->offset, + (intmax_t)iso9660->current_position); iso9660->entry_bytes_remaining = 0; iso9660->entry_sparse_offset = 0; return (ARCHIVE_WARN); @@ -1524,8 +1526,8 @@ archive_read_format_iso9660_read_data(st archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Ignoring out-of-order file (%s) %jd < %jd", iso9660->pathname.s, - iso9660->entry_content->offset, - iso9660->current_position); + (intmax_t)iso9660->entry_content->offset, + (intmax_t)iso9660->current_position); *buff = NULL; *size = 0; *offset = iso9660->entry_sparse_offset; @@ -1626,8 +1628,8 @@ parse_file_info(struct archive_read *a, */ if (location > 0 && (location + ((fsize + iso9660->logical_block_size -1) - / iso9660->logical_block_size)) > - (unsigned int)iso9660->volume_block) { + / iso9660->logical_block_size)) + > (uint32_t)iso9660->volume_block) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Invalid location of extent of file"); return (NULL); @@ -2699,8 +2701,14 @@ rede_add_entry(struct file_info *file) struct file_info *re; re = file->parent; - while (re != NULL && !re->re) + while (re != NULL && !re->re) { + /* Sanity check to prevent a infinity loop + * cause by a currupted iso file. */ + if (re->loop_by == file) + return (-1); + re->loop_by = file; re = re->parent; + } if (re == NULL) return (-1); Modified: stable/8/lib/libarchive/archive_read_support_format_tar.c ============================================================================== --- stable/8/lib/libarchive/archive_read_support_format_tar.c Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/archive_read_support_format_tar.c Thu Jan 5 11:45:22 2012 (r229589) @@ -576,7 +576,7 @@ tar_read_header(struct archive_read *a, h = __archive_read_ahead(a, 512, NULL); if (h != NULL) __archive_read_consume(a, 512); - archive_set_error(&a->archive, 0, NULL); + archive_clear_error(&a->archive); if (a->archive.archive_format_name == NULL) { a->archive.archive_format = ARCHIVE_FORMAT_TAR; a->archive.archive_format_name = "tar"; Modified: stable/8/lib/libarchive/archive_read_support_format_zip.c ============================================================================== --- stable/8/lib/libarchive/archive_read_support_format_zip.c Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/archive_read_support_format_zip.c Thu Jan 5 11:45:22 2012 (r229589) @@ -211,7 +211,7 @@ archive_read_format_zip_bid(struct archi /* Get 4k of data beyond where we stopped. */ buff = __archive_read_ahead(a, offset + 4096, &bytes_avail); - if (bytes_avail < offset + 1) + if (buff == NULL) break; p = (const char *)buff + offset; while (p + 9 < (const char *)buff + bytes_avail) { Modified: stable/8/lib/libarchive/archive_string.c ============================================================================== --- stable/8/lib/libarchive/archive_string.c Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/archive_string.c Thu Jan 5 11:45:22 2012 (r229589) @@ -152,7 +152,7 @@ __archive_strncat(struct archive_string /* Like strlen(p), except won't examine positions beyond p[n]. */ s = 0; pp = p; - while (*pp && s < n) { + while (s < n && *pp) { pp++; s++; } Modified: stable/8/lib/libarchive/archive_string.h ============================================================================== --- stable/8/lib/libarchive/archive_string.h Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/archive_string.h Thu Jan 5 11:45:22 2012 (r229589) @@ -44,6 +44,8 @@ #include #endif +#include "archive.h" + /* * Basic resizable/reusable string support a la Java's "StringBuffer." * @@ -134,10 +136,11 @@ void __archive_string_free(struct archiv /* Like 'vsprintf', but resizes the underlying string as necessary. */ void __archive_string_vsprintf(struct archive_string *, const char *, - va_list); + va_list) __LA_PRINTF(2, 0); #define archive_string_vsprintf __archive_string_vsprintf -void __archive_string_sprintf(struct archive_string *, const char *, ...); +void __archive_string_sprintf(struct archive_string *, const char *, ...) + __LA_PRINTF(2, 3); #define archive_string_sprintf __archive_string_sprintf /* Allocates a fresh buffer and converts as (assumed to be UTF-8) into it. Modified: stable/8/lib/libarchive/archive_util.c ============================================================================== --- stable/8/lib/libarchive/archive_util.c Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/archive_util.c Thu Jan 5 11:45:22 2012 (r229589) @@ -155,6 +155,7 @@ archive_clear_error(struct archive *a) { archive_string_empty(&a->error_string); a->error = NULL; + a->archive_error_number = 0; } void Modified: stable/8/lib/libarchive/archive_write_disk.c ============================================================================== --- stable/8/lib/libarchive/archive_write_disk.c Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/archive_write_disk.c Thu Jan 5 11:45:22 2012 (r229589) @@ -1513,6 +1513,22 @@ check_symlinks(struct archive_write_disk } #if defined(_WIN32) || defined(__CYGWIN__) +static int +guidword(const char *p, int n) +{ + int i; + + for (i = 0; i < n; i++) { + if ((*p >= '0' && *p <= '9') || + (*p >= 'a' && *p <= 'f') || + (*p >= 'A' && *p <= 'F')) + p++; + else + return (-1); + } + return (0); +} + /* * 1. Convert a path separator from '\' to '/' . * We shouldn't check multi-byte character directly because some @@ -1521,26 +1537,92 @@ check_symlinks(struct archive_write_disk * 2. Replace unusable characters in Windows with underscore('_'). * See also : http://msdn.microsoft.com/en-us/library/aa365247.aspx */ -static void +static int cleanup_pathname_win(struct archive_write_disk *a) { wchar_t wc; char *p; size_t alen, l; - alen = 0; - l = 0; - for (p = a->name; *p != '\0'; p++) { - ++alen; - if (*p == '\\') - l = 1; + p = a->name; + /* Skip leading "\\.\" or "\\?\" or "\\?\UNC\" or + * "\\?\Volume{GUID}\" + * (absolute path prefixes used by Windows API) */ + if ((p[0] == '\\' || p[0] == '/') && (p[1] == '\\' || p[1] == '/' ) && + (p[2] == '.' || p[2] == '?') && (p[3] == '\\' || p[3] == '/')) + { + /* A path begin with "\\?\UNC\" */ + if (p[2] == '?' && + (p[4] == 'U' || p[4] == 'u') && + (p[5] == 'N' || p[5] == 'n') && + (p[6] == 'C' || p[6] == 'c') && + (p[7] == '\\' || p[7] == '/')) + p += 8; + /* A path begin with "\\?\Volume{GUID}\" */ + else if (p[2] == '?' && + (p[4] == 'V' || p[4] == 'v') && + (p[5] == 'O' || p[5] == 'o') && + (p[6] == 'L' || p[6] == 'l') && + (p[7] == 'U' || p[7] == 'u') && + (p[8] == 'M' || p[8] == 'm') && + (p[9] == 'E' || p[9] == 'e') && + p[10] == '{') { + if (guidword(p+11, 8) == 0 && p[19] == '-' && + guidword(p+20, 4) == 0 && p[24] == '-' && + guidword(p+25, 4) == 0 && p[29] == '-' && + guidword(p+30, 4) == 0 && p[34] == '-' && + guidword(p+35, 12) == 0 && p[47] == '}' && + (p[48] == '\\' || p[48] == '/')) + p += 49; + else + p += 4; + /* A path begin with "\\.\PhysicalDriveX" */ + } else if (p[2] == '.' && + (p[4] == 'P' || p[4] == 'p') && + (p[5] == 'H' || p[5] == 'h') && + (p[6] == 'Y' || p[6] == 'y') && + (p[7] == 'S' || p[7] == 's') && + (p[8] == 'I' || p[8] == 'i') && + (p[9] == 'C' || p[9] == 'c') && + (p[9] == 'A' || p[9] == 'a') && + (p[9] == 'L' || p[9] == 'l') && + (p[9] == 'D' || p[9] == 'd') && + (p[9] == 'R' || p[9] == 'r') && + (p[9] == 'I' || p[9] == 'i') && + (p[9] == 'V' || p[9] == 'v') && + (p[9] == 'E' || p[9] == 'e') && + (p[10] >= '0' && p[10] <= '9') && + p[11] == '\0') { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Path is a physical drive name"); + return (ARCHIVE_FAILED); + } else + p += 4; + } + + /* Skip leading drive letter from archives created + * on Windows. */ + if (((p[0] >= 'a' && p[0] <= 'z') || + (p[0] >= 'A' && p[0] <= 'Z')) && + p[1] == ':') { + if (p[2] == '\0') { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Path is a drive name"); + return (ARCHIVE_FAILED); + } + if (p[2] == '\\' || p[2] == '/') + p += 3; + } + + for (; *p != '\0'; p++) { /* Rewrite the path name if its character is a unusable. */ if (*p == ':' || *p == '*' || *p == '?' || *p == '"' || *p == '<' || *p == '>' || *p == '|') *p = '_'; } - if (alen == 0 || l == 0) - return; + alen = p - a->name; + if (alen == 0 || strchr(a->name, '\\') == NULL) + return (ARCHIVE_OK); /* * Convert path separator. */ @@ -1560,6 +1642,7 @@ cleanup_pathname_win(struct archive_writ p += l; alen -= l; } + return (ARCHIVE_OK); } #endif @@ -1583,7 +1666,8 @@ cleanup_pathname(struct archive_write_di } #if defined(_WIN32) || defined(__CYGWIN__) - cleanup_pathname_win(a); + if (cleanup_pathname_win(a) != ARCHIVE_OK) + return (ARCHIVE_FAILED); #endif /* Skip leading '/'. */ if (*src == '/') @@ -1730,7 +1814,7 @@ create_dir(struct archive_write_disk *a, if (unlink(path) != 0) { archive_set_error(&a->archive, errno, "Can't create directory '%s': " - "Conflicting file cannot be removed"); + "Conflicting file cannot be removed", path); return (ARCHIVE_FAILED); } } else if (errno != ENOENT && errno != ENOTDIR) { Modified: stable/8/lib/libarchive/archive_write_set_compression_xz.c ============================================================================== --- stable/8/lib/libarchive/archive_write_set_compression_xz.c Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/archive_write_set_compression_xz.c Thu Jan 5 11:45:22 2012 (r229589) @@ -132,9 +132,10 @@ static int archive_compressor_xz_init_stream(struct archive_write *a, struct private_data *state) { + static const lzma_stream lzma_stream_init_data = LZMA_STREAM_INIT; int ret; - state->stream = (lzma_stream)LZMA_STREAM_INIT; + state->stream = lzma_stream_init_data; state->stream.next_out = state->compressed; state->stream.avail_out = state->compressed_buffer_size; if (a->archive.compression_code == ARCHIVE_COMPRESSION_XZ) Modified: stable/8/lib/libarchive/archive_write_set_format_ar.c ============================================================================== --- stable/8/lib/libarchive/archive_write_set_format_ar.c Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/archive_write_set_format_ar.c Thu Jan 5 11:45:22 2012 (r229589) @@ -440,7 +440,7 @@ archive_write_ar_finish_entry(struct arc if (ar->entry_padding != 1) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Padding wrong size: %d should be 1 or 0", - ar->entry_padding); + (int)ar->entry_padding); return (ARCHIVE_WARN); } Modified: stable/8/lib/libarchive/archive_write_set_format_shar.c ============================================================================== --- stable/8/lib/libarchive/archive_write_set_format_shar.c Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/archive_write_set_format_shar.c Thu Jan 5 11:45:22 2012 (r229589) @@ -537,8 +537,7 @@ archive_write_shar_finish_entry(struct a } if ((p = archive_entry_fflags_text(shar->entry)) != NULL) { - archive_string_sprintf(&shar->work, "chflags %s ", - p, archive_entry_pathname(shar->entry)); + archive_string_sprintf(&shar->work, "chflags %s ", p); shar_quote(&shar->work, archive_entry_pathname(shar->entry), 1); archive_strcat(&shar->work, "\n"); Modified: stable/8/lib/libarchive/archive_write_set_format_ustar.c ============================================================================== --- stable/8/lib/libarchive/archive_write_set_format_ustar.c Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/archive_write_set_format_ustar.c Thu Jan 5 11:45:22 2012 (r229589) @@ -168,7 +168,7 @@ archive_write_set_format_ustar(struct ar /* Basic internal sanity test. */ if (sizeof(template_header) != 512) { - archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Internal: template_header wrong size: %d should be 512", sizeof(template_header)); + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Internal: template_header wrong size: %d should be 512", (int)sizeof(template_header)); return (ARCHIVE_FATAL); } Modified: stable/8/lib/libarchive/config_freebsd.h ============================================================================== --- stable/8/lib/libarchive/config_freebsd.h Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/config_freebsd.h Thu Jan 5 11:45:22 2012 (r229589) @@ -68,6 +68,7 @@ #endif #define HAVE_BSDXML_H 1 +#define HAVE_BZLIB_H 1 #define HAVE_CHFLAGS 1 #define HAVE_CHOWN 1 #define HAVE_DECL_EXTATTR_NAMESPACE_USER 1 Modified: stable/8/lib/libarchive/libarchive-formats.5 ============================================================================== --- stable/8/lib/libarchive/libarchive-formats.5 Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/libarchive-formats.5 Thu Jan 5 11:45:22 2012 (r229589) @@ -65,6 +65,7 @@ Later variants have extended this by eit areas of the header record, extending the header to multiple records, or by storing special entries that modify the interpretation of subsequent entries. +.Pp .Bl -tag -width indent .It Cm gnutar The Modified: stable/8/lib/libarchive/libarchive.3 ============================================================================== --- stable/8/lib/libarchive/libarchive.3 Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/libarchive.3 Thu Jan 5 11:45:22 2012 (r229589) @@ -177,6 +177,8 @@ which provides a slightly more efficient You may prefer to use the higher-level .Fn archive_read_data_skip , which reads and discards the data for this entry, +.Fn archive_read_data_to_buffer , +which reads the data into an in-memory buffer, .Fn archive_read_data_to_file , which copies the data to the provided file descriptor, or .Fn archive_read_extract , Modified: stable/8/lib/libarchive/test/Makefile ============================================================================== --- stable/8/lib/libarchive/test/Makefile Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/test/Makefile Thu Jan 5 11:45:22 2012 (r229589) @@ -52,7 +52,7 @@ TESTS= \ test_read_format_gtar_gz.c \ test_read_format_gtar_lzma.c \ test_read_format_gtar_sparse.c \ - test_read_format_iso_gz.c \ + test_read_format_iso_Z.c \ test_read_format_iso_multi_extent.c \ test_read_format_isorr_rr_moved.c \ test_read_format_isojoliet_bz2.c \ Modified: stable/8/lib/libarchive/test/test_compat_zip.c ============================================================================== --- stable/8/lib/libarchive/test/test_compat_zip.c Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/lib/libarchive/test/test_compat_zip.c Thu Jan 5 11:45:22 2012 (r229589) @@ -67,7 +67,7 @@ finish: #if ARCHIVE_VERSION_NUMBER < 2000000 archive_read_finish(a); #else - assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); #endif } Copied: stable/8/lib/libarchive/test/test_read_format_iso_Z.c (from r228745, head/lib/libarchive/test/test_read_format_iso_Z.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/lib/libarchive/test/test_read_format_iso_Z.c Thu Jan 5 11:45:22 2012 (r229589, copy of r228745, head/lib/libarchive/test/test_read_format_iso_Z.c) @@ -0,0 +1,99 @@ +/*- + * Copyright (c) 2003-2007 Tim Kientzle + * 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 THE AUTHOR(S) ``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 THE AUTHOR(S) 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. + */ +#include "test.h" +__FBSDID("$FreeBSD$"); + +static void +test1(void) +{ + struct archive_entry *ae; + struct archive *a; + const char *name = "test_read_format_iso.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)); + 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_free(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_free(a)); +} + +DEFINE_TEST(test_read_format_iso_Z) +{ + test1(); + test2(); +} + + Modified: stable/8/usr.bin/cpio/Makefile ============================================================================== --- stable/8/usr.bin/cpio/Makefile Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/usr.bin/cpio/Makefile Thu Jan 5 11:45:22 2012 (r229589) @@ -3,7 +3,7 @@ .include PROG= bsdcpio -BSDCPIO_VERSION_STRING=2.8.4 +BSDCPIO_VERSION_STRING=2.8.5 SRCS= cpio.c cmdline.c Modified: stable/8/usr.bin/tar/Makefile ============================================================================== --- stable/8/usr.bin/tar/Makefile Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/usr.bin/tar/Makefile Thu Jan 5 11:45:22 2012 (r229589) @@ -2,7 +2,7 @@ .include PROG= bsdtar -BSDTAR_VERSION_STRING=2.8.4 +BSDTAR_VERSION_STRING=2.8.5 SRCS= bsdtar.c \ cmdline.c \ getdate.c \ Modified: stable/8/usr.bin/tar/tree.c ============================================================================== --- stable/8/usr.bin/tar/tree.c Thu Jan 5 11:44:55 2012 (r229588) +++ stable/8/usr.bin/tar/tree.c Thu Jan 5 11:45:22 2012 (r229589) @@ -48,6 +48,9 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_STAT_H #include #endif +#ifdef HAVE_DIRECT_H +#include +#endif #ifdef HAVE_DIRENT_H #include #endif @@ -66,6 +69,9 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_UNISTD_H #include #endif +#if defined(HAVE_WINDOWS_H) && !defined(__CYGWIN__) +#include +#endif #include "tree.h" @@ -76,27 +82,38 @@ __FBSDID("$FreeBSD$"); */ struct tree_entry { + int depth; struct tree_entry *next; struct tree_entry *parent; char *name; size_t dirname_length; dev_t dev; ino_t ino; + int flags; + /* How to return back to the parent of a symlink. */ #ifdef HAVE_FCHDIR - int fd; + int symlink_parent_fd; #elif defined(_WIN32) && !defined(__CYGWIN__) - char *fullpath; + char *symlink_parent_path; #else #error fchdir function required. #endif - int flags; }; /* Definitions for tree_entry.flags bitmap. */ #define isDir 1 /* This entry is a regular directory. */ #define isDirLink 2 /* This entry is a symbolic link to a directory. */ -#define needsPreVisit 4 /* This entry needs to be previsited. */ -#define needsPostVisit 8 /* This entry needs to be postvisited. */ +#define needsFirstVisit 4 /* This is an initial entry. */ +#define needsDescent 8 /* This entry needs to be previsited. */ +#define needsOpen 16 /* This is a directory that needs to be opened. */ +#define needsAscent 32 /* This entry needs to be postvisited. */ + +/* + * On Windows, "first visit" is handled as a pattern to be handed to + * _findfirst(). This is consistent with Windows conventions that + * file patterns are handled within the application. On Posix, + * "first visit" is just returned to the client. + */ /* * Local data for this package. @@ -104,21 +121,28 @@ struct tree_entry { struct tree { struct tree_entry *stack; struct tree_entry *current; +#if defined(HAVE_WINDOWS_H) && !defined(__CYGWIN__) + HANDLE d; + BY_HANDLE_FILE_INFORMATION fileInfo; +#define INVALID_DIR_HANDLE INVALID_HANDLE_VALUE + WIN32_FIND_DATA _findData; + WIN32_FIND_DATA *findData; +#else DIR *d; -#ifdef HAVE_FCHDIR - int initialDirFd; -#elif defined(_WIN32) && !defined(__CYGWIN__) - char *initialDir; +#define INVALID_DIR_HANDLE NULL + struct dirent *de; #endif int flags; int visit_type; int tree_errno; /* Error code from last failed operation. */ + /* Dynamically-sized buffer for holding path */ char *buff; - const char *basename; size_t buff_length; - size_t path_length; - size_t dirname_length; + + const char *basename; /* Last path element */ + size_t dirname_length; /* Leading dir length */ + size_t path_length; /* Total path length */ int depth; int openCount; @@ -129,10 +153,17 @@ struct tree { }; /* Definitions for tree.flags bitmap. */ -#define needsReturn 8 /* Marks first entry as not having been returned yet. */ -#define hasStat 16 /* The st entry is set. */ -#define hasLstat 32 /* The lst entry is set. */ +#define hasStat 16 /* The st entry is valid. */ +#define hasLstat 32 /* The lst entry is valid. */ +#define hasFileInfo 64 /* The Windows fileInfo entry is valid. */ +#if defined(_WIN32) && !defined(__CYGWIN__) +static int +tree_dir_next_windows(struct tree *t, const char *pattern); +#else +static int +tree_dir_next_posix(struct tree *t); +#endif #ifdef HAVE_DIRENT_D_NAMLEN /* BSD extension; avoids need for a strlen() call. */ @@ -141,25 +172,32 @@ struct tree { #define D_NAMELEN(dp) (strlen((dp)->d_name)) #endif -#if 0 #include void tree_dump(struct tree *t, FILE *out) { + char buff[300]; struct tree_entry *te; fprintf(out, "\tdepth: %d\n", t->depth); fprintf(out, "\tbuff: %s\n", t->buff); - fprintf(out, "\tpwd: "); fflush(stdout); system("pwd"); - fprintf(out, "\taccess: %s\n", t->basename); + fprintf(out, "\tpwd: %s\n", getcwd(buff, sizeof(buff))); + fprintf(out, "\tbasename: %s\n", t->basename); fprintf(out, "\tstack:\n"); for (te = t->stack; te != NULL; te = te->next) { - fprintf(out, "\t\tte->name: %s%s%s\n", te->name, - te->flags & needsPreVisit ? "" : " *", - t->current == te ? " (current)" : ""); + fprintf(out, "\t\t%s%d:\"%s\" %s%s%s%s%s%s\n", + t->current == te ? "*" : " ", + te->depth, + te->name, + te->flags & needsFirstVisit ? "V" : "", + te->flags & needsDescent ? "D" : "", + te->flags & needsOpen ? "O" : "", + te->flags & needsAscent ? "A" : "", + te->flags & isDirLink ? "L" : "", + (t->current == te && t->d) ? "+" : "" + ); } } -#endif /* * Add a directory path to the current stack. @@ -172,24 +210,29 @@ tree_push(struct tree *t, const char *pa te = malloc(sizeof(*te)); memset(te, 0, sizeof(*te)); te->next = t->stack; + te->parent = t->current; + if (te->parent) + te->depth = te->parent->depth + 1; t->stack = te; #ifdef HAVE_FCHDIR - te->fd = -1; + te->symlink_parent_fd = -1; + te->name = strdup(path); #elif defined(_WIN32) && !defined(__CYGWIN__) - te->fullpath = NULL; -#endif + te->symlink_parent_path = NULL; te->name = strdup(path); - te->flags = needsPreVisit | needsPostVisit; +#endif + te->flags = needsDescent | needsOpen | needsAscent; te->dirname_length = t->dirname_length; } /* - * Append a name to the current path. + * Append a name to the current dir path. */ static void tree_append(struct tree *t, const char *name, size_t name_length) { char *p; + size_t size_needed; if (t->buff != NULL) t->buff[t->dirname_length] = '\0'; @@ -198,12 +241,16 @@ tree_append(struct tree *t, const char * name_length--; /* Resize pathname buffer as needed. */ - while (name_length + 1 + t->dirname_length >= t->buff_length) { - t->buff_length *= 2; + size_needed = name_length + 1 + t->dirname_length; + if (t->buff_length < size_needed) { if (t->buff_length < 1024) t->buff_length = 1024; + while (t->buff_length < size_needed) + t->buff_length *= 2; t->buff = realloc(t->buff, t->buff_length); } + if (t->buff == NULL) + abort(); p = t->buff + t->dirname_length; t->path_length = t->dirname_length + name_length; /* Add a separating '/' if it's needed. */ @@ -211,7 +258,11 @@ tree_append(struct tree *t, const char * *p++ = '/'; t->path_length ++; } +#if HAVE_STRNCPY_S + strncpy_s(p, t->buff_length - (p - t->buff), name, name_length); +#else strncpy(p, name, name_length); +#endif p[name_length] = '\0'; t->basename = p; } @@ -222,24 +273,55 @@ tree_append(struct tree *t, const char * struct tree * tree_open(const char *path) { +#ifdef HAVE_FCHDIR struct tree *t; t = malloc(sizeof(*t)); memset(t, 0, sizeof(*t)); - tree_append(t, path, strlen(path)); -#ifdef HAVE_FCHDIR - t->initialDirFd = open(".", O_RDONLY); + /* First item is set up a lot like a symlink traversal. */ + tree_push(t, path); + t->stack->flags = needsFirstVisit | isDirLink | needsAscent; + t->stack->symlink_parent_fd = open(".", O_RDONLY); + t->openCount++; + t->d = INVALID_DIR_HANDLE; + return (t); #elif defined(_WIN32) && !defined(__CYGWIN__) - t->initialDir = getcwd(NULL, 0); -#endif - /* - * During most of the traversal, items are set up and then - * returned immediately from tree_next(). That doesn't work - * for the very first entry, so we set a flag for this special - * case. - */ - t->flags = needsReturn; + struct tree *t; + char *cwd = _getcwd(NULL, 0); + char *pathname = strdup(path), *p, *base; + + if (pathname == NULL) + abort(); + for (p = pathname; *p != '\0'; ++p) { + if (*p == '\\') + *p = '/'; + } + base = pathname; + + t = malloc(sizeof(*t)); + memset(t, 0, sizeof(*t)); + /* First item is set up a lot like a symlink traversal. */ + /* printf("Looking for wildcard in %s\n", path); */ + /* TODO: wildcard detection here screws up on \\?\c:\ UNC names */ + if (strchr(base, '*') || strchr(base, '?')) { + // It has a wildcard in it... + // Separate the last element. + p = strrchr(base, '/'); + if (p != NULL) { + *p = '\0'; + chdir(base); + tree_append(t, base, p - base); + t->dirname_length = t->path_length; + base = p + 1; + } + } + tree_push(t, base); + free(pathname); + t->stack->flags = needsFirstVisit | isDirLink | needsAscent; + t->stack->symlink_parent_path = cwd; + t->d = INVALID_DIR_HANDLE; return (t); +#endif } /* @@ -255,22 +337,26 @@ tree_ascend(struct tree *t) t->depth--; if (te->flags & isDirLink) { #ifdef HAVE_FCHDIR - if (fchdir(te->fd) != 0) { + if (fchdir(te->symlink_parent_fd) != 0) { t->tree_errno = errno; r = TREE_ERROR_FATAL; } - close(te->fd); + close(te->symlink_parent_fd); #elif defined(_WIN32) && !defined(__CYGWIN__) - if (chdir(te->fullpath) != 0) { + if (SetCurrentDirectory(te->symlink_parent_path) == 0) { t->tree_errno = errno; r = TREE_ERROR_FATAL; } - free(te->fullpath); - te->fullpath = NULL; + free(te->symlink_parent_path); + te->symlink_parent_path = NULL; #endif t->openCount--; } else { +#if defined(_WIN32) && !defined(__CYGWIN__) + if (SetCurrentDirectory("..") == 0) { +#else if (chdir("..") != 0) { +#endif t->tree_errno = errno; r = TREE_ERROR_FATAL; } @@ -286,16 +372,18 @@ tree_pop(struct tree *t) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 12:05:48 2012 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 DAAC5106566B; Thu, 5 Jan 2012 12:05:48 +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 C5CD58FC15; Thu, 5 Jan 2012 12:05:48 +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 q05C5muR034367; Thu, 5 Jan 2012 12:05:48 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05C5mOG034365; Thu, 5 Jan 2012 12:05:48 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201201051205.q05C5mOG034365@svn.freebsd.org> From: Ed Schouten Date: Thu, 5 Jan 2012 12:05:48 +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: r229590 - head/include 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, 05 Jan 2012 12:05:48 -0000 Author: ed Date: Thu Jan 5 12:05:48 2012 New Revision: 229590 URL: http://svn.freebsd.org/changeset/base/229590 Log: Make _Complex_I a proper float _Complex when using GCC 4.2. It turns out our GCC has quite an interesting bug: typeof(1.0fi) != float _Complex typeof((float _Complex)1.0fi) != float _Complex typeof((float _Complex)1.0i) == float _Complex In other words: if casting to an equal size, GCC seems to take a shortcut. By casting down from a double to a float, GCC doesn't take this shortcut, yielding the proper type. To prevent foot-shooting, add a _Static_assert() to guarantee that _Complex_I is always a float _Complex. I'm not going to MFC this part of the diff. MFC after: 2 weeks Modified: head/include/complex.h Modified: head/include/complex.h ============================================================================== --- head/include/complex.h Thu Jan 5 11:45:22 2012 (r229589) +++ head/include/complex.h Thu Jan 5 12:05:48 2012 (r229590) @@ -29,11 +29,15 @@ #ifndef _COMPLEX_H #define _COMPLEX_H +#include + #ifdef __GNUC__ #if __STDC_VERSION__ < 199901 #define _Complex __complex__ #endif -#define _Complex_I 1.0fi +#define _Complex_I ((float _Complex)1.0i) +_Static_assert(__generic(_Complex_I, float _Complex, 1, 0), + "_Complex_I must be of type float _Complex"); #endif #define complex _Complex From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 12:06:51 2012 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 77A3D106566C; Thu, 5 Jan 2012 12:06:50 +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 27E098FC0A; Thu, 5 Jan 2012 12:06:50 +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 q05C6n1G034452; Thu, 5 Jan 2012 12:06:49 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05C6n9Y034450; Thu, 5 Jan 2012 12:06:49 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201201051206.q05C6n9Y034450@svn.freebsd.org> From: Ed Schouten Date: Thu, 5 Jan 2012 12:06: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: r229591 - head/include 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, 05 Jan 2012 12:06:51 -0000 Author: ed Date: Thu Jan 5 12:06:49 2012 New Revision: 229591 URL: http://svn.freebsd.org/changeset/base/229591 Log: Remove _Complex_I workaround from . This removes the use of __typeof() from this header, thus making it work with a plain C11 compiler. Modified: head/include/tgmath.h Modified: head/include/tgmath.h ============================================================================== --- head/include/tgmath.h Thu Jan 5 12:05:48 2012 (r229590) +++ head/include/tgmath.h Thu Jan 5 12:06:49 2012 (r229591) @@ -53,9 +53,6 @@ * Note that these macros cannot be implemented with C's ?: operator, * because the return type of the whole expression would incorrectly be long * double complex regardless of the argument types. - * - * The _Complex_I distinction should not be needed, but due to a bug in - * GCC 4.2, _Complex_I is not of type float _Complex. */ #ifndef __generic @@ -66,9 +63,8 @@ __generic(x, long double _Complex, fnl, \ __generic(x, double _Complex, fn, \ __generic(x, float _Complex, fnf, \ - __generic(x, __typeof(_Complex_I), fnf, \ - __generic(x, long double, fnl, \ - __generic(x, float, fnf, fn)))))) + __generic(x, long double, fnl, \ + __generic(x, float, fnf, fn))))) #define __tg_impl_simple(x, y, z, fnl, fn, fnf, ...) \ __tg_generic_simple(x, \ __tg_generic_simple(y, \ @@ -87,9 +83,8 @@ __generic(x, long double _Complex, cfnl, \ __generic(x, double _Complex, cfn, \ __generic(x, float _Complex, cfnf, \ - __generic(x, __typeof(_Complex_I), cfnf, \ - __generic(x, long double, fnl, \ - __generic(x, float, fnf, fn)))))) + __generic(x, long double, fnl, \ + __generic(x, float, fnf, fn))))) #define __tg_impl_full(x, y, cfnl, cfn, cfnf, fnl, fn, fnf, ...) \ __tg_generic_full(x, \ __tg_generic_full(y, cfnl, cfnl, cfnl, cfnl, cfnl, cfnl), \ From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 12:06:55 2012 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 CC3941065670; Thu, 5 Jan 2012 12:06:55 +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 B12678FC0C; Thu, 5 Jan 2012 12:06: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 q05C6tB9034544; Thu, 5 Jan 2012 12:06:55 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05C6s6v034482; Thu, 5 Jan 2012 12:06:54 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201051206.q05C6s6v034482@svn.freebsd.org> From: Martin Matuska Date: Thu, 5 Jan 2012 12:06:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229592 - in stable/9/contrib/libarchive: . build contrib cpio cpio/test doc examples libarchive libarchive/test libarchive_fe tar tar/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: Thu, 05 Jan 2012 12:06:55 -0000 Author: mm Date: Thu Jan 5 12:06:54 2012 New Revision: 229592 URL: http://svn.freebsd.org/changeset/base/229592 Log: MFC contrib/libarchive: r228761-r228764, r228770-r228777, r228835, r228911: MFC r228761: Copy libarchive from vendor branch to contrib MFC r228762: Add FREEBSD-Xlist and FREEBSD-upgrade to contrib/libarchive MFC r228763: Set svn:keywords to FreeBSD=%H for contrib/libarchive MFC r228764: Strip unnecessary files and directories from contrib/libarchive according to FREEBSD-Xlist MFC r228770: Remove libarchive/archive_entry_copy_bhfi.c and libarchive/mtree.5 Add these files to FREEBSD-Xlist MFC r228771: Partial merge of r224691 from lib/libarchive: Add compatibility for ISO images created with unfixed makefs that violated ECMA-119 (ISO9660): allow reserved4 to be 0x20 in PVD. This allows tar to read FreeBSD distribution ISO images created with makefs prior to NetBSD bin/45217 bugfix (up to 9.0-BETA1). MFC r228772: Add missing integer casts to comparsions in libarchive read. MFC r228773: Merge FreeBSD changes from lib/libarchive to contrib/libarchive: r204111 (uqs): Fix common misspelling of hierarchy r208027 (uqs): mdoc: move CAVEATS, BUGS and SECURITY CONSIDERATIONS sections to the bottom of the manpages and order them consistently. GNU groff doesn't care about the ordering, and doesn't even mention CAVEATS and SECURITY CONSIDERATIONS as common sections and where to put them. r208291 (uqs): mdoc: consistently spell our email addresses r209031 (uqs): mdoc nitpicking: the title argument shall be uppercase r214822 (kientzle): Clarify the naming: Methods that free an object should be called "free". Retain the old "finish" names to preserve source compatibility for now. r214905 (kientzle): If the Zip reader doesn't see a PK signature block because there's inter-entry garbage, just scan forward to find the next one. This allows us to handle a lot of Zip archives that have been modified in-place. Thanks to: Gleb Kurtsou for sending me a sample archive r216258 (kientzle): Don't write data into an empty "file." In particular, this check avoids a warning when extracting directory entries from certain GNU tar archives that store directory contents. r225525 (kientzle): Fix cpio on ARM. MFC r228774: Add $FreeBSD$ to libarchive_fe headers where missing. MFC r228775: Merge FreeBSD changes from usr.bin/tar to contrib/libarchive/libarchive_fe: r213469: Recognize both ! and ^ as markers for negated character classes. MFC r228776: Merge FreeBSD changes from usr.bin/tar to contrib/libarchive/tar: r204111 (uqs): Fix common misspelling of hierarchy r207786 (kientzle): Various manpage updates, including many long-option synonyms that were previously undocumented. r208028 (uqs): mdoc: move remaining sections into consistent order This pertains mostly to FILES, HISTORY, EXIT STATUS and AUTHORS sections. r209152 (kientzle): If the compressed data is larger than the uncompressed, report the compression ratio as 0% instead of displaying nonsense triggered by numeric overflow. This is common when dealing with uncompressed files when the I/O blocking causes there to be small transient differences in the accounting. r210720 (joel): Fix typos. r223541 (kientzle): If there is a read error reading Y/N confirmation from the keyboard, exit immediately with an error. If there is an error opening or reading a file to put into the archive, set the return value for a deferred error exit. r223573 (kientzle): The --newer-than test should descend into old directories to look for new files. r226636 (kientzle): Typo from previous commit. Urgh. r224153 (mm, partial): Update bsdtar.1 manpage MFC r228777: Merge FreeBSD changes from usr.bin/cpio to contrib/libarchive/cpio: r204111 (uqs): Fix common misspelling of hierarchy r211054 (kientzle); Fix -R when used with -p. Previously, the uname and gname weren't overwritten, so the disk restore would use those to lookup the original uid/gid again. Clearing the uname and gname prevents this. r212263 (gjb): Fix typo in bsdcpio manual: s/libarchive_formats/libarchive-formats MFC r228835: Fix typo s/xz/libarchive/ Reported by: Emil Mikulic (private e-mail) MFC r228911: Update to vendor revision 4016. Vendor has integrated most of our local changes in revisions 3976-3979 so future updates are going to be easier. Thanks to Tim Kientzle . Added: - copied from r228761, head/contrib/libarchive/ stable/9/contrib/libarchive/FREEBSD-Xlist - copied, changed from r228762, head/contrib/libarchive/FREEBSD-Xlist stable/9/contrib/libarchive/FREEBSD-upgrade - copied, changed from r228762, head/contrib/libarchive/FREEBSD-upgrade stable/9/contrib/libarchive/libarchive/test/test_compat_zip_2.zip.uu - copied unchanged from r228911, head/contrib/libarchive/libarchive/test/test_compat_zip_2.zip.uu Directory Properties: stable/9/contrib/libarchive/ (props changed) Deleted: stable/9/contrib/libarchive/CMakeLists.txt stable/9/contrib/libarchive/CTestConfig.cmake stable/9/contrib/libarchive/INSTALL stable/9/contrib/libarchive/Makefile.am stable/9/contrib/libarchive/build/ stable/9/contrib/libarchive/configure.ac stable/9/contrib/libarchive/contrib/ stable/9/contrib/libarchive/cpio/CMakeLists.txt stable/9/contrib/libarchive/cpio/cpio_windows.c stable/9/contrib/libarchive/cpio/cpio_windows.h stable/9/contrib/libarchive/cpio/test/CMakeLists.txt stable/9/contrib/libarchive/doc/ stable/9/contrib/libarchive/examples/ stable/9/contrib/libarchive/libarchive/CMakeLists.txt stable/9/contrib/libarchive/libarchive/archive_entry_copy_bhfi.c stable/9/contrib/libarchive/libarchive/archive_windows.c stable/9/contrib/libarchive/libarchive/archive_windows.h stable/9/contrib/libarchive/libarchive/filter_fork_windows.c stable/9/contrib/libarchive/libarchive/mtree.5 stable/9/contrib/libarchive/libarchive/test/.cvsignore stable/9/contrib/libarchive/libarchive/test/CMakeLists.txt stable/9/contrib/libarchive/tar/CMakeLists.txt stable/9/contrib/libarchive/tar/bsdtar_windows.c stable/9/contrib/libarchive/tar/bsdtar_windows.h stable/9/contrib/libarchive/tar/test/CMakeLists.txt stable/9/contrib/libarchive/tar/test/test_windows.c Modified: stable/9/contrib/libarchive/cpio/bsdcpio.1 (contents, props changed) stable/9/contrib/libarchive/cpio/cmdline.c (contents, props changed) stable/9/contrib/libarchive/cpio/config_freebsd.h (contents, props changed) stable/9/contrib/libarchive/cpio/cpio.c (contents, props changed) stable/9/contrib/libarchive/cpio/cpio.h (contents, props changed) stable/9/contrib/libarchive/cpio/cpio_platform.h (contents, props changed) stable/9/contrib/libarchive/cpio/test/main.c (contents, props changed) stable/9/contrib/libarchive/cpio/test/test.h (contents, props changed) stable/9/contrib/libarchive/cpio/test/test_basic.c (contents, props changed) stable/9/contrib/libarchive/cpio/test/test_format_newc.c (contents, props changed) stable/9/contrib/libarchive/cpio/test/test_gcpio_compat.c (contents, props changed) stable/9/contrib/libarchive/cpio/test/test_option_L_upper.c (contents, props changed) stable/9/contrib/libarchive/cpio/test/test_option_a.c (contents, props changed) stable/9/contrib/libarchive/cpio/test/test_option_tv.stdout.uu (contents, props changed) stable/9/contrib/libarchive/cpio/test/test_option_y.c (contents, props changed) stable/9/contrib/libarchive/cpio/test/test_passthrough_dotdot.c (contents, props changed) stable/9/contrib/libarchive/cpio/test/test_passthrough_reverse.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive.h (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_check_magic.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_crc32.h (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_endian.h (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_entry.3 (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_entry.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_entry.h (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_entry_copy_stat.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_entry_link_resolver.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_entry_private.h (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_entry_stat.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_entry_strmode.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_entry_xattr.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_hash.h (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_platform.h (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_private.h (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_read.3 (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_read.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_read_data_into_fd.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_read_disk.3 (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_read_disk.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_read_disk_private.h (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_read_disk_set_standard_lookup.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_read_extract.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_read_open_fd.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_read_open_file.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_read_open_filename.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_read_open_memory.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_read_private.h (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_read_support_compression_all.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_read_support_compression_bzip2.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_read_support_compression_compress.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_read_support_compression_gzip.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_read_support_compression_none.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_read_support_compression_program.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_read_support_compression_uu.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_read_support_compression_xz.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_read_support_format_all.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_read_support_format_ar.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_read_support_format_cpio.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_read_support_format_empty.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_read_support_format_iso9660.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_read_support_format_mtree.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_read_support_format_raw.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_read_support_format_tar.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_read_support_format_xar.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_read_support_format_zip.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_string.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_string.h (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_string_sprintf.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_util.3 (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_util.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_virtual.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_write.3 (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_write.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_write_disk.3 (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_write_disk.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_write_disk_private.h (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_write_disk_set_standard_lookup.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_write_open_fd.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_write_open_file.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_write_open_filename.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_write_open_memory.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_write_private.h (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_write_set_compression_bzip2.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_write_set_compression_compress.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_write_set_compression_gzip.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_write_set_compression_none.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_write_set_compression_program.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_write_set_compression_xz.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_write_set_format.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_write_set_format_ar.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_write_set_format_by_name.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_write_set_format_cpio.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_write_set_format_cpio_newc.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_write_set_format_mtree.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_write_set_format_pax.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_write_set_format_shar.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_write_set_format_ustar.c (contents, props changed) stable/9/contrib/libarchive/libarchive/archive_write_set_format_zip.c (contents, props changed) stable/9/contrib/libarchive/libarchive/config_freebsd.h (contents, props changed) stable/9/contrib/libarchive/libarchive/cpio.5 (contents, props changed) stable/9/contrib/libarchive/libarchive/filter_fork.c (contents, props changed) stable/9/contrib/libarchive/libarchive/filter_fork.h (contents, props changed) stable/9/contrib/libarchive/libarchive/libarchive-formats.5 (contents, props changed) stable/9/contrib/libarchive/libarchive/libarchive.3 (contents, props changed) stable/9/contrib/libarchive/libarchive/libarchive_internals.3 (contents, props changed) stable/9/contrib/libarchive/libarchive/tar.5 (contents, props changed) stable/9/contrib/libarchive/libarchive/test/README (contents, props changed) stable/9/contrib/libarchive/libarchive/test/main.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/read_open_memory.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test.h (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_acl_basic.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_acl_freebsd.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_acl_pax.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_archive_api_feature.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_bad_fd.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_compat_bzip2.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_compat_bzip2_1.tbz.uu (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_compat_bzip2_2.tbz.uu (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_compat_cpio.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_compat_cpio_1.cpio.uu (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_compat_gtar.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_compat_gtar_1.tar.uu (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_compat_gzip.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_compat_gzip_1.tgz.uu (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_compat_gzip_2.tgz.uu (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_compat_lzma.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_compat_lzma_1.tlz.uu (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_compat_lzma_2.tlz.uu (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_compat_lzma_3.tlz.uu (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_compat_solaris_tar_acl.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_compat_solaris_tar_acl.tar.uu (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_compat_tar_hardlink.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_compat_tar_hardlink_1.tar.uu (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_compat_xz.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_compat_xz_1.txz.uu (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_compat_zip.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_compat_zip_1.zip.uu (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_empty_write.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_entry.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_entry_strmode.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_extattr_freebsd.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_fuzz.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_fuzz_1.iso.Z.uu (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_link_resolver.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_open_fd.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_open_file.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_open_filename.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_pax_filename_encoding.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_pax_filename_encoding.tar.uu (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_compress_program.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_data_large.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_disk.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_disk_entry_from_file.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_extract.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_file_nonexistent.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_ar.ar.uu (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_ar.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_cpio_bin.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_cpio_bin_Z.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_cpio_bin_be.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_cpio_bin_be.cpio.uu (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_cpio_bin_bz2.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_cpio_bin_gz.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_cpio_bin_lzma.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_cpio_bin_xz.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_cpio_odc.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_cpio_svr4_gzip.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_cpio_svr4c_Z.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_empty.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_gtar_gz.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_gtar_lzma.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_1_13.tar.uu (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_1_17.tar.uu (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_1_17_posix00.tar.uu (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_1_17_posix01.tar.uu (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_1_17_posix10.tar.uu (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_1_17_posix10_modified.tar.uu (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_iso.iso.Z.uu (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_iso_Z.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_iso_joliet.iso.Z.uu (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_iso_joliet_long.iso.Z.uu (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_iso_joliet_rockridge.iso.Z.uu (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_iso_multi_extent.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_iso_multi_extent.iso.Z.uu (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_iso_rockridge.iso.Z.uu (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_iso_rockridge_ce.iso.Z.uu (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_iso_rockridge_new.iso.Z.uu (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_iso_rockridge_rr_moved.iso.Z.uu (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_iso_zisofs.iso.Z.uu (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_isojoliet_bz2.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_isojoliet_long.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_isojoliet_rr.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_isorr_bz2.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_isorr_ce.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_isorr_new_bz2.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_isorr_rr_moved.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_isozisofs_bz2.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_mtree.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_mtree.mtree.uu (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_pax_bz2.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_raw.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_raw.data.Z.uu (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_raw.data.uu (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_tar.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_tar_empty_filename.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_tar_empty_filename.tar.uu (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_tbz.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_tgz.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_tlz.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_txz.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_tz.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_zip.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_zip.zip.uu (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_large.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_pax_truncated.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_position.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_truncated.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_read_uu.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_tar_filenames.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_tar_large.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_ustar_filenames.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_write_compress.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_write_compress_bzip2.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_write_compress_gzip.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_write_compress_lzma.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_write_compress_program.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_write_compress_xz.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_write_disk.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_write_disk_failures.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_write_disk_hardlink.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_write_disk_perms.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_write_disk_secure.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_write_disk_sparse.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_write_disk_symlink.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_write_disk_times.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_write_format_ar.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_write_format_cpio.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_write_format_cpio_empty.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_write_format_cpio_newc.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_write_format_cpio_odc.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_write_format_mtree.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_write_format_shar_empty.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_write_format_tar.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_write_format_tar_empty.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_write_format_tar_ustar.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_write_format_zip.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_write_format_zip_empty.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_write_format_zip_no_compression.c (contents, props changed) stable/9/contrib/libarchive/libarchive/test/test_write_open_memory.c (contents, props changed) stable/9/contrib/libarchive/libarchive_fe/err.h (contents, props changed) stable/9/contrib/libarchive/libarchive_fe/lafe_platform.h (contents, props changed) stable/9/contrib/libarchive/libarchive_fe/line_reader.h (contents, props changed) stable/9/contrib/libarchive/libarchive_fe/matching.c (contents, props changed) stable/9/contrib/libarchive/libarchive_fe/pathmatch.c (contents, props changed) stable/9/contrib/libarchive/tar/bsdtar.1 (contents, props changed) stable/9/contrib/libarchive/tar/bsdtar.c (contents, props changed) stable/9/contrib/libarchive/tar/bsdtar.h (contents, props changed) stable/9/contrib/libarchive/tar/bsdtar_platform.h (contents, props changed) stable/9/contrib/libarchive/tar/config_freebsd.h (contents, props changed) stable/9/contrib/libarchive/tar/read.c (contents, props changed) stable/9/contrib/libarchive/tar/subst.c (contents, props changed) stable/9/contrib/libarchive/tar/test/main.c (contents, props changed) stable/9/contrib/libarchive/tar/test/test.h (contents, props changed) stable/9/contrib/libarchive/tar/test/test_0.c (contents, props changed) stable/9/contrib/libarchive/tar/test/test_basic.c (contents, props changed) stable/9/contrib/libarchive/tar/test/test_copy.c (contents, props changed) stable/9/contrib/libarchive/tar/test/test_getdate.c (contents, props changed) stable/9/contrib/libarchive/tar/test/test_help.c (contents, props changed) stable/9/contrib/libarchive/tar/test/test_option_T_upper.c (contents, props changed) stable/9/contrib/libarchive/tar/test/test_option_q.c (contents, props changed) stable/9/contrib/libarchive/tar/test/test_option_s.c (contents, props changed) stable/9/contrib/libarchive/tar/test/test_patterns.c (contents, props changed) stable/9/contrib/libarchive/tar/test/test_stdio.c (contents, props changed) stable/9/contrib/libarchive/tar/test/test_strip_components.c (contents, props changed) stable/9/contrib/libarchive/tar/test/test_symlink_dir.c (contents, props changed) stable/9/contrib/libarchive/tar/test/test_version.c (contents, props changed) stable/9/contrib/libarchive/tar/tree.c (contents, props changed) stable/9/contrib/libarchive/tar/tree.h (contents, props changed) stable/9/contrib/libarchive/tar/util.c (contents, props changed) stable/9/contrib/libarchive/tar/write.c (contents, props changed) Directory Properties: stable/9/ (props changed) stable/9/contrib/libarchive/COPYING (props changed) stable/9/contrib/libarchive/NEWS (props changed) stable/9/contrib/libarchive/README (props changed) stable/9/contrib/libarchive/cpio/ (props changed) stable/9/contrib/libarchive/cpio/test/test_0.c (props changed) stable/9/contrib/libarchive/cpio/test/test_cmdline.c (props changed) stable/9/contrib/libarchive/cpio/test/test_gcpio_compat_ref.bin.uu (props changed) stable/9/contrib/libarchive/cpio/test/test_gcpio_compat_ref.crc.uu (props changed) stable/9/contrib/libarchive/cpio/test/test_gcpio_compat_ref.newc.uu (props changed) stable/9/contrib/libarchive/cpio/test/test_gcpio_compat_ref.ustar.uu (props changed) stable/9/contrib/libarchive/cpio/test/test_gcpio_compat_ref_nosym.bin.uu (props changed) stable/9/contrib/libarchive/cpio/test/test_gcpio_compat_ref_nosym.crc.uu (props changed) stable/9/contrib/libarchive/cpio/test/test_gcpio_compat_ref_nosym.newc.uu (props changed) stable/9/contrib/libarchive/cpio/test/test_gcpio_compat_ref_nosym.ustar.uu (props changed) stable/9/contrib/libarchive/cpio/test/test_option_B_upper.c (props changed) stable/9/contrib/libarchive/cpio/test/test_option_C_upper.c (props changed) stable/9/contrib/libarchive/cpio/test/test_option_J_upper.c (props changed) stable/9/contrib/libarchive/cpio/test/test_option_Z_upper.c (props changed) stable/9/contrib/libarchive/cpio/test/test_option_c.c (props changed) stable/9/contrib/libarchive/cpio/test/test_option_d.c (props changed) stable/9/contrib/libarchive/cpio/test/test_option_f.c (props changed) stable/9/contrib/libarchive/cpio/test/test_option_f.cpio.uu (props changed) stable/9/contrib/libarchive/cpio/test/test_option_help.c (props changed) stable/9/contrib/libarchive/cpio/test/test_option_l.c (props changed) stable/9/contrib/libarchive/cpio/test/test_option_lzma.c (props changed) stable/9/contrib/libarchive/cpio/test/test_option_m.c (props changed) stable/9/contrib/libarchive/cpio/test/test_option_m.cpio.uu (props changed) stable/9/contrib/libarchive/cpio/test/test_option_t.c (props changed) stable/9/contrib/libarchive/cpio/test/test_option_t.cpio.uu (props changed) stable/9/contrib/libarchive/cpio/test/test_option_t.stdout.uu (props changed) stable/9/contrib/libarchive/cpio/test/test_option_u.c (props changed) stable/9/contrib/libarchive/cpio/test/test_option_version.c (props changed) stable/9/contrib/libarchive/cpio/test/test_option_z.c (props changed) stable/9/contrib/libarchive/cpio/test/test_owner_parse.c (props changed) stable/9/contrib/libarchive/cpio/test/test_pathmatch.c (props changed) stable/9/contrib/libarchive/libarchive/ (props changed) stable/9/contrib/libarchive/libarchive/archive_read_support_compression_rpm.c (props changed) stable/9/contrib/libarchive/libarchive/test/test_open_failure.c (props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.c (props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.rpm.uu (props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_cpio_svr4_gzip_rpm.c (props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_cpio_svr4_gzip_rpm.rpm.uu (props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_iso_2.iso.Z.uu (props changed) stable/9/contrib/libarchive/libarchive/test/test_read_format_xar.c (props changed) stable/9/contrib/libarchive/libarchive/test/test_write_format_pax.c (props changed) stable/9/contrib/libarchive/libarchive_fe/ (props changed) stable/9/contrib/libarchive/libarchive_fe/err.c (props changed) stable/9/contrib/libarchive/libarchive_fe/line_reader.c (props changed) stable/9/contrib/libarchive/libarchive_fe/matching.h (props changed) stable/9/contrib/libarchive/libarchive_fe/pathmatch.h (props changed) stable/9/contrib/libarchive/tar/ (props changed) stable/9/contrib/libarchive/tar/cmdline.c (props changed) stable/9/contrib/libarchive/tar/getdate.c (props changed) stable/9/contrib/libarchive/tar/test/test_empty_mtree.c (props changed) stable/9/contrib/libarchive/tar/test/test_option_r.c (props changed) stable/9/contrib/libarchive/tar/test/test_patterns_2.tar.uu (props changed) stable/9/contrib/libarchive/tar/test/test_patterns_3.tar.uu (props changed) stable/9/contrib/libarchive/tar/test/test_patterns_4.tar.uu (props changed) Copied and modified: stable/9/contrib/libarchive/FREEBSD-Xlist (from r228762, head/contrib/libarchive/FREEBSD-Xlist) ============================================================================== --- head/contrib/libarchive/FREEBSD-Xlist Wed Dec 21 11:11:51 2011 (r228762, copy source) +++ stable/9/contrib/libarchive/FREEBSD-Xlist Thu Jan 5 12:06:54 2012 (r229592) @@ -13,9 +13,11 @@ cpio/test/CMakeLists.txt doc examples libarchive/CMakeLists.txt +libarchive/archive_entry_copy_bhfi.c libarchive/archive_windows.c libarchive/archive_windows.h libarchive/filter_fork_windows.c +libarchive/mtree.5 libarchive/test/.cvsignore libarchive/test/CMakeLists.txt tar/CMakeLists.txt Copied and modified: stable/9/contrib/libarchive/FREEBSD-upgrade (from r228762, head/contrib/libarchive/FREEBSD-upgrade) ============================================================================== --- head/contrib/libarchive/FREEBSD-upgrade Wed Dec 21 11:11:51 2011 (r228762, copy source) +++ stable/9/contrib/libarchive/FREEBSD-upgrade Thu Jan 5 12:06:54 2012 (r229592) @@ -17,7 +17,7 @@ at FreeBSD wiki: http://wiki.freebsd.org/SubversionPrimer/VendorImports -To make local changes to xz, simply patch and commit to the trunk +To make local changes to libarchive, simply patch and commit to the trunk branch (aka HEAD). Never make local changes on the vendor branch. mm@FreeBSD.org Modified: stable/9/contrib/libarchive/cpio/bsdcpio.1 ============================================================================== --- head/contrib/libarchive/cpio/bsdcpio.1 Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/cpio/bsdcpio.1 Thu Jan 5 12:06:54 2012 (r229592) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 21, 2007 +.Dd September 5, 2010 .Dt BSDCPIO 1 .Os .Sh NAME @@ -140,7 +140,7 @@ The POSIX.1 tar format. The default format is .Ar odc . See -.Xr libarchive_formats 5 +.Xr libarchive-formats 5 for more complete information about the formats currently supported by the underlying .Xr libarchive 3 @@ -295,7 +295,7 @@ for more information. .Sh EXAMPLES The .Nm -command is traditionally used to copy file heirarchies in conjunction +command is traditionally used to copy file hierarchies in conjunction with the .Xr find 1 command. Modified: stable/9/contrib/libarchive/cpio/cmdline.c ============================================================================== --- head/contrib/libarchive/cpio/cmdline.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/cpio/cmdline.c Thu Jan 5 12:06:54 2012 (r229592) @@ -26,7 +26,7 @@ #include "cpio_platform.h" -__FBSDID("$FreeBSD: src/usr.bin/cpio/cmdline.c,v 1.5 2008/12/06 07:30:40 kientzle Exp $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_ERRNO_H #include @@ -285,6 +285,8 @@ cpio_getopt(struct cpio *cpio) * A period can be used instead of the colon. * * Sets uid/gid return as appropriate, -1 indicates uid/gid not specified. + * TODO: If the spec uses uname/gname, then return those to the caller + * as well. If the spec provides uid/gid, just return names as NULL. * * Returns NULL if no error, otherwise returns error string for display. * Modified: stable/9/contrib/libarchive/cpio/config_freebsd.h ============================================================================== --- head/contrib/libarchive/cpio/config_freebsd.h Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/cpio/config_freebsd.h Thu Jan 5 12:06:54 2012 (r229592) @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/usr.bin/cpio/config_freebsd.h,v 1.3 2008/12/06 07:30:40 kientzle Exp $ + * $FreeBSD$ */ /* A hand-tooled configuration for FreeBSD. */ Modified: stable/9/contrib/libarchive/cpio/cpio.c ============================================================================== --- head/contrib/libarchive/cpio/cpio.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/cpio/cpio.c Thu Jan 5 12:06:54 2012 (r229592) @@ -26,7 +26,7 @@ #include "cpio_platform.h" -__FBSDID("$FreeBSD: src/usr.bin/cpio/cpio.c,v 1.15 2008/12/06 07:30:40 kientzle Exp $"); +__FBSDID("$FreeBSD$"); #include #include @@ -273,15 +273,21 @@ main(int argc, char *argv[]) cpio->quiet = 1; break; case 'R': /* GNU cpio, also --owner */ + /* TODO: owner_parse should return uname/gname + * also; use that to set [ug]name_override. */ errmsg = owner_parse(cpio->optarg, &uid, &gid); if (errmsg) { lafe_warnc(-1, "%s", errmsg); usage(); } - if (uid != -1) + if (uid != -1) { cpio->uid_override = uid; - if (gid != -1) + cpio->uname_override = NULL; + } + if (gid != -1) { cpio->gid_override = gid; + cpio->gname_override = NULL; + } break; case 'r': /* POSIX 1997 */ cpio->option_rename = 1; @@ -575,10 +581,14 @@ file_to_archive(struct cpio *cpio, const return (r); } - if (cpio->uid_override >= 0) + if (cpio->uid_override >= 0) { archive_entry_set_uid(entry, cpio->uid_override); - if (cpio->gid_override >= 0) + archive_entry_set_uname(entry, cpio->uname_override); + } + if (cpio->gid_override >= 0) { archive_entry_set_gid(entry, cpio->gid_override); + archive_entry_set_gname(entry, cpio->gname_override); + } /* * Generate a destination path for this entry. Modified: stable/9/contrib/libarchive/cpio/cpio.h ============================================================================== --- head/contrib/libarchive/cpio/cpio.h Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/cpio/cpio.h Thu Jan 5 12:06:54 2012 (r229592) @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/usr.bin/cpio/cpio.h,v 1.7 2008/12/06 07:30:40 kientzle Exp $ + * $FreeBSD$ */ #ifndef CPIO_H_INCLUDED @@ -68,7 +68,9 @@ struct cpio { size_t pass_destpath_alloc; char *pass_destpath; int uid_override; + char *uname_override; int gid_override; + char *gname_override; int day_first; /* true if locale prefers day/mon */ /* If >= 0, then close this when done. */ Modified: stable/9/contrib/libarchive/cpio/cpio_platform.h ============================================================================== --- head/contrib/libarchive/cpio/cpio_platform.h Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/cpio/cpio_platform.h Thu Jan 5 12:06:54 2012 (r229592) @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/usr.bin/cpio/cpio_platform.h,v 1.2 2008/12/06 07:15:42 kientzle Exp $ + * $FreeBSD$ */ /* Modified: stable/9/contrib/libarchive/cpio/test/main.c ============================================================================== --- head/contrib/libarchive/cpio/test/main.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/cpio/test/main.c Thu Jan 5 12:06:54 2012 (r229592) @@ -36,7 +36,7 @@ * TODO: Move this into a separate configuration header, have all test * suites share one copy of this file. */ -__FBSDID("$FreeBSD: src/usr.bin/cpio/test/main.c,v 1.3 2008/08/24 04:58:22 kientzle Exp $"); +__FBSDID("$FreeBSD$"); #define KNOWNREF "test_option_f.cpio.uu" #define ENVBASE "BSDCPIO" /* Prefix for environment variables. */ #define PROGRAM "bsdcpio" /* Name of program being tested. */ Modified: stable/9/contrib/libarchive/cpio/test/test.h ============================================================================== --- head/contrib/libarchive/cpio/test/test.h Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/cpio/test/test.h Thu Jan 5 12:06:54 2012 (r229592) @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/usr.bin/cpio/test/test.h,v 1.2 2008/06/21 02:17:18 kientzle Exp $ + * $FreeBSD$ */ /* Every test program should #include "test.h" as the first thing. */ Modified: stable/9/contrib/libarchive/cpio/test/test_basic.c ============================================================================== --- head/contrib/libarchive/cpio/test/test_basic.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/cpio/test/test_basic.c Thu Jan 5 12:06:54 2012 (r229592) @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/usr.bin/cpio/test/test_basic.c,v 1.4 2008/08/25 06:39:29 kientzle Exp $"); +__FBSDID("$FreeBSD$"); static void verify_files(const char *msg) Modified: stable/9/contrib/libarchive/cpio/test/test_format_newc.c ============================================================================== --- head/contrib/libarchive/cpio/test/test_format_newc.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/cpio/test/test_format_newc.c Thu Jan 5 12:06:54 2012 (r229592) @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/usr.bin/cpio/test/test_format_newc.c,v 1.2 2008/08/22 02:09:10 kientzle Exp $"); +__FBSDID("$FreeBSD$"); /* Number of bytes needed to pad 'n' to multiple of 'block', assuming * that 'block' is a power of two. This trick can be more easily Modified: stable/9/contrib/libarchive/cpio/test/test_gcpio_compat.c ============================================================================== --- head/contrib/libarchive/cpio/test/test_gcpio_compat.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/cpio/test/test_gcpio_compat.c Thu Jan 5 12:06:54 2012 (r229592) @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/usr.bin/cpio/test/test_gcpio_compat.c,v 1.2 2008/08/22 02:27:06 kientzle Exp $"); +__FBSDID("$FreeBSD$"); static void unpack_test(const char *from, const char *options, const char *se) Modified: stable/9/contrib/libarchive/cpio/test/test_option_L_upper.c ============================================================================== --- head/contrib/libarchive/cpio/test/test_option_L_upper.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/cpio/test/test_option_L_upper.c Thu Jan 5 12:06:54 2012 (r229592) @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/usr.bin/cpio/test/test_option_L.c,v 1.2 2008/08/24 06:21:00 kientzle Exp $"); +__FBSDID("$FreeBSD$"); /* This is a little pointless, as Windows doesn't support symlinks * (except for the seriously crippled CreateSymbolicLink API) so these Modified: stable/9/contrib/libarchive/cpio/test/test_option_a.c ============================================================================== --- head/contrib/libarchive/cpio/test/test_option_a.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/cpio/test/test_option_a.c Thu Jan 5 12:06:54 2012 (r229592) @@ -28,7 +28,7 @@ #elif defined(HAVE_SYS_UTIME_H) #include #endif -__FBSDID("$FreeBSD: src/usr.bin/cpio/test/test_option_a.c,v 1.3 2008/08/24 06:21:00 kientzle Exp $"); +__FBSDID("$FreeBSD$"); static struct { const char *name; Modified: stable/9/contrib/libarchive/cpio/test/test_option_tv.stdout.uu ============================================================================== --- head/contrib/libarchive/cpio/test/test_option_tv.stdout.uu Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/cpio/test/test_option_tv.stdout.uu Thu Jan 5 12:06:54 2012 (r229592) @@ -1,4 +1,4 @@ -$FreeBSD: src/usr.bin/cpio/test/test_option_tv.stdout.uu,v 1.2 2008/11/29 20:22:02 kientzle Exp $ +$FreeBSD$ begin 644 test_option_tv.stdout M+7)W+7(M+7(M+2`@(#$@=&EM("`@("`@=&EM("`@("`@("`@("`@(#`@1&5C /(#,Q("`Q.38Y(&9I;&4* Modified: stable/9/contrib/libarchive/cpio/test/test_option_y.c ============================================================================== --- head/contrib/libarchive/cpio/test/test_option_y.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/cpio/test/test_option_y.c Thu Jan 5 12:06:54 2012 (r229592) @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/usr.bin/cpio/test/test_option_y.c,v 1.2 2008/08/24 06:21:00 kientzle Exp $"); +__FBSDID("$FreeBSD$"); DEFINE_TEST(test_option_y) { Modified: stable/9/contrib/libarchive/cpio/test/test_passthrough_dotdot.c ============================================================================== --- head/contrib/libarchive/cpio/test/test_passthrough_dotdot.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/cpio/test/test_passthrough_dotdot.c Thu Jan 5 12:06:54 2012 (r229592) @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/usr.bin/cpio/test/test_passthrough_dotdot.c,v 1.4 2008/08/24 06:21:00 kientzle Exp $"); +__FBSDID("$FreeBSD$"); /* * Verify that "cpio -p .." works. Modified: stable/9/contrib/libarchive/cpio/test/test_passthrough_reverse.c ============================================================================== --- head/contrib/libarchive/cpio/test/test_passthrough_reverse.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/cpio/test/test_passthrough_reverse.c Thu Jan 5 12:06:54 2012 (r229592) @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/usr.bin/cpio/test/test_passthrough_reverse.c,v 1.2 2008/08/24 06:21:00 kientzle Exp $"); +__FBSDID("$FreeBSD$"); /* * As reported by Bernd Walter: Some people are in the habit of Modified: stable/9/contrib/libarchive/libarchive/archive.h ============================================================================== --- head/contrib/libarchive/libarchive/archive.h Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/libarchive/archive.h Thu Jan 5 12:06:54 2012 (r229592) @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/lib/libarchive/archive.h.in,v 1.50 2008/05/26 17:00:22 kientzle Exp $ + * $FreeBSD$ */ #ifndef ARCHIVE_H_INCLUDED @@ -493,11 +493,10 @@ __LA_DECL void archive_read_extract_set /* Close the file and release most resources. */ __LA_DECL int archive_read_close(struct archive *); /* Release all resources and destroy the object. */ -/* Note that archive_read_finish will call archive_read_close for you. */ -#if ARCHIVE_VERSION_NUMBER < 2000000 -/* Erroneously declared to return void in libarchive 1.x */ -__LA_DECL void archive_read_finish(struct archive *); -#else +/* Note that archive_read_free will call archive_read_close for you. */ +__LA_DECL int archive_read_free(struct archive *); +#if ARCHIVE_VERSION_NUMBER < 4000000 +/* Synonym for archive_read_free() for backwards compatibility. */ __LA_DECL int archive_read_finish(struct archive *); #endif @@ -514,7 +513,7 @@ __LA_DECL int archive_read_finish(stru * - archive_write_header to write the header * - archive_write_data to write the entry data * 5) archive_write_close to close the output - * 6) archive_write_finish to cleanup the writer and release resources + * 6) archive_write_free to cleanup the writer and release resources */ __LA_DECL struct archive *archive_write_new(void); __LA_DECL int archive_write_set_bytes_per_block(struct archive *, @@ -595,13 +594,12 @@ __LA_DECL __LA_SSIZE_T archive_write_da #endif __LA_DECL int archive_write_finish_entry(struct archive *); __LA_DECL int archive_write_close(struct archive *); -#if ARCHIVE_VERSION_NUMBER < 2000000 -/* Return value was incorrect in libarchive 1.x. */ -__LA_DECL void archive_write_finish(struct archive *); -#else -/* Libarchive 2.x and later returns an error if this fails. */ -/* It can fail if the archive wasn't already closed, in which case - * archive_write_finish() will implicitly call archive_write_close(). */ + +/* This can fail if the archive wasn't already closed, in which case + * archive_write_free() will implicitly call archive_write_close(). */ +__LA_DECL int archive_write_free(struct archive *); +#if ARCHIVE_VERSION_NUMBER < 4000000 +/* Synonym for archive_write_free() for backwards compatibility. */ __LA_DECL int archive_write_finish(struct archive *); #endif @@ -630,7 +628,7 @@ __LA_DECL int archive_write_set_options * - construct an appropriate struct archive_entry structure * - archive_write_header to create the file/dir/etc on disk * - archive_write_data to write the entry data - * 4) archive_write_finish to cleanup the writer and release resources + * 4) archive_write_free to cleanup the writer and release resources * * In particular, you can use this in conjunction with archive_read() * to pull entries out of an archive and create them on disk. Modified: stable/9/contrib/libarchive/libarchive/archive_check_magic.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_check_magic.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/libarchive/archive_check_magic.c Thu Jan 5 12:06:54 2012 (r229592) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_check_magic.c 201089 2009-12-28 02:20:23Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_TYPES_H #include Modified: stable/9/contrib/libarchive/libarchive/archive_crc32.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_crc32.h Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/libarchive/archive_crc32.h Thu Jan 5 12:06:54 2012 (r229592) @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: head/lib/libarchive/archive_crc32.h 201102 2009-12-28 03:11:36Z kientzle $ + * $FreeBSD$ */ #ifndef __LIBARCHIVE_BUILD Modified: stable/9/contrib/libarchive/libarchive/archive_endian.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_endian.h Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/libarchive/archive_endian.h Thu Jan 5 12:06:54 2012 (r229592) @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: head/lib/libarchive/archive_endian.h 201085 2009-12-28 02:17:15Z kientzle $ + * $FreeBSD$ * * Borrowed from FreeBSD's */ Modified: stable/9/contrib/libarchive/libarchive/archive_entry.3 ============================================================================== --- head/contrib/libarchive/libarchive/archive_entry.3 Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/libarchive/archive_entry.3 Thu Jan 5 12:06:54 2012 (r229592) @@ -22,10 +22,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libarchive/archive_entry.3,v 1.18 2008/05/26 17:00:22 kientzle Exp $ +.\" $FreeBSD$ .\" .Dd May 12, 2008 -.Dt archive_entry 3 +.Dt ARCHIVE_ENTRY 3 .Os .Sh NAME .Nm archive_entry_acl_add_entry , Modified: stable/9/contrib/libarchive/libarchive/archive_entry.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_entry.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/libarchive/archive_entry.c Thu Jan 5 12:06:54 2012 (r229592) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_entry.c 201096 2009-12-28 02:41:27Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_STAT_H #include Modified: stable/9/contrib/libarchive/libarchive/archive_entry.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_entry.h Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/libarchive/archive_entry.h Thu Jan 5 12:06:54 2012 (r229592) @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: head/lib/libarchive/archive_entry.h 201096 2009-12-28 02:41:27Z kientzle $ + * $FreeBSD$ */ #ifndef ARCHIVE_ENTRY_H_INCLUDED Modified: stable/9/contrib/libarchive/libarchive/archive_entry_copy_stat.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_entry_copy_stat.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/libarchive/archive_entry_copy_stat.c Thu Jan 5 12:06:54 2012 (r229592) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_entry_copy_stat.c 189466 2009-03-07 00:52:02Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_STAT_H #include Modified: stable/9/contrib/libarchive/libarchive/archive_entry_link_resolver.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_entry_link_resolver.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/libarchive/archive_entry_link_resolver.c Thu Jan 5 12:06:54 2012 (r229592) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_entry_link_resolver.c 201100 2009-12-28 03:05:31Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_STAT_H #include Modified: stable/9/contrib/libarchive/libarchive/archive_entry_private.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_entry_private.h Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/libarchive/archive_entry_private.h Thu Jan 5 12:06:54 2012 (r229592) @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: head/lib/libarchive/archive_entry_private.h 201096 2009-12-28 02:41:27Z kientzle $ + * $FreeBSD$ */ #ifndef __LIBARCHIVE_BUILD Modified: stable/9/contrib/libarchive/libarchive/archive_entry_stat.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_entry_stat.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/libarchive/archive_entry_stat.c Thu Jan 5 12:06:54 2012 (r229592) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_entry_stat.c 201100 2009-12-28 03:05:31Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_STAT_H #include Modified: stable/9/contrib/libarchive/libarchive/archive_entry_strmode.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_entry_strmode.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/libarchive/archive_entry_strmode.c Thu Jan 5 12:06:54 2012 (r229592) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_entry_strmode.c,v 1.4 2008/06/15 05:14:01 kientzle Exp $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_STAT_H #include Modified: stable/9/contrib/libarchive/libarchive/archive_entry_xattr.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_entry_xattr.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/libarchive/archive_entry_xattr.c Thu Jan 5 12:06:54 2012 (r229592) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_entry_xattr.c 201096 2009-12-28 02:41:27Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_STAT_H #include Modified: stable/9/contrib/libarchive/libarchive/archive_hash.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_hash.h Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/libarchive/archive_hash.h Thu Jan 5 12:06:54 2012 (r229592) @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: head/lib/libarchive/archive_hash.h 201171 2009-12-29 06:39:07Z kientzle $ + * $FreeBSD$ */ #ifndef __LIBARCHIVE_BUILD Modified: stable/9/contrib/libarchive/libarchive/archive_platform.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_platform.h Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/libarchive/archive_platform.h Thu Jan 5 12:06:54 2012 (r229592) @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: head/lib/libarchive/archive_platform.h 201090 2009-12-28 02:22:04Z kientzle $ + * $FreeBSD$ */ /* !!ONLY FOR USE INTERNALLY TO LIBARCHIVE!! */ Modified: stable/9/contrib/libarchive/libarchive/archive_private.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_private.h Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/libarchive/archive_private.h Thu Jan 5 12:06:54 2012 (r229592) @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: head/lib/libarchive/archive_private.h 201098 2009-12-28 02:58:14Z kientzle $ + * $FreeBSD$ */ #ifndef __LIBARCHIVE_BUILD @@ -58,7 +58,7 @@ struct archive_vtable { int (*archive_close)(struct archive *); - int (*archive_finish)(struct archive *); + int (*archive_free)(struct archive *); int (*archive_write_header)(struct archive *, struct archive_entry *); int (*archive_write_finish_entry)(struct archive *); Modified: stable/9/contrib/libarchive/libarchive/archive_read.3 ============================================================================== --- head/contrib/libarchive/libarchive/archive_read.3 Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/libarchive/archive_read.3 Thu Jan 5 12:06:54 2012 (r229592) @@ -22,10 +22,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: head/lib/libarchive/archive_read.3 191595 2009-04-27 20:13:13Z kientzle $ +.\" $FreeBSD$ .\" .Dd April 13, 2009 -.Dt archive_read 3 +.Dt ARCHIVE_READ 3 .Os .Sh NAME .Nm archive_read_new , @@ -69,7 +69,7 @@ .Nm archive_read_extract2 , .Nm archive_read_extract_set_progress_callback , .Nm archive_read_close , -.Nm archive_read_finish +.Nm archive_read_free .Nd functions for reading streaming archives .Sh SYNOPSIS .In archive.h @@ -196,7 +196,7 @@ .Ft int .Fn archive_read_close "struct archive *" .Ft int -.Fn archive_read_finish "struct archive *" +.Fn archive_read_free "struct archive *" .Sh DESCRIPTION These functions provide a complete API for reading streaming archives. The general process is to first create the @@ -457,7 +457,7 @@ object and the archive_entry object so t can be retrieved for the progress display. .It Fn archive_read_close Complete the archive and invoke the close callback. -.It Fn archive_read_finish +.It Fn archive_read_free Invokes .Fn archive_read_close if it was not invoked manually, then release all resources. @@ -600,7 +600,7 @@ list_archive(const char *name) printf("%s\en",archive_entry_pathname(entry)); archive_read_data_skip(a); } - archive_read_finish(a); + archive_read_free(a); free(mydata); } Modified: stable/9/contrib/libarchive/libarchive/archive_read.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/libarchive/archive_read.c Thu Jan 5 12:06:54 2012 (r229592) @@ -32,7 +32,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read.c 201157 2009-12-29 05:30:23Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_ERRNO_H #include @@ -60,7 +60,7 @@ static int choose_format(struct archive_ static int cleanup_filters(struct archive_read *); static struct archive_vtable *archive_read_vtable(void); static int _archive_read_close(struct archive *); -static int _archive_read_finish(struct archive *); +static int _archive_read_free(struct archive *); static struct archive_vtable * archive_read_vtable(void) @@ -69,7 +69,7 @@ archive_read_vtable(void) static int inited = 0; if (!inited) { - av.archive_finish = _archive_read_finish; + av.archive_free = _archive_read_free; av.archive_close = _archive_read_close; } return (&av); @@ -779,7 +779,7 @@ cleanup_filters(struct archive_read *a) * Release memory and other resources. */ static int -_archive_read_finish(struct archive *_a) +_archive_read_free(struct archive *_a) { struct archive_read *a = (struct archive_read *)_a; int i; @@ -787,7 +787,7 @@ _archive_read_finish(struct archive *_a) int r = ARCHIVE_OK; __archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_ANY, - "archive_read_finish"); + "archive_read_free"); if (a->archive.state != ARCHIVE_STATE_CLOSED) r = archive_read_close(&a->archive); Modified: stable/9/contrib/libarchive/libarchive/archive_read_data_into_fd.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_data_into_fd.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/libarchive/archive_read_data_into_fd.c Thu Jan 5 12:06:54 2012 (r229592) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_data_into_fd.c,v 1.16 2008/05/23 05:01:29 cperciva Exp $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_TYPES_H #include Modified: stable/9/contrib/libarchive/libarchive/archive_read_disk.3 ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_disk.3 Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/libarchive/archive_read_disk.3 Thu Jan 5 12:06:54 2012 (r229592) @@ -22,10 +22,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: head/lib/libarchive/archive_read_disk.3 190957 2009-04-12 05:04:02Z kientzle $ +.\" $FreeBSD$ .\" .Dd March 10, 2009 -.Dt archive_read_disk 3 +.Dt ARCHIVE_READ_DISK 3 .Os .Sh NAME .Nm archive_read_disk_new , @@ -39,7 +39,7 @@ .Nm archive_read_disk_set_gname_lookup , .Nm archive_read_disk_set_standard_lookup , .Nm archive_read_close , -.Nm archive_read_finish +.Nm archive_read_free .Nd functions for reading objects from disk .Sh SYNOPSIS .In archive.h @@ -81,7 +81,7 @@ .Ft int .Fn archive_read_close "struct archive *" .Ft int -.Fn archive_read_finish "struct archive *" +.Fn archive_read_free "struct archive *" .Sh DESCRIPTION These functions provide an API for reading information about objects on disk. @@ -178,9 +178,9 @@ This affects the file ownership fields a object. .It Fn archive_read_close This currently does nothing. -.It Fn archive_write_finish +.It Fn archive_read_free Invokes -.Fn archive_write_close +.Fn archive_read_close if it was not invoked manually, then releases all resources. .El More information about the @@ -213,7 +213,7 @@ file_to_archive(struct archive *a, const while ((bytes_read = read(fd, buff, sizeof(buff))) > 0) archive_write_data(a, buff, bytes_read); archive_write_finish_entry(a); - archive_read_finish(ard); + archive_read_free(ard); archive_entry_free(entry); } .Ed @@ -276,7 +276,7 @@ and first appeared in The .Nm libarchive library was written by -.An Tim Kientzle Aq kientzle@freebsd.org . +.An Tim Kientzle Aq kientzle@FreeBSD.org . .Sh BUGS The .Dq standard Modified: stable/9/contrib/libarchive/libarchive/archive_read_disk.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_disk.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/libarchive/archive_read_disk.c Thu Jan 5 12:06:54 2012 (r229592) @@ -25,7 +25,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_disk.c 189429 2009-03-06 04:35:31Z kientzle $"); +__FBSDID("$FreeBSD$"); #include "archive.h" #include "archive_string.h" @@ -33,7 +33,7 @@ __FBSDID("$FreeBSD: head/lib/libarchive/ #include "archive_private.h" #include "archive_read_disk_private.h" -static int _archive_read_finish(struct archive *); +static int _archive_read_free(struct archive *); static int _archive_read_close(struct archive *); static const char *trivial_lookup_gname(void *, gid_t gid); static const char *trivial_lookup_uname(void *, uid_t uid); @@ -45,7 +45,7 @@ archive_read_disk_vtable(void) static int inited = 0; if (!inited) { - av.archive_finish = _archive_read_finish; + av.archive_free = _archive_read_free; av.archive_close = _archive_read_close; } return (&av); @@ -129,7 +129,7 @@ archive_read_disk_new(void) } static int -_archive_read_finish(struct archive *_a) +_archive_read_free(struct archive *_a) { struct archive_read_disk *a = (struct archive_read_disk *)_a; Modified: stable/9/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c Thu Jan 5 12:06:54 2012 (r229592) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_disk_entry_from_file.c 201084 2009-12-28 02:14:09Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_TYPES_H /* Mac OSX requires sys/types.h before sys/acl.h. */ Modified: stable/9/contrib/libarchive/libarchive/archive_read_disk_private.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_disk_private.h Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/libarchive/archive_read_disk_private.h Thu Jan 5 12:06:54 2012 (r229592) @@ -23,7 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: head/lib/libarchive/archive_read_disk_private.h 201105 2009-12-28 03:20:54Z kientzle $ + * $FreeBSD$ */ #ifndef __LIBARCHIVE_BUILD Modified: stable/9/contrib/libarchive/libarchive/archive_read_disk_set_standard_lookup.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_disk_set_standard_lookup.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/libarchive/archive_read_disk_set_standard_lookup.c Thu Jan 5 12:06:54 2012 (r229592) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_disk_set_standard_lookup.c 201109 2009-12-28 03:30:31Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_TYPES_H #include Modified: stable/9/contrib/libarchive/libarchive/archive_read_extract.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_extract.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/libarchive/archive_read_extract.c Thu Jan 5 12:06:54 2012 (r229592) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_extract.c,v 1.61 2008/05/26 17:00:22 kientzle Exp $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_TYPES_H #include @@ -173,10 +173,7 @@ archive_read_extract_cleanup(struct arch { int ret = ARCHIVE_OK; -#if ARCHIVE_API_VERSION > 1 - ret = -#endif - archive_write_finish(a->extract->ad); + ret = archive_write_free(a->extract->ad); free(a->extract); a->extract = NULL; return (ret); Modified: stable/9/contrib/libarchive/libarchive/archive_read_open_fd.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_open_fd.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/libarchive/archive_read_open_fd.c Thu Jan 5 12:06:54 2012 (r229592) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_open_fd.c 201103 2009-12-28 03:13:49Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_STAT_H #include Modified: stable/9/contrib/libarchive/libarchive/archive_read_open_file.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_open_file.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/libarchive/archive_read_open_file.c Thu Jan 5 12:06:54 2012 (r229592) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_open_file.c 201093 2009-12-28 02:28:44Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_STAT_H #include Modified: stable/9/contrib/libarchive/libarchive/archive_read_open_filename.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_open_filename.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/libarchive/archive_read_open_filename.c Thu Jan 5 12:06:54 2012 (r229592) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_open_filename.c 201093 2009-12-28 02:28:44Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_STAT_H #include Modified: stable/9/contrib/libarchive/libarchive/archive_read_open_memory.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_open_memory.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/libarchive/archive_read_open_memory.c Thu Jan 5 12:06:54 2012 (r229592) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_open_memory.c,v 1.6 2007/07/06 15:51:59 kientzle Exp $"); +__FBSDID("$FreeBSD$"); #include #include Modified: stable/9/contrib/libarchive/libarchive/archive_read_private.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_private.h Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/libarchive/archive_read_private.h Thu Jan 5 12:06:54 2012 (r229592) @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: head/lib/libarchive/archive_read_private.h 201088 2009-12-28 02:18:55Z kientzle $ + * $FreeBSD$ */ #ifndef __LIBARCHIVE_BUILD Modified: stable/9/contrib/libarchive/libarchive/archive_read_support_compression_all.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_compression_all.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/libarchive/archive_read_support_compression_all.c Thu Jan 5 12:06:54 2012 (r229592) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_compression_all.c 201248 2009-12-30 06:12:03Z kientzle $"); +__FBSDID("$FreeBSD$"); #include "archive.h" Modified: stable/9/contrib/libarchive/libarchive/archive_read_support_compression_bzip2.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_compression_bzip2.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/libarchive/archive_read_support_compression_bzip2.c Thu Jan 5 12:06:54 2012 (r229592) @@ -25,7 +25,7 @@ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_compression_bzip2.c 201108 2009-12-28 03:28:21Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_ERRNO_H #include Modified: stable/9/contrib/libarchive/libarchive/archive_read_support_compression_compress.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_compression_compress.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/libarchive/archive_read_support_compression_compress.c Thu Jan 5 12:06:54 2012 (r229592) @@ -64,7 +64,7 @@ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_compression_compress.c 201094 2009-12-28 02:29:21Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_ERRNO_H #include Modified: stable/9/contrib/libarchive/libarchive/archive_read_support_compression_gzip.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_compression_gzip.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/libarchive/archive_read_support_compression_gzip.c Thu Jan 5 12:06:54 2012 (r229592) @@ -25,7 +25,7 @@ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_compression_gzip.c 201082 2009-12-28 02:05:28Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_ERRNO_H Modified: stable/9/contrib/libarchive/libarchive/archive_read_support_compression_none.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_compression_none.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/libarchive/archive_read_support_compression_none.c Thu Jan 5 12:06:54 2012 (r229592) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_compression_none.c 185679 2008-12-06 06:45:15Z kientzle $"); +__FBSDID("$FreeBSD$"); #include "archive.h" Modified: stable/9/contrib/libarchive/libarchive/archive_read_support_compression_program.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_compression_program.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/libarchive/archive_read_support_compression_program.c Thu Jan 5 12:06:54 2012 (r229592) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_compression_program.c 201112 2009-12-28 06:59:35Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_WAIT_H # include Modified: stable/9/contrib/libarchive/libarchive/archive_read_support_compression_uu.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_compression_uu.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/libarchive/archive_read_support_compression_uu.c Thu Jan 5 12:06:54 2012 (r229592) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_compression_uu.c 201248 2009-12-30 06:12:03Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_ERRNO_H #include Modified: stable/9/contrib/libarchive/libarchive/archive_read_support_compression_xz.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_compression_xz.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/libarchive/archive_read_support_compression_xz.c Thu Jan 5 12:06:54 2012 (r229592) @@ -26,7 +26,7 @@ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_compression_xz.c 201167 2009-12-29 06:06:20Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_ERRNO_H #include Modified: stable/9/contrib/libarchive/libarchive/archive_read_support_format_all.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_all.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/libarchive/archive_read_support_format_all.c Thu Jan 5 12:06:54 2012 (r229592) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_format_all.c 174991 2007-12-30 04:58:22Z kientzle $"); +__FBSDID("$FreeBSD$"); #include "archive.h" Modified: stable/9/contrib/libarchive/libarchive/archive_read_support_format_ar.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_ar.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/libarchive/archive_read_support_format_ar.c Thu Jan 5 12:06:54 2012 (r229592) @@ -26,7 +26,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_format_ar.c 201101 2009-12-28 03:06:27Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_STAT_H #include Modified: stable/9/contrib/libarchive/libarchive/archive_read_support_format_cpio.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_cpio.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/9/contrib/libarchive/libarchive/archive_read_support_format_cpio.c Thu Jan 5 12:06:54 2012 (r229592) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_format_cpio.c 201163 2009-12-29 05:50:34Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_ERRNO_H #include @@ -42,6 +42,10 @@ __FBSDID("$FreeBSD: head/lib/libarchive/ #include "archive_private.h" #include "archive_read_private.h" +#ifdef _MSC_VER +#define __packed +#pragma pack(push, 1) +#endif struct cpio_bin_header { unsigned char c_magic[2]; unsigned char c_dev[2]; @@ -54,7 +58,7 @@ struct cpio_bin_header { unsigned char c_mtime[4]; unsigned char c_namesize[2]; unsigned char c_filesize[4]; -}; +} __packed; struct cpio_odc_header { char c_magic[6]; @@ -68,7 +72,7 @@ struct cpio_odc_header { char c_mtime[11]; char c_namesize[6]; char c_filesize[11]; -}; +} __packed; struct cpio_newc_header { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 12:07:43 2012 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 88744106564A; Thu, 5 Jan 2012 12:07:43 +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 6DB248FC17; Thu, 5 Jan 2012 12:07:43 +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 q05C7hXI034661; Thu, 5 Jan 2012 12:07:43 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05C7ghw034598; Thu, 5 Jan 2012 12:07:42 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201051207.q05C7ghw034598@svn.freebsd.org> From: Martin Matuska Date: Thu, 5 Jan 2012 12:07:42 +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: r229593 - in stable/8/contrib/libarchive: . build contrib cpio cpio/test doc examples libarchive libarchive/test libarchive_fe tar tar/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: Thu, 05 Jan 2012 12:07:43 -0000 Author: mm Date: Thu Jan 5 12:07:42 2012 New Revision: 229593 URL: http://svn.freebsd.org/changeset/base/229593 Log: MFC contrib/libarchive: r228761-r228764, r228770-r228777, r228835, r228911: MFC r228761: Copy libarchive from vendor branch to contrib MFC r228762: Add FREEBSD-Xlist and FREEBSD-upgrade to contrib/libarchive MFC r228763: Set svn:keywords to FreeBSD=%H for contrib/libarchive MFC r228764: Strip unnecessary files and directories from contrib/libarchive according to FREEBSD-Xlist MFC r228770: Remove libarchive/archive_entry_copy_bhfi.c and libarchive/mtree.5 Add these files to FREEBSD-Xlist MFC r228771: Partial merge of r224691 from lib/libarchive: Add compatibility for ISO images created with unfixed makefs that violated ECMA-119 (ISO9660): allow reserved4 to be 0x20 in PVD. This allows tar to read FreeBSD distribution ISO images created with makefs prior to NetBSD bin/45217 bugfix (up to 9.0-BETA1). MFC r228772: Add missing integer casts to comparsions in libarchive read. MFC r228773: Merge FreeBSD changes from lib/libarchive to contrib/libarchive: r204111 (uqs): Fix common misspelling of hierarchy r208027 (uqs): mdoc: move CAVEATS, BUGS and SECURITY CONSIDERATIONS sections to the bottom of the manpages and order them consistently. GNU groff doesn't care about the ordering, and doesn't even mention CAVEATS and SECURITY CONSIDERATIONS as common sections and where to put them. r208291 (uqs): mdoc: consistently spell our email addresses r209031 (uqs): mdoc nitpicking: the title argument shall be uppercase r214822 (kientzle): Clarify the naming: Methods that free an object should be called "free". Retain the old "finish" names to preserve source compatibility for now. r214905 (kientzle): If the Zip reader doesn't see a PK signature block because there's inter-entry garbage, just scan forward to find the next one. This allows us to handle a lot of Zip archives that have been modified in-place. Thanks to: Gleb Kurtsou for sending me a sample archive r216258 (kientzle): Don't write data into an empty "file." In particular, this check avoids a warning when extracting directory entries from certain GNU tar archives that store directory contents. r225525 (kientzle): Fix cpio on ARM. MFC r228774: Add $FreeBSD$ to libarchive_fe headers where missing. MFC r228775: Merge FreeBSD changes from usr.bin/tar to contrib/libarchive/libarchive_fe: r213469: Recognize both ! and ^ as markers for negated character classes. MFC r228776: Merge FreeBSD changes from usr.bin/tar to contrib/libarchive/tar: r204111 (uqs): Fix common misspelling of hierarchy r207786 (kientzle): Various manpage updates, including many long-option synonyms that were previously undocumented. r208028 (uqs): mdoc: move remaining sections into consistent order This pertains mostly to FILES, HISTORY, EXIT STATUS and AUTHORS sections. r209152 (kientzle): If the compressed data is larger than the uncompressed, report the compression ratio as 0% instead of displaying nonsense triggered by numeric overflow. This is common when dealing with uncompressed files when the I/O blocking causes there to be small transient differences in the accounting. r210720 (joel): Fix typos. r223541 (kientzle): If there is a read error reading Y/N confirmation from the keyboard, exit immediately with an error. If there is an error opening or reading a file to put into the archive, set the return value for a deferred error exit. r223573 (kientzle): The --newer-than test should descend into old directories to look for new files. r226636 (kientzle): Typo from previous commit. Urgh. r224153 (mm, partial): Update bsdtar.1 manpage MFC r228777: Merge FreeBSD changes from usr.bin/cpio to contrib/libarchive/cpio: r204111 (uqs): Fix common misspelling of hierarchy r211054 (kientzle); Fix -R when used with -p. Previously, the uname and gname weren't overwritten, so the disk restore would use those to lookup the original uid/gid again. Clearing the uname and gname prevents this. r212263 (gjb): Fix typo in bsdcpio manual: s/libarchive_formats/libarchive-formats MFC r228835: Fix typo s/xz/libarchive/ Reported by: Emil Mikulic (private e-mail) MFC r228911: Update to vendor revision 4016. Vendor has integrated most of our local changes in revisions 3976-3979 so future updates are going to be easier. Thanks to Tim Kientzle . Added: - copied from r228761, head/contrib/libarchive/ stable/8/contrib/libarchive/FREEBSD-Xlist - copied, changed from r228762, head/contrib/libarchive/FREEBSD-Xlist stable/8/contrib/libarchive/FREEBSD-upgrade - copied, changed from r228762, head/contrib/libarchive/FREEBSD-upgrade stable/8/contrib/libarchive/libarchive/test/test_compat_zip_2.zip.uu - copied unchanged from r228911, head/contrib/libarchive/libarchive/test/test_compat_zip_2.zip.uu Directory Properties: stable/8/contrib/libarchive/ (props changed) Deleted: stable/8/contrib/libarchive/CMakeLists.txt stable/8/contrib/libarchive/CTestConfig.cmake stable/8/contrib/libarchive/INSTALL stable/8/contrib/libarchive/Makefile.am stable/8/contrib/libarchive/build/ stable/8/contrib/libarchive/configure.ac stable/8/contrib/libarchive/contrib/ stable/8/contrib/libarchive/cpio/CMakeLists.txt stable/8/contrib/libarchive/cpio/cpio_windows.c stable/8/contrib/libarchive/cpio/cpio_windows.h stable/8/contrib/libarchive/cpio/test/CMakeLists.txt stable/8/contrib/libarchive/doc/ stable/8/contrib/libarchive/examples/ stable/8/contrib/libarchive/libarchive/CMakeLists.txt stable/8/contrib/libarchive/libarchive/archive_entry_copy_bhfi.c stable/8/contrib/libarchive/libarchive/archive_windows.c stable/8/contrib/libarchive/libarchive/archive_windows.h stable/8/contrib/libarchive/libarchive/filter_fork_windows.c stable/8/contrib/libarchive/libarchive/mtree.5 stable/8/contrib/libarchive/libarchive/test/.cvsignore stable/8/contrib/libarchive/libarchive/test/CMakeLists.txt stable/8/contrib/libarchive/tar/CMakeLists.txt stable/8/contrib/libarchive/tar/bsdtar_windows.c stable/8/contrib/libarchive/tar/bsdtar_windows.h stable/8/contrib/libarchive/tar/test/CMakeLists.txt stable/8/contrib/libarchive/tar/test/test_windows.c Modified: stable/8/contrib/libarchive/cpio/bsdcpio.1 (contents, props changed) stable/8/contrib/libarchive/cpio/cmdline.c (contents, props changed) stable/8/contrib/libarchive/cpio/config_freebsd.h (contents, props changed) stable/8/contrib/libarchive/cpio/cpio.c (contents, props changed) stable/8/contrib/libarchive/cpio/cpio.h (contents, props changed) stable/8/contrib/libarchive/cpio/cpio_platform.h (contents, props changed) stable/8/contrib/libarchive/cpio/test/main.c (contents, props changed) stable/8/contrib/libarchive/cpio/test/test.h (contents, props changed) stable/8/contrib/libarchive/cpio/test/test_basic.c (contents, props changed) stable/8/contrib/libarchive/cpio/test/test_format_newc.c (contents, props changed) stable/8/contrib/libarchive/cpio/test/test_gcpio_compat.c (contents, props changed) stable/8/contrib/libarchive/cpio/test/test_option_L_upper.c (contents, props changed) stable/8/contrib/libarchive/cpio/test/test_option_a.c (contents, props changed) stable/8/contrib/libarchive/cpio/test/test_option_tv.stdout.uu (contents, props changed) stable/8/contrib/libarchive/cpio/test/test_option_y.c (contents, props changed) stable/8/contrib/libarchive/cpio/test/test_passthrough_dotdot.c (contents, props changed) stable/8/contrib/libarchive/cpio/test/test_passthrough_reverse.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive.h (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_check_magic.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_crc32.h (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_endian.h (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_entry.3 (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_entry.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_entry.h (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_entry_copy_stat.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_entry_link_resolver.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_entry_private.h (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_entry_stat.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_entry_strmode.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_entry_xattr.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_hash.h (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_platform.h (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_private.h (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read.3 (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_data_into_fd.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_disk.3 (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_disk.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_disk_private.h (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_disk_set_standard_lookup.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_extract.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_open_fd.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_open_file.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_open_filename.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_open_memory.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_private.h (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_support_compression_all.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_support_compression_bzip2.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_support_compression_compress.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_support_compression_gzip.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_support_compression_none.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_support_compression_program.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_support_compression_uu.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_support_compression_xz.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_support_format_all.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_support_format_ar.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_support_format_cpio.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_support_format_empty.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_support_format_iso9660.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_support_format_mtree.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_support_format_raw.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_support_format_tar.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_support_format_xar.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_read_support_format_zip.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_string.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_string.h (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_string_sprintf.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_util.3 (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_util.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_virtual.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write.3 (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_disk.3 (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_disk.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_disk_private.h (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_disk_set_standard_lookup.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_open_fd.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_open_file.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_open_filename.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_open_memory.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_private.h (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_set_compression_bzip2.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_set_compression_compress.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_set_compression_gzip.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_set_compression_none.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_set_compression_program.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_set_compression_xz.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_set_format.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_set_format_ar.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_set_format_by_name.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_set_format_cpio.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_set_format_cpio_newc.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_set_format_mtree.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_set_format_pax.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_set_format_shar.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_set_format_ustar.c (contents, props changed) stable/8/contrib/libarchive/libarchive/archive_write_set_format_zip.c (contents, props changed) stable/8/contrib/libarchive/libarchive/config_freebsd.h (contents, props changed) stable/8/contrib/libarchive/libarchive/cpio.5 (contents, props changed) stable/8/contrib/libarchive/libarchive/filter_fork.c (contents, props changed) stable/8/contrib/libarchive/libarchive/filter_fork.h (contents, props changed) stable/8/contrib/libarchive/libarchive/libarchive-formats.5 (contents, props changed) stable/8/contrib/libarchive/libarchive/libarchive.3 (contents, props changed) stable/8/contrib/libarchive/libarchive/libarchive_internals.3 (contents, props changed) stable/8/contrib/libarchive/libarchive/tar.5 (contents, props changed) stable/8/contrib/libarchive/libarchive/test/README (contents, props changed) stable/8/contrib/libarchive/libarchive/test/main.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/read_open_memory.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test.h (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_acl_basic.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_acl_freebsd.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_acl_pax.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_archive_api_feature.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_bad_fd.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_bzip2.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_bzip2_1.tbz.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_bzip2_2.tbz.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_cpio.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_cpio_1.cpio.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_gtar.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_gtar_1.tar.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_gzip.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_gzip_1.tgz.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_gzip_2.tgz.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_lzma.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_lzma_1.tlz.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_lzma_2.tlz.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_lzma_3.tlz.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_solaris_tar_acl.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_solaris_tar_acl.tar.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_tar_hardlink.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_tar_hardlink_1.tar.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_xz.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_xz_1.txz.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_zip.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_compat_zip_1.zip.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_empty_write.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_entry.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_entry_strmode.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_extattr_freebsd.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_fuzz.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_fuzz_1.iso.Z.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_link_resolver.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_open_fd.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_open_file.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_open_filename.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_pax_filename_encoding.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_pax_filename_encoding.tar.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_compress_program.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_data_large.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_disk.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_disk_entry_from_file.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_extract.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_file_nonexistent.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_ar.ar.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_ar.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_cpio_bin.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_cpio_bin_Z.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_cpio_bin_be.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_cpio_bin_be.cpio.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_cpio_bin_bz2.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_cpio_bin_gz.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_cpio_bin_lzma.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_cpio_bin_xz.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_cpio_odc.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_cpio_svr4_gzip.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_cpio_svr4c_Z.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_empty.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_gtar_gz.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_gtar_lzma.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_1_13.tar.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_1_17.tar.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_1_17_posix00.tar.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_1_17_posix01.tar.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_1_17_posix10.tar.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_1_17_posix10_modified.tar.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_iso.iso.Z.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_iso_Z.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_iso_joliet.iso.Z.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_iso_joliet_long.iso.Z.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_iso_joliet_rockridge.iso.Z.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_iso_multi_extent.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_iso_multi_extent.iso.Z.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_iso_rockridge.iso.Z.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_iso_rockridge_ce.iso.Z.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_iso_rockridge_new.iso.Z.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_iso_rockridge_rr_moved.iso.Z.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_iso_zisofs.iso.Z.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_isojoliet_bz2.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_isojoliet_long.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_isojoliet_rr.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_isorr_bz2.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_isorr_ce.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_isorr_new_bz2.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_isorr_rr_moved.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_isozisofs_bz2.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_mtree.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_mtree.mtree.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_pax_bz2.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_raw.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_raw.data.Z.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_raw.data.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_tar.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_tar_empty_filename.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_tar_empty_filename.tar.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_tbz.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_tgz.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_tlz.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_txz.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_tz.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_zip.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_zip.zip.uu (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_large.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_pax_truncated.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_position.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_truncated.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_read_uu.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_tar_filenames.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_tar_large.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_ustar_filenames.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_compress.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_compress_bzip2.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_compress_gzip.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_compress_lzma.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_compress_program.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_compress_xz.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_disk.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_disk_failures.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_disk_hardlink.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_disk_perms.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_disk_secure.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_disk_sparse.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_disk_symlink.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_disk_times.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_format_ar.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_format_cpio.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_format_cpio_empty.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_format_cpio_newc.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_format_cpio_odc.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_format_mtree.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_format_shar_empty.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_format_tar.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_format_tar_empty.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_format_tar_ustar.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_format_zip.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_format_zip_empty.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_format_zip_no_compression.c (contents, props changed) stable/8/contrib/libarchive/libarchive/test/test_write_open_memory.c (contents, props changed) stable/8/contrib/libarchive/libarchive_fe/err.h (contents, props changed) stable/8/contrib/libarchive/libarchive_fe/lafe_platform.h (contents, props changed) stable/8/contrib/libarchive/libarchive_fe/line_reader.h (contents, props changed) stable/8/contrib/libarchive/libarchive_fe/matching.c (contents, props changed) stable/8/contrib/libarchive/libarchive_fe/pathmatch.c (contents, props changed) stable/8/contrib/libarchive/tar/bsdtar.1 (contents, props changed) stable/8/contrib/libarchive/tar/bsdtar.c (contents, props changed) stable/8/contrib/libarchive/tar/bsdtar.h (contents, props changed) stable/8/contrib/libarchive/tar/bsdtar_platform.h (contents, props changed) stable/8/contrib/libarchive/tar/config_freebsd.h (contents, props changed) stable/8/contrib/libarchive/tar/read.c (contents, props changed) stable/8/contrib/libarchive/tar/subst.c (contents, props changed) stable/8/contrib/libarchive/tar/test/main.c (contents, props changed) stable/8/contrib/libarchive/tar/test/test.h (contents, props changed) stable/8/contrib/libarchive/tar/test/test_0.c (contents, props changed) stable/8/contrib/libarchive/tar/test/test_basic.c (contents, props changed) stable/8/contrib/libarchive/tar/test/test_copy.c (contents, props changed) stable/8/contrib/libarchive/tar/test/test_getdate.c (contents, props changed) stable/8/contrib/libarchive/tar/test/test_help.c (contents, props changed) stable/8/contrib/libarchive/tar/test/test_option_T_upper.c (contents, props changed) stable/8/contrib/libarchive/tar/test/test_option_q.c (contents, props changed) stable/8/contrib/libarchive/tar/test/test_option_s.c (contents, props changed) stable/8/contrib/libarchive/tar/test/test_patterns.c (contents, props changed) stable/8/contrib/libarchive/tar/test/test_stdio.c (contents, props changed) stable/8/contrib/libarchive/tar/test/test_strip_components.c (contents, props changed) stable/8/contrib/libarchive/tar/test/test_symlink_dir.c (contents, props changed) stable/8/contrib/libarchive/tar/test/test_version.c (contents, props changed) stable/8/contrib/libarchive/tar/tree.c (contents, props changed) stable/8/contrib/libarchive/tar/tree.h (contents, props changed) stable/8/contrib/libarchive/tar/util.c (contents, props changed) stable/8/contrib/libarchive/tar/write.c (contents, props changed) Directory Properties: stable/8/ (props changed) stable/8/contrib/ (props changed) stable/8/contrib/libarchive/COPYING (props changed) stable/8/contrib/libarchive/NEWS (props changed) stable/8/contrib/libarchive/README (props changed) stable/8/contrib/libarchive/cpio/ (props changed) stable/8/contrib/libarchive/cpio/test/test_0.c (props changed) stable/8/contrib/libarchive/cpio/test/test_cmdline.c (props changed) stable/8/contrib/libarchive/cpio/test/test_gcpio_compat_ref.bin.uu (props changed) stable/8/contrib/libarchive/cpio/test/test_gcpio_compat_ref.crc.uu (props changed) stable/8/contrib/libarchive/cpio/test/test_gcpio_compat_ref.newc.uu (props changed) stable/8/contrib/libarchive/cpio/test/test_gcpio_compat_ref.ustar.uu (props changed) stable/8/contrib/libarchive/cpio/test/test_gcpio_compat_ref_nosym.bin.uu (props changed) stable/8/contrib/libarchive/cpio/test/test_gcpio_compat_ref_nosym.crc.uu (props changed) stable/8/contrib/libarchive/cpio/test/test_gcpio_compat_ref_nosym.newc.uu (props changed) stable/8/contrib/libarchive/cpio/test/test_gcpio_compat_ref_nosym.ustar.uu (props changed) stable/8/contrib/libarchive/cpio/test/test_option_B_upper.c (props changed) stable/8/contrib/libarchive/cpio/test/test_option_C_upper.c (props changed) stable/8/contrib/libarchive/cpio/test/test_option_J_upper.c (props changed) stable/8/contrib/libarchive/cpio/test/test_option_Z_upper.c (props changed) stable/8/contrib/libarchive/cpio/test/test_option_c.c (props changed) stable/8/contrib/libarchive/cpio/test/test_option_d.c (props changed) stable/8/contrib/libarchive/cpio/test/test_option_f.c (props changed) stable/8/contrib/libarchive/cpio/test/test_option_f.cpio.uu (props changed) stable/8/contrib/libarchive/cpio/test/test_option_help.c (props changed) stable/8/contrib/libarchive/cpio/test/test_option_l.c (props changed) stable/8/contrib/libarchive/cpio/test/test_option_lzma.c (props changed) stable/8/contrib/libarchive/cpio/test/test_option_m.c (props changed) stable/8/contrib/libarchive/cpio/test/test_option_m.cpio.uu (props changed) stable/8/contrib/libarchive/cpio/test/test_option_t.c (props changed) stable/8/contrib/libarchive/cpio/test/test_option_t.cpio.uu (props changed) stable/8/contrib/libarchive/cpio/test/test_option_t.stdout.uu (props changed) stable/8/contrib/libarchive/cpio/test/test_option_u.c (props changed) stable/8/contrib/libarchive/cpio/test/test_option_version.c (props changed) stable/8/contrib/libarchive/cpio/test/test_option_z.c (props changed) stable/8/contrib/libarchive/cpio/test/test_owner_parse.c (props changed) stable/8/contrib/libarchive/cpio/test/test_pathmatch.c (props changed) stable/8/contrib/libarchive/libarchive/ (props changed) stable/8/contrib/libarchive/libarchive/archive_read_support_compression_rpm.c (props changed) stable/8/contrib/libarchive/libarchive/test/test_open_failure.c (props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.c (props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.rpm.uu (props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_cpio_svr4_gzip_rpm.c (props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_cpio_svr4_gzip_rpm.rpm.uu (props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_iso_2.iso.Z.uu (props changed) stable/8/contrib/libarchive/libarchive/test/test_read_format_xar.c (props changed) stable/8/contrib/libarchive/libarchive/test/test_write_format_pax.c (props changed) stable/8/contrib/libarchive/libarchive_fe/ (props changed) stable/8/contrib/libarchive/libarchive_fe/err.c (props changed) stable/8/contrib/libarchive/libarchive_fe/line_reader.c (props changed) stable/8/contrib/libarchive/libarchive_fe/matching.h (props changed) stable/8/contrib/libarchive/libarchive_fe/pathmatch.h (props changed) stable/8/contrib/libarchive/tar/ (props changed) stable/8/contrib/libarchive/tar/cmdline.c (props changed) stable/8/contrib/libarchive/tar/getdate.c (props changed) stable/8/contrib/libarchive/tar/test/test_empty_mtree.c (props changed) stable/8/contrib/libarchive/tar/test/test_option_r.c (props changed) stable/8/contrib/libarchive/tar/test/test_patterns_2.tar.uu (props changed) stable/8/contrib/libarchive/tar/test/test_patterns_3.tar.uu (props changed) stable/8/contrib/libarchive/tar/test/test_patterns_4.tar.uu (props changed) Copied and modified: stable/8/contrib/libarchive/FREEBSD-Xlist (from r228762, head/contrib/libarchive/FREEBSD-Xlist) ============================================================================== --- head/contrib/libarchive/FREEBSD-Xlist Wed Dec 21 11:11:51 2011 (r228762, copy source) +++ stable/8/contrib/libarchive/FREEBSD-Xlist Thu Jan 5 12:07:42 2012 (r229593) @@ -13,9 +13,11 @@ cpio/test/CMakeLists.txt doc examples libarchive/CMakeLists.txt +libarchive/archive_entry_copy_bhfi.c libarchive/archive_windows.c libarchive/archive_windows.h libarchive/filter_fork_windows.c +libarchive/mtree.5 libarchive/test/.cvsignore libarchive/test/CMakeLists.txt tar/CMakeLists.txt Copied and modified: stable/8/contrib/libarchive/FREEBSD-upgrade (from r228762, head/contrib/libarchive/FREEBSD-upgrade) ============================================================================== --- head/contrib/libarchive/FREEBSD-upgrade Wed Dec 21 11:11:51 2011 (r228762, copy source) +++ stable/8/contrib/libarchive/FREEBSD-upgrade Thu Jan 5 12:07:42 2012 (r229593) @@ -17,7 +17,7 @@ at FreeBSD wiki: http://wiki.freebsd.org/SubversionPrimer/VendorImports -To make local changes to xz, simply patch and commit to the trunk +To make local changes to libarchive, simply patch and commit to the trunk branch (aka HEAD). Never make local changes on the vendor branch. mm@FreeBSD.org Modified: stable/8/contrib/libarchive/cpio/bsdcpio.1 ============================================================================== --- head/contrib/libarchive/cpio/bsdcpio.1 Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/cpio/bsdcpio.1 Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 21, 2007 +.Dd September 5, 2010 .Dt BSDCPIO 1 .Os .Sh NAME @@ -140,7 +140,7 @@ The POSIX.1 tar format. The default format is .Ar odc . See -.Xr libarchive_formats 5 +.Xr libarchive-formats 5 for more complete information about the formats currently supported by the underlying .Xr libarchive 3 @@ -295,7 +295,7 @@ for more information. .Sh EXAMPLES The .Nm -command is traditionally used to copy file heirarchies in conjunction +command is traditionally used to copy file hierarchies in conjunction with the .Xr find 1 command. Modified: stable/8/contrib/libarchive/cpio/cmdline.c ============================================================================== --- head/contrib/libarchive/cpio/cmdline.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/cpio/cmdline.c Thu Jan 5 12:07:42 2012 (r229593) @@ -26,7 +26,7 @@ #include "cpio_platform.h" -__FBSDID("$FreeBSD: src/usr.bin/cpio/cmdline.c,v 1.5 2008/12/06 07:30:40 kientzle Exp $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_ERRNO_H #include @@ -285,6 +285,8 @@ cpio_getopt(struct cpio *cpio) * A period can be used instead of the colon. * * Sets uid/gid return as appropriate, -1 indicates uid/gid not specified. + * TODO: If the spec uses uname/gname, then return those to the caller + * as well. If the spec provides uid/gid, just return names as NULL. * * Returns NULL if no error, otherwise returns error string for display. * Modified: stable/8/contrib/libarchive/cpio/config_freebsd.h ============================================================================== --- head/contrib/libarchive/cpio/config_freebsd.h Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/cpio/config_freebsd.h Thu Jan 5 12:07:42 2012 (r229593) @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/usr.bin/cpio/config_freebsd.h,v 1.3 2008/12/06 07:30:40 kientzle Exp $ + * $FreeBSD$ */ /* A hand-tooled configuration for FreeBSD. */ Modified: stable/8/contrib/libarchive/cpio/cpio.c ============================================================================== --- head/contrib/libarchive/cpio/cpio.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/cpio/cpio.c Thu Jan 5 12:07:42 2012 (r229593) @@ -26,7 +26,7 @@ #include "cpio_platform.h" -__FBSDID("$FreeBSD: src/usr.bin/cpio/cpio.c,v 1.15 2008/12/06 07:30:40 kientzle Exp $"); +__FBSDID("$FreeBSD$"); #include #include @@ -273,15 +273,21 @@ main(int argc, char *argv[]) cpio->quiet = 1; break; case 'R': /* GNU cpio, also --owner */ + /* TODO: owner_parse should return uname/gname + * also; use that to set [ug]name_override. */ errmsg = owner_parse(cpio->optarg, &uid, &gid); if (errmsg) { lafe_warnc(-1, "%s", errmsg); usage(); } - if (uid != -1) + if (uid != -1) { cpio->uid_override = uid; - if (gid != -1) + cpio->uname_override = NULL; + } + if (gid != -1) { cpio->gid_override = gid; + cpio->gname_override = NULL; + } break; case 'r': /* POSIX 1997 */ cpio->option_rename = 1; @@ -575,10 +581,14 @@ file_to_archive(struct cpio *cpio, const return (r); } - if (cpio->uid_override >= 0) + if (cpio->uid_override >= 0) { archive_entry_set_uid(entry, cpio->uid_override); - if (cpio->gid_override >= 0) + archive_entry_set_uname(entry, cpio->uname_override); + } + if (cpio->gid_override >= 0) { archive_entry_set_gid(entry, cpio->gid_override); + archive_entry_set_gname(entry, cpio->gname_override); + } /* * Generate a destination path for this entry. Modified: stable/8/contrib/libarchive/cpio/cpio.h ============================================================================== --- head/contrib/libarchive/cpio/cpio.h Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/cpio/cpio.h Thu Jan 5 12:07:42 2012 (r229593) @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/usr.bin/cpio/cpio.h,v 1.7 2008/12/06 07:30:40 kientzle Exp $ + * $FreeBSD$ */ #ifndef CPIO_H_INCLUDED @@ -68,7 +68,9 @@ struct cpio { size_t pass_destpath_alloc; char *pass_destpath; int uid_override; + char *uname_override; int gid_override; + char *gname_override; int day_first; /* true if locale prefers day/mon */ /* If >= 0, then close this when done. */ Modified: stable/8/contrib/libarchive/cpio/cpio_platform.h ============================================================================== --- head/contrib/libarchive/cpio/cpio_platform.h Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/cpio/cpio_platform.h Thu Jan 5 12:07:42 2012 (r229593) @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/usr.bin/cpio/cpio_platform.h,v 1.2 2008/12/06 07:15:42 kientzle Exp $ + * $FreeBSD$ */ /* Modified: stable/8/contrib/libarchive/cpio/test/main.c ============================================================================== --- head/contrib/libarchive/cpio/test/main.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/cpio/test/main.c Thu Jan 5 12:07:42 2012 (r229593) @@ -36,7 +36,7 @@ * TODO: Move this into a separate configuration header, have all test * suites share one copy of this file. */ -__FBSDID("$FreeBSD: src/usr.bin/cpio/test/main.c,v 1.3 2008/08/24 04:58:22 kientzle Exp $"); +__FBSDID("$FreeBSD$"); #define KNOWNREF "test_option_f.cpio.uu" #define ENVBASE "BSDCPIO" /* Prefix for environment variables. */ #define PROGRAM "bsdcpio" /* Name of program being tested. */ Modified: stable/8/contrib/libarchive/cpio/test/test.h ============================================================================== --- head/contrib/libarchive/cpio/test/test.h Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/cpio/test/test.h Thu Jan 5 12:07:42 2012 (r229593) @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/usr.bin/cpio/test/test.h,v 1.2 2008/06/21 02:17:18 kientzle Exp $ + * $FreeBSD$ */ /* Every test program should #include "test.h" as the first thing. */ Modified: stable/8/contrib/libarchive/cpio/test/test_basic.c ============================================================================== --- head/contrib/libarchive/cpio/test/test_basic.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/cpio/test/test_basic.c Thu Jan 5 12:07:42 2012 (r229593) @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/usr.bin/cpio/test/test_basic.c,v 1.4 2008/08/25 06:39:29 kientzle Exp $"); +__FBSDID("$FreeBSD$"); static void verify_files(const char *msg) Modified: stable/8/contrib/libarchive/cpio/test/test_format_newc.c ============================================================================== --- head/contrib/libarchive/cpio/test/test_format_newc.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/cpio/test/test_format_newc.c Thu Jan 5 12:07:42 2012 (r229593) @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/usr.bin/cpio/test/test_format_newc.c,v 1.2 2008/08/22 02:09:10 kientzle Exp $"); +__FBSDID("$FreeBSD$"); /* Number of bytes needed to pad 'n' to multiple of 'block', assuming * that 'block' is a power of two. This trick can be more easily Modified: stable/8/contrib/libarchive/cpio/test/test_gcpio_compat.c ============================================================================== --- head/contrib/libarchive/cpio/test/test_gcpio_compat.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/cpio/test/test_gcpio_compat.c Thu Jan 5 12:07:42 2012 (r229593) @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/usr.bin/cpio/test/test_gcpio_compat.c,v 1.2 2008/08/22 02:27:06 kientzle Exp $"); +__FBSDID("$FreeBSD$"); static void unpack_test(const char *from, const char *options, const char *se) Modified: stable/8/contrib/libarchive/cpio/test/test_option_L_upper.c ============================================================================== --- head/contrib/libarchive/cpio/test/test_option_L_upper.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/cpio/test/test_option_L_upper.c Thu Jan 5 12:07:42 2012 (r229593) @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/usr.bin/cpio/test/test_option_L.c,v 1.2 2008/08/24 06:21:00 kientzle Exp $"); +__FBSDID("$FreeBSD$"); /* This is a little pointless, as Windows doesn't support symlinks * (except for the seriously crippled CreateSymbolicLink API) so these Modified: stable/8/contrib/libarchive/cpio/test/test_option_a.c ============================================================================== --- head/contrib/libarchive/cpio/test/test_option_a.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/cpio/test/test_option_a.c Thu Jan 5 12:07:42 2012 (r229593) @@ -28,7 +28,7 @@ #elif defined(HAVE_SYS_UTIME_H) #include #endif -__FBSDID("$FreeBSD: src/usr.bin/cpio/test/test_option_a.c,v 1.3 2008/08/24 06:21:00 kientzle Exp $"); +__FBSDID("$FreeBSD$"); static struct { const char *name; Modified: stable/8/contrib/libarchive/cpio/test/test_option_tv.stdout.uu ============================================================================== --- head/contrib/libarchive/cpio/test/test_option_tv.stdout.uu Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/cpio/test/test_option_tv.stdout.uu Thu Jan 5 12:07:42 2012 (r229593) @@ -1,4 +1,4 @@ -$FreeBSD: src/usr.bin/cpio/test/test_option_tv.stdout.uu,v 1.2 2008/11/29 20:22:02 kientzle Exp $ +$FreeBSD$ begin 644 test_option_tv.stdout M+7)W+7(M+7(M+2`@(#$@=&EM("`@("`@=&EM("`@("`@("`@("`@(#`@1&5C /(#,Q("`Q.38Y(&9I;&4* Modified: stable/8/contrib/libarchive/cpio/test/test_option_y.c ============================================================================== --- head/contrib/libarchive/cpio/test/test_option_y.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/cpio/test/test_option_y.c Thu Jan 5 12:07:42 2012 (r229593) @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/usr.bin/cpio/test/test_option_y.c,v 1.2 2008/08/24 06:21:00 kientzle Exp $"); +__FBSDID("$FreeBSD$"); DEFINE_TEST(test_option_y) { Modified: stable/8/contrib/libarchive/cpio/test/test_passthrough_dotdot.c ============================================================================== --- head/contrib/libarchive/cpio/test/test_passthrough_dotdot.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/cpio/test/test_passthrough_dotdot.c Thu Jan 5 12:07:42 2012 (r229593) @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/usr.bin/cpio/test/test_passthrough_dotdot.c,v 1.4 2008/08/24 06:21:00 kientzle Exp $"); +__FBSDID("$FreeBSD$"); /* * Verify that "cpio -p .." works. Modified: stable/8/contrib/libarchive/cpio/test/test_passthrough_reverse.c ============================================================================== --- head/contrib/libarchive/cpio/test/test_passthrough_reverse.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/cpio/test/test_passthrough_reverse.c Thu Jan 5 12:07:42 2012 (r229593) @@ -23,7 +23,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test.h" -__FBSDID("$FreeBSD: src/usr.bin/cpio/test/test_passthrough_reverse.c,v 1.2 2008/08/24 06:21:00 kientzle Exp $"); +__FBSDID("$FreeBSD$"); /* * As reported by Bernd Walter: Some people are in the habit of Modified: stable/8/contrib/libarchive/libarchive/archive.h ============================================================================== --- head/contrib/libarchive/libarchive/archive.h Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive.h Thu Jan 5 12:07:42 2012 (r229593) @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/lib/libarchive/archive.h.in,v 1.50 2008/05/26 17:00:22 kientzle Exp $ + * $FreeBSD$ */ #ifndef ARCHIVE_H_INCLUDED @@ -493,11 +493,10 @@ __LA_DECL void archive_read_extract_set /* Close the file and release most resources. */ __LA_DECL int archive_read_close(struct archive *); /* Release all resources and destroy the object. */ -/* Note that archive_read_finish will call archive_read_close for you. */ -#if ARCHIVE_VERSION_NUMBER < 2000000 -/* Erroneously declared to return void in libarchive 1.x */ -__LA_DECL void archive_read_finish(struct archive *); -#else +/* Note that archive_read_free will call archive_read_close for you. */ +__LA_DECL int archive_read_free(struct archive *); +#if ARCHIVE_VERSION_NUMBER < 4000000 +/* Synonym for archive_read_free() for backwards compatibility. */ __LA_DECL int archive_read_finish(struct archive *); #endif @@ -514,7 +513,7 @@ __LA_DECL int archive_read_finish(stru * - archive_write_header to write the header * - archive_write_data to write the entry data * 5) archive_write_close to close the output - * 6) archive_write_finish to cleanup the writer and release resources + * 6) archive_write_free to cleanup the writer and release resources */ __LA_DECL struct archive *archive_write_new(void); __LA_DECL int archive_write_set_bytes_per_block(struct archive *, @@ -595,13 +594,12 @@ __LA_DECL __LA_SSIZE_T archive_write_da #endif __LA_DECL int archive_write_finish_entry(struct archive *); __LA_DECL int archive_write_close(struct archive *); -#if ARCHIVE_VERSION_NUMBER < 2000000 -/* Return value was incorrect in libarchive 1.x. */ -__LA_DECL void archive_write_finish(struct archive *); -#else -/* Libarchive 2.x and later returns an error if this fails. */ -/* It can fail if the archive wasn't already closed, in which case - * archive_write_finish() will implicitly call archive_write_close(). */ + +/* This can fail if the archive wasn't already closed, in which case + * archive_write_free() will implicitly call archive_write_close(). */ +__LA_DECL int archive_write_free(struct archive *); +#if ARCHIVE_VERSION_NUMBER < 4000000 +/* Synonym for archive_write_free() for backwards compatibility. */ __LA_DECL int archive_write_finish(struct archive *); #endif @@ -630,7 +628,7 @@ __LA_DECL int archive_write_set_options * - construct an appropriate struct archive_entry structure * - archive_write_header to create the file/dir/etc on disk * - archive_write_data to write the entry data - * 4) archive_write_finish to cleanup the writer and release resources + * 4) archive_write_free to cleanup the writer and release resources * * In particular, you can use this in conjunction with archive_read() * to pull entries out of an archive and create them on disk. Modified: stable/8/contrib/libarchive/libarchive/archive_check_magic.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_check_magic.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_check_magic.c Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_check_magic.c 201089 2009-12-28 02:20:23Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_TYPES_H #include Modified: stable/8/contrib/libarchive/libarchive/archive_crc32.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_crc32.h Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_crc32.h Thu Jan 5 12:07:42 2012 (r229593) @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: head/lib/libarchive/archive_crc32.h 201102 2009-12-28 03:11:36Z kientzle $ + * $FreeBSD$ */ #ifndef __LIBARCHIVE_BUILD Modified: stable/8/contrib/libarchive/libarchive/archive_endian.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_endian.h Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_endian.h Thu Jan 5 12:07:42 2012 (r229593) @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: head/lib/libarchive/archive_endian.h 201085 2009-12-28 02:17:15Z kientzle $ + * $FreeBSD$ * * Borrowed from FreeBSD's */ Modified: stable/8/contrib/libarchive/libarchive/archive_entry.3 ============================================================================== --- head/contrib/libarchive/libarchive/archive_entry.3 Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_entry.3 Thu Jan 5 12:07:42 2012 (r229593) @@ -22,10 +22,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/lib/libarchive/archive_entry.3,v 1.18 2008/05/26 17:00:22 kientzle Exp $ +.\" $FreeBSD$ .\" .Dd May 12, 2008 -.Dt archive_entry 3 +.Dt ARCHIVE_ENTRY 3 .Os .Sh NAME .Nm archive_entry_acl_add_entry , Modified: stable/8/contrib/libarchive/libarchive/archive_entry.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_entry.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_entry.c Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_entry.c 201096 2009-12-28 02:41:27Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_STAT_H #include Modified: stable/8/contrib/libarchive/libarchive/archive_entry.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_entry.h Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_entry.h Thu Jan 5 12:07:42 2012 (r229593) @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: head/lib/libarchive/archive_entry.h 201096 2009-12-28 02:41:27Z kientzle $ + * $FreeBSD$ */ #ifndef ARCHIVE_ENTRY_H_INCLUDED Modified: stable/8/contrib/libarchive/libarchive/archive_entry_copy_stat.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_entry_copy_stat.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_entry_copy_stat.c Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_entry_copy_stat.c 189466 2009-03-07 00:52:02Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_STAT_H #include Modified: stable/8/contrib/libarchive/libarchive/archive_entry_link_resolver.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_entry_link_resolver.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_entry_link_resolver.c Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_entry_link_resolver.c 201100 2009-12-28 03:05:31Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_STAT_H #include Modified: stable/8/contrib/libarchive/libarchive/archive_entry_private.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_entry_private.h Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_entry_private.h Thu Jan 5 12:07:42 2012 (r229593) @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: head/lib/libarchive/archive_entry_private.h 201096 2009-12-28 02:41:27Z kientzle $ + * $FreeBSD$ */ #ifndef __LIBARCHIVE_BUILD Modified: stable/8/contrib/libarchive/libarchive/archive_entry_stat.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_entry_stat.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_entry_stat.c Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_entry_stat.c 201100 2009-12-28 03:05:31Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_STAT_H #include Modified: stable/8/contrib/libarchive/libarchive/archive_entry_strmode.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_entry_strmode.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_entry_strmode.c Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_entry_strmode.c,v 1.4 2008/06/15 05:14:01 kientzle Exp $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_STAT_H #include Modified: stable/8/contrib/libarchive/libarchive/archive_entry_xattr.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_entry_xattr.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_entry_xattr.c Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_entry_xattr.c 201096 2009-12-28 02:41:27Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_STAT_H #include Modified: stable/8/contrib/libarchive/libarchive/archive_hash.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_hash.h Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_hash.h Thu Jan 5 12:07:42 2012 (r229593) @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: head/lib/libarchive/archive_hash.h 201171 2009-12-29 06:39:07Z kientzle $ + * $FreeBSD$ */ #ifndef __LIBARCHIVE_BUILD Modified: stable/8/contrib/libarchive/libarchive/archive_platform.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_platform.h Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_platform.h Thu Jan 5 12:07:42 2012 (r229593) @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: head/lib/libarchive/archive_platform.h 201090 2009-12-28 02:22:04Z kientzle $ + * $FreeBSD$ */ /* !!ONLY FOR USE INTERNALLY TO LIBARCHIVE!! */ Modified: stable/8/contrib/libarchive/libarchive/archive_private.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_private.h Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_private.h Thu Jan 5 12:07:42 2012 (r229593) @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: head/lib/libarchive/archive_private.h 201098 2009-12-28 02:58:14Z kientzle $ + * $FreeBSD$ */ #ifndef __LIBARCHIVE_BUILD @@ -58,7 +58,7 @@ struct archive_vtable { int (*archive_close)(struct archive *); - int (*archive_finish)(struct archive *); + int (*archive_free)(struct archive *); int (*archive_write_header)(struct archive *, struct archive_entry *); int (*archive_write_finish_entry)(struct archive *); Modified: stable/8/contrib/libarchive/libarchive/archive_read.3 ============================================================================== --- head/contrib/libarchive/libarchive/archive_read.3 Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read.3 Thu Jan 5 12:07:42 2012 (r229593) @@ -22,10 +22,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: head/lib/libarchive/archive_read.3 191595 2009-04-27 20:13:13Z kientzle $ +.\" $FreeBSD$ .\" .Dd April 13, 2009 -.Dt archive_read 3 +.Dt ARCHIVE_READ 3 .Os .Sh NAME .Nm archive_read_new , @@ -69,7 +69,7 @@ .Nm archive_read_extract2 , .Nm archive_read_extract_set_progress_callback , .Nm archive_read_close , -.Nm archive_read_finish +.Nm archive_read_free .Nd functions for reading streaming archives .Sh SYNOPSIS .In archive.h @@ -196,7 +196,7 @@ .Ft int .Fn archive_read_close "struct archive *" .Ft int -.Fn archive_read_finish "struct archive *" +.Fn archive_read_free "struct archive *" .Sh DESCRIPTION These functions provide a complete API for reading streaming archives. The general process is to first create the @@ -457,7 +457,7 @@ object and the archive_entry object so t can be retrieved for the progress display. .It Fn archive_read_close Complete the archive and invoke the close callback. -.It Fn archive_read_finish +.It Fn archive_read_free Invokes .Fn archive_read_close if it was not invoked manually, then release all resources. @@ -600,7 +600,7 @@ list_archive(const char *name) printf("%s\en",archive_entry_pathname(entry)); archive_read_data_skip(a); } - archive_read_finish(a); + archive_read_free(a); free(mydata); } Modified: stable/8/contrib/libarchive/libarchive/archive_read.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read.c Thu Jan 5 12:07:42 2012 (r229593) @@ -32,7 +32,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read.c 201157 2009-12-29 05:30:23Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_ERRNO_H #include @@ -60,7 +60,7 @@ static int choose_format(struct archive_ static int cleanup_filters(struct archive_read *); static struct archive_vtable *archive_read_vtable(void); static int _archive_read_close(struct archive *); -static int _archive_read_finish(struct archive *); +static int _archive_read_free(struct archive *); static struct archive_vtable * archive_read_vtable(void) @@ -69,7 +69,7 @@ archive_read_vtable(void) static int inited = 0; if (!inited) { - av.archive_finish = _archive_read_finish; + av.archive_free = _archive_read_free; av.archive_close = _archive_read_close; } return (&av); @@ -779,7 +779,7 @@ cleanup_filters(struct archive_read *a) * Release memory and other resources. */ static int -_archive_read_finish(struct archive *_a) +_archive_read_free(struct archive *_a) { struct archive_read *a = (struct archive_read *)_a; int i; @@ -787,7 +787,7 @@ _archive_read_finish(struct archive *_a) int r = ARCHIVE_OK; __archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_ANY, - "archive_read_finish"); + "archive_read_free"); if (a->archive.state != ARCHIVE_STATE_CLOSED) r = archive_read_close(&a->archive); Modified: stable/8/contrib/libarchive/libarchive/archive_read_data_into_fd.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_data_into_fd.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_data_into_fd.c Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_data_into_fd.c,v 1.16 2008/05/23 05:01:29 cperciva Exp $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_TYPES_H #include Modified: stable/8/contrib/libarchive/libarchive/archive_read_disk.3 ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_disk.3 Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_disk.3 Thu Jan 5 12:07:42 2012 (r229593) @@ -22,10 +22,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: head/lib/libarchive/archive_read_disk.3 190957 2009-04-12 05:04:02Z kientzle $ +.\" $FreeBSD$ .\" .Dd March 10, 2009 -.Dt archive_read_disk 3 +.Dt ARCHIVE_READ_DISK 3 .Os .Sh NAME .Nm archive_read_disk_new , @@ -39,7 +39,7 @@ .Nm archive_read_disk_set_gname_lookup , .Nm archive_read_disk_set_standard_lookup , .Nm archive_read_close , -.Nm archive_read_finish +.Nm archive_read_free .Nd functions for reading objects from disk .Sh SYNOPSIS .In archive.h @@ -81,7 +81,7 @@ .Ft int .Fn archive_read_close "struct archive *" .Ft int -.Fn archive_read_finish "struct archive *" +.Fn archive_read_free "struct archive *" .Sh DESCRIPTION These functions provide an API for reading information about objects on disk. @@ -178,9 +178,9 @@ This affects the file ownership fields a object. .It Fn archive_read_close This currently does nothing. -.It Fn archive_write_finish +.It Fn archive_read_free Invokes -.Fn archive_write_close +.Fn archive_read_close if it was not invoked manually, then releases all resources. .El More information about the @@ -213,7 +213,7 @@ file_to_archive(struct archive *a, const while ((bytes_read = read(fd, buff, sizeof(buff))) > 0) archive_write_data(a, buff, bytes_read); archive_write_finish_entry(a); - archive_read_finish(ard); + archive_read_free(ard); archive_entry_free(entry); } .Ed @@ -276,7 +276,7 @@ and first appeared in The .Nm libarchive library was written by -.An Tim Kientzle Aq kientzle@freebsd.org . +.An Tim Kientzle Aq kientzle@FreeBSD.org . .Sh BUGS The .Dq standard Modified: stable/8/contrib/libarchive/libarchive/archive_read_disk.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_disk.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_disk.c Thu Jan 5 12:07:42 2012 (r229593) @@ -25,7 +25,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_disk.c 189429 2009-03-06 04:35:31Z kientzle $"); +__FBSDID("$FreeBSD$"); #include "archive.h" #include "archive_string.h" @@ -33,7 +33,7 @@ __FBSDID("$FreeBSD: head/lib/libarchive/ #include "archive_private.h" #include "archive_read_disk_private.h" -static int _archive_read_finish(struct archive *); +static int _archive_read_free(struct archive *); static int _archive_read_close(struct archive *); static const char *trivial_lookup_gname(void *, gid_t gid); static const char *trivial_lookup_uname(void *, uid_t uid); @@ -45,7 +45,7 @@ archive_read_disk_vtable(void) static int inited = 0; if (!inited) { - av.archive_finish = _archive_read_finish; + av.archive_free = _archive_read_free; av.archive_close = _archive_read_close; } return (&av); @@ -129,7 +129,7 @@ archive_read_disk_new(void) } static int -_archive_read_finish(struct archive *_a) +_archive_read_free(struct archive *_a) { struct archive_read_disk *a = (struct archive_read_disk *)_a; Modified: stable/8/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_disk_entry_from_file.c 201084 2009-12-28 02:14:09Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_TYPES_H /* Mac OSX requires sys/types.h before sys/acl.h. */ Modified: stable/8/contrib/libarchive/libarchive/archive_read_disk_private.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_disk_private.h Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_disk_private.h Thu Jan 5 12:07:42 2012 (r229593) @@ -23,7 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: head/lib/libarchive/archive_read_disk_private.h 201105 2009-12-28 03:20:54Z kientzle $ + * $FreeBSD$ */ #ifndef __LIBARCHIVE_BUILD Modified: stable/8/contrib/libarchive/libarchive/archive_read_disk_set_standard_lookup.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_disk_set_standard_lookup.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_disk_set_standard_lookup.c Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_disk_set_standard_lookup.c 201109 2009-12-28 03:30:31Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_TYPES_H #include Modified: stable/8/contrib/libarchive/libarchive/archive_read_extract.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_extract.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_extract.c Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_extract.c,v 1.61 2008/05/26 17:00:22 kientzle Exp $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_TYPES_H #include @@ -173,10 +173,7 @@ archive_read_extract_cleanup(struct arch { int ret = ARCHIVE_OK; -#if ARCHIVE_API_VERSION > 1 - ret = -#endif - archive_write_finish(a->extract->ad); + ret = archive_write_free(a->extract->ad); free(a->extract); a->extract = NULL; return (ret); Modified: stable/8/contrib/libarchive/libarchive/archive_read_open_fd.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_open_fd.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_open_fd.c Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_open_fd.c 201103 2009-12-28 03:13:49Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_STAT_H #include Modified: stable/8/contrib/libarchive/libarchive/archive_read_open_file.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_open_file.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_open_file.c Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_open_file.c 201093 2009-12-28 02:28:44Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_STAT_H #include Modified: stable/8/contrib/libarchive/libarchive/archive_read_open_filename.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_open_filename.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_open_filename.c Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_open_filename.c 201093 2009-12-28 02:28:44Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_STAT_H #include Modified: stable/8/contrib/libarchive/libarchive/archive_read_open_memory.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_open_memory.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_open_memory.c Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_open_memory.c,v 1.6 2007/07/06 15:51:59 kientzle Exp $"); +__FBSDID("$FreeBSD$"); #include #include Modified: stable/8/contrib/libarchive/libarchive/archive_read_private.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_private.h Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_private.h Thu Jan 5 12:07:42 2012 (r229593) @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: head/lib/libarchive/archive_read_private.h 201088 2009-12-28 02:18:55Z kientzle $ + * $FreeBSD$ */ #ifndef __LIBARCHIVE_BUILD Modified: stable/8/contrib/libarchive/libarchive/archive_read_support_compression_all.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_compression_all.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_support_compression_all.c Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_compression_all.c 201248 2009-12-30 06:12:03Z kientzle $"); +__FBSDID("$FreeBSD$"); #include "archive.h" Modified: stable/8/contrib/libarchive/libarchive/archive_read_support_compression_bzip2.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_compression_bzip2.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_support_compression_bzip2.c Thu Jan 5 12:07:42 2012 (r229593) @@ -25,7 +25,7 @@ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_compression_bzip2.c 201108 2009-12-28 03:28:21Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_ERRNO_H #include Modified: stable/8/contrib/libarchive/libarchive/archive_read_support_compression_compress.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_compression_compress.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_support_compression_compress.c Thu Jan 5 12:07:42 2012 (r229593) @@ -64,7 +64,7 @@ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_compression_compress.c 201094 2009-12-28 02:29:21Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_ERRNO_H #include Modified: stable/8/contrib/libarchive/libarchive/archive_read_support_compression_gzip.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_compression_gzip.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_support_compression_gzip.c Thu Jan 5 12:07:42 2012 (r229593) @@ -25,7 +25,7 @@ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_compression_gzip.c 201082 2009-12-28 02:05:28Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_ERRNO_H Modified: stable/8/contrib/libarchive/libarchive/archive_read_support_compression_none.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_compression_none.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_support_compression_none.c Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_compression_none.c 185679 2008-12-06 06:45:15Z kientzle $"); +__FBSDID("$FreeBSD$"); #include "archive.h" Modified: stable/8/contrib/libarchive/libarchive/archive_read_support_compression_program.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_compression_program.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_support_compression_program.c Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_compression_program.c 201112 2009-12-28 06:59:35Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_WAIT_H # include Modified: stable/8/contrib/libarchive/libarchive/archive_read_support_compression_uu.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_compression_uu.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_support_compression_uu.c Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_compression_uu.c 201248 2009-12-30 06:12:03Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_ERRNO_H #include Modified: stable/8/contrib/libarchive/libarchive/archive_read_support_compression_xz.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_compression_xz.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_support_compression_xz.c Thu Jan 5 12:07:42 2012 (r229593) @@ -26,7 +26,7 @@ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_compression_xz.c 201167 2009-12-29 06:06:20Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_ERRNO_H #include Modified: stable/8/contrib/libarchive/libarchive/archive_read_support_format_all.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_all.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_support_format_all.c Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_format_all.c 174991 2007-12-30 04:58:22Z kientzle $"); +__FBSDID("$FreeBSD$"); #include "archive.h" Modified: stable/8/contrib/libarchive/libarchive/archive_read_support_format_ar.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_ar.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_support_format_ar.c Thu Jan 5 12:07:42 2012 (r229593) @@ -26,7 +26,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_format_ar.c 201101 2009-12-28 03:06:27Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_SYS_STAT_H #include Modified: stable/8/contrib/libarchive/libarchive/archive_read_support_format_cpio.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_cpio.c Wed Dec 21 11:09:24 2011 (r228761) +++ stable/8/contrib/libarchive/libarchive/archive_read_support_format_cpio.c Thu Jan 5 12:07:42 2012 (r229593) @@ -24,7 +24,7 @@ */ #include "archive_platform.h" -__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_format_cpio.c 201163 2009-12-29 05:50:34Z kientzle $"); +__FBSDID("$FreeBSD$"); #ifdef HAVE_ERRNO_H #include @@ -42,6 +42,10 @@ __FBSDID("$FreeBSD: head/lib/libarchive/ #include "archive_private.h" #include "archive_read_private.h" +#ifdef _MSC_VER +#define __packed +#pragma pack(push, 1) +#endif struct cpio_bin_header { unsigned char c_magic[2]; unsigned char c_dev[2]; @@ -54,7 +58,7 @@ struct cpio_bin_header { unsigned char c_mtime[4]; unsigned char c_namesize[2]; unsigned char c_filesize[4]; -}; +} __packed; struct cpio_odc_header { char c_magic[6]; @@ -68,7 +72,7 @@ struct cpio_odc_header { char c_mtime[11]; char c_namesize[6]; char c_filesize[11]; -}; +} __packed; struct cpio_newc_header { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 12:09:40 2012 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 19EF7106566B; Thu, 5 Jan 2012 12:09:40 +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 DF8DD8FC1B; Thu, 5 Jan 2012 12:09: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 q05C9d18034775; Thu, 5 Jan 2012 12:09:39 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05C9dNs034773; Thu, 5 Jan 2012 12:09:39 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201201051209.q05C9dNs034773@svn.freebsd.org> From: Ed Schouten Date: Thu, 5 Jan 2012 12:09:39 +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: r229594 - head/include 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, 05 Jan 2012 12:09:40 -0000 Author: ed Date: Thu Jan 5 12:09:39 2012 New Revision: 229594 URL: http://svn.freebsd.org/changeset/base/229594 Log: Remove redundant inclusion of . Mea culpa. Modified: head/include/complex.h Modified: head/include/complex.h ============================================================================== --- head/include/complex.h Thu Jan 5 12:07:42 2012 (r229593) +++ head/include/complex.h Thu Jan 5 12:09:39 2012 (r229594) @@ -43,8 +43,6 @@ _Static_assert(__generic(_Complex_I, flo #define complex _Complex #define I _Complex_I -#include - __BEGIN_DECLS double cabs(double complex); From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 12:52:06 2012 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 A3C11106564A; Thu, 5 Jan 2012 12:52:06 +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 88CA28FC0A; Thu, 5 Jan 2012 12:52: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 q05Cq6qD036316; Thu, 5 Jan 2012 12:52:06 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05Cq6d6036309; Thu, 5 Jan 2012 12:52:06 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201051252.q05Cq6d6036309@svn.freebsd.org> From: Martin Matuska Date: Thu, 5 Jan 2012 12:52:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229595 - in stable/9: lib/libarchive lib/libarchive/libarchive_fe lib/libarchive/test usr.bin/cpio usr.bin/cpio/test usr.bin/tar usr.bin/tar/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: Thu, 05 Jan 2012 12:52:06 -0000 Author: mm Date: Thu Jan 5 12:52:05 2012 New Revision: 229595 URL: http://svn.freebsd.org/changeset/base/229595 Log: MFC r228797: Use contrib sources for building libarchive, tar and cpio. Make "make test" fully operational. Deleted: stable/9/lib/libarchive/COPYING stable/9/lib/libarchive/README stable/9/lib/libarchive/archive.h stable/9/lib/libarchive/archive_check_magic.c stable/9/lib/libarchive/archive_crc32.h stable/9/lib/libarchive/archive_endian.h stable/9/lib/libarchive/archive_entry.3 stable/9/lib/libarchive/archive_entry.c stable/9/lib/libarchive/archive_entry.h stable/9/lib/libarchive/archive_entry_copy_stat.c stable/9/lib/libarchive/archive_entry_link_resolver.c stable/9/lib/libarchive/archive_entry_private.h stable/9/lib/libarchive/archive_entry_stat.c stable/9/lib/libarchive/archive_entry_strmode.c stable/9/lib/libarchive/archive_entry_xattr.c stable/9/lib/libarchive/archive_hash.h stable/9/lib/libarchive/archive_platform.h stable/9/lib/libarchive/archive_private.h stable/9/lib/libarchive/archive_read.3 stable/9/lib/libarchive/archive_read.c stable/9/lib/libarchive/archive_read_data_into_fd.c stable/9/lib/libarchive/archive_read_disk.3 stable/9/lib/libarchive/archive_read_disk.c stable/9/lib/libarchive/archive_read_disk_entry_from_file.c stable/9/lib/libarchive/archive_read_disk_private.h stable/9/lib/libarchive/archive_read_disk_set_standard_lookup.c stable/9/lib/libarchive/archive_read_extract.c stable/9/lib/libarchive/archive_read_open_fd.c stable/9/lib/libarchive/archive_read_open_file.c stable/9/lib/libarchive/archive_read_open_filename.c stable/9/lib/libarchive/archive_read_open_memory.c stable/9/lib/libarchive/archive_read_private.h stable/9/lib/libarchive/archive_read_support_compression_all.c stable/9/lib/libarchive/archive_read_support_compression_bzip2.c stable/9/lib/libarchive/archive_read_support_compression_compress.c stable/9/lib/libarchive/archive_read_support_compression_gzip.c stable/9/lib/libarchive/archive_read_support_compression_none.c stable/9/lib/libarchive/archive_read_support_compression_program.c stable/9/lib/libarchive/archive_read_support_compression_rpm.c stable/9/lib/libarchive/archive_read_support_compression_uu.c stable/9/lib/libarchive/archive_read_support_compression_xz.c stable/9/lib/libarchive/archive_read_support_format_all.c stable/9/lib/libarchive/archive_read_support_format_ar.c stable/9/lib/libarchive/archive_read_support_format_cpio.c stable/9/lib/libarchive/archive_read_support_format_empty.c stable/9/lib/libarchive/archive_read_support_format_iso9660.c stable/9/lib/libarchive/archive_read_support_format_mtree.c stable/9/lib/libarchive/archive_read_support_format_raw.c stable/9/lib/libarchive/archive_read_support_format_tar.c stable/9/lib/libarchive/archive_read_support_format_xar.c stable/9/lib/libarchive/archive_read_support_format_zip.c stable/9/lib/libarchive/archive_string.c stable/9/lib/libarchive/archive_string.h stable/9/lib/libarchive/archive_string_sprintf.c stable/9/lib/libarchive/archive_util.3 stable/9/lib/libarchive/archive_util.c stable/9/lib/libarchive/archive_virtual.c stable/9/lib/libarchive/archive_write.3 stable/9/lib/libarchive/archive_write.c stable/9/lib/libarchive/archive_write_disk.3 stable/9/lib/libarchive/archive_write_disk.c stable/9/lib/libarchive/archive_write_disk_private.h stable/9/lib/libarchive/archive_write_disk_set_standard_lookup.c stable/9/lib/libarchive/archive_write_open_fd.c stable/9/lib/libarchive/archive_write_open_file.c stable/9/lib/libarchive/archive_write_open_filename.c stable/9/lib/libarchive/archive_write_open_memory.c stable/9/lib/libarchive/archive_write_private.h stable/9/lib/libarchive/archive_write_set_compression_bzip2.c stable/9/lib/libarchive/archive_write_set_compression_compress.c stable/9/lib/libarchive/archive_write_set_compression_gzip.c stable/9/lib/libarchive/archive_write_set_compression_none.c stable/9/lib/libarchive/archive_write_set_compression_program.c stable/9/lib/libarchive/archive_write_set_compression_xz.c stable/9/lib/libarchive/archive_write_set_format.c stable/9/lib/libarchive/archive_write_set_format_ar.c stable/9/lib/libarchive/archive_write_set_format_by_name.c stable/9/lib/libarchive/archive_write_set_format_cpio.c stable/9/lib/libarchive/archive_write_set_format_cpio_newc.c stable/9/lib/libarchive/archive_write_set_format_mtree.c stable/9/lib/libarchive/archive_write_set_format_pax.c stable/9/lib/libarchive/archive_write_set_format_shar.c stable/9/lib/libarchive/archive_write_set_format_ustar.c stable/9/lib/libarchive/archive_write_set_format_zip.c stable/9/lib/libarchive/cpio.5 stable/9/lib/libarchive/filter_fork.c stable/9/lib/libarchive/filter_fork.h stable/9/lib/libarchive/libarchive-formats.5 stable/9/lib/libarchive/libarchive.3 stable/9/lib/libarchive/libarchive_fe/ stable/9/lib/libarchive/libarchive_internals.3 stable/9/lib/libarchive/tar.5 stable/9/lib/libarchive/test/.cvsignore stable/9/lib/libarchive/test/README stable/9/lib/libarchive/test/main.c stable/9/lib/libarchive/test/read_open_memory.c stable/9/lib/libarchive/test/test.h stable/9/lib/libarchive/test/test_acl_basic.c stable/9/lib/libarchive/test/test_acl_freebsd.c stable/9/lib/libarchive/test/test_acl_pax.c stable/9/lib/libarchive/test/test_archive_api_feature.c stable/9/lib/libarchive/test/test_bad_fd.c stable/9/lib/libarchive/test/test_compat_bzip2.c stable/9/lib/libarchive/test/test_compat_bzip2_1.tbz.uu stable/9/lib/libarchive/test/test_compat_bzip2_2.tbz.uu stable/9/lib/libarchive/test/test_compat_cpio.c stable/9/lib/libarchive/test/test_compat_cpio_1.cpio.uu stable/9/lib/libarchive/test/test_compat_gtar.c stable/9/lib/libarchive/test/test_compat_gtar_1.tar.uu stable/9/lib/libarchive/test/test_compat_gzip.c stable/9/lib/libarchive/test/test_compat_gzip_1.tgz.uu stable/9/lib/libarchive/test/test_compat_gzip_2.tgz.uu stable/9/lib/libarchive/test/test_compat_lzma.c stable/9/lib/libarchive/test/test_compat_lzma_1.tlz.uu stable/9/lib/libarchive/test/test_compat_lzma_2.tlz.uu stable/9/lib/libarchive/test/test_compat_lzma_3.tlz.uu stable/9/lib/libarchive/test/test_compat_solaris_tar_acl.c stable/9/lib/libarchive/test/test_compat_solaris_tar_acl.tar.uu stable/9/lib/libarchive/test/test_compat_tar_hardlink.c stable/9/lib/libarchive/test/test_compat_tar_hardlink_1.tar.uu stable/9/lib/libarchive/test/test_compat_xz.c stable/9/lib/libarchive/test/test_compat_xz_1.txz.uu stable/9/lib/libarchive/test/test_compat_zip.c stable/9/lib/libarchive/test/test_compat_zip_1.zip.uu stable/9/lib/libarchive/test/test_compat_zip_2.zip.uu stable/9/lib/libarchive/test/test_empty_write.c stable/9/lib/libarchive/test/test_entry.c stable/9/lib/libarchive/test/test_entry_strmode.c stable/9/lib/libarchive/test/test_extattr_freebsd.c stable/9/lib/libarchive/test/test_fuzz.c stable/9/lib/libarchive/test/test_fuzz_1.iso.Z.uu stable/9/lib/libarchive/test/test_link_resolver.c stable/9/lib/libarchive/test/test_open_failure.c stable/9/lib/libarchive/test/test_open_fd.c stable/9/lib/libarchive/test/test_open_file.c stable/9/lib/libarchive/test/test_open_filename.c stable/9/lib/libarchive/test/test_pax_filename_encoding.c stable/9/lib/libarchive/test/test_pax_filename_encoding.tar.uu stable/9/lib/libarchive/test/test_read_compress_program.c stable/9/lib/libarchive/test/test_read_data_large.c stable/9/lib/libarchive/test/test_read_disk.c stable/9/lib/libarchive/test/test_read_disk_entry_from_file.c stable/9/lib/libarchive/test/test_read_extract.c stable/9/lib/libarchive/test/test_read_file_nonexistent.c stable/9/lib/libarchive/test/test_read_format_ar.ar.uu stable/9/lib/libarchive/test/test_read_format_ar.c stable/9/lib/libarchive/test/test_read_format_cpio_bin.c stable/9/lib/libarchive/test/test_read_format_cpio_bin_Z.c stable/9/lib/libarchive/test/test_read_format_cpio_bin_be.c stable/9/lib/libarchive/test/test_read_format_cpio_bin_be.cpio.uu stable/9/lib/libarchive/test/test_read_format_cpio_bin_bz2.c stable/9/lib/libarchive/test/test_read_format_cpio_bin_gz.c stable/9/lib/libarchive/test/test_read_format_cpio_bin_lzma.c stable/9/lib/libarchive/test/test_read_format_cpio_bin_xz.c stable/9/lib/libarchive/test/test_read_format_cpio_odc.c stable/9/lib/libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.c stable/9/lib/libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.rpm.uu stable/9/lib/libarchive/test/test_read_format_cpio_svr4_gzip.c stable/9/lib/libarchive/test/test_read_format_cpio_svr4_gzip_rpm.c stable/9/lib/libarchive/test/test_read_format_cpio_svr4_gzip_rpm.rpm.uu stable/9/lib/libarchive/test/test_read_format_cpio_svr4c_Z.c stable/9/lib/libarchive/test/test_read_format_empty.c stable/9/lib/libarchive/test/test_read_format_gtar_gz.c stable/9/lib/libarchive/test/test_read_format_gtar_lzma.c stable/9/lib/libarchive/test/test_read_format_gtar_sparse.c stable/9/lib/libarchive/test/test_read_format_gtar_sparse_1_13.tar.uu stable/9/lib/libarchive/test/test_read_format_gtar_sparse_1_17.tar.uu stable/9/lib/libarchive/test/test_read_format_gtar_sparse_1_17_posix00.tar.uu stable/9/lib/libarchive/test/test_read_format_gtar_sparse_1_17_posix01.tar.uu stable/9/lib/libarchive/test/test_read_format_gtar_sparse_1_17_posix10.tar.uu stable/9/lib/libarchive/test/test_read_format_gtar_sparse_1_17_posix10_modified.tar.uu stable/9/lib/libarchive/test/test_read_format_iso.iso.Z.uu stable/9/lib/libarchive/test/test_read_format_iso_2.iso.Z.uu stable/9/lib/libarchive/test/test_read_format_iso_Z.c stable/9/lib/libarchive/test/test_read_format_iso_joliet.iso.Z.uu stable/9/lib/libarchive/test/test_read_format_iso_joliet_long.iso.Z.uu stable/9/lib/libarchive/test/test_read_format_iso_joliet_rockridge.iso.Z.uu stable/9/lib/libarchive/test/test_read_format_iso_multi_extent.c stable/9/lib/libarchive/test/test_read_format_iso_multi_extent.iso.Z.uu stable/9/lib/libarchive/test/test_read_format_iso_rockridge.iso.Z.uu stable/9/lib/libarchive/test/test_read_format_iso_rockridge_ce.iso.Z.uu stable/9/lib/libarchive/test/test_read_format_iso_rockridge_new.iso.Z.uu stable/9/lib/libarchive/test/test_read_format_iso_rockridge_rr_moved.iso.Z.uu stable/9/lib/libarchive/test/test_read_format_iso_zisofs.iso.Z.uu stable/9/lib/libarchive/test/test_read_format_isojoliet_bz2.c stable/9/lib/libarchive/test/test_read_format_isojoliet_long.c stable/9/lib/libarchive/test/test_read_format_isojoliet_rr.c stable/9/lib/libarchive/test/test_read_format_isorr_bz2.c stable/9/lib/libarchive/test/test_read_format_isorr_ce.c stable/9/lib/libarchive/test/test_read_format_isorr_new_bz2.c stable/9/lib/libarchive/test/test_read_format_isorr_rr_moved.c stable/9/lib/libarchive/test/test_read_format_isozisofs_bz2.c stable/9/lib/libarchive/test/test_read_format_mtree.c stable/9/lib/libarchive/test/test_read_format_mtree.mtree.uu stable/9/lib/libarchive/test/test_read_format_pax_bz2.c stable/9/lib/libarchive/test/test_read_format_raw.c stable/9/lib/libarchive/test/test_read_format_raw.data.Z.uu stable/9/lib/libarchive/test/test_read_format_raw.data.uu stable/9/lib/libarchive/test/test_read_format_tar.c stable/9/lib/libarchive/test/test_read_format_tar_empty_filename.c stable/9/lib/libarchive/test/test_read_format_tar_empty_filename.tar.uu stable/9/lib/libarchive/test/test_read_format_tbz.c stable/9/lib/libarchive/test/test_read_format_tgz.c stable/9/lib/libarchive/test/test_read_format_tlz.c stable/9/lib/libarchive/test/test_read_format_txz.c stable/9/lib/libarchive/test/test_read_format_tz.c stable/9/lib/libarchive/test/test_read_format_xar.c stable/9/lib/libarchive/test/test_read_format_zip.c stable/9/lib/libarchive/test/test_read_format_zip.zip.uu stable/9/lib/libarchive/test/test_read_large.c stable/9/lib/libarchive/test/test_read_pax_truncated.c stable/9/lib/libarchive/test/test_read_position.c stable/9/lib/libarchive/test/test_read_truncated.c stable/9/lib/libarchive/test/test_read_uu.c stable/9/lib/libarchive/test/test_tar_filenames.c stable/9/lib/libarchive/test/test_tar_large.c stable/9/lib/libarchive/test/test_ustar_filenames.c stable/9/lib/libarchive/test/test_write_compress.c stable/9/lib/libarchive/test/test_write_compress_bzip2.c stable/9/lib/libarchive/test/test_write_compress_gzip.c stable/9/lib/libarchive/test/test_write_compress_lzma.c stable/9/lib/libarchive/test/test_write_compress_program.c stable/9/lib/libarchive/test/test_write_compress_xz.c stable/9/lib/libarchive/test/test_write_disk.c stable/9/lib/libarchive/test/test_write_disk_failures.c stable/9/lib/libarchive/test/test_write_disk_hardlink.c stable/9/lib/libarchive/test/test_write_disk_perms.c stable/9/lib/libarchive/test/test_write_disk_secure.c stable/9/lib/libarchive/test/test_write_disk_sparse.c stable/9/lib/libarchive/test/test_write_disk_symlink.c stable/9/lib/libarchive/test/test_write_disk_times.c stable/9/lib/libarchive/test/test_write_format_ar.c stable/9/lib/libarchive/test/test_write_format_cpio.c stable/9/lib/libarchive/test/test_write_format_cpio_empty.c stable/9/lib/libarchive/test/test_write_format_cpio_newc.c stable/9/lib/libarchive/test/test_write_format_cpio_odc.c stable/9/lib/libarchive/test/test_write_format_mtree.c stable/9/lib/libarchive/test/test_write_format_pax.c stable/9/lib/libarchive/test/test_write_format_shar_empty.c stable/9/lib/libarchive/test/test_write_format_tar.c stable/9/lib/libarchive/test/test_write_format_tar_empty.c stable/9/lib/libarchive/test/test_write_format_tar_ustar.c stable/9/lib/libarchive/test/test_write_format_zip.c stable/9/lib/libarchive/test/test_write_format_zip_empty.c stable/9/lib/libarchive/test/test_write_format_zip_no_compression.c stable/9/lib/libarchive/test/test_write_open_memory.c stable/9/usr.bin/cpio/bsdcpio.1 stable/9/usr.bin/cpio/cmdline.c stable/9/usr.bin/cpio/cpio.c stable/9/usr.bin/cpio/cpio.h stable/9/usr.bin/cpio/cpio_platform.h stable/9/usr.bin/cpio/test/main.c stable/9/usr.bin/cpio/test/test.h stable/9/usr.bin/cpio/test/test_0.c stable/9/usr.bin/cpio/test/test_basic.c stable/9/usr.bin/cpio/test/test_cmdline.c stable/9/usr.bin/cpio/test/test_format_newc.c stable/9/usr.bin/cpio/test/test_gcpio_compat.c stable/9/usr.bin/cpio/test/test_gcpio_compat_ref.bin.uu stable/9/usr.bin/cpio/test/test_gcpio_compat_ref.crc.uu stable/9/usr.bin/cpio/test/test_gcpio_compat_ref.newc.uu stable/9/usr.bin/cpio/test/test_gcpio_compat_ref.ustar.uu stable/9/usr.bin/cpio/test/test_gcpio_compat_ref_nosym.bin.uu stable/9/usr.bin/cpio/test/test_gcpio_compat_ref_nosym.crc.uu stable/9/usr.bin/cpio/test/test_gcpio_compat_ref_nosym.newc.uu stable/9/usr.bin/cpio/test/test_gcpio_compat_ref_nosym.ustar.uu stable/9/usr.bin/cpio/test/test_option_B_upper.c stable/9/usr.bin/cpio/test/test_option_C_upper.c stable/9/usr.bin/cpio/test/test_option_J_upper.c stable/9/usr.bin/cpio/test/test_option_L_upper.c stable/9/usr.bin/cpio/test/test_option_Z_upper.c stable/9/usr.bin/cpio/test/test_option_a.c stable/9/usr.bin/cpio/test/test_option_c.c stable/9/usr.bin/cpio/test/test_option_d.c stable/9/usr.bin/cpio/test/test_option_f.c stable/9/usr.bin/cpio/test/test_option_f.cpio.uu stable/9/usr.bin/cpio/test/test_option_help.c stable/9/usr.bin/cpio/test/test_option_l.c stable/9/usr.bin/cpio/test/test_option_lzma.c stable/9/usr.bin/cpio/test/test_option_m.c stable/9/usr.bin/cpio/test/test_option_m.cpio.uu stable/9/usr.bin/cpio/test/test_option_t.c stable/9/usr.bin/cpio/test/test_option_t.cpio.uu stable/9/usr.bin/cpio/test/test_option_t.stdout.uu stable/9/usr.bin/cpio/test/test_option_tv.stdout.uu stable/9/usr.bin/cpio/test/test_option_u.c stable/9/usr.bin/cpio/test/test_option_version.c stable/9/usr.bin/cpio/test/test_option_y.c stable/9/usr.bin/cpio/test/test_option_z.c stable/9/usr.bin/cpio/test/test_owner_parse.c stable/9/usr.bin/cpio/test/test_passthrough_dotdot.c stable/9/usr.bin/cpio/test/test_passthrough_reverse.c stable/9/usr.bin/cpio/test/test_pathmatch.c stable/9/usr.bin/tar/COPYING stable/9/usr.bin/tar/bsdtar.1 stable/9/usr.bin/tar/bsdtar.c stable/9/usr.bin/tar/bsdtar.h stable/9/usr.bin/tar/bsdtar_platform.h stable/9/usr.bin/tar/cmdline.c stable/9/usr.bin/tar/getdate.c stable/9/usr.bin/tar/read.c stable/9/usr.bin/tar/subst.c stable/9/usr.bin/tar/test/main.c stable/9/usr.bin/tar/test/test.h stable/9/usr.bin/tar/test/test_0.c stable/9/usr.bin/tar/test/test_basic.c stable/9/usr.bin/tar/test/test_copy.c stable/9/usr.bin/tar/test/test_empty_mtree.c stable/9/usr.bin/tar/test/test_getdate.c stable/9/usr.bin/tar/test/test_help.c stable/9/usr.bin/tar/test/test_option_T_upper.c stable/9/usr.bin/tar/test/test_option_q.c stable/9/usr.bin/tar/test/test_option_r.c stable/9/usr.bin/tar/test/test_option_s.c stable/9/usr.bin/tar/test/test_patterns.c stable/9/usr.bin/tar/test/test_patterns_2.tar.uu stable/9/usr.bin/tar/test/test_patterns_3.tar.uu stable/9/usr.bin/tar/test/test_patterns_4.tar.uu stable/9/usr.bin/tar/test/test_stdio.c stable/9/usr.bin/tar/test/test_strip_components.c stable/9/usr.bin/tar/test/test_symlink_dir.c stable/9/usr.bin/tar/test/test_version.c stable/9/usr.bin/tar/tree.c stable/9/usr.bin/tar/tree.h stable/9/usr.bin/tar/util.c stable/9/usr.bin/tar/write.c Modified: stable/9/lib/libarchive/Makefile stable/9/lib/libarchive/test/Makefile stable/9/usr.bin/cpio/Makefile stable/9/usr.bin/cpio/test/Makefile stable/9/usr.bin/tar/Makefile stable/9/usr.bin/tar/test/Makefile Directory Properties: stable/9/lib/libarchive/ (props changed) stable/9/usr.bin/cpio/ (props changed) stable/9/usr.bin/tar/ (props changed) Modified: stable/9/lib/libarchive/Makefile ============================================================================== --- stable/9/lib/libarchive/Makefile Thu Jan 5 12:09:39 2012 (r229594) +++ stable/9/lib/libarchive/Makefile Thu Jan 5 12:52:05 2012 (r229595) @@ -1,6 +1,8 @@ # $FreeBSD$ .include +LIBARCHIVEDIR= ${.CURDIR}/../../contrib/libarchive + LIB= archive DPADD= ${LIBZ} LDADD= -lz @@ -20,7 +22,7 @@ LDADD+= -lbsdxml # It has no real relation to the libarchive version number. SHLIB_MAJOR= 5 -CFLAGS+= -DPLATFORM_CONFIG_H=\"config_freebsd.h\" +CFLAGS+= -DPLATFORM_CONFIG_H=\"${.CURDIR}/config_freebsd.h\" CFLAGS+= -I${.OBJDIR} .if ${MK_OPENSSL} != "no" @@ -32,6 +34,8 @@ DPADD+= ${LIBMD} LDADD+= -lmd .endif +.PATH: ${LIBARCHIVEDIR}/libarchive + # Headers to be installed in /usr/include INCS= archive.h archive_entry.h @@ -273,8 +277,11 @@ MLINKS+= archive_write_disk.3 archive_wr MLINKS+= archive_write_disk.3 archive_write_disk_set_user_lookup.3 MLINKS+= libarchive.3 archive.3 -.PHONY: check test +.PHONY: check test clean-test check test: - cd ${.CURDIR}/test && make test + cd ${.CURDIR}/test && make obj && make test + +clean-test: + cd ${.CURDIR}/test && make clean .include Modified: stable/9/lib/libarchive/test/Makefile ============================================================================== --- stable/9/lib/libarchive/test/Makefile Thu Jan 5 12:09:39 2012 (r229594) +++ stable/9/lib/libarchive/test/Makefile Thu Jan 5 12:52:05 2012 (r229595) @@ -1,8 +1,23 @@ # $FreeBSD$ -# Where to find the libarchive sources -LA_SRCDIR=${.CURDIR}/.. +LIBARCHIVEDIR= ${.CURDIR}/../../../contrib/libarchive +NO_MAN=yes + +PROG=libarchive_test +INTERNALPROG=yes # Don't install this; it's just for testing +DPADD=${LIBBZ2} ${LIBZ} ${LIBMD} ${LIBCRYPTO} ${LIBBSDXML} +LDADD= -L ${.OBJDIR}/.. -larchive +LDADD+= -lz -lbz2 -llzma -lmd -lcrypto -lbsdxml +CFLAGS+= -g +CFLAGS+= -I${.CURDIR}/.. -I${LIBARCHIVEDIR} -I${.OBJDIR} +CFLAGS+= -DHAVE_LIBLZMA=1 -DHAVE_LZMA_H=1 + +# Uncomment to link against dmalloc +#LDADD+= -L/usr/local/lib -ldmalloc +#CFLAGS+= -I/usr/local/include -DUSE_DMALLOC + +.PATH: ${LIBARCHIVEDIR}/libarchive/test TESTS= \ test_acl_basic.c \ test_acl_freebsd.c \ @@ -120,28 +135,14 @@ SRCS= \ main.c \ read_open_memory.c -NO_MAN=yes - -PROG=libarchive_test -INTERNALPROG=yes # Don't install this; it's just for testing -DPADD=${LIBBZ2} ${LIBZ} ${LIBMD} ${LIBCRYPTO} ${LIBBSDXML} -LDADD= -L ${.OBJDIR}/.. -larchive -LDADD+= -lz -lbz2 -llzma -lmd -lcrypto -lbsdxml -CFLAGS+= -g -CFLAGS+= -I${LA_SRCDIR} -I. -CFLAGS+= -DHAVE_LIBLZMA=1 -DHAVE_LZMA_H=1 - -# Uncomment to link against dmalloc -#LDADD+= -L/usr/local/lib -ldmalloc -#CFLAGS+= -I/usr/local/include -DUSE_DMALLOC - # Build libarchive_test and run it. check test: libarchive_test - ./libarchive_test -r ${.CURDIR} + ./libarchive_test -r ${LIBARCHIVEDIR}/libarchive/test # list.h is just a list of all tests, as indicated by DEFINE_TEST macro lines list.h: ${TESTS} Makefile - (cd ${.CURDIR}; cat test_*.c) | grep DEFINE_TEST > list.h + (cd ${LIBARCHIVEDIR}/libarchive/test; cat test_*.c) | \ + grep DEFINE_TEST > ${.OBJDIR}/list.h CLEANFILES += *.out *.o *.core *~ list.h .dirstamp .depend CLEANDIRS += .deps .libs Modified: stable/9/usr.bin/cpio/Makefile ============================================================================== --- stable/9/usr.bin/cpio/Makefile Thu Jan 5 12:09:39 2012 (r229594) +++ stable/9/usr.bin/cpio/Makefile Thu Jan 5 12:52:05 2012 (r229595) @@ -2,17 +2,20 @@ .include +LIBARCHIVEDIR= ${.CURDIR}/../../contrib/libarchive + PROG= bsdcpio BSDCPIO_VERSION_STRING=2.8.5 +.PATH: ${LIBARCHIVEDIR}/cpio SRCS= cpio.c cmdline.c -.PATH: ${.CURDIR}/../../lib/libarchive/libarchive_fe +.PATH: ${LIBARCHIVEDIR}/libarchive_fe SRCS+= err.c line_reader.c matching.c pathmatch.c CFLAGS+= -DBSDCPIO_VERSION_STRING=\"${BSDCPIO_VERSION_STRING}\" -CFLAGS+= -DPLATFORM_CONFIG_H=\"config_freebsd.h\" -CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../../lib/libarchive/libarchive_fe +CFLAGS+= -DPLATFORM_CONFIG_H=\"${.CURDIR}/config_freebsd.h\" +CFLAGS+= -I${LIBARCHIVEDIR}/cpio -I${LIBARCHIVEDIR}/libarchive_fe .ifdef RELEASE_CRUNCH # FreeBSD's installer uses cpio in crunched binaries that are @@ -32,9 +35,12 @@ LDADD+= -lmd SYMLINKS=bsdcpio ${BINDIR}/cpio MLINKS= bsdcpio.1 cpio.1 -.PHONY: check test +.PHONY: check test clean-test check test: $(PROG) bsdcpio.1.gz - cd ${.CURDIR}/test && make clean test + cd ${.CURDIR}/test && make obj && make test + +clean-test: + cd ${.CURDIR}/test && make clean .include Modified: stable/9/usr.bin/cpio/test/Makefile ============================================================================== --- stable/9/usr.bin/cpio/test/Makefile Thu Jan 5 12:09:39 2012 (r229594) +++ stable/9/usr.bin/cpio/test/Makefile Thu Jan 5 12:52:05 2012 (r229595) @@ -1,14 +1,14 @@ # $FreeBSD$ -# Where to find the cpio sources (for the internal unit tests) -CPIO_SRCDIR=${.CURDIR}/.. +LIBARCHIVEDIR= ${.CURDIR}/../../../contrib/libarchive -.PATH: ${CPIO_SRCDIR} +.PATH: ${LIBARCHIVEDIR}/cpio CPIO_SRCS= cmdline.c -.PATH: ${.CURDIR}/../../../lib/libarchive/libarchive_fe +.PATH: ${LIBARCHIVEDIR}/libarchive_fe CPIO_SRCS+= err.c pathmatch.c +.PATH: ${LIBARCHIVEDIR}/cpio/test TESTS= \ test_0.c \ test_basic.c \ @@ -49,29 +49,30 @@ NO_MAN=yes PROG=bsdcpio_test DPADD=${LIBARCHIVE} ${LIBBZ2} ${LIBZ} ${LIBLZMA} -CFLAGS+= -DPLATFORM_CONFIG_H=\"config_freebsd.h\" -CFLAGS+= -I.. +CFLAGS+= -DPLATFORM_CONFIG_H=\"${.CURDIR}/../config_freebsd.h\" +CFLAGS+= -I${.CURDIR}/.. LDADD= -larchive -lz -lbz2 -llzma #CFLAGS+= -static -g -O2 -Wall CFLAGS+= -g -O2 -Wall CFLAGS+= -I${.OBJDIR} -CFLAGS+= -I${CPIO_SRCDIR} -CFLAGS+= -I${.CURDIR}/../../../lib/libarchive/libarchive_fe +CFLAGS+= -I${LIBARCHIVEDIR}/cpio -I${LIBARCHIVEDIR}/libarchive_fe # Uncomment to link against dmalloc #LDADD+= -L/usr/local/lib -ldmalloc #CFLAGS+= -I/usr/local/include -DUSE_DMALLOC check test: bsdcpio_test - ${.OBJDIR}/bsdcpio_test -p ${.OBJDIR}/../bsdcpio -r ${.CURDIR} + ${.OBJDIR}/bsdcpio_test -p ${.OBJDIR}/../bsdcpio \ + -r ${LIBARCHIVEDIR}/cpio/test ${.OBJDIR}/list.h list.h: ${TESTS} Makefile - (cd ${.CURDIR}; cat ${TESTS}) | grep DEFINE_TEST > list.h + (cd ${LIBARCHIVEDIR}/cpio/test; cat ${TESTS}) | \ + grep DEFINE_TEST > ${.OBJDIR}/list.h clean: rm -f ${CLEANFILES} rm -f *~ -chmod -R +w /tmp/bsdcpio_test.* - rm -rf /tmp/bsdcpio_test.* + rm -rf /tmp/bsdcpio_test .include Modified: stable/9/usr.bin/tar/Makefile ============================================================================== --- stable/9/usr.bin/tar/Makefile Thu Jan 5 12:09:39 2012 (r229594) +++ stable/9/usr.bin/tar/Makefile Thu Jan 5 12:52:05 2012 (r229595) @@ -1,8 +1,12 @@ # $FreeBSD$ .include +LIBARCHIVEDIR= ${.CURDIR}/../../contrib/libarchive + PROG= bsdtar BSDTAR_VERSION_STRING=2.8.5 + +.PATH: ${LIBARCHIVEDIR}/tar SRCS= bsdtar.c \ cmdline.c \ getdate.c \ @@ -12,7 +16,7 @@ SRCS= bsdtar.c \ util.c \ write.c -.PATH: ${.CURDIR}/../../lib/libarchive/libarchive_fe +.PATH: ${LIBARCHIVEDIR}/libarchive_fe SRCS+= err.c \ line_reader.c \ matching.c \ @@ -29,15 +33,18 @@ LDADD+= -lmd .endif CFLAGS+= -DBSDTAR_VERSION_STRING=\"${BSDTAR_VERSION_STRING}\" -CFLAGS+= -DPLATFORM_CONFIG_H=\"config_freebsd.h\" -CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../../lib/libarchive -CFLAGS+= -I${.CURDIR}/../../lib/libarchive/libarchive_fe +CFLAGS+= -DPLATFORM_CONFIG_H=\"${.CURDIR}/config_freebsd.h\" +CFLAGS+= -I${LIBARCHIVEDIR}/tar -I${LIBARCHIVEDIR}/libarchive +CFLAGS+= -I${LIBARCHIVEDIR}/libarchive_fe SYMLINKS= bsdtar ${BINDIR}/tar MLINKS= bsdtar.1 tar.1 DEBUG_FLAGS=-g -.PHONY: check test +.PHONY: check test clean-test check test: $(PROG) bsdtar.1.gz - cd ${.CURDIR}/test && make test + cd ${.CURDIR}/test && make obj && make test + +clean-test: + cd ${.CURDIR}/test && make clean .include Modified: stable/9/usr.bin/tar/test/Makefile ============================================================================== --- stable/9/usr.bin/tar/test/Makefile Thu Jan 5 12:09:39 2012 (r229594) +++ stable/9/usr.bin/tar/test/Makefile Thu Jan 5 12:52:05 2012 (r229595) @@ -1,13 +1,13 @@ # $FreeBSD$ -# Where to find the tar sources (for the internal unit tests) -TAR_SRCDIR=${.CURDIR}/.. -.PATH: ${TAR_SRCDIR} +LIBARCHIVEDIR= ${.CURDIR}/../../../contrib/libarchive +.PATH: ${LIBARCHIVEDIR}/tar # Some tar sources are pulled in for white-box tests -TAR_SRCS= \ +TAR_SRCS= \ getdate.c +.PATH: ${LIBARCHIVEDIR}/tar/test TESTS= \ test_0.c \ test_basic.c \ @@ -26,7 +26,7 @@ TESTS= \ test_version.c # Build the test program -SRCS= ${TAR_SRCS} \ +SRCS= ${TAR_SRCS} \ ${TESTS} \ list.h \ main.c @@ -37,24 +37,25 @@ NO_MAN=yes PROG=bsdtar_test DPADD=${LIBARCHIVE} ${LIBBZ2} ${LIBZ} ${LIBLZMA} -CFLAGS+= -DPLATFORM_CONFIG_H=\"config_freebsd.h\" -CFLAGS+= -I.. +CFLAGS+= -DPLATFORM_CONFIG_H=\"${.CURDIR}/../config_freebsd.h\" LDADD= -larchive -lz -lbz2 -llzma CFLAGS+= -static -g -O2 -Wall -CFLAGS+= -I${.OBJDIR} -CFLAGS+= -I${TAR_SRCDIR} +CFLAGS+= -I${.CURDIR}/.. -I${.OBJDIR} +CFLAGS+= -I${LIBARCHIVEDIR}/tar # Uncomment to link against dmalloc #LDADD+= -L/usr/local/lib -ldmalloc #CFLAGS+= -I/usr/local/include -DUSE_DMALLOC check test: bsdtar_test - ./bsdtar_test -p ${.OBJDIR}/../bsdtar -r ${.CURDIR} + ./bsdtar_test -p ${.OBJDIR}/../bsdtar -r ${LIBARCHIVEDIR}/tar/test list.h: ${TESTS} Makefile - (cd ${.CURDIR}; cat ${TESTS}) | grep DEFINE_TEST > list.h + (cd ${LIBARCHIVEDIR}/tar/test; cat ${TESTS}) | \ + grep DEFINE_TEST > ${.OBJDIR}/list.h clean: + rm -f ${CLEANFILES} rm -f *.out rm -f *.o rm -f *.core From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 12:57:15 2012 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 B5DDC106566C; Thu, 5 Jan 2012 12:57:15 +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 9B6238FC0A; Thu, 5 Jan 2012 12:57: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 q05CvFUm036511; Thu, 5 Jan 2012 12:57:15 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05CvFwU036504; Thu, 5 Jan 2012 12:57:15 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201051257.q05CvFwU036504@svn.freebsd.org> From: Martin Matuska Date: Thu, 5 Jan 2012 12:57: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: r229596 - in stable/8: lib/libarchive lib/libarchive/libarchive_fe lib/libarchive/test usr.bin/cpio usr.bin/cpio/test usr.bin/tar usr.bin/tar/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: Thu, 05 Jan 2012 12:57:15 -0000 Author: mm Date: Thu Jan 5 12:57:14 2012 New Revision: 229596 URL: http://svn.freebsd.org/changeset/base/229596 Log: MFC r228797: Use contrib sources for building libarchive, tar and cpio. Make "make test" fully operational. Deleted: stable/8/lib/libarchive/COPYING stable/8/lib/libarchive/README stable/8/lib/libarchive/archive.h stable/8/lib/libarchive/archive_check_magic.c stable/8/lib/libarchive/archive_crc32.h stable/8/lib/libarchive/archive_endian.h stable/8/lib/libarchive/archive_entry.3 stable/8/lib/libarchive/archive_entry.c stable/8/lib/libarchive/archive_entry.h stable/8/lib/libarchive/archive_entry_copy_stat.c stable/8/lib/libarchive/archive_entry_link_resolver.c stable/8/lib/libarchive/archive_entry_private.h stable/8/lib/libarchive/archive_entry_stat.c stable/8/lib/libarchive/archive_entry_strmode.c stable/8/lib/libarchive/archive_entry_xattr.c stable/8/lib/libarchive/archive_hash.h stable/8/lib/libarchive/archive_platform.h stable/8/lib/libarchive/archive_private.h stable/8/lib/libarchive/archive_read.3 stable/8/lib/libarchive/archive_read.c stable/8/lib/libarchive/archive_read_data_into_fd.c stable/8/lib/libarchive/archive_read_disk.3 stable/8/lib/libarchive/archive_read_disk.c stable/8/lib/libarchive/archive_read_disk_entry_from_file.c stable/8/lib/libarchive/archive_read_disk_private.h stable/8/lib/libarchive/archive_read_disk_set_standard_lookup.c stable/8/lib/libarchive/archive_read_extract.c stable/8/lib/libarchive/archive_read_open_fd.c stable/8/lib/libarchive/archive_read_open_file.c stable/8/lib/libarchive/archive_read_open_filename.c stable/8/lib/libarchive/archive_read_open_memory.c stable/8/lib/libarchive/archive_read_private.h stable/8/lib/libarchive/archive_read_support_compression_all.c stable/8/lib/libarchive/archive_read_support_compression_bzip2.c stable/8/lib/libarchive/archive_read_support_compression_compress.c stable/8/lib/libarchive/archive_read_support_compression_gzip.c stable/8/lib/libarchive/archive_read_support_compression_none.c stable/8/lib/libarchive/archive_read_support_compression_program.c stable/8/lib/libarchive/archive_read_support_compression_rpm.c stable/8/lib/libarchive/archive_read_support_compression_uu.c stable/8/lib/libarchive/archive_read_support_compression_xz.c stable/8/lib/libarchive/archive_read_support_format_all.c stable/8/lib/libarchive/archive_read_support_format_ar.c stable/8/lib/libarchive/archive_read_support_format_cpio.c stable/8/lib/libarchive/archive_read_support_format_empty.c stable/8/lib/libarchive/archive_read_support_format_iso9660.c stable/8/lib/libarchive/archive_read_support_format_mtree.c stable/8/lib/libarchive/archive_read_support_format_raw.c stable/8/lib/libarchive/archive_read_support_format_tar.c stable/8/lib/libarchive/archive_read_support_format_xar.c stable/8/lib/libarchive/archive_read_support_format_zip.c stable/8/lib/libarchive/archive_string.c stable/8/lib/libarchive/archive_string.h stable/8/lib/libarchive/archive_string_sprintf.c stable/8/lib/libarchive/archive_util.3 stable/8/lib/libarchive/archive_util.c stable/8/lib/libarchive/archive_virtual.c stable/8/lib/libarchive/archive_write.3 stable/8/lib/libarchive/archive_write.c stable/8/lib/libarchive/archive_write_disk.3 stable/8/lib/libarchive/archive_write_disk.c stable/8/lib/libarchive/archive_write_disk_private.h stable/8/lib/libarchive/archive_write_disk_set_standard_lookup.c stable/8/lib/libarchive/archive_write_open_fd.c stable/8/lib/libarchive/archive_write_open_file.c stable/8/lib/libarchive/archive_write_open_filename.c stable/8/lib/libarchive/archive_write_open_memory.c stable/8/lib/libarchive/archive_write_private.h stable/8/lib/libarchive/archive_write_set_compression_bzip2.c stable/8/lib/libarchive/archive_write_set_compression_compress.c stable/8/lib/libarchive/archive_write_set_compression_gzip.c stable/8/lib/libarchive/archive_write_set_compression_none.c stable/8/lib/libarchive/archive_write_set_compression_program.c stable/8/lib/libarchive/archive_write_set_compression_xz.c stable/8/lib/libarchive/archive_write_set_format.c stable/8/lib/libarchive/archive_write_set_format_ar.c stable/8/lib/libarchive/archive_write_set_format_by_name.c stable/8/lib/libarchive/archive_write_set_format_cpio.c stable/8/lib/libarchive/archive_write_set_format_cpio_newc.c stable/8/lib/libarchive/archive_write_set_format_mtree.c stable/8/lib/libarchive/archive_write_set_format_pax.c stable/8/lib/libarchive/archive_write_set_format_shar.c stable/8/lib/libarchive/archive_write_set_format_ustar.c stable/8/lib/libarchive/archive_write_set_format_zip.c stable/8/lib/libarchive/cpio.5 stable/8/lib/libarchive/filter_fork.c stable/8/lib/libarchive/filter_fork.h stable/8/lib/libarchive/libarchive-formats.5 stable/8/lib/libarchive/libarchive.3 stable/8/lib/libarchive/libarchive_fe/ stable/8/lib/libarchive/libarchive_internals.3 stable/8/lib/libarchive/tar.5 stable/8/lib/libarchive/test/.cvsignore stable/8/lib/libarchive/test/README stable/8/lib/libarchive/test/main.c stable/8/lib/libarchive/test/read_open_memory.c stable/8/lib/libarchive/test/test.h stable/8/lib/libarchive/test/test_acl_basic.c stable/8/lib/libarchive/test/test_acl_freebsd.c stable/8/lib/libarchive/test/test_acl_pax.c stable/8/lib/libarchive/test/test_archive_api_feature.c stable/8/lib/libarchive/test/test_bad_fd.c stable/8/lib/libarchive/test/test_compat_bzip2.c stable/8/lib/libarchive/test/test_compat_bzip2_1.tbz.uu stable/8/lib/libarchive/test/test_compat_bzip2_2.tbz.uu stable/8/lib/libarchive/test/test_compat_cpio.c stable/8/lib/libarchive/test/test_compat_cpio_1.cpio.uu stable/8/lib/libarchive/test/test_compat_gtar.c stable/8/lib/libarchive/test/test_compat_gtar_1.tar.uu stable/8/lib/libarchive/test/test_compat_gzip.c stable/8/lib/libarchive/test/test_compat_gzip_1.tgz.uu stable/8/lib/libarchive/test/test_compat_gzip_2.tgz.uu stable/8/lib/libarchive/test/test_compat_lzma.c stable/8/lib/libarchive/test/test_compat_lzma_1.tlz.uu stable/8/lib/libarchive/test/test_compat_lzma_2.tlz.uu stable/8/lib/libarchive/test/test_compat_lzma_3.tlz.uu stable/8/lib/libarchive/test/test_compat_solaris_tar_acl.c stable/8/lib/libarchive/test/test_compat_solaris_tar_acl.tar.uu stable/8/lib/libarchive/test/test_compat_tar_hardlink.c stable/8/lib/libarchive/test/test_compat_tar_hardlink_1.tar.uu stable/8/lib/libarchive/test/test_compat_xz.c stable/8/lib/libarchive/test/test_compat_xz_1.txz.uu stable/8/lib/libarchive/test/test_compat_zip.c stable/8/lib/libarchive/test/test_compat_zip_1.zip.uu stable/8/lib/libarchive/test/test_compat_zip_2.zip.uu stable/8/lib/libarchive/test/test_empty_write.c stable/8/lib/libarchive/test/test_entry.c stable/8/lib/libarchive/test/test_entry_strmode.c stable/8/lib/libarchive/test/test_extattr_freebsd.c stable/8/lib/libarchive/test/test_fuzz.c stable/8/lib/libarchive/test/test_fuzz_1.iso.Z.uu stable/8/lib/libarchive/test/test_link_resolver.c stable/8/lib/libarchive/test/test_open_failure.c stable/8/lib/libarchive/test/test_open_fd.c stable/8/lib/libarchive/test/test_open_file.c stable/8/lib/libarchive/test/test_open_filename.c stable/8/lib/libarchive/test/test_pax_filename_encoding.c stable/8/lib/libarchive/test/test_pax_filename_encoding.tar.uu stable/8/lib/libarchive/test/test_read_compress_program.c stable/8/lib/libarchive/test/test_read_data_large.c stable/8/lib/libarchive/test/test_read_disk.c stable/8/lib/libarchive/test/test_read_disk_entry_from_file.c stable/8/lib/libarchive/test/test_read_extract.c stable/8/lib/libarchive/test/test_read_file_nonexistent.c stable/8/lib/libarchive/test/test_read_format_ar.ar.uu stable/8/lib/libarchive/test/test_read_format_ar.c stable/8/lib/libarchive/test/test_read_format_cpio_bin.c stable/8/lib/libarchive/test/test_read_format_cpio_bin_Z.c stable/8/lib/libarchive/test/test_read_format_cpio_bin_be.c stable/8/lib/libarchive/test/test_read_format_cpio_bin_be.cpio.uu stable/8/lib/libarchive/test/test_read_format_cpio_bin_bz2.c stable/8/lib/libarchive/test/test_read_format_cpio_bin_gz.c stable/8/lib/libarchive/test/test_read_format_cpio_bin_lzma.c stable/8/lib/libarchive/test/test_read_format_cpio_bin_xz.c stable/8/lib/libarchive/test/test_read_format_cpio_odc.c stable/8/lib/libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.c stable/8/lib/libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.rpm.uu stable/8/lib/libarchive/test/test_read_format_cpio_svr4_gzip.c stable/8/lib/libarchive/test/test_read_format_cpio_svr4_gzip_rpm.c stable/8/lib/libarchive/test/test_read_format_cpio_svr4_gzip_rpm.rpm.uu stable/8/lib/libarchive/test/test_read_format_cpio_svr4c_Z.c stable/8/lib/libarchive/test/test_read_format_empty.c stable/8/lib/libarchive/test/test_read_format_gtar_gz.c stable/8/lib/libarchive/test/test_read_format_gtar_lzma.c stable/8/lib/libarchive/test/test_read_format_gtar_sparse.c stable/8/lib/libarchive/test/test_read_format_gtar_sparse_1_13.tar.uu stable/8/lib/libarchive/test/test_read_format_gtar_sparse_1_17.tar.uu stable/8/lib/libarchive/test/test_read_format_gtar_sparse_1_17_posix00.tar.uu stable/8/lib/libarchive/test/test_read_format_gtar_sparse_1_17_posix01.tar.uu stable/8/lib/libarchive/test/test_read_format_gtar_sparse_1_17_posix10.tar.uu stable/8/lib/libarchive/test/test_read_format_gtar_sparse_1_17_posix10_modified.tar.uu stable/8/lib/libarchive/test/test_read_format_iso.iso.Z.uu stable/8/lib/libarchive/test/test_read_format_iso_2.iso.Z.uu stable/8/lib/libarchive/test/test_read_format_iso_Z.c stable/8/lib/libarchive/test/test_read_format_iso_joliet.iso.Z.uu stable/8/lib/libarchive/test/test_read_format_iso_joliet_long.iso.Z.uu stable/8/lib/libarchive/test/test_read_format_iso_joliet_rockridge.iso.Z.uu stable/8/lib/libarchive/test/test_read_format_iso_multi_extent.c stable/8/lib/libarchive/test/test_read_format_iso_multi_extent.iso.Z.uu stable/8/lib/libarchive/test/test_read_format_iso_rockridge.iso.Z.uu stable/8/lib/libarchive/test/test_read_format_iso_rockridge_ce.iso.Z.uu stable/8/lib/libarchive/test/test_read_format_iso_rockridge_new.iso.Z.uu stable/8/lib/libarchive/test/test_read_format_iso_rockridge_rr_moved.iso.Z.uu stable/8/lib/libarchive/test/test_read_format_iso_zisofs.iso.Z.uu 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_ce.c stable/8/lib/libarchive/test/test_read_format_isorr_new_bz2.c stable/8/lib/libarchive/test/test_read_format_isorr_rr_moved.c stable/8/lib/libarchive/test/test_read_format_isozisofs_bz2.c stable/8/lib/libarchive/test/test_read_format_mtree.c stable/8/lib/libarchive/test/test_read_format_mtree.mtree.uu stable/8/lib/libarchive/test/test_read_format_pax_bz2.c stable/8/lib/libarchive/test/test_read_format_raw.c stable/8/lib/libarchive/test/test_read_format_raw.data.Z.uu stable/8/lib/libarchive/test/test_read_format_raw.data.uu stable/8/lib/libarchive/test/test_read_format_tar.c stable/8/lib/libarchive/test/test_read_format_tar_empty_filename.c stable/8/lib/libarchive/test/test_read_format_tar_empty_filename.tar.uu stable/8/lib/libarchive/test/test_read_format_tbz.c stable/8/lib/libarchive/test/test_read_format_tgz.c stable/8/lib/libarchive/test/test_read_format_tlz.c stable/8/lib/libarchive/test/test_read_format_txz.c stable/8/lib/libarchive/test/test_read_format_tz.c stable/8/lib/libarchive/test/test_read_format_xar.c stable/8/lib/libarchive/test/test_read_format_zip.c stable/8/lib/libarchive/test/test_read_format_zip.zip.uu stable/8/lib/libarchive/test/test_read_large.c stable/8/lib/libarchive/test/test_read_pax_truncated.c stable/8/lib/libarchive/test/test_read_position.c stable/8/lib/libarchive/test/test_read_truncated.c stable/8/lib/libarchive/test/test_read_uu.c stable/8/lib/libarchive/test/test_tar_filenames.c stable/8/lib/libarchive/test/test_tar_large.c stable/8/lib/libarchive/test/test_ustar_filenames.c stable/8/lib/libarchive/test/test_write_compress.c stable/8/lib/libarchive/test/test_write_compress_bzip2.c stable/8/lib/libarchive/test/test_write_compress_gzip.c stable/8/lib/libarchive/test/test_write_compress_lzma.c stable/8/lib/libarchive/test/test_write_compress_program.c stable/8/lib/libarchive/test/test_write_compress_xz.c stable/8/lib/libarchive/test/test_write_disk.c stable/8/lib/libarchive/test/test_write_disk_failures.c stable/8/lib/libarchive/test/test_write_disk_hardlink.c stable/8/lib/libarchive/test/test_write_disk_perms.c stable/8/lib/libarchive/test/test_write_disk_secure.c stable/8/lib/libarchive/test/test_write_disk_sparse.c stable/8/lib/libarchive/test/test_write_disk_symlink.c stable/8/lib/libarchive/test/test_write_disk_times.c stable/8/lib/libarchive/test/test_write_format_ar.c stable/8/lib/libarchive/test/test_write_format_cpio.c stable/8/lib/libarchive/test/test_write_format_cpio_empty.c stable/8/lib/libarchive/test/test_write_format_cpio_newc.c stable/8/lib/libarchive/test/test_write_format_cpio_odc.c stable/8/lib/libarchive/test/test_write_format_mtree.c stable/8/lib/libarchive/test/test_write_format_pax.c stable/8/lib/libarchive/test/test_write_format_shar_empty.c stable/8/lib/libarchive/test/test_write_format_tar.c stable/8/lib/libarchive/test/test_write_format_tar_empty.c stable/8/lib/libarchive/test/test_write_format_tar_ustar.c stable/8/lib/libarchive/test/test_write_format_zip.c stable/8/lib/libarchive/test/test_write_format_zip_empty.c stable/8/lib/libarchive/test/test_write_format_zip_no_compression.c stable/8/lib/libarchive/test/test_write_open_memory.c stable/8/usr.bin/cpio/bsdcpio.1 stable/8/usr.bin/cpio/cmdline.c stable/8/usr.bin/cpio/cpio.c stable/8/usr.bin/cpio/cpio.h stable/8/usr.bin/cpio/cpio_platform.h stable/8/usr.bin/cpio/test/main.c stable/8/usr.bin/cpio/test/test.h stable/8/usr.bin/cpio/test/test_0.c stable/8/usr.bin/cpio/test/test_basic.c stable/8/usr.bin/cpio/test/test_cmdline.c stable/8/usr.bin/cpio/test/test_format_newc.c stable/8/usr.bin/cpio/test/test_gcpio_compat.c stable/8/usr.bin/cpio/test/test_gcpio_compat_ref.bin.uu stable/8/usr.bin/cpio/test/test_gcpio_compat_ref.crc.uu stable/8/usr.bin/cpio/test/test_gcpio_compat_ref.newc.uu stable/8/usr.bin/cpio/test/test_gcpio_compat_ref.ustar.uu stable/8/usr.bin/cpio/test/test_gcpio_compat_ref_nosym.bin.uu stable/8/usr.bin/cpio/test/test_gcpio_compat_ref_nosym.crc.uu stable/8/usr.bin/cpio/test/test_gcpio_compat_ref_nosym.newc.uu stable/8/usr.bin/cpio/test/test_gcpio_compat_ref_nosym.ustar.uu stable/8/usr.bin/cpio/test/test_option_B_upper.c stable/8/usr.bin/cpio/test/test_option_C_upper.c stable/8/usr.bin/cpio/test/test_option_J_upper.c stable/8/usr.bin/cpio/test/test_option_L_upper.c stable/8/usr.bin/cpio/test/test_option_Z_upper.c stable/8/usr.bin/cpio/test/test_option_a.c stable/8/usr.bin/cpio/test/test_option_c.c stable/8/usr.bin/cpio/test/test_option_d.c stable/8/usr.bin/cpio/test/test_option_f.c stable/8/usr.bin/cpio/test/test_option_f.cpio.uu stable/8/usr.bin/cpio/test/test_option_help.c stable/8/usr.bin/cpio/test/test_option_l.c stable/8/usr.bin/cpio/test/test_option_lzma.c stable/8/usr.bin/cpio/test/test_option_m.c stable/8/usr.bin/cpio/test/test_option_m.cpio.uu stable/8/usr.bin/cpio/test/test_option_t.c stable/8/usr.bin/cpio/test/test_option_t.cpio.uu stable/8/usr.bin/cpio/test/test_option_t.stdout.uu stable/8/usr.bin/cpio/test/test_option_tv.stdout.uu stable/8/usr.bin/cpio/test/test_option_u.c stable/8/usr.bin/cpio/test/test_option_version.c stable/8/usr.bin/cpio/test/test_option_y.c stable/8/usr.bin/cpio/test/test_option_z.c stable/8/usr.bin/cpio/test/test_owner_parse.c stable/8/usr.bin/cpio/test/test_passthrough_dotdot.c stable/8/usr.bin/cpio/test/test_passthrough_reverse.c stable/8/usr.bin/cpio/test/test_pathmatch.c stable/8/usr.bin/tar/COPYING stable/8/usr.bin/tar/bsdtar.1 stable/8/usr.bin/tar/bsdtar.c stable/8/usr.bin/tar/bsdtar.h stable/8/usr.bin/tar/bsdtar_platform.h stable/8/usr.bin/tar/cmdline.c stable/8/usr.bin/tar/getdate.c stable/8/usr.bin/tar/read.c stable/8/usr.bin/tar/subst.c stable/8/usr.bin/tar/test/main.c stable/8/usr.bin/tar/test/test.h stable/8/usr.bin/tar/test/test_0.c stable/8/usr.bin/tar/test/test_basic.c stable/8/usr.bin/tar/test/test_copy.c stable/8/usr.bin/tar/test/test_empty_mtree.c stable/8/usr.bin/tar/test/test_getdate.c stable/8/usr.bin/tar/test/test_help.c stable/8/usr.bin/tar/test/test_option_T_upper.c stable/8/usr.bin/tar/test/test_option_q.c stable/8/usr.bin/tar/test/test_option_r.c stable/8/usr.bin/tar/test/test_option_s.c stable/8/usr.bin/tar/test/test_patterns.c stable/8/usr.bin/tar/test/test_patterns_2.tar.uu stable/8/usr.bin/tar/test/test_patterns_3.tar.uu stable/8/usr.bin/tar/test/test_patterns_4.tar.uu stable/8/usr.bin/tar/test/test_stdio.c stable/8/usr.bin/tar/test/test_strip_components.c stable/8/usr.bin/tar/test/test_symlink_dir.c stable/8/usr.bin/tar/test/test_version.c stable/8/usr.bin/tar/tree.c stable/8/usr.bin/tar/tree.h stable/8/usr.bin/tar/util.c stable/8/usr.bin/tar/write.c Modified: stable/8/lib/libarchive/Makefile stable/8/lib/libarchive/test/Makefile stable/8/usr.bin/cpio/Makefile stable/8/usr.bin/cpio/test/Makefile stable/8/usr.bin/tar/Makefile stable/8/usr.bin/tar/test/Makefile Directory Properties: stable/8/lib/libarchive/ (props changed) stable/8/usr.bin/cpio/ (props changed) stable/8/usr.bin/tar/ (props changed) Modified: stable/8/lib/libarchive/Makefile ============================================================================== --- stable/8/lib/libarchive/Makefile Thu Jan 5 12:52:05 2012 (r229595) +++ stable/8/lib/libarchive/Makefile Thu Jan 5 12:57:14 2012 (r229596) @@ -1,6 +1,8 @@ # $FreeBSD$ .include +LIBARCHIVEDIR= ${.CURDIR}/../../contrib/libarchive + LIB= archive DPADD= ${LIBZ} LDADD= -lz @@ -20,7 +22,7 @@ LDADD+= -lbsdxml # It has no real relation to the libarchive version number. SHLIB_MAJOR= 5 -CFLAGS+= -DPLATFORM_CONFIG_H=\"config_freebsd.h\" +CFLAGS+= -DPLATFORM_CONFIG_H=\"${.CURDIR}/config_freebsd.h\" CFLAGS+= -I${.OBJDIR} .if ${MK_OPENSSL} != "no" @@ -32,7 +34,7 @@ DPADD+= ${LIBMD} LDADD+= -lmd .endif -WARNS?= 6 +.PATH: ${LIBARCHIVEDIR}/libarchive # Headers to be installed in /usr/include INCS= archive.h archive_entry.h @@ -275,8 +277,11 @@ MLINKS+= archive_write_disk.3 archive_wr MLINKS+= archive_write_disk.3 archive_write_disk_set_user_lookup.3 MLINKS+= libarchive.3 archive.3 -.PHONY: check test +.PHONY: check test clean-test check test: - cd ${.CURDIR}/test && make test + cd ${.CURDIR}/test && make obj && make test + +clean-test: + cd ${.CURDIR}/test && make clean .include Modified: stable/8/lib/libarchive/test/Makefile ============================================================================== --- stable/8/lib/libarchive/test/Makefile Thu Jan 5 12:52:05 2012 (r229595) +++ stable/8/lib/libarchive/test/Makefile Thu Jan 5 12:57:14 2012 (r229596) @@ -1,8 +1,23 @@ # $FreeBSD$ -# Where to find the libarchive sources -LA_SRCDIR=${.CURDIR}/.. +LIBARCHIVEDIR= ${.CURDIR}/../../../contrib/libarchive +NO_MAN=yes + +PROG=libarchive_test +INTERNALPROG=yes # Don't install this; it's just for testing +DPADD=${LIBBZ2} ${LIBZ} ${LIBMD} ${LIBCRYPTO} ${LIBBSDXML} +LDADD= -L ${.OBJDIR}/.. -larchive +LDADD+= -lz -lbz2 -llzma -lmd -lcrypto -lbsdxml +CFLAGS+= -g +CFLAGS+= -I${.CURDIR}/.. -I${LIBARCHIVEDIR} -I${.OBJDIR} +CFLAGS+= -DHAVE_LIBLZMA=1 -DHAVE_LZMA_H=1 + +# Uncomment to link against dmalloc +#LDADD+= -L/usr/local/lib -ldmalloc +#CFLAGS+= -I/usr/local/include -DUSE_DMALLOC + +.PATH: ${LIBARCHIVEDIR}/libarchive/test TESTS= \ test_acl_basic.c \ test_acl_freebsd.c \ @@ -120,28 +135,14 @@ SRCS= \ main.c \ read_open_memory.c -NO_MAN=yes - -PROG=libarchive_test -INTERNALPROG=yes # Don't install this; it's just for testing -DPADD=${LIBBZ2} ${LIBZ} ${LIBMD} ${LIBCRYPTO} ${LIBBSDXML} -LDADD= -L ${.OBJDIR}/.. -larchive -LDADD+= -lz -lbz2 -llzma -lmd -lcrypto -lbsdxml -CFLAGS+= -g -CFLAGS+= -I${LA_SRCDIR} -I. -CFLAGS+= -DHAVE_LIBLZMA=1 -DHAVE_LZMA_H=1 - -# Uncomment to link against dmalloc -#LDADD+= -L/usr/local/lib -ldmalloc -#CFLAGS+= -I/usr/local/include -DUSE_DMALLOC - # Build libarchive_test and run it. check test: libarchive_test - ./libarchive_test -r ${.CURDIR} + ./libarchive_test -r ${LIBARCHIVEDIR}/libarchive/test # list.h is just a list of all tests, as indicated by DEFINE_TEST macro lines list.h: ${TESTS} Makefile - (cd ${.CURDIR}; cat test_*.c) | grep DEFINE_TEST > list.h + (cd ${LIBARCHIVEDIR}/libarchive/test; cat test_*.c) | \ + grep DEFINE_TEST > ${.OBJDIR}/list.h CLEANFILES += *.out *.o *.core *~ list.h .dirstamp .depend CLEANDIRS += .deps .libs Modified: stable/8/usr.bin/cpio/Makefile ============================================================================== --- stable/8/usr.bin/cpio/Makefile Thu Jan 5 12:52:05 2012 (r229595) +++ stable/8/usr.bin/cpio/Makefile Thu Jan 5 12:57:14 2012 (r229596) @@ -2,19 +2,22 @@ .include +LIBARCHIVEDIR= ${.CURDIR}/../../contrib/libarchive + PROG= bsdcpio BSDCPIO_VERSION_STRING=2.8.5 +.PATH: ${LIBARCHIVEDIR}/cpio SRCS= cpio.c cmdline.c -.PATH: ${.CURDIR}/../../lib/libarchive/libarchive_fe +.PATH: ${LIBARCHIVEDIR}/libarchive_fe SRCS+= err.c line_reader.c matching.c pathmatch.c WARNS?= 6 DPADD= ${LIBARCHIVE} ${LIBZ} ${LIBBZ2} CFLAGS+= -DBSDCPIO_VERSION_STRING=\"${BSDCPIO_VERSION_STRING}\" -CFLAGS+= -DPLATFORM_CONFIG_H=\"config_freebsd.h\" -CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../../lib/libarchive/libarchive_fe +CFLAGS+= -DPLATFORM_CONFIG_H=\"${.CURDIR}/config_freebsd.h\" +CFLAGS+= -I${LIBARCHIVEDIR}/cpio -I${LIBARCHIVEDIR}/libarchive_fe .ifdef RELEASE_CRUNCH # FreeBSD's installer uses cpio in crunched binaries that are @@ -34,9 +37,12 @@ LDADD+= -lmd SYMLINKS=bsdcpio ${BINDIR}/cpio MLINKS= bsdcpio.1 cpio.1 -.PHONY: check test +.PHONY: check test clean-test check test: $(PROG) bsdcpio.1.gz - cd ${.CURDIR}/test && make clean test + cd ${.CURDIR}/test && make obj && make test + +clean-test: + cd ${.CURDIR}/test && make clean .include Modified: stable/8/usr.bin/cpio/test/Makefile ============================================================================== --- stable/8/usr.bin/cpio/test/Makefile Thu Jan 5 12:52:05 2012 (r229595) +++ stable/8/usr.bin/cpio/test/Makefile Thu Jan 5 12:57:14 2012 (r229596) @@ -1,14 +1,14 @@ # $FreeBSD$ -# Where to find the cpio sources (for the internal unit tests) -CPIO_SRCDIR=${.CURDIR}/.. +LIBARCHIVEDIR= ${.CURDIR}/../../../contrib/libarchive -.PATH: ${CPIO_SRCDIR} +.PATH: ${LIBARCHIVEDIR}/cpio CPIO_SRCS= cmdline.c -.PATH: ${.CURDIR}/../../../lib/libarchive/libarchive_fe +.PATH: ${LIBARCHIVEDIR}/libarchive_fe CPIO_SRCS+= err.c pathmatch.c +.PATH: ${LIBARCHIVEDIR}/cpio/test TESTS= \ test_0.c \ test_basic.c \ @@ -49,14 +49,13 @@ NO_MAN=yes PROG=bsdcpio_test DPADD=${LIBARCHIVE} ${LIBBZ2} ${LIBZ} -CFLAGS+= -DPLATFORM_CONFIG_H=\"config_freebsd.h\" -CFLAGS+= -I.. +CFLAGS+= -DPLATFORM_CONFIG_H=\"${.CURDIR}/../config_freebsd.h\" +CFLAGS+= -I${.CURDIR}/.. LDADD= -larchive -lz -lbz2 #CFLAGS+= -static -g -O2 -Wall CFLAGS+= -g -O2 -Wall CFLAGS+= -I${.OBJDIR} -CFLAGS+= -I${CPIO_SRCDIR} -CFLAGS+= -I${.CURDIR}/../../../lib/libarchive/libarchive_fe +CFLAGS+= -I${LIBARCHIVEDIR}/cpio -I${LIBARCHIVEDIR}/libarchive_fe # Uncomment to link against dmalloc #LDADD+= -L/usr/local/lib -ldmalloc @@ -64,15 +63,17 @@ CFLAGS+= -I${.CURDIR}/../../../lib/libar WARNS=6 check test: bsdcpio_test - ${.OBJDIR}/bsdcpio_test -p ${.OBJDIR}/../bsdcpio -r ${.CURDIR} + ${.OBJDIR}/bsdcpio_test -p ${.OBJDIR}/../bsdcpio \ + -r ${LIBARCHIVEDIR}/cpio/test ${.OBJDIR}/list.h list.h: ${TESTS} Makefile - (cd ${.CURDIR}; cat ${TESTS}) | grep DEFINE_TEST > list.h + (cd ${LIBARCHIVEDIR}/cpio/test; cat ${TESTS}) | \ + grep DEFINE_TEST > ${.OBJDIR}/list.h clean: rm -f ${CLEANFILES} rm -f *~ -chmod -R +w /tmp/bsdcpio_test.* - rm -rf /tmp/bsdcpio_test.* + rm -rf /tmp/bsdcpio_test .include Modified: stable/8/usr.bin/tar/Makefile ============================================================================== --- stable/8/usr.bin/tar/Makefile Thu Jan 5 12:52:05 2012 (r229595) +++ stable/8/usr.bin/tar/Makefile Thu Jan 5 12:57:14 2012 (r229596) @@ -1,8 +1,12 @@ # $FreeBSD$ .include +LIBARCHIVEDIR= ${.CURDIR}/../../contrib/libarchive + PROG= bsdtar BSDTAR_VERSION_STRING=2.8.5 + +.PATH: ${LIBARCHIVEDIR}/tar SRCS= bsdtar.c \ cmdline.c \ getdate.c \ @@ -12,7 +16,7 @@ SRCS= bsdtar.c \ util.c \ write.c -.PATH: ${.CURDIR}/../../lib/libarchive/libarchive_fe +.PATH: ${LIBARCHIVEDIR}/libarchive_fe SRCS+= err.c \ line_reader.c \ matching.c \ @@ -30,15 +34,18 @@ LDADD+= -lmd .endif CFLAGS+= -DBSDTAR_VERSION_STRING=\"${BSDTAR_VERSION_STRING}\" -CFLAGS+= -DPLATFORM_CONFIG_H=\"config_freebsd.h\" -CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../../lib/libarchive -CFLAGS+= -I${.CURDIR}/../../lib/libarchive/libarchive_fe +CFLAGS+= -DPLATFORM_CONFIG_H=\"${.CURDIR}/config_freebsd.h\" +CFLAGS+= -I${LIBARCHIVEDIR}/tar -I${LIBARCHIVEDIR}/libarchive +CFLAGS+= -I${LIBARCHIVEDIR}/libarchive_fe SYMLINKS= bsdtar ${BINDIR}/tar MLINKS= bsdtar.1 tar.1 DEBUG_FLAGS=-g -.PHONY: check test +.PHONY: check test clean-test check test: $(PROG) bsdtar.1.gz - cd ${.CURDIR}/test && make test + cd ${.CURDIR}/test && make obj && make test + +clean-test: + cd ${.CURDIR}/test && make clean .include Modified: stable/8/usr.bin/tar/test/Makefile ============================================================================== --- stable/8/usr.bin/tar/test/Makefile Thu Jan 5 12:52:05 2012 (r229595) +++ stable/8/usr.bin/tar/test/Makefile Thu Jan 5 12:57:14 2012 (r229596) @@ -1,13 +1,13 @@ # $FreeBSD$ -# Where to find the tar sources (for the internal unit tests) -TAR_SRCDIR=${.CURDIR}/.. -.PATH: ${TAR_SRCDIR} +LIBARCHIVEDIR= ${.CURDIR}/../../../contrib/libarchive +.PATH: ${LIBARCHIVEDIR}/tar # Some tar sources are pulled in for white-box tests -TAR_SRCS= \ +TAR_SRCS= \ getdate.c +.PATH: ${LIBARCHIVEDIR}/tar/test TESTS= \ test_0.c \ test_basic.c \ @@ -26,7 +26,7 @@ TESTS= \ test_version.c # Build the test program -SRCS= ${TAR_SRCS} \ +SRCS= ${TAR_SRCS} \ ${TESTS} \ list.h \ main.c @@ -37,24 +37,25 @@ NO_MAN=yes PROG=bsdtar_test DPADD=${LIBARCHIVE} ${LIBBZ2} ${LIBZ} -CFLAGS+= -DPLATFORM_CONFIG_H=\"config_freebsd.h\" -CFLAGS+= -I.. +CFLAGS+= -DPLATFORM_CONFIG_H=\"${.CURDIR}/../config_freebsd.h\" LDADD= -larchive -lz -lbz2 CFLAGS+= -static -g -O2 -Wall -CFLAGS+= -I${.OBJDIR} -CFLAGS+= -I${TAR_SRCDIR} +CFLAGS+= -I${.CURDIR}/.. -I${.OBJDIR} +CFLAGS+= -I${LIBARCHIVEDIR}/tar # Uncomment to link against dmalloc #LDADD+= -L/usr/local/lib -ldmalloc #CFLAGS+= -I/usr/local/include -DUSE_DMALLOC check test: bsdtar_test - ./bsdtar_test -p ${.OBJDIR}/../bsdtar -r ${.CURDIR} + ./bsdtar_test -p ${.OBJDIR}/../bsdtar -r ${LIBARCHIVEDIR}/tar/test list.h: ${TESTS} Makefile - (cd ${.CURDIR}; cat ${TESTS}) | grep DEFINE_TEST > list.h + (cd ${LIBARCHIVEDIR}/tar/test; cat ${TESTS}) | \ + grep DEFINE_TEST > ${.OBJDIR}/list.h clean: + rm -f ${CLEANFILES} rm -f *.out rm -f *.o rm -f *.core From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 14:51:43 2012 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 DFF78106566C; Thu, 5 Jan 2012 14:51:43 +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 AEFC38FC15; Thu, 5 Jan 2012 14:51:43 +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 q05EphLe041072; Thu, 5 Jan 2012 14:51:43 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05EphoZ041070; Thu, 5 Jan 2012 14:51:43 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201201051451.q05EphoZ041070@svn.freebsd.org> From: Sergey Kandaurov Date: Thu, 5 Jan 2012 14:51:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229597 - stable/9/lib/libc/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, 05 Jan 2012 14:51:44 -0000 Author: pluknet Date: Thu Jan 5 14:51:43 2012 New Revision: 229597 URL: http://svn.freebsd.org/changeset/base/229597 Log: MFC r228970: Fix manual section for acl_get(3) and mac_get(3) family functions. Modified: stable/9/lib/libc/sys/cap_new.2 Directory Properties: stable/9/lib/libc/ (props changed) stable/9/lib/libc/stdtime/ (props changed) Modified: stable/9/lib/libc/sys/cap_new.2 ============================================================================== --- stable/9/lib/libc/sys/cap_new.2 Thu Jan 5 12:57:14 2012 (r229596) +++ stable/9/lib/libc/sys/cap_new.2 Thu Jan 5 14:51:43 2012 (r229597) @@ -107,17 +107,17 @@ Permit checking of an ACL on a file desc for this system call. .It Dv CAP_ACL_DELETE Permit -.Xr acl_delete_fd_np 2 . +.Xr acl_delete_fd_np 3 . .It Dv CAP_ACL_GET Permit -.Xr acl_get_fd 2 +.Xr acl_get_fd 3 and -.Xr acl_get_fd_np 2 . +.Xr acl_get_fd_np 3 . .It Dv CAP_ACL_SET Permit -.Xr acl_set_fd 2 +.Xr acl_set_fd 3 and -.Xr acl_set_fd_np 2 . +.Xr acl_set_fd_np 3 . .It Dv CAP_BIND Permit .Xr bind 2 . @@ -240,10 +240,10 @@ a global name space; see for details. .It Dv CAP_MAC_GET Permit -.Xr mac_get_fd 2 . +.Xr mac_get_fd 3 . .It Dv CAP_MAC_SET Permit -.Xr mac_set_fd 2 . +.Xr mac_set_fd 3 . .It Dv CAP_MMAP Permit .Xr mmap 2 ; @@ -385,12 +385,8 @@ argument is not a capability. .El .Sh SEE ALSO .Xr accept 2 , -.Xr acl_delete_fd_np 2 , -.Xr acl_get_fd 2 , -.Xr acl_get_fd_np 2 , -.Xr acl_set_fd_np 2 , -.Xr aio_read 2 , .Xr aio_fsync 2 , +.Xr aio_read 2 , .Xr aio_write 2 , .Xr bind 2 , .Xr cap_enter 2 , @@ -421,8 +417,6 @@ argument is not a capability. .Xr kqueue 2 , .Xr linkat 2 , .Xr listen 2 , -.Xr mac_get_fd 2 , -.Xr mac_set_fd 2 , .Xr mmap 2 , .Xr mq_open 2 , .Xr open 2 , @@ -450,8 +444,14 @@ argument is not a capability. .Xr socketpair 2 , .Xr unlinkat 2 , .Xr write 2 , +.Xr acl_delete_fd_np 3 , +.Xr acl_get_fd 3 , +.Xr acl_get_fd_np 3 , +.Xr acl_set_fd_np 3 , .Xr cap_limitfd 3 , .Xr libcapsicum 3 , +.Xr mac_get_fd 3 , +.Xr mac_set_fd 3 , .Xr sem_getvalue 3 , .Xr sem_post 3 , .Xr sem_trywait 3 , From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 16:27:32 2012 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 D6442106564A; Thu, 5 Jan 2012 16:27:32 +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 B9DD48FC13; Thu, 5 Jan 2012 16:27: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 q05GRWe1044216; Thu, 5 Jan 2012 16:27:32 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05GRWC0044213; Thu, 5 Jan 2012 16:27:32 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201051627.q05GRWC0044213@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 16:27: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: r229598 - head/sys/dev/ichwd 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, 05 Jan 2012 16:27:33 -0000 Author: jhb Date: Thu Jan 5 16:27:32 2012 New Revision: 229598 URL: http://svn.freebsd.org/changeset/base/229598 Log: Remove use of explicit bus space tags and handles and use methods that operate on resource objects instead. MFC after: 1 week Modified: head/sys/dev/ichwd/ichwd.c head/sys/dev/ichwd/ichwd.h Modified: head/sys/dev/ichwd/ichwd.c ============================================================================== --- head/sys/dev/ichwd/ichwd.c Thu Jan 5 14:51:43 2012 (r229597) +++ head/sys/dev/ichwd/ichwd.c Thu Jan 5 16:27:32 2012 (r229598) @@ -198,26 +198,26 @@ static struct ichwd_device ichwd_devices static devclass_t ichwd_devclass; #define ichwd_read_tco_1(sc, off) \ - bus_space_read_1((sc)->tco_bst, (sc)->tco_bsh, (off)) + bus_read_1((sc)->tco_res, (off)) #define ichwd_read_tco_2(sc, off) \ - bus_space_read_2((sc)->tco_bst, (sc)->tco_bsh, (off)) + bus_read_2((sc)->tco_res, (off)) #define ichwd_read_tco_4(sc, off) \ - bus_space_read_4((sc)->tco_bst, (sc)->tco_bsh, (off)) + bus_read_4((sc)->tco_res, (off)) #define ichwd_read_smi_4(sc, off) \ - bus_space_read_4((sc)->smi_bst, (sc)->smi_bsh, (off)) + bus_read_4((sc)->smi_res, (off)) #define ichwd_read_gcs_4(sc, off) \ - bus_space_read_4((sc)->gcs_bst, (sc)->gcs_bsh, (off)) + bus_read_4((sc)->gcs_res, (off)) #define ichwd_write_tco_1(sc, off, val) \ - bus_space_write_1((sc)->tco_bst, (sc)->tco_bsh, (off), (val)) + bus_write_1((sc)->tco_res, (off), (val)) #define ichwd_write_tco_2(sc, off, val) \ - bus_space_write_2((sc)->tco_bst, (sc)->tco_bsh, (off), (val)) + bus_write_2((sc)->tco_res, (off), (val)) #define ichwd_write_tco_4(sc, off, val) \ - bus_space_write_4((sc)->tco_bst, (sc)->tco_bsh, (off), (val)) + bus_write_4((sc)->tco_res, (off), (val)) #define ichwd_write_smi_4(sc, off, val) \ - bus_space_write_4((sc)->smi_bst, (sc)->smi_bsh, (off), (val)) + bus_write_4((sc)->smi_res, (off), (val)) #define ichwd_write_gcs_4(sc, off, val) \ - bus_space_write_4((sc)->gcs_bst, (sc)->gcs_bsh, (off), (val)) + bus_write_4((sc)->gcs_res, (off), (val)) #define ichwd_verbose_printf(dev, ...) \ do { \ @@ -519,8 +519,6 @@ ichwd_attach(device_t dev) device_printf(dev, "unable to reserve SMI registers\n"); goto fail; } - sc->smi_bst = rman_get_bustag(sc->smi_res); - sc->smi_bsh = rman_get_bushandle(sc->smi_res); sc->tco_rid = 1; sc->tco_res = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->tco_rid, @@ -530,8 +528,6 @@ ichwd_attach(device_t dev) device_printf(dev, "unable to reserve TCO registers\n"); goto fail; } - sc->tco_bst = rman_get_bustag(sc->tco_res); - sc->tco_bsh = rman_get_bushandle(sc->tco_res); sc->gcs_rid = 0; if (sc->ich_version >= 6) { @@ -541,12 +537,6 @@ ichwd_attach(device_t dev) device_printf(dev, "unable to reserve GCS registers\n"); goto fail; } - sc->gcs_bst = rman_get_bustag(sc->gcs_res); - sc->gcs_bsh = rman_get_bushandle(sc->gcs_res); - } else { - sc->gcs_res = 0; - sc->gcs_bst = 0; - sc->gcs_bsh = 0; } if (ichwd_clear_noreboot(sc) != 0) Modified: head/sys/dev/ichwd/ichwd.h ============================================================================== --- head/sys/dev/ichwd/ichwd.h Thu Jan 5 14:51:43 2012 (r229597) +++ head/sys/dev/ichwd/ichwd.h Thu Jan 5 16:27:32 2012 (r229598) @@ -48,18 +48,12 @@ struct ichwd_softc { int smi_enabled; int smi_rid; struct resource *smi_res; - bus_space_tag_t smi_bst; - bus_space_handle_t smi_bsh; int tco_rid; struct resource *tco_res; - bus_space_tag_t tco_bst; - bus_space_handle_t tco_bsh; int gcs_rid; struct resource *gcs_res; - bus_space_tag_t gcs_bst; - bus_space_handle_t gcs_bsh; eventhandler_tag ev_tag; }; From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 16:43:54 2012 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 C8F7D106566C; Thu, 5 Jan 2012 16:43:54 +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 AD3B68FC14; Thu, 5 Jan 2012 16:43: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 q05Ghsqd044767; Thu, 5 Jan 2012 16:43:54 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05GhsHc044765; Thu, 5 Jan 2012 16:43:54 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201201051643.q05GhsHc044765@svn.freebsd.org> From: Rick Macklem Date: Thu, 5 Jan 2012 16:43:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229599 - stable/9/sys/fs/nfsclient 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, 05 Jan 2012 16:43:55 -0000 Author: rmacklem Date: Thu Jan 5 16:43:54 2012 New Revision: 229599 URL: http://svn.freebsd.org/changeset/base/229599 Log: MFC: r227744 Since the nfscl_cleanup() function isn't used by the FreeBSD NFSv4 client, delete the code and fix up the related comments. This should not have any functional effect on the client. Modified: stable/9/sys/fs/nfsclient/nfs_clstate.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- stable/9/sys/fs/nfsclient/nfs_clstate.c Thu Jan 5 16:27:32 2012 (r229598) +++ stable/9/sys/fs/nfsclient/nfs_clstate.c Thu Jan 5 16:43:54 2012 (r229599) @@ -64,8 +64,8 @@ __FBSDID("$FreeBSD$"); * the granularity of the OpenOwner, then code must be added to * serialize Ops on the OpenOwner.) * - When to get rid of OpenOwners and LockOwners. - * - When a process exits, it calls nfscl_cleanup(), which goes - * through the client list looking for all Open and Lock Owners. + * - The function nfscl_cleanup_common() is executed after a process exits. + * It goes through the client list looking for all Open and Lock Owners. * When one is found, it is marked "defunct" or in the case of * an OpenOwner without any Opens, freed. * The renew thread scans for defunct Owners and gets rid of them, @@ -1630,33 +1630,9 @@ nfscl_expireclient(struct nfsclclient *c } } -#ifndef __FreeBSD__ /* - * Called from exit() upon process termination. - */ -APPLESTATIC void -nfscl_cleanup(NFSPROC_T *p) -{ - struct nfsclclient *clp; - u_int8_t own[NFSV4CL_LOCKNAMELEN]; - - if (!nfscl_inited) - return; - nfscl_filllockowner(p->td_proc, own, F_POSIX); - - NFSLOCKCLSTATE(); - /* - * Loop through all the clientids, looking for the OpenOwners. - */ - LIST_FOREACH(clp, &nfsclhead, nfsc_list) - nfscl_cleanup_common(clp, own); - NFSUNLOCKCLSTATE(); -} -#endif /* !__FreeBSD__ */ - -/* - * Common code used by nfscl_cleanup() and nfscl_cleanupkext(). - * Must be called with CLSTATE lock held. + * This function must be called after the process represented by "own" has + * exited. Must be called with CLSTATE lock held. */ static void nfscl_cleanup_common(struct nfsclclient *clp, u_int8_t *own) @@ -1707,9 +1683,7 @@ nfscl_cleanup_common(struct nfsclclient #if defined(APPLEKEXT) || defined(__FreeBSD__) /* - * Simulate the call nfscl_cleanup() by looking for open owners associated - * with processes that no longer exist, since a call to nfscl_cleanup() - * can't be patched into exit(). + * Find open/lock owners for processes that have exited. */ static void nfscl_cleanupkext(struct nfsclclient *clp) @@ -2556,8 +2530,8 @@ tryagain: #if defined(APPLEKEXT) || defined(__FreeBSD__) /* - * Simulate the calls to nfscl_cleanup() when a process - * exits, since the call can't be patched into exit(). + * Call nfscl_cleanupkext() once per second to check for + * open/lock owners where the process has exited. */ { struct timespec mytime; From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 17:06:05 2012 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 7CAEF106564A; Thu, 5 Jan 2012 17:06:05 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6BD298FC08; Thu, 5 Jan 2012 17:06:05 +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 q05H65oV045517; Thu, 5 Jan 2012 17:06:05 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05H65F2045515; Thu, 5 Jan 2012 17:06:05 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201051706.q05H65F2045515@svn.freebsd.org> From: Dimitry Andric Date: Thu, 5 Jan 2012 17:06: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: r229600 - head/sys/fs/nullfs 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, 05 Jan 2012 17:06:05 -0000 Author: dim Date: Thu Jan 5 17:06:04 2012 New Revision: 229600 URL: http://svn.freebsd.org/changeset/base/229600 Log: In sys/fs/nullfs/null_subr.c, in a KASSERT, output the correct vnode pointer 'lowervp' instead of 'vp', which is uninitialized at that point. Reviewed by: kib MFC after: 1 week Modified: head/sys/fs/nullfs/null_subr.c Modified: head/sys/fs/nullfs/null_subr.c ============================================================================== --- head/sys/fs/nullfs/null_subr.c Thu Jan 5 16:43:54 2012 (r229599) +++ head/sys/fs/nullfs/null_subr.c Thu Jan 5 17:06:04 2012 (r229600) @@ -201,7 +201,7 @@ null_nodeget(mp, lowervp, vpp) int error; ASSERT_VOP_LOCKED(lowervp, "lowervp"); - KASSERT(lowervp->v_usecount >= 1, ("Unreferenced vnode %p\n", vp)); + KASSERT(lowervp->v_usecount >= 1, ("Unreferenced vnode %p\n", lowervp)); /* Lookup the hash firstly */ *vpp = null_hashget(mp, lowervp); From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 17:12:21 2012 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 24C5F1065672; Thu, 5 Jan 2012 17:12:21 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ECD538FC16; Thu, 5 Jan 2012 17:12:20 +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 q05HCKQj045770; Thu, 5 Jan 2012 17:12:20 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05HCK4w045767; Thu, 5 Jan 2012 17:12:20 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201051712.q05HCK4w045767@svn.freebsd.org> From: Dimitry Andric Date: Thu, 5 Jan 2012 17:12:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229601 - in stable/9/sys/dev: ce cp 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, 05 Jan 2012 17:12:21 -0000 Author: dim Date: Thu Jan 5 17:12:20 2012 New Revision: 229601 URL: http://svn.freebsd.org/changeset/base/229601 Log: MFC r228963: Fix clang warnings in sys/dev/ce/if_ce.c and sys/dev/cp/if_cp.c, using jkim's last patch (reviewed by bde) from here: http://docs.freebsd.org/cgi/mid.cgi?201010141558.03154.jkim Modified: stable/9/sys/dev/ce/if_ce.c stable/9/sys/dev/cp/if_cp.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/ce/if_ce.c ============================================================================== --- stable/9/sys/dev/ce/if_ce.c Thu Jan 5 17:06:04 2012 (r229600) +++ stable/9/sys/dev/ce/if_ce.c Thu Jan 5 17:12:20 2012 (r229601) @@ -1313,9 +1313,11 @@ static int ce_ioctl (struct cdev *dev, u IFP2SP(d->ifp)->pp_flags &= ~(PP_FR); IFP2SP(d->ifp)->pp_flags |= PP_KEEPALIVE; d->ifp->if_flags |= PP_CISCO; - } else if (! strcmp ("fr", (char*)data) && PP_FR) { +#if PP_FR != 0 + } else if (! strcmp ("fr", (char*)data)) { d->ifp->if_flags &= ~(PP_CISCO); IFP2SP(d->ifp)->pp_flags |= PP_FR | PP_KEEPALIVE; +#endif } else if (! strcmp ("ppp", (char*)data)) { IFP2SP(d->ifp)->pp_flags &= ~PP_FR; IFP2SP(d->ifp)->pp_flags &= ~PP_KEEPALIVE; Modified: stable/9/sys/dev/cp/if_cp.c ============================================================================== --- stable/9/sys/dev/cp/if_cp.c Thu Jan 5 17:06:04 2012 (r229600) +++ stable/9/sys/dev/cp/if_cp.c Thu Jan 5 17:12:20 2012 (r229601) @@ -1052,9 +1052,11 @@ static int cp_ioctl (struct cdev *dev, u IFP2SP(d->ifp)->pp_flags &= ~(PP_FR); IFP2SP(d->ifp)->pp_flags |= PP_KEEPALIVE; d->ifp->if_flags |= PP_CISCO; - } else if (! strcmp ("fr", (char*)data) && PP_FR) { +#if PP_FR != 0 + } else if (! strcmp ("fr", (char*)data)) { d->ifp->if_flags &= ~(PP_CISCO); IFP2SP(d->ifp)->pp_flags |= PP_FR | PP_KEEPALIVE; +#endif } else if (! strcmp ("ppp", (char*)data)) { IFP2SP(d->ifp)->pp_flags &= ~PP_FR; IFP2SP(d->ifp)->pp_flags &= ~PP_KEEPALIVE; From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 17:14:13 2012 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 BDF05106566C; Thu, 5 Jan 2012 17:14:13 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ABEBE8FC15; Thu, 5 Jan 2012 17:14: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 q05HEDsg045918; Thu, 5 Jan 2012 17:14:13 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05HEDQg045915; Thu, 5 Jan 2012 17:14:13 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201051714.q05HEDQg045915@svn.freebsd.org> From: Dimitry Andric Date: Thu, 5 Jan 2012 17:14:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229602 - in stable/9/sys: conf modules/ce 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, 05 Jan 2012 17:14:13 -0000 Author: dim Date: Thu Jan 5 17:14:13 2012 New Revision: 229602 URL: http://svn.freebsd.org/changeset/base/229602 Log: MFC r228971: For sys/dev/ce/tau32-ddk.c, disable the following warning when building with clang: sys/dev/ce/tau32-ddk.c:1228:37: warning: implicit truncation from 'int' to bitfield changes value from 65532 to 8188 [-Wconstant-conversion] Since this file is obfuscated C, we can never determine (in a sane way, at least :) if this points to a real problem or not. The driver has been in the tree for more than five years, so it most likely isn't. Modified: stable/9/sys/conf/files.i386 stable/9/sys/modules/ce/Makefile Directory Properties: stable/9/sys/ (props changed) stable/9/sys/conf/ (props changed) Modified: stable/9/sys/conf/files.i386 ============================================================================== --- stable/9/sys/conf/files.i386 Thu Jan 5 17:12:20 2012 (r229601) +++ stable/9/sys/conf/files.i386 Thu Jan 5 17:14:13 2012 (r229602) @@ -144,7 +144,8 @@ dev/atkbdc/atkbdc_subr.c optional atkbdc dev/atkbdc/psm.c optional psm atkbdc dev/ce/ceddk.c optional ce dev/ce/if_ce.c optional ce -dev/ce/tau32-ddk.c optional ce +dev/ce/tau32-ddk.c optional ce \ + compile-with "${NORMAL_C} ${NO_WCONSTANT_CONVERSION}" dev/cm/if_cm_isa.c optional cm isa dev/coretemp/coretemp.c optional coretemp dev/cp/cpddk.c optional cp Modified: stable/9/sys/modules/ce/Makefile ============================================================================== --- stable/9/sys/modules/ce/Makefile Thu Jan 5 17:12:20 2012 (r229601) +++ stable/9/sys/modules/ce/Makefile Thu Jan 5 17:14:13 2012 (r229602) @@ -26,3 +26,6 @@ opt_ng_cronyx.h: .endif .include + +CWARNFLAGS.tau32-ddk.c= ${NO_WCONSTANT_CONVERSION} +CWARNFLAGS+= ${CWARNFLAGS.${.IMPSRC:T}} From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 17:20:04 2012 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 04DAD106564A; Thu, 5 Jan 2012 17:20:04 +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 DDBAE8FC13; Thu, 5 Jan 2012 17:20:03 +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 q05HK3Jp046155; Thu, 5 Jan 2012 17:20:03 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05HK34b046154; Thu, 5 Jan 2012 17:20:03 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201201051720.q05HK34b046154@svn.freebsd.org> From: Rick Macklem Date: Thu, 5 Jan 2012 17:20:03 +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: r229603 - stable/8/sys/fs/nfsclient 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, 05 Jan 2012 17:20:04 -0000 Author: rmacklem Date: Thu Jan 5 17:20:03 2012 New Revision: 229603 URL: http://svn.freebsd.org/changeset/base/229603 Log: MFC: r227744 Since the nfscl_cleanup() function isn't used by the FreeBSD NFSv4 client, delete the code and fix up the related comments. This should not have any functional effect on the client. Modified: stable/8/sys/fs/nfsclient/nfs_clstate.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/fs/nfsclient/nfs_clstate.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clstate.c Thu Jan 5 17:14:13 2012 (r229602) +++ stable/8/sys/fs/nfsclient/nfs_clstate.c Thu Jan 5 17:20:03 2012 (r229603) @@ -64,8 +64,8 @@ __FBSDID("$FreeBSD$"); * the granularity of the OpenOwner, then code must be added to * serialize Ops on the OpenOwner.) * - When to get rid of OpenOwners and LockOwners. - * - When a process exits, it calls nfscl_cleanup(), which goes - * through the client list looking for all Open and Lock Owners. + * - The function nfscl_cleanup_common() is executed after a process exits. + * It goes through the client list looking for all Open and Lock Owners. * When one is found, it is marked "defunct" or in the case of * an OpenOwner without any Opens, freed. * The renew thread scans for defunct Owners and gets rid of them, @@ -1630,33 +1630,9 @@ nfscl_expireclient(struct nfsclclient *c } } -#ifndef __FreeBSD__ /* - * Called from exit() upon process termination. - */ -APPLESTATIC void -nfscl_cleanup(NFSPROC_T *p) -{ - struct nfsclclient *clp; - u_int8_t own[NFSV4CL_LOCKNAMELEN]; - - if (!nfscl_inited) - return; - nfscl_filllockowner(p->td_proc, own, F_POSIX); - - NFSLOCKCLSTATE(); - /* - * Loop through all the clientids, looking for the OpenOwners. - */ - LIST_FOREACH(clp, &nfsclhead, nfsc_list) - nfscl_cleanup_common(clp, own); - NFSUNLOCKCLSTATE(); -} -#endif /* !__FreeBSD__ */ - -/* - * Common code used by nfscl_cleanup() and nfscl_cleanupkext(). - * Must be called with CLSTATE lock held. + * This function must be called after the process represented by "own" has + * exited. Must be called with CLSTATE lock held. */ static void nfscl_cleanup_common(struct nfsclclient *clp, u_int8_t *own) @@ -1707,9 +1683,7 @@ nfscl_cleanup_common(struct nfsclclient #if defined(APPLEKEXT) || defined(__FreeBSD__) /* - * Simulate the call nfscl_cleanup() by looking for open owners associated - * with processes that no longer exist, since a call to nfscl_cleanup() - * can't be patched into exit(). + * Find open/lock owners for processes that have exited. */ static void nfscl_cleanupkext(struct nfsclclient *clp) @@ -2556,8 +2530,8 @@ tryagain: #if defined(APPLEKEXT) || defined(__FreeBSD__) /* - * Simulate the calls to nfscl_cleanup() when a process - * exits, since the call can't be patched into exit(). + * Call nfscl_cleanupkext() once per second to check for + * open/lock owners where the process has exited. */ { struct timespec mytime; From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 17:22:33 2012 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 6D597106564A; Thu, 5 Jan 2012 17:22:33 +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 5A6C28FC14; Thu, 5 Jan 2012 17:22:33 +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 q05HMXtp046276; Thu, 5 Jan 2012 17:22:33 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05HMXKh046270; Thu, 5 Jan 2012 17:22:33 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201051722.q05HMXKh046270@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 17:22:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229604 - in stable/9: sbin/mount_nfs sys/fs/nfsclient sys/nfsclient 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, 05 Jan 2012 17:22:33 -0000 Author: jhb Date: Thu Jan 5 17:22:32 2012 New Revision: 229604 URL: http://svn.freebsd.org/changeset/base/229604 Log: MFC 227507: Finish making 'wcommitsize' an NFS client mount option. Modified: stable/9/sbin/mount_nfs/mount_nfs.8 stable/9/sbin/mount_nfs/mount_nfs.c stable/9/sys/fs/nfsclient/nfs_clvfsops.c stable/9/sys/nfsclient/nfs_vfsops.c Directory Properties: stable/9/sbin/mount_nfs/ (props changed) stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sbin/mount_nfs/mount_nfs.8 ============================================================================== --- stable/9/sbin/mount_nfs/mount_nfs.8 Thu Jan 5 17:20:03 2012 (r229603) +++ stable/9/sbin/mount_nfs/mount_nfs.8 Thu Jan 5 17:22:32 2012 (r229604) @@ -318,6 +318,10 @@ tune the timeout interval.) .It Cm udp Use UDP transport. +.It Cm wcommitsize Ns = Ns Aq Ar value +Set the maximum pending write commit size to the specified value. +This determines the maximum amount of pending write data that the NFS +client is willing to cache for each file. .It Cm wsize Ns = Ns Aq Ar value Set the write data size to the specified value. Ditto the comments w.r.t.\& the Modified: stable/9/sbin/mount_nfs/mount_nfs.c ============================================================================== --- stable/9/sbin/mount_nfs/mount_nfs.c Thu Jan 5 17:20:03 2012 (r229603) +++ stable/9/sbin/mount_nfs/mount_nfs.c Thu Jan 5 17:22:32 2012 (r229604) @@ -612,6 +612,13 @@ fallback_mount(struct iovec *iov, int io } args.flags |= NFSMNT_ACDIRMAX; } + if (findopt(iov, iovlen, "wcommitsize", &opt, NULL) == 0) { + ret = sscanf(opt, "%d", &args.wcommitsize); + if (ret != 1 || args.wcommitsize < 0) { + errx(1, "illegal wcommitsize: %s", opt); + } + args.flags |= NFSMNT_WCOMMITSIZE; + } if (findopt(iov, iovlen, "deadthresh", &opt, NULL) == 0) { ret = sscanf(opt, "%d", &args.deadthresh); if (ret != 1 || args.deadthresh <= 0) { Modified: stable/9/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- stable/9/sys/fs/nfsclient/nfs_clvfsops.c Thu Jan 5 17:20:03 2012 (r229603) +++ stable/9/sys/fs/nfsclient/nfs_clvfsops.c Thu Jan 5 17:22:32 2012 (r229604) @@ -715,7 +715,7 @@ static const char *nfs_opts[] = { "from" "retrans", "acregmin", "acregmax", "acdirmin", "acdirmax", "resvport", "readahead", "hostname", "timeout", "addr", "fh", "nfsv3", "sec", "principal", "nfsv4", "gssname", "allgssname", "dirpath", - "negnametimeo", "nocto", + "negnametimeo", "nocto", "wcommitsize", NULL }; /* @@ -949,6 +949,15 @@ nfs_mount(struct mount *mp) } args.flags |= NFSMNT_ACDIRMAX; } + if (vfs_getopt(mp->mnt_optnew, "wcommitsize", (void **)&opt, NULL) == 0) { + ret = sscanf(opt, "%d", &args.wcommitsize); + if (ret != 1 || args.wcommitsize < 0) { + vfs_mount_error(mp, "illegal wcommitsize: %s", opt); + error = EINVAL; + goto out; + } + args.flags |= NFSMNT_WCOMMITSIZE; + } if (vfs_getopt(mp->mnt_optnew, "timeout", (void **)&opt, NULL) == 0) { ret = sscanf(opt, "%d", &args.timeo); if (ret != 1 || args.timeo <= 0) { Modified: stable/9/sys/nfsclient/nfs_vfsops.c ============================================================================== --- stable/9/sys/nfsclient/nfs_vfsops.c Thu Jan 5 17:20:03 2012 (r229603) +++ stable/9/sys/nfsclient/nfs_vfsops.c Thu Jan 5 17:22:32 2012 (r229604) @@ -787,7 +787,7 @@ static const char *nfs_opts[] = { "from" "readahead", "readdirsize", "soft", "hard", "mntudp", "tcp", "udp", "wsize", "rsize", "retrans", "acregmin", "acregmax", "acdirmin", "acdirmax", "deadthresh", "hostname", "timeout", "addr", "fh", "nfsv3", - "sec", "maxgroups", "principal", "negnametimeo", "nocto", + "sec", "maxgroups", "principal", "negnametimeo", "nocto", "wcommitsize", NULL }; /* @@ -1019,6 +1019,15 @@ nfs_mount(struct mount *mp) } args.flags |= NFSMNT_ACDIRMAX; } + if (vfs_getopt(mp->mnt_optnew, "wcommitsize", (void **)&opt, NULL) == 0) { + ret = sscanf(opt, "%d", &args.wcommitsize); + if (ret != 1 || args.wcommitsize < 0) { + vfs_mount_error(mp, "illegal wcommitsize: %s", opt); + error = EINVAL; + goto out; + } + args.flags |= NFSMNT_WCOMMITSIZE; + } if (vfs_getopt(mp->mnt_optnew, "deadthresh", (void **)&opt, NULL) == 0) { ret = sscanf(opt, "%d", &args.deadthresh); if (ret != 1 || args.deadthresh <= 0) { From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 17:28:06 2012 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 58FCD106566C; Thu, 5 Jan 2012 17:28: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 480DD8FC14; Thu, 5 Jan 2012 17: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 q05HS6Gi046483; Thu, 5 Jan 2012 17:28:06 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05HS6vo046481; Thu, 5 Jan 2012 17:28:06 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201201051728.q05HS6vo046481@svn.freebsd.org> From: Adrian Chadd Date: Thu, 5 Jan 2012 17:28: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: r229605 - head/sys/ia64/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: Thu, 05 Jan 2012 17:28:06 -0000 Author: adrian Date: Thu Jan 5 17:28:05 2012 New Revision: 229605 URL: http://svn.freebsd.org/changeset/base/229605 Log: Flip on IEEE80211_SUPPORT_MESH and AH_SUPPORT_AR5416, the wlan and ath modules respectively assume this is set. Pointy hat to: adrian Modified: head/sys/ia64/conf/GENERIC Modified: head/sys/ia64/conf/GENERIC ============================================================================== --- head/sys/ia64/conf/GENERIC Thu Jan 5 17:22:32 2012 (r229604) +++ head/sys/ia64/conf/GENERIC Thu Jan 5 17:28:05 2012 (r229605) @@ -180,6 +180,15 @@ device uslcom # SI Labs CP2101/CP2102 device uvisor # Visor and Palm devices device uvscom # USB serial support for DDI pocket's PHS +# Wireless NIC cards. +# The wlan(4) module assumes this, so just define it so it +# at least correctly loads. +options IEEE80211_SUPPORT_MESH + +# The ath(4) and ath_hal(4) code requires this. The module currently +# builds everything including AR5416 (and later 11n NIC) support. +options AH_SUPPORT_AR5416 + # FireWire support device fwip # IP over FireWire (RFC 2734,3146) # sbp(4) works for some systems but causes boot failure on others From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 17:30:16 2012 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 9D1C91065691; Thu, 5 Jan 2012 17:30:16 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8C1378FC18; Thu, 5 Jan 2012 17:30: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 q05HUGgQ046595; Thu, 5 Jan 2012 17:30:16 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05HUGDE046591; Thu, 5 Jan 2012 17:30:16 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201201051730.q05HUGDE046591@svn.freebsd.org> From: Robert Watson Date: Thu, 5 Jan 2012 17:30: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: r229606 - head/sys/dev/e1000 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, 05 Jan 2012 17:30:16 -0000 Author: rwatson Date: Thu Jan 5 17:30:15 2012 New Revision: 229606 URL: http://svn.freebsd.org/changeset/base/229606 Log: When extracting the VLAN tag from if_em and if_lem receive descriptor rings, copy the whole VLAN tag, not just the VLAN ID. This fixes a problem in which VLAN priority information was dropped when using offloaded VLAN processing with these drivers. Discussed with: jfv, rrs Sponsored by: ADARA Networks, Inc. MFC after: 3 days Modified: head/sys/dev/e1000/if_em.c head/sys/dev/e1000/if_lem.c Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Thu Jan 5 17:28:05 2012 (r229605) +++ head/sys/dev/e1000/if_em.c Thu Jan 5 17:30:15 2012 (r229606) @@ -4480,8 +4480,7 @@ em_rxeof(struct rx_ring *rxr, int count, #endif if (status & E1000_RXD_STAT_VP) { sendmp->m_pkthdr.ether_vtag = - (le16toh(cur->special) & - E1000_RXD_SPC_VLAN_MASK); + le16toh(cur->special); sendmp->m_flags |= M_VLANTAG; } #ifndef __NO_STRICT_ALIGNMENT Modified: head/sys/dev/e1000/if_lem.c ============================================================================== --- head/sys/dev/e1000/if_lem.c Thu Jan 5 17:28:05 2012 (r229605) +++ head/sys/dev/e1000/if_lem.c Thu Jan 5 17:30:15 2012 (r229606) @@ -3591,8 +3591,7 @@ lem_rxeof(struct adapter *adapter, int c #endif if (status & E1000_RXD_STAT_VP) { adapter->fmp->m_pkthdr.ether_vtag = - (le16toh(current_desc->special) & - E1000_RXD_SPC_VLAN_MASK); + le16toh(current_desc->special); adapter->fmp->m_flags |= M_VLANTAG; } #ifndef __NO_STRICT_ALIGNMENT From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 18:21:18 2012 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 5AA1E1065673; Thu, 5 Jan 2012 18:21:18 +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 3E5EE8FC0A; Thu, 5 Jan 2012 18:21:18 +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 q05ILIA3048325; Thu, 5 Jan 2012 18:21:18 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05ILI2N048322; Thu, 5 Jan 2012 18:21:18 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201051821.q05ILI2N048322@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 5 Jan 2012 18:21:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229607 - stable/9/sys/dev/vr 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, 05 Jan 2012 18:21:18 -0000 Author: yongari Date: Thu Jan 5 18:21:17 2012 New Revision: 229607 URL: http://svn.freebsd.org/changeset/base/229607 Log: MFC r228084: Reuse flag variable to represent driver internal states rather than using member variables in softc. While I'm here change media after setting IFF_DRV_RUNNING. This will remove unnecessary link state handling in vr_tick() if controller established a link immediately. Modified: stable/9/sys/dev/vr/if_vr.c stable/9/sys/dev/vr/if_vrreg.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/vr/if_vr.c ============================================================================== --- stable/9/sys/dev/vr/if_vr.c Thu Jan 5 17:30:15 2012 (r229606) +++ stable/9/sys/dev/vr/if_vr.c Thu Jan 5 18:21:17 2012 (r229607) @@ -305,20 +305,20 @@ vr_miibus_statchg(device_t dev) (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) return; - sc->vr_link = 0; + sc->vr_flags &= ~VR_F_LINK; if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == (IFM_ACTIVE | IFM_AVALID)) { switch (IFM_SUBTYPE(mii->mii_media_active)) { case IFM_10_T: case IFM_100_TX: - sc->vr_link = 1; + sc->vr_flags |= VR_F_LINK; break; default: break; } } - if (sc->vr_link != 0) { + if ((sc->vr_flags & VR_F_LINK) != 0) { cr0 = CSR_READ_1(sc, VR_CR0); cr1 = CSR_READ_1(sc, VR_CR1); mfdx = (cr1 & VR_CR1_FULLDUPLEX) != 0; @@ -821,7 +821,7 @@ vr_detach(device_t dev) /* These should only be active if attach succeeded. */ if (device_is_attached(dev)) { VR_LOCK(sc); - sc->vr_detach = 1; + sc->vr_flags |= VR_F_DETACHED; vr_stop(sc); VR_UNLOCK(sc); callout_drain(&sc->vr_stat_callout); @@ -1542,7 +1542,7 @@ vr_tick(void *xsc) mii = device_get_softc(sc->vr_miibus); mii_tick(mii); - if (sc->vr_link == 0) + if ((sc->vr_flags & VR_F_LINK) == 0) vr_miibus_statchg(sc->vr_dev); vr_watchdog(sc); callout_reset(&sc->vr_stat_callout, hz, vr_tick, sc); @@ -1652,7 +1652,7 @@ vr_intr(void *arg) VR_LOCK(sc); - if (sc->vr_suspended != 0) + if ((sc->vr_flags & VR_F_SUSPENDED) != 0) goto done_locked; status = CSR_READ_2(sc, VR_ISR); @@ -1933,7 +1933,7 @@ vr_start_locked(struct ifnet *ifp) VR_LOCK_ASSERT(sc); if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != - IFF_DRV_RUNNING || sc->vr_link == 0) + IFF_DRV_RUNNING || (sc->vr_flags & VR_F_LINK) == 0) return; for (enq = 0; !IFQ_DRV_IS_EMPTY(&ifp->if_snd) && @@ -2103,12 +2103,12 @@ vr_init_locked(struct vr_softc *sc) if (sc->vr_revid > REV_ID_VT6102_A) CSR_WRITE_2(sc, VR_MII_IMR, 0); - sc->vr_link = 0; - mii_mediachg(mii); - ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + sc->vr_flags &= ~VR_F_LINK; + mii_mediachg(mii); + callout_reset(&sc->vr_stat_callout, hz, vr_tick, sc); } @@ -2177,7 +2177,7 @@ vr_ioctl(struct ifnet *ifp, u_long comma (IFF_PROMISC | IFF_ALLMULTI)) vr_set_filter(sc); } else { - if (sc->vr_detach == 0) + if ((sc->vr_flags & VR_F_DETACHED) == 0) vr_init_locked(sc); } } else { @@ -2265,7 +2265,7 @@ vr_watchdog(struct vr_softc *sc) if (sc->vr_cdata.vr_tx_cnt == 0) return; - if (sc->vr_link == 0) { + if ((sc->vr_flags & VR_F_LINK) == 0) { if (bootverbose) if_printf(sc->vr_ifp, "watchdog timeout " "(missed link)\n"); @@ -2443,7 +2443,7 @@ vr_suspend(device_t dev) VR_LOCK(sc); vr_stop(sc); vr_setwol(sc); - sc->vr_suspended = 1; + sc->vr_flags |= VR_F_SUSPENDED; VR_UNLOCK(sc); return (0); @@ -2464,7 +2464,7 @@ vr_resume(device_t dev) if (ifp->if_flags & IFF_UP) vr_init_locked(sc); - sc->vr_suspended = 0; + sc->vr_flags &= ~VR_F_SUSPENDED; VR_UNLOCK(sc); return (0); Modified: stable/9/sys/dev/vr/if_vrreg.h ============================================================================== --- stable/9/sys/dev/vr/if_vrreg.h Thu Jan 5 17:30:15 2012 (r229606) +++ stable/9/sys/dev/vr/if_vrreg.h Thu Jan 5 18:21:17 2012 (r229607) @@ -720,20 +720,20 @@ struct vr_softc { void *vr_intrhand; device_t vr_miibus; uint8_t vr_revid; /* Rhine chip revision */ - uint8_t vr_flags; /* See VR_F_* below */ -#define VR_F_RESTART 0x01 /* Restart unit on next tick */ + int vr_flags; /* See VR_F_* below */ +#define VR_F_RESTART 0x0001 /* Restart unit on next tick */ +#define VR_F_SUSPENDED 0x2000 +#define VR_F_DETACHED 0x4000 +#define VR_F_LINK 0x8000 int vr_if_flags; struct vr_chain_data vr_cdata; struct vr_ring_data vr_rdata; struct vr_statistics vr_stat; struct callout vr_stat_callout; struct mtx vr_mtx; - int vr_suspended; /* if 1, sleeping/detaching */ int vr_quirks; - int vr_link; int vr_watchdog_timer; int vr_txthresh; - int vr_detach; #ifdef DEVICE_POLLING int rxcycles; #endif From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 18:22:49 2012 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 55989106566B; Thu, 5 Jan 2012 18:22:49 +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 38F4D8FC08; Thu, 5 Jan 2012 18:22: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 q05IMnsS048416; Thu, 5 Jan 2012 18:22:49 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05IMnFF048413; Thu, 5 Jan 2012 18:22:49 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201051822.q05IMnFF048413@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 5 Jan 2012 18:22:49 +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: r229608 - stable/8/sys/dev/vr 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, 05 Jan 2012 18:22:49 -0000 Author: yongari Date: Thu Jan 5 18:22:48 2012 New Revision: 229608 URL: http://svn.freebsd.org/changeset/base/229608 Log: MFC r228084: Reuse flag variable to represent driver internal states rather than using member variables in softc. While I'm here change media after setting IFF_DRV_RUNNING. This will remove unnecessary link state handling in vr_tick() if controller established a link immediately. Modified: stable/8/sys/dev/vr/if_vr.c stable/8/sys/dev/vr/if_vrreg.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/vr/if_vr.c ============================================================================== --- stable/8/sys/dev/vr/if_vr.c Thu Jan 5 18:21:17 2012 (r229607) +++ stable/8/sys/dev/vr/if_vr.c Thu Jan 5 18:22:48 2012 (r229608) @@ -309,20 +309,20 @@ vr_miibus_statchg(device_t dev) (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) return; - sc->vr_link = 0; + sc->vr_flags &= ~VR_F_LINK; if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == (IFM_ACTIVE | IFM_AVALID)) { switch (IFM_SUBTYPE(mii->mii_media_active)) { case IFM_10_T: case IFM_100_TX: - sc->vr_link = 1; + sc->vr_flags |= VR_F_LINK; break; default: break; } } - if (sc->vr_link != 0) { + if ((sc->vr_flags & VR_F_LINK) != 0) { cr0 = CSR_READ_1(sc, VR_CR0); cr1 = CSR_READ_1(sc, VR_CR1); mfdx = (cr1 & VR_CR1_FULLDUPLEX) != 0; @@ -825,7 +825,7 @@ vr_detach(device_t dev) /* These should only be active if attach succeeded. */ if (device_is_attached(dev)) { VR_LOCK(sc); - sc->vr_detach = 1; + sc->vr_flags |= VR_F_DETACHED; vr_stop(sc); VR_UNLOCK(sc); callout_drain(&sc->vr_stat_callout); @@ -1546,7 +1546,7 @@ vr_tick(void *xsc) mii = device_get_softc(sc->vr_miibus); mii_tick(mii); - if (sc->vr_link == 0) + if ((sc->vr_flags & VR_F_LINK) == 0) vr_miibus_statchg(sc->vr_dev); vr_watchdog(sc); callout_reset(&sc->vr_stat_callout, hz, vr_tick, sc); @@ -1656,7 +1656,7 @@ vr_intr(void *arg) VR_LOCK(sc); - if (sc->vr_suspended != 0) + if ((sc->vr_flags & VR_F_SUSPENDED) != 0) goto done_locked; status = CSR_READ_2(sc, VR_ISR); @@ -1937,7 +1937,7 @@ vr_start_locked(struct ifnet *ifp) VR_LOCK_ASSERT(sc); if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != - IFF_DRV_RUNNING || sc->vr_link == 0) + IFF_DRV_RUNNING || (sc->vr_flags & VR_F_LINK) == 0) return; for (enq = 0; !IFQ_DRV_IS_EMPTY(&ifp->if_snd) && @@ -2107,12 +2107,12 @@ vr_init_locked(struct vr_softc *sc) if (sc->vr_revid > REV_ID_VT6102_A) CSR_WRITE_2(sc, VR_MII_IMR, 0); - sc->vr_link = 0; - mii_mediachg(mii); - ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + sc->vr_flags &= ~VR_F_LINK; + mii_mediachg(mii); + callout_reset(&sc->vr_stat_callout, hz, vr_tick, sc); } @@ -2181,7 +2181,7 @@ vr_ioctl(struct ifnet *ifp, u_long comma (IFF_PROMISC | IFF_ALLMULTI)) vr_set_filter(sc); } else { - if (sc->vr_detach == 0) + if ((sc->vr_flags & VR_F_DETACHED) == 0) vr_init_locked(sc); } } else { @@ -2269,7 +2269,7 @@ vr_watchdog(struct vr_softc *sc) if (sc->vr_cdata.vr_tx_cnt == 0) return; - if (sc->vr_link == 0) { + if ((sc->vr_flags & VR_F_LINK) == 0) { if (bootverbose) if_printf(sc->vr_ifp, "watchdog timeout " "(missed link)\n"); @@ -2447,7 +2447,7 @@ vr_suspend(device_t dev) VR_LOCK(sc); vr_stop(sc); vr_setwol(sc); - sc->vr_suspended = 1; + sc->vr_flags |= VR_F_SUSPENDED; VR_UNLOCK(sc); return (0); @@ -2468,7 +2468,7 @@ vr_resume(device_t dev) if (ifp->if_flags & IFF_UP) vr_init_locked(sc); - sc->vr_suspended = 0; + sc->vr_flags &= ~VR_F_SUSPENDED; VR_UNLOCK(sc); return (0); Modified: stable/8/sys/dev/vr/if_vrreg.h ============================================================================== --- stable/8/sys/dev/vr/if_vrreg.h Thu Jan 5 18:21:17 2012 (r229607) +++ stable/8/sys/dev/vr/if_vrreg.h Thu Jan 5 18:22:48 2012 (r229608) @@ -720,20 +720,20 @@ struct vr_softc { void *vr_intrhand; device_t vr_miibus; uint8_t vr_revid; /* Rhine chip revision */ - uint8_t vr_flags; /* See VR_F_* below */ -#define VR_F_RESTART 0x01 /* Restart unit on next tick */ + int vr_flags; /* See VR_F_* below */ +#define VR_F_RESTART 0x0001 /* Restart unit on next tick */ +#define VR_F_SUSPENDED 0x2000 +#define VR_F_DETACHED 0x4000 +#define VR_F_LINK 0x8000 int vr_if_flags; struct vr_chain_data vr_cdata; struct vr_ring_data vr_rdata; struct vr_statistics vr_stat; struct callout vr_stat_callout; struct mtx vr_mtx; - int vr_suspended; /* if 1, sleeping/detaching */ int vr_quirks; - int vr_link; int vr_watchdog_timer; int vr_txthresh; - int vr_detach; #ifdef DEVICE_POLLING int rxcycles; #endif From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 18:24:03 2012 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 4EF3F1065672; Thu, 5 Jan 2012 18:24:03 +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 33EFD8FC14; Thu, 5 Jan 2012 18:24:03 +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 q05IO3xS048491; Thu, 5 Jan 2012 18:24:03 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05IO2cu048488; Thu, 5 Jan 2012 18:24:02 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201051824.q05IO2cu048488@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 5 Jan 2012 18:24:02 +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: r229609 - stable/7/sys/dev/vr 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, 05 Jan 2012 18:24:03 -0000 Author: yongari Date: Thu Jan 5 18:24:02 2012 New Revision: 229609 URL: http://svn.freebsd.org/changeset/base/229609 Log: MFC r228084: Reuse flag variable to represent driver internal states rather than using member variables in softc. While I'm here change media after setting IFF_DRV_RUNNING. This will remove unnecessary link state handling in vr_tick() if controller established a link immediately. Modified: stable/7/sys/dev/vr/if_vr.c stable/7/sys/dev/vr/if_vrreg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/vr/if_vr.c ============================================================================== --- stable/7/sys/dev/vr/if_vr.c Thu Jan 5 18:22:48 2012 (r229608) +++ stable/7/sys/dev/vr/if_vr.c Thu Jan 5 18:24:02 2012 (r229609) @@ -309,20 +309,20 @@ vr_miibus_statchg(device_t dev) (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) return; - sc->vr_link = 0; + sc->vr_flags &= ~VR_F_LINK; if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == (IFM_ACTIVE | IFM_AVALID)) { switch (IFM_SUBTYPE(mii->mii_media_active)) { case IFM_10_T: case IFM_100_TX: - sc->vr_link = 1; + sc->vr_flags |= VR_F_LINK; break; default: break; } } - if (sc->vr_link != 0) { + if ((sc->vr_flags & VR_F_LINK) != 0) { cr0 = CSR_READ_1(sc, VR_CR0); cr1 = CSR_READ_1(sc, VR_CR1); mfdx = (cr1 & VR_CR1_FULLDUPLEX) != 0; @@ -825,7 +825,7 @@ vr_detach(device_t dev) /* These should only be active if attach succeeded. */ if (device_is_attached(dev)) { VR_LOCK(sc); - sc->vr_detach = 1; + sc->vr_flags |= VR_F_DETACHED; vr_stop(sc); VR_UNLOCK(sc); callout_drain(&sc->vr_stat_callout); @@ -1543,7 +1543,7 @@ vr_tick(void *xsc) mii = device_get_softc(sc->vr_miibus); mii_tick(mii); - if (sc->vr_link == 0) + if ((sc->vr_flags & VR_F_LINK) == 0) vr_miibus_statchg(sc->vr_dev); vr_watchdog(sc); callout_reset(&sc->vr_stat_callout, hz, vr_tick, sc); @@ -1648,7 +1648,7 @@ vr_intr(void *arg) VR_LOCK(sc); - if (sc->vr_suspended != 0) + if ((sc->vr_flags & VR_F_SUSPENDED) != 0) goto done_locked; status = CSR_READ_2(sc, VR_ISR); @@ -1929,7 +1929,7 @@ vr_start_locked(struct ifnet *ifp) VR_LOCK_ASSERT(sc); if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != - IFF_DRV_RUNNING || sc->vr_link == 0) + IFF_DRV_RUNNING || (sc->vr_flags & VR_F_LINK) == 0) return; for (enq = 0; !IFQ_DRV_IS_EMPTY(&ifp->if_snd) && @@ -2099,12 +2099,12 @@ vr_init_locked(struct vr_softc *sc) if (sc->vr_revid > REV_ID_VT6102_A) CSR_WRITE_2(sc, VR_MII_IMR, 0); - sc->vr_link = 0; - mii_mediachg(mii); - ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + sc->vr_flags &= ~VR_F_LINK; + mii_mediachg(mii); + callout_reset(&sc->vr_stat_callout, hz, vr_tick, sc); } @@ -2173,7 +2173,7 @@ vr_ioctl(struct ifnet *ifp, u_long comma (IFF_PROMISC | IFF_ALLMULTI)) vr_set_filter(sc); } else { - if (sc->vr_detach == 0) + if ((sc->vr_flags & VR_F_DETACHED) == 0) vr_init_locked(sc); } } else { @@ -2261,7 +2261,7 @@ vr_watchdog(struct vr_softc *sc) if (sc->vr_cdata.vr_tx_cnt == 0) return; - if (sc->vr_link == 0) { + if ((sc->vr_flags & VR_F_LINK) == 0) { if (bootverbose) if_printf(sc->vr_ifp, "watchdog timeout " "(missed link)\n"); @@ -2439,7 +2439,7 @@ vr_suspend(device_t dev) VR_LOCK(sc); vr_stop(sc); vr_setwol(sc); - sc->vr_suspended = 1; + sc->vr_flags |= VR_F_SUSPENDED; VR_UNLOCK(sc); return (0); @@ -2460,7 +2460,7 @@ vr_resume(device_t dev) if (ifp->if_flags & IFF_UP) vr_init_locked(sc); - sc->vr_suspended = 0; + sc->vr_flags &= ~VR_F_SUSPENDED; VR_UNLOCK(sc); return (0); Modified: stable/7/sys/dev/vr/if_vrreg.h ============================================================================== --- stable/7/sys/dev/vr/if_vrreg.h Thu Jan 5 18:22:48 2012 (r229608) +++ stable/7/sys/dev/vr/if_vrreg.h Thu Jan 5 18:24:02 2012 (r229609) @@ -720,20 +720,20 @@ struct vr_softc { void *vr_intrhand; device_t vr_miibus; uint8_t vr_revid; /* Rhine chip revision */ - uint8_t vr_flags; /* See VR_F_* below */ -#define VR_F_RESTART 0x01 /* Restart unit on next tick */ + int vr_flags; /* See VR_F_* below */ +#define VR_F_RESTART 0x0001 /* Restart unit on next tick */ +#define VR_F_SUSPENDED 0x2000 +#define VR_F_DETACHED 0x4000 +#define VR_F_LINK 0x8000 int vr_if_flags; struct vr_chain_data vr_cdata; struct vr_ring_data vr_rdata; struct vr_statistics vr_stat; struct callout vr_stat_callout; struct mtx vr_mtx; - int vr_suspended; /* if 1, sleeping/detaching */ int vr_quirks; - int vr_link; int vr_watchdog_timer; int vr_txthresh; - int vr_detach; #ifdef DEVICE_POLLING int rxcycles; #endif From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 18:26:44 2012 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 CBE2F106568E; Thu, 5 Jan 2012 18:26:44 +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 AF89B8FC27; Thu, 5 Jan 2012 18:26: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 q05IQixw048648; Thu, 5 Jan 2012 18:26:44 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05IQiqL048643; Thu, 5 Jan 2012 18:26:44 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201051826.q05IQiqL048643@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 18:26:44 +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: r229610 - in stable/8: sbin/mount_nfs sys/fs/nfsclient sys/nfsclient 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, 05 Jan 2012 18:26:44 -0000 Author: jhb Date: Thu Jan 5 18:26:44 2012 New Revision: 229610 URL: http://svn.freebsd.org/changeset/base/229610 Log: MFC 227507: Finish making 'wcommitsize' an NFS client mount option. Modified: stable/8/sbin/mount_nfs/mount_nfs.8 stable/8/sbin/mount_nfs/mount_nfs.c stable/8/sys/fs/nfsclient/nfs_clvfsops.c stable/8/sys/nfsclient/nfs_vfsops.c Directory Properties: stable/8/sbin/mount_nfs/ (props changed) 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/sbin/mount_nfs/mount_nfs.8 ============================================================================== --- stable/8/sbin/mount_nfs/mount_nfs.8 Thu Jan 5 18:24:02 2012 (r229609) +++ stable/8/sbin/mount_nfs/mount_nfs.8 Thu Jan 5 18:26:44 2012 (r229610) @@ -314,6 +314,10 @@ tune the timeout interval.) .It Cm udp Use UDP transport. +.It Cm wcommitsize Ns = Ns Aq Ar value +Set the maximum pending write commit size to the specified value. +This determines the maximum amount of pending write data that the NFS +client is willing to cache for each file. .It Cm wsize Ns = Ns Aq Ar value Set the write data size to the specified value. Ditto the comments w.r.t.\& the Modified: stable/8/sbin/mount_nfs/mount_nfs.c ============================================================================== --- stable/8/sbin/mount_nfs/mount_nfs.c Thu Jan 5 18:24:02 2012 (r229609) +++ stable/8/sbin/mount_nfs/mount_nfs.c Thu Jan 5 18:26:44 2012 (r229610) @@ -616,6 +616,13 @@ fallback_mount(struct iovec *iov, int io } args.flags |= NFSMNT_ACDIRMAX; } + if (findopt(iov, iovlen, "wcommitsize", &opt, NULL) == 0) { + ret = sscanf(opt, "%d", &args.wcommitsize); + if (ret != 1 || args.wcommitsize < 0) { + errx(1, "illegal wcommitsize: %s", opt); + } + args.flags |= NFSMNT_WCOMMITSIZE; + } if (findopt(iov, iovlen, "deadthresh", &opt, NULL) == 0) { ret = sscanf(opt, "%d", &args.deadthresh); if (ret != 1 || args.deadthresh <= 0) { Modified: stable/8/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clvfsops.c Thu Jan 5 18:24:02 2012 (r229609) +++ stable/8/sys/fs/nfsclient/nfs_clvfsops.c Thu Jan 5 18:26:44 2012 (r229610) @@ -711,7 +711,7 @@ static const char *nfs_opts[] = { "from" "retrans", "acregmin", "acregmax", "acdirmin", "acdirmax", "resvport", "readahead", "hostname", "timeout", "addr", "fh", "nfsv3", "sec", "principal", "nfsv4", "gssname", "allgssname", "dirpath", - "negnametimeo", "nocto", + "negnametimeo", "nocto", "wcommitsize", NULL }; /* @@ -945,6 +945,15 @@ nfs_mount(struct mount *mp) } args.flags |= NFSMNT_ACDIRMAX; } + if (vfs_getopt(mp->mnt_optnew, "wcommitsize", (void **)&opt, NULL) == 0) { + ret = sscanf(opt, "%d", &args.wcommitsize); + if (ret != 1 || args.wcommitsize < 0) { + vfs_mount_error(mp, "illegal wcommitsize: %s", opt); + error = EINVAL; + goto out; + } + args.flags |= NFSMNT_WCOMMITSIZE; + } if (vfs_getopt(mp->mnt_optnew, "timeout", (void **)&opt, NULL) == 0) { ret = sscanf(opt, "%d", &args.timeo); if (ret != 1 || args.timeo <= 0) { Modified: stable/8/sys/nfsclient/nfs_vfsops.c ============================================================================== --- stable/8/sys/nfsclient/nfs_vfsops.c Thu Jan 5 18:24:02 2012 (r229609) +++ stable/8/sys/nfsclient/nfs_vfsops.c Thu Jan 5 18:26:44 2012 (r229610) @@ -785,7 +785,7 @@ static const char *nfs_opts[] = { "from" "readahead", "readdirsize", "soft", "hard", "mntudp", "tcp", "udp", "wsize", "rsize", "retrans", "acregmin", "acregmax", "acdirmin", "acdirmax", "deadthresh", "hostname", "timeout", "addr", "fh", "nfsv3", - "sec", "maxgroups", "principal", "negnametimeo", "nocto", + "sec", "maxgroups", "principal", "negnametimeo", "nocto", "wcommitsize", NULL }; /* @@ -1017,6 +1017,15 @@ nfs_mount(struct mount *mp) } args.flags |= NFSMNT_ACDIRMAX; } + if (vfs_getopt(mp->mnt_optnew, "wcommitsize", (void **)&opt, NULL) == 0) { + ret = sscanf(opt, "%d", &args.wcommitsize); + if (ret != 1 || args.wcommitsize < 0) { + vfs_mount_error(mp, "illegal wcommitsize: %s", opt); + error = EINVAL; + goto out; + } + args.flags |= NFSMNT_WCOMMITSIZE; + } if (vfs_getopt(mp->mnt_optnew, "deadthresh", (void **)&opt, NULL) == 0) { ret = sscanf(opt, "%d", &args.deadthresh); if (ret != 1 || args.deadthresh <= 0) { From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 18:30:49 2012 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 40C091065670; Thu, 5 Jan 2012 18:30:49 +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 2EC308FC1A; Thu, 5 Jan 2012 18:30: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 q05IUnO6048854; Thu, 5 Jan 2012 18:30:49 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05IUmd9048848; Thu, 5 Jan 2012 18:30:48 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201051830.q05IUmd9048848@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 18:30:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229611 - stable/9/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: Thu, 05 Jan 2012 18:30:49 -0000 Author: jhb Date: Thu Jan 5 18:30:48 2012 New Revision: 229611 URL: http://svn.freebsd.org/changeset/base/229611 Log: MFC 227562: Add single-message MSI support to mfi(4). It is disabled by default but can be enabled via the hw.mfi.msi tunable. Many mfi(4) controllers also support MSI-X, but in testing it seems that many adapters do not work with MSI-X but do work with MSI. Modified: stable/9/sys/dev/mfi/mfi.c stable/9/sys/dev/mfi/mfi_cam.c stable/9/sys/dev/mfi/mfi_disk.c stable/9/sys/dev/mfi/mfi_pci.c stable/9/sys/dev/mfi/mfivar.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/mfi/mfi.c ============================================================================== --- stable/9/sys/dev/mfi/mfi.c Thu Jan 5 18:26:44 2012 (r229610) +++ stable/9/sys/dev/mfi/mfi.c Thu Jan 5 18:30:48 2012 (r229611) @@ -484,15 +484,8 @@ mfi_attach(struct mfi_softc *sc) mtx_unlock(&sc->mfi_io_lock); /* - * Set up the interrupt handler. XXX This should happen in - * mfi_pci.c + * Set up the interrupt handler. */ - sc->mfi_irq_rid = 0; - if ((sc->mfi_irq = bus_alloc_resource_any(sc->mfi_dev, SYS_RES_IRQ, - &sc->mfi_irq_rid, RF_SHAREABLE | RF_ACTIVE)) == NULL) { - device_printf(sc->mfi_dev, "Cannot allocate interrupt\n"); - return (EINVAL); - } if (bus_setup_intr(sc->mfi_dev, sc->mfi_irq, INTR_MPSAFE|INTR_TYPE_BIO, NULL, mfi_intr, sc, &sc->mfi_intr)) { device_printf(sc->mfi_dev, "Cannot set up interrupt\n"); Modified: stable/9/sys/dev/mfi/mfi_cam.c ============================================================================== --- stable/9/sys/dev/mfi/mfi_cam.c Thu Jan 5 18:26:44 2012 (r229610) +++ stable/9/sys/dev/mfi/mfi_cam.c Thu Jan 5 18:30:48 2012 (r229611) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: stable/9/sys/dev/mfi/mfi_disk.c ============================================================================== --- stable/9/sys/dev/mfi/mfi_disk.c Thu Jan 5 18:26:44 2012 (r229610) +++ stable/9/sys/dev/mfi/mfi_disk.c Thu Jan 5 18:30:48 2012 (r229611) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: stable/9/sys/dev/mfi/mfi_pci.c ============================================================================== --- stable/9/sys/dev/mfi/mfi_pci.c Thu Jan 5 18:26:44 2012 (r229610) +++ stable/9/sys/dev/mfi/mfi_pci.c Thu Jan 5 18:30:48 2012 (r229611) @@ -66,6 +66,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -106,6 +107,11 @@ static devclass_t mfi_devclass; DRIVER_MODULE(mfi, pci, mfi_pci_driver, mfi_devclass, 0, 0); MODULE_VERSION(mfi, 1); +static int mfi_msi = 0; +TUNABLE_INT("hw.mfi.msi", &mfi_msi); +SYSCTL_INT(_hw_mfi, OID_AUTO, msi, CTLFLAG_RDTUN, &mfi_msi, 0, + "Enable use of MSI interrupts"); + struct mfi_ident { uint16_t vendor; uint16_t device; @@ -168,7 +174,7 @@ mfi_pci_attach(device_t dev) struct mfi_softc *sc; struct mfi_ident *m; uint32_t command; - int error; + int count, error; sc = device_get_softc(dev); bzero(sc, sizeof(*sc)); @@ -225,6 +231,20 @@ mfi_pci_attach(device_t dev) goto out; } + /* Allocate IRQ resource. */ + sc->mfi_irq_rid = 0; + count = 1; + if (mfi_msi && pci_alloc_msi(sc->mfi_dev, &count) == 0) { + device_printf(sc->mfi_dev, "Using MSI\n"); + sc->mfi_irq_rid = 1; + } + if ((sc->mfi_irq = bus_alloc_resource_any(sc->mfi_dev, SYS_RES_IRQ, + &sc->mfi_irq_rid, RF_SHAREABLE | RF_ACTIVE)) == NULL) { + device_printf(sc->mfi_dev, "Cannot allocate interrupt\n"); + error = EINVAL; + goto out; + } + error = mfi_attach(sc); out: if (error) { @@ -279,6 +299,8 @@ mfi_pci_free(struct mfi_softc *sc) bus_release_resource(sc->mfi_dev, SYS_RES_MEMORY, sc->mfi_regs_rid, sc->mfi_regs_resource); } + if (sc->mfi_irq_rid != 0) + pci_release_msi(sc->mfi_dev); return; } Modified: stable/9/sys/dev/mfi/mfivar.h ============================================================================== --- stable/9/sys/dev/mfi/mfivar.h Thu Jan 5 18:26:44 2012 (r229610) +++ stable/9/sys/dev/mfi/mfivar.h Thu Jan 5 18:30:48 2012 (r229611) @@ -395,6 +395,7 @@ mfi_print_sense(struct mfi_softc *sc, vo (sc)->mfi_bhandle, (reg)) MALLOC_DECLARE(M_MFIBUF); +SYSCTL_DECL(_hw_mfi); #define MFI_CMD_TIMEOUT 30 #define MFI_MAXPHYS (128 * 1024) From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 18:31:09 2012 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 1CCBA106566B; Thu, 5 Jan 2012 18:31:09 +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 0AA378FC0C; Thu, 5 Jan 2012 18:31:09 +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 q05IV8fT048907; Thu, 5 Jan 2012 18:31:08 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05IV8MN048901; Thu, 5 Jan 2012 18:31:08 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201051831.q05IV8MN048901@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 18:31:08 +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: r229612 - stable/8/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: Thu, 05 Jan 2012 18:31:09 -0000 Author: jhb Date: Thu Jan 5 18:31:08 2012 New Revision: 229612 URL: http://svn.freebsd.org/changeset/base/229612 Log: MFC 227562: Add single-message MSI support to mfi(4). It is disabled by default but can be enabled via the hw.mfi.msi tunable. Many mfi(4) controllers also support MSI-X, but in testing it seems that many adapters do not work with MSI-X but do work with MSI. Modified: stable/8/sys/dev/mfi/mfi.c stable/8/sys/dev/mfi/mfi_cam.c stable/8/sys/dev/mfi/mfi_disk.c stable/8/sys/dev/mfi/mfi_pci.c stable/8/sys/dev/mfi/mfivar.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/mfi/mfi.c ============================================================================== --- stable/8/sys/dev/mfi/mfi.c Thu Jan 5 18:30:48 2012 (r229611) +++ stable/8/sys/dev/mfi/mfi.c Thu Jan 5 18:31:08 2012 (r229612) @@ -484,15 +484,8 @@ mfi_attach(struct mfi_softc *sc) mtx_unlock(&sc->mfi_io_lock); /* - * Set up the interrupt handler. XXX This should happen in - * mfi_pci.c + * Set up the interrupt handler. */ - sc->mfi_irq_rid = 0; - if ((sc->mfi_irq = bus_alloc_resource_any(sc->mfi_dev, SYS_RES_IRQ, - &sc->mfi_irq_rid, RF_SHAREABLE | RF_ACTIVE)) == NULL) { - device_printf(sc->mfi_dev, "Cannot allocate interrupt\n"); - return (EINVAL); - } if (bus_setup_intr(sc->mfi_dev, sc->mfi_irq, INTR_MPSAFE|INTR_TYPE_BIO, NULL, mfi_intr, sc, &sc->mfi_intr)) { device_printf(sc->mfi_dev, "Cannot set up interrupt\n"); Modified: stable/8/sys/dev/mfi/mfi_cam.c ============================================================================== --- stable/8/sys/dev/mfi/mfi_cam.c Thu Jan 5 18:30:48 2012 (r229611) +++ stable/8/sys/dev/mfi/mfi_cam.c Thu Jan 5 18:31:08 2012 (r229612) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: stable/8/sys/dev/mfi/mfi_disk.c ============================================================================== --- stable/8/sys/dev/mfi/mfi_disk.c Thu Jan 5 18:30:48 2012 (r229611) +++ stable/8/sys/dev/mfi/mfi_disk.c Thu Jan 5 18:31:08 2012 (r229612) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: stable/8/sys/dev/mfi/mfi_pci.c ============================================================================== --- stable/8/sys/dev/mfi/mfi_pci.c Thu Jan 5 18:30:48 2012 (r229611) +++ stable/8/sys/dev/mfi/mfi_pci.c Thu Jan 5 18:31:08 2012 (r229612) @@ -66,6 +66,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -107,6 +108,11 @@ static devclass_t mfi_devclass; DRIVER_MODULE(mfi, pci, mfi_pci_driver, mfi_devclass, 0, 0); MODULE_VERSION(mfi, 1); +static int mfi_msi = 0; +TUNABLE_INT("hw.mfi.msi", &mfi_msi); +SYSCTL_INT(_hw_mfi, OID_AUTO, msi, CTLFLAG_RDTUN, &mfi_msi, 0, + "Enable use of MSI interrupts"); + struct mfi_ident { uint16_t vendor; uint16_t device; @@ -169,7 +175,7 @@ mfi_pci_attach(device_t dev) struct mfi_softc *sc; struct mfi_ident *m; uint32_t command; - int error; + int count, error; sc = device_get_softc(dev); bzero(sc, sizeof(*sc)); @@ -226,6 +232,20 @@ mfi_pci_attach(device_t dev) goto out; } + /* Allocate IRQ resource. */ + sc->mfi_irq_rid = 0; + count = 1; + if (mfi_msi && pci_alloc_msi(sc->mfi_dev, &count) == 0) { + device_printf(sc->mfi_dev, "Using MSI\n"); + sc->mfi_irq_rid = 1; + } + if ((sc->mfi_irq = bus_alloc_resource_any(sc->mfi_dev, SYS_RES_IRQ, + &sc->mfi_irq_rid, RF_SHAREABLE | RF_ACTIVE)) == NULL) { + device_printf(sc->mfi_dev, "Cannot allocate interrupt\n"); + error = EINVAL; + goto out; + } + error = mfi_attach(sc); out: if (error) { @@ -280,6 +300,8 @@ mfi_pci_free(struct mfi_softc *sc) bus_release_resource(sc->mfi_dev, SYS_RES_MEMORY, sc->mfi_regs_rid, sc->mfi_regs_resource); } + if (sc->mfi_irq_rid != 0) + pci_release_msi(sc->mfi_dev); return; } Modified: stable/8/sys/dev/mfi/mfivar.h ============================================================================== --- stable/8/sys/dev/mfi/mfivar.h Thu Jan 5 18:30:48 2012 (r229611) +++ stable/8/sys/dev/mfi/mfivar.h Thu Jan 5 18:31:08 2012 (r229612) @@ -378,6 +378,7 @@ mfi_print_sense(struct mfi_softc *sc, vo (sc)->mfi_bhandle, (reg)) MALLOC_DECLARE(M_MFIBUF); +SYSCTL_DECL(_hw_mfi); #define MFI_CMD_TIMEOUT 30 #define MFI_MAXPHYS (128 * 1024) From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 18:32:38 2012 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 08477106566B; Thu, 5 Jan 2012 18:32:38 +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 EB0E88FC08; Thu, 5 Jan 2012 18:32: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 q05IWbCS048992; Thu, 5 Jan 2012 18:32:37 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05IWbDg048988; Thu, 5 Jan 2012 18:32:37 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201051832.q05IWbDg048988@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 18:32: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: r229613 - in head/sys/dev: bxe qlxgb sfxge 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, 05 Jan 2012 18:32:38 -0000 Author: jhb Date: Thu Jan 5 18:32:37 2012 New Revision: 229613 URL: http://svn.freebsd.org/changeset/base/229613 Log: Update recently added drivers to use the if_*addr_r*lock() wrapper functions instead of using the IF_ADDR_LOCK directly. The wrapper functions are the supported interface for device drivers. Reviewed by: bz, philip MFC after: 1 week Modified: head/sys/dev/bxe/if_bxe.c head/sys/dev/qlxgb/qla_os.c head/sys/dev/sfxge/sfxge_port.c Modified: head/sys/dev/bxe/if_bxe.c ============================================================================== --- head/sys/dev/bxe/if_bxe.c Thu Jan 5 18:31:08 2012 (r229612) +++ head/sys/dev/bxe/if_bxe.c Thu Jan 5 18:32:37 2012 (r229613) @@ -14115,7 +14115,7 @@ bxe_set_rx_mode(struct bxe_softc *sc) i = 0; config = BXE_SP(sc, mcast_config); - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) @@ -14144,7 +14144,7 @@ bxe_set_rx_mode(struct bxe_softc *sc) config_table->cam_entry.lsb_mac_addr); } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); old = config->hdr.length; @@ -14172,7 +14172,7 @@ bxe_set_rx_mode(struct bxe_softc *sc) /* Accept one or more multicasts */ memset(mc_filter, 0, 4 * MC_HASH_SIZE); - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) @@ -14184,7 +14184,7 @@ bxe_set_rx_mode(struct bxe_softc *sc) bit &= 0x1f; mc_filter[regidx] |= (1 << bit); } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); for (i = 0; i < MC_HASH_SIZE; i++) REG_WR(sc, MC_HASH_OFFSET(sc, i), mc_filter[i]); Modified: head/sys/dev/qlxgb/qla_os.c ============================================================================== --- head/sys/dev/qlxgb/qla_os.c Thu Jan 5 18:31:08 2012 (r229612) +++ head/sys/dev/qlxgb/qla_os.c Thu Jan 5 18:32:37 2012 (r229613) @@ -760,7 +760,7 @@ qla_set_multi(qla_host_t *ha, uint32_t a int mcnt = 0; struct ifnet *ifp = ha->ifp; - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { @@ -776,7 +776,7 @@ qla_set_multi(qla_host_t *ha, uint32_t a mcnt++; } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); qla_hw_set_multi(ha, mta, mcnt, add_multi); Modified: head/sys/dev/sfxge/sfxge_port.c ============================================================================== --- head/sys/dev/sfxge/sfxge_port.c Thu Jan 5 18:31:08 2012 (r229612) +++ head/sys/dev/sfxge/sfxge_port.c Thu Jan 5 18:32:37 2012 (r229613) @@ -301,7 +301,7 @@ sfxge_mac_filter_set_locked(struct sfxge * 0xff. */ bucket[0xff] = 1; - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family == AF_LINK) { sa = (struct sockaddr_dl *)ifma->ifma_addr; @@ -309,7 +309,7 @@ sfxge_mac_filter_set_locked(struct sfxge bucket[index] = 1; } } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); } return efx_mac_hash_set(enp, bucket); } @@ -391,10 +391,10 @@ sfxge_port_start(struct sfxge_softc *sc) goto fail2; /* Set the unicast address */ - IF_ADDR_LOCK(ifp); + if_addr_rlock(ifp); bcopy(LLADDR((struct sockaddr_dl *)ifp->if_addr->ifa_addr), mac_addr, sizeof(mac_addr)); - IF_ADDR_UNLOCK(ifp); + if_addr_runlock(ifp); if ((rc = efx_mac_addr_set(enp, mac_addr)) != 0) goto fail; From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 18:35:49 2012 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 D4080106564A; Thu, 5 Jan 2012 18:35:49 +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 C356B8FC18; Thu, 5 Jan 2012 18:35: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 q05IZnXV049135; Thu, 5 Jan 2012 18:35:49 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05IZnpC049132; Thu, 5 Jan 2012 18:35:49 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201051835.q05IZnpC049132@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 18:35: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: r229614 - 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: Thu, 05 Jan 2012 18:35:49 -0000 Author: jhb Date: Thu Jan 5 18:35:49 2012 New Revision: 229614 URL: http://svn.freebsd.org/changeset/base/229614 Log: Add new variants of the IF_ADDR_*LOCK*() macros used for protecting interface address lists that distinguish read locks from write locks. To preserve the KPI, the previous operations are mapped to the write lock macros. The lock is still kept as a mutex for now. Reviewed by: bz MFC after: 2 weeks Modified: head/sys/net/if_var.h Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Thu Jan 5 18:32:37 2012 (r229613) +++ head/sys/net/if_var.h Thu Jan 5 18:35:49 2012 (r229614) @@ -249,9 +249,15 @@ typedef void if_init_f_t(void *); #define IF_ADDR_LOCK_INIT(if) mtx_init(&(if)->if_addr_mtx, \ "if_addr_mtx", NULL, MTX_DEF) #define IF_ADDR_LOCK_DESTROY(if) mtx_destroy(&(if)->if_addr_mtx) -#define IF_ADDR_LOCK(if) mtx_lock(&(if)->if_addr_mtx) -#define IF_ADDR_UNLOCK(if) mtx_unlock(&(if)->if_addr_mtx) +#define IF_ADDR_WLOCK(if) mtx_lock(&(if)->if_addr_mtx) +#define IF_ADDR_WUNLOCK(if) mtx_unlock(&(if)->if_addr_mtx) +#define IF_ADDR_RLOCK(if) mtx_lock(&(if)->if_addr_mtx) +#define IF_ADDR_RUNLOCK(if) mtx_unlock(&(if)->if_addr_mtx) #define IF_ADDR_LOCK_ASSERT(if) mtx_assert(&(if)->if_addr_mtx, MA_OWNED) +#define IF_ADDR_WLOCK_ASSERT(if) mtx_assert(&(if)->if_addr_mtx, MA_OWNED) +/* XXX: Compat. */ +#define IF_ADDR_LOCK(if) IF_ADDR_WLOCK(if) +#define IF_ADDR_UNLOCK(if) IF_ADDR_WUNLOCK(if) /* * Function variations on locking macros intended to be used by loadable From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 18:38:14 2012 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 520D5106566B; Thu, 5 Jan 2012 18:38:14 +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 407F58FC08; Thu, 5 Jan 2012 18:38: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 q05IcEX8049323; Thu, 5 Jan 2012 18:38:14 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05IcEVq049321; Thu, 5 Jan 2012 18:38:14 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201051838.q05IcEVq049321@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 18:38:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229615 - stable/9/sbin/sysctl 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, 05 Jan 2012 18:38:14 -0000 Author: jhb Date: Thu Jan 5 18:38:13 2012 New Revision: 229615 URL: http://svn.freebsd.org/changeset/base/229615 Log: MFC 228181: If the -d flag is specified, ignore any new values specified and only display the descriptions of specified nodes. Modified: stable/9/sbin/sysctl/sysctl.c Directory Properties: stable/9/sbin/sysctl/ (props changed) Modified: stable/9/sbin/sysctl/sysctl.c ============================================================================== --- stable/9/sbin/sysctl/sysctl.c Thu Jan 5 18:35:49 2012 (r229614) +++ stable/9/sbin/sysctl/sysctl.c Thu Jan 5 18:38:13 2012 (r229615) @@ -201,7 +201,7 @@ parse(char *string) if (oidfmt(mib, len, fmt, &kind)) err(1, "couldn't find format of oid '%s'", bufp); - if (newval == NULL) { + if (newval == NULL || dflag) { if ((kind & CTLTYPE) == CTLTYPE_NODE) { if (dflag) { i = show_var(mib, len); From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 18:38:24 2012 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 9275A1065690; Thu, 5 Jan 2012 18:38:24 +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 811A08FC14; Thu, 5 Jan 2012 18:38: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 q05IcODr049364; Thu, 5 Jan 2012 18:38:24 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05IcOU1049362; Thu, 5 Jan 2012 18:38:24 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201051838.q05IcOU1049362@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 18:38:24 +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: r229616 - stable/8/sbin/sysctl 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, 05 Jan 2012 18:38:24 -0000 Author: jhb Date: Thu Jan 5 18:38:23 2012 New Revision: 229616 URL: http://svn.freebsd.org/changeset/base/229616 Log: MFC 228181: If the -d flag is specified, ignore any new values specified and only display the descriptions of specified nodes. Modified: stable/8/sbin/sysctl/sysctl.c Directory Properties: stable/8/sbin/sysctl/ (props changed) Modified: stable/8/sbin/sysctl/sysctl.c ============================================================================== --- stable/8/sbin/sysctl/sysctl.c Thu Jan 5 18:38:13 2012 (r229615) +++ stable/8/sbin/sysctl/sysctl.c Thu Jan 5 18:38:23 2012 (r229616) @@ -201,7 +201,7 @@ parse(char *string) if (oidfmt(mib, len, fmt, &kind)) err(1, "couldn't find format of oid '%s'", bufp); - if (newval == NULL) { + if (newval == NULL || dflag) { if ((kind & CTLTYPE) == CTLTYPE_NODE) { if (dflag) { i = show_var(mib, len); From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 18:50:13 2012 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 25C7C1065676; Thu, 5 Jan 2012 18:50:13 +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 132958FC14; Thu, 5 Jan 2012 18:50: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 q05IoCWG049795; Thu, 5 Jan 2012 18:50:12 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05IoCSK049792; Thu, 5 Jan 2012 18:50:12 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201051850.q05IoCSK049792@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 18:50:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229617 - in stable/9/sys: fs/nfsserver nfsserver 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, 05 Jan 2012 18:50:13 -0000 Author: jhb Date: Thu Jan 5 18:50:12 2012 New Revision: 229617 URL: http://svn.freebsd.org/changeset/base/229617 Log: MFC 228185: Enhance the sequential access heuristic used to perform readahead in the NFS server and reuse it for writes as well to allow writes to the backing store to be clustered. Modified: stable/9/sys/fs/nfsserver/nfs_nfsdport.c stable/9/sys/nfsserver/nfs_serv.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- stable/9/sys/fs/nfsserver/nfs_nfsdport.c Thu Jan 5 18:38:23 2012 (r229616) +++ stable/9/sys/fs/nfsserver/nfs_nfsdport.c Thu Jan 5 18:50:12 2012 (r229617) @@ -90,20 +90,78 @@ SYSCTL_INT(_vfs_nfsd, OID_AUTO, issue_de SYSCTL_INT(_vfs_nfsd, OID_AUTO, enable_locallocks, CTLFLAG_RW, &nfsrv_dolocallocks, 0, "Enable nfsd to acquire local locks on files"); -#define NUM_HEURISTIC 1017 +#define MAX_REORDERED_RPC 16 +#define NUM_HEURISTIC 1031 #define NHUSE_INIT 64 #define NHUSE_INC 16 #define NHUSE_MAX 2048 static struct nfsheur { struct vnode *nh_vp; /* vp to match (unreferenced pointer) */ - off_t nh_nextr; /* next offset for sequential detection */ + off_t nh_nextoff; /* next offset for sequential detection */ int nh_use; /* use count for selection */ int nh_seqcount; /* heuristic */ } nfsheur[NUM_HEURISTIC]; /* + * Heuristic to detect sequential operation. + */ +static struct nfsheur * +nfsrv_sequential_heuristic(struct uio *uio, struct vnode *vp) +{ + struct nfsheur *nh; + int hi, try; + + /* Locate best candidate. */ + try = 32; + hi = ((int)(vm_offset_t)vp / sizeof(struct vnode)) % NUM_HEURISTIC; + nh = &nfsheur[hi]; + while (try--) { + if (nfsheur[hi].nh_vp == vp) { + nh = &nfsheur[hi]; + break; + } + if (nfsheur[hi].nh_use > 0) + --nfsheur[hi].nh_use; + hi = (hi + 1) % NUM_HEURISTIC; + if (nfsheur[hi].nh_use < nh->nh_use) + nh = &nfsheur[hi]; + } + + /* Initialize hint if this is a new file. */ + if (nh->nh_vp != vp) { + nh->nh_vp = vp; + nh->nh_nextoff = uio->uio_offset; + nh->nh_use = NHUSE_INIT; + if (uio->uio_offset == 0) + nh->nh_seqcount = 4; + else + nh->nh_seqcount = 1; + } + + /* Calculate heuristic. */ + if ((uio->uio_offset == 0 && nh->nh_seqcount > 0) || + uio->uio_offset == nh->nh_nextoff) { + /* See comments in vfs_vnops.c:sequential_heuristic(). */ + nh->nh_seqcount += howmany(uio->uio_resid, 16384); + if (nh->nh_seqcount > IO_SEQMAX) + nh->nh_seqcount = IO_SEQMAX; + } else if (qabs(uio->uio_offset - nh->nh_nextoff) <= MAX_REORDERED_RPC * + imax(vp->v_mount->mnt_stat.f_iosize, uio->uio_resid)) { + /* Probably a reordered RPC, leave seqcount alone. */ + } else if (nh->nh_seqcount > 1) { + nh->nh_seqcount /= 2; + } else { + nh->nh_seqcount = 0; + } + nh->nh_use += NHUSE_INC; + if (nh->nh_use > NHUSE_MAX) + nh->nh_use = NHUSE_MAX; + return (nh); +} + +/* * Get attributes into nfsvattr structure. */ int @@ -567,60 +625,11 @@ nfsvno_read(struct vnode *vp, off_t off, int i; struct iovec *iv; struct iovec *iv2; - int error = 0, len, left, siz, tlen, ioflag = 0, hi, try = 32; + int error = 0, len, left, siz, tlen, ioflag = 0; struct mbuf *m2 = NULL, *m3; struct uio io, *uiop = &io; struct nfsheur *nh; - /* - * Calculate seqcount for heuristic - */ - /* - * Locate best candidate - */ - - hi = ((int)(vm_offset_t)vp / sizeof(struct vnode)) % NUM_HEURISTIC; - nh = &nfsheur[hi]; - - while (try--) { - if (nfsheur[hi].nh_vp == vp) { - nh = &nfsheur[hi]; - break; - } - if (nfsheur[hi].nh_use > 0) - --nfsheur[hi].nh_use; - hi = (hi + 1) % NUM_HEURISTIC; - if (nfsheur[hi].nh_use < nh->nh_use) - nh = &nfsheur[hi]; - } - - if (nh->nh_vp != vp) { - nh->nh_vp = vp; - nh->nh_nextr = off; - nh->nh_use = NHUSE_INIT; - if (off == 0) - nh->nh_seqcount = 4; - else - nh->nh_seqcount = 1; - } - - /* - * Calculate heuristic - */ - - if ((off == 0 && nh->nh_seqcount > 0) || off == nh->nh_nextr) { - if (++nh->nh_seqcount > IO_SEQMAX) - nh->nh_seqcount = IO_SEQMAX; - } else if (nh->nh_seqcount > 1) { - nh->nh_seqcount = 1; - } else { - nh->nh_seqcount = 0; - } - nh->nh_use += NHUSE_INC; - if (nh->nh_use > NHUSE_MAX) - nh->nh_use = NHUSE_MAX; - ioflag |= nh->nh_seqcount << IO_SEQSHIFT; - len = left = NFSM_RNDUP(cnt); m3 = NULL; /* @@ -665,6 +674,8 @@ nfsvno_read(struct vnode *vp, off_t off, uiop->uio_resid = len; uiop->uio_rw = UIO_READ; uiop->uio_segflg = UIO_SYSSPACE; + nh = nfsrv_sequential_heuristic(uiop, vp); + ioflag |= nh->nh_seqcount << IO_SEQSHIFT; error = VOP_READ(vp, uiop, IO_NODELOCKED | ioflag, cred); FREE((caddr_t)iv2, M_TEMP); if (error) { @@ -672,6 +683,7 @@ nfsvno_read(struct vnode *vp, off_t off, *mpp = NULL; goto out; } + nh->nh_nextoff = uiop->uio_offset; tlen = len - uiop->uio_resid; cnt = cnt < tlen ? cnt : tlen; tlen = NFSM_RNDUP(cnt); @@ -700,6 +712,7 @@ nfsvno_write(struct vnode *vp, off_t off struct iovec *iv; int ioflags, error; struct uio io, *uiop = &io; + struct nfsheur *nh; MALLOC(ivp, struct iovec *, cnt * sizeof (struct iovec), M_TEMP, M_WAITOK); @@ -733,7 +746,11 @@ nfsvno_write(struct vnode *vp, off_t off uiop->uio_segflg = UIO_SYSSPACE; NFSUIOPROC(uiop, p); uiop->uio_offset = off; + nh = nfsrv_sequential_heuristic(uiop, vp); + ioflags |= nh->nh_seqcount << IO_SEQSHIFT; error = VOP_WRITE(vp, uiop, ioflags, cred); + if (error == 0) + nh->nh_nextoff = uiop->uio_offset; FREE((caddr_t)iv, M_TEMP); NFSEXITCODE(error); Modified: stable/9/sys/nfsserver/nfs_serv.c ============================================================================== --- stable/9/sys/nfsserver/nfs_serv.c Thu Jan 5 18:38:23 2012 (r229616) +++ stable/9/sys/nfsserver/nfs_serv.c Thu Jan 5 18:50:12 2012 (r229617) @@ -107,14 +107,15 @@ FEATURE(nfsserver, "NFS server"); #define MAX_COMMIT_COUNT (1024 * 1024) -#define NUM_HEURISTIC 1017 +#define MAX_REORDERED_RPC 16 +#define NUM_HEURISTIC 1031 #define NHUSE_INIT 64 #define NHUSE_INC 16 #define NHUSE_MAX 2048 static struct nfsheur { struct vnode *nh_vp; /* vp to match (unreferenced pointer) */ - off_t nh_nextr; /* next offset for sequential detection */ + off_t nh_nextoff; /* next offset for sequential detection */ int nh_use; /* use count for selection */ int nh_seqcount; /* heuristic */ } nfsheur[NUM_HEURISTIC]; @@ -187,6 +188,63 @@ nfsrv_lockedpair_nd(int vfs1, struct nam } /* + * Heuristic to detect sequential operation. + */ +static struct nfsheur * +nfsrv_sequential_heuristic(struct uio *uio, struct vnode *vp) +{ + struct nfsheur *nh; + int hi, try; + + /* Locate best candidate. */ + try = 32; + hi = ((int)(vm_offset_t)vp / sizeof(struct vnode)) % NUM_HEURISTIC; + nh = &nfsheur[hi]; + while (try--) { + if (nfsheur[hi].nh_vp == vp) { + nh = &nfsheur[hi]; + break; + } + if (nfsheur[hi].nh_use > 0) + --nfsheur[hi].nh_use; + hi = (hi + 1) % NUM_HEURISTIC; + if (nfsheur[hi].nh_use < nh->nh_use) + nh = &nfsheur[hi]; + } + + /* Initialize hint if this is a new file. */ + if (nh->nh_vp != vp) { + nh->nh_vp = vp; + nh->nh_nextoff = uio->uio_offset; + nh->nh_use = NHUSE_INIT; + if (uio->uio_offset == 0) + nh->nh_seqcount = 4; + else + nh->nh_seqcount = 1; + } + + /* Calculate heuristic. */ + if ((uio->uio_offset == 0 && nh->nh_seqcount > 0) || + uio->uio_offset == nh->nh_nextoff) { + /* See comments in vfs_vnops.c:sequential_heuristic(). */ + nh->nh_seqcount += howmany(uio->uio_resid, 16384); + if (nh->nh_seqcount > IO_SEQMAX) + nh->nh_seqcount = IO_SEQMAX; + } else if (qabs(uio->uio_offset - nh->nh_nextoff) <= MAX_REORDERED_RPC * + imax(vp->v_mount->mnt_stat.f_iosize, uio->uio_resid)) { + /* Probably a reordered RPC, leave seqcount alone. */ + } else if (nh->nh_seqcount > 1) { + nh->nh_seqcount /= 2; + } else { + nh->nh_seqcount = 0; + } + nh->nh_use += NHUSE_INC; + if (nh->nh_use > NHUSE_MAX) + nh->nh_use = NHUSE_MAX; + return (nh); +} + +/* * nfs v3 access service */ int @@ -843,7 +901,6 @@ nfsrv_read(struct nfsrv_descript *nfsd, /* * Calculate byte count to read */ - if (off >= vap->va_size) cnt = 0; else if ((off + reqlen) > vap->va_size) @@ -851,61 +908,6 @@ nfsrv_read(struct nfsrv_descript *nfsd, else cnt = reqlen; - /* - * Calculate seqcount for heuristic - */ - - { - int hi; - int try = 32; - - /* - * Locate best candidate - */ - - hi = ((int)(vm_offset_t)vp / sizeof(struct vnode)) % NUM_HEURISTIC; - nh = &nfsheur[hi]; - - while (try--) { - if (nfsheur[hi].nh_vp == vp) { - nh = &nfsheur[hi]; - break; - } - if (nfsheur[hi].nh_use > 0) - --nfsheur[hi].nh_use; - hi = (hi + 1) % NUM_HEURISTIC; - if (nfsheur[hi].nh_use < nh->nh_use) - nh = &nfsheur[hi]; - } - - if (nh->nh_vp != vp) { - nh->nh_vp = vp; - nh->nh_nextr = off; - nh->nh_use = NHUSE_INIT; - if (off == 0) - nh->nh_seqcount = 4; - else - nh->nh_seqcount = 1; - } - - /* - * Calculate heuristic - */ - - if ((off == 0 && nh->nh_seqcount > 0) || off == nh->nh_nextr) { - if (++nh->nh_seqcount > IO_SEQMAX) - nh->nh_seqcount = IO_SEQMAX; - } else if (nh->nh_seqcount > 1) { - nh->nh_seqcount = 1; - } else { - nh->nh_seqcount = 0; - } - nh->nh_use += NHUSE_INC; - if (nh->nh_use > NHUSE_MAX) - nh->nh_use = NHUSE_MAX; - ioflag |= nh->nh_seqcount << IO_SEQSHIFT; - } - nfsm_reply(NFSX_POSTOPORFATTR(v3) + 3 * NFSX_UNSIGNED+nfsm_rndup(cnt)); if (v3) { tl = nfsm_build(u_int32_t *, NFSX_V3FATTR + 4 * NFSX_UNSIGNED); @@ -963,9 +965,11 @@ nfsrv_read(struct nfsrv_descript *nfsd, uiop->uio_resid = len; uiop->uio_rw = UIO_READ; uiop->uio_segflg = UIO_SYSSPACE; + nh = nfsrv_sequential_heuristic(uiop, vp); + ioflag |= nh->nh_seqcount << IO_SEQSHIFT; error = VOP_READ(vp, uiop, IO_NODELOCKED | ioflag, cred); - off = uiop->uio_offset; - nh->nh_nextr = off; + if (error == 0) + nh->nh_nextoff = uiop->uio_offset; free((caddr_t)iv2, M_TEMP); if (error || (getret = VOP_GETATTR(vp, vap, cred))) { if (!error) @@ -1030,6 +1034,7 @@ nfsrv_write(struct nfsrv_descript *nfsd, int v3 = (nfsd->nd_flag & ND_NFSV3); struct mbuf *mb, *mreq; struct vnode *vp = NULL; + struct nfsheur *nh; nfsfh_t nfh; fhandle_t *fhp; struct uio io, *uiop = &io; @@ -1170,7 +1175,11 @@ nfsrv_write(struct nfsrv_descript *nfsd, uiop->uio_segflg = UIO_SYSSPACE; uiop->uio_td = NULL; uiop->uio_offset = off; + nh = nfsrv_sequential_heuristic(uiop, vp); + ioflags |= nh->nh_seqcount << IO_SEQSHIFT; error = VOP_WRITE(vp, uiop, ioflags, cred); + if (error == 0) + nh->nh_nextoff = uiop->uio_offset; /* Unlocked write. */ nfsrvstats.srvvop_writes++; free((caddr_t)iv, M_TEMP); From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 18:50:38 2012 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 3D7531065675; Thu, 5 Jan 2012 18:50:38 +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 D66C98FC14; Thu, 5 Jan 2012 18:50: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 q05IobKk049844; Thu, 5 Jan 2012 18:50:37 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05Iob3g049841; Thu, 5 Jan 2012 18:50:37 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201051850.q05Iob3g049841@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 18:50:37 +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: r229618 - in stable/8/sys: fs/nfsserver nfsserver 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, 05 Jan 2012 18:50:38 -0000 Author: jhb Date: Thu Jan 5 18:50:37 2012 New Revision: 229618 URL: http://svn.freebsd.org/changeset/base/229618 Log: MFC 228185: Enhance the sequential access heuristic used to perform readahead in the NFS server and reuse it for writes as well to allow writes to the backing store to be clustered. Modified: stable/8/sys/fs/nfsserver/nfs_nfsdport.c stable/8/sys/nfsserver/nfs_serv.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/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdport.c Thu Jan 5 18:50:12 2012 (r229617) +++ stable/8/sys/fs/nfsserver/nfs_nfsdport.c Thu Jan 5 18:50:37 2012 (r229618) @@ -86,20 +86,78 @@ SYSCTL_INT(_vfs_newnfs, OID_AUTO, issue_ SYSCTL_INT(_vfs_newnfs, OID_AUTO, enable_locallocks, CTLFLAG_RW, &nfsrv_dolocallocks, 0, "Enable nfsd to acquire local locks on files"); -#define NUM_HEURISTIC 1017 +#define MAX_REORDERED_RPC 16 +#define NUM_HEURISTIC 1031 #define NHUSE_INIT 64 #define NHUSE_INC 16 #define NHUSE_MAX 2048 static struct nfsheur { struct vnode *nh_vp; /* vp to match (unreferenced pointer) */ - off_t nh_nextr; /* next offset for sequential detection */ + off_t nh_nextoff; /* next offset for sequential detection */ int nh_use; /* use count for selection */ int nh_seqcount; /* heuristic */ } nfsheur[NUM_HEURISTIC]; /* + * Heuristic to detect sequential operation. + */ +static struct nfsheur * +nfsrv_sequential_heuristic(struct uio *uio, struct vnode *vp) +{ + struct nfsheur *nh; + int hi, try; + + /* Locate best candidate. */ + try = 32; + hi = ((int)(vm_offset_t)vp / sizeof(struct vnode)) % NUM_HEURISTIC; + nh = &nfsheur[hi]; + while (try--) { + if (nfsheur[hi].nh_vp == vp) { + nh = &nfsheur[hi]; + break; + } + if (nfsheur[hi].nh_use > 0) + --nfsheur[hi].nh_use; + hi = (hi + 1) % NUM_HEURISTIC; + if (nfsheur[hi].nh_use < nh->nh_use) + nh = &nfsheur[hi]; + } + + /* Initialize hint if this is a new file. */ + if (nh->nh_vp != vp) { + nh->nh_vp = vp; + nh->nh_nextoff = uio->uio_offset; + nh->nh_use = NHUSE_INIT; + if (uio->uio_offset == 0) + nh->nh_seqcount = 4; + else + nh->nh_seqcount = 1; + } + + /* Calculate heuristic. */ + if ((uio->uio_offset == 0 && nh->nh_seqcount > 0) || + uio->uio_offset == nh->nh_nextoff) { + /* See comments in vfs_vnops.c:sequential_heuristic(). */ + nh->nh_seqcount += howmany(uio->uio_resid, 16384); + if (nh->nh_seqcount > IO_SEQMAX) + nh->nh_seqcount = IO_SEQMAX; + } else if (qabs(uio->uio_offset - nh->nh_nextoff) <= MAX_REORDERED_RPC * + imax(vp->v_mount->mnt_stat.f_iosize, uio->uio_resid)) { + /* Probably a reordered RPC, leave seqcount alone. */ + } else if (nh->nh_seqcount > 1) { + nh->nh_seqcount /= 2; + } else { + nh->nh_seqcount = 0; + } + nh->nh_use += NHUSE_INC; + if (nh->nh_use > NHUSE_MAX) + nh->nh_use = NHUSE_MAX; + return (nh); +} + +/* * Get attributes into nfsvattr structure. */ int @@ -562,60 +620,11 @@ nfsvno_read(struct vnode *vp, off_t off, int i; struct iovec *iv; struct iovec *iv2; - int error = 0, len, left, siz, tlen, ioflag = 0, hi, try = 32; + int error = 0, len, left, siz, tlen, ioflag = 0; struct mbuf *m2 = NULL, *m3; struct uio io, *uiop = &io; struct nfsheur *nh; - /* - * Calculate seqcount for heuristic - */ - /* - * Locate best candidate - */ - - hi = ((int)(vm_offset_t)vp / sizeof(struct vnode)) % NUM_HEURISTIC; - nh = &nfsheur[hi]; - - while (try--) { - if (nfsheur[hi].nh_vp == vp) { - nh = &nfsheur[hi]; - break; - } - if (nfsheur[hi].nh_use > 0) - --nfsheur[hi].nh_use; - hi = (hi + 1) % NUM_HEURISTIC; - if (nfsheur[hi].nh_use < nh->nh_use) - nh = &nfsheur[hi]; - } - - if (nh->nh_vp != vp) { - nh->nh_vp = vp; - nh->nh_nextr = off; - nh->nh_use = NHUSE_INIT; - if (off == 0) - nh->nh_seqcount = 4; - else - nh->nh_seqcount = 1; - } - - /* - * Calculate heuristic - */ - - if ((off == 0 && nh->nh_seqcount > 0) || off == nh->nh_nextr) { - if (++nh->nh_seqcount > IO_SEQMAX) - nh->nh_seqcount = IO_SEQMAX; - } else if (nh->nh_seqcount > 1) { - nh->nh_seqcount = 1; - } else { - nh->nh_seqcount = 0; - } - nh->nh_use += NHUSE_INC; - if (nh->nh_use > NHUSE_MAX) - nh->nh_use = NHUSE_MAX; - ioflag |= nh->nh_seqcount << IO_SEQSHIFT; - len = left = NFSM_RNDUP(cnt); m3 = NULL; /* @@ -660,6 +669,8 @@ nfsvno_read(struct vnode *vp, off_t off, uiop->uio_resid = len; uiop->uio_rw = UIO_READ; uiop->uio_segflg = UIO_SYSSPACE; + nh = nfsrv_sequential_heuristic(uiop, vp); + ioflag |= nh->nh_seqcount << IO_SEQSHIFT; error = VOP_READ(vp, uiop, IO_NODELOCKED | ioflag, cred); FREE((caddr_t)iv2, M_TEMP); if (error) { @@ -667,6 +678,7 @@ nfsvno_read(struct vnode *vp, off_t off, *mpp = NULL; goto out; } + nh->nh_nextoff = uiop->uio_offset; tlen = len - uiop->uio_resid; cnt = cnt < tlen ? cnt : tlen; tlen = NFSM_RNDUP(cnt); @@ -695,6 +707,7 @@ nfsvno_write(struct vnode *vp, off_t off struct iovec *iv; int ioflags, error; struct uio io, *uiop = &io; + struct nfsheur *nh; MALLOC(ivp, struct iovec *, cnt * sizeof (struct iovec), M_TEMP, M_WAITOK); @@ -728,7 +741,11 @@ nfsvno_write(struct vnode *vp, off_t off uiop->uio_segflg = UIO_SYSSPACE; NFSUIOPROC(uiop, p); uiop->uio_offset = off; + nh = nfsrv_sequential_heuristic(uiop, vp); + ioflags |= nh->nh_seqcount << IO_SEQSHIFT; error = VOP_WRITE(vp, uiop, ioflags, cred); + if (error == 0) + nh->nh_nextoff = uiop->uio_offset; FREE((caddr_t)iv, M_TEMP); NFSEXITCODE(error); Modified: stable/8/sys/nfsserver/nfs_serv.c ============================================================================== --- stable/8/sys/nfsserver/nfs_serv.c Thu Jan 5 18:50:12 2012 (r229617) +++ stable/8/sys/nfsserver/nfs_serv.c Thu Jan 5 18:50:37 2012 (r229618) @@ -105,14 +105,15 @@ __FBSDID("$FreeBSD$"); #define MAX_COMMIT_COUNT (1024 * 1024) -#define NUM_HEURISTIC 1017 +#define MAX_REORDERED_RPC 16 +#define NUM_HEURISTIC 1031 #define NHUSE_INIT 64 #define NHUSE_INC 16 #define NHUSE_MAX 2048 static struct nfsheur { struct vnode *nh_vp; /* vp to match (unreferenced pointer) */ - off_t nh_nextr; /* next offset for sequential detection */ + off_t nh_nextoff; /* next offset for sequential detection */ int nh_use; /* use count for selection */ int nh_seqcount; /* heuristic */ } nfsheur[NUM_HEURISTIC]; @@ -184,6 +185,63 @@ nfsrv_lockedpair_nd(int vfs1, struct nam } /* + * Heuristic to detect sequential operation. + */ +static struct nfsheur * +nfsrv_sequential_heuristic(struct uio *uio, struct vnode *vp) +{ + struct nfsheur *nh; + int hi, try; + + /* Locate best candidate. */ + try = 32; + hi = ((int)(vm_offset_t)vp / sizeof(struct vnode)) % NUM_HEURISTIC; + nh = &nfsheur[hi]; + while (try--) { + if (nfsheur[hi].nh_vp == vp) { + nh = &nfsheur[hi]; + break; + } + if (nfsheur[hi].nh_use > 0) + --nfsheur[hi].nh_use; + hi = (hi + 1) % NUM_HEURISTIC; + if (nfsheur[hi].nh_use < nh->nh_use) + nh = &nfsheur[hi]; + } + + /* Initialize hint if this is a new file. */ + if (nh->nh_vp != vp) { + nh->nh_vp = vp; + nh->nh_nextoff = uio->uio_offset; + nh->nh_use = NHUSE_INIT; + if (uio->uio_offset == 0) + nh->nh_seqcount = 4; + else + nh->nh_seqcount = 1; + } + + /* Calculate heuristic. */ + if ((uio->uio_offset == 0 && nh->nh_seqcount > 0) || + uio->uio_offset == nh->nh_nextoff) { + /* See comments in vfs_vnops.c:sequential_heuristic(). */ + nh->nh_seqcount += howmany(uio->uio_resid, 16384); + if (nh->nh_seqcount > IO_SEQMAX) + nh->nh_seqcount = IO_SEQMAX; + } else if (qabs(uio->uio_offset - nh->nh_nextoff) <= MAX_REORDERED_RPC * + imax(vp->v_mount->mnt_stat.f_iosize, uio->uio_resid)) { + /* Probably a reordered RPC, leave seqcount alone. */ + } else if (nh->nh_seqcount > 1) { + nh->nh_seqcount /= 2; + } else { + nh->nh_seqcount = 0; + } + nh->nh_use += NHUSE_INC; + if (nh->nh_use > NHUSE_MAX) + nh->nh_use = NHUSE_MAX; + return (nh); +} + +/* * nfs v3 access service */ int @@ -840,7 +898,6 @@ nfsrv_read(struct nfsrv_descript *nfsd, /* * Calculate byte count to read */ - if (off >= vap->va_size) cnt = 0; else if ((off + reqlen) > vap->va_size) @@ -848,61 +905,6 @@ nfsrv_read(struct nfsrv_descript *nfsd, else cnt = reqlen; - /* - * Calculate seqcount for heuristic - */ - - { - int hi; - int try = 32; - - /* - * Locate best candidate - */ - - hi = ((int)(vm_offset_t)vp / sizeof(struct vnode)) % NUM_HEURISTIC; - nh = &nfsheur[hi]; - - while (try--) { - if (nfsheur[hi].nh_vp == vp) { - nh = &nfsheur[hi]; - break; - } - if (nfsheur[hi].nh_use > 0) - --nfsheur[hi].nh_use; - hi = (hi + 1) % NUM_HEURISTIC; - if (nfsheur[hi].nh_use < nh->nh_use) - nh = &nfsheur[hi]; - } - - if (nh->nh_vp != vp) { - nh->nh_vp = vp; - nh->nh_nextr = off; - nh->nh_use = NHUSE_INIT; - if (off == 0) - nh->nh_seqcount = 4; - else - nh->nh_seqcount = 1; - } - - /* - * Calculate heuristic - */ - - if ((off == 0 && nh->nh_seqcount > 0) || off == nh->nh_nextr) { - if (++nh->nh_seqcount > IO_SEQMAX) - nh->nh_seqcount = IO_SEQMAX; - } else if (nh->nh_seqcount > 1) { - nh->nh_seqcount = 1; - } else { - nh->nh_seqcount = 0; - } - nh->nh_use += NHUSE_INC; - if (nh->nh_use > NHUSE_MAX) - nh->nh_use = NHUSE_MAX; - ioflag |= nh->nh_seqcount << IO_SEQSHIFT; - } - nfsm_reply(NFSX_POSTOPORFATTR(v3) + 3 * NFSX_UNSIGNED+nfsm_rndup(cnt)); if (v3) { tl = nfsm_build(u_int32_t *, NFSX_V3FATTR + 4 * NFSX_UNSIGNED); @@ -960,9 +962,11 @@ nfsrv_read(struct nfsrv_descript *nfsd, uiop->uio_resid = len; uiop->uio_rw = UIO_READ; uiop->uio_segflg = UIO_SYSSPACE; + nh = nfsrv_sequential_heuristic(uiop, vp); + ioflag |= nh->nh_seqcount << IO_SEQSHIFT; error = VOP_READ(vp, uiop, IO_NODELOCKED | ioflag, cred); - off = uiop->uio_offset; - nh->nh_nextr = off; + if (error == 0) + nh->nh_nextoff = uiop->uio_offset; free((caddr_t)iv2, M_TEMP); if (error || (getret = VOP_GETATTR(vp, vap, cred))) { if (!error) @@ -1027,6 +1031,7 @@ nfsrv_write(struct nfsrv_descript *nfsd, int v3 = (nfsd->nd_flag & ND_NFSV3); struct mbuf *mb, *mreq; struct vnode *vp = NULL; + struct nfsheur *nh; nfsfh_t nfh; fhandle_t *fhp; struct uio io, *uiop = &io; @@ -1167,7 +1172,11 @@ nfsrv_write(struct nfsrv_descript *nfsd, uiop->uio_segflg = UIO_SYSSPACE; uiop->uio_td = NULL; uiop->uio_offset = off; + nh = nfsrv_sequential_heuristic(uiop, vp); + ioflags |= nh->nh_seqcount << IO_SEQSHIFT; error = VOP_WRITE(vp, uiop, ioflags, cred); + if (error == 0) + nh->nh_nextoff = uiop->uio_offset; /* Unlocked write. */ nfsrvstats.srvvop_writes++; free((caddr_t)iv, M_TEMP); From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 18:55:59 2012 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 B9F6B106564A; Thu, 5 Jan 2012 18:55:59 +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 A88AC8FC19; Thu, 5 Jan 2012 18:55: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 q05ItxGW050069; Thu, 5 Jan 2012 18:55:59 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05ItxE8050067; Thu, 5 Jan 2012 18:55:59 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201051855.q05ItxE8050067@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 18:55:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229619 - stable/9/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: Thu, 05 Jan 2012 18:55:59 -0000 Author: jhb Date: Thu Jan 5 18:55:59 2012 New Revision: 229619 URL: http://svn.freebsd.org/changeset/base/229619 Log: MFC 228207: When changing the user priority of a thread, change the real priority in addition to the user priority for threads whose current real priority is equal to the previous user priority or if the new priority is a real-time priority. This allows priority changes of other threads to have an immediate effect. Modified: stable/9/sys/kern/kern_resource.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/kern/kern_resource.c ============================================================================== --- stable/9/sys/kern/kern_resource.c Thu Jan 5 18:50:37 2012 (r229618) +++ stable/9/sys/kern/kern_resource.c Thu Jan 5 18:55:59 2012 (r229619) @@ -488,8 +488,9 @@ rtp_to_pri(struct rtprio *rtp, struct th sched_class(td, rtp->type); /* XXX fix */ oldpri = td->td_user_pri; sched_user_prio(td, newpri); - if (curthread == td) - sched_prio(curthread, td->td_user_pri); /* XXX dubious */ + if (td->td_user_pri != oldpri && (td == curthread || + td->td_priority == oldpri || td->td_user_pri >= PRI_MAX_REALTIME)) + sched_prio(td, td->td_user_pri); if (TD_ON_UPILOCK(td) && oldpri != newpri) { critical_enter(); thread_unlock(td); From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 18:56:23 2012 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 EF5EF1065670; Thu, 5 Jan 2012 18:56:23 +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 DE1B28FC15; Thu, 5 Jan 2012 18:56: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 q05IuNsc050121; Thu, 5 Jan 2012 18:56:23 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05IuN05050119; Thu, 5 Jan 2012 18:56:23 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201051856.q05IuN05050119@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 18:56:23 +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: r229620 - 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: Thu, 05 Jan 2012 18:56:24 -0000 Author: jhb Date: Thu Jan 5 18:56:23 2012 New Revision: 229620 URL: http://svn.freebsd.org/changeset/base/229620 Log: MFC 228207: When changing the user priority of a thread, change the real priority in addition to the user priority for threads whose current real priority is equal to the previous user priority or if the new priority is a real-time priority. This allows priority changes of other threads to have an immediate effect. Modified: stable/8/sys/kern/kern_resource.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/kern_resource.c ============================================================================== --- stable/8/sys/kern/kern_resource.c Thu Jan 5 18:55:59 2012 (r229619) +++ stable/8/sys/kern/kern_resource.c Thu Jan 5 18:56:23 2012 (r229620) @@ -497,8 +497,9 @@ rtp_to_pri(struct rtprio *rtp, struct th sched_class(td, rtp->type); /* XXX fix */ oldpri = td->td_user_pri; sched_user_prio(td, newpri); - if (curthread == td) - sched_prio(curthread, td->td_user_pri); /* XXX dubious */ + if (td->td_user_pri != oldpri && (td == curthread || + td->td_priority == oldpri || td->td_user_pri >= PRI_MAX_REALTIME)) + sched_prio(td, td->td_user_pri); if (TD_ON_UPILOCK(td) && oldpri != newpri) { thread_unlock(td); umtx_pi_adjust(td, oldpri); From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 19:00:37 2012 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 83328106564A; Thu, 5 Jan 2012 19:00:37 +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 707F88FC0A; Thu, 5 Jan 2012 19:00: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 q05J0b35050315; Thu, 5 Jan 2012 19:00:37 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05J0biI050301; Thu, 5 Jan 2012 19:00:37 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201051900.q05J0biI050301@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 19:00: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: r229621 - in head/sys: kern net netatalk netinet netinet6 netipx 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, 05 Jan 2012 19:00:37 -0000 Author: jhb Date: Thu Jan 5 19:00:36 2012 New Revision: 229621 URL: http://svn.freebsd.org/changeset/base/229621 Log: Convert all users of IF_ADDR_LOCK to use new locking macros that specify either a read lock or write lock. Reviewed by: bz MFC after: 2 weeks Modified: head/sys/kern/kern_uuid.c head/sys/net/if.c head/sys/net/rtsock.c head/sys/netatalk/aarp.c head/sys/netatalk/at_control.c head/sys/netinet/if_ether.c head/sys/netinet/igmp.c head/sys/netinet/in.c head/sys/netinet/in_mcast.c head/sys/netinet/in_pcb.c head/sys/netinet/in_var.h head/sys/netinet/ip_carp.c head/sys/netinet/ip_icmp.c head/sys/netinet/ip_input.c head/sys/netinet/sctp_bsd_addr.c head/sys/netinet6/icmp6.c head/sys/netinet6/in6.c head/sys/netinet6/in6_ifattach.c head/sys/netinet6/in6_mcast.c head/sys/netinet6/in6_var.h head/sys/netinet6/ip6_input.c head/sys/netinet6/mld6.c head/sys/netinet6/nd6.c head/sys/netinet6/nd6_rtr.c head/sys/netipx/ipx.c Modified: head/sys/kern/kern_uuid.c ============================================================================== --- head/sys/kern/kern_uuid.c Thu Jan 5 18:56:23 2012 (r229620) +++ head/sys/kern/kern_uuid.c Thu Jan 5 19:00:36 2012 (r229621) @@ -98,20 +98,20 @@ uuid_node(uint16_t *node) IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { /* Walk the address list */ - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { sdl = (struct sockaddr_dl*)ifa->ifa_addr; if (sdl != NULL && sdl->sdl_family == AF_LINK && sdl->sdl_type == IFT_ETHER) { /* Got a MAC address. */ bcopy(LLADDR(sdl), node, UUID_NODE_LEN); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); IFNET_RUNLOCK_NOSLEEP(); CURVNET_RESTORE(); return; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } IFNET_RUNLOCK_NOSLEEP(); Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Thu Jan 5 18:56:23 2012 (r229620) +++ head/sys/net/if.c Thu Jan 5 19:00:36 2012 (r229621) @@ -786,10 +786,10 @@ if_purgemaddrs(struct ifnet *ifp) struct ifmultiaddr *ifma; struct ifmultiaddr *next; - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); TAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, next) if_delmulti_locked(ifp, ifma, 1); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); } /* @@ -1133,10 +1133,10 @@ if_addgroup(struct ifnet *ifp, const cha ifgl->ifgl_group = ifg; ifgm->ifgm_ifp = ifp; - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); TAILQ_INSERT_TAIL(&ifg->ifg_members, ifgm, ifgm_next); TAILQ_INSERT_TAIL(&ifp->if_groups, ifgl, ifgl_next); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); IFNET_WUNLOCK(); @@ -1163,9 +1163,9 @@ if_delgroup(struct ifnet *ifp, const cha return (ENOENT); } - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); TAILQ_REMOVE(&ifp->if_groups, ifgl, ifgl_next); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); TAILQ_FOREACH(ifgm, &ifgl->ifgl_group->ifg_members, ifgm_next) if (ifgm->ifgm_ifp == ifp) @@ -1206,9 +1206,9 @@ if_delgroups(struct ifnet *ifp) strlcpy(groupname, ifgl->ifgl_group->ifg_group, IFNAMSIZ); - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); TAILQ_REMOVE(&ifp->if_groups, ifgl, ifgl_next); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); TAILQ_FOREACH(ifgm, &ifgl->ifgl_group->ifg_members, ifgm_next) if (ifgm->ifgm_ifp == ifp) @@ -1250,33 +1250,33 @@ if_getgroup(struct ifgroupreq *data, str struct ifgroupreq *ifgr = data; if (ifgr->ifgr_len == 0) { - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifgl, &ifp->if_groups, ifgl_next) ifgr->ifgr_len += sizeof(struct ifg_req); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return (0); } len = ifgr->ifgr_len; ifgp = ifgr->ifgr_groups; /* XXX: wire */ - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifgl, &ifp->if_groups, ifgl_next) { if (len < sizeof(ifgrq)) { - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return (EINVAL); } bzero(&ifgrq, sizeof ifgrq); strlcpy(ifgrq.ifgrq_group, ifgl->ifgl_group->ifg_group, sizeof(ifgrq.ifgrq_group)); if ((error = copyout(&ifgrq, ifgp, sizeof(struct ifg_req)))) { - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return (error); } len -= sizeof(ifgrq); ifgp++; } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return (0); } @@ -1383,28 +1383,28 @@ void if_addr_rlock(struct ifnet *ifp) { - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); } void if_addr_runlock(struct ifnet *ifp) { - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } void if_maddr_rlock(struct ifnet *ifp) { - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); } void if_maddr_runlock(struct ifnet *ifp) { - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } /* @@ -1516,14 +1516,14 @@ ifa_ifwithaddr_internal(struct sockaddr IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != addr->sa_family) continue; if (sa_equal(addr, ifa->ifa_addr)) { if (getref) ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto done; } /* IP6 doesn't have broadcast */ @@ -1533,11 +1533,11 @@ ifa_ifwithaddr_internal(struct sockaddr sa_equal(ifa->ifa_broadaddr, addr)) { if (getref) ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto done; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } ifa = NULL; done: @@ -1571,7 +1571,7 @@ ifa_ifwithbroadaddr(struct sockaddr *add IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != addr->sa_family) continue; @@ -1580,11 +1580,11 @@ ifa_ifwithbroadaddr(struct sockaddr *add ifa->ifa_broadaddr->sa_len != 0 && sa_equal(ifa->ifa_broadaddr, addr)) { ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto done; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } ifa = NULL; done: @@ -1606,18 +1606,18 @@ ifa_ifwithdstaddr(struct sockaddr *addr) TAILQ_FOREACH(ifp, &V_ifnet, if_link) { if ((ifp->if_flags & IFF_POINTOPOINT) == 0) continue; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != addr->sa_family) continue; if (ifa->ifa_dstaddr != NULL && sa_equal(addr, ifa->ifa_dstaddr)) { ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto done; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } ifa = NULL; done: @@ -1651,12 +1651,12 @@ ifa_ifwithnet(struct sockaddr *addr, int /* * Scan though each interface, looking for ones that have addresses * in this address family. Maintain a reference on ifa_maybe once - * we find one, as we release the IF_ADDR_LOCK() that kept it stable + * we find one, as we release the IF_ADDR_RLOCK() that kept it stable * when we move onto the next interface. */ IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { char *cp, *cp2, *cp3; @@ -1675,7 +1675,7 @@ next: continue; if (ifa->ifa_dstaddr != NULL && sa_equal(addr, ifa->ifa_dstaddr)) { ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto done; } } else { @@ -1686,7 +1686,7 @@ next: continue; if (ifa->ifa_claim_addr) { if ((*ifa->ifa_claim_addr)(ifa, addr)) { ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto done; } continue; @@ -1726,7 +1726,7 @@ next: continue; } } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } ifa = ifa_maybe; ifa_maybe = NULL; @@ -1752,7 +1752,7 @@ ifaof_ifpforaddr(struct sockaddr *addr, if (af >= AF_MAX) return (NULL); - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != af) continue; @@ -1784,7 +1784,7 @@ ifaof_ifpforaddr(struct sockaddr *addr, done: if (ifa != NULL) ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return (ifa); } @@ -2334,9 +2334,9 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, * lose a race while we check if the membership * already exists. */ - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); ifma = if_findmulti(ifp, &ifr->ifr_addr); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); if (ifma != NULL) error = EADDRINUSE; else @@ -2762,7 +2762,7 @@ again: } addrs = 0; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { struct sockaddr *sa = ifa->ifa_addr; @@ -2794,7 +2794,7 @@ again: if (sbuf_error(sb) == 0) valid_len = sbuf_len(sb); } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); if (addrs == 0) { bzero((caddr_t)&ifr.ifr_addr, sizeof(ifr.ifr_addr)); sbuf_bcat(sb, &ifr, sizeof(ifr)); @@ -2952,13 +2952,13 @@ if_addmulti(struct ifnet *ifp, struct so * If the address is already present, return a new reference to it; * otherwise, allocate storage and set up a new address. */ - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); ifma = if_findmulti(ifp, sa); if (ifma != NULL) { ifma->ifma_refcount++; if (retifma != NULL) *retifma = ifma; - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); return (0); } @@ -3024,7 +3024,7 @@ if_addmulti(struct ifnet *ifp, struct so * pointer is still valid. */ rt_newmaddrmsg(RTM_NEWMADDR, ifma); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); /* * We are certain we have added something, so call down to the @@ -3044,7 +3044,7 @@ free_llsa_out: free(llsa, M_IFMADDR); unlock_out: - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); return (error); } @@ -3078,12 +3078,12 @@ if_delmulti(struct ifnet *ifp, struct so if (ifp == NULL) return (ENOENT); - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); lastref = 0; ifma = if_findmulti(ifp, sa); if (ifma != NULL) lastref = if_delmulti_locked(ifp, ifma, 0); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); if (ifma == NULL) return (ENOENT); @@ -3105,10 +3105,10 @@ if_delallmulti(struct ifnet *ifp) struct ifmultiaddr *ifma; struct ifmultiaddr *next; - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); TAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, next) if_delmulti_locked(ifp, ifma, 0); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); } /* @@ -3145,7 +3145,7 @@ if_delmulti_ifma(struct ifmultiaddr *ifm * If and only if the ifnet instance exists: Acquire the address lock. */ if (ifp != NULL) - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); lastref = if_delmulti_locked(ifp, ifma, 0); @@ -3155,7 +3155,7 @@ if_delmulti_ifma(struct ifmultiaddr *ifm * Release the address lock. * If the group was left: update the hardware hash filter. */ - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); if (lastref && ifp->if_ioctl != NULL) { (void)(*ifp->if_ioctl)(ifp, SIOCDELMULTI, 0); } @@ -3177,7 +3177,7 @@ if_delmulti_locked(struct ifnet *ifp, st if (ifp != NULL && ifma->ifma_ifp != NULL) { KASSERT(ifma->ifma_ifp == ifp, ("%s: inconsistent ifp %p", __func__, ifp)); - IF_ADDR_LOCK_ASSERT(ifp); + IF_ADDR_WLOCK_ASSERT(ifp); } ifp = ifma->ifma_ifp; @@ -3250,14 +3250,14 @@ if_setlladdr(struct ifnet *ifp, const u_ struct ifaddr *ifa; struct ifreq ifr; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); ifa = ifp->if_addr; if (ifa == NULL) { - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return (EINVAL); } ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); sdl = (struct sockaddr_dl *)ifa->ifa_addr; if (sdl == NULL) { ifa_free(ifa); Modified: head/sys/net/rtsock.c ============================================================================== --- head/sys/net/rtsock.c Thu Jan 5 18:56:23 2012 (r229620) +++ head/sys/net/rtsock.c Thu Jan 5 19:00:36 2012 (r229621) @@ -456,7 +456,7 @@ rtm_get_jailed(struct rt_addrinfo *info, * Try to find an address on the given outgoing interface * that belongs to the jail. */ - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { struct sockaddr *sa; sa = ifa->ifa_addr; @@ -468,7 +468,7 @@ rtm_get_jailed(struct rt_addrinfo *info, break; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); if (!found) { /* * As a last resort return the 'default' jail address. @@ -498,7 +498,7 @@ rtm_get_jailed(struct rt_addrinfo *info, * Try to find an address on the given outgoing interface * that belongs to the jail. */ - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { struct sockaddr *sa; sa = ifa->ifa_addr; @@ -511,7 +511,7 @@ rtm_get_jailed(struct rt_addrinfo *info, break; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); if (!found) { /* * As a last resort return the 'default' jail address. @@ -1547,7 +1547,7 @@ sysctl_iflist(int af, struct walkarg *w) TAILQ_FOREACH(ifp, &V_ifnet, if_link) { if (w->w_arg && w->w_arg != ifp->if_index) continue; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); ifa = ifp->if_addr; info.rti_info[RTAX_IFP] = ifa->ifa_addr; len = rt_msg2(RTM_IFINFO, &info, NULL, w); @@ -1614,13 +1614,13 @@ sysctl_iflist(int af, struct walkarg *w) goto done; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); info.rti_info[RTAX_IFA] = info.rti_info[RTAX_NETMASK] = info.rti_info[RTAX_BRD] = NULL; } done: if (ifp != NULL) - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); IFNET_RUNLOCK(); return (error); } @@ -1641,7 +1641,7 @@ sysctl_ifmalist(int af, struct walkarg * continue; ifa = ifp->if_addr; info.rti_info[RTAX_IFP] = ifa ? ifa->ifa_addr : NULL; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (af && af != ifma->ifma_addr->sa_family) continue; @@ -1662,12 +1662,12 @@ sysctl_ifmalist(int af, struct walkarg * ifmam->ifmam_addrs = info.rti_addrs; error = SYSCTL_OUT(w->w_req, w->w_tmem, len); if (error) { - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto done; } } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } done: IFNET_RUNLOCK(); Modified: head/sys/netatalk/aarp.c ============================================================================== --- head/sys/netatalk/aarp.c Thu Jan 5 18:56:23 2012 (r229620) +++ head/sys/netatalk/aarp.c Thu Jan 5 19:00:36 2012 (r229621) @@ -406,7 +406,7 @@ at_aarpinput(struct ifnet *ifp, struct m * Since we don't know the net, we just look for the first * phase 1 address on the interface. */ - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); for (aa = (struct at_ifaddr *)TAILQ_FIRST(&ifp->if_addrhead); aa; aa = (struct at_ifaddr *)aa->aa_ifa.ifa_link.tqe_next) { @@ -416,12 +416,12 @@ at_aarpinput(struct ifnet *ifp, struct m } } if (aa == NULL) { - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); m_freem(m); return; } ifa_ref(&aa->aa_ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); tpa.s_net = spa.s_net = AA_SAT(aa)->sat_addr.s_net; } Modified: head/sys/netatalk/at_control.c ============================================================================== --- head/sys/netatalk/at_control.c Thu Jan 5 18:56:23 2012 (r229620) +++ head/sys/netatalk/at_control.c Thu Jan 5 19:00:36 2012 (r229621) @@ -254,9 +254,9 @@ at_control(struct socket *so, u_long cmd */ aa->aa_ifp = ifp; ifa_ref(&aa->aa_ifa); /* if_addrhead */ - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); TAILQ_INSERT_TAIL(&ifp->if_addrhead, ifa, ifa_link); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); } else { /* * If we DID find one then we clobber any routes @@ -357,9 +357,9 @@ at_control(struct socket *so, u_long cmd * remove the ifaddr from the interface */ ifa = (struct ifaddr *)aa; - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); TAILQ_REMOVE(&ifp->if_addrhead, ifa, ifa_link); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); ifa_free(ifa); /* if_addrhead */ /* Modified: head/sys/netinet/if_ether.c ============================================================================== --- head/sys/netinet/if_ether.c Thu Jan 5 18:56:23 2012 (r229620) +++ head/sys/netinet/if_ether.c Thu Jan 5 19:00:36 2012 (r229621) @@ -608,17 +608,17 @@ in_arpinput(struct mbuf *m) * No match, use the first inet address on the receive interface * as a dummy address for the rest of the function. */ - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) if (ifa->ifa_addr->sa_family == AF_INET && (ifa->ifa_carp == NULL || (*carp_iamatch_p)(ifa, &enaddr))) { ia = ifatoia(ifa); ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto match; } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); /* * If bridging, fall back to using any inet address. Modified: head/sys/netinet/igmp.c ============================================================================== --- head/sys/netinet/igmp.c Thu Jan 5 18:56:23 2012 (r229620) +++ head/sys/netinet/igmp.c Thu Jan 5 19:00:36 2012 (r229621) @@ -618,7 +618,7 @@ igmp_ifdetach(struct ifnet *ifp) igi = ((struct in_ifinfo *)ifp->if_afdata[AF_INET])->ii_igmp; if (igi->igi_version == IGMP_VERSION_3) { - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) @@ -634,7 +634,7 @@ igmp_ifdetach(struct ifnet *ifp) } inm_clear_recorded(inm); } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); /* * Free the in_multi reference(s) for this IGMP lifecycle. */ @@ -751,7 +751,7 @@ igmp_input_v1_query(struct ifnet *ifp, c * for the interface on which the query arrived, * except those which are already running. */ - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) @@ -779,7 +779,7 @@ igmp_input_v1_query(struct ifnet *ifp, c break; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); out_locked: IGMP_UNLOCK(); @@ -852,7 +852,7 @@ igmp_input_v2_query(struct ifnet *ifp, c */ CTR2(KTR_IGMPV3, "process v2 general query on ifp %p(%s)", ifp, ifp->if_xname); - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) @@ -860,7 +860,7 @@ igmp_input_v2_query(struct ifnet *ifp, c inm = (struct in_multi *)ifma->ifma_protospec; igmp_v2_update_group(inm, timer); } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } else { /* * Group-specific IGMPv2 query, we need only @@ -1708,7 +1708,7 @@ igmp_fasttimo_vnet(void) IFQ_SET_MAXLEN(&scq, IGMP_MAX_STATE_CHANGE_PACKETS); } - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) @@ -1726,7 +1726,7 @@ igmp_fasttimo_vnet(void) break; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); if (igi->igi_version == IGMP_VERSION_3) { struct in_multi *tinm; @@ -2023,7 +2023,7 @@ igmp_v3_cancel_link_timers(struct igmp_i * for all memberships scoped to this link. */ ifp = igi->igi_ifp; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) @@ -2068,7 +2068,7 @@ igmp_v3_cancel_link_timers(struct igmp_i inm->inm_timer = 0; _IF_DRAIN(&inm->inm_scq); } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); SLIST_FOREACH_SAFE(inm, &igi->igi_relinmhead, inm_nrele, tinm) { SLIST_REMOVE_HEAD(&igi->igi_relinmhead, inm_nrele); inm_release_locked(inm); @@ -3331,7 +3331,7 @@ igmp_v3_dispatch_general_query(struct ig ifp = igi->igi_ifp; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) @@ -3362,7 +3362,7 @@ igmp_v3_dispatch_general_query(struct ig break; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); loop = (igi->igi_flags & IGIF_LOOPBACK) ? 1 : 0; igmp_dispatch_queue(&igi->igi_gq, IGMP_MAX_RESPONSE_BURST, loop); Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Thu Jan 5 18:56:23 2012 (r229620) +++ head/sys/netinet/in.c Thu Jan 5 19:00:36 2012 (r229621) @@ -363,7 +363,7 @@ in_control(struct socket *so, u_long cmd ifa_ref(&ia->ia_ifa); IN_IFADDR_RUNLOCK(); if (ia == NULL) { - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { iap = ifatoia(ifa); if (iap->ia_addr.sin_family == AF_INET) { @@ -377,7 +377,7 @@ in_control(struct socket *so, u_long cmd } if (ia != NULL) ifa_ref(&ia->ia_ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } if (ia == NULL) iaIsFirst = 1; @@ -441,9 +441,9 @@ in_control(struct socket *so, u_long cmd ia->ia_ifp = ifp; ifa_ref(ifa); /* if_addrhead */ - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); TAILQ_INSERT_TAIL(&ifp->if_addrhead, ifa, ifa_link); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); ifa_ref(ifa); /* in_ifaddrhead */ IN_IFADDR_WLOCK(); TAILQ_INSERT_TAIL(&V_in_ifaddrhead, ia, ia_link); @@ -622,7 +622,7 @@ in_control(struct socket *so, u_long cmd if (ia->ia_ifa.ifa_carp) (*carp_detach_p)(&ia->ia_ifa); - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); /* Re-check that ia is still part of the list. */ TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa == &ia->ia_ifa) @@ -634,12 +634,12 @@ in_control(struct socket *so, u_long cmd * try it again for the next loop as there is no other exit * path between here and out. */ - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); error = EADDRNOTAVAIL; goto out; } TAILQ_REMOVE(&ifp->if_addrhead, &ia->ia_ifa, ifa_link); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); ifa_free(&ia->ia_ifa); /* if_addrhead */ IN_IFADDR_WLOCK(); @@ -784,7 +784,7 @@ in_lifaddr_ioctl(struct socket *so, u_lo } } - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET) continue; @@ -798,7 +798,7 @@ in_lifaddr_ioctl(struct socket *so, u_lo } if (ifa != NULL) ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); if (ifa == NULL) return (EADDRNOTAVAIL); ia = (struct in_ifaddr *)ifa; @@ -1302,7 +1302,7 @@ in_purgemaddrs(struct ifnet *ifp) * We need to do this as IF_ADDR_LOCK() may be re-acquired * by code further down. */ - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) @@ -1314,7 +1314,7 @@ in_purgemaddrs(struct ifnet *ifp) inm = (struct in_multi *)ifma->ifma_protospec; LIST_INSERT_HEAD(&purgeinms, inm, inm_link); } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); LIST_FOREACH_SAFE(inm, &purgeinms, inm_link, tinm) { LIST_REMOVE(inm, inm_link); Modified: head/sys/netinet/in_mcast.c ============================================================================== --- head/sys/netinet/in_mcast.c Thu Jan 5 18:56:23 2012 (r229620) +++ head/sys/netinet/in_mcast.c Thu Jan 5 19:00:36 2012 (r229621) @@ -429,7 +429,7 @@ in_getmulti(struct ifnet *ifp, const str return (error); /* XXX ifma_protospec must be covered by IF_ADDR_LOCK */ - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); /* * If something other than netinet is occupying the link-layer @@ -453,11 +453,11 @@ in_getmulti(struct ifnet *ifp, const str #endif ++inm->inm_refcount; *pinm = inm; - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); return (0); } - IF_ADDR_LOCK_ASSERT(ifp); + IF_ADDR_WLOCK_ASSERT(ifp); /* * A new in_multi record is needed; allocate and initialize it. @@ -469,7 +469,7 @@ in_getmulti(struct ifnet *ifp, const str inm = malloc(sizeof(*inm), M_IPMADDR, M_NOWAIT | M_ZERO); if (inm == NULL) { if_delmulti_ifma(ifma); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); return (ENOMEM); } inm->inm_addr = *group; @@ -492,7 +492,7 @@ in_getmulti(struct ifnet *ifp, const str *pinm = inm; - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); return (0); } @@ -2832,7 +2832,7 @@ sysctl_ip_mcast_filters(SYSCTL_HANDLER_A IN_MULTI_LOCK(); - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) @@ -2865,7 +2865,7 @@ sysctl_ip_mcast_filters(SYSCTL_HANDLER_A break; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); IN_MULTI_UNLOCK(); Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Thu Jan 5 18:56:23 2012 (r229620) +++ head/sys/netinet/in_pcb.c Thu Jan 5 19:00:36 2012 (r229621) @@ -745,7 +745,7 @@ in_pcbladdr(struct inpcb *inp, struct in ifp = ia->ia_ifp; ifa_free(&ia->ia_ifa); ia = NULL; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { sa = ifa->ifa_addr; @@ -759,10 +759,10 @@ in_pcbladdr(struct inpcb *inp, struct in } if (ia != NULL) { laddr->s_addr = ia->ia_addr.sin_addr.s_addr; - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto done; } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); /* 3. As a last resort return the 'default' jail address. */ error = prison_get_ip4(cred, laddr); @@ -804,7 +804,7 @@ in_pcbladdr(struct inpcb *inp, struct in */ ia = NULL; ifp = sro.ro_rt->rt_ifp; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { sa = ifa->ifa_addr; if (sa->sa_family != AF_INET) @@ -817,10 +817,10 @@ in_pcbladdr(struct inpcb *inp, struct in } if (ia != NULL) { laddr->s_addr = ia->ia_addr.sin_addr.s_addr; - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto done; } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); /* 3. As a last resort return the 'default' jail address. */ error = prison_get_ip4(cred, laddr); @@ -868,7 +868,7 @@ in_pcbladdr(struct inpcb *inp, struct in ifp = ia->ia_ifp; ifa_free(&ia->ia_ifa); ia = NULL; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { sa = ifa->ifa_addr; @@ -883,10 +883,10 @@ in_pcbladdr(struct inpcb *inp, struct in } if (ia != NULL) { laddr->s_addr = ia->ia_addr.sin_addr.s_addr; - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto done; } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } /* 3. As a last resort return the 'default' jail address. */ Modified: head/sys/netinet/in_var.h ============================================================================== --- head/sys/netinet/in_var.h Thu Jan 5 18:56:23 2012 (r229620) +++ head/sys/netinet/in_var.h Thu Jan 5 19:00:36 2012 (r229621) @@ -394,9 +394,9 @@ inm_lookup(struct ifnet *ifp, const stru struct in_multi *inm; IN_MULTI_LOCK_ASSERT(); - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); inm = inm_lookup_locked(ifp, ina); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return (inm); } Modified: head/sys/netinet/ip_carp.c ============================================================================== --- head/sys/netinet/ip_carp.c Thu Jan 5 18:56:23 2012 (r229620) +++ head/sys/netinet/ip_carp.c Thu Jan 5 19:00:36 2012 (r229621) @@ -549,14 +549,14 @@ carp_input_c(struct mbuf *m, struct carp struct timeval sc_tv, ch_tv; /* verify that the VHID is valid on the receiving interface */ - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); IFNET_FOREACH_IFA(ifp, ifa) if (ifa->ifa_addr->sa_family == af && ifa->ifa_carp->sc_vhid == ch->carp_vhid) { ifa_ref(ifa); break; } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); if (ifa == NULL) { CARPSTATS_INC(carps_badvhid); @@ -1003,16 +1003,16 @@ carp_iamatch6(struct ifnet *ifp, struct { struct ifaddr *ifa; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); IFNET_FOREACH_IFA(ifp, ifa) if (ifa->ifa_addr->sa_family == AF_INET6 && ifa->ifa_carp->sc_state == MASTER && IN6_ARE_ADDR_EQUAL(taddr, IFA_IN6(ifa))) { ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return (ifa); } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return (NULL); } @@ -1022,14 +1022,14 @@ carp_macmatch6(struct ifnet *ifp, struct { struct ifaddr *ifa; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); IFNET_FOREACH_IFA(ifp, ifa) if (ifa->ifa_addr->sa_family == AF_INET6 && IN6_ARE_ADDR_EQUAL(taddr, IFA_IN6(ifa))) { struct carp_softc *sc = ifa->ifa_carp; struct m_tag *mtag; - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); mtag = m_tag_get(PACKET_TAG_CARP, sizeof(struct ifnet *), M_NOWAIT); @@ -1043,7 +1043,7 @@ carp_macmatch6(struct ifnet *ifp, struct return (LLADDR(&sc->sc_addr)); } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return (NULL); } @@ -1512,10 +1512,10 @@ carp_alloc_if(struct ifnet *ifp) cif->cif_ifp = ifp; TAILQ_INIT(&cif->cif_vrs); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 19:02:53 2012 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 91E50106566B; Thu, 5 Jan 2012 19:02:53 +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 813028FC14; Thu, 5 Jan 2012 19:02:53 +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 q05J2rHm050419; Thu, 5 Jan 2012 19:02:53 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05J2rjm050417; Thu, 5 Jan 2012 19:02:53 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201051902.q05J2rjm050417@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 19:02:53 +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: r229622 - 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: Thu, 05 Jan 2012 19:02:53 -0000 Author: jhb Date: Thu Jan 5 19:02:52 2012 New Revision: 229622 URL: http://svn.freebsd.org/changeset/base/229622 Log: Fix a logic bug in change 228207 in the check for a thread's new user priority being a realtime priority. MFC after: 3 days Modified: head/sys/kern/kern_resource.c Modified: head/sys/kern/kern_resource.c ============================================================================== --- head/sys/kern/kern_resource.c Thu Jan 5 19:00:36 2012 (r229621) +++ head/sys/kern/kern_resource.c Thu Jan 5 19:02:52 2012 (r229622) @@ -497,7 +497,7 @@ rtp_to_pri(struct rtprio *rtp, struct th oldpri = td->td_user_pri; sched_user_prio(td, newpri); if (td->td_user_pri != oldpri && (td == curthread || - td->td_priority == oldpri || td->td_user_pri >= PRI_MAX_REALTIME)) + td->td_priority == oldpri || td->td_user_pri <= PRI_MAX_REALTIME)) sched_prio(td, td->td_user_pri); if (TD_ON_UPILOCK(td) && oldpri != newpri) { critical_enter(); From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 19:14:03 2012 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 111A4106564A; Thu, 5 Jan 2012 19:14:03 +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 F37988FC0C; Thu, 5 Jan 2012 19:14: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 q05JE2pd050816; Thu, 5 Jan 2012 19:14:02 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05JE2c1050814; Thu, 5 Jan 2012 19:14:02 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201051914.q05JE2c1050814@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 19:14:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229623 - stable/9/usr.sbin/mfiutil 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, 05 Jan 2012 19:14:03 -0000 Author: jhb Date: Thu Jan 5 19:14:02 2012 New Revision: 229623 URL: http://svn.freebsd.org/changeset/base/229623 Log: MFC 228278: Use the correct volume identifier field when parsing MR_EVT_ARG_LD_STRIP arguments. Modified: stable/9/usr.sbin/mfiutil/mfi_evt.c Directory Properties: stable/9/usr.sbin/mfiutil/ (props changed) Modified: stable/9/usr.sbin/mfiutil/mfi_evt.c ============================================================================== --- stable/9/usr.sbin/mfiutil/mfi_evt.c Thu Jan 5 19:02:52 2012 (r229622) +++ stable/9/usr.sbin/mfiutil/mfi_evt.c Thu Jan 5 19:14:02 2012 (r229623) @@ -438,7 +438,7 @@ mfi_decode_evt(int fd, struct mfi_evt_de printf(": "); break; case MR_EVT_ARGS_LD_STRIP: - printf("VOL %s", volume_name(fd, &detail->args.ld_prog.ld)); + printf("VOL %s", volume_name(fd, &detail->args.ld_strip.ld)); if (verbose) { printf(" strip %lld", (long long)detail->args.ld_strip.strip); From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 19:14:11 2012 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 E83F01065672; Thu, 5 Jan 2012 19:14:11 +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 D64A88FC13; Thu, 5 Jan 2012 19:14: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 q05JEBaN050858; Thu, 5 Jan 2012 19:14:11 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05JEBDG050856; Thu, 5 Jan 2012 19:14:11 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201051914.q05JEBDG050856@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 19:14:11 +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: r229624 - stable/8/usr.sbin/mfiutil 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, 05 Jan 2012 19:14:12 -0000 Author: jhb Date: Thu Jan 5 19:14:11 2012 New Revision: 229624 URL: http://svn.freebsd.org/changeset/base/229624 Log: MFC 228278: Use the correct volume identifier field when parsing MR_EVT_ARG_LD_STRIP arguments. Modified: stable/8/usr.sbin/mfiutil/mfi_evt.c Directory Properties: stable/8/usr.sbin/mfiutil/ (props changed) Modified: stable/8/usr.sbin/mfiutil/mfi_evt.c ============================================================================== --- stable/8/usr.sbin/mfiutil/mfi_evt.c Thu Jan 5 19:14:02 2012 (r229623) +++ stable/8/usr.sbin/mfiutil/mfi_evt.c Thu Jan 5 19:14:11 2012 (r229624) @@ -438,7 +438,7 @@ mfi_decode_evt(int fd, struct mfi_evt_de printf(": "); break; case MR_EVT_ARGS_LD_STRIP: - printf("VOL %s", volume_name(fd, &detail->args.ld_prog.ld)); + printf("VOL %s", volume_name(fd, &detail->args.ld_strip.ld)); if (verbose) { printf(" strip %lld", (long long)detail->args.ld_strip.strip); From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 19:18:21 2012 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 B99E41065673; Thu, 5 Jan 2012 19:18:21 +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 5994D8FC0A; Thu, 5 Jan 2012 19:18: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 q05JIL4m051050; Thu, 5 Jan 2012 19:18:21 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05JILCe051048; Thu, 5 Jan 2012 19:18:21 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201051918.q05JILCe051048@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 19:18:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229625 - stable/9/sys/dev/pci 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, 05 Jan 2012 19:18:21 -0000 Author: jhb Date: Thu Jan 5 19:18:20 2012 New Revision: 229625 URL: http://svn.freebsd.org/changeset/base/229625 Log: MFC 228496: Implement BUS_ADD_CHILD() for the isab(4) driver. It already calls bus_generic_probe() and bus_generic_attach() to handle drivers that add new children via identify methods. Modified: stable/9/sys/dev/pci/isa_pci.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/pci/isa_pci.c ============================================================================== --- stable/9/sys/dev/pci/isa_pci.c Thu Jan 5 19:14:11 2012 (r229624) +++ stable/9/sys/dev/pci/isa_pci.c Thu Jan 5 19:18:20 2012 (r229625) @@ -67,6 +67,7 @@ static device_method_t isab_methods[] = DEVMETHOD(device_resume, bus_generic_resume), /* Bus interface */ + DEVMETHOD(bus_add_child, bus_generic_add_child), DEVMETHOD(bus_alloc_resource, isab_pci_alloc_resource), DEVMETHOD(bus_release_resource, isab_pci_release_resource), DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 19:18:42 2012 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 752AC106566B; Thu, 5 Jan 2012 19:18:42 +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 63ABA8FC1C; Thu, 5 Jan 2012 19:18:42 +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 q05JIghr051099; Thu, 5 Jan 2012 19:18:42 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05JIgpo051097; Thu, 5 Jan 2012 19:18:42 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201051918.q05JIgpo051097@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 19:18:42 +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: r229626 - stable/8/sys/dev/pci 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, 05 Jan 2012 19:18:42 -0000 Author: jhb Date: Thu Jan 5 19:18:41 2012 New Revision: 229626 URL: http://svn.freebsd.org/changeset/base/229626 Log: MFC 228496: Implement BUS_ADD_CHILD() for the isab(4) driver. It already calls bus_generic_probe() and bus_generic_attach() to handle drivers that add new children via identify methods. Modified: stable/8/sys/dev/pci/isa_pci.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/pci/isa_pci.c ============================================================================== --- stable/8/sys/dev/pci/isa_pci.c Thu Jan 5 19:18:20 2012 (r229625) +++ stable/8/sys/dev/pci/isa_pci.c Thu Jan 5 19:18:41 2012 (r229626) @@ -57,6 +57,7 @@ static device_method_t isab_methods[] = DEVMETHOD(device_resume, bus_generic_resume), /* Bus interface */ + DEVMETHOD(bus_add_child, bus_generic_add_child), DEVMETHOD(bus_print_child, bus_generic_print_child), DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource), DEVMETHOD(bus_release_resource, bus_generic_release_resource), From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 19:36:24 2012 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 2ACF6106566B; Thu, 5 Jan 2012 19:36:24 +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 194228FC0C; Thu, 5 Jan 2012 19:36: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 q05JaNr4051696; Thu, 5 Jan 2012 19:36:23 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05JaNnX051694; Thu, 5 Jan 2012 19:36:23 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201051936.q05JaNnX051694@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 19:36:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229627 - stable/9/sys/fs/devfs 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, 05 Jan 2012 19:36:24 -0000 Author: jhb Date: Thu Jan 5 19:36:23 2012 New Revision: 229627 URL: http://svn.freebsd.org/changeset/base/229627 Log: MFC 228361: Explicitly use curthread while manipulating td_fpop during last close of a devfs file descriptor in devfs_close_f(). The passed in td argument may be NULL if the close was invoked by garbage collection of open file descriptors in pending control messages in the socket buffer of a UNIX domain socket after it was closed. Modified: stable/9/sys/fs/devfs/devfs_vnops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/fs/devfs/devfs_vnops.c ============================================================================== --- stable/9/sys/fs/devfs/devfs_vnops.c Thu Jan 5 19:18:41 2012 (r229626) +++ stable/9/sys/fs/devfs/devfs_vnops.c Thu Jan 5 19:36:23 2012 (r229627) @@ -600,10 +600,14 @@ devfs_close_f(struct file *fp, struct th int error; struct file *fpop; - fpop = td->td_fpop; - td->td_fpop = fp; + /* + * NB: td may be NULL if this descriptor is closed due to + * garbage collection from a closed UNIX domain socket. + */ + fpop = curthread->td_fpop; + curthread->td_fpop = fp; error = vnops.fo_close(fp, td); - td->td_fpop = fpop; + curthread->td_fpop = fpop; /* * The f_cdevpriv cannot be assigned non-NULL value while we From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 19:36:38 2012 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 C21101065680; Thu, 5 Jan 2012 19:36:38 +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 B07168FC21; Thu, 5 Jan 2012 19:36: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 q05JacQS051738; Thu, 5 Jan 2012 19:36:38 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05Jactn051736; Thu, 5 Jan 2012 19:36:38 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201051936.q05Jactn051736@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 19:36: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: r229628 - stable/8/sys/fs/devfs 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, 05 Jan 2012 19:36:38 -0000 Author: jhb Date: Thu Jan 5 19:36:38 2012 New Revision: 229628 URL: http://svn.freebsd.org/changeset/base/229628 Log: MFC 228361: Explicitly use curthread while manipulating td_fpop during last close of a devfs file descriptor in devfs_close_f(). The passed in td argument may be NULL if the close was invoked by garbage collection of open file descriptors in pending control messages in the socket buffer of a UNIX domain socket after it was closed. Modified: stable/8/sys/fs/devfs/devfs_vnops.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/fs/devfs/devfs_vnops.c ============================================================================== --- stable/8/sys/fs/devfs/devfs_vnops.c Thu Jan 5 19:36:23 2012 (r229627) +++ stable/8/sys/fs/devfs/devfs_vnops.c Thu Jan 5 19:36:38 2012 (r229628) @@ -548,10 +548,14 @@ devfs_close_f(struct file *fp, struct th int error; struct file *fpop; - fpop = td->td_fpop; - td->td_fpop = fp; + /* + * NB: td may be NULL if this descriptor is closed due to + * garbage collection from a closed UNIX domain socket. + */ + fpop = curthread->td_fpop; + curthread->td_fpop = fp; error = vnops.fo_close(fp, td); - td->td_fpop = fpop; + curthread->td_fpop = fpop; /* * The f_cdevpriv cannot be assigned non-NULL value while we From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 19:50:12 2012 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 C491210656FF; Thu, 5 Jan 2012 19:50:12 +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 B174D8FC1D; Thu, 5 Jan 2012 19:50:12 +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 q05JoCeP052358; Thu, 5 Jan 2012 19:50:12 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05JoCKj052356; Thu, 5 Jan 2012 19:50:12 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201051950.q05JoCKj052356@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 19:50:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229633 - stable/9/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: Thu, 05 Jan 2012 19:50:13 -0000 Author: jhb Date: Thu Jan 5 19:50:12 2012 New Revision: 229633 URL: http://svn.freebsd.org/changeset/base/229633 Log: MFC 228089: Change the if_vlan driver to use if_transmit for forwarding packets to the parent interface. This avoids the overhead of queueing a packet to an IFQ only to immediately dequeue it again. Modified: stable/9/sys/net/if_vlan.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/net/if_vlan.c ============================================================================== --- stable/9/sys/net/if_vlan.c Thu Jan 5 19:47:54 2012 (r229632) +++ stable/9/sys/net/if_vlan.c Thu Jan 5 19:50:12 2012 (r229633) @@ -34,9 +34,8 @@ * we need to pretend to be enough of an Ethernet implementation * to make arp work. The way we do this is by telling everyone * that we are an Ethernet, and then catch the packets that - * ether_output() left on our output queue when it calls - * if_start(), rewrite them for use by the real outgoing interface, - * and ask it to send them. + * ether_output() sends to us via if_transmit(), rewrite them for + * use by the real outgoing interface, and ask it to send them. */ #include @@ -181,14 +180,15 @@ static __inline struct ifvlan * vlan_get #endif static void trunk_destroy(struct ifvlantrunk *trunk); -static void vlan_start(struct ifnet *ifp); static void vlan_init(void *foo); static void vlan_input(struct ifnet *ifp, struct mbuf *m); static int vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr); +static void vlan_qflush(struct ifnet *ifp); static int vlan_setflag(struct ifnet *ifp, int flag, int status, int (*func)(struct ifnet *, int)); static int vlan_setflags(struct ifnet *ifp, int status); static int vlan_setmulti(struct ifnet *ifp); +static int vlan_transmit(struct ifnet *ifp, struct mbuf *m); static void vlan_unconfig(struct ifnet *ifp); static void vlan_unconfig_locked(struct ifnet *ifp); static int vlan_config(struct ifvlan *ifv, struct ifnet *p, uint16_t tag); @@ -942,9 +942,9 @@ vlan_clone_create(struct if_clone *ifc, /* NB: mtu is not set here */ ifp->if_init = vlan_init; - ifp->if_start = vlan_start; + ifp->if_transmit = vlan_transmit; + ifp->if_qflush = vlan_qflush; ifp->if_ioctl = vlan_ioctl; - ifp->if_snd.ifq_maxlen = ifqmaxlen; ifp->if_flags = VLAN_IFFLAGS; ether_ifattach(ifp, eaddr); /* Now undo some of the damage... */ @@ -1003,99 +1003,95 @@ vlan_init(void *foo __unused) } /* - * The if_start method for vlan(4) interface. It doesn't - * raises the IFF_DRV_OACTIVE flag, since it is called - * only from IFQ_HANDOFF() macro in ether_output_frame(). - * If the interface queue is full, and vlan_start() is - * not called, the queue would never get emptied and - * interface would stall forever. + * The if_transmit method for vlan(4) interface. */ -static void -vlan_start(struct ifnet *ifp) +static int +vlan_transmit(struct ifnet *ifp, struct mbuf *m) { struct ifvlan *ifv; struct ifnet *p; - struct mbuf *m; int error; ifv = ifp->if_softc; p = PARENT(ifv); - for (;;) { - IF_DEQUEUE(&ifp->if_snd, m); - if (m == NULL) - break; - BPF_MTAP(ifp, m); + BPF_MTAP(ifp, m); - /* - * Do not run parent's if_start() if the parent is not up, - * or parent's driver will cause a system crash. - */ - if (!UP_AND_RUNNING(p)) { - m_freem(m); - ifp->if_collisions++; - continue; - } + /* + * Do not run parent's if_transmit() if the parent is not up, + * or parent's driver will cause a system crash. + */ + if (!UP_AND_RUNNING(p)) { + m_freem(m); + ifp->if_collisions++; + return (0); + } - /* - * Pad the frame to the minimum size allowed if told to. - * This option is in accord with IEEE Std 802.1Q, 2003 Ed., - * paragraph C.4.4.3.b. It can help to work around buggy - * bridges that violate paragraph C.4.4.3.a from the same - * document, i.e., fail to pad short frames after untagging. - * E.g., a tagged frame 66 bytes long (incl. FCS) is OK, but - * untagging it will produce a 62-byte frame, which is a runt - * and requires padding. There are VLAN-enabled network - * devices that just discard such runts instead or mishandle - * them somehow. - */ - if (soft_pad && p->if_type == IFT_ETHER) { - static char pad[8]; /* just zeros */ - int n; - - for (n = ETHERMIN + ETHER_HDR_LEN - m->m_pkthdr.len; - n > 0; n -= sizeof(pad)) - if (!m_append(m, min(n, sizeof(pad)), pad)) - break; - - if (n > 0) { - if_printf(ifp, "cannot pad short frame\n"); - ifp->if_oerrors++; - m_freem(m); - continue; - } - } + /* + * Pad the frame to the minimum size allowed if told to. + * This option is in accord with IEEE Std 802.1Q, 2003 Ed., + * paragraph C.4.4.3.b. It can help to work around buggy + * bridges that violate paragraph C.4.4.3.a from the same + * document, i.e., fail to pad short frames after untagging. + * E.g., a tagged frame 66 bytes long (incl. FCS) is OK, but + * untagging it will produce a 62-byte frame, which is a runt + * and requires padding. There are VLAN-enabled network + * devices that just discard such runts instead or mishandle + * them somehow. + */ + if (soft_pad && p->if_type == IFT_ETHER) { + static char pad[8]; /* just zeros */ + int n; + + for (n = ETHERMIN + ETHER_HDR_LEN - m->m_pkthdr.len; + n > 0; n -= sizeof(pad)) + if (!m_append(m, min(n, sizeof(pad)), pad)) + break; - /* - * If underlying interface can do VLAN tag insertion itself, - * just pass the packet along. However, we need some way to - * tell the interface where the packet came from so that it - * knows how to find the VLAN tag to use, so we attach a - * packet tag that holds it. - */ - if (p->if_capenable & IFCAP_VLAN_HWTAGGING) { - m->m_pkthdr.ether_vtag = ifv->ifv_tag; - m->m_flags |= M_VLANTAG; - } else { - m = ether_vlanencap(m, ifv->ifv_tag); - if (m == NULL) { - if_printf(ifp, - "unable to prepend VLAN header\n"); - ifp->if_oerrors++; - continue; - } + if (n > 0) { + if_printf(ifp, "cannot pad short frame\n"); + ifp->if_oerrors++; + m_freem(m); + return (0); } + } - /* - * Send it, precisely as ether_output() would have. - * We are already running at splimp. - */ - error = (p->if_transmit)(p, m); - if (!error) - ifp->if_opackets++; - else + /* + * If underlying interface can do VLAN tag insertion itself, + * just pass the packet along. However, we need some way to + * tell the interface where the packet came from so that it + * knows how to find the VLAN tag to use, so we attach a + * packet tag that holds it. + */ + if (p->if_capenable & IFCAP_VLAN_HWTAGGING) { + m->m_pkthdr.ether_vtag = ifv->ifv_tag; + m->m_flags |= M_VLANTAG; + } else { + m = ether_vlanencap(m, ifv->ifv_tag); + if (m == NULL) { + if_printf(ifp, "unable to prepend VLAN header\n"); ifp->if_oerrors++; + return (0); + } } + + /* + * Send it, precisely as ether_output() would have. + */ + error = (p->if_transmit)(p, m); + if (!error) + ifp->if_opackets++; + else + ifp->if_oerrors++; + return (error); +} + +/* + * The ifp->if_qflush entry point for vlan(4) is a no-op. + */ +static void +vlan_qflush(struct ifnet *ifp __unused) +{ } static void From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 19:50:47 2012 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 912CB106564A; Thu, 5 Jan 2012 19:50:47 +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 7E9118FC17; Thu, 5 Jan 2012 19:50:47 +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 q05Jolap052409; Thu, 5 Jan 2012 19:50:47 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05Jol9O052407; Thu, 5 Jan 2012 19:50:47 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201051950.q05Jol9O052407@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 19:50:47 +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: r229634 - stable/8/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: Thu, 05 Jan 2012 19:50:47 -0000 Author: jhb Date: Thu Jan 5 19:50:47 2012 New Revision: 229634 URL: http://svn.freebsd.org/changeset/base/229634 Log: MFC 228089: Change the if_vlan driver to use if_transmit for forwarding packets to the parent interface. This avoids the overhead of queueing a packet to an IFQ only to immediately dequeue it again. Modified: stable/8/sys/net/if_vlan.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/net/if_vlan.c ============================================================================== --- stable/8/sys/net/if_vlan.c Thu Jan 5 19:50:12 2012 (r229633) +++ stable/8/sys/net/if_vlan.c Thu Jan 5 19:50:47 2012 (r229634) @@ -34,9 +34,8 @@ * we need to pretend to be enough of an Ethernet implementation * to make arp work. The way we do this is by telling everyone * that we are an Ethernet, and then catch the packets that - * ether_output() left on our output queue when it calls - * if_start(), rewrite them for use by the real outgoing interface, - * and ask it to send them. + * ether_output() sends to us via if_transmit(), rewrite them for + * use by the real outgoing interface, and ask it to send them. */ #include @@ -179,14 +178,15 @@ static __inline struct ifvlan * vlan_get #endif static void trunk_destroy(struct ifvlantrunk *trunk); -static void vlan_start(struct ifnet *ifp); static void vlan_init(void *foo); static void vlan_input(struct ifnet *ifp, struct mbuf *m); static int vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr); +static void vlan_qflush(struct ifnet *ifp); static int vlan_setflag(struct ifnet *ifp, int flag, int status, int (*func)(struct ifnet *, int)); static int vlan_setflags(struct ifnet *ifp, int status); static int vlan_setmulti(struct ifnet *ifp); +static int vlan_transmit(struct ifnet *ifp, struct mbuf *m); static void vlan_unconfig(struct ifnet *ifp); static void vlan_unconfig_locked(struct ifnet *ifp); static int vlan_config(struct ifvlan *ifv, struct ifnet *p, uint16_t tag); @@ -807,9 +807,9 @@ vlan_clone_create(struct if_clone *ifc, /* NB: mtu is not set here */ ifp->if_init = vlan_init; - ifp->if_start = vlan_start; + ifp->if_transmit = vlan_transmit; + ifp->if_qflush = vlan_qflush; ifp->if_ioctl = vlan_ioctl; - ifp->if_snd.ifq_maxlen = ifqmaxlen; ifp->if_flags = VLAN_IFFLAGS; ether_ifattach(ifp, eaddr); /* Now undo some of the damage... */ @@ -865,99 +865,95 @@ vlan_init(void *foo __unused) } /* - * The if_start method for vlan(4) interface. It doesn't - * raises the IFF_DRV_OACTIVE flag, since it is called - * only from IFQ_HANDOFF() macro in ether_output_frame(). - * If the interface queue is full, and vlan_start() is - * not called, the queue would never get emptied and - * interface would stall forever. + * The if_transmit method for vlan(4) interface. */ -static void -vlan_start(struct ifnet *ifp) +static int +vlan_transmit(struct ifnet *ifp, struct mbuf *m) { struct ifvlan *ifv; struct ifnet *p; - struct mbuf *m; int error; ifv = ifp->if_softc; p = PARENT(ifv); - for (;;) { - IF_DEQUEUE(&ifp->if_snd, m); - if (m == NULL) - break; - BPF_MTAP(ifp, m); + BPF_MTAP(ifp, m); - /* - * Do not run parent's if_start() if the parent is not up, - * or parent's driver will cause a system crash. - */ - if (!UP_AND_RUNNING(p)) { - m_freem(m); - ifp->if_collisions++; - continue; - } + /* + * Do not run parent's if_transmit() if the parent is not up, + * or parent's driver will cause a system crash. + */ + if (!UP_AND_RUNNING(p)) { + m_freem(m); + ifp->if_collisions++; + return (0); + } - /* - * Pad the frame to the minimum size allowed if told to. - * This option is in accord with IEEE Std 802.1Q, 2003 Ed., - * paragraph C.4.4.3.b. It can help to work around buggy - * bridges that violate paragraph C.4.4.3.a from the same - * document, i.e., fail to pad short frames after untagging. - * E.g., a tagged frame 66 bytes long (incl. FCS) is OK, but - * untagging it will produce a 62-byte frame, which is a runt - * and requires padding. There are VLAN-enabled network - * devices that just discard such runts instead or mishandle - * them somehow. - */ - if (soft_pad) { - static char pad[8]; /* just zeros */ - int n; - - for (n = ETHERMIN + ETHER_HDR_LEN - m->m_pkthdr.len; - n > 0; n -= sizeof(pad)) - if (!m_append(m, min(n, sizeof(pad)), pad)) - break; - - if (n > 0) { - if_printf(ifp, "cannot pad short frame\n"); - ifp->if_oerrors++; - m_freem(m); - continue; - } - } + /* + * Pad the frame to the minimum size allowed if told to. + * This option is in accord with IEEE Std 802.1Q, 2003 Ed., + * paragraph C.4.4.3.b. It can help to work around buggy + * bridges that violate paragraph C.4.4.3.a from the same + * document, i.e., fail to pad short frames after untagging. + * E.g., a tagged frame 66 bytes long (incl. FCS) is OK, but + * untagging it will produce a 62-byte frame, which is a runt + * and requires padding. There are VLAN-enabled network + * devices that just discard such runts instead or mishandle + * them somehow. + */ + if (soft_pad) { + static char pad[8]; /* just zeros */ + int n; + + for (n = ETHERMIN + ETHER_HDR_LEN - m->m_pkthdr.len; + n > 0; n -= sizeof(pad)) + if (!m_append(m, min(n, sizeof(pad)), pad)) + break; - /* - * If underlying interface can do VLAN tag insertion itself, - * just pass the packet along. However, we need some way to - * tell the interface where the packet came from so that it - * knows how to find the VLAN tag to use, so we attach a - * packet tag that holds it. - */ - if (p->if_capenable & IFCAP_VLAN_HWTAGGING) { - m->m_pkthdr.ether_vtag = ifv->ifv_tag; - m->m_flags |= M_VLANTAG; - } else { - m = ether_vlanencap(m, ifv->ifv_tag); - if (m == NULL) { - if_printf(ifp, - "unable to prepend VLAN header\n"); - ifp->if_oerrors++; - continue; - } + if (n > 0) { + if_printf(ifp, "cannot pad short frame\n"); + ifp->if_oerrors++; + m_freem(m); + return (0); } + } - /* - * Send it, precisely as ether_output() would have. - * We are already running at splimp. - */ - error = (p->if_transmit)(p, m); - if (!error) - ifp->if_opackets++; - else + /* + * If underlying interface can do VLAN tag insertion itself, + * just pass the packet along. However, we need some way to + * tell the interface where the packet came from so that it + * knows how to find the VLAN tag to use, so we attach a + * packet tag that holds it. + */ + if (p->if_capenable & IFCAP_VLAN_HWTAGGING) { + m->m_pkthdr.ether_vtag = ifv->ifv_tag; + m->m_flags |= M_VLANTAG; + } else { + m = ether_vlanencap(m, ifv->ifv_tag); + if (m == NULL) { + if_printf(ifp, "unable to prepend VLAN header\n"); ifp->if_oerrors++; + return (0); + } } + + /* + * Send it, precisely as ether_output() would have. + */ + error = (p->if_transmit)(p, m); + if (!error) + ifp->if_opackets++; + else + ifp->if_oerrors++; + return (error); +} + +/* + * The ifp->if_qflush entry point for vlan(4) is a no-op. + */ +static void +vlan_qflush(struct ifnet *ifp __unused) +{ } static void From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 19:53:02 2012 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 02030106564A; Thu, 5 Jan 2012 19:53:02 +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 E4C538FC19; Thu, 5 Jan 2012 19:53: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 q05Jr1IE052542; Thu, 5 Jan 2012 19:53:01 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05Jr1Td052540; Thu, 5 Jan 2012 19:53:01 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201051953.q05Jr1Td052540@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 19:53:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229635 - stable/9/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: Thu, 05 Jan 2012 19:53:02 -0000 Author: jhb Date: Thu Jan 5 19:53:01 2012 New Revision: 229635 URL: http://svn.freebsd.org/changeset/base/229635 Log: MFC 228593: Fire a kevent if necessary after seeking on a regular file. This fixes a case where a kevent would not fire on a regular file if an application read to EOF and then seeked backwards into the file. Modified: stable/9/sys/kern/vfs_syscalls.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/kern/vfs_syscalls.c ============================================================================== --- stable/9/sys/kern/vfs_syscalls.c Thu Jan 5 19:50:47 2012 (r229634) +++ stable/9/sys/kern/vfs_syscalls.c Thu Jan 5 19:53:01 2012 (r229635) @@ -2047,6 +2047,7 @@ sys_lseek(td, uap) if (error != 0) goto drop; fp->f_offset = offset; + VFS_KNOTE_UNLOCKED(vp, 0); *(off_t *)(td->td_retval) = fp->f_offset; drop: fdrop(fp, td); From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 19:53:17 2012 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 B6A021065672; Thu, 5 Jan 2012 19:53:17 +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 A528D8FC14; Thu, 5 Jan 2012 19:53: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 q05JrHh1052589; Thu, 5 Jan 2012 19:53:17 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05JrHJE052587; Thu, 5 Jan 2012 19:53:17 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201051953.q05JrHJE052587@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 19:53:17 +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: r229636 - 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: Thu, 05 Jan 2012 19:53:17 -0000 Author: jhb Date: Thu Jan 5 19:53:17 2012 New Revision: 229636 URL: http://svn.freebsd.org/changeset/base/229636 Log: MFC 228593: Fire a kevent if necessary after seeking on a regular file. This fixes a case where a kevent would not fire on a regular file if an application read to EOF and then seeked backwards into the file. Modified: stable/8/sys/kern/vfs_syscalls.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/vfs_syscalls.c ============================================================================== --- stable/8/sys/kern/vfs_syscalls.c Thu Jan 5 19:53:01 2012 (r229635) +++ stable/8/sys/kern/vfs_syscalls.c Thu Jan 5 19:53:17 2012 (r229636) @@ -1971,6 +1971,7 @@ lseek(td, uap) if (error != 0) goto drop; fp->f_offset = offset; + VFS_KNOTE_UNLOCKED(vp, 0); *(off_t *)(td->td_retval) = fp->f_offset; drop: fdrop(fp, td); From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 19:56:30 2012 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 D5110106564A; Thu, 5 Jan 2012 19:56:30 +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 C37B08FC08; Thu, 5 Jan 2012 19:56:30 +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 q05JuUJH052752; Thu, 5 Jan 2012 19:56:30 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05JuUiI052750; Thu, 5 Jan 2012 19:56:30 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201051956.q05JuUiI052750@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 19:56:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229637 - stable/9/sys/netinet6 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, 05 Jan 2012 19:56:30 -0000 Author: jhb Date: Thu Jan 5 19:56:30 2012 New Revision: 229637 URL: http://svn.freebsd.org/changeset/base/229637 Log: MFC 228866: Fix a bug where TAILQ_FIRST(&V_ifnet) was accessed without holding the proper lock. Modified: stable/9/sys/netinet6/icmp6.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/netinet6/icmp6.c ============================================================================== --- stable/9/sys/netinet6/icmp6.c Thu Jan 5 19:53:17 2012 (r229636) +++ stable/9/sys/netinet6/icmp6.c Thu Jan 5 19:56:30 2012 (r229637) @@ -1851,7 +1851,7 @@ static int ni6_store_addrs(struct icmp6_nodeinfo *ni6, struct icmp6_nodeinfo *nni6, struct ifnet *ifp0, int resid) { - struct ifnet *ifp = ifp0 ? ifp0 : TAILQ_FIRST(&V_ifnet); + struct ifnet *ifp; struct in6_ifaddr *ifa6; struct ifaddr *ifa; struct ifnet *ifp_dep = NULL; @@ -1864,6 +1864,7 @@ ni6_store_addrs(struct icmp6_nodeinfo *n return (0); /* needless to copy */ IFNET_RLOCK_NOSLEEP(); + ifp = ifp0 ? ifp0 : TAILQ_FIRST(&V_ifnet); again: for (; ifp; ifp = TAILQ_NEXT(ifp, if_list)) { From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 19:56:54 2012 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 926E8106566C; Thu, 5 Jan 2012 19:56:54 +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 80F858FC1E; Thu, 5 Jan 2012 19:56: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 q05JusSH052797; Thu, 5 Jan 2012 19:56:54 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05JusHp052795; Thu, 5 Jan 2012 19:56:54 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201051956.q05JusHp052795@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 19:56: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: r229638 - stable/8/sys/netinet6 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, 05 Jan 2012 19:56:54 -0000 Author: jhb Date: Thu Jan 5 19:56:54 2012 New Revision: 229638 URL: http://svn.freebsd.org/changeset/base/229638 Log: MFC 228866: Fix a bug where TAILQ_FIRST(&V_ifnet) was accessed without holding the proper lock. Modified: stable/8/sys/netinet6/icmp6.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/netinet6/icmp6.c ============================================================================== --- stable/8/sys/netinet6/icmp6.c Thu Jan 5 19:56:30 2012 (r229637) +++ stable/8/sys/netinet6/icmp6.c Thu Jan 5 19:56:54 2012 (r229638) @@ -1768,7 +1768,7 @@ static int ni6_store_addrs(struct icmp6_nodeinfo *ni6, struct icmp6_nodeinfo *nni6, struct ifnet *ifp0, int resid) { - struct ifnet *ifp = ifp0 ? ifp0 : TAILQ_FIRST(&V_ifnet); + struct ifnet *ifp; struct in6_ifaddr *ifa6; struct ifaddr *ifa; struct ifnet *ifp_dep = NULL; @@ -1781,6 +1781,7 @@ ni6_store_addrs(struct icmp6_nodeinfo *n return (0); /* needless to copy */ IFNET_RLOCK_NOSLEEP(); + ifp = ifp0 ? ifp0 : TAILQ_FIRST(&V_ifnet); again: for (; ifp; ifp = TAILQ_NEXT(ifp, if_list)) { From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 20:18:01 2012 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 92FA3106566C; Thu, 5 Jan 2012 20:18:01 +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 81BBA8FC08; Thu, 5 Jan 2012 20:18: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 q05KI1bU053630; Thu, 5 Jan 2012 20:18:01 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05KI1eZ053628; Thu, 5 Jan 2012 20:18:01 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201201052018.q05KI1eZ053628@svn.freebsd.org> From: Adrian Chadd Date: Thu, 5 Jan 2012 20:18: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: r229639 - head/sys/arm/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: Thu, 05 Jan 2012 20:18:01 -0000 Author: adrian Date: Thu Jan 5 20:18:01 2012 New Revision: 229639 URL: http://svn.freebsd.org/changeset/base/229639 Log: Add missing options so modules build/load correctly. Modified: head/sys/arm/conf/KB920X Modified: head/sys/arm/conf/KB920X ============================================================================== --- head/sys/arm/conf/KB920X Thu Jan 5 19:56:54 2012 (r229638) +++ head/sys/arm/conf/KB920X Thu Jan 5 20:18:01 2012 (r229639) @@ -138,3 +138,6 @@ device wlan_wep # 802.11 WEP support device wlan_ccmp # 802.11 CCMP support device wlan_tkip # 802.11 TKIP support device wlan_amrr # AMRR transmit rate control algorithm +options IEEE80211_SUPPORT_MESH + +options AH_SUPPORT_AR5416 From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 20:19:34 2012 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 2AAC71065679; Thu, 5 Jan 2012 20:19:34 +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 EBA528FC15; Thu, 5 Jan 2012 20:19:33 +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 q05KJX4c053726; Thu, 5 Jan 2012 20:19:33 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05KJX8f053724; Thu, 5 Jan 2012 20:19:33 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201201052019.q05KJX8f053724@svn.freebsd.org> From: Adrian Chadd Date: Thu, 5 Jan 2012 20:19: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: r229640 - head/sys/powerpc/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: Thu, 05 Jan 2012 20:19:34 -0000 Author: adrian Date: Thu Jan 5 20:19:33 2012 New Revision: 229640 URL: http://svn.freebsd.org/changeset/base/229640 Log: Fix build. Modified: head/sys/powerpc/conf/GENERIC Modified: head/sys/powerpc/conf/GENERIC ============================================================================== --- head/sys/powerpc/conf/GENERIC Thu Jan 5 20:18:01 2012 (r229639) +++ head/sys/powerpc/conf/GENERIC Thu Jan 5 20:19:33 2012 (r229640) @@ -174,6 +174,10 @@ device cdce # Generic USB over Etherne device cue # CATC USB Ethernet device kue # Kawasaki LSI USB Ethernet +# Wireless NIC cards +options IEEE80211_SUPPORT_MESH +options AH_SUPPORT_AR5416 + # FireWire support device firewire # FireWire bus code # sbp(4) works for some systems but causes boot failure on others From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 20:30:16 2012 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 6BA221065670; Thu, 5 Jan 2012 20:30:16 +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 590158FC13; Thu, 5 Jan 2012 20:30: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 q05KUGE7054131; Thu, 5 Jan 2012 20:30:16 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05KUGq1054128; Thu, 5 Jan 2012 20:30:16 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201052030.q05KUGq1054128@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 5 Jan 2012 20:30:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229641 - stable/9/sys/dev/vr 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, 05 Jan 2012 20:30:16 -0000 Author: yongari Date: Thu Jan 5 20:30:16 2012 New Revision: 229641 URL: http://svn.freebsd.org/changeset/base/229641 Log: MFC r228086: Announce flow control capability to PHY drivers and enable flow control for all vr(4) controllers that support it. It's known that old vr(4) controllers(Rhine II) does not support TX pause but Rhine III supports both TX and RX pause. Make TX pause really work on Rhine III by letting controller know available RX buffers. While here, adjust XON/XOFF parameters to get better performance with flow control. Modified: stable/9/sys/dev/vr/if_vr.c stable/9/sys/dev/vr/if_vrreg.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/vr/if_vr.c ============================================================================== --- stable/9/sys/dev/vr/if_vr.c Thu Jan 5 20:19:33 2012 (r229640) +++ stable/9/sys/dev/vr/if_vr.c Thu Jan 5 20:30:16 2012 (r229641) @@ -305,7 +305,7 @@ vr_miibus_statchg(device_t dev) (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) return; - sc->vr_flags &= ~VR_F_LINK; + sc->vr_flags &= ~(VR_F_LINK | VR_F_TXPAUSE); if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == (IFM_ACTIVE | IFM_AVALID)) { switch (IFM_SUBTYPE(mii->mii_media_active)) { @@ -342,7 +342,6 @@ vr_miibus_statchg(device_t dev) CSR_WRITE_1(sc, VR_CR1, cr1); } fc = 0; -#ifdef notyet /* Configure flow-control. */ if (sc->vr_revid >= REV_ID_VT6105_A0) { fc = CSR_READ_1(sc, VR_FLOWCR1); @@ -351,8 +350,10 @@ vr_miibus_statchg(device_t dev) IFM_ETH_RXPAUSE) != 0) fc |= VR_FLOWCR1_RXPAUSE; if ((IFM_OPTIONS(mii->mii_media_active) & - IFM_ETH_TXPAUSE) != 0) + IFM_ETH_TXPAUSE) != 0) { fc |= VR_FLOWCR1_TXPAUSE; + sc->vr_flags |= VR_F_TXPAUSE; + } CSR_WRITE_1(sc, VR_FLOWCR1, fc); } else if (sc->vr_revid >= REV_ID_VT6102_A) { /* No Tx puase capability available for Rhine II. */ @@ -363,7 +364,6 @@ vr_miibus_statchg(device_t dev) fc |= VR_MISCCR0_RXPAUSE; CSR_WRITE_1(sc, VR_MISC_CR0, fc); } -#endif vr_rx_start(sc); vr_tx_start(sc); } else { @@ -766,7 +766,8 @@ vr_attach(device_t dev) else phy = CSR_READ_1(sc, VR_PHYADDR) & VR_PHYADDR_MASK; error = mii_attach(dev, &sc->vr_miibus, ifp, vr_ifmedia_upd, - vr_ifmedia_sts, BMSR_DEFCAPMASK, phy, MII_OFFSET_ANY, 0); + vr_ifmedia_sts, BMSR_DEFCAPMASK, phy, MII_OFFSET_ANY, + sc->vr_revid >= REV_ID_VT6102_A ? MIIF_DOPAUSE : 0); if (error != 0) { device_printf(dev, "attaching PHYs failed\n"); goto fail; @@ -1396,6 +1397,17 @@ vr_rxeof(struct vr_softc *sc) } if (prog > 0) { + /* + * Let controller know how many number of RX buffers + * are posted but avoid expensive register access if + * TX pause capability was not negotiated with link + * partner. + */ + if ((sc->vr_flags & VR_F_TXPAUSE) != 0) { + if (prog >= VR_RX_RING_CNT) + prog = VR_RX_RING_CNT - 1; + CSR_WRITE_1(sc, VR_FLOWCR0, prog); + } sc->vr_cdata.vr_rx_cons = cons; bus_dmamap_sync(sc->vr_cdata.vr_rx_ring_tag, sc->vr_cdata.vr_rx_ring_map, @@ -2071,14 +2083,32 @@ vr_init_locked(struct vr_softc *sc) /* Set flow-control parameters for Rhine III. */ if (sc->vr_revid >= REV_ID_VT6105_A0) { - /* Rx buffer count available for incoming packet. */ - CSR_WRITE_1(sc, VR_FLOWCR0, VR_RX_RING_CNT); /* - * Tx pause low threshold : 16 free receive buffers - * Tx pause XON high threshold : 48 free receive buffers + * Configure Rx buffer count available for incoming + * packet. + * Even though data sheet says almost nothing about + * this register, this register should be updated + * whenever driver adds new RX buffers to controller. + * Otherwise, XON frame is not sent to link partner + * even if controller has enough RX buffers and you + * would be isolated from network. + * The controller is not smart enough to know number + * of available RX buffers so driver have to let + * controller know how many RX buffers are posted. + * In other words, this register works like a residue + * counter for RX buffers and should be initialized + * to the number of total RX buffers - 1 before + * enabling RX MAC. Note, this register is 8bits so + * it effectively limits the maximum number of RX + * buffer to be configured by controller is 255. + */ + CSR_WRITE_1(sc, VR_FLOWCR0, VR_RX_RING_CNT - 1); + /* + * Tx pause low threshold : 8 free receive buffers + * Tx pause XON high threshold : 24 free receive buffers */ CSR_WRITE_1(sc, VR_FLOWCR1, - VR_FLOWCR1_TXLO16 | VR_FLOWCR1_TXHI48 | VR_FLOWCR1_XONXOFF); + VR_FLOWCR1_TXLO8 | VR_FLOWCR1_TXHI24 | VR_FLOWCR1_XONXOFF); /* Set Tx pause timer. */ CSR_WRITE_2(sc, VR_PAUSETIMER, 0xffff); } @@ -2106,7 +2136,7 @@ vr_init_locked(struct vr_softc *sc) ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - sc->vr_flags &= ~VR_F_LINK; + sc->vr_flags &= ~(VR_F_LINK | VR_F_TXPAUSE); mii_mediachg(mii); callout_reset(&sc->vr_stat_callout, hz, vr_tick, sc); @@ -2128,6 +2158,7 @@ vr_ifmedia_upd(struct ifnet *ifp) mii = device_get_softc(sc->vr_miibus); LIST_FOREACH(miisc, &mii->mii_phys, mii_list) PHY_RESET(miisc); + sc->vr_flags &= ~(VR_F_LINK | VR_F_TXPAUSE); error = mii_mediachg(mii); VR_UNLOCK(sc); Modified: stable/9/sys/dev/vr/if_vrreg.h ============================================================================== --- stable/9/sys/dev/vr/if_vrreg.h Thu Jan 5 20:19:33 2012 (r229640) +++ stable/9/sys/dev/vr/if_vrreg.h Thu Jan 5 20:30:16 2012 (r229641) @@ -722,6 +722,7 @@ struct vr_softc { uint8_t vr_revid; /* Rhine chip revision */ int vr_flags; /* See VR_F_* below */ #define VR_F_RESTART 0x0001 /* Restart unit on next tick */ +#define VR_F_TXPAUSE 0x0010 #define VR_F_SUSPENDED 0x2000 #define VR_F_DETACHED 0x4000 #define VR_F_LINK 0x8000 From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 20:31:58 2012 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 96D7510656DA; Thu, 5 Jan 2012 20:31:58 +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 846138FC1C; Thu, 5 Jan 2012 20:31: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 q05KVwlS054218; Thu, 5 Jan 2012 20:31:58 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05KVwZ7054215; Thu, 5 Jan 2012 20:31:58 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201052031.q05KVwZ7054215@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 5 Jan 2012 20:31: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: r229642 - stable/8/sys/dev/vr 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, 05 Jan 2012 20:31:58 -0000 Author: yongari Date: Thu Jan 5 20:31:58 2012 New Revision: 229642 URL: http://svn.freebsd.org/changeset/base/229642 Log: MFC r228086: Announce flow control capability to PHY drivers and enable flow control for all vr(4) controllers that support it. It's known that old vr(4) controllers(Rhine II) does not support TX pause but Rhine III supports both TX and RX pause. Make TX pause really work on Rhine III by letting controller know available RX buffers. While here, adjust XON/XOFF parameters to get better performance with flow control. Modified: stable/8/sys/dev/vr/if_vr.c stable/8/sys/dev/vr/if_vrreg.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/vr/if_vr.c ============================================================================== --- stable/8/sys/dev/vr/if_vr.c Thu Jan 5 20:30:16 2012 (r229641) +++ stable/8/sys/dev/vr/if_vr.c Thu Jan 5 20:31:58 2012 (r229642) @@ -309,7 +309,7 @@ vr_miibus_statchg(device_t dev) (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) return; - sc->vr_flags &= ~VR_F_LINK; + sc->vr_flags &= ~(VR_F_LINK | VR_F_TXPAUSE); if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == (IFM_ACTIVE | IFM_AVALID)) { switch (IFM_SUBTYPE(mii->mii_media_active)) { @@ -346,7 +346,6 @@ vr_miibus_statchg(device_t dev) CSR_WRITE_1(sc, VR_CR1, cr1); } fc = 0; -#ifdef notyet /* Configure flow-control. */ if (sc->vr_revid >= REV_ID_VT6105_A0) { fc = CSR_READ_1(sc, VR_FLOWCR1); @@ -355,8 +354,10 @@ vr_miibus_statchg(device_t dev) IFM_ETH_RXPAUSE) != 0) fc |= VR_FLOWCR1_RXPAUSE; if ((IFM_OPTIONS(mii->mii_media_active) & - IFM_ETH_TXPAUSE) != 0) + IFM_ETH_TXPAUSE) != 0) { fc |= VR_FLOWCR1_TXPAUSE; + sc->vr_flags |= VR_F_TXPAUSE; + } CSR_WRITE_1(sc, VR_FLOWCR1, fc); } else if (sc->vr_revid >= REV_ID_VT6102_A) { /* No Tx puase capability available for Rhine II. */ @@ -367,7 +368,6 @@ vr_miibus_statchg(device_t dev) fc |= VR_MISCCR0_RXPAUSE; CSR_WRITE_1(sc, VR_MISC_CR0, fc); } -#endif vr_rx_start(sc); vr_tx_start(sc); } else { @@ -770,7 +770,8 @@ vr_attach(device_t dev) else phy = CSR_READ_1(sc, VR_PHYADDR) & VR_PHYADDR_MASK; error = mii_attach(dev, &sc->vr_miibus, ifp, vr_ifmedia_upd, - vr_ifmedia_sts, BMSR_DEFCAPMASK, phy, MII_OFFSET_ANY, 0); + vr_ifmedia_sts, BMSR_DEFCAPMASK, phy, MII_OFFSET_ANY, + sc->vr_revid >= REV_ID_VT6102_A ? MIIF_DOPAUSE : 0); if (error != 0) { device_printf(dev, "attaching PHYs failed\n"); goto fail; @@ -1400,6 +1401,17 @@ vr_rxeof(struct vr_softc *sc) } if (prog > 0) { + /* + * Let controller know how many number of RX buffers + * are posted but avoid expensive register access if + * TX pause capability was not negotiated with link + * partner. + */ + if ((sc->vr_flags & VR_F_TXPAUSE) != 0) { + if (prog >= VR_RX_RING_CNT) + prog = VR_RX_RING_CNT - 1; + CSR_WRITE_1(sc, VR_FLOWCR0, prog); + } sc->vr_cdata.vr_rx_cons = cons; bus_dmamap_sync(sc->vr_cdata.vr_rx_ring_tag, sc->vr_cdata.vr_rx_ring_map, @@ -2075,14 +2087,32 @@ vr_init_locked(struct vr_softc *sc) /* Set flow-control parameters for Rhine III. */ if (sc->vr_revid >= REV_ID_VT6105_A0) { - /* Rx buffer count available for incoming packet. */ - CSR_WRITE_1(sc, VR_FLOWCR0, VR_RX_RING_CNT); /* - * Tx pause low threshold : 16 free receive buffers - * Tx pause XON high threshold : 48 free receive buffers + * Configure Rx buffer count available for incoming + * packet. + * Even though data sheet says almost nothing about + * this register, this register should be updated + * whenever driver adds new RX buffers to controller. + * Otherwise, XON frame is not sent to link partner + * even if controller has enough RX buffers and you + * would be isolated from network. + * The controller is not smart enough to know number + * of available RX buffers so driver have to let + * controller know how many RX buffers are posted. + * In other words, this register works like a residue + * counter for RX buffers and should be initialized + * to the number of total RX buffers - 1 before + * enabling RX MAC. Note, this register is 8bits so + * it effectively limits the maximum number of RX + * buffer to be configured by controller is 255. + */ + CSR_WRITE_1(sc, VR_FLOWCR0, VR_RX_RING_CNT - 1); + /* + * Tx pause low threshold : 8 free receive buffers + * Tx pause XON high threshold : 24 free receive buffers */ CSR_WRITE_1(sc, VR_FLOWCR1, - VR_FLOWCR1_TXLO16 | VR_FLOWCR1_TXHI48 | VR_FLOWCR1_XONXOFF); + VR_FLOWCR1_TXLO8 | VR_FLOWCR1_TXHI24 | VR_FLOWCR1_XONXOFF); /* Set Tx pause timer. */ CSR_WRITE_2(sc, VR_PAUSETIMER, 0xffff); } @@ -2110,7 +2140,7 @@ vr_init_locked(struct vr_softc *sc) ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - sc->vr_flags &= ~VR_F_LINK; + sc->vr_flags &= ~(VR_F_LINK | VR_F_TXPAUSE); mii_mediachg(mii); callout_reset(&sc->vr_stat_callout, hz, vr_tick, sc); @@ -2132,6 +2162,7 @@ vr_ifmedia_upd(struct ifnet *ifp) mii = device_get_softc(sc->vr_miibus); LIST_FOREACH(miisc, &mii->mii_phys, mii_list) mii_phy_reset(miisc); + sc->vr_flags &= ~(VR_F_LINK | VR_F_TXPAUSE); error = mii_mediachg(mii); VR_UNLOCK(sc); Modified: stable/8/sys/dev/vr/if_vrreg.h ============================================================================== --- stable/8/sys/dev/vr/if_vrreg.h Thu Jan 5 20:30:16 2012 (r229641) +++ stable/8/sys/dev/vr/if_vrreg.h Thu Jan 5 20:31:58 2012 (r229642) @@ -722,6 +722,7 @@ struct vr_softc { uint8_t vr_revid; /* Rhine chip revision */ int vr_flags; /* See VR_F_* below */ #define VR_F_RESTART 0x0001 /* Restart unit on next tick */ +#define VR_F_TXPAUSE 0x0010 #define VR_F_SUSPENDED 0x2000 #define VR_F_DETACHED 0x4000 #define VR_F_LINK 0x8000 From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 20:33:21 2012 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 278A91065679; Thu, 5 Jan 2012 20:33:21 +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 1532D8FC19; Thu, 5 Jan 2012 20:33: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 q05KXKk7054312; Thu, 5 Jan 2012 20:33:20 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05KXKBF054309; Thu, 5 Jan 2012 20:33:20 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201052033.q05KXKBF054309@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 5 Jan 2012 20:33:20 +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: r229643 - stable/7/sys/dev/vr 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, 05 Jan 2012 20:33:21 -0000 Author: yongari Date: Thu Jan 5 20:33:20 2012 New Revision: 229643 URL: http://svn.freebsd.org/changeset/base/229643 Log: MFC r228086: Announce flow control capability to PHY drivers and enable flow control for all vr(4) controllers that support it. It's known that old vr(4) controllers(Rhine II) does not support TX pause but Rhine III supports both TX and RX pause. Make TX pause really work on Rhine III by letting controller know available RX buffers. While here, adjust XON/XOFF parameters to get better performance with flow control. Modified: stable/7/sys/dev/vr/if_vr.c stable/7/sys/dev/vr/if_vrreg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/vr/if_vr.c ============================================================================== --- stable/7/sys/dev/vr/if_vr.c Thu Jan 5 20:31:58 2012 (r229642) +++ stable/7/sys/dev/vr/if_vr.c Thu Jan 5 20:33:20 2012 (r229643) @@ -309,7 +309,7 @@ vr_miibus_statchg(device_t dev) (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) return; - sc->vr_flags &= ~VR_F_LINK; + sc->vr_flags &= ~(VR_F_LINK | VR_F_TXPAUSE); if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == (IFM_ACTIVE | IFM_AVALID)) { switch (IFM_SUBTYPE(mii->mii_media_active)) { @@ -346,7 +346,6 @@ vr_miibus_statchg(device_t dev) CSR_WRITE_1(sc, VR_CR1, cr1); } fc = 0; -#ifdef notyet /* Configure flow-control. */ if (sc->vr_revid >= REV_ID_VT6105_A0) { fc = CSR_READ_1(sc, VR_FLOWCR1); @@ -355,8 +354,10 @@ vr_miibus_statchg(device_t dev) IFM_ETH_RXPAUSE) != 0) fc |= VR_FLOWCR1_RXPAUSE; if ((IFM_OPTIONS(mii->mii_media_active) & - IFM_ETH_TXPAUSE) != 0) + IFM_ETH_TXPAUSE) != 0) { fc |= VR_FLOWCR1_TXPAUSE; + sc->vr_flags |= VR_F_TXPAUSE; + } CSR_WRITE_1(sc, VR_FLOWCR1, fc); } else if (sc->vr_revid >= REV_ID_VT6102_A) { /* No Tx puase capability available for Rhine II. */ @@ -367,7 +368,6 @@ vr_miibus_statchg(device_t dev) fc |= VR_MISCCR0_RXPAUSE; CSR_WRITE_1(sc, VR_MISC_CR0, fc); } -#endif vr_rx_start(sc); vr_tx_start(sc); } else { @@ -770,7 +770,8 @@ vr_attach(device_t dev) else phy = CSR_READ_1(sc, VR_PHYADDR) & VR_PHYADDR_MASK; error = mii_attach(dev, &sc->vr_miibus, ifp, vr_ifmedia_upd, - vr_ifmedia_sts, BMSR_DEFCAPMASK, phy, MII_OFFSET_ANY, 0); + vr_ifmedia_sts, BMSR_DEFCAPMASK, phy, MII_OFFSET_ANY, + sc->vr_revid >= REV_ID_VT6102_A ? MIIF_DOPAUSE : 0); if (error != 0) { device_printf(dev, "attaching PHYs failed\n"); goto fail; @@ -1398,6 +1399,17 @@ vr_rxeof(struct vr_softc *sc) } if (prog > 0) { + /* + * Let controller know how many number of RX buffers + * are posted but avoid expensive register access if + * TX pause capability was not negotiated with link + * partner. + */ + if ((sc->vr_flags & VR_F_TXPAUSE) != 0) { + if (prog >= VR_RX_RING_CNT) + prog = VR_RX_RING_CNT - 1; + CSR_WRITE_1(sc, VR_FLOWCR0, prog); + } sc->vr_cdata.vr_rx_cons = cons; bus_dmamap_sync(sc->vr_cdata.vr_rx_ring_tag, sc->vr_cdata.vr_rx_ring_map, @@ -2067,14 +2079,32 @@ vr_init_locked(struct vr_softc *sc) /* Set flow-control parameters for Rhine III. */ if (sc->vr_revid >= REV_ID_VT6105_A0) { - /* Rx buffer count available for incoming packet. */ - CSR_WRITE_1(sc, VR_FLOWCR0, VR_RX_RING_CNT); /* - * Tx pause low threshold : 16 free receive buffers - * Tx pause XON high threshold : 48 free receive buffers + * Configure Rx buffer count available for incoming + * packet. + * Even though data sheet says almost nothing about + * this register, this register should be updated + * whenever driver adds new RX buffers to controller. + * Otherwise, XON frame is not sent to link partner + * even if controller has enough RX buffers and you + * would be isolated from network. + * The controller is not smart enough to know number + * of available RX buffers so driver have to let + * controller know how many RX buffers are posted. + * In other words, this register works like a residue + * counter for RX buffers and should be initialized + * to the number of total RX buffers - 1 before + * enabling RX MAC. Note, this register is 8bits so + * it effectively limits the maximum number of RX + * buffer to be configured by controller is 255. + */ + CSR_WRITE_1(sc, VR_FLOWCR0, VR_RX_RING_CNT - 1); + /* + * Tx pause low threshold : 8 free receive buffers + * Tx pause XON high threshold : 24 free receive buffers */ CSR_WRITE_1(sc, VR_FLOWCR1, - VR_FLOWCR1_TXLO16 | VR_FLOWCR1_TXHI48 | VR_FLOWCR1_XONXOFF); + VR_FLOWCR1_TXLO8 | VR_FLOWCR1_TXHI24 | VR_FLOWCR1_XONXOFF); /* Set Tx pause timer. */ CSR_WRITE_2(sc, VR_PAUSETIMER, 0xffff); } @@ -2102,7 +2132,7 @@ vr_init_locked(struct vr_softc *sc) ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - sc->vr_flags &= ~VR_F_LINK; + sc->vr_flags &= ~(VR_F_LINK | VR_F_TXPAUSE); mii_mediachg(mii); callout_reset(&sc->vr_stat_callout, hz, vr_tick, sc); @@ -2124,6 +2154,7 @@ vr_ifmedia_upd(struct ifnet *ifp) mii = device_get_softc(sc->vr_miibus); LIST_FOREACH(miisc, &mii->mii_phys, mii_list) mii_phy_reset(miisc); + sc->vr_flags &= ~(VR_F_LINK | VR_F_TXPAUSE); error = mii_mediachg(mii); VR_UNLOCK(sc); Modified: stable/7/sys/dev/vr/if_vrreg.h ============================================================================== --- stable/7/sys/dev/vr/if_vrreg.h Thu Jan 5 20:31:58 2012 (r229642) +++ stable/7/sys/dev/vr/if_vrreg.h Thu Jan 5 20:33:20 2012 (r229643) @@ -722,6 +722,7 @@ struct vr_softc { uint8_t vr_revid; /* Rhine chip revision */ int vr_flags; /* See VR_F_* below */ #define VR_F_RESTART 0x0001 /* Restart unit on next tick */ +#define VR_F_TXPAUSE 0x0010 #define VR_F_SUSPENDED 0x2000 #define VR_F_DETACHED 0x4000 #define VR_F_LINK 0x8000 From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 20:37:13 2012 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 C699D1065670; Thu, 5 Jan 2012 20:37:13 +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 B48238FC08; Thu, 5 Jan 2012 20:37: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 q05KbDQZ054496; Thu, 5 Jan 2012 20:37:13 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05KbD4B054494; Thu, 5 Jan 2012 20:37:13 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201052037.q05KbD4B054494@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 5 Jan 2012 20:37:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229644 - stable/9/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: Thu, 05 Jan 2012 20:37:13 -0000 Author: yongari Date: Thu Jan 5 20:37:13 2012 New Revision: 229644 URL: http://svn.freebsd.org/changeset/base/229644 Log: MFC r228205: Add more controllers that support jumbo frame. Modified: stable/9/share/man/man4/bge.4 Directory Properties: stable/9/share/man/man4/ (props changed) Modified: stable/9/share/man/man4/bge.4 ============================================================================== --- stable/9/share/man/man4/bge.4 Thu Jan 5 20:33:20 2012 (r229643) +++ stable/9/share/man/man4/bge.4 Thu Jan 5 20:37:13 2012 (r229644) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 23, 2010 +.Dd December 2, 2011 .Dt BGE 4 .Os .Sh NAME @@ -82,9 +82,9 @@ copper gigabit transceivers, which support autonegotiation of 10, 100 and 1000Mbps modes in full or half duplex. .Pp -The BCM5700, BCM5701, BCM5702, BCM5703, BCM5704 and BCM5717 also support -jumbo frames, which can be configured -via the interface MTU setting. +The BCM5700, BCM5701, BCM5702, BCM5703, BCM5704, BCM5714, BCM5717, BCM5719, +BCM5720, BCM5780 and BCM57765 also support jumbo frames, which can be +configured via the interface MTU setting. Selecting an MTU larger than 1500 bytes with the .Xr ifconfig 8 utility configures the adapter to receive and transmit jumbo frames. From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 20:37:29 2012 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 1F83E106566B; Thu, 5 Jan 2012 20:37:29 +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 0D6C28FC08; Thu, 5 Jan 2012 20:37: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 q05KbSKx054539; Thu, 5 Jan 2012 20:37:28 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05KbSDU054537; Thu, 5 Jan 2012 20:37:28 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201052037.q05KbSDU054537@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 5 Jan 2012 20:37: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: r229645 - 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: Thu, 05 Jan 2012 20:37:29 -0000 Author: yongari Date: Thu Jan 5 20:37:28 2012 New Revision: 229645 URL: http://svn.freebsd.org/changeset/base/229645 Log: MFC r228205: Add more controllers that support jumbo frame. Modified: stable/8/share/man/man4/bge.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/bge.4 ============================================================================== --- stable/8/share/man/man4/bge.4 Thu Jan 5 20:37:13 2012 (r229644) +++ stable/8/share/man/man4/bge.4 Thu Jan 5 20:37:28 2012 (r229645) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 23, 2010 +.Dd December 2, 2011 .Dt BGE 4 .Os .Sh NAME @@ -82,9 +82,9 @@ copper gigabit transceivers, which support autonegotiation of 10, 100 and 1000Mbps modes in full or half duplex. .Pp -The BCM5700, BCM5701, BCM5702, BCM5703, BCM5704 and BCM5717 also support -jumbo frames, which can be configured -via the interface MTU setting. +The BCM5700, BCM5701, BCM5702, BCM5703, BCM5704, BCM5714, BCM5717, BCM5719, +BCM5720, BCM5780 and BCM57765 also support jumbo frames, which can be +configured via the interface MTU setting. Selecting an MTU larger than 1500 bytes with the .Xr ifconfig 8 utility configures the adapter to receive and transmit jumbo frames. From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 20:37:42 2012 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 D50351065781; Thu, 5 Jan 2012 20:37:42 +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 C2F5A8FC0C; Thu, 5 Jan 2012 20:37:42 +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 q05Kbg58054581; Thu, 5 Jan 2012 20:37:42 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05KbgQl054579; Thu, 5 Jan 2012 20:37:42 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201052037.q05KbgQl054579@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 5 Jan 2012 20:37:42 +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: r229646 - 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: Thu, 05 Jan 2012 20:37:43 -0000 Author: yongari Date: Thu Jan 5 20:37:42 2012 New Revision: 229646 URL: http://svn.freebsd.org/changeset/base/229646 Log: MFC r228205: Add more controllers that support jumbo frame. Modified: stable/7/share/man/man4/bge.4 Directory Properties: stable/7/share/man/man4/ (props changed) Modified: stable/7/share/man/man4/bge.4 ============================================================================== --- stable/7/share/man/man4/bge.4 Thu Jan 5 20:37:28 2012 (r229645) +++ stable/7/share/man/man4/bge.4 Thu Jan 5 20:37:42 2012 (r229646) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 23, 2010 +.Dd December 2, 2011 .Dt BGE 4 .Os .Sh NAME @@ -82,9 +82,9 @@ copper gigabit transceivers, which support autonegotiation of 10, 100 and 1000Mbps modes in full or half duplex. .Pp -The BCM5700, BCM5701, BCM5702, BCM5703, BCM5704 and BCM5717 also support -jumbo frames, which can be configured -via the interface MTU setting. +The BCM5700, BCM5701, BCM5702, BCM5703, BCM5704, BCM5714, BCM5717, BCM5719, +BCM5720, BCM5780 and BCM57765 also support jumbo frames, which can be +configured via the interface MTU setting. Selecting an MTU larger than 1500 bytes with the .Xr ifconfig 8 utility configures the adapter to receive and transmit jumbo frames. From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 20:41:41 2012 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 2A300106566C; Thu, 5 Jan 2012 20:41:41 +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 0EE9D8FC0C; Thu, 5 Jan 2012 20:41: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 q05KfeeS054775; Thu, 5 Jan 2012 20:41:40 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05KfeaL054771; Thu, 5 Jan 2012 20:41:40 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201052041.q05KfeaL054771@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 20:41:40 +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: r229647 - in stable/8/cddl/contrib/opensolaris: cmd/zpool lib/libzfs/common 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, 05 Jan 2012 20:41:41 -0000 Author: jhb Date: Thu Jan 5 20:41:40 2012 New Revision: 229647 URL: http://svn.freebsd.org/changeset/base/229647 Log: MFC 224169 (gibbs): cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h: cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c: o Add zpool_pool_state_to_name() API to libzfs which converts a pool_state_t into a user consumable string. o While here, correct constness of make zpool_state_to_name() and zpool_label_disk(). Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Jan 5 20:37:42 2012 (r229646) +++ stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Jan 5 20:41:40 2012 (r229647) @@ -1185,7 +1185,7 @@ print_status_config(zpool_handle_t *zhp, char *vname; uint64_t notpresent; spare_cbdata_t cb; - char *state; + const char *state; if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN, &child, &children) != 0) Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Thu Jan 5 20:37:42 2012 (r229646) +++ stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Thu Jan 5 20:41:40 2012 (r229647) @@ -202,7 +202,8 @@ extern zpool_handle_t *zpool_open_canfai extern void zpool_close(zpool_handle_t *); extern const char *zpool_get_name(zpool_handle_t *); extern int zpool_get_state(zpool_handle_t *); -extern char *zpool_state_to_name(vdev_state_t, vdev_aux_t); +extern const char *zpool_state_to_name(vdev_state_t, vdev_aux_t); +extern const char *zpool_pool_state_to_name(pool_state_t); extern void zpool_free_handles(libzfs_handle_t *); /* @@ -252,7 +253,7 @@ extern nvlist_t *zpool_find_vdev(zpool_h boolean_t *, boolean_t *); extern nvlist_t *zpool_find_vdev_by_physpath(zpool_handle_t *, const char *, boolean_t *, boolean_t *, boolean_t *); -extern int zpool_label_disk(libzfs_handle_t *, zpool_handle_t *, char *); +extern int zpool_label_disk(libzfs_handle_t *, zpool_handle_t *, const char *); /* * Functions to manage pool properties Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Thu Jan 5 20:37:42 2012 (r229646) +++ stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Thu Jan 5 20:41:40 2012 (r229647) @@ -176,7 +176,7 @@ zpool_get_prop_int(zpool_handle_t *zhp, /* * Map VDEV STATE to printed strings. */ -char * +const char * zpool_state_to_name(vdev_state_t state, vdev_aux_t aux) { switch (state) { @@ -204,6 +204,34 @@ zpool_state_to_name(vdev_state_t state, } /* + * Map POOL STATE to printed strings. + */ +const char * +zpool_pool_state_to_name(pool_state_t state) +{ + switch (state) { + case POOL_STATE_ACTIVE: + return (gettext("ACTIVE")); + case POOL_STATE_EXPORTED: + return (gettext("EXPORTED")); + case POOL_STATE_DESTROYED: + return (gettext("DESTROYED")); + case POOL_STATE_SPARE: + return (gettext("SPARE")); + case POOL_STATE_L2CACHE: + return (gettext("L2CACHE")); + case POOL_STATE_UNINITIALIZED: + return (gettext("UNINITIALIZED")); + case POOL_STATE_UNAVAIL: + return (gettext("UNAVAIL")); + case POOL_STATE_POTENTIALLY_ACTIVE: + return (gettext("POTENTIALLY_ACTIVE")); + } + + return (gettext("UNKNOWN")); +} + +/* * Get a zpool property value for 'prop' and return the value in * a pre-allocated buffer. */ @@ -3648,7 +3676,7 @@ find_start_block(nvlist_t *config) * stripped of any leading /dev path. */ int -zpool_label_disk(libzfs_handle_t *hdl, zpool_handle_t *zhp, char *name) +zpool_label_disk(libzfs_handle_t *hdl, zpool_handle_t *zhp, const char *name) { #ifdef sun char path[MAXPATHLEN]; From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 20:49:49 2012 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 7FEB0106566B; Thu, 5 Jan 2012 20:49:48 +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 537698FC12; Thu, 5 Jan 2012 20:49:48 +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 q05KnmrG055063; Thu, 5 Jan 2012 20:49:48 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05KnmFo055061; Thu, 5 Jan 2012 20:49:48 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201052049.q05KnmFo055061@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 5 Jan 2012 20:49:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229648 - stable/9/sys/dev/ed 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, 05 Jan 2012 20:49:49 -0000 Author: yongari Date: Thu Jan 5 20:49:48 2012 New Revision: 229648 URL: http://svn.freebsd.org/changeset/base/229648 Log: MFC r228286: Fix off by one error in mbuf access. Previously it caused panic. While I'm here use NULL to compare mbuf pointer and add additional check for zero length mbuf before accessing the mbuf. PR: kern/162932 Modified: stable/9/sys/dev/ed/if_ed.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/ed/if_ed.c ============================================================================== --- stable/9/sys/dev/ed/if_ed.c Thu Jan 5 20:41:40 2012 (r229647) +++ stable/9/sys/dev/ed/if_ed.c Thu Jan 5 20:49:48 2012 (r229648) @@ -1709,12 +1709,19 @@ ed_shmem_write_mbufs(struct ed_softc *sc break; } } - for (len = 0; m != 0; m = m->m_next) { - if (sc->isa16bit) - bus_space_write_region_2(sc->mem_bst, - sc->mem_bsh, dst, - mtod(m, uint16_t *), (m->m_len + 1)/ 2); - else + for (len = 0; m != NULL; m = m->m_next) { + if (m->m_len == 0) + continue; + if (sc->isa16bit) { + if (m->m_len > 1) + bus_space_write_region_2(sc->mem_bst, + sc->mem_bsh, dst, + mtod(m, uint16_t *), m->m_len / 2); + if ((m->m_len & 1) != 0) + bus_space_write_1(sc->mem_bst, sc->mem_bsh, + dst + m->m_len - 1, + *(mtod(m, uint8_t *) + m->m_len - 1)); + } else bus_space_write_region_1(sc->mem_bst, sc->mem_bsh, dst, mtod(m, uint8_t *), m->m_len); From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 21:17:06 2012 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 C47D3106567A; Thu, 5 Jan 2012 21:17:06 +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 B218A8FC17; Thu, 5 Jan 2012 21:17: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 q05LH6Bk055929; Thu, 5 Jan 2012 21:17:06 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05LH6jX055927; Thu, 5 Jan 2012 21:17:06 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201052117.q05LH6jX055927@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 5 Jan 2012 21:17: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: r229649 - stable/8/sys/dev/ed 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, 05 Jan 2012 21:17:06 -0000 Author: yongari Date: Thu Jan 5 21:17:06 2012 New Revision: 229649 URL: http://svn.freebsd.org/changeset/base/229649 Log: MFC r228286: Fix off by one error in mbuf access. Previously it caused panic. While I'm here use NULL to compare mbuf pointer and add additional check for zero length mbuf before accessing the mbuf. PR: kern/162932 Modified: stable/8/sys/dev/ed/if_ed.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/ed/if_ed.c ============================================================================== --- stable/8/sys/dev/ed/if_ed.c Thu Jan 5 20:49:48 2012 (r229648) +++ stable/8/sys/dev/ed/if_ed.c Thu Jan 5 21:17:06 2012 (r229649) @@ -1695,12 +1695,19 @@ ed_shmem_write_mbufs(struct ed_softc *sc break; } } - for (len = 0; m != 0; m = m->m_next) { - if (sc->isa16bit) - bus_space_write_region_2(sc->mem_bst, - sc->mem_bsh, dst, - mtod(m, uint16_t *), (m->m_len + 1)/ 2); - else + for (len = 0; m != NULL; m = m->m_next) { + if (m->m_len == 0) + continue; + if (sc->isa16bit) { + if (m->m_len > 1) + bus_space_write_region_2(sc->mem_bst, + sc->mem_bsh, dst, + mtod(m, uint16_t *), m->m_len / 2); + if ((m->m_len & 1) != 0) + bus_space_write_1(sc->mem_bst, sc->mem_bsh, + dst + m->m_len - 1, + *(mtod(m, uint8_t *) + m->m_len - 1)); + } else bus_space_write_region_1(sc->mem_bst, sc->mem_bsh, dst, mtod(m, uint8_t *), m->m_len); From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 21:18:35 2012 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 516C51065670; Thu, 5 Jan 2012 21:18:35 +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 3F2E98FC12; Thu, 5 Jan 2012 21:18: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 q05LIZv0056006; Thu, 5 Jan 2012 21:18:35 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05LIZCV056004; Thu, 5 Jan 2012 21:18:35 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201052118.q05LIZCV056004@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 5 Jan 2012 21:18:35 +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: r229650 - stable/7/sys/dev/ed 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, 05 Jan 2012 21:18:35 -0000 Author: yongari Date: Thu Jan 5 21:18:34 2012 New Revision: 229650 URL: http://svn.freebsd.org/changeset/base/229650 Log: MFC r228286: Fix off by one error in mbuf access. Previously it caused panic. While I'm here use NULL to compare mbuf pointer and add additional check for zero length mbuf before accessing the mbuf. PR: kern/162932 Modified: stable/7/sys/dev/ed/if_ed.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/ed/if_ed.c ============================================================================== --- stable/7/sys/dev/ed/if_ed.c Thu Jan 5 21:17:06 2012 (r229649) +++ stable/7/sys/dev/ed/if_ed.c Thu Jan 5 21:18:34 2012 (r229650) @@ -1689,12 +1689,19 @@ ed_shmem_write_mbufs(struct ed_softc *sc break; } } - for (len = 0; m != 0; m = m->m_next) { - if (sc->isa16bit) - bus_space_write_region_2(sc->mem_bst, - sc->mem_bsh, dst, - mtod(m, uint16_t *), (m->m_len + 1)/ 2); - else + for (len = 0; m != NULL; m = m->m_next) { + if (m->m_len == 0) + continue; + if (sc->isa16bit) { + if (m->m_len > 1) + bus_space_write_region_2(sc->mem_bst, + sc->mem_bsh, dst, + mtod(m, uint16_t *), m->m_len / 2); + if ((m->m_len & 1) != 0) + bus_space_write_1(sc->mem_bst, sc->mem_bsh, + dst + m->m_len - 1, + *(mtod(m, uint8_t *) + m->m_len - 1)); + } else bus_space_write_region_1(sc->mem_bst, sc->mem_bsh, dst, mtod(m, uint8_t *), m->m_len); From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 21:36:12 2012 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 73337106564A; Thu, 5 Jan 2012 21:36:12 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6084E8FC08; Thu, 5 Jan 2012 21:36:12 +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 q05LaCXk056684; Thu, 5 Jan 2012 21:36:12 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05LaCE2056678; Thu, 5 Jan 2012 21:36:12 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201201052136.q05LaCE2056678@svn.freebsd.org> From: Ulrich Spoerlein Date: Thu, 5 Jan 2012 21:36:12 +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: r229651 - in head: contrib/groff/tmac lib/libstdthreads share/man/man3 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, 05 Jan 2012 21:36:12 -0000 Author: uqs Date: Thu Jan 5 21:36:12 2012 New Revision: 229651 URL: http://svn.freebsd.org/changeset/base/229651 Log: Pull up vendor changes to mdoc(7) This switches us to using -isoC-2011 as the symbol name which is used by groff and mdocml. It follows the change to 4 digit years as done with IEEE Std 1003 post-1999. MFC after: 2 weeks (groff changes only) Modified: head/contrib/groff/tmac/doc-syms head/contrib/groff/tmac/groff_mdoc.man head/lib/libstdthreads/thrd_create.3 head/share/man/man3/ATOMIC_VAR_INIT.3 head/share/man/man3/tgmath.3 Modified: head/contrib/groff/tmac/doc-syms ============================================================================== --- head/contrib/groff/tmac/doc-syms Thu Jan 5 21:18:34 2012 (r229650) +++ head/contrib/groff/tmac/doc-syms Thu Jan 5 21:36:12 2012 (r229651) @@ -605,6 +605,8 @@ .ds doc-str-St--isoC \*[doc-Tn-font-size]ISO/IEC\*[doc-str-St] 9899:1990 .as doc-str-St--isoC " (\*[Lq]\*[doc-Tn-font-size]ISO\~C\^90\*[doc-str-St]\*[Rq]) .als doc-str-St--isoC-90 doc-str-St--isoC +.ds doc-str-St--isoC-2011 \*[doc-Tn-font-size]ISO/IEC\*[doc-str-St] 9899:2011 +.as doc-str-St--isoC-2011 " (\*[Lq]\*[doc-Tn-font-size]ISO\~C\^11\*[doc-str-St]\*[Rq]) .ds doc-str-St--isoC-99 \*[doc-Tn-font-size]ISO/IEC\*[doc-str-St] 9899:1999 .as doc-str-St--isoC-99 " (\*[Lq]\*[doc-Tn-font-size]ISO\~C\^99\*[doc-str-St]\*[Rq]) .ds doc-str-St--isoC-amd1 \*[doc-Tn-font-size]ISO/IEC\*[doc-str-St] 9899/AMD1:1995 @@ -613,8 +615,6 @@ .as doc-str-St--isoC-tcor1 " (\*[Lq]\*[doc-Tn-font-size]ISO\~C\^90\*[doc-str-St], Technical Corrigendum 1\*[Rq]) .ds doc-str-St--isoC-tcor2 \*[doc-Tn-font-size]ISO/IEC\*[doc-str-St] 9899/TCOR2:1995 .as doc-str-St--isoC-tcor2 " (\*[Lq]\*[doc-Tn-font-size]ISO\~C\^90\*[doc-str-St], Technical Corrigendum 2\*[Rq]) -.ds doc-str-St--isoC-11 \*[doc-Tn-font-size]ISO/IEC\*[doc-str-St] 9899:2011 -.as doc-str-St--isoC-11 " (\*[Lq]\*[doc-Tn-font-size]ISO\~C\^11\*[doc-str-St]\*[Rq]) . .\" POSIX Part 1: System API .ds doc-str-St--p1003.1 \*[doc-Tn-font-size]\%IEEE\*[doc-str-St] Std 1003.1 Modified: head/contrib/groff/tmac/groff_mdoc.man ============================================================================== --- head/contrib/groff/tmac/groff_mdoc.man Thu Jan 5 21:18:34 2012 (r229650) +++ head/contrib/groff/tmac/groff_mdoc.man Thu Jan 5 21:36:12 2012 (r229651) @@ -2038,8 +2038,8 @@ are: .St -isoC-90 .It Li \-isoC\-99 .St -isoC-99 -.It Li \-isoC\-11 -.St -isoC-11 +.It Li \-isoC\-2011 +.St -isoC-2011 .El .Pp . Modified: head/lib/libstdthreads/thrd_create.3 ============================================================================== --- head/lib/libstdthreads/thrd_create.3 Thu Jan 5 21:18:34 2012 (r229650) +++ head/lib/libstdthreads/thrd_create.3 Thu Jan 5 21:36:12 2012 (r229651) @@ -110,7 +110,7 @@ .Fn tss_set "tss_t key" "void *val" .Sh DESCRIPTION As of -.St -isoC-11 , +.St -isoC-2011 , the C standard includes an API for writing multithreaded applications. Since POSIX.1 already includes a threading API that is used by virtually any multithreaded application, the interface provided by the C standard @@ -252,7 +252,7 @@ code .Xr pthread 3 .Sh STANDARDS These functions are expected to conform to -.St -isoC-11 . +.St -isoC-2011 . .Sh HISTORY These functions appeared in .Fx 10.0 . Modified: head/share/man/man3/ATOMIC_VAR_INIT.3 ============================================================================== --- head/share/man/man3/ATOMIC_VAR_INIT.3 Thu Jan 5 21:18:34 2012 (r229650) +++ head/share/man/man3/ATOMIC_VAR_INIT.3 Thu Jan 5 21:36:12 2012 (r229651) @@ -274,7 +274,7 @@ When using GCC, all atomic operations ar .Dv memory_order_seq_cst . .Pp Instead of using the atomic operations provided by this interface, -.St -isoC-11 +.St -isoC-2011 allows the atomic variables to be modified directly using built-in language operators. This behaviour cannot be emulated for older compilers. @@ -292,7 +292,7 @@ datatypes, if supported by the CPU. .Xr atomic 9 .Sh STANDARDS These macros attempt to conform to -.St -isoC-11 . +.St -isoC-2011 . .Sh HISTORY These macros appeared in .Fx 10.0 . Modified: head/share/man/man3/tgmath.3 ============================================================================== --- head/share/man/man3/tgmath.3 Thu Jan 5 21:18:34 2012 (r229650) +++ head/share/man/man3/tgmath.3 Thu Jan 5 21:36:12 2012 (r229651) @@ -141,13 +141,13 @@ first appeared in .Fx 5.3 . .Sh COMPILER SUPPORT Before -.St -isoC-11 , +.St -isoC-2011 , the header .In tgmath.h could not be implemented with strictly conforming C code and needed special compiler support. As of -.St -isoC-11 , +.St -isoC-2011 , this header file can be implemented using the .Fn _Generic language keyword. From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 21:36:20 2012 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 C697E106564A; Thu, 5 Jan 2012 21:36:20 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B50398FC12; Thu, 5 Jan 2012 21:36:20 +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 q05LaKEq056726; Thu, 5 Jan 2012 21:36:20 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05LaK8C056724; Thu, 5 Jan 2012 21:36:20 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201201052136.q05LaK8C056724@svn.freebsd.org> From: Ulrich Spoerlein Date: Thu, 5 Jan 2012 21:36:20 +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: r229652 - head/sbin/recoverdisk 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, 05 Jan 2012 21:36:20 -0000 Author: uqs Date: Thu Jan 5 21:36:20 2012 New Revision: 229652 URL: http://svn.freebsd.org/changeset/base/229652 Log: Document the detrimental effect of kern.cam.XX.retry_count for recoverdisk(1) recoverdisk(1) wants to know about read errors when doing the 1MB/64k reads as fast as possible so it can continue and retry them later with smaller reads (down to sector size). Any retries by lower layers will only slow it down. Prodded by: arundel Modified: head/sbin/recoverdisk/recoverdisk.1 Modified: head/sbin/recoverdisk/recoverdisk.1 ============================================================================== --- head/sbin/recoverdisk/recoverdisk.1 Thu Jan 5 21:36:12 2012 (r229651) +++ head/sbin/recoverdisk/recoverdisk.1 Thu Jan 5 21:36:20 2012 (r229652) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 1, 2011 +.Dd Jan 5, 2012 .Dt RECOVERDISK 1 .Os .Sh NAME @@ -124,7 +124,11 @@ recoverdisk -b 0 /dev/ad3 /somewhere .Ed .Sh SEE ALSO -.Xr dd 1 +.Xr dd 1 , +.Xr ada 4, +.Xr cam 4, +.Xr cd 4, +.Xr da 4 .Sh HISTORY The .Nm @@ -149,6 +153,18 @@ flying by. This is harmless and can be avoided by setting .Fl b to no more than 128kB. +.Pp +.Nm +needs to know about read errors as fast as possible, i.e. retries by lower +layers will usually slow down the operation. +When using +.Xr cam 4 +attached drives, you may want to set kern.cam.XX.retry_count to zero, e.g.: +.Bd -literal +# sysctl kern.cam.ada.retry_count=0 +# sysctl kern.cam.cd.retry_count=0 +# sysctl kern.cam.da.retry_count=0 +.Ed .\".Pp .\"When reading from optical media, a bug in the GEOM framework will .\"prevent it from seeing that the media has been removed. From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 21:36:28 2012 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 CB49D106576A; Thu, 5 Jan 2012 21:36:28 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B90F78FC19; Thu, 5 Jan 2012 21:36: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 q05LaS0f056768; Thu, 5 Jan 2012 21:36:28 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05LaSdc056765; Thu, 5 Jan 2012 21:36:28 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201201052136.q05LaSdc056765@svn.freebsd.org> From: Ulrich Spoerlein Date: Thu, 5 Jan 2012 21:36:28 +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: r229653 - head/usr.sbin/bsnmpd/modules/snmp_wlan 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, 05 Jan 2012 21:36:28 -0000 Author: uqs Date: Thu Jan 5 21:36:28 2012 New Revision: 229653 URL: http://svn.freebsd.org/changeset/base/229653 Log: Partial backout of r228990, restore original MIB object name. It's too late to change this in 9.0 -- so we have a release with the misspelling in the wild and should not break users that depend on it. Deprecating/replacing it because of a one-char typo seems excessive. Modified: head/usr.sbin/bsnmpd/modules/snmp_wlan/BEGEMOT-WIRELESS-MIB.txt head/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_tree.def Modified: head/usr.sbin/bsnmpd/modules/snmp_wlan/BEGEMOT-WIRELESS-MIB.txt ============================================================================== --- head/usr.sbin/bsnmpd/modules/snmp_wlan/BEGEMOT-WIRELESS-MIB.txt Thu Jan 5 21:36:20 2012 (r229652) +++ head/usr.sbin/bsnmpd/modules/snmp_wlan/BEGEMOT-WIRELESS-MIB.txt Thu Jan 5 21:36:28 2012 (r229653) @@ -82,8 +82,8 @@ WlanMgmtReasonCode ::= TEXTUAL-CONVENTIO associationLeave(8), associationNotAuthenticated(9), -- XXX: TODO - FIXME - disassocPwrcapBad(10), - disassocSuperchanBad(11), + dissassocPwrcapBad(10), + dissassocSuperchanBad(11), ieInvalid(13), micFailure(14), fourWayHandshakeTimeout(15), Modified: head/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_tree.def ============================================================================== --- head/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_tree.def Thu Jan 5 21:36:20 2012 (r229652) +++ head/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_tree.def Thu Jan 5 21:36:28 2012 (r229653) @@ -75,8 +75,8 @@ typedef WlanMgmtReasonCode ENUM ( 7 notAssociated 8 associationLeave 9 associationNotAuthenticated - 10 disassocPwrcapBad - 11 disassocSuperchanBad + 10 dissassocPwrcapBad + 11 dissassocSuperchanBad 13 ieInvalid 14 micFailure 15 fourWayHandshakeTimeout From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 21:36:36 2012 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 9E619106574E; Thu, 5 Jan 2012 21:36:36 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 728558FC1A; Thu, 5 Jan 2012 21:36:36 +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 q05LaaPP056809; Thu, 5 Jan 2012 21:36:36 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05LaawO056807; Thu, 5 Jan 2012 21:36:36 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201201052136.q05LaawO056807@svn.freebsd.org> From: Ulrich Spoerlein Date: Thu, 5 Jan 2012 21:36: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: r229654 - head/usr.sbin/newsyslog 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, 05 Jan 2012 21:36:36 -0000 Author: uqs Date: Thu Jan 5 21:36:36 2012 New Revision: 229654 URL: http://svn.freebsd.org/changeset/base/229654 Log: Further fix a typo and spelling classic correctly in function names, too. Submitted by: Ben Kaduk Modified: head/usr.sbin/newsyslog/newsyslog.c Modified: head/usr.sbin/newsyslog/newsyslog.c ============================================================================== --- head/usr.sbin/newsyslog/newsyslog.c Thu Jan 5 21:36:28 2012 (r229653) +++ head/usr.sbin/newsyslog/newsyslog.c Thu Jan 5 21:36:36 2012 (r229654) @@ -1600,7 +1600,7 @@ delete_oldest_timelog(const struct conf_ * Generate a log filename, when using classic filenames. */ static void -gen_clasiclog_fname(char *fname, size_t fname_sz, const char *archive_dir, +gen_classiclog_fname(char *fname, size_t fname_sz, const char *archive_dir, const char *namepart, int numlogs_c) { @@ -1612,15 +1612,15 @@ gen_clasiclog_fname(char *fname, size_t } /* - * Delete a rotated logfiles, when using classic filenames. + * Delete a rotated logfile, when using classic filenames. */ static void -delete_clasiclog(const char *archive_dir, const char *namepart, int numlog_c) +delete_classiclog(const char *archive_dir, const char *namepart, int numlog_c) { char file1[MAXPATHLEN], zfile1[MAXPATHLEN]; int c; - gen_clasiclog_fname(file1, sizeof(file1), archive_dir, namepart, + gen_classiclog_fname(file1, sizeof(file1), archive_dir, namepart, numlog_c); for (c = 0; c < COMPRESS_TYPES; c++) { @@ -1744,10 +1744,10 @@ do_rotate(const struct conf_entry *ent) * kept ent->numlogs + 1 files. This code can go away * at some point in the future. */ - delete_clasiclog(dirpart, namepart, ent->numlogs); + delete_classiclog(dirpart, namepart, ent->numlogs); if (ent->numlogs > 0) - delete_clasiclog(dirpart, namepart, ent->numlogs - 1); + delete_classiclog(dirpart, namepart, ent->numlogs - 1); } @@ -1768,7 +1768,7 @@ do_rotate(const struct conf_entry *ent) /* Don't run the code to move down logs */ numlogs_c = -1; } else { - gen_clasiclog_fname(file1, sizeof(file1), dirpart, namepart, + gen_classiclog_fname(file1, sizeof(file1), dirpart, namepart, ent->numlogs - 1); numlogs_c = ent->numlogs - 2; /* copy for countdown */ } @@ -1777,7 +1777,7 @@ do_rotate(const struct conf_entry *ent) for (; numlogs_c >= 0; numlogs_c--) { (void) strlcpy(file2, file1, sizeof(file2)); - gen_clasiclog_fname(file1, sizeof(file1), dirpart, namepart, + gen_classiclog_fname(file1, sizeof(file1), dirpart, namepart, numlogs_c); logfile_suffix = get_logfile_suffix(file1); From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 21:36:45 2012 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 75A3410657D9; Thu, 5 Jan 2012 21:36:45 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 62B398FC18; Thu, 5 Jan 2012 21:36: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 q05LajpF056854; Thu, 5 Jan 2012 21:36:45 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05Laj0m056848; Thu, 5 Jan 2012 21:36:45 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201201052136.q05Laj0m056848@svn.freebsd.org> From: Ulrich Spoerlein Date: Thu, 5 Jan 2012 21:36: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: r229655 - in head: usr.bin/locate/locate usr.bin/mail usr.sbin/bluetooth/sdpd usr.sbin/pkg_install/lib 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, 05 Jan 2012 21:36:45 -0000 Author: uqs Date: Thu Jan 5 21:36:45 2012 New Revision: 229655 URL: http://svn.freebsd.org/changeset/base/229655 Log: Touch up some more small typos missed in the previous round. Reported by: Ben Kaduk et al. Modified: head/usr.bin/locate/locate/util.c head/usr.bin/mail/main.c head/usr.bin/mail/util.c head/usr.sbin/bluetooth/sdpd/server.c head/usr.sbin/pkg_install/lib/plist.c Modified: head/usr.bin/locate/locate/util.c ============================================================================== --- head/usr.bin/locate/locate/util.c Thu Jan 5 21:36:36 2012 (r229654) +++ head/usr.bin/locate/locate/util.c Thu Jan 5 21:36:45 2012 (r229655) @@ -219,15 +219,15 @@ tolower_word(word) /* * Read integer from mmap pointer. - * Essential a simple ``return *(int *)p'' but avoid sigbus + * Essentially a simple ``return *(int *)p'' but avoids sigbus * for integer alignment (SunOS 4.x, 5.x). * * Convert network byte order to host byte order if necessary. - * So we can read on FreeBSD/i386 (little endian) a locate database + * So we can read a locate database on FreeBSD/i386 (little endian) * which was built on SunOS/sparc (big endian). */ -int +int getwm(p) caddr_t p; { Modified: head/usr.bin/mail/main.c ============================================================================== --- head/usr.bin/mail/main.c Thu Jan 5 21:36:36 2012 (r229654) +++ head/usr.bin/mail/main.c Thu Jan 5 21:36:45 2012 (r229655) @@ -259,7 +259,7 @@ Usage: %s [-dEiInv] [-s subject] [-c cc- if (ef == NULL) ef = "%"; if (setfile(ef) <= 0) - /* Either an error has occurted, or no mail */ + /* Either an error has occurred, or no mail */ exit(1); else exit(0); Modified: head/usr.bin/mail/util.c ============================================================================== --- head/usr.bin/mail/util.c Thu Jan 5 21:36:36 2012 (r229654) +++ head/usr.bin/mail/util.c Thu Jan 5 21:36:45 2012 (r229655) @@ -550,7 +550,7 @@ newname: } /* - * Count the occurrances of c in str + * Count the occurrences of c in str */ int charcount(char *str, int c) Modified: head/usr.sbin/bluetooth/sdpd/server.c ============================================================================== --- head/usr.sbin/bluetooth/sdpd/server.c Thu Jan 5 21:36:36 2012 (r229654) +++ head/usr.sbin/bluetooth/sdpd/server.c Thu Jan 5 21:36:45 2012 (r229655) @@ -334,7 +334,7 @@ server_accept_client(server_p srv, int32 * The minimum L2CAP MTU is 43 bytes. That means we need * 65536 / 43 = ~1524 chunks to transfer maximum packet * size with minimum MTU. The "rsp_cs" field in fd_idx_t - * is 11 bit wide that gives us up to 2048 chunks. + * is 11 bits wide, which gives us up to 2048 chunks. */ if (omtu < NG_L2CAP_MTU_MINIMUM) { Modified: head/usr.sbin/pkg_install/lib/plist.c ============================================================================== --- head/usr.sbin/pkg_install/lib/plist.c Thu Jan 5 21:36:36 2012 (r229654) +++ head/usr.sbin/pkg_install/lib/plist.c Thu Jan 5 21:36:45 2012 (r229655) @@ -123,7 +123,7 @@ find_plist_option(Package *pkg, const ch /* * Delete plist item 'type' in the list (if 'name' is non-null, match it - * too.) If 'all' is set, delete all items, not just the first occurrance. + * too.) If 'all' is set, delete all items, not just the first occurrence. */ void delete_plist(Package *pkg, Boolean all, plist_t type, const char *name) From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 21:36:53 2012 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 86CA21065694; Thu, 5 Jan 2012 21:36:53 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6B3038FC20; Thu, 5 Jan 2012 21:36:53 +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 q05Lar5T056900; Thu, 5 Jan 2012 21:36:53 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05Larqq056895; Thu, 5 Jan 2012 21:36:53 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201201052136.q05Larqq056895@svn.freebsd.org> From: Ulrich Spoerlein Date: Thu, 5 Jan 2012 21:36:53 +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: r229656 - head/tools/regression/msdosfs 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, 05 Jan 2012 21:36:53 -0000 Author: uqs Date: Thu Jan 5 21:36:53 2012 New Revision: 229656 URL: http://svn.freebsd.org/changeset/base/229656 Log: Convert files over to UTF-8. These files contained various combinations of Big5, eucJP and KOI8-U encoded strings. The byte representations of their respective encodings have been translated to $'...' escape sequences as understood by our sh(1). With help from: jilles Modified: head/tools/regression/msdosfs/msdosfstest-3.sh head/tools/regression/msdosfs/msdosfstest-4.sh head/tools/regression/msdosfs/msdosfstest-5.sh head/tools/regression/msdosfs/msdosfstest-6.sh Modified: head/tools/regression/msdosfs/msdosfstest-3.sh ============================================================================== --- head/tools/regression/msdosfs/msdosfstest-3.sh Thu Jan 5 21:36:45 2012 (r229655) +++ head/tools/regression/msdosfs/msdosfstest-3.sh Thu Jan 5 21:36:53 2012 (r229656) @@ -9,8 +9,10 @@ mdconfig -a -t swap -s 128m -u 10 bsdlabel -w md10 auto newfs_msdos -F 16 -b 8192 /dev/md10a mount_msdosfs -L zh_TW.Big5 -D CP950 /dev/md10a /tmp/msdosfstest/ -mkdir /tmp/msdosfstest/012345678_¨¸´c¤§¬ü -cd /tmp/msdosfstest/012345678_¨¸´c¤§¬ü +# The comment is UTF-8, the actual command uses the Big5 representation. +# mkdir /tmp/msdosfstest/012345678_邪惡之美 +mkdir /tmp/msdosfstest/012345678_$'\250\270\264\143\244\247\254\374' +cd /tmp/msdosfstest/012345678_$'\250\270\264\143\244\247\254\374' if [ $? -eq 0 ]; then echo "ok 3"; else Modified: head/tools/regression/msdosfs/msdosfstest-4.sh ============================================================================== --- head/tools/regression/msdosfs/msdosfstest-4.sh Thu Jan 5 21:36:45 2012 (r229655) +++ head/tools/regression/msdosfs/msdosfstest-4.sh Thu Jan 5 21:36:53 2012 (r229656) @@ -8,12 +8,12 @@ mdconfig -a -t swap -s 128m -u 10 bsdlabel -w md10 auto newfs_msdos -F 16 -b 8192 /dev/md10a mount_msdosfs -L uk_UA.KOI8-U -D CP866 -l /dev/md10a /tmp/msdosfstest -# mkdir /tmp/msdosfstest/U+0456 (CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I) -mkdir /tmp/msdosfstest/¦ +# The comment is UTF-8, the actual command uses the KOI8-U representation. +# mkdir /tmp/msdosfstest/Ñ– (CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I) +mkdir /tmp/msdosfstest/$'\246' if [ $? -eq 0 ]; then echo "ok 4 (pass stage 1/3)" - # cd /tmp/msdosfstest/U+0456 (CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I) - cd /tmp/msdosfstest/¦ + cd /tmp/msdosfstest/$'\246' if [ $? -eq 0 ]; then echo "ok 4 (pass stage 2/3)" cd /tmp Modified: head/tools/regression/msdosfs/msdosfstest-5.sh ============================================================================== --- head/tools/regression/msdosfs/msdosfstest-5.sh Thu Jan 5 21:36:45 2012 (r229655) +++ head/tools/regression/msdosfs/msdosfstest-5.sh Thu Jan 5 21:36:53 2012 (r229656) @@ -10,18 +10,20 @@ mdconfig -a -t swap -s 128m -u 10 bsdlabel -w md10 auto newfs_msdos -F 16 -b 8192 /dev/md10a mount_msdosfs -L ja_JP.eucJP -D CP932 -l /dev/md10a /tmp/msdosfstest -# touch /tmp/msdosfstest/U+FF71 (HALFWIDTH KATAKANA LETTER A) -touch /tmp/msdosfstest/Ž± +# The comment is UTF-8, the actual command uses the eucJP representation. +# touch /tmp/msdosfstest/ï½± (HALFWIDTH KATAKANA LETTER A) +touch /tmp/msdosfstest/$'\216\261' if [ $? -eq 0 ]; then umount /tmp/msdosfstest mount_msdosfs -L ja_JP.eucJP -D CP932 -s /dev/md10a /tmp/msdosfstest - ls /tmp/msdosfstest/Ž± + ls /tmp/msdosfstest/$'\216\261' if [ $? -eq 0 ]; then echo "ok 5 (pass stage 1/2)" umount /tmp/msdosfstest mount_msdosfs -L uk_UA.KOI8-U -D CP866 -l /dev/md10a /tmp/msdosfstest - # ls /tmp/msdosfstest/0xb1 (MEDIUM SHADE) - ls /tmp/msdosfstest/‘ + # The comment is UTF-8, the actual command uses the KOI8-U representation. + # ls /tmp/msdosfstest/â–’ (MEDIUM SHADE) + ls /tmp/msdosfstest/$'\221' if [ $? -ne 0 ]; then # assume that U+FF71 was recorded with long name echo "ok 5 (pass stage 2/2)" Modified: head/tools/regression/msdosfs/msdosfstest-6.sh ============================================================================== --- head/tools/regression/msdosfs/msdosfstest-6.sh Thu Jan 5 21:36:45 2012 (r229655) +++ head/tools/regression/msdosfs/msdosfstest-6.sh Thu Jan 5 21:36:53 2012 (r229656) @@ -9,8 +9,13 @@ mdconfig -a -t swap -s 128m -u 10 bsdlabel -w md10 auto newfs_msdos -F 32 -b 8192 /dev/md10a mount_msdosfs -L zh_TW.Big5 -D CP950 /dev/md10a /tmp/msdosfstest/ -mkdir '/tmp/msdosfstest/¬O§_¬Ý¹L§{¶¡±`¨£ªº³\¯øªå²\®ü¼y¥\®b¦Y»\¶º²Ä¥|¶°' -cd '/tmp/msdosfstest/¬O§_¬Ý¹L§{¶¡±`¨£ªº³\¯øªå²\®ü¼y¥\®b¦Y»\¶º²Ä¥|¶°' +# The comment is UTF-8, the actual command uses the Big5 representation. +# mkdir /tmp/msdosfstest/是å¦çœ‹éŽåŠé–“常見的許茹芸淚海慶功宴åƒè“‹é£¯ç¬¬å››é›† +subdir=$'\254\117\247\137\254\335\271\114\247\173\266\241\261\140\250\243'\ +$'\252\272\263\134\257\370\252\345\262\134\256\374\274\171\245\134'\ +$'\256\142\246\131\273\134\266\272\262\304\245\174\266\260' +mkdir /tmp/msdosfstest/$subdir +cd /tmp/msdosfstest/$subdir if [ $? -eq 0 ]; then echo "ok 6"; else From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 21:43:33 2012 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 E1F1A1065673; Thu, 5 Jan 2012 21:43:33 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B5DCA8FC15; Thu, 5 Jan 2012 21:43:33 +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 q05LhX9I057137; Thu, 5 Jan 2012 21:43:33 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05LhXA2057133; Thu, 5 Jan 2012 21:43:33 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201201052143.q05LhXA2057133@svn.freebsd.org> From: Ulrich Spoerlein Date: Thu, 5 Jan 2012 21:43: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: r229657 - in head/share/man: man4 man5 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, 05 Jan 2012 21:43:34 -0000 Author: uqs Date: Thu Jan 5 21:43:33 2012 New Revision: 229657 URL: http://svn.freebsd.org/changeset/base/229657 Log: Apply Typo-B-Gone 2000 [TM] Modified: head/share/man/man4/apic.4 head/share/man/man4/carp.4 head/share/man/man5/ar.5 Modified: head/share/man/man4/apic.4 ============================================================================== --- head/share/man/man4/apic.4 Thu Jan 5 21:36:53 2012 (r229656) +++ head/share/man/man4/apic.4 Thu Jan 5 21:43:33 2012 (r229657) @@ -61,7 +61,7 @@ In addition, they are able to accept and I/O APICs contain a redirection table, which is used to route the interrupts they receive from peripheral buses to one or more local APICs. .Pp -Each local APIC includes one 32-bit programable timer. +Each local APIC includes one 32-bit programmable timer. This driver uses them to supply kernel with one event timer named "LAPIC". Event timer provided by the driver supports both one-shot an periodic modes. Because of local APIC nature it is per-CPU. Modified: head/share/man/man4/carp.4 ============================================================================== --- head/share/man/man4/carp.4 Thu Jan 5 21:36:53 2012 (r229656) +++ head/share/man/man4/carp.4 Thu Jan 5 21:43:33 2012 (r229657) @@ -193,7 +193,7 @@ This can be accomplished by using hooks. Master/slave events are signalled under system .Dv CARP . -Subsystem specifies vhid and name of interface, where event occured. +Subsystem specifies vhid and name of interface, where event occurred. Type of the message displays new state of vhid. Please see .Xr devd.conf 5 Modified: head/share/man/man5/ar.5 ============================================================================== --- head/share/man/man5/ar.5 Thu Jan 5 21:36:53 2012 (r229656) +++ head/share/man/man5/ar.5 Thu Jan 5 21:43:33 2012 (r229657) @@ -126,7 +126,7 @@ The BSD and SVR4/GNU variants use differ names for members. .Bl -tag -width "SVR4/GNU" .It "BSD" -File names that are upto 16 bytes long and which do not contain +File names that are up to 16 bytes long and which do not contain embedded spaces are stored directly in the .Ar ar_name field of the archive header. @@ -164,7 +164,7 @@ ASCII .Dq "A BC D" .Pc . .It "SVR4/GNU" -File names that are upto 15 characters long are stored directly in the +File names that are up to 15 characters long are stored directly in the .Ar ar_name field of the header, terminated by a .Dq Li / From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 21:49:43 2012 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 EBC06106566C; Thu, 5 Jan 2012 21:49:43 +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 9C5978FC15; Thu, 5 Jan 2012 21:49:43 +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 q05LnhiJ057430; Thu, 5 Jan 2012 21:49:43 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05Lnh2v057428; Thu, 5 Jan 2012 21:49:43 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201201052149.q05Lnh2v057428@svn.freebsd.org> From: Adrian Chadd Date: Thu, 5 Jan 2012 21:49:43 +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: r229658 - head/share/mk 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, 05 Jan 2012 21:49:44 -0000 Author: adrian Date: Thu Jan 5 21:49:43 2012 New Revision: 229658 URL: http://svn.freebsd.org/changeset/base/229658 Log: Allow crunchgen binary link generation to be disabled. If CRUNCH_GENERATE_LINKS is set to "no", then no links will be generated. This defaults to "yes" so things like release crunch building still works. Modified: head/share/mk/bsd.crunchgen.mk Modified: head/share/mk/bsd.crunchgen.mk ============================================================================== --- head/share/mk/bsd.crunchgen.mk Thu Jan 5 21:43:33 2012 (r229657) +++ head/share/mk/bsd.crunchgen.mk Thu Jan 5 21:49:43 2012 (r229658) @@ -22,6 +22,8 @@ # Specific links can be suppressed by setting # CRUNCH_SUPPRESS_LINK_$(NAME) to 1. # +# If CRUNCH_GENERATE_LINKS is set to no, no links will be generated. +# # $FreeBSD$ @@ -39,6 +41,7 @@ CANONICALOBJDIR:= ${MAKEOBJDIRPREFIX}${. .else CANONICALOBJDIR:= /usr/obj${.CURDIR} .endif +CRUNCH_GENERATE_LINKS?= yes CLEANFILES+= $(CONF) *.o *.lo *.c *.mk *.cache *.a *.h @@ -51,6 +54,7 @@ $(OUTPUTS): $(CRUNCH_SRCDIR_${P})/Makefi .else $(OUTPUTS): $(.CURDIR)/../../$(D)/$(P)/Makefile .endif +.if ${CRUNCH_GENERATE_LINKS} == "yes" .ifndef CRUNCH_SUPPRESS_LINK_${P} LINKS+= $(BINDIR)/$(PROG) $(BINDIR)/$(P) .endif @@ -59,6 +63,7 @@ LINKS+= $(BINDIR)/$(PROG) $(BINDIR)/$(P) LINKS+= $(BINDIR)/$(PROG) $(BINDIR)/$(A) .endif .endfor +.endif .endfor .endfor From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 21:50:51 2012 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 5CAC3106566C; Thu, 5 Jan 2012 21:50:51 +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 4B53F8FC13; Thu, 5 Jan 2012 21:50:51 +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 q05LopVw057537; Thu, 5 Jan 2012 21:50:51 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05LopWs057535; Thu, 5 Jan 2012 21:50:51 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201201052150.q05LopWs057535@svn.freebsd.org> From: Adrian Chadd Date: Thu, 5 Jan 2012 21:50:51 +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: r229659 - 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: Thu, 05 Jan 2012 21:50:51 -0000 Author: adrian Date: Thu Jan 5 21:50:50 2012 New Revision: 229659 URL: http://svn.freebsd.org/changeset/base/229659 Log: Allow extra directories to be added to the build-tools target. Things such as "sh" require local tools to be built before cross-compiling. This allows for extra software (that's built via LOCAL_DIRS) to also have a build-tools target where required. Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Thu Jan 5 21:49:43 2012 (r229658) +++ head/Makefile.inc1 Thu Jan 5 21:50:50 2012 (r229659) @@ -15,6 +15,8 @@ # -DNO_WWWUPDATE do not update www in ${MAKE} update # -DNO_CTF do not run the DTrace CTF conversion tools on built objects # LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list +# LOCAL_TOOL_DIRS="list of dirs" to add additional dirs to the build-tools +# list # TARGET="machine" to crossbuild world for a different machine type # TARGET_ARCH= may be required when a TARGET supports multiple endians @@ -104,6 +106,8 @@ CLEANDIR= clean cleandepend CLEANDIR= cleandir .endif +LOCAL_TOOL_DIRS?= '' + CVS?= cvs CVSFLAGS?= -A -P -d -I! SVN?= svn @@ -1101,6 +1105,7 @@ build-tools: bin/csh \ bin/sh \ ${_rescue} \ + ${LOCAL_TOOL_DIRS} \ lib/ncurses/ncurses \ lib/ncurses/ncursesw \ ${_share} \ From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 22:06:01 2012 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 84928106566B; Thu, 5 Jan 2012 22:06:01 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 731338FC18; Thu, 5 Jan 2012 22:06: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 q05M61J5058174; Thu, 5 Jan 2012 22:06:01 GMT (envelope-from andreast@svn.freebsd.org) Received: (from andreast@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05M61Hd058172; Thu, 5 Jan 2012 22:06:01 GMT (envelope-from andreast@svn.freebsd.org) Message-Id: <201201052206.q05M61Hd058172@svn.freebsd.org> From: Andreas Tobler Date: Thu, 5 Jan 2012 22:06: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: r229660 - head/sys/powerpc/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: Thu, 05 Jan 2012 22:06:01 -0000 Author: andreast Date: Thu Jan 5 22:06:01 2012 New Revision: 229660 URL: http://svn.freebsd.org/changeset/base/229660 Log: Fix build on powerpc64 too. The same as r229640. Modified: head/sys/powerpc/conf/GENERIC64 Modified: head/sys/powerpc/conf/GENERIC64 ============================================================================== --- head/sys/powerpc/conf/GENERIC64 Thu Jan 5 21:50:50 2012 (r229659) +++ head/sys/powerpc/conf/GENERIC64 Thu Jan 5 22:06:01 2012 (r229660) @@ -170,6 +170,10 @@ device cdce # Generic USB over Etherne device cue # CATC USB Ethernet device kue # Kawasaki LSI USB Ethernet +# Wireless NIC cards +options IEEE80211_SUPPORT_MESH +options AH_SUPPORT_AR5416 + # FireWire support device firewire # FireWire bus code device sbp # SCSI over FireWire (Requires scbus and da) From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 22:14:18 2012 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 CA98B106566C; Thu, 5 Jan 2012 22:14:18 +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 B85DF8FC13; Thu, 5 Jan 2012 22:14:18 +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 q05MEIFs058558; Thu, 5 Jan 2012 22:14:18 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05MEIY2058556; Thu, 5 Jan 2012 22:14:18 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201052214.q05MEIY2058556@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 22:14:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229661 - stable/9/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: Thu, 05 Jan 2012 22:14:18 -0000 Author: jhb Date: Thu Jan 5 22:14:18 2012 New Revision: 229661 URL: http://svn.freebsd.org/changeset/base/229661 Log: MFC 227577: The sys/sysctl.h header is needed when MFI_DEBUG is defined. Modified: stable/9/sys/dev/mfi/mfi_debug.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/mfi/mfi_debug.c ============================================================================== --- stable/9/sys/dev/mfi/mfi_debug.c Thu Jan 5 22:06:01 2012 (r229660) +++ stable/9/sys/dev/mfi/mfi_debug.c Thu Jan 5 22:14:18 2012 (r229661) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 22:14:50 2012 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 4408A1065672; Thu, 5 Jan 2012 22:14:50 +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 320BD8FC1A; Thu, 5 Jan 2012 22:14:50 +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 q05MEoYo058609; Thu, 5 Jan 2012 22:14:50 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05MEohw058607; Thu, 5 Jan 2012 22:14:50 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201052214.q05MEohw058607@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 22:14:50 +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: r229662 - stable/8/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: Thu, 05 Jan 2012 22:14:50 -0000 Author: jhb Date: Thu Jan 5 22:14:49 2012 New Revision: 229662 URL: http://svn.freebsd.org/changeset/base/229662 Log: MFC 227577: The sys/sysctl.h header is needed when MFI_DEBUG is defined. Modified: stable/8/sys/dev/mfi/mfi_debug.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/mfi/mfi_debug.c ============================================================================== --- stable/8/sys/dev/mfi/mfi_debug.c Thu Jan 5 22:14:18 2012 (r229661) +++ stable/8/sys/dev/mfi/mfi_debug.c Thu Jan 5 22:14:49 2012 (r229662) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 22:16:41 2012 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 9FF4D106564A; Thu, 5 Jan 2012 22:16:41 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8DC0A8FC16; Thu, 5 Jan 2012 22:16: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 q05MGffS058719; Thu, 5 Jan 2012 22:16:41 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05MGfLY058717; Thu, 5 Jan 2012 22:16:41 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201201052216.q05MGfLY058717@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 5 Jan 2012 22:16: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: r229663 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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, 05 Jan 2012 22:16:41 -0000 Author: pjd Date: Thu Jan 5 22:16:41 2012 New Revision: 229663 URL: http://svn.freebsd.org/changeset/base/229663 Log: - Allow to change vfs.zfs.arc_meta_limit at runtime. - Change vfs.zfs.arc_meta_used from CTLFLAG_RDTUN to CTLFLAG_RD, as it is not a tunable. MFC after: 3 days Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Thu Jan 5 22:14:49 2012 (r229662) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Thu Jan 5 22:16:41 2012 (r229663) @@ -464,10 +464,10 @@ static uint64_t arc_loaned_bytes; static uint64_t arc_meta_used; static uint64_t arc_meta_limit; static uint64_t arc_meta_max = 0; -SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, arc_meta_used, CTLFLAG_RDTUN, - &arc_meta_used, 0, "ARC metadata used"); -SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, arc_meta_limit, CTLFLAG_RDTUN, - &arc_meta_limit, 0, "ARC metadata limit"); +SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, arc_meta_used, CTLFLAG_RD, &arc_meta_used, 0, + "ARC metadata used"); +SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, arc_meta_limit, CTLFLAG_RW, &arc_meta_limit, 0, + "ARC metadata limit"); typedef struct l2arc_buf_hdr l2arc_buf_hdr_t; From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 22:28:41 2012 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 51EC41065673; Thu, 5 Jan 2012 22:28:41 +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 3D30F8FC0A; Thu, 5 Jan 2012 22:28: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 q05MSfuJ059133; Thu, 5 Jan 2012 22:28:41 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05MSfBa059126; Thu, 5 Jan 2012 22:28:41 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201052228.q05MSfBa059126@svn.freebsd.org> From: Martin Matuska Date: Thu, 5 Jan 2012 22:28:41 +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: r229664 - in stable/8/cddl/contrib/opensolaris: cmd/zdb cmd/zpool cmd/ztest head lib/libzfs/common lib/libzpool/common 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, 05 Jan 2012 22:28:41 -0000 Author: mm Date: Thu Jan 5 22:28:40 2012 New Revision: 229664 URL: http://svn.freebsd.org/changeset/base/229664 Log: MFC ZFS userland to reduce diff with stable/9: r224170, r224526, r226583, r226613, r226615, r226616 MFC r224170 (gibbs): Correct reporting of missing leaf vdevs so that the GUID required to perform pool actions is always displayed. cddl/contrib/opensolaris/cmd/zpool/zpool_main.c: The "zpool status" command reports the "last seen at" device node path when the vdev name is being reported by GUID. Augment this code to assume a GUID is reported when a device goes missing after initial boot in addition to the previous behavior of doing this for devices that aren't seen at boot. cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c: In zpool_vdev_name(), report recently missing devices by GUID. There is no guarantee they will return at their previous location. MFC r224526 (mm, userland part only): Fix serious bug in ZIL that can lead to pool corruption in the case of a held dataset during remount. Detailed description is available at: https://www.illumos.org/issues/883 illumos-gate revision: 13380:161b964a0e10 MFC r226583 (pjd): Make all the lines align properly. MFC r226613 (pjd) [1]: libzpool task_alloc: pass only valid flags to kmem_alloc tqflags may contain other flags besided those that are suitable for kmem_alloc == umem_alloc MFC r226615 (pjd) [1]: thr_create: new_thread_ID may be NULL MFC r226616 (pjd) [1]: zdb: access dp_free_bpobj only if pool version is >= SPA_VERSION_DEADLISTS Submitted by: avg [1] Modified: stable/8/cddl/contrib/opensolaris/cmd/zdb/zdb.c stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c stable/8/cddl/contrib/opensolaris/cmd/ztest/ztest.c stable/8/cddl/contrib/opensolaris/head/thread.h stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c stable/8/cddl/contrib/opensolaris/lib/libzpool/common/taskq.c Directory Properties: stable/8/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zdb/zdb.c Thu Jan 5 22:16:41 2012 (r229663) +++ stable/8/cddl/contrib/opensolaris/cmd/zdb/zdb.c Thu Jan 5 22:28:40 2012 (r229664) @@ -2190,8 +2190,10 @@ dump_block_stats(spa_t *spa) */ (void) bpobj_iterate_nofree(&spa->spa_deferred_bpobj, count_block_cb, &zcb, NULL); - (void) bpobj_iterate_nofree(&spa->spa_dsl_pool->dp_free_bpobj, - count_block_cb, &zcb, NULL); + if (spa_version(spa) >= SPA_VERSION_DEADLISTS) { + (void) bpobj_iterate_nofree(&spa->spa_dsl_pool->dp_free_bpobj, + count_block_cb, &zcb, NULL); + } if (dump_opt['c'] > 1) flags |= TRAVERSE_PREFETCH_DATA; Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Jan 5 22:16:41 2012 (r229663) +++ stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Jan 5 22:28:40 2012 (r229664) @@ -1217,10 +1217,11 @@ print_status_config(zpool_handle_t *zhp, } if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_NOT_PRESENT, - ¬present) == 0) { + ¬present) == 0 || + vs->vs_state <= VDEV_STATE_CANT_OPEN) { char *path; - verify(nvlist_lookup_string(nv, ZPOOL_CONFIG_PATH, &path) == 0); - (void) printf(" was %s", path); + if (nvlist_lookup_string(nv, ZPOOL_CONFIG_PATH, &path) == 0) + (void) printf(" was %s", path); } else if (vs->vs_aux != 0) { (void) printf(" "); @@ -3466,7 +3467,7 @@ print_scan_status(pool_scan_stat_t *ps) double fraction_done; char processed_buf[7], examined_buf[7], total_buf[7], rate_buf[7]; - (void) printf(gettext(" scan: ")); + (void) printf(gettext(" scan: ")); /* If there's never been a scan, there's not much to say. */ if (ps == NULL || ps->pss_func == POOL_SCAN_NONE || @@ -3546,7 +3547,7 @@ print_scan_status(pool_scan_stat_t *ps) /* * do not print estimated time if hours_left is more than 30 days */ - (void) printf(gettext(" %s scanned out of %s at %s/s"), + (void) printf(gettext(" %s scanned out of %s at %s/s"), examined_buf, total_buf, rate_buf); if (hours_left < (30 * 24)) { (void) printf(gettext(", %lluh%um to go\n"), @@ -3557,10 +3558,10 @@ print_scan_status(pool_scan_stat_t *ps) } if (ps->pss_func == POOL_SCAN_RESILVER) { - (void) printf(gettext(" %s resilvered, %.2f%% done\n"), + (void) printf(gettext(" %s resilvered, %.2f%% done\n"), processed_buf, 100 * fraction_done); } else if (ps->pss_func == POOL_SCAN_SCRUB) { - (void) printf(gettext(" %s repaired, %.2f%% done\n"), + (void) printf(gettext(" %s repaired, %.2f%% done\n"), processed_buf, 100 * fraction_done); } } Modified: stable/8/cddl/contrib/opensolaris/cmd/ztest/ztest.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/ztest/ztest.c Thu Jan 5 22:16:41 2012 (r229663) +++ stable/8/cddl/contrib/opensolaris/cmd/ztest/ztest.c Thu Jan 5 22:28:40 2012 (r229664) @@ -206,6 +206,7 @@ typedef struct ztest_od { */ typedef struct ztest_ds { objset_t *zd_os; + rwlock_t zd_zilog_lock; zilog_t *zd_zilog; uint64_t zd_seq; ztest_od_t *zd_od; /* debugging aid */ @@ -239,6 +240,7 @@ ztest_func_t ztest_dmu_commit_callbacks; ztest_func_t ztest_zap; ztest_func_t ztest_zap_parallel; ztest_func_t ztest_zil_commit; +ztest_func_t ztest_zil_remount; ztest_func_t ztest_dmu_read_write_zcopy; ztest_func_t ztest_dmu_objset_create_destroy; ztest_func_t ztest_dmu_prealloc; @@ -275,6 +277,7 @@ ztest_info_t ztest_info[] = { { ztest_zap_parallel, 100, &zopt_always }, { ztest_split_pool, 1, &zopt_always }, { ztest_zil_commit, 1, &zopt_incessant }, + { ztest_zil_remount, 1, &zopt_sometimes }, { ztest_dmu_read_write_zcopy, 1, &zopt_often }, { ztest_dmu_objset_create_destroy, 1, &zopt_often }, { ztest_dsl_prop_get_set, 1, &zopt_often }, @@ -990,6 +993,7 @@ ztest_zd_init(ztest_ds_t *zd, objset_t * zd->zd_seq = 0; dmu_objset_name(os, zd->zd_name); + VERIFY(rwlock_init(&zd->zd_zilog_lock, USYNC_THREAD, NULL) == 0); VERIFY(_mutex_init(&zd->zd_dirobj_lock, USYNC_THREAD, NULL) == 0); for (int l = 0; l < ZTEST_OBJECT_LOCKS; l++) @@ -1969,6 +1973,8 @@ ztest_io(ztest_ds_t *zd, uint64_t object if (ztest_random(2) == 0) io_type = ZTEST_IO_WRITE_TAG; + (void) rw_rdlock(&zd->zd_zilog_lock); + switch (io_type) { case ZTEST_IO_WRITE_TAG: @@ -2004,6 +2010,8 @@ ztest_io(ztest_ds_t *zd, uint64_t object break; } + (void) rw_unlock(&zd->zd_zilog_lock); + umem_free(data, blocksize); } @@ -2058,6 +2066,8 @@ ztest_zil_commit(ztest_ds_t *zd, uint64_ { zilog_t *zilog = zd->zd_zilog; + (void) rw_rdlock(&zd->zd_zilog_lock); + zil_commit(zilog, ztest_random(ZTEST_OBJECTS)); /* @@ -2069,6 +2079,31 @@ ztest_zil_commit(ztest_ds_t *zd, uint64_ ASSERT(zd->zd_seq <= zilog->zl_commit_lr_seq); zd->zd_seq = zilog->zl_commit_lr_seq; mutex_exit(&zilog->zl_lock); + + (void) rw_unlock(&zd->zd_zilog_lock); +} + +/* + * This function is designed to simulate the operations that occur during a + * mount/unmount operation. We hold the dataset across these operations in an + * attempt to expose any implicit assumptions about ZIL management. + */ +/* ARGSUSED */ +void +ztest_zil_remount(ztest_ds_t *zd, uint64_t id) +{ + objset_t *os = zd->zd_os; + + (void) rw_wrlock(&zd->zd_zilog_lock); + + /* zfsvfs_teardown() */ + zil_close(zd->zd_zilog); + + /* zfsvfs_setup() */ + VERIFY(zil_open(os, ztest_get_data) == zd->zd_zilog); + zil_replay(os, zd, ztest_replay_vector); + + (void) rw_unlock(&zd->zd_zilog_lock); } /* Modified: stable/8/cddl/contrib/opensolaris/head/thread.h ============================================================================== --- stable/8/cddl/contrib/opensolaris/head/thread.h Thu Jan 5 22:16:41 2012 (r229663) +++ stable/8/cddl/contrib/opensolaris/head/thread.h Thu Jan 5 22:28:40 2012 (r229664) @@ -76,6 +76,7 @@ static __inline int thr_create(void *stack_base, size_t stack_size, void *(*start_func) (void*), void *arg, long flags, thread_t *new_thread_ID) { + pthread_t dummy; int ret; assert(stack_base == NULL); @@ -85,9 +86,12 @@ thr_create(void *stack_base, size_t stac pthread_attr_t attr; pthread_attr_init(&attr); - if(flags & THR_DETACHED) + if (flags & THR_DETACHED) pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + if (new_thread_ID == NULL) + new_thread_ID = &dummy; + /* This function ignores the THR_BOUND flag, since NPTL doesn't seem to support PTHREAD_SCOPE_PROCESS */ ret = pthread_create(new_thread_ID, &attr, start_func, arg); Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Thu Jan 5 22:16:41 2012 (r229663) +++ stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Thu Jan 5 22:28:40 2012 (r229664) @@ -3153,15 +3153,25 @@ zpool_vdev_name(libzfs_handle_t *hdl, zp char buf[64]; vdev_stat_t *vs; uint_t vsc; + int have_stats; + int have_path; - if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_NOT_PRESENT, - &value) == 0) { + have_stats = nvlist_lookup_uint64_array(nv, ZPOOL_CONFIG_VDEV_STATS, + (uint64_t **)&vs, &vsc) == 0; + have_path = nvlist_lookup_string(nv, ZPOOL_CONFIG_PATH, &path) == 0; + + /* + * If the device is not currently present, assume it will not + * come back at the same device path. Display the device by GUID. + */ + if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_NOT_PRESENT, &value) == 0 || + have_path && have_stats && vs->vs_state <= VDEV_STATE_CANT_OPEN) { verify(nvlist_lookup_uint64(nv, ZPOOL_CONFIG_GUID, &value) == 0); (void) snprintf(buf, sizeof (buf), "%llu", (u_longlong_t)value); path = buf; - } else if (nvlist_lookup_string(nv, ZPOOL_CONFIG_PATH, &path) == 0) { + } else if (have_path) { /* * If the device is dead (faulted, offline, etc) then don't @@ -3169,8 +3179,7 @@ zpool_vdev_name(libzfs_handle_t *hdl, zp * open a misbehaving device, which can have undesirable * effects. */ - if ((nvlist_lookup_uint64_array(nv, ZPOOL_CONFIG_VDEV_STATS, - (uint64_t **)&vs, &vsc) != 0 || + if ((have_stats == 0 || vs->vs_state >= VDEV_STATE_DEGRADED) && zhp != NULL && nvlist_lookup_string(nv, ZPOOL_CONFIG_DEVID, &devid) == 0) { Modified: stable/8/cddl/contrib/opensolaris/lib/libzpool/common/taskq.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/lib/libzpool/common/taskq.c Thu Jan 5 22:16:41 2012 (r229663) +++ stable/8/cddl/contrib/opensolaris/lib/libzpool/common/taskq.c Thu Jan 5 22:28:40 2012 (r229664) @@ -87,7 +87,7 @@ again: if ((t = tq->tq_freelist) != NULL } mutex_exit(&tq->tq_lock); - t = kmem_alloc(sizeof (task_t), tqflags); + t = kmem_alloc(sizeof (task_t), tqflags & KM_SLEEP); mutex_enter(&tq->tq_lock); if (t != NULL) From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 22:29:12 2012 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 413B4106566B; Thu, 5 Jan 2012 22:29:12 +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 158B18FC08; Thu, 5 Jan 2012 22:29:12 +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 q05MTBBf059187; Thu, 5 Jan 2012 22:29:11 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05MTBMf059184; Thu, 5 Jan 2012 22:29:11 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201052229.q05MTBMf059184@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Jan 2012 22:29: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: r229665 - 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: Thu, 05 Jan 2012 22:29:12 -0000 Author: jhb Date: Thu Jan 5 22:29:11 2012 New Revision: 229665 URL: http://svn.freebsd.org/changeset/base/229665 Log: Remove the assertion from tcp_input() that rcv_nxt is always greater than or equal to rcv_adv and fix tcp_twstart() to handle this case by assuming the last window was zero rather than a negative value. The code in tcp_input() already safely handled this case. It can happen due to delayed ACKs along with a remote sender that sends data beyond the window we previously advertised. If we have room in our socket buffer for the extra data beyond the advertised window, we will accept it. However, if the ACK for that segment is delayed, then we will not effectively fixup rcv_adv to account for that extra data until the next segment arrives and forces out an ACK. When that next segment arrives, rcv_nxt will be beyond rcv_adv. Tested by: pjd MFC after: 1 week Modified: head/sys/netinet/tcp_input.c head/sys/netinet/tcp_timewait.c Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Thu Jan 5 22:28:40 2012 (r229664) +++ head/sys/netinet/tcp_input.c Thu Jan 5 22:29:11 2012 (r229665) @@ -1795,9 +1795,6 @@ tcp_do_segment(struct mbuf *m, struct tc win = sbspace(&so->so_rcv); if (win < 0) win = 0; - KASSERT(SEQ_GEQ(tp->rcv_adv, tp->rcv_nxt), - ("tcp_input negative window: tp %p rcv_nxt %u rcv_adv %u", tp, - tp->rcv_nxt, tp->rcv_adv)); tp->rcv_wnd = imax(win, (int)(tp->rcv_adv - tp->rcv_nxt)); /* Reset receive buffer auto scaling when not in bulk receive mode. */ Modified: head/sys/netinet/tcp_timewait.c ============================================================================== --- head/sys/netinet/tcp_timewait.c Thu Jan 5 22:28:40 2012 (r229664) +++ head/sys/netinet/tcp_timewait.c Thu Jan 5 22:29:11 2012 (r229665) @@ -242,10 +242,10 @@ tcp_twstart(struct tcpcb *tp) /* * Recover last window size sent. */ - KASSERT(SEQ_GEQ(tp->rcv_adv, tp->rcv_nxt), - ("tcp_twstart negative window: tp %p rcv_nxt %u rcv_adv %u", tp, - tp->rcv_nxt, tp->rcv_adv)); - tw->last_win = (tp->rcv_adv - tp->rcv_nxt) >> tp->rcv_scale; + if (SEQ_GE(tp->rcv_adv, tp->rcv_nxt)) + tw->last_win = (tp->rcv_adv - tp->rcv_nxt) >> tp->rcv_scale; + else + tw->last_win = 0; /* * Set t_recent if timestamps are used on the connection. From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 22:31:25 2012 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 BFD9A10656B0; Thu, 5 Jan 2012 22:31:25 +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 AD4308FC1C; Thu, 5 Jan 2012 22:31:25 +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 q05MVPxh059310; Thu, 5 Jan 2012 22:31:25 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05MVP9J059308; Thu, 5 Jan 2012 22:31:25 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201052231.q05MVP9J059308@svn.freebsd.org> From: Martin Matuska Date: Thu, 5 Jan 2012 22:31:25 +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: r229666 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs 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, 05 Jan 2012 22:31:25 -0000 Author: mm Date: Thu Jan 5 22:31:25 2012 New Revision: 229666 URL: http://svn.freebsd.org/changeset/base/229666 Log: MFC r226617 (pjd): zfs vdev_file_io_start: validate vdev before using vdev_tsd vdev_tsd can be NULL for certain vdev states. At least in userland testing with ztest. Submitted by: avg Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c Thu Jan 5 22:29:11 2012 (r229665) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c Thu Jan 5 22:31:25 2012 (r229666) @@ -153,17 +153,19 @@ static int vdev_file_io_start(zio_t *zio) { vdev_t *vd = zio->io_vd; - vdev_file_t *vf = vd->vdev_tsd; - vnode_t *vp = vf->vf_vnode; + vdev_file_t *vf; + vnode_t *vp; ssize_t resid; - if (zio->io_type == ZIO_TYPE_IOCTL) { - /* XXPOLICY */ - if (!vdev_readable(vd)) { - zio->io_error = ENXIO; - return (ZIO_PIPELINE_CONTINUE); - } + if (!vdev_readable(vd)) { + zio->io_error = ENXIO; + return (ZIO_PIPELINE_CONTINUE); + } + + vf = vd->vdev_tsd; + vp = vf->vf_vnode; + if (zio->io_type == ZIO_TYPE_IOCTL) { switch (zio->io_cmd) { case DKIOCFLUSHWRITECACHE: zio->io_error = VOP_FSYNC(vp, FSYNC | FDSYNC, From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 22:48:36 2012 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 B437C106566B; Thu, 5 Jan 2012 22:48:36 +0000 (UTC) (envelope-from ghelmer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A29C58FC18; Thu, 5 Jan 2012 22:48:36 +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 q05MmaPD059873; Thu, 5 Jan 2012 22:48:36 GMT (envelope-from ghelmer@svn.freebsd.org) Received: (from ghelmer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05MmaZk059871; Thu, 5 Jan 2012 22:48:36 GMT (envelope-from ghelmer@svn.freebsd.org) Message-Id: <201201052248.q05MmaZk059871@svn.freebsd.org> From: Guy Helmer Date: Thu, 5 Jan 2012 22:48: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: r229667 - head/usr.sbin/daemon 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, 05 Jan 2012 22:48:36 -0000 Author: ghelmer Date: Thu Jan 5 22:48:36 2012 New Revision: 229667 URL: http://svn.freebsd.org/changeset/base/229667 Log: Allow daemon(8) to run pidfile_open() before relenquishing privileges so pid files can be written in /var/run when started as root. I do not expect this to cause any security issues, but if anyone objects it could be easily reverted. PR: bin/159568 MFC after: 4 weeks Modified: head/usr.sbin/daemon/daemon.c Modified: head/usr.sbin/daemon/daemon.c ============================================================================== --- head/usr.sbin/daemon/daemon.c Thu Jan 5 22:31:25 2012 (r229666) +++ head/usr.sbin/daemon/daemon.c Thu Jan 5 22:48:36 2012 (r229667) @@ -79,9 +79,6 @@ main(int argc, char *argv[]) if (argc == 0) usage(); - if (user != NULL) - restrict_process(user); - /* * Try to open the pidfile before calling daemon(3), * to be able to report the error intelligently @@ -97,6 +94,9 @@ main(int argc, char *argv[]) } } + if (user != NULL) + restrict_process(user); + if (daemon(nochdir, noclose) == -1) err(1, NULL); From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 23:08:11 2012 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 E98A0106564A; Thu, 5 Jan 2012 23:08:11 +0000 (UTC) (envelope-from ghelmer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D7F308FC19; Thu, 5 Jan 2012 23:08: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 q05N8BGp060522; Thu, 5 Jan 2012 23:08:11 GMT (envelope-from ghelmer@svn.freebsd.org) Received: (from ghelmer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05N8BUx060520; Thu, 5 Jan 2012 23:08:11 GMT (envelope-from ghelmer@svn.freebsd.org) Message-Id: <201201052308.q05N8BUx060520@svn.freebsd.org> From: Guy Helmer Date: Thu, 5 Jan 2012 23:08: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: r229668 - head/usr.bin/newgrp 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, 05 Jan 2012 23:08:12 -0000 Author: ghelmer Date: Thu Jan 5 23:08:11 2012 New Revision: 229668 URL: http://svn.freebsd.org/changeset/base/229668 Log: Fix a memory leak in addgroup() by ensuring the allocated memory is freed if an error occurs. PR: bin/161510 MFC after: 4 weeks Modified: head/usr.bin/newgrp/newgrp.c Modified: head/usr.bin/newgrp/newgrp.c ============================================================================== --- head/usr.bin/newgrp/newgrp.c Thu Jan 5 22:48:36 2012 (r229667) +++ head/usr.bin/newgrp/newgrp.c Thu Jan 5 23:08:11 2012 (r229668) @@ -190,7 +190,7 @@ addgroup(const char *grpname) err(1, "malloc"); if ((ngrps = getgroups(ngrps_max, (gid_t *)grps)) < 0) { warn("getgroups"); - return; + goto end; } /* Remove requested gid from supp. list if it exists. */ @@ -204,7 +204,7 @@ addgroup(const char *grpname) if (setgroups(ngrps, (const gid_t *)grps) < 0) { PRIV_END; warn("setgroups"); - return; + goto end; } PRIV_END; } @@ -213,7 +213,7 @@ addgroup(const char *grpname) if (setgid(grp->gr_gid)) { PRIV_END; warn("setgid"); - return; + goto end; } PRIV_END; grps[0] = grp->gr_gid; @@ -228,12 +228,12 @@ addgroup(const char *grpname) if (setgroups(ngrps, (const gid_t *)grps)) { PRIV_END; warn("setgroups"); - return; + goto end; } PRIV_END; } } - +end: free(grps); } From owner-svn-src-all@FreeBSD.ORG Thu Jan 5 23:11:06 2012 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 0B7AB106566C; Thu, 5 Jan 2012 23:11:06 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EDF7E8FC12; Thu, 5 Jan 2012 23:11:05 +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 q05NB5Dq060660; Thu, 5 Jan 2012 23:11:05 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q05NB5gl060658; Thu, 5 Jan 2012 23:11:05 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <201201052311.q05NB5gl060658@svn.freebsd.org> From: Robert Watson Date: Thu, 5 Jan 2012 23:11: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: r229669 - head/contrib/pf/pfctl 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, 05 Jan 2012 23:11:06 -0000 Author: rwatson Date: Thu Jan 5 23:11:05 2012 New Revision: 229669 URL: http://svn.freebsd.org/changeset/base/229669 Log: Replace an OpenBSDism with a FreeBSDism in the pfctl(8) man page: we put configuration file man pages in section 5, and we prefer rc.conf to rc.conf.local. MFC after: 3 days Modified: head/contrib/pf/pfctl/pfctl.8 Modified: head/contrib/pf/pfctl/pfctl.8 ============================================================================== --- head/contrib/pf/pfctl/pfctl.8 Thu Jan 5 23:08:11 2012 (r229668) +++ head/contrib/pf/pfctl/pfctl.8 Thu Jan 5 23:11:05 2012 (r229669) @@ -88,7 +88,7 @@ When the variable is set to .Dv YES in -.Xr rc.conf.local 8 , +.Xr rc.conf 5 , the rule file specified with the variable .Va pf_rules is loaded automatically by the From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 00:19:31 2012 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 2F969106566C; Fri, 6 Jan 2012 00:19:31 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-tul01m020-f182.google.com (mail-tul01m020-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id C347E8FC17; Fri, 6 Jan 2012 00:19:30 +0000 (UTC) Received: by obbwd18 with SMTP id wd18so1800796obb.13 for ; Thu, 05 Jan 2012 16:19:30 -0800 (PST) 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:cc:content-type :content-transfer-encoding; bh=E1xE1Zi+syHw9mtJHpI0iMioaU9eIKWVLirksTtF8CU=; b=SU45Wa79BxH8ix1PtmpW3IIX4MDED3pEUdY3XWxXhxIn+Bg28BPdYss8SdaoKPwU56 13L3EVuxz2QL4d9N3URd7Mg0gUAsyloaezsx5r5ot1t3/CIv0TsvrRNhbGzVk0OAUjuB zmlwcYJ/ni/0IDhsBz2UIZ/DVIlP5KEPpArBU= MIME-Version: 1.0 Received: by 10.182.78.165 with SMTP id c5mr3187458obx.60.1325809170056; Thu, 05 Jan 2012 16:19:30 -0800 (PST) Sender: pluknet@gmail.com Received: by 10.182.171.67 with HTTP; Thu, 5 Jan 2012 16:19:29 -0800 (PST) In-Reply-To: <201201052229.q05MTBMf059184@svn.freebsd.org> References: <201201052229.q05MTBMf059184@svn.freebsd.org> Date: Fri, 6 Jan 2012 03:19:29 +0300 X-Google-Sender-Auth: 5D52Cw1Ijvgd_ZezHnhMeakpnQY Message-ID: From: Sergey Kandaurov To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r229665 - 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, 06 Jan 2012 00:19:31 -0000 On 6 January 2012 02:29, John Baldwin wrote: > Author: jhb > Date: Thu Jan =A05 22:29:11 2012 > New Revision: 229665 > URL: http://svn.freebsd.org/changeset/base/229665 > > Log: > =A0Remove the assertion from tcp_input() that rcv_nxt is always greater > =A0than or equal to rcv_adv and fix tcp_twstart() to handle this case by > =A0assuming the last window was zero rather than a negative value. > > =A0The code in tcp_input() already safely handled this case. =A0It can ha= ppen > =A0due to delayed ACKs along with a remote sender that sends data beyond > =A0the window we previously advertised. =A0If we have room in our socket = buffer > =A0for the extra data beyond the advertised window, we will accept it. > =A0However, if the ACK for that segment is delayed, then we will not > =A0effectively fixup rcv_adv to account for that extra data until the > =A0next segment arrives and forces out an ACK. =A0When that next segment > =A0arrives, rcv_nxt will be beyond rcv_adv. > > =A0Tested by: =A0 =A0pjd > =A0MFC after: =A0 =A01 week > > Modified: > =A0head/sys/netinet/tcp_input.c > =A0head/sys/netinet/tcp_timewait.c > > Modified: head/sys/netinet/tcp_input.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/netinet/tcp_input.c =A0 =A0 =A0 =A0Thu Jan =A05 22:28:40 201= 2 =A0 =A0 =A0 =A0(r229664) > +++ head/sys/netinet/tcp_input.c =A0 =A0 =A0 =A0Thu Jan =A05 22:29:11 201= 2 =A0 =A0 =A0 =A0(r229665) > @@ -1795,9 +1795,6 @@ tcp_do_segment(struct mbuf *m, struct tc > =A0 =A0 =A0 =A0win =3D sbspace(&so->so_rcv); > =A0 =A0 =A0 =A0if (win < 0) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0win =3D 0; > - =A0 =A0 =A0 KASSERT(SEQ_GEQ(tp->rcv_adv, tp->rcv_nxt), > - =A0 =A0 =A0 =A0 =A0 ("tcp_input negative window: tp %p rcv_nxt %u rcv_a= dv %u", tp, > - =A0 =A0 =A0 =A0 =A0 tp->rcv_nxt, tp->rcv_adv)); > =A0 =A0 =A0 =A0tp->rcv_wnd =3D imax(win, (int)(tp->rcv_adv - tp->rcv_nxt)= ); > > =A0 =A0 =A0 =A0/* Reset receive buffer auto scaling when not in bulk rece= ive mode. */ > > Modified: head/sys/netinet/tcp_timewait.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/netinet/tcp_timewait.c =A0 =A0 Thu Jan =A05 22:28:40 2012 = =A0 =A0 =A0 =A0(r229664) > +++ head/sys/netinet/tcp_timewait.c =A0 =A0 Thu Jan =A05 22:29:11 2012 = =A0 =A0 =A0 =A0(r229665) > @@ -242,10 +242,10 @@ tcp_twstart(struct tcpcb *tp) > =A0 =A0 =A0 =A0/* > =A0 =A0 =A0 =A0 * Recover last window size sent. > =A0 =A0 =A0 =A0 */ > - =A0 =A0 =A0 KASSERT(SEQ_GEQ(tp->rcv_adv, tp->rcv_nxt), > - =A0 =A0 =A0 =A0 =A0 ("tcp_twstart negative window: tp %p rcv_nxt %u rcv= _adv %u", tp, > - =A0 =A0 =A0 =A0 =A0 tp->rcv_nxt, tp->rcv_adv)); > - =A0 =A0 =A0 tw->last_win =3D (tp->rcv_adv - tp->rcv_nxt) >> tp->rcv_sca= le; > + =A0 =A0 =A0 if (SEQ_GE(tp->rcv_adv, tp->rcv_nxt)) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 tw->last_win =3D (tp->rcv_adv - tp->rcv_nxt= ) >> tp->rcv_scale; > + =A0 =A0 =A0 else > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 tw->last_win =3D 0; > > =A0 =A0 =A0 =A0/* > =A0 =A0 =A0 =A0 * Set t_recent if timestamps are used on the connection. Hi, Looks like a typo there: /usr/src/sys/netinet/tcp_timewait.c: In function 'tcp_twstart': /usr/src/sys/netinet/tcp_timewait.c:245: warning: implicit declaration of function 'SEQ_GE' /usr/src/sys/netinet/tcp_timewait.c:245: warning: nested extern declaration of 'SEQ_GE' [-Wnested-externs] --=20 wbr, pluknet From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 00:22:55 2012 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 B87D0106566C; Fri, 6 Jan 2012 00:22:55 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8C1808FC0C; Fri, 6 Jan 2012 00:22: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 q060MtLT063133; Fri, 6 Jan 2012 00:22:55 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q060MtMw063129; Fri, 6 Jan 2012 00:22:55 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201201060022.q060MtMw063129@svn.freebsd.org> From: Jim Harris Date: Fri, 6 Jan 2012 00:22: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: r229671 - in head/sys/dev: ahci ata ata/chipsets 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, 06 Jan 2012 00:22:55 -0000 Author: jimharris Date: Fri Jan 6 00:22:55 2012 New Revision: 229671 URL: http://svn.freebsd.org/changeset/base/229671 Log: Add 0x2826 device ID for C600 (Patsburg) SATA controller in RAID mode. Reviewed by: mav Approved by: scottl Modified: head/sys/dev/ahci/ahci.c head/sys/dev/ata/ata-pci.h head/sys/dev/ata/chipsets/ata-intel.c Modified: head/sys/dev/ahci/ahci.c ============================================================================== --- head/sys/dev/ahci/ahci.c Thu Jan 5 23:12:19 2012 (r229670) +++ head/sys/dev/ahci/ahci.c Fri Jan 6 00:22:55 2012 (r229671) @@ -171,6 +171,7 @@ static struct { {0x1d028086, 0x00, "Intel Patsburg", 0}, {0x1d048086, 0x00, "Intel Patsburg", 0}, {0x1d068086, 0x00, "Intel Patsburg", 0}, + {0x28268086, 0x00, "Intel Patsburg (RAID)", 0}, {0x1e028086, 0x00, "Intel Panther Point", 0}, {0x1e038086, 0x00, "Intel Panther Point", 0}, {0x1e048086, 0x00, "Intel Panther Point", 0}, Modified: head/sys/dev/ata/ata-pci.h ============================================================================== --- head/sys/dev/ata/ata-pci.h Thu Jan 5 23:12:19 2012 (r229670) +++ head/sys/dev/ata/ata-pci.h Fri Jan 6 00:22:55 2012 (r229671) @@ -236,6 +236,7 @@ struct ata_pci_controller { #define ATA_PBG_AH1 0x1d028086 #define ATA_PBG_R1 0x1d048086 #define ATA_PBG_R2 0x1d068086 +#define ATA_PBG_R3 0x28268086 #define ATA_PBG_S2 0x1d088086 #define ATA_PPT_S1 0x1e008086 Modified: head/sys/dev/ata/chipsets/ata-intel.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-intel.c Thu Jan 5 23:12:19 2012 (r229670) +++ head/sys/dev/ata/chipsets/ata-intel.c Fri Jan 6 00:22:55 2012 (r229671) @@ -197,6 +197,7 @@ ata_intel_probe(device_t dev) { ATA_PBG_AH1, 0, INTEL_AHCI, 0, ATA_SA300, "Patsburg" }, { ATA_PBG_R1, 0, INTEL_AHCI, 0, ATA_SA300, "Patsburg" }, { ATA_PBG_R2, 0, INTEL_AHCI, 0, ATA_SA300, "Patsburg" }, + { ATA_PBG_R3, 0, INTEL_AHCI, 0, ATA_SA300, "Patsburg" }, { ATA_PBG_S2, 0, INTEL_6CH2, 0, ATA_SA300, "Patsburg" }, { ATA_PPT_S1, 0, INTEL_6CH, 0, ATA_SA300, "Panther Point" }, { ATA_PPT_S2, 0, INTEL_6CH, 0, ATA_SA300, "Panther Point" }, From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 00:23:17 2012 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 93C771065708; Fri, 6 Jan 2012 00:23:17 +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 825128FC16; Fri, 6 Jan 2012 00:23: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 q060NHS0063182; Fri, 6 Jan 2012 00:23:17 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q060NHAZ063180; Fri, 6 Jan 2012 00:23:17 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201201060023.q060NHAZ063180@svn.freebsd.org> From: Sergey Kandaurov Date: Fri, 6 Jan 2012 00:23:17 +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: r229672 - 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, 06 Jan 2012 00:23:17 -0000 Author: pluknet Date: Fri Jan 6 00:23:17 2012 New Revision: 229672 URL: http://svn.freebsd.org/changeset/base/229672 Log: Fix a typo. X-MFC-with: 229665 Modified: head/sys/netinet/tcp_timewait.c Modified: head/sys/netinet/tcp_timewait.c ============================================================================== --- head/sys/netinet/tcp_timewait.c Fri Jan 6 00:22:55 2012 (r229671) +++ head/sys/netinet/tcp_timewait.c Fri Jan 6 00:23:17 2012 (r229672) @@ -242,7 +242,7 @@ tcp_twstart(struct tcpcb *tp) /* * Recover last window size sent. */ - if (SEQ_GE(tp->rcv_adv, tp->rcv_nxt)) + if (SEQ_GEQ(tp->rcv_adv, tp->rcv_nxt)) tw->last_win = (tp->rcv_adv - tp->rcv_nxt) >> tp->rcv_scale; else tw->last_win = 0; From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 00:34:27 2012 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 963581065675; Fri, 6 Jan 2012 00:34:27 +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 851348FC13; Fri, 6 Jan 2012 00:34:27 +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 q060YRa3063577; Fri, 6 Jan 2012 00:34:27 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q060YR69063575; Fri, 6 Jan 2012 00:34:27 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201201060034.q060YR69063575@svn.freebsd.org> From: Adrian Chadd Date: Fri, 6 Jan 2012 00:34:27 +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: r229673 - 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: Fri, 06 Jan 2012 00:34:27 -0000 Author: adrian Date: Fri Jan 6 00:34:27 2012 New Revision: 229673 URL: http://svn.freebsd.org/changeset/base/229673 Log: Fix the broken non-cross compile build. Oops! Another pointy hat to: adrian, for stirring up more trouble. Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Fri Jan 6 00:23:17 2012 (r229672) +++ head/Makefile.inc1 Fri Jan 6 00:34:27 2012 (r229673) @@ -106,7 +106,7 @@ CLEANDIR= clean cleandepend CLEANDIR= cleandir .endif -LOCAL_TOOL_DIRS?= '' +LOCAL_TOOL_DIRS?= CVS?= cvs CVSFLAGS?= -A -P -d -I! From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 00:42:33 2012 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 522F3106567A; Fri, 6 Jan 2012 00:42:33 +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 3F4FE8FC0C; Fri, 6 Jan 2012 00:42:33 +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 q060gXrS063846; Fri, 6 Jan 2012 00:42:33 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q060gX4o063843; Fri, 6 Jan 2012 00:42:33 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201201060042.q060gX4o063843@svn.freebsd.org> From: Rick Macklem Date: Fri, 6 Jan 2012 00:42:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229674 - in stable/9/sys/fs: nfs nfsclient 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, 06 Jan 2012 00:42:33 -0000 Author: rmacklem Date: Fri Jan 6 00:42:32 2012 New Revision: 229674 URL: http://svn.freebsd.org/changeset/base/229674 Log: MFC: r227760 Add two arguments to the nfsrpc_rellockown() function in the NFSv4 client. This does not change the client's behaviour, but prepares the code so that nfsrpc_rellockown() can be called elsewhere in a future commit. Modified: stable/9/sys/fs/nfs/nfs_var.h stable/9/sys/fs/nfsclient/nfs_clrpcops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/fs/nfs/nfs_var.h ============================================================================== --- stable/9/sys/fs/nfs/nfs_var.h Fri Jan 6 00:34:27 2012 (r229673) +++ stable/9/sys/fs/nfs/nfs_var.h Fri Jan 6 00:42:32 2012 (r229674) @@ -418,8 +418,8 @@ int nfsrpc_pathconf(vnode_t, struct nfsv struct ucred *, NFSPROC_T *, struct nfsvattr *, int *, void *); int nfsrpc_renew(struct nfsclclient *, struct ucred *, NFSPROC_T *); -int nfsrpc_rellockown(struct nfsmount *, struct nfscllockowner *, - struct ucred *, NFSPROC_T *); +int nfsrpc_rellockown(struct nfsmount *, struct nfscllockowner *, uint8_t *, + int, struct ucred *, NFSPROC_T *); int nfsrpc_getdirpath(struct nfsmount *, u_char *, struct ucred *, NFSPROC_T *); int nfsrpc_delegreturn(struct nfscldeleg *, struct ucred *, Modified: stable/9/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- stable/9/sys/fs/nfsclient/nfs_clrpcops.c Fri Jan 6 00:34:27 2012 (r229673) +++ stable/9/sys/fs/nfsclient/nfs_clrpcops.c Fri Jan 6 00:42:32 2012 (r229674) @@ -649,7 +649,8 @@ nfsrpc_doclose(struct nfsmount *nmp, str * puts on the wire has the file handle for this file appended * to it, so it can be done now. */ - (void)nfsrpc_rellockown(nmp, lp, tcred, p); + (void)nfsrpc_rellockown(nmp, lp, lp->nfsl_open->nfso_fh, + lp->nfsl_open->nfso_fhlen, tcred, p); } /* @@ -4027,7 +4028,7 @@ nfsrpc_renew(struct nfsclclient *clp, st */ APPLESTATIC int nfsrpc_rellockown(struct nfsmount *nmp, struct nfscllockowner *lp, - struct ucred *cred, NFSPROC_T *p) + uint8_t *fh, int fhlen, struct ucred *cred, NFSPROC_T *p) { struct nfsrv_descript nfsd, *nd = &nfsd; u_int32_t *tl; @@ -4039,10 +4040,8 @@ nfsrpc_rellockown(struct nfsmount *nmp, *tl++ = nmp->nm_clp->nfsc_clientid.lval[0]; *tl = nmp->nm_clp->nfsc_clientid.lval[1]; NFSBCOPY(lp->nfsl_owner, own, NFSV4CL_LOCKNAMELEN); - NFSBCOPY(lp->nfsl_open->nfso_fh, &own[NFSV4CL_LOCKNAMELEN], - lp->nfsl_open->nfso_fhlen); - (void)nfsm_strtom(nd, own, NFSV4CL_LOCKNAMELEN + - lp->nfsl_open->nfso_fhlen); + NFSBCOPY(fh, &own[NFSV4CL_LOCKNAMELEN], fhlen); + (void)nfsm_strtom(nd, own, NFSV4CL_LOCKNAMELEN + fhlen); nd->nd_flag |= ND_USEGSSNAME; error = newnfs_request(nd, nmp, NULL, &nmp->nm_sockreq, NULL, p, cred, NFS_PROG, NFS_VER4, NULL, 1, NULL); From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 00:56:31 2012 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 D471C106564A; Fri, 6 Jan 2012 00:56:31 +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 C1CE78FC14; Fri, 6 Jan 2012 00:56:31 +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 q060uVsZ064451; Fri, 6 Jan 2012 00:56:31 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q060uVJh064441; Fri, 6 Jan 2012 00:56:31 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201201060056.q060uVJh064441@svn.freebsd.org> From: Adrian Chadd Date: Fri, 6 Jan 2012 00:56:31 +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: r229675 - head/tools/bsdbox 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, 06 Jan 2012 00:56:31 -0000 Author: adrian Date: Fri Jan 6 00:56:31 2012 New Revision: 229675 URL: http://svn.freebsd.org/changeset/base/229675 Log: Import the first cut of "bsdbox". This uses the existing crunchgen infrastructure to build a series of tools designed to replace the base and networking tools on an embedded system. It reuses 'bsd.crunchgen.mk' to drive the actual file creation. The rescue build system also uses this. Unlike busybox, it doesn't include its own source - instead, it just builds from the sources in /usr/src/ and leverages the existing BSD framework. Thie is still quite messy and could do with a whole lot of cleaning up. However it is proving to be very useful with my current build framework, allowing me to build binary root images that are about 30% less than simply cherrypicking files and libraries from an installworld. Added: head/tools/bsdbox/ head/tools/bsdbox/Makefile (contents, props changed) head/tools/bsdbox/Makefile.base (contents, props changed) head/tools/bsdbox/Makefile.fs (contents, props changed) head/tools/bsdbox/Makefile.hostapd (contents, props changed) head/tools/bsdbox/Makefile.kld (contents, props changed) head/tools/bsdbox/Makefile.login (contents, props changed) head/tools/bsdbox/Makefile.net (contents, props changed) head/tools/bsdbox/Makefile.telnetd (contents, props changed) head/tools/bsdbox/Makefile.textproc (contents, props changed) head/tools/bsdbox/README (contents, props changed) Added: head/tools/bsdbox/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/bsdbox/Makefile Fri Jan 6 00:56:31 2012 (r229675) @@ -0,0 +1,115 @@ +#$FreeBSD$ +# @(#)Makefile 8.1 (Berkeley) 6/2/93 + +NO_MAN= + +.include +MK_SSP= no + +PROG= bsdbox +BINDIR?=/sbin + +################################################################# +# +# General notes: +# +# A number of Make variables are used to generate the crunchgen config file. +# +# CRUNCH_SRCDIRS: lists directories to search for included programs +# CRUNCH_PROGS: lists programs to be included +# CRUNCH_LIBS: libraries to statically link with +# CRUNCH_SHLIBS: libraries to dynamically link with +# CRUNCH_BUILDOPTS: generic build options to be added to every program +# CRUNCH_BUILDTOOLS: lists programs that need build tools built in the +# local architecture. +# +# Special options can be specified for individual programs +# CRUNCH_SRCDIR_$(P): base source directory for program $(P) +# CRUNCH_BUILDOPTS_$(P): additional build options for $(P) +# CRUNCH_ALIAS_$(P): additional names to be used for $(P) +# +# By default, any name appearing in CRUNCH_PROGS or CRUNCH_ALIAS_${P} +# will be used to generate a hard link to the resulting binary. +# Specific links can be suppressed by setting +# CRUNCH_SUPPRESS_LINK_$(NAME) to 1. +# + +# Define Makefile variable RESCUE +CRUNCH_BUILDOPTS+= -DRESCUE + +# Don't do symlinks as part of the install +CRUNCH_GENERATE_LINKS= no + +# Which sources have local-arch build tools? +# Define as blank; othrs need to override +CRUNCH_BUILDTOOLS= + +################################################################### +# Programs from stock /bin +# +# WARNING: Changing this list may require adjusting +# /usr/include/paths.h as well! You were warned! +# +CRUNCH_SRCDIRS+= bin +# These are required to be shared so login and su can run as +# setuid binaries - they use these libraries. PAM needs to be +# built dynamically or it tries to build _all_ of the modules +# statically - and that ends very badly. +CRUNCH_SHLIBS+= -lc -lutil +CRUNCH_LIBS+= -lkvm -lmemstat -lnetgraph +CRUNCH_LIBS+= -lcrypt -ledit -ll -ltermcap + +################################################################### +# Programs from standard /sbin +# +# WARNING: Changing this list may require adjusting +# /usr/include/paths.h as well! You were warned! +# +# Note that mdmfs have their own private 'pathnames.h' +# headers in addition to the standard 'paths.h' header. +# +CRUNCH_SRCDIRS+= sbin + +CRUNCH_LIBS+= -lalias -lcam -lcurses -ldevstat -lipsec +# Don't forget this - ifconfig, etc -adrian +.if ${MK_IPX} != "no" +CRUNCH_LIBS+= -lipx +.endif +CRUNCH_LIBS+= -lgeom -lbsdxml -ljail -lkiconv -lmd -lsbuf -lufs + +################################################################## +# Programs from stock /usr/bin +# +CRUNCH_SRCDIRS+= usr.bin +# grep +CRUNCH_LIBS+= -lbz2 + +################################################################## +# Programs from stock /usr/sbin +# +CRUNCH_SRCDIRS+= usr.sbin + +################################################################## + +CRUNCH_SRCDIRS+= libexec + +CRUNCH_LIBS+= -lm + +.include "Makefile.base" +.include "Makefile.net" +.include "Makefile.hostapd" +.include "Makefile.textproc" +.include "Makefile.login" +.include "Makefile.kld" +# telnet/telnetd are too broken to include as a crunchgen'ed binary, +# thanks to some of the horrible layering violations going on. +# .include "Makefile.telnetd" +.include "Makefile.fs" + +CRUNCH_LIBS+= -lcrypto -lssl -lz + +# the crunchgen build environment +.include + +# and since it creates a program.. +.include Added: head/tools/bsdbox/Makefile.base ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/bsdbox/Makefile.base Fri Jan 6 00:56:31 2012 (r229675) @@ -0,0 +1,55 @@ +# +# This builds a variety of "base" tools, useful for an embedded +# system. +# +# $FreeBSD$ +# +CRUNCH_PROGS_sbin+= dmesg sysctl init reboot +CRUNCH_PROGS_bin+= ls cat dd df cp hostname kill mkdir sleep ps ln rm hostname +CRUNCH_PROGS_usr.bin+= true false hexdump tail nc w head uname tset +CRUNCH_PROGS_usr.sbin+= gpioctl +CRUNCH_ALIAS_w= uptime +CRUNCH_ALIAS_tset= reset + +CRUNCH_PROGS_usr.bin+= vmstat systat +CRUNCH_LIBS+= -ldevstat -lncursesw -lncurses -lmemstat -lkvm + +CRUNCH_PROGS_usr.bin+= tar cpio +# XXX SSL ? +CRUNCH_LIBS+= -larchive -lbz2 -lz -llzma -lbsdxml -lssl -lcrypto + +# Clear requires tput, and it's a shell script so it won't be crunched +CRUNCH_PROGS_usr.bin+= tput + +# sh +CRUNCH_PROGS_bin+= sh +CRUNCH_ALIAS_sh= -sh +CRUNCH_SUPPRESS_LINK_-sh= 1 +CRUNCH_BUILDTOOLS+= bin/sh + +# chown +CRUNCH_PROGS_usr.sbin+= chown +CRUNCH_ALIAS_chown= chgrp + +# Basic filesystem stuff +CRUNCH_PROGS_sbin+= mount umount + +# grep +# grep doesn't yet work -adrian +CRUNCH_PROGS_usr.bin+= grep + +# less/more +CRUNCH_PROGS_usr.bin+= less +CRUNCH_ALIAS_less= more + +# passwd +CRUNCH_PROGS_usr.bin+= passwd +# These need to be shared, or PAM wants to include _all_ of the libraries +# at runtime. +CRUNCH_SHLIBS+= -lpam -lbsm + +# gzip/gunzip +CRUNCH_PROGS_usr.bin+= gzip +CRUNCH_ALIAS_gunzip= gzip +CRUNCH_ALIAS_gzcat= gzip +CRUNCH_LIBS+= -lz -llzma -lbz2 Added: head/tools/bsdbox/Makefile.fs ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/bsdbox/Makefile.fs Fri Jan 6 00:56:31 2012 (r229675) @@ -0,0 +1,17 @@ +# +# Filesystem related tools +# +# $FreeBSD$ + +# mfs +CRUNCH_PROGS_sbin+= mdmfs mdconfig newfs +CRUNCH_ALIAS_mdmfs= mount_mfs + +# UFS +CRUNCH_PROGS_sbin+= fsck_ffs +CRUNCH_LIBS+= -lgeom +CRUNCH_LIBS+= -lufs + +# msdos +# CRUNCH_PROGS_sbin+= mount_msdosfs +# CRUNCH_LIBS+= -lkiconv Added: head/tools/bsdbox/Makefile.hostapd ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/bsdbox/Makefile.hostapd Fri Jan 6 00:56:31 2012 (r229675) @@ -0,0 +1,15 @@ +# +# Build hostap/wpa_supplicant and supporting utilities. +# +# $FreeBSD$ +# +CRUNCH_PROGS_usr.sbin+= hostapd hostapd_cli +CRUNCH_SRCDIR_hostapd= $(.CURDIR)/../../usr.sbin/wpa/hostapd +CRUNCH_SRCDIR_hostapd_cli= $(.CURDIR)/../../usr.sbin/wpa/hostapd_cli + +CRUNCH_PROGS_usr.sbin+= wpa_supplicant wpa_cli +CRUNCH_SRCDIR_wpa_supplicant= $(.CURDIR)/../../usr.sbin/wpa/wpa_supplicant +CRUNCH_SRCDIR_wpa_cli= $(.CURDIR)/../../usr.sbin/wpa/wpa_cli + +CRUNCH_LIBS+= -lpcap + Added: head/tools/bsdbox/Makefile.kld ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/bsdbox/Makefile.kld Fri Jan 6 00:56:31 2012 (r229675) @@ -0,0 +1,6 @@ +# +# This builds the kld related programs. +# +# $FreeBSD$ +# +CRUNCH_PROGS_sbin+= kldload kldunload kldstat Added: head/tools/bsdbox/Makefile.login ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/bsdbox/Makefile.login Fri Jan 6 00:56:31 2012 (r229675) @@ -0,0 +1,9 @@ +# +# This builds login and friends. +# +# $FreeBSD$ +# + +CRUNCH_PROGS_libexec+= getty +CRUNCH_PROGS_usr.bin+= cap_mkdb +CRUNCH_PROGS_usr.sbin+= pwd_mkdb Added: head/tools/bsdbox/Makefile.net ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/bsdbox/Makefile.net Fri Jan 6 00:56:31 2012 (r229675) @@ -0,0 +1,32 @@ +# +# This builds network tools. +# +# $FreeBSD$ +# + +CRUNCH_PROGS_sbin+= route ping +CRUNCH_PROGS_usr.sbin+= arp + +# inetd +CRUNCH_PROGS_usr.sbin+= inetd +CRUNCH_LIBS+= -lwrap + +#.if ${MK_INET6_SUPPORT} != "no" +#CRUNCH_PROGS_sbin+= ping6 +#.endif + +# netstat +CRUNCH_PROGS_usr.bin+= netstat +CRUNCH_LIBS+= -lmemstat -lnetgraph +CRUNCH_BUILDOPTS_netstat=-DMK_IPX_SUPPORT=no + +# ifconfig +CRUNCH_PROGS_sbin+= ifconfig +CRUNCH_BUILDOPTS_ifconfig=-DMK_IPX_SUPPORT=no + +# wlan stuff +CRUNCH_PROGS_usr.sbin+= wlandebug + +# tcpdump +CRUNCH_PROGS_usr.sbin+= tcpdump +# CRUNCH_LIBS+= -lpcap -lcrypto Added: head/tools/bsdbox/Makefile.telnetd ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/bsdbox/Makefile.telnetd Fri Jan 6 00:56:31 2012 (r229675) @@ -0,0 +1,14 @@ +# Build telnetd +# Question - why is telnetds objects ending up in the srcdir? -adrian + +# This won't work yet - because telnetd relies on libtelnet.a which includes +# kerberos support by default; building telnetd without kerberos support +# requires the cross-build world to be built the same. +# -adrian + +# $FreeBSD$ + +CRUNCH_PROGS_libexec+= telnetd +CRUNCH_PROGS_usr.bin+= telnet +CRUNCH_LIBS+= -lkrb5 -lhx509 -lasn1 -lcom_err -lroken -ltelnetd +# CRUNCH_BUILDOPTS_telnetd= WITHOUT_KERBEROS_SUPPORT=yes Added: head/tools/bsdbox/Makefile.textproc ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/bsdbox/Makefile.textproc Fri Jan 6 00:56:31 2012 (r229675) @@ -0,0 +1,20 @@ +# +# This builds a variety of text processing tools that +# may be useful on an embedded device. +# +# $FreeBSD$ +# + +# Sed +CRUNCH_PROGS_usr.bin+= sed + +# Awk +# Disable - it's big! -adrian +#CRUNCH_PROGS_usr.bin+= awk +#CRUNCH_BUILDTOOLS+= usr.bin/awk + +# vi +# Disable - it's big! -adrian +#CRUNCH_PROGS_usr.bin+= vi + +CRUNCH_PROGS_usr.bin+= ee Added: head/tools/bsdbox/README ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/bsdbox/README Fri Jan 6 00:56:31 2012 (r229675) @@ -0,0 +1,12 @@ +$FreeBSD$ + +This is a very cut down implementation of a "busybox" style binary +for FreeBSD. + +It's based on the rescue build system, which uses the crunchgen functionality +to build binaries. + +It's a work in progress. + + -- adrian + From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 01:20:48 2012 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 957EC106566B; Fri, 6 Jan 2012 01:20:48 +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 79CFA8FC14; Fri, 6 Jan 2012 01:20:48 +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 q061Kmgt065239; Fri, 6 Jan 2012 01:20:48 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q061KmHr065236; Fri, 6 Jan 2012 01:20:48 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201201060120.q061KmHr065236@svn.freebsd.org> From: Rick Macklem Date: Fri, 6 Jan 2012 01:20:48 +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: r229676 - in stable/8/sys/fs: nfs nfsclient 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, 06 Jan 2012 01:20:48 -0000 Author: rmacklem Date: Fri Jan 6 01:20:48 2012 New Revision: 229676 URL: http://svn.freebsd.org/changeset/base/229676 Log: MFC: r227760 Add two arguments to the nfsrpc_rellockown() function in the NFSv4 client. This does not change the client's behaviour, but prepares the code so that nfsrpc_rellockown() can be called elsewhere in a future commit. Modified: stable/8/sys/fs/nfs/nfs_var.h stable/8/sys/fs/nfsclient/nfs_clrpcops.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/fs/nfs/nfs_var.h ============================================================================== --- stable/8/sys/fs/nfs/nfs_var.h Fri Jan 6 00:56:31 2012 (r229675) +++ stable/8/sys/fs/nfs/nfs_var.h Fri Jan 6 01:20:48 2012 (r229676) @@ -418,8 +418,8 @@ int nfsrpc_pathconf(vnode_t, struct nfsv struct ucred *, NFSPROC_T *, struct nfsvattr *, int *, void *); int nfsrpc_renew(struct nfsclclient *, struct ucred *, NFSPROC_T *); -int nfsrpc_rellockown(struct nfsmount *, struct nfscllockowner *, - struct ucred *, NFSPROC_T *); +int nfsrpc_rellockown(struct nfsmount *, struct nfscllockowner *, uint8_t *, + int, struct ucred *, NFSPROC_T *); int nfsrpc_getdirpath(struct nfsmount *, u_char *, struct ucred *, NFSPROC_T *); int nfsrpc_delegreturn(struct nfscldeleg *, struct ucred *, Modified: stable/8/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clrpcops.c Fri Jan 6 00:56:31 2012 (r229675) +++ stable/8/sys/fs/nfsclient/nfs_clrpcops.c Fri Jan 6 01:20:48 2012 (r229676) @@ -649,7 +649,8 @@ nfsrpc_doclose(struct nfsmount *nmp, str * puts on the wire has the file handle for this file appended * to it, so it can be done now. */ - (void)nfsrpc_rellockown(nmp, lp, tcred, p); + (void)nfsrpc_rellockown(nmp, lp, lp->nfsl_open->nfso_fh, + lp->nfsl_open->nfso_fhlen, tcred, p); } /* @@ -4027,7 +4028,7 @@ nfsrpc_renew(struct nfsclclient *clp, st */ APPLESTATIC int nfsrpc_rellockown(struct nfsmount *nmp, struct nfscllockowner *lp, - struct ucred *cred, NFSPROC_T *p) + uint8_t *fh, int fhlen, struct ucred *cred, NFSPROC_T *p) { struct nfsrv_descript nfsd, *nd = &nfsd; u_int32_t *tl; @@ -4039,10 +4040,8 @@ nfsrpc_rellockown(struct nfsmount *nmp, *tl++ = nmp->nm_clp->nfsc_clientid.lval[0]; *tl = nmp->nm_clp->nfsc_clientid.lval[1]; NFSBCOPY(lp->nfsl_owner, own, NFSV4CL_LOCKNAMELEN); - NFSBCOPY(lp->nfsl_open->nfso_fh, &own[NFSV4CL_LOCKNAMELEN], - lp->nfsl_open->nfso_fhlen); - (void)nfsm_strtom(nd, own, NFSV4CL_LOCKNAMELEN + - lp->nfsl_open->nfso_fhlen); + NFSBCOPY(fh, &own[NFSV4CL_LOCKNAMELEN], fhlen); + (void)nfsm_strtom(nd, own, NFSV4CL_LOCKNAMELEN + fhlen); nd->nd_flag |= ND_USEGSSNAME; error = newnfs_request(nd, nmp, NULL, &nmp->nm_sockreq, NULL, p, cred, NFS_PROG, NFS_VER4, NULL, 1, NULL); From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 01:23:26 2012 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 9C3B0106566C; Fri, 6 Jan 2012 01:23:26 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 890DE8FC0A; Fri, 6 Jan 2012 01:23: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 q061NQiS065382; Fri, 6 Jan 2012 01:23:26 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q061NQoM065373; Fri, 6 Jan 2012 01:23:26 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201201060123.q061NQoM065373@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Fri, 6 Jan 2012 01:23: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: r229677 - in head/sys/mips: cavium cavium/cryptocteon include mips 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, 06 Jan 2012 01:23:26 -0000 Author: gonzo Date: Fri Jan 6 01:23:26 2012 New Revision: 229677 URL: http://svn.freebsd.org/changeset/base/229677 Log: - Add better COP2 (crypto coprocessor) context handler for Octeon. Keep COP2 disabled and lazily allocate COP2 context structure in exception handler. Keep kernel and userland contexts separated. Added: head/sys/mips/cavium/octeon_cop2.S (contents, props changed) head/sys/mips/cavium/octeon_cop2.h (contents, props changed) head/sys/mips/include/octeon_cop2.h (contents, props changed) head/sys/mips/mips/octeon_cop2.c (contents, props changed) head/sys/mips/mips/octeon_cop2_swtch.S (contents, props changed) Modified: head/sys/mips/cavium/cryptocteon/cavium_crypto.c head/sys/mips/cavium/files.octeon1 head/sys/mips/include/cpuregs.h head/sys/mips/include/frame.h head/sys/mips/include/proc.h head/sys/mips/mips/exception.S head/sys/mips/mips/genassym.c head/sys/mips/mips/locore.S head/sys/mips/mips/pm_machdep.c head/sys/mips/mips/swtch.S head/sys/mips/mips/trap.c head/sys/mips/mips/vm_machdep.c Modified: head/sys/mips/cavium/cryptocteon/cavium_crypto.c ============================================================================== --- head/sys/mips/cavium/cryptocteon/cavium_crypto.c Fri Jan 6 01:20:48 2012 (r229676) +++ head/sys/mips/cavium/cryptocteon/cavium_crypto.c Fri Jan 6 01:23:26 2012 (r229677) @@ -87,22 +87,6 @@ __FBSDID("$FreeBSD$"); } \ } while (0) -static inline unsigned long octeon_crypto_enable(void) -{ - register_t s; - - s = intr_disable(); - mips_wr_status(mips_rd_status() | MIPS_SR_COP_2_BIT); - - return (s); -} - -static inline void octeon_crypto_disable(register_t s) -{ - mips_wr_status(mips_rd_status() & ~MIPS_SR_COP_2_BIT); - intr_restore(s); -} - #define ESP_HEADER_LENGTH 8 #define DES_CBC_IV_LENGTH 8 #define AES_CBC_IV_LENGTH 16 @@ -252,14 +236,12 @@ octo_calc_hash(uint8_t auth, unsigned ch uint64_t *key1; register uint64_t xor1 = 0x3636363636363636ULL; register uint64_t xor2 = 0x5c5c5c5c5c5c5c5cULL; - register_t s; dprintf("%s()\n", __func__); memset(hash_key, 0, sizeof(hash_key)); memcpy(hash_key, (uint8_t *) key, (auth ? 20 : 16)); key1 = (uint64_t *) hash_key; - s = octeon_crypto_enable(); if (auth) { CVMX_MT_HSH_IV(0x67452301EFCDAB89ULL, 0); CVMX_MT_HSH_IV(0x98BADCFE10325476ULL, 1); @@ -332,7 +314,6 @@ octo_calc_hash(uint8_t auth, unsigned ch outer[2] = 0; CVMX_MF_HSH_IV(outer[2], 2); } - octeon_crypto_disable(s); return; } @@ -349,7 +330,6 @@ octo_des_cbc_encrypt( { uint64_t *data; int data_i, data_l; - register_t s; dprintf("%s()\n", __func__); @@ -367,7 +347,6 @@ octo_des_cbc_encrypt( CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); - s = octeon_crypto_enable(); /* load 3DES Key */ CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 0); @@ -378,7 +357,6 @@ octo_des_cbc_encrypt( CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 1); CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 2); } else { - octeon_crypto_disable(s); dprintf("%s: Bad key length %d\n", __func__, od->octo_encklen); return -EINVAL; } @@ -397,7 +375,6 @@ octo_des_cbc_encrypt( crypt_len -= 8; } - octeon_crypto_disable(s); return 0; } @@ -412,7 +389,6 @@ octo_des_cbc_decrypt( { uint64_t *data; int data_i, data_l; - register_t s; dprintf("%s()\n", __func__); @@ -430,8 +406,6 @@ octo_des_cbc_decrypt( CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); - s = octeon_crypto_enable(); - /* load 3DES Key */ CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 0); if (od->octo_encklen == 24) { @@ -441,7 +415,6 @@ octo_des_cbc_decrypt( CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 1); CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 2); } else { - octeon_crypto_disable(s); dprintf("%s: Bad key length %d\n", __func__, od->octo_encklen); return -EINVAL; } @@ -460,7 +433,6 @@ octo_des_cbc_decrypt( crypt_len -= 8; } - octeon_crypto_disable(s); return 0; } @@ -477,7 +449,6 @@ octo_aes_cbc_encrypt( { uint64_t *data, *pdata; int data_i, data_l; - register_t s; dprintf("%s()\n", __func__); @@ -495,8 +466,6 @@ octo_aes_cbc_encrypt( CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); - s = octeon_crypto_enable(); - /* load AES Key */ CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[0], 0); CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[1], 1); @@ -511,7 +480,6 @@ octo_aes_cbc_encrypt( CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[2], 2); CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[3], 3); } else { - octeon_crypto_disable(s); dprintf("%s: Bad key length %d\n", __func__, od->octo_encklen); return -EINVAL; } @@ -536,7 +504,6 @@ octo_aes_cbc_encrypt( crypt_len -= 16; } - octeon_crypto_disable(s); return 0; } @@ -551,7 +518,6 @@ octo_aes_cbc_decrypt( { uint64_t *data, *pdata; int data_i, data_l; - register_t s; dprintf("%s()\n", __func__); @@ -569,8 +535,6 @@ octo_aes_cbc_decrypt( CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); - s = octeon_crypto_enable(); - /* load AES Key */ CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[0], 0); CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[1], 1); @@ -585,7 +549,6 @@ octo_aes_cbc_decrypt( CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[2], 2); CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[3], 3); } else { - octeon_crypto_disable(s); dprintf("%s: Bad key length %d\n", __func__, od->octo_encklen); return -EINVAL; } @@ -610,7 +573,6 @@ octo_aes_cbc_decrypt( crypt_len -= 16; } - octeon_crypto_disable(s); return 0; } @@ -629,7 +591,6 @@ octo_null_md5_encrypt( uint64_t *data; uint64_t tmp1, tmp2; int data_i, data_l, alen = auth_len; - register_t s; dprintf("%s()\n", __func__); @@ -644,8 +605,6 @@ octo_null_md5_encrypt( IOV_INIT(iov, data, data_i, data_l); - s = octeon_crypto_enable(); - /* Load MD5 IV */ CVMX_MT_HSH_IV(od->octo_hminner[0], 0); CVMX_MT_HSH_IV(od->octo_hminner[1], 1); @@ -716,7 +675,6 @@ octo_null_md5_encrypt( CVMX_MF_HSH_IV(tmp1, 1); *(uint32_t *)data = (uint32_t) (tmp1 >> 32); - octeon_crypto_disable(s); return 0; } @@ -735,7 +693,6 @@ octo_null_sha1_encrypt( uint64_t *data; uint64_t tmp1, tmp2, tmp3; int data_i, data_l, alen = auth_len; - register_t s; dprintf("%s()\n", __func__); @@ -750,8 +707,6 @@ octo_null_sha1_encrypt( IOV_INIT(iov, data, data_i, data_l); - s = octeon_crypto_enable(); - /* Load SHA1 IV */ CVMX_MT_HSH_IV(od->octo_hminner[0], 0); CVMX_MT_HSH_IV(od->octo_hminner[1], 1); @@ -825,7 +780,6 @@ octo_null_sha1_encrypt( CVMX_MF_HSH_IV(tmp1, 1); *(uint32_t *)data = (uint32_t) (tmp1 >> 32); - octeon_crypto_disable(s); return 0; } @@ -849,7 +803,6 @@ octo_des_cbc_md5_encrypt( uint32_t *data32; uint64_t tmp1, tmp2; int data_i, data_l, alen = auth_len; - register_t s; dprintf("%s()\n", __func__); @@ -870,8 +823,6 @@ octo_des_cbc_md5_encrypt( CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); - s = octeon_crypto_enable(); - /* load 3DES Key */ CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 0); if (od->octo_encklen == 24) { @@ -881,7 +832,6 @@ octo_des_cbc_md5_encrypt( CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 1); CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 2); } else { - octeon_crypto_disable(s); dprintf("%s: Bad key length %d\n", __func__, od->octo_encklen); return -EINVAL; } @@ -981,7 +931,6 @@ octo_des_cbc_md5_encrypt( CVMX_MF_HSH_IV(tmp1, 1); *data32 = (uint32_t) (tmp1 >> 32); - octeon_crypto_disable(s); return 0; } @@ -1002,7 +951,6 @@ octo_des_cbc_md5_decrypt( uint32_t *data32; uint64_t tmp1, tmp2; int data_i, data_l, alen = auth_len; - register_t s; dprintf("%s()\n", __func__); @@ -1023,8 +971,6 @@ octo_des_cbc_md5_decrypt( CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); - s = octeon_crypto_enable(); - /* load 3DES Key */ CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 0); if (od->octo_encklen == 24) { @@ -1034,7 +980,6 @@ octo_des_cbc_md5_decrypt( CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 1); CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 2); } else { - octeon_crypto_disable(s); dprintf("%s: Bad key length %d\n", __func__, od->octo_encklen); return -EINVAL; } @@ -1134,7 +1079,6 @@ octo_des_cbc_md5_decrypt( CVMX_MF_HSH_IV(tmp1, 1); *data32 = (uint32_t) (tmp1 >> 32); - octeon_crypto_disable(s); return 0; } @@ -1158,7 +1102,6 @@ octo_des_cbc_sha1_encrypt( uint32_t *data32; uint64_t tmp1, tmp2, tmp3; int data_i, data_l, alen = auth_len; - register_t s; dprintf("%s()\n", __func__); @@ -1179,8 +1122,6 @@ octo_des_cbc_sha1_encrypt( CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); - s = octeon_crypto_enable(); - /* load 3DES Key */ CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 0); if (od->octo_encklen == 24) { @@ -1190,7 +1131,6 @@ octo_des_cbc_sha1_encrypt( CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 1); CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 2); } else { - octeon_crypto_disable(s); dprintf("%s: Bad key length %d\n", __func__, od->octo_encklen); return -EINVAL; } @@ -1293,7 +1233,6 @@ octo_des_cbc_sha1_encrypt( CVMX_MF_HSH_IV(tmp1, 1); *data32 = (uint32_t) (tmp1 >> 32); - octeon_crypto_disable(s); return 0; } @@ -1314,7 +1253,6 @@ octo_des_cbc_sha1_decrypt( uint32_t *data32; uint64_t tmp1, tmp2, tmp3; int data_i, data_l, alen = auth_len; - register_t s; dprintf("%s()\n", __func__); @@ -1335,8 +1273,6 @@ octo_des_cbc_sha1_decrypt( CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); - s = octeon_crypto_enable(); - /* load 3DES Key */ CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 0); if (od->octo_encklen == 24) { @@ -1346,7 +1282,6 @@ octo_des_cbc_sha1_decrypt( CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 1); CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 2); } else { - octeon_crypto_disable(s); dprintf("%s: Bad key length %d\n", __func__, od->octo_encklen); return -EINVAL; } @@ -1448,7 +1383,6 @@ octo_des_cbc_sha1_decrypt( CVMX_MF_HSH_IV(tmp1, 1); *data32 = (uint32_t) (tmp1 >> 32); - octeon_crypto_disable(s); return 0; } @@ -1473,7 +1407,6 @@ octo_aes_cbc_md5_encrypt( uint32_t *data32; uint64_t tmp1, tmp2; int data_i, data_l, alen = auth_len; - register_t s; dprintf("%s()\n", __func__); @@ -1494,8 +1427,6 @@ octo_aes_cbc_md5_encrypt( CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); - s = octeon_crypto_enable(); - /* load AES Key */ CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[0], 0); CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[1], 1); @@ -1510,7 +1441,6 @@ octo_aes_cbc_md5_encrypt( CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[2], 2); CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[3], 3); } else { - octeon_crypto_disable(s); dprintf("%s: Bad key length %d\n", __func__, od->octo_encklen); return -EINVAL; } @@ -1633,7 +1563,6 @@ octo_aes_cbc_md5_encrypt( CVMX_MF_HSH_IV(tmp1, 1); *data32 = (uint32_t) (tmp1 >> 32); - octeon_crypto_disable(s); return 0; } @@ -1655,7 +1584,6 @@ octo_aes_cbc_md5_decrypt( uint32_t *data32; uint64_t tmp1, tmp2; int data_i, data_l, alen = auth_len; - register_t s; dprintf("%s()\n", __func__); @@ -1676,8 +1604,6 @@ octo_aes_cbc_md5_decrypt( CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); - s = octeon_crypto_enable(); - /* load AES Key */ CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[0], 0); CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[1], 1); @@ -1692,7 +1618,6 @@ octo_aes_cbc_md5_decrypt( CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[2], 2); CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[3], 3); } else { - octeon_crypto_disable(s); dprintf("%s: Bad key length %d\n", __func__, od->octo_encklen); return -EINVAL; } @@ -1811,7 +1736,6 @@ octo_aes_cbc_md5_decrypt( CVMX_MF_HSH_IV(tmp1, 1); *data32 = (uint32_t) (tmp1 >> 32); - octeon_crypto_disable(s); return 0; } @@ -1836,7 +1760,6 @@ octo_aes_cbc_sha1_encrypt( uint32_t *data32; uint64_t tmp1, tmp2, tmp3; int data_i, data_l, alen = auth_len; - register_t s; dprintf("%s()\n", __func__); @@ -1857,8 +1780,6 @@ octo_aes_cbc_sha1_encrypt( CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); - s = octeon_crypto_enable(); - /* load AES Key */ CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[0], 0); CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[1], 1); @@ -1873,7 +1794,6 @@ octo_aes_cbc_sha1_encrypt( CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[2], 2); CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[3], 3); } else { - octeon_crypto_disable(s); dprintf("%s: Bad key length %d\n", __func__, od->octo_encklen); return -EINVAL; } @@ -2015,7 +1935,6 @@ octo_aes_cbc_sha1_encrypt( CVMX_MF_HSH_IV(tmp1, 1); *data32 = (uint32_t) (tmp1 >> 32); - octeon_crypto_disable(s); return 0; } @@ -2037,7 +1956,6 @@ octo_aes_cbc_sha1_decrypt( uint32_t *data32; uint64_t tmp1, tmp2, tmp3; int data_i, data_l, alen = auth_len; - register_t s; dprintf("%s()\n", __func__); @@ -2058,8 +1976,6 @@ octo_aes_cbc_sha1_decrypt( CVMX_PREFETCH0(ivp); CVMX_PREFETCH0(od->octo_enckey); - s = octeon_crypto_enable(); - /* load AES Key */ CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[0], 0); CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[1], 1); @@ -2074,7 +1990,6 @@ octo_aes_cbc_sha1_decrypt( CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[2], 2); CVMX_MT_AES_KEY(((uint64_t *) od->octo_enckey)[3], 3); } else { - octeon_crypto_disable(s); dprintf("%s: Bad key length %d\n", __func__, od->octo_encklen); return -EINVAL; } @@ -2215,7 +2130,6 @@ octo_aes_cbc_sha1_decrypt( CVMX_MF_HSH_IV(tmp1, 1); *data32 = (uint32_t) (tmp1 >> 32); - octeon_crypto_disable(s); return 0; } Modified: head/sys/mips/cavium/files.octeon1 ============================================================================== --- head/sys/mips/cavium/files.octeon1 Fri Jan 6 01:20:48 2012 (r229676) +++ head/sys/mips/cavium/files.octeon1 Fri Jan 6 01:23:26 2012 (r229677) @@ -21,6 +21,8 @@ mips/cavium/octeon_nmi.S optional octe mips/cavium/cryptocteon/cavium_crypto.c optional cryptocteon mips/cavium/cryptocteon/cryptocteon.c optional cryptocteon +mips/mips/octeon_cop2_swtch.S standard +mips/mips/octeon_cop2.c standard mips/cavium/octe/ethernet.c optional octe mips/cavium/octe/ethernet-mv88e61xx.c optional octe octeon_vendor_lanner Added: head/sys/mips/cavium/octeon_cop2.S ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/cavium/octeon_cop2.S Fri Jan 6 01:23:26 2012 (r229677) @@ -0,0 +1,225 @@ +/*- + * Copyright (c) 2011 Oleksandr Tymoshenko + * 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 THE AUTHOR AND CONTRIBUTORS ``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 THE AUTHOR 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. + * + * $FreeBSD$ + */ + +#include +#include + +#include "assym.s" + +.set noreorder + +#define SAVE_COP2_REGISTER(reg) \ + dmfc2 t1, reg; sd t1, reg##_OFFSET(a0) + + +#define RESTORE_COP2_REGISTER(reg) \ + ld t1, reg##_OFFSET(a0); dmtc2 t1, reg##_SET + +LEAF(octeon_cop2_save) + /* Get CvmCtl register */ + dmfc0 t0, $9, 7 + + /* CRC state */ + SAVE_COP2_REGISTER(COP2_CRC_IV) + SAVE_COP2_REGISTER(COP2_CRC_LENGTH) + SAVE_COP2_REGISTER(COP2_CRC_POLY) + + /* if CvmCtl[NODFA_CP2] -> save_nodfa */ + bbit1 t0, 28, save_nodfa + nop + + /* LLM state */ + SAVE_COP2_REGISTER(COP2_LLM_DAT0) + SAVE_COP2_REGISTER(COP2_LLM_DAT1) + +save_nodfa: + /* crypto stuff is irrelevant if CvmCtl[NOCRYPTO] */ + bbit1 t0, 26, save_done + nop + + SAVE_COP2_REGISTER(COP2_3DES_IV) + SAVE_COP2_REGISTER(COP2_3DES_KEY0) + SAVE_COP2_REGISTER(COP2_3DES_KEY1) + SAVE_COP2_REGISTER(COP2_3DES_KEY2) + SAVE_COP2_REGISTER(COP2_3DES_RESULT) + + SAVE_COP2_REGISTER(COP2_AES_INP0) + SAVE_COP2_REGISTER(COP2_AES_IV0) + SAVE_COP2_REGISTER(COP2_AES_IV1) + SAVE_COP2_REGISTER(COP2_AES_KEY0) + SAVE_COP2_REGISTER(COP2_AES_KEY1) + SAVE_COP2_REGISTER(COP2_AES_KEY2) + SAVE_COP2_REGISTER(COP2_AES_KEY3) + SAVE_COP2_REGISTER(COP2_AES_KEYLEN) + SAVE_COP2_REGISTER(COP2_AES_RESULT0) + SAVE_COP2_REGISTER(COP2_AES_RESULT1) + + dmfc0 t0, $15 + li t1, 0x000d0000 /* Octeon Pass1 */ + beq t0, t1, save_pass1 + nop + + SAVE_COP2_REGISTER(COP2_HSH_DATW0) + SAVE_COP2_REGISTER(COP2_HSH_DATW1) + SAVE_COP2_REGISTER(COP2_HSH_DATW2) + SAVE_COP2_REGISTER(COP2_HSH_DATW3) + SAVE_COP2_REGISTER(COP2_HSH_DATW4) + SAVE_COP2_REGISTER(COP2_HSH_DATW5) + SAVE_COP2_REGISTER(COP2_HSH_DATW6) + SAVE_COP2_REGISTER(COP2_HSH_DATW7) + SAVE_COP2_REGISTER(COP2_HSH_DATW8) + SAVE_COP2_REGISTER(COP2_HSH_DATW9) + SAVE_COP2_REGISTER(COP2_HSH_DATW10) + SAVE_COP2_REGISTER(COP2_HSH_DATW11) + SAVE_COP2_REGISTER(COP2_HSH_DATW12) + SAVE_COP2_REGISTER(COP2_HSH_DATW13) + SAVE_COP2_REGISTER(COP2_HSH_DATW14) + SAVE_COP2_REGISTER(COP2_HSH_IVW0) + SAVE_COP2_REGISTER(COP2_HSH_IVW1) + SAVE_COP2_REGISTER(COP2_HSH_IVW2) + SAVE_COP2_REGISTER(COP2_HSH_IVW3) + SAVE_COP2_REGISTER(COP2_HSH_IVW4) + SAVE_COP2_REGISTER(COP2_HSH_IVW5) + SAVE_COP2_REGISTER(COP2_HSH_IVW6) + SAVE_COP2_REGISTER(COP2_HSH_IVW7) + SAVE_COP2_REGISTER(COP2_GFM_MULT0) + SAVE_COP2_REGISTER(COP2_GFM_MULT1) + SAVE_COP2_REGISTER(COP2_GFM_POLY) + SAVE_COP2_REGISTER(COP2_GFM_RESULT0) + SAVE_COP2_REGISTER(COP2_GFM_RESULT1) + jr ra + nop + +save_pass1: + SAVE_COP2_REGISTER(COP2_HSH_DATW0_PASS1) + SAVE_COP2_REGISTER(COP2_HSH_DATW1_PASS1) + SAVE_COP2_REGISTER(COP2_HSH_DATW2_PASS1) + SAVE_COP2_REGISTER(COP2_HSH_DATW3_PASS1) + SAVE_COP2_REGISTER(COP2_HSH_DATW4_PASS1) + SAVE_COP2_REGISTER(COP2_HSH_DATW5_PASS1) + SAVE_COP2_REGISTER(COP2_HSH_DATW6_PASS1) + SAVE_COP2_REGISTER(COP2_HSH_IVW0_PASS1) + SAVE_COP2_REGISTER(COP2_HSH_IVW1_PASS1) + SAVE_COP2_REGISTER(COP2_HSH_IVW2_PASS1) + +save_done: + jr ra + nop +END(octeon_cop2_save) + +LEAF(octeon_cop2_restore) + /* Get CvmCtl register */ + dmfc0 t0, $9, 7 + + /* CRC state */ + RESTORE_COP2_REGISTER(COP2_CRC_IV) + RESTORE_COP2_REGISTER(COP2_CRC_LENGTH) + RESTORE_COP2_REGISTER(COP2_CRC_POLY) + + /* if CvmCtl[NODFA_CP2] -> save_nodfa */ + bbit1 t0, 28, restore_nodfa + nop + + /* LLM state */ + RESTORE_COP2_REGISTER(COP2_LLM_DAT0) + RESTORE_COP2_REGISTER(COP2_LLM_DAT1) + +restore_nodfa: + /* crypto stuff is irrelevant if CvmCtl[NOCRYPTO] */ + bbit1 t0, 26, restore_done + nop + + RESTORE_COP2_REGISTER(COP2_3DES_IV) + RESTORE_COP2_REGISTER(COP2_3DES_KEY0) + RESTORE_COP2_REGISTER(COP2_3DES_KEY1) + RESTORE_COP2_REGISTER(COP2_3DES_KEY2) + RESTORE_COP2_REGISTER(COP2_3DES_RESULT) + + RESTORE_COP2_REGISTER(COP2_AES_INP0) + RESTORE_COP2_REGISTER(COP2_AES_IV0) + RESTORE_COP2_REGISTER(COP2_AES_IV1) + RESTORE_COP2_REGISTER(COP2_AES_KEY0) + RESTORE_COP2_REGISTER(COP2_AES_KEY1) + RESTORE_COP2_REGISTER(COP2_AES_KEY2) + RESTORE_COP2_REGISTER(COP2_AES_KEY3) + RESTORE_COP2_REGISTER(COP2_AES_KEYLEN) + RESTORE_COP2_REGISTER(COP2_AES_RESULT0) + RESTORE_COP2_REGISTER(COP2_AES_RESULT1) + + dmfc0 t0, $15 + li t1, 0x000d0000 /* Octeon Pass1 */ + beq t0, t1, restore_pass1 + nop + + RESTORE_COP2_REGISTER(COP2_HSH_DATW0) + RESTORE_COP2_REGISTER(COP2_HSH_DATW1) + RESTORE_COP2_REGISTER(COP2_HSH_DATW2) + RESTORE_COP2_REGISTER(COP2_HSH_DATW3) + RESTORE_COP2_REGISTER(COP2_HSH_DATW4) + RESTORE_COP2_REGISTER(COP2_HSH_DATW5) + RESTORE_COP2_REGISTER(COP2_HSH_DATW6) + RESTORE_COP2_REGISTER(COP2_HSH_DATW7) + RESTORE_COP2_REGISTER(COP2_HSH_DATW8) + RESTORE_COP2_REGISTER(COP2_HSH_DATW9) + RESTORE_COP2_REGISTER(COP2_HSH_DATW10) + RESTORE_COP2_REGISTER(COP2_HSH_DATW11) + RESTORE_COP2_REGISTER(COP2_HSH_DATW12) + RESTORE_COP2_REGISTER(COP2_HSH_DATW13) + RESTORE_COP2_REGISTER(COP2_HSH_DATW14) + RESTORE_COP2_REGISTER(COP2_HSH_IVW0) + RESTORE_COP2_REGISTER(COP2_HSH_IVW1) + RESTORE_COP2_REGISTER(COP2_HSH_IVW2) + RESTORE_COP2_REGISTER(COP2_HSH_IVW3) + RESTORE_COP2_REGISTER(COP2_HSH_IVW4) + RESTORE_COP2_REGISTER(COP2_HSH_IVW5) + RESTORE_COP2_REGISTER(COP2_HSH_IVW6) + RESTORE_COP2_REGISTER(COP2_HSH_IVW7) + RESTORE_COP2_REGISTER(COP2_GFM_MULT0) + RESTORE_COP2_REGISTER(COP2_GFM_MULT1) + RESTORE_COP2_REGISTER(COP2_GFM_POLY) + RESTORE_COP2_REGISTER(COP2_GFM_RESULT0) + RESTORE_COP2_REGISTER(COP2_GFM_RESULT1) + jr ra + nop + +restore_pass1: + RESTORE_COP2_REGISTER(COP2_HSH_DATW0_PASS1) + RESTORE_COP2_REGISTER(COP2_HSH_DATW1_PASS1) + RESTORE_COP2_REGISTER(COP2_HSH_DATW2_PASS1) + RESTORE_COP2_REGISTER(COP2_HSH_DATW3_PASS1) + RESTORE_COP2_REGISTER(COP2_HSH_DATW4_PASS1) + RESTORE_COP2_REGISTER(COP2_HSH_DATW5_PASS1) + RESTORE_COP2_REGISTER(COP2_HSH_DATW6_PASS1) + RESTORE_COP2_REGISTER(COP2_HSH_IVW0_PASS1) + RESTORE_COP2_REGISTER(COP2_HSH_IVW1_PASS1) + RESTORE_COP2_REGISTER(COP2_HSH_IVW2_PASS1) + +restore_done: + jr ra + nop +END(octeon_cop2_restore) Added: head/sys/mips/cavium/octeon_cop2.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/cavium/octeon_cop2.h Fri Jan 6 01:23:26 2012 (r229677) @@ -0,0 +1,210 @@ +/*- + * Copyright (c) 2011, Oleksandr Tymoshenko + * 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 unmodified, 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 THE AUTHOR AND CONTRIBUTORS ``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 THE AUTHOR 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. + * + * $FreeBSD$ + * + */ + +#ifndef __OCTEON_COP2_H__ +#define __OCTEON_COP2_H__ + +/* + * COP2 registers of interest + */ +#define COP2_CRC_IV 0x201 +#define COP2_CRC_IV_SET COP2_CRC_IV +#define COP2_CRC_LENGTH 0x202 +#define COP2_CRC_LENGTH_SET 0x1202 +#define COP2_CRC_POLY 0x200 +#define COP2_CRC_POLY_SET 0x4200 +#define COP2_LLM_DAT0 0x402 +#define COP2_LLM_DAT0_SET COP2_LLM_DAT0 +#define COP2_LLM_DAT1 0x40A +#define COP2_LLM_DAT1_SET COP2_LLM_DAT1 +#define COP2_3DES_IV 0x084 +#define COP2_3DES_IV_SET COP2_3DES_IV +#define COP2_3DES_KEY0 0x080 +#define COP2_3DES_KEY0_SET COP2_3DES_KEY0 +#define COP2_3DES_KEY1 0x081 +#define COP2_3DES_KEY1_SET COP2_3DES_KEY1 +#define COP2_3DES_KEY2 0x082 +#define COP2_3DES_KEY2_SET COP2_3DES_KEY2 +#define COP2_3DES_RESULT 0x088 +#define COP2_3DES_RESULT_SET 0x098 +#define COP2_AES_INP0 0x111 +#define COP2_AES_INP0_SET COP2_AES_INP0 +#define COP2_AES_IV0 0x102 +#define COP2_AES_IV0_SET COP2_AES_IV0 +#define COP2_AES_IV1 0x103 +#define COP2_AES_IV1_SET COP2_AES_IV1 +#define COP2_AES_KEY0 0x104 +#define COP2_AES_KEY0_SET COP2_AES_KEY0 +#define COP2_AES_KEY1 0x105 +#define COP2_AES_KEY1_SET COP2_AES_KEY1 +#define COP2_AES_KEY2 0x106 +#define COP2_AES_KEY2_SET COP2_AES_KEY2 +#define COP2_AES_KEY3 0x107 +#define COP2_AES_KEY3_SET COP2_AES_KEY3 +#define COP2_AES_KEYLEN 0x110 +#define COP2_AES_KEYLEN_SET COP2_AES_KEYLEN +#define COP2_AES_RESULT0 0x100 +#define COP2_AES_RESULT0_SET COP2_AES_RESULT0 +#define COP2_AES_RESULT1 0x101 +#define COP2_AES_RESULT1_SET COP2_AES_RESULT1 +#define COP2_HSH_DATW0 0x240 +#define COP2_HSH_DATW0_SET COP2_HSH_DATW0 +#define COP2_HSH_DATW1 0x241 +#define COP2_HSH_DATW1_SET COP2_HSH_DATW1 +#define COP2_HSH_DATW2 0x242 +#define COP2_HSH_DATW2_SET COP2_HSH_DATW2 +#define COP2_HSH_DATW3 0x243 +#define COP2_HSH_DATW3_SET COP2_HSH_DATW3 +#define COP2_HSH_DATW4 0x244 +#define COP2_HSH_DATW4_SET COP2_HSH_DATW4 +#define COP2_HSH_DATW5 0x245 +#define COP2_HSH_DATW5_SET COP2_HSH_DATW5 +#define COP2_HSH_DATW6 0x246 +#define COP2_HSH_DATW6_SET COP2_HSH_DATW6 +#define COP2_HSH_DATW7 0x247 +#define COP2_HSH_DATW7_SET COP2_HSH_DATW7 +#define COP2_HSH_DATW8 0x248 +#define COP2_HSH_DATW8_SET COP2_HSH_DATW8 +#define COP2_HSH_DATW9 0x249 +#define COP2_HSH_DATW9_SET COP2_HSH_DATW9 +#define COP2_HSH_DATW10 0x24A +#define COP2_HSH_DATW10_SET COP2_HSH_DATW10 +#define COP2_HSH_DATW11 0x24B +#define COP2_HSH_DATW11_SET COP2_HSH_DATW11 +#define COP2_HSH_DATW12 0x24C +#define COP2_HSH_DATW12_SET COP2_HSH_DATW12 +#define COP2_HSH_DATW13 0x24D +#define COP2_HSH_DATW13_SET COP2_HSH_DATW13 +#define COP2_HSH_DATW14 0x24E +#define COP2_HSH_DATW14_SET COP2_HSH_DATW14 +#define COP2_HSH_IVW0 0x250 +#define COP2_HSH_IVW0_SET COP2_HSH_IVW0 +#define COP2_HSH_IVW1 0x251 +#define COP2_HSH_IVW1_SET COP2_HSH_IVW1 +#define COP2_HSH_IVW2 0x252 +#define COP2_HSH_IVW2_SET COP2_HSH_IVW2 +#define COP2_HSH_IVW3 0x253 +#define COP2_HSH_IVW3_SET COP2_HSH_IVW3 +#define COP2_HSH_IVW4 0x254 +#define COP2_HSH_IVW4_SET COP2_HSH_IVW4 +#define COP2_HSH_IVW5 0x255 +#define COP2_HSH_IVW5_SET COP2_HSH_IVW5 +#define COP2_HSH_IVW6 0x256 +#define COP2_HSH_IVW6_SET COP2_HSH_IVW6 +#define COP2_HSH_IVW7 0x257 +#define COP2_HSH_IVW7_SET COP2_HSH_IVW7 +#define COP2_GFM_MULT0 0x258 +#define COP2_GFM_MULT0_SET COP2_GFM_MULT0 +#define COP2_GFM_MULT1 0x259 +#define COP2_GFM_MULT1_SET COP2_GFM_MULT1 +#define COP2_GFM_POLY 0x25E +#define COP2_GFM_POLY_SET COP2_GFM_POLY +#define COP2_GFM_RESULT0 0x25A +#define COP2_GFM_RESULT0_SET COP2_GFM_RESULT0 +#define COP2_GFM_RESULT1 0x25B +#define COP2_GFM_RESULT1_SET COP2_GFM_RESULT1 +#define COP2_HSH_DATW0_PASS1 0x040 +#define COP2_HSH_DATW0_PASS1_SET COP2_HSH_DATW0_PASS1 +#define COP2_HSH_DATW1_PASS1 0x041 +#define COP2_HSH_DATW1_PASS1_SET COP2_HSH_DATW1_PASS1 +#define COP2_HSH_DATW2_PASS1 0x042 +#define COP2_HSH_DATW2_PASS1_SET COP2_HSH_DATW2_PASS1 +#define COP2_HSH_DATW3_PASS1 0x043 +#define COP2_HSH_DATW3_PASS1_SET COP2_HSH_DATW3_PASS1 +#define COP2_HSH_DATW4_PASS1 0x044 +#define COP2_HSH_DATW4_PASS1_SET COP2_HSH_DATW4_PASS1 +#define COP2_HSH_DATW5_PASS1 0x045 +#define COP2_HSH_DATW5_PASS1_SET COP2_HSH_DATW5_PASS1 +#define COP2_HSH_DATW6_PASS1 0x046 +#define COP2_HSH_DATW6_PASS1_SET COP2_HSH_DATW6_PASS1 +#define COP2_HSH_IVW0_PASS1 0x048 +#define COP2_HSH_IVW0_PASS1_SET COP2_HSH_IVW0_PASS1 +#define COP2_HSH_IVW1_PASS1 0x049 +#define COP2_HSH_IVW1_PASS1_SET COP2_HSH_IVW1_PASS1 +#define COP2_HSH_IVW2_PASS1 0x04A +#define COP2_HSH_IVW2_PASS1_SET COP2_HSH_IVW2_PASS1 + +#ifndef LOCORE + +struct octeon_cop2_state { + /* 3DES */ + /* 0x0084 */ + unsigned long _3des_iv; + /* 0x0080..0x0082 */ + unsigned long _3des_key[3]; + /* 0x0088, set: 0x0098 */ + unsigned long _3des_result; + + /* AES */ + /* 0x0111 */ + unsigned long aes_inp0; + /* 0x0102..0x0103 */ + unsigned long aes_iv[2]; + /* 0x0104..0x0107 */ + unsigned long aes_key[4]; + /* 0x0110 */ + unsigned long aes_keylen; + /* 0x0100..0x0101 */ + unsigned long aes_result[2]; + + /* CRC */ + /* 0x0201 */ + unsigned long crc_iv; + /* 0x0202, set: 0x1202 */ + unsigned long crc_length; + /* 0x0200, set: 0x4200 */ + unsigned long crc_poly; + + /* Low-latency memory stuff */ + /* 0x0402, 0x040A */ + unsigned long llm_dat[2]; + + /* SHA & MD5 */ + /* 0x0240..0x024E */ + unsigned long hsh_datw[15]; + /* 0x0250..0x0257 */ + unsigned long hsh_ivw[8]; + + /* GFM */ + /* 0x0258..0x0259 */ + unsigned long gfm_mult[2]; + /* 0x025E */ + unsigned long gfm_poly; + /* 0x025A..0x025B */ + unsigned long gfm_result[2]; +}; + +/* Prototypes */ + +void octeon_cop2_save(struct octeon_cop2_state *); +void octeon_cop2_restore(struct octeon_cop2_state *); + +#endif /* LOCORE */ +#endif /* __OCTEON_COP2_H__ */ Modified: head/sys/mips/include/cpuregs.h ============================================================================== --- head/sys/mips/include/cpuregs.h Fri Jan 6 01:20:48 2012 (r229676) +++ head/sys/mips/include/cpuregs.h Fri Jan 6 01:23:26 2012 (r229677) @@ -233,6 +233,7 @@ #define MIPS3_CR_EXC_CODE 0x0000007C /* five bits */ #define MIPS_CR_IP 0x0000FF00 #define MIPS_CR_EXC_CODE_SHIFT 2 +#define MIPS_CR_COP_ERR_SHIFT 28 /* * The bits in the status register. All bits are active when set to 1. Modified: head/sys/mips/include/frame.h ============================================================================== --- head/sys/mips/include/frame.h Fri Jan 6 01:20:48 2012 (r229676) +++ head/sys/mips/include/frame.h Fri Jan 6 01:23:26 2012 (r229677) @@ -122,11 +122,6 @@ struct trapframe { f_register_t f31; register_t fsr; register_t fdummy; - /* - * COP2 registers may need to be saved here based on the CPU, and those - * might need to be per process, or even for the kernel, so we need - * some thought here. - */ }; /* REVISIT */ Added: head/sys/mips/include/octeon_cop2.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/include/octeon_cop2.h Fri Jan 6 01:23:26 2012 (r229677) @@ -0,0 +1,215 @@ +/*- + * Copyright (c) 2011, Oleksandr Tymoshenko + * 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 unmodified, 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 THE AUTHOR AND CONTRIBUTORS ``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 THE AUTHOR 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. + * + * $FreeBSD$ + * *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 01:57:42 2012 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 5A021106566B; Fri, 6 Jan 2012 01:57:42 +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 2D92C8FC14; Fri, 6 Jan 2012 01:57:42 +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 q061vgZ4066410; Fri, 6 Jan 2012 01:57:42 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q061vgPw066408; Fri, 6 Jan 2012 01:57:42 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201201060157.q061vgPw066408@svn.freebsd.org> From: Rick Macklem Date: Fri, 6 Jan 2012 01:57:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229678 - stable/9/sys/fs/nfsclient 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, 06 Jan 2012 01:57:42 -0000 Author: rmacklem Date: Fri Jan 6 01:57:41 2012 New Revision: 229678 URL: http://svn.freebsd.org/changeset/base/229678 Log: MFC: r227796 Clean up some cruft in the NFSv4 client left over from the OpenBSD port, so that it is more readable. No logic change is made by this commit. Modified: stable/9/sys/fs/nfsclient/nfs_clstate.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- stable/9/sys/fs/nfsclient/nfs_clstate.c Fri Jan 6 01:23:26 2012 (r229677) +++ stable/9/sys/fs/nfsclient/nfs_clstate.c Fri Jan 6 01:57:41 2012 (r229678) @@ -1681,7 +1681,6 @@ nfscl_cleanup_common(struct nfsclclient } } -#if defined(APPLEKEXT) || defined(__FreeBSD__) /* * Find open/lock owners for processes that have exited. */ @@ -1699,7 +1698,6 @@ nfscl_cleanupkext(struct nfsclclient *cl NFSUNLOCKCLSTATE(); NFSPROCLISTUNLOCK(); } -#endif /* APPLEKEXT || __FreeBSD__ */ static int fake_global; /* Used to force visibility of MNTK_UNMOUNTF */ /* @@ -2341,6 +2339,8 @@ nfscl_renewthread(struct nfsclclient *cl u_int32_t clidrev; int error, cbpathdown, islept, igotlock, ret, clearok; uint32_t recover_done_time = 0; + struct timespec mytime; + static time_t prevsec = 0; cred = newnfs_getcred(); NFSLOCKCLSTATE(); @@ -2528,22 +2528,15 @@ tryagain: FREE((caddr_t)dp, M_NFSCLDELEG); } -#if defined(APPLEKEXT) || defined(__FreeBSD__) /* * Call nfscl_cleanupkext() once per second to check for * open/lock owners where the process has exited. */ - { - struct timespec mytime; - static time_t prevsec = 0; - - NFSGETNANOTIME(&mytime); - if (prevsec != mytime.tv_sec) { - prevsec = mytime.tv_sec; - nfscl_cleanupkext(clp); - } + NFSGETNANOTIME(&mytime); + if (prevsec != mytime.tv_sec) { + prevsec = mytime.tv_sec; + nfscl_cleanupkext(clp); } -#endif /* APPLEKEXT || __FreeBSD__ */ NFSLOCKCLSTATE(); if ((clp->nfsc_flags & NFSCLFLAGS_RECOVER) == 0) From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 02:23:34 2012 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 0BBCB106566C; Fri, 6 Jan 2012 02:23:34 +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 D3B018FC1B; Fri, 6 Jan 2012 02:23:33 +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 q062NXaB067282; Fri, 6 Jan 2012 02:23:33 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q062NXsd067279; Fri, 6 Jan 2012 02:23:33 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201201060223.q062NXsd067279@svn.freebsd.org> From: Rick Macklem Date: Fri, 6 Jan 2012 02:23:33 +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: r229679 - stable/8/sys/fs/nfsclient 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, 06 Jan 2012 02:23:34 -0000 Author: rmacklem Date: Fri Jan 6 02:23:33 2012 New Revision: 229679 URL: http://svn.freebsd.org/changeset/base/229679 Log: MFC: r227796 Clean up some cruft in the NFSv4 client left over from the OpenBSD port, so that it is more readable. No logic change is made by this commit. Modified: stable/8/sys/fs/nfsclient/nfs_clstate.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/fs/nfsclient/nfs_clstate.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clstate.c Fri Jan 6 01:57:41 2012 (r229678) +++ stable/8/sys/fs/nfsclient/nfs_clstate.c Fri Jan 6 02:23:33 2012 (r229679) @@ -1681,7 +1681,6 @@ nfscl_cleanup_common(struct nfsclclient } } -#if defined(APPLEKEXT) || defined(__FreeBSD__) /* * Find open/lock owners for processes that have exited. */ @@ -1699,7 +1698,6 @@ nfscl_cleanupkext(struct nfsclclient *cl NFSUNLOCKCLSTATE(); NFSPROCLISTUNLOCK(); } -#endif /* APPLEKEXT || __FreeBSD__ */ static int fake_global; /* Used to force visibility of MNTK_UNMOUNTF */ /* @@ -2341,6 +2339,8 @@ nfscl_renewthread(struct nfsclclient *cl u_int32_t clidrev; int error, cbpathdown, islept, igotlock, ret, clearok; uint32_t recover_done_time = 0; + struct timespec mytime; + static time_t prevsec = 0; cred = newnfs_getcred(); NFSLOCKCLSTATE(); @@ -2528,22 +2528,15 @@ tryagain: FREE((caddr_t)dp, M_NFSCLDELEG); } -#if defined(APPLEKEXT) || defined(__FreeBSD__) /* * Call nfscl_cleanupkext() once per second to check for * open/lock owners where the process has exited. */ - { - struct timespec mytime; - static time_t prevsec = 0; - - NFSGETNANOTIME(&mytime); - if (prevsec != mytime.tv_sec) { - prevsec = mytime.tv_sec; - nfscl_cleanupkext(clp); - } + NFSGETNANOTIME(&mytime); + if (prevsec != mytime.tv_sec) { + prevsec = mytime.tv_sec; + nfscl_cleanupkext(clp); } -#endif /* APPLEKEXT || __FreeBSD__ */ NFSLOCKCLSTATE(); if ((clp->nfsc_flags & NFSCLFLAGS_RECOVER) == 0) From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 02:24:30 2012 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 E3A87106566B; Fri, 6 Jan 2012 02:24:29 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C8A6D8FC19; Fri, 6 Jan 2012 02:24: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 q062OTuF067350; Fri, 6 Jan 2012 02:24:29 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q062OTRV067347; Fri, 6 Jan 2012 02:24:29 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201060224.q062OTRV067347@svn.freebsd.org> From: Eitan Adler Date: Fri, 6 Jan 2012 02:24:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229680 - stable/9/sbin/md5 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, 06 Jan 2012 02:24:30 -0000 Author: eadler (ports committer) Date: Fri Jan 6 02:24:29 2012 New Revision: 229680 URL: http://svn.freebsd.org/changeset/base/229680 Log: MFC r227488: - add "check" option to MD5 and friends to compare files against known hash. Approved by: cperciva Modified: stable/9/sbin/md5/md5.1 stable/9/sbin/md5/md5.c Directory Properties: stable/9/sbin/md5/ (props changed) Modified: stable/9/sbin/md5/md5.1 ============================================================================== --- stable/9/sbin/md5/md5.1 Fri Jan 6 02:23:33 2012 (r229679) +++ stable/9/sbin/md5/md5.1 Fri Jan 6 02:24:29 2012 (r229680) @@ -8,18 +8,22 @@ .Sh SYNOPSIS .Nm md5 .Op Fl pqrtx +.Op Fl c Ar string .Op Fl s Ar string .Op Ar .Nm sha1 .Op Fl pqrtx +.Op Fl c Ar string .Op Fl s Ar string .Op Ar .Nm sha256 .Op Fl pqrtx +.Op Fl c Ar string .Op Fl s Ar string .Op Ar .Nm rmd160 .Op Fl pqrtx +.Op Fl c Ar string .Op Fl s Ar string .Op Ar .Sh DESCRIPTION @@ -73,6 +77,9 @@ precede any files named on the command l The hexadecimal checksum of each file listed on the command line is printed after the options are processed. .Bl -tag -width indent +.It Fl c Ar string +Compare files to this md5 string. (Note that this option is not yet useful +if multiple files are specified.) .It Fl s Ar string Print a checksum of the given .Ar string . @@ -101,7 +108,8 @@ The and .Nm rmd160 utilities exit 0 on success, -and 1 if at least one of the input files could not be read. +1 if at least one of the input files could not be read, +and 2 if at least one file does not have the same hash as the -c option. .Sh SEE ALSO .Xr cksum 1 , .Xr md5 3 , Modified: stable/9/sbin/md5/md5.c ============================================================================== --- stable/9/sbin/md5/md5.c Fri Jan 6 02:23:33 2012 (r229679) +++ stable/9/sbin/md5/md5.c Fri Jan 6 02:24:29 2012 (r229680) @@ -44,6 +44,8 @@ __FBSDID("$FreeBSD$"); int qflag; int rflag; int sflag; +unsigned char* checkAgainst; +int checksFailed; typedef void (DIGEST_Init)(void *); typedef void (DIGEST_Update)(void *, const unsigned char *, size_t); @@ -138,8 +140,13 @@ main(int argc, char *argv[]) digest = 0; failed = 0; - while ((ch = getopt(argc, argv, "pqrs:tx")) != -1) + checkAgainst = NULL; + checksFailed = 0; + while ((ch = getopt(argc, argv, "c:pqrs:tx")) != -1) switch (ch) { + case 'c': + checkAgainst = optarg; + break; case 'p': MDFilter(&Algorithm[digest], 1); break; @@ -173,12 +180,19 @@ main(int argc, char *argv[]) failed++; } else { if (qflag) - printf("%s\n", p); + printf("%s", p); else if (rflag) - printf("%s %s\n", p, *argv); + printf("%s %s", p, *argv); else - printf("%s (%s) = %s\n", + printf("%s (%s) = %s", Algorithm[digest].name, *argv, p); + if (checkAgainst && strcmp(checkAgainst,p)) + { + checksFailed++; + if (!qflag) + printf(" [ Failed ]"); + } + printf("\n"); } } while (*++argv); } else if (!sflag && (optind == 1 || qflag || rflag)) @@ -186,6 +200,8 @@ main(int argc, char *argv[]) if (failed != 0) return (1); + if (checksFailed != 0) + return (2); return (0); } @@ -198,12 +214,20 @@ MDString(Algorithm_t *alg, const char *s size_t len = strlen(string); char buf[HEX_DIGEST_LENGTH]; + alg->Data(string,len,buf); if (qflag) - printf("%s\n", alg->Data(string, len, buf)); + printf("%s", buf); else if (rflag) - printf("%s \"%s\"\n", alg->Data(string, len, buf), string); + printf("%s \"%s\"", buf, string); else - printf("%s (\"%s\") = %s\n", alg->name, string, alg->Data(string, len, buf)); + printf("%s (\"%s\") = %s", alg->name, string, buf); + if (checkAgainst && strcmp(buf,checkAgainst)) + { + checksFailed++; + if (!qflag) + printf(" [ failed ]"); + } + printf("\n"); } /* * Measures the time to digest TEST_BLOCK_COUNT TEST_BLOCK_LEN-byte blocks. From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 02:27:43 2012 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 BC416106564A; Fri, 6 Jan 2012 02:27:43 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A0E228FC0C; Fri, 6 Jan 2012 02:27:43 +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 q062RhHu067547; Fri, 6 Jan 2012 02:27:43 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q062RhDi067544; Fri, 6 Jan 2012 02:27:43 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201060227.q062RhDi067544@svn.freebsd.org> From: Eitan Adler Date: Fri, 6 Jan 2012 02:27:43 +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: r229681 - stable/8/sbin/md5 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, 06 Jan 2012 02:27:43 -0000 Author: eadler (ports committer) Date: Fri Jan 6 02:27:43 2012 New Revision: 229681 URL: http://svn.freebsd.org/changeset/base/229681 Log: MFC r227488: - add "check" option to MD5 and friends to compare files against known hash. Approved by: cperciva Modified: stable/8/sbin/md5/md5.1 stable/8/sbin/md5/md5.c Directory Properties: stable/8/sbin/md5/ (props changed) Modified: stable/8/sbin/md5/md5.1 ============================================================================== --- stable/8/sbin/md5/md5.1 Fri Jan 6 02:24:29 2012 (r229680) +++ stable/8/sbin/md5/md5.1 Fri Jan 6 02:27:43 2012 (r229681) @@ -8,18 +8,22 @@ .Sh SYNOPSIS .Nm md5 .Op Fl pqrtx +.Op Fl c Ar string .Op Fl s Ar string .Op Ar .Nm sha1 .Op Fl pqrtx +.Op Fl c Ar string .Op Fl s Ar string .Op Ar .Nm sha256 .Op Fl pqrtx +.Op Fl c Ar string .Op Fl s Ar string .Op Ar .Nm rmd160 .Op Fl pqrtx +.Op Fl c Ar string .Op Fl s Ar string .Op Ar .Sh DESCRIPTION @@ -73,6 +77,9 @@ precede any files named on the command l The hexadecimal checksum of each file listed on the command line is printed after the options are processed. .Bl -tag -width indent +.It Fl c Ar string +Compare files to this md5 string. (Note that this option is not yet useful +if multiple files are specified.) .It Fl s Ar string Print a checksum of the given .Ar string . @@ -101,7 +108,8 @@ The and .Nm rmd160 utilities exit 0 on success, -and 1 if at least one of the input files could not be read. +1 if at least one of the input files could not be read, +and 2 if at least one file does not have the same hash as the -c option. .Sh SEE ALSO .Xr cksum 1 , .Xr md5 3 , Modified: stable/8/sbin/md5/md5.c ============================================================================== --- stable/8/sbin/md5/md5.c Fri Jan 6 02:24:29 2012 (r229680) +++ stable/8/sbin/md5/md5.c Fri Jan 6 02:27:43 2012 (r229681) @@ -44,6 +44,8 @@ __FBSDID("$FreeBSD$"); int qflag; int rflag; int sflag; +unsigned char* checkAgainst; +int checksFailed; typedef void (DIGEST_Init)(void *); typedef void (DIGEST_Update)(void *, const unsigned char *, size_t); @@ -138,8 +140,13 @@ main(int argc, char *argv[]) digest = 0; failed = 0; - while ((ch = getopt(argc, argv, "pqrs:tx")) != -1) + checkAgainst = NULL; + checksFailed = 0; + while ((ch = getopt(argc, argv, "c:pqrs:tx")) != -1) switch (ch) { + case 'c': + checkAgainst = optarg; + break; case 'p': MDFilter(&Algorithm[digest], 1); break; @@ -173,12 +180,19 @@ main(int argc, char *argv[]) failed++; } else { if (qflag) - printf("%s\n", p); + printf("%s", p); else if (rflag) - printf("%s %s\n", p, *argv); + printf("%s %s", p, *argv); else - printf("%s (%s) = %s\n", + printf("%s (%s) = %s", Algorithm[digest].name, *argv, p); + if (checkAgainst && strcmp(checkAgainst,p)) + { + checksFailed++; + if (!qflag) + printf(" [ Failed ]"); + } + printf("\n"); } } while (*++argv); } else if (!sflag && (optind == 1 || qflag || rflag)) @@ -186,6 +200,8 @@ main(int argc, char *argv[]) if (failed != 0) return (1); + if (checksFailed != 0) + return (2); return (0); } @@ -198,12 +214,20 @@ MDString(Algorithm_t *alg, const char *s size_t len = strlen(string); char buf[HEX_DIGEST_LENGTH]; + alg->Data(string,len,buf); if (qflag) - printf("%s\n", alg->Data(string, len, buf)); + printf("%s", buf); else if (rflag) - printf("%s \"%s\"\n", alg->Data(string, len, buf), string); + printf("%s \"%s\"", buf, string); else - printf("%s (\"%s\") = %s\n", alg->name, string, alg->Data(string, len, buf)); + printf("%s (\"%s\") = %s", alg->name, string, buf); + if (checkAgainst && strcmp(buf,checkAgainst)) + { + checksFailed++; + if (!qflag) + printf(" [ failed ]"); + } + printf("\n"); } /* * Measures the time to digest TEST_BLOCK_COUNT TEST_BLOCK_LEN-byte blocks. From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 02:28:22 2012 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 DF107106566B; Fri, 6 Jan 2012 02:28:21 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CD4128FC1C; Fri, 6 Jan 2012 02:28: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 q062SLtn067621; Fri, 6 Jan 2012 02:28:21 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q062SLbu067618; Fri, 6 Jan 2012 02:28:21 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201060228.q062SLbu067618@svn.freebsd.org> From: Eitan Adler Date: Fri, 6 Jan 2012 02:28:21 +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: r229682 - stable/7/sbin/md5 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, 06 Jan 2012 02:28:22 -0000 Author: eadler (ports committer) Date: Fri Jan 6 02:28:21 2012 New Revision: 229682 URL: http://svn.freebsd.org/changeset/base/229682 Log: MFC r227488: - add "check" option to MD5 and friends to compare files against known hash. Approved by: cperciva Modified: stable/7/sbin/md5/md5.1 stable/7/sbin/md5/md5.c Directory Properties: stable/7/sbin/md5/ (props changed) Modified: stable/7/sbin/md5/md5.1 ============================================================================== --- stable/7/sbin/md5/md5.1 Fri Jan 6 02:27:43 2012 (r229681) +++ stable/7/sbin/md5/md5.1 Fri Jan 6 02:28:21 2012 (r229682) @@ -8,18 +8,22 @@ .Sh SYNOPSIS .Nm md5 .Op Fl pqrtx +.Op Fl c Ar string .Op Fl s Ar string .Op Ar .Nm sha1 .Op Fl pqrtx +.Op Fl c Ar string .Op Fl s Ar string .Op Ar .Nm sha256 .Op Fl pqrtx +.Op Fl c Ar string .Op Fl s Ar string .Op Ar .Nm rmd160 .Op Fl pqrtx +.Op Fl c Ar string .Op Fl s Ar string .Op Ar .Sh DESCRIPTION @@ -64,6 +68,9 @@ precede any files named on the command l The hexadecimal checksum of each file listed on the command line is printed after the options are processed. .Bl -tag -width indent +.It Fl c Ar string +Compare files to this md5 string. (Note that this option is not yet useful +if multiple files are specified.) .It Fl s Ar string Print a checksum of the given .Ar string . @@ -92,7 +99,8 @@ The and .Nm rmd160 utilities exit 0 on success, -and 1 if at least one of the input files could not be read. +1 if at least one of the input files could not be read, +and 2 if at least one file does not have the same hash as the -c option. .Sh SEE ALSO .Xr cksum 1 , .Xr md5 3 , Modified: stable/7/sbin/md5/md5.c ============================================================================== --- stable/7/sbin/md5/md5.c Fri Jan 6 02:27:43 2012 (r229681) +++ stable/7/sbin/md5/md5.c Fri Jan 6 02:28:21 2012 (r229682) @@ -44,6 +44,8 @@ __FBSDID("$FreeBSD$"); int qflag; int rflag; int sflag; +unsigned char* checkAgainst; +int checksFailed; typedef void (DIGEST_Init)(void *); typedef void (DIGEST_Update)(void *, const unsigned char *, size_t); @@ -138,8 +140,13 @@ main(int argc, char *argv[]) digest = 0; failed = 0; - while ((ch = getopt(argc, argv, "pqrs:tx")) != -1) + checkAgainst = NULL; + checksFailed = 0; + while ((ch = getopt(argc, argv, "c:pqrs:tx")) != -1) switch (ch) { + case 'c': + checkAgainst = optarg; + break; case 'p': MDFilter(&Algorithm[digest], 1); break; @@ -173,12 +180,19 @@ main(int argc, char *argv[]) failed++; } else { if (qflag) - printf("%s\n", p); + printf("%s", p); else if (rflag) - printf("%s %s\n", p, *argv); + printf("%s %s", p, *argv); else - printf("%s (%s) = %s\n", + printf("%s (%s) = %s", Algorithm[digest].name, *argv, p); + if (checkAgainst && strcmp(checkAgainst,p)) + { + checksFailed++; + if (!qflag) + printf(" [ Failed ]"); + } + printf("\n"); } } while (*++argv); } else if (!sflag && (optind == 1 || qflag || rflag)) @@ -186,6 +200,8 @@ main(int argc, char *argv[]) if (failed != 0) return (1); + if (checksFailed != 0) + return (2); return (0); } @@ -198,12 +214,20 @@ MDString(Algorithm_t *alg, const char *s size_t len = strlen(string); char buf[HEX_DIGEST_LENGTH]; + alg->Data(string,len,buf); if (qflag) - printf("%s\n", alg->Data(string, len, buf)); + printf("%s", buf); else if (rflag) - printf("%s \"%s\"\n", alg->Data(string, len, buf), string); + printf("%s \"%s\"", buf, string); else - printf("%s (\"%s\") = %s\n", alg->name, string, alg->Data(string, len, buf)); + printf("%s (\"%s\") = %s", alg->name, string, buf); + if (checkAgainst && strcmp(buf,checkAgainst)) + { + checksFailed++; + if (!qflag) + printf(" [ failed ]"); + } + printf("\n"); } /* * Measures the time to digest TEST_BLOCK_COUNT TEST_BLOCK_LEN-byte blocks. From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 02:58:12 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id 0FBC11065670; Fri, 6 Jan 2012 02:58:12 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from 172-17-198-245.globalsuite.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 070EB14FCA4; Fri, 6 Jan 2012 02:58:09 +0000 (UTC) Message-ID: <4F066340.9010507@FreeBSD.org> Date: Thu, 05 Jan 2012 18:58:08 -0800 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:9.0) Gecko/20111222 Thunderbird/9.0 MIME-Version: 1.0 To: Guy Helmer References: <201201052248.q05MmaZk059871@svn.freebsd.org> In-Reply-To: <201201052248.q05MmaZk059871@svn.freebsd.org> X-Enigmail-Version: undefined OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r229667 - head/usr.sbin/daemon 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, 06 Jan 2012 02:58:12 -0000 On 01/05/2012 14:48, Guy Helmer wrote: > Allow daemon(8) to run pidfile_open() before relenquishing privileges > so pid files can be written in /var/run when started as root. I'm not sure how useful this is since when daemon is exiting it won't be able to remove the pid file (unless I'm missing something). Isn't it better to pre-create the pid file with the proper permissions for the unprivileged user? Doug -- You can observe a lot just by watching. -- Yogi Berra Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 05:03:23 2012 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 443C8106564A; Fri, 6 Jan 2012 05:03:23 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 314828FC0C; Fri, 6 Jan 2012 05:03: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 q0653NLE072628; Fri, 6 Jan 2012 05:03:23 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0653NYm072626; Fri, 6 Jan 2012 05:03:23 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201201060503.q0653NYm072626@svn.freebsd.org> From: Hiroki Sato Date: Fri, 6 Jan 2012 05:03:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229683 - stable/9/release/doc/en_US.ISO8859-1/relnotes 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, 06 Jan 2012 05:03:23 -0000 Author: hrs Date: Fri Jan 6 05:03:22 2012 New Revision: 229683 URL: http://svn.freebsd.org/changeset/base/229683 Log: - Update copyright year. - Add SA-11:0[12456789] and -11:10. - Update the upgrade section. Modified: stable/9/release/doc/en_US.ISO8859-1/relnotes/article.sgml Modified: stable/9/release/doc/en_US.ISO8859-1/relnotes/article.sgml ============================================================================== --- stable/9/release/doc/en_US.ISO8859-1/relnotes/article.sgml Fri Jan 6 02:28:21 2012 (r229682) +++ stable/9/release/doc/en_US.ISO8859-1/relnotes/article.sgml Fri Jan 6 05:03:22 2012 (r229683) @@ -20,17 +20,7 @@ $FreeBSD$ - 2000 - 2001 - 2002 - 2003 - 2004 - 2005 - 2006 - 2007 - 2008 - 2009 - 2010 + 2012 The &os; Documentation Project @@ -132,9 +122,97 @@ Security Advisories - - - + Problems described in the following security advisories have + been fixed. For more information, consult the individual + advisories available from + . + + + + + + + + + Advisory + Date + Topic + + + + + + SA-11:01.mountd + 20 April 2011 + Network ACL mishandling in &man.mountd.8; + + + + SA-11:02.bind + 28 May 2011 + BIND remote DoS with large RRSIG RRsets and negative + caching + + + + SA-11:04.compress + 28 September 2011 + Errors handling corrupt compress file in + &man.compress.1; and &man.gzip.1; + + + + SA-11:05.unix + 28 September 2011 + Buffer overflow in handling of UNIX socket + addresses + + + + SA-11:06.bind + 23 December 2011 + Remote packet Denial of Service against &man.named.8; + servers + + + + SA-11:07.chroot + 23 December 2011 + Code execution via chrooted ftpd + + + + SA-11:08.telnetd + 23 December 2011 + telnetd code execution vulnerability + + + + SA-11:09.pam_ssh + 23 December 2011 + pam_ssh improperly grants access when user account has + unencrypted SSH private keys + + + + SA-11:10.pam + 23 December 2011 + pam_start() does not validate + service names + + + + + Kernel Changes @@ -544,17 +622,11 @@ binary upgrades between RELEASE versions (and snapshots of the various security branches) are supported using the &man.freebsd-update.8; utility. The binary upgrade procedure will - update unmodified userland utilities, as well as unmodified GENERIC or - SMP kernels distributed as a part of an official &os; release. + update unmodified userland utilities, as well as a unmodified GENERIC kernel + distributed as a part of an official &os; release. The &man.freebsd-update.8; utility requires that the host being upgraded have Internet connectivity. - An older form of binary upgrade is supported through the - Upgrade option from the main &man.sysinstall.8; - menu on CDROM distribution media. This type of binary upgrade - may be useful on non-&arch.i386;, non-&arch.amd64; machines - or on systems with no Internet connectivity. - Source-based upgrades (those based on recompiling the &os; base system from source code) from previous versions are supported, according to the instructions in From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 05:08:51 2012 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 F144D106566C; Fri, 6 Jan 2012 05:08:51 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D4C1F8FC08; Fri, 6 Jan 2012 05:08:51 +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 q0658pmE072821; Fri, 6 Jan 2012 05:08:51 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0658p4D072817; Fri, 6 Jan 2012 05:08:51 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201201060508.q0658p4D072817@svn.freebsd.org> From: Hiroki Sato Date: Fri, 6 Jan 2012 05:08:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229684 - in stable/9/release/doc: en_US.ISO8859-1/share/sgml share/examples share/sgml 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, 06 Jan 2012 05:08:52 -0000 Author: hrs Date: Fri Jan 6 05:08:51 2012 New Revision: 229684 URL: http://svn.freebsd.org/changeset/base/229684 Log: Update entities and variables for 9.0R. Modified: stable/9/release/doc/en_US.ISO8859-1/share/sgml/release.dsl stable/9/release/doc/share/examples/Makefile.relnotesng stable/9/release/doc/share/sgml/release.ent Modified: stable/9/release/doc/en_US.ISO8859-1/share/sgml/release.dsl ============================================================================== --- stable/9/release/doc/en_US.ISO8859-1/share/sgml/release.dsl Fri Jan 6 05:03:22 2012 (r229683) +++ stable/9/release/doc/en_US.ISO8859-1/share/sgml/release.dsl Fri Jan 6 05:08:51 2012 (r229684) @@ -42,8 +42,8 @@ (literal (entity-text "release.branch")) (literal " should subscribe to the ") (literal "<") - (create-link (list (list "HREF" "mailto:current@FreeBSD.org")) - (literal "current@FreeBSD.org")) + (create-link (list (list "HREF" "mailto:stable@FreeBSD.org")) + (literal "stable@FreeBSD.org")) (literal "> mailing list."))) (make element gi: "p" Modified: stable/9/release/doc/share/examples/Makefile.relnotesng ============================================================================== --- stable/9/release/doc/share/examples/Makefile.relnotesng Fri Jan 6 05:03:22 2012 (r229683) +++ stable/9/release/doc/share/examples/Makefile.relnotesng Fri Jan 6 05:08:51 2012 (r229684) @@ -12,7 +12,7 @@ UNITEXTS= hardware readme relnotes errat IMAGEDIR= .imagedir RHOST= freefall.freebsd.org -RDIR= public_html/relnotes/CURRENT +RDIR= public_html/relnotes/RELENG_9 DOCDIR= ./release/doc LANG= en_US.ISO8859-1 Modified: stable/9/release/doc/share/sgml/release.ent ============================================================================== --- stable/9/release/doc/share/sgml/release.ent Fri Jan 6 05:03:22 2012 (r229683) +++ stable/9/release/doc/share/sgml/release.ent Fri Jan 6 05:08:51 2012 (r229684) @@ -6,40 +6,40 @@ - + - + - + - + - + - - + + - + - + From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 05:12:57 2012 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 DCF4D106566B; Fri, 6 Jan 2012 05:12:57 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C04768FC13; Fri, 6 Jan 2012 05:12: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 q065Cv9x072995; Fri, 6 Jan 2012 05:12:57 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q065Cv5I072993; Fri, 6 Jan 2012 05:12:57 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201201060512.q065Cv5I072993@svn.freebsd.org> From: Hiroki Sato Date: Fri, 6 Jan 2012 05:12:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229685 - stable/9/release/doc/en_US.ISO8859-1/errata 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, 06 Jan 2012 05:12:58 -0000 Author: hrs Date: Fri Jan 6 05:12:57 2012 New Revision: 229685 URL: http://svn.freebsd.org/changeset/base/229685 Log: - Update copyright year. - Add SA-11:0[12456789] and -11:10. Modified: stable/9/release/doc/en_US.ISO8859-1/errata/article.sgml Modified: stable/9/release/doc/en_US.ISO8859-1/errata/article.sgml ============================================================================== --- stable/9/release/doc/en_US.ISO8859-1/errata/article.sgml Fri Jan 6 05:08:51 2012 (r229684) +++ stable/9/release/doc/en_US.ISO8859-1/errata/article.sgml Fri Jan 6 05:12:57 2012 (r229685) @@ -39,12 +39,7 @@ $FreeBSD$ - 2000 - 2001 - 2002 - 2003 - 2004 - 2005 + 2012 The &os; Documentation Project @@ -129,18 +124,97 @@ Security Advisories -No advisories. -]]> - -No advisories. -]]> - -No advisories. -]]> - + Problems described in the following security advisories have + been fixed in &release.current;. For more information, consult + the individual advisories available from . + + + + + + + + + + Advisory + Date + Topic + + + + + + SA-11:01.mountd + 20 April 2011 + Network ACL mishandling in &man.mountd.8; + + + + SA-11:02.bind + 28 May 2011 + BIND remote DoS with large RRSIG RRsets and negative + caching + + + + SA-11:04.compress + 28 September 2011 + Errors handling corrupt compress file in + &man.compress.1; and &man.gzip.1; + + + + SA-11:05.unix + 28 September 2011 + Buffer overflow in handling of UNIX socket + addresses + + + + SA-11:06.bind + 23 December 2011 + Remote packet Denial of Service against &man.named.8; + servers + + + + SA-11:07.chroot + 23 December 2011 + Code execution via chrooted ftpd + + + + SA-11:08.telnetd + 23 December 2011 + telnetd code execution vulnerability + + + + SA-11:09.pam_ssh + 23 December 2011 + pam_ssh improperly grants access when user account has + unencrypted SSH private keys + + + + SA-11:10.pam + 23 December 2011 + pam_start() does not validate + service names + + + + From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 05:17:43 2012 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 D88B4106564A; Fri, 6 Jan 2012 05:17:43 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C6BFA8FC15; Fri, 6 Jan 2012 05:17:43 +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 q065HhGP073168; Fri, 6 Jan 2012 05:17:43 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q065HhsC073166; Fri, 6 Jan 2012 05:17:43 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201201060517.q065HhsC073166@svn.freebsd.org> From: Hiroki Sato Date: Fri, 6 Jan 2012 05:17:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229686 - stable/9/release/doc/en_US.ISO8859-1/readme 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, 06 Jan 2012 05:17:44 -0000 Author: hrs Date: Fri Jan 6 05:17:43 2012 New Revision: 229686 URL: http://svn.freebsd.org/changeset/base/229686 Log: - Update copyright year. - Remove a paragraph which describes sysinstall(8). Modified: stable/9/release/doc/en_US.ISO8859-1/readme/article.sgml Modified: stable/9/release/doc/en_US.ISO8859-1/readme/article.sgml ============================================================================== --- stable/9/release/doc/en_US.ISO8859-1/readme/article.sgml Fri Jan 6 05:12:57 2012 (r229685) +++ stable/9/release/doc/en_US.ISO8859-1/readme/article.sgml Fri Jan 6 05:17:43 2012 (r229686) @@ -15,15 +15,7 @@ $FreeBSD$ - 2000 - 2001 - 2002 - 2003 - 2004 - 2005 - 2006 - 2007 - 2008 + 2012 The &os; Documentation Project @@ -333,12 +325,6 @@ - On platforms that support &man.sysinstall.8; (currently - &arch.amd64;, &arch.i386;, &arch.ia64;, &arch.pc98;, and &arch.sparc64;), these documents are generally available via the - Documentation menu during installation. Once the system is - installed, you can revisit this menu by re-running the - &man.sysinstall.8; utility. - It is extremely important to read the errata for any given release before installing it, to learn about any From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 05:45:24 2012 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 19ABE106564A; Fri, 6 Jan 2012 05:45:24 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 082768FC0C; Fri, 6 Jan 2012 05: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 q065jNIQ074033; Fri, 6 Jan 2012 05:45:23 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q065jNpI074031; Fri, 6 Jan 2012 05:45:23 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201201060545.q065jNpI074031@svn.freebsd.org> From: Kevin Lo Date: Fri, 6 Jan 2012 05:45:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229687 - stable/9/sys/dev/uart 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, 06 Jan 2012 05:45:24 -0000 Author: kevlo Date: Fri Jan 6 05:45:23 2012 New Revision: 229687 URL: http://svn.freebsd.org/changeset/base/229687 Log: MFC r229379: Add support for Intel EG20T serial ports Modified: stable/9/sys/dev/uart/uart_bus_pci.c Modified: stable/9/sys/dev/uart/uart_bus_pci.c ============================================================================== --- stable/9/sys/dev/uart/uart_bus_pci.c Fri Jan 6 05:17:43 2012 (r229686) +++ stable/9/sys/dev/uart/uart_bus_pci.c Fri Jan 6 05:45:23 2012 (r229687) @@ -112,6 +112,10 @@ static struct pci_id pci_ns8250_ids[] = 0x10, 16384000 }, { 0x151f, 0x0000, 0xffff, 0, "TOPIC Semiconductor TP560 56k modem", 0x10 }, { 0x8086, 0x1c3d, 0xffff, 0, "Intel AMT - KT Controller", 0x10 }, +{ 0x8086, 0x8811, 0xffff, 0, "Intel EG20T Serial Port 0", 0x10 }, +{ 0x8086, 0x8812, 0xffff, 0, "Intel EG20T Serial Port 1", 0x10 }, +{ 0x8086, 0x8813, 0xffff, 0, "Intel EG20T Serial Port 2", 0x10 }, +{ 0x8086, 0x8814, 0xffff, 0, "Intel EG20T Serial Port 3", 0x10 }, { 0x9710, 0x9820, 0x1000, 1, "NetMos NM9820 Serial Port", 0x10 }, { 0x9710, 0x9835, 0x1000, 1, "NetMos NM9835 Serial Port", 0x10 }, { 0x9710, 0x9865, 0xa000, 0x1000, "NetMos NM9865 Serial Port", 0x10 }, From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 05:48:53 2012 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 05F40106571E; Fri, 6 Jan 2012 05:48:52 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C43558FC0C; Fri, 6 Jan 2012 05:48:52 +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 q065mqRn074175; Fri, 6 Jan 2012 05:48:52 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q065mq3L074171; Fri, 6 Jan 2012 05:48:52 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201201060548.q065mq3L074171@svn.freebsd.org> From: Kevin Lo Date: Fri, 6 Jan 2012 05:48:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229688 - in stable/9/usr.sbin/bsdinstall: distextract distfetch partedit 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, 06 Jan 2012 05:48:53 -0000 Author: kevlo Date: Fri Jan 6 05:48:52 2012 New Revision: 229688 URL: http://svn.freebsd.org/changeset/base/229688 Log: MFC r228048: Plug memory leaks and fix open(2) error check. Reviewed by: nwhitehorn Modified: stable/9/usr.sbin/bsdinstall/distextract/distextract.c stable/9/usr.sbin/bsdinstall/distfetch/distfetch.c stable/9/usr.sbin/bsdinstall/partedit/gpart_ops.c Modified: stable/9/usr.sbin/bsdinstall/distextract/distextract.c ============================================================================== --- stable/9/usr.sbin/bsdinstall/distextract/distextract.c Fri Jan 6 05:45:23 2012 (r229687) +++ stable/9/usr.sbin/bsdinstall/distextract/distextract.c Fri Jan 6 05:48:52 2012 (r229688) @@ -49,6 +49,7 @@ main(void) dists = calloc(ndists, sizeof(const char *)); if (dists == NULL) { fprintf(stderr, "Out of memory!\n"); + free(diststring); return (1); } Modified: stable/9/usr.sbin/bsdinstall/distfetch/distfetch.c ============================================================================== --- stable/9/usr.sbin/bsdinstall/distfetch/distfetch.c Fri Jan 6 05:45:23 2012 (r229687) +++ stable/9/usr.sbin/bsdinstall/distfetch/distfetch.c Fri Jan 6 05:48:52 2012 (r229688) @@ -48,6 +48,7 @@ main(void) urls = calloc(ndists, sizeof(const char *)); if (urls == NULL) { fprintf(stderr, "Out of memory!\n"); + free(diststring); return (1); } Modified: stable/9/usr.sbin/bsdinstall/partedit/gpart_ops.c ============================================================================== --- stable/9/usr.sbin/bsdinstall/partedit/gpart_ops.c Fri Jan 6 05:45:23 2012 (r229687) +++ stable/9/usr.sbin/bsdinstall/partedit/gpart_ops.c Fri Jan 6 05:48:52 2012 (r229688) @@ -301,7 +301,7 @@ gpart_bootcode(struct ggeom *gp) return; bootfd = open(bootcode, O_RDONLY); - if (bootfd <= 0) { + if (bootfd < 0) { dialog_msgbox("Bootcode Error", strerror(errno), 0, 0, TRUE); return; From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 05:51:01 2012 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 597BD1065672; Fri, 6 Jan 2012 05:51:01 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4837F8FC17; Fri, 6 Jan 2012 05:51: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 q065p1LM074282; Fri, 6 Jan 2012 05:51:01 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q065p1Jl074280; Fri, 6 Jan 2012 05:51:01 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201201060551.q065p1Jl074280@svn.freebsd.org> From: Kevin Lo Date: Fri, 6 Jan 2012 05:51:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229689 - stable/9/sys/dev/vte 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, 06 Jan 2012 05:51:01 -0000 Author: kevlo Date: Fri Jan 6 05:51:00 2012 New Revision: 229689 URL: http://svn.freebsd.org/changeset/base/229689 Log: MFC r227871: Remove unused variable mii. This variable is initialized but not used. Reviewed by: yongari Modified: stable/9/sys/dev/vte/if_vte.c Modified: stable/9/sys/dev/vte/if_vte.c ============================================================================== --- stable/9/sys/dev/vte/if_vte.c Fri Jan 6 05:48:52 2012 (r229688) +++ stable/9/sys/dev/vte/if_vte.c Fri Jan 6 05:51:00 2012 (r229689) @@ -1621,14 +1621,12 @@ static void vte_init_locked(struct vte_softc *sc) { struct ifnet *ifp; - struct mii_data *mii; bus_addr_t paddr; uint8_t *eaddr; VTE_LOCK_ASSERT(sc); ifp = sc->vte_ifp; - mii = device_get_softc(sc->vte_miibus); if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) return; From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 06:00:18 2012 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 B6EA4106566B; Fri, 6 Jan 2012 06:00:18 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-tul01m020-f182.google.com (mail-tul01m020-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 568318FC08; Fri, 6 Jan 2012 06:00:18 +0000 (UTC) Received: by obbwd18 with SMTP id wd18so2063384obb.13 for ; Thu, 05 Jan 2012 22:00:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=h7wODd/sxH4swpexBUz9AzNsvASbu9s806UGEYbW9Ik=; b=cpPnGW+OtLegW01zvys27N31tHCYALSPmVcjEDqVIT/nJT92BYJkM+LkUoSIsSo10I kwGop6uRCaS2iM76g6A61N0lGyWCMzODBJ/3bZB9IEOkmVAiHM2sVP9bhDASTwry8sfI e0pw6QIad93fYlbV4VKp0wTb6dLpJQNQ4WxX4= MIME-Version: 1.0 Received: by 10.182.164.106 with SMTP id yp10mr3773920obb.71.1325829617802; Thu, 05 Jan 2012 22:00:17 -0800 (PST) Received: by 10.182.152.6 with HTTP; Thu, 5 Jan 2012 22:00:17 -0800 (PST) In-Reply-To: <4F066340.9010507@FreeBSD.org> References: <201201052248.q05MmaZk059871@svn.freebsd.org> <4F066340.9010507@FreeBSD.org> Date: Thu, 5 Jan 2012 22:00:17 -0800 Message-ID: From: Garrett Cooper To: Doug Barton Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Guy Helmer Subject: Re: svn commit: r229667 - head/usr.sbin/daemon 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, 06 Jan 2012 06:00:18 -0000 On Thu, Jan 5, 2012 at 6:58 PM, Doug Barton wrote: > On 01/05/2012 14:48, Guy Helmer wrote: >> =A0 Allow daemon(8) to run pidfile_open() before relenquishing privilege= s >> =A0 so pid files can be written in /var/run when started as root. > > I'm not sure how useful this is since when daemon is exiting it won't be > able to remove the pid file (unless I'm missing something). > > Isn't it better to pre-create the pid file with the proper permissions > for the unprivileged user? As another aside, the file descriptor never has fcntl(, FD_CLOEXEC) run on it, so it leaks the file descriptors across execs.. that's not good... Thanks, -Garrett From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 08:20:20 2012 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 951311065672; Fri, 6 Jan 2012 08:20:20 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.64.117]) by mx1.freebsd.org (Postfix) with ESMTP id 8C0008FC12; Fri, 6 Jan 2012 08:20:13 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.5/8.14.5) with ESMTP id q068K5Qh062535; Fri, 6 Jan 2012 12:20:05 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id q068K5xY062534; Fri, 6 Jan 2012 12:20:05 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Fri, 6 Jan 2012 12:20:05 +0400 From: Gleb Smirnoff To: John Baldwin Message-ID: <20120106082005.GQ34721@FreeBSD.org> References: <201201051950.q05JoCKj052356@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <201201051950.q05JoCKj052356@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-stable@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, svn-src-stable-9@FreeBSD.org Subject: Re: svn commit: r229633 - stable/9/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: Fri, 06 Jan 2012 08:20:20 -0000 John, On Thu, Jan 05, 2012 at 07:50:12PM +0000, John Baldwin wrote: J> Author: jhb J> Date: Thu Jan 5 19:50:12 2012 J> New Revision: 229633 J> URL: http://svn.freebsd.org/changeset/base/229633 J> J> Log: J> MFC 228089: J> Change the if_vlan driver to use if_transmit for forwarding packets to the J> parent interface. This avoids the overhead of queueing a packet to an IFQ J> only to immediately dequeue it again. This should have been merged together with r228967. Now a bug that was successfully discovered and fixed in head/ leaked to stable branches. :( Can you please merge r228967 to stable/9 and stable/8 ASAP? -- Totus tuus, Glebius. From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 08:46:27 2012 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 54DAC106566C; Fri, 6 Jan 2012 08:46:27 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3EDD38FC0A; Fri, 6 Jan 2012 08:46:27 +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 q068kRYK079788; Fri, 6 Jan 2012 08:46:27 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q068kR5q079786; Fri, 6 Jan 2012 08:46:27 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201201060846.q068kR5q079786@svn.freebsd.org> From: Gleb Smirnoff Date: Fri, 6 Jan 2012 08:46:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229690 - stable/9/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: Fri, 06 Jan 2012 08:46:27 -0000 Author: glebius Date: Fri Jan 6 08:46:26 2012 New Revision: 229690 URL: http://svn.freebsd.org/changeset/base/229690 Log: Merge r226830 from head/: Add macro IF_DEQUEUE_ALL(ifq, m), that takes the entire mbuf chain off the queue. It can be utilized in queue processing to avoid multiple locking/unlocking. Modified: stable/9/sys/net/if_var.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/net/if_var.h ============================================================================== --- stable/9/sys/net/if_var.h Fri Jan 6 05:51:00 2012 (r229689) +++ stable/9/sys/net/if_var.h Fri Jan 6 08:46:26 2012 (r229690) @@ -321,6 +321,18 @@ void if_maddr_runlock(struct ifnet *ifp) IF_UNLOCK(ifq); \ } while (0) +#define _IF_DEQUEUE_ALL(ifq, m) do { \ + (m) = (ifq)->ifq_head; \ + (ifq)->ifq_head = (ifq)->ifq_tail = NULL; \ + (ifq)->ifq_len = 0; \ +} while (0) + +#define IF_DEQUEUE_ALL(ifq, m) do { \ + IF_LOCK(ifq); \ + _IF_DEQUEUE_ALL(ifq, m); \ + IF_UNLOCK(ifq); \ +} while (0) + #define _IF_POLL(ifq, m) ((m) = (ifq)->ifq_head) #define IF_POLL(ifq, m) _IF_POLL(ifq, m) From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 08:51:21 2012 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 78CBC106564A; Fri, 6 Jan 2012 08:51:21 +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 6508B8FC1A; Fri, 6 Jan 2012 08:51: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 q068pL2d080021; Fri, 6 Jan 2012 08:51:21 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q068pLeF080019; Fri, 6 Jan 2012 08:51:21 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201201060851.q068pLeF080019@svn.freebsd.org> From: Adrian Chadd Date: Fri, 6 Jan 2012 08:51: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: r229691 - head/sys/pc98/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: Fri, 06 Jan 2012 08:51:21 -0000 Author: adrian Date: Fri Jan 6 08:51:20 2012 New Revision: 229691 URL: http://svn.freebsd.org/changeset/base/229691 Log: Flip these options on so the modules build correctly for now. Modified: head/sys/pc98/conf/GENERIC Modified: head/sys/pc98/conf/GENERIC ============================================================================== --- head/sys/pc98/conf/GENERIC Fri Jan 6 08:46:26 2012 (r229690) +++ head/sys/pc98/conf/GENERIC Fri Jan 6 08:51:20 2012 (r229691) @@ -214,7 +214,7 @@ device xe # Xircom pccard Ethernet #device wlan # 802.11 support #options IEEE80211_DEBUG # enable debug msgs #options IEEE80211_AMPDU_AGE # age frames in AMPDU reorder q's -#options IEEE80211_SUPPORT_MESH # enable 802.11s draft support +options IEEE80211_SUPPORT_MESH # enable 802.11s draft support #device wlan_wep # 802.11 WEP support #device wlan_ccmp # 802.11 CCMP support #device wlan_tkip # 802.11 TKIP support @@ -223,7 +223,7 @@ device xe # Xircom pccard Ethernet #device ath # Atheros NIC's #device ath_pci # Atheros pci/cardbus glue #device ath_hal # pci/cardbus chip support -#options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors +options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors #device ath_rate_sample # SampleRate tx rate control for ath #device ral # Ralink Technology RT2500 wireless NICs. #device wi # WaveLAN/Intersil/Symbol 802.11 wireless NICs. From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 09:17:34 2012 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 B3BFD106564A; Fri, 6 Jan 2012 09:17:34 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9ED7F8FC12; Fri, 6 Jan 2012 09:17: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 q069HY2o080896; Fri, 6 Jan 2012 09:17:34 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q069HYO1080894; Fri, 6 Jan 2012 09:17:34 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201201060917.q069HYO1080894@svn.freebsd.org> From: Jaakko Heinonen Date: Fri, 6 Jan 2012 09:17: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: r229692 - head/sys/fs/pseudofs 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, 06 Jan 2012 09:17:34 -0000 Author: jh Date: Fri Jan 6 09:17:34 2012 New Revision: 229692 URL: http://svn.freebsd.org/changeset/base/229692 Log: Check the return value of sbuf_finish() in pfs_readlink() and return ENAMETOOLONG if the buffer overflowed. Approved by: des MFC after: 2 weeks Modified: head/sys/fs/pseudofs/pseudofs_vnops.c Modified: head/sys/fs/pseudofs/pseudofs_vnops.c ============================================================================== --- head/sys/fs/pseudofs/pseudofs_vnops.c Fri Jan 6 08:51:20 2012 (r229691) +++ head/sys/fs/pseudofs/pseudofs_vnops.c Fri Jan 6 09:17:34 2012 (r229692) @@ -891,7 +891,11 @@ pfs_readlink(struct vop_readlink_args *v PFS_RETURN (error); } - sbuf_finish(&sb); + if (sbuf_finish(&sb) != 0) { + sbuf_delete(&sb); + PFS_RETURN (ENAMETOOLONG); + } + error = uiomove_frombuf(sbuf_data(&sb), sbuf_len(&sb), uio); sbuf_delete(&sb); PFS_RETURN (error); From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 09:21:41 2012 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 86C7D1065672; Fri, 6 Jan 2012 09:21:41 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 680FF8FC0A; Fri, 6 Jan 2012 09:21: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 q069LfGW081054; Fri, 6 Jan 2012 09:21:41 GMT (envelope-from andreast@svn.freebsd.org) Received: (from andreast@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q069Lfi8081051; Fri, 6 Jan 2012 09:21:41 GMT (envelope-from andreast@svn.freebsd.org) Message-Id: <201201060921.q069Lfi8081051@svn.freebsd.org> From: Andreas Tobler Date: Fri, 6 Jan 2012 09:21: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: r229693 - in head/lib/libc: powerpc powerpc64 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, 06 Jan 2012 09:21:41 -0000 Author: andreast Date: Fri Jan 6 09:21:40 2012 New Revision: 229693 URL: http://svn.freebsd.org/changeset/base/229693 Log: Use the macro WEAK_ALIAS. Tested on 32 and 64-bit. Modified: head/lib/libc/powerpc/SYS.h head/lib/libc/powerpc64/SYS.h Modified: head/lib/libc/powerpc/SYS.h ============================================================================== --- head/lib/libc/powerpc/SYS.h Fri Jan 6 09:17:34 2012 (r229692) +++ head/lib/libc/powerpc/SYS.h Fri Jan 6 09:21:40 2012 (r229693) @@ -44,10 +44,8 @@ .align 2; \ 2: b PIC_PLT(CNAME(HIDENAME(cerror))); \ ENTRY(__CONCAT(__sys_,x)); \ - .weak CNAME(x); \ - .set CNAME(x),CNAME(__CONCAT(__sys_,x)); \ - .weak CNAME(__CONCAT(_,x)); \ - .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \ + WEAK_ALIAS(x,__CONCAT(__sys_,x)); \ + WEAK_ALIAS(__CONCAT(_,x),__CONCAT(__sys_,x)); \ _SYSCALL(x); \ bso 2b @@ -55,8 +53,7 @@ ENTRY(__CONCAT(__sys_,x)); \ .text; \ .align 2; \ ENTRY(__CONCAT(__sys_,x)); \ - .weak CNAME(__CONCAT(_,x)); \ - .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \ + WEAK_ALIAS(__CONCAT(_,x),__CONCAT(__sys_,x)); \ _SYSCALL(x); \ bnslr; \ b PIC_PLT(CNAME(HIDENAME(cerror))) @@ -66,10 +63,8 @@ ENTRY(__CONCAT(__sys_,x)); \ .align 2; \ 2: b PIC_PLT(CNAME(HIDENAME(cerror))); \ ENTRY(__CONCAT(__sys_,x)); \ - .weak CNAME(x); \ - .set CNAME(x),CNAME(__CONCAT(__sys_,x)); \ - .weak CNAME(__CONCAT(_,x)); \ - .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \ + WEAK_ALIAS(x,__CONCAT(__sys_,x)); \ + WEAK_ALIAS(__CONCAT(_,x), __CONCAT(__sys_,x)); \ _SYSCALL(x); \ bnslr; \ b PIC_PLT(CNAME(HIDENAME(cerror))) Modified: head/lib/libc/powerpc64/SYS.h ============================================================================== --- head/lib/libc/powerpc64/SYS.h Fri Jan 6 09:17:34 2012 (r229692) +++ head/lib/libc/powerpc64/SYS.h Fri Jan 6 09:21:40 2012 (r229693) @@ -52,10 +52,8 @@ mtlr %r0; \ blr; \ ENTRY(__CONCAT(__sys_,x)); \ - .weak CNAME(x); \ - .set CNAME(x),CNAME(__CONCAT(__sys_,x)); \ - .weak CNAME(__CONCAT(_,x)); \ - .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \ + WEAK_ALIAS(x,__CONCAT(__sys_,x)); \ + WEAK_ALIAS(__CONCAT(_,x),__CONCAT(__sys_,x)); \ _SYSCALL(x); \ bso 2b @@ -63,8 +61,7 @@ ENTRY(__CONCAT(__sys_,x)); \ .text; \ .align 2; \ ENTRY(__CONCAT(__sys_,x)); \ - .weak CNAME(__CONCAT(_,x)); \ - .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \ + WEAK_ALIAS(__CONCAT(_,x),__CONCAT(__sys_,x)); \ _SYSCALL(x); \ bnslr; \ mflr %r0; \ @@ -81,10 +78,8 @@ ENTRY(__CONCAT(__sys_,x)); \ .text; \ .align 2; \ ENTRY(__CONCAT(__sys_,x)); \ - .weak CNAME(x); \ - .set CNAME(x),CNAME(__CONCAT(__sys_,x)); \ - .weak CNAME(__CONCAT(_,x)); \ - .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \ + WEAK_ALIAS(x,__CONCAT(__sys_,x)); \ + WEAK_ALIAS(__CONCAT(_,x), __CONCAT(__sys_,x)); \ _SYSCALL(x); \ bnslr; \ \ From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 10:13:00 2012 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 56C1A106566B; Fri, 6 Jan 2012 10:13:00 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 26ABD8FC08; Fri, 6 Jan 2012 10:13: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 q06AD0EK082684; Fri, 6 Jan 2012 10:13:00 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06ACxxw082682; Fri, 6 Jan 2012 10:12:59 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201201061012.q06ACxxw082682@svn.freebsd.org> From: Jaakko Heinonen Date: Fri, 6 Jan 2012 10:12: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: r229694 - head/sys/fs/pseudofs 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, 06 Jan 2012 10:13:00 -0000 Author: jh Date: Fri Jan 6 10:12:59 2012 New Revision: 229694 URL: http://svn.freebsd.org/changeset/base/229694 Log: r222004 changed sbuf_finish() to not clear the buffer error status. As a consequence sbuf_len() will return -1 for buffers which had the error status set prior to sbuf_finish() call. This causes a problem in pfs_read() which purposely uses a fixed size sbuf to discard bytes which are not needed to fulfill the read request. Work around the problem by using the full buffer length when sbuf_finish() indicates an overflow. An overflowed sbuf with fixed size is always full. PR: kern/163076 Approved by: des MFC after: 2 weeks Modified: head/sys/fs/pseudofs/pseudofs_vnops.c Modified: head/sys/fs/pseudofs/pseudofs_vnops.c ============================================================================== --- head/sys/fs/pseudofs/pseudofs_vnops.c Fri Jan 6 09:21:40 2012 (r229693) +++ head/sys/fs/pseudofs/pseudofs_vnops.c Fri Jan 6 10:12:59 2012 (r229694) @@ -630,14 +630,14 @@ pfs_read(struct vop_read_args *va) if (uio->uio_offset < 0 || uio->uio_resid < 0 || (offset = uio->uio_offset) != uio->uio_offset || (resid = uio->uio_resid) != uio->uio_resid || - (buflen = offset + resid + 1) < offset || buflen > INT_MAX) { + (buflen = offset + resid) < offset || buflen >= INT_MAX) { error = EINVAL; goto ret; } - if (buflen > MAXPHYS + 1) - buflen = MAXPHYS + 1; + if (buflen > MAXPHYS) + buflen = MAXPHYS; - sb = sbuf_new(sb, NULL, buflen, 0); + sb = sbuf_new(sb, NULL, buflen + 1, 0); if (sb == NULL) { error = EIO; goto ret; @@ -650,8 +650,14 @@ pfs_read(struct vop_read_args *va) goto ret; } - sbuf_finish(sb); - error = uiomove_frombuf(sbuf_data(sb), sbuf_len(sb), uio); + /* + * XXX: If the buffer overflowed, sbuf_len() will not return + * the data length. Then just use the full length because an + * overflowed sbuf must be full. + */ + if (sbuf_finish(sb) == 0) + buflen = sbuf_len(sb); + error = uiomove_frombuf(sbuf_data(sb), buflen, uio); sbuf_delete(sb); ret: vn_lock(vn, locked | LK_RETRY); From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 11:06:16 2012 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 44C22106566B; Fri, 6 Jan 2012 11:06:16 +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 2EAF38FC0C; Fri, 6 Jan 2012 11:06: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 q06B6Gfj086851; Fri, 6 Jan 2012 11:06:16 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06B6FIZ086849; Fri, 6 Jan 2012 11:06:15 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201061106.q06B6FIZ086849@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 6 Jan 2012 11:06:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229695 - stable/9/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: Fri, 06 Jan 2012 11:06:16 -0000 Author: kib Date: Fri Jan 6 11:06:15 2012 New Revision: 229695 URL: http://svn.freebsd.org/changeset/base/229695 Log: MFC r228838: Optimize the common case of msyncing the whole file mapping with MS_SYNC flag. Modified: stable/9/sys/vm/vm_object.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/vm/vm_object.c ============================================================================== --- stable/9/sys/vm/vm_object.c Fri Jan 6 10:12:59 2012 (r229694) +++ stable/9/sys/vm/vm_object.c Fri Jan 6 11:06:15 2012 (r229695) @@ -937,7 +937,7 @@ vm_object_sync(vm_object_t object, vm_oo vm_object_t backing_object; struct vnode *vp; struct mount *mp; - int flags; + int flags, fsync_after; if (object == NULL) return; @@ -970,11 +970,26 @@ vm_object_sync(vm_object_t object, vm_oo (void) vn_start_write(vp, &mp, V_WAIT); vfslocked = VFS_LOCK_GIANT(vp->v_mount); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); - flags = (syncio || invalidate) ? OBJPC_SYNC : 0; - flags |= invalidate ? OBJPC_INVAL : 0; + if (syncio && !invalidate && offset == 0 && + OFF_TO_IDX(size) == object->size) { + /* + * If syncing the whole mapping of the file, + * it is faster to schedule all the writes in + * async mode, also allowing the clustering, + * and then wait for i/o to complete. + */ + flags = 0; + fsync_after = TRUE; + } else { + flags = (syncio || invalidate) ? OBJPC_SYNC : 0; + flags |= invalidate ? (OBJPC_SYNC | OBJPC_INVAL) : 0; + fsync_after = FALSE; + } VM_OBJECT_LOCK(object); vm_object_page_clean(object, offset, offset + size, flags); VM_OBJECT_UNLOCK(object); + if (fsync_after) + (void) VOP_FSYNC(vp, MNT_WAIT, curthread); VOP_UNLOCK(vp, 0); VFS_UNLOCK_GIANT(vfslocked); vn_finished_write(mp); From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 11:06:48 2012 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 F10101065670; Fri, 6 Jan 2012 11:06:48 +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 DB8128FC1D; Fri, 6 Jan 2012 11:06:48 +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 q06B6mH3086903; Fri, 6 Jan 2012 11:06:48 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06B6mD0086901; Fri, 6 Jan 2012 11:06:48 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201061106.q06B6mD0086901@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 6 Jan 2012 11:06:48 +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: r229696 - 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: Fri, 06 Jan 2012 11:06:49 -0000 Author: kib Date: Fri Jan 6 11:06:48 2012 New Revision: 229696 URL: http://svn.freebsd.org/changeset/base/229696 Log: MFC r228838: Optimize the common case of msyncing the whole file mapping with MS_SYNC flag. Modified: stable/8/sys/vm/vm_object.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/vm/vm_object.c ============================================================================== --- stable/8/sys/vm/vm_object.c Fri Jan 6 11:06:15 2012 (r229695) +++ stable/8/sys/vm/vm_object.c Fri Jan 6 11:06:48 2012 (r229696) @@ -942,7 +942,7 @@ vm_object_sync(vm_object_t object, vm_oo vm_object_t backing_object; struct vnode *vp; struct mount *mp; - int flags; + int flags, fsync_after; if (object == NULL) return; @@ -975,14 +975,29 @@ vm_object_sync(vm_object_t object, vm_oo (void) vn_start_write(vp, &mp, V_WAIT); vfslocked = VFS_LOCK_GIANT(vp->v_mount); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); - flags = (syncio || invalidate) ? OBJPC_SYNC : 0; - flags |= invalidate ? OBJPC_INVAL : 0; + if (syncio && !invalidate && offset == 0 && + OFF_TO_IDX(size) == object->size) { + /* + * If syncing the whole mapping of the file, + * it is faster to schedule all the writes in + * async mode, also allowing the clustering, + * and then wait for i/o to complete. + */ + flags = 0; + fsync_after = TRUE; + } else { + flags = (syncio || invalidate) ? OBJPC_SYNC : 0; + flags |= invalidate ? (OBJPC_SYNC | OBJPC_INVAL) : 0; + fsync_after = FALSE; + } VM_OBJECT_LOCK(object); vm_object_page_clean(object, OFF_TO_IDX(offset), OFF_TO_IDX(offset + size + PAGE_MASK), flags); VM_OBJECT_UNLOCK(object); + if (fsync_after) + (void) VOP_FSYNC(vp, MNT_WAIT, curthread); VOP_UNLOCK(vp, 0); VFS_UNLOCK_GIANT(vfslocked); vn_finished_write(mp); From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 11:42:03 2012 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 BCB2F106564A; Fri, 6 Jan 2012 11:42:03 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8D0DF8FC08; Fri, 6 Jan 2012 11:42:03 +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 q06Bg32I087972; Fri, 6 Jan 2012 11:42:03 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06Bg37O087970; Fri, 6 Jan 2012 11:42:03 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201201061142.q06Bg37O087970@svn.freebsd.org> From: Ulrich Spoerlein Date: Fri, 6 Jan 2012 11:42:03 +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: r229697 - head/sbin/recoverdisk 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, 06 Jan 2012 11:42:03 -0000 Author: uqs Date: Fri Jan 6 11:42:03 2012 New Revision: 229697 URL: http://svn.freebsd.org/changeset/base/229697 Log: Fix mdoc date from previous commit. Modified: head/sbin/recoverdisk/recoverdisk.1 Modified: head/sbin/recoverdisk/recoverdisk.1 ============================================================================== --- head/sbin/recoverdisk/recoverdisk.1 Fri Jan 6 11:06:48 2012 (r229696) +++ head/sbin/recoverdisk/recoverdisk.1 Fri Jan 6 11:42:03 2012 (r229697) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Jan 5, 2012 +.Dd January 5, 2012 .Dt RECOVERDISK 1 .Os .Sh NAME From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 12:05:44 2012 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 2CEBA1065675; Fri, 6 Jan 2012 12:05:44 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1858A8FC0A; Fri, 6 Jan 2012 12:05: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 q06C5hUK088770; Fri, 6 Jan 2012 12:05:43 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06C5hWn088768; Fri, 6 Jan 2012 12:05:43 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201201061205.q06C5hWn088768@svn.freebsd.org> From: Gleb Smirnoff Date: Fri, 6 Jan 2012 12:05:43 +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: r229698 - 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: Fri, 06 Jan 2012 12:05:44 -0000 Author: glebius Date: Fri Jan 6 12:05:43 2012 New Revision: 229698 URL: http://svn.freebsd.org/changeset/base/229698 Log: Since r228571 CARP is no longer an interface. Modified: head/sys/net/if_media.h Modified: head/sys/net/if_media.h ============================================================================== --- head/sys/net/if_media.h Fri Jan 6 11:42:03 2012 (r229697) +++ head/sys/net/if_media.h Fri Jan 6 12:05:43 2012 (r229698) @@ -247,11 +247,6 @@ uint64_t ifmedia_baudrate(int); #define IFM_ATM_UNASSIGNED 0x00000400 /* unassigned cells */ /* - * CARP Common Address Redundancy Protocol - */ -#define IFM_CARP 0x000000c0 - -/* * Shared media sub-types */ #define IFM_AUTO 0 /* Autoselect best media */ @@ -337,7 +332,6 @@ struct ifmedia_description { { IFM_FDDI, "FDDI" }, \ { IFM_IEEE80211, "IEEE 802.11 Wireless Ethernet" }, \ { IFM_ATM, "ATM" }, \ - { IFM_CARP, "Common Address Redundancy Protocol" }, \ { 0, NULL }, \ } @@ -718,8 +712,6 @@ struct ifmedia_status_description { { "no network", "active" } }, \ { IFM_ATM, IFM_AVALID, IFM_ACTIVE, \ { "no network", "active" } }, \ - { IFM_CARP, IFM_AVALID, IFM_ACTIVE, \ - { "backup", "master" } }, \ { 0, 0, 0, \ { NULL, NULL } } \ } From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 12:27:18 2012 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 830DF106566C; Fri, 6 Jan 2012 12:27:18 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6DFAB8FC15; Fri, 6 Jan 2012 12:27:18 +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 q06CRIOO089550; Fri, 6 Jan 2012 12:27:18 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06CRICP089547; Fri, 6 Jan 2012 12:27:18 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201201061227.q06CRICP089547@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Fri, 6 Jan 2012 12:27:18 +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: r229699 - head/sbin/hastd 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, 06 Jan 2012 12:27:18 -0000 Author: pjd Date: Fri Jan 6 12:27:17 2012 New Revision: 229699 URL: http://svn.freebsd.org/changeset/base/229699 Log: Constify argument. MFC after: 3 days Modified: head/sbin/hastd/subr.c head/sbin/hastd/subr.h Modified: head/sbin/hastd/subr.c ============================================================================== --- head/sbin/hastd/subr.c Fri Jan 6 12:05:43 2012 (r229698) +++ head/sbin/hastd/subr.c Fri Jan 6 12:27:17 2012 (r229699) @@ -149,7 +149,7 @@ role2str(int role) } int -drop_privs(struct hast_resource *res) +drop_privs(const struct hast_resource *res) { char jailhost[sizeof(res->hr_name) * 2]; struct jail jailst; Modified: head/sbin/hastd/subr.h ============================================================================== --- head/sbin/hastd/subr.h Fri Jan 6 12:05:43 2012 (r229698) +++ head/sbin/hastd/subr.h Fri Jan 6 12:27:17 2012 (r229699) @@ -51,6 +51,6 @@ int snprlcat(char *str, size_t size, con int provinfo(struct hast_resource *res, bool dowrite); const char *role2str(int role); -int drop_privs(struct hast_resource *res); +int drop_privs(const struct hast_resource *res); #endif /* !_SUBR_H_ */ From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 12:49:01 2012 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 BD9691065670; Fri, 6 Jan 2012 12:49:01 +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 A890C8FC18; Fri, 6 Jan 2012 12:49: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 q06Cn1UI090245; Fri, 6 Jan 2012 12:49:01 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06Cn1Uh090243; Fri, 6 Jan 2012 12:49:01 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201061249.q06Cn1Uh090243@svn.freebsd.org> From: John Baldwin Date: Fri, 6 Jan 2012 12:49: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: r229700 - 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, 06 Jan 2012 12:49:01 -0000 Author: jhb Date: Fri Jan 6 12:49:01 2012 New Revision: 229700 URL: http://svn.freebsd.org/changeset/base/229700 Log: Tweak the last fix to match what was actually tested. Pointy hat to: jhb Modified: head/sys/netinet/tcp_timewait.c Modified: head/sys/netinet/tcp_timewait.c ============================================================================== --- head/sys/netinet/tcp_timewait.c Fri Jan 6 12:27:17 2012 (r229699) +++ head/sys/netinet/tcp_timewait.c Fri Jan 6 12:49:01 2012 (r229700) @@ -242,7 +242,7 @@ tcp_twstart(struct tcpcb *tp) /* * Recover last window size sent. */ - if (SEQ_GEQ(tp->rcv_adv, tp->rcv_nxt)) + if (SEQ_GT(tp->rcv_adv, tp->rcv_nxt)) tw->last_win = (tp->rcv_adv - tp->rcv_nxt) >> tp->rcv_scale; else tw->last_win = 0; From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 12:49:41 2012 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 8387B106564A; Fri, 6 Jan 2012 12:49:41 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 5122C8FC0C; Fri, 6 Jan 2012 12:49:41 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id E4CA846B0A; Fri, 6 Jan 2012 07:49:40 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 76244B960; Fri, 6 Jan 2012 07:49:40 -0500 (EST) From: John Baldwin To: Sergey Kandaurov Date: Fri, 6 Jan 2012 07:49:39 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p8; KDE/4.5.5; amd64; ; ) References: <201201052229.q05MTBMf059184@svn.freebsd.org> In-Reply-To: MIME-Version: 1.0 Message-Id: <201201060749.39680.jhb@freebsd.org> Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 06 Jan 2012 07:49:40 -0500 (EST) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r229665 - 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, 06 Jan 2012 12:49:41 -0000 On Thursday, January 05, 2012 7:19:29 pm Sergey Kandaurov wrote: > Hi, Looks like a typo there: > /usr/src/sys/netinet/tcp_timewait.c: In function 'tcp_twstart': > /usr/src/sys/netinet/tcp_timewait.c:245: warning: implicit declaration > of function 'SEQ_GE' > /usr/src/sys/netinet/tcp_timewait.c:245: warning: nested extern > declaration of 'SEQ_GE' [-Wnested-externs] Yeah, it was supposed to be SEQ_GT (which is what it was in the testing patch I had sent out that was derived from the patch I committed). Thanks for fixing my breakage. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 13:12:10 2012 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 6AB70106566C; Fri, 6 Jan 2012 13:12:10 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail01.syd.optusnet.com.au (mail01.syd.optusnet.com.au [211.29.132.182]) by mx1.freebsd.org (Postfix) with ESMTP id 01F838FC0C; Fri, 6 Jan 2012 13:12:09 +0000 (UTC) Received: from c211-30-171-136.carlnfd1.nsw.optusnet.com.au (c211-30-171-136.carlnfd1.nsw.optusnet.com.au [211.30.171.136]) by mail01.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q06DC6ZH029458 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 7 Jan 2012 00:12:07 +1100 Date: Sat, 7 Jan 2012 00:12:06 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Andreas Tobler In-Reply-To: <201201060921.q069Lfi8081051@svn.freebsd.org> Message-ID: <20120106225728.G9027@besplex.bde.org> References: <201201060921.q069Lfi8081051@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r229693 - in head/lib/libc: powerpc powerpc64 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, 06 Jan 2012 13:12:10 -0000 On Fri, 6 Jan 2012, Andreas Tobler wrote: > Log: > Use the macro WEAK_ALIAS. Tested on 32 and 64-bit. This API should be fixed before using it extensively. It has the args reversed relative to the C API __weak_reference(). Also, its name is different, and the spelling of "=" in its implementation is different. Perhaps the arg order makes sense for both, since for WEAK_ALIAS() the alias is the first arg, while for __weak_reference() the symbol being referred to to create the alias is the first arg. But this is still confusing. The easiest way to fix this is to remove WEAK_ALIAS() and add an asm API WEAK_REFERENCE(). Unfortunately, ALIAS is a better name than REFERENCE. __weak_reference() is not so easy to change since it is used extensively Similarly for STRONG_ALIAS() and __strong_reference(), except STRONG_REFERENCE() doesn't exist for most arches and __strong_reference() didn't exist until this week, so neither is used extensively. More details on current existence and use of these: In the kernel, WEAK_ALIAS is not defined for amd64 or sparc64, and is never used. In libc, WEAK_ALIAS was only used for arm, ia64 and mips. Now it is used for some i386 string functions. In the kernel, STRONG_ALIAS was only defined for mips, and was never used. Now it is also defined for i386, and is never used. In libc, STRONG_ALIAS was not used. It was used for a few days in some i386 string functions. This was a bug. Now WEAK_ALIAS is used instead, and STRONG_ALIAS is not used again. It is another bug that these "optimized" i386 string functions (strchr/index and strrchr/rindex) even exist. amd64 doesn't have them. The MI versions are not very optimal, but neither are the i386 ones. > Modified: head/lib/libc/powerpc/SYS.h > ============================================================================== > --- head/lib/libc/powerpc/SYS.h Fri Jan 6 09:17:34 2012 (r229692) > +++ head/lib/libc/powerpc/SYS.h Fri Jan 6 09:21:40 2012 (r229693) > @@ -44,10 +44,8 @@ > .align 2; \ > 2: b PIC_PLT(CNAME(HIDENAME(cerror))); \ > ENTRY(__CONCAT(__sys_,x)); \ > - .weak CNAME(x); \ > - .set CNAME(x),CNAME(__CONCAT(__sys_,x)); \ > - .weak CNAME(__CONCAT(_,x)); \ > - .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \ > + WEAK_ALIAS(x,__CONCAT(__sys_,x)); \ > + WEAK_ALIAS(__CONCAT(_,x),__CONCAT(__sys_,x)); \ > _SYSCALL(x); \ > bso 2b > The style bugs in this should be fixed someday. This is still messed up to support K&R. With ancient cpp's, you had to write __CONCAT(x,y) instead of __CONCAT(x, y) to avoid getting a space between x and y. This was fixed in Standard C 22 years ago, but all SYS.h files in libc except ia64's one still use the ugly __CONCAT(x,y) in most places. ia64 hard-codes __CONCAT(x, y) as x ## y instead. The missing space after the comma for the WEAK_ALIAS() parameters is even less necessary. For ancient cpp's, it allowed WEAK_ALIAS to format the asm directives without a space. With STDC cpp's, the formatting is controlled by the macro, but it is still hard to produce nice formatting because cpp may change whitespace. __weak_reference() also difference from WEAK_ALIAS() in the spelling of "=". It uses ".equ". ".set" in the all the SYS.h's except ia64 and mips (*) seems to be yet another spelling. (*) ia64 avoids the hard coded directive using WEAK_ALIAS(). mips hard-codes "=" instead of ".set". Some other gratuitous differences in the SYS.h's: - arm and mips use _C_LABEL() instead of CNAME() - ia64 doesn't use either _C_LABEL() or CNAME() - arm, ia64 and mips don't use HIDENAME() for cerror: - arm uses CERROR and hard-codes this as _C_LABEL(cerror) - ia64 hard-codes it as .cerror - mips hard-codes it as __cerror. - sparc64 doesn't use ENTRY() or END() and has to repeat things like .type and .size found in those when it defines _SYSENTRY() and _SYSEND(). It doesn't use CNAME() in these definitions. Underscores in these names are bogus, since these names are even less public than ENTRY() and END() which don't have them. Some of these differences may be due to FreeBSD's cleaning up or down of the decomposition of SYS.h and only for older arches. Both of these files are MD so you can hard-code things in either, but I think it is best put as much of the details as possible in the lowest level, which is . Using WEAK_ALIAS() from there is a step in this direction. Bruce From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 13:45:15 2012 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 55E871065675; Fri, 6 Jan 2012 13:45:15 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 27A3C8FC14; Fri, 6 Jan 2012 13:45:15 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id D3A7446B09; Fri, 6 Jan 2012 08:45:14 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 426DBB960; Fri, 6 Jan 2012 08:45:14 -0500 (EST) From: John Baldwin To: Gleb Smirnoff Date: Fri, 6 Jan 2012 08:45:12 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p8; KDE/4.5.5; amd64; ; ) References: <201201051950.q05JoCKj052356@svn.freebsd.org> <20120106082005.GQ34721@FreeBSD.org> In-Reply-To: <20120106082005.GQ34721@FreeBSD.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="koi8-r" Content-Transfer-Encoding: 7bit Message-Id: <201201060845.13174.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 06 Jan 2012 08:45:14 -0500 (EST) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org Subject: Re: svn commit: r229633 - stable/9/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: Fri, 06 Jan 2012 13:45:15 -0000 On Friday, January 06, 2012 3:20:05 am Gleb Smirnoff wrote: > John, > > On Thu, Jan 05, 2012 at 07:50:12PM +0000, John Baldwin wrote: > J> Author: jhb > J> Date: Thu Jan 5 19:50:12 2012 > J> New Revision: 229633 > J> URL: http://svn.freebsd.org/changeset/base/229633 > J> > J> Log: > J> MFC 228089: > J> Change the if_vlan driver to use if_transmit for forwarding packets to the > J> parent interface. This avoids the overhead of queueing a packet to an IFQ > J> only to immediately dequeue it again. > > This should have been merged together with r228967. Now a bug that > was successfully discovered and fixed in head/ leaked to stable > branches. :( > > Can you please merge r228967 to stable/9 and stable/8 ASAP? Err, that bug was already present before this change. I did not expose it. I can MFC the stat fixes, but this was already broken in 8 and 9, and is broken in 7 as well (likely in older branches than that). -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 14:00:32 2012 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 869711065673; Fri, 6 Jan 2012 14:00:32 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 71BAE8FC19; Fri, 6 Jan 2012 14:00: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 q06E0W6N092467; Fri, 6 Jan 2012 14:00:32 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06E0W0g092465; Fri, 6 Jan 2012 14:00:32 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201201061400.q06E0W0g092465@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Fri, 6 Jan 2012 14:00: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: r229701 - head/etc/rc.d 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, 06 Jan 2012 14:00:32 -0000 Author: pjd Date: Fri Jan 6 14:00:31 2012 New Revision: 229701 URL: http://svn.freebsd.org/changeset/base/229701 Log: Add 'nojail' keyword as auditd(8) can't really do anything useful when inside a jail. Discussed with: rwatson MFC after: 1 week Modified: head/etc/rc.d/auditd Modified: head/etc/rc.d/auditd ============================================================================== --- head/etc/rc.d/auditd Fri Jan 6 12:49:01 2012 (r229700) +++ head/etc/rc.d/auditd Fri Jan 6 14:00:31 2012 (r229701) @@ -8,7 +8,7 @@ # PROVIDE: auditd # REQUIRE: syslogd # BEFORE: DAEMON -# KEYWORD: shutdown +# KEYWORD: nojail shutdown . /etc/rc.subr From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 14:25:01 2012 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 EA6EA1065673; Fri, 6 Jan 2012 14:25:01 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.64.117]) by mx1.freebsd.org (Postfix) with ESMTP id 5003D8FC0A; Fri, 6 Jan 2012 14:25:01 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.5/8.14.5) with ESMTP id q06EOxAP063795; Fri, 6 Jan 2012 18:24:59 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id q06EOxNH063794; Fri, 6 Jan 2012 18:24:59 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Fri, 6 Jan 2012 18:24:59 +0400 From: Gleb Smirnoff To: John Baldwin Message-ID: <20120106142459.GR34721@FreeBSD.org> References: <201201051950.q05JoCKj052356@svn.freebsd.org> <20120106082005.GQ34721@FreeBSD.org> <201201060845.13174.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <201201060845.13174.jhb@freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-stable@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, svn-src-stable-9@FreeBSD.org Subject: Re: svn commit: r229633 - stable/9/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: Fri, 06 Jan 2012 14:25:02 -0000 On Fri, Jan 06, 2012 at 08:45:12AM -0500, John Baldwin wrote: J> On Friday, January 06, 2012 3:20:05 am Gleb Smirnoff wrote: J> > John, J> > J> > On Thu, Jan 05, 2012 at 07:50:12PM +0000, John Baldwin wrote: J> > J> Author: jhb J> > J> Date: Thu Jan 5 19:50:12 2012 J> > J> New Revision: 229633 J> > J> URL: http://svn.freebsd.org/changeset/base/229633 J> > J> J> > J> Log: J> > J> MFC 228089: J> > J> Change the if_vlan driver to use if_transmit for forwarding packets to the J> > J> parent interface. This avoids the overhead of queueing a packet to an IFQ J> > J> only to immediately dequeue it again. J> > J> > This should have been merged together with r228967. Now a bug that J> > was successfully discovered and fixed in head/ leaked to stable J> > branches. :( J> > J> > Can you please merge r228967 to stable/9 and stable/8 ASAP? J> J> Err, that bug was already present before this change. I did not expose it. J> J> I can MFC the stat fixes, but this was already broken in 8 and 9, and is J> broken in 7 as well (likely in older branches than that). Well, on 8.2-STABLE if_obytes are correctly accounted: glebius@xxx:~:|>netstat -hI vlan2 1 input (vlan2) output packets errs idrops bytes packets errs bytes colls 33 0 0 2.3k 4 0 840 0 36 0 0 2.4k 4 0 442 0 32 0 0 2.3k 6 0 887 0 glebius@xxx:~:|>uname -v FreeBSD 8.2-STABLE #2: Wed Jul 6 13:22:13 MSD 2011 While on 228089 =< head < 228967 they are not: glebius@xxx2:~:|>netstat -hI vlan77 1 input (vlan77) output packets errs idrops bytes packets errs bytes colls 9.1k 0 0 2M 12k 0 0 0 11k 0 0 4.3M 14k 0 0 0 10k 0 0 2.8M 14k 0 0 0 9.4k 0 0 2.3M 13k 0 0 0 glebius@xxx2:~:|>uname -v FreeBSD 10.0-CURRENT #5 r228769M: Thu Dec 22 19:44:57 MSK 2011 -- Totus tuus, Glebius. From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 14:51:20 2012 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 E0AAB106566B; Fri, 6 Jan 2012 14:51:20 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id B0AA28FC16; Fri, 6 Jan 2012 14:51:20 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id 5139F46B0A; Fri, 6 Jan 2012 09:51:20 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id AF762B960; Fri, 6 Jan 2012 09:51:19 -0500 (EST) From: John Baldwin To: Gleb Smirnoff Date: Fri, 6 Jan 2012 09:50:13 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p8; KDE/4.5.5; amd64; ; ) References: <201201051950.q05JoCKj052356@svn.freebsd.org> <201201060845.13174.jhb@freebsd.org> <20120106142459.GR34721@FreeBSD.org> In-Reply-To: <20120106142459.GR34721@FreeBSD.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="koi8-r" Content-Transfer-Encoding: 7bit Message-Id: <201201060950.13736.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 06 Jan 2012 09:51:19 -0500 (EST) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org Subject: Re: svn commit: r229633 - stable/9/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: Fri, 06 Jan 2012 14:51:21 -0000 On Friday, January 06, 2012 9:24:59 am Gleb Smirnoff wrote: > On Fri, Jan 06, 2012 at 08:45:12AM -0500, John Baldwin wrote: > J> On Friday, January 06, 2012 3:20:05 am Gleb Smirnoff wrote: > J> > John, > J> > > J> > On Thu, Jan 05, 2012 at 07:50:12PM +0000, John Baldwin wrote: > J> > J> Author: jhb > J> > J> Date: Thu Jan 5 19:50:12 2012 > J> > J> New Revision: 229633 > J> > J> URL: http://svn.freebsd.org/changeset/base/229633 > J> > J> > J> > J> Log: > J> > J> MFC 228089: > J> > J> Change the if_vlan driver to use if_transmit for forwarding packets to the > J> > J> parent interface. This avoids the overhead of queueing a packet to an IFQ > J> > J> only to immediately dequeue it again. > J> > > J> > This should have been merged together with r228967. Now a bug that > J> > was successfully discovered and fixed in head/ leaked to stable > J> > branches. :( > J> > > J> > Can you please merge r228967 to stable/9 and stable/8 ASAP? > J> > J> Err, that bug was already present before this change. I did not expose it. > J> > J> I can MFC the stat fixes, but this was already broken in 8 and 9, and is > J> broken in 7 as well (likely in older branches than that). > > Well, on 8.2-STABLE if_obytes are correctly accounted: > > glebius@xxx:~:|>netstat -hI vlan2 1 > input (vlan2) output > packets errs idrops bytes packets errs bytes colls > 33 0 0 2.3k 4 0 840 0 > 36 0 0 2.4k 4 0 442 0 > 32 0 0 2.3k 6 0 887 0 > > glebius@xxx:~:|>uname -v > FreeBSD 8.2-STABLE #2: Wed Jul 6 13:22:13 MSD 2011 > > While on 228089 =< head < 228967 they are not: > > glebius@xxx2:~:|>netstat -hI vlan77 1 > input (vlan77) output > packets errs idrops bytes packets errs bytes colls > 9.1k 0 0 2M 12k 0 0 0 > 11k 0 0 4.3M 14k 0 0 0 > 10k 0 0 2.8M 14k 0 0 0 > 9.4k 0 0 2.3M 13k 0 0 0 > > glebius@xxx2:~:|>uname -v > FreeBSD 10.0-CURRENT #5 r228769M: Thu Dec 22 19:44:57 MSK 2011 Hmm, it seems to be a side effect of the IFQ macros. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 15:01:06 2012 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 8931E106574C; Fri, 6 Jan 2012 15:01:06 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 599ED8FC0A; Fri, 6 Jan 2012 15:01: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 q06F16Hr094601; Fri, 6 Jan 2012 15:01:06 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06F16UK094599; Fri, 6 Jan 2012 15:01:06 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201201061501.q06F16UK094599@svn.freebsd.org> From: Gleb Smirnoff Date: Fri, 6 Jan 2012 15:01: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: r229702 - head/sbin/devd 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, 06 Jan 2012 15:01:06 -0000 Author: glebius Date: Fri Jan 6 15:01:05 2012 New Revision: 229702 URL: http://svn.freebsd.org/changeset/base/229702 Log: Fix build. Modified: head/sbin/devd/devd.cc Modified: head/sbin/devd/devd.cc ============================================================================== --- head/sbin/devd/devd.cc Fri Jan 6 14:00:31 2012 (r229701) +++ head/sbin/devd/devd.cc Fri Jan 6 15:01:05 2012 (r229702) @@ -298,7 +298,6 @@ media::media(config &, const char *var, { IFM_FDDI, "FDDI" }, { IFM_IEEE80211, "802.11" }, { IFM_ATM, "ATM" }, - { IFM_CARP, "CARP" }, { -1, "unknown" }, { 0, NULL }, }; From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 15:07:29 2012 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 D8AB0106566B; Fri, 6 Jan 2012 15:07:28 +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 C067A8FC16; Fri, 6 Jan 2012 15:07: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 q06F7SAj094820; Fri, 6 Jan 2012 15:07:28 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06F7Sj6094812; Fri, 6 Jan 2012 15:07:28 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201061507.q06F7Sj6094812@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 6 Jan 2012 15:07:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229703 - in stable/9: . sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/fs/devfs sys/fs/nullfs sys/fs/pseudofs 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, 06 Jan 2012 15:07:29 -0000 Author: kib Date: Fri Jan 6 15:07:28 2012 New Revision: 229703 URL: http://svn.freebsd.org/changeset/base/229703 Log: MFC r227697: Change the interface for VOP_VPTOCNP(), now the dvp must be referenced. Convert all in-tree implementations of VOP_VPTOCNP(). This fixes VOP_VPTOCNP bypass for nullfs. Approved by: re (bz) Modified: stable/9/UPDATING stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c stable/9/sys/fs/devfs/devfs_vnops.c stable/9/sys/fs/nullfs/null_vnops.c stable/9/sys/fs/pseudofs/pseudofs_vnops.c stable/9/sys/kern/vfs_cache.c stable/9/sys/kern/vfs_default.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/UPDATING ============================================================================== --- stable/9/UPDATING Fri Jan 6 15:01:05 2012 (r229702) +++ stable/9/UPDATING Fri Jan 6 15:07:28 2012 (r229703) @@ -10,6 +10,11 @@ Items affecting the ports and packages s /usr/ports/UPDATING. Please read that file before running portupgrade. 20120106: + The interface of the VOP_VPTOCNP(9) changed, now the returned + vnode shall be referenced, previously it was required to be + only held. All in-tree filesystems are converted. + +20120106: 9.0-RELEASE. 20111101: Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Fri Jan 6 15:01:05 2012 (r229702) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Fri Jan 6 15:07:28 2012 (r229703) @@ -1594,7 +1594,7 @@ zfsctl_snapshot_vptocnp(struct vop_vptoc *ap->a_buflen -= len; bcopy(sep->se_name, ap->a_buf + *ap->a_buflen, len); mutex_exit(&sdp->sd_lock); - vhold(dvp); + vref(dvp); *ap->a_vpp = dvp; } VN_RELE(dvp); Modified: stable/9/sys/fs/devfs/devfs_vnops.c ============================================================================== --- stable/9/sys/fs/devfs/devfs_vnops.c Fri Jan 6 15:01:05 2012 (r229702) +++ stable/9/sys/fs/devfs/devfs_vnops.c Fri Jan 6 15:07:28 2012 (r229703) @@ -261,7 +261,7 @@ devfs_vptocnp(struct vop_vptocnp_args *a } else if (vp->v_type == VDIR) { if (dd == dmp->dm_rootdir) { *dvp = vp; - vhold(*dvp); + vref(*dvp); goto finished; } i -= dd->de_dirent->d_namlen; @@ -289,6 +289,8 @@ devfs_vptocnp(struct vop_vptocnp_args *a mtx_unlock(&devfs_de_interlock); vholdl(*dvp); VI_UNLOCK(*dvp); + vref(*dvp); + vdrop(*dvp); } else { mtx_unlock(&devfs_de_interlock); error = ENOENT; Modified: stable/9/sys/fs/nullfs/null_vnops.c ============================================================================== --- stable/9/sys/fs/nullfs/null_vnops.c Fri Jan 6 15:01:05 2012 (r229702) +++ stable/9/sys/fs/nullfs/null_vnops.c Fri Jan 6 15:07:28 2012 (r229703) @@ -784,6 +784,7 @@ null_vptocnp(struct vop_vptocnp_args *ap vhold(lvp); VOP_UNLOCK(vp, 0); /* vp is held by vn_vptocnp_locked that called us */ ldvp = lvp; + vref(lvp); error = vn_vptocnp(&ldvp, cred, ap->a_buf, ap->a_buflen); vdrop(lvp); if (error != 0) { @@ -797,19 +798,17 @@ null_vptocnp(struct vop_vptocnp_args *ap */ error = vn_lock(ldvp, LK_EXCLUSIVE); if (error != 0) { + vrele(ldvp); vn_lock(vp, locked | LK_RETRY); - vdrop(ldvp); return (ENOENT); } vref(ldvp); - vdrop(ldvp); error = null_nodeget(vp->v_mount, ldvp, dvp); if (error == 0) { #ifdef DIAGNOSTIC NULLVPTOLOWERVP(*dvp); #endif - vhold(*dvp); - vput(*dvp); + VOP_UNLOCK(*dvp, 0); /* keep reference on *dvp */ } else vput(ldvp); Modified: stable/9/sys/fs/pseudofs/pseudofs_vnops.c ============================================================================== --- stable/9/sys/fs/pseudofs/pseudofs_vnops.c Fri Jan 6 15:01:05 2012 (r229702) +++ stable/9/sys/fs/pseudofs/pseudofs_vnops.c Fri Jan 6 15:07:28 2012 (r229703) @@ -410,8 +410,7 @@ pfs_vptocnp(struct vop_vptocnp_args *ap) } *buflen = i; - vhold(*dvp); - vput(*dvp); + VOP_UNLOCK(*dvp, 0); vn_lock(vp, locked | LK_RETRY); vfs_unbusy(mp); Modified: stable/9/sys/kern/vfs_cache.c ============================================================================== --- stable/9/sys/kern/vfs_cache.c Fri Jan 6 15:01:05 2012 (r229702) +++ stable/9/sys/kern/vfs_cache.c Fri Jan 6 15:07:28 2012 (r229703) @@ -1067,16 +1067,8 @@ vn_vptocnp(struct vnode **vp, struct ucr CACHE_RLOCK(); error = vn_vptocnp_locked(vp, cred, buf, buflen); - if (error == 0) { - /* - * vn_vptocnp_locked() dropped hold acquired by - * VOP_VPTOCNP immediately after locking the - * cache. Since we are going to drop the cache rlock, - * re-hold the result. - */ - vhold(*vp); + if (error == 0) CACHE_RUNLOCK(); - } return (error); } @@ -1095,6 +1087,9 @@ vn_vptocnp_locked(struct vnode **vp, str if (ncp != NULL) { if (*buflen < ncp->nc_nlen) { CACHE_RUNLOCK(); + vfslocked = VFS_LOCK_GIANT((*vp)->v_mount); + vrele(*vp); + VFS_UNLOCK_GIANT(vfslocked); numfullpathfail4++; error = ENOMEM; SDT_PROBE(vfs, namecache, fullpath, return, error, @@ -1105,18 +1100,23 @@ vn_vptocnp_locked(struct vnode **vp, str memcpy(buf + *buflen, ncp->nc_name, ncp->nc_nlen); SDT_PROBE(vfs, namecache, fullpath, hit, ncp->nc_dvp, ncp->nc_name, vp, 0, 0); + dvp = *vp; *vp = ncp->nc_dvp; + vref(*vp); + CACHE_RUNLOCK(); + vfslocked = VFS_LOCK_GIANT(dvp->v_mount); + vrele(dvp); + VFS_UNLOCK_GIANT(vfslocked); + CACHE_RLOCK(); return (0); } SDT_PROBE(vfs, namecache, fullpath, miss, vp, 0, 0, 0, 0); - vhold(*vp); CACHE_RUNLOCK(); vfslocked = VFS_LOCK_GIANT((*vp)->v_mount); vn_lock(*vp, LK_SHARED | LK_RETRY); error = VOP_VPTOCNP(*vp, &dvp, cred, buf, buflen); - VOP_UNLOCK(*vp, 0); - vdrop(*vp); + vput(*vp); VFS_UNLOCK_GIANT(vfslocked); if (error) { numfullpathfail2++; @@ -1127,16 +1127,20 @@ vn_vptocnp_locked(struct vnode **vp, str *vp = dvp; CACHE_RLOCK(); - if ((*vp)->v_iflag & VI_DOOMED) { + if (dvp->v_iflag & VI_DOOMED) { /* forced unmount */ CACHE_RUNLOCK(); - vdrop(*vp); + vfslocked = VFS_LOCK_GIANT(dvp->v_mount); + vrele(dvp); + VFS_UNLOCK_GIANT(vfslocked); error = ENOENT; SDT_PROBE(vfs, namecache, fullpath, return, error, vp, NULL, 0, 0); return (error); } - vdrop(*vp); + /* + * *vp has its use count incremented still. + */ return (0); } @@ -1148,10 +1152,11 @@ static int vn_fullpath1(struct thread *td, struct vnode *vp, struct vnode *rdir, char *buf, char **retbuf, u_int buflen) { - int error, slash_prefixed; + int error, slash_prefixed, vfslocked; #ifdef KDTRACE_HOOKS struct vnode *startvp = vp; #endif + struct vnode *vp1; buflen--; buf[buflen] = '\0'; @@ -1160,6 +1165,7 @@ vn_fullpath1(struct thread *td, struct v SDT_PROBE(vfs, namecache, fullpath, entry, vp, 0, 0, 0, 0); numfullpathcalls++; + vref(vp); CACHE_RLOCK(); if (vp->v_type != VDIR) { error = vn_vptocnp_locked(&vp, td->td_ucred, buf, &buflen); @@ -1167,6 +1173,9 @@ vn_fullpath1(struct thread *td, struct v return (error); if (buflen == 0) { CACHE_RUNLOCK(); + vfslocked = VFS_LOCK_GIANT(vp->v_mount); + vrele(vp); + VFS_UNLOCK_GIANT(vfslocked); return (ENOMEM); } buf[--buflen] = '/'; @@ -1176,16 +1185,29 @@ vn_fullpath1(struct thread *td, struct v if (vp->v_vflag & VV_ROOT) { if (vp->v_iflag & VI_DOOMED) { /* forced unmount */ CACHE_RUNLOCK(); + vfslocked = VFS_LOCK_GIANT(vp->v_mount); + vrele(vp); + VFS_UNLOCK_GIANT(vfslocked); error = ENOENT; SDT_PROBE(vfs, namecache, fullpath, return, error, vp, NULL, 0, 0); break; } - vp = vp->v_mount->mnt_vnodecovered; + vp1 = vp->v_mount->mnt_vnodecovered; + vref(vp1); + CACHE_RUNLOCK(); + vfslocked = VFS_LOCK_GIANT(vp->v_mount); + vrele(vp); + VFS_UNLOCK_GIANT(vfslocked); + vp = vp1; + CACHE_RLOCK(); continue; } if (vp->v_type != VDIR) { CACHE_RUNLOCK(); + vfslocked = VFS_LOCK_GIANT(vp->v_mount); + vrele(vp); + VFS_UNLOCK_GIANT(vfslocked); numfullpathfail1++; error = ENOTDIR; SDT_PROBE(vfs, namecache, fullpath, return, @@ -1197,6 +1219,9 @@ vn_fullpath1(struct thread *td, struct v break; if (buflen == 0) { CACHE_RUNLOCK(); + vfslocked = VFS_LOCK_GIANT(vp->v_mount); + vrele(vp); + VFS_UNLOCK_GIANT(vfslocked); error = ENOMEM; SDT_PROBE(vfs, namecache, fullpath, return, error, startvp, NULL, 0, 0); @@ -1210,6 +1235,9 @@ vn_fullpath1(struct thread *td, struct v if (!slash_prefixed) { if (buflen == 0) { CACHE_RUNLOCK(); + vfslocked = VFS_LOCK_GIANT(vp->v_mount); + vrele(vp); + VFS_UNLOCK_GIANT(vfslocked); numfullpathfail4++; SDT_PROBE(vfs, namecache, fullpath, return, ENOMEM, startvp, NULL, 0, 0); @@ -1219,6 +1247,9 @@ vn_fullpath1(struct thread *td, struct v } numfullpathfound++; CACHE_RUNLOCK(); + vfslocked = VFS_LOCK_GIANT(vp->v_mount); + vrele(vp); + VFS_UNLOCK_GIANT(vfslocked); SDT_PROBE(vfs, namecache, fullpath, return, 0, startvp, buf + buflen, 0, 0); Modified: stable/9/sys/kern/vfs_default.c ============================================================================== --- stable/9/sys/kern/vfs_default.c Fri Jan 6 15:01:05 2012 (r229702) +++ stable/9/sys/kern/vfs_default.c Fri Jan 6 15:07:28 2012 (r229703) @@ -843,7 +843,7 @@ out: free(dirbuf, M_TEMP); if (!error) { *buflen = i; - vhold(*dvp); + vref(*dvp); } if (covered) { vput(*dvp); From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 16:20:18 2012 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 42CC5106564A; Fri, 6 Jan 2012 16:20:18 +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 CD2518FC08; Fri, 6 Jan 2012 16:20: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 q06GKHZA097123; Fri, 6 Jan 2012 16:20:17 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06GKHx3097121; Fri, 6 Jan 2012 16:20:17 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201201061620.q06GKHx3097121@svn.freebsd.org> From: Ed Schouten Date: Fri, 6 Jan 2012 16:20:17 +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: r229704 - head/include 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, 06 Jan 2012 16:20:18 -0000 Author: ed Date: Fri Jan 6 16:20:17 2012 New Revision: 229704 URL: http://svn.freebsd.org/changeset/base/229704 Log: Add an even faster implementation of for the future. Instead of using an exponential number of cases with respect to the number of arguments, this version only uses a linear number. Unfortunately, it works with Clang, GCC 4.6 and GCC 4.7, but not GCC 4.2. Therefore, leave it commented out. Modified: head/include/tgmath.h Modified: head/include/tgmath.h ============================================================================== --- head/include/tgmath.h Fri Jan 6 15:07:28 2012 (r229703) +++ head/include/tgmath.h Fri Jan 6 16:20:17 2012 (r229704) @@ -59,6 +59,25 @@ #error " not implemented for this compiler" #endif +#if 0 /* XXX: Much shorter and faster to compile, but broken with GCC 4.2. */ +#define __tg_generic(x, cfnl, cfn, cfnf, fnl, fn, fnf) \ + __generic(x, long double _Complex, cfnl, \ + __generic(x, double _Complex, cfn, \ + __generic(x, float _Complex, cfnf, \ + __generic(x, long double, fnl, \ + __generic(x, float, fnf, fn))))) +#define __tg_type(x) \ + __tg_generic(x, (long double _Complex)0, (double _Complex)0, \ + (float _Complex)0, (long double)0, (double)0, (float)0) +#define __tg_impl_simple(x, y, z, fnl, fn, fnf, ...) \ + __tg_generic( \ + __tg_type(x) + __tg_type(y) + __tg_type(z), \ + fnl, fn, fnf, fnl, fn, fnf)(__VA_ARGS__) +#define __tg_impl_full(x, y, cfnl, cfn, cfnf, fnl, fn, fnf, ...) \ + __tg_generic( \ + __tg_type(x) + __tg_type(y), \ + cfnl, cfn, cfnf, fnl, fn, fnf)(__VA_ARGS__) +#else #define __tg_generic_simple(x, fnl, fn, fnf) \ __generic(x, long double _Complex, fnl, \ __generic(x, double _Complex, fn, \ @@ -94,6 +113,7 @@ __tg_generic_full(y, cfnl, cfn , cfn , fnl , fn , fn ), \ __tg_generic_full(y, cfnl, cfn , cfnf, fnl , fn , fnf )) \ (__VA_ARGS__) +#endif /* Macros to save lots of repetition below */ #define __tg_simple(x, fn) \ From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 16:45:45 2012 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 206A81065678; Fri, 6 Jan 2012 16:45:45 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0AEA98FC13; Fri, 6 Jan 2012 16:45: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 q06GjimD097987; Fri, 6 Jan 2012 16:45:44 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06GjiK4097985; Fri, 6 Jan 2012 16:45:44 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201201061645.q06GjiK4097985@svn.freebsd.org> From: Mikolaj Golub Date: Fri, 6 Jan 2012 16:45:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229705 - stable/9/sys/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, 06 Jan 2012 16:45:45 -0000 Author: trociny Date: Fri Jan 6 16:45:44 2012 New Revision: 229705 URL: http://svn.freebsd.org/changeset/base/229705 Log: MFC r227954: Add const qualifier to rlimit_ident. Modified: stable/9/sys/sys/resource.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/sys/resource.h ============================================================================== --- stable/9/sys/sys/resource.h Fri Jan 6 16:20:17 2012 (r229704) +++ stable/9/sys/sys/resource.h Fri Jan 6 16:45:44 2012 (r229705) @@ -108,7 +108,7 @@ struct rusage { */ #ifdef _RLIMIT_IDENT -static char *rlimit_ident[RLIM_NLIMITS] = { +static const char *rlimit_ident[RLIM_NLIMITS] = { "cpu", "fsize", "data", From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 16:46:53 2012 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 1AD27106564A; Fri, 6 Jan 2012 16:46:53 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 04CDD8FC13; Fri, 6 Jan 2012 16:46:53 +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 q06GkqVf098056; Fri, 6 Jan 2012 16:46:52 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06Gkqnb098054; Fri, 6 Jan 2012 16:46:52 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201201061646.q06Gkqnb098054@svn.freebsd.org> From: Mikolaj Golub Date: Fri, 6 Jan 2012 16:46:52 +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: r229706 - stable/8/sys/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, 06 Jan 2012 16:46:53 -0000 Author: trociny Date: Fri Jan 6 16:46:52 2012 New Revision: 229706 URL: http://svn.freebsd.org/changeset/base/229706 Log: MFC r227954: Add const qualifier to rlimit_ident. Modified: stable/8/sys/sys/resource.h Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/sys/resource.h ============================================================================== --- stable/8/sys/sys/resource.h Fri Jan 6 16:45:44 2012 (r229705) +++ stable/8/sys/sys/resource.h Fri Jan 6 16:46:52 2012 (r229706) @@ -108,7 +108,7 @@ struct rusage { */ #ifdef _RLIMIT_IDENT -static char *rlimit_ident[RLIM_NLIMITS] = { +static const char *rlimit_ident[RLIM_NLIMITS] = { "cpu", "fsize", "data", From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 16:49:43 2012 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 115D9106566C; Fri, 6 Jan 2012 16:49:43 +0000 (UTC) (envelope-from guy.helmer@palisadesystems.com) Received: from ps-1-a.compliancesafe.com (ps-1-a.compliancesafe.com [216.81.161.161]) by mx1.freebsd.org (Postfix) with ESMTP id B24E48FC0A; Fri, 6 Jan 2012 16:49:42 +0000 (UTC) Received: from mail.palisadesystems.com (localhost [127.0.0.1]) by ps-1-a.compliancesafe.com (8.14.4/8.14.3) with ESMTP id q06GIZ6Q082629; Fri, 6 Jan 2012 10:18:35 -0600 (CST) (envelope-from guy.helmer@palisadesystems.com) Received: from guysmbp.dyn.palisadesys.com (GuysMBP.dyn.palisadesys.com [172.16.2.90]) (authenticated bits=0) by mail.palisadesystems.com (8.14.3/8.14.3) with ESMTP id q06GISoB025557 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Fri, 6 Jan 2012 10:18:29 -0600 (CST) (envelope-from guy.helmer@palisadesystems.com) X-DKIM: Sendmail DKIM Filter v2.8.3 mail.palisadesystems.com q06GISoB025557 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=palisadesystems.com; s=mail; t=1325866709; bh=z80dQqAsFwu1h1Oef0Tdj448kXHNT7n3RD3NFoWx+tg=; l=128; h=Subject:Mime-Version:Content-Type:From:In-Reply-To:Date:Cc: Content-Transfer-Encoding:Message-Id:References:To; b=jaT3RBvb69BYSuoZo0y8c/Udd9CRc3nYbWSc7IjXgjFuwEr/EH8k6PWtCVMqKNM0o 8ak0mKngNweTS0RvGJfmGBnH15IDuph+Me/MJf/gBeBqA6Xa1eQiyFUDTafJJKhGHj gcDnyJOgqh9CdfUcK3O8Xpio97lAGSjc0cXQjtPk= Mime-Version: 1.0 (Apple Message framework v1251.1) Content-Type: text/plain; charset=iso-8859-1 From: Guy Helmer In-Reply-To: <4F066340.9010507@FreeBSD.org> Date: Fri, 6 Jan 2012 10:18:29 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201201052248.q05MmaZk059871@svn.freebsd.org> <4F066340.9010507@FreeBSD.org> To: Doug Barton X-Mailer: Apple Mail (2.1251.1) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.5 (mail.palisadesystems.com [172.16.1.5]); Fri, 06 Jan 2012 10:18:29 -0600 (CST) X-Palisade-MailScanner-Information: Please contact the ISP for more information X-Palisade-MailScanner-ID: q06GISoB025557 X-Palisade-MailScanner: Found to be clean X-Palisade-MailScanner-SpamCheck: not spam (whitelisted), SpamAssassin (score=-1.628, required 5, ALL_TRUSTED -1.00, BAYES_00 -1.90, RP_8BIT 1.27) X-Palisade-MailScanner-From: guy.helmer@palisadesystems.com X-Spam-Status: No X-PacketSure-Scanned: Yes Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r229667 - head/usr.sbin/daemon 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, 06 Jan 2012 16:49:43 -0000 On Jan 5, 2012, at 8:58 PM, Doug Barton wrote: > On 01/05/2012 14:48, Guy Helmer wrote: >> Allow daemon(8) to run pidfile_open() before relenquishing = privileges >> so pid files can be written in /var/run when started as root. >=20 > I'm not sure how useful this is since when daemon is exiting it won't = be > able to remove the pid file (unless I'm missing something). >=20 > Isn't it better to pre-create the pid file with the proper permissions > for the unprivileged user? >=20 Would it be OK for daemon to hang around and wait for the child process = to exit, then remove the pid file? The only other alternative I see would be to create a subdirectory that = is writable by the user so the child can create and delete the pid file. Guy= -------- This message has been scanned by ComplianceSafe, powered by Palisade's PacketSure. From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 16:54:17 2012 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 3DEF2106566B; Fri, 6 Jan 2012 16:54:17 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0DA5A8FC18; Fri, 6 Jan 2012 16:54: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 q06GsGBL098351; Fri, 6 Jan 2012 16:54:16 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06GsGKb098348; Fri, 6 Jan 2012 16:54:16 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201201061654.q06GsGKb098348@svn.freebsd.org> From: Mikolaj Golub Date: Fri, 6 Jan 2012 16:54:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229707 - in stable/9/sys: 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: Fri, 06 Jan 2012 16:54:17 -0000 Author: trociny Date: Fri Jan 6 16:54:16 2012 New Revision: 229707 URL: http://svn.freebsd.org/changeset/base/229707 Log: MFC r227316: Add KVME_FLAG_SUPER and use it in sysctl_kern_proc_vmmap for marking entries with superpages. Submitted by: Mel Flynn Reviewed by: alc, rwatson Modified: stable/9/sys/kern/kern_proc.c stable/9/sys/sys/user.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/kern_proc.c ============================================================================== --- stable/9/sys/kern/kern_proc.c Fri Jan 6 16:46:52 2012 (r229706) +++ stable/9/sys/kern/kern_proc.c Fri Jan 6 16:54:16 2012 (r229707) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -75,6 +76,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #ifdef COMPAT_FREEBSD32 @@ -1710,7 +1712,8 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_AR entry = entry->next) { vm_object_t obj, tobj, lobj; vm_offset_t addr; - int vfslocked; + vm_paddr_t locked_pa; + int vfslocked, mincoreinfo; if (entry->eflags & MAP_ENTRY_IS_SUB_MAP) continue; @@ -1728,8 +1731,14 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_AR kve->kve_resident = 0; addr = entry->start; while (addr < entry->end) { - if (pmap_extract(map->pmap, addr)) + locked_pa = 0; + mincoreinfo = pmap_mincore(map->pmap, addr, &locked_pa); + if (locked_pa != 0) + vm_page_unlock(PHYS_TO_VM_PAGE(locked_pa)); + if (mincoreinfo & MINCORE_INCORE) kve->kve_resident++; + if (mincoreinfo & MINCORE_SUPER) + kve->kve_flags |= KVME_FLAG_SUPER; addr += PAGE_SIZE; } Modified: stable/9/sys/sys/user.h ============================================================================== --- stable/9/sys/sys/user.h Fri Jan 6 16:46:52 2012 (r229706) +++ stable/9/sys/sys/user.h Fri Jan 6 16:54:16 2012 (r229707) @@ -412,6 +412,7 @@ struct kinfo_file { #define KVME_FLAG_COW 0x00000001 #define KVME_FLAG_NEEDS_COPY 0x00000002 #define KVME_FLAG_NOCOREDUMP 0x00000004 +#define KVME_FLAG_SUPER 0x00000008 #if defined(__amd64__) #define KINFO_OVMENTRY_SIZE 1168 From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 16:56:10 2012 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 31E471065676; Fri, 6 Jan 2012 16:56:10 +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 024928FC22; Fri, 6 Jan 2012 16:56: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 q06Gu9iS098476; Fri, 6 Jan 2012 16:56:09 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06Gu9TX098474; Fri, 6 Jan 2012 16:56:09 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201061656.q06Gu9TX098474@svn.freebsd.org> From: John Baldwin Date: Fri, 6 Jan 2012 16:56:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229708 - stable/9/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: Fri, 06 Jan 2012 16:56:10 -0000 Author: jhb Date: Fri Jan 6 16:56:09 2012 New Revision: 229708 URL: http://svn.freebsd.org/changeset/base/229708 Log: MFC 228967: Update if_obytes and if_omcast after successful transmit. While I'm here update if_oerrors if parent interface of vlan is not up and running. Previously it updated collision counter and it was confusing to interprete it. Modified: stable/9/sys/net/if_vlan.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/net/if_vlan.c ============================================================================== --- stable/9/sys/net/if_vlan.c Fri Jan 6 16:54:16 2012 (r229707) +++ stable/9/sys/net/if_vlan.c Fri Jan 6 16:56:09 2012 (r229708) @@ -1010,10 +1010,12 @@ vlan_transmit(struct ifnet *ifp, struct { struct ifvlan *ifv; struct ifnet *p; - int error; + int error, len, mcast; ifv = ifp->if_softc; p = PARENT(ifv); + len = m->m_pkthdr.len; + mcast = (m->m_flags & (M_MCAST | M_BCAST)) ? 1 : 0; BPF_MTAP(ifp, m); @@ -1023,7 +1025,7 @@ vlan_transmit(struct ifnet *ifp, struct */ if (!UP_AND_RUNNING(p)) { m_freem(m); - ifp->if_collisions++; + ifp->if_oerrors++; return (0); } @@ -1079,9 +1081,11 @@ vlan_transmit(struct ifnet *ifp, struct * Send it, precisely as ether_output() would have. */ error = (p->if_transmit)(p, m); - if (!error) + if (!error) { ifp->if_opackets++; - else + ifp->if_omcasts += mcast; + ifp->if_obytes += len; + } else ifp->if_oerrors++; return (error); } From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 16:57:30 2012 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 0DBDB106567F; Fri, 6 Jan 2012 16:57:30 +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 ECDB98FC1E; Fri, 6 Jan 2012 16:57: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 q06GvTnc098556; Fri, 6 Jan 2012 16:57:29 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06GvTmW098554; Fri, 6 Jan 2012 16:57:29 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201061657.q06GvTmW098554@svn.freebsd.org> From: John Baldwin Date: Fri, 6 Jan 2012 16:57:29 +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: r229709 - stable/8/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: Fri, 06 Jan 2012 16:57:30 -0000 Author: jhb Date: Fri Jan 6 16:57:29 2012 New Revision: 229709 URL: http://svn.freebsd.org/changeset/base/229709 Log: MFC 228967: Update if_obytes and if_omcast after successful transmit. While I'm here update if_oerrors if parent interface of vlan is not up and running. Previously it updated collision counter and it was confusing to interprete it. Modified: stable/8/sys/net/if_vlan.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/net/if_vlan.c ============================================================================== --- stable/8/sys/net/if_vlan.c Fri Jan 6 16:56:09 2012 (r229708) +++ stable/8/sys/net/if_vlan.c Fri Jan 6 16:57:29 2012 (r229709) @@ -872,10 +872,12 @@ vlan_transmit(struct ifnet *ifp, struct { struct ifvlan *ifv; struct ifnet *p; - int error; + int error, len, mcast; ifv = ifp->if_softc; p = PARENT(ifv); + len = m->m_pkthdr.len; + mcast = (m->m_flags & (M_MCAST | M_BCAST)) ? 1 : 0; BPF_MTAP(ifp, m); @@ -885,7 +887,7 @@ vlan_transmit(struct ifnet *ifp, struct */ if (!UP_AND_RUNNING(p)) { m_freem(m); - ifp->if_collisions++; + ifp->if_oerrors++; return (0); } @@ -941,9 +943,11 @@ vlan_transmit(struct ifnet *ifp, struct * Send it, precisely as ether_output() would have. */ error = (p->if_transmit)(p, m); - if (!error) + if (!error) { ifp->if_opackets++; - else + ifp->if_omcasts += mcast; + ifp->if_obytes += len; + } else ifp->if_oerrors++; return (error); } From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 16:57:57 2012 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 4A30C1065673; Fri, 6 Jan 2012 16:57:57 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 192A68FC17; Fri, 6 Jan 2012 16:57: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 q06Gvur2098606; Fri, 6 Jan 2012 16:57:56 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06GvuX7098603; Fri, 6 Jan 2012 16:57:56 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201201061657.q06GvuX7098603@svn.freebsd.org> From: Mikolaj Golub Date: Fri, 6 Jan 2012 16:57:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229710 - stable/9/usr.bin/procstat 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, 06 Jan 2012 16:57:57 -0000 Author: trociny Date: Fri Jan 6 16:57:56 2012 New Revision: 229710 URL: http://svn.freebsd.org/changeset/base/229710 Log: MFC r227317, r227355: When displaying process virtual memory mappings print superpage mapping flag. Submitted by: Mel Flynn Reviewed by: alc, rwatson Modified: stable/9/usr.bin/procstat/procstat.1 stable/9/usr.bin/procstat/procstat_vm.c Directory Properties: stable/9/usr.bin/procstat/ (props changed) Modified: stable/9/usr.bin/procstat/procstat.1 ============================================================================== --- stable/9/usr.bin/procstat/procstat.1 Fri Jan 6 16:57:29 2012 (r229709) +++ stable/9/usr.bin/procstat/procstat.1 Fri Jan 6 16:57:56 2012 (r229710) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 14, 2011 +.Dd November 7, 2011 .Dt PROCSTAT 1 .Os .Sh NAME @@ -421,6 +421,8 @@ The following mapping flags may be displ copy-on-write .It N needs copy +.It S +one or more superpage mappings are used .El .Sh EXIT STATUS .Ex -std Modified: stable/9/usr.bin/procstat/procstat_vm.c ============================================================================== --- stable/9/usr.bin/procstat/procstat_vm.c Fri Jan 6 16:57:29 2012 (r229709) +++ stable/9/usr.bin/procstat/procstat_vm.c Fri Jan 6 16:57:56 2012 (r229710) @@ -50,7 +50,7 @@ procstat_vm(struct kinfo_proc *kipp) ptrwidth = 2*sizeof(void *) + 2; if (!hflag) - printf("%5s %*s %*s %3s %4s %4s %3s %3s %2s %-2s %-s\n", + printf("%5s %*s %*s %3s %4s %4s %3s %3s %3s %-2s %-s\n", "PID", ptrwidth, "START", ptrwidth, "END", "PRT", "RES", "PRES", "REF", "SHD", "FL", "TP", "PATH"); @@ -70,8 +70,9 @@ procstat_vm(struct kinfo_proc *kipp) printf("%3d ", kve->kve_ref_count); printf("%3d ", kve->kve_shadow_count); printf("%-1s", kve->kve_flags & KVME_FLAG_COW ? "C" : "-"); - printf("%-1s ", kve->kve_flags & KVME_FLAG_NEEDS_COPY ? "N" : + printf("%-1s", kve->kve_flags & KVME_FLAG_NEEDS_COPY ? "N" : "-"); + printf("%-1s ", kve->kve_flags & KVME_FLAG_SUPER ? "S" : "-"); switch (kve->kve_type) { case KVME_TYPE_NONE: str = "--"; From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 18:07:29 2012 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 ABF89106566C; Fri, 6 Jan 2012 18:07:29 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: from mail-tul01m020-f182.google.com (mail-tul01m020-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 3D0AF8FC1F; Fri, 6 Jan 2012 18:07:29 +0000 (UTC) Received: by obbwd18 with SMTP id wd18so3064233obb.13 for ; Fri, 06 Jan 2012 10:07:28 -0800 (PST) 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=5PQkD5ssXrH4LYGAwjXCHmrqN/QE9miE0rPXk91XxNo=; b=IdIrpqxwcZ2+liVVlLYf9JVYXmnRN++gmd/C5lgO+gN26MGHjJWeF+FKZW6ngA7oRl gwq9UuUL9T7FJaVux6uK/gP37UN9sBYIPdEhvDjBYI5qD3dtIcvacUUXdz9sGVxC1yXA occJ7xZBJRmHaUKE8pGGLJC6X5ZkKqpVLRlhY= Received: by 10.50.46.166 with SMTP id w6mr8658608igm.6.1325871544314; Fri, 06 Jan 2012 09:39:04 -0800 (PST) Received: from pyunyh@gmail.com ([174.35.1.224]) by mx.google.com with ESMTPS id r5sm95368541igl.3.2012.01.06.09.39.01 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 06 Jan 2012 09:39:03 -0800 (PST) Received: by pyunyh@gmail.com (sSMTP sendmail emulation); Fri, 06 Jan 2012 09:39:02 -0800 From: YongHyeon PYUN Date: Fri, 6 Jan 2012 09:39:01 -0800 To: John Baldwin Message-ID: <20120106173901.GA21750@michelle.cdnetworks.com> References: <201201051950.q05JoCKj052356@svn.freebsd.org> <201201060845.13174.jhb@freebsd.org> <20120106142459.GR34721@FreeBSD.org> <201201060950.13736.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201201060950.13736.jhb@freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, Gleb Smirnoff , src-committers@freebsd.org, svn-src-stable-9@freebsd.org Subject: Re: svn commit: r229633 - stable/9/sys/net 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: Fri, 06 Jan 2012 18:07:29 -0000 On Fri, Jan 06, 2012 at 09:50:13AM -0500, John Baldwin wrote: > On Friday, January 06, 2012 9:24:59 am Gleb Smirnoff wrote: > > On Fri, Jan 06, 2012 at 08:45:12AM -0500, John Baldwin wrote: > > J> On Friday, January 06, 2012 3:20:05 am Gleb Smirnoff wrote: > > J> > John, > > J> > > > J> > On Thu, Jan 05, 2012 at 07:50:12PM +0000, John Baldwin wrote: > > J> > J> Author: jhb > > J> > J> Date: Thu Jan 5 19:50:12 2012 > > J> > J> New Revision: 229633 > > J> > J> URL: http://svn.freebsd.org/changeset/base/229633 > > J> > J> > > J> > J> Log: > > J> > J> MFC 228089: > > J> > J> Change the if_vlan driver to use if_transmit for forwarding packets to the > > J> > J> parent interface. This avoids the overhead of queueing a packet to an IFQ > > J> > J> only to immediately dequeue it again. > > J> > > > J> > This should have been merged together with r228967. Now a bug that > > J> > was successfully discovered and fixed in head/ leaked to stable > > J> > branches. :( > > J> > > > J> > Can you please merge r228967 to stable/9 and stable/8 ASAP? > > J> > > J> Err, that bug was already present before this change. I did not expose it. > > J> > > J> I can MFC the stat fixes, but this was already broken in 8 and 9, and is > > J> broken in 7 as well (likely in older branches than that). > > > > Well, on 8.2-STABLE if_obytes are correctly accounted: > > > > glebius@xxx:~:|>netstat -hI vlan2 1 > > input (vlan2) output > > packets errs idrops bytes packets errs bytes colls > > 33 0 0 2.3k 4 0 840 0 > > 36 0 0 2.4k 4 0 442 0 > > 32 0 0 2.3k 6 0 887 0 > > > > glebius@xxx:~:|>uname -v > > FreeBSD 8.2-STABLE #2: Wed Jul 6 13:22:13 MSD 2011 > > > > While on 228089 =< head < 228967 they are not: > > > > glebius@xxx2:~:|>netstat -hI vlan77 1 > > input (vlan77) output > > packets errs idrops bytes packets errs bytes colls > > 9.1k 0 0 2M 12k 0 0 0 > > 11k 0 0 4.3M 14k 0 0 0 > > 10k 0 0 2.8M 14k 0 0 0 > > 9.4k 0 0 2.3M 13k 0 0 0 > > > > glebius@xxx2:~:|>uname -v > > FreeBSD 10.0-CURRENT #5 r228769M: Thu Dec 22 19:44:57 MSK 2011 > > Hmm, it seems to be a side effect of the IFQ macros. IFQ_HANDOFF() is no longer called in vlan_transmit() so we needed a different approach. From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 18:15:27 2012 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 9A3581065680; Fri, 6 Jan 2012 18:15:27 +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 835BD8FC14; Fri, 6 Jan 2012 18:15:27 +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 q06IFRRJ001285; Fri, 6 Jan 2012 18:15:27 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06IFRTt001282; Fri, 6 Jan 2012 18:15:27 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201061815.q06IFRTt001282@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 6 Jan 2012 18:15:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229711 - stable/9/sys/dev/et 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, 06 Jan 2012 18:15:27 -0000 Author: yongari Date: Fri Jan 6 18:15:27 2012 New Revision: 229711 URL: http://svn.freebsd.org/changeset/base/229711 Log: MFC r228291-228293,228297-228298: r228291: Remove NetBSD license. r199548 removed all bit macros that were derived from NetBSD. r228292: Implement suspend/resume methods. Driver has no issue with suspend/resume. r228293: Fix alt(4) support. Also add check for number of available TX descriptors before trying to send frames. If we're not able to send a frame, make sure to prepend it to if_snd queue such that alt(4) should work. While I'm here prefer ETHER_BPF_MTAP to BPF_MTAP. ETHER_BPF_MTAP should be used for controllers that support VLAN hardware tag insertion. The controller supports VLAN tag insertion but lacks VLAN tag stripping in RX path though. r228297: et(4) supports VLAN oversized frame so correctly set header length. While I'm here remove initializing if_mtu, it is set by ether_ifattach(9). Also move callout_init_mtx(9) to the right below driver lock initialization. r228298: Make et_probe() return BUS_PROBE_DEFAULT such that allow other driver that has high precedence for the controller override et(4). Add missing callout_drain(9) in device detach and rework detach routine. While I'm here use rman_get_rid(9) instead of using cached resource id because bus methods are free to change the id. Modified: stable/9/sys/dev/et/if_et.c stable/9/sys/dev/et/if_etreg.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/et/if_et.c ============================================================================== --- stable/9/sys/dev/et/if_et.c Fri Jan 6 16:57:56 2012 (r229710) +++ stable/9/sys/dev/et/if_et.c Fri Jan 6 18:15:27 2012 (r229711) @@ -87,6 +87,8 @@ static int et_probe(device_t); static int et_attach(device_t); static int et_detach(device_t); static int et_shutdown(device_t); +static int et_suspend(device_t); +static int et_resume(device_t); static int et_miibus_readreg(device_t, int, int); static int et_miibus_writereg(device_t, int, int, int); @@ -169,6 +171,8 @@ static device_method_t et_methods[] = { DEVMETHOD(device_attach, et_attach), DEVMETHOD(device_detach, et_detach), DEVMETHOD(device_shutdown, et_shutdown), + DEVMETHOD(device_suspend, et_suspend), + DEVMETHOD(device_resume, et_resume), DEVMETHOD(miibus_readreg, et_miibus_readreg), DEVMETHOD(miibus_writereg, et_miibus_writereg), @@ -222,7 +226,7 @@ et_probe(device_t dev) for (d = et_devices; d->desc != NULL; ++d) { if (vid == d->vid && did == d->did) { device_set_desc(dev, d->desc); - return (0); + return (BUS_PROBE_DEFAULT); } } return (ENXIO); @@ -240,6 +244,7 @@ et_attach(device_t dev) sc->dev = dev; mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, MTX_DEF); + callout_init_mtx(&sc->sc_tick, &sc->sc_mtx, 0); ifp = sc->ifp = if_alloc(IFT_ETHER); if (ifp == NULL) { @@ -331,10 +336,10 @@ et_attach(device_t dev) ifp->if_init = et_init; ifp->if_ioctl = et_ioctl; ifp->if_start = et_start; - ifp->if_mtu = ETHERMTU; ifp->if_capabilities = IFCAP_TXCSUM | IFCAP_VLAN_MTU; ifp->if_capenable = ifp->if_capabilities; - IFQ_SET_MAXLEN(&ifp->if_snd, ET_TX_NDESC); + ifp->if_snd.ifq_drv_maxlen = ET_TX_NDESC - 1; + IFQ_SET_MAXLEN(&ifp->if_snd, ET_TX_NDESC - 1); IFQ_SET_READY(&ifp->if_snd); et_chip_attach(sc); @@ -347,7 +352,9 @@ et_attach(device_t dev) } ether_ifattach(ifp, eaddr); - callout_init_mtx(&sc->sc_tick, &sc->sc_mtx, 0); + + /* Tell the upper layer(s) we support long frames. */ + ifp->if_hdrlen = sizeof(struct ether_vlan_header); error = bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_NET | INTR_MPSAFE, NULL, et_intr, sc, &sc->sc_irq_handle); @@ -371,31 +378,27 @@ et_detach(device_t dev) struct et_softc *sc = device_get_softc(dev); if (device_is_attached(dev)) { - struct ifnet *ifp = sc->ifp; - + ether_ifdetach(sc->ifp); ET_LOCK(sc); et_stop(sc); - bus_teardown_intr(dev, sc->sc_irq_res, sc->sc_irq_handle); ET_UNLOCK(sc); - - ether_ifdetach(ifp); + callout_drain(&sc->sc_tick); } if (sc->sc_miibus != NULL) device_delete_child(dev, sc->sc_miibus); bus_generic_detach(dev); - if (sc->sc_irq_res != NULL) { - bus_release_resource(dev, SYS_RES_IRQ, sc->sc_irq_rid, - sc->sc_irq_res); - } + if (sc->sc_irq_handle != NULL) + bus_teardown_intr(dev, sc->sc_irq_res, sc->sc_irq_handle); + if (sc->sc_irq_res != NULL) + bus_release_resource(dev, SYS_RES_IRQ, + rman_get_rid(sc->sc_irq_res), sc->sc_irq_res); if ((sc->sc_flags & ET_FLAG_MSI) != 0) pci_release_msi(dev); - - if (sc->sc_mem_res != NULL) { - bus_release_resource(dev, SYS_RES_MEMORY, sc->sc_mem_rid, - sc->sc_mem_res); - } + if (sc->sc_mem_res != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, + rman_get_rid(sc->sc_mem_res), sc->sc_mem_res); if (sc->ifp != NULL) if_free(sc->ifp); @@ -1253,12 +1256,13 @@ et_ioctl(struct ifnet *ifp, u_long cmd, static void et_start_locked(struct ifnet *ifp) { - struct et_softc *sc = ifp->if_softc; + struct et_softc *sc; + struct mbuf *m_head = NULL; struct et_txbuf_data *tbd; - int trans; + int enq; + sc = ifp->if_softc; ET_LOCK_ASSERT(sc); - tbd = &sc->sc_tx_data; if ((sc->sc_flags & ET_FLAG_TXRX_ENABLED) == 0) return; @@ -1266,30 +1270,32 @@ et_start_locked(struct ifnet *ifp) if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING) return; - trans = 0; - for (;;) { - struct mbuf *m; - - if ((tbd->tbd_used + ET_NSEG_SPARE) > ET_TX_NDESC) { + tbd = &sc->sc_tx_data; + for (enq = 0; !IFQ_DRV_IS_EMPTY(&ifp->if_snd); ) { + if (tbd->tbd_used + ET_NSEG_SPARE >= ET_TX_NDESC) { ifp->if_drv_flags |= IFF_DRV_OACTIVE; break; } - IFQ_DEQUEUE(&ifp->if_snd, m); - if (m == NULL) + IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head); + if (m_head == NULL) break; - if (et_encap(sc, &m)) { - ifp->if_oerrors++; - ifp->if_drv_flags |= IFF_DRV_OACTIVE; + if (et_encap(sc, &m_head)) { + if (m_head == NULL) { + ifp->if_oerrors++; + break; + } + IFQ_DRV_PREPEND(&ifp->if_snd, m_head); + if (tbd->tbd_used > 0) + ifp->if_drv_flags |= IFF_DRV_OACTIVE; break; } - trans = 1; - - BPF_MTAP(ifp, m); + enq++; + ETHER_BPF_MTAP(ifp, m_head); } - if (trans) + if (enq > 0) sc->watchdog_timer = 5; } @@ -2451,3 +2457,29 @@ et_setup_rxdesc(struct et_rxbuf_data *rb bus_dmamap_sync(rx_ring->rr_dtag, rx_ring->rr_dmap, BUS_DMASYNC_PREWRITE); } + +static int +et_suspend(device_t dev) +{ + struct et_softc *sc; + + sc = device_get_softc(dev); + ET_LOCK(sc); + if ((sc->ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + et_stop(sc); + ET_UNLOCK(sc); + return (0); +} + +static int +et_resume(device_t dev) +{ + struct et_softc *sc; + + sc = device_get_softc(dev); + ET_LOCK(sc); + if ((sc->ifp->if_flags & IFF_UP) != 0) + et_init_locked(sc); + ET_UNLOCK(sc); + return (0); +} Modified: stable/9/sys/dev/et/if_etreg.h ============================================================================== --- stable/9/sys/dev/et/if_etreg.h Fri Jan 6 16:57:56 2012 (r229710) +++ stable/9/sys/dev/et/if_etreg.h Fri Jan 6 18:15:27 2012 (r229711) @@ -34,41 +34,6 @@ * $DragonFly: src/sys/dev/netif/et/if_etreg.h,v 1.3 2007/10/23 14:28:42 sephe Exp $ * $FreeBSD$ */ -/*- - * Portions of this code is derived from NetBSD which is covered by - * the following license: - * - * Copyright (c) 2004, 2005 David Young. All rights reserved. - * - * Programmed for NetBSD by David Young. - * - * 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. - * 3. The name of David Young may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY David Young ``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 David - * Young 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. - * - * $DragonFly: src/sys/sys/bitops.h,v 1.1 2007/10/14 04:15:17 sephe Exp $ - */ #ifndef _IF_ETREG_H #define _IF_ETREG_H From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 18:16:58 2012 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 920051065794; Fri, 6 Jan 2012 18:16:58 +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 714AF8FC14; Fri, 6 Jan 2012 18:16: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 q06IGws7001365; Fri, 6 Jan 2012 18:16:58 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06IGwai001362; Fri, 6 Jan 2012 18:16:58 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201061816.q06IGwai001362@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 6 Jan 2012 18:16: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: r229712 - stable/8/sys/dev/et 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, 06 Jan 2012 18:16:58 -0000 Author: yongari Date: Fri Jan 6 18:16:57 2012 New Revision: 229712 URL: http://svn.freebsd.org/changeset/base/229712 Log: MFC r228291-228293,228297-228298: r228291: Remove NetBSD license. r199548 removed all bit macros that were derived from NetBSD. r228292: Implement suspend/resume methods. Driver has no issue with suspend/resume. r228293: Fix alt(4) support. Also add check for number of available TX descriptors before trying to send frames. If we're not able to send a frame, make sure to prepend it to if_snd queue such that alt(4) should work. While I'm here prefer ETHER_BPF_MTAP to BPF_MTAP. ETHER_BPF_MTAP should be used for controllers that support VLAN hardware tag insertion. The controller supports VLAN tag insertion but lacks VLAN tag stripping in RX path though. r228297: et(4) supports VLAN oversized frame so correctly set header length. While I'm here remove initializing if_mtu, it is set by ether_ifattach(9). Also move callout_init_mtx(9) to the right below driver lock initialization. r228298: Make et_probe() return BUS_PROBE_DEFAULT such that allow other driver that has high precedence for the controller override et(4). Add missing callout_drain(9) in device detach and rework detach routine. While I'm here use rman_get_rid(9) instead of using cached resource id because bus methods are free to change the id. Modified: stable/8/sys/dev/et/if_et.c stable/8/sys/dev/et/if_etreg.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/et/if_et.c ============================================================================== --- stable/8/sys/dev/et/if_et.c Fri Jan 6 18:15:27 2012 (r229711) +++ stable/8/sys/dev/et/if_et.c Fri Jan 6 18:16:57 2012 (r229712) @@ -88,6 +88,8 @@ static int et_probe(device_t); static int et_attach(device_t); static int et_detach(device_t); static int et_shutdown(device_t); +static int et_suspend(device_t); +static int et_resume(device_t); static int et_miibus_readreg(device_t, int, int); static int et_miibus_writereg(device_t, int, int, int); @@ -170,6 +172,8 @@ static device_method_t et_methods[] = { DEVMETHOD(device_attach, et_attach), DEVMETHOD(device_detach, et_detach), DEVMETHOD(device_shutdown, et_shutdown), + DEVMETHOD(device_suspend, et_suspend), + DEVMETHOD(device_resume, et_resume), DEVMETHOD(bus_print_child, bus_generic_print_child), DEVMETHOD(bus_driver_added, bus_generic_driver_added), @@ -226,7 +230,7 @@ et_probe(device_t dev) for (d = et_devices; d->desc != NULL; ++d) { if (vid == d->vid && did == d->did) { device_set_desc(dev, d->desc); - return (0); + return (BUS_PROBE_DEFAULT); } } return (ENXIO); @@ -244,6 +248,7 @@ et_attach(device_t dev) sc->dev = dev; mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, MTX_DEF); + callout_init_mtx(&sc->sc_tick, &sc->sc_mtx, 0); ifp = sc->ifp = if_alloc(IFT_ETHER); if (ifp == NULL) { @@ -335,10 +340,10 @@ et_attach(device_t dev) ifp->if_init = et_init; ifp->if_ioctl = et_ioctl; ifp->if_start = et_start; - ifp->if_mtu = ETHERMTU; ifp->if_capabilities = IFCAP_TXCSUM | IFCAP_VLAN_MTU; ifp->if_capenable = ifp->if_capabilities; - IFQ_SET_MAXLEN(&ifp->if_snd, ET_TX_NDESC); + ifp->if_snd.ifq_drv_maxlen = ET_TX_NDESC - 1; + IFQ_SET_MAXLEN(&ifp->if_snd, ET_TX_NDESC - 1); IFQ_SET_READY(&ifp->if_snd); et_chip_attach(sc); @@ -351,7 +356,9 @@ et_attach(device_t dev) } ether_ifattach(ifp, eaddr); - callout_init_mtx(&sc->sc_tick, &sc->sc_mtx, 0); + + /* Tell the upper layer(s) we support long frames. */ + ifp->if_hdrlen = sizeof(struct ether_vlan_header); error = bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_NET | INTR_MPSAFE, NULL, et_intr, sc, &sc->sc_irq_handle); @@ -375,31 +382,27 @@ et_detach(device_t dev) struct et_softc *sc = device_get_softc(dev); if (device_is_attached(dev)) { - struct ifnet *ifp = sc->ifp; - + ether_ifdetach(sc->ifp); ET_LOCK(sc); et_stop(sc); - bus_teardown_intr(dev, sc->sc_irq_res, sc->sc_irq_handle); ET_UNLOCK(sc); - - ether_ifdetach(ifp); + callout_drain(&sc->sc_tick); } if (sc->sc_miibus != NULL) device_delete_child(dev, sc->sc_miibus); bus_generic_detach(dev); - if (sc->sc_irq_res != NULL) { - bus_release_resource(dev, SYS_RES_IRQ, sc->sc_irq_rid, - sc->sc_irq_res); - } + if (sc->sc_irq_handle != NULL) + bus_teardown_intr(dev, sc->sc_irq_res, sc->sc_irq_handle); + if (sc->sc_irq_res != NULL) + bus_release_resource(dev, SYS_RES_IRQ, + rman_get_rid(sc->sc_irq_res), sc->sc_irq_res); if ((sc->sc_flags & ET_FLAG_MSI) != 0) pci_release_msi(dev); - - if (sc->sc_mem_res != NULL) { - bus_release_resource(dev, SYS_RES_MEMORY, sc->sc_mem_rid, - sc->sc_mem_res); - } + if (sc->sc_mem_res != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, + rman_get_rid(sc->sc_mem_res), sc->sc_mem_res); if (sc->ifp != NULL) if_free(sc->ifp); @@ -1257,12 +1260,13 @@ et_ioctl(struct ifnet *ifp, u_long cmd, static void et_start_locked(struct ifnet *ifp) { - struct et_softc *sc = ifp->if_softc; + struct et_softc *sc; + struct mbuf *m_head = NULL; struct et_txbuf_data *tbd; - int trans; + int enq; + sc = ifp->if_softc; ET_LOCK_ASSERT(sc); - tbd = &sc->sc_tx_data; if ((sc->sc_flags & ET_FLAG_TXRX_ENABLED) == 0) return; @@ -1270,30 +1274,32 @@ et_start_locked(struct ifnet *ifp) if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING) return; - trans = 0; - for (;;) { - struct mbuf *m; - - if ((tbd->tbd_used + ET_NSEG_SPARE) > ET_TX_NDESC) { + tbd = &sc->sc_tx_data; + for (enq = 0; !IFQ_DRV_IS_EMPTY(&ifp->if_snd); ) { + if (tbd->tbd_used + ET_NSEG_SPARE >= ET_TX_NDESC) { ifp->if_drv_flags |= IFF_DRV_OACTIVE; break; } - IFQ_DEQUEUE(&ifp->if_snd, m); - if (m == NULL) + IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head); + if (m_head == NULL) break; - if (et_encap(sc, &m)) { - ifp->if_oerrors++; - ifp->if_drv_flags |= IFF_DRV_OACTIVE; + if (et_encap(sc, &m_head)) { + if (m_head == NULL) { + ifp->if_oerrors++; + break; + } + IFQ_DRV_PREPEND(&ifp->if_snd, m_head); + if (tbd->tbd_used > 0) + ifp->if_drv_flags |= IFF_DRV_OACTIVE; break; } - trans = 1; - - BPF_MTAP(ifp, m); + enq++; + ETHER_BPF_MTAP(ifp, m_head); } - if (trans) + if (enq > 0) sc->watchdog_timer = 5; } @@ -2455,3 +2461,29 @@ et_setup_rxdesc(struct et_rxbuf_data *rb bus_dmamap_sync(rx_ring->rr_dtag, rx_ring->rr_dmap, BUS_DMASYNC_PREWRITE); } + +static int +et_suspend(device_t dev) +{ + struct et_softc *sc; + + sc = device_get_softc(dev); + ET_LOCK(sc); + if ((sc->ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + et_stop(sc); + ET_UNLOCK(sc); + return (0); +} + +static int +et_resume(device_t dev) +{ + struct et_softc *sc; + + sc = device_get_softc(dev); + ET_LOCK(sc); + if ((sc->ifp->if_flags & IFF_UP) != 0) + et_init_locked(sc); + ET_UNLOCK(sc); + return (0); +} Modified: stable/8/sys/dev/et/if_etreg.h ============================================================================== --- stable/8/sys/dev/et/if_etreg.h Fri Jan 6 18:15:27 2012 (r229711) +++ stable/8/sys/dev/et/if_etreg.h Fri Jan 6 18:16:57 2012 (r229712) @@ -34,41 +34,6 @@ * $DragonFly: src/sys/dev/netif/et/if_etreg.h,v 1.3 2007/10/23 14:28:42 sephe Exp $ * $FreeBSD$ */ -/*- - * Portions of this code is derived from NetBSD which is covered by - * the following license: - * - * Copyright (c) 2004, 2005 David Young. All rights reserved. - * - * Programmed for NetBSD by David Young. - * - * 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. - * 3. The name of David Young may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY David Young ``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 David - * Young 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. - * - * $DragonFly: src/sys/sys/bitops.h,v 1.1 2007/10/14 04:15:17 sephe Exp $ - */ #ifndef _IF_ETREG_H #define _IF_ETREG_H From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 18:18:26 2012 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 30D86106566C; Fri, 6 Jan 2012 18:18:26 +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 199938FC0A; Fri, 6 Jan 2012 18:18: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 q06IIPEH001450; Fri, 6 Jan 2012 18:18:25 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06IIPOb001447; Fri, 6 Jan 2012 18:18:25 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201061818.q06IIPOb001447@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 6 Jan 2012 18:18:25 +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: r229713 - stable/7/sys/dev/et 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, 06 Jan 2012 18:18:26 -0000 Author: yongari Date: Fri Jan 6 18:18:25 2012 New Revision: 229713 URL: http://svn.freebsd.org/changeset/base/229713 Log: MFC r228291-228293,228297-228298: r228291: Remove NetBSD license. r199548 removed all bit macros that were derived from NetBSD. r228292: Implement suspend/resume methods. Driver has no issue with suspend/resume. r228293: Fix alt(4) support. Also add check for number of available TX descriptors before trying to send frames. If we're not able to send a frame, make sure to prepend it to if_snd queue such that alt(4) should work. While I'm here prefer ETHER_BPF_MTAP to BPF_MTAP. ETHER_BPF_MTAP should be used for controllers that support VLAN hardware tag insertion. The controller supports VLAN tag insertion but lacks VLAN tag stripping in RX path though. r228297: et(4) supports VLAN oversized frame so correctly set header length. While I'm here remove initializing if_mtu, it is set by ether_ifattach(9). Also move callout_init_mtx(9) to the right below driver lock initialization. r228298: Make et_probe() return BUS_PROBE_DEFAULT such that allow other driver that has high precedence for the controller override et(4). Add missing callout_drain(9) in device detach and rework detach routine. While I'm here use rman_get_rid(9) instead of using cached resource id because bus methods are free to change the id. Modified: stable/7/sys/dev/et/if_et.c stable/7/sys/dev/et/if_etreg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/et/if_et.c ============================================================================== --- stable/7/sys/dev/et/if_et.c Fri Jan 6 18:16:57 2012 (r229712) +++ stable/7/sys/dev/et/if_et.c Fri Jan 6 18:18:25 2012 (r229713) @@ -88,6 +88,8 @@ static int et_probe(device_t); static int et_attach(device_t); static int et_detach(device_t); static int et_shutdown(device_t); +static int et_suspend(device_t); +static int et_resume(device_t); static int et_miibus_readreg(device_t, int, int); static int et_miibus_writereg(device_t, int, int, int); @@ -170,6 +172,8 @@ static device_method_t et_methods[] = { DEVMETHOD(device_attach, et_attach), DEVMETHOD(device_detach, et_detach), DEVMETHOD(device_shutdown, et_shutdown), + DEVMETHOD(device_suspend, et_suspend), + DEVMETHOD(device_resume, et_resume), DEVMETHOD(bus_print_child, bus_generic_print_child), DEVMETHOD(bus_driver_added, bus_generic_driver_added), @@ -226,7 +230,7 @@ et_probe(device_t dev) for (d = et_devices; d->desc != NULL; ++d) { if (vid == d->vid && did == d->did) { device_set_desc(dev, d->desc); - return (0); + return (BUS_PROBE_DEFAULT); } } return (ENXIO); @@ -244,6 +248,7 @@ et_attach(device_t dev) sc->dev = dev; mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, MTX_DEF); + callout_init_mtx(&sc->sc_tick, &sc->sc_mtx, 0); ifp = sc->ifp = if_alloc(IFT_ETHER); if (ifp == NULL) { @@ -335,10 +340,10 @@ et_attach(device_t dev) ifp->if_init = et_init; ifp->if_ioctl = et_ioctl; ifp->if_start = et_start; - ifp->if_mtu = ETHERMTU; ifp->if_capabilities = IFCAP_TXCSUM | IFCAP_VLAN_MTU; ifp->if_capenable = ifp->if_capabilities; - IFQ_SET_MAXLEN(&ifp->if_snd, ET_TX_NDESC); + ifp->if_snd.ifq_drv_maxlen = ET_TX_NDESC - 1; + IFQ_SET_MAXLEN(&ifp->if_snd, ET_TX_NDESC - 1); IFQ_SET_READY(&ifp->if_snd); et_chip_attach(sc); @@ -351,7 +356,9 @@ et_attach(device_t dev) } ether_ifattach(ifp, eaddr); - callout_init_mtx(&sc->sc_tick, &sc->sc_mtx, 0); + + /* Tell the upper layer(s) we support long frames. */ + ifp->if_hdrlen = sizeof(struct ether_vlan_header); error = bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_NET | INTR_MPSAFE, NULL, et_intr, sc, &sc->sc_irq_handle); @@ -375,31 +382,27 @@ et_detach(device_t dev) struct et_softc *sc = device_get_softc(dev); if (device_is_attached(dev)) { - struct ifnet *ifp = sc->ifp; - + ether_ifdetach(sc->ifp); ET_LOCK(sc); et_stop(sc); - bus_teardown_intr(dev, sc->sc_irq_res, sc->sc_irq_handle); ET_UNLOCK(sc); - - ether_ifdetach(ifp); + callout_drain(&sc->sc_tick); } if (sc->sc_miibus != NULL) device_delete_child(dev, sc->sc_miibus); bus_generic_detach(dev); - if (sc->sc_irq_res != NULL) { - bus_release_resource(dev, SYS_RES_IRQ, sc->sc_irq_rid, - sc->sc_irq_res); - } + if (sc->sc_irq_handle != NULL) + bus_teardown_intr(dev, sc->sc_irq_res, sc->sc_irq_handle); + if (sc->sc_irq_res != NULL) + bus_release_resource(dev, SYS_RES_IRQ, + rman_get_rid(sc->sc_irq_res), sc->sc_irq_res); if ((sc->sc_flags & ET_FLAG_MSI) != 0) pci_release_msi(dev); - - if (sc->sc_mem_res != NULL) { - bus_release_resource(dev, SYS_RES_MEMORY, sc->sc_mem_rid, - sc->sc_mem_res); - } + if (sc->sc_mem_res != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, + rman_get_rid(sc->sc_mem_res), sc->sc_mem_res); if (sc->ifp != NULL) if_free(sc->ifp); @@ -1257,12 +1260,13 @@ et_ioctl(struct ifnet *ifp, u_long cmd, static void et_start_locked(struct ifnet *ifp) { - struct et_softc *sc = ifp->if_softc; + struct et_softc *sc; + struct mbuf *m_head = NULL; struct et_txbuf_data *tbd; - int trans; + int enq; + sc = ifp->if_softc; ET_LOCK_ASSERT(sc); - tbd = &sc->sc_tx_data; if ((sc->sc_flags & ET_FLAG_TXRX_ENABLED) == 0) return; @@ -1270,30 +1274,32 @@ et_start_locked(struct ifnet *ifp) if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING) return; - trans = 0; - for (;;) { - struct mbuf *m; - - if ((tbd->tbd_used + ET_NSEG_SPARE) > ET_TX_NDESC) { + tbd = &sc->sc_tx_data; + for (enq = 0; !IFQ_DRV_IS_EMPTY(&ifp->if_snd); ) { + if (tbd->tbd_used + ET_NSEG_SPARE >= ET_TX_NDESC) { ifp->if_drv_flags |= IFF_DRV_OACTIVE; break; } - IFQ_DEQUEUE(&ifp->if_snd, m); - if (m == NULL) + IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head); + if (m_head == NULL) break; - if (et_encap(sc, &m)) { - ifp->if_oerrors++; - ifp->if_drv_flags |= IFF_DRV_OACTIVE; + if (et_encap(sc, &m_head)) { + if (m_head == NULL) { + ifp->if_oerrors++; + break; + } + IFQ_DRV_PREPEND(&ifp->if_snd, m_head); + if (tbd->tbd_used > 0) + ifp->if_drv_flags |= IFF_DRV_OACTIVE; break; } - trans = 1; - - BPF_MTAP(ifp, m); + enq++; + ETHER_BPF_MTAP(ifp, m_head); } - if (trans) + if (enq > 0) sc->watchdog_timer = 5; } @@ -2455,3 +2461,29 @@ et_setup_rxdesc(struct et_rxbuf_data *rb bus_dmamap_sync(rx_ring->rr_dtag, rx_ring->rr_dmap, BUS_DMASYNC_PREWRITE); } + +static int +et_suspend(device_t dev) +{ + struct et_softc *sc; + + sc = device_get_softc(dev); + ET_LOCK(sc); + if ((sc->ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + et_stop(sc); + ET_UNLOCK(sc); + return (0); +} + +static int +et_resume(device_t dev) +{ + struct et_softc *sc; + + sc = device_get_softc(dev); + ET_LOCK(sc); + if ((sc->ifp->if_flags & IFF_UP) != 0) + et_init_locked(sc); + ET_UNLOCK(sc); + return (0); +} Modified: stable/7/sys/dev/et/if_etreg.h ============================================================================== --- stable/7/sys/dev/et/if_etreg.h Fri Jan 6 18:16:57 2012 (r229712) +++ stable/7/sys/dev/et/if_etreg.h Fri Jan 6 18:18:25 2012 (r229713) @@ -34,41 +34,6 @@ * $DragonFly: src/sys/dev/netif/et/if_etreg.h,v 1.3 2007/10/23 14:28:42 sephe Exp $ * $FreeBSD$ */ -/*- - * Portions of this code is derived from NetBSD which is covered by - * the following license: - * - * Copyright (c) 2004, 2005 David Young. All rights reserved. - * - * Programmed for NetBSD by David Young. - * - * 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. - * 3. The name of David Young may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY David Young ``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 David - * Young 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. - * - * $DragonFly: src/sys/sys/bitops.h,v 1.1 2007/10/14 04:15:17 sephe Exp $ - */ #ifndef _IF_ETREG_H #define _IF_ETREG_H From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 18:29:41 2012 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 63CD61065735; Fri, 6 Jan 2012 18:29:41 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4DB3F8FC17; Fri, 6 Jan 2012 18:29: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 q06ITfFY001843; Fri, 6 Jan 2012 18:29:41 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06ITfP0001841; Fri, 6 Jan 2012 18:29:41 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201201061829.q06ITfP0001841@svn.freebsd.org> From: Navdeep Parhar Date: Fri, 6 Jan 2012 18:29: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: r229714 - 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, 06 Jan 2012 18:29:41 -0000 Author: np Date: Fri Jan 6 18:29:40 2012 New Revision: 229714 URL: http://svn.freebsd.org/changeset/base/229714 Log: Always release the inp lock before returning from tcp_detach. MFC after: 5 days Modified: head/sys/netinet/tcp_usrreq.c Modified: head/sys/netinet/tcp_usrreq.c ============================================================================== --- head/sys/netinet/tcp_usrreq.c Fri Jan 6 18:18:25 2012 (r229713) +++ head/sys/netinet/tcp_usrreq.c Fri Jan 6 18:29:40 2012 (r229714) @@ -204,8 +204,10 @@ tcp_detach(struct socket *so, struct inp tcp_discardcb(tp); in_pcbdetach(inp); in_pcbfree(inp); - } else + } else { in_pcbdetach(inp); + INP_WUNLOCK(inp); + } } } From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 18:37:50 2012 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 46516106566B; Fri, 6 Jan 2012 18:37:50 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 30B258FC14; Fri, 6 Jan 2012 18:37:50 +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 q06Ibonw002140; Fri, 6 Jan 2012 18:37:50 GMT (envelope-from andreast@svn.freebsd.org) Received: (from andreast@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06IbnKk002138; Fri, 6 Jan 2012 18:37:49 GMT (envelope-from andreast@svn.freebsd.org) Message-Id: <201201061837.q06IbnKk002138@svn.freebsd.org> From: Andreas Tobler Date: Fri, 6 Jan 2012 18:37: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: r229715 - head/contrib/gcc/config 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, 06 Jan 2012 18:37:50 -0000 Author: andreast Date: Fri Jan 6 18:37:49 2012 New Revision: 229715 URL: http://svn.freebsd.org/changeset/base/229715 Log: Silence a warning about redefinition of TARGET_ELF on powerpc. Modified: head/contrib/gcc/config/freebsd.h Modified: head/contrib/gcc/config/freebsd.h ============================================================================== --- head/contrib/gcc/config/freebsd.h Fri Jan 6 18:29:40 2012 (r229714) +++ head/contrib/gcc/config/freebsd.h Fri Jan 6 18:37:49 2012 (r229715) @@ -63,6 +63,7 @@ Boston, MA 02110-1301, USA. */ /* All FreeBSD Architectures support the ELF object file format. */ #undef OBJECT_FORMAT_ELF #define OBJECT_FORMAT_ELF 1 +#undef TARGET_ELF #define TARGET_ELF 1 /* Don't assume anything about the header files. */ From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 19:04:59 2012 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 CAC531065675; Fri, 6 Jan 2012 19:04:59 +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 9B6DA8FC0C; Fri, 6 Jan 2012 19:04: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 q06J4xGY003068; Fri, 6 Jan 2012 19:04:59 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06J4xCE003066; Fri, 6 Jan 2012 19:04:59 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201201061904.q06J4xCE003066@svn.freebsd.org> From: Ed Schouten Date: Fri, 6 Jan 2012 19:04: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: r229716 - head/include 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, 06 Jan 2012 19:04:59 -0000 Author: ed Date: Fri Jan 6 19:04:59 2012 New Revision: 229716 URL: http://svn.freebsd.org/changeset/base/229716 Log: Last attempt at : do enable the new code for C11 compilers. I was thinking by myself, if the new code doesn't work with GCC 4.2, why not simply turn it into an efficient version for C11 compilers? By changing the code to use _Generic() directly in that case, I can build the tgmath regression test in a matter of milliseconds with Clang, instead of the 8 seconds it used to take. So by the time C11 becomes the default, it will pick up the new code automatically. And now I will refrain from making more changes to . Modified: head/include/tgmath.h Modified: head/include/tgmath.h ============================================================================== --- head/include/tgmath.h Fri Jan 6 18:37:49 2012 (r229715) +++ head/include/tgmath.h Fri Jan 6 19:04:59 2012 (r229716) @@ -53,19 +53,23 @@ * Note that these macros cannot be implemented with C's ?: operator, * because the return type of the whole expression would incorrectly be long * double complex regardless of the argument types. + * + * The structure of the C11 implementation of these macros can in + * principle be reused for non-C11 compilers, but due to an integer + * promotion bug for complex types in GCC 4.2, simply let non-C11 + * compilers use an inefficient yet reliable version. */ -#ifndef __generic -#error " not implemented for this compiler" -#endif - -#if 0 /* XXX: Much shorter and faster to compile, but broken with GCC 4.2. */ +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L #define __tg_generic(x, cfnl, cfn, cfnf, fnl, fn, fnf) \ - __generic(x, long double _Complex, cfnl, \ - __generic(x, double _Complex, cfn, \ - __generic(x, float _Complex, cfnf, \ - __generic(x, long double, fnl, \ - __generic(x, float, fnf, fn))))) + _Generic(x, \ + long double _Complex: cfnl, \ + double _Complex: cfn, \ + float _Complex: cfnf, \ + long double: fnl, \ + default: fn, \ + float: fnf \ + ) #define __tg_type(x) \ __tg_generic(x, (long double _Complex)0, (double _Complex)0, \ (float _Complex)0, (long double)0, (double)0, (float)0) @@ -77,7 +81,7 @@ __tg_generic( \ __tg_type(x) + __tg_type(y), \ cfnl, cfn, cfnf, fnl, fn, fnf)(__VA_ARGS__) -#else +#elif defined(__generic) #define __tg_generic_simple(x, fnl, fn, fnf) \ __generic(x, long double _Complex, fnl, \ __generic(x, double _Complex, fn, \ @@ -113,6 +117,8 @@ __tg_generic_full(y, cfnl, cfn , cfn , fnl , fn , fn ), \ __tg_generic_full(y, cfnl, cfn , cfnf, fnl , fn , fnf )) \ (__VA_ARGS__) +#else +#error " not implemented for this compiler" #endif /* Macros to save lots of repetition below */ From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 19:05:16 2012 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 E44651065670; Fri, 6 Jan 2012 19:05:16 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.64.117]) by mx1.freebsd.org (Postfix) with ESMTP id 63C9F8FC1A; Fri, 6 Jan 2012 19:05:16 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.5/8.14.5) with ESMTP id q06J5FAN064919; Fri, 6 Jan 2012 23:05:15 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id q06J5FAc064918; Fri, 6 Jan 2012 23:05:15 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Fri, 6 Jan 2012 23:05:15 +0400 From: Gleb Smirnoff To: Navdeep Parhar Message-ID: <20120106190515.GU34721@FreeBSD.org> References: <201201061829.q06ITfP0001841@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <201201061829.q06ITfP0001841@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r229714 - 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, 06 Jan 2012 19:05:17 -0000 Navdeep, On Fri, Jan 06, 2012 at 06:29:41PM +0000, Navdeep Parhar wrote: N> Author: np N> Date: Fri Jan 6 18:29:40 2012 N> New Revision: 229714 N> URL: http://svn.freebsd.org/changeset/base/229714 N> N> Log: N> Always release the inp lock before returning from tcp_detach. ^ after ? N> Modified: N> head/sys/netinet/tcp_usrreq.c N> N> Modified: head/sys/netinet/tcp_usrreq.c N> ============================================================================== N> --- head/sys/netinet/tcp_usrreq.c Fri Jan 6 18:18:25 2012 (r229713) N> +++ head/sys/netinet/tcp_usrreq.c Fri Jan 6 18:29:40 2012 (r229714) N> @@ -204,8 +204,10 @@ tcp_detach(struct socket *so, struct inp N> tcp_discardcb(tp); N> in_pcbdetach(inp); N> in_pcbfree(inp); N> - } else N> + } else { N> in_pcbdetach(inp); N> + INP_WUNLOCK(inp); N> + } N> } N> } N> -- Totus tuus, Glebius. From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 19:09:47 2012 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 E82AE106564A; Fri, 6 Jan 2012 19:09:47 +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 D0ABD8FC12; Fri, 6 Jan 2012 19:09:47 +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 q06J9lJq003240; Fri, 6 Jan 2012 19:09:47 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06J9lis003237; Fri, 6 Jan 2012 19:09:47 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201061909.q06J9lis003237@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 6 Jan 2012 19:09:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229717 - stable/9/sys/dev/et 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, 06 Jan 2012 19:09:48 -0000 Author: yongari Date: Fri Jan 6 19:09:47 2012 New Revision: 229717 URL: http://svn.freebsd.org/changeset/base/229717 Log: MFC r228325: Overhaul bus_dma(9) usage in et(4) and clean up TX/RX path. This change should make et(4) work on any architectures. o Remove m_getl inline function and replace it with stanard mbuf interfaces. Previous code tried to minimize code duplication but this came from incorrect use of common DMA tag. Driver may be still use a common RX allocation handler with additional structure changes but I don't see much point to do that it would make it hard to understand the code. o Remove DragonflyBSD specific constant EVL_ENCAPLEN, use ETHER_VLAN_ENCAP_LEN instead. o Add bunch of new RX status definition. It seems controller supports RX checksum offloading but I was not able to make the feature work yet. Currently driver checks whether recevied frame is good one or not. o Avoid a typedef ending in '_t' as style(9) says. o Controller has no restriction on DMA address space, so there is no reason to limit the DMA address to 32bit. Descriptor rings, status blocks and TX/RX buffers now use full 64bit DMA addressing. o Allocate DMA memory shared between host and controller as coherent. o Create 3 separate DMA tags to be used as TX, mini RX ring and stanard RX ring. Previously it created a single DMA tag and it was used to all three rings. o et(4) does not support jumbo frame at this moment and I still don't quite understand how jumbo frame works on this controller so use two RX rings to handle small sized frame and normal sized frame respectively. The mini RX ring will be used to receive frames that are less than or equal to 127 bytes. The second RX ring is used to receive frames that are not handled by the first RX ring. If jumbo frame support is implemented, driver may have to choose better RX scheme by letting the second RX ring handle jumbo frames. This scheme will mimic Broadcom's efficient jumbo frame handling feature. However RAM buffer size(16KB) of the controller is too small to hold 2 jumbo frames, if 9KB jumbo frame is used, I'm not sure how good performance would it have. o In et_rxeof(), make sure to check whether controller received good frame or not. Passing corrupted frame to upper layer is bad idea. o If driver receives a bad frame or driver fails to allocate RX buffer due to resource shortage condition, reuse previously loaded DMA map for RX buffer instead of unloading/loading RX buffer again. o et_init_tx_ring() never fails so change return type to void. o In watchdog handler, show TX DMA write back status of errored frame which could be used as a clue to debug watchdog timeout. o Add missing bus_dmamap_sync() in various places such that et(4) should work with bounce buffers(e.g. PAE). o TX side bus_dmamap_load_mbuf_sg(9) support. o RX side bus_dmamap_load_mbuf_sg(9) support. o Controller has no DMA alignment limit in RX buffer so use m_adj(9) in RX buffer allocation to make IP header align on 2 bytes boundary. Otherwise it would trigger unaligned access error in upper layer on strict alignment architectures. One of down side of controller is it provides limited set of RX buffer length like most Intel controllers. This is not problem at this moment because driver does not support jumbo frame yet but it may require alignment fixup code to support jumbo frame on strict alignment architectures. o In et_txeof(), don't zero TX descriptors for transmitted frames. TX descriptors don't need write access after transmission. Driver sets IFF_DRV_OACTIVE when the number of available TX descriptors are less than or equal to ET_NSEG_SPARE. Make sure to clear IFF_DRV_OACTIVE only when the number of available TX descriptor is greater than ET_NSEG_SPARE. Modified: stable/9/sys/dev/et/if_et.c stable/9/sys/dev/et/if_etvar.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/et/if_et.c ============================================================================== --- stable/9/sys/dev/et/if_et.c Fri Jan 6 19:04:59 2012 (r229716) +++ stable/9/sys/dev/et/if_et.c Fri Jan 6 19:09:47 2012 (r229717) @@ -99,7 +99,7 @@ static void et_init(void *); static int et_ioctl(struct ifnet *, u_long, caddr_t); static void et_start_locked(struct ifnet *); static void et_start(struct ifnet *); -static void et_watchdog(struct et_softc *); +static int et_watchdog(struct et_softc *); static int et_ifmedia_upd_locked(struct ifnet *); static int et_ifmedia_upd(struct ifnet *); static void et_ifmedia_sts(struct ifnet *, struct ifmediareq *); @@ -114,24 +114,22 @@ static void et_disable_intrs(struct et_s static void et_rxeof(struct et_softc *); static void et_txeof(struct et_softc *); -static int et_dma_alloc(device_t); -static void et_dma_free(device_t); -static int et_dma_mem_create(device_t, bus_size_t, bus_dma_tag_t *, - void **, bus_addr_t *, bus_dmamap_t *); -static void et_dma_mem_destroy(bus_dma_tag_t, void *, bus_dmamap_t); -static int et_dma_mbuf_create(device_t); -static void et_dma_mbuf_destroy(device_t, int, const int[]); -static void et_dma_ring_addr(void *, bus_dma_segment_t *, int, int); -static void et_dma_buf_addr(void *, bus_dma_segment_t *, int, - bus_size_t, int); -static int et_init_tx_ring(struct et_softc *); +static int et_dma_alloc(struct et_softc *); +static void et_dma_free(struct et_softc *); +static void et_dma_map_addr(void *, bus_dma_segment_t *, int, int); +static int et_dma_ring_alloc(struct et_softc *, bus_size_t, bus_size_t, + bus_dma_tag_t *, uint8_t **, bus_dmamap_t *, bus_addr_t *, + const char *); +static void et_dma_ring_free(struct et_softc *, bus_dma_tag_t *, uint8_t **, + bus_dmamap_t *); +static void et_init_tx_ring(struct et_softc *); static int et_init_rx_ring(struct et_softc *); static void et_free_tx_ring(struct et_softc *); static void et_free_rx_ring(struct et_softc *); static int et_encap(struct et_softc *, struct mbuf **); -static int et_newbuf(struct et_rxbuf_data *, int, int, int); -static int et_newbuf_cluster(struct et_rxbuf_data *, int, int); -static int et_newbuf_hdr(struct et_rxbuf_data *, int, int); +static int et_newbuf_cluster(struct et_rxbuf_data *, int); +static int et_newbuf_hdr(struct et_rxbuf_data *, int); +static void et_rxbuf_discard(struct et_rxbuf_data *, int); static void et_stop(struct et_softc *); static int et_chip_init(struct et_softc *); @@ -152,7 +150,6 @@ static void et_get_eaddr(device_t, uint8 static void et_setmulti(struct et_softc *); static void et_tick(void *); static void et_setmedia(struct et_softc *); -static void et_setup_rxdesc(struct et_rxbuf_data *, int, bus_addr_t); static const struct et_dev { uint16_t vid; @@ -202,18 +199,6 @@ TUNABLE_INT("hw.et.rx_intr_npkts", &et_r TUNABLE_INT("hw.et.rx_intr_delay", &et_rx_intr_delay); TUNABLE_INT("hw.et.tx_intr_nsegs", &et_tx_intr_nsegs); -struct et_bsize { - int bufsize; - et_newbuf_t newbuf; -}; - -static const struct et_bsize et_bufsize_std[ET_RX_NRING] = { - { .bufsize = ET_RXDMA_CTRL_RING0_128, - .newbuf = et_newbuf_hdr }, - { .bufsize = ET_RXDMA_CTRL_RING1_2048, - .newbuf = et_newbuf_cluster }, -}; - static int et_probe(device_t dev) { @@ -326,7 +311,7 @@ et_attach(device_t dev) et_disable_intrs(sc); - error = et_dma_alloc(dev); + error = et_dma_alloc(sc); if (error) goto fail; @@ -403,7 +388,7 @@ et_detach(device_t dev) if (sc->ifp != NULL) if_free(sc->ifp); - et_dma_free(dev); + et_dma_free(sc); mtx_destroy(&sc->sc_mtx); @@ -699,235 +684,250 @@ et_enable_intrs(struct et_softc *sc, uin CSR_WRITE_4(sc, ET_INTR_MASK, ~intrs); } +struct et_dmamap_arg { + bus_addr_t et_busaddr; +}; + +static void +et_dma_map_addr(void *arg, bus_dma_segment_t *segs, int nseg, int error) +{ + struct et_dmamap_arg *ctx; + + if (error) + return; + + KASSERT(nseg == 1, ("%s: %d segments returned!", __func__, nseg)); + + ctx = arg; + ctx->et_busaddr = segs->ds_addr; +} + static int -et_dma_alloc(device_t dev) +et_dma_ring_alloc(struct et_softc *sc, bus_size_t alignment, bus_size_t maxsize, + bus_dma_tag_t *tag, uint8_t **ring, bus_dmamap_t *map, bus_addr_t *paddr, + const char *msg) { - struct et_softc *sc = device_get_softc(dev); - struct et_txdesc_ring *tx_ring = &sc->sc_tx_ring; - struct et_txstatus_data *txsd = &sc->sc_tx_status; - struct et_rxstat_ring *rxst_ring = &sc->sc_rxstat_ring; - struct et_rxstatus_data *rxsd = &sc->sc_rx_status; - int i, error; + struct et_dmamap_arg ctx; + int error; - /* - * Create top level DMA tag - */ - error = bus_dma_tag_create(NULL, 1, 0, - BUS_SPACE_MAXADDR_32BIT, - BUS_SPACE_MAXADDR, - NULL, NULL, - MAXBSIZE, - BUS_SPACE_UNRESTRICTED, - BUS_SPACE_MAXSIZE_32BIT, - 0, NULL, NULL, &sc->sc_dtag); - if (error) { - device_printf(dev, "can't create DMA tag\n"); + error = bus_dma_tag_create(sc->sc_dtag, alignment, 0, BUS_SPACE_MAXADDR, + BUS_SPACE_MAXADDR, NULL, NULL, maxsize, 1, maxsize, 0, NULL, NULL, + tag); + if (error != 0) { + device_printf(sc->dev, "could not create %s dma tag\n", msg); return (error); } - - /* - * Create TX ring DMA stuffs - */ - error = et_dma_mem_create(dev, ET_TX_RING_SIZE, &tx_ring->tr_dtag, - (void **)&tx_ring->tr_desc, - &tx_ring->tr_paddr, &tx_ring->tr_dmap); - if (error) { - device_printf(dev, "can't create TX ring DMA stuffs\n"); + /* Allocate DMA'able memory for ring. */ + error = bus_dmamem_alloc(*tag, (void **)ring, + BUS_DMA_NOWAIT | BUS_DMA_ZERO | BUS_DMA_COHERENT, map); + if (error != 0) { + device_printf(sc->dev, + "could not allocate DMA'able memory for %s\n", msg); return (error); } - - /* - * Create TX status DMA stuffs - */ - error = et_dma_mem_create(dev, sizeof(uint32_t), &txsd->txsd_dtag, - (void **)&txsd->txsd_status, - &txsd->txsd_paddr, &txsd->txsd_dmap); - if (error) { - device_printf(dev, "can't create TX status DMA stuffs\n"); + /* Load the address of the ring. */ + ctx.et_busaddr = 0; + error = bus_dmamap_load(*tag, *map, *ring, maxsize, et_dma_map_addr, + &ctx, BUS_DMA_NOWAIT); + if (error != 0) { + device_printf(sc->dev, + "could not load DMA'able memory for %s\n", msg); return (error); } + *paddr = ctx.et_busaddr; + return (0); +} - /* - * Create DMA stuffs for RX rings - */ - for (i = 0; i < ET_RX_NRING; ++i) { - static const uint32_t rx_ring_posreg[ET_RX_NRING] = - { ET_RX_RING0_POS, ET_RX_RING1_POS }; - - struct et_rxdesc_ring *rx_ring = &sc->sc_rx_ring[i]; +static void +et_dma_ring_free(struct et_softc *sc, bus_dma_tag_t *tag, uint8_t **ring, + bus_dmamap_t *map) +{ - error = et_dma_mem_create(dev, ET_RX_RING_SIZE, - &rx_ring->rr_dtag, - (void **)&rx_ring->rr_desc, - &rx_ring->rr_paddr, - &rx_ring->rr_dmap); - if (error) { - device_printf(dev, "can't create DMA stuffs for " - "the %d RX ring\n", i); - return (error); - } - rx_ring->rr_posreg = rx_ring_posreg[i]; + if (*map != NULL) + bus_dmamap_unload(*tag, *map); + if (*map != NULL && *ring != NULL) { + bus_dmamem_free(*tag, *ring, *map); + *ring = NULL; + *map = NULL; } - - /* - * Create RX stat ring DMA stuffs - */ - error = et_dma_mem_create(dev, ET_RXSTAT_RING_SIZE, - &rxst_ring->rsr_dtag, - (void **)&rxst_ring->rsr_stat, - &rxst_ring->rsr_paddr, &rxst_ring->rsr_dmap); - if (error) { - device_printf(dev, "can't create RX stat ring DMA stuffs\n"); - return (error); + if (*tag) { + bus_dma_tag_destroy(*tag); + *tag = NULL; } +} - /* - * Create RX status DMA stuffs - */ - error = et_dma_mem_create(dev, sizeof(struct et_rxstatus), - &rxsd->rxsd_dtag, - (void **)&rxsd->rxsd_status, - &rxsd->rxsd_paddr, &rxsd->rxsd_dmap); - if (error) { - device_printf(dev, "can't create RX status DMA stuffs\n"); +static int +et_dma_alloc(struct et_softc *sc) +{ + struct et_txdesc_ring *tx_ring; + struct et_rxdesc_ring *rx_ring; + struct et_rxstat_ring *rxst_ring; + struct et_rxstatus_data *rxsd; + struct et_rxbuf_data *rbd; + struct et_txbuf_data *tbd; + struct et_txstatus_data *txsd; + int i, error; + + error = bus_dma_tag_create(bus_get_dma_tag(sc->dev), 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, + BUS_SPACE_MAXSIZE_32BIT, 0, BUS_SPACE_MAXSIZE_32BIT, 0, NULL, NULL, + &sc->sc_dtag); + if (error != 0) { + device_printf(sc->dev, "could not allocate parent dma tag\n"); return (error); } - /* - * Create mbuf DMA stuffs - */ - error = et_dma_mbuf_create(dev); + /* TX ring. */ + tx_ring = &sc->sc_tx_ring; + error = et_dma_ring_alloc(sc, ET_RING_ALIGN, ET_TX_RING_SIZE, + &tx_ring->tr_dtag, (uint8_t **)&tx_ring->tr_desc, &tx_ring->tr_dmap, + &tx_ring->tr_paddr, "TX ring"); if (error) return (error); - return (0); -} + /* TX status block. */ + txsd = &sc->sc_tx_status; + error = et_dma_ring_alloc(sc, ET_STATUS_ALIGN, sizeof(uint32_t), + &txsd->txsd_dtag, (uint8_t **)&txsd->txsd_status, &txsd->txsd_dmap, + &txsd->txsd_paddr, "TX status block"); + if (error) + return (error); -static void -et_dma_free(device_t dev) -{ - struct et_softc *sc = device_get_softc(dev); - struct et_txdesc_ring *tx_ring = &sc->sc_tx_ring; - struct et_txstatus_data *txsd = &sc->sc_tx_status; - struct et_rxstat_ring *rxst_ring = &sc->sc_rxstat_ring; - struct et_rxstatus_data *rxsd = &sc->sc_rx_status; - int i, rx_done[ET_RX_NRING]; + /* RX ring 0, used as to recive small sized frames. */ + rx_ring = &sc->sc_rx_ring[0]; + error = et_dma_ring_alloc(sc, ET_RING_ALIGN, ET_RX_RING_SIZE, + &rx_ring->rr_dtag, (uint8_t **)&rx_ring->rr_desc, &rx_ring->rr_dmap, + &rx_ring->rr_paddr, "RX ring 0"); + rx_ring->rr_posreg = ET_RX_RING0_POS; + if (error) + return (error); - /* - * Destroy TX ring DMA stuffs - */ - et_dma_mem_destroy(tx_ring->tr_dtag, tx_ring->tr_desc, - tx_ring->tr_dmap); + /* RX ring 1, used as to store normal sized frames. */ + rx_ring = &sc->sc_rx_ring[1]; + error = et_dma_ring_alloc(sc, ET_RING_ALIGN, ET_RX_RING_SIZE, + &rx_ring->rr_dtag, (uint8_t **)&rx_ring->rr_desc, &rx_ring->rr_dmap, + &rx_ring->rr_paddr, "RX ring 1"); + rx_ring->rr_posreg = ET_RX_RING1_POS; + if (error) + return (error); - /* - * Destroy TX status DMA stuffs - */ - et_dma_mem_destroy(txsd->txsd_dtag, txsd->txsd_status, - txsd->txsd_dmap); + /* RX stat ring. */ + rxst_ring = &sc->sc_rxstat_ring; + error = et_dma_ring_alloc(sc, ET_RING_ALIGN, ET_RXSTAT_RING_SIZE, + &rxst_ring->rsr_dtag, (uint8_t **)&rxst_ring->rsr_stat, + &rxst_ring->rsr_dmap, &rxst_ring->rsr_paddr, "RX stat ring"); + if (error) + return (error); - /* - * Destroy DMA stuffs for RX rings - */ - for (i = 0; i < ET_RX_NRING; ++i) { - struct et_rxdesc_ring *rx_ring = &sc->sc_rx_ring[i]; + /* RX status block. */ + rxsd = &sc->sc_rx_status; + error = et_dma_ring_alloc(sc, ET_STATUS_ALIGN, + sizeof(struct et_rxstatus), &rxsd->rxsd_dtag, + (uint8_t **)&rxsd->rxsd_status, &rxsd->rxsd_dmap, + &rxsd->rxsd_paddr, "RX status block"); + if (error) + return (error); - et_dma_mem_destroy(rx_ring->rr_dtag, rx_ring->rr_desc, - rx_ring->rr_dmap); + /* Create parent DMA tag for mbufs. */ + error = bus_dma_tag_create(bus_get_dma_tag(sc->dev), 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, + BUS_SPACE_MAXSIZE_32BIT, 0, BUS_SPACE_MAXSIZE_32BIT, 0, NULL, NULL, + &sc->sc_mbuf_dtag); + if (error != 0) { + device_printf(sc->dev, + "could not allocate parent dma tag for mbuf\n"); + return (error); } - /* - * Destroy RX stat ring DMA stuffs - */ - et_dma_mem_destroy(rxst_ring->rsr_dtag, rxst_ring->rsr_stat, - rxst_ring->rsr_dmap); - - /* - * Destroy RX status DMA stuffs - */ - et_dma_mem_destroy(rxsd->rxsd_dtag, rxsd->rxsd_status, - rxsd->rxsd_dmap); - - /* - * Destroy mbuf DMA stuffs - */ - for (i = 0; i < ET_RX_NRING; ++i) - rx_done[i] = ET_RX_NDESC; - et_dma_mbuf_destroy(dev, ET_TX_NDESC, rx_done); - - /* - * Destroy top level DMA tag - */ - if (sc->sc_dtag != NULL) - bus_dma_tag_destroy(sc->sc_dtag); -} - -static int -et_dma_mbuf_create(device_t dev) -{ - struct et_softc *sc = device_get_softc(dev); - struct et_txbuf_data *tbd = &sc->sc_tx_data; - int i, error, rx_done[ET_RX_NRING]; + /* Create DMA tag for mini RX mbufs to use RX ring 0. */ + error = bus_dma_tag_create(sc->sc_mbuf_dtag, 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, MHLEN, 1, + MHLEN, 0, NULL, NULL, &sc->sc_rx_mini_tag); + if (error) { + device_printf(sc->dev, "could not create mini RX dma tag\n"); + return (error); + } - /* - * Create mbuf DMA tag - */ - error = bus_dma_tag_create(sc->sc_dtag, 1, 0, - BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, - NULL, NULL, - ET_JUMBO_FRAMELEN, ET_NSEG_MAX, - BUS_SPACE_MAXSIZE_32BIT, - BUS_DMA_ALLOCNOW, NULL, NULL, &sc->sc_mbuf_dtag); + /* Create DMA tag for standard RX mbufs to use RX ring 1. */ + error = bus_dma_tag_create(sc->sc_mbuf_dtag, 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES, 1, + MCLBYTES, 0, NULL, NULL, &sc->sc_rx_tag); if (error) { - device_printf(dev, "can't create mbuf DMA tag\n"); + device_printf(sc->dev, "could not create RX dma tag\n"); return (error); } - /* - * Create spare DMA map for RX mbufs - */ - error = bus_dmamap_create(sc->sc_mbuf_dtag, 0, &sc->sc_mbuf_tmp_dmap); + /* Create DMA tag for TX mbufs. */ + error = bus_dma_tag_create(sc->sc_mbuf_dtag, 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, + MCLBYTES * ET_NSEG_MAX, ET_NSEG_MAX, MCLBYTES, 0, NULL, NULL, + &sc->sc_tx_tag); if (error) { - device_printf(dev, "can't create spare mbuf DMA map\n"); - bus_dma_tag_destroy(sc->sc_mbuf_dtag); - sc->sc_mbuf_dtag = NULL; + device_printf(sc->dev, "could not create TX dma tag\n"); return (error); } - /* - * Create DMA maps for RX mbufs - */ - bzero(rx_done, sizeof(rx_done)); - for (i = 0; i < ET_RX_NRING; ++i) { - struct et_rxbuf_data *rbd = &sc->sc_rx_data[i]; - int j; + /* Initialize RX ring 0. */ + rbd = &sc->sc_rx_data[0]; + rbd->rbd_bufsize = ET_RXDMA_CTRL_RING0_128; + rbd->rbd_newbuf = et_newbuf_hdr; + rbd->rbd_discard = et_rxbuf_discard; + rbd->rbd_softc = sc; + rbd->rbd_ring = &sc->sc_rx_ring[0]; + /* Create DMA maps for mini RX buffers, ring 0. */ + for (i = 0; i < ET_RX_NDESC; i++) { + error = bus_dmamap_create(sc->sc_rx_mini_tag, 0, + &rbd->rbd_buf[i].rb_dmap); + if (error) { + device_printf(sc->dev, + "could not create DMA map for mini RX mbufs\n"); + return (error); + } + } - for (j = 0; j < ET_RX_NDESC; ++j) { - error = bus_dmamap_create(sc->sc_mbuf_dtag, 0, - &rbd->rbd_buf[j].rb_dmap); - if (error) { - device_printf(dev, "can't create %d RX mbuf " - "for %d RX ring\n", j, i); - rx_done[i] = j; - et_dma_mbuf_destroy(dev, 0, rx_done); - return (error); - } + /* Create a spare DMA map for mini RX buffers, ring 0. */ + error = bus_dmamap_create(sc->sc_rx_mini_tag, 0, + &sc->sc_rx_mini_sparemap); + if (error) { + device_printf(sc->dev, + "could not create spare DMA map for mini RX mbuf\n"); + return (error); + } + + /* Initialize RX ring 1. */ + rbd = &sc->sc_rx_data[1]; + rbd->rbd_bufsize = ET_RXDMA_CTRL_RING1_2048; + rbd->rbd_newbuf = et_newbuf_cluster; + rbd->rbd_discard = et_rxbuf_discard; + rbd->rbd_softc = sc; + rbd->rbd_ring = &sc->sc_rx_ring[1]; + /* Create DMA maps for standard RX buffers, ring 1. */ + for (i = 0; i < ET_RX_NDESC; i++) { + error = bus_dmamap_create(sc->sc_rx_tag, 0, + &rbd->rbd_buf[i].rb_dmap); + if (error) { + device_printf(sc->dev, + "could not create DMA map for mini RX mbufs\n"); + return (error); } - rx_done[i] = ET_RX_NDESC; + } - rbd->rbd_softc = sc; - rbd->rbd_ring = &sc->sc_rx_ring[i]; + /* Create a spare DMA map for standard RX buffers, ring 1. */ + error = bus_dmamap_create(sc->sc_rx_tag, 0, &sc->sc_rx_sparemap); + if (error) { + device_printf(sc->dev, + "could not create spare DMA map for RX mbuf\n"); + return (error); } - /* - * Create DMA maps for TX mbufs - */ - for (i = 0; i < ET_TX_NDESC; ++i) { - error = bus_dmamap_create(sc->sc_mbuf_dtag, 0, - &tbd->tbd_buf[i].tb_dmap); + /* Create DMA maps for TX buffers. */ + tbd = &sc->sc_tx_data; + for (i = 0; i < ET_TX_NDESC; i++) { + error = bus_dmamap_create(sc->sc_tx_tag, 0, + &tbd->tbd_buf[i].tb_dmap); if (error) { - device_printf(dev, "can't create %d TX mbuf " - "DMA map\n", i); - et_dma_mbuf_destroy(dev, i, rx_done); + device_printf(sc->dev, + "could not create DMA map for TX mbufs\n"); return (error); } } @@ -936,106 +936,97 @@ et_dma_mbuf_create(device_t dev) } static void -et_dma_mbuf_destroy(device_t dev, int tx_done, const int rx_done[]) +et_dma_free(struct et_softc *sc) { - struct et_softc *sc = device_get_softc(dev); - struct et_txbuf_data *tbd = &sc->sc_tx_data; + struct et_txdesc_ring *tx_ring; + struct et_rxdesc_ring *rx_ring; + struct et_txstatus_data *txsd; + struct et_rxstat_ring *rxst_ring; + struct et_rxstatus_data *rxsd; + struct et_rxbuf_data *rbd; + struct et_txbuf_data *tbd; int i; - if (sc->sc_mbuf_dtag == NULL) - return; - - /* - * Destroy DMA maps for RX mbufs - */ - for (i = 0; i < ET_RX_NRING; ++i) { - struct et_rxbuf_data *rbd = &sc->sc_rx_data[i]; - int j; - - for (j = 0; j < rx_done[i]; ++j) { - struct et_rxbuf *rb = &rbd->rbd_buf[j]; - - KASSERT(rb->rb_mbuf == NULL, - ("RX mbuf in %d RX ring is not freed yet\n", i)); - bus_dmamap_destroy(sc->sc_mbuf_dtag, rb->rb_dmap); + /* Destroy DMA maps for mini RX buffers, ring 0. */ + rbd = &sc->sc_rx_data[0]; + for (i = 0; i < ET_RX_NDESC; i++) { + if (rbd->rbd_buf[i].rb_dmap) { + bus_dmamap_destroy(sc->sc_rx_mini_tag, + rbd->rbd_buf[i].rb_dmap); + rbd->rbd_buf[i].rb_dmap = NULL; } } - - /* - * Destroy DMA maps for TX mbufs - */ - for (i = 0; i < tx_done; ++i) { - struct et_txbuf *tb = &tbd->tbd_buf[i]; - - KASSERT(tb->tb_mbuf == NULL, ("TX mbuf is not freed yet\n")); - bus_dmamap_destroy(sc->sc_mbuf_dtag, tb->tb_dmap); + if (sc->sc_rx_mini_sparemap) { + bus_dmamap_destroy(sc->sc_rx_mini_tag, sc->sc_rx_mini_sparemap); + sc->sc_rx_mini_sparemap = NULL; } - - /* - * Destroy spare mbuf DMA map - */ - bus_dmamap_destroy(sc->sc_mbuf_dtag, sc->sc_mbuf_tmp_dmap); - - /* - * Destroy mbuf DMA tag - */ - bus_dma_tag_destroy(sc->sc_mbuf_dtag); - sc->sc_mbuf_dtag = NULL; -} - -static int -et_dma_mem_create(device_t dev, bus_size_t size, bus_dma_tag_t *dtag, - void **addr, bus_addr_t *paddr, bus_dmamap_t *dmap) -{ - struct et_softc *sc = device_get_softc(dev); - int error; - - error = bus_dma_tag_create(sc->sc_dtag, ET_ALIGN, 0, - BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, - NULL, NULL, - size, 1, BUS_SPACE_MAXSIZE_32BIT, - 0, NULL, NULL, dtag); - if (error) { - device_printf(dev, "can't create DMA tag\n"); - return (error); + if (sc->sc_rx_mini_tag) { + bus_dma_tag_destroy(sc->sc_rx_mini_tag); + sc->sc_rx_mini_tag = NULL; } - error = bus_dmamem_alloc(*dtag, addr, BUS_DMA_WAITOK | BUS_DMA_ZERO, - dmap); - if (error) { - device_printf(dev, "can't allocate DMA mem\n"); - bus_dma_tag_destroy(*dtag); - *dtag = NULL; - return (error); + /* Destroy DMA maps for standard RX buffers, ring 1. */ + rbd = &sc->sc_rx_data[1]; + for (i = 0; i < ET_RX_NDESC; i++) { + if (rbd->rbd_buf[i].rb_dmap) { + bus_dmamap_destroy(sc->sc_rx_tag, + rbd->rbd_buf[i].rb_dmap); + rbd->rbd_buf[i].rb_dmap = NULL; + } } - - error = bus_dmamap_load(*dtag, *dmap, *addr, size, - et_dma_ring_addr, paddr, BUS_DMA_WAITOK); - if (error) { - device_printf(dev, "can't load DMA mem\n"); - bus_dmamem_free(*dtag, *addr, *dmap); - bus_dma_tag_destroy(*dtag); - *dtag = NULL; - return (error); + if (sc->sc_rx_sparemap) { + bus_dmamap_destroy(sc->sc_rx_tag, sc->sc_rx_sparemap); + sc->sc_rx_sparemap = NULL; + } + if (sc->sc_rx_tag) { + bus_dma_tag_destroy(sc->sc_rx_tag); + sc->sc_rx_tag = NULL; } - return (0); -} -static void -et_dma_mem_destroy(bus_dma_tag_t dtag, void *addr, bus_dmamap_t dmap) -{ - if (dtag != NULL) { - bus_dmamap_unload(dtag, dmap); - bus_dmamem_free(dtag, addr, dmap); - bus_dma_tag_destroy(dtag); + /* Destroy DMA maps for TX buffers. */ + tbd = &sc->sc_tx_data; + for (i = 0; i < ET_TX_NDESC; i++) { + if (tbd->tbd_buf[i].tb_dmap) { + bus_dmamap_destroy(sc->sc_tx_tag, + tbd->tbd_buf[i].tb_dmap); + tbd->tbd_buf[i].tb_dmap = NULL; + } + } + if (sc->sc_tx_tag) { + bus_dma_tag_destroy(sc->sc_tx_tag); + sc->sc_tx_tag = NULL; } -} -static void -et_dma_ring_addr(void *arg, bus_dma_segment_t *seg, int nseg, int error) -{ - KASSERT(nseg == 1, ("too many segments\n")); - *((bus_addr_t *)arg) = seg->ds_addr; + /* Destroy mini RX ring, ring 0. */ + rx_ring = &sc->sc_rx_ring[0]; + et_dma_ring_free(sc, &rx_ring->rr_dtag, (void *)&rx_ring->rr_desc, + &rx_ring->rr_dmap); + /* Destroy standard RX ring, ring 1. */ + rx_ring = &sc->sc_rx_ring[1]; + et_dma_ring_free(sc, &rx_ring->rr_dtag, (void *)&rx_ring->rr_desc, + &rx_ring->rr_dmap); + /* Destroy RX stat ring. */ + rxst_ring = &sc->sc_rxstat_ring; + et_dma_ring_free(sc, &rxst_ring->rsr_dtag, (void *)&rxst_ring->rsr_stat, + &rxst_ring->rsr_dmap); + /* Destroy RX status block. */ + rxsd = &sc->sc_rx_status; + et_dma_ring_free(sc, &rxst_ring->rsr_dtag, (void *)&rxst_ring->rsr_stat, + &rxst_ring->rsr_dmap); + /* Destroy TX ring. */ + tx_ring = &sc->sc_tx_ring; + et_dma_ring_free(sc, &tx_ring->tr_dtag, (void *)&tx_ring->tr_desc, + &tx_ring->tr_dmap); + /* Destroy TX status block. */ + txsd = &sc->sc_tx_status; + et_dma_ring_free(sc, &txsd->txsd_dtag, (void *)&txsd->txsd_status, + &txsd->txsd_dmap); + + /* Destroy the parent tag. */ + if (sc->sc_dtag) { + bus_dma_tag_destroy(sc->sc_dtag); + sc->sc_dtag = NULL; + } } static void @@ -1113,30 +1104,21 @@ back: static void et_init_locked(struct et_softc *sc) { - struct ifnet *ifp = sc->ifp; - const struct et_bsize *arr; - int error, i; + struct ifnet *ifp; + int error; ET_LOCK_ASSERT(sc); + ifp = sc->ifp; if (ifp->if_drv_flags & IFF_DRV_RUNNING) return; et_stop(sc); - arr = et_bufsize_std; - for (i = 0; i < ET_RX_NRING; ++i) { - sc->sc_rx_data[i].rbd_bufsize = arr[i].bufsize; - sc->sc_rx_data[i].rbd_newbuf = arr[i].newbuf; - } - - error = et_init_tx_ring(sc); - if (error) - goto back; - + et_init_tx_ring(sc); error = et_init_rx_ring(sc); if (error) - goto back; + return; error = et_chip_init(sc); if (error) @@ -1309,20 +1291,26 @@ et_start(struct ifnet *ifp) ET_UNLOCK(sc); } -static void +static int et_watchdog(struct et_softc *sc) { + uint32_t status; + ET_LOCK_ASSERT(sc); if (sc->watchdog_timer == 0 || --sc->watchdog_timer) - return; + return (0); - if_printf(sc->ifp, "watchdog timed out\n"); + bus_dmamap_sync(sc->sc_tx_status.txsd_dtag, sc->sc_tx_status.txsd_dmap, + BUS_DMASYNC_POSTREAD); + status = le32toh(*(sc->sc_tx_status.txsd_status)); + if_printf(sc->ifp, "watchdog timed out (0x%08x) -- resetting\n", + status); sc->ifp->if_oerrors++; sc->ifp->if_drv_flags &= ~IFF_DRV_RUNNING; et_init_locked(sc); - et_start_locked(sc->ifp); + return (EJUSTRETURN); } static int @@ -1350,49 +1338,59 @@ et_stop_txdma(struct et_softc *sc) static void et_free_tx_ring(struct et_softc *sc) { - struct et_txbuf_data *tbd = &sc->sc_tx_data; - struct et_txdesc_ring *tx_ring = &sc->sc_tx_ring; + struct et_txdesc_ring *tx_ring; + struct et_txbuf_data *tbd; + struct et_txbuf *tb; int i; + tbd = &sc->sc_tx_data; + tx_ring = &sc->sc_tx_ring; for (i = 0; i < ET_TX_NDESC; ++i) { - struct et_txbuf *tb = &tbd->tbd_buf[i]; - + tb = &tbd->tbd_buf[i]; if (tb->tb_mbuf != NULL) { + bus_dmamap_sync(sc->sc_tx_tag, tb->tb_dmap, + BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(sc->sc_mbuf_dtag, tb->tb_dmap); m_freem(tb->tb_mbuf); tb->tb_mbuf = NULL; } } - - bzero(tx_ring->tr_desc, ET_TX_RING_SIZE); - bus_dmamap_sync(tx_ring->tr_dtag, tx_ring->tr_dmap, - BUS_DMASYNC_PREWRITE); } static void et_free_rx_ring(struct et_softc *sc) { - int n; - - for (n = 0; n < ET_RX_NRING; ++n) { - struct et_rxbuf_data *rbd = &sc->sc_rx_data[n]; - struct et_rxdesc_ring *rx_ring = &sc->sc_rx_ring[n]; - int i; - - for (i = 0; i < ET_RX_NDESC; ++i) { - struct et_rxbuf *rb = &rbd->rbd_buf[i]; + struct et_rxbuf_data *rbd; + struct et_rxdesc_ring *rx_ring; + struct et_rxbuf *rb; + int i; - if (rb->rb_mbuf != NULL) { - bus_dmamap_unload(sc->sc_mbuf_dtag, - rb->rb_dmap); - m_freem(rb->rb_mbuf); - rb->rb_mbuf = NULL; - } + /* Ring 0 */ + rx_ring = &sc->sc_rx_ring[0]; + rbd = &sc->sc_rx_data[0]; + for (i = 0; i < ET_RX_NDESC; ++i) { + rb = &rbd->rbd_buf[i]; + if (rb->rb_mbuf != NULL) { + bus_dmamap_sync(sc->sc_rx_mini_tag, rx_ring->rr_dmap, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->sc_rx_mini_tag, rb->rb_dmap); + m_freem(rb->rb_mbuf); + rb->rb_mbuf = NULL; } + } - bzero(rx_ring->rr_desc, ET_RX_RING_SIZE); - bus_dmamap_sync(rx_ring->rr_dtag, rx_ring->rr_dmap, - BUS_DMASYNC_PREWRITE); + /* Ring 1 */ + rx_ring = &sc->sc_rx_ring[1]; + rbd = &sc->sc_rx_data[1]; + for (i = 0; i < ET_RX_NDESC; ++i) { + rb = &rbd->rbd_buf[i]; + if (rb->rb_mbuf != NULL) { + bus_dmamap_sync(sc->sc_rx_tag, rx_ring->rr_dmap, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->sc_rx_tag, rb->rb_dmap); + m_freem(rb->rb_mbuf); + rb->rb_mbuf = NULL; + } } } @@ -1519,40 +1517,41 @@ et_chip_init(struct et_softc *sc) return (0); } -static int +static void et_init_tx_ring(struct et_softc *sc) { - struct et_txdesc_ring *tx_ring = &sc->sc_tx_ring; - struct et_txstatus_data *txsd = &sc->sc_tx_status; - struct et_txbuf_data *tbd = &sc->sc_tx_data; + struct et_txdesc_ring *tx_ring; + struct et_txbuf_data *tbd; + struct et_txstatus_data *txsd; + tx_ring = &sc->sc_tx_ring; bzero(tx_ring->tr_desc, ET_TX_RING_SIZE); bus_dmamap_sync(tx_ring->tr_dtag, tx_ring->tr_dmap, - BUS_DMASYNC_PREWRITE); + BUS_DMASYNC_PREWRITE); + tbd = &sc->sc_tx_data; tbd->tbd_start_index = 0; tbd->tbd_start_wrap = 0; tbd->tbd_used = 0; + txsd = &sc->sc_tx_status; bzero(txsd->txsd_status, sizeof(uint32_t)); bus_dmamap_sync(txsd->txsd_dtag, txsd->txsd_dmap, - BUS_DMASYNC_PREWRITE); - return (0); + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); } static int et_init_rx_ring(struct et_softc *sc) { - struct et_rxstatus_data *rxsd = &sc->sc_rx_status; - struct et_rxstat_ring *rxst_ring = &sc->sc_rxstat_ring; - int n; + struct et_rxstatus_data *rxsd; + struct et_rxstat_ring *rxst_ring; + struct et_rxbuf_data *rbd; + int i, error, n; for (n = 0; n < ET_RX_NRING; ++n) { - struct et_rxbuf_data *rbd = &sc->sc_rx_data[n]; - int i, error; - + rbd = &sc->sc_rx_data[n]; for (i = 0; i < ET_RX_NDESC; ++i) { - error = rbd->rbd_newbuf(rbd, i, 1); + error = rbd->rbd_newbuf(rbd, i); if (error) { if_printf(sc->ifp, "%d ring %d buf, " "newbuf failed: %d\n", n, i, error); @@ -1561,37 +1560,19 @@ et_init_rx_ring(struct et_softc *sc) } } + rxsd = &sc->sc_rx_status; bzero(rxsd->rxsd_status, sizeof(struct et_rxstatus)); bus_dmamap_sync(rxsd->rxsd_dtag, rxsd->rxsd_dmap, - BUS_DMASYNC_PREWRITE); + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + rxst_ring = &sc->sc_rxstat_ring; bzero(rxst_ring->rsr_stat, ET_RXSTAT_RING_SIZE); bus_dmamap_sync(rxst_ring->rsr_dtag, rxst_ring->rsr_dmap, - BUS_DMASYNC_PREWRITE); + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); return (0); } -static void -et_dma_buf_addr(void *xctx, bus_dma_segment_t *segs, int nsegs, - bus_size_t mapsz __unused, int error) -{ - struct et_dmamap_ctx *ctx = xctx; - int i; - - if (error) - return; - - if (nsegs > ctx->nsegs) { - ctx->nsegs = 0; - return; - } - - ctx->nsegs = nsegs; - for (i = 0; i < nsegs; ++i) - ctx->segs[i] = segs[i]; -} - static int et_init_rxdma(struct et_softc *sc) { @@ -1929,13 +1910,20 @@ et_enable_txrx(struct et_softc *sc, int static void et_rxeof(struct et_softc *sc) { - struct ifnet *ifp; struct et_rxstatus_data *rxsd; struct et_rxstat_ring *rxst_ring; - uint32_t rxs_stat_ring, rxst_info2; - int rxst_wrap, rxst_index; + struct et_rxbuf_data *rbd; + struct et_rxdesc_ring *rx_ring; + struct et_rxstat *st; + struct ifnet *ifp; + struct mbuf *m; + uint32_t rxstat_pos, rxring_pos; + uint32_t rxst_info1, rxst_info2, rxs_stat_ring; + int buflen, buf_idx, npost[2], ring_idx; + int rxst_index, rxst_wrap; ET_LOCK_ASSERT(sc); + ifp = sc->ifp; rxsd = &sc->sc_rx_status; rxst_ring = &sc->sc_rxstat_ring; @@ -1944,26 +1932,24 @@ et_rxeof(struct et_softc *sc) return; bus_dmamap_sync(rxsd->rxsd_dtag, rxsd->rxsd_dmap, - BUS_DMASYNC_POSTREAD); + BUS_DMASYNC_POSTREAD); bus_dmamap_sync(rxst_ring->rsr_dtag, rxst_ring->rsr_dmap, - BUS_DMASYNC_POSTREAD); + BUS_DMASYNC_POSTREAD); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 19:11:20 2012 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 B7405106564A; Fri, 6 Jan 2012 19:11:20 +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 9EC4C8FC16; Fri, 6 Jan 2012 19:11:20 +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 q06JBKHl003342; Fri, 6 Jan 2012 19:11:20 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06JBKWb003339; Fri, 6 Jan 2012 19:11:20 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201061911.q06JBKWb003339@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 6 Jan 2012 19:11:20 +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: r229718 - stable/8/sys/dev/et 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, 06 Jan 2012 19:11:20 -0000 Author: yongari Date: Fri Jan 6 19:11:20 2012 New Revision: 229718 URL: http://svn.freebsd.org/changeset/base/229718 Log: MFC r228325: Overhaul bus_dma(9) usage in et(4) and clean up TX/RX path. This change should make et(4) work on any architectures. o Remove m_getl inline function and replace it with stanard mbuf interfaces. Previous code tried to minimize code duplication but this came from incorrect use of common DMA tag. Driver may be still use a common RX allocation handler with additional structure changes but I don't see much point to do that it would make it hard to understand the code. o Remove DragonflyBSD specific constant EVL_ENCAPLEN, use ETHER_VLAN_ENCAP_LEN instead. o Add bunch of new RX status definition. It seems controller supports RX checksum offloading but I was not able to make the feature work yet. Currently driver checks whether recevied frame is good one or not. o Avoid a typedef ending in '_t' as style(9) says. o Controller has no restriction on DMA address space, so there is no reason to limit the DMA address to 32bit. Descriptor rings, status blocks and TX/RX buffers now use full 64bit DMA addressing. o Allocate DMA memory shared between host and controller as coherent. o Create 3 separate DMA tags to be used as TX, mini RX ring and stanard RX ring. Previously it created a single DMA tag and it was used to all three rings. o et(4) does not support jumbo frame at this moment and I still don't quite understand how jumbo frame works on this controller so use two RX rings to handle small sized frame and normal sized frame respectively. The mini RX ring will be used to receive frames that are less than or equal to 127 bytes. The second RX ring is used to receive frames that are not handled by the first RX ring. If jumbo frame support is implemented, driver may have to choose better RX scheme by letting the second RX ring handle jumbo frames. This scheme will mimic Broadcom's efficient jumbo frame handling feature. However RAM buffer size(16KB) of the controller is too small to hold 2 jumbo frames, if 9KB jumbo frame is used, I'm not sure how good performance would it have. o In et_rxeof(), make sure to check whether controller received good frame or not. Passing corrupted frame to upper layer is bad idea. o If driver receives a bad frame or driver fails to allocate RX buffer due to resource shortage condition, reuse previously loaded DMA map for RX buffer instead of unloading/loading RX buffer again. o et_init_tx_ring() never fails so change return type to void. o In watchdog handler, show TX DMA write back status of errored frame which could be used as a clue to debug watchdog timeout. o Add missing bus_dmamap_sync() in various places such that et(4) should work with bounce buffers(e.g. PAE). o TX side bus_dmamap_load_mbuf_sg(9) support. o RX side bus_dmamap_load_mbuf_sg(9) support. o Controller has no DMA alignment limit in RX buffer so use m_adj(9) in RX buffer allocation to make IP header align on 2 bytes boundary. Otherwise it would trigger unaligned access error in upper layer on strict alignment architectures. One of down side of controller is it provides limited set of RX buffer length like most Intel controllers. This is not problem at this moment because driver does not support jumbo frame yet but it may require alignment fixup code to support jumbo frame on strict alignment architectures. o In et_txeof(), don't zero TX descriptors for transmitted frames. TX descriptors don't need write access after transmission. Driver sets IFF_DRV_OACTIVE when the number of available TX descriptors are less than or equal to ET_NSEG_SPARE. Make sure to clear IFF_DRV_OACTIVE only when the number of available TX descriptor is greater than ET_NSEG_SPARE. Modified: stable/8/sys/dev/et/if_et.c stable/8/sys/dev/et/if_etvar.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/et/if_et.c ============================================================================== --- stable/8/sys/dev/et/if_et.c Fri Jan 6 19:09:47 2012 (r229717) +++ stable/8/sys/dev/et/if_et.c Fri Jan 6 19:11:20 2012 (r229718) @@ -100,7 +100,7 @@ static void et_init(void *); static int et_ioctl(struct ifnet *, u_long, caddr_t); static void et_start_locked(struct ifnet *); static void et_start(struct ifnet *); -static void et_watchdog(struct et_softc *); +static int et_watchdog(struct et_softc *); static int et_ifmedia_upd_locked(struct ifnet *); static int et_ifmedia_upd(struct ifnet *); static void et_ifmedia_sts(struct ifnet *, struct ifmediareq *); @@ -115,24 +115,22 @@ static void et_disable_intrs(struct et_s static void et_rxeof(struct et_softc *); static void et_txeof(struct et_softc *); -static int et_dma_alloc(device_t); -static void et_dma_free(device_t); -static int et_dma_mem_create(device_t, bus_size_t, bus_dma_tag_t *, - void **, bus_addr_t *, bus_dmamap_t *); -static void et_dma_mem_destroy(bus_dma_tag_t, void *, bus_dmamap_t); -static int et_dma_mbuf_create(device_t); -static void et_dma_mbuf_destroy(device_t, int, const int[]); -static void et_dma_ring_addr(void *, bus_dma_segment_t *, int, int); -static void et_dma_buf_addr(void *, bus_dma_segment_t *, int, - bus_size_t, int); -static int et_init_tx_ring(struct et_softc *); +static int et_dma_alloc(struct et_softc *); +static void et_dma_free(struct et_softc *); +static void et_dma_map_addr(void *, bus_dma_segment_t *, int, int); +static int et_dma_ring_alloc(struct et_softc *, bus_size_t, bus_size_t, + bus_dma_tag_t *, uint8_t **, bus_dmamap_t *, bus_addr_t *, + const char *); +static void et_dma_ring_free(struct et_softc *, bus_dma_tag_t *, uint8_t **, + bus_dmamap_t *); +static void et_init_tx_ring(struct et_softc *); static int et_init_rx_ring(struct et_softc *); static void et_free_tx_ring(struct et_softc *); static void et_free_rx_ring(struct et_softc *); static int et_encap(struct et_softc *, struct mbuf **); -static int et_newbuf(struct et_rxbuf_data *, int, int, int); -static int et_newbuf_cluster(struct et_rxbuf_data *, int, int); -static int et_newbuf_hdr(struct et_rxbuf_data *, int, int); +static int et_newbuf_cluster(struct et_rxbuf_data *, int); +static int et_newbuf_hdr(struct et_rxbuf_data *, int); +static void et_rxbuf_discard(struct et_rxbuf_data *, int); static void et_stop(struct et_softc *); static int et_chip_init(struct et_softc *); @@ -153,7 +151,6 @@ static void et_get_eaddr(device_t, uint8 static void et_setmulti(struct et_softc *); static void et_tick(void *); static void et_setmedia(struct et_softc *); -static void et_setup_rxdesc(struct et_rxbuf_data *, int, bus_addr_t); static const struct et_dev { uint16_t vid; @@ -206,18 +203,6 @@ TUNABLE_INT("hw.et.rx_intr_npkts", &et_r TUNABLE_INT("hw.et.rx_intr_delay", &et_rx_intr_delay); TUNABLE_INT("hw.et.tx_intr_nsegs", &et_tx_intr_nsegs); -struct et_bsize { - int bufsize; - et_newbuf_t newbuf; -}; - -static const struct et_bsize et_bufsize_std[ET_RX_NRING] = { - { .bufsize = ET_RXDMA_CTRL_RING0_128, - .newbuf = et_newbuf_hdr }, - { .bufsize = ET_RXDMA_CTRL_RING1_2048, - .newbuf = et_newbuf_cluster }, -}; - static int et_probe(device_t dev) { @@ -330,7 +315,7 @@ et_attach(device_t dev) et_disable_intrs(sc); - error = et_dma_alloc(dev); + error = et_dma_alloc(sc); if (error) goto fail; @@ -407,7 +392,7 @@ et_detach(device_t dev) if (sc->ifp != NULL) if_free(sc->ifp); - et_dma_free(dev); + et_dma_free(sc); mtx_destroy(&sc->sc_mtx); @@ -703,235 +688,250 @@ et_enable_intrs(struct et_softc *sc, uin CSR_WRITE_4(sc, ET_INTR_MASK, ~intrs); } +struct et_dmamap_arg { + bus_addr_t et_busaddr; +}; + +static void +et_dma_map_addr(void *arg, bus_dma_segment_t *segs, int nseg, int error) +{ + struct et_dmamap_arg *ctx; + + if (error) + return; + + KASSERT(nseg == 1, ("%s: %d segments returned!", __func__, nseg)); + + ctx = arg; + ctx->et_busaddr = segs->ds_addr; +} + static int -et_dma_alloc(device_t dev) +et_dma_ring_alloc(struct et_softc *sc, bus_size_t alignment, bus_size_t maxsize, + bus_dma_tag_t *tag, uint8_t **ring, bus_dmamap_t *map, bus_addr_t *paddr, + const char *msg) { - struct et_softc *sc = device_get_softc(dev); - struct et_txdesc_ring *tx_ring = &sc->sc_tx_ring; - struct et_txstatus_data *txsd = &sc->sc_tx_status; - struct et_rxstat_ring *rxst_ring = &sc->sc_rxstat_ring; - struct et_rxstatus_data *rxsd = &sc->sc_rx_status; - int i, error; + struct et_dmamap_arg ctx; + int error; - /* - * Create top level DMA tag - */ - error = bus_dma_tag_create(NULL, 1, 0, - BUS_SPACE_MAXADDR_32BIT, - BUS_SPACE_MAXADDR, - NULL, NULL, - MAXBSIZE, - BUS_SPACE_UNRESTRICTED, - BUS_SPACE_MAXSIZE_32BIT, - 0, NULL, NULL, &sc->sc_dtag); - if (error) { - device_printf(dev, "can't create DMA tag\n"); + error = bus_dma_tag_create(sc->sc_dtag, alignment, 0, BUS_SPACE_MAXADDR, + BUS_SPACE_MAXADDR, NULL, NULL, maxsize, 1, maxsize, 0, NULL, NULL, + tag); + if (error != 0) { + device_printf(sc->dev, "could not create %s dma tag\n", msg); return (error); } - - /* - * Create TX ring DMA stuffs - */ - error = et_dma_mem_create(dev, ET_TX_RING_SIZE, &tx_ring->tr_dtag, - (void **)&tx_ring->tr_desc, - &tx_ring->tr_paddr, &tx_ring->tr_dmap); - if (error) { - device_printf(dev, "can't create TX ring DMA stuffs\n"); + /* Allocate DMA'able memory for ring. */ + error = bus_dmamem_alloc(*tag, (void **)ring, + BUS_DMA_NOWAIT | BUS_DMA_ZERO | BUS_DMA_COHERENT, map); + if (error != 0) { + device_printf(sc->dev, + "could not allocate DMA'able memory for %s\n", msg); return (error); } - - /* - * Create TX status DMA stuffs - */ - error = et_dma_mem_create(dev, sizeof(uint32_t), &txsd->txsd_dtag, - (void **)&txsd->txsd_status, - &txsd->txsd_paddr, &txsd->txsd_dmap); - if (error) { - device_printf(dev, "can't create TX status DMA stuffs\n"); + /* Load the address of the ring. */ + ctx.et_busaddr = 0; + error = bus_dmamap_load(*tag, *map, *ring, maxsize, et_dma_map_addr, + &ctx, BUS_DMA_NOWAIT); + if (error != 0) { + device_printf(sc->dev, + "could not load DMA'able memory for %s\n", msg); return (error); } + *paddr = ctx.et_busaddr; + return (0); +} - /* - * Create DMA stuffs for RX rings - */ - for (i = 0; i < ET_RX_NRING; ++i) { - static const uint32_t rx_ring_posreg[ET_RX_NRING] = - { ET_RX_RING0_POS, ET_RX_RING1_POS }; - - struct et_rxdesc_ring *rx_ring = &sc->sc_rx_ring[i]; +static void +et_dma_ring_free(struct et_softc *sc, bus_dma_tag_t *tag, uint8_t **ring, + bus_dmamap_t *map) +{ - error = et_dma_mem_create(dev, ET_RX_RING_SIZE, - &rx_ring->rr_dtag, - (void **)&rx_ring->rr_desc, - &rx_ring->rr_paddr, - &rx_ring->rr_dmap); - if (error) { - device_printf(dev, "can't create DMA stuffs for " - "the %d RX ring\n", i); - return (error); - } - rx_ring->rr_posreg = rx_ring_posreg[i]; + if (*map != NULL) + bus_dmamap_unload(*tag, *map); + if (*map != NULL && *ring != NULL) { + bus_dmamem_free(*tag, *ring, *map); + *ring = NULL; + *map = NULL; } - - /* - * Create RX stat ring DMA stuffs - */ - error = et_dma_mem_create(dev, ET_RXSTAT_RING_SIZE, - &rxst_ring->rsr_dtag, - (void **)&rxst_ring->rsr_stat, - &rxst_ring->rsr_paddr, &rxst_ring->rsr_dmap); - if (error) { - device_printf(dev, "can't create RX stat ring DMA stuffs\n"); - return (error); + if (*tag) { + bus_dma_tag_destroy(*tag); + *tag = NULL; } +} - /* - * Create RX status DMA stuffs - */ - error = et_dma_mem_create(dev, sizeof(struct et_rxstatus), - &rxsd->rxsd_dtag, - (void **)&rxsd->rxsd_status, - &rxsd->rxsd_paddr, &rxsd->rxsd_dmap); - if (error) { - device_printf(dev, "can't create RX status DMA stuffs\n"); +static int +et_dma_alloc(struct et_softc *sc) +{ + struct et_txdesc_ring *tx_ring; + struct et_rxdesc_ring *rx_ring; + struct et_rxstat_ring *rxst_ring; + struct et_rxstatus_data *rxsd; + struct et_rxbuf_data *rbd; + struct et_txbuf_data *tbd; + struct et_txstatus_data *txsd; + int i, error; + + error = bus_dma_tag_create(bus_get_dma_tag(sc->dev), 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, + BUS_SPACE_MAXSIZE_32BIT, 0, BUS_SPACE_MAXSIZE_32BIT, 0, NULL, NULL, + &sc->sc_dtag); + if (error != 0) { + device_printf(sc->dev, "could not allocate parent dma tag\n"); return (error); } - /* - * Create mbuf DMA stuffs - */ - error = et_dma_mbuf_create(dev); + /* TX ring. */ + tx_ring = &sc->sc_tx_ring; + error = et_dma_ring_alloc(sc, ET_RING_ALIGN, ET_TX_RING_SIZE, + &tx_ring->tr_dtag, (uint8_t **)&tx_ring->tr_desc, &tx_ring->tr_dmap, + &tx_ring->tr_paddr, "TX ring"); if (error) return (error); - return (0); -} + /* TX status block. */ + txsd = &sc->sc_tx_status; + error = et_dma_ring_alloc(sc, ET_STATUS_ALIGN, sizeof(uint32_t), + &txsd->txsd_dtag, (uint8_t **)&txsd->txsd_status, &txsd->txsd_dmap, + &txsd->txsd_paddr, "TX status block"); + if (error) + return (error); -static void -et_dma_free(device_t dev) -{ - struct et_softc *sc = device_get_softc(dev); - struct et_txdesc_ring *tx_ring = &sc->sc_tx_ring; - struct et_txstatus_data *txsd = &sc->sc_tx_status; - struct et_rxstat_ring *rxst_ring = &sc->sc_rxstat_ring; - struct et_rxstatus_data *rxsd = &sc->sc_rx_status; - int i, rx_done[ET_RX_NRING]; + /* RX ring 0, used as to recive small sized frames. */ + rx_ring = &sc->sc_rx_ring[0]; + error = et_dma_ring_alloc(sc, ET_RING_ALIGN, ET_RX_RING_SIZE, + &rx_ring->rr_dtag, (uint8_t **)&rx_ring->rr_desc, &rx_ring->rr_dmap, + &rx_ring->rr_paddr, "RX ring 0"); + rx_ring->rr_posreg = ET_RX_RING0_POS; + if (error) + return (error); - /* - * Destroy TX ring DMA stuffs - */ - et_dma_mem_destroy(tx_ring->tr_dtag, tx_ring->tr_desc, - tx_ring->tr_dmap); + /* RX ring 1, used as to store normal sized frames. */ + rx_ring = &sc->sc_rx_ring[1]; + error = et_dma_ring_alloc(sc, ET_RING_ALIGN, ET_RX_RING_SIZE, + &rx_ring->rr_dtag, (uint8_t **)&rx_ring->rr_desc, &rx_ring->rr_dmap, + &rx_ring->rr_paddr, "RX ring 1"); + rx_ring->rr_posreg = ET_RX_RING1_POS; + if (error) + return (error); - /* - * Destroy TX status DMA stuffs - */ - et_dma_mem_destroy(txsd->txsd_dtag, txsd->txsd_status, - txsd->txsd_dmap); + /* RX stat ring. */ + rxst_ring = &sc->sc_rxstat_ring; + error = et_dma_ring_alloc(sc, ET_RING_ALIGN, ET_RXSTAT_RING_SIZE, + &rxst_ring->rsr_dtag, (uint8_t **)&rxst_ring->rsr_stat, + &rxst_ring->rsr_dmap, &rxst_ring->rsr_paddr, "RX stat ring"); + if (error) + return (error); - /* - * Destroy DMA stuffs for RX rings - */ - for (i = 0; i < ET_RX_NRING; ++i) { - struct et_rxdesc_ring *rx_ring = &sc->sc_rx_ring[i]; + /* RX status block. */ + rxsd = &sc->sc_rx_status; + error = et_dma_ring_alloc(sc, ET_STATUS_ALIGN, + sizeof(struct et_rxstatus), &rxsd->rxsd_dtag, + (uint8_t **)&rxsd->rxsd_status, &rxsd->rxsd_dmap, + &rxsd->rxsd_paddr, "RX status block"); + if (error) + return (error); - et_dma_mem_destroy(rx_ring->rr_dtag, rx_ring->rr_desc, - rx_ring->rr_dmap); + /* Create parent DMA tag for mbufs. */ + error = bus_dma_tag_create(bus_get_dma_tag(sc->dev), 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, + BUS_SPACE_MAXSIZE_32BIT, 0, BUS_SPACE_MAXSIZE_32BIT, 0, NULL, NULL, + &sc->sc_mbuf_dtag); + if (error != 0) { + device_printf(sc->dev, + "could not allocate parent dma tag for mbuf\n"); + return (error); } - /* - * Destroy RX stat ring DMA stuffs - */ - et_dma_mem_destroy(rxst_ring->rsr_dtag, rxst_ring->rsr_stat, - rxst_ring->rsr_dmap); - - /* - * Destroy RX status DMA stuffs - */ - et_dma_mem_destroy(rxsd->rxsd_dtag, rxsd->rxsd_status, - rxsd->rxsd_dmap); - - /* - * Destroy mbuf DMA stuffs - */ - for (i = 0; i < ET_RX_NRING; ++i) - rx_done[i] = ET_RX_NDESC; - et_dma_mbuf_destroy(dev, ET_TX_NDESC, rx_done); - - /* - * Destroy top level DMA tag - */ - if (sc->sc_dtag != NULL) - bus_dma_tag_destroy(sc->sc_dtag); -} - -static int -et_dma_mbuf_create(device_t dev) -{ - struct et_softc *sc = device_get_softc(dev); - struct et_txbuf_data *tbd = &sc->sc_tx_data; - int i, error, rx_done[ET_RX_NRING]; + /* Create DMA tag for mini RX mbufs to use RX ring 0. */ + error = bus_dma_tag_create(sc->sc_mbuf_dtag, 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, MHLEN, 1, + MHLEN, 0, NULL, NULL, &sc->sc_rx_mini_tag); + if (error) { + device_printf(sc->dev, "could not create mini RX dma tag\n"); + return (error); + } - /* - * Create mbuf DMA tag - */ - error = bus_dma_tag_create(sc->sc_dtag, 1, 0, - BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, - NULL, NULL, - ET_JUMBO_FRAMELEN, ET_NSEG_MAX, - BUS_SPACE_MAXSIZE_32BIT, - BUS_DMA_ALLOCNOW, NULL, NULL, &sc->sc_mbuf_dtag); + /* Create DMA tag for standard RX mbufs to use RX ring 1. */ + error = bus_dma_tag_create(sc->sc_mbuf_dtag, 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES, 1, + MCLBYTES, 0, NULL, NULL, &sc->sc_rx_tag); if (error) { - device_printf(dev, "can't create mbuf DMA tag\n"); + device_printf(sc->dev, "could not create RX dma tag\n"); return (error); } - /* - * Create spare DMA map for RX mbufs - */ - error = bus_dmamap_create(sc->sc_mbuf_dtag, 0, &sc->sc_mbuf_tmp_dmap); + /* Create DMA tag for TX mbufs. */ + error = bus_dma_tag_create(sc->sc_mbuf_dtag, 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, + MCLBYTES * ET_NSEG_MAX, ET_NSEG_MAX, MCLBYTES, 0, NULL, NULL, + &sc->sc_tx_tag); if (error) { - device_printf(dev, "can't create spare mbuf DMA map\n"); - bus_dma_tag_destroy(sc->sc_mbuf_dtag); - sc->sc_mbuf_dtag = NULL; + device_printf(sc->dev, "could not create TX dma tag\n"); return (error); } - /* - * Create DMA maps for RX mbufs - */ - bzero(rx_done, sizeof(rx_done)); - for (i = 0; i < ET_RX_NRING; ++i) { - struct et_rxbuf_data *rbd = &sc->sc_rx_data[i]; - int j; + /* Initialize RX ring 0. */ + rbd = &sc->sc_rx_data[0]; + rbd->rbd_bufsize = ET_RXDMA_CTRL_RING0_128; + rbd->rbd_newbuf = et_newbuf_hdr; + rbd->rbd_discard = et_rxbuf_discard; + rbd->rbd_softc = sc; + rbd->rbd_ring = &sc->sc_rx_ring[0]; + /* Create DMA maps for mini RX buffers, ring 0. */ + for (i = 0; i < ET_RX_NDESC; i++) { + error = bus_dmamap_create(sc->sc_rx_mini_tag, 0, + &rbd->rbd_buf[i].rb_dmap); + if (error) { + device_printf(sc->dev, + "could not create DMA map for mini RX mbufs\n"); + return (error); + } + } - for (j = 0; j < ET_RX_NDESC; ++j) { - error = bus_dmamap_create(sc->sc_mbuf_dtag, 0, - &rbd->rbd_buf[j].rb_dmap); - if (error) { - device_printf(dev, "can't create %d RX mbuf " - "for %d RX ring\n", j, i); - rx_done[i] = j; - et_dma_mbuf_destroy(dev, 0, rx_done); - return (error); - } + /* Create a spare DMA map for mini RX buffers, ring 0. */ + error = bus_dmamap_create(sc->sc_rx_mini_tag, 0, + &sc->sc_rx_mini_sparemap); + if (error) { + device_printf(sc->dev, + "could not create spare DMA map for mini RX mbuf\n"); + return (error); + } + + /* Initialize RX ring 1. */ + rbd = &sc->sc_rx_data[1]; + rbd->rbd_bufsize = ET_RXDMA_CTRL_RING1_2048; + rbd->rbd_newbuf = et_newbuf_cluster; + rbd->rbd_discard = et_rxbuf_discard; + rbd->rbd_softc = sc; + rbd->rbd_ring = &sc->sc_rx_ring[1]; + /* Create DMA maps for standard RX buffers, ring 1. */ + for (i = 0; i < ET_RX_NDESC; i++) { + error = bus_dmamap_create(sc->sc_rx_tag, 0, + &rbd->rbd_buf[i].rb_dmap); + if (error) { + device_printf(sc->dev, + "could not create DMA map for mini RX mbufs\n"); + return (error); } - rx_done[i] = ET_RX_NDESC; + } - rbd->rbd_softc = sc; - rbd->rbd_ring = &sc->sc_rx_ring[i]; + /* Create a spare DMA map for standard RX buffers, ring 1. */ + error = bus_dmamap_create(sc->sc_rx_tag, 0, &sc->sc_rx_sparemap); + if (error) { + device_printf(sc->dev, + "could not create spare DMA map for RX mbuf\n"); + return (error); } - /* - * Create DMA maps for TX mbufs - */ - for (i = 0; i < ET_TX_NDESC; ++i) { - error = bus_dmamap_create(sc->sc_mbuf_dtag, 0, - &tbd->tbd_buf[i].tb_dmap); + /* Create DMA maps for TX buffers. */ + tbd = &sc->sc_tx_data; + for (i = 0; i < ET_TX_NDESC; i++) { + error = bus_dmamap_create(sc->sc_tx_tag, 0, + &tbd->tbd_buf[i].tb_dmap); if (error) { - device_printf(dev, "can't create %d TX mbuf " - "DMA map\n", i); - et_dma_mbuf_destroy(dev, i, rx_done); + device_printf(sc->dev, + "could not create DMA map for TX mbufs\n"); return (error); } } @@ -940,106 +940,97 @@ et_dma_mbuf_create(device_t dev) } static void -et_dma_mbuf_destroy(device_t dev, int tx_done, const int rx_done[]) +et_dma_free(struct et_softc *sc) { - struct et_softc *sc = device_get_softc(dev); - struct et_txbuf_data *tbd = &sc->sc_tx_data; + struct et_txdesc_ring *tx_ring; + struct et_rxdesc_ring *rx_ring; + struct et_txstatus_data *txsd; + struct et_rxstat_ring *rxst_ring; + struct et_rxstatus_data *rxsd; + struct et_rxbuf_data *rbd; + struct et_txbuf_data *tbd; int i; - if (sc->sc_mbuf_dtag == NULL) - return; - - /* - * Destroy DMA maps for RX mbufs - */ - for (i = 0; i < ET_RX_NRING; ++i) { - struct et_rxbuf_data *rbd = &sc->sc_rx_data[i]; - int j; - - for (j = 0; j < rx_done[i]; ++j) { - struct et_rxbuf *rb = &rbd->rbd_buf[j]; - - KASSERT(rb->rb_mbuf == NULL, - ("RX mbuf in %d RX ring is not freed yet\n", i)); - bus_dmamap_destroy(sc->sc_mbuf_dtag, rb->rb_dmap); + /* Destroy DMA maps for mini RX buffers, ring 0. */ + rbd = &sc->sc_rx_data[0]; + for (i = 0; i < ET_RX_NDESC; i++) { + if (rbd->rbd_buf[i].rb_dmap) { + bus_dmamap_destroy(sc->sc_rx_mini_tag, + rbd->rbd_buf[i].rb_dmap); + rbd->rbd_buf[i].rb_dmap = NULL; } } - - /* - * Destroy DMA maps for TX mbufs - */ - for (i = 0; i < tx_done; ++i) { - struct et_txbuf *tb = &tbd->tbd_buf[i]; - - KASSERT(tb->tb_mbuf == NULL, ("TX mbuf is not freed yet\n")); - bus_dmamap_destroy(sc->sc_mbuf_dtag, tb->tb_dmap); + if (sc->sc_rx_mini_sparemap) { + bus_dmamap_destroy(sc->sc_rx_mini_tag, sc->sc_rx_mini_sparemap); + sc->sc_rx_mini_sparemap = NULL; } - - /* - * Destroy spare mbuf DMA map - */ - bus_dmamap_destroy(sc->sc_mbuf_dtag, sc->sc_mbuf_tmp_dmap); - - /* - * Destroy mbuf DMA tag - */ - bus_dma_tag_destroy(sc->sc_mbuf_dtag); - sc->sc_mbuf_dtag = NULL; -} - -static int -et_dma_mem_create(device_t dev, bus_size_t size, bus_dma_tag_t *dtag, - void **addr, bus_addr_t *paddr, bus_dmamap_t *dmap) -{ - struct et_softc *sc = device_get_softc(dev); - int error; - - error = bus_dma_tag_create(sc->sc_dtag, ET_ALIGN, 0, - BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, - NULL, NULL, - size, 1, BUS_SPACE_MAXSIZE_32BIT, - 0, NULL, NULL, dtag); - if (error) { - device_printf(dev, "can't create DMA tag\n"); - return (error); + if (sc->sc_rx_mini_tag) { + bus_dma_tag_destroy(sc->sc_rx_mini_tag); + sc->sc_rx_mini_tag = NULL; } - error = bus_dmamem_alloc(*dtag, addr, BUS_DMA_WAITOK | BUS_DMA_ZERO, - dmap); - if (error) { - device_printf(dev, "can't allocate DMA mem\n"); - bus_dma_tag_destroy(*dtag); - *dtag = NULL; - return (error); + /* Destroy DMA maps for standard RX buffers, ring 1. */ + rbd = &sc->sc_rx_data[1]; + for (i = 0; i < ET_RX_NDESC; i++) { + if (rbd->rbd_buf[i].rb_dmap) { + bus_dmamap_destroy(sc->sc_rx_tag, + rbd->rbd_buf[i].rb_dmap); + rbd->rbd_buf[i].rb_dmap = NULL; + } } - - error = bus_dmamap_load(*dtag, *dmap, *addr, size, - et_dma_ring_addr, paddr, BUS_DMA_WAITOK); - if (error) { - device_printf(dev, "can't load DMA mem\n"); - bus_dmamem_free(*dtag, *addr, *dmap); - bus_dma_tag_destroy(*dtag); - *dtag = NULL; - return (error); + if (sc->sc_rx_sparemap) { + bus_dmamap_destroy(sc->sc_rx_tag, sc->sc_rx_sparemap); + sc->sc_rx_sparemap = NULL; + } + if (sc->sc_rx_tag) { + bus_dma_tag_destroy(sc->sc_rx_tag); + sc->sc_rx_tag = NULL; } - return (0); -} -static void -et_dma_mem_destroy(bus_dma_tag_t dtag, void *addr, bus_dmamap_t dmap) -{ - if (dtag != NULL) { - bus_dmamap_unload(dtag, dmap); - bus_dmamem_free(dtag, addr, dmap); - bus_dma_tag_destroy(dtag); + /* Destroy DMA maps for TX buffers. */ + tbd = &sc->sc_tx_data; + for (i = 0; i < ET_TX_NDESC; i++) { + if (tbd->tbd_buf[i].tb_dmap) { + bus_dmamap_destroy(sc->sc_tx_tag, + tbd->tbd_buf[i].tb_dmap); + tbd->tbd_buf[i].tb_dmap = NULL; + } + } + if (sc->sc_tx_tag) { + bus_dma_tag_destroy(sc->sc_tx_tag); + sc->sc_tx_tag = NULL; } -} -static void -et_dma_ring_addr(void *arg, bus_dma_segment_t *seg, int nseg, int error) -{ - KASSERT(nseg == 1, ("too many segments\n")); - *((bus_addr_t *)arg) = seg->ds_addr; + /* Destroy mini RX ring, ring 0. */ + rx_ring = &sc->sc_rx_ring[0]; + et_dma_ring_free(sc, &rx_ring->rr_dtag, (void *)&rx_ring->rr_desc, + &rx_ring->rr_dmap); + /* Destroy standard RX ring, ring 1. */ + rx_ring = &sc->sc_rx_ring[1]; + et_dma_ring_free(sc, &rx_ring->rr_dtag, (void *)&rx_ring->rr_desc, + &rx_ring->rr_dmap); + /* Destroy RX stat ring. */ + rxst_ring = &sc->sc_rxstat_ring; + et_dma_ring_free(sc, &rxst_ring->rsr_dtag, (void *)&rxst_ring->rsr_stat, + &rxst_ring->rsr_dmap); + /* Destroy RX status block. */ + rxsd = &sc->sc_rx_status; + et_dma_ring_free(sc, &rxst_ring->rsr_dtag, (void *)&rxst_ring->rsr_stat, + &rxst_ring->rsr_dmap); + /* Destroy TX ring. */ + tx_ring = &sc->sc_tx_ring; + et_dma_ring_free(sc, &tx_ring->tr_dtag, (void *)&tx_ring->tr_desc, + &tx_ring->tr_dmap); + /* Destroy TX status block. */ + txsd = &sc->sc_tx_status; + et_dma_ring_free(sc, &txsd->txsd_dtag, (void *)&txsd->txsd_status, + &txsd->txsd_dmap); + + /* Destroy the parent tag. */ + if (sc->sc_dtag) { + bus_dma_tag_destroy(sc->sc_dtag); + sc->sc_dtag = NULL; + } } static void @@ -1117,30 +1108,21 @@ back: static void et_init_locked(struct et_softc *sc) { - struct ifnet *ifp = sc->ifp; - const struct et_bsize *arr; - int error, i; + struct ifnet *ifp; + int error; ET_LOCK_ASSERT(sc); + ifp = sc->ifp; if (ifp->if_drv_flags & IFF_DRV_RUNNING) return; et_stop(sc); - arr = et_bufsize_std; - for (i = 0; i < ET_RX_NRING; ++i) { - sc->sc_rx_data[i].rbd_bufsize = arr[i].bufsize; - sc->sc_rx_data[i].rbd_newbuf = arr[i].newbuf; - } - - error = et_init_tx_ring(sc); - if (error) - goto back; - + et_init_tx_ring(sc); error = et_init_rx_ring(sc); if (error) - goto back; + return; error = et_chip_init(sc); if (error) @@ -1313,20 +1295,26 @@ et_start(struct ifnet *ifp) ET_UNLOCK(sc); } -static void +static int et_watchdog(struct et_softc *sc) { + uint32_t status; + ET_LOCK_ASSERT(sc); if (sc->watchdog_timer == 0 || --sc->watchdog_timer) - return; + return (0); - if_printf(sc->ifp, "watchdog timed out\n"); + bus_dmamap_sync(sc->sc_tx_status.txsd_dtag, sc->sc_tx_status.txsd_dmap, + BUS_DMASYNC_POSTREAD); + status = le32toh(*(sc->sc_tx_status.txsd_status)); + if_printf(sc->ifp, "watchdog timed out (0x%08x) -- resetting\n", + status); sc->ifp->if_oerrors++; sc->ifp->if_drv_flags &= ~IFF_DRV_RUNNING; et_init_locked(sc); - et_start_locked(sc->ifp); + return (EJUSTRETURN); } static int @@ -1354,49 +1342,59 @@ et_stop_txdma(struct et_softc *sc) static void et_free_tx_ring(struct et_softc *sc) { - struct et_txbuf_data *tbd = &sc->sc_tx_data; - struct et_txdesc_ring *tx_ring = &sc->sc_tx_ring; + struct et_txdesc_ring *tx_ring; + struct et_txbuf_data *tbd; + struct et_txbuf *tb; int i; + tbd = &sc->sc_tx_data; + tx_ring = &sc->sc_tx_ring; for (i = 0; i < ET_TX_NDESC; ++i) { - struct et_txbuf *tb = &tbd->tbd_buf[i]; - + tb = &tbd->tbd_buf[i]; if (tb->tb_mbuf != NULL) { + bus_dmamap_sync(sc->sc_tx_tag, tb->tb_dmap, + BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(sc->sc_mbuf_dtag, tb->tb_dmap); m_freem(tb->tb_mbuf); tb->tb_mbuf = NULL; } } - - bzero(tx_ring->tr_desc, ET_TX_RING_SIZE); - bus_dmamap_sync(tx_ring->tr_dtag, tx_ring->tr_dmap, - BUS_DMASYNC_PREWRITE); } static void et_free_rx_ring(struct et_softc *sc) { - int n; - - for (n = 0; n < ET_RX_NRING; ++n) { - struct et_rxbuf_data *rbd = &sc->sc_rx_data[n]; - struct et_rxdesc_ring *rx_ring = &sc->sc_rx_ring[n]; - int i; - - for (i = 0; i < ET_RX_NDESC; ++i) { - struct et_rxbuf *rb = &rbd->rbd_buf[i]; + struct et_rxbuf_data *rbd; + struct et_rxdesc_ring *rx_ring; + struct et_rxbuf *rb; + int i; - if (rb->rb_mbuf != NULL) { - bus_dmamap_unload(sc->sc_mbuf_dtag, - rb->rb_dmap); - m_freem(rb->rb_mbuf); - rb->rb_mbuf = NULL; - } + /* Ring 0 */ + rx_ring = &sc->sc_rx_ring[0]; + rbd = &sc->sc_rx_data[0]; + for (i = 0; i < ET_RX_NDESC; ++i) { + rb = &rbd->rbd_buf[i]; + if (rb->rb_mbuf != NULL) { + bus_dmamap_sync(sc->sc_rx_mini_tag, rx_ring->rr_dmap, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->sc_rx_mini_tag, rb->rb_dmap); + m_freem(rb->rb_mbuf); + rb->rb_mbuf = NULL; } + } - bzero(rx_ring->rr_desc, ET_RX_RING_SIZE); - bus_dmamap_sync(rx_ring->rr_dtag, rx_ring->rr_dmap, - BUS_DMASYNC_PREWRITE); + /* Ring 1 */ + rx_ring = &sc->sc_rx_ring[1]; + rbd = &sc->sc_rx_data[1]; + for (i = 0; i < ET_RX_NDESC; ++i) { + rb = &rbd->rbd_buf[i]; + if (rb->rb_mbuf != NULL) { + bus_dmamap_sync(sc->sc_rx_tag, rx_ring->rr_dmap, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->sc_rx_tag, rb->rb_dmap); + m_freem(rb->rb_mbuf); + rb->rb_mbuf = NULL; + } } } @@ -1523,40 +1521,41 @@ et_chip_init(struct et_softc *sc) return (0); } -static int +static void et_init_tx_ring(struct et_softc *sc) { - struct et_txdesc_ring *tx_ring = &sc->sc_tx_ring; - struct et_txstatus_data *txsd = &sc->sc_tx_status; - struct et_txbuf_data *tbd = &sc->sc_tx_data; + struct et_txdesc_ring *tx_ring; + struct et_txbuf_data *tbd; + struct et_txstatus_data *txsd; + tx_ring = &sc->sc_tx_ring; bzero(tx_ring->tr_desc, ET_TX_RING_SIZE); bus_dmamap_sync(tx_ring->tr_dtag, tx_ring->tr_dmap, - BUS_DMASYNC_PREWRITE); + BUS_DMASYNC_PREWRITE); + tbd = &sc->sc_tx_data; tbd->tbd_start_index = 0; tbd->tbd_start_wrap = 0; tbd->tbd_used = 0; + txsd = &sc->sc_tx_status; bzero(txsd->txsd_status, sizeof(uint32_t)); bus_dmamap_sync(txsd->txsd_dtag, txsd->txsd_dmap, - BUS_DMASYNC_PREWRITE); - return (0); + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); } static int et_init_rx_ring(struct et_softc *sc) { - struct et_rxstatus_data *rxsd = &sc->sc_rx_status; - struct et_rxstat_ring *rxst_ring = &sc->sc_rxstat_ring; - int n; + struct et_rxstatus_data *rxsd; + struct et_rxstat_ring *rxst_ring; + struct et_rxbuf_data *rbd; + int i, error, n; for (n = 0; n < ET_RX_NRING; ++n) { - struct et_rxbuf_data *rbd = &sc->sc_rx_data[n]; - int i, error; - + rbd = &sc->sc_rx_data[n]; for (i = 0; i < ET_RX_NDESC; ++i) { - error = rbd->rbd_newbuf(rbd, i, 1); + error = rbd->rbd_newbuf(rbd, i); if (error) { if_printf(sc->ifp, "%d ring %d buf, " "newbuf failed: %d\n", n, i, error); @@ -1565,37 +1564,19 @@ et_init_rx_ring(struct et_softc *sc) } } + rxsd = &sc->sc_rx_status; bzero(rxsd->rxsd_status, sizeof(struct et_rxstatus)); bus_dmamap_sync(rxsd->rxsd_dtag, rxsd->rxsd_dmap, - BUS_DMASYNC_PREWRITE); + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + rxst_ring = &sc->sc_rxstat_ring; bzero(rxst_ring->rsr_stat, ET_RXSTAT_RING_SIZE); bus_dmamap_sync(rxst_ring->rsr_dtag, rxst_ring->rsr_dmap, - BUS_DMASYNC_PREWRITE); + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); return (0); } -static void -et_dma_buf_addr(void *xctx, bus_dma_segment_t *segs, int nsegs, - bus_size_t mapsz __unused, int error) -{ - struct et_dmamap_ctx *ctx = xctx; - int i; - - if (error) - return; - - if (nsegs > ctx->nsegs) { - ctx->nsegs = 0; - return; - } - - ctx->nsegs = nsegs; - for (i = 0; i < nsegs; ++i) - ctx->segs[i] = segs[i]; -} - static int et_init_rxdma(struct et_softc *sc) { @@ -1933,13 +1914,20 @@ et_enable_txrx(struct et_softc *sc, int static void et_rxeof(struct et_softc *sc) { - struct ifnet *ifp; struct et_rxstatus_data *rxsd; struct et_rxstat_ring *rxst_ring; - uint32_t rxs_stat_ring, rxst_info2; - int rxst_wrap, rxst_index; + struct et_rxbuf_data *rbd; + struct et_rxdesc_ring *rx_ring; + struct et_rxstat *st; + struct ifnet *ifp; + struct mbuf *m; + uint32_t rxstat_pos, rxring_pos; + uint32_t rxst_info1, rxst_info2, rxs_stat_ring; + int buflen, buf_idx, npost[2], ring_idx; + int rxst_index, rxst_wrap; ET_LOCK_ASSERT(sc); + ifp = sc->ifp; rxsd = &sc->sc_rx_status; rxst_ring = &sc->sc_rxstat_ring; @@ -1948,26 +1936,24 @@ et_rxeof(struct et_softc *sc) return; bus_dmamap_sync(rxsd->rxsd_dtag, rxsd->rxsd_dmap, - BUS_DMASYNC_POSTREAD); + BUS_DMASYNC_POSTREAD); bus_dmamap_sync(rxst_ring->rsr_dtag, rxst_ring->rsr_dmap, - BUS_DMASYNC_POSTREAD); + BUS_DMASYNC_POSTREAD); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 19:12:48 2012 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 82CF81065675; Fri, 6 Jan 2012 19:12:48 +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 6B8D58FC17; Fri, 6 Jan 2012 19:12:48 +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 q06JCmbu003419; Fri, 6 Jan 2012 19:12:48 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06JCmDx003416; Fri, 6 Jan 2012 19:12:48 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201061912.q06JCmDx003416@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 6 Jan 2012 19:12:48 +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: r229719 - stable/7/sys/dev/et 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, 06 Jan 2012 19:12:48 -0000 Author: yongari Date: Fri Jan 6 19:12:47 2012 New Revision: 229719 URL: http://svn.freebsd.org/changeset/base/229719 Log: MFC r228325: Overhaul bus_dma(9) usage in et(4) and clean up TX/RX path. This change should make et(4) work on any architectures. o Remove m_getl inline function and replace it with stanard mbuf interfaces. Previous code tried to minimize code duplication but this came from incorrect use of common DMA tag. Driver may be still use a common RX allocation handler with additional structure changes but I don't see much point to do that it would make it hard to understand the code. o Remove DragonflyBSD specific constant EVL_ENCAPLEN, use ETHER_VLAN_ENCAP_LEN instead. o Add bunch of new RX status definition. It seems controller supports RX checksum offloading but I was not able to make the feature work yet. Currently driver checks whether recevied frame is good one or not. o Avoid a typedef ending in '_t' as style(9) says. o Controller has no restriction on DMA address space, so there is no reason to limit the DMA address to 32bit. Descriptor rings, status blocks and TX/RX buffers now use full 64bit DMA addressing. o Allocate DMA memory shared between host and controller as coherent. o Create 3 separate DMA tags to be used as TX, mini RX ring and stanard RX ring. Previously it created a single DMA tag and it was used to all three rings. o et(4) does not support jumbo frame at this moment and I still don't quite understand how jumbo frame works on this controller so use two RX rings to handle small sized frame and normal sized frame respectively. The mini RX ring will be used to receive frames that are less than or equal to 127 bytes. The second RX ring is used to receive frames that are not handled by the first RX ring. If jumbo frame support is implemented, driver may have to choose better RX scheme by letting the second RX ring handle jumbo frames. This scheme will mimic Broadcom's efficient jumbo frame handling feature. However RAM buffer size(16KB) of the controller is too small to hold 2 jumbo frames, if 9KB jumbo frame is used, I'm not sure how good performance would it have. o In et_rxeof(), make sure to check whether controller received good frame or not. Passing corrupted frame to upper layer is bad idea. o If driver receives a bad frame or driver fails to allocate RX buffer due to resource shortage condition, reuse previously loaded DMA map for RX buffer instead of unloading/loading RX buffer again. o et_init_tx_ring() never fails so change return type to void. o In watchdog handler, show TX DMA write back status of errored frame which could be used as a clue to debug watchdog timeout. o Add missing bus_dmamap_sync() in various places such that et(4) should work with bounce buffers(e.g. PAE). o TX side bus_dmamap_load_mbuf_sg(9) support. o RX side bus_dmamap_load_mbuf_sg(9) support. o Controller has no DMA alignment limit in RX buffer so use m_adj(9) in RX buffer allocation to make IP header align on 2 bytes boundary. Otherwise it would trigger unaligned access error in upper layer on strict alignment architectures. One of down side of controller is it provides limited set of RX buffer length like most Intel controllers. This is not problem at this moment because driver does not support jumbo frame yet but it may require alignment fixup code to support jumbo frame on strict alignment architectures. o In et_txeof(), don't zero TX descriptors for transmitted frames. TX descriptors don't need write access after transmission. Driver sets IFF_DRV_OACTIVE when the number of available TX descriptors are less than or equal to ET_NSEG_SPARE. Make sure to clear IFF_DRV_OACTIVE only when the number of available TX descriptor is greater than ET_NSEG_SPARE. Modified: stable/7/sys/dev/et/if_et.c stable/7/sys/dev/et/if_etvar.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/et/if_et.c ============================================================================== --- stable/7/sys/dev/et/if_et.c Fri Jan 6 19:11:20 2012 (r229718) +++ stable/7/sys/dev/et/if_et.c Fri Jan 6 19:12:47 2012 (r229719) @@ -100,7 +100,7 @@ static void et_init(void *); static int et_ioctl(struct ifnet *, u_long, caddr_t); static void et_start_locked(struct ifnet *); static void et_start(struct ifnet *); -static void et_watchdog(struct et_softc *); +static int et_watchdog(struct et_softc *); static int et_ifmedia_upd_locked(struct ifnet *); static int et_ifmedia_upd(struct ifnet *); static void et_ifmedia_sts(struct ifnet *, struct ifmediareq *); @@ -115,24 +115,22 @@ static void et_disable_intrs(struct et_s static void et_rxeof(struct et_softc *); static void et_txeof(struct et_softc *); -static int et_dma_alloc(device_t); -static void et_dma_free(device_t); -static int et_dma_mem_create(device_t, bus_size_t, bus_dma_tag_t *, - void **, bus_addr_t *, bus_dmamap_t *); -static void et_dma_mem_destroy(bus_dma_tag_t, void *, bus_dmamap_t); -static int et_dma_mbuf_create(device_t); -static void et_dma_mbuf_destroy(device_t, int, const int[]); -static void et_dma_ring_addr(void *, bus_dma_segment_t *, int, int); -static void et_dma_buf_addr(void *, bus_dma_segment_t *, int, - bus_size_t, int); -static int et_init_tx_ring(struct et_softc *); +static int et_dma_alloc(struct et_softc *); +static void et_dma_free(struct et_softc *); +static void et_dma_map_addr(void *, bus_dma_segment_t *, int, int); +static int et_dma_ring_alloc(struct et_softc *, bus_size_t, bus_size_t, + bus_dma_tag_t *, uint8_t **, bus_dmamap_t *, bus_addr_t *, + const char *); +static void et_dma_ring_free(struct et_softc *, bus_dma_tag_t *, uint8_t **, + bus_dmamap_t *); +static void et_init_tx_ring(struct et_softc *); static int et_init_rx_ring(struct et_softc *); static void et_free_tx_ring(struct et_softc *); static void et_free_rx_ring(struct et_softc *); static int et_encap(struct et_softc *, struct mbuf **); -static int et_newbuf(struct et_rxbuf_data *, int, int, int); -static int et_newbuf_cluster(struct et_rxbuf_data *, int, int); -static int et_newbuf_hdr(struct et_rxbuf_data *, int, int); +static int et_newbuf_cluster(struct et_rxbuf_data *, int); +static int et_newbuf_hdr(struct et_rxbuf_data *, int); +static void et_rxbuf_discard(struct et_rxbuf_data *, int); static void et_stop(struct et_softc *); static int et_chip_init(struct et_softc *); @@ -153,7 +151,6 @@ static void et_get_eaddr(device_t, uint8 static void et_setmulti(struct et_softc *); static void et_tick(void *); static void et_setmedia(struct et_softc *); -static void et_setup_rxdesc(struct et_rxbuf_data *, int, bus_addr_t); static const struct et_dev { uint16_t vid; @@ -206,18 +203,6 @@ TUNABLE_INT("hw.et.rx_intr_npkts", &et_r TUNABLE_INT("hw.et.rx_intr_delay", &et_rx_intr_delay); TUNABLE_INT("hw.et.tx_intr_nsegs", &et_tx_intr_nsegs); -struct et_bsize { - int bufsize; - et_newbuf_t newbuf; -}; - -static const struct et_bsize et_bufsize_std[ET_RX_NRING] = { - { .bufsize = ET_RXDMA_CTRL_RING0_128, - .newbuf = et_newbuf_hdr }, - { .bufsize = ET_RXDMA_CTRL_RING1_2048, - .newbuf = et_newbuf_cluster }, -}; - static int et_probe(device_t dev) { @@ -330,7 +315,7 @@ et_attach(device_t dev) et_disable_intrs(sc); - error = et_dma_alloc(dev); + error = et_dma_alloc(sc); if (error) goto fail; @@ -407,7 +392,7 @@ et_detach(device_t dev) if (sc->ifp != NULL) if_free(sc->ifp); - et_dma_free(dev); + et_dma_free(sc); mtx_destroy(&sc->sc_mtx); @@ -703,235 +688,250 @@ et_enable_intrs(struct et_softc *sc, uin CSR_WRITE_4(sc, ET_INTR_MASK, ~intrs); } +struct et_dmamap_arg { + bus_addr_t et_busaddr; +}; + +static void +et_dma_map_addr(void *arg, bus_dma_segment_t *segs, int nseg, int error) +{ + struct et_dmamap_arg *ctx; + + if (error) + return; + + KASSERT(nseg == 1, ("%s: %d segments returned!", __func__, nseg)); + + ctx = arg; + ctx->et_busaddr = segs->ds_addr; +} + static int -et_dma_alloc(device_t dev) +et_dma_ring_alloc(struct et_softc *sc, bus_size_t alignment, bus_size_t maxsize, + bus_dma_tag_t *tag, uint8_t **ring, bus_dmamap_t *map, bus_addr_t *paddr, + const char *msg) { - struct et_softc *sc = device_get_softc(dev); - struct et_txdesc_ring *tx_ring = &sc->sc_tx_ring; - struct et_txstatus_data *txsd = &sc->sc_tx_status; - struct et_rxstat_ring *rxst_ring = &sc->sc_rxstat_ring; - struct et_rxstatus_data *rxsd = &sc->sc_rx_status; - int i, error; + struct et_dmamap_arg ctx; + int error; - /* - * Create top level DMA tag - */ - error = bus_dma_tag_create(NULL, 1, 0, - BUS_SPACE_MAXADDR_32BIT, - BUS_SPACE_MAXADDR, - NULL, NULL, - MAXBSIZE, - BUS_SPACE_UNRESTRICTED, - BUS_SPACE_MAXSIZE_32BIT, - 0, NULL, NULL, &sc->sc_dtag); - if (error) { - device_printf(dev, "can't create DMA tag\n"); + error = bus_dma_tag_create(sc->sc_dtag, alignment, 0, BUS_SPACE_MAXADDR, + BUS_SPACE_MAXADDR, NULL, NULL, maxsize, 1, maxsize, 0, NULL, NULL, + tag); + if (error != 0) { + device_printf(sc->dev, "could not create %s dma tag\n", msg); return (error); } - - /* - * Create TX ring DMA stuffs - */ - error = et_dma_mem_create(dev, ET_TX_RING_SIZE, &tx_ring->tr_dtag, - (void **)&tx_ring->tr_desc, - &tx_ring->tr_paddr, &tx_ring->tr_dmap); - if (error) { - device_printf(dev, "can't create TX ring DMA stuffs\n"); + /* Allocate DMA'able memory for ring. */ + error = bus_dmamem_alloc(*tag, (void **)ring, + BUS_DMA_NOWAIT | BUS_DMA_ZERO | BUS_DMA_COHERENT, map); + if (error != 0) { + device_printf(sc->dev, + "could not allocate DMA'able memory for %s\n", msg); return (error); } - - /* - * Create TX status DMA stuffs - */ - error = et_dma_mem_create(dev, sizeof(uint32_t), &txsd->txsd_dtag, - (void **)&txsd->txsd_status, - &txsd->txsd_paddr, &txsd->txsd_dmap); - if (error) { - device_printf(dev, "can't create TX status DMA stuffs\n"); + /* Load the address of the ring. */ + ctx.et_busaddr = 0; + error = bus_dmamap_load(*tag, *map, *ring, maxsize, et_dma_map_addr, + &ctx, BUS_DMA_NOWAIT); + if (error != 0) { + device_printf(sc->dev, + "could not load DMA'able memory for %s\n", msg); return (error); } + *paddr = ctx.et_busaddr; + return (0); +} - /* - * Create DMA stuffs for RX rings - */ - for (i = 0; i < ET_RX_NRING; ++i) { - static const uint32_t rx_ring_posreg[ET_RX_NRING] = - { ET_RX_RING0_POS, ET_RX_RING1_POS }; - - struct et_rxdesc_ring *rx_ring = &sc->sc_rx_ring[i]; +static void +et_dma_ring_free(struct et_softc *sc, bus_dma_tag_t *tag, uint8_t **ring, + bus_dmamap_t *map) +{ - error = et_dma_mem_create(dev, ET_RX_RING_SIZE, - &rx_ring->rr_dtag, - (void **)&rx_ring->rr_desc, - &rx_ring->rr_paddr, - &rx_ring->rr_dmap); - if (error) { - device_printf(dev, "can't create DMA stuffs for " - "the %d RX ring\n", i); - return (error); - } - rx_ring->rr_posreg = rx_ring_posreg[i]; + if (*map != NULL) + bus_dmamap_unload(*tag, *map); + if (*map != NULL && *ring != NULL) { + bus_dmamem_free(*tag, *ring, *map); + *ring = NULL; + *map = NULL; } - - /* - * Create RX stat ring DMA stuffs - */ - error = et_dma_mem_create(dev, ET_RXSTAT_RING_SIZE, - &rxst_ring->rsr_dtag, - (void **)&rxst_ring->rsr_stat, - &rxst_ring->rsr_paddr, &rxst_ring->rsr_dmap); - if (error) { - device_printf(dev, "can't create RX stat ring DMA stuffs\n"); - return (error); + if (*tag) { + bus_dma_tag_destroy(*tag); + *tag = NULL; } +} - /* - * Create RX status DMA stuffs - */ - error = et_dma_mem_create(dev, sizeof(struct et_rxstatus), - &rxsd->rxsd_dtag, - (void **)&rxsd->rxsd_status, - &rxsd->rxsd_paddr, &rxsd->rxsd_dmap); - if (error) { - device_printf(dev, "can't create RX status DMA stuffs\n"); +static int +et_dma_alloc(struct et_softc *sc) +{ + struct et_txdesc_ring *tx_ring; + struct et_rxdesc_ring *rx_ring; + struct et_rxstat_ring *rxst_ring; + struct et_rxstatus_data *rxsd; + struct et_rxbuf_data *rbd; + struct et_txbuf_data *tbd; + struct et_txstatus_data *txsd; + int i, error; + + error = bus_dma_tag_create(bus_get_dma_tag(sc->dev), 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, + BUS_SPACE_MAXSIZE_32BIT, 0, BUS_SPACE_MAXSIZE_32BIT, 0, NULL, NULL, + &sc->sc_dtag); + if (error != 0) { + device_printf(sc->dev, "could not allocate parent dma tag\n"); return (error); } - /* - * Create mbuf DMA stuffs - */ - error = et_dma_mbuf_create(dev); + /* TX ring. */ + tx_ring = &sc->sc_tx_ring; + error = et_dma_ring_alloc(sc, ET_RING_ALIGN, ET_TX_RING_SIZE, + &tx_ring->tr_dtag, (uint8_t **)&tx_ring->tr_desc, &tx_ring->tr_dmap, + &tx_ring->tr_paddr, "TX ring"); if (error) return (error); - return (0); -} + /* TX status block. */ + txsd = &sc->sc_tx_status; + error = et_dma_ring_alloc(sc, ET_STATUS_ALIGN, sizeof(uint32_t), + &txsd->txsd_dtag, (uint8_t **)&txsd->txsd_status, &txsd->txsd_dmap, + &txsd->txsd_paddr, "TX status block"); + if (error) + return (error); -static void -et_dma_free(device_t dev) -{ - struct et_softc *sc = device_get_softc(dev); - struct et_txdesc_ring *tx_ring = &sc->sc_tx_ring; - struct et_txstatus_data *txsd = &sc->sc_tx_status; - struct et_rxstat_ring *rxst_ring = &sc->sc_rxstat_ring; - struct et_rxstatus_data *rxsd = &sc->sc_rx_status; - int i, rx_done[ET_RX_NRING]; + /* RX ring 0, used as to recive small sized frames. */ + rx_ring = &sc->sc_rx_ring[0]; + error = et_dma_ring_alloc(sc, ET_RING_ALIGN, ET_RX_RING_SIZE, + &rx_ring->rr_dtag, (uint8_t **)&rx_ring->rr_desc, &rx_ring->rr_dmap, + &rx_ring->rr_paddr, "RX ring 0"); + rx_ring->rr_posreg = ET_RX_RING0_POS; + if (error) + return (error); - /* - * Destroy TX ring DMA stuffs - */ - et_dma_mem_destroy(tx_ring->tr_dtag, tx_ring->tr_desc, - tx_ring->tr_dmap); + /* RX ring 1, used as to store normal sized frames. */ + rx_ring = &sc->sc_rx_ring[1]; + error = et_dma_ring_alloc(sc, ET_RING_ALIGN, ET_RX_RING_SIZE, + &rx_ring->rr_dtag, (uint8_t **)&rx_ring->rr_desc, &rx_ring->rr_dmap, + &rx_ring->rr_paddr, "RX ring 1"); + rx_ring->rr_posreg = ET_RX_RING1_POS; + if (error) + return (error); - /* - * Destroy TX status DMA stuffs - */ - et_dma_mem_destroy(txsd->txsd_dtag, txsd->txsd_status, - txsd->txsd_dmap); + /* RX stat ring. */ + rxst_ring = &sc->sc_rxstat_ring; + error = et_dma_ring_alloc(sc, ET_RING_ALIGN, ET_RXSTAT_RING_SIZE, + &rxst_ring->rsr_dtag, (uint8_t **)&rxst_ring->rsr_stat, + &rxst_ring->rsr_dmap, &rxst_ring->rsr_paddr, "RX stat ring"); + if (error) + return (error); - /* - * Destroy DMA stuffs for RX rings - */ - for (i = 0; i < ET_RX_NRING; ++i) { - struct et_rxdesc_ring *rx_ring = &sc->sc_rx_ring[i]; + /* RX status block. */ + rxsd = &sc->sc_rx_status; + error = et_dma_ring_alloc(sc, ET_STATUS_ALIGN, + sizeof(struct et_rxstatus), &rxsd->rxsd_dtag, + (uint8_t **)&rxsd->rxsd_status, &rxsd->rxsd_dmap, + &rxsd->rxsd_paddr, "RX status block"); + if (error) + return (error); - et_dma_mem_destroy(rx_ring->rr_dtag, rx_ring->rr_desc, - rx_ring->rr_dmap); + /* Create parent DMA tag for mbufs. */ + error = bus_dma_tag_create(bus_get_dma_tag(sc->dev), 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, + BUS_SPACE_MAXSIZE_32BIT, 0, BUS_SPACE_MAXSIZE_32BIT, 0, NULL, NULL, + &sc->sc_mbuf_dtag); + if (error != 0) { + device_printf(sc->dev, + "could not allocate parent dma tag for mbuf\n"); + return (error); } - /* - * Destroy RX stat ring DMA stuffs - */ - et_dma_mem_destroy(rxst_ring->rsr_dtag, rxst_ring->rsr_stat, - rxst_ring->rsr_dmap); - - /* - * Destroy RX status DMA stuffs - */ - et_dma_mem_destroy(rxsd->rxsd_dtag, rxsd->rxsd_status, - rxsd->rxsd_dmap); - - /* - * Destroy mbuf DMA stuffs - */ - for (i = 0; i < ET_RX_NRING; ++i) - rx_done[i] = ET_RX_NDESC; - et_dma_mbuf_destroy(dev, ET_TX_NDESC, rx_done); - - /* - * Destroy top level DMA tag - */ - if (sc->sc_dtag != NULL) - bus_dma_tag_destroy(sc->sc_dtag); -} - -static int -et_dma_mbuf_create(device_t dev) -{ - struct et_softc *sc = device_get_softc(dev); - struct et_txbuf_data *tbd = &sc->sc_tx_data; - int i, error, rx_done[ET_RX_NRING]; + /* Create DMA tag for mini RX mbufs to use RX ring 0. */ + error = bus_dma_tag_create(sc->sc_mbuf_dtag, 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, MHLEN, 1, + MHLEN, 0, NULL, NULL, &sc->sc_rx_mini_tag); + if (error) { + device_printf(sc->dev, "could not create mini RX dma tag\n"); + return (error); + } - /* - * Create mbuf DMA tag - */ - error = bus_dma_tag_create(sc->sc_dtag, 1, 0, - BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, - NULL, NULL, - ET_JUMBO_FRAMELEN, ET_NSEG_MAX, - BUS_SPACE_MAXSIZE_32BIT, - BUS_DMA_ALLOCNOW, NULL, NULL, &sc->sc_mbuf_dtag); + /* Create DMA tag for standard RX mbufs to use RX ring 1. */ + error = bus_dma_tag_create(sc->sc_mbuf_dtag, 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES, 1, + MCLBYTES, 0, NULL, NULL, &sc->sc_rx_tag); if (error) { - device_printf(dev, "can't create mbuf DMA tag\n"); + device_printf(sc->dev, "could not create RX dma tag\n"); return (error); } - /* - * Create spare DMA map for RX mbufs - */ - error = bus_dmamap_create(sc->sc_mbuf_dtag, 0, &sc->sc_mbuf_tmp_dmap); + /* Create DMA tag for TX mbufs. */ + error = bus_dma_tag_create(sc->sc_mbuf_dtag, 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, + MCLBYTES * ET_NSEG_MAX, ET_NSEG_MAX, MCLBYTES, 0, NULL, NULL, + &sc->sc_tx_tag); if (error) { - device_printf(dev, "can't create spare mbuf DMA map\n"); - bus_dma_tag_destroy(sc->sc_mbuf_dtag); - sc->sc_mbuf_dtag = NULL; + device_printf(sc->dev, "could not create TX dma tag\n"); return (error); } - /* - * Create DMA maps for RX mbufs - */ - bzero(rx_done, sizeof(rx_done)); - for (i = 0; i < ET_RX_NRING; ++i) { - struct et_rxbuf_data *rbd = &sc->sc_rx_data[i]; - int j; + /* Initialize RX ring 0. */ + rbd = &sc->sc_rx_data[0]; + rbd->rbd_bufsize = ET_RXDMA_CTRL_RING0_128; + rbd->rbd_newbuf = et_newbuf_hdr; + rbd->rbd_discard = et_rxbuf_discard; + rbd->rbd_softc = sc; + rbd->rbd_ring = &sc->sc_rx_ring[0]; + /* Create DMA maps for mini RX buffers, ring 0. */ + for (i = 0; i < ET_RX_NDESC; i++) { + error = bus_dmamap_create(sc->sc_rx_mini_tag, 0, + &rbd->rbd_buf[i].rb_dmap); + if (error) { + device_printf(sc->dev, + "could not create DMA map for mini RX mbufs\n"); + return (error); + } + } - for (j = 0; j < ET_RX_NDESC; ++j) { - error = bus_dmamap_create(sc->sc_mbuf_dtag, 0, - &rbd->rbd_buf[j].rb_dmap); - if (error) { - device_printf(dev, "can't create %d RX mbuf " - "for %d RX ring\n", j, i); - rx_done[i] = j; - et_dma_mbuf_destroy(dev, 0, rx_done); - return (error); - } + /* Create a spare DMA map for mini RX buffers, ring 0. */ + error = bus_dmamap_create(sc->sc_rx_mini_tag, 0, + &sc->sc_rx_mini_sparemap); + if (error) { + device_printf(sc->dev, + "could not create spare DMA map for mini RX mbuf\n"); + return (error); + } + + /* Initialize RX ring 1. */ + rbd = &sc->sc_rx_data[1]; + rbd->rbd_bufsize = ET_RXDMA_CTRL_RING1_2048; + rbd->rbd_newbuf = et_newbuf_cluster; + rbd->rbd_discard = et_rxbuf_discard; + rbd->rbd_softc = sc; + rbd->rbd_ring = &sc->sc_rx_ring[1]; + /* Create DMA maps for standard RX buffers, ring 1. */ + for (i = 0; i < ET_RX_NDESC; i++) { + error = bus_dmamap_create(sc->sc_rx_tag, 0, + &rbd->rbd_buf[i].rb_dmap); + if (error) { + device_printf(sc->dev, + "could not create DMA map for mini RX mbufs\n"); + return (error); } - rx_done[i] = ET_RX_NDESC; + } - rbd->rbd_softc = sc; - rbd->rbd_ring = &sc->sc_rx_ring[i]; + /* Create a spare DMA map for standard RX buffers, ring 1. */ + error = bus_dmamap_create(sc->sc_rx_tag, 0, &sc->sc_rx_sparemap); + if (error) { + device_printf(sc->dev, + "could not create spare DMA map for RX mbuf\n"); + return (error); } - /* - * Create DMA maps for TX mbufs - */ - for (i = 0; i < ET_TX_NDESC; ++i) { - error = bus_dmamap_create(sc->sc_mbuf_dtag, 0, - &tbd->tbd_buf[i].tb_dmap); + /* Create DMA maps for TX buffers. */ + tbd = &sc->sc_tx_data; + for (i = 0; i < ET_TX_NDESC; i++) { + error = bus_dmamap_create(sc->sc_tx_tag, 0, + &tbd->tbd_buf[i].tb_dmap); if (error) { - device_printf(dev, "can't create %d TX mbuf " - "DMA map\n", i); - et_dma_mbuf_destroy(dev, i, rx_done); + device_printf(sc->dev, + "could not create DMA map for TX mbufs\n"); return (error); } } @@ -940,106 +940,97 @@ et_dma_mbuf_create(device_t dev) } static void -et_dma_mbuf_destroy(device_t dev, int tx_done, const int rx_done[]) +et_dma_free(struct et_softc *sc) { - struct et_softc *sc = device_get_softc(dev); - struct et_txbuf_data *tbd = &sc->sc_tx_data; + struct et_txdesc_ring *tx_ring; + struct et_rxdesc_ring *rx_ring; + struct et_txstatus_data *txsd; + struct et_rxstat_ring *rxst_ring; + struct et_rxstatus_data *rxsd; + struct et_rxbuf_data *rbd; + struct et_txbuf_data *tbd; int i; - if (sc->sc_mbuf_dtag == NULL) - return; - - /* - * Destroy DMA maps for RX mbufs - */ - for (i = 0; i < ET_RX_NRING; ++i) { - struct et_rxbuf_data *rbd = &sc->sc_rx_data[i]; - int j; - - for (j = 0; j < rx_done[i]; ++j) { - struct et_rxbuf *rb = &rbd->rbd_buf[j]; - - KASSERT(rb->rb_mbuf == NULL, - ("RX mbuf in %d RX ring is not freed yet\n", i)); - bus_dmamap_destroy(sc->sc_mbuf_dtag, rb->rb_dmap); + /* Destroy DMA maps for mini RX buffers, ring 0. */ + rbd = &sc->sc_rx_data[0]; + for (i = 0; i < ET_RX_NDESC; i++) { + if (rbd->rbd_buf[i].rb_dmap) { + bus_dmamap_destroy(sc->sc_rx_mini_tag, + rbd->rbd_buf[i].rb_dmap); + rbd->rbd_buf[i].rb_dmap = NULL; } } - - /* - * Destroy DMA maps for TX mbufs - */ - for (i = 0; i < tx_done; ++i) { - struct et_txbuf *tb = &tbd->tbd_buf[i]; - - KASSERT(tb->tb_mbuf == NULL, ("TX mbuf is not freed yet\n")); - bus_dmamap_destroy(sc->sc_mbuf_dtag, tb->tb_dmap); + if (sc->sc_rx_mini_sparemap) { + bus_dmamap_destroy(sc->sc_rx_mini_tag, sc->sc_rx_mini_sparemap); + sc->sc_rx_mini_sparemap = NULL; } - - /* - * Destroy spare mbuf DMA map - */ - bus_dmamap_destroy(sc->sc_mbuf_dtag, sc->sc_mbuf_tmp_dmap); - - /* - * Destroy mbuf DMA tag - */ - bus_dma_tag_destroy(sc->sc_mbuf_dtag); - sc->sc_mbuf_dtag = NULL; -} - -static int -et_dma_mem_create(device_t dev, bus_size_t size, bus_dma_tag_t *dtag, - void **addr, bus_addr_t *paddr, bus_dmamap_t *dmap) -{ - struct et_softc *sc = device_get_softc(dev); - int error; - - error = bus_dma_tag_create(sc->sc_dtag, ET_ALIGN, 0, - BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, - NULL, NULL, - size, 1, BUS_SPACE_MAXSIZE_32BIT, - 0, NULL, NULL, dtag); - if (error) { - device_printf(dev, "can't create DMA tag\n"); - return (error); + if (sc->sc_rx_mini_tag) { + bus_dma_tag_destroy(sc->sc_rx_mini_tag); + sc->sc_rx_mini_tag = NULL; } - error = bus_dmamem_alloc(*dtag, addr, BUS_DMA_WAITOK | BUS_DMA_ZERO, - dmap); - if (error) { - device_printf(dev, "can't allocate DMA mem\n"); - bus_dma_tag_destroy(*dtag); - *dtag = NULL; - return (error); + /* Destroy DMA maps for standard RX buffers, ring 1. */ + rbd = &sc->sc_rx_data[1]; + for (i = 0; i < ET_RX_NDESC; i++) { + if (rbd->rbd_buf[i].rb_dmap) { + bus_dmamap_destroy(sc->sc_rx_tag, + rbd->rbd_buf[i].rb_dmap); + rbd->rbd_buf[i].rb_dmap = NULL; + } } - - error = bus_dmamap_load(*dtag, *dmap, *addr, size, - et_dma_ring_addr, paddr, BUS_DMA_WAITOK); - if (error) { - device_printf(dev, "can't load DMA mem\n"); - bus_dmamem_free(*dtag, *addr, *dmap); - bus_dma_tag_destroy(*dtag); - *dtag = NULL; - return (error); + if (sc->sc_rx_sparemap) { + bus_dmamap_destroy(sc->sc_rx_tag, sc->sc_rx_sparemap); + sc->sc_rx_sparemap = NULL; + } + if (sc->sc_rx_tag) { + bus_dma_tag_destroy(sc->sc_rx_tag); + sc->sc_rx_tag = NULL; } - return (0); -} -static void -et_dma_mem_destroy(bus_dma_tag_t dtag, void *addr, bus_dmamap_t dmap) -{ - if (dtag != NULL) { - bus_dmamap_unload(dtag, dmap); - bus_dmamem_free(dtag, addr, dmap); - bus_dma_tag_destroy(dtag); + /* Destroy DMA maps for TX buffers. */ + tbd = &sc->sc_tx_data; + for (i = 0; i < ET_TX_NDESC; i++) { + if (tbd->tbd_buf[i].tb_dmap) { + bus_dmamap_destroy(sc->sc_tx_tag, + tbd->tbd_buf[i].tb_dmap); + tbd->tbd_buf[i].tb_dmap = NULL; + } + } + if (sc->sc_tx_tag) { + bus_dma_tag_destroy(sc->sc_tx_tag); + sc->sc_tx_tag = NULL; } -} -static void -et_dma_ring_addr(void *arg, bus_dma_segment_t *seg, int nseg, int error) -{ - KASSERT(nseg == 1, ("too many segments\n")); - *((bus_addr_t *)arg) = seg->ds_addr; + /* Destroy mini RX ring, ring 0. */ + rx_ring = &sc->sc_rx_ring[0]; + et_dma_ring_free(sc, &rx_ring->rr_dtag, (void *)&rx_ring->rr_desc, + &rx_ring->rr_dmap); + /* Destroy standard RX ring, ring 1. */ + rx_ring = &sc->sc_rx_ring[1]; + et_dma_ring_free(sc, &rx_ring->rr_dtag, (void *)&rx_ring->rr_desc, + &rx_ring->rr_dmap); + /* Destroy RX stat ring. */ + rxst_ring = &sc->sc_rxstat_ring; + et_dma_ring_free(sc, &rxst_ring->rsr_dtag, (void *)&rxst_ring->rsr_stat, + &rxst_ring->rsr_dmap); + /* Destroy RX status block. */ + rxsd = &sc->sc_rx_status; + et_dma_ring_free(sc, &rxst_ring->rsr_dtag, (void *)&rxst_ring->rsr_stat, + &rxst_ring->rsr_dmap); + /* Destroy TX ring. */ + tx_ring = &sc->sc_tx_ring; + et_dma_ring_free(sc, &tx_ring->tr_dtag, (void *)&tx_ring->tr_desc, + &tx_ring->tr_dmap); + /* Destroy TX status block. */ + txsd = &sc->sc_tx_status; + et_dma_ring_free(sc, &txsd->txsd_dtag, (void *)&txsd->txsd_status, + &txsd->txsd_dmap); + + /* Destroy the parent tag. */ + if (sc->sc_dtag) { + bus_dma_tag_destroy(sc->sc_dtag); + sc->sc_dtag = NULL; + } } static void @@ -1117,30 +1108,21 @@ back: static void et_init_locked(struct et_softc *sc) { - struct ifnet *ifp = sc->ifp; - const struct et_bsize *arr; - int error, i; + struct ifnet *ifp; + int error; ET_LOCK_ASSERT(sc); + ifp = sc->ifp; if (ifp->if_drv_flags & IFF_DRV_RUNNING) return; et_stop(sc); - arr = et_bufsize_std; - for (i = 0; i < ET_RX_NRING; ++i) { - sc->sc_rx_data[i].rbd_bufsize = arr[i].bufsize; - sc->sc_rx_data[i].rbd_newbuf = arr[i].newbuf; - } - - error = et_init_tx_ring(sc); - if (error) - goto back; - + et_init_tx_ring(sc); error = et_init_rx_ring(sc); if (error) - goto back; + return; error = et_chip_init(sc); if (error) @@ -1313,20 +1295,26 @@ et_start(struct ifnet *ifp) ET_UNLOCK(sc); } -static void +static int et_watchdog(struct et_softc *sc) { + uint32_t status; + ET_LOCK_ASSERT(sc); if (sc->watchdog_timer == 0 || --sc->watchdog_timer) - return; + return (0); - if_printf(sc->ifp, "watchdog timed out\n"); + bus_dmamap_sync(sc->sc_tx_status.txsd_dtag, sc->sc_tx_status.txsd_dmap, + BUS_DMASYNC_POSTREAD); + status = le32toh(*(sc->sc_tx_status.txsd_status)); + if_printf(sc->ifp, "watchdog timed out (0x%08x) -- resetting\n", + status); sc->ifp->if_oerrors++; sc->ifp->if_drv_flags &= ~IFF_DRV_RUNNING; et_init_locked(sc); - et_start_locked(sc->ifp); + return (EJUSTRETURN); } static int @@ -1354,49 +1342,59 @@ et_stop_txdma(struct et_softc *sc) static void et_free_tx_ring(struct et_softc *sc) { - struct et_txbuf_data *tbd = &sc->sc_tx_data; - struct et_txdesc_ring *tx_ring = &sc->sc_tx_ring; + struct et_txdesc_ring *tx_ring; + struct et_txbuf_data *tbd; + struct et_txbuf *tb; int i; + tbd = &sc->sc_tx_data; + tx_ring = &sc->sc_tx_ring; for (i = 0; i < ET_TX_NDESC; ++i) { - struct et_txbuf *tb = &tbd->tbd_buf[i]; - + tb = &tbd->tbd_buf[i]; if (tb->tb_mbuf != NULL) { + bus_dmamap_sync(sc->sc_tx_tag, tb->tb_dmap, + BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(sc->sc_mbuf_dtag, tb->tb_dmap); m_freem(tb->tb_mbuf); tb->tb_mbuf = NULL; } } - - bzero(tx_ring->tr_desc, ET_TX_RING_SIZE); - bus_dmamap_sync(tx_ring->tr_dtag, tx_ring->tr_dmap, - BUS_DMASYNC_PREWRITE); } static void et_free_rx_ring(struct et_softc *sc) { - int n; - - for (n = 0; n < ET_RX_NRING; ++n) { - struct et_rxbuf_data *rbd = &sc->sc_rx_data[n]; - struct et_rxdesc_ring *rx_ring = &sc->sc_rx_ring[n]; - int i; - - for (i = 0; i < ET_RX_NDESC; ++i) { - struct et_rxbuf *rb = &rbd->rbd_buf[i]; + struct et_rxbuf_data *rbd; + struct et_rxdesc_ring *rx_ring; + struct et_rxbuf *rb; + int i; - if (rb->rb_mbuf != NULL) { - bus_dmamap_unload(sc->sc_mbuf_dtag, - rb->rb_dmap); - m_freem(rb->rb_mbuf); - rb->rb_mbuf = NULL; - } + /* Ring 0 */ + rx_ring = &sc->sc_rx_ring[0]; + rbd = &sc->sc_rx_data[0]; + for (i = 0; i < ET_RX_NDESC; ++i) { + rb = &rbd->rbd_buf[i]; + if (rb->rb_mbuf != NULL) { + bus_dmamap_sync(sc->sc_rx_mini_tag, rx_ring->rr_dmap, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->sc_rx_mini_tag, rb->rb_dmap); + m_freem(rb->rb_mbuf); + rb->rb_mbuf = NULL; } + } - bzero(rx_ring->rr_desc, ET_RX_RING_SIZE); - bus_dmamap_sync(rx_ring->rr_dtag, rx_ring->rr_dmap, - BUS_DMASYNC_PREWRITE); + /* Ring 1 */ + rx_ring = &sc->sc_rx_ring[1]; + rbd = &sc->sc_rx_data[1]; + for (i = 0; i < ET_RX_NDESC; ++i) { + rb = &rbd->rbd_buf[i]; + if (rb->rb_mbuf != NULL) { + bus_dmamap_sync(sc->sc_rx_tag, rx_ring->rr_dmap, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->sc_rx_tag, rb->rb_dmap); + m_freem(rb->rb_mbuf); + rb->rb_mbuf = NULL; + } } } @@ -1523,40 +1521,41 @@ et_chip_init(struct et_softc *sc) return (0); } -static int +static void et_init_tx_ring(struct et_softc *sc) { - struct et_txdesc_ring *tx_ring = &sc->sc_tx_ring; - struct et_txstatus_data *txsd = &sc->sc_tx_status; - struct et_txbuf_data *tbd = &sc->sc_tx_data; + struct et_txdesc_ring *tx_ring; + struct et_txbuf_data *tbd; + struct et_txstatus_data *txsd; + tx_ring = &sc->sc_tx_ring; bzero(tx_ring->tr_desc, ET_TX_RING_SIZE); bus_dmamap_sync(tx_ring->tr_dtag, tx_ring->tr_dmap, - BUS_DMASYNC_PREWRITE); + BUS_DMASYNC_PREWRITE); + tbd = &sc->sc_tx_data; tbd->tbd_start_index = 0; tbd->tbd_start_wrap = 0; tbd->tbd_used = 0; + txsd = &sc->sc_tx_status; bzero(txsd->txsd_status, sizeof(uint32_t)); bus_dmamap_sync(txsd->txsd_dtag, txsd->txsd_dmap, - BUS_DMASYNC_PREWRITE); - return (0); + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); } static int et_init_rx_ring(struct et_softc *sc) { - struct et_rxstatus_data *rxsd = &sc->sc_rx_status; - struct et_rxstat_ring *rxst_ring = &sc->sc_rxstat_ring; - int n; + struct et_rxstatus_data *rxsd; + struct et_rxstat_ring *rxst_ring; + struct et_rxbuf_data *rbd; + int i, error, n; for (n = 0; n < ET_RX_NRING; ++n) { - struct et_rxbuf_data *rbd = &sc->sc_rx_data[n]; - int i, error; - + rbd = &sc->sc_rx_data[n]; for (i = 0; i < ET_RX_NDESC; ++i) { - error = rbd->rbd_newbuf(rbd, i, 1); + error = rbd->rbd_newbuf(rbd, i); if (error) { if_printf(sc->ifp, "%d ring %d buf, " "newbuf failed: %d\n", n, i, error); @@ -1565,37 +1564,19 @@ et_init_rx_ring(struct et_softc *sc) } } + rxsd = &sc->sc_rx_status; bzero(rxsd->rxsd_status, sizeof(struct et_rxstatus)); bus_dmamap_sync(rxsd->rxsd_dtag, rxsd->rxsd_dmap, - BUS_DMASYNC_PREWRITE); + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + rxst_ring = &sc->sc_rxstat_ring; bzero(rxst_ring->rsr_stat, ET_RXSTAT_RING_SIZE); bus_dmamap_sync(rxst_ring->rsr_dtag, rxst_ring->rsr_dmap, - BUS_DMASYNC_PREWRITE); + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); return (0); } -static void -et_dma_buf_addr(void *xctx, bus_dma_segment_t *segs, int nsegs, - bus_size_t mapsz __unused, int error) -{ - struct et_dmamap_ctx *ctx = xctx; - int i; - - if (error) - return; - - if (nsegs > ctx->nsegs) { - ctx->nsegs = 0; - return; - } - - ctx->nsegs = nsegs; - for (i = 0; i < nsegs; ++i) - ctx->segs[i] = segs[i]; -} - static int et_init_rxdma(struct et_softc *sc) { @@ -1933,13 +1914,20 @@ et_enable_txrx(struct et_softc *sc, int static void et_rxeof(struct et_softc *sc) { - struct ifnet *ifp; struct et_rxstatus_data *rxsd; struct et_rxstat_ring *rxst_ring; - uint32_t rxs_stat_ring, rxst_info2; - int rxst_wrap, rxst_index; + struct et_rxbuf_data *rbd; + struct et_rxdesc_ring *rx_ring; + struct et_rxstat *st; + struct ifnet *ifp; + struct mbuf *m; + uint32_t rxstat_pos, rxring_pos; + uint32_t rxst_info1, rxst_info2, rxs_stat_ring; + int buflen, buf_idx, npost[2], ring_idx; + int rxst_index, rxst_wrap; ET_LOCK_ASSERT(sc); + ifp = sc->ifp; rxsd = &sc->sc_rx_status; rxst_ring = &sc->sc_rxstat_ring; @@ -1948,26 +1936,24 @@ et_rxeof(struct et_softc *sc) return; bus_dmamap_sync(rxsd->rxsd_dtag, rxsd->rxsd_dmap, - BUS_DMASYNC_POSTREAD); + BUS_DMASYNC_POSTREAD); bus_dmamap_sync(rxst_ring->rsr_dtag, rxst_ring->rsr_dmap, - BUS_DMASYNC_POSTREAD); + BUS_DMASYNC_POSTREAD); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 19:19:57 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: by hub.freebsd.org (Postfix, from userid 1205) id 99D1F106567B; Fri, 6 Jan 2012 19:19:57 +0000 (UTC) Date: Fri, 6 Jan 2012 19:19:57 +0000 From: Navdeep Parhar To: Gleb Smirnoff Message-ID: <20120106191957.GA58317@hub.freebsd.org> Mail-Followup-To: Gleb Smirnoff , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org References: <201201061829.q06ITfP0001841@svn.freebsd.org> <20120106190515.GU34721@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120106190515.GU34721@FreeBSD.org> User-Agent: Mutt/1.4.2.1i Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r229714 - 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, 06 Jan 2012 19:19:57 -0000 On Fri, Jan 06, 2012 at 11:05:15PM +0400, Gleb Smirnoff wrote: > Navdeep, > > On Fri, Jan 06, 2012 at 06:29:41PM +0000, Navdeep Parhar wrote: > N> Author: np > N> Date: Fri Jan 6 18:29:40 2012 > N> New Revision: 229714 > N> URL: http://svn.freebsd.org/changeset/base/229714 > N> > N> Log: > N> Always release the inp lock before returning from tcp_detach. > ^ after ? I don't see anything wrong in the message. The lock is released within tcp_detach (before it returns), and not after. Navdeep > > N> Modified: > N> head/sys/netinet/tcp_usrreq.c > N> > N> Modified: head/sys/netinet/tcp_usrreq.c > N> ============================================================================== > N> --- head/sys/netinet/tcp_usrreq.c Fri Jan 6 18:18:25 2012 (r229713) > N> +++ head/sys/netinet/tcp_usrreq.c Fri Jan 6 18:29:40 2012 (r229714) > N> @@ -204,8 +204,10 @@ tcp_detach(struct socket *so, struct inp > N> tcp_discardcb(tp); > N> in_pcbdetach(inp); > N> in_pcbfree(inp); > N> - } else > N> + } else { > N> in_pcbdetach(inp); > N> + INP_WUNLOCK(inp); > N> + } > N> } > N> } > N> > > -- > Totus tuus, Glebius. From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 19:24:33 2012 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 ACB891065670; Fri, 6 Jan 2012 19:24:33 +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 951138FC14; Fri, 6 Jan 2012 19:24:33 +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 q06JOXe4003977; Fri, 6 Jan 2012 19:24:33 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06JOXri003973; Fri, 6 Jan 2012 19:24:33 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201061924.q06JOXri003973@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 6 Jan 2012 19:24:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229720 - stable/9/sys/dev/et 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, 06 Jan 2012 19:24:33 -0000 Author: yongari Date: Fri Jan 6 19:24:33 2012 New Revision: 229720 URL: http://svn.freebsd.org/changeset/base/229720 Log: MFC r228326-228327,228331-228332: r228326: Controller does not require TX start command for every frame. So send a single TX command after setting up all TX frames. This removes unnecessary register accesses and bus_dmamap_sync(9) calls. et(4) uses TX interrupt moderation so it's possible to have TX buffers that were already transmitted but waiting for TX completion interrupt. If the number of available TX descriptor is less then 1/3 of total TX descriptor, try reclaiming first to get enough free TX descriptors before setting up TX descriptors. After r228325, et_txeof() no longer tries to send frames after reclaiming TX buffers. That change was made to give more chance to transmit frames in main interrupt handler since we can still send frames in interrupt handler with RX interrupt. So right before exiting interrupt hander, after enabling interrupt, try to send more frames. This gives slightly better performance numbers. While I'm here reduce number of spare TX descriptors from 8 to 4. Controller does not require reserved TX descriptors, it was just to reduce TX overhead. After r228325, driver has much lower TX overhead so it does not make sense to reserve 8 TX descriptors. r228327: Remove et_enable_intrs(), et_disable_intrs() functions and manipulation of interrupt register access is done through CSR_WRITE_4 macro. Also add disabling interrupt into et_reset() because we want interrupt disabled state after controller reset. While I'm here slightly change interrupt handler to be more readable one. r228331: Rework link state tracking and TX/RX MAC configuration. o Do not report link status if driver is not running. o TX/RX MAC configuration should be done with resolved speed, duplex and flow control after establishing a link so it can't be done in driver initialization routine. Move the configuration to miibus_statchg callback which will be called whenever any link state change is detected. At this moment, flow-control is not enabled yet mainly because I was not able to set correct flow control parameters to generate TX pause frames. o Now TX/RX MAC is enabled only when a valid link is detected. Rearragnge hardware initialization routine a bit to leave enabling MAC to miibus_statchg callback. In order to that, TX/RX DMA engine is enabled in et_init_locked(). o Introduce ET_FLAG_LINK flag to track current link state. o Introduce ET_FLAG_FASTETHER flag to mark whether controller is fast ethernet. This flag is checked in miibus_statchg callback to know whether PHY established a valid link. o In et_stop(), TX/RX MAC is explicitly disabled instead of relying on et_reset(). And move et_reset() from et_stop() to controller initialization. Controler reset is not required here and it would also clear critial registers(i.e station address, RX filter configuration, WOL etc) that are required to make WOL work. o Switching to current media is done in et_init_locked() after setting IFF_DRV_RUNNING flag. This should ensure reliable auto-negotiation/manual link establishment. o In et_start_locked(), check whether driver got a valid link before trying to send frames. o Remove checking a link in et_tick() as this is done by miibus_statchg callback. r228332: Implement hardware MAC statistics counter. Counters could be queried with dev.et.%d.stats sysctl node where %d is an instance of device. Modified: stable/9/sys/dev/et/if_et.c stable/9/sys/dev/et/if_etreg.h stable/9/sys/dev/et/if_etvar.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/et/if_et.c ============================================================================== --- stable/9/sys/dev/et/if_et.c Fri Jan 6 19:12:47 2012 (r229719) +++ stable/9/sys/dev/et/if_et.c Fri Jan 6 19:24:33 2012 (r229720) @@ -109,8 +109,6 @@ static int et_sysctl_rx_intr_npkts(SYSCT static int et_sysctl_rx_intr_delay(SYSCTL_HANDLER_ARGS); static void et_intr(void *); -static void et_enable_intrs(struct et_softc *, uint32_t); -static void et_disable_intrs(struct et_softc *); static void et_rxeof(struct et_softc *); static void et_txeof(struct et_softc *); @@ -143,13 +141,12 @@ static int et_start_rxdma(struct et_soft static int et_start_txdma(struct et_softc *); static int et_stop_rxdma(struct et_softc *); static int et_stop_txdma(struct et_softc *); -static int et_enable_txrx(struct et_softc *, int); static void et_reset(struct et_softc *); static int et_bus_config(struct et_softc *); static void et_get_eaddr(device_t, uint8_t[]); static void et_setmulti(struct et_softc *); static void et_tick(void *); -static void et_setmedia(struct et_softc *); +static void et_stats_update(struct et_softc *); static const struct et_dev { uint16_t vid; @@ -298,6 +295,9 @@ et_attach(device_t dev) goto fail; } + if (pci_get_device(dev) == PCI_PRODUCT_LUCENT_ET1310_FAST) + sc->sc_flags |= ET_FLAG_FASTETHER; + error = et_bus_config(sc); if (error) goto fail; @@ -309,8 +309,6 @@ et_attach(device_t dev) et_reset(sc); - et_disable_intrs(sc); - error = et_dma_alloc(sc); if (error) goto fail; @@ -491,7 +489,89 @@ et_miibus_writereg(device_t dev, int phy static void et_miibus_statchg(device_t dev) { - et_setmedia(device_get_softc(dev)); + struct et_softc *sc; + struct mii_data *mii; + struct ifnet *ifp; + uint32_t cfg1, cfg2, ctrl; + int i; + + sc = device_get_softc(dev); + + mii = device_get_softc(sc->sc_miibus); + ifp = sc->ifp; + if (mii == NULL || ifp == NULL || + (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + return; + + sc->sc_flags &= ~ET_FLAG_LINK; + if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == + (IFM_ACTIVE | IFM_AVALID)) { + switch (IFM_SUBTYPE(mii->mii_media_active)) { + case IFM_10_T: + case IFM_100_TX: + sc->sc_flags |= ET_FLAG_LINK; + break; + case IFM_1000_T: + if ((sc->sc_flags & ET_FLAG_FASTETHER) == 0) + sc->sc_flags |= ET_FLAG_LINK; + break; + } + } + + /* XXX Stop TX/RX MAC? */ + if ((sc->sc_flags & ET_FLAG_LINK) == 0) + return; + + /* Program MACs with resolved speed/duplex/flow-control. */ + ctrl = CSR_READ_4(sc, ET_MAC_CTRL); + ctrl &= ~(ET_MAC_CTRL_GHDX | ET_MAC_CTRL_MODE_MII); + cfg1 = CSR_READ_4(sc, ET_MAC_CFG1); + cfg1 &= ~(ET_MAC_CFG1_TXFLOW | ET_MAC_CFG1_RXFLOW | + ET_MAC_CFG1_LOOPBACK); + cfg2 = CSR_READ_4(sc, ET_MAC_CFG2); + cfg2 &= ~(ET_MAC_CFG2_MODE_MII | ET_MAC_CFG2_MODE_GMII | + ET_MAC_CFG2_FDX | ET_MAC_CFG2_BIGFRM); + cfg2 |= ET_MAC_CFG2_LENCHK | ET_MAC_CFG2_CRC | ET_MAC_CFG2_PADCRC | + ((7 << ET_MAC_CFG2_PREAMBLE_LEN_SHIFT) & + ET_MAC_CFG2_PREAMBLE_LEN_MASK); + + if (IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T) + cfg2 |= ET_MAC_CFG2_MODE_GMII; + else { + cfg2 |= ET_MAC_CFG2_MODE_MII; + ctrl |= ET_MAC_CTRL_MODE_MII; + } + + if (IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) { + cfg2 |= ET_MAC_CFG2_FDX; +#ifdef notyet + if (IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_TXPAUSE) + cfg1 |= ET_MAC_CFG1_TXFLOW; + if (IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_RXPAUSE) + cfg1 |= ET_MAC_CFG1_RXFLOW; +#endif + } else + ctrl |= ET_MAC_CTRL_GHDX; + + CSR_WRITE_4(sc, ET_MAC_CTRL, ctrl); + CSR_WRITE_4(sc, ET_MAC_CFG2, cfg2); + cfg1 |= ET_MAC_CFG1_TXEN | ET_MAC_CFG1_RXEN; + CSR_WRITE_4(sc, ET_MAC_CFG1, cfg1); + +#define NRETRY 50 + + for (i = 0; i < NRETRY; ++i) { + cfg1 = CSR_READ_4(sc, ET_MAC_CFG1); + if ((cfg1 & (ET_MAC_CFG1_SYNC_TXEN | ET_MAC_CFG1_SYNC_RXEN)) == + (ET_MAC_CFG1_SYNC_TXEN | ET_MAC_CFG1_SYNC_RXEN)) + break; + DELAY(100); + } + if (i == NRETRY) + if_printf(ifp, "can't enable RX/TX\n"); + sc->sc_flags |= ET_FLAG_TXRX_ENABLED; + +#undef NRETRY } static int @@ -522,10 +602,17 @@ et_ifmedia_upd(struct ifnet *ifp) static void et_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) { - struct et_softc *sc = ifp->if_softc; - struct mii_data *mii = device_get_softc(sc->sc_miibus); + struct et_softc *sc; + struct mii_data *mii; + sc = ifp->if_softc; ET_LOCK(sc); + if ((ifp->if_flags & IFF_UP) == 0) { + ET_UNLOCK(sc); + return; + } + + mii = device_get_softc(sc->sc_miibus); mii_pollstat(mii); ifmr->ifm_active = mii->mii_media_active; ifmr->ifm_status = mii->mii_media_status; @@ -540,17 +627,20 @@ et_stop(struct et_softc *sc) ET_LOCK_ASSERT(sc); callout_stop(&sc->sc_tick); + /* Disable interrupts. */ + CSR_WRITE_4(sc, ET_INTR_MASK, 0xffffffff); + + CSR_WRITE_4(sc, ET_MAC_CFG1, CSR_READ_4(sc, ET_MAC_CFG1) & ~( + ET_MAC_CFG1_TXEN | ET_MAC_CFG1_RXEN)); + DELAY(100); et_stop_rxdma(sc); et_stop_txdma(sc); - - et_disable_intrs(sc); + et_stats_update(sc); et_free_tx_ring(sc); et_free_rx_ring(sc); - et_reset(sc); - sc->sc_tx = 0; sc->sc_tx_intr = 0; sc->sc_flags &= ~ET_FLAG_TXRX_ENABLED; @@ -670,20 +760,10 @@ et_reset(struct et_softc *sc) ET_MAC_CFG1_RST_TXFUNC | ET_MAC_CFG1_RST_RXFUNC | ET_MAC_CFG1_RST_TXMC | ET_MAC_CFG1_RST_RXMC); CSR_WRITE_4(sc, ET_MAC_CFG1, 0); -} - -static void -et_disable_intrs(struct et_softc *sc) -{ + /* Disable interrupts. */ CSR_WRITE_4(sc, ET_INTR_MASK, 0xffffffff); } -static void -et_enable_intrs(struct et_softc *sc, uint32_t intrs) -{ - CSR_WRITE_4(sc, ET_INTR_MASK, ~intrs); -} - struct et_dmamap_arg { bus_addr_t et_busaddr; }; @@ -1083,12 +1163,12 @@ et_intr(void *xsc) return; } - et_disable_intrs(sc); + /* Disable further interrupts. */ + CSR_WRITE_4(sc, ET_INTR_MASK, 0xffffffff); intrs = CSR_READ_4(sc, ET_INTR_STATUS); - intrs &= ET_INTRS; - if (intrs == 0) /* Not interested */ - goto back; + if ((intrs & ET_INTRS) == 0) + goto done; if (intrs & ET_INTR_RXEOF) et_rxeof(sc); @@ -1096,8 +1176,12 @@ et_intr(void *xsc) et_txeof(sc); if (intrs & ET_INTR_TIMER) CSR_WRITE_4(sc, ET_TIMER, sc->sc_timer); -back: - et_enable_intrs(sc, ET_INTRS); +done: + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + CSR_WRITE_4(sc, ET_INTR_MASK, ~ET_INTRS); + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + et_start_locked(ifp); + } ET_UNLOCK(sc); } @@ -1114,6 +1198,7 @@ et_init_locked(struct et_softc *sc) return; et_stop(sc); + et_reset(sc); et_init_tx_ring(sc); error = et_init_rx_ring(sc); @@ -1122,21 +1207,33 @@ et_init_locked(struct et_softc *sc) error = et_chip_init(sc); if (error) - goto back; + goto fail; - error = et_enable_txrx(sc, 1); + /* + * Start TX/RX DMA engine + */ + error = et_start_rxdma(sc); if (error) - goto back; + return; - et_enable_intrs(sc, ET_INTRS); + error = et_start_txdma(sc); + if (error) + return; - callout_reset(&sc->sc_tick, hz, et_tick, sc); + /* Enable interrupts. */ + CSR_WRITE_4(sc, ET_INTR_MASK, ~ET_INTRS); CSR_WRITE_4(sc, ET_TIMER, sc->sc_timer); ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; -back: + + sc->sc_flags &= ~ET_FLAG_LINK; + et_ifmedia_upd_locked(ifp); + + callout_reset(&sc->sc_tick, hz, et_tick, sc); + +fail: if (error) et_stop(sc); } @@ -1240,19 +1337,32 @@ et_start_locked(struct ifnet *ifp) { struct et_softc *sc; struct mbuf *m_head = NULL; + struct et_txdesc_ring *tx_ring; struct et_txbuf_data *tbd; + uint32_t tx_ready_pos; int enq; sc = ifp->if_softc; ET_LOCK_ASSERT(sc); - if ((sc->sc_flags & ET_FLAG_TXRX_ENABLED) == 0) - return; - - if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING) + if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != + IFF_DRV_RUNNING || + (sc->sc_flags & (ET_FLAG_LINK | ET_FLAG_TXRX_ENABLED)) != + (ET_FLAG_LINK | ET_FLAG_TXRX_ENABLED)) return; + /* + * Driver does not request TX completion interrupt for every + * queued frames to prevent generating excessive interrupts. + * This means driver may wait for TX completion interrupt even + * though some frames were sucessfully transmitted. Reclaiming + * transmitted frames will ensure driver see all available + * descriptors. + */ tbd = &sc->sc_tx_data; + if (tbd->tbd_used > (ET_TX_NDESC * 2) / 3) + et_txeof(sc); + for (enq = 0; !IFQ_DRV_IS_EMPTY(&ifp->if_snd); ) { if (tbd->tbd_used + ET_NSEG_SPARE >= ET_TX_NDESC) { ifp->if_drv_flags |= IFF_DRV_OACTIVE; @@ -1277,8 +1387,17 @@ et_start_locked(struct ifnet *ifp) ETHER_BPF_MTAP(ifp, m_head); } - if (enq > 0) + if (enq > 0) { + tx_ring = &sc->sc_tx_ring; + bus_dmamap_sync(tx_ring->tr_dtag, tx_ring->tr_dmap, + BUS_DMASYNC_PREWRITE); + tx_ready_pos = tx_ring->tr_ready_index & + ET_TX_READY_POS_INDEX_MASK; + if (tx_ring->tr_ready_wrap) + tx_ready_pos |= ET_TX_READY_POS_WRAP; + CSR_WRITE_4(sc, ET_TX_READY_POS, tx_ready_pos); sc->watchdog_timer = 5; + } } static void @@ -1857,56 +1976,6 @@ et_start_txdma(struct et_softc *sc) return (0); } -static int -et_enable_txrx(struct et_softc *sc, int media_upd) -{ - struct ifnet *ifp = sc->ifp; - uint32_t val; - int i, error; - - val = CSR_READ_4(sc, ET_MAC_CFG1); - val |= ET_MAC_CFG1_TXEN | ET_MAC_CFG1_RXEN; - val &= ~(ET_MAC_CFG1_TXFLOW | ET_MAC_CFG1_RXFLOW | - ET_MAC_CFG1_LOOPBACK); - CSR_WRITE_4(sc, ET_MAC_CFG1, val); - - if (media_upd) - et_ifmedia_upd_locked(ifp); - else - et_setmedia(sc); - -#define NRETRY 50 - - for (i = 0; i < NRETRY; ++i) { - val = CSR_READ_4(sc, ET_MAC_CFG1); - if ((val & (ET_MAC_CFG1_SYNC_TXEN | ET_MAC_CFG1_SYNC_RXEN)) == - (ET_MAC_CFG1_SYNC_TXEN | ET_MAC_CFG1_SYNC_RXEN)) - break; - - DELAY(100); - } - if (i == NRETRY) { - if_printf(ifp, "can't enable RX/TX\n"); - return (0); - } - sc->sc_flags |= ET_FLAG_TXRX_ENABLED; - -#undef NRETRY - - /* - * Start TX/RX DMA engine - */ - error = et_start_rxdma(sc); - if (error) - return (error); - - error = et_start_txdma(sc); - if (error) - return (error); - - return (0); -} - static void et_rxeof(struct et_softc *sc) { @@ -1982,7 +2051,6 @@ et_rxeof(struct et_softc *sc) m = rbd->rbd_buf[buf_idx].rb_mbuf; if ((rxst_info1 & ET_RXST_INFO1_OK) == 0){ /* Discard errored frame. */ - ifp->if_ierrors++; rbd->rbd_discard(rbd, buf_idx); } else if (rbd->rbd_newbuf(rbd, buf_idx) != 0) { /* No available mbufs, discard it. */ @@ -1996,7 +2064,6 @@ et_rxeof(struct et_softc *sc) } else { m->m_pkthdr.len = m->m_len = buflen; m->m_pkthdr.rcvif = ifp; - ifp->if_ipackets++; ET_UNLOCK(sc); ifp->if_input(ifp, m); ET_LOCK(sc); @@ -2036,7 +2103,7 @@ et_encap(struct et_softc *sc, struct mbu struct mbuf *m; bus_dma_segment_t segs[ET_NSEG_MAX]; bus_dmamap_t map; - uint32_t csum_flags, last_td_ctrl2, tx_ready_pos; + uint32_t csum_flags, last_td_ctrl2; int error, i, idx, first_idx, last_idx, nsegs; tx_ring = &sc->sc_tx_ring; @@ -2121,12 +2188,6 @@ et_encap(struct et_softc *sc, struct mbu tbd->tbd_used += nsegs; MPASS(tbd->tbd_used <= ET_TX_NDESC); - bus_dmamap_sync(tx_ring->tr_dtag, tx_ring->tr_dmap, - BUS_DMASYNC_PREWRITE); - tx_ready_pos = tx_ring->tr_ready_index & ET_TX_READY_POS_INDEX_MASK; - if (tx_ring->tr_ready_wrap) - tx_ready_pos |= ET_TX_READY_POS_WRAP; - CSR_WRITE_4(sc, ET_TX_READY_POS, tx_ready_pos); return (0); } @@ -2168,7 +2229,6 @@ et_txeof(struct et_softc *sc) bus_dmamap_unload(sc->sc_tx_tag, tb->tb_dmap); m_freem(tb->tb_mbuf); tb->tb_mbuf = NULL; - ifp->if_opackets++; } if (++tbd->tbd_start_index == ET_TX_NDESC) { @@ -2185,6 +2245,7 @@ et_txeof(struct et_softc *sc) if (tbd->tbd_used + ET_NSEG_SPARE < ET_TX_NDESC) ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; } + static void et_tick(void *xsc) { @@ -2197,13 +2258,7 @@ et_tick(void *xsc) mii = device_get_softc(sc->sc_miibus); mii_tick(mii); - if ((sc->sc_flags & ET_FLAG_TXRX_ENABLED) == 0 && - (mii->mii_media_status & IFM_ACTIVE) && - IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) { - if_printf(ifp, "Link up, enable TX/RX\n"); - if (et_enable_txrx(sc, 0) == 0) - et_start_locked(ifp); - } + et_stats_update(sc); if (et_watchdog(sc) == EJUSTRETURN) return; callout_reset(&sc->sc_tick, hz, et_tick, sc); @@ -2316,6 +2371,11 @@ et_newbuf_hdr(struct et_rxbuf_data *rbd, return (0); } +#define ET_SYSCTL_STAT_ADD32(c, h, n, p, d) \ + SYSCTL_ADD_UINT(c, h, OID_AUTO, n, CTLFLAG_RD, p, 0, d) +#define ET_SYSCTL_STAT_ADD64(c, h, n, p, d) \ + SYSCTL_ADD_UQUAD(c, h, OID_AUTO, n, CTLFLAG_RD, p, d) + /* * Create sysctl tree */ @@ -2323,7 +2383,9 @@ static void et_add_sysctls(struct et_softc * sc) { struct sysctl_ctx_list *ctx; - struct sysctl_oid_list *children; + struct sysctl_oid_list *children, *parent; + struct sysctl_oid *tree; + struct et_hw_stats *stats; ctx = device_get_sysctl_ctx(sc->dev); children = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->dev)); @@ -2339,8 +2401,116 @@ et_add_sysctls(struct et_softc * sc) "TX IM, # segments per TX interrupt"); SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "timer", CTLFLAG_RW, &sc->sc_timer, 0, "TX timer"); + + tree = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, "stats", CTLFLAG_RD, + NULL, "ET statistics"); + parent = SYSCTL_CHILDREN(tree); + + /* TX/RX statistics. */ + stats = &sc->sc_stats; + ET_SYSCTL_STAT_ADD64(ctx, parent, "frames_64", &stats->pkts_64, + "0 to 64 bytes frames"); + ET_SYSCTL_STAT_ADD64(ctx, parent, "frames_65_127", &stats->pkts_65, + "65 to 127 bytes frames"); + ET_SYSCTL_STAT_ADD64(ctx, parent, "frames_128_255", &stats->pkts_128, + "128 to 255 bytes frames"); + ET_SYSCTL_STAT_ADD64(ctx, parent, "frames_256_511", &stats->pkts_256, + "256 to 511 bytes frames"); + ET_SYSCTL_STAT_ADD64(ctx, parent, "frames_512_1023", &stats->pkts_512, + "512 to 1023 bytes frames"); + ET_SYSCTL_STAT_ADD64(ctx, parent, "frames_1024_1518", &stats->pkts_1024, + "1024 to 1518 bytes frames"); + ET_SYSCTL_STAT_ADD64(ctx, parent, "frames_1519_1522", &stats->pkts_1519, + "1519 to 1522 bytes frames"); + + /* RX statistics. */ + tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "rx", CTLFLAG_RD, + NULL, "RX MAC statistics"); + children = SYSCTL_CHILDREN(tree); + ET_SYSCTL_STAT_ADD64(ctx, children, "bytes", + &stats->rx_bytes, "Good bytes"); + ET_SYSCTL_STAT_ADD64(ctx, children, "frames", + &stats->rx_frames, "Good frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "crc_errs", + &stats->rx_crcerrs, "CRC errors"); + ET_SYSCTL_STAT_ADD64(ctx, children, "mcast_frames", + &stats->rx_mcast, "Multicast frames"); + ET_SYSCTL_STAT_ADD64(ctx, children, "bcast_frames", + &stats->rx_bcast, "Broadcast frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "control", + &stats->rx_control, "Control frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "pause", + &stats->rx_pause, "Pause frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "unknown_control", + &stats->rx_unknown_control, "Unknown control frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "align_errs", + &stats->rx_alignerrs, "Alignment errors"); + ET_SYSCTL_STAT_ADD32(ctx, children, "len_errs", + &stats->rx_lenerrs, "Frames with length mismatched"); + ET_SYSCTL_STAT_ADD32(ctx, children, "code_errs", + &stats->rx_codeerrs, "Frames with code error"); + ET_SYSCTL_STAT_ADD32(ctx, children, "cs_errs", + &stats->rx_cserrs, "Frames with carrier sense error"); + ET_SYSCTL_STAT_ADD32(ctx, children, "runts", + &stats->rx_runts, "Too short frames"); + ET_SYSCTL_STAT_ADD64(ctx, children, "oversize", + &stats->rx_oversize, "Oversized frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "fragments", + &stats->rx_fragments, "Fragmented frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "jabbers", + &stats->rx_jabbers, "Frames with jabber error"); + ET_SYSCTL_STAT_ADD32(ctx, children, "drop", + &stats->rx_drop, "Dropped frames"); + + /* TX statistics. */ + tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "tx", CTLFLAG_RD, + NULL, "TX MAC statistics"); + children = SYSCTL_CHILDREN(tree); + ET_SYSCTL_STAT_ADD64(ctx, children, "bytes", + &stats->tx_bytes, "Good bytes"); + ET_SYSCTL_STAT_ADD64(ctx, children, "frames", + &stats->tx_frames, "Good frames"); + ET_SYSCTL_STAT_ADD64(ctx, children, "mcast_frames", + &stats->tx_mcast, "Multicast frames"); + ET_SYSCTL_STAT_ADD64(ctx, children, "bcast_frames", + &stats->tx_bcast, "Broadcast frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "pause", + &stats->tx_pause, "Pause frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "deferred", + &stats->tx_deferred, "Deferred frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "excess_deferred", + &stats->tx_excess_deferred, "Excessively deferred frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "single_colls", + &stats->tx_single_colls, "Single collisions"); + ET_SYSCTL_STAT_ADD32(ctx, children, "multi_colls", + &stats->tx_multi_colls, "Multiple collisions"); + ET_SYSCTL_STAT_ADD32(ctx, children, "late_colls", + &stats->tx_late_colls, "Late collisions"); + ET_SYSCTL_STAT_ADD32(ctx, children, "excess_colls", + &stats->tx_excess_colls, "Excess collisions"); + ET_SYSCTL_STAT_ADD32(ctx, children, "total_colls", + &stats->tx_total_colls, "Total collisions"); + ET_SYSCTL_STAT_ADD32(ctx, children, "pause_honored", + &stats->tx_pause_honored, "Honored pause frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "drop", + &stats->tx_drop, "Dropped frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "jabbers", + &stats->tx_jabbers, "Frames with jabber errors"); + ET_SYSCTL_STAT_ADD32(ctx, children, "crc_errs", + &stats->tx_crcerrs, "Frames with CRC errors"); + ET_SYSCTL_STAT_ADD32(ctx, children, "control", + &stats->tx_control, "Control frames"); + ET_SYSCTL_STAT_ADD64(ctx, children, "oversize", + &stats->tx_oversize, "Oversized frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "undersize", + &stats->tx_undersize, "Undersized frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "fragments", + &stats->tx_fragments, "Fragmented frames"); } +#undef ET_SYSCTL_STAT_ADD32 +#undef ET_SYSCTL_STAT_ADD64 + static int et_sysctl_rx_intr_npkts(SYSCTL_HANDLER_ARGS) { @@ -2392,35 +2562,70 @@ back: } static void -et_setmedia(struct et_softc *sc) +et_stats_update(struct et_softc *sc) { - struct mii_data *mii = device_get_softc(sc->sc_miibus); - uint32_t cfg2, ctrl; - - cfg2 = CSR_READ_4(sc, ET_MAC_CFG2); - cfg2 &= ~(ET_MAC_CFG2_MODE_MII | ET_MAC_CFG2_MODE_GMII | - ET_MAC_CFG2_FDX | ET_MAC_CFG2_BIGFRM); - cfg2 |= ET_MAC_CFG2_LENCHK | ET_MAC_CFG2_CRC | ET_MAC_CFG2_PADCRC | - ((7 << ET_MAC_CFG2_PREAMBLE_LEN_SHIFT) & - ET_MAC_CFG2_PREAMBLE_LEN_MASK); - - ctrl = CSR_READ_4(sc, ET_MAC_CTRL); - ctrl &= ~(ET_MAC_CTRL_GHDX | ET_MAC_CTRL_MODE_MII); - - if (IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T) { - cfg2 |= ET_MAC_CFG2_MODE_GMII; - } else { - cfg2 |= ET_MAC_CFG2_MODE_MII; - ctrl |= ET_MAC_CTRL_MODE_MII; - } + struct ifnet *ifp; + struct et_hw_stats *stats; - if ((mii->mii_media_active & IFM_GMASK) == IFM_FDX) - cfg2 |= ET_MAC_CFG2_FDX; - else - ctrl |= ET_MAC_CTRL_GHDX; + stats = &sc->sc_stats; + stats->pkts_64 += CSR_READ_4(sc, ET_STAT_PKTS_64); + stats->pkts_65 += CSR_READ_4(sc, ET_STAT_PKTS_65_127); + stats->pkts_128 += CSR_READ_4(sc, ET_STAT_PKTS_128_255); + stats->pkts_256 += CSR_READ_4(sc, ET_STAT_PKTS_256_511); + stats->pkts_512 += CSR_READ_4(sc, ET_STAT_PKTS_512_1023); + stats->pkts_1024 += CSR_READ_4(sc, ET_STAT_PKTS_1024_1518); + stats->pkts_1519 += CSR_READ_4(sc, ET_STAT_PKTS_1519_1522); + + stats->rx_bytes += CSR_READ_4(sc, ET_STAT_RX_BYTES); + stats->rx_frames += CSR_READ_4(sc, ET_STAT_RX_FRAMES); + stats->rx_crcerrs += CSR_READ_4(sc, ET_STAT_RX_CRC_ERR); + stats->rx_mcast += CSR_READ_4(sc, ET_STAT_RX_MCAST); + stats->rx_bcast += CSR_READ_4(sc, ET_STAT_RX_BCAST); + stats->rx_control += CSR_READ_4(sc, ET_STAT_RX_CTL); + stats->rx_pause += CSR_READ_4(sc, ET_STAT_RX_PAUSE); + stats->rx_unknown_control += CSR_READ_4(sc, ET_STAT_RX_UNKNOWN_CTL); + stats->rx_alignerrs += CSR_READ_4(sc, ET_STAT_RX_ALIGN_ERR); + stats->rx_lenerrs += CSR_READ_4(sc, ET_STAT_RX_LEN_ERR); + stats->rx_codeerrs += CSR_READ_4(sc, ET_STAT_RX_CODE_ERR); + stats->rx_cserrs += CSR_READ_4(sc, ET_STAT_RX_CS_ERR); + stats->rx_runts += CSR_READ_4(sc, ET_STAT_RX_RUNT); + stats->rx_oversize += CSR_READ_4(sc, ET_STAT_RX_OVERSIZE); + stats->rx_fragments += CSR_READ_4(sc, ET_STAT_RX_FRAG); + stats->rx_jabbers += CSR_READ_4(sc, ET_STAT_RX_JABBER); + stats->rx_drop += CSR_READ_4(sc, ET_STAT_RX_DROP); + + stats->tx_bytes += CSR_READ_4(sc, ET_STAT_TX_BYTES); + stats->tx_frames += CSR_READ_4(sc, ET_STAT_TX_FRAMES); + stats->tx_mcast += CSR_READ_4(sc, ET_STAT_TX_MCAST); + stats->tx_bcast += CSR_READ_4(sc, ET_STAT_TX_BCAST); + stats->tx_pause += CSR_READ_4(sc, ET_STAT_TX_PAUSE); + stats->tx_deferred += CSR_READ_4(sc, ET_STAT_TX_DEFER); + stats->tx_excess_deferred += CSR_READ_4(sc, ET_STAT_TX_EXCESS_DEFER); + stats->tx_single_colls += CSR_READ_4(sc, ET_STAT_TX_SINGLE_COL); + stats->tx_multi_colls += CSR_READ_4(sc, ET_STAT_TX_MULTI_COL); + stats->tx_late_colls += CSR_READ_4(sc, ET_STAT_TX_LATE_COL); + stats->tx_excess_colls += CSR_READ_4(sc, ET_STAT_TX_EXCESS_COL); + stats->tx_total_colls += CSR_READ_4(sc, ET_STAT_TX_TOTAL_COL); + stats->tx_pause_honored += CSR_READ_4(sc, ET_STAT_TX_PAUSE_HONOR); + stats->tx_drop += CSR_READ_4(sc, ET_STAT_TX_DROP); + stats->tx_jabbers += CSR_READ_4(sc, ET_STAT_TX_JABBER); + stats->tx_crcerrs += CSR_READ_4(sc, ET_STAT_TX_CRC_ERR); + stats->tx_control += CSR_READ_4(sc, ET_STAT_TX_CTL); + stats->tx_oversize += CSR_READ_4(sc, ET_STAT_TX_OVERSIZE); + stats->tx_undersize += CSR_READ_4(sc, ET_STAT_TX_UNDERSIZE); + stats->tx_fragments += CSR_READ_4(sc, ET_STAT_TX_FRAG); - CSR_WRITE_4(sc, ET_MAC_CTRL, ctrl); - CSR_WRITE_4(sc, ET_MAC_CFG2, cfg2); + /* Update ifnet counters. */ + ifp = sc->ifp; + ifp->if_opackets = (u_long)stats->tx_frames; + ifp->if_collisions = stats->tx_total_colls; + ifp->if_oerrors = stats->tx_drop + stats->tx_jabbers + + stats->tx_crcerrs + stats->tx_excess_deferred + + stats->tx_late_colls; + ifp->if_ipackets = (u_long)stats->rx_frames; + ifp->if_ierrors = stats->rx_crcerrs + stats->rx_alignerrs + + stats->rx_lenerrs + stats->rx_codeerrs + stats->rx_cserrs + + stats->rx_runts + stats->rx_jabbers + stats->rx_drop; } static int Modified: stable/9/sys/dev/et/if_etreg.h ============================================================================== --- stable/9/sys/dev/et/if_etreg.h Fri Jan 6 19:12:47 2012 (r229719) +++ stable/9/sys/dev/et/if_etreg.h Fri Jan 6 19:24:33 2012 (r229720) @@ -318,6 +318,52 @@ #define ET_MAC_ADDR1 0x5040 #define ET_MAC_ADDR2 0x5044 +/* MAC statistics counters. */ +#define ET_STAT_PKTS_64 0x6080 +#define ET_STAT_PKTS_65_127 0x6084 +#define ET_STAT_PKTS_128_255 0x6088 +#define ET_STAT_PKTS_256_511 0x608C +#define ET_STAT_PKTS_512_1023 0x6090 +#define ET_STAT_PKTS_1024_1518 0x6094 +#define ET_STAT_PKTS_1519_1522 0x6098 +#define ET_STAT_RX_BYTES 0x609C +#define ET_STAT_RX_FRAMES 0x60A0 +#define ET_STAT_RX_CRC_ERR 0x60A4 +#define ET_STAT_RX_MCAST 0x60A8 +#define ET_STAT_RX_BCAST 0x60AC +#define ET_STAT_RX_CTL 0x60B0 +#define ET_STAT_RX_PAUSE 0x60B4 +#define ET_STAT_RX_UNKNOWN_CTL 0x60B8 +#define ET_STAT_RX_ALIGN_ERR 0x60BC +#define ET_STAT_RX_LEN_ERR 0x60C0 +#define ET_STAT_RX_CODE_ERR 0x60C4 +#define ET_STAT_RX_CS_ERR 0x60C8 +#define ET_STAT_RX_RUNT 0x60CC +#define ET_STAT_RX_OVERSIZE 0x60D0 +#define ET_STAT_RX_FRAG 0x60D4 +#define ET_STAT_RX_JABBER 0x60D8 +#define ET_STAT_RX_DROP 0x60DC +#define ET_STAT_TX_BYTES 0x60E0 +#define ET_STAT_TX_FRAMES 0x60E4 +#define ET_STAT_TX_MCAST 0x60E8 +#define ET_STAT_TX_BCAST 0x60EC +#define ET_STAT_TX_PAUSE 0x60F0 +#define ET_STAT_TX_DEFER 0x60F4 +#define ET_STAT_TX_EXCESS_DEFER 0x60F8 +#define ET_STAT_TX_SINGLE_COL 0x60FC +#define ET_STAT_TX_MULTI_COL 0x6100 +#define ET_STAT_TX_LATE_COL 0x6104 +#define ET_STAT_TX_EXCESS_COL 0x6108 +#define ET_STAT_TX_TOTAL_COL 0x610C +#define ET_STAT_TX_PAUSE_HONOR 0x6110 +#define ET_STAT_TX_DROP 0x6114 +#define ET_STAT_TX_JABBER 0x6118 +#define ET_STAT_TX_CRC_ERR 0x611C +#define ET_STAT_TX_CTL 0x6120 +#define ET_STAT_TX_OVERSIZE 0x6124 +#define ET_STAT_TX_UNDERSIZE 0x6128 +#define ET_STAT_TX_FRAG 0x612C + #define ET_MMC_CTRL 0x7000 #define ET_MMC_CTRL_ENABLE 0x00000001 #define ET_MMC_CTRL_ARB_DISABLE 0x00000002 Modified: stable/9/sys/dev/et/if_etvar.h ============================================================================== --- stable/9/sys/dev/et/if_etvar.h Fri Jan 6 19:12:47 2012 (r229719) +++ stable/9/sys/dev/et/if_etvar.h Fri Jan 6 19:24:33 2012 (r229720) @@ -41,7 +41,7 @@ #define ET_RING_ALIGN 4096 #define ET_STATUS_ALIGN 8 #define ET_NSEG_MAX 32 /* XXX no limit actually */ -#define ET_NSEG_SPARE 8 +#define ET_NSEG_SPARE 4 #define ET_TX_NDESC 512 #define ET_RX_NDESC 512 @@ -231,6 +231,56 @@ struct et_rxbuf_data { void (*rbd_discard)(struct et_rxbuf_data *, int); }; +struct et_hw_stats { + /* RX/TX stats. */ + uint64_t pkts_64; + uint64_t pkts_65; + uint64_t pkts_128; + uint64_t pkts_256; + uint64_t pkts_512; + uint64_t pkts_1024; + uint64_t pkts_1519; + /* RX stats. */ + uint64_t rx_bytes; + uint64_t rx_frames; + uint32_t rx_crcerrs; + uint64_t rx_mcast; + uint64_t rx_bcast; + uint32_t rx_control; + uint32_t rx_pause; + uint32_t rx_unknown_control; + uint32_t rx_alignerrs; + uint32_t rx_lenerrs; + uint32_t rx_codeerrs; + uint32_t rx_cserrs; + uint32_t rx_runts; + uint64_t rx_oversize; + uint32_t rx_fragments; + uint32_t rx_jabbers; + uint32_t rx_drop; + /* TX stats. */ + uint64_t tx_bytes; + uint64_t tx_frames; + uint64_t tx_mcast; + uint64_t tx_bcast; + uint32_t tx_pause; + uint32_t tx_deferred; + uint32_t tx_excess_deferred; + uint32_t tx_single_colls; + uint32_t tx_multi_colls; + uint32_t tx_late_colls; + uint32_t tx_excess_colls; + uint32_t tx_total_colls; + uint32_t tx_pause_honored; + uint32_t tx_drop; + uint32_t tx_jabbers; + uint32_t tx_crcerrs; + uint32_t tx_control; + uint64_t tx_oversize; + uint32_t tx_undersize; + uint32_t tx_fragments; +}; + struct et_softc { struct ifnet *ifp; device_t dev; @@ -271,6 +321,7 @@ struct et_softc { struct et_rxbuf_data sc_rx_data[ET_RX_NRING]; struct et_txbuf_data sc_tx_data; + struct et_hw_stats sc_stats; uint32_t sc_tx; uint32_t sc_tx_intr; @@ -289,7 +340,9 @@ struct et_softc { #define ET_FLAG_PCIE 0x0001 #define ET_FLAG_MSI 0x0002 +#define ET_FLAG_FASTETHER 0x0004 #define ET_FLAG_TXRX_ENABLED 0x0100 #define ET_FLAG_JUMBO 0x0200 +#define ET_FLAG_LINK 0x8000 #endif /* !_IF_ETVAR_H */ From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 19:26:31 2012 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 831E21065672; Fri, 6 Jan 2012 19:26:31 +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 6B10B8FC08; Fri, 6 Jan 2012 19:26:31 +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 q06JQVKQ004070; Fri, 6 Jan 2012 19:26:31 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06JQVsU004066; Fri, 6 Jan 2012 19:26:31 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201061926.q06JQVsU004066@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 6 Jan 2012 19:26:31 +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: r229721 - stable/8/sys/dev/et 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, 06 Jan 2012 19:26:31 -0000 Author: yongari Date: Fri Jan 6 19:26:31 2012 New Revision: 229721 URL: http://svn.freebsd.org/changeset/base/229721 Log: MFC r228326-228327,228331-228332: r228326: Controller does not require TX start command for every frame. So send a single TX command after setting up all TX frames. This removes unnecessary register accesses and bus_dmamap_sync(9) calls. et(4) uses TX interrupt moderation so it's possible to have TX buffers that were already transmitted but waiting for TX completion interrupt. If the number of available TX descriptor is less then 1/3 of total TX descriptor, try reclaiming first to get enough free TX descriptors before setting up TX descriptors. After r228325, et_txeof() no longer tries to send frames after reclaiming TX buffers. That change was made to give more chance to transmit frames in main interrupt handler since we can still send frames in interrupt handler with RX interrupt. So right before exiting interrupt hander, after enabling interrupt, try to send more frames. This gives slightly better performance numbers. While I'm here reduce number of spare TX descriptors from 8 to 4. Controller does not require reserved TX descriptors, it was just to reduce TX overhead. After r228325, driver has much lower TX overhead so it does not make sense to reserve 8 TX descriptors. r228327: Remove et_enable_intrs(), et_disable_intrs() functions and manipulation of interrupt register access is done through CSR_WRITE_4 macro. Also add disabling interrupt into et_reset() because we want interrupt disabled state after controller reset. While I'm here slightly change interrupt handler to be more readable one. r228331: Rework link state tracking and TX/RX MAC configuration. o Do not report link status if driver is not running. o TX/RX MAC configuration should be done with resolved speed, duplex and flow control after establishing a link so it can't be done in driver initialization routine. Move the configuration to miibus_statchg callback which will be called whenever any link state change is detected. At this moment, flow-control is not enabled yet mainly because I was not able to set correct flow control parameters to generate TX pause frames. o Now TX/RX MAC is enabled only when a valid link is detected. Rearragnge hardware initialization routine a bit to leave enabling MAC to miibus_statchg callback. In order to that, TX/RX DMA engine is enabled in et_init_locked(). o Introduce ET_FLAG_LINK flag to track current link state. o Introduce ET_FLAG_FASTETHER flag to mark whether controller is fast ethernet. This flag is checked in miibus_statchg callback to know whether PHY established a valid link. o In et_stop(), TX/RX MAC is explicitly disabled instead of relying on et_reset(). And move et_reset() from et_stop() to controller initialization. Controler reset is not required here and it would also clear critial registers(i.e station address, RX filter configuration, WOL etc) that are required to make WOL work. o Switching to current media is done in et_init_locked() after setting IFF_DRV_RUNNING flag. This should ensure reliable auto-negotiation/manual link establishment. o In et_start_locked(), check whether driver got a valid link before trying to send frames. o Remove checking a link in et_tick() as this is done by miibus_statchg callback. r228332: Implement hardware MAC statistics counter. Counters could be queried with dev.et.%d.stats sysctl node where %d is an instance of device. Modified: stable/8/sys/dev/et/if_et.c stable/8/sys/dev/et/if_etreg.h stable/8/sys/dev/et/if_etvar.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/et/if_et.c ============================================================================== --- stable/8/sys/dev/et/if_et.c Fri Jan 6 19:24:33 2012 (r229720) +++ stable/8/sys/dev/et/if_et.c Fri Jan 6 19:26:31 2012 (r229721) @@ -110,8 +110,6 @@ static int et_sysctl_rx_intr_npkts(SYSCT static int et_sysctl_rx_intr_delay(SYSCTL_HANDLER_ARGS); static void et_intr(void *); -static void et_enable_intrs(struct et_softc *, uint32_t); -static void et_disable_intrs(struct et_softc *); static void et_rxeof(struct et_softc *); static void et_txeof(struct et_softc *); @@ -144,13 +142,12 @@ static int et_start_rxdma(struct et_soft static int et_start_txdma(struct et_softc *); static int et_stop_rxdma(struct et_softc *); static int et_stop_txdma(struct et_softc *); -static int et_enable_txrx(struct et_softc *, int); static void et_reset(struct et_softc *); static int et_bus_config(struct et_softc *); static void et_get_eaddr(device_t, uint8_t[]); static void et_setmulti(struct et_softc *); static void et_tick(void *); -static void et_setmedia(struct et_softc *); +static void et_stats_update(struct et_softc *); static const struct et_dev { uint16_t vid; @@ -302,6 +299,9 @@ et_attach(device_t dev) goto fail; } + if (pci_get_device(dev) == PCI_PRODUCT_LUCENT_ET1310_FAST) + sc->sc_flags |= ET_FLAG_FASTETHER; + error = et_bus_config(sc); if (error) goto fail; @@ -313,8 +313,6 @@ et_attach(device_t dev) et_reset(sc); - et_disable_intrs(sc); - error = et_dma_alloc(sc); if (error) goto fail; @@ -495,7 +493,89 @@ et_miibus_writereg(device_t dev, int phy static void et_miibus_statchg(device_t dev) { - et_setmedia(device_get_softc(dev)); + struct et_softc *sc; + struct mii_data *mii; + struct ifnet *ifp; + uint32_t cfg1, cfg2, ctrl; + int i; + + sc = device_get_softc(dev); + + mii = device_get_softc(sc->sc_miibus); + ifp = sc->ifp; + if (mii == NULL || ifp == NULL || + (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + return; + + sc->sc_flags &= ~ET_FLAG_LINK; + if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == + (IFM_ACTIVE | IFM_AVALID)) { + switch (IFM_SUBTYPE(mii->mii_media_active)) { + case IFM_10_T: + case IFM_100_TX: + sc->sc_flags |= ET_FLAG_LINK; + break; + case IFM_1000_T: + if ((sc->sc_flags & ET_FLAG_FASTETHER) == 0) + sc->sc_flags |= ET_FLAG_LINK; + break; + } + } + + /* XXX Stop TX/RX MAC? */ + if ((sc->sc_flags & ET_FLAG_LINK) == 0) + return; + + /* Program MACs with resolved speed/duplex/flow-control. */ + ctrl = CSR_READ_4(sc, ET_MAC_CTRL); + ctrl &= ~(ET_MAC_CTRL_GHDX | ET_MAC_CTRL_MODE_MII); + cfg1 = CSR_READ_4(sc, ET_MAC_CFG1); + cfg1 &= ~(ET_MAC_CFG1_TXFLOW | ET_MAC_CFG1_RXFLOW | + ET_MAC_CFG1_LOOPBACK); + cfg2 = CSR_READ_4(sc, ET_MAC_CFG2); + cfg2 &= ~(ET_MAC_CFG2_MODE_MII | ET_MAC_CFG2_MODE_GMII | + ET_MAC_CFG2_FDX | ET_MAC_CFG2_BIGFRM); + cfg2 |= ET_MAC_CFG2_LENCHK | ET_MAC_CFG2_CRC | ET_MAC_CFG2_PADCRC | + ((7 << ET_MAC_CFG2_PREAMBLE_LEN_SHIFT) & + ET_MAC_CFG2_PREAMBLE_LEN_MASK); + + if (IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T) + cfg2 |= ET_MAC_CFG2_MODE_GMII; + else { + cfg2 |= ET_MAC_CFG2_MODE_MII; + ctrl |= ET_MAC_CTRL_MODE_MII; + } + + if (IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) { + cfg2 |= ET_MAC_CFG2_FDX; +#ifdef notyet + if (IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_TXPAUSE) + cfg1 |= ET_MAC_CFG1_TXFLOW; + if (IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_RXPAUSE) + cfg1 |= ET_MAC_CFG1_RXFLOW; +#endif + } else + ctrl |= ET_MAC_CTRL_GHDX; + + CSR_WRITE_4(sc, ET_MAC_CTRL, ctrl); + CSR_WRITE_4(sc, ET_MAC_CFG2, cfg2); + cfg1 |= ET_MAC_CFG1_TXEN | ET_MAC_CFG1_RXEN; + CSR_WRITE_4(sc, ET_MAC_CFG1, cfg1); + +#define NRETRY 50 + + for (i = 0; i < NRETRY; ++i) { + cfg1 = CSR_READ_4(sc, ET_MAC_CFG1); + if ((cfg1 & (ET_MAC_CFG1_SYNC_TXEN | ET_MAC_CFG1_SYNC_RXEN)) == + (ET_MAC_CFG1_SYNC_TXEN | ET_MAC_CFG1_SYNC_RXEN)) + break; + DELAY(100); + } + if (i == NRETRY) + if_printf(ifp, "can't enable RX/TX\n"); + sc->sc_flags |= ET_FLAG_TXRX_ENABLED; + +#undef NRETRY } static int @@ -526,10 +606,17 @@ et_ifmedia_upd(struct ifnet *ifp) static void et_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) { - struct et_softc *sc = ifp->if_softc; - struct mii_data *mii = device_get_softc(sc->sc_miibus); + struct et_softc *sc; + struct mii_data *mii; + sc = ifp->if_softc; ET_LOCK(sc); + if ((ifp->if_flags & IFF_UP) == 0) { + ET_UNLOCK(sc); + return; + } + + mii = device_get_softc(sc->sc_miibus); mii_pollstat(mii); ifmr->ifm_active = mii->mii_media_active; ifmr->ifm_status = mii->mii_media_status; @@ -544,17 +631,20 @@ et_stop(struct et_softc *sc) ET_LOCK_ASSERT(sc); callout_stop(&sc->sc_tick); + /* Disable interrupts. */ + CSR_WRITE_4(sc, ET_INTR_MASK, 0xffffffff); + + CSR_WRITE_4(sc, ET_MAC_CFG1, CSR_READ_4(sc, ET_MAC_CFG1) & ~( + ET_MAC_CFG1_TXEN | ET_MAC_CFG1_RXEN)); + DELAY(100); et_stop_rxdma(sc); et_stop_txdma(sc); - - et_disable_intrs(sc); + et_stats_update(sc); et_free_tx_ring(sc); et_free_rx_ring(sc); - et_reset(sc); - sc->sc_tx = 0; sc->sc_tx_intr = 0; sc->sc_flags &= ~ET_FLAG_TXRX_ENABLED; @@ -674,20 +764,10 @@ et_reset(struct et_softc *sc) ET_MAC_CFG1_RST_TXFUNC | ET_MAC_CFG1_RST_RXFUNC | ET_MAC_CFG1_RST_TXMC | ET_MAC_CFG1_RST_RXMC); CSR_WRITE_4(sc, ET_MAC_CFG1, 0); -} - -static void -et_disable_intrs(struct et_softc *sc) -{ + /* Disable interrupts. */ CSR_WRITE_4(sc, ET_INTR_MASK, 0xffffffff); } -static void -et_enable_intrs(struct et_softc *sc, uint32_t intrs) -{ - CSR_WRITE_4(sc, ET_INTR_MASK, ~intrs); -} - struct et_dmamap_arg { bus_addr_t et_busaddr; }; @@ -1087,12 +1167,12 @@ et_intr(void *xsc) return; } - et_disable_intrs(sc); + /* Disable further interrupts. */ + CSR_WRITE_4(sc, ET_INTR_MASK, 0xffffffff); intrs = CSR_READ_4(sc, ET_INTR_STATUS); - intrs &= ET_INTRS; - if (intrs == 0) /* Not interested */ - goto back; + if ((intrs & ET_INTRS) == 0) + goto done; if (intrs & ET_INTR_RXEOF) et_rxeof(sc); @@ -1100,8 +1180,12 @@ et_intr(void *xsc) et_txeof(sc); if (intrs & ET_INTR_TIMER) CSR_WRITE_4(sc, ET_TIMER, sc->sc_timer); -back: - et_enable_intrs(sc, ET_INTRS); +done: + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + CSR_WRITE_4(sc, ET_INTR_MASK, ~ET_INTRS); + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + et_start_locked(ifp); + } ET_UNLOCK(sc); } @@ -1118,6 +1202,7 @@ et_init_locked(struct et_softc *sc) return; et_stop(sc); + et_reset(sc); et_init_tx_ring(sc); error = et_init_rx_ring(sc); @@ -1126,21 +1211,33 @@ et_init_locked(struct et_softc *sc) error = et_chip_init(sc); if (error) - goto back; + goto fail; - error = et_enable_txrx(sc, 1); + /* + * Start TX/RX DMA engine + */ + error = et_start_rxdma(sc); if (error) - goto back; + return; - et_enable_intrs(sc, ET_INTRS); + error = et_start_txdma(sc); + if (error) + return; - callout_reset(&sc->sc_tick, hz, et_tick, sc); + /* Enable interrupts. */ + CSR_WRITE_4(sc, ET_INTR_MASK, ~ET_INTRS); CSR_WRITE_4(sc, ET_TIMER, sc->sc_timer); ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; -back: + + sc->sc_flags &= ~ET_FLAG_LINK; + et_ifmedia_upd_locked(ifp); + + callout_reset(&sc->sc_tick, hz, et_tick, sc); + +fail: if (error) et_stop(sc); } @@ -1244,19 +1341,32 @@ et_start_locked(struct ifnet *ifp) { struct et_softc *sc; struct mbuf *m_head = NULL; + struct et_txdesc_ring *tx_ring; struct et_txbuf_data *tbd; + uint32_t tx_ready_pos; int enq; sc = ifp->if_softc; ET_LOCK_ASSERT(sc); - if ((sc->sc_flags & ET_FLAG_TXRX_ENABLED) == 0) - return; - - if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING) + if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != + IFF_DRV_RUNNING || + (sc->sc_flags & (ET_FLAG_LINK | ET_FLAG_TXRX_ENABLED)) != + (ET_FLAG_LINK | ET_FLAG_TXRX_ENABLED)) return; + /* + * Driver does not request TX completion interrupt for every + * queued frames to prevent generating excessive interrupts. + * This means driver may wait for TX completion interrupt even + * though some frames were sucessfully transmitted. Reclaiming + * transmitted frames will ensure driver see all available + * descriptors. + */ tbd = &sc->sc_tx_data; + if (tbd->tbd_used > (ET_TX_NDESC * 2) / 3) + et_txeof(sc); + for (enq = 0; !IFQ_DRV_IS_EMPTY(&ifp->if_snd); ) { if (tbd->tbd_used + ET_NSEG_SPARE >= ET_TX_NDESC) { ifp->if_drv_flags |= IFF_DRV_OACTIVE; @@ -1281,8 +1391,17 @@ et_start_locked(struct ifnet *ifp) ETHER_BPF_MTAP(ifp, m_head); } - if (enq > 0) + if (enq > 0) { + tx_ring = &sc->sc_tx_ring; + bus_dmamap_sync(tx_ring->tr_dtag, tx_ring->tr_dmap, + BUS_DMASYNC_PREWRITE); + tx_ready_pos = tx_ring->tr_ready_index & + ET_TX_READY_POS_INDEX_MASK; + if (tx_ring->tr_ready_wrap) + tx_ready_pos |= ET_TX_READY_POS_WRAP; + CSR_WRITE_4(sc, ET_TX_READY_POS, tx_ready_pos); sc->watchdog_timer = 5; + } } static void @@ -1861,56 +1980,6 @@ et_start_txdma(struct et_softc *sc) return (0); } -static int -et_enable_txrx(struct et_softc *sc, int media_upd) -{ - struct ifnet *ifp = sc->ifp; - uint32_t val; - int i, error; - - val = CSR_READ_4(sc, ET_MAC_CFG1); - val |= ET_MAC_CFG1_TXEN | ET_MAC_CFG1_RXEN; - val &= ~(ET_MAC_CFG1_TXFLOW | ET_MAC_CFG1_RXFLOW | - ET_MAC_CFG1_LOOPBACK); - CSR_WRITE_4(sc, ET_MAC_CFG1, val); - - if (media_upd) - et_ifmedia_upd_locked(ifp); - else - et_setmedia(sc); - -#define NRETRY 50 - - for (i = 0; i < NRETRY; ++i) { - val = CSR_READ_4(sc, ET_MAC_CFG1); - if ((val & (ET_MAC_CFG1_SYNC_TXEN | ET_MAC_CFG1_SYNC_RXEN)) == - (ET_MAC_CFG1_SYNC_TXEN | ET_MAC_CFG1_SYNC_RXEN)) - break; - - DELAY(100); - } - if (i == NRETRY) { - if_printf(ifp, "can't enable RX/TX\n"); - return (0); - } - sc->sc_flags |= ET_FLAG_TXRX_ENABLED; - -#undef NRETRY - - /* - * Start TX/RX DMA engine - */ - error = et_start_rxdma(sc); - if (error) - return (error); - - error = et_start_txdma(sc); - if (error) - return (error); - - return (0); -} - static void et_rxeof(struct et_softc *sc) { @@ -1986,7 +2055,6 @@ et_rxeof(struct et_softc *sc) m = rbd->rbd_buf[buf_idx].rb_mbuf; if ((rxst_info1 & ET_RXST_INFO1_OK) == 0){ /* Discard errored frame. */ - ifp->if_ierrors++; rbd->rbd_discard(rbd, buf_idx); } else if (rbd->rbd_newbuf(rbd, buf_idx) != 0) { /* No available mbufs, discard it. */ @@ -2000,7 +2068,6 @@ et_rxeof(struct et_softc *sc) } else { m->m_pkthdr.len = m->m_len = buflen; m->m_pkthdr.rcvif = ifp; - ifp->if_ipackets++; ET_UNLOCK(sc); ifp->if_input(ifp, m); ET_LOCK(sc); @@ -2040,7 +2107,7 @@ et_encap(struct et_softc *sc, struct mbu struct mbuf *m; bus_dma_segment_t segs[ET_NSEG_MAX]; bus_dmamap_t map; - uint32_t csum_flags, last_td_ctrl2, tx_ready_pos; + uint32_t csum_flags, last_td_ctrl2; int error, i, idx, first_idx, last_idx, nsegs; tx_ring = &sc->sc_tx_ring; @@ -2125,12 +2192,6 @@ et_encap(struct et_softc *sc, struct mbu tbd->tbd_used += nsegs; MPASS(tbd->tbd_used <= ET_TX_NDESC); - bus_dmamap_sync(tx_ring->tr_dtag, tx_ring->tr_dmap, - BUS_DMASYNC_PREWRITE); - tx_ready_pos = tx_ring->tr_ready_index & ET_TX_READY_POS_INDEX_MASK; - if (tx_ring->tr_ready_wrap) - tx_ready_pos |= ET_TX_READY_POS_WRAP; - CSR_WRITE_4(sc, ET_TX_READY_POS, tx_ready_pos); return (0); } @@ -2172,7 +2233,6 @@ et_txeof(struct et_softc *sc) bus_dmamap_unload(sc->sc_tx_tag, tb->tb_dmap); m_freem(tb->tb_mbuf); tb->tb_mbuf = NULL; - ifp->if_opackets++; } if (++tbd->tbd_start_index == ET_TX_NDESC) { @@ -2189,6 +2249,7 @@ et_txeof(struct et_softc *sc) if (tbd->tbd_used + ET_NSEG_SPARE < ET_TX_NDESC) ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; } + static void et_tick(void *xsc) { @@ -2201,13 +2262,7 @@ et_tick(void *xsc) mii = device_get_softc(sc->sc_miibus); mii_tick(mii); - if ((sc->sc_flags & ET_FLAG_TXRX_ENABLED) == 0 && - (mii->mii_media_status & IFM_ACTIVE) && - IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) { - if_printf(ifp, "Link up, enable TX/RX\n"); - if (et_enable_txrx(sc, 0) == 0) - et_start_locked(ifp); - } + et_stats_update(sc); if (et_watchdog(sc) == EJUSTRETURN) return; callout_reset(&sc->sc_tick, hz, et_tick, sc); @@ -2320,6 +2375,11 @@ et_newbuf_hdr(struct et_rxbuf_data *rbd, return (0); } +#define ET_SYSCTL_STAT_ADD32(c, h, n, p, d) \ + SYSCTL_ADD_UINT(c, h, OID_AUTO, n, CTLFLAG_RD, p, 0, d) +#define ET_SYSCTL_STAT_ADD64(c, h, n, p, d) \ + SYSCTL_ADD_UQUAD(c, h, OID_AUTO, n, CTLFLAG_RD, p, d) + /* * Create sysctl tree */ @@ -2327,7 +2387,9 @@ static void et_add_sysctls(struct et_softc * sc) { struct sysctl_ctx_list *ctx; - struct sysctl_oid_list *children; + struct sysctl_oid_list *children, *parent; + struct sysctl_oid *tree; + struct et_hw_stats *stats; ctx = device_get_sysctl_ctx(sc->dev); children = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->dev)); @@ -2343,8 +2405,116 @@ et_add_sysctls(struct et_softc * sc) "TX IM, # segments per TX interrupt"); SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "timer", CTLFLAG_RW, &sc->sc_timer, 0, "TX timer"); + + tree = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, "stats", CTLFLAG_RD, + NULL, "ET statistics"); + parent = SYSCTL_CHILDREN(tree); + + /* TX/RX statistics. */ + stats = &sc->sc_stats; + ET_SYSCTL_STAT_ADD64(ctx, parent, "frames_64", &stats->pkts_64, + "0 to 64 bytes frames"); + ET_SYSCTL_STAT_ADD64(ctx, parent, "frames_65_127", &stats->pkts_65, + "65 to 127 bytes frames"); + ET_SYSCTL_STAT_ADD64(ctx, parent, "frames_128_255", &stats->pkts_128, + "128 to 255 bytes frames"); + ET_SYSCTL_STAT_ADD64(ctx, parent, "frames_256_511", &stats->pkts_256, + "256 to 511 bytes frames"); + ET_SYSCTL_STAT_ADD64(ctx, parent, "frames_512_1023", &stats->pkts_512, + "512 to 1023 bytes frames"); + ET_SYSCTL_STAT_ADD64(ctx, parent, "frames_1024_1518", &stats->pkts_1024, + "1024 to 1518 bytes frames"); + ET_SYSCTL_STAT_ADD64(ctx, parent, "frames_1519_1522", &stats->pkts_1519, + "1519 to 1522 bytes frames"); + + /* RX statistics. */ + tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "rx", CTLFLAG_RD, + NULL, "RX MAC statistics"); + children = SYSCTL_CHILDREN(tree); + ET_SYSCTL_STAT_ADD64(ctx, children, "bytes", + &stats->rx_bytes, "Good bytes"); + ET_SYSCTL_STAT_ADD64(ctx, children, "frames", + &stats->rx_frames, "Good frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "crc_errs", + &stats->rx_crcerrs, "CRC errors"); + ET_SYSCTL_STAT_ADD64(ctx, children, "mcast_frames", + &stats->rx_mcast, "Multicast frames"); + ET_SYSCTL_STAT_ADD64(ctx, children, "bcast_frames", + &stats->rx_bcast, "Broadcast frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "control", + &stats->rx_control, "Control frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "pause", + &stats->rx_pause, "Pause frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "unknown_control", + &stats->rx_unknown_control, "Unknown control frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "align_errs", + &stats->rx_alignerrs, "Alignment errors"); + ET_SYSCTL_STAT_ADD32(ctx, children, "len_errs", + &stats->rx_lenerrs, "Frames with length mismatched"); + ET_SYSCTL_STAT_ADD32(ctx, children, "code_errs", + &stats->rx_codeerrs, "Frames with code error"); + ET_SYSCTL_STAT_ADD32(ctx, children, "cs_errs", + &stats->rx_cserrs, "Frames with carrier sense error"); + ET_SYSCTL_STAT_ADD32(ctx, children, "runts", + &stats->rx_runts, "Too short frames"); + ET_SYSCTL_STAT_ADD64(ctx, children, "oversize", + &stats->rx_oversize, "Oversized frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "fragments", + &stats->rx_fragments, "Fragmented frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "jabbers", + &stats->rx_jabbers, "Frames with jabber error"); + ET_SYSCTL_STAT_ADD32(ctx, children, "drop", + &stats->rx_drop, "Dropped frames"); + + /* TX statistics. */ + tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "tx", CTLFLAG_RD, + NULL, "TX MAC statistics"); + children = SYSCTL_CHILDREN(tree); + ET_SYSCTL_STAT_ADD64(ctx, children, "bytes", + &stats->tx_bytes, "Good bytes"); + ET_SYSCTL_STAT_ADD64(ctx, children, "frames", + &stats->tx_frames, "Good frames"); + ET_SYSCTL_STAT_ADD64(ctx, children, "mcast_frames", + &stats->tx_mcast, "Multicast frames"); + ET_SYSCTL_STAT_ADD64(ctx, children, "bcast_frames", + &stats->tx_bcast, "Broadcast frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "pause", + &stats->tx_pause, "Pause frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "deferred", + &stats->tx_deferred, "Deferred frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "excess_deferred", + &stats->tx_excess_deferred, "Excessively deferred frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "single_colls", + &stats->tx_single_colls, "Single collisions"); + ET_SYSCTL_STAT_ADD32(ctx, children, "multi_colls", + &stats->tx_multi_colls, "Multiple collisions"); + ET_SYSCTL_STAT_ADD32(ctx, children, "late_colls", + &stats->tx_late_colls, "Late collisions"); + ET_SYSCTL_STAT_ADD32(ctx, children, "excess_colls", + &stats->tx_excess_colls, "Excess collisions"); + ET_SYSCTL_STAT_ADD32(ctx, children, "total_colls", + &stats->tx_total_colls, "Total collisions"); + ET_SYSCTL_STAT_ADD32(ctx, children, "pause_honored", + &stats->tx_pause_honored, "Honored pause frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "drop", + &stats->tx_drop, "Dropped frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "jabbers", + &stats->tx_jabbers, "Frames with jabber errors"); + ET_SYSCTL_STAT_ADD32(ctx, children, "crc_errs", + &stats->tx_crcerrs, "Frames with CRC errors"); + ET_SYSCTL_STAT_ADD32(ctx, children, "control", + &stats->tx_control, "Control frames"); + ET_SYSCTL_STAT_ADD64(ctx, children, "oversize", + &stats->tx_oversize, "Oversized frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "undersize", + &stats->tx_undersize, "Undersized frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "fragments", + &stats->tx_fragments, "Fragmented frames"); } +#undef ET_SYSCTL_STAT_ADD32 +#undef ET_SYSCTL_STAT_ADD64 + static int et_sysctl_rx_intr_npkts(SYSCTL_HANDLER_ARGS) { @@ -2396,35 +2566,70 @@ back: } static void -et_setmedia(struct et_softc *sc) +et_stats_update(struct et_softc *sc) { - struct mii_data *mii = device_get_softc(sc->sc_miibus); - uint32_t cfg2, ctrl; - - cfg2 = CSR_READ_4(sc, ET_MAC_CFG2); - cfg2 &= ~(ET_MAC_CFG2_MODE_MII | ET_MAC_CFG2_MODE_GMII | - ET_MAC_CFG2_FDX | ET_MAC_CFG2_BIGFRM); - cfg2 |= ET_MAC_CFG2_LENCHK | ET_MAC_CFG2_CRC | ET_MAC_CFG2_PADCRC | - ((7 << ET_MAC_CFG2_PREAMBLE_LEN_SHIFT) & - ET_MAC_CFG2_PREAMBLE_LEN_MASK); - - ctrl = CSR_READ_4(sc, ET_MAC_CTRL); - ctrl &= ~(ET_MAC_CTRL_GHDX | ET_MAC_CTRL_MODE_MII); - - if (IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T) { - cfg2 |= ET_MAC_CFG2_MODE_GMII; - } else { - cfg2 |= ET_MAC_CFG2_MODE_MII; - ctrl |= ET_MAC_CTRL_MODE_MII; - } + struct ifnet *ifp; + struct et_hw_stats *stats; - if ((mii->mii_media_active & IFM_GMASK) == IFM_FDX) - cfg2 |= ET_MAC_CFG2_FDX; - else - ctrl |= ET_MAC_CTRL_GHDX; + stats = &sc->sc_stats; + stats->pkts_64 += CSR_READ_4(sc, ET_STAT_PKTS_64); + stats->pkts_65 += CSR_READ_4(sc, ET_STAT_PKTS_65_127); + stats->pkts_128 += CSR_READ_4(sc, ET_STAT_PKTS_128_255); + stats->pkts_256 += CSR_READ_4(sc, ET_STAT_PKTS_256_511); + stats->pkts_512 += CSR_READ_4(sc, ET_STAT_PKTS_512_1023); + stats->pkts_1024 += CSR_READ_4(sc, ET_STAT_PKTS_1024_1518); + stats->pkts_1519 += CSR_READ_4(sc, ET_STAT_PKTS_1519_1522); + + stats->rx_bytes += CSR_READ_4(sc, ET_STAT_RX_BYTES); + stats->rx_frames += CSR_READ_4(sc, ET_STAT_RX_FRAMES); + stats->rx_crcerrs += CSR_READ_4(sc, ET_STAT_RX_CRC_ERR); + stats->rx_mcast += CSR_READ_4(sc, ET_STAT_RX_MCAST); + stats->rx_bcast += CSR_READ_4(sc, ET_STAT_RX_BCAST); + stats->rx_control += CSR_READ_4(sc, ET_STAT_RX_CTL); + stats->rx_pause += CSR_READ_4(sc, ET_STAT_RX_PAUSE); + stats->rx_unknown_control += CSR_READ_4(sc, ET_STAT_RX_UNKNOWN_CTL); + stats->rx_alignerrs += CSR_READ_4(sc, ET_STAT_RX_ALIGN_ERR); + stats->rx_lenerrs += CSR_READ_4(sc, ET_STAT_RX_LEN_ERR); + stats->rx_codeerrs += CSR_READ_4(sc, ET_STAT_RX_CODE_ERR); + stats->rx_cserrs += CSR_READ_4(sc, ET_STAT_RX_CS_ERR); + stats->rx_runts += CSR_READ_4(sc, ET_STAT_RX_RUNT); + stats->rx_oversize += CSR_READ_4(sc, ET_STAT_RX_OVERSIZE); + stats->rx_fragments += CSR_READ_4(sc, ET_STAT_RX_FRAG); + stats->rx_jabbers += CSR_READ_4(sc, ET_STAT_RX_JABBER); + stats->rx_drop += CSR_READ_4(sc, ET_STAT_RX_DROP); + + stats->tx_bytes += CSR_READ_4(sc, ET_STAT_TX_BYTES); + stats->tx_frames += CSR_READ_4(sc, ET_STAT_TX_FRAMES); + stats->tx_mcast += CSR_READ_4(sc, ET_STAT_TX_MCAST); + stats->tx_bcast += CSR_READ_4(sc, ET_STAT_TX_BCAST); + stats->tx_pause += CSR_READ_4(sc, ET_STAT_TX_PAUSE); + stats->tx_deferred += CSR_READ_4(sc, ET_STAT_TX_DEFER); + stats->tx_excess_deferred += CSR_READ_4(sc, ET_STAT_TX_EXCESS_DEFER); + stats->tx_single_colls += CSR_READ_4(sc, ET_STAT_TX_SINGLE_COL); + stats->tx_multi_colls += CSR_READ_4(sc, ET_STAT_TX_MULTI_COL); + stats->tx_late_colls += CSR_READ_4(sc, ET_STAT_TX_LATE_COL); + stats->tx_excess_colls += CSR_READ_4(sc, ET_STAT_TX_EXCESS_COL); + stats->tx_total_colls += CSR_READ_4(sc, ET_STAT_TX_TOTAL_COL); + stats->tx_pause_honored += CSR_READ_4(sc, ET_STAT_TX_PAUSE_HONOR); + stats->tx_drop += CSR_READ_4(sc, ET_STAT_TX_DROP); + stats->tx_jabbers += CSR_READ_4(sc, ET_STAT_TX_JABBER); + stats->tx_crcerrs += CSR_READ_4(sc, ET_STAT_TX_CRC_ERR); + stats->tx_control += CSR_READ_4(sc, ET_STAT_TX_CTL); + stats->tx_oversize += CSR_READ_4(sc, ET_STAT_TX_OVERSIZE); + stats->tx_undersize += CSR_READ_4(sc, ET_STAT_TX_UNDERSIZE); + stats->tx_fragments += CSR_READ_4(sc, ET_STAT_TX_FRAG); - CSR_WRITE_4(sc, ET_MAC_CTRL, ctrl); - CSR_WRITE_4(sc, ET_MAC_CFG2, cfg2); + /* Update ifnet counters. */ + ifp = sc->ifp; + ifp->if_opackets = (u_long)stats->tx_frames; + ifp->if_collisions = stats->tx_total_colls; + ifp->if_oerrors = stats->tx_drop + stats->tx_jabbers + + stats->tx_crcerrs + stats->tx_excess_deferred + + stats->tx_late_colls; + ifp->if_ipackets = (u_long)stats->rx_frames; + ifp->if_ierrors = stats->rx_crcerrs + stats->rx_alignerrs + + stats->rx_lenerrs + stats->rx_codeerrs + stats->rx_cserrs + + stats->rx_runts + stats->rx_jabbers + stats->rx_drop; } static int Modified: stable/8/sys/dev/et/if_etreg.h ============================================================================== --- stable/8/sys/dev/et/if_etreg.h Fri Jan 6 19:24:33 2012 (r229720) +++ stable/8/sys/dev/et/if_etreg.h Fri Jan 6 19:26:31 2012 (r229721) @@ -318,6 +318,52 @@ #define ET_MAC_ADDR1 0x5040 #define ET_MAC_ADDR2 0x5044 +/* MAC statistics counters. */ +#define ET_STAT_PKTS_64 0x6080 +#define ET_STAT_PKTS_65_127 0x6084 +#define ET_STAT_PKTS_128_255 0x6088 +#define ET_STAT_PKTS_256_511 0x608C +#define ET_STAT_PKTS_512_1023 0x6090 +#define ET_STAT_PKTS_1024_1518 0x6094 +#define ET_STAT_PKTS_1519_1522 0x6098 +#define ET_STAT_RX_BYTES 0x609C +#define ET_STAT_RX_FRAMES 0x60A0 +#define ET_STAT_RX_CRC_ERR 0x60A4 +#define ET_STAT_RX_MCAST 0x60A8 +#define ET_STAT_RX_BCAST 0x60AC +#define ET_STAT_RX_CTL 0x60B0 +#define ET_STAT_RX_PAUSE 0x60B4 +#define ET_STAT_RX_UNKNOWN_CTL 0x60B8 +#define ET_STAT_RX_ALIGN_ERR 0x60BC +#define ET_STAT_RX_LEN_ERR 0x60C0 +#define ET_STAT_RX_CODE_ERR 0x60C4 +#define ET_STAT_RX_CS_ERR 0x60C8 +#define ET_STAT_RX_RUNT 0x60CC +#define ET_STAT_RX_OVERSIZE 0x60D0 +#define ET_STAT_RX_FRAG 0x60D4 +#define ET_STAT_RX_JABBER 0x60D8 +#define ET_STAT_RX_DROP 0x60DC +#define ET_STAT_TX_BYTES 0x60E0 +#define ET_STAT_TX_FRAMES 0x60E4 +#define ET_STAT_TX_MCAST 0x60E8 +#define ET_STAT_TX_BCAST 0x60EC +#define ET_STAT_TX_PAUSE 0x60F0 +#define ET_STAT_TX_DEFER 0x60F4 +#define ET_STAT_TX_EXCESS_DEFER 0x60F8 +#define ET_STAT_TX_SINGLE_COL 0x60FC +#define ET_STAT_TX_MULTI_COL 0x6100 +#define ET_STAT_TX_LATE_COL 0x6104 +#define ET_STAT_TX_EXCESS_COL 0x6108 +#define ET_STAT_TX_TOTAL_COL 0x610C +#define ET_STAT_TX_PAUSE_HONOR 0x6110 +#define ET_STAT_TX_DROP 0x6114 +#define ET_STAT_TX_JABBER 0x6118 +#define ET_STAT_TX_CRC_ERR 0x611C +#define ET_STAT_TX_CTL 0x6120 +#define ET_STAT_TX_OVERSIZE 0x6124 +#define ET_STAT_TX_UNDERSIZE 0x6128 +#define ET_STAT_TX_FRAG 0x612C + #define ET_MMC_CTRL 0x7000 #define ET_MMC_CTRL_ENABLE 0x00000001 #define ET_MMC_CTRL_ARB_DISABLE 0x00000002 Modified: stable/8/sys/dev/et/if_etvar.h ============================================================================== --- stable/8/sys/dev/et/if_etvar.h Fri Jan 6 19:24:33 2012 (r229720) +++ stable/8/sys/dev/et/if_etvar.h Fri Jan 6 19:26:31 2012 (r229721) @@ -41,7 +41,7 @@ #define ET_RING_ALIGN 4096 #define ET_STATUS_ALIGN 8 #define ET_NSEG_MAX 32 /* XXX no limit actually */ -#define ET_NSEG_SPARE 8 +#define ET_NSEG_SPARE 4 #define ET_TX_NDESC 512 #define ET_RX_NDESC 512 @@ -231,6 +231,56 @@ struct et_rxbuf_data { void (*rbd_discard)(struct et_rxbuf_data *, int); }; +struct et_hw_stats { + /* RX/TX stats. */ + uint64_t pkts_64; + uint64_t pkts_65; + uint64_t pkts_128; + uint64_t pkts_256; + uint64_t pkts_512; + uint64_t pkts_1024; + uint64_t pkts_1519; + /* RX stats. */ + uint64_t rx_bytes; + uint64_t rx_frames; + uint32_t rx_crcerrs; + uint64_t rx_mcast; + uint64_t rx_bcast; + uint32_t rx_control; + uint32_t rx_pause; + uint32_t rx_unknown_control; + uint32_t rx_alignerrs; + uint32_t rx_lenerrs; + uint32_t rx_codeerrs; + uint32_t rx_cserrs; + uint32_t rx_runts; + uint64_t rx_oversize; + uint32_t rx_fragments; + uint32_t rx_jabbers; + uint32_t rx_drop; + /* TX stats. */ + uint64_t tx_bytes; + uint64_t tx_frames; + uint64_t tx_mcast; + uint64_t tx_bcast; + uint32_t tx_pause; + uint32_t tx_deferred; + uint32_t tx_excess_deferred; + uint32_t tx_single_colls; + uint32_t tx_multi_colls; + uint32_t tx_late_colls; + uint32_t tx_excess_colls; + uint32_t tx_total_colls; + uint32_t tx_pause_honored; + uint32_t tx_drop; + uint32_t tx_jabbers; + uint32_t tx_crcerrs; + uint32_t tx_control; + uint64_t tx_oversize; + uint32_t tx_undersize; + uint32_t tx_fragments; +}; + struct et_softc { struct ifnet *ifp; device_t dev; @@ -271,6 +321,7 @@ struct et_softc { struct et_rxbuf_data sc_rx_data[ET_RX_NRING]; struct et_txbuf_data sc_tx_data; + struct et_hw_stats sc_stats; uint32_t sc_tx; uint32_t sc_tx_intr; @@ -289,7 +340,9 @@ struct et_softc { #define ET_FLAG_PCIE 0x0001 #define ET_FLAG_MSI 0x0002 +#define ET_FLAG_FASTETHER 0x0004 #define ET_FLAG_TXRX_ENABLED 0x0100 #define ET_FLAG_JUMBO 0x0200 +#define ET_FLAG_LINK 0x8000 #endif /* !_IF_ETVAR_H */ From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 19:27:51 2012 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 A2DE9106564A; Fri, 6 Jan 2012 19:27:51 +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 8A7BA8FC0A; Fri, 6 Jan 2012 19:27:51 +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 q06JRpQc004154; Fri, 6 Jan 2012 19:27:51 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06JRpmY004150; Fri, 6 Jan 2012 19:27:51 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201061927.q06JRpmY004150@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 6 Jan 2012 19:27:51 +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: r229722 - stable/7/sys/dev/et 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, 06 Jan 2012 19:27:51 -0000 Author: yongari Date: Fri Jan 6 19:27:51 2012 New Revision: 229722 URL: http://svn.freebsd.org/changeset/base/229722 Log: MFC r228326-228327,228331-228332: r228326: Controller does not require TX start command for every frame. So send a single TX command after setting up all TX frames. This removes unnecessary register accesses and bus_dmamap_sync(9) calls. et(4) uses TX interrupt moderation so it's possible to have TX buffers that were already transmitted but waiting for TX completion interrupt. If the number of available TX descriptor is less then 1/3 of total TX descriptor, try reclaiming first to get enough free TX descriptors before setting up TX descriptors. After r228325, et_txeof() no longer tries to send frames after reclaiming TX buffers. That change was made to give more chance to transmit frames in main interrupt handler since we can still send frames in interrupt handler with RX interrupt. So right before exiting interrupt hander, after enabling interrupt, try to send more frames. This gives slightly better performance numbers. While I'm here reduce number of spare TX descriptors from 8 to 4. Controller does not require reserved TX descriptors, it was just to reduce TX overhead. After r228325, driver has much lower TX overhead so it does not make sense to reserve 8 TX descriptors. r228327: Remove et_enable_intrs(), et_disable_intrs() functions and manipulation of interrupt register access is done through CSR_WRITE_4 macro. Also add disabling interrupt into et_reset() because we want interrupt disabled state after controller reset. While I'm here slightly change interrupt handler to be more readable one. r228331: Rework link state tracking and TX/RX MAC configuration. o Do not report link status if driver is not running. o TX/RX MAC configuration should be done with resolved speed, duplex and flow control after establishing a link so it can't be done in driver initialization routine. Move the configuration to miibus_statchg callback which will be called whenever any link state change is detected. At this moment, flow-control is not enabled yet mainly because I was not able to set correct flow control parameters to generate TX pause frames. o Now TX/RX MAC is enabled only when a valid link is detected. Rearragnge hardware initialization routine a bit to leave enabling MAC to miibus_statchg callback. In order to that, TX/RX DMA engine is enabled in et_init_locked(). o Introduce ET_FLAG_LINK flag to track current link state. o Introduce ET_FLAG_FASTETHER flag to mark whether controller is fast ethernet. This flag is checked in miibus_statchg callback to know whether PHY established a valid link. o In et_stop(), TX/RX MAC is explicitly disabled instead of relying on et_reset(). And move et_reset() from et_stop() to controller initialization. Controler reset is not required here and it would also clear critial registers(i.e station address, RX filter configuration, WOL etc) that are required to make WOL work. o Switching to current media is done in et_init_locked() after setting IFF_DRV_RUNNING flag. This should ensure reliable auto-negotiation/manual link establishment. o In et_start_locked(), check whether driver got a valid link before trying to send frames. o Remove checking a link in et_tick() as this is done by miibus_statchg callback. r228332: Implement hardware MAC statistics counter. Counters could be queried with dev.et.%d.stats sysctl node where %d is an instance of device. Modified: stable/7/sys/dev/et/if_et.c stable/7/sys/dev/et/if_etreg.h stable/7/sys/dev/et/if_etvar.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/et/if_et.c ============================================================================== --- stable/7/sys/dev/et/if_et.c Fri Jan 6 19:26:31 2012 (r229721) +++ stable/7/sys/dev/et/if_et.c Fri Jan 6 19:27:51 2012 (r229722) @@ -110,8 +110,6 @@ static int et_sysctl_rx_intr_npkts(SYSCT static int et_sysctl_rx_intr_delay(SYSCTL_HANDLER_ARGS); static void et_intr(void *); -static void et_enable_intrs(struct et_softc *, uint32_t); -static void et_disable_intrs(struct et_softc *); static void et_rxeof(struct et_softc *); static void et_txeof(struct et_softc *); @@ -144,13 +142,12 @@ static int et_start_rxdma(struct et_soft static int et_start_txdma(struct et_softc *); static int et_stop_rxdma(struct et_softc *); static int et_stop_txdma(struct et_softc *); -static int et_enable_txrx(struct et_softc *, int); static void et_reset(struct et_softc *); static int et_bus_config(struct et_softc *); static void et_get_eaddr(device_t, uint8_t[]); static void et_setmulti(struct et_softc *); static void et_tick(void *); -static void et_setmedia(struct et_softc *); +static void et_stats_update(struct et_softc *); static const struct et_dev { uint16_t vid; @@ -302,6 +299,9 @@ et_attach(device_t dev) goto fail; } + if (pci_get_device(dev) == PCI_PRODUCT_LUCENT_ET1310_FAST) + sc->sc_flags |= ET_FLAG_FASTETHER; + error = et_bus_config(sc); if (error) goto fail; @@ -313,8 +313,6 @@ et_attach(device_t dev) et_reset(sc); - et_disable_intrs(sc); - error = et_dma_alloc(sc); if (error) goto fail; @@ -495,7 +493,89 @@ et_miibus_writereg(device_t dev, int phy static void et_miibus_statchg(device_t dev) { - et_setmedia(device_get_softc(dev)); + struct et_softc *sc; + struct mii_data *mii; + struct ifnet *ifp; + uint32_t cfg1, cfg2, ctrl; + int i; + + sc = device_get_softc(dev); + + mii = device_get_softc(sc->sc_miibus); + ifp = sc->ifp; + if (mii == NULL || ifp == NULL || + (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + return; + + sc->sc_flags &= ~ET_FLAG_LINK; + if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == + (IFM_ACTIVE | IFM_AVALID)) { + switch (IFM_SUBTYPE(mii->mii_media_active)) { + case IFM_10_T: + case IFM_100_TX: + sc->sc_flags |= ET_FLAG_LINK; + break; + case IFM_1000_T: + if ((sc->sc_flags & ET_FLAG_FASTETHER) == 0) + sc->sc_flags |= ET_FLAG_LINK; + break; + } + } + + /* XXX Stop TX/RX MAC? */ + if ((sc->sc_flags & ET_FLAG_LINK) == 0) + return; + + /* Program MACs with resolved speed/duplex/flow-control. */ + ctrl = CSR_READ_4(sc, ET_MAC_CTRL); + ctrl &= ~(ET_MAC_CTRL_GHDX | ET_MAC_CTRL_MODE_MII); + cfg1 = CSR_READ_4(sc, ET_MAC_CFG1); + cfg1 &= ~(ET_MAC_CFG1_TXFLOW | ET_MAC_CFG1_RXFLOW | + ET_MAC_CFG1_LOOPBACK); + cfg2 = CSR_READ_4(sc, ET_MAC_CFG2); + cfg2 &= ~(ET_MAC_CFG2_MODE_MII | ET_MAC_CFG2_MODE_GMII | + ET_MAC_CFG2_FDX | ET_MAC_CFG2_BIGFRM); + cfg2 |= ET_MAC_CFG2_LENCHK | ET_MAC_CFG2_CRC | ET_MAC_CFG2_PADCRC | + ((7 << ET_MAC_CFG2_PREAMBLE_LEN_SHIFT) & + ET_MAC_CFG2_PREAMBLE_LEN_MASK); + + if (IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T) + cfg2 |= ET_MAC_CFG2_MODE_GMII; + else { + cfg2 |= ET_MAC_CFG2_MODE_MII; + ctrl |= ET_MAC_CTRL_MODE_MII; + } + + if (IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) { + cfg2 |= ET_MAC_CFG2_FDX; +#ifdef notyet + if (IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_TXPAUSE) + cfg1 |= ET_MAC_CFG1_TXFLOW; + if (IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_RXPAUSE) + cfg1 |= ET_MAC_CFG1_RXFLOW; +#endif + } else + ctrl |= ET_MAC_CTRL_GHDX; + + CSR_WRITE_4(sc, ET_MAC_CTRL, ctrl); + CSR_WRITE_4(sc, ET_MAC_CFG2, cfg2); + cfg1 |= ET_MAC_CFG1_TXEN | ET_MAC_CFG1_RXEN; + CSR_WRITE_4(sc, ET_MAC_CFG1, cfg1); + +#define NRETRY 50 + + for (i = 0; i < NRETRY; ++i) { + cfg1 = CSR_READ_4(sc, ET_MAC_CFG1); + if ((cfg1 & (ET_MAC_CFG1_SYNC_TXEN | ET_MAC_CFG1_SYNC_RXEN)) == + (ET_MAC_CFG1_SYNC_TXEN | ET_MAC_CFG1_SYNC_RXEN)) + break; + DELAY(100); + } + if (i == NRETRY) + if_printf(ifp, "can't enable RX/TX\n"); + sc->sc_flags |= ET_FLAG_TXRX_ENABLED; + +#undef NRETRY } static int @@ -526,10 +606,17 @@ et_ifmedia_upd(struct ifnet *ifp) static void et_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) { - struct et_softc *sc = ifp->if_softc; - struct mii_data *mii = device_get_softc(sc->sc_miibus); + struct et_softc *sc; + struct mii_data *mii; + sc = ifp->if_softc; ET_LOCK(sc); + if ((ifp->if_flags & IFF_UP) == 0) { + ET_UNLOCK(sc); + return; + } + + mii = device_get_softc(sc->sc_miibus); mii_pollstat(mii); ifmr->ifm_active = mii->mii_media_active; ifmr->ifm_status = mii->mii_media_status; @@ -544,17 +631,20 @@ et_stop(struct et_softc *sc) ET_LOCK_ASSERT(sc); callout_stop(&sc->sc_tick); + /* Disable interrupts. */ + CSR_WRITE_4(sc, ET_INTR_MASK, 0xffffffff); + + CSR_WRITE_4(sc, ET_MAC_CFG1, CSR_READ_4(sc, ET_MAC_CFG1) & ~( + ET_MAC_CFG1_TXEN | ET_MAC_CFG1_RXEN)); + DELAY(100); et_stop_rxdma(sc); et_stop_txdma(sc); - - et_disable_intrs(sc); + et_stats_update(sc); et_free_tx_ring(sc); et_free_rx_ring(sc); - et_reset(sc); - sc->sc_tx = 0; sc->sc_tx_intr = 0; sc->sc_flags &= ~ET_FLAG_TXRX_ENABLED; @@ -674,20 +764,10 @@ et_reset(struct et_softc *sc) ET_MAC_CFG1_RST_TXFUNC | ET_MAC_CFG1_RST_RXFUNC | ET_MAC_CFG1_RST_TXMC | ET_MAC_CFG1_RST_RXMC); CSR_WRITE_4(sc, ET_MAC_CFG1, 0); -} - -static void -et_disable_intrs(struct et_softc *sc) -{ + /* Disable interrupts. */ CSR_WRITE_4(sc, ET_INTR_MASK, 0xffffffff); } -static void -et_enable_intrs(struct et_softc *sc, uint32_t intrs) -{ - CSR_WRITE_4(sc, ET_INTR_MASK, ~intrs); -} - struct et_dmamap_arg { bus_addr_t et_busaddr; }; @@ -1087,12 +1167,12 @@ et_intr(void *xsc) return; } - et_disable_intrs(sc); + /* Disable further interrupts. */ + CSR_WRITE_4(sc, ET_INTR_MASK, 0xffffffff); intrs = CSR_READ_4(sc, ET_INTR_STATUS); - intrs &= ET_INTRS; - if (intrs == 0) /* Not interested */ - goto back; + if ((intrs & ET_INTRS) == 0) + goto done; if (intrs & ET_INTR_RXEOF) et_rxeof(sc); @@ -1100,8 +1180,12 @@ et_intr(void *xsc) et_txeof(sc); if (intrs & ET_INTR_TIMER) CSR_WRITE_4(sc, ET_TIMER, sc->sc_timer); -back: - et_enable_intrs(sc, ET_INTRS); +done: + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + CSR_WRITE_4(sc, ET_INTR_MASK, ~ET_INTRS); + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + et_start_locked(ifp); + } ET_UNLOCK(sc); } @@ -1118,6 +1202,7 @@ et_init_locked(struct et_softc *sc) return; et_stop(sc); + et_reset(sc); et_init_tx_ring(sc); error = et_init_rx_ring(sc); @@ -1126,21 +1211,33 @@ et_init_locked(struct et_softc *sc) error = et_chip_init(sc); if (error) - goto back; + goto fail; - error = et_enable_txrx(sc, 1); + /* + * Start TX/RX DMA engine + */ + error = et_start_rxdma(sc); if (error) - goto back; + return; - et_enable_intrs(sc, ET_INTRS); + error = et_start_txdma(sc); + if (error) + return; - callout_reset(&sc->sc_tick, hz, et_tick, sc); + /* Enable interrupts. */ + CSR_WRITE_4(sc, ET_INTR_MASK, ~ET_INTRS); CSR_WRITE_4(sc, ET_TIMER, sc->sc_timer); ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; -back: + + sc->sc_flags &= ~ET_FLAG_LINK; + et_ifmedia_upd_locked(ifp); + + callout_reset(&sc->sc_tick, hz, et_tick, sc); + +fail: if (error) et_stop(sc); } @@ -1244,19 +1341,32 @@ et_start_locked(struct ifnet *ifp) { struct et_softc *sc; struct mbuf *m_head = NULL; + struct et_txdesc_ring *tx_ring; struct et_txbuf_data *tbd; + uint32_t tx_ready_pos; int enq; sc = ifp->if_softc; ET_LOCK_ASSERT(sc); - if ((sc->sc_flags & ET_FLAG_TXRX_ENABLED) == 0) - return; - - if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING) + if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != + IFF_DRV_RUNNING || + (sc->sc_flags & (ET_FLAG_LINK | ET_FLAG_TXRX_ENABLED)) != + (ET_FLAG_LINK | ET_FLAG_TXRX_ENABLED)) return; + /* + * Driver does not request TX completion interrupt for every + * queued frames to prevent generating excessive interrupts. + * This means driver may wait for TX completion interrupt even + * though some frames were sucessfully transmitted. Reclaiming + * transmitted frames will ensure driver see all available + * descriptors. + */ tbd = &sc->sc_tx_data; + if (tbd->tbd_used > (ET_TX_NDESC * 2) / 3) + et_txeof(sc); + for (enq = 0; !IFQ_DRV_IS_EMPTY(&ifp->if_snd); ) { if (tbd->tbd_used + ET_NSEG_SPARE >= ET_TX_NDESC) { ifp->if_drv_flags |= IFF_DRV_OACTIVE; @@ -1281,8 +1391,17 @@ et_start_locked(struct ifnet *ifp) ETHER_BPF_MTAP(ifp, m_head); } - if (enq > 0) + if (enq > 0) { + tx_ring = &sc->sc_tx_ring; + bus_dmamap_sync(tx_ring->tr_dtag, tx_ring->tr_dmap, + BUS_DMASYNC_PREWRITE); + tx_ready_pos = tx_ring->tr_ready_index & + ET_TX_READY_POS_INDEX_MASK; + if (tx_ring->tr_ready_wrap) + tx_ready_pos |= ET_TX_READY_POS_WRAP; + CSR_WRITE_4(sc, ET_TX_READY_POS, tx_ready_pos); sc->watchdog_timer = 5; + } } static void @@ -1861,56 +1980,6 @@ et_start_txdma(struct et_softc *sc) return (0); } -static int -et_enable_txrx(struct et_softc *sc, int media_upd) -{ - struct ifnet *ifp = sc->ifp; - uint32_t val; - int i, error; - - val = CSR_READ_4(sc, ET_MAC_CFG1); - val |= ET_MAC_CFG1_TXEN | ET_MAC_CFG1_RXEN; - val &= ~(ET_MAC_CFG1_TXFLOW | ET_MAC_CFG1_RXFLOW | - ET_MAC_CFG1_LOOPBACK); - CSR_WRITE_4(sc, ET_MAC_CFG1, val); - - if (media_upd) - et_ifmedia_upd_locked(ifp); - else - et_setmedia(sc); - -#define NRETRY 50 - - for (i = 0; i < NRETRY; ++i) { - val = CSR_READ_4(sc, ET_MAC_CFG1); - if ((val & (ET_MAC_CFG1_SYNC_TXEN | ET_MAC_CFG1_SYNC_RXEN)) == - (ET_MAC_CFG1_SYNC_TXEN | ET_MAC_CFG1_SYNC_RXEN)) - break; - - DELAY(100); - } - if (i == NRETRY) { - if_printf(ifp, "can't enable RX/TX\n"); - return (0); - } - sc->sc_flags |= ET_FLAG_TXRX_ENABLED; - -#undef NRETRY - - /* - * Start TX/RX DMA engine - */ - error = et_start_rxdma(sc); - if (error) - return (error); - - error = et_start_txdma(sc); - if (error) - return (error); - - return (0); -} - static void et_rxeof(struct et_softc *sc) { @@ -1986,7 +2055,6 @@ et_rxeof(struct et_softc *sc) m = rbd->rbd_buf[buf_idx].rb_mbuf; if ((rxst_info1 & ET_RXST_INFO1_OK) == 0){ /* Discard errored frame. */ - ifp->if_ierrors++; rbd->rbd_discard(rbd, buf_idx); } else if (rbd->rbd_newbuf(rbd, buf_idx) != 0) { /* No available mbufs, discard it. */ @@ -2000,7 +2068,6 @@ et_rxeof(struct et_softc *sc) } else { m->m_pkthdr.len = m->m_len = buflen; m->m_pkthdr.rcvif = ifp; - ifp->if_ipackets++; ET_UNLOCK(sc); ifp->if_input(ifp, m); ET_LOCK(sc); @@ -2040,7 +2107,7 @@ et_encap(struct et_softc *sc, struct mbu struct mbuf *m; bus_dma_segment_t segs[ET_NSEG_MAX]; bus_dmamap_t map; - uint32_t csum_flags, last_td_ctrl2, tx_ready_pos; + uint32_t csum_flags, last_td_ctrl2; int error, i, idx, first_idx, last_idx, nsegs; tx_ring = &sc->sc_tx_ring; @@ -2125,12 +2192,6 @@ et_encap(struct et_softc *sc, struct mbu tbd->tbd_used += nsegs; MPASS(tbd->tbd_used <= ET_TX_NDESC); - bus_dmamap_sync(tx_ring->tr_dtag, tx_ring->tr_dmap, - BUS_DMASYNC_PREWRITE); - tx_ready_pos = tx_ring->tr_ready_index & ET_TX_READY_POS_INDEX_MASK; - if (tx_ring->tr_ready_wrap) - tx_ready_pos |= ET_TX_READY_POS_WRAP; - CSR_WRITE_4(sc, ET_TX_READY_POS, tx_ready_pos); return (0); } @@ -2172,7 +2233,6 @@ et_txeof(struct et_softc *sc) bus_dmamap_unload(sc->sc_tx_tag, tb->tb_dmap); m_freem(tb->tb_mbuf); tb->tb_mbuf = NULL; - ifp->if_opackets++; } if (++tbd->tbd_start_index == ET_TX_NDESC) { @@ -2189,6 +2249,7 @@ et_txeof(struct et_softc *sc) if (tbd->tbd_used + ET_NSEG_SPARE < ET_TX_NDESC) ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; } + static void et_tick(void *xsc) { @@ -2201,13 +2262,7 @@ et_tick(void *xsc) mii = device_get_softc(sc->sc_miibus); mii_tick(mii); - if ((sc->sc_flags & ET_FLAG_TXRX_ENABLED) == 0 && - (mii->mii_media_status & IFM_ACTIVE) && - IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) { - if_printf(ifp, "Link up, enable TX/RX\n"); - if (et_enable_txrx(sc, 0) == 0) - et_start_locked(ifp); - } + et_stats_update(sc); if (et_watchdog(sc) == EJUSTRETURN) return; callout_reset(&sc->sc_tick, hz, et_tick, sc); @@ -2320,6 +2375,11 @@ et_newbuf_hdr(struct et_rxbuf_data *rbd, return (0); } +#define ET_SYSCTL_STAT_ADD32(c, h, n, p, d) \ + SYSCTL_ADD_UINT(c, h, OID_AUTO, n, CTLFLAG_RD, p, 0, d) +#define ET_SYSCTL_STAT_ADD64(c, h, n, p, d) \ + SYSCTL_ADD_UQUAD(c, h, OID_AUTO, n, CTLFLAG_RD, p, d) + /* * Create sysctl tree */ @@ -2327,7 +2387,9 @@ static void et_add_sysctls(struct et_softc * sc) { struct sysctl_ctx_list *ctx; - struct sysctl_oid_list *children; + struct sysctl_oid_list *children, *parent; + struct sysctl_oid *tree; + struct et_hw_stats *stats; ctx = device_get_sysctl_ctx(sc->dev); children = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->dev)); @@ -2343,8 +2405,116 @@ et_add_sysctls(struct et_softc * sc) "TX IM, # segments per TX interrupt"); SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "timer", CTLFLAG_RW, &sc->sc_timer, 0, "TX timer"); + + tree = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, "stats", CTLFLAG_RD, + NULL, "ET statistics"); + parent = SYSCTL_CHILDREN(tree); + + /* TX/RX statistics. */ + stats = &sc->sc_stats; + ET_SYSCTL_STAT_ADD64(ctx, parent, "frames_64", &stats->pkts_64, + "0 to 64 bytes frames"); + ET_SYSCTL_STAT_ADD64(ctx, parent, "frames_65_127", &stats->pkts_65, + "65 to 127 bytes frames"); + ET_SYSCTL_STAT_ADD64(ctx, parent, "frames_128_255", &stats->pkts_128, + "128 to 255 bytes frames"); + ET_SYSCTL_STAT_ADD64(ctx, parent, "frames_256_511", &stats->pkts_256, + "256 to 511 bytes frames"); + ET_SYSCTL_STAT_ADD64(ctx, parent, "frames_512_1023", &stats->pkts_512, + "512 to 1023 bytes frames"); + ET_SYSCTL_STAT_ADD64(ctx, parent, "frames_1024_1518", &stats->pkts_1024, + "1024 to 1518 bytes frames"); + ET_SYSCTL_STAT_ADD64(ctx, parent, "frames_1519_1522", &stats->pkts_1519, + "1519 to 1522 bytes frames"); + + /* RX statistics. */ + tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "rx", CTLFLAG_RD, + NULL, "RX MAC statistics"); + children = SYSCTL_CHILDREN(tree); + ET_SYSCTL_STAT_ADD64(ctx, children, "bytes", + &stats->rx_bytes, "Good bytes"); + ET_SYSCTL_STAT_ADD64(ctx, children, "frames", + &stats->rx_frames, "Good frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "crc_errs", + &stats->rx_crcerrs, "CRC errors"); + ET_SYSCTL_STAT_ADD64(ctx, children, "mcast_frames", + &stats->rx_mcast, "Multicast frames"); + ET_SYSCTL_STAT_ADD64(ctx, children, "bcast_frames", + &stats->rx_bcast, "Broadcast frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "control", + &stats->rx_control, "Control frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "pause", + &stats->rx_pause, "Pause frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "unknown_control", + &stats->rx_unknown_control, "Unknown control frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "align_errs", + &stats->rx_alignerrs, "Alignment errors"); + ET_SYSCTL_STAT_ADD32(ctx, children, "len_errs", + &stats->rx_lenerrs, "Frames with length mismatched"); + ET_SYSCTL_STAT_ADD32(ctx, children, "code_errs", + &stats->rx_codeerrs, "Frames with code error"); + ET_SYSCTL_STAT_ADD32(ctx, children, "cs_errs", + &stats->rx_cserrs, "Frames with carrier sense error"); + ET_SYSCTL_STAT_ADD32(ctx, children, "runts", + &stats->rx_runts, "Too short frames"); + ET_SYSCTL_STAT_ADD64(ctx, children, "oversize", + &stats->rx_oversize, "Oversized frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "fragments", + &stats->rx_fragments, "Fragmented frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "jabbers", + &stats->rx_jabbers, "Frames with jabber error"); + ET_SYSCTL_STAT_ADD32(ctx, children, "drop", + &stats->rx_drop, "Dropped frames"); + + /* TX statistics. */ + tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "tx", CTLFLAG_RD, + NULL, "TX MAC statistics"); + children = SYSCTL_CHILDREN(tree); + ET_SYSCTL_STAT_ADD64(ctx, children, "bytes", + &stats->tx_bytes, "Good bytes"); + ET_SYSCTL_STAT_ADD64(ctx, children, "frames", + &stats->tx_frames, "Good frames"); + ET_SYSCTL_STAT_ADD64(ctx, children, "mcast_frames", + &stats->tx_mcast, "Multicast frames"); + ET_SYSCTL_STAT_ADD64(ctx, children, "bcast_frames", + &stats->tx_bcast, "Broadcast frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "pause", + &stats->tx_pause, "Pause frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "deferred", + &stats->tx_deferred, "Deferred frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "excess_deferred", + &stats->tx_excess_deferred, "Excessively deferred frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "single_colls", + &stats->tx_single_colls, "Single collisions"); + ET_SYSCTL_STAT_ADD32(ctx, children, "multi_colls", + &stats->tx_multi_colls, "Multiple collisions"); + ET_SYSCTL_STAT_ADD32(ctx, children, "late_colls", + &stats->tx_late_colls, "Late collisions"); + ET_SYSCTL_STAT_ADD32(ctx, children, "excess_colls", + &stats->tx_excess_colls, "Excess collisions"); + ET_SYSCTL_STAT_ADD32(ctx, children, "total_colls", + &stats->tx_total_colls, "Total collisions"); + ET_SYSCTL_STAT_ADD32(ctx, children, "pause_honored", + &stats->tx_pause_honored, "Honored pause frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "drop", + &stats->tx_drop, "Dropped frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "jabbers", + &stats->tx_jabbers, "Frames with jabber errors"); + ET_SYSCTL_STAT_ADD32(ctx, children, "crc_errs", + &stats->tx_crcerrs, "Frames with CRC errors"); + ET_SYSCTL_STAT_ADD32(ctx, children, "control", + &stats->tx_control, "Control frames"); + ET_SYSCTL_STAT_ADD64(ctx, children, "oversize", + &stats->tx_oversize, "Oversized frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "undersize", + &stats->tx_undersize, "Undersized frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "fragments", + &stats->tx_fragments, "Fragmented frames"); } +#undef ET_SYSCTL_STAT_ADD32 +#undef ET_SYSCTL_STAT_ADD64 + static int et_sysctl_rx_intr_npkts(SYSCTL_HANDLER_ARGS) { @@ -2396,35 +2566,70 @@ back: } static void -et_setmedia(struct et_softc *sc) +et_stats_update(struct et_softc *sc) { - struct mii_data *mii = device_get_softc(sc->sc_miibus); - uint32_t cfg2, ctrl; - - cfg2 = CSR_READ_4(sc, ET_MAC_CFG2); - cfg2 &= ~(ET_MAC_CFG2_MODE_MII | ET_MAC_CFG2_MODE_GMII | - ET_MAC_CFG2_FDX | ET_MAC_CFG2_BIGFRM); - cfg2 |= ET_MAC_CFG2_LENCHK | ET_MAC_CFG2_CRC | ET_MAC_CFG2_PADCRC | - ((7 << ET_MAC_CFG2_PREAMBLE_LEN_SHIFT) & - ET_MAC_CFG2_PREAMBLE_LEN_MASK); - - ctrl = CSR_READ_4(sc, ET_MAC_CTRL); - ctrl &= ~(ET_MAC_CTRL_GHDX | ET_MAC_CTRL_MODE_MII); - - if (IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T) { - cfg2 |= ET_MAC_CFG2_MODE_GMII; - } else { - cfg2 |= ET_MAC_CFG2_MODE_MII; - ctrl |= ET_MAC_CTRL_MODE_MII; - } + struct ifnet *ifp; + struct et_hw_stats *stats; - if ((mii->mii_media_active & IFM_GMASK) == IFM_FDX) - cfg2 |= ET_MAC_CFG2_FDX; - else - ctrl |= ET_MAC_CTRL_GHDX; + stats = &sc->sc_stats; + stats->pkts_64 += CSR_READ_4(sc, ET_STAT_PKTS_64); + stats->pkts_65 += CSR_READ_4(sc, ET_STAT_PKTS_65_127); + stats->pkts_128 += CSR_READ_4(sc, ET_STAT_PKTS_128_255); + stats->pkts_256 += CSR_READ_4(sc, ET_STAT_PKTS_256_511); + stats->pkts_512 += CSR_READ_4(sc, ET_STAT_PKTS_512_1023); + stats->pkts_1024 += CSR_READ_4(sc, ET_STAT_PKTS_1024_1518); + stats->pkts_1519 += CSR_READ_4(sc, ET_STAT_PKTS_1519_1522); + + stats->rx_bytes += CSR_READ_4(sc, ET_STAT_RX_BYTES); + stats->rx_frames += CSR_READ_4(sc, ET_STAT_RX_FRAMES); + stats->rx_crcerrs += CSR_READ_4(sc, ET_STAT_RX_CRC_ERR); + stats->rx_mcast += CSR_READ_4(sc, ET_STAT_RX_MCAST); + stats->rx_bcast += CSR_READ_4(sc, ET_STAT_RX_BCAST); + stats->rx_control += CSR_READ_4(sc, ET_STAT_RX_CTL); + stats->rx_pause += CSR_READ_4(sc, ET_STAT_RX_PAUSE); + stats->rx_unknown_control += CSR_READ_4(sc, ET_STAT_RX_UNKNOWN_CTL); + stats->rx_alignerrs += CSR_READ_4(sc, ET_STAT_RX_ALIGN_ERR); + stats->rx_lenerrs += CSR_READ_4(sc, ET_STAT_RX_LEN_ERR); + stats->rx_codeerrs += CSR_READ_4(sc, ET_STAT_RX_CODE_ERR); + stats->rx_cserrs += CSR_READ_4(sc, ET_STAT_RX_CS_ERR); + stats->rx_runts += CSR_READ_4(sc, ET_STAT_RX_RUNT); + stats->rx_oversize += CSR_READ_4(sc, ET_STAT_RX_OVERSIZE); + stats->rx_fragments += CSR_READ_4(sc, ET_STAT_RX_FRAG); + stats->rx_jabbers += CSR_READ_4(sc, ET_STAT_RX_JABBER); + stats->rx_drop += CSR_READ_4(sc, ET_STAT_RX_DROP); + + stats->tx_bytes += CSR_READ_4(sc, ET_STAT_TX_BYTES); + stats->tx_frames += CSR_READ_4(sc, ET_STAT_TX_FRAMES); + stats->tx_mcast += CSR_READ_4(sc, ET_STAT_TX_MCAST); + stats->tx_bcast += CSR_READ_4(sc, ET_STAT_TX_BCAST); + stats->tx_pause += CSR_READ_4(sc, ET_STAT_TX_PAUSE); + stats->tx_deferred += CSR_READ_4(sc, ET_STAT_TX_DEFER); + stats->tx_excess_deferred += CSR_READ_4(sc, ET_STAT_TX_EXCESS_DEFER); + stats->tx_single_colls += CSR_READ_4(sc, ET_STAT_TX_SINGLE_COL); + stats->tx_multi_colls += CSR_READ_4(sc, ET_STAT_TX_MULTI_COL); + stats->tx_late_colls += CSR_READ_4(sc, ET_STAT_TX_LATE_COL); + stats->tx_excess_colls += CSR_READ_4(sc, ET_STAT_TX_EXCESS_COL); + stats->tx_total_colls += CSR_READ_4(sc, ET_STAT_TX_TOTAL_COL); + stats->tx_pause_honored += CSR_READ_4(sc, ET_STAT_TX_PAUSE_HONOR); + stats->tx_drop += CSR_READ_4(sc, ET_STAT_TX_DROP); + stats->tx_jabbers += CSR_READ_4(sc, ET_STAT_TX_JABBER); + stats->tx_crcerrs += CSR_READ_4(sc, ET_STAT_TX_CRC_ERR); + stats->tx_control += CSR_READ_4(sc, ET_STAT_TX_CTL); + stats->tx_oversize += CSR_READ_4(sc, ET_STAT_TX_OVERSIZE); + stats->tx_undersize += CSR_READ_4(sc, ET_STAT_TX_UNDERSIZE); + stats->tx_fragments += CSR_READ_4(sc, ET_STAT_TX_FRAG); - CSR_WRITE_4(sc, ET_MAC_CTRL, ctrl); - CSR_WRITE_4(sc, ET_MAC_CFG2, cfg2); + /* Update ifnet counters. */ + ifp = sc->ifp; + ifp->if_opackets = (u_long)stats->tx_frames; + ifp->if_collisions = stats->tx_total_colls; + ifp->if_oerrors = stats->tx_drop + stats->tx_jabbers + + stats->tx_crcerrs + stats->tx_excess_deferred + + stats->tx_late_colls; + ifp->if_ipackets = (u_long)stats->rx_frames; + ifp->if_ierrors = stats->rx_crcerrs + stats->rx_alignerrs + + stats->rx_lenerrs + stats->rx_codeerrs + stats->rx_cserrs + + stats->rx_runts + stats->rx_jabbers + stats->rx_drop; } static int Modified: stable/7/sys/dev/et/if_etreg.h ============================================================================== --- stable/7/sys/dev/et/if_etreg.h Fri Jan 6 19:26:31 2012 (r229721) +++ stable/7/sys/dev/et/if_etreg.h Fri Jan 6 19:27:51 2012 (r229722) @@ -318,6 +318,52 @@ #define ET_MAC_ADDR1 0x5040 #define ET_MAC_ADDR2 0x5044 +/* MAC statistics counters. */ +#define ET_STAT_PKTS_64 0x6080 +#define ET_STAT_PKTS_65_127 0x6084 +#define ET_STAT_PKTS_128_255 0x6088 +#define ET_STAT_PKTS_256_511 0x608C +#define ET_STAT_PKTS_512_1023 0x6090 +#define ET_STAT_PKTS_1024_1518 0x6094 +#define ET_STAT_PKTS_1519_1522 0x6098 +#define ET_STAT_RX_BYTES 0x609C +#define ET_STAT_RX_FRAMES 0x60A0 +#define ET_STAT_RX_CRC_ERR 0x60A4 +#define ET_STAT_RX_MCAST 0x60A8 +#define ET_STAT_RX_BCAST 0x60AC +#define ET_STAT_RX_CTL 0x60B0 +#define ET_STAT_RX_PAUSE 0x60B4 +#define ET_STAT_RX_UNKNOWN_CTL 0x60B8 +#define ET_STAT_RX_ALIGN_ERR 0x60BC +#define ET_STAT_RX_LEN_ERR 0x60C0 +#define ET_STAT_RX_CODE_ERR 0x60C4 +#define ET_STAT_RX_CS_ERR 0x60C8 +#define ET_STAT_RX_RUNT 0x60CC +#define ET_STAT_RX_OVERSIZE 0x60D0 +#define ET_STAT_RX_FRAG 0x60D4 +#define ET_STAT_RX_JABBER 0x60D8 +#define ET_STAT_RX_DROP 0x60DC +#define ET_STAT_TX_BYTES 0x60E0 +#define ET_STAT_TX_FRAMES 0x60E4 +#define ET_STAT_TX_MCAST 0x60E8 +#define ET_STAT_TX_BCAST 0x60EC +#define ET_STAT_TX_PAUSE 0x60F0 +#define ET_STAT_TX_DEFER 0x60F4 +#define ET_STAT_TX_EXCESS_DEFER 0x60F8 +#define ET_STAT_TX_SINGLE_COL 0x60FC +#define ET_STAT_TX_MULTI_COL 0x6100 +#define ET_STAT_TX_LATE_COL 0x6104 +#define ET_STAT_TX_EXCESS_COL 0x6108 +#define ET_STAT_TX_TOTAL_COL 0x610C +#define ET_STAT_TX_PAUSE_HONOR 0x6110 +#define ET_STAT_TX_DROP 0x6114 +#define ET_STAT_TX_JABBER 0x6118 +#define ET_STAT_TX_CRC_ERR 0x611C +#define ET_STAT_TX_CTL 0x6120 +#define ET_STAT_TX_OVERSIZE 0x6124 +#define ET_STAT_TX_UNDERSIZE 0x6128 +#define ET_STAT_TX_FRAG 0x612C + #define ET_MMC_CTRL 0x7000 #define ET_MMC_CTRL_ENABLE 0x00000001 #define ET_MMC_CTRL_ARB_DISABLE 0x00000002 Modified: stable/7/sys/dev/et/if_etvar.h ============================================================================== --- stable/7/sys/dev/et/if_etvar.h Fri Jan 6 19:26:31 2012 (r229721) +++ stable/7/sys/dev/et/if_etvar.h Fri Jan 6 19:27:51 2012 (r229722) @@ -41,7 +41,7 @@ #define ET_RING_ALIGN 4096 #define ET_STATUS_ALIGN 8 #define ET_NSEG_MAX 32 /* XXX no limit actually */ -#define ET_NSEG_SPARE 8 +#define ET_NSEG_SPARE 4 #define ET_TX_NDESC 512 #define ET_RX_NDESC 512 @@ -231,6 +231,56 @@ struct et_rxbuf_data { void (*rbd_discard)(struct et_rxbuf_data *, int); }; +struct et_hw_stats { + /* RX/TX stats. */ + uint64_t pkts_64; + uint64_t pkts_65; + uint64_t pkts_128; + uint64_t pkts_256; + uint64_t pkts_512; + uint64_t pkts_1024; + uint64_t pkts_1519; + /* RX stats. */ + uint64_t rx_bytes; + uint64_t rx_frames; + uint32_t rx_crcerrs; + uint64_t rx_mcast; + uint64_t rx_bcast; + uint32_t rx_control; + uint32_t rx_pause; + uint32_t rx_unknown_control; + uint32_t rx_alignerrs; + uint32_t rx_lenerrs; + uint32_t rx_codeerrs; + uint32_t rx_cserrs; + uint32_t rx_runts; + uint64_t rx_oversize; + uint32_t rx_fragments; + uint32_t rx_jabbers; + uint32_t rx_drop; + /* TX stats. */ + uint64_t tx_bytes; + uint64_t tx_frames; + uint64_t tx_mcast; + uint64_t tx_bcast; + uint32_t tx_pause; + uint32_t tx_deferred; + uint32_t tx_excess_deferred; + uint32_t tx_single_colls; + uint32_t tx_multi_colls; + uint32_t tx_late_colls; + uint32_t tx_excess_colls; + uint32_t tx_total_colls; + uint32_t tx_pause_honored; + uint32_t tx_drop; + uint32_t tx_jabbers; + uint32_t tx_crcerrs; + uint32_t tx_control; + uint64_t tx_oversize; + uint32_t tx_undersize; + uint32_t tx_fragments; +}; + struct et_softc { struct ifnet *ifp; device_t dev; @@ -271,6 +321,7 @@ struct et_softc { struct et_rxbuf_data sc_rx_data[ET_RX_NRING]; struct et_txbuf_data sc_tx_data; + struct et_hw_stats sc_stats; uint32_t sc_tx; uint32_t sc_tx_intr; @@ -289,7 +340,9 @@ struct et_softc { #define ET_FLAG_PCIE 0x0001 #define ET_FLAG_MSI 0x0002 +#define ET_FLAG_FASTETHER 0x0004 #define ET_FLAG_TXRX_ENABLED 0x0100 #define ET_FLAG_JUMBO 0x0200 +#define ET_FLAG_LINK 0x8000 #endif /* !_IF_ETVAR_H */ From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 19:29:16 2012 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 DD1F5106564A; Fri, 6 Jan 2012 19:29:16 +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 C426C8FC16; Fri, 6 Jan 2012 19:29: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 q06JTGua004283; Fri, 6 Jan 2012 19:29:16 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06JTG7d004261; Fri, 6 Jan 2012 19:29:16 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201061929.q06JTG7d004261@svn.freebsd.org> From: John Baldwin Date: Fri, 6 Jan 2012 19:29:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229723 - in stable/9: . lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys 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: Fri, 06 Jan 2012 19:29:17 -0000 Author: jhb Date: Fri Jan 6 19:29:16 2012 New Revision: 229723 URL: http://svn.freebsd.org/changeset/base/229723 Log: MFC 227070,227341,227502: Add the posix_fadvise(2) system call. It is somewhat similar to madvise(2) except that it operates on a file descriptor instead of a memory region. It is currently only supported on regular files. Note that this adds a new VOP, so all filesystem modules must be recompiled. Approved by: re (kib) Added: stable/9/lib/libc/sys/posix_fadvise.2 - copied unchanged from r227070, head/lib/libc/sys/posix_fadvise.2 Modified: stable/9/UPDATING stable/9/lib/libc/sys/Makefile.inc stable/9/lib/libc/sys/Symbol.map stable/9/lib/libc/sys/madvise.2 stable/9/sys/compat/freebsd32/freebsd32_misc.c stable/9/sys/compat/freebsd32/syscalls.master stable/9/sys/kern/syscalls.master stable/9/sys/kern/vfs_default.c stable/9/sys/kern/vfs_subr.c stable/9/sys/kern/vfs_syscalls.c stable/9/sys/kern/vfs_vnops.c stable/9/sys/kern/vnode_if.src stable/9/sys/sys/fcntl.h stable/9/sys/sys/file.h stable/9/sys/sys/param.h stable/9/sys/sys/syscallsubr.h stable/9/sys/sys/unistd.h stable/9/sys/sys/vnode.h stable/9/sys/vm/vm_object.c stable/9/sys/vm/vm_object.h Directory Properties: stable/9/lib/libc/ (props changed) stable/9/lib/libc/stdtime/ (props changed) stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/UPDATING ============================================================================== --- stable/9/UPDATING Fri Jan 6 19:27:51 2012 (r229722) +++ stable/9/UPDATING Fri Jan 6 19:29:16 2012 (r229723) @@ -10,6 +10,10 @@ Items affecting the ports and packages s /usr/ports/UPDATING. Please read that file before running portupgrade. 20120106: + A new VOP_ADVISE() was added to support posix_fadvise(2). All + filesystem modules must be recompiled. + +20120106: The interface of the VOP_VPTOCNP(9) changed, now the returned vnode shall be referenced, previously it was required to be only held. All in-tree filesystems are converted. Modified: stable/9/lib/libc/sys/Makefile.inc ============================================================================== --- stable/9/lib/libc/sys/Makefile.inc Fri Jan 6 19:27:51 2012 (r229722) +++ stable/9/lib/libc/sys/Makefile.inc Fri Jan 6 19:29:16 2012 (r229723) @@ -96,7 +96,8 @@ MAN+= abort2.2 accept.2 access.2 acct.2 mq_setattr.2 \ msgctl.2 msgget.2 msgrcv.2 msgsnd.2 \ msync.2 munmap.2 nanosleep.2 nfssvc.2 ntp_adjtime.2 open.2 \ - pathconf.2 pdfork.2 pipe.2 poll.2 posix_fallocate.2 posix_openpt.2 profil.2 \ + pathconf.2 pdfork.2 pipe.2 poll.2 posix_fadvise.2 posix_fallocate.2 \ + posix_openpt.2 profil.2 \ pselect.2 ptrace.2 quotactl.2 \ read.2 readlink.2 reboot.2 recv.2 rename.2 revoke.2 rfork.2 rmdir.2 \ rtprio.2 Modified: stable/9/lib/libc/sys/Symbol.map ============================================================================== --- stable/9/lib/libc/sys/Symbol.map Fri Jan 6 19:27:51 2012 (r229722) +++ stable/9/lib/libc/sys/Symbol.map Fri Jan 6 19:29:16 2012 (r229723) @@ -378,6 +378,10 @@ FBSD_1.2 { setloginclass; }; +FBSD_1.3 { + posix_fadvise; +}; + FBSDprivate_1.0 { ___acl_aclcheck_fd; __sys___acl_aclcheck_fd; Modified: stable/9/lib/libc/sys/madvise.2 ============================================================================== --- stable/9/lib/libc/sys/madvise.2 Fri Jan 6 19:27:51 2012 (r229722) +++ stable/9/lib/libc/sys/madvise.2 Fri Jan 6 19:29:16 2012 (r229723) @@ -169,7 +169,8 @@ was specified and the process does not h .Xr mincore 2 , .Xr mprotect 2 , .Xr msync 2 , -.Xr munmap 2 +.Xr munmap 2 , +.Xr posix_fadvise 2 .Sh STANDARDS The .Fn posix_madvise Copied: stable/9/lib/libc/sys/posix_fadvise.2 (from r227070, head/lib/libc/sys/posix_fadvise.2) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/lib/libc/sys/posix_fadvise.2 Fri Jan 6 19:29:16 2012 (r229723, copy of r227070, head/lib/libc/sys/posix_fadvise.2) @@ -0,0 +1,139 @@ +.\" Copyright (c) 1991, 1993 +.\" The Regents of the University of California. 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. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 THE REGENTS 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. +.\" +.\" @(#)madvise.2 8.1 (Berkeley) 6/9/93 +.\" $FreeBSD$ +.\" +.Dd October 26, 2011 +.Dt POSIX_FADVISE 2 +.Os +.Sh NAME +.Nm posix_fadvise +.Nd give advice about use of file data +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In fcntl.h +.Ft int +.Fn posix_fadvise "int fd" "off_t offset" "off_t len" "int advice" +.Sh DESCRIPTION +The +.Fn posix_fadvise +system call +allows a process to describe to the system its data access behavior for an +open file descriptor +.Fa fd . +The advice covers the data starting at offset +.Fa offset +and continuing for +.Fa len +bytes. +If +.Fa len +is zero, +all data from +.Fa offset +to the end of the file is covered. +.Pp +The behavior is specified by the +.Fa advice +parameter and may be one of: +.Bl -tag -width POSIX_FADV_SEQUENTIAL +.It Dv POSIX_FADV_NORMAL +Tells the system to revert to the default data access behavior. +.It Dv POSIX_FADV_RANDOM +Is a hint that file data will be accessed randomly, +and prefetching is likely not advantageous. +.It Dv POSIX_FADV_SEQUENTIAL +Tells the system that file data will be accessed sequentially. +This currently does nothing as the default behavior uses heuristics to +detect sequential behavior. +.It Dv POSIX_FADV_WILLNEED +Tells the system that the specified data will be accessed in the near future. +The system may initiate an asychronous read of the data if it is not already +present in memory. +.It Dv POSIX_FADV_DONTNEED +Tells the system that the specified data will not be accessed in the near +future. +The system may decrease the in-memory priority of clean data within the +specified range and future access to this data may require a read operation. +.It Dv POSIX_FADV_NOREUSE +Tells the system that the specified data will only be accessed once and +then not reused. +Accesses to data within the specified range are treated as if the file +descriptor has the +.Dv O_DIRECT +flag enabled. +.El +.Pp +.Sh RETURN VALUES +.Rv -std posix_fadvise +.Sh ERRORS +The +.Fn posix_fadvise +system call will fail if: +.Bl -tag -width Er +.It Bq Er EBADF +The +.Fa fd +argument is not a valid file descriptor. +.It Bq Er EINVAL +The +.Fa advice +argument is not valid. +.It Bq Er EINVAL +The +.Fa offset +or +.Fa len +arguments are negative, +or +.Fa offset ++ +.Fa len +is greater than the maximum file size. +.It Bq Er ENODEV +The +.Fa fd +argument does not refer to a regular file. +.It Bq Er ESPIPE +The +.Fa fd +argument is associated with a pipe or FIFO. +.El +.Sh SEE ALSO +.Xr madvise 2 +.Sh STANDARDS +The +.Fn posix_fadvise +interface conforms to +.St -p1003.1-2001 . +.Sh HISTORY +The +.Fn posix_fadvise +system call first appeared in +.Fx 10.0 . Modified: stable/9/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- stable/9/sys/compat/freebsd32/freebsd32_misc.c Fri Jan 6 19:27:51 2012 (r229722) +++ stable/9/sys/compat/freebsd32/freebsd32_misc.c Fri Jan 6 19:29:16 2012 (r229723) @@ -2808,10 +2808,16 @@ int freebsd32_posix_fallocate(struct thread *td, struct freebsd32_posix_fallocate_args *uap) { - struct posix_fallocate_args ap; - ap.fd = uap->fd; - ap.offset = PAIR32TO64(off_t, uap->offset); - ap.len = PAIR32TO64(off_t, uap->len); - return (sys_posix_fallocate(td, &ap)); + return (kern_posix_fallocate(td, uap->fd, + PAIR32TO64(off_t, uap->offset), PAIR32TO64(off_t, uap->len))); +} + +int +freebsd32_posix_fadvise(struct thread *td, + struct freebsd32_posix_fadvise_args *uap) +{ + + return (kern_posix_fadvise(td, uap->fd, PAIR32TO64(off_t, uap->offset), + PAIR32TO64(off_t, uap->len), uap->advice)); } Modified: stable/9/sys/compat/freebsd32/syscalls.master ============================================================================== --- stable/9/sys/compat/freebsd32/syscalls.master Fri Jan 6 19:27:51 2012 (r229722) +++ stable/9/sys/compat/freebsd32/syscalls.master Fri Jan 6 19:29:16 2012 (r229723) @@ -991,4 +991,7 @@ 530 AUE_NULL STD { int freebsd32_posix_fallocate(int fd,\ uint32_t offset1, uint32_t offset2,\ uint32_t len1, uint32_t len2); } -531 AUE_NULL UNIMPL posix_fadvise +531 AUE_NULL STD { int freebsd32_posix_fadvise(int fd, \ + uint32_t offset1, uint32_t offset2,\ + uint32_t len1, uint32_t len2, \ + int advice); } Modified: stable/9/sys/kern/syscalls.master ============================================================================== --- stable/9/sys/kern/syscalls.master Fri Jan 6 19:27:51 2012 (r229722) +++ stable/9/sys/kern/syscalls.master Fri Jan 6 19:29:16 2012 (r229723) @@ -947,6 +947,7 @@ size_t outbuflen); } 530 AUE_NULL STD { int posix_fallocate(int fd, \ off_t offset, off_t len); } -531 AUE_NULL UNIMPL posix_fadvise +531 AUE_NULL STD { int posix_fadvise(int fd, off_t offset, \ + off_t len, int advice); } ; Please copy any additions and changes to the following compatability tables: ; sys/compat/freebsd32/syscalls.master Modified: stable/9/sys/kern/vfs_default.c ============================================================================== --- stable/9/sys/kern/vfs_default.c Fri Jan 6 19:27:51 2012 (r229722) +++ stable/9/sys/kern/vfs_default.c Fri Jan 6 19:29:16 2012 (r229723) @@ -96,6 +96,7 @@ struct vop_vector default_vnodeops = { .vop_access = vop_stdaccess, .vop_accessx = vop_stdaccessx, + .vop_advise = vop_stdadvise, .vop_advlock = vop_stdadvlock, .vop_advlockasync = vop_stdadvlockasync, .vop_advlockpurge = vop_stdadvlockpurge, @@ -984,6 +985,58 @@ vop_stdallocate(struct vop_allocate_args return (error); } +int +vop_stdadvise(struct vop_advise_args *ap) +{ + struct vnode *vp; + off_t start, end; + int error, vfslocked; + + vp = ap->a_vp; + switch (ap->a_advice) { + case POSIX_FADV_WILLNEED: + /* + * Do nothing for now. Filesystems should provide a + * custom method which starts an asynchronous read of + * the requested region. + */ + error = 0; + break; + case POSIX_FADV_DONTNEED: + /* + * Flush any open FS buffers and then remove pages + * from the backing VM object. Using vinvalbuf() here + * is a bit heavy-handed as it flushes all buffers for + * the given vnode, not just the buffers covering the + * requested range. + */ + error = 0; + vfslocked = VFS_LOCK_GIANT(vp->v_mount); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + if (vp->v_iflag & VI_DOOMED) { + VOP_UNLOCK(vp, 0); + VFS_UNLOCK_GIANT(vfslocked); + break; + } + vinvalbuf(vp, V_CLEANONLY, 0, 0); + if (vp->v_object != NULL) { + start = trunc_page(ap->a_start); + end = round_page(ap->a_end); + VM_OBJECT_LOCK(vp->v_object); + vm_object_page_cache(vp->v_object, OFF_TO_IDX(start), + OFF_TO_IDX(end)); + VM_OBJECT_UNLOCK(vp->v_object); + } + VOP_UNLOCK(vp, 0); + VFS_UNLOCK_GIANT(vfslocked); + break; + default: + error = EINVAL; + break; + } + return (error); +} + /* * vfs default ops * used to fill the vfs function table to get reasonable default return values. Modified: stable/9/sys/kern/vfs_subr.c ============================================================================== --- stable/9/sys/kern/vfs_subr.c Fri Jan 6 19:27:51 2012 (r229722) +++ stable/9/sys/kern/vfs_subr.c Fri Jan 6 19:29:16 2012 (r229723) @@ -1191,7 +1191,7 @@ bufobj_invalbuf(struct bufobj *bo, int f do { error = flushbuflist(&bo->bo_clean, flags, bo, slpflag, slptimeo); - if (error == 0) + if (error == 0 && !(flags & V_CLEANONLY)) error = flushbuflist(&bo->bo_dirty, flags, bo, slpflag, slptimeo); if (error != 0 && error != EAGAIN) { @@ -1220,7 +1220,8 @@ bufobj_invalbuf(struct bufobj *bo, int f /* * Destroy the copy in the VM cache, too. */ - if (bo->bo_object != NULL && (flags & (V_ALT | V_NORMAL)) == 0) { + if (bo->bo_object != NULL && + (flags & (V_ALT | V_NORMAL | V_CLEANONLY)) == 0) { VM_OBJECT_LOCK(bo->bo_object); vm_object_page_remove(bo->bo_object, 0, 0, (flags & V_SAVE) ? OBJPR_CLEANONLY : 0); @@ -1229,7 +1230,7 @@ bufobj_invalbuf(struct bufobj *bo, int f #ifdef INVARIANTS BO_LOCK(bo); - if ((flags & (V_ALT | V_NORMAL)) == 0 && + if ((flags & (V_ALT | V_NORMAL | V_CLEANONLY)) == 0 && (bo->bo_dirty.bv_cnt > 0 || bo->bo_clean.bv_cnt > 0)) panic("vinvalbuf: flush failed"); BO_UNLOCK(bo); Modified: stable/9/sys/kern/vfs_syscalls.c ============================================================================== --- stable/9/sys/kern/vfs_syscalls.c Fri Jan 6 19:27:51 2012 (r229722) +++ stable/9/sys/kern/vfs_syscalls.c Fri Jan 6 19:29:16 2012 (r229723) @@ -86,6 +86,8 @@ __FBSDID("$FreeBSD$"); #include #include +static MALLOC_DEFINE(M_FADVISE, "fadvise", "posix_fadvise(2) information"); + SDT_PROVIDER_DEFINE(vfs); SDT_PROBE_DEFINE(vfs, , stat, mode, mode); SDT_PROBE_ARGTYPE(vfs, , stat, mode, 0, "char *"); @@ -4765,7 +4767,7 @@ out: return (error); } -static int +int kern_posix_fallocate(struct thread *td, int fd, off_t offset, off_t len) { struct file *fp; @@ -4859,3 +4861,140 @@ sys_posix_fallocate(struct thread *td, s return (kern_posix_fallocate(td, uap->fd, uap->offset, uap->len)); } + +/* + * Unlike madvise(2), we do not make a best effort to remember every + * possible caching hint. Instead, we remember the last setting with + * the exception that we will allow POSIX_FADV_NORMAL to adjust the + * region of any current setting. + */ +int +kern_posix_fadvise(struct thread *td, int fd, off_t offset, off_t len, + int advice) +{ + struct fadvise_info *fa, *new; + struct file *fp; + struct vnode *vp; + off_t end; + int error; + + if (offset < 0 || len < 0 || offset > OFF_MAX - len) + return (EINVAL); + switch (advice) { + case POSIX_FADV_SEQUENTIAL: + case POSIX_FADV_RANDOM: + case POSIX_FADV_NOREUSE: + new = malloc(sizeof(*fa), M_FADVISE, M_WAITOK); + break; + case POSIX_FADV_NORMAL: + case POSIX_FADV_WILLNEED: + case POSIX_FADV_DONTNEED: + new = NULL; + break; + default: + return (EINVAL); + } + /* XXX: CAP_POSIX_FADVISE? */ + error = fget(td, fd, 0, &fp); + if (error != 0) + goto out; + + switch (fp->f_type) { + case DTYPE_VNODE: + break; + case DTYPE_PIPE: + case DTYPE_FIFO: + error = ESPIPE; + goto out; + default: + error = ENODEV; + goto out; + } + vp = fp->f_vnode; + if (vp->v_type != VREG) { + error = ENODEV; + goto out; + } + if (len == 0) + end = OFF_MAX; + else + end = offset + len - 1; + switch (advice) { + case POSIX_FADV_SEQUENTIAL: + case POSIX_FADV_RANDOM: + case POSIX_FADV_NOREUSE: + /* + * Try to merge any existing non-standard region with + * this new region if possible, otherwise create a new + * non-standard region for this request. + */ + mtx_pool_lock(mtxpool_sleep, fp); + fa = fp->f_advice; + if (fa != NULL && fa->fa_advice == advice && + ((fa->fa_start <= end && fa->fa_end >= offset) || + (end != OFF_MAX && fa->fa_start == end + 1) || + (fa->fa_end != OFF_MAX && fa->fa_end + 1 == offset))) { + if (offset < fa->fa_start) + fa->fa_start = offset; + if (end > fa->fa_end) + fa->fa_end = end; + } else { + new->fa_advice = advice; + new->fa_start = offset; + new->fa_end = end; + fp->f_advice = new; + new = fa; + } + mtx_pool_unlock(mtxpool_sleep, fp); + break; + case POSIX_FADV_NORMAL: + /* + * If a the "normal" region overlaps with an existing + * non-standard region, trim or remove the + * non-standard region. + */ + mtx_pool_lock(mtxpool_sleep, fp); + fa = fp->f_advice; + if (fa != NULL) { + if (offset <= fa->fa_start && end >= fa->fa_end) { + new = fa; + fp->f_advice = NULL; + } else if (offset <= fa->fa_start && + end >= fa->fa_start) + fa->fa_start = end + 1; + else if (offset <= fa->fa_end && end >= fa->fa_end) + fa->fa_end = offset - 1; + else if (offset >= fa->fa_start && end <= fa->fa_end) { + /* + * If the "normal" region is a middle + * portion of the existing + * non-standard region, just remove + * the whole thing rather than picking + * one side or the other to + * preserve. + */ + new = fa; + fp->f_advice = NULL; + } + } + mtx_pool_unlock(mtxpool_sleep, fp); + break; + case POSIX_FADV_WILLNEED: + case POSIX_FADV_DONTNEED: + error = VOP_ADVISE(vp, offset, end, advice); + break; + } +out: + if (fp != NULL) + fdrop(fp, td); + free(new, M_FADVISE); + return (error); +} + +int +sys_posix_fadvise(struct thread *td, struct posix_fadvise_args *uap) +{ + + return (kern_posix_fadvise(td, uap->fd, uap->offset, uap->len, + uap->advice)); +} Modified: stable/9/sys/kern/vfs_vnops.c ============================================================================== --- stable/9/sys/kern/vfs_vnops.c Fri Jan 6 19:27:51 2012 (r229722) +++ stable/9/sys/kern/vfs_vnops.c Fri Jan 6 19:29:16 2012 (r229723) @@ -518,7 +518,7 @@ vn_read(fp, uio, active_cred, flags, td) struct vnode *vp; int error, ioflag; struct mtx *mtxp; - int vfslocked; + int advice, vfslocked; KASSERT(uio->uio_td == td, ("uio_td %p is not td %p", uio->uio_td, td)); @@ -529,27 +529,48 @@ vn_read(fp, uio, active_cred, flags, td) ioflag |= IO_NDELAY; if (fp->f_flag & O_DIRECT) ioflag |= IO_DIRECT; + advice = POSIX_FADV_NORMAL; vfslocked = VFS_LOCK_GIANT(vp->v_mount); /* * According to McKusick the vn lock was protecting f_offset here. * It is now protected by the FOFFSET_LOCKED flag. */ - if ((flags & FOF_OFFSET) == 0) { + if ((flags & FOF_OFFSET) == 0 || fp->f_advice != NULL) { mtxp = mtx_pool_find(mtxpool_sleep, fp); mtx_lock(mtxp); - while(fp->f_vnread_flags & FOFFSET_LOCKED) { - fp->f_vnread_flags |= FOFFSET_LOCK_WAITING; - msleep(&fp->f_vnread_flags, mtxp, PUSER -1, - "vnread offlock", 0); + if ((flags & FOF_OFFSET) == 0) { + while (fp->f_vnread_flags & FOFFSET_LOCKED) { + fp->f_vnread_flags |= FOFFSET_LOCK_WAITING; + msleep(&fp->f_vnread_flags, mtxp, PUSER -1, + "vnread offlock", 0); + } + fp->f_vnread_flags |= FOFFSET_LOCKED; + uio->uio_offset = fp->f_offset; } - fp->f_vnread_flags |= FOFFSET_LOCKED; + if (fp->f_advice != NULL && + uio->uio_offset >= fp->f_advice->fa_start && + uio->uio_offset + uio->uio_resid <= fp->f_advice->fa_end) + advice = fp->f_advice->fa_advice; mtx_unlock(mtxp); - vn_lock(vp, LK_SHARED | LK_RETRY); - uio->uio_offset = fp->f_offset; - } else - vn_lock(vp, LK_SHARED | LK_RETRY); + } + vn_lock(vp, LK_SHARED | LK_RETRY); - ioflag |= sequential_heuristic(uio, fp); + switch (advice) { + case POSIX_FADV_NORMAL: + case POSIX_FADV_SEQUENTIAL: + ioflag |= sequential_heuristic(uio, fp); + break; + case POSIX_FADV_RANDOM: + /* Disable read-ahead for random I/O. */ + break; + case POSIX_FADV_NOREUSE: + /* + * Request the underlying FS to discard the buffers + * and pages after the I/O is complete. + */ + ioflag |= IO_DIRECT; + break; + } #ifdef MAC error = mac_vnode_check_read(active_cred, fp->f_cred, vp); @@ -584,7 +605,8 @@ vn_write(fp, uio, active_cred, flags, td struct vnode *vp; struct mount *mp; int error, ioflag, lock_flags; - int vfslocked; + struct mtx *mtxp; + int advice, vfslocked; KASSERT(uio->uio_td == td, ("uio_td %p is not td %p", uio->uio_td, td)); @@ -618,7 +640,33 @@ vn_write(fp, uio, active_cred, flags, td vn_lock(vp, lock_flags | LK_RETRY); if ((flags & FOF_OFFSET) == 0) uio->uio_offset = fp->f_offset; - ioflag |= sequential_heuristic(uio, fp); + advice = POSIX_FADV_NORMAL; + if (fp->f_advice != NULL) { + mtxp = mtx_pool_find(mtxpool_sleep, fp); + mtx_lock(mtxp); + if (fp->f_advice != NULL && + uio->uio_offset >= fp->f_advice->fa_start && + uio->uio_offset + uio->uio_resid <= fp->f_advice->fa_end) + advice = fp->f_advice->fa_advice; + mtx_unlock(mtxp); + } + switch (advice) { + case POSIX_FADV_NORMAL: + case POSIX_FADV_SEQUENTIAL: + ioflag |= sequential_heuristic(uio, fp); + break; + case POSIX_FADV_RANDOM: + /* XXX: Is this correct? */ + break; + case POSIX_FADV_NOREUSE: + /* + * Request the underlying FS to discard the buffers + * and pages after the I/O is complete. + */ + ioflag |= IO_DIRECT; + break; + } + #ifdef MAC error = mac_vnode_check_write(active_cred, fp->f_cred, vp); if (error == 0) Modified: stable/9/sys/kern/vnode_if.src ============================================================================== --- stable/9/sys/kern/vnode_if.src Fri Jan 6 19:27:51 2012 (r229722) +++ stable/9/sys/kern/vnode_if.src Fri Jan 6 19:29:16 2012 (r229723) @@ -628,3 +628,12 @@ vop_allocate { INOUT off_t *offset; INOUT off_t *len; }; + +%% advise vp U U U + +vop_advise { + IN struct vnode *vp; + IN off_t start; + IN off_t end; + IN int advice; +}; Modified: stable/9/sys/sys/fcntl.h ============================================================================== --- stable/9/sys/sys/fcntl.h Fri Jan 6 19:27:51 2012 (r229722) +++ stable/9/sys/sys/fcntl.h Fri Jan 6 19:29:16 2012 (r229723) @@ -277,9 +277,17 @@ struct oflock { #define LOCK_UN 0x08 /* unlock file */ #endif +#if __POSIX_VISIBLE >= 200112 /* - * XXX missing posix_fadvise() and POSIX_FADV_* macros. + * Advice to posix_fadvise */ +#define POSIX_FADV_NORMAL 0 /* no special treatment */ +#define POSIX_FADV_RANDOM 1 /* expect random page references */ +#define POSIX_FADV_SEQUENTIAL 2 /* expect sequential page references */ +#define POSIX_FADV_WILLNEED 3 /* will need these pages */ +#define POSIX_FADV_DONTNEED 4 /* dont need these pages */ +#define POSIX_FADV_NOREUSE 5 /* access data only once */ +#endif #ifndef _KERNEL __BEGIN_DECLS @@ -290,6 +298,7 @@ int fcntl(int, int, ...); int openat(int, const char *, int, ...); #endif #if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 +int posix_fadvise(int, off_t, off_t, int); int posix_fallocate(int, off_t, off_t); #endif #if __BSD_VISIBLE Modified: stable/9/sys/sys/file.h ============================================================================== --- stable/9/sys/sys/file.h Fri Jan 6 19:27:51 2012 (r229722) +++ stable/9/sys/sys/file.h Fri Jan 6 19:29:16 2012 (r229723) @@ -122,6 +122,12 @@ struct fileops { * none not locked */ +struct fadvise_info { + int fa_advice; /* (f) FADV_* type. */ + off_t fa_start; /* (f) Region start. */ + off_t fa_end; /* (f) Region end. */ +}; + struct file { void *f_data; /* file descriptor specific data */ struct fileops *f_ops; /* File operations */ @@ -136,7 +142,11 @@ struct file { */ int f_seqcount; /* Count of sequential accesses. */ off_t f_nextoff; /* next expected read/write offset. */ - struct cdev_privdata *f_cdevpriv; /* (d) Private data for the cdev. */ + union { + struct cdev_privdata *fvn_cdevpriv; + /* (d) Private data for the cdev. */ + struct fadvise_info *fvn_advice; + } f_vnun; /* * DFLAG_SEEKABLE specific fields */ @@ -147,6 +157,9 @@ struct file { void *f_label; /* Place-holder for MAC label. */ }; +#define f_cdevpriv f_vnun.fvn_cdevpriv +#define f_advice f_vnun.fvn_advice + #define FOFFSET_LOCKED 0x1 #define FOFFSET_LOCK_WAITING 0x2 Modified: stable/9/sys/sys/param.h ============================================================================== --- stable/9/sys/sys/param.h Fri Jan 6 19:27:51 2012 (r229722) +++ stable/9/sys/sys/param.h Fri Jan 6 19:29:16 2012 (r229723) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 900500 /* Master, propagated to newvers */ +#define __FreeBSD_version 900501 /* Master, propagated to newvers */ #ifdef _KERNEL #define P_OSREL_SIGWAIT 700000 Modified: stable/9/sys/sys/syscallsubr.h ============================================================================== --- stable/9/sys/sys/syscallsubr.h Fri Jan 6 19:27:51 2012 (r229722) +++ stable/9/sys/sys/syscallsubr.h Fri Jan 6 19:29:16 2012 (r229723) @@ -153,6 +153,10 @@ int kern_openat(struct thread *td, int f int kern_pathconf(struct thread *td, char *path, enum uio_seg pathseg, int name, u_long flags); int kern_pipe(struct thread *td, int fildes[2]); +int kern_posix_fadvise(struct thread *td, int fd, off_t offset, off_t len, + int advice); +int kern_posix_fallocate(struct thread *td, int fd, off_t offset, + off_t len); int kern_preadv(struct thread *td, int fd, struct uio *auio, off_t offset); int kern_pselect(struct thread *td, int nd, fd_set *in, fd_set *ou, fd_set *ex, struct timeval *tvp, sigset_t *uset, int abi_nfdbits); Modified: stable/9/sys/sys/unistd.h ============================================================================== --- stable/9/sys/sys/unistd.h Fri Jan 6 19:27:51 2012 (r229722) +++ stable/9/sys/sys/unistd.h Fri Jan 6 19:29:16 2012 (r229723) @@ -49,7 +49,7 @@ * the POSIX standard; however, if the relevant sysconf() function * returns -1, the functions may be stubbed out. */ -#define _POSIX_ADVISORY_INFO -1 +#define _POSIX_ADVISORY_INFO 200112L #define _POSIX_ASYNCHRONOUS_IO 0 #define _POSIX_CHOWN_RESTRICTED 1 #define _POSIX_CLOCK_SELECTION -1 Modified: stable/9/sys/sys/vnode.h ============================================================================== --- stable/9/sys/sys/vnode.h Fri Jan 6 19:27:51 2012 (r229722) +++ stable/9/sys/sys/vnode.h Fri Jan 6 19:29:16 2012 (r229723) @@ -384,6 +384,7 @@ extern int vttoif_tab[]; #define V_SAVE 0x0001 /* vinvalbuf: sync file first */ #define V_ALT 0x0002 /* vinvalbuf: invalidate only alternate bufs */ #define V_NORMAL 0x0004 /* vinvalbuf: invalidate only regular bufs */ +#define V_CLEANONLY 0x0008 /* vinvalbuf: invalidate only clean bufs */ #define REVOKEALL 0x0001 /* vop_revoke: revoke all aliases */ #define V_WAIT 0x0001 /* vn_start_write: sleep for suspend */ #define V_NOWAIT 0x0002 /* vn_start_write: don't sleep for suspend */ @@ -685,6 +686,7 @@ int vop_stdunlock(struct vop_unlock_args int vop_nopoll(struct vop_poll_args *); int vop_stdaccess(struct vop_access_args *ap); int vop_stdaccessx(struct vop_accessx_args *ap); +int vop_stdadvise(struct vop_advise_args *ap); int vop_stdadvlock(struct vop_advlock_args *ap); int vop_stdadvlockasync(struct vop_advlockasync_args *ap); int vop_stdadvlockpurge(struct vop_advlockpurge_args *ap); Modified: stable/9/sys/vm/vm_object.c ============================================================================== --- stable/9/sys/vm/vm_object.c Fri Jan 6 19:27:51 2012 (r229722) +++ stable/9/sys/vm/vm_object.c Fri Jan 6 19:29:16 2012 (r229723) @@ -1878,6 +1878,60 @@ skipmemq: } /* + * vm_object_page_cache: + * + * For the given object, attempt to move the specified clean + * pages to the cache queue. If a page is wired for any reason, + * then it will not be changed. Pages are specified by the given + * range ["start", "end"). As a special case, if "end" is zero, + * then the range extends from "start" to the end of the object. + * Any mappings to the specified pages are removed before the + * pages are moved to the cache queue. + * + * This operation should only be performed on objects that + * contain managed pages. + * + * The object must be locked. + */ +void +vm_object_page_cache(vm_object_t object, vm_pindex_t start, vm_pindex_t end) +{ + struct mtx *mtx, *new_mtx; + vm_page_t p, next; + + VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); + KASSERT((object->type != OBJT_DEVICE && object->type != OBJT_SG && + object->type != OBJT_PHYS), + ("vm_object_page_cache: illegal object %p", object)); + if (object->resident_page_count == 0) + return; + p = vm_page_find_least(object, start); + + /* + * Here, the variable "p" is either (1) the page with the least pindex + * greater than or equal to the parameter "start" or (2) NULL. + */ + mtx = NULL; + for (; p != NULL && (p->pindex < end || end == 0); p = next) { + next = TAILQ_NEXT(p, listq); + + /* + * Avoid releasing and reacquiring the same page lock. + */ + new_mtx = vm_page_lockptr(p); + if (mtx != new_mtx) { + if (mtx != NULL) + mtx_unlock(mtx); + mtx = new_mtx; + mtx_lock(mtx); + } + vm_page_try_to_cache(p); + } + if (mtx != NULL) + mtx_unlock(mtx); +} + +/* * Populate the specified range of the object with valid pages. Returns * TRUE if the range is successfully populated and FALSE otherwise. * Modified: stable/9/sys/vm/vm_object.h ============================================================================== --- stable/9/sys/vm/vm_object.h Fri Jan 6 19:27:51 2012 (r229722) +++ stable/9/sys/vm/vm_object.h Fri Jan 6 19:29:16 2012 (r229723) @@ -224,6 +224,8 @@ void vm_object_destroy (vm_object_t); void vm_object_terminate (vm_object_t); void vm_object_set_writeable_dirty (vm_object_t); void vm_object_init (void); +void vm_object_page_cache(vm_object_t object, vm_pindex_t start, + vm_pindex_t end); void vm_object_page_clean(vm_object_t object, vm_ooffset_t start, vm_ooffset_t end, int flags); void vm_object_page_remove(vm_object_t object, vm_pindex_t start, From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 19:30:17 2012 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 B47751065675; Fri, 6 Jan 2012 19:30:17 +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 9CD248FC13; Fri, 6 Jan 2012 19:30: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 q06JUHKd004392; Fri, 6 Jan 2012 19:30:17 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06JUHVs004379; Fri, 6 Jan 2012 19:30:17 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201061930.q06JUHVs004379@svn.freebsd.org> From: John Baldwin Date: Fri, 6 Jan 2012 19:30:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229724 - in stable/9/sys: compat/freebsd32 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: Fri, 06 Jan 2012 19:30:17 -0000 Author: jhb Date: Fri Jan 6 19:30:17 2012 New Revision: 229724 URL: http://svn.freebsd.org/changeset/base/229724 Log: Regen. Modified: stable/9/sys/compat/freebsd32/freebsd32_proto.h stable/9/sys/compat/freebsd32/freebsd32_syscall.h stable/9/sys/compat/freebsd32/freebsd32_syscalls.c stable/9/sys/compat/freebsd32/freebsd32_sysent.c stable/9/sys/compat/freebsd32/freebsd32_systrace_args.c stable/9/sys/kern/init_sysent.c stable/9/sys/kern/syscalls.c stable/9/sys/kern/systrace_args.c stable/9/sys/sys/syscall.h stable/9/sys/sys/syscall.mk stable/9/sys/sys/sysproto.h Modified: stable/9/sys/compat/freebsd32/freebsd32_proto.h ============================================================================== --- stable/9/sys/compat/freebsd32/freebsd32_proto.h Fri Jan 6 19:29:16 2012 (r229723) +++ stable/9/sys/compat/freebsd32/freebsd32_proto.h Fri Jan 6 19:30:17 2012 (r229724) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/9/sys/compat/freebsd32/syscalls.master 229500 2012-01-04 16:29:45Z jhb + * created from FreeBSD: stable/9/sys/compat/freebsd32/syscalls.master 229723 2012-01-06 19:29:16Z jhb */ #ifndef _FREEBSD32_SYSPROTO_H_ @@ -575,6 +575,14 @@ struct freebsd32_posix_fallocate_args { char len1_l_[PADL_(uint32_t)]; uint32_t len1; char len1_r_[PADR_(uint32_t)]; char len2_l_[PADL_(uint32_t)]; uint32_t len2; char len2_r_[PADR_(uint32_t)]; }; +struct freebsd32_posix_fadvise_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char offset1_l_[PADL_(uint32_t)]; uint32_t offset1; char offset1_r_[PADR_(uint32_t)]; + char offset2_l_[PADL_(uint32_t)]; uint32_t offset2; char offset2_r_[PADR_(uint32_t)]; + char len1_l_[PADL_(uint32_t)]; uint32_t len1; char len1_r_[PADR_(uint32_t)]; + char len2_l_[PADL_(uint32_t)]; uint32_t len2; char len2_r_[PADR_(uint32_t)]; + char advice_l_[PADL_(int)]; int advice; char advice_r_[PADR_(int)]; +}; #if !defined(PAD64_REQUIRED) && defined(__powerpc__) #define PAD64_REQUIRED #endif @@ -684,6 +692,7 @@ int freebsd32_msgctl(struct thread *, st int freebsd32_shmctl(struct thread *, struct freebsd32_shmctl_args *); int freebsd32_pselect(struct thread *, struct freebsd32_pselect_args *); int freebsd32_posix_fallocate(struct thread *, struct freebsd32_posix_fallocate_args *); +int freebsd32_posix_fadvise(struct thread *, struct freebsd32_posix_fadvise_args *); #ifdef COMPAT_43 @@ -1058,6 +1067,7 @@ int freebsd7_freebsd32_shmctl(struct thr #define FREEBSD32_SYS_AUE_freebsd32_shmctl AUE_SHMCTL #define FREEBSD32_SYS_AUE_freebsd32_pselect AUE_SELECT #define FREEBSD32_SYS_AUE_freebsd32_posix_fallocate AUE_NULL +#define FREEBSD32_SYS_AUE_freebsd32_posix_fadvise AUE_NULL #undef PAD_ #undef PADL_ Modified: stable/9/sys/compat/freebsd32/freebsd32_syscall.h ============================================================================== --- stable/9/sys/compat/freebsd32/freebsd32_syscall.h Fri Jan 6 19:29:16 2012 (r229723) +++ stable/9/sys/compat/freebsd32/freebsd32_syscall.h Fri Jan 6 19:30:17 2012 (r229724) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/9/sys/compat/freebsd32/syscalls.master 229500 2012-01-04 16:29:45Z jhb + * created from FreeBSD: stable/9/sys/compat/freebsd32/syscalls.master 229723 2012-01-06 19:29:16Z jhb */ #define FREEBSD32_SYS_syscall 0 @@ -424,4 +424,5 @@ #define FREEBSD32_SYS_rctl_add_rule 528 #define FREEBSD32_SYS_rctl_remove_rule 529 #define FREEBSD32_SYS_freebsd32_posix_fallocate 530 +#define FREEBSD32_SYS_freebsd32_posix_fadvise 531 #define FREEBSD32_SYS_MAXSYSCALL 532 Modified: stable/9/sys/compat/freebsd32/freebsd32_syscalls.c ============================================================================== --- stable/9/sys/compat/freebsd32/freebsd32_syscalls.c Fri Jan 6 19:29:16 2012 (r229723) +++ stable/9/sys/compat/freebsd32/freebsd32_syscalls.c Fri Jan 6 19:30:17 2012 (r229724) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/9/sys/compat/freebsd32/syscalls.master 229500 2012-01-04 16:29:45Z jhb + * created from FreeBSD: stable/9/sys/compat/freebsd32/syscalls.master 229723 2012-01-06 19:29:16Z jhb */ const char *freebsd32_syscallnames[] = { @@ -554,5 +554,5 @@ const char *freebsd32_syscallnames[] = { "rctl_add_rule", /* 528 = rctl_add_rule */ "rctl_remove_rule", /* 529 = rctl_remove_rule */ "freebsd32_posix_fallocate", /* 530 = freebsd32_posix_fallocate */ - "#531", /* 531 = posix_fadvise */ + "freebsd32_posix_fadvise", /* 531 = freebsd32_posix_fadvise */ }; Modified: stable/9/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- stable/9/sys/compat/freebsd32/freebsd32_sysent.c Fri Jan 6 19:29:16 2012 (r229723) +++ stable/9/sys/compat/freebsd32/freebsd32_sysent.c Fri Jan 6 19:30:17 2012 (r229724) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/9/sys/compat/freebsd32/syscalls.master 229500 2012-01-04 16:29:45Z jhb + * created from FreeBSD: stable/9/sys/compat/freebsd32/syscalls.master 229723 2012-01-06 19:29:16Z jhb */ #include "opt_compat.h" @@ -591,5 +591,5 @@ struct sysent freebsd32_sysent[] = { { AS(rctl_add_rule_args), (sy_call_t *)sys_rctl_add_rule, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 528 = rctl_add_rule */ { AS(rctl_remove_rule_args), (sy_call_t *)sys_rctl_remove_rule, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 529 = rctl_remove_rule */ { AS(freebsd32_posix_fallocate_args), (sy_call_t *)freebsd32_posix_fallocate, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 530 = freebsd32_posix_fallocate */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 531 = posix_fadvise */ + { AS(freebsd32_posix_fadvise_args), (sy_call_t *)freebsd32_posix_fadvise, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 531 = freebsd32_posix_fadvise */ }; Modified: stable/9/sys/compat/freebsd32/freebsd32_systrace_args.c ============================================================================== --- stable/9/sys/compat/freebsd32/freebsd32_systrace_args.c Fri Jan 6 19:29:16 2012 (r229723) +++ stable/9/sys/compat/freebsd32/freebsd32_systrace_args.c Fri Jan 6 19:30:17 2012 (r229724) @@ -3034,6 +3034,18 @@ systrace_args(int sysnum, void *params, *n_args = 5; break; } + /* freebsd32_posix_fadvise */ + case 531: { + struct freebsd32_posix_fadvise_args *p = params; + iarg[0] = p->fd; /* int */ + uarg[1] = p->offset1; /* uint32_t */ + uarg[2] = p->offset2; /* uint32_t */ + uarg[3] = p->len1; /* uint32_t */ + uarg[4] = p->len2; /* uint32_t */ + iarg[5] = p->advice; /* int */ + *n_args = 6; + break; + } default: *n_args = 0; break; @@ -8093,6 +8105,31 @@ systrace_setargdesc(int sysnum, int ndx, break; }; break; + /* freebsd32_posix_fadvise */ + case 531: + switch(ndx) { + case 0: + p = "int"; + break; + case 1: + p = "uint32_t"; + break; + case 2: + p = "uint32_t"; + break; + case 3: + p = "uint32_t"; + break; + case 4: + p = "uint32_t"; + break; + case 5: + p = "int"; + break; + default: + break; + }; + break; default: break; }; Modified: stable/9/sys/kern/init_sysent.c ============================================================================== --- stable/9/sys/kern/init_sysent.c Fri Jan 6 19:29:16 2012 (r229723) +++ stable/9/sys/kern/init_sysent.c Fri Jan 6 19:30:17 2012 (r229724) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 224987 2011-08-18 22:51:30Z jonathan + * created from FreeBSD: stable/9/sys/kern/syscalls.master 229723 2012-01-06 19:29:16Z jhb */ #include "opt_compat.h" @@ -565,5 +565,5 @@ struct sysent sysent[] = { { AS(rctl_add_rule_args), (sy_call_t *)sys_rctl_add_rule, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 528 = rctl_add_rule */ { AS(rctl_remove_rule_args), (sy_call_t *)sys_rctl_remove_rule, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 529 = rctl_remove_rule */ { AS(posix_fallocate_args), (sy_call_t *)sys_posix_fallocate, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 530 = posix_fallocate */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 531 = posix_fadvise */ + { AS(posix_fadvise_args), (sy_call_t *)sys_posix_fadvise, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 531 = posix_fadvise */ }; Modified: stable/9/sys/kern/syscalls.c ============================================================================== --- stable/9/sys/kern/syscalls.c Fri Jan 6 19:29:16 2012 (r229723) +++ stable/9/sys/kern/syscalls.c Fri Jan 6 19:30:17 2012 (r229724) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 224987 2011-08-18 22:51:30Z jonathan + * created from FreeBSD: stable/9/sys/kern/syscalls.master 229723 2012-01-06 19:29:16Z jhb */ const char *syscallnames[] = { @@ -538,5 +538,5 @@ const char *syscallnames[] = { "rctl_add_rule", /* 528 = rctl_add_rule */ "rctl_remove_rule", /* 529 = rctl_remove_rule */ "posix_fallocate", /* 530 = posix_fallocate */ - "#531", /* 531 = posix_fadvise */ + "posix_fadvise", /* 531 = posix_fadvise */ }; Modified: stable/9/sys/kern/systrace_args.c ============================================================================== --- stable/9/sys/kern/systrace_args.c Fri Jan 6 19:29:16 2012 (r229723) +++ stable/9/sys/kern/systrace_args.c Fri Jan 6 19:30:17 2012 (r229724) @@ -3234,6 +3234,16 @@ systrace_args(int sysnum, void *params, *n_args = 3; break; } + /* posix_fadvise */ + case 531: { + struct posix_fadvise_args *p = params; + iarg[0] = p->fd; /* int */ + iarg[1] = p->offset; /* off_t */ + iarg[2] = p->len; /* off_t */ + iarg[3] = p->advice; /* int */ + *n_args = 4; + break; + } default: *n_args = 0; break; @@ -8603,6 +8613,25 @@ systrace_setargdesc(int sysnum, int ndx, break; }; break; + /* posix_fadvise */ + case 531: + switch(ndx) { + case 0: + p = "int"; + break; + case 1: + p = "off_t"; + break; + case 2: + p = "off_t"; + break; + case 3: + p = "int"; + break; + default: + break; + }; + break; default: break; }; Modified: stable/9/sys/sys/syscall.h ============================================================================== --- stable/9/sys/sys/syscall.h Fri Jan 6 19:29:16 2012 (r229723) +++ stable/9/sys/sys/syscall.h Fri Jan 6 19:30:17 2012 (r229724) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 224987 2011-08-18 22:51:30Z jonathan + * created from FreeBSD: stable/9/sys/kern/syscalls.master 229723 2012-01-06 19:29:16Z jhb */ #define SYS_syscall 0 @@ -446,4 +446,5 @@ #define SYS_rctl_add_rule 528 #define SYS_rctl_remove_rule 529 #define SYS_posix_fallocate 530 +#define SYS_posix_fadvise 531 #define SYS_MAXSYSCALL 532 Modified: stable/9/sys/sys/syscall.mk ============================================================================== --- stable/9/sys/sys/syscall.mk Fri Jan 6 19:29:16 2012 (r229723) +++ stable/9/sys/sys/syscall.mk Fri Jan 6 19:30:17 2012 (r229724) @@ -1,7 +1,7 @@ # FreeBSD system call names. # DO NOT EDIT-- this file is automatically generated. # $FreeBSD$ -# created from FreeBSD: head/sys/kern/syscalls.master 224987 2011-08-18 22:51:30Z jonathan +# created from FreeBSD: stable/9/sys/kern/syscalls.master 229723 2012-01-06 19:29:16Z jhb MIASM = \ syscall.o \ exit.o \ @@ -394,4 +394,5 @@ MIASM = \ rctl_get_limits.o \ rctl_add_rule.o \ rctl_remove_rule.o \ - posix_fallocate.o + posix_fallocate.o \ + posix_fadvise.o Modified: stable/9/sys/sys/sysproto.h ============================================================================== --- stable/9/sys/sys/sysproto.h Fri Jan 6 19:29:16 2012 (r229723) +++ stable/9/sys/sys/sysproto.h Fri Jan 6 19:30:17 2012 (r229724) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 224987 2011-08-18 22:51:30Z jonathan + * created from FreeBSD: stable/9/sys/kern/syscalls.master 229723 2012-01-06 19:29:16Z jhb */ #ifndef _SYS_SYSPROTO_H_ @@ -1733,6 +1733,12 @@ struct posix_fallocate_args { char offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)]; char len_l_[PADL_(off_t)]; off_t len; char len_r_[PADR_(off_t)]; }; +struct posix_fadvise_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)]; + char len_l_[PADL_(off_t)]; off_t len; char len_r_[PADR_(off_t)]; + char advice_l_[PADL_(int)]; int advice; char advice_r_[PADR_(int)]; +}; int nosys(struct thread *, struct nosys_args *); void sys_sys_exit(struct thread *, struct sys_exit_args *); int sys_fork(struct thread *, struct fork_args *); @@ -2109,6 +2115,7 @@ int sys_rctl_get_limits(struct thread *, int sys_rctl_add_rule(struct thread *, struct rctl_add_rule_args *); int sys_rctl_remove_rule(struct thread *, struct rctl_remove_rule_args *); int sys_posix_fallocate(struct thread *, struct posix_fallocate_args *); +int sys_posix_fadvise(struct thread *, struct posix_fadvise_args *); #ifdef COMPAT_43 @@ -2799,6 +2806,7 @@ int freebsd7_shmctl(struct thread *, str #define SYS_AUE_rctl_add_rule AUE_NULL #define SYS_AUE_rctl_remove_rule AUE_NULL #define SYS_AUE_posix_fallocate AUE_NULL +#define SYS_AUE_posix_fadvise AUE_NULL #undef PAD_ #undef PADL_ From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 19:32:40 2012 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 04BFB106585B; Fri, 6 Jan 2012 19:32:40 +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 DF2718FC0A; Fri, 6 Jan 2012 19:32: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 q06JWd0u004574; Fri, 6 Jan 2012 19:32:39 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06JWdeQ004552; Fri, 6 Jan 2012 19:32:39 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201061932.q06JWdeQ004552@svn.freebsd.org> From: John Baldwin Date: Fri, 6 Jan 2012 19:32:39 +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: r229725 - in stable/8: . lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys 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: Fri, 06 Jan 2012 19:32:40 -0000 Author: jhb Date: Fri Jan 6 19:32:39 2012 New Revision: 229725 URL: http://svn.freebsd.org/changeset/base/229725 Log: MFC 226217,227070,227341,227502: Add the posix_fadvise(2) system call. It is somewhat similar to madvise(2) except that it operates on a file descriptor instead of a memory region. It is currently only supported on regular files. Note that this adds a new VOP, so all filesystem modules must be recompiled. Approved by: re (kib) Added: stable/8/lib/libc/sys/posix_fadvise.2 - copied unchanged from r227070, head/lib/libc/sys/posix_fadvise.2 Modified: stable/8/UPDATING stable/8/lib/libc/sys/Makefile.inc stable/8/lib/libc/sys/Symbol.map stable/8/lib/libc/sys/madvise.2 stable/8/sys/compat/freebsd32/freebsd32_misc.c stable/8/sys/compat/freebsd32/syscalls.master stable/8/sys/kern/syscalls.master stable/8/sys/kern/vfs_default.c stable/8/sys/kern/vfs_subr.c stable/8/sys/kern/vfs_syscalls.c stable/8/sys/kern/vfs_vnops.c stable/8/sys/kern/vnode_if.src stable/8/sys/sys/fcntl.h stable/8/sys/sys/file.h stable/8/sys/sys/param.h stable/8/sys/sys/syscallsubr.h stable/8/sys/sys/unistd.h stable/8/sys/sys/vnode.h stable/8/sys/vm/vm_object.c stable/8/sys/vm/vm_object.h Directory Properties: stable/8/lib/libc/ (props changed) stable/8/lib/libc/stdtime/ (props changed) 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/UPDATING ============================================================================== --- stable/8/UPDATING Fri Jan 6 19:30:17 2012 (r229724) +++ stable/8/UPDATING Fri Jan 6 19:32:39 2012 (r229725) @@ -15,6 +15,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. debugging tools present in HEAD were left in place because sun4v support still needs work to become production ready. +20120106: + A new VOP_ADVISE() was added to support posix_fadvise(2). All + filesystem modules must be recompiled. + +20111116: + A new VOP_ALLOCATE() was added to support posix_fallocate(2). All + filesystem modules must be recompiled. + 20111101: The broken amd(4) driver has been replaced with esp(4) in the amd64, i386 and pc98 GENERIC kernel configuration files. Modified: stable/8/lib/libc/sys/Makefile.inc ============================================================================== --- stable/8/lib/libc/sys/Makefile.inc Fri Jan 6 19:30:17 2012 (r229724) +++ stable/8/lib/libc/sys/Makefile.inc Fri Jan 6 19:32:39 2012 (r229725) @@ -86,7 +86,8 @@ MAN+= abort2.2 accept.2 access.2 acct.2 mq_setattr.2 \ msgctl.2 msgget.2 msgrcv.2 msgsnd.2 \ msync.2 munmap.2 nanosleep.2 nfssvc.2 ntp_adjtime.2 open.2 \ - pathconf.2 pipe.2 poll.2 posix_fallocate.2 posix_openpt.2 profil.2 \ + pathconf.2 pipe.2 poll.2 posix_fadvise.2 posix_fallocate.2 \ + posix_openpt.2 profil.2 \ pselect.2 ptrace.2 quotactl.2 \ read.2 readlink.2 reboot.2 recv.2 rename.2 revoke.2 rfork.2 rmdir.2 \ rtprio.2 Modified: stable/8/lib/libc/sys/Symbol.map ============================================================================== --- stable/8/lib/libc/sys/Symbol.map Fri Jan 6 19:30:17 2012 (r229724) +++ stable/8/lib/libc/sys/Symbol.map Fri Jan 6 19:32:39 2012 (r229725) @@ -364,6 +364,10 @@ FBSD_1.2 { posix_fallocate; }; +FBSD_1.3 { + posix_fadvise; +}; + FBSDprivate_1.0 { ___acl_aclcheck_fd; __sys___acl_aclcheck_fd; Modified: stable/8/lib/libc/sys/madvise.2 ============================================================================== --- stable/8/lib/libc/sys/madvise.2 Fri Jan 6 19:30:17 2012 (r229724) +++ stable/8/lib/libc/sys/madvise.2 Fri Jan 6 19:32:39 2012 (r229725) @@ -169,7 +169,8 @@ was specified and the process does not h .Xr mincore 2 , .Xr mprotect 2 , .Xr msync 2 , -.Xr munmap 2 +.Xr munmap 2 , +.Xr posix_fadvise 2 .Sh STANDARDS The .Fn posix_madvise Copied: stable/8/lib/libc/sys/posix_fadvise.2 (from r227070, head/lib/libc/sys/posix_fadvise.2) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/lib/libc/sys/posix_fadvise.2 Fri Jan 6 19:32:39 2012 (r229725, copy of r227070, head/lib/libc/sys/posix_fadvise.2) @@ -0,0 +1,139 @@ +.\" Copyright (c) 1991, 1993 +.\" The Regents of the University of California. 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. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 THE REGENTS 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. +.\" +.\" @(#)madvise.2 8.1 (Berkeley) 6/9/93 +.\" $FreeBSD$ +.\" +.Dd October 26, 2011 +.Dt POSIX_FADVISE 2 +.Os +.Sh NAME +.Nm posix_fadvise +.Nd give advice about use of file data +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In fcntl.h +.Ft int +.Fn posix_fadvise "int fd" "off_t offset" "off_t len" "int advice" +.Sh DESCRIPTION +The +.Fn posix_fadvise +system call +allows a process to describe to the system its data access behavior for an +open file descriptor +.Fa fd . +The advice covers the data starting at offset +.Fa offset +and continuing for +.Fa len +bytes. +If +.Fa len +is zero, +all data from +.Fa offset +to the end of the file is covered. +.Pp +The behavior is specified by the +.Fa advice +parameter and may be one of: +.Bl -tag -width POSIX_FADV_SEQUENTIAL +.It Dv POSIX_FADV_NORMAL +Tells the system to revert to the default data access behavior. +.It Dv POSIX_FADV_RANDOM +Is a hint that file data will be accessed randomly, +and prefetching is likely not advantageous. +.It Dv POSIX_FADV_SEQUENTIAL +Tells the system that file data will be accessed sequentially. +This currently does nothing as the default behavior uses heuristics to +detect sequential behavior. +.It Dv POSIX_FADV_WILLNEED +Tells the system that the specified data will be accessed in the near future. +The system may initiate an asychronous read of the data if it is not already +present in memory. +.It Dv POSIX_FADV_DONTNEED +Tells the system that the specified data will not be accessed in the near +future. +The system may decrease the in-memory priority of clean data within the +specified range and future access to this data may require a read operation. +.It Dv POSIX_FADV_NOREUSE +Tells the system that the specified data will only be accessed once and +then not reused. +Accesses to data within the specified range are treated as if the file +descriptor has the +.Dv O_DIRECT +flag enabled. +.El +.Pp +.Sh RETURN VALUES +.Rv -std posix_fadvise +.Sh ERRORS +The +.Fn posix_fadvise +system call will fail if: +.Bl -tag -width Er +.It Bq Er EBADF +The +.Fa fd +argument is not a valid file descriptor. +.It Bq Er EINVAL +The +.Fa advice +argument is not valid. +.It Bq Er EINVAL +The +.Fa offset +or +.Fa len +arguments are negative, +or +.Fa offset ++ +.Fa len +is greater than the maximum file size. +.It Bq Er ENODEV +The +.Fa fd +argument does not refer to a regular file. +.It Bq Er ESPIPE +The +.Fa fd +argument is associated with a pipe or FIFO. +.El +.Sh SEE ALSO +.Xr madvise 2 +.Sh STANDARDS +The +.Fn posix_fadvise +interface conforms to +.St -p1003.1-2001 . +.Sh HISTORY +The +.Fn posix_fadvise +system call first appeared in +.Fx 10.0 . Modified: stable/8/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- stable/8/sys/compat/freebsd32/freebsd32_misc.c Fri Jan 6 19:30:17 2012 (r229724) +++ stable/8/sys/compat/freebsd32/freebsd32_misc.c Fri Jan 6 19:32:39 2012 (r229725) @@ -2677,10 +2677,16 @@ int freebsd32_posix_fallocate(struct thread *td, struct freebsd32_posix_fallocate_args *uap) { - struct posix_fallocate_args ap; - ap.fd = uap->fd; - ap.offset = PAIR32TO64(off_t, uap->offset); - ap.len = PAIR32TO64(off_t, uap->len); - return (posix_fallocate(td, &ap)); + return (kern_posix_fallocate(td, uap->fd, + PAIR32TO64(off_t, uap->offset), PAIR32TO64(off_t, uap->len))); +} + +int +freebsd32_posix_fadvise(struct thread *td, + struct freebsd32_posix_fadvise_args *uap) +{ + + return (kern_posix_fadvise(td, uap->fd, PAIR32TO64(off_t, uap->offset), + PAIR32TO64(off_t, uap->len), uap->advice)); } Modified: stable/8/sys/compat/freebsd32/syscalls.master ============================================================================== --- stable/8/sys/compat/freebsd32/syscalls.master Fri Jan 6 19:30:17 2012 (r229724) +++ stable/8/sys/compat/freebsd32/syscalls.master Fri Jan 6 19:32:39 2012 (r229725) @@ -973,4 +973,7 @@ 530 AUE_NULL STD { int freebsd32_posix_fallocate(int fd,\ uint32_t offset1, uint32_t offset2,\ uint32_t len1, uint32_t len2); } -531 AUE_NULL UNIMPL posix_fadvise +531 AUE_NULL STD { int freebsd32_posix_fadvise(int fd, \ + uint32_t offset1, uint32_t offset2,\ + uint32_t len1, uint32_t len2, \ + int advice); } Modified: stable/8/sys/kern/syscalls.master ============================================================================== --- stable/8/sys/kern/syscalls.master Fri Jan 6 19:30:17 2012 (r229724) +++ stable/8/sys/kern/syscalls.master Fri Jan 6 19:32:39 2012 (r229725) @@ -936,6 +936,7 @@ 529 AUE_NULL UNIMPL rctl_remove_rule 530 AUE_NULL STD { int posix_fallocate(int fd, \ off_t offset, off_t len); } -531 AUE_NULL UNIMPL posix_fadvise +531 AUE_NULL STD { int posix_fadvise(int fd, off_t offset, \ + off_t len, int advice); } ; Please copy any additions and changes to the following compatability tables: ; sys/compat/freebsd32/syscalls.master Modified: stable/8/sys/kern/vfs_default.c ============================================================================== --- stable/8/sys/kern/vfs_default.c Fri Jan 6 19:30:17 2012 (r229724) +++ stable/8/sys/kern/vfs_default.c Fri Jan 6 19:32:39 2012 (r229725) @@ -96,6 +96,7 @@ struct vop_vector default_vnodeops = { .vop_access = vop_stdaccess, .vop_accessx = vop_stdaccessx, + .vop_advise = vop_stdadvise, .vop_advlock = vop_stdadvlock, .vop_advlockasync = vop_stdadvlockasync, .vop_allocate = vop_stdallocate, @@ -973,6 +974,58 @@ vop_stdallocate(struct vop_allocate_args return (error); } +int +vop_stdadvise(struct vop_advise_args *ap) +{ + struct vnode *vp; + off_t start, end; + int error, vfslocked; + + vp = ap->a_vp; + switch (ap->a_advice) { + case POSIX_FADV_WILLNEED: + /* + * Do nothing for now. Filesystems should provide a + * custom method which starts an asynchronous read of + * the requested region. + */ + error = 0; + break; + case POSIX_FADV_DONTNEED: + /* + * Flush any open FS buffers and then remove pages + * from the backing VM object. Using vinvalbuf() here + * is a bit heavy-handed as it flushes all buffers for + * the given vnode, not just the buffers covering the + * requested range. + */ + error = 0; + vfslocked = VFS_LOCK_GIANT(vp->v_mount); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + if (vp->v_iflag & VI_DOOMED) { + VOP_UNLOCK(vp, 0); + VFS_UNLOCK_GIANT(vfslocked); + break; + } + vinvalbuf(vp, V_CLEANONLY, 0, 0); + if (vp->v_object != NULL) { + start = trunc_page(ap->a_start); + end = round_page(ap->a_end); + VM_OBJECT_LOCK(vp->v_object); + vm_object_page_cache(vp->v_object, OFF_TO_IDX(start), + OFF_TO_IDX(end)); + VM_OBJECT_UNLOCK(vp->v_object); + } + VOP_UNLOCK(vp, 0); + VFS_UNLOCK_GIANT(vfslocked); + break; + default: + error = EINVAL; + break; + } + return (error); +} + /* * vfs default ops * used to fill the vfs function table to get reasonable default return values. Modified: stable/8/sys/kern/vfs_subr.c ============================================================================== --- stable/8/sys/kern/vfs_subr.c Fri Jan 6 19:30:17 2012 (r229724) +++ stable/8/sys/kern/vfs_subr.c Fri Jan 6 19:32:39 2012 (r229725) @@ -1194,7 +1194,7 @@ bufobj_invalbuf(struct bufobj *bo, int f do { error = flushbuflist(&bo->bo_clean, flags, bo, slpflag, slptimeo); - if (error == 0) + if (error == 0 && !(flags & V_CLEANONLY)) error = flushbuflist(&bo->bo_dirty, flags, bo, slpflag, slptimeo); if (error != 0 && error != EAGAIN) { @@ -1223,7 +1223,8 @@ bufobj_invalbuf(struct bufobj *bo, int f /* * Destroy the copy in the VM cache, too. */ - if (bo->bo_object != NULL && (flags & (V_ALT | V_NORMAL)) == 0) { + if (bo->bo_object != NULL && + (flags & (V_ALT | V_NORMAL | V_CLEANONLY)) == 0) { VM_OBJECT_LOCK(bo->bo_object); vm_object_page_remove(bo->bo_object, 0, 0, (flags & V_SAVE) ? TRUE : FALSE); @@ -1232,7 +1233,7 @@ bufobj_invalbuf(struct bufobj *bo, int f #ifdef INVARIANTS BO_LOCK(bo); - if ((flags & (V_ALT | V_NORMAL)) == 0 && + if ((flags & (V_ALT | V_NORMAL | V_CLEANONLY)) == 0 && (bo->bo_dirty.bv_cnt > 0 || bo->bo_clean.bv_cnt > 0)) panic("vinvalbuf: flush failed"); BO_UNLOCK(bo); Modified: stable/8/sys/kern/vfs_syscalls.c ============================================================================== --- stable/8/sys/kern/vfs_syscalls.c Fri Jan 6 19:30:17 2012 (r229724) +++ stable/8/sys/kern/vfs_syscalls.c Fri Jan 6 19:32:39 2012 (r229725) @@ -84,6 +84,8 @@ __FBSDID("$FreeBSD$"); #include #include +static MALLOC_DEFINE(M_FADVISE, "fadvise", "posix_fadvise(2) information"); + SDT_PROVIDER_DEFINE(vfs); SDT_PROBE_DEFINE(vfs, , stat, mode, mode); SDT_PROBE_ARGTYPE(vfs, , stat, mode, 0, "char *"); @@ -4656,7 +4658,7 @@ out: return (error); } -static int +int kern_posix_fallocate(struct thread *td, int fd, off_t offset, off_t len) { struct file *fp; @@ -4750,3 +4752,139 @@ posix_fallocate(struct thread *td, struc return (kern_posix_fallocate(td, uap->fd, uap->offset, uap->len)); } + +/* + * Unlike madvise(2), we do not make a best effort to remember every + * possible caching hint. Instead, we remember the last setting with + * the exception that we will allow POSIX_FADV_NORMAL to adjust the + * region of any current setting. + */ +int +kern_posix_fadvise(struct thread *td, int fd, off_t offset, off_t len, + int advice) +{ + struct fadvise_info *fa, *new; + struct file *fp; + struct vnode *vp; + off_t end; + int error; + + if (offset < 0 || len < 0 || offset > OFF_MAX - len) + return (EINVAL); + switch (advice) { + case POSIX_FADV_SEQUENTIAL: + case POSIX_FADV_RANDOM: + case POSIX_FADV_NOREUSE: + new = malloc(sizeof(*fa), M_FADVISE, M_WAITOK); + break; + case POSIX_FADV_NORMAL: + case POSIX_FADV_WILLNEED: + case POSIX_FADV_DONTNEED: + new = NULL; + break; + default: + return (EINVAL); + } + error = fget(td, fd, &fp); + if (error != 0) + goto out; + + switch (fp->f_type) { + case DTYPE_VNODE: + break; + case DTYPE_PIPE: + case DTYPE_FIFO: + error = ESPIPE; + goto out; + default: + error = ENODEV; + goto out; + } + vp = fp->f_vnode; + if (vp->v_type != VREG) { + error = ENODEV; + goto out; + } + if (len == 0) + end = OFF_MAX; + else + end = offset + len - 1; + switch (advice) { + case POSIX_FADV_SEQUENTIAL: + case POSIX_FADV_RANDOM: + case POSIX_FADV_NOREUSE: + /* + * Try to merge any existing non-standard region with + * this new region if possible, otherwise create a new + * non-standard region for this request. + */ + mtx_pool_lock(mtxpool_sleep, fp); + fa = fp->f_advice; + if (fa != NULL && fa->fa_advice == advice && + ((fa->fa_start <= end && fa->fa_end >= offset) || + (end != OFF_MAX && fa->fa_start == end + 1) || + (fa->fa_end != OFF_MAX && fa->fa_end + 1 == offset))) { + if (offset < fa->fa_start) + fa->fa_start = offset; + if (end > fa->fa_end) + fa->fa_end = end; + } else { + new->fa_advice = advice; + new->fa_start = offset; + new->fa_end = end; + fp->f_advice = new; + new = fa; + } + mtx_pool_unlock(mtxpool_sleep, fp); + break; + case POSIX_FADV_NORMAL: + /* + * If a the "normal" region overlaps with an existing + * non-standard region, trim or remove the + * non-standard region. + */ + mtx_pool_lock(mtxpool_sleep, fp); + fa = fp->f_advice; + if (fa != NULL) { + if (offset <= fa->fa_start && end >= fa->fa_end) { + new = fa; + fp->f_advice = NULL; + } else if (offset <= fa->fa_start && + end >= fa->fa_start) + fa->fa_start = end + 1; + else if (offset <= fa->fa_end && end >= fa->fa_end) + fa->fa_end = offset - 1; + else if (offset >= fa->fa_start && end <= fa->fa_end) { + /* + * If the "normal" region is a middle + * portion of the existing + * non-standard region, just remove + * the whole thing rather than picking + * one side or the other to + * preserve. + */ + new = fa; + fp->f_advice = NULL; + } + } + mtx_pool_unlock(mtxpool_sleep, fp); + break; + case POSIX_FADV_WILLNEED: + case POSIX_FADV_DONTNEED: + error = VOP_ADVISE(vp, offset, end, advice); + break; + } +out: + if (fp != NULL) + fdrop(fp, td); + free(new, M_FADVISE); + return (error); +} + +int +posix_fadvise(struct thread *td, struct posix_fadvise_args *uap) +{ + + return (kern_posix_fadvise(td, uap->fd, uap->offset, uap->len, + uap->advice)); +} Modified: stable/8/sys/kern/vfs_vnops.c ============================================================================== --- stable/8/sys/kern/vfs_vnops.c Fri Jan 6 19:30:17 2012 (r229724) +++ stable/8/sys/kern/vfs_vnops.c Fri Jan 6 19:32:39 2012 (r229725) @@ -511,7 +511,7 @@ vn_read(fp, uio, active_cred, flags, td) struct vnode *vp; int error, ioflag; struct mtx *mtxp; - int vfslocked; + int advice, vfslocked; KASSERT(uio->uio_td == td, ("uio_td %p is not td %p", uio->uio_td, td)); @@ -522,27 +522,48 @@ vn_read(fp, uio, active_cred, flags, td) ioflag |= IO_NDELAY; if (fp->f_flag & O_DIRECT) ioflag |= IO_DIRECT; + advice = POSIX_FADV_NORMAL; vfslocked = VFS_LOCK_GIANT(vp->v_mount); /* * According to McKusick the vn lock was protecting f_offset here. * It is now protected by the FOFFSET_LOCKED flag. */ - if ((flags & FOF_OFFSET) == 0) { + if ((flags & FOF_OFFSET) == 0 || fp->f_advice != NULL) { mtxp = mtx_pool_find(mtxpool_sleep, fp); mtx_lock(mtxp); - while(fp->f_vnread_flags & FOFFSET_LOCKED) { - fp->f_vnread_flags |= FOFFSET_LOCK_WAITING; - msleep(&fp->f_vnread_flags, mtxp, PUSER -1, - "vnread offlock", 0); + if ((flags & FOF_OFFSET) == 0) { + while (fp->f_vnread_flags & FOFFSET_LOCKED) { + fp->f_vnread_flags |= FOFFSET_LOCK_WAITING; + msleep(&fp->f_vnread_flags, mtxp, PUSER -1, + "vnread offlock", 0); + } + fp->f_vnread_flags |= FOFFSET_LOCKED; + uio->uio_offset = fp->f_offset; } - fp->f_vnread_flags |= FOFFSET_LOCKED; + if (fp->f_advice != NULL && + uio->uio_offset >= fp->f_advice->fa_start && + uio->uio_offset + uio->uio_resid <= fp->f_advice->fa_end) + advice = fp->f_advice->fa_advice; mtx_unlock(mtxp); - vn_lock(vp, LK_SHARED | LK_RETRY); - uio->uio_offset = fp->f_offset; - } else - vn_lock(vp, LK_SHARED | LK_RETRY); + } + vn_lock(vp, LK_SHARED | LK_RETRY); - ioflag |= sequential_heuristic(uio, fp); + switch (advice) { + case POSIX_FADV_NORMAL: + case POSIX_FADV_SEQUENTIAL: + ioflag |= sequential_heuristic(uio, fp); + break; + case POSIX_FADV_RANDOM: + /* Disable read-ahead for random I/O. */ + break; + case POSIX_FADV_NOREUSE: + /* + * Request the underlying FS to discard the buffers + * and pages after the I/O is complete. + */ + ioflag |= IO_DIRECT; + break; + } #ifdef MAC error = mac_vnode_check_read(active_cred, fp->f_cred, vp); @@ -577,7 +598,8 @@ vn_write(fp, uio, active_cred, flags, td struct vnode *vp; struct mount *mp; int error, ioflag, lock_flags; - int vfslocked; + struct mtx *mtxp; + int advice, vfslocked; KASSERT(uio->uio_td == td, ("uio_td %p is not td %p", uio->uio_td, td)); @@ -611,7 +633,33 @@ vn_write(fp, uio, active_cred, flags, td vn_lock(vp, lock_flags | LK_RETRY); if ((flags & FOF_OFFSET) == 0) uio->uio_offset = fp->f_offset; - ioflag |= sequential_heuristic(uio, fp); + advice = POSIX_FADV_NORMAL; + if (fp->f_advice != NULL) { + mtxp = mtx_pool_find(mtxpool_sleep, fp); + mtx_lock(mtxp); + if (fp->f_advice != NULL && + uio->uio_offset >= fp->f_advice->fa_start && + uio->uio_offset + uio->uio_resid <= fp->f_advice->fa_end) + advice = fp->f_advice->fa_advice; + mtx_unlock(mtxp); + } + switch (advice) { + case POSIX_FADV_NORMAL: + case POSIX_FADV_SEQUENTIAL: + ioflag |= sequential_heuristic(uio, fp); + break; + case POSIX_FADV_RANDOM: + /* XXX: Is this correct? */ + break; + case POSIX_FADV_NOREUSE: + /* + * Request the underlying FS to discard the buffers + * and pages after the I/O is complete. + */ + ioflag |= IO_DIRECT; + break; + } + #ifdef MAC error = mac_vnode_check_write(active_cred, fp->f_cred, vp); if (error == 0) Modified: stable/8/sys/kern/vnode_if.src ============================================================================== --- stable/8/sys/kern/vnode_if.src Fri Jan 6 19:30:17 2012 (r229724) +++ stable/8/sys/kern/vnode_if.src Fri Jan 6 19:32:39 2012 (r229725) @@ -621,3 +621,12 @@ vop_allocate { INOUT off_t *offset; INOUT off_t *len; }; + +%% advise vp U U U + +vop_advise { + IN struct vnode *vp; + IN off_t start; + IN off_t end; + IN int advice; +}; Modified: stable/8/sys/sys/fcntl.h ============================================================================== --- stable/8/sys/sys/fcntl.h Fri Jan 6 19:30:17 2012 (r229724) +++ stable/8/sys/sys/fcntl.h Fri Jan 6 19:32:39 2012 (r229725) @@ -277,9 +277,17 @@ struct oflock { #define LOCK_UN 0x08 /* unlock file */ #endif +#if __POSIX_VISIBLE >= 200112 /* - * XXX missing posix_fadvise() and POSIX_FADV_* macros. + * Advice to posix_fadvise */ +#define POSIX_FADV_NORMAL 0 /* no special treatment */ +#define POSIX_FADV_RANDOM 1 /* expect random page references */ +#define POSIX_FADV_SEQUENTIAL 2 /* expect sequential page references */ +#define POSIX_FADV_WILLNEED 3 /* will need these pages */ +#define POSIX_FADV_DONTNEED 4 /* dont need these pages */ +#define POSIX_FADV_NOREUSE 5 /* access data only once */ +#endif #ifndef _KERNEL __BEGIN_DECLS @@ -290,6 +298,7 @@ int fcntl(int, int, ...); int openat(int, const char *, int, ...); #endif #if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 +int posix_fadvise(int, off_t, off_t, int); int posix_fallocate(int, off_t, off_t); #endif #if __BSD_VISIBLE Modified: stable/8/sys/sys/file.h ============================================================================== --- stable/8/sys/sys/file.h Fri Jan 6 19:30:17 2012 (r229724) +++ stable/8/sys/sys/file.h Fri Jan 6 19:32:39 2012 (r229725) @@ -113,6 +113,12 @@ struct fileops { * none not locked */ +struct fadvise_info { + int fa_advice; /* (f) FADV_* type. */ + off_t fa_start; /* (f) Region start. */ + off_t fa_end; /* (f) Region end. */ +}; + struct file { void *f_data; /* file descriptor specific data */ struct fileops *f_ops; /* File operations */ @@ -127,7 +133,11 @@ struct file { */ int f_seqcount; /* Count of sequential accesses. */ off_t f_nextoff; /* next expected read/write offset. */ - struct cdev_privdata *f_cdevpriv; /* (d) Private data for the cdev. */ + union { + struct cdev_privdata *fvn_cdevpriv; + /* (d) Private data for the cdev. */ + struct fadvise_info *fvn_advice; + } f_vnun; /* * DFLAG_SEEKABLE specific fields */ @@ -138,6 +148,9 @@ struct file { void *f_label; /* Place-holder for MAC label. */ }; +#define f_cdevpriv f_vnun.fvn_cdevpriv +#define f_advice f_vnun.fvn_advice + #define FOFFSET_LOCKED 0x1 #define FOFFSET_LOCK_WAITING 0x2 Modified: stable/8/sys/sys/param.h ============================================================================== --- stable/8/sys/sys/param.h Fri Jan 6 19:30:17 2012 (r229724) +++ stable/8/sys/sys/param.h Fri Jan 6 19:32:39 2012 (r229725) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 802514 /* Master, propagated to newvers */ +#define __FreeBSD_version 802515 /* Master, propagated to newvers */ #ifdef _KERNEL #define P_OSREL_SIGWAIT 700000 Modified: stable/8/sys/sys/syscallsubr.h ============================================================================== --- stable/8/sys/sys/syscallsubr.h Fri Jan 6 19:30:17 2012 (r229724) +++ stable/8/sys/sys/syscallsubr.h Fri Jan 6 19:32:39 2012 (r229725) @@ -149,6 +149,10 @@ int kern_openat(struct thread *td, int f int kern_pathconf(struct thread *td, char *path, enum uio_seg pathseg, int name, u_long flags); int kern_pipe(struct thread *td, int fildes[2]); +int kern_posix_fadvise(struct thread *td, int fd, off_t offset, off_t len, + int advice); +int kern_posix_fallocate(struct thread *td, int fd, off_t offset, + off_t len); int kern_preadv(struct thread *td, int fd, struct uio *auio, off_t offset); int kern_pselect(struct thread *td, int nd, fd_set *in, fd_set *ou, fd_set *ex, struct timeval *tvp, sigset_t *uset, int abi_nfdbits); Modified: stable/8/sys/sys/unistd.h ============================================================================== --- stable/8/sys/sys/unistd.h Fri Jan 6 19:30:17 2012 (r229724) +++ stable/8/sys/sys/unistd.h Fri Jan 6 19:32:39 2012 (r229725) @@ -49,7 +49,7 @@ * the POSIX standard; however, if the relevant sysconf() function * returns -1, the functions may be stubbed out. */ -#define _POSIX_ADVISORY_INFO -1 +#define _POSIX_ADVISORY_INFO 200112L #define _POSIX_ASYNCHRONOUS_IO 0 #define _POSIX_CHOWN_RESTRICTED 1 #define _POSIX_CLOCK_SELECTION -1 Modified: stable/8/sys/sys/vnode.h ============================================================================== --- stable/8/sys/sys/vnode.h Fri Jan 6 19:30:17 2012 (r229724) +++ stable/8/sys/sys/vnode.h Fri Jan 6 19:32:39 2012 (r229725) @@ -385,6 +385,7 @@ extern int vttoif_tab[]; #define V_SAVE 0x0001 /* vinvalbuf: sync file first */ #define V_ALT 0x0002 /* vinvalbuf: invalidate only alternate bufs */ #define V_NORMAL 0x0004 /* vinvalbuf: invalidate only regular bufs */ +#define V_CLEANONLY 0x0008 /* vinvalbuf: invalidate only clean bufs */ #define REVOKEALL 0x0001 /* vop_revoke: revoke all aliases */ #define V_WAIT 0x0001 /* vn_start_write: sleep for suspend */ #define V_NOWAIT 0x0002 /* vn_start_write: don't sleep for suspend */ @@ -686,6 +687,7 @@ int vop_stdunlock(struct vop_unlock_args int vop_nopoll(struct vop_poll_args *); int vop_stdaccess(struct vop_access_args *ap); int vop_stdaccessx(struct vop_accessx_args *ap); +int vop_stdadvise(struct vop_advise_args *ap); int vop_stdadvlock(struct vop_advlock_args *ap); int vop_stdadvlockasync(struct vop_advlockasync_args *ap); int vop_stdallocate(struct vop_allocate_args *ap); Modified: stable/8/sys/vm/vm_object.c ============================================================================== --- stable/8/sys/vm/vm_object.c Fri Jan 6 19:30:17 2012 (r229724) +++ stable/8/sys/vm/vm_object.c Fri Jan 6 19:32:39 2012 (r229725) @@ -1874,6 +1874,48 @@ skipmemq: } /* + * vm_object_page_cache: + * + * For the given object, attempt to move the specified clean + * pages to the cache queue. If a page is wired for any reason, + * then it will not be changed. Pages are specified by the given + * range ["start", "end"). As a special case, if "end" is zero, + * then the range extends from "start" to the end of the object. + * Any mappings to the specified pages are removed before the + * pages are moved to the cache queue. + * + * This operation should only be performed on objects that + * contain managed pages. + * + * The object must be locked. + */ +void +vm_object_page_cache(vm_object_t object, vm_pindex_t start, vm_pindex_t end) +{ + vm_page_t p, next; + + VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); + KASSERT((object->type != OBJT_DEVICE && object->type != OBJT_SG && + object->type != OBJT_PHYS), + ("vm_object_page_cache: illegal object %p", object)); + if (object->resident_page_count == 0) + return; + p = vm_page_find_least(object, start); + + /* + * Here, the variable "p" is either (1) the page with the least pindex + * greater than or equal to the parameter "start" or (2) NULL. + */ + vm_page_lock_queues(); + for (; p != NULL && (p->pindex < end || end == 0); p = next) { + next = TAILQ_NEXT(p, listq); + + vm_page_try_to_cache(p); + } + vm_page_unlock_queues(); +} + +/* * Populate the specified range of the object with valid pages. Returns * TRUE if the range is successfully populated and FALSE otherwise. * Modified: stable/8/sys/vm/vm_object.h ============================================================================== --- stable/8/sys/vm/vm_object.h Fri Jan 6 19:30:17 2012 (r229724) +++ stable/8/sys/vm/vm_object.h Fri Jan 6 19:32:39 2012 (r229725) @@ -218,6 +218,8 @@ void vm_object_destroy (vm_object_t); void vm_object_terminate (vm_object_t); void vm_object_set_writeable_dirty (vm_object_t); void vm_object_init (void); +void vm_object_page_cache(vm_object_t object, vm_pindex_t start, + vm_pindex_t end); void vm_object_page_clean (vm_object_t, vm_pindex_t, vm_pindex_t, boolean_t); void vm_object_page_remove (vm_object_t, vm_pindex_t, vm_pindex_t, boolean_t); boolean_t vm_object_populate(vm_object_t, vm_pindex_t, vm_pindex_t); From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 19:33:27 2012 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 939E6106567D; Fri, 6 Jan 2012 19:33:27 +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 732088FC14; Fri, 6 Jan 2012 19:33:27 +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 q06JXROD004686; Fri, 6 Jan 2012 19:33:27 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06JXRFL004674; Fri, 6 Jan 2012 19:33:27 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201061933.q06JXRFL004674@svn.freebsd.org> From: John Baldwin Date: Fri, 6 Jan 2012 19:33:27 +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: r229726 - in stable/8/sys: compat/freebsd32 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: Fri, 06 Jan 2012 19:33:27 -0000 Author: jhb Date: Fri Jan 6 19:33:27 2012 New Revision: 229726 URL: http://svn.freebsd.org/changeset/base/229726 Log: Regen. Modified: stable/8/sys/compat/freebsd32/freebsd32_proto.h stable/8/sys/compat/freebsd32/freebsd32_syscall.h stable/8/sys/compat/freebsd32/freebsd32_syscalls.c stable/8/sys/compat/freebsd32/freebsd32_sysent.c stable/8/sys/compat/freebsd32/freebsd32_systrace_args.c stable/8/sys/kern/init_sysent.c stable/8/sys/kern/syscalls.c stable/8/sys/kern/systrace_args.c stable/8/sys/sys/syscall.h stable/8/sys/sys/syscall.mk stable/8/sys/sys/sysproto.h Modified: stable/8/sys/compat/freebsd32/freebsd32_proto.h ============================================================================== --- stable/8/sys/compat/freebsd32/freebsd32_proto.h Fri Jan 6 19:32:39 2012 (r229725) +++ stable/8/sys/compat/freebsd32/freebsd32_proto.h Fri Jan 6 19:33:27 2012 (r229726) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/8/sys/compat/freebsd32/syscalls.master 227573 2011-11-16 18:33:17Z jhb + * created from FreeBSD: stable/8/sys/compat/freebsd32/syscalls.master 229725 2012-01-06 19:32:39Z jhb */ #ifndef _FREEBSD32_SYSPROTO_H_ @@ -575,6 +575,14 @@ struct freebsd32_posix_fallocate_args { char len1_l_[PADL_(uint32_t)]; uint32_t len1; char len1_r_[PADR_(uint32_t)]; char len2_l_[PADL_(uint32_t)]; uint32_t len2; char len2_r_[PADR_(uint32_t)]; }; +struct freebsd32_posix_fadvise_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char offset1_l_[PADL_(uint32_t)]; uint32_t offset1; char offset1_r_[PADR_(uint32_t)]; + char offset2_l_[PADL_(uint32_t)]; uint32_t offset2; char offset2_r_[PADR_(uint32_t)]; + char len1_l_[PADL_(uint32_t)]; uint32_t len1; char len1_r_[PADR_(uint32_t)]; + char len2_l_[PADL_(uint32_t)]; uint32_t len2; char len2_r_[PADR_(uint32_t)]; + char advice_l_[PADL_(int)]; int advice; char advice_r_[PADR_(int)]; +}; #if !defined(PAD64_REQUIRED) && defined(__powerpc__) #define PAD64_REQUIRED #endif @@ -684,6 +692,7 @@ int freebsd32_msgctl(struct thread *, st int freebsd32_shmctl(struct thread *, struct freebsd32_shmctl_args *); int freebsd32_pselect(struct thread *, struct freebsd32_pselect_args *); int freebsd32_posix_fallocate(struct thread *, struct freebsd32_posix_fallocate_args *); +int freebsd32_posix_fadvise(struct thread *, struct freebsd32_posix_fadvise_args *); #ifdef COMPAT_43 @@ -1015,6 +1024,7 @@ int freebsd7_freebsd32_shmctl(struct thr #define FREEBSD32_SYS_AUE_freebsd32_shmctl AUE_SHMCTL #define FREEBSD32_SYS_AUE_freebsd32_pselect AUE_SELECT #define FREEBSD32_SYS_AUE_freebsd32_posix_fallocate AUE_NULL +#define FREEBSD32_SYS_AUE_freebsd32_posix_fadvise AUE_NULL #undef PAD_ #undef PADL_ Modified: stable/8/sys/compat/freebsd32/freebsd32_syscall.h ============================================================================== --- stable/8/sys/compat/freebsd32/freebsd32_syscall.h Fri Jan 6 19:32:39 2012 (r229725) +++ stable/8/sys/compat/freebsd32/freebsd32_syscall.h Fri Jan 6 19:33:27 2012 (r229726) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/8/sys/compat/freebsd32/syscalls.master 227573 2011-11-16 18:33:17Z jhb + * created from FreeBSD: stable/8/sys/compat/freebsd32/syscalls.master 229725 2012-01-06 19:32:39Z jhb */ #define FREEBSD32_SYS_syscall 0 @@ -411,4 +411,5 @@ #define FREEBSD32_SYS_lpathconf 513 #define FREEBSD32_SYS_freebsd32_pselect 522 #define FREEBSD32_SYS_freebsd32_posix_fallocate 530 +#define FREEBSD32_SYS_freebsd32_posix_fadvise 531 #define FREEBSD32_SYS_MAXSYSCALL 532 Modified: stable/8/sys/compat/freebsd32/freebsd32_syscalls.c ============================================================================== --- stable/8/sys/compat/freebsd32/freebsd32_syscalls.c Fri Jan 6 19:32:39 2012 (r229725) +++ stable/8/sys/compat/freebsd32/freebsd32_syscalls.c Fri Jan 6 19:33:27 2012 (r229726) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/8/sys/compat/freebsd32/syscalls.master 227573 2011-11-16 18:33:17Z jhb + * created from FreeBSD: stable/8/sys/compat/freebsd32/syscalls.master 229725 2012-01-06 19:32:39Z jhb */ const char *freebsd32_syscallnames[] = { @@ -554,5 +554,5 @@ const char *freebsd32_syscallnames[] = { "#528", /* 528 = rctl_add_rule */ "#529", /* 529 = rctl_remove_rule */ "freebsd32_posix_fallocate", /* 530 = freebsd32_posix_fallocate */ - "#531", /* 531 = posix_fadvise */ + "freebsd32_posix_fadvise", /* 531 = freebsd32_posix_fadvise */ }; Modified: stable/8/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- stable/8/sys/compat/freebsd32/freebsd32_sysent.c Fri Jan 6 19:32:39 2012 (r229725) +++ stable/8/sys/compat/freebsd32/freebsd32_sysent.c Fri Jan 6 19:33:27 2012 (r229726) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/8/sys/compat/freebsd32/syscalls.master 227573 2011-11-16 18:33:17Z jhb + * created from FreeBSD: stable/8/sys/compat/freebsd32/syscalls.master 229725 2012-01-06 19:32:39Z jhb */ #include "opt_compat.h" @@ -591,5 +591,5 @@ struct sysent freebsd32_sysent[] = { { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 528 = rctl_add_rule */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 529 = rctl_remove_rule */ { AS(freebsd32_posix_fallocate_args), (sy_call_t *)freebsd32_posix_fallocate, AUE_NULL, NULL, 0, 0, 0 }, /* 530 = freebsd32_posix_fallocate */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 531 = posix_fadvise */ + { AS(freebsd32_posix_fadvise_args), (sy_call_t *)freebsd32_posix_fadvise, AUE_NULL, NULL, 0, 0, 0 }, /* 531 = freebsd32_posix_fadvise */ }; Modified: stable/8/sys/compat/freebsd32/freebsd32_systrace_args.c ============================================================================== --- stable/8/sys/compat/freebsd32/freebsd32_systrace_args.c Fri Jan 6 19:32:39 2012 (r229725) +++ stable/8/sys/compat/freebsd32/freebsd32_systrace_args.c Fri Jan 6 19:33:27 2012 (r229726) @@ -2941,6 +2941,18 @@ systrace_args(int sysnum, void *params, *n_args = 5; break; } + /* freebsd32_posix_fadvise */ + case 531: { + struct freebsd32_posix_fadvise_args *p = params; + iarg[0] = p->fd; /* int */ + uarg[1] = p->offset1; /* uint32_t */ + uarg[2] = p->offset2; /* uint32_t */ + uarg[3] = p->len1; /* uint32_t */ + uarg[4] = p->len2; /* uint32_t */ + iarg[5] = p->advice; /* int */ + *n_args = 6; + break; + } default: *n_args = 0; break; @@ -7843,6 +7855,31 @@ systrace_setargdesc(int sysnum, int ndx, break; }; break; + /* freebsd32_posix_fadvise */ + case 531: + switch(ndx) { + case 0: + p = "int"; + break; + case 1: + p = "uint32_t"; + break; + case 2: + p = "uint32_t"; + break; + case 3: + p = "uint32_t"; + break; + case 4: + p = "uint32_t"; + break; + case 5: + p = "int"; + break; + default: + break; + }; + break; default: break; }; Modified: stable/8/sys/kern/init_sysent.c ============================================================================== --- stable/8/sys/kern/init_sysent.c Fri Jan 6 19:32:39 2012 (r229725) +++ stable/8/sys/kern/init_sysent.c Fri Jan 6 19:33:27 2012 (r229726) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/8/sys/kern/syscalls.master 227573 2011-11-16 18:33:17Z jhb + * created from FreeBSD: stable/8/sys/kern/syscalls.master 229725 2012-01-06 19:32:39Z jhb */ #include "opt_compat.h" @@ -565,5 +565,5 @@ struct sysent sysent[] = { { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 528 = rctl_add_rule */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 529 = rctl_remove_rule */ { AS(posix_fallocate_args), (sy_call_t *)posix_fallocate, AUE_NULL, NULL, 0, 0, 0 }, /* 530 = posix_fallocate */ - { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 531 = posix_fadvise */ + { AS(posix_fadvise_args), (sy_call_t *)posix_fadvise, AUE_NULL, NULL, 0, 0, 0 }, /* 531 = posix_fadvise */ }; Modified: stable/8/sys/kern/syscalls.c ============================================================================== --- stable/8/sys/kern/syscalls.c Fri Jan 6 19:32:39 2012 (r229725) +++ stable/8/sys/kern/syscalls.c Fri Jan 6 19:33:27 2012 (r229726) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/8/sys/kern/syscalls.master 227573 2011-11-16 18:33:17Z jhb + * created from FreeBSD: stable/8/sys/kern/syscalls.master 229725 2012-01-06 19:32:39Z jhb */ const char *syscallnames[] = { @@ -538,5 +538,5 @@ const char *syscallnames[] = { "#528", /* 528 = rctl_add_rule */ "#529", /* 529 = rctl_remove_rule */ "posix_fallocate", /* 530 = posix_fallocate */ - "#531", /* 531 = posix_fadvise */ + "posix_fadvise", /* 531 = posix_fadvise */ }; Modified: stable/8/sys/kern/systrace_args.c ============================================================================== --- stable/8/sys/kern/systrace_args.c Fri Jan 6 19:32:39 2012 (r229725) +++ stable/8/sys/kern/systrace_args.c Fri Jan 6 19:33:27 2012 (r229726) @@ -3117,6 +3117,16 @@ systrace_args(int sysnum, void *params, *n_args = 3; break; } + /* posix_fadvise */ + case 531: { + struct posix_fadvise_args *p = params; + iarg[0] = p->fd; /* int */ + iarg[1] = p->offset; /* off_t */ + iarg[2] = p->len; /* off_t */ + iarg[3] = p->advice; /* int */ + *n_args = 4; + break; + } default: *n_args = 0; break; @@ -8290,6 +8300,25 @@ systrace_setargdesc(int sysnum, int ndx, break; }; break; + /* posix_fadvise */ + case 531: + switch(ndx) { + case 0: + p = "int"; + break; + case 1: + p = "off_t"; + break; + case 2: + p = "off_t"; + break; + case 3: + p = "int"; + break; + default: + break; + }; + break; default: break; }; Modified: stable/8/sys/sys/syscall.h ============================================================================== --- stable/8/sys/sys/syscall.h Fri Jan 6 19:32:39 2012 (r229725) +++ stable/8/sys/sys/syscall.h Fri Jan 6 19:33:27 2012 (r229726) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/8/sys/kern/syscalls.master 227573 2011-11-16 18:33:17Z jhb + * created from FreeBSD: stable/8/sys/kern/syscalls.master 229725 2012-01-06 19:32:39Z jhb */ #define SYS_syscall 0 @@ -432,4 +432,5 @@ #define SYS_lpathconf 513 #define SYS_pselect 522 #define SYS_posix_fallocate 530 +#define SYS_posix_fadvise 531 #define SYS_MAXSYSCALL 532 Modified: stable/8/sys/sys/syscall.mk ============================================================================== --- stable/8/sys/sys/syscall.mk Fri Jan 6 19:32:39 2012 (r229725) +++ stable/8/sys/sys/syscall.mk Fri Jan 6 19:33:27 2012 (r229726) @@ -1,7 +1,7 @@ # FreeBSD system call names. # DO NOT EDIT-- this file is automatically generated. # $FreeBSD$ -# created from FreeBSD: stable/8/sys/kern/syscalls.master 227573 2011-11-16 18:33:17Z jhb +# created from FreeBSD: stable/8/sys/kern/syscalls.master 229725 2012-01-06 19:32:39Z jhb MIASM = \ syscall.o \ exit.o \ @@ -380,4 +380,5 @@ MIASM = \ shmctl.o \ lpathconf.o \ pselect.o \ - posix_fallocate.o + posix_fallocate.o \ + posix_fadvise.o Modified: stable/8/sys/sys/sysproto.h ============================================================================== --- stable/8/sys/sys/sysproto.h Fri Jan 6 19:32:39 2012 (r229725) +++ stable/8/sys/sys/sysproto.h Fri Jan 6 19:33:27 2012 (r229726) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: stable/8/sys/kern/syscalls.master 227573 2011-11-16 18:33:17Z jhb + * created from FreeBSD: stable/8/sys/kern/syscalls.master 229725 2012-01-06 19:32:39Z jhb */ #ifndef _SYS_SYSPROTO_H_ @@ -1670,6 +1670,12 @@ struct posix_fallocate_args { char offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)]; char len_l_[PADL_(off_t)]; off_t len; char len_r_[PADR_(off_t)]; }; +struct posix_fadvise_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)]; + char len_l_[PADL_(off_t)]; off_t len; char len_r_[PADR_(off_t)]; + char advice_l_[PADL_(int)]; int advice; char advice_r_[PADR_(int)]; +}; int nosys(struct thread *, struct nosys_args *); void sys_exit(struct thread *, struct sys_exit_args *); int fork(struct thread *, struct fork_args *); @@ -2032,6 +2038,7 @@ int shmctl(struct thread *, struct shmct int lpathconf(struct thread *, struct lpathconf_args *); int pselect(struct thread *, struct pselect_args *); int posix_fallocate(struct thread *, struct posix_fallocate_args *); +int posix_fadvise(struct thread *, struct posix_fadvise_args *); #ifdef COMPAT_43 @@ -2708,6 +2715,7 @@ int freebsd7_shmctl(struct thread *, str #define SYS_AUE_lpathconf AUE_LPATHCONF #define SYS_AUE_pselect AUE_SELECT #define SYS_AUE_posix_fallocate AUE_NULL +#define SYS_AUE_posix_fadvise AUE_NULL #undef PAD_ #undef PADL_ From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 19:42:50 2012 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 5AF9E106568A; Fri, 6 Jan 2012 19:42:50 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.64.117]) by mx1.freebsd.org (Postfix) with ESMTP id C6D318FC1B; Fri, 6 Jan 2012 19:42:49 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.5/8.14.5) with ESMTP id q06Jgmei065154; Fri, 6 Jan 2012 23:42:48 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id q06Jgmaa065153; Fri, 6 Jan 2012 23:42:48 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Fri, 6 Jan 2012 23:42:48 +0400 From: Gleb Smirnoff To: src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Message-ID: <20120106194248.GV34721@FreeBSD.org> References: <201201061829.q06ITfP0001841@svn.freebsd.org> <20120106190515.GU34721@FreeBSD.org> <20120106191957.GA58317@hub.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <20120106191957.GA58317@hub.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Subject: Re: svn commit: r229714 - 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, 06 Jan 2012 19:42:50 -0000 On Fri, Jan 06, 2012 at 07:19:57PM +0000, Navdeep Parhar wrote: N> On Fri, Jan 06, 2012 at 11:05:15PM +0400, Gleb Smirnoff wrote: N> > Navdeep, N> > N> > On Fri, Jan 06, 2012 at 06:29:41PM +0000, Navdeep Parhar wrote: N> > N> Author: np N> > N> Date: Fri Jan 6 18:29:40 2012 N> > N> New Revision: 229714 N> > N> URL: http://svn.freebsd.org/changeset/base/229714 N> > N> N> > N> Log: N> > N> Always release the inp lock before returning from tcp_detach. N> > ^ after ? N> N> I don't see anything wrong in the message. The lock is released within N> tcp_detach (before it returns), and not after. Ah, sorry. My braino :( -- Totus tuus, Glebius. From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 19:59:28 2012 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 5CCC9106564A; Fri, 6 Jan 2012 19:59:28 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from smtp.fgznet.ch (mail.fgznet.ch [81.92.96.47]) by mx1.freebsd.org (Postfix) with ESMTP id 02DA98FC08; Fri, 6 Jan 2012 19:59:27 +0000 (UTC) Received: from deuterium.andreas.nets (dhclient-91-190-14-19.flashcable.ch [91.190.14.19]) by smtp.fgznet.ch (8.13.8/8.13.8/Submit_SMTPAUTH) with ESMTP id q06Jt8KJ028608; Fri, 6 Jan 2012 20:55:10 +0100 (CET) (envelope-from andreast@FreeBSD.org) Message-ID: <4F07529B.2060608@FreeBSD.org> Date: Fri, 06 Jan 2012 20:59:23 +0100 From: Andreas Tobler User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.5; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 To: Bruce Evans References: <201201060921.q069Lfi8081051@svn.freebsd.org> <20120106225728.G9027@besplex.bde.org> In-Reply-To: <20120106225728.G9027@besplex.bde.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.64 on 81.92.96.47 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r229693 - in head/lib/libc: powerpc powerpc64 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, 06 Jan 2012 19:59:28 -0000 Hi Bruce, thank you for the feedback. I wasn't aware about the fine details. I try to understand and implement what you suggest. It may take several iterations until I match everything. On 06.01.12 14:12, Bruce Evans wrote: > On Fri, 6 Jan 2012, Andreas Tobler wrote: > >> Log: >> Use the macro WEAK_ALIAS. Tested on 32 and 64-bit. > > This API should be fixed before using it extensively. It has the args > reversed relative to the C API __weak_reference(). Also, its name is > different, and the spelling of "=" in its implementation is different. > Perhaps the arg order makes sense for both, since for WEAK_ALIAS() the > alias is the first arg, while for __weak_reference() the symbol being > referred to to create the alias is the first arg. But this is still > confusing. > > The easiest way to fix this is to remove WEAK_ALIAS() and add an asm > API WEAK_REFERENCE(). Unfortunately, ALIAS is a better name than > REFERENCE. __weak_reference() is not so easy to change since it is > used extensively So, I started with a WEAK_REFERENCE macro in sys/powerpc/asm.h It is like the WEAK_ALIAS but with reversed arguments: +#define WEAK_REFERENCE(sym, alias) \ + .weak alias; \ + alias = sym + Here I do not have a preference for the "=" implementation, is it "=" or is it .set ..... If we find a final version I'll be able to delete the WEAK_ALIAS. > Similarly for STRONG_ALIAS() and __strong_reference(), except > STRONG_REFERENCE() doesn't exist for most arches and __strong_reference() > didn't exist until this week, so neither is used extensively. > > More details on current existence and use of these: > > In the kernel, WEAK_ALIAS is not defined for amd64 or sparc64, and is > never used. > > In libc, WEAK_ALIAS was only used for arm, ia64 and mips. Now it is used > for some i386 string functions. > > In the kernel, STRONG_ALIAS was only defined for mips, and was never used. > Now it is also defined for i386, and is never used. > > In libc, STRONG_ALIAS was not used. It was used for a few days in some > i386 string functions. This was a bug. Now WEAK_ALIAS is used instead, > and STRONG_ALIAS is not used again. It is another bug that these > "optimized" i386 string functions (strchr/index and strrchr/rindex) even > exist. amd64 doesn't have them. The MI versions are not very optimal, > but neither are the i386 ones. > >> Modified: head/lib/libc/powerpc/SYS.h >> ============================================================================== >> --- head/lib/libc/powerpc/SYS.h Fri Jan 6 09:17:34 2012 (r229692) >> +++ head/lib/libc/powerpc/SYS.h Fri Jan 6 09:21:40 2012 (r229693) >> @@ -44,10 +44,8 @@ >> .align 2; \ >> 2: b PIC_PLT(CNAME(HIDENAME(cerror))); \ >> ENTRY(__CONCAT(__sys_,x)); \ >> - .weak CNAME(x); \ >> - .set CNAME(x),CNAME(__CONCAT(__sys_,x)); \ >> - .weak CNAME(__CONCAT(_,x)); \ >> - .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \ >> + WEAK_ALIAS(x,__CONCAT(__sys_,x)); \ >> + WEAK_ALIAS(__CONCAT(_,x),__CONCAT(__sys_,x)); \ >> _SYSCALL(x); \ >> bso 2b >> > > The style bugs in this should be fixed someday. This is still messed up > to support K&R. With ancient cpp's, you had to write __CONCAT(x,y) instead > of __CONCAT(x, y) to avoid getting a space between x and y. This was fixed > in Standard C 22 years ago, but all SYS.h files in libc except ia64's one > still use the ugly __CONCAT(x,y) in most places. ia64 hard-codes > __CONCAT(x, y) as x ## y instead. > > The missing space after the comma for the WEAK_ALIAS() parameters is even > less necessary. For ancient cpp's, it allowed WEAK_ALIAS to format the > asm directives without a space. With STDC cpp's, the formatting is > controlled by the macro, but it is still hard to produce nice formatting > because cpp may change whitespace. If I get the above right, the snippet from above should look like this, right? @@ -51,20 +51,17 @@ ld %r0,16(%r1); \ mtlr %r0; \ blr; \ -ENTRY(__CONCAT(__sys_,x)); \ - .weak CNAME(x); \ - .set CNAME(x),CNAME(__CONCAT(__sys_,x)); \ - .weak CNAME(__CONCAT(_,x)); \ - .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \ +ENTRY(__CONCAT(__sys_, x)); \ + WEAK_REFERENCE(__CONCAT(__sys_, x), x); \ + WEAK_REFERENCE(__CONCAT(__sys_, x), __CONCAT(_, x)); \ _SYSCALL(x); \ bso 2b > > __weak_reference() also difference from WEAK_ALIAS() in the spelling > of "=". It uses ".equ". ".set" in the all the SYS.h's except ia64 and > mips (*) seems to be yet another spelling. > > (*) ia64 avoids the hard coded directive using WEAK_ALIAS(). mips > hard-codes "=" instead of ".set". > > Some other gratuitous differences in the SYS.h's: > - arm and mips use _C_LABEL() instead of CNAME() > - ia64 doesn't use either _C_LABEL() or CNAME() > - arm, ia64 and mips don't use HIDENAME() for cerror: > - arm uses CERROR and hard-codes this as _C_LABEL(cerror) > - ia64 hard-codes it as .cerror > - mips hard-codes it as __cerror. > - sparc64 doesn't use ENTRY() or END() and has to repeat things like .type > and .size found in those when it defines _SYSENTRY() and _SYSEND(). > It doesn't use CNAME() in these definitions. Underscores in these > names are bogus, since these names are even less public than ENTRY() > and END() which don't have them. > > Some of these differences may be due to FreeBSD's cleaning up or down > of the decomposition of SYS.h and only for older arches. > Both of these files are MD so you can hard-code things in either, but > I think it is best put as much of the details as possible in the lowest > level, which is. Using WEAK_ALIAS() from there is a > step in this direction. If we want to stay with WEAK_ALIAS I can at least fix the style bugs. Thanks, Andreas From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 20:05:48 2012 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 C62D21065678; Fri, 6 Jan 2012 20:05:48 +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 B52A08FC0C; Fri, 6 Jan 2012 20:05:48 +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 q06K5mNY005774; Fri, 6 Jan 2012 20:05:48 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06K5mTI005772; Fri, 6 Jan 2012 20:05:48 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201062005.q06K5mTI005772@svn.freebsd.org> From: John Baldwin Date: Fri, 6 Jan 2012 20:05:48 +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: r229727 - 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: Fri, 06 Jan 2012 20:05:48 -0000 Author: jhb Date: Fri Jan 6 20:05:48 2012 New Revision: 229727 URL: http://svn.freebsd.org/changeset/base/229727 Log: Use proper argument structure types for the extattr post-VOP hooks. The wrong structure happened to work since the only argument used was the vnode which is in the same place in both VOP_SETATTR() and the two extattr VOPs. MFC after: 3 days Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Fri Jan 6 19:33:27 2012 (r229726) +++ head/sys/kern/vfs_subr.c Fri Jan 6 20:05:48 2012 (r229727) @@ -4035,7 +4035,7 @@ vop_create_post(void *ap, int rc) void vop_deleteextattr_post(void *ap, int rc) { - struct vop_setattr_args *a = ap; + struct vop_deleteextattr_args *a = ap; if (!rc) VFS_KNOTE_LOCKED(a->a_vp, NOTE_ATTRIB); @@ -4125,7 +4125,7 @@ vop_setattr_post(void *ap, int rc) void vop_setextattr_post(void *ap, int rc) { - struct vop_setattr_args *a = ap; + struct vop_setextattr_args *a = ap; if (!rc) VFS_KNOTE_LOCKED(a->a_vp, NOTE_ATTRIB); From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 20:06:45 2012 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 60AC4106564A; Fri, 6 Jan 2012 20:06:45 +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 4FDD38FC13; Fri, 6 Jan 2012 20:06: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 q06K6j3E005838; Fri, 6 Jan 2012 20:06:45 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06K6j7W005836; Fri, 6 Jan 2012 20:06:45 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201201062006.q06K6j7W005836@svn.freebsd.org> From: John Baldwin Date: Fri, 6 Jan 2012 20:06: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: r229728 - 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: Fri, 06 Jan 2012 20:06:45 -0000 Author: jhb Date: Fri Jan 6 20:06:45 2012 New Revision: 229728 URL: http://svn.freebsd.org/changeset/base/229728 Log: Add 5 spare VOPs as placeholders to avoid breaking the KBI in the future when new VOPs are MFC'd to a branch. Reviewed by: kib, bz MFC after: 3 days Modified: head/sys/kern/vnode_if.src Modified: head/sys/kern/vnode_if.src ============================================================================== --- head/sys/kern/vnode_if.src Fri Jan 6 20:05:48 2012 (r229727) +++ head/sys/kern/vnode_if.src Fri Jan 6 20:06:45 2012 (r229728) @@ -50,7 +50,7 @@ # X: locked if not nil. # # The paramater named "vpp" is assumed to be always used with double -# indirection (**vpp) and that name is hard-codeed in vnode_if.awk ! +# indirection (**vpp) and that name is hard-coded in vnode_if.awk ! # # Lines starting with %! specify a pre or post-condition function # to call before/after the vop call. @@ -639,3 +639,28 @@ vop_advise { IN off_t end; IN int advice; }; + +# The VOPs below are spares at the end of the table to allow new VOPs to be +# added in stable branches without breaking the KBI. New VOPs in HEAD should +# be added above these spares. When merging a new VOP to a stable branch, +# the new VOP should replace one of the spares. + +vop_spare1 { + IN struct vnode *vp; +}; + +vop_spare2 { + IN struct vnode *vp; +}; + +vop_spare3 { + IN struct vnode *vp; +}; + +vop_spare4 { + IN struct vnode *vp; +}; + +vop_spare5 { + IN struct vnode *vp; +}; From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 20:21:00 2012 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 29261106566B; Fri, 6 Jan 2012 20:20:59 +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 D24468FC14; Fri, 6 Jan 2012 20:20: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 q06KKxsX006358; Fri, 6 Jan 2012 20:20:59 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06KKxjx006356; Fri, 6 Jan 2012 20:20:59 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201201062020.q06KKxjx006356@svn.freebsd.org> From: Michael Tuexen Date: Fri, 6 Jan 2012 20:20: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: r229729 - 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, 06 Jan 2012 20:21:00 -0000 Author: tuexen Date: Fri Jan 6 20:20:59 2012 New Revision: 229729 URL: http://svn.freebsd.org/changeset/base/229729 Log: Use NULL instead of 0. MFC after: 1 month. Modified: head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctputil.c ============================================================================== --- head/sys/netinet/sctputil.c Fri Jan 6 20:06:45 2012 (r229728) +++ head/sys/netinet/sctputil.c Fri Jan 6 20:20:59 2012 (r229729) @@ -1460,7 +1460,7 @@ sctp_timeout_handler(void *t) type = tmr->type; if (inp) { SCTP_INP_INCR_REF(inp); - if ((inp->sctp_socket == 0) && + if ((inp->sctp_socket == NULL) && ((tmr->type != SCTP_TIMER_TYPE_INPKILL) && (tmr->type != SCTP_TIMER_TYPE_INIT) && (tmr->type != SCTP_TIMER_TYPE_SEND) && From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 21:14:54 2012 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 9F666106564A; Fri, 6 Jan 2012 21:14:54 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 83DA68FC16; Fri, 6 Jan 2012 21:14: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 q06LEsJO008198; Fri, 6 Jan 2012 21:14:54 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06LEsIW008192; Fri, 6 Jan 2012 21:14:54 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201062114.q06LEsIW008192@svn.freebsd.org> From: Dimitry Andric Date: Fri, 6 Jan 2012 21:14:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229731 - in stable/9/sys: conf modules/drm/r128 modules/drm/radeon modules/drm/via 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, 06 Jan 2012 21:14:54 -0000 Author: dim Date: Fri Jan 6 21:14:54 2012 New Revision: 229731 URL: http://svn.freebsd.org/changeset/base/229731 Log: MFC r228978: For several files in sys/dev/drm, disable -Wunused-value when building with clang. There are several macros in these files that return values, and in some cases nothing is done with them, but it is completely harmless. For some other files, also disable -Wconstant-conversion, since that triggers a false positive with the DMA_BIT_MASK() macro. Modified: stable/9/sys/conf/files stable/9/sys/conf/kern.mk stable/9/sys/modules/drm/r128/Makefile stable/9/sys/modules/drm/radeon/Makefile stable/9/sys/modules/drm/via/Makefile Directory Properties: stable/9/sys/ (props changed) stable/9/sys/conf/ (props changed) Modified: stable/9/sys/conf/files ============================================================================== --- stable/9/sys/conf/files Fri Jan 6 20:44:57 2012 (r229730) +++ stable/9/sys/conf/files Fri Jan 6 21:14:54 2012 (r229731) @@ -985,15 +985,18 @@ dev/drm/mga_irq.c optional mgadrm dev/drm/mga_state.c optional mgadrm \ compile-with "${NORMAL_C} -finline-limit=13500" dev/drm/mga_warp.c optional mgadrm -dev/drm/r128_cce.c optional r128drm +dev/drm/r128_cce.c optional r128drm \ + compile-with "${NORMAL_C} ${NO_WUNUSED_VALUE} ${NO_WCONSTANT_CONVERSION}" dev/drm/r128_drv.c optional r128drm dev/drm/r128_irq.c optional r128drm dev/drm/r128_state.c optional r128drm \ - compile-with "${NORMAL_C} -finline-limit=13500" + compile-with "${NORMAL_C} ${NO_WUNUSED_VALUE} -finline-limit=13500" dev/drm/r300_cmdbuf.c optional radeondrm dev/drm/r600_blit.c optional radeondrm -dev/drm/r600_cp.c optional radeondrm -dev/drm/radeon_cp.c optional radeondrm +dev/drm/r600_cp.c optional radeondrm \ + compile-with "${NORMAL_C} ${NO_WUNUSED_VALUE} ${NO_WCONSTANT_CONVERSION}" +dev/drm/radeon_cp.c optional radeondrm \ + compile-with "${NORMAL_C} ${NO_WUNUSED_VALUE} ${NO_WCONSTANT_CONVERSION}" dev/drm/radeon_cs.c optional radeondrm dev/drm/radeon_drv.c optional radeondrm dev/drm/radeon_irq.c optional radeondrm Modified: stable/9/sys/conf/kern.mk ============================================================================== --- stable/9/sys/conf/kern.mk Fri Jan 6 20:44:57 2012 (r229730) +++ stable/9/sys/conf/kern.mk Fri Jan 6 21:14:54 2012 (r229731) @@ -20,6 +20,7 @@ NO_WCONSTANT_CONVERSION= -Wno-constant-c NO_WARRAY_BOUNDS= -Wno-array-bounds NO_WSHIFT_COUNT_NEGATIVE= -Wno-shift-count-negative NO_WSHIFT_COUNT_OVERFLOW= -Wno-shift-count-overflow +NO_WUNUSED_VALUE= -Wno-unused-value # Several other warnings which might be useful in some cases, but not severe # enough to error out the whole kernel build. Display them anyway, so there is # some incentive to fix them eventually. Modified: stable/9/sys/modules/drm/r128/Makefile ============================================================================== --- stable/9/sys/modules/drm/r128/Makefile Fri Jan 6 20:44:57 2012 (r229730) +++ stable/9/sys/modules/drm/r128/Makefile Fri Jan 6 21:14:54 2012 (r229731) @@ -6,3 +6,7 @@ SRCS = r128_cce.c r128_drv.c r128_irq.c SRCS +=device_if.h bus_if.h pci_if.h opt_drm.h .include + +CWARNFLAGS.r128_cce.c= ${NO_WUNUSED_VALUE} ${NO_WCONSTANT_CONVERSION} +CWARNFLAGS.r128_state.c= ${NO_WUNUSED_VALUE} +CWARNFLAGS+= ${CWARNFLAGS.${.IMPSRC:T}} Modified: stable/9/sys/modules/drm/radeon/Makefile ============================================================================== --- stable/9/sys/modules/drm/radeon/Makefile Fri Jan 6 20:44:57 2012 (r229730) +++ stable/9/sys/modules/drm/radeon/Makefile Fri Jan 6 21:14:54 2012 (r229731) @@ -7,3 +7,7 @@ SRCS = r300_cmdbuf.c r600_blit.c r600_cp SRCS +=device_if.h bus_if.h pci_if.h opt_drm.h .include + +CWARNFLAGS.r600_cp.c= ${NO_WUNUSED_VALUE} ${NO_WCONSTANT_CONVERSION} +CWARNFLAGS.radeon_cp.c= ${NO_WUNUSED_VALUE} ${NO_WCONSTANT_CONVERSION} +CWARNFLAGS+= ${CWARNFLAGS.${.IMPSRC:T}} Modified: stable/9/sys/modules/drm/via/Makefile ============================================================================== --- stable/9/sys/modules/drm/via/Makefile Fri Jan 6 20:44:57 2012 (r229730) +++ stable/9/sys/modules/drm/via/Makefile Fri Jan 6 21:14:54 2012 (r229731) @@ -20,3 +20,7 @@ opt_drm.h: echo $(DRM_LINUX_OPT) >> opt_drm.h .include + +CWARNFLAGS.via_dma.c= ${NO_WUNUSED_VALUE} +CWARNFLAGS.via_dmablit.c= ${NO_WUNUSED_VALUE} +CWARNFLAGS+= ${CWARNFLAGS.${.IMPSRC:T}} From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 21:16:52 2012 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 43F981065677; Fri, 6 Jan 2012 21:16:52 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3262D8FC13; Fri, 6 Jan 2012 21:16:52 +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 q06LGqkn008313; Fri, 6 Jan 2012 21:16:52 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06LGqGH008311; Fri, 6 Jan 2012 21:16:52 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201062116.q06LGqGH008311@svn.freebsd.org> From: Dimitry Andric Date: Fri, 6 Jan 2012 21:16:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229732 - stable/9/sys/dev/drm 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, 06 Jan 2012 21:16:52 -0000 Author: dim Date: Fri Jan 6 21:16:51 2012 New Revision: 229732 URL: http://svn.freebsd.org/changeset/base/229732 Log: MFC r228979: In sys/dev/drm/radeon_state.c, use the correct printf length modifiers for ints. Modified: stable/9/sys/dev/drm/radeon_state.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/drm/radeon_state.c ============================================================================== --- stable/9/sys/dev/drm/radeon_state.c Fri Jan 6 21:14:54 2012 (r229731) +++ stable/9/sys/dev/drm/radeon_state.c Fri Jan 6 21:16:51 2012 (r229732) @@ -1745,7 +1745,7 @@ static int radeon_cp_dispatch_texture(st DRM_DEBUG("tex=%dx%d blit=%d\n", tex_width, tex->height, blit_width); do { - DRM_DEBUG("tex: ofs=0x%x p=%d f=%d x=%hd y=%hd w=%hd h=%hd\n", + DRM_DEBUG("tex: ofs=0x%x p=%d f=%d x=%d y=%d w=%d h=%d\n", tex->offset >> 10, tex->pitch, tex->format, image->x, image->y, image->width, image->height); From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 21:19:43 2012 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 9DCE4106567A; Fri, 6 Jan 2012 21:19:43 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 70EDC8FC13; Fri, 6 Jan 2012 21:19:43 +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 q06LJhpi008456; Fri, 6 Jan 2012 21:19:43 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06LJhk2008453; Fri, 6 Jan 2012 21:19:43 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201062119.q06LJhk2008453@svn.freebsd.org> From: Dimitry Andric Date: Fri, 6 Jan 2012 21:19:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229733 - in stable/9/sys/dev/ath/ath_hal: ar5210 ar5211 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, 06 Jan 2012 21:19:43 -0000 Author: dim Date: Fri Jan 6 21:19:43 2012 New Revision: 229733 URL: http://svn.freebsd.org/changeset/base/229733 Log: MFC r228980: Reapply r228785 now it has been tested by Adrian. Also add comments with the old AR_SCR_SLE_XXX values, with a short explanation why they were changed. Reviewed by: adrian Modified: stable/9/sys/dev/ath/ath_hal/ar5210/ar5210reg.h stable/9/sys/dev/ath/ath_hal/ar5211/ar5211reg.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/ath/ath_hal/ar5210/ar5210reg.h ============================================================================== --- stable/9/sys/dev/ath/ath_hal/ar5210/ar5210reg.h Fri Jan 6 21:16:51 2012 (r229732) +++ stable/9/sys/dev/ath/ath_hal/ar5210/ar5210reg.h Fri Jan 6 21:19:43 2012 (r229733) @@ -245,9 +245,20 @@ #define AR_SCR_SLDUR 0x0000ffff /* sleep duration */ #define AR_SCR_SLE 0x00030000 /* sleep enable */ #define AR_SCR_SLE_S 16 -#define AR_SCR_SLE_WAKE 0x00000000 /* force wake */ -#define AR_SCR_SLE_SLP 0x00010000 /* force sleep */ -#define AR_SCR_SLE_ALLOW 0x00020000 /* allow to control sleep */ +/* + * The previous values for the following three defines were: + * + * AR_SCR_SLE_WAKE 0x00000000 + * AR_SCR_SLE_SLP 0x00010000 + * AR_SCR_SLE_ALLOW 0x00020000 + * + * However, these have been pre-shifted with AR_SCR_SLE_S. The + * OS_REG_READ() macro would attempt to shift them again, effectively + * shifting out any of the set bits completely. + */ +#define AR_SCR_SLE_WAKE 0 /* force wake */ +#define AR_SCR_SLE_SLP 1 /* force sleep */ +#define AR_SCR_SLE_ALLOW 2 /* allow to control sleep */ #define AR_SCR_BITS "\20\20SLE_SLP\21SLE_ALLOW" #define AR_INTPEND_IP 0x00000001 /* interrupt pending */ Modified: stable/9/sys/dev/ath/ath_hal/ar5211/ar5211reg.h ============================================================================== --- stable/9/sys/dev/ath/ath_hal/ar5211/ar5211reg.h Fri Jan 6 21:16:51 2012 (r229732) +++ stable/9/sys/dev/ath/ath_hal/ar5211/ar5211reg.h Fri Jan 6 21:19:43 2012 (r229733) @@ -618,9 +618,20 @@ #define AR_SCR_SLDUR_S 0 #define AR_SCR_SLE 0x00030000 /* sleep enable mask */ #define AR_SCR_SLE_S 16 /* sleep enable bits shift */ -#define AR_SCR_SLE_WAKE 0x00000000 /* force wake */ -#define AR_SCR_SLE_SLP 0x00010000 /* force sleep */ -#define AR_SCR_SLE_NORM 0x00020000 /* sleep logic normal operation */ +/* + * The previous values for the following three defines were: + * + * AR_SCR_SLE_WAKE 0x00000000 + * AR_SCR_SLE_SLP 0x00010000 + * AR_SCR_SLE_NORM 0x00020000 + * + * However, these have been pre-shifted with AR_SCR_SLE_S. The + * OS_REG_READ() macro would attempt to shift them again, effectively + * shifting out any of the set bits completely. + */ +#define AR_SCR_SLE_WAKE 0 /* force wake */ +#define AR_SCR_SLE_SLP 1 /* force sleep */ +#define AR_SCR_SLE_NORM 2 /* sleep logic normal operation */ #define AR_SCR_SLE_UNITS 0x00000008 /* SCR units/TU */ #define AR_SCR_BITS "\20\20SLE_SLP\21SLE" From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 21:23:01 2012 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 0A55D106566B; Fri, 6 Jan 2012 21:23:01 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EB89E8FC13; Fri, 6 Jan 2012 21:23: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 q06LN0U9008629; Fri, 6 Jan 2012 21:23:00 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06LN0en008623; Fri, 6 Jan 2012 21:23:00 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201062123.q06LN0en008623@svn.freebsd.org> From: Dimitry Andric Date: Fri, 6 Jan 2012 21:23:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229734 - in stable/9/sys: conf modules/ipfilter modules/nxge modules/xfs 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, 06 Jan 2012 21:23:01 -0000 Author: dim Date: Fri Jan 6 21:23:00 2012 New Revision: 229734 URL: http://svn.freebsd.org/changeset/base/229734 Log: MFC r228994: Disable several instances instances of clang's -Wself-assign warning. All of these are harmless, and are in fact used to shut up warnings from lint. While here, remove -Wno-missing-prototypes from the xfs module Makefile, as I could not reproduce those warnings either with gcc or clang. Modified: stable/9/sys/conf/files stable/9/sys/conf/kern.mk stable/9/sys/modules/ipfilter/Makefile stable/9/sys/modules/nxge/Makefile stable/9/sys/modules/xfs/Makefile Directory Properties: stable/9/sys/ (props changed) stable/9/sys/conf/ (props changed) Modified: stable/9/sys/conf/files ============================================================================== --- stable/9/sys/conf/files Fri Jan 6 21:19:43 2012 (r229733) +++ stable/9/sys/conf/files Fri Jan 6 21:23:00 2012 (r229734) @@ -301,7 +301,7 @@ contrib/dev/acpica/utilities/utstate.c contrib/dev/acpica/utilities/utxface.c optional acpi contrib/dev/acpica/utilities/utxferror.c optional acpi contrib/ipfilter/netinet/fil.c optional ipfilter inet \ - compile-with "${NORMAL_C} -I$S/contrib/ipfilter" + compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN} -I$S/contrib/ipfilter" contrib/ipfilter/netinet/ip_auth.c optional ipfilter inet \ compile-with "${NORMAL_C} -I$S/contrib/ipfilter" contrib/ipfilter/netinet/ip_fil_freebsd.c optional ipfilter inet \ @@ -313,11 +313,11 @@ contrib/ipfilter/netinet/ip_log.c option contrib/ipfilter/netinet/ip_nat.c optional ipfilter inet \ compile-with "${NORMAL_C} -I$S/contrib/ipfilter" contrib/ipfilter/netinet/ip_proxy.c optional ipfilter inet \ - compile-with "${NORMAL_C} -I$S/contrib/ipfilter" + compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN} -I$S/contrib/ipfilter" contrib/ipfilter/netinet/ip_state.c optional ipfilter inet \ compile-with "${NORMAL_C} -I$S/contrib/ipfilter" contrib/ipfilter/netinet/ip_lookup.c optional ipfilter inet \ - compile-with "${NORMAL_C} -Wno-error -I$S/contrib/ipfilter" + compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN} -Wno-error -I$S/contrib/ipfilter" contrib/ipfilter/netinet/ip_pool.c optional ipfilter inet \ compile-with "${NORMAL_C} -I$S/contrib/ipfilter" contrib/ipfilter/netinet/ip_htable.c optional ipfilter inet \ @@ -1514,17 +1514,25 @@ dev/my/if_my.c optional my dev/ncv/ncr53c500.c optional ncv dev/ncv/ncr53c500_pccard.c optional ncv pccard dev/nge/if_nge.c optional nge -dev/nxge/if_nxge.c optional nxge -dev/nxge/xgehal/xgehal-device.c optional nxge +dev/nxge/if_nxge.c optional nxge \ + compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN}" +dev/nxge/xgehal/xgehal-device.c optional nxge \ + compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN}" dev/nxge/xgehal/xgehal-mm.c optional nxge dev/nxge/xgehal/xge-queue.c optional nxge -dev/nxge/xgehal/xgehal-driver.c optional nxge -dev/nxge/xgehal/xgehal-ring.c optional nxge -dev/nxge/xgehal/xgehal-channel.c optional nxge -dev/nxge/xgehal/xgehal-fifo.c optional nxge -dev/nxge/xgehal/xgehal-stats.c optional nxge +dev/nxge/xgehal/xgehal-driver.c optional nxge \ + compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN}" +dev/nxge/xgehal/xgehal-ring.c optional nxge \ + compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN}" +dev/nxge/xgehal/xgehal-channel.c optional nxge \ + compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN}" +dev/nxge/xgehal/xgehal-fifo.c optional nxge \ + compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN}" +dev/nxge/xgehal/xgehal-stats.c optional nxge \ + compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN}" dev/nxge/xgehal/xgehal-config.c optional nxge -dev/nxge/xgehal/xgehal-mgmt.c optional nxge +dev/nxge/xgehal/xgehal-mgmt.c optional nxge \ + compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN}" dev/nmdm/nmdm.c optional nmdm dev/nsp/nsp.c optional nsp dev/nsp/nsp_pccard.c optional nsp pccard @@ -3469,7 +3477,7 @@ gnu/fs/xfs/FreeBSD/xfs_sysctl.c optional gnu/fs/xfs/FreeBSD/xfs_fs_subr.c optional xfs \ compile-with "${NORMAL_C} -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs" gnu/fs/xfs/FreeBSD/xfs_ioctl.c optional xfs \ - compile-with "${NORMAL_C} -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs" + compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN} -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs" gnu/fs/xfs/FreeBSD/support/debug.c optional xfs \ compile-with "${NORMAL_C} -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs" gnu/fs/xfs/FreeBSD/support/ktrace.c optional xfs \ Modified: stable/9/sys/conf/kern.mk ============================================================================== --- stable/9/sys/conf/kern.mk Fri Jan 6 21:19:43 2012 (r229733) +++ stable/9/sys/conf/kern.mk Fri Jan 6 21:23:00 2012 (r229734) @@ -21,6 +21,7 @@ NO_WARRAY_BOUNDS= -Wno-array-bounds NO_WSHIFT_COUNT_NEGATIVE= -Wno-shift-count-negative NO_WSHIFT_COUNT_OVERFLOW= -Wno-shift-count-overflow NO_WUNUSED_VALUE= -Wno-unused-value +NO_WSELF_ASSIGN= -Wno-self-assign # Several other warnings which might be useful in some cases, but not severe # enough to error out the whole kernel build. Display them anyway, so there is # some incentive to fix them eventually. Modified: stable/9/sys/modules/ipfilter/Makefile ============================================================================== --- stable/9/sys/modules/ipfilter/Makefile Fri Jan 6 21:19:43 2012 (r229733) +++ stable/9/sys/modules/ipfilter/Makefile Fri Jan 6 21:23:00 2012 (r229734) @@ -26,3 +26,8 @@ CFLAGS+= -DIPFILTER=1 -DIPFILTER_LKM -DI # .include + +CWARNFLAGS.fil.c= ${NO_WSELF_ASSIGN} +CWARNFLAGS.ip_proxy.c= ${NO_WSELF_ASSIGN} +CWARNFLAGS.ip_lookup.c= ${NO_WSELF_ASSIGN} +CWARNFLAGS+= ${CWARNFLAGS.${.IMPSRC:T}} Modified: stable/9/sys/modules/nxge/Makefile ============================================================================== --- stable/9/sys/modules/nxge/Makefile Fri Jan 6 21:19:43 2012 (r229733) +++ stable/9/sys/modules/nxge/Makefile Fri Jan 6 21:23:00 2012 (r229734) @@ -39,3 +39,13 @@ SRCS+= xgehal-mgmt.c SRCS+= device_if.h bus_if.h pci_if.h .include + +CWARNFLAGS.if_nxge.c= ${NO_WSELF_ASSIGN} +CWARNFLAGS.xgehal-device.c= ${NO_WSELF_ASSIGN} +CWARNFLAGS.xgehal-driver.c= ${NO_WSELF_ASSIGN} +CWARNFLAGS.xgehal-ring.c= ${NO_WSELF_ASSIGN} +CWARNFLAGS.xgehal-channel.c= ${NO_WSELF_ASSIGN} +CWARNFLAGS.xgehal-fifo.c= ${NO_WSELF_ASSIGN} +CWARNFLAGS.xgehal-stats.c= ${NO_WSELF_ASSIGN} +CWARNFLAGS.xgehal-mgmt.c= ${NO_WSELF_ASSIGN} +CWARNFLAGS+= ${CWARNFLAGS.${.IMPSRC:T}} Modified: stable/9/sys/modules/xfs/Makefile ============================================================================== --- stable/9/sys/modules/xfs/Makefile Fri Jan 6 21:19:43 2012 (r229733) +++ stable/9/sys/modules/xfs/Makefile Fri Jan 6 21:23:00 2012 (r229734) @@ -86,8 +86,5 @@ CFLAGS+= -I${.CURDIR}/../../gnu/fs/xfs/F -I${.CURDIR}/../../gnu/fs/xfs/FreeBSD/support \ -I${.CURDIR}/../../gnu/fs/xfs -# -# XFS sources trigger missing-prototypes warnings. -# Disable them here. -# -CWARNFLAGS+= -Wno-missing-prototypes +CWARNFLAGS.xfs_ioctl.c= ${NO_WSELF_ASSIGN} +CWARNFLAGS+= ${CWARNFLAGS.${.IMPSRC:T}} From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 21:28:30 2012 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 76101106567D; Fri, 6 Jan 2012 21:28:30 +0000 (UTC) (envelope-from ghelmer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DFD808FC12; Fri, 6 Jan 2012 21:28: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 q06LSTLx008887; Fri, 6 Jan 2012 21:28:29 GMT (envelope-from ghelmer@svn.freebsd.org) Received: (from ghelmer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06LSTON008885; Fri, 6 Jan 2012 21:28:29 GMT (envelope-from ghelmer@svn.freebsd.org) Message-Id: <201201062128.q06LSTON008885@svn.freebsd.org> From: Guy Helmer Date: Fri, 6 Jan 2012 21:28: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: r229735 - head/lib/libdevstat 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, 06 Jan 2012 21:28:30 -0000 Author: ghelmer Date: Fri Jan 6 21:28:29 2012 New Revision: 229735 URL: http://svn.freebsd.org/changeset/base/229735 Log: Handle memory allocation failures in devstat_getdevs(), devstat_selectdevs(), and devstat_buildmatch(). PR: bin/83359 Reviewed by: ken Modified: head/lib/libdevstat/devstat.c Modified: head/lib/libdevstat/devstat.c ============================================================================== --- head/lib/libdevstat/devstat.c Fri Jan 6 21:23:00 2012 (r229734) +++ head/lib/libdevstat/devstat.c Fri Jan 6 21:28:29 2012 (r229735) @@ -365,6 +365,12 @@ devstat_getdevs(kvm_t *kd, struct statin dssize = (dinfo->numdevs * sizeof(struct devstat)) + sizeof(long); dinfo->mem_ptr = (u_int8_t *)malloc(dssize); + if (dinfo->mem_ptr == NULL) { + snprintf(devstat_errbuf, sizeof(devstat_errbuf), + "%s: Cannot allocate memory for mem_ptr element", + __func__); + return(-1); + } } else dssize = (dinfo->numdevs * sizeof(struct devstat)) + sizeof(long); @@ -567,7 +573,7 @@ devstat_selectdevs(struct device_selecti * either enlarge or reduce the size of the device selection list. */ } else if (*num_selections != numdevs) { - *dev_select = (struct device_selection *)realloc(*dev_select, + *dev_select = (struct device_selection *)reallocf(*dev_select, numdevs * sizeof(struct device_selection)); *select_generation = current_generation; init_selections = 1; @@ -581,6 +587,13 @@ devstat_selectdevs(struct device_selecti init_selections = 1; } + if (*dev_select == NULL) { + snprintf(devstat_errbuf, sizeof(devstat_errbuf), + "%s: Cannot (re)allocate memory for dev_select argument", + __func__); + return(-1); + } + /* * If we're in "only" mode, we want to clear out the selected * variable since we're going to select exactly what the user wants @@ -608,6 +621,12 @@ devstat_selectdevs(struct device_selecti || (perf_select != 0)) && (changed == 0)){ old_dev_select = (struct device_selection *)malloc( *num_selections * sizeof(struct device_selection)); + if (old_dev_select == NULL) { + snprintf(devstat_errbuf, sizeof(devstat_errbuf), + "%s: Cannot allocate memory for selection list backup", + __func__); + return(-1); + } old_num_selections = *num_selections; bcopy(*dev_select, old_dev_select, sizeof(struct device_selection) * *num_selections); @@ -1028,16 +1047,17 @@ devstat_buildmatch(char *match_str, stru return(-1); } - /* - * Since you can't realloc a pointer that hasn't been malloced - * first, we malloc first and then realloc. - */ if (*num_matches == 0) - *matches = (struct devstat_match *)malloc( - sizeof(struct devstat_match)); - else - *matches = (struct devstat_match *)realloc(*matches, - sizeof(struct devstat_match) * (*num_matches + 1)); + *matches = NULL; + + *matches = (struct devstat_match *)reallocf(*matches, + sizeof(struct devstat_match) * (*num_matches + 1)); + + if (*matches == NULL) { + snprintf(devstat_errbuf, sizeof(devstat_errbuf), + "%s: Cannot allocate memory for matches list", __func__); + return(-1); + } /* Make sure the current entry is clear */ bzero(&matches[0][*num_matches], sizeof(struct devstat_match)); From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 21:43:27 2012 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 160391065677; Fri, 6 Jan 2012 21:43:27 +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 030688FC1B; Fri, 6 Jan 2012 21:43:27 +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 q06LhRdv009536; Fri, 6 Jan 2012 21:43:27 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06LhQDm009532; Fri, 6 Jan 2012 21:43:26 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201062143.q06LhQDm009532@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 6 Jan 2012 21:43:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229736 - stable/9/sys/dev/et 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, 06 Jan 2012 21:43:27 -0000 Author: yongari Date: Fri Jan 6 21:43:26 2012 New Revision: 229736 URL: http://svn.freebsd.org/changeset/base/229736 Log: MFC r228333,228335-228336,228362,228368-228369,228381: r228333: Protect SIOCSIFMTU ioctl handler with driver lock. Don't blindly re-initialize controller whenever MTU is changed. Now, reinitializing is done only when driver is running. While here, remove unnecessary assignment of error value since it was already initialized to 0. r228335: Consistently use a tab character instead of using either a space or tab after #define. While I'm here consistently use capital letters when it uses hexadecimal notation. No functional changes. r228336: Disable all clocks and put PHY into COMA before entering into suspend state. This will save more power. On resume, make sure to enable all clocks. While I'm here, if controller is not fast ethernet, enable gigabit PHY. r228362: Do not disable interrupt without knowing whether the raised interrupt is ours. Note, interrupts are automatically ACKed when the status register is read. Add RX/TX DMA error to interrupt handler and do full controller reset if driver happen to encounter these errors. There is no way to recover from these DMA errors without controller reset. Rename local variable name intrs with status to enhance readability. While I'm here, rename ET_INTR_TXEOF and ET_INTR_RXEOF to ET_INTR_TXDMA and ET_INTR_RXDMA respectively. These interrupts indicate that a frame is successfully DMAed to controller's internal FIFO and they have nothing to do with EOF(end of frame). Driver does not need to wait actual end of TX/RX of a frame(e.g. no need to wait the end signal of TX which is generated when a frame in TX FIFO is emptied by MAC). Previous names were somewhat confusing. r228368: Remove unnecessary definition of ET_PCIR_BAR. Controller support I/O memory only. While here, use pci_set_max_read_req(9) rather than directly manipulating PCIe device control register. r228369: Announce flow control ability to PHY driver and enable RX flow control. Controller does not automatically generate pause frames based on number of available RX buffers so it's very hard to know when driver should generate XON frame in time. The only mechanism driver can detect low number of RX buffer condition is ET_INTR_RXRING0_LOW or ET_INTR_RXRING1_LOW interrupt. This interrupt is generated whenever controller notices the number of available RX buffers are lower than pre-programmed value( ET_RX_RING0_MINCNT and ET_RX_RING1_MINCNT register). This scheme does not provide a way to detect when controller sees enough number of RX buffers again such that efficient generation of XON/XOFF frame is not easy. While here, add more flow control related register definition. r228381: FreeBSD driver does not require arpcom structure in softc. Modified: stable/9/sys/dev/et/if_et.c stable/9/sys/dev/et/if_etreg.h stable/9/sys/dev/et/if_etvar.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/dev/et/if_et.c ============================================================================== --- stable/9/sys/dev/et/if_et.c Fri Jan 6 21:28:29 2012 (r229735) +++ stable/9/sys/dev/et/if_et.c Fri Jan 6 21:43:26 2012 (r229736) @@ -220,6 +220,7 @@ et_attach(device_t dev) struct et_softc *sc; struct ifnet *ifp; uint8_t eaddr[ETHER_ADDR_LEN]; + uint32_t pmcfg; int cap, error, msic; sc = device_get_softc(dev); @@ -249,9 +250,9 @@ et_attach(device_t dev) /* * Allocate IO memory */ - sc->sc_mem_rid = ET_PCIR_BAR; + sc->sc_mem_rid = PCIR_BAR(0); sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, - &sc->sc_mem_rid, RF_ACTIVE); + &sc->sc_mem_rid, RF_ACTIVE); if (sc->sc_mem_res == NULL) { device_printf(dev, "can't allocate IO memory\n"); return (ENXIO); @@ -304,8 +305,11 @@ et_attach(device_t dev) et_get_eaddr(dev, eaddr); - CSR_WRITE_4(sc, ET_PM, - ET_PM_SYSCLK_GATE | ET_PM_TXCLK_GATE | ET_PM_RXCLK_GATE); + /* Take PHY out of COMA and enable clocks. */ + pmcfg = ET_PM_SYSCLK_GATE | ET_PM_TXCLK_GATE | ET_PM_RXCLK_GATE; + if ((sc->sc_flags & ET_FLAG_FASTETHER) == 0) + pmcfg |= EM_PM_GIGEPHY_ENB; + CSR_WRITE_4(sc, ET_PM, pmcfg); et_reset(sc); @@ -328,7 +332,8 @@ et_attach(device_t dev) et_chip_attach(sc); error = mii_attach(dev, &sc->sc_miibus, ifp, et_ifmedia_upd, - et_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + et_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, + MIIF_DOPAUSE); if (error) { device_printf(dev, "attaching PHYs failed\n"); goto fail; @@ -544,12 +549,23 @@ et_miibus_statchg(device_t dev) if (IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) { cfg2 |= ET_MAC_CFG2_FDX; + /* + * Controller lacks automatic TX pause frame + * generation so it should be handled by driver. + * Even though driver can send pause frame with + * arbitrary pause time, controller does not + * provide a way that tells how many free RX + * buffers are available in controller. This + * limitation makes it hard to generate XON frame + * in time on driver side so don't enable TX flow + * control. + */ #ifdef notyet if (IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_TXPAUSE) cfg1 |= ET_MAC_CFG1_TXFLOW; +#endif if (IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_RXPAUSE) cfg1 |= ET_MAC_CFG1_RXFLOW; -#endif } else ctrl |= ET_MAC_CTRL_GHDX; @@ -718,12 +734,7 @@ et_bus_config(struct et_softc *sc) /* * Set max read request size to 2048 bytes */ - val = pci_read_config(sc->dev, - sc->sc_expcap + PCIR_EXPRESS_DEVICE_CTL, 2); - val &= ~PCIM_EXP_CTL_MAX_READ_REQUEST; - val |= ET_PCIV_DEVICE_CTRL_RRSZ_2K; - pci_write_config(sc->dev, - sc->sc_expcap + PCIR_EXPRESS_DEVICE_CTL, val, 2); + pci_set_max_read_req(sc->dev, 2048); return (0); } @@ -1154,34 +1165,40 @@ et_intr(void *xsc) { struct et_softc *sc = xsc; struct ifnet *ifp; - uint32_t intrs; + uint32_t status; ET_LOCK(sc); ifp = sc->ifp; - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { - ET_UNLOCK(sc); - return; - } + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + goto done; + + status = CSR_READ_4(sc, ET_INTR_STATUS); + if ((status & ET_INTRS) == 0) + goto done; /* Disable further interrupts. */ CSR_WRITE_4(sc, ET_INTR_MASK, 0xffffffff); - intrs = CSR_READ_4(sc, ET_INTR_STATUS); - if ((intrs & ET_INTRS) == 0) - goto done; - - if (intrs & ET_INTR_RXEOF) + if (status & (ET_INTR_RXDMA_ERROR | ET_INTR_TXDMA_ERROR)) { + device_printf(sc->dev, "DMA error(0x%08x) -- resetting\n", + status); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + et_init_locked(sc); + ET_UNLOCK(sc); + return; + } + if (status & ET_INTR_RXDMA) et_rxeof(sc); - if (intrs & (ET_INTR_TXEOF | ET_INTR_TIMER)) + if (status & (ET_INTR_TXDMA | ET_INTR_TIMER)) et_txeof(sc); - if (intrs & ET_INTR_TIMER) + if (status & ET_INTR_TIMER) CSR_WRITE_4(sc, ET_TIMER, sc->sc_timer); -done: if (ifp->if_drv_flags & IFF_DRV_RUNNING) { CSR_WRITE_4(sc, ET_INTR_MASK, ~ET_INTRS); if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) et_start_locked(ifp); } +done: ET_UNLOCK(sc); } @@ -1287,11 +1304,11 @@ et_ioctl(struct ifnet *ifp, u_long cmd, ET_LOCK(sc); et_setmulti(sc); ET_UNLOCK(sc); - error = 0; } break; case SIOCSIFMTU: + ET_LOCK(sc); #if 0 if (sc->sc_flags & ET_FLAG_JUMBO) max_framelen = ET_JUMBO_FRAMELEN; @@ -1301,14 +1318,18 @@ et_ioctl(struct ifnet *ifp, u_long cmd, if (ET_FRAMELEN(ifr->ifr_mtu) > max_framelen) { error = EOPNOTSUPP; + ET_UNLOCK(sc); break; } if (ifp->if_mtu != ifr->ifr_mtu) { ifp->if_mtu = ifr->ifr_mtu; - ifp->if_drv_flags &= ~IFF_DRV_RUNNING; - et_init(sc); + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + et_init_locked(sc); + } } + ET_UNLOCK(sc); break; case SIOCSIFCAP: @@ -1940,8 +1961,12 @@ et_init_txmac(struct et_softc *sc) /* Disable TX MAC and FC(?) */ CSR_WRITE_4(sc, ET_TXMAC_CTRL, ET_TXMAC_CTRL_FC_DISABLE); - /* No flow control yet */ - CSR_WRITE_4(sc, ET_TXMAC_FLOWCTRL, 0); + /* + * Initialize pause time. + * This register should be set before XON/XOFF frame is + * sent by driver. + */ + CSR_WRITE_4(sc, ET_TXMAC_FLOWCTRL, 0 << ET_TXMAC_FLOWCTRL_CFPT_SHIFT); /* Enable TX MAC but leave FC(?) diabled */ CSR_WRITE_4(sc, ET_TXMAC_CTRL, @@ -2632,11 +2657,18 @@ static int et_suspend(device_t dev) { struct et_softc *sc; + uint32_t pmcfg; sc = device_get_softc(dev); ET_LOCK(sc); if ((sc->ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) et_stop(sc); + /* Diable all clocks and put PHY into COMA. */ + pmcfg = CSR_READ_4(sc, ET_PM); + pmcfg &= ~(EM_PM_GIGEPHY_ENB | ET_PM_SYSCLK_GATE | ET_PM_TXCLK_GATE | + ET_PM_RXCLK_GATE); + pmcfg |= ET_PM_PHY_SW_COMA; + CSR_WRITE_4(sc, ET_PM, pmcfg); ET_UNLOCK(sc); return (0); } @@ -2645,9 +2677,15 @@ static int et_resume(device_t dev) { struct et_softc *sc; + uint32_t pmcfg; sc = device_get_softc(dev); ET_LOCK(sc); + /* Take PHY out of COMA and enable clocks. */ + pmcfg = ET_PM_SYSCLK_GATE | ET_PM_TXCLK_GATE | ET_PM_RXCLK_GATE; + if ((sc->sc_flags & ET_FLAG_FASTETHER) == 0) + pmcfg |= EM_PM_GIGEPHY_ENB; + CSR_WRITE_4(sc, ET_PM, pmcfg); if ((sc->ifp->if_flags & IFF_UP) != 0) et_init_locked(sc); ET_UNLOCK(sc); Modified: stable/9/sys/dev/et/if_etreg.h ============================================================================== --- stable/9/sys/dev/et/if_etreg.h Fri Jan 6 21:28:29 2012 (r229735) +++ stable/9/sys/dev/et/if_etreg.h Fri Jan 6 21:43:26 2012 (r229736) @@ -38,11 +38,11 @@ #ifndef _IF_ETREG_H #define _IF_ETREG_H -#define ET_MEM_TXSIZE_EX 182 -#define ET_MEM_RXSIZE_MIN 608 -#define ET_MEM_RXSIZE_DEFAULT 11216 -#define ET_MEM_SIZE 16384 -#define ET_MEM_UNIT 16 +#define ET_MEM_TXSIZE_EX 182 +#define ET_MEM_RXSIZE_MIN 608 +#define ET_MEM_RXSIZE_DEFAULT 11216 +#define ET_MEM_SIZE 16384 +#define ET_MEM_UNIT 16 /* * PCI registers @@ -53,270 +53,277 @@ * ET_PCIV_REPLAY_TIMER_{128,256} are from * PCI EXPRESS BASE SPECIFICATION, REV. 1.0a, Table 3-4 */ -#define ET_PCIR_BAR PCIR_BAR(0) +#define ET_PCIR_DEVICE_CAPS 0x4C +#define ET_PCIM_DEVICE_CAPS_MAX_PLSZ 0x7 /* Max playload size */ +#define ET_PCIV_DEVICE_CAPS_PLSZ_128 0x0 +#define ET_PCIV_DEVICE_CAPS_PLSZ_256 0x1 + +#define ET_PCIR_DEVICE_CTRL 0x50 +#define ET_PCIM_DEVICE_CTRL_MAX_RRSZ 0x7000 /* Max read request size */ +#define ET_PCIV_DEVICE_CTRL_RRSZ_2K 0x4000 + +#define ET_PCIR_MAC_ADDR0 0xA4 +#define ET_PCIR_MAC_ADDR1 0xA8 + +#define ET_PCIR_EEPROM_STATUS 0xB2 /* XXX undocumented */ +#define ET_PCIM_EEPROM_STATUS_ERROR 0x4C + +#define ET_PCIR_ACK_LATENCY 0xC0 +#define ET_PCIV_ACK_LATENCY_128 237 +#define ET_PCIV_ACK_LATENCY_256 416 + +#define ET_PCIR_REPLAY_TIMER 0xC2 +#define ET_REPLAY_TIMER_RX_L0S_ADJ 250 /* XXX infered from default */ +#define ET_PCIV_REPLAY_TIMER_128 (711 + ET_REPLAY_TIMER_RX_L0S_ADJ) +#define ET_PCIV_REPLAY_TIMER_256 (1248 + ET_REPLAY_TIMER_RX_L0S_ADJ) -#define ET_PCIR_DEVICE_CAPS 0x4c -#define ET_PCIM_DEVICE_CAPS_MAX_PLSZ 0x7 /* Max playload size */ -#define ET_PCIV_DEVICE_CAPS_PLSZ_128 0x0 -#define ET_PCIV_DEVICE_CAPS_PLSZ_256 0x1 - -#define ET_PCIR_DEVICE_CTRL 0x50 -#define ET_PCIM_DEVICE_CTRL_MAX_RRSZ 0x7000 /* Max read request size */ -#define ET_PCIV_DEVICE_CTRL_RRSZ_2K 0x4000 - -#define ET_PCIR_MAC_ADDR0 0xa4 -#define ET_PCIR_MAC_ADDR1 0xa8 - -#define ET_PCIR_EEPROM_STATUS 0xb2 /* XXX undocumented */ -#define ET_PCIM_EEPROM_STATUS_ERROR 0x4c - -#define ET_PCIR_ACK_LATENCY 0xc0 -#define ET_PCIV_ACK_LATENCY_128 237 -#define ET_PCIV_ACK_LATENCY_256 416 - -#define ET_PCIR_REPLAY_TIMER 0xc2 -#define ET_REPLAY_TIMER_RX_L0S_ADJ 250 /* XXX infered from default */ -#define ET_PCIV_REPLAY_TIMER_128 (711 + ET_REPLAY_TIMER_RX_L0S_ADJ) -#define ET_PCIV_REPLAY_TIMER_256 (1248 + ET_REPLAY_TIMER_RX_L0S_ADJ) - -#define ET_PCIR_L0S_L1_LATENCY 0xcf +#define ET_PCIR_L0S_L1_LATENCY 0xCF /* * CSR */ -#define ET_TXQUEUE_START 0x0000 -#define ET_TXQUEUE_END 0x0004 -#define ET_RXQUEUE_START 0x0008 -#define ET_RXQUEUE_END 0x000c -#define ET_QUEUE_ADDR(addr) (((addr) / ET_MEM_UNIT) - 1) -#define ET_QUEUE_ADDR_START 0 -#define ET_QUEUE_ADDR_END ET_QUEUE_ADDR(ET_MEM_SIZE) - -#define ET_PM 0x0010 -#define ET_PM_SYSCLK_GATE 0x00000008 -#define ET_PM_TXCLK_GATE 0x00000010 -#define ET_PM_RXCLK_GATE 0x00000020 - -#define ET_INTR_STATUS 0x0018 -#define ET_INTR_MASK 0x001c - -#define ET_SWRST 0x0028 -#define ET_SWRST_TXDMA 0x00000001 -#define ET_SWRST_RXDMA 0x00000002 -#define ET_SWRST_TXMAC 0x00000004 -#define ET_SWRST_RXMAC 0x00000008 -#define ET_SWRST_MAC 0x00000010 -#define ET_SWRST_MAC_STAT 0x00000020 -#define ET_SWRST_MMC 0x00000040 -#define ET_SWRST_SELFCLR_DISABLE 0x80000000 - -#define ET_MSI_CFG 0x0030 - -#define ET_LOOPBACK 0x0034 - -#define ET_TIMER 0x0038 - -#define ET_TXDMA_CTRL 0x1000 -#define ET_TXDMA_CTRL_HALT 0x00000001 -#define ET_TXDMA_CTRL_CACHE_THR_MASK 0x000000F0 -#define ET_TXDMA_CTRL_SINGLE_EPKT 0x00000100 /* ??? */ - -#define ET_TX_RING_HI 0x1004 -#define ET_TX_RING_LO 0x1008 -#define ET_TX_RING_CNT 0x100c - -#define ET_TX_STATUS_HI 0x101c -#define ET_TX_STATUS_LO 0x1020 - -#define ET_TX_READY_POS 0x1024 -#define ET_TX_READY_POS_INDEX_MASK 0x000003FF -#define ET_TX_READY_POS_WRAP 0x00000400 - -#define ET_TX_DONE_POS 0x1060 -#define ET_TX_DONE_POS_INDEX_MASK 0x0000003FF -#define ET_TX_DONE_POS_WRAP 0x000000400 - -#define ET_RXDMA_CTRL 0x2000 -#define ET_RXDMA_CTRL_HALT 0x00000001 -#define ET_RXDMA_CTRL_RING0_SIZE_MASK 0x00000300 -#define ET_RXDMA_CTRL_RING0_128 0x00000000 /* 127 */ -#define ET_RXDMA_CTRL_RING0_256 0x00000100 /* 255 */ -#define ET_RXDMA_CTRL_RING0_512 0x00000200 /* 511 */ -#define ET_RXDMA_CTRL_RING0_1024 0x00000300 /* 1023 */ -#define ET_RXDMA_CTRL_RING0_ENABLE 0x00000400 -#define ET_RXDMA_CTRL_RING1_SIZE_MASK 0x00001800 -#define ET_RXDMA_CTRL_RING1_2048 0x00000000 /* 2047 */ -#define ET_RXDMA_CTRL_RING1_4096 0x00000800 /* 4095 */ -#define ET_RXDMA_CTRL_RING1_8192 0x00001000 /* 8191 */ -#define ET_RXDMA_CTRL_RING1_16384 0x00001800 /* 16383 (9022?) */ -#define ET_RXDMA_CTRL_RING1_ENABLE 0x00002000 -#define ET_RXDMA_CTRL_HALTED 0x00020000 - -#define ET_RX_STATUS_LO 0x2004 -#define ET_RX_STATUS_HI 0x2008 - -#define ET_RX_INTR_NPKTS 0x200c -#define ET_RX_INTR_DELAY 0x2010 - -#define ET_RXSTAT_LO 0x2020 -#define ET_RXSTAT_HI 0x2024 -#define ET_RXSTAT_CNT 0x2028 - -#define ET_RXSTAT_POS 0x2030 -#define ET_RXSTAT_POS_INDEX_MASK 0x00000FFF -#define ET_RXSTAT_POS_WRAP 0x00001000 - -#define ET_RXSTAT_MINCNT 0x2038 - -#define ET_RX_RING0_LO 0x203c -#define ET_RX_RING0_HI 0x2040 -#define ET_RX_RING0_CNT 0x2044 - -#define ET_RX_RING0_POS 0x204c -#define ET_RX_RING0_POS_INDEX_MASK 0x000003FF -#define ET_RX_RING0_POS_WRAP 0x00000400 - -#define ET_RX_RING0_MINCNT 0x2054 - -#define ET_RX_RING1_LO 0x2058 -#define ET_RX_RING1_HI 0x205c -#define ET_RX_RING1_CNT 0x2060 - -#define ET_RX_RING1_POS 0x2068 -#define ET_RX_RING1_POS_INDEX 0x000003FF -#define ET_RX_RING1_POS_WRAP 0x00000400 - -#define ET_RX_RING1_MINCNT 0x2070 - -#define ET_TXMAC_CTRL 0x3000 -#define ET_TXMAC_CTRL_ENABLE 0x00000001 -#define ET_TXMAC_CTRL_FC_DISABLE 0x00000008 - -#define ET_TXMAC_FLOWCTRL 0x3010 - -#define ET_RXMAC_CTRL 0x4000 -#define ET_RXMAC_CTRL_ENABLE 0x00000001 -#define ET_RXMAC_CTRL_NO_PKTFILT 0x00000004 -#define ET_RXMAC_CTRL_WOL_DISABLE 0x00000008 - -#define ET_WOL_CRC 0x4004 -#define ET_WOL_SA_LO 0x4010 -#define ET_WOL_SA_HI 0x4014 -#define ET_WOL_MASK 0x4018 - -#define ET_UCAST_FILTADDR1 0x4068 -#define ET_UCAST_FILTADDR2 0x406c -#define ET_UCAST_FILTADDR3 0x4070 - -#define ET_MULTI_HASH 0x4074 - -#define ET_PKTFILT 0x4084 -#define ET_PKTFILT_BCAST 0x00000001 -#define ET_PKTFILT_MCAST 0x00000002 -#define ET_PKTFILT_UCAST 0x00000004 -#define ET_PKTFILT_FRAG 0x00000008 -#define ET_PKTFILT_MINLEN_MASK 0x007F0000 -#define ET_PKTFILT_MINLEN_SHIFT 16 - -#define ET_RXMAC_MC_SEGSZ 0x4088 -#define ET_RXMAC_MC_SEGSZ_ENABLE 0x00000001 -#define ET_RXMAC_MC_SEGSZ_FC 0x00000002 -#define ET_RXMAC_MC_SEGSZ_MAX_MASK 0x000003FC -#define ET_RXMAC_SEGSZ(segsz) ((segsz) / ET_MEM_UNIT) -#define ET_RXMAC_CUT_THRU_FRMLEN 8074 - -#define ET_RXMAC_MC_WATERMARK 0x408c -#define ET_RXMAC_SPACE_AVL 0x4094 - -#define ET_RXMAC_MGT 0x4098 -#define ET_RXMAC_MGT_PASS_ECRC 0x00000010 -#define ET_RXMAC_MGT_PASS_ELEN 0x00000020 -#define ET_RXMAC_MGT_PASS_ETRUNC 0x00010000 -#define ET_RXMAC_MGT_CHECK_PKT 0x00020000 - -#define ET_MAC_CFG1 0x5000 -#define ET_MAC_CFG1_TXEN 0x00000001 -#define ET_MAC_CFG1_SYNC_TXEN 0x00000002 -#define ET_MAC_CFG1_RXEN 0x00000004 -#define ET_MAC_CFG1_SYNC_RXEN 0x00000008 -#define ET_MAC_CFG1_TXFLOW 0x00000010 -#define ET_MAC_CFG1_RXFLOW 0x00000020 -#define ET_MAC_CFG1_LOOPBACK 0x00000100 -#define ET_MAC_CFG1_RST_TXFUNC 0x00010000 -#define ET_MAC_CFG1_RST_RXFUNC 0x00020000 -#define ET_MAC_CFG1_RST_TXMC 0x00040000 -#define ET_MAC_CFG1_RST_RXMC 0x00080000 -#define ET_MAC_CFG1_SIM_RST 0x40000000 -#define ET_MAC_CFG1_SOFT_RST 0x80000000 - -#define ET_MAC_CFG2 0x5004 -#define ET_MAC_CFG2_FDX 0x00000001 -#define ET_MAC_CFG2_CRC 0x00000002 -#define ET_MAC_CFG2_PADCRC 0x00000004 -#define ET_MAC_CFG2_LENCHK 0x00000010 -#define ET_MAC_CFG2_BIGFRM 0x00000020 -#define ET_MAC_CFG2_MODE_MII 0x00000100 -#define ET_MAC_CFG2_MODE_GMII 0x00000200 -#define ET_MAC_CFG2_PREAMBLE_LEN_MASK 0x0000F000 -#define ET_MAC_CFG2_PREAMBLE_LEN_SHIFT 12 - -#define ET_IPG 0x5008 -#define ET_IPG_B2B_MASK 0x0000007F -#define ET_IPG_MINIFG_MASK 0x0000FF00 -#define ET_IPG_NONB2B_2_MASK 0x007F0000 -#define ET_IPG_NONB2B_1_MASK 0x7F000000 -#define ET_IPG_B2B_SHIFT 0 -#define ET_IPG_MINIFG_SHIFT 8 -#define ET_IPG_NONB2B_2_SHIFT 16 -#define ET_IPG_NONB2B_1_SHIFT 24 - -#define ET_MAC_HDX 0x500c -#define ET_MAC_HDX_COLLWIN_MASK 0x000003FF -#define ET_MAC_HDX_REXMIT_MAX_MASK 0x0000F000 -#define ET_MAC_HDX_EXC_DEFER 0x00010000 -#define ET_MAC_HDX_NOBACKOFF 0x00020000 -#define ET_MAC_HDX_BP_NOBACKOFF 0x00040000 -#define ET_MAC_HDX_ALT_BEB 0x00080000 -#define ET_MAC_HDX_ALT_BEB_TRUNC_MASK 0x00F00000 -#define ET_MAC_HDX_COLLWIN_SHIFT 0 -#define ET_MAC_HDX_REXMIT_MAX_SHIFT 12 -#define ET_MAC_HDX_ALT_BEB_TRUNC_SHIFT 20 - -#define ET_MAX_FRMLEN 0x5010 - -#define ET_MII_CFG 0x5020 -#define ET_MII_CFG_CLKRST 0x00000007 -#define ET_MII_CFG_PREAMBLE_SUP 0x00000010 -#define ET_MII_CFG_SCAN_AUTOINC 0x00000020 -#define ET_MII_CFG_RST 0x80000000 - -#define ET_MII_CMD 0x5024 -#define ET_MII_CMD_READ 0x00000001 - -#define ET_MII_ADDR 0x5028 -#define ET_MII_ADDR_REG_MASK 0x0000001F -#define ET_MII_ADDR_PHY_MASK 0x00001F00 -#define ET_MII_ADDR_REG_SHIFT 0 -#define ET_MII_ADDR_PHY_SHIFT 8 - -#define ET_MII_CTRL 0x502c -#define ET_MII_CTRL_VALUE_MASK 0x0000FFFF -#define ET_MII_CTRL_VALUE_SHIFT 0 - -#define ET_MII_STAT 0x5030 -#define ET_MII_STAT_VALUE_MASK 0x0000FFFF - -#define ET_MII_IND 0x5034 -#define ET_MII_IND_BUSY 0x00000001 -#define ET_MII_IND_INVALID 0x00000004 - -#define ET_MAC_CTRL 0x5038 -#define ET_MAC_CTRL_MODE_MII 0x01000000 -#define ET_MAC_CTRL_LHDX 0x02000000 -#define ET_MAC_CTRL_GHDX 0x04000000 +#define ET_TXQUEUE_START 0x0000 +#define ET_TXQUEUE_END 0x0004 +#define ET_RXQUEUE_START 0x0008 +#define ET_RXQUEUE_END 0x000C +#define ET_QUEUE_ADDR(addr) (((addr) / ET_MEM_UNIT) - 1) +#define ET_QUEUE_ADDR_START 0 +#define ET_QUEUE_ADDR_END ET_QUEUE_ADDR(ET_MEM_SIZE) + +#define ET_PM 0x0010 +#define EM_PM_GIGEPHY_ENB 0x00000001 +#define ET_PM_SYSCLK_GATE 0x00000008 +#define ET_PM_TXCLK_GATE 0x00000010 +#define ET_PM_RXCLK_GATE 0x00000020 +#define ET_PM_PHY_SW_COMA 0x00000040 + +#define ET_INTR_STATUS 0x0018 +#define ET_INTR_MASK 0x001C + +#define ET_SWRST 0x0028 +#define ET_SWRST_TXDMA 0x00000001 +#define ET_SWRST_RXDMA 0x00000002 +#define ET_SWRST_TXMAC 0x00000004 +#define ET_SWRST_RXMAC 0x00000008 +#define ET_SWRST_MAC 0x00000010 +#define ET_SWRST_MAC_STAT 0x00000020 +#define ET_SWRST_MMC 0x00000040 +#define ET_SWRST_SELFCLR_DISABLE 0x80000000 + +#define ET_MSI_CFG 0x0030 + +#define ET_LOOPBACK 0x0034 + +#define ET_TIMER 0x0038 + +#define ET_TXDMA_CTRL 0x1000 +#define ET_TXDMA_CTRL_HALT 0x00000001 +#define ET_TXDMA_CTRL_CACHE_THR_MASK 0x000000F0 +#define ET_TXDMA_CTRL_SINGLE_EPKT 0x00000100 /* ??? */ + +#define ET_TX_RING_HI 0x1004 +#define ET_TX_RING_LO 0x1008 +#define ET_TX_RING_CNT 0x100C + +#define ET_TX_STATUS_HI 0x101C +#define ET_TX_STATUS_LO 0x1020 + +#define ET_TX_READY_POS 0x1024 +#define ET_TX_READY_POS_INDEX_MASK 0x000003FF +#define ET_TX_READY_POS_WRAP 0x00000400 + +#define ET_TX_DONE_POS 0x1060 +#define ET_TX_DONE_POS_INDEX_MASK 0x0000003FF +#define ET_TX_DONE_POS_WRAP 0x000000400 + +#define ET_RXDMA_CTRL 0x2000 +#define ET_RXDMA_CTRL_HALT 0x00000001 +#define ET_RXDMA_CTRL_RING0_SIZE_MASK 0x00000300 +#define ET_RXDMA_CTRL_RING0_128 0x00000000 /* 127 */ +#define ET_RXDMA_CTRL_RING0_256 0x00000100 /* 255 */ +#define ET_RXDMA_CTRL_RING0_512 0x00000200 /* 511 */ +#define ET_RXDMA_CTRL_RING0_1024 0x00000300 /* 1023 */ +#define ET_RXDMA_CTRL_RING0_ENABLE 0x00000400 +#define ET_RXDMA_CTRL_RING1_SIZE_MASK 0x00001800 +#define ET_RXDMA_CTRL_RING1_2048 0x00000000 /* 2047 */ +#define ET_RXDMA_CTRL_RING1_4096 0x00000800 /* 4095 */ +#define ET_RXDMA_CTRL_RING1_8192 0x00001000 /* 8191 */ +#define ET_RXDMA_CTRL_RING1_16384 0x00001800 /* 16383 (9022?) */ +#define ET_RXDMA_CTRL_RING1_ENABLE 0x00002000 +#define ET_RXDMA_CTRL_HALTED 0x00020000 + +#define ET_RX_STATUS_LO 0x2004 +#define ET_RX_STATUS_HI 0x2008 + +#define ET_RX_INTR_NPKTS 0x200C +#define ET_RX_INTR_DELAY 0x2010 + +#define ET_RXSTAT_LO 0x2020 +#define ET_RXSTAT_HI 0x2024 +#define ET_RXSTAT_CNT 0x2028 + +#define ET_RXSTAT_POS 0x2030 +#define ET_RXSTAT_POS_INDEX_MASK 0x00000FFF +#define ET_RXSTAT_POS_WRAP 0x00001000 + +#define ET_RXSTAT_MINCNT 0x2038 + +#define ET_RX_RING0_LO 0x203C +#define ET_RX_RING0_HI 0x2040 +#define ET_RX_RING0_CNT 0x2044 + +#define ET_RX_RING0_POS 0x204C +#define ET_RX_RING0_POS_INDEX_MASK 0x000003FF +#define ET_RX_RING0_POS_WRAP 0x00000400 + +#define ET_RX_RING0_MINCNT 0x2054 + +#define ET_RX_RING1_LO 0x2058 +#define ET_RX_RING1_HI 0x205C +#define ET_RX_RING1_CNT 0x2060 + +#define ET_RX_RING1_POS 0x2068 +#define ET_RX_RING1_POS_INDEX 0x000003FF +#define ET_RX_RING1_POS_WRAP 0x00000400 + +#define ET_RX_RING1_MINCNT 0x2070 + +#define ET_TXMAC_CTRL 0x3000 +#define ET_TXMAC_CTRL_ENABLE 0x00000001 +#define ET_TXMAC_CTRL_FC_DISABLE 0x00000008 + +#define ET_TXMAC_FLOWCTRL 0x3010 +#define ET_TXMAC_FLOWCTRL_CFPT_MASK 0x0000FFFF +#define ET_TXMAC_FLOWCTRL_CFEP_MASK 0xFFFF0000 +#define ET_TXMAC_FLOWCTRL_CFPT_SHIFT 0 + +#define ET_TXMAC_BP_CTRL 0x3020 +#define ET_TXMAC_BP_CTRL_XONXOFF 0x00000001 +#define ET_TXMAC_BP_CTRL_REQ 0x00000002 + +#define ET_RXMAC_CTRL 0x4000 +#define ET_RXMAC_CTRL_ENABLE 0x00000001 +#define ET_RXMAC_CTRL_NO_PKTFILT 0x00000004 +#define ET_RXMAC_CTRL_WOL_DISABLE 0x00000008 + +#define ET_WOL_CRC 0x4004 +#define ET_WOL_SA_LO 0x4010 +#define ET_WOL_SA_HI 0x4014 +#define ET_WOL_MASK 0x4018 + +#define ET_UCAST_FILTADDR1 0x4068 +#define ET_UCAST_FILTADDR2 0x406C +#define ET_UCAST_FILTADDR3 0x4070 + +#define ET_MULTI_HASH 0x4074 + +#define ET_PKTFILT 0x4084 +#define ET_PKTFILT_BCAST 0x00000001 +#define ET_PKTFILT_MCAST 0x00000002 +#define ET_PKTFILT_UCAST 0x00000004 +#define ET_PKTFILT_FRAG 0x00000008 +#define ET_PKTFILT_MINLEN_MASK 0x007F0000 +#define ET_PKTFILT_MINLEN_SHIFT 16 + +#define ET_RXMAC_MC_SEGSZ 0x4088 +#define ET_RXMAC_MC_SEGSZ_ENABLE 0x00000001 +#define ET_RXMAC_MC_SEGSZ_FC 0x00000002 +#define ET_RXMAC_MC_SEGSZ_MAX_MASK 0x000003FC +#define ET_RXMAC_SEGSZ(segsz) ((segsz) / ET_MEM_UNIT) +#define ET_RXMAC_CUT_THRU_FRMLEN 8074 + +#define ET_RXMAC_MC_WATERMARK 0x408C +#define ET_RXMAC_SPACE_AVL 0x4094 + +#define ET_RXMAC_MGT 0x4098 +#define ET_RXMAC_MGT_PASS_ECRC 0x00000010 +#define ET_RXMAC_MGT_PASS_ELEN 0x00000020 +#define ET_RXMAC_MGT_PASS_ETRUNC 0x00010000 +#define ET_RXMAC_MGT_CHECK_PKT 0x00020000 + +#define ET_MAC_CFG1 0x5000 +#define ET_MAC_CFG1_TXEN 0x00000001 +#define ET_MAC_CFG1_SYNC_TXEN 0x00000002 +#define ET_MAC_CFG1_RXEN 0x00000004 +#define ET_MAC_CFG1_SYNC_RXEN 0x00000008 +#define ET_MAC_CFG1_TXFLOW 0x00000010 +#define ET_MAC_CFG1_RXFLOW 0x00000020 +#define ET_MAC_CFG1_LOOPBACK 0x00000100 +#define ET_MAC_CFG1_RST_TXFUNC 0x00010000 +#define ET_MAC_CFG1_RST_RXFUNC 0x00020000 +#define ET_MAC_CFG1_RST_TXMC 0x00040000 +#define ET_MAC_CFG1_RST_RXMC 0x00080000 +#define ET_MAC_CFG1_SIM_RST 0x40000000 +#define ET_MAC_CFG1_SOFT_RST 0x80000000 + +#define ET_MAC_CFG2 0x5004 +#define ET_MAC_CFG2_FDX 0x00000001 +#define ET_MAC_CFG2_CRC 0x00000002 +#define ET_MAC_CFG2_PADCRC 0x00000004 +#define ET_MAC_CFG2_LENCHK 0x00000010 +#define ET_MAC_CFG2_BIGFRM 0x00000020 +#define ET_MAC_CFG2_MODE_MII 0x00000100 +#define ET_MAC_CFG2_MODE_GMII 0x00000200 +#define ET_MAC_CFG2_PREAMBLE_LEN_MASK 0x0000F000 +#define ET_MAC_CFG2_PREAMBLE_LEN_SHIFT 12 + +#define ET_IPG 0x5008 +#define ET_IPG_B2B_MASK 0x0000007F +#define ET_IPG_MINIFG_MASK 0x0000FF00 +#define ET_IPG_NONB2B_2_MASK 0x007F0000 +#define ET_IPG_NONB2B_1_MASK 0x7F000000 +#define ET_IPG_B2B_SHIFT 0 +#define ET_IPG_MINIFG_SHIFT 8 +#define ET_IPG_NONB2B_2_SHIFT 16 +#define ET_IPG_NONB2B_1_SHIFT 24 + +#define ET_MAC_HDX 0x500C +#define ET_MAC_HDX_COLLWIN_MASK 0x000003FF +#define ET_MAC_HDX_REXMIT_MAX_MASK 0x0000F000 +#define ET_MAC_HDX_EXC_DEFER 0x00010000 +#define ET_MAC_HDX_NOBACKOFF 0x00020000 +#define ET_MAC_HDX_BP_NOBACKOFF 0x00040000 +#define ET_MAC_HDX_ALT_BEB 0x00080000 +#define ET_MAC_HDX_ALT_BEB_TRUNC_MASK 0x00F00000 +#define ET_MAC_HDX_COLLWIN_SHIFT 0 +#define ET_MAC_HDX_REXMIT_MAX_SHIFT 12 +#define ET_MAC_HDX_ALT_BEB_TRUNC_SHIFT 20 + +#define ET_MAX_FRMLEN 0x5010 + +#define ET_MII_CFG 0x5020 +#define ET_MII_CFG_CLKRST 0x00000007 +#define ET_MII_CFG_PREAMBLE_SUP 0x00000010 +#define ET_MII_CFG_SCAN_AUTOINC 0x00000020 +#define ET_MII_CFG_RST 0x80000000 + +#define ET_MII_CMD 0x5024 +#define ET_MII_CMD_READ 0x00000001 + +#define ET_MII_ADDR 0x5028 +#define ET_MII_ADDR_REG_MASK 0x0000001F +#define ET_MII_ADDR_PHY_MASK 0x00001F00 +#define ET_MII_ADDR_REG_SHIFT 0 +#define ET_MII_ADDR_PHY_SHIFT 8 + +#define ET_MII_CTRL 0x502C +#define ET_MII_CTRL_VALUE_MASK 0x0000FFFF +#define ET_MII_CTRL_VALUE_SHIFT 0 + +#define ET_MII_STAT 0x5030 +#define ET_MII_STAT_VALUE_MASK 0x0000FFFF + +#define ET_MII_IND 0x5034 +#define ET_MII_IND_BUSY 0x00000001 +#define ET_MII_IND_INVALID 0x00000004 + +#define ET_MAC_CTRL 0x5038 +#define ET_MAC_CTRL_MODE_MII 0x01000000 +#define ET_MAC_CTRL_LHDX 0x02000000 +#define ET_MAC_CTRL_GHDX 0x04000000 -#define ET_MAC_ADDR1 0x5040 -#define ET_MAC_ADDR2 0x5044 +#define ET_MAC_ADDR1 0x5040 +#define ET_MAC_ADDR2 0x5044 /* MAC statistics counters. */ #define ET_STAT_PKTS_64 0x6080 @@ -364,48 +371,48 @@ #define ET_STAT_TX_UNDERSIZE 0x6128 #define ET_STAT_TX_FRAG 0x612C -#define ET_MMC_CTRL 0x7000 -#define ET_MMC_CTRL_ENABLE 0x00000001 -#define ET_MMC_CTRL_ARB_DISABLE 0x00000002 -#define ET_MMC_CTRL_RXMAC_DISABLE 0x00000004 -#define ET_MMC_CTRL_TXMAC_DISABLE 0x00000008 -#define ET_MMC_CTRL_TXDMA_DISABLE 0x00000010 -#define ET_MMC_CTRL_RXDMA_DISABLE 0x00000020 -#define ET_MMC_CTRL_FORCE_CE 0x00000040 +#define ET_MMC_CTRL 0x7000 +#define ET_MMC_CTRL_ENABLE 0x00000001 +#define ET_MMC_CTRL_ARB_DISABLE 0x00000002 +#define ET_MMC_CTRL_RXMAC_DISABLE 0x00000004 +#define ET_MMC_CTRL_TXMAC_DISABLE 0x00000008 +#define ET_MMC_CTRL_TXDMA_DISABLE 0x00000010 +#define ET_MMC_CTRL_RXDMA_DISABLE 0x00000020 +#define ET_MMC_CTRL_FORCE_CE 0x00000040 /* * Interrupts */ -#define ET_INTR_TXEOF 0x00000008 -#define ET_INTR_TXDMA_ERROR 0x00000010 -#define ET_INTR_RXEOF 0x00000020 -#define ET_INTR_RXRING0_LOW 0x00000040 -#define ET_INTR_RXRING1_LOW 0x00000080 -#define ET_INTR_RXSTAT_LOW 0x00000100 -#define ET_INTR_RXDMA_ERROR 0x00000200 -#define ET_INTR_TIMER 0x00004000 -#define ET_INTR_WOL 0x00008000 -#define ET_INTR_PHY 0x00010000 -#define ET_INTR_TXMAC 0x00020000 -#define ET_INTR_RXMAC 0x00040000 -#define ET_INTR_MAC_STATS 0x00080000 -#define ET_INTR_SLAVE_TO 0x00100000 - -#define ET_INTRS (ET_INTR_TXEOF | \ - ET_INTR_RXEOF | \ - ET_INTR_TIMER) +#define ET_INTR_TXDMA 0x00000008 +#define ET_INTR_TXDMA_ERROR 0x00000010 +#define ET_INTR_RXDMA 0x00000020 +#define ET_INTR_RXRING0_LOW 0x00000040 +#define ET_INTR_RXRING1_LOW 0x00000080 +#define ET_INTR_RXSTAT_LOW 0x00000100 +#define ET_INTR_RXDMA_ERROR 0x00000200 +#define ET_INTR_TIMER 0x00004000 +#define ET_INTR_WOL 0x00008000 +#define ET_INTR_PHY 0x00010000 +#define ET_INTR_TXMAC 0x00020000 +#define ET_INTR_RXMAC 0x00040000 +#define ET_INTR_MAC_STATS 0x00080000 +#define ET_INTR_SLAVE_TO 0x00100000 + +#define ET_INTRS \ + (ET_INTR_TXDMA | ET_INTR_RXDMA | ET_INTR_TIMER | \ + ET_INTR_TXDMA_ERROR | ET_INTR_RXDMA_ERROR) /* * RX ring position uses same layout */ -#define ET_RX_RING_POS_INDEX_MASK 0x000003FF -#define ET_RX_RING_POS_WRAP 0x00000400 +#define ET_RX_RING_POS_INDEX_MASK 0x000003FF +#define ET_RX_RING_POS_WRAP 0x00000400 /* * PCI IDs */ -#define PCI_VENDOR_LUCENT 0x11c1 -#define PCI_PRODUCT_LUCENT_ET1310 0xed00 /* ET1310 10/100/1000M Ethernet */ -#define PCI_PRODUCT_LUCENT_ET1310_FAST 0xed01 /* ET1310 10/100M Ethernet */ +#define PCI_VENDOR_LUCENT 0x11C1 +#define PCI_PRODUCT_LUCENT_ET1310 0xED00 /* ET1310 10/100/1000M Ethernet */ +#define PCI_PRODUCT_LUCENT_ET1310_FAST 0xED01 /* ET1310 10/100M Ethernet */ #endif /* !_IF_ETREG_H */ Modified: stable/9/sys/dev/et/if_etvar.h ============================================================================== --- stable/9/sys/dev/et/if_etvar.h Fri Jan 6 21:28:29 2012 (r229735) +++ stable/9/sys/dev/et/if_etvar.h Fri Jan 6 21:43:26 2012 (r229736) @@ -38,39 +38,39 @@ #ifndef _IF_ETVAR_H #define _IF_ETVAR_H -#define ET_RING_ALIGN 4096 -#define ET_STATUS_ALIGN 8 -#define ET_NSEG_MAX 32 /* XXX no limit actually */ -#define ET_NSEG_SPARE 4 - -#define ET_TX_NDESC 512 -#define ET_RX_NDESC 512 -#define ET_RX_NRING 2 -#define ET_RX_NSTAT (ET_RX_NRING * ET_RX_NDESC) - -#define ET_TX_RING_SIZE (ET_TX_NDESC * sizeof(struct et_txdesc)) -#define ET_RX_RING_SIZE (ET_RX_NDESC * sizeof(struct et_rxdesc)) -#define ET_RXSTAT_RING_SIZE (ET_RX_NSTAT * sizeof(struct et_rxstat)) +#define ET_RING_ALIGN 4096 +#define ET_STATUS_ALIGN 8 +#define ET_NSEG_MAX 32 /* XXX no limit actually */ +#define ET_NSEG_SPARE 4 + +#define ET_TX_NDESC 512 +#define ET_RX_NDESC 512 +#define ET_RX_NRING 2 +#define ET_RX_NSTAT (ET_RX_NRING * ET_RX_NDESC) + +#define ET_TX_RING_SIZE (ET_TX_NDESC * sizeof(struct et_txdesc)) +#define ET_RX_RING_SIZE (ET_RX_NDESC * sizeof(struct et_rxdesc)) +#define ET_RXSTAT_RING_SIZE (ET_RX_NSTAT * sizeof(struct et_rxstat)) -#define ET_JUMBO_FRAMELEN (ET_MEM_SIZE - ET_MEM_RXSIZE_MIN - \ +#define ET_JUMBO_FRAMELEN (ET_MEM_SIZE - ET_MEM_RXSIZE_MIN - \ ET_MEM_TXSIZE_EX) -#define ET_JUMBO_MTU (ET_JUMBO_FRAMELEN - ETHER_HDR_LEN - \ +#define ET_JUMBO_MTU (ET_JUMBO_FRAMELEN - ETHER_HDR_LEN - \ EVL_ENCAPLEN - ETHER_CRC_LEN) -#define ET_FRAMELEN(mtu) (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + \ +#define ET_FRAMELEN(mtu) (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + \ (mtu) + ETHER_CRC_LEN) -#define ET_JSLOTS (ET_RX_NDESC + 128) -#define ET_JLEN (ET_JUMBO_FRAMELEN + ETHER_ALIGN) -#define ET_JUMBO_MEM_SIZE (ET_JSLOTS * ET_JLEN) +#define ET_JSLOTS (ET_RX_NDESC + 128) +#define ET_JLEN (ET_JUMBO_FRAMELEN + ETHER_ALIGN) +#define ET_JUMBO_MEM_SIZE (ET_JSLOTS * ET_JLEN) -#define CSR_WRITE_4(sc, reg, val) \ +#define CSR_WRITE_4(sc, reg, val) \ bus_write_4((sc)->sc_mem_res, (reg), (val)) -#define CSR_READ_4(sc, reg) \ +#define CSR_READ_4(sc, reg) \ bus_read_4((sc)->sc_mem_res, (reg)) -#define ET_ADDR_HI(addr) ((uint64_t) (addr) >> 32) -#define ET_ADDR_LO(addr) ((uint64_t) (addr) & 0xffffffff) +#define ET_ADDR_HI(addr) ((uint64_t) (addr) >> 32) +#define ET_ADDR_LO(addr) ((uint64_t) (addr) & 0xffffffff) struct et_txdesc { uint32_t td_addr_hi; @@ -79,23 +79,23 @@ struct et_txdesc { uint32_t td_ctrl2; /* ET_TDCTRL2_ */ }; -#define ET_TDCTRL1_LEN_MASK 0x0000FFFF +#define ET_TDCTRL1_LEN_MASK 0x0000FFFF -#define ET_TDCTRL2_LAST_FRAG 0x00000001 -#define ET_TDCTRL2_FIRST_FRAG 0x00000002 -#define ET_TDCTRL2_INTR 0x00000004 -#define ET_TDCTRL2_CTRL_WORD 0x00000008 -#define ET_TDCTRL2_HDX_BACKP 0x00000010 -#define ET_TDCTRL2_XMIT_PAUSE 0x00000020 -#define ET_TDCTRL2_FRAME_ERR 0x00000040 -#define ET_TDCTRL2_NO_CRC 0x00000080 -#define ET_TDCTRL2_MAC_OVRRD 0x00000100 -#define ET_TDCTRL2_PAD_PACKET 0x00000200 -#define ET_TDCTRL2_JUMBO_PACKET 0x00000400 -#define ET_TDCTRL2_INS_VLAN 0x00000800 -#define ET_TDCTRL2_CSUM_IP 0x00001000 -#define ET_TDCTRL2_CSUM_TCP 0x00002000 -#define ET_TDCTRL2_CSUM_UDP 0x00004000 +#define ET_TDCTRL2_LAST_FRAG 0x00000001 +#define ET_TDCTRL2_FIRST_FRAG 0x00000002 +#define ET_TDCTRL2_INTR 0x00000004 +#define ET_TDCTRL2_CTRL_WORD 0x00000008 +#define ET_TDCTRL2_HDX_BACKP 0x00000010 +#define ET_TDCTRL2_XMIT_PAUSE 0x00000020 +#define ET_TDCTRL2_FRAME_ERR 0x00000040 +#define ET_TDCTRL2_NO_CRC 0x00000080 +#define ET_TDCTRL2_MAC_OVRRD 0x00000100 +#define ET_TDCTRL2_PAD_PACKET 0x00000200 +#define ET_TDCTRL2_JUMBO_PACKET 0x00000400 +#define ET_TDCTRL2_INS_VLAN 0x00000800 +#define ET_TDCTRL2_CSUM_IP 0x00001000 +#define ET_TDCTRL2_CSUM_TCP 0x00002000 +#define ET_TDCTRL2_CSUM_UDP 0x00004000 struct et_rxdesc { uint32_t rd_addr_lo; @@ -103,56 +103,56 @@ struct et_rxdesc { uint32_t rd_ctrl; /* ET_RDCTRL_ */ }; -#define ET_RDCTRL_BUFIDX_MASK 0x000003FF +#define ET_RDCTRL_BUFIDX_MASK 0x000003FF struct et_rxstat { uint32_t rxst_info1; uint32_t rxst_info2; /* ET_RXST_INFO2_ */ }; -#define ET_RXST_INFO1_HASH_PASS 0x00000001 -#define ET_RXST_INFO1_IPCSUM 0x00000002 -#define ET_RXST_INFO1_IPCSUM_OK 0x00000004 -#define ET_RXST_INFO1_TCPCSUM 0x00000008 -#define ET_RXST_INFO1_TCPCSUM_OK 0x00000010 -#define ET_RXST_INFO1_WOL 0x00000020 -#define ET_RXST_INFO1_RXMAC_ERR 0x00000040 -#define ET_RXST_INFO1_DROP 0x00000080 -#define ET_RXST_INFO1_FRAME_TRUNC 0x00000100 -#define ET_RXST_INFO1_JUMBO 0x00000200 -#define ET_RXST_INFO1_VLAN 0x00000400 -#define ET_RXST_INFO1_PREV_FRMAE_DROP 0x00010000 -#define ET_RXST_INFO1_SHORT 0x00020000 -#define ET_RXST_INFO1_BAD_CARRIER 0x00040000 -#define ET_RXST_INFO1_CODE_ERR 0x00080000 -#define ET_RXST_INFO1_CRC_ERR 0x00100000 -#define ET_RXST_INFO1_LEN_MISMATCH 0x00200000 -#define ET_RXST_INFO1_TOO_LONG 0x00400000 -#define ET_RXST_INFO1_OK 0x00800000 -#define ET_RXST_INFO1_MULTICAST 0x01000000 -#define ET_RXST_INFO1_BROADCAST 0x02000000 -#define ET_RXST_INFO1_DRIBBLE 0x04000000 -#define ET_RXST_INFO1_CTL_FRAME 0x08000000 -#define ET_RXST_INFO1_PAUSE_FRAME 0x10000000 -#define ET_RXST_INFO1_UNKWN_CTL_FRAME 0x20000000 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 21:45:08 2012 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 6E0A81065673; Fri, 6 Jan 2012 21:45:08 +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 5AD688FC1A; Fri, 6 Jan 2012 21:45:08 +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 q06Lj81p009647; Fri, 6 Jan 2012 21:45:08 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06Lj8Xt009644; Fri, 6 Jan 2012 21:45:08 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201062145.q06Lj8Xt009644@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 6 Jan 2012 21:45:08 +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: r229737 - stable/8/sys/dev/et 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, 06 Jan 2012 21:45:08 -0000 Author: yongari Date: Fri Jan 6 21:45:08 2012 New Revision: 229737 URL: http://svn.freebsd.org/changeset/base/229737 Log: MFC r228333,228335-228336,228362,228368-228369,228381: r228333: Protect SIOCSIFMTU ioctl handler with driver lock. Don't blindly re-initialize controller whenever MTU is changed. Now, reinitializing is done only when driver is running. While here, remove unnecessary assignment of error value since it was already initialized to 0. r228335: Consistently use a tab character instead of using either a space or tab after #define. While I'm here consistently use capital letters when it uses hexadecimal notation. No functional changes. r228336: Disable all clocks and put PHY into COMA before entering into suspend state. This will save more power. On resume, make sure to enable all clocks. While I'm here, if controller is not fast ethernet, enable gigabit PHY. r228362: Do not disable interrupt without knowing whether the raised interrupt is ours. Note, interrupts are automatically ACKed when the status register is read. Add RX/TX DMA error to interrupt handler and do full controller reset if driver happen to encounter these errors. There is no way to recover from these DMA errors without controller reset. Rename local variable name intrs with status to enhance readability. While I'm here, rename ET_INTR_TXEOF and ET_INTR_RXEOF to ET_INTR_TXDMA and ET_INTR_RXDMA respectively. These interrupts indicate that a frame is successfully DMAed to controller's internal FIFO and they have nothing to do with EOF(end of frame). Driver does not need to wait actual end of TX/RX of a frame(e.g. no need to wait the end signal of TX which is generated when a frame in TX FIFO is emptied by MAC). Previous names were somewhat confusing. r228368: Remove unnecessary definition of ET_PCIR_BAR. Controller support I/O memory only. While here, use pci_set_max_read_req(9) rather than directly manipulating PCIe device control register. r228369: Announce flow control ability to PHY driver and enable RX flow control. Controller does not automatically generate pause frames based on number of available RX buffers so it's very hard to know when driver should generate XON frame in time. The only mechanism driver can detect low number of RX buffer condition is ET_INTR_RXRING0_LOW or ET_INTR_RXRING1_LOW interrupt. This interrupt is generated whenever controller notices the number of available RX buffers are lower than pre-programmed value( ET_RX_RING0_MINCNT and ET_RX_RING1_MINCNT register). This scheme does not provide a way to detect when controller sees enough number of RX buffers again such that efficient generation of XON/XOFF frame is not easy. While here, add more flow control related register definition. r228381: FreeBSD driver does not require arpcom structure in softc. Modified: stable/8/sys/dev/et/if_et.c stable/8/sys/dev/et/if_etreg.h stable/8/sys/dev/et/if_etvar.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/et/if_et.c ============================================================================== --- stable/8/sys/dev/et/if_et.c Fri Jan 6 21:43:26 2012 (r229736) +++ stable/8/sys/dev/et/if_et.c Fri Jan 6 21:45:08 2012 (r229737) @@ -224,6 +224,7 @@ et_attach(device_t dev) struct et_softc *sc; struct ifnet *ifp; uint8_t eaddr[ETHER_ADDR_LEN]; + uint32_t pmcfg; int cap, error, msic; sc = device_get_softc(dev); @@ -253,9 +254,9 @@ et_attach(device_t dev) /* * Allocate IO memory */ - sc->sc_mem_rid = ET_PCIR_BAR; + sc->sc_mem_rid = PCIR_BAR(0); sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, - &sc->sc_mem_rid, RF_ACTIVE); + &sc->sc_mem_rid, RF_ACTIVE); if (sc->sc_mem_res == NULL) { device_printf(dev, "can't allocate IO memory\n"); return (ENXIO); @@ -308,8 +309,11 @@ et_attach(device_t dev) et_get_eaddr(dev, eaddr); - CSR_WRITE_4(sc, ET_PM, - ET_PM_SYSCLK_GATE | ET_PM_TXCLK_GATE | ET_PM_RXCLK_GATE); + /* Take PHY out of COMA and enable clocks. */ + pmcfg = ET_PM_SYSCLK_GATE | ET_PM_TXCLK_GATE | ET_PM_RXCLK_GATE; + if ((sc->sc_flags & ET_FLAG_FASTETHER) == 0) + pmcfg |= EM_PM_GIGEPHY_ENB; + CSR_WRITE_4(sc, ET_PM, pmcfg); et_reset(sc); @@ -332,7 +336,8 @@ et_attach(device_t dev) et_chip_attach(sc); error = mii_attach(dev, &sc->sc_miibus, ifp, et_ifmedia_upd, - et_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + et_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, + MIIF_DOPAUSE); if (error) { device_printf(dev, "attaching PHYs failed\n"); goto fail; @@ -548,12 +553,23 @@ et_miibus_statchg(device_t dev) if (IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) { cfg2 |= ET_MAC_CFG2_FDX; + /* + * Controller lacks automatic TX pause frame + * generation so it should be handled by driver. + * Even though driver can send pause frame with + * arbitrary pause time, controller does not + * provide a way that tells how many free RX + * buffers are available in controller. This + * limitation makes it hard to generate XON frame + * in time on driver side so don't enable TX flow + * control. + */ #ifdef notyet if (IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_TXPAUSE) cfg1 |= ET_MAC_CFG1_TXFLOW; +#endif if (IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_RXPAUSE) cfg1 |= ET_MAC_CFG1_RXFLOW; -#endif } else ctrl |= ET_MAC_CTRL_GHDX; @@ -722,12 +738,7 @@ et_bus_config(struct et_softc *sc) /* * Set max read request size to 2048 bytes */ - val = pci_read_config(sc->dev, - sc->sc_expcap + PCIR_EXPRESS_DEVICE_CTL, 2); - val &= ~PCIM_EXP_CTL_MAX_READ_REQUEST; - val |= ET_PCIV_DEVICE_CTRL_RRSZ_2K; - pci_write_config(sc->dev, - sc->sc_expcap + PCIR_EXPRESS_DEVICE_CTL, val, 2); + pci_set_max_read_req(sc->dev, 2048); return (0); } @@ -1158,34 +1169,40 @@ et_intr(void *xsc) { struct et_softc *sc = xsc; struct ifnet *ifp; - uint32_t intrs; + uint32_t status; ET_LOCK(sc); ifp = sc->ifp; - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { - ET_UNLOCK(sc); - return; - } + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + goto done; + + status = CSR_READ_4(sc, ET_INTR_STATUS); + if ((status & ET_INTRS) == 0) + goto done; /* Disable further interrupts. */ CSR_WRITE_4(sc, ET_INTR_MASK, 0xffffffff); - intrs = CSR_READ_4(sc, ET_INTR_STATUS); - if ((intrs & ET_INTRS) == 0) - goto done; - - if (intrs & ET_INTR_RXEOF) + if (status & (ET_INTR_RXDMA_ERROR | ET_INTR_TXDMA_ERROR)) { + device_printf(sc->dev, "DMA error(0x%08x) -- resetting\n", + status); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + et_init_locked(sc); + ET_UNLOCK(sc); + return; + } + if (status & ET_INTR_RXDMA) et_rxeof(sc); - if (intrs & (ET_INTR_TXEOF | ET_INTR_TIMER)) + if (status & (ET_INTR_TXDMA | ET_INTR_TIMER)) et_txeof(sc); - if (intrs & ET_INTR_TIMER) + if (status & ET_INTR_TIMER) CSR_WRITE_4(sc, ET_TIMER, sc->sc_timer); -done: if (ifp->if_drv_flags & IFF_DRV_RUNNING) { CSR_WRITE_4(sc, ET_INTR_MASK, ~ET_INTRS); if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) et_start_locked(ifp); } +done: ET_UNLOCK(sc); } @@ -1291,11 +1308,11 @@ et_ioctl(struct ifnet *ifp, u_long cmd, ET_LOCK(sc); et_setmulti(sc); ET_UNLOCK(sc); - error = 0; } break; case SIOCSIFMTU: + ET_LOCK(sc); #if 0 if (sc->sc_flags & ET_FLAG_JUMBO) max_framelen = ET_JUMBO_FRAMELEN; @@ -1305,14 +1322,18 @@ et_ioctl(struct ifnet *ifp, u_long cmd, if (ET_FRAMELEN(ifr->ifr_mtu) > max_framelen) { error = EOPNOTSUPP; + ET_UNLOCK(sc); break; } if (ifp->if_mtu != ifr->ifr_mtu) { ifp->if_mtu = ifr->ifr_mtu; - ifp->if_drv_flags &= ~IFF_DRV_RUNNING; - et_init(sc); + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + et_init_locked(sc); + } } + ET_UNLOCK(sc); break; case SIOCSIFCAP: @@ -1944,8 +1965,12 @@ et_init_txmac(struct et_softc *sc) /* Disable TX MAC and FC(?) */ CSR_WRITE_4(sc, ET_TXMAC_CTRL, ET_TXMAC_CTRL_FC_DISABLE); - /* No flow control yet */ - CSR_WRITE_4(sc, ET_TXMAC_FLOWCTRL, 0); + /* + * Initialize pause time. + * This register should be set before XON/XOFF frame is + * sent by driver. + */ + CSR_WRITE_4(sc, ET_TXMAC_FLOWCTRL, 0 << ET_TXMAC_FLOWCTRL_CFPT_SHIFT); /* Enable TX MAC but leave FC(?) diabled */ CSR_WRITE_4(sc, ET_TXMAC_CTRL, @@ -2378,7 +2403,7 @@ et_newbuf_hdr(struct et_rxbuf_data *rbd, #define ET_SYSCTL_STAT_ADD32(c, h, n, p, d) \ SYSCTL_ADD_UINT(c, h, OID_AUTO, n, CTLFLAG_RD, p, 0, d) #define ET_SYSCTL_STAT_ADD64(c, h, n, p, d) \ - SYSCTL_ADD_UQUAD(c, h, OID_AUTO, n, CTLFLAG_RD, p, d) + SYSCTL_ADD_QUAD(c, h, OID_AUTO, n, CTLFLAG_RD, p, d) /* * Create sysctl tree @@ -2636,11 +2661,18 @@ static int et_suspend(device_t dev) { struct et_softc *sc; + uint32_t pmcfg; sc = device_get_softc(dev); ET_LOCK(sc); if ((sc->ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) et_stop(sc); + /* Diable all clocks and put PHY into COMA. */ + pmcfg = CSR_READ_4(sc, ET_PM); + pmcfg &= ~(EM_PM_GIGEPHY_ENB | ET_PM_SYSCLK_GATE | ET_PM_TXCLK_GATE | + ET_PM_RXCLK_GATE); + pmcfg |= ET_PM_PHY_SW_COMA; + CSR_WRITE_4(sc, ET_PM, pmcfg); ET_UNLOCK(sc); return (0); } @@ -2649,9 +2681,15 @@ static int et_resume(device_t dev) { struct et_softc *sc; + uint32_t pmcfg; sc = device_get_softc(dev); ET_LOCK(sc); + /* Take PHY out of COMA and enable clocks. */ + pmcfg = ET_PM_SYSCLK_GATE | ET_PM_TXCLK_GATE | ET_PM_RXCLK_GATE; + if ((sc->sc_flags & ET_FLAG_FASTETHER) == 0) + pmcfg |= EM_PM_GIGEPHY_ENB; + CSR_WRITE_4(sc, ET_PM, pmcfg); if ((sc->ifp->if_flags & IFF_UP) != 0) et_init_locked(sc); ET_UNLOCK(sc); Modified: stable/8/sys/dev/et/if_etreg.h ============================================================================== --- stable/8/sys/dev/et/if_etreg.h Fri Jan 6 21:43:26 2012 (r229736) +++ stable/8/sys/dev/et/if_etreg.h Fri Jan 6 21:45:08 2012 (r229737) @@ -38,11 +38,11 @@ #ifndef _IF_ETREG_H #define _IF_ETREG_H -#define ET_MEM_TXSIZE_EX 182 -#define ET_MEM_RXSIZE_MIN 608 -#define ET_MEM_RXSIZE_DEFAULT 11216 -#define ET_MEM_SIZE 16384 -#define ET_MEM_UNIT 16 +#define ET_MEM_TXSIZE_EX 182 +#define ET_MEM_RXSIZE_MIN 608 +#define ET_MEM_RXSIZE_DEFAULT 11216 +#define ET_MEM_SIZE 16384 +#define ET_MEM_UNIT 16 /* * PCI registers @@ -53,270 +53,277 @@ * ET_PCIV_REPLAY_TIMER_{128,256} are from * PCI EXPRESS BASE SPECIFICATION, REV. 1.0a, Table 3-4 */ -#define ET_PCIR_BAR PCIR_BAR(0) +#define ET_PCIR_DEVICE_CAPS 0x4C +#define ET_PCIM_DEVICE_CAPS_MAX_PLSZ 0x7 /* Max playload size */ +#define ET_PCIV_DEVICE_CAPS_PLSZ_128 0x0 +#define ET_PCIV_DEVICE_CAPS_PLSZ_256 0x1 + +#define ET_PCIR_DEVICE_CTRL 0x50 +#define ET_PCIM_DEVICE_CTRL_MAX_RRSZ 0x7000 /* Max read request size */ +#define ET_PCIV_DEVICE_CTRL_RRSZ_2K 0x4000 + +#define ET_PCIR_MAC_ADDR0 0xA4 +#define ET_PCIR_MAC_ADDR1 0xA8 + +#define ET_PCIR_EEPROM_STATUS 0xB2 /* XXX undocumented */ +#define ET_PCIM_EEPROM_STATUS_ERROR 0x4C + +#define ET_PCIR_ACK_LATENCY 0xC0 +#define ET_PCIV_ACK_LATENCY_128 237 +#define ET_PCIV_ACK_LATENCY_256 416 + +#define ET_PCIR_REPLAY_TIMER 0xC2 +#define ET_REPLAY_TIMER_RX_L0S_ADJ 250 /* XXX infered from default */ +#define ET_PCIV_REPLAY_TIMER_128 (711 + ET_REPLAY_TIMER_RX_L0S_ADJ) +#define ET_PCIV_REPLAY_TIMER_256 (1248 + ET_REPLAY_TIMER_RX_L0S_ADJ) -#define ET_PCIR_DEVICE_CAPS 0x4c -#define ET_PCIM_DEVICE_CAPS_MAX_PLSZ 0x7 /* Max playload size */ -#define ET_PCIV_DEVICE_CAPS_PLSZ_128 0x0 -#define ET_PCIV_DEVICE_CAPS_PLSZ_256 0x1 - -#define ET_PCIR_DEVICE_CTRL 0x50 -#define ET_PCIM_DEVICE_CTRL_MAX_RRSZ 0x7000 /* Max read request size */ -#define ET_PCIV_DEVICE_CTRL_RRSZ_2K 0x4000 - -#define ET_PCIR_MAC_ADDR0 0xa4 -#define ET_PCIR_MAC_ADDR1 0xa8 - -#define ET_PCIR_EEPROM_STATUS 0xb2 /* XXX undocumented */ -#define ET_PCIM_EEPROM_STATUS_ERROR 0x4c - -#define ET_PCIR_ACK_LATENCY 0xc0 -#define ET_PCIV_ACK_LATENCY_128 237 -#define ET_PCIV_ACK_LATENCY_256 416 - -#define ET_PCIR_REPLAY_TIMER 0xc2 -#define ET_REPLAY_TIMER_RX_L0S_ADJ 250 /* XXX infered from default */ -#define ET_PCIV_REPLAY_TIMER_128 (711 + ET_REPLAY_TIMER_RX_L0S_ADJ) -#define ET_PCIV_REPLAY_TIMER_256 (1248 + ET_REPLAY_TIMER_RX_L0S_ADJ) - -#define ET_PCIR_L0S_L1_LATENCY 0xcf +#define ET_PCIR_L0S_L1_LATENCY 0xCF /* * CSR */ -#define ET_TXQUEUE_START 0x0000 -#define ET_TXQUEUE_END 0x0004 -#define ET_RXQUEUE_START 0x0008 -#define ET_RXQUEUE_END 0x000c -#define ET_QUEUE_ADDR(addr) (((addr) / ET_MEM_UNIT) - 1) -#define ET_QUEUE_ADDR_START 0 -#define ET_QUEUE_ADDR_END ET_QUEUE_ADDR(ET_MEM_SIZE) - -#define ET_PM 0x0010 -#define ET_PM_SYSCLK_GATE 0x00000008 -#define ET_PM_TXCLK_GATE 0x00000010 -#define ET_PM_RXCLK_GATE 0x00000020 - -#define ET_INTR_STATUS 0x0018 -#define ET_INTR_MASK 0x001c - -#define ET_SWRST 0x0028 -#define ET_SWRST_TXDMA 0x00000001 -#define ET_SWRST_RXDMA 0x00000002 -#define ET_SWRST_TXMAC 0x00000004 -#define ET_SWRST_RXMAC 0x00000008 -#define ET_SWRST_MAC 0x00000010 -#define ET_SWRST_MAC_STAT 0x00000020 -#define ET_SWRST_MMC 0x00000040 -#define ET_SWRST_SELFCLR_DISABLE 0x80000000 - -#define ET_MSI_CFG 0x0030 - -#define ET_LOOPBACK 0x0034 - -#define ET_TIMER 0x0038 - -#define ET_TXDMA_CTRL 0x1000 -#define ET_TXDMA_CTRL_HALT 0x00000001 -#define ET_TXDMA_CTRL_CACHE_THR_MASK 0x000000F0 -#define ET_TXDMA_CTRL_SINGLE_EPKT 0x00000100 /* ??? */ - -#define ET_TX_RING_HI 0x1004 -#define ET_TX_RING_LO 0x1008 -#define ET_TX_RING_CNT 0x100c - -#define ET_TX_STATUS_HI 0x101c -#define ET_TX_STATUS_LO 0x1020 - -#define ET_TX_READY_POS 0x1024 -#define ET_TX_READY_POS_INDEX_MASK 0x000003FF -#define ET_TX_READY_POS_WRAP 0x00000400 - -#define ET_TX_DONE_POS 0x1060 -#define ET_TX_DONE_POS_INDEX_MASK 0x0000003FF -#define ET_TX_DONE_POS_WRAP 0x000000400 - -#define ET_RXDMA_CTRL 0x2000 -#define ET_RXDMA_CTRL_HALT 0x00000001 -#define ET_RXDMA_CTRL_RING0_SIZE_MASK 0x00000300 -#define ET_RXDMA_CTRL_RING0_128 0x00000000 /* 127 */ -#define ET_RXDMA_CTRL_RING0_256 0x00000100 /* 255 */ -#define ET_RXDMA_CTRL_RING0_512 0x00000200 /* 511 */ -#define ET_RXDMA_CTRL_RING0_1024 0x00000300 /* 1023 */ -#define ET_RXDMA_CTRL_RING0_ENABLE 0x00000400 -#define ET_RXDMA_CTRL_RING1_SIZE_MASK 0x00001800 -#define ET_RXDMA_CTRL_RING1_2048 0x00000000 /* 2047 */ -#define ET_RXDMA_CTRL_RING1_4096 0x00000800 /* 4095 */ -#define ET_RXDMA_CTRL_RING1_8192 0x00001000 /* 8191 */ -#define ET_RXDMA_CTRL_RING1_16384 0x00001800 /* 16383 (9022?) */ -#define ET_RXDMA_CTRL_RING1_ENABLE 0x00002000 -#define ET_RXDMA_CTRL_HALTED 0x00020000 - -#define ET_RX_STATUS_LO 0x2004 -#define ET_RX_STATUS_HI 0x2008 - -#define ET_RX_INTR_NPKTS 0x200c -#define ET_RX_INTR_DELAY 0x2010 - -#define ET_RXSTAT_LO 0x2020 -#define ET_RXSTAT_HI 0x2024 -#define ET_RXSTAT_CNT 0x2028 - -#define ET_RXSTAT_POS 0x2030 -#define ET_RXSTAT_POS_INDEX_MASK 0x00000FFF -#define ET_RXSTAT_POS_WRAP 0x00001000 - -#define ET_RXSTAT_MINCNT 0x2038 - -#define ET_RX_RING0_LO 0x203c -#define ET_RX_RING0_HI 0x2040 -#define ET_RX_RING0_CNT 0x2044 - -#define ET_RX_RING0_POS 0x204c -#define ET_RX_RING0_POS_INDEX_MASK 0x000003FF -#define ET_RX_RING0_POS_WRAP 0x00000400 - -#define ET_RX_RING0_MINCNT 0x2054 - -#define ET_RX_RING1_LO 0x2058 -#define ET_RX_RING1_HI 0x205c -#define ET_RX_RING1_CNT 0x2060 - -#define ET_RX_RING1_POS 0x2068 -#define ET_RX_RING1_POS_INDEX 0x000003FF -#define ET_RX_RING1_POS_WRAP 0x00000400 - -#define ET_RX_RING1_MINCNT 0x2070 - -#define ET_TXMAC_CTRL 0x3000 -#define ET_TXMAC_CTRL_ENABLE 0x00000001 -#define ET_TXMAC_CTRL_FC_DISABLE 0x00000008 - -#define ET_TXMAC_FLOWCTRL 0x3010 - -#define ET_RXMAC_CTRL 0x4000 -#define ET_RXMAC_CTRL_ENABLE 0x00000001 -#define ET_RXMAC_CTRL_NO_PKTFILT 0x00000004 -#define ET_RXMAC_CTRL_WOL_DISABLE 0x00000008 - -#define ET_WOL_CRC 0x4004 -#define ET_WOL_SA_LO 0x4010 -#define ET_WOL_SA_HI 0x4014 -#define ET_WOL_MASK 0x4018 - -#define ET_UCAST_FILTADDR1 0x4068 -#define ET_UCAST_FILTADDR2 0x406c -#define ET_UCAST_FILTADDR3 0x4070 - -#define ET_MULTI_HASH 0x4074 - -#define ET_PKTFILT 0x4084 -#define ET_PKTFILT_BCAST 0x00000001 -#define ET_PKTFILT_MCAST 0x00000002 -#define ET_PKTFILT_UCAST 0x00000004 -#define ET_PKTFILT_FRAG 0x00000008 -#define ET_PKTFILT_MINLEN_MASK 0x007F0000 -#define ET_PKTFILT_MINLEN_SHIFT 16 - -#define ET_RXMAC_MC_SEGSZ 0x4088 -#define ET_RXMAC_MC_SEGSZ_ENABLE 0x00000001 -#define ET_RXMAC_MC_SEGSZ_FC 0x00000002 -#define ET_RXMAC_MC_SEGSZ_MAX_MASK 0x000003FC -#define ET_RXMAC_SEGSZ(segsz) ((segsz) / ET_MEM_UNIT) -#define ET_RXMAC_CUT_THRU_FRMLEN 8074 - -#define ET_RXMAC_MC_WATERMARK 0x408c -#define ET_RXMAC_SPACE_AVL 0x4094 - -#define ET_RXMAC_MGT 0x4098 -#define ET_RXMAC_MGT_PASS_ECRC 0x00000010 -#define ET_RXMAC_MGT_PASS_ELEN 0x00000020 -#define ET_RXMAC_MGT_PASS_ETRUNC 0x00010000 -#define ET_RXMAC_MGT_CHECK_PKT 0x00020000 - -#define ET_MAC_CFG1 0x5000 -#define ET_MAC_CFG1_TXEN 0x00000001 -#define ET_MAC_CFG1_SYNC_TXEN 0x00000002 -#define ET_MAC_CFG1_RXEN 0x00000004 -#define ET_MAC_CFG1_SYNC_RXEN 0x00000008 -#define ET_MAC_CFG1_TXFLOW 0x00000010 -#define ET_MAC_CFG1_RXFLOW 0x00000020 -#define ET_MAC_CFG1_LOOPBACK 0x00000100 -#define ET_MAC_CFG1_RST_TXFUNC 0x00010000 -#define ET_MAC_CFG1_RST_RXFUNC 0x00020000 -#define ET_MAC_CFG1_RST_TXMC 0x00040000 -#define ET_MAC_CFG1_RST_RXMC 0x00080000 -#define ET_MAC_CFG1_SIM_RST 0x40000000 -#define ET_MAC_CFG1_SOFT_RST 0x80000000 - -#define ET_MAC_CFG2 0x5004 -#define ET_MAC_CFG2_FDX 0x00000001 -#define ET_MAC_CFG2_CRC 0x00000002 -#define ET_MAC_CFG2_PADCRC 0x00000004 -#define ET_MAC_CFG2_LENCHK 0x00000010 -#define ET_MAC_CFG2_BIGFRM 0x00000020 -#define ET_MAC_CFG2_MODE_MII 0x00000100 -#define ET_MAC_CFG2_MODE_GMII 0x00000200 -#define ET_MAC_CFG2_PREAMBLE_LEN_MASK 0x0000F000 -#define ET_MAC_CFG2_PREAMBLE_LEN_SHIFT 12 - -#define ET_IPG 0x5008 -#define ET_IPG_B2B_MASK 0x0000007F -#define ET_IPG_MINIFG_MASK 0x0000FF00 -#define ET_IPG_NONB2B_2_MASK 0x007F0000 -#define ET_IPG_NONB2B_1_MASK 0x7F000000 -#define ET_IPG_B2B_SHIFT 0 -#define ET_IPG_MINIFG_SHIFT 8 -#define ET_IPG_NONB2B_2_SHIFT 16 -#define ET_IPG_NONB2B_1_SHIFT 24 - -#define ET_MAC_HDX 0x500c -#define ET_MAC_HDX_COLLWIN_MASK 0x000003FF -#define ET_MAC_HDX_REXMIT_MAX_MASK 0x0000F000 -#define ET_MAC_HDX_EXC_DEFER 0x00010000 -#define ET_MAC_HDX_NOBACKOFF 0x00020000 -#define ET_MAC_HDX_BP_NOBACKOFF 0x00040000 -#define ET_MAC_HDX_ALT_BEB 0x00080000 -#define ET_MAC_HDX_ALT_BEB_TRUNC_MASK 0x00F00000 -#define ET_MAC_HDX_COLLWIN_SHIFT 0 -#define ET_MAC_HDX_REXMIT_MAX_SHIFT 12 -#define ET_MAC_HDX_ALT_BEB_TRUNC_SHIFT 20 - -#define ET_MAX_FRMLEN 0x5010 - -#define ET_MII_CFG 0x5020 -#define ET_MII_CFG_CLKRST 0x00000007 -#define ET_MII_CFG_PREAMBLE_SUP 0x00000010 -#define ET_MII_CFG_SCAN_AUTOINC 0x00000020 -#define ET_MII_CFG_RST 0x80000000 - -#define ET_MII_CMD 0x5024 -#define ET_MII_CMD_READ 0x00000001 - -#define ET_MII_ADDR 0x5028 -#define ET_MII_ADDR_REG_MASK 0x0000001F -#define ET_MII_ADDR_PHY_MASK 0x00001F00 -#define ET_MII_ADDR_REG_SHIFT 0 -#define ET_MII_ADDR_PHY_SHIFT 8 - -#define ET_MII_CTRL 0x502c -#define ET_MII_CTRL_VALUE_MASK 0x0000FFFF -#define ET_MII_CTRL_VALUE_SHIFT 0 - -#define ET_MII_STAT 0x5030 -#define ET_MII_STAT_VALUE_MASK 0x0000FFFF - -#define ET_MII_IND 0x5034 -#define ET_MII_IND_BUSY 0x00000001 -#define ET_MII_IND_INVALID 0x00000004 - -#define ET_MAC_CTRL 0x5038 -#define ET_MAC_CTRL_MODE_MII 0x01000000 -#define ET_MAC_CTRL_LHDX 0x02000000 -#define ET_MAC_CTRL_GHDX 0x04000000 +#define ET_TXQUEUE_START 0x0000 +#define ET_TXQUEUE_END 0x0004 +#define ET_RXQUEUE_START 0x0008 +#define ET_RXQUEUE_END 0x000C +#define ET_QUEUE_ADDR(addr) (((addr) / ET_MEM_UNIT) - 1) +#define ET_QUEUE_ADDR_START 0 +#define ET_QUEUE_ADDR_END ET_QUEUE_ADDR(ET_MEM_SIZE) + +#define ET_PM 0x0010 +#define EM_PM_GIGEPHY_ENB 0x00000001 +#define ET_PM_SYSCLK_GATE 0x00000008 +#define ET_PM_TXCLK_GATE 0x00000010 +#define ET_PM_RXCLK_GATE 0x00000020 +#define ET_PM_PHY_SW_COMA 0x00000040 + +#define ET_INTR_STATUS 0x0018 +#define ET_INTR_MASK 0x001C + +#define ET_SWRST 0x0028 +#define ET_SWRST_TXDMA 0x00000001 +#define ET_SWRST_RXDMA 0x00000002 +#define ET_SWRST_TXMAC 0x00000004 +#define ET_SWRST_RXMAC 0x00000008 +#define ET_SWRST_MAC 0x00000010 +#define ET_SWRST_MAC_STAT 0x00000020 +#define ET_SWRST_MMC 0x00000040 +#define ET_SWRST_SELFCLR_DISABLE 0x80000000 + +#define ET_MSI_CFG 0x0030 + +#define ET_LOOPBACK 0x0034 + +#define ET_TIMER 0x0038 + +#define ET_TXDMA_CTRL 0x1000 +#define ET_TXDMA_CTRL_HALT 0x00000001 +#define ET_TXDMA_CTRL_CACHE_THR_MASK 0x000000F0 +#define ET_TXDMA_CTRL_SINGLE_EPKT 0x00000100 /* ??? */ + +#define ET_TX_RING_HI 0x1004 +#define ET_TX_RING_LO 0x1008 +#define ET_TX_RING_CNT 0x100C + +#define ET_TX_STATUS_HI 0x101C +#define ET_TX_STATUS_LO 0x1020 + +#define ET_TX_READY_POS 0x1024 +#define ET_TX_READY_POS_INDEX_MASK 0x000003FF +#define ET_TX_READY_POS_WRAP 0x00000400 + +#define ET_TX_DONE_POS 0x1060 +#define ET_TX_DONE_POS_INDEX_MASK 0x0000003FF +#define ET_TX_DONE_POS_WRAP 0x000000400 + +#define ET_RXDMA_CTRL 0x2000 +#define ET_RXDMA_CTRL_HALT 0x00000001 +#define ET_RXDMA_CTRL_RING0_SIZE_MASK 0x00000300 +#define ET_RXDMA_CTRL_RING0_128 0x00000000 /* 127 */ +#define ET_RXDMA_CTRL_RING0_256 0x00000100 /* 255 */ +#define ET_RXDMA_CTRL_RING0_512 0x00000200 /* 511 */ +#define ET_RXDMA_CTRL_RING0_1024 0x00000300 /* 1023 */ +#define ET_RXDMA_CTRL_RING0_ENABLE 0x00000400 +#define ET_RXDMA_CTRL_RING1_SIZE_MASK 0x00001800 +#define ET_RXDMA_CTRL_RING1_2048 0x00000000 /* 2047 */ +#define ET_RXDMA_CTRL_RING1_4096 0x00000800 /* 4095 */ +#define ET_RXDMA_CTRL_RING1_8192 0x00001000 /* 8191 */ +#define ET_RXDMA_CTRL_RING1_16384 0x00001800 /* 16383 (9022?) */ +#define ET_RXDMA_CTRL_RING1_ENABLE 0x00002000 +#define ET_RXDMA_CTRL_HALTED 0x00020000 + +#define ET_RX_STATUS_LO 0x2004 +#define ET_RX_STATUS_HI 0x2008 + +#define ET_RX_INTR_NPKTS 0x200C +#define ET_RX_INTR_DELAY 0x2010 + +#define ET_RXSTAT_LO 0x2020 +#define ET_RXSTAT_HI 0x2024 +#define ET_RXSTAT_CNT 0x2028 + +#define ET_RXSTAT_POS 0x2030 +#define ET_RXSTAT_POS_INDEX_MASK 0x00000FFF +#define ET_RXSTAT_POS_WRAP 0x00001000 + +#define ET_RXSTAT_MINCNT 0x2038 + +#define ET_RX_RING0_LO 0x203C +#define ET_RX_RING0_HI 0x2040 +#define ET_RX_RING0_CNT 0x2044 + +#define ET_RX_RING0_POS 0x204C +#define ET_RX_RING0_POS_INDEX_MASK 0x000003FF +#define ET_RX_RING0_POS_WRAP 0x00000400 + +#define ET_RX_RING0_MINCNT 0x2054 + +#define ET_RX_RING1_LO 0x2058 +#define ET_RX_RING1_HI 0x205C +#define ET_RX_RING1_CNT 0x2060 + +#define ET_RX_RING1_POS 0x2068 +#define ET_RX_RING1_POS_INDEX 0x000003FF +#define ET_RX_RING1_POS_WRAP 0x00000400 + +#define ET_RX_RING1_MINCNT 0x2070 + +#define ET_TXMAC_CTRL 0x3000 +#define ET_TXMAC_CTRL_ENABLE 0x00000001 +#define ET_TXMAC_CTRL_FC_DISABLE 0x00000008 + +#define ET_TXMAC_FLOWCTRL 0x3010 +#define ET_TXMAC_FLOWCTRL_CFPT_MASK 0x0000FFFF +#define ET_TXMAC_FLOWCTRL_CFEP_MASK 0xFFFF0000 +#define ET_TXMAC_FLOWCTRL_CFPT_SHIFT 0 + +#define ET_TXMAC_BP_CTRL 0x3020 +#define ET_TXMAC_BP_CTRL_XONXOFF 0x00000001 +#define ET_TXMAC_BP_CTRL_REQ 0x00000002 + +#define ET_RXMAC_CTRL 0x4000 +#define ET_RXMAC_CTRL_ENABLE 0x00000001 +#define ET_RXMAC_CTRL_NO_PKTFILT 0x00000004 +#define ET_RXMAC_CTRL_WOL_DISABLE 0x00000008 + +#define ET_WOL_CRC 0x4004 +#define ET_WOL_SA_LO 0x4010 +#define ET_WOL_SA_HI 0x4014 +#define ET_WOL_MASK 0x4018 + +#define ET_UCAST_FILTADDR1 0x4068 +#define ET_UCAST_FILTADDR2 0x406C +#define ET_UCAST_FILTADDR3 0x4070 + +#define ET_MULTI_HASH 0x4074 + +#define ET_PKTFILT 0x4084 +#define ET_PKTFILT_BCAST 0x00000001 +#define ET_PKTFILT_MCAST 0x00000002 +#define ET_PKTFILT_UCAST 0x00000004 +#define ET_PKTFILT_FRAG 0x00000008 +#define ET_PKTFILT_MINLEN_MASK 0x007F0000 +#define ET_PKTFILT_MINLEN_SHIFT 16 + +#define ET_RXMAC_MC_SEGSZ 0x4088 +#define ET_RXMAC_MC_SEGSZ_ENABLE 0x00000001 +#define ET_RXMAC_MC_SEGSZ_FC 0x00000002 +#define ET_RXMAC_MC_SEGSZ_MAX_MASK 0x000003FC +#define ET_RXMAC_SEGSZ(segsz) ((segsz) / ET_MEM_UNIT) +#define ET_RXMAC_CUT_THRU_FRMLEN 8074 + +#define ET_RXMAC_MC_WATERMARK 0x408C +#define ET_RXMAC_SPACE_AVL 0x4094 + +#define ET_RXMAC_MGT 0x4098 +#define ET_RXMAC_MGT_PASS_ECRC 0x00000010 +#define ET_RXMAC_MGT_PASS_ELEN 0x00000020 +#define ET_RXMAC_MGT_PASS_ETRUNC 0x00010000 +#define ET_RXMAC_MGT_CHECK_PKT 0x00020000 + +#define ET_MAC_CFG1 0x5000 +#define ET_MAC_CFG1_TXEN 0x00000001 +#define ET_MAC_CFG1_SYNC_TXEN 0x00000002 +#define ET_MAC_CFG1_RXEN 0x00000004 +#define ET_MAC_CFG1_SYNC_RXEN 0x00000008 +#define ET_MAC_CFG1_TXFLOW 0x00000010 +#define ET_MAC_CFG1_RXFLOW 0x00000020 +#define ET_MAC_CFG1_LOOPBACK 0x00000100 +#define ET_MAC_CFG1_RST_TXFUNC 0x00010000 +#define ET_MAC_CFG1_RST_RXFUNC 0x00020000 +#define ET_MAC_CFG1_RST_TXMC 0x00040000 +#define ET_MAC_CFG1_RST_RXMC 0x00080000 +#define ET_MAC_CFG1_SIM_RST 0x40000000 +#define ET_MAC_CFG1_SOFT_RST 0x80000000 + +#define ET_MAC_CFG2 0x5004 +#define ET_MAC_CFG2_FDX 0x00000001 +#define ET_MAC_CFG2_CRC 0x00000002 +#define ET_MAC_CFG2_PADCRC 0x00000004 +#define ET_MAC_CFG2_LENCHK 0x00000010 +#define ET_MAC_CFG2_BIGFRM 0x00000020 +#define ET_MAC_CFG2_MODE_MII 0x00000100 +#define ET_MAC_CFG2_MODE_GMII 0x00000200 +#define ET_MAC_CFG2_PREAMBLE_LEN_MASK 0x0000F000 +#define ET_MAC_CFG2_PREAMBLE_LEN_SHIFT 12 + +#define ET_IPG 0x5008 +#define ET_IPG_B2B_MASK 0x0000007F +#define ET_IPG_MINIFG_MASK 0x0000FF00 +#define ET_IPG_NONB2B_2_MASK 0x007F0000 +#define ET_IPG_NONB2B_1_MASK 0x7F000000 +#define ET_IPG_B2B_SHIFT 0 +#define ET_IPG_MINIFG_SHIFT 8 +#define ET_IPG_NONB2B_2_SHIFT 16 +#define ET_IPG_NONB2B_1_SHIFT 24 + +#define ET_MAC_HDX 0x500C +#define ET_MAC_HDX_COLLWIN_MASK 0x000003FF +#define ET_MAC_HDX_REXMIT_MAX_MASK 0x0000F000 +#define ET_MAC_HDX_EXC_DEFER 0x00010000 +#define ET_MAC_HDX_NOBACKOFF 0x00020000 +#define ET_MAC_HDX_BP_NOBACKOFF 0x00040000 +#define ET_MAC_HDX_ALT_BEB 0x00080000 +#define ET_MAC_HDX_ALT_BEB_TRUNC_MASK 0x00F00000 +#define ET_MAC_HDX_COLLWIN_SHIFT 0 +#define ET_MAC_HDX_REXMIT_MAX_SHIFT 12 +#define ET_MAC_HDX_ALT_BEB_TRUNC_SHIFT 20 + +#define ET_MAX_FRMLEN 0x5010 + +#define ET_MII_CFG 0x5020 +#define ET_MII_CFG_CLKRST 0x00000007 +#define ET_MII_CFG_PREAMBLE_SUP 0x00000010 +#define ET_MII_CFG_SCAN_AUTOINC 0x00000020 +#define ET_MII_CFG_RST 0x80000000 + +#define ET_MII_CMD 0x5024 +#define ET_MII_CMD_READ 0x00000001 + +#define ET_MII_ADDR 0x5028 +#define ET_MII_ADDR_REG_MASK 0x0000001F +#define ET_MII_ADDR_PHY_MASK 0x00001F00 +#define ET_MII_ADDR_REG_SHIFT 0 +#define ET_MII_ADDR_PHY_SHIFT 8 + +#define ET_MII_CTRL 0x502C +#define ET_MII_CTRL_VALUE_MASK 0x0000FFFF +#define ET_MII_CTRL_VALUE_SHIFT 0 + +#define ET_MII_STAT 0x5030 +#define ET_MII_STAT_VALUE_MASK 0x0000FFFF + +#define ET_MII_IND 0x5034 +#define ET_MII_IND_BUSY 0x00000001 +#define ET_MII_IND_INVALID 0x00000004 + +#define ET_MAC_CTRL 0x5038 +#define ET_MAC_CTRL_MODE_MII 0x01000000 +#define ET_MAC_CTRL_LHDX 0x02000000 +#define ET_MAC_CTRL_GHDX 0x04000000 -#define ET_MAC_ADDR1 0x5040 -#define ET_MAC_ADDR2 0x5044 +#define ET_MAC_ADDR1 0x5040 +#define ET_MAC_ADDR2 0x5044 /* MAC statistics counters. */ #define ET_STAT_PKTS_64 0x6080 @@ -364,48 +371,48 @@ #define ET_STAT_TX_UNDERSIZE 0x6128 #define ET_STAT_TX_FRAG 0x612C -#define ET_MMC_CTRL 0x7000 -#define ET_MMC_CTRL_ENABLE 0x00000001 -#define ET_MMC_CTRL_ARB_DISABLE 0x00000002 -#define ET_MMC_CTRL_RXMAC_DISABLE 0x00000004 -#define ET_MMC_CTRL_TXMAC_DISABLE 0x00000008 -#define ET_MMC_CTRL_TXDMA_DISABLE 0x00000010 -#define ET_MMC_CTRL_RXDMA_DISABLE 0x00000020 -#define ET_MMC_CTRL_FORCE_CE 0x00000040 +#define ET_MMC_CTRL 0x7000 +#define ET_MMC_CTRL_ENABLE 0x00000001 +#define ET_MMC_CTRL_ARB_DISABLE 0x00000002 +#define ET_MMC_CTRL_RXMAC_DISABLE 0x00000004 +#define ET_MMC_CTRL_TXMAC_DISABLE 0x00000008 +#define ET_MMC_CTRL_TXDMA_DISABLE 0x00000010 +#define ET_MMC_CTRL_RXDMA_DISABLE 0x00000020 +#define ET_MMC_CTRL_FORCE_CE 0x00000040 /* * Interrupts */ -#define ET_INTR_TXEOF 0x00000008 -#define ET_INTR_TXDMA_ERROR 0x00000010 -#define ET_INTR_RXEOF 0x00000020 -#define ET_INTR_RXRING0_LOW 0x00000040 -#define ET_INTR_RXRING1_LOW 0x00000080 -#define ET_INTR_RXSTAT_LOW 0x00000100 -#define ET_INTR_RXDMA_ERROR 0x00000200 -#define ET_INTR_TIMER 0x00004000 -#define ET_INTR_WOL 0x00008000 -#define ET_INTR_PHY 0x00010000 -#define ET_INTR_TXMAC 0x00020000 -#define ET_INTR_RXMAC 0x00040000 -#define ET_INTR_MAC_STATS 0x00080000 -#define ET_INTR_SLAVE_TO 0x00100000 - -#define ET_INTRS (ET_INTR_TXEOF | \ - ET_INTR_RXEOF | \ - ET_INTR_TIMER) +#define ET_INTR_TXDMA 0x00000008 +#define ET_INTR_TXDMA_ERROR 0x00000010 +#define ET_INTR_RXDMA 0x00000020 +#define ET_INTR_RXRING0_LOW 0x00000040 +#define ET_INTR_RXRING1_LOW 0x00000080 +#define ET_INTR_RXSTAT_LOW 0x00000100 +#define ET_INTR_RXDMA_ERROR 0x00000200 +#define ET_INTR_TIMER 0x00004000 +#define ET_INTR_WOL 0x00008000 +#define ET_INTR_PHY 0x00010000 +#define ET_INTR_TXMAC 0x00020000 +#define ET_INTR_RXMAC 0x00040000 +#define ET_INTR_MAC_STATS 0x00080000 +#define ET_INTR_SLAVE_TO 0x00100000 + +#define ET_INTRS \ + (ET_INTR_TXDMA | ET_INTR_RXDMA | ET_INTR_TIMER | \ + ET_INTR_TXDMA_ERROR | ET_INTR_RXDMA_ERROR) /* * RX ring position uses same layout */ -#define ET_RX_RING_POS_INDEX_MASK 0x000003FF -#define ET_RX_RING_POS_WRAP 0x00000400 +#define ET_RX_RING_POS_INDEX_MASK 0x000003FF +#define ET_RX_RING_POS_WRAP 0x00000400 /* * PCI IDs */ -#define PCI_VENDOR_LUCENT 0x11c1 -#define PCI_PRODUCT_LUCENT_ET1310 0xed00 /* ET1310 10/100/1000M Ethernet */ -#define PCI_PRODUCT_LUCENT_ET1310_FAST 0xed01 /* ET1310 10/100M Ethernet */ +#define PCI_VENDOR_LUCENT 0x11C1 +#define PCI_PRODUCT_LUCENT_ET1310 0xED00 /* ET1310 10/100/1000M Ethernet */ +#define PCI_PRODUCT_LUCENT_ET1310_FAST 0xED01 /* ET1310 10/100M Ethernet */ #endif /* !_IF_ETREG_H */ Modified: stable/8/sys/dev/et/if_etvar.h ============================================================================== --- stable/8/sys/dev/et/if_etvar.h Fri Jan 6 21:43:26 2012 (r229736) +++ stable/8/sys/dev/et/if_etvar.h Fri Jan 6 21:45:08 2012 (r229737) @@ -38,39 +38,39 @@ #ifndef _IF_ETVAR_H #define _IF_ETVAR_H -#define ET_RING_ALIGN 4096 -#define ET_STATUS_ALIGN 8 -#define ET_NSEG_MAX 32 /* XXX no limit actually */ -#define ET_NSEG_SPARE 4 - -#define ET_TX_NDESC 512 -#define ET_RX_NDESC 512 -#define ET_RX_NRING 2 -#define ET_RX_NSTAT (ET_RX_NRING * ET_RX_NDESC) - -#define ET_TX_RING_SIZE (ET_TX_NDESC * sizeof(struct et_txdesc)) -#define ET_RX_RING_SIZE (ET_RX_NDESC * sizeof(struct et_rxdesc)) -#define ET_RXSTAT_RING_SIZE (ET_RX_NSTAT * sizeof(struct et_rxstat)) +#define ET_RING_ALIGN 4096 +#define ET_STATUS_ALIGN 8 +#define ET_NSEG_MAX 32 /* XXX no limit actually */ +#define ET_NSEG_SPARE 4 + +#define ET_TX_NDESC 512 +#define ET_RX_NDESC 512 +#define ET_RX_NRING 2 +#define ET_RX_NSTAT (ET_RX_NRING * ET_RX_NDESC) + +#define ET_TX_RING_SIZE (ET_TX_NDESC * sizeof(struct et_txdesc)) +#define ET_RX_RING_SIZE (ET_RX_NDESC * sizeof(struct et_rxdesc)) +#define ET_RXSTAT_RING_SIZE (ET_RX_NSTAT * sizeof(struct et_rxstat)) -#define ET_JUMBO_FRAMELEN (ET_MEM_SIZE - ET_MEM_RXSIZE_MIN - \ +#define ET_JUMBO_FRAMELEN (ET_MEM_SIZE - ET_MEM_RXSIZE_MIN - \ ET_MEM_TXSIZE_EX) -#define ET_JUMBO_MTU (ET_JUMBO_FRAMELEN - ETHER_HDR_LEN - \ +#define ET_JUMBO_MTU (ET_JUMBO_FRAMELEN - ETHER_HDR_LEN - \ EVL_ENCAPLEN - ETHER_CRC_LEN) -#define ET_FRAMELEN(mtu) (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + \ +#define ET_FRAMELEN(mtu) (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + \ (mtu) + ETHER_CRC_LEN) -#define ET_JSLOTS (ET_RX_NDESC + 128) -#define ET_JLEN (ET_JUMBO_FRAMELEN + ETHER_ALIGN) -#define ET_JUMBO_MEM_SIZE (ET_JSLOTS * ET_JLEN) +#define ET_JSLOTS (ET_RX_NDESC + 128) +#define ET_JLEN (ET_JUMBO_FRAMELEN + ETHER_ALIGN) +#define ET_JUMBO_MEM_SIZE (ET_JSLOTS * ET_JLEN) -#define CSR_WRITE_4(sc, reg, val) \ +#define CSR_WRITE_4(sc, reg, val) \ bus_write_4((sc)->sc_mem_res, (reg), (val)) -#define CSR_READ_4(sc, reg) \ +#define CSR_READ_4(sc, reg) \ bus_read_4((sc)->sc_mem_res, (reg)) -#define ET_ADDR_HI(addr) ((uint64_t) (addr) >> 32) -#define ET_ADDR_LO(addr) ((uint64_t) (addr) & 0xffffffff) +#define ET_ADDR_HI(addr) ((uint64_t) (addr) >> 32) +#define ET_ADDR_LO(addr) ((uint64_t) (addr) & 0xffffffff) struct et_txdesc { uint32_t td_addr_hi; @@ -79,23 +79,23 @@ struct et_txdesc { uint32_t td_ctrl2; /* ET_TDCTRL2_ */ }; -#define ET_TDCTRL1_LEN_MASK 0x0000FFFF +#define ET_TDCTRL1_LEN_MASK 0x0000FFFF -#define ET_TDCTRL2_LAST_FRAG 0x00000001 -#define ET_TDCTRL2_FIRST_FRAG 0x00000002 -#define ET_TDCTRL2_INTR 0x00000004 -#define ET_TDCTRL2_CTRL_WORD 0x00000008 -#define ET_TDCTRL2_HDX_BACKP 0x00000010 -#define ET_TDCTRL2_XMIT_PAUSE 0x00000020 -#define ET_TDCTRL2_FRAME_ERR 0x00000040 -#define ET_TDCTRL2_NO_CRC 0x00000080 -#define ET_TDCTRL2_MAC_OVRRD 0x00000100 -#define ET_TDCTRL2_PAD_PACKET 0x00000200 -#define ET_TDCTRL2_JUMBO_PACKET 0x00000400 -#define ET_TDCTRL2_INS_VLAN 0x00000800 -#define ET_TDCTRL2_CSUM_IP 0x00001000 -#define ET_TDCTRL2_CSUM_TCP 0x00002000 -#define ET_TDCTRL2_CSUM_UDP 0x00004000 +#define ET_TDCTRL2_LAST_FRAG 0x00000001 +#define ET_TDCTRL2_FIRST_FRAG 0x00000002 +#define ET_TDCTRL2_INTR 0x00000004 +#define ET_TDCTRL2_CTRL_WORD 0x00000008 +#define ET_TDCTRL2_HDX_BACKP 0x00000010 +#define ET_TDCTRL2_XMIT_PAUSE 0x00000020 +#define ET_TDCTRL2_FRAME_ERR 0x00000040 +#define ET_TDCTRL2_NO_CRC 0x00000080 +#define ET_TDCTRL2_MAC_OVRRD 0x00000100 +#define ET_TDCTRL2_PAD_PACKET 0x00000200 +#define ET_TDCTRL2_JUMBO_PACKET 0x00000400 +#define ET_TDCTRL2_INS_VLAN 0x00000800 +#define ET_TDCTRL2_CSUM_IP 0x00001000 +#define ET_TDCTRL2_CSUM_TCP 0x00002000 +#define ET_TDCTRL2_CSUM_UDP 0x00004000 struct et_rxdesc { uint32_t rd_addr_lo; @@ -103,56 +103,56 @@ struct et_rxdesc { uint32_t rd_ctrl; /* ET_RDCTRL_ */ }; -#define ET_RDCTRL_BUFIDX_MASK 0x000003FF +#define ET_RDCTRL_BUFIDX_MASK 0x000003FF struct et_rxstat { uint32_t rxst_info1; uint32_t rxst_info2; /* ET_RXST_INFO2_ */ }; -#define ET_RXST_INFO1_HASH_PASS 0x00000001 -#define ET_RXST_INFO1_IPCSUM 0x00000002 -#define ET_RXST_INFO1_IPCSUM_OK 0x00000004 -#define ET_RXST_INFO1_TCPCSUM 0x00000008 -#define ET_RXST_INFO1_TCPCSUM_OK 0x00000010 -#define ET_RXST_INFO1_WOL 0x00000020 -#define ET_RXST_INFO1_RXMAC_ERR 0x00000040 -#define ET_RXST_INFO1_DROP 0x00000080 -#define ET_RXST_INFO1_FRAME_TRUNC 0x00000100 -#define ET_RXST_INFO1_JUMBO 0x00000200 -#define ET_RXST_INFO1_VLAN 0x00000400 -#define ET_RXST_INFO1_PREV_FRMAE_DROP 0x00010000 -#define ET_RXST_INFO1_SHORT 0x00020000 -#define ET_RXST_INFO1_BAD_CARRIER 0x00040000 -#define ET_RXST_INFO1_CODE_ERR 0x00080000 -#define ET_RXST_INFO1_CRC_ERR 0x00100000 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 21:46:35 2012 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 82D1A106564A; Fri, 6 Jan 2012 21:46:35 +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 6F7AB8FC08; Fri, 6 Jan 2012 21:46: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 q06LkZJD009723; Fri, 6 Jan 2012 21:46:35 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06LkZtC009719; Fri, 6 Jan 2012 21:46:35 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201062146.q06LkZtC009719@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 6 Jan 2012 21:46:35 +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: r229738 - stable/7/sys/dev/et 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, 06 Jan 2012 21:46:35 -0000 Author: yongari Date: Fri Jan 6 21:46:35 2012 New Revision: 229738 URL: http://svn.freebsd.org/changeset/base/229738 Log: MFC r228333,228335-228336,228362,228368-228369,228381: r228333: Protect SIOCSIFMTU ioctl handler with driver lock. Don't blindly re-initialize controller whenever MTU is changed. Now, reinitializing is done only when driver is running. While here, remove unnecessary assignment of error value since it was already initialized to 0. r228335: Consistently use a tab character instead of using either a space or tab after #define. While I'm here consistently use capital letters when it uses hexadecimal notation. No functional changes. r228336: Disable all clocks and put PHY into COMA before entering into suspend state. This will save more power. On resume, make sure to enable all clocks. While I'm here, if controller is not fast ethernet, enable gigabit PHY. r228362: Do not disable interrupt without knowing whether the raised interrupt is ours. Note, interrupts are automatically ACKed when the status register is read. Add RX/TX DMA error to interrupt handler and do full controller reset if driver happen to encounter these errors. There is no way to recover from these DMA errors without controller reset. Rename local variable name intrs with status to enhance readability. While I'm here, rename ET_INTR_TXEOF and ET_INTR_RXEOF to ET_INTR_TXDMA and ET_INTR_RXDMA respectively. These interrupts indicate that a frame is successfully DMAed to controller's internal FIFO and they have nothing to do with EOF(end of frame). Driver does not need to wait actual end of TX/RX of a frame(e.g. no need to wait the end signal of TX which is generated when a frame in TX FIFO is emptied by MAC). Previous names were somewhat confusing. r228368: Remove unnecessary definition of ET_PCIR_BAR. Controller support I/O memory only. While here, use pci_set_max_read_req(9) rather than directly manipulating PCIe device control register. r228369: Announce flow control ability to PHY driver and enable RX flow control. Controller does not automatically generate pause frames based on number of available RX buffers so it's very hard to know when driver should generate XON frame in time. The only mechanism driver can detect low number of RX buffer condition is ET_INTR_RXRING0_LOW or ET_INTR_RXRING1_LOW interrupt. This interrupt is generated whenever controller notices the number of available RX buffers are lower than pre-programmed value( ET_RX_RING0_MINCNT and ET_RX_RING1_MINCNT register). This scheme does not provide a way to detect when controller sees enough number of RX buffers again such that efficient generation of XON/XOFF frame is not easy. While here, add more flow control related register definition. r228381: FreeBSD driver does not require arpcom structure in softc. Modified: stable/7/sys/dev/et/if_et.c stable/7/sys/dev/et/if_etreg.h stable/7/sys/dev/et/if_etvar.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/et/if_et.c ============================================================================== --- stable/7/sys/dev/et/if_et.c Fri Jan 6 21:45:08 2012 (r229737) +++ stable/7/sys/dev/et/if_et.c Fri Jan 6 21:46:35 2012 (r229738) @@ -224,6 +224,7 @@ et_attach(device_t dev) struct et_softc *sc; struct ifnet *ifp; uint8_t eaddr[ETHER_ADDR_LEN]; + uint32_t pmcfg; int cap, error, msic; sc = device_get_softc(dev); @@ -253,9 +254,9 @@ et_attach(device_t dev) /* * Allocate IO memory */ - sc->sc_mem_rid = ET_PCIR_BAR; + sc->sc_mem_rid = PCIR_BAR(0); sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, - &sc->sc_mem_rid, RF_ACTIVE); + &sc->sc_mem_rid, RF_ACTIVE); if (sc->sc_mem_res == NULL) { device_printf(dev, "can't allocate IO memory\n"); return (ENXIO); @@ -308,8 +309,11 @@ et_attach(device_t dev) et_get_eaddr(dev, eaddr); - CSR_WRITE_4(sc, ET_PM, - ET_PM_SYSCLK_GATE | ET_PM_TXCLK_GATE | ET_PM_RXCLK_GATE); + /* Take PHY out of COMA and enable clocks. */ + pmcfg = ET_PM_SYSCLK_GATE | ET_PM_TXCLK_GATE | ET_PM_RXCLK_GATE; + if ((sc->sc_flags & ET_FLAG_FASTETHER) == 0) + pmcfg |= EM_PM_GIGEPHY_ENB; + CSR_WRITE_4(sc, ET_PM, pmcfg); et_reset(sc); @@ -332,7 +336,8 @@ et_attach(device_t dev) et_chip_attach(sc); error = mii_attach(dev, &sc->sc_miibus, ifp, et_ifmedia_upd, - et_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + et_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, + MIIF_DOPAUSE); if (error) { device_printf(dev, "attaching PHYs failed\n"); goto fail; @@ -548,12 +553,23 @@ et_miibus_statchg(device_t dev) if (IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) { cfg2 |= ET_MAC_CFG2_FDX; + /* + * Controller lacks automatic TX pause frame + * generation so it should be handled by driver. + * Even though driver can send pause frame with + * arbitrary pause time, controller does not + * provide a way that tells how many free RX + * buffers are available in controller. This + * limitation makes it hard to generate XON frame + * in time on driver side so don't enable TX flow + * control. + */ #ifdef notyet if (IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_TXPAUSE) cfg1 |= ET_MAC_CFG1_TXFLOW; +#endif if (IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_RXPAUSE) cfg1 |= ET_MAC_CFG1_RXFLOW; -#endif } else ctrl |= ET_MAC_CTRL_GHDX; @@ -722,12 +738,7 @@ et_bus_config(struct et_softc *sc) /* * Set max read request size to 2048 bytes */ - val = pci_read_config(sc->dev, - sc->sc_expcap + PCIR_EXPRESS_DEVICE_CTL, 2); - val &= ~PCIM_EXP_CTL_MAX_READ_REQUEST; - val |= ET_PCIV_DEVICE_CTRL_RRSZ_2K; - pci_write_config(sc->dev, - sc->sc_expcap + PCIR_EXPRESS_DEVICE_CTL, val, 2); + pci_set_max_read_req(sc->dev, 2048); return (0); } @@ -1158,34 +1169,40 @@ et_intr(void *xsc) { struct et_softc *sc = xsc; struct ifnet *ifp; - uint32_t intrs; + uint32_t status; ET_LOCK(sc); ifp = sc->ifp; - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { - ET_UNLOCK(sc); - return; - } + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + goto done; + + status = CSR_READ_4(sc, ET_INTR_STATUS); + if ((status & ET_INTRS) == 0) + goto done; /* Disable further interrupts. */ CSR_WRITE_4(sc, ET_INTR_MASK, 0xffffffff); - intrs = CSR_READ_4(sc, ET_INTR_STATUS); - if ((intrs & ET_INTRS) == 0) - goto done; - - if (intrs & ET_INTR_RXEOF) + if (status & (ET_INTR_RXDMA_ERROR | ET_INTR_TXDMA_ERROR)) { + device_printf(sc->dev, "DMA error(0x%08x) -- resetting\n", + status); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + et_init_locked(sc); + ET_UNLOCK(sc); + return; + } + if (status & ET_INTR_RXDMA) et_rxeof(sc); - if (intrs & (ET_INTR_TXEOF | ET_INTR_TIMER)) + if (status & (ET_INTR_TXDMA | ET_INTR_TIMER)) et_txeof(sc); - if (intrs & ET_INTR_TIMER) + if (status & ET_INTR_TIMER) CSR_WRITE_4(sc, ET_TIMER, sc->sc_timer); -done: if (ifp->if_drv_flags & IFF_DRV_RUNNING) { CSR_WRITE_4(sc, ET_INTR_MASK, ~ET_INTRS); if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) et_start_locked(ifp); } +done: ET_UNLOCK(sc); } @@ -1291,11 +1308,11 @@ et_ioctl(struct ifnet *ifp, u_long cmd, ET_LOCK(sc); et_setmulti(sc); ET_UNLOCK(sc); - error = 0; } break; case SIOCSIFMTU: + ET_LOCK(sc); #if 0 if (sc->sc_flags & ET_FLAG_JUMBO) max_framelen = ET_JUMBO_FRAMELEN; @@ -1305,14 +1322,18 @@ et_ioctl(struct ifnet *ifp, u_long cmd, if (ET_FRAMELEN(ifr->ifr_mtu) > max_framelen) { error = EOPNOTSUPP; + ET_UNLOCK(sc); break; } if (ifp->if_mtu != ifr->ifr_mtu) { ifp->if_mtu = ifr->ifr_mtu; - ifp->if_drv_flags &= ~IFF_DRV_RUNNING; - et_init(sc); + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + et_init_locked(sc); + } } + ET_UNLOCK(sc); break; case SIOCSIFCAP: @@ -1944,8 +1965,12 @@ et_init_txmac(struct et_softc *sc) /* Disable TX MAC and FC(?) */ CSR_WRITE_4(sc, ET_TXMAC_CTRL, ET_TXMAC_CTRL_FC_DISABLE); - /* No flow control yet */ - CSR_WRITE_4(sc, ET_TXMAC_FLOWCTRL, 0); + /* + * Initialize pause time. + * This register should be set before XON/XOFF frame is + * sent by driver. + */ + CSR_WRITE_4(sc, ET_TXMAC_FLOWCTRL, 0 << ET_TXMAC_FLOWCTRL_CFPT_SHIFT); /* Enable TX MAC but leave FC(?) diabled */ CSR_WRITE_4(sc, ET_TXMAC_CTRL, @@ -2378,7 +2403,7 @@ et_newbuf_hdr(struct et_rxbuf_data *rbd, #define ET_SYSCTL_STAT_ADD32(c, h, n, p, d) \ SYSCTL_ADD_UINT(c, h, OID_AUTO, n, CTLFLAG_RD, p, 0, d) #define ET_SYSCTL_STAT_ADD64(c, h, n, p, d) \ - SYSCTL_ADD_UQUAD(c, h, OID_AUTO, n, CTLFLAG_RD, p, d) + SYSCTL_ADD_QUAD(c, h, OID_AUTO, n, CTLFLAG_RD, p, d) /* * Create sysctl tree @@ -2636,11 +2661,18 @@ static int et_suspend(device_t dev) { struct et_softc *sc; + uint32_t pmcfg; sc = device_get_softc(dev); ET_LOCK(sc); if ((sc->ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) et_stop(sc); + /* Diable all clocks and put PHY into COMA. */ + pmcfg = CSR_READ_4(sc, ET_PM); + pmcfg &= ~(EM_PM_GIGEPHY_ENB | ET_PM_SYSCLK_GATE | ET_PM_TXCLK_GATE | + ET_PM_RXCLK_GATE); + pmcfg |= ET_PM_PHY_SW_COMA; + CSR_WRITE_4(sc, ET_PM, pmcfg); ET_UNLOCK(sc); return (0); } @@ -2649,9 +2681,15 @@ static int et_resume(device_t dev) { struct et_softc *sc; + uint32_t pmcfg; sc = device_get_softc(dev); ET_LOCK(sc); + /* Take PHY out of COMA and enable clocks. */ + pmcfg = ET_PM_SYSCLK_GATE | ET_PM_TXCLK_GATE | ET_PM_RXCLK_GATE; + if ((sc->sc_flags & ET_FLAG_FASTETHER) == 0) + pmcfg |= EM_PM_GIGEPHY_ENB; + CSR_WRITE_4(sc, ET_PM, pmcfg); if ((sc->ifp->if_flags & IFF_UP) != 0) et_init_locked(sc); ET_UNLOCK(sc); Modified: stable/7/sys/dev/et/if_etreg.h ============================================================================== --- stable/7/sys/dev/et/if_etreg.h Fri Jan 6 21:45:08 2012 (r229737) +++ stable/7/sys/dev/et/if_etreg.h Fri Jan 6 21:46:35 2012 (r229738) @@ -38,11 +38,11 @@ #ifndef _IF_ETREG_H #define _IF_ETREG_H -#define ET_MEM_TXSIZE_EX 182 -#define ET_MEM_RXSIZE_MIN 608 -#define ET_MEM_RXSIZE_DEFAULT 11216 -#define ET_MEM_SIZE 16384 -#define ET_MEM_UNIT 16 +#define ET_MEM_TXSIZE_EX 182 +#define ET_MEM_RXSIZE_MIN 608 +#define ET_MEM_RXSIZE_DEFAULT 11216 +#define ET_MEM_SIZE 16384 +#define ET_MEM_UNIT 16 /* * PCI registers @@ -53,270 +53,277 @@ * ET_PCIV_REPLAY_TIMER_{128,256} are from * PCI EXPRESS BASE SPECIFICATION, REV. 1.0a, Table 3-4 */ -#define ET_PCIR_BAR PCIR_BAR(0) +#define ET_PCIR_DEVICE_CAPS 0x4C +#define ET_PCIM_DEVICE_CAPS_MAX_PLSZ 0x7 /* Max playload size */ +#define ET_PCIV_DEVICE_CAPS_PLSZ_128 0x0 +#define ET_PCIV_DEVICE_CAPS_PLSZ_256 0x1 + +#define ET_PCIR_DEVICE_CTRL 0x50 +#define ET_PCIM_DEVICE_CTRL_MAX_RRSZ 0x7000 /* Max read request size */ +#define ET_PCIV_DEVICE_CTRL_RRSZ_2K 0x4000 + +#define ET_PCIR_MAC_ADDR0 0xA4 +#define ET_PCIR_MAC_ADDR1 0xA8 + +#define ET_PCIR_EEPROM_STATUS 0xB2 /* XXX undocumented */ +#define ET_PCIM_EEPROM_STATUS_ERROR 0x4C + +#define ET_PCIR_ACK_LATENCY 0xC0 +#define ET_PCIV_ACK_LATENCY_128 237 +#define ET_PCIV_ACK_LATENCY_256 416 + +#define ET_PCIR_REPLAY_TIMER 0xC2 +#define ET_REPLAY_TIMER_RX_L0S_ADJ 250 /* XXX infered from default */ +#define ET_PCIV_REPLAY_TIMER_128 (711 + ET_REPLAY_TIMER_RX_L0S_ADJ) +#define ET_PCIV_REPLAY_TIMER_256 (1248 + ET_REPLAY_TIMER_RX_L0S_ADJ) -#define ET_PCIR_DEVICE_CAPS 0x4c -#define ET_PCIM_DEVICE_CAPS_MAX_PLSZ 0x7 /* Max playload size */ -#define ET_PCIV_DEVICE_CAPS_PLSZ_128 0x0 -#define ET_PCIV_DEVICE_CAPS_PLSZ_256 0x1 - -#define ET_PCIR_DEVICE_CTRL 0x50 -#define ET_PCIM_DEVICE_CTRL_MAX_RRSZ 0x7000 /* Max read request size */ -#define ET_PCIV_DEVICE_CTRL_RRSZ_2K 0x4000 - -#define ET_PCIR_MAC_ADDR0 0xa4 -#define ET_PCIR_MAC_ADDR1 0xa8 - -#define ET_PCIR_EEPROM_STATUS 0xb2 /* XXX undocumented */ -#define ET_PCIM_EEPROM_STATUS_ERROR 0x4c - -#define ET_PCIR_ACK_LATENCY 0xc0 -#define ET_PCIV_ACK_LATENCY_128 237 -#define ET_PCIV_ACK_LATENCY_256 416 - -#define ET_PCIR_REPLAY_TIMER 0xc2 -#define ET_REPLAY_TIMER_RX_L0S_ADJ 250 /* XXX infered from default */ -#define ET_PCIV_REPLAY_TIMER_128 (711 + ET_REPLAY_TIMER_RX_L0S_ADJ) -#define ET_PCIV_REPLAY_TIMER_256 (1248 + ET_REPLAY_TIMER_RX_L0S_ADJ) - -#define ET_PCIR_L0S_L1_LATENCY 0xcf +#define ET_PCIR_L0S_L1_LATENCY 0xCF /* * CSR */ -#define ET_TXQUEUE_START 0x0000 -#define ET_TXQUEUE_END 0x0004 -#define ET_RXQUEUE_START 0x0008 -#define ET_RXQUEUE_END 0x000c -#define ET_QUEUE_ADDR(addr) (((addr) / ET_MEM_UNIT) - 1) -#define ET_QUEUE_ADDR_START 0 -#define ET_QUEUE_ADDR_END ET_QUEUE_ADDR(ET_MEM_SIZE) - -#define ET_PM 0x0010 -#define ET_PM_SYSCLK_GATE 0x00000008 -#define ET_PM_TXCLK_GATE 0x00000010 -#define ET_PM_RXCLK_GATE 0x00000020 - -#define ET_INTR_STATUS 0x0018 -#define ET_INTR_MASK 0x001c - -#define ET_SWRST 0x0028 -#define ET_SWRST_TXDMA 0x00000001 -#define ET_SWRST_RXDMA 0x00000002 -#define ET_SWRST_TXMAC 0x00000004 -#define ET_SWRST_RXMAC 0x00000008 -#define ET_SWRST_MAC 0x00000010 -#define ET_SWRST_MAC_STAT 0x00000020 -#define ET_SWRST_MMC 0x00000040 -#define ET_SWRST_SELFCLR_DISABLE 0x80000000 - -#define ET_MSI_CFG 0x0030 - -#define ET_LOOPBACK 0x0034 - -#define ET_TIMER 0x0038 - -#define ET_TXDMA_CTRL 0x1000 -#define ET_TXDMA_CTRL_HALT 0x00000001 -#define ET_TXDMA_CTRL_CACHE_THR_MASK 0x000000F0 -#define ET_TXDMA_CTRL_SINGLE_EPKT 0x00000100 /* ??? */ - -#define ET_TX_RING_HI 0x1004 -#define ET_TX_RING_LO 0x1008 -#define ET_TX_RING_CNT 0x100c - -#define ET_TX_STATUS_HI 0x101c -#define ET_TX_STATUS_LO 0x1020 - -#define ET_TX_READY_POS 0x1024 -#define ET_TX_READY_POS_INDEX_MASK 0x000003FF -#define ET_TX_READY_POS_WRAP 0x00000400 - -#define ET_TX_DONE_POS 0x1060 -#define ET_TX_DONE_POS_INDEX_MASK 0x0000003FF -#define ET_TX_DONE_POS_WRAP 0x000000400 - -#define ET_RXDMA_CTRL 0x2000 -#define ET_RXDMA_CTRL_HALT 0x00000001 -#define ET_RXDMA_CTRL_RING0_SIZE_MASK 0x00000300 -#define ET_RXDMA_CTRL_RING0_128 0x00000000 /* 127 */ -#define ET_RXDMA_CTRL_RING0_256 0x00000100 /* 255 */ -#define ET_RXDMA_CTRL_RING0_512 0x00000200 /* 511 */ -#define ET_RXDMA_CTRL_RING0_1024 0x00000300 /* 1023 */ -#define ET_RXDMA_CTRL_RING0_ENABLE 0x00000400 -#define ET_RXDMA_CTRL_RING1_SIZE_MASK 0x00001800 -#define ET_RXDMA_CTRL_RING1_2048 0x00000000 /* 2047 */ -#define ET_RXDMA_CTRL_RING1_4096 0x00000800 /* 4095 */ -#define ET_RXDMA_CTRL_RING1_8192 0x00001000 /* 8191 */ -#define ET_RXDMA_CTRL_RING1_16384 0x00001800 /* 16383 (9022?) */ -#define ET_RXDMA_CTRL_RING1_ENABLE 0x00002000 -#define ET_RXDMA_CTRL_HALTED 0x00020000 - -#define ET_RX_STATUS_LO 0x2004 -#define ET_RX_STATUS_HI 0x2008 - -#define ET_RX_INTR_NPKTS 0x200c -#define ET_RX_INTR_DELAY 0x2010 - -#define ET_RXSTAT_LO 0x2020 -#define ET_RXSTAT_HI 0x2024 -#define ET_RXSTAT_CNT 0x2028 - -#define ET_RXSTAT_POS 0x2030 -#define ET_RXSTAT_POS_INDEX_MASK 0x00000FFF -#define ET_RXSTAT_POS_WRAP 0x00001000 - -#define ET_RXSTAT_MINCNT 0x2038 - -#define ET_RX_RING0_LO 0x203c -#define ET_RX_RING0_HI 0x2040 -#define ET_RX_RING0_CNT 0x2044 - -#define ET_RX_RING0_POS 0x204c -#define ET_RX_RING0_POS_INDEX_MASK 0x000003FF -#define ET_RX_RING0_POS_WRAP 0x00000400 - -#define ET_RX_RING0_MINCNT 0x2054 - -#define ET_RX_RING1_LO 0x2058 -#define ET_RX_RING1_HI 0x205c -#define ET_RX_RING1_CNT 0x2060 - -#define ET_RX_RING1_POS 0x2068 -#define ET_RX_RING1_POS_INDEX 0x000003FF -#define ET_RX_RING1_POS_WRAP 0x00000400 - -#define ET_RX_RING1_MINCNT 0x2070 - -#define ET_TXMAC_CTRL 0x3000 -#define ET_TXMAC_CTRL_ENABLE 0x00000001 -#define ET_TXMAC_CTRL_FC_DISABLE 0x00000008 - -#define ET_TXMAC_FLOWCTRL 0x3010 - -#define ET_RXMAC_CTRL 0x4000 -#define ET_RXMAC_CTRL_ENABLE 0x00000001 -#define ET_RXMAC_CTRL_NO_PKTFILT 0x00000004 -#define ET_RXMAC_CTRL_WOL_DISABLE 0x00000008 - -#define ET_WOL_CRC 0x4004 -#define ET_WOL_SA_LO 0x4010 -#define ET_WOL_SA_HI 0x4014 -#define ET_WOL_MASK 0x4018 - -#define ET_UCAST_FILTADDR1 0x4068 -#define ET_UCAST_FILTADDR2 0x406c -#define ET_UCAST_FILTADDR3 0x4070 - -#define ET_MULTI_HASH 0x4074 - -#define ET_PKTFILT 0x4084 -#define ET_PKTFILT_BCAST 0x00000001 -#define ET_PKTFILT_MCAST 0x00000002 -#define ET_PKTFILT_UCAST 0x00000004 -#define ET_PKTFILT_FRAG 0x00000008 -#define ET_PKTFILT_MINLEN_MASK 0x007F0000 -#define ET_PKTFILT_MINLEN_SHIFT 16 - -#define ET_RXMAC_MC_SEGSZ 0x4088 -#define ET_RXMAC_MC_SEGSZ_ENABLE 0x00000001 -#define ET_RXMAC_MC_SEGSZ_FC 0x00000002 -#define ET_RXMAC_MC_SEGSZ_MAX_MASK 0x000003FC -#define ET_RXMAC_SEGSZ(segsz) ((segsz) / ET_MEM_UNIT) -#define ET_RXMAC_CUT_THRU_FRMLEN 8074 - -#define ET_RXMAC_MC_WATERMARK 0x408c -#define ET_RXMAC_SPACE_AVL 0x4094 - -#define ET_RXMAC_MGT 0x4098 -#define ET_RXMAC_MGT_PASS_ECRC 0x00000010 -#define ET_RXMAC_MGT_PASS_ELEN 0x00000020 -#define ET_RXMAC_MGT_PASS_ETRUNC 0x00010000 -#define ET_RXMAC_MGT_CHECK_PKT 0x00020000 - -#define ET_MAC_CFG1 0x5000 -#define ET_MAC_CFG1_TXEN 0x00000001 -#define ET_MAC_CFG1_SYNC_TXEN 0x00000002 -#define ET_MAC_CFG1_RXEN 0x00000004 -#define ET_MAC_CFG1_SYNC_RXEN 0x00000008 -#define ET_MAC_CFG1_TXFLOW 0x00000010 -#define ET_MAC_CFG1_RXFLOW 0x00000020 -#define ET_MAC_CFG1_LOOPBACK 0x00000100 -#define ET_MAC_CFG1_RST_TXFUNC 0x00010000 -#define ET_MAC_CFG1_RST_RXFUNC 0x00020000 -#define ET_MAC_CFG1_RST_TXMC 0x00040000 -#define ET_MAC_CFG1_RST_RXMC 0x00080000 -#define ET_MAC_CFG1_SIM_RST 0x40000000 -#define ET_MAC_CFG1_SOFT_RST 0x80000000 - -#define ET_MAC_CFG2 0x5004 -#define ET_MAC_CFG2_FDX 0x00000001 -#define ET_MAC_CFG2_CRC 0x00000002 -#define ET_MAC_CFG2_PADCRC 0x00000004 -#define ET_MAC_CFG2_LENCHK 0x00000010 -#define ET_MAC_CFG2_BIGFRM 0x00000020 -#define ET_MAC_CFG2_MODE_MII 0x00000100 -#define ET_MAC_CFG2_MODE_GMII 0x00000200 -#define ET_MAC_CFG2_PREAMBLE_LEN_MASK 0x0000F000 -#define ET_MAC_CFG2_PREAMBLE_LEN_SHIFT 12 - -#define ET_IPG 0x5008 -#define ET_IPG_B2B_MASK 0x0000007F -#define ET_IPG_MINIFG_MASK 0x0000FF00 -#define ET_IPG_NONB2B_2_MASK 0x007F0000 -#define ET_IPG_NONB2B_1_MASK 0x7F000000 -#define ET_IPG_B2B_SHIFT 0 -#define ET_IPG_MINIFG_SHIFT 8 -#define ET_IPG_NONB2B_2_SHIFT 16 -#define ET_IPG_NONB2B_1_SHIFT 24 - -#define ET_MAC_HDX 0x500c -#define ET_MAC_HDX_COLLWIN_MASK 0x000003FF -#define ET_MAC_HDX_REXMIT_MAX_MASK 0x0000F000 -#define ET_MAC_HDX_EXC_DEFER 0x00010000 -#define ET_MAC_HDX_NOBACKOFF 0x00020000 -#define ET_MAC_HDX_BP_NOBACKOFF 0x00040000 -#define ET_MAC_HDX_ALT_BEB 0x00080000 -#define ET_MAC_HDX_ALT_BEB_TRUNC_MASK 0x00F00000 -#define ET_MAC_HDX_COLLWIN_SHIFT 0 -#define ET_MAC_HDX_REXMIT_MAX_SHIFT 12 -#define ET_MAC_HDX_ALT_BEB_TRUNC_SHIFT 20 - -#define ET_MAX_FRMLEN 0x5010 - -#define ET_MII_CFG 0x5020 -#define ET_MII_CFG_CLKRST 0x00000007 -#define ET_MII_CFG_PREAMBLE_SUP 0x00000010 -#define ET_MII_CFG_SCAN_AUTOINC 0x00000020 -#define ET_MII_CFG_RST 0x80000000 - -#define ET_MII_CMD 0x5024 -#define ET_MII_CMD_READ 0x00000001 - -#define ET_MII_ADDR 0x5028 -#define ET_MII_ADDR_REG_MASK 0x0000001F -#define ET_MII_ADDR_PHY_MASK 0x00001F00 -#define ET_MII_ADDR_REG_SHIFT 0 -#define ET_MII_ADDR_PHY_SHIFT 8 - -#define ET_MII_CTRL 0x502c -#define ET_MII_CTRL_VALUE_MASK 0x0000FFFF -#define ET_MII_CTRL_VALUE_SHIFT 0 - -#define ET_MII_STAT 0x5030 -#define ET_MII_STAT_VALUE_MASK 0x0000FFFF - -#define ET_MII_IND 0x5034 -#define ET_MII_IND_BUSY 0x00000001 -#define ET_MII_IND_INVALID 0x00000004 - -#define ET_MAC_CTRL 0x5038 -#define ET_MAC_CTRL_MODE_MII 0x01000000 -#define ET_MAC_CTRL_LHDX 0x02000000 -#define ET_MAC_CTRL_GHDX 0x04000000 +#define ET_TXQUEUE_START 0x0000 +#define ET_TXQUEUE_END 0x0004 +#define ET_RXQUEUE_START 0x0008 +#define ET_RXQUEUE_END 0x000C +#define ET_QUEUE_ADDR(addr) (((addr) / ET_MEM_UNIT) - 1) +#define ET_QUEUE_ADDR_START 0 +#define ET_QUEUE_ADDR_END ET_QUEUE_ADDR(ET_MEM_SIZE) + +#define ET_PM 0x0010 +#define EM_PM_GIGEPHY_ENB 0x00000001 +#define ET_PM_SYSCLK_GATE 0x00000008 +#define ET_PM_TXCLK_GATE 0x00000010 +#define ET_PM_RXCLK_GATE 0x00000020 +#define ET_PM_PHY_SW_COMA 0x00000040 + +#define ET_INTR_STATUS 0x0018 +#define ET_INTR_MASK 0x001C + +#define ET_SWRST 0x0028 +#define ET_SWRST_TXDMA 0x00000001 +#define ET_SWRST_RXDMA 0x00000002 +#define ET_SWRST_TXMAC 0x00000004 +#define ET_SWRST_RXMAC 0x00000008 +#define ET_SWRST_MAC 0x00000010 +#define ET_SWRST_MAC_STAT 0x00000020 +#define ET_SWRST_MMC 0x00000040 +#define ET_SWRST_SELFCLR_DISABLE 0x80000000 + +#define ET_MSI_CFG 0x0030 + +#define ET_LOOPBACK 0x0034 + +#define ET_TIMER 0x0038 + +#define ET_TXDMA_CTRL 0x1000 +#define ET_TXDMA_CTRL_HALT 0x00000001 +#define ET_TXDMA_CTRL_CACHE_THR_MASK 0x000000F0 +#define ET_TXDMA_CTRL_SINGLE_EPKT 0x00000100 /* ??? */ + +#define ET_TX_RING_HI 0x1004 +#define ET_TX_RING_LO 0x1008 +#define ET_TX_RING_CNT 0x100C + +#define ET_TX_STATUS_HI 0x101C +#define ET_TX_STATUS_LO 0x1020 + +#define ET_TX_READY_POS 0x1024 +#define ET_TX_READY_POS_INDEX_MASK 0x000003FF +#define ET_TX_READY_POS_WRAP 0x00000400 + +#define ET_TX_DONE_POS 0x1060 +#define ET_TX_DONE_POS_INDEX_MASK 0x0000003FF +#define ET_TX_DONE_POS_WRAP 0x000000400 + +#define ET_RXDMA_CTRL 0x2000 +#define ET_RXDMA_CTRL_HALT 0x00000001 +#define ET_RXDMA_CTRL_RING0_SIZE_MASK 0x00000300 +#define ET_RXDMA_CTRL_RING0_128 0x00000000 /* 127 */ +#define ET_RXDMA_CTRL_RING0_256 0x00000100 /* 255 */ +#define ET_RXDMA_CTRL_RING0_512 0x00000200 /* 511 */ +#define ET_RXDMA_CTRL_RING0_1024 0x00000300 /* 1023 */ +#define ET_RXDMA_CTRL_RING0_ENABLE 0x00000400 +#define ET_RXDMA_CTRL_RING1_SIZE_MASK 0x00001800 +#define ET_RXDMA_CTRL_RING1_2048 0x00000000 /* 2047 */ +#define ET_RXDMA_CTRL_RING1_4096 0x00000800 /* 4095 */ +#define ET_RXDMA_CTRL_RING1_8192 0x00001000 /* 8191 */ +#define ET_RXDMA_CTRL_RING1_16384 0x00001800 /* 16383 (9022?) */ +#define ET_RXDMA_CTRL_RING1_ENABLE 0x00002000 +#define ET_RXDMA_CTRL_HALTED 0x00020000 + +#define ET_RX_STATUS_LO 0x2004 +#define ET_RX_STATUS_HI 0x2008 + +#define ET_RX_INTR_NPKTS 0x200C +#define ET_RX_INTR_DELAY 0x2010 + +#define ET_RXSTAT_LO 0x2020 +#define ET_RXSTAT_HI 0x2024 +#define ET_RXSTAT_CNT 0x2028 + +#define ET_RXSTAT_POS 0x2030 +#define ET_RXSTAT_POS_INDEX_MASK 0x00000FFF +#define ET_RXSTAT_POS_WRAP 0x00001000 + +#define ET_RXSTAT_MINCNT 0x2038 + +#define ET_RX_RING0_LO 0x203C +#define ET_RX_RING0_HI 0x2040 +#define ET_RX_RING0_CNT 0x2044 + +#define ET_RX_RING0_POS 0x204C +#define ET_RX_RING0_POS_INDEX_MASK 0x000003FF +#define ET_RX_RING0_POS_WRAP 0x00000400 + +#define ET_RX_RING0_MINCNT 0x2054 + +#define ET_RX_RING1_LO 0x2058 +#define ET_RX_RING1_HI 0x205C +#define ET_RX_RING1_CNT 0x2060 + +#define ET_RX_RING1_POS 0x2068 +#define ET_RX_RING1_POS_INDEX 0x000003FF +#define ET_RX_RING1_POS_WRAP 0x00000400 + +#define ET_RX_RING1_MINCNT 0x2070 + +#define ET_TXMAC_CTRL 0x3000 +#define ET_TXMAC_CTRL_ENABLE 0x00000001 +#define ET_TXMAC_CTRL_FC_DISABLE 0x00000008 + +#define ET_TXMAC_FLOWCTRL 0x3010 +#define ET_TXMAC_FLOWCTRL_CFPT_MASK 0x0000FFFF +#define ET_TXMAC_FLOWCTRL_CFEP_MASK 0xFFFF0000 +#define ET_TXMAC_FLOWCTRL_CFPT_SHIFT 0 + +#define ET_TXMAC_BP_CTRL 0x3020 +#define ET_TXMAC_BP_CTRL_XONXOFF 0x00000001 +#define ET_TXMAC_BP_CTRL_REQ 0x00000002 + +#define ET_RXMAC_CTRL 0x4000 +#define ET_RXMAC_CTRL_ENABLE 0x00000001 +#define ET_RXMAC_CTRL_NO_PKTFILT 0x00000004 +#define ET_RXMAC_CTRL_WOL_DISABLE 0x00000008 + +#define ET_WOL_CRC 0x4004 +#define ET_WOL_SA_LO 0x4010 +#define ET_WOL_SA_HI 0x4014 +#define ET_WOL_MASK 0x4018 + +#define ET_UCAST_FILTADDR1 0x4068 +#define ET_UCAST_FILTADDR2 0x406C +#define ET_UCAST_FILTADDR3 0x4070 + +#define ET_MULTI_HASH 0x4074 + +#define ET_PKTFILT 0x4084 +#define ET_PKTFILT_BCAST 0x00000001 +#define ET_PKTFILT_MCAST 0x00000002 +#define ET_PKTFILT_UCAST 0x00000004 +#define ET_PKTFILT_FRAG 0x00000008 +#define ET_PKTFILT_MINLEN_MASK 0x007F0000 +#define ET_PKTFILT_MINLEN_SHIFT 16 + +#define ET_RXMAC_MC_SEGSZ 0x4088 +#define ET_RXMAC_MC_SEGSZ_ENABLE 0x00000001 +#define ET_RXMAC_MC_SEGSZ_FC 0x00000002 +#define ET_RXMAC_MC_SEGSZ_MAX_MASK 0x000003FC +#define ET_RXMAC_SEGSZ(segsz) ((segsz) / ET_MEM_UNIT) +#define ET_RXMAC_CUT_THRU_FRMLEN 8074 + +#define ET_RXMAC_MC_WATERMARK 0x408C +#define ET_RXMAC_SPACE_AVL 0x4094 + +#define ET_RXMAC_MGT 0x4098 +#define ET_RXMAC_MGT_PASS_ECRC 0x00000010 +#define ET_RXMAC_MGT_PASS_ELEN 0x00000020 +#define ET_RXMAC_MGT_PASS_ETRUNC 0x00010000 +#define ET_RXMAC_MGT_CHECK_PKT 0x00020000 + +#define ET_MAC_CFG1 0x5000 +#define ET_MAC_CFG1_TXEN 0x00000001 +#define ET_MAC_CFG1_SYNC_TXEN 0x00000002 +#define ET_MAC_CFG1_RXEN 0x00000004 +#define ET_MAC_CFG1_SYNC_RXEN 0x00000008 +#define ET_MAC_CFG1_TXFLOW 0x00000010 +#define ET_MAC_CFG1_RXFLOW 0x00000020 +#define ET_MAC_CFG1_LOOPBACK 0x00000100 +#define ET_MAC_CFG1_RST_TXFUNC 0x00010000 +#define ET_MAC_CFG1_RST_RXFUNC 0x00020000 +#define ET_MAC_CFG1_RST_TXMC 0x00040000 +#define ET_MAC_CFG1_RST_RXMC 0x00080000 +#define ET_MAC_CFG1_SIM_RST 0x40000000 +#define ET_MAC_CFG1_SOFT_RST 0x80000000 + +#define ET_MAC_CFG2 0x5004 +#define ET_MAC_CFG2_FDX 0x00000001 +#define ET_MAC_CFG2_CRC 0x00000002 +#define ET_MAC_CFG2_PADCRC 0x00000004 +#define ET_MAC_CFG2_LENCHK 0x00000010 +#define ET_MAC_CFG2_BIGFRM 0x00000020 +#define ET_MAC_CFG2_MODE_MII 0x00000100 +#define ET_MAC_CFG2_MODE_GMII 0x00000200 +#define ET_MAC_CFG2_PREAMBLE_LEN_MASK 0x0000F000 +#define ET_MAC_CFG2_PREAMBLE_LEN_SHIFT 12 + +#define ET_IPG 0x5008 +#define ET_IPG_B2B_MASK 0x0000007F +#define ET_IPG_MINIFG_MASK 0x0000FF00 +#define ET_IPG_NONB2B_2_MASK 0x007F0000 +#define ET_IPG_NONB2B_1_MASK 0x7F000000 +#define ET_IPG_B2B_SHIFT 0 +#define ET_IPG_MINIFG_SHIFT 8 +#define ET_IPG_NONB2B_2_SHIFT 16 +#define ET_IPG_NONB2B_1_SHIFT 24 + +#define ET_MAC_HDX 0x500C +#define ET_MAC_HDX_COLLWIN_MASK 0x000003FF +#define ET_MAC_HDX_REXMIT_MAX_MASK 0x0000F000 +#define ET_MAC_HDX_EXC_DEFER 0x00010000 +#define ET_MAC_HDX_NOBACKOFF 0x00020000 +#define ET_MAC_HDX_BP_NOBACKOFF 0x00040000 +#define ET_MAC_HDX_ALT_BEB 0x00080000 +#define ET_MAC_HDX_ALT_BEB_TRUNC_MASK 0x00F00000 +#define ET_MAC_HDX_COLLWIN_SHIFT 0 +#define ET_MAC_HDX_REXMIT_MAX_SHIFT 12 +#define ET_MAC_HDX_ALT_BEB_TRUNC_SHIFT 20 + +#define ET_MAX_FRMLEN 0x5010 + +#define ET_MII_CFG 0x5020 +#define ET_MII_CFG_CLKRST 0x00000007 +#define ET_MII_CFG_PREAMBLE_SUP 0x00000010 +#define ET_MII_CFG_SCAN_AUTOINC 0x00000020 +#define ET_MII_CFG_RST 0x80000000 + +#define ET_MII_CMD 0x5024 +#define ET_MII_CMD_READ 0x00000001 + +#define ET_MII_ADDR 0x5028 +#define ET_MII_ADDR_REG_MASK 0x0000001F +#define ET_MII_ADDR_PHY_MASK 0x00001F00 +#define ET_MII_ADDR_REG_SHIFT 0 +#define ET_MII_ADDR_PHY_SHIFT 8 + +#define ET_MII_CTRL 0x502C +#define ET_MII_CTRL_VALUE_MASK 0x0000FFFF +#define ET_MII_CTRL_VALUE_SHIFT 0 + +#define ET_MII_STAT 0x5030 +#define ET_MII_STAT_VALUE_MASK 0x0000FFFF + +#define ET_MII_IND 0x5034 +#define ET_MII_IND_BUSY 0x00000001 +#define ET_MII_IND_INVALID 0x00000004 + +#define ET_MAC_CTRL 0x5038 +#define ET_MAC_CTRL_MODE_MII 0x01000000 +#define ET_MAC_CTRL_LHDX 0x02000000 +#define ET_MAC_CTRL_GHDX 0x04000000 -#define ET_MAC_ADDR1 0x5040 -#define ET_MAC_ADDR2 0x5044 +#define ET_MAC_ADDR1 0x5040 +#define ET_MAC_ADDR2 0x5044 /* MAC statistics counters. */ #define ET_STAT_PKTS_64 0x6080 @@ -364,48 +371,48 @@ #define ET_STAT_TX_UNDERSIZE 0x6128 #define ET_STAT_TX_FRAG 0x612C -#define ET_MMC_CTRL 0x7000 -#define ET_MMC_CTRL_ENABLE 0x00000001 -#define ET_MMC_CTRL_ARB_DISABLE 0x00000002 -#define ET_MMC_CTRL_RXMAC_DISABLE 0x00000004 -#define ET_MMC_CTRL_TXMAC_DISABLE 0x00000008 -#define ET_MMC_CTRL_TXDMA_DISABLE 0x00000010 -#define ET_MMC_CTRL_RXDMA_DISABLE 0x00000020 -#define ET_MMC_CTRL_FORCE_CE 0x00000040 +#define ET_MMC_CTRL 0x7000 +#define ET_MMC_CTRL_ENABLE 0x00000001 +#define ET_MMC_CTRL_ARB_DISABLE 0x00000002 +#define ET_MMC_CTRL_RXMAC_DISABLE 0x00000004 +#define ET_MMC_CTRL_TXMAC_DISABLE 0x00000008 +#define ET_MMC_CTRL_TXDMA_DISABLE 0x00000010 +#define ET_MMC_CTRL_RXDMA_DISABLE 0x00000020 +#define ET_MMC_CTRL_FORCE_CE 0x00000040 /* * Interrupts */ -#define ET_INTR_TXEOF 0x00000008 -#define ET_INTR_TXDMA_ERROR 0x00000010 -#define ET_INTR_RXEOF 0x00000020 -#define ET_INTR_RXRING0_LOW 0x00000040 -#define ET_INTR_RXRING1_LOW 0x00000080 -#define ET_INTR_RXSTAT_LOW 0x00000100 -#define ET_INTR_RXDMA_ERROR 0x00000200 -#define ET_INTR_TIMER 0x00004000 -#define ET_INTR_WOL 0x00008000 -#define ET_INTR_PHY 0x00010000 -#define ET_INTR_TXMAC 0x00020000 -#define ET_INTR_RXMAC 0x00040000 -#define ET_INTR_MAC_STATS 0x00080000 -#define ET_INTR_SLAVE_TO 0x00100000 - -#define ET_INTRS (ET_INTR_TXEOF | \ - ET_INTR_RXEOF | \ - ET_INTR_TIMER) +#define ET_INTR_TXDMA 0x00000008 +#define ET_INTR_TXDMA_ERROR 0x00000010 +#define ET_INTR_RXDMA 0x00000020 +#define ET_INTR_RXRING0_LOW 0x00000040 +#define ET_INTR_RXRING1_LOW 0x00000080 +#define ET_INTR_RXSTAT_LOW 0x00000100 +#define ET_INTR_RXDMA_ERROR 0x00000200 +#define ET_INTR_TIMER 0x00004000 +#define ET_INTR_WOL 0x00008000 +#define ET_INTR_PHY 0x00010000 +#define ET_INTR_TXMAC 0x00020000 +#define ET_INTR_RXMAC 0x00040000 +#define ET_INTR_MAC_STATS 0x00080000 +#define ET_INTR_SLAVE_TO 0x00100000 + +#define ET_INTRS \ + (ET_INTR_TXDMA | ET_INTR_RXDMA | ET_INTR_TIMER | \ + ET_INTR_TXDMA_ERROR | ET_INTR_RXDMA_ERROR) /* * RX ring position uses same layout */ -#define ET_RX_RING_POS_INDEX_MASK 0x000003FF -#define ET_RX_RING_POS_WRAP 0x00000400 +#define ET_RX_RING_POS_INDEX_MASK 0x000003FF +#define ET_RX_RING_POS_WRAP 0x00000400 /* * PCI IDs */ -#define PCI_VENDOR_LUCENT 0x11c1 -#define PCI_PRODUCT_LUCENT_ET1310 0xed00 /* ET1310 10/100/1000M Ethernet */ -#define PCI_PRODUCT_LUCENT_ET1310_FAST 0xed01 /* ET1310 10/100M Ethernet */ +#define PCI_VENDOR_LUCENT 0x11C1 +#define PCI_PRODUCT_LUCENT_ET1310 0xED00 /* ET1310 10/100/1000M Ethernet */ +#define PCI_PRODUCT_LUCENT_ET1310_FAST 0xED01 /* ET1310 10/100M Ethernet */ #endif /* !_IF_ETREG_H */ Modified: stable/7/sys/dev/et/if_etvar.h ============================================================================== --- stable/7/sys/dev/et/if_etvar.h Fri Jan 6 21:45:08 2012 (r229737) +++ stable/7/sys/dev/et/if_etvar.h Fri Jan 6 21:46:35 2012 (r229738) @@ -38,39 +38,39 @@ #ifndef _IF_ETVAR_H #define _IF_ETVAR_H -#define ET_RING_ALIGN 4096 -#define ET_STATUS_ALIGN 8 -#define ET_NSEG_MAX 32 /* XXX no limit actually */ -#define ET_NSEG_SPARE 4 - -#define ET_TX_NDESC 512 -#define ET_RX_NDESC 512 -#define ET_RX_NRING 2 -#define ET_RX_NSTAT (ET_RX_NRING * ET_RX_NDESC) - -#define ET_TX_RING_SIZE (ET_TX_NDESC * sizeof(struct et_txdesc)) -#define ET_RX_RING_SIZE (ET_RX_NDESC * sizeof(struct et_rxdesc)) -#define ET_RXSTAT_RING_SIZE (ET_RX_NSTAT * sizeof(struct et_rxstat)) +#define ET_RING_ALIGN 4096 +#define ET_STATUS_ALIGN 8 +#define ET_NSEG_MAX 32 /* XXX no limit actually */ +#define ET_NSEG_SPARE 4 + +#define ET_TX_NDESC 512 +#define ET_RX_NDESC 512 +#define ET_RX_NRING 2 +#define ET_RX_NSTAT (ET_RX_NRING * ET_RX_NDESC) + +#define ET_TX_RING_SIZE (ET_TX_NDESC * sizeof(struct et_txdesc)) +#define ET_RX_RING_SIZE (ET_RX_NDESC * sizeof(struct et_rxdesc)) +#define ET_RXSTAT_RING_SIZE (ET_RX_NSTAT * sizeof(struct et_rxstat)) -#define ET_JUMBO_FRAMELEN (ET_MEM_SIZE - ET_MEM_RXSIZE_MIN - \ +#define ET_JUMBO_FRAMELEN (ET_MEM_SIZE - ET_MEM_RXSIZE_MIN - \ ET_MEM_TXSIZE_EX) -#define ET_JUMBO_MTU (ET_JUMBO_FRAMELEN - ETHER_HDR_LEN - \ +#define ET_JUMBO_MTU (ET_JUMBO_FRAMELEN - ETHER_HDR_LEN - \ EVL_ENCAPLEN - ETHER_CRC_LEN) -#define ET_FRAMELEN(mtu) (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + \ +#define ET_FRAMELEN(mtu) (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + \ (mtu) + ETHER_CRC_LEN) -#define ET_JSLOTS (ET_RX_NDESC + 128) -#define ET_JLEN (ET_JUMBO_FRAMELEN + ETHER_ALIGN) -#define ET_JUMBO_MEM_SIZE (ET_JSLOTS * ET_JLEN) +#define ET_JSLOTS (ET_RX_NDESC + 128) +#define ET_JLEN (ET_JUMBO_FRAMELEN + ETHER_ALIGN) +#define ET_JUMBO_MEM_SIZE (ET_JSLOTS * ET_JLEN) -#define CSR_WRITE_4(sc, reg, val) \ +#define CSR_WRITE_4(sc, reg, val) \ bus_write_4((sc)->sc_mem_res, (reg), (val)) -#define CSR_READ_4(sc, reg) \ +#define CSR_READ_4(sc, reg) \ bus_read_4((sc)->sc_mem_res, (reg)) -#define ET_ADDR_HI(addr) ((uint64_t) (addr) >> 32) -#define ET_ADDR_LO(addr) ((uint64_t) (addr) & 0xffffffff) +#define ET_ADDR_HI(addr) ((uint64_t) (addr) >> 32) +#define ET_ADDR_LO(addr) ((uint64_t) (addr) & 0xffffffff) struct et_txdesc { uint32_t td_addr_hi; @@ -79,23 +79,23 @@ struct et_txdesc { uint32_t td_ctrl2; /* ET_TDCTRL2_ */ }; -#define ET_TDCTRL1_LEN_MASK 0x0000FFFF +#define ET_TDCTRL1_LEN_MASK 0x0000FFFF -#define ET_TDCTRL2_LAST_FRAG 0x00000001 -#define ET_TDCTRL2_FIRST_FRAG 0x00000002 -#define ET_TDCTRL2_INTR 0x00000004 -#define ET_TDCTRL2_CTRL_WORD 0x00000008 -#define ET_TDCTRL2_HDX_BACKP 0x00000010 -#define ET_TDCTRL2_XMIT_PAUSE 0x00000020 -#define ET_TDCTRL2_FRAME_ERR 0x00000040 -#define ET_TDCTRL2_NO_CRC 0x00000080 -#define ET_TDCTRL2_MAC_OVRRD 0x00000100 -#define ET_TDCTRL2_PAD_PACKET 0x00000200 -#define ET_TDCTRL2_JUMBO_PACKET 0x00000400 -#define ET_TDCTRL2_INS_VLAN 0x00000800 -#define ET_TDCTRL2_CSUM_IP 0x00001000 -#define ET_TDCTRL2_CSUM_TCP 0x00002000 -#define ET_TDCTRL2_CSUM_UDP 0x00004000 +#define ET_TDCTRL2_LAST_FRAG 0x00000001 +#define ET_TDCTRL2_FIRST_FRAG 0x00000002 +#define ET_TDCTRL2_INTR 0x00000004 +#define ET_TDCTRL2_CTRL_WORD 0x00000008 +#define ET_TDCTRL2_HDX_BACKP 0x00000010 +#define ET_TDCTRL2_XMIT_PAUSE 0x00000020 +#define ET_TDCTRL2_FRAME_ERR 0x00000040 +#define ET_TDCTRL2_NO_CRC 0x00000080 +#define ET_TDCTRL2_MAC_OVRRD 0x00000100 +#define ET_TDCTRL2_PAD_PACKET 0x00000200 +#define ET_TDCTRL2_JUMBO_PACKET 0x00000400 +#define ET_TDCTRL2_INS_VLAN 0x00000800 +#define ET_TDCTRL2_CSUM_IP 0x00001000 +#define ET_TDCTRL2_CSUM_TCP 0x00002000 +#define ET_TDCTRL2_CSUM_UDP 0x00004000 struct et_rxdesc { uint32_t rd_addr_lo; @@ -103,56 +103,56 @@ struct et_rxdesc { uint32_t rd_ctrl; /* ET_RDCTRL_ */ }; -#define ET_RDCTRL_BUFIDX_MASK 0x000003FF +#define ET_RDCTRL_BUFIDX_MASK 0x000003FF struct et_rxstat { uint32_t rxst_info1; uint32_t rxst_info2; /* ET_RXST_INFO2_ */ }; -#define ET_RXST_INFO1_HASH_PASS 0x00000001 -#define ET_RXST_INFO1_IPCSUM 0x00000002 -#define ET_RXST_INFO1_IPCSUM_OK 0x00000004 -#define ET_RXST_INFO1_TCPCSUM 0x00000008 -#define ET_RXST_INFO1_TCPCSUM_OK 0x00000010 -#define ET_RXST_INFO1_WOL 0x00000020 -#define ET_RXST_INFO1_RXMAC_ERR 0x00000040 -#define ET_RXST_INFO1_DROP 0x00000080 -#define ET_RXST_INFO1_FRAME_TRUNC 0x00000100 -#define ET_RXST_INFO1_JUMBO 0x00000200 -#define ET_RXST_INFO1_VLAN 0x00000400 -#define ET_RXST_INFO1_PREV_FRMAE_DROP 0x00010000 -#define ET_RXST_INFO1_SHORT 0x00020000 -#define ET_RXST_INFO1_BAD_CARRIER 0x00040000 -#define ET_RXST_INFO1_CODE_ERR 0x00080000 -#define ET_RXST_INFO1_CRC_ERR 0x00100000 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 22:15:59 2012 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 377131065670; Fri, 6 Jan 2012 22:15:59 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 258588FC13; Fri, 6 Jan 2012 22:15: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 q06MFxAI010855; Fri, 6 Jan 2012 22:15:59 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06MFxkV010853; Fri, 6 Jan 2012 22:15:59 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201062215.q06MFxkV010853@svn.freebsd.org> From: Dimitry Andric Date: Fri, 6 Jan 2012 22:15:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229739 - stable/9/sys/compat/ndis 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, 06 Jan 2012 22:15:59 -0000 Author: dim Date: Fri Jan 6 22:15:58 2012 New Revision: 229739 URL: http://svn.freebsd.org/changeset/base/229739 Log: MFC r229004: In sys/compat/ndis/subr_ntoskrnl.c, change the RtlFillMemory function definition from K&R to ANSI, to avoid a clang warning about the uint8_t parameter being promoted to int, which is not compatible with the type declared in the earlier prototype. Modified: stable/9/sys/compat/ndis/subr_ntoskrnl.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/compat/ndis/subr_ntoskrnl.c ============================================================================== --- stable/9/sys/compat/ndis/subr_ntoskrnl.c Fri Jan 6 21:46:35 2012 (r229738) +++ stable/9/sys/compat/ndis/subr_ntoskrnl.c Fri Jan 6 22:15:58 2012 (r229739) @@ -3016,10 +3016,7 @@ RtlSecureZeroMemory(dst, len) } static void -RtlFillMemory(dst, len, c) - void *dst; - size_t len; - uint8_t c; +RtlFillMemory(void *dst, size_t len, uint8_t c) { memset(dst, c, len); } From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 22:18:14 2012 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 29B08106575D; Fri, 6 Jan 2012 22:18:14 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 17B828FC19; Fri, 6 Jan 2012 22:18: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 q06MIDbL010978; Fri, 6 Jan 2012 22:18:13 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06MIDGe010975; Fri, 6 Jan 2012 22:18:13 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201062218.q06MIDGe010975@svn.freebsd.org> From: Dimitry Andric Date: Fri, 6 Jan 2012 22:18:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229740 - in stable/9/sys/dev/ath/ath_hal: ar5212 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: Fri, 06 Jan 2012 22:18:14 -0000 Author: dim Date: Fri Jan 6 22:18:13 2012 New Revision: 229740 URL: http://svn.freebsd.org/changeset/base/229740 Log: MFC r228817: Use the correct types when calling the decompression mask function. There's currently no public code which uses this feature and the current reference driver doesn't enable this feature at all. It's possible it was used by a previous version of the driver and that indeed it should return HAL_STATUS; but at this point I'm happy to require that they complain and submit a patch. This was found by LLVM compile-time type checking. Modified: stable/9/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c stable/9/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c ============================================================================== --- stable/9/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c Fri Jan 6 22:15:58 2012 (r229739) +++ stable/9/sys/dev/ath/ath_hal/ar5212/ar5212_misc.c Fri Jan 6 22:18:13 2012 (r229740) @@ -573,7 +573,7 @@ ar5212SetDecompMask(struct ath_hal *ah, struct ath_hal_5212 *ahp = AH5212(ah); if (keyidx >= HAL_DECOMP_MASK_SIZE) - return HAL_EINVAL; + return AH_FALSE; OS_REG_WRITE(ah, AR_DCM_A, keyidx); OS_REG_WRITE(ah, AR_DCM_D, en ? AR_DCM_D_EN : 0); ahp->ah_decompMask[keyidx] = en; Modified: stable/9/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c ============================================================================== --- stable/9/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Fri Jan 6 22:15:58 2012 (r229739) +++ stable/9/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Fri Jan 6 22:18:13 2012 (r229740) @@ -155,7 +155,7 @@ ar5416SetAntennaSwitch(struct ath_hal *a HAL_BOOL ar5416SetDecompMask(struct ath_hal *ah, uint16_t keyidx, int en) { - return HAL_OK; + return AH_TRUE; } /* Setup coverage class */ From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 22:54:04 2012 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 0EDC71065675; Fri, 6 Jan 2012 22:54:04 +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 D89B08FC15; Fri, 6 Jan 2012 22:54:03 +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 q06Ms3w7012104; Fri, 6 Jan 2012 22:54:03 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06Ms3jf012102; Fri, 6 Jan 2012 22:54:03 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201201062254.q06Ms3jf012102@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 6 Jan 2012 22:54:03 +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: r229741 - stable/8/sys/dev/usb/controller 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, 06 Jan 2012 22:54:04 -0000 Author: hselasky Date: Fri Jan 6 22:54:03 2012 New Revision: 229741 URL: http://svn.freebsd.org/changeset/base/229741 Log: Fix build of ehci_mbus.c by applying patches similar to ones in r228483. This file was missed by a recent MFC because the file is named differently in 10-current. Pointy hat: hselasky @ Reported by: jhb Modified: stable/8/sys/dev/usb/controller/ehci_mbus.c Modified: stable/8/sys/dev/usb/controller/ehci_mbus.c ============================================================================== --- stable/8/sys/dev/usb/controller/ehci_mbus.c Fri Jan 6 22:18:13 2012 (r229740) +++ stable/8/sys/dev/usb/controller/ehci_mbus.c Fri Jan 6 22:54:03 2012 (r229741) @@ -78,9 +78,6 @@ __FBSDID("$FreeBSD$"); static device_attach_t ehci_mbus_attach; static device_detach_t ehci_mbus_detach; -static device_shutdown_t ehci_mbus_shutdown; -static device_suspend_t ehci_mbus_suspend; -static device_resume_t ehci_mbus_resume; static int err_intr(void *arg); @@ -99,45 +96,6 @@ static void *ih_err; #define MV_USB_DEVICE_UNDERFLOW (1 << 3) static int -ehci_mbus_suspend(device_t self) -{ - ehci_softc_t *sc = device_get_softc(self); - int err; - - err = bus_generic_suspend(self); - if (err) - return (err); - ehci_suspend(sc); - return (0); -} - -static int -ehci_mbus_resume(device_t self) -{ - ehci_softc_t *sc = device_get_softc(self); - - ehci_resume(sc); - - bus_generic_resume(self); - - return (0); -} - -static int -ehci_mbus_shutdown(device_t self) -{ - ehci_softc_t *sc = device_get_softc(self); - int err; - - err = bus_generic_shutdown(self); - if (err) - return (err); - ehci_shutdown(sc); - - return (0); -} - -static int ehci_mbus_probe(device_t self) { @@ -361,20 +319,17 @@ static device_method_t ehci_methods[] = DEVMETHOD(device_probe, ehci_mbus_probe), DEVMETHOD(device_attach, ehci_mbus_attach), DEVMETHOD(device_detach, ehci_mbus_detach), - DEVMETHOD(device_suspend, ehci_mbus_suspend), - DEVMETHOD(device_resume, ehci_mbus_resume), - DEVMETHOD(device_shutdown, ehci_mbus_shutdown), - - /* Bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + DEVMETHOD(device_shutdown, bus_generic_shutdown), - {0, 0} + DEVMETHOD_END }; static driver_t ehci_driver = { - "ehci", - ehci_methods, - sizeof(ehci_softc_t), + .name = "ehci", + .methods = ehci_methods, + .size = sizeof(ehci_softc_t), }; static devclass_t ehci_devclass; From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 23:20:33 2012 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 EB5A71065672; Fri, 6 Jan 2012 23:20:33 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D9EE88FC08; Fri, 6 Jan 2012 23:20:33 +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 q06NKXbb013021; Fri, 6 Jan 2012 23:20:33 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06NKXcL013019; Fri, 6 Jan 2012 23:20:33 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201201062320.q06NKXcL013019@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 6 Jan 2012 23:20: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: r229742 - head/tools/regression/bin/sh/builtins 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, 06 Jan 2012 23:20:34 -0000 Author: jilles Date: Fri Jan 6 23:20:33 2012 New Revision: 229742 URL: http://svn.freebsd.org/changeset/base/229742 Log: sh: Avoid possible echo options in a testcase. Modified: head/tools/regression/bin/sh/builtins/getopts1.0 Modified: head/tools/regression/bin/sh/builtins/getopts1.0 ============================================================================== --- head/tools/regression/bin/sh/builtins/getopts1.0 Fri Jan 6 22:54:03 2012 (r229741) +++ head/tools/regression/bin/sh/builtins/getopts1.0 Fri Jan 6 23:20:33 2012 (r229742) @@ -1,6 +1,6 @@ # $FreeBSD$ -echo '-1-' +printf -- '-1-\n' set -- -abc getopts "ab:" OPTION echo ${OPTION} @@ -11,7 +11,7 @@ echo ${OPTION} # ksh93 20090505; pdksh 5.2.14p2; mksh R39c; bash 4.1 PL7; and zsh 4.3.10. # all recognize that "b" is missing its argument on the *first* iteration # of 'getopts' and do not produce the "a" in $OPTION. -echo '-2-' +printf -- '-2-\n' set -- -ab getopts "ab:" OPTION echo ${OPTION} @@ -19,7 +19,7 @@ getopts "ab:" OPTION echo ${OPTION} # The 'shift' is aimed at causing an error. -echo '-3-' +printf -- '-3-\n' shift 1 getopts "ab:" OPTION echo ${OPTION} From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 23:44:27 2012 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 F40D6106576C; Fri, 6 Jan 2012 23:44:26 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E2DB78FC0C; Fri, 6 Jan 2012 23:44: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 q06NiQCO013803; Fri, 6 Jan 2012 23:44:26 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06NiQi4013800; Fri, 6 Jan 2012 23:44:26 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201201062344.q06NiQi4013800@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Fri, 6 Jan 2012 23:44: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: r229744 - head/sbin/hastd 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, 06 Jan 2012 23:44:27 -0000 Author: pjd Date: Fri Jan 6 23:44:26 2012 New Revision: 229744 URL: http://svn.freebsd.org/changeset/base/229744 Log: fork(2) returns -1 on failure, not some random negative number. MFC after: 3 days Modified: head/sbin/hastd/primary.c head/sbin/hastd/secondary.c Modified: head/sbin/hastd/primary.c ============================================================================== --- head/sbin/hastd/primary.c Fri Jan 6 23:33:33 2012 (r229743) +++ head/sbin/hastd/primary.c Fri Jan 6 23:44:26 2012 (r229744) @@ -886,7 +886,7 @@ hastd_primary(struct hast_resource *res) } pid = fork(); - if (pid < 0) { + if (pid == -1) { /* TODO: There's no need for this to be fatal error. */ KEEP_ERRNO((void)pidfile_remove(pfh)); pjdlog_exit(EX_TEMPFAIL, "Unable to fork"); Modified: head/sbin/hastd/secondary.c ============================================================================== --- head/sbin/hastd/secondary.c Fri Jan 6 23:33:33 2012 (r229743) +++ head/sbin/hastd/secondary.c Fri Jan 6 23:44:26 2012 (r229744) @@ -401,7 +401,7 @@ hastd_secondary(struct hast_resource *re } pid = fork(); - if (pid < 0) { + if (pid == -1) { KEEP_ERRNO((void)pidfile_remove(pfh)); pjdlog_exit(EX_OSERR, "Unable to fork"); } From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 23:57:21 2012 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 84A74106566C; Fri, 6 Jan 2012 23:57:21 +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 72B228FC12; Fri, 6 Jan 2012 23:57: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 q06NvLd3014277; Fri, 6 Jan 2012 23:57:21 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06NvL4a014274; Fri, 6 Jan 2012 23:57:21 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201062357.q06NvL4a014274@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 6 Jan 2012 23:57:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229745 - stable/9/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, 06 Jan 2012 23:57:21 -0000 Author: yongari Date: Fri Jan 6 23:57:21 2012 New Revision: 229745 URL: http://svn.freebsd.org/changeset/base/229745 Log: MFC r228370: After r228293, et(4) supports altq(4). Modified: stable/9/share/man/man4/altq.4 stable/9/share/man/man4/et.4 Directory Properties: stable/9/share/man/man4/ (props changed) Modified: stable/9/share/man/man4/altq.4 ============================================================================== --- stable/9/share/man/man4/altq.4 Fri Jan 6 23:44:26 2012 (r229744) +++ stable/9/share/man/man4/altq.4 Fri Jan 6 23:57:21 2012 (r229745) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 8, 2011 +.Dd December 9, 2011 .Dt ALTQ 4 .Os .Sh NAME @@ -134,6 +134,7 @@ They have been applied to the following .Xr em 4 , .Xr ep 4 , .Xr epair 4 , +.Xr et 4 , .Xr fxp 4 , .Xr gem 4 , .Xr hme 4 , Modified: stable/9/share/man/man4/et.4 ============================================================================== --- stable/9/share/man/man4/et.4 Fri Jan 6 23:44:26 2012 (r229744) +++ stable/9/share/man/man4/et.4 Fri Jan 6 23:57:21 2012 (r229745) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 25, 2010 +.Dd December 9, 2011 .Dt ET 4 .Os .Sh NAME @@ -156,6 +156,7 @@ to achieve TX interrupt moderation. The default value is 1000000000 (nanoseconds). .El .Sh SEE ALSO +.Xr altq 4 , .Xr arp 4 , .Xr miibus 4 , .Xr netintro 4 , From owner-svn-src-all@FreeBSD.ORG Fri Jan 6 23:59:25 2012 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 C97F81065670; Fri, 6 Jan 2012 23:59:25 +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 B79418FC13; Fri, 6 Jan 2012 23:59:25 +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 q06NxPrB014386; Fri, 6 Jan 2012 23:59:25 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q06NxPFP014383; Fri, 6 Jan 2012 23:59:25 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201062359.q06NxPFP014383@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 6 Jan 2012 23:59:25 +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: r229746 - 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, 06 Jan 2012 23:59:25 -0000 Author: yongari Date: Fri Jan 6 23:59:25 2012 New Revision: 229746 URL: http://svn.freebsd.org/changeset/base/229746 Log: MFC r215835,228370: r215835: Add a HARDWARE section. r228370: After r228293, et(4) supports altq(4). Modified: stable/8/share/man/man4/altq.4 stable/8/share/man/man4/et.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/altq.4 ============================================================================== --- stable/8/share/man/man4/altq.4 Fri Jan 6 23:57:21 2012 (r229745) +++ stable/8/share/man/man4/altq.4 Fri Jan 6 23:59:25 2012 (r229746) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 8, 2011 +.Dd December 9, 2011 .Dt ALTQ 4 .Os .Sh NAME @@ -134,6 +134,7 @@ They have been applied to the following .Xr em 4 , .Xr ep 4 , .Xr epair 4 , +.Xr et 4 , .Xr fxp 4 , .Xr gem 4 , .Xr hme 4 , Modified: stable/8/share/man/man4/et.4 ============================================================================== --- stable/8/share/man/man4/et.4 Fri Jan 6 23:57:21 2012 (r229745) +++ stable/8/share/man/man4/et.4 Fri Jan 6 23:59:25 2012 (r229746) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 14, 2008 +.Dd December 9, 2011 .Dt ET 4 .Os .Sh NAME @@ -122,6 +122,11 @@ Note that the 1000baseT media type is on if it is supported by the adapter. For more information on configuring this device, see .Xr ifconfig 8 . +.Sh HARDWARE +The +.Nm +driver supports Agere ET1310 10/100/Gigabit +Ethernet adapters. .Sh TUNABLES .Bl -tag -width ".Va hw.et.rx_intr_npkts" .It Va hw.et.rx_intr_npkts @@ -151,6 +156,7 @@ to achieve TX interrupt moderation. The default value is 1000000000 (nanoseconds). .El .Sh SEE ALSO +.Xr altq 4 , .Xr arp 4 , .Xr miibus 4 , .Xr netintro 4 , From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 00:05:21 2012 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 073C21065675; Sat, 7 Jan 2012 00:05:21 +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 E01DB8FC0A; Sat, 7 Jan 2012 00:05:20 +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 q0705KEo014654; Sat, 7 Jan 2012 00:05:20 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0705KHf014650; Sat, 7 Jan 2012 00:05:20 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201070005.q0705KHf014650@svn.freebsd.org> From: Pyun YongHyeon Date: Sat, 7 Jan 2012 00:05:20 +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: r229747 - 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: Sat, 07 Jan 2012 00:05:21 -0000 Author: yongari Date: Sat Jan 7 00:05:20 2012 New Revision: 229747 URL: http://svn.freebsd.org/changeset/base/229747 Log: MFC r180509,181362,215835,228370: Belatedly add man page for et(4) and catch up with all changes. r180509: Manpage for the et(4) driver. r181362: Comment out information about Jumbo Frame support, it's not implemented yet. While here, fix a whitespace nit. r215835: Add a HARDWARE section. r228370: After r228293, et(4) supports altq(4). Added: stable/7/share/man/man4/et.4 - copied, changed from r180509, head/share/man/man4/et.4 Modified: stable/7/share/man/man4/Makefile stable/7/share/man/man4/altq.4 Directory Properties: stable/7/share/man/man4/ (props changed) Modified: stable/7/share/man/man4/Makefile ============================================================================== --- stable/7/share/man/man4/Makefile Fri Jan 6 23:59:25 2012 (r229746) +++ stable/7/share/man/man4/Makefile Sat Jan 7 00:05:20 2012 (r229747) @@ -85,6 +85,7 @@ MAN= aac.4 \ en.4 \ enc.4 \ esp.4 \ + et.4 \ exca.4 \ faith.4 \ fatm.4 \ @@ -469,6 +470,7 @@ MLINKS+=edsc.4 if_edsc.4 MLINKS+=ef.4 if_ef.4 MLINKS+=em.4 if_em.4 MLINKS+=en.4 if_en.4 +MLINKS+=et.4 if_et.4 MLINKS+=faith.4 if_faith.4 MLINKS+=fatm.4 if_fatm.4 MLINKS+=fd.4 stderr.4 \ Modified: stable/7/share/man/man4/altq.4 ============================================================================== --- stable/7/share/man/man4/altq.4 Fri Jan 6 23:59:25 2012 (r229746) +++ stable/7/share/man/man4/altq.4 Sat Jan 7 00:05:20 2012 (r229747) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 8, 2011 +.Dd December 9, 2011 .Dt ALTQ 4 .Os .Sh NAME @@ -133,6 +133,7 @@ They have been applied to the following .Xr ed 4 , .Xr em 4 , .Xr ep 4 , +.Xr et 4 , .Xr fxp 4 , .Xr gem 4 , .Xr hme 4 , Copied and modified: stable/7/share/man/man4/et.4 (from r180509, head/share/man/man4/et.4) ============================================================================== --- head/share/man/man4/et.4 Mon Jul 14 18:15:43 2008 (r180509, copy source) +++ stable/7/share/man/man4/et.4 Sat Jan 7 00:05:20 2012 (r229747) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 14, 2008 +.Dd December 9, 2011 .Dt ET 4 .Os .Sh NAME @@ -54,14 +54,14 @@ if_et_load="YES" .Sh DESCRIPTION The .Nm -driver supports PCI Express Ethernet adapters based on the Agere ET1310 chip. -.Pp -Support for Jumbo Frames is provided via the interface MTU setting. -Selecting an MTU larger than 1500 bytes with the -.Xr ifconfig 8 -utility configures the adapter to receive and transmit Jumbo Frames. -The maximum MTU setting for Jumbo Frames is 15572. -This value coincides with the maximum Jumbo Frames size of 15594. +driver supports PCI Express Ethernet adapters based on the Agere ET1310 chip. +.\".Pp +.\"Support for Jumbo Frames is provided via the interface MTU setting. +.\"Selecting an MTU larger than 1500 bytes with the +.\".Xr ifconfig 8 +.\"utility configures the adapter to receive and transmit Jumbo Frames. +.\"The maximum MTU setting for Jumbo Frames is 15572. +.\"This value coincides with the maximum Jumbo Frames size of 15594. .Pp The .Nm @@ -122,6 +122,11 @@ Note that the 1000baseT media type is on if it is supported by the adapter. For more information on configuring this device, see .Xr ifconfig 8 . +.Sh HARDWARE +The +.Nm +driver supports Agere ET1310 10/100/Gigabit +Ethernet adapters. .Sh TUNABLES .Bl -tag -width ".Va hw.et.rx_intr_npkts" .It Va hw.et.rx_intr_npkts @@ -151,6 +156,7 @@ to achieve TX interrupt moderation. The default value is 1000000000 (nanoseconds). .El .Sh SEE ALSO +.Xr altq 4 , .Xr arp 4 , .Xr miibus 4 , .Xr netintro 4 , From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 00:07:24 2012 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 013DD106564A; Sat, 7 Jan 2012 00:07:24 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E37E08FC08; Sat, 7 Jan 2012 00:07: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 q0707Nil014746; Sat, 7 Jan 2012 00:07:23 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0707N9L014744; Sat, 7 Jan 2012 00:07:23 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <201201070007.q0707N9L014744@svn.freebsd.org> From: Ken Smith Date: Sat, 7 Jan 2012 00:07:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229748 - stable/9/usr.sbin/pkg_install/add 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, 07 Jan 2012 00:07:24 -0000 Author: kensmith Date: Sat Jan 7 00:07:23 2012 New Revision: 229748 URL: http://svn.freebsd.org/changeset/base/229748 Log: MFC the rest of r225757 that applies to the package set directories. Modified: stable/9/usr.sbin/pkg_install/add/main.c Modified: stable/9/usr.sbin/pkg_install/add/main.c ============================================================================== --- stable/9/usr.sbin/pkg_install/add/main.c Sat Jan 7 00:05:20 2012 (r229747) +++ stable/9/usr.sbin/pkg_install/add/main.c Sat Jan 7 00:07:23 2012 (r229748) @@ -95,7 +95,8 @@ struct { { 600100, 699000, "/packages-6-stable" }, { 700100, 799000, "/packages-7-stable" }, { 800500, 899000, "/packages-8-stable" }, - { 900000, 999000, "/packages-9-current" }, + { 900500, 999000, "/packages-9-stable" }, + { 1000500, 1099000, "/packages-10-current" }, { 0, 9999999, "/packages-current" }, { 0, 0, NULL } }; From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 00:11:36 2012 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 C3A8C106567C; Sat, 7 Jan 2012 00:11:36 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B2D728FC13; Sat, 7 Jan 2012 00:11:36 +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 q070BaAw014994; Sat, 7 Jan 2012 00:11:36 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q070Banb014992; Sat, 7 Jan 2012 00:11:36 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201070011.q070Banb014992@svn.freebsd.org> From: Eitan Adler Date: Sat, 7 Jan 2012 00:11: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: r229749 - 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: Sat, 07 Jan 2012 00:11:36 -0000 Author: eadler (ports committer) Date: Sat Jan 7 00:11:36 2012 New Revision: 229749 URL: http://svn.freebsd.org/changeset/base/229749 Log: - Fix sysctl description PR: 163623 Submitted by: Eugene Grosbein Approved by: bz Modified: head/sys/netinet/ip_icmp.c Modified: head/sys/netinet/ip_icmp.c ============================================================================== --- head/sys/netinet/ip_icmp.c Sat Jan 7 00:07:23 2012 (r229748) +++ head/sys/netinet/ip_icmp.c Sat Jan 7 00:11:36 2012 (r229749) @@ -89,7 +89,7 @@ static VNET_DEFINE(int, icmplim_output) #define V_icmplim_output VNET(icmplim_output) SYSCTL_VNET_INT(_net_inet_icmp, OID_AUTO, icmplim_output, CTLFLAG_RW, &VNET_NAME(icmplim_output), 0, - "Enable rate limiting of ICMP responses"); + "Enable logging of ICMP response rate limiting"); #ifdef INET VNET_DEFINE(struct icmpstat, icmpstat); From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 00:16:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id 7DD61106564A; Sat, 7 Jan 2012 00:16:15 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from 172-17-198-245.globalsuite.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 7B9B217A18A; Sat, 7 Jan 2012 00:16:05 +0000 (UTC) Message-ID: <4F078EC4.2090802@FreeBSD.org> Date: Fri, 06 Jan 2012 16:16:04 -0800 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:9.0) Gecko/20111222 Thunderbird/9.0 MIME-Version: 1.0 To: Guy Helmer References: <201201052248.q05MmaZk059871@svn.freebsd.org> <4F066340.9010507@FreeBSD.org> In-Reply-To: X-Enigmail-Version: undefined OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r229667 - head/usr.sbin/daemon 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, 07 Jan 2012 00:16:15 -0000 On 01/06/2012 08:18, Guy Helmer wrote: > On Jan 5, 2012, at 8:58 PM, Doug Barton wrote: > >> On 01/05/2012 14:48, Guy Helmer wrote: >>> Allow daemon(8) to run pidfile_open() before relenquishing >>> privileges so pid files can be written in /var/run when started >>> as root. >> >> I'm not sure how useful this is since when daemon is exiting it >> won't be able to remove the pid file (unless I'm missing >> something). >> >> Isn't it better to pre-create the pid file with the proper >> permissions for the unprivileged user? >> > > Would it be OK for daemon to hang around and wait for the child > process to exit, then remove the pid file? Without having given it any kind of careful thought, that sounds Ok ... but I don't understand how daemon could remove a pid file written as root after it's already dropped privileges. (IOW that's the same problem I was bringing up.) > The only other alternative I see would be to create a subdirectory > that is writable by the user so the child can create and delete the > pid file. That's functionally equivalent to pre-creating the pid file with the right permissions, so it would be Ok. Various ports use each of these approaches. I'm generally in favor of using the pid file only solution since rc.d/cleanvar will clean all that stuff up at boot, and it's preferable to not leave stale directories around for stuff that is no longer running and/or installed. Doug -- You can observe a lot just by watching. -- Yogi Berra Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 00:33:13 2012 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 D7BF31065676; Sat, 7 Jan 2012 00:33:13 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C5E378FC08; Sat, 7 Jan 2012 00:33: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 q070XDOq015879; Sat, 7 Jan 2012 00:33:13 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q070XDOa015877; Sat, 7 Jan 2012 00:33:13 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <201201070033.q070XDOa015877@svn.freebsd.org> From: Ken Smith Date: Sat, 7 Jan 2012 00:33:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229751 - stable/9/usr.sbin/pkg_install/add 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, 07 Jan 2012 00:33:14 -0000 Author: kensmith Date: Sat Jan 7 00:33:13 2012 New Revision: 229751 URL: http://svn.freebsd.org/changeset/base/229751 Log: When copying/pasting a line to create a line you want to add make sure to change all pieces of it, not just some of them. Submitted by: A helpful soul on IRC Pointy hat: me Modified: stable/9/usr.sbin/pkg_install/add/main.c Modified: stable/9/usr.sbin/pkg_install/add/main.c ============================================================================== --- stable/9/usr.sbin/pkg_install/add/main.c Sat Jan 7 00:15:02 2012 (r229750) +++ stable/9/usr.sbin/pkg_install/add/main.c Sat Jan 7 00:33:13 2012 (r229751) @@ -96,7 +96,7 @@ struct { { 700100, 799000, "/packages-7-stable" }, { 800500, 899000, "/packages-8-stable" }, { 900500, 999000, "/packages-9-stable" }, - { 1000500, 1099000, "/packages-10-current" }, + { 1000000, 1099000, "/packages-10-current" }, { 0, 9999999, "/packages-current" }, { 0, 0, NULL } }; From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 00:36:18 2012 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 44E08106566B; Sat, 7 Jan 2012 00:36:18 +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 31CE48FC0A; Sat, 7 Jan 2012 00:36:18 +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 q070aIHH016030; Sat, 7 Jan 2012 00:36:18 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q070aIui016027; Sat, 7 Jan 2012 00:36:18 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201201070036.q070aIui016027@svn.freebsd.org> From: Rick Macklem Date: Sat, 7 Jan 2012 00:36:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229752 - in stable/9/sys/fs: nfs nfsclient 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, 07 Jan 2012 00:36:18 -0000 Author: rmacklem Date: Sat Jan 7 00:36:17 2012 New Revision: 229752 URL: http://svn.freebsd.org/changeset/base/229752 Log: MFC: r228217 Post r223774, the NFSv4 client no longer has multiple instances of the same lock_owner4 string. As such, the handling of cleanup of lock_owners could be simplified. This simplification permitted the client to do a ReleaseLockOwner operation when the process that the lock_owner4 string represents, has exited. This permits the server to release any storage related to the lock_owner4 string before the associated open is closed. Without this change, it is possible to exhaust a server's storage when a long running process opens a file and then many child processes do locking on the file, because the open doesn't get closed. A similar patch was applied to the Linux NFSv4 client recently so that it wouldn't exhaust a server's storage. Modified: stable/9/sys/fs/nfs/nfsclstate.h stable/9/sys/fs/nfsclient/nfs_clstate.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) Modified: stable/9/sys/fs/nfs/nfsclstate.h ============================================================================== --- stable/9/sys/fs/nfs/nfsclstate.h Sat Jan 7 00:33:13 2012 (r229751) +++ stable/9/sys/fs/nfs/nfsclstate.h Sat Jan 7 00:36:17 2012 (r229752) @@ -34,6 +34,7 @@ */ LIST_HEAD(nfsclopenhead, nfsclopen); LIST_HEAD(nfscllockownerhead, nfscllockowner); +SLIST_HEAD(nfscllockownerfhhead, nfscllockownerfh); LIST_HEAD(nfscllockhead, nfscllock); LIST_HEAD(nfsclhead, nfsclclient); LIST_HEAD(nfsclownerhead, nfsclowner); @@ -149,8 +150,8 @@ struct nfscllockowner { struct nfsclopen *nfsl_open; NFSPROC_T *nfsl_inprog; nfsv4stateid_t nfsl_stateid; + int nfsl_lockflags; u_int32_t nfsl_seqid; - u_int32_t nfsl_defunct; struct nfsv4lock nfsl_rwlock; u_int8_t nfsl_owner[NFSV4CL_LOCKNAMELEN]; u_int8_t nfsl_openowner[NFSV4CL_LOCKNAMELEN]; @@ -166,6 +167,14 @@ struct nfscllock { short nfslo_type; }; +/* This structure is used to collect a list of lockowners to free up. */ +struct nfscllockownerfh { + SLIST_ENTRY(nfscllockownerfh) nfslfh_list; + struct nfscllockownerhead nfslfh_lock; + int nfslfh_len; + uint8_t nfslfh_fh[NFSX_V4FHMAX]; +}; + /* * Macro for incrementing the seqid#. */ Modified: stable/9/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- stable/9/sys/fs/nfsclient/nfs_clstate.c Sat Jan 7 00:33:13 2012 (r229751) +++ stable/9/sys/fs/nfsclient/nfs_clstate.c Sat Jan 7 00:36:17 2012 (r229752) @@ -143,6 +143,8 @@ static void nfscl_freeopenowner(struct n static void nfscl_cleandeleg(struct nfscldeleg *); static int nfscl_trydelegreturn(struct nfscldeleg *, struct ucred *, struct nfsmount *, NFSPROC_T *); +static void nfscl_emptylockowner(struct nfscllockowner *, + struct nfscllockownerfhhead *); static short nfscberr_null[] = { 0, @@ -1030,7 +1032,7 @@ nfscl_getbytelock(vnode_t vp, u_int64_t NFSBCOPY(op->nfso_own->nfsow_owner, nlp->nfsl_openowner, NFSV4CL_LOCKNAMELEN); nlp->nfsl_seqid = 0; - nlp->nfsl_defunct = 0; + nlp->nfsl_lockflags = flags; nlp->nfsl_inprog = NULL; nfscl_lockinit(&nlp->nfsl_rwlock); LIST_INIT(&nlp->nfsl_lock); @@ -1638,7 +1640,6 @@ static void nfscl_cleanup_common(struct nfsclclient *clp, u_int8_t *own) { struct nfsclowner *owp, *nowp; - struct nfsclopen *op; struct nfscllockowner *lp, *nlp; struct nfscldeleg *dp; @@ -1667,15 +1668,6 @@ nfscl_cleanup_common(struct nfsclclient nfscl_freeopenowner(owp, 0); else owp->nfsow_defunct = 1; - } else { - /* look for lockowners on other opens */ - LIST_FOREACH(op, &owp->nfsow_open, nfso_list) { - LIST_FOREACH(lp, &op->nfso_lock, nfsl_list) { - if (!NFSBCMP(lp->nfsl_owner, own, - NFSV4CL_LOCKNAMELEN)) - lp->nfsl_defunct = 1; - } - } } owp = nowp; } @@ -1685,13 +1677,21 @@ nfscl_cleanup_common(struct nfsclclient * Find open/lock owners for processes that have exited. */ static void -nfscl_cleanupkext(struct nfsclclient *clp) +nfscl_cleanupkext(struct nfsclclient *clp, struct nfscllockownerfhhead *lhp) { struct nfsclowner *owp, *nowp; + struct nfsclopen *op; + struct nfscllockowner *lp, *nlp; NFSPROCLISTLOCK(); NFSLOCKCLSTATE(); LIST_FOREACH_SAFE(owp, &clp->nfsc_owner, nfsow_list, nowp) { + LIST_FOREACH(op, &owp->nfsow_open, nfso_list) { + LIST_FOREACH_SAFE(lp, &op->nfso_lock, nfsl_list, nlp) { + if (LIST_EMPTY(&lp->nfsl_lock)) + nfscl_emptylockowner(lp, lhp); + } + } if (nfscl_procdoesntexist(owp->nfsow_owner)) nfscl_cleanup_common(clp, owp->nfsow_owner); } @@ -1699,6 +1699,58 @@ nfscl_cleanupkext(struct nfsclclient *cl NFSPROCLISTUNLOCK(); } +/* + * Take the empty lock owner and move it to the local lhp list if the + * associated process no longer exists. + */ +static void +nfscl_emptylockowner(struct nfscllockowner *lp, + struct nfscllockownerfhhead *lhp) +{ + struct nfscllockownerfh *lfhp, *mylfhp; + struct nfscllockowner *nlp; + int fnd_it; + + /* If not a Posix lock owner, just return. */ + if ((lp->nfsl_lockflags & F_POSIX) == 0) + return; + + fnd_it = 0; + mylfhp = NULL; + /* + * First, search to see if this lock owner is already in the list. + * If it is, then the associated process no longer exists. + */ + SLIST_FOREACH(lfhp, lhp, nfslfh_list) { + if (lfhp->nfslfh_len == lp->nfsl_open->nfso_fhlen && + !NFSBCMP(lfhp->nfslfh_fh, lp->nfsl_open->nfso_fh, + lfhp->nfslfh_len)) + mylfhp = lfhp; + LIST_FOREACH(nlp, &lfhp->nfslfh_lock, nfsl_list) + if (!NFSBCMP(nlp->nfsl_owner, lp->nfsl_owner, + NFSV4CL_LOCKNAMELEN)) + fnd_it = 1; + } + /* If not found, check if process still exists. */ + if (fnd_it == 0 && nfscl_procdoesntexist(lp->nfsl_owner) == 0) + return; + + /* Move the lock owner over to the local list. */ + if (mylfhp == NULL) { + mylfhp = malloc(sizeof(struct nfscllockownerfh), M_TEMP, + M_NOWAIT); + if (mylfhp == NULL) + return; + mylfhp->nfslfh_len = lp->nfsl_open->nfso_fhlen; + NFSBCOPY(lp->nfsl_open->nfso_fh, mylfhp->nfslfh_fh, + mylfhp->nfslfh_len); + LIST_INIT(&mylfhp->nfslfh_lock); + SLIST_INSERT_HEAD(lhp, mylfhp, nfslfh_list); + } + LIST_REMOVE(lp, nfsl_list); + LIST_INSERT_HEAD(&mylfhp->nfslfh_lock, lp, nfsl_list); +} + static int fake_global; /* Used to force visibility of MNTK_UNMOUNTF */ /* * Called from nfs umount to free up the clientid. @@ -2331,9 +2383,8 @@ nfscl_renewthread(struct nfsclclient *cl { struct nfsclowner *owp, *nowp; struct nfsclopen *op; - struct nfscllockowner *lp, *nlp, *olp; + struct nfscllockowner *lp, *nlp; struct nfscldeleghead dh; - struct nfscllockownerhead lh; struct nfscldeleg *dp, *ndp; struct ucred *cred; u_int32_t clidrev; @@ -2341,6 +2392,8 @@ nfscl_renewthread(struct nfsclclient *cl uint32_t recover_done_time = 0; struct timespec mytime; static time_t prevsec = 0; + struct nfscllockownerfh *lfhp, *nlfhp; + struct nfscllockownerfhhead lfh; cred = newnfs_getcred(); NFSLOCKCLSTATE(); @@ -2379,7 +2432,6 @@ nfscl_renewthread(struct nfsclclient *cl (void) nfscl_hasexpired(clp, clidrev, p); } - LIST_INIT(&lh); TAILQ_INIT(&dh); NFSLOCKCLSTATE(); if (cbpathdown) @@ -2389,41 +2441,11 @@ nfscl_renewthread(struct nfsclclient *cl /* * Now, handle defunct owners. */ - owp = LIST_FIRST(&clp->nfsc_owner); - while (owp != NULL) { - nowp = LIST_NEXT(owp, nfsow_list); - if (LIST_EMPTY(&owp->nfsow_open)) { - if (owp->nfsow_defunct) - nfscl_freeopenowner(owp, 0); - } else { - LIST_FOREACH(op, &owp->nfsow_open, nfso_list) { - lp = LIST_FIRST(&op->nfso_lock); - while (lp != NULL) { - nlp = LIST_NEXT(lp, nfsl_list); - if (lp->nfsl_defunct && - LIST_EMPTY(&lp->nfsl_lock)) { - LIST_FOREACH(olp, &lh, nfsl_list) { - if (!NFSBCMP(olp->nfsl_owner, - lp->nfsl_owner,NFSV4CL_LOCKNAMELEN)) - break; - } - if (olp == NULL) { - LIST_REMOVE(lp, nfsl_list); - LIST_INSERT_HEAD(&lh, lp, nfsl_list); - } else { - nfscl_freelockowner(lp, 0); - } - } - lp = nlp; - } + LIST_FOREACH_SAFE(owp, &clp->nfsc_owner, nfsow_list, nowp) { + if (LIST_EMPTY(&owp->nfsow_open)) { + if (owp->nfsow_defunct != 0) + nfscl_freeopenowner(owp, 0); } - } - owp = nowp; - } - - /* and release defunct lock owners */ - LIST_FOREACH_SAFE(lp, &lh, nfsl_list, nlp) { - nfscl_freelockowner(lp, 0); } /* @@ -2528,6 +2550,7 @@ tryagain: FREE((caddr_t)dp, M_NFSCLDELEG); } + SLIST_INIT(&lfh); /* * Call nfscl_cleanupkext() once per second to check for * open/lock owners where the process has exited. @@ -2535,8 +2558,26 @@ tryagain: NFSGETNANOTIME(&mytime); if (prevsec != mytime.tv_sec) { prevsec = mytime.tv_sec; - nfscl_cleanupkext(clp); + nfscl_cleanupkext(clp, &lfh); + } + + /* + * Do a ReleaseLockOwner for all lock owners where the + * associated process no longer exists, as found by + * nfscl_cleanupkext(). + */ + newnfs_setroot(cred); + SLIST_FOREACH_SAFE(lfhp, &lfh, nfslfh_list, nlfhp) { + LIST_FOREACH_SAFE(lp, &lfhp->nfslfh_lock, nfsl_list, + nlp) { + (void)nfsrpc_rellockown(clp->nfsc_nmp, lp, + lfhp->nfslfh_fh, lfhp->nfslfh_len, cred, + p); + nfscl_freelockowner(lp, 0); + } + free(lfhp, M_TEMP); } + SLIST_INIT(&lfh); NFSLOCKCLSTATE(); if ((clp->nfsc_flags & NFSCLFLAGS_RECOVER) == 0) @@ -3539,8 +3580,8 @@ nfscl_relock(vnode_t vp, struct nfsclcli off = lop->nfslo_first; len = lop->nfslo_end - lop->nfslo_first; error = nfscl_getbytelock(vp, off, len, lop->nfslo_type, cred, p, - clp, 1, NULL, 0, lp->nfsl_owner, lp->nfsl_openowner, &nlp, &newone, - &donelocally); + clp, 1, NULL, lp->nfsl_lockflags, lp->nfsl_owner, + lp->nfsl_openowner, &nlp, &newone, &donelocally); if (error || donelocally) return (error); if (nmp->nm_clp != NULL) From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 00:47:27 2012 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 B25F2106564A; Sat, 7 Jan 2012 00:47:27 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A18828FC18; Sat, 7 Jan 2012 00:47:27 +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 q070lR5H016398; Sat, 7 Jan 2012 00:47:27 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q070lRMO016396; Sat, 7 Jan 2012 00:47:27 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201070047.q070lRMO016396@svn.freebsd.org> From: Dimitry Andric Date: Sat, 7 Jan 2012 00:47:27 +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: r229753 - head/sys/contrib/rdma 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, 07 Jan 2012 00:47:27 -0000 Author: dim Date: Sat Jan 7 00:47:27 2012 New Revision: 229753 URL: http://svn.freebsd.org/changeset/base/229753 Log: In sys/contrib/rdma/ib_addr.h, bump MAX_ADDR_LEN to 20 bytes (the same value used in sys/ofed/include/linux/netdevice.h), so there will be no buffer overruns in the rest of the inline functions in this file. Reviewed by: kmacy MFC after: 1 week Modified: head/sys/contrib/rdma/ib_addr.h Modified: head/sys/contrib/rdma/ib_addr.h ============================================================================== --- head/sys/contrib/rdma/ib_addr.h Sat Jan 7 00:36:17 2012 (r229752) +++ head/sys/contrib/rdma/ib_addr.h Sat Jan 7 00:47:27 2012 (r229753) @@ -42,7 +42,7 @@ #include -#define MAX_ADDR_LEN ETHER_ADDR_LEN /* XXX doesn't support IB! */ +#define MAX_ADDR_LEN 20 struct rdma_addr_client { int refcount; From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 01:08:17 2012 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 EABCD1065670; Sat, 7 Jan 2012 01:08:17 +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 D8A458FC1A; Sat, 7 Jan 2012 01:08: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 q0718H7K017105; Sat, 7 Jan 2012 01:08:17 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0718HV7017102; Sat, 7 Jan 2012 01:08:17 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201070108.q0718HV7017102@svn.freebsd.org> From: Pyun YongHyeon Date: Sat, 7 Jan 2012 01:08:17 +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: r229754 - in stable/8/sys/dev: bce mxge 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, 07 Jan 2012 01:08:18 -0000 Author: yongari Date: Sat Jan 7 01:08:17 2012 New Revision: 229754 URL: http://svn.freebsd.org/changeset/base/229754 Log: MFC r207761: Belatedly merge r207761. For unknown reason r207761 was not fully merged (r208073) to stable/8 but mergeinfo was recorded. Add a fastpath to allocate from packet zone when using m_getjcl. This will add support for packet zone for at least igb and ixgbe and will avoid to check for that in bce and mxge. Modified: stable/8/sys/dev/bce/if_bce.c stable/8/sys/dev/mxge/if_mxge.c Modified: stable/8/sys/dev/bce/if_bce.c ============================================================================== --- stable/8/sys/dev/bce/if_bce.c Sat Jan 7 00:47:27 2012 (r229753) +++ stable/8/sys/dev/bce/if_bce.c Sat Jan 7 01:08:17 2012 (r229754) @@ -5017,11 +5017,8 @@ bce_get_rx_buf(struct bce_softc *sc, str #ifdef BCE_JUMBO_HDRSPLIT MGETHDR(m_new, M_DONTWAIT, MT_DATA); #else - if (sc->rx_bd_mbuf_alloc_size <= MCLBYTES) - m_new = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); - else - m_new = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, - sc->rx_bd_mbuf_alloc_size); + m_new = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, + sc->rx_bd_mbuf_alloc_size); #endif if (m_new == NULL) { Modified: stable/8/sys/dev/mxge/if_mxge.c ============================================================================== --- stable/8/sys/dev/mxge/if_mxge.c Sat Jan 7 00:47:27 2012 (r229753) +++ stable/8/sys/dev/mxge/if_mxge.c Sat Jan 7 01:08:17 2012 (r229754) @@ -2411,10 +2411,7 @@ mxge_get_buf_big(struct mxge_slice_state mxge_rx_ring_t *rx = &ss->rx_big; int cnt, err, i; - if (rx->cl_size == MCLBYTES) - m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); - else - m = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, rx->cl_size); + m = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, rx->cl_size); if (m == NULL) { rx->alloc_fail++; err = ENOBUFS; From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 01:12:22 2012 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 5C891106564A; Sat, 7 Jan 2012 01:12:22 +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 2FFBC8FC12; Sat, 7 Jan 2012 01:12: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 q071CMNm017283; Sat, 7 Jan 2012 01:12:22 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q071CMpu017279; Sat, 7 Jan 2012 01:12:22 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201201070112.q071CMpu017279@svn.freebsd.org> From: Pyun YongHyeon Date: Sat, 7 Jan 2012 01:12: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: r229755 - in stable/7/sys: dev/bce dev/mxge 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, 07 Jan 2012 01:12:22 -0000 Author: yongari Date: Sat Jan 7 01:12:21 2012 New Revision: 229755 URL: http://svn.freebsd.org/changeset/base/229755 Log: MFC r207761: Add a fastpath to allocate from packet zone when using m_getjcl. This will add support for packet zone for at least igb and ixgbe and will avoid to check for that in bce and mxge. Modified: stable/7/sys/dev/bce/if_bce.c stable/7/sys/dev/mxge/if_mxge.c stable/7/sys/sys/mbuf.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/bce/if_bce.c ============================================================================== --- stable/7/sys/dev/bce/if_bce.c Sat Jan 7 01:08:17 2012 (r229754) +++ stable/7/sys/dev/bce/if_bce.c Sat Jan 7 01:12:21 2012 (r229755) @@ -5017,11 +5017,8 @@ bce_get_rx_buf(struct bce_softc *sc, str #ifdef BCE_JUMBO_HDRSPLIT MGETHDR(m_new, M_DONTWAIT, MT_DATA); #else - if (sc->rx_bd_mbuf_alloc_size <= MCLBYTES) - m_new = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); - else - m_new = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, - sc->rx_bd_mbuf_alloc_size); + m_new = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, + sc->rx_bd_mbuf_alloc_size); #endif if (m_new == NULL) { Modified: stable/7/sys/dev/mxge/if_mxge.c ============================================================================== --- stable/7/sys/dev/mxge/if_mxge.c Sat Jan 7 01:08:17 2012 (r229754) +++ stable/7/sys/dev/mxge/if_mxge.c Sat Jan 7 01:12:21 2012 (r229755) @@ -2260,10 +2260,7 @@ mxge_get_buf_big(struct mxge_slice_state mxge_rx_ring_t *rx = &ss->rx_big; int cnt, err, i; - if (rx->cl_size == MCLBYTES) - m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); - else - m = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, rx->cl_size); + m = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, rx->cl_size); if (m == NULL) { rx->alloc_fail++; err = ENOBUFS; Modified: stable/7/sys/sys/mbuf.h ============================================================================== --- stable/7/sys/sys/mbuf.h Sat Jan 7 01:08:17 2012 (r229754) +++ stable/7/sys/sys/mbuf.h Sat Jan 7 01:12:21 2012 (r229755) @@ -484,6 +484,9 @@ m_getjcl(int how, short type, int flags, struct mbuf *m, *n; uma_zone_t zone; + if (size == MCLBYTES) + return m_getcl(how, type, flags); + args.flags = flags; args.type = type; From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 01:39:38 2012 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 F0CD1106564A; Sat, 7 Jan 2012 01:39:38 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DE92E8FC0A; Sat, 7 Jan 2012 01:39: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 q071dc6D018283; Sat, 7 Jan 2012 01:39:38 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q071dcsZ018280; Sat, 7 Jan 2012 01:39:38 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201201070139.q071dcsZ018280@svn.freebsd.org> From: Glen Barber Date: Sat, 7 Jan 2012 01:39:38 +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: r229756 - stable/7/usr.bin/du 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, 07 Jan 2012 01:39:39 -0000 Author: gjb (doc committer) Date: Sat Jan 7 01:39:38 2012 New Revision: 229756 URL: http://svn.freebsd.org/changeset/base/229756 Log: MFC r209362, r210933, r228356: r209362 (brian) [1]: - Add a -t switch for masking output that's above or below certain thresholds. This switch makes it a lot easier to locate problem areas when a process is threatening to consume all of your disk space. r210933 (joel): - Fix typos and spelling mistakes. r228356 [2]: - Update du(1): - Sort arguments alphabetically where appropriate - '-B blocksize' is not mutually exclusive of '-h|-k|-m' - Mention '-t' in synopsis - Other wording improvements - Update usage() output to reflect the new synopsis - Other miscellaneous improvements Approved by: brian [1] PR: 162438 [2] Modified: stable/7/usr.bin/du/du.1 stable/7/usr.bin/du/du.c Directory Properties: stable/7/usr.bin/du/ (props changed) Modified: stable/7/usr.bin/du/du.1 ============================================================================== --- stable/7/usr.bin/du/du.1 Sat Jan 7 01:12:21 2012 (r229755) +++ stable/7/usr.bin/du/du.1 Sat Jan 7 01:39:38 2012 (r229756) @@ -32,7 +32,7 @@ .\" @(#)du.1 8.2 (Berkeley) 4/1/94 .\" $FreeBSD$ .\" -.Dd November 6, 2008 +.Dd December 8, 2011 .Dt DU 1 .Os .Sh NAME @@ -40,15 +40,13 @@ .Nd display disk usage statistics .Sh SYNOPSIS .Nm -.Op Fl A +.Op Fl Aclnx .Op Fl H | L | P +.Op Fl h | k | m .Op Fl a | s | d Ar depth -.Op Fl c -.Op Fl l -.Op Fl h | k | m | B Ar blocksize -.Op Fl n -.Op Fl x +.Op Fl B Ar blocksize .Op Fl I Ar mask +.Op Fl t Ar threshold .Op Ar .Sh DESCRIPTION The @@ -69,10 +67,12 @@ Calculate block counts in .Ar blocksize byte blocks. This is different from the -.Fl k, m +.Fl h, k +and +.Fl m options or setting .Ev BLOCKSIZE -and gives an estimate of how much space the examined file hierachy would +and gives an estimate of how much space the examined file hierarchy would require on a filesystem with the given .Ar blocksize . Unless in @@ -83,40 +83,31 @@ is rounded up to the next multiple of 51 .It Fl H Symbolic links on the command line are followed, symbolic links in file hierarchies are not followed. -.It Fl L -Symbolic links on the command line and in file hierarchies are followed. .It Fl I Ar mask Ignore files and directories matching the specified .Ar mask . +.It Fl L +Symbolic links on the command line and in file hierarchies are followed. .It Fl P No symbolic links are followed. This is the default. .It Fl a Display an entry for each file in a file hierarchy. -.It Fl h -"Human-readable" output. -Use unit suffixes: Byte, Kilobyte, Megabyte, -Gigabyte, Terabyte and Petabyte. -.It Fl r -Generate messages about directories that cannot be read, files -that cannot be opened, and so on. -This is the default case. -This option exists solely for conformance with -.St -xpg4 . -.It Fl s -Display an entry for each specified file. -(Equivalent to -.Fl d Li 0 ) +.It Fl c +Display a grand total. .It Fl d Ar depth Display an entry for all files and directories .Ar depth directories deep. -.It Fl c -Display a grand total. +.It Fl h +.Dq Human-readable +output. +Use unit suffixes: Byte, Kilobyte, Megabyte, +Gigabyte, Terabyte and Petabyte. .It Fl k Display block counts in 1024-byte (1-Kbyte) blocks. .It Fl l -If a file has multiple hard links, count its size many times. +If a file has multiple hard links, count its size multiple times. The default behavior of .Nm is to count files with multiple hard links only once. @@ -132,6 +123,24 @@ Ignore files and directories with user flag .Pq Dv UF_NODUMP set. +.It Fl r +Generate messages about directories that cannot be read, files +that cannot be opened, and so on. +This is the default case. +This option exists solely for conformance with +.St -xpg4 . +.It Fl s +Display an entry for each specified file. +(Equivalent to +.Fl d Li 0 ) +.It Fl t Ar threshold +Display only entries for which size exceeds +.Ar threshold . +If +.Ar threshold +is negative, display only entries for which size is less than the absolute +value of +.Ar threshold . .It Fl x File system mount points are not traversed. .El @@ -148,25 +157,32 @@ If either the .Fl H or .Fl L -options are specified, storage used by any symbolic links which are -followed is not counted or displayed. +option is specified, storage used by any symbolic links which are +followed is not counted (or displayed). +.Pp +The +.Fl h, k +and +.Fl m +options all override each other; the last one specified determines +the block counts used. .Sh ENVIRONMENT .Bl -tag -width BLOCKSIZE .It Ev BLOCKSIZE If the environment variable .Ev BLOCKSIZE is set, and the -.Fl k, m +.Fl h, k or -.Fl h +.Fl m options are not specified, the block counts will be displayed in units of that block size. If .Ev BLOCKSIZE is not set, and the -.Fl k, m +.Fl h, k or -.Fl h +.Fl m options are not specified, the block counts will be displayed in 512-byte blocks. .El Modified: stable/7/usr.bin/du/du.c ============================================================================== --- stable/7/usr.bin/du/du.c Sat Jan 7 01:12:21 2012 (r229755) +++ stable/7/usr.bin/du/du.c Sat Jan 7 01:39:38 2012 (r229756) @@ -88,6 +88,7 @@ main(int argc, char *argv[]) FTS *fts; FTSENT *p; off_t savednumber, curblocks; + off_t threshold, threshold_sign; int ftsoptions; int listall; int depth; @@ -104,12 +105,14 @@ main(int argc, char *argv[]) save = argv; ftsoptions = 0; savednumber = 0; + threshold = 0; + threshold_sign = 1; cblocksize = DEV_BSIZE; blocksize = 0; depth = INT_MAX; SLIST_INIT(&ignores); - while ((ch = getopt(argc, argv, "AB:HI:LPasd:chklmnrx")) != -1) + while ((ch = getopt(argc, argv, "AB:HI:LPasd:chklmnrt:x")) != -1) switch (ch) { case 'A': Aflag = 1; @@ -177,6 +180,14 @@ main(int argc, char *argv[]) break; case 'r': /* Compatibility. */ break; + case 't' : + if (expand_number(optarg, &threshold) != 0 || + threshold == 0) { + warnx("invalid threshold: %s", optarg); + usage(); + } else if (threshold < 0) + threshold_sign = -1; + break; case 'x': ftsoptions |= FTS_XDEV; break; @@ -246,6 +257,10 @@ main(int argc, char *argv[]) blocksize /= DEV_BSIZE; } + if (threshold != 0) + threshold = howmany(threshold / DEV_BSIZE * cblocksize, + blocksize); + rval = 0; if ((fts = fts_open(argv, ftsoptions, NULL)) == NULL) @@ -267,7 +282,9 @@ main(int argc, char *argv[]) p->fts_parent->fts_bignum += p->fts_bignum += curblocks; - if (p->fts_level <= depth) { + if (p->fts_level <= depth && threshold <= + threshold_sign * howmany(p->fts_bignum * + cblocksize, blocksize)) { if (hflag) { prthumanval(p->fts_bignum); (void)printf("\t%s\n", p->fts_path); @@ -486,9 +503,9 @@ static void usage(void) { (void)fprintf(stderr, - "usage: du [-A] [-H | -L | -P] [-a | -s | -d depth] [-c] " - "[-l] [-h | -k | -m | -B bsize] [-n] [-x] [-I mask] " - "[file ...]\n"); + "usage: du [-Aclnx] [-H | -L | -P] [-h | -k | -m ] " + "[-a | -s | -d depth] [-B blocksize] [-I mask] " + "[-t threshold] [file ...]\n"); exit(EX_USAGE); } From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 02:03:07 2012 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 D1416106564A; Sat, 7 Jan 2012 02:03:07 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BFD788FC0C; Sat, 7 Jan 2012 02:03: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 q07237VY019301; Sat, 7 Jan 2012 02:03:07 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q07237dk019299; Sat, 7 Jan 2012 02:03:07 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201201070203.q07237dk019299@svn.freebsd.org> From: Glen Barber Date: Sat, 7 Jan 2012 02:03:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229757 - stable/9/share/man/man5 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, 07 Jan 2012 02:03:07 -0000 Author: gjb (doc committer) Date: Sat Jan 7 02:03:07 2012 New Revision: 229757 URL: http://svn.freebsd.org/changeset/base/229757 Log: MFC r228355: - As of r226865, daily_scrub_zfs_default_threshold is 35 days. PR: 162890 Modified: stable/9/share/man/man5/periodic.conf.5 Directory Properties: stable/9/share/man/man5/ (props changed) Modified: stable/9/share/man/man5/periodic.conf.5 ============================================================================== --- stable/9/share/man/man5/periodic.conf.5 Sat Jan 7 01:39:38 2012 (r229756) +++ stable/9/share/man/man5/periodic.conf.5 Sat Jan 7 02:03:07 2012 (r229757) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 15, 2010 +.Dd December 8, 2011 .Dt PERIODIC.CONF 5 .Os .Sh NAME @@ -631,7 +631,7 @@ If the list is empty or not set, all zfs .It Va daily_scrub_zfs_default_threshold .Pq Vt int Number of days between a scrub if no pool-specific threshold is set. -The default value if no value is set is 30. +If not set, the default value is 35, corresponding to 5 weeks. .It Va daily_scrub_zfs_ Ns Ao Ar poolname Ac Ns Va _threshold .Pq Vt int The same as From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 02:03:42 2012 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 75644106567C; Sat, 7 Jan 2012 02:03:42 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 642948FC1D; Sat, 7 Jan 2012 02:03:42 +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 q0723glM019375; Sat, 7 Jan 2012 02:03:42 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0723gUs019373; Sat, 7 Jan 2012 02:03:42 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201201070203.q0723gUs019373@svn.freebsd.org> From: Glen Barber Date: Sat, 7 Jan 2012 02:03:42 +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: r229758 - stable/8/share/man/man5 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, 07 Jan 2012 02:03:42 -0000 Author: gjb (doc committer) Date: Sat Jan 7 02:03:42 2012 New Revision: 229758 URL: http://svn.freebsd.org/changeset/base/229758 Log: MFC r228355: - As of r226865, daily_scrub_zfs_default_threshold is 35 days. PR: 162890 Modified: stable/8/share/man/man5/periodic.conf.5 Directory Properties: stable/8/share/man/man5/ (props changed) Modified: stable/8/share/man/man5/periodic.conf.5 ============================================================================== --- stable/8/share/man/man5/periodic.conf.5 Sat Jan 7 02:03:07 2012 (r229757) +++ stable/8/share/man/man5/periodic.conf.5 Sat Jan 7 02:03:42 2012 (r229758) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 15, 2010 +.Dd December 8, 2011 .Dt PERIODIC.CONF 5 .Os .Sh NAME @@ -631,7 +631,7 @@ If the list is empty or not set, all zfs .It Va daily_scrub_zfs_default_threshold .Pq Vt int Number of days between a scrub if no pool-specific threshold is set. -The default value if no value is set is 30. +If not set, the default value is 35, corresponding to 5 weeks. .It Va daily_scrub_zfs_ Ns Ao Ar poolname Ac Ns Va _threshold .Pq Vt int The same as From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 02:09:50 2012 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 153031065672; Sat, 7 Jan 2012 02:09:50 +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 020A28FC1D; Sat, 7 Jan 2012 02:09:50 +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 q0729ntJ019735; Sat, 7 Jan 2012 02:09:49 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0729nbM019732; Sat, 7 Jan 2012 02:09:49 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201201070209.q0729nbM019732@svn.freebsd.org> From: Rick Macklem Date: Sat, 7 Jan 2012 02:09:49 +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: r229759 - in stable/8/sys/fs: nfs nfsclient 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, 07 Jan 2012 02:09:50 -0000 Author: rmacklem Date: Sat Jan 7 02:09:49 2012 New Revision: 229759 URL: http://svn.freebsd.org/changeset/base/229759 Log: MFC: r228217 Post r223774, the NFSv4 client no longer has multiple instances of the same lock_owner4 string. As such, the handling of cleanup of lock_owners could be simplified. This simplification permitted the client to do a ReleaseLockOwner operation when the process that the lock_owner4 string represents, has exited. This permits the server to release any storage related to the lock_owner4 string before the associated open is closed. Without this change, it is possible to exhaust a server's storage when a long running process opens a file and then many child processes do locking on the file, because the open doesn't get closed. A similar patch was applied to the Linux NFSv4 client recently so that it wouldn't exhaust a server's storage. Modified: stable/8/sys/fs/nfs/nfsclstate.h stable/8/sys/fs/nfsclient/nfs_clstate.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/fs/nfs/nfsclstate.h ============================================================================== --- stable/8/sys/fs/nfs/nfsclstate.h Sat Jan 7 02:03:42 2012 (r229758) +++ stable/8/sys/fs/nfs/nfsclstate.h Sat Jan 7 02:09:49 2012 (r229759) @@ -34,6 +34,7 @@ */ LIST_HEAD(nfsclopenhead, nfsclopen); LIST_HEAD(nfscllockownerhead, nfscllockowner); +SLIST_HEAD(nfscllockownerfhhead, nfscllockownerfh); LIST_HEAD(nfscllockhead, nfscllock); LIST_HEAD(nfsclhead, nfsclclient); LIST_HEAD(nfsclownerhead, nfsclowner); @@ -149,8 +150,8 @@ struct nfscllockowner { struct nfsclopen *nfsl_open; NFSPROC_T *nfsl_inprog; nfsv4stateid_t nfsl_stateid; + int nfsl_lockflags; u_int32_t nfsl_seqid; - u_int32_t nfsl_defunct; struct nfsv4lock nfsl_rwlock; u_int8_t nfsl_owner[NFSV4CL_LOCKNAMELEN]; u_int8_t nfsl_openowner[NFSV4CL_LOCKNAMELEN]; @@ -166,6 +167,14 @@ struct nfscllock { short nfslo_type; }; +/* This structure is used to collect a list of lockowners to free up. */ +struct nfscllockownerfh { + SLIST_ENTRY(nfscllockownerfh) nfslfh_list; + struct nfscllockownerhead nfslfh_lock; + int nfslfh_len; + uint8_t nfslfh_fh[NFSX_V4FHMAX]; +}; + /* * Macro for incrementing the seqid#. */ Modified: stable/8/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clstate.c Sat Jan 7 02:03:42 2012 (r229758) +++ stable/8/sys/fs/nfsclient/nfs_clstate.c Sat Jan 7 02:09:49 2012 (r229759) @@ -143,6 +143,8 @@ static void nfscl_freeopenowner(struct n static void nfscl_cleandeleg(struct nfscldeleg *); static int nfscl_trydelegreturn(struct nfscldeleg *, struct ucred *, struct nfsmount *, NFSPROC_T *); +static void nfscl_emptylockowner(struct nfscllockowner *, + struct nfscllockownerfhhead *); static short nfscberr_null[] = { 0, @@ -1030,7 +1032,7 @@ nfscl_getbytelock(vnode_t vp, u_int64_t NFSBCOPY(op->nfso_own->nfsow_owner, nlp->nfsl_openowner, NFSV4CL_LOCKNAMELEN); nlp->nfsl_seqid = 0; - nlp->nfsl_defunct = 0; + nlp->nfsl_lockflags = flags; nlp->nfsl_inprog = NULL; nfscl_lockinit(&nlp->nfsl_rwlock); LIST_INIT(&nlp->nfsl_lock); @@ -1638,7 +1640,6 @@ static void nfscl_cleanup_common(struct nfsclclient *clp, u_int8_t *own) { struct nfsclowner *owp, *nowp; - struct nfsclopen *op; struct nfscllockowner *lp, *nlp; struct nfscldeleg *dp; @@ -1667,15 +1668,6 @@ nfscl_cleanup_common(struct nfsclclient nfscl_freeopenowner(owp, 0); else owp->nfsow_defunct = 1; - } else { - /* look for lockowners on other opens */ - LIST_FOREACH(op, &owp->nfsow_open, nfso_list) { - LIST_FOREACH(lp, &op->nfso_lock, nfsl_list) { - if (!NFSBCMP(lp->nfsl_owner, own, - NFSV4CL_LOCKNAMELEN)) - lp->nfsl_defunct = 1; - } - } } owp = nowp; } @@ -1685,13 +1677,21 @@ nfscl_cleanup_common(struct nfsclclient * Find open/lock owners for processes that have exited. */ static void -nfscl_cleanupkext(struct nfsclclient *clp) +nfscl_cleanupkext(struct nfsclclient *clp, struct nfscllockownerfhhead *lhp) { struct nfsclowner *owp, *nowp; + struct nfsclopen *op; + struct nfscllockowner *lp, *nlp; NFSPROCLISTLOCK(); NFSLOCKCLSTATE(); LIST_FOREACH_SAFE(owp, &clp->nfsc_owner, nfsow_list, nowp) { + LIST_FOREACH(op, &owp->nfsow_open, nfso_list) { + LIST_FOREACH_SAFE(lp, &op->nfso_lock, nfsl_list, nlp) { + if (LIST_EMPTY(&lp->nfsl_lock)) + nfscl_emptylockowner(lp, lhp); + } + } if (nfscl_procdoesntexist(owp->nfsow_owner)) nfscl_cleanup_common(clp, owp->nfsow_owner); } @@ -1699,6 +1699,58 @@ nfscl_cleanupkext(struct nfsclclient *cl NFSPROCLISTUNLOCK(); } +/* + * Take the empty lock owner and move it to the local lhp list if the + * associated process no longer exists. + */ +static void +nfscl_emptylockowner(struct nfscllockowner *lp, + struct nfscllockownerfhhead *lhp) +{ + struct nfscllockownerfh *lfhp, *mylfhp; + struct nfscllockowner *nlp; + int fnd_it; + + /* If not a Posix lock owner, just return. */ + if ((lp->nfsl_lockflags & F_POSIX) == 0) + return; + + fnd_it = 0; + mylfhp = NULL; + /* + * First, search to see if this lock owner is already in the list. + * If it is, then the associated process no longer exists. + */ + SLIST_FOREACH(lfhp, lhp, nfslfh_list) { + if (lfhp->nfslfh_len == lp->nfsl_open->nfso_fhlen && + !NFSBCMP(lfhp->nfslfh_fh, lp->nfsl_open->nfso_fh, + lfhp->nfslfh_len)) + mylfhp = lfhp; + LIST_FOREACH(nlp, &lfhp->nfslfh_lock, nfsl_list) + if (!NFSBCMP(nlp->nfsl_owner, lp->nfsl_owner, + NFSV4CL_LOCKNAMELEN)) + fnd_it = 1; + } + /* If not found, check if process still exists. */ + if (fnd_it == 0 && nfscl_procdoesntexist(lp->nfsl_owner) == 0) + return; + + /* Move the lock owner over to the local list. */ + if (mylfhp == NULL) { + mylfhp = malloc(sizeof(struct nfscllockownerfh), M_TEMP, + M_NOWAIT); + if (mylfhp == NULL) + return; + mylfhp->nfslfh_len = lp->nfsl_open->nfso_fhlen; + NFSBCOPY(lp->nfsl_open->nfso_fh, mylfhp->nfslfh_fh, + mylfhp->nfslfh_len); + LIST_INIT(&mylfhp->nfslfh_lock); + SLIST_INSERT_HEAD(lhp, mylfhp, nfslfh_list); + } + LIST_REMOVE(lp, nfsl_list); + LIST_INSERT_HEAD(&mylfhp->nfslfh_lock, lp, nfsl_list); +} + static int fake_global; /* Used to force visibility of MNTK_UNMOUNTF */ /* * Called from nfs umount to free up the clientid. @@ -2331,9 +2383,8 @@ nfscl_renewthread(struct nfsclclient *cl { struct nfsclowner *owp, *nowp; struct nfsclopen *op; - struct nfscllockowner *lp, *nlp, *olp; + struct nfscllockowner *lp, *nlp; struct nfscldeleghead dh; - struct nfscllockownerhead lh; struct nfscldeleg *dp, *ndp; struct ucred *cred; u_int32_t clidrev; @@ -2341,6 +2392,8 @@ nfscl_renewthread(struct nfsclclient *cl uint32_t recover_done_time = 0; struct timespec mytime; static time_t prevsec = 0; + struct nfscllockownerfh *lfhp, *nlfhp; + struct nfscllockownerfhhead lfh; cred = newnfs_getcred(); NFSLOCKCLSTATE(); @@ -2379,7 +2432,6 @@ nfscl_renewthread(struct nfsclclient *cl (void) nfscl_hasexpired(clp, clidrev, p); } - LIST_INIT(&lh); TAILQ_INIT(&dh); NFSLOCKCLSTATE(); if (cbpathdown) @@ -2389,41 +2441,11 @@ nfscl_renewthread(struct nfsclclient *cl /* * Now, handle defunct owners. */ - owp = LIST_FIRST(&clp->nfsc_owner); - while (owp != NULL) { - nowp = LIST_NEXT(owp, nfsow_list); - if (LIST_EMPTY(&owp->nfsow_open)) { - if (owp->nfsow_defunct) - nfscl_freeopenowner(owp, 0); - } else { - LIST_FOREACH(op, &owp->nfsow_open, nfso_list) { - lp = LIST_FIRST(&op->nfso_lock); - while (lp != NULL) { - nlp = LIST_NEXT(lp, nfsl_list); - if (lp->nfsl_defunct && - LIST_EMPTY(&lp->nfsl_lock)) { - LIST_FOREACH(olp, &lh, nfsl_list) { - if (!NFSBCMP(olp->nfsl_owner, - lp->nfsl_owner,NFSV4CL_LOCKNAMELEN)) - break; - } - if (olp == NULL) { - LIST_REMOVE(lp, nfsl_list); - LIST_INSERT_HEAD(&lh, lp, nfsl_list); - } else { - nfscl_freelockowner(lp, 0); - } - } - lp = nlp; - } + LIST_FOREACH_SAFE(owp, &clp->nfsc_owner, nfsow_list, nowp) { + if (LIST_EMPTY(&owp->nfsow_open)) { + if (owp->nfsow_defunct != 0) + nfscl_freeopenowner(owp, 0); } - } - owp = nowp; - } - - /* and release defunct lock owners */ - LIST_FOREACH_SAFE(lp, &lh, nfsl_list, nlp) { - nfscl_freelockowner(lp, 0); } /* @@ -2528,6 +2550,7 @@ tryagain: FREE((caddr_t)dp, M_NFSCLDELEG); } + SLIST_INIT(&lfh); /* * Call nfscl_cleanupkext() once per second to check for * open/lock owners where the process has exited. @@ -2535,8 +2558,26 @@ tryagain: NFSGETNANOTIME(&mytime); if (prevsec != mytime.tv_sec) { prevsec = mytime.tv_sec; - nfscl_cleanupkext(clp); + nfscl_cleanupkext(clp, &lfh); + } + + /* + * Do a ReleaseLockOwner for all lock owners where the + * associated process no longer exists, as found by + * nfscl_cleanupkext(). + */ + newnfs_setroot(cred); + SLIST_FOREACH_SAFE(lfhp, &lfh, nfslfh_list, nlfhp) { + LIST_FOREACH_SAFE(lp, &lfhp->nfslfh_lock, nfsl_list, + nlp) { + (void)nfsrpc_rellockown(clp->nfsc_nmp, lp, + lfhp->nfslfh_fh, lfhp->nfslfh_len, cred, + p); + nfscl_freelockowner(lp, 0); + } + free(lfhp, M_TEMP); } + SLIST_INIT(&lfh); NFSLOCKCLSTATE(); if ((clp->nfsc_flags & NFSCLFLAGS_RECOVER) == 0) @@ -3539,8 +3580,8 @@ nfscl_relock(vnode_t vp, struct nfsclcli off = lop->nfslo_first; len = lop->nfslo_end - lop->nfslo_first; error = nfscl_getbytelock(vp, off, len, lop->nfslo_type, cred, p, - clp, 1, NULL, 0, lp->nfsl_owner, lp->nfsl_openowner, &nlp, &newone, - &donelocally); + clp, 1, NULL, lp->nfsl_lockflags, lp->nfsl_owner, + lp->nfsl_openowner, &nlp, &newone, &donelocally); if (error || donelocally) return (error); if (nmp->nm_clp != NULL) From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 02:24:00 2012 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 F1880106566B; Sat, 7 Jan 2012 02:23:58 +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 DE9AE8FC18; Sat, 7 Jan 2012 02:23: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 q072NwBx020228; Sat, 7 Jan 2012 02:23:58 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q072Nw0l020225; Sat, 7 Jan 2012 02:23:58 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201070223.q072Nw0l020225@svn.freebsd.org> From: Martin Matuska Date: Sat, 7 Jan 2012 02:23: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: r229760 - in stable/8/sys: boot/zfs cddl/boot/zfs 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, 07 Jan 2012 02:24:00 -0000 Author: mm Date: Sat Jan 7 02:23:58 2012 New Revision: 229760 URL: http://svn.freebsd.org/changeset/base/229760 Log: MFC r226549,r226550,r226551,r226552,r226553,r226568 MFC r226549 (pjd): Remove redundant size calculation. MFC r226550 (pjd): Initialize 'rc' properly before using it. This error could lead to infinite loop when data reconstruction was needed. MFC r226551 (pjd): Don't mark vdev as healthy too soon, so we won't try to use invalid vdevs. MFC r226552 (pjd): Never pass NULL block pointer when reading. This is neither expected nor handled by lower layers like vdev_raidz, which uses bp for checksum verification. This bug could lead to NULL pointer reference and resets during boot. MFC r226553 (pjd): Always pass data size for checksum verification function, as using physical block size declared in bp may not always be what we want. For example in case of gang block header physical block size declared in bp is much larger than SPA_GANGBLOCKSIZE (512 bytes) and checksum calculation failed. This bug could lead to accessing unallocated memory and resets/failures during boot. MFC r226568 (pjd) [1]: - Correctly read gang header from raidz. - Decompress assembled gang block data if compressed. - Verify checksum of a gang header. - Verify checksum of assembled gang block data. - Verify checksum of uber block. Submitted by: avg [1] Modified: stable/8/sys/boot/zfs/zfsimpl.c stable/8/sys/cddl/boot/zfs/zfssubr.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/boot/zfs/zfsimpl.c ============================================================================== --- stable/8/sys/boot/zfs/zfsimpl.c Sat Jan 7 02:09:49 2012 (r229759) +++ stable/8/sys/boot/zfs/zfsimpl.c Sat Jan 7 02:23:58 2012 (r229760) @@ -347,7 +347,7 @@ vdev_read_phys(vdev_t *vdev, const blkpt rc = vdev->v_phys_read(vdev, vdev->v_read_priv, offset, buf, psize); if (rc) return (rc); - if (bp && zio_checksum_error(bp, buf, offset)) + if (bp && zio_checksum_verify(bp, buf)) return (EIO); return (0); @@ -543,8 +543,6 @@ vdev_init_from_nvlist(const unsigned cha vdev->v_state = VDEV_STATE_DEGRADED; else if (isnt_present) vdev->v_state = VDEV_STATE_CANT_OPEN; - else - vdev->v_state = VDEV_STATE_HEALTHY; } rc = nvlist_find(nvlist, ZPOOL_CONFIG_CHILDREN, @@ -800,6 +798,7 @@ vdev_probe(vdev_phys_read_t *read, void BP_SET_PSIZE(&bp, sizeof(vdev_phys_t)); BP_SET_CHECKSUM(&bp, ZIO_CHECKSUM_LABEL); BP_SET_COMPRESS(&bp, ZIO_COMPRESS_OFF); + DVA_SET_OFFSET(BP_IDENTITY(&bp), off); ZIO_SET_CHECKSUM(&bp.blk_cksum, off, 0, 0, 0); if (vdev_read_phys(&vtmp, &bp, vdev_label, off, 0)) return (EIO); @@ -912,6 +911,7 @@ vdev_probe(vdev_phys_read_t *read, void if (vdev) { vdev->v_phys_read = read; vdev->v_read_priv = read_priv; + vdev->v_state = VDEV_STATE_HEALTHY; } else { printf("ZFS: inconsistent nvlist contents\n"); return (EIO); @@ -941,7 +941,7 @@ vdev_probe(vdev_phys_read_t *read, void BP_SET_COMPRESS(&bp, ZIO_COMPRESS_OFF); ZIO_SET_CHECKSUM(&bp.blk_cksum, off, 0, 0, 0); - if (vdev_read_phys(vdev, NULL, upbuf, off, VDEV_UBERBLOCK_SIZE(vdev))) + if (vdev_read_phys(vdev, &bp, upbuf, off, 0)) continue; if (up->ub_magic != UBERBLOCK_MAGIC) @@ -974,34 +974,39 @@ ilog2(int n) } static int -zio_read_gang(spa_t *spa, const blkptr_t *bp, const dva_t *dva, void *buf) +zio_read_gang(spa_t *spa, const blkptr_t *bp, void *buf) { + blkptr_t gbh_bp; zio_gbh_phys_t zio_gb; - vdev_t *vdev; - int vdevid; - off_t offset; + char *pbuf; int i; - vdevid = DVA_GET_VDEV(dva); - offset = DVA_GET_OFFSET(dva); - STAILQ_FOREACH(vdev, &spa->spa_vdevs, v_childlink) - if (vdev->v_id == vdevid) - break; - if (!vdev || !vdev->v_read) - return (EIO); - if (vdev->v_read(vdev, NULL, &zio_gb, offset, SPA_GANGBLOCKSIZE)) + /* Artificial BP for gang block header. */ + gbh_bp = *bp; + BP_SET_PSIZE(&gbh_bp, SPA_GANGBLOCKSIZE); + BP_SET_LSIZE(&gbh_bp, SPA_GANGBLOCKSIZE); + BP_SET_CHECKSUM(&gbh_bp, ZIO_CHECKSUM_GANG_HEADER); + BP_SET_COMPRESS(&gbh_bp, ZIO_COMPRESS_OFF); + for (i = 0; i < SPA_DVAS_PER_BP; i++) + DVA_SET_GANG(&gbh_bp.blk_dva[i], 0); + + /* Read gang header block using the artificial BP. */ + if (zio_read(spa, &gbh_bp, &zio_gb)) return (EIO); + pbuf = buf; for (i = 0; i < SPA_GBH_NBLKPTRS; i++) { blkptr_t *gbp = &zio_gb.zg_blkptr[i]; if (BP_IS_HOLE(gbp)) continue; - if (zio_read(spa, gbp, buf)) + if (zio_read(spa, gbp, pbuf)) return (EIO); - buf = (char*)buf + BP_GET_PSIZE(gbp); + pbuf += BP_GET_PSIZE(gbp); } - + + if (zio_checksum_verify(bp, buf)) + return (EIO); return (0); } @@ -1024,46 +1029,41 @@ zio_read(spa_t *spa, const blkptr_t *bp, if (!dva->dva_word[0] && !dva->dva_word[1]) continue; - if (DVA_GET_GANG(dva)) { - error = zio_read_gang(spa, bp, dva, buf); - if (error != 0) - continue; - } else { - vdevid = DVA_GET_VDEV(dva); - offset = DVA_GET_OFFSET(dva); - STAILQ_FOREACH(vdev, &spa->spa_vdevs, v_childlink) { - if (vdev->v_id == vdevid) - break; - } - if (!vdev || !vdev->v_read) - continue; + vdevid = DVA_GET_VDEV(dva); + offset = DVA_GET_OFFSET(dva); + STAILQ_FOREACH(vdev, &spa->spa_vdevs, v_childlink) { + if (vdev->v_id == vdevid) + break; + } + if (!vdev || !vdev->v_read) + continue; - size = BP_GET_PSIZE(bp); + size = BP_GET_PSIZE(bp); + if (vdev->v_read == vdev_raidz_read) { align = 1ULL << vdev->v_top->v_ashift; if (P2PHASE(size, align) != 0) size = P2ROUNDUP(size, align); - if (size != BP_GET_PSIZE(bp) || cpfunc != ZIO_COMPRESS_OFF) - pbuf = zfs_alloc(size); - else - pbuf = buf; + } + if (size != BP_GET_PSIZE(bp) || cpfunc != ZIO_COMPRESS_OFF) + pbuf = zfs_alloc(size); + else + pbuf = buf; + if (DVA_GET_GANG(dva)) + error = zio_read_gang(spa, bp, pbuf); + else error = vdev->v_read(vdev, bp, pbuf, offset, size); - if (error == 0) { - if (cpfunc != ZIO_COMPRESS_OFF) { - error = zio_decompress_data(cpfunc, - pbuf, BP_GET_PSIZE(bp), buf, - BP_GET_LSIZE(bp)); - } else if (size != BP_GET_PSIZE(bp)) { - bcopy(pbuf, buf, BP_GET_PSIZE(bp)); - } - } - if (buf != pbuf) - zfs_free(pbuf, size); - if (error != 0) - continue; + if (error == 0) { + if (cpfunc != ZIO_COMPRESS_OFF) + error = zio_decompress_data(cpfunc, pbuf, + BP_GET_PSIZE(bp), buf, BP_GET_LSIZE(bp)); + else if (size != BP_GET_PSIZE(bp)) + bcopy(pbuf, buf, BP_GET_PSIZE(bp)); } - error = 0; - break; + if (buf != pbuf) + zfs_free(pbuf, size); + if (error == 0) + break; } if (error != 0) printf("ZFS: i/o error - all block copies unavailable\n"); Modified: stable/8/sys/cddl/boot/zfs/zfssubr.c ============================================================================== --- stable/8/sys/cddl/boot/zfs/zfssubr.c Sat Jan 7 02:09:49 2012 (r229759) +++ stable/8/sys/cddl/boot/zfs/zfssubr.c Sat Jan 7 02:23:58 2012 (r229760) @@ -181,14 +181,17 @@ zio_checksum_label_verifier(zio_cksum_t } static int -zio_checksum_error(const blkptr_t *bp, void *data, uint64_t offset) +zio_checksum_verify(const blkptr_t *bp, void *data) { - unsigned int checksum = BP_IS_GANG(bp) ? ZIO_CHECKSUM_GANG_HEADER : BP_GET_CHECKSUM(bp); - uint64_t size = BP_GET_PSIZE(bp); + uint64_t size; + unsigned int checksum; zio_checksum_info_t *ci; zio_cksum_t actual_cksum, expected_cksum, verifier; int byteswap; + checksum = BP_GET_CHECKSUM(bp); + size = BP_GET_PSIZE(bp); + if (checksum >= ZIO_CHECKSUM_FUNCTIONS) return (EINVAL); ci = &zio_checksum_table[checksum]; @@ -206,7 +209,8 @@ zio_checksum_error(const blkptr_t *bp, v if (checksum == ZIO_CHECKSUM_GANG_HEADER) zio_checksum_gang_verifier(&verifier, bp); else if (checksum == ZIO_CHECKSUM_LABEL) - zio_checksum_label_verifier(&verifier, offset); + zio_checksum_label_verifier(&verifier, + DVA_GET_OFFSET(BP_IDENTITY(bp))); else verifier = bp->blk_cksum; @@ -224,7 +228,6 @@ zio_checksum_error(const blkptr_t *bp, v byteswap_uint64_array(&expected_cksum, sizeof (zio_cksum_t)); } else { - ASSERT(!BP_IS_GANG(bp)); expected_cksum = bp->blk_cksum; ci->ci_func[0](data, size, &actual_cksum); } @@ -1215,15 +1218,10 @@ static void vdev_raidz_map_free(raidz_map_t *rm) { int c; - size_t size; for (c = rm->rm_firstdatacol - 1; c >= 0; c--) zfs_free(rm->rm_col[c].rc_data, rm->rm_col[c].rc_size); - size = 0; - for (c = rm->rm_firstdatacol; c < rm->rm_cols; c++) - size += rm->rm_col[c].rc_size; - zfs_free(rm, offsetof(raidz_map_t, rm_col[rm->rm_scols])); } @@ -1245,10 +1243,10 @@ vdev_child(vdev_t *pvd, uint64_t devidx) * any ereports we generate can note it. */ static int -raidz_checksum_verify(const blkptr_t *bp, void *data) +raidz_checksum_verify(const blkptr_t *bp, void *data, uint64_t size) { - return (zio_checksum_error(bp, data, 0)); + return (zio_checksum_verify(bp, data)); } /* @@ -1298,7 +1296,7 @@ raidz_parity_verify(raidz_map_t *rm) */ static int vdev_raidz_combrec(raidz_map_t *rm, const blkptr_t *bp, void *data, - off_t offset, int total_errors, int data_errors) + off_t offset, uint64_t bytes, int total_errors, int data_errors) { raidz_col_t *rc; void *orig[VDEV_RAIDZ_MAXPARITY]; @@ -1377,7 +1375,7 @@ vdev_raidz_combrec(raidz_map_t *rm, cons * success. */ code = vdev_raidz_reconstruct(rm, tgts, n); - if (raidz_checksum_verify(bp, data) == 0) { + if (raidz_checksum_verify(bp, data, bytes) == 0) { for (i = 0; i < n; i++) { c = tgts[i]; rc = &rm->rm_col[c]; @@ -1548,7 +1546,7 @@ reconstruct: */ if (total_errors <= rm->rm_firstdatacol - parity_untried) { if (data_errors == 0) { - if (raidz_checksum_verify(bp, data) == 0) { + if (raidz_checksum_verify(bp, data, bytes) == 0) { /* * If we read parity information (unnecessarily * as it happens since no reconstruction was @@ -1593,7 +1591,7 @@ reconstruct: code = vdev_raidz_reconstruct(rm, tgts, n); - if (raidz_checksum_verify(bp, data) == 0) { + if (raidz_checksum_verify(bp, data, bytes) == 0) { /* * If we read more parity disks than were used * for reconstruction, confirm that the other @@ -1633,7 +1631,9 @@ reconstruct: n = 0; for (c = 0; c < rm->rm_cols; c++) { - if (rm->rm_col[c].rc_tried) + rc = &rm->rm_col[c]; + + if (rc->rc_tried) continue; cvd = vdev_child(vd, rc->rc_devidx); @@ -1665,8 +1665,8 @@ reconstruct: if (total_errors > rm->rm_firstdatacol) { error = EIO; } else if (total_errors < rm->rm_firstdatacol && - (code = vdev_raidz_combrec(rm, bp, data, offset, total_errors, - data_errors)) != 0) { + (code = vdev_raidz_combrec(rm, bp, data, offset, bytes, + total_errors, data_errors)) != 0) { /* * If we didn't use all the available parity for the * combinatorial reconstruction, verify that the remaining From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 02:35:01 2012 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 45C56106566B; Sat, 7 Jan 2012 02:35:01 +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 32DB58FC08; Sat, 7 Jan 2012 02:35: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 q072Z1LD020615; Sat, 7 Jan 2012 02:35:01 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q072Z1Sf020612; Sat, 7 Jan 2012 02:35:01 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201201070235.q072Z1Sf020612@svn.freebsd.org> From: Martin Matuska Date: Sat, 7 Jan 2012 02:35:01 +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: r229761 - stable/8/tools/tools/zfsboottest 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, 07 Jan 2012 02:35:01 -0000 Author: mm Date: Sat Jan 7 02:35:00 2012 New Revision: 229761 URL: http://svn.freebsd.org/changeset/base/229761 Log: MFC zfsboottest: r225608 (partial), r225609, r226611, r226612 MFC r225608 (avg, tools/ part): zfstest: rename to zfsboottest and move to tools MFC r225609 (avg): zfsboottest: some additional enhancements - redirect diagnostics printfs in the boot code to stderr - do not read trailing garbage from a trailing block of a file Also add my copyright to the file after making so many changes. MFC r226611 (pjd): - Allow to specify multiple files to check, eg. zfsboottest gpt/system0 gpt/system1 - /boot/kernel/kernel /boot/zfsloader - Instead of printing file's content calculate MD5 hash of the file, so it can be easly compared to the hash calculated via file system. - Some other minor improvements. MFC r226612 (pjd): Because ZFS boot code was very fragile in the past and real PITA to debug, introduce zfsboottest.sh script that will verify if it will be possible to boot from the given pool. # zfsboottest.sh system Where "system" is pool name of the pool we want to boot from. What is being verified by the script: - Does the pool exist? - Does it have bootfs property configured? - Is mountpoint property of the boot dataset set to 'legacy'? Dataset configured in bootfs property has to be mounted to perform more checks: - Does the /boot directory in boot dataset exist? - Is this dataset configured as root file system in /etc/fstab or set in vfs.root.mountfrom variable in /boot/loader.conf? By using zfsboottest tool the script will read all the files in /boot directory using ZFS boot code and calculate their checksums. Then, it will walk /boot directory using find(1) though regular file sytem and also read all the files in /boot directory and calculate their checksums. If any of the files cannot be looked up, read or checksum is invalid it will be reported and booting off of this pool is probably not possible. Some additional checks may be interesting as well. For example if the disks contain proper pmbr and gptzfsboot code or if all expected files in /boot/ are present. When upgrading FreeBSD, one should snapshot datasets that contain operating system, upgrade (install new world and kernel) and use zfsboottest.sh to verify if it will be possible to boot from new configuration. If all is good one should upgrade boot blocks, by eg.: # gpart -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada1 If something is wrong, one should rollback datasets and report the problems. Added: stable/8/tools/tools/zfsboottest/ - copied from r225608, head/tools/tools/zfsboottest/ stable/8/tools/tools/zfsboottest/zfsboottest.sh - copied unchanged from r226612, head/tools/tools/zfsboottest/zfsboottest.sh Modified: stable/8/tools/tools/zfsboottest/Makefile stable/8/tools/tools/zfsboottest/zfsboottest.c Directory Properties: stable/8/tools/ (props changed) stable/8/tools/tools/ (props changed) Modified: stable/8/tools/tools/zfsboottest/Makefile ============================================================================== --- head/tools/tools/zfsboottest/Makefile Fri Sep 16 08:22:48 2011 (r225608) +++ stable/8/tools/tools/zfsboottest/Makefile Sat Jan 7 02:35:00 2012 (r229761) @@ -2,7 +2,12 @@ .PATH: ${.CURDIR}/../../../sys/boot/zfs ${.CURDIR}/../../../sys/cddl/boot/zfs +BINDIR?= /usr/bin +SCRIPTSDIR?= /usr/bin + PROG= zfsboottest +SCRIPTS= zfsboottest.sh +SCRIPTSNAME= zfsboottest.sh NO_MAN= CFLAGS= -O1 \ @@ -12,8 +17,9 @@ CFLAGS= -O1 \ -fdiagnostics-show-option \ -W -Wextra -Wno-sign-compare -Wno-unused-parameter \ -Werror +LDFLAGS+=-lmd -.if ${MACHINE_CPUARCH} == "amd64" +.if ${MACHINE_ARCH} == "amd64" beforedepend zfsboottest.o: machine CLEANFILES+= machine machine: Modified: stable/8/tools/tools/zfsboottest/zfsboottest.c ============================================================================== --- head/tools/tools/zfsboottest/zfsboottest.c Fri Sep 16 08:22:48 2011 (r225608) +++ stable/8/tools/tools/zfsboottest/zfsboottest.c Sat Jan 7 02:35:00 2012 (r229761) @@ -1,5 +1,7 @@ /*- * Copyright (c) 2010 Doug Rabson + * Copyright (c) 2011 Andriy Gapon + * Copyright (c) 2011 Pawel Jakub Dawidek * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -24,14 +26,13 @@ * SUCH DAMAGE. */ /* $FreeBSD$ */ -/* - * Compile with 'cc -I. -I../../cddl/boot/zfs zfstest.c -o zfstest' - */ #include #include +#include #include #include +#include #include #include #include @@ -45,15 +46,19 @@ void pager_output(const char *line) { + fprintf(stderr, "%s", line); } +#define ZFS_TEST +#define printf(...) fprintf(stderr, __VA_ARGS__) #include "zfsimpl.c" +#undef printf static int vdev_read(vdev_t *vdev, void *priv, off_t off, void *buf, size_t bytes) { - int fd = *(int *) priv; + int fd = *(int *)priv; if (pread(fd, buf, bytes, off) != bytes) return (-1); @@ -72,7 +77,7 @@ zfs_read(spa_t *spa, dnode_phys_t *dn, v n = zp->zp_size - off; rc = dnode_read(spa, dn, off, buf, n); - if (rc) + if (rc != 0) return (-rc); return (n); @@ -81,29 +86,49 @@ zfs_read(spa_t *spa, dnode_phys_t *dn, v int main(int argc, char** argv) { - char buf[512]; - int fd[100]; + char buf[512], hash[33]; + MD5_CTX ctx; struct stat sb; dnode_phys_t dn; spa_t *spa; - int i, n, off; + off_t off; + ssize_t n; + int i, failures, *fd; zfs_init(); if (argc == 1) { static char *av[] = { - "zfstest", "COPYRIGHT", - "/dev/da0p2", "/dev/da1p2", "/dev/da2p2", + "zfsboottest", + "/dev/gpt/system0", + "/dev/gpt/system1", + "-", + "/boot/zfsloader", + "/boot/support.4th", + "/boot/kernel/kernel", NULL, }; - argc = 5; + argc = sizeof(av) / sizeof(av[0]) - 1; argv = av; } - for (i = 2; i < argc; i++) { - fd[i] = open(argv[i], O_RDONLY); - if (fd[i] < 0) + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-") == 0) + break; + } + fd = malloc(sizeof(fd[0]) * (i - 1)); + if (fd == NULL) + errx(1, "Unable to allocate memory."); + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-") == 0) + break; + fd[i - 1] = open(argv[i], O_RDONLY); + if (fd[i - 1] == -1) { + warn("open(%s) failed", argv[i]); continue; - if (vdev_probe(vdev_read, &fd[i], NULL) != 0) - close(fd[i]); + } + if (vdev_probe(vdev_read, &fd[i - 1], NULL) != 0) { + warnx("vdev_probe(%s) failed", argv[i]); + close(fd[i - 1]); + } } spa_all_status(); @@ -118,27 +143,40 @@ main(int argc, char** argv) exit(1); } - if (zfs_lookup(spa, argv[1], &dn)) { - fprintf(stderr, "can't lookup\n"); - exit(1); - } - - if (zfs_dnode_stat(spa, &dn, &sb)) { - fprintf(stderr, "can't stat\n"); - exit(1); - } - + printf("\n"); + for (++i, failures = 0; i < argc; i++) { + if (zfs_lookup(spa, argv[i], &dn)) { + fprintf(stderr, "%s: can't lookup\n", argv[i]); + failures++; + continue; + } - off = 0; - do { - n = zfs_read(spa, &dn, buf, 512, off); - if (n < 0) { - fprintf(stderr, "zfs_read failed\n"); - exit(1); + if (zfs_dnode_stat(spa, &dn, &sb)) { + fprintf(stderr, "%s: can't stat\n", argv[i]); + failures++; + continue; } - write(1, buf, n); - off += n; - } while (off < sb.st_size); - return (0); + off = 0; + MD5Init(&ctx); + do { + n = sb.st_size - off; + n = n > sizeof(buf) ? sizeof(buf) : n; + n = zfs_read(spa, &dn, buf, n, off); + if (n < 0) { + fprintf(stderr, "%s: zfs_read failed\n", + argv[i]); + failures++; + break; + } + MD5Update(&ctx, buf, n); + off += n; + } while (off < sb.st_size); + if (off < sb.st_size) + continue; + MD5End(&ctx, hash); + printf("%s %s\n", hash, argv[i]); + } + + return (failures == 0 ? 0 : 1); } Copied: stable/8/tools/tools/zfsboottest/zfsboottest.sh (from r226612, head/tools/tools/zfsboottest/zfsboottest.sh) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/tools/zfsboottest/zfsboottest.sh Sat Jan 7 02:35:00 2012 (r229761, copy of r226612, head/tools/tools/zfsboottest/zfsboottest.sh) @@ -0,0 +1,130 @@ +#!/bin/sh +# +# Copyright (c) 2011 Pawel Jakub Dawidek +# 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 THE AUTHORS AND CONTRIBUTORS ``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 THE AUTHORS 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. +# +# $FreeBSD$ + +if [ $# -ne 1 ]; then + echo "usage: zfsboottest.sh " >&2 + exit 1 +fi + +which -s zfsboottest +if [ $? -eq 0 ]; then + zfsboottest="zfsboottest" +else + if [ ! -x "/usr/src/tools/tools/zfsboottest/zfsboottest" ]; then + echo "Unable to find \"zfsboottest\" utility." >&2 + exit 1 + fi + zfsboottest="/usr/src/tools/tools/zfsboottest/zfsboottest" +fi + +startdir="/boot" + +pool="${1}" +zpool list "${pool}" >/dev/null 2>&1 +if [ $? -ne 0 ]; then + echo "No such pool \"${pool}\"." >&2 + exit 1 +fi +bootfs=`zpool get bootfs "${pool}" | tail -1 | awk '{print $3}'` +if [ "${bootfs}" = "-" ]; then + echo "The \"bootfs\" property is not configured for pool \"${pool}\"." >&2 + exit 1 +fi +# Dataset's mountpoint property should be set to 'legacy'. +if [ "`zfs get -H -o value mountpoint ${bootfs}`" != "legacy" ]; then + echo "The \"mountpoint\" property of dataset \"${bootfs}\" should be set to \"legacy\"." >&2 + exit 1 +fi +mountpoint=`df -t zfs "${bootfs}" 2>/dev/null | tail -1 | awk '{print $6}'` +if [ -z "${mountpoint}" ]; then + echo "The \"${bootfs}\" dataset is not mounted." >&2 + exit 1 +fi +if [ ! -d "${mountpoint}${startdir}" ]; then + echo "The \"${mountpoint}${startdir}\" directory doesn't exist." >&2 + exit 1 +fi +# To be able to mount root ZFS file system we need either /etc/fstab entry +# or vfs.root.mountfrom variable set in /boot/loader.conf. +egrep -q '^'"${bootfs}"'[[:space:]]+/[[:space:]]+zfs[[:space:]]+' "${mountpoint}/etc/fstab" 2>/dev/null +if [ $? -ne 0 ]; then + egrep -q 'vfs.root.mountfrom="?'"${bootfs}"'"?[[:space:]]*$' "${mountpoint}/boot/loader.conf" 2>/dev/null + if [ $? -ne 0 ]; then + echo "To be able to boot from \"${bootfs}\", you need to declare" >&2 + echo "\"${bootfs}\" as being root file system in ${mountpoint}/etc/fstab" >&2 + echo "or add \"vfs.root.mountfrom\" variable set to \"${bootfs}\" to" >&2 + echo "${mountpoint}/boot/loader.conf." >&2 + exit 1 + fi +fi +vdevs="" +for vdev in `zpool status "${pool}" | grep ONLINE | awk '{print $1}'`; do + vdev="/dev/${vdev#/dev/}" + if [ -c "${vdev}" ]; then + if [ -z "${vdevs}" ]; then + vdevs="${vdev}" + else + vdevs="${vdevs} ${vdev}" + fi + fi +done + +list0=`mktemp /tmp/zfsboottest.XXXXXXXXXX` +if [ $? -ne 0 ]; then + echo "Unable to create temporary file." >&2 + exit 1 +fi +list1=`mktemp /tmp/zfsboottest.XXXXXXXXXX` +if [ $? -ne 0 ]; then + echo "Unable to create temporary file." >&2 + rm -f "${list0}" + exit 1 +fi + +echo "zfsboottest.sh is reading all the files in ${mountpoint}${startdir} using" +echo "boot code and using file system code." +echo "It calculates MD5 checksums for all the files and will compare them." +echo "If all files can be properly read using boot code, it is very likely you" +echo "will be able to boot from \"${pool}\" pool>:> Good luck!" +echo + +"${zfsboottest}" ${vdevs} - `find "${mountpoint}${startdir}" -type f | sed "s@^${mountpoint}@@"` | egrep '^[0-9a-z]{32} /' | sort -k 2 >"${list0}" +find "${mountpoint}${startdir}" -type f | xargs md5 -r | sed "s@ ${mountpoint}@ @" | egrep '^[0-9a-z]{32} /' | sort -k 2 >"${list1}" + +diff -u "${list0}" "${list1}" +ec=$? + +rm -f "${list0}" "${list1}" + +if [ $? -ne 0 ]; then + echo >&2 + echo "You may not be able to boot." >&2 + exit 1 +fi + +echo "OK" From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 03:31:40 2012 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 D5FC91065670; Sat, 7 Jan 2012 03:31:40 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C3BB58FC0C; Sat, 7 Jan 2012 03:31:40 +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 q073VeCv022650; Sat, 7 Jan 2012 03:31:40 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q073Ve11022648; Sat, 7 Jan 2012 03:31:40 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201070331.q073Ve11022648@svn.freebsd.org> From: Eitan Adler Date: Sat, 7 Jan 2012 03:31:40 +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: r229762 - stable/7/sbin/md5 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, 07 Jan 2012 03:31:40 -0000 Author: eadler (ports committer) Date: Sat Jan 7 03:31:40 2012 New Revision: 229762 URL: http://svn.freebsd.org/changeset/base/229762 Log: MFC r227491: - new sentence should start on new line. Approved by: gjb Modified: stable/7/sbin/md5/md5.1 Directory Properties: stable/7/sbin/md5/ (props changed) Modified: stable/7/sbin/md5/md5.1 ============================================================================== --- stable/7/sbin/md5/md5.1 Sat Jan 7 02:35:00 2012 (r229761) +++ stable/7/sbin/md5/md5.1 Sat Jan 7 03:31:40 2012 (r229762) @@ -69,8 +69,8 @@ The hexadecimal checksum of each file li after the options are processed. .Bl -tag -width indent .It Fl c Ar string -Compare files to this md5 string. (Note that this option is not yet useful -if multiple files are specified.) +Compare files to this md5 string. +(Note that this option is not yet useful if multiple files are specified.) .It Fl s Ar string Print a checksum of the given .Ar string . From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 03:32:24 2012 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 D14A11065673; Sat, 7 Jan 2012 03:32:24 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BFC528FC16; Sat, 7 Jan 2012 03:32: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 q073WOUi022708; Sat, 7 Jan 2012 03:32:24 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q073WOvK022706; Sat, 7 Jan 2012 03:32:24 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201070332.q073WOvK022706@svn.freebsd.org> From: Eitan Adler Date: Sat, 7 Jan 2012 03:32:24 +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: r229763 - stable/8/sbin/md5 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, 07 Jan 2012 03:32:24 -0000 Author: eadler (ports committer) Date: Sat Jan 7 03:32:24 2012 New Revision: 229763 URL: http://svn.freebsd.org/changeset/base/229763 Log: MFC r227491: - new sentence should start on new line. Approved by: gjb Modified: stable/8/sbin/md5/md5.1 Directory Properties: stable/8/sbin/md5/ (props changed) Modified: stable/8/sbin/md5/md5.1 ============================================================================== --- stable/8/sbin/md5/md5.1 Sat Jan 7 03:31:40 2012 (r229762) +++ stable/8/sbin/md5/md5.1 Sat Jan 7 03:32:24 2012 (r229763) @@ -78,8 +78,8 @@ The hexadecimal checksum of each file li after the options are processed. .Bl -tag -width indent .It Fl c Ar string -Compare files to this md5 string. (Note that this option is not yet useful -if multiple files are specified.) +Compare files to this md5 string. +(Note that this option is not yet useful if multiple files are specified.) .It Fl s Ar string Print a checksum of the given .Ar string . From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 03:32:48 2012 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 1C60A10656E0; Sat, 7 Jan 2012 03:32:48 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0AEBB8FC20; Sat, 7 Jan 2012 03:32:48 +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 q073Wl6e022753; Sat, 7 Jan 2012 03:32:47 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q073Wlq8022751; Sat, 7 Jan 2012 03:32:47 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201070332.q073Wlq8022751@svn.freebsd.org> From: Eitan Adler Date: Sat, 7 Jan 2012 03:32:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229764 - stable/9/sbin/md5 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, 07 Jan 2012 03:32:48 -0000 Author: eadler (ports committer) Date: Sat Jan 7 03:32:47 2012 New Revision: 229764 URL: http://svn.freebsd.org/changeset/base/229764 Log: MFC r227491: - new sentence should start on new line. Approved by: gjb Modified: stable/9/sbin/md5/md5.1 Directory Properties: stable/9/sbin/md5/ (props changed) Modified: stable/9/sbin/md5/md5.1 ============================================================================== --- stable/9/sbin/md5/md5.1 Sat Jan 7 03:32:24 2012 (r229763) +++ stable/9/sbin/md5/md5.1 Sat Jan 7 03:32:47 2012 (r229764) @@ -78,8 +78,8 @@ The hexadecimal checksum of each file li after the options are processed. .Bl -tag -width indent .It Fl c Ar string -Compare files to this md5 string. (Note that this option is not yet useful -if multiple files are specified.) +Compare files to this md5 string. +(Note that this option is not yet useful if multiple files are specified.) .It Fl s Ar string Print a checksum of the given .Ar string . From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 04:13:25 2012 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 7BA5F106564A; Sat, 7 Jan 2012 04:13:25 +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 6AA528FC0A; Sat, 7 Jan 2012 04:13:25 +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 q074DPqt024075; Sat, 7 Jan 2012 04:13:25 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q074DPNR024073; Sat, 7 Jan 2012 04:13:25 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201201070413.q074DPNR024073@svn.freebsd.org> From: Adrian Chadd Date: Sat, 7 Jan 2012 04:13:25 +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: r229765 - head/sys/mips/atheros 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, 07 Jan 2012 04:13:25 -0000 Author: adrian Date: Sat Jan 7 04:13:25 2012 New Revision: 229765 URL: http://svn.freebsd.org/changeset/base/229765 Log: Fix the ar724x shift calculation when writing to the PCI config space. This was preventing the ath driver from being loaded at runtime. It worked fine when compiled statically into the kernel but not when kldload'ed after the system booted. The root cause was that PCIR_INTLINE (register 60) was being overwritten by zeros when register 62 was being written to. A subsequent read of this register would return 0, and thus the rest of the PCI glue assumed an IRQ resource had already been allocated. This caused the device to fail to attach at runtime as the device itself didn't contain any IRQ resources. TODO: go back over the ar71xx and ar724x PCI config read/write code and ensure it's correct. Modified: head/sys/mips/atheros/ar724x_pci.c Modified: head/sys/mips/atheros/ar724x_pci.c ============================================================================== --- head/sys/mips/atheros/ar724x_pci.c Sat Jan 7 03:32:47 2012 (r229764) +++ head/sys/mips/atheros/ar724x_pci.c Sat Jan 7 04:13:25 2012 (r229765) @@ -93,7 +93,7 @@ ar724x_pci_write(uint32_t reg, uint32_t uint32_t val, mask, shift; /* Register access is 32-bit aligned */ - shift = 8 * (offset & (bytes % 4)); + shift = (offset & 3) * 8; if (bytes % 4) mask = (1 << (bytes * 8)) - 1; else From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 09:01:20 2012 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 097E11065673; Sat, 7 Jan 2012 09:01:20 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D1EB58FC14; Sat, 7 Jan 2012 09:01: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 q0791JBj032868; Sat, 7 Jan 2012 09:01:19 GMT (envelope-from ume@svn.freebsd.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0791JRm032864; Sat, 7 Jan 2012 09:01:19 GMT (envelope-from ume@svn.freebsd.org) Message-Id: <201201070901.q0791JRm032864@svn.freebsd.org> From: Hajimu UMEMOTO Date: Sat, 7 Jan 2012 09:01: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: r229766 - in head: lib/libc/net sbin/route 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, 07 Jan 2012 09:01:20 -0000 Author: ume Date: Sat Jan 7 09:01:19 2012 New Revision: 229766 URL: http://svn.freebsd.org/changeset/base/229766 Log: Handle the internal scope address representation of the KAME IPv6 stack for the node-local multicast address. Spotted by: Rainer Bredehorn MFC after: 1 week Modified: head/lib/libc/net/getaddrinfo.c head/sbin/route/route.c Modified: head/lib/libc/net/getaddrinfo.c ============================================================================== --- head/lib/libc/net/getaddrinfo.c Sat Jan 7 04:13:25 2012 (r229765) +++ head/lib/libc/net/getaddrinfo.c Sat Jan 7 09:01:19 2012 (r229766) @@ -1576,7 +1576,8 @@ ip6_str2scopeid(char *scope, struct sock if (*scope == '\0') return -1; - if (IN6_IS_ADDR_LINKLOCAL(a6) || IN6_IS_ADDR_MC_LINKLOCAL(a6)) { + if (IN6_IS_ADDR_LINKLOCAL(a6) || IN6_IS_ADDR_MC_LINKLOCAL(a6) || + IN6_IS_ADDR_MC_NODELOCAL(a6)) { /* * We currently assume a one-to-one mapping between links * and interfaces, so we simply use interface indices for Modified: head/sbin/route/route.c ============================================================================== --- head/sbin/route/route.c Sat Jan 7 04:13:25 2012 (r229765) +++ head/sbin/route/route.c Sat Jan 7 09:01:19 2012 (r229766) @@ -375,7 +375,8 @@ routename(struct sockaddr *sa) #ifdef __KAME__ if (sa->sa_len == sizeof(struct sockaddr_in6) && (IN6_IS_ADDR_LINKLOCAL(&sin6.sin6_addr) || - IN6_IS_ADDR_MC_LINKLOCAL(&sin6.sin6_addr)) && + IN6_IS_ADDR_MC_LINKLOCAL(&sin6.sin6_addr) || + IN6_IS_ADDR_MC_NODELOCAL(&sin6.sin6_addr)) && sin6.sin6_scope_id == 0) { sin6.sin6_scope_id = ntohs(*(u_int16_t *)&sin6.sin6_addr.s6_addr[2]); @@ -500,7 +501,8 @@ netname(struct sockaddr *sa) #ifdef __KAME__ if (sa->sa_len == sizeof(struct sockaddr_in6) && (IN6_IS_ADDR_LINKLOCAL(&sin6.sin6_addr) || - IN6_IS_ADDR_MC_LINKLOCAL(&sin6.sin6_addr)) && + IN6_IS_ADDR_MC_LINKLOCAL(&sin6.sin6_addr) || + IN6_IS_ADDR_MC_NODELOCAL(&sin6.sin6_addr)) && sin6.sin6_scope_id == 0) { sin6.sin6_scope_id = ntohs(*(u_int16_t *)&sin6.sin6_addr.s6_addr[2]); @@ -1002,7 +1004,8 @@ getaddr(int which, char *str, struct hos memcpy(&su->sin6, res->ai_addr, sizeof(su->sin6)); #ifdef __KAME__ if ((IN6_IS_ADDR_LINKLOCAL(&su->sin6.sin6_addr) || - IN6_IS_ADDR_MC_LINKLOCAL(&su->sin6.sin6_addr)) && + IN6_IS_ADDR_MC_LINKLOCAL(&su->sin6.sin6_addr) || + IN6_IS_ADDR_MC_NODELOCAL(&su->sin6.sin6_addr)) && su->sin6.sin6_scope_id) { *(u_int16_t *)&su->sin6.sin6_addr.s6_addr[2] = htons(su->sin6.sin6_scope_id); From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 09:17:32 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id BB053106566B; Sat, 7 Jan 2012 09:17:32 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from 172-17-198-245.globalsuite.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 89443151F95; Sat, 7 Jan 2012 09:17:31 +0000 (UTC) Message-ID: <4F080DAA.9030109@FreeBSD.org> Date: Sat, 07 Jan 2012 01:17:30 -0800 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:9.0) Gecko/20111222 Thunderbird/9.0 MIME-Version: 1.0 To: Hans Petter Selasky References: <201112191535.pBJFZ6hY063597@svn.freebsd.org> In-Reply-To: <201112191535.pBJFZ6hY063597@svn.freebsd.org> X-Enigmail-Version: undefined OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228711 - head/sys/dev/usb/controller 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, 07 Jan 2012 09:17:32 -0000 Is this the change that is causing all the new usb-related messages when shutting down? If so, can it be hidden behind verbose? Doug On 12/19/2011 07:35, Hans Petter Selasky wrote: > Author: hselasky > Date: Mon Dec 19 15:35:05 2011 > New Revision: 228711 > URL: http://svn.freebsd.org/changeset/base/228711 > > Log: > Add code to wait for USB shutdown to be executed at system shutdown. > Add sysctl which can be used to skip this waiting. > > MFC after: 3 days > > Modified: > head/sys/dev/usb/controller/usb_controller.c > > Modified: head/sys/dev/usb/controller/usb_controller.c > ============================================================================== > --- head/sys/dev/usb/controller/usb_controller.c Mon Dec 19 14:55:14 2011 (r228710) > +++ head/sys/dev/usb/controller/usb_controller.c Mon Dec 19 15:35:05 2011 (r228711) > @@ -87,7 +87,12 @@ SYSCTL_INT(_hw_usb_ctrl, OID_AUTO, debug > static int usb_no_boot_wait = 0; > TUNABLE_INT("hw.usb.no_boot_wait", &usb_no_boot_wait); > SYSCTL_INT(_hw_usb, OID_AUTO, no_boot_wait, CTLFLAG_RDTUN, &usb_no_boot_wait, 0, > - "No device enumerate waiting at boot."); > + "No USB device enumerate waiting at boot."); > + > +static int usb_no_shutdown_wait = 0; > +TUNABLE_INT("hw.usb.no_shutdown_wait", &usb_no_shutdown_wait); > +SYSCTL_INT(_hw_usb, OID_AUTO, no_shutdown_wait, CTLFLAG_RDTUN, &usb_no_shutdown_wait, 0, > + "No USB device waiting at system shutdown."); > > static devclass_t usb_devclass; > > @@ -277,11 +282,20 @@ usb_shutdown(device_t dev) > return (0); > } > > + device_printf(bus->bdev, "Controller shutdown\n"); > + > USB_BUS_LOCK(bus); > usb_proc_msignal(&bus->explore_proc, > &bus->shutdown_msg[0], &bus->shutdown_msg[1]); > + if (usb_no_shutdown_wait == 0) { > + /* wait for shutdown callback to be executed */ > + usb_proc_mwait(&bus->explore_proc, > + &bus->shutdown_msg[0], &bus->shutdown_msg[1]); > + } > USB_BUS_UNLOCK(bus); > > + device_printf(bus->bdev, "Controller shutdown complete\n"); > + > return (0); > } > > -- You can observe a lot just by watching. -- Yogi Berra Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 09:39:45 2012 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 67102106566B; Sat, 7 Jan 2012 09:39:45 +0000 (UTC) (envelope-from hans.petter.selasky@bitfrost.no) Received: from smtp01-out.isp.tdc.no (smtp01-out.isp.tdc.no [85.19.210.243]) by mx1.freebsd.org (Postfix) with ESMTP id DCF618FC13; Sat, 7 Jan 2012 09:39:44 +0000 (UTC) Received: from mail.bitfrost.no (mail.bitfrost.no [85.19.79.136]) by smtp01-out.isp.tdc.no (Postfix) with ESMTP id 8C9D0215C; Sat, 7 Jan 2012 10:22:45 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at bitfrost.no From: =?windows-1252?Q?Hans_Petter_Selasky?= To: =?windows-1252?Q?Doug_Barton?= Date: Sat, 7 Jan 2012 10:22:42 +0100 Mime-Version: 1.0 In-Reply-To: <4F080DAA.9030109@FreeBSD.org> References: <4F080DAA.9030109@FreeBSD.org> X-Priority: 3 (Normal) Message-Id: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: "=?windows-1252?Q?svn-src-head=40freebsd.org?=" , "=?windows-1252?Q?svn-src-all=40freebsd.org?=" , "=?windows-1252?Q?src-committers=40freebsd.org?=" Subject: RE: svn commit: r228711 - head/sys/dev/usb/controller 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, 07 Jan 2012 09:39:45 -0000 Hi,=0D=0A=0D=0A=A0=0D=0A=0D=0AYes, that is correct.=0D=0A=0D=0A=A0=0D=0A=0D= =0AI was thinking to add something like if (bootverbose), please feel fre= e to do so. I'm very busy this weekend.=0D=0A=0D=0A=A0=0D=0A=0D=0ASome me= ssages are produced by new bus, and I'm not sure how easy those are to hi= de.=0D=0A=0D=0A=A0=0D=0A=0D=0AThe idea behind the messages, is that if an= ything hangs at shutdown, that it will easily be traced down.=0D=0A=0D=0A= =A0=0D=0A=0D=0A--HPS=0D=0A=A0=0D=0A-----Original message-----=0D=0ATo:Han= s Petter Selasky ;=20=0D=0ACC:src-committers@freebs= d.org; svn-src-all@freebsd.org; svn-src-head@freebsd.org;=20=0D=0AFrom:Do= ug Barton =0D=0ASent:Sat 07-01-2012 10:18=0D=0ASubject= :Re: svn commit: r228711 - head/sys/dev/usb/controller=0D=0AIs this the c= hange that is causing all the new usb-related messages when=0D=0Ashutting= down=3F If so, can it be hidden behind verbose=3F=0D=0A=0D=0A=0D=0ADoug=0D= =0A From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 09:41:59 2012 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 32476106564A; Sat, 7 Jan 2012 09:41:59 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1D5948FC12; Sat, 7 Jan 2012 09:41: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 q079fxn5034106; Sat, 7 Jan 2012 09:41:59 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q079fwK0034069; Sat, 7 Jan 2012 09:41:58 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201201070941.q079fwK0034069@svn.freebsd.org> From: Kevin Lo Date: Sat, 7 Jan 2012 09:41: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: r229767 - in head/sys/dev: an bfe bm bxe e1000 ep ex firewire ie if_ndis ixgb ixgbe lge msk my nfe nve qlxgb rt sis sk sn snc stge tl tsec usb/net vx vxge wb xen/netback xen/netfront 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, 07 Jan 2012 09:41:59 -0000 Author: kevlo Date: Sat Jan 7 09:41:57 2012 New Revision: 229767 URL: http://svn.freebsd.org/changeset/base/229767 Log: ether_ifattach() sets if_mtu to ETHERMTU, don't bother set it again Reviewed by: yongari Modified: head/sys/dev/an/if_an.c head/sys/dev/bfe/if_bfe.c head/sys/dev/bm/if_bm.c head/sys/dev/bxe/if_bxe.c head/sys/dev/e1000/if_em.c head/sys/dev/e1000/if_igb.c head/sys/dev/e1000/if_lem.c head/sys/dev/ep/if_ep.c head/sys/dev/ex/if_ex.c head/sys/dev/firewire/if_fwe.c head/sys/dev/ie/if_ie.c head/sys/dev/if_ndis/if_ndis.c head/sys/dev/ixgb/if_ixgb.c head/sys/dev/ixgbe/ixgbe.c head/sys/dev/ixgbe/ixv.c head/sys/dev/lge/if_lge.c head/sys/dev/msk/if_msk.c head/sys/dev/my/if_my.c head/sys/dev/nfe/if_nfe.c head/sys/dev/nve/if_nve.c head/sys/dev/qlxgb/qla_os.c head/sys/dev/rt/if_rt.c head/sys/dev/sis/if_sis.c head/sys/dev/sk/if_sk.c head/sys/dev/sn/if_sn.c head/sys/dev/snc/dp83932.c head/sys/dev/stge/if_stge.c head/sys/dev/tl/if_tl.c head/sys/dev/tsec/if_tsec.c head/sys/dev/usb/net/usb_ethernet.c head/sys/dev/vx/if_vx.c head/sys/dev/vxge/vxge.c head/sys/dev/wb/if_wb.c head/sys/dev/xen/netback/netback.c head/sys/dev/xen/netfront/netfront.c Modified: head/sys/dev/an/if_an.c ============================================================================== --- head/sys/dev/an/if_an.c Sat Jan 7 09:01:19 2012 (r229766) +++ head/sys/dev/an/if_an.c Sat Jan 7 09:41:57 2012 (r229767) @@ -761,7 +761,6 @@ an_attach(struct an_softc *sc, int flags ifp->if_softc = sc; if_initname(ifp, device_get_name(sc->an_dev), device_get_unit(sc->an_dev)); - ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = an_ioctl; ifp->if_start = an_start; Modified: head/sys/dev/bfe/if_bfe.c ============================================================================== --- head/sys/dev/bfe/if_bfe.c Sat Jan 7 09:01:19 2012 (r229766) +++ head/sys/dev/bfe/if_bfe.c Sat Jan 7 09:41:57 2012 (r229767) @@ -489,7 +489,6 @@ bfe_attach(device_t dev) ifp->if_ioctl = bfe_ioctl; ifp->if_start = bfe_start; ifp->if_init = bfe_init; - ifp->if_mtu = ETHERMTU; IFQ_SET_MAXLEN(&ifp->if_snd, BFE_TX_QLEN); ifp->if_snd.ifq_drv_maxlen = BFE_TX_QLEN; IFQ_SET_READY(&ifp->if_snd); Modified: head/sys/dev/bm/if_bm.c ============================================================================== --- head/sys/dev/bm/if_bm.c Sat Jan 7 09:01:19 2012 (r229766) +++ head/sys/dev/bm/if_bm.c Sat Jan 7 09:41:57 2012 (r229767) @@ -468,7 +468,6 @@ bm_attach(device_t dev) if_initname(ifp, device_get_name(sc->sc_dev), device_get_unit(sc->sc_dev)); - ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_start = bm_start; ifp->if_ioctl = bm_ioctl; Modified: head/sys/dev/bxe/if_bxe.c ============================================================================== --- head/sys/dev/bxe/if_bxe.c Sat Jan 7 09:01:19 2012 (r229766) +++ head/sys/dev/bxe/if_bxe.c Sat Jan 7 09:41:57 2012 (r229767) @@ -2136,7 +2136,6 @@ bxe_attach(device_t dev) #endif ifp->if_init = bxe_init; - ifp->if_mtu = ETHERMTU; ifp->if_hwassist = BXE_IF_HWASSIST; ifp->if_capabilities = BXE_IF_CAPABILITIES; /* TPA not enabled by default. */ Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Sat Jan 7 09:01:19 2012 (r229766) +++ head/sys/dev/e1000/if_em.c Sat Jan 7 09:41:57 2012 (r229767) @@ -2898,7 +2898,6 @@ em_setup_interface(device_t dev, struct return (-1); } if_initname(ifp, device_get_name(dev), device_get_unit(dev)); - ifp->if_mtu = ETHERMTU; ifp->if_init = em_init; ifp->if_softc = adapter; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; Modified: head/sys/dev/e1000/if_igb.c ============================================================================== --- head/sys/dev/e1000/if_igb.c Sat Jan 7 09:01:19 2012 (r229766) +++ head/sys/dev/e1000/if_igb.c Sat Jan 7 09:41:57 2012 (r229767) @@ -2899,7 +2899,6 @@ igb_setup_interface(device_t dev, struct return (-1); } if_initname(ifp, device_get_name(dev), device_get_unit(dev)); - ifp->if_mtu = ETHERMTU; ifp->if_init = igb_init; ifp->if_softc = adapter; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; Modified: head/sys/dev/e1000/if_lem.c ============================================================================== --- head/sys/dev/e1000/if_lem.c Sat Jan 7 09:01:19 2012 (r229766) +++ head/sys/dev/e1000/if_lem.c Sat Jan 7 09:41:57 2012 (r229767) @@ -2354,7 +2354,6 @@ lem_setup_interface(device_t dev, struct return (-1); } if_initname(ifp, device_get_name(dev), device_get_unit(dev)); - ifp->if_mtu = ETHERMTU; ifp->if_init = lem_init; ifp->if_softc = adapter; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; Modified: head/sys/dev/ep/if_ep.c ============================================================================== --- head/sys/dev/ep/if_ep.c Sat Jan 7 09:01:19 2012 (r229766) +++ head/sys/dev/ep/if_ep.c Sat Jan 7 09:41:57 2012 (r229767) @@ -301,7 +301,6 @@ ep_attach(struct ep_softc *sc) ifp->if_softc = sc; if_initname(ifp, device_get_name(sc->dev), device_get_unit(sc->dev)); - ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_start = epstart; ifp->if_ioctl = epioctl; Modified: head/sys/dev/ex/if_ex.c ============================================================================== --- head/sys/dev/ex/if_ex.c Sat Jan 7 09:01:19 2012 (r229766) +++ head/sys/dev/ex/if_ex.c Sat Jan 7 09:41:57 2012 (r229767) @@ -232,7 +232,6 @@ ex_attach(device_t dev) */ ifp->if_softc = sc; if_initname(ifp, device_get_name(dev), device_get_unit(dev)); - ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST; ifp->if_start = ex_start; ifp->if_ioctl = ex_ioctl; Modified: head/sys/dev/firewire/if_fwe.c ============================================================================== --- head/sys/dev/firewire/if_fwe.c Sat Jan 7 09:01:19 2012 (r229766) +++ head/sys/dev/firewire/if_fwe.c Sat Jan 7 09:41:57 2012 (r229767) @@ -214,7 +214,6 @@ fwe_attach(device_t dev) #endif ifp->if_start = fwe_start; ifp->if_ioctl = fwe_ioctl; - ifp->if_mtu = ETHERMTU; ifp->if_flags = (IFF_BROADCAST|IFF_SIMPLEX|IFF_MULTICAST); ifp->if_snd.ifq_maxlen = TX_MAX_QUEUE; Modified: head/sys/dev/ie/if_ie.c ============================================================================== --- head/sys/dev/ie/if_ie.c Sat Jan 7 09:01:19 2012 (r229766) +++ head/sys/dev/ie/if_ie.c Sat Jan 7 09:41:57 2012 (r229767) @@ -313,7 +313,6 @@ ie_attach(device_t dev) ifp->if_softc = sc; if_initname(ifp, device_get_name(dev), device_get_unit(dev)); - ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_start = iestart; ifp->if_ioctl = ieioctl; Modified: head/sys/dev/if_ndis/if_ndis.c ============================================================================== --- head/sys/dev/if_ndis/if_ndis.c Sat Jan 7 09:01:19 2012 (r229766) +++ head/sys/dev/if_ndis/if_ndis.c Sat Jan 7 09:41:57 2012 (r229767) @@ -714,7 +714,6 @@ ndis_attach(dev) ndis_probe_offload(sc); if_initname(ifp, device_get_name(dev), device_get_unit(dev)); - ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = ndis_ioctl; ifp->if_start = ndis_start; Modified: head/sys/dev/ixgb/if_ixgb.c ============================================================================== --- head/sys/dev/ixgb/if_ixgb.c Sat Jan 7 09:01:19 2012 (r229766) +++ head/sys/dev/ixgb/if_ixgb.c Sat Jan 7 09:41:57 2012 (r229767) @@ -1354,7 +1354,6 @@ ixgb_setup_interface(device_t dev, struc ifp->if_unit = device_get_unit(dev); ifp->if_name = "ixgb"; #endif - ifp->if_mtu = ETHERMTU; ifp->if_baudrate = 1000000000; ifp->if_init = ixgb_init; ifp->if_softc = adapter; Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Sat Jan 7 09:01:19 2012 (r229766) +++ head/sys/dev/ixgbe/ixgbe.c Sat Jan 7 09:41:57 2012 (r229767) @@ -2431,7 +2431,6 @@ ixgbe_setup_interface(device_t dev, stru return (-1); } if_initname(ifp, device_get_name(dev), device_get_unit(dev)); - ifp->if_mtu = ETHERMTU; ifp->if_baudrate = 1000000000; ifp->if_init = ixgbe_init; ifp->if_softc = adapter; Modified: head/sys/dev/ixgbe/ixv.c ============================================================================== --- head/sys/dev/ixgbe/ixv.c Sat Jan 7 09:01:19 2012 (r229766) +++ head/sys/dev/ixgbe/ixv.c Sat Jan 7 09:41:57 2012 (r229767) @@ -1829,7 +1829,6 @@ ixv_setup_interface(device_t dev, struct if (ifp == NULL) panic("%s: can not if_alloc()\n", device_get_nameunit(dev)); if_initname(ifp, device_get_name(dev), device_get_unit(dev)); - ifp->if_mtu = ETHERMTU; ifp->if_baudrate = 1000000000; ifp->if_init = ixv_init; ifp->if_softc = adapter; Modified: head/sys/dev/lge/if_lge.c ============================================================================== --- head/sys/dev/lge/if_lge.c Sat Jan 7 09:01:19 2012 (r229766) +++ head/sys/dev/lge/if_lge.c Sat Jan 7 09:41:57 2012 (r229767) @@ -536,7 +536,6 @@ lge_attach(dev) } ifp->if_softc = sc; if_initname(ifp, device_get_name(dev), device_get_unit(dev)); - ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = lge_ioctl; ifp->if_start = lge_start; Modified: head/sys/dev/msk/if_msk.c ============================================================================== --- head/sys/dev/msk/if_msk.c Sat Jan 7 09:01:19 2012 (r229766) +++ head/sys/dev/msk/if_msk.c Sat Jan 7 09:41:57 2012 (r229767) @@ -1636,7 +1636,6 @@ msk_attach(device_t dev) } ifp->if_softc = sc_if; if_initname(ifp, device_get_name(dev), device_get_unit(dev)); - ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_capabilities = IFCAP_TXCSUM | IFCAP_TSO4; /* Modified: head/sys/dev/my/if_my.c ============================================================================== --- head/sys/dev/my/if_my.c Sat Jan 7 09:01:19 2012 (r229766) +++ head/sys/dev/my/if_my.c Sat Jan 7 09:41:57 2012 (r229767) @@ -895,7 +895,6 @@ my_attach(device_t dev) } ifp->if_softc = sc; if_initname(ifp, device_get_name(dev), device_get_unit(dev)); - ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = my_ioctl; ifp->if_start = my_start; Modified: head/sys/dev/nfe/if_nfe.c ============================================================================== --- head/sys/dev/nfe/if_nfe.c Sat Jan 7 09:01:19 2012 (r229766) +++ head/sys/dev/nfe/if_nfe.c Sat Jan 7 09:41:57 2012 (r229767) @@ -565,7 +565,6 @@ nfe_attach(device_t dev) ifp->if_softc = sc; if_initname(ifp, device_get_name(dev), device_get_unit(dev)); - ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = nfe_ioctl; ifp->if_start = nfe_start; Modified: head/sys/dev/nve/if_nve.c ============================================================================== --- head/sys/dev/nve/if_nve.c Sat Jan 7 09:01:19 2012 (r229766) +++ head/sys/dev/nve/if_nve.c Sat Jan 7 09:41:57 2012 (r229767) @@ -529,7 +529,6 @@ nve_attach(device_t dev) ifp->if_ioctl = nve_ioctl; ifp->if_start = nve_ifstart; ifp->if_init = nve_init; - ifp->if_mtu = ETHERMTU; ifp->if_baudrate = IF_Mbps(100); IFQ_SET_MAXLEN(&ifp->if_snd, TX_RING_SIZE - 1); ifp->if_snd.ifq_drv_maxlen = TX_RING_SIZE - 1; Modified: head/sys/dev/qlxgb/qla_os.c ============================================================================== --- head/sys/dev/qlxgb/qla_os.c Sat Jan 7 09:01:19 2012 (r229766) +++ head/sys/dev/qlxgb/qla_os.c Sat Jan 7 09:41:57 2012 (r229767) @@ -660,7 +660,6 @@ qla_init_ifnet(device_t dev, qla_host_t if_initname(ifp, device_get_name(dev), device_get_unit(dev)); - ifp->if_mtu = ETHERMTU; ifp->if_baudrate = (1 * 1000 * 1000 *1000); ifp->if_init = qla_init; ifp->if_softc = ha; Modified: head/sys/dev/rt/if_rt.c ============================================================================== --- head/sys/dev/rt/if_rt.c Sat Jan 7 09:01:19 2012 (r229766) +++ head/sys/dev/rt/if_rt.c Sat Jan 7 09:41:57 2012 (r229767) @@ -383,7 +383,6 @@ rt_attach(device_t dev) ifp->if_init = rt_init; ifp->if_ioctl = rt_ioctl; ifp->if_start = rt_start; - ifp->if_mtu = ETHERMTU; #define RT_TX_QLEN 256 IFQ_SET_MAXLEN(&ifp->if_snd, RT_TX_QLEN); Modified: head/sys/dev/sis/if_sis.c ============================================================================== --- head/sys/dev/sis/if_sis.c Sat Jan 7 09:01:19 2012 (r229766) +++ head/sys/dev/sis/if_sis.c Sat Jan 7 09:41:57 2012 (r229767) @@ -1054,7 +1054,6 @@ sis_attach(device_t dev) } ifp->if_softc = sc; if_initname(ifp, device_get_name(dev), device_get_unit(dev)); - ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = sis_ioctl; ifp->if_start = sis_start; Modified: head/sys/dev/sk/if_sk.c ============================================================================== --- head/sys/dev/sk/if_sk.c Sat Jan 7 09:01:19 2012 (r229766) +++ head/sys/dev/sk/if_sk.c Sat Jan 7 09:41:57 2012 (r229767) @@ -1350,7 +1350,6 @@ sk_attach(dev) } ifp->if_softc = sc_if; if_initname(ifp, device_get_name(dev), device_get_unit(dev)); - ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; /* * SK_GENESIS has a bug in checksum offload - From linux. Modified: head/sys/dev/sn/if_sn.c ============================================================================== --- head/sys/dev/sn/if_sn.c Sat Jan 7 09:01:19 2012 (r229766) +++ head/sys/dev/sn/if_sn.c Sat Jan 7 09:41:57 2012 (r229767) @@ -201,7 +201,6 @@ sn_attach(device_t dev) } ifp->if_softc = sc; if_initname(ifp, device_get_name(dev), device_get_unit(dev)); - ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_start = snstart; ifp->if_ioctl = snioctl; Modified: head/sys/dev/snc/dp83932.c ============================================================================== --- head/sys/dev/snc/dp83932.c Sat Jan 7 09:01:19 2012 (r229766) +++ head/sys/dev/snc/dp83932.c Sat Jan 7 09:41:57 2012 (r229767) @@ -176,7 +176,6 @@ sncconfig(sc, media, nmedia, defmedia, m ifp->if_start = sncstart; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_init = sncinit; - ifp->if_mtu = ETHERMTU; IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); /* Initialize media goo. */ Modified: head/sys/dev/stge/if_stge.c ============================================================================== --- head/sys/dev/stge/if_stge.c Sat Jan 7 09:01:19 2012 (r229766) +++ head/sys/dev/stge/if_stge.c Sat Jan 7 09:41:57 2012 (r229767) @@ -573,7 +573,6 @@ stge_attach(device_t dev) ifp->if_ioctl = stge_ioctl; ifp->if_start = stge_start; ifp->if_init = stge_init; - ifp->if_mtu = ETHERMTU; ifp->if_snd.ifq_drv_maxlen = STGE_TX_RING_CNT - 1; IFQ_SET_MAXLEN(&ifp->if_snd, ifp->if_snd.ifq_drv_maxlen); IFQ_SET_READY(&ifp->if_snd); Modified: head/sys/dev/tl/if_tl.c ============================================================================== --- head/sys/dev/tl/if_tl.c Sat Jan 7 09:01:19 2012 (r229766) +++ head/sys/dev/tl/if_tl.c Sat Jan 7 09:41:57 2012 (r229767) @@ -1175,7 +1175,6 @@ tl_attach(dev) ifp->if_ioctl = tl_ioctl; ifp->if_start = tl_start; ifp->if_init = tl_init; - ifp->if_mtu = ETHERMTU; ifp->if_snd.ifq_maxlen = TL_TX_LIST_CNT - 1; ifp->if_capabilities |= IFCAP_VLAN_MTU; ifp->if_capenable |= IFCAP_VLAN_MTU; Modified: head/sys/dev/tsec/if_tsec.c ============================================================================== --- head/sys/dev/tsec/if_tsec.c Sat Jan 7 09:01:19 2012 (r229766) +++ head/sys/dev/tsec/if_tsec.c Sat Jan 7 09:41:57 2012 (r229767) @@ -247,7 +247,6 @@ tsec_attach(struct tsec_softc *sc) ifp->if_softc = sc; if_initname(ifp, device_get_name(sc->dev), device_get_unit(sc->dev)); - ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_SIMPLEX | IFF_MULTICAST | IFF_BROADCAST; ifp->if_init = tsec_init; ifp->if_start = tsec_start; Modified: head/sys/dev/usb/net/usb_ethernet.c ============================================================================== --- head/sys/dev/usb/net/usb_ethernet.c Sat Jan 7 09:01:19 2012 (r229766) +++ head/sys/dev/usb/net/usb_ethernet.c Sat Jan 7 09:41:57 2012 (r229767) @@ -219,7 +219,6 @@ ue_attach_post_task(struct usb_proc_msg ue->ue_ifp = ifp; error = ue->ue_methods->ue_attach_post_sub(ue); } else { - ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; if (ue->ue_methods->ue_ioctl != NULL) ifp->if_ioctl = ue->ue_methods->ue_ioctl; Modified: head/sys/dev/vx/if_vx.c ============================================================================== --- head/sys/dev/vx/if_vx.c Sat Jan 7 09:01:19 2012 (r229766) +++ head/sys/dev/vx/if_vx.c Sat Jan 7 09:41:57 2012 (r229767) @@ -188,7 +188,6 @@ vx_attach(device_t dev) eaddr[(i << 1) + 1] = x; } - ifp->if_mtu = ETHERMTU; ifp->if_snd.ifq_maxlen = ifqmaxlen; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_start = vx_start; Modified: head/sys/dev/vxge/vxge.c ============================================================================== --- head/sys/dev/vxge/vxge.c Sat Jan 7 09:01:19 2012 (r229766) +++ head/sys/dev/vxge/vxge.c Sat Jan 7 09:41:57 2012 (r229767) @@ -1378,7 +1378,6 @@ vxge_ifp_setup(device_t ndev) /* Initialize interface ifnet structure */ if_initname(ifp, device_get_name(ndev), device_get_unit(ndev)); - ifp->if_mtu = ETHERMTU; ifp->if_baudrate = VXGE_BAUDRATE; ifp->if_init = vxge_init; ifp->if_softc = vdev; Modified: head/sys/dev/wb/if_wb.c ============================================================================== --- head/sys/dev/wb/if_wb.c Sat Jan 7 09:01:19 2012 (r229766) +++ head/sys/dev/wb/if_wb.c Sat Jan 7 09:41:57 2012 (r229767) @@ -660,7 +660,6 @@ wb_attach(dev) } ifp->if_softc = sc; if_initname(ifp, device_get_name(dev), device_get_unit(dev)); - ifp->if_mtu = ETHERMTU; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = wb_ioctl; ifp->if_start = wb_start; Modified: head/sys/dev/xen/netback/netback.c ============================================================================== --- head/sys/dev/xen/netback/netback.c Sat Jan 7 09:01:19 2012 (r229766) +++ head/sys/dev/xen/netback/netback.c Sat Jan 7 09:41:57 2012 (r229767) @@ -375,7 +375,6 @@ netif_create(int handle, struct xenbus_d ifp->if_output = ether_output; ifp->if_start = netback_start; ifp->if_ioctl = netback_ioctl; - ifp->if_mtu = ETHERMTU; ifp->if_snd.ifq_maxlen = NET_TX_RING_SIZE - 1; DPRINTF("Created %s for domid=%d handle=%d\n", IFNAME(netif), netif->domid, netif->handle); Modified: head/sys/dev/xen/netfront/netfront.c ============================================================================== --- head/sys/dev/xen/netfront/netfront.c Sat Jan 7 09:01:19 2012 (r229766) +++ head/sys/dev/xen/netfront/netfront.c Sat Jan 7 09:41:57 2012 (r229767) @@ -2145,7 +2145,6 @@ create_netdev(device_t dev) ifp->if_watchdog = xn_watchdog; #endif ifp->if_init = xn_ifinit; - ifp->if_mtu = ETHERMTU; ifp->if_snd.ifq_maxlen = NET_TX_RING_SIZE - 1; ifp->if_hwassist = XN_CSUM_FEATURES; From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 10:33:02 2012 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 7E891106564A; Sat, 7 Jan 2012 10:33: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 6B6AA8FC0C; Sat, 7 Jan 2012 10:33: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 q07AX2tm035786; Sat, 7 Jan 2012 10:33:02 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q07AX21h035775; Sat, 7 Jan 2012 10:33:02 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201071033.q07AX21h035775@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 7 Jan 2012 10:33: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: r229768 - in head: include lib/libc/gen 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: Sat, 07 Jan 2012 10:33:02 -0000 Author: kib Date: Sat Jan 7 10:33:01 2012 New Revision: 229768 URL: http://svn.freebsd.org/changeset/base/229768 Log: Implement fdlopen(3), an rtld interface to load shared object by file descriptor. Requested and tested by: des (previous version) Reviewed by: des, kan (previous version) MFC after: 2 weeks Modified: head/include/dlfcn.h head/lib/libc/gen/Makefile.inc head/lib/libc/gen/Symbol.map head/lib/libc/gen/dlfcn.c head/lib/libc/gen/dlopen.3 head/libexec/rtld-elf/Symbol.map head/libexec/rtld-elf/rtld.c Modified: head/include/dlfcn.h ============================================================================== --- head/include/dlfcn.h Sat Jan 7 09:41:57 2012 (r229767) +++ head/include/dlfcn.h Sat Jan 7 10:33:01 2012 (r229768) @@ -118,6 +118,7 @@ void *dlopen(const char *, int); void *dlsym(void * __restrict, const char * __restrict); #if __BSD_VISIBLE +void *fdlopen(int, int); int dladdr(const void * __restrict, Dl_info * __restrict); dlfunc_t dlfunc(void * __restrict, const char * __restrict); int dlinfo(void * __restrict, int, void * __restrict); Modified: head/lib/libc/gen/Makefile.inc ============================================================================== --- head/lib/libc/gen/Makefile.inc Sat Jan 7 09:41:57 2012 (r229767) +++ head/lib/libc/gen/Makefile.inc Sat Jan 7 10:33:01 2012 (r229768) @@ -95,8 +95,8 @@ MLINKS+=directory.3 closedir.3 directory directory.3 fdopendir.3 \ directory.3 readdir.3 directory.3 readdir_r.3 directory.3 rewinddir.3 \ directory.3 seekdir.3 directory.3 telldir.3 -MLINKS+=dlopen.3 dlclose.3 dlopen.3 dlerror.3 dlopen.3 dlfunc.3 \ - dlopen.3 dlsym.3 +MLINKS+=dlopen.3 fdlopen.3 dlopen.3 dlclose.3 dlopen.3 dlerror.3 \ + dlopen.3 dlfunc.3 dlopen.3 dlsym.3 MLINKS+=err.3 err_set_exit.3 err.3 err_set_file.3 err.3 errc.3 err.3 errx.3 \ err.3 verr.3 err.3 verrc.3 err.3 verrx.3 err.3 vwarn.3 err.3 vwarnc.3 \ err.3 vwarnx.3 err.3 warnc.3 err.3 warn.3 err.3 warnx.3 Modified: head/lib/libc/gen/Symbol.map ============================================================================== --- head/lib/libc/gen/Symbol.map Sat Jan 7 09:41:57 2012 (r229767) +++ head/lib/libc/gen/Symbol.map Sat Jan 7 10:33:01 2012 (r229768) @@ -382,6 +382,7 @@ FBSD_1.2 { }; FBSD_1.3 { + fdlopen; __FreeBSD_libc_enter_restricted_mode; }; Modified: head/lib/libc/gen/dlfcn.c ============================================================================== --- head/lib/libc/gen/dlfcn.c Sat Jan 7 09:41:57 2012 (r229767) +++ head/lib/libc/gen/dlfcn.c Sat Jan 7 10:33:01 2012 (r229768) @@ -147,6 +147,15 @@ dl_iterate_phdr(int (*callback)(struct d return 0; } +#pragma weak fdlopen +void * +fdlopen(int fd, int mode) +{ + + _rtld_error(sorry); + return NULL; +} + #pragma weak _rtld_atfork_pre void _rtld_atfork_pre(int *locks) Modified: head/lib/libc/gen/dlopen.3 ============================================================================== --- head/lib/libc/gen/dlopen.3 Sat Jan 7 09:41:57 2012 (r229767) +++ head/lib/libc/gen/dlopen.3 Sat Jan 7 10:33:01 2012 (r229768) @@ -32,11 +32,12 @@ .\" @(#) dlopen.3 1.6 90/01/31 SMI .\" $FreeBSD$ .\" -.Dd July 7, 2009 +.Dd December 21, 2011 .Dt DLOPEN 3 .Os .Sh NAME .Nm dlopen , +.Nm fdlopen , .Nm dlsym , .Nm dlfunc , .Nm dlerror , @@ -49,6 +50,8 @@ .Ft void * .Fn dlopen "const char *path" "int mode" .Ft void * +.Fn fdlopen "int fd" "int mode" +.Ft void * .Fn dlsym "void * restrict handle" "const char * restrict symbol" .Ft dlfunc_t .Fn dlfunc "void * restrict handle" "const char * restrict symbol" @@ -164,6 +167,36 @@ be interrogated with .Fn dlerror . .Pp The +.Fn fdlopen +function is similar to +.Fn dlopen , +but it takes the file descriptor argument +.Fa fd , +which is used for the file operations needed to load an object +into the address space. +The file descriptor +.Fa fd +is not closed by the function regardless a result of execution, +but a duplicate of the file descriptor is. +This may be important if a +.Xr lockf 3 +lock is held on the passed descriptor. +The +.Fa fd +argument -1 is interpreted as a reference to the main +executable of the process, similar to +.Va NULL +value for the +.Fa name +argument to +.Fn dlopen . +The +.Fn fdlopen +function can be used by the code that needs to perform +additional checks on the loaded objects, to prevent races with +symlinking or renames. +.Pp +The .Fn dlsym function returns the address binding of the symbol described in the null-terminated @@ -354,6 +387,7 @@ option to the C language compiler. .Sh ERRORS The .Fn dlopen , +.Fn fdlopen , .Fn dlsym , and .Fn dlfunc Modified: head/libexec/rtld-elf/Symbol.map ============================================================================== --- head/libexec/rtld-elf/Symbol.map Sat Jan 7 09:41:57 2012 (r229767) +++ head/libexec/rtld-elf/Symbol.map Sat Jan 7 10:33:01 2012 (r229768) @@ -18,6 +18,10 @@ FBSD_1.0 { __tls_get_addr; }; +FBSD_1.3 { + fdlopen; +}; + FBSDprivate_1.0 { _rtld_thread_init; _rtld_allocate_tls; Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Sat Jan 7 09:41:57 2012 (r229767) +++ head/libexec/rtld-elf/rtld.c Sat Jan 7 10:33:01 2012 (r229768) @@ -83,7 +83,7 @@ static void digest_dynamic2(Obj_Entry *, static void digest_dynamic(Obj_Entry *, int); static Obj_Entry *digest_phdr(const Elf_Phdr *, int, caddr_t, const char *); static Obj_Entry *dlcheck(void *); -static Obj_Entry *dlopen_object(const char *name, Obj_Entry *refobj, +static Obj_Entry *dlopen_object(const char *name, int fd, Obj_Entry *refobj, int lo_flags, int mode); static Obj_Entry *do_load_object(int, const char *, char *, struct stat *, int); static int do_search_info(const Obj_Entry *obj, int, struct dl_serinfo *); @@ -103,7 +103,7 @@ static void load_filtees(Obj_Entry *, in static void unload_filtees(Obj_Entry *); static int load_needed_objects(Obj_Entry *, int); static int load_preload_objects(void); -static Obj_Entry *load_object(const char *, const Obj_Entry *, int); +static Obj_Entry *load_object(const char *, int fd, const Obj_Entry *, int); static void map_stacks_exec(RtldLockState *); static Obj_Entry *obj_from_addr(const void *); static void objlist_call_fini(Objlist *, Obj_Entry *, RtldLockState *); @@ -120,6 +120,7 @@ static int resolve_objects_ifunc(Obj_Ent RtldLockState *lockstate); static int rtld_dirname(const char *, char *); static int rtld_dirname_abs(const char *, char *); +static void *rtld_dlopen(const char *name, int fd, int mode); static void rtld_exit(void); static char *search_library_path(const char *, const char *); static const void **get_program_var_addr(const char *, RtldLockState *); @@ -1544,7 +1545,7 @@ load_filtee1(Obj_Entry *obj, Needed_Entr { for (; needed != NULL; needed = needed->next) { - needed->obj = dlopen_object(obj->strtab + needed->name, obj, + needed->obj = dlopen_object(obj->strtab + needed->name, -1, obj, flags, ((ld_loadfltr || obj->z_loadfltr) ? RTLD_NOW : RTLD_LAZY) | RTLD_LOCAL); } @@ -1568,7 +1569,7 @@ process_needed(Obj_Entry *obj, Needed_En Obj_Entry *obj1; for (; needed != NULL; needed = needed->next) { - obj1 = needed->obj = load_object(obj->strtab + needed->name, obj, + obj1 = needed->obj = load_object(obj->strtab + needed->name, -1, obj, flags & ~RTLD_LO_NOLOAD); if (obj1 == NULL && !ld_tracing && (flags & RTLD_LO_FILTEES) == 0) return (-1); @@ -1615,7 +1616,7 @@ load_preload_objects(void) savech = p[len]; p[len] = '\0'; - if (load_object(p, NULL, 0) == NULL) + if (load_object(p, -1, NULL, 0) == NULL) return -1; /* XXX - cleanup */ p[len] = savech; p += len; @@ -1625,43 +1626,68 @@ load_preload_objects(void) return 0; } +static const char * +printable_path(const char *path) +{ + + return (path == NULL ? "" : path); +} + /* - * Load a shared object into memory, if it is not already loaded. + * Load a shared object into memory, if it is not already loaded. The + * object may be specified by name or by user-supplied file descriptor + * fd_u. In the later case, the fd_u descriptor is not closed, but its + * duplicate is. * * Returns a pointer to the Obj_Entry for the object. Returns NULL * on failure. */ static Obj_Entry * -load_object(const char *name, const Obj_Entry *refobj, int flags) +load_object(const char *name, int fd_u, const Obj_Entry *refobj, int flags) { Obj_Entry *obj; - int fd = -1; + int fd; struct stat sb; char *path; - for (obj = obj_list->next; obj != NULL; obj = obj->next) - if (object_match_name(obj, name)) - return obj; + if (name != NULL) { + for (obj = obj_list->next; obj != NULL; obj = obj->next) { + if (object_match_name(obj, name)) + return (obj); + } - path = find_library(name, refobj); - if (path == NULL) - return NULL; + path = find_library(name, refobj); + if (path == NULL) + return (NULL); + } else + path = NULL; /* - * If we didn't find a match by pathname, open the file and check - * again by device and inode. This avoids false mismatches caused - * by multiple links or ".." in pathnames. + * If we didn't find a match by pathname, or the name is not + * supplied, open the file and check again by device and inode. + * This avoids false mismatches caused by multiple links or ".." + * in pathnames. * * To avoid a race, we open the file and use fstat() rather than * using stat(). */ - if ((fd = open(path, O_RDONLY)) == -1) { - _rtld_error("Cannot open \"%s\"", path); - free(path); - return NULL; + fd = -1; + if (fd_u == -1) { + if ((fd = open(path, O_RDONLY)) == -1) { + _rtld_error("Cannot open \"%s\"", path); + free(path); + return (NULL); + } + } else { + fd = dup(fd_u); + if (fd == -1) { + _rtld_error("Cannot dup fd"); + free(path); + return (NULL); + } } if (fstat(fd, &sb) == -1) { - _rtld_error("Cannot fstat \"%s\"", path); + _rtld_error("Cannot fstat \"%s\"", printable_path(path)); close(fd); free(path); return NULL; @@ -1669,7 +1695,7 @@ load_object(const char *name, const Obj_ for (obj = obj_list->next; obj != NULL; obj = obj->next) if (obj->ino == sb.st_ino && obj->dev == sb.st_dev) break; - if (obj != NULL) { + if (obj != NULL && name != NULL) { object_add_name(obj, name); free(path); close(fd); @@ -1703,20 +1729,25 @@ do_load_object(int fd, const char *name, */ if (dangerous_ld_env) { if (fstatfs(fd, &fs) != 0) { - _rtld_error("Cannot fstatfs \"%s\"", path); - return NULL; + _rtld_error("Cannot fstatfs \"%s\"", printable_path(path)); + return NULL; } if (fs.f_flags & MNT_NOEXEC) { _rtld_error("Cannot execute objects on %s\n", fs.f_mntonname); return NULL; } } - dbg("loading \"%s\"", path); - obj = map_object(fd, path, sbp); + dbg("loading \"%s\"", printable_path(path)); + obj = map_object(fd, printable_path(path), sbp); if (obj == NULL) return NULL; - object_add_name(obj, name); + /* + * If DT_SONAME is present in the object, digest_dynamic2 already + * added it to the object names. + */ + if (name != NULL) + object_add_name(obj, name); obj->path = path; digest_dynamic(obj, 0); if (obj->z_noopen && (flags & (RTLD_LO_DLOPEN | RTLD_LO_TRACE)) == @@ -2212,6 +2243,20 @@ dllockinit(void *context, void * dlopen(const char *name, int mode) { + + return (rtld_dlopen(name, -1, mode)); +} + +void * +fdlopen(int fd, int mode) +{ + + return (rtld_dlopen(NULL, fd, mode)); +} + +static void * +rtld_dlopen(const char *name, int fd, int mode) +{ RtldLockState lockstate; int lo_flags; @@ -2232,7 +2277,7 @@ dlopen(const char *name, int mode) if (ld_tracing != NULL) lo_flags |= RTLD_LO_TRACE; - return (dlopen_object(name, obj_main, lo_flags, + return (dlopen_object(name, fd, obj_main, lo_flags, mode & (RTLD_MODEMASK | RTLD_GLOBAL))); } @@ -2247,7 +2292,8 @@ dlopen_cleanup(Obj_Entry *obj) } static Obj_Entry * -dlopen_object(const char *name, Obj_Entry *refobj, int lo_flags, int mode) +dlopen_object(const char *name, int fd, Obj_Entry *refobj, int lo_flags, + int mode) { Obj_Entry **old_obj_tail; Obj_Entry *obj; @@ -2262,11 +2308,11 @@ dlopen_object(const char *name, Obj_Entr old_obj_tail = obj_tail; obj = NULL; - if (name == NULL) { + if (name == NULL && fd == -1) { obj = obj_main; obj->refcount++; } else { - obj = load_object(name, refobj, lo_flags); + obj = load_object(name, fd, refobj, lo_flags); } if (obj) { From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 10:49:05 2012 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 1C553106567B; Sat, 7 Jan 2012 10:49:04 +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 941FE8FC18; Sat, 7 Jan 2012 10:49:04 +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 q07An49q036321; Sat, 7 Jan 2012 10:49:04 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q07An4Ru036319; Sat, 7 Jan 2012 10:49:04 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201071049.q07An4Ru036319@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 7 Jan 2012 10:49:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229769 - stable/9/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: Sat, 07 Jan 2012 10:49:05 -0000 Author: kib Date: Sat Jan 7 10:49:04 2012 New Revision: 229769 URL: http://svn.freebsd.org/changeset/base/229769 Log: MFC r229508: Postpone the resolution of IRELATIVE relocations and IFUNC-targeted relocations until tls is initialized and stacks permissions correctly set. This allows the ifunc to call malloc(3) and some other heavy services. Add debug banner. Modified: stable/9/libexec/rtld-elf/rtld.c Directory Properties: stable/9/libexec/rtld-elf/ (props changed) Modified: stable/9/libexec/rtld-elf/rtld.c ============================================================================== --- stable/9/libexec/rtld-elf/rtld.c Sat Jan 7 10:33:01 2012 (r229768) +++ stable/9/libexec/rtld-elf/rtld.c Sat Jan 7 10:49:04 2012 (r229769) @@ -515,10 +515,6 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_ ld_bind_now != NULL && *ld_bind_now != '\0', &obj_rtld, NULL) == -1) die(); - if (resolve_objects_ifunc(obj_main, - ld_bind_now != NULL && *ld_bind_now != '\0', NULL) == -1) - die(); - dbg("doing copy relocations"); if (do_copy_relocations(obj_main) == -1) die(); @@ -549,6 +545,11 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_ map_stacks_exec(NULL); + dbg("resolving ifuncs"); + if (resolve_objects_ifunc(obj_main, + ld_bind_now != NULL && *ld_bind_now != '\0', NULL) == -1) + die(); + wlock_acquire(rtld_bind_lock, &lockstate); objlist_call_init(&initlist, &lockstate); objlist_clear(&initlist); From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 11:01:36 2012 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 2B356106564A; Sat, 7 Jan 2012 11:01:36 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0FA8A8FC0C; Sat, 7 Jan 2012 11:01:36 +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 q07B1Zx1036874; Sat, 7 Jan 2012 11:01:35 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q07B1ZOZ036871; Sat, 7 Jan 2012 11:01:35 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201201071101.q07B1ZOZ036871@svn.freebsd.org> From: Gleb Smirnoff Date: Sat, 7 Jan 2012 11:01:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229770 - in stable/9/sys: contrib/pf/net modules/pfsync 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, 07 Jan 2012 11:01:36 -0000 Author: glebius Date: Sat Jan 7 11:01:35 2012 New Revision: 229770 URL: http://svn.freebsd.org/changeset/base/229770 Log: Merge from head/ 228732,228811,228813-228816,228855: r228732 | glebius | 2011-12-20 16:34:16 +0400 (вт, 20 дек 2011) | 3 lines - Cover pfsync callouts deletion with PF_LOCK(). - Cover setting up interface between pf and pfsync with PF_LOCK(). r228811 | glebius | 2011-12-22 22:31:47 +0400 (чт, 22 дек 2011) | 3 lines In FreeBSD we always have bpf(4) API, either real or stub. No need in detecting presense of 'device bpf'. r228813 | glebius | 2011-12-22 22:51:35 +0400 (чт, 22 дек 2011) | 2 lines We really mean MTU of the real interface here, not of our pseudo. r228814 | glebius | 2011-12-22 22:56:27 +0400 (чт, 22 дек 2011) | 16 lines Merge couple more fixes from OpenBSD to bulk processing: revision 1.118 date: 2009/03/23 06:19:59; author: dlg; state: Exp; lines: +8 -6 wait an appropriate amount of time before giving up on a bulk update, rather than giving up after a hardcoded 5 seconds (which is generally much too short an interval for a bulk update). pointed out by david@, eyeballed by mcbride@ revision 1.171 date: 2011/10/31 22:02:52; author: mikeb; state: Exp; lines: +2 -1 Don't forget to cancel bulk update failure timeout when destroying an interface. Problem report and fix from Erik Lax, thanks! Start a brief note of revisions merged from OpenBSD. r228815 | glebius | 2011-12-22 23:05:58 +0400 (чт, 22 дек 2011) | 12 lines Merge from OpenBSD: revision 1.120 date: 2009/04/04 13:09:29; author: dlg; state: Exp; lines: +5 -5 use time_uptime instead of time_second internally. time_uptime isnt affected by adjusting the clock. revision 1.175 date: 2011/11/25 12:52:10; author: dlg; state: Exp; lines: +3 -3 use time_uptime to set state creation values as time_second can be skewed at runtime by things like date(1) and ntpd. time_uptime is monotonic and therefore more useful to compare against. r228816 | glebius | 2011-12-22 23:09:55 +0400 (чт, 22 дек 2011) | 11 lines Merge from OpenBSD: revision 1.122 date: 2009/05/13 01:01:34; author: dlg; state: Exp; lines: +6 -4 only keep track of the number of updates on tcp connections. state sync on all the other protocols is simply pushing the timeouts along which has a resolution of 1 second, so it isnt going to be hurt by pfsync taking up to a second to send it over. keep track of updates on tcp still though, their windows need constant attention. Modified: stable/9/sys/contrib/pf/net/if_pfsync.c stable/9/sys/modules/pfsync/Makefile Directory Properties: stable/9/sys/ (props changed) stable/9/sys/contrib/pf/ (props changed) Modified: stable/9/sys/contrib/pf/net/if_pfsync.c ============================================================================== --- stable/9/sys/contrib/pf/net/if_pfsync.c Sat Jan 7 10:49:04 2012 (r229769) +++ stable/9/sys/contrib/pf/net/if_pfsync.c Sat Jan 7 11:01:35 2012 (r229770) @@ -42,20 +42,22 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +/* + * Revisions picked from OpenBSD after revision 1.110 import: + * 1.118, 1.124, 1.148, 1.149, 1.151, 1.171 - fixes to bulk updates + * 1.120, 1.175 - use monotonic time_uptime + * 1.122 - reduce number of updates for non-TCP sessions + */ + #ifdef __FreeBSD__ #include "opt_inet.h" #include "opt_inet6.h" -#include "opt_bpf.h" #include "opt_pf.h" #include __FBSDID("$FreeBSD$"); -#ifdef DEV_BPF -#define NBPFILTER DEV_BPF -#else -#define NBPFILTER 0 -#endif +#define NBPFILTER 1 #ifdef DEV_PFSYNC #define NPFSYNC DEV_PFSYNC @@ -539,9 +541,14 @@ pfsync_clone_destroy(struct ifnet *ifp) #ifdef __FreeBSD__ EVENTHANDLER_DEREGISTER(ifnet_departure_event, sc->sc_detachtag); + PF_LOCK(); #endif - timeout_del(&sc->sc_bulk_tmo); /* XXX: need PF_LOCK() before */ + timeout_del(&sc->sc_bulkfail_tmo); + timeout_del(&sc->sc_bulk_tmo); timeout_del(&sc->sc_tmo); +#ifdef __FreeBSD__ + PF_UNLOCK(); +#endif #if NCARP > 0 #ifdef notyet #ifdef __FreeBSD__ @@ -662,7 +669,7 @@ pfsync_state_export(struct pfsync_state /* copy from state */ strlcpy(sp->ifname, st->kif->pfik_name, sizeof(sp->ifname)); bcopy(&st->rt_addr, &sp->rt_addr, sizeof(sp->rt_addr)); - sp->creation = htonl(time_second - st->creation); + sp->creation = htonl(time_uptime - st->creation); sp->expire = pf_state_expires(st); if (sp->expire <= time_second) sp->expire = htonl(0); @@ -813,7 +820,7 @@ pfsync_state_import(struct pfsync_state /* copy to state */ bcopy(&sp->rt_addr, &st->rt_addr, sizeof(st->rt_addr)); - st->creation = time_second - ntohl(sp->creation); + st->creation = time_uptime - ntohl(sp->creation); st->expire = time_second; if (sp->expire) { /* XXX No adaptive scaling. */ @@ -836,7 +843,7 @@ pfsync_state_import(struct pfsync_state st->anchor.ptr = NULL; st->rt_kif = NULL; - st->pfsync_time = time_second; + st->pfsync_time = time_uptime; st->sync_state = PFSYNC_S_NONE; /* XXX when we have nat_rule/anchors, use STATE_INC_COUNTERS */ @@ -1328,7 +1335,7 @@ pfsync_in_upd(struct pfsync_pkt *pkt, st pf_state_peer_ntoh(&sp->dst, &st->dst); st->expire = ntohl(sp->expire) + time_second; st->timeout = sp->timeout; - st->pfsync_time = time_second; + st->pfsync_time = time_uptime; } #ifdef __FreeBSD__ PF_UNLOCK(); @@ -1438,7 +1445,7 @@ pfsync_in_upd_c(struct pfsync_pkt *pkt, pf_state_peer_ntoh(&up->dst, &st->dst); st->expire = ntohl(up->expire) + time_second; st->timeout = up->timeout; - st->pfsync_time = time_second; + st->pfsync_time = time_uptime; } #ifdef __FreeBSD__ PF_UNLOCK(); @@ -1608,14 +1615,16 @@ pfsync_in_bus(struct pfsync_pkt *pkt, st switch (bus->status) { case PFSYNC_BUS_START: #ifdef __FreeBSD__ - callout_reset(&sc->sc_bulkfail_tmo, 5 * hz, pfsync_bulk_fail, - V_pfsyncif); + callout_reset(&sc->sc_bulkfail_tmo, 4 * hz + + V_pf_pool_limits[PF_LIMIT_STATES].limit / + ((sc->sc_sync_if->if_mtu - PFSYNC_MINPKT) / + sizeof(struct pfsync_state)), + pfsync_bulk_fail, V_pfsyncif); #else - timeout_add_sec(&sc->sc_bulkfail_tmo, 5); /* XXX magic */ -#endif -#ifdef XXX + timeout_add(&sc->sc_bulkfail_tmo, 4 * hz + pf_pool_limits[PF_LIMIT_STATES].limit / - (PFSYNC_BULKPACKETS * sc->sc_maxcount)); + ((sc->sc_if.if_mtu - PFSYNC_MINPKT) / + sizeof(struct pfsync_state))); #endif #ifdef __FreeBSD__ if (V_pf_status.debug >= PF_DEBUG_MISC) @@ -2606,9 +2615,11 @@ pfsync_update_state(struct pf_state *st) case PFSYNC_S_INS: /* we're already handling it */ - st->sync_updates++; - if (st->sync_updates >= sc->sc_maxupdates) - sync = 1; + if (st->key[PF_SK_WIRE]->proto == IPPROTO_TCP) { + st->sync_updates++; + if (st->sync_updates >= sc->sc_maxupdates) + sync = 1; + } break; case PFSYNC_S_IACK: @@ -2623,7 +2634,7 @@ pfsync_update_state(struct pf_state *st) st->sync_state); } - if (sync || (time_second - st->pfsync_time) < 2) { + if (sync || (time_uptime - st->pfsync_time) < 2) { pfsync_upds++; #ifdef __FreeBSD__ pfsync_sendout(); @@ -2665,7 +2676,7 @@ pfsync_request_update(u_int32_t creatori nlen += sizeof(struct pfsync_subheader); #ifdef __FreeBSD__ - if (sc->sc_len + nlen > sc->sc_ifp->if_mtu) { + if (sc->sc_len + nlen > sc->sc_sync_if->if_mtu) { #else if (sc->sc_len + nlen > sc->sc_if.if_mtu) { #endif @@ -3290,16 +3301,17 @@ void pfsyncintr(void *arg) { struct pfsync_softc *sc = arg; - struct mbuf *m; + struct mbuf *m, *n; CURVNET_SET(sc->sc_ifp->if_vnet); pfsync_ints++; - for (;;) { - IF_DEQUEUE(&sc->sc_ifp->if_snd, m); - if (m == 0) - break; + IF_DEQUEUE_ALL(&sc->sc_ifp->if_snd, m); + for (; m != NULL; m = n) { + + n = m->m_nextpkt; + m->m_nextpkt = NULL; if (ip_output(m, NULL, NULL, IP_RAWOUTPUT, &sc->sc_imo, NULL) == 0) V_pfsyncstats.pfsyncs_opackets++; @@ -3391,6 +3403,7 @@ vnet_pfsync_init(const void *unused) if (error) panic("%s: swi_add %d", __func__, error); + PF_LOCK(); pfsync_state_import_ptr = pfsync_state_import; pfsync_up_ptr = pfsync_up; pfsync_insert_state_ptr = pfsync_insert_state; @@ -3399,6 +3412,7 @@ vnet_pfsync_init(const void *unused) pfsync_clear_states_ptr = pfsync_clear_states; pfsync_state_in_use_ptr = pfsync_state_in_use; pfsync_defer_ptr = pfsync_defer; + PF_UNLOCK(); return (0); } @@ -3409,6 +3423,7 @@ vnet_pfsync_uninit(const void *unused) swi_remove(pfsync_swi.pfsync_swi_cookie); + PF_LOCK(); pfsync_state_import_ptr = NULL; pfsync_up_ptr = NULL; pfsync_insert_state_ptr = NULL; @@ -3417,6 +3432,7 @@ vnet_pfsync_uninit(const void *unused) pfsync_clear_states_ptr = NULL; pfsync_state_in_use_ptr = NULL; pfsync_defer_ptr = NULL; + PF_UNLOCK(); if_clone_detach(&pfsync_cloner); Modified: stable/9/sys/modules/pfsync/Makefile ============================================================================== --- stable/9/sys/modules/pfsync/Makefile Sat Jan 7 10:49:04 2012 (r229769) +++ stable/9/sys/modules/pfsync/Makefile Sat Jan 7 11:01:35 2012 (r229770) @@ -6,7 +6,7 @@ KMOD= pfsync SRCS= if_pfsync.c \ - opt_pf.h opt_inet.h opt_inet6.h opt_bpf.h + opt_pf.h opt_inet.h opt_inet6.h CFLAGS+= -I${.CURDIR}/../../contrib/pf SRCS+= bus_if.h device_if.h @@ -24,9 +24,6 @@ opt_inet6.h: echo "#define INET6 1" > ${.TARGET} .endif -opt_bpf.h: - echo "#define DEV_BPF 1" > ${.TARGET} - .if defined(VIMAGE) opt_global.h: echo "#define VIMAGE 1" >> ${.TARGET} From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 11:16:23 2012 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 B7ECD1065670; Sat, 7 Jan 2012 11:16:23 +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 8C5378FC0A; Sat, 7 Jan 2012 11:16: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 q07BGN89037347; Sat, 7 Jan 2012 11:16:23 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q07BGN2D037345; Sat, 7 Jan 2012 11:16:23 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201201071116.q07BGN2D037345@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 7 Jan 2012 11:16:23 +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: r229771 - head/sys/boot/common 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, 07 Jan 2012 11:16:23 -0000 Author: kib Date: Sat Jan 7 11:16:23 2012 New Revision: 229771 URL: http://svn.freebsd.org/changeset/base/229771 Log: Document comconsole_port and comconsole_pcidev loader variables. MFC after: 2 weeks Modified: head/sys/boot/common/loader.8 Modified: head/sys/boot/common/loader.8 ============================================================================== --- head/sys/boot/common/loader.8 Sat Jan 7 11:01:35 2012 (r229770) +++ head/sys/boot/common/loader.8 Sat Jan 7 11:16:23 2012 (r229771) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 27, 2011 +.Dd January 7, 2012 .Dt LOADER 8 .Os .Sh NAME @@ -419,6 +419,43 @@ was compiled. Changes to the .Va comconsole_speed variable take effect immediately. +.It Va comconsole_port +Defines the base i/o port used to access console UART +(i386 and amd64 only). +If the variable is not set, its assumed value is 0x3F8, which +corresponds to PC port COM1, unless overriden by +.Va BOOT_COMCONSOLE_PORT +variable during the compilation of +.Nm . +Setting the +.Va comconsole_port +variable automatically set +.Va hw.uart.console +environment variable to provide a hint to kernel for location of the console. +Loader console is changed immediately after variable +.Va comconsole_port +is set. +.It Va comconsole_pcidev +Defines the location of a PCI device of the 'simple communication' +class to be used as the serial console UART (i386 and amd64 only). +The syntax of the variable is +.Li 'bus:device:function[:bar]' , +where all members must be numeric, with possible +.Li 0x +prefix to indicate a hexadecimal value. +The +.Va bar +member is optional and assumed to be 0x10 if omitted. +The bar must decode i/o space. +Setting the variable +.Va comconsole_pcidev +automatically sets the variable +.Va comconsole_port +to the base of the selected bar, and hint +.Va hw.uart.console . +Loader console is changed immediately after variable +.Va comconsole_pcidev +is set. .It Va console Defines the current console or consoles. Multiple consoles may be specified. From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 12:32:50 2012 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 870C5106566B; Sat, 7 Jan 2012 12:32:50 +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 715018FC08; Sat, 7 Jan 2012 12:32:50 +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 q07CWopc039683; Sat, 7 Jan 2012 12:32:50 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q07CWoSk039681; Sat, 7 Jan 2012 12:32:50 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201201071232.q07CWoSk039681@svn.freebsd.org> From: Adrian Chadd Date: Sat, 7 Jan 2012 12:32:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229772 - stable/9/sys/mips/atheros 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, 07 Jan 2012 12:32:50 -0000 Author: adrian Date: Sat Jan 7 12:32:50 2012 New Revision: 229772 URL: http://svn.freebsd.org/changeset/base/229772 Log: MFC r229765 - Fix the ar724x shift calculation when writing to the PCI config space. Modified: stable/9/sys/mips/atheros/ar724x_pci.c Modified: stable/9/sys/mips/atheros/ar724x_pci.c ============================================================================== --- stable/9/sys/mips/atheros/ar724x_pci.c Sat Jan 7 11:16:23 2012 (r229771) +++ stable/9/sys/mips/atheros/ar724x_pci.c Sat Jan 7 12:32:50 2012 (r229772) @@ -93,7 +93,7 @@ ar724x_pci_write(uint32_t reg, uint32_t uint32_t val, mask, shift; /* Register access is 32-bit aligned */ - shift = 8 * (offset & (bytes % 4)); + shift = (offset & 3) * 8; if (bytes % 4) mask = (1 << (bytes * 8)) - 1; else From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 12:40:46 2012 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 29755106566B; Sat, 7 Jan 2012 12:40:46 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 148BB8FC16; Sat, 7 Jan 2012 12:40:46 +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 q07CejqC039954; Sat, 7 Jan 2012 12:40:45 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q07CejIW039952; Sat, 7 Jan 2012 12:40:45 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201201071240.q07CejIW039952@svn.freebsd.org> From: Gleb Smirnoff Date: Sat, 7 Jan 2012 12:40: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: r229773 - head/sys/contrib/pf/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: Sat, 07 Jan 2012 12:40:46 -0000 Author: glebius Date: Sat Jan 7 12:40:45 2012 New Revision: 229773 URL: http://svn.freebsd.org/changeset/base/229773 Log: Fix indentation. Modified: head/sys/contrib/pf/net/if_pfsync.c Modified: head/sys/contrib/pf/net/if_pfsync.c ============================================================================== --- head/sys/contrib/pf/net/if_pfsync.c Sat Jan 7 12:32:50 2012 (r229772) +++ head/sys/contrib/pf/net/if_pfsync.c Sat Jan 7 12:40:45 2012 (r229773) @@ -3028,11 +3028,10 @@ pfsync_bulk_start(void) #else sc->sc_bulk_next = TAILQ_FIRST(&state_list); #endif - sc->sc_bulk_last = sc->sc_bulk_next; + sc->sc_bulk_last = sc->sc_bulk_next; - pfsync_bulk_status(PFSYNC_BUS_START); - callout_reset(&sc->sc_bulk_tmo, 1, - pfsync_bulk_update, sc); + pfsync_bulk_status(PFSYNC_BUS_START); + callout_reset(&sc->sc_bulk_tmo, 1, pfsync_bulk_update, sc); } #ifdef __FreeBSD__ PF_UNLOCK(); From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 13:03:34 2012 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 63E0B106566B; Sat, 7 Jan 2012 13:03:34 +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 4DAF68FC15; Sat, 7 Jan 2012 13:03: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 q07D3Y8p040747; Sat, 7 Jan 2012 13:03:34 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q07D3Yv1040745; Sat, 7 Jan 2012 13:03:34 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201201071303.q07D3Yv1040745@svn.freebsd.org> From: Michael Tuexen Date: Sat, 7 Jan 2012 13:03: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: r229774 - 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: Sat, 07 Jan 2012 13:03:34 -0000 Author: tuexen Date: Sat Jan 7 13:03:33 2012 New Revision: 229774 URL: http://svn.freebsd.org/changeset/base/229774 Log: Improve the handling of received INITs. Send an ABORT when not accepting the connection. Also fix a crash, which could happen when the user closed the socket. MFC after: 1 month. Modified: head/sys/netinet/sctp_input.c Modified: head/sys/netinet/sctp_input.c ============================================================================== --- head/sys/netinet/sctp_input.c Sat Jan 7 12:40:45 2012 (r229773) +++ head/sys/netinet/sctp_input.c Sat Jan 7 13:03:33 2012 (r229774) @@ -88,43 +88,14 @@ sctp_handle_init(struct mbuf *m, int iph { struct sctp_init *init; struct mbuf *op_err; - uint32_t init_limit; SCTPDBG(SCTP_DEBUG_INPUT2, "sctp_handle_init: handling INIT tcb:%p\n", stcb); if (stcb == NULL) { SCTP_INP_RLOCK(inp); - if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) { - goto outnow; - } - } - op_err = NULL; - init = &cp->init; - /* First are we accepting? */ - if ((inp->sctp_socket->so_qlimit == 0) && (stcb == NULL)) { - SCTPDBG(SCTP_DEBUG_INPUT2, - "sctp_handle_init: Abort, so_qlimit:%d\n", - inp->sctp_socket->so_qlimit); - /* - * FIX ME ?? What about TCP model and we have a - * match/restart case? Actually no fix is needed. the lookup - * will always find the existing assoc so stcb would not be - * NULL. It may be questionable to do this since we COULD - * just send back the INIT-ACK and hope that the app did - * accept()'s by the time the COOKIE was sent. But there is - * a price to pay for COOKIE generation and I don't want to - * pay it on the chance that the app will actually do some - * accepts(). The App just looses and should NOT be in this - * state :-) - */ - sctp_abort_association(inp, stcb, m, iphlen, sh, op_err, - vrf_id, port); - if (stcb) - *abort_no_unlock = 1; - goto outnow; } + /* validate length */ if (ntohs(cp->ch.chunk_length) < sizeof(struct sctp_init_chunk)) { - /* Invalid length */ op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM); sctp_abort_association(inp, stcb, m, iphlen, sh, op_err, vrf_id, port); @@ -133,6 +104,7 @@ sctp_handle_init(struct mbuf *m, int iph goto outnow; } /* validate parameters */ + init = &cp->init; if (init->initiate_tag == 0) { /* protocol error... send abort */ op_err = sctp_generate_invmanparam(SCTP_CAUSE_INVALID_PARAM); @@ -169,19 +141,49 @@ sctp_handle_init(struct mbuf *m, int iph *abort_no_unlock = 1; goto outnow; } - init_limit = offset + ntohs(cp->ch.chunk_length); if (sctp_validate_init_auth_params(m, offset + sizeof(*cp), - init_limit)) { + offset + ntohs(cp->ch.chunk_length))) { /* auth parameter(s) error... send abort */ sctp_abort_association(inp, stcb, m, iphlen, sh, NULL, vrf_id, port); if (stcb) *abort_no_unlock = 1; goto outnow; } - /* send an INIT-ACK w/cookie */ - SCTPDBG(SCTP_DEBUG_INPUT3, "sctp_handle_init: sending INIT-ACK\n"); - sctp_send_initiate_ack(inp, stcb, m, iphlen, offset, sh, cp, vrf_id, port, - ((stcb == NULL) ? SCTP_HOLDS_LOCK : SCTP_NOT_LOCKED)); + /* + * We are only accepting if we have a socket with positive + * so_qlimit. + */ + if ((stcb == NULL) && + ((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) || + (inp->sctp_socket == NULL) || + (inp->sctp_socket->so_qlimit == 0))) { + /* + * FIX ME ?? What about TCP model and we have a + * match/restart case? Actually no fix is needed. the lookup + * will always find the existing assoc so stcb would not be + * NULL. It may be questionable to do this since we COULD + * just send back the INIT-ACK and hope that the app did + * accept()'s by the time the COOKIE was sent. But there is + * a price to pay for COOKIE generation and I don't want to + * pay it on the chance that the app will actually do some + * accepts(). The App just looses and should NOT be in this + * state :-) + */ + sctp_abort_association(inp, stcb, m, iphlen, sh, NULL, + vrf_id, port); + goto outnow; + } + if ((stcb != NULL) && + (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_SHUTDOWN_ACK_SENT)) { + SCTPDBG(SCTP_DEBUG_INPUT3, "sctp_handle_init: sending SHUTDOWN-ACK\n"); + sctp_send_shutdown_ack(stcb, NULL); + sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_CONTROL_PROC, SCTP_SO_NOT_LOCKED); + } else { + SCTPDBG(SCTP_DEBUG_INPUT3, "sctp_handle_init: sending INIT-ACK\n"); + sctp_send_initiate_ack(inp, stcb, m, iphlen, offset, sh, cp, vrf_id, port, + ((stcb == NULL) ? SCTP_HOLDS_LOCK : SCTP_NOT_LOCKED)); + } outnow: if (stcb == NULL) { SCTP_INP_RUNLOCK(inp); @@ -1025,7 +1027,7 @@ sctp_handle_shutdown_ack(struct sctp_shu if ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) { /* Set the connected flag to disconnected */ - stcb->sctp_ep->sctp_socket->so_snd.sb_cc = 0; + stcb->sctp_socket->so_snd.sb_cc = 0; } } SCTP_STAT_INCR_COUNTER32(sctps_shutdown); @@ -4499,7 +4501,6 @@ __attribute__((noinline)) * process all control chunks... */ if (((ch->chunk_type == SCTP_SELECTIVE_ACK) || - /* EY */ (ch->chunk_type == SCTP_NR_SELECTIVE_ACK) || (ch->chunk_type == SCTP_HEARTBEAT_REQUEST)) && (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_COOKIE_ECHOED)) { @@ -4613,54 +4614,30 @@ process_control_chunks: } switch (ch->chunk_type) { case SCTP_INITIATION: - /* must be first and only chunk */ SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_INIT\n"); - if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) { - /* We are not interested anymore? */ - if ((stcb) && (stcb->asoc.total_output_queue_size)) { - /* - * collision case where we are - * sending to them too - */ - ; - } else { - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } - *offset = length; - return (NULL); - } - } - if ((chk_length > SCTP_LARGEST_INIT_ACCEPTED) || - (num_chunks > 1) || + /* The INIT chunk must be the only chunk. */ + if ((num_chunks > 1) || (SCTP_BASE_SYSCTL(sctp_strict_init) && (length - *offset > (int)SCTP_SIZE32(chk_length)))) { + sctp_abort_association(inp, stcb, m, + iphlen, sh, NULL, vrf_id, port); *offset = length; - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } return (NULL); } - if ((stcb != NULL) && - (SCTP_GET_STATE(&stcb->asoc) == - SCTP_STATE_SHUTDOWN_ACK_SENT)) { - sctp_send_shutdown_ack(stcb, NULL); + /* Honor our resource limit. */ + if (chk_length > SCTP_LARGEST_INIT_ACCEPTED) { + struct mbuf *op_err; + + op_err = sctp_generate_invmanparam(SCTP_CAUSE_OUT_OF_RESC); + sctp_abort_association(inp, stcb, m, + iphlen, sh, op_err, vrf_id, port); *offset = length; - sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_CONTROL_PROC, SCTP_SO_NOT_LOCKED); - if (locked_tcb) { - SCTP_TCB_UNLOCK(locked_tcb); - } return (NULL); } - if (netp) { - sctp_handle_init(m, iphlen, *offset, sh, - (struct sctp_init_chunk *)ch, inp, - stcb, &abort_no_unlock, vrf_id, port); - } - if (abort_no_unlock) - return (NULL); - + sctp_handle_init(m, iphlen, *offset, sh, + (struct sctp_init_chunk *)ch, inp, + stcb, &abort_no_unlock, vrf_id, port); *offset = length; - if (locked_tcb) { + if ((!abort_no_unlock) && (locked_tcb)) { SCTP_TCB_UNLOCK(locked_tcb); } return (NULL); @@ -4668,7 +4645,6 @@ process_control_chunks: case SCTP_PAD_CHUNK: break; case SCTP_INITIATION_ACK: - /* must be first and only chunk */ SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_INIT-ACK\n"); if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) { /* We are not interested anymore */ @@ -4697,6 +4673,7 @@ process_control_chunks: return (NULL); } } + /* The INIT-CK chunk must be the only chunk. */ if ((num_chunks > 1) || (SCTP_BASE_SYSCTL(sctp_strict_init) && (length - *offset > (int)SCTP_SIZE32(chk_length)))) { *offset = length; @@ -4711,16 +4688,17 @@ process_control_chunks: } else { ret = -1; } + *offset = length; + if (abort_no_unlock) { + return (NULL); + } /* * Special case, I must call the output routine to * get the cookie echoed */ - if (abort_no_unlock) - return (NULL); - - if ((stcb) && ret == 0) + if ((stcb != NULL) && (ret == 0)) { sctp_chunk_output(stcb->sctp_ep, stcb, SCTP_OUTPUT_FROM_CONTROL_PROC, SCTP_SO_NOT_LOCKED); - *offset = length; + } if (locked_tcb) { SCTP_TCB_UNLOCK(locked_tcb); } @@ -4977,7 +4955,6 @@ process_control_chunks: case SCTP_OPERATION_ERROR: SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_OP-ERR\n"); if ((stcb) && netp && *netp && sctp_handle_error(ch, stcb, *netp) < 0) { - *offset = length; return (NULL); } @@ -5009,23 +4986,11 @@ process_control_chunks: if ((stcb == NULL) && (inp->sctp_socket->so_qlen >= inp->sctp_socket->so_qlimit)) { if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) && (SCTP_BASE_SYSCTL(sctp_abort_if_one_2_one_hits_limit))) { - struct mbuf *oper; - struct sctp_paramhdr *phdr; + struct mbuf *op_err; - oper = sctp_get_mbuf_for_msg(sizeof(struct sctp_paramhdr), - 0, M_DONTWAIT, 1, MT_DATA); - if (oper) { - SCTP_BUF_LEN(oper) = - sizeof(struct sctp_paramhdr); - phdr = mtod(oper, - struct sctp_paramhdr *); - phdr->param_type = - htons(SCTP_CAUSE_OUT_OF_RESC); - phdr->param_length = - htons(sizeof(struct sctp_paramhdr)); - } + op_err = sctp_generate_invmanparam(SCTP_CAUSE_OUT_OF_RESC); sctp_abort_association(inp, stcb, m, - iphlen, sh, oper, vrf_id, port); + iphlen, sh, op_err, vrf_id, port); } *offset = length; return (NULL); From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 14:04:01 2012 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 63326106566B; Sat, 7 Jan 2012 14:04:01 +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 4D5F38FC0A; Sat, 7 Jan 2012 14:04: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 q07E41aP042588; Sat, 7 Jan 2012 14:04:01 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q07E41Bo042583; Sat, 7 Jan 2012 14:04:01 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201201071404.q07E41Bo042583@svn.freebsd.org> From: Michael Tuexen Date: Sat, 7 Jan 2012 14:04: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: r229775 - 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: Sat, 07 Jan 2012 14:04:01 -0000 Author: tuexen Date: Sat Jan 7 14:04:00 2012 New Revision: 229775 URL: http://svn.freebsd.org/changeset/base/229775 Log: Retire the SCTP sysctl "strict_init". We always perform the validation and there is no reason to make is configuarable. Discussed with rrs@. Modified: head/sys/netinet/sctp_input.c head/sys/netinet/sctp_sysctl.c head/sys/netinet/sctp_sysctl.h Modified: head/sys/netinet/sctp_input.c ============================================================================== --- head/sys/netinet/sctp_input.c Sat Jan 7 13:03:33 2012 (r229774) +++ head/sys/netinet/sctp_input.c Sat Jan 7 14:04:00 2012 (r229775) @@ -4617,7 +4617,7 @@ process_control_chunks: SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_INIT\n"); /* The INIT chunk must be the only chunk. */ if ((num_chunks > 1) || - (SCTP_BASE_SYSCTL(sctp_strict_init) && (length - *offset > (int)SCTP_SIZE32(chk_length)))) { + (length - *offset > (int)SCTP_SIZE32(chk_length))) { sctp_abort_association(inp, stcb, m, iphlen, sh, NULL, vrf_id, port); *offset = length; @@ -4673,9 +4673,9 @@ process_control_chunks: return (NULL); } } - /* The INIT-CK chunk must be the only chunk. */ + /* The INIT-ACK chunk must be the only chunk. */ if ((num_chunks > 1) || - (SCTP_BASE_SYSCTL(sctp_strict_init) && (length - *offset > (int)SCTP_SIZE32(chk_length)))) { + (length - *offset > (int)SCTP_SIZE32(chk_length))) { *offset = length; if (locked_tcb) { SCTP_TCB_UNLOCK(locked_tcb); Modified: head/sys/netinet/sctp_sysctl.c ============================================================================== --- head/sys/netinet/sctp_sysctl.c Sat Jan 7 13:03:33 2012 (r229774) +++ head/sys/netinet/sctp_sysctl.c Sat Jan 7 14:04:00 2012 (r229775) @@ -58,7 +58,6 @@ sctp_init_sysctls() #if !defined(SCTP_WITH_NO_CSUM) SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback) = SCTPCTL_LOOPBACK_NOCSUM_DEFAULT; #endif - SCTP_BASE_SYSCTL(sctp_strict_init) = SCTPCTL_STRICT_INIT_DEFAULT; SCTP_BASE_SYSCTL(sctp_peer_chunk_oh) = SCTPCTL_PEER_CHKOH_DEFAULT; SCTP_BASE_SYSCTL(sctp_max_burst_default) = SCTPCTL_MAXBURST_DEFAULT; SCTP_BASE_SYSCTL(sctp_fr_max_burst_default) = SCTPCTL_FRMAXBURST_DEFAULT; @@ -607,7 +606,6 @@ sysctl_sctp_check(SYSCTL_HANDLER_ARGS) #if !defined(SCTP_WITH_NO_CSUM) RANGECHK(SCTP_BASE_SYSCTL(sctp_no_csum_on_loopback), SCTPCTL_LOOPBACK_NOCSUM_MIN, SCTPCTL_LOOPBACK_NOCSUM_MAX); #endif - RANGECHK(SCTP_BASE_SYSCTL(sctp_strict_init), SCTPCTL_STRICT_INIT_MIN, SCTPCTL_STRICT_INIT_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_peer_chunk_oh), SCTPCTL_PEER_CHKOH_MIN, SCTPCTL_PEER_CHKOH_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_max_burst_default), SCTPCTL_MAXBURST_MIN, SCTPCTL_MAXBURST_MAX); RANGECHK(SCTP_BASE_SYSCTL(sctp_fr_max_burst_default), SCTPCTL_FRMAXBURST_MIN, SCTPCTL_FRMAXBURST_MAX); @@ -876,10 +874,6 @@ SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUT SCTPCTL_LOOPBACK_NOCSUM_DESC); #endif -SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, strict_init, CTLTYPE_UINT | CTLFLAG_RW, - &SCTP_BASE_SYSCTL(sctp_strict_init), 0, sysctl_sctp_check, "IU", - SCTPCTL_STRICT_INIT_DESC); - SYSCTL_VNET_PROC(_net_inet_sctp, OID_AUTO, peer_chkoh, CTLTYPE_UINT | CTLFLAG_RW, &SCTP_BASE_SYSCTL(sctp_peer_chunk_oh), 0, sysctl_sctp_check, "IU", SCTPCTL_PEER_CHKOH_DESC); Modified: head/sys/netinet/sctp_sysctl.h ============================================================================== --- head/sys/netinet/sctp_sysctl.h Sat Jan 7 13:03:33 2012 (r229774) +++ head/sys/netinet/sctp_sysctl.h Sat Jan 7 14:04:00 2012 (r229775) @@ -50,7 +50,6 @@ struct sctp_sysctl { #if !defined(SCTP_WITH_NO_CSUM) uint32_t sctp_no_csum_on_loopback; #endif - uint32_t sctp_strict_init; uint32_t sctp_peer_chunk_oh; uint32_t sctp_max_burst_default; uint32_t sctp_max_chunks_on_queue; @@ -168,12 +167,6 @@ struct sctp_sysctl { #define SCTPCTL_LOOPBACK_NOCSUM_MAX 1 #define SCTPCTL_LOOPBACK_NOCSUM_DEFAULT 1 -/* strict_init: Enable strict INIT/INIT-ACK singleton enforcement */ -#define SCTPCTL_STRICT_INIT_DESC "Enable strict INIT/INIT-ACK singleton enforcement" -#define SCTPCTL_STRICT_INIT_MIN 0 -#define SCTPCTL_STRICT_INIT_MAX 1 -#define SCTPCTL_STRICT_INIT_DEFAULT 1 - /* peer_chkoh: Amount to debit peers rwnd per chunk sent */ #define SCTPCTL_PEER_CHKOH_DESC "Amount to debit peers rwnd per chunk sent" #define SCTPCTL_PEER_CHKOH_MIN 0 From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 14:15:32 2012 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 5AE1D106564A for ; Sat, 7 Jan 2012 14:15:32 +0000 (UTC) (envelope-from ronald-freebsd8@klop.yi.org) Received: from fep28.mx.upcmail.net (fep28.mx.upcmail.net [62.179.121.48]) by mx1.freebsd.org (Postfix) with ESMTP id 9F5338FC0A for ; Sat, 7 Jan 2012 14:15:31 +0000 (UTC) Received: from edge03.upcmail.net ([192.168.13.238]) by viefep14-int.chello.at (InterMail vM.8.01.05.04 201-2260-151-105-20111014) with ESMTP id <20120107135836.CKHW12772.viefep14-int.chello.at@edge03.upcmail.net>; Sat, 7 Jan 2012 14:58:36 +0100 Received: from pinky ([77.251.58.236]) by edge03.upcmail.net with edge id Jdya1i00h55oZSd03dya1t; Sat, 07 Jan 2012 14:58:36 +0100 X-SourceIP: 77.251.58.236 Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes To: svn-src-all@freebsd.org, "Pawel Jakub Dawidek" References: <201201040704.q0474iIe065299@svn.freebsd.org> Date: Sat, 07 Jan 2012 14:58:34 +0100 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: "Ronald Klop" Message-ID: In-Reply-To: <201201040704.q0474iIe065299@svn.freebsd.org> User-Agent: Opera Mail/11.60 (Win32) Cc: Subject: Re: svn commit: r229466 - head/usr.sbin/mptable 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, 07 Jan 2012 14:15:32 -0000 I don't know much about this code, but is chmod 0666 really wat is wanted here (and in the commits following this one)? It makes the file world writable. And that smells funny. :-) Ronald. On Wed, 04 Jan 2012 08:04:44 +0100, Pawel Jakub Dawidek wrote: > Author: pjd > Date: Wed Jan 4 07:04:43 2012 > New Revision: 229466 > URL: http://svn.freebsd.org/changeset/base/229466 > > Log: > Add an missing argument to open(2). If O_CREAT flag is specified, > file permission has to be specified as well. > > Modified: > head/usr.sbin/mptable/mptable.c > > Modified: head/usr.sbin/mptable/mptable.c > ============================================================================== > --- head/usr.sbin/mptable/mptable.c Wed Jan 4 07:01:23 2012 (r229465) > +++ head/usr.sbin/mptable/mptable.c Wed Jan 4 07:04:43 2012 (r229466) > @@ -828,7 +828,7 @@ MPConfigTableHeader( u_int32_t pap ) > int ofd; > u_char dumpbuf[ 4096 ]; > - ofd = open( "/tmp/mpdump", O_CREAT | O_RDWR ); > + ofd = open( "/tmp/mpdump", O_CREAT | O_RDWR, 0666 ); > seekEntry( paddr ); > readEntry( dumpbuf, 1024 ); > write( ofd, dumpbuf, 1024 ); > _______________________________________________ > svn-src-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 14:35:37 2012 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 EF7CF106566C; Sat, 7 Jan 2012 14:35:37 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D99CA8FC12; Sat, 7 Jan 2012 14:35: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 q07EZb3A043617; Sat, 7 Jan 2012 14:35:37 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q07EZbQL043615; Sat, 7 Jan 2012 14:35:37 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201201071435.q07EZbQL043615@svn.freebsd.org> From: Dimitry Andric Date: Sat, 7 Jan 2012 14:35:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229776 - stable/9/sys/dev/hwpmc 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, 07 Jan 2012 14:35:38 -0000 Author: dim Date: Sat Jan 7 14:35:37 2012 New Revision: 229776 URL: http://svn.freebsd.org/changeset/base/229776 Log: MFC r229076: In sys/dev/hwpmc/hwpmc_amd.c, fix a clang warning about invalid enum conversions. Reviewed by: jkoshy Modified: stable/9/sys/dev/hwpmc/hwpmc_amd.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/dev/hwpmc/hwpmc_amd.c ============================================================================== --- stable/9/sys/dev/hwpmc/hwpmc_amd.c Sat Jan 7 14:04:00 2012 (r229775) +++ stable/9/sys/dev/hwpmc/hwpmc_amd.c Sat Jan 7 14:35:37 2012 (r229776) @@ -889,7 +889,6 @@ pmc_amd_initialize(void) * field returned by CPUID for instruction family >= 6. */ - class = cputype = -1; name = NULL; switch (cpu_id & 0xF00) { #if defined(__i386__) @@ -906,9 +905,8 @@ pmc_amd_initialize(void) class = PMC_CLASS_K8; name = "K8"; break; - } - if ((int) cputype == -1) { + default: (void) printf("pmc: Unknown AMD CPU.\n"); return NULL; } From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 14:39:46 2012 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 3B1251065670; Sat, 7 Jan 2012 14:39:46 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0A17F8FC08; Sat, 7 Jan 2012 14:39:46 +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 q07EdjlU043791; Sat, 7 Jan 2012 14:39:45 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q07EdjZu043789; Sat, 7 Jan 2012 14:39:45 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201201071439.q07EdjZu043789@svn.freebsd.org> From: Gleb Smirnoff Date: Sat, 7 Jan 2012 14:39: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: r229777 - head/sys/contrib/pf/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: Sat, 07 Jan 2012 14:39:46 -0000 Author: glebius Date: Sat Jan 7 14:39:45 2012 New Revision: 229777 URL: http://svn.freebsd.org/changeset/base/229777 Log: Merge from OpenBSD: revision 1.170 date: 2011/10/30 23:04:38; author: mikeb; state: Exp; lines: +6 -7 Allow setting big MTU values on the pfsync interface but not larger than the syncdev MTU. Prompted by the discussion with and tested by Maxim Bourmistrov; ok dlg, mpf Consistently use sc_ifp->if_mtu in the MTU check throughout the module. This backs out r228813. Modified: head/sys/contrib/pf/net/if_pfsync.c Modified: head/sys/contrib/pf/net/if_pfsync.c ============================================================================== --- head/sys/contrib/pf/net/if_pfsync.c Sat Jan 7 14:35:37 2012 (r229776) +++ head/sys/contrib/pf/net/if_pfsync.c Sat Jan 7 14:39:45 2012 (r229777) @@ -47,6 +47,7 @@ * 1.118, 1.124, 1.148, 1.149, 1.151, 1.171 - fixes to bulk updates * 1.120, 1.175 - use monotonic time_uptime * 1.122 - reduce number of updates for non-TCP sessions + * 1.170 - SIOCSIFMTU checks */ #ifdef __FreeBSD__ @@ -492,13 +493,12 @@ pfsync_clone_create(struct if_clone *ifc ifp->if_type = IFT_PFSYNC; ifp->if_snd.ifq_maxlen = ifqmaxlen; ifp->if_hdrlen = sizeof(struct pfsync_header); - ifp->if_mtu = 1500; /* XXX */ + ifp->if_mtu = ETHERMTU; #ifdef __FreeBSD__ callout_init(&sc->sc_tmo, CALLOUT_MPSAFE); callout_init_mtx(&sc->sc_bulk_tmo, &pf_task_mtx, 0); callout_init(&sc->sc_bulkfail_tmo, CALLOUT_MPSAFE); #else - ifp->if_hardmtu = MCLBYTES; /* XXX */ timeout_set(&sc->sc_tmo, pfsync_timeout, sc); timeout_set(&sc->sc_bulk_tmo, pfsync_bulk_update, sc); timeout_set(&sc->sc_bulkfail_tmo, pfsync_bulk_fail, sc); @@ -1614,7 +1614,7 @@ pfsync_in_bus(struct pfsync_pkt *pkt, st #ifdef __FreeBSD__ callout_reset(&sc->sc_bulkfail_tmo, 4 * hz + V_pf_pool_limits[PF_LIMIT_STATES].limit / - ((sc->sc_sync_if->if_mtu - PFSYNC_MINPKT) / + ((sc->sc_ifp->if_mtu - PFSYNC_MINPKT) / sizeof(struct pfsync_state)), pfsync_bulk_fail, V_pfsyncif); #else @@ -1821,10 +1821,10 @@ pfsyncioctl(struct ifnet *ifp, u_long cm #endif break; case SIOCSIFMTU: - if (ifr->ifr_mtu <= PFSYNC_MINPKT) + if (!sc->sc_sync_if || + ifr->ifr_mtu <= PFSYNC_MINPKT || + ifr->ifr_mtu > sc->sc_sync_if->if_mtu) return (EINVAL); - if (ifr->ifr_mtu > MCLBYTES) /* XXX could be bigger */ - ifr->ifr_mtu = MCLBYTES; if (ifr->ifr_mtu < ifp->if_mtu) { s = splnet(); #ifdef __FreeBSD__ @@ -2667,7 +2667,7 @@ pfsync_request_update(u_int32_t creatori nlen += sizeof(struct pfsync_subheader); #ifdef __FreeBSD__ - if (sc->sc_len + nlen > sc->sc_sync_if->if_mtu) { + if (sc->sc_len + nlen > sc->sc_ifp->if_mtu) { #else if (sc->sc_len + nlen > sc->sc_if.if_mtu) { #endif From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 16:09:34 2012 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 4EB2C106564A; Sat, 7 Jan 2012 16:09:34 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 360FA8FC0A; Sat, 7 Jan 2012 16:09: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 q07G9Yl9046662; Sat, 7 Jan 2012 16:09:34 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q07G9XPV046637; Sat, 7 Jan 2012 16:09:33 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201201071609.q07G9XPV046637@svn.freebsd.org> From: Ulrich Spoerlein Date: Sat, 7 Jan 2012 16:09: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: r229778 - in head/sbin: bsdlabel camcontrol devfs dhclient fsck_ffs hastctl hastd ifconfig ipfw mdmfs mount_nfs ping6 reboot routed 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, 07 Jan 2012 16:09:34 -0000 Author: uqs Date: Sat Jan 7 16:09:33 2012 New Revision: 229778 URL: http://svn.freebsd.org/changeset/base/229778 Log: Spelling fixes for sbin/ Modified: head/sbin/bsdlabel/bsdlabel.c head/sbin/camcontrol/camcontrol.c head/sbin/devfs/rule.c head/sbin/dhclient/dhclient-script.8 head/sbin/dhclient/options.c head/sbin/fsck_ffs/fsck.h head/sbin/fsck_ffs/fsutil.c head/sbin/hastctl/hastctl.8 head/sbin/hastd/activemap.c head/sbin/hastd/hast_compression.c head/sbin/hastd/hastd.c head/sbin/hastd/lzf.h head/sbin/hastd/primary.c head/sbin/hastd/proto.c head/sbin/ifconfig/ifieee80211.c head/sbin/ipfw/ipfw2.c head/sbin/ipfw/main.c head/sbin/mdmfs/mdmfs.c head/sbin/mount_nfs/mount_nfs.c head/sbin/ping6/ping6.c head/sbin/reboot/nextboot.8 head/sbin/routed/main.c head/sbin/routed/radix.c head/sbin/routed/table.c Modified: head/sbin/bsdlabel/bsdlabel.c ============================================================================== --- head/sbin/bsdlabel/bsdlabel.c Sat Jan 7 14:39:45 2012 (r229777) +++ head/sbin/bsdlabel/bsdlabel.c Sat Jan 7 16:09:33 2012 (r229778) @@ -189,8 +189,8 @@ main(int argc, char *argv[]) break; case 'r': /* - * We accept and ignode -r for compatibility with - * historically disklabel usage. + * We accept and ignore -r for compatibility with + * historical disklabel usage. */ break; case 'w': @@ -386,7 +386,7 @@ writelabel(void) struct disklabel *lp = &lab; if (disable_write) { - warnx("write to disk label supressed - label was as follows:"); + warnx("write to disk label suppressed - label was as follows:"); display(stdout, NULL); return (0); } @@ -1512,8 +1512,8 @@ getvirginlabel(void) loclab.d_secperunit = mediasize / secsize; /* - * Nobody in these enligthened days uses the CHS geometry for - * anything, but nontheless try to get it right. If we fail + * Nobody in these enlightened days uses the CHS geometry for + * anything, but nonetheless try to get it right. If we fail * to get any good ideas from the device, construct something * which is IBM-PC friendly. */ Modified: head/sbin/camcontrol/camcontrol.c ============================================================================== --- head/sbin/camcontrol/camcontrol.c Sat Jan 7 14:39:45 2012 (r229777) +++ head/sbin/camcontrol/camcontrol.c Sat Jan 7 16:09:33 2012 (r229778) @@ -5732,7 +5732,7 @@ usage(int verbose) "defects arguments:\n" "-f format specify defect list format (block, bfi or phys)\n" "-G get the grown defect list\n" -"-P get the permanant defect list\n" +"-P get the permanent defect list\n" "inquiry arguments:\n" "-D get the standard inquiry data\n" "-S get the serial number\n" Modified: head/sbin/devfs/rule.c ============================================================================== --- head/sbin/devfs/rule.c Sat Jan 7 14:39:45 2012 (r229777) +++ head/sbin/devfs/rule.c Sat Jan 7 16:09:33 2012 (r229778) @@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$"); #include "extern.h" -static void rulespec_infp(FILE *fp, unsigned long reqest, devfs_rsnum rsnum); +static void rulespec_infp(FILE *fp, unsigned long request, devfs_rsnum rsnum); static void rulespec_instr(struct devfs_rule *dr, const char *str, devfs_rsnum rsnum); static void rulespec_intok(struct devfs_rule *dr, int ac, char **av, Modified: head/sbin/dhclient/dhclient-script.8 ============================================================================== --- head/sbin/dhclient/dhclient-script.8 Sat Jan 7 14:39:45 2012 (r229777) +++ head/sbin/dhclient/dhclient-script.8 Sat Jan 7 16:09:33 2012 (r229778) @@ -232,7 +232,7 @@ will check for the existence of .Pa /etc/dhclient-exit-hooks . If found, it will be sourced .Pq see Xr sh 1 . -These hooks scripts can be used to dynamically modify the enviornment at +These hooks scripts can be used to dynamically modify the environment at appropriate times during the DHCP negotiations. For example, if the administrator wishes to disable alias IP numbers on the DHCP interface, they might want to put the following in Modified: head/sbin/dhclient/options.c ============================================================================== --- head/sbin/dhclient/options.c Sat Jan 7 14:39:45 2012 (r229777) +++ head/sbin/dhclient/options.c Sat Jan 7 16:09:33 2012 (r229778) @@ -284,8 +284,8 @@ find_search_domain_name_len(struct optio option->data[i + 1]; if (pointer >= *offset) { /* - * The pointer must indicates a prior - * occurance. + * The pointer must indicate a prior + * occurrence. */ warning("Invalid forward pointer in DHCP " "Domain Search option compression."); Modified: head/sbin/fsck_ffs/fsck.h ============================================================================== --- head/sbin/fsck_ffs/fsck.h Sat Jan 7 14:39:45 2012 (r229777) +++ head/sbin/fsck_ffs/fsck.h Sat Jan 7 16:09:33 2012 (r229778) @@ -220,7 +220,7 @@ struct inodesc { * To check if a block has been found as a duplicate it is only * necessary to search from duplist through muldup. To find the * total number of times that a block has been found as a duplicate - * the entire list must be searched for occurences of the block + * the entire list must be searched for occurrences of the block * in question. The following diagram shows a sample list where * w (found twice), x (found once), y (found three times), and z * (found once) are duplicate block numbers: Modified: head/sbin/fsck_ffs/fsutil.c ============================================================================== --- head/sbin/fsck_ffs/fsutil.c Sat Jan 7 14:39:45 2012 (r229777) +++ head/sbin/fsck_ffs/fsutil.c Sat Jan 7 16:09:33 2012 (r229778) @@ -717,7 +717,7 @@ dofix(struct inodesc *idesc, const char #include /* - * An unexpected inconsistency occured. + * An unexpected inconsistency occurred. * Die if preening or file system is running with soft dependency protocol, * otherwise just print message and continue. */ Modified: head/sbin/hastctl/hastctl.8 ============================================================================== --- head/sbin/hastctl/hastctl.8 Sat Jan 7 14:39:45 2012 (r229777) +++ head/sbin/hastctl/hastctl.8 Sat Jan 7 16:09:33 2012 (r229778) @@ -97,7 +97,7 @@ If extent size is too small, there will related to dirty map updates, which will degrade performance of the given resource. If extent size is too large, synchronization, even in case of short -outage, can take a long time increasing the risk of loosing up-to-date +outage, can take a long time increasing the risk of losing up-to-date node before synchronization process is completed. The default extent size is .Va 2MB . Modified: head/sbin/hastd/activemap.c ============================================================================== --- head/sbin/hastd/activemap.c Sat Jan 7 14:39:45 2012 (r229777) +++ head/sbin/hastd/activemap.c Sat Jan 7 16:09:33 2012 (r229778) @@ -219,7 +219,7 @@ keepdirty_add(struct activemap *amp, int kd = keepdirty_find(amp, extent); if (kd != NULL) { /* - * Only move element at the begining. + * Only move element at the beginning. */ TAILQ_REMOVE(&->am_keepdirty, kd, kd_next); TAILQ_INSERT_HEAD(&->am_keepdirty, kd, kd_next); @@ -573,7 +573,7 @@ activemap_sync_rewind(struct activemap * return; } /* - * Mark that we want to start synchronization from the begining. + * Mark that we want to start synchronization from the beginning. */ amp->am_syncoff = -1; } Modified: head/sbin/hastd/hast_compression.c ============================================================================== --- head/sbin/hastd/hast_compression.c Sat Jan 7 14:39:45 2012 (r229777) +++ head/sbin/hastd/hast_compression.c Sat Jan 7 16:09:33 2012 (r229778) @@ -55,7 +55,7 @@ allzeros(const void *data, size_t size) * Because inside the loop we don't check at every step, we would * get an answer only after walking through entire buffer. * To return early if the buffer doesn't contain all zeros, we probe - * 8 bytes at the begining, in the middle and at the end of the buffer + * 8 bytes at the beginning, in the middle and at the end of the buffer * first. */ Modified: head/sbin/hastd/hastd.c ============================================================================== --- head/sbin/hastd/hastd.c Sat Jan 7 14:39:45 2012 (r229777) +++ head/sbin/hastd/hastd.c Sat Jan 7 16:09:33 2012 (r229778) @@ -786,7 +786,7 @@ listen_accept(struct hastd_listen *lst) pjdlog_debug(2, "%s: resource=%s", raddr, resname); token = nv_get_uint8_array(nvin, &size, "token"); /* - * NULL token means that this is first conection. + * NULL token means that this is first connection. */ if (token != NULL && size != sizeof(res->hr_token)) { pjdlog_error("Received token of invalid size from %s (expected %zu, got %zu).", Modified: head/sbin/hastd/lzf.h ============================================================================== --- head/sbin/hastd/lzf.h Sat Jan 7 14:39:45 2012 (r229777) +++ head/sbin/hastd/lzf.h Sat Jan 7 16:09:33 2012 (r229778) @@ -146,7 +146,7 @@ lzf_decompress (const void *const in_dat /* * Avoid assigning values to errno variable? for some embedding purposes - * (linux kernel for example), this is neccessary. NOTE: this breaks + * (linux kernel for example), this is necessary. NOTE: this breaks * the documentation in lzf.h. */ #ifndef AVOID_ERRNO @@ -167,7 +167,7 @@ lzf_decompress (const void *const in_dat * and return EINVAL if the input stream has been corrupted. This * only shields against overflowing the input buffer and will not * detect most corrupted streams. - * This check is not normally noticable on modern hardware + * This check is not normally noticeable on modern hardware * (<1% slowdown), but might slow down older cpus considerably. */ #ifndef CHECK_INPUT Modified: head/sbin/hastd/primary.c ============================================================================== --- head/sbin/hastd/primary.c Sat Jan 7 14:39:45 2012 (r229777) +++ head/sbin/hastd/primary.c Sat Jan 7 16:09:33 2012 (r229778) @@ -933,7 +933,7 @@ hastd_primary(struct hast_resource *res) /* * Create the guard thread first, so we can handle signals from the - * very begining. + * very beginning. */ error = pthread_create(&td, NULL, guard_thread, res); PJDLOG_ASSERT(error == 0); Modified: head/sbin/hastd/proto.c ============================================================================== --- head/sbin/hastd/proto.c Sat Jan 7 14:39:45 2012 (r229777) +++ head/sbin/hastd/proto.c Sat Jan 7 16:09:33 2012 (r229778) @@ -131,7 +131,7 @@ proto_common_setup(const char *srcaddr, /* * ret == 0 - success * ret == -1 - dstaddr is not for this protocol - * ret > 0 - right protocol, but an error occured + * ret > 0 - right protocol, but an error occurred */ if (ret >= 0) break; @@ -142,7 +142,7 @@ proto_common_setup(const char *srcaddr, return (-1); } if (ret > 0) { - /* An error occured. */ + /* An error occurred. */ errno = ret; return (-1); } Modified: head/sbin/ifconfig/ifieee80211.c ============================================================================== --- head/sbin/ifconfig/ifieee80211.c Sat Jan 7 14:39:45 2012 (r229777) +++ head/sbin/ifconfig/ifieee80211.c Sat Jan 7 16:09:33 2012 (r229778) @@ -884,7 +884,7 @@ set80211wepkey(const char *val, int d, i } /* - * This function is purely a NetBSD compatability interface. The NetBSD + * This function is purely a NetBSD compatibility interface. The NetBSD * interface is too inflexible, but it's there so we'll support it since * it's not all that hard. */ Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Sat Jan 7 14:39:45 2012 (r229777) +++ head/sbin/ipfw/ipfw2.c Sat Jan 7 16:09:33 2012 (r229778) @@ -454,8 +454,8 @@ _substrcmp(const char *str1, const char* * of the first. A warning is printed to stderr in the case that the * first string does not match the third. * - * This function exists to warn about the bizzare construction - * strncmp(str, "by", 2) which is used to allow people to use a shotcut + * This function exists to warn about the bizarre construction + * strncmp(str, "by", 2) which is used to allow people to use a shortcut * for "bytes". The problem is that in addition to accepting "by", * "byt", "byte", and "bytes", it also excepts "by_rabid_dogs" and any * other string beginning with "by". @@ -2866,9 +2866,9 @@ chkarg: ((struct sockaddr_in*)&result)->sin_addr.s_addr = INADDR_ANY; } else { - /* + /* * Resolve the host name or address to a family and a - * network representation of the addres. + * network representation of the address. */ if (getaddrinfo(*av, NULL, NULL, &res)) errx(EX_DATAERR, NULL); Modified: head/sbin/ipfw/main.c ============================================================================== --- head/sbin/ipfw/main.c Sat Jan 7 14:39:45 2012 (r229777) +++ head/sbin/ipfw/main.c Sat Jan 7 16:09:33 2012 (r229778) @@ -167,7 +167,7 @@ ipfw_main(int oldac, char **oldav) i++; bcopy(arg+j, av_p, i-j); av[ac] = av_p; - av_p += i-j; /* the lenght of the string */ + av_p += i-j; /* the length of the string */ *av_p++ = '\0'; ac++; j = i + 1; Modified: head/sbin/mdmfs/mdmfs.c ============================================================================== --- head/sbin/mdmfs/mdmfs.c Sat Jan 7 14:39:45 2012 (r229777) +++ head/sbin/mdmfs/mdmfs.c Sat Jan 7 16:09:33 2012 (r229778) @@ -632,7 +632,7 @@ run(int *ofd, const char *cmdline, ...) * loop. */ (void)fprintf(stderr, "DEBUG: running:"); - /* Should be equivilent to 'cmd' (before strsep, of course). */ + /* Should be equivalent to 'cmd' (before strsep, of course). */ for (i = 0; argv[i] != NULL; i++) (void)fprintf(stderr, " %s", argv[i]); (void)fprintf(stderr, "\n"); Modified: head/sbin/mount_nfs/mount_nfs.c ============================================================================== --- head/sbin/mount_nfs/mount_nfs.c Sat Jan 7 14:39:45 2012 (r229777) +++ head/sbin/mount_nfs/mount_nfs.c Sat Jan 7 16:09:33 2012 (r229778) @@ -788,7 +788,7 @@ getnfsargs(char *spec, struct iovec **io for (;;) { /* * Try each entry returned by getaddrinfo(). Note the - * occurence of remote errors by setting `remoteerr'. + * occurrence of remote errors by setting `remoteerr'. */ remoteerr = 0; for (ai = ai_nfs; ai != NULL; ai = ai->ai_next) { Modified: head/sbin/ping6/ping6.c ============================================================================== --- head/sbin/ping6/ping6.c Sat Jan 7 14:39:45 2012 (r229777) +++ head/sbin/ping6/ping6.c Sat Jan 7 16:09:33 2012 (r229778) @@ -1166,7 +1166,7 @@ main(int argc, char *argv[]) /* * receive control messages only. Process the - * exceptions (currently the only possiblity is + * exceptions (currently the only possibility is * a path MTU notification.) */ if ((mtu = get_pathmtu(&m)) > 0) { Modified: head/sbin/reboot/nextboot.8 ============================================================================== --- head/sbin/reboot/nextboot.8 Sat Jan 7 14:39:45 2012 (r229777) +++ head/sbin/reboot/nextboot.8 Sat Jan 7 16:09:33 2012 (r229778) @@ -117,7 +117,7 @@ The .Nm code is implemented in the .Xr loader 8 . -It is not the most throughly tested code. +It is not the most thoroughly tested code. It is also my first attempt to write in Forth. .Pp Finally, it does some evil things like writing to the file system before it Modified: head/sbin/routed/main.c ============================================================================== --- head/sbin/routed/main.c Sat Jan 7 14:39:45 2012 (r229777) +++ head/sbin/routed/main.c Sat Jan 7 16:09:33 2012 (r229778) @@ -414,7 +414,7 @@ usage: continue; } - /* Check the kernel table occassionally for mysteriously + /* Check the kernel table occasionally for mysteriously * evaporated routes */ timevalsub(&t2, &flush_kern_timer, &now); @@ -446,7 +446,7 @@ usage: * the previous update was finished. * Even if we just started after discovering * a 2nd interface or were otherwise delayed, - * pick a 30-second aniversary of the + * pick a 30-second anniversary of the * original broadcast time. */ n = 1 + (0-t2.tv_sec)/SUPPLY_INTERVAL; Modified: head/sbin/routed/radix.c ============================================================================== --- head/sbin/routed/radix.c Sat Jan 7 14:39:45 2012 (r229777) +++ head/sbin/routed/radix.c Sat Jan 7 16:09:33 2012 (r229778) @@ -97,7 +97,7 @@ static struct radix_node *rn_match(void * node as high in the tree as we can go. * * The present version of the code makes use of normal routes in short- - * circuiting an explict mask and compare operation when testing whether + * circuiting an explicit mask and compare operation when testing whether * a key satisfies a normal route, and also in remembering the unique leaf * that governs a subtree. */ @@ -247,7 +247,7 @@ rn_match(void *v_arg, * * In this case, we have a complete match of the key. Unless * the node is one of the roots, we are finished. - * If it is the zeros root, then take what we have, prefering + * If it is the zeros root, then take what we have, preferring * any real data. * If it is the ones root, then pretend the target key was followed * by a byte of zeros. Modified: head/sbin/routed/table.c ============================================================================== --- head/sbin/routed/table.c Sat Jan 7 14:39:45 2012 (r229777) +++ head/sbin/routed/table.c Sat Jan 7 16:09:33 2012 (r229778) @@ -2071,7 +2071,7 @@ walk_age(struct radix_node *rn, /* try to switch to an alternative */ rtswitch(RT, 0); - /* Delete a dead route after it has been publically mourned. */ + /* Delete a dead route after it has been publicly mourned. */ if (now_garbage > RT->rt_time) { rtdelete(RT); return 0; From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 16:09:44 2012 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 6F62110657C7; Sat, 7 Jan 2012 16:09:44 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4E72B8FC12; Sat, 7 Jan 2012 16:09: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 q07G9i6J046711; Sat, 7 Jan 2012 16:09:44 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q07G9iiG046705; Sat, 7 Jan 2012 16:09:44 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201201071609.q07G9iiG046705@svn.freebsd.org> From: Ulrich Spoerlein Date: Sat, 7 Jan 2012 16:09: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: r229779 - in head/release: doc/en_US.ISO8859-1/relnotes picobsd/tinyware/passwd picobsd/tinyware/simple_httpd 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, 07 Jan 2012 16:09:44 -0000 Author: uqs Date: Sat Jan 7 16:09:43 2012 New Revision: 229779 URL: http://svn.freebsd.org/changeset/base/229779 Log: Spelling fixes for release/ Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.sgml head/release/picobsd/tinyware/passwd/local_passwd.c head/release/picobsd/tinyware/passwd/pw_copy.c head/release/picobsd/tinyware/simple_httpd/README Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.sgml ============================================================================== --- head/release/doc/en_US.ISO8859-1/relnotes/article.sgml Sat Jan 7 16:09:33 2012 (r229778) +++ head/release/doc/en_US.ISO8859-1/relnotes/article.sgml Sat Jan 7 16:09:43 2012 (r229779) @@ -339,7 +339,7 @@ with the same semantics as (for example) &man.chmod.1;. - For compatiblity with other implementations, &man.cp.1; now + For compatibility with other implementations, &man.cp.1; now supports a flag, which is equivalent to specifying the flags. Modified: head/release/picobsd/tinyware/passwd/local_passwd.c ============================================================================== --- head/release/picobsd/tinyware/passwd/local_passwd.c Sat Jan 7 16:09:33 2012 (r229778) +++ head/release/picobsd/tinyware/passwd/local_passwd.c Sat Jan 7 16:09:43 2012 (r229779) @@ -172,7 +172,7 @@ getnewpasswd(pw, nis) to64(&salt[5], random(), 4); salt[9] = '\0'; #else - /* Make a good size salt for algoritms that can use it. */ + /* Make a good size salt for algorithms that can use it. */ gettimeofday(&tv,0); #ifdef LOGIN_CAP if (login_setcryptfmt(lc, "md5", NULL) == NULL) Modified: head/release/picobsd/tinyware/passwd/pw_copy.c ============================================================================== --- head/release/picobsd/tinyware/passwd/pw_copy.c Sat Jan 7 16:09:33 2012 (r229778) +++ head/release/picobsd/tinyware/passwd/pw_copy.c Sat Jan 7 16:09:43 2012 (r229779) @@ -193,7 +193,7 @@ err: pw_error(NULL, 1, 1); * by default, warning for IDs greater than USHRT_MAX. * * If pw_big_ids_warning is anything other than -1 on entry to pw_scan() - * it will be set based on the existance of PW_SCAN_BIG_IDS in the + * it will be set based on the existence of PW_SCAN_BIG_IDS in the * environment. */ int pw_big_ids_warning = -1; Modified: head/release/picobsd/tinyware/simple_httpd/README ============================================================================== --- head/release/picobsd/tinyware/simple_httpd/README Sat Jan 7 16:09:33 2012 (r229778) +++ head/release/picobsd/tinyware/simple_httpd/README Sat Jan 7 16:09:43 2012 (r229779) @@ -21,14 +21,14 @@ of html,gif,cgi whatever. Your traditio The "fetch" mode supports file transfer over httpd. This is best thought of as mate for fetch(1). This feature can be -usefull to transfer a file from one host to another. +useful to transfer a file from one host to another. Simple_httpd has the ability to run CGI scripts. All CGI scripts must be located in ${DOCUMENT_ROOT}/cgi-bin. The -server currently only sets 3 enviroment variables before calling +server currently only sets 3 environment variables before calling the script. -CGI Enviroment variables are below: +CGI Environment variables are below: SERVER_SOFTWARE = FreeBSD/PicoBSD REMOTE_HOST = client.canada_lower_taxes.com @@ -61,7 +61,7 @@ daemonize without fear of output on stdo -D Do not daemonize. The server will not run in the background. It will -stay attached to the tty. This is usefull for debugging. In this +stay attached to the tty. This is useful for debugging. In this mode no log file is created. Logging info is to stdout. This option is automatically selected if fetch option is selected. @@ -139,7 +139,7 @@ receiver# fetch http://sender.com:53/Ind To Do ===== -Simple authentication would be very usefull[understatment]. +Simple authentication would be very useful [understatment]. /etc/passwd or PAM would be nice. I think a netmask option would be good. Most internet appliances From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 16:09:55 2012 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 5EA3F10656D5; Sat, 7 Jan 2012 16:09:55 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 462508FC18; Sat, 7 Jan 2012 16:09: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 q07G9tql046772; Sat, 7 Jan 2012 16:09:55 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q07G9sDx046751; Sat, 7 Jan 2012 16:09:54 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201201071609.q07G9sDx046751@svn.freebsd.org> From: Ulrich Spoerlein Date: Sat, 7 Jan 2012 16:09:54 +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: r229780 - in head/libexec: bootpd bootpd/bootpgw bootpd/tools/bootptest ftpd getty lukemftpd rbootd revnetgroup rshd rtld-aout rtld-elf rtld-elf/mips rtld-elf/sparc64 tftpd 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, 07 Jan 2012 16:09:55 -0000 Author: uqs Date: Sat Jan 7 16:09:54 2012 New Revision: 229780 URL: http://svn.freebsd.org/changeset/base/229780 Log: Spelling fixes for libexec/ Modified: head/libexec/bootpd/bootpd.c head/libexec/bootpd/bootpgw/bootpgw.c head/libexec/bootpd/hash.h head/libexec/bootpd/tools/bootptest/bootptest.c head/libexec/bootpd/tools/bootptest/print-bootp.c head/libexec/ftpd/ftpcmd.y head/libexec/getty/init.c head/libexec/lukemftpd/nbsd_pidfile.h head/libexec/rbootd/parseconf.c head/libexec/rbootd/rbootd.c head/libexec/rbootd/rmpproto.c head/libexec/revnetgroup/parse_netgroup.c head/libexec/rshd/rshd.8 head/libexec/rtld-aout/shlib.c head/libexec/rtld-elf/mips/reloc.c head/libexec/rtld-elf/rtld.h head/libexec/rtld-elf/sparc64/reloc.c head/libexec/tftpd/tftp-io.c head/libexec/tftpd/tftp-utils.h Modified: head/libexec/bootpd/bootpd.c ============================================================================== --- head/libexec/bootpd/bootpd.c Sat Jan 7 16:09:43 2012 (r229779) +++ head/libexec/bootpd/bootpd.c Sat Jan 7 16:09:54 2012 (r229780) @@ -663,7 +663,7 @@ ignoring request for server %s from clie bp->bp_op = BOOTREPLY; if (bp->bp_ciaddr.s_addr == 0) { /* - * client doesnt know his IP address, + * client doesn't know his IP address, * search by hardware address. */ if (debug > 1) { @@ -1119,7 +1119,7 @@ sendreply(forward, dst_override) /* * This call checks read access to a file. It returns 0 if the file given - * by "path" exists and is publically readable. A value of -1 is returned if + * by "path" exists and is publicly readable. A value of -1 is returned if * access is not permitted or an error occurs. Successful calls also * return the file size in bytes using the long pointer "filesize". * Modified: head/libexec/bootpd/bootpgw/bootpgw.c ============================================================================== --- head/libexec/bootpd/bootpgw/bootpgw.c Sat Jan 7 16:09:43 2012 (r229779) +++ head/libexec/bootpd/bootpgw/bootpgw.c Sat Jan 7 16:09:54 2012 (r229780) @@ -534,7 +534,7 @@ handle_request() /* Has this packet hopped too many times? */ hops = bp->bp_hops; if (++hops > maxhops) { - report(LOG_NOTICE, "reqest from %s reached hop limit", + report(LOG_NOTICE, "request from %s reached hop limit", inet_ntoa(recv_addr.sin_addr)); return; } Modified: head/libexec/bootpd/hash.h ============================================================================== --- head/libexec/bootpd/hash.h Sat Jan 7 16:09:43 2012 (r229779) +++ head/libexec/bootpd/hash.h Sat Jan 7 16:09:54 2012 (r229780) @@ -81,7 +81,7 @@ SOFTWARE. * * A generalized hash function, hash_HashFunction(), is included * with this package to make things a little easier. It is not - * guarenteed to use the best hash algorithm in existence. . . . + * guaranteed to use the best hash algorithm in existence. . . . */ Modified: head/libexec/bootpd/tools/bootptest/bootptest.c ============================================================================== --- head/libexec/bootpd/tools/bootptest/bootptest.c Sat Jan 7 16:09:43 2012 (r229779) +++ head/libexec/bootpd/tools/bootptest/bootptest.c Sat Jan 7 16:09:54 2012 (r229780) @@ -186,7 +186,7 @@ main(argc, argv) break; switch (argv[0][1]) { - case 'f': /* File name to reqest. */ + case 'f': /* File name to request. */ if (argc < 2) goto error; argc--; argv++; Modified: head/libexec/bootpd/tools/bootptest/print-bootp.c ============================================================================== --- head/libexec/bootpd/tools/bootptest/print-bootp.c Sat Jan 7 16:09:43 2012 (r229779) +++ head/libexec/bootpd/tools/bootptest/print-bootp.c Sat Jan 7 16:09:54 2012 (r229780) @@ -187,7 +187,7 @@ bootp_print(bp, length, sport, dport) /* * Option description data follows. - * These are decribed in: RFC-1048, RFC-1395, RFC-1497, RFC-1533 + * These are described in: RFC-1048, RFC-1395, RFC-1497, RFC-1533 * * The first char of each option string encodes the data format: * ?: unknown Modified: head/libexec/ftpd/ftpcmd.y ============================================================================== --- head/libexec/ftpd/ftpcmd.y Sat Jan 7 16:09:43 2012 (r229779) +++ head/libexec/ftpd/ftpcmd.y Sat Jan 7 16:09:54 2012 (r229780) @@ -1718,7 +1718,7 @@ exptilde(char *s) * Avoid expanding to a pathname including '\r' or '\n' in order to * not disrupt the FTP protocol. * The expansion found must be unique. - * Return the result as a malloced string, or NULL if an error occured. + * Return the result as a malloced string, or NULL if an error occurred. * * Problem: this production is used for all pathname * processing, but only gives a 550 error reply. Modified: head/libexec/getty/init.c ============================================================================== --- head/libexec/getty/init.c Sat Jan 7 16:09:43 2012 (r229779) +++ head/libexec/getty/init.c Sat Jan 7 16:09:54 2012 (r229780) @@ -64,7 +64,7 @@ struct gettystrs gettystrs[] = { { "et", &omode.c_cc[VEOF] }, /* eof chatacter (eot) */ { "pc", nullstr }, /* pad character */ { "tt" }, /* terminal type */ - { "ev" }, /* enviroment */ + { "ev" }, /* environment */ { "lo", loginprg }, /* login program */ { "hn", hostname }, /* host name */ { "he" }, /* host name edit */ Modified: head/libexec/lukemftpd/nbsd_pidfile.h ============================================================================== --- head/libexec/lukemftpd/nbsd_pidfile.h Sat Jan 7 16:09:43 2012 (r229779) +++ head/libexec/lukemftpd/nbsd_pidfile.h Sat Jan 7 16:09:54 2012 (r229780) @@ -10,7 +10,7 @@ pidfile(const char *basename) pid_t otherpid, childpid; if (basename != NULL) { - errx(EX_USAGE, "Need to impliment NetBSD semantics."); + errx(EX_USAGE, "Need to implement NetBSD semantics."); } pfh = pidfile_open(basename, 0644, &otherpid); Modified: head/libexec/rbootd/parseconf.c ============================================================================== --- head/libexec/rbootd/parseconf.c Sat Jan 7 16:09:43 2012 (r229779) +++ head/libexec/rbootd/parseconf.c Sat Jan 7 16:09:54 2012 (r229780) @@ -145,7 +145,7 @@ ParseConfig(void) */ if ((addr = ParseAddr(bcp)) == NULL) { syslog(LOG_ERR, - "ParseConfig: line %d: cant parse <%s>", + "ParseConfig: line %d: can't parse <%s>", linecnt, bcp); continue; } @@ -193,7 +193,7 @@ ParseConfig(void) /* * Restricted list of boot files were spec'd, * however, none of them were found. Since we - * apparently cant let them boot "just anything", + * apparently can't let them boot "just anything", * the entire record is invalidated. */ if (i == 0) { @@ -355,7 +355,7 @@ GetBootFiles(void) (void) closedir(dfd); /* close BootDir */ - if (i == 0) /* cant find any boot files */ + if (i == 0) /* can't find any boot files */ syslog(LOG_ERR, "GetBootFiles: no boot files (%s)\n", BootDir); return(i); Modified: head/libexec/rbootd/rbootd.c ============================================================================== --- head/libexec/rbootd/rbootd.c Sat Jan 7 16:09:43 2012 (r229779) +++ head/libexec/rbootd/rbootd.c Sat Jan 7 16:09:54 2012 (r229780) @@ -231,7 +231,7 @@ main(int argc, char *argv[]) r = rset; - if (RmpConns == NULL) { /* timeout isnt necessary */ + if (RmpConns == NULL) { /* timeout isn't necessary */ nsel = select(maxfds, &r, NULL, NULL, NULL); } else { timeout.tv_sec = RMP_TIMEOUT; Modified: head/libexec/rbootd/rmpproto.c ============================================================================== --- head/libexec/rbootd/rmpproto.c Sat Jan 7 16:09:43 2012 (r229779) +++ head/libexec/rbootd/rmpproto.c Sat Jan 7 16:09:54 2012 (r229780) @@ -401,7 +401,7 @@ SendReadRepl(RMPCONN *rconn) int madeconn = 0; /* - * Find the old connection. If one doesnt exist, create one only + * Find the old connection. If one doesn't exist, create one only * to return the error code. */ if ((oldconn = FindConn(rconn)) == NULL) { @@ -515,7 +515,7 @@ BootDone(RMPCONN *rconn) struct rmp_packet *rpl; /* - * If we cant find the connection, ignore the request. + * If we can't find the connection, ignore the request. */ if ((oldconn = FindConn(rconn)) == NULL) { syslog(LOG_ERR, "BootDone: no existing connection (%s)", Modified: head/libexec/revnetgroup/parse_netgroup.c ============================================================================== --- head/libexec/revnetgroup/parse_netgroup.c Sat Jan 7 16:09:43 2012 (r229779) +++ head/libexec/revnetgroup/parse_netgroup.c Sat Jan 7 16:09:54 2012 (r229780) @@ -199,8 +199,8 @@ parse_netgrp(char *group) if (lp->l_parsed) { #ifdef DEBUG /* - * This error message is largely superflous since the - * code handles the error condition sucessfully, and + * This error message is largely superfluous since the + * code handles the error condition successfully, and * spewing it out from inside libc can actually hose * certain programs. */ Modified: head/libexec/rshd/rshd.8 ============================================================================== --- head/libexec/rshd/rshd.8 Sat Jan 7 16:09:43 2012 (r229779) +++ head/libexec/rshd/rshd.8 Sat Jan 7 16:09:54 2012 (r229780) @@ -148,7 +148,7 @@ by The options are as follows: .Bl -tag -width indent .It Fl a -This flag is ignored, and is present for compatability purposes. +This flag is ignored, and is present for compatibility purposes. .It Fl D Sets the TCP_NODELAY socket option, which improves the performance of small back-to-back writes at the expense of additional network Modified: head/libexec/rtld-aout/shlib.c ============================================================================== --- head/libexec/rtld-aout/shlib.c Sat Jan 7 16:09:43 2012 (r229779) +++ head/libexec/rtld-aout/shlib.c Sat Jan 7 16:09:54 2012 (r229780) @@ -159,7 +159,7 @@ cmpndewey(int d1[], int n1, int d2[], in if (i == n2) return 1; - errx(1, "cmpndewey: cant happen"); + errx(1, "cmpndewey: can't happen"); return 0; } Modified: head/libexec/rtld-elf/mips/reloc.c ============================================================================== --- head/libexec/rtld-elf/mips/reloc.c Sat Jan 7 16:09:43 2012 (r229779) +++ head/libexec/rtld-elf/mips/reloc.c Sat Jan 7 16:09:54 2012 (r229780) @@ -358,7 +358,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry def = find_symdef(i, obj, &defobj, false, NULL, lockstate); if (def == NULL) { - dbg("Warning4, cant find symbole %d", i); + dbg("Warning4, can't find symbole %d", i); return -1; } *got = def->st_value + (Elf_Addr)defobj->relocbase; Modified: head/libexec/rtld-elf/rtld.h ============================================================================== --- head/libexec/rtld-elf/rtld.h Sat Jan 7 16:09:43 2012 (r229779) +++ head/libexec/rtld-elf/rtld.h Sat Jan 7 16:09:54 2012 (r229780) @@ -238,7 +238,7 @@ typedef struct Struct_Obj_Entry { Objlist dagmembers; /* DAG has these members (%) */ dev_t dev; /* Object's filesystem's device */ ino_t ino; /* Object's inode number */ - void *priv; /* Platform-dependant */ + void *priv; /* Platform-dependent */ } Obj_Entry; #define RTLD_MAGIC 0xd550b87a Modified: head/libexec/rtld-elf/sparc64/reloc.c ============================================================================== --- head/libexec/rtld-elf/sparc64/reloc.c Sat Jan 7 16:09:43 2012 (r229779) +++ head/libexec/rtld-elf/sparc64/reloc.c Sat Jan 7 16:09:54 2012 (r229780) @@ -623,7 +623,7 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr flush(where, 4); } else if (target >= 0 && target < (1L<<32)) { /* - * We're withing 32-bits of address zero. + * We're within 32-bits of address zero. * * The resulting code in the jump slot is: * @@ -643,7 +643,7 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr flush(where, 4); } else if (target <= 0 && target > -(1L<<32)) { /* - * We're withing 32-bits of address -1. + * We're within 32-bits of address -1. * * The resulting code in the jump slot is: * @@ -665,7 +665,7 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr flush(where, 4); } else if (offset <= (1L<<32) && offset >= -((1L<<32) - 4)) { /* - * We're withing 32-bits -- we can use a direct call + * We're within 32-bits -- we can use a direct call * insn * * The resulting code in the jump slot is: @@ -688,7 +688,7 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr flush(where, 4); } else if (offset >= 0 && offset < (1L<<44)) { /* - * We're withing 44 bits. We can generate this + * We're within 44 bits. We can generate this * pattern: * * The resulting code in the jump slot is: @@ -713,7 +713,7 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr flush(where, 4); } else if (offset < 0 && offset > -(1L<<44)) { /* - * We're withing 44 bits. We can generate this + * We're within 44 bits. We can generate this * pattern: * * The resulting code in the jump slot is: Modified: head/libexec/tftpd/tftp-io.c ============================================================================== --- head/libexec/tftpd/tftp-io.c Sat Jan 7 16:09:43 2012 (r229779) +++ head/libexec/tftpd/tftp-io.c Sat Jan 7 16:09:54 2012 (r229780) @@ -72,13 +72,13 @@ struct errmsg { #define DROPPACKET(s) \ if (packetdroppercentage != 0 && \ random()%100 < packetdroppercentage) { \ - tftp_log(LOG_DEBUG, "Artifical packet drop in %s", s); \ + tftp_log(LOG_DEBUG, "Artificial packet drop in %s", s); \ return; \ } #define DROPPACKETn(s,n) \ if (packetdroppercentage != 0 && \ random()%100 < packetdroppercentage) { \ - tftp_log(LOG_DEBUG, "Artifical packet drop in %s", s); \ + tftp_log(LOG_DEBUG, "Artificial packet drop in %s", s); \ return (n); \ } Modified: head/libexec/tftpd/tftp-utils.h ============================================================================== --- head/libexec/tftpd/tftp-utils.h Sat Jan 7 16:09:43 2012 (r229779) +++ head/libexec/tftpd/tftp-utils.h Sat Jan 7 16:09:54 2012 (r229780) @@ -36,11 +36,11 @@ __FBSDID("$FreeBSD$"); #define MAXPKTSIZE (MAXSEGSIZE + 4) /* Maximum size of the packet */ /* For the blksize option */ -#define BLKSIZE_MIN 8 /* Minumum size of the data segment */ +#define BLKSIZE_MIN 8 /* Minimum size of the data segment */ #define BLKSIZE_MAX MAXSEGSIZE /* Maximum size of the data segment */ /* For the timeout option */ -#define TIMEOUT_MIN 0 /* Minumum timeout value */ +#define TIMEOUT_MIN 0 /* Minimum timeout value */ #define TIMEOUT_MAX 255 /* Maximum timeout value */ #define MIN_TIMEOUTS 3 From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 16:10:15 2012 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 F026710656D7; Sat, 7 Jan 2012 16:10:15 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D8E998FC15; Sat, 7 Jan 2012 16:10: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 q07GAFsU046832; Sat, 7 Jan 2012 16:10:15 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q07GAFji046824; Sat, 7 Jan 2012 16:10:15 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201201071610.q07GAFji046824@svn.freebsd.org> From: Ulrich Spoerlein Date: Sat, 7 Jan 2012 16:10: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: r229781 - in head/include: . arpa gssapi rpc rpcsvc 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, 07 Jan 2012 16:10:16 -0000 Author: uqs Date: Sat Jan 7 16:10:15 2012 New Revision: 229781 URL: http://svn.freebsd.org/changeset/base/229781 Log: Spelling fixes for include/ Modified: head/include/arpa/nameser_compat.h head/include/gssapi/gssapi.h head/include/resolv.h head/include/rpc/svc.h head/include/rpcsvc/mount.x head/include/rpcsvc/nfs_prot.x head/include/rpcsvc/nis.x Modified: head/include/arpa/nameser_compat.h ============================================================================== --- head/include/arpa/nameser_compat.h Sat Jan 7 16:09:54 2012 (r229780) +++ head/include/arpa/nameser_compat.h Sat Jan 7 16:10:15 2012 (r229781) @@ -63,7 +63,7 @@ typedef struct { /* fields in third byte */ unsigned qr: 1; /*%< response flag */ unsigned opcode: 4; /*%< purpose of message */ - unsigned aa: 1; /*%< authoritive answer */ + unsigned aa: 1; /*%< authoritative answer */ unsigned tc: 1; /*%< truncated message */ unsigned rd: 1; /*%< recursion desired */ /* fields in fourth byte */ @@ -77,7 +77,7 @@ typedef struct { /* fields in third byte */ unsigned rd :1; /*%< recursion desired */ unsigned tc :1; /*%< truncated message */ - unsigned aa :1; /*%< authoritive answer */ + unsigned aa :1; /*%< authoritative answer */ unsigned opcode :4; /*%< purpose of message */ unsigned qr :1; /*%< response flag */ /* fields in fourth byte */ Modified: head/include/gssapi/gssapi.h ============================================================================== --- head/include/gssapi/gssapi.h Sat Jan 7 16:09:54 2012 (r229780) +++ head/include/gssapi/gssapi.h Sat Jan 7 16:10:15 2012 (r229781) @@ -756,11 +756,11 @@ OM_uint32 gss_release_oid OM_uint32 gss_decapsulate_token (const gss_buffer_t, /* mechanism independent token */ gss_OID, /* desired mechanism */ - gss_buffer_t /* decapsulated mechanism dependant token */ + gss_buffer_t /* decapsulated mechanism dependent token */ ); OM_uint32 gss_encapsulate_token - (const gss_buffer_t, /* mechanism dependant token */ + (const gss_buffer_t, /* mechanism dependent token */ gss_OID, /* desired mechanism */ gss_buffer_t /* encapsulated mechanism independent token */ ); Modified: head/include/resolv.h ============================================================================== --- head/include/resolv.h Sat Jan 7 16:09:54 2012 (r229780) +++ head/include/resolv.h Sat Jan 7 16:10:15 2012 (r229781) @@ -184,7 +184,7 @@ struct __res_state { u_int16_t nscount; u_int16_t nstimes[MAXNS]; /*%< ms. */ int nssocks[MAXNS]; - struct __res_state_ext *ext; /*%< extention for IPv6 */ + struct __res_state_ext *ext; /*%< extension for IPv6 */ } _ext; } _u; }; Modified: head/include/rpc/svc.h ============================================================================== --- head/include/rpc/svc.h Sat Jan 7 16:09:54 2012 (r229780) +++ head/include/rpc/svc.h Sat Jan 7 16:10:15 2012 (r229781) @@ -314,7 +314,7 @@ __END_DECLS * Somebody has to wait for incoming requests and then call the correct * service routine. The routine svc_run does infinite waiting; i.e., * svc_run never returns. - * Since another (co-existant) package may wish to selectively wait for + * Since another (co-existent) package may wish to selectively wait for * incoming calls or other events outside of the rpc architecture, the * routine svc_getreq is provided. It must be passed readfds, the * "in-place" results of a select system call (see select, section 2). Modified: head/include/rpcsvc/mount.x ============================================================================== --- head/include/rpcsvc/mount.x Sat Jan 7 16:09:54 2012 (r229780) +++ head/include/rpcsvc/mount.x Sat Jan 7 16:10:15 2012 (r229781) @@ -150,7 +150,7 @@ program MOUNTPROG { version MOUNTVERS { /* * Does no work. It is made available in all RPC services - * to allow server reponse testing and timing + * to allow server response testing and timing */ void MOUNTPROC_NULL(void) = 0; @@ -205,7 +205,7 @@ program MOUNTPROG { version MOUNTVERS3 { /* * Does no work. It is made available in all RPC services - * to allow server reponse testing and timing + * to allow server response testing and timing */ void MOUNTPROC_NULL(void) = 0; Modified: head/include/rpcsvc/nfs_prot.x ============================================================================== --- head/include/rpcsvc/nfs_prot.x Sat Jan 7 16:09:54 2012 (r229780) +++ head/include/rpcsvc/nfs_prot.x Sat Jan 7 16:10:15 2012 (r229781) @@ -121,7 +121,7 @@ struct fattr { unsigned uid; /* owner user id */ unsigned gid; /* owner group id */ unsigned size; /* file size in bytes */ - unsigned blocksize; /* prefered block size */ + unsigned blocksize; /* preferred block size */ unsigned rdev; /* special device # */ unsigned blocks; /* Kb of disk used by file */ unsigned fsid; /* device # */ @@ -402,7 +402,7 @@ struct fattr3 { uid3 uid; /* owner user id */ gid3 gid; /* owner group id */ size3 size; /* file size in bytes */ - size3 used; /* prefered block size */ + size3 used; /* preferred block size */ specdata3 rdev; /* special device # */ uint64 fsid; /* device # */ fileid3 fileid; /* inode # */ Modified: head/include/rpcsvc/nis.x ============================================================================== --- head/include/rpcsvc/nis.x Sat Jan 7 16:09:54 2012 (r229780) +++ head/include/rpcsvc/nis.x Sat Jan 7 16:10:15 2012 (r229781) @@ -192,8 +192,8 @@ struct ping_args { * note that modifications will appear as two entries, for names, they have * an "OLD" entry followed by a "NEW" entry. For entries in tables, there * is a remove followed by an add. It is done this way so that we can read - * the log backwards to back out transactions and forwards to propogate - * updated. + * the log backwards to back out transactions and forwards to propagate + * updates. */ enum log_entry_t { LOG_NOP = 0, From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 16:10:24 2012 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 366C110656E9; Sat, 7 Jan 2012 16:10:24 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 214188FC1B; Sat, 7 Jan 2012 16:10: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 q07GANU7046874; Sat, 7 Jan 2012 16:10:23 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q07GANCs046872; Sat, 7 Jan 2012 16:10:23 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201201071610.q07GANCs046872@svn.freebsd.org> From: Ulrich Spoerlein Date: Sat, 7 Jan 2012 16:10:23 +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: r229782 - head/bin/ps 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, 07 Jan 2012 16:10:24 -0000 Author: uqs Date: Sat Jan 7 16:10:23 2012 New Revision: 229782 URL: http://svn.freebsd.org/changeset/base/229782 Log: Spelling fixes for bin/ Modified: head/bin/ps/ps.c Modified: head/bin/ps/ps.c ============================================================================== --- head/bin/ps/ps.c Sat Jan 7 16:10:15 2012 (r229781) +++ head/bin/ps/ps.c Sat Jan 7 16:10:23 2012 (r229782) @@ -625,7 +625,7 @@ main(int argc, char *argv[]) ks = STAILQ_FIRST(&kinfo[i].ki_ks); STAILQ_REMOVE_HEAD(&kinfo[i].ki_ks, ks_next); - /* Truncate rightmost column if neccessary. */ + /* Truncate rightmost column if necessary. */ if (STAILQ_NEXT(vent, next_ve) == NULL && termwidth != UNLIMITED && ks->ks_str != NULL) { left = termwidth - linelen; From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 16:10:33 2012 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 0DECA106573C; Sat, 7 Jan 2012 16:10:33 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D23918FC16; Sat, 7 Jan 2012 16:10: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 q07GAWiq046922; Sat, 7 Jan 2012 16:10:32 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q07GAWZA046912; Sat, 7 Jan 2012 16:10:32 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201201071610.q07GAWZA046912@svn.freebsd.org> From: Ulrich Spoerlein Date: Sat, 7 Jan 2012 16:10: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: r229783 - in head/etc: . namedb rc.d 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, 07 Jan 2012 16:10:33 -0000 Author: uqs Date: Sat Jan 7 16:10:32 2012 New Revision: 229783 URL: http://svn.freebsd.org/changeset/base/229783 Log: Spelling fixes for etc/ Modified: head/etc/mac.conf head/etc/namedb/named.conf head/etc/network.subr head/etc/rc.d/bgfsck head/etc/rc.firewall head/etc/rc.initdiskless head/etc/rc.subr head/etc/services Modified: head/etc/mac.conf ============================================================================== --- head/etc/mac.conf Sat Jan 7 16:10:23 2012 (r229782) +++ head/etc/mac.conf Sat Jan 7 16:10:32 2012 (r229783) @@ -3,7 +3,7 @@ # # TrustedBSD MAC userland policy configuration file. Kernel modules # export label information, and mac.conf indicates to userland -# applications what defaults they should use in the absense of any +# applications what defaults they should use in the absence of any # other user-provided information. # Modified: head/etc/namedb/named.conf ============================================================================== --- head/etc/namedb/named.conf Sat Jan 7 16:10:23 2012 (r229782) +++ head/etc/namedb/named.conf Sat Jan 7 16:10:32 2012 (r229783) @@ -94,7 +94,7 @@ zone "." { type hint; file "/etc/namedb/ As documented at http://dns.icann.org/services/axfr/ these zones: "." (the root), ARPA, IN-ADDR.ARPA, IP6.ARPA, and ROOT-SERVERS.NET - are availble for AXFR from these servers on IPv4 and IPv6: + are available for AXFR from these servers on IPv4 and IPv6: xfr.lax.dns.icann.org, xfr.cjr.dns.icann.org */ /* Modified: head/etc/network.subr ============================================================================== --- head/etc/network.subr Sat Jan 7 16:10:23 2012 (r229782) +++ head/etc/network.subr Sat Jan 7 16:10:32 2012 (r229783) @@ -139,7 +139,7 @@ ifconfig_up() _cfg=0 fi - # backward compatiblity: $ipv6_ifconfig_IF + # backward compatibility: $ipv6_ifconfig_IF ifconfig_args=`get_if_var $1 ipv6_ifconfig_IF` if [ -n "${ifconfig_args}" ]; then warn "\$ipv6_ifconfig_$1 is obsolete." \ Modified: head/etc/rc.d/bgfsck ============================================================================== --- head/etc/rc.d/bgfsck Sat Jan 7 16:10:23 2012 (r229782) +++ head/etc/rc.d/bgfsck Sat Jan 7 16:10:32 2012 (r229783) @@ -22,7 +22,7 @@ bgfsck_start () background_fsck_delay=0 fi if [ ${background_fsck_delay} -lt 0 ]; then - echo "Background file system checks delayed indefinitly" + echo "Background file system checks delayed indefinitely" return 0 fi Modified: head/etc/rc.firewall ============================================================================== --- head/etc/rc.firewall Sat Jan 7 16:10:23 2012 (r229782) +++ head/etc/rc.firewall Sat Jan 7 16:10:32 2012 (r229783) @@ -46,7 +46,7 @@ fi # client - will try to protect just this machine # simple - will try to protect a whole network # closed - totally disables IP services except via lo0 interface -# workstation - will try to protect just this machine using statefull +# workstation - will try to protect just this machine using stateful # firewalling. See below for rc.conf variables used # UNKNOWN - disables the loading of firewall rules. # filename - will load the rules in the given filename (full path required) @@ -105,7 +105,7 @@ setup_ipv6_mandatory () { ${fwcmd} add pass ipv6-icmp from fe80::/10 to fe80::/10 ${fwcmd} add pass ipv6-icmp from fe80::/10 to ff02::/16 - # Allow ICMPv6 destination unreach + # Allow ICMPv6 destination unreachable ${fwcmd} add pass ipv6-icmp from any to any icmp6types 1 # Allow NS/NA/toobig (don't filter it out) @@ -437,7 +437,7 @@ case ${firewall_type} in # default denied packets should be # logged (in /var/log/security). # firewall_nologports: List of TCP/UDP ports for which - # denied incomming packets are not + # denied incoming packets are not # logged. # Allow packets for which a state has been built. @@ -505,7 +505,7 @@ case ${firewall_type} in ${fwcmd} add deny { tcp or udp } from any to any $i in done - # Broadcasts and muticasts + # Broadcasts and multicasts ${fwcmd} add deny ip from any to 255.255.255.255 ${fwcmd} add deny ip from any to 224.0.0.0/24 in # XXX @@ -513,7 +513,7 @@ case ${firewall_type} in ${fwcmd} add deny udp from any to any 520 in # Noise from webbrowsing. - # The statefull filter is a bit agressive, and will cause some + # The stateful filter is a bit aggressive, and will cause some # connection teardowns to be logged. ${fwcmd} add deny tcp from any 80,443 to any 1024-65535 in Modified: head/etc/rc.initdiskless ============================================================================== --- head/etc/rc.initdiskless Sat Jan 7 16:10:23 2012 (r229782) +++ head/etc/rc.initdiskless Sat Jan 7 16:10:32 2012 (r229783) @@ -46,16 +46,16 @@ # bcast/${ipba} same as above # ${class} where ${class} is a list of directories supplied by # bootp/dhcp through the T134 option. -# ${ipba} and ${class} are typicall used to configure features +# ${ipba} and ${class} are typically used to configure features # for group of diskless clients, or even individual features; # ${ip} where ${ip} is the machine's assigned IP address, typically # used to set host-specific features; # ip/${ip} same as above # # Template directories are scanned in the order they are listed above, -# with each sucessive directory overriding (merged into) the previous one; +# with each successive directory overriding (merged into) the previous one; # non-existing directories are ignored. The subdirectory forms exist to -# help keep the top level /conf managable in large installations. +# help keep the top level /conf manageable in large installations. # # The existence of a directory /conf/T/M causes this script to create a # memory filesystem mounted as /M on the client. Modified: head/etc/rc.subr ============================================================================== --- head/etc/rc.subr Sat Jan 7 16:10:23 2012 (r229782) +++ head/etc/rc.subr Sat Jan 7 16:10:32 2012 (r229783) @@ -1280,7 +1280,7 @@ backup_file() # Make a symbolic link 'link' to src from basedir. If the # directory in which link is to be created does not exist # a warning will be displayed and an error will be returned. -# Returns 0 on sucess, 1 otherwise. +# Returns 0 on success, 1 otherwise. # make_symlink() { Modified: head/etc/services ============================================================================== --- head/etc/services Sat Jan 7 16:10:23 2012 (r229782) +++ head/etc/services Sat Jan 7 16:10:32 2012 (r229783) @@ -795,7 +795,7 @@ alpes 463/udp kpasswd5 464/tcp # Kerberos (v5) kpasswd5 464/udp # Kerberos (v5) #PROBLEMS!============================================================== -# IANA has offically assigned these two ports as ``kpasswd'' +# IANA has officially assigned these two ports as ``kpasswd'' #kpasswd 464/tcp # Kerberos (v5) #kpasswd 464/udp # Kerberos (v5) #PROBLEMS!============================================================== @@ -1275,8 +1275,8 @@ hcp-wismar 686/tcp #Hardware Con hcp-wismar 686/udp #Hardware Control Protocol Wismar asipregistry 687/tcp asipregistry 687/udp -realm-rusd 688/tcp #ApplianceWare managment protocol -realm-rusd 688/udp #ApplianceWare managment protocol +realm-rusd 688/tcp #ApplianceWare management protocol +realm-rusd 688/udp #ApplianceWare management protocol nmap 689/tcp nmap 689/udp vatp 690/tcp #Velazquez Application Transfer Protocol @@ -2392,7 +2392,7 @@ xdsxdm 6558/tcp xdsxdm 6558/udp sane-port 6566/tcp #Scanner Access Now Easy (SANE) Control Port sane-port 6566/udp #Scanner Access Now Easy (SANE) Control Port -ircd 6667/tcp #Internet Relay Chat (unoffical) +ircd 6667/tcp #Internet Relay Chat (unofficial) frc-hp 6704/sctp #ForCES HP (High Priority) channel frc-mp 6705/sctp #ForCES MP (Medium Priority) channel frc-lp 6706/sctp #ForCES LP (Low priority) channel From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 16:13:57 2012 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 7A74D1065672; Sat, 7 Jan 2012 16:13:57 +0000 (UTC) (envelope-from uqs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 638668FC19; Sat, 7 Jan 2012 16:13: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 q07GDvBu047105; Sat, 7 Jan 2012 16:13:57 GMT (envelope-from uqs@svn.freebsd.org) Received: (from uqs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q07GDvqD047089; Sat, 7 Jan 2012 16:13:57 GMT (envelope-from uqs@svn.freebsd.org) Message-Id: <201201071613.q07GDvqD047089@svn.freebsd.org> From: Ulrich Spoerlein Date: Sat, 7 Jan 2012 16:13:57 +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: r229784 - in head/lib: libgssapi libutil libvgl msun/src 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, 07 Jan 2012 16:13:57 -0000 Author: uqs Date: Sat Jan 7 16:13:56 2012 New Revision: 229784 URL: http://svn.freebsd.org/changeset/base/229784 Log: Convert files to UTF-8 and add some copyright markers where missing. Modified: head/lib/libgssapi/gss_display_status.c head/lib/libgssapi/gss_pseudo_random.c head/lib/libgssapi/gss_release_oid.c head/lib/libutil/flopen.3 head/lib/libutil/kld.3 head/lib/libvgl/bitmap.c head/lib/libvgl/keyboard.c head/lib/libvgl/main.c head/lib/libvgl/mouse.c head/lib/libvgl/simple.c head/lib/libvgl/text.c head/lib/libvgl/vgl.3 head/lib/libvgl/vgl.h head/lib/msun/src/s_fabsl.c Modified: head/lib/libgssapi/gss_display_status.c ============================================================================== --- head/lib/libgssapi/gss_display_status.c Sat Jan 7 16:10:32 2012 (r229783) +++ head/lib/libgssapi/gss_display_status.c Sat Jan 7 16:13:56 2012 (r229784) @@ -26,7 +26,7 @@ * $FreeBSD$ */ /* - * Copyright (c) 1998 - 2005 Kungliga Tekniska Högskolan + * Copyright (c) 1998 - 2005 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -58,7 +58,7 @@ * SUCH DAMAGE. */ /* - * Copyright (c) 1998 - 2005 Kungliga Tekniska Högskolan + * Copyright (c) 1998 - 2005 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * Modified: head/lib/libgssapi/gss_pseudo_random.c ============================================================================== --- head/lib/libgssapi/gss_pseudo_random.c Sat Jan 7 16:10:32 2012 (r229783) +++ head/lib/libgssapi/gss_pseudo_random.c Sat Jan 7 16:13:56 2012 (r229784) @@ -1,5 +1,5 @@ -/* - * Copyright (c) 2007 Kungliga Tekniska Högskolan +/*- + * Copyright (c) 2007 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * Modified: head/lib/libgssapi/gss_release_oid.c ============================================================================== --- head/lib/libgssapi/gss_release_oid.c Sat Jan 7 16:10:32 2012 (r229783) +++ head/lib/libgssapi/gss_release_oid.c Sat Jan 7 16:13:56 2012 (r229784) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2006 Kungliga Tekniska Högskolan + * Copyright (c) 2006 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * Modified: head/lib/libutil/flopen.3 ============================================================================== --- head/lib/libutil/flopen.3 Sat Jan 7 16:10:32 2012 (r229783) +++ head/lib/libutil/flopen.3 Sat Jan 7 16:13:56 2012 (r229784) @@ -1,5 +1,5 @@ .\"- -.\" Copyright (c) 2007 Dag-Erling Coïdan Smørgrav +.\" Copyright (c) 2007 Dag-Erling Coïdan Smørgrav .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without Modified: head/lib/libutil/kld.3 ============================================================================== --- head/lib/libutil/kld.3 Sat Jan 7 16:10:32 2012 (r229783) +++ head/lib/libutil/kld.3 Sat Jan 7 16:13:56 2012 (r229784) @@ -1,5 +1,5 @@ .\"- -.\" Copyright (c) 2006 Dag-Erling Coïdan Smørgrav +.\" Copyright (c) 2006 Dag-Erling Coïdan Smørgrav .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without Modified: head/lib/libvgl/bitmap.c ============================================================================== --- head/lib/libvgl/bitmap.c Sat Jan 7 16:10:32 2012 (r229783) +++ head/lib/libvgl/bitmap.c Sat Jan 7 16:13:56 2012 (r229784) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 1991-1997 Søren Schmidt + * Copyright (c) 1991-1997 Søren Schmidt * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/lib/libvgl/keyboard.c ============================================================================== --- head/lib/libvgl/keyboard.c Sat Jan 7 16:10:32 2012 (r229783) +++ head/lib/libvgl/keyboard.c Sat Jan 7 16:13:56 2012 (r229784) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 1997 Søren Schmidt + * Copyright (c) 1997 Søren Schmidt * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/lib/libvgl/main.c ============================================================================== --- head/lib/libvgl/main.c Sat Jan 7 16:10:32 2012 (r229783) +++ head/lib/libvgl/main.c Sat Jan 7 16:13:56 2012 (r229784) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 1991-1997 Søren Schmidt + * Copyright (c) 1991-1997 Søren Schmidt * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/lib/libvgl/mouse.c ============================================================================== --- head/lib/libvgl/mouse.c Sat Jan 7 16:10:32 2012 (r229783) +++ head/lib/libvgl/mouse.c Sat Jan 7 16:13:56 2012 (r229784) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 1991-1997 Søren Schmidt + * Copyright (c) 1991-1997 Søren Schmidt * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/lib/libvgl/simple.c ============================================================================== --- head/lib/libvgl/simple.c Sat Jan 7 16:10:32 2012 (r229783) +++ head/lib/libvgl/simple.c Sat Jan 7 16:13:56 2012 (r229784) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 1991-1997 Søren Schmidt + * Copyright (c) 1991-1997 Søren Schmidt * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/lib/libvgl/text.c ============================================================================== --- head/lib/libvgl/text.c Sat Jan 7 16:10:32 2012 (r229783) +++ head/lib/libvgl/text.c Sat Jan 7 16:13:56 2012 (r229784) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 1991-1997 Søren Schmidt + * Copyright (c) 1991-1997 Søren Schmidt * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/lib/libvgl/vgl.3 ============================================================================== --- head/lib/libvgl/vgl.3 Sat Jan 7 16:10:32 2012 (r229783) +++ head/lib/libvgl/vgl.3 Sat Jan 7 16:13:56 2012 (r229784) @@ -1,4 +1,5 @@ -.\" Copyright (c) 1997 Søren Schmidt +.\"- +.\" Copyright (c) 1997 Søren Schmidt .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without Modified: head/lib/libvgl/vgl.h ============================================================================== --- head/lib/libvgl/vgl.h Sat Jan 7 16:10:32 2012 (r229783) +++ head/lib/libvgl/vgl.h Sat Jan 7 16:13:56 2012 (r229784) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 1991-1997 Søren Schmidt + * Copyright (c) 1991-1997 Søren Schmidt * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/lib/msun/src/s_fabsl.c ============================================================================== --- head/lib/msun/src/s_fabsl.c Sat Jan 7 16:10:32 2012 (r229783) +++ head/lib/msun/src/s_fabsl.c Sat Jan 7 16:13:56 2012 (r229784) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2003 Dag-Erling Coïdan Smørgrav + * Copyright (c) 2003 Dag-Erling Coïdan Smørgrav * All rights reserved. * * Redistribution and use in source and binary forms, with or without From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 16:14:53 2012 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 AC9191065676; Sat, 7 Jan 2012 16:14:53 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9624F8FC12; Sat, 7 Jan 2012 16:14:53 +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 q07GEr3M047182; Sat, 7 Jan 2012 16:14:53 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q07GErS3047180; Sat, 7 Jan 2012 16:14:53 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201201071614.q07GErS3047180@svn.freebsd.org> From: Kevin Lo Date: Sat, 7 Jan 2012 16:14:53 +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: r229785 - stable/7/sys/dev/vte 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, 07 Jan 2012 16:14:53 -0000 Author: kevlo Date: Sat Jan 7 16:14:53 2012 New Revision: 229785 URL: http://svn.freebsd.org/changeset/base/229785 Log: MFC r227871: Remove unused variable mii. This variable is initialized but not used. Reviewed by: yongari Modified: stable/7/sys/dev/vte/if_vte.c Modified: stable/7/sys/dev/vte/if_vte.c ============================================================================== --- stable/7/sys/dev/vte/if_vte.c Sat Jan 7 16:13:56 2012 (r229784) +++ stable/7/sys/dev/vte/if_vte.c Sat Jan 7 16:14:53 2012 (r229785) @@ -1621,14 +1621,12 @@ static void vte_init_locked(struct vte_softc *sc) { struct ifnet *ifp; - struct mii_data *mii; bus_addr_t paddr; uint8_t *eaddr; VTE_LOCK_ASSERT(sc); ifp = sc->vte_ifp; - mii = device_get_softc(sc->vte_miibus); if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) return; From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 16:16:14 2012 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 289E5106566C; Sat, 7 Jan 2012 16:16:14 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1013D8FC0C; Sat, 7 Jan 2012 16:16: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 q07GGDeB047283; Sat, 7 Jan 2012 16:16:13 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q07GGDQD047281; Sat, 7 Jan 2012 16:16:13 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201201071616.q07GGDQD047281@svn.freebsd.org> From: Kevin Lo Date: Sat, 7 Jan 2012 16:16: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: r229786 - stable/8/sys/dev/vte 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, 07 Jan 2012 16:16:14 -0000 Author: kevlo Date: Sat Jan 7 16:16:13 2012 New Revision: 229786 URL: http://svn.freebsd.org/changeset/base/229786 Log: MFC r227871: Remove unused variable mii. This variable is initialized but not used. Reviewed by: yongari Modified: stable/8/sys/dev/vte/if_vte.c Modified: stable/8/sys/dev/vte/if_vte.c ============================================================================== --- stable/8/sys/dev/vte/if_vte.c Sat Jan 7 16:14:53 2012 (r229785) +++ stable/8/sys/dev/vte/if_vte.c Sat Jan 7 16:16:13 2012 (r229786) @@ -1621,14 +1621,12 @@ static void vte_init_locked(struct vte_softc *sc) { struct ifnet *ifp; - struct mii_data *mii; bus_addr_t paddr; uint8_t *eaddr; VTE_LOCK_ASSERT(sc); ifp = sc->vte_ifp; - mii = device_get_softc(sc->vte_miibus); if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) return; From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 18:52:16 2012 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 9CB531065673; Sat, 7 Jan 2012 18:52:16 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8474B8FC0C; Sat, 7 Jan 2012 18: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 q07IqGNt052187; Sat, 7 Jan 2012 18:52:16 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q07IqG4F052185; Sat, 7 Jan 2012 18:52:16 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201201071852.q07IqG4F052185@svn.freebsd.org> From: Hiroki Sato Date: Sat, 7 Jan 2012 18:52:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229787 - stable/9/release/doc/en_US.ISO8859-1/relnotes 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, 07 Jan 2012 18:52:16 -0000 Author: hrs Date: Sat Jan 7 18:52:16 2012 New Revision: 229787 URL: http://svn.freebsd.org/changeset/base/229787 Log: - Remove unnecessary and/or old parts. - Add relnote entries: msk(4) RX checksum bugfix, rdcphy(4) for R6040 10/100 PHY added, vte(4) for RDC R6040 added, vlan(4) IPv6 LLA interface ID bugfix, wpi(4) bugfix, md(4) vm.md_malloc_wait sysctl added, mmc(4) device detection fixed, FFS TRIM support added, poweroff(8) added, rtld(1) now supports shared objects for filtering, sh(1) kill built-in added, and KDE 4.7.3. Modified: stable/9/release/doc/en_US.ISO8859-1/relnotes/article.sgml Modified: stable/9/release/doc/en_US.ISO8859-1/relnotes/article.sgml ============================================================================== --- stable/9/release/doc/en_US.ISO8859-1/relnotes/article.sgml Sat Jan 7 16:16:13 2012 (r229786) +++ stable/9/release/doc/en_US.ISO8859-1/relnotes/article.sgml Sat Jan 7 18:52:16 2012 (r229787) @@ -4,11 +4,6 @@ %release; - - - - - ]>
@@ -53,29 +48,6 @@ It also provides some notes on upgrading from previous versions of &os;. -The &release.type; distribution to which these release notes - apply represents the latest point along the &release.branch; development - branch since &release.branch; was created. Information regarding pre-built, binary - &release.type; distributions along this branch - can be found at . - -]]> - -The &release.type; distribution to which these release notes - apply represents a point along the &release.branch; development - branch between &release.prev; and the future &release.next;. - Information regarding - pre-built, binary &release.type; distributions along this branch - can be found at . - -]]> - -This distribution of &os; &release.current; is a &release.type; distribution. It can be found at or any of its mirrors. More @@ -86,8 +58,6 @@ url="&url.books.handbook;/">&os; Handbook. -]]> - All users are encouraged to consult the release errata before installing &os;. The errata document is updated with late-breaking information discovered late in the @@ -103,10 +73,7 @@ This section describes the most user-visible new or changed features in &os; - since &release.prev;. - In general, changes described here are unique to the &release.branch; - branch unless specifically marked as &merged; features. - + since &release.prev;. Typical release note items document recent security advisories issued after @@ -217,128 +184,48 @@ Kernel Changes - A new &man.cpuset.2; API has been added - for thread to CPU binding and CPU resource grouping and - assignment. The &man.cpuset.1; userland utility has been added - to allow manipulation of processor sets. - - The &man.ddb.4; kernel debugger now has an output capture - facility. Input and output from &man.ddb.4; can now be captured - to a memory buffer for later inspection using &man.sysctl.8; or - a textdump. The new capture command controls - this feature. - - The &man.ddb.4; debugger now supports a simple scripting - facility, which supports a set of named scripts consisting of a - set of &man.ddb.4; commands. These commands can be managed from - within &man.ddb.4; or with the use of the new &man.ddb.8; - utility. More details can be found in the &man.ddb.4; manual - page. - - The kernel now supports a new textdump format of kernel - dumps. A textdump provides higher-level information via - mechanically generated/extracted debugging output, rather than a - simple memory dump. This facility can be used to generate brief - kernel bug reports that are rich in debugging information, but - are not dependent on kernel symbol tables or precisely - synchronized source code. More information can be found in the - &man.textdump.4; manual page. - - Kernel support for M:N threading has been removed. While - the KSE (Kernel Scheduled Entities) project was quite successful - in bringing threading to FreeBSD, the M:N approach taken by the - KSE library was never developed to its full potential. - Backwards compatibility for applications using KSE threading - will be provided via &man.libmap.conf.5; for dynamically linked - binaries. The &os; Project greatly appreciates the work of - &a.julian;, &a.deischen;, and &a.davidxu; on KSE support. - - The &os; kernel now exports information about certain kernel - features via the kern.features sysctl tree. - The &man.feature.present.3; library call provides a convenient - interface for user applications to test the presence of - features. - - The &os; kernel now has support for large - memory page mappings (superpages). - - The ULE - scheduler is now the default process scheduler - in GENERIC kernels. - Boot Loader Changes - The BTX kernel used by the boot - loader has been changed to invoke BIOS routines from real - mode. This change makes it possible to boot &os; from USB - devices. - - A new gptboot boot loader has - been added to support booting from a GPT labeled disk. A - new boot command has been added to - &man.gpt.8;, which makes a GPT disk bootable by writing the - required bits of the boot loader, creating a new boot - partition if required. - + Hardware Support - The &man.cmx.4; driver, a driver for Omnikey CardMan 4040 - PCMCIA smartcard readers, has been added. - - The &man.syscons.4; driver now supports Colemak keyboard layout. - - The &man.uslcom.4; driver, a driver for Silicon - Laboratories CP2101/CP2102-based USB serial adapters, has been - imported from OpenBSD. - Multimedia Support - Network Interface Support - The &man.ale.4; driver has been added to provide support - for Atheros AR8121/AR8113/AR8114 Gigabit/Fast Ethernet controllers. - - The &man.em.4; driver has been split into two drivers - with some common parts. The &man.em.4; driver will continue - to support adapters up to the 82575, as well as new - client/desktop adapters. A new &man.igb.4; driver - will support new server adapters. - - The &man.jme.4; driver has been added to provide support - for PCIe network adapters based on JMicron JMC250 Gigabit - Ethernet and JMC260 Fast Ethernet controllers. - - The &man.malo.4; driver has been added to provide - support for Marvell Libertas 88W8335 based PCI network - adapters. - - The firmware for the &man.mxge.4; driver has been - updated from 1.4.25 to 1.4.29. - - The &man.sf.4; driver has been overhauled to improve its - performance and to add support for checksum offloading. It - should also work on all architectures. - - The &man.re.4; driver has been overhauled to fix a - number of issues. This driver now has Wake On LAN (WOL) - support. - - The &man.vr.4; driver has been overhauled to fix a - number of outstanding issues. It also now works on all - architectures. + A bug in &man.msk.4; driver has been + fixed. It could prevent the RX checksum offloading from + working. + + A rdcphy(4) driver for RDC Semiconductor + R6040 10/100 PHY has been added. + + A bug in &man.vlan.4; pseudo interface + han been fixed. It could have a random interface + identifier in an automatically configured IPv6 link-local + address, instead of one generated with the parent + interface's IEEE 802 48-bit MAC address and an algorithm + described in RFC 4291. + + A &man.vte.4; driver for RDC R6040 Fast + Ethernet controller, which is commonly found on Vortex86 + System On a Chip, has been added. + + A bug in &man.wpi.4; driver has been + fixed. It could display the following error messages and + result in the device unusable: - The &man.wpi.4; driver has - been updated to include a number of stability fixes. + wpi0: could not map mbuf (error 12) +wpi0: wpi_rx_intr: bus_dmamap_load failed, error 12 @@ -346,265 +233,95 @@ Network Protocols - The &man.bpf.4; packet filter and capture facility now - supports a zero-copy mode of operation, in which buffers are - loaned from a user process to the kernel. This feature can - be enabled by setting - the net.bpf.zerocopy_enable sysctl - variable to 1. - - ISDN4BSD(I4B), netatm, and all - related subsystems have been removed due to lack of - multi-processor support. - - A bug in TCP options padding, where the wrong padding - bytes were used, has been fixed. - + Disks and Storage - The &man.aac.4; driver now supports volumes larger than - 2TB in size. - - The &man.ata.4; driver now supports a spindown command for - disks; after a configurable amount of time, if no requests - have been received for a disk, the disk will be spun down - until the next request. The &man.atacontrol.8; utility now - supports a spindown command to configure - this feature. - - The &man.hptrr.4; driver has been updated to version 1.2 - from Highpoint. + The &man.md.4; memory-backed pseudo disk + device driver now supports a &man.sysctl.8; variable + vm.md_malloc_wait to specify whether a + malloc-backed disk to using M_WAITOK or + M_NOWAIT for &man.malloc.9; calls. The + M_WAITOK can prevent memory allocation + failure under high load. If it is set to + 0, a malloc-backed disk uses + M_NOWAIT for memory allocation. The + default value is 0. + A bug in the &man.mmc.4; driver that could + fail in device detection has been fixed. File Systems - A problem with using &man.mmap.2; on ZFS filesystems has - been fixed. - - A new kernel-mode NFS lock manager has been added, - improving performance and behavior of NFS locking. A new - &man.clear.locks.8; command has been added to clear locks held - on behalf of an NFS client. - - The ZFS file system - has been upgraded to version 14. Additional changes include - support for NFSv4 ACLs, a speedup of zfs send and an improved L2ARC. - New statistics for prefetch and L2ARC have been introduced. - + The &os; Fast File System now supports + TRIM command when freeing data blocks. A + new flag in the &man.newfs.8; and + &man.tunefs.8; utilities sets the TRIM-enable flag in a file + system. The TRIM-enable flag makes the file system send a + delete request to the underlying device for each freed + block. The TRIM command is specified as + Data Set Management Command in ATA8-ACS2 standard to carry + the information related to deleted data blocks to device, + especially for SSD (Solid-State Drive) for optimization. + Userland Changes - The &man.adduser.8; utility now supports - a option to set the mode of a new user's - home directory. - - BSD-licensed versions of &man.ar.1; and &man.ranlib.1;, - based on libarchive, have replaced the GNU - Binutils versions of these utilities. - - BSD-licensed versions of &man.bc.1; and &man.dc.1; have - replaced their GNU counterparts. - - &man.chflags.1; now supports a flag for - verbose output and a flag to ignore errors - with the same semantics as (for example) - &man.chmod.1;. - - For compatiblity with other implementations, &man.cp.1; now - supports a flag, which is equivalent to - specifying the flags. - - BSD-licensed version of &man.cpio.1; based on - libarchive, has replaced the GNU cpio. - Note that the GNU cpio is still installed as - gcpio. - - The &man.env.1; program now supports - which will completely unset the given variable - name by removing it from the environment, - instead of just setting it to a null value. - - The &man.fdopendir.3; library function has been added. - - The &man.fetch.3; library now support HTTP 1.1 - If-Modified-Since behavior. The &man.fetch.1; program now - supports - which will only download the specified HTTP URL if the content - is newer than filename. - - &man.find.1; has been enhanced by the addition of a number - of primaries that were present in GNU find but not &os; - &man.find.1;. - - &man.jexec.8; now supports option to specify the - jail where the command will be executed. - - &man.kgdb.1; now supports a new add-kld - command to make it easier to debug crash dumps with kernel - modules. - - The &man.ls.1; program now supports a - option to specify a date format string to be used with the long - format () output. - - &man.nc.1; now supports a switch to - disable the use of TCP options. - - &man.nc.1;'s switch has been deprecated. - It will be removed in a future release. - - The &man.ping6.8; utility now returns 2 - when the packet transmission was successful but no responses - were received (this is the same behavior as &man.ping.8;). - It returned a non-zero value before this change. - - The &man.procstat.1; utility has been added to display - detailed information about processes. - - The &man.realpath.1; utility now supports - a flag to suppress warnings; it now also - accepts multiple paths on its command line. - - The &man.split.1; utility now supports a - flag to split a file into a certain number of chunks. - - The &man.tar.1; utility now supports a - flag to enable &man.compress.1;-style - compression/decompression. - - The &man.tar.1; utility now supports a - flag to ignore user/group names - on create and extract. - - The &man.tar.1; utility now supports an - flag to sparsify files on extraction. - - The &man.tar.1; utility now supports a - flag to substitute filenames based on the specified regular - expression. - - The &man.tcgetsid.3; library function has been added to - return the process group ID for the session leader for the - controlling terminal. It is defined in IEEE Std 1003.1-2001 - (POSIX). - - &man.top.1; now supports a flag to - provide per-CPU usage statistics. - - &man.zdump.8; is now working properly on 64 bit architectures. - - - &man.traceroute.8; now has the ability to print the AS - number for each hop with the new switch; a - new option allows selecting a particular - WHOIS server. - - &man.traceroute6.8; now supports a flag - to send probe packets with no upper-layer protocol, rather than - the usual UDP probe packets. + A &man.poweroff.8; utility has been added. + This is equivalent to: + + &prompt.root; shutdown -p now + + The &man.rtld.1; runtime linker now supports + shared objects as filters in ELF shared libraries. Both + standard and auxillary filtering have been supported. The + &man.rtld.1; linker's processing of a filter defers loading a + filtee until a filter symbol is referenced unless + LD_LOADFLTR environment variable is defined + or a -z loadfltr option was specified when + the filter was created. + + The &man.sh.1; program now supports + kill as a built-in command. This allows + specifying %job + which is equivalent to the corresponding process group. Note + that this built-in command returns the exit status + 2 instead of 1 if an + fatal error occurs as other built-in commands do. <filename>/etc/rc.d</filename> Scripts - Contributed Software - AMD has been updated from 6.0.10 - to 6.1.5. - - awk has been updated from 1 May - 2007 release to the 23 October 2007 release. - - bzip2 has been updated from 1.0.4 - to 1.0.5. - - CVS has been updated from 1.11.17 - to a post-1.11.22 snapshot from 10 March 2008. - - FILE has been updated from 4.23 - to 5.03. - - hostapd has been - updated from 0.5.8 to 0.5.10. - - IPFilter has been updated from - 4.1.23 to 4.1.28. - - less has been updated from - v408 to v429. - - ncurses has been updated from - 5.6-20061217 to 5.6-20080503. - - OpenSSH has been updated - from 4.5p1 to 5.1p1. - - OpenPAM has been updated from the - Figwort release to the Hydrangea release. - - sendmail has been updated from - 8.14.1 to 8.14.5. - - The timezone database has been updated from - the tzdata2008h release to - the tzdata2009m release. - - The stdtime part of libc, &man.zdump.8 and &man.zic.8 - have been updated from the tzcode2004a - release to the tzcode2009h release. - If you have upgraded from source or via the &man.freebsd-update.8, - then please run &man.tzsetup.8 to install a new /etc/localtime. - - - WPA Supplicant has been - updated from 0.5.8 to 0.5.10. - - xz has been updated - from snapshot as of 12 April 2010 to 5.0.0. - + Ports/Packages Collection Infrastructure - The &man.pkg.create.1; utility now supports - . When this option is specified and a - package tarball exists, it will not be overwritten. This is - useful when multiple packages are saved with several consecutive - runs of &man.pkg.create.1; with the - options. - - The pkg_sign and pkg_check utilities for cryptographically - signing &os; packages have been removed. They were only useful - for packages compressed using &man.gzip.1;; however - &man.bzip2.1; compression has been the norm for some time - now. - + Release Engineering and Integration - The supported version of - the GNOME desktop environment - (x11/gnome2) has been - updated from 2.20.1 to 2.22. - + The supported version of + the KDE desktop environment + (x11/kde4) has been + updated from 4.5.5 to 4.7.3. @@ -618,6 +335,10 @@ Upgrading from previous releases of &os; + + Upgrading using freebsd-update(8) or source-based + procedure + Beginning with &os; 6.2-RELEASE, binary upgrades between RELEASE versions (and snapshots of the various security branches) are supported using the @@ -637,5 +358,13 @@ backing up all data and configuration files. + + + + User-visible incompatibilities + + This section describes notable incompatibilities which + your should know before upgrading your system. +
From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 18:53:15 2012 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 B391E1065675; Sat, 7 Jan 2012 18:53:15 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 935DB8FC12; Sat, 7 Jan 2012 18:53: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 q07IrFOZ052258; Sat, 7 Jan 2012 18:53:15 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q07IrFkN052256; Sat, 7 Jan 2012 18:53:15 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201201071853.q07IrFkN052256@svn.freebsd.org> From: Hiroki Sato Date: Sat, 7 Jan 2012 18:53:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229788 - stable/9/release/doc/share/sgml 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, 07 Jan 2012 18:53:15 -0000 Author: hrs Date: Sat Jan 7 18:53:14 2012 New Revision: 229788 URL: http://svn.freebsd.org/changeset/base/229788 Log: Add revision attribute handling. Links are now generated at the end of the paragraph from revision="NNN". Modified: stable/9/release/doc/share/sgml/release.dsl Modified: stable/9/release/doc/share/sgml/release.dsl ============================================================================== --- stable/9/release/doc/share/sgml/release.dsl Sat Jan 7 18:52:16 2012 (r229787) +++ stable/9/release/doc/share/sgml/release.dsl Sat Jan 7 18:53:14 2012 (r229788) @@ -170,6 +170,7 @@ (tgroup (have-ancestor? (normalize "tgroup"))) (arch (attribute-string (normalize "arch"))) (role (attribute-string (normalize "role"))) + (rev (attribute-string (normalize "revision"))) (arch-string (entity-text "arch")) (merged-string (entity-text "merged"))) (make sequence @@ -179,28 +180,46 @@ (list (list "ALIGN" %default-quadding%)) '())) (make sequence - (cond - ;; If arch= not specified, then print unconditionally. This clause - ;; handles the majority of cases. - ((or (equal? arch #f) - (equal? arch "") - (equal? arch "all")) - (process-children)) - (else - (sosofo-append - (make sequence - (literal "[") - (let loop ((prev (car (split-string-to-list arch))) - (rest (cdr (split-string-to-list arch)))) - (make sequence - (literal prev) - (if (not (null? rest)) - (make sequence - (literal ", ") - (loop (car rest) (cdr rest))) - (empty-sosofo)))) - (literal "] ") - (process-children))))) + (sosofo-append + (if (and (not (equal? arch #f)) + (not (equal? arch "")) + (not (equal? arch "all"))) + (make sequence + (literal "[") + (let loop ((prev (car (split-string-to-list arch))) + (rest (cdr (split-string-to-list arch)))) + (make sequence + (literal prev) + (if (not (null? rest)) + (make sequence + (literal ", ") + (loop (car rest) (cdr rest))) + (empty-sosofo)))) + (literal "] ")) + (empty-sosofo)) + (process-children) + (if (and (not (equal? rev #f)) + (not (equal? rev ""))) + (make sequence + (literal "[") + (let loop ((prev (car (split-string-to-list rev))) + (rest (cdr (split-string-to-list rev)))) + (make sequence + (make element gi: "A" + attributes: (list + (list "HREF" (string-append + "http://svn.freebsd.org/viewvc/base?view=revision&revision=" + prev)) + (list "TARGET" "_top")) + (literal "r") + (literal prev)) + (if (not (null? rest)) + (make sequence + (literal ", ") + (loop (car rest) (cdr rest))) + (empty-sosofo)))) + (literal "] ")) + (empty-sosofo))) (if (and (not (null? role)) (equal? role "merged")) (literal " [" merged-string "]") (empty-sosofo)) From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 19:38:26 2012 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 70429106564A; Sat, 7 Jan 2012 19:38:26 +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 5B8338FC0A; Sat, 7 Jan 2012 19:38: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 q07JcQek053678; Sat, 7 Jan 2012 19:38:26 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q07JcQbf053676; Sat, 7 Jan 2012 19:38:26 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201201071938.q07JcQbf053676@svn.freebsd.org> From: Adrian Chadd Date: Sat, 7 Jan 2012 19:38: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: r229789 - head/sys/i386/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: Sat, 07 Jan 2012 19:38:26 -0000 Author: adrian Date: Sat Jan 7 19:38:26 2012 New Revision: 229789 URL: http://svn.freebsd.org/changeset/base/229789 Log: Fix the broken module build I introduced earlier. Modified: head/sys/i386/conf/XEN Modified: head/sys/i386/conf/XEN ============================================================================== --- head/sys/i386/conf/XEN Sat Jan 7 18:53:14 2012 (r229788) +++ head/sys/i386/conf/XEN Sat Jan 7 19:38:26 2012 (r229789) @@ -83,6 +83,10 @@ device md # Memory "disks" device gif # IPv6 and IPv4 tunneling device faith # IPv6-to-IPv4 relaying (translation) +# Wireless cards +options IEEE80211_SUPPORT_MESH +options AH_SUPPORT_AR5416 + # The `bpf' device enables the Berkeley Packet Filter. # Be aware of the administrative consequences of enabling this! # Note that 'bpf' is required for DHCP. From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 19:57:08 2012 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 398F11065673 for ; Sat, 7 Jan 2012 19:57:08 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id E25778FC15 for ; Sat, 7 Jan 2012 19:57:07 +0000 (UTC) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) by mail.dawidek.net (Postfix) with ESMTPSA id 1506D2CD; Sat, 7 Jan 2012 20:57:04 +0100 (CET) Date: Sat, 7 Jan 2012 20:55:58 +0100 From: Pawel Jakub Dawidek To: Ronald Klop Message-ID: <20120107195557.GA1674@garage.freebsd.pl> References: <201201040704.q0474iIe065299@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="0OAP2g/MAC+5xKAE" Content-Disposition: inline In-Reply-To: X-OS: FreeBSD 9.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-all@freebsd.org Subject: Re: svn commit: r229466 - head/usr.sbin/mptable 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, 07 Jan 2012 19:57:08 -0000 --0OAP2g/MAC+5xKAE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jan 07, 2012 at 02:58:34PM +0100, Ronald Klop wrote: > I don't know much about this code, but is chmod 0666 really wat is wanted= =20 > here (and in the commits following this one)? It makes the file world =20 > writable. And that smells funny. :-) File permission during creation is always ANDed with process' umask. Most of the time umask is 022, so result file permission will be 0644. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://yomoli.com --0OAP2g/MAC+5xKAE Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAk8Io00ACgkQForvXbEpPzSnJwCcDGhtjtubcpglpy13IdSYLmf7 xvwAoMf7CdbufeJHBhC07YcZOlddeNWR =yBTt -----END PGP SIGNATURE----- --0OAP2g/MAC+5xKAE-- From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 20:03:32 2012 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 5BCF0106564A; Sat, 7 Jan 2012 20:03:32 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id 173328FC16; Sat, 7 Jan 2012 20:03:32 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:6cc4:185:83f6:3148] (unknown [IPv6:2001:7b8:3a7:0:6cc4:185:83f6:3148]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 0B5565C37; Sat, 7 Jan 2012 21:03:31 +0100 (CET) Message-ID: <4F08A518.8090207@FreeBSD.org> Date: Sat, 07 Jan 2012 21:03:36 +0100 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0) Gecko/20120106 Thunderbird/10.0 MIME-Version: 1.0 To: Sergey Kandaurov References: <201112300624.pBU6OxO9098906@svn.freebsd.org> In-Reply-To: <201112300624.pBU6OxO9098906@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228985 - head/sys/boot/forth 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, 07 Jan 2012 20:03:32 -0000 On 2011-12-30 07:24, Sergey Kandaurov wrote: > Author: pluknet > Date: Fri Dec 30 06:24:59 2011 > New Revision: 228985 > URL: http://svn.freebsd.org/changeset/base/228985 > > Log: > Unset the environment variables associated with individual menu items > before invoking the kernel. When I did a single-user mode boot to install a new world, I saw the following warning on the (serial) console during boot: /boot.config: -D -S115200 Consoles: internal video/keyboard serial port BIOS drive A: is disk0 BIOS drive C: is disk1 BIOS 638kB/3143616kB available memory FreeBSD/x86 bootstrap loader, Revision 1.1 (dim@vm-freebsd10-amd64.home.andric.com, Sat Jan 7 01:05:07 CET 2012) Loading /boot/defaults/loader.conf /boot/kernel/kernel data=0xb73530 data=0x11dbe0+0x2b4db8 syms=[0x8+0xfd620+0x8+0xec6b6] - Hit [Enter] to boot immediately, or any other key for command prompt. Type '?' for a list of commands, 'help' for more detailed help. OK boot -s menu-unset not found <<-- what's this? GDB: no debug ports present KDB: debugger backends: ddb KDB: current backend: ddb [...kernel boots...] E.g, it always gives a 'menu-unset not found' warning (or maybe it's an error, it's not clear). This was not the case before r228985. I have almost no knowledge about forth, but it looks like this might be caused by the new try-menu-unset subroutine. My loader.conf is just this: beastie_disable="YES" comconsole_speed="115200" console="comconsole vidconsole" kern.hz="100" From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 20:13:55 2012 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 D7E36106566B; Sat, 7 Jan 2012 20:13:55 +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 C3B628FC0A; Sat, 7 Jan 2012 20:13: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 q07KDt8a054820; Sat, 7 Jan 2012 20:13:55 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q07KDtiG054818; Sat, 7 Jan 2012 20:13:55 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201201072013.q07KDtiG054818@svn.freebsd.org> From: Adrian Chadd Date: Sat, 7 Jan 2012 20:13: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: r229790 - head/sys/dev/ath/ath_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: Sat, 07 Jan 2012 20:13:55 -0000 Author: adrian Date: Sat Jan 7 20:13:55 2012 New Revision: 229790 URL: http://svn.freebsd.org/changeset/base/229790 Log: Commit a temporary workaround for people who are building kernels where they've disabled all the wireless devices/framework. This is just a build workaround. If you're actively using wireless, you must still define AH_SUPPORT_AR5416 as I'm not sure what else will break! The real solution is to make the module build depend if AH_SUPPORT_AR5416 is defined, as well as make the 11n code in if_ath_tx.c and if_ath_tx_ht.c completely optional (maybe depend upon ATH_SUPPORT_11N.) Modified: head/sys/dev/ath/ath_hal/ah_desc.h Modified: head/sys/dev/ath/ath_hal/ah_desc.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah_desc.h Sat Jan 7 19:38:26 2012 (r229789) +++ head/sys/dev/ath/ath_hal/ah_desc.h Sat Jan 7 20:13:55 2012 (r229790) @@ -23,6 +23,17 @@ #include "opt_ah.h" /* NB: required for AH_SUPPORT_AR5416 */ /* + * For now, define this for the structure definitions. + * Because of how the HAL / driver module currently builds, + * it's not very feasible to build the module without + * this defined. The rest of the code (eg in the driver + * body) can work fine with these fields being uninitialised; + * they'll be initialised to 0 anyway. + */ + +#define AH_SUPPORT_AR5416 1 + +/* * Transmit descriptor status. This structure is filled * in only after the tx descriptor process method finds a * ``done'' descriptor; at which point it returns something From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 20:23:05 2012 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 E65AE106564A; Sat, 7 Jan 2012 20:23:05 +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 D11B28FC0A; Sat, 7 Jan 2012 20:23:05 +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 q07KN5bX055154; Sat, 7 Jan 2012 20:23:05 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q07KN5RK055151; Sat, 7 Jan 2012 20:23:05 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201201072023.q07KN5RK055151@svn.freebsd.org> From: Adrian Chadd Date: Sat, 7 Jan 2012 20: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: r229791 - head/sys/dev/ath/ath_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: Sat, 07 Jan 2012 20:23:06 -0000 Author: adrian Date: Sat Jan 7 20:23:05 2012 New Revision: 229791 URL: http://svn.freebsd.org/changeset/base/229791 Log: .. the AR5416 HAL code touches the MIMO parts in HAL_CHANNEL, so this is also needed. Pointed out by: bz Modified: head/sys/dev/ath/ath_hal/ah_desc.h head/sys/dev/ath/ath_hal/ah_internal.h Modified: head/sys/dev/ath/ath_hal/ah_desc.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah_desc.h Sat Jan 7 20:13:55 2012 (r229790) +++ head/sys/dev/ath/ath_hal/ah_desc.h Sat Jan 7 20:23:05 2012 (r229791) @@ -31,7 +31,9 @@ * they'll be initialised to 0 anyway. */ +#ifndef AH_SUPPORT_AR5416 #define AH_SUPPORT_AR5416 1 +#endif /* * Transmit descriptor status. This structure is filled Modified: head/sys/dev/ath/ath_hal/ah_internal.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah_internal.h Sat Jan 7 20:13:55 2012 (r229790) +++ head/sys/dev/ath/ath_hal/ah_internal.h Sat Jan 7 20:23:05 2012 (r229791) @@ -30,6 +30,10 @@ #include #include "opt_ah.h" /* needed for AH_SUPPORT_AR5416 */ +#ifndef AH_SUPPORT_AR5416 +#define AH_SUPPORT_AR5416 1 +#endif + #ifndef NBBY #define NBBY 8 /* number of bits/byte */ #endif From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 20:29:05 2012 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 BEA80106566C; Sat, 7 Jan 2012 20:29:05 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A7F2A8FC15; Sat, 7 Jan 2012 20:29:05 +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 q07KT5BU055367; Sat, 7 Jan 2012 20:29:05 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q07KT5Bm055365; Sat, 7 Jan 2012 20:29:05 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201201072029.q07KT5Bm055365@svn.freebsd.org> From: Hiroki Sato Date: Sat, 7 Jan 2012 20:29:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229792 - stable/9/release/doc/en_US.ISO8859-1/relnotes 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, 07 Jan 2012 20:29:05 -0000 Author: hrs Date: Sat Jan 7 20:29:05 2012 New Revision: 229792 URL: http://svn.freebsd.org/changeset/base/229792 Log: Add relnotes items: PT_GNU_STACK and kern.elf{32,64}.nxstack sysctls in ELF imgact, FreeBSD/powerpc PS3 support added, re(4) TSO support added, re(4) RTL8169[CDE] jumbo frame panic fixed, source address selection in unbound sockets fixed, ifconfig(8) fdx/flow/hdx/loop aliases added, sed(1) -i race fixed, sh(1) EXIT trap fixed, sh(1) %builtin keyword removed, dialog to 1.1-20110707 and description about key operation change. Modified: stable/9/release/doc/en_US.ISO8859-1/relnotes/article.sgml Modified: stable/9/release/doc/en_US.ISO8859-1/relnotes/article.sgml ============================================================================== --- stable/9/release/doc/en_US.ISO8859-1/relnotes/article.sgml Sat Jan 7 20:23:05 2012 (r229791) +++ stable/9/release/doc/en_US.ISO8859-1/relnotes/article.sgml Sat Jan 7 20:29:05 2012 (r229792) @@ -184,6 +184,14 @@ Kernel Changes + &os; ELF image + activator now supports PT_GNU_STACK program + header. This is disabled by default. New &man.sysctl.8; + variables kern.elf32.nxstack and + kern.elf64.nxstack allow to enable + PT_GNU_STACK for the specified ABIs + (e.g. elf32 for 32-bit ABI). + Boot Loader Changes @@ -193,6 +201,10 @@ Hardware Support + &os;/powerpc now + supports Sony Playstation 3 using the OtherOS feature + available on firmwares 3.15 and earlier. + Multimedia Support @@ -209,6 +221,17 @@ A rdcphy(4) driver for RDC Semiconductor R6040 10/100 PHY has been added. + The &man.re.4; driver now supports + TSO (TCP Segmentation Offload) on RealTek RTL8168/8111 C + or later controllers. Note that this is disabled by + default on some old devices because broken frames can be + sent under certain conditions. + + A bug in the &man.re.4; driver has + been fixed. It could cause a panic when receiving a jumbo + frame on an RTL8169C, 8169D, or 8169E controller-based + network interface. + A bug in &man.vlan.4; pseudo interface han been fixed. It could have a random interface identifier in an automatically configured IPv6 link-local @@ -233,7 +256,10 @@ wpi0: wpi_rx_intr: bus_dmamap_load faile Network Protocols - + A bug in &os; TCP/IP network stack has + been fixed. The source address selection could not being + performed when multicast options were present but without an + interface being specified. @@ -274,6 +300,14 @@ wpi0: wpi_rx_intr: bus_dmamap_load faile Userland Changes + The &man.ifconfig.8; utility now + supports fdx, flow, + hdx, and loop keywords + as aliases of full-duplex, + flowcontrol, + half-duplex, + and loopback, respectively. + A &man.poweroff.8; utility has been added. This is equivalent to: @@ -288,6 +322,11 @@ wpi0: wpi_rx_intr: bus_dmamap_load faile or a -z loadfltr option was specified when the filter was created. + A race condition in the &man.sed.1; + utility has been fixed. When an option is + specified, it could cause a short time window with no file + with the original file name. + The &man.sh.1; program now supports kill as a built-in command. This allows specifying %job @@ -296,6 +335,18 @@ wpi0: wpi_rx_intr: bus_dmamap_load faile 2 instead of 1 if an fatal error occurs as other built-in commands do. + A bug in the &man.sh.1; program has been + fixed for POSIX conformance. It could return an wrong exit + status when an exit command with no + parameter is specified in the EXIT trap + handler. + + %builtin keyword + support in $PATH variable has been removed + in the &man.sh.1; program. All built-in commands are always + found before looking up directories in + $PATH. + <filename>/etc/rc.d</filename> Scripts @@ -306,7 +357,8 @@ wpi0: wpi_rx_intr: bus_dmamap_load faile Contributed Software - + dialog has been + updated to version 1.1-20110707. @@ -363,8 +415,23 @@ wpi0: wpi_rx_intr: bus_dmamap_load faile User-visible incompatibilities - This section describes notable incompatibilities which - your should know before upgrading your system. + This section describes notable incompatibilities which you + might want to know before upgrading your system. + + + Update of <literal>dialog</literal> + + The dialog library is used in &os; + new installer and &os; Ports Collection to display a dialog + window and allow users to select various options. Note that + it is updated in &release.current; and there is several + differences in the key operation which might confuse users + who are familiar with releases prior to &release.current;. + For example, pushing enter key in a check list window is no + longer able to be used to check an item. The new version + consistently supports space bar for selecting an item and + enter key for OK/Cancel selection. +
From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 22:17:35 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id 4ECF4106564A; Sat, 7 Jan 2012 22:17:35 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from 172-17-198-245.globalsuite.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 70C291516EE; Sat, 7 Jan 2012 22:17:34 +0000 (UTC) Message-ID: <4F08C47D.7090906@FreeBSD.org> Date: Sat, 07 Jan 2012 14:17:33 -0800 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:9.0) Gecko/20111222 Thunderbird/9.0 MIME-Version: 1.0 To: Ulrich Spoerlein References: <201201071610.q07GAWZA046912@svn.freebsd.org> In-Reply-To: <201201071610.q07GAWZA046912@svn.freebsd.org> X-Enigmail-Version: undefined OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r229783 - in head/etc: . namedb rc.d 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, 07 Jan 2012 22:17:35 -0000 On 01/07/2012 08:10, Ulrich Spoerlein wrote: > Modified: head/etc/namedb/named.conf Good catch, thanks. :) -- You can observe a lot just by watching. -- Yogi Berra Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 22:29:46 2012 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 BE92F1065677; Sat, 7 Jan 2012 22:29:46 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A09748FC16; Sat, 7 Jan 2012 22:29:46 +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 q07MTk18058990; Sat, 7 Jan 2012 22:29:46 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q07MTkXv058988; Sat, 7 Jan 2012 22:29:46 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201201072229.q07MTkXv058988@svn.freebsd.org> From: Hiroki Sato Date: Sat, 7 Jan 2012 22:29:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229793 - stable/9/release/doc/en_US.ISO8859-1/relnotes 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, 07 Jan 2012 22:29:47 -0000 Author: hrs Date: Sat Jan 7 22:29:46 2012 New Revision: 229793 URL: http://svn.freebsd.org/changeset/base/229793 Log: - Fix spelling. - Add relnotes items: nxstack on powerpc, ral(4) and run(4) ieee80211_ratectl_node_init() call fix, re(4) RTL8168E/8111E-VL support added, re(4) TX/RX checksum offloading configuarable independently, cpuset(1) -C and "all" keyword added, sh(1) exit status in trap action for !EXIT signals, sh(1) trap -- handling, ACPI CA to 20110527. Modified: stable/9/release/doc/en_US.ISO8859-1/relnotes/article.sgml Modified: stable/9/release/doc/en_US.ISO8859-1/relnotes/article.sgml ============================================================================== --- stable/9/release/doc/en_US.ISO8859-1/relnotes/article.sgml Sat Jan 7 20:29:05 2012 (r229792) +++ stable/9/release/doc/en_US.ISO8859-1/relnotes/article.sgml Sat Jan 7 22:29:46 2012 (r229793) @@ -184,7 +184,7 @@ Kernel Changes - &os; ELF image + &os; ELF image activator now supports PT_GNU_STACK program header. This is disabled by default. New &man.sysctl.8; variables kern.elf32.nxstack and @@ -218,15 +218,26 @@ fixed. It could prevent the RX checksum offloading from working. + A bug in &man.ral.4; and &man.run.4; + drivers which could prevent hostap mode + from working has been fixed. + A rdcphy(4) driver for RDC Semiconductor R6040 10/100 PHY has been added. + The &man.re.4; driver now supports + RTL8168E/8111E-VL PCIe Gigabit Ethernet controllers. + The &man.re.4; driver now supports TSO (TCP Segmentation Offload) on RealTek RTL8168/8111 C or later controllers. Note that this is disabled by default on some old devices because broken frames can be sent under certain conditions. + The &man.re.4; driver now supports + enabling TX and/or RX checksum offloading independently + from each other. + A bug in the &man.re.4; driver has been fixed. It could cause a panic when receiving a jumbo frame on an RTL8169C, 8169D, or 8169E controller-based @@ -276,8 +287,8 @@ wpi0: wpi_rx_intr: bus_dmamap_load faile M_NOWAIT for memory allocation. The default value is 0. - A bug in the &man.mmc.4; driver that could - fail in device detection has been fixed. + A bug in the &man.mmc.4; driver + that could fail in device detection has been fixed. @@ -300,6 +311,17 @@ wpi0: wpi_rx_intr: bus_dmamap_load faile Userland Changes + The &man.cpuset.1; utility now supports + a flag to create a new cpuset and assign + an existing process into that set, and an + all keyword in option to specify + all CPUs in the system. + + A bug in the &man.fetch.1; utility which + could prevent STAT FTP command from working + properly has been fixed. + The &man.ifconfig.8; utility now supports fdx, flow, hdx, and loop keywords @@ -315,7 +337,7 @@ wpi0: wpi_rx_intr: bus_dmamap_load faile The &man.rtld.1; runtime linker now supports shared objects as filters in ELF shared libraries. Both - standard and auxillary filtering have been supported. The + standard and auxiliary filtering have been supported. The &man.rtld.1; linker's processing of a filter defers loading a filtee until a filter symbol is referenced unless LD_LOADFLTR environment variable is defined @@ -335,11 +357,18 @@ wpi0: wpi_rx_intr: bus_dmamap_load faile 2 instead of 1 if an fatal error occurs as other built-in commands do. - A bug in the &man.sh.1; program has been + A bug in the &man.sh.1; program has been fixed for POSIX conformance. It could return an wrong exit status when an exit command with no parameter is specified in the EXIT trap - handler. + handler, which is triggered when the shell terminates. + In trap actions for other signals, exit + command with no parameter returns an exit status corresponding + to the received signal. + + The &man.sh.1; program now supports a + flag in trap command to + stop the option processing. %builtin keyword support in $PATH variable has been removed @@ -357,6 +386,9 @@ wpi0: wpi_rx_intr: bus_dmamap_load faile Contributed Software + ACPI CA has been + updated to version 20110527. + dialog has been updated to version 1.1-20110707. From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 23:15:22 2012 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 3810F1065678; Sat, 7 Jan 2012 23:15:22 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 22F7A8FC08; Sat, 7 Jan 2012 23:15: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 q07NFMGK060479; Sat, 7 Jan 2012 23:15:22 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q07NFM3v060477; Sat, 7 Jan 2012 23:15:22 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201201072315.q07NFM3v060477@svn.freebsd.org> From: Eitan Adler Date: Sat, 7 Jan 2012 23:15:22 +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: r229794 - head/usr.bin/hexdump 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, 07 Jan 2012 23:15:22 -0000 Author: eadler (ports committer) Date: Sat Jan 7 23:15:21 2012 New Revision: 229794 URL: http://svn.freebsd.org/changeset/base/229794 Log: - Fix how hexdump parses escape strings From the NetBSD bug: The way how hexdump(1) parses escape sequences has some bugs. It shows up when an escape sequence is used as the non-last character of a format string. PR: bin/144722 Submitted by: gcooper Approved by: rpaulo Obtained from: NetBSD MFC after: 1 week Modified: head/usr.bin/hexdump/parse.c Modified: head/usr.bin/hexdump/parse.c ============================================================================== --- head/usr.bin/hexdump/parse.c Sat Jan 7 22:29:46 2012 (r229793) +++ head/usr.bin/hexdump/parse.c Sat Jan 7 23:15:21 2012 (r229794) @@ -255,7 +255,9 @@ rewrite(FS *fs) sokay = NOTOKAY; } - p2 = p1 + 1; /* Set end pointer. */ + p2 = *p1 ? p1 + 1 : p1; /* Set end pointer -- make sure + * that it's non-NUL/-NULL first + * though. */ cs[0] = *p1; /* Set conversion string. */ cs[1] = '\0'; @@ -449,13 +451,21 @@ escape(char *p1) char *p2; /* alphabetic escape sequences have to be done in place */ - for (p2 = p1;; ++p1, ++p2) { - if (!*p1) { - *p2 = *p1; - break; - } - if (*p1 == '\\') - switch(*++p1) { + for (p2 = p1; *p1; p1++, p2++) { + /* + * Let's take a peak at the next item and see whether or not + * we need to escape the value... + */ + if (*p1 == '\\') { + + p1++; + + switch(*p1) { + /* A standalone `\' */ + case '\0': + *p2 = '\\'; + *++p2 = '\0'; + break; case 'a': /* *p2 = '\a'; */ *p2 = '\007'; @@ -482,7 +492,12 @@ escape(char *p1) *p2 = *p1; break; } + + } else + *p2 = *p1; + } + } void From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 23:33:33 2012 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 20C06106567D; Sat, 7 Jan 2012 23:33:33 +0000 (UTC) (envelope-from luchesar.iliev@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 065288FC1B; Sat, 7 Jan 2012 23:33:31 +0000 (UTC) Received: by wgbdr11 with SMTP id dr11so538342wgb.31 for ; Sat, 07 Jan 2012 15:33:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:disposition-notification-to:date:from:user-agent :mime-version:to:cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=hTmsTiKVvDe8BU7g+da27b3mSvFo05rXppvF1Cx9ld4=; b=rlooBqUB1J5zri6NK2HsqL3hLuQIPsri22lVKuCetTvyIqDTaiWyPYnBfWumMOmAPK 644W0TJStmC15kSJTIs0wLXbNsunFB4vN1XAcMOOjO0a9Ey1avy0uPM64KIq37HGZ4jN E/Eo0ouXZpw5H/tOk0lF8e4QLQYQ6xap3C4vA= Received: by 10.180.90.40 with SMTP id bt8mr19831857wib.4.1325979210264; Sat, 07 Jan 2012 15:33:30 -0800 (PST) Received: from [192.168.1.254] ([79.124.93.41]) by mx.google.com with ESMTPS id ba4sm57615914wib.5.2012.01.07.15.33.28 (version=SSLv3 cipher=OTHER); Sat, 07 Jan 2012 15:33:29 -0800 (PST) Message-ID: <4F08D646.5030206@gmail.com> Date: Sun, 08 Jan 2012 01:33:26 +0200 From: "Luchesar V. ILIEV" User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:9.0) Gecko/20111226 Thunderbird/9.0 MIME-Version: 1.0 To: Ken Smith References: <201201070007.q0707N9L014744@svn.freebsd.org> In-Reply-To: <201201070007.q0707N9L014744@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org Subject: Re: svn commit: r229748 - stable/9/usr.sbin/pkg_install/add 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, 07 Jan 2012 23:33:33 -0000 On 07/01/2012 02:07, Ken Smith wrote: > Author: kensmith > Date: Sat Jan 7 00:07:23 2012 > New Revision: 229748 > URL: http://svn.freebsd.org/changeset/base/229748 > > Log: > MFC the rest of r225757 that applies to the package set directories. > > Modified: > stable/9/usr.sbin/pkg_install/add/main.c > > Modified: stable/9/usr.sbin/pkg_install/add/main.c > ============================================================================== > --- stable/9/usr.sbin/pkg_install/add/main.c Sat Jan 7 00:05:20 2012 (r229747) > +++ stable/9/usr.sbin/pkg_install/add/main.c Sat Jan 7 00:07:23 2012 (r229748) > @@ -95,7 +95,8 @@ struct { > { 600100, 699000, "/packages-6-stable" }, > { 700100, 799000, "/packages-7-stable" }, > { 800500, 899000, "/packages-8-stable" }, > - { 900000, 999000, "/packages-9-current" }, > + { 900500, 999000, "/packages-9-stable" }, > + { 1000500, 1099000, "/packages-10-current" }, > { 0, 9999999, "/packages-current" }, > { 0, 0, NULL } > }; Thanks a lot for the explanation about r229304 (I decided to not spam the lists unnecessarily at the time). Well, I suppose now PR 162490 can be safely closed, too... :) http://www.freebsd.org/cgi/query-pr.cgi?pr=162490 And thanks for _all_ your hard work, guys. Cheers, Luchesar From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 23:41:39 2012 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 00235106566B; Sat, 7 Jan 2012 23:41:38 +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 DF39C8FC0A; Sat, 7 Jan 2012 23:41: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 q07NfcTw061323; Sat, 7 Jan 2012 23:41:38 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q07NfcZk061321; Sat, 7 Jan 2012 23:41:38 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201201072341.q07NfcZk061321@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 7 Jan 2012 23:41:38 +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: r229795 - head/sys/net80211 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, 07 Jan 2012 23:41:39 -0000 Author: bz Date: Sat Jan 7 23:41:38 2012 New Revision: 229795 URL: http://svn.freebsd.org/changeset/base/229795 Log: Correct comment for the IPv6 case to say "traffic class" not "TOS" as pointed out back in 2009. MFC after: 3 days Modified: head/sys/net80211/ieee80211_output.c Modified: head/sys/net80211/ieee80211_output.c ============================================================================== --- head/sys/net80211/ieee80211_output.c Sat Jan 7 23:15:21 2012 (r229794) +++ head/sys/net80211/ieee80211_output.c Sat Jan 7 23:41:38 2012 (r229795) @@ -834,7 +834,7 @@ ieee80211_classify(struct ieee80211_node uint32_t flow; uint8_t tos; /* - * IPv6 frame, map the DSCP bits from the TOS field. + * IPv6 frame, map the DSCP bits from the traffic class field. */ m_copydata(m, sizeof(struct ether_header) + offsetof(struct ip6_hdr, ip6_flow), sizeof(flow), From owner-svn-src-all@FreeBSD.ORG Sat Jan 7 23:47:10 2012 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 EC476106566B; Sat, 7 Jan 2012 23:47:09 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D59F08FC13; Sat, 7 Jan 2012 23:47:09 +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 q07Nl9wj061527; Sat, 7 Jan 2012 23:47:09 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q07Nl9cf061525; Sat, 7 Jan 2012 23:47:09 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201201072347.q07Nl9cf061525@svn.freebsd.org> From: Hiroki Sato Date: Sat, 7 Jan 2012 23:47:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r229796 - stable/9/release/doc/en_US.ISO8859-1/relnotes 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, 07 Jan 2012 23:47:10 -0000 Author: hrs Date: Sat Jan 7 23:47:09 2012 New Revision: 229796 URL: http://svn.freebsd.org/changeset/base/229796 Log: - Add relnotes items: alc(4) AR8152-based card lockup fixed, ixgbe(4) to 2.3.8, sis(4) reinit issue fixed, netstat(1) embedded address scope id handling, sh(1) signal handling fixed, unifdef(1) to 2.5.6. Modified: stable/9/release/doc/en_US.ISO8859-1/relnotes/article.sgml Modified: stable/9/release/doc/en_US.ISO8859-1/relnotes/article.sgml ============================================================================== --- stable/9/release/doc/en_US.ISO8859-1/relnotes/article.sgml Sat Jan 7 23:41:38 2012 (r229795) +++ stable/9/release/doc/en_US.ISO8859-1/relnotes/article.sgml Sat Jan 7 23:47:09 2012 (r229796) @@ -214,6 +214,13 @@ Network Interface Support + A bug in &man.alc.4; driver which + could make AR8152-based network interfaces stop working + has been fixed. + + The &man.ixgbe.4; driver has been + updated to version 2.3.8. + A bug in &man.msk.4; driver has been fixed. It could prevent the RX checksum offloading from working. @@ -243,6 +250,12 @@ frame on an RTL8169C, 8169D, or 8169E controller-based network interface. + A bug in the &man.sis.4; driver has + been changed. It could prevent a proper reinitialization + on DP83815, DP83816, and SiS 900/7016 controllers when + configuration of multicast packet handling and/or + promiscus mode is changed. + A bug in &man.vlan.4; pseudo interface han been fixed. It could have a random interface identifier in an automatically configured IPv6 link-local @@ -330,6 +343,12 @@ wpi0: wpi_rx_intr: bus_dmamap_load faile half-duplex, and loopback, respectively. + The &man.netstat.1; utility now does not + expose internal scope address representation used in the &os; + kernel, which is derived from KAME IPv6 stack, in the results + of netstat -ani and netstat + -nr. + A &man.poweroff.8; utility has been added. This is equivalent to: @@ -366,6 +385,13 @@ wpi0: wpi_rx_intr: bus_dmamap_load faile command with no parameter returns an exit status corresponding to the received signal. + A bug in the &man.sh.1; program has been + fixed. When a foreground job exits on a signal, a message is + printed to stdout about this. The buffer was not flushed after + this which could result in the message being written to the + wrong file if the next command was a builtin and had stdout + redirected. + The &man.sh.1; program now supports a flag in trap command to stop the option processing. @@ -391,6 +417,9 @@ wpi0: wpi_rx_intr: bus_dmamap_load faile dialog has been updated to version 1.1-20110707. + + &man.unifdef.1; utility has been updated + to version 2.5.6.