From owner-svn-src-head@FreeBSD.ORG Sun Nov 15 03:09:51 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 082DE106566B; Sun, 15 Nov 2009 03:09:51 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EBB6F8FC1C; Sun, 15 Nov 2009 03:09:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAF39o2t021171; Sun, 15 Nov 2009 03:09:50 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAF39oYJ021170; Sun, 15 Nov 2009 03:09:50 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200911150309.nAF39oYJ021170@svn.freebsd.org> From: Marcel Moolenaar Date: Sun, 15 Nov 2009 03:09:50 +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: r199284 - head/sys/nfsserver X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Nov 2009 03:09:51 -0000 Author: marcel Date: Sun Nov 15 03:09:50 2009 New Revision: 199284 URL: http://svn.freebsd.org/changeset/base/199284 Log: Revert previous change and fix misalignment by using bcopy() to copy the file handle from fid_data into fh. This eliminates conditional compilation. Pointed out by: imp Modified: head/sys/nfsserver/nfs_fha.c Modified: head/sys/nfsserver/nfs_fha.c ============================================================================== --- head/sys/nfsserver/nfs_fha.c Sat Nov 14 23:35:37 2009 (r199283) +++ head/sys/nfsserver/nfs_fha.c Sun Nov 15 03:09:50 2009 (r199284) @@ -30,7 +30,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -207,11 +206,7 @@ fha_extract_info(struct svc_req *req, st if (error) goto out; -#if _BYTE_ORDER == _LITTLE_ENDIAN - i->fh = le64dec(fh.fh_generic.fh_fid.fid_data); -#else - i->fh = be64dec(fh.fh_generic.fh_fid.fid_data); -#endif + bcopy(fh.fh_generic.fh_fid.fid_data, &i->fh, sizeof(i->fh)); /* Content ourselves with zero offset for all but reads. */ if (procnum != NFSPROC_READ) From owner-svn-src-head@FreeBSD.ORG Sun Nov 15 11:07:23 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8896E106566B; Sun, 15 Nov 2009 11:07:23 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5D5D58FC15; Sun, 15 Nov 2009 11:07:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAFB7N2C035826; Sun, 15 Nov 2009 11:07:23 GMT (envelope-from bms@svn.freebsd.org) Received: (from bms@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAFB7NCD035825; Sun, 15 Nov 2009 11:07:23 GMT (envelope-from bms@svn.freebsd.org) Message-Id: <200911151107.nAFB7NCD035825@svn.freebsd.org> From: Bruce M Simpson Date: Sun, 15 Nov 2009 11:07: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: r199287 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Nov 2009 11:07:23 -0000 Author: bms Date: Sun Nov 15 11:07:22 2009 New Revision: 199287 URL: http://svn.freebsd.org/changeset/base/199287 Log: Fix a functional regression in multicast. Userland daemons need to see IGMP traffic regardless of the group; omit the imo filter check if the proto is IGMP. The kernel part of IGMP will have already filtered appropriately at this point. MFC after: ASAP Submitted by: Franz Struwig Reported by: Ivor Prebeg, Franz Struwig Modified: head/sys/netinet/raw_ip.c Modified: head/sys/netinet/raw_ip.c ============================================================================== --- head/sys/netinet/raw_ip.c Sun Nov 15 07:28:37 2009 (r199286) +++ head/sys/netinet/raw_ip.c Sun Nov 15 11:07:22 2009 (r199287) @@ -343,17 +343,35 @@ rip_input(struct mbuf *m, int off) */ if (inp->inp_moptions != NULL && IN_MULTICAST(ntohl(ip->ip_dst.s_addr))) { - struct sockaddr_in group; + /* + * If the incoming datagram is for IGMP, allow it + * through unconditionally to the raw socket. + * + * In the case of IGMPv2, we may not have explicitly + * joined the group, and may have set IFF_ALLMULTI + * on the interface. imo_multi_filter() may discard + * control traffic we actually need to see. + * + * Userland multicast routing daemons should continue + * filter the control traffic appropriately. + */ int blocked; - bzero(&group, sizeof(struct sockaddr_in)); - group.sin_len = sizeof(struct sockaddr_in); - group.sin_family = AF_INET; - group.sin_addr = ip->ip_dst; - - blocked = imo_multi_filter(inp->inp_moptions, ifp, - (struct sockaddr *)&group, - (struct sockaddr *)&ripsrc); + blocked = MCAST_PASS; + if (proto != IPPROTO_IGMP) { + struct sockaddr_in group; + + bzero(&group, sizeof(struct sockaddr_in)); + group.sin_len = sizeof(struct sockaddr_in); + group.sin_family = AF_INET; + group.sin_addr = ip->ip_dst; + + blocked = imo_multi_filter(inp->inp_moptions, + ifp, + (struct sockaddr *)&group, + (struct sockaddr *)&ripsrc); + } + if (blocked != MCAST_PASS) { IPSTAT_INC(ips_notmember); continue; From owner-svn-src-head@FreeBSD.ORG Sun Nov 15 11:44:50 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C78F6106566B; Sun, 15 Nov 2009 11:44:50 +0000 (UTC) (envelope-from stas@SpringDaemons.com) Received: from mx0.deglitch.com (backbone.deglitch.com [IPv6:2001:16d8:fffb:4::abba]) by mx1.freebsd.org (Postfix) with ESMTP id 6F35D8FC08; Sun, 15 Nov 2009 11:44:50 +0000 (UTC) Received: from sputnik.SpringDaemons.com (unknown [78.110.48.118]) by mx0.deglitch.com (Postfix) with ESMTPA id B6B768FC4E; Sun, 15 Nov 2009 14:44:47 +0300 (MSK) Received: by sputnik.SpringDaemons.com (Postfix, from userid 1024) id B3D1FB86F; Sun, 15 Nov 2009 03:44:56 -0800 (PST) Date: Sun, 15 Nov 2009 03:44:50 -0800 From: Stanislav Sedov To: Tom Judge Message-Id: <20091115034450.18484593.stas@FreeBSD.org> In-Reply-To: <4AF08495.5040507@tomjudge.com> References: <200910211247.n9LCl9Ab099426@svn.freebsd.org> <4AF08495.5040507@tomjudge.com> Organization: The FreeBSD Project X-XMPP: ssedov@jabber.ru X-Voice: +7 916 849 20 23 X-PGP-Fingerprin: F21E D6CC 5626 9609 6CE2 A385 2BF5 5993 EB26 9581 X-Mailer: carrier-pigeon Mime-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="PGP-SHA1"; boundary="Signature=_Sun__15_Nov_2009_03_44_50_-0800_OY8jK=VU7QqBQ2ks" Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r198320 - in head/sys: conf dev/bce X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Nov 2009 11:44:50 -0000 --Signature=_Sun__15_Nov_2009_03_44_50_-0800_OY8jK=VU7QqBQ2ks Content-Type: text/plain; charset=US-ASCII Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, 03 Nov 2009 19:29:25 +0000 Tom Judge mentioned: > Hi Stanislav, >=20 > Any chance this can be MFC'd to stable/8, stable/7 and releng/8.0? >=20 Hi, Tom! I did MFC to STABLE_7 and STABLE_8. It was not allowed to merge to RELENG as it was too late for this :-( --=20 Stanislav Sedov ST4096-RIPE --Signature=_Sun__15_Nov_2009_03_44_50_-0800_OY8jK=VU7QqBQ2ks Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iQIcBAEBAgAGBQJK/+m3AAoJEKN82nOYvCd0+9MP/R6B0CaWhugDG2Lgx4X5JNyA RoJFUYTu0GDaMb4YMGX9ylmWU6Dy0EVt5g4gb9zuQOcEP1+VReWt11zjNxGcIeSS 8c55LUsxnErME1bJ7Q6/CHdNqDoKtSXejwUgEGGDi5PWzUpS7QsvK/AZpAHnxHQs FJgmyM/rk4/KhkxRiembCW+wviP4l6875820H2b8rPKukSbcl6EjaB1rER409kj6 WBix4iqyX2iwYwFWF6+tmqRe74BWzaeYyjQ4PEufrCQV6fwcOdy3CugMrctgnlW3 6aHJiQCDyuT3yENF3b08mYN2JGJCfZTSN70Asu+iSotn6idO2VkLMJgX9RWwC4yo Ap5SJkzCdpAqFXdn8w1lkKe3ndblepfyYHylcW1b9Y3zMmThWHJBdsDiuXohPVEq 5e60nPKy13VfZBBobK75v8Zdm3J5faQzcQpRxrPWWYSS3/nNkI6VtHEtxTD/lHdc YMHDmK5MdutPCZwxg8J/gPbxKGsgQG9XE+VfHj8XhmtQhPe2NhJ/jOb/5JYo4MjK XLT4wdOaKpJVvLV9Bwc+e3g5rBovX2gLuUSxe5lrRG/paiMOUy4DJlHG9dWCun6Z jJVy7umNSBb30DT/8eWIpg0s0ErF2INmi7hmRkdfCUelpYsaJZgwRr/a5m0VgDR+ JEGkjHfeW9I8vjUAnpe6 =iUPa -----END PGP SIGNATURE----- --Signature=_Sun__15_Nov_2009_03_44_50_-0800_OY8jK=VU7QqBQ2ks-- From owner-svn-src-head@FreeBSD.ORG Sun Nov 15 16:44:44 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4ED08106566B; Sun, 15 Nov 2009 16:44:44 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3D2838FC12; Sun, 15 Nov 2009 16:44:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAFGiiE9042742; Sun, 15 Nov 2009 16:44:44 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAFGiiOT042741; Sun, 15 Nov 2009 16:44:44 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <200911151644.nAFGiiOT042741@svn.freebsd.org> From: Attilio Rao Date: Sun, 15 Nov 2009 16:44: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: r199291 - in head: lib/libdevinfo tools/tools/ncpus usr.sbin/bsnmpd/modules/snmp_hostres usr.sbin/devinfo X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Nov 2009 16:44:44 -0000 Author: attilio Date: Sun Nov 15 16:44:43 2009 New Revision: 199291 URL: http://svn.freebsd.org/changeset/base/199291 Log: Collapse devinfo_state_t with device_state_t in order to avoid a structure replication and improve manteneability. Reviewed by: jhb, imp Tested by: Riccardo Torrini Modified: head/lib/libdevinfo/devinfo.h head/tools/tools/ncpus/acpi.c head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c head/usr.sbin/devinfo/devinfo.c Modified: head/lib/libdevinfo/devinfo.h ============================================================================== --- head/lib/libdevinfo/devinfo.h Sun Nov 15 14:11:26 2009 (r199290) +++ head/lib/libdevinfo/devinfo.h Sun Nov 15 16:44:43 2009 (r199291) @@ -32,20 +32,12 @@ #include #include +#include typedef __uintptr_t devinfo_handle_t; #define DEVINFO_ROOT_DEVICE ((devinfo_handle_t)0) -/* - * State of the device. - */ -/* XXX not sure if I want a copy here, or expose sys/bus.h */ -typedef enum devinfo_state { - DIS_NOTPRESENT = 10, /* not probed or probe failed */ - DIS_ALIVE = 20, /* probe succeeded */ - DIS_ATTACHED = 30, /* attach method called */ - DIS_BUSY = 40 /* device is open */ -} devinfo_state_t; +typedef enum device_state devinfo_state_t; struct devinfo_dev { devinfo_handle_t dd_handle; /* device handle */ Modified: head/tools/tools/ncpus/acpi.c ============================================================================== --- head/tools/tools/ncpus/acpi.c Sun Nov 15 14:11:26 2009 (r199290) +++ head/tools/tools/ncpus/acpi.c Sun Nov 15 16:44:43 2009 (r199291) @@ -247,13 +247,13 @@ static const char * devstate(devinfo_state_t state) { switch (state) { - case DIS_NOTPRESENT: + case DS_NOTPRESENT: return "not-present"; - case DIS_ALIVE: + case DS_ALIVE: return "alive"; - case DIS_ATTACHED: + case DS_ATTACHED: return "attached"; - case DIS_BUSY: + case DS_BUSY: return "busy"; default: return "unknown-state"; @@ -266,8 +266,8 @@ acpi0_check(struct devinfo_dev *dd, void printf("%s: %s %s\n", __func__, dd->dd_name, devstate(dd->dd_state)); /* NB: device must be present AND attached */ if (strcmp(dd->dd_name, "acpi0") == 0) - return (dd->dd_state == DIS_ATTACHED || - dd->dd_state == DIS_BUSY); + return (dd->dd_state == DS_ATTACHED || + dd->dd_state == DS_BUSY); return devinfo_foreach_device_child(dd, acpi0_check, arg); } Modified: head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c ============================================================================== --- head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c Sun Nov 15 14:11:26 2009 (r199290) +++ head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c Sun Nov 15 16:44:43 2009 (r199291) @@ -352,11 +352,11 @@ device_get_status(struct devinfo_dev *de assert(dev != NULL); switch (dev->dd_state) { - case DIS_ALIVE: /* probe succeeded */ - case DIS_NOTPRESENT: /* not probed or probe failed */ + case DS_ALIVE: /* probe succeeded */ + case DS_NOTPRESENT: /* not probed or probe failed */ return (DS_DOWN); - case DIS_ATTACHED: /* attach method called */ - case DIS_BUSY: /* device is open */ + case DS_ATTACHED: /* attach method called */ + case DS_BUSY: /* device is open */ return (DS_RUNNING); default: return (DS_UNKNOWN); Modified: head/usr.sbin/devinfo/devinfo.c ============================================================================== --- head/usr.sbin/devinfo/devinfo.c Sun Nov 15 14:11:26 2009 (r199290) +++ head/usr.sbin/devinfo/devinfo.c Sun Nov 15 16:44:43 2009 (r199291) @@ -137,7 +137,7 @@ print_device(struct devinfo_dev *dev, vo struct indent_arg ia; int i, indent; - if (vflag || (dev->dd_name[0] != 0 && dev->dd_state >= DIS_ATTACHED)) { + if (vflag || (dev->dd_name[0] != 0 && dev->dd_state >= DS_ATTACHED)) { indent = (int)(intptr_t)arg; for (i = 0; i < indent; i++) printf(" "); From owner-svn-src-head@FreeBSD.ORG Sun Nov 15 18:31:57 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C7F12106568D; Sun, 15 Nov 2009 18:31:57 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B64518FC12; Sun, 15 Nov 2009 18:31:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAFIVvP5044849; Sun, 15 Nov 2009 18:31:57 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAFIVvMv044846; Sun, 15 Nov 2009 18:31:57 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <200911151831.nAFIVvMv044846@svn.freebsd.org> From: Rui Paulo Date: Sun, 15 Nov 2009 18:31: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: r199292 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Nov 2009 18:31:57 -0000 Author: rpaulo Date: Sun Nov 15 18:31:57 2009 New Revision: 199292 URL: http://svn.freebsd.org/changeset/base/199292 Log: Add atp(4) man page. Submitted by: Rohit Grover Added: head/share/man/man4/atp.4 (contents, props changed) Modified: head/share/man/man4/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Sun Nov 15 16:44:43 2009 (r199291) +++ head/share/man/man4/Makefile Sun Nov 15 18:31:57 2009 (r199292) @@ -44,6 +44,7 @@ MAN= aac.4 \ ath_hal.4 \ atkbd.4 \ atkbdc.4 \ + ${_atp.4} \ audit.4 \ auditpipe.4 \ aue.4 \ @@ -611,6 +612,7 @@ _acpi_wmi.4= acpi_wmi.4 _amdsmb.4= amdsmb.4 _amdtemp.4= amdtemp.4 _asmc.4= asmc.4 +_atp.4= atp.4 _coretemp.4= coretemp.4 _cpuctl.4= cpuctl.4 _dpms.4= dpms.4 @@ -642,6 +644,10 @@ _wpi.4= wpi.4 MLINKS+=lindev.4 full.4 .endif +.if ${MACHINE_ARCH} == "powerpc" +_atp.4= atp.4 +.endif + .if exists(${.CURDIR}/man4.${MACHINE_ARCH}) SUBDIR= man4.${MACHINE_ARCH} .endif Added: head/share/man/man4/atp.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/atp.4 Sun Nov 15 18:31:57 2009 (r199292) @@ -0,0 +1,180 @@ +.\" Copyright (c) 2009 Rohit Grover . +.\" 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. +.\" 3. Neither the name of the author nor the names of any co-contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" 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 November 12, 2009 +.Dt ATP 4 +.Os +.Sh NAME +.Nm atp +.Nd Apple touchpad driver +.Sh SYNOPSIS +To compile this driver into the kernel, place the following lines into +your kernel configuration file: +.Bd -ragged -offset indent +.Cd "device atp" +.Cd "device usb" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +atp_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for the Apple Internal Trackpad +device found in many Apple laptops. +.Pp +The driver simulates a three\-button mouse using multi\-finger tap +detection. +. +A single\-finger tap generates a left button click; +two\-finger tap maps to the middle button; whereas a three\-finger tap +gets treated as a right button click. +. +A double\-tap followed by a drag is treated as a selection gesture; a +virtual left\-button click is assumed for the lifespan of the drag. +. +.Nm +attempts to filter away activity at the horizontal edges of the +trackpad\-\-this is to keep unintentional palm movement from being +considered as user input. +. +.Pp +.Nm +supports dynamic reconfiguration using +.Xr sysctl 8 ; +through nodes under +.Nm hw.usb.atp . +Pointer sensitivity can be controlled using the sysctl tunable +.Nm hw.usb.atp.scale_factor . +. +.Sh HARDWARE +The +.Nm +driver provides support for the following Product IDs: +.Pp +.Bl -bullet -compact +.It +Core Duo MacBook & MacBook Pro (IDs: 0x0217, 0x0218, 0x0219) +.It +Core2 Duo MacBook & MacBook Pro (IDs: 0x021a, 0x021b, 0x021c) +.It +Core2 Duo MacBook3,1 (IDs: 0x0229, 0x022a, 0x022b) +.It +12 inch PowerBook and iBook (IDs: 0x030a, 0x030b) +.It +15 inch PowerBook (IDs: 0x020e, 0x020f, 0x0215) +.It +17 inch PowerBook (ID: 0x020d) +.El +.Pp +To discover the product\-id of a touchpad, search for 'Trackpad' in the +output of +.Xr lshal 1 +and look up the property +.Nm usb_device.product_id . +.Sh FILES +.Nm +creates a blocking pseudo\-device file, +.Pa /dev/atp0 , +which presents the mouse as a +.Ar sysmouse +or +.Ar mousesystems +type device\-\-see +.Xr moused 8 +for an explanation of these mouse +types. +.Xr moused 8 +can be configured to read touchpad data from +.Pa /dev/atp0 +and pass it along to the +.Xr sysmouse 4 +driver so that any process wanting to utilize mouse operation (such as +an X server) may fetch it from +.Pa /dev/sysmouse ; +alternatively, +.Pa /dev/atp0 +may be manipulated via +.Xr read 2 +and +.Xr ioctl 2 +calls to get mouse data directly. +.Sh EXAMPLES +To use a compatible Apple Trackpad as your console mouse: +.Pp +.Dl moused -p /dev/atp0 -t auto +.Pp +To launch +.Xr moused 8 +automatically upon boot, add the following to +.Pa /etc/rc.conf : +.Pp +.Dl moused_enable="YES" +.Dl moused_type="auto" +.Dl moused_port="/dev/atp0" +.Pp +If you want +.Xr moused 8 +to also probe for external USB mice or other devices, then add the +following to +.Pa /etc/rc.conf : +.Pp +.Dl moused_nondefault_enable="YES" +.Dl moused_ums0_enable="YES" +.Dl moused_ums1_enable="YES" +.Pp +To be able to use the trackpad under X, change the "Pointer" section in +.Nm xorg.conf +to the following: +.Pp +.Dl Device "/dev/atp0" +.Dl Protocol "Auto" +.Pp +Better still, if you want to be able to use the mouse in both virtual +consoles as well as in X change it to: +.Pp +.Dl Device "/dev/sysmouse" +.Dl Protocol "Auto" +.Sh SEE ALSO +.Xr sysmouse 4 , +.Xr usb 4 , +.Xr loader.conf 5 , +.Xr xorg.conf 5 Pq Pa ports/x11/xorg , +.Xr moused 8 , +.Xr sysctl 8 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Rohit Grover Aq rgrover1@gmail.com From owner-svn-src-head@FreeBSD.ORG Sun Nov 15 21:35:53 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F4A21065672; Sun, 15 Nov 2009 21:35:53 +0000 (UTC) (envelope-from andreast-list@fgznet.ch) Received: from smtp.fgznet.ch (mail.fgznet.ch [81.92.96.47]) by mx1.freebsd.org (Postfix) with ESMTP id 9E31B8FC1C; Sun, 15 Nov 2009 21:35:51 +0000 (UTC) Received: from deuterium.andreas.nets (dhclient-91-190-8-131.flashcable.ch [91.190.8.131]) by smtp.fgznet.ch (8.13.8/8.13.8/Submit_SMTPAUTH) with ESMTP id nAFL2NAT027454; Sun, 15 Nov 2009 22:02:23 +0100 (CET) (envelope-from andreast-list@fgznet.ch) Message-ID: <4B006C5F.7060306@fgznet.ch> Date: Sun, 15 Nov 2009 22:02:23 +0100 From: Andreas Tobler User-Agent: Thunderbird 2.0.0.23 (Macintosh/20090812) MIME-Version: 1.0 To: Marcel Moolenaar References: <200911150309.nAF39oYJ021170@svn.freebsd.org> In-Reply-To: <200911150309.nAF39oYJ021170@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: r199284 - head/sys/nfsserver X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Nov 2009 21:35:53 -0000 Marcel Moolenaar wrote: > Author: marcel > Date: Sun Nov 15 03:09:50 2009 > New Revision: 199284 > URL: http://svn.freebsd.org/changeset/base/199284 > > Log: > Revert previous change and fix misalignment by using bcopy() > to copy the file handle from fid_data into fh. This eliminates > conditional compilation. > > Pointed out by: imp > > Modified: > head/sys/nfsserver/nfs_fha.c Thanks Marcel, with this ci I'm able the mount my nfs exports from i386 on ppc/amd64 again. With the previous commit I was only able to mount the nfs exports from amd64 to powerpc but not from i386 to powerpc. Andreas From owner-svn-src-head@FreeBSD.ORG Sun Nov 15 23:31:07 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B068D106568B; Sun, 15 Nov 2009 23:31:07 +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 868BE8FC29; Sun, 15 Nov 2009 23:31:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAFNV7v5051024; Sun, 15 Nov 2009 23:31:07 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAFNV79R051022; Sun, 15 Nov 2009 23:31:07 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200911152331.nAFNV79R051022@svn.freebsd.org> From: Doug Barton Date: Sun, 15 Nov 2009 23:31: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: r199299 - head/share/man/man5 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Nov 2009 23:31:07 -0000 Author: dougb Date: Sun Nov 15 23:31:07 2009 New Revision: 199299 URL: http://svn.freebsd.org/changeset/base/199299 Log: In r199127/r199152 I forgot to bump .Dd Modified: head/share/man/man5/rc.conf.5 Modified: head/share/man/man5/rc.conf.5 ============================================================================== --- head/share/man/man5/rc.conf.5 Sun Nov 15 22:09:48 2009 (r199298) +++ head/share/man/man5/rc.conf.5 Sun Nov 15 23:31:07 2009 (r199299) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 23, 2009 +.Dd November 11, 2009 .Dt RC.CONF 5 .Os .Sh NAME From owner-svn-src-head@FreeBSD.ORG Mon Nov 16 09:28:22 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 933E91065670; Mon, 16 Nov 2009 09:28:22 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 821CC8FC19; Mon, 16 Nov 2009 09:28:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAG9SMv3063937; Mon, 16 Nov 2009 09:28:22 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAG9SMwC063935; Mon, 16 Nov 2009 09:28:22 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <200911160928.nAG9SMwC063935@svn.freebsd.org> From: Christian Brueffer Date: Mon, 16 Nov 2009 09:28: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: r199317 - head/lib/libc/posix1e X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Nov 2009 09:28:22 -0000 Author: brueffer Date: Mon Nov 16 09:28:22 2009 New Revision: 199317 URL: http://svn.freebsd.org/changeset/base/199317 Log: Fix a memory leak in acl_from_text() in case the conversion succeeded. Submitted by: Jim Wilcoxson MFC after: 1 week Modified: head/lib/libc/posix1e/acl_from_text.c Modified: head/lib/libc/posix1e/acl_from_text.c ============================================================================== --- head/lib/libc/posix1e/acl_from_text.c Mon Nov 16 08:32:13 2009 (r199316) +++ head/lib/libc/posix1e/acl_from_text.c Mon Nov 16 09:28:22 2009 (r199317) @@ -257,6 +257,7 @@ acl_from_text(const char *buf_p) } #endif + free(mybuf_p); return(acl); error_label: From owner-svn-src-head@FreeBSD.ORG Mon Nov 16 10:53:04 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3CFE1065670; Mon, 16 Nov 2009 10:53:04 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C369C8FC19; Mon, 16 Nov 2009 10:53:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAGAr4v5068681; Mon, 16 Nov 2009 10:53:04 GMT (envelope-from phk@svn.freebsd.org) Received: (from phk@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAGAr4hd068679; Mon, 16 Nov 2009 10:53:04 GMT (envelope-from phk@svn.freebsd.org) Message-Id: <200911161053.nAGAr4hd068679@svn.freebsd.org> From: Poul-Henning Kamp Date: Mon, 16 Nov 2009 10:53: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: r199319 - head/sys/amd64/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Nov 2009 10:53:04 -0000 Author: phk Date: Mon Nov 16 10:53:04 2009 New Revision: 199319 URL: http://svn.freebsd.org/changeset/base/199319 Log: Uppercase the UL suffix on a constant, so Flexelint doesn't worry that 'u1' might have been intended. No, that does not make sense and yes I have told them. Modified: head/sys/amd64/include/param.h Modified: head/sys/amd64/include/param.h ============================================================================== --- head/sys/amd64/include/param.h Mon Nov 16 09:37:30 2009 (r199318) +++ head/sys/amd64/include/param.h Mon Nov 16 10:53:04 2009 (r199319) @@ -105,7 +105,7 @@ #define NPML4EPG (PAGE_SIZE/(sizeof (pml4_entry_t))) #define NPML4EPGSHIFT 9 /* LOG2(NPML4EPG) */ #define PML4SHIFT 39 /* LOG2(NBPML4) */ -#define NBPML4 (1ul< Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9D474106566C; Mon, 16 Nov 2009 14:33:31 +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 8C8FB8FC08; Mon, 16 Nov 2009 14:33:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAGEXVgu072737; Mon, 16 Nov 2009 14:33:31 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAGEXV4U072735; Mon, 16 Nov 2009 14:33:31 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <200911161433.nAGEXV4U072735@svn.freebsd.org> From: Christian Brueffer Date: Mon, 16 Nov 2009 14:33: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: r199320 - head/lib/libc/locale X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Nov 2009 14:33:31 -0000 Author: brueffer Date: Mon Nov 16 14:33:31 2009 New Revision: 199320 URL: http://svn.freebsd.org/changeset/base/199320 Log: Fix grammar. PR: 140459 Submitted by: Jeremy Huddleston MFC after: 1 week Modified: head/lib/libc/locale/nl_langinfo.3 Modified: head/lib/libc/locale/nl_langinfo.3 ============================================================================== --- head/lib/libc/locale/nl_langinfo.3 Mon Nov 16 10:53:04 2009 (r199319) +++ head/lib/libc/locale/nl_langinfo.3 Mon Nov 16 14:33:31 2009 (r199320) @@ -53,7 +53,7 @@ with a category corresponding to the cat or to the category .Dv LC_ALL , -may overwrite buffer pointed by the return value. +may overwrite the buffer pointed to by the return value. .Sh RETURN VALUES In a locale where langinfo data is not defined, .Fn nl_langinfo From owner-svn-src-head@FreeBSD.ORG Mon Nov 16 15:18:02 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 926F1106566B; Mon, 16 Nov 2009 15:18:02 +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 81BED8FC23; Mon, 16 Nov 2009 15:18:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAGFI2NB073569; Mon, 16 Nov 2009 15:18:02 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAGFI26S073567; Mon, 16 Nov 2009 15:18:02 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200911161518.nAGFI26S073567@svn.freebsd.org> From: Alexander Motin Date: Mon, 16 Nov 2009 15:18: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: r199321 - head/sys/cam/ata X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Nov 2009 15:18:02 -0000 Author: mav Date: Mon Nov 16 15:18:02 2009 New Revision: 199321 URL: http://svn.freebsd.org/changeset/base/199321 Log: Disable PortMultiplier Async Notifications for time of ports reset. They are useless at that time, but confuse Marvell AHCI. Add quirk for SiI57XX Port Multipliers, to hide extra port. Modified: head/sys/cam/ata/ata_pmp.c Modified: head/sys/cam/ata/ata_pmp.c ============================================================================== --- head/sys/cam/ata/ata_pmp.c Mon Nov 16 14:33:31 2009 (r199320) +++ head/sys/cam/ata/ata_pmp.c Mon Nov 16 15:18:02 2009 (r199321) @@ -63,11 +63,12 @@ __FBSDID("$FreeBSD$"); typedef enum { PMP_STATE_NORMAL, PMP_STATE_PORTS, - PMP_STATE_CONFIG, + PMP_STATE_PRECONFIG, PMP_STATE_RESET, PMP_STATE_CONNECT, PMP_STATE_CHECK, PMP_STATE_CLEAR, + PMP_STATE_CONFIG, PMP_STATE_SCAN } pmp_state; @@ -436,7 +437,7 @@ pmpstart(struct cam_periph *periph, unio pmp_default_timeout * 1000); ata_pm_read_cmd(ataio, 2, 15); break; - case PMP_STATE_CONFIG: + case PMP_STATE_PRECONFIG: cam_fill_ataio(ataio, pmp_retry_count, pmpdone, @@ -445,7 +446,7 @@ pmpstart(struct cam_periph *periph, unio /*data_ptr*/NULL, /*dxfer_len*/0, pmp_default_timeout * 1000); - ata_pm_write_cmd(ataio, 0x60, 15, 0xf); + ata_pm_write_cmd(ataio, 0x60, 15, 0x0); break; case PMP_STATE_RESET: cam_fill_ataio(ataio, @@ -495,6 +496,17 @@ printf("PM RESET %d%s\n", softc->pm_step pmp_default_timeout * 1000); ata_pm_write_cmd(ataio, 1, softc->pm_step, 0xFFFFFFFF); break; + case PMP_STATE_CONFIG: + cam_fill_ataio(ataio, + pmp_retry_count, + pmpdone, + /*flags*/CAM_DIR_NONE, + 0, + /*data_ptr*/NULL, + /*dxfer_len*/0, + pmp_default_timeout * 1000); + ata_pm_write_cmd(ataio, 0x60, 15, 0xf); + break; default: break; } @@ -554,24 +566,29 @@ pmpdone(struct cam_periph *periph, union (done_ccb->ataio.res.lba_mid << 16) + (done_ccb->ataio.res.lba_low << 8) + done_ccb->ataio.res.sector_count; - /* This PM declares 6 ports, while only 5 of them are real. + /* This PMP declares 6 ports, while only 5 of them are real. * Port 5 is enclosure management bridge port, which has implementation * problems, causing probe faults. Hide it for now. */ if (softc->pm_pid == 0x37261095 && softc->pm_ports == 6) softc->pm_ports = 5; - /* This PM declares 7 ports, while only 5 of them are real. + /* This PMP declares 7 ports, while only 5 of them are real. * Port 5 is some fake "Config Disk" with 640 sectors size, * port 6 is enclosure management bridge port. * Both fake ports has implementation problems, causing * probe faults. Hide them for now. */ if (softc->pm_pid == 0x47261095 && softc->pm_ports == 7) softc->pm_ports = 5; + /* These PMPs declare one more port then actually have, + * for configuration purposes. Hide it for now. */ + if (softc->pm_pid == 0x57231095 || softc->pm_pid == 0x57331095 || + softc->pm_pid == 0x57341095 || softc->pm_pid == 0x57441095) + softc->pm_ports--; printf("PM ports: %d\n", softc->pm_ports); - softc->state = PMP_STATE_CONFIG; + softc->state = PMP_STATE_PRECONFIG; xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); return; - case PMP_STATE_CONFIG: + case PMP_STATE_PRECONFIG: softc->pm_step = 0; softc->state = PMP_STATE_RESET; softc->reset |= ~softc->found; @@ -658,11 +675,15 @@ pmpdone(struct cam_periph *periph, union return; case PMP_STATE_CLEAR: softc->pm_step++; - if (softc->pm_step < softc->pm_ports) { - xpt_release_ccb(done_ccb); - xpt_schedule(periph, priority); - return; - } else if (softc->found) { + if (softc->pm_step >= softc->pm_ports) { + softc->state = PMP_STATE_CONFIG; + softc->pm_step = 0; + } + xpt_release_ccb(done_ccb); + xpt_schedule(periph, priority); + return; + case PMP_STATE_CONFIG: + if (softc->found) { softc->pm_step = 0; softc->state = PMP_STATE_SCAN; work_ccb = xpt_alloc_ccb_nowait(); From owner-svn-src-head@FreeBSD.ORG Mon Nov 16 15:38:28 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E13EB1065676; Mon, 16 Nov 2009 15:38:27 +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 CF0EF8FC47; Mon, 16 Nov 2009 15:38:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAGFcRgC074276; Mon, 16 Nov 2009 15:38:27 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAGFcRsS074268; Mon, 16 Nov 2009 15:38:27 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200911161538.nAGFcRsS074268@svn.freebsd.org> From: Alexander Motin Date: Mon, 16 Nov 2009 15:38: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: r199322 - in head/sys/dev: ahci ata ata/chipsets X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Nov 2009 15:38:28 -0000 Author: mav Date: Mon Nov 16 15:38:27 2009 New Revision: 199322 URL: http://svn.freebsd.org/changeset/base/199322 Log: Change the way in which AHCI+PATA combined controllers, such as JMicron and Marvell handled. Instead of trying to attach two different drivers to single device, wrapping each call, make one of them (atajmicron, atamarvell) attach do device solely, but create child device for AHCI driver, passing it all required resources. It is quite easy, as none of resources are shared, except IRQ. As result, it: - makes drivers operation more independent and straitforward, - allows to use new ahci(4) driver with such devices, adding support for new features, such as PMP and NCQ, same time keeping legacy PATA support, - will allow to just drop old ataahci driver, when it's time come. Modified: head/sys/dev/ahci/ahci.c head/sys/dev/ahci/ahci.h head/sys/dev/ata/ata-pci.c head/sys/dev/ata/ata-pci.h head/sys/dev/ata/chipsets/ata-ahci.c head/sys/dev/ata/chipsets/ata-jmicron.c head/sys/dev/ata/chipsets/ata-marvell.c Modified: head/sys/dev/ahci/ahci.c ============================================================================== --- head/sys/dev/ahci/ahci.c Mon Nov 16 15:18:02 2009 (r199321) +++ head/sys/dev/ahci/ahci.c Mon Nov 16 15:38:27 2009 (r199322) @@ -99,7 +99,14 @@ MALLOC_DEFINE(M_AHCI, "AHCI driver", "AH static struct { uint32_t id; const char *name; - int flags; + int quirks; +#define AHCI_Q_NOFORCE 1 +#define AHCI_Q_NOPMP 2 +#define AHCI_Q_NONCQ 4 +#define AHCI_Q_1CH 8 +#define AHCI_Q_2CH 16 +#define AHCI_Q_4CH 32 +#define AHCI_Q_EDGEIS 64 } ahci_ids[] = { {0x43801002, "ATI IXP600", 0}, {0x43901002, "ATI IXP700", 0}, @@ -145,6 +152,15 @@ static struct { {0x3b2b8086, "Intel PCH", 0}, {0x3b2c8086, "Intel PCH", 0}, {0x3b2f8086, "Intel PCH", 0}, + {0x2361197b, "JMicron JMB361", AHCI_Q_NOFORCE}, + {0x2363197b, "JMicron JMB363", AHCI_Q_NOFORCE}, + {0x2365197b, "JMicron JMB365", AHCI_Q_NOFORCE}, + {0x2366197b, "JMicron JMB366", AHCI_Q_NOFORCE}, + {0x2368197b, "JMicron JMB368", AHCI_Q_NOFORCE}, + {0x611111ab, "Marvell 88SX6111", AHCI_Q_NOFORCE|AHCI_Q_1CH|AHCI_Q_EDGEIS}, + {0x612111ab, "Marvell 88SX6121", AHCI_Q_NOFORCE|AHCI_Q_2CH|AHCI_Q_EDGEIS}, + {0x614111ab, "Marvell 88SX6141", AHCI_Q_NOFORCE|AHCI_Q_4CH|AHCI_Q_EDGEIS}, + {0x614511ab, "Marvell 88SX6145", AHCI_Q_NOFORCE|AHCI_Q_4CH|AHCI_Q_EDGEIS}, {0x044c10de, "NVIDIA MCP65", 0}, {0x044d10de, "NVIDIA MCP65", 0}, {0x044e10de, "NVIDIA MCP65", 0}, @@ -226,9 +242,39 @@ static int ahci_probe(device_t dev) { char buf[64]; + int i, valid = 0; + uint32_t devid = pci_get_devid(dev); + + /* Is this a possible AHCI candidate? */ + if (pci_get_class(dev) == PCIC_STORAGE && + pci_get_subclass(dev) == PCIS_STORAGE_SATA && + pci_get_progif(dev) == PCIP_STORAGE_SATA_AHCI_1_0) + valid = 1; + /* Is this a known AHCI chip? */ + for (i = 0; ahci_ids[i].id != 0; i++) { + if (ahci_ids[i].id == devid && + (valid || !(ahci_ids[i].quirks & AHCI_Q_NOFORCE))) { + snprintf(buf, sizeof(buf), "%s AHCI SATA controller", + ahci_ids[i].name); + device_set_desc_copy(dev, buf); + return (BUS_PROBE_VENDOR); + } + } + if (!valid) + return (ENXIO); + device_set_desc_copy(dev, "AHCI SATA controller"); + return (BUS_PROBE_VENDOR); +} + +static int +ahci_ata_probe(device_t dev) +{ + char buf[64]; int i; uint32_t devid = pci_get_devid(dev); + if ((intptr_t)device_get_ivars(dev) >= 0) + return (ENXIO); /* Is this a known AHCI chip? */ for (i = 0; ahci_ids[i].id != 0; i++) { if (ahci_ids[i].id == devid) { @@ -238,11 +284,6 @@ ahci_probe(device_t dev) return (BUS_PROBE_VENDOR); } } - /* Is this a possible AHCI candidate? */ - if (pci_get_class(dev) != PCIC_STORAGE || - pci_get_subclass(dev) != PCIS_STORAGE_SATA || - pci_get_progif(dev) != PCIP_STORAGE_SATA_AHCI_1_0) - return (ENXIO); device_set_desc_copy(dev, "AHCI SATA controller"); return (BUS_PROBE_VENDOR); } @@ -252,10 +293,15 @@ ahci_attach(device_t dev) { struct ahci_controller *ctlr = device_get_softc(dev); device_t child; - int error, unit, speed; + int error, unit, speed, i; + uint32_t devid = pci_get_devid(dev); u_int32_t version; ctlr->dev = dev; + i = 0; + while (ahci_ids[i].id != 0 && ahci_ids[i].id != devid) + i++; + ctlr->quirks = ahci_ids[i].quirks; resource_int_value(device_get_name(dev), device_get_unit(dev), "ccc", &ctlr->ccc); /* if we have a memory BAR(5) we are likely on an AHCI part */ @@ -282,10 +328,32 @@ ahci_attach(device_t dev) rman_fini(&ctlr->sc_iomem); return (error); }; - /* Get the number of HW channels */ + /* Get the HW capabilities */ + version = ATA_INL(ctlr->r_mem, AHCI_VS); + ctlr->caps = ATA_INL(ctlr->r_mem, AHCI_CAP); + if (version >= 0x00010020) + ctlr->caps2 = ATA_INL(ctlr->r_mem, AHCI_CAP2); ctlr->ichannels = ATA_INL(ctlr->r_mem, AHCI_PI); + if (ctlr->quirks & AHCI_Q_1CH) { + ctlr->caps &= ~AHCI_CAP_NPMASK; + ctlr->ichannels &= 0x01; + } + if (ctlr->quirks & AHCI_Q_2CH) { + ctlr->caps &= ~AHCI_CAP_NPMASK; + ctlr->caps |= 1; + ctlr->ichannels &= 0x03; + } + if (ctlr->quirks & AHCI_Q_4CH) { + ctlr->caps &= ~AHCI_CAP_NPMASK; + ctlr->caps |= 3; + ctlr->ichannels &= 0x0f; + } ctlr->channels = MAX(flsl(ctlr->ichannels), - (ATA_INL(ctlr->r_mem, AHCI_CAP) & AHCI_CAP_NPMASK) + 1); + (ctlr->caps & AHCI_CAP_NPMASK) + 1); + if (ctlr->quirks & AHCI_Q_NOPMP) + ctlr->caps &= ~AHCI_CAP_SPM; + if (ctlr->quirks & AHCI_Q_NONCQ) + ctlr->caps &= ~AHCI_CAP_SNCQ; /* Setup interrupts. */ if (ahci_setup_interrupt(dev)) { bus_release_resource(dev, SYS_RES_MEMORY, ctlr->r_rid, ctlr->r_mem); @@ -293,10 +361,6 @@ ahci_attach(device_t dev) return ENXIO; } /* Announce HW capabilities. */ - version = ATA_INL(ctlr->r_mem, AHCI_VS); - ctlr->caps = ATA_INL(ctlr->r_mem, AHCI_CAP); - if (version >= 0x00010020) - ctlr->caps2 = ATA_INL(ctlr->r_mem, AHCI_CAP2); speed = (ctlr->caps & AHCI_CAP_ISS) >> AHCI_CAP_ISS_SHIFT; device_printf(dev, "AHCI v%x.%02x with %d %sGbps ports, Port Multiplier %s\n", @@ -531,8 +595,15 @@ ahci_intr(void *data) for (; unit < ctlr->channels; unit++) { if ((is & (1 << unit)) != 0 && (arg = ctlr->interrupt[unit].argument)) { - ctlr->interrupt[unit].function(arg); - ATA_OUTL(ctlr->r_mem, AHCI_IS, 1 << unit); + if (ctlr->quirks & AHCI_Q_EDGEIS) { + /* Some controller have edge triggered IS. */ + ATA_OUTL(ctlr->r_mem, AHCI_IS, 1 << unit); + ctlr->interrupt[unit].function(arg); + } else { + /* but AHCI declares level triggered IS. */ + ctlr->interrupt[unit].function(arg); + ATA_OUTL(ctlr->r_mem, AHCI_IS, 1 << unit); + } } } } @@ -665,6 +736,25 @@ static driver_t ahci_driver = { sizeof(struct ahci_controller) }; DRIVER_MODULE(ahci, pci, ahci_driver, ahci_devclass, 0, 0); +static device_method_t ahci_ata_methods[] = { + DEVMETHOD(device_probe, ahci_ata_probe), + DEVMETHOD(device_attach, ahci_attach), + DEVMETHOD(device_detach, ahci_detach), + DEVMETHOD(device_suspend, ahci_suspend), + DEVMETHOD(device_resume, ahci_resume), + DEVMETHOD(bus_print_child, ahci_print_child), + DEVMETHOD(bus_alloc_resource, ahci_alloc_resource), + DEVMETHOD(bus_release_resource, ahci_release_resource), + DEVMETHOD(bus_setup_intr, ahci_setup_intr), + DEVMETHOD(bus_teardown_intr,ahci_teardown_intr), + { 0, 0 } +}; +static driver_t ahci_ata_driver = { + "ahci", + ahci_ata_methods, + sizeof(struct ahci_controller) +}; +DRIVER_MODULE(ahci, atapci, ahci_ata_driver, ahci_devclass, 0, 0); MODULE_VERSION(ahci, 1); MODULE_DEPEND(ahci, cam, 1, 1, 1); @@ -688,6 +778,7 @@ ahci_ch_attach(device_t dev) ch->unit = (intptr_t)device_get_ivars(dev); ch->caps = ctlr->caps; ch->caps2 = ctlr->caps2; + ch->quirks = ctlr->quirks; ch->numslots = ((ch->caps & AHCI_CAP_NCS) >> AHCI_CAP_NCS_SHIFT) + 1, mtx_init(&ch->mtx, "AHCI channel lock", NULL, MTX_DEF); resource_int_value(device_get_name(dev), @@ -858,7 +949,7 @@ static driver_t ahcich_driver = { ahcich_methods, sizeof(struct ahci_channel) }; -DRIVER_MODULE(ahcich, ahci, ahcich_driver, ahci_devclass, 0, 0); +DRIVER_MODULE(ahcich, ahci, ahcich_driver, ahcich_devclass, 0, 0); struct ahci_dc_cb_args { bus_addr_t maddr; Modified: head/sys/dev/ahci/ahci.h ============================================================================== --- head/sys/dev/ahci/ahci.h Mon Nov 16 15:18:02 2009 (r199321) +++ head/sys/dev/ahci/ahci.h Mon Nov 16 15:38:27 2009 (r199322) @@ -352,6 +352,7 @@ struct ahci_channel { struct cam_path *path; uint32_t caps; /* Controller capabilities */ uint32_t caps2; /* Controller capabilities */ + int quirks; int numslots; /* Number of present slots */ int pm_level; /* power management level */ int sata_rev; /* Maximum allowed SATA generation */ @@ -391,6 +392,7 @@ struct ahci_controller { } irqs[16]; uint32_t caps; /* Controller capabilities */ uint32_t caps2; /* Controller capabilities */ + int quirks; int numirqs; int channels; int ichannels; Modified: head/sys/dev/ata/ata-pci.c ============================================================================== --- head/sys/dev/ata/ata-pci.c Mon Nov 16 15:18:02 2009 (r199321) +++ head/sys/dev/ata/ata-pci.c Mon Nov 16 15:38:27 2009 (r199322) @@ -189,91 +189,138 @@ ata_pci_resume(device_t dev) return error; } +int +ata_pci_read_ivar(device_t dev, device_t child, int which, uintptr_t *result) +{ + + return (BUS_READ_IVAR(device_get_parent(dev), dev, which, result)); +} + +int +ata_pci_write_ivar(device_t dev, device_t child, int which, uintptr_t value) +{ + + return (BUS_WRITE_IVAR(device_get_parent(dev), dev, which, value)); +} + +uint32_t +ata_pci_read_config(device_t dev, device_t child, int reg, int width) +{ + + return (pci_read_config(dev, reg, width)); +} + +void +ata_pci_write_config(device_t dev, device_t child, int reg, + uint32_t val, int width) +{ + + pci_write_config(dev, reg, val, width); +} + 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) { - struct ata_pci_controller *controller = device_get_softc(dev); - int unit = ((struct ata_channel *)device_get_softc(child))->unit; - struct resource *res = NULL; - int myrid; - - if (type == SYS_RES_IOPORT) { - switch (*rid) { - case ATA_IOADDR_RID: - if (controller->legacy) { - start = (unit ? ATA_SECONDARY : ATA_PRIMARY); - count = ATA_IOSIZE; - end = start + count - 1; - } - myrid = PCIR_BAR(0) + (unit << 3); - res = BUS_ALLOC_RESOURCE(device_get_parent(dev), dev, - SYS_RES_IOPORT, &myrid, - start, end, count, flags); - break; - - case ATA_CTLADDR_RID: - if (controller->legacy) { - start = (unit ? ATA_SECONDARY : ATA_PRIMARY) + ATA_CTLOFFSET; - count = ATA_CTLIOSIZE; - end = start + count - 1; - } - myrid = PCIR_BAR(1) + (unit << 3); - res = BUS_ALLOC_RESOURCE(device_get_parent(dev), dev, - SYS_RES_IOPORT, &myrid, - start, end, count, flags); - break; - } - } - if (type == SYS_RES_IRQ && *rid == ATA_IRQ_RID) { - if (controller->legacy) { - int irq = (unit == 0 ? 14 : 15); + struct ata_pci_controller *controller = device_get_softc(dev); + struct resource *res = NULL; + + if (device_get_devclass(child) == ata_devclass) { + int unit = ((struct ata_channel *)device_get_softc(child))->unit; + int myrid; + + if (type == SYS_RES_IOPORT) { + switch (*rid) { + case ATA_IOADDR_RID: + if (controller->legacy) { + start = (unit ? ATA_SECONDARY : ATA_PRIMARY); + count = ATA_IOSIZE; + end = start + count - 1; + } + myrid = PCIR_BAR(0) + (unit << 3); + res = BUS_ALLOC_RESOURCE(device_get_parent(dev), dev, + SYS_RES_IOPORT, &myrid, + start, end, count, flags); + break; + case ATA_CTLADDR_RID: + if (controller->legacy) { + start = (unit ? ATA_SECONDARY : ATA_PRIMARY) + + ATA_CTLOFFSET; + count = ATA_CTLIOSIZE; + end = start + count - 1; + } + myrid = PCIR_BAR(1) + (unit << 3); + res = BUS_ALLOC_RESOURCE(device_get_parent(dev), dev, + SYS_RES_IOPORT, &myrid, + start, end, count, flags); + break; + } + } + if (type == SYS_RES_IRQ && *rid == ATA_IRQ_RID) { + if (controller->legacy) { + int irq = (unit == 0 ? 14 : 15); - res = BUS_ALLOC_RESOURCE(device_get_parent(dev), child, - SYS_RES_IRQ, rid, irq, irq, 1, flags); + res = BUS_ALLOC_RESOURCE(device_get_parent(dev), child, + SYS_RES_IRQ, rid, irq, irq, 1, flags); + } else + res = controller->r_irq; + } + } else { + if (type == SYS_RES_IRQ) { + if (*rid != ATA_IRQ_RID) + return (NULL); + res = controller->r_irq; + } else { + res = BUS_ALLOC_RESOURCE(device_get_parent(dev), dev, + type, rid, start, end, count, flags); + } } - else - res = controller->r_irq; - } - return res; + return (res); } int ata_pci_release_resource(device_t dev, device_t child, int type, int rid, struct resource *r) { - struct ata_pci_controller *controller = device_get_softc(dev); - int unit = ((struct ata_channel *)device_get_softc(child))->unit; - - if (type == SYS_RES_IOPORT) { - switch (rid) { - case ATA_IOADDR_RID: - return BUS_RELEASE_RESOURCE(device_get_parent(dev), dev, - SYS_RES_IOPORT, - PCIR_BAR(0) + (unit << 3), r); - break; - - case ATA_CTLADDR_RID: - return BUS_RELEASE_RESOURCE(device_get_parent(dev), dev, - SYS_RES_IOPORT, - PCIR_BAR(1) + (unit << 3), r); - break; - default: - return ENOENT; - } - } - if (type == SYS_RES_IRQ) { - if (rid != ATA_IRQ_RID) - return ENOENT; - if (controller->legacy) { - return BUS_RELEASE_RESOURCE(device_get_parent(dev), child, - SYS_RES_IRQ, rid, r); + if (device_get_devclass(child) == ata_devclass) { + struct ata_pci_controller *controller = device_get_softc(dev); + int unit = ((struct ata_channel *)device_get_softc(child))->unit; + + if (type == SYS_RES_IOPORT) { + switch (rid) { + case ATA_IOADDR_RID: + return BUS_RELEASE_RESOURCE(device_get_parent(dev), dev, + SYS_RES_IOPORT, + PCIR_BAR(0) + (unit << 3), r); + case ATA_CTLADDR_RID: + return BUS_RELEASE_RESOURCE(device_get_parent(dev), dev, + SYS_RES_IOPORT, + PCIR_BAR(1) + (unit << 3), r); + default: + return ENOENT; + } + } + if (type == SYS_RES_IRQ) { + if (rid != ATA_IRQ_RID) + return ENOENT; + if (controller->legacy) { + return BUS_RELEASE_RESOURCE(device_get_parent(dev), child, + SYS_RES_IRQ, rid, r); + } else + return 0; + } + } else { + if (type == SYS_RES_IRQ) { + if (rid != ATA_IRQ_RID) + return (ENOENT); + return (0); + } else { + return (BUS_RELEASE_RESOURCE(device_get_parent(dev), child, + type, rid, r)); + } } - else - return 0; - } - return EINVAL; + return (EINVAL); } int @@ -281,44 +328,50 @@ ata_pci_setup_intr(device_t dev, device_ int flags, driver_filter_t *filter, driver_intr_t *function, void *argument, void **cookiep) { - struct ata_pci_controller *controller = device_get_softc(dev); + struct ata_pci_controller *controller = device_get_softc(dev); - if (controller->legacy) { - return BUS_SETUP_INTR(device_get_parent(dev), child, irq, + if (controller->legacy) { + return BUS_SETUP_INTR(device_get_parent(dev), child, irq, flags, filter, function, argument, cookiep); - } - else { - struct ata_pci_controller *controller = device_get_softc(dev); - int unit = ((struct ata_channel *)device_get_softc(child))->unit; + } else { + struct ata_pci_controller *controller = device_get_softc(dev); + int unit; - if (filter != NULL) { - printf("ata-pci.c: we cannot use a filter here\n"); - return (EINVAL); + if (filter != NULL) { + printf("ata-pci.c: we cannot use a filter here\n"); + return (EINVAL); + } + if (device_get_devclass(child) == ata_devclass) + unit = ((struct ata_channel *)device_get_softc(child))->unit; + else + unit = ATA_PCI_MAX_CH - 1; + controller->interrupt[unit].function = function; + controller->interrupt[unit].argument = argument; + *cookiep = controller; + return 0; } - controller->interrupt[unit].function = function; - controller->interrupt[unit].argument = argument; - *cookiep = controller; - return 0; - } } int ata_pci_teardown_intr(device_t dev, device_t child, struct resource *irq, void *cookie) { - struct ata_pci_controller *controller = device_get_softc(dev); - - if (controller->legacy) { - return BUS_TEARDOWN_INTR(device_get_parent(dev), child, irq, cookie); - } - else { struct ata_pci_controller *controller = device_get_softc(dev); - int unit = ((struct ata_channel *)device_get_softc(child))->unit; - controller->interrupt[unit].function = NULL; - controller->interrupt[unit].argument = NULL; - return 0; - } + if (controller->legacy) { + return BUS_TEARDOWN_INTR(device_get_parent(dev), child, irq, cookie); + } else { + struct ata_pci_controller *controller = device_get_softc(dev); + int unit; + + if (device_get_devclass(child) == ata_devclass) + unit = ((struct ata_channel *)device_get_softc(child))->unit; + else + unit = ATA_PCI_MAX_CH - 1; + controller->interrupt[unit].function = NULL; + controller->interrupt[unit].argument = NULL; + return 0; + } } static void @@ -510,12 +563,16 @@ static device_method_t ata_pci_methods[] DEVMETHOD(device_shutdown, bus_generic_shutdown), /* bus methods */ + DEVMETHOD(bus_read_ivar, ata_pci_read_ivar), + DEVMETHOD(bus_write_ivar, ata_pci_write_ivar), DEVMETHOD(bus_alloc_resource, ata_pci_alloc_resource), DEVMETHOD(bus_release_resource, ata_pci_release_resource), DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), DEVMETHOD(bus_setup_intr, ata_pci_setup_intr), DEVMETHOD(bus_teardown_intr, ata_pci_teardown_intr), + DEVMETHOD(pci_read_config, ata_pci_read_config), + DEVMETHOD(pci_write_config, ata_pci_write_config), { 0, 0 } }; @@ -537,6 +594,8 @@ 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); @@ -711,7 +770,7 @@ ata_generic_intr(void *data) struct ata_channel *ch; int unit; - for (unit = 0; unit < ctlr->channels; unit++) { + for (unit = 0; unit < ATA_PCI_MAX_CH; unit++) { if ((ch = ctlr->interrupt[unit].argument)) ctlr->interrupt[unit].function(ch); } Modified: head/sys/dev/ata/ata-pci.h ============================================================================== --- head/sys/dev/ata/ata-pci.h Mon Nov 16 15:18:02 2009 (r199321) +++ head/sys/dev/ata/ata-pci.h Mon Nov 16 15:38:27 2009 (r199322) @@ -36,6 +36,8 @@ struct ata_chip_id { char *text; }; +#define ATA_PCI_MAX_CH 8 + /* structure describing a PCI ATA controller */ struct ata_pci_controller { device_t dev; @@ -65,7 +67,7 @@ struct ata_pci_controller { struct { void (*function)(void *); void *argument; - } interrupt[8]; /* XXX SOS max ch# for now */ + } interrupt[ATA_PCI_MAX_CH]; void *chipset_data; }; @@ -486,6 +488,11 @@ int ata_pci_attach(device_t dev); int ata_pci_detach(device_t dev); int ata_pci_suspend(device_t dev); int ata_pci_resume(device_t dev); +int ata_pci_read_ivar(device_t dev, device_t child, int which, uintptr_t *result); +int ata_pci_write_ivar(device_t dev, device_t child, int which, uintptr_t value); +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); 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); int ata_pci_release_resource(device_t dev, device_t child, int type, int rid, struct resource *r); int ata_pci_setup_intr(device_t dev, device_t child, struct resource *irq, int flags, driver_filter_t *filter, driver_intr_t *function, void *argument, void **cookiep); @@ -509,12 +516,6 @@ int ata_mode2idx(int mode); /* global prototypes from chipsets/ata-*.c */ int ata_ahci_chipinit(device_t); -int ata_ahci_ch_attach(device_t dev); -int ata_ahci_ch_detach(device_t dev); -int ata_ahci_ch_suspend(device_t dev); -int ata_ahci_ch_resume(device_t dev); -int ata_ahci_ctlr_reset(device_t dev); -void ata_ahci_reset(device_t dev); int ata_marvell_edma_chipinit(device_t); int ata_sii_chipinit(device_t); @@ -530,12 +531,16 @@ static device_method_t __CONCAT(dname,_m DEVMETHOD(device_suspend, ata_pci_suspend), \ DEVMETHOD(device_resume, ata_pci_resume), \ DEVMETHOD(device_shutdown, bus_generic_shutdown), \ + DEVMETHOD(bus_read_ivar, ata_pci_read_ivar), \ + DEVMETHOD(bus_write_ivar, ata_pci_write_ivar), \ DEVMETHOD(bus_alloc_resource, ata_pci_alloc_resource), \ DEVMETHOD(bus_release_resource, ata_pci_release_resource), \ DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), \ DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), \ DEVMETHOD(bus_setup_intr, ata_pci_setup_intr), \ DEVMETHOD(bus_teardown_intr, ata_pci_teardown_intr), \ + DEVMETHOD(pci_read_config, ata_pci_read_config), \ + DEVMETHOD(pci_write_config, ata_pci_write_config), \ { 0, 0 } \ }; \ static driver_t __CONCAT(dname,_driver) = { \ Modified: head/sys/dev/ata/chipsets/ata-ahci.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-ahci.c Mon Nov 16 15:18:02 2009 (r199321) +++ head/sys/dev/ata/chipsets/ata-ahci.c Mon Nov 16 15:38:27 2009 (r199322) @@ -52,6 +52,12 @@ __FBSDID("$FreeBSD$"); #include /* local prototypes */ +static int ata_ahci_ch_attach(device_t dev); +static int ata_ahci_ch_detach(device_t dev); +static int ata_ahci_ch_suspend(device_t dev); +static int ata_ahci_ch_resume(device_t dev); +static int ata_ahci_ctlr_reset(device_t dev); +static void ata_ahci_reset(device_t dev); static int ata_ahci_suspend(device_t dev); static int ata_ahci_status(device_t dev); static int ata_ahci_begin_transaction(struct ata_request *request); @@ -97,6 +103,49 @@ ata_ahci_probe(device_t dev) return (BUS_PROBE_GENERIC); } +static int +ata_ahci_ata_probe(device_t dev) +{ + struct ata_pci_controller *ctlr = device_get_softc(dev); + + if ((intptr_t)device_get_ivars(dev) >= 0) + return (ENXIO); + device_set_desc_copy(dev, "AHCI SATA controller"); + ctlr->chipinit = ata_ahci_chipinit; + return (BUS_PROBE_GENERIC); +} + +static int +ata_ahci_ata_attach(device_t dev) +{ + struct ata_pci_controller *ctlr = device_get_softc(dev); + device_t child; + int unit; + + /* do chipset specific setups only needed once */ + ctlr->legacy = 0; + ctlr->ichannels = -1; + ctlr->ch_attach = ata_pci_ch_attach; + ctlr->ch_detach = ata_pci_ch_detach; + ctlr->dev = dev; + if (ctlr->chipinit(dev)) + return ENXIO; + /* 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, "ata", + ((unit == 0 || unit == 1) && ctlr->legacy) ? + unit : devclass_find_free_unit(ata_devclass, 2)); + if (child == NULL) + device_printf(dev, "failed to add ata child device\n"); + else + device_set_ivars(child, (void *)(intptr_t)unit); + } + bus_generic_attach(dev); + return 0; +} + int ata_ahci_chipinit(device_t dev) { @@ -129,9 +178,15 @@ ata_ahci_chipinit(device_t dev) /* get the number of HW channels */ ctlr->ichannels = ATA_INL(ctlr->r_res2, ATA_AHCI_PI); - ctlr->channels = - MAX(flsl(ctlr->ichannels), + ctlr->channels = MAX(flsl(ctlr->ichannels), (ATA_INL(ctlr->r_res2, ATA_AHCI_CAP) & ATA_AHCI_CAP_NPMASK) + 1); + if (pci_get_devid(dev) == ATA_M88SX6111) + ctlr->channels = 1; + else if (pci_get_devid(dev) == ATA_M88SX6121) + ctlr->channels = 2; + else if (pci_get_devid(dev) == ATA_M88SX6141 || + pci_get_devid(dev) == ATA_M88SX6145) + ctlr->channels = 4; ctlr->reset = ata_ahci_reset; ctlr->ch_attach = ata_ahci_ch_attach; @@ -183,7 +238,7 @@ ata_ahci_chipinit(device_t dev) return 0; } -int +static int ata_ahci_ctlr_reset(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); @@ -228,7 +283,7 @@ ata_ahci_suspend(device_t dev) return 0; } -int +static int ata_ahci_ch_attach(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); @@ -259,7 +314,7 @@ ata_ahci_ch_attach(device_t dev) return 0; } -int +static int ata_ahci_ch_detach(device_t dev) { @@ -268,7 +323,7 @@ ata_ahci_ch_detach(device_t dev) return (0); } -int +static int ata_ahci_ch_suspend(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); @@ -293,7 +348,7 @@ ata_ahci_ch_suspend(device_t dev) return (0); } -int +static int ata_ahci_ch_resume(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); @@ -813,7 +868,7 @@ ata_ahci_softreset(device_t dev, int por return ATA_INL(ctlr->r_res2, ATA_AHCI_P_SIG + offset); } -void +static void ata_ahci_reset(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); @@ -927,3 +982,26 @@ ata_ahci_setup_fis(struct ata_ahci_cmd_t } ATA_DECLARE_DRIVER(ata_ahci); +static device_method_t ata_ahci_ata_methods[] = { + DEVMETHOD(device_probe, ata_ahci_ata_probe), + DEVMETHOD(device_attach, ata_ahci_ata_attach), + DEVMETHOD(device_detach, ata_pci_detach), + DEVMETHOD(device_suspend, ata_pci_suspend), + DEVMETHOD(device_resume, ata_pci_resume), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + DEVMETHOD(bus_read_ivar, ata_pci_read_ivar), + DEVMETHOD(bus_write_ivar, ata_pci_write_ivar), + DEVMETHOD(bus_alloc_resource, ata_pci_alloc_resource), + DEVMETHOD(bus_release_resource, ata_pci_release_resource), + DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), + DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), + DEVMETHOD(bus_setup_intr, ata_pci_setup_intr), + DEVMETHOD(bus_teardown_intr, ata_pci_teardown_intr), + { 0, 0 } +}; +static driver_t ata_ahci_ata_driver = { + "atapci", + ata_ahci_ata_methods, + sizeof(struct ata_pci_controller) +}; +DRIVER_MODULE(ata_ahci_ata, atapci, ata_ahci_ata_driver, ata_pci_devclass, 0, 0); Modified: head/sys/dev/ata/chipsets/ata-jmicron.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-jmicron.c Mon Nov 16 15:18:02 2009 (r199321) +++ head/sys/dev/ata/chipsets/ata-jmicron.c Mon Nov 16 15:38:27 2009 (r199322) @@ -53,11 +53,6 @@ __FBSDID("$FreeBSD$"); /* local prototypes */ static int ata_jmicron_chipinit(device_t dev); -static int ata_jmicron_ch_attach(device_t dev); -static int ata_jmicron_ch_detach(device_t dev); -static int ata_jmicron_ch_suspend(device_t dev); -static int ata_jmicron_ch_resume(device_t dev); -static void ata_jmicron_reset(device_t dev); static void ata_jmicron_setmode(device_t dev, int mode); /* @@ -70,10 +65,10 @@ ata_jmicron_probe(device_t dev) struct ata_chip_id *idx; static struct ata_chip_id ids[] = {{ ATA_JMB360, 0, 1, 0, ATA_SA300, "JMB360" }, - { ATA_JMB361, 0, 1, 1, ATA_SA300, "JMB361" }, - { ATA_JMB363, 0, 2, 1, ATA_SA300, "JMB363" }, - { ATA_JMB365, 0, 1, 2, ATA_SA300, "JMB365" }, - { ATA_JMB366, 0, 2, 2, ATA_SA300, "JMB366" }, + { ATA_JMB361, 0, 1, 1, ATA_UDMA6, "JMB361" }, + { ATA_JMB363, 0, 2, 1, ATA_UDMA6, "JMB363" }, + { ATA_JMB365, 0, 1, 2, ATA_UDMA6, "JMB365" }, + { ATA_JMB366, 0, 2, 2, ATA_UDMA6, "JMB366" }, { ATA_JMB368, 0, 0, 1, ATA_UDMA6, "JMB368" }, { 0, 0, 0, 0, 0, 0}}; char buffer[64]; @@ -101,7 +96,7 @@ static int ata_jmicron_chipinit(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); - int error; + device_t child; if (ata_setup_interrupt(dev, ata_generic_intr)) return ENXIO; @@ -123,116 +118,35 @@ ata_jmicron_chipinit(device_t dev) /* set controller configuration to a combined setup we support */ pci_write_config(dev, 0x40, 0x80c0a131, 4); pci_write_config(dev, 0x80, 0x01200000, 4); - - if (ctlr->chip->cfg1 && (error = ata_ahci_chipinit(dev))) - return error; - - ctlr->ch_attach = ata_jmicron_ch_attach; - ctlr->ch_detach = ata_jmicron_ch_detach; - ctlr->ch_suspend = ata_jmicron_ch_suspend; - ctlr->ch_resume = ata_jmicron_ch_resume; - ctlr->reset = ata_jmicron_reset; + /* Create AHCI subdevice if AHCI part present. */ + if (ctlr->chip->cfg1) { + child = device_add_child(dev, NULL, -1); + if (child != NULL) { + device_set_ivars(child, (void *)(intptr_t)-1); + bus_generic_attach(dev); + } + } + ctlr->ch_attach = ata_pci_ch_attach; + ctlr->ch_detach = ata_pci_ch_detach; + ctlr->reset = ata_generic_reset; ctlr->setmode = ata_jmicron_setmode; - - /* set the number of HW channels */ - ctlr->channels = ctlr->chip->cfg1 + ctlr->chip->cfg2; - ctlr->ichannels |= ((0xffffffffU >> (32 - ctlr->chip->cfg2)) - << ctlr->chip->cfg1); + ctlr->channels = ctlr->chip->cfg2; } return 0; } -static int -ata_jmicron_ch_attach(device_t dev) -{ - struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); - struct ata_channel *ch = device_get_softc(dev); - int error; - - if (ch->unit >= ctlr->chip->cfg1) { - ch->unit -= ctlr->chip->cfg1; - error = ata_pci_ch_attach(dev); - ch->unit += ctlr->chip->cfg1; - } - else - error = ata_ahci_ch_attach(dev); - return error; -} - -static int -ata_jmicron_ch_detach(device_t dev) -{ - struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); - struct ata_channel *ch = device_get_softc(dev); - int error; - - if (ch->unit >= ctlr->chip->cfg1) { - ch->unit -= ctlr->chip->cfg1; - error = ata_pci_ch_detach(dev); - ch->unit += ctlr->chip->cfg1; - } - else - error = ata_ahci_ch_detach(dev); - - return (error); -} - -static int -ata_jmicron_ch_suspend(device_t dev) -{ - struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); - struct ata_channel *ch = device_get_softc(dev); - int error = 0; - - if (ch->unit < ctlr->chip->cfg1) - error = ata_ahci_ch_suspend(dev); - return error; -} - -static int -ata_jmicron_ch_resume(device_t dev) -{ - struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); - struct ata_channel *ch = device_get_softc(dev); - int error = 0; - - if (ch->unit < ctlr->chip->cfg1) - error = ata_ahci_ch_resume(dev); - return (error); -} - -static void -ata_jmicron_reset(device_t dev) -{ - struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev)); - struct ata_channel *ch = device_get_softc(dev); - - if (ch->unit >= ctlr->chip->cfg1) - ata_generic_reset(dev); - else - ata_ahci_reset(dev); -} - static void ata_jmicron_setmode(device_t dev, int mode) { - struct ata_pci_controller *ctlr = device_get_softc(GRANDPARENT(dev)); - struct ata_channel *ch = device_get_softc(device_get_parent(dev)); - - if (pci_read_config(dev, 0xdf, 1) & 0x40 || ch->unit >= ctlr->chip->cfg1) { struct ata_device *atadev = device_get_softc(dev); /* check for 80pin cable present */ if (pci_read_config(dev, 0x40, 1) & 0x08) - mode = ata_limit_mode(dev, mode, ATA_UDMA2); + mode = ata_limit_mode(dev, mode, ATA_UDMA2); else - mode = ata_limit_mode(dev, mode, ATA_UDMA6); - + mode = ata_limit_mode(dev, mode, ATA_UDMA6); if (!ata_controlcmd(dev, ATA_SETFEATURES, ATA_SF_SETXFER, 0, mode)) - atadev->mode = mode; - } - else - ata_sata_setmode(dev, mode); + atadev->mode = mode; } ATA_DECLARE_DRIVER(ata_jmicron); Modified: head/sys/dev/ata/chipsets/ata-marvell.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-marvell.c Mon Nov 16 15:18:02 2009 (r199321) +++ head/sys/dev/ata/chipsets/ata-marvell.c Mon Nov 16 15:38:27 2009 (r199322) @@ -54,9 +54,7 @@ __FBSDID("$FreeBSD$"); /* local prototypes */ static int ata_marvell_chipinit(device_t dev); static int ata_marvell_ch_attach(device_t dev); -static int ata_marvell_ch_detach(device_t dev); static void ata_marvell_setmode(device_t dev, int mode); -static void ata_marvell_reset(device_t dev); static int ata_marvell_edma_ch_attach(device_t dev); static int ata_marvell_edma_ch_detach(device_t dev); static int ata_marvell_edma_status(device_t dev); @@ -111,10 +109,10 @@ ata_marvell_probe(device_t dev) { ATA_M88SX7042, 0, 4, MV_7042, ATA_SA300, "88SX7042" }, { ATA_M88SX6101, 0, 0, MV_61XX, ATA_UDMA6, "88SX6101" }, { ATA_M88SX6102, 0, 0, MV_61XX, ATA_UDMA6, "88SX6102" }, - { ATA_M88SX6111, 0, 1, MV_61XX, ATA_SA300, "88SX6111" }, - { ATA_M88SX6121, 0, 2, MV_61XX, ATA_SA300, "88SX6121" }, - { ATA_M88SX6141, 0, 4, MV_61XX, ATA_SA300, "88SX6141" }, - { ATA_M88SX6145, 0, 4, MV_61XX, ATA_SA300, "88SX6145" }, + { ATA_M88SX6111, 0, 1, MV_61XX, ATA_UDMA6, "88SX6111" }, + { ATA_M88SX6121, 0, 2, MV_61XX, ATA_UDMA6, "88SX6121" }, + { ATA_M88SX6141, 0, 4, MV_61XX, ATA_UDMA6, "88SX6141" }, + { ATA_M88SX6145, 0, 4, MV_61XX, ATA_UDMA6, "88SX6145" }, { 0, 0, 0, 0, 0, 0}}; if (pci_get_vendor(dev) != ATA_MARVELL_ID) @@ -142,83 +140,50 @@ ata_marvell_probe(device_t dev) static int ata_marvell_chipinit(device_t dev) { - struct ata_pci_controller *ctlr = device_get_softc(dev); - int error = 0; - - if (ata_setup_interrupt(dev, ata_generic_intr)) - return ENXIO; + struct ata_pci_controller *ctlr = device_get_softc(dev); + device_t child; - if (ctlr->chip->cfg1 && (error = ata_ahci_chipinit(dev))) - return (error); - ctlr->ch_attach = ata_marvell_ch_attach; - ctlr->ch_detach = ata_marvell_ch_detach; - ctlr->reset = ata_marvell_reset; - ctlr->setmode = ata_marvell_setmode; - ctlr->channels = ctlr->chip->cfg1 + 1; - return (0); + if (ata_setup_interrupt(dev, ata_generic_intr)) + return ENXIO; + /* Create AHCI subdevice if AHCI part present. */ + if (ctlr->chip->cfg1) { + child = device_add_child(dev, NULL, -1); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Mon Nov 16 19:10:10 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 52688106566B; Mon, 16 Nov 2009 19:10:10 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0C6D28FC0C; Mon, 16 Nov 2009 19:10:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAGJA9wF078910; Mon, 16 Nov 2009 19:10:09 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAGJA9Kx078907; Mon, 16 Nov 2009 19:10:09 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <200911161910.nAGJA9Kx078907@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 16 Nov 2009 19:10: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: r199329 - head/lib/libc/nls X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Nov 2009 19:10:10 -0000 Author: jkim Date: Mon Nov 16 19:10:09 2009 New Revision: 199329 URL: http://svn.freebsd.org/changeset/base/199329 Log: Sync with C.msg r199083. Modified: head/lib/libc/nls/ko_KR.UTF-8.msg (contents, props changed) head/lib/libc/nls/ko_KR.eucKR.msg (contents, props changed) Modified: head/lib/libc/nls/ko_KR.UTF-8.msg ============================================================================== --- head/lib/libc/nls/ko_KR.UTF-8.msg Mon Nov 16 18:59:04 2009 (r199328) +++ head/lib/libc/nls/ko_KR.UTF-8.msg Mon Nov 16 19:10:09 2009 (r199329) @@ -181,6 +181,16 @@ $ ENOATTR 87 ì†ì„±ì„ ì°¾ì„ ìˆ˜ 없습니다 $ EDOOFUS 88 í”„ë¡œê·¸ëž¨ìƒ ì˜¤ë¥˜ìž…ë‹ˆë‹¤ +$ EBADMSG +89 ìž˜ëª»ëœ ë©”ì‹œì§€ìž…ë‹ˆë‹¤ +$ EMULTIHOP +90 ë©€í‹°í™‰ì´ ì‹œë„ë˜ì—ˆìŠµë‹ˆë‹¤ +$ ENOLINK +91 ì—°ê²°ì´ ëŠê²¼ìŠµë‹ˆë‹¤ +$ EPROTO +92 í”„ë¡œí† ì½œì´ ìž˜ëª»ë˜ì—ˆìŠµë‹ˆë‹¤ +$ ENOTCAPABLE +93 ì ‘ê·¼ ëŠ¥ë ¥ì´ ì¶©ë¶„ì¹˜ 않습니다 $ $ strsignal() support catalog $ @@ -230,7 +240,7 @@ $ SIGTTIN $ SIGTTOU 22 정지 (í„°ë¯¸ë„ ì¶œë ¥) $ SIGIO -23 I/O possible +23 I/O 가능 $ SIGXCPU 24 CPU 사용 시간 초과 $ SIGXFSZ @@ -247,3 +257,39 @@ $ SIGUSR1 30 ì‚¬ìš©ìž ì •ì˜ ì‹œê·¸ë„ 1 $ SIGUSR2 31 ì‚¬ìš©ìž ì •ì˜ ì‹œê·¸ë„ 2 +$ +$ gai_strerror() support catalog +$ +$set 3 +$ 1 (obsolete) +1 호스트 ì´ë¦„ì´ ì§€ì›í•˜ì§€ 않는 주소군입니다 +$ EAI_AGAIN +2 주소 ë³€í™˜ì— ì¼ì‹œì ìœ¼ë¡œ 실패했습니다 +$ EAI_BADFLAGS +3 ìž˜ëª»ëœ ai_flags입니다 +$ EAI_FAIL +4 주소 ë³€í™˜ì— ì™„ì „ížˆ 실패했습니다 +$ EAI_FAMILY +5 지ì›ë˜ì§€ 않는 ai_family입니다 +$ EAI_MEMORY +6 메모리 í• ë‹¹ì— ì‹¤íŒ¨í–ˆìŠµë‹ˆë‹¤ +$ 7 (obsolete) +7 호스트 ì´ë¦„ê³¼ ì¼ì¹˜í•˜ëŠ” 주소가 없습니다 +$ EAI_NONAME +8 호스트 ì´ë¦„ ë˜ëŠ” 서비스 ì´ë¦„ì´ ì§€ì •ë˜ì§€ 않았거나 ì•Œ 수 없습니다 +$ EAI_SERVICE +9 서비스 ì´ë¦„ì€ ai_socktypeì—ì„œ 지ì›ë˜ì§€ 않습니다 +$ EAI_SOCKTYPE +10 지ì›ë˜ì§€ 않는 ai_socktype입니다 +$ EAI_SYSTEM +11 시스템 오류가 errnoì— ë°˜í™˜ë˜ì—ˆìŠµë‹ˆë‹¤ +$ EAI_BADHINTS +12 ìž˜ëª»ëœ hints입니다 +$ EAI_PROTOCOL +13 ì•Œ 수 없는 í”„ë¡œí† ì½œì´ ë³€í™˜ë˜ì—ˆìŠµë‹ˆë‹¤ +$ EAI_OVERFLOW +14 ì¸ìž ë²„í¼ ê³µê°„ì´ ëª¨ìžëžë‹ˆë‹¤ +$ 0 +32766 성공 +$ NL_MSGMAX +32767 ì•Œ 수 없는 오류 Modified: head/lib/libc/nls/ko_KR.eucKR.msg ============================================================================== --- head/lib/libc/nls/ko_KR.eucKR.msg Mon Nov 16 18:59:04 2009 (r199328) +++ head/lib/libc/nls/ko_KR.eucKR.msg Mon Nov 16 19:10:09 2009 (r199329) @@ -181,6 +181,16 @@ $ ENOATTR 87 ¼Ó¼ºÀ» ãÀ» ¼ö ¾ø½À´Ï´Ù $ EDOOFUS 88 ÇÁ·Î±×·¥»ó ¿À·ùÀÔ´Ï´Ù +$ EBADMSG +89 À߸øµÈ ¸Þ½ÃÁöÀÔ´Ï´Ù +$ EMULTIHOP +90 ¸ÖƼȩÀÌ ½ÃµµµÇ¾ú½À´Ï´Ù +$ ENOLINK +91 ¿¬°áÀÌ ²÷°å½À´Ï´Ù +$ EPROTO +92 ÇÁ·ÎÅäÄÝÀÌ À߸øµÇ¾ú½À´Ï´Ù +$ ENOTCAPABLE +93 Á¢±Ù ´É·ÂÀÌ ÃæºÐÄ¡ ¾Ê½À´Ï´Ù $ $ strsignal() support catalog $ @@ -230,7 +240,7 @@ $ SIGTTIN $ SIGTTOU 22 Á¤Áö (Å͹̳ΠÃâ·Â) $ SIGIO -23 I/O possible +23 I/O °¡´É $ SIGXCPU 24 CPU »ç¿ë ½Ã°£ ÃÊ°ú $ SIGXFSZ @@ -247,3 +257,39 @@ $ SIGUSR1 30 »ç¿ëÀÚ Á¤ÀÇ ½Ã±×³Î 1 $ SIGUSR2 31 »ç¿ëÀÚ Á¤ÀÇ ½Ã±×³Î 2 +$ +$ gai_strerror() support catalog +$ +$set 3 +$ 1 (obsolete) +1 È£½ºÆ® À̸§ÀÌ Áö¿øÇÏÁö ¾Ê´Â ÁÖ¼Ò±ºÀÔ´Ï´Ù +$ EAI_AGAIN +2 ÁÖ¼Ò º¯È¯¿¡ ÀϽÃÀûÀ¸·Î ½ÇÆÐÇß½À´Ï´Ù +$ EAI_BADFLAGS +3 À߸øµÈ ai_flagsÀÔ´Ï´Ù +$ EAI_FAIL +4 ÁÖ¼Ò º¯È¯¿¡ ¿ÏÀüÈ÷ ½ÇÆÐÇß½À´Ï´Ù +$ EAI_FAMILY +5 Áö¿øµÇÁö ¾Ê´Â ai_familyÀÔ´Ï´Ù +$ EAI_MEMORY +6 ¸Þ¸ð¸® ÇÒ´ç¿¡ ½ÇÆÐÇß½À´Ï´Ù +$ 7 (obsolete) +7 È£½ºÆ® À̸§°ú ÀÏÄ¡ÇÏ´Â ÁÖ¼Ò°¡ ¾ø½À´Ï´Ù +$ EAI_NONAME +8 È£½ºÆ® À̸§ ¶Ç´Â ¼­ºñ½º À̸§ÀÌ ÁöÁ¤µÇÁö ¾Ê¾Ò°Å³ª ¾Ë ¼ö ¾ø½À´Ï´Ù +$ EAI_SERVICE +9 ¼­ºñ½º À̸§Àº ai_socktype¿¡¼­ Áö¿øµÇÁö ¾Ê½À´Ï´Ù +$ EAI_SOCKTYPE +10 Áö¿øµÇÁö ¾Ê´Â ai_socktypeÀÔ´Ï´Ù +$ EAI_SYSTEM +11 ½Ã½ºÅÛ ¿À·ù°¡ errno¿¡ ¹ÝȯµÇ¾ú½À´Ï´Ù +$ EAI_BADHINTS +12 À߸øµÈ hintsÀÔ´Ï´Ù +$ EAI_PROTOCOL +13 ¾Ë ¼ö ¾ø´Â ÇÁ·ÎÅäÄÝÀÌ º¯È¯µÇ¾ú½À´Ï´Ù +$ EAI_OVERFLOW +14 ÀÎÀÚ ¹öÆÛ °ø°£ÀÌ ¸ðÀÚ¶ø´Ï´Ù +$ 0 +32766 ¼º°ø +$ NL_MSGMAX +32767 ¾Ë ¼ö ¾ø´Â ¿À·ù From owner-svn-src-head@FreeBSD.ORG Mon Nov 16 20:35:17 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 388AF10656AB; Mon, 16 Nov 2009 20:35:17 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 231E78FC2C; Mon, 16 Nov 2009 20:35:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAGKZGNh080741; Mon, 16 Nov 2009 20:35:16 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAGKZGcx080738; Mon, 16 Nov 2009 20:35:16 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200911162035.nAGKZGcx080738@svn.freebsd.org> From: Andrew Thompson Date: Mon, 16 Nov 2009 20:35: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: r199331 - in head/sys/dev/usb: . serial X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Nov 2009 20:35:17 -0000 Author: thompsa Date: Mon Nov 16 20:35:16 2009 New Revision: 199331 URL: http://svn.freebsd.org/changeset/base/199331 Log: Add the Curitel UM175 3g device. Modified: head/sys/dev/usb/serial/u3g.c head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/serial/u3g.c ============================================================================== --- head/sys/dev/usb/serial/u3g.c Mon Nov 16 20:34:53 2009 (r199330) +++ head/sys/dev/usb/serial/u3g.c Mon Nov 16 20:35:16 2009 (r199331) @@ -173,6 +173,7 @@ MODULE_DEPEND(u3g, usb, 1, 1, 1); static const struct usb_device_id u3g_devs[] = { #define U3G_DEV(v,p,i) { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i) } + U3G_DEV(CURITEL, UM175, 0), /* OEM: Option */ U3G_DEV(OPTION, GT3G, 0), U3G_DEV(OPTION, GT3GQUAD, 0), Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Mon Nov 16 20:34:53 2009 (r199330) +++ head/sys/dev/usb/usbdevs Mon Nov 16 20:35:16 2009 (r199331) @@ -1116,6 +1116,7 @@ product CTX EX1300 0x9999 Ex1300 hub product CURITEL HX550C 0x1101 CDMA 2000 1xRTT USB modem (HX-550C) product CURITEL HX57XB 0x2101 CDMA 2000 1xRTT USB modem (HX-570/575B/PR-600) product CURITEL PC5740 0x3701 Broadband Wireless modem +product CURITEL UM175 0x3714 EVDO modem /* CyberPower products */ product CYBERPOWER 1500CAVRLCD 0x0501 1500CAVRLCD From owner-svn-src-head@FreeBSD.ORG Mon Nov 16 20:36:43 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B4F06106568B; Mon, 16 Nov 2009 20:36:43 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A36B08FC08; Mon, 16 Nov 2009 20:36:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAGKahGC080827; Mon, 16 Nov 2009 20:36:43 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAGKahwk080825; Mon, 16 Nov 2009 20:36:43 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200911162036.nAGKahwk080825@svn.freebsd.org> From: Andrew Thompson Date: Mon, 16 Nov 2009 20:36: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: r199332 - head/sys/dev/usb/serial X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Nov 2009 20:36:43 -0000 Author: thompsa Date: Mon Nov 16 20:36:43 2009 New Revision: 199332 URL: http://svn.freebsd.org/changeset/base/199332 Log: Sort ID list by vendor. Modified: head/sys/dev/usb/serial/u3g.c Modified: head/sys/dev/usb/serial/u3g.c ============================================================================== --- head/sys/dev/usb/serial/u3g.c Mon Nov 16 20:35:16 2009 (r199331) +++ head/sys/dev/usb/serial/u3g.c Mon Nov 16 20:36:43 2009 (r199332) @@ -174,6 +174,10 @@ MODULE_DEPEND(u3g, usb, 1, 1, 1); static const struct usb_device_id u3g_devs[] = { #define U3G_DEV(v,p,i) { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i) } U3G_DEV(CURITEL, UM175, 0), + /* OEM: Huawei */ + U3G_DEV(HUAWEI, MOBILE, U3GFL_HUAWEI_INIT), + U3G_DEV(HUAWEI, E180V, U3GFL_HUAWEI_INIT), + U3G_DEV(HUAWEI, E220, U3GFL_HUAWEI_INIT), /* OEM: Option */ U3G_DEV(OPTION, GT3G, 0), U3G_DEV(OPTION, GT3GQUAD, 0), @@ -187,10 +191,8 @@ static const struct usb_device_id u3g_de /* OEM: Qualcomm, Inc. */ U3G_DEV(QUALCOMMINC, ZTE_STOR, U3GFL_SCSI_EJECT), U3G_DEV(QUALCOMMINC, CDMA_MSM, U3GFL_SCSI_EJECT), - /* OEM: Huawei */ - U3G_DEV(HUAWEI, MOBILE, U3GFL_HUAWEI_INIT), - U3G_DEV(HUAWEI, E180V, U3GFL_HUAWEI_INIT), - U3G_DEV(HUAWEI, E220, U3GFL_HUAWEI_INIT), + /* OEM: Merlin */ + U3G_DEV(MERLIN, V620, 0), /* OEM: Novatel */ U3G_DEV(NOVATEL, CDMA_MODEM, 0), U3G_DEV(NOVATEL, ES620, 0), @@ -209,8 +211,6 @@ static const struct usb_device_id u3g_de U3G_DEV(NOVATEL, ZEROCD, U3GFL_SCSI_EJECT), U3G_DEV(NOVATEL, U760, U3GFL_SCSI_EJECT), U3G_DEV(DELL, U740, 0), - /* OEM: Merlin */ - U3G_DEV(MERLIN, V620, 0), /* OEM: Sierra Wireless: */ U3G_DEV(SIERRA, AIRCARD580, 0), U3G_DEV(SIERRA, AIRCARD595, 0), From owner-svn-src-head@FreeBSD.ORG Mon Nov 16 20:54:48 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 333601065676; Mon, 16 Nov 2009 20:54:48 +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 2211F8FC08; Mon, 16 Nov 2009 20:54:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAGKslI1081307; Mon, 16 Nov 2009 20:54:47 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAGKslTI081305; Mon, 16 Nov 2009 20:54:47 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200911162054.nAGKslTI081305@svn.freebsd.org> From: Alexander Motin Date: Mon, 16 Nov 2009 20:54: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: r199333 - head/sys/dev/siis X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Nov 2009 20:54:48 -0000 Author: mav Date: Mon Nov 16 20:54:47 2009 New Revision: 199333 URL: http://svn.freebsd.org/changeset/base/199333 Log: Do not require payload data to be aligned. It is not mentioned in datasheet and works fine in practice. Modified: head/sys/dev/siis/siis.c Modified: head/sys/dev/siis/siis.c ============================================================================== --- head/sys/dev/siis/siis.c Mon Nov 16 20:36:43 2009 (r199332) +++ head/sys/dev/siis/siis.c Mon Nov 16 20:54:47 2009 (r199333) @@ -579,7 +579,7 @@ siis_dmainit(device_t dev) } ch->dma.work_bus = dcba.maddr; /* Data area. */ - if (bus_dma_tag_create(bus_get_dma_tag(dev), 2, 0, + if (bus_dma_tag_create(bus_get_dma_tag(dev), 1, 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, SIIS_SG_ENTRIES * PAGE_SIZE * SIIS_MAX_SLOTS, From owner-svn-src-head@FreeBSD.ORG Mon Nov 16 21:12:27 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7B943106566C; Mon, 16 Nov 2009 21:12:27 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5076D8FC08; Mon, 16 Nov 2009 21:12:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAGLCRS4081817; Mon, 16 Nov 2009 21:12:27 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAGLCRHe081814; Mon, 16 Nov 2009 21:12:27 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200911162112.nAGLCRHe081814@svn.freebsd.org> From: Edwin Groothuis Date: Mon, 16 Nov 2009 21:12: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: r199336 - head/share/zoneinfo X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Nov 2009 21:12:27 -0000 Author: edwin Date: Mon Nov 16 21:12:27 2009 New Revision: 199336 URL: http://svn.freebsd.org/changeset/base/199336 Log: MFV of tzdata2009s, r199334 - Fix (harmless) typo in the definitions of Antarctica/David - Fiji will go into DST from 29 November 2009 to 25 April 2010. MFC after: 3 days Modified: head/share/zoneinfo/antarctica head/share/zoneinfo/australasia Directory Properties: head/share/zoneinfo/ (props changed) Modified: head/share/zoneinfo/antarctica ============================================================================== --- head/share/zoneinfo/antarctica Mon Nov 16 21:07:17 2009 (r199335) +++ head/share/zoneinfo/antarctica Mon Nov 16 21:12:27 2009 (r199336) @@ -1,5 +1,5 @@ #
-# @(#)antarctica	8.6
+# @(#)antarctica	8.7
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -106,7 +106,7 @@ Zone Antarctica/Casey	0	-	zzz	1969
 Zone Antarctica/Davis	0	-	zzz	1957 Jan 13
 			7:00	-	DAVT	1964 Nov # Davis Time
 			0	-	zzz	1969 Feb
-			7:00	-	DAVT	2009 Oct 18 2:0
+			7:00	-	DAVT	2009 Oct 18 2:00
 			5:00	-	DAVT
 Zone Antarctica/Mawson	0	-	zzz	1954 Feb 13
 			6:00	-	MAWT	2009 Oct 18 2:00

Modified: head/share/zoneinfo/australasia
==============================================================================
--- head/share/zoneinfo/australasia	Mon Nov 16 21:07:17 2009	(r199335)
+++ head/share/zoneinfo/australasia	Mon Nov 16 21:12:27 2009	(r199336)
@@ -1,5 +1,5 @@
 # 
-# @(#)australasia	8.14
+# @(#)australasia	8.15
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -248,9 +248,30 @@ Zone	Indian/Cocos	6:27:40	-	LMT	1900
 			6:30	-	CCT	# Cocos Islands Time
 
 # Fiji
+# From Alexander Krivenyshev (2009-11-10):
+# According to Fiji Broadcasting Corporation,  Fiji plans to re-introduce DST
+# from November 29th 2009  to April 25th 2010.
+#
+# "Daylight savings to commence this month"
+# 
+# http://www.radiofiji.com.fj/fullstory.php?id=23719
+# 
+# or
+# 
+# http://www.worldtimezone.com/dst_news/dst_news_fiji01.html
+# 
+
+# From Steffen Thorsen (2009-11-10):
+# The Fiji Government has posted some more details about the approved
+# amendments:
+# 
+# http://www.fiji.gov.fj/publish/page_16198.shtml
+# 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Fiji	1998	1999	-	Nov	Sun>=1	2:00	1:00	S
 Rule	Fiji	1999	2000	-	Feb	lastSun	3:00	0	-
+Rule	Fiji	2009	only	-	Nov	29	2:00	1:00	S
+Rule	Fiji	2010	only	-	Apr	25	3:00	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Pacific/Fiji	11:53:40 -	LMT	1915 Oct 26	# Suva
 			12:00	Fiji	FJ%sT	# Fiji Time

From owner-svn-src-head@FreeBSD.ORG  Mon Nov 16 21:47:13 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1E54B106568D;
	Mon, 16 Nov 2009 21:47:13 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 08CCF8FC18;
	Mon, 16 Nov 2009 21:47:13 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAGLlC8h082520;
	Mon, 16 Nov 2009 21:47:12 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAGLlCRV082494;
	Mon, 16 Nov 2009 21:47:12 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <200911162147.nAGLlCRV082494@svn.freebsd.org>
From: Jung-uk Kim 
Date: Mon, 16 Nov 2009 21:47: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: r199337 - in head: sys/conf sys/contrib/dev/acpica
	sys/contrib/dev/acpica/compiler sys/contrib/dev/acpica/debugger
	sys/contrib/dev/acpica/dispatcher
	sys/contrib/dev/acpica/events sys/co...
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 16 Nov 2009 21:47:13 -0000

Author: jkim
Date: Mon Nov 16 21:47:12 2009
New Revision: 199337
URL: http://svn.freebsd.org/changeset/base/199337

Log:
  Merge ACPICA 20091112.

Added:
  head/sys/contrib/dev/acpica/namespace/nsrepair2.c
     - copied, changed from r199336, vendor-sys/acpica/dist/namespace/nsrepair2.c
Modified:
  head/sys/conf/files
  head/sys/contrib/dev/acpica/changes.txt
  head/sys/contrib/dev/acpica/compiler/aslcompile.c
  head/sys/contrib/dev/acpica/compiler/aslerror.c
  head/sys/contrib/dev/acpica/compiler/asllookup.c
  head/sys/contrib/dev/acpica/compiler/asloperands.c
  head/sys/contrib/dev/acpica/compiler/asltransform.c
  head/sys/contrib/dev/acpica/compiler/asltypes.h
  head/sys/contrib/dev/acpica/debugger/dbcmds.c
  head/sys/contrib/dev/acpica/debugger/dbexec.c
  head/sys/contrib/dev/acpica/debugger/dbstats.c
  head/sys/contrib/dev/acpica/dispatcher/dsinit.c
  head/sys/contrib/dev/acpica/dispatcher/dsmthdat.c
  head/sys/contrib/dev/acpica/dispatcher/dsobject.c
  head/sys/contrib/dev/acpica/events/evgpeblk.c
  head/sys/contrib/dev/acpica/events/evregion.c
  head/sys/contrib/dev/acpica/executer/exconfig.c
  head/sys/contrib/dev/acpica/executer/exconvrt.c
  head/sys/contrib/dev/acpica/executer/exfield.c
  head/sys/contrib/dev/acpica/executer/exoparg1.c
  head/sys/contrib/dev/acpica/executer/exoparg6.c
  head/sys/contrib/dev/acpica/executer/exregion.c
  head/sys/contrib/dev/acpica/include/acconfig.h
  head/sys/contrib/dev/acpica/include/acmacros.h
  head/sys/contrib/dev/acpica/include/acnamesp.h
  head/sys/contrib/dev/acpica/include/acpixf.h
  head/sys/contrib/dev/acpica/include/acutils.h
  head/sys/contrib/dev/acpica/namespace/nsdump.c
  head/sys/contrib/dev/acpica/namespace/nsdumpdv.c
  head/sys/contrib/dev/acpica/namespace/nseval.c
  head/sys/contrib/dev/acpica/namespace/nsinit.c
  head/sys/contrib/dev/acpica/namespace/nspredef.c
  head/sys/contrib/dev/acpica/namespace/nsrepair.c
  head/sys/contrib/dev/acpica/namespace/nswalk.c
  head/sys/contrib/dev/acpica/namespace/nsxfeval.c
  head/sys/contrib/dev/acpica/parser/psloop.c
  head/sys/contrib/dev/acpica/parser/psparse.c
  head/sys/contrib/dev/acpica/parser/psxface.c
  head/sys/contrib/dev/acpica/utilities/utmisc.c
  head/sys/contrib/dev/acpica/utilities/utobject.c
  head/sys/dev/acpica/acpi.c
  head/sys/dev/acpica/acpi_dock.c
  head/sys/dev/acpica/acpi_pci.c
  head/sys/dev/acpica/acpi_video.c
  head/usr.sbin/acpi/acpidb/Makefile
Directory Properties:
  head/sys/contrib/dev/acpica/   (props changed)

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files	Mon Nov 16 21:12:27 2009	(r199336)
+++ head/sys/conf/files	Mon Nov 16 21:47:12 2009	(r199337)
@@ -171,107 +171,108 @@ contrib/dev/acpica/dispatcher/dswexec.c	
 contrib/dev/acpica/dispatcher/dswload.c		optional acpi
 contrib/dev/acpica/dispatcher/dswscope.c	optional acpi
 contrib/dev/acpica/dispatcher/dswstate.c	optional acpi
-contrib/dev/acpica/events/evevent.c	optional acpi
-contrib/dev/acpica/events/evgpe.c	optional acpi
-contrib/dev/acpica/events/evgpeblk.c	optional acpi
-contrib/dev/acpica/events/evmisc.c	optional acpi
-contrib/dev/acpica/events/evregion.c	optional acpi
-contrib/dev/acpica/events/evrgnini.c	optional acpi
-contrib/dev/acpica/events/evsci.c	optional acpi
-contrib/dev/acpica/events/evxface.c	optional acpi
-contrib/dev/acpica/events/evxfevnt.c	optional acpi
-contrib/dev/acpica/events/evxfregn.c	optional acpi
-contrib/dev/acpica/executer/exconfig.c	optional acpi
-contrib/dev/acpica/executer/exconvrt.c	optional acpi
-contrib/dev/acpica/executer/excreate.c	optional acpi
-contrib/dev/acpica/executer/exdump.c	optional acpi
-contrib/dev/acpica/executer/exfield.c	optional acpi
-contrib/dev/acpica/executer/exfldio.c	optional acpi
-contrib/dev/acpica/executer/exmisc.c	optional acpi
-contrib/dev/acpica/executer/exmutex.c	optional acpi
-contrib/dev/acpica/executer/exnames.c	optional acpi
-contrib/dev/acpica/executer/exoparg1.c	optional acpi
-contrib/dev/acpica/executer/exoparg2.c	optional acpi
-contrib/dev/acpica/executer/exoparg3.c	optional acpi
-contrib/dev/acpica/executer/exoparg6.c	optional acpi
-contrib/dev/acpica/executer/exprep.c	optional acpi
-contrib/dev/acpica/executer/exregion.c	optional acpi
-contrib/dev/acpica/executer/exresnte.c	optional acpi
-contrib/dev/acpica/executer/exresolv.c	optional acpi
-contrib/dev/acpica/executer/exresop.c	optional acpi
-contrib/dev/acpica/executer/exstore.c	optional acpi
-contrib/dev/acpica/executer/exstoren.c	optional acpi
-contrib/dev/acpica/executer/exstorob.c	optional acpi
-contrib/dev/acpica/executer/exsystem.c	optional acpi
-contrib/dev/acpica/executer/exutils.c	optional acpi
-contrib/dev/acpica/hardware/hwacpi.c	optional acpi
-contrib/dev/acpica/hardware/hwgpe.c	optional acpi
-contrib/dev/acpica/hardware/hwregs.c	optional acpi
-contrib/dev/acpica/hardware/hwsleep.c	optional acpi
-contrib/dev/acpica/hardware/hwtimer.c	optional acpi
-contrib/dev/acpica/hardware/hwvalid.c	optional acpi
-contrib/dev/acpica/hardware/hwxface.c	optional acpi
-contrib/dev/acpica/namespace/nsaccess.c	optional acpi
-contrib/dev/acpica/namespace/nsalloc.c	optional acpi
-contrib/dev/acpica/namespace/nsdump.c	optional acpi
-contrib/dev/acpica/namespace/nseval.c	optional acpi
-contrib/dev/acpica/namespace/nsinit.c	optional acpi
-contrib/dev/acpica/namespace/nsload.c	optional acpi
-contrib/dev/acpica/namespace/nsnames.c	optional acpi
-contrib/dev/acpica/namespace/nsobject.c	optional acpi
-contrib/dev/acpica/namespace/nsparse.c	optional acpi
-contrib/dev/acpica/namespace/nspredef.c	optional acpi
-contrib/dev/acpica/namespace/nsrepair.c	optional acpi
-contrib/dev/acpica/namespace/nssearch.c	optional acpi
-contrib/dev/acpica/namespace/nsutils.c	optional acpi
-contrib/dev/acpica/namespace/nswalk.c	optional acpi
-contrib/dev/acpica/namespace/nsxfeval.c	optional acpi
-contrib/dev/acpica/namespace/nsxfname.c	optional acpi
-contrib/dev/acpica/namespace/nsxfobj.c	optional acpi
-contrib/dev/acpica/parser/psargs.c	optional acpi
-contrib/dev/acpica/parser/psloop.c	optional acpi
-contrib/dev/acpica/parser/psopcode.c	optional acpi
-contrib/dev/acpica/parser/psparse.c	optional acpi
-contrib/dev/acpica/parser/psscope.c	optional acpi
-contrib/dev/acpica/parser/pstree.c	optional acpi
-contrib/dev/acpica/parser/psutils.c	optional acpi
-contrib/dev/acpica/parser/pswalk.c	optional acpi
-contrib/dev/acpica/parser/psxface.c	optional acpi
-contrib/dev/acpica/resources/rsaddr.c	optional acpi
-contrib/dev/acpica/resources/rscalc.c	optional acpi
-contrib/dev/acpica/resources/rscreate.c	optional acpi
-contrib/dev/acpica/resources/rsdump.c	optional acpi
-contrib/dev/acpica/resources/rsinfo.c	optional acpi
-contrib/dev/acpica/resources/rsio.c	optional acpi
-contrib/dev/acpica/resources/rsirq.c	optional acpi
-contrib/dev/acpica/resources/rslist.c	optional acpi
-contrib/dev/acpica/resources/rsmemory.c	optional acpi
-contrib/dev/acpica/resources/rsmisc.c	optional acpi
-contrib/dev/acpica/resources/rsutils.c	optional acpi
-contrib/dev/acpica/resources/rsxface.c	optional acpi
-contrib/dev/acpica/tables/tbfadt.c	optional acpi
-contrib/dev/acpica/tables/tbfind.c	optional acpi
-contrib/dev/acpica/tables/tbinstal.c	optional acpi
-contrib/dev/acpica/tables/tbutils.c	optional acpi
-contrib/dev/acpica/tables/tbxface.c	optional acpi
-contrib/dev/acpica/tables/tbxfroot.c	optional acpi
-contrib/dev/acpica/utilities/utalloc.c	optional acpi
-contrib/dev/acpica/utilities/utcache.c	optional acpi
-contrib/dev/acpica/utilities/utcopy.c	optional acpi
-contrib/dev/acpica/utilities/utdebug.c	optional acpi
-contrib/dev/acpica/utilities/utdelete.c	optional acpi
-contrib/dev/acpica/utilities/uteval.c	optional acpi
-contrib/dev/acpica/utilities/utglobal.c	optional acpi
-contrib/dev/acpica/utilities/utids.c	optional acpi
-contrib/dev/acpica/utilities/utinit.c	optional acpi
-contrib/dev/acpica/utilities/utlock.c	optional acpi
-contrib/dev/acpica/utilities/utmath.c	optional acpi
-contrib/dev/acpica/utilities/utmisc.c	optional acpi
-contrib/dev/acpica/utilities/utmutex.c	optional acpi
-contrib/dev/acpica/utilities/utobject.c	optional acpi
-contrib/dev/acpica/utilities/utresrc.c	optional acpi
-contrib/dev/acpica/utilities/utstate.c	optional acpi
-contrib/dev/acpica/utilities/utxface.c	optional acpi
+contrib/dev/acpica/events/evevent.c		optional acpi
+contrib/dev/acpica/events/evgpe.c		optional acpi
+contrib/dev/acpica/events/evgpeblk.c		optional acpi
+contrib/dev/acpica/events/evmisc.c		optional acpi
+contrib/dev/acpica/events/evregion.c		optional acpi
+contrib/dev/acpica/events/evrgnini.c		optional acpi
+contrib/dev/acpica/events/evsci.c		optional acpi
+contrib/dev/acpica/events/evxface.c		optional acpi
+contrib/dev/acpica/events/evxfevnt.c		optional acpi
+contrib/dev/acpica/events/evxfregn.c		optional acpi
+contrib/dev/acpica/executer/exconfig.c		optional acpi
+contrib/dev/acpica/executer/exconvrt.c		optional acpi
+contrib/dev/acpica/executer/excreate.c		optional acpi
+contrib/dev/acpica/executer/exdump.c		optional acpi
+contrib/dev/acpica/executer/exfield.c		optional acpi
+contrib/dev/acpica/executer/exfldio.c		optional acpi
+contrib/dev/acpica/executer/exmisc.c		optional acpi
+contrib/dev/acpica/executer/exmutex.c		optional acpi
+contrib/dev/acpica/executer/exnames.c		optional acpi
+contrib/dev/acpica/executer/exoparg1.c		optional acpi
+contrib/dev/acpica/executer/exoparg2.c		optional acpi
+contrib/dev/acpica/executer/exoparg3.c		optional acpi
+contrib/dev/acpica/executer/exoparg6.c		optional acpi
+contrib/dev/acpica/executer/exprep.c		optional acpi
+contrib/dev/acpica/executer/exregion.c		optional acpi
+contrib/dev/acpica/executer/exresnte.c		optional acpi
+contrib/dev/acpica/executer/exresolv.c		optional acpi
+contrib/dev/acpica/executer/exresop.c		optional acpi
+contrib/dev/acpica/executer/exstore.c		optional acpi
+contrib/dev/acpica/executer/exstoren.c		optional acpi
+contrib/dev/acpica/executer/exstorob.c		optional acpi
+contrib/dev/acpica/executer/exsystem.c		optional acpi
+contrib/dev/acpica/executer/exutils.c		optional acpi
+contrib/dev/acpica/hardware/hwacpi.c		optional acpi
+contrib/dev/acpica/hardware/hwgpe.c		optional acpi
+contrib/dev/acpica/hardware/hwregs.c		optional acpi
+contrib/dev/acpica/hardware/hwsleep.c		optional acpi
+contrib/dev/acpica/hardware/hwtimer.c		optional acpi
+contrib/dev/acpica/hardware/hwvalid.c		optional acpi
+contrib/dev/acpica/hardware/hwxface.c		optional acpi
+contrib/dev/acpica/namespace/nsaccess.c		optional acpi
+contrib/dev/acpica/namespace/nsalloc.c		optional acpi
+contrib/dev/acpica/namespace/nsdump.c		optional acpi
+contrib/dev/acpica/namespace/nseval.c		optional acpi
+contrib/dev/acpica/namespace/nsinit.c		optional acpi
+contrib/dev/acpica/namespace/nsload.c		optional acpi
+contrib/dev/acpica/namespace/nsnames.c		optional acpi
+contrib/dev/acpica/namespace/nsobject.c		optional acpi
+contrib/dev/acpica/namespace/nsparse.c		optional acpi
+contrib/dev/acpica/namespace/nspredef.c		optional acpi
+contrib/dev/acpica/namespace/nsrepair.c		optional acpi
+contrib/dev/acpica/namespace/nsrepair2.c	optional acpi
+contrib/dev/acpica/namespace/nssearch.c		optional acpi
+contrib/dev/acpica/namespace/nsutils.c		optional acpi
+contrib/dev/acpica/namespace/nswalk.c		optional acpi
+contrib/dev/acpica/namespace/nsxfeval.c		optional acpi
+contrib/dev/acpica/namespace/nsxfname.c		optional acpi
+contrib/dev/acpica/namespace/nsxfobj.c		optional acpi
+contrib/dev/acpica/parser/psargs.c		optional acpi
+contrib/dev/acpica/parser/psloop.c		optional acpi
+contrib/dev/acpica/parser/psopcode.c		optional acpi
+contrib/dev/acpica/parser/psparse.c		optional acpi
+contrib/dev/acpica/parser/psscope.c		optional acpi
+contrib/dev/acpica/parser/pstree.c		optional acpi
+contrib/dev/acpica/parser/psutils.c		optional acpi
+contrib/dev/acpica/parser/pswalk.c		optional acpi
+contrib/dev/acpica/parser/psxface.c		optional acpi
+contrib/dev/acpica/resources/rsaddr.c		optional acpi
+contrib/dev/acpica/resources/rscalc.c		optional acpi
+contrib/dev/acpica/resources/rscreate.c		optional acpi
+contrib/dev/acpica/resources/rsdump.c		optional acpi
+contrib/dev/acpica/resources/rsinfo.c		optional acpi
+contrib/dev/acpica/resources/rsio.c		optional acpi
+contrib/dev/acpica/resources/rsirq.c		optional acpi
+contrib/dev/acpica/resources/rslist.c		optional acpi
+contrib/dev/acpica/resources/rsmemory.c		optional acpi
+contrib/dev/acpica/resources/rsmisc.c		optional acpi
+contrib/dev/acpica/resources/rsutils.c		optional acpi
+contrib/dev/acpica/resources/rsxface.c		optional acpi
+contrib/dev/acpica/tables/tbfadt.c		optional acpi
+contrib/dev/acpica/tables/tbfind.c		optional acpi
+contrib/dev/acpica/tables/tbinstal.c		optional acpi
+contrib/dev/acpica/tables/tbutils.c		optional acpi
+contrib/dev/acpica/tables/tbxface.c		optional acpi
+contrib/dev/acpica/tables/tbxfroot.c		optional acpi
+contrib/dev/acpica/utilities/utalloc.c		optional acpi
+contrib/dev/acpica/utilities/utcache.c		optional acpi
+contrib/dev/acpica/utilities/utcopy.c		optional acpi
+contrib/dev/acpica/utilities/utdebug.c		optional acpi
+contrib/dev/acpica/utilities/utdelete.c		optional acpi
+contrib/dev/acpica/utilities/uteval.c		optional acpi
+contrib/dev/acpica/utilities/utglobal.c		optional acpi
+contrib/dev/acpica/utilities/utids.c		optional acpi
+contrib/dev/acpica/utilities/utinit.c		optional acpi
+contrib/dev/acpica/utilities/utlock.c		optional acpi
+contrib/dev/acpica/utilities/utmath.c		optional acpi
+contrib/dev/acpica/utilities/utmisc.c		optional acpi
+contrib/dev/acpica/utilities/utmutex.c		optional acpi
+contrib/dev/acpica/utilities/utobject.c		optional acpi
+contrib/dev/acpica/utilities/utresrc.c		optional acpi
+contrib/dev/acpica/utilities/utstate.c		optional acpi
+contrib/dev/acpica/utilities/utxface.c		optional acpi
 contrib/ipfilter/netinet/fil.c	optional ipfilter inet \
 	compile-with "${NORMAL_C} -I$S/contrib/ipfilter"
 contrib/ipfilter/netinet/ip_auth.c optional ipfilter inet \

Modified: head/sys/contrib/dev/acpica/changes.txt
==============================================================================
--- head/sys/contrib/dev/acpica/changes.txt	Mon Nov 16 21:12:27 2009	(r199336)
+++ head/sys/contrib/dev/acpica/changes.txt	Mon Nov 16 21:47:12 2009	(r199337)
@@ -1,4 +1,77 @@
 ----------------------------------------
+12 November 2009. Summary of changes for version 20091112:
+
+This release is available at www.acpica.org/downloads
+
+1) ACPI CA Core Subsystem:
+
+Implemented a post-order callback to AcpiWalkNamespace. The existing 
+interface only has a pre-order callback. This change adds an additional 
+parameter for a post-order callback which will be more useful for bus scans. 
+ACPICA BZ 779. Lin Ming. Updated the ACPICA Programmer Reference.
+
+Modified the behavior of the operation region memory mapping cache for 
+SystemMemory. Ensure that the memory mappings created for operation regions 
+do not cross 4K page boundaries. Crossing a page boundary while mapping 
+regions can cause kernel warnings on some hosts if the pages have different 
+attributes. Such regions are probably BIOS bugs, and this is the workaround. 
+Linux BZ 14445. Lin Ming.
+
+Implemented an automatic repair for predefined methods that must return 
+sorted lists. This change will repair (by sorting) packages returned by _ALR, 
+_PSS, and _TSS. Drivers can now assume that the packages are correctly sorted 
+and do not contain NULL package elements. Adds one new file, 
+namespace/nsrepair2.c. ACPICA BZ 784. Lin Ming, Bob Moore.
+
+Fixed a possible fault during predefined name validation if a return Package 
+object contains NULL elements. Also adds a warning if a NULL element is 
+followed by any non-null elements. ACPICA BZ 813, 814. Future enhancement may 
+include repair or removal of all such NULL elements where possible.
+
+Implemented additional module-level executable AML code support. This change 
+will execute module-level code that is not at the root of the namespace 
+(under a Device object, etc.) at table load time. Module-level executable AML 
+code has been illegal since ACPI 2.0. ACPICA BZ 762. Lin Ming.
+
+Implemented a new internal function to create Integer objects. This function 
+simplifies miscellaneous object creation code. ACPICA BZ 823.
+
+Reduced the severity of predefined repair messages, Warning to Info. Since 
+the object was successfully repaired, a warning is too severe. Reduced to an 
+info message for now. These messages may eventually be changed to debug-only. 
+ACPICA BZ 812.
+
+Example Code and Data Size: These are the sizes for the OS-independent 
+acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. The 
+debug version of the code includes the debug output trace mechanism and has a 
+much larger code and data size.
+
+  Previous Release:
+    Non-Debug Version:  85.8K Code, 18.0K Data, 103.8K Total
+    Debug Version:     161.8K Code, 50.6K Data, 212.4K Total
+  Current Release:
+    Non-Debug Version:  86.6K Code, 18.2K Data, 104.8K Total
+    Debug Version:     162.7K Code, 50.8K Data, 213.5K Total
+
+2) iASL Compiler/Disassembler and Tools:
+
+iASL: Implemented Switch() with While(1) so that Break works correctly. This 
+change correctly implements the Switch operator with a surrounding While(1) 
+so that the Break operator works as expected. ACPICA BZ 461. Lin Ming.
+
+iASL: Added a message if a package initializer list is shorter than package 
+length. Adds a new remark for a Package() declaration if an initializer list 
+exists, but is shorter than the declared length of the package. Although 
+technically legal, this is probably a coding error and it is seen in the 
+field. ACPICA BZ 815. Lin Ming, Bob Moore.
+
+iASL: Fixed a problem where the compiler could fault after the maximum number 
+of errors was reached (200).
+
+acpixtract: Fixed a possible warning for pointer cast if the compiler warning 
+level set very high.
+
+----------------------------------------
 13 October 2009. Summary of changes for version 20091013:
 
 This release is available at www.acpica.org/downloads

Modified: head/sys/contrib/dev/acpica/compiler/aslcompile.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslcompile.c	Mon Nov 16 21:12:27 2009	(r199336)
+++ head/sys/contrib/dev/acpica/compiler/aslcompile.c	Mon Nov 16 21:47:12 2009	(r199337)
@@ -895,13 +895,6 @@ CmCleanupAndExit (
                         10) / Gbl_NsLookupCount);
     }
 
-    /* Close all open files */
-
-    for (i = 2; i < ASL_MAX_FILE_TYPE; i++)
-    {
-        FlCloseFile (i);
-    }
-
     /*
      * TBD: SourceOutput should be .TMP, then rename if we want to keep it?
      */
@@ -923,6 +916,13 @@ CmCleanupAndExit (
     }
 
     UtDisplaySummary (ASL_FILE_STDOUT);
+
+    /* Close all open files */
+
+    for (i = 2; i < ASL_MAX_FILE_TYPE; i++)
+    {
+        FlCloseFile (i);
+    }
 }
 
 

Modified: head/sys/contrib/dev/acpica/compiler/aslerror.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/aslerror.c	Mon Nov 16 21:12:27 2009	(r199336)
+++ head/sys/contrib/dev/acpica/compiler/aslerror.c	Mon Nov 16 21:47:12 2009	(r199337)
@@ -535,6 +535,7 @@ AslCommonError (
         Gbl_NextError = Gbl_ErrorLog;
         CmDoOutputFiles ();
         CmCleanupAndExit ();
+        exit(1);
     }
 
     return;

Modified: head/sys/contrib/dev/acpica/compiler/asllookup.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/asllookup.c	Mon Nov 16 21:12:27 2009	(r199336)
+++ head/sys/contrib/dev/acpica/compiler/asllookup.c	Mon Nov 16 21:47:12 2009	(r199337)
@@ -526,7 +526,7 @@ LsDisplayNamespace (
     /* Walk entire namespace from the root */
 
     Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
-                ACPI_UINT32_MAX, FALSE, LsDoOneNamespaceObject,
+                ACPI_UINT32_MAX, FALSE, LsDoOneNamespaceObject, NULL,
                 NULL, NULL);
 
     /* Print the full pathname for each namespace node */
@@ -534,7 +534,7 @@ LsDisplayNamespace (
     FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "\nNamespace pathnames\n\n");
 
     Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
-                ACPI_UINT32_MAX, FALSE, LsDoOnePathname,
+                ACPI_UINT32_MAX, FALSE, LsDoOnePathname, NULL,
                 NULL, NULL);
 
     return (Status);
@@ -598,7 +598,7 @@ LkObjectExists (
     /* Walk entire namespace from the supplied root */
 
     Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
-                ACPI_UINT32_MAX, FALSE, LsCompareOneNamespaceObject,
+                ACPI_UINT32_MAX, FALSE, LsCompareOneNamespaceObject, NULL,
                 Name, NULL);
     if (Status == AE_CTRL_TRUE)
     {
@@ -753,7 +753,7 @@ LkFindUnreferencedObjects (
     /* Walk entire namespace from the supplied root */
 
     (void) AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
-                ACPI_UINT32_MAX, FALSE, LkIsObjectUsed,
+                ACPI_UINT32_MAX, FALSE, LkIsObjectUsed, NULL,
                 NULL, NULL);
 }
 

Modified: head/sys/contrib/dev/acpica/compiler/asloperands.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/asloperands.c	Mon Nov 16 21:12:27 2009	(r199336)
+++ head/sys/contrib/dev/acpica/compiler/asloperands.c	Mon Nov 16 21:47:12 2009	(r199337)
@@ -788,20 +788,30 @@ OpnDoPackage (
     if ((PackageLengthOp->Asl.ParseOpcode == PARSEOP_INTEGER)      ||
         (PackageLengthOp->Asl.ParseOpcode == PARSEOP_QWORDCONST))
     {
-        if (PackageLengthOp->Asl.Value.Integer >= PackageLength)
+        if (PackageLengthOp->Asl.Value.Integer > PackageLength)
         {
-            /* Allow package to be longer than the initializer list */
+            /*
+             * Allow package length to be longer than the initializer
+             * list -- but if the length of initializer list is nonzero,
+             * issue a message since this is probably a coding error,
+             * even though technically legal.
+             */
+            if (PackageLength > 0)
+            {
+                AslError (ASL_REMARK, ASL_MSG_LIST_LENGTH_SHORT,
+                    PackageLengthOp, NULL);
+            }
 
             PackageLength = (UINT32) PackageLengthOp->Asl.Value.Integer;
         }
-        else
+        else if (PackageLengthOp->Asl.Value.Integer < PackageLength)
         {
             /*
-             * Initializer list is longer than the package length. This
-             * is an error as per the ACPI spec.
+             * The package length is smaller than the length of the
+             * initializer list. This is an error as per the ACPI spec.
              */
-            AslError (ASL_ERROR, ASL_MSG_LIST_LENGTH,
-                PackageLengthOp->Asl.Next, NULL);
+            AslError (ASL_ERROR, ASL_MSG_LIST_LENGTH_LONG,
+                PackageLengthOp, NULL);
         }
     }
 

Modified: head/sys/contrib/dev/acpica/compiler/asltransform.c
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/asltransform.c	Mon Nov 16 21:12:27 2009	(r199336)
+++ head/sys/contrib/dev/acpica/compiler/asltransform.c	Mon Nov 16 21:47:12 2009	(r199337)
@@ -468,6 +468,8 @@ TrDoSwitch (
     ACPI_PARSE_OBJECT       *NewOp;
     ACPI_PARSE_OBJECT       *NewOp2;
     ACPI_PARSE_OBJECT       *MethodOp;
+    ACPI_PARSE_OBJECT       *StoreOp;
+    ACPI_PARSE_OBJECT       *BreakOp;
     char                    *PredicateValueName;
     UINT16                  Index;
     UINT32                  Btype;
@@ -638,11 +640,7 @@ TrDoSwitch (
              */
             if (CurrentParentNode == StartNode)
             {
-                Conditional->Asl.Parent = CurrentParentNode->Asl.Parent;
-
-                /* Link IF into the peer list */
-
-                TrAmlInsertPeer (CurrentParentNode, Conditional);
+                Conditional->Asl.Next = NULL;
             }
             else
             {
@@ -695,6 +693,7 @@ TrDoSwitch (
             {
                 return;
             }
+
             TrAmlInitNode (DefaultOp, PARSEOP_ELSE);
             DefaultOp->Asl.Parent = Conditional->Asl.Parent;
 
@@ -799,22 +798,44 @@ TrDoSwitch (
     TrAmlSetSubtreeParent (NewOp2, NewOp);
 
     /*
-     * Transform the Switch() into a Store() node which will be used to save the
+     * Transform the Switch() into a While(One)-Break node.
+     * And create a Store() node which will be used to save the
      * Switch() value.  The store is of the form: Store (Value, _T_x)
      * where _T_x is the temp variable.
      */
-    TrAmlInitNode (StartNode, PARSEOP_STORE);
-    StartNode->Asl.Child = NULL;
+    TrAmlInitNode (StartNode, PARSEOP_WHILE);
+    NewOp = TrCreateLeafNode (PARSEOP_ONE);
+    NewOp->Asl.Next = Predicate->Asl.Next;
+    NewOp->Asl.Parent = StartNode;
+    StartNode->Asl.Child = NewOp;
+
+    /* Create a Store() node */
+
+    StoreOp = TrCreateLeafNode (PARSEOP_STORE);
+    StoreOp->Asl.Parent = StartNode;
+    TrAmlInsertPeer (NewOp, StoreOp);
 
     /* Complete the Store subtree */
 
-    StartNode->Asl.Child = Predicate;
-    Predicate->Asl.Parent = StartNode;
+    StoreOp->Asl.Child = Predicate;
+    Predicate->Asl.Parent = StoreOp;
 
     NewOp = TrCreateValuedLeafNode (PARSEOP_NAMESEG,
                 (ACPI_INTEGER) ACPI_TO_INTEGER (PredicateValueName));
-    NewOp->Asl.Parent    = StartNode;
+    NewOp->Asl.Parent    = StoreOp;
     Predicate->Asl.Next  = NewOp;
+
+    /* Create a Break() node and insert it into the end of While() */
+
+    Conditional = StartNode->Asl.Child;
+    while (Conditional->Asl.Next)
+    {
+        Conditional = Conditional->Asl.Next;
+    }
+
+    BreakOp = TrCreateLeafNode (PARSEOP_BREAK);
+    BreakOp->Asl.Parent = StartNode;
+    TrAmlInsertPeer (Conditional, BreakOp);
 }
 
 

Modified: head/sys/contrib/dev/acpica/compiler/asltypes.h
==============================================================================
--- head/sys/contrib/dev/acpica/compiler/asltypes.h	Mon Nov 16 21:12:27 2009	(r199336)
+++ head/sys/contrib/dev/acpica/compiler/asltypes.h	Mon Nov 16 21:47:12 2009	(r199337)
@@ -369,7 +369,8 @@ typedef enum
     ASL_MSG_INVALID_TIME,
     ASL_MSG_INVALID_TYPE,
     ASL_MSG_INVALID_UUID,
-    ASL_MSG_LIST_LENGTH,
+    ASL_MSG_LIST_LENGTH_LONG,
+    ASL_MSG_LIST_LENGTH_SHORT,
     ASL_MSG_LISTING_FILE_OPEN,
     ASL_MSG_LISTING_FILENAME,
     ASL_MSG_LOCAL_INIT,
@@ -488,7 +489,8 @@ char                        *AslMessages
 /*    ASL_MSG_INVALID_TIME */               "Time parameter too long (255 max)",
 /*    ASL_MSG_INVALID_TYPE */               "Invalid type",
 /*    ASL_MSG_INVALID_UUID */               "UUID string must be of the form \"aabbccdd-eeff-gghh-iijj-kkllmmnnoopp\"",
-/*    ASL_MSG_LIST_LENGTH */                "Initializer list too long",
+/*    ASL_MSG_LIST_LENGTH_LONG */           "Initializer list longer than declared package length",
+/*    ASL_MSG_LIST_LENGTH_SHORT */          "Initializer list shorter than declared package length",
 /*    ASL_MSG_LISTING_FILE_OPEN */          "Could not open listing file",
 /*    ASL_MSG_LISTING_FILENAME */           "Could not create listing filename",
 /*    ASL_MSG_LOCAL_INIT */                 "Method local variable is not initialized",

Modified: head/sys/contrib/dev/acpica/debugger/dbcmds.c
==============================================================================
--- head/sys/contrib/dev/acpica/debugger/dbcmds.c	Mon Nov 16 21:12:27 2009	(r199336)
+++ head/sys/contrib/dev/acpica/debugger/dbcmds.c	Mon Nov 16 21:47:12 2009	(r199337)
@@ -383,7 +383,7 @@ AcpiDbFindReferences (
     /* Search all nodes in namespace */
 
     (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
-                    AcpiDbWalkForReferences, (void *) ObjDesc, NULL);
+                    AcpiDbWalkForReferences, NULL, (void *) ObjDesc, NULL);
 }
 
 
@@ -475,7 +475,7 @@ AcpiDbCheckPredefinedNames (
     /* Search all nodes in namespace */
 
     (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
-                AcpiDbWalkForPredefinedNames, (void *) &Count, NULL);
+                AcpiDbWalkForPredefinedNames, NULL, (void *) &Count, NULL);
 
     AcpiOsPrintf ("Found %d predefined names in the namespace\n", Count);
 }
@@ -617,7 +617,7 @@ AcpiDbBatchExecute (
     /* Search all nodes in namespace */
 
     (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
-                AcpiDbWalkForExecute, (void *) &Info, NULL);
+                AcpiDbWalkForExecute, NULL, (void *) &Info, NULL);
 
     AcpiOsPrintf ("Executed %d predefined names in the namespace\n", Info.Count);
 }
@@ -1165,15 +1165,13 @@ AcpiDbSetMethodData (
 
     /* Create and initialize the new object */
 
-    ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+    ObjDesc = AcpiUtCreateIntegerObject ((UINT64) Value);
     if (!ObjDesc)
     {
         AcpiOsPrintf ("Could not create an internal object\n");
         return;
     }
 
-    ObjDesc->Integer.Value = Value;
-
     /* Store the new object into the target */
 
     switch (Type)
@@ -1325,7 +1323,7 @@ AcpiDbDisplayObjects (
     /* Walk the namespace from the root */
 
     (void) AcpiWalkNamespace (Type, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
-                AcpiDbWalkForSpecificObjects, (void *) &Info, NULL);
+                AcpiDbWalkForSpecificObjects, NULL, (void *) &Info, NULL);
 
     AcpiOsPrintf (
         "\nFound %u objects of type [%s] in the current ACPI Namespace\n",
@@ -1441,7 +1439,7 @@ AcpiDbFindNameInNamespace (
     /* Walk the namespace from the root */
 
     (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
-                        AcpiDbWalkAndMatchName, AcpiName, NULL);
+                        AcpiDbWalkAndMatchName, NULL, AcpiName, NULL);
 
     AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
     return (AE_OK);
@@ -1942,7 +1940,7 @@ AcpiDbCheckIntegrity (
     /* Search all nodes in namespace */
 
     (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
-                    AcpiDbIntegrityWalk, (void *) &Info, NULL);
+                    AcpiDbIntegrityWalk, NULL, (void *) &Info, NULL);
 
     AcpiOsPrintf ("Verified %d namespace nodes with %d Objects\n",
         Info.Nodes, Info.Objects);
@@ -2129,7 +2127,7 @@ AcpiDbGetBusInfo (
     /* Search all nodes in namespace */
 
     (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
-                    AcpiDbBusWalk, NULL, NULL);
+                    AcpiDbBusWalk, NULL, NULL, NULL);
 }
 
 #endif /* ACPI_DEBUGGER */

Modified: head/sys/contrib/dev/acpica/debugger/dbexec.c
==============================================================================
--- head/sys/contrib/dev/acpica/debugger/dbexec.c	Mon Nov 16 21:12:27 2009	(r199336)
+++ head/sys/contrib/dev/acpica/debugger/dbexec.c	Mon Nov 16 21:47:12 2009	(r199337)
@@ -453,7 +453,7 @@ AcpiDbExecute (
     if (*Name == '*')
     {
         (void) AcpiWalkNamespace (ACPI_TYPE_METHOD, ACPI_ROOT_OBJECT,
-                    ACPI_UINT32_MAX, AcpiDbExecutionWalk, NULL, NULL);
+                    ACPI_UINT32_MAX, AcpiDbExecutionWalk, NULL, NULL, NULL);
         return;
     }
     else

Modified: head/sys/contrib/dev/acpica/debugger/dbstats.c
==============================================================================
--- head/sys/contrib/dev/acpica/debugger/dbstats.c	Mon Nov 16 21:12:27 2009	(r199336)
+++ head/sys/contrib/dev/acpica/debugger/dbstats.c	Mon Nov 16 21:47:12 2009	(r199337)
@@ -446,7 +446,7 @@ AcpiDbCountNamespaceObjects (
     }
 
     (void) AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
-                ACPI_UINT32_MAX, FALSE, AcpiDbClassifyOneObject, NULL, NULL);
+                ACPI_UINT32_MAX, FALSE, AcpiDbClassifyOneObject, NULL, NULL, NULL);
 }
 
 

Modified: head/sys/contrib/dev/acpica/dispatcher/dsinit.c
==============================================================================
--- head/sys/contrib/dev/acpica/dispatcher/dsinit.c	Mon Nov 16 21:12:27 2009	(r199336)
+++ head/sys/contrib/dev/acpica/dispatcher/dsinit.c	Mon Nov 16 21:47:12 2009	(r199337)
@@ -283,7 +283,7 @@ AcpiDsInitializeObjects (
      * the namespace reader lock.
      */
     Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, StartNode, ACPI_UINT32_MAX,
-                ACPI_NS_WALK_UNLOCK, AcpiDsInitOneObject, &Info, NULL);
+                ACPI_NS_WALK_UNLOCK, AcpiDsInitOneObject, NULL, &Info, NULL);
     if (ACPI_FAILURE (Status))
     {
         ACPI_EXCEPTION ((AE_INFO, Status, "During WalkNamespace"));

Modified: head/sys/contrib/dev/acpica/dispatcher/dsmthdat.c
==============================================================================
--- head/sys/contrib/dev/acpica/dispatcher/dsmthdat.c	Mon Nov 16 21:12:27 2009	(r199336)
+++ head/sys/contrib/dev/acpica/dispatcher/dsmthdat.c	Mon Nov 16 21:47:12 2009	(r199337)
@@ -524,13 +524,12 @@ AcpiDsMethodDataGetValue (
 
         if (AcpiGbl_EnableInterpreterSlack)
         {
-            Object = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+            Object = AcpiUtCreateIntegerObject ((UINT64) 0);
             if (!Object)
             {
                 return_ACPI_STATUS (AE_NO_MEMORY);
             }
 
-            Object->Integer.Value = 0;
             Node->Object = Object;
         }
 

Modified: head/sys/contrib/dev/acpica/dispatcher/dsobject.c
==============================================================================
--- head/sys/contrib/dev/acpica/dispatcher/dsobject.c	Mon Nov 16 21:12:27 2009	(r199336)
+++ head/sys/contrib/dev/acpica/dispatcher/dsobject.c	Mon Nov 16 21:47:12 2009	(r199337)
@@ -574,7 +574,7 @@ AcpiDsBuildInternalPackageObj (
          *
          * Note: technically, this is an error, from ACPI spec: "It is an error
          * for NumElements to be less than the number of elements in the
-         * PackageList". However, we just print an error message and
+         * PackageList". However, we just print a message and
          * no exception is returned. This provides Windows compatibility. Some
          * BIOSs will alter the NumElements on the fly, creating this type
          * of ill-formed package object.
@@ -598,8 +598,8 @@ AcpiDsBuildInternalPackageObj (
             Arg = Arg->Common.Next;
         }
 
-        ACPI_ERROR ((AE_INFO,
-            "Package List length (0x%X) larger than NumElements count (0x%X), truncated\n",
+        ACPI_INFO ((AE_INFO,
+            "Actual Package length (0x%X) is larger than NumElements field (0x%X), truncated\n",
             i, ElementCount));
     }
     else if (i < ElementCount)

Modified: head/sys/contrib/dev/acpica/events/evgpeblk.c
==============================================================================
--- head/sys/contrib/dev/acpica/events/evgpeblk.c	Mon Nov 16 21:12:27 2009	(r199336)
+++ head/sys/contrib/dev/acpica/events/evgpeblk.c	Mon Nov 16 21:47:12 2009	(r199337)
@@ -1110,7 +1110,7 @@ AcpiEvCreateGpeBlock (
 
     Status = AcpiNsWalkNamespace (ACPI_TYPE_METHOD, GpeDevice,
                 ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
-                AcpiEvSaveMethodInfo, GpeBlock, NULL);
+                AcpiEvSaveMethodInfo, NULL, GpeBlock, NULL);
 
     /* Return the new block */
 
@@ -1192,7 +1192,7 @@ AcpiEvInitializeGpeBlock (
 
         Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
                     ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK,
-                    AcpiEvMatchPrwAndGpe, &GpeInfo, NULL);
+                    AcpiEvMatchPrwAndGpe, NULL, &GpeInfo, NULL);
     }
 
     /*

Modified: head/sys/contrib/dev/acpica/events/evregion.c
==============================================================================
--- head/sys/contrib/dev/acpica/events/evregion.c	Mon Nov 16 21:12:27 2009	(r199336)
+++ head/sys/contrib/dev/acpica/events/evregion.c	Mon Nov 16 21:47:12 2009	(r199337)
@@ -400,25 +400,21 @@ AcpiEvExecuteRegMethod (
      *  connection status 1 for connecting the handler, 0 for disconnecting
      *  the handler (Passed as a parameter)
      */
-    Args[0] = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+    Args[0] = AcpiUtCreateIntegerObject ((UINT64) RegionObj->Region.SpaceId);
     if (!Args[0])
     {
         Status = AE_NO_MEMORY;
         goto Cleanup1;
     }
 
-    Args[1] = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+    Args[1] = AcpiUtCreateIntegerObject ((UINT64) Function);
     if (!Args[1])
     {
         Status = AE_NO_MEMORY;
         goto Cleanup2;
     }
 
-    /* Setup the parameter objects */
-
-    Args[0]->Integer.Value = RegionObj->Region.SpaceId;
-    Args[1]->Integer.Value = Function;
-    Args[2] = NULL;
+    Args[2] = NULL; /* Terminate list */
 
     /* Execute the method, no return value */
 
@@ -1173,7 +1169,7 @@ AcpiEvInstallSpaceHandler (
      * of the branch
      */
     Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, Node, ACPI_UINT32_MAX,
-                ACPI_NS_WALK_UNLOCK, AcpiEvInstallHandler,
+                ACPI_NS_WALK_UNLOCK, AcpiEvInstallHandler, NULL,
                 HandlerObj, NULL);
 
 UnlockAndExit:
@@ -1213,7 +1209,7 @@ AcpiEvExecuteRegMethods (
      * regions of this Space ID before we can run any _REG methods)
      */
     Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, Node, ACPI_UINT32_MAX,
-                ACPI_NS_WALK_UNLOCK, AcpiEvRegRun,
+                ACPI_NS_WALK_UNLOCK, AcpiEvRegRun, NULL,
                 &SpaceId, NULL);
 
     return_ACPI_STATUS (Status);

Modified: head/sys/contrib/dev/acpica/executer/exconfig.c
==============================================================================
--- head/sys/contrib/dev/acpica/executer/exconfig.c	Mon Nov 16 21:12:27 2009	(r199336)
+++ head/sys/contrib/dev/acpica/executer/exconfig.c	Mon Nov 16 21:47:12 2009	(r199337)
@@ -263,15 +263,13 @@ AcpiExLoadTableOp (
 
         /* Table not found, return an Integer=0 and AE_OK */
 
-        DdbHandle = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+        DdbHandle = AcpiUtCreateIntegerObject ((UINT64) 0);
         if (!DdbHandle)
         {
             return_ACPI_STATUS (AE_NO_MEMORY);
         }
 
-        DdbHandle->Integer.Value = 0;
         *ReturnDesc = DdbHandle;
-
         return_ACPI_STATUS (AE_OK);
     }
 

Modified: head/sys/contrib/dev/acpica/executer/exconvrt.c
==============================================================================
--- head/sys/contrib/dev/acpica/executer/exconvrt.c	Mon Nov 16 21:12:27 2009	(r199336)
+++ head/sys/contrib/dev/acpica/executer/exconvrt.c	Mon Nov 16 21:47:12 2009	(r199337)
@@ -260,7 +260,7 @@ AcpiExConvertToInteger (
 
     /* Create a new integer */
 
-    ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+    ReturnDesc = AcpiUtCreateIntegerObject (Result);
     if (!ReturnDesc)
     {
         return_ACPI_STATUS (AE_NO_MEMORY);
@@ -271,7 +271,6 @@ AcpiExConvertToInteger (
 
     /* Save the Result */
 
-    ReturnDesc->Integer.Value = Result;
     AcpiExTruncateFor32bitTable (ReturnDesc);
     *ResultDesc = ReturnDesc;
     return_ACPI_STATUS (AE_OK);

Modified: head/sys/contrib/dev/acpica/executer/exfield.c
==============================================================================
--- head/sys/contrib/dev/acpica/executer/exfield.c	Mon Nov 16 21:12:27 2009	(r199336)
+++ head/sys/contrib/dev/acpica/executer/exfield.c	Mon Nov 16 21:47:12 2009	(r199337)
@@ -249,14 +249,13 @@ AcpiExReadDataFromField (
     {
         /* Field will fit within an Integer (normal case) */
 
-        BufferDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+        BufferDesc = AcpiUtCreateIntegerObject ((UINT64) 0);
         if (!BufferDesc)
         {
             return_ACPI_STATUS (AE_NO_MEMORY);
         }
 
         Length = AcpiGbl_IntegerByteWidth;
-        BufferDesc->Integer.Value = 0;
         Buffer = &BufferDesc->Integer.Value;
     }
 

Modified: head/sys/contrib/dev/acpica/executer/exoparg1.c
==============================================================================
--- head/sys/contrib/dev/acpica/executer/exoparg1.c	Mon Nov 16 21:12:27 2009	(r199336)
+++ head/sys/contrib/dev/acpica/executer/exoparg1.c	Mon Nov 16 21:47:12 2009	(r199337)
@@ -183,13 +183,12 @@ AcpiExOpcode_0A_0T_1R (
 
         /* Create a return object of type Integer */
 
-        ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+        ReturnDesc = AcpiUtCreateIntegerObject (AcpiOsGetTimer ());
         if (!ReturnDesc)
         {
             Status = AE_NO_MEMORY;
             goto Cleanup;
         }
-        ReturnDesc->Integer.Value = AcpiOsGetTimer ();
         break;
 
     default:                /*  Unknown opcode  */
@@ -733,7 +732,7 @@ AcpiExOpcode_1A_0T_1R (
     {
     case AML_LNOT_OP:               /* LNot (Operand) */
 
-        ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+        ReturnDesc = AcpiUtCreateIntegerObject ((UINT64) 0);
         if (!ReturnDesc)
         {
             Status = AE_NO_MEMORY;
@@ -838,14 +837,12 @@ AcpiExOpcode_1A_0T_1R (
 
         /* Allocate a descriptor to hold the type. */
 
-        ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+        ReturnDesc = AcpiUtCreateIntegerObject ((UINT64) Type);
         if (!ReturnDesc)
         {
             Status = AE_NO_MEMORY;
             goto Cleanup;
         }
-
-        ReturnDesc->Integer.Value = Type;
         break;
 
 
@@ -917,14 +914,12 @@ AcpiExOpcode_1A_0T_1R (
          * Now that we have the size of the object, create a result
          * object to hold the value
          */
-        ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+        ReturnDesc = AcpiUtCreateIntegerObject (Value);
         if (!ReturnDesc)
         {
             Status = AE_NO_MEMORY;
             goto Cleanup;
         }
-
-        ReturnDesc->Integer.Value = Value;
         break;
 
 
@@ -1089,21 +1084,18 @@ AcpiExOpcode_1A_0T_1R (
                      * NOTE: index into a buffer is NOT a pointer to a
                      * sub-buffer of the main buffer, it is only a pointer to a
                      * single element (byte) of the buffer!
+                     *
+                     * Since we are returning the value of the buffer at the
+                     * indexed location, we don't need to add an additional
+                     * reference to the buffer itself.
                      */
-                    ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+                    ReturnDesc = AcpiUtCreateIntegerObject ((UINT64)
+                        TempDesc->Buffer.Pointer[Operand[0]->Reference.Value]);
                     if (!ReturnDesc)
                     {
                         Status = AE_NO_MEMORY;
                         goto Cleanup;
                     }
-
-                    /*
-                     * Since we are returning the value of the buffer at the
-                     * indexed location, we don't need to add an additional
-                     * reference to the buffer itself.
-                     */
-                    ReturnDesc->Integer.Value =
-                        TempDesc->Buffer.Pointer[Operand[0]->Reference.Value];
                     break;
 
 

Modified: head/sys/contrib/dev/acpica/executer/exoparg6.c
==============================================================================
--- head/sys/contrib/dev/acpica/executer/exoparg6.c	Mon Nov 16 21:12:27 2009	(r199336)
+++ head/sys/contrib/dev/acpica/executer/exoparg6.c	Mon Nov 16 21:47:12 2009	(r199337)
@@ -344,8 +344,9 @@ AcpiExOpcode_6A_0T_1R (
         }
 
         /* Create an integer for the return value */
+        /* Default return value is ACPI_INTEGER_MAX if no match found */
 
-        ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+        ReturnDesc = AcpiUtCreateIntegerObject (ACPI_INTEGER_MAX);
         if (!ReturnDesc)
         {
             Status = AE_NO_MEMORY;
@@ -353,10 +354,6 @@ AcpiExOpcode_6A_0T_1R (
 
         }
 
-        /* Default return value if no match found */
-
-        ReturnDesc->Integer.Value = ACPI_INTEGER_MAX;
-
         /*
          * Examine each element until a match is found. Both match conditions
          * must be satisfied for a match to occur. Within the loop,

Modified: head/sys/contrib/dev/acpica/executer/exregion.c
==============================================================================
--- head/sys/contrib/dev/acpica/executer/exregion.c	Mon Nov 16 21:12:27 2009	(r199336)
+++ head/sys/contrib/dev/acpica/executer/exregion.c	Mon Nov 16 21:47:12 2009	(r199337)
@@ -157,7 +157,8 @@ AcpiExSystemMemorySpaceHandler (
     void                    *LogicalAddrPtr = NULL;
     ACPI_MEM_SPACE_CONTEXT  *MemInfo = RegionContext;
     UINT32                  Length;
-    ACPI_SIZE               WindowSize;
+    ACPI_SIZE               MapLength;
+    ACPI_SIZE               PageBoundaryMapLength;
 #ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED
     UINT32                  Remainder;
 #endif
@@ -227,26 +228,45 @@ AcpiExSystemMemorySpaceHandler (
         }
 
         /*
-         * Don't attempt to map memory beyond the end of the region, and
-         * constrain the maximum mapping size to something reasonable.
+         * October 2009: Attempt to map from the requested address to the
+         * end of the region. However, we will never map more than one
+         * page, nor will we cross a page boundary.
          */
-        WindowSize = (ACPI_SIZE)
+        MapLength = (ACPI_SIZE)
             ((MemInfo->Address + MemInfo->Length) - Address);
 
-        if (WindowSize > ACPI_SYSMEM_REGION_WINDOW_SIZE)
+        /*
+         * If mapping the entire remaining portion of the region will cross
+         * a page boundary, just map up to the page boundary, do not cross.
+         * On some systems, crossing a page boundary while mapping regions
+         * can cause warnings if the pages have different attributes
+         * due to resource management.
+         *
+         * This has the added benefit of constraining a single mapping to
+         * one page, which is similar to the original code that used a 4k
+         * maximum window.
+         */
+        PageBoundaryMapLength =
+            ACPI_ROUND_UP (Address, ACPI_DEFAULT_PAGE_SIZE) - Address;
+        if (PageBoundaryMapLength == 0)
+        {
+            PageBoundaryMapLength = ACPI_DEFAULT_PAGE_SIZE;
+        }
+
+        if (MapLength > PageBoundaryMapLength)
         {
-            WindowSize = ACPI_SYSMEM_REGION_WINDOW_SIZE;
+            MapLength = PageBoundaryMapLength;
         }
 
         /* Create a new mapping starting at the address given */
 
         MemInfo->MappedLogicalAddress = AcpiOsMapMemory (
-            (ACPI_PHYSICAL_ADDRESS) Address, WindowSize);
+            (ACPI_PHYSICAL_ADDRESS) Address, MapLength);
         if (!MemInfo->MappedLogicalAddress)
         {
             ACPI_ERROR ((AE_INFO,
                 "Could not map memory at %8.8X%8.8X, size %X",
-                ACPI_FORMAT_NATIVE_UINT (Address), (UINT32) WindowSize));
+                ACPI_FORMAT_NATIVE_UINT (Address), (UINT32) MapLength));
             MemInfo->MappedLength = 0;
             return_ACPI_STATUS (AE_NO_MEMORY);
         }
@@ -254,7 +274,7 @@ AcpiExSystemMemorySpaceHandler (
         /* Save the physical address and mapping size */
 
         MemInfo->MappedPhysicalAddress = Address;
-        MemInfo->MappedLength = WindowSize;
+        MemInfo->MappedLength = MapLength;
     }
 
     /*

Modified: head/sys/contrib/dev/acpica/include/acconfig.h
==============================================================================
--- head/sys/contrib/dev/acpica/include/acconfig.h	Mon Nov 16 21:12:27 2009	(r199336)
+++ head/sys/contrib/dev/acpica/include/acconfig.h	Mon Nov 16 21:47:12 2009	(r199337)
@@ -177,9 +177,9 @@
 
 #define ACPI_MAX_REFERENCE_COUNT        0x800
 
-/* Size of cached memory mapping for system memory operation region */
+/* Default page size for use in mapping memory for operation regions */
 
-#define ACPI_SYSMEM_REGION_WINDOW_SIZE  4096
+#define ACPI_DEFAULT_PAGE_SIZE          4096    /* Must be power of 2 */
 
 /* OwnerId tracking. 8 entries allows for 255 OwnerIds */
 

Modified: head/sys/contrib/dev/acpica/include/acmacros.h
==============================================================================
--- head/sys/contrib/dev/acpica/include/acmacros.h	Mon Nov 16 21:12:27 2009	(r199336)
+++ head/sys/contrib/dev/acpica/include/acmacros.h	Mon Nov 16 21:47:12 2009	(r199337)
@@ -403,6 +403,7 @@
 #define ACPI_ERROR_NAMESPACE(s, e)      AcpiNsReportError (AE_INFO, s, e);
 #define ACPI_ERROR_METHOD(s, n, p, e)   AcpiNsReportMethodError (AE_INFO, s, n, p, e);
 #define ACPI_WARN_PREDEFINED(plist)     AcpiUtPredefinedWarning plist
+#define ACPI_INFO_PREDEFINED(plist)     AcpiUtPredefinedInfo plist
 

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@FreeBSD.ORG  Mon Nov 16 21:53:56 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B025A1065676;
	Mon, 16 Nov 2009 21:53:56 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9F4168FC19;
	Mon, 16 Nov 2009 21:53:56 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAGLruPB082710;
	Mon, 16 Nov 2009 21:53:56 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAGLrutu082708;
	Mon, 16 Nov 2009 21:53:56 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <200911162153.nAGLrutu082708@svn.freebsd.org>
From: Jung-uk Kim 
Date: Mon, 16 Nov 2009 21:53:56 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r199338 - head/sys/modules/acpi/acpi
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 16 Nov 2009 21:53:56 -0000

Author: jkim
Date: Mon Nov 16 21:53:56 2009
New Revision: 199338
URL: http://svn.freebsd.org/changeset/base/199338

Log:
  Add a forgotten module Makefile change from the previous commit.

Modified:
  head/sys/modules/acpi/acpi/Makefile

Modified: head/sys/modules/acpi/acpi/Makefile
==============================================================================
--- head/sys/modules/acpi/acpi/Makefile	Mon Nov 16 21:47:12 2009	(r199337)
+++ head/sys/modules/acpi/acpi/Makefile	Mon Nov 16 21:53:56 2009	(r199338)
@@ -41,8 +41,8 @@ SRCS+=	exprep.c exregion.c exresnte.c ex
 SRCS+=	exstoren.c exstorob.c exsystem.c exutils.c
 SRCS+=	hwacpi.c hwgpe.c hwregs.c hwsleep.c hwtimer.c hwvalid.c hwxface.c
 SRCS+=	nsaccess.c nsalloc.c nsdump.c nseval.c nsinit.c nsload.c nsnames.c
-SRCS+=	nsobject.c nsparse.c nspredef.c nsrepair.c nssearch.c nsutils.c
-SRCS+=	nswalk.c nsxfeval.c nsxfname.c nsxfobj.c
+SRCS+=	nsobject.c nsparse.c nspredef.c nsrepair.c nsrepair2.c nssearch.c
+SRCS+=	nsutils.c nswalk.c nsxfeval.c nsxfname.c nsxfobj.c
 SRCS+=	psargs.c psloop.c psopcode.c psparse.c psscope.c pstree.c psutils.c
 SRCS+=	pswalk.c psxface.c
 SRCS+=	rsaddr.c rscalc.c rscreate.c rsdump.c rsinfo.c rsio.c rsirq.c rslist.c

From owner-svn-src-head@FreeBSD.ORG  Mon Nov 16 22:52:52 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 953CA1065679;
	Mon, 16 Nov 2009 22:52:52 +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 84E318FC19;
	Mon, 16 Nov 2009 22:52:52 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAGMqqrO083975;
	Mon, 16 Nov 2009 22:52:52 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAGMqqcx083973;
	Mon, 16 Nov 2009 22:52:52 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200911162252.nAGMqqcx083973@svn.freebsd.org>
From: Xin LI 
Date: Mon, 16 Nov 2009 22:52: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: r199339 - head/usr.bin/gzip
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Mon, 16 Nov 2009 22:52:52 -0000

Author: delphij
Date: Mon Nov 16 22:52:52 2009
New Revision: 199339
URL: http://svn.freebsd.org/changeset/base/199339

Log:
  We should distinguish between a real truncated case and EOF after
  BZ_STREAM_END triggered re-init.  Do it by introducing a new flag
  to represent the 'cold' case after bzip2 state is reinitialized.
  
  This fixes regression reported on -current@ as well as another one
  I found during twiddling with gzip.
  
  Reported by:	swell.k gmail.com
  MFC after:	1 week

Modified:
  head/usr.bin/gzip/unbzip2.c

Modified: head/usr.bin/gzip/unbzip2.c
==============================================================================
--- head/usr.bin/gzip/unbzip2.c	Mon Nov 16 21:53:56 2009	(r199338)
+++ head/usr.bin/gzip/unbzip2.c	Mon Nov 16 22:52:52 2009	(r199339)
@@ -36,7 +36,7 @@
 static off_t
 unbzip2(int in, int out, char *pre, size_t prelen, off_t *bytes_in)
 {
-	int		ret, end_of_file;
+	int		ret, end_of_file, cold = 0;
 	off_t		bytes_out = 0;
 	bz_stream	bzs;
 	static char	*inbuf, *outbuf;
@@ -86,8 +86,18 @@ unbzip2(int in, int out, char *pre, size
 	        switch (ret) {
 	        case BZ_STREAM_END:
 	        case BZ_OK:
-	                if (ret == BZ_OK && end_of_file)
-	                        maybe_err("read");
+	                if (ret == BZ_OK && end_of_file) {
+				/*
+				 * If we hit this after a stream end, consider
+				 * it as the end of the whole file and don't
+				 * bail out.
+				 */
+				if (cold == 1)
+					ret = BZ_STREAM_END;
+				else
+					maybe_errx("truncated file");
+			}
+			cold = 0;
 	                if (!tflag && bzs.avail_out != BUFLEN) {
 				ssize_t	n;
 
@@ -100,6 +110,7 @@ unbzip2(int in, int out, char *pre, size
 				if (BZ2_bzDecompressEnd(&bzs) != BZ_OK ||
 				    BZ2_bzDecompressInit(&bzs, 0, 0) != BZ_OK)
 					maybe_errx("bzip2 re-init");
+				cold = 1;
 				ret = BZ_OK;
 			}
 			break;

From owner-svn-src-head@FreeBSD.ORG  Tue Nov 17 00:11:23 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 855FF106566B;
	Tue, 17 Nov 2009 00:11:23 +0000 (UTC)
	(envelope-from lynx.ripe@gmail.com)
Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.153])
	by mx1.freebsd.org (Postfix) with ESMTP id 6FCFC8FC13;
	Tue, 17 Nov 2009 00:11:16 +0000 (UTC)
Received: by fg-out-1718.google.com with SMTP id e12so1286730fga.13
	for ; Mon, 16 Nov 2009 16:11:16 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:received:received:message-id:date:from
	:user-agent:mime-version:to:cc:subject:content-type
	:content-transfer-encoding;
	bh=L5rJ7vonNbE57RAkR/QN0t/1omRGKH7cQU0YZbcKbUw=;
	b=SsNPV8dRhRtUo5DN7vajPaJlZvjNwKzjMPZFDKvjLPpfh2i7XAH8Ov1IhxyLq0QrZ3
	6gboLfUKkHT5yJAXqC+DnXvOQgRgWSNEZn61tnJ1ZAAsjWAke5BU0bb+yYaJXXaXOezR
	JqADohtEJbno7WlcPusSFUXVeCeaCawDZdLhc=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=message-id:date:from:user-agent:mime-version:to:cc:subject
	:content-type:content-transfer-encoding;
	b=as6mC6rJEfb+vmaVBHtB/QMmoAq7SZ90PXmeuV27N59dvwAgq+tGZJBxp1be3VsOtB
	IScMPJ1gfuS8YY/NT7pGtkYN3FGQY6PzavLwqKj08dWWCTwak/IolO5qCwnNaS8SVkvu
	OGwgBWUxNyfA63E2VT8B3MiG5guz3TgyQzoow=
Received: by 10.86.254.17 with SMTP id b17mr2888688fgi.65.1258415435685;
	Mon, 16 Nov 2009 15:50:35 -0800 (PST)
Received: from lynx.homenet (244-200-132-95.pool.ukrtel.net [95.132.200.244])
	by mx.google.com with ESMTPS id 3sm327497fge.29.2009.11.16.15.50.34
	(version=TLSv1/SSLv3 cipher=RC4-MD5);
	Mon, 16 Nov 2009 15:50:34 -0800 (PST)
Message-ID: <4B01E548.7040708@gmail.com>
Date: Tue, 17 Nov 2009 01:50:32 +0200
From: Dmitry Pryanishnikov 
User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US;
	rv:1.8.1.23) Gecko/20090906 SeaMonkey/1.1.18
MIME-Version: 1.0
To: Edwin Groothuis 
Content-Type: text/plain; charset=ISO-8859-1; 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: r194783 - head/lib/libc/stdtime
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 17 Nov 2009 00:11:23 -0000


Hello!

> Author: edwin
> Date: Tue Jun 23 22:28:44 2009
> New Revision: 194783
> URL: http://svn.freebsd.org/changeset/base/194783
> 
> Log:
>   Remove duplicate if-statement on gmt_is_set in gmtsub().
>   
>   MFC after:	1 week
> 
> Modified:
>   head/lib/libc/stdtime/localtime.c
> 
> Modified: head/lib/libc/stdtime/localtime.c
> ==============================================================================
> --- head/lib/libc/stdtime/localtime.c	Tue Jun 23 22:22:20 2009	(r194782)
> +++ head/lib/libc/stdtime/localtime.c	Tue Jun 23 22:28:44 2009	(r194783)
> @@ -1472,18 +1472,16 @@ struct tm * const	tmp;
>  {
>  	register struct tm *	result;
>  
> +	_MUTEX_LOCK(&gmt_mutex);
>  	if (!gmt_is_set) {
> -		_MUTEX_LOCK(&gmt_mutex);
> -		if (!gmt_is_set) {

   This change looks like a (small?) pessimization to me: before it, 
_MUTEX_LOCK/_MUTEX_UNLOCK pair would be skipped for the case gmt_is_set 
== TRUE (all invocations except the first one), now it won't. I'm not 
sure whether this is critical here though...


Sincerely, Dmitry
-- 
nic-hdl: LYNX-RIPE

From owner-svn-src-head@FreeBSD.ORG  Tue Nov 17 07:06:42 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2F2821065676;
	Tue, 17 Nov 2009 07:06:42 +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 1DA748FC14;
	Tue, 17 Nov 2009 07:06:42 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAH76fkU094562;
	Tue, 17 Nov 2009 07:06:41 GMT
	(envelope-from brueffer@svn.freebsd.org)
Received: (from brueffer@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAH76fdW094560;
	Tue, 17 Nov 2009 07:06:41 GMT
	(envelope-from brueffer@svn.freebsd.org)
Message-Id: <200911170706.nAH76fdW094560@svn.freebsd.org>
From: Christian Brueffer 
Date: Tue, 17 Nov 2009 07:06: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: r199349 - head/share/man/man3
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 17 Nov 2009 07:06:42 -0000

Author: brueffer
Date: Tue Nov 17 07:06:41 2009
New Revision: 199349
URL: http://svn.freebsd.org/changeset/base/199349

Log:
  Fix typo.
  
  PR:		140615
  Submitted by:	Andrius Morkunas 
  MFC after:	3 days

Modified:
  head/share/man/man3/queue.3

Modified: head/share/man/man3/queue.3
==============================================================================
--- head/share/man/man3/queue.3	Tue Nov 17 07:01:49 2009	(r199348)
+++ head/share/man/man3/queue.3	Tue Nov 17 07:06:41 2009	(r199349)
@@ -233,7 +233,7 @@ O(1) removal of any entry in the list.
 However:
 .Bl -enum -compact -offset indent
 .It
-Each elements requires two pointers rather than one.
+Each element requires two pointers rather than one.
 .It
 Code size and execution time of operations (except for removal) is about
 twice that of the singly-linked data-structures.

From owner-svn-src-head@FreeBSD.ORG  Tue Nov 17 07:29:35 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EAD13106568B;
	Tue, 17 Nov 2009 07:29:35 +0000 (UTC)
	(envelope-from netchild@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D98258FC1B;
	Tue, 17 Nov 2009 07:29:35 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAH7TZPi095099;
	Tue, 17 Nov 2009 07:29:35 GMT
	(envelope-from netchild@svn.freebsd.org)
Received: (from netchild@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAH7TZN7095097;
	Tue, 17 Nov 2009 07:29:35 GMT
	(envelope-from netchild@svn.freebsd.org)
Message-Id: <200911170729.nAH7TZN7095097@svn.freebsd.org>
From: Alexander Leidinger 
Date: Tue, 17 Nov 2009 07:29: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: r199351 - head/bin/ps
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 17 Nov 2009 07:29:36 -0000

Author: netchild
Date: Tue Nov 17 07:29:35 2009
New Revision: 199351
URL: http://svn.freebsd.org/changeset/base/199351

Log:
  Fix small resource leak (memory).
  
  Reviewed by:	gad
  MFC after:	1 week

Modified:
  head/bin/ps/keyword.c

Modified: head/bin/ps/keyword.c
==============================================================================
--- head/bin/ps/keyword.c	Tue Nov 17 07:21:27 2009	(r199350)
+++ head/bin/ps/keyword.c	Tue Nov 17 07:29:35 2009	(r199351)
@@ -330,6 +330,7 @@ findvar(char *p, int user, char **header
 				errx(1, "malloc failed");
 			snprintf(realfmt, rflen, "%s=%s", v->alias, hp);
 			parsefmt(realfmt, user);
+			free(realfmt);
 		}
 		return ((VAR *)NULL);
 	}

From owner-svn-src-head@FreeBSD.ORG  Tue Nov 17 11:39:16 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 377F31065672;
	Tue, 17 Nov 2009 11:39: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 2570E8FC13;
	Tue, 17 Nov 2009 11:39:16 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAHBdG4M005127;
	Tue, 17 Nov 2009 11:39:16 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAHBdFAA005120;
	Tue, 17 Nov 2009 11:39:15 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <200911171139.nAHBdFAA005120@svn.freebsd.org>
From: Konstantin Belousov 
Date: Tue, 17 Nov 2009 11:39: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: r199355 - in head/sys: ddb kern sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 17 Nov 2009 11:39:16 -0000

Author: kib
Date: Tue Nov 17 11:39:15 2009
New Revision: 199355
URL: http://svn.freebsd.org/changeset/base/199355

Log:
  Among signal generation syscalls, only sigqueue(2) is allowed by POSIX
  to fail due to lack of resources to queue siginfo. Add KSI_SIGQ flag
  that allows sigqueue_add() to fail while trying to allocate memory for
  new siginfo. When the flag is not set, behaviour is the same as for
  KSI_TRAP: if memory cannot be allocated, set bit in sq_kill. KSI_TRAP is
  kept to preserve KBI.
  
  Add SI_KERNEL si_code, to be used in siginfo.si_code when signal is
  generated by kernel. Deliver siginfo when signal is generated by kill(2)
  family of syscalls (SI_USER with properly filled si_uid and si_pid), or
  by kernel (SI_KERNEL, mostly job control or SIGIO). Since KSI_SIGQ flag
  is not set for the ksi, low memory condition cause old behaviour.
  
  Keep psignal(9) KBI intact, but modify it to generate SI_KERNEL
  si_code. Pgsignal(9) and gsignal(9) now take ksi explicitely. Add
  pksignal(9) that behaves like psignal but takes ksi, and ddb kill
  command implemented as pksignal(..., ksi = NULL) to not do allocation
  while in debugger.
  
  While there, remove some register specifiers and use ANSI C prototypes.
  
  Reviewed by:	davidxu
  MFC after:	1 month

Modified:
  head/sys/ddb/db_command.c
  head/sys/kern/kern_sig.c
  head/sys/kern/tty.c
  head/sys/sys/signal.h
  head/sys/sys/signalvar.h

Modified: head/sys/ddb/db_command.c
==============================================================================
--- head/sys/ddb/db_command.c	Tue Nov 17 10:59:51 2009	(r199354)
+++ head/sys/ddb/db_command.c	Tue Nov 17 11:39:15 2009	(r199355)
@@ -652,7 +652,7 @@ db_kill(dummy1, dummy2, dummy3, dummy4)
 	if (PROC_TRYLOCK(p) == 0)
 		DB_ERROR(("Can't lock process with pid %ld\n", (long) pid));
 	else {
-		psignal(p, sig);
+		pksignal(p, sig, NULL);
 		PROC_UNLOCK(p);
 	}
 

Modified: head/sys/kern/kern_sig.c
==============================================================================
--- head/sys/kern/kern_sig.c	Tue Nov 17 10:59:51 2009	(r199354)
+++ head/sys/kern/kern_sig.c	Tue Nov 17 11:39:15 2009	(r199355)
@@ -99,7 +99,8 @@ SDT_PROBE_ARGTYPE(proc, kernel, , signal
 
 static int	coredump(struct thread *);
 static char	*expand_name(const char *, uid_t, pid_t);
-static int	killpg1(struct thread *td, int sig, int pgid, int all);
+static int	killpg1(struct thread *td, int sig, int pgid, int all,
+		    ksiginfo_t *ksi);
 static int	issignal(struct thread *td, int stop_allowed);
 static int	sigprop(int sig);
 static void	tdsigwakeup(struct thread *, int, sig_t, int);
@@ -381,7 +382,8 @@ sigqueue_add(sigqueue_t *sq, int signo, 
 		ksi->ksi_sigq = sq;
 	}
 
-	if ((si->ksi_flags & KSI_TRAP) != 0) {
+	if ((si->ksi_flags & KSI_TRAP) != 0 ||
+	    (si->ksi_flags & KSI_SIGQ) == 0) {
 		if (ret != 0)
 			SIGADDSET(sq->sq_kill, signo);
 		ret = 0;
@@ -1611,11 +1613,9 @@ kern_sigaltstack(struct thread *td, stac
  * cp is calling process.
  */
 static int
-killpg1(td, sig, pgid, all)
-	register struct thread *td;
-	int sig, pgid, all;
+killpg1(struct thread *td, int sig, int pgid, int all, ksiginfo_t *ksi)
 {
-	register struct proc *p;
+	struct proc *p;
 	struct pgrp *pgrp;
 	int nfound = 0;
 
@@ -1634,7 +1634,7 @@ killpg1(td, sig, pgid, all)
 			if (p_cansignal(td, p, sig) == 0) {
 				nfound++;
 				if (sig)
-					psignal(p, sig);
+					pksignal(p, sig, ksi);
 			}
 			PROC_UNLOCK(p);
 		}
@@ -1665,7 +1665,7 @@ killpg1(td, sig, pgid, all)
 			if (p_cansignal(td, p, sig) == 0) {
 				nfound++;
 				if (sig)
-					psignal(p, sig);
+					pksignal(p, sig, ksi);
 			}
 			PROC_UNLOCK(p);
 		}
@@ -1682,11 +1682,10 @@ struct kill_args {
 #endif
 /* ARGSUSED */
 int
-kill(td, uap)
-	register struct thread *td;
-	register struct kill_args *uap;
+kill(struct thread *td, struct kill_args *uap)
 {
-	register struct proc *p;
+	ksiginfo_t ksi;
+	struct proc *p;
 	int error;
 
 	AUDIT_ARG_SIGNUM(uap->signum);
@@ -1694,6 +1693,12 @@ kill(td, uap)
 	if ((u_int)uap->signum > _SIG_MAXSIG)
 		return (EINVAL);
 
+	ksiginfo_init(&ksi);
+	ksi.ksi_signo = uap->signum;
+	ksi.ksi_code = SI_USER;
+	ksi.ksi_pid = td->td_proc->p_pid;
+	ksi.ksi_uid = td->td_ucred->cr_ruid;
+
 	if (uap->pid > 0) {
 		/* kill single process */
 		if ((p = pfind(uap->pid)) == NULL) {
@@ -1703,17 +1708,17 @@ kill(td, uap)
 		AUDIT_ARG_PROCESS(p);
 		error = p_cansignal(td, p, uap->signum);
 		if (error == 0 && uap->signum)
-			psignal(p, uap->signum);
+			pksignal(p, uap->signum, &ksi);
 		PROC_UNLOCK(p);
 		return (error);
 	}
 	switch (uap->pid) {
 	case -1:		/* broadcast signal */
-		return (killpg1(td, uap->signum, 0, 1));
+		return (killpg1(td, uap->signum, 0, 1, &ksi));
 	case 0:			/* signal own process group */
-		return (killpg1(td, uap->signum, 0, 0));
+		return (killpg1(td, uap->signum, 0, 0, &ksi));
 	default:		/* negative explicit process group */
-		return (killpg1(td, uap->signum, -uap->pid, 0));
+		return (killpg1(td, uap->signum, -uap->pid, 0, &ksi));
 	}
 	/* NOTREACHED */
 }
@@ -1727,17 +1732,21 @@ struct okillpg_args {
 #endif
 /* ARGSUSED */
 int
-okillpg(td, uap)
-	struct thread *td;
-	register struct okillpg_args *uap;
+okillpg(struct thread *td, struct okillpg_args *uap)
 {
+	ksiginfo_t ksi;
 
 	AUDIT_ARG_SIGNUM(uap->signum);
 	AUDIT_ARG_PID(uap->pgid);
 	if ((u_int)uap->signum > _SIG_MAXSIG)
 		return (EINVAL);
 
-	return (killpg1(td, uap->signum, uap->pgid, 0));
+	ksiginfo_init(&ksi);
+	ksi.ksi_signo = uap->signum;
+	ksi.ksi_code = SI_USER;
+	ksi.ksi_pid = td->td_proc->p_pid;
+	ksi.ksi_uid = td->td_ucred->cr_ruid;
+	return (killpg1(td, uap->signum, uap->pgid, 0, &ksi));
 }
 #endif /* COMPAT_43 */
 
@@ -1772,6 +1781,7 @@ sigqueue(struct thread *td, struct sigqu
 	error = p_cansignal(td, p, uap->signum);
 	if (error == 0 && uap->signum != 0) {
 		ksiginfo_init(&ksi);
+		ksi.ksi_flags = KSI_SIGQ;
 		ksi.ksi_signo = uap->signum;
 		ksi.ksi_code = SI_QUEUE;
 		ksi.ksi_pid = td->td_proc->p_pid;
@@ -1787,8 +1797,7 @@ sigqueue(struct thread *td, struct sigqu
  * Send a signal to a process group.
  */
 void
-gsignal(pgid, sig)
-	int pgid, sig;
+gsignal(int pgid, int sig, ksiginfo_t *ksi)
 {
 	struct pgrp *pgrp;
 
@@ -1797,7 +1806,7 @@ gsignal(pgid, sig)
 		pgrp = pgfind(pgid);
 		sx_sunlock(&proctree_lock);
 		if (pgrp != NULL) {
-			pgsignal(pgrp, sig, 0);
+			pgsignal(pgrp, sig, 0, ksi);
 			PGRP_UNLOCK(pgrp);
 		}
 	}
@@ -1808,18 +1817,16 @@ gsignal(pgid, sig)
  * limit to members which have a controlling terminal.
  */
 void
-pgsignal(pgrp, sig, checkctty)
-	struct pgrp *pgrp;
-	int sig, checkctty;
+pgsignal(struct pgrp *pgrp, int sig, int checkctty, ksiginfo_t *ksi)
 {
-	register struct proc *p;
+	struct proc *p;
 
 	if (pgrp) {
 		PGRP_LOCK_ASSERT(pgrp, MA_OWNED);
 		LIST_FOREACH(p, &pgrp->pg_members, p_pglist) {
 			PROC_LOCK(p);
 			if (checkctty == 0 || p->p_flag & P_CONTROLT)
-				psignal(p, sig);
+				pksignal(p, sig, ksi);
 			PROC_UNLOCK(p);
 		}
 	}
@@ -1940,7 +1947,19 @@ sigtd(struct proc *p, int sig, int prop)
 void
 psignal(struct proc *p, int sig)
 {
-	(void) tdsignal(p, NULL, sig, NULL);
+	ksiginfo_t ksi;
+
+	ksiginfo_init(&ksi);
+	ksi.ksi_signo = sig;
+	ksi.ksi_code = SI_KERNEL;
+	(void) tdsignal(p, NULL, sig, &ksi);
+}
+
+void
+pksignal(struct proc *p, int sig, ksiginfo_t *ksi)
+{
+
+	(void) tdsignal(p, NULL, sig, ksi);
 }
 
 int
@@ -3143,8 +3162,13 @@ pgsigio(sigiop, sig, checkctty)
 	struct sigio **sigiop;
 	int sig, checkctty;
 {
+	ksiginfo_t ksi;
 	struct sigio *sigio;
 
+	ksiginfo_init(&ksi);
+	ksi.ksi_signo = sig;
+	ksi.ksi_code = SI_KERNEL;
+
 	SIGIO_LOCK();
 	sigio = *sigiop;
 	if (sigio == NULL) {

Modified: head/sys/kern/tty.c
==============================================================================
--- head/sys/kern/tty.c	Tue Nov 17 10:59:51 2009	(r199354)
+++ head/sys/kern/tty.c	Tue Nov 17 11:39:15 2009	(r199355)
@@ -355,6 +355,7 @@ tty_wait_background(struct tty *tp, stru
 {
 	struct proc *p = td->td_proc;
 	struct pgrp *pg;
+	ksiginfo_t ksi;
 	int error;
 
 	MPASS(sig == SIGTTIN || sig == SIGTTOU);
@@ -396,8 +397,14 @@ tty_wait_background(struct tty *tp, stru
 		 * Send the signal and sleep until we're the new
 		 * foreground process group.
 		 */
+		if (sig != 0) {
+			ksiginfo_init(&ksi);
+			ksi.ksi_code = SI_KERNEL;
+			ksi.ksi_signo = sig;
+			sig = 0;
+		}
 		PGRP_LOCK(pg);
-		pgsignal(pg, sig, 1);
+		pgsignal(pg, ksi.ksi_signo, 1, &ksi);
 		PGRP_UNLOCK(pg);
 
 		error = tty_wait(tp, &tp->t_bgwait);
@@ -1240,6 +1247,8 @@ tty_signal_sessleader(struct tty *tp, in
 void
 tty_signal_pgrp(struct tty *tp, int sig)
 {
+	ksiginfo_t ksi;
+
 	tty_lock_assert(tp, MA_OWNED);
 	MPASS(sig >= 1 && sig < NSIG);
 
@@ -1249,8 +1258,11 @@ tty_signal_pgrp(struct tty *tp, int sig)
 	if (sig == SIGINFO && !(tp->t_termios.c_lflag & NOKERNINFO))
 		tty_info(tp);
 	if (tp->t_pgrp != NULL) {
+		ksiginfo_init(&ksi);
+		ksi.ksi_signo = sig;
+		ksi.ksi_code = SI_KERNEL;
 		PGRP_LOCK(tp->t_pgrp);
-		pgsignal(tp->t_pgrp, sig, 1);
+		pgsignal(tp->t_pgrp, sig, 1, &ksi);
 		PGRP_UNLOCK(tp->t_pgrp);
 	}
 }

Modified: head/sys/sys/signal.h
==============================================================================
--- head/sys/sys/signal.h	Tue Nov 17 10:59:51 2009	(r199354)
+++ head/sys/sys/signal.h	Tue Nov 17 11:39:15 2009	(r199355)
@@ -338,6 +338,7 @@ struct sigaction {
 					/* an asynchronous I/O request.*/
 #define	SI_MESGQ	0x10005		/* Signal generated by arrival of a */
 					/* message on an empty message queue. */
+#define	SI_KERNEL	0x10006
 #endif
 #if __BSD_VISIBLE
 #define	SI_UNDEFINED	0

Modified: head/sys/sys/signalvar.h
==============================================================================
--- head/sys/sys/signalvar.h	Tue Nov 17 10:59:51 2009	(r199354)
+++ head/sys/sys/signalvar.h	Tue Nov 17 11:39:15 2009	(r199355)
@@ -233,7 +233,8 @@ typedef struct ksiginfo {
 #define KSI_TRAP	0x01	/* Generated by trap. */
 #define	KSI_EXT		0x02	/* Externally managed ksi. */
 #define KSI_INS		0x04	/* Directly insert ksi, not the copy */
-#define	KSI_COPYMASK	KSI_TRAP
+#define	KSI_SIGQ	0x08	/* Generated by sigqueue, might ret EGAIN. */
+#define	KSI_COPYMASK	(KSI_TRAP|KSI_SIGQ)
 
 #define	KSI_ONQ(ksi)	((ksi)->ksi_sigq != NULL)
 
@@ -326,10 +327,11 @@ extern int kern_logsigexit;	/* Sysctl va
  */
 int	cursig(struct thread *td, int stop_allowed);
 void	execsigs(struct proc *p);
-void	gsignal(int pgid, int sig);
+void	gsignal(int pgid, int sig, ksiginfo_t *ksi);
 void	killproc(struct proc *p, char *why);
+void	pksignal(struct proc *p, int sig, ksiginfo_t *ksi);
 void	pgsigio(struct sigio **, int signum, int checkctty);
-void	pgsignal(struct pgrp *pgrp, int sig, int checkctty);
+void	pgsignal(struct pgrp *pgrp, int sig, int checkctty, ksiginfo_t *ksi);
 int	postsig(int sig);
 void	psignal(struct proc *p, int sig);
 int	psignal_event(struct proc *p, struct sigevent *, ksiginfo_t *);

From owner-svn-src-head@FreeBSD.ORG  Tue Nov 17 12:57:10 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CAC5F1065672;
	Tue, 17 Nov 2009 12:57:10 +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 BAA078FC23;
	Tue, 17 Nov 2009 12:57:10 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAHCvAgk007590;
	Tue, 17 Nov 2009 12:57:10 GMT (envelope-from tuexen@svn.freebsd.org)
Received: (from tuexen@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAHCvAEH007588;
	Tue, 17 Nov 2009 12:57:10 GMT (envelope-from tuexen@svn.freebsd.org)
Message-Id: <200911171257.nAHCvAEH007588@svn.freebsd.org>
From: Michael Tuexen 
Date: Tue, 17 Nov 2009 12:57:10 +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: r199365 - head/sys/net
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 17 Nov 2009 12:57:10 -0000

Author: tuexen
Date: Tue Nov 17 12:57:10 2009
New Revision: 199365
URL: http://svn.freebsd.org/changeset/base/199365

Log:
  Fix a LOR showing up with sctp_bsd_addr(): Do not hold a rt lock
  when calling rt_newaddrmsg().
  
  Reviewed by: qingli
  Approved by: rrs (mentor)
  MFC after: 1 month

Modified:
  head/sys/net/route.c

Modified: head/sys/net/route.c
==============================================================================
--- head/sys/net/route.c	Tue Nov 17 12:42:27 2009	(r199364)
+++ head/sys/net/route.c	Tue Nov 17 12:57:10 2009	(r199365)
@@ -1497,7 +1497,11 @@ rtinit1(struct ifaddr *ifa, int cmd, int
 			    ((struct sockaddr_dl *)rt->rt_gateway)->sdl_index =
 				rt->rt_ifp->if_index;
 			}
+			RT_ADDREF(rt);
+			RT_UNLOCK(rt);
 			rt_newaddrmsg(cmd, ifa, error, rt);
+			RT_LOCK(rt);
+			RT_REMREF(rt);
 			if (cmd == RTM_DELETE) {
 				/*
 				 * If we are deleting, and we found an entry,

From owner-svn-src-head@FreeBSD.ORG  Tue Nov 17 13:05:51 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C52681065670;
	Tue, 17 Nov 2009 13:05:51 +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 B4FE28FC17;
	Tue, 17 Nov 2009 13:05:51 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAHD5pxn007983;
	Tue, 17 Nov 2009 13:05:51 GMT (envelope-from tuexen@svn.freebsd.org)
Received: (from tuexen@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAHD5pDa007981;
	Tue, 17 Nov 2009 13:05:51 GMT (envelope-from tuexen@svn.freebsd.org)
Message-Id: <200911171305.nAHD5pDa007981@svn.freebsd.org>
From: Michael Tuexen 
Date: Tue, 17 Nov 2009 13:05: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: r199369 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 17 Nov 2009 13:05:51 -0000

Author: tuexen
Date: Tue Nov 17 13:05:51 2009
New Revision: 199369
URL: http://svn.freebsd.org/changeset/base/199369

Log:
  Do not hold the lock longer than necessary.
  
  Approved by: rrs (mentor)
  MFC after: 1 month

Modified:
  head/sys/netinet/sctputil.c

Modified: head/sys/netinet/sctputil.c
==============================================================================
--- head/sys/netinet/sctputil.c	Tue Nov 17 13:04:05 2009	(r199368)
+++ head/sys/netinet/sctputil.c	Tue Nov 17 13:05:51 2009	(r199369)
@@ -6156,11 +6156,11 @@ sctp_dynamic_set_primary(struct sockaddr
 	 * newest first :-0
 	 */
 	LIST_INSERT_HEAD(&SCTP_BASE_INFO(addr_wq), wi, sctp_nxt_addr);
+	SCTP_IPI_ITERATOR_WQ_UNLOCK();
 	sctp_timer_start(SCTP_TIMER_TYPE_ADDR_WQ,
 	    (struct sctp_inpcb *)NULL,
 	    (struct sctp_tcb *)NULL,
 	    (struct sctp_nets *)NULL);
-	SCTP_IPI_ITERATOR_WQ_UNLOCK();
 	return (0);
 }
 

From owner-svn-src-head@FreeBSD.ORG  Tue Nov 17 13:08:15 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 852811065693;
	Tue, 17 Nov 2009 13:08:15 +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 750B98FC1E;
	Tue, 17 Nov 2009 13:08:15 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAHD8FNF008067;
	Tue, 17 Nov 2009 13:08:15 GMT (envelope-from tuexen@svn.freebsd.org)
Received: (from tuexen@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAHD8FJe008065;
	Tue, 17 Nov 2009 13:08:15 GMT (envelope-from tuexen@svn.freebsd.org)
Message-Id: <200911171308.nAHD8FJe008065@svn.freebsd.org>
From: Michael Tuexen 
Date: Tue, 17 Nov 2009 13:08: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: r199370 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 17 Nov 2009 13:08:15 -0000

Author: tuexen
Date: Tue Nov 17 13:08:15 2009
New Revision: 199370
URL: http://svn.freebsd.org/changeset/base/199370

Log:
  Allow the UMA to free data. This resolves the UMA related bug reported
  by Julian.
  
  Approved by: rrs (mentor)
  MFC after: 1 month

Modified:
  head/sys/netinet/sctp_os_bsd.h

Modified: head/sys/netinet/sctp_os_bsd.h
==============================================================================
--- head/sys/netinet/sctp_os_bsd.h	Tue Nov 17 13:05:51 2009	(r199369)
+++ head/sys/netinet/sctp_os_bsd.h	Tue Nov 17 13:08:15 2009	(r199370)
@@ -255,10 +255,9 @@ MALLOC_DECLARE(SCTP_M_SOCKOPT);
 /* SCTP_ZONE_INIT: initialize the zone */
 typedef struct uma_zone *sctp_zone_t;
 
-#define UMA_ZFLAG_FULL	0x0020
 #define SCTP_ZONE_INIT(zone, name, size, number) { \
 	zone = uma_zcreate(name, size, NULL, NULL, NULL, NULL, UMA_ALIGN_PTR,\
-		UMA_ZFLAG_FULL); \
+		0); \
 	uma_zone_set_max(zone, number); \
 }
 

From owner-svn-src-head@FreeBSD.ORG  Tue Nov 17 13:09:52 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2948F1065672;
	Tue, 17 Nov 2009 13:09:51 +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 18F588FC1E;
	Tue, 17 Nov 2009 13:09:51 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAHD9op6008157;
	Tue, 17 Nov 2009 13:09:50 GMT (envelope-from tuexen@svn.freebsd.org)
Received: (from tuexen@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAHD9oli008155;
	Tue, 17 Nov 2009 13:09:50 GMT (envelope-from tuexen@svn.freebsd.org)
Message-Id: <200911171309.nAHD9oli008155@svn.freebsd.org>
From: Michael Tuexen 
Date: Tue, 17 Nov 2009 13:09:50 +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: r199371 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 17 Nov 2009 13:09:52 -0000

Author: tuexen
Date: Tue Nov 17 13:09:50 2009
New Revision: 199371
URL: http://svn.freebsd.org/changeset/base/199371

Log:
  Disable (temporary) the thread based interator. It does not work with vnet.
  
  Approved by: rrs (mentor)

Modified:
  head/sys/netinet/sctp_constants.h

Modified: head/sys/netinet/sctp_constants.h
==============================================================================
--- head/sys/netinet/sctp_constants.h	Tue Nov 17 13:08:15 2009	(r199370)
+++ head/sys/netinet/sctp_constants.h	Tue Nov 17 13:09:50 2009	(r199371)
@@ -87,7 +87,10 @@ __FBSDID("$FreeBSD$");
 /* #define SCTP_AUDITING_ENABLED 1 used for debug/auditing */
 #define SCTP_AUDIT_SIZE 256
 
+/* temporary disabled since it does not work with VNET. */
+#if 0
 #define SCTP_USE_THREAD_BASED_ITERATOR 1
+#endif
 
 #define SCTP_KTRHEAD_NAME "sctp_iterator"
 #define SCTP_KTHREAD_PAGES 2

From owner-svn-src-head@FreeBSD.ORG  Tue Nov 17 13:11:23 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5B0B51065693;
	Tue, 17 Nov 2009 13:11:23 +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 4A9838FC16;
	Tue, 17 Nov 2009 13:11:23 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAHDBN3K008244;
	Tue, 17 Nov 2009 13:11:23 GMT (envelope-from tuexen@svn.freebsd.org)
Received: (from tuexen@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAHDBNbd008242;
	Tue, 17 Nov 2009 13:11:23 GMT (envelope-from tuexen@svn.freebsd.org)
Message-Id: <200911171311.nAHDBNbd008242@svn.freebsd.org>
From: Michael Tuexen 
Date: Tue, 17 Nov 2009 13:11: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: r199372 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 17 Nov 2009 13:11:23 -0000

Author: tuexen
Date: Tue Nov 17 13:11:23 2009
New Revision: 199372
URL: http://svn.freebsd.org/changeset/base/199372

Log:
  Do not start the iterator when there are no associations.
  This fixes a bug found by Irene Ruengeler.
  
  Approved by: rrs (mentor)
  MFC after: 1 month

Modified:
  head/sys/netinet/sctp_asconf.c

Modified: head/sys/netinet/sctp_asconf.c
==============================================================================
--- head/sys/netinet/sctp_asconf.c	Tue Nov 17 13:09:50 2009	(r199371)
+++ head/sys/netinet/sctp_asconf.c	Tue Nov 17 13:11:23 2009	(r199372)
@@ -3180,24 +3180,6 @@ sctp_addr_mgmt_ep_sa(struct sctp_inpcb *
 		ifa = NULL;
 	}
 	if (ifa != NULL) {
-		/* add this address */
-		struct sctp_asconf_iterator *asc;
-		struct sctp_laddr *wi;
-
-		SCTP_MALLOC(asc, struct sctp_asconf_iterator *,
-		    sizeof(struct sctp_asconf_iterator),
-		    SCTP_M_ASC_IT);
-		if (asc == NULL) {
-			SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_ASCONF, ENOMEM);
-			return (ENOMEM);
-		}
-		wi = SCTP_ZONE_GET(SCTP_BASE_INFO(ipi_zone_laddr),
-		    struct sctp_laddr);
-		if (wi == NULL) {
-			SCTP_FREE(asc, SCTP_M_ASC_IT);
-			SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_ASCONF, ENOMEM);
-			return (ENOMEM);
-		}
 		if (type == SCTP_ADD_IP_ADDRESS) {
 			sctp_add_local_addr_ep(inp, ifa, type);
 		} else if (type == SCTP_DEL_IP_ADDRESS) {
@@ -3205,8 +3187,6 @@ sctp_addr_mgmt_ep_sa(struct sctp_inpcb *
 
 			if (inp->laddr_count < 2) {
 				/* can't delete the last local address */
-				SCTP_FREE(asc, SCTP_M_ASC_IT);
-				SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_laddr), wi);
 				SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_ASCONF, EINVAL);
 				return (EINVAL);
 			}
@@ -3218,27 +3198,49 @@ sctp_addr_mgmt_ep_sa(struct sctp_inpcb *
 				}
 			}
 		}
-		LIST_INIT(&asc->list_of_work);
-		asc->cnt = 1;
-		SCTP_INCR_LADDR_COUNT();
-		wi->ifa = ifa;
-		wi->action = type;
-		atomic_add_int(&ifa->refcount, 1);
-		LIST_INSERT_HEAD(&asc->list_of_work, wi, sctp_nxt_addr);
-		(void)sctp_initiate_iterator(sctp_asconf_iterator_ep,
-		    sctp_asconf_iterator_stcb,
-		    sctp_asconf_iterator_ep_end,
-		    SCTP_PCB_ANY_FLAGS,
-		    SCTP_PCB_ANY_FEATURES,
-		    SCTP_ASOC_ANY_STATE,
-		    (void *)asc, 0,
-		    sctp_asconf_iterator_end, inp, 0);
+		if (!LIST_EMPTY(&inp->sctp_asoc_list)) {
+			/*
+			 * There is no need to start the iterator if the inp
+			 * has no associations.
+			 */
+			struct sctp_asconf_iterator *asc;
+			struct sctp_laddr *wi;
+
+			SCTP_MALLOC(asc, struct sctp_asconf_iterator *,
+			    sizeof(struct sctp_asconf_iterator),
+			    SCTP_M_ASC_IT);
+			if (asc == NULL) {
+				SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_ASCONF, ENOMEM);
+				return (ENOMEM);
+			}
+			wi = SCTP_ZONE_GET(SCTP_BASE_INFO(ipi_zone_laddr), struct sctp_laddr);
+			if (wi == NULL) {
+				SCTP_FREE(asc, SCTP_M_ASC_IT);
+				SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_ASCONF, ENOMEM);
+				return (ENOMEM);
+			}
+			LIST_INIT(&asc->list_of_work);
+			asc->cnt = 1;
+			SCTP_INCR_LADDR_COUNT();
+			wi->ifa = ifa;
+			wi->action = type;
+			atomic_add_int(&ifa->refcount, 1);
+			LIST_INSERT_HEAD(&asc->list_of_work, wi, sctp_nxt_addr);
+			(void)sctp_initiate_iterator(sctp_asconf_iterator_ep,
+			    sctp_asconf_iterator_stcb,
+			    sctp_asconf_iterator_ep_end,
+			    SCTP_PCB_ANY_FLAGS,
+			    SCTP_PCB_ANY_FEATURES,
+			    SCTP_ASOC_ANY_STATE,
+			    (void *)asc, 0,
+			    sctp_asconf_iterator_end, inp, 0);
+		}
+		return (0);
 	} else {
 		/* invalid address! */
 		SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTP_ASCONF, EADDRNOTAVAIL);
 		return (EADDRNOTAVAIL);
 	}
-	return (0);
 }
 
 void

From owner-svn-src-head@FreeBSD.ORG  Tue Nov 17 13:13:59 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 54337106566B;
	Tue, 17 Nov 2009 13:13: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 29D038FC20;
	Tue, 17 Nov 2009 13:13:59 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAHDDx8w008354;
	Tue, 17 Nov 2009 13:13:59 GMT (envelope-from tuexen@svn.freebsd.org)
Received: (from tuexen@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAHDDxL8008352;
	Tue, 17 Nov 2009 13:13:59 GMT (envelope-from tuexen@svn.freebsd.org)
Message-Id: <200911171313.nAHDDxL8008352@svn.freebsd.org>
From: Michael Tuexen 
Date: Tue, 17 Nov 2009 13:13: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: r199373 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 17 Nov 2009 13:13:59 -0000

Author: tuexen
Date: Tue Nov 17 13:13:58 2009
New Revision: 199373
URL: http://svn.freebsd.org/changeset/base/199373

Log:
  Fix a memory leak when destroying an SCTP stack.
  Clean up sctp_pcb_finish().
  Approved by: rrs (mentor)
  MFC after: 1 month

Modified:
  head/sys/netinet/sctp_pcb.c

Modified: head/sys/netinet/sctp_pcb.c
==============================================================================
--- head/sys/netinet/sctp_pcb.c	Tue Nov 17 13:11:23 2009	(r199372)
+++ head/sys/netinet/sctp_pcb.c	Tue Nov 17 13:13:58 2009	(r199373)
@@ -5558,36 +5558,54 @@ sctp_pcb_finish(void)
 	struct sctp_ifa *ifa;
 	struct sctpvtaghead *chain;
 	struct sctp_tagblock *twait_block, *prev_twait_block;
+	struct sctp_laddr *wi;
+	struct sctp_iterator *it;
 	int i;
 
+#if defined(SCTP_USE_THREAD_BASED_ITERATOR)
+	SCTP_BASE_INFO(threads_must_exit) = 1;
+	/* Wake the thread up so it will exit now */
+	sctp_wakeup_iterator();
+
+#endif
+	SCTP_OS_TIMER_STOP(&SCTP_BASE_INFO(addr_wq_timer.timer));
+	SCTP_IPI_ITERATOR_WQ_LOCK();
+	while ((wi = LIST_FIRST(&SCTP_BASE_INFO(addr_wq))) != NULL) {
+		LIST_REMOVE(wi, sctp_nxt_addr);
+		SCTP_DECR_LADDR_COUNT();
+		SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_laddr), wi);
+	}
+	SCTP_IPI_ITERATOR_WQ_UNLOCK();
+	while ((it = TAILQ_FIRST(&SCTP_BASE_INFO(iteratorhead))) != NULL) {
+		if (it->function_atend != NULL) {
+			(*it->function_atend) (it->pointer, it->val);
+		}
+		TAILQ_REMOVE(&SCTP_BASE_INFO(iteratorhead), it, sctp_nxt_itr);
+		SCTP_FREE(it, SCTP_M_ITER);
+	}
+
 	/*
 	 * free the vrf/ifn/ifa lists and hashes (be sure address monitor is
 	 * destroyed first).
 	 */
 	vrf_bucket = &SCTP_BASE_INFO(sctp_vrfhash)[(SCTP_DEFAULT_VRFID & SCTP_BASE_INFO(hashvrfmark))];
-	vrf = LIST_FIRST(vrf_bucket);
-	while (vrf) {
-		ifn = LIST_FIRST(&vrf->ifnlist);
-		while (ifn) {
-			ifa = LIST_FIRST(&ifn->ifalist);
-			while (ifa) {
+	while ((vrf = LIST_FIRST(vrf_bucket)) != NULL) {
+		while ((ifn = LIST_FIRST(&vrf->ifnlist)) != NULL) {
+			while ((ifa = LIST_FIRST(&ifn->ifalist)) != NULL) {
 				/* free the ifa */
 				LIST_REMOVE(ifa, next_bucket);
 				LIST_REMOVE(ifa, next_ifa);
 				SCTP_FREE(ifa, SCTP_M_IFA);
-				ifa = LIST_FIRST(&ifn->ifalist);
 			}
 			/* free the ifn */
 			LIST_REMOVE(ifn, next_bucket);
 			LIST_REMOVE(ifn, next_ifn);
 			SCTP_FREE(ifn, SCTP_M_IFN);
-			ifn = LIST_FIRST(&vrf->ifnlist);
 		}
 		SCTP_HASH_FREE(vrf->vrf_addr_hash, vrf->vrf_addr_hashmark);
 		/* free the vrf */
 		LIST_REMOVE(vrf, next_vrf);
 		SCTP_FREE(vrf, SCTP_M_VRF);
-		vrf = LIST_FIRST(vrf_bucket);
 	}
 	/* free the vrf hashes */
 	SCTP_HASH_FREE(SCTP_BASE_INFO(sctp_vrfhash), SCTP_BASE_INFO(hashvrfmark));
@@ -5614,7 +5632,6 @@ sctp_pcb_finish(void)
 	/* free the locks and mutexes */
 #ifdef SCTP_PACKET_LOGGING
 	SCTP_IP_PKTLOG_DESTROY();
-
 #endif
 	SCTP_IPI_ADDR_DESTROY();
 	SCTP_ITERATOR_LOCK_DESTROY();

From owner-svn-src-head@FreeBSD.ORG  Tue Nov 17 13:36:21 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D541B1065676;
	Tue, 17 Nov 2009 13:36:21 +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 C4D138FC16;
	Tue, 17 Nov 2009 13:36:21 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAHDaLu3008903;
	Tue, 17 Nov 2009 13:36:21 GMT (envelope-from tuexen@svn.freebsd.org)
Received: (from tuexen@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAHDaLY5008901;
	Tue, 17 Nov 2009 13:36:21 GMT (envelope-from tuexen@svn.freebsd.org)
Message-Id: <200911171336.nAHDaLY5008901@svn.freebsd.org>
From: Michael Tuexen 
Date: Tue, 17 Nov 2009 13:36: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: r199374 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 17 Nov 2009 13:36:21 -0000

Author: tuexen
Date: Tue Nov 17 13:36:21 2009
New Revision: 199374
URL: http://svn.freebsd.org/changeset/base/199374

Log:
  Fix a bug where queued ASCONF messags are not sent out.
  
  Approved by: rrs (mentor)
  Obtained from:	Irene Ruengeler
  MFC after: 1 month

Modified:
  head/sys/netinet/sctp_output.c

Modified: head/sys/netinet/sctp_output.c
==============================================================================
--- head/sys/netinet/sctp_output.c	Tue Nov 17 13:13:58 2009	(r199373)
+++ head/sys/netinet/sctp_output.c	Tue Nov 17 13:36:21 2009	(r199374)
@@ -9442,6 +9442,7 @@ sctp_chunk_output(struct sctp_inpcb *inp
 
 	if ((un_sent <= 0) &&
 	    (TAILQ_EMPTY(&asoc->control_send_queue)) &&
+	    (TAILQ_EMPTY(&asoc->asconf_send_queue)) &&
 	    (asoc->sent_queue_retran_cnt == 0)) {
 		/* Nothing to do unless there is something to be sent left */
 		return;

From owner-svn-src-head@FreeBSD.ORG  Tue Nov 17 14:13:31 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B8D9C106568B;
	Tue, 17 Nov 2009 14:13:31 +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 63FCB8FC15;
	Tue, 17 Nov 2009 14:13:31 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAHEDUJB011055;
	Tue, 17 Nov 2009 14:13:30 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAHEDUF6011052;
	Tue, 17 Nov 2009 14:13:30 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200911171413.nAHEDUF6011052@svn.freebsd.org>
From: John Baldwin 
Date: Tue, 17 Nov 2009 14:13: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: r199378 - head/sys/dev/de
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 17 Nov 2009 14:13:31 -0000

Author: jhb
Date: Tue Nov 17 14:13:30 2009
New Revision: 199378
URL: http://svn.freebsd.org/changeset/base/199378

Log:
  Use a private timer to run the statistics timer instead of (ab)using
  if_watchdog and if_timer.
  
  Tested by:	WATANABE Kazuhiro  CQG00620 of nifty.ne.jp

Modified:
  head/sys/dev/de/if_de.c
  head/sys/dev/de/if_devar.h

Modified: head/sys/dev/de/if_de.c
==============================================================================
--- head/sys/dev/de/if_de.c	Tue Nov 17 14:08:42 2009	(r199377)
+++ head/sys/dev/de/if_de.c	Tue Nov 17 14:13:30 2009	(r199378)
@@ -151,6 +151,7 @@ static void	tulip_start_locked(tulip_sof
 static struct mbuf *
 		tulip_txput(tulip_softc_t * const sc, struct mbuf *m);
 static void	tulip_txput_setup(tulip_softc_t * const sc);
+static void	tulip_watchdog(void *arg);
 struct mbuf *	tulip_dequeue_mbuf(tulip_ringinfo_t *ri, tulip_descinfo_t *di,
 		    int sync);
 static void	tulip_dma_map_addr(void *, bus_dma_segment_t *, int, int);
@@ -3302,11 +3303,13 @@ tulip_init_locked(tulip_softc_t * const 
 	    TULIP_CSR_READ(sc, csr_status));
 	if ((sc->tulip_flags & (TULIP_WANTSETUP|TULIP_TXPROBE_ACTIVE)) == TULIP_WANTSETUP)
 	    tulip_txput_setup(sc);
+	callout_reset(&sc->tulip_stat_timer, hz, tulip_watchdog, sc);
     } else {
 	CTR0(KTR_TULIP, "tulip_init_locked: not up, reset chip");
 	sc->tulip_ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 	tulip_reset(sc);
 	tulip_addr_filter(sc);
+	callout_stop(&sc->tulip_stat_timer);
     }
 }
 
@@ -4319,23 +4322,17 @@ tulip_start_locked(tulip_softc_t * const
     }
 }
 
-/*
- * Even though this routine runs at device spl, it does not break
- * our use of splnet (splsoftnet under NetBSD) for the majority
- * of this driver since 
- * if_watcbog is called from if_watchdog which is called from
- * splsoftclock which is below spl[soft]net.
- */
 static void
-tulip_ifwatchdog(struct ifnet *ifp)
+tulip_watchdog(void *arg)
 {
-    TULIP_PERFSTART(ifwatchdog)
-    tulip_softc_t * const sc = (tulip_softc_t *)ifp->if_softc;
+    TULIP_PERFSTART(stat)
+    tulip_softc_t *sc = arg;
 #if defined(TULIP_DEBUG)
     u_int32_t rxintrs;
 #endif
 
-    TULIP_LOCK(sc);
+    TULIP_LOCK_ASSERT(sc);
+    callout_reset(&sc->tulip_stat_timer, hz, tulip_watchdog, sc);    
 #if defined(TULIP_DEBUG)
     rxintrs = sc->tulip_dbg.dbg_rxintrs - sc->tulip_dbg.dbg_last_rxintrs;
     if (rxintrs > sc->tulip_dbg.dbg_high_rxintrs_hz)
@@ -4343,7 +4340,6 @@ tulip_ifwatchdog(struct ifnet *ifp)
     sc->tulip_dbg.dbg_last_rxintrs = sc->tulip_dbg.dbg_rxintrs;
 #endif /* TULIP_DEBUG */
 
-    sc->tulip_ifp->if_timer = 1;
     /*
      * These should be rare so do a bulk test up front so we can just skip
      * them if needed.
@@ -4381,11 +4377,11 @@ tulip_ifwatchdog(struct ifnet *ifp)
 	tulip_init_locked(sc);
     }
 
-    TULIP_PERFEND(ifwatchdog);
+    TULIP_PERFEND(stat);
     TULIP_PERFMERGE(sc, perf_intr_cycles);
     TULIP_PERFMERGE(sc, perf_ifstart_cycles);
     TULIP_PERFMERGE(sc, perf_ifioctl_cycles);
-    TULIP_PERFMERGE(sc, perf_ifwatchdog_cycles);
+    TULIP_PERFMERGE(sc, perf_stat_cycles);
     TULIP_PERFMERGE(sc, perf_timeout_cycles);
     TULIP_PERFMERGE(sc, perf_ifstart_one_cycles);
     TULIP_PERFMERGE(sc, perf_txput_cycles);
@@ -4395,14 +4391,13 @@ tulip_ifwatchdog(struct ifnet *ifp)
     TULIP_PERFMERGE(sc, perf_intr);
     TULIP_PERFMERGE(sc, perf_ifstart);
     TULIP_PERFMERGE(sc, perf_ifioctl);
-    TULIP_PERFMERGE(sc, perf_ifwatchdog);
+    TULIP_PERFMERGE(sc, perf_stat);
     TULIP_PERFMERGE(sc, perf_timeout);
     TULIP_PERFMERGE(sc, perf_ifstart_one);
     TULIP_PERFMERGE(sc, perf_txput);
     TULIP_PERFMERGE(sc, perf_txintr);
     TULIP_PERFMERGE(sc, perf_rxintr);
     TULIP_PERFMERGE(sc, perf_rxget);
-    TULIP_UNLOCK(sc);
 }
 
 static void
@@ -4418,8 +4413,6 @@ tulip_attach(tulip_softc_t * const sc)
     ifp->if_flags = IFF_BROADCAST|IFF_SIMPLEX|IFF_MULTICAST;
     ifp->if_ioctl = tulip_ifioctl;
     ifp->if_start = tulip_start;
-    ifp->if_watchdog = tulip_ifwatchdog;
-    ifp->if_timer = 1;
     ifp->if_init = tulip_init;
     IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen);
     ifp->if_snd.ifq_drv_maxlen = ifqmaxlen;
@@ -4839,6 +4832,7 @@ tulip_pci_attach(device_t dev)
     mtx_init(TULIP_MUTEX(sc), MTX_NETWORK_LOCK, device_get_nameunit(dev),
 	MTX_DEF);
     callout_init_mtx(&sc->tulip_callout, TULIP_MUTEX(sc), 0);
+    callout_init_mtx(&sc->tulip_stat_timer, TULIP_MUTEX(sc), 0);
     tulips[unit] = sc;
 
     tulip_initcsrs(sc, csr_base + csroffset, csrsize);

Modified: head/sys/dev/de/if_devar.h
==============================================================================
--- head/sys/dev/de/if_devar.h	Tue Nov 17 14:08:42 2009	(r199377)
+++ head/sys/dev/de/if_devar.h	Tue Nov 17 14:13:30 2009	(r199378)
@@ -477,7 +477,7 @@ struct tulip_perfstat {
 	u_quad_t	perf_ifstart_cycles;
 	u_quad_t	perf_ifstart_one_cycles;
 	u_quad_t	perf_ifioctl_cycles;
-	u_quad_t	perf_ifwatchdog_cycles;
+	u_quad_t	perf_stat_cycles;
 	u_quad_t	perf_timeout_cycles;
 	u_quad_t	perf_txput_cycles;
 	u_quad_t	perf_txintr_cycles;
@@ -487,7 +487,7 @@ struct tulip_perfstat {
 	unsigned int	perf_ifstart;
 	unsigned int	perf_ifstart_one;
 	unsigned int	perf_ifioctl;
-	unsigned int	perf_ifwatchdog;
+	unsigned int	perf_stat;
 	unsigned int	perf_timeout;
 	unsigned int	perf_txput;
 	unsigned int	perf_txintr;
@@ -570,6 +570,7 @@ struct tulip_softc {
 	tulip_srom_connection_t	tulip_conntype;
 	struct callout		tulip_callout;
 	struct mtx		tulip_mutex;
+	struct callout	tulip_stat_timer;
 };
 
 #define	tulip_curperfstats	tulip_perfstats[TULIP_PERF_CURRENT]

From owner-svn-src-head@FreeBSD.ORG  Tue Nov 17 14:23:10 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 019E4106566B;
	Tue, 17 Nov 2009 14:23: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 E45A58FC0C;
	Tue, 17 Nov 2009 14:23:09 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAHEN9oo011959;
	Tue, 17 Nov 2009 14:23:09 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAHEN98w011955;
	Tue, 17 Nov 2009 14:23:09 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200911171423.nAHEN98w011955@svn.freebsd.org>
From: John Baldwin 
Date: Tue, 17 Nov 2009 14:23: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: r199380 - head/sys/dev/ed
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 17 Nov 2009 14:23:10 -0000

Author: jhb
Date: Tue Nov 17 14:23:09 2009
New Revision: 199380
URL: http://svn.freebsd.org/changeset/base/199380

Log:
  Use a private callout timer to drive the transmit watchdog instead of using
  if_watchdog and if_timer.  The driver already contained an optional stats
  timer that individual attachments could use to provide a 'tick' event.  The
  stats timer only ran if the tick function pointer was non-NULL and the
  attachment's tick routine had to call callout_reset(), etc.  Now the driver
  always schedules a stat timer and manages the callout_reset() internally.
  This timer is used to drive the watchdog and will also call the attachment's
  'tick' handler if one is provided.
  
  Tested by:	WATANABE Kazuhiro

Modified:
  head/sys/dev/ed/if_ed.c
  head/sys/dev/ed/if_ed_pccard.c
  head/sys/dev/ed/if_edvar.h

Modified: head/sys/dev/ed/if_ed.c
==============================================================================
--- head/sys/dev/ed/if_ed.c	Tue Nov 17 14:14:07 2009	(r199379)
+++ head/sys/dev/ed/if_ed.c	Tue Nov 17 14:23:09 2009	(r199380)
@@ -77,7 +77,8 @@ static int	ed_ioctl(struct ifnet *, u_lo
 static void	ed_start(struct ifnet *);
 static void	ed_start_locked(struct ifnet *);
 static void	ed_reset(struct ifnet *);
-static void	ed_watchdog(struct ifnet *);
+static void	ed_tick(void *);
+static void	ed_watchdog(struct ed_softc *);
 
 static void	ed_ds_getmcaf(struct ed_softc *, uint32_t *);
 
@@ -281,7 +282,6 @@ ed_attach(device_t dev)
 	if_initname(ifp, device_get_name(dev), device_get_unit(dev));
 	ifp->if_start = ed_start;
 	ifp->if_ioctl = ed_ioctl;
-	ifp->if_watchdog = ed_watchdog;
 	ifp->if_init = ed_init;
 	IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN);
 	ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN;
@@ -381,8 +381,8 @@ ed_detach(device_t dev)
 			ed_stop(sc);
 		ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 		ED_UNLOCK(sc);
-		callout_drain(&sc->tick_ch);
 		ether_ifdetach(ifp);
+		callout_drain(&sc->tick_ch);
 	}
 	if (sc->irq_res != NULL && sc->irq_handle)
 		bus_teardown_intr(dev, sc->irq_res, sc->irq_handle);
@@ -447,26 +447,42 @@ void
 ed_stop(struct ed_softc *sc)
 {
 	ED_ASSERT_LOCKED(sc);
-	if (sc->sc_tick)
-		callout_stop(&sc->tick_ch);
+	callout_stop(&sc->tick_ch);
 	ed_stop_hw(sc);
 }
 
 /*
+ * Periodic timer used to drive the watchdog and attachment-specific
+ * tick handler.
+ */
+static void
+ed_tick(void *arg)
+{
+	struct ed_softc *sc;
+
+	sc = arg;
+	ED_ASSERT_LOCKED(sc);
+	if (sc->sc_tick)
+		sc->sc_tick(sc);
+	if (sc->tx_timer != 0 && --sc->tx_timer == 0)
+		ed_watchdog(sc);
+	callout_reset(&sc->tick_ch, hz, ed_tick, sc);
+}
+
+/*
  * Device timeout/watchdog routine. Entered if the device neglects to
  *	generate an interrupt after a transmit has been started on it.
  */
 static void
-ed_watchdog(struct ifnet *ifp)
+ed_watchdog(struct ed_softc *sc)
 {
-	struct ed_softc *sc = ifp->if_softc;
+	struct ifnet *ifp;
 
+	ifp = sc->ifp;
 	log(LOG_ERR, "%s: device timeout\n", ifp->if_xname);
 	ifp->if_oerrors++;
 
-	ED_LOCK(sc);
 	ed_reset(ifp);
-	ED_UNLOCK(sc);
 }
 
 /*
@@ -499,7 +515,7 @@ ed_init_locked(struct ed_softc *sc)
 
 	/* reset transmitter flags */
 	sc->xmit_busy = 0;
-	ifp->if_timer = 0;
+	sc->tx_timer = 0;
 
 	sc->txb_inuse = 0;
 	sc->txb_new = 0;
@@ -612,8 +628,7 @@ ed_init_locked(struct ed_softc *sc)
 	 */
 	ed_start_locked(ifp);
 
-	if (sc->sc_tick)
-		callout_reset(&sc->tick_ch, hz, sc->sc_tick, sc);
+	callout_reset(&sc->tick_ch, hz, ed_tick, sc);
 }
 
 /*
@@ -622,7 +637,6 @@ ed_init_locked(struct ed_softc *sc)
 static __inline void
 ed_xmit(struct ed_softc *sc)
 {
-	struct ifnet *ifp = sc->ifp;
 	unsigned short len;
 
 	len = sc->txb_len[sc->txb_next_tx];
@@ -660,7 +674,7 @@ ed_xmit(struct ed_softc *sc)
 	/*
 	 * Set a timer just in case we never hear from the board again
 	 */
-	ifp->if_timer = 2;
+	sc->tx_timer = 2;
 }
 
 /*
@@ -1023,7 +1037,7 @@ edintr(void *arg)
 			/*
 			 * clear watchdog timer
 			 */
-			ifp->if_timer = 0;
+			sc->tx_timer = 0;
 
 			/*
 			 * Add in total number of collisions on last

Modified: head/sys/dev/ed/if_ed_pccard.c
==============================================================================
--- head/sys/dev/ed/if_ed_pccard.c	Tue Nov 17 14:14:07 2009	(r199379)
+++ head/sys/dev/ed/if_ed_pccard.c	Tue Nov 17 14:23:09 2009	(r199380)
@@ -250,7 +250,7 @@ static const struct ed_product {
  */
 static int	ed_pccard_probe(device_t);
 static int	ed_pccard_attach(device_t);
-static void	ed_pccard_tick(void *);
+static void	ed_pccard_tick(struct ed_softc *);
 
 static int	ed_pccard_dl100xx(device_t dev, const struct ed_product *);
 static void	ed_pccard_dl100xx_mii_reset(struct ed_softc *sc);
@@ -1196,9 +1196,8 @@ ed_child_detached(device_t dev, device_t
 }
 
 static void
-ed_pccard_tick(void *arg)
+ed_pccard_tick(struct ed_softc *sc)
 {
-	struct ed_softc *sc = arg;
 	struct mii_data *mii;
 	int media = 0;
 
@@ -1223,7 +1222,6 @@ ed_pccard_tick(void *arg)
 		}
 		
 	}
-	callout_reset(&sc->tick_ch, hz, ed_pccard_tick, sc);
 }
 
 static device_method_t ed_pccard_methods[] = {

Modified: head/sys/dev/ed/if_edvar.h
==============================================================================
--- head/sys/dev/ed/if_edvar.h	Tue Nov 17 14:14:07 2009	(r199379)
+++ head/sys/dev/ed/if_edvar.h	Tue Nov 17 14:23:09 2009	(r199380)
@@ -65,11 +65,12 @@ struct ed_softc {
 	void	(*mii_writebits)(struct ed_softc *, u_int, int);
 	u_int	(*mii_readbits)(struct ed_softc *, int);
 	struct callout	      tick_ch;
-        void	(*sc_tick)(void *);
+        void	(*sc_tick)(struct ed_softc *);
 	void (*readmem)(struct ed_softc *sc, bus_size_t src, uint8_t *dst,
 	    uint16_t amount);
 	u_short	(*sc_write_mbufs)(struct ed_softc *, struct mbuf *, bus_size_t);
 
+	int	tx_timer;
 	int	nic_offset;	/* NIC (DS8390) I/O bus address offset */
 	int	asic_offset;	/* ASIC I/O bus address offset */
 

From owner-svn-src-head@FreeBSD.ORG  Tue Nov 17 15:47:20 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3B1021065751;
	Tue, 17 Nov 2009 15:47:20 +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 29B4F8FC08;
	Tue, 17 Nov 2009 15:47:20 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAHFlJCt018812;
	Tue, 17 Nov 2009 15:47:19 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAHFlJsw018810;
	Tue, 17 Nov 2009 15:47:19 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200911171547.nAHFlJsw018810@svn.freebsd.org>
From: John Baldwin 
Date: Tue, 17 Nov 2009 15:47: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: r199395 - head/sys/pc98/conf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 17 Nov 2009 15:47:20 -0000

Author: jhb
Date: Tue Nov 17 15:47:19 2009
New Revision: 199395
URL: http://svn.freebsd.org/changeset/base/199395

Log:
  Remove duplicate 'ural' entry since it was added to the MI NOTES a while
  ago.

Modified:
  head/sys/pc98/conf/NOTES

Modified: head/sys/pc98/conf/NOTES
==============================================================================
--- head/sys/pc98/conf/NOTES	Tue Nov 17 15:30:22 2009	(r199394)
+++ head/sys/pc98/conf/NOTES	Tue Nov 17 15:47:19 2009	(r199395)
@@ -385,7 +385,6 @@ hint.mse.0.irq="13"
 # ral:	Ralink Technology IEEE 802.11 wireless adapter
 # sbni: Granch SBNI12-xx ISA and PCI adapters
 # snc:	National Semiconductor DP8393X SONIC Ethernet adapter driver
-# ural:	Ralink Technology RT2500USB IEEE 802.11 wireless adapter
 # ath:  Atheros a/b/g WiFi adapters (requires ath_hal and wlan)
 
 # Order for ISA/EISA devices is important here
@@ -419,7 +418,6 @@ hint.snc.0.at="isa"
 hint.snc.0.port="0x888"
 hint.snc.0.irq="6"
 hint.snc.0.maddr="0xc0000"
-device		ural
 
 device		ath		# Atheros pci/cardbus NIC's
 device		ath_hal		# pci/cardbus chip support

From owner-svn-src-head@FreeBSD.ORG  Tue Nov 17 16:00:42 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 092971065676;
	Tue, 17 Nov 2009 16:00:42 +0000 (UTC)
	(envelope-from vanhu@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id EBE848FC19;
	Tue, 17 Nov 2009 16:00:41 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAHG0fEW019710;
	Tue, 17 Nov 2009 16:00:41 GMT (envelope-from vanhu@svn.freebsd.org)
Received: (from vanhu@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAHG0f2e019707;
	Tue, 17 Nov 2009 16:00:41 GMT (envelope-from vanhu@svn.freebsd.org)
Message-Id: <200911171600.nAHG0f2e019707@svn.freebsd.org>
From: VANHULLEBUS Yvan 
Date: Tue, 17 Nov 2009 16:00: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: r199398 - head/sys/netipsec
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 17 Nov 2009 16:00:42 -0000

Author: vanhu
Date: Tue Nov 17 16:00:41 2009
New Revision: 199398
URL: http://svn.freebsd.org/changeset/base/199398

Log:
  fixed two race conditions when inserting/removing SAs via PFKey,
  which can both lead to a kernel panic when adding/removing quickly
  a lot of SAs.
  
  Obtained from:	NETASQ
  MFC after:	2w (MFC on 8 before 8.0 release ???)

Modified:
  head/sys/netipsec/key.c

Modified: head/sys/netipsec/key.c
==============================================================================
--- head/sys/netipsec/key.c	Tue Nov 17 15:59:26 2009	(r199397)
+++ head/sys/netipsec/key.c	Tue Nov 17 16:00:41 2009	(r199398)
@@ -2852,9 +2852,10 @@ key_newsav(m, mhp, sah, errp, where, tag
 	sa_initref(newsav);
 	newsav->state = SADB_SASTATE_LARVAL;
 
-	/* XXX locking??? */
+	SAHTREE_LOCK();
 	LIST_INSERT_TAIL(&sah->savtree[SADB_SASTATE_LARVAL], newsav,
 			secasvar, chain);
+	SAHTREE_UNLOCK();
 done:
 	KEYDEBUG(KEYDEBUG_IPSEC_STAMP,
 		printf("DP %s from %s:%u return SP:%p\n", __func__,
@@ -5698,8 +5699,8 @@ key_delete(so, m, mhp)
 	}
 
 	key_sa_chgstate(sav, SADB_SASTATE_DEAD);
-	SAHTREE_UNLOCK();
 	KEY_FREESAV(&sav);
+	SAHTREE_UNLOCK();
 
     {
 	struct mbuf *n;

From owner-svn-src-head@FreeBSD.ORG  Tue Nov 17 16:26:46 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 93C911065670;
	Tue, 17 Nov 2009 16:26:46 +0000 (UTC)
	(envelope-from obrien@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 686C48FC18;
	Tue, 17 Nov 2009 16:26:46 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAHGQkWb021553;
	Tue, 17 Nov 2009 16:26:46 GMT (envelope-from obrien@svn.freebsd.org)
Received: (from obrien@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAHGQkxO021550;
	Tue, 17 Nov 2009 16:26:46 GMT (envelope-from obrien@svn.freebsd.org)
Message-Id: <200911171626.nAHGQkxO021550@svn.freebsd.org>
From: "David E. O'Brien" 
Date: Tue, 17 Nov 2009 16:26:46 +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: r199404 - head/usr.bin/make
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 17 Nov 2009 16:26:46 -0000

Author: obrien
Date: Tue Nov 17 16:26:45 2009
New Revision: 199404
URL: http://svn.freebsd.org/changeset/base/199404

Log:
  Garbage collect some old #ifdef'ed code from 1994 that causes vi's '%'
  to be unable to find a match in Path_FindFile().

Modified:
  head/usr.bin/make/dir.c
  head/usr.bin/make/job.c

Modified: head/usr.bin/make/dir.c
==============================================================================
--- head/usr.bin/make/dir.c	Tue Nov 17 16:18:03 2009	(r199403)
+++ head/usr.bin/make/dir.c	Tue Nov 17 16:26:45 2009	(r199404)
@@ -832,21 +832,6 @@ Path_FindFile(char *name, struct Path *p
 	 * When searching for $(FILE), we will find it in $(INSTALLDIR)
 	 * b/c we added it here. This is not good...
 	 */
-#ifdef notdef
-	cp[-1] = '\0';
-	Path_AddDir(path, name);
-	cp[-1] = '/';
-
-	bigmisses += 1;
-	pe = TAILQ_LAST(path, Path);
-	if (pe == NULL)
-		return (NULL);
-
-	if (Hash_FindEntry(&pe->dir->files, cp) != NULL) {
-		return (estrdup(name));
-
-	return (NULL);
-#else /* !notdef */
 	DEBUGF(DIR, ("Looking for \"%s\"...", name));
 
 	bigmisses += 1;
@@ -864,7 +849,6 @@ Path_FindFile(char *name, struct Path *p
 		DEBUGF(DIR, ("failed. Returning NULL\n"));
 		return (NULL);
 	}
-#endif /* notdef */
 }
 
 /*-

Modified: head/usr.bin/make/job.c
==============================================================================
--- head/usr.bin/make/job.c	Tue Nov 17 16:18:03 2009	(r199403)
+++ head/usr.bin/make/job.c	Tue Nov 17 16:26:45 2009	(r199404)
@@ -1008,17 +1008,6 @@ JobFinish(Job *job, int *status)
 				if (!(job->flags & JOB_CONTINUING)) {
 					DEBUGF(JOB, ("Warning: process %jd was not "
 						     "continuing.\n", (intmax_t) job->pid));
-#ifdef notdef
-					/*
-					 * We don't really want to restart a
-					 * job from scratch just because it
-					 * continued, especially not without
-					 * killing the continuing process!
-					 * That's why this is ifdef'ed out.
-					 * FD - 9/17/90
-					 */
-					JobRestart(job);
-#endif
 				}
 				job->flags &= ~JOB_CONTINUING;
 				TAILQ_INSERT_TAIL(&jobs, job, link);

From owner-svn-src-head@FreeBSD.ORG  Tue Nov 17 16:29:40 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 57F88106566B;
	Tue, 17 Nov 2009 16:29:40 +0000 (UTC)
	(envelope-from obrien@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 462CD8FC16;
	Tue, 17 Nov 2009 16:29:40 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAHGTe6g021738;
	Tue, 17 Nov 2009 16:29:40 GMT (envelope-from obrien@svn.freebsd.org)
Received: (from obrien@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAHGTeUE021735;
	Tue, 17 Nov 2009 16:29:40 GMT (envelope-from obrien@svn.freebsd.org)
Message-Id: <200911171629.nAHGTeUE021735@svn.freebsd.org>
From: "David E. O'Brien" 
Date: Tue, 17 Nov 2009 16:29:40 +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: r199405 - in head: lib/libc/gen share/zoneinfo
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 17 Nov 2009 16:29:40 -0000

Author: obrien
Date: Tue Nov 17 16:29:39 2009
New Revision: 199405
URL: http://svn.freebsd.org/changeset/base/199405

Log:
  Catch up with r130332 which changed the default timezone from GMT to UTC.
  Otherwise the tzload() (when called by gmtload()) fails to locate the UTC
  file and loads the posixrules.

Modified:
  head/lib/libc/gen/tzset.3
  head/share/zoneinfo/etcetera

Modified: head/lib/libc/gen/tzset.3
==============================================================================
--- head/lib/libc/gen/tzset.3	Tue Nov 17 16:26:45 2009	(r199404)
+++ head/lib/libc/gen/tzset.3	Tue Nov 17 16:29:39 2009	(r199405)
@@ -310,14 +310,14 @@ time zone directory
 rules for
 .Tn POSIX Ns -style
 .Tn TZ Ns 's
-.It Pa /usr/share/zoneinfo/GMT
+.It Pa /usr/share/zoneinfo/Etc/GMT
 for
 .Tn UTC
 leap seconds
 .El
 .Pp
 If the file
-.Pa /usr/share/zoneinfo/GMT
+.Pa /usr/share/zoneinfo/UTC
 does not exist,
 .Tn UTC
 leap seconds are loaded from

Modified: head/share/zoneinfo/etcetera
==============================================================================
--- head/share/zoneinfo/etcetera	Tue Nov 17 16:26:45 2009	(r199404)
+++ head/share/zoneinfo/etcetera	Tue Nov 17 16:29:39 2009	(r199405)
@@ -16,9 +16,9 @@ Zone	Etc/UCT		0	-	UCT
 
 # The following link uses older naming conventions,
 # but it belongs here, not in the file `backward',
-# as functions like gmtime load the "GMT" file to handle leap seconds properly.
+# as functions like gmtime load the "UTC" file to handle leap seconds properly.
 # We want this to work even on installations that omit the other older names.
-Link	Etc/GMT				GMT
+Link	Etc/UTC				UTC
 
 Link	Etc/UTC				Etc/Universal
 Link	Etc/UTC				Etc/Zulu

From owner-svn-src-head@FreeBSD.ORG  Tue Nov 17 16:43:02 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 85A66106566B;
	Tue, 17 Nov 2009 16:43: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 716CB8FC1C;
	Tue, 17 Nov 2009 16:43:02 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAHGh2V1022605;
	Tue, 17 Nov 2009 16:43:02 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAHGh2NV022600;
	Tue, 17 Nov 2009 16:43:02 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200911171643.nAHGh2NV022600@svn.freebsd.org>
From: John Baldwin 
Date: Tue, 17 Nov 2009 16:43: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: r199407 - in head/sys/dev: ce cp ctau cx
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 17 Nov 2009 16:43:02 -0000

Author: jhb
Date: Tue Nov 17 16:43:02 2009
New Revision: 199407
URL: http://svn.freebsd.org/changeset/base/199407

Log:
  Always use a private timer instead of if_watchdog and if_timer to drive
  the transmit watchdog.  These drivers already used a private timer when
  compiled to use Netgraph.  This change just makes them always use the
  private timer.  Note that these drivers do not compile and are disconnected
  from the build due to TTY changes.

Modified:
  head/sys/dev/ce/if_ce.c
  head/sys/dev/cp/if_cp.c
  head/sys/dev/ctau/if_ct.c
  head/sys/dev/cx/if_cx.c

Modified: head/sys/dev/ce/if_ce.c
==============================================================================
--- head/sys/dev/ce/if_ce.c	Tue Nov 17 16:30:57 2009	(r199406)
+++ head/sys/dev/ce/if_ce.c	Tue Nov 17 16:43:02 2009	(r199407)
@@ -171,11 +171,11 @@ typedef struct _drv_t {
 	node_p	node;
 	struct	ifqueue queue;
 	struct	ifqueue hi_queue;
-	short	timeout;
-	struct	callout timeout_handle;
 #else
 	struct	ifnet *ifp;
 #endif
+	short	timeout;
+	struct	callout timeout_handle;
 #if __FreeBSD_version >= 500000
 	struct	cdev *devt;
 #else /* __FreeBSD_version < 500000 */
@@ -211,13 +211,13 @@ static void ce_up (drv_t *d);
 static void ce_start (drv_t *d);
 static void ce_down (drv_t *d);
 static void ce_watchdog (drv_t *d);
+static void ce_watchdog_timer (void *arg);
 #ifdef NETGRAPH
 extern struct ng_type typestruct;
 #else
 static void ce_ifstart (struct ifnet *ifp);
 static void ce_tlf (struct sppp *sp);
 static void ce_tls (struct sppp *sp);
-static void ce_ifwatchdog (struct ifnet *ifp);
 static int ce_sioctl (struct ifnet *ifp, u_long cmd, caddr_t data);
 static void ce_initialize (void *softc);
 #endif
@@ -677,6 +677,7 @@ static int ce_attach (device_t dev)
 			continue;
 		d = c->sys;
 
+		callout_init (&d->timeout_handle, CALLOUT_MPSAFE);
 #ifdef NETGRAPH
 		if (ng_make_node_common (&typestruct, &d->node) != 0) {
 			printf ("%s: cannot make common node\n", d->name);
@@ -685,7 +686,6 @@ static int ce_attach (device_t dev)
 		}
 #if __FreeBSD_version >= 500000
 		NG_NODE_SET_PRIVATE (d->node, d);
-		callout_init (&d->timeout_handle, CALLOUT_MPSAFE);
 #else
 		d->node->private = d;
 #endif
@@ -731,7 +731,6 @@ static int ce_attach (device_t dev)
 		d->ifp->if_flags	= IFF_POINTOPOINT | IFF_MULTICAST;
 		d->ifp->if_ioctl	= ce_sioctl;
 		d->ifp->if_start	= ce_ifstart;
-		d->ifp->if_watchdog	= ce_ifwatchdog;
 		d->ifp->if_init		= ce_initialize;
 		d->rqueue.ifq_maxlen	= IFQ_MAXLEN;
 #if __FreeBSD_version >= 500000
@@ -806,6 +805,7 @@ static int ce_detach (device_t dev)
 
 		if (! d || ! d->chan)
 			continue;
+		callout_stop (&d->timeout_handle);
 #ifndef NETGRAPH
 		/* Detach from the packet filter list of interfaces. */
 		bpfdetach (d->ifp);
@@ -855,13 +855,12 @@ static int ce_detach (device_t dev)
 	TAU32_DestructiveHalt (b->ddk.pControllerObject, 0);
 	bus_release_resource (dev, SYS_RES_MEMORY, PCIR_BAR(0), bd->ce_res);
 
-	s = splimp ();
-	CE_LOCK (bd);
 	for (c = b->chan; c < b->chan + NCHAN; ++c) {
 		drv_t *d = (drv_t*) c->sys;
 
 		if (! d || ! d->chan)
 			continue;
+		callout_drain (&d->timeout_handle);
 		channel [b->num * NCHAN + c->num] = 0;
 		/* Deallocate buffers. */
 		ce_bus_dma_mem_free (&d->dmamem);
@@ -869,8 +868,6 @@ static int ce_detach (device_t dev)
 	adapter [b->num] = 0;
 	ce_bus_dma_mem_free (&bd->dmamem);
 	free (b, M_DEVBUF);
-	CE_UNLOCK (bd);
-	splx (s);
 #if __FreeBSD_version >= 504000
 	mtx_destroy (&bd->ce_mtx);
 #endif
@@ -888,13 +885,6 @@ static void ce_ifstart (struct ifnet *if
 	CE_UNLOCK (bd);
 }
 
-static void ce_ifwatchdog (struct ifnet *ifp)
-{
-	drv_t *d = ifp->if_softc;
-
-	ce_watchdog (d);
-}
-
 static void ce_tlf (struct sppp *sp)
 {
 	drv_t *d = SP2IFP(sp)->if_softc;
@@ -989,6 +979,7 @@ static void ce_down (drv_t *d)
 	ce_set_rts (d->chan, 0);
 
 	d->running = 0;
+	callout_stop (&d->timeout_handle);
 }
 
 /*
@@ -1055,11 +1046,7 @@ static void ce_send (drv_t *d)
 		}
 		m_freem (m);
 		/* Set up transmit timeout, if the transmit ring is not empty.*/
-#ifdef NETGRAPH
 		d->timeout = 10;
-#else
-		d->ifp->if_timer = 10;
-#endif
 	}
 #ifndef NETGRAPH
 #if __FreeBSD_version >= 600034
@@ -1082,6 +1069,7 @@ static void ce_start (drv_t *d)
 		if (! d->chan->rts)
 			ce_set_rts (d->chan, 1);
 		ce_send (d);
+		callout_reset (&d->timeout_handle, hz, ce_watchdog_timer, d);
 	}
 }
 
@@ -1092,11 +1080,8 @@ static void ce_start (drv_t *d)
  */
 static void ce_watchdog (drv_t *d)
 {
-	bdrv_t *bd = d->board->sys;
 	CE_DEBUG (d, ("device timeout\n"));
 	if (d->running) {
-		int s = splimp ();
-		CE_LOCK (bd);
 		ce_set_dtr (d->chan, 0);
 		ce_set_rts (d->chan, 0);
 /*		ce_stop_chan (d->chan);*/
@@ -1104,25 +1089,35 @@ static void ce_watchdog (drv_t *d)
 		ce_set_dtr (d->chan, 1);
 		ce_set_rts (d->chan, 1);
 		ce_start (d);
-		CE_UNLOCK (bd);
-		splx (s);
 	}
 }
 
+static void ce_watchdog_timer (void *arg)
+{
+	drv_t *d = arg;
+	bdrv_t *bd = d->board->sys;
+
+	CE_LOCK(bd);
+	if (d->timeout == 1)
+		ce_watchdog (d);
+	if (d->timeout)
+		d->timeout--;
+	callout_reset (&d->timeout_handle, hz, ce_watchdog_timer, d);
+	CE_UNLOCK(bd);
+}
+
 static void ce_transmit (ce_chan_t *c, void *attachment, int len)
 {
 	drv_t *d = c->sys;
 
-#ifdef NETGRAPH
 	d->timeout = 0;
-#else
+#ifndef NETGRAPH
 	++d->ifp->if_opackets;
 #if __FreeBSD_version >=  600034
 	d->ifp->if_flags &= ~IFF_DRV_OACTIVE;
 #else
 	d->ifp->if_flags &= ~IFF_OACTIVE;
 #endif
-	d->ifp->if_timer = 0;
 #endif
 	ce_start (d);
 }
@@ -1195,16 +1190,14 @@ static void ce_error (ce_chan_t *c, int 
 		break;
 	case CE_UNDERRUN:
 		CE_DEBUG (d, ("underrun error\n"));
-#ifdef NETGRAPH
 		d->timeout = 0;
-#else
+#ifndef NETGRAPH
 		++d->ifp->if_oerrors;
 #if __FreeBSD_version >= 600034
 		d->ifp->if_flags &= ~IFF_DRV_OACTIVE;
 #else
 		d->ifp->if_flags &= ~IFF_OACTIVE;
 #endif
-		d->ifp->if_timer = 0;
 #endif
 		ce_start (d);
 		break;
@@ -2507,19 +2500,6 @@ static int ng_ce_rmnode (node_p node)
 	return 0;
 }
 
-static void ng_ce_watchdog (void *arg)
-{
-	drv_t *d = arg;
-
-	if (d) {
-		if (d->timeout == 1)
-			ce_watchdog (d);
-		if (d->timeout)
-			d->timeout--;
-		callout_reset (&d->timeout_handle, hz, ng_ce_watchdog, d);
-	}
-}
-
 static int ng_ce_connect (hook_p hook)
 {
 #if __FreeBSD_version >= 500000
@@ -2530,7 +2510,7 @@ static int ng_ce_connect (hook_p hook)
 
 	if (d) {
 		CE_DEBUG (d, ("Connect\n"));
-		callout_reset (&d->timeout_handle, hz, ng_ce_watchdog, d);
+		callout_reset (&d->timeout_handle, hz, ce_watchdog_timer, d);
 	}
 	
 	return 0;

Modified: head/sys/dev/cp/if_cp.c
==============================================================================
--- head/sys/dev/cp/if_cp.c	Tue Nov 17 16:30:57 2009	(r199406)
+++ head/sys/dev/cp/if_cp.c	Tue Nov 17 16:43:02 2009	(r199407)
@@ -117,12 +117,12 @@ typedef struct _drv_t {
 	node_p	node;
 	struct	ifqueue queue;
 	struct	ifqueue hi_queue;
-	short	timeout;
-	struct	callout timeout_handle;
 #else
 	struct	ifqueue queue;
 	struct	ifnet *ifp;
 #endif
+	short	timeout;
+	struct	callout timeout_handle;
 	struct	cdev *devt;
 } drv_t;
 
@@ -151,13 +151,13 @@ static void cp_up (drv_t *d);
 static void cp_start (drv_t *d);
 static void cp_down (drv_t *d);
 static void cp_watchdog (drv_t *d);
+static void cp_watchdog_timer (void *arg);
 #ifdef NETGRAPH
 extern struct ng_type typestruct;
 #else
 static void cp_ifstart (struct ifnet *ifp);
 static void cp_tlf (struct sppp *sp);
 static void cp_tls (struct sppp *sp);
-static void cp_ifwatchdog (struct ifnet *ifp);
 static int cp_sioctl (struct ifnet *ifp, u_long cmd, caddr_t data);
 static void cp_initialize (void *softc);
 #endif
@@ -490,6 +490,7 @@ static int cp_attach (device_t dev)
 		d->board = b;
 		d->chan = c;
 		c->sys = d;
+		callout_init (&d->timeout_handle, CALLOUT_MPSAFE);
 #ifdef NETGRAPH
 		if (ng_make_node_common (&typestruct, &d->node) != 0) {
 			printf ("%s: cannot make common node\n", d->name);
@@ -508,7 +509,6 @@ static int cp_attach (device_t dev)
 		d->hi_queue.ifq_maxlen = IFQ_MAXLEN;
 		mtx_init (&d->queue.ifq_mtx, "cp_queue", NULL, MTX_DEF);
 		mtx_init (&d->hi_queue.ifq_mtx, "cp_queue_hi", NULL, MTX_DEF);
-		callout_init (&d->timeout_handle, CALLOUT_MPSAFE);
 #else /*NETGRAPH*/
 		d->ifp = if_alloc(IFT_PPP);
 		if (d->ifp == NULL) {
@@ -521,7 +521,6 @@ static int cp_attach (device_t dev)
 		d->ifp->if_flags	= IFF_POINTOPOINT | IFF_MULTICAST;
 		d->ifp->if_ioctl	= cp_sioctl;
 		d->ifp->if_start	= cp_ifstart;
-		d->ifp->if_watchdog	= cp_ifwatchdog;
 		d->ifp->if_init		= cp_initialize;
 		d->queue.ifq_maxlen	= NRBUF;
 		mtx_init (&d->queue.ifq_mtx, "cp_queue", NULL, MTX_DEF);
@@ -603,6 +602,7 @@ static int cp_detach (device_t dev)
 
 		if (! d || ! d->chan->type)
 			continue;
+		callout_stop (&d->timeout_handle);
 #ifndef NETGRAPH
 		/* Detach from the packet filter list of interfaces. */
 		bpfdetach (d->ifp);
@@ -639,12 +639,12 @@ static int cp_detach (device_t dev)
 	callout_drain (&led_timo[b->num]);
 	splx (s);
 
-	s = splimp ();
 	for (c = b->chan; c < b->chan + NCHAN; ++c) {
 		drv_t *d = (drv_t*) c->sys;
 
 		if (! d || ! d->chan->type)
 			continue;
+		callout_drain (&d->timeout_handle);
 		channel [b->num*NCHAN + c->num] = 0;
 		/* Deallocate buffers. */
 		cp_bus_dma_mem_free (&d->dmamem);
@@ -652,7 +652,6 @@ static int cp_detach (device_t dev)
 	adapter [b->num] = 0;
 	cp_bus_dma_mem_free (&bd->dmamem);
 	free (b, M_DEVBUF);
-	splx (s);
 	mtx_destroy (&bd->cp_mtx);
 	return 0;
 }
@@ -668,13 +667,6 @@ static void cp_ifstart (struct ifnet *if
 	CP_UNLOCK (bd);
 }
 
-static void cp_ifwatchdog (struct ifnet *ifp)
-{
-	drv_t *d = ifp->if_softc;
-
-	cp_watchdog (d);
-}
-
 static void cp_tlf (struct sppp *sp)
 {
 	drv_t *d = SP2IFP(sp)->if_softc;
@@ -766,6 +758,7 @@ static void cp_down (drv_t *d)
 	cp_set_rts (d->chan, 0);
 
 	d->running = 0;
+	callout_stop (&d->timeout_handle);
 }
 
 /*
@@ -827,11 +820,7 @@ static void cp_send (drv_t *d)
 		}
 		m_freem (m);
 		/* Set up transmit timeout, if the transmit ring is not empty.*/
-#ifdef NETGRAPH
 		d->timeout = 10;
-#else
-		d->ifp->if_timer = 10;
-#endif
 	}
 #ifndef NETGRAPH
 	d->ifp->if_drv_flags |= IFF_DRV_OACTIVE;
@@ -850,6 +839,7 @@ static void cp_start (drv_t *d)
 		if (! d->chan->rts)
 			cp_set_rts (d->chan, 1);
 		cp_send (d);
+		callout_reset (&d->timeout_handle, hz, cp_watchdog_timer, d);
 	}
 }
 
@@ -860,12 +850,8 @@ static void cp_start (drv_t *d)
  */
 static void cp_watchdog (drv_t *d)
 {
-	bdrv_t *bd = d->board->sys;
 	CP_DEBUG (d, ("device timeout\n"));
 	if (d->running) {
-		int s = splimp ();
-
-		CP_LOCK (bd);
 		cp_stop_chan (d->chan);
 		cp_stop_e1 (d->chan);
 		cp_start_e1 (d->chan);
@@ -873,21 +859,31 @@ static void cp_watchdog (drv_t *d)
 		cp_set_dtr (d->chan, 1);
 		cp_set_rts (d->chan, 1);
 		cp_start (d);
-		CP_UNLOCK (bd);
-		splx (s);
 	}
 }
 
+static void cp_watchdog_timer (void *arg)
+{
+	drv_t *d = arg;
+	bdrv_t *bd = d->board->sys;
+
+	CP_LOCK (bd);
+	if (d->timeout == 1)
+		cp_watchdog (d);
+	if (d->timeout)
+		d->timeout--;
+	callout_reset (&d->timeout_handle, hz, cp_watchdog_timer, d);
+	CP_UNLOCK (bd);
+}
+
 static void cp_transmit (cp_chan_t *c, void *attachment, int len)
 {
 	drv_t *d = c->sys;
 
-#ifdef NETGRAPH
 	d->timeout = 0;
-#else
+#ifndef NETGRAPH
 	++d->ifp->if_opackets;
 	d->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
-	d->ifp->if_timer = 0;
 #endif
 	cp_start (d);
 }
@@ -958,12 +954,10 @@ static void cp_error (cp_chan_t *c, int 
 		break;
 	case CP_UNDERRUN:
 		CP_DEBUG (d, ("underrun error\n"));
-#ifdef NETGRAPH
 		d->timeout = 0;
-#else
+#ifndef NETGRAPH
 		++d->ifp->if_oerrors;
 		d->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
-		d->ifp->if_timer = 0;
 #endif
 		cp_start (d);
 		break;
@@ -2198,26 +2192,13 @@ static int ng_cp_rmnode (node_p node)
 	return 0;
 }
 
-static void ng_cp_watchdog (void *arg)
-{
-	drv_t *d = arg;
-
-	if (d) {
-		if (d->timeout == 1)
-			cp_watchdog (d);
-		if (d->timeout)
-			d->timeout--;
-		callout_reset (&d->timeout_handle, hz, ng_cp_watchdog, d);
-	}
-}
-
 static int ng_cp_connect (hook_p hook)
 {
 	drv_t *d = NG_NODE_PRIVATE (NG_HOOK_NODE (hook));
 
 	if (d) {
 		CP_DEBUG (d, ("Connect\n"));
-		callout_reset (&d->timeout_handle, hz, ng_cp_watchdog, d);
+		callout_reset (&d->timeout_handle, hz, cp_watchdog_timer, d);
 	}
 	
 	return 0;

Modified: head/sys/dev/ctau/if_ct.c
==============================================================================
--- head/sys/dev/ctau/if_ct.c	Tue Nov 17 16:30:57 2009	(r199406)
+++ head/sys/dev/ctau/if_ct.c	Tue Nov 17 16:43:02 2009	(r199407)
@@ -118,12 +118,12 @@ typedef struct _drv_t {
 	node_p	node;
 	struct	ifqueue queue;
 	struct	ifqueue hi_queue;
-	short	timeout;
-	struct	callout timeout_handle;
 #else
 	struct	ifqueue queue;
 	struct	ifnet *ifp;
 #endif
+	short	timeout;
+	struct	callout timeout_handle;
 	struct	cdev *devt;
 } drv_t;
 
@@ -155,13 +155,13 @@ static void ct_up (drv_t *d);
 static void ct_start (drv_t *d);
 static void ct_down (drv_t *d);
 static void ct_watchdog (drv_t *d);
+static void ct_watchdog_timer (void *arg);
 #ifdef NETGRAPH
 extern struct ng_type typestruct;
 #else
 static void ct_ifstart (struct ifnet *ifp);
 static void ct_tlf (struct sppp *sp);
 static void ct_tls (struct sppp *sp);
-static void ct_ifwatchdog (struct ifnet *ifp);
 static int ct_sioctl (struct ifnet *ifp, u_long cmd, caddr_t data);
 static void ct_initialize (void *softc);
 #endif
@@ -701,6 +701,7 @@ static int ct_attach (device_t dev)
 		c->sys = d;
 		channel [b->num*NCHAN + c->num] = d;
 		sprintf (d->name, "ct%d.%d", b->num, c->num);
+		callout_init (&d->timeout_handle, CALLOUT_MPSAFE);
 
 #ifdef NETGRAPH
 		if (ng_make_node_common (&typestruct, &d->node) != 0) {
@@ -724,8 +725,7 @@ static int ct_attach (device_t dev)
 		d->queue.ifq_maxlen = IFQ_MAXLEN;
 		d->hi_queue.ifq_maxlen = IFQ_MAXLEN;
 		mtx_init (&d->queue.ifq_mtx, "ct_queue", NULL, MTX_DEF);
-		mtx_init (&d->hi_queue.ifq_mtx, "ct_queue_hi", NULL, MTX_DEF);		
-		callout_init (&d->timeout_handle, CALLOUT_MPSAFE);
+		mtx_init (&d->hi_queue.ifq_mtx, "ct_queue_hi", NULL, MTX_DEF);
 #else /*NETGRAPH*/
 		d->ifp = if_alloc(IFT_PPP);
 		if (d->ifp == NULL) {
@@ -742,7 +742,6 @@ static int ct_attach (device_t dev)
 		d->ifp->if_flags	= IFF_POINTOPOINT | IFF_MULTICAST;
 		d->ifp->if_ioctl	= ct_sioctl;
 		d->ifp->if_start	= ct_ifstart;
-		d->ifp->if_watchdog	= ct_ifwatchdog;
 		d->ifp->if_init		= ct_initialize;
 		d->queue.ifq_maxlen	= NBUF;
 		mtx_init (&d->queue.ifq_mtx, "ct_queue", NULL, MTX_DEF);
@@ -816,6 +815,7 @@ static int ct_detach (device_t dev)
 		if (!d || !d->chan->type)
 			continue;
 
+		callout_stop (&d->timeout_handle);
 #ifdef NETGRAPH
 		if (d->node) {
 			ng_rmnode_self (d->node);
@@ -845,12 +845,12 @@ static int ct_detach (device_t dev)
 	callout_drain (&led_timo[b->num]);
 	splx (s);
 	
-	s = splimp ();
 	for (c = b->chan; c < b->chan + NCHAN; ++c) {
 		drv_t *d = (drv_t*) c->sys;
 
 		if (!d || !d->chan->type)
 			continue;
+		callout_drain(&d->timeout_handle);
 		
 		/* Deallocate buffers. */
 		ct_bus_dma_mem_free (&d->dmamem);
@@ -858,7 +858,6 @@ static int ct_detach (device_t dev)
 	bd->board = 0;
 	adapter [b->num] = 0;
 	free (b, M_DEVBUF);
-	splx (s);
 	
 	mtx_destroy (&bd->ct_mtx);
 
@@ -876,13 +875,6 @@ static void ct_ifstart (struct ifnet *if
 	CT_UNLOCK (bd);
 }
 
-static void ct_ifwatchdog (struct ifnet *ifp)
-{
-	drv_t *d = ifp->if_softc;
-
-	ct_watchdog (d);
-}
-
 static void ct_tlf (struct sppp *sp)
 {
 	drv_t *d = SP2IFP(sp)->if_softc;
@@ -970,6 +962,7 @@ static void ct_down (drv_t *d)
 	ct_set_dtr (d->chan, 0);
 	ct_set_rts (d->chan, 0);
 	d->running = 0;
+	callout_stop (&d->timeout_handle);
 	splx (s);
 }
 
@@ -1033,11 +1026,7 @@ static void ct_send (drv_t *d)
 
 		/* Set up transmit timeout, if the transmit ring is not empty.
 		 * Transmit timeout is 10 seconds. */
-#ifdef NETGRAPH
 		d->timeout = 10;
-#else
-		d->ifp->if_timer = 10;
-#endif
 	}
 #ifndef NETGRAPH
 	d->ifp->if_drv_flags |= IFF_DRV_OACTIVE;
@@ -1058,6 +1047,7 @@ static void ct_start (drv_t *d)
 		if (! d->chan->rts)
 			ct_set_rts (d->chan, 1);
 		ct_send (d);
+		callout_reset (&d->timeout_handle, hz, ct_watchdog_timer, d);
 	}
 
 	splx (s);
@@ -1070,11 +1060,7 @@ static void ct_start (drv_t *d)
  */
 static void ct_watchdog (drv_t *d)
 {
-	bdrv_t *bd = d->bd;
-	int s;
 
-	s = splimp ();
-	CT_LOCK (bd);
 	CT_DEBUG (d, ("device timeout\n"));
 	if (d->running) {
 		ct_setup_chan (d->chan);
@@ -1083,8 +1069,20 @@ static void ct_watchdog (drv_t *d)
 		ct_set_rts (d->chan, 1);
 		ct_start (d);
 	}
+}
+
+static void ct_watchdog_timer (void *arg)
+{
+	drv_t *d = arg;
+	bdrv_t *bd = d->bd;
+
+	CT_LOCK (bd);
+	if (d->timeout == 1)
+		ct_watchdog (d);
+	if (d->timeout)
+		d->timeout--;
+	callout_reset (&d->timeout_handle, hz, ct_watchdog_timer, d);
 	CT_UNLOCK (bd);
-	splx (s);
 }
 
 /*
@@ -1096,12 +1094,10 @@ static void ct_transmit (ct_chan_t *c, v
 
 	if (!d)
 		return;
-#ifdef NETGRAPH
 	d->timeout = 0;
-#else
+#ifndef NETGRAPH
 	++d->ifp->if_opackets;
 	d->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
-	d->ifp->if_timer = 0;
 #endif
 	ct_start (d);
 }
@@ -1181,12 +1177,10 @@ static void ct_error (ct_chan_t *c, int 
 		break;
 	case CT_UNDERRUN:
 		CT_DEBUG (d, ("underrun error\n"));
-#ifdef NETGRAPH
 		d->timeout = 0;
-#else
+#ifndef NETGRAPH
 		++d->ifp->if_oerrors;
 		d->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
-		d->ifp->if_timer = 0;
 #endif
 		ct_start (d);
 		break;
@@ -2142,20 +2136,6 @@ static int ng_ct_rmnode (node_p node)
 	return 0;
 }
 
-static void ng_ct_watchdog (void *arg)
-{
-	drv_t *d = arg;
-
-	if (!d)
-		return;
-		
-	if (d->timeout == 1)
-		ct_watchdog (d);
-	if (d->timeout)
-		d->timeout--;
-	callout_reset (&d->timeout_handle, hz, ng_ct_watchdog, d);
-}
-
 static int ng_ct_connect (hook_p hook)
 {
 	drv_t *d = NG_NODE_PRIVATE (NG_HOOK_NODE (hook));
@@ -2163,7 +2143,7 @@ static int ng_ct_connect (hook_p hook)
 	if (!d)
 		return 0;
 		
-	callout_reset (&d->timeout_handle, hz, ng_ct_watchdog, d);
+	callout_reset (&d->timeout_handle, hz, ct_watchdog_timer, d);
 	return 0;
 }
 

Modified: head/sys/dev/cx/if_cx.c
==============================================================================
--- head/sys/dev/cx/if_cx.c	Tue Nov 17 16:30:57 2009	(r199406)
+++ head/sys/dev/cx/if_cx.c	Tue Nov 17 16:43:02 2009	(r199407)
@@ -143,12 +143,12 @@ typedef struct _drv_t {
 	node_p	node;
 	struct	ifqueue lo_queue;
 	struct	ifqueue hi_queue;
-	short	timeout;
-	struct	callout timeout_handle;
 #else
 	struct	ifqueue queue;
 	struct	ifnet *ifp;
 #endif
+	short	timeout;
+	struct	callout timeout_handle;
 	struct	cdev *devt;
 	async_q	aqueue;
 #define CX_READ 1
@@ -197,6 +197,7 @@ static void cx_softintr (void *);
 static void *cx_fast_ih;
 static void cx_down (drv_t *d);
 static void cx_watchdog (drv_t *d);
+static void cx_watchdog_timer (void *arg);
 static void cx_carrier (void *arg);
 
 #ifdef NETGRAPH
@@ -205,7 +206,6 @@ extern struct ng_type typestruct;
 static void cx_ifstart (struct ifnet *ifp);
 static void cx_tlf (struct sppp *sp);
 static void cx_tls (struct sppp *sp);
-static void cx_ifwatchdog (struct ifnet *ifp);
 static int cx_sioctl (struct ifnet *ifp, u_long cmd, caddr_t data);
 static void cx_initialize (void *softc);
 #endif
@@ -811,6 +811,7 @@ static int cx_attach (device_t dev)
 		case T_UNIV_RS232:
 		case T_UNIV_RS449:
 		case T_UNIV_V35:
+		callout_init (&d->timeout_handle, CALLOUT_MPSAFE);
 #ifdef NETGRAPH
 		if (ng_make_node_common (&typestruct, &d->node) != 0) {
 			printf ("%s: cannot make common node\n", d->name);
@@ -834,7 +835,6 @@ static int cx_attach (device_t dev)
 		d->hi_queue.ifq_maxlen = IFQ_MAXLEN;
 		mtx_init (&d->lo_queue.ifq_mtx, "cx_queue_lo", NULL, MTX_DEF);
 		mtx_init (&d->hi_queue.ifq_mtx, "cx_queue_hi", NULL, MTX_DEF);
-		callout_init (&d->timeout_handle, CALLOUT_MPSAFE);
 #else /*NETGRAPH*/
 		d->ifp = if_alloc(IFT_PPP);
 		if (d->ifp == NULL) {
@@ -851,7 +851,6 @@ static int cx_attach (device_t dev)
 		d->ifp->if_flags	= IFF_POINTOPOINT | IFF_MULTICAST;
 		d->ifp->if_ioctl	= cx_sioctl;
 		d->ifp->if_start	= cx_ifstart;
-		d->ifp->if_watchdog	= cx_ifwatchdog;
 		d->ifp->if_init		= cx_initialize;
 		d->queue.ifq_maxlen	= 2;
 		mtx_init (&d->queue.ifq_mtx, "cx_queue", NULL, MTX_DEF);
@@ -959,6 +958,7 @@ static int cx_detach (device_t dev)
 			d->tty = NULL;
 		}
 
+		callout_stop (&d->timeout_handle);
 #ifdef NETGRAPH
 		if (d->node) {
 			ng_rmnode_self (d->node);
@@ -992,6 +992,7 @@ static int cx_detach (device_t dev)
 			continue;
 
 		callout_drain (&d->dcd_timeout_handle);
+		callout_drain (&d->timeout_handle);
 	}
 	splx (s);
 	
@@ -1026,13 +1027,6 @@ static void cx_ifstart (struct ifnet *if
 	CX_UNLOCK (bd);
 }
 
-static void cx_ifwatchdog (struct ifnet *ifp)
-{
-	drv_t *d = ifp->if_softc;
-
-	cx_watchdog (d);
-}
-
 static void cx_tlf (struct sppp *sp)
 {
 	drv_t *d = SP2IFP(sp)->if_softc;
@@ -1129,6 +1123,7 @@ static void cx_down (drv_t *d)
 	cx_set_dtr (d->chan, 0);
 	cx_set_rts (d->chan, 0);
 	d->running = 0;
+	callout_stop (&d->timeout_handle);
 	splx (s);
 }
 
@@ -1191,11 +1186,7 @@ static void cx_send (drv_t *d)
 		m_freem (m);
 
 		/* Set up transmit timeout, 10 seconds. */
-#ifdef NETGRAPH
 		d->timeout = 10;
-#else
-		d->ifp->if_timer = 10;
-#endif
 	}
 #ifndef NETGRAPH
 	d->ifp->if_drv_flags |= IFF_DRV_OACTIVE;
@@ -1215,6 +1206,7 @@ static void cx_start (drv_t *d)
 		if (! d->chan->rts)
 			cx_set_rts (d->chan, 1);
 		cx_send (d);
+		callout_reset (&d->timeout_handle, hz, cx_watchdog_timer, d);
 	}
 	splx (s);
 }
@@ -1226,10 +1218,7 @@ static void cx_start (drv_t *d)
  */
 static void cx_watchdog (drv_t *d)
 {
-	bdrv_t *bd = d->board->sys;
 	
-	int s = splhigh ();
-	CX_LOCK (bd);
 	CX_DEBUG (d, ("device timeout\n"));
 	if (d->running) {
 		cx_setup_chan (d->chan);
@@ -1238,8 +1227,20 @@ static void cx_watchdog (drv_t *d)
 		cx_set_rts (d->chan, 1);
 		cx_start (d);
 	}
+}
+
+static void cx_watchdog_timer (void *arg)
+{
+	drv_t *d = arg;
+	bdrv_t *bd = d->board->sys;
+
+	CX_LOCK (bd);
+	if (d->timeout == 1)
+		cx_watchdog (d);
+	if (d->timeout)
+		d->timeout--;
+	callout_reset (&d->timeout_handle, hz, cx_watchdog_timer, d);
 	CX_UNLOCK (bd);
-	splx (s);
 }
 
 /*
@@ -1262,12 +1263,10 @@ static void cx_transmit (cx_chan_t *c, v
 		}
 		return;
 	}
-#ifdef NETGRAPH
 	d->timeout = 0;
-#else
+#ifndef NETGRAPH
 	++d->ifp->if_opackets;
 	d->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
-	d->ifp->if_timer = 0;
 #endif
 	cx_start (d);
 }
@@ -1421,14 +1420,12 @@ static void cx_error (cx_chan_t *c, int 
 	case CX_UNDERRUN:
 		CX_DEBUG (d, ("underrun error\n"));
 		if (c->mode != M_ASYNC) {
-#ifdef NETGRAPH
 			d->timeout = 0;
-#else
+#ifndef NETGRAPH
 			++d->ifp->if_oerrors;
 			d->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
-			d->ifp->if_timer = 0;
-			cx_start (d);
 #endif
+			cx_start (d);
 		}
 		break;
 	case CX_BREAK:
@@ -2477,22 +2474,11 @@ static int ng_cx_rmnode (node_p node)
 	return 0;
 }
 
-static void ng_cx_watchdog (void *arg)
-{
-	drv_t *d = arg;
-
-	if (d->timeout == 1)
-		cx_watchdog (d);
-	if (d->timeout)
-		d->timeout--;
-	callout_reset (&d->timeout_handle, hz, ng_cx_watchdog, d);
-}
-
 static int ng_cx_connect (hook_p hook)
 {
 	drv_t *d = NG_NODE_PRIVATE (NG_HOOK_NODE (hook));
 
-	callout_reset (&d->timeout_handle, hz, ng_cx_watchdog, d);
+	callout_reset (&d->timeout_handle, hz, cx_watchdog_timer, d);
 	return 0;
 }
 

From owner-svn-src-head@FreeBSD.ORG  Tue Nov 17 17:38:42 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 11A29106566B;
	Tue, 17 Nov 2009 17:38:42 +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 000958FC21;
	Tue, 17 Nov 2009 17:38:41 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAHHcftF026144;
	Tue, 17 Nov 2009 17:38:41 GMT (envelope-from jh@svn.freebsd.org)
Received: (from jh@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAHHcf2T026142;
	Tue, 17 Nov 2009 17:38:41 GMT (envelope-from jh@svn.freebsd.org)
Message-Id: <200911171738.nAHHcf2T026142@svn.freebsd.org>
From: Jaakko Heinonen 
Date: Tue, 17 Nov 2009 17:38: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: r199411 - head/usr.sbin/fifolog/fifolog_writer
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 17 Nov 2009 17:38:42 -0000

Author: jh
Date: Tue Nov 17 17:38:41 2009
New Revision: 199411
URL: http://svn.freebsd.org/changeset/base/199411

Log:
  Unify fifolog_writer usage printout with fifolog_create and
  fifolog_reader.
  
  Approved by:	trasz (mentor)

Modified:
  head/usr.sbin/fifolog/fifolog_writer/fifolog_writer.c

Modified: head/usr.sbin/fifolog/fifolog_writer/fifolog_writer.c
==============================================================================
--- head/usr.sbin/fifolog/fifolog_writer/fifolog_writer.c	Tue Nov 17 16:51:49 2009	(r199410)
+++ head/usr.sbin/fifolog/fifolog_writer/fifolog_writer.c	Tue Nov 17 17:38:41 2009	(r199411)
@@ -42,7 +42,7 @@
 static void
 usage(void)
 {
-	fprintf(stderr, "fifolog_writer [-w write-rate] [-s sync-rate] "
+	fprintf(stderr, "Usage: fifolog_writer [-w write-rate] [-s sync-rate] "
 	    "[-z compression] file\n");
 	exit(EX_USAGE);
 }

From owner-svn-src-head@FreeBSD.ORG  Tue Nov 17 18:19:46 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4581C10656A4;
	Tue, 17 Nov 2009 18:19: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 33FBF8FC0A;
	Tue, 17 Nov 2009 18:19:46 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAHIJk4k028321;
	Tue, 17 Nov 2009 18:19:46 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAHIJkKh028319;
	Tue, 17 Nov 2009 18:19:46 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200911171819.nAHIJkKh028319@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Tue, 17 Nov 2009 18:19:46 +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: r199413 - head/sys/dev/msk
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 17 Nov 2009 18:19:46 -0000

Author: yongari
Date: Tue Nov 17 18:19:45 2009
New Revision: 199413
URL: http://svn.freebsd.org/changeset/base/199413

Log:
  It seems generation of link state change of e1000phy(4) is not
  reliable on some Marvell PHYs. If msk(4) know it still does not
  have established link check whether msk(4) missed the link state
  change by looking into polled link state.
  
  Reported by:	Mel Flynn < mel.flynn+fbsd.current <> mailing.thruhere dot net >,
  		Gleb Kurtsou  gmail dot com >
  Tested by:	Gleb Kurtsou  gmail dot com >

Modified:
  head/sys/dev/msk/if_msk.c

Modified: head/sys/dev/msk/if_msk.c
==============================================================================
--- head/sys/dev/msk/if_msk.c	Tue Nov 17 17:53:52 2009	(r199412)
+++ head/sys/dev/msk/if_msk.c	Tue Nov 17 18:19:45 2009	(r199413)
@@ -3198,6 +3198,8 @@ msk_tick(void *xsc_if)
 	mii = device_get_softc(sc_if->msk_miibus);
 
 	mii_tick(mii);
+	if ((sc_if->msk_flags & MSK_FLAG_LINK) == 0)
+		msk_miibus_statchg(sc_if->msk_if_dev);
 	msk_watchdog(sc_if);
 	callout_reset(&sc_if->msk_tick_ch, hz, msk_tick, sc_if);
 }

From owner-svn-src-head@FreeBSD.ORG  Tue Nov 17 18:22:14 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 862B21065695;
	Tue, 17 Nov 2009 18:22: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 736E18FC23;
	Tue, 17 Nov 2009 18:22:14 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAHIMEdD028552;
	Tue, 17 Nov 2009 18:22:14 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAHIME0p028542;
	Tue, 17 Nov 2009 18:22:14 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200911171822.nAHIME0p028542@svn.freebsd.org>
From: John Baldwin 
Date: Tue, 17 Nov 2009 18:22: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: r199414 - in head/sys/dev: sn tl vge wb
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 17 Nov 2009 18:22:14 -0000

Author: jhb
Date: Tue Nov 17 18:22:14 2009
New Revision: 199414
URL: http://svn.freebsd.org/changeset/base/199414

Log:
  Use the bus_*() routines rather than bus_space_*() for register operations.

Modified:
  head/sys/dev/sn/if_sn.c
  head/sys/dev/sn/if_sn_pccard.c
  head/sys/dev/sn/if_snvar.h
  head/sys/dev/tl/if_tl.c
  head/sys/dev/tl/if_tlreg.h
  head/sys/dev/vge/if_vge.c
  head/sys/dev/vge/if_vgevar.h
  head/sys/dev/wb/if_wb.c
  head/sys/dev/wb/if_wbreg.h

Modified: head/sys/dev/sn/if_sn.c
==============================================================================
--- head/sys/dev/sn/if_sn.c	Tue Nov 17 18:19:45 2009	(r199413)
+++ head/sys/dev/sn/if_sn.c	Tue Nov 17 18:22:14 2009	(r199414)
@@ -1220,8 +1220,6 @@ sn_activate(device_t dev)
 		sn_deactivate(dev);
 		return ENOMEM;
 	}
-	sc->bst = rman_get_bustag(sc->port_res);
-	sc->bsh = rman_get_bushandle(sc->port_res);
 	return (0);
 }
 

Modified: head/sys/dev/sn/if_sn_pccard.c
==============================================================================
--- head/sys/dev/sn/if_sn_pccard.c	Tue Nov 17 18:19:45 2009	(r199413)
+++ head/sys/dev/sn/if_sn_pccard.c	Tue Nov 17 18:22:14 2009	(r199414)
@@ -271,8 +271,6 @@ sn_pccard_megahertz_activate(device_t de
 		sn_deactivate(dev);
 		return ENOMEM;
 	}
-	sc->bst = rman_get_bustag(sc->port_res);
-	sc->bsh = rman_get_bushandle(sc->port_res);
 	return 0;
 }
 

Modified: head/sys/dev/sn/if_snvar.h
==============================================================================
--- head/sys/dev/sn/if_snvar.h	Tue Nov 17 18:19:45 2009	(r199413)
+++ head/sys/dev/sn/if_snvar.h	Tue Nov 17 18:22:14 2009	(r199414)
@@ -32,8 +32,6 @@
 
 struct sn_softc {
 	struct ifnet    *ifp;
-	bus_space_tag_t	bst;
-	bus_space_handle_t bsh;
 	struct mtx sc_mtx;
 	int             pages_wanted;	/* Size of outstanding MMU ALLOC */
 	int             intr_mask;	/* Most recently set interrupt mask */
@@ -55,20 +53,20 @@ void	sn_intr(void *);
 int	sn_activate(device_t);
 void	sn_deactivate(device_t);
 
-#define CSR_READ_1(sc, off) (bus_space_read_1((sc)->bst, (sc)->bsh, off))
-#define CSR_READ_2(sc, off) (bus_space_read_2((sc)->bst, (sc)->bsh, off))
+#define CSR_READ_1(sc, off) (bus_read_1((sc)->port_res, off))
+#define CSR_READ_2(sc, off) (bus_read_2((sc)->port_res, off))
 #define CSR_WRITE_1(sc, off, val) \
-	bus_space_write_1(sc->bst, sc->bsh, off, val)
+	bus_write_1((sc)->port_res, off, val)
 #define CSR_WRITE_2(sc, off, val) \
-	bus_space_write_2(sc->bst, sc->bsh, off, val)
+	bus_write_2((sc)->port_res, off, val)
 #define CSR_WRITE_MULTI_1(sc, off, addr, count) \
-	bus_space_write_multi_1(sc->bst, sc->bsh, off, addr, count)
+	bus_write_multi_1((sc)->port_res, off, addr, count)
 #define CSR_WRITE_MULTI_2(sc, off, addr, count) \
-	bus_space_write_multi_2(sc->bst, sc->bsh, off, addr, count)
+	bus_write_multi_2((sc)->port_res, off, addr, count)
 #define CSR_READ_MULTI_1(sc, off, addr, count) \
-	bus_space_read_multi_1(sc->bst, sc->bsh, off, addr, count)
+	bus_read_multi_1((sc)->port_res, off, addr, count)
 #define CSR_READ_MULTI_2(sc, off, addr, count) \
-	bus_space_read_multi_2(sc->bst, sc->bsh, off, addr, count)
+	bus_read_multi_2((sc)->port_res, off, addr, count)
 
 #define SN_LOCK(_sc)		mtx_lock(&(_sc)->sc_mtx)
 #define	SN_UNLOCK(_sc)		mtx_unlock(&(_sc)->sc_mtx)

Modified: head/sys/dev/tl/if_tl.c
==============================================================================
--- head/sys/dev/tl/if_tl.c	Tue Nov 17 18:19:45 2009	(r199413)
+++ head/sys/dev/tl/if_tl.c	Tue Nov 17 18:22:14 2009	(r199414)
@@ -1170,9 +1170,6 @@ tl_attach(dev)
 		goto fail;
 	}
 
-	sc->tl_btag = rman_get_bustag(sc->tl_res);
-	sc->tl_bhandle = rman_get_bushandle(sc->tl_res);
-
 #ifdef notdef
 	/*
 	 * The ThunderLAN manual suggests jacking the PCI latency

Modified: head/sys/dev/tl/if_tlreg.h
==============================================================================
--- head/sys/dev/tl/if_tlreg.h	Tue Nov 17 18:19:45 2009	(r199413)
+++ head/sys/dev/tl/if_tlreg.h	Tue Nov 17 18:22:14 2009	(r199414)
@@ -112,8 +112,6 @@ struct tl_softc {
 	struct ifnet		*tl_ifp;
 	device_t		tl_dev;
 	struct ifmedia		ifmedia;	/* media info */
-	bus_space_handle_t	tl_bhandle;
-	bus_space_tag_t		tl_btag;
 	void			*tl_intrhand;
 	struct resource		*tl_irq;
 	struct resource		*tl_res;
@@ -493,19 +491,13 @@ struct tl_stats {
 /*
  * register space access macros
  */
-#define CSR_WRITE_4(sc, reg, val)	\
-	bus_space_write_4(sc->tl_btag, sc->tl_bhandle, reg, val)
-#define CSR_WRITE_2(sc, reg, val)	\
-	bus_space_write_2(sc->tl_btag, sc->tl_bhandle, reg, val)
-#define CSR_WRITE_1(sc, reg, val)	\
-	bus_space_write_1(sc->tl_btag, sc->tl_bhandle, reg, val)
-
-#define CSR_READ_4(sc, reg)		\
-	bus_space_read_4(sc->tl_btag, sc->tl_bhandle, reg)
-#define CSR_READ_2(sc, reg)		\
-	bus_space_read_2(sc->tl_btag, sc->tl_bhandle, reg)
-#define CSR_READ_1(sc, reg)		\
-	bus_space_read_1(sc->tl_btag, sc->tl_bhandle, reg)
+#define CSR_WRITE_4(sc, reg, val)	bus_write_4(sc->tl_res, reg, val)
+#define CSR_WRITE_2(sc, reg, val)	bus_write_2(sc->tl_res, reg, val)
+#define CSR_WRITE_1(sc, reg, val)	bus_write_1(sc->tl_res, reg, val)
+
+#define CSR_READ_4(sc, reg)		bus_read_4(sc->tl_res, reg)
+#define CSR_READ_2(sc, reg)		bus_read_2(sc->tl_res, reg)
+#define CSR_READ_1(sc, reg)		bus_read_1(sc->tl_res, reg)
 
 #define CMD_PUT(sc, x) CSR_WRITE_4(sc, TL_HOSTCMD, x)
 #define CMD_SET(sc, x)	\

Modified: head/sys/dev/vge/if_vge.c
==============================================================================
--- head/sys/dev/vge/if_vge.c	Tue Nov 17 18:19:45 2009	(r199413)
+++ head/sys/dev/vge/if_vge.c	Tue Nov 17 18:22:14 2009	(r199414)
@@ -945,9 +945,6 @@ vge_attach(dev)
 		goto fail;
 	}
 
-	sc->vge_btag = rman_get_bustag(sc->vge_res);
-	sc->vge_bhandle = rman_get_bushandle(sc->vge_res);
-
 	/* Allocate interrupt */
 	rid = 0;
 	sc->vge_irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid,

Modified: head/sys/dev/vge/if_vgevar.h
==============================================================================
--- head/sys/dev/vge/if_vgevar.h	Tue Nov 17 18:19:45 2009	(r199413)
+++ head/sys/dev/vge/if_vgevar.h	Tue Nov 17 18:22:14 2009	(r199414)
@@ -100,8 +100,6 @@ struct vge_list_data {
 struct vge_softc {
 	struct ifnet		*vge_ifp;	/* interface info */
 	device_t		vge_dev;
-	bus_space_handle_t	vge_bhandle;	/* bus space handle */
-	bus_space_tag_t		vge_btag;	/* bus space tag */
 	struct resource		*vge_res;
 	struct resource		*vge_irq;
 	void			*vge_intrhand;
@@ -134,20 +132,20 @@ struct vge_softc {
  * register space access macros
  */
 #define CSR_WRITE_STREAM_4(sc, reg, val)	\
-	bus_space_write_stream_4(sc->vge_btag, sc->vge_bhandle, reg, val)
+	bus_write_stream_4(sc->vge_res, reg, val)
 #define CSR_WRITE_4(sc, reg, val)	\
-	bus_space_write_4(sc->vge_btag, sc->vge_bhandle, reg, val)
+	bus_write_4(sc->vge_res, reg, val)
 #define CSR_WRITE_2(sc, reg, val)	\
-	bus_space_write_2(sc->vge_btag, sc->vge_bhandle, reg, val)
+	bus_write_2(sc->vge_res, reg, val)
 #define CSR_WRITE_1(sc, reg, val)	\
-	bus_space_write_1(sc->vge_btag, sc->vge_bhandle, reg, val)
+	bus_write_1(sc->vge_res, reg, val)
 
 #define CSR_READ_4(sc, reg)		\
-	bus_space_read_4(sc->vge_btag, sc->vge_bhandle, reg)
+	bus_read_4(sc->vge_res, reg)
 #define CSR_READ_2(sc, reg)		\
-	bus_space_read_2(sc->vge_btag, sc->vge_bhandle, reg)
+	bus_read_2(sc->vge_res, reg)
 #define CSR_READ_1(sc, reg)		\
-	bus_space_read_1(sc->vge_btag, sc->vge_bhandle, reg)
+	bus_read_1(sc->vge_res, reg)
 
 #define CSR_SETBIT_1(sc, reg, x)	\
 	CSR_WRITE_1(sc, reg, CSR_READ_1(sc, reg) | (x))

Modified: head/sys/dev/wb/if_wb.c
==============================================================================
--- head/sys/dev/wb/if_wb.c	Tue Nov 17 18:19:45 2009	(r199413)
+++ head/sys/dev/wb/if_wb.c	Tue Nov 17 18:22:14 2009	(r199414)
@@ -804,9 +804,6 @@ wb_attach(dev)
 		goto fail;
 	}
 
-	sc->wb_btag = rman_get_bustag(sc->wb_res);
-	sc->wb_bhandle = rman_get_bushandle(sc->wb_res);
-
 	/* Allocate interrupt */
 	rid = 0;
 	sc->wb_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,

Modified: head/sys/dev/wb/if_wbreg.h
==============================================================================
--- head/sys/dev/wb/if_wbreg.h	Tue Nov 17 18:19:45 2009	(r199413)
+++ head/sys/dev/wb/if_wbreg.h	Tue Nov 17 18:22:14 2009	(r199414)
@@ -365,8 +365,6 @@ struct wb_softc {
 	struct ifnet		*wb_ifp;	/* interface info */
 	device_t		wb_dev;
 	device_t		wb_miibus;
-	bus_space_handle_t	wb_bhandle;
-	bus_space_tag_t		wb_btag;
 	struct resource		*wb_res;
 	struct resource		*wb_irq;
 	void			*wb_intrhand;
@@ -388,19 +386,13 @@ struct wb_softc {
 /*
  * register space access macros
  */
-#define CSR_WRITE_4(sc, reg, val)	\
-	bus_space_write_4(sc->wb_btag, sc->wb_bhandle, reg, val)
-#define CSR_WRITE_2(sc, reg, val)	\
-	bus_space_write_2(sc->wb_btag, sc->wb_bhandle, reg, val)
-#define CSR_WRITE_1(sc, reg, val)	\
-	bus_space_write_1(sc->wb_btag, sc->wb_bhandle, reg, val)
-
-#define CSR_READ_4(sc, reg)	\
-	bus_space_read_4(sc->wb_btag, sc->wb_bhandle, reg)
-#define CSR_READ_2(sc, reg)	\
-	bus_space_read_2(sc->wb_btag, sc->wb_bhandle, reg)
-#define CSR_READ_1(sc, reg)	\
-	bus_space_read_1(sc->wb_btag, sc->wb_bhandle, reg)
+#define CSR_WRITE_4(sc, reg, val)	bus_write_4(sc->wb_res, reg, val)
+#define CSR_WRITE_2(sc, reg, val)	bus_write_2(sc->wb_res, reg, val)
+#define CSR_WRITE_1(sc, reg, val)	bus_write_1(sc->wb_res, reg, val)
+
+#define CSR_READ_4(sc, reg)		bus_read_4(sc->wb_res, reg)
+#define CSR_READ_2(sc, reg)		bus_read_2(sc->wb_res, reg)
+#define CSR_READ_1(sc, reg)		bus_read_1(sc->wb_res, reg)
 
 #define WB_TIMEOUT		1000
 

From owner-svn-src-head@FreeBSD.ORG  Tue Nov 17 18:44:50 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 27BF7106566B;
	Tue, 17 Nov 2009 18:44:50 +0000 (UTC)
	(envelope-from jilles@crab.stack.nl)
Received: from crab.stack.nl (crab.stack.nl [131.155.140.134])
	by mx1.freebsd.org (Postfix) with ESMTP id DFB408FC1B;
	Tue, 17 Nov 2009 18:44:49 +0000 (UTC)
Received: by crab.stack.nl (Postfix, from userid 1677)
	id 093FE5C53; Tue, 17 Nov 2009 19:25:02 +0100 (CET)
Date: Tue, 17 Nov 2009 19:25:01 +0100
From: Jilles Tjoelker 
To: Dmitry Pryanishnikov 
Message-ID: <20091117182501.GA70742@stack.nl>
References: <4B01E548.7040708@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <4B01E548.7040708@gmail.com>
User-Agent: Mutt/1.5.20 (2009-06-14)
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, Edwin Groothuis 
Subject: Re: svn commit: r194783 - head/lib/libc/stdtime
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 17 Nov 2009 18:44:50 -0000

On Tue, Nov 17, 2009 at 01:50:32AM +0200, Dmitry Pryanishnikov wrote:
> > Author: edwin
> > Date: Tue Jun 23 22:28:44 2009
> > New Revision: 194783
> > URL: http://svn.freebsd.org/changeset/base/194783

> > Log:
> >   Remove duplicate if-statement on gmt_is_set in gmtsub().

> >   MFC after:	1 week

> > Modified:
> >   head/lib/libc/stdtime/localtime.c

>    This change looks like a (small?) pessimization to me: before it, 
> _MUTEX_LOCK/_MUTEX_UNLOCK pair would be skipped for the case gmt_is_set 
> == TRUE (all invocations except the first one), now it won't. I'm not 
> sure whether this is critical here though...

It is certainly less efficient, but the old code was (most likely)
wrong. It used an idiom known as "double checked locking", which is
incorrect in most memory models. The problem is that the store to
gmt_is_set may become visible without stores to other memory (gmtptr and
what it points to) becoming visible.

-- 
Jilles Tjoelker

From owner-svn-src-head@FreeBSD.ORG  Tue Nov 17 18:57:44 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 78042106566C;
	Tue, 17 Nov 2009 18:57:44 +0000 (UTC)
	(envelope-from gabor@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 671BE8FC25;
	Tue, 17 Nov 2009 18:57:44 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAHIviRX031114;
	Tue, 17 Nov 2009 18:57:44 GMT (envelope-from gabor@svn.freebsd.org)
Received: (from gabor@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAHIviGi031113;
	Tue, 17 Nov 2009 18:57:44 GMT (envelope-from gabor@svn.freebsd.org)
Message-Id: <200911171857.nAHIviGi031113@svn.freebsd.org>
From: Gabor Kovesdan 
Date: Tue, 17 Nov 2009 18:57:44 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r199417 - head/lib/libc/nls
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 17 Nov 2009 18:57:44 -0000

Author: gabor (doc,ports committer)
Date: Tue Nov 17 18:57:44 2009
New Revision: 199417
URL: http://svn.freebsd.org/changeset/base/199417

Log:
  - Update Hungarian libc catalog

Modified:
  head/lib/libc/nls/hu_HU.ISO8859-2.msg

Modified: head/lib/libc/nls/hu_HU.ISO8859-2.msg
==============================================================================
--- head/lib/libc/nls/hu_HU.ISO8859-2.msg	Tue Nov 17 18:38:00 2009	(r199416)
+++ head/lib/libc/nls/hu_HU.ISO8859-2.msg	Tue Nov 17 18:57:44 2009	(r199417)
@@ -181,6 +181,16 @@ $ ENOATTR
 87 Attribútum nem található
 $ EDOOFUS
 88 Programozási hiba
+$ EBADMSG
+89 Helytelen üzenet
+$ EMULTIHOP
+90 Multihop kísérlet
+$ ENOLINK
+91 A kapcsolat szigorítva lett
+$ EPROTO
+92 Protokol hiba
+$ ENOTCAPABLE
+93 Elégtelen képességek
 $
 $ strsignal() support catalog
 $
@@ -247,3 +257,39 @@ $ SIGUSR1
 30 Felhasználói szignál 1
 $ SIGUSR2
 31 Felhasználói szignál 2
+$
+$ gai_strerror() support catalog
+$
+$set 3
+$ 1 (elavult)
+1 A hosztnévhez tartozó címcsalád nem támogatott
+$ EAI_AGAIN
+2 Ideiglenes hiba a névfeloldáskor
+$ EAI_BADFLAGS
+3 Érvénytelen ai_flags érték
+$ EAI_FAIL
+4 Nem helyreállítható hiba a névfeloldásban
+$ EAI_FAMILY
+5 ai_family nem támogatott
+$ EAI_MEMORY
+6 Memóriafoglalási hiba
+$ 7 (elavult)
+7 Nem tartozik cím í hosztnévhez
+$ EAI_NONAME
+8 Se hosztnév, se szolgáltatásnév nem áll rendelkezésre
+$ EAI_SERVICE
+9 Nem támogatott ai_socktype szolgáltatásnév
+$ EAI_SOCKTYPE
+10 ai_socktype nem támogatott
+$ EAI_SYSTEM
+11 Rendszerhiba jött vissza az errno változóban
+$ EAI_BADHINTS
+12 Érvénytelen hint érték
+$ EAI_PROTOCOL
+13 A feloldott protokol ismeretlen
+$ EAI_OVERFLOW
+14 Az argumentumok puffere túlcsordult
+$ 0
+32766 Siker
+$ NL_MSGMAX
+32767 Ismeretlen hiba

From owner-svn-src-head@FreeBSD.ORG  Tue Nov 17 19:24:26 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 66120106566B;
	Tue, 17 Nov 2009 19:24:26 +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 552DF8FC16;
	Tue, 17 Nov 2009 19:24:26 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAHJOQWu032546;
	Tue, 17 Nov 2009 19:24:26 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAHJOQIh032544;
	Tue, 17 Nov 2009 19:24:26 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <200911171924.nAHJOQIh032544@svn.freebsd.org>
From: Konstantin Belousov 
Date: Tue, 17 Nov 2009 19:24: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: r199418 - head/sys/dev/syscons
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 17 Nov 2009 19:24:26 -0000

Author: kib
Date: Tue Nov 17 19:24:26 2009
New Revision: 199418
URL: http://svn.freebsd.org/changeset/base/199418

Log:
  Fix pgsignal() call after signature change in r199355.
  
  Reported and tested by:	bf1783 googlemail com
  MFC after:	1 month

Modified:
  head/sys/dev/syscons/scvidctl.c

Modified: head/sys/dev/syscons/scvidctl.c
==============================================================================
--- head/sys/dev/syscons/scvidctl.c	Tue Nov 17 18:57:44 2009	(r199417)
+++ head/sys/dev/syscons/scvidctl.c	Tue Nov 17 19:24:26 2009	(r199418)
@@ -321,6 +321,7 @@ sc_set_pixel_mode(scr_stat *scp, struct 
     return ENODEV;
 #else
     video_info_t info;
+    ksiginfo_t ksi;
     u_char *font;
     int prev_ysize;
     int error;
@@ -458,8 +459,11 @@ sc_set_pixel_mode(scr_stat *scp, struct 
 	tp->t_winsize.ws_col = scp->xsize;
 	tp->t_winsize.ws_row = scp->ysize;
 	if (tp->t_pgrp != NULL) {
+	    ksiginfo_init(&ksi);
+	    ksi.ksi_signo = SIGWINCH;
+	    ksi.ksi_code = SI_KERNEL;
 	    PGRP_LOCK(tp->t_pgrp);
-	    pgsignal(tp->t_pgrp, SIGWINCH, 1);
+	    pgsignal(tp->t_pgrp, SIGWINCH, 1, &ksi);
 	    PGRP_UNLOCK(tp->t_pgrp);
 	}
     }

From owner-svn-src-head@FreeBSD.ORG  Tue Nov 17 19:35:11 2009
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from [127.0.0.1] (freefall.freebsd.org [IPv6:2001:4f8:fff6::28])
	by hub.freebsd.org (Postfix) with ESMTP id CCBDE106568B;
	Tue, 17 Nov 2009 19:35:10 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
From: Jung-uk Kim 
To: src-committers@FreeBSD.org
Date: Tue, 17 Nov 2009 14:34:54 -0500
User-Agent: KMail/1.6.2
References: <200911171924.nAHJOQIh032544@svn.freebsd.org>
In-Reply-To: <200911171924.nAHJOQIh032544@svn.freebsd.org>
MIME-Version: 1.0
Content-Disposition: inline
Content-Type: Multipart/Mixed;
  boundary="Boundary-00=_grvALVEc9GqwctC"
Message-Id: <200911171434.56358.jkim@FreeBSD.org>
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	Konstantin Belousov 
Subject: Re: svn commit: r199418 - head/sys/dev/syscons
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 17 Nov 2009 19:35:11 -0000


--Boundary-00=_grvALVEc9GqwctC
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Tuesday 17 November 2009 02:24 pm, Konstantin Belousov wrote:
> Author: kib
> Date: Tue Nov 17 19:24:26 2009
> New Revision: 199418
> URL: http://svn.freebsd.org/changeset/base/199418
>
> Log:
>   Fix pgsignal() call after signature change in r199355.
>
>   Reported and tested by:	bf1783 googlemail com
>   MFC after:	1 month
>
> Modified:
>   head/sys/dev/syscons/scvidctl.c
>
> Modified: head/sys/dev/syscons/scvidctl.c
> ===================================================================
>=========== --- head/sys/dev/syscons/scvidctl.c	Tue Nov 17 18:57:44
> 2009	(r199417) +++ head/sys/dev/syscons/scvidctl.c	Tue Nov 17
> 19:24:26 2009	(r199418) @@ -321,6 +321,7 @@
> sc_set_pixel_mode(scr_stat *scp, struct return ENODEV;
>  #else
>      video_info_t info;
> +    ksiginfo_t ksi;
>      u_char *font;
>      int prev_ysize;
>      int error;
> @@ -458,8 +459,11 @@ sc_set_pixel_mode(scr_stat *scp, struct
>  	tp->t_winsize.ws_col = scp->xsize;
>  	tp->t_winsize.ws_row = scp->ysize;
>  	if (tp->t_pgrp != NULL) {
> +	    ksiginfo_init(&ksi);
> +	    ksi.ksi_signo = SIGWINCH;
> +	    ksi.ksi_code = SI_KERNEL;
>  	    PGRP_LOCK(tp->t_pgrp);
> -	    pgsignal(tp->t_pgrp, SIGWINCH, 1);
> +	    pgsignal(tp->t_pgrp, SIGWINCH, 1, &ksi);
>  	    PGRP_UNLOCK(tp->t_pgrp);
>  	}
>      }

Probably you wanted this:

--- sys/dev/syscons/scvidctl.c
+++ sys/dev/syscons/scvidctl.c
@@ -321,7 +321,6 @@ sc_set_pixel_mode(scr_stat *scp, struct tty *tp, i
     return ENODEV;
 #else
     video_info_t info;
-    ksiginfo_t ksi;
     u_char *font;
     int prev_ysize;
     int error;
@@ -458,14 +457,8 @@ sc_set_pixel_mode(scr_stat *scp, struct tty *tp, i
        || tp->t_winsize.ws_row != scp->ysize) {
        tp->t_winsize.ws_col = scp->xsize;
        tp->t_winsize.ws_row = scp->ysize;
-       if (tp->t_pgrp != NULL) {
-           ksiginfo_init(&ksi);
-           ksi.ksi_signo = SIGWINCH;
-           ksi.ksi_code = SI_KERNEL;
-           PGRP_LOCK(tp->t_pgrp);
-           pgsignal(tp->t_pgrp, SIGWINCH, 1, &ksi);
-           PGRP_UNLOCK(tp->t_pgrp);
-       }
+
+       tty_signal_pgrp(tp, SIGWINCH);
     }
 
     return 0;
------------------------------------------------------------------

In fact, it seems it was missed in r181905.

Jung-uk Kim

--Boundary-00=_grvALVEc9GqwctC
Content-Type: text/x-diff;
  charset="iso-8859-1";
  name="scvidctl.c.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="scvidctl.c.diff"

--- sys/dev/syscons/scvidctl.c
+++ sys/dev/syscons/scvidctl.c
@@ -321,7 +321,6 @@ sc_set_pixel_mode(scr_stat *scp, struct tty *tp, i
     return ENODEV;
 #else
     video_info_t info;
-    ksiginfo_t ksi;
     u_char *font;
     int prev_ysize;
     int error;
@@ -458,14 +457,8 @@ sc_set_pixel_mode(scr_stat *scp, struct tty *tp, i
 	|| tp->t_winsize.ws_row != scp->ysize) {
 	tp->t_winsize.ws_col = scp->xsize;
 	tp->t_winsize.ws_row = scp->ysize;
-	if (tp->t_pgrp != NULL) {
-	    ksiginfo_init(&ksi);
-	    ksi.ksi_signo = SIGWINCH;
-	    ksi.ksi_code = SI_KERNEL;
-	    PGRP_LOCK(tp->t_pgrp);
-	    pgsignal(tp->t_pgrp, SIGWINCH, 1, &ksi);
-	    PGRP_UNLOCK(tp->t_pgrp);
-	}
+
+	tty_signal_pgrp(tp, SIGWINCH);
     }
 
     return 0;

--Boundary-00=_grvALVEc9GqwctC--

From owner-svn-src-head@FreeBSD.ORG  Tue Nov 17 19:35:39 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 87A181065698;
	Tue, 17 Nov 2009 19:35:39 +0000 (UTC)
	(envelope-from obrien@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 76BAE8FC1A;
	Tue, 17 Nov 2009 19:35:39 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAHJZddU033171;
	Tue, 17 Nov 2009 19:35:39 GMT (envelope-from obrien@svn.freebsd.org)
Received: (from obrien@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAHJZdbQ033168;
	Tue, 17 Nov 2009 19:35:39 GMT (envelope-from obrien@svn.freebsd.org)
Message-Id: <200911171935.nAHJZdbQ033168@svn.freebsd.org>
From: "David E. O'Brien" 
Date: Tue, 17 Nov 2009 19:35: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: r199419 - head/usr.bin/make
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 17 Nov 2009 19:35:39 -0000

Author: obrien
Date: Tue Nov 17 19:35:39 2009
New Revision: 199419
URL: http://svn.freebsd.org/changeset/base/199419

Log:
  Catch up with r144020's /Dir_FindFile/Path_FindFile/

Modified:
  head/usr.bin/make/arch.c
  head/usr.bin/make/dir.c

Modified: head/usr.bin/make/arch.c
==============================================================================
--- head/usr.bin/make/arch.c	Tue Nov 17 19:24:26 2009	(r199418)
+++ head/usr.bin/make/arch.c	Tue Nov 17 19:35:39 2009	(r199419)
@@ -1131,7 +1131,7 @@ Arch_MemMTime(GNode *gn)
  *	command (or the linker will know where to find it) and set the
  *	TARGET variable for this node to be the node's name. Otherwise,
  *	we set the TARGET variable to be the full path of the library,
- *	as returned by Dir_FindFile.
+ *	as returned by Path_FindFile.
  *
  *-----------------------------------------------------------------------
  */

Modified: head/usr.bin/make/dir.c
==============================================================================
--- head/usr.bin/make/dir.c	Tue Nov 17 19:24:26 2009	(r199418)
+++ head/usr.bin/make/dir.c	Tue Nov 17 19:35:39 2009	(r199419)
@@ -862,7 +862,7 @@ Path_FindFile(char *name, struct Path *p
  *
  * Side Effects:
  *	The modification time is placed in the node's mtime slot.
- *	If the node didn't have a path entry before, and Dir_FindFile
+ *	If the node didn't have a path entry before, and Path_FindFile
  *	found one for it, the full name is placed in the path slot.
  *-----------------------------------------------------------------------
  */

From owner-svn-src-head@FreeBSD.ORG  Tue Nov 17 19:50:13 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9FF1710656C5;
	Tue, 17 Nov 2009 19:50:13 +0000 (UTC)
	(envelope-from kostikbel@gmail.com)
Received: from mail.zoral.com.ua (skuns.zoral.com.ua [91.193.166.194])
	by mx1.freebsd.org (Postfix) with ESMTP id 2D94E8FC13;
	Tue, 17 Nov 2009 19:50:12 +0000 (UTC)
Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua
	[10.1.1.148])
	by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id nAHJo8HG078921
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Tue, 17 Nov 2009 21:50:08 +0200 (EET)
	(envelope-from kostikbel@gmail.com)
Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1])
	by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id
	nAHJo8dx084045; Tue, 17 Nov 2009 21:50:08 +0200 (EET)
	(envelope-from kostikbel@gmail.com)
Received: (from kostik@localhost)
	by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id nAHJo8Tx084044; 
	Tue, 17 Nov 2009 21:50:08 +0200 (EET)
	(envelope-from kostikbel@gmail.com)
X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to
	kostikbel@gmail.com using -f
Date: Tue, 17 Nov 2009 21:50:08 +0200
From: Kostik Belousov 
To: Jung-uk Kim 
Message-ID: <20091117195008.GH2331@deviant.kiev.zoral.com.ua>
References: <200911171924.nAHJOQIh032544@svn.freebsd.org>
	<200911171434.56358.jkim@FreeBSD.org>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="qOvqZqNrf4y6v2y5"
Content-Disposition: inline
In-Reply-To: <200911171434.56358.jkim@FreeBSD.org>
User-Agent: Mutt/1.4.2.3i
X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua
X-Virus-Status: Clean
X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00
	autolearn=ham version=3.2.5
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on
	skuns.kiev.zoral.com.ua
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r199418 - head/sys/dev/syscons
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 17 Nov 2009 19:50:13 -0000


--qOvqZqNrf4y6v2y5
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Nov 17, 2009 at 02:34:54PM -0500, Jung-uk Kim wrote:
> On Tuesday 17 November 2009 02:24 pm, Konstantin Belousov wrote:
> > Author: kib
> > Date: Tue Nov 17 19:24:26 2009
> > New Revision: 199418
> > URL: http://svn.freebsd.org/changeset/base/199418
> >
> > Log:
> >   Fix pgsignal() call after signature change in r199355.
> >
> >   Reported and tested by:	bf1783 googlemail com
> >   MFC after:	1 month
> >
> > Modified:
> >   head/sys/dev/syscons/scvidctl.c
> >
> > Modified: head/sys/dev/syscons/scvidctl.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/syscons/scvidctl.c	Tu=
e Nov 17 18:57:44
> > 2009	(r199417) +++ head/sys/dev/syscons/scvidctl.c	Tue Nov 17
> > 19:24:26 2009	(r199418) @@ -321,6 +321,7 @@
> > sc_set_pixel_mode(scr_stat *scp, struct return ENODEV;
> >  #else
> >      video_info_t info;
> > +    ksiginfo_t ksi;
> >      u_char *font;
> >      int prev_ysize;
> >      int error;
> > @@ -458,8 +459,11 @@ sc_set_pixel_mode(scr_stat *scp, struct
> >  	tp->t_winsize.ws_col =3D scp->xsize;
> >  	tp->t_winsize.ws_row =3D scp->ysize;
> >  	if (tp->t_pgrp !=3D NULL) {
> > +	    ksiginfo_init(&ksi);
> > +	    ksi.ksi_signo =3D SIGWINCH;
> > +	    ksi.ksi_code =3D SI_KERNEL;
> >  	    PGRP_LOCK(tp->t_pgrp);
> > -	    pgsignal(tp->t_pgrp, SIGWINCH, 1);
> > +	    pgsignal(tp->t_pgrp, SIGWINCH, 1, &ksi);
> >  	    PGRP_UNLOCK(tp->t_pgrp);
> >  	}
> >      }
>=20
> Probably you wanted this:
>=20
> --- sys/dev/syscons/scvidctl.c
> +++ sys/dev/syscons/scvidctl.c
> @@ -321,7 +321,6 @@ sc_set_pixel_mode(scr_stat *scp, struct tty *tp, i
>      return ENODEV;
>  #else
>      video_info_t info;
> -    ksiginfo_t ksi;
>      u_char *font;
>      int prev_ysize;
>      int error;
> @@ -458,14 +457,8 @@ sc_set_pixel_mode(scr_stat *scp, struct tty *tp, i
>         || tp->t_winsize.ws_row !=3D scp->ysize) {
>         tp->t_winsize.ws_col =3D scp->xsize;
>         tp->t_winsize.ws_row =3D scp->ysize;
> -       if (tp->t_pgrp !=3D NULL) {
> -           ksiginfo_init(&ksi);
> -           ksi.ksi_signo =3D SIGWINCH;
> -           ksi.ksi_code =3D SI_KERNEL;
> -           PGRP_LOCK(tp->t_pgrp);
> -           pgsignal(tp->t_pgrp, SIGWINCH, 1, &ksi);
> -           PGRP_UNLOCK(tp->t_pgrp);
> -       }
> +
> +       tty_signal_pgrp(tp, SIGWINCH);
>      }
> =20
>      return 0;
> ------------------------------------------------------------------
>=20
> In fact, it seems it was missed in r181905.
>=20
> Jung-uk Kim

I do not think so, at least it needs further considerations.
First, call to tty_signal_pgrp() requires locked tty.
Second, tty_signal_pgrp() restores i/o processing on the terminal,
	tp->t_flags &=3D ~TF_STOPPED;
that is not quite obviously right thing to do on SIGWINCH.


--qOvqZqNrf4y6v2y5
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (FreeBSD)

iEYEARECAAYFAksC/nAACgkQC3+MBN1Mb4hrnQCfbyLMUGGuI4ZwzECtvsXyVd2e
Gd0Anil753cThd7joNwmYP/Od/uGBSAc
=BpuX
-----END PGP SIGNATURE-----

--qOvqZqNrf4y6v2y5--

From owner-svn-src-head@FreeBSD.ORG  Tue Nov 17 20:01:04 2009
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from [127.0.0.1] (freefall.freebsd.org [IPv6:2001:4f8:fff6::28])
	by hub.freebsd.org (Postfix) with ESMTP id 1BB0E1065670;
	Tue, 17 Nov 2009 20:01:04 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
From: Jung-uk Kim 
To: Kostik Belousov 
Date: Tue, 17 Nov 2009 15:00:49 -0500
User-Agent: KMail/1.6.2
References: <200911171924.nAHJOQIh032544@svn.freebsd.org>
	<200911171434.56358.jkim@FreeBSD.org>
	<20091117195008.GH2331@deviant.kiev.zoral.com.ua>
In-Reply-To: <20091117195008.GH2331@deviant.kiev.zoral.com.ua>
MIME-Version: 1.0
Content-Disposition: inline
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Message-Id: <200911171500.52995.jkim@FreeBSD.org>
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r199418 - head/sys/dev/syscons
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 17 Nov 2009 20:01:04 -0000

On Tuesday 17 November 2009 02:50 pm, Kostik Belousov wrote:
> On Tue, Nov 17, 2009 at 02:34:54PM -0500, Jung-uk Kim wrote:
> > On Tuesday 17 November 2009 02:24 pm, Konstantin Belousov wrote:
> > > Author: kib
> > > Date: Tue Nov 17 19:24:26 2009
> > > New Revision: 199418
> > > URL: http://svn.freebsd.org/changeset/base/199418
> > >
> > > Log:
> > >   Fix pgsignal() call after signature change in r199355.
> > >
> > >   Reported and tested by:	bf1783 googlemail com
> > >   MFC after:	1 month
> > >
> > > Modified:
> > >   head/sys/dev/syscons/scvidctl.c
> > >
> > > Modified: head/sys/dev/syscons/scvidctl.c
> > > ===============================================================
> > >==== =========== --- head/sys/dev/syscons/scvidctl.c	Tue Nov 17
> > > 18:57:44 2009	(r199417) +++ head/sys/dev/syscons/scvidctl.c	Tue
> > > Nov 17 19:24:26 2009	(r199418) @@ -321,6 +321,7 @@
> > > sc_set_pixel_mode(scr_stat *scp, struct return ENODEV;
> > >  #else
> > >      video_info_t info;
> > > +    ksiginfo_t ksi;
> > >      u_char *font;
> > >      int prev_ysize;
> > >      int error;
> > > @@ -458,8 +459,11 @@ sc_set_pixel_mode(scr_stat *scp, struct
> > >  	tp->t_winsize.ws_col = scp->xsize;
> > >  	tp->t_winsize.ws_row = scp->ysize;
> > >  	if (tp->t_pgrp != NULL) {
> > > +	    ksiginfo_init(&ksi);
> > > +	    ksi.ksi_signo = SIGWINCH;
> > > +	    ksi.ksi_code = SI_KERNEL;
> > >  	    PGRP_LOCK(tp->t_pgrp);
> > > -	    pgsignal(tp->t_pgrp, SIGWINCH, 1);
> > > +	    pgsignal(tp->t_pgrp, SIGWINCH, 1, &ksi);
> > >  	    PGRP_UNLOCK(tp->t_pgrp);
> > >  	}
> > >      }
> >
> > Probably you wanted this:
> >
> > --- sys/dev/syscons/scvidctl.c
> > +++ sys/dev/syscons/scvidctl.c
> > @@ -321,7 +321,6 @@ sc_set_pixel_mode(scr_stat *scp, struct tty
> > *tp, i return ENODEV;
> >  #else
> >      video_info_t info;
> > -    ksiginfo_t ksi;
> >      u_char *font;
> >      int prev_ysize;
> >      int error;
> > @@ -458,14 +457,8 @@ sc_set_pixel_mode(scr_stat *scp, struct tty
> > *tp, i
> >
> >         || tp->t_winsize.ws_row != scp->ysize) {
> >
> >         tp->t_winsize.ws_col = scp->xsize;
> >         tp->t_winsize.ws_row = scp->ysize;
> > -       if (tp->t_pgrp != NULL) {
> > -           ksiginfo_init(&ksi);
> > -           ksi.ksi_signo = SIGWINCH;
> > -           ksi.ksi_code = SI_KERNEL;
> > -           PGRP_LOCK(tp->t_pgrp);
> > -           pgsignal(tp->t_pgrp, SIGWINCH, 1, &ksi);
> > -           PGRP_UNLOCK(tp->t_pgrp);
> > -       }
> > +
> > +       tty_signal_pgrp(tp, SIGWINCH);
> >      }
> >
> >      return 0;
> > -----------------------------------------------------------------
> >-
> >
> > In fact, it seems it was missed in r181905.
> >
> > Jung-uk Kim
>
> I do not think so, at least it needs further considerations.
> First, call to tty_signal_pgrp() requires locked tty.
> Second, tty_signal_pgrp() restores i/o processing on the terminal,
> 	tp->t_flags &= ~TF_STOPPED;
> that is not quite obviously right thing to do on SIGWINCH.

If so, r181905 is wrong, too:

http://svn.freebsd.org/viewvc/base/head/sys/dev/syscons/scvidctl.c?r1=181905&r2=181904&pathrev=181905

Jung-uk Kim

From owner-svn-src-head@FreeBSD.ORG  Tue Nov 17 20:56:14 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DBDC91065695;
	Tue, 17 Nov 2009 20:56:14 +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 CBA528FC16;
	Tue, 17 Nov 2009 20:56:14 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAHKuEkR038044;
	Tue, 17 Nov 2009 20:56:14 GMT (envelope-from tuexen@svn.freebsd.org)
Received: (from tuexen@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAHKuEXf038039;
	Tue, 17 Nov 2009 20:56:14 GMT (envelope-from tuexen@svn.freebsd.org)
Message-Id: <200911172056.nAHKuEXf038039@svn.freebsd.org>
From: Michael Tuexen 
Date: Tue, 17 Nov 2009 20:56: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: r199437 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 17 Nov 2009 20:56:15 -0000

Author: tuexen
Date: Tue Nov 17 20:56:14 2009
New Revision: 199437
URL: http://svn.freebsd.org/changeset/base/199437

Log:
  Use always LIST_EMPTY instead of sometime SCTP_LIST_EMPTY,
  which is defined as LIST_EMPTY.
  
  Approved by: rrs (mentor)
  MFC after: 1 month

Modified:
  head/sys/netinet/sctp_auth.c
  head/sys/netinet/sctp_os_bsd.h
  head/sys/netinet/sctp_pcb.c
  head/sys/netinet/sctp_usrreq.c

Modified: head/sys/netinet/sctp_auth.c
==============================================================================
--- head/sys/netinet/sctp_auth.c	Tue Nov 17 20:54:52 2009	(r199436)
+++ head/sys/netinet/sctp_auth.c	Tue Nov 17 20:56:14 2009	(r199437)
@@ -573,7 +573,7 @@ sctp_insert_sharedkey(struct sctp_keyhea
 		return (EINVAL);
 
 	/* insert into an empty list? */
-	if (SCTP_LIST_EMPTY(shared_keys)) {
+	if (LIST_EMPTY(shared_keys)) {
 		LIST_INSERT_HEAD(shared_keys, new_skey, next);
 		return (0);
 	}

Modified: head/sys/netinet/sctp_os_bsd.h
==============================================================================
--- head/sys/netinet/sctp_os_bsd.h	Tue Nov 17 20:54:52 2009	(r199436)
+++ head/sys/netinet/sctp_os_bsd.h	Tue Nov 17 20:56:14 2009	(r199437)
@@ -153,7 +153,6 @@ MALLOC_DECLARE(SCTP_M_SOCKOPT);
  *
  */
 #define USER_ADDR_NULL	(NULL)	/* FIX ME: temp */
-#define SCTP_LIST_EMPTY(list)	LIST_EMPTY(list)
 
 #if defined(SCTP_DEBUG)
 #define SCTPDBG(level, params...)					\

Modified: head/sys/netinet/sctp_pcb.c
==============================================================================
--- head/sys/netinet/sctp_pcb.c	Tue Nov 17 20:54:52 2009	(r199436)
+++ head/sys/netinet/sctp_pcb.c	Tue Nov 17 20:56:14 2009	(r199437)
@@ -452,7 +452,7 @@ sctp_remove_ifa_from_ifn(struct sctp_ifa
 			sctp_ifap->ifn_p->num_v4--;
 
 		ifn_index = sctp_ifap->ifn_p->ifn_index;
-		if (SCTP_LIST_EMPTY(&sctp_ifap->ifn_p->ifalist)) {
+		if (LIST_EMPTY(&sctp_ifap->ifn_p->ifalist)) {
 			/* remove the ifn, possibly freeing it */
 			sctp_delete_ifn(sctp_ifap->ifn_p, SCTP_ADDR_LOCKED);
 		} else {
@@ -4262,7 +4262,7 @@ sctp_delete_from_timewait(uint32_t tag, 
 	int i;
 
 	chain = &SCTP_BASE_INFO(vtag_timewait)[(tag % SCTP_STACK_VTAG_HASH_SIZE)];
-	if (!SCTP_LIST_EMPTY(chain)) {
+	if (!LIST_EMPTY(chain)) {
 		LIST_FOREACH(twait_block, chain, sctp_nxt_tagblock) {
 			for (i = 0; i < SCTP_NUMBER_IN_VTAG_BLOCK; i++) {
 				if ((twait_block->vtag_block[i].v_tag == tag) &&
@@ -4292,7 +4292,7 @@ sctp_is_in_timewait(uint32_t tag, uint16
 
 	SCTP_INP_INFO_WLOCK();
 	chain = &SCTP_BASE_INFO(vtag_timewait)[(tag % SCTP_STACK_VTAG_HASH_SIZE)];
-	if (!SCTP_LIST_EMPTY(chain)) {
+	if (!LIST_EMPTY(chain)) {
 		LIST_FOREACH(twait_block, chain, sctp_nxt_tagblock) {
 			for (i = 0; i < SCTP_NUMBER_IN_VTAG_BLOCK; i++) {
 				if ((twait_block->vtag_block[i].v_tag == tag) &&
@@ -4326,7 +4326,7 @@ sctp_add_vtag_to_timewait(uint32_t tag, 
 	(void)SCTP_GETTIME_TIMEVAL(&now);
 	chain = &SCTP_BASE_INFO(vtag_timewait)[(tag % SCTP_STACK_VTAG_HASH_SIZE)];
 	set = 0;
-	if (!SCTP_LIST_EMPTY(chain)) {
+	if (!LIST_EMPTY(chain)) {
 		/* Block(s) present, lets find space, and expire on the fly */
 		LIST_FOREACH(twait_block, chain, sctp_nxt_tagblock) {
 			for (i = 0; i < SCTP_NUMBER_IN_VTAG_BLOCK; i++) {
@@ -4953,7 +4953,7 @@ sctp_free_assoc(struct sctp_inpcb *inp, 
 		sctp_free_remote_addr(net);
 	}
 
-	while (!SCTP_LIST_EMPTY(&asoc->sctp_restricted_addrs)) {
+	while (!LIST_EMPTY(&asoc->sctp_restricted_addrs)) {
 		/* sa_ignore FREED_MEMORY */
 		laddr = LIST_FIRST(&asoc->sctp_restricted_addrs);
 		sctp_remove_laddr(laddr);
@@ -5617,7 +5617,7 @@ sctp_pcb_finish(void)
 	 */
 	for (i = 0; i < SCTP_STACK_VTAG_HASH_SIZE; i++) {
 		chain = &SCTP_BASE_INFO(vtag_timewait)[i];
-		if (!SCTP_LIST_EMPTY(chain)) {
+		if (!LIST_EMPTY(chain)) {
 			prev_twait_block = NULL;
 			LIST_FOREACH(twait_block, chain, sctp_nxt_tagblock) {
 				if (prev_twait_block) {
@@ -6387,7 +6387,7 @@ skip_vtag_check:
 
 	chain = &SCTP_BASE_INFO(vtag_timewait[(tag % SCTP_STACK_VTAG_HASH_SIZE))];
 	/* Now what about timed wait ? */
-	if (!SCTP_LIST_EMPTY(chain)) {
+	if (!LIST_EMPTY(chain)) {
 		/*
 		 * Block(s) are present, lets see if we have this tag in the
 		 * list

Modified: head/sys/netinet/sctp_usrreq.c
==============================================================================
--- head/sys/netinet/sctp_usrreq.c	Tue Nov 17 20:54:52 2009	(r199436)
+++ head/sys/netinet/sctp_usrreq.c	Tue Nov 17 20:56:14 2009	(r199437)
@@ -759,7 +759,7 @@ sctp_disconnect(struct socket *so)
 	SCTP_INP_RLOCK(inp);
 	if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
 	    (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) {
-		if (SCTP_LIST_EMPTY(&inp->sctp_asoc_list)) {
+		if (LIST_EMPTY(&inp->sctp_asoc_list)) {
 			/* No connection */
 			SCTP_INP_RUNLOCK(inp);
 			return (0);

From owner-svn-src-head@FreeBSD.ORG  Tue Nov 17 21:08:10 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D2F56106568D;
	Tue, 17 Nov 2009 21:08:10 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C2E948FC18;
	Tue, 17 Nov 2009 21:08:10 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAHL8AB4038907;
	Tue, 17 Nov 2009 21:08:10 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAHL8A0K038906;
	Tue, 17 Nov 2009 21:08:10 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <200911172108.nAHL8A0K038906@svn.freebsd.org>
From: Marius Strobl 
Date: Tue, 17 Nov 2009 21:08:10 +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: r199442 - head/sys/sparc64/sparc64
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 17 Nov 2009 21:08:11 -0000

Author: marius
Date: Tue Nov 17 21:08:10 2009
New Revision: 199442
URL: http://svn.freebsd.org/changeset/base/199442

Log:
  Unroll copying of the registers in {g,s}et_mcontext() and limit it
  to the set actually restored by tl0_ret() instead of using the whole
  trapframe. Additionally skip %g7 as that register is used as the
  userland TLS pointer.
  
  PR:		140523
  MFC after:	1 week

Modified:
  head/sys/sparc64/sparc64/machdep.c

Modified: head/sys/sparc64/sparc64/machdep.c
==============================================================================
--- head/sys/sparc64/sparc64/machdep.c	Tue Nov 17 21:00:02 2009	(r199441)
+++ head/sys/sparc64/sparc64/machdep.c	Tue Nov 17 21:08:10 2009	(r199442)
@@ -692,12 +692,39 @@ get_mcontext(struct thread *td, mcontext
 
 	tf = td->td_frame;
 	pcb = td->td_pcb;
-	bcopy(tf, mc, sizeof(*tf));
+	/*
+	 * Copy the registers which will be restored by tl0_ret() from the
+	 * trapframe.
+	 * Note that we skip %g7 which is used as the userland TLS register
+	 * and %wstate.
+	 */
+	mc->mc_flags = _MC_VERSION;
+	mc->mc_global[1] = tf->tf_global[1];
+	mc->mc_global[2] = tf->tf_global[2];
+	mc->mc_global[3] = tf->tf_global[3];
+	mc->mc_global[4] = tf->tf_global[4];
+	mc->mc_global[5] = tf->tf_global[5];
+	mc->mc_global[6] = tf->tf_global[6];
 	if (flags & GET_MC_CLEAR_RET) {
 		mc->mc_out[0] = 0;
 		mc->mc_out[1] = 0;
+	} else {
+		mc->mc_out[0] = tf->tf_out[0];
+		mc->mc_out[1] = tf->tf_out[1];
 	}
-	mc->mc_flags = _MC_VERSION;
+	mc->mc_out[2] = tf->tf_out[2];
+	mc->mc_out[3] = tf->tf_out[3];
+	mc->mc_out[4] = tf->tf_out[4];
+	mc->mc_out[5] = tf->tf_out[5];
+	mc->mc_out[6] = tf->tf_out[6];
+	mc->mc_out[7] = tf->tf_out[7];
+	mc->mc_fprs = tf->tf_fprs;
+	mc->mc_fsr = tf->tf_fsr;
+	mc->mc_gsr = tf->tf_gsr;
+	mc->mc_tnpc = tf->tf_tnpc;
+	mc->mc_tpc = tf->tf_tpc;
+	mc->mc_tstate = tf->tf_tstate;
+	mc->mc_y = tf->tf_y;
 	critical_enter();
 	if ((tf->tf_fprs & FPRS_FEF) != 0) {
 		savefpctx(pcb->pcb_ufp);
@@ -717,7 +744,6 @@ set_mcontext(struct thread *td, const mc
 {
 	struct trapframe *tf;
 	struct pcb *pcb;
-	uint64_t wstate;
 
 	if (!TSTATE_SECURE(mc->mc_tstate) ||
 	    (mc->mc_flags & ((1L << _MC_VERSION_BITS) - 1)) != _MC_VERSION)
@@ -726,9 +752,33 @@ set_mcontext(struct thread *td, const mc
 	pcb = td->td_pcb;
 	/* Make sure the windows are spilled first. */
 	flushw();
-	wstate = tf->tf_wstate;
-	bcopy(mc, tf, sizeof(*tf));
-	tf->tf_wstate = wstate;
+	/*
+	 * Copy the registers which will be restored by tl0_ret() to the
+	 * trapframe.
+	 * Note that we skip %g7 which is used as the userland TLS register
+	 * and %wstate.
+	 */
+	tf->tf_global[1] = mc->mc_global[1];
+	tf->tf_global[2] = mc->mc_global[2];
+	tf->tf_global[3] = mc->mc_global[3];
+	tf->tf_global[4] = mc->mc_global[4];
+	tf->tf_global[5] = mc->mc_global[5];
+	tf->tf_global[6] = mc->mc_global[6];
+	tf->tf_out[0] = mc->mc_out[0];
+	tf->tf_out[1] = mc->mc_out[1];
+	tf->tf_out[2] = mc->mc_out[2];
+	tf->tf_out[3] = mc->mc_out[3];
+	tf->tf_out[4] = mc->mc_out[4];
+	tf->tf_out[5] = mc->mc_out[5];
+	tf->tf_out[6] = mc->mc_out[6];
+	tf->tf_out[7] = mc->mc_out[7];
+	tf->tf_fprs = mc->mc_fprs;
+	tf->tf_fsr = mc->mc_fsr;
+	tf->tf_gsr = mc->mc_gsr;
+	tf->tf_tnpc = mc->mc_tnpc;
+	tf->tf_tpc = mc->mc_tpc;
+	tf->tf_tstate = mc->mc_tstate;
+	tf->tf_y = mc->mc_y;
 	if ((mc->mc_fprs & FPRS_FEF) != 0) {
 		tf->tf_fprs = 0;
 		bcopy(mc->mc_fp, pcb->pcb_ufp, sizeof(pcb->pcb_ufp));

From owner-svn-src-head@FreeBSD.ORG  Tue Nov 17 21:56:12 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 98E1A1065697;
	Tue, 17 Nov 2009 21:56:12 +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 88FEF8FC12;
	Tue, 17 Nov 2009 21:56:12 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAHLuC5u042033;
	Tue, 17 Nov 2009 21:56:12 GMT (envelope-from gonzo@svn.freebsd.org)
Received: (from gonzo@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAHLuC5f042031;
	Tue, 17 Nov 2009 21:56:12 GMT (envelope-from gonzo@svn.freebsd.org)
Message-Id: <200911172156.nAHLuC5f042031@svn.freebsd.org>
From: Oleksandr Tymoshenko 
Date: Tue, 17 Nov 2009 21:56: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: r199457 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 17 Nov 2009 21:56:12 -0000

Author: gonzo
Date: Tue Nov 17 21:56:12 2009
New Revision: 199457
URL: http://svn.freebsd.org/changeset/base/199457

Log:
  - Unbreak build with KLD_DEBUG defined
  - Add debug.kld_debug sysctl to control KLD debugging level
  - Print information about KLD dependencies with debug enabled

Modified:
  head/sys/kern/kern_linker.c

Modified: head/sys/kern/kern_linker.c
==============================================================================
--- head/sys/kern/kern_linker.c	Tue Nov 17 21:45:28 2009	(r199456)
+++ head/sys/kern/kern_linker.c	Tue Nov 17 21:56:12 2009	(r199457)
@@ -64,6 +64,8 @@ __FBSDID("$FreeBSD$");
 
 #ifdef KLD_DEBUG
 int kld_debug = 0;
+SYSCTL_INT(_debug, OID_AUTO, kld_debug, CTLFLAG_RW,
+        &kld_debug, 0, "Set various levels of KLD debug");
 #endif
 
 #define	KLD_LOCK()		sx_xlock(&kld_sx)
@@ -632,7 +634,7 @@ linker_file_unload(linker_file_t file, i
 		 */
 		if ((error = module_unload(mod)) != 0) {
 			KLD_DPF(FILE, ("linker_file_unload: module %s"
-			    " failed unload\n", mod));
+			    " failed unload\n", module_getname(mod)));
 			return (error);
 		}
 		MOD_XLOCK;
@@ -709,6 +711,9 @@ linker_file_add_dependency(linker_file_t
 	file->deps = newdeps;
 	file->deps[file->ndeps] = dep;
 	file->ndeps++;
+	KLD_DPF(FILE, ("linker_file_add_dependency:"
+	    " adding %s as dependency for %s\n", 
+	    dep->filename, file->filename));
 	return (0);
 }
 

From owner-svn-src-head@FreeBSD.ORG  Tue Nov 17 22:47:21 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5374D106568F;
	Tue, 17 Nov 2009 22:47:21 +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 41C7E8FC1E;
	Tue, 17 Nov 2009 22:47:21 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAHMlKG6044146;
	Tue, 17 Nov 2009 22:47:20 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAHMlKCF044145;
	Tue, 17 Nov 2009 22:47:20 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <200911172247.nAHMlKCF044145@svn.freebsd.org>
From: Jilles Tjoelker 
Date: Tue, 17 Nov 2009 22:47: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: r199458 - in head/bin: . pwait
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 17 Nov 2009 22:47:21 -0000

Author: jilles
Date: Tue Nov 17 22:47:20 2009
New Revision: 199458
URL: http://svn.freebsd.org/changeset/base/199458

Log:
  Add pwait utility, which waits for any process to terminate.
  
  This is similar to the Solaris utility of the same name.
  
  Some use cases:
  * rc.subr's wait_for_pids
  * interactive use, e.g. to shut down the computer when some task is done
    even if the task is already running
  
  Discussed on:	hackers@

Added:
  head/bin/pwait/
  head/bin/pwait/Makefile   (contents, props changed)
  head/bin/pwait/pwait.1   (contents, props changed)
  head/bin/pwait/pwait.c   (contents, props changed)
Modified:
  head/bin/Makefile

Modified: head/bin/Makefile
==============================================================================
--- head/bin/Makefile	Tue Nov 17 21:56:12 2009	(r199457)
+++ head/bin/Makefile	Tue Nov 17 22:47:20 2009	(r199458)
@@ -27,6 +27,7 @@ SUBDIR= cat \
 	pax \
 	pkill \
 	ps \
+	pwait \
 	pwd \
 	${_rcp} \
 	realpath \

Added: head/bin/pwait/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/bin/pwait/Makefile	Tue Nov 17 22:47:20 2009	(r199458)
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+PROG=	pwait
+
+.include 

Added: head/bin/pwait/pwait.1
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/bin/pwait/pwait.1	Tue Nov 17 22:47:20 2009	(r199458)
@@ -0,0 +1,78 @@
+.\"
+.\" Copyright (c) 2004-2009, Jilles Tjoelker
+.\" 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 COPYRIGHT HOLDERS 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
+.\" COPYRIGHT OWNER 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 November 1, 2009
+.Os
+.Dt PWAIT 1
+.Sh NAME
+.Nm pwait
+.Nd wait for processes to terminate
+.Sh SYNOPSIS
+.Nm
+.Op Fl v
+.Ar pid
+\&...
+.Sh DESCRIPTION
+The
+.Nm
+utility will wait until each of the given processes has terminated. 
+.Pp
+The following option is available:
+.Bl -tag -width indent
+.It Fl v
+Print the exit status when each process terminates.
+.El
+.Sh DIAGNOSTICS
+.Pp
+The
+.Nm
+utility returns 0 on success, and >0 if an error occurs.
+.Pp
+Invalid pids elicit a warning message but are otherwise ignored.
+.Sh SEE ALSO
+.Xr kill 1 ,
+.Xr pkill 1 ,
+.Xr ps 1 ,
+.Xr wait 1 ,
+.Xr kqueue 2
+.Sh NOTES
+.Nm
+is not a substitute for the
+.Xr wait 1
+builtin
+as it will not clean up any zombies or state in the parent process.
+.Sh HISTORY
+A
+.Nm
+command first appeared in SunOS 5.8.

Added: head/bin/pwait/pwait.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/bin/pwait/pwait.c	Tue Nov 17 22:47:20 2009	(r199458)
@@ -0,0 +1,145 @@
+/*-
+ * Copyright (c) 2004-2009, Jilles Tjoelker
+ * 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 COPYRIGHT HOLDERS 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
+ * COPYRIGHT OWNER 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 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static void
+usage(void)
+{
+
+	fprintf(stderr, "usage: pwait [-v] pid ...\n");
+	exit(EX_USAGE);
+}
+
+/*
+ * pwait - wait for processes to terminate
+ */
+int
+main(int argc, char *argv[])
+{
+	int kq;
+	struct kevent *e;
+	int verbose = 0;
+	int opt, nleft, n, i, duplicate, status;
+	long pid;
+	char *s, *end;
+
+	while ((opt = getopt(argc, argv, "v")) != -1) {
+		switch (opt) {
+		case 'v':
+			verbose = 1;
+			break;
+		default:
+			usage();
+			/* NOTREACHED */
+		}
+	}
+
+	argc -= optind;
+	argv += optind;
+
+	if (argc == 0)
+		usage();
+
+	kq = kqueue();
+	if (kq == -1)
+		err(1, "kqueue");
+
+	e = malloc(argc * sizeof(struct kevent));
+	if (e == NULL)
+		err(1, "malloc");
+	nleft = 0;
+	for (n = 0; n < argc; n++) {
+		s = argv[n];
+		if (!strncmp(s, "/proc/", 6)) /* Undocumented Solaris compat */
+			s += 6;
+		errno = 0;
+		pid = strtol(s, &end, 10);
+		if (pid < 0 || *end != '\0' || errno != 0) {
+			warnx("%s: bad process id", s);
+			continue;
+		}
+		duplicate = 0;
+		for (i = 0; i < nleft; i++)
+			if (e[i].ident == (uintptr_t)pid)
+				duplicate = 1;
+		if (!duplicate) {
+			EV_SET(e + nleft, pid, EVFILT_PROC, EV_ADD, NOTE_EXIT,
+			    0, NULL);
+			if (kevent(kq, e + nleft, 1, NULL, 0, NULL) == -1)
+				warn("%ld", pid);
+			else
+				nleft++;
+		}
+	}
+
+	while (nleft > 0) {
+		n = kevent(kq, NULL, 0, e, nleft, NULL);
+		if (n == -1)
+			err(1, "kevent");
+		if (verbose)
+			for (i = 0; i < n; i++) {
+				status = e[i].data;
+				if (WIFEXITED(status))
+					printf("%ld: exited with status %d.\n",
+					    (long)e[i].ident,
+					    WEXITSTATUS(status));
+				else if (WIFSIGNALED(status))
+					printf("%ld: killed by signal %d.\n",
+					    (long)e[i].ident,
+					    WTERMSIG(status));
+				else
+					printf("%ld: terminated.\n",
+					    (long)e[i].ident);
+			}
+		nleft -= n;
+	}
+
+	return 0;
+}

From owner-svn-src-head@FreeBSD.ORG  Tue Nov 17 23:03:39 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 784B91065670;
	Tue, 17 Nov 2009 23:03:39 +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 4ED9A8FC1F;
	Tue, 17 Nov 2009 23:03:39 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAHN3dsZ044935;
	Tue, 17 Nov 2009 23:03:39 GMT (envelope-from tuexen@svn.freebsd.org)
Received: (from tuexen@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAHN3dM4044931;
	Tue, 17 Nov 2009 23:03:39 GMT (envelope-from tuexen@svn.freebsd.org)
Message-Id: <200911172303.nAHN3dM4044931@svn.freebsd.org>
From: Michael Tuexen 
Date: Tue, 17 Nov 2009 23:03: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: r199459 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 17 Nov 2009 23:03:39 -0000

Author: tuexen
Date: Tue Nov 17 23:03:38 2009
New Revision: 199459
URL: http://svn.freebsd.org/changeset/base/199459

Log:
  Get rid of unused fields addr_over which is never really used,
  only copied around.
  
  Approved by: rrs (mentor)

Modified:
  head/sys/netinet/sctp_output.c
  head/sys/netinet/sctp_structs.h
  head/sys/netinet/sctputil.c

Modified: head/sys/netinet/sctp_output.c
==============================================================================
--- head/sys/netinet/sctp_output.c	Tue Nov 17 22:47:20 2009	(r199458)
+++ head/sys/netinet/sctp_output.c	Tue Nov 17 23:03:38 2009	(r199459)
@@ -5875,10 +5875,8 @@ sctp_msg_append(struct sctp_tcb *stcb,
 	sp->strseq = 0;
 	if (sp->sinfo_flags & SCTP_ADDR_OVER) {
 		sp->net = net;
-		sp->addr_over = 1;
 	} else {
 		sp->net = stcb->asoc.primary_destination;
-		sp->addr_over = 0;
 	}
 	atomic_add_int(&sp->net->ref_count, 1);
 	(void)SCTP_GETTIME_TIMEVAL(&sp->ts);
@@ -7052,7 +7050,6 @@ dont_do_it:
 
 	chk->rec.data.timetodrop = sp->ts;
 	chk->flags = sp->act_flags;
-	chk->addr_over = sp->addr_over;
 
 	chk->whoTo = net;
 	atomic_add_int(&chk->whoTo->ref_count, 1);
@@ -12252,10 +12249,8 @@ skip_copy:
 	} else {
 		if (sp->sinfo_flags & SCTP_ADDR_OVER) {
 			sp->net = net;
-			sp->addr_over = 1;
 		} else {
 			sp->net = asoc->primary_destination;
-			sp->addr_over = 0;
 		}
 		atomic_add_int(&sp->net->ref_count, 1);
 		sctp_set_prsctp_policy(sp);

Modified: head/sys/netinet/sctp_structs.h
==============================================================================
--- head/sys/netinet/sctp_structs.h	Tue Nov 17 22:47:20 2009	(r199458)
+++ head/sys/netinet/sctp_structs.h	Tue Nov 17 23:03:38 2009	(r199459)
@@ -364,9 +364,6 @@ struct sctp_tmit_chunk {
 	uint8_t pad_inplace;
 	uint8_t do_rtt;
 	uint8_t book_size_scale;
-	uint8_t addr_over;	/* flag which is set if the dest address for
-				 * this chunk is overridden by user. Used for
-				 * CMT (iyengar@cis.udel.edu, 2005/06/21) */
 	uint8_t no_fr_allowed;
 	uint8_t pr_sctp_on;
 	uint8_t copy_by_ref;
@@ -444,7 +441,6 @@ struct sctp_stream_queue_pending {
 	uint8_t holds_key_ref;
 	uint8_t msg_is_complete;
 	uint8_t some_taken;
-	uint8_t addr_over;
 	uint8_t pr_sctp_on;
 	uint8_t sender_all_done;
 	uint8_t put_last_out;

Modified: head/sys/netinet/sctputil.c
==============================================================================
--- head/sys/netinet/sctputil.c	Tue Nov 17 22:47:20 2009	(r199458)
+++ head/sys/netinet/sctputil.c	Tue Nov 17 23:03:38 2009	(r199459)
@@ -4791,7 +4791,6 @@ next_on_sent:
 					chk->rec.data.payloadtype = sp->ppid;
 					chk->rec.data.context = sp->context;
 					chk->flags = sp->act_flags;
-					chk->addr_over = sp->addr_over;
 					chk->whoTo = sp->net;
 					atomic_add_int(&chk->whoTo->ref_count, 1);
 					chk->rec.data.TSN_seq = atomic_fetchadd_int(&stcb->asoc.sending_seq, 1);

From owner-svn-src-head@FreeBSD.ORG  Wed Nov 18 00:56:06 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0BE48106566C;
	Wed, 18 Nov 2009 00:56:06 +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 D5B138FC18;
	Wed, 18 Nov 2009 00:56:05 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAI0u57W049826;
	Wed, 18 Nov 2009 00:56:05 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAI0u5KY049822;
	Wed, 18 Nov 2009 00:56:05 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200911180056.nAI0u5KY049822@svn.freebsd.org>
From: Xin LI 
Date: Wed, 18 Nov 2009 00:56: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: r199463 - in head: . share/man/man8
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 18 Nov 2009 00:56:06 -0000

Author: delphij
Date: Wed Nov 18 00:56:05 2009
New Revision: 199463
URL: http://svn.freebsd.org/changeset/base/199463

Log:
  rc.early(8) was removed as of 20090530 so remove manual page reference
  to it.
  
  MFC after:	1 week

Modified:
  head/ObsoleteFiles.inc
  head/share/man/man8/Makefile
  head/share/man/man8/rc.8

Modified: head/ObsoleteFiles.inc
==============================================================================
--- head/ObsoleteFiles.inc	Wed Nov 18 00:51:31 2009	(r199462)
+++ head/ObsoleteFiles.inc	Wed Nov 18 00:56:05 2009	(r199463)
@@ -14,6 +14,8 @@
 # The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last.
 #
 
+# 20091117: removal of rc.early(8) link
+OLD_FILES+=usr/share/man/man8/rc.early.8.gz
 # 20091027: pselect.3 implemented as syscall
 OLD_FILES+=usr/share/man/man3/pselect.3.gz
 # 20091005: fusword.9 and susword.9 removed

Modified: head/share/man/man8/Makefile
==============================================================================
--- head/share/man/man8/Makefile	Wed Nov 18 00:51:31 2009	(r199462)
+++ head/share/man/man8/Makefile	Wed Nov 18 00:56:05 2009	(r199463)
@@ -16,7 +16,6 @@ MAN=	crash.8 \
 
 MLINKS=	rc.8 rc.atm.8 \
 	rc.8 rc.d.8 \
-	rc.8 rc.early.8 \
 	rc.8 rc.firewall.8 \
 	rc.8 rc.local.8 \
 	rc.8 rc.network.8 \

Modified: head/share/man/man8/rc.8
==============================================================================
--- head/share/man/man8/rc.8	Wed Nov 18 00:51:31 2009	(r199462)
+++ head/share/man/man8/rc.8	Wed Nov 18 00:56:05 2009	(r199463)
@@ -35,7 +35,7 @@
 .\"     @(#)rc.8	8.2 (Berkeley) 12/11/93
 .\" $FreeBSD$
 .\"
-.Dd May 18, 2007
+.Dd November 17, 2009
 .Dt RC 8
 .Os
 .Sh NAME
@@ -394,20 +394,6 @@ is not set, when going from single-user 
 the script does not do anything.
 .Pp
 The
-.Nm rc.early
-script is run very early in the startup process, immediately before the
-file system check.
-The
-.Nm rc.early
-script is deprecated.
-Any commands in this
-file should be separated out into
-.Nm rc.d/
-style scripts and integrated into the
-.Nm
-system.
-.Pp
-The
 .Pa /etc/rc.d/local
 script can execute scripts from multiple
 .Nm rc.d/

From owner-svn-src-head@FreeBSD.ORG  Wed Nov 18 01:13:15 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6FB16106568D;
	Wed, 18 Nov 2009 01:13:15 +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 5F1E28FC15;
	Wed, 18 Nov 2009 01:13:15 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAI1DF0i050543;
	Wed, 18 Nov 2009 01:13:15 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAI1DFF5050541;
	Wed, 18 Nov 2009 01:13:15 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200911180113.nAI1DFF5050541@svn.freebsd.org>
From: Xin LI 
Date: Wed, 18 Nov 2009 01:13: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: r199464 - head/share/man/man4
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 18 Nov 2009 01:13:15 -0000

Author: delphij
Date: Wed Nov 18 01:13:15 2009
New Revision: 199464
URL: http://svn.freebsd.org/changeset/base/199464

Log:
  Add a missing .Ed tag.
  
  MFC after:	2 weeks

Modified:
  head/share/man/man4/wi.4

Modified: head/share/man/man4/wi.4
==============================================================================
--- head/share/man/man4/wi.4	Wed Nov 18 00:56:05 2009	(r199463)
+++ head/share/man/man4/wi.4	Wed Nov 18 01:13:15 2009	(r199464)
@@ -253,6 +253,7 @@ Join a specific BSS network with network
 .Bd -literal -offset indent
 ifconfig wlan create wlandev wi0 inet 192.168.0.20 \e
     netmask 0xffffff00 ssid my_net
+.Ed
 .Pp
 Join a specific BSS network with WEP encryption:
 .Bd -literal -offset indent

From owner-svn-src-head@FreeBSD.ORG  Wed Nov 18 01:35:36 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EDB3B1065672;
	Wed, 18 Nov 2009 01:35:36 +0000 (UTC)
	(envelope-from davidxu@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DCF708FC17;
	Wed, 18 Nov 2009 01:35:36 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAI1ZaCR051551;
	Wed, 18 Nov 2009 01:35:36 GMT (envelope-from davidxu@svn.freebsd.org)
Received: (from davidxu@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAI1ZaIe051549;
	Wed, 18 Nov 2009 01:35:36 GMT (envelope-from davidxu@svn.freebsd.org)
Message-Id: <200911180135.nAI1ZaIe051549@svn.freebsd.org>
From: David Xu 
Date: Wed, 18 Nov 2009 01:35: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: r199465 - head/lib/librt
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 18 Nov 2009 01:35:37 -0000

Author: davidxu
Date: Wed Nov 18 01:35:36 2009
New Revision: 199465
URL: http://svn.freebsd.org/changeset/base/199465

Log:
  Fix compiler warnings.

Modified:
  head/lib/librt/sigev_thread.c

Modified: head/lib/librt/sigev_thread.c
==============================================================================
--- head/lib/librt/sigev_thread.c	Wed Nov 18 01:13:15 2009	(r199464)
+++ head/lib/librt/sigev_thread.c	Wed Nov 18 01:35:36 2009	(r199465)
@@ -439,9 +439,9 @@ worker_routine(void *arg)
 {
 	struct sigev_node *sn = arg;
 
-	_pthread_cleanup_push(worker_cleanup, sn);
+	pthread_cleanup_push(worker_cleanup, sn);
 	sn->sn_dispatch(sn);
-	_pthread_cleanup_pop(1);
+	pthread_cleanup_pop(1);
 
 	return (0);
 }

From owner-svn-src-head@FreeBSD.ORG  Wed Nov 18 03:51:34 2009
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A35F9106566B;
	Wed, 18 Nov 2009 03:51:34 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85])
	by mx1.freebsd.org (Postfix) with ESMTP id 62FF68FC13;
	Wed, 18 Nov 2009 03:51:34 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
	by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id nAI3l9g3049188;
	Tue, 17 Nov 2009 20:47:10 -0700 (MST) (envelope-from imp@bsdimp.com)
Date: Tue, 17 Nov 2009 20:47:32 -0700 (MST)
Message-Id: <20091117.204732.1339398361.imp@bsdimp.com>
To: lynx.ripe@gmail.com
From: "M. Warner Losh" 
In-Reply-To: <4B01E548.7040708@gmail.com>
References: <4B01E548.7040708@gmail.com>
X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org, edwin@FreeBSD.org
Subject: Re: svn commit: r194783 - head/lib/libc/stdtime
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 18 Nov 2009 03:51:34 -0000

In message: <4B01E548.7040708@gmail.com>
            Dmitry Pryanishnikov  writes:
: 
: Hello!
: 
: > Author: edwin
: > Date: Tue Jun 23 22:28:44 2009
: > New Revision: 194783
: > URL: http://svn.freebsd.org/changeset/base/194783
: > 
: > Log:
: >   Remove duplicate if-statement on gmt_is_set in gmtsub().
: >   
: >   MFC after:	1 week
: > 
: > Modified:
: >   head/lib/libc/stdtime/localtime.c
: > 
: > Modified: head/lib/libc/stdtime/localtime.c
: > ==============================================================================
: > --- head/lib/libc/stdtime/localtime.c	Tue Jun 23 22:22:20 2009	(r194782)
: > +++ head/lib/libc/stdtime/localtime.c	Tue Jun 23 22:28:44 2009	(r194783)
: > @@ -1472,18 +1472,16 @@ struct tm * const	tmp;
: >  {
: >  	register struct tm *	result;
: >  
: > +	_MUTEX_LOCK(&gmt_mutex);
: >  	if (!gmt_is_set) {
: > -		_MUTEX_LOCK(&gmt_mutex);
: > -		if (!gmt_is_set) {
: 
:    This change looks like a (small?) pessimization to me: before it, 
: _MUTEX_LOCK/_MUTEX_UNLOCK pair would be skipped for the case gmt_is_set 
: == TRUE (all invocations except the first one), now it won't. I'm not 
: sure whether this is critical here though...

I think this is a big pessimization.  gmt_is_set code only needs to
execute once, and this code was designed to be lockless once
gmt_is_set was set...

Warner

From owner-svn-src-head@FreeBSD.ORG  Wed Nov 18 03:58:26 2009
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 95C6610656C4;
	Wed, 18 Nov 2009 03:58:26 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85])
	by mx1.freebsd.org (Postfix) with ESMTP id 567098FC15;
	Wed, 18 Nov 2009 03:58:26 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
	by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id nAI3tb1o049261;
	Tue, 17 Nov 2009 20:55:37 -0700 (MST) (envelope-from imp@bsdimp.com)
Date: Tue, 17 Nov 2009 20:56:00 -0700 (MST)
Message-Id: <20091117.205600.-1447187016.imp@bsdimp.com>
To: davidxu@FreeBSD.org
From: "M. Warner Losh" 
In-Reply-To: <200911180135.nAI1ZaIe051549@svn.freebsd.org>
References: <200911180135.nAI1ZaIe051549@svn.freebsd.org>
X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r199465 - head/lib/librt
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 18 Nov 2009 03:58:26 -0000

In message: <200911180135.nAI1ZaIe051549@svn.freebsd.org>
            David Xu  writes:
: Author: davidxu
: Date: Wed Nov 18 01:35:36 2009
: New Revision: 199465
: URL: http://svn.freebsd.org/changeset/base/199465
: 
: Log:
:   Fix compiler warnings.
: 
: Modified:
:   head/lib/librt/sigev_thread.c
: 
: Modified: head/lib/librt/sigev_thread.c
: ==============================================================================
: --- head/lib/librt/sigev_thread.c	Wed Nov 18 01:13:15 2009	(r199464)
: +++ head/lib/librt/sigev_thread.c	Wed Nov 18 01:35:36 2009	(r199465)
: @@ -439,9 +439,9 @@ worker_routine(void *arg)
:  {
:  	struct sigev_node *sn = arg;
:  
: -	_pthread_cleanup_push(worker_cleanup, sn);
: +	pthread_cleanup_push(worker_cleanup, sn);
:  	sn->sn_dispatch(sn);
: -	_pthread_cleanup_pop(1);
: +	pthread_cleanup_pop(1);
:  
:  	return (0);
:  }

Is this what is causing the tinerbox failure on MIPS?

Warner

From owner-svn-src-head@FreeBSD.ORG  Wed Nov 18 03:58:27 2009
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2885710656DA;
	Wed, 18 Nov 2009 03:58:27 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85])
	by mx1.freebsd.org (Postfix) with ESMTP id D99BF8FC1B;
	Wed, 18 Nov 2009 03:58:26 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
	by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id nAI3rSaX049243;
	Tue, 17 Nov 2009 20:53:28 -0700 (MST) (envelope-from imp@bsdimp.com)
Date: Tue, 17 Nov 2009 20:53:50 -0700 (MST)
Message-Id: <20091117.205350.1682637096.imp@bsdimp.com>
To: jilles@stack.nl
From: "M. Warner Losh" 
In-Reply-To: <20091117182501.GA70742@stack.nl>
References: <4B01E548.7040708@gmail.com>
	<20091117182501.GA70742@stack.nl>
X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@FreeBSD.org, lynx.ripe@gmail.com, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org, edwin@FreeBSD.org
Subject: Re: svn commit: r194783 - head/lib/libc/stdtime
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 18 Nov 2009 03:58:27 -0000

In message: <20091117182501.GA70742@stack.nl>
            Jilles Tjoelker  writes:
: On Tue, Nov 17, 2009 at 01:50:32AM +0200, Dmitry Pryanishnikov wrote:
: > > Author: edwin
: > > Date: Tue Jun 23 22:28:44 2009
: > > New Revision: 194783
: > > URL: http://svn.freebsd.org/changeset/base/194783
: 
: > > Log:
: > >   Remove duplicate if-statement on gmt_is_set in gmtsub().
: 
: > >   MFC after:	1 week
: 
: > > Modified:
: > >   head/lib/libc/stdtime/localtime.c
: 
: >    This change looks like a (small?) pessimization to me: before it, 
: > _MUTEX_LOCK/_MUTEX_UNLOCK pair would be skipped for the case gmt_is_set 
: > == TRUE (all invocations except the first one), now it won't. I'm not 
: > sure whether this is critical here though...
: 
: It is certainly less efficient, but the old code was (most likely)
: wrong. It used an idiom known as "double checked locking", which is
: incorrect in most memory models. The problem is that the store to
: gmt_is_set may become visible without stores to other memory (gmtptr and
: what it points to) becoming visible.

Wouldn't a memory barrier solve that at a much lower cost than a full
lock?

Warner

From owner-svn-src-head@FreeBSD.ORG  Wed Nov 18 04:13:00 2009
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8210D1065672;
	Wed, 18 Nov 2009 04:13:00 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85])
	by mx1.freebsd.org (Postfix) with ESMTP id 4188A8FC1B;
	Wed, 18 Nov 2009 04:13:00 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
	by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id nAI44eF4049358;
	Tue, 17 Nov 2009 21:04:40 -0700 (MST) (envelope-from imp@bsdimp.com)
Date: Tue, 17 Nov 2009 21:05:02 -0700 (MST)
Message-Id: <20091117.210502.-1623813784.imp@bsdimp.com>
To: davidxu@FreeBSD.org
From: "M. Warner Losh" 
In-Reply-To: <200911180135.nAI1ZaIe051549@svn.freebsd.org>
References: <200911180135.nAI1ZaIe051549@svn.freebsd.org>
X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r199465 - head/lib/librt
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 18 Nov 2009 04:13:00 -0000

In message: <200911180135.nAI1ZaIe051549@svn.freebsd.org>
            David Xu  writes:
: Author: davidxu
: Date: Wed Nov 18 01:35:36 2009
: New Revision: 199465
: URL: http://svn.freebsd.org/changeset/base/199465
: 
: Log:
:   Fix compiler warnings.
: 
: Modified:
:   head/lib/librt/sigev_thread.c
: 
: Modified: head/lib/librt/sigev_thread.c
: ==============================================================================
: --- head/lib/librt/sigev_thread.c	Wed Nov 18 01:13:15 2009	(r199464)
: +++ head/lib/librt/sigev_thread.c	Wed Nov 18 01:35:36 2009	(r199465)
: @@ -439,9 +439,9 @@ worker_routine(void *arg)
:  {
:  	struct sigev_node *sn = arg;
:  
: -	_pthread_cleanup_push(worker_cleanup, sn);
: +	pthread_cleanup_push(worker_cleanup, sn);
:  	sn->sn_dispatch(sn);
: -	_pthread_cleanup_pop(1);
: +	pthread_cleanup_pop(1);
:  
:  	return (0);
:  }

This change causes libthr to be needed now for librt.  Before this
wasn't the case, so ntp break on mips now (I haven't looked at other
arcs yet).  _pthread_cleanup_pop is exported from libc, while
pthread_cleanup_pop causes __pthread_cleanup_pop_imp to be referenced,
which is defined in libthr.

I guess that's a long way of saying "gee, this seems wrong to me,
please explain what you are fixing better or revert this change,
thanks" :)

Warner


From owner-svn-src-head@FreeBSD.ORG  Wed Nov 18 04:18:13 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 240281065672;
	Wed, 18 Nov 2009 04:18:13 +0000 (UTC)
	(envelope-from davidxu@freebsd.org)
Received: from freefall.freebsd.org (freefall.freebsd.org
	[IPv6:2001:4f8:fff6::28])
	by mx1.freebsd.org (Postfix) with ESMTP id 1116A8FC18;
	Wed, 18 Nov 2009 04:18:13 +0000 (UTC)
Received: from apple.my.domain (localhost [127.0.0.1])
	by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id nAI4IBB9082098;
	Wed, 18 Nov 2009 04:18:12 GMT (envelope-from davidxu@freebsd.org)
Message-ID: <4B037583.4010605@freebsd.org>
Date: Wed, 18 Nov 2009 12:18:11 +0800
From: David Xu 
User-Agent: Thunderbird 2.0.0.9 (X11/20080612)
MIME-Version: 1.0
To: "M. Warner Losh" 
References: <200911180135.nAI1ZaIe051549@svn.freebsd.org>
	<20091117.210502.-1623813784.imp@bsdimp.com>
In-Reply-To: <20091117.210502.-1623813784.imp@bsdimp.com>
Content-Type: text/plain; charset=ISO-8859-1; 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: r199465 - head/lib/librt
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 18 Nov 2009 04:18:13 -0000

M. Warner Losh wrote:
> In message: <200911180135.nAI1ZaIe051549@svn.freebsd.org>
>             David Xu  writes:
> : Author: davidxu
> : Date: Wed Nov 18 01:35:36 2009
> : New Revision: 199465
> : URL: http://svn.freebsd.org/changeset/base/199465
> : 
> : Log:
> :   Fix compiler warnings.
> : 
> : Modified:
> :   head/lib/librt/sigev_thread.c
> : 
> : Modified: head/lib/librt/sigev_thread.c
> : ==============================================================================
> : --- head/lib/librt/sigev_thread.c	Wed Nov 18 01:13:15 2009	(r199464)
> : +++ head/lib/librt/sigev_thread.c	Wed Nov 18 01:35:36 2009	(r199465)
> : @@ -439,9 +439,9 @@ worker_routine(void *arg)
> :  {
> :  	struct sigev_node *sn = arg;
> :  
> : -	_pthread_cleanup_push(worker_cleanup, sn);
> : +	pthread_cleanup_push(worker_cleanup, sn);
> :  	sn->sn_dispatch(sn);
> : -	_pthread_cleanup_pop(1);
> : +	pthread_cleanup_pop(1);
> :  
> :  	return (0);
> :  }
> 
> This change causes libthr to be needed now for librt.  Before this
> wasn't the case, so ntp break on mips now (I haven't looked at other
> arcs yet).  _pthread_cleanup_pop is exported from libc, while
> pthread_cleanup_pop causes __pthread_cleanup_pop_imp to be referenced,
> which is defined in libthr.
> 
> I guess that's a long way of saying "gee, this seems wrong to me,
> please explain what you are fixing better or revert this change,
> thanks" :)
> 
> Warner
> 
> 
hmm, why should ntpd use librt?

From owner-svn-src-head@FreeBSD.ORG  Wed Nov 18 04:46:04 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6391F1065676;
	Wed, 18 Nov 2009 04:46:04 +0000 (UTC)
	(envelope-from davidxu@freebsd.org)
Received: from freefall.freebsd.org (freefall.freebsd.org
	[IPv6:2001:4f8:fff6::28])
	by mx1.freebsd.org (Postfix) with ESMTP id 371EF8FC0A;
	Wed, 18 Nov 2009 04:46:04 +0000 (UTC)
Received: from apple.my.domain (localhost [127.0.0.1])
	by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id nAI4k2l6008466;
	Wed, 18 Nov 2009 04:46:02 GMT (envelope-from davidxu@freebsd.org)
Message-ID: <4B037C0A.5030804@freebsd.org>
Date: Wed, 18 Nov 2009 12:46:02 +0800
From: David Xu 
User-Agent: Thunderbird 2.0.0.9 (X11/20080612)
MIME-Version: 1.0
To: "M. Warner Losh" 
References: <200911180135.nAI1ZaIe051549@svn.freebsd.org>
	<20091117.210502.-1623813784.imp@bsdimp.com>
In-Reply-To: <20091117.210502.-1623813784.imp@bsdimp.com>
Content-Type: text/plain; charset=ISO-8859-1; 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: r199465 - head/lib/librt
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 18 Nov 2009 04:46:04 -0000

M. Warner Losh wrote:
> In message: <200911180135.nAI1ZaIe051549@svn.freebsd.org>
>             David Xu  writes:
> : Author: davidxu
> : Date: Wed Nov 18 01:35:36 2009
> : New Revision: 199465
> : URL: http://svn.freebsd.org/changeset/base/199465
> : 
> : Log:
> :   Fix compiler warnings.
> : 
> : Modified:
> :   head/lib/librt/sigev_thread.c
> : 
> : Modified: head/lib/librt/sigev_thread.c
> : ==============================================================================
> : --- head/lib/librt/sigev_thread.c	Wed Nov 18 01:13:15 2009	(r199464)
> : +++ head/lib/librt/sigev_thread.c	Wed Nov 18 01:35:36 2009	(r199465)
> : @@ -439,9 +439,9 @@ worker_routine(void *arg)
> :  {
> :  	struct sigev_node *sn = arg;
> :  
> : -	_pthread_cleanup_push(worker_cleanup, sn);
> : +	pthread_cleanup_push(worker_cleanup, sn);
> :  	sn->sn_dispatch(sn);
> : -	_pthread_cleanup_pop(1);
> : +	pthread_cleanup_pop(1);
> :  
> :  	return (0);
> :  }
> 
> This change causes libthr to be needed now for librt.  Before this
> wasn't the case, so ntp break on mips now (I haven't looked at other
> arcs yet).  _pthread_cleanup_pop is exported from libc, while
> pthread_cleanup_pop causes __pthread_cleanup_pop_imp to be referenced,
> which is defined in libthr.
> 
> I guess that's a long way of saying "gee, this seems wrong to me,
> please explain what you are fixing better or revert this change,
> thanks" :)
> 
> Warner
> 
> 

librt needs libpthread to function correctly, otherwise SIGEV_THREAD
notification won't work, though the ntp code may not use it, but who
can guarantee librt never use threads? in old design, the timer
functions were really in libpthread and implemented as threads.

Regards,
David Xu


Index: ntpdate/Makefile
===================================================================
--- ntpdate/Makefile	(revision 199351)
+++ ntpdate/Makefile	(working copy)
@@ -9,7 +9,7 @@
  CFLAGS+= -I${.CURDIR}/../../../contrib/ntp/include -I${.CURDIR}/../

  DPADD=	${LIBNTP} ${LIBM} ${LIBMD} ${LIBRT}
-LDADD=	${LIBNTP} -lm -lmd -lrt
+LDADD=	${LIBNTP} -lm -lmd -lrt -lpthread

  CLEANFILES+= .version version.c

Index: ntpd/Makefile
===================================================================
--- ntpd/Makefile	(revision 199351)
+++ ntpd/Makefile	(working copy)
@@ -33,7 +33,7 @@
  	-I${.CURDIR}/../../../contrib/ntp/libopts -I${.CURDIR}

  DPADD=	${LIBPARSE} ${LIBNTP} ${LIBM} ${LIBMD} ${LIBRT} ${LIBOPTS}
-LDADD=	${LIBPARSE} ${LIBNTP} -lm -lmd -lrt ${LIBOPTS}
+LDADD=	${LIBPARSE} ${LIBNTP} -lm -lmd -lrt -lpthread ${LIBOPTS}

  .if ${MK_OPENSSL} != "no" && !defined(RELEASE_CRUNCH)
  DPADD+=	${LIBCRYPTO}

From owner-svn-src-head@FreeBSD.ORG  Wed Nov 18 05:09:03 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 72CD71065693;
	Wed, 18 Nov 2009 05:09:03 +0000 (UTC)
	(envelope-from davidxu@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 47EA08FC16;
	Wed, 18 Nov 2009 05:09:03 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAI593J4058972;
	Wed, 18 Nov 2009 05:09:03 GMT (envelope-from davidxu@svn.freebsd.org)
Received: (from davidxu@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAI593kQ058970;
	Wed, 18 Nov 2009 05:09:03 GMT (envelope-from davidxu@svn.freebsd.org)
Message-Id: <200911180509.nAI593kQ058970@svn.freebsd.org>
From: David Xu 
Date: Wed, 18 Nov 2009 05:09: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: r199469 - head/lib/librt
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 18 Nov 2009 05:09:03 -0000

Author: davidxu
Date: Wed Nov 18 05:09:03 2009
New Revision: 199469
URL: http://svn.freebsd.org/changeset/base/199469

Log:
  link libpthread because the librt really needs it to fully function.

Modified:
  head/lib/librt/Makefile

Modified: head/lib/librt/Makefile
==============================================================================
--- head/lib/librt/Makefile	Wed Nov 18 04:34:43 2009	(r199468)
+++ head/lib/librt/Makefile	Wed Nov 18 05:09:03 2009	(r199469)
@@ -4,6 +4,7 @@ LIB=rt
 SHLIB_MAJOR= 1
 CFLAGS+=-I${.CURDIR}/../libc/include -I${.CURDIR}
 CFLAGS+=-Winline -Wall -g
+LDADD+=-lpthread
 
 #MAN=	libthr.3
 

From owner-svn-src-head@FreeBSD.ORG  Wed Nov 18 06:10:50 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6115D106566B;
	Wed, 18 Nov 2009 06:10:50 +0000 (UTC)
	(envelope-from davidxu@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4FC388FC0A;
	Wed, 18 Nov 2009 06:10:50 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAI6Aoi7060566;
	Wed, 18 Nov 2009 06:10:50 GMT (envelope-from davidxu@svn.freebsd.org)
Received: (from davidxu@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAI6AoMJ060564;
	Wed, 18 Nov 2009 06:10:50 GMT (envelope-from davidxu@svn.freebsd.org)
Message-Id: <200911180610.nAI6AoMJ060564@svn.freebsd.org>
From: David Xu 
Date: Wed, 18 Nov 2009 06:10:50 +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: r199475 - head/lib/librt
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 18 Nov 2009 06:10:50 -0000

Author: davidxu
Date: Wed Nov 18 06:10:50 2009
New Revision: 199475
URL: http://svn.freebsd.org/changeset/base/199475

Log:
  Make following functions be cancellation points:
  mq_receive
  mq_send
  mq_timereceive
  mq_timedsend

Modified:
  head/lib/librt/mq.c

Modified: head/lib/librt/mq.c
==============================================================================
--- head/lib/librt/mq.c	Wed Nov 18 05:52:09 2009	(r199474)
+++ head/lib/librt/mq.c	Wed Nov 18 06:10:50 2009	(r199475)
@@ -33,6 +33,7 @@
 
 #include "namespace.h"
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -66,15 +67,15 @@ __weak_reference(__mq_getattr, mq_getatt
 __weak_reference(__mq_getattr, _mq_getattr);
 __weak_reference(__mq_setattr, mq_setattr);
 __weak_reference(__mq_setattr, _mq_setattr);
-__weak_reference(__mq_timedreceive, mq_timedreceive);
+__weak_reference(__mq_timedreceive_cancel, mq_timedreceive);
 __weak_reference(__mq_timedreceive, _mq_timedreceive);
-__weak_reference(__mq_timedsend, mq_timedsend);
+__weak_reference(__mq_timedsend_cancel, mq_timedsend);
 __weak_reference(__mq_timedsend, _mq_timedsend);
 __weak_reference(__mq_unlink, mq_unlink);
 __weak_reference(__mq_unlink, _mq_unlink);
-__weak_reference(__mq_send, mq_send);
+__weak_reference(__mq_send_cancel, mq_send);
 __weak_reference(__mq_send, _mq_send);
-__weak_reference(__mq_receive, mq_receive);
+__weak_reference(__mq_receive_cancel, mq_receive);
 __weak_reference(__mq_receive, _mq_receive);
 
 mqd_t
@@ -196,6 +197,19 @@ __mq_timedreceive(mqd_t mqd, char *buf, 
 }
 
 ssize_t
+__mq_timedreceive_cancel(mqd_t mqd, char *buf, size_t len,
+	unsigned *prio, const struct timespec *timeout)
+{
+	int oldtype;
+	int ret;
+
+	_pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype);
+	ret = __sys_kmq_timedreceive(mqd->oshandle, buf, len, prio, timeout);
+	_pthread_setcanceltype(oldtype, NULL);
+	return (ret);
+}
+
+ssize_t
 __mq_receive(mqd_t mqd, char *buf, size_t len, unsigned *prio)
 {
 
@@ -203,6 +217,17 @@ __mq_receive(mqd_t mqd, char *buf, size_
 }
 
 ssize_t
+__mq_receive_cancel(mqd_t mqd, char *buf, size_t len, unsigned *prio)
+{
+	int oldtype;
+	int ret;
+
+	_pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype);
+	ret = __sys_kmq_timedreceive(mqd->oshandle, buf, len, prio, NULL);
+	_pthread_setcanceltype(oldtype, NULL);
+	return (ret);
+}
+ssize_t
 __mq_timedsend(mqd_t mqd, char *buf, size_t len,
 	unsigned prio, const struct timespec *timeout)
 {
@@ -211,12 +236,38 @@ __mq_timedsend(mqd_t mqd, char *buf, siz
 }
 
 ssize_t
+__mq_timedsend_cancel(mqd_t mqd, char *buf, size_t len,
+	unsigned prio, const struct timespec *timeout)
+{
+	int oldtype;
+	int ret;
+
+	_pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype);
+	ret = __sys_kmq_timedsend(mqd->oshandle, buf, len, prio, timeout);
+	_pthread_setcanceltype(oldtype, NULL);
+	return (ret);
+}
+
+ssize_t
 __mq_send(mqd_t mqd, char *buf, size_t len, unsigned prio)
 {
 
 	return __sys_kmq_timedsend(mqd->oshandle, buf, len, prio, NULL);
 }
 
+
+ssize_t
+__mq_send_cancel(mqd_t mqd, char *buf, size_t len, unsigned prio)
+{
+	int oldtype;
+	int ret;
+
+	_pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype);
+	ret = __sys_kmq_timedsend(mqd->oshandle, buf, len, prio, NULL);
+	_pthread_setcanceltype(oldtype, NULL);
+	return (ret);
+}
+
 int
 __mq_unlink(const char *path)
 {

From owner-svn-src-head@FreeBSD.ORG  Wed Nov 18 12:17:06 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DBE6B106568B;
	Wed, 18 Nov 2009 12:17:06 +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 CAB918FC20;
	Wed, 18 Nov 2009 12:17:06 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAICH6Kv070843;
	Wed, 18 Nov 2009 12:17:06 GMT (envelope-from tuexen@svn.freebsd.org)
Received: (from tuexen@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAICH6kp070841;
	Wed, 18 Nov 2009 12:17:06 GMT (envelope-from tuexen@svn.freebsd.org)
Message-Id: <200911181217.nAICH6kp070841@svn.freebsd.org>
From: Michael Tuexen 
Date: Wed, 18 Nov 2009 12:17: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: r199477 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 18 Nov 2009 12:17:07 -0000

Author: tuexen
Date: Wed Nov 18 12:17:06 2009
New Revision: 199477
URL: http://svn.freebsd.org/changeset/base/199477

Log:
  Fix a bug where the system panics when a SHUTDOWN is received with an
  illegal TSN.
  
  Approved by: rrs (mentor)
  MFC after: ASAP

Modified:
  head/sys/netinet/sctp_input.c

Modified: head/sys/netinet/sctp_input.c
==============================================================================
--- head/sys/netinet/sctp_input.c	Wed Nov 18 09:20:04 2009	(r199476)
+++ head/sys/netinet/sctp_input.c	Wed Nov 18 12:17:06 2009	(r199477)
@@ -834,6 +834,9 @@ sctp_handle_shutdown(struct sctp_shutdow
 		return;
 	} else {
 		sctp_update_acked(stcb, cp, net, abort_flag);
+		if (*abort_flag) {
+			return;
+		}
 	}
 	if (asoc->control_pdapi) {
 		/*

From owner-svn-src-head@FreeBSD.ORG  Wed Nov 18 13:53:04 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 574121065698;
	Wed, 18 Nov 2009 13:53:04 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85])
	by mx1.freebsd.org (Postfix) with ESMTP id 092468FC0A;
	Wed, 18 Nov 2009 13:53:03 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
	by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id nAIDfNxG062318;
	Wed, 18 Nov 2009 06:41:23 -0700 (MST) (envelope-from imp@bsdimp.com)
Date: Wed, 18 Nov 2009 06:41:46 -0700 (MST)
Message-Id: <20091118.064146.-290369589.imp@bsdimp.com>
To: davidxu@freebsd.org
From: "M. Warner Losh" 
In-Reply-To: <4B037C0A.5030804@freebsd.org>
References: <200911180135.nAI1ZaIe051549@svn.freebsd.org>
	<20091117.210502.-1623813784.imp@bsdimp.com>
	<4B037C0A.5030804@freebsd.org>
X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r199465 - head/lib/librt
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 18 Nov 2009 13:53:04 -0000

In message: <4B037C0A.5030804@freebsd.org>
            David Xu  writes:
: M. Warner Losh wrote:
: > In message: <200911180135.nAI1ZaIe051549@svn.freebsd.org>
: >             David Xu  writes:
: > : Author: davidxu
: > : Date: Wed Nov 18 01:35:36 2009
: > : New Revision: 199465
: > : URL: http://svn.freebsd.org/changeset/base/199465
: > : 
: > : Log:
: > :   Fix compiler warnings.
: > : 
: > : Modified:
: > :   head/lib/librt/sigev_thread.c
: > : 
: > : Modified: head/lib/librt/sigev_thread.c
: > : ==============================================================================
: > : --- head/lib/librt/sigev_thread.c	Wed Nov 18 01:13:15 2009	(r199464)
: > : +++ head/lib/librt/sigev_thread.c	Wed Nov 18 01:35:36 2009	(r199465)
: > : @@ -439,9 +439,9 @@ worker_routine(void *arg)
: > :  {
: > :  	struct sigev_node *sn = arg;
: > :  
: > : -	_pthread_cleanup_push(worker_cleanup, sn);
: > : +	pthread_cleanup_push(worker_cleanup, sn);
: > :  	sn->sn_dispatch(sn);
: > : -	_pthread_cleanup_pop(1);
: > : +	pthread_cleanup_pop(1);
: > :  
: > :  	return (0);
: > :  }
: > 
: > This change causes libthr to be needed now for librt.  Before this
: > wasn't the case, so ntp break on mips now (I haven't looked at other
: > arcs yet).  _pthread_cleanup_pop is exported from libc, while
: > pthread_cleanup_pop causes __pthread_cleanup_pop_imp to be referenced,
: > which is defined in libthr.
: > 
: > I guess that's a long way of saying "gee, this seems wrong to me,
: > please explain what you are fixing better or revert this change,
: > thanks" :)
: > 
: > Warner
: > 
: > 
: 
: librt needs libpthread to function correctly, otherwise SIGEV_THREAD
: notification won't work, though the ntp code may not use it, but who
: can guarantee librt never use threads? in old design, the timer
: functions were really in libpthread and implemented as threads.
: 
: Regards,
: David Xu
: 
: 
: Index: ntpdate/Makefile
: ===================================================================
: --- ntpdate/Makefile	(revision 199351)
: +++ ntpdate/Makefile	(working copy)
: @@ -9,7 +9,7 @@
:   CFLAGS+= -I${.CURDIR}/../../../contrib/ntp/include -I${.CURDIR}/../
: 
:   DPADD=	${LIBNTP} ${LIBM} ${LIBMD} ${LIBRT}
: -LDADD=	${LIBNTP} -lm -lmd -lrt
: +LDADD=	${LIBNTP} -lm -lmd -lrt -lpthread
: 
:   CLEANFILES+= .version version.c
: 
: Index: ntpd/Makefile
: ===================================================================
: --- ntpd/Makefile	(revision 199351)
: +++ ntpd/Makefile	(working copy)
: @@ -33,7 +33,7 @@
:   	-I${.CURDIR}/../../../contrib/ntp/libopts -I${.CURDIR}
: 
:   DPADD=	${LIBPARSE} ${LIBNTP} ${LIBM} ${LIBMD} ${LIBRT} ${LIBOPTS}
: -LDADD=	${LIBPARSE} ${LIBNTP} -lm -lmd -lrt ${LIBOPTS}
: +LDADD=	${LIBPARSE} ${LIBNTP} -lm -lmd -lrt -lpthread ${LIBOPTS}
: 
:   .if ${MK_OPENSSL} != "no" && !defined(RELEASE_CRUNCH)
:   DPADD+=	${LIBCRYPTO}

I'd like to look more deeply into this issue.  Can you back out the
original commit until I can track things down a little more
completely?

Warner



From owner-svn-src-head@FreeBSD.ORG  Wed Nov 18 14:35:10 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4EA321065698;
	Wed, 18 Nov 2009 14:35:10 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85])
	by mx1.freebsd.org (Postfix) with ESMTP id 108CC8FC16;
	Wed, 18 Nov 2009 14:35:09 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
	by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id nAIEOptD063104;
	Wed, 18 Nov 2009 07:24:51 -0700 (MST) (envelope-from imp@bsdimp.com)
Date: Wed, 18 Nov 2009 07:25:14 -0700 (MST)
Message-Id: <20091118.072514.673374189.imp@bsdimp.com>
To: davidxu@freebsd.org
From: "M. Warner Losh" 
In-Reply-To: <200911180509.nAI593kQ058970@svn.freebsd.org>
References: <200911180509.nAI593kQ058970@svn.freebsd.org>
X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r199469 - head/lib/librt
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 18 Nov 2009 14:35:10 -0000

In message: <200911180509.nAI593kQ058970@svn.freebsd.org>
            David Xu  writes:
: Author: davidxu
: Date: Wed Nov 18 05:09:03 2009
: New Revision: 199469
: URL: http://svn.freebsd.org/changeset/base/199469
: 
: Log:
:   link libpthread because the librt really needs it to fully function.

If you are now requiring libpthread, why are you using the _pthread_*
functions everywhere else?

Warner

: Modified:
:   head/lib/librt/Makefile
: 
: Modified: head/lib/librt/Makefile
: ==============================================================================
: --- head/lib/librt/Makefile	Wed Nov 18 04:34:43 2009	(r199468)
: +++ head/lib/librt/Makefile	Wed Nov 18 05:09:03 2009	(r199469)
: @@ -4,6 +4,7 @@ LIB=rt
:  SHLIB_MAJOR= 1
:  CFLAGS+=-I${.CURDIR}/../libc/include -I${.CURDIR}
:  CFLAGS+=-Winline -Wall -g
: +LDADD+=-lpthread
:  
:  #MAN=	libthr.3
:  
: 

From owner-svn-src-head@FreeBSD.ORG  Wed Nov 18 14:46:47 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 44047106566B;
	Wed, 18 Nov 2009 14:46:47 +0000 (UTC)
	(envelope-from mandree@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 329C88FC1E;
	Wed, 18 Nov 2009 14:46:47 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAIEkkWL074505;
	Wed, 18 Nov 2009 14:46:46 GMT (envelope-from mandree@svn.freebsd.org)
Received: (from mandree@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAIEkke5074503;
	Wed, 18 Nov 2009 14:46:46 GMT (envelope-from mandree@svn.freebsd.org)
Message-Id: <200911181446.nAIEkke5074503@svn.freebsd.org>
From: Matthias Andree 
Date: Wed, 18 Nov 2009 14:46:46 +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: r199479 - head/share/misc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 18 Nov 2009 14:46:47 -0000

Author: mandree (ports committer)
Date: Wed Nov 18 14:46:46 2009
New Revision: 199479
URL: http://svn.freebsd.org/changeset/base/199479

Log:
  Add mandree@ and mentorship relations with garga/miwi.

Modified:
  head/share/misc/committers-ports.dot

Modified: head/share/misc/committers-ports.dot
==============================================================================
--- head/share/misc/committers-ports.dot	Wed Nov 18 14:40:00 2009	(r199478)
+++ head/share/misc/committers-ports.dot	Wed Nov 18 14:46:46 2009	(r199479)
@@ -110,6 +110,7 @@ lwhsu [label="Li-Wen Hsu\nlwhsu@FreeBSD.
 lx [label="David Thiel\nlx@FreeBSD.org\n2006/11/29"]
 maho [label="Maho Nakata\nmaho@FreeBSD.org\n2002/10/17"]
 makc [label="Max Brazhnikov\makc@FreeBSD.org\n2008/08/25"]
+mandree [label="Matthias Andree\nmandree@FreeBSD.org\n2009/11/18"]
 marcus [label="Joe Marcus Clarke\nmarcus@FreeBSD.org\n2002/04/05"]
 markus [label="Markus Brueffer\nmarkus@FreeBSD.org\n2004/02/21"]
 mat [label="Mathieu Arnold\nmat@FreeBSD.org\n2003/08/15"]
@@ -225,6 +226,7 @@ gabor -> pgj
 
 garga -> acm
 garga -> alepulver
+garga -> mandree
 garga -> mm
 garga -> rnoland
 garga -> vd
@@ -280,6 +282,7 @@ miwi -> beat
 miwi -> farrokhi
 miwi -> gahr
 miwi -> makc
+miwi -> mandree
 miwi -> mva
 miwi -> nox
 miwi -> tabthorpe

From owner-svn-src-head@FreeBSD.ORG  Wed Nov 18 14:47:47 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DD5D510656B4;
	Wed, 18 Nov 2009 14:47:47 +0000 (UTC)
	(envelope-from mandree@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CC5768FC13;
	Wed, 18 Nov 2009 14:47:47 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAIEllSP074562;
	Wed, 18 Nov 2009 14:47:47 GMT (envelope-from mandree@svn.freebsd.org)
Received: (from mandree@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAIEll9d074560;
	Wed, 18 Nov 2009 14:47:47 GMT (envelope-from mandree@svn.freebsd.org)
Message-Id: <200911181447.nAIEll9d074560@svn.freebsd.org>
From: Matthias Andree 
Date: Wed, 18 Nov 2009 14:47: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: r199480 - head/share/misc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 18 Nov 2009 14:47:48 -0000

Author: mandree (ports committer)
Date: Wed Nov 18 14:47:47 2009
New Revision: 199480
URL: http://svn.freebsd.org/changeset/base/199480

Log:
  Fix mistyped \n in makc's label.
  
  This and previous commit have been...
  Approved by:    garga (mentor)

Modified:
  head/share/misc/committers-ports.dot

Modified: head/share/misc/committers-ports.dot
==============================================================================
--- head/share/misc/committers-ports.dot	Wed Nov 18 14:46:46 2009	(r199479)
+++ head/share/misc/committers-ports.dot	Wed Nov 18 14:47:47 2009	(r199480)
@@ -109,7 +109,7 @@ lth [label="Lars Thegler\nlth@FreeBSD.or
 lwhsu [label="Li-Wen Hsu\nlwhsu@FreeBSD.org\n2007/04/03"]
 lx [label="David Thiel\nlx@FreeBSD.org\n2006/11/29"]
 maho [label="Maho Nakata\nmaho@FreeBSD.org\n2002/10/17"]
-makc [label="Max Brazhnikov\makc@FreeBSD.org\n2008/08/25"]
+makc [label="Max Brazhnikov\nmakc@FreeBSD.org\n2008/08/25"]
 mandree [label="Matthias Andree\nmandree@FreeBSD.org\n2009/11/18"]
 marcus [label="Joe Marcus Clarke\nmarcus@FreeBSD.org\n2002/04/05"]
 markus [label="Markus Brueffer\nmarkus@FreeBSD.org\n2004/02/21"]

From owner-svn-src-head@FreeBSD.ORG  Wed Nov 18 15:12:18 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 014BA106566C;
	Wed, 18 Nov 2009 15:12:18 +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 C7CF08FC1B;
	Wed, 18 Nov 2009 15:12:17 +0000 (UTC)
Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net
	[66.111.2.69])
	by cyrus.watson.org (Postfix) with ESMTPSA id 67FA046B53;
	Wed, 18 Nov 2009 10:12:17 -0500 (EST)
Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8])
	by bigwig.baldwin.cx (Postfix) with ESMTPA id 6F7A98A020;
	Wed, 18 Nov 2009 10:12:16 -0500 (EST)
From: John Baldwin 
To: Jilles Tjoelker 
Date: Wed, 18 Nov 2009 08:41:54 -0500
User-Agent: KMail/1.9.7
References: <4B01E548.7040708@gmail.com> <20091117182501.GA70742@stack.nl>
In-Reply-To: <20091117182501.GA70742@stack.nl>
MIME-Version: 1.0
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200911180841.55183.jhb@freebsd.org>
X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1
	(bigwig.baldwin.cx); Wed, 18 Nov 2009 10:12:16 -0500 (EST)
X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx
X-Virus-Status: Clean
X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE
	autolearn=no version=3.2.5
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx
Cc: svn-src-head@freebsd.org, Dmitry Pryanishnikov ,
	svn-src-all@freebsd.org, src-committers@freebsd.org,
	Edwin Groothuis 
Subject: Re: svn commit: r194783 - head/lib/libc/stdtime
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 18 Nov 2009 15:12:18 -0000

On Tuesday 17 November 2009 1:25:01 pm Jilles Tjoelker wrote:
> On Tue, Nov 17, 2009 at 01:50:32AM +0200, Dmitry Pryanishnikov wrote:
> > > Author: edwin
> > > Date: Tue Jun 23 22:28:44 2009
> > > New Revision: 194783
> > > URL: http://svn.freebsd.org/changeset/base/194783
> 
> > > Log:
> > >   Remove duplicate if-statement on gmt_is_set in gmtsub().
> 
> > >   MFC after:	1 week
> 
> > > Modified:
> > >   head/lib/libc/stdtime/localtime.c
> 
> >    This change looks like a (small?) pessimization to me: before it, 
> > _MUTEX_LOCK/_MUTEX_UNLOCK pair would be skipped for the case gmt_is_set 
> > == TRUE (all invocations except the first one), now it won't. I'm not 
> > sure whether this is critical here though...
> 
> It is certainly less efficient, but the old code was (most likely)
> wrong. It used an idiom known as "double checked locking", which is
> incorrect in most memory models. The problem is that the store to
> gmt_is_set may become visible without stores to other memory (gmtptr and
> what it points to) becoming visible.

That is easily fixed with a memory barrier.  Just use atomic_store_rel() to 
set gmt_is_set at the end of the setup phase.

-- 
John Baldwin

From owner-svn-src-head@FreeBSD.ORG  Wed Nov 18 18:05:55 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0CB1B106568F;
	Wed, 18 Nov 2009 18:05:55 +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 F04C18FC28;
	Wed, 18 Nov 2009 18:05:54 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAII5sHI079488;
	Wed, 18 Nov 2009 18:05:54 GMT (envelope-from alc@svn.freebsd.org)
Received: (from alc@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAII5s1J079483;
	Wed, 18 Nov 2009 18:05:54 GMT (envelope-from alc@svn.freebsd.org)
Message-Id: <200911181805.nAII5s1J079483@svn.freebsd.org>
From: Alan Cox 
Date: Wed, 18 Nov 2009 18:05: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: r199490 - head/sys/vm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 18 Nov 2009 18:05:55 -0000

Author: alc
Date: Wed Nov 18 18:05:54 2009
New Revision: 199490
URL: http://svn.freebsd.org/changeset/base/199490

Log:
  Simplify both the invocation and the implementation of vm_fault() for wiring
  pages.
  
  (Note: Claims made in the comments about the handling of breakpoints in
  wired pages have been false for roughly a decade.  This and another bug
  involving breakpoints will be fixed in coming changes.)
  
  Reviewed by:	kib

Modified:
  head/sys/vm/vm_extern.h
  head/sys/vm/vm_fault.c
  head/sys/vm/vm_map.c
  head/sys/vm/vm_map.h

Modified: head/sys/vm/vm_extern.h
==============================================================================
--- head/sys/vm/vm_extern.h	Wed Nov 18 17:51:54 2009	(r199489)
+++ head/sys/vm/vm_extern.h	Wed Nov 18 18:05:54 2009	(r199490)
@@ -58,7 +58,7 @@ int vm_fault(vm_map_t, vm_offset_t, vm_p
 void vm_fault_copy_entry(vm_map_t, vm_map_t, vm_map_entry_t, vm_map_entry_t,
     vm_ooffset_t *);
 void vm_fault_unwire(vm_map_t, vm_offset_t, vm_offset_t, boolean_t);
-int vm_fault_wire(vm_map_t, vm_offset_t, vm_offset_t, boolean_t, boolean_t);
+int vm_fault_wire(vm_map_t, vm_offset_t, vm_offset_t, boolean_t);
 int vm_forkproc(struct thread *, struct proc *, struct thread *, struct vmspace *, int);
 void vm_waitproc(struct proc *);
 int vm_mmap(vm_map_t, vm_offset_t *, vm_size_t, vm_prot_t, vm_prot_t, int, objtype_t, void *, vm_ooffset_t);

Modified: head/sys/vm/vm_fault.c
==============================================================================
--- head/sys/vm/vm_fault.c	Wed Nov 18 17:51:54 2009	(r199489)
+++ head/sys/vm/vm_fault.c	Wed Nov 18 18:05:54 2009	(r199490)
@@ -185,7 +185,7 @@ unlock_and_deallocate(struct faultstate 
  *	      default objects are zero-fill, there is no real pager.
  */
 #define TRYPAGER	(fs.object->type != OBJT_DEFAULT && \
-			(((fault_flags & VM_FAULT_WIRE_MASK) == 0) || wired))
+			((fault_flags & VM_FAULT_CHANGE_WIRING) == 0 || wired))
 
 /*
  *	vm_fault:
@@ -238,31 +238,15 @@ RetryFault:;
 	result = vm_map_lookup(&fs.map, vaddr, fault_type, &fs.entry,
 	    &fs.first_object, &fs.first_pindex, &prot, &wired);
 	if (result != KERN_SUCCESS) {
-		if (result != KERN_PROTECTION_FAILURE ||
-		    (fault_flags & VM_FAULT_WIRE_MASK) != VM_FAULT_USER_WIRE) {
-			if (growstack && result == KERN_INVALID_ADDRESS &&
-			    map != kernel_map && curproc != NULL) {
-				result = vm_map_growstack(curproc, vaddr);
-				if (result != KERN_SUCCESS)
-					return (KERN_FAILURE);
-				growstack = FALSE;
-				goto RetryFault;
-			}
-			return (result);
+		if (growstack && result == KERN_INVALID_ADDRESS &&
+		    map != kernel_map) {
+			result = vm_map_growstack(curproc, vaddr);
+			if (result != KERN_SUCCESS)
+				return (KERN_FAILURE);
+			growstack = FALSE;
+			goto RetryFault;
 		}
-
-		/*
-   		 * If we are user-wiring a r/w segment, and it is COW, then
-   		 * we need to do the COW operation.  Note that we don't COW
-   		 * currently RO sections now, because it is NOT desirable
-   		 * to COW .text.  We simply keep .text from ever being COW'ed
-   		 * and take the heat that one cannot debug wired .text sections.
-   		 */
-		result = vm_map_lookup(&fs.map, vaddr,
-			VM_PROT_READ|VM_PROT_WRITE|VM_PROT_OVERRIDE_WRITE,
-			&fs.entry, &fs.first_object, &fs.first_pindex, &prot, &wired);
-		if (result != KERN_SUCCESS)
-			return (result);
+		return (result);
 	}
 
 	map_generation = fs.map->timestamp;
@@ -919,9 +903,8 @@ vnode_locked:
 	 * won't find it (yet).
 	 */
 	pmap_enter(fs.map->pmap, vaddr, fault_type, fs.m, prot, wired);
-	if (((fault_flags & VM_FAULT_WIRE_MASK) == 0) && (wired == 0)) {
+	if ((fault_flags & VM_FAULT_CHANGE_WIRING) == 0 && wired == 0)
 		vm_fault_prefault(fs.map->pmap, vaddr, fs.entry);
-	}
 	VM_OBJECT_LOCK(fs.object);
 	vm_page_lock_queues();
 	vm_page_flag_set(fs.m, PG_REFERENCED);
@@ -930,7 +913,7 @@ vnode_locked:
 	 * If the page is not wired down, then put it where the pageout daemon
 	 * can find it.
 	 */
-	if (fault_flags & VM_FAULT_WIRE_MASK) {
+	if (fault_flags & VM_FAULT_CHANGE_WIRING) {
 		if (wired)
 			vm_page_wire(fs.m);
 		else
@@ -1048,7 +1031,7 @@ vm_fault_quick(caddr_t v, int prot)
  */
 int
 vm_fault_wire(vm_map_t map, vm_offset_t start, vm_offset_t end,
-    boolean_t user_wire, boolean_t fictitious)
+    boolean_t fictitious)
 {
 	vm_offset_t va;
 	int rv;
@@ -1059,9 +1042,7 @@ vm_fault_wire(vm_map_t map, vm_offset_t 
 	 * read-only sections.
 	 */
 	for (va = start; va < end; va += PAGE_SIZE) {
-		rv = vm_fault(map, va,
-		    user_wire ? VM_PROT_READ : VM_PROT_READ | VM_PROT_WRITE,
-		    user_wire ? VM_FAULT_USER_WIRE : VM_FAULT_CHANGE_WIRING);
+		rv = vm_fault(map, va, VM_PROT_NONE, VM_FAULT_CHANGE_WIRING);
 		if (rv) {
 			if (va != start)
 				vm_fault_unwire(map, start, va, fictitious);

Modified: head/sys/vm/vm_map.c
==============================================================================
--- head/sys/vm/vm_map.c	Wed Nov 18 17:51:54 2009	(r199489)
+++ head/sys/vm/vm_map.c	Wed Nov 18 18:05:54 2009	(r199490)
@@ -2381,7 +2381,7 @@ vm_map_wire(vm_map_t map, vm_offset_t st
 			 */
 			vm_map_unlock(map);
 			rv = vm_fault_wire(map, saved_start, saved_end,
-			    user_wire, fictitious);
+			    fictitious);
 			vm_map_lock(map);
 			if (last_timestamp + 1 != map->timestamp) {
 				/*
@@ -3563,7 +3563,7 @@ RetryLookup:;
 	else
 		prot = entry->protection;
 	fault_type &= (VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
-	if ((fault_type & prot) != fault_type) {
+	if ((fault_type & prot) != fault_type || prot == VM_PROT_NONE) {
 		vm_map_unlock_read(map);
 		return (KERN_PROTECTION_FAILURE);
 	}

Modified: head/sys/vm/vm_map.h
==============================================================================
--- head/sys/vm/vm_map.h	Wed Nov 18 17:51:54 2009	(r199489)
+++ head/sys/vm/vm_map.h	Wed Nov 18 18:05:54 2009	(r199490)
@@ -319,8 +319,6 @@ long vmspace_wired_count(struct vmspace 
  */
 #define VM_FAULT_NORMAL 0		/* Nothing special */
 #define VM_FAULT_CHANGE_WIRING 1	/* Change the wiring as appropriate */
-#define VM_FAULT_USER_WIRE 2		/* Likewise, but for user purposes */
-#define VM_FAULT_WIRE_MASK (VM_FAULT_CHANGE_WIRING|VM_FAULT_USER_WIRE)
 #define VM_FAULT_DIRTY 8		/* Dirty the page */
 
 /*

From owner-svn-src-head@FreeBSD.ORG  Wed Nov 18 18:48:18 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EF34D106566C;
	Wed, 18 Nov 2009 18:48:18 +0000 (UTC)
	(envelope-from rpaulo@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C60318FC13;
	Wed, 18 Nov 2009 18:48:18 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAIImITo080568;
	Wed, 18 Nov 2009 18:48:18 GMT (envelope-from rpaulo@svn.freebsd.org)
Received: (from rpaulo@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAIImIEG080565;
	Wed, 18 Nov 2009 18:48:18 GMT (envelope-from rpaulo@svn.freebsd.org)
Message-Id: <200911181848.nAIImIEG080565@svn.freebsd.org>
From: Rui Paulo 
Date: Wed, 18 Nov 2009 18:48: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: r199491 - head/sys/dev/ath/ath_hal
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 18 Nov 2009 18:48:19 -0000

Author: rpaulo
Date: Wed Nov 18 18:48:18 2009
New Revision: 199491
URL: http://svn.freebsd.org/changeset/base/199491

Log:
  Add WorldB SKU.
  
  Reviewed by:	sam
  MFC after:	1 week

Modified:
  head/sys/dev/ath/ath_hal/ah_regdomain.c

Modified: head/sys/dev/ath/ath_hal/ah_regdomain.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ah_regdomain.c	Wed Nov 18 18:05:54 2009	(r199490)
+++ head/sys/dev/ath/ath_hal/ah_regdomain.c	Wed Nov 18 18:48:18 2009	(r199491)
@@ -170,6 +170,7 @@ enum {
 
 	WOR9_WORLD	= 0x69,		/* World9 (WO9 SKU) */	
 	WORA_WORLD	= 0x6A,		/* WorldA (WOA SKU) */	
+	WORB_WORLD	= 0x6B,		/* WorldB (WOB SKU) */
 
 	MKK3_MKKB	= 0x80,		/* Japan UNI-1 even + MKKB */
 	MKK3_MKKA2	= 0x81,		/* Japan UNI-1 even + MKKA2 */
@@ -432,6 +433,7 @@ static REG_DMN_PAIR_MAPPING regDomainPai
 	{EU1_WORLD,	EU1_WORLD,	EU1_WORLD,	NO_REQ, NO_REQ, PSCAN_DEFER, CTRY_DEFAULT },
 	{WOR9_WORLD,	WOR9_WORLD,	WOR9_WORLD,	DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB, NO_REQ, PSCAN_DEFER, CTRY_DEFAULT },
 	{WORA_WORLD,	WORA_WORLD,	WORA_WORLD,	DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB, NO_REQ, PSCAN_DEFER, CTRY_DEFAULT },
+	{WORB_WORLD,	WORB_WORLD,	WORB_WORLD,	DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB, NO_REQ, PSCAN_DEFER, CTRY_DEFAULT },
 };
 
 /* 
@@ -1681,6 +1683,31 @@ static REG_DOMAIN regDomains[] = {
 				      WG1_2467_2467),
 	 .chan11g_turbo		= BM1(T3_2437_2437)},
 
+	{.regDmnEnum		= WORB_WORLD,
+	 .conformanceTestLimit	= NO_CTL,
+	 .dfsMask		= DFS_FCC3 | DFS_ETSI,
+	 .pscan			= PSCAN_WWR,
+	 .flags			= DISALLOW_ADHOC_11A,
+	 .chan11a		= BM4(W1_5260_5320,
+				      W1_5180_5240,
+				      W1_5745_5825,
+				      W1_5500_5700),
+	 .chan11b		= BM7(W1_2412_2412,
+				      W1_2437_2442,
+				      W1_2462_2462,
+				      W1_2472_2472,
+				      W1_2417_2432,
+				      W1_2447_2457,
+				      W1_2467_2467),
+	 .chan11g		= BM7(WG1_2412_2412,
+				      WG1_2437_2442,
+				      WG1_2462_2462,
+				      WG1_2472_2472,
+				      WG1_2417_2432,
+				      WG1_2447_2457,
+				      WG1_2467_2467),
+	 .chan11g_turbo		= BM1(T3_2437_2437)},
+
 	{.regDmnEnum		= NULL1,
 	 .conformanceTestLimit	= NO_CTL,
 	}

From owner-svn-src-head@FreeBSD.ORG  Wed Nov 18 19:26:17 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7D3B91065670;
	Wed, 18 Nov 2009 19:26:17 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 6BF428FC0A;
	Wed, 18 Nov 2009 19:26:17 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAIJQHsb081478;
	Wed, 18 Nov 2009 19:26:17 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAIJQHOR081471;
	Wed, 18 Nov 2009 19:26:17 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <200911181926.nAIJQHOR081471@svn.freebsd.org>
From: Jung-uk Kim 
Date: Wed, 18 Nov 2009 19:26: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: r199492 - in head/sys: amd64/amd64 i386/i386 net
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 18 Nov 2009 19:26:17 -0000

Author: jkim
Date: Wed Nov 18 19:26:17 2009
New Revision: 199492
URL: http://svn.freebsd.org/changeset/base/199492

Log:
  - Make BPF JIT compiler working again in userland.  We are limiting size of
  generated native binary to page size for now.
  - Update copyright date and fix some style nits.

Modified:
  head/sys/amd64/amd64/bpf_jit_machdep.c
  head/sys/amd64/amd64/bpf_jit_machdep.h
  head/sys/i386/i386/bpf_jit_machdep.c
  head/sys/i386/i386/bpf_jit_machdep.h
  head/sys/net/bpf_jitter.c
  head/sys/net/bpf_jitter.h

Modified: head/sys/amd64/amd64/bpf_jit_machdep.c
==============================================================================
--- head/sys/amd64/amd64/bpf_jit_machdep.c	Wed Nov 18 18:48:18 2009	(r199491)
+++ head/sys/amd64/amd64/bpf_jit_machdep.c	Wed Nov 18 19:26:17 2009	(r199492)
@@ -1,6 +1,6 @@
 /*-
  * Copyright (C) 2002-2003 NetGroup, Politecnico di Torino (Italy)
- * Copyright (C) 2005-2008 Jung-uk Kim 
+ * Copyright (C) 2005-2009 Jung-uk Kim 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -42,6 +42,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #else
 #include 
+#include 
+#include 
 #endif
 
 #include 
@@ -97,9 +99,9 @@ emit_code(bpf_bin_stream *stream, u_int 
 bpf_filter_func
 bpf_jit_compile(struct bpf_insn *prog, u_int nins, int *mem)
 {
+	bpf_bin_stream stream;
 	struct bpf_insn *ins;
 	u_int i, pass;
-	bpf_bin_stream stream;
 
 	/*
 	 * NOTE: do not modify the name of this variable, as it's used by
@@ -475,20 +477,31 @@ bpf_jit_compile(struct bpf_insn *prog, u
 		}
 
 		pass++;
-		if (pass == 2)
+		if (pass >= 2) {
+#ifndef _KERNEL
+			if (mprotect(stream.ibuf, stream.cur_ip,
+			    PROT_READ | PROT_EXEC) != 0) {
+				munmap(stream.ibuf, BPF_JIT_MAXSIZE);
+				stream.ibuf = NULL;
+			}
+#endif
 			break;
+		}
 
 #ifdef _KERNEL
 		stream.ibuf = (char *)malloc(stream.cur_ip, M_BPFJIT, M_NOWAIT);
-		if (stream.ibuf == NULL) {
-			free(stream.refs, M_BPFJIT);
-			return (NULL);
-		}
+		if (stream.ibuf == NULL)
+			break;
 #else
-		stream.ibuf = (char *)malloc(stream.cur_ip);
-		if (stream.ibuf == NULL) {
-			free(stream.refs);
-			return (NULL);
+		if (stream.cur_ip > BPF_JIT_MAXSIZE) {
+			stream.ibuf = NULL;
+			break;
+		}
+		stream.ibuf = (char *)mmap(NULL, BPF_JIT_MAXSIZE,
+		    PROT_READ | PROT_WRITE, MAP_ANON, -1, 0);
+		if (stream.ibuf == MAP_FAILED) {
+			stream.ibuf = NULL;
+			break;
 		}
 #endif
 

Modified: head/sys/amd64/amd64/bpf_jit_machdep.h
==============================================================================
--- head/sys/amd64/amd64/bpf_jit_machdep.h	Wed Nov 18 18:48:18 2009	(r199491)
+++ head/sys/amd64/amd64/bpf_jit_machdep.h	Wed Nov 18 19:26:17 2009	(r199492)
@@ -1,6 +1,6 @@
 /*-
  * Copyright (C) 2002-2003 NetGroup, Politecnico di Torino (Italy)
- * Copyright (C) 2005-2008 Jung-uk Kim 
+ * Copyright (C) 2005-2009 Jung-uk Kim 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: head/sys/i386/i386/bpf_jit_machdep.c
==============================================================================
--- head/sys/i386/i386/bpf_jit_machdep.c	Wed Nov 18 18:48:18 2009	(r199491)
+++ head/sys/i386/i386/bpf_jit_machdep.c	Wed Nov 18 19:26:17 2009	(r199492)
@@ -1,6 +1,6 @@
 /*-
  * Copyright (C) 2002-2003 NetGroup, Politecnico di Torino (Italy)
- * Copyright (C) 2005-2008 Jung-uk Kim 
+ * Copyright (C) 2005-2009 Jung-uk Kim 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -42,6 +42,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #else
 #include 
+#include 
+#include 
 #endif
 
 #include 
@@ -97,9 +99,9 @@ emit_code(bpf_bin_stream *stream, u_int 
 bpf_filter_func
 bpf_jit_compile(struct bpf_insn *prog, u_int nins, int *mem)
 {
+	bpf_bin_stream stream;
 	struct bpf_insn *ins;
 	u_int i, pass;
-	bpf_bin_stream stream;
 
 	/*
 	 * NOTE: do not modify the name of this variable, as it's used by
@@ -498,20 +500,31 @@ bpf_jit_compile(struct bpf_insn *prog, u
 		}
 
 		pass++;
-		if (pass == 2)
+		if (pass >= 2) {
+#ifndef _KERNEL
+			if (mprotect(stream.ibuf, stream.cur_ip,
+			    PROT_READ | PROT_EXEC) != 0) {
+				munmap(stream.ibuf, BPF_JIT_MAXSIZE);
+				stream.ibuf = NULL;
+			}
+#endif
 			break;
+		}
 
 #ifdef _KERNEL
 		stream.ibuf = (char *)malloc(stream.cur_ip, M_BPFJIT, M_NOWAIT);
-		if (stream.ibuf == NULL) {
-			free(stream.refs, M_BPFJIT);
-			return (NULL);
-		}
+		if (stream.ibuf == NULL)
+			break;
 #else
-		stream.ibuf = (char *)malloc(stream.cur_ip);
-		if (stream.ibuf == NULL) {
-			free(stream.refs);
-			return (NULL);
+		if (stream.cur_ip > BPF_JIT_MAXSIZE) {
+			stream.ibuf = NULL;
+			break;
+		}
+		stream.ibuf = (char *)mmap(NULL, BPF_JIT_MAXSIZE,
+		    PROT_READ | PROT_WRITE, MAP_ANON, -1, 0);
+		if (stream.ibuf == MAP_FAILED) {
+			stream.ibuf = NULL;
+			break;
 		}
 #endif
 

Modified: head/sys/i386/i386/bpf_jit_machdep.h
==============================================================================
--- head/sys/i386/i386/bpf_jit_machdep.h	Wed Nov 18 18:48:18 2009	(r199491)
+++ head/sys/i386/i386/bpf_jit_machdep.h	Wed Nov 18 19:26:17 2009	(r199492)
@@ -1,6 +1,6 @@
 /*-
  * Copyright (C) 2002-2003 NetGroup, Politecnico di Torino (Italy)
- * Copyright (C) 2005-2008 Jung-uk Kim 
+ * Copyright (C) 2005-2009 Jung-uk Kim 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: head/sys/net/bpf_jitter.c
==============================================================================
--- head/sys/net/bpf_jitter.c	Wed Nov 18 18:48:18 2009	(r199491)
+++ head/sys/net/bpf_jitter.c	Wed Nov 18 19:26:17 2009	(r199492)
@@ -1,6 +1,6 @@
 /*-
  * Copyright (C) 2002-2003 NetGroup, Politecnico di Torino (Italy)
- * Copyright (C) 2005-2008 Jung-uk Kim 
+ * Copyright (C) 2005-2009 Jung-uk Kim 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -43,6 +43,8 @@ __FBSDID("$FreeBSD$");
 #else
 #include 
 #include 
+#include 
+#include 
 #include 
 #endif
 
@@ -127,7 +129,7 @@ bpf_destroy_jit_filter(bpf_jit_filter *f
 {
 
 	if (filter->func != bpf_jit_accept_all)
-		free(filter->func);
+		munmap(filter->func, BPF_JIT_MAXSIZE);
 	free(filter);
 }
 #endif

Modified: head/sys/net/bpf_jitter.h
==============================================================================
--- head/sys/net/bpf_jitter.h	Wed Nov 18 18:48:18 2009	(r199491)
+++ head/sys/net/bpf_jitter.h	Wed Nov 18 19:26:17 2009	(r199492)
@@ -1,6 +1,6 @@
 /*-
  * Copyright (C) 2002-2003 NetGroup, Politecnico di Torino (Italy)
- * Copyright (C) 2005-2008 Jung-uk Kim 
+ * Copyright (C) 2005-2009 Jung-uk Kim 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -36,6 +36,8 @@
 
 #ifdef _KERNEL
 MALLOC_DECLARE(M_BPFJIT);
+#else
+#define	BPF_JIT_MAXSIZE		PAGE_SIZE
 #endif
 
 extern int bpf_jitter_enable;

From owner-svn-src-head@FreeBSD.ORG  Wed Nov 18 22:39:07 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7601A1065694;
	Wed, 18 Nov 2009 22:39:07 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42])
	by mx1.freebsd.org (Postfix) with ESMTP id 1BF568FC18;
	Wed, 18 Nov 2009 22:39:07 +0000 (UTC)
Received: from fledge.watson.org (fledge.watson.org [65.122.17.41])
	by cyrus.watson.org (Postfix) with ESMTPS id 7C4BB46B03;
	Wed, 18 Nov 2009 17:39:06 -0500 (EST)
Date: Wed, 18 Nov 2009 22:39:06 +0000 (GMT)
From: Robert Watson 
X-X-Sender: robert@fledge.watson.org
To: Jung-uk Kim 
In-Reply-To: <200911181926.nAIJQHOR081471@svn.freebsd.org>
Message-ID: 
References: <200911181926.nAIJQHOR081471@svn.freebsd.org>
User-Agent: Alpine 2.00 (BSF 1167 2008-08-23)
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r199492 - in head/sys: amd64/amd64 i386/i386 net
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 18 Nov 2009 22:39:07 -0000

On Wed, 18 Nov 2009, Jung-uk Kim wrote:

> Author: jkim
> Date: Wed Nov 18 19:26:17 2009
> New Revision: 199492
> URL: http://svn.freebsd.org/changeset/base/199492
>
> Log:
>  - Make BPF JIT compiler working again in userland.  We are limiting size of
>  generated native binary to page size for now.
>  - Update copyright date and fix some style nits.

I'm not sure if you have noticed, but there are a bunch of embedded target 
ports of the BPF JIT in the PR collection -- ARM, MIPS, etc.  Any chance we 
might see those integrated into 9.x at some point?  The less cache-rich CPUs 
are especially helped by JIT parts.

Robert N M Watson
Computer Laboratory
University of Cambridge

>
> Modified:
>  head/sys/amd64/amd64/bpf_jit_machdep.c
>  head/sys/amd64/amd64/bpf_jit_machdep.h
>  head/sys/i386/i386/bpf_jit_machdep.c
>  head/sys/i386/i386/bpf_jit_machdep.h
>  head/sys/net/bpf_jitter.c
>  head/sys/net/bpf_jitter.h
>
> Modified: head/sys/amd64/amd64/bpf_jit_machdep.c
> ==============================================================================
> --- head/sys/amd64/amd64/bpf_jit_machdep.c	Wed Nov 18 18:48:18 2009	(r199491)
> +++ head/sys/amd64/amd64/bpf_jit_machdep.c	Wed Nov 18 19:26:17 2009	(r199492)
> @@ -1,6 +1,6 @@
> /*-
>  * Copyright (C) 2002-2003 NetGroup, Politecnico di Torino (Italy)
> - * Copyright (C) 2005-2008 Jung-uk Kim 
> + * Copyright (C) 2005-2009 Jung-uk Kim 
>  * All rights reserved.
>  *
>  * Redistribution and use in source and binary forms, with or without
> @@ -42,6 +42,8 @@ __FBSDID("$FreeBSD$");
> #include 
> #else
> #include 
> +#include 
> +#include 
> #endif
>
> #include 
> @@ -97,9 +99,9 @@ emit_code(bpf_bin_stream *stream, u_int
> bpf_filter_func
> bpf_jit_compile(struct bpf_insn *prog, u_int nins, int *mem)
> {
> +	bpf_bin_stream stream;
> 	struct bpf_insn *ins;
> 	u_int i, pass;
> -	bpf_bin_stream stream;
>
> 	/*
> 	 * NOTE: do not modify the name of this variable, as it's used by
> @@ -475,20 +477,31 @@ bpf_jit_compile(struct bpf_insn *prog, u
> 		}
>
> 		pass++;
> -		if (pass == 2)
> +		if (pass >= 2) {
> +#ifndef _KERNEL
> +			if (mprotect(stream.ibuf, stream.cur_ip,
> +			    PROT_READ | PROT_EXEC) != 0) {
> +				munmap(stream.ibuf, BPF_JIT_MAXSIZE);
> +				stream.ibuf = NULL;
> +			}
> +#endif
> 			break;
> +		}
>
> #ifdef _KERNEL
> 		stream.ibuf = (char *)malloc(stream.cur_ip, M_BPFJIT, M_NOWAIT);
> -		if (stream.ibuf == NULL) {
> -			free(stream.refs, M_BPFJIT);
> -			return (NULL);
> -		}
> +		if (stream.ibuf == NULL)
> +			break;
> #else
> -		stream.ibuf = (char *)malloc(stream.cur_ip);
> -		if (stream.ibuf == NULL) {
> -			free(stream.refs);
> -			return (NULL);
> +		if (stream.cur_ip > BPF_JIT_MAXSIZE) {
> +			stream.ibuf = NULL;
> +			break;
> +		}
> +		stream.ibuf = (char *)mmap(NULL, BPF_JIT_MAXSIZE,
> +		    PROT_READ | PROT_WRITE, MAP_ANON, -1, 0);
> +		if (stream.ibuf == MAP_FAILED) {
> +			stream.ibuf = NULL;
> +			break;
> 		}
> #endif
>
>
> Modified: head/sys/amd64/amd64/bpf_jit_machdep.h
> ==============================================================================
> --- head/sys/amd64/amd64/bpf_jit_machdep.h	Wed Nov 18 18:48:18 2009	(r199491)
> +++ head/sys/amd64/amd64/bpf_jit_machdep.h	Wed Nov 18 19:26:17 2009	(r199492)
> @@ -1,6 +1,6 @@
> /*-
>  * Copyright (C) 2002-2003 NetGroup, Politecnico di Torino (Italy)
> - * Copyright (C) 2005-2008 Jung-uk Kim 
> + * Copyright (C) 2005-2009 Jung-uk Kim 
>  * All rights reserved.
>  *
>  * Redistribution and use in source and binary forms, with or without
>
> Modified: head/sys/i386/i386/bpf_jit_machdep.c
> ==============================================================================
> --- head/sys/i386/i386/bpf_jit_machdep.c	Wed Nov 18 18:48:18 2009	(r199491)
> +++ head/sys/i386/i386/bpf_jit_machdep.c	Wed Nov 18 19:26:17 2009	(r199492)
> @@ -1,6 +1,6 @@
> /*-
>  * Copyright (C) 2002-2003 NetGroup, Politecnico di Torino (Italy)
> - * Copyright (C) 2005-2008 Jung-uk Kim 
> + * Copyright (C) 2005-2009 Jung-uk Kim 
>  * All rights reserved.
>  *
>  * Redistribution and use in source and binary forms, with or without
> @@ -42,6 +42,8 @@ __FBSDID("$FreeBSD$");
> #include 
> #else
> #include 
> +#include 
> +#include 
> #endif
>
> #include 
> @@ -97,9 +99,9 @@ emit_code(bpf_bin_stream *stream, u_int
> bpf_filter_func
> bpf_jit_compile(struct bpf_insn *prog, u_int nins, int *mem)
> {
> +	bpf_bin_stream stream;
> 	struct bpf_insn *ins;
> 	u_int i, pass;
> -	bpf_bin_stream stream;
>
> 	/*
> 	 * NOTE: do not modify the name of this variable, as it's used by
> @@ -498,20 +500,31 @@ bpf_jit_compile(struct bpf_insn *prog, u
> 		}
>
> 		pass++;
> -		if (pass == 2)
> +		if (pass >= 2) {
> +#ifndef _KERNEL
> +			if (mprotect(stream.ibuf, stream.cur_ip,
> +			    PROT_READ | PROT_EXEC) != 0) {
> +				munmap(stream.ibuf, BPF_JIT_MAXSIZE);
> +				stream.ibuf = NULL;
> +			}
> +#endif
> 			break;
> +		}
>
> #ifdef _KERNEL
> 		stream.ibuf = (char *)malloc(stream.cur_ip, M_BPFJIT, M_NOWAIT);
> -		if (stream.ibuf == NULL) {
> -			free(stream.refs, M_BPFJIT);
> -			return (NULL);
> -		}
> +		if (stream.ibuf == NULL)
> +			break;
> #else
> -		stream.ibuf = (char *)malloc(stream.cur_ip);
> -		if (stream.ibuf == NULL) {
> -			free(stream.refs);
> -			return (NULL);
> +		if (stream.cur_ip > BPF_JIT_MAXSIZE) {
> +			stream.ibuf = NULL;
> +			break;
> +		}
> +		stream.ibuf = (char *)mmap(NULL, BPF_JIT_MAXSIZE,
> +		    PROT_READ | PROT_WRITE, MAP_ANON, -1, 0);
> +		if (stream.ibuf == MAP_FAILED) {
> +			stream.ibuf = NULL;
> +			break;
> 		}
> #endif
>
>
> Modified: head/sys/i386/i386/bpf_jit_machdep.h
> ==============================================================================
> --- head/sys/i386/i386/bpf_jit_machdep.h	Wed Nov 18 18:48:18 2009	(r199491)
> +++ head/sys/i386/i386/bpf_jit_machdep.h	Wed Nov 18 19:26:17 2009	(r199492)
> @@ -1,6 +1,6 @@
> /*-
>  * Copyright (C) 2002-2003 NetGroup, Politecnico di Torino (Italy)
> - * Copyright (C) 2005-2008 Jung-uk Kim 
> + * Copyright (C) 2005-2009 Jung-uk Kim 
>  * All rights reserved.
>  *
>  * Redistribution and use in source and binary forms, with or without
>
> Modified: head/sys/net/bpf_jitter.c
> ==============================================================================
> --- head/sys/net/bpf_jitter.c	Wed Nov 18 18:48:18 2009	(r199491)
> +++ head/sys/net/bpf_jitter.c	Wed Nov 18 19:26:17 2009	(r199492)
> @@ -1,6 +1,6 @@
> /*-
>  * Copyright (C) 2002-2003 NetGroup, Politecnico di Torino (Italy)
> - * Copyright (C) 2005-2008 Jung-uk Kim 
> + * Copyright (C) 2005-2009 Jung-uk Kim 
>  * All rights reserved.
>  *
>  * Redistribution and use in source and binary forms, with or without
> @@ -43,6 +43,8 @@ __FBSDID("$FreeBSD$");
> #else
> #include 
> #include 
> +#include 
> +#include 
> #include 
> #endif
>
> @@ -127,7 +129,7 @@ bpf_destroy_jit_filter(bpf_jit_filter *f
> {
>
> 	if (filter->func != bpf_jit_accept_all)
> -		free(filter->func);
> +		munmap(filter->func, BPF_JIT_MAXSIZE);
> 	free(filter);
> }
> #endif
>
> Modified: head/sys/net/bpf_jitter.h
> ==============================================================================
> --- head/sys/net/bpf_jitter.h	Wed Nov 18 18:48:18 2009	(r199491)
> +++ head/sys/net/bpf_jitter.h	Wed Nov 18 19:26:17 2009	(r199492)
> @@ -1,6 +1,6 @@
> /*-
>  * Copyright (C) 2002-2003 NetGroup, Politecnico di Torino (Italy)
> - * Copyright (C) 2005-2008 Jung-uk Kim 
> + * Copyright (C) 2005-2009 Jung-uk Kim 
>  * All rights reserved.
>  *
>  * Redistribution and use in source and binary forms, with or without
> @@ -36,6 +36,8 @@
>
> #ifdef _KERNEL
> MALLOC_DECLARE(M_BPFJIT);
> +#else
> +#define	BPF_JIT_MAXSIZE		PAGE_SIZE
> #endif
>
> extern int bpf_jitter_enable;
>

From owner-svn-src-head@FreeBSD.ORG  Wed Nov 18 23:40:19 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A6777106566C;
	Wed, 18 Nov 2009 23:40:19 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9340A8FC08;
	Wed, 18 Nov 2009 23:40:19 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAINeJ6T087656;
	Wed, 18 Nov 2009 23:40:19 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAINeJ3W087652;
	Wed, 18 Nov 2009 23:40:19 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <200911182340.nAINeJ3W087652@svn.freebsd.org>
From: Jung-uk Kim 
Date: Wed, 18 Nov 2009 23:40: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: r199498 - in head/sys: amd64/amd64 i386/i386 net
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 18 Nov 2009 23:40:19 -0000

Author: jkim
Date: Wed Nov 18 23:40:19 2009
New Revision: 199498
URL: http://svn.freebsd.org/changeset/base/199498

Log:
  - Change internal function bpf_jit_compile() to return allocated size of
  the generated binary and remove page size limitation for userland.
  - Use contigmalloc(9)/contigfree(9) instead of malloc(9)/free(9) to make
  sure the generated binary aligns properly and make it physically contiguous.

Modified:
  head/sys/amd64/amd64/bpf_jit_machdep.c
  head/sys/i386/i386/bpf_jit_machdep.c
  head/sys/net/bpf_jitter.c
  head/sys/net/bpf_jitter.h

Modified: head/sys/amd64/amd64/bpf_jit_machdep.c
==============================================================================
--- head/sys/amd64/amd64/bpf_jit_machdep.c	Wed Nov 18 22:53:05 2009	(r199497)
+++ head/sys/amd64/amd64/bpf_jit_machdep.c	Wed Nov 18 23:40:19 2009	(r199498)
@@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-bpf_filter_func	bpf_jit_compile(struct bpf_insn *, u_int, int *);
+bpf_filter_func	bpf_jit_compile(struct bpf_insn *, u_int, size_t *, int *);
 
 /*
  * emit routine to update the jump table
@@ -97,7 +97,7 @@ emit_code(bpf_bin_stream *stream, u_int 
  * Function that does the real stuff
  */
 bpf_filter_func
-bpf_jit_compile(struct bpf_insn *prog, u_int nins, int *mem)
+bpf_jit_compile(struct bpf_insn *prog, u_int nins, size_t *size, int *mem)
 {
 	bpf_bin_stream stream;
 	struct bpf_insn *ins;
@@ -481,23 +481,21 @@ bpf_jit_compile(struct bpf_insn *prog, u
 #ifndef _KERNEL
 			if (mprotect(stream.ibuf, stream.cur_ip,
 			    PROT_READ | PROT_EXEC) != 0) {
-				munmap(stream.ibuf, BPF_JIT_MAXSIZE);
+				munmap(stream.ibuf, stream.cur_ip);
 				stream.ibuf = NULL;
 			}
 #endif
+			*size = stream.cur_ip;
 			break;
 		}
 
 #ifdef _KERNEL
-		stream.ibuf = (char *)malloc(stream.cur_ip, M_BPFJIT, M_NOWAIT);
+		stream.ibuf = (char *)contigmalloc(stream.cur_ip, M_BPFJIT,
+		    M_NOWAIT, 0, ~0ULL, 16, 0);
 		if (stream.ibuf == NULL)
 			break;
 #else
-		if (stream.cur_ip > BPF_JIT_MAXSIZE) {
-			stream.ibuf = NULL;
-			break;
-		}
-		stream.ibuf = (char *)mmap(NULL, BPF_JIT_MAXSIZE,
+		stream.ibuf = (char *)mmap(NULL, stream.cur_ip,
 		    PROT_READ | PROT_WRITE, MAP_ANON, -1, 0);
 		if (stream.ibuf == MAP_FAILED) {
 			stream.ibuf = NULL;

Modified: head/sys/i386/i386/bpf_jit_machdep.c
==============================================================================
--- head/sys/i386/i386/bpf_jit_machdep.c	Wed Nov 18 22:53:05 2009	(r199497)
+++ head/sys/i386/i386/bpf_jit_machdep.c	Wed Nov 18 23:40:19 2009	(r199498)
@@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-bpf_filter_func	bpf_jit_compile(struct bpf_insn *, u_int, int *);
+bpf_filter_func	bpf_jit_compile(struct bpf_insn *, u_int, size_t *, int *);
 
 /*
  * emit routine to update the jump table
@@ -97,7 +97,7 @@ emit_code(bpf_bin_stream *stream, u_int 
  * Function that does the real stuff
  */
 bpf_filter_func
-bpf_jit_compile(struct bpf_insn *prog, u_int nins, int *mem)
+bpf_jit_compile(struct bpf_insn *prog, u_int nins, size_t *size, int *mem)
 {
 	bpf_bin_stream stream;
 	struct bpf_insn *ins;
@@ -504,23 +504,21 @@ bpf_jit_compile(struct bpf_insn *prog, u
 #ifndef _KERNEL
 			if (mprotect(stream.ibuf, stream.cur_ip,
 			    PROT_READ | PROT_EXEC) != 0) {
-				munmap(stream.ibuf, BPF_JIT_MAXSIZE);
+				munmap(stream.ibuf, stream.cur_ip);
 				stream.ibuf = NULL;
 			}
 #endif
+			*size = stream.cur_ip;
 			break;
 		}
 
 #ifdef _KERNEL
-		stream.ibuf = (char *)malloc(stream.cur_ip, M_BPFJIT, M_NOWAIT);
+		stream.ibuf = (char *)contigmalloc(stream.cur_ip, M_BPFJIT,
+		    M_NOWAIT, 0, ~0ULL, 16, 0);
 		if (stream.ibuf == NULL)
 			break;
 #else
-		if (stream.cur_ip > BPF_JIT_MAXSIZE) {
-			stream.ibuf = NULL;
-			break;
-		}
-		stream.ibuf = (char *)mmap(NULL, BPF_JIT_MAXSIZE,
+		stream.ibuf = (char *)mmap(NULL, stream.cur_ip,
 		    PROT_READ | PROT_WRITE, MAP_ANON, -1, 0);
 		if (stream.ibuf == MAP_FAILED) {
 			stream.ibuf = NULL;

Modified: head/sys/net/bpf_jitter.c
==============================================================================
--- head/sys/net/bpf_jitter.c	Wed Nov 18 22:53:05 2009	(r199497)
+++ head/sys/net/bpf_jitter.c	Wed Nov 18 23:40:19 2009	(r199498)
@@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-bpf_filter_func	bpf_jit_compile(struct bpf_insn *, u_int, int *);
+bpf_filter_func	bpf_jit_compile(struct bpf_insn *, u_int, size_t *, int *);
 
 static u_int	bpf_jit_accept_all(u_char *, u_int, u_int);
 
@@ -81,7 +81,8 @@ bpf_jitter(struct bpf_insn *fp, int nins
 	}
 
 	/* Create the binary */
-	if ((filter->func = bpf_jit_compile(fp, nins, filter->mem)) == NULL) {
+	if ((filter->func = bpf_jit_compile(fp, nins, &filter->size,
+	    filter->mem)) == NULL) {
 		free(filter, M_BPFJIT);
 		return (NULL);
 	}
@@ -94,7 +95,7 @@ bpf_destroy_jit_filter(bpf_jit_filter *f
 {
 
 	if (filter->func != bpf_jit_accept_all)
-		free(filter->func, M_BPFJIT);
+		contigfree(filter->func, filter->size, M_BPFJIT);
 	free(filter, M_BPFJIT);
 }
 #else
@@ -116,7 +117,8 @@ bpf_jitter(struct bpf_insn *fp, int nins
 	}
 
 	/* Create the binary */
-	if ((filter->func = bpf_jit_compile(fp, nins, filter->mem)) == NULL) {
+	if ((filter->func = bpf_jit_compile(fp, nins, &filter->size,
+	    filter->mem)) == NULL) {
 		free(filter);
 		return (NULL);
 	}
@@ -129,7 +131,7 @@ bpf_destroy_jit_filter(bpf_jit_filter *f
 {
 
 	if (filter->func != bpf_jit_accept_all)
-		munmap(filter->func, BPF_JIT_MAXSIZE);
+		munmap(filter->func, filter->size);
 	free(filter);
 }
 #endif

Modified: head/sys/net/bpf_jitter.h
==============================================================================
--- head/sys/net/bpf_jitter.h	Wed Nov 18 22:53:05 2009	(r199497)
+++ head/sys/net/bpf_jitter.h	Wed Nov 18 23:40:19 2009	(r199498)
@@ -36,8 +36,6 @@
 
 #ifdef _KERNEL
 MALLOC_DECLARE(M_BPFJIT);
-#else
-#define	BPF_JIT_MAXSIZE		PAGE_SIZE
 #endif
 
 extern int bpf_jitter_enable;
@@ -55,7 +53,7 @@ typedef u_int (*bpf_filter_func)(u_char 
 typedef struct bpf_jit_filter {
 	/* The native filtering binary, in the form of a bpf_filter_func. */
 	bpf_filter_func	func;
-
+	size_t		size;
 	int		mem[BPF_MEMWORDS];	/* Scratch memory */
 } bpf_jit_filter;
 

From owner-svn-src-head@FreeBSD.ORG  Wed Nov 18 23:47:52 2009
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from [127.0.0.1] (freefall.freebsd.org [IPv6:2001:4f8:fff6::28])
	by hub.freebsd.org (Postfix) with ESMTP id 66444106568B;
	Wed, 18 Nov 2009 23:47:52 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
From: Jung-uk Kim 
To: Robert Watson 
Date: Wed, 18 Nov 2009 18:47:34 -0500
User-Agent: KMail/1.6.2
References: <200911181926.nAIJQHOR081471@svn.freebsd.org>
	
In-Reply-To: 
MIME-Version: 1.0
Content-Disposition: inline
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Message-Id: <200911181847.44496.jkim@FreeBSD.org>
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r199492 - in head/sys: amd64/amd64 i386/i386 net
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 18 Nov 2009 23:47:52 -0000

On Wednesday 18 November 2009 05:39 pm, Robert Watson wrote:
> I'm not sure if you have noticed, but there are a bunch of embedded
> target ports of the BPF JIT in the PR collection -- ARM, MIPS, etc.
>  Any chance we might see those integrated into 9.x at some point? 
> The less cache-rich CPUs are especially helped by JIT parts.

Yes, I am aware of such patches.  However, I am not qualified to 
review/test them. :-(

If someone has time/hardware/knowledge to verify their correctness, 
I'll be happy to commit them.

Thanks,

Jung-uk Kim

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 00:00:32 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6B0D7106566C;
	Thu, 19 Nov 2009 00:00:32 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 565E78FC0C;
	Thu, 19 Nov 2009 00:00:32 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAJ00WJS088115;
	Thu, 19 Nov 2009 00:00:32 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAJ00WPa088112;
	Thu, 19 Nov 2009 00:00:32 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <200911190000.nAJ00WPa088112@svn.freebsd.org>
From: Jung-uk Kim 
Date: Thu, 19 Nov 2009 00: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: r199499 - in head/tools/regression/bpf/bpf_filter: .
	tests
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 00:00:32 -0000

Author: jkim
Date: Thu Nov 19 00:00:31 2009
New Revision: 199499
URL: http://svn.freebsd.org/changeset/base/199499

Log:
  Add a test case for very long BPF program.

Added:
  head/tools/regression/bpf/bpf_filter/tests/test0084.h   (contents, props changed)
Modified:
  head/tools/regression/bpf/bpf_filter/Makefile

Modified: head/tools/regression/bpf/bpf_filter/Makefile
==============================================================================
--- head/tools/regression/bpf/bpf_filter/Makefile	Wed Nov 18 23:40:19 2009	(r199498)
+++ head/tools/regression/bpf/bpf_filter/Makefile	Thu Nov 19 00:00:31 2009	(r199499)
@@ -20,7 +20,7 @@ TEST_CASES?=	test0001 test0002 test0003 
 		test0069 test0070 test0071 test0072	\
 		test0073 test0074 test0075 test0076	\
 		test0077 test0078 test0079 test0080	\
-		test0081 test0082 test0083
+		test0081 test0082 test0083 test0084
 
 SYSDIR?=	${.CURDIR}/../../../../sys
 

Added: head/tools/regression/bpf/bpf_filter/tests/test0084.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/regression/bpf/bpf_filter/tests/test0084.h	Thu Nov 19 00:00:31 2009	(r199499)
@@ -0,0 +1,1030 @@
+/*-
+ * Test 0084:	Check very long BPF program.
+ *
+ * $FreeBSD$
+ */
+
+/* BPF program */
+struct bpf_insn pc[] = {
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),
+	BPF_STMT(BPF_LD+BPF_W+BPF_ABS, 1),

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 01:11:16 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9EA6F1065676;
	Thu, 19 Nov 2009 01:11:16 +0000 (UTC)
	(envelope-from davidxu@freebsd.org)
Received: from freefall.freebsd.org (freefall.freebsd.org
	[IPv6:2001:4f8:fff6::28])
	by mx1.freebsd.org (Postfix) with ESMTP id 8BCF18FC20;
	Thu, 19 Nov 2009 01:11:16 +0000 (UTC)
Received: from apple.my.domain (localhost [127.0.0.1])
	by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id nAJ1BE7x006003;
	Thu, 19 Nov 2009 01:11:15 GMT (envelope-from davidxu@freebsd.org)
Message-ID: <4B049B32.6090801@freebsd.org>
Date: Thu, 19 Nov 2009 09:11:14 +0800
From: David Xu 
User-Agent: Thunderbird 2.0.0.9 (X11/20080612)
MIME-Version: 1.0
To: "M. Warner Losh" 
References: <200911180509.nAI593kQ058970@svn.freebsd.org>
	<20091118.072514.673374189.imp@bsdimp.com>
In-Reply-To: <20091118.072514.673374189.imp@bsdimp.com>
Content-Type: text/plain; charset=ISO-8859-1; 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: r199469 - head/lib/librt
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 01:11:16 -0000

M. Warner Losh wrote:
> In message: <200911180509.nAI593kQ058970@svn.freebsd.org>
>             David Xu  writes:
> : Author: davidxu
> : Date: Wed Nov 18 05:09:03 2009
> : New Revision: 199469
> : URL: http://svn.freebsd.org/changeset/base/199469
> : 
> : Log:
> :   link libpthread because the librt really needs it to fully function.
> 
> If you are now requiring libpthread, why are you using the _pthread_*
> functions everywhere else?
> 
> Warner

now the pthread_cleanup_push is a macro, but originally it is a
function.

I don't know if we need an underline version of pthread_cleanup_push,
it is trivial if one wants to add it.



From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 01:27:22 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DB864106566C;
	Thu, 19 Nov 2009 01:27:22 +0000 (UTC)
	(envelope-from marcel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C9ED88FC15;
	Thu, 19 Nov 2009 01:27:22 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAJ1RMjZ089832;
	Thu, 19 Nov 2009 01:27:22 GMT (envelope-from marcel@svn.freebsd.org)
Received: (from marcel@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAJ1RMLb089829;
	Thu, 19 Nov 2009 01:27:22 GMT (envelope-from marcel@svn.freebsd.org)
Message-Id: <200911190127.nAJ1RMLb089829@svn.freebsd.org>
From: Marcel Moolenaar 
Date: Thu, 19 Nov 2009 01:27: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: r199502 - head/sys/ia64/ia64
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 01:27:23 -0000

Author: marcel
Date: Thu Nov 19 01:27:22 2009
New Revision: 199502
URL: http://svn.freebsd.org/changeset/base/199502

Log:
  opt_* headers are included using the quoted form.

Modified:
  head/sys/ia64/ia64/db_machdep.c
  head/sys/ia64/ia64/exception.S

Modified: head/sys/ia64/ia64/db_machdep.c
==============================================================================
--- head/sys/ia64/ia64/db_machdep.c	Thu Nov 19 01:20:16 2009	(r199501)
+++ head/sys/ia64/ia64/db_machdep.c	Thu Nov 19 01:27:22 2009	(r199502)
@@ -29,7 +29,7 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#include 
+#include "opt_xtrace.h"
 
 #include 
 #include 

Modified: head/sys/ia64/ia64/exception.S
==============================================================================
--- head/sys/ia64/ia64/exception.S	Thu Nov 19 01:20:16 2009	(r199501)
+++ head/sys/ia64/ia64/exception.S	Thu Nov 19 01:27:22 2009	(r199502)
@@ -28,7 +28,7 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#include 
+#include "opt_xtrace.h"
 
 #include 
 #include 

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 04:12:37 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5CD2D106566C;
	Thu, 19 Nov 2009 04:12:37 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85])
	by mx1.freebsd.org (Postfix) with ESMTP id 1D5378FC0A;
	Thu, 19 Nov 2009 04:12:37 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
	by harmony.bsdimp.com (8.14.3/8.14.1) with ESMTP id nAJ46ZWi072500;
	Wed, 18 Nov 2009 21:06:35 -0700 (MST) (envelope-from imp@bsdimp.com)
Date: Wed, 18 Nov 2009 21:06:59 -0700 (MST)
Message-Id: <20091118.210659.63015724.imp@bsdimp.com>
To: davidxu@freebsd.org
From: "M. Warner Losh" 
In-Reply-To: <4B049B32.6090801@freebsd.org>
References: <200911180509.nAI593kQ058970@svn.freebsd.org>
	<20091118.072514.673374189.imp@bsdimp.com>
	<4B049B32.6090801@freebsd.org>
X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r199469 - head/lib/librt
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 04:12:37 -0000

In message: <4B049B32.6090801@freebsd.org>
            David Xu  writes:
: M. Warner Losh wrote:
: > In message: <200911180509.nAI593kQ058970@svn.freebsd.org>
: >             David Xu  writes:
: > : Author: davidxu
: > : Date: Wed Nov 18 05:09:03 2009
: > : New Revision: 199469
: > : URL: http://svn.freebsd.org/changeset/base/199469
: > : 
: > : Log:
: > :   link libpthread because the librt really needs it to fully function.
: > 
: > If you are now requiring libpthread, why are you using the _pthread_*
: > functions everywhere else?
: > 
: > Warner
: 
: now the pthread_cleanup_push is a macro, but originally it is a
: function.
: 
: I don't know if we need an underline version of pthread_cleanup_push,
: it is trivial if one wants to add it.

That makes sense.  won't we need some compat shim for old binaries?

Warner

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 08:10:24 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DB572106566C;
	Thu, 19 Nov 2009 08:10:24 +0000 (UTC)
	(envelope-from darrenr@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C9E748FC0A;
	Thu, 19 Nov 2009 08:10:24 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAJ8AOdu098107;
	Thu, 19 Nov 2009 08:10:24 GMT (envelope-from darrenr@svn.freebsd.org)
Received: (from darrenr@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAJ8AOKF098105;
	Thu, 19 Nov 2009 08:10:24 GMT (envelope-from darrenr@svn.freebsd.org)
Message-Id: <200911190810.nAJ8AOKF098105@svn.freebsd.org>
From: Darren Reed 
Date: Thu, 19 Nov 2009 08:10:24 +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: r199510 - head/contrib/ipfilter/man
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 08:10:25 -0000

Author: darrenr
Date: Thu Nov 19 08:10:24 2009
New Revision: 199510
URL: http://svn.freebsd.org/changeset/base/199510

Log:
  fix spelling mistake

Modified:
  head/contrib/ipfilter/man/ipf.8

Modified: head/contrib/ipfilter/man/ipf.8
==============================================================================
--- head/contrib/ipfilter/man/ipf.8	Thu Nov 19 07:01:09 2009	(r199509)
+++ head/contrib/ipfilter/man/ipf.8	Thu Nov 19 08:10:24 2009	(r199510)
@@ -46,7 +46,7 @@ supports \fBlanguage\fI.  At present, th
 \fBC\fB (-cc) for which two files - \fBip_rules.c\fP
 and \fBip_rules.h\fP are generated in the \fBCURRENT DIRECTORY\fP when
 \fBipf\fP is being run.  These files can be used with the
-\fBIPFILTER_COMPILED\fP kernel option to build filter rules staticly into
+\fBIPFILTER_COMPILED\fP kernel option to build filter rules staticlly into
 the kernel.
 .TP
 .B \-d

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 08:26:28 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6A7C5106566C;
	Thu, 19 Nov 2009 08:26:28 +0000 (UTC)
	(envelope-from rwatson@FreeBSD.org)
Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42])
	by mx1.freebsd.org (Postfix) with ESMTP id 2A3618FC27;
	Thu, 19 Nov 2009 08:26:28 +0000 (UTC)
Received: from fledge.watson.org (fledge.watson.org [65.122.17.41])
	by cyrus.watson.org (Postfix) with ESMTPS id B1D5946B03;
	Thu, 19 Nov 2009 03:26:27 -0500 (EST)
Date: Thu, 19 Nov 2009 08:26:27 +0000 (GMT)
From: Robert Watson 
X-X-Sender: robert@fledge.watson.org
To: Jung-uk Kim 
In-Reply-To: <200911182340.nAINeJ3W087652@svn.freebsd.org>
Message-ID: 
References: <200911182340.nAINeJ3W087652@svn.freebsd.org>
User-Agent: Alpine 2.00 (BSF 1167 2008-08-23)
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r199498 - in head/sys: amd64/amd64 i386/i386 net
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 08:26:28 -0000


On Wed, 18 Nov 2009, Jung-uk Kim wrote:

>  - Change internal function bpf_jit_compile() to return allocated size of
>  the generated binary and remove page size limitation for userland.
>  - Use contigmalloc(9)/contigfree(9) instead of malloc(9)/free(9) to make
>  sure the generated binary aligns properly and make it physically contiguous.

Is physical contiguity actually required here -- I would have thought virtual 
contiguity and alignment would be sufficient, in which case the normal trick 
is to allocate using malloc the size + min-align + 1 and then fudge the 
pointer forward until it's properly aligned.

Also, in 9.x I'm going to be looking at parallel execution within BPF 
descriptors, and I notice that the JIT compiles the register array pointer 
into the generated code, rather than allowing a pointer to be passed in to 
each instance.  I guess it's non-trivial to change that, suggesting that we 
have a pool of compiled instances, but it would be preferable to be able to do 
what the normal BPF code does: allocate a per-thread register block when 
needed.

Robert N M Watson
Computer Laboratory
University of Cambridge

> Modified:
>  head/sys/amd64/amd64/bpf_jit_machdep.c
>  head/sys/i386/i386/bpf_jit_machdep.c
>  head/sys/net/bpf_jitter.c
>  head/sys/net/bpf_jitter.h
>
> Modified: head/sys/amd64/amd64/bpf_jit_machdep.c
> ==============================================================================
> --- head/sys/amd64/amd64/bpf_jit_machdep.c	Wed Nov 18 22:53:05 2009	(r199497)
> +++ head/sys/amd64/amd64/bpf_jit_machdep.c	Wed Nov 18 23:40:19 2009	(r199498)
> @@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$");
>
> #include 
>
> -bpf_filter_func	bpf_jit_compile(struct bpf_insn *, u_int, int *);
> +bpf_filter_func	bpf_jit_compile(struct bpf_insn *, u_int, size_t *, int *);
>
> /*
>  * emit routine to update the jump table
> @@ -97,7 +97,7 @@ emit_code(bpf_bin_stream *stream, u_int
>  * Function that does the real stuff
>  */
> bpf_filter_func
> -bpf_jit_compile(struct bpf_insn *prog, u_int nins, int *mem)
> +bpf_jit_compile(struct bpf_insn *prog, u_int nins, size_t *size, int *mem)
> {
> 	bpf_bin_stream stream;
> 	struct bpf_insn *ins;
> @@ -481,23 +481,21 @@ bpf_jit_compile(struct bpf_insn *prog, u
> #ifndef _KERNEL
> 			if (mprotect(stream.ibuf, stream.cur_ip,
> 			    PROT_READ | PROT_EXEC) != 0) {
> -				munmap(stream.ibuf, BPF_JIT_MAXSIZE);
> +				munmap(stream.ibuf, stream.cur_ip);
> 				stream.ibuf = NULL;
> 			}
> #endif
> +			*size = stream.cur_ip;
> 			break;
> 		}
>
> #ifdef _KERNEL
> -		stream.ibuf = (char *)malloc(stream.cur_ip, M_BPFJIT, M_NOWAIT);
> +		stream.ibuf = (char *)contigmalloc(stream.cur_ip, M_BPFJIT,
> +		    M_NOWAIT, 0, ~0ULL, 16, 0);
> 		if (stream.ibuf == NULL)
> 			break;
> #else
> -		if (stream.cur_ip > BPF_JIT_MAXSIZE) {
> -			stream.ibuf = NULL;
> -			break;
> -		}
> -		stream.ibuf = (char *)mmap(NULL, BPF_JIT_MAXSIZE,
> +		stream.ibuf = (char *)mmap(NULL, stream.cur_ip,
> 		    PROT_READ | PROT_WRITE, MAP_ANON, -1, 0);
> 		if (stream.ibuf == MAP_FAILED) {
> 			stream.ibuf = NULL;
>
> Modified: head/sys/i386/i386/bpf_jit_machdep.c
> ==============================================================================
> --- head/sys/i386/i386/bpf_jit_machdep.c	Wed Nov 18 22:53:05 2009	(r199497)
> +++ head/sys/i386/i386/bpf_jit_machdep.c	Wed Nov 18 23:40:19 2009	(r199498)
> @@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$");
>
> #include 
>
> -bpf_filter_func	bpf_jit_compile(struct bpf_insn *, u_int, int *);
> +bpf_filter_func	bpf_jit_compile(struct bpf_insn *, u_int, size_t *, int *);
>
> /*
>  * emit routine to update the jump table
> @@ -97,7 +97,7 @@ emit_code(bpf_bin_stream *stream, u_int
>  * Function that does the real stuff
>  */
> bpf_filter_func
> -bpf_jit_compile(struct bpf_insn *prog, u_int nins, int *mem)
> +bpf_jit_compile(struct bpf_insn *prog, u_int nins, size_t *size, int *mem)
> {
> 	bpf_bin_stream stream;
> 	struct bpf_insn *ins;
> @@ -504,23 +504,21 @@ bpf_jit_compile(struct bpf_insn *prog, u
> #ifndef _KERNEL
> 			if (mprotect(stream.ibuf, stream.cur_ip,
> 			    PROT_READ | PROT_EXEC) != 0) {
> -				munmap(stream.ibuf, BPF_JIT_MAXSIZE);
> +				munmap(stream.ibuf, stream.cur_ip);
> 				stream.ibuf = NULL;
> 			}
> #endif
> +			*size = stream.cur_ip;
> 			break;
> 		}
>
> #ifdef _KERNEL
> -		stream.ibuf = (char *)malloc(stream.cur_ip, M_BPFJIT, M_NOWAIT);
> +		stream.ibuf = (char *)contigmalloc(stream.cur_ip, M_BPFJIT,
> +		    M_NOWAIT, 0, ~0ULL, 16, 0);
> 		if (stream.ibuf == NULL)
> 			break;
> #else
> -		if (stream.cur_ip > BPF_JIT_MAXSIZE) {
> -			stream.ibuf = NULL;
> -			break;
> -		}
> -		stream.ibuf = (char *)mmap(NULL, BPF_JIT_MAXSIZE,
> +		stream.ibuf = (char *)mmap(NULL, stream.cur_ip,
> 		    PROT_READ | PROT_WRITE, MAP_ANON, -1, 0);
> 		if (stream.ibuf == MAP_FAILED) {
> 			stream.ibuf = NULL;
>
> Modified: head/sys/net/bpf_jitter.c
> ==============================================================================
> --- head/sys/net/bpf_jitter.c	Wed Nov 18 22:53:05 2009	(r199497)
> +++ head/sys/net/bpf_jitter.c	Wed Nov 18 23:40:19 2009	(r199498)
> @@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$");
> #include 
> #include 
>
> -bpf_filter_func	bpf_jit_compile(struct bpf_insn *, u_int, int *);
> +bpf_filter_func	bpf_jit_compile(struct bpf_insn *, u_int, size_t *, int *);
>
> static u_int	bpf_jit_accept_all(u_char *, u_int, u_int);
>
> @@ -81,7 +81,8 @@ bpf_jitter(struct bpf_insn *fp, int nins
> 	}
>
> 	/* Create the binary */
> -	if ((filter->func = bpf_jit_compile(fp, nins, filter->mem)) == NULL) {
> +	if ((filter->func = bpf_jit_compile(fp, nins, &filter->size,
> +	    filter->mem)) == NULL) {
> 		free(filter, M_BPFJIT);
> 		return (NULL);
> 	}
> @@ -94,7 +95,7 @@ bpf_destroy_jit_filter(bpf_jit_filter *f
> {
>
> 	if (filter->func != bpf_jit_accept_all)
> -		free(filter->func, M_BPFJIT);
> +		contigfree(filter->func, filter->size, M_BPFJIT);
> 	free(filter, M_BPFJIT);
> }
> #else
> @@ -116,7 +117,8 @@ bpf_jitter(struct bpf_insn *fp, int nins
> 	}
>
> 	/* Create the binary */
> -	if ((filter->func = bpf_jit_compile(fp, nins, filter->mem)) == NULL) {
> +	if ((filter->func = bpf_jit_compile(fp, nins, &filter->size,
> +	    filter->mem)) == NULL) {
> 		free(filter);
> 		return (NULL);
> 	}
> @@ -129,7 +131,7 @@ bpf_destroy_jit_filter(bpf_jit_filter *f
> {
>
> 	if (filter->func != bpf_jit_accept_all)
> -		munmap(filter->func, BPF_JIT_MAXSIZE);
> +		munmap(filter->func, filter->size);
> 	free(filter);
> }
> #endif
>
> Modified: head/sys/net/bpf_jitter.h
> ==============================================================================
> --- head/sys/net/bpf_jitter.h	Wed Nov 18 22:53:05 2009	(r199497)
> +++ head/sys/net/bpf_jitter.h	Wed Nov 18 23:40:19 2009	(r199498)
> @@ -36,8 +36,6 @@
>
> #ifdef _KERNEL
> MALLOC_DECLARE(M_BPFJIT);
> -#else
> -#define	BPF_JIT_MAXSIZE		PAGE_SIZE
> #endif
>
> extern int bpf_jitter_enable;
> @@ -55,7 +53,7 @@ typedef u_int (*bpf_filter_func)(u_char
> typedef struct bpf_jit_filter {
> 	/* The native filtering binary, in the form of a bpf_filter_func. */
> 	bpf_filter_func	func;
> -
> +	size_t		size;
> 	int		mem[BPF_MEMWORDS];	/* Scratch memory */
> } bpf_jit_filter;
>
>

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 08:32:10 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4A3D4106566B;
	Thu, 19 Nov 2009 08:32:10 +0000 (UTC)
	(envelope-from bzeeb-lists@lists.zabbadoz.net)
Received: from mail.cksoft.de (mail.cksoft.de [IPv6:2001:4068:10::3])
	by mx1.freebsd.org (Postfix) with ESMTP id D28A08FC17;
	Thu, 19 Nov 2009 08:32:09 +0000 (UTC)
Received: from localhost (amavis.fra.cksoft.de [192.168.74.71])
	by mail.cksoft.de (Postfix) with ESMTP id D524041C756;
	Thu, 19 Nov 2009 09:32:07 +0100 (CET)
X-Virus-Scanned: amavisd-new at cksoft.de
Received: from mail.cksoft.de ([192.168.74.103])
	by localhost (amavis.fra.cksoft.de [192.168.74.71]) (amavisd-new,
	port 10024)
	with ESMTP id DE0NEYWiSDn7; Thu, 19 Nov 2009 09:32:07 +0100 (CET)
Received: by mail.cksoft.de (Postfix, from userid 66)
	id 2D88A41C75C; Thu, 19 Nov 2009 09:32:07 +0100 (CET)
Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net
	[10.111.66.10])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.int.zabbadoz.net (Postfix) with ESMTP id 4769C4448E6;
	Thu, 19 Nov 2009 08:30:54 +0000 (UTC)
Date: Thu, 19 Nov 2009 08:30:54 +0000 (UTC)
From: "Bjoern A. Zeeb" 
X-X-Sender: bz@maildrop.int.zabbadoz.net
To: Darren Reed 
In-Reply-To: <200911190810.nAJ8AOKF098105@svn.freebsd.org>
Message-ID: <20091119083005.S37440@maildrop.int.zabbadoz.net>
References: <200911190810.nAJ8AOKF098105@svn.freebsd.org>
X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842
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: r199510 - head/contrib/ipfilter/man
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 08:32:10 -0000

On Thu, 19 Nov 2009, Darren Reed wrote:

> Author: darrenr
> Date: Thu Nov 19 08:10:24 2009
> New Revision: 199510
> URL: http://svn.freebsd.org/changeset/base/199510
>
> Log:
>  fix spelling mistake
>
> Modified:
>  head/contrib/ipfilter/man/ipf.8
>
> Modified: head/contrib/ipfilter/man/ipf.8
> ==============================================================================
> --- head/contrib/ipfilter/man/ipf.8	Thu Nov 19 07:01:09 2009	(r199509)
> +++ head/contrib/ipfilter/man/ipf.8	Thu Nov 19 08:10:24 2009	(r199510)
> @@ -46,7 +46,7 @@ supports \fBlanguage\fI.  At present, th
> \fBC\fB (-cc) for which two files - \fBip_rules.c\fP
> and \fBip_rules.h\fP are generated in the \fBCURRENT DIRECTORY\fP when
> \fBipf\fP is being run.  These files can be used with the
> -\fBIPFILTER_COMPILED\fP kernel option to build filter rules staticly into
> +\fBIPFILTER_COMPILED\fP kernel option to build filter rules staticlly into

I might need coffee, still, but did you mean "statically"?


> the kernel.
> .TP
> .B \-d
>

-- 
Bjoern A. Zeeb         It will not break if you know what you are doing.

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 11:55:20 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1DD04106566C;
	Thu, 19 Nov 2009 11:55:20 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0D0E18FC0C;
	Thu, 19 Nov 2009 11:55:20 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAJBtJ5Z005582;
	Thu, 19 Nov 2009 11:55:19 GMT (envelope-from bms@svn.freebsd.org)
Received: (from bms@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAJBtJRT005580;
	Thu, 19 Nov 2009 11:55:19 GMT (envelope-from bms@svn.freebsd.org)
Message-Id: <200911191155.nAJBtJRT005580@svn.freebsd.org>
From: Bruce M Simpson 
Date: Thu, 19 Nov 2009 11:55: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: r199518 - head/sys/netinet6
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 11:55:20 -0000

Author: bms
Date: Thu Nov 19 11:55:19 2009
New Revision: 199518
URL: http://svn.freebsd.org/changeset/base/199518

Log:
  Adapt the fix for IGMPv2 in r199287 for the IPv6 stack.
  Only multicast routing is affected by the issue.
  
  MFC after:	1 day

Modified:
  head/sys/netinet6/raw_ip6.c

Modified: head/sys/netinet6/raw_ip6.c
==============================================================================
--- head/sys/netinet6/raw_ip6.c	Thu Nov 19 11:16:37 2009	(r199517)
+++ head/sys/netinet6/raw_ip6.c	Thu Nov 19 11:55:19 2009	(r199518)
@@ -213,17 +213,39 @@ rip6_input(struct mbuf **mp, int *offp, 
 		 */
 		if (in6p->in6p_moptions &&
 		    IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) {
-			struct sockaddr_in6 mcaddr;
+			/*
+			 * If the incoming datagram is for MLD, allow it
+			 * through unconditionally to the raw socket.
+			 *
+			 * Use the M_RTALERT_MLD flag to check for MLD
+			 * traffic without having to inspect the mbuf chain
+			 * more deeply, as all MLDv1/v2 host messages MUST
+			 * contain the Router Alert option.
+			 *
+			 * In the case of MLDv1, we may not have explicitly
+			 * joined the group, and may have set IFF_ALLMULTI
+			 * on the interface. im6o_mc_filter() may discard
+			 * control traffic we actually need to see.
+			 *
+			 * Userland multicast routing daemons should continue
+			 * filter the control traffic appropriately.
+			 */
 			int blocked;
 
-			bzero(&mcaddr, sizeof(struct sockaddr_in6));
-			mcaddr.sin6_len = sizeof(struct sockaddr_in6);
-			mcaddr.sin6_family = AF_INET6;
-			mcaddr.sin6_addr = ip6->ip6_dst;
-
-			blocked = im6o_mc_filter(in6p->in6p_moptions, ifp,
-			    (struct sockaddr *)&mcaddr,
-			    (struct sockaddr *)&fromsa);
+			blocked = MCAST_PASS;
+			if ((m->m_flags & M_RTALERT_MLD) == 0) {
+				struct sockaddr_in6 mcaddr;
+
+				bzero(&mcaddr, sizeof(struct sockaddr_in6));
+				mcaddr.sin6_len = sizeof(struct sockaddr_in6);
+				mcaddr.sin6_family = AF_INET6;
+				mcaddr.sin6_addr = ip6->ip6_dst;
+
+				blocked = im6o_mc_filter(in6p->in6p_moptions,
+				    ifp,
+				    (struct sockaddr *)&mcaddr,
+				    (struct sockaddr *)&fromsa);
+			}
 			if (blocked != MCAST_PASS) {
 				IP6STAT_INC(ip6s_notmember);
 				continue;

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 12:18:31 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 408F8106568D;
	Thu, 19 Nov 2009 12:18:31 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3050C8FC18;
	Thu, 19 Nov 2009 12:18:31 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAJCIVq0006228;
	Thu, 19 Nov 2009 12:18:31 GMT (envelope-from bms@svn.freebsd.org)
Received: (from bms@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAJCIV2u006226;
	Thu, 19 Nov 2009 12:18:31 GMT (envelope-from bms@svn.freebsd.org)
Message-Id: <200911191218.nAJCIV2u006226@svn.freebsd.org>
From: Bruce M Simpson 
Date: Thu, 19 Nov 2009 12:18: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: r199522 - head/sys/netinet6
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 12:18:31 -0000

Author: bms
Date: Thu Nov 19 12:18:30 2009
New Revision: 199522
URL: http://svn.freebsd.org/changeset/base/199522

Log:
  Adapt r197130 to IPv6 stack:
    Fix an obvious logic error in the IPv4 multicast leave processing,
    where the filter mode vector was not updated correctly after the leave.
  
  MFC after:	1 day

Modified:
  head/sys/netinet6/in6_mcast.c

Modified: head/sys/netinet6/in6_mcast.c
==============================================================================
--- head/sys/netinet6/in6_mcast.c	Thu Nov 19 12:10:34 2009	(r199521)
+++ head/sys/netinet6/in6_mcast.c	Thu Nov 19 12:18:30 2009	(r199522)
@@ -2272,8 +2272,10 @@ out_im6f_rollback:
 
 	if (is_final) {
 		/* Remove the gap in the membership array. */
-		for (++idx; idx < imo->im6o_num_memberships; ++idx)
+		for (++idx; idx < imo->im6o_num_memberships; ++idx) {
 			imo->im6o_membership[idx-1] = imo->im6o_membership[idx];
+			imo->im6o_mfilters[idx-1] = imo->im6o_mfilters[idx];
+		}
 		imo->im6o_num_memberships--;
 	}
 

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 12:21:20 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9A2A81065670;
	Thu, 19 Nov 2009 12:21:20 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 885188FC12;
	Thu, 19 Nov 2009 12:21:20 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAJCLKdn006383;
	Thu, 19 Nov 2009 12:21:20 GMT (envelope-from bms@svn.freebsd.org)
Received: (from bms@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAJCLKox006381;
	Thu, 19 Nov 2009 12:21:20 GMT (envelope-from bms@svn.freebsd.org)
Message-Id: <200911191221.nAJCLKox006381@svn.freebsd.org>
From: Bruce M Simpson 
Date: Thu, 19 Nov 2009 12:21: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: r199523 - head/sys/netinet6
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 12:21:20 -0000

Author: bms
Date: Thu Nov 19 12:21:20 2009
New Revision: 199523
URL: http://svn.freebsd.org/changeset/base/199523

Log:
  Adapt r197314 to IPv6 stack:
    Return ENOBUFS consistently if user attempts to exceed
    in_mcast_maxsocksrc resource limit.
  
  MFC after:	1 day

Modified:
  head/sys/netinet6/in6_mcast.c

Modified: head/sys/netinet6/in6_mcast.c
==============================================================================
--- head/sys/netinet6/in6_mcast.c	Thu Nov 19 12:18:30 2009	(r199522)
+++ head/sys/netinet6/in6_mcast.c	Thu Nov 19 12:21:20 2009	(r199523)
@@ -2342,9 +2342,11 @@ in6p_set_source_filters(struct inpcb *in
 	if (error)
 		return (error);
 
-	if (msfr.msfr_nsrcs > in6_mcast_maxsocksrc ||
-	    (msfr.msfr_fmode != MCAST_EXCLUDE &&
-	     msfr.msfr_fmode != MCAST_INCLUDE))
+	if (msfr.msfr_nsrcs > in6_mcast_maxsocksrc)
+		return (ENOBUFS);
+
+	if (msfr.msfr_fmode != MCAST_EXCLUDE &&
+	    msfr.msfr_fmode != MCAST_INCLUDE)
 		return (EINVAL);
 
 	if (msfr.msfr_group.ss_family != AF_INET6 ||

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 13:21:38 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 462771065670;
	Thu, 19 Nov 2009 13:21:38 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 362308FC08;
	Thu, 19 Nov 2009 13:21:38 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAJDLc5x007666;
	Thu, 19 Nov 2009 13:21:38 GMT (envelope-from bms@svn.freebsd.org)
Received: (from bms@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAJDLc4d007664;
	Thu, 19 Nov 2009 13:21:38 GMT (envelope-from bms@svn.freebsd.org)
Message-Id: <200911191321.nAJDLc4d007664@svn.freebsd.org>
From: Bruce M Simpson 
Date: Thu, 19 Nov 2009 13:21: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: r199525 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 13:21:38 -0000

Author: bms
Date: Thu Nov 19 13:21:37 2009
New Revision: 199525
URL: http://svn.freebsd.org/changeset/base/199525

Log:
  Correct a comment.
  
  MFC after:	1 day

Modified:
  head/sys/netinet/in_mcast.c

Modified: head/sys/netinet/in_mcast.c
==============================================================================
--- head/sys/netinet/in_mcast.c	Thu Nov 19 12:51:19 2009	(r199524)
+++ head/sys/netinet/in_mcast.c	Thu Nov 19 13:21:37 2009	(r199525)
@@ -1967,7 +1967,7 @@ inp_join_group(struct inpcb *inp, struct
 		imf = &imo->imo_mfilters[idx];
 		if (ssa->ss.ss_family != AF_UNSPEC) {
 			/*
-			 * MCAST_JOIN_SOURCE on an exclusive membership
+			 * MCAST_JOIN_SOURCE_GROUP on an exclusive membership
 			 * is an error. On an existing inclusive membership,
 			 * it just adds the source to the filter list.
 			 */

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 13:30:07 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4908E106566C;
	Thu, 19 Nov 2009 13:30:07 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 38B3A8FC17;
	Thu, 19 Nov 2009 13:30:07 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAJDU7kI007904;
	Thu, 19 Nov 2009 13:30:07 GMT (envelope-from bms@svn.freebsd.org)
Received: (from bms@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAJDU72V007902;
	Thu, 19 Nov 2009 13:30:07 GMT (envelope-from bms@svn.freebsd.org)
Message-Id: <200911191330.nAJDU72V007902@svn.freebsd.org>
From: Bruce M Simpson 
Date: Thu, 19 Nov 2009 13:30: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: r199526 - head/sys/netinet6
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 13:30:07 -0000

Author: bms
Date: Thu Nov 19 13:30:06 2009
New Revision: 199526
URL: http://svn.freebsd.org/changeset/base/199526

Log:
  Adapt r197132 to IPv6 stack:
    Tighten input checking in in6p_join_group():
     * Don't try to use the source address, when its family is unspecified.
     * If we get a join without a source, on an existing inclusive
       mode group, this is an error, as it would change the filter mode.
  
    Fix a problem with the handling of in6_mfilter for new memberships:
     * Do not rely on im6f being NULL; it is explicitly initialized to a
       non-NULL pointer when constructing a membership.
     * Explicitly initialize *im6f to EX mode when the source address
       is unspecified.
  
    This fixes a problem with in_mfilter slot recycling in the join path.
  
  MFC after:	1 day

Modified:
  head/sys/netinet6/in6_mcast.c

Modified: head/sys/netinet6/in6_mcast.c
==============================================================================
--- head/sys/netinet6/in6_mcast.c	Thu Nov 19 13:21:37 2009	(r199525)
+++ head/sys/netinet6/in6_mcast.c	Thu Nov 19 13:30:06 2009	(r199526)
@@ -1917,11 +1917,6 @@ in6p_join_group(struct inpcb *inp, struc
 	 */
 	(void)in6_setscope(&gsa->sin6.sin6_addr, ifp, NULL);
 
-	/*
-	 * MCAST_JOIN_SOURCE on an exclusive membership is an error.
-	 * On an existing inclusive membership, it just adds the
-	 * source to the filter list.
-	 */
 	imo = in6p_findmoptions(inp);
 	idx = im6o_match_group(imo, ifp, &gsa->sa);
 	if (idx == -1) {
@@ -1929,15 +1924,33 @@ in6p_join_group(struct inpcb *inp, struc
 	} else {
 		inm = imo->im6o_membership[idx];
 		imf = &imo->im6o_mfilters[idx];
-		if (ssa->ss.ss_family != AF_UNSPEC &&
-		    imf->im6f_st[1] != MCAST_INCLUDE) {
-			error = EINVAL;
-			goto out_in6p_locked;
-		}
-		lims = im6o_match_source(imo, idx, &ssa->sa);
-		if (lims != NULL) {
-			error = EADDRNOTAVAIL;
-			goto out_in6p_locked;
+		if (ssa->ss.ss_family != AF_UNSPEC) {
+			/*
+			 * MCAST_JOIN_SOURCE_GROUP on an exclusive membership
+			 * is an error. On an existing inclusive membership,
+			 * it just adds the source to the filter list.
+			 */
+			if (imf->im6f_st[1] != MCAST_INCLUDE) {
+				error = EINVAL;
+				goto out_in6p_locked;
+			}
+			/* Throw out duplicates. */
+			lims = im6o_match_source(imo, idx, &ssa->sa);
+			if (lims != NULL) {
+				error = EADDRNOTAVAIL;
+				goto out_in6p_locked;
+			}
+		} else {
+			/*
+			 * MCAST_JOIN_GROUP on an existing inclusive
+			 * membership is an error; if you want to change
+			 * filter mode, you must use the userland API
+			 * setsourcefilter().
+			 */
+			if (imf->im6f_st[1] == MCAST_INCLUDE) {
+				error = EINVAL;
+				goto out_in6p_locked;
+			}
 		}
 	}
 
@@ -1970,7 +1983,8 @@ in6p_join_group(struct inpcb *inp, struc
 	/*
 	 * Graft new source into filter list for this inpcb's
 	 * membership of the group. The in6_multi may not have
-	 * been allocated yet if this is a new membership.
+	 * been allocated yet if this is a new membership, however,
+	 * the in_mfilter slot will be allocated and must be initialized.
 	 */
 	if (ssa->ss.ss_family != AF_UNSPEC) {
 		/* Membership starts in IN mode */
@@ -1987,6 +2001,12 @@ in6p_join_group(struct inpcb *inp, struc
 			error = ENOMEM;
 			goto out_im6o_free;
 		}
+	} else {
+		/* No address specified; Membership starts in EX mode */
+		if (is_new) {
+			CTR1(KTR_MLD, "%s: new join w/o source", __func__);
+			im6f_init(imf, MCAST_UNDEFINED, MCAST_EXCLUDE);
+		}
 	}
 
 	/*

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 13:33:24 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0A2FE1065693;
	Thu, 19 Nov 2009 13:33:24 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D4A4D8FC0C;
	Thu, 19 Nov 2009 13:33:23 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAJDXNQw008049;
	Thu, 19 Nov 2009 13:33:23 GMT (envelope-from bms@svn.freebsd.org)
Received: (from bms@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAJDXNvT008047;
	Thu, 19 Nov 2009 13:33:23 GMT (envelope-from bms@svn.freebsd.org)
Message-Id: <200911191333.nAJDXNvT008047@svn.freebsd.org>
From: Bruce M Simpson 
Date: Thu, 19 Nov 2009 13:33: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: r199527 - head/sys/netinet6
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 13:33:24 -0000

Author: bms
Date: Thu Nov 19 13:33:23 2009
New Revision: 199527
URL: http://svn.freebsd.org/changeset/base/199527

Log:
  Adapt r197135 to IPv6 stack:
    Don't allow joins w/o source on an existing group.
    This is almost always pilot error.
  
    We don't need to check for group filter UNDEFINED state at t1,
    because we only ever allocate filters with their groups, so we
    unconditionally reject such calls with EINVAL.
    Trying to change the active filter mode w/o going through IPV6_MSFILTER
    is also disallowed.
  
  MFC after:	1 day

Modified:
  head/sys/netinet6/in6_mcast.c

Modified: head/sys/netinet6/in6_mcast.c
==============================================================================
--- head/sys/netinet6/in6_mcast.c	Thu Nov 19 13:30:06 2009	(r199526)
+++ head/sys/netinet6/in6_mcast.c	Thu Nov 19 13:33:23 2009	(r199527)
@@ -1942,15 +1942,18 @@ in6p_join_group(struct inpcb *inp, struc
 			}
 		} else {
 			/*
-			 * MCAST_JOIN_GROUP on an existing inclusive
-			 * membership is an error; if you want to change
-			 * filter mode, you must use the userland API
-			 * setsourcefilter().
+			 * MCAST_JOIN_GROUP alone, on any existing membership,
+			 * is rejected, to stop the same inpcb tying up
+			 * multiple refs to the in_multi.
+			 * On an existing inclusive membership, this is also
+			 * an error; if you want to change filter mode,
+			 * you must use the userland API setsourcefilter().
+			 * XXX We don't reject this for imf in UNDEFINED
+			 * state at t1, because allocation of a filter
+			 * is atomic with allocation of a membership.
 			 */
-			if (imf->im6f_st[1] == MCAST_INCLUDE) {
-				error = EINVAL;
-				goto out_in6p_locked;
-			}
+			error = EINVAL;
+			goto out_in6p_locked;
 		}
 	}
 
@@ -1985,6 +1988,9 @@ in6p_join_group(struct inpcb *inp, struc
 	 * membership of the group. The in6_multi may not have
 	 * been allocated yet if this is a new membership, however,
 	 * the in_mfilter slot will be allocated and must be initialized.
+	 *
+	 * Note: Grafting of exclusive mode filters doesn't happen
+	 * in this path.
 	 */
 	if (ssa->ss.ss_family != AF_UNSPEC) {
 		/* Membership starts in IN mode */

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 13:39:07 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B773F106566B;
	Thu, 19 Nov 2009 13:39:07 +0000 (UTC) (envelope-from bms@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A749E8FC18;
	Thu, 19 Nov 2009 13:39:07 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAJDd7TO008197;
	Thu, 19 Nov 2009 13:39:07 GMT (envelope-from bms@svn.freebsd.org)
Received: (from bms@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAJDd7MS008195;
	Thu, 19 Nov 2009 13:39:07 GMT (envelope-from bms@svn.freebsd.org)
Message-Id: <200911191339.nAJDd7MS008195@svn.freebsd.org>
From: Bruce M Simpson 
Date: Thu, 19 Nov 2009 13:39: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: r199528 - head/sys/netinet6
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 13:39:07 -0000

Author: bms
Date: Thu Nov 19 13:39:07 2009
New Revision: 199528
URL: http://svn.freebsd.org/changeset/base/199528

Log:
  Adapt r197136 to IPv6 stack:
    Comment some flawed assumptions in in6p_join_group() about
    mixing SSM full-state and delta-based APIs.
  
  MFC after:	1 day

Modified:
  head/sys/netinet6/in6_mcast.c

Modified: head/sys/netinet6/in6_mcast.c
==============================================================================
--- head/sys/netinet6/in6_mcast.c	Thu Nov 19 13:33:23 2009	(r199527)
+++ head/sys/netinet6/in6_mcast.c	Thu Nov 19 13:39:07 2009	(r199528)
@@ -1814,6 +1814,7 @@ in6p_join_group(struct inpcb *inp, struc
 
 	ifp = NULL;
 	imf = NULL;
+	lims = NULL;
 	error = 0;
 	is_new = 0;
 
@@ -1934,9 +1935,25 @@ in6p_join_group(struct inpcb *inp, struc
 				error = EINVAL;
 				goto out_in6p_locked;
 			}
-			/* Throw out duplicates. */
+			/*
+			 * Throw out duplicates.
+			 *
+			 * XXX FIXME: This makes a naive assumption that
+			 * even if entries exist for *ssa in this imf,
+			 * they will be rejected as dupes, even if they
+			 * are not valid in the current mode (in-mode).
+			 *
+			 * in6_msource is transactioned just as for anything
+			 * else in SSM -- but note naive use of in6m_graft()
+			 * below for allocating new filter entries.
+			 *
+			 * This is only an issue if someone mixes the
+			 * full-state SSM API with the delta-based API,
+			 * which is discouraged in the relevant RFCs.
+			 */
 			lims = im6o_match_source(imo, idx, &ssa->sa);
-			if (lims != NULL) {
+			if (lims != NULL /*&&
+			    lims->im6sl_st[1] == MCAST_INCLUDE*/) {
 				error = EADDRNOTAVAIL;
 				goto out_in6p_locked;
 			}
@@ -1991,6 +2008,8 @@ in6p_join_group(struct inpcb *inp, struc
 	 *
 	 * Note: Grafting of exclusive mode filters doesn't happen
 	 * in this path.
+	 * XXX: Should check for non-NULL lims (node exists but may
+	 * not be in-mode) for interop with full-state API.
 	 */
 	if (ssa->ss.ss_family != AF_UNSPEC) {
 		/* Membership starts in IN mode */

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 14:33:04 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 461F51065707;
	Thu, 19 Nov 2009 14:33:04 +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 369B48FC0A;
	Thu, 19 Nov 2009 14:33:04 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAJEX33Y009273;
	Thu, 19 Nov 2009 14:33:03 GMT (envelope-from jh@svn.freebsd.org)
Received: (from jh@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAJEX3GH009271;
	Thu, 19 Nov 2009 14:33:03 GMT (envelope-from jh@svn.freebsd.org)
Message-Id: <200911191433.nAJEX3GH009271@svn.freebsd.org>
From: Jaakko Heinonen 
Date: Thu, 19 Nov 2009 14:33: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: r199529 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 14:33:04 -0000

Author: jh
Date: Thu Nov 19 14:33:03 2009
New Revision: 199529
URL: http://svn.freebsd.org/changeset/base/199529

Log:
  Extend ddb(4) "show mount" command to print active string mount options.
  Note that only option names are printed, not values.
  
  Reviewed by:	pjd
  Approved by:	trasz (mentor)
  MFC after:	2 weeks

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==============================================================================
--- head/sys/kern/vfs_subr.c	Thu Nov 19 13:39:07 2009	(r199528)
+++ head/sys/kern/vfs_subr.c	Thu Nov 19 14:33:03 2009	(r199529)
@@ -2761,6 +2761,7 @@ DB_SHOW_COMMAND(vnode, db_show_vnode)
 DB_SHOW_COMMAND(mount, db_show_mount)
 {
 	struct mount *mp;
+	struct vfsopt *opt;
 	struct statfs *sp;
 	struct vnode *vp;
 	char buf[512];
@@ -2866,6 +2867,18 @@ DB_SHOW_COMMAND(mount, db_show_mount)
 	}
 	db_printf("    mnt_kern_flag = %s\n", buf);
 
+	db_printf("    mnt_opt = ");
+	opt = TAILQ_FIRST(mp->mnt_opt);
+	if (opt != NULL) {
+		db_printf("%s", opt->name);
+		opt = TAILQ_NEXT(opt, link);
+		while (opt != NULL) {
+			db_printf(", %s", opt->name);
+			opt = TAILQ_NEXT(opt, link);
+		}
+	}
+	db_printf("\n");
+
 	sp = &mp->mnt_stat;
 	db_printf("    mnt_stat = { version=%u type=%u flags=0x%016jx "
 	    "bsize=%ju iosize=%ju blocks=%ju bfree=%ju bavail=%jd files=%ju "

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 15:45:24 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 798FF1065676;
	Thu, 19 Nov 2009 15:45:24 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 69FA68FC12;
	Thu, 19 Nov 2009 15:45:24 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAJFjOnl010827;
	Thu, 19 Nov 2009 15:45:24 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAJFjOBN010824;
	Thu, 19 Nov 2009 15:45:24 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <200911191545.nAJFjOBN010824@svn.freebsd.org>
From: Jung-uk Kim 
Date: Thu, 19 Nov 2009 15:45:24 +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: r199531 - in head/sys: amd64/amd64 i386/i386
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 15:45:24 -0000

Author: jkim
Date: Thu Nov 19 15:45:24 2009
New Revision: 199531
URL: http://svn.freebsd.org/changeset/base/199531

Log:
  Fix tinderbox build for i386 and sync amd64 with it.

Modified:
  head/sys/amd64/amd64/bpf_jit_machdep.c
  head/sys/i386/i386/bpf_jit_machdep.c

Modified: head/sys/amd64/amd64/bpf_jit_machdep.c
==============================================================================
--- head/sys/amd64/amd64/bpf_jit_machdep.c	Thu Nov 19 15:28:08 2009	(r199530)
+++ head/sys/amd64/amd64/bpf_jit_machdep.c	Thu Nov 19 15:45:24 2009	(r199531)
@@ -491,7 +491,7 @@ bpf_jit_compile(struct bpf_insn *prog, u
 
 #ifdef _KERNEL
 		stream.ibuf = (char *)contigmalloc(stream.cur_ip, M_BPFJIT,
-		    M_NOWAIT, 0, ~0ULL, 16, 0);
+		    M_NOWAIT, 0, ~0UL, 16, 0);
 		if (stream.ibuf == NULL)
 			break;
 #else

Modified: head/sys/i386/i386/bpf_jit_machdep.c
==============================================================================
--- head/sys/i386/i386/bpf_jit_machdep.c	Thu Nov 19 15:28:08 2009	(r199530)
+++ head/sys/i386/i386/bpf_jit_machdep.c	Thu Nov 19 15:45:24 2009	(r199531)
@@ -514,7 +514,7 @@ bpf_jit_compile(struct bpf_insn *prog, u
 
 #ifdef _KERNEL
 		stream.ibuf = (char *)contigmalloc(stream.cur_ip, M_BPFJIT,
-		    M_NOWAIT, 0, ~0ULL, 16, 0);
+		    M_NOWAIT, 0, ~0UL, 16, 0);
 		if (stream.ibuf == NULL)
 			break;
 #else

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 16:15:21 2009
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from [127.0.0.1] (freefall.freebsd.org [IPv6:2001:4f8:fff6::28])
	by hub.freebsd.org (Postfix) with ESMTP id 4D258106566B;
	Thu, 19 Nov 2009 16:15:20 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
From: Jung-uk Kim 
To: Robert Watson 
Date: Thu, 19 Nov 2009 11:15:01 -0500
User-Agent: KMail/1.6.2
References: <200911182340.nAINeJ3W087652@svn.freebsd.org>
	
In-Reply-To: 
MIME-Version: 1.0
Content-Disposition: inline
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Message-Id: <200911191115.11088.jkim@FreeBSD.org>
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r199498 - in head/sys: amd64/amd64 i386/i386 net
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 16:15:21 -0000

On Thursday 19 November 2009 03:26 am, Robert Watson wrote:
> On Wed, 18 Nov 2009, Jung-uk Kim wrote:
> >  - Change internal function bpf_jit_compile() to return allocated
> > size of the generated binary and remove page size limitation for
> > userland. - Use contigmalloc(9)/contigfree(9) instead of
> > malloc(9)/free(9) to make sure the generated binary aligns
> > properly and make it physically contiguous.
>
> Is physical contiguity actually required here -- I would have
> thought virtual contiguity and alignment would be sufficient, in
> which case the normal trick is to allocate using malloc the size +
> min-align + 1 and then fudge the pointer forward until it's
> properly aligned.

I don't believe it is strictly necessary but I assumed it might have 
performance benefit for very big BPF programs although I have not 
measured it.  Also, contigmalloc(9)/contigfree(9) is too obvious to 
ignore for this purpose. :-)

> Also, in 9.x I'm going to be looking at parallel execution within
> BPF descriptors, and I notice that the JIT compiles the register
> array pointer into the generated code, rather than allowing a
> pointer to be passed in to each instance.  I guess it's non-trivial
> to change that, suggesting that we have a pool of compiled
> instances, but it would be preferable to be able to do what the
> normal BPF code does: allocate a per-thread register block when
> needed.

It is non-trivial but certainly not impossible.

Jung-uk Kim

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 16:19:06 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 08AE31065679;
	Thu, 19 Nov 2009 16:19:06 +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 ECCAB8FC12;
	Thu, 19 Nov 2009 16:19:05 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAJGJ5a2011570;
	Thu, 19 Nov 2009 16:19:05 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAJGJ5N5011567;
	Thu, 19 Nov 2009 16:19:05 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200911191619.nAJGJ5N5011567@svn.freebsd.org>
From: Alexander Motin 
Date: Thu, 19 Nov 2009 16: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: r199532 - head/share/man/man4
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 16:19:06 -0000

Author: mav
Date: Thu Nov 19 16:19:05 2009
New Revision: 199532
URL: http://svn.freebsd.org/changeset/base/199532

Log:
  Add ada(4) man page.

Added:
  head/share/man/man4/ada.4   (contents, props changed)
Modified:
  head/share/man/man4/Makefile

Modified: head/share/man/man4/Makefile
==============================================================================
--- head/share/man/man4/Makefile	Thu Nov 19 15:45:24 2009	(r199531)
+++ head/share/man/man4/Makefile	Thu Nov 19 16:19:05 2009	(r199532)
@@ -15,6 +15,7 @@ MAN=	aac.4 \
 	${_acpi_toshiba.4} \
 	acpi_video.4 \
 	${_acpi_wmi.4} \
+	ada.4 \
 	adv.4 \
 	adw.4 \
 	ae.4 \

Added: head/share/man/man4/ada.4
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/share/man/man4/ada.4	Thu Nov 19 16:19:05 2009	(r199532)
@@ -0,0 +1,138 @@
+.\" Copyright (c) 2009 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 November 19, 2009
+.Dt ADA 4
+.Os
+.Sh NAME
+.Nm ada
+.Nd ATA Direct Access device driver
+.Sh SYNOPSIS
+.Cd device ada
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for direct access devices, implementing
+.Tn ATA
+command protocol, that are attached to the system through a host adapter
+supported by CAM subsystem.
+.Pp
+Host adapter must also be separately configured into the system before a
+.Tn ATA
+direct access device can be configured.
+.Sh COMMAND QUEUING
+Command queueing allows the device to process multiple transactions
+concurrently, often re-ordering them to reduce the number and length of
+seeks.
+.Tn ATA
+defines two types of queueing:
+.Tn TCQ (Tagged Command Queueing, PATA legacy)
+and
+.Tn NCQ (Native Command Queueing, SATA).
+The
+.Nm
+device driver takes full advantage of the NCQ, when supported.
+To ensure that transactions to distant portions of the media,
+which may be deferred indefinitely by servicing requests nearer the current
+head position, are completed in a timely fashion, an ordered
+transaction is sent every 7 seconds during continuous device operation.
+.Sh CACHE EFFECTS
+Many direct access devices are equipped with read and/or write caches.
+Parameters affecting the device's cache are reported in device IDENTIFY data
+and can be examined and modified via the
+.Xr camcontrol 8
+utility.
+.Pp
+The read cache is used to store data from device-initiated read ahead
+operations as well as frequently used data.
+The read cache is transparent
+to the user and can be enabled without any adverse effect.
+Most devices
+with a read cache come from the factory with it enabled.
+.Pp
+The write cache can greatly decrease the latency of write operations
+and allows the device to reorganize writes to increase efficiency and
+performance.
+This performance gain comes at a price.
+Should the device
+lose power while its cache contains uncommitted write operations, these
+writes will be lost.
+The effect of a loss of write transactions on
+a file system is non-deterministic and can cause corruption.
+Most
+devices age write transactions to limit vulnerability to a few transactions
+recently reported as complete, but it is none-the-less recommended that
+systems with write cache enabled devices reside on an Uninterruptible
+Power Supply (UPS).
+The
+.Nm
+device driver ensures that the cache and media are synchronized upon
+final close of the device or an unexpected shutdown (panic) event.
+This ensures that it is safe to disconnect power once the operating system
+has reported that it has halted.
+.Sh SYSCTL VARIABLES
+The following variables are available as both
+.Xr sysctl 8
+variables and
+.Xr loader 8
+tunables:
+.Bl -tag -width 12
+.It kern.cam.ada.retry_count
+.Pp
+This variable determines how many times the
+.Nm
+driver will retry a READ or WRITE command.
+This does not affect the number of retries used during probe time or for
+the
+.Nm
+driver dump routine.
+This value currently defaults to 4.
+.It kern.cam.ada.default_timeout
+.Pp
+This variable determines how long the
+.Nm
+driver will wait before timing out an outstanding command.
+The units for this value are seconds, and the default is currently 30
+seconds.
+.El
+.Sh FILES
+.Bl -tag -width ".Pa /dev/ada*" -compact
+.It Pa /dev/ada*
+ATA device nodes
+.El
+.Sh SEE ALSO
+.Xr ahci 4 ,
+.Xr siis 4 ,
+.Xr ad 4
+.Xr da 4
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Fx 8.0 .
+.Sh AUTHORS
+.An Alexander Motin Aq mav@FreeBSD.org .

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 16:21:27 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1816410656C0;
	Thu, 19 Nov 2009 16:21:27 +0000 (UTC) (envelope-from raj@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 08D1E8FC1C;
	Thu, 19 Nov 2009 16:21:27 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAJGLQS7011672;
	Thu, 19 Nov 2009 16:21:26 GMT (envelope-from raj@svn.freebsd.org)
Received: (from raj@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAJGLQNp011670;
	Thu, 19 Nov 2009 16:21:26 GMT (envelope-from raj@svn.freebsd.org)
Message-Id: <200911191621.nAJGLQNp011670@svn.freebsd.org>
From: Rafal Jaworowski 
Date: Thu, 19 Nov 2009 16:21: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: r199533 - head/sys/powerpc/powerpc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 16:21:27 -0000

Author: raj
Date: Thu Nov 19 16:21:26 2009
New Revision: 199533
URL: http://svn.freebsd.org/changeset/base/199533

Log:
  Fix cpuid output on E500 core.

Modified:
  head/sys/powerpc/powerpc/cpu.c

Modified: head/sys/powerpc/powerpc/cpu.c
==============================================================================
--- head/sys/powerpc/powerpc/cpu.c	Thu Nov 19 16:19:05 2009	(r199532)
+++ head/sys/powerpc/powerpc/cpu.c	Thu Nov 19 16:21:26 2009	(r199533)
@@ -429,6 +429,8 @@ cpu_e500_setup(int cpuid, uint16_t vers)
 {
 	register_t hid0;
 
+	printf("\n");
+
 	hid0 = mfspr(SPR_HID0);
 	printf("cpu%d: HID0 %b", cpuid, (int)hid0, HID0_E500_BITMASK);
 }

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 16:25:41 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 866EA106568B;
	Thu, 19 Nov 2009 16:25:41 +0000 (UTC) (envelope-from raj@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7772D8FC1C;
	Thu, 19 Nov 2009 16:25:41 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAJGPf7p011866;
	Thu, 19 Nov 2009 16:25:41 GMT (envelope-from raj@svn.freebsd.org)
Received: (from raj@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAJGPfx7011864;
	Thu, 19 Nov 2009 16:25:41 GMT (envelope-from raj@svn.freebsd.org)
Message-Id: <200911191625.nAJGPfx7011864@svn.freebsd.org>
From: Rafal Jaworowski 
Date: Thu, 19 Nov 2009 16:25: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: r199534 - head/sys/boot/uboot/common
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 16:25:41 -0000

Author: raj
Date: Thu Nov 19 16:25:41 2009
New Revision: 199534
URL: http://svn.freebsd.org/changeset/base/199534

Log:
  Provide an effective (relocated) address when building modules metadata.
  
  This lets modules loaded dynamically in loader(8) work for U-Boot-based
  platforms.
  
  MFC after:	1 week

Modified:
  head/sys/boot/uboot/common/metadata.c

Modified: head/sys/boot/uboot/common/metadata.c
==============================================================================
--- head/sys/boot/uboot/common/metadata.c	Thu Nov 19 16:21:26 2009	(r199533)
+++ head/sys/boot/uboot/common/metadata.c	Thu Nov 19 16:25:41 2009	(r199534)
@@ -231,6 +231,7 @@ md_copymodules(vm_offset_t addr)
 	struct preloaded_file	*fp;
 	struct file_metadata	*md;
 	int			c;
+	vm_offset_t a;
 
 	c = addr != 0;
 	/* start with the first module on the list, should be the kernel */
@@ -240,7 +241,8 @@ md_copymodules(vm_offset_t addr)
 		MOD_TYPE(addr, fp->f_type, c);
 		if (fp->f_args)
 			MOD_ARGS(addr, fp->f_args, c);
-		MOD_ADDR(addr, fp->f_addr, c);
+		a = fp->f_addr - __elfN(relocation_offset);
+		MOD_ADDR(addr, a, c);
 		MOD_SIZE(addr, fp->f_size, c);
 		for (md = fp->f_metadata; md != NULL; md = md->md_next) {
 			if (!(md->md_type & MODINFOMD_NOCOPY))

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 16:26:07 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C72B9106566B;
	Thu, 19 Nov 2009 16:26: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 B849A8FC24;
	Thu, 19 Nov 2009 16:26:07 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAJGQ7j2011916;
	Thu, 19 Nov 2009 16:26:07 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAJGQ70v011914;
	Thu, 19 Nov 2009 16:26:07 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200911191626.nAJGQ70v011914@svn.freebsd.org>
From: Alexander Motin 
Date: Thu, 19 Nov 2009 16:26: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: r199535 - head/sys/conf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 16:26:07 -0000

Author: mav
Date: Thu Nov 19 16:26:07 2009
New Revision: 199535
URL: http://svn.freebsd.org/changeset/base/199535

Log:
  Tune CAM ATA kernel options a bit. Move PMP support from da to scbus and
  add ada device option, according to man page.

Modified:
  head/sys/conf/files

Modified: head/sys/conf/files
==============================================================================
--- head/sys/conf/files	Thu Nov 19 16:25:41 2009	(r199534)
+++ head/sys/conf/files	Thu Nov 19 16:26:07 2009	(r199535)
@@ -112,12 +112,12 @@ cam/cam_sim.c			optional scbus
 cam/cam_xpt.c			optional scbus
 cam/ata/ata_all.c		optional scbus
 cam/ata/ata_xpt.c		optional scbus
+cam/ata/ata_pmp.c		optional scbus
 cam/scsi/scsi_xpt.c		optional scbus
 cam/scsi/scsi_all.c		optional scbus
 cam/scsi/scsi_cd.c		optional cd
 cam/scsi/scsi_ch.c		optional ch
-cam/ata/ata_da.c		optional da
-cam/ata/ata_pmp.c		optional da
+cam/ata/ata_da.c		optional ada | da
 cam/scsi/scsi_da.c		optional da
 cam/scsi/scsi_low.c		optional ct | ncv | nsp | stg
 cam/scsi/scsi_low_pisa.c	optional ct | ncv | nsp | stg

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 16:27:52 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 54E1210656A7;
	Thu, 19 Nov 2009 16:27:52 +0000 (UTC) (envelope-from mr@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 432888FC14;
	Thu, 19 Nov 2009 16:27:52 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAJGRq4d011997;
	Thu, 19 Nov 2009 16:27:52 GMT (envelope-from mr@svn.freebsd.org)
Received: (from mr@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAJGRqae011985;
	Thu, 19 Nov 2009 16:27:52 GMT (envelope-from mr@svn.freebsd.org)
Message-Id: <200911191627.nAJGRqae011985@svn.freebsd.org>
From: Michael Reifenberger 
Date: Thu, 19 Nov 2009 16:27: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: r199536 - in head/tools/tools/nanobsd/pcengines: .
	Files Files/etc Files/root Files/usr Files/usr/ports Pkg
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 16:27:52 -0000

Author: mr
Date: Thu Nov 19 16:27:51 2009
New Revision: 199536
URL: http://svn.freebsd.org/changeset/base/199536

Log:
  Add nanobsd example for the PC Engines ALIX board (serial console).

Added:
  head/tools/tools/nanobsd/pcengines/
  head/tools/tools/nanobsd/pcengines/ALIX_DSK   (contents, props changed)
  head/tools/tools/nanobsd/pcengines/ALIX_NFS   (contents, props changed)
  head/tools/tools/nanobsd/pcengines/Files/
  head/tools/tools/nanobsd/pcengines/Files/etc/
  head/tools/tools/nanobsd/pcengines/Files/etc/rc.conf   (contents, props changed)
  head/tools/tools/nanobsd/pcengines/Files/etc/ttys   (contents, props changed)
  head/tools/tools/nanobsd/pcengines/Files/root/
  head/tools/tools/nanobsd/pcengines/Files/root/.cshrc   (contents, props changed)
  head/tools/tools/nanobsd/pcengines/Files/root/.k5login   (contents, props changed)
  head/tools/tools/nanobsd/pcengines/Files/root/.login   (contents, props changed)
  head/tools/tools/nanobsd/pcengines/Files/root/change_password   (contents, props changed)
  head/tools/tools/nanobsd/pcengines/Files/root/save_cfg   (contents, props changed)
  head/tools/tools/nanobsd/pcengines/Files/root/save_sshkeys   (contents, props changed)
  head/tools/tools/nanobsd/pcengines/Files/root/updatep1   (contents, props changed)
  head/tools/tools/nanobsd/pcengines/Files/root/updatep2   (contents, props changed)
  head/tools/tools/nanobsd/pcengines/Files/usr/
  head/tools/tools/nanobsd/pcengines/Files/usr/ports/
  head/tools/tools/nanobsd/pcengines/Files/usr/ports/.keepme   (contents, props changed)
  head/tools/tools/nanobsd/pcengines/Pkg/
  head/tools/tools/nanobsd/pcengines/alix_dsk.conf   (contents, props changed)
  head/tools/tools/nanobsd/pcengines/alix_nfs.conf   (contents, props changed)
  head/tools/tools/nanobsd/pcengines/build.sh   (contents, props changed)
  head/tools/tools/nanobsd/pcengines/common.conf   (contents, props changed)
  head/tools/tools/nanobsd/pcengines/test.sh   (contents, props changed)

Added: head/tools/tools/nanobsd/pcengines/ALIX_DSK
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/tools/nanobsd/pcengines/ALIX_DSK	Thu Nov 19 16:27:51 2009	(r199536)
@@ -0,0 +1,113 @@
+#
+# $FreeBSD$
+#
+
+cpu		I586_CPU
+ident		ALIX_DSK
+makeoptions	DEBUG=-g		
+options		CPU_GEODE
+options 	SCHED_ULE		
+options 	PREEMPTION		
+options 	INET			
+options 	INET6			
+options 	FFS			
+options 	SOFTUPDATES		
+options 	UFS_ACL			
+options 	UFS_DIRHASH		
+options 	NFSCLIENT		
+options 	NFSLOCKD		
+options 	MSDOSFS			
+options 	CD9660			
+options 	PROCFS			
+options 	PSEUDOFS		
+options 	GEOM_PART_GPT		
+options 	GEOM_LABEL		
+options 	COMPAT_43TTY		
+options 	COMPAT_FREEBSD7		
+options 	SCSI_DELAY=5000		
+options 	SYSVSHM			
+options 	SYSVMSG			
+options 	SYSVSEM			
+options 	P1003_1B_SEMAPHORES	
+options 	_KPOSIX_PRIORITY_SCHEDULING 
+options 	PRINTF_BUFR_SIZE=128	
+device		apic			
+device		pci
+device		fdc
+device		ata
+device		atadisk		
+device		atapicd		
+device		atapist		
+options 	ATA_STATIC_ID	
+device		scbus		
+device		da		
+device		sa		
+device		cd		
+device		pass		
+device		uart		
+device		em		
+device		miibus		
+device		vr		
+device		wlan		
+options 	IEEE80211_DEBUG	
+options 	IEEE80211_AMPDU_AGE 
+options 	IEEE80211_SUPPORT_MESH	
+device		wlan_wep	
+device		wlan_ccmp	
+device		wlan_tkip	
+device		wlan_amrr	
+device		an		
+device		ath		
+device		ath_hal		
+options 	AH_SUPPORT_AR5416	
+device		ath_rate_sample	
+device		wi		
+device		loop		
+device		random		
+device		ether		
+device		tun		
+device		pty		
+device		md		
+device		gif		
+device		faith		
+device		firmware	
+device		bpf		
+device		uhci		
+device		ohci		
+device		ehci		
+device		usb		
+device		ulpt		
+device		umass		
+device		u3g		
+device		ubsa		
+device		uftdi		
+
+options         INCLUDE_CONFIG_FILE
+
+options         ALTQ
+options         ALTQ_CBQ
+options         ALTQ_RED
+options         ALTQ_RIO
+options         ALTQ_HFSC
+options         ALTQ_CDNR
+options         ALTQ_PRIQ
+
+device          pf
+device          pflog
+device          pfsync                                                          
+device          carp                                                            
+device          if_bridge
+
+options         DEVICE_POLLING
+
+options         NETGRAPH                                                        
+options         NETGRAPH_BPF                                                    
+options         NETGRAPH_ETHER                                                  
+options         NETGRAPH_IFACE                                                  
+options         NETGRAPH_PPP                                                    
+options         NETGRAPH_PPPOE                                                  
+options         NETGRAPH_PPTPGRE                                                
+options         NETGRAPH_MPPC_ENCRYPTION                                        
+options         NETGRAPH_SOCKET                                                 
+options         NETGRAPH_KSOCKET                                                
+options         NETGRAPH_VJC

Added: head/tools/tools/nanobsd/pcengines/ALIX_NFS
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/tools/nanobsd/pcengines/ALIX_NFS	Thu Nov 19 16:27:51 2009	(r199536)
@@ -0,0 +1,121 @@
+#
+# $FreeBSD$
+#
+
+cpu		I586_CPU
+ident		ALIX_DSK
+makeoptions	DEBUG=-g		
+options		CPU_GEODE
+options 	SCHED_ULE		
+options 	PREEMPTION		
+options 	INET			
+options 	INET6			
+options 	FFS			
+options 	SOFTUPDATES		
+options 	UFS_ACL			
+options 	UFS_DIRHASH		
+options 	NFSCLIENT		
+options 	NFSLOCKD		
+options 	MSDOSFS			
+options 	CD9660			
+options 	PROCFS			
+options 	PSEUDOFS		
+options 	GEOM_PART_GPT		
+options 	GEOM_LABEL		
+options 	COMPAT_43TTY		
+options 	COMPAT_FREEBSD7		
+options 	SCSI_DELAY=5000		
+options 	SYSVSHM			
+options 	SYSVMSG			
+options 	SYSVSEM			
+options 	P1003_1B_SEMAPHORES	
+options 	_KPOSIX_PRIORITY_SCHEDULING 
+options 	PRINTF_BUFR_SIZE=128	
+device		apic			
+device		pci
+device		fdc
+device		ata
+device		atadisk		
+device		atapicd		
+device		atapist		
+options 	ATA_STATIC_ID	
+device		scbus		
+device		da		
+device		sa		
+device		cd		
+device		pass		
+device		uart		
+device		em		
+device		miibus		
+device		vr		
+device		wlan		
+options 	IEEE80211_DEBUG	
+options 	IEEE80211_AMPDU_AGE 
+options 	IEEE80211_SUPPORT_MESH	
+device		wlan_wep	
+device		wlan_ccmp	
+device		wlan_tkip	
+device		wlan_amrr	
+device		an		
+device		ath		
+device		ath_hal		
+options 	AH_SUPPORT_AR5416	
+device		ath_rate_sample	
+device		wi		
+device		loop		
+device		random		
+device		ether		
+device		tun		
+device		pty		
+device		md		
+device		gif		
+device		faith		
+device		firmware	
+device		bpf		
+device		uhci		
+device		ohci		
+device		ehci		
+device		usb		
+device		ulpt		
+device		umass		
+device		u3g		
+device		ubsa		
+device		uftdi		
+
+options         INCLUDE_CONFIG_FILE
+
+options         ALTQ
+options         ALTQ_CBQ
+options         ALTQ_RED
+options         ALTQ_RIO
+options         ALTQ_HFSC
+options         ALTQ_CDNR
+options         ALTQ_PRIQ
+
+device          pf
+device          pflog
+device          pfsync                                                          
+device          carp                                                            
+device          if_bridge
+
+options         DEVICE_POLLING
+
+options         NETGRAPH                                                        
+options         NETGRAPH_BPF                                                    
+options         NETGRAPH_ETHER                                                  
+options         NETGRAPH_IFACE                                                  
+options         NETGRAPH_PPP                                                    
+options         NETGRAPH_PPPOE                                                  
+options         NETGRAPH_PPTPGRE                                                
+options         NETGRAPH_MPPC_ENCRYPTION                                        
+options         NETGRAPH_SOCKET                                                 
+options         NETGRAPH_KSOCKET                                                
+options         NETGRAPH_VJC
+
+options		NFS_ROOT
+options         BOOTP
+options         BOOTP_NFSROOT
+options         BOOTP_NFSV3
+#options                BOOTP_WIRED_TO=fxp0
+#options                BOOTP_WIRED_TO=ath0
+options         BOOTP_COMPAT

Added: head/tools/tools/nanobsd/pcengines/Files/etc/rc.conf
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/tools/nanobsd/pcengines/Files/etc/rc.conf	Thu Nov 19 16:27:51 2009	(r199536)
@@ -0,0 +1,13 @@
+#
+# $FreeBSD$
+#
+
+hostname="alix"
+ifconfig_vr0="DHCP"
+ifconfig_em0="DHCP"
+
+sshd_enable="YES"
+#ntpdate_enable="YES"
+#ntpdate_hosts="1.0.0.0"
+#ntpd_enable="YES"
+#ntpd_sync_on_start="YES"

Added: head/tools/tools/nanobsd/pcengines/Files/etc/ttys
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/tools/nanobsd/pcengines/Files/etc/ttys	Thu Nov 19 16:27:51 2009	(r199536)
@@ -0,0 +1,565 @@
+#
+# $FreeBSD$
+#	@(#)ttys	5.1 (Berkeley) 4/17/89
+#
+# This file specifies various information about terminals on the system.
+# It is used by several different programs.  Common entries for the
+# various columns include:
+#
+# name  The name of the terminal device.
+#
+# getty The program to start running on the terminal.  Typically a
+#       getty program, as the name implies.  Other common entries
+#       include none, when no getty is needed, and xdm, to start the
+#       X Window System.
+#
+# type The initial terminal type for this port.  For hardwired
+#      terminal lines, this will contain the type of terminal used.
+#      For virtual consoles, the correct type is typically xterm, but
+#      vt220 will work better if you need interoperability with other
+#      systems like Solaris or GNU/Linux.
+#      Other common values include network for network connections on
+#      pseudo-terminals, dialup for incoming modem ports, and unknown
+#      when the terminal type cannot be predetermined.
+#
+# status Must be on or off.  If on, init will run the getty program on
+#        the specified port.  If the word "secure" appears, this tty
+#        allows root login.
+#
+# name	getty				type	status		comments
+#
+# If console is marked "insecure", then init will ask for the root password
+# when going to single-user mode.
+console	none				unknown	off secure
+#
+ttyv0	"/usr/libexec/getty Pc"		xterm	off  secure
+# Virtual terminals
+ttyv1	"/usr/libexec/getty Pc"		xterm	off  secure
+ttyv2	"/usr/libexec/getty Pc"		xterm	off  secure
+ttyv3	"/usr/libexec/getty Pc"		xterm	off  secure
+ttyv4	"/usr/libexec/getty Pc"		xterm	off  secure
+ttyv5	"/usr/libexec/getty Pc"		xterm	off  secure
+ttyv6	"/usr/libexec/getty Pc"		xterm	off  secure
+ttyv7	"/usr/libexec/getty Pc"		xterm	off  secure
+ttyv8	"/usr/local/bin/xdm -nodaemon"	xterm	off secure
+# Serial terminals
+# The 'dialup' keyword identifies dialin lines to login, fingerd etc.
+ttyu0	"/usr/libexec/getty std.9600"	xterm	on secure
+ttyd1	"/usr/libexec/getty std.9600"	dialup	off secure
+ttyd2	"/usr/libexec/getty std.9600"	dialup	off secure
+ttyd3	"/usr/libexec/getty std.9600"	dialup	off secure
+# Dumb console
+dcons	"/usr/libexec/getty std.9600"	vt100	off secure
+# Pseudo terminals
+ttyp0	none			network
+ttyp1	none			network
+ttyp2	none			network
+ttyp3	none			network
+ttyp4	none			network
+ttyp5	none			network
+ttyp6	none			network
+ttyp7	none			network
+ttyp8	none			network
+ttyp9	none			network
+ttypa	none			network
+ttypb	none			network
+ttypc	none			network
+ttypd	none			network
+ttype	none			network
+ttypf	none			network
+ttypg	none			network
+ttyph	none			network
+ttypi	none			network
+ttypj	none			network
+ttypk	none			network
+ttypl	none			network
+ttypm	none			network
+ttypn	none			network
+ttypo	none			network
+ttypp	none			network
+ttypq	none			network
+ttypr	none			network
+ttyps	none			network
+ttypt	none			network
+ttypu	none			network
+ttypv	none			network
+ttyq0	none			network
+ttyq1	none			network
+ttyq2	none			network
+ttyq3	none			network
+ttyq4	none			network
+ttyq5	none			network
+ttyq6	none			network
+ttyq7	none			network
+ttyq8	none			network
+ttyq9	none			network
+ttyqa	none			network
+ttyqb	none			network
+ttyqc	none			network
+ttyqd	none			network
+ttyqe	none			network
+ttyqf	none			network
+ttyqg	none			network
+ttyqh	none			network
+ttyqi	none			network
+ttyqj	none			network
+ttyqk	none			network
+ttyql	none			network
+ttyqm	none			network
+ttyqn	none			network
+ttyqo	none			network
+ttyqp	none			network
+ttyqq	none			network
+ttyqr	none			network
+ttyqs	none			network
+ttyqt	none			network
+ttyqu	none			network
+ttyqv	none			network
+ttyr0	none			network
+ttyr1	none			network
+ttyr2	none			network
+ttyr3	none			network
+ttyr4	none			network
+ttyr5	none			network
+ttyr6	none			network
+ttyr7	none			network
+ttyr8	none			network
+ttyr9	none			network
+ttyra	none			network
+ttyrb	none			network
+ttyrc	none			network
+ttyrd	none			network
+ttyre	none			network
+ttyrf	none			network
+ttyrg	none			network
+ttyrh	none			network
+ttyri	none			network
+ttyrj	none			network
+ttyrk	none			network
+ttyrl	none			network
+ttyrm	none			network
+ttyrn	none			network
+ttyro	none			network
+ttyrp	none			network
+ttyrq	none			network
+ttyrr	none			network
+ttyrs	none			network
+ttyrt	none			network
+ttyru	none			network
+ttyrv	none			network
+ttys0	none			network
+ttys1	none			network
+ttys2	none			network
+ttys3	none			network
+ttys4	none			network
+ttys5	none			network
+ttys6	none			network
+ttys7	none			network
+ttys8	none			network
+ttys9	none			network
+ttysa	none			network
+ttysb	none			network
+ttysc	none			network
+ttysd	none			network
+ttyse	none			network
+ttysf	none			network
+ttysg	none			network
+ttysh	none			network
+ttysi	none			network
+ttysj	none			network
+ttysk	none			network
+ttysl	none			network
+ttysm	none			network
+ttysn	none			network
+ttyso	none			network
+ttysp	none			network
+ttysq	none			network
+ttysr	none			network
+ttyss	none			network
+ttyst	none			network
+ttysu	none			network
+ttysv	none			network
+ttyP0	none			network
+ttyP1	none			network
+ttyP2	none			network
+ttyP3	none			network
+ttyP4	none			network
+ttyP5	none			network
+ttyP6	none			network
+ttyP7	none			network
+ttyP8	none			network
+ttyP9	none			network
+ttyPa	none			network
+ttyPb	none			network
+ttyPc	none			network
+ttyPd	none			network
+ttyPe	none			network
+ttyPf	none			network
+ttyPg	none			network
+ttyPh	none			network
+ttyPi	none			network
+ttyPj	none			network
+ttyPk	none			network
+ttyPl	none			network
+ttyPm	none			network
+ttyPn	none			network
+ttyPo	none			network
+ttyPp	none			network
+ttyPq	none			network
+ttyPr	none			network
+ttyPs	none			network
+ttyPt	none			network
+ttyPu	none			network
+ttyPv	none			network
+ttyQ0	none			network
+ttyQ1	none			network
+ttyQ2	none			network
+ttyQ3	none			network
+ttyQ4	none			network
+ttyQ5	none			network
+ttyQ6	none			network
+ttyQ7	none			network
+ttyQ8	none			network
+ttyQ9	none			network
+ttyQa	none			network
+ttyQb	none			network
+ttyQc	none			network
+ttyQd	none			network
+ttyQe	none			network
+ttyQf	none			network
+ttyQg	none			network
+ttyQh	none			network
+ttyQi	none			network
+ttyQj	none			network
+ttyQk	none			network
+ttyQl	none			network
+ttyQm	none			network
+ttyQn	none			network
+ttyQo	none			network
+ttyQp	none			network
+ttyQq	none			network
+ttyQr	none			network
+ttyQs	none			network
+ttyQt	none			network
+ttyQu	none			network
+ttyQv	none			network
+ttyR0	none			network
+ttyR1	none			network
+ttyR2	none			network
+ttyR3	none			network
+ttyR4	none			network
+ttyR5	none			network
+ttyR6	none			network
+ttyR7	none			network
+ttyR8	none			network
+ttyR9	none			network
+ttyRa	none			network
+ttyRb	none			network
+ttyRc	none			network
+ttyRd	none			network
+ttyRe	none			network
+ttyRf	none			network
+ttyRg	none			network
+ttyRh	none			network
+ttyRi	none			network
+ttyRj	none			network
+ttyRk	none			network
+ttyRl	none			network
+ttyRm	none			network
+ttyRn	none			network
+ttyRo	none			network
+ttyRp	none			network
+ttyRq	none			network
+ttyRr	none			network
+ttyRs	none			network
+ttyRt	none			network
+ttyRu	none			network
+ttyRv	none			network
+ttyS0	none			network
+ttyS1	none			network
+ttyS2	none			network
+ttyS3	none			network
+ttyS4	none			network
+ttyS5	none			network
+ttyS6	none			network
+ttyS7	none			network
+ttyS8	none			network
+ttyS9	none			network
+ttySa	none			network
+ttySb	none			network
+ttySc	none			network
+ttySd	none			network
+ttySe	none			network
+ttySf	none			network
+ttySg	none			network
+ttySh	none			network
+ttySi	none			network
+ttySj	none			network
+ttySk	none			network
+ttySl	none			network
+ttySm	none			network
+ttySn	none			network
+ttySo	none			network
+ttySp	none			network
+ttySq	none			network
+ttySr	none			network
+ttySs	none			network
+ttySt	none			network
+ttySu	none			network
+ttySv	none			network
+ttyl0	none			network
+ttyl1	none			network
+ttyl2	none			network
+ttyl3	none			network
+ttyl4	none			network
+ttyl5	none			network
+ttyl6	none			network
+ttyl7	none			network
+ttyl8	none			network
+ttyl9	none			network
+ttyla	none			network
+ttylb	none			network
+ttylc	none			network
+ttyld	none			network
+ttyle	none			network
+ttylf	none			network
+ttylg	none			network
+ttylh	none			network
+ttyli	none			network
+ttylj	none			network
+ttylk	none			network
+ttyll	none			network
+ttylm	none			network
+ttyln	none			network
+ttylo	none			network
+ttylp	none			network
+ttylq	none			network
+ttylr	none			network
+ttyls	none			network
+ttylt	none			network
+ttylu	none			network
+ttylv	none			network
+ttym0	none			network
+ttym1	none			network
+ttym2	none			network
+ttym3	none			network
+ttym4	none			network
+ttym5	none			network
+ttym6	none			network
+ttym7	none			network
+ttym8	none			network
+ttym9	none			network
+ttyma	none			network
+ttymb	none			network
+ttymc	none			network
+ttymd	none			network
+ttyme	none			network
+ttymf	none			network
+ttymg	none			network
+ttymh	none			network
+ttymi	none			network
+ttymj	none			network
+ttymk	none			network
+ttyml	none			network
+ttymm	none			network
+ttymn	none			network
+ttymo	none			network
+ttymp	none			network
+ttymq	none			network
+ttymr	none			network
+ttyms	none			network
+ttymt	none			network
+ttymu	none			network
+ttymv	none			network
+ttyn0	none			network
+ttyn1	none			network
+ttyn2	none			network
+ttyn3	none			network
+ttyn4	none			network
+ttyn5	none			network
+ttyn6	none			network
+ttyn7	none			network
+ttyn8	none			network
+ttyn9	none			network
+ttyna	none			network
+ttynb	none			network
+ttync	none			network
+ttynd	none			network
+ttyne	none			network
+ttynf	none			network
+ttyng	none			network
+ttynh	none			network
+ttyni	none			network
+ttynj	none			network
+ttynk	none			network
+ttynl	none			network
+ttynm	none			network
+ttynn	none			network
+ttyno	none			network
+ttynp	none			network
+ttynq	none			network
+ttynr	none			network
+ttyns	none			network
+ttynt	none			network
+ttynu	none			network
+ttynv	none			network
+ttyo0	none			network
+ttyo1	none			network
+ttyo2	none			network
+ttyo3	none			network
+ttyo4	none			network
+ttyo5	none			network
+ttyo6	none			network
+ttyo7	none			network
+ttyo8	none			network
+ttyo9	none			network
+ttyoa	none			network
+ttyob	none			network
+ttyoc	none			network
+ttyod	none			network
+ttyoe	none			network
+ttyof	none			network
+ttyog	none			network
+ttyoh	none			network
+ttyoi	none			network
+ttyoj	none			network
+ttyok	none			network
+ttyol	none			network
+ttyom	none			network
+ttyon	none			network
+ttyoo	none			network
+ttyop	none			network
+ttyoq	none			network
+ttyor	none			network
+ttyos	none			network
+ttyot	none			network
+ttyou	none			network
+ttyov	none			network
+ttyL0	none			network
+ttyL1	none			network
+ttyL2	none			network
+ttyL3	none			network
+ttyL4	none			network
+ttyL5	none			network
+ttyL6	none			network
+ttyL7	none			network
+ttyL8	none			network
+ttyL9	none			network
+ttyLa	none			network
+ttyLb	none			network
+ttyLc	none			network
+ttyLd	none			network
+ttyLe	none			network
+ttyLf	none			network
+ttyLg	none			network
+ttyLh	none			network
+ttyLi	none			network
+ttyLj	none			network
+ttyLk	none			network
+ttyLl	none			network
+ttyLm	none			network
+ttyLn	none			network
+ttyLo	none			network
+ttyLp	none			network
+ttyLq	none			network
+ttyLr	none			network
+ttyLs	none			network
+ttyLt	none			network
+ttyLu	none			network
+ttyLv	none			network
+ttyM0	none			network
+ttyM1	none			network
+ttyM2	none			network
+ttyM3	none			network
+ttyM4	none			network
+ttyM5	none			network
+ttyM6	none			network
+ttyM7	none			network
+ttyM8	none			network
+ttyM9	none			network
+ttyMa	none			network
+ttyMb	none			network
+ttyMc	none			network
+ttyMd	none			network
+ttyMe	none			network
+ttyMf	none			network
+ttyMg	none			network
+ttyMh	none			network
+ttyMi	none			network
+ttyMj	none			network
+ttyMk	none			network
+ttyMl	none			network
+ttyMm	none			network
+ttyMn	none			network
+ttyMo	none			network
+ttyMp	none			network
+ttyMq	none			network
+ttyMr	none			network
+ttyMs	none			network
+ttyMt	none			network
+ttyMu	none			network
+ttyMv	none			network
+ttyN0	none			network
+ttyN1	none			network
+ttyN2	none			network
+ttyN3	none			network
+ttyN4	none			network
+ttyN5	none			network
+ttyN6	none			network
+ttyN7	none			network
+ttyN8	none			network
+ttyN9	none			network
+ttyNa	none			network
+ttyNb	none			network
+ttyNc	none			network
+ttyNd	none			network
+ttyNe	none			network
+ttyNf	none			network
+ttyNg	none			network
+ttyNh	none			network
+ttyNi	none			network
+ttyNj	none			network
+ttyNk	none			network
+ttyNl	none			network
+ttyNm	none			network
+ttyNn	none			network
+ttyNo	none			network
+ttyNp	none			network
+ttyNq	none			network
+ttyNr	none			network
+ttyNs	none			network
+ttyNt	none			network
+ttyNu	none			network
+ttyNv	none			network
+ttyO0	none			network
+ttyO1	none			network
+ttyO2	none			network
+ttyO3	none			network
+ttyO4	none			network
+ttyO5	none			network
+ttyO6	none			network
+ttyO7	none			network
+ttyO8	none			network
+ttyO9	none			network
+ttyOa	none			network
+ttyOb	none			network
+ttyOc	none			network
+ttyOd	none			network
+ttyOe	none			network
+ttyOf	none			network
+ttyOg	none			network
+ttyOh	none			network
+ttyOi	none			network
+ttyOj	none			network
+ttyOk	none			network
+ttyOl	none			network
+ttyOm	none			network
+ttyOn	none			network
+ttyOo	none			network
+ttyOp	none			network
+ttyOq	none			network
+ttyOr	none			network
+ttyOs	none			network
+ttyOt	none			network
+ttyOu	none			network
+ttyOv	none			network

Added: head/tools/tools/nanobsd/pcengines/Files/root/.cshrc
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/tools/nanobsd/pcengines/Files/root/.cshrc	Thu Nov 19 16:27:51 2009	(r199536)
@@ -0,0 +1,35 @@
+# $FreeBSD$
+#
+# .cshrc - csh resource script, read at beginning of execution by each shell
+#
+# see also csh(1), environ(7).
+#
+
+alias h		history 25
+alias j		jobs -l
+alias la	ls -a
+alias lf	ls -FA
+alias ll	ls -lA
+
+# A righteous umask
+umask 22
+
+set path = (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin /usr/X11R6/bin $HOME/bin)
+
+setenv	EDITOR	vi
+setenv	PAGER	more
+setenv	BLOCKSIZE	K
+
+if ($?prompt) then
+	# An interactive shell -- set some stuff up
+	set prompt = "`/bin/hostname -s`# "
+	set filec
+	set history = 100
+	set savehist = 100
+	set mail = (/var/mail/$USER)
+	if ( $?tcsh ) then
+		bindkey "^W" backward-delete-word
+		bindkey -k up history-search-backward
+		bindkey -k down history-search-forward
+	endif
+endif

Added: head/tools/tools/nanobsd/pcengines/Files/root/.k5login
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/tools/nanobsd/pcengines/Files/root/.k5login	Thu Nov 19 16:27:51 2009	(r199536)
@@ -0,0 +1,4 @@
+# $FreeBSD$
+#
+# user1/root@YOUR.REALM.WHEREVER
+# user2/root@YOUR.REALM.WHEREVER

Added: head/tools/tools/nanobsd/pcengines/Files/root/.login
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/tools/nanobsd/pcengines/Files/root/.login	Thu Nov 19 16:27:51 2009	(r199536)
@@ -0,0 +1,9 @@
+# $FreeBSD$
+#
+# .login - csh login script, read by login shell, after `.cshrc' at login.
+#
+# see also csh(1), environ(7).
+#
+
+# Uncomment to display a random cookie each login:
+# [ -x /usr/games/fortune ] && /usr/games/fortune -s

Added: head/tools/tools/nanobsd/pcengines/Files/root/change_password
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/tools/nanobsd/pcengines/Files/root/change_password	Thu Nov 19 16:27:51 2009	(r199536)
@@ -0,0 +1,40 @@
+#!/bin/sh
+#
+# Copyright (c) 2004-2005 Poul-Henning Kamp.
+# 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$
+#
+
+set -e
+
+passwd root
+
+cfgslice=`grep '/cfg' /etc/fstab | cut -d \  -f 1`
+
+trap "umount /cfg" 1 2 15 EXIT
+mount /cfg
+cp /etc/master.passwd /etc/passwd /etc/pwd.db /etc/spwd.db /etc/group /cfg
+umount /cfg
+trap 1 2 15 EXIT

Added: head/tools/tools/nanobsd/pcengines/Files/root/save_cfg
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/tools/nanobsd/pcengines/Files/root/save_cfg	Thu Nov 19 16:27:51 2009	(r199536)
@@ -0,0 +1,42 @@
+#!/bin/sh
+#
+# Copyright (c) 2006 Mathieu Arnold
+# 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$
+#
+
+set -e
+
+trap "umount /cfg" 1 2 15 EXIT
+mount /cfg
+(
+cd /cfg
+for i in "$@" `find * -type f`
+do
+        cmp -s /etc/$i /cfg/$i || cp -pfv /etc/$i /cfg/$i
+done
+)
+umount /cfg
+trap 1 2 15 EXIT

Added: head/tools/tools/nanobsd/pcengines/Files/root/save_sshkeys
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/tools/nanobsd/pcengines/Files/root/save_sshkeys	Thu Nov 19 16:27:51 2009	(r199536)
@@ -0,0 +1,40 @@
+#!/bin/sh
+#
+# Copyright (c) 2004-2005 Poul-Henning Kamp.
+# 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$
+#

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 18:11:24 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 43B2E106568F;
	Thu, 19 Nov 2009 18:11: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 1899D8FC1C;
	Thu, 19 Nov 2009 18:11:24 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAJIBNI1014363;
	Thu, 19 Nov 2009 18:11:23 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAJIBNU4014359;
	Thu, 19 Nov 2009 18:11:23 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200911191811.nAJIBNU4014359@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 19 Nov 2009 18:11: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: r199537 - in head/sys: arm/at91 dev/nxge dev/wl
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 18:11:24 -0000

Author: jhb
Date: Thu Nov 19 18:11:23 2009
New Revision: 199537
URL: http://svn.freebsd.org/changeset/base/199537

Log:
  These drivers only set if_timer but never set if_watchdog.  Just remove
  the assignments to if_timer.

Modified:
  head/sys/arm/at91/if_ate.c
  head/sys/dev/nxge/if_nxge.c
  head/sys/dev/wl/if_wl.c

Modified: head/sys/arm/at91/if_ate.c
==============================================================================
--- head/sys/arm/at91/if_ate.c	Thu Nov 19 16:27:51 2009	(r199536)
+++ head/sys/arm/at91/if_ate.c	Thu Nov 19 18:11:23 2009	(r199537)
@@ -276,7 +276,6 @@ ate_attach(device_t dev)
 	IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN);
 	ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN;
 	IFQ_SET_READY(&ifp->if_snd);
-	ifp->if_timer = 0;
 	ifp->if_linkmib = &sc->mibdata;
 	ifp->if_linkmiblen = sizeof(sc->mibdata);
 	sc->mibdata.dot3Compliance = DOT3COMPLIANCE_COLLS;
@@ -999,7 +998,6 @@ atestop(struct ate_softc *sc)
 	ATE_ASSERT_LOCKED(sc);
 	ifp = sc->ifp;
 	if (ifp) {
-		ifp->if_timer = 0;
 		ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
 	}
 

Modified: head/sys/dev/nxge/if_nxge.c
==============================================================================
--- head/sys/dev/nxge/if_nxge.c	Thu Nov 19 16:27:51 2009	(r199536)
+++ head/sys/dev/nxge/if_nxge.c	Thu Nov 19 18:11:23 2009	(r199537)
@@ -2946,7 +2946,6 @@ xge_flush_txds(xge_hal_channel_h channel
 	struct ifnet *ifnetp = lldev->ifnetp;
 	u8 t_code;
 
-	ifnetp->if_timer = 0;
 	while(xge_hal_fifo_dtr_next_completed(channelh, &tx_dtr, &t_code)
 	    == XGE_HAL_OK) {
 	    XGE_DRV_STATS(tx_desc_compl);
@@ -3105,7 +3104,6 @@ _exit1:
 	XGE_DRV_STATS(tx_again);
 
 _exit:
-	ifnetp->if_timer = 15;
 }
 
 /**
@@ -3269,8 +3267,6 @@ xge_tx_compl(xge_hal_channel_h channelh,
 
 	XGE_DRV_STATS(tx_completions);
 
-	ifnetp->if_timer = 0;
-
 	/*
 	 * For each completed descriptor: Get private structure, free buffer,
 	 * do unmapping, and free descriptor

Modified: head/sys/dev/wl/if_wl.c
==============================================================================
--- head/sys/dev/wl/if_wl.c	Thu Nov 19 16:27:51 2009	(r199536)
+++ head/sys/dev/wl/if_wl.c	Thu Nov 19 18:11:23 2009	(r199537)
@@ -559,10 +559,8 @@ wlattach(device_t device)
     ifp->if_init = wlinit;
     ifp->if_start = wlstart;
     ifp->if_ioctl = wlioctl;
-    ifp->if_timer = 0;   /* paranoia */
     ifp->if_snd.ifq_maxlen = IFQ_MAXLEN;
     /* no entries
-       ifp->if_watchdog
        ifp->if_done
        ifp->if_reset
        */

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 18:21:51 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 754F81065670;
	Thu, 19 Nov 2009 18:21:51 +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 648488FC0C;
	Thu, 19 Nov 2009 18:21:51 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAJILpQN014637;
	Thu, 19 Nov 2009 18:21:51 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAJILpZ6014634;
	Thu, 19 Nov 2009 18:21:51 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200911191821.nAJILpZ6014634@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 19 Nov 2009 18:21: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: r199538 - head/sys/dev/lmc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 18:21:51 -0000

Author: jhb
Date: Thu Nov 19 18:21:51 2009
New Revision: 199538
URL: http://svn.freebsd.org/changeset/base/199538

Log:
  This driver has two modes, a netgraph mode and an ifnet mode.  In the
  netgraph mode it used a private timer to drive the transmit watchdog.  In
  the ifnet mode it used if_watchdog.  Now it always uses the private timer.

Modified:
  head/sys/dev/lmc/if_lmc.c
  head/sys/dev/lmc/if_lmc.h

Modified: head/sys/dev/lmc/if_lmc.c
==============================================================================
--- head/sys/dev/lmc/if_lmc.c	Thu Nov 19 18:11:23 2009	(r199537)
+++ head/sys/dev/lmc/if_lmc.c	Thu Nov 19 18:21:51 2009	(r199538)
@@ -4642,8 +4642,9 @@ lmc_raw_output(struct ifnet *ifp, struct
 
 /* Called from a softirq once a second. */
 static void
-lmc_ifnet_watchdog(struct ifnet *ifp)
+lmc_watchdog(void *arg)
   {
+  struct ifnet *ifp = arg;
   softc_t *sc = IFP2SC(ifp);
   u_int8_t old_oper_status = sc->status.oper_status;
   struct event_cntrs *cntrs = &sc->status.cntrs;
@@ -4734,7 +4735,7 @@ lmc_ifnet_watchdog(struct ifnet *ifp)
 # endif
 
   /* Call this procedure again after one second. */
-  ifp->if_timer = 1;
+  callout_reset(&sc->callout, hz, lmc_watchdog, ifp);
   }
 
 # ifdef __OpenBSD__
@@ -4822,8 +4823,6 @@ setup_ifnet(struct ifnet *ifp)
   ifp->if_start    = lmc_ifnet_start;	/* sppp changes this */
   ifp->if_output   = lmc_raw_output;	/* sppp & p2p change this */
   ifp->if_input    = lmc_raw_input;
-  ifp->if_watchdog = lmc_ifnet_watchdog;
-  ifp->if_timer    = 1;
   ifp->if_mtu      = MAX_DESC_LEN;	/* sppp & p2p change this */
   ifp->if_type     = IFT_PTPSERIAL;	/* p2p changes this */
 
@@ -4917,6 +4916,8 @@ lmc_ifnet_attach(softc_t *sc)
     }
 # endif  /* __OpenBSD__ */
 
+  callout_reset(&sc->callout, hz, lmc_watchdog, sc);
+
   return 0;
   }
 
@@ -5244,7 +5245,7 @@ ng_watchdog(void *arg)
   sc->status.line_prot = 0;
 
   /* Call this procedure again after one second. */
-  callout_reset(&sc->ng_callout, hz, ng_watchdog, sc);
+  callout_reset(&sc->callout, hz, ng_watchdog, sc);
   }
 # endif
 
@@ -5301,16 +5302,9 @@ ng_attach(softc_t *sc)
   IFQ_SET_MAXLEN(&sc->ng_sndq,  SNDQ_MAXLEN);
   IFQ_SET_READY(&sc->ng_sndq);
 
-  /* If ifnet is present, it will call watchdog. */
-  /* Otherwise, arrange to call watchdog here. */
 # if (IFNET == 0)
   /* Arrange to call ng_watchdog() once a second. */
-#  if (__FreeBSD_version >= 500000)
-  callout_init(&sc->ng_callout, 0);
-#  else  /* FreeBSD-4 */
-  callout_init(&sc->ng_callout);
-#  endif
-  callout_reset(&sc->ng_callout, hz, ng_watchdog, sc);
+  callout_reset(&sc->callout, hz, ng_watchdog, sc);
 # endif
 
   return 0;
@@ -5319,9 +5313,7 @@ ng_attach(softc_t *sc)
 static void
 ng_detach(softc_t *sc)
   {
-# if (IFNET == 0)
-  callout_stop(&sc->ng_callout);
-# endif
+  callout_drain(&sc->callout);
 # if (__FreeBSD_version >= 500000)
   mtx_destroy(&sc->ng_sndq.ifq_mtx);
   mtx_destroy(&sc->ng_fastq.ifq_mtx);
@@ -5493,6 +5485,12 @@ attach_card(softc_t *sc, const char *int
   /* Start the card. */
   if ((error = startup_card(sc))) return error;
 
+#  if (__FreeBSD_version >= 500000)
+  callout_init(&sc->callout, 0);
+#  else  /* FreeBSD-4 */
+  callout_init(&sc->callout);
+#  endif
+
   /* Attach a kernel interface. */
 #if NETGRAPH
   if ((error = ng_attach(sc))) return error;

Modified: head/sys/dev/lmc/if_lmc.h
==============================================================================
--- head/sys/dev/lmc/if_lmc.h	Thu Nov 19 18:11:23 2009	(r199537)
+++ head/sys/dev/lmc/if_lmc.h	Thu Nov 19 18:21:51 2009	(r199538)
@@ -1140,7 +1140,6 @@ struct softc
 #endif
 
 #if NETGRAPH
-  struct callout ng_callout;	/* ng_watchdog needs this                  */
   node_p	ng_node;	/* pointer to our node struct              */
   hook_p	ng_hook;	/* non-zero means NETGRAPH owns device     */
 # if (__FreeBSD_version >= 503000)
@@ -1153,6 +1152,7 @@ struct softc
 #endif
 
 #ifdef __FreeBSD__
+  struct callout callout;	/* watchdog needs this                  */
   struct device	*dev;		/* base device pointer                     */
   bus_space_tag_t csr_tag;	/* bus_space needs this                    */
   bus_space_handle_t csr_handle;/* bus_space_needs this                    */
@@ -1596,7 +1596,6 @@ static int lmc_ifnet_ioctl(struct ifnet 
 static void lmc_ifnet_start(struct ifnet *);
 static int lmc_raw_output(struct ifnet *, struct mbuf *,
  struct sockaddr *, struct route *);
-static void lmc_ifnet_watchdog(struct ifnet *);
 # ifdef __OpenBSD__
 static int ifmedia_change(struct ifnet *);
 static void ifmedia_status(struct ifnet *, struct ifmediareq *);

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 18:37:55 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6BE031065670;
	Thu, 19 Nov 2009 18:37:55 +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 5AC8F8FC15;
	Thu, 19 Nov 2009 18:37:55 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAJIbt9Z015112;
	Thu, 19 Nov 2009 18:37:55 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAJIbtJM015109;
	Thu, 19 Nov 2009 18:37:55 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200911191837.nAJIbtJM015109@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 19 Nov 2009 18:37: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: r199539 - head/sys/dev/ixgb
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 18:37:55 -0000

Author: jhb
Date: Thu Nov 19 18:37:55 2009
New Revision: 199539
URL: http://svn.freebsd.org/changeset/base/199539

Log:
  - Use callout_init_mtx() instead of callout_init(..., CALLOUT_MPSAFE).
  - Add a missing callout_drain() to detach.
  - Hook into the stats timer and use that to drive the transmit watchdog
    instead of using if_watchdog.
  - Run the stats timer every second to match other drivers instead of every
    other second.
  - Remove dubious callout handling that stopped the timer only to start it
    again while holding the driver lock without dropping it in between the
    stop and the start.

Modified:
  head/sys/dev/ixgb/if_ixgb.c
  head/sys/dev/ixgb/if_ixgb.h

Modified: head/sys/dev/ixgb/if_ixgb.c
==============================================================================
--- head/sys/dev/ixgb/if_ixgb.c	Thu Nov 19 18:21:51 2009	(r199538)
+++ head/sys/dev/ixgb/if_ixgb.c	Thu Nov 19 18:37:55 2009	(r199539)
@@ -97,7 +97,7 @@ static void     ixgb_intr(void *);
 static void     ixgb_start(struct ifnet *);
 static void     ixgb_start_locked(struct ifnet *);
 static int      ixgb_ioctl(struct ifnet *, IOCTL_CMD_TYPE, caddr_t);
-static void     ixgb_watchdog(struct ifnet *);
+static void     ixgb_watchdog(struct adapter *);
 static void     ixgb_init(void *);
 static void     ixgb_init_locked(struct adapter *);
 static void     ixgb_stop(void *);
@@ -274,7 +274,7 @@ ixgb_attach(device_t dev)
 			(void *)adapter, 0,
 			ixgb_sysctl_stats, "I", "Statistics");
 
-	callout_init(&adapter->timer, CALLOUT_MPSAFE);
+	callout_init_mtx(&adapter->timer, &adapter->mtx, 0);
 
 	/* Determine hardware revision */
 	ixgb_identify_hardware(adapter);
@@ -382,13 +382,14 @@ ixgb_detach(device_t dev)
 	IXGB_UNLOCK(adapter);
 
 #if __FreeBSD_version < 500000
-	ether_ifdetach(adapter->ifp, ETHER_BPF_SUPPORTED);
+	ether_ifdetach(ifp, ETHER_BPF_SUPPORTED);
 #else
-	ether_ifdetach(adapter->ifp);
+	ether_ifdetach(ifp);
 #endif
+	callout_drain(&adapter->timer);
 	ixgb_free_pci_resources(adapter);
 #if __FreeBSD_version >= 500000
-	if_free(adapter->ifp);
+	if_free(ifp);
 #endif
 
 	/* Free Transmit Descriptor ring */
@@ -409,9 +410,6 @@ ixgb_detach(device_t dev)
 	if (adapter->prev != NULL)
 		adapter->prev->next = adapter->next;
 
-	ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
-	ifp->if_timer = 0;
-
 	IXGB_LOCK_DESTROY(adapter);
 	return (0);
 }
@@ -473,7 +471,7 @@ ixgb_start_locked(struct ifnet * ifp)
 		ETHER_BPF_MTAP(ifp, m_head);
 #endif
 		/* Set timeout in case hardware has problems transmitting */
-		ifp->if_timer = IXGB_TX_TIMEOUT;
+		adapter->tx_timer = IXGB_TX_TIMEOUT;
 
 	}
 	return;
@@ -610,26 +608,24 @@ out:
  **********************************************************************/
 
 static void
-ixgb_watchdog(struct ifnet * ifp)
+ixgb_watchdog(struct adapter *adapter)
 {
-	struct adapter *adapter;
-	adapter = ifp->if_softc;
+	struct ifnet *ifp;
+
+	ifp = adapter->ifp;
 
 	/*
 	 * If we are in this routine because of pause frames, then don't
 	 * reset the hardware.
 	 */
 	if (IXGB_READ_REG(&adapter->hw, STATUS) & IXGB_STATUS_TXOFF) {
-		ifp->if_timer = IXGB_TX_TIMEOUT;
+		adapter->tx_timer = IXGB_TX_TIMEOUT;
 		return;
 	}
 	if_printf(ifp, "watchdog timeout -- resetting\n");
 
-	ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
-
-
 	ixgb_stop(adapter);
-	ixgb_init(adapter);
+	ixgb_init_locked(adapter);
 
 
 	ifp->if_oerrors++;
@@ -713,7 +709,7 @@ ixgb_init_locked(struct adapter *adapter
 		temp_reg |= IXGB_CTRL0_JFE;
 		IXGB_WRITE_REG(&adapter->hw, CTRL0, temp_reg);
 	}
-	callout_reset(&adapter->timer, 2 * hz, ixgb_local_timer, adapter);
+	callout_reset(&adapter->timer, hz, ixgb_local_timer, adapter);
 	ixgb_clear_hw_cntrs(&adapter->hw);
 #ifdef DEVICE_POLLING
 	/*
@@ -753,11 +749,8 @@ ixgb_poll_locked(struct ifnet * ifp, enu
 	if (cmd == POLL_AND_CHECK_STATUS) {
 		reg_icr = IXGB_READ_REG(&adapter->hw, ICR);
 		if (reg_icr & (IXGB_INT_RXSEQ | IXGB_INT_LSC)) {
-			callout_stop(&adapter->timer);
 			ixgb_check_for_link(&adapter->hw);
 			ixgb_print_link_status(adapter);
-			callout_reset(&adapter->timer, 2 * hz, ixgb_local_timer,
-			    adapter);
 		}
 	}
 	rx_npkts = ixgb_process_receive_interrupts(adapter, count);
@@ -830,11 +823,8 @@ ixgb_intr(void *arg)
 
 	/* Link status change */
 	if (reg_icr & (IXGB_INT_RXSEQ | IXGB_INT_LSC)) {
-		callout_stop(&adapter->timer);
 		ixgb_check_for_link(&adapter->hw);
 		ixgb_print_link_status(adapter);
-		callout_reset(&adapter->timer, 2 * hz, ixgb_local_timer,
-		    adapter);
 	}
 	while (loop_cnt > 0) {
 		if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
@@ -1123,7 +1113,7 @@ ixgb_local_timer(void *arg)
 	struct adapter *adapter = arg;
 	ifp = adapter->ifp;
 
-	IXGB_LOCK(adapter);
+	IXGB_LOCK_ASSERT(adapter);
 
 	ixgb_check_for_link(&adapter->hw);
 	ixgb_print_link_status(adapter);
@@ -1131,10 +1121,9 @@ ixgb_local_timer(void *arg)
 	if (ixgb_display_debug_stats && ifp->if_drv_flags & IFF_DRV_RUNNING) {
 		ixgb_print_hw_stats(adapter);
 	}
-	callout_reset(&adapter->timer, 2 * hz, ixgb_local_timer, adapter);
-
-	IXGB_UNLOCK(adapter);
-	return;
+	if (adapter->tx_timer != 0 && --adapter->tx_timer == 0)
+		ixgb_watchdog(adapter);
+	callout_reset(&adapter->timer, hz, ixgb_local_timer, adapter);
 }
 
 static void
@@ -1183,9 +1172,9 @@ ixgb_stop(void *arg)
 	ixgb_free_transmit_structures(adapter);
 	ixgb_free_receive_structures(adapter);
 
-
 	/* Tell the stack that the interface is no longer active */
 	ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
+	adapter->tx_timer = 0;
 
 	return;
 }
@@ -1352,7 +1341,6 @@ ixgb_setup_interface(device_t dev, struc
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
 	ifp->if_ioctl = ixgb_ioctl;
 	ifp->if_start = ixgb_start;
-	ifp->if_watchdog = ixgb_watchdog;
 	ifp->if_snd.ifq_maxlen = adapter->num_tx_desc - 1;
 
 #if __FreeBSD_version < 500000
@@ -1755,9 +1743,9 @@ ixgb_clean_transmit_interrupts(struct ad
 
 		ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
 		if (num_avail == adapter->num_tx_desc)
-			ifp->if_timer = 0;
+			adapter->tx_timer = 0;
 		else if (num_avail == adapter->num_tx_desc_avail)
-			ifp->if_timer = IXGB_TX_TIMEOUT;
+			adapter->tx_timer = IXGB_TX_TIMEOUT;
 	}
 	adapter->num_tx_desc_avail = num_avail;
 	return;

Modified: head/sys/dev/ixgb/if_ixgb.h
==============================================================================
--- head/sys/dev/ixgb/if_ixgb.h	Thu Nov 19 18:21:51 2009	(r199538)
+++ head/sys/dev/ixgb/if_ixgb.h	Thu Nov 19 18:37:55 2009	(r199539)
@@ -284,6 +284,7 @@ struct adapter {
 	struct ifmedia  media;
 	struct callout 	timer;
 	int             io_rid;
+	int		tx_timer;
 	struct mtx	mtx;
 
 	/* Info about the board itself */

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 18:38:45 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5644E106566B
	for ; Thu, 19 Nov 2009 18:38:45 +0000 (UTC)
	(envelope-from julian@elischer.org)
Received: from outP.internet-mail-service.net (outp.internet-mail-service.net
	[216.240.47.239])
	by mx1.freebsd.org (Postfix) with ESMTP id 3D1BF8FC1C
	for ; Thu, 19 Nov 2009 18:38:45 +0000 (UTC)
Received: from idiom.com (mx0.idiom.com [216.240.32.160])
	by out.internet-mail-service.net (Postfix) with ESMTP id 595EE14E053;
	Thu, 19 Nov 2009 10:38:44 -0800 (PST)
X-Client-Authorized: MaGic Cook1e
X-Client-Authorized: MaGic Cook1e
X-Client-Authorized: MaGic Cook1e
X-Client-Authorized: MaGic Cook1e
Received: from julian-mac.elischer.org
	(h-67-100-89-137.snfccasy.static.covad.net [67.100.89.137])
	by idiom.com (Postfix) with ESMTP id 500AD2D6018;
	Thu, 19 Nov 2009 10:38:43 -0800 (PST)
Message-ID: <4B0590B2.1010007@elischer.org>
Date: Thu, 19 Nov 2009 10:38:42 -0800
From: Julian Elischer 
User-Agent: Thunderbird 2.0.0.23 (Macintosh/20090812)
MIME-Version: 1.0
To: John Baldwin 
References: <200911191821.nAJILpZ6014634@svn.freebsd.org>
In-Reply-To: <200911191821.nAJILpZ6014634@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: r199538 - head/sys/dev/lmc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 18:38:45 -0000

John Baldwin wrote:
> Author: jhb
> Date: Thu Nov 19 18:21:51 2009

> +#  if (__FreeBSD_version >= 500000)
> +  callout_init(&sc->callout, 0);
> +#  else  /* FreeBSD-4 */
> +  callout_init(&sc->callout);
> +#  endif
> +


I think the OpenBSD and _FreeBSD_version >= 500000
conditions can probably be removed..


>  
>  #ifdef __FreeBSD__
> +  struct callout callout;	/* watchdog needs this                  */
>    struct device	*dev;		/* base device pointer                     */
>    bus_space_tag_t csr_tag;	/* bus_space needs this                    */
>    bus_space_handle_t csr_handle;/* bus_space_needs this                    */

along with #ifdef __FreeBSD__

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 18:43:44 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 23B2D1065698;
	Thu, 19 Nov 2009 18:43: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 1231A8FC13;
	Thu, 19 Nov 2009 18:43:44 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAJIhhvv015298;
	Thu, 19 Nov 2009 18:43:43 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAJIhh0q015295;
	Thu, 19 Nov 2009 18:43:43 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200911191843.nAJIhh0q015295@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 19 Nov 2009 18:43: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: r199540 - head/sys/dev/my
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 18:43:44 -0000

Author: jhb
Date: Thu Nov 19 18:43:43 2009
New Revision: 199540
URL: http://svn.freebsd.org/changeset/base/199540

Log:
  - This driver used the if_watchdog timer both as a watchdog on transmit and
    auto-negotiation.  To make this simpler and easier to understand I have
    split this out into two separate timers.  One just manages the auto-neg
    side of things and one is a transmit watchdog.  Neither uses if_watchdog.
  - Call ether_ifdetach() at the start of detach.

Modified:
  head/sys/dev/my/if_my.c
  head/sys/dev/my/if_myreg.h

Modified: head/sys/dev/my/if_my.c
==============================================================================
--- head/sys/dev/my/if_my.c	Thu Nov 19 18:37:55 2009	(r199539)
+++ head/sys/dev/my/if_my.c	Thu Nov 19 18:43:43 2009	(r199540)
@@ -126,7 +126,8 @@ static int      my_ioctl(struct ifnet *,
 static void     my_init(void *);
 static void     my_init_locked(struct my_softc *);
 static void     my_stop(struct my_softc *);
-static void     my_watchdog(struct ifnet *);
+static void     my_autoneg_timeout(void *);
+static void     my_watchdog(void *);
 static int      my_shutdown(device_t);
 static int      my_ifmedia_upd(struct ifnet *);
 static void     my_ifmedia_sts(struct ifnet *, struct ifmediareq *);
@@ -382,6 +383,15 @@ my_autoneg_xmit(struct my_softc * sc)
 	return;
 }
 
+static void
+my_autoneg_timeout(void *arg)
+{
+	struct my_softc *sc;
+
+	sc = arg;
+	MY_LOCK_ASSERT(sc);
+	my_autoneg_mii(sc, MY_FLAG_DELAYTIMEO, 1);
+}
 
 /*
  * Invoke autonegotiation on a PHY.
@@ -439,12 +449,13 @@ my_autoneg_mii(struct my_softc * sc, int
 			return;
 		}
 		my_autoneg_xmit(sc);
-		ifp->if_timer = 5;
+		callout_reset(&sc->my_autoneg_timer, hz * 5, my_autoneg_timeout,
+		    sc);
 		sc->my_autoneg = 1;
 		sc->my_want_auto = 0;
 		return;
 	case MY_FLAG_DELAYTIMEO:
-		ifp->if_timer = 0;
+		callout_stop(&sc->my_autoneg_timer);
 		sc->my_autoneg = 0;
 		break;
 	default:
@@ -661,7 +672,8 @@ my_setmode_mii(struct my_softc * sc, int
 	 */
 	if (sc->my_autoneg) {
 		device_printf(sc->my_dev, "canceling autoneg session\n");
-		ifp->if_timer = sc->my_autoneg = sc->my_want_auto = 0;
+		callout_stop(&sc->my_autoneg_timer);
+		sc->my_autoneg = sc->my_want_auto = 0;
 		bmcr = my_phy_readreg(sc, PHY_BMCR);
 		bmcr &= ~PHY_BMCR_AUTONEGENBL;
 		my_phy_writereg(sc, PHY_BMCR, bmcr);
@@ -808,6 +820,8 @@ my_attach(device_t dev)
 	sc->my_dev = dev;
 	mtx_init(&sc->my_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
 	    MTX_DEF);
+	callout_init_mtx(&sc->my_autoneg_timer, &sc->my_mtx, 0);
+	callout_init_mtx(&sc->my_watchdog, &sc->my_mtx, 0);
 
 	/*
 	 * Map control/status registers.
@@ -886,7 +900,6 @@ my_attach(device_t dev)
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
 	ifp->if_ioctl = my_ioctl;
 	ifp->if_start = my_start;
-	ifp->if_watchdog = my_watchdog;
 	ifp->if_init = my_init;
 	ifp->if_baudrate = 10000000;
 	IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN);
@@ -984,13 +997,15 @@ my_detach(device_t dev)
 	struct ifnet   *ifp;
 
 	sc = device_get_softc(dev);
+	ifp = sc->my_ifp;
+	ether_ifdetach(ifp);
 	MY_LOCK(sc);
 	my_stop(sc);
 	MY_UNLOCK(sc);
 	bus_teardown_intr(dev, sc->my_irq, sc->my_intrhand);
+	callout_drain(&sc->my_watchdog);
+	callout_drain(&sc->my_autoneg_timer);
 
-	ifp = sc->my_ifp;
-	ether_ifdetach(ifp);
 	if_free(ifp);
 	free(sc->my_ldata_ptr, M_DEVBUF);
 
@@ -1188,7 +1203,7 @@ my_txeof(struct my_softc * sc)
 	MY_LOCK_ASSERT(sc);
 	ifp = sc->my_ifp;
 	/* Clear the timeout timer. */
-	ifp->if_timer = 0;
+	sc->my_timer = 0;
 	if (sc->my_cdata.my_tx_head == NULL) {
 		return;
 	}
@@ -1240,7 +1255,7 @@ my_txeoc(struct my_softc * sc)
 
 	MY_LOCK_ASSERT(sc);
 	ifp = sc->my_ifp;
-	ifp->if_timer = 0;
+	sc->my_timer = 0;
 	if (sc->my_cdata.my_tx_head == NULL) {
 		ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
 		sc->my_cdata.my_tx_tail = NULL;
@@ -1249,7 +1264,7 @@ my_txeoc(struct my_softc * sc)
 	} else {
 		if (MY_TXOWN(sc->my_cdata.my_tx_head) == MY_UNSENT) {
 			MY_TXOWN(sc->my_cdata.my_tx_head) = MY_OWNByNIC;
-			ifp->if_timer = 5;
+			sc->my_timer = 5;
 			CSR_WRITE_4(sc, MY_TXPDR, 0xFFFFFFFF);
 		}
 	}
@@ -1455,7 +1470,7 @@ my_start_locked(struct ifnet * ifp)
 	/*
 	 * Set a timeout in case the chip goes out to lunch.
 	 */
-	ifp->if_timer = 5;
+	sc->my_timer = 5;
 	return;
 }
 
@@ -1555,6 +1570,8 @@ my_init_locked(struct my_softc *sc)
 		my_phy_writereg(sc, PHY_BMCR, phy_bmcr);
 	ifp->if_drv_flags |= IFF_DRV_RUNNING;
 	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
+
+	callout_reset(&sc->my_watchdog, hz, my_watchdog, sc);
 	return;
 }
 
@@ -1680,17 +1697,18 @@ my_ioctl(struct ifnet * ifp, u_long comm
 }
 
 static void
-my_watchdog(struct ifnet * ifp)
+my_watchdog(void *arg)
 {
 	struct my_softc *sc;
+	struct ifnet *ifp;
 
-	sc = ifp->if_softc;
-	MY_LOCK(sc);
-	if (sc->my_autoneg) {
-		my_autoneg_mii(sc, MY_FLAG_DELAYTIMEO, 1);
-		MY_UNLOCK(sc);
+	sc = arg;
+	MY_LOCK_ASSERT(sc);
+	callout_reset(&sc->my_watchdog, hz, my_watchdog, sc);
+	if (sc->my_timer == 0 || --sc->my_timer > 0)
 		return;
-	}
+
+	ifp = sc->my_ifp;
 	ifp->if_oerrors++;
 	if_printf(ifp, "watchdog timeout\n");
 	if (!(my_phy_readreg(sc, PHY_BMSR) & PHY_BMSR_LINKSTAT))
@@ -1700,8 +1718,6 @@ my_watchdog(struct ifnet * ifp)
 	my_init_locked(sc);
 	if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
 		my_start_locked(ifp);
-	MY_UNLOCK(sc);
-	return;
 }
 
 
@@ -1716,7 +1732,9 @@ my_stop(struct my_softc * sc)
 
 	MY_LOCK_ASSERT(sc);
 	ifp = sc->my_ifp;
-	ifp->if_timer = 0;
+
+	callout_stop(&sc->my_autoneg_timer);
+	callout_stop(&sc->my_watchdog);
 
 	MY_CLRBIT(sc, MY_TCRRCR, (MY_RE | MY_TE));
 	CSR_WRITE_4(sc, MY_IMR, 0x00000000);

Modified: head/sys/dev/my/if_myreg.h
==============================================================================
--- head/sys/dev/my/if_myreg.h	Thu Nov 19 18:37:55 2009	(r199539)
+++ head/sys/dev/my/if_myreg.h	Thu Nov 19 18:43:43 2009	(r199540)
@@ -371,8 +371,10 @@ struct my_softc {
         struct my_chain_data    my_cdata;
 	device_t		my_miibus;
 /* Add by Surfer 2001/12/2 */
-	struct mtx		my_mtx;	
-
+	struct mtx		my_mtx;
+	struct callout		my_autoneg_timer;
+	struct callout		my_watchdog;
+	int			my_timer;
 };
 
 /* Add by Surfer 2001/12/2 */

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 19:19:38 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 526ED1065672;
	Thu, 19 Nov 2009 19:19: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 2405E8FC08;
	Thu, 19 Nov 2009 19:19:38 +0000 (UTC)
Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net
	[66.111.2.69])
	by cyrus.watson.org (Postfix) with ESMTPSA id 9D1FF46B2C;
	Thu, 19 Nov 2009 14:19:37 -0500 (EST)
Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8])
	by bigwig.baldwin.cx (Postfix) with ESMTPA id DEBC18A020;
	Thu, 19 Nov 2009 14:19:36 -0500 (EST)
From: John Baldwin 
To: Julian Elischer 
Date: Thu, 19 Nov 2009 14:19:29 -0500
User-Agent: KMail/1.9.7
References: <200911191821.nAJILpZ6014634@svn.freebsd.org>
	<4B0590B2.1010007@elischer.org>
In-Reply-To: <4B0590B2.1010007@elischer.org>
MIME-Version: 1.0
Content-Type: text/plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200911191419.30432.jhb@freebsd.org>
X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1
	(bigwig.baldwin.cx); Thu, 19 Nov 2009 14:19:36 -0500 (EST)
X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx
X-Virus-Status: Clean
X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE
	autolearn=no version=3.2.5
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r199538 - head/sys/dev/lmc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 19:19:38 -0000

On Thursday 19 November 2009 1:38:42 pm Julian Elischer wrote:
> John Baldwin wrote:
> > Author: jhb
> > Date: Thu Nov 19 18:21:51 2009
> 
> > +#  if (__FreeBSD_version >= 500000)
> > +  callout_init(&sc->callout, 0);
> > +#  else  /* FreeBSD-4 */
> > +  callout_init(&sc->callout);
> > +#  endif
> > +
> 
> 
> I think the OpenBSD and _FreeBSD_version >= 500000
> conditions can probably be removed..
> 
> 
> >  
> >  #ifdef __FreeBSD__
> > +  struct callout callout;	/* watchdog needs this                  */
> >    struct device	*dev;		/* base device pointer                     */
> >    bus_space_tag_t csr_tag;	/* bus_space needs this                    */
> >    bus_space_handle_t csr_handle;/* bus_space_needs this                    
*/
> 
> along with #ifdef __FreeBSD__

Go for it. :)  I was just removing if_watchdog use in this sweep.  No one 
stepped up to test this since I posted it almost 2 weeks ago though, so I'm 
not sure if there are any users of this.

-- 
John Baldwin

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 19:25:48 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 608BB106566B;
	Thu, 19 Nov 2009 19:25: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 4E7D78FC13;
	Thu, 19 Nov 2009 19:25:48 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAJJPmAO016379;
	Thu, 19 Nov 2009 19:25:48 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAJJPmIZ016374;
	Thu, 19 Nov 2009 19:25:48 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200911191925.nAJJPmIZ016374@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 19 Nov 2009 19:25: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: r199542 - head/sys/dev/pdq
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 19:25:48 -0000

Author: jhb
Date: Thu Nov 19 19:25:47 2009
New Revision: 199542
URL: http://svn.freebsd.org/changeset/base/199542

Log:
  Several fixes to these drivers.  Note that these two drivers are actually
  just two different attachments (EISA and PCI) to a single driver.
  - Add real locking.  Previously these drivers only acquired their lock
    in their interrupt handler or in the ioctl routine (but too broadly in
    the latter).  No locking was used for the stack calling down into the
    driver via if_init() or if_start(), for device shutdown or detach.  Also,
    the interrupt handler held the driver lock while calling if_input().  All
    this stuff should be fixed in the locking changes.
  - Really fix these drivers to handle if_alloc().  The front-end attachments
    were using if_initname() before the ifnet was allocated.  Fix this by
    moving some of the duplicated logic from each driver into pdq_ifattach().
    While here, make pdq_ifattach() return an error so that the driver just
    fails to attach if if_alloc() fails rather than panic'ing.  Also, defer
    freeing the ifnet until the driver has stopped using it during detach.
  - Add a new private timer to drive the watchdog timer.
  - Pass the softc pointer to the interrupt handlers instead of the device_t
    so we can avoid the use of device_get_softc() and to better match what
    other drivers do.

Modified:
  head/sys/dev/pdq/if_fea.c
  head/sys/dev/pdq/if_fpa.c
  head/sys/dev/pdq/pdq_freebsd.h
  head/sys/dev/pdq/pdq_ifsubr.c

Modified: head/sys/dev/pdq/if_fea.c
==============================================================================
--- head/sys/dev/pdq/if_fea.c	Thu Nov 19 18:56:06 2009	(r199541)
+++ head/sys/dev/pdq/if_fea.c	Thu Nov 19 19:25:47 2009	(r199542)
@@ -163,11 +163,9 @@ static void
 pdq_eisa_ifintr(arg)
 	void *		arg;
 {
-	device_t	dev;
 	pdq_softc_t *	sc;
 
-	dev = (device_t)arg;
-	sc = device_get_softc(dev);
+	sc = arg;
 
 	PDQ_LOCK(sc);
 	(void) pdq_interrupt(sc->sc_pdq);
@@ -181,11 +179,9 @@ pdq_eisa_attach (dev)
 	device_t	dev;
 {
 	pdq_softc_t *	sc;
-	struct ifnet *	ifp;
 	int		error;
 
 	sc = device_get_softc(dev);
-	ifp = sc->ifp;
 
 	sc->dev = dev;
 
@@ -222,28 +218,20 @@ pdq_eisa_attach (dev)
 		goto bad;
 	}
 
-	if_initname(ifp, device_get_name(dev), device_get_unit(dev));
-
 	pdq_eisa_devinit(sc);
-	sc->sc_pdq = pdq_initialize(sc->mem_bst, sc->mem_bsh,
-				    ifp->if_xname, -1,
-				    (void *)sc, PDQ_DEFEA);
-	if (sc->sc_pdq == NULL) {
-		device_printf(dev, "Initialization failed.\n");
-		error = ENXIO;
+	error = pdq_ifattach(sc, sc->sc_pdq->pdq_hwaddr.lanaddr_bytes,
+	    PDQ_DEFEA);
+	if (error)
 		goto bad;
-	}
 
-	error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET,
-		               NULL, pdq_eisa_ifintr, dev, &sc->irq_ih);
+	error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET | INTR_MPSAFE,
+		               NULL, pdq_eisa_ifintr, sc, &sc->irq_ih);
 	if (error) {
 		device_printf(dev, "Failed to setup interrupt handler.\n");
-		error = ENXIO;
-		goto bad;
+		pdq_ifdetach(sc);
+		return (error);
 	}
 
-	pdq_ifattach(sc, sc->sc_pdq->pdq_hwaddr.lanaddr_bytes);
-
 	return (0);
 bad:
 	pdq_free(dev);
@@ -269,7 +257,9 @@ pdq_eisa_shutdown(dev)
 	pdq_softc_t *	sc;
 
 	sc = device_get_softc(dev);
+	PDQ_LOCK(sc);
 	pdq_hwreset(sc->sc_pdq);
+	PDQ_UNLOCK(sc);
 
 	return (0);
 }

Modified: head/sys/dev/pdq/if_fpa.c
==============================================================================
--- head/sys/dev/pdq/if_fpa.c	Thu Nov 19 18:56:06 2009	(r199541)
+++ head/sys/dev/pdq/if_fpa.c	Thu Nov 19 19:25:47 2009	(r199542)
@@ -73,11 +73,9 @@ static void	pdq_pci_ifintr		(void *);
 static void
 pdq_pci_ifintr(void *arg)
 {
-    device_t dev;
     pdq_softc_t *sc;
 
-    dev = (device_t)arg;
-    sc = device_get_softc(dev);
+    sc = arg;
 
     PDQ_LOCK(sc);
     (void) pdq_interrupt(sc->sc_pdq);
@@ -105,12 +103,10 @@ static int
 pdq_pci_attach(device_t dev)
 {
     pdq_softc_t *sc;
-    struct ifnet *ifp;
     u_int32_t command;
     int error;
 
     sc = device_get_softc(dev);
-    ifp = sc->ifp;
 
     sc->dev = dev;
 
@@ -146,26 +142,18 @@ pdq_pci_attach(device_t dev)
 	goto bad;
     }
 
-    if_initname(ifp, device_get_name(dev), device_get_unit(dev));
-
-    sc->sc_pdq = pdq_initialize(sc->mem_bst, sc->mem_bsh,
-				ifp->if_xname, -1,
-				(void *)sc, PDQ_DEFPA);
-    if (sc->sc_pdq == NULL) {
-	device_printf(dev, "Initialization failed.\n");
-	error = ENXIO;
+    error = pdq_ifattach(sc, sc->sc_pdq->pdq_hwaddr.lanaddr_bytes, PDQ_DEFPA);
+    if (error)
 	goto bad;
-    }
-
-    error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET, NULL,
-			   pdq_pci_ifintr, dev, &sc->irq_ih);
+    
+    error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET | INTR_MPSAFE, NULL,
+			   pdq_pci_ifintr, sc, &sc->irq_ih);
     if (error) {
 	device_printf(dev, "Failed to setup interrupt handler.\n");
-	error = ENXIO;
-	goto bad;
+	pdq_ifdetach(sc);
+	return (error);
     }
 
-    pdq_ifattach(sc, sc->sc_pdq->pdq_hwaddr.lanaddr_bytes);
 
     return (0);
 bad:
@@ -191,7 +179,9 @@ pdq_pci_shutdown(device_t dev)
     pdq_softc_t *sc;
 
     sc = device_get_softc(dev);
+    PDQ_LOCK(sc);
     pdq_hwreset(sc->sc_pdq);
+    PDQ_UNLOCK(sc);
 
     return (0);
 }

Modified: head/sys/dev/pdq/pdq_freebsd.h
==============================================================================
--- head/sys/dev/pdq/pdq_freebsd.h	Thu Nov 19 18:56:06 2009	(r199541)
+++ head/sys/dev/pdq/pdq_freebsd.h	Thu Nov 19 19:25:47 2009	(r199542)
@@ -124,10 +124,13 @@ typedef struct _pdq_os_ctx_t {
 	void *			irq_ih;
 
 	struct mtx		mtx;
+	struct callout		watchdog;
+	int			timer;
 } pdq_softc_t;
 
 #define PDQ_LOCK(_sc)		mtx_lock(&(_sc)->mtx)
 #define PDQ_UNLOCK(_sc)		mtx_unlock(&(_sc)->mtx)
+#define	PDQ_LOCK_ASSERT(_sc)	mtx_assert(&(_sc)->mtx, MA_OWNED)
 
 #define	PDQ_OS_HDR_OFFSET	PDQ_RX_FC_OFFSET
 
@@ -255,7 +258,8 @@ pdq_state_t	pdq_stop (pdq_t *pdq);
  * OS dependent functions provided by
  * pdq_ifsubr.c or pdq.c to the bus front ends
  */
-void		pdq_ifattach (pdq_softc_t *, const pdq_uint8_t *);
+int		pdq_ifattach (pdq_softc_t *, const pdq_uint8_t *,
+			      pdq_type_t type);
 void		pdq_ifdetach (pdq_softc_t *);
 void		pdq_free (device_t);
 int		pdq_interrupt (pdq_t *pdq);

Modified: head/sys/dev/pdq/pdq_ifsubr.c
==============================================================================
--- head/sys/dev/pdq/pdq_ifsubr.c	Thu Nov 19 18:56:06 2009	(r199541)
+++ head/sys/dev/pdq/pdq_ifsubr.c	Thu Nov 19 19:25:47 2009	(r199542)
@@ -69,10 +69,23 @@ __FBSDID("$FreeBSD$");
 
 devclass_t pdq_devclass;
 
+static void	pdq_watchdog(void *);
+
+static void
+pdq_ifstop(pdq_softc_t *sc)
+{
+
+    PDQ_IFNET(sc)->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
+    sc->sc_pdq->pdq_flags &= ~PDQ_RUNNING;
+    pdq_stop(sc->sc_pdq);
+    callout_stop(&sc->watchdog);
+}
+
 static void
-pdq_ifinit(
-    pdq_softc_t *sc)
+pdq_ifinit_locked(pdq_softc_t *sc)
 {
+
+    PDQ_LOCK_ASSERT(sc);
     if (PDQ_IFNET(sc)->if_flags & IFF_UP) {
 	PDQ_IFNET(sc)->if_drv_flags |= IFF_DRV_RUNNING;
 	if (PDQ_IFNET(sc)->if_flags & IFF_PROMISC) {
@@ -87,24 +100,40 @@ pdq_ifinit(
 	}
 	sc->sc_pdq->pdq_flags |= PDQ_RUNNING;
 	pdq_run(sc->sc_pdq);
-    } else {
-	PDQ_IFNET(sc)->if_drv_flags &= ~IFF_DRV_RUNNING;
-	sc->sc_pdq->pdq_flags &= ~PDQ_RUNNING;
-	pdq_stop(sc->sc_pdq);
-    }
+	callout_reset(&sc->watchdog, hz, pdq_watchdog, sc);
+    } else
+	pdq_ifstop(sc);
+}
+
+static void
+pdq_ifinit(void *arg)
+{
+    pdq_softc_t *sc;
+
+    sc = arg;
+    PDQ_LOCK(sc);
+    pdq_ifinit_locked(sc);
+    PDQ_UNLOCK(sc);
 }
 
 static void
-pdq_ifwatchdog(
-    struct ifnet *ifp)
+pdq_watchdog(void *arg)
 {
+    pdq_softc_t *sc;
+    struct ifnet *ifp;
+
+    sc = arg;
+    PDQ_LOCK_ASSERT(sc);
+    callout_reset(&sc->watchdog, hz, pdq_watchdog, sc);
+    if (sc->timer == 0 || --sc->timer > 0)
+	return;
+
     /*
      * No progress was made on the transmit queue for PDQ_OS_TX_TRANSMIT
      * seconds.  Remove all queued packets.
      */
-
+    ifp = PDQ_IFNET(sc);
     ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
-    ifp->if_timer = 0;
     for (;;) {
 	struct mbuf *m;
 	IFQ_DEQUEUE(&ifp->if_snd, m);
@@ -115,18 +144,18 @@ pdq_ifwatchdog(
 }
 
 static void
-pdq_ifstart(
-    struct ifnet *ifp)
+pdq_ifstart_locked(struct ifnet *ifp)
 {
     pdq_softc_t * const sc = PDQ_OS_IFP_TO_SOFTC(ifp);
     struct mbuf *m;
     int tx = 0;
 
+    PDQ_LOCK_ASSERT(sc);
     if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
 	return;
 
-    if (PDQ_IFNET(sc)->if_timer == 0)
-	PDQ_IFNET(sc)->if_timer = PDQ_OS_TX_TIMEOUT;
+    if (sc->timer == 0)
+	sc->timer = PDQ_OS_TX_TIMEOUT;
 
     if ((sc->sc_pdq->pdq_flags & PDQ_TXOK) == 0) {
 	PDQ_IFNET(sc)->if_drv_flags |= IFF_DRV_OACTIVE;
@@ -177,6 +206,16 @@ pdq_ifstart(
 	PDQ_DO_TYPE2_PRODUCER(sc->sc_pdq);
     sc->sc_flags &= ~PDQIF_DOWNCALL;
 }
+
+static void
+pdq_ifstart(struct ifnet *ifp)
+{
+    pdq_softc_t * const sc = PDQ_OS_IFP_TO_SOFTC(ifp);
+
+    PDQ_LOCK(sc);
+    pdq_ifstart_locked(ifp);
+    PDQ_UNLOCK(sc);
+}
 
 void
 pdq_os_receive_pdu(
@@ -218,7 +257,9 @@ pdq_os_receive_pdu(
     }
 
     m->m_pkthdr.rcvif = ifp;
+    PDQ_UNLOCK(sc);
     (*ifp->if_input)(ifp, m);
+    PDQ_LOCK(sc);
 }
 
 void
@@ -228,11 +269,11 @@ pdq_os_restart_transmitter(
     pdq_softc_t *sc = pdq->pdq_os_ctx;
     PDQ_IFNET(sc)->if_drv_flags &= ~IFF_DRV_OACTIVE;
     if (IFQ_IS_EMPTY(&PDQ_IFNET(sc)->if_snd) == 0) {
-	PDQ_IFNET(sc)->if_timer = PDQ_OS_TX_TIMEOUT;
+	sc->timer = PDQ_OS_TX_TIMEOUT;
 	if ((sc->sc_flags & PDQIF_DOWNCALL) == 0)
-	    pdq_ifstart(PDQ_IFNET(sc));
+	    pdq_ifstart_locked(PDQ_IFNET(sc));
     } else {
-	PDQ_IFNET(sc)->if_timer = 0;
+	sc->timer = 0;
     }
 }
 
@@ -305,6 +346,7 @@ pdq_ifmedia_change(
 {
     pdq_softc_t * const sc = PDQ_OS_IFP_TO_SOFTC(ifp);
 
+    PDQ_LOCK(sc);
     if (sc->sc_ifmedia.ifm_media & IFM_FDX) {
 	if ((sc->sc_pdq->pdq_flags & PDQ_WANT_FDX) == 0) {
 	    sc->sc_pdq->pdq_flags |= PDQ_WANT_FDX;
@@ -316,6 +358,7 @@ pdq_ifmedia_change(
 	if (sc->sc_pdq->pdq_flags & PDQ_RUNNING)
 	    pdq_run(sc->sc_pdq);
     }
+    PDQ_UNLOCK(sc);
 
     return 0;
 }
@@ -327,6 +370,7 @@ pdq_ifmedia_status(
 {
     pdq_softc_t * const sc = PDQ_OS_IFP_TO_SOFTC(ifp);
 
+    PDQ_LOCK(sc);
     ifmr->ifm_status = IFM_AVALID;
     if (sc->sc_pdq->pdq_flags & PDQ_IS_ONRING)
 	ifmr->ifm_status |= IFM_ACTIVE;
@@ -334,6 +378,7 @@ pdq_ifmedia_status(
     ifmr->ifm_active = (ifmr->ifm_current & ~IFM_FDX);
     if (sc->sc_pdq->pdq_flags & PDQ_IS_FDX)
 	ifmr->ifm_active |= IFM_FDX;
+    PDQ_UNLOCK(sc);
 }
 
 void
@@ -369,8 +414,6 @@ pdq_ifioctl(
     pdq_softc_t *sc = PDQ_OS_IFP_TO_SOFTC(ifp);
     int error = 0;
 
-    PDQ_LOCK(sc);
-
     switch (cmd) {
 	case SIOCSIFFLAGS: {
 	    pdq_ifinit(sc);
@@ -379,10 +422,12 @@ pdq_ifioctl(
 
 	case SIOCADDMULTI:
 	case SIOCDELMULTI: {
+	    PDQ_LOCK(sc);
 	    if (PDQ_IFNET(sc)->if_drv_flags & IFF_DRV_RUNNING) {
 		    pdq_run(sc->sc_pdq);
 		error = 0;
 	    }
+	    PDQ_UNLOCK(sc);
 	    break;
 	}
 
@@ -401,7 +446,6 @@ pdq_ifioctl(
 	}
     }
 
-    PDQ_UNLOCK(sc);
     return error;
 }
 
@@ -409,25 +453,27 @@ pdq_ifioctl(
 #define	IFF_NOTRAILERS	0
 #endif
 
-void
-pdq_ifattach(pdq_softc_t *sc, const pdq_uint8_t *llc)
+int
+pdq_ifattach(pdq_softc_t *sc, const pdq_uint8_t *llc, pdq_type_t type)
 {
     struct ifnet *ifp;
 
     ifp = PDQ_IFNET(sc) = if_alloc(IFT_FDDI);
-    if (ifp == NULL)
-	panic("%s: can not if_alloc()", device_get_nameunit(sc->dev));
+    if (ifp == NULL) {
+	device_printf(sc->dev, "can not if_alloc()\n");
+	return (ENOSPC);
+    }
 
     mtx_init(&sc->mtx, device_get_nameunit(sc->dev), MTX_NETWORK_LOCK,
-	MTX_DEF | MTX_RECURSE);
+	MTX_DEF);
+    callout_init_mtx(&sc->watchdog, &sc->mtx, 0);
 
+    if_initname(ifp, device_get_name(sc->dev), device_get_unit(sc->dev));
     ifp->if_softc = sc;
-    ifp->if_init = (if_init_f_t *)pdq_ifinit;
+    ifp->if_init = pdq_ifinit;
     ifp->if_snd.ifq_maxlen = IFQ_MAXLEN;
     ifp->if_flags = IFF_BROADCAST|IFF_SIMPLEX|IFF_NOTRAILERS|IFF_MULTICAST;
 
-    ifp->if_watchdog = pdq_ifwatchdog;
-
     ifp->if_ioctl = pdq_ifioctl;
     ifp->if_start = pdq_ifstart;
 
@@ -441,7 +487,15 @@ pdq_ifattach(pdq_softc_t *sc, const pdq_
     }
 #endif
   
+    sc->sc_pdq = pdq_initialize(sc->mem_bst, sc->mem_bsh, ifp->if_xname, -1,
+	sc, type);
+    if (sc->sc_pdq == NULL) {
+	device_printf(sc->dev, "Initialization failed.\n");
+	return (ENXIO);
+    }
+
     fddi_ifattach(ifp, llc, FDDI_BPF_SUPPORTED);
+    return (0);
 }
 
 void
@@ -452,8 +506,10 @@ pdq_ifdetach (pdq_softc_t *sc)
     ifp = sc->ifp;
 
     fddi_ifdetach(ifp, FDDI_BPF_SUPPORTED);
-    if_free(ifp);
-    pdq_stop(sc->sc_pdq);
+    PDQ_LOCK(sc);
+    pdq_ifstop(sc);
+    PDQ_UNLOCK(sc);
+    callout_drain(&sc->watchdog);
     pdq_free(sc->dev);
 
     return;
@@ -474,6 +530,8 @@ pdq_free (device_t dev)
 		bus_teardown_intr(dev, sc->irq, sc->irq_ih);
 	if (sc->irq)
 		bus_release_resource(dev, SYS_RES_IRQ, sc->irq_rid, sc->irq);
+	if (sc->ifp)
+		if_free(sc->ifp);
 
 	/*
 	 * Destroy the mutex.

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 19:35:16 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 27161106566B;
	Thu, 19 Nov 2009 19:35: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 153B18FC08;
	Thu, 19 Nov 2009 19:35:16 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAJJZFpp016642;
	Thu, 19 Nov 2009 19:35:15 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAJJZF8x016639;
	Thu, 19 Nov 2009 19:35:15 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200911191935.nAJJZF8x016639@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 19 Nov 2009 19:35: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: r199543 - head/sys/dev/vge
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 19:35:16 -0000

Author: jhb
Date: Thu Nov 19 19:35:15 2009
New Revision: 199543
URL: http://svn.freebsd.org/changeset/base/199543

Log:
  Several fixes to this driver:
  - Overhaul the locking to avoid recursion and add missing locking in a few
    places.
  - Don't schedule a task to call vge_start() from contexts that are safe to
    call vge_start() directly.  Just invoke the routine directly instead
    (this is what all of the other NIC drivers I am familiar with do).  Note
    that vge(4) does not use an interrupt filter handler which is the primary
    reason some other drivers use tasks.
  - Add a new private timer to drive the watchdog timer instead of using
    if_watchdog and if_timer.
  - Fixup detach by calling ether_ifdetach() before stopping the interface.

Modified:
  head/sys/dev/vge/if_vge.c
  head/sys/dev/vge/if_vgevar.h

Modified: head/sys/dev/vge/if_vge.c
==============================================================================
--- head/sys/dev/vge/if_vge.c	Thu Nov 19 19:25:47 2009	(r199542)
+++ head/sys/dev/vge/if_vge.c	Thu Nov 19 19:35:15 2009	(r199543)
@@ -93,7 +93,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
@@ -160,12 +159,13 @@ static int vge_rxeof		(struct vge_softc 
 static void vge_txeof		(struct vge_softc *);
 static void vge_intr		(void *);
 static void vge_tick		(void *);
-static void vge_tx_task		(void *, int);
 static void vge_start		(struct ifnet *);
+static void vge_start_locked	(struct ifnet *);
 static int vge_ioctl		(struct ifnet *, u_long, caddr_t);
 static void vge_init		(void *);
+static void vge_init_locked	(struct vge_softc *);
 static void vge_stop		(struct vge_softc *);
-static void vge_watchdog	(struct ifnet *);
+static void vge_watchdog	(void *);
 static int vge_suspend		(device_t);
 static int vge_resume		(device_t);
 static int vge_shutdown		(device_t);
@@ -378,7 +378,7 @@ vge_miibus_readreg(dev, phy, reg)
 	if (phy != (CSR_READ_1(sc, VGE_MIICFG) & 0x1F))
 		return(0);
 
-	VGE_LOCK(sc);
+	VGE_LOCK_ASSERT(sc);
 	vge_miipoll_stop(sc);
 
 	/* Specify the register we want to read. */
@@ -400,7 +400,6 @@ vge_miibus_readreg(dev, phy, reg)
 		rval = CSR_READ_2(sc, VGE_MIIDATA);
 
 	vge_miipoll_start(sc);
-	VGE_UNLOCK(sc);
 
 	return (rval);
 }
@@ -418,7 +417,7 @@ vge_miibus_writereg(dev, phy, reg, data)
 	if (phy != (CSR_READ_1(sc, VGE_MIICFG) & 0x1F))
 		return(0);
 
-	VGE_LOCK(sc);
+	VGE_LOCK_ASSERT(sc);
 	vge_miipoll_stop(sc);
 
 	/* Specify the register we want to write. */
@@ -443,7 +442,6 @@ vge_miibus_writereg(dev, phy, reg, data)
 	}
 
 	vge_miipoll_start(sc);
-	VGE_UNLOCK(sc);
 
 	return (rval);
 }
@@ -929,7 +927,9 @@ vge_attach(dev)
 	sc->vge_dev = dev;
 
 	mtx_init(&sc->vge_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
-	    MTX_DEF | MTX_RECURSE);
+	    MTX_DEF);
+	callout_init_mtx(&sc->vge_watchdog, &sc->vge_mtx, 0);
+
 	/*
 	 * Map control/status registers.
 	 */
@@ -1014,14 +1014,11 @@ vge_attach(dev)
 #ifdef DEVICE_POLLING
 	ifp->if_capabilities |= IFCAP_POLLING;
 #endif
-	ifp->if_watchdog = vge_watchdog;
 	ifp->if_init = vge_init;
 	IFQ_SET_MAXLEN(&ifp->if_snd, VGE_IFQ_MAXLEN);
 	ifp->if_snd.ifq_drv_maxlen = VGE_IFQ_MAXLEN;
 	IFQ_SET_READY(&ifp->if_snd);
 
-	TASK_INIT(&sc->vge_txtask, 0, vge_tx_task, ifp);
-
 	/*
 	 * Call MI attach routine.
 	 */
@@ -1070,21 +1067,11 @@ vge_detach(dev)
 
 	/* These should only be active if attach succeeded */
 	if (device_is_attached(dev)) {
-		vge_stop(sc);
-		/*
-		 * Force off the IFF_UP flag here, in case someone
-		 * still had a BPF descriptor attached to this
-		 * interface. If they do, ether_ifattach() will cause
-		 * the BPF code to try and clear the promisc mode
-		 * flag, which will bubble down to vge_ioctl(),
-		 * which will try to call vge_init() again. This will
-		 * turn the NIC back on and restart the MII ticker,
-		 * which will panic the system when the kernel tries
-		 * to invoke the vge_tick() function that isn't there
-		 * anymore.
-		 */
-		ifp->if_flags &= ~IFF_UP;
 		ether_ifdetach(ifp);
+		VGE_LOCK(sc);
+		vge_stop(sc);
+		VGE_UNLOCK(sc);
+		callout_drain(&sc->vge_watchdog);
 	}
 	if (sc->vge_miibus)
 		device_delete_child(dev, sc->vge_miibus);
@@ -1523,7 +1510,7 @@ vge_txeof(sc)
 	if (idx != sc->vge_ldata.vge_tx_considx) {
 		sc->vge_ldata.vge_tx_considx = idx;
 		ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
-		ifp->if_timer = 0;
+		sc->vge_timer = 0;
 	}
 
 	/*
@@ -1549,7 +1536,7 @@ vge_tick(xsc)
 
 	sc = xsc;
 	ifp = sc->vge_ifp;
-	VGE_LOCK(sc);
+	VGE_LOCK_ASSERT(sc);
 	mii = device_get_softc(sc->vge_miibus);
 
 	mii_tick(mii);
@@ -1566,13 +1553,10 @@ vge_tick(xsc)
 			if_link_state_change(sc->vge_ifp,
 			    LINK_STATE_UP);
 			if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
-				taskqueue_enqueue(taskqueue_swi,
-				    &sc->vge_txtask);
+				vge_start_locked(ifp);
 		}
 	}
 
-	VGE_UNLOCK(sc);
-
 	return;
 }
 
@@ -1592,7 +1576,7 @@ vge_poll (struct ifnet *ifp, enum poll_c
 	vge_txeof(sc);
 
 	if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
-		taskqueue_enqueue(taskqueue_swi, &sc->vge_txtask);
+		vge_start_locked(ifp);
 
 	if (cmd == POLL_AND_CHECK_STATUS) { /* also check status register */
 		u_int32_t       status;
@@ -1608,7 +1592,7 @@ vge_poll (struct ifnet *ifp, enum poll_c
 
 		if (status & VGE_ISR_TXDMA_STALL ||
 		    status & VGE_ISR_RXDMA_STALL)
-			vge_init(sc);
+			vge_init_locked(sc);
 
 		if (status & (VGE_ISR_RXOFLOW|VGE_ISR_RXNODESC)) {
 			vge_rxeof(sc);
@@ -1681,7 +1665,7 @@ vge_intr(arg)
 			vge_txeof(sc);
 
 		if (status & (VGE_ISR_TXDMA_STALL|VGE_ISR_RXDMA_STALL))
-			vge_init(sc);
+			vge_init_locked(sc);
 
 		if (status & VGE_ISR_LINKSTS)
 			vge_tick(sc);
@@ -1690,10 +1674,10 @@ vge_intr(arg)
 	/* Re-enable interrupts */
 	CSR_WRITE_1(sc, VGE_CRS3, VGE_CR3_INT_GMSK);
 
-	VGE_UNLOCK(sc);
-
 	if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
-		taskqueue_enqueue(taskqueue_swi, &sc->vge_txtask);
+		vge_start_locked(ifp);
+
+	VGE_UNLOCK(sc);
 
 	return;
 }
@@ -1774,19 +1758,6 @@ vge_encap(sc, m_head, idx)
 	return (0);
 }
 
-static void
-vge_tx_task(arg, npending)
-	void			*arg;
-	int			npending;
-{
-	struct ifnet		*ifp;
-
-	ifp = arg;
-	vge_start(ifp);
-
-	return;
-}
-
 /*
  * Main transmit routine.
  */
@@ -1796,21 +1767,29 @@ vge_start(ifp)
 	struct ifnet		*ifp;
 {
 	struct vge_softc	*sc;
+
+	sc = ifp->if_softc;
+	VGE_LOCK(sc);
+	vge_start_locked(ifp);
+	VGE_UNLOCK(sc);
+}
+
+static void
+vge_start_locked(ifp)
+	struct ifnet		*ifp;
+{
+	struct vge_softc	*sc;
 	struct mbuf		*m_head = NULL;
 	int			idx, pidx = 0;
 
 	sc = ifp->if_softc;
-	VGE_LOCK(sc);
+	VGE_LOCK_ASSERT(sc);
 
-	if (!sc->vge_link || ifp->if_drv_flags & IFF_DRV_OACTIVE) {
-		VGE_UNLOCK(sc);
+	if (!sc->vge_link || ifp->if_drv_flags & IFF_DRV_OACTIVE)
 		return;
-	}
 
-	if (IFQ_DRV_IS_EMPTY(&ifp->if_snd)) {
-		VGE_UNLOCK(sc);
+	if (IFQ_DRV_IS_EMPTY(&ifp->if_snd))
 		return;
-	}
 
 	idx = sc->vge_ldata.vge_tx_prodidx;
 
@@ -1843,10 +1822,8 @@ vge_start(ifp)
 		ETHER_BPF_MTAP(ifp, m_head);
 	}
 
-	if (idx == sc->vge_ldata.vge_tx_prodidx) {
-		VGE_UNLOCK(sc);
+	if (idx == sc->vge_ldata.vge_tx_prodidx)
 		return;
-	}
 
 	/* Flush the TX descriptors */
 
@@ -1870,12 +1847,10 @@ vge_start(ifp)
 	 */
 	CSR_WRITE_1(sc, VGE_CRS1, VGE_CR1_TIMER0_ENABLE);
 
-	VGE_UNLOCK(sc);
-
 	/*
 	 * Set a timeout in case the chip goes out to lunch.
 	 */
-	ifp->if_timer = 5;
+	sc->vge_timer = 5;
 
 	return;
 }
@@ -1885,11 +1860,20 @@ vge_init(xsc)
 	void			*xsc;
 {
 	struct vge_softc	*sc = xsc;
+
+	VGE_LOCK(sc);
+	vge_init_locked(sc);
+	VGE_UNLOCK(sc);
+}
+
+static void
+vge_init_locked(struct vge_softc *sc)
+{
 	struct ifnet		*ifp = sc->vge_ifp;
 	struct mii_data		*mii;
 	int			i;
 
-	VGE_LOCK(sc);
+	VGE_LOCK_ASSERT(sc);
 	mii = device_get_softc(sc->vge_miibus);
 
 	/*
@@ -2045,12 +2029,11 @@ vge_init(xsc)
 
 	ifp->if_drv_flags |= IFF_DRV_RUNNING;
 	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
+	callout_reset(&sc->vge_watchdog, hz, vge_watchdog, sc);
 
 	sc->vge_if_flags = 0;
 	sc->vge_link = 0;
 
-	VGE_UNLOCK(sc);
-
 	return;
 }
 
@@ -2087,7 +2070,9 @@ vge_ifmedia_sts(ifp, ifmr)
 	sc = ifp->if_softc;
 	mii = device_get_softc(sc->vge_miibus);
 
+	VGE_LOCK(sc);
 	mii_pollstat(mii);
+	VGE_UNLOCK(sc);
 	ifmr->ifm_active = mii->mii_media_active;
 	ifmr->ifm_status = mii->mii_media_status;
 
@@ -2162,6 +2147,7 @@ vge_ioctl(ifp, command, data)
 		ifp->if_mtu = ifr->ifr_mtu;
 		break;
 	case SIOCSIFFLAGS:
+		VGE_LOCK(sc);
 		if (ifp->if_flags & IFF_UP) {
 			if (ifp->if_drv_flags & IFF_DRV_RUNNING &&
 			    ifp->if_flags & IFF_PROMISC &&
@@ -2176,16 +2162,19 @@ vge_ioctl(ifp, command, data)
 				    VGE_RXCTL_RX_PROMISC);
 				vge_setmulti(sc);
                         } else
-				vge_init(sc);
+				vge_init_locked(sc);
 		} else {
 			if (ifp->if_drv_flags & IFF_DRV_RUNNING)
 				vge_stop(sc);
 		}
 		sc->vge_if_flags = ifp->if_flags;
+		VGE_UNLOCK(sc);
 		break;
 	case SIOCADDMULTI:
 	case SIOCDELMULTI:
+		VGE_LOCK(sc);
 		vge_setmulti(sc);
+		VGE_UNLOCK(sc);
 		break;
 	case SIOCGIFMEDIA:
 	case SIOCSIFMEDIA:
@@ -2219,6 +2208,7 @@ vge_ioctl(ifp, command, data)
 			}
 		}
 #endif /* DEVICE_POLLING */
+		VGE_LOCK(sc);
 		if ((mask & IFCAP_TXCSUM) != 0 &&
 		    (ifp->if_capabilities & IFCAP_TXCSUM) != 0) {
 			ifp->if_capenable ^= IFCAP_TXCSUM;
@@ -2230,6 +2220,7 @@ vge_ioctl(ifp, command, data)
 		if ((mask & IFCAP_RXCSUM) != 0 &&
 		    (ifp->if_capabilities & IFCAP_RXCSUM) != 0)
 			ifp->if_capenable ^= IFCAP_RXCSUM;
+		VGE_UNLOCK(sc);
 	    }
 		break;
 	default:
@@ -2241,22 +2232,25 @@ vge_ioctl(ifp, command, data)
 }
 
 static void
-vge_watchdog(ifp)
-	struct ifnet		*ifp;
+vge_watchdog(void *arg)
 {
-	struct vge_softc		*sc;
+	struct vge_softc *sc;
+	struct ifnet *ifp;
 
-	sc = ifp->if_softc;
-	VGE_LOCK(sc);
+	sc = arg;
+	VGE_LOCK_ASSERT(sc);
+	callout_reset(&sc->vge_watchdog, hz, vge_watchdog, sc);
+	if (sc->vge_timer == 0 || --sc->vge_timer > 0)
+		return;
+
+	ifp = sc->vge_ifp;
 	if_printf(ifp, "watchdog timeout\n");
 	ifp->if_oerrors++;
 
 	vge_txeof(sc);
 	vge_rxeof(sc);
 
-	vge_init(sc);
-
-	VGE_UNLOCK(sc);
+	vge_init_locked(sc);
 
 	return;
 }
@@ -2272,9 +2266,10 @@ vge_stop(sc)
 	register int		i;
 	struct ifnet		*ifp;
 
-	VGE_LOCK(sc);
+	VGE_LOCK_ASSERT(sc);
 	ifp = sc->vge_ifp;
-	ifp->if_timer = 0;
+	sc->vge_timer = 0;
+	callout_stop(&sc->vge_watchdog);
 
 	ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
 
@@ -2312,8 +2307,6 @@ vge_stop(sc)
 		}
 	}
 
-	VGE_UNLOCK(sc);
-
 	return;
 }
 
@@ -2330,9 +2323,11 @@ vge_suspend(dev)
 
 	sc = device_get_softc(dev);
 
+	VGE_LOCK(sc);
 	vge_stop(sc);
 
 	sc->suspended = 1;
+	VGE_UNLOCK(sc);
 
 	return (0);
 }
@@ -2357,10 +2352,12 @@ vge_resume(dev)
 	pci_enable_io(dev, SYS_RES_MEMORY);
 
 	/* reinitialize interface if necessary */
+	VGE_LOCK(sc);
 	if (ifp->if_flags & IFF_UP)
-		vge_init(sc);
+		vge_init_locked(sc);
 
 	sc->suspended = 0;
+	VGE_UNLOCK(sc);
 
 	return (0);
 }
@@ -2377,7 +2374,9 @@ vge_shutdown(dev)
 
 	sc = device_get_softc(dev);
 
+	VGE_LOCK(sc);
 	vge_stop(sc);
+	VGE_UNLOCK(sc);
 
 	return (0);
 }

Modified: head/sys/dev/vge/if_vgevar.h
==============================================================================
--- head/sys/dev/vge/if_vgevar.h	Thu Nov 19 19:25:47 2009	(r199542)
+++ head/sys/dev/vge/if_vgevar.h	Thu Nov 19 19:35:15 2009	(r199543)
@@ -111,8 +111,9 @@ struct vge_softc {
 	int			vge_rx_consumed;
 	int			vge_link;
 	int			vge_camidx;
-	struct task		vge_txtask;
 	struct mtx		vge_mtx;
+	struct callout		vge_watchdog;
+	int			vge_timer;
 	struct mbuf		*vge_head;
 	struct mbuf		*vge_tail;
 

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 20:57:36 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 44DB6106566B;
	Thu, 19 Nov 2009 20:57: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 3192A8FC14;
	Thu, 19 Nov 2009 20:57:36 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAJKva1b019071;
	Thu, 19 Nov 2009 20:57:36 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAJKvawI019067;
	Thu, 19 Nov 2009 20:57:36 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200911192057.nAJKvawI019067@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Thu, 19 Nov 2009 20:57: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: r199548 - head/sys/dev/et
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 20:57:36 -0000

Author: yongari
Date: Thu Nov 19 20:57:35 2009
New Revision: 199548
URL: http://svn.freebsd.org/changeset/base/199548

Log:
  Remove complex macros that were used to compute bits values.
  Although these macros may have its own strength, its complex
  definition make hard to read the code.
  
  Approved by:	delphij

Modified:
  head/sys/dev/et/if_et.c
  head/sys/dev/et/if_etreg.h
  head/sys/dev/et/if_etvar.h

Modified: head/sys/dev/et/if_et.c
==============================================================================
--- head/sys/dev/et/if_et.c	Thu Nov 19 20:41:36 2009	(r199547)
+++ head/sys/dev/et/if_et.c	Thu Nov 19 20:57:35 2009	(r199548)
@@ -404,8 +404,8 @@ et_miibus_readreg(device_t dev, int phy,
 	/* Stop any pending operations */
 	CSR_WRITE_4(sc, ET_MII_CMD, 0);
 
-	val = __SHIFTIN(phy, ET_MII_ADDR_PHY) |
-	      __SHIFTIN(reg, ET_MII_ADDR_REG);
+	val = (phy << ET_MII_ADDR_PHY_SHIFT) & ET_MII_ADDR_PHY_MASK;
+	val |= (reg << ET_MII_ADDR_REG_SHIFT) & ET_MII_ADDR_REG_MASK;
 	CSR_WRITE_4(sc, ET_MII_ADDR, val);
 
 	/* Start reading */
@@ -429,7 +429,7 @@ et_miibus_readreg(device_t dev, int phy,
 #undef NRETRY
 
 	val = CSR_READ_4(sc, ET_MII_STAT);
-	ret = __SHIFTOUT(val, ET_MII_STAT_VALUE);
+	ret = val & ET_MII_STAT_VALUE_MASK;
 
 back:
 	/* Make sure that the current operation is stopped */
@@ -447,12 +447,13 @@ et_miibus_writereg(device_t dev, int phy
 	/* Stop any pending operations */
 	CSR_WRITE_4(sc, ET_MII_CMD, 0);
 
-	val = __SHIFTIN(phy, ET_MII_ADDR_PHY) |
-	      __SHIFTIN(reg, ET_MII_ADDR_REG);
+	val = (phy << ET_MII_ADDR_PHY_SHIFT) & ET_MII_ADDR_PHY_MASK;
+	val |= (reg << ET_MII_ADDR_REG_SHIFT) & ET_MII_ADDR_REG_MASK;
 	CSR_WRITE_4(sc, ET_MII_ADDR, val);
 
 	/* Start writing */
-	CSR_WRITE_4(sc, ET_MII_CTRL, __SHIFTIN(val0, ET_MII_CTRL_VALUE));
+	CSR_WRITE_4(sc, ET_MII_CTRL,
+	    (val0 << ET_MII_CTRL_VALUE_SHIFT) & ET_MII_CTRL_VALUE_MASK);
 
 #define NRETRY 100
 
@@ -601,8 +602,13 @@ et_bus_config(device_t dev)
 	/*
 	 * Set L0s and L1 latency timer to 2us
 	 */
-	val = ET_PCIV_L0S_LATENCY(2) | ET_PCIV_L1_LATENCY(2);
-	pci_write_config(dev, ET_PCIR_L0S_L1_LATENCY, val, 1);
+	val = pci_read_config(dev, ET_PCIR_L0S_L1_LATENCY, 4);
+	val &= ~(PCIM_LINK_CAP_L0S_EXIT | PCIM_LINK_CAP_L1_EXIT);
+	/* L0s exit latency : 2us */
+	val |= 0x00005000;
+	/* L1 exit latency : 2us */
+	val |= 0x00028000;
+	pci_write_config(dev, ET_PCIR_L0S_L1_LATENCY, val, 4);
 
 	/*
 	 * Set max read request size to 2048 bytes
@@ -1021,10 +1027,10 @@ et_chip_attach(struct et_softc *sc)
 	/*
 	 * Setup half duplex mode
 	 */
-	val = __SHIFTIN(10, ET_MAC_HDX_ALT_BEB_TRUNC) |
-	      __SHIFTIN(15, ET_MAC_HDX_REXMIT_MAX) |
-	      __SHIFTIN(55, ET_MAC_HDX_COLLWIN) |
-	      ET_MAC_HDX_EXC_DEFER;
+	val = (10 << ET_MAC_HDX_ALT_BEB_TRUNC_SHIFT) |
+	    (15 << ET_MAC_HDX_REXMIT_MAX_SHIFT) |
+	    (55 << ET_MAC_HDX_COLLWIN_SHIFT) |
+	    ET_MAC_HDX_EXC_DEFER;
 	CSR_WRITE_4(sc, ET_MAC_HDX, val);
 
 	/* Clear MAC control */
@@ -1655,19 +1661,19 @@ et_init_mac(struct et_softc *sc)
 	/*
 	 * Setup inter packet gap
 	 */
-	val = __SHIFTIN(56, ET_IPG_NONB2B_1) |
-	      __SHIFTIN(88, ET_IPG_NONB2B_2) |
-	      __SHIFTIN(80, ET_IPG_MINIFG) |
-	      __SHIFTIN(96, ET_IPG_B2B);
+	val = (56 << ET_IPG_NONB2B_1_SHIFT) |
+	    (88 << ET_IPG_NONB2B_2_SHIFT) |
+	    (80 << ET_IPG_MINIFG_SHIFT) |
+	    (96 << ET_IPG_B2B_SHIFT);
 	CSR_WRITE_4(sc, ET_IPG, val);
 
 	/*
 	 * Setup half duplex mode
 	 */
-	val = __SHIFTIN(10, ET_MAC_HDX_ALT_BEB_TRUNC) |
-	      __SHIFTIN(15, ET_MAC_HDX_REXMIT_MAX) |
-	      __SHIFTIN(55, ET_MAC_HDX_COLLWIN) |
-	      ET_MAC_HDX_EXC_DEFER;
+	val = (10 << ET_MAC_HDX_ALT_BEB_TRUNC_SHIFT) |
+	    (15 << ET_MAC_HDX_REXMIT_MAX_SHIFT) |
+	    (55 << ET_MAC_HDX_COLLWIN_SHIFT) |
+	    ET_MAC_HDX_EXC_DEFER;
 	CSR_WRITE_4(sc, ET_MAC_HDX, val);
 
 	/* Clear MAC control */
@@ -1738,7 +1744,7 @@ et_init_rxmac(struct et_softc *sc)
 		 * since this is the size of the PCI-Express TLP's
 		 * that the ET1310 uses.
 		 */
-		val = __SHIFTIN(ET_RXMAC_SEGSZ(256), ET_RXMAC_MC_SEGSZ_MAX) |
+		val = (ET_RXMAC_SEGSZ(256) & ET_RXMAC_MC_SEGSZ_MAX_MASK) |
 		      ET_RXMAC_MC_SEGSZ_ENABLE;
 	} else {
 		val = 0;
@@ -1761,7 +1767,9 @@ et_init_rxmac(struct et_softc *sc)
 	/*
 	 * Configure runt filtering (may not work on certain chip generation)
 	 */
-	val = __SHIFTIN(ETHER_MIN_LEN, ET_PKTFILT_MINLEN) | ET_PKTFILT_FRAG;
+	val = (ETHER_MIN_LEN << ET_PKTFILT_MINLEN_SHIFT) &
+	    ET_PKTFILT_MINLEN_MASK;
+	val |= ET_PKTFILT_FRAG;
 	CSR_WRITE_4(sc, ET_PKTFILT, val);
 
 	/* Enable RX MAC but leave WOL disabled */
@@ -1793,11 +1801,9 @@ et_start_rxdma(struct et_softc *sc)
 {
 	uint32_t val = 0;
 
-	val |= __SHIFTIN(sc->sc_rx_data[0].rbd_bufsize,
-			 ET_RXDMA_CTRL_RING0_SIZE) |
+	val |= (sc->sc_rx_data[0].rbd_bufsize & ET_RXDMA_CTRL_RING0_SIZE_MASK) |
 	       ET_RXDMA_CTRL_RING0_ENABLE;
-	val |= __SHIFTIN(sc->sc_rx_data[1].rbd_bufsize,
-			 ET_RXDMA_CTRL_RING1_SIZE) |
+	val |= (sc->sc_rx_data[1].rbd_bufsize & ET_RXDMA_CTRL_RING1_SIZE_MASK) |
 	       ET_RXDMA_CTRL_RING1_ENABLE;
 
 	CSR_WRITE_4(sc, ET_RXDMA_CTRL, val);
@@ -1892,7 +1898,8 @@ et_rxeof(struct et_softc *sc)
 
 	rxs_stat_ring = rxsd->rxsd_status->rxs_stat_ring;
 	rxst_wrap = (rxs_stat_ring & ET_RXS_STATRING_WRAP) ? 1 : 0;
-	rxst_index = __SHIFTOUT(rxs_stat_ring, ET_RXS_STATRING_INDEX);
+	rxst_index = (rxs_stat_ring & ET_RXS_STATRING_INDEX_MASK) >>
+	    ET_RXS_STATRING_INDEX_SHIFT;
 
 	while (rxst_index != rxst_ring->rsr_index ||
 	       rxst_wrap != rxst_ring->rsr_wrap) {
@@ -1906,16 +1913,18 @@ et_rxeof(struct et_softc *sc)
 		MPASS(rxst_ring->rsr_index < ET_RX_NSTAT);
 		st = &rxst_ring->rsr_stat[rxst_ring->rsr_index];
 
-		buflen = __SHIFTOUT(st->rxst_info2, ET_RXST_INFO2_LEN);
-		buf_idx = __SHIFTOUT(st->rxst_info2, ET_RXST_INFO2_BUFIDX);
-		ring_idx = __SHIFTOUT(st->rxst_info2, ET_RXST_INFO2_RINGIDX);
+		buflen = (st->rxst_info2 & ET_RXST_INFO2_LEN_MASK) >>
+		    ET_RXST_INFO2_LEN_SHIFT;
+		buf_idx = (st->rxst_info2 & ET_RXST_INFO2_BUFIDX_MASK) >>
+		    ET_RXST_INFO2_BUFIDX_SHIFT;
+		ring_idx = (st->rxst_info2 & ET_RXST_INFO2_RINGIDX_MASK) >>
+		    ET_RXST_INFO2_RINGIDX_SHIFT;
 
 		if (++rxst_ring->rsr_index == ET_RX_NSTAT) {
 			rxst_ring->rsr_index = 0;
 			rxst_ring->rsr_wrap ^= 1;
 		}
-		rxstat_pos = __SHIFTIN(rxst_ring->rsr_index,
-				       ET_RXSTAT_POS_INDEX);
+		rxstat_pos = rxst_ring->rsr_index & ET_RXSTAT_POS_INDEX_MASK;
 		if (rxst_ring->rsr_wrap)
 			rxstat_pos |= ET_RXSTAT_POS_WRAP;
 		CSR_WRITE_4(sc, ET_RXSTAT_POS, rxstat_pos);
@@ -1968,7 +1977,7 @@ et_rxeof(struct et_softc *sc)
 			rx_ring->rr_index = 0;
 			rx_ring->rr_wrap ^= 1;
 		}
-		rxring_pos = __SHIFTIN(rx_ring->rr_index, ET_RX_RING_POS_INDEX);
+		rxring_pos = rx_ring->rr_index & ET_RX_RING_POS_INDEX_MASK;
 		if (rx_ring->rr_wrap)
 			rxring_pos |= ET_RX_RING_POS_WRAP;
 		CSR_WRITE_4(sc, rx_ring->rr_posreg, rxring_pos);
@@ -2056,7 +2065,7 @@ et_encap(struct et_softc *sc, struct mbu
 		td = &tx_ring->tr_desc[idx];
 		td->td_addr_hi = ET_ADDR_HI(segs[i].ds_addr);
 		td->td_addr_lo = ET_ADDR_LO(segs[i].ds_addr);
-		td->td_ctrl1 = __SHIFTIN(segs[i].ds_len, ET_TDCTRL1_LEN);
+		td->td_ctrl1 =  segs[i].ds_len & ET_TDCTRL1_LEN_MASK;
 
 		if (i == ctx.nsegs - 1) {	/* Last frag */
 			td->td_ctrl2 = last_td_ctrl2;
@@ -2083,8 +2092,7 @@ et_encap(struct et_softc *sc, struct mbu
 	bus_dmamap_sync(tx_ring->tr_dtag, tx_ring->tr_dmap,
 			BUS_DMASYNC_PREWRITE);
 
-	tx_ready_pos = __SHIFTIN(tx_ring->tr_ready_index,
-		       ET_TX_READY_POS_INDEX);
+	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);
@@ -2119,7 +2127,7 @@ et_txeof(struct et_softc *sc)
 		return;
 
 	tx_done = CSR_READ_4(sc, ET_TX_DONE_POS);
-	end = __SHIFTOUT(tx_done, ET_TX_DONE_POS_INDEX);
+	end = tx_done & ET_TX_DONE_POS_INDEX_MASK;
 	wrap = (tx_done & ET_TX_DONE_POS_WRAP) ? 1 : 0;
 
 	while (tbd->tbd_start_index != end || tbd->tbd_start_wrap != wrap) {
@@ -2352,7 +2360,8 @@ et_setmedia(struct et_softc *sc)
 	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 |
-		__SHIFTIN(7, ET_MAC_CFG2_PREAMBLE_LEN);
+	    ((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);
@@ -2384,7 +2393,7 @@ et_setup_rxdesc(struct et_rxbuf_data *rb
 
 	desc->rd_addr_hi = ET_ADDR_HI(paddr);
 	desc->rd_addr_lo = ET_ADDR_LO(paddr);
-	desc->rd_ctrl = __SHIFTIN(buf_idx, ET_RDCTRL_BUFIDX);
+	desc->rd_ctrl = buf_idx & ET_RDCTRL_BUFIDX_MASK;
 
 	bus_dmamap_sync(rx_ring->rr_dtag, rx_ring->rr_dmap,
 			BUS_DMASYNC_PREWRITE);

Modified: head/sys/dev/et/if_etreg.h
==============================================================================
--- head/sys/dev/et/if_etreg.h	Thu Nov 19 20:41:36 2009	(r199547)
+++ head/sys/dev/et/if_etreg.h	Thu Nov 19 20:57:35 2009	(r199548)
@@ -73,50 +73,6 @@
 #ifndef _IF_ETREG_H
 #define _IF_ETREG_H
 
-/*
- * __BIT(n): Return a bitmask with bit n set, where the least
- *           significant bit is bit 0.
- *
- * __BITS(m, n): Return a bitmask with bits m through n, inclusive,
- *               set.  It does not matter whether m>n or m<=n.  The
- *               least significant bit is bit 0.
- *
- * A "bitfield" is a span of consecutive bits defined by a bitmask,
- * where 1s select the bits in the bitfield.  __SHIFTIN, __SHIFTOUT,
- * and __SHIFTOUT_MASK help read and write bitfields from device
- * registers.
- *
- * __SHIFTIN(v, mask): Left-shift bits `v' into the bitfield
- *                     defined by `mask', and return them.  No
- *                     side-effects.
- *
- * __SHIFTOUT(v, mask): Extract and return the bitfield selected
- *                      by `mask' from `v', right-shifting the
- *                      bits so that the rightmost selected bit
- *                      is at bit 0.  No side-effects.
- *
- * __SHIFTOUT_MASK(mask): Right-shift the bits in `mask' so that
- *                        the rightmost non-zero bit is at bit
- *                        0.  This is useful for finding the
- *                        greatest unsigned value that a bitfield
- *                        can hold.  No side-effects.  Note that
- *                        __SHIFTOUT_MASK(m) = __SHIFTOUT(m, m).
- */
-
-/* __BIT(n): nth bit, where __BIT(0) == 0x1. */
-#define	__BIT(__n) (((__n) == 32) ? 0 : ((uint32_t)1 << (__n)))
-
-/* __BITS(m, n): bits m through n, m < n. */
-#define	__BITS(__m, __n)	\
-	((__BIT(MAX((__m), (__n)) + 1) - 1) ^ (__BIT(MIN((__m), (__n))) - 1))
-
-/* Find least significant bit that is set */
-#define	__LOWEST_SET_BIT(__mask) ((((__mask) - 1) & (__mask)) ^ (__mask))
-
-#define	__SHIFTOUT(__x, __mask) (((__x) & (__mask)) / __LOWEST_SET_BIT(__mask))
-#define	__SHIFTIN(__x, __mask) ((__x) * __LOWEST_SET_BIT(__mask))
-#define	__SHIFTOUT_MASK(__mask) __SHIFTOUT((__mask), (__mask))
-
 #define ET_MEM_TXSIZE_EX		182
 #define ET_MEM_RXSIZE_MIN		608
 #define ET_MEM_RXSIZE_DEFAULT		11216
@@ -159,10 +115,6 @@
 #define ET_PCIV_REPLAY_TIMER_256	(1248 + ET_REPLAY_TIMER_RX_L0S_ADJ)
 
 #define ET_PCIR_L0S_L1_LATENCY		0xcf
-#define ET_PCIM_L0S_LATENCY		__BITS(2, 0)
-#define ET_PCIM_L1_LATENCY		__BITS(5, 3)
-#define ET_PCIV_L0S_LATENCY(l)		__SHIFTIN((l) - 1, ET_PCIM_L0S_LATENCY)
-#define ET_PCIV_L1_LATENCY(l)		__SHIFTIN((l) - 1, ET_PCIM_L1_LATENCY)
 
 /*
  * CSR
@@ -176,22 +128,22 @@
 #define ET_QUEUE_ADDR_END		ET_QUEUE_ADDR(ET_MEM_SIZE)
 
 #define ET_PM				0x0010
-#define ET_PM_SYSCLK_GATE		__BIT(3)
-#define ET_PM_TXCLK_GATE		__BIT(4)
-#define ET_PM_RXCLK_GATE		__BIT(5)
+#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			__BIT(0)
-#define ET_SWRST_RXDMA			__BIT(1)
-#define ET_SWRST_TXMAC			__BIT(2)
-#define ET_SWRST_RXMAC			__BIT(3)
-#define ET_SWRST_MAC			__BIT(4)
-#define ET_SWRST_MAC_STAT		__BIT(5)
-#define ET_SWRST_MMC			__BIT(6)
-#define ET_SWRST_SELFCLR_DISABLE	__BIT(31)
+#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
 
@@ -200,9 +152,9 @@
 #define ET_TIMER			0x0038
 
 #define ET_TXDMA_CTRL			0x1000
-#define ET_TXDMA_CTRL_HALT		__BIT(0)
-#define ET_TXDMA_CTRL_CACHE_THR		__BITS(7, 4)
-#define ET_TXDMA_CTRL_SINGLE_EPKT	__BIT(8)	/* ??? */
+#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
@@ -212,28 +164,28 @@
 #define ET_TX_STATUS_LO			0x1020
 
 #define ET_TX_READY_POS			0x1024
-#define ET_TX_READY_POS_INDEX		__BITS(9, 0)
-#define ET_TX_READY_POS_WRAP		__BIT(10)
+#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		__BITS(9, 0)
-#define ET_TX_DONE_POS_WRAP		__BIT(10)
+#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		__BIT(0)
-#define ET_RXDMA_CTRL_RING0_SIZE	__BITS(9, 8)
-#define ET_RXDMA_CTRL_RING0_128		0		/* 127 */
-#define ET_RXDMA_CTRL_RING0_256		1		/* 255 */
-#define ET_RXDMA_CTRL_RING0_512		2		/* 511 */
-#define ET_RXDMA_CTRL_RING0_1024	3		/* 1023 */
-#define ET_RXDMA_CTRL_RING0_ENABLE	__BIT(10)
-#define ET_RXDMA_CTRL_RING1_SIZE	__BITS(12, 11)
-#define ET_RXDMA_CTRL_RING1_2048	0		/* 2047 */
-#define ET_RXDMA_CTRL_RING1_4096	1		/* 4095 */
-#define ET_RXDMA_CTRL_RING1_8192	2		/* 8191 */
-#define ET_RXDMA_CTRL_RING1_16384	3		/* 16383 (9022?) */
-#define ET_RXDMA_CTRL_RING1_ENABLE	__BIT(13)
-#define ET_RXDMA_CTRL_HALTED		__BIT(17)
+#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
@@ -246,8 +198,8 @@
 #define ET_RXSTAT_CNT			0x2028
 
 #define ET_RXSTAT_POS			0x2030
-#define ET_RXSTAT_POS_INDEX		__BITS(11, 0)
-#define ET_RXSTAT_POS_WRAP		__BIT(12)
+#define ET_RXSTAT_POS_INDEX_MASK	0x00000FFF
+#define ET_RXSTAT_POS_WRAP		0x00001000
 
 #define ET_RXSTAT_MINCNT		0x2038
 
@@ -256,8 +208,8 @@
 #define ET_RX_RING0_CNT			0x2044
 
 #define ET_RX_RING0_POS			0x204c
-#define ET_RX_RING0_POS_INDEX		__BITS(9, 0)
-#define ET_RX_RING0_POS_WRAP		__BIT(10)
+#define ET_RX_RING0_POS_INDEX_MASK	0x000003FF
+#define ET_RX_RING0_POS_WRAP		0x00000400
 
 #define ET_RX_RING0_MINCNT		0x2054
 
@@ -266,21 +218,21 @@
 #define ET_RX_RING1_CNT			0x2060
 
 #define ET_RX_RING1_POS			0x2068
-#define ET_RX_RING1_POS_INDEX		__BITS(9, 0)
-#define ET_RX_RING1_POS_WRAP		__BIT(10)
+#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		__BIT(0)
-#define ET_TXMAC_CTRL_FC_DISABLE	__BIT(3)
+#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		__BIT(0)
-#define ET_RXMAC_CTRL_NO_PKTFILT	__BIT(2)
-#define ET_RXMAC_CTRL_WOL_DISABLE	__BIT(3)
+#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
@@ -294,16 +246,17 @@
 #define ET_MULTI_HASH			0x4074
 
 #define ET_PKTFILT			0x4084
-#define ET_PKTFILT_BCAST		__BIT(0)
-#define ET_PKTFILT_MCAST		__BIT(1)
-#define ET_PKTFILT_UCAST		__BIT(2)
-#define ET_PKTFILT_FRAG			__BIT(3)
-#define ET_PKTFILT_MINLEN		__BITS(22, 16)
+#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	__BIT(0)
-#define ET_RXMAC_MC_SEGSZ_FC		__BIT(1)
-#define ET_RXMAC_MC_SEGSZ_MAX		__BITS(9, 2)
+#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
 
@@ -311,110 +264,121 @@
 #define ET_RXMAC_SPACE_AVL		0x4094
 
 #define ET_RXMAC_MGT			0x4098
-#define ET_RXMAC_MGT_PASS_ECRC		__BIT(4)
-#define ET_RXMAC_MGT_PASS_ELEN		__BIT(5)
-#define ET_RXMAC_MGT_PASS_ETRUNC	__BIT(16)
-#define ET_RXMAC_MGT_CHECK_PKT		__BIT(17)
+#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		__BIT(0)
-#define ET_MAC_CFG1_SYNC_TXEN		__BIT(1)
-#define ET_MAC_CFG1_RXEN		__BIT(2)
-#define ET_MAC_CFG1_SYNC_RXEN		__BIT(3)
-#define ET_MAC_CFG1_TXFLOW		__BIT(4)
-#define ET_MAC_CFG1_RXFLOW		__BIT(5)
-#define ET_MAC_CFG1_LOOPBACK		__BIT(8)
-#define ET_MAC_CFG1_RST_TXFUNC		__BIT(16)
-#define ET_MAC_CFG1_RST_RXFUNC		__BIT(17)
-#define ET_MAC_CFG1_RST_TXMC		__BIT(18)
-#define ET_MAC_CFG1_RST_RXMC		__BIT(19)
-#define ET_MAC_CFG1_SIM_RST		__BIT(30)
-#define ET_MAC_CFG1_SOFT_RST		__BIT(31)
+#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			__BIT(0)
-#define ET_MAC_CFG2_CRC			__BIT(1)
-#define ET_MAC_CFG2_PADCRC		__BIT(2)
-#define ET_MAC_CFG2_LENCHK		__BIT(4)
-#define ET_MAC_CFG2_BIGFRM		__BIT(5)
-#define ET_MAC_CFG2_MODE_MII		__BIT(8)
-#define ET_MAC_CFG2_MODE_GMII		__BIT(9)
-#define ET_MAC_CFG2_PREAMBLE_LEN	__BITS(15, 12)
+#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			__BITS(6, 0)
-#define ET_IPG_MINIFG			__BITS(15, 8)
-#define ET_IPG_NONB2B_2			__BITS(22, 16)
-#define ET_IPG_NONB2B_1			__BITS(30, 24)
+#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		__BITS(9, 0)
-#define ET_MAC_HDX_REXMIT_MAX		__BITS(15, 12)
-#define ET_MAC_HDX_EXC_DEFER		__BIT(16)
-#define ET_MAC_HDX_NOBACKOFF		__BIT(17)
-#define ET_MAC_HDX_BP_NOBACKOFF		__BIT(18)
-#define ET_MAC_HDX_ALT_BEB		__BIT(19)
-#define ET_MAC_HDX_ALT_BEB_TRUNC	__BITS(23, 20)
+#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		__BITS(2, 0)
-#define ET_MII_CFG_PREAMBLE_SUP		__BIT(4)
-#define ET_MII_CFG_SCAN_AUTOINC		__BIT(5)
-#define ET_MII_CFG_RST			__BIT(31)
+#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			__BIT(0)
+#define ET_MII_CMD_READ			0x00000001
 
 #define ET_MII_ADDR			0x5028
-#define ET_MII_ADDR_REG			__BITS(4, 0)
-#define ET_MII_ADDR_PHY			__BITS(12, 8)
+#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		__BITS(15, 0) 
+#define ET_MII_CTRL_VALUE_MASK		0x0000FFFF
+#define ET_MII_CTRL_VALUE_SHIFT		0
 
 #define ET_MII_STAT			0x5030
-#define ET_MII_STAT_VALUE		__BITS(15, 0)
+#define ET_MII_STAT_VALUE_MASK		0x0000FFFF
 
 #define ET_MII_IND			0x5034
-#define ET_MII_IND_BUSY			__BIT(0)
-#define ET_MII_IND_INVALID		__BIT(2)
+#define ET_MII_IND_BUSY			0x00000001
+#define ET_MII_IND_INVALID		0x00000004
 
 #define ET_MAC_CTRL			0x5038
-#define ET_MAC_CTRL_MODE_MII		__BIT(24)
-#define ET_MAC_CTRL_LHDX		__BIT(25)
-#define ET_MAC_CTRL_GHDX		__BIT(26)
+#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_MMC_CTRL			0x7000
-#define ET_MMC_CTRL_ENABLE		__BIT(0)
-#define ET_MMC_CTRL_ARB_DISABLE		__BIT(1)
-#define ET_MMC_CTRL_RXMAC_DISABLE	__BIT(2)
-#define ET_MMC_CTRL_TXMAC_DISABLE	__BIT(3)
-#define ET_MMC_CTRL_TXDMA_DISABLE	__BIT(4)
-#define ET_MMC_CTRL_RXDMA_DISABLE	__BIT(5)
-#define ET_MMC_CTRL_FORCE_CE		__BIT(6)
+#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			__BIT(3)
-#define ET_INTR_TXDMA_ERROR		__BIT(4)
-#define ET_INTR_RXEOF			__BIT(5)
-#define ET_INTR_RXRING0_LOW		__BIT(6)
-#define ET_INTR_RXRING1_LOW		__BIT(7)
-#define ET_INTR_RXSTAT_LOW		__BIT(8)
-#define ET_INTR_RXDMA_ERROR		__BIT(9)
-#define ET_INTR_TIMER			__BIT(14)
-#define ET_INTR_WOL			__BIT(15)
-#define ET_INTR_PHY			__BIT(16)
-#define ET_INTR_TXMAC			__BIT(17)
-#define ET_INTR_RXMAC			__BIT(18)
-#define ET_INTR_MAC_STATS		__BIT(19)
-#define ET_INTR_SLAVE_TO		__BIT(20)
+#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 | \
@@ -423,8 +387,8 @@
 /*
  * RX ring position uses same layout
  */
-#define ET_RX_RING_POS_INDEX		__BITS(9, 0)
-#define ET_RX_RING_POS_WRAP		__BIT(10)
+#define ET_RX_RING_POS_INDEX_MASK	0x000003FF
+#define ET_RX_RING_POS_WRAP		0x00000400
 
 /*
  * PCI IDs

Modified: head/sys/dev/et/if_etvar.h
==============================================================================
--- head/sys/dev/et/if_etvar.h	Thu Nov 19 20:41:36 2009	(r199547)
+++ head/sys/dev/et/if_etvar.h	Thu Nov 19 20:57:35 2009	(r199548)
@@ -106,11 +106,11 @@ struct et_txdesc {
 	uint32_t	td_ctrl2;	/* ET_TDCTRL2_ */
 } __packed;
 
-#define ET_TDCTRL1_LEN		__BITS(15, 0)
+#define ET_TDCTRL1_LEN_MASK	0x0000FFFF
 
-#define ET_TDCTRL2_LAST_FRAG	__BIT(0)
-#define ET_TDCTRL2_FIRST_FRAG	__BIT(1)
-#define ET_TDCTRL2_INTR		__BIT(2)
+#define ET_TDCTRL2_LAST_FRAG	0x00000001
+#define ET_TDCTRL2_FIRST_FRAG	0x00000002
+#define ET_TDCTRL2_INTR		0x00000004
 
 struct et_rxdesc {
 	uint32_t	rd_addr_lo;
@@ -118,24 +118,28 @@ struct et_rxdesc {
 	uint32_t	rd_ctrl;	/* ET_RDCTRL_ */
 } __packed;
 
-#define ET_RDCTRL_BUFIDX	__BITS(9, 0)
+#define ET_RDCTRL_BUFIDX_MASK	0x000003FF
 
 struct et_rxstat {
 	uint32_t	rxst_info1;
 	uint32_t	rxst_info2;	/* ET_RXST_INFO2_ */
 } __packed;
 
-#define ET_RXST_INFO2_LEN	__BITS(15, 0)
-#define ET_RXST_INFO2_BUFIDX	__BITS(25, 16)
-#define ET_RXST_INFO2_RINGIDX	__BITS(27, 26)
+#define ET_RXST_INFO2_LEN_MASK	0x0000FFFF
+#define ET_RXST_INFO2_LEN_SHIFT	0
+#define ET_RXST_INFO2_BUFIDX_MASK	0x03FF0000
+#define ET_RXST_INFO2_BUFIDX_SHIFT	16
+#define ET_RXST_INFO2_RINGIDX_MASK	0x0C000000
+#define ET_RXST_INFO2_RINGIDX_SHIFT	26
 
 struct et_rxstatus {
 	uint32_t	rxs_ring;
 	uint32_t	rxs_stat_ring;	/* ET_RXS_STATRING_ */
 } __packed;
 
-#define ET_RXS_STATRING_INDEX	__BITS(27, 16)
-#define ET_RXS_STATRING_WRAP	__BIT(28)
+#define ET_RXS_STATRING_INDEX_MASK	0x0FFF0000
+#define ET_RXS_STATRING_INDEX_SHIFT	16
+#define ET_RXS_STATRING_WRAP	0x10000000
 
 struct et_dmamap_ctx {
 	int		nsegs;

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 20:59:41 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3C095106566B;
	Thu, 19 Nov 2009 20:59: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 2A39D8FC14;
	Thu, 19 Nov 2009 20:59:41 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAJKxeHS019169;
	Thu, 19 Nov 2009 20:59:40 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAJKxegM019167;
	Thu, 19 Nov 2009 20:59:40 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200911192059.nAJKxegM019167@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 19 Nov 2009 20:59:40 +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: r199549 - head/sys/dev/xen/netfront
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 20:59:41 -0000

Author: jhb
Date: Thu Nov 19 20:59:40 2009
New Revision: 199549
URL: http://svn.freebsd.org/changeset/base/199549

Log:
  Remove commented out reference to if_watchdog and an assignment of zero to
  if_timer.
  
  Reviewed by:	scottl

Modified:
  head/sys/dev/xen/netfront/netfront.c

Modified: head/sys/dev/xen/netfront/netfront.c
==============================================================================
--- head/sys/dev/xen/netfront/netfront.c	Thu Nov 19 20:57:35 2009	(r199548)
+++ head/sys/dev/xen/netfront/netfront.c	Thu Nov 19 20:59:40 2009	(r199549)
@@ -1056,7 +1056,6 @@ xn_txeof(struct netfront_info *np)
 		return;
 	
 	ifp = np->xn_ifp;
-	ifp->if_timer = 0;
 	
 	do {
 		prod = np->tx.sring->rsp_prod;
@@ -1948,9 +1947,6 @@ create_netdev(device_t dev)
     	ifp->if_ioctl = xn_ioctl;
     	ifp->if_output = ether_output;
     	ifp->if_start = xn_start;
-#ifdef notyet
-    	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;

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 21:08:33 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B1946106568B;
	Thu, 19 Nov 2009 21:08: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 9F9558FC13;
	Thu, 19 Nov 2009 21:08:33 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAJL8XEH019448;
	Thu, 19 Nov 2009 21:08:33 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAJL8XEE019446;
	Thu, 19 Nov 2009 21:08:33 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200911192108.nAJL8XEE019446@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Thu, 19 Nov 2009 21:08: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: r199550 - head/sys/dev/et
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 21:08:33 -0000

Author: yongari
Date: Thu Nov 19 21:08:33 2009
New Revision: 199550
URL: http://svn.freebsd.org/changeset/base/199550

Log:
  Remove support code for FreeBSD 6.x versions.

Modified:
  head/sys/dev/et/if_et.c

Modified: head/sys/dev/et/if_et.c
==============================================================================
--- head/sys/dev/et/if_et.c	Thu Nov 19 20:59:40 2009	(r199549)
+++ head/sys/dev/et/if_et.c	Thu Nov 19 21:08:33 2009	(r199550)
@@ -322,13 +322,8 @@ et_attach(device_t dev)
 	ether_ifattach(ifp, eaddr);
 	callout_init_mtx(&sc->sc_tick, &sc->sc_mtx, 0);
 
-#if __FreeBSD_version > 700030
 	error = bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_NET | INTR_MPSAFE,
 			       NULL, et_intr, sc, &sc->sc_irq_handle);
-#else
-	error = bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_NET | INTR_MPSAFE,
-			       et_intr, sc, &sc->sc_irq_handle);
-#endif
 
 	if (error) {
 		ether_ifdetach(ifp);

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 21:39:43 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8D8991065670;
	Thu, 19 Nov 2009 21:39: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 61AFF8FC0C;
	Thu, 19 Nov 2009 21:39:43 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAJLdhmm020263;
	Thu, 19 Nov 2009 21:39:43 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAJLdhC3020261;
	Thu, 19 Nov 2009 21:39:43 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200911192139.nAJLdhC3020261@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Thu, 19 Nov 2009 21:39: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: r199551 - head/sys/dev/et
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 21:39:43 -0000

Author: yongari
Date: Thu Nov 19 21:39:43 2009
New Revision: 199551
URL: http://svn.freebsd.org/changeset/base/199551

Log:
  Destroy driver mutex in device detach.

Modified:
  head/sys/dev/et/if_et.c

Modified: head/sys/dev/et/if_et.c
==============================================================================
--- head/sys/dev/et/if_et.c	Thu Nov 19 21:08:33 2009	(r199550)
+++ head/sys/dev/et/if_et.c	Thu Nov 19 21:39:43 2009	(r199551)
@@ -373,7 +373,8 @@ et_detach(device_t dev)
 		if_free(sc->ifp);
 
 	et_dma_free(dev);
-	/* XXX Destroy lock here */
+
+	mtx_destroy(&sc->sc_mtx);
 
 	return 0;
 }

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 21:45:06 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AED4F1065696;
	Thu, 19 Nov 2009 21:45: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 9C7B68FC17;
	Thu, 19 Nov 2009 21:45:06 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAJLj6cf020457;
	Thu, 19 Nov 2009 21:45:06 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAJLj6KD020454;
	Thu, 19 Nov 2009 21:45:06 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200911192145.nAJLj6KD020454@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Thu, 19 Nov 2009 21:45: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: r199552 - head/sys/dev/et
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 21:45:06 -0000

Author: yongari
Date: Thu Nov 19 21:45:06 2009
New Revision: 199552
URL: http://svn.freebsd.org/changeset/base/199552

Log:
  Add MSI support.

Modified:
  head/sys/dev/et/if_et.c
  head/sys/dev/et/if_etvar.h

Modified: head/sys/dev/et/if_et.c
==============================================================================
--- head/sys/dev/et/if_et.c	Thu Nov 19 21:39:43 2009	(r199551)
+++ head/sys/dev/et/if_et.c	Thu Nov 19 21:45:06 2009	(r199552)
@@ -76,6 +76,10 @@ MODULE_DEPEND(et, pci, 1, 1, 1);
 MODULE_DEPEND(et, ether, 1, 1, 1);
 MODULE_DEPEND(et, miibus, 1, 1, 1);
 
+/* Tunables. */
+static int msi_disable = 0;
+TUNABLE_INT("hw.re.msi_disable", &msi_disable);
+
 static int	et_probe(device_t);
 static int	et_attach(device_t);
 static int	et_detach(device_t);
@@ -230,7 +234,7 @@ et_attach(device_t dev)
 	struct et_softc *sc;
 	struct ifnet *ifp;
 	uint8_t eaddr[ETHER_ADDR_LEN];
-	int error;
+	int cap, error, msic;
 
 	sc = device_get_softc(dev);
 	sc->dev = dev;
@@ -268,13 +272,38 @@ et_attach(device_t dev)
 	sc->sc_mem_bt = rman_get_bustag(sc->sc_mem_res);
 	sc->sc_mem_bh = rman_get_bushandle(sc->sc_mem_res);
 
+	msic = 0;
+	if (pci_find_extcap(dev, PCIY_EXPRESS, &cap) == 0) {
+		sc->sc_expcap = cap;
+		sc->sc_flags |= ET_FLAG_PCIE;
+		msic = pci_msi_count(dev);
+		if (bootverbose)
+			device_printf(dev, "MSI count : %d\n", msic);
+	}
+	if (msic > 0 && msi_disable == 0) {
+		msic = 1;
+		if (pci_alloc_msi(dev, &msic) == 0) {
+			if (msic == 1) {
+				device_printf(dev, "Using %d MSI message\n",
+				    msic);
+				sc->sc_flags |= ET_FLAG_MSI;
+			} else
+				pci_release_msi(dev);
+		}
+	}
+
 	/*
 	 * Allocate IRQ
 	 */
-	sc->sc_irq_rid = 0;
-	sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ,
-						&sc->sc_irq_rid,
-						RF_SHAREABLE | RF_ACTIVE);
+	if ((sc->sc_flags & ET_FLAG_MSI) == 0) {
+		sc->sc_irq_rid = 0;
+		sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ,
+		    &sc->sc_irq_rid, RF_SHAREABLE | RF_ACTIVE);
+	} else {
+		sc->sc_irq_rid = 1;
+		sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ,
+		    &sc->sc_irq_rid, RF_ACTIVE);
+	}
 	if (sc->sc_irq_res == NULL) {
 		device_printf(dev, "can't allocate irq\n");
 		error = ENXIO;
@@ -323,8 +352,7 @@ et_attach(device_t dev)
 	callout_init_mtx(&sc->sc_tick, &sc->sc_mtx, 0);
 
 	error = bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_NET | INTR_MPSAFE,
-			       NULL, et_intr, sc, &sc->sc_irq_handle);
-
+	    NULL, et_intr, sc, &sc->sc_irq_handle);
 	if (error) {
 		ether_ifdetach(ifp);
 		device_printf(dev, "can't setup intr\n");
@@ -363,6 +391,8 @@ et_detach(device_t dev)
 		bus_release_resource(dev, SYS_RES_IRQ, sc->sc_irq_rid,
 				     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,
@@ -1433,7 +1463,8 @@ et_chip_init(struct et_softc *sc)
 	CSR_WRITE_4(sc, ET_LOOPBACK, 0);
 
 	/* Clear MSI configure */
-	CSR_WRITE_4(sc, ET_MSI_CFG, 0);
+	if ((sc->sc_flags & ET_FLAG_MSI) == 0)
+		CSR_WRITE_4(sc, ET_MSI_CFG, 0);
 
 	/* Disable timer */
 	CSR_WRITE_4(sc, ET_TIMER, 0);

Modified: head/sys/dev/et/if_etvar.h
==============================================================================
--- head/sys/dev/et/if_etvar.h	Thu Nov 19 21:39:43 2009	(r199551)
+++ head/sys/dev/et/if_etvar.h	Thu Nov 19 21:45:06 2009	(r199552)
@@ -238,6 +238,7 @@ struct et_softc {
 	struct arpcom		arpcom;
 	int			sc_if_flags;
 	uint32_t		sc_flags;	/* ET_FLAG_ */
+	int			sc_expcap;
 
 	int			sc_mem_rid;
 
@@ -277,7 +278,9 @@ struct et_softc {
 #define ET_UNLOCK(_sc)		mtx_unlock(&(_sc)->sc_mtx)
 #define ET_LOCK_ASSERT(_sc)	mtx_assert(&(_sc)->sc_mtx, MA_OWNED)
 
-#define ET_FLAG_TXRX_ENABLED	0x1
-#define ET_FLAG_JUMBO		0x2
+#define ET_FLAG_PCIE		0x0001
+#define ET_FLAG_MSI		0x0002
+#define ET_FLAG_TXRX_ENABLED	0x0100
+#define ET_FLAG_JUMBO		0x0200
 
 #endif	/* !_IF_ETVAR_H */

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 21:46:58 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8323C106568B;
	Thu, 19 Nov 2009 21:46: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 70A358FC0C;
	Thu, 19 Nov 2009 21:46:58 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAJLkw6H020537;
	Thu, 19 Nov 2009 21:46:58 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAJLkwTt020533;
	Thu, 19 Nov 2009 21:46:58 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200911192146.nAJLkwTt020533@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Thu, 19 Nov 2009 21:46: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: r199553 - head/sys/dev/et
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 21:46:58 -0000

Author: yongari
Date: Thu Nov 19 21:46:58 2009
New Revision: 199553
URL: http://svn.freebsd.org/changeset/base/199553

Log:
  Remove extra spce at the EOL.

Modified:
  head/sys/dev/et/if_et.c
  head/sys/dev/et/if_etreg.h
  head/sys/dev/et/if_etvar.h

Modified: head/sys/dev/et/if_et.c
==============================================================================
--- head/sys/dev/et/if_et.c	Thu Nov 19 21:45:06 2009	(r199552)
+++ head/sys/dev/et/if_et.c	Thu Nov 19 21:46:58 2009	(r199553)
@@ -1358,7 +1358,7 @@ et_free_rx_ring(struct et_softc *sc)
 			struct et_rxbuf *rb = &rbd->rbd_buf[i];
 
 			if (rb->rb_mbuf != NULL) {
-				bus_dmamap_unload(sc->sc_mbuf_dtag, 
+				bus_dmamap_unload(sc->sc_mbuf_dtag,
 			  	    rb->rb_dmap);
 				m_freem(rb->rb_mbuf);
 				rb->rb_mbuf = NULL;

Modified: head/sys/dev/et/if_etreg.h
==============================================================================
--- head/sys/dev/et/if_etreg.h	Thu Nov 19 21:45:06 2009	(r199552)
+++ head/sys/dev/et/if_etreg.h	Thu Nov 19 21:46:58 2009	(r199553)
@@ -1,13 +1,13 @@
 /*-
  * Copyright (c) 2007 The DragonFly Project.  All rights reserved.
- * 
+ *
  * This code is derived from software contributed to The DragonFly Project
  * by Sepherosa Ziehau 
- * 
+ *
  * 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
@@ -17,7 +17,7 @@
  * 3. Neither the name of The DragonFly Project 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 COPYRIGHT HOLDERS AND CONTRIBUTORS
  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@@ -30,7 +30,7 @@
  * 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/dev/netif/et/if_etreg.h,v 1.3 2007/10/23 14:28:42 sephe Exp $
  * $FreeBSD$
  */

Modified: head/sys/dev/et/if_etvar.h
==============================================================================
--- head/sys/dev/et/if_etvar.h	Thu Nov 19 21:45:06 2009	(r199552)
+++ head/sys/dev/et/if_etvar.h	Thu Nov 19 21:46:58 2009	(r199553)
@@ -1,13 +1,13 @@
 /*-
  * Copyright (c) 2007 The DragonFly Project.  All rights reserved.
- * 
+ *
  * This code is derived from software contributed to The DragonFly Project
  * by Sepherosa Ziehau 
- * 
+ *
  * 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
@@ -17,7 +17,7 @@
  * 3. Neither the name of The DragonFly Project 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 COPYRIGHT HOLDERS AND CONTRIBUTORS
  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
@@ -30,7 +30,7 @@
  * 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/dev/netif/et/if_etvar.h,v 1.4 2007/10/23 14:28:42 sephe Exp $
  * $FreeBSD$
  */
@@ -40,7 +40,7 @@
 
 /* DragonFly compatibility */
 #define EVL_ENCAPLEN		ETHER_VLAN_ENCAP_LEN
- 
+
 /*
  * Allocate the right type of mbuf for the desired total length.
  */

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 21:47:55 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3268E1065694;
	Thu, 19 Nov 2009 21:47:55 +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 06EFB8FC1D;
	Thu, 19 Nov 2009 21:47:55 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAJLlsSb020595;
	Thu, 19 Nov 2009 21:47:54 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAJLlsll020593;
	Thu, 19 Nov 2009 21:47:54 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200911192147.nAJLlsll020593@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 19 Nov 2009 21:47: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: r199554 - head/sys/dev/nxge
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 21:47:55 -0000

Author: jhb
Date: Thu Nov 19 21:47:54 2009
New Revision: 199554
URL: http://svn.freebsd.org/changeset/base/199554

Log:
  Fix compile after previous "harmless" commit.
  
  Pointy hat to:	jhb

Modified:
  head/sys/dev/nxge/if_nxge.c

Modified: head/sys/dev/nxge/if_nxge.c
==============================================================================
--- head/sys/dev/nxge/if_nxge.c	Thu Nov 19 21:46:58 2009	(r199553)
+++ head/sys/dev/nxge/if_nxge.c	Thu Nov 19 21:47:54 2009	(r199554)
@@ -2943,7 +2943,6 @@ xge_flush_txds(xge_hal_channel_h channel
 	xge_lldev_t *lldev = xge_hal_channel_userdata(channelh);
 	xge_hal_dtr_h tx_dtr;
 	xge_tx_priv_t *tx_priv;
-	struct ifnet *ifnetp = lldev->ifnetp;
 	u8 t_code;
 
 	while(xge_hal_fifo_dtr_next_completed(channelh, &tx_dtr, &t_code)
@@ -3005,7 +3004,7 @@ xge_send_locked(struct ifnet *ifnetp, in
 
 	/* If device is not initialized, return */
 	if((!lldev->initialized) || (!(ifnetp->if_drv_flags & IFF_DRV_RUNNING)))
-	    goto _exit;
+	    return;
 
 	XGE_DRV_STATS(tx_calls);
 
@@ -3015,7 +3014,10 @@ xge_send_locked(struct ifnet *ifnetp, in
 	 */
 	for(;;) {
 	    IF_DEQUEUE(&ifnetp->if_snd, m_head);
-	    if(m_head == NULL) break;
+	    if (m_head == NULL) {
+		ifnetp->if_drv_flags &= ~(IFF_DRV_OACTIVE);
+		return;
+	    }
 
 	    for(m_buf = m_head; m_buf != NULL; m_buf = m_buf->m_next) {
 	        if(m_buf->m_len) count += 1;
@@ -3032,7 +3034,7 @@ xge_send_locked(struct ifnet *ifnetp, in
 	    if(status != XGE_HAL_OK) {
 	        XGE_DRV_STATS(tx_no_txd);
 	        xge_flush_txds(channelh);
-	        goto _exit1;
+		break;
 	    }
 
 	    vlan_tag =
@@ -3053,7 +3055,7 @@ xge_send_locked(struct ifnet *ifnetp, in
 	        ll_tx_priv->dma_map, m_head, segs, &nsegs, BUS_DMA_NOWAIT)) {
 	        xge_trace(XGE_TRACE, "DMA map load failed");
 	        XGE_DRV_STATS(tx_map_fail);
-	        goto _exit1;
+		break;
 	    }
 
 	    if(lldev->driver_stats.tx_max_frags < nsegs)
@@ -3092,9 +3094,7 @@ xge_send_locked(struct ifnet *ifnetp, in
 	     * listener so that we can use tools like tcpdump */
 	    ETHER_BPF_MTAP(ifnetp, m_head);
 	}
-	ifnetp->if_drv_flags &= ~(IFF_DRV_OACTIVE);
-	goto _exit;
-_exit1:
+
 	/* Prepend the packet back to queue */
 	IF_PREPEND(&ifnetp->if_snd, m_head);
 	ifnetp->if_drv_flags |= IFF_DRV_OACTIVE;
@@ -3102,8 +3102,6 @@ _exit1:
 	xge_queue_produce_context(xge_hal_device_queue(lldev->devh),
 	    XGE_LL_EVENT_TRY_XMIT_AGAIN, lldev->devh);
 	XGE_DRV_STATS(tx_again);
-
-_exit:
 }
 
 /**

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 21:50:54 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 645221065789
	for ; Thu, 19 Nov 2009 21:50:54 +0000 (UTC)
	(envelope-from julian@elischer.org)
Received: from outJ.internet-mail-service.net (outj.internet-mail-service.net
	[216.240.47.233])
	by mx1.freebsd.org (Postfix) with ESMTP id 4967B8FC16
	for ; Thu, 19 Nov 2009 21:50:54 +0000 (UTC)
Received: from idiom.com (mx0.idiom.com [216.240.32.160])
	by out.internet-mail-service.net (Postfix) with ESMTP id 3362714DF1D;
	Thu, 19 Nov 2009 13:50:54 -0800 (PST)
X-Client-Authorized: MaGic Cook1e
X-Client-Authorized: MaGic Cook1e
X-Client-Authorized: MaGic Cook1e
X-Client-Authorized: MaGic Cook1e
Received: from julian-mac.elischer.org
	(h-67-100-89-137.snfccasy.static.covad.net [67.100.89.137])
	by idiom.com (Postfix) with ESMTP id D1EA32D6013;
	Thu, 19 Nov 2009 13:50:52 -0800 (PST)
Message-ID: <4B05BDBA.30602@elischer.org>
Date: Thu, 19 Nov 2009 13:50:50 -0800
From: Julian Elischer 
User-Agent: Thunderbird 2.0.0.23 (Macintosh/20090812)
MIME-Version: 1.0
To: John Baldwin 
References: <200911191821.nAJILpZ6014634@svn.freebsd.org>
	<4B0590B2.1010007@elischer.org>
	<200911191419.30432.jhb@freebsd.org>
In-Reply-To: <200911191419.30432.jhb@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: r199538 - head/sys/dev/lmc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 21:50:54 -0000

John Baldwin wrote:
> On Thursday 19 November 2009 1:38:42 pm Julian Elischer wrote:
>> John Baldwin wrote:
>>> Author: jhb
>>> Date: Thu Nov 19 18:21:51 2009
>>> +#  if (__FreeBSD_version >= 500000)
>>> +  callout_init(&sc->callout, 0);
>>> +#  else  /* FreeBSD-4 */
>>> +  callout_init(&sc->callout);
>>> +#  endif
>>> +
>>
>> I think the OpenBSD and _FreeBSD_version >= 500000
>> conditions can probably be removed..
>>
>>
>>>  
>>>  #ifdef __FreeBSD__
>>> +  struct callout callout;	/* watchdog needs this                  */
>>>    struct device	*dev;		/* base device pointer                     */
>>>    bus_space_tag_t csr_tag;	/* bus_space needs this                    */
>>>    bus_space_handle_t csr_handle;/* bus_space_needs this                    
> */
>> along with #ifdef __FreeBSD__
> 
> Go for it. :)  I was just removing if_watchdog use in this sweep.  No one 
> stepped up to test this since I posted it almost 2 weeks ago though, so I'm 
> not sure if there are any users of this.
> 

I didn't realize it was an externally maintained driver...

stripping saves some space..
-rw-r--r--    1 root  wheel  212883 Nov 19 11:54 if_lmc.c
-rw-r--r--    1 root  wheel   76600 Nov 19 11:54 if_lmc.h
-rw-r--r--    1 root  wheel  142163 Nov 19 13:41 stripped.c
-rw-r--r--    1 root  wheel   61537 Nov 19 13:47 stripped.h

but I'll ask the author first..



From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 21:53:21 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5EFE2106568F;
	Thu, 19 Nov 2009 21:53: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 4BD968FC16;
	Thu, 19 Nov 2009 21:53:21 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAJLrLCH020868;
	Thu, 19 Nov 2009 21:53:21 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAJLrLfB020866;
	Thu, 19 Nov 2009 21:53:21 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200911192153.nAJLrLfB020866@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Thu, 19 Nov 2009 21:53: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: r199556 - head/sys/dev/et
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 21:53:21 -0000

Author: yongari
Date: Thu Nov 19 21:53:21 2009
New Revision: 199556
URL: http://svn.freebsd.org/changeset/base/199556

Log:
  style(9)

Modified:
  head/sys/dev/et/if_et.c

Modified: head/sys/dev/et/if_et.c
==============================================================================
--- head/sys/dev/et/if_et.c	Thu Nov 19 21:48:01 2009	(r199555)
+++ head/sys/dev/et/if_et.c	Thu Nov 19 21:53:21 2009	(r199556)
@@ -222,10 +222,10 @@ 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 (0);
 		}
 	}
-	return ENXIO;
+	return (ENXIO);
 }
 
 static int
@@ -267,7 +267,7 @@ et_attach(device_t dev)
 						&sc->sc_mem_rid, RF_ACTIVE);
 	if (sc->sc_mem_res == NULL) {
 		device_printf(dev, "can't allocate IO memory\n");
-		return ENXIO;
+		return (ENXIO);
 	}
 	sc->sc_mem_bt = rman_get_bustag(sc->sc_mem_res);
 	sc->sc_mem_bh = rman_get_bushandle(sc->sc_mem_res);
@@ -361,10 +361,10 @@ et_attach(device_t dev)
 
 	et_add_sysctls(sc);
 
-	return 0;
+	return (0);
 fail:
 	et_detach(dev);
-	return error;
+	return (error);
 }
 
 static int
@@ -406,7 +406,7 @@ et_detach(device_t dev)
 
 	mtx_destroy(&sc->sc_mtx);
 
-	return 0;
+	return (0);
 }
 
 static int
@@ -417,7 +417,7 @@ et_shutdown(device_t dev)
 	ET_LOCK(sc);
 	et_stop(sc);
 	ET_UNLOCK(sc);
-	return 0;
+	return (0);
 }
 
 static int
@@ -460,7 +460,7 @@ et_miibus_readreg(device_t dev, int phy,
 back:
 	/* Make sure that the current operation is stopped */
 	CSR_WRITE_4(sc, ET_MII_CMD, 0);
-	return ret;
+	return (ret);
 }
 
 static int
@@ -499,7 +499,7 @@ et_miibus_writereg(device_t dev, int phy
 
 	/* Make sure that the current operation is stopped */
 	CSR_WRITE_4(sc, ET_MII_CMD, 0);
-	return 0;
+	return (0);
 }
 
 static void
@@ -522,7 +522,7 @@ et_ifmedia_upd_locked(struct ifnet *ifp)
 	}
 	mii_mediachg(mii);
 
-	return 0;
+	return (0);
 }
 
 static int
@@ -535,7 +535,7 @@ et_ifmedia_upd(struct ifnet *ifp)
 	res = et_ifmedia_upd_locked(ifp);
 	ET_UNLOCK(sc);
 
-	return res;
+	return (res);
 }
 
 static void
@@ -590,7 +590,7 @@ et_bus_config(device_t dev)
 	val = pci_read_config(dev, ET_PCIR_EEPROM_STATUS, 1);
 	if (val & ET_PCIM_EEPROM_STATUS_ERROR) {
 		device_printf(dev, "EEPROM status error 0x%02x\n", val);
-		return ENXIO;
+		return (ENXIO);
 	}
 
 	/* TODO: LED */
@@ -644,7 +644,7 @@ et_bus_config(device_t dev)
 	val |= ET_PCIV_DEVICE_CTRL_RRSZ_2K;
 	pci_write_config(dev, ET_PCIR_DEVICE_CTRL, val, 2);
 
-	return 0;
+	return (0);
 }
 
 static void
@@ -716,7 +716,7 @@ et_dma_alloc(device_t dev)
 				   0, NULL, NULL, &sc->sc_dtag);
 	if (error) {
 		device_printf(dev, "can't create DMA tag\n");
-		return error;
+		return (error);
 	}
 
 	/*
@@ -727,7 +727,7 @@ et_dma_alloc(device_t dev)
 				  &tx_ring->tr_paddr, &tx_ring->tr_dmap);
 	if (error) {
 		device_printf(dev, "can't create TX ring DMA stuffs\n");
-		return error;
+		return (error);
 	}
 
 	/*
@@ -738,7 +738,7 @@ et_dma_alloc(device_t dev)
 				  &txsd->txsd_paddr, &txsd->txsd_dmap);
 	if (error) {
 		device_printf(dev, "can't create TX status DMA stuffs\n");
-		return error;
+		return (error);
 	}
 
 	/*
@@ -758,7 +758,7 @@ et_dma_alloc(device_t dev)
 		if (error) {
 			device_printf(dev, "can't create DMA stuffs for "
 				      "the %d RX ring\n", i);
-			return error;
+			return (error);
 		}
 		rx_ring->rr_posreg = rx_ring_posreg[i];
 	}
@@ -772,7 +772,7 @@ et_dma_alloc(device_t dev)
 				  &rxst_ring->rsr_paddr, &rxst_ring->rsr_dmap);
 	if (error) {
 		device_printf(dev, "can't create RX stat ring DMA stuffs\n");
-		return error;
+		return (error);
 	}
 
 	/*
@@ -784,7 +784,7 @@ et_dma_alloc(device_t dev)
 				  &rxsd->rxsd_paddr, &rxsd->rxsd_dmap);
 	if (error) {
 		device_printf(dev, "can't create RX status DMA stuffs\n");
-		return error;
+		return (error);
 	}
 
 	/*
@@ -792,9 +792,9 @@ et_dma_alloc(device_t dev)
 	 */
 	error = et_dma_mbuf_create(dev);
 	if (error)
-		return error;
+		return (error);
 
-	return 0;
+	return (0);
 }
 
 static void
@@ -873,7 +873,7 @@ et_dma_mbuf_create(device_t dev)
 				   BUS_DMA_ALLOCNOW, NULL, NULL, &sc->sc_mbuf_dtag);
 	if (error) {
 		device_printf(dev, "can't create mbuf DMA tag\n");
-		return error;
+		return (error);
 	}
 
 	/*
@@ -884,7 +884,7 @@ et_dma_mbuf_create(device_t dev)
 		device_printf(dev, "can't create spare mbuf DMA map\n");
 		bus_dma_tag_destroy(sc->sc_mbuf_dtag);
 		sc->sc_mbuf_dtag = NULL;
-		return error;
+		return (error);
 	}
 
 	/*
@@ -903,7 +903,7 @@ et_dma_mbuf_create(device_t dev)
 					      "for %d RX ring\n", j, i);
 				rx_done[i] = j;
 				et_dma_mbuf_destroy(dev, 0, rx_done);
-				return error;
+				return (error);
 			}
 		}
 		rx_done[i] = ET_RX_NDESC;
@@ -922,11 +922,11 @@ et_dma_mbuf_create(device_t dev)
 			device_printf(dev, "can't create %d TX mbuf "
 				      "DMA map\n", i);
 			et_dma_mbuf_destroy(dev, i, rx_done);
-			return error;
+			return (error);
 		}
 	}
 
-	return 0;
+	return (0);
 }
 
 static void
@@ -991,7 +991,7 @@ et_dma_mem_create(device_t dev, bus_size
 				   0, NULL, NULL, dtag);
 	if (error) {
 		device_printf(dev, "can't create DMA tag\n");
-		return error;
+		return (error);
 	}
 
 	error = bus_dmamem_alloc(*dtag, addr, BUS_DMA_WAITOK | BUS_DMA_ZERO,
@@ -1000,7 +1000,7 @@ et_dma_mem_create(device_t dev, bus_size
 		device_printf(dev, "can't allocate DMA mem\n");
 		bus_dma_tag_destroy(*dtag);
 		*dtag = NULL;
-		return error;
+		return (error);
 	}
 
 	error = bus_dmamap_load(*dtag, *dmap, *addr, size,
@@ -1010,9 +1010,9 @@ et_dma_mem_create(device_t dev, bus_size
 		bus_dmamem_free(*dtag, *addr, *dmap);
 		bus_dma_tag_destroy(*dtag);
 		*dtag = NULL;
-		return error;
+		return (error);
 	}
-	return 0;
+	return (0);
 }
 
 static void
@@ -1230,7 +1230,7 @@ et_ioctl(struct ifnet *ifp, u_long cmd, 
 		error = ether_ioctl(ifp, cmd, data);
 		break;
 	}
-	return error;
+	return (error);
 }
 
 static void
@@ -1309,9 +1309,9 @@ et_stop_rxdma(struct et_softc *sc)
 	DELAY(5);
 	if ((CSR_READ_4(sc, ET_RXDMA_CTRL) & ET_RXDMA_CTRL_HALTED) == 0) {
 		if_printf(sc->ifp, "can't stop RX DMA engine\n");
-		return ETIMEDOUT;
+		return (ETIMEDOUT);
 	}
-	return 0;
+	return (0);
 }
 
 static int
@@ -1319,7 +1319,7 @@ et_stop_txdma(struct et_softc *sc)
 {
 	CSR_WRITE_4(sc, ET_TXDMA_CTRL,
 		    ET_TXDMA_CTRL_HALT | ET_TXDMA_CTRL_SINGLE_EPKT);
-	return 0;
+	return (0);
 }
 
 static void
@@ -1484,14 +1484,14 @@ et_chip_init(struct et_softc *sc)
 	/* Initialize RX DMA engine */
 	error = et_init_rxdma(sc);
 	if (error)
-		return error;
+		return (error);
 
 	/* Initialize TX DMA engine */
 	error = et_init_txdma(sc);
 	if (error)
-		return error;
+		return (error);
 
-	return 0;
+	return (0);
 }
 
 static int
@@ -1512,7 +1512,7 @@ et_init_tx_ring(struct et_softc *sc)
 	bzero(txsd->txsd_status, sizeof(uint32_t));
 	bus_dmamap_sync(txsd->txsd_dtag, txsd->txsd_dmap,
 			BUS_DMASYNC_PREWRITE);
-	return 0;
+	return (0);
 }
 
 static int
@@ -1531,7 +1531,7 @@ et_init_rx_ring(struct et_softc *sc)
 			if (error) {
 				if_printf(sc->ifp, "%d ring %d buf, "
 					  "newbuf failed: %d\n", n, i, error);
-				return error;
+				return (error);
 			}
 		}
 	}
@@ -1544,7 +1544,7 @@ et_init_rx_ring(struct et_softc *sc)
 	bus_dmamap_sync(rxst_ring->rsr_dtag, rxst_ring->rsr_dmap,
 			BUS_DMASYNC_PREWRITE);
 
-	return 0;
+	return (0);
 }
 
 static void
@@ -1578,7 +1578,7 @@ et_init_rxdma(struct et_softc *sc)
 	error = et_stop_rxdma(sc);
 	if (error) {
 		if_printf(sc->ifp, "can't init RX DMA engine\n");
-		return error;
+		return (error);
 	}
 
 	/*
@@ -1634,7 +1634,7 @@ et_init_rxdma(struct et_softc *sc)
 	CSR_WRITE_4(sc, ET_RX_INTR_NPKTS, sc->sc_rx_intr_npkts);
 	CSR_WRITE_4(sc, ET_RX_INTR_DELAY, sc->sc_rx_intr_delay);
 
-	return 0;
+	return (0);
 }
 
 static int
@@ -1647,7 +1647,7 @@ et_init_txdma(struct et_softc *sc)
 	error = et_stop_txdma(sc);
 	if (error) {
 		if_printf(sc->ifp, "can't init TX DMA engine\n");
-		return error;
+		return (error);
 	}
 
 	/*
@@ -1669,7 +1669,7 @@ et_init_txdma(struct et_softc *sc)
 	tx_ring->tr_ready_index = 0;
 	tx_ring->tr_ready_wrap = 0;
 
-	return 0;
+	return (0);
 }
 
 static void
@@ -1839,16 +1839,16 @@ et_start_rxdma(struct et_softc *sc)
 
 	if (CSR_READ_4(sc, ET_RXDMA_CTRL) & ET_RXDMA_CTRL_HALTED) {
 		if_printf(sc->ifp, "can't start RX DMA engine\n");
-		return ETIMEDOUT;
+		return (ETIMEDOUT);
 	}
-	return 0;
+	return (0);
 }
 
 static int
 et_start_txdma(struct et_softc *sc)
 {
 	CSR_WRITE_4(sc, ET_TXDMA_CTRL, ET_TXDMA_CTRL_SINGLE_EPKT);
-	return 0;
+	return (0);
 }
 
 static int
@@ -1881,7 +1881,7 @@ et_enable_txrx(struct et_softc *sc, int 
 	}
 	if (i == NRETRY) {
 		if_printf(ifp, "can't enable RX/TX\n");
-		return 0;
+		return (0);
 	}
 	sc->sc_flags |= ET_FLAG_TXRX_ENABLED;
 
@@ -1892,13 +1892,13 @@ et_enable_txrx(struct et_softc *sc, int 
 	 */
 	error = et_start_rxdma(sc);
 	if (error)
-		return error;
+		return (error);
 
 	error = et_start_txdma(sc);
 	if (error)
-		return error;
+		return (error);
 
-	return 0;
+	return (0);
 }
 
 static void
@@ -2130,7 +2130,7 @@ back:
 		m_freem(m);
 		*m0 = NULL;
 	}
-	return error;
+	return (error);
 }
 
 static void
@@ -2218,13 +2218,13 @@ et_tick(void *xsc)
 static int
 et_newbuf_cluster(struct et_rxbuf_data *rbd, int buf_idx, int init)
 {
-	return et_newbuf(rbd, buf_idx, init, MCLBYTES);
+	return (et_newbuf(rbd, buf_idx, init, MCLBYTES));
 }
 
 static int
 et_newbuf_hdr(struct et_rxbuf_data *rbd, int buf_idx, int init)
 {
-	return et_newbuf(rbd, buf_idx, init, MHLEN);
+	return (et_newbuf(rbd, buf_idx, init, MHLEN));
 }
 
 static int
@@ -2248,7 +2248,7 @@ et_newbuf(struct et_rxbuf_data *rbd, int
 		if (init) {
 			if_printf(sc->ifp,
 				  "m_getl failed, size %d\n", len0);
-			return error;
+			return (error);
 		} else {
 			goto back;
 		}
@@ -2275,7 +2275,7 @@ et_newbuf(struct et_rxbuf_data *rbd, int
 
 		if (init) {
 			if_printf(sc->ifp, "can't load RX mbuf\n");
-			return error;
+			return (error);
 		} else {
 			goto back;
 		}
@@ -2299,7 +2299,7 @@ et_newbuf(struct et_rxbuf_data *rbd, int
 	error = 0;
 back:
 	et_setup_rxdesc(rbd, buf_idx, rb->rb_paddr);
-	return error;
+	return (error);
 }
 
 /*
@@ -2349,7 +2349,7 @@ et_sysctl_rx_intr_npkts(SYSCTL_HANDLER_A
 		sc->sc_rx_intr_npkts = v;
 	}
 back:
-	return error;
+	return (error);
 }
 
 static int
@@ -2374,7 +2374,7 @@ et_sysctl_rx_intr_delay(SYSCTL_HANDLER_A
 		sc->sc_rx_intr_delay = v;
 	}
 back:
-	return error;
+	return (error);
 }
 
 static void

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 21:55:33 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CD99F106568B;
	Thu, 19 Nov 2009 21:55:33 +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 988BB8FC08;
	Thu, 19 Nov 2009 21:55:33 +0000 (UTC)
Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net
	[66.111.2.69])
	by cyrus.watson.org (Postfix) with ESMTPSA id 214D446B38;
	Thu, 19 Nov 2009 16:55:33 -0500 (EST)
Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8])
	by bigwig.baldwin.cx (Postfix) with ESMTPA id 583088A020;
	Thu, 19 Nov 2009 16:55:32 -0500 (EST)
From: John Baldwin 
To: Jung-uk Kim 
Date: Thu, 19 Nov 2009 16:49:36 -0500
User-Agent: KMail/1.9.7
References: <200911182340.nAINeJ3W087652@svn.freebsd.org>
	
	<200911191115.11088.jkim@FreeBSD.org>
In-Reply-To: <200911191115.11088.jkim@FreeBSD.org>
MIME-Version: 1.0
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200911191649.37198.jhb@freebsd.org>
X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1
	(bigwig.baldwin.cx); Thu, 19 Nov 2009 16:55:32 -0500 (EST)
X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx
X-Virus-Status: Clean
X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE
	autolearn=no version=3.2.5
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, Robert Watson 
Subject: Re: svn commit: r199498 - in head/sys: amd64/amd64 i386/i386 net
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 21:55:33 -0000

On Thursday 19 November 2009 11:15:01 am Jung-uk Kim wrote:
> On Thursday 19 November 2009 03:26 am, Robert Watson wrote:
> > On Wed, 18 Nov 2009, Jung-uk Kim wrote:
> > >  - Change internal function bpf_jit_compile() to return allocated
> > > size of the generated binary and remove page size limitation for
> > > userland. - Use contigmalloc(9)/contigfree(9) instead of
> > > malloc(9)/free(9) to make sure the generated binary aligns
> > > properly and make it physically contiguous.
> >
> > Is physical contiguity actually required here -- I would have
> > thought virtual contiguity and alignment would be sufficient, in
> > which case the normal trick is to allocate using malloc the size +
> > min-align + 1 and then fudge the pointer forward until it's
> > properly aligned.
> 
> I don't believe it is strictly necessary but I assumed it might have 
> performance benefit for very big BPF programs although I have not 
> measured it.  Also, contigmalloc(9)/contigfree(9) is too obvious to 
> ignore for this purpose. :-)

Why would it have a performance benefit to have the pages be physically 
contiguous?  contigmalloc() is expensive and should really only be used if 
you truly need contiguous memory.  If you can get by with malloc(), just use 
malloc().

-- 
John Baldwin

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 21:55:34 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A29EF1065693;
	Thu, 19 Nov 2009 21:55:34 +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 622C08FC15;
	Thu, 19 Nov 2009 21:55:34 +0000 (UTC)
Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net
	[66.111.2.69])
	by cyrus.watson.org (Postfix) with ESMTPSA id EBF3346B03;
	Thu, 19 Nov 2009 16:55:33 -0500 (EST)
Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8])
	by bigwig.baldwin.cx (Postfix) with ESMTPA id 08A098A021;
	Thu, 19 Nov 2009 16:55:33 -0500 (EST)
From: John Baldwin 
To: Jilles Tjoelker 
Date: Thu, 19 Nov 2009 16:55:31 -0500
User-Agent: KMail/1.9.7
References: <4B01E548.7040708@gmail.com> <20091117182501.GA70742@stack.nl>
	<200911180841.55183.jhb@freebsd.org>
In-Reply-To: <200911180841.55183.jhb@freebsd.org>
MIME-Version: 1.0
Content-Type: Multipart/Mixed;
  boundary="Boundary-00=_T7bBLr0AvhuQLBB"
Message-Id: <200911191655.32008.jhb@freebsd.org>
X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1
	(bigwig.baldwin.cx); Thu, 19 Nov 2009 16:55:33 -0500 (EST)
X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx
X-Virus-Status: Clean
X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE
	autolearn=no version=3.2.5
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx
Cc: svn-src-head@freebsd.org, Dmitry Pryanishnikov ,
	svn-src-all@freebsd.org, src-committers@freebsd.org,
	Edwin Groothuis 
Subject: Re: svn commit: r194783 - head/lib/libc/stdtime
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 21:55:34 -0000

--Boundary-00=_T7bBLr0AvhuQLBB
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Wednesday 18 November 2009 8:41:54 am John Baldwin wrote:
> On Tuesday 17 November 2009 1:25:01 pm Jilles Tjoelker wrote:
> > On Tue, Nov 17, 2009 at 01:50:32AM +0200, Dmitry Pryanishnikov wrote:
> > > > Author: edwin
> > > > Date: Tue Jun 23 22:28:44 2009
> > > > New Revision: 194783
> > > > URL: http://svn.freebsd.org/changeset/base/194783
> > 
> > > > Log:
> > > >   Remove duplicate if-statement on gmt_is_set in gmtsub().
> > 
> > > >   MFC after:	1 week
> > 
> > > > Modified:
> > > >   head/lib/libc/stdtime/localtime.c
> > 
> > >    This change looks like a (small?) pessimization to me: before it, 
> > > _MUTEX_LOCK/_MUTEX_UNLOCK pair would be skipped for the case gmt_is_set 
> > > == TRUE (all invocations except the first one), now it won't. I'm not 
> > > sure whether this is critical here though...
> > 
> > It is certainly less efficient, but the old code was (most likely)
> > wrong. It used an idiom known as "double checked locking", which is
> > incorrect in most memory models. The problem is that the store to
> > gmt_is_set may become visible without stores to other memory (gmtptr and
> > what it points to) becoming visible.
> 
> That is easily fixed with a memory barrier.  Just use atomic_store_rel() to 
> set gmt_is_set at the end of the setup phase.

Alan Cox suggested that it might be best to provide an abstraction for this 
sort of thing rather than having N copies of using various memory barriers 
and atomic ops, etc.  This patch adds a new internal method to libc _once() 
that is just like pthread_once().  It is called _once() because it has some 
extra trickery to use pthread_once() for a multithreaded process and to use 
an internal stub version for single-threaded processes.  I also converted the 
gmt_is_set stuff to use this instead.  This should restore the lockless code 
for the common case.  Edwin, can you test this against the bug you were 
seeing?

-- 
John Baldwin

--Boundary-00=_T7bBLr0AvhuQLBB
Content-Type: text/x-diff;
  charset="iso-8859-1";
  name="stdtime.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="stdtime.patch"

Index: gen/Makefile.inc
===================================================================
--- gen/Makefile.inc	(revision 199529)
+++ gen/Makefile.inc	(working copy)
@@ -5,7 +5,8 @@
 .PATH: ${.CURDIR}/${MACHINE_ARCH}/gen ${.CURDIR}/gen
 
 SRCS+=  __getosreldate.c __xuname.c \
-	_pthread_stubs.c _rand48.c _spinlock_stub.c _thread_init.c \
+	_once_stub.c _pthread_stubs.c _rand48.c _spinlock_stub.c \
+	_thread_init.c \
 	alarm.c arc4random.c assert.c basename.c check_utility_compat.c \
 	clock.c closedir.c confstr.c \
 	crypt.c ctermid.c daemon.c devname.c dirname.c disklabel.c \
Index: gen/_once_stub.c
===================================================================
--- gen/_once_stub.c	(revision 0)
+++ gen/_once_stub.c	(revision 0)
@@ -0,0 +1,67 @@
+/*-
+ * Copyright (c) 2009 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.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include "namespace.h"
+#include 
+#include "un-namespace.h"
+#include "libc_private.h"
+
+/*
+ * This implements pthread_once() for the single-threaded case.  It is
+ * non-static so that it can be used by _pthread_stubs.c.
+ */
+int
+_libc_once(pthread_once_t *once_control, void (*init_routine)(void))
+{
+
+	if (once_control->state == PTHREAD_NEEDS_INIT)
+		return (0);
+	init_routine();
+	once_control->state = PTHREAD_DONE_INIT;
+	return (0);
+}
+
+/*
+ * This is the internal interface provided to libc.  It will use
+ * pthread_once() from the threading library in a multi-threaded
+ * process and _libc_once() for a single-threaded library.  Because
+ * _libc_once() uses the same ABI for the values in the pthread_once_t
+ * structure as the threading library, it is safe for a process to
+ * switch from _libc_once() to pthread_once() when threading is
+ * enabled.
+ */
+int
+_once(pthread_once_t *once_control, void (*init_routine)(void))
+{
+
+	if (__isthreaded)
+		return (_pthread_once(once_control, init_routine));
+	return (_libc_once(once_control, init_routine));
+}

Property changes on: gen/_once_stub.c
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + FreeBSD=%H
Added: svn:eol-style
   + native

Index: gen/_pthread_stubs.c
===================================================================
--- gen/_pthread_stubs.c	(revision 199529)
+++ gen/_pthread_stubs.c	(working copy)
@@ -105,7 +105,7 @@
 	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_MUTEX_LOCK */
 	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_MUTEX_TRYLOCK */
 	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_MUTEX_UNLOCK */
-	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_ONCE */
+	{PJT_DUAL_ENTRY(_libc_once)},   /* PJT_ONCE */
 	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_RWLOCK_DESTROY */
 	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_RWLOCK_INIT */
 	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_RWLOCK_RDLOCK */
Index: stdtime/localtime.c
===================================================================
--- stdtime/localtime.c	(revision 199529)
+++ stdtime/localtime.c	(working copy)
@@ -235,9 +235,8 @@
 
 static char		lcl_TZname[TZ_STRLEN_MAX + 1];
 static int		lcl_is_set;
-static int		gmt_is_set;
+static pthread_once_t	gmt_once = PTHREAD_ONCE_INIT;
 static pthread_rwlock_t	lcl_rwlock = PTHREAD_RWLOCK_INITIALIZER;
-static pthread_mutex_t	gmt_mutex = PTHREAD_MUTEX_INITIALIZER;
 
 char *			tzname[2] = {
 	wildabbr,
@@ -1464,6 +1463,17 @@
 	return tmp;
 }
 
+static void
+gmt_init(void)
+{
+
+#ifdef ALL_STATE
+	gmtptr = (struct state *) malloc(sizeof *gmtptr);
+	if (gmtptr != NULL)
+#endif /* defined ALL_STATE */
+		gmtload(gmtptr);
+}
+
 /*
 ** gmtsub is to gmtime as localsub is to localtime.
 */
@@ -1476,16 +1486,7 @@
 {
 	register struct tm *	result;
 
-	_MUTEX_LOCK(&gmt_mutex);
-	if (!gmt_is_set) {
-#ifdef ALL_STATE
-		gmtptr = (struct state *) malloc(sizeof *gmtptr);
-		if (gmtptr != NULL)
-#endif /* defined ALL_STATE */
-			gmtload(gmtptr);
-		gmt_is_set = TRUE;
-	}
-	_MUTEX_UNLOCK(&gmt_mutex);
+	_once(&gmt_once, gmt_init);
 	result = timesub(timep, offset, gmtptr, tmp);
 #ifdef TM_ZONE
 	/*
Index: include/libc_private.h
===================================================================
--- include/libc_private.h	(revision 199529)
+++ include/libc_private.h	(working copy)
@@ -34,6 +34,7 @@
 
 #ifndef _LIBC_PRIVATE_H_
 #define _LIBC_PRIVATE_H_
+#include 
 
 /*
  * This global flag is non-zero when a process has created one
@@ -147,6 +148,13 @@
 void _init_tls(void);
 
 /*
+ * Provides pthread_once()-like functionality for both single-threaded
+ * and multi-threaded applications.
+ */
+int _once(pthread_once_t *, void (*)(void));
+int _libc_once(pthread_once_t *, void (*)(void));
+
+/*
  * Set the TLS thread pointer
  */
 void _set_tp(void *tp);

--Boundary-00=_T7bBLr0AvhuQLBB--

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 22:04:03 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 670D0106566C;
	Thu, 19 Nov 2009 22:04: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 3B8748FC19;
	Thu, 19 Nov 2009 22:04:03 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAJM43Et021199;
	Thu, 19 Nov 2009 22:04:03 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAJM43Sg021197;
	Thu, 19 Nov 2009 22:04:03 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200911192204.nAJM43Sg021197@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 19 Nov 2009 22:04: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: r199557 - head/sys/arm/at91
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 22:04:03 -0000

Author: jhb
Date: Thu Nov 19 22:04:02 2009
New Revision: 199557
URL: http://svn.freebsd.org/changeset/base/199557

Log:
  - Initialize callout before it is used in atestop() during attach.
  - Reorder detach so that ether_ifdetach() is called first.  This removes
    the race that ATE_FLAG_DETACHING closed, so that flag can be removed.
  - Trim a duplicate clearing of IFF_DRV_RUNNING.
  
  Reviewed by:	imp

Modified:
  head/sys/arm/at91/if_ate.c

Modified: head/sys/arm/at91/if_ate.c
==============================================================================
--- head/sys/arm/at91/if_ate.c	Thu Nov 19 21:53:21 2009	(r199556)
+++ head/sys/arm/at91/if_ate.c	Thu Nov 19 22:04:02 2009	(r199557)
@@ -75,8 +75,7 @@ __FBSDID("$FreeBSD$");
 /*
  * Driver-specific flags.
  */
-#define	ATE_FLAG_DETACHING	0x01
-#define	ATE_FLAG_MULTICAST	0x02
+#define	ATE_FLAG_MULTICAST	0x01
 
 struct ate_softc
 {
@@ -196,6 +195,7 @@ ate_attach(device_t dev)
 	sc = device_get_softc(dev);
 	sc->dev = dev;
 	ATE_LOCK_INIT(sc);
+	callout_init_mtx(&sc->tick_ch, &sc->sc_mtx, 0);
 	
 	/*
 	 * Allocate resources.
@@ -233,7 +233,6 @@ ate_attach(device_t dev)
 	ATE_LOCK(sc);
 	atestop(sc);
 	ATE_UNLOCK(sc);
-	callout_init_mtx(&sc->tick_ch, &sc->sc_mtx, 0);
 
 	if ((err = ate_get_mac(sc, eaddr)) != 0) {
 		/*
@@ -310,12 +309,11 @@ ate_detach(device_t dev)
 	KASSERT(sc != NULL, ("[ate: %d]: sc is NULL", __LINE__));
 	ifp = sc->ifp;
 	if (device_is_attached(dev)) {
+		ether_ifdetach(ifp);
 		ATE_LOCK(sc);
-			sc->flags |= ATE_FLAG_DETACHING;
-			atestop(sc);
+		atestop(sc);
 		ATE_UNLOCK(sc);
 		callout_drain(&sc->tick_ch);
-		ether_ifdetach(ifp);
 	}
 	if (sc->miibus != NULL) {
 		device_delete_child(dev, sc->miibus);
@@ -1107,11 +1105,9 @@ ateioctl(struct ifnet *ifp, u_long cmd, 
 				    & (IFF_PROMISC | IFF_ALLMULTI)) != 0)
 					ate_rxfilter(sc);
 			} else {
-				if ((sc->flags & ATE_FLAG_DETACHING) == 0)
-					ateinit_locked(sc);
+				ateinit_locked(sc);
 			}
 		} else if ((drv_flags & IFF_DRV_RUNNING) != 0) {
-			ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 			atestop(sc);
 		}
 		sc->if_flags = flags;

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 22:06:19 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 61B181065695;
	Thu, 19 Nov 2009 22:06: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 4F9028FC08;
	Thu, 19 Nov 2009 22:06:19 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAJM6JD8021286;
	Thu, 19 Nov 2009 22:06:19 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAJM6J1l021283;
	Thu, 19 Nov 2009 22:06:19 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200911192206.nAJM6J1l021283@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Thu, 19 Nov 2009 22:06: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: r199558 - head/sys/dev/et
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 22:06:19 -0000

Author: yongari
Date: Thu Nov 19 22:06:19 2009
New Revision: 199558
URL: http://svn.freebsd.org/changeset/base/199558

Log:
  Use bus_{read,write}_4 rather than bus_space_{read,write}_4.

Modified:
  head/sys/dev/et/if_et.c
  head/sys/dev/et/if_etvar.h

Modified: head/sys/dev/et/if_et.c
==============================================================================
--- head/sys/dev/et/if_et.c	Thu Nov 19 22:04:02 2009	(r199557)
+++ head/sys/dev/et/if_et.c	Thu Nov 19 22:06:19 2009	(r199558)
@@ -269,8 +269,6 @@ et_attach(device_t dev)
 		device_printf(dev, "can't allocate IO memory\n");
 		return (ENXIO);
 	}
-	sc->sc_mem_bt = rman_get_bustag(sc->sc_mem_res);
-	sc->sc_mem_bh = rman_get_bushandle(sc->sc_mem_res);
 
 	msic = 0;
 	if (pci_find_extcap(dev, PCIY_EXPRESS, &cap) == 0) {

Modified: head/sys/dev/et/if_etvar.h
==============================================================================
--- head/sys/dev/et/if_etvar.h	Thu Nov 19 22:04:02 2009	(r199557)
+++ head/sys/dev/et/if_etvar.h	Thu Nov 19 22:06:19 2009	(r199558)
@@ -92,9 +92,9 @@ m_getl(int len, int how, int type, int f
 #define ET_JUMBO_MEM_SIZE	(ET_JSLOTS * ET_JLEN)
 
 #define CSR_WRITE_4(sc, reg, val)	\
-	bus_space_write_4((sc)->sc_mem_bt, (sc)->sc_mem_bh, (reg), (val))
+	bus_write_4((sc)->sc_mem_res, (reg), (val))
 #define CSR_READ_4(sc, reg)		\
-	bus_space_read_4((sc)->sc_mem_bt, (sc)->sc_mem_bh, (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)
@@ -229,8 +229,6 @@ struct et_softc {
 	device_t		dev;
 	struct mtx		sc_mtx;
 	device_t		sc_miibus;
-	bus_space_handle_t	sc_mem_bh;
-	bus_space_tag_t		sc_mem_bt;
 	void			*sc_irq_handle;
 	struct resource		*sc_irq_res;
 	struct resource		*sc_mem_res;

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 22:06:40 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C2AD51065695;
	Thu, 19 Nov 2009 22:06: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 AD7AF8FC21;
	Thu, 19 Nov 2009 22:06:40 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAJM6eRX021347;
	Thu, 19 Nov 2009 22:06:40 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAJM6e99021330;
	Thu, 19 Nov 2009 22:06:40 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200911192206.nAJM6e99021330@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 19 Nov 2009 22:06:40 +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: r199559 - in head/sys/dev: cm ep fatm malo mwl sn ste
	ti vx
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 22:06:40 -0000

Author: jhb
Date: Thu Nov 19 22:06:40 2009
New Revision: 199559
URL: http://svn.freebsd.org/changeset/base/199559

Log:
  - Add a private timer to drive the transmit watchdog instead of using
    if_watchdog and if_timer.
  - Fix some issues in detach for sn(4), ste(4), and ti(4).  Primarily this
    means calling ether_ifdetach() before anything else.

Modified:
  head/sys/dev/cm/smc90cx6.c
  head/sys/dev/cm/smc90cx6var.h
  head/sys/dev/ep/if_ep.c
  head/sys/dev/ep/if_epvar.h
  head/sys/dev/fatm/if_fatm.c
  head/sys/dev/fatm/if_fatmvar.h
  head/sys/dev/malo/if_malo.c
  head/sys/dev/malo/if_malo.h
  head/sys/dev/mwl/if_mwl.c
  head/sys/dev/mwl/if_mwlvar.h
  head/sys/dev/sn/if_sn.c
  head/sys/dev/sn/if_snvar.h
  head/sys/dev/ste/if_ste.c
  head/sys/dev/ste/if_stereg.h
  head/sys/dev/ti/if_ti.c
  head/sys/dev/ti/if_tireg.h
  head/sys/dev/vx/if_vx.c
  head/sys/dev/vx/if_vxvar.h

Modified: head/sys/dev/cm/smc90cx6.c
==============================================================================
--- head/sys/dev/cm/smc90cx6.c	Thu Nov 19 22:06:19 2009	(r199558)
+++ head/sys/dev/cm/smc90cx6.c	Thu Nov 19 22:06:40 2009	(r199559)
@@ -124,7 +124,7 @@ static void cm_reset_locked(struct cm_so
 void	cm_start(struct ifnet *);
 void	cm_start_locked(struct ifnet *);
 int	cm_ioctl(struct ifnet *, unsigned long, caddr_t);
-void	cm_watchdog(struct ifnet *);
+void	cm_watchdog(void *);
 void	cm_srint_locked(void *vsc);
 static	void cm_tint_locked(struct cm_softc *, int);
 void	cm_reconwatch_locked(void *);
@@ -194,11 +194,9 @@ cm_attach(dev)
 	ifp->if_output = arc_output;
 	ifp->if_start = cm_start;
 	ifp->if_ioctl = cm_ioctl;
-	ifp->if_watchdog  = cm_watchdog;
 	ifp->if_init = cm_init;
 	/* XXX IFQ_SET_READY(&ifp->if_snd); */
 	ifp->if_snd.ifq_maxlen = IFQ_MAXLEN;
-	ifp->if_timer = 0;
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX;
 
 	arc_ifattach(ifp, linkaddress);
@@ -210,6 +208,7 @@ cm_attach(dev)
 #endif
 
 	callout_init_mtx(&sc->sc_recon_ch, &sc->sc_mtx, 0);
+	callout_init_mtx(&sc->sc_watchdog_timer, &sc->sc_mtx, 0);
 
 	if_printf(ifp, "link addr 0x%02x (%d)\n", linkaddress, linkaddress);
 	return 0;
@@ -315,6 +314,7 @@ cm_reset_locked(sc)
 	ifp->if_drv_flags |= IFF_DRV_RUNNING;
 	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
 
+	callout_reset(&sc->sc_watchdog_timer, hz, cm_watchdog, sc);
 	cm_start_locked(ifp);
 }
 
@@ -332,7 +332,8 @@ cm_stop_locked(sc)
 	GETREG(CMRESET);
 
 	/* Stop watchdog timer */
-	sc->sc_ifp->if_timer = 0;
+	callout_stop(&sc->sc_watchdog_timer);
+	sc->sc_timer = 0;
 }
 
 void
@@ -464,7 +465,7 @@ cm_start_locked(ifp)
 		PUTREG(CMCMD, CM_TX(buffer));
 		PUTREG(CMSTAT, sc->sc_intmask);
 
-		ifp->if_timer = ARCTIMEOUT;
+		sc->sc_timer = ARCTIMEOUT;
 	}
 	m_freem(m);
 
@@ -627,7 +628,7 @@ cm_tint_locked(sc, isr)
 	if (isr & CM_TMA || sc->sc_broadcast[buffer])
 		ifp->if_opackets++;
 #ifdef CMRETRANSMIT
-	else if (ifp->if_flags & IFF_LINK2 && ifp->if_timer > 0
+	else if (ifp->if_flags & IFF_LINK2 && sc->sc_timer > 0
 	    && --sc->sc_retransmits[buffer] > 0) {
 		/* retransmit same buffer */
 		PUTREG(CMCMD, CM_TX(buffer));
@@ -657,7 +658,7 @@ cm_tint_locked(sc, isr)
 		 */
 		PUTREG(CMCMD, CM_TX(buffer));
 		/* init watchdog timer */
-		ifp->if_timer = ARCTIMEOUT;
+		sc->sc_timer = ARCTIMEOUT;
 
 #if defined(CM_DEBUG) && (CM_DEBUG > 1)
 		if_printf(ifp,
@@ -669,7 +670,7 @@ cm_tint_locked(sc, isr)
 		sc->sc_intmask &= ~CM_TA;
 		PUTREG(CMSTAT, sc->sc_intmask);
 		/* ... and watchdog timer */
-		ifp->if_timer = 0;
+		sc->sc_timer = 0;
 
 #ifdef CM_DEBUG
 		if_printf(ifp, "tint: no more buffers to send, status 0x%02x\n",
@@ -920,12 +921,13 @@ cm_ioctl(ifp, command, data)
  * retransmission is implemented).
  */
 void
-cm_watchdog(ifp)
-	struct ifnet *ifp;
+cm_watchdog(void *arg)
 {
-	struct cm_softc *sc = ifp->if_softc;
+	struct cm_softc *sc;
 
-	CM_LOCK(sc);
+	sc = arg;
+	callout_reset(&sc->sc_watchdog_timer, hz, cm_watchdog, sc);
+	if (sc->sc_timer == 0 || --sc->sc_timer > 0)
+		return;
 	PUTREG(CMCMD, CM_TXDIS);
-	CM_UNLOCK(sc);
 }

Modified: head/sys/dev/cm/smc90cx6var.h
==============================================================================
--- head/sys/dev/cm/smc90cx6var.h	Thu Nov 19 22:06:19 2009	(r199558)
+++ head/sys/dev/cm/smc90cx6var.h	Thu Nov 19 22:06:40 2009	(r199559)
@@ -77,6 +77,8 @@ struct cm_softc {
 	u_long	sc_reconcount_excessive; /* for the above */
 #define ARC_EXCESSIVE_RECONS 20
 #define ARC_EXCESSIVE_RECONS_REWARN 400
+	struct callout sc_watchdog_timer;
+	int	sc_timer;
 	u_char	sc_intmask;
 	u_char	sc_rx_act;		/* 2..3 */
 	u_char	sc_tx_act;		/* 0..1 */

Modified: head/sys/dev/ep/if_ep.c
==============================================================================
--- head/sys/dev/ep/if_ep.c	Thu Nov 19 22:06:19 2009	(r199558)
+++ head/sys/dev/ep/if_ep.c	Thu Nov 19 22:06:40 2009	(r199559)
@@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -91,10 +92,12 @@ static int ep_media2if_media[] =
 static void epinit(void *);
 static int epioctl(struct ifnet *, u_long, caddr_t);
 static void epstart(struct ifnet *);
-static void epwatchdog(struct ifnet *);
 
+static void ep_intr_locked(struct ep_softc *);
 static void epstart_locked(struct ifnet *);
 static void epinit_locked(struct ep_softc *);
+static void eptick(void *);
+static void epwatchdog(struct ep_softc *);
 
 /* if_media functions */
 static int ep_ifmedia_upd(struct ifnet *);
@@ -302,12 +305,12 @@ ep_attach(struct ep_softc *sc)
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
 	ifp->if_start = epstart;
 	ifp->if_ioctl = epioctl;
-	ifp->if_watchdog = epwatchdog;
 	ifp->if_init = epinit;
 	IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN);
 	ifp->if_snd.ifq_drv_maxlen = IFQ_MAXLEN;
 	IFQ_SET_READY(&ifp->if_snd);
 
+	callout_init_mtx(&sc->watchdog_timer, &sc->sc_mtx, 0);
 	if (!sc->epb.mii_trans) {
 		ifmedia_init(&sc->ifmedia, 0, ep_ifmedia_upd, ep_ifmedia_sts);
 
@@ -361,6 +364,7 @@ ep_detach(device_t dev)
 	ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 	EP_UNLOCK(sc);
 	ether_ifdetach(ifp);
+	callout_drain(&sc->watchdog_timer);
 	ep_free(dev);
 
 	if_free(ifp);
@@ -457,6 +461,7 @@ epinit_locked(struct ep_softc *sc)
 
 	GO_WINDOW(sc, 1);
 	epstart_locked(ifp);
+	callout_reset(&sc->watchdog_timer, hz, eptick, sc);
 }
 
 static void
@@ -556,7 +561,7 @@ startagain:
 
 	BPF_MTAP(ifp, m0);
 
-	ifp->if_timer = 2;
+	sc->tx_timer = 2;
 	ifp->if_opackets++;
 	m_freem(m0);
 
@@ -583,20 +588,26 @@ void
 ep_intr(void *arg)
 {
 	struct ep_softc *sc;
-	int status;
-	struct ifnet *ifp;
 
 	sc = (struct ep_softc *) arg;
 	EP_LOCK(sc);
+	ep_intr_locked(sc);
+	EP_UNLOCK(sc);
+}
+
+static void
+ep_intr_locked(struct ep_softc *sc)
+{
+	int status;
+	struct ifnet *ifp;
+
 	/* XXX 4.x splbio'd here to reduce interruptability */
 
 	/*
 	 * quick fix: Try to detect an interrupt when the card goes away.
 	 */
-	if (sc->gone || CSR_READ_2(sc, EP_STATUS) == 0xffff) {
-		EP_UNLOCK(sc);
+	if (sc->gone || CSR_READ_2(sc, EP_STATUS) == 0xffff)
 		return;
-	}
 	ifp = sc->ifp;
 
 	CSR_WRITE_2(sc, EP_COMMAND, SET_INTR_MASK);	/* disable all Ints */
@@ -612,14 +623,14 @@ rescan:
 			epread(sc);
 		if (status & S_TX_AVAIL) {
 			/* we need ACK */
-			ifp->if_timer = 0;
+			sc->tx_timer = 0;
 			ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
 			GO_WINDOW(sc, 1);
 			CSR_READ_2(sc, EP_W1_FREE_TX);
 			epstart_locked(ifp);
 		}
 		if (status & S_CARD_FAILURE) {
-			ifp->if_timer = 0;
+			sc->tx_timer = 0;
 #ifdef EP_LOCAL_STATS
 			device_printf(sc->dev, "\n\tStatus: %x\n", status);
 			GO_WINDOW(sc, 4);
@@ -642,11 +653,10 @@ rescan:
 
 #endif
 			epinit_locked(sc);
-			EP_UNLOCK(sc);
 			return;
 		}
 		if (status & S_TX_COMPLETE) {
-			ifp->if_timer = 0;
+			sc->tx_timer = 0;
 			/*
 			 * We need ACK. We do it at the end.
 			 *
@@ -700,7 +710,6 @@ rescan:
 
 	/* re-enable Ints */
 	CSR_WRITE_2(sc, EP_COMMAND, SET_INTR_MASK | S_5_INTS);
-	EP_UNLOCK(sc);
 }
 
 static void
@@ -933,7 +942,6 @@ epioctl(struct ifnet *ifp, u_long cmd, c
 		EP_LOCK(sc);
 		if (((ifp->if_flags & IFF_UP) == 0) &&
 		    (ifp->if_drv_flags & IFF_DRV_RUNNING)) {
-			ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 			epstop(sc);
 		} else
 			/* reinitialize card on any parameter change */
@@ -966,15 +974,27 @@ epioctl(struct ifnet *ifp, u_long cmd, c
 }
 
 static void
-epwatchdog(struct ifnet *ifp)
+eptick(void *arg)
 {
-	struct ep_softc *sc = ifp->if_softc;
+	struct ep_softc *sc;
+
+	sc = arg;
+	if (sc->tx_timer != 0 && --sc->tx_timer == 0)
+		epwatchdog(sc);
+	callout_reset(&sc->watchdog_timer, hz, eptick, sc);
+}
+
+static void
+epwatchdog(struct ep_softc *sc)
+{
+	struct ifnet *ifp;
 
+	ifp = sc->ifp;
 	if (sc->gone)
 		return;
 	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
-	epstart(ifp);
-	ep_intr(ifp->if_softc);
+	epstart_locked(ifp);
+	ep_intr_locked(sc);
 }
 
 static void
@@ -997,4 +1017,7 @@ epstop(struct ep_softc *sc)
 	CSR_WRITE_2(sc, EP_COMMAND, SET_RD_0_MASK);
 	CSR_WRITE_2(sc, EP_COMMAND, SET_INTR_MASK);
 	CSR_WRITE_2(sc, EP_COMMAND, SET_RX_FILTER);
+
+	sc->ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
+	callout_stop(&sc->watchdog_timer);
 }

Modified: head/sys/dev/ep/if_epvar.h
==============================================================================
--- head/sys/dev/ep/if_epvar.h	Thu Nov 19 22:06:19 2009	(r199558)
+++ head/sys/dev/ep/if_epvar.h	Thu Nov 19 22:06:40 2009	(r199559)
@@ -45,6 +45,9 @@ struct ep_softc {
 	bus_space_tag_t bst;
 	void *ep_intrhand;
 
+	struct callout watchdog_timer;
+	int tx_timer;
+
 	u_short ep_connectors;	/* Connectors on this card. */
 	u_char ep_connector;	/* Configured connector. */
 

Modified: head/sys/dev/fatm/if_fatm.c
==============================================================================
--- head/sys/dev/fatm/if_fatm.c	Thu Nov 19 22:06:19 2009	(r199558)
+++ head/sys/dev/fatm/if_fatm.c	Thu Nov 19 22:06:40 2009	(r199559)
@@ -391,16 +391,14 @@ fatm_check_heartbeat(struct fatm_softc *
  * Ensure that the heart is still beating.
  */
 static void
-fatm_watchdog(struct ifnet *ifp)
+fatm_watchdog(void *arg)
 {
-	struct fatm_softc *sc = ifp->if_softc;
+	struct fatm_softc *sc;
 
-	FATM_LOCK(sc);
-	if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
-		fatm_check_heartbeat(sc);
-		ifp->if_timer = 5;
-	}
-	FATM_UNLOCK(sc);
+	sc = arg;
+	FATM_CHECKLOCK(sc);
+	fatm_check_heartbeat(sc);
+	callout_reset(&sc->watchdog_timer, hz * 5, fatm_watchdog, sc);
 }
 
 /*
@@ -474,7 +472,7 @@ fatm_stop(struct fatm_softc *sc)
 	(void)fatm_reset(sc);
 
 	/* stop watchdog */
-	sc->ifp->if_timer = 0;
+	callout_stop(&sc->watchdog_timer);
 
 	if (sc->ifp->if_drv_flags & IFF_DRV_RUNNING) {
 		sc->ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
@@ -1341,7 +1339,7 @@ fatm_init_locked(struct fatm_softc *sc)
 	/*
 	 * Start the watchdog timer
 	 */
-	sc->ifp->if_timer = 5;
+	callout_reset(&sc->watchdog_timer, hz * 5, fatm_watchdog, sc);
 
 	/* start SUNI */
 	utopia_start(&sc->utopia);
@@ -2543,6 +2541,7 @@ fatm_detach(device_t dev)
 		FATM_UNLOCK(sc);
 		atm_ifdetach(sc->ifp);		/* XXX race */
 	}
+	callout_drain(&sc->watchdog_timer);
 
 	if (sc->ih != NULL)
 		bus_teardown_intr(dev, sc->irqres, sc->ih);
@@ -2784,6 +2783,7 @@ fatm_attach(device_t dev)
 	cv_init(&sc->cv_regs, "fatm_regs");
 
 	sysctl_ctx_init(&sc->sysctl_ctx);
+	callout_init_mtx(&sc->watchdog_timer, &sc->mtx, 0);
 
 	/*
 	 * Make the sysctl tree
@@ -2824,7 +2824,6 @@ fatm_attach(device_t dev)
 	ifp->if_flags = IFF_SIMPLEX;
 	ifp->if_ioctl = fatm_ioctl;
 	ifp->if_start = fatm_start;
-	ifp->if_watchdog = fatm_watchdog;
 	ifp->if_init = fatm_init;
 	ifp->if_linkmib = &IFP2IFATM(sc->ifp)->mib;
 	ifp->if_linkmiblen = sizeof(IFP2IFATM(sc->ifp)->mib);

Modified: head/sys/dev/fatm/if_fatmvar.h
==============================================================================
--- head/sys/dev/fatm/if_fatmvar.h	Thu Nov 19 22:06:19 2009	(r199558)
+++ head/sys/dev/fatm/if_fatmvar.h	Thu Nov 19 22:06:40 2009	(r199559)
@@ -188,6 +188,7 @@ struct fatm_softc {
 	struct ifnet	*ifp;		/* common part */
 	struct mtx	mtx;		/* lock this structure */
 	struct ifmedia	media;		/* media */
+	struct callout	watchdog_timer;
 
 	int		init_state;	/* initialisation step */
 	int		memid;		/* resource id for card memory */

Modified: head/sys/dev/malo/if_malo.c
==============================================================================
--- head/sys/dev/malo/if_malo.c	Thu Nov 19 22:06:19 2009	(r199558)
+++ head/sys/dev/malo/if_malo.c	Thu Nov 19 22:06:40 2009	(r199559)
@@ -135,7 +135,7 @@ static	int	malo_setup_hwdma(struct malo_
 static	void	malo_txq_init(struct malo_softc *, struct malo_txq *, int);
 static	void	malo_tx_cleanupq(struct malo_softc *, struct malo_txq *);
 static	void	malo_start(struct ifnet *);
-static	void	malo_watchdog(struct ifnet *);
+static	void	malo_watchdog(void *);
 static	int	malo_ioctl(struct ifnet *, u_long, caddr_t);
 static	void	malo_updateslot(struct ifnet *);
 static	int	malo_newstate(struct ieee80211vap *, enum ieee80211_state, int);
@@ -191,6 +191,7 @@ malo_attach(uint16_t devid, struct malo_
 	ic = ifp->if_l2com;
 
 	MALO_LOCK_INIT(sc);
+	callout_init_mtx(&sc->malo_watchdog_timer, &sc->malo_mtx, 0);
 
 	/* set these up early for if_printf use */
 	if_initname(ifp, device_get_name(sc->malo_dev),
@@ -272,7 +273,6 @@ malo_attach(uint16_t devid, struct malo_
 	ifp->if_softc = sc;
 	ifp->if_flags = IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST;
 	ifp->if_start = malo_start;
-	ifp->if_watchdog = malo_watchdog;
 	ifp->if_ioctl = malo_ioctl;
 	ifp->if_init = malo_init;
 	IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN);
@@ -1076,7 +1076,7 @@ malo_tx_proc(void *arg, int npending)
 
 	if (nreaped != 0) {
 		ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
-		ifp->if_timer = 0;
+		sc->malo_timer = 0;
 		malo_start(ifp);
 	}
 }
@@ -1260,7 +1260,7 @@ malo_tx_start(struct malo_softc *sc, str
 	MALO_TXDESC_SYNC(txq, ds, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 
 	ifp->if_opackets++;
-	ifp->if_timer = 5;
+	sc->malo_timer = 5;
 	MALO_TXQ_UNLOCK(txq);
 	return 0;
 #undef IEEE80211_DIR_DSTODS
@@ -1339,10 +1339,17 @@ malo_start(struct ifnet *ifp)
 }
 
 static void
-malo_watchdog(struct ifnet *ifp)
+malo_watchdog(void *arg)
 {
-	struct malo_softc *sc = ifp->if_softc;
+	struct malo_softc *sc;
+	struct ifnet *ifp;
+
+	sc = arg;
+	callout_reset(&sc->malo_watchdog_timer, hz, malo_watchdog, sc);
+	if (sc->malo_timer == 0 || --sc->malo_timer > 0)
+		return;
 
+	ifp = sc->malo_ifp;
 	if ((ifp->if_drv_flags & IFF_DRV_RUNNING) && !sc->malo_invalid) {
 		if_printf(ifp, "watchdog timeout\n");
 
@@ -1536,6 +1543,7 @@ malo_init_locked(struct malo_softc *sc)
 
 	ifp->if_drv_flags |= IFF_DRV_RUNNING;
 	malo_hal_intrset(mh, sc->malo_imask);
+	callout_reset(&sc->malo_watchdog_timer, hz, malo_watchdog, sc);
 }
 
 static void
@@ -1699,7 +1707,8 @@ malo_stop_locked(struct ifnet *ifp, int 
 	 * is gone (invalid).
 	 */
 	ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
-	ifp->if_timer = 0;
+	callout_stop(&sc->malo_watchdog_timer);
+	sc->malo_timer = 0;
 	/* diable interrupt.  */
 	malo_hal_intrset(mh, 0);
 	/* turn off the radio.  */
@@ -2241,6 +2250,7 @@ malo_detach(struct malo_softc *sc)
 	 * Other than that, it's straightforward...
 	 */
 	ieee80211_ifdetach(ic);
+	callout_drain(&sc->malo_watchdog_timer);
 	malo_dma_cleanup(sc);
 	malo_tx_cleanup(sc);
 	malo_hal_detach(sc->malo_mh);

Modified: head/sys/dev/malo/if_malo.h
==============================================================================
--- head/sys/dev/malo/if_malo.h	Thu Nov 19 22:06:19 2009	(r199558)
+++ head/sys/dev/malo/if_malo.h	Thu Nov 19 22:06:40 2009	(r199559)
@@ -550,6 +550,8 @@ struct malo_softc {
 
 	struct malo_txq		malo_txq[MALO_NUM_TX_QUEUES];
 	struct task		malo_txtask;	/* tx int processing */
+	struct callout	malo_watchdog_timer;
+	int			malo_timer;
 
 	struct malo_tx_radiotap_header malo_tx_th;
 	struct malo_rx_radiotap_header malo_rx_th;

Modified: head/sys/dev/mwl/if_mwl.c
==============================================================================
--- head/sys/dev/mwl/if_mwl.c	Thu Nov 19 22:06:19 2009	(r199558)
+++ head/sys/dev/mwl/if_mwl.c	Thu Nov 19 22:06:40 2009	(r199559)
@@ -98,7 +98,7 @@ static void	mwl_start(struct ifnet *);
 static int	mwl_raw_xmit(struct ieee80211_node *, struct mbuf *,
 			const struct ieee80211_bpf_params *);
 static int	mwl_media_change(struct ifnet *);
-static void	mwl_watchdog(struct ifnet *);
+static void	mwl_watchdog(void *);
 static int	mwl_ioctl(struct ifnet *, u_long, caddr_t);
 static void	mwl_radar_proc(void *, int);
 static void	mwl_chanswitch_proc(void *, int);
@@ -360,6 +360,7 @@ mwl_attach(uint16_t devid, struct mwl_so
 		goto bad1;
 
 	callout_init(&sc->sc_timer, CALLOUT_MPSAFE);
+	callout_init_mtx(&sc->sc_watchdog, &sc->sc_mtx, 0);
 
 	sc->sc_tq = taskqueue_create("mwl_taskq", M_NOWAIT,
 		taskqueue_thread_enqueue, &sc->sc_tq);
@@ -401,7 +402,6 @@ mwl_attach(uint16_t devid, struct mwl_so
 	ifp->if_softc = sc;
 	ifp->if_flags = IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST;
 	ifp->if_start = mwl_start;
-	ifp->if_watchdog = mwl_watchdog;
 	ifp->if_ioctl = mwl_ioctl;
 	ifp->if_init = mwl_init;
 	IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN);
@@ -558,6 +558,7 @@ mwl_detach(struct mwl_softc *sc)
 	 * Other than that, it's straightforward...
 	 */
 	ieee80211_ifdetach(ic);
+	callout_drain(&sc->sc_watchdog);
 	mwl_dma_cleanup(sc);
 	mwl_tx_cleanup(sc);
 	mwl_hal_detach(sc->sc_mh);
@@ -1214,6 +1215,7 @@ mwl_init_locked(struct mwl_softc *sc)
 
 	ifp->if_drv_flags |= IFF_DRV_RUNNING;
 	mwl_hal_intrset(mh, sc->sc_imask);
+	callout_reset(&sc->sc_watchdog, hz, mwl_watchdog, sc);
 
 	return 0;
 }
@@ -1251,7 +1253,8 @@ mwl_stop_locked(struct ifnet *ifp, int d
 		 * Shutdown the hardware and driver.
 		 */
 		ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
-		ifp->if_timer = 0;
+		callout_stop(&sc->sc_watchdog);
+		sc->sc_tx_timer = 0;
 		mwl_draintxq(sc);
 	}
 }
@@ -3411,7 +3414,7 @@ mwl_tx_start(struct mwl_softc *sc, struc
 	MWL_TXDESC_SYNC(txq, ds, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 
 	ifp->if_opackets++;
-	ifp->if_timer = 5;
+	sc->sc_tx_timer = 5;
 	MWL_TXQ_UNLOCK(txq);
 
 	return 0;
@@ -3558,7 +3561,7 @@ mwl_tx_proc(void *arg, int npending)
 
 	if (nreaped != 0) {
 		ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
-		ifp->if_timer = 0;
+		sc->sc_tx_timer = 0;
 		if (!IFQ_IS_EMPTY(&ifp->if_snd)) {
 			/* NB: kick fw; the tx thread may have been preempted */
 			mwl_hal_txstart(sc->sc_mh, 0);
@@ -3624,7 +3627,7 @@ mwl_draintxq(struct mwl_softc *sc)
 	for (i = 0; i < MWL_NUM_TX_QUEUES; i++)
 		mwl_tx_draintxq(sc, &sc->sc_txq[i]);
 	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
-	ifp->if_timer = 0;
+	sc->sc_tx_timer = 0;
 }
 
 #ifdef MWL_DIAGAPI
@@ -4770,10 +4773,17 @@ mwl_txq_dump(struct mwl_txq *txq)
 #endif
 
 static void
-mwl_watchdog(struct ifnet *ifp)
+mwl_watchdog(void *arg)
 {
-	struct mwl_softc *sc = ifp->if_softc;
+	struct mwl_softc *sc;
+	struct ifnet *ifp;
+
+	sc = arg;
+	callout_reset(&sc->sc_watchdog, hz, mwl_watchdog, sc);
+	if (sc->sc_tx_timer == 0 || --sc->sc_tx_timer > 0)
+		return;
 
+	ifp = sc->sc_ifp;
 	if ((ifp->if_drv_flags & IFF_DRV_RUNNING) && !sc->sc_invalid) {
 		if (mwl_hal_setkeepalive(sc->sc_mh))
 			if_printf(ifp, "transmit timeout (firmware hung?)\n");

Modified: head/sys/dev/mwl/if_mwlvar.h
==============================================================================
--- head/sys/dev/mwl/if_mwlvar.h	Thu Nov 19 22:06:19 2009	(r199558)
+++ head/sys/dev/mwl/if_mwlvar.h	Thu Nov 19 22:06:40 2009	(r199559)
@@ -255,6 +255,8 @@ struct mwl_softc {
 	bus_space_tag_t		sc_io1t;
 	struct mtx		sc_mtx;		/* master lock (recursive) */
 	struct taskqueue	*sc_tq;		/* private task queue */
+	struct callout	sc_watchdog;
+	int			sc_tx_timer;
 	unsigned int		sc_invalid : 1,	/* disable hardware accesses */
 				sc_recvsetup:1,	/* recv setup */
 				sc_csapending:1,/* 11h channel switch pending */

Modified: head/sys/dev/sn/if_sn.c
==============================================================================
--- head/sys/dev/sn/if_sn.c	Thu Nov 19 22:06:19 2009	(r199558)
+++ head/sys/dev/sn/if_sn.c	Thu Nov 19 22:06:40 2009	(r199559)
@@ -82,6 +82,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -121,6 +122,7 @@ static int snioctl(struct ifnet * ifp, u
 
 static void snresume(struct ifnet *);
 
+static void snintr_locked(struct sn_softc *);
 static void sninit_locked(void *);
 static void snstart_locked(struct ifnet *);
 
@@ -128,7 +130,7 @@ static void sninit(void *);
 static void snread(struct ifnet *);
 static void snstart(struct ifnet *);
 static void snstop(struct sn_softc *);
-static void snwatchdog(struct ifnet *);
+static void snwatchdog(void *);
 
 static void sn_setmcast(struct sn_softc *);
 static int sn_getmcf(struct ifnet *ifp, u_char *mcf);
@@ -170,6 +172,7 @@ sn_attach(device_t dev)
 	}
 
 	SN_LOCK_INIT(sc);
+	callout_init_mtx(&sc->watchdog, &sc->sc_mtx, 0);
 	snstop(sc);
 	sc->pages_wanted = -1;
 
@@ -202,13 +205,11 @@ sn_attach(device_t dev)
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
 	ifp->if_start = snstart;
 	ifp->if_ioctl = snioctl;
-	ifp->if_watchdog = snwatchdog;
 	ifp->if_init = sninit;
 	ifp->if_baudrate = 10000000;
 	IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN);
 	ifp->if_snd.ifq_maxlen = IFQ_MAXLEN;
 	IFQ_SET_READY(&ifp->if_snd);
-	ifp->if_timer = 0;
 
 	ether_ifattach(ifp, eaddr);
 
@@ -233,9 +234,11 @@ sn_detach(device_t dev)
 	struct sn_softc	*sc = device_get_softc(dev);
 	struct ifnet	*ifp = sc->ifp;
 
-	snstop(sc);
-	ifp->if_drv_flags &= ~IFF_DRV_RUNNING; 
 	ether_ifdetach(ifp);
+	SN_LOCK(sc);
+	snstop(sc);
+	SN_UNLOCK(sc);
+	callout_drain(&sc->watchdog);
 	sn_deactivate(dev);
 	if_free(ifp);
 	SN_LOCK_DESTROY(sc);
@@ -342,6 +345,7 @@ sninit_locked(void *xsc)
 	 */
 	ifp->if_drv_flags |= IFF_DRV_RUNNING;
 	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
+	callout_reset(&sc->watchdog, hz, snwatchdog, sc);
 
 	/*
 	 * Attempt to push out any waiting packets.
@@ -463,7 +467,7 @@ startagain:
 		CSR_WRITE_1(sc, INTR_MASK_REG_B, mask);
 		sc->intr_mask = mask;
 
-		ifp->if_timer = 1;
+		sc->timer = 1;
 		ifp->if_drv_flags |= IFF_DRV_OACTIVE;
 		sc->pages_wanted = numPages;
 		return;
@@ -548,7 +552,7 @@ startagain:
 	CSR_WRITE_2(sc, MMU_CMD_REG_W, MMUCR_ENQUEUE);
 
 	ifp->if_drv_flags |= IFF_DRV_OACTIVE;
-	ifp->if_timer = 1;
+	sc->timer = 1;
 
 	BPF_MTAP(ifp, top);
 
@@ -657,7 +661,7 @@ snresume(struct ifnet *ifp)
 	packet_no = CSR_READ_1(sc, ALLOC_RESULT_REG_B);
 	if (packet_no & ARR_FAILED) {
 		if_printf(ifp, "Memory allocation failed.  Weird.\n");
-		ifp->if_timer = 1;
+		sc->timer = 1;
 		goto try_start;
 	}
 	/*
@@ -755,24 +759,32 @@ try_start:
 	 * Now pass control to snstart() to queue any additional packets
 	 */
 	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
-	snstart(ifp);
+	snstart_locked(ifp);
 
 	/*
 	 * We've sent something, so we're active.  Set a watchdog in case the
 	 * TX_EMPTY interrupt is lost.
 	 */
 	ifp->if_drv_flags |= IFF_DRV_OACTIVE;
-	ifp->if_timer = 1;
+	sc->timer = 1;
 
 	return;
 }
 
-
 void
 sn_intr(void *arg)
 {
-	int             status, interrupts;
 	struct sn_softc *sc = (struct sn_softc *) arg;
+
+	SN_LOCK(sc);
+	snintr_locked(sc);
+	SN_UNLOCK(sc);
+}
+
+static void
+snintr_locked(struct sn_softc *sc)
+{
+	int             status, interrupts;
 	struct ifnet   *ifp = sc->ifp;
 
 	/*
@@ -783,12 +795,10 @@ sn_intr(void *arg)
 	uint16_t        tx_status;
 	uint16_t        card_stats;
 
-	SN_LOCK(sc);
-
 	/*
 	 * Clear the watchdog.
 	 */
-	ifp->if_timer = 0;
+	sc->timer = 0;
 
 	SMC_SELECT_BANK(sc, 2);
 
@@ -981,7 +991,6 @@ out:
 	mask |= CSR_READ_1(sc, INTR_MASK_REG_B);
 	CSR_WRITE_1(sc, INTR_MASK_REG_B, mask);
 	sc->intr_mask = mask;
-	SN_UNLOCK(sc);
 }
 
 static void
@@ -1136,7 +1145,6 @@ snioctl(struct ifnet *ifp, u_long cmd, c
 		SN_LOCK(sc);
 		if ((ifp->if_flags & IFF_UP) == 0 &&
 		    ifp->if_drv_flags & IFF_DRV_RUNNING) {
-			ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 			snstop(sc);
 		} else {
 			/* reinitialize card on any parameter change */
@@ -1161,9 +1169,16 @@ snioctl(struct ifnet *ifp, u_long cmd, c
 }
 
 static void
-snwatchdog(struct ifnet *ifp)
+snwatchdog(void *arg)
 {
-	sn_intr(ifp->if_softc);
+	struct sn_softc *sc;
+
+	sc = arg;
+	SN_ASSERT_LOCKED(sc);
+	callout_reset(&sc->watchdog, hz, snwatchdog, sc);
+	if (sc->timer == 0 || --sc->timer > 0)
+		return;
+	snintr_locked(sc);
 }
 
 
@@ -1193,7 +1208,9 @@ snstop(struct sn_softc *sc)
 	/*
 	 * Cancel watchdog.
 	 */
-	ifp->if_timer = 0;
+	sc->timer = 0;
+	callout_stop(&sc->watchdog);
+	ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
 }
 
 

Modified: head/sys/dev/sn/if_snvar.h
==============================================================================
--- head/sys/dev/sn/if_snvar.h	Thu Nov 19 22:06:19 2009	(r199558)
+++ head/sys/dev/sn/if_snvar.h	Thu Nov 19 22:06:40 2009	(r199559)
@@ -33,6 +33,8 @@
 struct sn_softc {
 	struct ifnet    *ifp;
 	struct mtx sc_mtx;
+	struct callout watchdog;
+	int		timer;
 	int             pages_wanted;	/* Size of outstanding MMU ALLOC */
 	int             intr_mask;	/* Most recently set interrupt mask */
 	device_t	dev;

Modified: head/sys/dev/ste/if_ste.c
==============================================================================
--- head/sys/dev/ste/if_ste.c	Thu Nov 19 22:06:19 2009	(r199558)
+++ head/sys/dev/ste/if_ste.c	Thu Nov 19 22:06:40 2009	(r199559)
@@ -108,7 +108,7 @@ static int ste_ioctl(struct ifnet *, u_l
 static int ste_encap(struct ste_softc *, struct ste_chain *, struct mbuf *);
 static void ste_start(struct ifnet *);
 static void ste_start_locked(struct ifnet *);
-static void ste_watchdog(struct ifnet *);
+static void ste_watchdog(struct ste_softc *);
 static int ste_shutdown(device_t);
 static int ste_newbuf(struct ste_softc *, struct ste_chain_onefrag *,
 		struct mbuf *);
@@ -924,7 +924,7 @@ ste_txeof(sc)
 
 	sc->ste_cdata.ste_tx_cons = idx;
 	if (idx == sc->ste_cdata.ste_tx_prod)
-		ifp->if_timer = 0;
+		sc->ste_timer = 0;
 }
 
 static void
@@ -960,6 +960,8 @@ ste_stats_update(xsc)
 		}
 	}
 
+	if (sc->ste_timer > 0 && --sc->ste_timer == 0)
+		ste_watchdog(sc);
 	callout_reset(&sc->ste_stat_callout, hz, ste_stats_update, sc);
 
 	return;
@@ -1094,7 +1096,6 @@ ste_attach(dev)
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
 	ifp->if_ioctl = ste_ioctl;
 	ifp->if_start = ste_start;
-	ifp->if_watchdog = ste_watchdog;
 	ifp->if_init = ste_init;
 	IFQ_SET_MAXLEN(&ifp->if_snd, STE_TX_LIST_CNT - 1);
 	ifp->if_snd.ifq_drv_maxlen = STE_TX_LIST_CNT - 1;
@@ -1159,11 +1160,11 @@ ste_detach(dev)
 
 	/* These should only be active if attach succeeded */
 	if (device_is_attached(dev)) {
+		ether_ifdetach(ifp);
 		STE_LOCK(sc);
 		ste_stop(sc);
 		STE_UNLOCK(sc);
 		callout_drain(&sc->ste_stat_callout);
-		ether_ifdetach(ifp);
 	}
 	if (sc->ste_miibus)
 		device_delete_child(dev, sc->ste_miibus);
@@ -1708,7 +1709,7 @@ ste_start_locked(ifp)
 		BPF_MTAP(ifp, cur_tx->ste_mbuf);
 
 		STE_INC(idx, STE_TX_LIST_CNT);
-		ifp->if_timer = 5;
+		sc->ste_timer = 5;
 	}
 	sc->ste_cdata.ste_tx_prod = idx;
 
@@ -1716,13 +1717,12 @@ ste_start_locked(ifp)
 }
 
 static void
-ste_watchdog(ifp)
-	struct ifnet		*ifp;
+ste_watchdog(struct ste_softc *sc)
 {
-	struct ste_softc	*sc;
+	struct ifnet		*ifp;
 
-	sc = ifp->if_softc;
-	STE_LOCK(sc);
+	ifp = sc->ste_ifp;
+	STE_LOCK_ASSERT(sc);
 
 	ifp->if_oerrors++;
 	if_printf(ifp, "watchdog timeout\n");
@@ -1736,7 +1736,6 @@ ste_watchdog(ifp)
 
 	if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
 		ste_start_locked(ifp);
-	STE_UNLOCK(sc);
 
 	return;
 }

Modified: head/sys/dev/ste/if_stereg.h
==============================================================================
--- head/sys/dev/ste/if_stereg.h	Thu Nov 19 22:06:19 2009	(r199558)
+++ head/sys/dev/ste/if_stereg.h	Thu Nov 19 22:06:40 2009	(r199559)
@@ -517,6 +517,7 @@ struct ste_softc {
 	int			ste_tx_thresh;
 	u_int8_t		ste_link;
 	int			ste_if_flags;
+	int			ste_timer;
 	struct ste_chain	*ste_tx_prev;
 	struct ste_list_data	*ste_ldata;
 	struct ste_chain_data	ste_cdata;

Modified: head/sys/dev/ti/if_ti.c
==============================================================================
--- head/sys/dev/ti/if_ti.c	Thu Nov 19 22:06:19 2009	(r199558)
+++ head/sys/dev/ti/if_ti.c	Thu Nov 19 22:06:40 2009	(r199559)
@@ -194,7 +194,7 @@ static void ti_init(void *);
 static void ti_init_locked(void *);
 static void ti_init2(struct ti_softc *);
 static void ti_stop(struct ti_softc *);
-static void ti_watchdog(struct ifnet *);
+static void ti_watchdog(void *);
 static int ti_shutdown(device_t);
 static int ti_ifmedia_upd(struct ifnet *);
 static void ti_ifmedia_sts(struct ifnet *, struct ifmediareq *);
@@ -2285,6 +2285,7 @@ ti_attach(dev)
 
 	mtx_init(&sc->ti_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
 	    MTX_DEF);
+	callout_init_mtx(&sc->ti_watchdog, &sc->ti_mtx, 0);
 	ifmedia_init(&sc->ifmedia, IFM_IMASK, ti_ifmedia_upd, ti_ifmedia_sts);
 	ifp = sc->ti_ifp = if_alloc(IFT_ETHER);
 	if (ifp == NULL) {
@@ -2486,7 +2487,6 @@ ti_attach(dev)
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
 	ifp->if_ioctl = ti_ioctl;
 	ifp->if_start = ti_start;
-	ifp->if_watchdog = ti_watchdog;
 	ifp->if_init = ti_init;
 	ifp->if_baudrate = 1000000000;
 	ifp->if_mtu = ETHERMTU;
@@ -2565,24 +2565,22 @@ ti_detach(dev)
 {
 	struct ti_softc		*sc;
 	struct ifnet		*ifp;
-	int			attached;
 
 	sc = device_get_softc(dev);
 	if (sc->dev)
 		destroy_dev(sc->dev);
 	KASSERT(mtx_initialized(&sc->ti_mtx), ("ti mutex not initialized"));
-	attached = device_is_attached(dev);
-	TI_LOCK(sc);
 	ifp = sc->ti_ifp;
-	if (attached)
-		ti_stop(sc);
-	TI_UNLOCK(sc);
-	if (attached)
+	if (device_is_attached(dev)) {
 		ether_ifdetach(ifp);
+		TI_LOCK(sc);
+		ti_stop(sc);
+		TI_UNLOCK(sc);
+	}
 
 	/* These should only be active if attach succeeded */
-	if (attached)
-		bus_generic_detach(dev);
+	callout_drain(&sc->ti_watchdog);
+	bus_generic_detach(dev);
 	ti_free_dmamaps(sc);
 	ifmedia_removeall(&sc->ifmedia);
 
@@ -2866,7 +2864,7 @@ ti_txeof(sc)
 	}
 	sc->ti_tx_saved_considx = idx;
 
-	ifp->if_timer = sc->ti_txcnt > 0 ? 5 : 0;
+	sc->ti_timer = sc->ti_txcnt > 0 ? 5 : 0;
 }
 
 static void
@@ -3121,7 +3119,7 @@ ti_start_locked(ifp)
 		/*
 		 * Set a timeout in case the chip goes out to lunch.
 		 */
-		ifp->if_timer = 5;
+		sc->ti_timer = 5;
 	}
 }
 
@@ -3225,6 +3223,7 @@ static void ti_init2(sc)
 
 	ifp->if_drv_flags |= IFF_DRV_RUNNING;
 	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
+	callout_reset(&sc->ti_watchdog, hz, ti_watchdog, sc);
 
 	/*
 	 * Make sure to set media properly. We have to do this
@@ -3786,30 +3785,31 @@ ti_ioctl2(struct cdev *dev, u_long cmd, 
 }
 
 static void
-ti_watchdog(ifp)
-	struct ifnet		*ifp;
+ti_watchdog(void *arg)
 {
 	struct ti_softc		*sc;
+	struct ifnet		*ifp;
 
-	sc = ifp->if_softc;
-	TI_LOCK(sc);
+	sc = arg;
+	TI_LOCK_ASSERT(sc);
+	callout_reset(&sc->ti_watchdog, hz, ti_watchdog, sc);

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 22:14:23 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CDF49106566C;
	Thu, 19 Nov 2009 22: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 BACD18FC08;
	Thu, 19 Nov 2009 22:14:23 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAJMEN4L021567;
	Thu, 19 Nov 2009 22:14:23 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAJMENe4021556;
	Thu, 19 Nov 2009 22:14:23 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200911192214.nAJMENe4021556@svn.freebsd.org>
From: John Baldwin 
Date: Thu, 19 Nov 2009 22:14: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: r199560 - in head/sys/dev: lge nve pcn tl wb
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 22:14:23 -0000

Author: jhb
Date: Thu Nov 19 22:14:23 2009
New Revision: 199560
URL: http://svn.freebsd.org/changeset/base/199560

Log:
  - Hook into the existing stat timer to drive the transmit watchdog instead
    of using if_watchdog and if_timer.
  - Reorder detach to call ether_ifdetach() before anything else in tl(4)
    and wb(4).

Modified:
  head/sys/dev/lge/if_lge.c
  head/sys/dev/lge/if_lgereg.h
  head/sys/dev/nve/if_nve.c
  head/sys/dev/nve/if_nvereg.h
  head/sys/dev/pcn/if_pcn.c
  head/sys/dev/pcn/if_pcnreg.h
  head/sys/dev/tl/if_tl.c
  head/sys/dev/tl/if_tlreg.h
  head/sys/dev/wb/if_wb.c
  head/sys/dev/wb/if_wbreg.h

Modified: head/sys/dev/lge/if_lge.c
==============================================================================
--- head/sys/dev/lge/if_lge.c	Thu Nov 19 22:06:40 2009	(r199559)
+++ head/sys/dev/lge/if_lge.c	Thu Nov 19 22:14:23 2009	(r199560)
@@ -137,7 +137,7 @@ static int lge_ioctl(struct ifnet *, u_l
 static void lge_init(void *);
 static void lge_init_locked(struct lge_softc *);
 static void lge_stop(struct lge_softc *);
-static void lge_watchdog(struct ifnet *);
+static void lge_watchdog(struct lge_softc *);
 static int lge_shutdown(device_t);
 static int lge_ifmedia_upd(struct ifnet *);
 static void lge_ifmedia_upd_locked(struct ifnet *);
@@ -544,7 +544,6 @@ lge_attach(dev)
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
 	ifp->if_ioctl = lge_ioctl;
 	ifp->if_start = lge_start;
-	ifp->if_watchdog = lge_watchdog;
 	ifp->if_init = lge_init;
 	ifp->if_snd.ifq_maxlen = LGE_TX_LIST_CNT - 1;
 	ifp->if_capabilities = IFCAP_RXCSUM;
@@ -1000,7 +999,7 @@ lge_txeof(sc)
 	ifp = sc->lge_ifp;
 
 	/* Clear the timeout timer. */
-	ifp->if_timer = 0;
+	sc->lge_timer = 0;
 
 	/*
 	 * Go through our tx list and free mbufs for those
@@ -1021,7 +1020,7 @@ lge_txeof(sc)
 
 		txdone--;
 		LGE_INC(idx, LGE_TX_LIST_CNT);
-		ifp->if_timer = 0;
+		sc->lge_timer = 0;
 	}
 
 	sc->lge_cdata.lge_tx_cons = idx;
@@ -1064,6 +1063,8 @@ lge_tick(xsc)
 		}
 	}
 
+	if (sc->lge_timer != 0 && --sc->lge_timer == 0)
+		lge_watchdog(sc);
 	callout_reset(&sc->lge_stat_callout, hz, lge_tick, sc);
 
 	return;
@@ -1236,7 +1237,7 @@ lge_start_locked(ifp)
 	/*
 	 * Set a timeout in case the chip goes out to lunch.
 	 */
-	ifp->if_timer = 5;
+	sc->lge_timer = 5;
 
 	return;
 }
@@ -1506,14 +1507,14 @@ lge_ioctl(ifp, command, data)
 }
 
 static void
-lge_watchdog(ifp)
-	struct ifnet		*ifp;
-{
+lge_watchdog(sc)
 	struct lge_softc	*sc;
+{
+	struct ifnet		*ifp;
 
-	sc = ifp->if_softc;
+	LGE_LOCK_ASSERT(sc);
+	ifp = sc->lge_ifp;
 
-	LGE_LOCK(sc);
 	ifp->if_oerrors++;
 	if_printf(ifp, "watchdog timeout\n");
 
@@ -1524,9 +1525,6 @@ lge_watchdog(ifp)
 
 	if (ifp->if_snd.ifq_head != NULL)
 		lge_start_locked(ifp);
-	LGE_UNLOCK(sc);
-
-	return;
 }
 
 /*
@@ -1542,7 +1540,7 @@ lge_stop(sc)
 
 	LGE_LOCK_ASSERT(sc);
 	ifp = sc->lge_ifp;
-	ifp->if_timer = 0;
+	sc->lge_timer = 0;
 	callout_stop(&sc->lge_stat_callout);
 	CSR_WRITE_4(sc, LGE_IMR, LGE_IMR_INTR_ENB);
 

Modified: head/sys/dev/lge/if_lgereg.h
==============================================================================
--- head/sys/dev/lge/if_lgereg.h	Thu Nov 19 22:06:40 2009	(r199559)
+++ head/sys/dev/lge/if_lgereg.h	Thu Nov 19 22:14:23 2009	(r199560)
@@ -534,6 +534,7 @@ struct lge_softc {
 	u_int8_t		lge_link;
 	u_int8_t		lge_pcs;
 	int			lge_if_flags;
+	int			lge_timer;
 	struct lge_list_data	*lge_ldata;
 	struct lge_ring_data	lge_cdata;
 	struct callout		lge_stat_callout;

Modified: head/sys/dev/nve/if_nve.c
==============================================================================
--- head/sys/dev/nve/if_nve.c	Thu Nov 19 22:06:40 2009	(r199559)
+++ head/sys/dev/nve/if_nve.c	Thu Nov 19 22:14:23 2009	(r199560)
@@ -140,7 +140,7 @@ static int      nve_ioctl(struct ifnet *
 static void     nve_intr(void *);
 static void     nve_tick(void *);
 static void     nve_setmulti(struct nve_softc *);
-static void     nve_watchdog(struct ifnet *);
+static void     nve_watchdog(struct nve_softc *);
 static void     nve_update_stats(struct nve_softc *);
 
 static int      nve_ifmedia_upd(struct ifnet *);
@@ -540,8 +540,6 @@ nve_attach(device_t dev)
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
 	ifp->if_ioctl = nve_ioctl;
 	ifp->if_start = nve_ifstart;
-	ifp->if_watchdog = nve_watchdog;
-	ifp->if_timer = 0;
 	ifp->if_init = nve_init;
 	ifp->if_mtu = ETHERMTU;
 	ifp->if_baudrate = IF_Mbps(100);
@@ -709,7 +707,7 @@ nve_stop(struct nve_softc *sc)
 	DEBUGOUT(NVE_DEBUG_RUNNING, "nve: nve_stop - entry\n");
 
 	ifp = sc->ifp;
-	ifp->if_timer = 0;
+	sc->tx_timer = 0;
 
 	/* Cancel tick timer */
 	callout_stop(&sc->stat_callout);
@@ -983,7 +981,7 @@ nve_ifstart_locked(struct ifnet *ifp)
 			return;
 		}
 		/* Set watchdog timer. */
-		ifp->if_timer = 8;
+		sc->tx_timer = 8;
 
 		/* Copy packet to BPF tap */
 		BPF_MTAP(ifp, m0);
@@ -1095,7 +1093,7 @@ nve_intr(void *arg)
 
 	/* If no pending packets we don't need a timeout */
 	if (sc->pending_txs == 0)
-		sc->ifp->if_timer = 0;
+		sc->tx_timer = 0;
 	NVE_UNLOCK(sc);
 
 	DEBUGOUT(NVE_DEBUG_INTERRUPT, "nve: nve_intr - exit\n");
@@ -1236,6 +1234,9 @@ nve_tick(void *xsc)
 		if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
 			nve_ifstart_locked(ifp);
 	}
+
+	if (sc->tx_timer > 0 && --sc->tx_timer == 0)
+		nve_watchdog(sc);
 	callout_reset(&sc->stat_callout, hz, nve_tick, sc);
 
 	return;
@@ -1307,12 +1308,13 @@ nve_miibus_writereg(device_t dev, int ph
 
 /* Watchdog timer to prevent PHY lockups */
 static void
-nve_watchdog(struct ifnet *ifp)
+nve_watchdog(struct nve_softc *sc)
 {
-	struct nve_softc *sc = ifp->if_softc;
+	struct ifnet *ifp;
 	int pending_txs_start;
 
-	NVE_LOCK(sc);
+	NVE_LOCK_ASSERT(sc);
+	ifp = sc->ifp;
 
 	/*
 	 * The nvidia driver blob defers tx completion notifications.
@@ -1328,24 +1330,18 @@ nve_watchdog(struct ifnet *ifp)
 	sc->hwapi->pfnDisableInterrupts(sc->hwapi->pADCX);
 	sc->hwapi->pfnHandleInterrupt(sc->hwapi->pADCX);
 	sc->hwapi->pfnEnableInterrupts(sc->hwapi->pADCX);
-	if (sc->pending_txs < pending_txs_start) {
-		NVE_UNLOCK(sc);
+	if (sc->pending_txs < pending_txs_start)
 		return;
-	}
 
 	device_printf(sc->dev, "device timeout (%d)\n", sc->pending_txs);
 
 	sc->tx_errors++;
 
 	nve_stop(sc);
-	ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 	nve_init_locked(sc);
 
 	if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
 		nve_ifstart_locked(ifp);
-	NVE_UNLOCK(sc);
-
-	return;
 }
 
 /* --- Start of NVOSAPI interface --- */

Modified: head/sys/dev/nve/if_nvereg.h
==============================================================================
--- head/sys/dev/nve/if_nvereg.h	Thu Nov 19 22:06:40 2009	(r199559)
+++ head/sys/dev/nve/if_nvereg.h	Thu Nov 19 22:14:23 2009	(r199560)
@@ -138,6 +138,7 @@ struct nve_softc {
 	device_t miibus;
 	device_t dev;
 	struct callout stat_callout;
+	int tx_timer;
 
 	void *sc_ih;
 	bus_space_tag_t sc_st;

Modified: head/sys/dev/pcn/if_pcn.c
==============================================================================
--- head/sys/dev/pcn/if_pcn.c	Thu Nov 19 22:06:40 2009	(r199559)
+++ head/sys/dev/pcn/if_pcn.c	Thu Nov 19 22:14:23 2009	(r199560)
@@ -143,7 +143,7 @@ static int pcn_ioctl(struct ifnet *, u_l
 static void pcn_init(void *);
 static void pcn_init_locked(struct pcn_softc *);
 static void pcn_stop(struct pcn_softc *);
-static void pcn_watchdog(struct ifnet *);
+static void pcn_watchdog(struct pcn_softc *);
 static int pcn_shutdown(device_t);
 static int pcn_ifmedia_upd(struct ifnet *);
 static void pcn_ifmedia_sts(struct ifnet *, struct ifmediareq *);
@@ -630,7 +630,6 @@ pcn_attach(dev)
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
 	ifp->if_ioctl = pcn_ioctl;
 	ifp->if_start = pcn_start;
-	ifp->if_watchdog = pcn_watchdog;
 	ifp->if_init = pcn_init;
 	ifp->if_snd.ifq_maxlen = PCN_TX_LIST_CNT - 1;
 
@@ -948,7 +947,7 @@ pcn_txeof(sc)
 		sc->pcn_cdata.pcn_tx_cons = idx;
 		ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
 	}
-	ifp->if_timer = (sc->pcn_cdata.pcn_tx_cnt == 0) ? 0 : 5;
+	sc->pcn_timer = (sc->pcn_cdata.pcn_tx_cnt == 0) ? 0 : 5;
 
 	return;
 }
@@ -980,6 +979,8 @@ pcn_tick(xsc)
 			pcn_start_locked(ifp);
 	}
 
+	if (sc->pcn_timer > 0 && --sc->pcn_timer == 0)
+		pcn_watchdog(sc);
 	callout_reset(&sc->pcn_stat_callout, hz, pcn_tick, sc);
 
 	return;
@@ -1147,7 +1148,7 @@ pcn_start_locked(ifp)
 	/*
 	 * Set a timeout in case the chip goes out to lunch.
 	 */
-	ifp->if_timer = 5;
+	sc->pcn_timer = 5;
 
 	return;
 }
@@ -1429,14 +1430,12 @@ pcn_ioctl(ifp, command, data)
 }
 
 static void
-pcn_watchdog(ifp)
-	struct ifnet		*ifp;
+pcn_watchdog(struct pcn_softc *sc)
 {
-	struct pcn_softc	*sc;
-
-	sc = ifp->if_softc;
+	struct ifnet		*ifp;
 
-	PCN_LOCK(sc);
+	PCN_LOCK_ASSERT(sc);
+	ifp = sc->pcn_ifp;
 
 	ifp->if_oerrors++;
 	if_printf(ifp, "watchdog timeout\n");
@@ -1447,10 +1446,6 @@ pcn_watchdog(ifp)
 
 	if (ifp->if_snd.ifq_head != NULL)
 		pcn_start_locked(ifp);
-
-	PCN_UNLOCK(sc);
-
-	return;
 }
 
 /*
@@ -1465,7 +1460,7 @@ pcn_stop(struct pcn_softc *sc)
 
 	PCN_LOCK_ASSERT(sc);
 	ifp = sc->pcn_ifp;
-	ifp->if_timer = 0;
+	sc->pcn_timer = 0;
 
 	callout_stop(&sc->pcn_stat_callout);
 

Modified: head/sys/dev/pcn/if_pcnreg.h
==============================================================================
--- head/sys/dev/pcn/if_pcnreg.h	Thu Nov 19 22:06:40 2009	(r199559)
+++ head/sys/dev/pcn/if_pcnreg.h	Thu Nov 19 22:14:23 2009	(r199560)
@@ -465,6 +465,7 @@ struct pcn_softc {
 	struct pcn_ring_data	pcn_cdata;
 	struct callout		pcn_stat_callout;
 	struct mtx		pcn_mtx;
+	int			pcn_timer;
 };
 
 #define	PCN_LOCK(_sc)		mtx_lock(&(_sc)->pcn_mtx)

Modified: head/sys/dev/tl/if_tl.c
==============================================================================
--- head/sys/dev/tl/if_tl.c	Thu Nov 19 22:06:40 2009	(r199559)
+++ head/sys/dev/tl/if_tl.c	Thu Nov 19 22:14:23 2009	(r199560)
@@ -281,7 +281,7 @@ static int tl_ioctl(struct ifnet *, u_lo
 static void tl_init(void *);
 static void tl_init_locked(struct tl_softc *);
 static void tl_stop(struct tl_softc *);
-static void tl_watchdog(struct ifnet *);
+static void tl_watchdog(struct tl_softc *);
 static int tl_shutdown(device_t);
 static int tl_ifmedia_upd(struct ifnet *);
 static void tl_ifmedia_sts(struct ifnet *, struct ifmediareq *);
@@ -1260,7 +1260,6 @@ tl_attach(dev)
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
 	ifp->if_ioctl = tl_ioctl;
 	ifp->if_start = tl_start;
-	ifp->if_watchdog = tl_watchdog;
 	ifp->if_init = tl_init;
 	ifp->if_mtu = ETHERMTU;
 	ifp->if_snd.ifq_maxlen = TL_TX_LIST_CNT - 1;
@@ -1337,11 +1336,11 @@ tl_detach(dev)
 
 	/* These should only be active if attach succeeded */
 	if (device_is_attached(dev)) {
+		ether_ifdetach(ifp);
 		TL_LOCK(sc);
 		tl_stop(sc);
 		TL_UNLOCK(sc);
 		callout_drain(&sc->tl_stat_callout);
-		ether_ifdetach(ifp);
 	}
 	if (sc->tl_miibus)
 		device_delete_child(dev, sc->tl_miibus);
@@ -1635,7 +1634,7 @@ tl_intvec_txeoc(xsc, type)
 	ifp = sc->tl_ifp;
 
 	/* Clear the timeout timer. */
-	ifp->if_timer = 0;
+	sc->tl_timer = 0;
 
 	if (sc->tl_cdata.tl_tx_head == NULL) {
 		ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
@@ -1821,6 +1820,9 @@ tl_stats_update(xsc)
 		}
 	}
 
+	if (sc->tl_timer > 0 && --sc->tl_timer == 0)
+		tl_watchdog(sc);
+
 	callout_reset(&sc->tl_stat_callout, hz, tl_stats_update, sc);
 
 	if (!sc->tl_bitrate) {
@@ -2029,7 +2031,7 @@ tl_start_locked(ifp)
 	/*
 	 * Set a timeout in case the chip goes out to lunch.
 	 */
-	ifp->if_timer = 5;
+	sc->tl_timer = 5;
 
 	return;
 }
@@ -2254,21 +2256,20 @@ tl_ioctl(ifp, command, data)
 }
 
 static void
-tl_watchdog(ifp)
-	struct ifnet		*ifp;
-{
+tl_watchdog(sc)
 	struct tl_softc		*sc;
+{
+	struct ifnet		*ifp;
 
-	sc = ifp->if_softc;
+	TL_LOCK_ASSERT(sc);
+	ifp = sc->tl_ifp;
 
 	if_printf(ifp, "device timeout\n");
 
-	TL_LOCK(sc);
 	ifp->if_oerrors++;
 
 	tl_softreset(sc, 1);
 	tl_init_locked(sc);
-	TL_UNLOCK(sc);
 
 	return;
 }

Modified: head/sys/dev/tl/if_tlreg.h
==============================================================================
--- head/sys/dev/tl/if_tlreg.h	Thu Nov 19 22:06:40 2009	(r199559)
+++ head/sys/dev/tl/if_tlreg.h	Thu Nov 19 22:14:23 2009	(r199560)
@@ -125,6 +125,7 @@ struct tl_softc {
 	int			tl_if_flags;
 	struct callout		tl_stat_callout;
 	struct mtx		tl_mtx;
+	int			tl_timer;
 };
 
 #define	TL_LOCK(_sc)		mtx_lock(&(_sc)->tl_mtx)

Modified: head/sys/dev/wb/if_wb.c
==============================================================================
--- head/sys/dev/wb/if_wb.c	Thu Nov 19 22:06:40 2009	(r199559)
+++ head/sys/dev/wb/if_wb.c	Thu Nov 19 22:14:23 2009	(r199560)
@@ -158,7 +158,7 @@ static int wb_ioctl(struct ifnet *, u_lo
 static void wb_init(void *);
 static void wb_init_locked(struct wb_softc *);
 static void wb_stop(struct wb_softc *);
-static void wb_watchdog(struct ifnet *);
+static void wb_watchdog(struct wb_softc *);
 static int wb_shutdown(device_t);
 static int wb_ifmedia_upd(struct ifnet *);
 static void wb_ifmedia_sts(struct ifnet *, struct ifmediareq *);
@@ -849,7 +849,6 @@ wb_attach(dev)
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
 	ifp->if_ioctl = wb_ioctl;
 	ifp->if_start = wb_start;
-	ifp->if_watchdog = wb_watchdog;
 	ifp->if_init = wb_init;
 	ifp->if_snd.ifq_maxlen = WB_TX_LIST_CNT - 1;
 
@@ -907,11 +906,11 @@ wb_detach(dev)
 	 * This should only be done if attach succeeded.
 	 */
 	if (device_is_attached(dev)) {
+		ether_ifdetach(ifp);
 		WB_LOCK(sc);
 		wb_stop(sc);
 		WB_UNLOCK(sc);
 		callout_drain(&sc->wb_stat_callout);
-		ether_ifdetach(ifp);
 	}
 	if (sc->wb_miibus)
 		device_delete_child(dev, sc->wb_miibus);
@@ -1157,7 +1156,7 @@ wb_txeof(sc)
 	ifp = sc->wb_ifp;
 
 	/* Clear the timeout timer. */
-	ifp->if_timer = 0;
+	sc->wb_timer = 0;
 
 	if (sc->wb_cdata.wb_tx_head == NULL)
 		return;
@@ -1212,7 +1211,7 @@ wb_txeoc(sc)
 
 	ifp = sc->wb_ifp;
 
-	ifp->if_timer = 0;
+	sc->wb_timer = 0;
 
 	if (sc->wb_cdata.wb_tx_head == NULL) {
 		ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
@@ -1220,7 +1219,7 @@ wb_txeoc(sc)
 	} else {
 		if (WB_TXOWN(sc->wb_cdata.wb_tx_head) == WB_UNSENT) {
 			WB_TXOWN(sc->wb_cdata.wb_tx_head) = WB_TXSTAT_OWN;
-			ifp->if_timer = 5;
+			sc->wb_timer = 5;
 			CSR_WRITE_4(sc, WB_TXSTART, 0xFFFFFFFF);
 		}
 	}
@@ -1329,6 +1328,8 @@ wb_tick(xsc)
 
 	mii_tick(mii);
 
+	if (sc->wb_timer > 0 && --sc->wb_timer == 0)
+		wb_watchdog(sc);
 	callout_reset(&sc->wb_stat_callout, hz, wb_tick, sc);
 
 	return;
@@ -1529,7 +1530,7 @@ wb_start_locked(ifp)
 	/*
 	 * Set a timeout in case the chip goes out to lunch.
 	 */
-	ifp->if_timer = 5;
+	sc->wb_timer = 5;
 
 	return;
 }
@@ -1748,14 +1749,13 @@ wb_ioctl(ifp, command, data)
 }
 
 static void
-wb_watchdog(ifp)
-	struct ifnet		*ifp;
-{
+wb_watchdog(sc)
 	struct wb_softc		*sc;
+{
+	struct ifnet		*ifp;
 
-	sc = ifp->if_softc;
-
-	WB_LOCK(sc);
+	WB_LOCK_ASSERT(sc);
+	ifp = sc->wb_ifp;
 	ifp->if_oerrors++;
 	if_printf(ifp, "watchdog timeout\n");
 #ifdef foo
@@ -1768,7 +1768,6 @@ wb_watchdog(ifp)
 
 	if (ifp->if_snd.ifq_head != NULL)
 		wb_start_locked(ifp);
-	WB_UNLOCK(sc);
 
 	return;
 }
@@ -1786,7 +1785,7 @@ wb_stop(sc)
 
 	WB_LOCK_ASSERT(sc);
 	ifp = sc->wb_ifp;
-	ifp->if_timer = 0;
+	sc->wb_timer = 0;
 
 	callout_stop(&sc->wb_stat_callout);
 

Modified: head/sys/dev/wb/if_wbreg.h
==============================================================================
--- head/sys/dev/wb/if_wbreg.h	Thu Nov 19 22:06:40 2009	(r199559)
+++ head/sys/dev/wb/if_wbreg.h	Thu Nov 19 22:14:23 2009	(r199560)
@@ -372,6 +372,7 @@ struct wb_softc {
 	u_int8_t		wb_type;
 	u_int16_t		wb_txthresh;
 	int			wb_cachesize;
+	int			wb_timer;
 	caddr_t			wb_ldata_ptr;
 	struct wb_list_data	*wb_ldata;
 	struct wb_chain_data	wb_cdata;

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 22:31:13 2009
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from [127.0.0.1] (freefall.freebsd.org [IPv6:2001:4f8:fff6::28])
	by hub.freebsd.org (Postfix) with ESMTP id 4E3171065670;
	Thu, 19 Nov 2009 22:31:13 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
From: Jung-uk Kim 
To: John Baldwin 
Date: Thu, 19 Nov 2009 17:31:00 -0500
User-Agent: KMail/1.6.2
References: <200911182340.nAINeJ3W087652@svn.freebsd.org>
	<200911191115.11088.jkim@FreeBSD.org>
	<200911191649.37198.jhb@freebsd.org>
In-Reply-To: <200911191649.37198.jhb@freebsd.org>
MIME-Version: 1.0
Content-Disposition: inline
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Message-Id: <200911191731.04075.jkim@FreeBSD.org>
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org, Robert Watson 
Subject: Re: svn commit: r199498 - in head/sys: amd64/amd64 i386/i386 net
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 22:31:14 -0000

On Thursday 19 November 2009 04:49 pm, John Baldwin wrote:
> On Thursday 19 November 2009 11:15:01 am Jung-uk Kim wrote:
> > On Thursday 19 November 2009 03:26 am, Robert Watson wrote:
> > > On Wed, 18 Nov 2009, Jung-uk Kim wrote:
> > > >  - Change internal function bpf_jit_compile() to return
> > > > allocated size of the generated binary and remove page size
> > > > limitation for userland. - Use contigmalloc(9)/contigfree(9)
> > > > instead of malloc(9)/free(9) to make sure the generated
> > > > binary aligns properly and make it physically contiguous.
> > >
> > > Is physical contiguity actually required here -- I would have
> > > thought virtual contiguity and alignment would be sufficient,
> > > in which case the normal trick is to allocate using malloc the
> > > size + min-align + 1 and then fudge the pointer forward until
> > > it's properly aligned.
> >
> > I don't believe it is strictly necessary but I assumed it might
> > have performance benefit for very big BPF programs although I
> > have not measured it.  Also, contigmalloc(9)/contigfree(9) is too
> > obvious to ignore for this purpose. :-)
>
> Why would it have a performance benefit to have the pages be
> physically contiguous?  contigmalloc() is expensive and should
> really only be used if you truly need contiguous memory.  If you
> can get by with malloc(), just use malloc().

Remember are allocating memory for a function pointer here.  If we 
want to take care of alignment, then "fudging the pointer forward" 
trick is not going to be easy unless I embed real offset in the 
structure and pass it around with the pointer.  I don't mind doing it 
but it seemed unnecessary to me.  Besides, it is very unlikely to see 
a lot of parallel BPF filter allocations in real world.  Actually, 
that is a big assumption for BPF JIT compiler by itself because 
filter compilation is expensive.  Also, if contigmalloc() fails, 
bpf(4) simply falls back to good old bpf_filter().  So, I don't see 
anything wrong with this.

Jung-uk Kim

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 22:41:52 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: by hub.freebsd.org (Postfix, from userid 1033)
	id 30D59106568D; Thu, 19 Nov 2009 22:41:52 +0000 (UTC)
Date: Thu, 19 Nov 2009 22:41:52 +0000
From: Alexey Dokuchaev 
To: Pyun YongHyeon 
Message-ID: <20091119224151.GA79179@FreeBSD.org>
References: <200911192145.nAJLj6KD020454@svn.freebsd.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=koi8-r
Content-Disposition: inline
In-Reply-To: <200911192145.nAJLj6KD020454@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: r199552 - head/sys/dev/et
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 22:41:52 -0000

On Thu, Nov 19, 2009 at 09:45:06PM +0000, Pyun YongHyeon wrote:
> 
> Modified: head/sys/dev/et/if_et.c
> ==============================================================================
> --- head/sys/dev/et/if_et.c	Thu Nov 19 21:39:43 2009	(r199551)
> +++ head/sys/dev/et/if_et.c	Thu Nov 19 21:45:06 2009	(r199552)
> @@ -76,6 +76,10 @@ MODULE_DEPEND(et, pci, 1, 1, 1);
>  MODULE_DEPEND(et, ether, 1, 1, 1);
>  MODULE_DEPEND(et, miibus, 1, 1, 1);
>  
> +/* Tunables. */
> +static int msi_disable = 0;
> +TUNABLE_INT("hw.re.msi_disable", &msi_disable);
		^^^^^
Shouldn't it be "hw.et" instead?

> +		msic = pci_msi_count(dev);
> +		if (bootverbose)
> +			device_printf(dev, "MSI count : %d\n", msic);

Is extra space before colon really necessary here?

./danfe

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 22:53:41 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 95B7B1065672;
	Thu, 19 Nov 2009 22:53:41 +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 8360C8FC1A;
	Thu, 19 Nov 2009 22:53:41 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAJMrfBX022441;
	Thu, 19 Nov 2009 22:53:41 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAJMrf3P022439;
	Thu, 19 Nov 2009 22:53:41 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200911192253.nAJMrf3P022439@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Thu, 19 Nov 2009 22:53: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: r199561 - head/sys/dev/et
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 22:53:41 -0000

Author: yongari
Date: Thu Nov 19 22:53:41 2009
New Revision: 199561
URL: http://svn.freebsd.org/changeset/base/199561

Log:
  Use capability pointer to access PCIe registers rather than
  directly access them at fixed address. Frequently the register
  offset could be changed if additional PCI capabilities are added to
  controller.
  One odd thing is ET_PCIR_L0S_L1_LATENCY register. I think it's PCIe
  link capabilities register but the location of the register does
  not match with PCIe capability pointer + offset. I'm not sure it's
  shadow register of PCIe link capabilities register.

Modified:
  head/sys/dev/et/if_et.c

Modified: head/sys/dev/et/if_et.c
==============================================================================
--- head/sys/dev/et/if_et.c	Thu Nov 19 22:14:23 2009	(r199560)
+++ head/sys/dev/et/if_et.c	Thu Nov 19 22:53:41 2009	(r199561)
@@ -142,7 +142,7 @@ 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(device_t);
+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 *);
@@ -308,7 +308,7 @@ et_attach(device_t dev)
 		goto fail;
 	}
 
-	error = et_bus_config(dev);
+	error = et_bus_config(sc);
 	if (error)
 		goto fail;
 
@@ -575,7 +575,7 @@ et_stop(struct et_softc *sc)
 }
 
 static int
-et_bus_config(device_t dev)
+et_bus_config(struct et_softc *sc)
 {
 	uint32_t val, max_plsz;
 	uint16_t ack_latency, replay_timer;
@@ -584,21 +584,25 @@ et_bus_config(device_t dev)
 	 * Test whether EEPROM is valid
 	 * NOTE: Read twice to get the correct value
 	 */
-	pci_read_config(dev, ET_PCIR_EEPROM_STATUS, 1);
-	val = pci_read_config(dev, ET_PCIR_EEPROM_STATUS, 1);
+	pci_read_config(sc->dev, ET_PCIR_EEPROM_STATUS, 1);
+	val = pci_read_config(sc->dev, ET_PCIR_EEPROM_STATUS, 1);
 	if (val & ET_PCIM_EEPROM_STATUS_ERROR) {
-		device_printf(dev, "EEPROM status error 0x%02x\n", val);
+		device_printf(sc->dev, "EEPROM status error 0x%02x\n", val);
 		return (ENXIO);
 	}
 
 	/* TODO: LED */
 
+	if ((sc->sc_flags & ET_FLAG_PCIE) == 0)
+		return (0);
+
 	/*
 	 * Configure ACK latency and replay timer according to
 	 * max playload size
 	 */
-	val = pci_read_config(dev, ET_PCIR_DEVICE_CAPS, 4);
-	max_plsz = val & ET_PCIM_DEVICE_CAPS_MAX_PLSZ;
+	val = pci_read_config(sc->dev,
+	    sc->sc_expcap + PCIR_EXPRESS_DEVICE_CAP, 4);
+	max_plsz = val & PCIM_EXP_CAP_MAX_PAYLOAD;
 
 	switch (max_plsz) {
 	case ET_PCIV_DEVICE_CAPS_PLSZ_128:
@@ -612,35 +616,39 @@ et_bus_config(device_t dev)
 		break;
 
 	default:
-		ack_latency = pci_read_config(dev, ET_PCIR_ACK_LATENCY, 2);
-		replay_timer = pci_read_config(dev, ET_PCIR_REPLAY_TIMER, 2);
-		device_printf(dev, "ack latency %u, replay timer %u\n",
+		ack_latency = pci_read_config(sc->dev, ET_PCIR_ACK_LATENCY, 2);
+		replay_timer = pci_read_config(sc->dev,
+		    ET_PCIR_REPLAY_TIMER, 2);
+		device_printf(sc->dev, "ack latency %u, replay timer %u\n",
 			      ack_latency, replay_timer);
 		break;
 	}
 	if (ack_latency != 0) {
-		pci_write_config(dev, ET_PCIR_ACK_LATENCY, ack_latency, 2);
-		pci_write_config(dev, ET_PCIR_REPLAY_TIMER, replay_timer, 2);
+		pci_write_config(sc->dev, ET_PCIR_ACK_LATENCY, ack_latency, 2);
+		pci_write_config(sc->dev, ET_PCIR_REPLAY_TIMER, replay_timer,
+		    2);
 	}
 
 	/*
 	 * Set L0s and L1 latency timer to 2us
 	 */
-	val = pci_read_config(dev, ET_PCIR_L0S_L1_LATENCY, 4);
+	val = pci_read_config(sc->dev, ET_PCIR_L0S_L1_LATENCY, 4);
 	val &= ~(PCIM_LINK_CAP_L0S_EXIT | PCIM_LINK_CAP_L1_EXIT);
 	/* L0s exit latency : 2us */
 	val |= 0x00005000;
 	/* L1 exit latency : 2us */
 	val |= 0x00028000;
-	pci_write_config(dev, ET_PCIR_L0S_L1_LATENCY, val, 4);
+	pci_write_config(sc->dev, ET_PCIR_L0S_L1_LATENCY, val, 4);
 
 	/*
 	 * Set max read request size to 2048 bytes
 	 */
-	val = pci_read_config(dev, ET_PCIR_DEVICE_CTRL, 2);
-	val &= ~ET_PCIM_DEVICE_CTRL_MAX_RRSZ;
+	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(dev, ET_PCIR_DEVICE_CTRL, val, 2);
+	pci_write_config(sc->dev,
+	    sc->sc_expcap + PCIR_EXPRESS_DEVICE_CTL, val, 2);
 
 	return (0);
 }

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 22:57:16 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AC864106568D;
	Thu, 19 Nov 2009 22:57:16 +0000 (UTC)
	(envelope-from pyunyh@gmail.com)
Received: from qw-out-2122.google.com (qw-out-2122.google.com [74.125.92.26])
	by mx1.freebsd.org (Postfix) with ESMTP id 1C20E8FC19;
	Thu, 19 Nov 2009 22:57:15 +0000 (UTC)
Received: by qw-out-2122.google.com with SMTP id 9so623407qwb.7
	for ; Thu, 19 Nov 2009 14:57:15 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:received:received:received:from:date:to:cc
	:subject:message-id:reply-to:references:mime-version:content-type
	:content-disposition:in-reply-to:user-agent;
	bh=cyI5ynS2OEJQ9u5SGRMrxKsQWLeBSSXIX5q81GRwL8k=;
	b=NYIY/k0DFr1gqcQgNOEsu+Lz7UkSmykdZivUFPkxFJZU9wEOyov1o6/Fmmdz13ijxk
	bxJHZpukE7nACMfVcwobHvc+6axZoTTPpdkq0MR2KvZemw0VucZleKoig5jSbKJ8wggc
	eZOkDs+F28H82HrydJIvuwuEda7ZmNWF87azM=
DomainKey-Signature: a=rsa-sha1; c=nofws; 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;
	b=PX9HNGq7nctdOv7wghWwJ0yLp2ldDJL5IkN3EXoRb/E3MuKI2v4nWQw6LuDXNW+jL9
	a2I9MWjyNe/ukaUb8VPdrX+tcEtV+MAaRA+4QQCTIB8VFWyxVZDVPylHwkU5hwvQ/yDd
	thZViWdfSsoKHL8seYJy2YQ+8Fa6E5VV+X1TI=
Received: by 10.224.96.202 with SMTP id i10mr413758qan.311.1258671435353;
	Thu, 19 Nov 2009 14:57:15 -0800 (PST)
Received: from pyunyh@gmail.com ([174.35.1.224])
	by mx.google.com with ESMTPS id 20sm729646qyk.9.2009.11.19.14.57.12
	(version=TLSv1/SSLv3 cipher=RC4-MD5);
	Thu, 19 Nov 2009 14:57:13 -0800 (PST)
Received: by pyunyh@gmail.com (sSMTP sendmail emulation);
	Thu, 19 Nov 2009 14:56:44 -0800
From: Pyun YongHyeon 
Date: Thu, 19 Nov 2009 14:56:44 -0800
To: Alexey Dokuchaev 
Message-ID: <20091119225644.GU1262@michelle.cdnetworks.com>
References: <200911192145.nAJLj6KD020454@svn.freebsd.org>
	<20091119224151.GA79179@FreeBSD.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20091119224151.GA79179@FreeBSD.org>
User-Agent: Mutt/1.4.2.3i
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, Pyun YongHyeon 
Subject: Re: svn commit: r199552 - head/sys/dev/et
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: pyunyh@gmail.com
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 22:57:16 -0000

On Thu, Nov 19, 2009 at 10:41:52PM +0000, Alexey Dokuchaev wrote:
> On Thu, Nov 19, 2009 at 09:45:06PM +0000, Pyun YongHyeon wrote:
> > 
> > Modified: head/sys/dev/et/if_et.c
> > ==============================================================================
> > --- head/sys/dev/et/if_et.c	Thu Nov 19 21:39:43 2009	(r199551)
> > +++ head/sys/dev/et/if_et.c	Thu Nov 19 21:45:06 2009	(r199552)
> > @@ -76,6 +76,10 @@ MODULE_DEPEND(et, pci, 1, 1, 1);
> >  MODULE_DEPEND(et, ether, 1, 1, 1);
> >  MODULE_DEPEND(et, miibus, 1, 1, 1);
> >  
> > +/* Tunables. */
> > +static int msi_disable = 0;
> > +TUNABLE_INT("hw.re.msi_disable", &msi_disable);
> 		^^^^^
> Shouldn't it be "hw.et" instead?
> 

Oops, right.

> > +		msic = pci_msi_count(dev);
> > +		if (bootverbose)
> > +			device_printf(dev, "MSI count : %d\n", msic);
> 
> Is extra space before colon really necessary here?
> 

Not needed here.

Thanks for reviewing!

> ./danfe

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 22:59:52 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C40631065696;
	Thu, 19 Nov 2009 22:59: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 B21468FC1C;
	Thu, 19 Nov 2009 22:59:52 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAJMxqQF022659;
	Thu, 19 Nov 2009 22:59:52 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAJMxqPR022657;
	Thu, 19 Nov 2009 22:59:52 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200911192259.nAJMxqPR022657@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Thu, 19 Nov 2009 22:59: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: r199563 - head/sys/dev/et
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 22:59:52 -0000

Author: yongari
Date: Thu Nov 19 22:59:52 2009
New Revision: 199563
URL: http://svn.freebsd.org/changeset/base/199563

Log:
  Fix copy & paste error and remove extra space before colon.
  
  Pointed out by: danfe

Modified:
  head/sys/dev/et/if_et.c

Modified: head/sys/dev/et/if_et.c
==============================================================================
--- head/sys/dev/et/if_et.c	Thu Nov 19 22:59:35 2009	(r199562)
+++ head/sys/dev/et/if_et.c	Thu Nov 19 22:59:52 2009	(r199563)
@@ -78,7 +78,7 @@ MODULE_DEPEND(et, miibus, 1, 1, 1);
 
 /* Tunables. */
 static int msi_disable = 0;
-TUNABLE_INT("hw.re.msi_disable", &msi_disable);
+TUNABLE_INT("hw.et.msi_disable", &msi_disable);
 
 static int	et_probe(device_t);
 static int	et_attach(device_t);
@@ -276,7 +276,7 @@ et_attach(device_t dev)
 		sc->sc_flags |= ET_FLAG_PCIE;
 		msic = pci_msi_count(dev);
 		if (bootverbose)
-			device_printf(dev, "MSI count : %d\n", msic);
+			device_printf(dev, "MSI count: %d\n", msic);
 	}
 	if (msic > 0 && msi_disable == 0) {
 		msic = 1;

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 23:12:44 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8F2B41065700;
	Thu, 19 Nov 2009 23:12: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 637558FC0C;
	Thu, 19 Nov 2009 23:12:44 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAJNCidf023013;
	Thu, 19 Nov 2009 23:12:44 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAJNCisS023011;
	Thu, 19 Nov 2009 23:12:44 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200911192312.nAJNCisS023011@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Thu, 19 Nov 2009 23:12: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: r199564 - head/sys/dev/re
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 23:12:44 -0000

Author: yongari
Date: Thu Nov 19 23:12:44 2009
New Revision: 199564
URL: http://svn.freebsd.org/changeset/base/199564

Log:
  Minimize interface reinitialization by checking IFF_DRV_RUNNING
  flag. This fixes unnecessary interface UP/DOWNs during getting an
  IP address via DHCP.
  
  Tested by:	Warren Block ( wblock<> wonkity dot com )

Modified:
  head/sys/dev/re/if_re.c

Modified: head/sys/dev/re/if_re.c
==============================================================================
--- head/sys/dev/re/if_re.c	Thu Nov 19 22:59:52 2009	(r199563)
+++ head/sys/dev/re/if_re.c	Thu Nov 19 23:12:44 2009	(r199564)
@@ -753,6 +753,7 @@ re_diag(struct rl_softc *sc)
 
 	ifp->if_flags |= IFF_PROMISC;
 	sc->rl_testmode = 1;
+	ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 	re_init_locked(sc);
 	sc->rl_flags |= RL_FLAG_LINK;
 	if (sc->rl_type == RL_8169)
@@ -2145,8 +2146,10 @@ re_poll_locked(struct ifnet *ifp, enum p
 		 * XXX check behaviour on receiver stalls.
 		 */
 
-		if (status & RL_ISR_SYSTEM_ERR)
+		if (status & RL_ISR_SYSTEM_ERR) {
+			ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 			re_init_locked(sc);
+		}
 	}
 	return (rx_npkts);
 }
@@ -2222,8 +2225,10 @@ re_int_task(void *arg, int npending)
 	    RL_ISR_TX_ERR|RL_ISR_TX_DESC_UNAVAIL))
 		re_txeof(sc);
 
-	if (status & RL_ISR_SYSTEM_ERR)
+	if (status & RL_ISR_SYSTEM_ERR) {
+		ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 		re_init_locked(sc);
+	}
 
 	if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
 		taskqueue_enqueue_fast(taskqueue_fast, &sc->rl_txtask);
@@ -2539,6 +2544,9 @@ re_init_locked(struct rl_softc *sc)
 
 	mii = device_get_softc(sc->rl_miibus);
 
+	if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
+		return;
+
 	/*
 	 * Cancel pending I/O and free all RX/TX buffers.
 	 */
@@ -2793,7 +2801,8 @@ re_ioctl(struct ifnet *ifp, u_long comma
 	case SIOCADDMULTI:
 	case SIOCDELMULTI:
 		RL_LOCK(sc);
-		re_set_rxmode(sc);
+		if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
+			re_set_rxmode(sc);
 		RL_UNLOCK(sc);
 		break;
 	case SIOCGIFMEDIA:
@@ -2862,8 +2871,10 @@ re_ioctl(struct ifnet *ifp, u_long comma
 			if ((mask & IFCAP_WOL_MAGIC) != 0)
 				ifp->if_capenable ^= IFCAP_WOL_MAGIC;
 		}
-		if (reinit && ifp->if_drv_flags & IFF_DRV_RUNNING)
+		if (reinit && ifp->if_drv_flags & IFF_DRV_RUNNING) {
+			ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 			re_init(sc);
+		}
 		VLAN_CAPABILITIES(ifp);
 	    }
 		break;
@@ -2899,6 +2910,7 @@ re_watchdog(struct rl_softc *sc)
 	ifp->if_oerrors++;
 
 	re_rxeof(sc, NULL);
+	ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 	re_init_locked(sc);
 	if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
 		taskqueue_enqueue_fast(taskqueue_fast, &sc->rl_txtask);

From owner-svn-src-head@FreeBSD.ORG  Thu Nov 19 23:14:40 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 68866106568B;
	Thu, 19 Nov 2009 23:14:40 +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 56E018FC16;
	Thu, 19 Nov 2009 23:14:40 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAJNEePC023084;
	Thu, 19 Nov 2009 23:14:40 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAJNEek2023082;
	Thu, 19 Nov 2009 23:14:40 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200911192314.nAJNEek2023082@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Thu, 19 Nov 2009 23:14:40 +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: r199565 - head/sys/dev/re
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 19 Nov 2009 23:14:40 -0000

Author: yongari
Date: Thu Nov 19 23:14:40 2009
New Revision: 199565
URL: http://svn.freebsd.org/changeset/base/199565

Log:
  Move interface reinitialization down after disabling WOL in resume
  path.

Modified:
  head/sys/dev/re/if_re.c

Modified: head/sys/dev/re/if_re.c
==============================================================================
--- head/sys/dev/re/if_re.c	Thu Nov 19 23:12:44 2009	(r199564)
+++ head/sys/dev/re/if_re.c	Thu Nov 19 23:14:40 2009	(r199565)
@@ -3023,15 +3023,16 @@ re_resume(device_t dev)
 			    CSR_READ_1(sc, RL_GPIO) | 0x01);
 	}
 
-	/* reinitialize interface if necessary */
-	if (ifp->if_flags & IFF_UP)
-		re_init_locked(sc);
-
 	/*
 	 * Clear WOL matching such that normal Rx filtering
 	 * wouldn't interfere with WOL patterns.
 	 */
 	re_clrwol(sc);
+
+	/* reinitialize interface if necessary */
+	if (ifp->if_flags & IFF_UP)
+		re_init_locked(sc);
+
 	sc->suspended = 0;
 	RL_UNLOCK(sc);
 

From owner-svn-src-head@FreeBSD.ORG  Fri Nov 20 03:14:55 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 68421106566B;
	Fri, 20 Nov 2009 03:14:55 +0000 (UTC)
	(envelope-from marcel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 56EF28FC08;
	Fri, 20 Nov 2009 03:14:55 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAK3EtT5027932;
	Fri, 20 Nov 2009 03:14:55 GMT (envelope-from marcel@svn.freebsd.org)
Received: (from marcel@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAK3EtwR027929;
	Fri, 20 Nov 2009 03:14:55 GMT (envelope-from marcel@svn.freebsd.org)
Message-Id: <200911200314.nAK3EtwR027929@svn.freebsd.org>
From: Marcel Moolenaar 
Date: Fri, 20 Nov 2009 03:14: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: r199566 - head/sys/ia64/ia64
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 20 Nov 2009 03:14:55 -0000

Author: marcel
Date: Fri Nov 20 03:14:54 2009
New Revision: 199566
URL: http://svn.freebsd.org/changeset/base/199566

Log:
  Add a seatbelt to the Nested TLB Fault handler to give us a chance
  to panic when we have an unexpected TLB fault while interrupt
  collection is disabled. Use a token rather than the actual address
  of the restart point to avoid the need for the movl instruction.
  The token is arbitrary. For the drummers: it's based on a single
  paradiddle.

Modified:
  head/sys/ia64/ia64/exception.S
  head/sys/ia64/ia64/trap.c

Modified: head/sys/ia64/ia64/exception.S
==============================================================================
--- head/sys/ia64/ia64/exception.S	Thu Nov 19 23:14:40 2009	(r199565)
+++ head/sys/ia64/ia64/exception.S	Fri Nov 20 03:14:54 2009	(r199566)
@@ -28,12 +28,21 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include "opt_kstack_pages.h"
 #include "opt_xtrace.h"
 
 #include 
 #include 
 
 /*
+ * Nested TLB restart tokens. These are used by the
+ * nested TLB handler for jumping back to the code
+ * where the nested TLB was caused.
+ */
+#define	NTLBRT_SAVE	0x12c12c
+#define	NTLBRT_RESTORE  0x12c12d
+
+/*
  * ar.k7 = kernel memory stack
  * ar.k6 = kernel register stack
  * ar.k5 = EPC gateway page
@@ -140,9 +149,10 @@ ENTRY_NOPROFILE(exception_save, 0)
 	add		r31=8,r30
 	;;
 }
-{	.mlx
+{	.mib
 	mov		r22=cr.iip
-	movl		r26=exception_save_restart
+	addl		r29=NTLBRT_SAVE,r0	// 22-bit restart token.
+	nop		0
 	;;
 }
 
@@ -157,7 +167,7 @@ ENTRY_NOPROFILE(exception_save, 0)
 	 * that are currently alive:
 	 *	r16,r17=arguments
 	 *	r18=pr, r19=length, r20=unat, r21=rsc, r22=iip, r23=TOS
-	 *	r26=restart point
+	 *	r29=restart point
 	 *	r30,r31=trapframe pointers
 	 *	p14,p15=memory stack switch
 	 */
@@ -544,7 +554,7 @@ ENTRY_NOPROFILE(exception_restore, 0)
 	ld8		r21=[r31],24		// rnat
 	mov		ar.pfs=r28
 	;;
-	ld8.fill	r29=[r30],16		// tp
+	ld8.fill	r26=[r30],16		// tp
 	ld8		r22=[r31],16		// rsc
 	;;
 {	.mmi
@@ -555,21 +565,21 @@ ENTRY_NOPROFILE(exception_restore, 0)
 }
 {	.mmi
 	ld8.fill	r1=[r30],16		// gp
-	ld8		r25=[r31],16		// ndirty
+	ld8		r27=[r31],16		// ndirty
 	cmp.le		p14,p15=5,r28
 	;;
 }
 {	.mmb
-	ld8		r26=[r30]		// cfm
+	ld8		r25=[r30]		// cfm
 	ld8		r19=[r31]		// ip
 	nop		0
 	;;
 }
-{	.mib
+{	.mii
 	// Switch register stack
 	alloc		r30=ar.pfs,0,0,0,0	// discard current frame
-	shl		r31=r25,16		// value for ar.rsc
-	nop		0
+	shl		r31=r27,16		// value for ar.rsc
+(p15)	mov		r13=r26
 	;;
 }
 	// The loadrs can fault if the backing store is not currently
@@ -580,7 +590,7 @@ ENTRY_NOPROFILE(exception_restore, 0)
 {	.mmi
 	mov		ar.rsc=r31		// setup for loadrs
 	mov		ar.k7=r16
-(p15)	mov		r13=r29
+	addl		r29=NTLBRT_RESTORE,r0	// 22-bit restart token 
 	;;
 }
 exception_restore_restart:
@@ -611,7 +621,7 @@ exception_restore_restart:
 }
 {	.mmi
 	mov		cr.ipsr=r24
-	mov		cr.ifs=r26
+	mov		cr.ifs=r25
 	mov		pr=r18,0x1ffff
 	;;
 }
@@ -944,7 +954,7 @@ IVT_ENTRY(Data_Nested_TLB, 0x1400)
 }
 {	.mii
 	ld8		r27=[r27]				// dir L0 page
-	extr.u		r29=r30,2*PAGE_SHIFT-5, PAGE_SHIFT-3	// dir L1 index
+	extr.u		r26=r30,2*PAGE_SHIFT-5, PAGE_SHIFT-3	// dir L1 index
 	;;
 	dep		r27=0,r27,61,3
 	;;
@@ -957,16 +967,16 @@ IVT_ENTRY(Data_Nested_TLB, 0x1400)
 	;;
 }
 {	.mmi
-	shladd		r27=r29,3,r27
+	shladd		r27=r26,3,r27
 	;;
-	mov		r29=rr[r30]
+	mov		r26=rr[r30]
 	dep		r27=0,r27,61,3
 	;;
 }
 {	.mii
 	ld8		r27=[r27]				// pte page
 	shl		r28=r28,5
-	dep		r29=0,r29,0,2
+	dep		r26=0,r26,0,2
 	;;
 }
 {	.mmi
@@ -979,28 +989,54 @@ IVT_ENTRY(Data_Nested_TLB, 0x1400)
 {	.mmi
 	ld8		r28=[r27]		// pte
 	;;
-	mov		cr.itir=r29
+	mov		cr.itir=r26
 	or		r28=PTE_DIRTY+PTE_ACCESSED,r28
 	;;
 }
-{	.mlx
+{	.mmi
 	st8		[r27]=r28
-	movl		r29=exception_save_restart
 	;;
+	addl		r26=NTLBRT_SAVE,r0
+	addl		r27=NTLBRT_RESTORE,r0
 }
 {	.mmi
 	itc.d		r28
 	;;
 	ssm		psr.dt
-	cmp.eq		p12,p13=r26,r29
+	cmp.eq		p12,p0=r29,r26
 	;;
 }
-{	.mbb
+{	.mib
 	srlz.d
+	cmp.eq		p13,p0=r29,r27
 (p12)	br.sptk		exception_save_restart
+	;;
+}
+{	.mib
+	nop		0
+	nop		0
 (p13)	br.sptk		exception_restore_restart
 	;;
 }
+{	.mlx
+	mov		r26=ar.bsp
+	movl		r27=kstack
+	;;
+}
+{	.mib
+	mov		r28=sp
+	addl		r27=KSTACK_PAGES*PAGE_SIZE-16,r0
+	nop		0
+	;;
+}
+{	.mmi
+	mov		sp=r27
+	;;
+	mov		r27=ar.bspstore
+	nop		0
+	;;
+}
+	CALL(trap, 5, r30)
 IVT_END(Data_Nested_TLB)
 
 IVT_ENTRY(Instruction_Key_Miss, 0x1800)

Modified: head/sys/ia64/ia64/trap.c
==============================================================================
--- head/sys/ia64/ia64/trap.c	Thu Nov 19 23:14:40 2009	(r199565)
+++ head/sys/ia64/ia64/trap.c	Fri Nov 20 03:14:54 2009	(r199566)
@@ -414,11 +414,9 @@ trap(int vector, struct trapframe *tf)
 
 	case IA64_VEC_NESTED_DTLB:
 		/*
-		 * We never call trap() with this vector. We may want to
-		 * do that in the future in case the nested TLB handler
-		 * could not find the translation it needs. In that case
-		 * we could switch to a special (hardwired) stack and
-		 * come here to produce a nice panic().
+		 * When the nested TLB handler encounters an unexpected
+		 * condition, it'll switch to the backup stack and transfer
+		 * here. All we need to do is panic.
 		 */
 		trap_panic(vector, tf);
 		break;

From owner-svn-src-head@FreeBSD.ORG  Fri Nov 20 06:39:29 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 59C41106566C;
	Fri, 20 Nov 2009 06:39:29 +0000 (UTC) (envelope-from alc@cs.rice.edu)
Received: from mail.cs.rice.edu (mail.cs.rice.edu [128.42.1.31])
	by mx1.freebsd.org (Postfix) with ESMTP id 181FF8FC12;
	Fri, 20 Nov 2009 06:39:28 +0000 (UTC)
Received: from mail.cs.rice.edu (localhost.localdomain [127.0.0.1])
	by mail.cs.rice.edu (Postfix) with ESMTP id 5509B2C2D87;
	Fri, 20 Nov 2009 00:39:28 -0600 (CST)
X-Virus-Scanned: by amavis-2.4.0 at mail.cs.rice.edu
Received: from mail.cs.rice.edu ([127.0.0.1])
	by mail.cs.rice.edu (mail.cs.rice.edu [127.0.0.1]) (amavisd-new,
	port 10024)
	with LMTP id AaL+zKdw-nY5; Fri, 20 Nov 2009 00:39:20 -0600 (CST)
Received: from adsl-216-63-78-18.dsl.hstntx.swbell.net
	(adsl-216-63-78-18.dsl.hstntx.swbell.net [216.63.78.18])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.cs.rice.edu (Postfix) with ESMTP id EBE662C2D89;
	Fri, 20 Nov 2009 00:39:19 -0600 (CST)
Message-ID: <4B063997.2010900@cs.rice.edu>
Date: Fri, 20 Nov 2009 00:39:19 -0600
From: Alan Cox 
User-Agent: Thunderbird 2.0.0.23 (X11/20090822)
MIME-Version: 1.0
To: John Baldwin 
References: <200911182340.nAINeJ3W087652@svn.freebsd.org>
	
	<200911191115.11088.jkim@FreeBSD.org>
	<200911191649.37198.jhb@freebsd.org>
In-Reply-To: <200911191649.37198.jhb@freebsd.org>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, Robert Watson ,
	Jung-uk Kim 
Subject: Re: svn commit: r199498 - in head/sys: amd64/amd64 i386/i386 net
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 20 Nov 2009 06:39:29 -0000

John Baldwin wrote:
> On Thursday 19 November 2009 11:15:01 am Jung-uk Kim wrote:
>   
>> On Thursday 19 November 2009 03:26 am, Robert Watson wrote:
>>     
>>> On Wed, 18 Nov 2009, Jung-uk Kim wrote:
>>>       
>>>>  - Change internal function bpf_jit_compile() to return allocated
>>>> size of the generated binary and remove page size limitation for
>>>> userland. - Use contigmalloc(9)/contigfree(9) instead of
>>>> malloc(9)/free(9) to make sure the generated binary aligns
>>>> properly and make it physically contiguous.
>>>>         
>>> Is physical contiguity actually required here -- I would have
>>> thought virtual contiguity and alignment would be sufficient, in
>>> which case the normal trick is to allocate using malloc the size +
>>> min-align + 1 and then fudge the pointer forward until it's
>>> properly aligned.
>>>       
>> I don't believe it is strictly necessary but I assumed it might have 
>> performance benefit for very big BPF programs although I have not 
>> measured it.  Also, contigmalloc(9)/contigfree(9) is too obvious to 
>> ignore for this purpose. :-)
>>     
>
> Why would it have a performance benefit to have the pages be physically 
> contiguous?  contigmalloc() is expensive and should really only be used if 
> you truly need contiguous memory.  If you can get by with malloc(), just use 
> malloc().
>
>   

If anything, there is a performance benefit from using malloc.  Kernel 
memory allocated with malloc on amd64 is likely to be backed by 
superpages.  This is not true of contigmalloc.

Alan



From owner-svn-src-head@FreeBSD.ORG  Fri Nov 20 07:40:02 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EDE91106568F;
	Fri, 20 Nov 2009 07:40:02 +0000 (UTC)
	(envelope-from marcel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DD88E8FC0C;
	Fri, 20 Nov 2009 07:40:02 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAK7e2j8033336;
	Fri, 20 Nov 2009 07:40:02 GMT (envelope-from marcel@svn.freebsd.org)
Received: (from marcel@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAK7e2kK033334;
	Fri, 20 Nov 2009 07:40:02 GMT (envelope-from marcel@svn.freebsd.org)
Message-Id: <200911200740.nAK7e2kK033334@svn.freebsd.org>
From: Marcel Moolenaar 
Date: Fri, 20 Nov 2009 07:40: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: r199574 - head/sys/ia64/ia64
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 20 Nov 2009 07:40:03 -0000

Author: marcel
Date: Fri Nov 20 07:40:02 2009
New Revision: 199574
URL: http://svn.freebsd.org/changeset/base/199574

Log:
  No need to include opt_kstack_pages.h, because KSTACK_PAGES is
  already defined through genassym.c

Modified:
  head/sys/ia64/ia64/exception.S

Modified: head/sys/ia64/ia64/exception.S
==============================================================================
--- head/sys/ia64/ia64/exception.S	Fri Nov 20 07:23:49 2009	(r199573)
+++ head/sys/ia64/ia64/exception.S	Fri Nov 20 07:40:02 2009	(r199574)
@@ -28,7 +28,6 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#include "opt_kstack_pages.h"
 #include "opt_xtrace.h"
 
 #include 

From owner-svn-src-head@FreeBSD.ORG  Fri Nov 20 08:57:26 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 94138106566B;
	Fri, 20 Nov 2009 08:57:26 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 821A58FC1C;
	Fri, 20 Nov 2009 08:57:26 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAK8vQGc035053;
	Fri, 20 Nov 2009 08:57:26 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAK8vQxX035052;
	Fri, 20 Nov 2009 08:57:26 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200911200857.nAK8vQxX035052@svn.freebsd.org>
From: Andrew Thompson 
Date: Fri, 20 Nov 2009 08:57: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: r199575 - head/lib/libusb
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 20 Nov 2009 08:57:26 -0000

Author: thompsa
Date: Fri Nov 20 08:57:25 2009
New Revision: 199575
URL: http://svn.freebsd.org/changeset/base/199575

Log:
  Sync to P4
   - fix a transfer cancelling bug/segfault [1]
   - correct a return code in the transfer cancel function.
   - add new API function, libusb20_tr_bulk_intr_sync().
  
  Submitted by:	HPS
  Reported by:	Robert Jenssen [1]

Modified:
  head/lib/libusb/libusb10.c
  head/lib/libusb/libusb10.h
  head/lib/libusb/libusb20.3
  head/lib/libusb/libusb20.c
  head/lib/libusb/libusb20.h

Modified: head/lib/libusb/libusb10.c
==============================================================================
--- head/lib/libusb/libusb10.c	Fri Nov 20 07:40:02 2009	(r199574)
+++ head/lib/libusb/libusb10.c	Fri Nov 20 08:57:25 2009	(r199575)
@@ -833,8 +833,12 @@ libusb10_complete_transfer(struct libusb
 	if (pxfer != NULL)
 		libusb20_tr_set_priv_sc1(pxfer, NULL);
 
+	/* set transfer status */
 	uxfer->status = status;
 
+	/* update super transfer state */
+	sxfer->state = LIBUSB_SUPER_XFER_ST_NONE;
+
 	dev = libusb_get_device(uxfer->dev_handle);
 
 	TAILQ_INSERT_TAIL(&dev->ctx->tr_done, sxfer, entry);
@@ -1111,6 +1115,8 @@ libusb10_submit_transfer_sub(struct libu
 		return;
 	case 2:
 		sxfer = libusb20_tr_get_priv_sc1(pxfer1);
+		if (sxfer == NULL)
+			return;		/* cancelling */
 		if (sxfer->rem_len)
 			return;		/* cannot queue another one */
 		/* swap transfers */
@@ -1118,6 +1124,8 @@ libusb10_submit_transfer_sub(struct libu
 		break;
 	case 1:
 		sxfer = libusb20_tr_get_priv_sc1(pxfer0);
+		if (sxfer == NULL)
+			return;		/* cancelling */
 		if (sxfer->rem_len)
 			return;		/* cannot queue another one */
 		/* swap transfers */
@@ -1229,12 +1237,18 @@ libusb_submit_transfer(struct libusb_tra
 	if (pxfer0 == NULL || pxfer1 == NULL) {
 		err = LIBUSB_ERROR_OTHER;
 	} else if ((sxfer->entry.tqe_prev != NULL) ||
-		    (libusb20_tr_get_priv_sc1(pxfer0) == sxfer) ||
+	    (libusb20_tr_get_priv_sc1(pxfer0) == sxfer) ||
 	    (libusb20_tr_get_priv_sc1(pxfer1) == sxfer)) {
 		err = LIBUSB_ERROR_BUSY;
 	} else {
+
+		/* set pending state */
+		sxfer->state = LIBUSB_SUPER_XFER_ST_PEND;
+
+		/* insert transfer into transfer head list */
 		TAILQ_INSERT_TAIL(&dev->tr_head, sxfer, entry);
 
+		/* start work transfers */
 		libusb10_submit_transfer_sub(
 		    uxfer->dev_handle, endpoint);
 
@@ -1258,12 +1272,14 @@ libusb_cancel_transfer(struct libusb_tra
 	struct libusb_super_transfer *sxfer;
 	struct libusb_device *dev;
 	uint32_t endpoint;
+	int retval;
 
 	if (uxfer == NULL)
 		return (LIBUSB_ERROR_INVALID_PARAM);
 
+	/* check if not initialised */
 	if (uxfer->dev_handle == NULL)
-		return (LIBUSB_ERROR_INVALID_PARAM);
+		return (LIBUSB_ERROR_NOT_FOUND);
 
 	endpoint = uxfer->endpoint;
 
@@ -1277,39 +1293,50 @@ libusb_cancel_transfer(struct libusb_tra
 	sxfer = (struct libusb_super_transfer *)(
 	    (uint8_t *)uxfer - sizeof(*sxfer));
 
+	retval = 0;
+
 	CTX_LOCK(dev->ctx);
 
 	pxfer0 = libusb10_get_transfer(uxfer->dev_handle, endpoint, 0);
 	pxfer1 = libusb10_get_transfer(uxfer->dev_handle, endpoint, 1);
 
-	if (sxfer->entry.tqe_prev != NULL) {
+	if (sxfer->state != LIBUSB_SUPER_XFER_ST_PEND) {
+		/* only update the transfer status */
+		uxfer->status = LIBUSB_TRANSFER_CANCELLED;
+		retval = LIBUSB_ERROR_NOT_FOUND;
+	} else if (sxfer->entry.tqe_prev != NULL) {
 		/* we are lucky - transfer is on a queue */
 		TAILQ_REMOVE(&dev->tr_head, sxfer, entry);
 		sxfer->entry.tqe_prev = NULL;
-		libusb10_complete_transfer(NULL, sxfer, LIBUSB_TRANSFER_CANCELLED);
+		libusb10_complete_transfer(NULL,
+		    sxfer, LIBUSB_TRANSFER_CANCELLED);
 	} else if (pxfer0 == NULL || pxfer1 == NULL) {
 		/* not started */
+		retval = LIBUSB_ERROR_NOT_FOUND;
 	} else if (libusb20_tr_get_priv_sc1(pxfer0) == sxfer) {
-		libusb10_complete_transfer(pxfer0, sxfer, LIBUSB_TRANSFER_CANCELLED);
+		libusb10_complete_transfer(pxfer0,
+		    sxfer, LIBUSB_TRANSFER_CANCELLED);
 		libusb20_tr_stop(pxfer0);
 		/* make sure the queue doesn't stall */
 		libusb10_submit_transfer_sub(
 		    uxfer->dev_handle, endpoint);
 	} else if (libusb20_tr_get_priv_sc1(pxfer1) == sxfer) {
-		libusb10_complete_transfer(pxfer1, sxfer, LIBUSB_TRANSFER_CANCELLED);
+		libusb10_complete_transfer(pxfer1,
+		    sxfer, LIBUSB_TRANSFER_CANCELLED);
 		libusb20_tr_stop(pxfer1);
 		/* make sure the queue doesn't stall */
 		libusb10_submit_transfer_sub(
 		    uxfer->dev_handle, endpoint);
 	} else {
 		/* not started */
+		retval = LIBUSB_ERROR_NOT_FOUND;
 	}
 
 	CTX_UNLOCK(dev->ctx);
 
 	DPRINTF(dev->ctx, LIBUSB_DEBUG_FUNCTION, "libusb_cancel_transfer leave");
 
-	return (0);
+	return (retval);
 }
 
 UNEXPORTED void

Modified: head/lib/libusb/libusb10.h
==============================================================================
--- head/lib/libusb/libusb10.h	Fri Nov 20 07:40:02 2009	(r199574)
+++ head/lib/libusb/libusb10.h	Fri Nov 20 08:57:25 2009	(r199575)
@@ -65,7 +65,9 @@ struct libusb_super_transfer {
 	uint8_t *curr_data;
 	uint32_t rem_len;
 	uint32_t last_len;
-	uint8_t	flags;
+	uint8_t	state;
+#define	LIBUSB_SUPER_XFER_ST_NONE 0
+#define	LIBUSB_SUPER_XFER_ST_PEND 1
 };
 
 struct libusb_context {

Modified: head/lib/libusb/libusb20.3
==============================================================================
--- head/lib/libusb/libusb20.3	Fri Nov 20 07:40:02 2009	(r199574)
+++ head/lib/libusb/libusb20.3	Fri Nov 20 08:57:25 2009	(r199575)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 22, 2009
+.Dd November 18, 2009
 .Dt LIBUSB20 3
 .Os
 .Sh NAME
@@ -98,6 +98,8 @@ USB access library (libusb -lusb)
 .Fn libusb20_tr_setup_intr "struct libusb20_transfer *xfer" "void *pbuf" "uint32_t length" "uint32_t timeout"
 .Ft void
 .Fn libusb20_tr_setup_isoc "struct libusb20_transfer *xfer" "void *pbuf" "uint32_t length" "uint61_t fr_index"
+.Ft uint8_t
+.Fn libusb20_tr_bulk_intr_sync "struct libusb20_transfer *xfer" "void *pbuf" "uint32_t length" "uint32_t *pactlen" "uint32_t timeout"
 .Ft void
 .Fn libusb20_tr_start "struct libusb20_transfer *xfer"
 .Ft void
@@ -451,6 +453,29 @@ is a helper function for setting up a mu
 .
 .Pp
 .
+.Fn libusb20_tr_bulk_intr_sync
+will perform a synchronous BULK or INTERRUPT transfer having length given by the
+.Fa length
+argument and buffer pointer given by the
+.Fa pbuf
+argument on the USB transfer given by the
+.Fa xfer
+argument.
+.
+If the
+.Fa pactlen
+argument is non-NULL the actual transfer length will be stored at the given pointer destination.
+.
+If the
+.Fa timeout
+argument is non-zero the transfer will timeout after the given value in milliseconds.
+.
+This function does not change the transfer flags, like short packet not ok.
+.
+This function returns zero on success else a LIBUSB20_TRANSFER_XXX value is returned.
+.
+.Pp
+.
 .Fn libusb20_tr_start
 will get the USB transfer started, if not already
 started.

Modified: head/lib/libusb/libusb20.c
==============================================================================
--- head/lib/libusb/libusb20.c	Fri Nov 20 07:40:02 2009	(r199574)
+++ head/lib/libusb/libusb20.c	Fri Nov 20 08:57:25 2009	(r199575)
@@ -1,6 +1,6 @@
 /* $FreeBSD$ */
 /*-
- * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
+ * Copyright (c) 2008-2009 Hans Petter Selasky. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -263,6 +263,10 @@ libusb20_tr_get_priv_sc1(struct libusb20
 void
 libusb20_tr_stop(struct libusb20_transfer *xfer)
 {
+	if (!xfer->is_opened) {
+		/* transfer is not opened */
+		return;
+	}
 	if (!xfer->is_pending) {
 		/* transfer not pending */
 		return;
@@ -280,6 +284,10 @@ libusb20_tr_stop(struct libusb20_transfe
 void
 libusb20_tr_drain(struct libusb20_transfer *xfer)
 {
+	if (!xfer->is_opened) {
+		/* transfer is not opened */
+		return;
+	}
 	/* make sure that we are cancelling */
 	libusb20_tr_stop(xfer);
 
@@ -415,9 +423,79 @@ libusb20_tr_setup_isoc(struct libusb20_t
 	return;
 }
 
+uint8_t
+libusb20_tr_bulk_intr_sync(struct libusb20_transfer *xfer,
+    void *pbuf, uint32_t length, uint32_t *pactlen,
+    uint32_t timeout)
+{
+	struct libusb20_device *pdev = xfer->pdev;
+	uint32_t transfer_max;
+	uint32_t transfer_act;
+	uint8_t retval;
+
+	/* set some sensible default value */
+	if (pactlen != NULL)
+		*pactlen = 0;
+
+	/* check for error condition */
+	if (libusb20_tr_pending(xfer))
+		return (LIBUSB20_ERROR_OTHER);
+
+	do {
+		/* compute maximum transfer length */
+		transfer_max = 
+		    libusb20_tr_get_max_total_length(xfer);
+
+		if (transfer_max > length)
+			transfer_max = length;
+
+		/* setup bulk or interrupt transfer */
+		libusb20_tr_setup_bulk(xfer, pbuf, 
+		    transfer_max, timeout);
+
+		/* start the transfer */
+		libusb20_tr_start(xfer);
+
+		/* wait for transfer completion */
+		while (libusb20_dev_process(pdev) == 0) {
+
+			if (libusb20_tr_pending(xfer) == 0)
+				break;
+
+			libusb20_dev_wait_process(pdev, -1);
+		}
+
+		transfer_act = libusb20_tr_get_actual_length(xfer);
+
+		/* update actual length, if any */
+		if (pactlen != NULL)
+			pactlen[0] += transfer_act;
+
+		/* check transfer status */
+		retval = libusb20_tr_get_status(xfer);
+		if (retval)
+			break;
+
+		/* check for short transfer */
+		if (transfer_act != transfer_max)
+			break;
+
+		/* update buffer pointer and length */
+		pbuf = ((uint8_t *)pbuf) + transfer_max;
+		length = length - transfer_max;
+
+	} while (length != 0);
+
+	return (retval);
+}
+
 void
 libusb20_tr_submit(struct libusb20_transfer *xfer)
 {
+	if (!xfer->is_opened) {
+		/* transfer is not opened */
+		return;
+	}
 	if (xfer->is_pending) {
 		/* should not happen */
 		return;
@@ -433,6 +511,10 @@ libusb20_tr_submit(struct libusb20_trans
 void
 libusb20_tr_start(struct libusb20_transfer *xfer)
 {
+	if (!xfer->is_opened) {
+		/* transfer is not opened */
+		return;
+	}
 	if (xfer->is_pending) {
 		if (xfer->is_cancel) {
 			/* cancelling - restart */
@@ -461,7 +543,14 @@ libusb20_dev_close(struct libusb20_devic
 	for (x = 0; x != pdev->nTransfer; x++) {
 		xfer = pdev->pTransfer + x;
 
+		if (!xfer->is_opened) {
+			/* transfer is not opened */
+			continue;
+		}
+
 		libusb20_tr_drain(xfer);
+
+		libusb20_tr_close(xfer);
 	}
 
 	if (pdev->pTransfer != NULL) {

Modified: head/lib/libusb/libusb20.h
==============================================================================
--- head/lib/libusb/libusb20.h	Fri Nov 20 07:40:02 2009	(r199574)
+++ head/lib/libusb/libusb20.h	Fri Nov 20 08:57:25 2009	(r199575)
@@ -1,6 +1,6 @@
 /* $FreeBSD$ */
 /*-
- * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
+ * Copyright (c) 2008-2009 Hans Petter Selasky. All rights reserved.
  * Copyright (c) 2007-2008 Daniel Drake.  All rights reserved.
  * Copyright (c) 2001 Johannes Erdfelt.  All rights reserved.
  *
@@ -226,6 +226,7 @@ void	libusb20_tr_setup_bulk(struct libus
 void	libusb20_tr_setup_control(struct libusb20_transfer *xfer, void *psetup, void *pbuf, uint32_t timeout);
 void	libusb20_tr_setup_intr(struct libusb20_transfer *xfer, void *pbuf, uint32_t length, uint32_t timeout);
 void	libusb20_tr_setup_isoc(struct libusb20_transfer *xfer, void *pbuf, uint32_t length, uint16_t fr_index);
+uint8_t	libusb20_tr_bulk_intr_sync(struct libusb20_transfer *xfer, void *pbuf, uint32_t length, uint32_t *pactlen, uint32_t timeout);
 void	libusb20_tr_start(struct libusb20_transfer *xfer);
 void	libusb20_tr_stop(struct libusb20_transfer *xfer);
 void	libusb20_tr_submit(struct libusb20_transfer *xfer);

From owner-svn-src-head@FreeBSD.ORG  Fri Nov 20 09:00:39 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6C91C106566B;
	Fri, 20 Nov 2009 09:00:39 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4219A8FC1D;
	Fri, 20 Nov 2009 09:00:39 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAK90cCK035171;
	Fri, 20 Nov 2009 09:00:38 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAK90cEN035169;
	Fri, 20 Nov 2009 09:00:38 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200911200900.nAK90cEN035169@svn.freebsd.org>
From: Andrew Thompson 
Date: Fri, 20 Nov 2009 09:00: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: r199576 - head/sys/dev/sound/usb
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 20 Nov 2009 09:00:39 -0000

Author: thompsa
Date: Fri Nov 20 09:00:38 2009
New Revision: 199576
URL: http://svn.freebsd.org/changeset/base/199576

Log:
  remove volume alignment (was previously not correctly implemented)
  
  Submitted by:	HPS
  Reported by:	Jaakko Heinonen

Modified:
  head/sys/dev/sound/usb/uaudio.c

Modified: head/sys/dev/sound/usb/uaudio.c
==============================================================================
--- head/sys/dev/sound/usb/uaudio.c	Fri Nov 20 08:57:25 2009	(r199575)
+++ head/sys/dev/sound/usb/uaudio.c	Fri Nov 20 09:00:38 2009	(r199576)
@@ -118,7 +118,6 @@ struct uaudio_mixer_node {
 	int32_t	maxval;
 #define	MIX_MAX_CHAN 8
 	int32_t	wValue[MIX_MAX_CHAN];	/* using nchan */
-	uint32_t mod;		/* modulus */
 	uint32_t mul;
 	uint32_t ctl;
 
@@ -1318,6 +1317,11 @@ uaudio_chan_init(struct uaudio_softc *sc
 	ch->pcm_cap.minspeed = ch->sample_rate;
 	ch->pcm_cap.maxspeed = ch->sample_rate;
 
+	/* setup mutex and PCM channel */
+
+	ch->pcm_ch = c;
+	ch->pcm_mtx = c->lock;
+
 	if (ch->p_asf1d->bNrChannels >= 2)
 		ch->pcm_cap.fmtlist[0] =
 		    SND_FORMAT(ch->p_fmt->freebsd_fmt, 2, 0);
@@ -1391,8 +1395,6 @@ uaudio_chan_init(struct uaudio_softc *sc
 	ch->start = ch->buf;
 	ch->end = ch->buf + buf_size;
 	ch->cur = ch->buf;
-	ch->pcm_ch = c;
-	ch->pcm_mtx = c->lock;
 	ch->pcm_buf = b;
 
 	if (ch->pcm_mtx == NULL) {
@@ -1570,9 +1572,7 @@ uaudio_mixer_add_ctl(struct uaudio_softc
 	if (mc->type == MIX_ON_OFF) {
 		mc->minval = 0;
 		mc->maxval = 1;
-		mc->mod = 1;
 	} else if (mc->type == MIX_SELECTOR) {
-		mc->mod = 1;
 	} else {
 
 		/* determine min and max values */
@@ -1600,11 +1600,8 @@ uaudio_mixer_add_ctl(struct uaudio_softc
 
 		/* compute value alignment */
 		res = uaudio_mixer_get(sc->sc_udev, GET_RES, mc);
-		if (res == 0)
-			res = 1;
-		mc->mod = mc->mul / res;
-		if (mc->mod == 0)
-			mc->mod = 1;
+
+		DPRINTF("Resolution = %d\n", (int)res);
 	}
 
 	uaudio_mixer_add_ctl_sub(sc, mc);
@@ -3097,9 +3094,6 @@ uaudio_mixer_bsd2value(struct uaudio_mix
 		/* compute actual volume */
 		val = (val * mc->mul) / 255;
 
-		/* align volume level */
-		val = val - (val % mc->mod);
-
 		/* add lower offset */
 		val = val + mc->minval;
 

From owner-svn-src-head@FreeBSD.ORG  Fri Nov 20 12:48:36 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 877301065670;
	Fri, 20 Nov 2009 12:48:36 +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 75DB18FC18;
	Fri, 20 Nov 2009 12:48:36 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAKCmaZY044085;
	Fri, 20 Nov 2009 12:48:36 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAKCma12044082;
	Fri, 20 Nov 2009 12:48:36 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200911201248.nAKCma12044082@svn.freebsd.org>
From: John Baldwin 
Date: Fri, 20 Nov 2009 12: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: r199579 - head/sys/boot/i386/zfsboot
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 20 Nov 2009 12:48:36 -0000

Author: jhb
Date: Fri Nov 20 12:48:35 2009
New Revision: 199579
URL: http://svn.freebsd.org/changeset/base/199579

Log:
  Always use 64-bit LBAs for disk addresses in zfsboot and gptzfsboot to
  fully support booting from large volumes.
  
  Tested by:	Emil Smolenski  ambsd of raisa.eu.org
  Submitted by:	Matt Reimer  mattjreimer of gmail (most of the C bits)
  MFC after:	1 week

Modified:
  head/sys/boot/i386/zfsboot/zfsboot.c
  head/sys/boot/i386/zfsboot/zfsldr.S

Modified: head/sys/boot/i386/zfsboot/zfsboot.c
==============================================================================
--- head/sys/boot/i386/zfsboot/zfsboot.c	Fri Nov 20 12:30:40 2009	(r199578)
+++ head/sys/boot/i386/zfsboot/zfsboot.c	Fri Nov 20 12:48:35 2009	(r199579)
@@ -138,8 +138,8 @@ struct dsk {
     unsigned unit;
     unsigned slice;
     unsigned part;
-    unsigned start;
     int init;
+    daddr_t start;
 };
 static char cmd[512];
 static char kname[1024];
@@ -163,7 +163,7 @@ static int parse(void);
 static void printf(const char *,...);
 static void putchar(int);
 static uint32_t memsize(void);
-static int drvread(struct dsk *, void *, unsigned, unsigned);
+static int drvread(struct dsk *, void *, daddr_t, unsigned);
 static int keyhit(unsigned);
 static int xputc(int);
 static int xgetc(int);
@@ -310,7 +310,8 @@ static int
 vdev_read(vdev_t *vdev, void *priv, off_t off, void *buf, size_t bytes)
 {
 	char *p;
-	unsigned int lba, nb;
+	daddr_t lba;
+	unsigned int nb;
 	struct dsk *dsk = (struct dsk *) priv;
 
 	if ((off & (DEV_BSIZE - 1)) || (bytes & (DEV_BSIZE - 1)))
@@ -964,7 +965,7 @@ static struct {
 #endif
 
 static int
-drvread(struct dsk *dsk, void *buf, unsigned lba, unsigned nblk)
+drvread(struct dsk *dsk, void *buf, daddr_t lba, unsigned nblk)
 {
 #ifdef GPT
     static unsigned c = 0x2d5c7c2f;
@@ -999,7 +1000,7 @@ drvread(struct dsk *dsk, void *buf, unsi
     v86.es = VTOPSEG(buf);
     v86.eax = lba;
     v86.ebx = VTOPOFF(buf);
-    v86.ecx = lba >> 16;
+    v86.ecx = lba >> 32;
     v86.edx = nblk << 8 | dsk->drive;
     v86int();
     v86.ctl = V86_FLAGS;

Modified: head/sys/boot/i386/zfsboot/zfsldr.S
==============================================================================
--- head/sys/boot/i386/zfsboot/zfsldr.S	Fri Nov 20 12:30:40 2009	(r199578)
+++ head/sys/boot/i386/zfsboot/zfsldr.S	Fri Nov 20 12:48:35 2009	(r199579)
@@ -83,7 +83,7 @@ ebpb:		.byte	0		# BIOS physical drive nu
  * Trampoline used by boot2 to call read to read data from the disk via
  * the BIOS.  Call with:
  *
- * %cx:%ax	- long    - LBA to read in
+ * %ecx:%eax	- long    - LBA to read in
  * %es:(%bx)	- caddr_t - buffer to read data into
  * %dl		- byte    - drive to read from
  * %dh		- byte    - num sectors to read
@@ -94,10 +94,8 @@ xread:		push %ss			# Address
 /*
  * Setup an EDD disk packet and pass it to read
  */
-xread.1:					# Starting
-		pushl $0x0			#  absolute
-		push %cx			#  block
-		push %ax			#  number
+xread.1:	pushl %ecx			# Starting absolute block
+		pushl %eax			#  block number
 		push %es			# Address of
 		push %bx			#  transfer buffer
 		xor %ax,%ax			# Number of
@@ -195,7 +193,7 @@ main.4: 	xor %dx,%dx			# Partition:drive
  */
 main.5: 	mov %dx,MEM_ARG			# Save args
 		movb $NSECT,%dh			# Sector count
-		movw $1024,%ax			# Offset to boot2
+		movl $1024,%eax			# Offset to boot2
 		callw nread.1			# Read disk
 main.6:		mov $MEM_BUF,%si		# BTX (before reloc)
 		mov 0xa(%si),%bx		# Get BTX length and set
@@ -245,10 +243,11 @@ seta20.3:	sti				# Enable interrupts
 /*
  * Trampoline used to call read from within boot1.
  */
-nread:		xor %ax,%ax			# Sector offset in partition
+nread:		xor %eax,%eax			# Sector offset in partition
 nread.1:	mov $MEM_BUF,%bx		# Transfer buffer
-		add 0x8(%si),%ax		# Get
-		mov 0xa(%si),%cx		#  LBA
+		xor %ecx,%ecx			# Get
+		addl 0x8(%si),%eax		#  LBA
+		adc $0,%ecx
 		push %cs			# Read from
 		callw xread.1	 		#  disk
 		jnc return			# If success, return

From owner-svn-src-head@FreeBSD.ORG  Fri Nov 20 13:28:07 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 456FC106577B;
	Fri, 20 Nov 2009 13:28:07 +0000 (UTC) (envelope-from raj@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 345388FC13;
	Fri, 20 Nov 2009 13:28:07 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAKDS7wd044942;
	Fri, 20 Nov 2009 13:28:07 GMT (envelope-from raj@svn.freebsd.org)
Received: (from raj@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAKDS7vd044940;
	Fri, 20 Nov 2009 13:28:07 GMT (envelope-from raj@svn.freebsd.org)
Message-Id: <200911201328.nAKDS7vd044940@svn.freebsd.org>
From: Rafal Jaworowski 
Date: Fri, 20 Nov 2009 13:28: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: r199580 - head/sys/dev/tsec
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 20 Nov 2009 13:28:07 -0000

Author: raj
Date: Fri Nov 20 13:28:06 2009
New Revision: 199580
URL: http://svn.freebsd.org/changeset/base/199580

Log:
  tsec: Use IFQ_DRV macros for managing interface packet queue.
  
  This lets tsec(4) work with ALTQ.
  
  Submitted by:	Marcin Ligenza
  MFC after:	1 week

Modified:
  head/sys/dev/tsec/if_tsec.c

Modified: head/sys/dev/tsec/if_tsec.c
==============================================================================
--- head/sys/dev/tsec/if_tsec.c	Fri Nov 20 12:48:35 2009	(r199579)
+++ head/sys/dev/tsec/if_tsec.c	Fri Nov 20 13:28:06 2009	(r199580)
@@ -716,9 +716,9 @@ tsec_start_locked(struct ifnet *ifp)
 	bus_dmamap_sync(sc->tsec_tx_dtag, sc->tsec_tx_dmap,
 	    BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
 
-	for (;;) {
+	while (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) {
 		/* Get packet from the queue */
-		IF_DEQUEUE(&ifp->if_snd, m0);
+		IFQ_DRV_DEQUEUE(&ifp->if_snd, m0);
 		if (m0 == NULL)
 			break;
 
@@ -755,7 +755,7 @@ tsec_start_locked(struct ifnet *ifp)
 			m0 = mtmp;
 
 		if (tsec_encap(sc, m0, fcb_inserted)) {
-			IF_PREPEND(&ifp->if_snd, m0);
+			IFQ_DRV_PREPEND(&ifp->if_snd, m0);
 			ifp->if_drv_flags |= IFF_DRV_OACTIVE;
 			break;
 		}

From owner-svn-src-head@FreeBSD.ORG  Fri Nov 20 14:41:37 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D08D61065670;
	Fri, 20 Nov 2009 14:41:37 +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 8D33D8FC15;
	Fri, 20 Nov 2009 14:41:37 +0000 (UTC)
Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net
	[66.111.2.69])
	by cyrus.watson.org (Postfix) with ESMTPSA id 2942E46B03;
	Fri, 20 Nov 2009 09:41:37 -0500 (EST)
Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.9])
	by bigwig.baldwin.cx (Postfix) with ESMTPA id 768678A01B;
	Fri, 20 Nov 2009 09:41:36 -0500 (EST)
From: John Baldwin 
To: Jung-uk Kim 
Date: Fri, 20 Nov 2009 07:43:26 -0500
User-Agent: KMail/1.9.7
References: <200911182340.nAINeJ3W087652@svn.freebsd.org>
	<200911191649.37198.jhb@freebsd.org>
	<200911191731.04075.jkim@FreeBSD.org>
In-Reply-To: <200911191731.04075.jkim@FreeBSD.org>
MIME-Version: 1.0
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200911200743.27239.jhb@freebsd.org>
X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1
	(bigwig.baldwin.cx); Fri, 20 Nov 2009 09:41:36 -0500 (EST)
X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx
X-Virus-Status: Clean
X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE
	autolearn=no version=3.2.5
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org, Robert Watson 
Subject: Re: svn commit: r199498 - in head/sys: amd64/amd64 i386/i386 net
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 20 Nov 2009 14:41:37 -0000

On Thursday 19 November 2009 5:31:00 pm Jung-uk Kim wrote:
> On Thursday 19 November 2009 04:49 pm, John Baldwin wrote:
> > On Thursday 19 November 2009 11:15:01 am Jung-uk Kim wrote:
> > > On Thursday 19 November 2009 03:26 am, Robert Watson wrote:
> > > > On Wed, 18 Nov 2009, Jung-uk Kim wrote:
> > > > >  - Change internal function bpf_jit_compile() to return
> > > > > allocated size of the generated binary and remove page size
> > > > > limitation for userland. - Use contigmalloc(9)/contigfree(9)
> > > > > instead of malloc(9)/free(9) to make sure the generated
> > > > > binary aligns properly and make it physically contiguous.
> > > >
> > > > Is physical contiguity actually required here -- I would have
> > > > thought virtual contiguity and alignment would be sufficient,
> > > > in which case the normal trick is to allocate using malloc the
> > > > size + min-align + 1 and then fudge the pointer forward until
> > > > it's properly aligned.
> > >
> > > I don't believe it is strictly necessary but I assumed it might
> > > have performance benefit for very big BPF programs although I
> > > have not measured it.  Also, contigmalloc(9)/contigfree(9) is too
> > > obvious to ignore for this purpose. :-)
> >
> > Why would it have a performance benefit to have the pages be
> > physically contiguous?  contigmalloc() is expensive and should
> > really only be used if you truly need contiguous memory.  If you
> > can get by with malloc(), just use malloc().
> 
> Remember are allocating memory for a function pointer here.  If we 
> want to take care of alignment, then "fudging the pointer forward" 
> trick is not going to be easy unless I embed real offset in the 
> structure and pass it around with the pointer.  I don't mind doing it 
> but it seemed unnecessary to me.  Besides, it is very unlikely to see 
> a lot of parallel BPF filter allocations in real world.  Actually, 
> that is a big assumption for BPF JIT compiler by itself because 
> filter compilation is expensive.  Also, if contigmalloc() fails, 
> bpf(4) simply falls back to good old bpf_filter().  So, I don't see 
> anything wrong with this.

Why does a function pointer matter?  Fudging the pointer forward will always 
work as virtual addresses always have the same sub-page alignment as physical 
addresses, so doing something like:

	foo *realp;
	void *p;

	align = 16;
	p = malloc(size + (align -1));
	realp = (foo *)(roundup2((uintptr_t)p, align));

Will always work to give a 16-byte aligned pointer.  However, the in-kernel 
malloc() already gives you aligned memory anyway.  Are you seeing any panics
or buggy behavior when using malloc()?

-- 
John Baldwin

From owner-svn-src-head@FreeBSD.ORG  Fri Nov 20 15:27:01 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 74785106566C;
	Fri, 20 Nov 2009 15:27:01 +0000 (UTC)
	(envelope-from netchild@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 61F8C8FC20;
	Fri, 20 Nov 2009 15:27:01 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAKFR1o3047806;
	Fri, 20 Nov 2009 15:27:01 GMT
	(envelope-from netchild@svn.freebsd.org)
Received: (from netchild@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAKFR1RS047805;
	Fri, 20 Nov 2009 15:27:01 GMT
	(envelope-from netchild@svn.freebsd.org)
Message-Id: <200911201527.nAKFR1RS047805@svn.freebsd.org>
From: Alexander Leidinger 
Date: Fri, 20 Nov 2009 15:27: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: r199582 - head/sbin/fsck
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 20 Nov 2009 15:27:01 -0000

Author: netchild
Date: Fri Nov 20 15:27:00 2009
New Revision: 199582
URL: http://svn.freebsd.org/changeset/base/199582

Log:
  Fix minor resource leak in a function which was introduced by changing an
  err() to a return in r106254.
  
  MFC after:	1 week

Modified:
  head/sbin/fsck/fsck.c

Modified: head/sbin/fsck/fsck.c
==============================================================================
--- head/sbin/fsck/fsck.c	Fri Nov 20 14:50:03 2009	(r199581)
+++ head/sbin/fsck/fsck.c	Fri Nov 20 15:27:00 2009	(r199582)
@@ -543,8 +543,10 @@ getfslab(const char *str)
 	if ((fd = open(str, O_RDONLY)) == -1)
 		err(1, "cannot open `%s'", str);
 
-	if (ioctl(fd, DIOCGDINFO, &dl) == -1)
+	if (ioctl(fd, DIOCGDINFO, &dl) == -1) {
+		(void) close(fd);
 		return(NULL);
+	}
 
 	(void) close(fd);
 

From owner-svn-src-head@FreeBSD.ORG  Fri Nov 20 15:28:38 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DAAD2106568D;
	Fri, 20 Nov 2009 15:28:38 +0000 (UTC)
	(envelope-from netchild@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C96208FC25;
	Fri, 20 Nov 2009 15:28:38 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAKFScGt047902;
	Fri, 20 Nov 2009 15:28:38 GMT
	(envelope-from netchild@svn.freebsd.org)
Received: (from netchild@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAKFSco5047900;
	Fri, 20 Nov 2009 15:28:38 GMT
	(envelope-from netchild@svn.freebsd.org)
Message-Id: <200911201528.nAKFSco5047900@svn.freebsd.org>
From: Alexander Leidinger 
Date: Fri, 20 Nov 2009 15:28: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: r199584 - head/sbin/mount_cd9660
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 20 Nov 2009 15:28:39 -0000

Author: netchild
Date: Fri Nov 20 15:28:38 2009
New Revision: 199584
URL: http://svn.freebsd.org/changeset/base/199584

Log:
  Fix minor memory leak in a function.
  
  MFC after:	1 week

Modified:
  head/sbin/mount_cd9660/mount_cd9660.c

Modified: head/sbin/mount_cd9660/mount_cd9660.c
==============================================================================
--- head/sbin/mount_cd9660/mount_cd9660.c	Fri Nov 20 15:27:52 2009	(r199583)
+++ head/sbin/mount_cd9660/mount_cd9660.c	Fri Nov 20 15:28:38 2009	(r199584)
@@ -251,8 +251,10 @@ set_charset(struct iovec **iov, int *iov
 
 	if ((cs_disk = malloc(ICONV_CSNMAXLEN)) == NULL)
 		return (-1);
-	if ((cs_local = malloc(ICONV_CSNMAXLEN)) == NULL)
+	if ((cs_local = malloc(ICONV_CSNMAXLEN)) == NULL) {
+		free(cs_disk);
 		return (-1);
+	}
 	strncpy(cs_disk, ENCODING_UNICODE, ICONV_CSNMAXLEN);
 	strncpy(cs_local, kiconv_quirkcs(localcs, KICONV_VENDOR_MICSFT),
 	    ICONV_CSNMAXLEN);

From owner-svn-src-head@FreeBSD.ORG  Fri Nov 20 17:59:50 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 569EB1065676;
	Fri, 20 Nov 2009 17:59:50 +0000 (UTC)
	(envelope-from marcel@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 460AB8FC19;
	Fri, 20 Nov 2009 17:59:50 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAKHxojU052050;
	Fri, 20 Nov 2009 17:59:50 GMT (envelope-from marcel@svn.freebsd.org)
Received: (from marcel@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAKHxo6I052048;
	Fri, 20 Nov 2009 17:59:50 GMT (envelope-from marcel@svn.freebsd.org)
Message-Id: <200911201759.nAKHxo6I052048@svn.freebsd.org>
From: Marcel Moolenaar 
Date: Fri, 20 Nov 2009 17:59:50 +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: r199602 - head/sys/powerpc/mpc85xx
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 20 Nov 2009 17:59:50 -0000

Author: marcel
Date: Fri Nov 20 17:59:50 2009
New Revision: 199602
URL: http://svn.freebsd.org/changeset/base/199602

Log:
  Always allocate PCI/ISA interrupts as shareable so that shared
  interrupts don't cause driver attach failures.

Modified:
  head/sys/powerpc/mpc85xx/pci_ocp.c

Modified: head/sys/powerpc/mpc85xx/pci_ocp.c
==============================================================================
--- head/sys/powerpc/mpc85xx/pci_ocp.c	Fri Nov 20 17:17:44 2009	(r199601)
+++ head/sys/powerpc/mpc85xx/pci_ocp.c	Fri Nov 20 17:59:50 2009	(r199602)
@@ -783,6 +783,7 @@ pci_ocp_alloc_resource(device_t dev, dev
 			device_printf(dev, "%s requested ISA interrupt %lu\n",
 			    device_get_nameunit(child), start);
 		}
+		flags |= RF_SHAREABLE;
 		return (BUS_ALLOC_RESOURCE(device_get_parent(dev), child,
 		    type, rid, start, end, count, flags));
 	default:

From owner-svn-src-head@FreeBSD.ORG  Fri Nov 20 18:49:20 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E464D1065676;
	Fri, 20 Nov 2009 18:49:20 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D1BBF8FC1F;
	Fri, 20 Nov 2009 18:49:20 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAKInKR5053107;
	Fri, 20 Nov 2009 18:49:20 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAKInKt6053100;
	Fri, 20 Nov 2009 18:49:20 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <200911201849.nAKInKt6053100@svn.freebsd.org>
From: Jung-uk Kim 
Date: Fri, 20 Nov 2009 18:49: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: r199603 - in head/sys: amd64/amd64 i386/i386 net
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 20 Nov 2009 18:49:21 -0000

Author: jkim
Date: Fri Nov 20 18:49:20 2009
New Revision: 199603
URL: http://svn.freebsd.org/changeset/base/199603

Log:
  - Allocate scratch memory on stack instead of pre-allocating it with
  the filter as we do from bpf_filter()[1].
  - Revert experimental use of contigmalloc(9)/contigfree(9).  It has no
  performance benefit over malloc(9)/free(9)[2].
  
  Requested by:	rwatson[1]
  Pointed out by:	rwatson, jhb, alc[2]

Modified:
  head/sys/amd64/amd64/bpf_jit_machdep.c
  head/sys/amd64/amd64/bpf_jit_machdep.h
  head/sys/i386/i386/bpf_jit_machdep.c
  head/sys/i386/i386/bpf_jit_machdep.h
  head/sys/net/bpf_jitter.c
  head/sys/net/bpf_jitter.h

Modified: head/sys/amd64/amd64/bpf_jit_machdep.c
==============================================================================
--- head/sys/amd64/amd64/bpf_jit_machdep.c	Fri Nov 20 17:59:50 2009	(r199602)
+++ head/sys/amd64/amd64/bpf_jit_machdep.c	Fri Nov 20 18:49:20 2009	(r199603)
@@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-bpf_filter_func	bpf_jit_compile(struct bpf_insn *, u_int, size_t *, int *);
+bpf_filter_func	bpf_jit_compile(struct bpf_insn *, u_int, size_t *);
 
 /*
  * emit routine to update the jump table
@@ -97,7 +97,7 @@ emit_code(bpf_bin_stream *stream, u_int 
  * Function that does the real stuff
  */
 bpf_filter_func
-bpf_jit_compile(struct bpf_insn *prog, u_int nins, size_t *size, int *mem)
+bpf_jit_compile(struct bpf_insn *prog, u_int nins, size_t *size)
 {
 	bpf_bin_stream stream;
 	struct bpf_insn *ins;
@@ -111,10 +111,9 @@ bpf_jit_compile(struct bpf_insn *prog, u
 
 	/* Allocate the reference table for the jumps */
 #ifdef _KERNEL
-	stream.refs = (u_int *)malloc((nins + 1) * sizeof(u_int),
-	    M_BPFJIT, M_NOWAIT);
+	stream.refs = malloc((nins + 1) * sizeof(u_int), M_BPFJIT, M_NOWAIT);
 #else
-	stream.refs = (u_int *)malloc((nins + 1) * sizeof(u_int));
+	stream.refs = malloc((nins + 1) * sizeof(u_int));
 #endif
 	if (stream.refs == NULL)
 		return (NULL);
@@ -137,8 +136,10 @@ bpf_jit_compile(struct bpf_insn *prog, u
 		ins = prog;
 
 		/* create the procedure header */
-		MOVrq2(RBX, R8);
-		MOVrq(RDI, RBX);
+		PUSH(RBP);
+		MOVrq(RSP, RBP);
+		SUBib(BPF_MEMWORDS * sizeof(uint32_t), RSP);
+		MOVrq2(RDI, R8);
 		MOVrd2(ESI, R9D);
 		MOVrd(EDX, EDI);
 
@@ -155,13 +156,11 @@ bpf_jit_compile(struct bpf_insn *prog, u
 
 			case BPF_RET|BPF_K:
 				MOVid(ins->k, EAX);
-				MOVrq3(R8, RBX);
-				RET();
+				LEAVE_RET();
 				break;
 
 			case BPF_RET|BPF_A:
-				MOVrq3(R8, RBX);
-				RET();
+				LEAVE_RET();
 				break;
 
 			case BPF_LD|BPF_W|BPF_ABS:
@@ -171,11 +170,11 @@ bpf_jit_compile(struct bpf_insn *prog, u
 				MOVrd(EDI, ECX);
 				SUBrd(ESI, ECX);
 				CMPid(sizeof(int32_t), ECX);
-				JAEb(6);
+				JAEb(4);
 				ZEROrd(EAX);
-				MOVrq3(R8, RBX);
-				RET();
-				MOVobd(RBX, RSI, EAX);
+				LEAVE_RET();
+				MOVrq3(R8, RCX);
+				MOVobd(RCX, RSI, EAX);
 				BSWAP(EAX);
 				break;
 
@@ -187,10 +186,10 @@ bpf_jit_compile(struct bpf_insn *prog, u
 				MOVrd(EDI, ECX);
 				SUBrd(ESI, ECX);
 				CMPid(sizeof(int16_t), ECX);
-				JAEb(4);
-				MOVrq3(R8, RBX);
-				RET();
-				MOVobw(RBX, RSI, AX);
+				JAEb(2);
+				LEAVE_RET();
+				MOVrq3(R8, RCX);
+				MOVobw(RCX, RSI, AX);
 				SWAP_AX();
 				break;
 
@@ -198,10 +197,10 @@ bpf_jit_compile(struct bpf_insn *prog, u
 				ZEROrd(EAX);
 				MOVid(ins->k, ESI);
 				CMPrd(EDI, ESI);
-				JBb(4);
-				MOVrq3(R8, RBX);
-				RET();
-				MOVobb(RBX, RSI, AL);
+				JBb(2);
+				LEAVE_RET();
+				MOVrq3(R8, RCX);
+				MOVobb(RCX, RSI, AL);
 				break;
 
 			case BPF_LD|BPF_W|BPF_LEN:
@@ -224,11 +223,11 @@ bpf_jit_compile(struct bpf_insn *prog, u
 				MOVrd(EDI, ECX);
 				SUBrd(ESI, ECX);
 				CMPid(sizeof(int32_t), ECX);
-				JAEb(6);
+				JAEb(4);
 				ZEROrd(EAX);
-				MOVrq3(R8, RBX);
-				RET();
-				MOVobd(RBX, RSI, EAX);
+				LEAVE_RET();
+				MOVrq3(R8, RCX);
+				MOVobd(RCX, RSI, EAX);
 				BSWAP(EAX);
 				break;
 
@@ -245,10 +244,10 @@ bpf_jit_compile(struct bpf_insn *prog, u
 				MOVrd(EDI, ECX);
 				SUBrd(ESI, ECX);
 				CMPid(sizeof(int16_t), ECX);
-				JAEb(4);
-				MOVrq3(R8, RBX);
-				RET();
-				MOVobw(RBX, RSI, AX);
+				JAEb(2);
+				LEAVE_RET();
+				MOVrq3(R8, RCX);
+				MOVobw(RCX, RSI, AX);
 				SWAP_AX();
 				break;
 
@@ -260,22 +259,22 @@ bpf_jit_compile(struct bpf_insn *prog, u
 				MOVrd(EDI, ECX);
 				SUBrd(EDX, ECX);
 				CMPrd(ESI, ECX);
-				JAb(4);
-				MOVrq3(R8, RBX);
-				RET();
+				JAb(2);
+				LEAVE_RET();
+				MOVrq3(R8, RCX);
 				ADDrd(EDX, ESI);
-				MOVobb(RBX, RSI, AL);
+				MOVobb(RCX, RSI, AL);
 				break;
 
 			case BPF_LDX|BPF_MSH|BPF_B:
 				MOVid(ins->k, ESI);
 				CMPrd(EDI, ESI);
-				JBb(6);
+				JBb(4);
 				ZEROrd(EAX);
-				MOVrq3(R8, RBX);
-				RET();
+				LEAVE_RET();
 				ZEROrd(EDX);
-				MOVobb(RBX, RSI, DL);
+				MOVrq3(R8, RCX);
+				MOVobb(RCX, RSI, DL);
 				ANDib(0x0f, DL);
 				SHLib(2, EDX);
 				break;
@@ -289,15 +288,13 @@ bpf_jit_compile(struct bpf_insn *prog, u
 				break;
 
 			case BPF_LD|BPF_MEM:
-				MOViq((uintptr_t)mem, RCX);
-				MOVid(ins->k * 4, ESI);
-				MOVobd(RCX, RSI, EAX);
+				MOVid(ins->k * sizeof(uint32_t), ESI);
+				MOVobd(RSP, RSI, EAX);
 				break;
 
 			case BPF_LDX|BPF_MEM:
-				MOViq((uintptr_t)mem, RCX);
-				MOVid(ins->k * 4, ESI);
-				MOVobd(RCX, RSI, EDX);
+				MOVid(ins->k * sizeof(uint32_t), ESI);
+				MOVobd(RSP, RSI, EDX);
 				break;
 
 			case BPF_ST:
@@ -306,15 +303,13 @@ bpf_jit_compile(struct bpf_insn *prog, u
 				 * be optimized if the previous instruction
 				 * was already of this type
 				 */
-				MOViq((uintptr_t)mem, RCX);
-				MOVid(ins->k * 4, ESI);
-				MOVomd(EAX, RCX, RSI);
+				MOVid(ins->k * sizeof(uint32_t), ESI);
+				MOVomd(EAX, RSP, RSI);
 				break;
 
 			case BPF_STX:
-				MOViq((uintptr_t)mem, RCX);
-				MOVid(ins->k * 4, ESI);
-				MOVomd(EDX, RCX, RSI);
+				MOVid(ins->k * sizeof(uint32_t), ESI);
+				MOVomd(EDX, RSP, RSI);
 				break;
 
 			case BPF_JMP|BPF_JA:
@@ -394,10 +389,9 @@ bpf_jit_compile(struct bpf_insn *prog, u
 
 			case BPF_ALU|BPF_DIV|BPF_X:
 				TESTrd(EDX, EDX);
-				JNEb(6);
+				JNEb(4);
 				ZEROrd(EAX);
-				MOVrq3(R8, RBX);
-				RET();
+				LEAVE_RET();
 				MOVrd(EDX, ECX);
 				ZEROrd(EDX);
 				DIVrd(ECX);
@@ -490,13 +484,12 @@ bpf_jit_compile(struct bpf_insn *prog, u
 		}
 
 #ifdef _KERNEL
-		stream.ibuf = (char *)contigmalloc(stream.cur_ip, M_BPFJIT,
-		    M_NOWAIT, 0, ~0UL, 16, 0);
+		stream.ibuf = malloc(stream.cur_ip, M_BPFJIT, M_NOWAIT);
 		if (stream.ibuf == NULL)
 			break;
 #else
-		stream.ibuf = (char *)mmap(NULL, stream.cur_ip,
-		    PROT_READ | PROT_WRITE, MAP_ANON, -1, 0);
+		stream.ibuf = mmap(NULL, stream.cur_ip, PROT_READ | PROT_WRITE,
+		    MAP_ANON, -1, 0);
 		if (stream.ibuf == MAP_FAILED) {
 			stream.ibuf = NULL;
 			break;

Modified: head/sys/amd64/amd64/bpf_jit_machdep.h
==============================================================================
--- head/sys/amd64/amd64/bpf_jit_machdep.h	Fri Nov 20 17:59:50 2009	(r199602)
+++ head/sys/amd64/amd64/bpf_jit_machdep.h	Fri Nov 20 18:49:20 2009	(r199603)
@@ -215,9 +215,14 @@ typedef void (*emit_func)(bpf_bin_stream
 	emitm(&stream, 0xc486, 2);					\
 } while (0)
 
-/* ret */
-#define RET() do {						\
-	emitm(&stream, 0xc3, 1);					\
+/* pushq r64 */
+#define PUSH(r64) do {							\
+	emitm(&stream, (5 << 4) | (0 << 3) | (r64 & 0x7), 1);		\
+} while (0)
+
+/* leave/ret */
+#define LEAVE_RET() do {						\
+	emitm(&stream, 0xc3c9, 2);					\
 } while (0)
 
 /* addl sr32,dr32 */
@@ -253,6 +258,13 @@ typedef void (*emit_func)(bpf_bin_stream
 	emitm(&stream, i32, 4);						\
 } while (0)
 
+/* subq i8,r64 */
+#define SUBib(i8, r64) do {						\
+	emitm(&stream, 0x8348, 2);					\
+	emitm(&stream, (29 << 3) | (r64 & 0x7), 1);			\
+	emitm(&stream, i8, 1);						\
+} while (0)
+
 /* mull r32 */
 #define MULrd(r32) do {							\
 	emitm(&stream, 0xf7, 1);					\

Modified: head/sys/i386/i386/bpf_jit_machdep.c
==============================================================================
--- head/sys/i386/i386/bpf_jit_machdep.c	Fri Nov 20 17:59:50 2009	(r199602)
+++ head/sys/i386/i386/bpf_jit_machdep.c	Fri Nov 20 18:49:20 2009	(r199603)
@@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
-bpf_filter_func	bpf_jit_compile(struct bpf_insn *, u_int, size_t *, int *);
+bpf_filter_func	bpf_jit_compile(struct bpf_insn *, u_int, size_t *);
 
 /*
  * emit routine to update the jump table
@@ -97,7 +97,7 @@ emit_code(bpf_bin_stream *stream, u_int 
  * Function that does the real stuff
  */
 bpf_filter_func
-bpf_jit_compile(struct bpf_insn *prog, u_int nins, size_t *size, int *mem)
+bpf_jit_compile(struct bpf_insn *prog, u_int nins, size_t *size)
 {
 	bpf_bin_stream stream;
 	struct bpf_insn *ins;
@@ -111,10 +111,9 @@ bpf_jit_compile(struct bpf_insn *prog, u
 
 	/* Allocate the reference table for the jumps */
 #ifdef _KERNEL
-	stream.refs = (u_int *)malloc((nins + 1) * sizeof(u_int),
-	    M_BPFJIT, M_NOWAIT);
+	stream.refs = malloc((nins + 1) * sizeof(u_int), M_BPFJIT, M_NOWAIT);
 #else
-	stream.refs = (u_int *)malloc((nins + 1) * sizeof(u_int));
+	stream.refs = malloc((nins + 1) * sizeof(u_int));
 #endif
 	if (stream.refs == NULL)
 		return (NULL);
@@ -139,6 +138,7 @@ bpf_jit_compile(struct bpf_insn *prog, u
 		/* create the procedure header */
 		PUSH(EBP);
 		MOVrd(ESP, EBP);
+		SUBib(BPF_MEMWORDS * sizeof(uint32_t), ESP);
 		PUSH(EDI);
 		PUSH(ESI);
 		PUSH(EBX);
@@ -310,14 +310,16 @@ bpf_jit_compile(struct bpf_insn *prog, u
 				break;
 
 			case BPF_LD|BPF_MEM:
-				MOVid((uintptr_t)mem, ECX);
-				MOVid(ins->k * 4, ESI);
+				MOVrd(EBP, ECX);
+				MOVid(((int)ins->k - BPF_MEMWORDS) *
+				    sizeof(uint32_t), ESI);
 				MOVobd(ECX, ESI, EAX);
 				break;
 
 			case BPF_LDX|BPF_MEM:
-				MOVid((uintptr_t)mem, ECX);
-				MOVid(ins->k * 4, ESI);
+				MOVrd(EBP, ECX);
+				MOVid(((int)ins->k - BPF_MEMWORDS) *
+				    sizeof(uint32_t), ESI);
 				MOVobd(ECX, ESI, EDX);
 				break;
 
@@ -327,14 +329,16 @@ bpf_jit_compile(struct bpf_insn *prog, u
 				 * be optimized if the previous instruction
 				 * was already of this type
 				 */
-				MOVid((uintptr_t)mem, ECX);
-				MOVid(ins->k * 4, ESI);
+				MOVrd(EBP, ECX);
+				MOVid(((int)ins->k - BPF_MEMWORDS) *
+				    sizeof(uint32_t), ESI);
 				MOVomd(EAX, ECX, ESI);
 				break;
 
 			case BPF_STX:
-				MOVid((uintptr_t)mem, ECX);
-				MOVid(ins->k * 4, ESI);
+				MOVrd(EBP, ECX);
+				MOVid(((int)ins->k - BPF_MEMWORDS) *
+				    sizeof(uint32_t), ESI);
 				MOVomd(EDX, ECX, ESI);
 				break;
 
@@ -513,13 +517,12 @@ bpf_jit_compile(struct bpf_insn *prog, u
 		}
 
 #ifdef _KERNEL
-		stream.ibuf = (char *)contigmalloc(stream.cur_ip, M_BPFJIT,
-		    M_NOWAIT, 0, ~0UL, 16, 0);
+		stream.ibuf = malloc(stream.cur_ip, M_BPFJIT, M_NOWAIT);
 		if (stream.ibuf == NULL)
 			break;
 #else
-		stream.ibuf = (char *)mmap(NULL, stream.cur_ip,
-		    PROT_READ | PROT_WRITE, MAP_ANON, -1, 0);
+		stream.ibuf = mmap(NULL, stream.cur_ip, PROT_READ | PROT_WRITE,
+		    MAP_ANON, -1, 0);
 		if (stream.ibuf == MAP_FAILED) {
 			stream.ibuf = NULL;
 			break;

Modified: head/sys/i386/i386/bpf_jit_machdep.h
==============================================================================
--- head/sys/i386/i386/bpf_jit_machdep.h	Fri Nov 20 17:59:50 2009	(r199602)
+++ head/sys/i386/i386/bpf_jit_machdep.h	Fri Nov 20 18:49:20 2009	(r199603)
@@ -203,6 +203,13 @@ typedef void (*emit_func)(bpf_bin_stream
 	emitm(&stream, i32, 4);						\
 } while (0)
 
+/* subl i8,r32 */
+#define SUBib(i8, r32) do {						\
+	emitm(&stream, 0x83, 1);					\
+	emitm(&stream, (29 << 3) | (r32 & 0x7), 1);			\
+	emitm(&stream, i8, 1);						\
+} while (0)
+
 /* mull r32 */
 #define MULrd(r32) do {							\
 	emitm(&stream, 0xf7, 1);					\

Modified: head/sys/net/bpf_jitter.c
==============================================================================
--- head/sys/net/bpf_jitter.c	Fri Nov 20 17:59:50 2009	(r199602)
+++ head/sys/net/bpf_jitter.c	Fri Nov 20 18:49:20 2009	(r199603)
@@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-bpf_filter_func	bpf_jit_compile(struct bpf_insn *, u_int, size_t *, int *);
+bpf_filter_func	bpf_jit_compile(struct bpf_insn *, u_int, size_t *);
 
 static u_int	bpf_jit_accept_all(u_char *, u_int, u_int);
 
@@ -70,7 +70,7 @@ bpf_jitter(struct bpf_insn *fp, int nins
 
 	/* Allocate the filter structure */
 	filter = (struct bpf_jit_filter *)malloc(sizeof(*filter),
-	    M_BPFJIT, M_NOWAIT | M_ZERO);
+	    M_BPFJIT, M_NOWAIT);
 	if (filter == NULL)
 		return (NULL);
 
@@ -81,8 +81,7 @@ bpf_jitter(struct bpf_insn *fp, int nins
 	}
 
 	/* Create the binary */
-	if ((filter->func = bpf_jit_compile(fp, nins, &filter->size,
-	    filter->mem)) == NULL) {
+	if ((filter->func = bpf_jit_compile(fp, nins, &filter->size)) == NULL) {
 		free(filter, M_BPFJIT);
 		return (NULL);
 	}
@@ -95,7 +94,7 @@ bpf_destroy_jit_filter(bpf_jit_filter *f
 {
 
 	if (filter->func != bpf_jit_accept_all)
-		contigfree(filter->func, filter->size, M_BPFJIT);
+		free(filter->func, M_BPFJIT);
 	free(filter, M_BPFJIT);
 }
 #else
@@ -108,7 +107,6 @@ bpf_jitter(struct bpf_insn *fp, int nins
 	filter = (struct bpf_jit_filter *)malloc(sizeof(*filter));
 	if (filter == NULL)
 		return (NULL);
-	memset(filter, 0, sizeof(*filter));
 
 	/* No filter means accept all */
 	if (fp == NULL || nins == 0) {
@@ -117,8 +115,7 @@ bpf_jitter(struct bpf_insn *fp, int nins
 	}
 
 	/* Create the binary */
-	if ((filter->func = bpf_jit_compile(fp, nins, &filter->size,
-	    filter->mem)) == NULL) {
+	if ((filter->func = bpf_jit_compile(fp, nins, &filter->size)) == NULL) {
 		free(filter);
 		return (NULL);
 	}

Modified: head/sys/net/bpf_jitter.h
==============================================================================
--- head/sys/net/bpf_jitter.h	Fri Nov 20 17:59:50 2009	(r199602)
+++ head/sys/net/bpf_jitter.h	Fri Nov 20 18:49:20 2009	(r199603)
@@ -54,7 +54,6 @@ typedef struct bpf_jit_filter {
 	/* The native filtering binary, in the form of a bpf_filter_func. */
 	bpf_filter_func	func;
 	size_t		size;
-	int		mem[BPF_MEMWORDS];	/* Scratch memory */
 } bpf_jit_filter;
 
 /*

From owner-svn-src-head@FreeBSD.ORG  Fri Nov 20 18:53:38 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B8A88106575D;
	Fri, 20 Nov 2009 18:53:38 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A6CC38FC0A;
	Fri, 20 Nov 2009 18:53:38 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAKIrc6G053225;
	Fri, 20 Nov 2009 18:53:38 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAKIrcoZ053217;
	Fri, 20 Nov 2009 18:53:38 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <200911201853.nAKIrcoZ053217@svn.freebsd.org>
From: Jung-uk Kim 
Date: Fri, 20 Nov 2009 18:53: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: r199604 - in head/tools/regression/bpf/bpf_filter: .
	tests
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 20 Nov 2009 18:53:38 -0000

Author: jkim
Date: Fri Nov 20 18:53:38 2009
New Revision: 199604
URL: http://svn.freebsd.org/changeset/base/199604

Log:
  Adjust BPF JIT compiler regression tests to catch up with r199603.

Modified:
  head/tools/regression/bpf/bpf_filter/Makefile
  head/tools/regression/bpf/bpf_filter/bpf_test.c
  head/tools/regression/bpf/bpf_filter/tests/test0075.h
  head/tools/regression/bpf/bpf_filter/tests/test0076.h
  head/tools/regression/bpf/bpf_filter/tests/test0077.h
  head/tools/regression/bpf/bpf_filter/tests/test0078.h
  head/tools/regression/bpf/bpf_filter/tests/test0080.h

Modified: head/tools/regression/bpf/bpf_filter/Makefile
==============================================================================
--- head/tools/regression/bpf/bpf_filter/Makefile	Fri Nov 20 18:49:20 2009	(r199603)
+++ head/tools/regression/bpf/bpf_filter/Makefile	Fri Nov 20 18:53:38 2009	(r199604)
@@ -43,6 +43,7 @@ CFLAGS+=	-DBPF_VALIDATE
 SRCS+=		${SYSDIR}/net/bpf_jitter.c	\
 		${SYSDIR}/${MACHINE_ARCH}/${MACHINE_ARCH}/bpf_jit_machdep.c
 CFLAGS+=	-DBPF_JIT_COMPILER
+LIBS+=		-lutil
 WARNS?=		6
 .else
 SRCS+=		${SYSDIR}/net/bpf_filter.c
@@ -52,7 +53,7 @@ WARNS?=		2
 .for TEST in ${TEST_CASES}
 ${TEST}:	${.CURDIR}/tests/${TEST}.h ${SRCS}
 	@${CC} ${CFLAGS} -DBPF_TEST_H=\"${TEST}.h\"	\
-	    -o ${.CURDIR}/${TEST} ${SRCS}
+	    -o ${.CURDIR}/${TEST} ${SRCS} ${LIBS}
 .endfor
 
 all:		${TEST_CASES}

Modified: head/tools/regression/bpf/bpf_filter/bpf_test.c
==============================================================================
--- head/tools/regression/bpf/bpf_filter/bpf_test.c	Fri Nov 20 18:49:20 2009	(r199603)
+++ head/tools/regression/bpf/bpf_filter/bpf_test.c	Fri Nov 20 18:53:38 2009	(r199604)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (C) 2008 Jung-uk Kim . All rights reserved.
+ * Copyright (C) 2009 Jung-uk Kim . All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -57,6 +57,8 @@ static int	verbose = LOG_LEVEL;
 
 #ifdef BPF_JIT_COMPILER
 
+#include 
+
 #include 
 
 static u_int
@@ -73,6 +75,10 @@ bpf_compile_and_filter(void)
 			printf("FATAL\n");
 		exit(FATAL);
 	}
+	if (verbose > 2) {
+		printf("\n");
+		hexdump(filter->func, filter->size, NULL, HD_OMIT_CHARS);
+	}
 
 	for (i = 0; i < BPF_NRUNS; i++)
 		ret = (*(filter->func))(pkt, wirelen, buflen);
@@ -222,6 +228,14 @@ main(void)
 	for (i = 0; i < BPF_NRUNS; i++)
 		ret = bpf_filter(nins != 0 ? pc : NULL, pkt, wirelen, buflen);
 #endif
+	if (expect_signal != 0) {
+		if (verbose > 1)
+			printf("Expected signal %d but got none:\t",
+			    expect_signal);
+		if (verbose > 0)
+			printf("FAILED\n");
+		return (FAILED);
+	}
 	if (ret != expect) {
 		if (verbose > 1)
 			printf("Expected 0x%x but got 0x%x:\t", expect, ret);

Modified: head/tools/regression/bpf/bpf_filter/tests/test0075.h
==============================================================================
--- head/tools/regression/bpf/bpf_filter/tests/test0075.h	Fri Nov 20 18:49:20 2009	(r199603)
+++ head/tools/regression/bpf/bpf_filter/tests/test0075.h	Fri Nov 20 18:53:38 2009	(r199604)
@@ -7,7 +7,7 @@
 /* BPF program */
 struct bpf_insn pc[] = {
 	BPF_STMT(BPF_LD+BPF_IMM, 0xdeadc0de),
-	BPF_STMT(BPF_LD+BPF_MEM, 0xffffffff),
+	BPF_STMT(BPF_LD+BPF_MEM, 0x8fffffff),
 	BPF_STMT(BPF_RET+BPF_A, 0),
 };
 
@@ -29,8 +29,8 @@ int	invalid =	1;
 u_int	expect =	0xdeadc0de;
 
 /* Expected signal */
-#ifdef BPF_JIT_COMPILER
-int	expect_signal =	SIGSEGV;
-#else
+#ifdef __amd64__
 int	expect_signal =	SIGBUS;
+#else
+int	expect_signal =	SIGSEGV;
 #endif

Modified: head/tools/regression/bpf/bpf_filter/tests/test0076.h
==============================================================================
--- head/tools/regression/bpf/bpf_filter/tests/test0076.h	Fri Nov 20 18:49:20 2009	(r199603)
+++ head/tools/regression/bpf/bpf_filter/tests/test0076.h	Fri Nov 20 18:53:38 2009	(r199604)
@@ -7,7 +7,7 @@
 /* BPF program */
 struct bpf_insn pc[] = {
 	BPF_STMT(BPF_LD+BPF_IMM, 0xdeadc0de),
-	BPF_STMT(BPF_LDX+BPF_MEM, 0xffffffff),
+	BPF_STMT(BPF_LDX+BPF_MEM, 0x8fffffff),
 	BPF_STMT(BPF_MISC+BPF_TXA, 0),
 	BPF_STMT(BPF_RET+BPF_A, 0),
 };
@@ -30,8 +30,8 @@ int	invalid =	1;
 u_int	expect =	0xdeadc0de;
 
 /* Expected signal */
-#ifdef BPF_JIT_COMPILER
-int	expect_signal =	SIGSEGV;
-#else
+#ifdef __amd64__
 int	expect_signal =	SIGBUS;
+#else
+int	expect_signal =	SIGSEGV;
 #endif

Modified: head/tools/regression/bpf/bpf_filter/tests/test0077.h
==============================================================================
--- head/tools/regression/bpf/bpf_filter/tests/test0077.h	Fri Nov 20 18:49:20 2009	(r199603)
+++ head/tools/regression/bpf/bpf_filter/tests/test0077.h	Fri Nov 20 18:53:38 2009	(r199604)
@@ -7,7 +7,7 @@
 /* BPF program */
 struct bpf_insn pc[] = {
 	BPF_STMT(BPF_LD+BPF_IMM, 0xdeadc0de),
-	BPF_STMT(BPF_ST, 0xffffffff),
+	BPF_STMT(BPF_ST, 0x8fffffff),
 	BPF_STMT(BPF_RET+BPF_A, 0),
 };
 
@@ -29,8 +29,8 @@ int	invalid =	1;
 u_int	expect =	0xdeadc0de;
 
 /* Expected signal */
-#ifdef BPF_JIT_COMPILER
-int	expect_signal =	SIGSEGV;
-#else
+#ifdef __amd64__
 int	expect_signal =	SIGBUS;
+#else
+int	expect_signal =	SIGSEGV;
 #endif

Modified: head/tools/regression/bpf/bpf_filter/tests/test0078.h
==============================================================================
--- head/tools/regression/bpf/bpf_filter/tests/test0078.h	Fri Nov 20 18:49:20 2009	(r199603)
+++ head/tools/regression/bpf/bpf_filter/tests/test0078.h	Fri Nov 20 18:53:38 2009	(r199604)
@@ -7,7 +7,7 @@
 /* BPF program */
 struct bpf_insn pc[] = {
 	BPF_STMT(BPF_LD+BPF_IMM, 0xdeadc0de),
-	BPF_STMT(BPF_STX, 0xffffffff),
+	BPF_STMT(BPF_STX, 0x8fffffff),
 	BPF_STMT(BPF_MISC+BPF_TXA, 0),
 	BPF_STMT(BPF_RET+BPF_A, 0),
 };
@@ -30,8 +30,8 @@ int	invalid =	1;
 u_int	expect =	0xdeadc0de;
 
 /* Expected signal */
-#ifdef BPF_JIT_COMPILER
-int	expect_signal =	SIGSEGV;
-#else
+#ifdef __amd64__
 int	expect_signal =	SIGBUS;
+#else
+int	expect_signal =	SIGSEGV;
 #endif

Modified: head/tools/regression/bpf/bpf_filter/tests/test0080.h
==============================================================================
--- head/tools/regression/bpf/bpf_filter/tests/test0080.h	Fri Nov 20 18:49:20 2009	(r199603)
+++ head/tools/regression/bpf/bpf_filter/tests/test0080.h	Fri Nov 20 18:53:38 2009	(r199604)
@@ -1,12 +1,12 @@
 /*-
- * Test 0080:	Check uninitialized scratch memory (only for JIT compiler).
+ * Test 0080:	Check uninitialized scratch memory (obsolete).
  *
  * $FreeBSD$
  */
 
 /* BPF program */
 struct bpf_insn pc[] = {
-#ifdef BPF_JIT_COMPILER
+#ifdef BPF_JIT_COMPILER_OBSOLETE
 	BPF_STMT(BPF_LDX+BPF_IMM, 0xffffffff),
 	BPF_STMT(BPF_LD+BPF_MEM, 0),
 	BPF_JUMP(BPF_JMP+BPF_JSET+BPF_X, 0, 29, 0),

From owner-svn-src-head@FreeBSD.ORG  Fri Nov 20 19:01:09 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6482A106566B;
	Fri, 20 Nov 2009 19:01:09 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 53AAF8FC14;
	Fri, 20 Nov 2009 19:01:09 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAKJ1928053461;
	Fri, 20 Nov 2009 19:01:09 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAKJ199I053459;
	Fri, 20 Nov 2009 19:01:09 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <200911201901.nAKJ199I053459@svn.freebsd.org>
From: Jung-uk Kim 
Date: Fri, 20 Nov 2009 19:01: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: r199605 - head/tools/regression/bpf/bpf_filter
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 20 Nov 2009 19:01:09 -0000

Author: jkim
Date: Fri Nov 20 19:01:09 2009
New Revision: 199605
URL: http://svn.freebsd.org/changeset/base/199605

Log:
  Correct copyright date in the BPF regression test.

Modified:
  head/tools/regression/bpf/bpf_filter/bpf_test.c

Modified: head/tools/regression/bpf/bpf_filter/bpf_test.c
==============================================================================
--- head/tools/regression/bpf/bpf_filter/bpf_test.c	Fri Nov 20 18:53:38 2009	(r199604)
+++ head/tools/regression/bpf/bpf_filter/bpf_test.c	Fri Nov 20 19:01:09 2009	(r199605)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (C) 2009 Jung-uk Kim . All rights reserved.
+ * Copyright (C) 2008-2009 Jung-uk Kim . All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions

From owner-svn-src-head@FreeBSD.ORG  Fri Nov 20 19:19:52 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2AACA106566B;
	Fri, 20 Nov 2009 19:19: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 18FD58FC0A;
	Fri, 20 Nov 2009 19:19:52 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAKJJpPH053863;
	Fri, 20 Nov 2009 19:19:51 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAKJJpdu053858;
	Fri, 20 Nov 2009 19:19:51 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200911201919.nAKJJpdu053858@svn.freebsd.org>
From: John Baldwin 
Date: Fri, 20 Nov 2009 19:19: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: r199606 - in head/lib/libc: gen include
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 20 Nov 2009 19:19:52 -0000

Author: jhb
Date: Fri Nov 20 19:19:51 2009
New Revision: 199606
URL: http://svn.freebsd.org/changeset/base/199606

Log:
  Add an internal _once() method.  This works identical to pthread_once(3)
  with the additional property that it is safe for routines in libc to use
  in both single-threaded and multi-threaded processes.  Multi-threaded
  processes use the pthread_once() implementation from the threading library
  while single-threaded processes use a simplified "stub" version internal
  to libc.  The libc stub-version of pthread_once() now also uses the
  simplified "stub" version as well instead of being a nop.
  
  Reviewed by:	deischen, Matthew Fleming @ Isilon
  Suggested by:	alc
  MFC after:	1 week

Added:
  head/lib/libc/gen/_once_stub.c   (contents, props changed)
Modified:
  head/lib/libc/gen/Makefile.inc
  head/lib/libc/gen/_pthread_stubs.c
  head/lib/libc/include/libc_private.h

Modified: head/lib/libc/gen/Makefile.inc
==============================================================================
--- head/lib/libc/gen/Makefile.inc	Fri Nov 20 19:01:09 2009	(r199605)
+++ head/lib/libc/gen/Makefile.inc	Fri Nov 20 19:19:51 2009	(r199606)
@@ -5,7 +5,8 @@
 .PATH: ${.CURDIR}/${MACHINE_ARCH}/gen ${.CURDIR}/gen
 
 SRCS+=  __getosreldate.c __xuname.c \
-	_pthread_stubs.c _rand48.c _spinlock_stub.c _thread_init.c \
+	_once_stub.c _pthread_stubs.c _rand48.c _spinlock_stub.c \
+	_thread_init.c \
 	alarm.c arc4random.c assert.c basename.c check_utility_compat.c \
 	clock.c closedir.c confstr.c \
 	crypt.c ctermid.c daemon.c devname.c dirname.c disklabel.c \

Added: head/lib/libc/gen/_once_stub.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lib/libc/gen/_once_stub.c	Fri Nov 20 19:19:51 2009	(r199606)
@@ -0,0 +1,67 @@
+/*-
+ * Copyright (c) 2009 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.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include "namespace.h"
+#include 
+#include "un-namespace.h"
+#include "libc_private.h"
+
+/*
+ * This implements pthread_once() for the single-threaded case.  It is
+ * non-static so that it can be used by _pthread_stubs.c.
+ */
+int
+_libc_once(pthread_once_t *once_control, void (*init_routine)(void))
+{
+
+	if (once_control->state == PTHREAD_DONE_INIT)
+		return (0);
+	init_routine();
+	once_control->state = PTHREAD_DONE_INIT;
+	return (0);
+}
+
+/*
+ * This is the internal interface provided to libc.  It will use
+ * pthread_once() from the threading library in a multi-threaded
+ * process and _libc_once() for a single-threaded library.  Because
+ * _libc_once() uses the same ABI for the values in the pthread_once_t
+ * structure as the threading library, it is safe for a process to
+ * switch from _libc_once() to pthread_once() when threading is
+ * enabled.
+ */
+int
+_once(pthread_once_t *once_control, void (*init_routine)(void))
+{
+
+	if (__isthreaded)
+		return (_pthread_once(once_control, init_routine));
+	return (_libc_once(once_control, init_routine));
+}

Modified: head/lib/libc/gen/_pthread_stubs.c
==============================================================================
--- head/lib/libc/gen/_pthread_stubs.c	Fri Nov 20 19:01:09 2009	(r199605)
+++ head/lib/libc/gen/_pthread_stubs.c	Fri Nov 20 19:19:51 2009	(r199606)
@@ -105,7 +105,7 @@ pthread_func_entry_t __thr_jtable[PJT_MA
 	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_MUTEX_LOCK */
 	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_MUTEX_TRYLOCK */
 	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_MUTEX_UNLOCK */
-	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_ONCE */
+	{PJT_DUAL_ENTRY(_libc_once)},   /* PJT_ONCE */
 	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_RWLOCK_DESTROY */
 	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_RWLOCK_INIT */
 	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_RWLOCK_RDLOCK */

Modified: head/lib/libc/include/libc_private.h
==============================================================================
--- head/lib/libc/include/libc_private.h	Fri Nov 20 19:01:09 2009	(r199605)
+++ head/lib/libc/include/libc_private.h	Fri Nov 20 19:19:51 2009	(r199606)
@@ -34,6 +34,7 @@
 
 #ifndef _LIBC_PRIVATE_H_
 #define _LIBC_PRIVATE_H_
+#include 
 
 /*
  * This global flag is non-zero when a process has created one
@@ -147,6 +148,13 @@ int _yp_check(char **);
 void _init_tls(void);
 
 /*
+ * Provides pthread_once()-like functionality for both single-threaded
+ * and multi-threaded applications.
+ */
+int _once(pthread_once_t *, void (*)(void));
+int _libc_once(pthread_once_t *, void (*)(void));
+
+/*
  * Set the TLS thread pointer
  */
 void _set_tp(void *tp);

From owner-svn-src-head@FreeBSD.ORG  Fri Nov 20 19:21:33 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C11DA106568D;
	Fri, 20 Nov 2009 19:21: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 B05518FC16;
	Fri, 20 Nov 2009 19:21:33 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAKJLXcs053933;
	Fri, 20 Nov 2009 19:21:33 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAKJLXMl053931;
	Fri, 20 Nov 2009 19:21:33 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200911201921.nAKJLXMl053931@svn.freebsd.org>
From: John Baldwin 
Date: Fri, 20 Nov 2009 19:21:33 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r199607 - head/lib/libc/stdtime
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 20 Nov 2009 19:21:33 -0000

Author: jhb
Date: Fri Nov 20 19:21:33 2009
New Revision: 199607
URL: http://svn.freebsd.org/changeset/base/199607

Log:
  Replace gmt_is_set and the gmt_mutex lock with a pthread_once_t variable and
  an init routine run on the first invocation via _once().
  
  MFC after:	1 week

Modified:
  head/lib/libc/stdtime/localtime.c

Modified: head/lib/libc/stdtime/localtime.c
==============================================================================
--- head/lib/libc/stdtime/localtime.c	Fri Nov 20 19:19:51 2009	(r199606)
+++ head/lib/libc/stdtime/localtime.c	Fri Nov 20 19:21:33 2009	(r199607)
@@ -235,9 +235,8 @@ static struct state	gmtmem;
 
 static char		lcl_TZname[TZ_STRLEN_MAX + 1];
 static int		lcl_is_set;
-static int		gmt_is_set;
+static pthread_once_t	gmt_once = PTHREAD_ONCE_INIT;
 static pthread_rwlock_t	lcl_rwlock = PTHREAD_RWLOCK_INITIALIZER;
-static pthread_mutex_t	gmt_mutex = PTHREAD_MUTEX_INITIALIZER;
 
 char *			tzname[2] = {
 	wildabbr,
@@ -1464,6 +1463,17 @@ struct tm *		tmp;
 	return tmp;
 }
 
+static void
+gmt_init(void)
+{
+
+#ifdef ALL_STATE
+	gmtptr = (struct state *) malloc(sizeof *gmtptr);
+	if (gmtptr != NULL)
+#endif /* defined ALL_STATE */
+		gmtload(gmtptr);
+}
+
 /*
 ** gmtsub is to gmtime as localsub is to localtime.
 */
@@ -1476,16 +1486,7 @@ struct tm * const	tmp;
 {
 	register struct tm *	result;
 
-	_MUTEX_LOCK(&gmt_mutex);
-	if (!gmt_is_set) {
-#ifdef ALL_STATE
-		gmtptr = (struct state *) malloc(sizeof *gmtptr);
-		if (gmtptr != NULL)
-#endif /* defined ALL_STATE */
-			gmtload(gmtptr);
-		gmt_is_set = TRUE;
-	}
-	_MUTEX_UNLOCK(&gmt_mutex);
+	_once(&gmt_once, gmt_init);
 	result = timesub(timep, offset, gmtptr, tmp);
 #ifdef TM_ZONE
 	/*

From owner-svn-src-head@FreeBSD.ORG  Fri Nov 20 20:12:38 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4FBEB106566C;
	Fri, 20 Nov 2009 20:12:38 +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 3E6F58FC0A;
	Fri, 20 Nov 2009 20:12:38 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAKKCbaE055181;
	Fri, 20 Nov 2009 20:12:37 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAKKCbuM055180;
	Fri, 20 Nov 2009 20:12:37 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200911202012.nAKKCbuM055180@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Fri, 20 Nov 2009 20:12: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: r199608 - head/sys/dev/et
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 20 Nov 2009 20:12:38 -0000

Author: yongari
Date: Fri Nov 20 20:12:37 2009
New Revision: 199608
URL: http://svn.freebsd.org/changeset/base/199608

Log:
  Remove unnecessary structure packing.

Modified:
  head/sys/dev/et/if_etvar.h

Modified: head/sys/dev/et/if_etvar.h
==============================================================================
--- head/sys/dev/et/if_etvar.h	Fri Nov 20 19:21:33 2009	(r199607)
+++ head/sys/dev/et/if_etvar.h	Fri Nov 20 20:12:37 2009	(r199608)
@@ -104,7 +104,7 @@ struct et_txdesc {
 	uint32_t	td_addr_lo;
 	uint32_t	td_ctrl1;	/* ET_TDCTRL1_ */
 	uint32_t	td_ctrl2;	/* ET_TDCTRL2_ */
-} __packed;
+};
 
 #define ET_TDCTRL1_LEN_MASK	0x0000FFFF
 
@@ -116,14 +116,14 @@ struct et_rxdesc {
 	uint32_t	rd_addr_lo;
 	uint32_t	rd_addr_hi;
 	uint32_t	rd_ctrl;	/* ET_RDCTRL_ */
-} __packed;
+};
 
 #define ET_RDCTRL_BUFIDX_MASK	0x000003FF
 
 struct et_rxstat {
 	uint32_t	rxst_info1;
 	uint32_t	rxst_info2;	/* ET_RXST_INFO2_ */
-} __packed;
+};
 
 #define ET_RXST_INFO2_LEN_MASK	0x0000FFFF
 #define ET_RXST_INFO2_LEN_SHIFT	0
@@ -135,7 +135,7 @@ struct et_rxstat {
 struct et_rxstatus {
 	uint32_t	rxs_ring;
 	uint32_t	rxs_stat_ring;	/* ET_RXS_STATRING_ */
-} __packed;
+};
 
 #define ET_RXS_STATRING_INDEX_MASK	0x0FFF0000
 #define ET_RXS_STATRING_INDEX_SHIFT	16

From owner-svn-src-head@FreeBSD.ORG  Fri Nov 20 20:18:54 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DE4D9106566B;
	Fri, 20 Nov 2009 20:18: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 CCA398FC0A;
	Fri, 20 Nov 2009 20:18:53 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAKKIrbk055331;
	Fri, 20 Nov 2009 20:18:53 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAKKIrOl055329;
	Fri, 20 Nov 2009 20:18:53 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200911202018.nAKKIrOl055329@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Fri, 20 Nov 2009 20:18: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: r199609 - head/sys/dev/et
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 20 Nov 2009 20:18:54 -0000

Author: yongari
Date: Fri Nov 20 20:18:53 2009
New Revision: 199609
URL: http://svn.freebsd.org/changeset/base/199609

Log:
  Add initial endianness support. It seems the controller supports
  both big-endian and little-endian format in descriptors for Rx path
  but I couldn't find equivalent feature in Tx path. So just stick to
  little-endian for now.

Modified:
  head/sys/dev/et/if_et.c

Modified: head/sys/dev/et/if_et.c
==============================================================================
--- head/sys/dev/et/if_et.c	Fri Nov 20 20:12:37 2009	(r199608)
+++ head/sys/dev/et/if_et.c	Fri Nov 20 20:18:53 2009	(r199609)
@@ -1913,7 +1913,7 @@ 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;
+	uint32_t rxs_stat_ring, rxst_info2;
 	int rxst_wrap, rxst_index;
 
 	ET_LOCK_ASSERT(sc);
@@ -1929,7 +1929,7 @@ et_rxeof(struct et_softc *sc)
 	bus_dmamap_sync(rxst_ring->rsr_dtag, rxst_ring->rsr_dmap,
 			BUS_DMASYNC_POSTREAD);
 
-	rxs_stat_ring = rxsd->rxsd_status->rxs_stat_ring;
+	rxs_stat_ring = le32toh(rxsd->rxsd_status->rxs_stat_ring);
 	rxst_wrap = (rxs_stat_ring & ET_RXS_STATRING_WRAP) ? 1 : 0;
 	rxst_index = (rxs_stat_ring & ET_RXS_STATRING_INDEX_MASK) >>
 	    ET_RXS_STATRING_INDEX_SHIFT;
@@ -1945,12 +1945,12 @@ et_rxeof(struct et_softc *sc)
 
 		MPASS(rxst_ring->rsr_index < ET_RX_NSTAT);
 		st = &rxst_ring->rsr_stat[rxst_ring->rsr_index];
-
-		buflen = (st->rxst_info2 & ET_RXST_INFO2_LEN_MASK) >>
+		rxst_info2 = le32toh(st->rxst_info2);
+		buflen = (rxst_info2 & ET_RXST_INFO2_LEN_MASK) >>
 		    ET_RXST_INFO2_LEN_SHIFT;
-		buf_idx = (st->rxst_info2 & ET_RXST_INFO2_BUFIDX_MASK) >>
+		buf_idx = (rxst_info2 & ET_RXST_INFO2_BUFIDX_MASK) >>
 		    ET_RXST_INFO2_BUFIDX_SHIFT;
-		ring_idx = (st->rxst_info2 & ET_RXST_INFO2_RINGIDX_MASK) >>
+		ring_idx = (rxst_info2 & ET_RXST_INFO2_RINGIDX_MASK) >>
 		    ET_RXST_INFO2_RINGIDX_SHIFT;
 
 		if (++rxst_ring->rsr_index == ET_RX_NSTAT) {
@@ -2096,12 +2096,12 @@ et_encap(struct et_softc *sc, struct mbu
 
 		idx = (first_idx + i) % ET_TX_NDESC;
 		td = &tx_ring->tr_desc[idx];
-		td->td_addr_hi = ET_ADDR_HI(segs[i].ds_addr);
-		td->td_addr_lo = ET_ADDR_LO(segs[i].ds_addr);
-		td->td_ctrl1 =  segs[i].ds_len & ET_TDCTRL1_LEN_MASK;
+		td->td_addr_hi = htole32(ET_ADDR_HI(segs[i].ds_addr));
+		td->td_addr_lo = htole32(ET_ADDR_LO(segs[i].ds_addr));
+		td->td_ctrl1 =  htole32(segs[i].ds_len & ET_TDCTRL1_LEN_MASK);
 
 		if (i == ctx.nsegs - 1) {	/* Last frag */
-			td->td_ctrl2 = last_td_ctrl2;
+			td->td_ctrl2 = htole32(last_td_ctrl2);
 			last_idx = idx;
 		}
 
@@ -2112,7 +2112,7 @@ et_encap(struct et_softc *sc, struct mbu
 		}
 	}
 	td = &tx_ring->tr_desc[first_idx];
-	td->td_ctrl2 |= ET_TDCTRL2_FIRST_FRAG;	/* First frag */
+	td->td_ctrl2 |= htole32(ET_TDCTRL2_FIRST_FRAG);	/* First frag */
 
 	MPASS(last_idx >= 0);
 	tbd->tbd_buf[first_idx].tb_dmap = tbd->tbd_buf[last_idx].tb_dmap;
@@ -2424,9 +2424,9 @@ et_setup_rxdesc(struct et_rxbuf_data *rb
 	MPASS(buf_idx < ET_RX_NDESC);
 	desc = &rx_ring->rr_desc[buf_idx];
 
-	desc->rd_addr_hi = ET_ADDR_HI(paddr);
-	desc->rd_addr_lo = ET_ADDR_LO(paddr);
-	desc->rd_ctrl = buf_idx & ET_RDCTRL_BUFIDX_MASK;
+	desc->rd_addr_hi = htole32(ET_ADDR_HI(paddr));
+	desc->rd_addr_lo = htole32(ET_ADDR_LO(paddr));
+	desc->rd_ctrl = htole32(buf_idx & ET_RDCTRL_BUFIDX_MASK);
 
 	bus_dmamap_sync(rx_ring->rr_dtag, rx_ring->rr_dmap,
 			BUS_DMASYNC_PREWRITE);

From owner-svn-src-head@FreeBSD.ORG  Fri Nov 20 20:20:44 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 467161065695;
	Fri, 20 Nov 2009 20:20:44 +0000 (UTC)
	(envelope-from kabaev@gmail.com)
Received: from qw-out-2122.google.com (qw-out-2122.google.com [74.125.92.26])
	by mx1.freebsd.org (Postfix) with ESMTP id D4C898FC23;
	Fri, 20 Nov 2009 20:20:43 +0000 (UTC)
Received: by qw-out-2122.google.com with SMTP id 9so814679qwb.7
	for ; Fri, 20 Nov 2009 12:20:43 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:received:received:date:from:to:cc:subject
	:message-id:in-reply-to:references:x-mailer:mime-version
	:content-type; bh=mZim0dICu/79k58/z/V1kgsMNg++ikQoZUWKvK5CAs4=;
	b=FuVadMdY9oYNgawg/RWiqqmXwcau4gcWPicIJlSqa8JZnTkWL00Jjea0em8iX+fEhb
	Wat852feZldDOxqdPCUcKqBK8mmgT5e1j1kjVyJLjtMUvizE8iiTez9qKCsRVMO0jwg5
	TCodTkbUjV9yyhQrtowagahg7zwCHVCzylD5k=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer
	:mime-version:content-type;
	b=Nx2U/KOKSDUCC1hKLlqAJQdmlfP8n+mrdEnCQHtlJPpDGOoKgzyO6MEPN0P/TAsoYe
	pGZYWmV5qWqhjTGZnVP2htni4nvylYuqPl/CEtbADfzrDC3/nSfZKv7/r2Z53RXVd/t6
	5Pa0Nj/COKR9j9wauADUOG02nnZIH1GmJ105I=
Received: by 10.224.94.134 with SMTP id z6mr1043568qam.145.1258746939097;
	Fri, 20 Nov 2009 11:55:39 -0800 (PST)
Received: from kan.dnsalias.net (c-24-91-218-112.hsd1.ma.comcast.net
	[24.91.218.112])
	by mx.google.com with ESMTPS id 7sm5033591qwb.52.2009.11.20.11.55.37
	(version=SSLv3 cipher=RC4-MD5); Fri, 20 Nov 2009 11:55:38 -0800 (PST)
Date: Fri, 20 Nov 2009 14:55:32 -0500
From: Alexander Kabaev 
To: John Baldwin 
Message-ID: <20091120145532.3892b830@kan.dnsalias.net>
In-Reply-To: <200911201919.nAKJJpdu053858@svn.freebsd.org>
References: <200911201919.nAKJJpdu053858@svn.freebsd.org>
X-Mailer: Claws Mail 3.7.2 (GTK+ 2.16.6; amd64-portbld-freebsd8.0)
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=PGP-SHA1;
	boundary="Sig_/0xFfLNXHAszM=j/hk_j2i3g";
	protocol="application/pgp-signature"
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r199606 - in head/lib/libc: gen include
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 20 Nov 2009 20:20:44 -0000

--Sig_/0xFfLNXHAszM=j/hk_j2i3g
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

Just for the record, this breaks __gthread_active_p() in
GCC and consequently breaks libstdc++ and libgcc_s.so.1 (iirc).

--=20
Alexander Kabaev

--Sig_/0xFfLNXHAszM=j/hk_j2i3g
Content-Type: application/pgp-signature; name=signature.asc
Content-Disposition: attachment; filename=signature.asc

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.13 (FreeBSD)

iD8DBQFLBvQ4Q6z1jMm+XZYRAl1ZAJ4w+Ruhw/mtAV79QqU1/XcawaX8cQCfS/rC
YGLxOcK000b6Ivxr/QJ6FiE=
=WsvW
-----END PGP SIGNATURE-----

--Sig_/0xFfLNXHAszM=j/hk_j2i3g--

From owner-svn-src-head@FreeBSD.ORG  Fri Nov 20 20:25:22 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 483FB1065693;
	Fri, 20 Nov 2009 20:25: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 36D908FC0A;
	Fri, 20 Nov 2009 20:25:22 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAKKPM0K055514;
	Fri, 20 Nov 2009 20:25:22 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAKKPMDF055512;
	Fri, 20 Nov 2009 20:25:22 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200911202025.nAKKPMDF055512@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Fri, 20 Nov 2009 20:25: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: r199610 - head/sys/dev/et
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 20 Nov 2009 20:25:22 -0000

Author: yongari
Date: Fri Nov 20 20:25:21 2009
New Revision: 199610
URL: http://svn.freebsd.org/changeset/base/199610

Log:
  Because we know received bytes including CRC there is no reason to
  call m_adj(9). The controller also seems to have a capability to
  strip CRC bytes but I failed to activate this feature except for
  loopback traffic.

Modified:
  head/sys/dev/et/if_et.c

Modified: head/sys/dev/et/if_et.c
==============================================================================
--- head/sys/dev/et/if_et.c	Fri Nov 20 20:18:53 2009	(r199609)
+++ head/sys/dev/et/if_et.c	Fri Nov 20 20:25:21 2009	(r199610)
@@ -1982,11 +1982,9 @@ et_rxeof(struct et_softc *sc)
 				m = NULL;
 				ifp->if_ierrors++;
 			} else {
-				m->m_pkthdr.len = m->m_len = buflen;
+				m->m_pkthdr.len = m->m_len =
+				    buflen - ETHER_CRC_LEN;
 				m->m_pkthdr.rcvif = ifp;
-
-				m_adj(m, -ETHER_CRC_LEN);
-
 				ifp->if_ipackets++;
 				ET_UNLOCK(sc);
 				ifp->if_input(ifp, m);

From owner-svn-src-head@FreeBSD.ORG  Fri Nov 20 20:29:33 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A11031065696;
	Fri, 20 Nov 2009 20:29:33 +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 7316E8FC17;
	Fri, 20 Nov 2009 20:29:33 +0000 (UTC)
Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net
	[66.111.2.69])
	by cyrus.watson.org (Postfix) with ESMTPSA id 2850046B1A;
	Fri, 20 Nov 2009 15:29:33 -0500 (EST)
Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.9])
	by bigwig.baldwin.cx (Postfix) with ESMTPA id 84A328A01B;
	Fri, 20 Nov 2009 15:29:32 -0500 (EST)
From: John Baldwin 
To: Alexander Kabaev 
Date: Fri, 20 Nov 2009 15:29:14 -0500
User-Agent: KMail/1.9.7
References: <200911201919.nAKJJpdu053858@svn.freebsd.org>
	<20091120145532.3892b830@kan.dnsalias.net>
In-Reply-To: <20091120145532.3892b830@kan.dnsalias.net>
MIME-Version: 1.0
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200911201529.14898.jhb@freebsd.org>
X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1
	(bigwig.baldwin.cx); Fri, 20 Nov 2009 15:29:32 -0500 (EST)
X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx
X-Virus-Status: Clean
X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE
	autolearn=no version=3.2.5
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r199606 - in head/lib/libc: gen include
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 20 Nov 2009 20:29:33 -0000

On Friday 20 November 2009 2:55:32 pm Alexander Kabaev wrote:
> Just for the record, this breaks __gthread_active_p() in
> GCC and consequently breaks libstdc++ and libgcc_s.so.1 (iirc).

Gah, ok.  I think it mostly pessimizes them rather than outright breaks them?
Still, I'm build-testing a fix now to make the pthread_init() stub back into a
nop.

-- 
John Baldwin

From owner-svn-src-head@FreeBSD.ORG  Fri Nov 20 20:34:00 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 26492106566B;
	Fri, 20 Nov 2009 20:34:00 +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 1420F8FC14;
	Fri, 20 Nov 2009 20:34:00 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAKKXxYr055726;
	Fri, 20 Nov 2009 20:33:59 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAKKXx58055723;
	Fri, 20 Nov 2009 20:33:59 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200911202033.nAKKXx58055723@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Fri, 20 Nov 2009 20:33: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: r199611 - head/sys/dev/et
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 20 Nov 2009 20:34:00 -0000

Author: yongari
Date: Fri Nov 20 20:33:59 2009
New Revision: 199611
URL: http://svn.freebsd.org/changeset/base/199611

Log:
  Add IPv4/TCP/UDP Tx checksum offloading support. It seems the
  controller also has support for IP/TCP checksum offloading for Rx
  path. But I failed to find to way to enable Rx MAC to compute the
  checksum of received frames.

Modified:
  head/sys/dev/et/if_et.c
  head/sys/dev/et/if_etvar.h

Modified: head/sys/dev/et/if_et.c
==============================================================================
--- head/sys/dev/et/if_et.c	Fri Nov 20 20:25:21 2009	(r199610)
+++ head/sys/dev/et/if_et.c	Fri Nov 20 20:33:59 2009	(r199611)
@@ -80,6 +80,8 @@ MODULE_DEPEND(et, miibus, 1, 1, 1);
 static int msi_disable = 0;
 TUNABLE_INT("hw.et.msi_disable", &msi_disable);
 
+#define	ET_CSUM_FEATURES	(CSUM_IP | CSUM_TCP | CSUM_UDP)
+
 static int	et_probe(device_t);
 static int	et_attach(device_t);
 static int	et_detach(device_t);
@@ -332,7 +334,7 @@ et_attach(device_t dev)
 	ifp->if_ioctl = et_ioctl;
 	ifp->if_start = et_start;
 	ifp->if_mtu = ETHERMTU;
-	ifp->if_capabilities = IFCAP_VLAN_MTU;
+	ifp->if_capabilities = /*IFCAP_TXCSUM*/IFCAP_HWCSUM | IFCAP_VLAN_MTU;
 	ifp->if_capenable = ifp->if_capabilities;
 	IFQ_SET_MAXLEN(&ifp->if_snd, ET_TX_NDESC);
 	IFQ_SET_READY(&ifp->if_snd);
@@ -1175,7 +1177,7 @@ et_ioctl(struct ifnet *ifp, u_long cmd, 
 	struct et_softc *sc = ifp->if_softc;
 	struct mii_data *mii = device_get_softc(sc->sc_miibus);
 	struct ifreq *ifr = (struct ifreq *)data;
-	int error = 0, max_framelen;
+	int error = 0, mask, max_framelen;
 
 /* XXX LOCKSUSED */
 	switch (cmd) {
@@ -1232,6 +1234,20 @@ et_ioctl(struct ifnet *ifp, u_long cmd, 
 		}
 		break;
 
+	case SIOCSIFCAP:
+		ET_LOCK(sc);
+		mask = ifr->ifr_reqcap ^ ifp->if_capenable;
+		if ((mask & IFCAP_TXCSUM) != 0 &&
+		    (IFCAP_TXCSUM & ifp->if_capabilities) != 0) {
+			ifp->if_capenable ^= IFCAP_TXCSUM;
+			if ((IFCAP_TXCSUM & ifp->if_capenable) != 0)
+				ifp->if_hwassist |= ET_CSUM_FEATURES;
+			else
+				ifp->if_hwassist &= ~ET_CSUM_FEATURES;
+		}
+		ET_UNLOCK(sc);
+		break;
+
 	default:
 		error = ether_ioctl(ifp, cmd, data);
 		break;
@@ -2026,7 +2042,7 @@ et_encap(struct et_softc *sc, struct mbu
 	struct et_txdesc *td;
 	bus_dmamap_t map;
 	int error, maxsegs, first_idx, last_idx, i;
-	uint32_t tx_ready_pos, last_td_ctrl2;
+	uint32_t csum_flags, tx_ready_pos, last_td_ctrl2;
 
 	maxsegs = ET_TX_NDESC - tbd->tbd_used;
 	if (maxsegs > ET_NSEG_MAX)
@@ -2088,6 +2104,15 @@ et_encap(struct et_softc *sc, struct mbu
 		last_td_ctrl2 |= ET_TDCTRL2_INTR;
 	}
 
+	csum_flags = 0;
+	if ((m->m_pkthdr.csum_flags & ET_CSUM_FEATURES) != 0) {
+		if ((m->m_pkthdr.csum_flags & CSUM_IP) != 0)
+			csum_flags |= ET_TDCTRL2_CSUM_IP;
+		if ((m->m_pkthdr.csum_flags & CSUM_UDP) != 0)
+			csum_flags |= ET_TDCTRL2_CSUM_UDP;
+		else if ((m->m_pkthdr.csum_flags & CSUM_TCP) != 0)
+			csum_flags |= ET_TDCTRL2_CSUM_TCP;
+	}
 	last_idx = -1;
 	for (i = 0; i < ctx.nsegs; ++i) {
 		int idx;
@@ -2097,11 +2122,11 @@ et_encap(struct et_softc *sc, struct mbu
 		td->td_addr_hi = htole32(ET_ADDR_HI(segs[i].ds_addr));
 		td->td_addr_lo = htole32(ET_ADDR_LO(segs[i].ds_addr));
 		td->td_ctrl1 =  htole32(segs[i].ds_len & ET_TDCTRL1_LEN_MASK);
-
 		if (i == ctx.nsegs - 1) {	/* Last frag */
-			td->td_ctrl2 = htole32(last_td_ctrl2);
+			td->td_ctrl2 = htole32(last_td_ctrl2 | csum_flags);
 			last_idx = idx;
-		}
+		} else
+			td->td_ctrl2 = htole32(csum_flags);
 
 		MPASS(tx_ring->tr_ready_index < ET_TX_NDESC);
 		if (++tx_ring->tr_ready_index == ET_TX_NDESC) {

Modified: head/sys/dev/et/if_etvar.h
==============================================================================
--- head/sys/dev/et/if_etvar.h	Fri Nov 20 20:25:21 2009	(r199610)
+++ head/sys/dev/et/if_etvar.h	Fri Nov 20 20:33:59 2009	(r199611)
@@ -111,6 +111,18 @@ struct et_txdesc {
 #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;

From owner-svn-src-head@FreeBSD.ORG  Fri Nov 20 20:40:34 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7FF2A106566C;
	Fri, 20 Nov 2009 20:40:34 +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 6E61D8FC0C;
	Fri, 20 Nov 2009 20:40:34 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAKKeYuX055873;
	Fri, 20 Nov 2009 20:40:34 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAKKeY4c055871;
	Fri, 20 Nov 2009 20:40:34 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200911202040.nAKKeY4c055871@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Fri, 20 Nov 2009 20:40: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: r199612 - head/sys/dev/et
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 20 Nov 2009 20:40:34 -0000

Author: yongari
Date: Fri Nov 20 20:40:34 2009
New Revision: 199612
URL: http://svn.freebsd.org/changeset/base/199612

Log:
  Add __FBSDID.

Modified:
  head/sys/dev/et/if_et.c

Modified: head/sys/dev/et/if_et.c
==============================================================================
--- head/sys/dev/et/if_et.c	Fri Nov 20 20:33:59 2009	(r199611)
+++ head/sys/dev/et/if_et.c	Fri Nov 20 20:40:34 2009	(r199612)
@@ -32,9 +32,11 @@
  * SUCH DAMAGE.
  *
  * $DragonFly: src/sys/dev/netif/et/if_et.c,v 1.10 2008/05/18 07:47:14 sephe Exp $
- * $FreeBSD$
  */
 
+#include 
+__FBSDID("$FreeBSD$");
+
 #include 
 #include 
 #include 

From owner-svn-src-head@FreeBSD.ORG  Fri Nov 20 20:43:16 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 98BCF1065694;
	Fri, 20 Nov 2009 20:43: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 8741D8FC12;
	Fri, 20 Nov 2009 20:43:16 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAKKhGoN055964;
	Fri, 20 Nov 2009 20:43:16 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAKKhGXU055962;
	Fri, 20 Nov 2009 20:43:16 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200911202043.nAKKhGXU055962@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Fri, 20 Nov 2009 20:43: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: r199613 - head/sys/dev/et
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 20 Nov 2009 20:43:16 -0000

Author: yongari
Date: Fri Nov 20 20:43:16 2009
New Revision: 199613
URL: http://svn.freebsd.org/changeset/base/199613

Log:
  Only Tx checksum offloading is supported now. Remove experimental
  code sneaked in r199611.

Modified:
  head/sys/dev/et/if_et.c

Modified: head/sys/dev/et/if_et.c
==============================================================================
--- head/sys/dev/et/if_et.c	Fri Nov 20 20:40:34 2009	(r199612)
+++ head/sys/dev/et/if_et.c	Fri Nov 20 20:43:16 2009	(r199613)
@@ -336,7 +336,7 @@ et_attach(device_t dev)
 	ifp->if_ioctl = et_ioctl;
 	ifp->if_start = et_start;
 	ifp->if_mtu = ETHERMTU;
-	ifp->if_capabilities = /*IFCAP_TXCSUM*/IFCAP_HWCSUM | IFCAP_VLAN_MTU;
+	ifp->if_capabilities = IFCAP_TXCSUM | IFCAP_VLAN_MTU;
 	ifp->if_capenable = ifp->if_capabilities;
 	IFQ_SET_MAXLEN(&ifp->if_snd, ET_TX_NDESC);
 	IFQ_SET_READY(&ifp->if_snd);

From owner-svn-src-head@FreeBSD.ORG  Fri Nov 20 20:43:34 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C9A351065672;
	Fri, 20 Nov 2009 20:43:34 +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 9E4E18FC19;
	Fri, 20 Nov 2009 20:43:34 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAKKhY5Z056007;
	Fri, 20 Nov 2009 20:43:34 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAKKhYas056003;
	Fri, 20 Nov 2009 20:43:34 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200911202043.nAKKhYas056003@svn.freebsd.org>
From: John Baldwin 
Date: Fri, 20 Nov 2009 20:43: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: r199614 - in head/lib/libc: gen include
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 20 Nov 2009 20:43:34 -0000

Author: jhb
Date: Fri Nov 20 20:43:34 2009
New Revision: 199614
URL: http://svn.freebsd.org/changeset/base/199614

Log:
  Revert the previous change to pthread_once() stub in libc.  It is actually
  a feature that libstdc++ depends on to simulate the behavior of libc's
  internal '__isthreaded' variable.  One benefit of this is that _libc_once()
  is now private to _once_stub.c.
  
  Requested by:	kan

Modified:
  head/lib/libc/gen/_once_stub.c
  head/lib/libc/gen/_pthread_stubs.c
  head/lib/libc/include/libc_private.h

Modified: head/lib/libc/gen/_once_stub.c
==============================================================================
--- head/lib/libc/gen/_once_stub.c	Fri Nov 20 20:43:16 2009	(r199613)
+++ head/lib/libc/gen/_once_stub.c	Fri Nov 20 20:43:34 2009	(r199614)
@@ -33,11 +33,8 @@ __FBSDID("$FreeBSD$");
 #include "un-namespace.h"
 #include "libc_private.h"
 
-/*
- * This implements pthread_once() for the single-threaded case.  It is
- * non-static so that it can be used by _pthread_stubs.c.
- */
-int
+/* This implements pthread_once() for the single-threaded case. */
+static int
 _libc_once(pthread_once_t *once_control, void (*init_routine)(void))
 {
 

Modified: head/lib/libc/gen/_pthread_stubs.c
==============================================================================
--- head/lib/libc/gen/_pthread_stubs.c	Fri Nov 20 20:43:16 2009	(r199613)
+++ head/lib/libc/gen/_pthread_stubs.c	Fri Nov 20 20:43:34 2009	(r199614)
@@ -105,7 +105,7 @@ pthread_func_entry_t __thr_jtable[PJT_MA
 	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_MUTEX_LOCK */
 	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_MUTEX_TRYLOCK */
 	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_MUTEX_UNLOCK */
-	{PJT_DUAL_ENTRY(_libc_once)},   /* PJT_ONCE */
+	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_ONCE */
 	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_RWLOCK_DESTROY */
 	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_RWLOCK_INIT */
 	{PJT_DUAL_ENTRY(stub_zero)},    /* PJT_RWLOCK_RDLOCK */

Modified: head/lib/libc/include/libc_private.h
==============================================================================
--- head/lib/libc/include/libc_private.h	Fri Nov 20 20:43:16 2009	(r199613)
+++ head/lib/libc/include/libc_private.h	Fri Nov 20 20:43:34 2009	(r199614)
@@ -152,7 +152,6 @@ void _init_tls(void);
  * and multi-threaded applications.
  */
 int _once(pthread_once_t *, void (*)(void));
-int _libc_once(pthread_once_t *, void (*)(void));
 
 /*
  * Set the TLS thread pointer

From owner-svn-src-head@FreeBSD.ORG  Fri Nov 20 21:12:40 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E15CE1065670;
	Fri, 20 Nov 2009 21:12:40 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CE0E88FC0C;
	Fri, 20 Nov 2009 21:12:40 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAKLCexK056657;
	Fri, 20 Nov 2009 21:12:40 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAKLCe35056653;
	Fri, 20 Nov 2009 21:12:40 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <200911202112.nAKLCe35056653@svn.freebsd.org>
From: Jung-uk Kim 
Date: Fri, 20 Nov 2009 21:12:40 +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: r199615 - in head/sys: amd64/amd64 i386/i386 net
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 20 Nov 2009 21:12:41 -0000

Author: jkim
Date: Fri Nov 20 21:12:40 2009
New Revision: 199615
URL: http://svn.freebsd.org/changeset/base/199615

Log:
  General style cleanup, no functional change.

Modified:
  head/sys/amd64/amd64/bpf_jit_machdep.c
  head/sys/i386/i386/bpf_jit_machdep.c
  head/sys/net/bpf_jitter.c

Modified: head/sys/amd64/amd64/bpf_jit_machdep.c
==============================================================================
--- head/sys/amd64/amd64/bpf_jit_machdep.c	Fri Nov 20 20:43:34 2009	(r199614)
+++ head/sys/amd64/amd64/bpf_jit_machdep.c	Fri Nov 20 21:12:40 2009	(r199615)
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #else
 #include 
+#include 
 #include 
 #include 
 #endif
@@ -104,38 +105,38 @@ bpf_jit_compile(struct bpf_insn *prog, u
 	u_int i, pass;
 
 	/*
-	 * NOTE: do not modify the name of this variable, as it's used by
+	 * NOTE: Do not modify the name of this variable, as it's used by
 	 * the macros to emit code.
 	 */
 	emit_func emitm;
 
-	/* Allocate the reference table for the jumps */
+	/* Allocate the reference table for the jumps. */
 #ifdef _KERNEL
-	stream.refs = malloc((nins + 1) * sizeof(u_int), M_BPFJIT, M_NOWAIT);
+	stream.refs = malloc((nins + 1) * sizeof(u_int), M_BPFJIT,
+	    M_NOWAIT | M_ZERO);
 #else
 	stream.refs = malloc((nins + 1) * sizeof(u_int));
 #endif
 	if (stream.refs == NULL)
 		return (NULL);
-
-	/* Reset the reference table */
-	for (i = 0; i < nins + 1; i++)
-		stream.refs[i] = 0;
+#ifndef _KERNEL
+	memset(stream.refs, 0, (nins + 1) * sizeof(u_int));
+#endif
 
 	stream.cur_ip = 0;
 	stream.bpf_pc = 0;
+	stream.ibuf = NULL;
 
 	/*
-	 * the first pass will emit the lengths of the instructions
-	 * to create the reference table
+	 * The first pass will emit the lengths of the instructions
+	 * to create the reference table.
 	 */
 	emitm = emit_length;
 
-	pass = 0;
-	for (;;) {
+	for (pass = 0; pass < 2; pass++) {
 		ins = prog;
 
-		/* create the procedure header */
+		/* Create the procedure header. */
 		PUSH(RBP);
 		MOVrq(RSP, RBP);
 		SUBib(BPF_MEMWORDS * sizeof(uint32_t), RSP);
@@ -470,25 +471,16 @@ bpf_jit_compile(struct bpf_insn *prog, u
 			ins++;
 		}
 
-		pass++;
-		if (pass >= 2) {
-#ifndef _KERNEL
-			if (mprotect(stream.ibuf, stream.cur_ip,
-			    PROT_READ | PROT_EXEC) != 0) {
-				munmap(stream.ibuf, stream.cur_ip);
-				stream.ibuf = NULL;
-			}
-#endif
-			*size = stream.cur_ip;
-			break;
-		}
+		if (pass > 0)
+			continue;
 
+		*size = stream.cur_ip;
 #ifdef _KERNEL
-		stream.ibuf = malloc(stream.cur_ip, M_BPFJIT, M_NOWAIT);
+		stream.ibuf = malloc(*size, M_BPFJIT, M_NOWAIT);
 		if (stream.ibuf == NULL)
 			break;
 #else
-		stream.ibuf = mmap(NULL, stream.cur_ip, PROT_READ | PROT_WRITE,
+		stream.ibuf = mmap(NULL, *size, PROT_READ | PROT_WRITE,
 		    MAP_ANON, -1, 0);
 		if (stream.ibuf == MAP_FAILED) {
 			stream.ibuf = NULL;
@@ -497,28 +489,33 @@ bpf_jit_compile(struct bpf_insn *prog, u
 #endif
 
 		/*
-		 * modify the reference table to contain the offsets and
-		 * not the lengths of the instructions
+		 * Modify the reference table to contain the offsets and
+		 * not the lengths of the instructions.
 		 */
 		for (i = 1; i < nins + 1; i++)
 			stream.refs[i] += stream.refs[i - 1];
 
-		/* Reset the counters */
+		/* Reset the counters. */
 		stream.cur_ip = 0;
 		stream.bpf_pc = 0;
 
-		/* the second pass creates the actual code */
+		/* The second pass creates the actual code. */
 		emitm = emit_code;
 	}
 
 	/*
-	 * the reference table is needed only during compilation,
-	 * now we can free it
+	 * The reference table is needed only during compilation,
+	 * now we can free it.
 	 */
 #ifdef _KERNEL
 	free(stream.refs, M_BPFJIT);
 #else
 	free(stream.refs);
+	if (stream.ibuf != NULL &&
+	    mprotect(stream.ibuf, *size, PROT_READ | PROT_EXEC) != 0) {
+		munmap(stream.ibuf, *size);
+		stream.ibuf = NULL;
+	}
 #endif
 
 	return ((bpf_filter_func)stream.ibuf);

Modified: head/sys/i386/i386/bpf_jit_machdep.c
==============================================================================
--- head/sys/i386/i386/bpf_jit_machdep.c	Fri Nov 20 20:43:34 2009	(r199614)
+++ head/sys/i386/i386/bpf_jit_machdep.c	Fri Nov 20 21:12:40 2009	(r199615)
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #else
 #include 
+#include 
 #include 
 #include 
 #endif
@@ -104,38 +105,38 @@ bpf_jit_compile(struct bpf_insn *prog, u
 	u_int i, pass;
 
 	/*
-	 * NOTE: do not modify the name of this variable, as it's used by
+	 * NOTE: Do not modify the name of this variable, as it's used by
 	 * the macros to emit code.
 	 */
 	emit_func emitm;
 
-	/* Allocate the reference table for the jumps */
+	/* Allocate the reference table for the jumps. */
 #ifdef _KERNEL
-	stream.refs = malloc((nins + 1) * sizeof(u_int), M_BPFJIT, M_NOWAIT);
+	stream.refs = malloc((nins + 1) * sizeof(u_int), M_BPFJIT,
+	    M_NOWAIT | M_ZERO);
 #else
 	stream.refs = malloc((nins + 1) * sizeof(u_int));
 #endif
 	if (stream.refs == NULL)
 		return (NULL);
-
-	/* Reset the reference table */
-	for (i = 0; i < nins + 1; i++)
-		stream.refs[i] = 0;
+#ifndef _KERNEL
+	memset(stream.refs, 0, (nins + 1) * sizeof(u_int));
+#endif
 
 	stream.cur_ip = 0;
 	stream.bpf_pc = 0;
+	stream.ibuf = NULL;
 
 	/*
-	 * the first pass will emit the lengths of the instructions
-	 * to create the reference table
+	 * The first pass will emit the lengths of the instructions
+	 * to create the reference table.
 	 */
 	emitm = emit_length;
 
-	pass = 0;
-	for (;;) {
+	for (pass = 0; pass < 2; pass++) {
 		ins = prog;
 
-		/* create the procedure header */
+		/* Create the procedure header. */
 		PUSH(EBP);
 		MOVrd(ESP, EBP);
 		SUBib(BPF_MEMWORDS * sizeof(uint32_t), ESP);
@@ -503,25 +504,16 @@ bpf_jit_compile(struct bpf_insn *prog, u
 			ins++;
 		}
 
-		pass++;
-		if (pass >= 2) {
-#ifndef _KERNEL
-			if (mprotect(stream.ibuf, stream.cur_ip,
-			    PROT_READ | PROT_EXEC) != 0) {
-				munmap(stream.ibuf, stream.cur_ip);
-				stream.ibuf = NULL;
-			}
-#endif
-			*size = stream.cur_ip;
-			break;
-		}
+		if (pass > 0)
+			continue;
 
+		*size = stream.cur_ip;
 #ifdef _KERNEL
-		stream.ibuf = malloc(stream.cur_ip, M_BPFJIT, M_NOWAIT);
+		stream.ibuf = malloc(*size, M_BPFJIT, M_NOWAIT);
 		if (stream.ibuf == NULL)
 			break;
 #else
-		stream.ibuf = mmap(NULL, stream.cur_ip, PROT_READ | PROT_WRITE,
+		stream.ibuf = mmap(NULL, *size, PROT_READ | PROT_WRITE,
 		    MAP_ANON, -1, 0);
 		if (stream.ibuf == MAP_FAILED) {
 			stream.ibuf = NULL;
@@ -530,28 +522,33 @@ bpf_jit_compile(struct bpf_insn *prog, u
 #endif
 
 		/*
-		 * modify the reference table to contain the offsets and
-		 * not the lengths of the instructions
+		 * Modify the reference table to contain the offsets and
+		 * not the lengths of the instructions.
 		 */
 		for (i = 1; i < nins + 1; i++)
 			stream.refs[i] += stream.refs[i - 1];
 
-		/* Reset the counters */
+		/* Reset the counters. */
 		stream.cur_ip = 0;
 		stream.bpf_pc = 0;
 
-		/* the second pass creates the actual code */
+		/* The second pass creates the actual code. */
 		emitm = emit_code;
 	}
 
 	/*
-	 * the reference table is needed only during compilation,
-	 * now we can free it
+	 * The reference table is needed only during compilation,
+	 * now we can free it.
 	 */
 #ifdef _KERNEL
 	free(stream.refs, M_BPFJIT);
 #else
 	free(stream.refs);
+	if (stream.ibuf != NULL &&
+	    mprotect(stream.ibuf, *size, PROT_READ | PROT_EXEC) != 0) {
+		munmap(stream.ibuf, *size);
+		stream.ibuf = NULL;
+	}
 #endif
 
 	return ((bpf_filter_func)stream.ibuf);

Modified: head/sys/net/bpf_jitter.c
==============================================================================
--- head/sys/net/bpf_jitter.c	Fri Nov 20 20:43:34 2009	(r199614)
+++ head/sys/net/bpf_jitter.c	Fri Nov 20 21:12:40 2009	(r199615)
@@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #else
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -62,27 +61,36 @@ SYSCTL_NODE(_net, OID_AUTO, bpf_jitter, 
 int bpf_jitter_enable = 1;
 SYSCTL_INT(_net_bpf_jitter, OID_AUTO, enable, CTLFLAG_RW,
     &bpf_jitter_enable, 0, "enable BPF JIT compiler");
+#endif
 
 bpf_jit_filter *
 bpf_jitter(struct bpf_insn *fp, int nins)
 {
 	bpf_jit_filter *filter;
 
-	/* Allocate the filter structure */
+	/* Allocate the filter structure. */
+#ifdef _KERNEL
 	filter = (struct bpf_jit_filter *)malloc(sizeof(*filter),
 	    M_BPFJIT, M_NOWAIT);
+#else
+	filter = (struct bpf_jit_filter *)malloc(sizeof(*filter));
+#endif
 	if (filter == NULL)
 		return (NULL);
 
-	/* No filter means accept all */
+	/* No filter means accept all. */
 	if (fp == NULL || nins == 0) {
 		filter->func = bpf_jit_accept_all;
 		return (filter);
 	}
 
-	/* Create the binary */
+	/* Create the binary. */
 	if ((filter->func = bpf_jit_compile(fp, nins, &filter->size)) == NULL) {
+#ifdef _KERNEL
 		free(filter, M_BPFJIT);
+#else
+		free(filter);
+#endif
 		return (NULL);
 	}
 
@@ -93,45 +101,16 @@ void
 bpf_destroy_jit_filter(bpf_jit_filter *filter)
 {
 
+#ifdef _KERNEL
 	if (filter->func != bpf_jit_accept_all)
 		free(filter->func, M_BPFJIT);
 	free(filter, M_BPFJIT);
-}
 #else
-bpf_jit_filter *
-bpf_jitter(struct bpf_insn *fp, int nins)
-{
-	bpf_jit_filter *filter;
-
-	/* Allocate the filter structure */
-	filter = (struct bpf_jit_filter *)malloc(sizeof(*filter));
-	if (filter == NULL)
-		return (NULL);
-
-	/* No filter means accept all */
-	if (fp == NULL || nins == 0) {
-		filter->func = bpf_jit_accept_all;
-		return (filter);
-	}
-
-	/* Create the binary */
-	if ((filter->func = bpf_jit_compile(fp, nins, &filter->size)) == NULL) {
-		free(filter);
-		return (NULL);
-	}
-
-	return (filter);
-}
-
-void
-bpf_destroy_jit_filter(bpf_jit_filter *filter)
-{
-
 	if (filter->func != bpf_jit_accept_all)
 		munmap(filter->func, filter->size);
 	free(filter);
-}
 #endif
+}
 
 static u_int
 bpf_jit_accept_all(__unused u_char *p, __unused u_int wirelen,

From owner-svn-src-head@FreeBSD.ORG  Fri Nov 20 21:21:13 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9DDF41065694;
	Fri, 20 Nov 2009 21:21:13 +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 8AF728FC18;
	Fri, 20 Nov 2009 21:21:13 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAKLLDtL056857;
	Fri, 20 Nov 2009 21:21:13 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Received: (from rmacklem@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAKLLDHJ056853;
	Fri, 20 Nov 2009 21:21:13 GMT
	(envelope-from rmacklem@svn.freebsd.org)
Message-Id: <200911202121.nAKLLDHJ056853@svn.freebsd.org>
From: Rick Macklem 
Date: Fri, 20 Nov 2009 21:21:13 +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: r199616 - in head/sys/fs: nfs nfsserver
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 20 Nov 2009 21:21:13 -0000

Author: rmacklem
Date: Fri Nov 20 21:21:13 2009
New Revision: 199616
URL: http://svn.freebsd.org/changeset/base/199616

Log:
  Patch the experimental NFS server is a manner analagous to
  r197525, so that the creation verifier is handled correctly
  in va_atime for 64bit architectures. There were two problems.
  One was that the code incorrectly assumed that
  sizeof (struct timespec) == 8 and the other was that the tv_sec
  field needs to be assigned from a signed 32bit integer, so that
  sign extension occurs on 64bit architectures. This is required
  for correct operation when exporting ZFS volumes.
  
  Reviewed by:	pjd
  MFC after:	2 weeks

Modified:
  head/sys/fs/nfs/nfs_var.h
  head/sys/fs/nfsserver/nfs_nfsdport.c
  head/sys/fs/nfsserver/nfs_nfsdserv.c

Modified: head/sys/fs/nfs/nfs_var.h
==============================================================================
--- head/sys/fs/nfs/nfs_var.h	Fri Nov 20 21:12:40 2009	(r199615)
+++ head/sys/fs/nfs/nfs_var.h	Fri Nov 20 21:21:13 2009	(r199616)
@@ -529,7 +529,7 @@ int nfsvno_read(vnode_t, off_t, int, str
 int nfsvno_write(vnode_t, off_t, int, int, int, mbuf_t,
     char *, struct ucred *, NFSPROC_T *);
 int nfsvno_createsub(struct nfsrv_descript *, struct nameidata *,
-    vnode_t *, struct nfsvattr *, int *, u_char *, NFSDEV_T, NFSPROC_T *,
+    vnode_t *, struct nfsvattr *, int *, int32_t *, NFSDEV_T, NFSPROC_T *,
     struct nfsexstuff *);
 int nfsvno_mknod(struct nameidata *, struct nfsvattr *, struct ucred *,
     NFSPROC_T *);
@@ -552,7 +552,7 @@ int nfsvno_fsync(vnode_t, u_int64_t, int
 int nfsvno_statfs(vnode_t, struct statfs *);
 void nfsvno_getfs(struct nfsfsinfo *, int);
 void nfsvno_open(struct nfsrv_descript *, struct nameidata *, nfsquad_t,
-    nfsv4stateid_t *, struct nfsstate *, int *, struct nfsvattr *, u_char *,
+    nfsv4stateid_t *, struct nfsstate *, int *, struct nfsvattr *, int32_t *,
     int, NFSACL_T *, nfsattrbit_t *, struct ucred *, NFSPROC_T *,
     struct nfsexstuff *, vnode_t *);
 void nfsvno_updfilerev(vnode_t, struct nfsvattr *, struct ucred *,

Modified: head/sys/fs/nfsserver/nfs_nfsdport.c
==============================================================================
--- head/sys/fs/nfsserver/nfs_nfsdport.c	Fri Nov 20 21:12:40 2009	(r199615)
+++ head/sys/fs/nfsserver/nfs_nfsdport.c	Fri Nov 20 21:21:13 2009	(r199616)
@@ -720,7 +720,7 @@ nfsvno_write(struct vnode *vp, off_t off
 int
 nfsvno_createsub(struct nfsrv_descript *nd, struct nameidata *ndp,
     struct vnode **vpp, struct nfsvattr *nvap, int *exclusive_flagp,
-    u_char *cverf, NFSDEV_T rdev, struct thread *p, struct nfsexstuff *exp)
+    int32_t *cverf, NFSDEV_T rdev, struct thread *p, struct nfsexstuff *exp)
 {
 	u_quad_t tempsize;
 	int error;
@@ -737,8 +737,8 @@ nfsvno_createsub(struct nfsrv_descript *
 				if (*exclusive_flagp) {
 					*exclusive_flagp = 0;
 					NFSVNO_ATTRINIT(nvap);
-					NFSBCOPY(cverf,(caddr_t)&nvap->na_atime,
-					    NFSX_VERF);
+					nvap->na_atime.tv_sec = cverf[0];
+					nvap->na_atime.tv_nsec = cverf[1];
 					error = VOP_SETATTR(ndp->ni_vp,
 					    &nvap->na_vattr, nd->nd_cred);
 				}
@@ -1285,7 +1285,7 @@ nfsvno_statfs(struct vnode *vp, struct s
 void
 nfsvno_open(struct nfsrv_descript *nd, struct nameidata *ndp,
     nfsquad_t clientid, nfsv4stateid_t *stateidp, struct nfsstate *stp,
-    int *exclusive_flagp, struct nfsvattr *nvap, u_char *cverf, int create,
+    int *exclusive_flagp, struct nfsvattr *nvap, int32_t *cverf, int create,
     NFSACL_T *aclp, nfsattrbit_t *attrbitp, struct ucred *cred, struct thread *p,
     struct nfsexstuff *exp, struct vnode **vpp)
 {
@@ -1307,9 +1307,8 @@ nfsvno_open(struct nfsrv_descript *nd, s
 				if (*exclusive_flagp) {
 					*exclusive_flagp = 0;
 					NFSVNO_ATTRINIT(nvap);
-					NFSBCOPY(cverf,
-					    (caddr_t)&nvap->na_atime,
-					    NFSX_VERF);
+					nvap->na_atime.tv_sec = cverf[0];
+					nvap->na_atime.tv_nsec = cverf[1];
 					nd->nd_repstat = VOP_SETATTR(ndp->ni_vp,
 					    &nvap->na_vattr, cred);
 				} else {

Modified: head/sys/fs/nfsserver/nfs_nfsdserv.c
==============================================================================
--- head/sys/fs/nfsserver/nfs_nfsdserv.c	Fri Nov 20 21:12:40 2009	(r199615)
+++ head/sys/fs/nfsserver/nfs_nfsdserv.c	Fri Nov 20 21:21:13 2009	(r199616)
@@ -865,11 +865,11 @@ nfsrvd_create(struct nfsrv_descript *nd,
 	int how = NFSCREATE_UNCHECKED, exclusive_flag = 0;
 	NFSDEV_T rdev = 0;
 	vnode_t vp = NULL, dirp = NULL;
-	u_char cverf[NFSX_VERF], *cp;
 	fhandle_t fh;
 	char *bufp;
 	u_long *hashp;
 	enum vtype vtyp;
+	int32_t cverf[2], tverf[2] = { 0, 0 };
 
 	if (nd->nd_repstat) {
 		nfsrv_wcc(nd, dirfor_ret, &dirfor, diraft_ret, &diraft);
@@ -920,8 +920,9 @@ nfsrvd_create(struct nfsrv_descript *nd,
 					goto nfsmout;
 				break;
 			case NFSCREATE_EXCLUSIVE:
-				NFSM_DISSECT(cp, u_char *, NFSX_VERF);
-				NFSBCOPY(cp, cverf, NFSX_VERF);
+				NFSM_DISSECT(tl, u_int32_t *, NFSX_VERF);
+				cverf[0] = *tl++;
+				cverf[1] = *tl;
 				exclusive_flag = 1;
 				break;
 			};
@@ -988,6 +989,10 @@ nfsrvd_create(struct nfsrv_descript *nd,
 			nd->nd_repstat = nfsvno_getattr(vp, &nva, nd->nd_cred,
 			    p);
 		vput(vp);
+		if (!nd->nd_repstat) {
+			tverf[0] = nva.na_atime.tv_sec;
+			tverf[1] = nva.na_atime.tv_nsec;
+		}
 	}
 	if (nd->nd_flag & ND_NFSV2) {
 		if (!nd->nd_repstat) {
@@ -995,8 +1000,8 @@ nfsrvd_create(struct nfsrv_descript *nd,
 			nfsrv_fillattr(nd, &nva);
 		}
 	} else {
-		if (exclusive_flag && !nd->nd_repstat &&
-			NFSBCMP(cverf, (caddr_t)&nva.na_atime, NFSX_VERF))
+		if (exclusive_flag && !nd->nd_repstat && (cverf[0] != tverf[0]
+		    || cverf[1] != tverf[1]))
 			nd->nd_repstat = EEXIST;
 		diraft_ret = nfsvno_getattr(dirp, &diraft, nd->nd_cred, p);
 		vrele(dirp);
@@ -2406,7 +2411,7 @@ nfsrvd_open(struct nfsrv_descript *nd, _
 	int error = 0, create, claim, exclusive_flag = 0;
 	u_int32_t rflags = NFSV4OPEN_LOCKTYPEPOSIX, acemask;
 	int how = NFSCREATE_UNCHECKED;
-	u_char cverf[NFSX_VERF];
+	int32_t cverf[2], tverf[2] = { 0, 0 };
 	vnode_t vp = NULL, dirp = NULL;
 	struct nfsvattr nva, dirfor, diraft;
 	struct nameidata named;
@@ -2517,7 +2522,8 @@ nfsrvd_open(struct nfsrv_descript *nd, _
 			break;
 		case NFSCREATE_EXCLUSIVE:
 			NFSM_DISSECT(tl, u_int32_t *, NFSX_VERF);
-			NFSBCOPY((caddr_t)tl, cverf, NFSX_VERF);
+			cverf[0] = *tl++;
+			cverf[1] = *tl;
 			break;
 		default:
 			nd->nd_repstat = NFSERR_BADXDR;
@@ -2677,10 +2683,15 @@ nfsrvd_open(struct nfsrv_descript *nd, _
 		    NFSACCCHK_VPISLOCKED);
 	}
 
-	if (!nd->nd_repstat)
+	if (!nd->nd_repstat) {
 		nd->nd_repstat = nfsvno_getattr(vp, &nva, nd->nd_cred, p);
-	if (!nd->nd_repstat && exclusive_flag &&
-	    NFSBCMP(cverf, (caddr_t)&nva.na_atime, NFSX_VERF))
+		if (!nd->nd_repstat) {
+			tverf[0] = nva.na_atime.tv_sec;
+			tverf[1] = nva.na_atime.tv_nsec;
+		}
+	}
+	if (!nd->nd_repstat && exclusive_flag && (cverf[0] != tverf[0] ||
+	    cverf[1] != tverf[1]))
 		nd->nd_repstat = EEXIST;
 	/*
 	 * Do the open locking/delegation stuff.

From owner-svn-src-head@FreeBSD.ORG  Fri Nov 20 22:22:53 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AC40D106568D;
	Fri, 20 Nov 2009 22:22:53 +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 9A1D68FC0A;
	Fri, 20 Nov 2009 22:22:53 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAKMMrZH058052;
	Fri, 20 Nov 2009 22:22:53 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAKMMr9J058050;
	Fri, 20 Nov 2009 22:22:53 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <200911202222.nAKMMr9J058050@svn.freebsd.org>
From: Konstantin Belousov 
Date: Fri, 20 Nov 2009 22:22: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: r199617 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 20 Nov 2009 22:22:53 -0000

Author: kib
Date: Fri Nov 20 22:22:53 2009
New Revision: 199617
URL: http://svn.freebsd.org/changeset/base/199617

Log:
  On the return path from F_RDAHEAD and F_READAHEAD fcntls, do not
  unlock Giant twice.
  
  While there, bring conditions in the do/while loops closer to style,
  that also makes the lines fit into 80 columns.
  
  Reported and tested by:	dougb

Modified:
  head/sys/kern/kern_descrip.c

Modified: head/sys/kern/kern_descrip.c
==============================================================================
--- head/sys/kern/kern_descrip.c	Fri Nov 20 21:21:13 2009	(r199616)
+++ head/sys/kern/kern_descrip.c	Fri Nov 20 22:22:53 2009	(r199617)
@@ -718,14 +718,15 @@ kern_fcntl(struct thread *td, int fd, in
 			do {
 				new = old = fp->f_flag;
 				new |= FRDAHEAD;
-			} while (atomic_cmpset_rel_int(&fp->f_flag, old, new) == 0);
+			} while (!atomic_cmpset_rel_int(&fp->f_flag, old, new));
 readahead_vnlock_fail:
 			VFS_UNLOCK_GIANT(vfslocked);
+			vfslocked = 0;
 		} else {
 			do {
 				new = old = fp->f_flag;
 				new &= ~FRDAHEAD;
-			} while (atomic_cmpset_rel_int(&fp->f_flag, old, new) == 0);
+			} while (!atomic_cmpset_rel_int(&fp->f_flag, old, new));
 		}
 		fdrop(fp, td);
 		break;

From owner-svn-src-head@FreeBSD.ORG  Sat Nov 21 00:19:09 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BD23A106566B;
	Sat, 21 Nov 2009 00:19:09 +0000 (UTC)
	(envelope-from jkim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A9CF28FC21;
	Sat, 21 Nov 2009 00:19:09 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAL0J9oW060530;
	Sat, 21 Nov 2009 00:19:09 GMT (envelope-from jkim@svn.freebsd.org)
Received: (from jkim@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAL0J91R060525;
	Sat, 21 Nov 2009 00:19:09 GMT (envelope-from jkim@svn.freebsd.org)
Message-Id: <200911210019.nAL0J91R060525@svn.freebsd.org>
From: Jung-uk Kim 
Date: Sat, 21 Nov 2009 00:19: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: r199619 - in head/sys: amd64/amd64 i386/i386
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 21 Nov 2009 00:19:09 -0000

Author: jkim
Date: Sat Nov 21 00:19:09 2009
New Revision: 199619
URL: http://svn.freebsd.org/changeset/base/199619

Log:
  Add an experimental and rudimentary JIT optimizer to reduce unncessary
  overhead from short BPF filter programs such as "get the first 96 bytes".

Modified:
  head/sys/amd64/amd64/bpf_jit_machdep.c
  head/sys/amd64/amd64/bpf_jit_machdep.h
  head/sys/i386/i386/bpf_jit_machdep.c
  head/sys/i386/i386/bpf_jit_machdep.h

Modified: head/sys/amd64/amd64/bpf_jit_machdep.c
==============================================================================
--- head/sys/amd64/amd64/bpf_jit_machdep.c	Fri Nov 20 23:14:08 2009	(r199618)
+++ head/sys/amd64/amd64/bpf_jit_machdep.c	Sat Nov 21 00:19:09 2009	(r199619)
@@ -57,18 +57,19 @@ __FBSDID("$FreeBSD$");
 bpf_filter_func	bpf_jit_compile(struct bpf_insn *, u_int, size_t *);
 
 /*
- * emit routine to update the jump table
+ * Emit routine to update the jump table.
  */
 static void
 emit_length(bpf_bin_stream *stream, __unused u_int value, u_int len)
 {
 
-	(stream->refs)[stream->bpf_pc] += len;
+	if (stream->refs != NULL)
+		(stream->refs)[stream->bpf_pc] += len;
 	stream->cur_ip += len;
 }
 
 /*
- * emit routine to output the actual binary code
+ * Emit routine to output the actual binary code.
  */
 static void
 emit_code(bpf_bin_stream *stream, u_int value, u_int len)
@@ -95,37 +96,79 @@ emit_code(bpf_bin_stream *stream, u_int 
 }
 
 /*
- * Function that does the real stuff
+ * Scan the filter program and find possible optimization.
+ */
+static int
+bpf_jit_optimize(struct bpf_insn *prog, u_int nins)
+{
+	const struct bpf_insn *p;
+	int flags;
+	u_int i;
+
+	/* Do we return immediately? */
+	if (BPF_CLASS(prog[0].code) == BPF_RET)
+		return (BPF_JIT_FLAG_RET);
+
+	for (flags = 0, i = 0; i < nins; i++) {
+		p = &prog[i];
+
+		/* Do we need reference table? */
+		if ((flags & BPF_JIT_FLAG_JMP) == 0 &&
+		    BPF_CLASS(p->code) == BPF_JMP)
+			flags |= BPF_JIT_FLAG_JMP;
+
+		/* Do we need scratch memory? */
+		if ((flags & BPF_JIT_FLAG_MEM) == 0 &&
+		    (p->code == BPF_ST || p->code == BPF_STX ||
+		    p->code == (BPF_LD|BPF_MEM) ||
+		    p->code == (BPF_LDX|BPF_MEM)))
+			flags |= BPF_JIT_FLAG_MEM;
+
+		if (flags == BPF_JIT_FLAG_ALL)
+			break;
+	}
+
+	return (flags);
+}
+
+/*
+ * Function that does the real stuff.
  */
 bpf_filter_func
 bpf_jit_compile(struct bpf_insn *prog, u_int nins, size_t *size)
 {
 	bpf_bin_stream stream;
 	struct bpf_insn *ins;
+	int flags, flag_ret, flag_jmp, flag_mem;
 	u_int i, pass;
 
+	flags = bpf_jit_optimize(prog, nins);
+	flag_ret = (flags & BPF_JIT_FLAG_RET) != 0;
+	flag_jmp = (flags & BPF_JIT_FLAG_JMP) != 0;
+	flag_mem = (flags & BPF_JIT_FLAG_MEM) != 0;
+
 	/*
 	 * NOTE: Do not modify the name of this variable, as it's used by
 	 * the macros to emit code.
 	 */
 	emit_func emitm;
 
+	memset(&stream, 0, sizeof(stream));
+
 	/* Allocate the reference table for the jumps. */
+	if (flag_jmp) {
 #ifdef _KERNEL
-	stream.refs = malloc((nins + 1) * sizeof(u_int), M_BPFJIT,
-	    M_NOWAIT | M_ZERO);
+		stream.refs = malloc((nins + 1) * sizeof(u_int), M_BPFJIT,
+		    M_NOWAIT | M_ZERO);
 #else
-	stream.refs = malloc((nins + 1) * sizeof(u_int));
+		stream.refs = malloc((nins + 1) * sizeof(u_int));
 #endif
-	if (stream.refs == NULL)
-		return (NULL);
+		if (stream.refs == NULL)
+			return (NULL);
 #ifndef _KERNEL
-	memset(stream.refs, 0, (nins + 1) * sizeof(u_int));
+		memset(stream.refs, 0, (nins + 1) * sizeof(u_int));
 #endif
-
-	stream.cur_ip = 0;
-	stream.bpf_pc = 0;
-	stream.ibuf = NULL;
+	}
 
 	/*
 	 * The first pass will emit the lengths of the instructions
@@ -137,12 +180,16 @@ bpf_jit_compile(struct bpf_insn *prog, u
 		ins = prog;
 
 		/* Create the procedure header. */
-		PUSH(RBP);
-		MOVrq(RSP, RBP);
-		SUBib(BPF_MEMWORDS * sizeof(uint32_t), RSP);
-		MOVrq2(RDI, R8);
-		MOVrd2(ESI, R9D);
-		MOVrd(EDX, EDI);
+		if (flag_mem) {
+			PUSH(RBP);
+			MOVrq(RSP, RBP);
+			SUBib(BPF_MEMWORDS * sizeof(uint32_t), RSP);
+		}
+		if (!flag_ret) {
+			MOVrq2(RDI, R8);
+			MOVrd2(ESI, R9D);
+			MOVrd(EDX, EDI);
+		}
 
 		for (i = 0; i < nins; i++) {
 			stream.bpf_pc++;
@@ -157,11 +204,15 @@ bpf_jit_compile(struct bpf_insn *prog, u
 
 			case BPF_RET|BPF_K:
 				MOVid(ins->k, EAX);
-				LEAVE_RET();
+				if (flag_mem)
+					LEAVE();
+				RET();
 				break;
 
 			case BPF_RET|BPF_A:
-				LEAVE_RET();
+				if (flag_mem)
+					LEAVE();
+				RET();
 				break;
 
 			case BPF_LD|BPF_W|BPF_ABS:
@@ -171,9 +222,15 @@ bpf_jit_compile(struct bpf_insn *prog, u
 				MOVrd(EDI, ECX);
 				SUBrd(ESI, ECX);
 				CMPid(sizeof(int32_t), ECX);
-				JAEb(4);
-				ZEROrd(EAX);
-				LEAVE_RET();
+				if (flag_mem) {
+					JAEb(4);
+					ZEROrd(EAX);
+					LEAVE();
+				} else {
+					JAEb(3);
+					ZEROrd(EAX);
+				}
+				RET();
 				MOVrq3(R8, RCX);
 				MOVobd(RCX, RSI, EAX);
 				BSWAP(EAX);
@@ -187,8 +244,12 @@ bpf_jit_compile(struct bpf_insn *prog, u
 				MOVrd(EDI, ECX);
 				SUBrd(ESI, ECX);
 				CMPid(sizeof(int16_t), ECX);
-				JAEb(2);
-				LEAVE_RET();
+				if (flag_mem) {
+					JAEb(2);
+					LEAVE();
+				} else
+					JAEb(1);
+				RET();
 				MOVrq3(R8, RCX);
 				MOVobw(RCX, RSI, AX);
 				SWAP_AX();
@@ -198,8 +259,12 @@ bpf_jit_compile(struct bpf_insn *prog, u
 				ZEROrd(EAX);
 				MOVid(ins->k, ESI);
 				CMPrd(EDI, ESI);
-				JBb(2);
-				LEAVE_RET();
+				if (flag_mem) {
+					JBb(2);
+					LEAVE();
+				} else
+					JBb(1);
+				RET();
 				MOVrq3(R8, RCX);
 				MOVobb(RCX, RSI, AL);
 				break;
@@ -224,9 +289,15 @@ bpf_jit_compile(struct bpf_insn *prog, u
 				MOVrd(EDI, ECX);
 				SUBrd(ESI, ECX);
 				CMPid(sizeof(int32_t), ECX);
-				JAEb(4);
-				ZEROrd(EAX);
-				LEAVE_RET();
+				if (flag_mem) {
+					JAEb(4);
+					ZEROrd(EAX);
+					LEAVE();
+				} else {
+					JAEb(3);
+					ZEROrd(EAX);
+				}
+				RET();
 				MOVrq3(R8, RCX);
 				MOVobd(RCX, RSI, EAX);
 				BSWAP(EAX);
@@ -245,8 +316,12 @@ bpf_jit_compile(struct bpf_insn *prog, u
 				MOVrd(EDI, ECX);
 				SUBrd(ESI, ECX);
 				CMPid(sizeof(int16_t), ECX);
-				JAEb(2);
-				LEAVE_RET();
+				if (flag_mem) {
+					JAEb(2);
+					LEAVE();
+				} else
+					JAEb(1);
+				RET();
 				MOVrq3(R8, RCX);
 				MOVobw(RCX, RSI, AX);
 				SWAP_AX();
@@ -260,8 +335,12 @@ bpf_jit_compile(struct bpf_insn *prog, u
 				MOVrd(EDI, ECX);
 				SUBrd(EDX, ECX);
 				CMPrd(ESI, ECX);
-				JAb(2);
-				LEAVE_RET();
+				if (flag_mem) {
+					JAb(2);
+					LEAVE();
+				} else
+					JAb(1);
+				RET();
 				MOVrq3(R8, RCX);
 				ADDrd(EDX, ESI);
 				MOVobb(RCX, RSI, AL);
@@ -270,9 +349,15 @@ bpf_jit_compile(struct bpf_insn *prog, u
 			case BPF_LDX|BPF_MSH|BPF_B:
 				MOVid(ins->k, ESI);
 				CMPrd(EDI, ESI);
-				JBb(4);
-				ZEROrd(EAX);
-				LEAVE_RET();
+				if (flag_mem) {
+					JBb(4);
+					ZEROrd(EAX);
+					LEAVE();
+				} else {
+					JBb(3);
+					ZEROrd(EAX);
+				}
+				RET();
 				ZEROrd(EDX);
 				MOVrq3(R8, RCX);
 				MOVobb(RCX, RSI, DL);
@@ -390,9 +475,15 @@ bpf_jit_compile(struct bpf_insn *prog, u
 
 			case BPF_ALU|BPF_DIV|BPF_X:
 				TESTrd(EDX, EDX);
-				JNEb(4);
-				ZEROrd(EAX);
-				LEAVE_RET();
+				if (flag_mem) {
+					JNEb(4);
+					ZEROrd(EAX);
+					LEAVE();
+				} else {
+					JNEb(3);
+					ZEROrd(EAX);
+				}
+				RET();
 				MOVrd(EDX, ECX);
 				ZEROrd(EDX);
 				DIVrd(ECX);
@@ -492,8 +583,9 @@ bpf_jit_compile(struct bpf_insn *prog, u
 		 * Modify the reference table to contain the offsets and
 		 * not the lengths of the instructions.
 		 */
-		for (i = 1; i < nins + 1; i++)
-			stream.refs[i] += stream.refs[i - 1];
+		if (flag_jmp)
+			for (i = 1; i < nins + 1; i++)
+				stream.refs[i] += stream.refs[i - 1];
 
 		/* Reset the counters. */
 		stream.cur_ip = 0;
@@ -507,10 +599,14 @@ bpf_jit_compile(struct bpf_insn *prog, u
 	 * The reference table is needed only during compilation,
 	 * now we can free it.
 	 */
+	if (flag_jmp)
 #ifdef _KERNEL
-	free(stream.refs, M_BPFJIT);
+		free(stream.refs, M_BPFJIT);
 #else
-	free(stream.refs);
+		free(stream.refs);
+#endif
+
+#ifndef _KERNEL
 	if (stream.ibuf != NULL &&
 	    mprotect(stream.ibuf, *size, PROT_READ | PROT_EXEC) != 0) {
 		munmap(stream.ibuf, *size);

Modified: head/sys/amd64/amd64/bpf_jit_machdep.h
==============================================================================
--- head/sys/amd64/amd64/bpf_jit_machdep.h	Fri Nov 20 23:14:08 2009	(r199618)
+++ head/sys/amd64/amd64/bpf_jit_machdep.h	Sat Nov 21 00:19:09 2009	(r199619)
@@ -85,7 +85,15 @@
 #define DL	2
 #define BL	3
 
-/* A stream of native binary code.*/
+/* Optimization flags */
+#define	BPF_JIT_FLAG_RET	0x01
+#define	BPF_JIT_FLAG_JMP	0x02
+#define	BPF_JIT_FLAG_MEM	0x04
+
+#define	BPF_JIT_FLAG_ALL	\
+    (BPF_JIT_FLAG_JMP | BPF_JIT_FLAG_MEM)
+
+/* A stream of native binary code */
 typedef struct bpf_bin_stream {
 	/* Current native instruction pointer. */
 	int		cur_ip;
@@ -117,7 +125,7 @@ typedef struct bpf_bin_stream {
 typedef void (*emit_func)(bpf_bin_stream *stream, u_int value, u_int n);
 
 /*
- * native Instruction Macros
+ * Native instruction macros
  */
 
 /* movl i32,r32 */
@@ -220,9 +228,14 @@ typedef void (*emit_func)(bpf_bin_stream
 	emitm(&stream, (5 << 4) | (0 << 3) | (r64 & 0x7), 1);		\
 } while (0)
 
-/* leave/ret */
-#define LEAVE_RET() do {						\
-	emitm(&stream, 0xc3c9, 2);					\
+/* leaveq */
+#define LEAVE() do {							\
+	emitm(&stream, 0xc9, 1);					\
+} while (0)
+
+/* retq */
+#define RET() do {							\
+	emitm(&stream, 0xc3, 1);					\
 } while (0)
 
 /* addl sr32,dr32 */

Modified: head/sys/i386/i386/bpf_jit_machdep.c
==============================================================================
--- head/sys/i386/i386/bpf_jit_machdep.c	Fri Nov 20 23:14:08 2009	(r199618)
+++ head/sys/i386/i386/bpf_jit_machdep.c	Sat Nov 21 00:19:09 2009	(r199619)
@@ -57,18 +57,19 @@ __FBSDID("$FreeBSD$");
 bpf_filter_func	bpf_jit_compile(struct bpf_insn *, u_int, size_t *);
 
 /*
- * emit routine to update the jump table
+ * Emit routine to update the jump table.
  */
 static void
 emit_length(bpf_bin_stream *stream, __unused u_int value, u_int len)
 {
 
-	(stream->refs)[stream->bpf_pc] += len;
+	if (stream->refs != NULL)
+		(stream->refs)[stream->bpf_pc] += len;
 	stream->cur_ip += len;
 }
 
 /*
- * emit routine to output the actual binary code
+ * Emit routine to output the actual binary code.
  */
 static void
 emit_code(bpf_bin_stream *stream, u_int value, u_int len)
@@ -95,37 +96,79 @@ emit_code(bpf_bin_stream *stream, u_int 
 }
 
 /*
- * Function that does the real stuff
+ * Scan the filter program and find possible optimization.
+ */
+static int
+bpf_jit_optimize(struct bpf_insn *prog, u_int nins)
+{
+	const struct bpf_insn *p;
+	int flags;
+	u_int i;
+
+	/* Do we return immediately? */
+	if (BPF_CLASS(prog[0].code) == BPF_RET)
+		return (BPF_JIT_FLAG_RET);
+
+	for (flags = 0, i = 0; i < nins; i++) {
+		p = &prog[i];
+
+		/* Do we need reference table? */
+		if ((flags & BPF_JIT_FLAG_JMP) == 0 &&
+		    BPF_CLASS(p->code) == BPF_JMP)
+			flags |= BPF_JIT_FLAG_JMP;
+
+		/* Do we need scratch memory? */
+		if ((flags & BPF_JIT_FLAG_MEM) == 0 &&
+		    (p->code == BPF_ST || p->code == BPF_STX ||
+		    p->code == (BPF_LD|BPF_MEM) ||
+		    p->code == (BPF_LDX|BPF_MEM)))
+			flags |= BPF_JIT_FLAG_MEM;
+
+		if (flags == BPF_JIT_FLAG_ALL)
+			break;
+	}
+
+	return (flags);
+}
+
+/*
+ * Function that does the real stuff.
  */
 bpf_filter_func
 bpf_jit_compile(struct bpf_insn *prog, u_int nins, size_t *size)
 {
 	bpf_bin_stream stream;
 	struct bpf_insn *ins;
+	int flags, flag_ret, flag_jmp, flag_mem;
 	u_int i, pass;
 
+	flags = bpf_jit_optimize(prog, nins);
+	flag_ret = (flags & BPF_JIT_FLAG_RET) != 0;
+	flag_jmp = (flags & BPF_JIT_FLAG_JMP) != 0;
+	flag_mem = (flags & BPF_JIT_FLAG_MEM) != 0;
+
 	/*
 	 * NOTE: Do not modify the name of this variable, as it's used by
 	 * the macros to emit code.
 	 */
 	emit_func emitm;
 
+	memset(&stream, 0, sizeof(stream));
+
 	/* Allocate the reference table for the jumps. */
+	if (flag_jmp) {
 #ifdef _KERNEL
-	stream.refs = malloc((nins + 1) * sizeof(u_int), M_BPFJIT,
-	    M_NOWAIT | M_ZERO);
+		stream.refs = malloc((nins + 1) * sizeof(u_int), M_BPFJIT,
+		    M_NOWAIT | M_ZERO);
 #else
-	stream.refs = malloc((nins + 1) * sizeof(u_int));
+		stream.refs = malloc((nins + 1) * sizeof(u_int));
 #endif
-	if (stream.refs == NULL)
-		return (NULL);
+		if (stream.refs == NULL)
+			return (NULL);
 #ifndef _KERNEL
-	memset(stream.refs, 0, (nins + 1) * sizeof(u_int));
+		memset(stream.refs, 0, (nins + 1) * sizeof(u_int));
 #endif
-
-	stream.cur_ip = 0;
-	stream.bpf_pc = 0;
-	stream.ibuf = NULL;
+	}
 
 	/*
 	 * The first pass will emit the lengths of the instructions
@@ -137,14 +180,19 @@ bpf_jit_compile(struct bpf_insn *prog, u
 		ins = prog;
 
 		/* Create the procedure header. */
-		PUSH(EBP);
-		MOVrd(ESP, EBP);
-		SUBib(BPF_MEMWORDS * sizeof(uint32_t), ESP);
-		PUSH(EDI);
-		PUSH(ESI);
-		PUSH(EBX);
-		MOVodd(8, EBP, EBX);
-		MOVodd(16, EBP, EDI);
+		if (!flag_ret) {
+			PUSH(EBP);
+			MOVrd(ESP, EBP);
+		}
+		if (flag_mem)
+			SUBib(BPF_MEMWORDS * sizeof(uint32_t), ESP);
+		if (!flag_ret) {
+			PUSH(EDI);
+			PUSH(ESI);
+			PUSH(EBX);
+			MOVodd(8, EBP, EBX);
+			MOVodd(16, EBP, EDI);
+		}
 
 		for (i = 0; i < nins; i++) {
 			stream.bpf_pc++;
@@ -159,17 +207,23 @@ bpf_jit_compile(struct bpf_insn *prog, u
 
 			case BPF_RET|BPF_K:
 				MOVid(ins->k, EAX);
-				POP(EBX);
-				POP(ESI);
-				POP(EDI);
-				LEAVE_RET();
+				if (!flag_ret) {
+					POP(EBX);
+					POP(ESI);
+					POP(EDI);
+					LEAVE();
+				}
+				RET();
 				break;
 
 			case BPF_RET|BPF_A:
-				POP(EBX);
-				POP(ESI);
-				POP(EDI);
-				LEAVE_RET();
+				if (!flag_ret) {
+					POP(EBX);
+					POP(ESI);
+					POP(EDI);
+					LEAVE();
+				}
+				RET();
 				break;
 
 			case BPF_LD|BPF_W|BPF_ABS:
@@ -184,7 +238,8 @@ bpf_jit_compile(struct bpf_insn *prog, u
 				POP(EBX);
 				POP(ESI);
 				POP(EDI);
-				LEAVE_RET();
+				LEAVE();
+				RET();
 				MOVobd(EBX, ESI, EAX);
 				BSWAP(EAX);
 				break;
@@ -201,7 +256,8 @@ bpf_jit_compile(struct bpf_insn *prog, u
 				POP(EBX);
 				POP(ESI);
 				POP(EDI);
-				LEAVE_RET();
+				LEAVE();
+				RET();
 				MOVobw(EBX, ESI, AX);
 				SWAP_AX();
 				break;
@@ -214,7 +270,8 @@ bpf_jit_compile(struct bpf_insn *prog, u
 				POP(EBX);
 				POP(ESI);
 				POP(EDI);
-				LEAVE_RET();
+				LEAVE();
+				RET();
 				MOVobb(EBX, ESI, AL);
 				break;
 
@@ -243,7 +300,8 @@ bpf_jit_compile(struct bpf_insn *prog, u
 				POP(EBX);
 				POP(ESI);
 				POP(EDI);
-				LEAVE_RET();
+				LEAVE();
+				RET();
 				MOVobd(EBX, ESI, EAX);
 				BSWAP(EAX);
 				break;
@@ -265,7 +323,8 @@ bpf_jit_compile(struct bpf_insn *prog, u
 				POP(EBX);
 				POP(ESI);
 				POP(EDI);
-				LEAVE_RET();
+				LEAVE();
+				RET();
 				MOVobw(EBX, ESI, AX);
 				SWAP_AX();
 				break;
@@ -282,7 +341,8 @@ bpf_jit_compile(struct bpf_insn *prog, u
 				POP(EBX);
 				POP(ESI);
 				POP(EDI);
-				LEAVE_RET();
+				LEAVE();
+				RET();
 				ADDrd(EDX, ESI);
 				MOVobb(EBX, ESI, AL);
 				break;
@@ -295,7 +355,8 @@ bpf_jit_compile(struct bpf_insn *prog, u
 				POP(EBX);
 				POP(ESI);
 				POP(EDI);
-				LEAVE_RET();
+				LEAVE();
+				RET();
 				ZEROrd(EDX);
 				MOVobb(EBX, ESI, DL);
 				ANDib(0x0f, DL);
@@ -425,7 +486,8 @@ bpf_jit_compile(struct bpf_insn *prog, u
 				POP(EBX);
 				POP(ESI);
 				POP(EDI);
-				LEAVE_RET();
+				LEAVE();
+				RET();
 				MOVrd(EDX, ECX);
 				ZEROrd(EDX);
 				DIVrd(ECX);
@@ -525,8 +587,9 @@ bpf_jit_compile(struct bpf_insn *prog, u
 		 * Modify the reference table to contain the offsets and
 		 * not the lengths of the instructions.
 		 */
-		for (i = 1; i < nins + 1; i++)
-			stream.refs[i] += stream.refs[i - 1];
+		if (flag_jmp)
+			for (i = 1; i < nins + 1; i++)
+				stream.refs[i] += stream.refs[i - 1];
 
 		/* Reset the counters. */
 		stream.cur_ip = 0;
@@ -540,10 +603,14 @@ bpf_jit_compile(struct bpf_insn *prog, u
 	 * The reference table is needed only during compilation,
 	 * now we can free it.
 	 */
+	if (flag_jmp)
 #ifdef _KERNEL
-	free(stream.refs, M_BPFJIT);
+		free(stream.refs, M_BPFJIT);
 #else
-	free(stream.refs);
+		free(stream.refs);
+#endif
+
+#ifndef _KERNEL
 	if (stream.ibuf != NULL &&
 	    mprotect(stream.ibuf, *size, PROT_READ | PROT_EXEC) != 0) {
 		munmap(stream.ibuf, *size);

Modified: head/sys/i386/i386/bpf_jit_machdep.h
==============================================================================
--- head/sys/i386/i386/bpf_jit_machdep.h	Fri Nov 20 23:14:08 2009	(r199618)
+++ head/sys/i386/i386/bpf_jit_machdep.h	Sat Nov 21 00:19:09 2009	(r199619)
@@ -60,7 +60,15 @@
 #define DL	2
 #define BL	3
 
-/* A stream of native binary code.*/
+/* Optimization flags */
+#define	BPF_JIT_FLAG_RET	0x01
+#define	BPF_JIT_FLAG_JMP	0x02
+#define	BPF_JIT_FLAG_MEM	0x04
+
+#define	BPF_JIT_FLAG_ALL	\
+    (BPF_JIT_FLAG_JMP | BPF_JIT_FLAG_MEM)
+
+/* A stream of native binary code */
 typedef struct bpf_bin_stream {
 	/* Current native instruction pointer. */
 	int		cur_ip;
@@ -92,7 +100,7 @@ typedef struct bpf_bin_stream {
 typedef void (*emit_func)(bpf_bin_stream *stream, u_int value, u_int n);
 
 /*
- * native Instruction Macros
+ * Native instruction macros
  */
 
 /* movl i32,r32 */
@@ -165,9 +173,14 @@ typedef void (*emit_func)(bpf_bin_stream
 	emitm(&stream, (5 << 4) | (1 << 3) | (r32 & 0x7), 1);		\
 } while (0)
 
-/* leave/ret */
-#define LEAVE_RET() do {						\
-	emitm(&stream, 0xc3c9, 2);					\
+/* leave */
+#define LEAVE() do {							\
+	emitm(&stream, 0xc9, 1);					\
+} while (0)
+
+/* ret */
+#define RET() do {							\
+	emitm(&stream, 0xc3, 1);					\
 } while (0)
 
 /* addl sr32,dr32 */

From owner-svn-src-head@FreeBSD.ORG  Sat Nov 21 01:43:22 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D2BCA106566B;
	Sat, 21 Nov 2009 01:43:22 +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 C1EE38FC0A;
	Sat, 21 Nov 2009 01:43:22 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAL1hMHN062262;
	Sat, 21 Nov 2009 01:43:22 GMT (envelope-from dougb@svn.freebsd.org)
Received: (from dougb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAL1hMx3062260;
	Sat, 21 Nov 2009 01:43:22 GMT (envelope-from dougb@svn.freebsd.org)
Message-Id: <200911210143.nAL1hMx3062260@svn.freebsd.org>
From: Doug Barton 
Date: Sat, 21 Nov 2009 01:43: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: r199621 - head
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 21 Nov 2009 01:43:22 -0000

Author: dougb
Date: Sat Nov 21 01:43:22 2009
New Revision: 199621
URL: http://svn.freebsd.org/changeset/base/199621

Log:
  Add a note that wpa_supplicant(8) may require a full world build to
  sync up with 20091109.

Modified:
  head/UPDATING

Modified: head/UPDATING
==============================================================================
--- head/UPDATING	Sat Nov 21 00:34:51 2009	(r199620)
+++ head/UPDATING	Sat Nov 21 01:43:22 2009	(r199621)
@@ -42,6 +42,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 9.
 	Applications that require wireless scan results (e.g. ifconfig(8))
 	from net80211 need to be recompiled.
 
+	Applications such as wpa_supplicant(8) may require a full world
+	build without using NO_CLEAN in order to get synchronized with the
+	new structure.
+
 20091025:
 	The iwn(4) driver has been updated to support the 5000 and 5150 series.
 	There's one kernel module for each firmware. Adding "device iwnfw"

From owner-svn-src-head@FreeBSD.ORG  Sat Nov 21 10:21:20 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7D9301065679;
	Sat, 21 Nov 2009 10:21:20 +0000 (UTC) (envelope-from ed@hoeg.nl)
Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211])
	by mx1.freebsd.org (Postfix) with ESMTP id 088F08FC12;
	Sat, 21 Nov 2009 10:21:19 +0000 (UTC)
Received: by palm.hoeg.nl (Postfix, from userid 1000)
	id EDB3B1CCDF; Sat, 21 Nov 2009 11:21:14 +0100 (CET)
Date: Sat, 21 Nov 2009 11:21:14 +0100
From: Ed Schouten 
To: Jung-uk Kim 
Message-ID: <20091121102114.GK64905@hoeg.nl>
References: <200911202112.nAKLCe35056653@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="W9OqCIgVwV7zeaDP"
Content-Disposition: inline
In-Reply-To: <200911202112.nAKLCe35056653@svn.freebsd.org>
User-Agent: Mutt/1.5.20 (2009-06-14)
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r199615 - in head/sys: amd64/amd64 i386/i386 net
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 21 Nov 2009 10:21:20 -0000


--W9OqCIgVwV7zeaDP
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi,

* Jung-uk Kim  wrote:
>  #ifdef _KERNEL
> -	stream.refs =3D malloc((nins + 1) * sizeof(u_int), M_BPFJIT, M_NOWAIT);
> +	stream.refs =3D malloc((nins + 1) * sizeof(u_int), M_BPFJIT,
> +	    M_NOWAIT | M_ZERO);
>  #else
>  	stream.refs =3D malloc((nins + 1) * sizeof(u_int));
>  #endif
>  	if (stream.refs =3D=3D NULL)
>  		return (NULL);
> -
> -	/* Reset the reference table */
> -	for (i =3D 0; i < nins + 1; i++)
> -		stream.refs[i] =3D 0;
> +#ifndef _KERNEL
> +	memset(stream.refs, 0, (nins + 1) * sizeof(u_int));
> +#endif

Can't we avoid the special case here by just calling calloc(3)?

--=20
 Ed Schouten 
 WWW: http://80386.nl/

--W9OqCIgVwV7zeaDP
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (FreeBSD)

iEUEARECAAYFAksHvxoACgkQ52SDGA2eCwX3AACXbZnEcesb8eGpyWsK170DcrR8
PQCfaJbjZBsrlFnuorOjDvoVAG8pNMM=
=AcwQ
-----END PGP SIGNATURE-----

--W9OqCIgVwV7zeaDP--

From owner-svn-src-head@FreeBSD.ORG  Sat Nov 21 10:46:50 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1FDB11065670;
	Sat, 21 Nov 2009 10:46:50 +0000 (UTC)
	(envelope-from netchild@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0E0B58FC08;
	Sat, 21 Nov 2009 10:46:50 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nALAkncq077649;
	Sat, 21 Nov 2009 10:46:49 GMT
	(envelope-from netchild@svn.freebsd.org)
Received: (from netchild@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nALAknkT077647;
	Sat, 21 Nov 2009 10:46:49 GMT
	(envelope-from netchild@svn.freebsd.org)
Message-Id: <200911211046.nALAknkT077647@svn.freebsd.org>
From: Alexander Leidinger 
Date: Sat, 21 Nov 2009 10:46: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: r199626 - head/sbin/ipfw
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 21 Nov 2009 10:46:50 -0000

Author: netchild
Date: Sat Nov 21 10:46:49 2009
New Revision: 199626
URL: http://svn.freebsd.org/changeset/base/199626

Log:
  Fix minor resource leak in a function.
  
  Reviewed by:	luigi
  MFC after:	1 week

Modified:
  head/sbin/ipfw/dummynet.c

Modified: head/sbin/ipfw/dummynet.c
==============================================================================
--- head/sbin/ipfw/dummynet.c	Sat Nov 21 06:13:29 2009	(r199625)
+++ head/sbin/ipfw/dummynet.c	Sat Nov 21 10:46:49 2009	(r199626)
@@ -650,6 +650,8 @@ load_extra_delays(const char *filename, 
 		}
 	}
 
+	fclose (f);
+
 	if (samples == -1) {
 	    warnx("'%s' not found, assuming 100", ED_TOK_SAMPLES);
 	    samples = 100;

From owner-svn-src-head@FreeBSD.ORG  Sat Nov 21 14:12:52 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5D0E8106566C;
	Sat, 21 Nov 2009 14:12:52 +0000 (UTC)
	(envelope-from stefanf@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4BEF48FC15;
	Sat, 21 Nov 2009 14:12:52 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nALECp35081558;
	Sat, 21 Nov 2009 14:12:51 GMT (envelope-from stefanf@svn.freebsd.org)
Received: (from stefanf@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nALECpZ4081556;
	Sat, 21 Nov 2009 14:12:51 GMT (envelope-from stefanf@svn.freebsd.org)
Message-Id: <200911211412.nALECpZ4081556@svn.freebsd.org>
From: Stefan Farfeleder 
Date: Sat, 21 Nov 2009 14:12: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: r199628 - head/tools/regression/bin/sh/builtins
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 21 Nov 2009 14:12:52 -0000

Author: stefanf
Date: Sat Nov 21 14:12:51 2009
New Revision: 199628
URL: http://svn.freebsd.org/changeset/base/199628

Log:
  Add a few very basic tests for cd -{L,P} and pwd -{L,P}.

Modified:
  head/tools/regression/bin/sh/builtins/cd1.0

Modified: head/tools/regression/bin/sh/builtins/cd1.0
==============================================================================
--- head/tools/regression/bin/sh/builtins/cd1.0	Sat Nov 21 12:38:45 2009	(r199627)
+++ head/tools/regression/bin/sh/builtins/cd1.0	Sat Nov 21 14:12:51 2009	(r199628)
@@ -1,17 +1,27 @@
 # $FreeBSD$
 set -e
 
-PDIR=${TMPDIR:-/tmp}
-cd ${PDIR}
-TMPDIR=$(mktemp -d sh-test.XXXXXX)
-chmod 0 ${TMPDIR}
+P=${TMPDIR:-/tmp}
+cd $P
+T=$(mktemp -d sh-test.XXXXXX)
 
-cd -L ${TMPDIR} 2>/dev/null && exit 1
-[ "${PWD}" = "${PDIR}" ]
-[ "$(pwd)" = "${PDIR}" ]
-cd -P ${TMPDIR} 2>/dev/null && exit 1
-[ "${PWD}" = "${PDIR}" ]
-[ "$(pwd)" = "${PDIR}" ]
+chmod 0 $T
+cd -L $T 2>/dev/null && exit 1
+[ "$PWD" = "$P" ]
+[ "$(pwd)" = "$P" ]
+cd -P $T 2>/dev/null && exit 1
+[ "$PWD" = "$P" ]
+[ "$(pwd)" = "$P" ]
 
-chmod 755 ${TMPDIR}
-rmdir ${TMPDIR}
+chmod 755 $T
+cd $T
+mkdir -p 1/2/3
+ln -s 1/2 link1
+ln -s 2/3 1/link2
+(cd -L 1/../1 && [ "$(pwd -L)" = "$P/$T/1" ])
+(cd -L link1 && [ "$(pwd -L)" = "$P/$T/link1" ])
+(cd -L link1 && [ "$(pwd -P)" = "$P/$T/1/2" ])
+(cd -P link1 && [ "$(pwd -L)" = "$P/$T/1/2" ])
+(cd -P link1 && [ "$(pwd -P)" = "$P/$T/1/2" ])
+
+rm -rf ${P}/${T}

From owner-svn-src-head@FreeBSD.ORG  Sat Nov 21 14:28:32 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E9BC6106566C;
	Sat, 21 Nov 2009 14:28:32 +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 CECCF8FC14;
	Sat, 21 Nov 2009 14:28:32 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nALESWOM082010;
	Sat, 21 Nov 2009 14:28:32 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nALESWpF082002;
	Sat, 21 Nov 2009 14:28:32 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <200911211428.nALESWpF082002@svn.freebsd.org>
From: Jilles Tjoelker 
Date: Sat, 21 Nov 2009 14:28: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: r199629 - head/bin/sh
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 21 Nov 2009 14:28:33 -0000

Author: jilles
Date: Sat Nov 21 14:28:32 2009
New Revision: 199629
URL: http://svn.freebsd.org/changeset/base/199629

Log:
  sh: Some changes to stderr flushing:
  * increase buffer size from 100 to 256 bytes
  * remove implied flush from out2str(), in particular this avoids unnecessary
    flushing in the middle of a -x tracing line
  * rename dprintf() to out2fmt_flush(), make it flush out2 and use this
    function in various places where flushing is desired after an error
    message

Modified:
  head/bin/sh/histedit.c
  head/bin/sh/input.c
  head/bin/sh/jobs.c
  head/bin/sh/main.c
  head/bin/sh/output.c
  head/bin/sh/output.h
  head/bin/sh/parser.c

Modified: head/bin/sh/histedit.c
==============================================================================
--- head/bin/sh/histedit.c	Sat Nov 21 14:12:51 2009	(r199628)
+++ head/bin/sh/histedit.c	Sat Nov 21 14:28:32 2009	(r199629)
@@ -92,7 +92,7 @@ histedit(void)
 			if (hist != NULL)
 				sethistsize(histsizeval());
 			else
-				out2str("sh: can't initialize history\n");
+				out2fmt_flush("sh: can't initialize history\n");
 		}
 		if (editing && !el && isatty(0)) { /* && isatty(2) ??? */
 			/*
@@ -114,7 +114,7 @@ histedit(void)
 				el_set(el, EL_PROMPT, getprompt);
 			} else {
 bad:
-				out2str("sh: can't initialize editing\n");
+				out2fmt_flush("sh: can't initialize editing\n");
 			}
 			INTON;
 		} else if (!editing && el) {
@@ -336,6 +336,7 @@ histcmd(int argc, char **argv)
 			if (sflg) {
 				if (displayhist) {
 					out2str(s);
+					flushout(out2);
 				}
 				evalstring(s, 0);
 				if (displayhist && hist) {

Modified: head/bin/sh/input.c
==============================================================================
--- head/bin/sh/input.c	Sat Nov 21 14:12:51 2009	(r199628)
+++ head/bin/sh/input.c	Sat Nov 21 14:28:32 2009	(r199629)
@@ -215,7 +215,7 @@ retry:
                                 if (flags >= 0 && flags & O_NONBLOCK) {
                                         flags &=~ O_NONBLOCK;
                                         if (fcntl(0, F_SETFL, flags) >= 0) {
-						out2str("sh: turning off NDELAY mode\n");
+						out2fmt_flush("sh: turning off NDELAY mode\n");
                                                 goto retry;
                                         }
                                 }
@@ -359,7 +359,7 @@ pushstring(char *s, int len, void *ap)
 	struct strpush *sp;
 
 	INTOFF;
-/*dprintf("*** calling pushstring: %s, %d\n", s, len);*/
+/*out2fmt_flush("*** calling pushstring: %s, %d\n", s, len);*/
 	if (parsefile->strpush) {
 		sp = ckmalloc(sizeof (struct strpush));
 		sp->prev = parsefile->strpush;
@@ -386,7 +386,7 @@ popstring(void)
 	parsenextc = sp->prevstring;
 	parsenleft = sp->prevnleft;
 	parselleft = sp->prevlleft;
-/*dprintf("*** calling popstring: restoring to '%s'\n", parsenextc);*/
+/*out2fmt_flush("*** calling popstring: restoring to '%s'\n", parsenextc);*/
 	if (sp->ap)
 		sp->ap->flag &= ~ALIASINUSE;
 	parsefile->strpush = sp->prev;

Modified: head/bin/sh/jobs.c
==============================================================================
--- head/bin/sh/jobs.c	Sat Nov 21 14:12:51 2009	(r199628)
+++ head/bin/sh/jobs.c	Sat Nov 21 14:28:32 2009	(r199629)
@@ -146,7 +146,7 @@ setjobctl(int on)
 		do { /* while we are in the background */
 			initialpgrp = tcgetpgrp(ttyfd);
 			if (initialpgrp < 0) {
-out:				out2str("sh: can't access tty; job control turned off\n");
+out:				out2fmt_flush("sh: can't access tty; job control turned off\n");
 				mflag = 0;
 				return;
 			}
@@ -1046,7 +1046,7 @@ stoppedjobs(void)
 		if (jp->used == 0)
 			continue;
 		if (jp->state == JOBSTOPPED) {
-			out2str("You have stopped jobs.\n");
+			out2fmt_flush("You have stopped jobs.\n");
 			job_warning = 2;
 			return (1);
 		}

Modified: head/bin/sh/main.c
==============================================================================
--- head/bin/sh/main.c	Sat Nov 21 14:12:51 2009	(r199628)
+++ head/bin/sh/main.c	Sat Nov 21 14:28:32 2009	(r199629)
@@ -154,7 +154,7 @@ main(int argc, char *argv[])
 	setstackmark(&smark);
 	procargs(argc, argv);
 	if (getpwd() == NULL && iflag)
-		out2str("sh: cannot determine working directory\n");
+		out2fmt_flush("sh: cannot determine working directory\n");
 	if (getpwd() != NULL)
 		setvar ("PWD", getpwd(), VEXPORT);
 	if (argv[0] && argv[0][0] == '-') {
@@ -223,7 +223,7 @@ cmdloop(int top)
 			if (!stoppedjobs()) {
 				if (!Iflag)
 					break;
-				out2str("\nUse \"exit\" to leave shell.\n");
+				out2fmt_flush("\nUse \"exit\" to leave shell.\n");
 			}
 			numeof++;
 		} else if (n != NULL && nflag == 0) {

Modified: head/bin/sh/output.c
==============================================================================
--- head/bin/sh/output.c	Sat Nov 21 14:12:51 2009	(r199628)
+++ head/bin/sh/output.c	Sat Nov 21 14:28:32 2009	(r199629)
@@ -71,7 +71,7 @@ __FBSDID("$FreeBSD$");
 static int doformat_wr(void *, const char *, int);
 
 struct output output = {NULL, 0, NULL, OUTBUFSIZ, 1, 0};
-struct output errout = {NULL, 0, NULL, 100, 2, 0};
+struct output errout = {NULL, 0, NULL, 256, 2, 0};
 struct output memout = {NULL, 0, NULL, 0, MEM_OUT, 0};
 struct output *out1 = &output;
 struct output *out2 = &errout;
@@ -124,8 +124,6 @@ outstr(const char *p, struct output *fil
 {
 	while (*p)
 		outc(*p++, file);
-	if (file == out2)
-		flushout(file);
 }
 
 /* Like outstr(), but quote for re-input into the shell. */
@@ -255,7 +253,7 @@ out1fmt(const char *fmt, ...)
 }
 
 void
-dprintf(const char *fmt, ...)
+out2fmt_flush(const char *fmt, ...)
 {
 	va_list ap;
 

Modified: head/bin/sh/output.h
==============================================================================
--- head/bin/sh/output.h	Sat Nov 21 14:12:51 2009	(r199628)
+++ head/bin/sh/output.h	Sat Nov 21 14:28:32 2009	(r199629)
@@ -65,7 +65,7 @@ void flushout(struct output *);
 void freestdout(void);
 void outfmt(struct output *, const char *, ...) __printflike(2, 3);
 void out1fmt(const char *, ...) __printflike(1, 2);
-void dprintf(const char *, ...) __printflike(1, 2);
+void out2fmt_flush(const char *, ...) __printflike(1, 2);
 void fmtstr(char *, int, const char *, ...) __printflike(3, 4);
 void doformat(struct output *, const char *, va_list) __printflike(2, 0);
 int xwrite(int, char *, int);

Modified: head/bin/sh/parser.c
==============================================================================
--- head/bin/sh/parser.c	Sat Nov 21 14:12:51 2009	(r199628)
+++ head/bin/sh/parser.c	Sat Nov 21 14:28:32 2009	(r199629)
@@ -1563,7 +1563,10 @@ setprompt(int which)
 #ifndef NO_HISTORY
 	if (!el)
 #endif
+	{
 		out2str(getprompt(NULL));
+		flushout(out2);
+	}
 }
 
 /*

From owner-svn-src-head@FreeBSD.ORG  Sat Nov 21 14:53:22 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C5C0910656A3;
	Sat, 21 Nov 2009 14:53:22 +0000 (UTC)
	(envelope-from stefanf@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B4EF48FC14;
	Sat, 21 Nov 2009 14:53:22 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nALErMtE082644;
	Sat, 21 Nov 2009 14:53:22 GMT (envelope-from stefanf@svn.freebsd.org)
Received: (from stefanf@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nALErMPf082642;
	Sat, 21 Nov 2009 14:53:22 GMT (envelope-from stefanf@svn.freebsd.org)
Message-Id: <200911211453.nALErMPf082642@svn.freebsd.org>
From: Stefan Farfeleder 
Date: Sat, 21 Nov 2009 14:53: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: r199631 - head/bin/sh
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 21 Nov 2009 14:53:22 -0000

Author: stefanf
Date: Sat Nov 21 14:53:22 2009
New Revision: 199631
URL: http://svn.freebsd.org/changeset/base/199631

Log:
  Handle current work directories of arbitrary length.  The argument to cd
  continues to be limited by PATH_MAX (1024).
  
  Obtained from:	NetBSD
  PR:		104456

Modified:
  head/bin/sh/cd.c

Modified: head/bin/sh/cd.c
==============================================================================
--- head/bin/sh/cd.c	Sat Nov 21 14:53:08 2009	(r199630)
+++ head/bin/sh/cd.c	Sat Nov 21 14:53:22 2009	(r199631)
@@ -70,7 +70,7 @@ STATIC int docd(char *, int, int);
 STATIC char *getcomponent(void);
 STATIC char *findcwd(char *);
 STATIC void updatepwd(char *);
-STATIC char *getpwd2(char *, size_t);
+STATIC char *getpwd2(void);
 
 STATIC char *curdir = NULL;	/* current working directory */
 STATIC char *prevdir;		/* previous working directory */
@@ -263,10 +263,8 @@ findcwd(char *dir)
 	 * any more because we traversed a symbolic link or something
 	 * we couldn't stat().
 	 */
-	if (dir == NULL || curdir == NULL)  {
-		p = stalloc(PATH_MAX);
-		return getpwd2(p, PATH_MAX);
-	}
+	if (dir == NULL || curdir == NULL)
+		return getpwd2();
 	cdcomppath = stalloc(strlen(dir) + 1);
 	scopy(dir, cdcomppath);
 	STARTSTACKSTR(new);
@@ -313,7 +311,7 @@ updatepwd(char *dir)
 int
 pwdcmd(int argc, char **argv)
 {
-	char buf[PATH_MAX];
+	char *p;
 	int ch, phys;
 
 	optreset = 1; optind = 1; opterr = 0; /* initialize getopt */
@@ -341,9 +339,9 @@ pwdcmd(int argc, char **argv)
 		out1str(curdir);
 		out1c('\n');
 	} else {
-		if (getcwd(buf, sizeof(buf)) == NULL)
+		if ((p = getpwd2()) == NULL)
 			error(".: %s", strerror(errno));
-		out1str(buf);
+		out1str(p);
 		out1c('\n');
 	}
 
@@ -356,36 +354,45 @@ pwdcmd(int argc, char **argv)
 char *
 getpwd(void)
 {
-	char buf[PATH_MAX];
 	char *p;
 
 	if (curdir)
 		return curdir;
 
-	p = getpwd2(buf, sizeof(buf));
+	p = getpwd2();
 	if (p != NULL)
 		curdir = savestr(p);
 
 	return curdir;
 }
 
+#define MAXPWD 256
+
 /*
  * Return the current directory.
  */
 STATIC char *
-getpwd2(char *buf, size_t size)
+getpwd2(void)
 {
-	if (getcwd(buf, size) == NULL) {
-		char *pwd = getenv("PWD");
-		struct stat stdot, stpwd;
-
-		if (pwd && *pwd == '/' && stat(".", &stdot) != -1 &&
-		    stat(pwd, &stpwd) != -1 &&
-		    stdot.st_dev == stpwd.st_dev &&
-		    stdot.st_ino == stpwd.st_ino) {
+	struct stat stdot, stpwd;
+	char *pwd;
+	int i;
+
+	for (i = MAXPWD;; i *= 2) {
+		pwd = stalloc(i);
+		if (getcwd(pwd, i) != NULL)
 			return pwd;
-		}
-		return NULL;
+		stunalloc(pwd);
+		if (errno != ERANGE)
+			break;
+	}
+
+	pwd = getenv("PWD");
+	if (pwd && *pwd == '/' && stat(".", &stdot) != -1 &&
+	    stat(pwd, &stpwd) != -1 &&
+	    stdot.st_dev == stpwd.st_dev &&
+	    stdot.st_ino == stpwd.st_ino) {
+		return pwd;
 	}
-	return buf;
+	return NULL;
 }

From owner-svn-src-head@FreeBSD.ORG  Sat Nov 21 14:54:36 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0B19D1065672;
	Sat, 21 Nov 2009 14:54:36 +0000 (UTC)
	(envelope-from stefanf@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id EE9278FC14;
	Sat, 21 Nov 2009 14:54:35 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nALEsZCN082722;
	Sat, 21 Nov 2009 14:54:35 GMT (envelope-from stefanf@svn.freebsd.org)
Received: (from stefanf@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nALEsZd2082720;
	Sat, 21 Nov 2009 14:54:35 GMT (envelope-from stefanf@svn.freebsd.org)
Message-Id: <200911211454.nALEsZd2082720@svn.freebsd.org>
From: Stefan Farfeleder 
Date: Sat, 21 Nov 2009 14:54: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: r199632 - head/tools/regression/bin/sh/builtins
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 21 Nov 2009 14:54:36 -0000

Author: stefanf
Date: Sat Nov 21 14:54:35 2009
New Revision: 199632
URL: http://svn.freebsd.org/changeset/base/199632

Log:
  Add a test for r199631.

Added:
  head/tools/regression/bin/sh/builtins/cd2.0   (contents, props changed)

Added: head/tools/regression/bin/sh/builtins/cd2.0
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/regression/bin/sh/builtins/cd2.0	Sat Nov 21 14:54:35 2009	(r199632)
@@ -0,0 +1,15 @@
+# $FreeBSD$
+set -e
+
+T=$(mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXX)
+cd $T
+D=$T
+for i in 0 1 2 3 4 5 6 7 8 9; do
+	for j in 0 1 2 3 4 5 6 7 8 9; do
+		mkdir veryverylongdirectoryname
+		cd veryverylongdirectoryname
+		D=$D/veryverylongdirectoryname
+	done
+done
+[ $(pwd | wc -c) -eq $((${#D} + 1)) ] # +\n
+rm -rf ${T}

From owner-svn-src-head@FreeBSD.ORG  Sat Nov 21 20:44:34 2009
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DAA811065670;
	Sat, 21 Nov 2009 20:44:34 +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 C96DB8FC08;
	Sat, 21 Nov 2009 20:44:34 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nALKiY0o096986;
	Sat, 21 Nov 2009 20:44:34 GMT (envelope-from jilles@svn.freebsd.org)
Received: (from jilles@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id nALKiYhH096983;
	Sat, 21 Nov 2009 20:44:34 GMT (envelope-from jilles@svn.freebsd.org)
Message-Id: <200911212044.nALKiYhH096983@svn.freebsd.org>
From: Jilles Tjoelker 
Date: Sat, 21 Nov 2009 20:44: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: r199641 - in head: bin/sh
	tools/regression/bin/sh/builtins
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 21 Nov 2009 20:44:35 -0000

Author: jilles
Date: Sat Nov 21 20:44:34 2009
New Revision: 199641
URL: http://svn.freebsd.org/changeset/base/199641

Log:
  trap: do not consider a bad signal name a fatal error.
  POSIX explicitly prescribes this.
  Continue processing any other signals and return status 1.

Added:
  head/tools/regression/bin/sh/builtins/trap3.0   (contents, props changed)
Modified:
  head/bin/sh/trap.c

Modified: head/bin/sh/trap.c
==============================================================================
--- head/bin/sh/trap.c	Sat Nov 21 17:11:51 2009	(r199640)
+++ head/bin/sh/trap.c	Sat Nov 21 20:44:34 2009	(r199641)
@@ -149,6 +149,7 @@ trapcmd(int argc, char **argv)
 {
 	char *action;
 	int signo;
+	int errors = 0;
 
 	if (argc <= 1) {
 		for (signo = 0 ; signo < sys_nsig ; signo++) {
@@ -183,8 +184,10 @@ trapcmd(int argc, char **argv)
 		}
 	}
 	while (*argv) {
-		if ((signo = sigstring_to_signum(*argv)) == -1)
-			error("bad signal %s", *argv);
+		if ((signo = sigstring_to_signum(*argv)) == -1) {
+			out2fmt_flush("trap: bad signal %s\n", *argv);
+			errors = 1;
+		}
 		INTOFF;
 		if (action)
 			action = savestr(action);
@@ -196,7 +199,7 @@ trapcmd(int argc, char **argv)
 		INTON;
 		argv++;
 	}
-	return 0;
+	return errors;
 }
 
 

Added: head/tools/regression/bin/sh/builtins/trap3.0
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/regression/bin/sh/builtins/trap3.0	Sat Nov 21 20:44:34 2009	(r199641)
@@ -0,0 +1,12 @@
+# $FreeBSD$
+
+{
+	trap '' garbage && exit 3
+	trap - garbage && exit 3
+	trap true garbage && exit 3
+	trap '' 99999 && exit 3
+	trap - 99999 && exit 3
+	trap true 99999 && exit 3
+} 2>/dev/null
+test -n "$(trap true garbage TERM 2>/dev/null || trap)" || exit 3
+exit 0